1# Check for the presence of C11 features. 2 3# Check for C11 _Static_assert 4# 5AC_DEFUN([FC_C11_STATIC_ASSERT], 6[ 7 AC_CACHE_CHECK([for C11 static assert], [ac_cv_c11_static_assert], 8 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <assert.h> 9]], [[ _Static_assert(1, "1 is not true"); ]])], 10[ac_cv_c11_static_assert=yes], [ac_cv_c11_static_assert=no])]) 11 if test "x${ac_cv_c11_static_assert}" = "xyes" ; then 12 AC_DEFINE([FREECIV_C11_STATIC_ASSERT], [1], [C11 static assert supported]) 13 fi 14]) 15 16AC_DEFUN([FC_C11_AT_QUICK_EXIT], 17[ 18 AC_CACHE_CHECK([for C11 at_quick_exit()], [ac_cv_c11_at_quick_exit], [ 19 dnl Add -Werror to detect cases where the header does not declare 20 dnl at_quick_exit() but linking still work. This situation can happen 21 dnl when the header is strict about the fact that at_quick_exit() is 22 dnl a C11 feature and the compiler is not in C11 mode. 23 dnl $EXTRA_DEBUG_CFLAGS contains -Wmissing-declarations if it's supported. 24 fc_save_CPPFLAGS="$CPPFLAGS" 25 CPPFLAGS="$CPPFLAGS -Werror $EXTRA_DEBUG_CFLAGS" 26 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> 27static void func(void) 28{} 29]], [[ at_quick_exit(func); ]])], 30[ac_cv_c11_at_quick_exit=yes], [ac_cv_c11_at_quick_exit=no]) 31 CPPFLAGS="$fc_save_CPPFLAGS"]) 32 if test "x${ac_cv_c11_at_quick_exit}" = "xyes" ; then 33 AC_DEFINE([HAVE_AT_QUICK_EXIT], [1], [C11 at_quick_exit() available]) 34 fi 35]) 36