Re: [PATCH v2 1/7] config: use $EGREP instead of egrep

2022-07-07 Thread Eric Gallager via Gcc-patches
On Mon, Jun 27, 2022 at 2:07 AM Xi Ruoyao via Gcc-patches
 wrote:
>
> egrep has been deprecated in favor of grep -E for a long time, and the
> next GNU grep release (3.8 or 4.0) will print a warning if egrep is used.
> Unfortunately, old hosts with non-GNU grep may lack the support for -E
> option.  Use AC_PROG_EGREP and $EGREP variable so we'll work fine on
> both old and new platforms.
>
> ChangeLog:
>
> * configure.ac: Call AC_PROG_EGREP, and use $EGREP instead of
> egrep.
> * config.rpath: Use $EGREP instead of egrep.

config.rpath is imported from gnulib where this problem is already
fixed apparently; wouldn't it make more sense to re-import a fresh
config.rpath from upstream gnulib instead of patching GCC's local
copy?


> * configure: Regenerate.
>
> config/ChangeLog:
>
> * lib-ld.m4 (AC_LIB_PROG_LD_GNU): Call AC_PROG_EGREP, and use
> $EGREP instead of egrep.
> (acl_cv_path_LD): Likewise.
> * lib-link.m4 (AC_LIB_RPATH): Call AC_PROG_EGREP, and pass
> $EGREP to config.rpath.
>
> gcc/ChangeLog:
>
> * configure: Regenerate.
>
> intl/ChangeLog:
>
> * configure: Regenerate.
>
> libcpp/ChangeLog:
>
> * configure: Regenerate.
>
> libgcc/ChangeLog:
>
> * configure: Regenerate.
>
> libstdc++-v3/ChangeLog:
>
> * configure: Regenerate.
> ---
>  config.rpath   |  10 +--
>  config/lib-ld.m4   |   6 +-
>  config/lib-link.m4 |   4 +-
>  configure  | 136 -
>  configure.ac   |   5 +-
>  gcc/configure  |  13 ++--
>  intl/configure |   9 +--
>  libcpp/configure   |   9 +--
>  libgcc/configure   |   2 +-
>  libstdc++-v3/configure |   9 +--
>  10 files changed, 172 insertions(+), 31 deletions(-)
>
> diff --git a/config.rpath b/config.rpath
> index 4dea75957c2..4ada7468c22 100755
> --- a/config.rpath
> +++ b/config.rpath
> @@ -29,7 +29,7 @@
>  #CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
>  # or
>  #CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
> -# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
> +# The environment variables CC, GCC, EGREP, LDFLAGS, LD, with_gnu_ld
>  # should be set by the caller.
>  #
>  # The set of defined variables is at the end of this script.
> @@ -143,7 +143,7 @@ if test "$with_gnu_ld" = yes; then
>ld_shlibs=no
>;;
>  beos*)
> -  if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; 
> then
> +  if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null; 
> then
>  :
>else
>  ld_shlibs=no
> @@ -162,9 +162,9 @@ if test "$with_gnu_ld" = yes; then
>  netbsd*)
>;;
>  solaris* | sysv5*)
> -  if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
> +  if $LD -v 2>&1 | $EGREP 'BFD 2\.8' > /dev/null; then
>  ld_shlibs=no
> -  elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; 
> then
> +  elif $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > 
> /dev/null; then
>  :
>else
>  ld_shlibs=no
> @@ -174,7 +174,7 @@ if test "$with_gnu_ld" = yes; then
>hardcode_direct=yes
>;;
>  *)
> -  if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; 
> then
> +  if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null; 
> then
>  :
>else
>  ld_shlibs=no
> diff --git a/config/lib-ld.m4 b/config/lib-ld.m4
> index 11d0ce77342..88a014b7a74 100644
> --- a/config/lib-ld.m4
> +++ b/config/lib-ld.m4
> @@ -14,7 +14,8 @@ dnl From libtool-1.4. Sets the variable with_gnu_ld to yes 
> or no.
>  AC_DEFUN([AC_LIB_PROG_LD_GNU],
>  [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
>  [# I'd rather use --version here, but apparently some GNU ld's only accept 
> -v.
> -if $LD -v 2>&1 &5; then
> +AC_REQUIRE([AC_PROG_EGREP])dnl
> +if $LD -v 2>&1 &5; then
>acl_cv_prog_gnu_ld=yes
>  else
>acl_cv_prog_gnu_ld=no
> @@ -28,6 +29,7 @@ AC_DEFUN([AC_LIB_PROG_LD],
>  [  --with-gnu-ld   assume the C compiler uses GNU ld [default=no]],
>  test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
>  AC_REQUIRE([AC_PROG_CC])dnl
> +AC_REQUIRE([AC_PROG_EGREP])dnl
>  AC_REQUIRE([AC_CANONICAL_HOST])dnl
>  # Prepare PATH_SEPARATOR.
>  # The user is always right.
> @@ -88,7 +90,7 @@ AC_CACHE_VAL(acl_cv_path_LD,
># Check to see if the program is GNU ld.  I'd rather use --version,
># but apparently some GNU ld's only accept -v.
># Break only if it was the GNU/non-GNU ld that we prefer.
> -  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > 
> /dev/null; then
> +  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' > 
> /dev/null; then
> test "$with_gnu_ld" != no && break
>else
> test "$with_gnu_ld" != yes && break
> diff --git a/config/lib-link.m4 b/config/lib-link.m4
> index 

Re: [PATCH v2 1/7] config: use $EGREP instead of egrep

2022-07-04 Thread Hans-Peter Nilsson
On Mon, 27 Jun 2022, Xi Ruoyao via Gcc-patches wrote:
> egrep has been deprecated in favor of grep -E for a long time, and the
> next GNU grep release (3.8 or 4.0) will print a warning if egrep is used.
> Unfortunately, old hosts with non-GNU grep may lack the support for -E
> option.  Use AC_PROG_EGREP and $EGREP variable so we'll work fine on
> both old and new platforms.
>
> ChangeLog:
>
>   * configure.ac: Call AC_PROG_EGREP, and use $EGREP instead of
>   egrep.

Nit of the day:

> diff --git a/config/lib-link.m4 b/config/lib-link.m4
> index 20e281fd323..5bbbd999de0 100644
> --- a/config/lib-link.m4
> +++ b/config/lib-link.m4
> @@ -99,8 +99,10 @@ AC_DEFUN([AC_LIB_RPATH],
>AC_REQUIRE([AC_LIB_PROG_LD])dnl we use $LD, $with_gnu_ld
>AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
>AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
> +  AC_REQUIRE([AC_PROG_EGREP]) dnl we use $GREP

Shouldn't that be "we use $EGREP"?

brgds, H-P


[PATCH v2 1/7] config: use $EGREP instead of egrep

2022-06-27 Thread Xi Ruoyao via Gcc-patches
egrep has been deprecated in favor of grep -E for a long time, and the
next GNU grep release (3.8 or 4.0) will print a warning if egrep is used.
Unfortunately, old hosts with non-GNU grep may lack the support for -E
option.  Use AC_PROG_EGREP and $EGREP variable so we'll work fine on
both old and new platforms.

ChangeLog:

* configure.ac: Call AC_PROG_EGREP, and use $EGREP instead of
egrep.
* config.rpath: Use $EGREP instead of egrep.
* configure: Regenerate.

config/ChangeLog:

* lib-ld.m4 (AC_LIB_PROG_LD_GNU): Call AC_PROG_EGREP, and use
$EGREP instead of egrep.
(acl_cv_path_LD): Likewise.
* lib-link.m4 (AC_LIB_RPATH): Call AC_PROG_EGREP, and pass
$EGREP to config.rpath.

gcc/ChangeLog:

* configure: Regenerate.

intl/ChangeLog:

* configure: Regenerate.

libcpp/ChangeLog:

* configure: Regenerate.

libgcc/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.
---
 config.rpath   |  10 +--
 config/lib-ld.m4   |   6 +-
 config/lib-link.m4 |   4 +-
 configure  | 136 -
 configure.ac   |   5 +-
 gcc/configure  |  13 ++--
 intl/configure |   9 +--
 libcpp/configure   |   9 +--
 libgcc/configure   |   2 +-
 libstdc++-v3/configure |   9 +--
 10 files changed, 172 insertions(+), 31 deletions(-)

diff --git a/config.rpath b/config.rpath
index 4dea75957c2..4ada7468c22 100755
--- a/config.rpath
+++ b/config.rpath
@@ -29,7 +29,7 @@
 #CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
 # or
 #CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# The environment variables CC, GCC, EGREP, LDFLAGS, LD, with_gnu_ld
 # should be set by the caller.
 #
 # The set of defined variables is at the end of this script.
@@ -143,7 +143,7 @@ if test "$with_gnu_ld" = yes; then
   ld_shlibs=no
   ;;
 beos*)
-  if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+  if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null; 
then
 :
   else
 ld_shlibs=no
@@ -162,9 +162,9 @@ if test "$with_gnu_ld" = yes; then
 netbsd*)
   ;;
 solaris* | sysv5*)
-  if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+  if $LD -v 2>&1 | $EGREP 'BFD 2\.8' > /dev/null; then
 ld_shlibs=no
-  elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; 
then
+  elif $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null; 
then
 :
   else
 ld_shlibs=no
@@ -174,7 +174,7 @@ if test "$with_gnu_ld" = yes; then
   hardcode_direct=yes
   ;;
 *)
-  if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+  if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null; 
then
 :
   else
 ld_shlibs=no
diff --git a/config/lib-ld.m4 b/config/lib-ld.m4
index 11d0ce77342..88a014b7a74 100644
--- a/config/lib-ld.m4
+++ b/config/lib-ld.m4
@@ -14,7 +14,8 @@ dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or 
no.
 AC_DEFUN([AC_LIB_PROG_LD_GNU],
 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 &5; then
+AC_REQUIRE([AC_PROG_EGREP])dnl
+if $LD -v 2>&1 &5; then
   acl_cv_prog_gnu_ld=yes
 else
   acl_cv_prog_gnu_ld=no
@@ -28,6 +29,7 @@ AC_DEFUN([AC_LIB_PROG_LD],
 [  --with-gnu-ld   assume the C compiler uses GNU ld [default=no]],
 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
 AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_EGREP])dnl
 AC_REQUIRE([AC_CANONICAL_HOST])dnl
 # Prepare PATH_SEPARATOR.
 # The user is always right.
@@ -88,7 +90,7 @@ AC_CACHE_VAL(acl_cv_path_LD,
   # Check to see if the program is GNU ld.  I'd rather use --version,
   # but apparently some GNU ld's only accept -v.
   # Break only if it was the GNU/non-GNU ld that we prefer.
-  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > 
/dev/null; then
+  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' > 
/dev/null; then
test "$with_gnu_ld" != no && break
   else
test "$with_gnu_ld" != yes && break
diff --git a/config/lib-link.m4 b/config/lib-link.m4
index 20e281fd323..5bbbd999de0 100644
--- a/config/lib-link.m4
+++ b/config/lib-link.m4
@@ -99,8 +99,10 @@ AC_DEFUN([AC_LIB_RPATH],
   AC_REQUIRE([AC_LIB_PROG_LD])dnl we use $LD, $with_gnu_ld
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+  AC_REQUIRE([AC_PROG_EGREP]) dnl we use $GREP
   AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
-CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" 
\
+