gcc-3.0.4 (x86) doesn't understand -m32, so autoconfiscate it


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3848 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/configure.in b/configure.in
index 3965037..0aed2b8 100644
--- a/configure.in
+++ b/configure.in
@@ -62,7 +62,7 @@
 DEFAULT_SUPP=""
 
 
-# We don't want gcc 2.7
+# We don't want gcc < 3.0
 AC_MSG_CHECKING([for a supported version of gcc])
 
 gcc_version=`${CC} --version | head -n 1`
@@ -70,7 +70,15 @@
 case "${gcc_version}" in
      gcc-2.7.*)
 	AC_MSG_RESULT([no (${gcc_version})])
-	AC_MSG_ERROR([please use a recent (>= gcc-2.95) version of gcc])
+	AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
+	;;
+     gcc-2.8.*)
+	AC_MSG_RESULT([no (${gcc_version})])
+	AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
+	;;
+     gcc-2.9*)
+	AC_MSG_RESULT([no (${gcc_version})])
+	AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
 	;;
 
      *)
@@ -96,9 +104,9 @@
 	AC_MSG_RESULT([ok (${host_cpu})])
         VG_ARCH="x86"
         KICKSTART_BASE="0xb0000000"
-        ARCH_CORE_AM_CFLAGS="-m32 @PREFERRED_STACK_BOUNDARY@ -DELFSZ=32"
-        ARCH_TOOL_AM_CFLAGS="-m32 @PREFERRED_STACK_BOUNDARY@"
-        ARCH_CORE_AM_CCASFLAGS="-m32"
+        ARCH_CORE_AM_CFLAGS="@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@ -DELFSZ=32"
+        ARCH_TOOL_AM_CFLAGS="@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@"
+        ARCH_CORE_AM_CCASFLAGS="@FLAG_M32@"
         ;;
 
      x86_64) 
@@ -268,6 +276,7 @@
 	;;
 esac
 
+
 # We don't know how to detect the X client library version
 # (detecting the server version is easy, bu no help).  So we
 # just use a hack: always include the suppressions for both
@@ -279,6 +288,27 @@
 fi
 
 
+# does this compiler support -m32 ?
+AC_MSG_CHECKING([if gcc accepts -m32])
+
+safe_CFLAGS=$CFLAGS
+CFLAGS="-m32"
+
+AC_TRY_COMPILE(, [
+int main () { return 0 ; }
+],
+[
+FLAG_M32="-m32"
+AC_MSG_RESULT([yes])
+], [
+FLAG_M32=""
+AC_MSG_RESULT([no])
+])
+CFLAGS=$safe_CFLAGS
+
+AC_SUBST(FLAG_M32)
+
+
 # does this compiler support -mpreferred-stack-boundary=2 ?
 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
 
@@ -299,6 +329,7 @@
 
 AC_SUBST(PREFERRED_STACK_BOUNDARY)
 
+
 # does this compiler support -Wno-pointer-sign ?
 AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
 
@@ -321,6 +352,7 @@
   CFLAGS="$CFLAGS -Wno-pointer-sign"
 fi
 
+
 # Check for TLS support in the compiler and linker
 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
 	       [AC_ARG_ENABLE(tls, [  --enable-tls            platform supports TLS],
@@ -334,6 +366,7 @@
 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
 fi
 
+
 # Check for PIE support in the compiler and linker
 AC_SUBST(PIE_AM_CFLAGS)
 AC_CACHE_CHECK([for PIE support], vg_cv_pie,
@@ -360,12 +393,14 @@
 AC_HEADER_STDC
 AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h])
 
+
 # Checks for typedefs, structures, and compiler characteristics.
 AC_TYPE_UID_T
 AC_TYPE_OFF_T
 AC_TYPE_SIZE_T
 AC_HEADER_TIME
 
+
 # Checks for library functions.
 AC_FUNC_MEMCMP
 AC_FUNC_MMAP