openwrt/tools/autoconf-archive/patches/001-AX_CXX_COMPILE_STDCXX-Add-C-23-support.patch
Christian Marangi 8ad5f35a90
Some checks are pending
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Waiting to run
Build host tools / Build host tools for linux and macos based systems (push) Waiting to run
autoconf-archive: backport patch for C++23 support
Backport upstream patch for C++23 support on ax_cxx_compile_stdcxx.m4.

This is needed by Asterisk package to correctly configure.

It's currently not possible to bump to a more recent autoconf-archive
release 2024.10.16 as it's currently affected by multiple BUGs ([1])

[1] e1acc7a67b

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2025-12-03 20:00:21 +01:00

90 lines
2.7 KiB
Diff

From 833c9c2e5b65383c8c1353b6beb88f52dede640f Mon Sep 17 00:00:00 2001
From: Olly Betts <olly@survex.com>
Date: Wed, 29 May 2024 07:54:24 +1200
Subject: [PATCH] AX_CXX_COMPILE_STDCXX: Add C++23 support
---
m4/ax_cxx_compile_stdcxx.m4 | 47 ++++++++++++++++++++++++++++++++++---
1 file changed, 44 insertions(+), 3 deletions(-)
--- a/m4/ax_cxx_compile_stdcxx.m4
+++ b/m4/ax_cxx_compile_stdcxx.m4
@@ -10,8 +10,8 @@
#
# Check for baseline language coverage in the compiler for the specified
# version of the C++ standard. If necessary, add switches to CXX and
-# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for
-# the respective C++ standard version.
+# CXXCPP to enable support. VERSION may be '11', '14', '17', '20', or
+# '23' for the respective C++ standard version.
#
# The second argument, if specified, indicates whether you insist on an
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
@@ -43,7 +43,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 18
+#serial 19
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13).
@@ -53,6 +53,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
[$1], [20], [ax_cxx_compile_alternatives="20"],
+ [$1], [23], [ax_cxx_compile_alternatives="23"],
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$2], [], [],
[$2], [ext], [],
@@ -186,6 +187,16 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbo
_AX_CXX_COMPILE_STDCXX_testbody_new_in_20
)
+dnl Test body for checking C++23 support
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_23],
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_20
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_23
+)
+
dnl Tests for new features in C++11
@@ -1016,3 +1027,33 @@ namespace cxx20
#endif // __cplusplus < 202002L && !defined _MSC_VER
]])
+
+
+dnl Tests for new features in C++23
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_23], [[
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 202302L
+
+#error "This is not a C++23 compiler"
+
+#else
+
+#include <version>
+
+namespace cxx23
+{
+
+// As C++23 supports feature test macros in the standard, there is no
+// immediate need to actually test for feature availability on the
+// Autoconf side.
+
+} // namespace cxx23
+
+#endif // (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 202302L
+
+]])