From a63caac1edf817115c057423cebacfd60cf3eb71 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Thu, 31 Dec 2015 11:57:20 +0000 Subject: [PATCH] Require a C99 compiler, not a C11 compiler and improve the C99 detection logic. --- configure.ac | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/configure.ac b/configure.ac index 7741483f..8df45b73 100644 --- a/configure.ac +++ b/configure.ac @@ -19,50 +19,47 @@ AC_PROG_MAKE_SET AC_PROG_LIBTOOL dnl ================================================================ -dnl C11 compiler checks. +dnl C99 compiler checks. dnl ================================================================ AC_LANG_PUSH(C) -AC_MSG_CHECKING([if $CC supports C11 without any flags]) +AC_MSG_CHECKING([if $CC supports C99 without any flags]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( - [[// test]], + [[static inline int c99_restrict(int *restrict c99_restrict) {}]], [[]])], [AC_MSG_RESULT([yes]) - have_c11_native=yes], + have_c99_native=yes], [AC_MSG_RESULT([no]) - have_c11_native=no]) + have_c99_native=no]) AC_LANG_POP(C) AC_LANG_PUSH(C) TEMP_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -std=c11" -AC_MSG_CHECKING([if $CC supports C11 with the -std=c11 flag]) +CFLAGS="$CFLAGS -std=c99" +AC_MSG_CHECKING([if $CC supports C99 with the -std=c99 flag]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( - [[// test]], + [[static inline int c99_restrict(int *restrict c99_restrict) {}]], [[]])], [AC_MSG_RESULT([yes]) - have_c11_c11=yes], + have_c99_c99=yes], [AC_MSG_RESULT([no]) - have_c11_c11=no]) + have_c99_c99=no]) CFLAGS="$TEMP_CFLAGS" AC_LANG_POP(C) -AC_MSG_CHECKING([if $CC supports C11]) -if test "$have_c11_c11" = yes ; then - AC_MSG_RESULT([-std=c11]) - CFLAGS="$CFLAGS -std=c11" -elif test "$have_c11_native" = yes ; then +AC_MSG_CHECKING([if $CC supports C99]) +if test "$have_c99_c99" = yes ; then + AC_MSG_RESULT([-std=c99]) + CFLAGS="$CFLAGS -std=c99" +elif test "$have_c99_native" = yes ; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) - AC_MSG_ERROR([C11 is not supported by $CC.]) + AC_MSG_ERROR([C99 is not supported by $CC.]) fi -AC_C_INLINE -AC_C_RESTRICT - dnl ================================================================ dnl library checks. dnl ================================================================