summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2023-01-19 17:40:13 +1300
committerOlly Betts <olly@survex.com>2023-01-19 17:40:13 +1300
commit04c71e680ce8d47abca807597aa353e03273eb0a (patch)
treee462d520076b72774a2f8798ae44fa5de878262c
parentda89908ef7d82a90fe5dab8904a65869b5a5d996 (diff)
downloadautoconf-archive-04c71e680ce8d47abca807597aa353e03273eb0a.tar.gz
AX_CXX_COMPILE_STDCXX: Fix MSVC with C++17 or later
MSVC defaults to C++14 and needs -std:c++NN to enable support for newer versions so add that to the list of options to try.
-rw-r--r--m4/ax_cxx_compile_stdcxx.m45
1 files changed, 3 insertions, 2 deletions
diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4
index a3d964c..a2e068a 100644
--- a/m4/ax_cxx_compile_stdcxx.m4
+++ b/m4/ax_cxx_compile_stdcxx.m4
@@ -43,7 +43,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 15
+#serial 16
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13).
@@ -104,8 +104,9 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
dnl HP's aCC needs +std=c++11 according to:
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
dnl Cray's crayCC needs "-h std=c++11"
+ dnl MSVC needs -std:c++NN for C++17 and later (default is C++14)
for alternative in ${ax_cxx_compile_alternatives}; do
- for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
+ for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" -std:c++${alternative}; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,