]> git.puffer.fish Git - mirror/frr.git/commitdiff
build: adjust compiler/C11 bits for autoconf 2.70+
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 11 Nov 2021 11:18:44 +0000 (12:18 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Thu, 11 Nov 2021 11:18:44 +0000 (12:18 +0100)
`autoconf` finally arrived in the 2010s and tries to do ISO C11.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
configure.ac

index 92a60ce818c75e5bb165285f8fb6b1d2f3e858a9..b1c6cdc1263cb0fcb4d43f84894a229bf62f983a 100644 (file)
@@ -180,8 +180,6 @@ AM_PROG_CC_C_O
 dnl remove autoconf default "-g -O2"
 CFLAGS="$orig_cflags"
 CXXFLAGS="$orig_cxxflags"
-AC_PROG_CC_C99
-dnl NB: see C11 below
 
 dnl Some special handling for ICC later on
 if test "$CC" = "icc"; then
@@ -254,12 +252,24 @@ if test "$cc_is_icc" = "yes"; then
     AC_C_FLAG([-diag-error 10006])
 fi
 
-dnl AC_PROG_CC_C99 may change CC to include -std=gnu99 or something
-ac_cc="$CC"
-CC="${CC% -std=gnu99}"
-CC="${CC% -std=c99}"
+dnl autoconf 2.69 AC_PROG_CC_C99 is "state of the art"
+dnl autoconf 2.70 AC_PROG_CC_C99 is deprecated and AC_PROC_CC tries to do C11
+m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.70]), [-1], [dnl
+  dnl autoconf < 2.70
+  AC_PROG_CC_C99
 
-AC_C_FLAG([-std=gnu11], [CC="$ac_cc"], [CC="$CC -std=gnu11"])
+  dnl AC_PROG_CC_C99 may change CC to include -std=gnu99 or something
+  ac_cc="$CC"
+  CC="${CC% -std=gnu99}"
+  CC="${CC% -std=c99}"
+
+  AC_C_FLAG([-std=gnu11], [CC="$ac_cc"], [CC="$CC -std=gnu11"])
+], [
+  dnl autoconf >= 2.70
+  if test "$ac_cv_prog_cc_c11" = "no"; then
+    AC_MSG_ERROR([ISO C11 compiler support (with GNU extensions) is required.])
+  fi
+])
 
 dnl if the user has specified any CFLAGS, override our settings
 if test "$enable_gcov" = "yes"; then