[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
_AC_PROG_GREP bug (was: Re: 4-gary-AC_PROG_GREP.patch)
From: |
Alexandre Duret-Lutz |
Subject: |
_AC_PROG_GREP bug (was: Re: 4-gary-AC_PROG_GREP.patch) |
Date: |
Tue, 20 Apr 2004 00:31:21 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
>>> "Gary" == Gary V Vaughan <address@hidden> writes:
[...]
Gary> * lib/autoconf/programs.m4 (AC_PROG_GREP): New macro to test for a
Gary> grep or ggrep program in PATH that accepts as long lines as
Gary> possible.
Gary> * lib/autoconf/programs.m4 (_AC_PROG_GREP): Factor out the core of
Gary> AC_PROG_GREP.
Gary> (AC_PROG_EGREP, AC_PROG_FGREP): Use it to find best available
Gary> egrep and fgrep respectively if $GREP -E/-F don't work.
Gary> (_AC_PATH_PROG_FEATURE_CHECK): Factor out the common core of
Gary> _AC_PROG_GREP, and AC_PROG_SED.
Gary> (_AC_FEATURE_CHECK_LENGTH): New helper macro for finding the
Gary> longest input length accepted by a command.
Gary> (AC_PROG_SED): Use it.
Gary> * doc/autoconf.texi (Particular Programs): Document the changes.
Gary> * NEWS: Updated.
Another one:
[...]
Gary> AC_DEFUN([AC_PROG_EGREP],
Gary> +AC_CACHE_CHECK([for egrep], ac_cv_path_EGREP,
Gary> + [if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1
Gary> + then ac_cv_path_EGREP="$GREP -E"
Gary> + else
Gary> + _AC_PROG_GREP(EGREP, egrep)
Gary> + fi])
Gary> + EGREP="$ac_cv_path_EGREP"
Gary> AC_SUBST([EGREP])
Gary> ])# AC_PROG_EGREP
[...]
Gary> AC_DEFUN([AC_PROG_FGREP],
Gary> +[AC_REQUIRE([AC_PROG_GREP])dnl
Gary> +AC_CACHE_CHECK([for fgrep], ac_cv_path_FGREP,
Gary> + [if echo 'ab*c' | ($GREP -F 'ab*c') >/dev/null 2>&1
Gary> + then ac_cv_path_FGREP="$GREP -F"
Gary> + else
Gary> + _AC_PROG_GREP(FGREP, fgrep)
Gary> + fi])
Gary> + FGREP="$ac_cv_path_FGREP"
Gary> AC_SUBST([FGREP])
Gary> ])# AC_PROG_FGREP
[...]
Gary> +m4_define([_AC_PROG_GREP],
Gary> +[_AC_PATH_PROG_FEATURE_CHECK([$1], [$2],
Gary> + [_AC_FEATURE_CHECK_LENGTH([ac_path_$1], [ac_cv_path_$1],
Gary> + ["$ac_path_$1" '$1$'], [$1])])
Gary> +])
Look at the ["$ac_path_$1" '$1$'] block.
When called from AC_PROG_EGREP, this will evaluate to
$ac_path_EGREP 'EGREP$'
which is then run on a file containing 'EGREP'.
Now, when called from AC_PROG_FGREP, this will evaluate to
$ac_path_FGREP 'FGREP$'
but that will not match a file that contains 'FGREP'.
As a consequence the code fails to find any working fgrep
implementation, except the GNU one (because that checking code
is not run on GNU stuff).
--
Alexandre Duret-Lutz
- _AC_PROG_GREP bug (was: Re: 4-gary-AC_PROG_GREP.patch),
Alexandre Duret-Lutz <=