bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gettext-0.14.1 -- problems compiling C++ programs


From: Peter Breitenlohner
Subject: Re: gettext-0.14.1 -- problems compiling C++ programs
Date: Tue, 23 Nov 2004 16:14:27 +0100 (CET)

On Tue, 23 Nov 2004, Bruno Haible wrote:

Peter Breitenlohner wrote:
in several packages using this or another recent gettext version
I had to correct the gettext.h included in that package as per the
attached patch. The problem occurs when compiling C++ programs with
"configure --disable-nls". The comments in the patch ought to be
self-explanatory.

Hi,

To let me reproduce the problem, you could have said that
 - you are using g++ 3.4.x,
 - a simple test program is
============ foo.cc ============
#include "gettext.h"
#include <iostream>
================================

Hi Bruno,

Yes, I should have said something like this.

.... I'll be using the following fix in GNU gettext.

*** gettext.h   13 Feb 2003 21:21:41 -0000      1.1
--- gettext.h   23 Nov 2004 14:52:50 -0000
***************
*** 1,5 ****
 /* Convenience header for conditional use of GNU <libintl.h>.
!    Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.

    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published
--- 1,5 ----
 /* Convenience header for conditional use of GNU <libintl.h>.
!    Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc.

    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published
***************
*** 37,42 ****
--- 37,52 ----
 # include <locale.h>
 #endif

+ /* Many header files from the libstdc++ coming with g++ 3.4 or newer include
+    <libintl.h>, which chokes if dcgettext is defined as a macro.  So include
+    it now, to make later inclusions of <libintl.h> a NOP.  */
+ #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
+ # include <cstdlib>
+ # if _GLIBCXX_HAVE_LIBINTL_H
+ #  include <libintl.h>
+ # endif
+ #endif
+
 /* Disabled NLS.
    The casts to 'const char *' serve the purpose of producing warnings
    for invalid uses of the value returned from these functions.


Your comment and test are certainly much better than what I did.

It is, however, g++ 3.3 or newer, but never mind that.

I am not entirely sure if the above suffices. At some time I needed to
undefine gettext etc. in order not to get lots of "macro redefined"
warnings. I do, however, not remember the details of that (might have been
package=aspell-0.60, glibc=2.3.2, gcc=3.3.2).

Just to be on the safe side one might want to undefine everything to be defined
after the end of your patch.

regards
Peter Breitenlohner <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]