summaryrefslogtreecommitdiff
path: root/m4/ax_cxx_compile_stdcxx.m4
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2023-01-21 08:02:16 +1300
committerOlly Betts <olly@survex.com>2023-01-21 08:02:16 +1300
commit3a2674fc7d64171f5cd229590456d106fd4e65d9 (patch)
tree83eb88bfa9c608e4d356dfca5b543313aa7abf2b /m4/ax_cxx_compile_stdcxx.m4
parent04c71e680ce8d47abca807597aa353e03273eb0a (diff)
downloadautoconf-archive-3a2674fc7d64171f5cd229590456d106fd4e65d9.tar.gz
Avoid cache variable name collision
AS_TR_SH maps both `:` and `=` to `_` so -std:c++17 was colliding with -std=c++17. Suffix the cache variable name for the former with _MSVC to avoid this.
Diffstat (limited to 'm4/ax_cxx_compile_stdcxx.m4')
-rw-r--r--m4/ax_cxx_compile_stdcxx.m412
1 files changed, 10 insertions, 2 deletions
diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4
index a2e068a..a9c990e 100644
--- a/m4/ax_cxx_compile_stdcxx.m4
+++ b/m4/ax_cxx_compile_stdcxx.m4
@@ -106,8 +106,16 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
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}" -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"