Hi, with gcc 3.4.0, how can I decide at compile time (e.g., by a preprocessor constant) whether gcc was called with the '-pthread' command line option? Background: My compiler is configured as follows: cludwig@lap200:~/C++/gcc3.4/LaRed2> LANG=C ; g++ -v Reading specs from /opt/gcc/gcc-3.4.0/lib/gcc/i686-pc-linux-gnu/3.4.0/specs Configured with: ../gcc-3.4.0/configure --prefix=/opt/gcc/gcc-3.4.0 --enable-threads=posix --enable-version-specific-runtime-libs --enable-languages=c,c++ --enable-__cxa_atexit --enable-c-mbchar --enable-concept-checks --enable-libstdcxx-debug --enable-c99 --enable-libstdcxx-pch Thread model: posix gcc version 3.4.0 When testing gcc 3.4.0 with a program using Boost libraries, I found that sometimes the preprocessor variable BOOST_HAS_THREADS is spuriously set if, e.g., the C++ standard string header is included. This makes the boost::smart_ptr library refer to pthread symbols. In other translation units that do not include the C++ string header BOOST_HAS_THREADS is not set whence boost::smart_ptr refers to a dummy mutex. This is not only an obvious violation of the ODR, but also causes linker errors. (I gave more details in my posting to the Boost mailing list. http://thread.gmane.org/gmane.comp.lib.boost.devel/102817) The string header eventually includes the header c++/i686-pc-linux-gnu/bits/gthr-default.h. Since gcc 3.4, this header unconditionally defines the preprocessor variable _REENTRANT. (A rational for this change is given in http://gcc.gnu.org/ml/gcc-patches/2003-07/msg01607.html.) But the Boost configuration headers define BOOST_HAS_THREADS if _REENTRANT is defined. Hence my questions: - Is it correct that _REENTRANT is defined under linux even if the compiler was called without '-pthread'? - How can I decide at compile time whether the command line option '-pthread' was present? Or whether any other MT-support is active? (I was told about __gthread_active_p(), but that does not help at *compile* time.) - Where can I find comprehensive documentation of the effects of the '-pthread' option under Linux on x86? The gcc 3.4.0 manual mentions this option as an IBM RS/6000 and PowerPC submodel option only. (E.g., does the compiler generate different code for the initialization of local static variables if '-pthread' is in effect?) Thanks Christoph -- http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/cludwig.html LiDIA: http://www.informatik.tu-darmstadt.de/TI/LiDIA/Welcome.html