0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-31 19:08:59 +01:00

m4: Add macro argument to pass an SD-6 feature test number.

This test against the __cplusplus #define value allows for a more
granular feature test.
This commit is contained in:
Jason Volk 2016-07-19 10:22:14 -07:00
parent 69e345aac7
commit 5ed274e082
2 changed files with 16 additions and 12 deletions

View file

@ -13,7 +13,7 @@ AC_PREFIX_DEFAULT($HOME/ircd)
AC_LANG(C++)
AC_GNU_SOURCE
AC_USE_SYSTEM_EXTENSIONS
AX_CXX_COMPILE_STDCXX_14([ext], [mandatory])
AX_CXX_COMPILE_STDCXX([14], [gnu], [mandatory], 201304)
AC_ISC_POSIX
AC_C_INLINE
AC_C_CONST

View file

@ -61,7 +61,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
ac_success=no
AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
ax_cv_cxx_compile_cxx$1,
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1($4)])],
[ax_cv_cxx_compile_cxx$1=yes],
[ax_cv_cxx_compile_cxx$1=no])])
if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
@ -76,7 +76,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
$cachevar,
[ac_save_CXX="$CXX"
CXX="$CXX $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1($4)])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXX="$ac_save_CXX"])
@ -102,7 +102,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
$cachevar,
[ac_save_CXX="$CXX"
CXX="$CXX $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1($4)])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXX="$ac_save_CXX"])
@ -137,15 +137,15 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
dnl Test body for checking C++11 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11($1)
)
dnl Test body for checking C++14 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11($1)
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14($1)
)
@ -160,7 +160,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
#error "This is not a C++ compiler"
#elif __cplusplus < 201103L
#elif __cplusplus < $1L
#error "This is not a C++11 compiler"
@ -433,7 +433,7 @@ namespace cxx11
} // namespace cxx11
#endif // __cplusplus >= 201103L
#endif // __cplusplus >= $1L
]])
@ -449,11 +449,11 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
#error "This is not a C++ compiler"
#elif __cplusplus < 201402L
#elif __cplusplus < $1L
#error "This is not a C++14 compiler"
#else
#elif __cplusplus >= 201402L
namespace cxx14
{
@ -557,6 +557,10 @@ namespace cxx14
} // namespace cxx14
#endif // __cplusplus >= 201402L
#else
// Add tests here if __cplusplus is not to be trusted
#endif // __cplusplus >= $1L
]])