+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>
@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
@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
@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}.
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.
[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])
[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])
# 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])
])
[_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])
# 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)=],
[^(_|@|.[*#?].|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
[[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