1# Check for the presence of C++11 features. 2 3# Check for C++11 static_assert 4# 5AC_DEFUN([FC_CXX11_STATIC_ASSERT], 6[ 7 if test "x$cxx_works" = "xyes" ; then 8 AC_CACHE_CHECK([for C++11 static assert], [ac_cv_cxx11_static_assert], 9 [AC_LANG_PUSH([C++]) 10 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <assert.h> 11]], [[ static_assert(1, "1 is not true"); ]])], 12[ac_cv_cxx11_static_assert=yes], [ac_cv_cxx11_static_assert=no]) 13 AC_LANG_POP([C++])]) 14 if test "x${ac_cv_cxx11_static_assert}" = "xyes" ; then 15 AC_DEFINE([FREECIV_CXX11_STATIC_ASSERT], [1], [C++11 static assert supported]) 16 fi 17 fi 18]) 19 20# Check for C++11 nullptr, and define nullptr as '0' if it's missing 21# 22AC_DEFUN([FC_CXX11_NULLPTR], 23[ 24 if test "x$cxx_works" = "xyes" ; then 25 AC_LANG_PUSH([C++]) 26 AC_CHECK_HEADERS([cstddef]) 27 AC_CACHE_CHECK([for C++11 nullptr], [ac_cv_cxx11_nullptr], 28 [AC_LINK_IFELSE([AC_LANG_PROGRAM( 29[[#ifdef HAVE_CSTDDEF 30#include <cstddef> 31#endif]], 32 [[ int *var = nullptr; ]])], 33[ac_cv_cxx11_nullptr=yes], [ac_cv_cxx11_nullptr=no])]) 34 if test "x${ac_cv_cxx11_nullptr}" != "xyes" ; then 35 AC_DEFINE([nullptr], [0], [Fallback since C++11 nullptr not available]) 36 fi 37 AC_LANG_POP([C++]) 38 fi 39]) 40