|
| 1 | +From 833c9c2e5b65383c8c1353b6beb88f52dede640f Mon Sep 17 00:00:00 2001 |
| 2 | +From: Olly Betts < [email protected]> |
| 3 | +Date: Wed, 29 May 2024 07:54:24 +1200 |
| 4 | +Subject: [PATCH] AX_CXX_COMPILE_STDCXX: Add C++23 support |
| 5 | + |
| 6 | +--- |
| 7 | + m4/ax_cxx_compile_stdcxx.m4 | 47 ++++++++++++++++++++++++++++++++++--- |
| 8 | + 1 file changed, 44 insertions(+), 3 deletions(-) |
| 9 | + |
| 10 | +--- a/m4/ax_cxx_compile_stdcxx.m4 |
| 11 | ++++ b/m4/ax_cxx_compile_stdcxx.m4 |
| 12 | +@@ -10,8 +10,8 @@ |
| 13 | + # |
| 14 | + # Check for baseline language coverage in the compiler for the specified |
| 15 | + # version of the C++ standard. If necessary, add switches to CXX and |
| 16 | +-# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for |
| 17 | +-# the respective C++ standard version. |
| 18 | ++# CXXCPP to enable support. VERSION may be '11', '14', '17', '20', or |
| 19 | ++# '23' for the respective C++ standard version. |
| 20 | + # |
| 21 | + # The second argument, if specified, indicates whether you insist on an |
| 22 | + # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. |
| 23 | +@@ -43,7 +43,7 @@ |
| 24 | + # and this notice are preserved. This file is offered as-is, without any |
| 25 | + # warranty. |
| 26 | + |
| 27 | +-#serial 18 |
| 28 | ++#serial 19 |
| 29 | + |
| 30 | + dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro |
| 31 | + dnl (serial version number 13). |
| 32 | +@@ -53,6 +53,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl |
| 33 | + [$1], [14], [ax_cxx_compile_alternatives="14 1y"], |
| 34 | + [$1], [17], [ax_cxx_compile_alternatives="17 1z"], |
| 35 | + [$1], [20], [ax_cxx_compile_alternatives="20"], |
| 36 | ++ [$1], [23], [ax_cxx_compile_alternatives="23"], |
| 37 | + [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl |
| 38 | + m4_if([$2], [], [], |
| 39 | + [$2], [ext], [], |
| 40 | +@@ -186,6 +187,16 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbo |
| 41 | + _AX_CXX_COMPILE_STDCXX_testbody_new_in_20 |
| 42 | + ) |
| 43 | + |
| 44 | ++dnl Test body for checking C++23 support |
| 45 | ++ |
| 46 | ++m4_define([_AX_CXX_COMPILE_STDCXX_testbody_23], |
| 47 | ++ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 |
| 48 | ++ _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 |
| 49 | ++ _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 |
| 50 | ++ _AX_CXX_COMPILE_STDCXX_testbody_new_in_20 |
| 51 | ++ _AX_CXX_COMPILE_STDCXX_testbody_new_in_23 |
| 52 | ++) |
| 53 | ++ |
| 54 | + |
| 55 | + dnl Tests for new features in C++11 |
| 56 | + |
| 57 | +@@ -1016,3 +1027,33 @@ namespace cxx20 |
| 58 | + #endif // __cplusplus < 202002L && !defined _MSC_VER |
| 59 | + |
| 60 | + ]]) |
| 61 | ++ |
| 62 | ++ |
| 63 | ++dnl Tests for new features in C++23 |
| 64 | ++ |
| 65 | ++m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_23], [[ |
| 66 | ++ |
| 67 | ++#ifndef __cplusplus |
| 68 | ++ |
| 69 | ++#error "This is not a C++ compiler" |
| 70 | ++ |
| 71 | ++#elif (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 202302L |
| 72 | ++ |
| 73 | ++#error "This is not a C++23 compiler" |
| 74 | ++ |
| 75 | ++#else |
| 76 | ++ |
| 77 | ++#include <version> |
| 78 | ++ |
| 79 | ++namespace cxx23 |
| 80 | ++{ |
| 81 | ++ |
| 82 | ++// As C++23 supports feature test macros in the standard, there is no |
| 83 | ++// immediate need to actually test for feature availability on the |
| 84 | ++// Autoconf side. |
| 85 | ++ |
| 86 | ++} // namespace cxx23 |
| 87 | ++ |
| 88 | ++#endif // (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 202302L |
| 89 | ++ |
| 90 | ++]]) |
0 commit comments