@@ -24,29 +24,34 @@ my_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64"
2424my_CFLAGS="-Wall -Wmissing-declarations -Wwrite-strings"
2525my_CXXFLAGS="-Wall -Wmissing-declarations"
2626my_LDFLAGS=""
27- AC_MSG_CHECKING ( [ available C++ standard] )
28- cxxmode=""
29- for i in "c++26" "c++2c" "c++23" "c++2b" "c++20"; do
27+ cxxmode="error"
28+ AC_MSG_CHECKING ( [ for C++ standard availability] )
29+ echo ""
30+ for i in "" "c++26" "c++2c" "c++23" "c++2b" "c++20"; do
3031 dnl cov-scan cannot take too high a standard
3132 AS_IF ( [ test -n "$COVERITY" && test "$i" != "c++20"] , [ continue] )
32- CXXFLAGS="$saved_CXXFLAGS -std=$i"
33+ AC_MSG_CHECKING ( [ if $CXX${i:+ -std=$i} works for our code] )
34+ CXXFLAGS="$saved_CXXFLAGS${i:+ -std=$i}"
3335 AC_COMPILE_IFELSE ( [ AC_LANG_SOURCE ( [
3436 #include <span>
3537 #include <vector>
3638 int main() {
3739 std::vector<int> v{1,9};
3840 std::span s = v;
3941 }
40- ] ) ] , [ cxxmode="$i"] )
41- AS_IF ( [ test -n "$cxxmode"] , [ break] )
42+ ] ) ] , [
43+ AC_MSG_RESULT ( [ yes] )
44+ cxxmode="${i:+ -std=$i}"
45+ break
46+ ] , [
47+ AC_MSG_RESULT ( [ no] )
48+ ] )
4249done
4350CXXFLAGS="$saved_CXXFLAGS"
44- AS_IF ( [ test -n "$cxxmode"] , [
45- my_CXXFLAGS="$my_CXXFLAGS -std=$cxxmode"
46- AC_MSG_RESULT ( [ $cxxmode] )
47- ] , [
48- AC_MSG_RESULT ( [ none] )
51+ AS_IF ( [ test "$cxxmode" = error] , [
52+ AC_MSG_ERROR ( [ None of the -std= flags we tried led to successful compilation, but we need C++20 support.] )
4953] )
54+ my_CXXFLAGS="$my_CXXFLAGS${cxxmode}"
5055
5156AC_ARG_WITH ( [ asan] , AS_HELP_STRING ( [ --with-asan] , [ Activate Address Sanitizer] ) ,
5257 [
0 commit comments