]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Prefer 'grep' implementations that accept -e.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 May 2004 05:54:17 +0000 (05:54 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 May 2004 05:54:17 +0000 (05:54 +0000)
ChangeLog
doc/autoconf.texi
lib/autoconf/programs.m4
tests/local.at

index 3feaa672f238e388d800bb9a6a406f1fb7994bd5..563bb0954cf771337eff311b7e492c7b9c83b203 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2004-05-02  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * doc/autoconf.texi (Particular Programs): AC_PROG_GREP
+       now prefers 'grep' implementations that accept -e.
+       (Limitations of Usual Tools): Describe problems of traditional
+       egrep and fgrep with long input lines, and of traditional grep
+       with -e.
+       * lib/autoconf/programs.m4 (AC_PROG_GREP): Check for -e, too.
+       (_AC_PROG_GREP): Assume 3rd arg is properly quoted for the shell.
+       All callers changed.  Append /usr/xpg4/bin to the PATH, for
+       Solaris.
+       * tests/local.at (AC_STATE_SAVE): Use $GREP, not grep.
+       Define it with AC_PROG_GREP.
+
+2004-05-02  Eric Sunshine <sunshine@sunshineco.com>
+
+       * lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): Consult $SHELL as
+       a possible candidate only after all others fail, rather than
+       consulting it first.  This improves backward compatibility by
+       better reflecting the way shell selection occurred in previous
+       versions of Autoconf, and should help to avoid triggering latent
+       problems in other packages, such as the one in Automake where zsh
+       is not handled robustly:
+       http://mail.gnu.org/archive/html/automake/2004-04/msg00095.html
+       Although it is not Autoconf's responsibility to work around
+       problems in Automake, it nevertheless makes sense to avoid
+       introducing unnecessary incompatibilites.
+
 2004-04-22  Albert Chin-A-Young <china@thewrittenword.com>,
            Gary V. Vaughan  <gary@gnu.org>
 
index fb9b83422e10d3d1102822d0f1d3f54e186f5ab6..500de50c5919787ebd1bc6ab29fd88baf96342ef 100644 (file)
@@ -3239,9 +3239,11 @@ best implementation.
 @acindex{PROG_GREP}
 @ovindex GREP
 On AIX the default @code{grep} silently truncates long lines on the
-input before matching.  This macro looks for @sc{gnu} Grep or
+input before matching.  On Solaris 9 @code{/usr/bin/grep} does not
+understand the @option{-e} option.  This macro looks for @sc{gnu} Grep or
 else the best available @code{grep} or @code{ggrep} in the user's
-@code{$PATH}, which accepts the longest input lines possible.  Set the
+@code{$PATH}, which accepts the longest input lines possible and which
+accepts @option{-e}.  Set the
 output variable @code{GREP} to whatever is chosen.
 @end defmac
 
@@ -11132,7 +11134,8 @@ of Unix.
 @prindex @command{egrep}
 @acronym{POSIX} 1003.1-2001 no longer requires @command{egrep},
 but many older hosts do not yet support the @acronym{POSIX}
-replacement @code{grep -E}.  To work around this problem, invoke
+replacement @code{grep -E}.  Also, some traditional implementations do
+not work on long input lines.  To work around these problems, invoke
 @code{AC_PROG_EGREP} and then use @code{$EGREP}.
 
 The empty alternative is not portable, use @samp{?} instead.  For
@@ -11253,7 +11256,8 @@ set to @command{expr} or to @command{false} according to the result.
 @prindex @command{fgrep}
 @acronym{POSIX} 1003.1-2001 no longer requires @command{fgrep},
 but many older hosts do not yet support the @acronym{POSIX}
-replacement @code{grep -F}.  To work around this problem, invoke
+replacement @code{grep -F}.  Also, some traditional implementations do
+not work on long input lines.  To work around these problems, invoke
 @code{AC_PROG_FGREP} and then use @code{$FGREP}.
 
 
@@ -11287,10 +11291,12 @@ redirect the standard output and standard error (in case the file
 doesn't exist) of @code{grep} to @file{/dev/null}.  Check the exit
 status of @code{grep} to determine whether it found a match.
 
-Don't use multiple regexps with @option{-e}, as some @code{grep} will only
-honor the last pattern (e.g., @sc{irix} 6.5 and Solaris 2.5.1).  Anyway,
-Stardent Vistra SVR4 @code{grep} lacks @option{-e}@dots{}  Instead, use
-extended regular expressions and alternation.
+Some traditional @command{grep} implementations do not work on long
+input lines.  Also, many implementations do not support multiple regexps
+with @option{-e}: they either reject @samp{-e} entirely (e.g., Solaris
+9) or honor only the the last pattern (e.g., @acronym{IRIX} 6.5).  To
+work around these problems, invoke @code{AC_PROG_GREP} and then use
+@code{$GREP}.
 
 Don't rely on @option{-w}, as Irix 6.5.16m's @command{grep} does not
 support it.
index 856c0a3d6ea16d9b4cf1cf92a92faa7a71ad75c0..089270e50e770cb9f8ce88416e2da574e2ab65bd 100644 (file)
@@ -366,7 +366,7 @@ AC_CACHE_CHECK([for egrep], ac_cv_path_EGREP,
    [if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1
    then ac_cv_path_EGREP="$GREP -E"
    else
-     _AC_PROG_GREP(EGREP, egrep, [EGREP$])
+     _AC_PROG_GREP(EGREP, egrep, ['EGREP$'])
    fi])
  EGREP="$ac_cv_path_EGREP"
  AC_SUBST([EGREP])
@@ -381,7 +381,7 @@ AC_CACHE_CHECK([for fgrep], ac_cv_path_FGREP,
    [if echo 'ab*c' | ($GREP -F 'ab*c') >/dev/null 2>&1
    then ac_cv_path_FGREP="$GREP -F"
    else
-     _AC_PROG_GREP(FGREP, fgrep, FGREP)
+     _AC_PROG_GREP(FGREP, fgrep, [FGREP])
    fi])
  FGREP="$ac_cv_path_FGREP"
  AC_SUBST([FGREP])
@@ -393,16 +393,19 @@ AC_CACHE_CHECK([for fgrep], ac_cv_path_FGREP,
 # Check for a fully functional grep program that handles
 # the longest lines possible.  Prefer GNU grep if found.
 AC_DEFUN([AC_PROG_GREP],
-[AC_CACHE_CHECK([for grep that handles long lines], ac_cv_path_GREP,
-   [_$0(GREP, [grep ggrep], [GREP$])])
+[AC_CACHE_CHECK([for grep that handles long lines and -e], ac_cv_path_GREP,
+   [_$0(GREP, [grep ggrep], [-e 'GREP$' -e '-(cannot match)-'])])
  GREP="$ac_cv_path_GREP"
  AC_SUBST([GREP])
 ])
-# _AC_PROG_GREP(VARIABLE, PROGNAME-LIST, MATCH-EXPRESSION)
+# _AC_PROG_GREP(VARIABLE, PROGNAME-LIST, PROG-ARGUMENTS)
 m4_define([_AC_PROG_GREP],
 [_AC_PATH_PROG_FEATURE_CHECK([$1], [$2],
        [_AC_FEATURE_CHECK_LENGTH([ac_path_$1], [ac_cv_path_$1],
-               ["$ac_path_$1" '$3'], [$1])])
+               ["$ac_path_$1" $3], [$1])],
+       dnl Add /usr/xpg4/bin/*grep as it is typically found on Solaris
+       dnl along with a /usr/bin/*grep that lacks -e.
+       [$PATH:/usr/xpg4/bin])
 ])
 
 
@@ -720,7 +723,7 @@ AC_DEFUN([AC_PROG_SED],
        [_AC_FEATURE_CHECK_LENGTH([ac_path_SED], [ac_cv_path_SED],
                ["$ac_path_SED" -e 's/a$//'])],
        dnl Add /usr/xpg4/bin/sed as it is typically found on Solaris
-       dnl along with a /bin/sed that truncates output.
+       dnl along with a /usr/bin/sed that truncates output.
        [$PATH:/usr/xpg4/bin])])
  SED="$ac_cv_path_SED"
  AC_SUBST([SED])
index e896e2380934a0362bb4d354ede6291a02baa8dd..937ee74c49e606d7b066eaab1600cf7eb0cb1804 100644 (file)
@@ -192,7 +192,7 @@ m4_define([AT_CONFIGURE_AC],
 # to keep the error message but we can't: that would break AT_CHECK.
 m4_defun([AC_STATE_SAVE],
 [(set) 2>&1 |
-  grep -E -v -e 'm4_join([|],
+  $GREP -E -v -e 'm4_join([|],
       [^a[cs]_],
       [^((exec_)?prefix|DEFS|CONFIG_STATUS)=],
       [^(CC|CFLAGS|CPP|GCC|CXX|CXXFLAGS|CXXCPP|GXX|F77|FFLAGS|FLIBS|G77)=],
@@ -209,7 +209,7 @@ m4_defun([AC_STATE_SAVE],
       [^(_|@|.[*#?].|LINENO|OLDPWD|PIPESTATUS|RANDOM|SECONDS)=])' 2>/dev/null |
   # There maybe variables spread on several lines, eg IFS, remove the dead
   # lines.
-  grep '^m4_defn([m4_re_word])=' >state-env.$][1
+  $GREP '^m4_defn([m4_re_word])=' >state-env.$][1
 test $? = 0 || rm -f state-env.$][1
 ls -1 | sed '/^at-/d;/^state-/d;/^config\./d' | sort >state-ls.$][1
 ])# AC_STATE_SAVE
@@ -219,6 +219,7 @@ AT_DATA([configure.ac],
 [[AC_INIT
 AC_CONFIG_AUX_DIR($top_srcdir/config)
 AC_CONFIG_HEADER(config.h:config.hin)
+AC_PROG_GREP
 AC_STATE_SAVE(before)]
 $1
 [AC_OUTPUT