From 919f004106a705947a52ead1b6b23238cbe10218 Mon Sep 17 00:00:00 2001 From: Haru Date: Sat, 25 Aug 2018 16:50:52 +0200 Subject: Change language specification to c11 in the autoconf builds Fixes an issue with certain glibc versions using the emulated `_Static_assert` (allowing only one assertion per scope) despite the compiler having built-in support for the c11 version. Fixes builds in Debian stretch and other distributions. Signed-off-by: Haru --- configure.ac | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 1bb30b09f..4d5f4bcfd 100644 --- a/configure.ac +++ b/configure.ac @@ -638,7 +638,37 @@ AC_LANG([C]) # -Werror-implicit-function-declaration -Wtrampolines # -Wjump-misses-init -CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wextra -Wno-sign-compare -std=c99" +AC_MSG_CHECKING([whether $CC supports -std=c11]) +OLD_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -std=c11" +AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([int foo;])], + [ + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no]) + + AC_MSG_CHECKING([whether $CC supports -std=c1x]) + CFLAGS="$OLD_CFLAGS -std=c1x" + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([int foo;])], + [ + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no, falling back to -std=c99]) + CFLAGS="$OLD_CFLAGS -std=c99" + ] + ) + ], + [ + AC_MSG_RESULT([guessing no]) + CFLAGS="$OLD_CFLAGS -std=c99" + ] +) + +CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wextra -Wno-sign-compare" CPPFLAGS="$CPPFLAGS -I../common" LDFLAGS="$LDFLAGS" -- cgit v1.2.3-60-g2f50