-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hello,
I have a special question about the AC_HEADER macro in autoconf. I'm trying to text for the existence of the unordered_set header file in C++. Unfortunately, I will got a message, that I have to use the -std=gnu++0x if I want to include this header file.
So I want to ask, what I have to to, that autoconf will respect this option in the AC_HEADER macro.
Best Regards: Jochen Schmitt
Jochen Schmitt <Jochen <at> herr-schmitt.de> writes:
So I want to ask, what I have to to, that autoconf will respect this option in the AC_HEADER macro.
Add it to the CXXFLAGS, you'll need it there anyway when actually building the program. I believe there's also a macro to check the existence of the flag, which will add it to the CXXFLAGS automatically if the test succeeds.
But why are you still using autoconf and not something less insane? ;-) http://www.cmake.org/
Kevin Kofler
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Kevin Kofler schrieb:
Add it to the CXXFLAGS, you'll need it there anyway when actually building the program. I believe there's also a macro to check the existence of the flag, which will add it to the CXXFLAGS automatically if the test succeeds.
That was the first thing what I have tried to do after I have recognized this issue, but autoconf doesn't honor this settings when AC_CHECK_HEADER call the g++ compiler for compiling the test program.
For you suggestion to using cmake, I'm not the upstream author.
As follow a snippet from the config.log file:
configure:9397: checking unordered_set usability configure:9414: g++ -c -O2 -Wall conftest.cpp >&5 In file included from /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/unordered_set:40, from conftest.cpp:107: /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/c++0x_warning.h:36:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options. In file included from /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/unordered_set:53, from conftest.cpp:107:
Best Regards:
Jochen Schmitt
Hello,
On Thu, Jan 10, 2008 at 06:47:18PM +0100, Jochen Schmitt wrote:
Kevin Kofler schrieb:
Add it to the CXXFLAGS, you'll need it there anyway when actually building the program. I believe there's also a macro to check the existence of the flag, which will add it to the CXXFLAGS automatically if the test succeeds.
That was the first thing what I have tried to do after I have recognized this issue, but autoconf doesn't honor this settings when AC_CHECK_HEADER call the g++ compiler for compiling the test program.
Autoconf checks for features of a compiler. To do this, it has to know which programming language is the compiler supposed to compile. This is why you have to specify the language using AC_LANG or AC_LANG_PUSH/POP. See http://www.gnu.org/software/autoconf/manual/html_node/Language-Choice.html
The default language is C, thus people using C exclusively need not know about the language selection. But as soon as you use a different language, e.g. Erlang, Fortran, or C++, you have to keep this in mind.
(Using CC=g++ says "my C compiler is named g++" which is not usually true.)
And yes, Autoconf uses CXXFLAGS instead of CFLAGS when checking for C++ features.
Hope this helps, Stepan Kasal
I have a special question about the AC_HEADER macro in autoconf. I'm trying to text for the existence of the unordered_set header file in C++.
I wrote up autoconf macros for this here: http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/backwards_compatibility.htm...
See "Support for C++TR1 dialect"
I'm waiting on feedback and then hope to merge these into the autoconf macro repository.
Unfortunately, I will got a message, that I have to use the -std=gnu++0x if I want to include this header file.
Yes, as <unordered_set> is a C++0x standard header.
If you'd like to use C++98, I suggest using TR1's <tr1/unordered_set>
best, benjamin