If necessary, options are added to @code{CXX} to enable support for
ISO Standard C++ features with extensions, preferring the newest edition
of the C++ standard that is supported. Currently the newest edition
-Autoconf knows how to detect support for is C++11. After calling
+Autoconf knows how to detect support for is C++23. After calling
this macro, you can check whether the C++ compiler has been set to
accept standard C++ by inspecting the shell variable @code{ac_prog_cxx_stdcxx}.
-Its value will be @samp{cxx11} or @samp{cxx98}, respectively,
-if the C++ compiler has been set to use the 2011 or 1990 edition of the
+Its value will be @samp{cxx23}, @samp{cxx20}, @samp{cxx17},
+@samp{cxx14}, @samp{cxx11} or @samp{cxx98},
+if the C++ compiler has been set to use the corresponding edition of the
C++ standard, and @samp{no} if the compiler does not support compiling
standard C++ at all.
and Autoconf assumes at least C89, the first C standard,
which is sometimes called ``C90'' due to a delay in standardization.
C has since gone through the standards C99, C11, C17, and C23, and
+C++ has evolved in a similar way, with the standards
+C++98, C++11, C++14, C++17, C++20, and C++23.
Autoconf is compatible with all these standards.
Program portability is a huge topic, and this section can only briefly
"
]])])
+AC_DEFUN([_AC_CXX_CXX14_TEST_PROGRAM],
+[m4_divert_text([INIT_PREPARE],
+[[ac_cxx_conftest_cxx14_program='
+#if __cplusplus < 201402
+# error "Compiler does not advertise C++14 conformance"
+#endif
+
+int
+main ()
+{
+ auto floating_point_literal_with_single_quotes = 0.123'\''456;
+}
+'
+]])])
+
+AC_DEFUN([_AC_CXX_CXX17_TEST_PROGRAM],
+[m4_divert_text([INIT_PREPARE],
+[[ac_cxx_conftest_cxx17_program='
+#if __cplusplus < 201707
+# error "Compiler does not advertise C++17 conformance"
+#endif
+
+int
+main ()
+{
+ auto u8_expression_with_u8_character_literals = u8'\''x'\'' == u8'\''x'\'';
+}
+'
+]])])
+
+AC_DEFUN([_AC_CXX_CXX20_TEST_PROGRAM],
+[m4_divert_text([INIT_PREPARE],
+[[ac_cxx_conftest_cxx20_program='
+#if __cplusplus < 202002
+# error "Compiler does not advertise C++20 conformance"
+#endif
+
+#include <compare>
+
+int
+main ()
+{
+ auto expression_with_three_way_comparison = 1 <=> 2;
+}
+'
+]])])
+
+AC_DEFUN([_AC_CXX_CXX23_TEST_PROGRAM],
+[m4_divert_text([INIT_PREPARE],
+[[ac_cxx_conftest_cxx23_program='
+#if __cplusplus < 202302
+# error "Compiler does not advertise C++23 conformance"
+#endif
+
+int
+main ()
+{
+ auto expression_with_signed_size_literal = -1z < 0;
+}
+'
+]])])
+
# _AC_CXX_CXX98_OPTIONS
# ---------------------
# Whitespace-separated list of options that might put the C++ compiler
-AA
])
+# Similarly for C++14, C++17, C++20, C++23,
+# where -std=gnu++XX should be good enough.
+m4_define([_AC_CXX_CXX14_OPTIONS], [-std=gnu++14])
+m4_define([_AC_CXX_CXX17_OPTIONS], [-std=gnu++17])
+m4_define([_AC_CXX_CXX20_OPTIONS], [-std=gnu++20])
+m4_define([_AC_CXX_CXX23_OPTIONS], [-std=gnu++23])
+
# _AC_PROG_CXX_STDCXX_EDITION_TRY(EDITION)
# ----------------------------------------
# Subroutine of _AC_PROG_CXX_STDCXX_EDITION. Not to be called directly.
# variable ac_prog_cxx_stdcxx to indicate the edition.
AC_DEFUN([_AC_PROG_CXX_STDCXX_EDITION],
[ac_prog_cxx_stdcxx=no
-m4_map([_AC_PROG_CXX_STDCXX_EDITION_TRY], [[11], [98]])])
+m4_map([_AC_PROG_CXX_STDCXX_EDITION_TRY], [23, 20, 17, 14, 11, 98])])