This patch fixes a nasty bug in AC_PROG_GREP and AC_PROG_SED which causes these two macros to ignore valid versions of grep and sed. In fact, this bug prevented me from configuring Autoconf itself since Autoconf's configure.ac now invokes AC_PROG_GREP. -- ES 2004-05-10 Eric Sunshine <sunshine@xxxxxxxxxxxxxx> * programs.m4 (_AC_PROG_GREP): Fixed bug where PATH argument handed to _AC_PATH_PROG_FEATURE_CHECK contained leading whitespace (i.e. " $PATH:/usr/xpg4/bin"). This resulted in bogus tests, such as `test -f " /usr/bin/grep"', which _always_ failed. (AC_PROG_SED): Ditto bogus PATH fix. * autoconf.texi (AC_PROG_GREP): Properly document that this macro requires that grep correctly supports _multiple_ `-e' options, rather than stating only that grep should accept `-e'. Index: doc/autoconf.texi =================================================================== RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v retrieving revision 1.811 diff -u -d -r1.811 autoconf.texi --- doc/autoconf.texi 3 May 2004 05:54:17 -0000 1.811 +++ doc/autoconf.texi 10 May 2004 10:37:30 -0000 @@ -3240,10 +3240,11 @@ @ovindex GREP On AIX the default @code{grep} silently truncates long lines on the 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 +understand the @option{-e} option. On NeXT, @code{grep} understands only a +single @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 and which -accepts @option{-e}. Set the +@code{$PATH} which accepts the longest input lines possible, and which +accepts and respects multiple @option{-e} options. Set the output variable @code{GREP} to whatever is chosen. @end defmac Index: lib/autoconf/programs.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/programs.m4,v retrieving revision 1.29 diff -u -d -r1.29 programs.m4 --- lib/autoconf/programs.m4 3 May 2004 06:48:24 -0000 1.29 +++ lib/autoconf/programs.m4 10 May 2004 10:37:30 -0000 @@ -391,21 +391,25 @@ # AC_PROG_GREP # ------------ # Check for a fully functional grep program that handles -# the longest lines possible. Prefer GNU grep if found. +# the longest lines possible and which respects multiple -e options. +# Prefer GNU grep if found. AC_DEFUN([AC_PROG_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, PROG-ARGUMENTS) +# ------------------------------------------------------ +# Solaris 9 /usr/xpg4/bin/*grep is suitable, but /usr/bin/*grep lacks -e +# AIX silently truncates long lines before matching +# NeXT understands only one -e and truncates long lines 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])], - 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_path_$1" $3], [$1])], [$PATH:/usr/xpg4/bin]) ]) @@ -717,14 +721,13 @@ # ----------- # Check for a fully functional sed program that truncates # as few characters as possible. Prefer GNU sed if found. +# +# Solaris /usr/xpg4/bin/sed is suitable, but /usr/bin/sed truncates output. AC_DEFUN([AC_PROG_SED], [AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED, [_AC_PATH_PROG_FEATURE_CHECK(SED, [sed gsed], [_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 /usr/bin/sed that truncates output. - [$PATH:/usr/xpg4/bin])]) + ["$ac_path_SED" -e 's/a$//'])], [$PATH:/usr/xpg4/bin])]) SED="$ac_cv_path_SED" AC_SUBST([SED]) ])# AC_PROG_SED