Mercurial > octave
comparison m4/ax_cxx_compile_stdcxx.m4 @ 32567:7714577c87dd stable
build: Update autoconf macros with changes from upstream.
* ax_blas.m4, ax_compare_version.m4, ax_cxx_compile_stdcxx.m4, ax_openmp.m4:
Update with changes from upstream:
https://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=tree;hb=eb940c6cf25be8247f7efff4465fd1b770891c5b
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 10 Dec 2023 13:16:02 +0100 |
parents | c8c947e1f05c |
children |
comparison
equal
deleted
inserted
replaced
32564:b30c8691c2e1 | 32567:7714577c87dd |
---|---|
41 # Copying and distribution of this file, with or without modification, are | 41 # Copying and distribution of this file, with or without modification, are |
42 # permitted in any medium without royalty provided the copyright notice | 42 # permitted in any medium without royalty provided the copyright notice |
43 # and this notice are preserved. This file is offered as-is, without any | 43 # and this notice are preserved. This file is offered as-is, without any |
44 # warranty. | 44 # warranty. |
45 | 45 |
46 #serial 14 | 46 #serial 18 |
47 | 47 |
48 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro | 48 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro |
49 dnl (serial version number 13). | 49 dnl (serial version number 13). |
50 | 50 |
51 AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl | 51 AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl |
102 m4_if([$2], [ext], [], [dnl | 102 m4_if([$2], [ext], [], [dnl |
103 if test x$ac_success = xno; then | 103 if test x$ac_success = xno; then |
104 dnl HP's aCC needs +std=c++11 according to: | 104 dnl HP's aCC needs +std=c++11 according to: |
105 dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf | 105 dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf |
106 dnl Cray's crayCC needs "-h std=c++11" | 106 dnl Cray's crayCC needs "-h std=c++11" |
107 dnl MSVC needs -std:c++NN for C++17 and later (default is C++14) | |
107 for alternative in ${ax_cxx_compile_alternatives}; do | 108 for alternative in ${ax_cxx_compile_alternatives}; do |
108 for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do | 109 for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do |
109 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) | 110 if test x"$switch" = xMSVC; then |
111 dnl AS_TR_SH maps both `:` and `=` to `_` so -std:c++17 would collide | |
112 dnl with -std=c++17. We suffix the cache variable name with _MSVC to | |
113 dnl avoid this. | |
114 switch=-std:c++${alternative} | |
115 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_${switch}_MSVC]) | |
116 else | |
117 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) | |
118 fi | |
110 AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, | 119 AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, |
111 $cachevar, | 120 $cachevar, |
112 [ac_save_CXX="$CXX" | 121 [ac_save_CXX="$CXX" |
113 CXX="$CXX $switch" | 122 CXX="$CXX $switch" |
114 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], | 123 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], |
187 | 196 |
188 #ifndef __cplusplus | 197 #ifndef __cplusplus |
189 | 198 |
190 #error "This is not a C++ compiler" | 199 #error "This is not a C++ compiler" |
191 | 200 |
192 #elif __cplusplus < 201103L | 201 // MSVC always sets __cplusplus to 199711L in older versions; newer versions |
202 // only set it correctly if /Zc:__cplusplus is specified as well as a | |
203 // /std:c++NN switch: | |
204 // https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ | |
205 #elif __cplusplus < 201103L && !defined _MSC_VER | |
193 | 206 |
194 #error "This is not a C++11 compiler" | 207 #error "This is not a C++11 compiler" |
195 | 208 |
196 #else | 209 #else |
197 | 210 |
478 | 491 |
479 #ifndef __cplusplus | 492 #ifndef __cplusplus |
480 | 493 |
481 #error "This is not a C++ compiler" | 494 #error "This is not a C++ compiler" |
482 | 495 |
483 #elif __cplusplus < 201402L | 496 #elif __cplusplus < 201402L && !defined _MSC_VER |
484 | 497 |
485 #error "This is not a C++14 compiler" | 498 #error "This is not a C++14 compiler" |
486 | 499 |
487 #else | 500 #else |
488 | 501 |
602 | 615 |
603 #ifndef __cplusplus | 616 #ifndef __cplusplus |
604 | 617 |
605 #error "This is not a C++ compiler" | 618 #error "This is not a C++ compiler" |
606 | 619 |
607 #elif __cplusplus < 201703L | 620 #elif __cplusplus < 201703L && !defined _MSC_VER |
608 | 621 |
609 #error "This is not a C++17 compiler" | 622 #error "This is not a C++17 compiler" |
610 | 623 |
611 #else | 624 #else |
612 | 625 |
968 | 981 |
969 } | 982 } |
970 | 983 |
971 } // namespace cxx17 | 984 } // namespace cxx17 |
972 | 985 |
973 #endif // __cplusplus < 201703L | 986 #endif // __cplusplus < 201703L && !defined _MSC_VER |
974 | 987 |
975 ]]) | 988 ]]) |
976 | 989 |
977 | 990 |
978 dnl Tests for new features in C++20 | 991 dnl Tests for new features in C++20 |
981 | 994 |
982 #ifndef __cplusplus | 995 #ifndef __cplusplus |
983 | 996 |
984 #error "This is not a C++ compiler" | 997 #error "This is not a C++ compiler" |
985 | 998 |
986 #elif __cplusplus < 202002L | 999 #elif __cplusplus < 202002L && !defined _MSC_VER |
987 | 1000 |
988 #error "This is not a C++20 compiler" | 1001 #error "This is not a C++20 compiler" |
989 | 1002 |
990 #else | 1003 #else |
991 | 1004 |
998 // immediate need to actually test for feature availability on the | 1011 // immediate need to actually test for feature availability on the |
999 // Autoconf side. | 1012 // Autoconf side. |
1000 | 1013 |
1001 } // namespace cxx20 | 1014 } // namespace cxx20 |
1002 | 1015 |
1003 #endif // __cplusplus < 202002L | 1016 #endif // __cplusplus < 202002L && !defined _MSC_VER |
1004 | 1017 |
1005 ]]) | 1018 ]]) |