Hi Jim, > - dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. > - AC_REQUIRE([AC_PROG_CPP]) > - AC_REQUIRE([AC_PROG_EGREP]) > - > AC_CACHE_CHECK([whether <inttypes.h> defines strtoimax as a macro], > gl_cv_func_strtoimax_macro, > [AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h>
I don't see the sense of this patch. - If it eliminates the expansion of AC_PROG_EGREP from the configure script, the AC_EGREP_CPP expansion will contain an invalid command (namely $EGREP something, and $EGREP expands to empty). - If it does not eliminate the expansion of AC_PROG_EGREP from the configure script, the error "checking for grep that handles long lines and -e... configure: error: noa cceptable grep could be found" will still occur. In my test, with autoconf-2.68 and a testdir of the module list "alloca dirfd strtoimax strtoumax", the expansion of AC_PROG_EGREP was still present in the configure script - because autoconf nowadays contains a dependency from AC_EGREP_CPP to AC_PROG_EGREP. > Unfortunately, some check for grep *is* required, > since it's used here, to set EGREP > > ac_cv_path_EGREP="$GREP -E" > EGREP="$ac_cv_path_EGREP" > > and $EGREP is used for each expansion of AC_EGREP_CPP, e.g., > > $ grep '\$EGREP' configure > if test -z "$EGREP"; then > ac_cv_path_EGREP=$EGREP > $EGREP "memchr" >/dev/null 2>&1; then : > $EGREP "free" >/dev/null 2>&1; then : > $EGREP "webecray" >/dev/null 2>&1; then : > $EGREP "choke me" >/dev/null 2>&1; then : > $EGREP "booboo" >/dev/null 2>&1; then : > $EGREP "yes" >/dev/null 2>&1; then : > $EGREP "yes" >/dev/null 2>&1; then : > > However, each and every one of those uses is trivial Indeed, and this leads to a solution that actually works. You don't need to get rid of the expansions of AC_PROG_GREP and AC_PROG_EGREP. It is sufficient to note that the one of AC_PROG_GREP starts with if test -z "$GREP"; then and the one of AC_PROG_EGREP starts with if test -z "$EGREP"; then Hence, it is possible to disable the body of these two expansions by assigning values to GREP and EGREP inside the configure script. Here's how it works: 1) Store in build-aux/dummygrep the following file: ============================= build-aux/dummygrep ============================= #!/bin/sh # This file is a dummy replacement for the 'grep' command, solely for the # use by GNU grep's configure command. # It does not handle regular expressions with anchors or grouping, nor # does it handle long lines in the input. But that is OK, since the only # regular expressions that are passed by GNU grep's configure script are # "choke me", "booboo", "yes", and similar. if test "X$1" = "X-e"; then shift fi exec grep "$@" =============================================================================== 2) In configure.ac, in the section "Checks for programs", add this: =============================================================================== # These overrides of GREP and EGREP make it possible to build GNU grep on # a Solaris machine that has only /usr/bin/grep and no /usr/xpg4/bin/grep. # # Assign a default for the grep command, so that AC_PROG_GREP cannot fail # while searching for an optimally working 'grep' program. if test -z "$GREP"; then GREP="/bin/sh $ac_aux_dir/dummygrep" fi # Assign a default for the egrep command, so that AC_PROG_EGREP cannot fail # while searching for an optimally working 'egrep' program. if test -z "$EGREP"; then EGREP="/bin/sh $ac_aux_dir/dummygrep" fi =============================================================================== 3) Make sure build-aux/dummygrep gets distributed, through EXTRA_DIST. With this, the error checking for grep that handles long lines and -e... configure: error: no acceptable grep could be found in /usr/bin:/usr/ccs/bin is avoided, the build runs fine, and only 3 tests fail: FAIL: test-exclude2.sh FAIL: test-exclude5.sh FAIL: test-update-copyright.sh $ ./test-exclude2.sh *** excltmp.11245 Sun Nov 14 14:46:05 2010 --- - Sun Nov 14 14:46:05 2010 *************** *** 2,6 **** foo*: 1 bar: 1 foobar: 0 ! baz: 1 bar/qux: 0 --- 2,6 ---- foo*: 1 bar: 1 foobar: 0 ! baz: 0 bar/qux: 0 $ ./test-exclude5.sh *** excltmp.11253 Sun Nov 14 14:46:42 2010 --- - Sun Nov 14 14:46:42 2010 *************** *** 1,4 **** bar: 1 ! bar/qux: 1 barz: 0 foo/bar: 1 --- 1,4 ---- bar: 1 ! bar/qux: 0 barz: 0 foo/bar: 1 You probably already know about the last one: <http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=history;f=tests/test-update-copyright.sh;h=ea700c902b8be30f9de761f32db81316db5b6143;hb=HEAD> Bruno