[master] 5101756 Look for C99 compilers somewhat harder

Tollef Fog Heen tfheen at varnish-cache.org
Mon Mar 14 13:31:05 CET 2011


commit 5101756880bbe0369c679ea13558241b4fd1de48
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Mon Mar 14 12:56:59 2011 +0100

    Look for C99 compilers somewhat harder
    
    RHEL5/CentOS 5 has an ancient version of autoconf which doesn't pick
    up the necessary runes to enable C99 mode, leading to compilation
    failures.  Hack around this in configure.ac

diff --git a/configure.ac b/configure.ac
index 22f0651..b954106 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,8 +20,21 @@ AM_INIT_AUTOMAKE([foreign])
 AC_GNU_SOURCE
 AC_PROG_CC
 AC_PROG_CC_STDC
-if test "x$ac_cv_prog_cc_c99" = xno; then
-  AC_MSG_ERROR([Could not find a C99 compatible compiler])
+if test "x$ac_cv_prog_cc_c99" = "xno" || test "x$ac_cv_prog_cc_c99" = "x"; then
+# We might be on RHEL5 with a git checkout and so broken
+# autoconf. Check if CC is gcc and if it bails when given -std=gnu99.
+# If not, use that.  Yuck.
+  if test "x$ac_cv_c_compiler_gnu" = "yes"; then
+     CC="$CC -std=gnu99"
+     AC_RUN_IFELSE(
+	[AC_LANG_PROGRAM([],[[
+return 0;
+    ]])],
+    [],
+    [AC_MSG_ERROR([Could not find a C99 compatible compiler])])
+  else
+    AC_MSG_ERROR([Could not find a C99 compatible compiler])
+  fi
 fi
 AC_PROG_CPP
 



More information about the varnish-commit mailing list