This is the mail archive of the
mailing list for the libstdc++ project.
Re: Autoconf test for v3/ext namespace?
- From: Phil Edwards <phil at jaj dot com>
- To: Jonathan Lennox <lennox at cs dot columbia dot edu>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-help at gcc dot gnu dot org
- Date: Mon, 1 Jul 2002 18:47:36 -0400
- Subject: Re: Autoconf test for v3/ext namespace?
- References: <200207011902.g61J2UBV017490@grandcentral.cs.columbia.edu>
On Mon, Jul 01, 2002 at 03:02:30PM -0400, Jonathan Lennox wrote:
> GCC 3.1 (correctly) changed the namespace for symbols in the header files in
> libstdc++'s 'ext' directory, such as <ext/hash_map>, from std:: to
> I want to write code that uses these extensions, and I want it to work both
> with gcc 3.0 and 3.1. Obviously, to do this, I'm going to need to have
> different 'using' statements depending on which version of the compiler I'm
> using; I'd like to use autoconf to determine this.
> Does anyone have an autoconf test that can determine whether a C++ header
> file defines a particular namespace-qualified symbol?
Not specifically. You'd have to do an AC_TRY_COMPILE that simply includes
the header and then tries to use a name (say, take the address of it, or
something). If you end up needing to do a lot of this, you could wrap the
test in a macro of your own, e.g., MYPROJ_FIND_EXTENSION_NAMESPACE(foo),
which then calls AC_TRY_COMPILE for std::foo and __gnu_cxx::foo, and
perhaps sets some output/subst'd variable to the result (so you can do
"using EXTENSIONS::foo;" or whatever). Lots of possibilities there.
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace. We seek
not your counsel, nor your arms. Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen. - Samuel Adams