This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[build] Avoid use of unportable grep -q


During a recent build on Solaris 8 and 9 with only the native tools, I
noticed that a couple of uses of grep -q have crept in, which is
unportable according to the Autoconf manual, and not supported by
Solaris /usr/bin/grep.

The following patch fixes some of them.  The remaining uses are in
config.guess (which would have to be fixed upstream first, but only
affects NetBSD, HP-UX and Linux) and config/tcl.m4, which is probably
unused at least in the GCC side of the tree, so I've left them alone.

Ok for mainline, 4.5 and 4.4 branches?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2010-05-08  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libjava:
	* configure.ac: Redirect grep output to /dev/null instead of grep -q.
	Use -- instead of grep -e.

	* configure: Regenerate.

	gcc:
	* configure.ac (gcc_cv_as_ld_jalr_reloc): Redirect grep output to
	/dev/null instead of grep -q.
	* configure: Regenerate.

	contrib:
	* dg-extract-results.sh: Redirect grep output to /dev/null instead
	of grep -q.

diff -r ee08b4a7b8b5 contrib/dg-extract-results.sh
--- a/contrib/dg-extract-results.sh	Sat May 08 11:41:49 2010 +0200
+++ b/contrib/dg-extract-results.sh	Sat May 08 17:42:17 2010 +0200
@@ -224,7 +224,7 @@
   VARIANTS=""
   for VAR in $VARS
   do
-    grep -q "Running target $VAR" $SUM_FILES && VARIANTS="$VARIANTS $VAR"
+    grep "Running target $VAR" $SUM_FILES > /dev/null && VARIANTS="$VARIANTS $VAR"
   done
 fi
 
@@ -418,6 +418,6 @@
 # This is ugly, but if there's version output from the compiler under test
 # at the end of the file, we want it.  The other thing that might be there
 # is the final summary counts.
-tail -2 $FIRST_SUM | grep -q '^#' || tail -2 $FIRST_SUM
+tail -2 $FIRST_SUM | grep '^#' > /dev/null || tail -2 $FIRST_SUM
 
 exit 0
diff -r ee08b4a7b8b5 gcc/configure
--- a/gcc/configure	Sat May 08 11:41:49 2010 +0200
+++ b/gcc/configure	Sat May 08 17:42:17 2010 +0200
@@ -24111,8 +24111,8 @@
         echo '	.end x' >> conftest.s
         if $gcc_cv_as -o conftest.o conftest.s >/dev/null 2>&5 \
            && $gcc_cv_ld -shared -o conftest.so conftest.o >/dev/null 2>&5; then
-	  if $gcc_cv_objdump -d conftest.so | grep -q jalr \
-	     && $gcc_cv_objdump -d conftest.so | grep -q "bal.*<x>"; then
+	  if $gcc_cv_objdump -d conftest.so | grep jalr >/dev/null \
+	     && $gcc_cv_objdump -d conftest.so | grep "bal.*<x>" >/dev/null; then
             gcc_cv_as_ld_jalr_reloc=yes
 	  fi
         fi
diff -r ee08b4a7b8b5 gcc/configure.ac
--- a/gcc/configure.ac	Sat May 08 11:41:49 2010 +0200
+++ b/gcc/configure.ac	Sat May 08 17:42:17 2010 +0200
@@ -3555,8 +3555,8 @@
         echo '	.end x' >> conftest.s
         if $gcc_cv_as -o conftest.o conftest.s >/dev/null 2>&AS_MESSAGE_LOG_FD \
            && $gcc_cv_ld -shared -o conftest.so conftest.o >/dev/null 2>&AS_MESSAGE_LOG_FD; then
-	  if $gcc_cv_objdump -d conftest.so | grep -q jalr \
-	     && $gcc_cv_objdump -d conftest.so | grep -q "bal.*<x>"; then
+	  if $gcc_cv_objdump -d conftest.so | grep jalr >/dev/null \
+	     && $gcc_cv_objdump -d conftest.so | grep "bal.*<x>" >/dev/null; then
             gcc_cv_as_ld_jalr_reloc=yes
 	  fi
         fi
diff -r ee08b4a7b8b5 libjava/configure
--- a/libjava/configure	Sat May 08 11:41:49 2010 +0200
+++ b/libjava/configure	Sat May 08 17:42:17 2010 +0200
@@ -24510,8 +24510,8 @@
 # Check if linker supports static linking on a per library basis
 LD_START_STATIC_SPEC=
 LD_FINISH_STATIC_SPEC=
-if $LD --help 2>&1 | grep -q -e -call_shared ; then
-  if $LD --help 2>&1 | grep -q -e -non_shared ; then
+if $LD --help 2>&1 | grep -- -call_shared >/dev/null; then
+  if $LD --help 2>&1 | grep -- -non_shared >/dev/null; then
     LD_START_STATIC_SPEC='%{static-libgcj:-non_shared}'
     LD_FINISH_STATIC_SPEC='%{static-libgcj:-call_shared}'
   fi
diff -r ee08b4a7b8b5 libjava/configure.ac
--- a/libjava/configure.ac	Sat May 08 11:41:49 2010 +0200
+++ b/libjava/configure.ac	Sat May 08 17:42:17 2010 +0200
@@ -1770,8 +1770,8 @@
 # Check if linker supports static linking on a per library basis
 LD_START_STATIC_SPEC=
 LD_FINISH_STATIC_SPEC=
-if $LD --help 2>&1 | grep -q -e -call_shared ; then
-  if $LD --help 2>&1 | grep -q -e -non_shared ; then
+if $LD --help 2>&1 | grep -- -call_shared >/dev/null; then
+  if $LD --help 2>&1 | grep -- -non_shared >/dev/null; then
     LD_START_STATIC_SPEC='%{static-libgcj:-non_shared}'
     LD_FINISH_STATIC_SPEC='%{static-libgcj:-call_shared}'
   fi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]