From: Serhei Makarov Date: Wed, 10 Jun 2026 18:33:26 +0000 (-0400) Subject: configure.ac: fixup to allow c++11 if c++20 is unavailable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=422eb8024690f566412dc2498bd9e92b89a2f1cf;p=thirdparty%2Felfutils.git configure.ac: fixup to allow c++11 if c++20 is unavailable --- diff --git a/configure.ac b/configure.ac index e18f2472..ec452570 100644 --- a/configure.ac +++ b/configure.ac @@ -905,6 +905,12 @@ AX_CXX_COMPILE_STDCXX(20, noext, optional) AS_IF([test "x$HAVE_CXX20" = "x1"], [HAVE_CXX20=yes], [HAVE_CXX20=no]) AM_CONDITIONAL([HAVE_CXX20],[test "x$HAVE_CXX20" = "xyes"]) +AS_IF([test "x$HAVE_CXX20" = "xno"], [ + # For tests that need to use C++11, when C++20 is unavailable + AX_CXX_COMPILE_STDCXX(11, noext, optional) +]) +AS_IF([test "x$HAVE_CXX11" = "x1"], [HAVE_CXX11=yes], [HAVE_CXX11=no]) +AM_CONDITIONAL([HAVE_CXX11],[test "x$HAVE_CXX11" = "xyes"]) # For eu-stackprof # optional: @@ -913,7 +919,18 @@ AM_CONDITIONAL([HAVE_LIBPFM], [test "x${ac_cv_header_perfmon_pfmlib_perf_event_h AC_CHECK_LIB(pfm, pfm_get_os_event_encoding, [AC_SUBST(libpfm_LIBS, '-lpfm')]) # required: AC_CHECK_HEADERS([linux/perf_event.h]) -AM_CONDITIONAL([ENABLE_STACKPROF],[test "x${ac_cv_header_linux_perf_event_h}x${HAVE_CXX20}" = "xyesxyes" ]) +HAVE_CXX20_FORMAT=no +AS_IF([test "x$HAVE_CXX20" = "xyes"], [ + old_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -std=c++20" + AC_LANG_PUSH([C++]) + AC_CACHE_CHECK([for c++20 format.h], ac_cv_have_cxx20_format_h, + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ])], + ac_cv_have_cxx20_format_h=yes, ac_cv_have_cxx20_format_h=no)]) + AC_LANG_POP + CXXFLAGS="$old_CXXFLAGS" +]) +AM_CONDITIONAL([ENABLE_STACKPROF],[test "x${ac_cv_header_linux_perf_event_h}x${ac_cv_have_cxx20_format_h}x${HAVE_CXX20}" = "xyesxyesxyes" ]) AC_CHECK_HEADERS([execinfo.h]) @@ -964,6 +981,8 @@ AS_IF([test "x$with_libarchive" = "xyes" -a "x$have_libarchive" != "xyes"], [ # pronounce judgement on ability to build server, overridden by =yes/=no if test "x$enable_debuginfod" = "xno"; then true +elif test "x$have_jsonc$HAVE_CXX11$have_libarchive$have_sqlite3" = "xyesyesyesyes"; then + enable_debuginfod=yes elif test "x$have_jsonc$HAVE_CXX20$have_libarchive$have_sqlite3" = "xyesyesyesyes"; then enable_debuginfod=yes elif test "x$enable_debuginfod" = "xyes"; then @@ -1063,11 +1082,12 @@ AC_MSG_NOTICE([ Default DEBUGINFOD_URLS : ${default_debuginfod_urls} Debuginfod RPM sig checking : ${enable_debuginfod_ima_verification} Default DEBUGINFOD_IMA_CERT_PATH : ${default_debuginfod_ima_cert_path} - ${program_prefix}stackprof support : ${enable_stackprof} + ${program_prefix}stackprof support : ${enable_stackprof} EXTRA TEST FEATURES (used with make check) have bunzip2 installed (required) : ${HAVE_BUNZIP2} have zstd installed : ${HAVE_ZSTD} + C++11 : ${HAVE_CXX11} C++20 : ${HAVE_CXX20} debug branch prediction : ${use_debugpred} gprof support : ${use_gprof}