changeset 16132:43e6415393ff

build: check for grep in configure and then use it in build process. * configure.ac: Add call to AC_PROG_GREP. * build-aux/common.mk: substitute environment variable GREP with value from configure. Use $(GREP) in commands. * build-aux/find-files-with-tests.sh: use $(GREP) instead of grep in commands.
author Rik <rik@octave.org>
date Tue, 26 Feb 2013 16:52:33 -0800
parents e125db98263f
children 249d62b3fac8
files build-aux/common.mk build-aux/find-files-with-tests.sh configure.ac
diffstat 3 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/build-aux/common.mk	Tue Feb 26 15:22:12 2013 -0800
+++ b/build-aux/common.mk	Tue Feb 26 16:52:33 2013 -0800
@@ -3,12 +3,15 @@
 AWK = @AWK@
 export AWK
 
-SED = @SED@
-export SED
+GREP = @GREP@
+export GREP
 
 FIND = @FIND@
 export FIND
 
+SED = @SED@
+export SED
+
 PERL = @PERL@
 export PERL
 
@@ -731,7 +734,7 @@
 endef
 
 define test-file-commands
-( echo "## DO NOT EDIT!  Generated automatically from $(<F) by Make."; grep '^%!' $< ) > $@-t
+( echo "## DO NOT EDIT!  Generated automatically from $(<F) by Make."; $(GREP) '^%!' $< ) > $@-t
 mv $@-t $@
 endef
 
--- a/build-aux/find-files-with-tests.sh	Tue Feb 26 15:22:12 2013 -0800
+++ b/build-aux/find-files-with-tests.sh	Tue Feb 26 16:52:33 2013 -0800
@@ -1,6 +1,7 @@
 #! /bin/sh
 
 set -e
+GREP=${GREP:-grep}
 SED=${SED:-sed}
 
 srcdir="$1"
@@ -13,7 +14,7 @@
   else
     file="$srcdir/$arg"
   fi
-  if [ "`grep -l '^%!' $file`" ]; then
+  if [ "`$GREP -l '^%!' $file`" ]; then
     echo "$file" | $SED "s,\\$srcdir/,,";
   fi
 done
--- a/configure.ac	Tue Feb 26 15:22:12 2013 -0800
+++ b/configure.ac	Tue Feb 26 16:52:33 2013 -0800
@@ -97,6 +97,7 @@
 
 ## Programs used in Makefiles.
 AC_PROG_AWK
+AC_PROG_GREP
 OCTAVE_PROG_FIND
 OCTAVE_PROG_SED
 OCTAVE_PROG_PERL