summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
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"