Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11313) utility/fcintl.h conflicts with libintl.h
Home

[Freeciv-Dev] (PR#11313) utility/fcintl.h conflicts with libintl.h

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11313) utility/fcintl.h conflicts with libintl.h
From: "Frédéric Brière" <fbriere@xxxxxxxxxxx>
Date: Thu, 2 Dec 2004 19:55:56 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=11313 >

utility/fcintl.h defines some replacement functions for libintl.h if
ENABLE_NLS is false; this will result in a compilation error if
libintl.h is included afterwards.  (For example, <strings> includes it
indirectly.)

This patch adds a check for libintl.h in configure.ac, and forces the
inclusion of libintl.h (if present) before redefining its functions in
utility/fcintl.h.

I've also modified intl/libgettext.h in the same way, even though this
file appears to be unused at the moment.


-- 
             Frédéric Brière    <*>    fbriere@xxxxxxxxxxx

 =>  <fbriere@xxxxxxxxxx> IS NO MORE:  <http://www.abacomsucks.com>  <=

Index: configure.ac
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.ac,v
retrieving revision 1.87
diff -u -r1.87 configure.ac
--- configure.ac        2 Dec 2004 09:51:22 -0000       1.87
+++ configure.ac        3 Dec 2004 03:44:49 -0000
@@ -463,7 +463,7 @@
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(fcntl.h sys/time.h sys/types.h unistd.h sys/utsname.h \
-                 sys/file.h)
+                 sys/file.h libintl.h)
 AC_HEADER_STDBOOL
 dnl Avoid including the unix emulation layer if we build mingw executables
 dnl There would be type conflicts between winsock and bsd/unix includes
Index: utility/fcintl.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/fcintl.h,v
retrieving revision 1.10
diff -u -r1.10 fcintl.h
--- utility/fcintl.h    23 May 2004 14:27:38 -0000      1.10
+++ utility/fcintl.h    3 Dec 2004 03:44:49 -0000
@@ -19,12 +19,15 @@
 #endif
 #endif
 
-#ifdef ENABLE_NLS
+#ifdef HAVE_LIBINTL_H
 #include <libintl.h>
+#endif
 #ifdef HAVE_LOCALE_H
 #include <locale.h>
 #endif
 
+#ifdef ENABLE_NLS
+
 #define _(String) gettext(String)
 #define N_(String) String
 #define Q_(String) skip_intl_qualifier_prefix(gettext(String))
@@ -37,6 +40,9 @@
 #define Q_(String) skip_intl_qualifier_prefix(String)
 #define PL_(String1, String2, n) ((n) == 1 ? (String1) : (String2))
 
+#undef textdomain
+#undef bindtextdomain
+
 #define textdomain(Domain)
 #define bindtextdomain(Package, Directory)
 
Index: intl/libgettext.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/intl/libgettext.h,v
retrieving revision 1.2
diff -u -r1.2 libgettext.h
--- intl/libgettext.h   15 Jun 2001 23:12:55 -0000      1.2
+++ intl/libgettext.h   3 Dec 2004 03:44:49 -0000
@@ -18,13 +18,25 @@
 #ifndef _LIBGETTEXT_H
 #define _LIBGETTEXT_H 1
 
-/* NLS can be disabled through the configure --disable-nls option.  */
-#if ENABLE_NLS
+#ifdef HAVE_LIBINTL_H
 
 /* Get declarations of GNU message catalog functions.  */
 # include <libintl.h>
 
-#else
+#endif
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#ifndef ENABLE_NLS
+
+# undef gettext
+# undef dgettext
+# undef dcgettext
+# undef ngettext
+# undef dngettext
+# undef dcngettext
+# undef textdomain
+# undef bindtextdomain
+# undef bind_textdomain_codeset
 
 # define gettext(Msgid) (Msgid)
 # define dgettext(Domainname, Msgid) (Msgid)

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