with __. Use preprocessor-level redirection in libgnuintl.h.
+2002-04-27 Bruno Haible <bruno@clisp.org>
+
+ * libgnuintl.h: Redirect every function to the one prefixed with
+ "libintl_". Remove __OPTIMIZED variants.
+ * gettextP.h: Use prefix "libintl_" instead of suffix "__".
+ * dcigettext.c: Likewise.
+ * dcgettext.c: Likewise.
+ * dgettext.c: Likewise.
+ * gettext.c: Likewise.
+ * dcngettext.c: Likewise.
+ * dngettext.c: Likewise.
+ * ngettext.c: Likewise.
+ * textdomain.c: Likewise.
+ * bindtextdom.c: Likewise.
+ * plural-exp.h: Likewise.
+ * os2compat.c: Likewise.
+ * intl-compat.c: Likewise.
+
2002-04-24 Bruno Haible <bruno@clisp.org>
* gettext-0.11.2 released.
names than the internal variables in GNU libc, otherwise programs
using libintl.a cannot be linked statically. */
#if !defined _LIBC
-# define _nl_default_dirname _nl_default_dirname__
-# define _nl_domain_bindings _nl_domain_bindings__
+# define _nl_default_dirname libintl_nl_default_dirname
+# define _nl_domain_bindings libintl_nl_domain_bindings
#endif
/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
# define strdup(str) __strdup (str)
# endif
#else
-# define BINDTEXTDOMAIN bindtextdomain__
-# define BIND_TEXTDOMAIN_CODESET bind_textdomain_codeset__
+# define BINDTEXTDOMAIN libintl_bindtextdomain
+# define BIND_TEXTDOMAIN_CODESET libintl_bind_textdomain_codeset
#endif
/* Prototypes for local functions. */
# define DCGETTEXT __dcgettext
# define DCIGETTEXT __dcigettext
#else
-# define DCGETTEXT dcgettext__
-# define DCIGETTEXT dcigettext__
+# define DCGETTEXT libintl_dcgettext
+# define DCIGETTEXT libintl_dcigettext
#endif
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
names than the internal variables in GNU libc, otherwise programs
using libintl.a cannot be linked statically. */
#if !defined _LIBC
-# define _nl_default_default_domain _nl_default_default_domain__
-# define _nl_current_default_domain _nl_current_default_domain__
-# define _nl_default_dirname _nl_default_dirname__
-# define _nl_domain_bindings _nl_domain_bindings__
+# define _nl_default_default_domain libintl_nl_default_default_domain
+# define _nl_current_default_domain libintl_nl_current_default_domain
+# define _nl_default_dirname libintl_nl_default_dirname
+# define _nl_domain_bindings libintl_nl_domain_bindings
#endif
/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
#ifdef _LIBC
# define DCIGETTEXT __dcigettext
#else
-# define DCIGETTEXT dcigettext__
+# define DCIGETTEXT libintl_dcigettext
#endif
/* Lock variable to protect the global data in the gettext implementation. */
# define DCNGETTEXT __dcngettext
# define DCIGETTEXT __dcigettext
#else
-# define DCNGETTEXT dcngettext__
-# define DCIGETTEXT dcigettext__
+# define DCNGETTEXT libintl_dcngettext
+# define DCIGETTEXT libintl_dcigettext
#endif
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
# define DGETTEXT __dgettext
# define DCGETTEXT INTUSE(__dcgettext)
#else
-# define DGETTEXT dgettext__
-# define DCGETTEXT dcgettext__
+# define DGETTEXT libintl_dgettext
+# define DCGETTEXT libintl_dcgettext
#endif
/* Look up MSGID in the DOMAINNAME message catalog of the current
# define DNGETTEXT __dngettext
# define DCNGETTEXT INTUSE(__dcngettext)
#else
-# define DNGETTEXT dngettext__
-# define DCNGETTEXT dcngettext__
+# define DNGETTEXT libintl_dngettext
+# define DCNGETTEXT libintl_dcngettext
#endif
/* Look up MSGID in the DOMAINNAME message catalog of the current
# define GETTEXT __gettext
# define DCGETTEXT INTUSE(__dcgettext)
#else
-# define GETTEXT gettext__
-# define DCGETTEXT dcgettext__
+# define GETTEXT libintl_gettext
+# define DCGETTEXT libintl_dcgettext
#endif
/* Look up MSGID in the current default message catalog for the current
extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
const char *__codeset));
#else
-extern char *gettext__ PARAMS ((const char *__msgid));
-extern char *dgettext__ PARAMS ((const char *__domainname,
- const char *__msgid));
-extern char *dcgettext__ PARAMS ((const char *__domainname,
- const char *__msgid, int __category));
-extern char *ngettext__ PARAMS ((const char *__msgid1, const char *__msgid2,
- unsigned long int __n));
-extern char *dngettext__ PARAMS ((const char *__domainname,
- const char *__msgid1, const char *__msgid2,
- unsigned long int __n));
-extern char *dcngettext__ PARAMS ((const char *__domainname,
- const char *__msgid1, const char *__msgid2,
- unsigned long int __n, int __category));
-extern char *dcigettext__ PARAMS ((const char *__domainname,
- const char *__msgid1, const char *__msgid2,
- int __plural, unsigned long int __n,
- int __category));
-extern char *textdomain__ PARAMS ((const char *__domainname));
-extern char *bindtextdomain__ PARAMS ((const char *__domainname,
- const char *__dirname));
-extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname,
- const char *__codeset));
+extern char *libintl_gettext PARAMS ((const char *__msgid));
+extern char *libintl_dgettext PARAMS ((const char *__domainname,
+ const char *__msgid));
+extern char *libintl_dcgettext PARAMS ((const char *__domainname,
+ const char *__msgid, int __category));
+extern char *libintl_ngettext PARAMS ((const char *__msgid1,
+ const char *__msgid2,
+ unsigned long int __n));
+extern char *libintl_dngettext PARAMS ((const char *__domainname,
+ const char *__msgid1,
+ const char *__msgid2,
+ unsigned long int __n));
+extern char *libintl_dcngettext PARAMS ((const char *__domainname,
+ const char *__msgid1,
+ const char *__msgid2,
+ unsigned long int __n,
+ int __category));
+extern char *libintl_dcigettext PARAMS ((const char *__domainname,
+ const char *__msgid1,
+ const char *__msgid2,
+ int __plural, unsigned long int __n,
+ int __category));
+extern char *libintl_textdomain PARAMS ((const char *__domainname));
+extern char *libintl_bindtextdomain PARAMS ((const char *__domainname,
+ const char *__dirname));
+extern char *libintl_bind_textdomain_codeset PARAMS ((const char *__domainname,
+ const char *__codeset));
#endif
/* @@ begin of epilog @@ */
/* intl-compat.c - Stub functions to call gettext functions from GNU gettext
Library.
- Copyright (C) 1995, 2000, 2001 Software Foundation, Inc.
+ Copyright (C) 1995, 2000-2002 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
/* @@ end of prolog @@ */
-/* This file redirects the gettext functions (without prefix or suffix) to
- those defined in the included GNU gettext library (with "__" suffix).
- It is compiled into libintl when the included GNU gettext library is
- configured --with-included-gettext.
-
- This redirection works also in the case that the system C library or
- the system libintl library contain gettext/textdomain/... functions.
- If it didn't, we would need to add preprocessor level redirections to
- libgnuintl.h of the following form:
-
-# define gettext gettext__
-# define dgettext dgettext__
-# define dcgettext dcgettext__
-# define ngettext ngettext__
-# define dngettext dngettext__
-# define dcngettext dcngettext__
-# define textdomain textdomain__
-# define bindtextdomain bindtextdomain__
-# define bind_textdomain_codeset bind_textdomain_codeset__
-
- How does this redirection work? There are two cases.
- A. When libintl.a is linked into an executable, it works because
- functions defined in the executable always override functions in
- the shared libraries.
- B. When libintl.so is used, it works because
- 1. those systems defining gettext/textdomain/... in the C library
- (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer) are
- ELF systems and define these symbols as weak, thus explicitly
- letting other shared libraries override it.
- 2. those systems defining gettext/textdomain/... in a standalone
- libintl.so library (namely, Solaris 2.3 and newer) have this
- shared library in /usr/lib, and the linker will search /usr/lib
- *after* the directory where the GNU gettext library is installed.
-
- A third case, namely when libintl.a is linked into a shared library
- whose name is not libintl.so, is not supported. In this case, on
- Solaris, when -lintl precedes the linker option for the shared library
- containing GNU gettext, the system's gettext would indeed override
- the GNU gettext. Anyone doing this kind of stuff must be clever enough
- to 1. compile libintl.a with -fPIC, 2. remove -lintl from his linker
- command line. */
+/* This file redirects the gettext functions (without prefix) to those
+ defined in the included GNU libintl library (with "libintl_" prefix).
+ It is compiled into libintl in order to make the AM_GNU_GETTEXT test
+ of gettext <= 0.11.2 work with the libintl library >= 0.11.3 which
+ has the redirections primarily in the <libintl.h> include file. */
#undef gettext
gettext (msgid)
const char *msgid;
{
- return gettext__ (msgid);
+ return libintl_gettext (msgid);
}
const char *domainname;
const char *msgid;
{
- return dgettext__ (domainname, msgid);
+ return libintl_dgettext (domainname, msgid);
}
const char *msgid;
int category;
{
- return dcgettext__ (domainname, msgid, category);
+ return libintl_dcgettext (domainname, msgid, category);
}
const char *msgid2;
unsigned long int n;
{
- return ngettext__ (msgid1, msgid2, n);
+ return libintl_ngettext (msgid1, msgid2, n);
}
const char *msgid2;
unsigned long int n;
{
- return dngettext__ (domainname, msgid1, msgid2, n);
+ return libintl_dngettext (domainname, msgid1, msgid2, n);
}
unsigned long int n;
int category;
{
- return dcngettext__ (domainname, msgid1, msgid2, n, category);
+ return libintl_dcngettext (domainname, msgid1, msgid2, n, category);
}
textdomain (domainname)
const char *domainname;
{
- return textdomain__ (domainname);
+ return libintl_textdomain (domainname);
}
const char *domainname;
const char *dirname;
{
- return bindtextdomain__ (domainname, dirname);
+ return libintl_bindtextdomain (domainname, dirname);
}
const char *domainname;
const char *codeset;
{
- return bind_textdomain_codeset__ (domainname, codeset);
+ return libintl_bind_textdomain_codeset (domainname, codeset);
}
precedence over _conio_gettext. */
#ifdef __DJGPP__
# undef gettext
-# define gettext gettext
#endif
/* Use _INTL_PARAMS, not PARAMS, in order to avoid clashes with identifiers
extern "C" {
#endif
+
+/* We redirect the functions to those prefixed with "libintl_". This is
+ necessary, because some systems define gettext/textdomain/... in the C
+ library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
+ If we used the unprefixed names, there would be cases where the
+ definition in the C library would override the one in the libintl.so
+ shared library. Recall that on ELF systems, the symbols are looked
+ up in the following order:
+ 1. in the executable,
+ 2. in the shared libraries specified on the link command line, in order,
+ 3. in the dependencies of the shared libraries specified on the link
+ command line,
+ 4. in the dlopen()ed shared libraries, in the order in which they were
+ dlopen()ed.
+ The definition in the C library would override the one in libintl.so if
+ either
+ * -lc is given on the link command line and -lintl isn't, or
+ * -lc is given on the link command line before -lintl, or
+ * libintl.so is a dependency of a dlopen()ed shared library but not
+ linked to the executable at link time.
+ Since Solaris gettext() behaves differently than GNU gettext(), this
+ would be unacceptable. */
+
+
/* Look up MSGID in the current default message catalog for the current
LC_MESSAGES locale. If not found, returns MSGID itself (the default
text). */
+#define gettext libintl_gettext
extern char *gettext _INTL_PARAMS ((const char *__msgid));
/* Look up MSGID in the DOMAINNAME message catalog for the current
LC_MESSAGES locale. */
+#define dgettext libintl_dgettext
extern char *dgettext _INTL_PARAMS ((const char *__domainname,
const char *__msgid));
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
locale. */
+#define dcgettext libintl_dcgettext
extern char *dcgettext _INTL_PARAMS ((const char *__domainname,
const char *__msgid,
int __category));
/* Similar to `gettext' but select the plural form corresponding to the
number N. */
+#define ngettext libintl_ngettext
extern char *ngettext _INTL_PARAMS ((const char *__msgid1,
const char *__msgid2,
unsigned long int __n));
/* Similar to `dgettext' but select the plural form corresponding to the
number N. */
+#define dngettext libintl_dngettext
extern char *dngettext _INTL_PARAMS ((const char *__domainname,
const char *__msgid1,
const char *__msgid2,
/* Similar to `dcgettext' but select the plural form corresponding to the
number N. */
+#define dcngettext libintl_dcngettext
extern char *dcngettext _INTL_PARAMS ((const char *__domainname,
const char *__msgid1,
const char *__msgid2,
/* Set the current default message catalog to DOMAINNAME.
If DOMAINNAME is null, return the current default.
If DOMAINNAME is "", reset to the default of "messages". */
+#define textdomain libintl_textdomain
extern char *textdomain _INTL_PARAMS ((const char *__domainname));
/* Specify that the DOMAINNAME message catalog will be found
in DIRNAME rather than in the system locale data base. */
+#define bindtextdomain libintl_bindtextdomain
extern char *bindtextdomain _INTL_PARAMS ((const char *__domainname,
const char *__dirname));
/* Specify the character encoding in which the messages from the
DOMAINNAME message catalog will be returned. */
+#define bind_textdomain_codeset libintl_bind_textdomain_codeset
extern char *bind_textdomain_codeset _INTL_PARAMS ((const char *__domainname,
const char *__codeset));
-/* Optimized version of the functions above. */
-#if defined __OPTIMIZED
-/* These are macros, but could also be inline functions. */
-
-# define gettext(msgid) \
- dgettext (NULL, msgid)
-
-# define dgettext(domainname, msgid) \
- dcgettext (domainname, msgid, LC_MESSAGES)
-
-# define ngettext(msgid1, msgid2, n) \
- dngettext (NULL, msgid1, msgid2, n)
-
-# define dngettext(domainname, msgid1, msgid2, n) \
- dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
-
-#endif /* Optimizing. */
-
-
#ifdef __cplusplus
}
#endif
# define NGETTEXT __ngettext
# define DCNGETTEXT INTUSE(__dcngettext)
#else
-# define NGETTEXT ngettext__
-# define DCNGETTEXT dcngettext__
+# define NGETTEXT libintl_ngettext
+# define DCNGETTEXT libintl_dcngettext
#endif
/* Look up MSGID in the current default message catalog for the current
}
/* A fixed size buffer. */
-char _nl_default_dirname__[MAXPATHLEN+1];
+char libintl_nl_default_dirname[MAXPATHLEN+1];
char *_nlos2_libdir = NULL;
char *_nlos2_localealiaspath = NULL;
}
if (strlen (_nlos2_localedir) <= MAXPATHLEN)
- strcpy (_nl_default_dirname__, _nlos2_localedir);
+ strcpy (libintl_nl_default_dirname, _nlos2_localedir);
}
# define GERMANIC_PLURAL __gettext_germanic_plural
# define EXTRACT_PLURAL_EXPRESSION __gettext_extract_plural
#elif defined (IN_LIBINTL)
-# define FREE_EXPRESSION gettext_free_exp__
-# define PLURAL_PARSE gettextparse__
-# define GERMANIC_PLURAL gettext_germanic_plural__
-# define EXTRACT_PLURAL_EXPRESSION gettext_extract_plural__
+# define FREE_EXPRESSION libintl_gettext_free_exp
+# define PLURAL_PARSE libintl_gettextparse
+# define GERMANIC_PLURAL libintl_gettext_germanic_plural
+# define EXTRACT_PLURAL_EXPRESSION libintl_gettext_extract_plural
#else
# define FREE_EXPRESSION free_plural_expression
# define PLURAL_PARSE parse_plural_expression
names than the internal variables in GNU libc, otherwise programs
using libintl.a cannot be linked statically. */
#if !defined _LIBC
-# define _nl_default_default_domain _nl_default_default_domain__
-# define _nl_current_default_domain _nl_current_default_domain__
+# define _nl_default_default_domain libintl_nl_default_default_domain
+# define _nl_current_default_domain libintl_nl_current_default_domain
#endif
/* @@ end of prolog @@ */
# define strdup(str) __strdup (str)
# endif
#else
-# define TEXTDOMAIN textdomain__
+# define TEXTDOMAIN libintl_textdomain
#endif
/* Lock variable to protect the global data in the gettext implementation. */
+2002-04-27 Bruno Haible <bruno@clisp.org>
+
+ * plural-1-prg.c: No need to redirect textdomain() etc., now done in
+ libgnuintl.h.
+ * tstgettext.c: Likewise.
+ * tstngettext.c: Likewise.
+
2002-04-24 Bruno Haible <bruno@clisp.org>
* gettext-0.11.2 released.
-/* Test program, used by the plural-1 test. */
+/* Test program, used by the plural-1 test.
+ Copyright (C) 2001-2002 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#include "xsetenv.h"
/* Make sure we use the included libintl, not the system's one. */
-#define textdomain textdomain__
-#define bindtextdomain bindtextdomain__
-#define ngettext ngettext__
#undef _LIBINTL_H
#include "libgnuintl.h"
#define HAVE_SETLOCALE 1
/* Make sure we use the included libintl, not the system's one. */
-#define textdomain textdomain__
-#define bindtextdomain bindtextdomain__
-#define gettext gettext__
-#define dgettext dgettext__
#undef _LIBINTL_H
#include "libgnuintl.h"
#define HAVE_SETLOCALE 1
/* Make sure we use the included libintl, not the system's one. */
-#define textdomain textdomain__
-#define bindtextdomain bindtextdomain__
-#define gettext gettext__
-#define dngettext dngettext__
#undef _LIBINTL_H
#include "libgnuintl.h"