From f5f56e1a1c4d9e9496fcb9d81131066a964ccd23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 14:15:43 +0200 Subject: Adding upstream version 2.4.1. Signed-off-by: Daniel Baumann --- m4macros/ax_cpp20.m4 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 m4macros/ax_cpp20.m4 (limited to 'm4macros/ax_cpp20.m4') diff --git a/m4macros/ax_cpp20.m4 b/m4macros/ax_cpp20.m4 new file mode 100644 index 0000000..da116c9 --- /dev/null +++ b/m4macros/ax_cpp20.m4 @@ -0,0 +1,33 @@ +AC_DEFUN([AX_ISC_CPP20], [ + AC_MSG_CHECKING(c++20 support) + + # Save flags. + CPPFLAGS_SAVED="${CPPFLAGS}" + LIBS_SAVED="${LIBS}" + + # Provide -std=c++20 flag temporarily. + CPPFLAGS="${CPPFLAGS} -std=c++20" + + # Simulate the definition of std::derived_from. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include + template + concept derived_from = + std::is_base_of_v && + std::is_convertible_v; + + struct BaseClass {}; + struct DerivedClass : BaseClass {}; + ], + [static_assert(std::derived_from == false); + static_assert(std::derived_from == true);] + )], + [AC_MSG_RESULT([yes]) + CPP20_SUPPORTED=true], + [AC_MSG_RESULT([no]) + CPP20_SUPPORTED=false]) + + # Restore flags. + CPPFLAGS="${CPPFLAGS_SAVED}" +]) -- cgit v1.2.3