configure: add test for C++17 feature "constexpr if"

This commit is contained in:
Moritz Bunkus 2020-05-13 16:34:17 +02:00
parent 01a2c80f45
commit f13c9c83fe
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85

View File

@ -506,6 +506,29 @@ AC_DEFUN([AX_CXX17_STD_GCD],[
fi
])
AC_DEFUN([AX_CXX17_CONSTEXPR_IF],[
AC_CACHE_CHECK([for support for C++17 feature "constexpr if"], [ax_cv_cxx17_constexpr_if],[
CXXFLAGS_SAVED=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $STD_CXX"
export CXXFLAGS
AC_LANG_PUSH(C++)
AC_TRY_COMPILE(
[],
[if constexpr (true) return 42; else return 54;],
[ax_cv_cxx17_constexpr_if="yes"],
[ax_cv_cxx17_constexpr_if="no"])
AC_LANG_POP
CXXFLAGS="$CXXFLAGS_SAVED"
])
if ! test x"$ax_cv_cxx17_constexpr_if" = xyes ; then
missing_cxx_features="$missing_cxx_features\n * constexpr if (C++17)"
fi
])
dnl AC_DEFUN([AX_CXX17_DEF_NAME],[
dnl AC_CACHE_CHECK([for support for C++17 feature "human"], [ax_cv_cxx17_def_name],[
dnl
@ -548,6 +571,7 @@ AX_CXX17_NESTED_NAMESPACE_DEFINITION
AX_CXX17_STRUCTURED_BINDINGS
AX_CXX17_STD_OPTIONAL
AX_CXX17_STD_GCD
AX_CXX17_CONSTEXPR_IF
if test x"$missing_cxx_features" != x ; then
printf "The following features of the C++11/C++14/C++17 standards are not supported by $CXX:$missing_cxx_features\n"