diff options
author | Joshua Judson Rosen <jrosen@harvestai.com> | 2015-12-02 16:46:05 -0500 |
---|---|---|
committer | Peter Simons <simons@cryp.to> | 2016-02-29 11:41:21 +0100 |
commit | 9e5ef8a7fa6f32dce37a9a340cef793254d2396b (patch) | |
tree | f5ee7f83c763343a4a85c7057575967dcf1659bc /m4/ax_cxx_compile_stdcxx.m4 | |
parent | 401d6b8cefcc5bf3c1f6c35d76c589bb6b7387b0 (diff) | |
download | autoconf-archive-9e5ef8a7fa6f32dce37a9a340cef793254d2396b.tar.gz |
AX_CXX_COMPILE_STDCXX: don't break "make CXXFLAGS=..."
Make C++ std-selection macros modify $(CXX), not $(CXXFLAGS).
Using $(CXXFLAGS) prevents users from being able to
rebuild with different CXXFLAGS (e.g.: to try out
different optimisations or to change debug levels)
unless they re-run ./configure with their CFLAGS.
This is more like what the mainline Autoconf macros do
(e.g.: AC_PROG_CC_C99, AC_PROG_CC_STD, etc. modify $(CC),
not $(CCFLAGS)), presmuably for much the same reasons:
if you need to specify a standard to the compiler,
it doesn't really make sense to separate that from
$(CC)/$(CXX) since $(CC)/$(CXX) aren't usable without it.
Diffstat (limited to 'm4/ax_cxx_compile_stdcxx.m4')
-rw-r--r-- | m4/ax_cxx_compile_stdcxx.m4 | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 index 64c9e3a..8adc765 100644 --- a/m4/ax_cxx_compile_stdcxx.m4 +++ b/m4/ax_cxx_compile_stdcxx.m4 @@ -9,7 +9,7 @@ # DESCRIPTION # # Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXXFLAGS to +# version of the C++ standard. If necessary, add switches to CXX to # enable support. VERSION may be '11' (for the C++11 standard) or '14' # (for the C++14 standard). # @@ -39,7 +39,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 2 +#serial 3 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). @@ -74,14 +74,14 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, - [ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" + [ac_save_CXX="$CXX" + CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) - CXXFLAGS="$ac_save_CXXFLAGS"]) + CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" + CXX="$CXX $switch" ac_success=yes break fi @@ -97,14 +97,14 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, - [ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" + [ac_save_CXX="$CXX" + CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) - CXXFLAGS="$ac_save_CXXFLAGS"]) + CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" + CXX="$CXX $switch" ac_success=yes break fi |