* Make sure we're using GNU sed; install can otherwise fail

* when getting the gcc version number, be robust to strings like
  "gcc.orig (GNU) 3.3.3" -- previous pattern was fooled by the dot
  in "gcc.orig"



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8442 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/configure.in b/configure.in
index dfbcc90..e5d696c 100644
--- a/configure.in
+++ b/configure.in
@@ -92,10 +92,30 @@
 ])
 
 
+# Check we have GNU sed: some of the stuff done by "make install" relies
+# on some pretty fancy sed expressions, and AIX sed doesn't produce the
+# same results, causing install to fail
+
+AC_MSG_CHECKING([for GNU sed])
+
+[sed_firstline=`sed --version | head -n 1`]
+
+case "${sed_firstline}" in
+    GNU*)
+	AC_MSG_RESULT([ok, looks like GNU sed])
+	;;
+    *)
+	AC_MSG_RESULT([please ensure first 'sed' in your path is GNU sed])
+	AC_MSG_RESULT([note: GNU sed is only required at build/install time])
+	AC_MSG_ERROR([build/install requires that 'sed' is GNU sed])
+	;;
+esac
+
+
 # We don't want gcc < 3.0
 AC_MSG_CHECKING([for a supported version of gcc])
 
-[gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`]
+[gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
 
 case "${gcc_version}" in
      2.*)