diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2021-03-27 18:18:58 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2021-03-27 18:23:30 +0000 |
commit | 7184a3c921fd267f0e34c837d8bc4471dcdc3dc3 (patch) | |
tree | 39639e0a83412fa5f4a55b881b996e9d5789efc5 | |
parent | 7dc042b756250e429f4c9cdc70d44a7fe9c1c31b (diff) | |
download | swig-7184a3c921fd267f0e34c837d8bc4471dcdc3dc3.tar.gz |
Testing of C++14 and C++17 detection improved
Previously if the compiler was detected to support c++11,
-std=c++11 was set preventing c++17 code from being properly tested.
Now c++14 and c++17 support is looked for and the -std flag is
appropriately set to the compiler's maximum supported version.
-rw-r--r-- | configure.ac | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index e8cdfb043..7df17556c 100644 --- a/configure.ac +++ b/configure.ac @@ -301,15 +301,47 @@ PLATCXXFLAGS="$PLATCFLAGS" if test x"$enable_cpp11_testing" = xyes; then CXX_SAVED=$CXX CXXCPP_SAVED=$CXXCPP + + # Test for c++17 CXXCPP=" " - AX_CXX_COMPILE_STDCXX(11, [noext], [optional]) - AC_MSG_CHECKING([whether C++11 testing is actually enabled]) - if test "$HAVE_CXX11" = "1"; then + AX_CXX_COMPILE_STDCXX(17, [noext], [optional]) + AC_MSG_CHECKING([whether C++17 and earlier testing is enabled]) + if test "$HAVE_CXX17" = "1"; then AC_MSG_RESULT([yes]) PLATCXXFLAGS="$CXXCPP $PLATCXXFLAGS" + HAVE_CXX14="1" + HAVE_CXX11="1" else AC_MSG_RESULT([no]) + + # Test for c++14 + CXXCPP=" " + CXX=$CXX_SAVED + AX_CXX_COMPILE_STDCXX(14, [noext], [optional]) + AC_MSG_CHECKING([whether C++14 and earlier testing is enabled]) + if test "$HAVE_CXX14" = "1"; then + AC_MSG_RESULT([yes]) + PLATCXXFLAGS="$CXXCPP $PLATCXXFLAGS" + HAVE_CXX11="1" + else + AC_MSG_RESULT([no]) + + # Test for c++11 + CXXCPP=" " + CXX=$CXX_SAVED + AX_CXX_COMPILE_STDCXX(11, [noext], [optional]) + AC_MSG_CHECKING([whether C++11 and earlier testing is enabled]) + if test "$HAVE_CXX11" = "1"; then + AC_MSG_RESULT([yes]) + PLATCXXFLAGS="$CXXCPP $PLATCXXFLAGS" + else + AC_MSG_RESULT([no]) + fi + + fi + fi + CXX=$CXX_SAVED CXXCPP=$CXXCPP_SAVED fi |