[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug #31646] grep fails to build on Solaris 10, because it lacks gre
From: |
Paolo Bonzini |
Subject: |
Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep |
Date: |
Sun, 14 Nov 2010 16:35:13 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Fedora/3.1.6-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.6 |
On 11/14/2010 03:09 PM, Jim Meyering wrote:
>> It is possible to disable the body of these two expansions by
>> assigning values to GREP and EGREP inside the configure script.
>
> But with no grep program already installed, that will always fail.
You can implement a basic grep that is "good enough for configure"
using while/read and case. You will use the newly-built grep
after it's, well, built. But nobody uses grep in "make all", so
it can be substituted unconditionally in Makefiles, and a shell
function can replace the dummygrep binary.
This is the patch:
2010-11-14 Paolo Bonzini <address@hidden>
* configure.ac (fn_grep): New. Set GREP and EGREP to it,
replace with newly-built grep before AC_OUTPUT.
diff --git a/configure.ac b/configure.ac
index 481ce86..87a38cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,6 +22,36 @@ AC_INIT([GNU grep],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
address@hidden)
+# Override grep during configure.
+fn_grep () {
+ test $1 = -E && shift
+ case address@hidden:@:$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])
@@ -167,4 +197,6 @@ AC_CONFIG_FILES([
doc/Makefile
gnulib-tests/Makefile
])
+GREP="$ac_abs_top_builddir/src/grep"
+EGREP="$ac_abs_top_builddir/src/egrep"
AC_OUTPUT
- Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep, Jim Meyering, 2010/11/14
- Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep, Bruno Haible, 2010/11/14
- Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep, Jim Meyering, 2010/11/14
- Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep, Bruno Haible, 2010/11/14
- Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep,
Paolo Bonzini <=
- Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep, Jim Meyering, 2010/11/14
- Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep, Bruno Haible, 2010/11/14
- Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep, Paolo Bonzini, 2010/11/14
- Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep, Florin Iucha, 2010/11/14
- Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep, Paolo Bonzini, 2010/11/14
- Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep, Ralf Wildenhues, 2010/11/14
Re: [bug #31646] grep fails to build on Solaris 10, because it lacks grep, Bruno Haible, 2010/11/14