[COMMITTED] Rework compiler version check in configure.
Commit Message
This replaces -v grovelling (AC_CHECK_PROG_VER) with a straightforward
compile test of the __GNUC__ and __GNUC_MINOR__ macro values. Everything
using AC_CHECK_PROG_VER is inherently fragile, and it's also just more
autoconfy to use a more empirical test. This is pretty well orthogonal,
but since I used AC_CACHE_CHECK it also now becomes easy to force the check
to succeed by putting libc_cv_compiler_ok=yes on the configure command
line, which is handy in experimental situations.
Thanks,
Roland
* 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.
@@ -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