This is the mail archive of the libstdc++@gcc.gnu.org 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: [PATCH/RFC] libstdc++'s tr1/cstdint vs. IRIX's stdint.h


On 7/18/06, Roger Sayle <roger@eyesopen.com> wrote:

mips-sgi-irix6.5 currently fails to bootstrap due to an interesting interaction between libstdc++'s configure logic and IRIX's stdint.h header file.

The catch is that the top of IRIX's /usr/include/stdint.h contain the
problematic lines:

#ifndef __c99
#error This header file is to be used only for c99 mode compilations
...
#endif

It looks like its trying to avoid poluting the default namespace with
int_fast16_t and friends, unless the user has requested ISO compatability.

This, of course, means that <stdint.h> can't be used from C unless
the user explicitly uses -std=gnu99 or similar command line option,
c.f. http://gcc.gnu.org/ml/gcc-patches/2006-01/msg00139.html which
was a similar fix for a libgfortran failure.


The unanticipated interaction in the libstdc++, is that configure first tests whether <stdint.h> is available using a C compiler but without -std=gnu99, which therefore fails on IRIX, but later in the same configure script tests "checking for ISO C99 support to TR1 in <stdint.h>" using the g++ compiler, which confusingly returns true. The irix backend of the g++ compiler, defines "__c99" by default.

This twisted logic results in c++config.h not defining the macro
_GLIBCXX_HAVE_STDINT_H but paradoxically defining the macro
_GLIBC_USE_C99_STDINT_TR1.  This then is sufficient to trigger
compilation failures in include/tr1/cstdint, which uses the first
to determine whether to include the system header, and the second
to determine whether to use the symbols defined in that header.


I'm not really sure the best way to fix this. Conceptually, it would make sense of libstdc++ to use the C++ compiler to detect whether headers are available. Unfortunately, my autoconf-foo isn't clever enough for that.

You can try sticking AC_LANG_CPLUSPLUS somewhere at the top of libstdc++ configure.ac.

Richard.


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