From f2788a5543f72cdbe5fafd95ea7b37fab06745e3 Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Fri, 4 Mar 2016 21:39:12 +0100 Subject: use C11 if available, otherwise try C99 (closes #7) --- config.m4 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/config.m4 b/config.m4 index f73dfe8..9cb8969 100644 --- a/config.m4 +++ b/config.m4 @@ -27,4 +27,20 @@ if test "$PHP_SUHOSIN7_DEBUG" != "no"; then AC_DEFINE(SUHOSIN7_DEBUG, 1, [Whether to enable suhosin7 debugging]) fi -CFLAGS="$CFLAGS -std=c11" +AC_MSG_CHECKING([for C11 support with -std=c11]) +old_CFLAGS="$CFLAGS" +CFLAGS+=" -std=c11" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[AC_MSG_RESULT([yes])],[ + AC_MSG_RESULT([no]) + CFLAGS="$old_CFLAGS" + echo "===== WARNING ============================================" + echo " Suhosin7 is written in C11, but your compiler lacks C11" + echo " support. Trying C99 instead, but compiling may fail." + echo "==========================================================" + AC_MSG_CHECKING([for C99 support with -std=c99]) + CFLAGS+=" -std=c99" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[AC_MSG_RESULT([yes])],[ + AC_MSG_RESULT([no]) + CFLAGS="$old_CFLAGS" + ]) +]) -- cgit v1.3