summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2014-10-24 14:45:47 -0700
committerRoland McGrath <roland@hack.frob.com>2014-10-24 14:45:47 -0700
commit461a7b1e4551ee9018f7542c21ff32b0f9872e7f (patch)
tree9b94af8d879cb7ab5a1d9ede3eaa5baecd48c12c
parent70996a373dd38296254029423ae6d87c02e7184a (diff)
downloadglibc-461a7b1e4551ee9018f7542c21ff32b0f9872e7f.tar.gz
glibc-461a7b1e4551ee9018f7542c21ff32b0f9872e7f.tar.xz
glibc-461a7b1e4551ee9018f7542c21ff32b0f9872e7f.zip
Rework compiler version check in configure.
-rw-r--r--ChangeLog5
-rwxr-xr-xconfigure96
-rw-r--r--configure.ac13
3 files changed, 48 insertions, 66 deletions
diff --git a/ChangeLog b/ChangeLog
index b52ff14f95..149ecc41ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2014-10-24  Roland McGrath  <roland@hack.frob.com>
 
+	* configure.ac: Validate compiler version with a empirical test of
+	__GNUC__ and __GNUC_MINOR__ predefined values, rather than by grepping
+	$CC -v output.
+	* configure: Regenerated.
+
 	* inet/htons.c (htons): Prototypify.
 	* inet/htonl.c (htonl): Likewise.
 
diff --git a/configure b/configure
index 89566c54c6..24888d990b 100755
--- a/configure
+++ b/configure
@@ -4599,69 +4599,6 @@ fi
 
 # These programs are version sensitive.
 
-for ac_prog in ${ac_tool_prefix}gcc ${ac_tool_prefix}cc
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$CC" && break
-done
-
-if test -z "$CC"; then
-  ac_verc_fail=yes
-else
-  # Found it, now check the version.
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $CC" >&5
-$as_echo_n "checking version of $CC... " >&6; }
-  ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustpi-]*[0-9.]*\).*$/\1/p'`
-  case $ac_prog_version in
-    '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
-    4.[4-9].* | 4.[1-9][0-9].* | [5-9].* )
-       ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
-    *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
-
-  esac
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5
-$as_echo "$ac_prog_version" >&6; }
-fi
-if test $ac_verc_fail = yes; then
-  critic_missing="$critic_missing gcc"
-fi
-
 for ac_prog in gnumake gmake make
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -4979,6 +4916,39 @@ if test $ac_verc_fail = yes; then
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC is sufficient to build libc" >&5
+$as_echo_n "checking if $CC is sufficient to build libc... " >&6; }
+if ${libc_cv_compiler_ok+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+#if !defined __GNUC__ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)
+#error insufficient compiler
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_cv_compiler_ok=yes
+else
+  libc_cv_compiler_ok=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_compiler_ok" >&5
+$as_echo "$libc_cv_compiler_ok" >&6; }
+if test $libc_cv_compiler_ok != yes; then :
+  critic_missing="$critic_missing compiler"
+fi
+
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}nm", so it can be a program name with args.
 set dummy ${ac_tool_prefix}nm; ac_word=$2
diff --git a/configure.ac b/configure.ac
index 82d0896c31..9dd2c686a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -910,9 +910,6 @@ AC_CHECK_PROG_VER(LD, $LD, --version,
 
 # These programs are version sensitive.
 AC_CHECK_TOOL_PREFIX
-AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
-  [version \([egcygnustpi-]*[0-9.]*\)], [4.[4-9].* | 4.[1-9][0-9].* | [5-9].* ],
-  critic_missing="$critic_missing gcc")
 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
   [GNU Make[^0-9]*\([0-9][0-9.]*\)],
   [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
@@ -933,6 +930,16 @@ AC_CHECK_PROG_VER(AWK, gawk, --version,
   [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
   [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
 
+AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
+AC_TRY_COMPILE([], [
+#if !defined __GNUC__ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)
+#error insufficient compiler
+#endif],
+	       [libc_cv_compiler_ok=yes],
+	       [libc_cv_compiler_ok=no])])
+AS_IF([test $libc_cv_compiler_ok != yes],
+      [critic_missing="$critic_missing compiler"])
+
 AC_CHECK_TOOL(NM, nm, false)
 
 if test "x$maintainer" = "xyes"; then