@@ -6,7 +6,7 @@ dnl PHP_CXX_COMPILE_STDCXX(version, mandatory|optional, var_name_to_put_switch_i
66dnl
77dnl ARGUMENTS
88dnl
9- dnl first arg - version as 11, 14 or 17
9+ dnl first arg - version as 11, 14, 17 or 20
1010dnl second arg - if mandatory, the configure will fail when no features found.
1111dnl Optional will make configure silently continue
1212dnl third arg - a variable name where the corresponding switch would be put. If
@@ -26,6 +26,7 @@ AC_DEFUN([PHP_CXX_COMPILE_STDCXX], [dnl
2626 m4_if ( [ $1 ] , [ 11] , [ ax_cxx_compile_alternatives="11 0x"] ,
2727 [ $1 ] , [ 14] , [ ax_cxx_compile_alternatives="14 1y"] ,
2828 [ $1 ] , [ 17] , [ ax_cxx_compile_alternatives="17 1z"] ,
29+ [ $1 ] , [ 20] , [ ax_cxx_compile_alternatives="20"] ,
2930 [ m4_fatal ( [ invalid first argument `$1 ' to PHP_CXX_COMPILE_STDCXX] ) ] ) dnl
3031 m4_if ( [ $2 ] , [ ] , [ ax_cxx_compile_cxx$1 _required=true] ,
3132 [ $2 ] , [ mandatory] , [ ax_cxx_compile_cxx$1 _required=true] ,
8889# Copyright (c) 2015 Moritz Klammler <[email protected] >8990# Copyright (c) 2016, 2018 Krzesimir Nowak <[email protected] >9091# Copyright (c) 2019 Enji Cooper <[email protected] >92+ # Copyright (c) 2020 Jason Merrill <[email protected] >93+ # Copyright (c) 2021 Jörn Heusipp <[email protected] >9194#
9295# Copying and distribution of this file, with or without modification, are
9396# permitted in any medium without royalty provided the copyright notice
9497# and this notice are preserved. This file is offered as-is, without any
9598# warranty.
9699
100+
97101dnl Test body for checking C++11 support
98102
99103m4_define ( [ _AX_CXX_COMPILE_STDCXX_testbody_11] ,
100104 _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
101105)
102106
103-
104107dnl Test body for checking C++14 support
105108
106109m4_define ( [ _AX_CXX_COMPILE_STDCXX_testbody_14] ,
107110 _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
108111 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
109112)
110113
114+ dnl Test body for checking C++17 support
115+
111116m4_define ( [ _AX_CXX_COMPILE_STDCXX_testbody_17] ,
112117 _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
113118 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
114119 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
115120)
116121
122+ dnl Test body for checking C++20 support
123+
124+ m4_define ( [ _AX_CXX_COMPILE_STDCXX_testbody_20] ,
125+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
126+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
127+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
128+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_20
129+ )
130+
131+
117132dnl Tests for new features in C++11
118133
119134m4_define ( [ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11] , [ [
@@ -909,3 +924,33 @@ namespace cxx17
909924#endif // __cplusplus < 201703L
910925
911926] ] )
927+
928+
929+ dnl Tests for new features in C++20
930+
931+ m4_define ( [ _AX_CXX_COMPILE_STDCXX_testbody_new_in_20] , [ [
932+
933+ #ifndef __cplusplus
934+
935+ #error "This is not a C++ compiler"
936+
937+ #elif __cplusplus < 202002L
938+
939+ #error "This is not a C++20 compiler"
940+
941+ #else
942+
943+ #include <version>
944+
945+ namespace cxx20
946+ {
947+
948+ // As C++20 supports feature test macros in the standard, there is no
949+ // immediate need to actually test for feature availability on the
950+ // Autoconf side.
951+
952+ } // namespace cxx20
953+
954+ #endif // __cplusplus < 202002L
955+
956+ ] ] )
0 commit comments