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-04-26 22:32:52 +0100 |
commit | 0a991923390ab9bd81b38bfed396fa2638cb8637 (patch) | |
tree | 5500cc9808c363405243b1846d592de3d249ab90 | |
parent | f198ff0a43b3bb7c71088c8789d72026b7dae279 (diff) | |
download | swig-0a991923390ab9bd81b38bfed396fa2638cb8637.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 |