]> granicus.if.org Git - procps-ng/commitdiff
build-sys: require compiler running in C99 mode
authorSami Kerola <kerolasa@iki.fi>
Sat, 25 Feb 2012 21:52:02 +0000 (22:52 +0100)
committerCraig Small <csmall@enc.com.au>
Sat, 3 Mar 2012 07:32:29 +0000 (18:32 +1100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
configure.ac

index 4f343c261918dd49f989bc770c063067e1de891d..567aaab1a3c9791041c73dd6cd3a375af325a978 100644 (file)
@@ -13,6 +13,23 @@ AC_CONFIG_HEADERS([config.h])
 # Checks for programs.
 AC_GNU_SOURCE
 AC_PROG_CC
+AC_PROG_CC_STDC
+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" = "xyes"; 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
 AM_PROG_CC_C_O
 AC_PROG_INSTALL
 AC_PROG_LN_S