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

Kip Warner <[email protected]> Sun, 20 Mar 2016 16:34:15 -0700
Newsgroups gmane.comp.sysutils.autoconf.archive-maintainers
Organization Cartesian Theatre
Message-ID <[email protected]>
On Sat, 2016-03-19 at 04:53 +0100, Moritz Klammler wrote:
> 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.

Hey Moritz. Yes, I am using the latest release from [1].

> 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], [[email protected]])
>     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
>     # ...

I confirm the same results. However, if you add AC_PROG_CXXCPP just
before the AX_CXX_COMPILE_STDCXX_14 expansion, I see the following:

    $ ./configure 
    checking for g++... g++
    checking whether the C++ compiler works... yes
    checking for C++ compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking how to run the C++ preprocessor... g++ -E
    checking whether we are using the GNU C++ compiler... (cached) yes
    checking whether g++ accepts -g... (cached) yes
    checking whether g++ supports C++14 features by default... no
    checking whether g++ supports C++14 features with -std=gnu++14... yes
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    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
    configure: creating ./config.status

I hope that helps.

-- 
Kip Warner -- Senior Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com
signature.asc (application/pgp-signature, 181 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEABECAAYFAlbvM3cACgkQLXnfK7bii21GXwCfVWv1+OVrA+BnLvkwYAKi9ham
vN4AnA5orpvpWdOBvY532zs7ZLVrUszU
=ZQKj
-----END PGP SIGNATURE-----