diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2010-11-14 16:54:37 +0100 |
---|---|---|
committer | Paolo Bonzini <bonzini@gnu.org> | 2010-11-14 16:59:49 +0100 |
commit | 21de5e00a99d3cb79913863ebeae6a2be6422a58 (patch) | |
tree | 4623aac215eb5bc54efa46d89ba58b1cdbf77b35 /configure.ac | |
parent | b717d5bdbe93f88eb687ebb7d3f26cc4e7368ee5 (diff) | |
download | grep-21de5e00a99d3cb79913863ebeae6a2be6422a58.tar.gz |
configure: remove dependency on grep that supports long lines and -e
* configure.ac (fn_grep): New. Set GREP and EGREP to it, replace
with newly-built grep before AC_OUTPUT. Reported by Florin Iucha
<http://savannah.gnu.org/bugs/?31646>.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 3c282186..b22fe98d 100644 --- a/configure.ac +++ b/configure.ac @@ -22,6 +22,36 @@ AC_INIT([GNU grep], m4_esyscmd([build-aux/git-version-gen .tarball-version]), [bug-grep@gnu.org]) +# Override grep during configure. +fn_grep () { + test "$1" = -E && shift + case $@%:@:$1 in + 0:*) AC_MSG_ERROR([fn_grep: expected pattern]) ;; + 1:-*) AC_MSG_ERROR([fn_grep: invalid command line]) ;; + 1:*) pattern=$1 ;; + 2:--|2:-e|2:-Ee) pattern=$2 ;; + *) AC_MSG_ERROR([fn_grep: invalid command line]) ;; + esac + + case $pattern in + *[].^$\\*[]*) AC_MSG_ERROR([fn_grep: regular expressions not supported]) ;; + esac + + rc=1 + while read line; do + case $line in + *$pattern*) + rc=0 + AS_ECHO([$line]) ;; + esac + done + return $rc +} + +test -n "$GREP" || GREP=fn_grep +test -n "$EGREP" || EGREP=fn_grep +ac_cv_path_EGREP=$EGREP + AC_CONFIG_AUX_DIR(build-aux) AC_CONFIG_SRCDIR(src/grep.c) AC_DEFINE([GREP], 1, [We are building grep]) @@ -168,4 +198,6 @@ AC_CONFIG_FILES([ doc/Makefile gnulib-tests/Makefile ]) +GREP="$ac_abs_top_builddir/src/grep" +EGREP="$ac_abs_top_builddir/src/grep -E" AC_OUTPUT |