From: Paul Floyd Date: Thu, 11 Sep 2025 05:18:52 +0000 (+0200) Subject: configure: add check for C++ constexpr if X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4247bab4b0880b5f69621e7ec407b9b0436d158e;p=thirdparty%2Fvalgrind.git configure: add check for C++ constexpr if For old compilers like GCC 6.3 that suppoert -std=c++17 but not constexpr if, which is a 17 feature. --- diff --git a/configure.ac b/configure.ac index ee623b050..21e905fe8 100755 --- a/configure.ac +++ b/configure.ac @@ -1993,6 +1993,31 @@ AC_LANG(C) AM_CONDITIONAL(HAVE_CXX17, test x$ac_have_cxx_17 = xyes) +AC_MSG_CHECKING([that C++ compiler supports constexpr if]) +AC_LANG(C++) +safe_CXXFLAGS=$CXXFLAGS +CXXFLAGS=-std=c++17 + +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +void f() +{ + if constexpr (true) + ; +} +])], +[ +ac_have_constexpr_if=yes +AC_MSG_RESULT([yes]) +], [ +ac_have_constexpr_if=no +AC_MSG_RESULT([no]) + ]) +CXXFLAGS=$safe_CXXFLAGS +AC_LANG(C) + +AM_CONDITIONAL(HAVE_CONSTEXPR_IF, test x$ac_have_constexpr_if = xyes) + + AC_MSG_CHECKING([that C++ compiler can include header file]) AC_LANG(C++) safe_CXXFLAGS=$CXXFLAGS