summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-08-25 16:50:52 +0200
committerHaru <haru@dotalux.com>2018-08-25 17:52:21 +0200
commit919f004106a705947a52ead1b6b23238cbe10218 (patch)
tree40040c86649ae45319c31f34db18692d955f8f03 /configure.ac
parent234189f34e5f055c82654b8cd35330822e8aa4d7 (diff)
downloadhercules-919f004106a705947a52ead1b6b23238cbe10218.tar.gz
hercules-919f004106a705947a52ead1b6b23238cbe10218.tar.bz2
hercules-919f004106a705947a52ead1b6b23238cbe10218.tar.xz
hercules-919f004106a705947a52ead1b6b23238cbe10218.zip
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 <haru@dotalux.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac32
1 files changed, 31 insertions, 1 deletions
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"