diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 14:53:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 14:53:22 +0000 |
commit | 52c021ee0b0c6ad2128ed550c694aad0d11d4c3f (patch) | |
tree | 83cf8627b94336cf4bee7479b9749263bbfd3a06 /m4macros/ax_cpp20.m4 | |
parent | Initial commit. (diff) | |
download | isc-kea-upstream.tar.xz isc-kea-upstream.zip |
Adding upstream version 2.5.7.upstream/2.5.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'm4macros/ax_cpp20.m4')
-rw-r--r-- | m4macros/ax_cpp20.m4 | 33 |
1 files changed, 33 insertions, 0 deletions
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 <concepts> + template<class Derived, class Base> + concept derived_from = + std::is_base_of_v<Base, Derived> && + std::is_convertible_v<const volatile Derived*, const volatile Base*>; + + struct BaseClass {}; + struct DerivedClass : BaseClass {}; + ], + [static_assert(std::derived_from<BaseClass, DerivedClass> == false); + static_assert(std::derived_from<DerivedClass, BaseClass> == true);] + )], + [AC_MSG_RESULT([yes]) + CPP20_SUPPORTED=true], + [AC_MSG_RESULT([no]) + CPP20_SUPPORTED=false]) + + # Restore flags. + CPPFLAGS="${CPPFLAGS_SAVED}" +]) |