http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54659
--- Comment #2 from rguenther at suse dot de <rguenther at suse dot de> 2012-10-26 12:05:14 UTC --- On Fri, 26 Oct 2012, burnus at gcc dot gnu.org wrote: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54659 > > Tobias Burnus <burnus at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |burnus at gcc dot gnu.org, > | |rguenther at suse dot de > > --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-10-26 > 10:36:30 UTC --- > From PR 54281: > > | With --disable-nls intl.h does > | > | #ifdef ENABLE_NLS > | #include <libintl.h> > | extern void gcc_init_libintl (void); > | extern size_t gcc_gettext_width (const char *); > | #else > | /* Stubs. */ > | # undef textdomain > | # define textdomain(domain) (domain) > | # undef bindtextdomain > | # define bindtextdomain(domain, directory) (domain) > | # undef gettext > | # define gettext(msgid) (msgid) > | > | which wrecks an included libintl.h: > | We end up including libintl.h through > | > | gcc/double-int.h > | #include <gmp.h> > | #include <iosfwd> (here from GCC 4.1) > | #include <bits/c++locale.h> > | #include <libintl.h> > > Side note: On my system only GCC 4.1's c++locale.h includes libintl.h, GCC > 4.3/4.4/4.5/4.6/4.7 don't. > > And: > | Possibly by looking for and > | including libintl.h before re-defining those macros? It's the toplevel > | intl.h btw. > > | Another fix is to include all system headers (and thus gmp.h) from system.h > | which always comes before includes of intl.h. > > > > The patch for PR 54281 comment 10 (Rev. 190487) changed it to: > > #if defined(HAVE_LIBINTL_H) || defined(ENABLE_NLS) > # include <libintl.h> > #endif > > #ifdef ENABLE_NLS > ... > #else > /* Stubs. */ > # undef textdomain > # define textdomain(domain) (domain) > ... > > > > As written in comment 0, that breaks MinGW builds as libintl.h re-defined > fprint on non-POSIX-printf systems. If one now tries to undo the effect by > using: > > #if defined(HAVE_LIBINTL_H) || defined(ENABLE_NLS) > # include <libintl.h> > # if !defined(ENABLE_NLS) > # undef fprintf > # undef sprintf > # undef snprintf > # undef vfprintf > # endif > #endif > > > One ends up with: > > libbackend.a(ipa-pure-const.o): In function `check_decl': > C:\MinGW\msys\1.0\home\brad\gfortran\ibin\gcc/../../gcc-trunk/gcc/ipa-pure-const.c:253: > undefined reference to `_libintl > _fprintf' > ... > libcommon-target.a(opts.o): In function `wrap_help': > C:\MinGW\msys\1.0\home\brad\gfortran\ibin\gcc/../../gcc-trunk/gcc/opts.c:884: > undefined reference to `___printf__' > > > > Without having tested with neither MinGW nor with GCC 4.1/Linux, I wonder > whether one could do something like: > > #if defined(HAVE_LIBINTL_H) && !defined(ENABLE_NLS) > # define _LIBINTL_H 1 > #end if > > #ifdef (ENABLE_NLS) > # include <libintl.h> > #endif > > Or is that too evil or won't it work? Fact is that all this stuff happens because gmp.h is not included from system.h ...