autoconf-archive-maintainers | |
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ pre-processor flags not updated by ax_cxx_compile_stdcxx.m4
From: |
Moritz Klammler |
Subject: |
Re: C++ pre-processor flags not updated by ax_cxx_compile_stdcxx.m4 |
Date: |
Sat, 19 Mar 2016 04:53:37 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Are you using the latest version of `AX_CXX_COMPILE_STDCXX` [1]? I
think this should have been fixed by Joshua's latest patch [2] which
changed the macro to append the `-std=c++14` flag to the `CXX` rather
than to the `CXXFLAGS` variable so the pre-processor should now pick it
up as well.
[1] https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
[2]
http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=commit;h=9e5ef8a7fa6f32dce37a9a340cef793254d2396b
I've tested with the following setup and it seems to work properly with
the latest version.
$ ls
configure.ac m4/
$ cat configure.ac
AC_PREREQ([2.69])
AC_INIT([example], [1.0], address@hidden)
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_14
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([initializer_list])
AC_LANG_POP([C++])
AC_OUTPUT
$ ls m4/
ax_cxx_compile_stdcxx.m4 ax_cxx_compile_stdcxx_14.m4
$ autoreconf && ./configure
# ...
With the older version of `ax_cxx_compile_stdcxx.m4` I get the following
bogus result.
$ autoreconf && ./configure
[...]
checking initializer_list usability... yes
checking initializer_list presence... no
configure: WARNING: initializer_list: accepted by the compiler, rejected by
the preprocessor!
configure: WARNING: initializer_list: proceeding with the compiler's result
checking for initializer_list... yes
[...]
Peter Simons <address@hidden> writes:
> I'm re-sending the following message on behalf of Kip Warner
> <address@hidden> 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
--
OpenPGP:
Public Key: http://openpgp.klammler.eu
Fingerprint: 2732 DA32 C8D0 EEEC A081 BE9D CF6C 5166 F393 A9C0
signature.asc
Description: PGP signature