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

Message ID 227ea157c8576df47a9d016f5f25b7c6feaee53e.camel@xry111.site
State New
Headers
Series Avoid using obsoleted egrep/fgrep |

Commit Message

Xi Ruoyao June 27, 2022, 6:07 a.m. UTC
  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(-)
  

Comments

Hans-Peter Nilsson July 5, 2022, 12:58 a.m. UTC | #1
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
  
Eric Gallager July 8, 2022, 3:46 a.m. UTC | #2
On Mon, Jun 27, 2022 at 2:07 AM Xi Ruoyao via Gcc-patches
<gcc-patches@gcc.gnu.org> 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 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +AC_REQUIRE([AC_PROG_EGREP])dnl
> +if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 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" \
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" EGREP="$EGREP" \
> +    with_gnu_ld="$with_gnu_ld" \
>      ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
>      . ./conftest.sh
>      rm -f ./conftest.sh
> diff --git a/configure b/configure
> index 5dcaab14ae9..e0f9a0708ea 100755
> --- a/configure
> +++ b/configure
> @@ -724,6 +724,8 @@ target_subdir
>  host_subdir
>  build_subdir
>  build_libsubdir
> +EGREP
> +GREP
>  AWK
>  SED
>  LN_S
> @@ -2763,6 +2765,136 @@ fi
>    test -n "$AWK" && break
>  done
>
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
> +$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
> +if ${ac_cv_path_GREP+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -z "$GREP"; then
> +  ac_path_GREP_found=false
> +  # Loop through the user's path and test for each of PROGNAME-LIST
> +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
> +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
> +do
> +  IFS=$as_save_IFS
> +  test -z "$as_dir" && as_dir=.
> +    for ac_prog in grep ggrep; do
> +    for ac_exec_ext in '' $ac_executable_extensions; do
> +      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
> +      as_fn_executable_p "$ac_path_GREP" || continue
> +# Check for GNU ac_path_GREP and select it if it is found.
> +  # Check for GNU $ac_path_GREP
> +case `"$ac_path_GREP" --version 2>&1` in
> +*GNU*)
> +  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
> +*)
> +  ac_count=0
> +  $as_echo_n 0123456789 >"conftest.in"
> +  while :
> +  do
> +    cat "conftest.in" "conftest.in" >"conftest.tmp"
> +    mv "conftest.tmp" "conftest.in"
> +    cp "conftest.in" "conftest.nl"
> +    $as_echo 'GREP' >> "conftest.nl"
> +    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
> +    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
> +    as_fn_arith $ac_count + 1 && ac_count=$as_val
> +    if test $ac_count -gt ${ac_path_GREP_max-0}; then
> +      # Best one so far, save it but keep looking for a better one
> +      ac_cv_path_GREP="$ac_path_GREP"
> +      ac_path_GREP_max=$ac_count
> +    fi
> +    # 10*(2^10) chars as input seems more than enough
> +    test $ac_count -gt 10 && break
> +  done
> +  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
> +esac
> +
> +      $ac_path_GREP_found && break 3
> +    done
> +  done
> +  done
> +IFS=$as_save_IFS
> +  if test -z "$ac_cv_path_GREP"; then
> +    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
> +  fi
> +else
> +  ac_cv_path_GREP=$GREP
> +fi
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
> +$as_echo "$ac_cv_path_GREP" >&6; }
> + GREP="$ac_cv_path_GREP"
> +
> +
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
> +$as_echo_n "checking for egrep... " >&6; }
> +if ${ac_cv_path_EGREP+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
> +   then ac_cv_path_EGREP="$GREP -E"
> +   else
> +     if test -z "$EGREP"; then
> +  ac_path_EGREP_found=false
> +  # Loop through the user's path and test for each of PROGNAME-LIST
> +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
> +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
> +do
> +  IFS=$as_save_IFS
> +  test -z "$as_dir" && as_dir=.
> +    for ac_prog in egrep; do
> +    for ac_exec_ext in '' $ac_executable_extensions; do
> +      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
> +      as_fn_executable_p "$ac_path_EGREP" || continue
> +# Check for GNU ac_path_EGREP and select it if it is found.
> +  # Check for GNU $ac_path_EGREP
> +case `"$ac_path_EGREP" --version 2>&1` in
> +*GNU*)
> +  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
> +*)
> +  ac_count=0
> +  $as_echo_n 0123456789 >"conftest.in"
> +  while :
> +  do
> +    cat "conftest.in" "conftest.in" >"conftest.tmp"
> +    mv "conftest.tmp" "conftest.in"
> +    cp "conftest.in" "conftest.nl"
> +    $as_echo 'EGREP' >> "conftest.nl"
> +    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
> +    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
> +    as_fn_arith $ac_count + 1 && ac_count=$as_val
> +    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
> +      # Best one so far, save it but keep looking for a better one
> +      ac_cv_path_EGREP="$ac_path_EGREP"
> +      ac_path_EGREP_max=$ac_count
> +    fi
> +    # 10*(2^10) chars as input seems more than enough
> +    test $ac_count -gt 10 && break
> +  done
> +  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
> +esac
> +
> +      $ac_path_EGREP_found && break 3
> +    done
> +  done
> +  done
> +IFS=$as_save_IFS
> +  if test -z "$ac_cv_path_EGREP"; then
> +    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
> +  fi
> +else
> +  ac_cv_path_EGREP=$EGREP
> +fi
> +
> +   fi
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
> +$as_echo "$ac_cv_path_EGREP" >&6; }
> + EGREP="$ac_cv_path_EGREP"
> +
> +
>
>  srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
>
> @@ -9448,7 +9580,7 @@ if test x${use_gnu_as} = x &&
>  fi
>
>  if test x${use_gnu_ld} = x &&
> -   echo " ${configdirs} " | egrep " (go)?ld " > /dev/null 2>&1 ; then
> +   echo " ${configdirs} " | $EGREP " (go)?ld " > /dev/null 2>&1 ; then
>    with_gnu_ld=yes
>    extra_host_args="$extra_host_args --with-gnu-ld"
>  fi
> @@ -10620,7 +10752,7 @@ case " $build_configdirs " in
>      # For an installed makeinfo, we require it to be from texinfo 4.7 or
>      # higher, else we use the "missing" dummy.
>      if ${MAKEINFO} --version \
> -       | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
> +       | $EGREP 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
>        :
>      else
>        MAKEINFO="$MISSING makeinfo"
> diff --git a/configure.ac b/configure.ac
> index 85977482aee..19d34edba1c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -88,6 +88,7 @@ ACX_PROG_LN
>  AC_PROG_LN_S
>  AC_PROG_SED
>  AC_PROG_AWK
> +AC_PROG_EGREP
>
>  srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
>
> @@ -2634,7 +2635,7 @@ if test x${use_gnu_as} = x &&
>  fi
>
>  if test x${use_gnu_ld} = x &&
> -   echo " ${configdirs} " | egrep " (go)?ld " > /dev/null 2>&1 ; then
> +   echo " ${configdirs} " | $EGREP " (go)?ld " > /dev/null 2>&1 ; then
>    with_gnu_ld=yes
>    extra_host_args="$extra_host_args --with-gnu-ld"
>  fi
> @@ -3549,7 +3550,7 @@ changequote(,)
>      # For an installed makeinfo, we require it to be from texinfo 4.7 or
>      # higher, else we use the "missing" dummy.
>      if ${MAKEINFO} --version \
> -       | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
> +       | $EGREP 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
>        :
>      else
>        MAKEINFO="$MISSING makeinfo"
> diff --git a/gcc/configure b/gcc/configure
> index f43dc989d02..c58ec9b2273 100755
> --- a/gcc/configure
> +++ b/gcc/configure
> @@ -11160,7 +11160,7 @@ else
>        # 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
> @@ -11188,7 +11188,7 @@ if ${acl_cv_prog_gnu_ld+:} false; then :
>    $as_echo_n "(cached) " >&6
>  else
>    # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 1>&5; then
>    acl_cv_prog_gnu_ld=yes
>  else
>    acl_cv_prog_gnu_ld=no
> @@ -11200,13 +11200,14 @@ with_gnu_ld=$acl_cv_prog_gnu_ld
>
>
>
> -                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
> +                                                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
>  $as_echo_n "checking for shared library run path origin... " >&6; }
>  if ${acl_cv_rpath+:} false; then :
>    $as_echo_n "(cached) " >&6
>  else
>
> -    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" EGREP="$EGREP" \
> +    with_gnu_ld="$with_gnu_ld" \
>      ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
>      . ./conftest.sh
>      rm -f ./conftest.sh
> @@ -19674,7 +19675,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 19679 "configure"
> +#line 19678 "configure"
>  #include "confdefs.h"
>
>  #if HAVE_DLFCN_H
> @@ -19780,7 +19781,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 19785 "configure"
> +#line 19784 "configure"
>  #include "confdefs.h"
>
>  #if HAVE_DLFCN_H
> diff --git a/intl/configure b/intl/configure
> index 03f40487a92..3caa5a51940 100755
> --- a/intl/configure
> +++ b/intl/configure
> @@ -5090,7 +5090,7 @@ else
>        # 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
> @@ -5118,7 +5118,7 @@ if ${acl_cv_prog_gnu_ld+:} false; then :
>    $as_echo_n "(cached) " >&6
>  else
>    # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 1>&5; then
>    acl_cv_prog_gnu_ld=yes
>  else
>    acl_cv_prog_gnu_ld=no
> @@ -5130,13 +5130,14 @@ with_gnu_ld=$acl_cv_prog_gnu_ld
>
>
>
> -                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
> +                                                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
>  $as_echo_n "checking for shared library run path origin... " >&6; }
>  if ${acl_cv_rpath+:} false; then :
>    $as_echo_n "(cached) " >&6
>  else
>
> -    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" EGREP="$EGREP" \
> +    with_gnu_ld="$with_gnu_ld" \
>      ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
>      . ./conftest.sh
>      rm -f ./conftest.sh
> diff --git a/libcpp/configure b/libcpp/configure
> index 75145390215..800b0bad595 100755
> --- a/libcpp/configure
> +++ b/libcpp/configure
> @@ -6807,7 +6807,7 @@ else
>        # 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
> @@ -6835,7 +6835,7 @@ if ${acl_cv_prog_gnu_ld+:} false; then :
>    $as_echo_n "(cached) " >&6
>  else
>    # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 1>&5; then
>    acl_cv_prog_gnu_ld=yes
>  else
>    acl_cv_prog_gnu_ld=no
> @@ -6847,13 +6847,14 @@ with_gnu_ld=$acl_cv_prog_gnu_ld
>
>
>
> -                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
> +                                                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
>  $as_echo_n "checking for shared library run path origin... " >&6; }
>  if ${acl_cv_rpath+:} false; then :
>    $as_echo_n "(cached) " >&6
>  else
>
> -    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" EGREP="$EGREP" \
> +    with_gnu_ld="$with_gnu_ld" \
>      ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
>      . ./conftest.sh
>      rm -f ./conftest.sh
> diff --git a/libgcc/configure b/libgcc/configure
> index 61f3ace2891..181420e67f2 100755
> --- a/libgcc/configure
> +++ b/libgcc/configure
> @@ -5032,7 +5032,7 @@ if ${acl_cv_prog_gnu_ld+:} false; then :
>    $as_echo_n "(cached) " >&6
>  else
>    # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 1>&5; then
>    acl_cv_prog_gnu_ld=yes
>  else
>    acl_cv_prog_gnu_ld=no
> diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
> index eac60392121..f715029375b 100755
> --- a/libstdc++-v3/configure
> +++ b/libstdc++-v3/configure
> @@ -28473,7 +28473,7 @@ else
>        # 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
> @@ -28501,7 +28501,7 @@ if ${acl_cv_prog_gnu_ld+:} false; then :
>    $as_echo_n "(cached) " >&6
>  else
>    # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 1>&5; then
>    acl_cv_prog_gnu_ld=yes
>  else
>    acl_cv_prog_gnu_ld=no
> @@ -28513,13 +28513,14 @@ with_gnu_ld=$acl_cv_prog_gnu_ld
>
>
>
> -                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
> +                                                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
>  $as_echo_n "checking for shared library run path origin... " >&6; }
>  if ${acl_cv_rpath+:} false; then :
>    $as_echo_n "(cached) " >&6
>  else
>
> -    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" EGREP="$EGREP" \
> +    with_gnu_ld="$with_gnu_ld" \
>      ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
>      . ./conftest.sh
>      rm -f ./conftest.sh
> --
> 2.36.1
>
>
  

Patch

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 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+AC_REQUIRE([AC_PROG_EGREP])dnl
+if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 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" \
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" EGREP="$EGREP" \
+    with_gnu_ld="$with_gnu_ld" \
     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
     . ./conftest.sh
     rm -f ./conftest.sh
diff --git a/configure b/configure
index 5dcaab14ae9..e0f9a0708ea 100755
--- a/configure
+++ b/configure
@@ -724,6 +724,8 @@  target_subdir
 host_subdir
 build_subdir
 build_libsubdir
+EGREP
+GREP
 AWK
 SED
 LN_S
@@ -2763,6 +2765,136 @@  fi
   test -n "$AWK" && break
 done
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
 
 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
 
@@ -9448,7 +9580,7 @@  if test x${use_gnu_as} = x &&
 fi
 
 if test x${use_gnu_ld} = x &&
-   echo " ${configdirs} " | egrep " (go)?ld " > /dev/null 2>&1 ; then
+   echo " ${configdirs} " | $EGREP " (go)?ld " > /dev/null 2>&1 ; then
   with_gnu_ld=yes
   extra_host_args="$extra_host_args --with-gnu-ld"
 fi
@@ -10620,7 +10752,7 @@  case " $build_configdirs " in
     # For an installed makeinfo, we require it to be from texinfo 4.7 or
     # higher, else we use the "missing" dummy.
     if ${MAKEINFO} --version \
-       | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
+       | $EGREP 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
       :
     else
       MAKEINFO="$MISSING makeinfo"
diff --git a/configure.ac b/configure.ac
index 85977482aee..19d34edba1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,7 @@  ACX_PROG_LN
 AC_PROG_LN_S
 AC_PROG_SED
 AC_PROG_AWK
+AC_PROG_EGREP
 
 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
 
@@ -2634,7 +2635,7 @@  if test x${use_gnu_as} = x &&
 fi
 
 if test x${use_gnu_ld} = x &&
-   echo " ${configdirs} " | egrep " (go)?ld " > /dev/null 2>&1 ; then
+   echo " ${configdirs} " | $EGREP " (go)?ld " > /dev/null 2>&1 ; then
   with_gnu_ld=yes
   extra_host_args="$extra_host_args --with-gnu-ld"
 fi
@@ -3549,7 +3550,7 @@  changequote(,)
     # For an installed makeinfo, we require it to be from texinfo 4.7 or
     # higher, else we use the "missing" dummy.
     if ${MAKEINFO} --version \
-       | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
+       | $EGREP 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
       :
     else
       MAKEINFO="$MISSING makeinfo"
diff --git a/gcc/configure b/gcc/configure
index f43dc989d02..c58ec9b2273 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11160,7 +11160,7 @@  else
       # 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
@@ -11188,7 +11188,7 @@  if ${acl_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 1>&5; then
   acl_cv_prog_gnu_ld=yes
 else
   acl_cv_prog_gnu_ld=no
@@ -11200,13 +11200,14 @@  with_gnu_ld=$acl_cv_prog_gnu_ld
 
 
 
-                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
+                                                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
 $as_echo_n "checking for shared library run path origin... " >&6; }
 if ${acl_cv_rpath+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
-    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" EGREP="$EGREP" \
+    with_gnu_ld="$with_gnu_ld" \
     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
     . ./conftest.sh
     rm -f ./conftest.sh
@@ -19674,7 +19675,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19679 "configure"
+#line 19678 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19780,7 +19781,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19785 "configure"
+#line 19784 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/intl/configure b/intl/configure
index 03f40487a92..3caa5a51940 100755
--- a/intl/configure
+++ b/intl/configure
@@ -5090,7 +5090,7 @@  else
       # 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
@@ -5118,7 +5118,7 @@  if ${acl_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 1>&5; then
   acl_cv_prog_gnu_ld=yes
 else
   acl_cv_prog_gnu_ld=no
@@ -5130,13 +5130,14 @@  with_gnu_ld=$acl_cv_prog_gnu_ld
 
 
 
-                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
+                                                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
 $as_echo_n "checking for shared library run path origin... " >&6; }
 if ${acl_cv_rpath+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
-    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" EGREP="$EGREP" \
+    with_gnu_ld="$with_gnu_ld" \
     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
     . ./conftest.sh
     rm -f ./conftest.sh
diff --git a/libcpp/configure b/libcpp/configure
index 75145390215..800b0bad595 100755
--- a/libcpp/configure
+++ b/libcpp/configure
@@ -6807,7 +6807,7 @@  else
       # 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
@@ -6835,7 +6835,7 @@  if ${acl_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 1>&5; then
   acl_cv_prog_gnu_ld=yes
 else
   acl_cv_prog_gnu_ld=no
@@ -6847,13 +6847,14 @@  with_gnu_ld=$acl_cv_prog_gnu_ld
 
 
 
-                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
+                                                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
 $as_echo_n "checking for shared library run path origin... " >&6; }
 if ${acl_cv_rpath+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
-    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" EGREP="$EGREP" \
+    with_gnu_ld="$with_gnu_ld" \
     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
     . ./conftest.sh
     rm -f ./conftest.sh
diff --git a/libgcc/configure b/libgcc/configure
index 61f3ace2891..181420e67f2 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5032,7 +5032,7 @@  if ${acl_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 1>&5; then
   acl_cv_prog_gnu_ld=yes
 else
   acl_cv_prog_gnu_ld=no
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index eac60392121..f715029375b 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -28473,7 +28473,7 @@  else
       # 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
@@ -28501,7 +28501,7 @@  if ${acl_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 1>&5; then
   acl_cv_prog_gnu_ld=yes
 else
   acl_cv_prog_gnu_ld=no
@@ -28513,13 +28513,14 @@  with_gnu_ld=$acl_cv_prog_gnu_ld
 
 
 
-                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
+                                                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
 $as_echo_n "checking for shared library run path origin... " >&6; }
 if ${acl_cv_rpath+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
-    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" EGREP="$EGREP" \
+    with_gnu_ld="$with_gnu_ld" \
     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
     . ./conftest.sh
     rm -f ./conftest.sh