Re: AX_CXX_COMPILE_STDCXX fails to select default C++ standard automatically

Paul Eggert <[email protected]> Sun, 29 Mar 2026 14:03:03 -0600
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
On 3/29/26 10:58, Yuri wrote:

> 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

This could be a bug with AX_CXX_COMPILE_STDCXX, in that it is not 
checking for C++11 (or whatever) features appropriately. If so, the bug 
would be masked in Autoconf 2.70 through 2.72 (which defaulted to C++11 
if you did nothing else), but exposed by Autoconf 2.73 (which doesn't 
default in that way). Can you investigate this possibility? You should 
be a able to do that by looking at config.log.


> This is ... about selecting 
> the highest fully supported standard automatically when the user 
> provides no flags.

Yes, but Autoconf 2.73 got out of that business, and reverted to its 
behavior in Autoconf 2.69 and earlier, for reasons discussed in the top 
thread listed here:

https://lists.gnu.org/r/autoconf/2024-05/threads.html

The consensus there, by people who know C++ implementations on GNU/Linux 
a lot better than I do, was that Autoconf should not mess with the C++ 
compiler's default -std= value.