Sorry, I'll try to explain. Before version 2.72, the dnl code:
dnl If the user did not specify a C++ version.
if test -z `echo "$PRESET_CXXFLAGS" | $GREP -o -E "\\-std="`; then
dnl Set highest possible C++ support
AX_CXX_COMPILE_STDCXX(20, [noext], [optional])
if test "$HAVE_CXX20" = "0"; then
AX_CXX_COMPILE_STDCXX(17, [noext], [optional])
elif test "$HAVE_CXX17" = "0"; then
AX_CXX_COMPILE_STDCXX(14, [noext], [optional])
elif test "$HAVE_CXX14" = "0"; then
AX_CXX_COMPILE_STDCXX(11, [noext], [mandatory])
fi
fi
in configure.ac worked perfectly. Here, a choice is made between four
alternatives, with the -std flag set if necessary. After upgrading to
2.73, the check broke for outdated but still-usable versions of GCC (in
particular). The result is that the compiler runs without the flag,
which means for gcc 5.5, the C++98 standard is selected. This breaks the
build and requires determining the compiler version (which requires more
complex code, similar to OpenSSH) and the standard's flag table.
Please note that all previous versions (up to and including 2.72) behave
completely correctly. If a user wants to enforce a known version of the
standard, they specify the option during configuration. Changing
behavior without warning means breaking the contract and requires
significant code changes, possibly breaking backward compatibility.
Given that I can't exclude a specific version of autoconf without
serious reconfiguration tricks, my only option is to disable any use of
versions newer than 2.72 or write my own compiler check macro and set
the flag. My point is that sometimes the minimum level of full standard
support requires setting the flag. The user may not be aware of this,
but the compiler developers are aware, and there is a fairly reliable
mechanism for detecting this flag. Therefore, I don't understand the
rationale for breaking this behavior.
This is not about enforcing the latest standard, it’s about selecting
the highest fully supported standard automatically when the user
provides no flags.
29.03.2026 21:27, Sam James пишет:
Tom Lane<[email protected]> writes:
Yuri<[email protected]> writes:
Expected behavior:
* |AX_CXX_COMPILE_STDCXX| should automatically detect and use the
highest supported standard if the user does not provide any flags.
Is "highest supported standard" really the right decision rule?
I would personally have expected "use the compiler's default",
if no other guide is available.
It's actually unsafe as well, because a compiler may support newer
-std=XYZ but it could be experimental at least wrt ABI. GCC does that
and I think Clang does as well (at least for libstdc++, it has no
choice).
So, say, -std=c++26 being supported by the compiler doesn't mean it should
be used.
[...]
sam