Re: C++ pre-processor flags not updated by ax_cxx_compile_stdcxx.m4

Peter Simons <[email protected]> Fri, 18 Mar 2016 12:54:29 +0100
Newsgroups gmane.comp.sysutils.autoconf.archive-maintainers
Message-ID <[email protected]>
I'm re-sending the following message on behalf of Kip Warner
<[email protected]> to the macro's authors:

-----8<------------------------------------------------------------------------
Hey list,

Today while adding...

    AX_CXX_COMPILE_STDCXX_14([noext],[mandatory])

    ...

    AC_CHECK_HEADERS([cfenv], [],
    [AC_MSG_ERROR([missing some required standard C++ headers...])])

...to my configure.ac, I noticed a peculiar warning. The conftest.cpp
successfully compiled without warning, but the pre-processor test
raised one. Here is the log:

    ...
    configure:9708: checking cfenv usability
    configure:9708: g++ -c -g3 -std=c++14 -mfpmath=sse -msse -msse2
     conftest.cpp >&5
    configure:9708: $? = 0
    configure:9708: result: yes
    configure:9708: checking cfenv presence
    configure:9708: g++ -E  conftest.cpp
    In file included from /usr/include/c++/5/cfenv:35:0,
                     from conftest.cpp:31:
    /usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This
    file requires compiler and library support for the ISO C++ 2011
    standard. This support is currently experimental, and must be
    enabled with the -std=c++11 or -std=gnu++11 compiler options.
    ...

I did a bit of digging and it looks like ax_cxx_compile_stdcxx.m4
updates CXXFLAGS correctly, but doesn't touch CPPFLAGS. In most cases
this probably wouldn't have mattered, but for this header it does.

Should I simply add the following or do something else?

    AX_CXX_COMPILE_STDCXX_14([noext],[mandatory])
    CPPFLAGS="$CPPFLAGS -std=c++14"

Or should ax_cxx_compile_stdcxx.m4 be patched to update the CPPFLAGS?
-----8<------------------------------------------------------------------------

Best regards,
Peter