This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Autoconf test for v3/ext namespace?

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
> __gnu_cxx::.
> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]