Paul Eggert wrote: > 2007-07-02 Paul Eggert <[EMAIL PROTECTED]> > > * lib/inttypes_.h [defined __cplusplus&&!defined __STDC_LIMIT_MACROS]: > #define __STDC_LIMIT_MACROS temporarily while including > <stdint.h>, so that __STDC_LIMIT_MACROS is defined. > Problem reported by Joel E. Denny in > <http://lists.gnu.org/archive/html/bug-gnulib/2007-07/msg00008.html>.
Thanks Paul. But I think __STDC_LIMIT_MACROS needs to be defined before the _first_ inclusion of <stdint.h>: When you look at glibc's <stdint.h> and gnulib's <stdint.h>, they expand to nothing if the file has already been included - even with a different setting of __STDC_LIMIT_MACROS. In other words, #include <stdint.h> #include <inttypes.h> still fails in C++ mode with your patch. Therefore I would say that gl_INTTYPES_H should do the following: AH_VERBATIM([__STDC_LIMIT_MACROS], [/* Ensure that <stdint.h> defines the limit macros, since gnulib's <inttypes.h> relies on them. */ #if defined __cplusplus && !defined __STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS 1 #endif ]) This will end up in <config.h>. But even with your patch, and even with the addition of this code to config.h, Joel's test case still fails. Here we see that there is also a problem in bison: examples/calc++/calc++-scanner.cc is compiled through the command line g++ -I. -I../../lib -g -O2 ... -c -o calc++-scanner.o calc++-scanner.cc which makes ../../lib/inttypes.h visible, but ../../lib/config.h has never been included. So apparently there are two kinds of bison sources: Those which use <config.h> and which link against libbison.a, and those which don't. The examples/calc++ is in the second category. This -I../../lib originates from this line in examples/calc++/Makefile.in: DEFAULT_INCLUDES = -I. -I$(top_builddir)/[EMAIL PROTECTED]@ which automake has put there, to ensure that <config.h> is found. There are two ways to fix this: - Define DEFAULT_INCLUDES yourself in examples/calc++/Makefile.am, or - Move config.h to a different directory, such as $(top_builddir). Bruno