diff options
author | Peter Simons <simons@cryp.to> | 2023-02-20 17:18:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-20 17:18:51 +0100 |
commit | d18f0e05a3dda76d9f73fdd9594259087170b834 (patch) | |
tree | 305e9c936610de8e38e70f5059568d4c90a58e1a | |
parent | 8ea5f08e2617d37f4444c45e60166acc62364e93 (diff) | |
parent | 3a2674fc7d64171f5cd229590456d106fd4e65d9 (diff) | |
download | autoconf-archive-d18f0e05a3dda76d9f73fdd9594259087170b834.tar.gz |
Merge pull request #272 from ojwb/fix-AX_CXX_COMPILE_STDCXX-for-MSVC-C++17
AX_CXX_COMPILE_STDCXX: Fix MSVC with C++17 or later
-rw-r--r-- | m4/ax_cxx_compile_stdcxx.m4 | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 index a3d964c..a9c990e 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,9 +104,18 @@ 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 - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do + if test x"$switch" = xMSVC; then + dnl AS_TR_SH maps both `:` and `=` to `_` so -std:c++17 would collide + dnl with -std=c++17. We suffix the cache variable name with _MSVC to + dnl avoid this. + switch=-std:c++${alternative} + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_${switch}_MSVC]) + else + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + fi AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" |