update gettext copy.
authorPierre Habouzit <madcoder@debian.org>
Sun, 29 Oct 2006 01:37:30 +0000 (02:37 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sun, 29 Oct 2006 01:37:30 +0000 (02:37 +0100)
we don't care about OSes that do not have a snprintf

40 files changed:
Makefile.am
configure.in
intl/ChangeLog
intl/Makefile.in
intl/VERSION
intl/bindtextdom.c
intl/config.charset [changed mode: 0644->0755]
intl/dcigettext.c
intl/explodename.c
intl/export.h [new file with mode: 0644]
intl/finddomain.c
intl/gettextP.h
intl/hash-string.c [new file with mode: 0644]
intl/hash-string.h
intl/intl-compat.c
intl/intl-exports.c [new file with mode: 0644]
intl/l10nflist.c
intl/langprefs.c
intl/libgnuintl.h.in [new file with mode: 0644]
intl/loadinfo.h
intl/loadmsgcat.c
intl/localcharset.c
intl/localealias.c
intl/localename.c
intl/lock.c [new file with mode: 0644]
intl/lock.h [new file with mode: 0644]
intl/log.c
intl/osdep.c
intl/plural-exp.c
intl/plural-exp.h
intl/plural.c
intl/plural.y
intl/printf-args.c
intl/printf.c
intl/relocatable.c
intl/relocatable.h
intl/textdomain.c
intl/vasnprintf.c
intl/version.c [new file with mode: 0644]
snprintf.c [deleted file]

index d0c2bba..d949971 100644 (file)
@@ -110,7 +110,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \
        makedoc.c stamp-doc-rc README.SSL smime.h\
        muttngbug pgppacket.h depcomp ascii.h BEWARE \
        mkchangelog.sh cvslog2changelog.pl mutt_idna.h \
-       snprintf.c regex.c mutt_libesmtp.h crypt-gpgme.h
+       regex.c mutt_libesmtp.h crypt-gpgme.h
 
 muttng_dotlock_SOURCES = mutt_dotlock.c
 muttng_dotlock_LDADD = @LIBOBJS@
index 37190f2..ed0ea67 100644 (file)
@@ -326,22 +326,14 @@ AC_TYPE_PID_T
 dnl AC_CHECK_TYPE(ssize_t, int)
 
 AC_CHECK_FUNCS(fgetpos memmove setegid srand48 strerror)
-
 AC_REPLACE_FUNCS(strcasecmp strdup setenv)
+AC_CHECK_FUNCS(snprintf vsnprintf)
 
 AC_CHECK_FUNC(getopt)
 if test $ac_cv_func_getopt = yes; then
         AC_CHECK_HEADERS(getopt.h)
 fi
 
-mutt_cv_snprintf=no
-SNPRINTFOBJS=""
-AC_CHECK_FUNCS(snprintf, , [mutt_cv_snprintf=yes])
-AC_CHECK_FUNCS(vsnprintf, , [mutt_cv_snprintf=yes])
-if test $mutt_cv_snprintf = yes; then
-        AC_LIBOBJ(snprintf)
-fi
-
 dnl SCO uses chsize() instead of ftruncate()
 AC_CHECK_FUNCS(ftruncate, , [AC_CHECK_LIB(x, chsize)])
 
index 7d1d96e..fd4940c 100644 (file)
-2005-05-23  Bruno Haible  <bruno@clisp.org>
+2006-07-21  GNU  <bug-gnu-gettext@gnu.org>
 
-       * gettext-0.14.5 released.
+       * Version 0.15 released.
 
-2005-04-11  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.14.4 released.
-
-2005-04-11  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 7:3:4.
-
-2005-03-16  Bruno Haible  <bruno@clisp.org>
-
-       Canonicalize locale names on MacOS X.
-       * localename.c (_nl_locale_name_canonicalize): New function.
-       (_nl_locale_name_default): Use it.
-       * langprefs.c (_nl_locale_name_canonicalize): New declaration.
-       (_nl_language_preferences_default): Use it.
-
-2005-03-14  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.14.3 released.
-
-2005-03-14  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (dist, distdir): Ignore a failure to copy Makefile.in.
-       Needed because the automake-1.9 generated dist rule of the parent
-       directory already copies this file.
-
-2005-03-08  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 7:2:4.
-
-2005-03-06  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (dist, distdir): Fail if some of the files to be
-       distributed do not exist or cannot be copied.
-       Suggested by Alexandre Duret-Lutz <adl@src.lip6.fr>.
-
-2005-02-24  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.14.2 released.
-
-2005-02-12  Bruno Haible  <bruno@clisp.org>
-
-       * vasnprintf.c (EOVERFLOW): Define to a fallback if needed.
-
-2005-02-11  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 7:1:4.
-
-2005-01-29  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.am (libintl.la, libgnuintl.la): Use INTL_MACOSX_LIBS
-       instead of INTL_MACOSX_LDFLAGS.
-
-2004-09-08  Bruno Haible  <bruno@clisp.org>
-
-       * vasnprintf.c (VASNPRINTF): Signal EOVERFLOW if the resulting length
-       is > INT_MAX.
-
-2005-01-01  Bruno Haible  <bruno@clisp.org>
-
-       * dcigettext.c (guess_category_value): Let the environment variables
-       LC_ALL, LC_xxx, LANG take precedence over the system-dependent language
-       preference list.
-       * gettextP.h (_nl_language_preferences): Remove declaration.
-       (_nl_language_preferences_default): New declaration.
-       (_nl_locale_name_posix, _nl_locale_name_default): New declarations.
-       * langprefs.c (_nl_language_preferences_default): Renamed from
-       _nl_language_preferences. Remove handling of getenv("LANGUAGE").
-       * localename.c (_nl_locale_name_posix, _nl_locale_name_default): New
-       functions, extracted from _nl_locale_name.
-       (_nl_locale_name): Use them.
-
-2004-09-06  Bruno Haible  <bruno@clisp.org>
-
-       * localename.c (_nl_locale_name): Add code for MacOS X versions that
-       don't have the CFLocaleCopyCurrent() function.
-       * langprefs.c (_nl_language_preferences): Make code more robust.
-
-2004-09-05  Bruno Haible  <bruno@clisp.org>
-
-       * langprefs.c: New file.
-       * gettextP.h (_nl_language_preferences): New declaration.
-       * dcigettext.c (guess_category_value) [!_LIBC]: Use
-       _nl_language_preferences.
-       * Makefile.in (SOURCES): Add langprefs.c.
-       (OBJECTS): Add langprefs.$lo.
-       (langprefs.lo): New rule.
-       * Makefile.msvc (OBJECTS): Add langprefs.obj.
-       (langprefs.obj): New rule.
-       * Makefile.vms (OBJECTS): Add langprefs.obj.
-       (langprefs.obj): New rule.
-
-2004-09-03  Bruno Haible  <bruno@clisp.org>
-
-       * localename.c (_nl_locale_name): Use a more intelligent fallback on
-       MacOS X versions that have the CFLocaleCopyCurrent() function.
-       * Makefile.in (libintl.la, libgnuintl.la): Use the INTL_MACOSX_LDFLAGS.
-
-2004-09-01  Bruno Haible  <bruno@clisp.org>
-
-       * config.charset: Add support for Darwin 7.
-
-2004-08-13  Bruno Haible  <bruno@clisp.org>
-
-       * libgnuintl.h.in (__GNU_GETTEXT_SUPPORTED_REVISION): Treat major
-       revision 1 like major revision 0. Needed for 2004-01-09 change.
-
-2004-08-08  Bruno Haible  <bruno@clisp.org>
-
-       * relocatable.c (FILE_SYSTEM_PREFIX_LEN): Renamed from
-       FILESYSTEM_PREFIX_LEN.
-       (compute_curr_prefix): Update.
-
-2004-05-14  Bruno Haible  <bruno@clisp.org>
-
-       * vasnprintf.c (VASNPRINTF): Correctly handle the case of a precision
-       that consists of a '.' followed by an empty digit string.
-       Patch by Tor Lillqvist <tml@iki.fi>.
-
-2004-04-28  Bruno Haible  <bruno@clisp.org>
-
-       * dcigettext.c (ISSLASH, IS_ABSOLUTE_PATH, IS_PATH_WITH_DIR): Treat
-       Cygwin like Windows, since it now accepts Windows pathnames.
-       * l10nflist.c (ISSLASH, IS_ABSOLUTE_PATH): Treat Cygwin like Windows,
-       since it now accepts Windows pathnames.
-       * localcharset.c (ISSLASH): Treat Cygwin like Windows, since it now
-       accepts Windows pathnames.
-       * relocatable.c (ISSLASH, IS_PATH_WITH_DIR, FILESYSTEM_PREFIX_LEN):
-       Treat Cygwin like Windows, since it now accepts Windows pathnames.
-       (compute_curr_prefix): Likewise.
-       Reported by Derek Robert Price <derek@ximbiot.com>.
-
-2004-04-23  Bruno Haible  <bruno@clisp.org>
-
-       * localcharset.c (get_charset_aliases): Allow the CHARSETALIASDIR
-       environment variable to override LIBDIR.
-       Suggested by Matthias Clasen <mclasen@redhat.com>.
-
-2004-04-20  Jim Meyering  <jim@meyering.net>
-            Bruno Haible  <bruno@clisp.org>
-
-       * localcharset.c (get_charset_aliases) [!VMS && !WIN32]: Don't leak
-       memory when realloc fails.
-
-2004-03-02  Bruno Haible  <bruno@clisp.org>
-
-       * localename.c (_nl_locale_name): Add info about default territory for
-       Basque, Mongolian, Russian, Tamil. Map Norwegian to nb, not no.
-
-2004-02-02  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (install-exec, installdirs, uninstall): Install
-       preloaded_libintl.so only on glibc systems, not on OpenBSD.
-       Reported by Han Boetes <han@mijncomputer.nl>.
-
-2004-01-29  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.14.1 released.
-
-2004-01-28  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.14 released.
-
-2004-01-21  Bruno Haible  <bruno@clisp.org>
-
-       * config.charset: Add support for MacOS X (Darwin).
-
-2004-01-18  Bruno Haible  <bruno@clisp.org>
-
-       * localename.c (_nl_locale_name): Use two-letter ISO 639 codes for
-       Divehi, Fulfulde, Igbo, Kanuri, Venda.
-
-2004-01-17  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 7:0:4.
-
-2003-12-02  Jakub Jelinek  <jakub@redhat.com>
-
-       * locale.alias: Use nb_NO instead of no_NO for bokmÃ¥l.
-
-2003-11-03  Ulrich Drepper  <drepper@redhat.com>
-
-       * locale.alias: nb_NO is now the correct name, not no_NO.
-
-2004-01-09  Bruno Haible  <bruno@clisp.org>
-
-       * gmo.h (MO_REVISION_NUMBER_WITH_SYSDEP_I): New definition.
-       * loadmsgcat.c (get_sysdep_segment_value): Handle "I".
-       (_nl_load_domain): Treat major revision 1 like major revision 0.
-
-2004-01-08  Bruno Haible  <bruno@clisp.org>
-
-       * loadmsgcat.c (_nl_load_domain): When a string pair uses a system
-       dependent segment not known to this version of the library, ignore
-       the string pair instead of crashing.
-
-2003-12-17  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.13.1 released.
-
-2003-12-17  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 6:1:4.
-
-2003-12-05  Bruno Haible  <bruno@clisp.org>
-
-       * localename.c (_nl_locale_name): Change result for Latin Uzbek locale
-       to match the glibc name.
-
-2003-12-02  Bruno Haible  <bruno@clisp.org>
-
-       * localename.c (LANG_AMHARIC, LANG_BURMESE, LANG_CAMBODIAN,
-       LANG_CHEROKEE, LANG_EDO, LANG_FRISIAN, LANG_FULFULDE, LANG_GUARANI,
-       LANG_HAUSA, LANG_HAWAIIAN, LANG_IBIBIO, LANG_IGBO, LANG_INUKTITUT,
-       LANG_KANURI, LANG_LAO, LANG_LATIN, LANG_OROMO, LANG_PAPIAMENTU,
-       LANG_PASHTO, LANG_SINHALESE, LANG_SOMALI, LANG_TAGALOG, LANG_TAJIK,
-       LANG_TAMAZIGHT, LANG_TIBETAN, LANG_TIGRINYA, LANG_TURKMEN, LANG_YI,
-       LANG_YIDDISH, LANG_YORUBA): New macros.
-       (LANG_GAELIC, LANG_MALTESE, LANG_RHAETO_ROMANCE, LANG_SAAMI, LANG_SUTU,
-       LANG_TSONGA, LANG_TSWANA, LANG_VENDA, LANG_WELSH, LANG_XHOSA,
-       LANG_ZULU): New macros, consistent with those found in Wine.
-       (SUBLANG_BENGALI_INDIA, SUBLANG_BENGALI_BANGLADESH,
-       SUBLANG_ENGLISH_INDONESIA, SUBLANG_ENGLISH_HONGKONG,
-       SUBLANG_ENGLISH_INDIA, SUBLANG_ENGLISH_MALAYSIA,
-       SUBLANG_ENGLISH_SINGAPORE, SUBLANG_FRENCH_WESTINDIES,
-       SUBLANG_FRENCH_REUNION, SUBLANG_FRENCH_CONGO, SUBLANG_FRENCH_SENEGAL,
-       SUBLANG_FRENCH_CAMEROON, SUBLANG_FRENCH_COTEDIVOIRE,
-       SUBLANG_FRENCH_MALI, SUBLANG_FRENCH_MOROCCO, SUBLANG_FRENCH_HAITI,
-       SUBLANG_PUNJABI_INDIA, SUBLANG_PUNJABI_PAKISTAN,
-       SUBLANG_ROMANIAN_ROMANIA, SUBLANG_ROMANIAN_MOLDOVA,
-       SUBLANG_SINDHI_INDIA, SUBLANG_SINDHI_PAKISTAN,
-       SUBLANG_TAMAZIGHT_ARABIC, SUBLANG_TAMAZIGHT_LATIN,
-       SUBLANG_TIGRINYA_ETHIOPIA, SUBLANG_TIGRINYA_ERITREA): New macros.
-       (_nl_locale_name) [WIN32]: Use them. Improve handling of Bengali,
-       Serbian, English, French, Punjabi, Romanian, Sindhi, Tamazight,
-       Tigrinya.
-
-2003-12-02  Bruno Haible  <bruno@clisp.org>
-
-       * config.charset: Treat the new country name CS like the old country
-       name YU.
-
-2003-11-30  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.13 released.
-
-2003-11-23  Paul Eggert  <eggert@twinsun.com>
-            Bruno Haible  <bruno@clisp.org>
-
-       * printf-parse.h: Don't include sys/types.h.
-       (ARG_NONE): New macro.
-       (char_directive): Change type of *arg_index fields to size_t.
-       * wprintf-parse.h: Don't include sys/types.h.
-       (ARG_NONE): New macro.
-       (wchar_t_directive): Change type of *arg_index fields to size_t.
-       * printf-parse.c: Don't include sys/types.h.
-       (SSIZE_MAX): Remove macro.
-       (PRINTF_PARSE): Change the type of the arg_index variables to size_t.
-       Remove unnecessary overflow check.
-       * vasnprintf.c (VASNPRINTF): Update for type change of *arg_index
-       fields.
-
-2003-11-17  Bruno Haible  <bruno@clisp.org>
-
-       * vasnprintf.c (alloca): Remove fallback definition.
-       (freea): Remove definition.
-       (VASNPRINTF): Use alloca only for small sizes, say <= 4000 bytes.
-       Reported by Paul Eggert.
-
-2003-11-16  Paul Eggert  <eggert@twinsun.com>
-            Bruno Haible  <bruno@clisp.org>
-
-       Protect against address arithmetic overflow.
-       * printf-args.h: Include stddef.h.
-       (arguments): Change type of field 'count' to size_t.
-       * printf-args.c (printf_fetchargs): Use size_t instead of
-       'unsigned int' where appropriate.
-       * printf-parse.h: Include sys/types.h.
-       (char_directive): Change type of *arg_index fields to ssize_t.
-       (char_directives): Change type of fields 'count', max_*_length to
-       size_t.
-       * wprintf-parse.h: Include sys/types.h.
-       (wchar_t_directive): Change type of *arg_index fields to ssize_t.
-       (wchar_t_directives): Change type of fields 'count', max_*_length to
-       size_t.
-       * printf-parse.c: Include sys/types.h and xsize.h.
-       (SSIZE_MAX): Define fallback value.
-       (PRINTF_PARSE): Use size_t instead of 'unsigned int' and ssize_t
-       instead of 'int' where appropriate. Check a_allocated, d_allocated
-       against overflow. Reject %m$ argument numbers > SSIZE_MAX + 1.
-       * vasnprintf.c: Include xsize.h.
-       (VASNPRINTF): Use size_t instead of 'unsigned int' where appropriate.
-       Check alloca, malloc, realloc, ENSURE_ALLOCATION arguments against
-       overflow. Avoid wraparound when converting a width or precision from
-       decimal to binary.
-       * xsize.h: New file, from gnulib.
-       * Makefile.in (HEADERS): Add xsize.h.
-       (printf.$lo): Depend on it.
-
-2003-11-16  Bruno Haible  <bruno@clisp.org>
-
-       * libgnuintl.h.in (_INTL_REDIRECT_ASM): Don't define on AIX with gcc 2.
-       Reported by Kouichi Hashikawa <z01a7ksy@cs.ecip.tohoku.ac.jp>.
-
-2003-10-19  Bruno Haible  <bruno@clisp.org>
-
-       * hash-string.h (hash_string): Zero-extend each char from the string;
-       the old code did a sign-extend on some platforms.
-
-2003-10-19  Jim Meyering  <jim@meyering.net>
-
-       * vasnprintf.c (VASNPRINTF): Work around losing snprintf on HPUX 10.20.
-
-2003-10-09  Bruno Haible  <bruno@clisp.org>
-
-       * relocatable.c: Include xalloc.h instead of xmalloc.h.
-
-2003-10-07  Bruno Haible  <bruno@clisp.org>
-
-       Assume ANSI C.
-       * libgnuintl.h.in (PARAMS): Remove macro.
-       (gettext, dgettext, dcgettext, ngettext, dngettext, dcngettext,
-       textdomain, bindtextdomain, bind_textdomain_codeset, fprintf, vfprintf,
-       printf, vprintf, sprintf, vsprintf, snprintf, vsnprintf, asprintf,
-       vasprintf, fwprintf, vfwprintf, wprintf, vwprintf, swprintf, vswprintf,
-       libintl_set_relocation_prefix): Use ANSI C function declarations.
-       * gettextP.h (PARAMS): Remove macro.
-       (_nl_locale_name, _nl_find_domain, _nl_load_domain, _nl_unload_domain,
-       _nl_init_domain_conv, _nl_free_domain_conv, _nl_find_msg, __gettext,
-       __dgettext, __dcgettext, __ngettext, __dngettext, __dcngettext,
-       __dcigettext, __textdomain, __bindtextdomain,
-       __bind_textdomain_codeset, libintl_dcigettext): Use ANSI C function
-       declarations.
-       * hash-string.h (PARAMS): Remove macro.
-       (hash_string): Use ANSI C function declaration.
-       * loadinfo.h (PARAMS): Remove macro.
-       (_nl_normalize_codeset, _nl_make_l10nflist, _nl_expand_alias,
-       _nl_explode_name, _nl_find_language): Use ANSI C function declarations.
-       * plural-exp.h (PARAMS): Remove macro.
-       (FREE_EXPRESSION, PLURAL_PARSE, GERMANIC_PLURAL,
-       EXTRACT_PLURAL_EXPRESSION): Use ANSI C function declarations.
-       * bindtextdom.c (set_binding_values, BINDTEXTDOMAIN,
-       BIND_TEXTDOMAIN_CODESET): Use ANSI C function declarations.
-       * dcgettext.c (DCGETTEXT): Likewise.
-       * dcigettext.c (transcmp, DCIGETTEXT, _nl_log_untranslated,
-       _nl_find_msg, plural_lookup, category_to_name, guess_category_value,
-       stpcpy, mempcpy): Likewise.
-       * dcngettext.c (DCNGETTEXT): Likewise.
-       * dgettext.c (DGETTEXT): Likewise.
-       * dngettext.c (DNGETTEXT): Likewise.
-       * eval-plural.h (plural_eval): Likewise.
-       * explodename.c (_nl_find_language, _nl_explode_name): Likewise.
-       * finddomain.c (_nl_find_domain): Likewise.
-       * gettext.c (GETTEXT): Likewise.
-       * intl-compat.c (gettext, dgettext, dcgettext, ngettext, dngettext,
-       dcngettext, textdomain, bindtextdomain, bind_textdomain_codeset):
-       Likewise.
-       * l10nflist.c (argz_count__, argz_stringify__, argz_next__, pop,
-       _nl_make_l10nflist, _nl_normalize_codeset, stpcpy): Likewise.
-       * loadmsgcat.c (get_sysdep_segment_value, _nl_init_domain_conv,
-       locale_charset, _nl_free_domain_conv, _nl_load_domain,
-       _nl_unload_domain): Likewise.
-       * localealias.c (_nl_expand_alias, read_alias_file, alias_compare):
-       Likewise.
-       * localename.c (_nl_locale_name): Likewise.
-       * log.c (print_escaped, _nl_log_untranslated): Likewise.
-       * ngettext.c (NGETTEXT): Likewise.
-       * plural-exp.c (EXTRACT_PLURAL_EXPRESSION): Likewise.
-       * plural.y (new_exp, new_exp_0, new_exp_1, new_exp_2, new_exp_3,
-       FREE_EXPRESSION, yylex, yyerror): Likewise.
-       * textdomain.c (TEXTDOMAIN): Likewise.
-
-2003-09-17  Bruno Haible  <bruno@clisp.org>
-
-       * printf.c: Test HAVE_FWPRINTF, not HAVE_WPRINTF. Needed for
-       portability to Cygwin.
-
-2003-09-04  Bruno Haible  <bruno@clisp.org>
-
-       * dgettext.c: Include <locale.h> after gettextP.h, not before. This
-       ensures that libintl_dcgettext is correctly declared on Solaris.
-       (Needed because Solaris <locale.h> includes libintl.h.)
-       * dngettext.c: Likewise, for the libintl_dcngettext declaration.
-
-2003-08-29  Bruno Haible  <bruno@clisp.org>
-
-       * vasnprintf.c: Test HAVE_DECL__SNPRINTF instead of HAVE__SNPRINTF.
-       Test HAVE_DECL__SNWPRINTF instead of HAVE__SNWPRINTF.
-       * printf.c: Likewise.
-
-2003-08-27  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (install-exec): Fix the 2003-04-06 patch.
-
-2003-08-24  Bruno Haible  <bruno@clisp.org>
-
-       * vasnprintf.c (local_wcslen): Protect against multiple definition.
-       (USE_SNPRINTF): Define also if only _snprintf() is available.
-       (SNPRINTF): Possibly define as _snprintf or _snwprintf.
-       * printf.c (DLL_EXPORTED): New macro.
-       Mark all functions as DLL_EXPORTED.
-       (system_vsnprintf): New macro.
-       (libintl_vsnprintf): Use it.
-       (system_vswprintf): New macro.
-       (libintl_vswprintf): Use it.
-
-2003-08-24  Bruno Haible  <bruno@clisp.org>
-
-       * libgnuintl.h.in: Use <stdarg.h> when compiling with MSVC, even though
-       it doesn't define __STDC__ by default.
-
-2003-08-24  Bruno Haible  <bruno@clisp.org>
-
-       * relocatable.h: Make this file includable in C++ mode: add extern "C".
-
-2003-08-23  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 6:0:4.
-
-2003-08-20  Bruno Haible  <bruno@clisp.org>
-
-       * config.charset (linux-gnulibc1*): Change hr_HR, ro_RO to ISO-8859-2.
-       Reported by Alain Guibert <derogaton+bgli@oreka.com>.
-
-2003-08-14  Bruno Haible  <bruno@clisp.org>
-
-       * config.charset: Add support for Linux libc5. Based on data from
-       Alain Guibert <derogaton+bgli@oreka.com>.
-
-2003-08-11  Bruno Haible  <bruno@clisp.org>
-
-       * vasnprintf.c (local_wcslen): New function, for Solaris 2.5.1.
-       (VASNPRINTF): Use it instead of wcslen.
-
-2003-08-01  Bruno Haible  <bruno@clisp.org>
-
-       * relocatable.c (find_shared_library_fullname): Disable the code on
-       Linux/libc5. Reported by Alain Guibert <derogaton+bgli@oreka.com>.
-
-2003-06-27  Bruno Haible  <bruno@clisp.org>
-
-       Avoid use of *_unlocked functions on Solaris 2.5.1.
-       * localcharset.c: Test HAVE_DECL_GETC_UNLOCKED, not HAVE_GETC_UNLOCKED.
-       * localealias.c: Test HAVE_DECL_*_UNLOCKED, not HAVE_*_UNLOCKED.
-       Reported by Eric Botcazou <ebotcazou@libertysurf.fr>.
-
-2003-06-22  Bruno Haible  <bruno@clisp.org>
-
-       Portability to mingw32.
-       * relocatable.c [WIN32]: Include <windows.h>.
-       Reported by Jeff Bonggren <jbon@cfl.rr.com>.
-
-2003-06-22  Bruno Haible  <bruno@clisp.org>
-
-       * relocatable.c (compute_curr_prefix): Comment out this function in
-       the case when it is not used.
-       Reported by Pavel Roskin <proski@gnu.org>.
-
-2003-06-22  Bruno Haible  <bruno@clisp.org>
-
-       * gettextP.h: Undefine _INTL_REDIRECT_INLINE, _INTL_REDIRECT_MACROS,
-       possibly defined in config.h, before setting _INTL_REDIRECT_MACROS.
-       Reported by Pavel Roskin <proski@gnu.org>.
-
-2003-06-19  Bruno Haible  <bruno@clisp.org>
-
-       * printf-args.h: New file, from ../libasprintf.
-       * printf-args.c: New file, from ../libasprintf.
-       * printf-parse.h: New file, from ../libasprintf.
-       * printf-parse.c: New file, from ../libasprintf.
-       * vasnprintf.h: New file, from ../libasprintf.
-       * vasnprintf.c: New file, from ../libasprintf.
-       * wprintf-parse.h: New file.
-       * vasnwprintf.h: New file.
-       * printf.c: New file.
-       * libgnuintl.h.in (fprintf, vfprintf, printf, vprintf, sprintf,
-       vsprintf, snprintf, vsnprintf, asprintf, vasprintf, fwprintf,
-       vfwprintf, wprintf, vwprintf, swprintf, vswprintf): New fallback
-       macros.
-       * Makefile.in (HEADERS): Add printf-args.h, printf-args.c,
-       printf-parse.h, wprintf-parse.h, printf-parse.c, vasnprintf.h,
-       vasnwprintf.h, vasnprintf.c.
-       (SOURCES): Add printf.c.
-       (OBJECTS): Add printf.$lo.
-       (DISTFILES.gettext): Add libgnuintl.h_vms, libgnuintl.h.msvc-static.
-       (printf.lo): New rule.
-       (libgnuintl.h): Also perform some AC_SUBST substitutions.
-       (printf.$lo): New dependencies.
-       * Makefile.msvc (OBJECTS): Add printf.obj.
-       (libgnuintl.h): Use libgnuintl.h.msvc-static.
-       (printf.obj): New rule.
-       * Makefile.vms (libgnuintl.h): Use libgnuintl.h_vms.
-
-2003-06-12  Bruno Haible  <bruno@clisp.org>
-
-       * libgnuintl.h (_INTL_REDIRECT_ASM): Don't define when using Mingw.
-       Reported by Tor Lillqvist <tml@iki.fi>.
-
-2003-06-08  Bruno Haible  <bruno@clisp.org>
-
-       * dcigettext.c (getcwd) [VMS]: Pass 3 arguments.
-       Reported by Jouk Jansen <joukj@hrem.stm.tudelft.nl>.
-
-2003-05-22  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.12.1 released.
-
-2003-05-20  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (VPATH): Add back this variable, needed outside gettext
-       when $builddir != $srcdir.
-       Reported by Pavel Roskin <proski@gnu.org>.
-
-2003-05-18  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.msvc (DEBUGFLAGS): New variable.
-       (intl.lib): Use it.
-
-2003-05-17  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.12 released.
-
-2003-05-12  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.msvc (PICFLAGS, CFLAGS): Move BUILDING_* macros from
-       CFLAGS to PICFLAGS.
-       Reported by Perry Rapp.
-
-2003-05-07  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.vms (install): Fix mistake.
-
-2003-05-03  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (LIBS): New variable.
-       (libintl.la, libgnuintl.la): Use it.
-       Reported by Andreas Buening <andreas.buening@nexgo.de>.
-
-2003-04-12  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.vms: New variables ABIFLAGS, DEFS. Avoid rules with no
-       lines. Update library creation rule. Don't use the force target.
-       Correct wildcard syntax.
-       Suggested by Jouk Jansen <joukj@hrem.stm.tudelft.nl>.
-
-2003-04-12  Bruno Haible  <bruno@clisp.org>
-
-       * localcharset.c (get_charset_aliases): Add special case for VMS.
-
-2003-04-06  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (install-exec): Remove the installed libintl.la if it
-       has hardwired pathnames in dependency_libs and the installed package
-       shall be relocatable.
-
-2003-04-05  Bruno Haible  <bruno@clisp.org>
-
-       * relocatable.c: Rely on DEPENDS_ON_LIBCHARSET, DEPENDS_ON_LIBICONV,
-       DEPENDS_ON_LIBINTL, not on NO_LIBRARIES.
-       * Makefile.in (DEFS): Define DEPENDS_ON_LIBICONV, for relocatable.c.
-       * Makefile.msvc (CFLAGS): Also define DEPENDS_ON_LIBICONV.
-
-2003-04-05  Bruno Haible  <bruno@clisp.org>
-
-       * relocatable.c (_GNU_SOURCE): Define, to ensure getline() gets
-       declared by <stdio.h>.
-
-2003-04-04  Bruno Haible  <bruno@clisp.org>
-
-       * gettextP.h [!_LIBC]: Remove declarations of exported libintl_*
-       functions; include libgnuintl.h instead.
-       * intl-compat.c: Remove include of libgnuintl.h.
-       (DLL_EXPORTED): New macro.
-       (gettext, dgettext, dcgettext, ngettext, dngettext, dcngettext,
-       textdomain, bindtextdomain, bind_textdomain_codeset): Use it.
-
-2003-04-04  Bruno Haible  <bruno@clisp.org>
-
-       * libgnuintl.h.in (libintl_set_relocation_prefix): Convert extern
-       declaration to K&R syntax.
-
-2003-03-30  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.vms: New file.
-       * Makefile.in (DISTFILES.gettext): Add Makefile.vms.
-
-2003-03-30  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (INCLUDES): Mention the current directory first.
-
-2003-03-17  Bruno Haible  <bruno@clisp.org>
-
-       Native Woe32/MSVC support.
-       * libgnuintl.h.in: Renamed from libgnuintl.h.
-       * Makefile.msvc: New file.
-       * README.woe32: New file.
-       * Makefile.in (HEADERS): Remove libgnuintl.h, add libgnuintl.h.in.
-       (DISTFILES.gettext): Add libgnuintl.h.msvc-shared, README.woe32,
-       Makefile.msvc.
-       (DISTFILES.obsolete): Add libgnuintl.h.
-       (libgnuintl.h): New rule.
-       (libintl.h, $(OBJECTS)): Expect libgnuintl.h in builddir, not in
-       srcdir.
-       (mostlyclean): Also remove libgnuintl.h.
-       * dcigettext.c (alloca): Add support for MSVC.
-       * loadmsgcat.c (alloca): Likewise.
-       * localealias.c (alloca): Likewise.
-       * relocatable.h (RELOCATABLE_DLL_EXPORTED): New macro.
-
-       * Makefile.in (loadmsgcat.$lo): Depend on hash-string.h.
-
-2003-02-28  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (localcharset.$lo): Depend on localcharset.h.
-
-2003-02-28  Bruno Haible  <bruno@clisp.org>
-
-       Support for relocatable installation.
-       * relocatable.h: New file.
-       * relocatable.c: New file.
-       * libgnuintl.h (libintl_set_relocation_prefix): New declaration.
-       * localealias.c: Include relocatable.h.
-       (read_alias_file): Relocate LOCALE_ALIAS_PATH element.
-       * localcharset.c: Include relocatable.h.
-       (get_charset_aliases): Relocate LIBDIR value.
-       * Makefile.in (DEFS): Define also ENABLE_RELOCATABLE, IN_LIBRARY,
-       INSTALLDIR, NO_XMALLOC, set_relocation_prefix, relocate.
-       (HEADERS): Add relocatable.h.
-       (SOURCES): Add relocatable.c.
-       (OBJECTS): Add relocatable.$lo.
-       (relocatable.$lo): New rule.
-
-2003-02-28  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (mkinstalldirs): Simplify. Prepending "$(top_builddir)/"
-       in the case of a relative $srcdir is now handled in gettext.m4.
-
-2003-02-28  Bruno Haible  <bruno@clisp.org>
-
-       * localcharset.h: Change copyright to LGPL. Enclose declaration in
-       extern "C", for C++ compilers.
-       * localcharset.c: Drop C linkage declaration.
-
-2003-02-18  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 5:0:3.
-
-2003-01-29  Bruno Haible  <bruno@clisp.org>
-
-       * config.charset: Add an alias for CP1251 on Solaris.
-       Reported by Hidetoshi Tajima <hidetoshi.tajima@sun.com>.
-
-2003-02-16  Bruno Haible  <bruno@clisp.org>
-
-       * log.c: New file.
-       * dcigettext.c (DCIGETTEXT) [!_LIBC]: Before returning the
-       untranslated string, call _nl_log_untranslated.
-       * intl-compat.c: Comments.
-       * Makefile.in (SOURCES): Add log.c.
-       (OBJECTS): Add intl-compat.$lo unconditionally. Add log.$lo.
-       (log.lo): New rule.
-       (install-exec): Stop using @INTLOBJS@. Install preloadable_libintl.so.
-       (installdirs, uninstall): Update accordingly.
-
-2003-02-16  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (.sin.sed): Remove rule.
-       (ref-add.sed, ref-del.sed): New rules.
-
-2003-02-12  Bruno Haible  <bruno@clisp.org>
-
-       Big restructuring.
-       * Makefile.in: Make usable with $srcdir != $builddir even when not
-       using GNU make.
-       (VPATH): Remove variable.
-       (.c.lo): Remove rule. Use a separate rule for every object file.
-       (libintl.h, charset.alias, $(OBJECTS)): Refer to $srcdir where
-       appropriate.
-       (INCLUDES): Simplify.
-       (install-exec): Special case packages 'gettext-runtime' and
-       'gettext-tools'.
-       (install-data): Special case package 'gettext-tools'.
-       (installdirs, uninstall): Special case packages 'gettext-runtime' and
-       'gettext-tools'.
-       (distclean, dist): Likewise.
-       (Makefile): Work around autoconf error message.
-
-2003-01-12  Bruno Haible  <bruno@clisp.org>
-
-       * localcharset.h: New file.
-       * localcharset.c: Include it.
-       * Makefile.in (HEADERS): Add localcharset.h.
-       (COMHDRS): Remove variable, fold into HEADERS.
-       (COMSRCS): Remove variable, fold into SOURCES.
-
-2002-12-12  Bruno Haible  <bruno@clisp.org>
-
-       * dcigettext.c (INTVARDEF): Correct fallback definition.
-
-2002-11-19  Ulrich Drepper  <drepper@redhat.com>
-
-       * localealias.c (read_alias_file): Use only about 400 bytes of stack
-       space instead of 16k.
-
-2002-10-30  Jakub Jelinek  <jakub@redhat.com>
-
-       * finddomain.c (free_mem): Use libc_freeres_fn macro, remove
-       text_set_element.
-       * dcigettext.c (free_mem): Likewise.
-
-2002-10-25  Jakub Jelinek  <jakub@redhat.com>
-
-       * localealias.c (libc_freeres_ptr): Define if !_LIBC.
-       (string_space, map): Add libc_freeres_ptr.
-       (free_mem): Remove.
-
-2002-09-19  Bruno Haible  <bruno@clisp.org>
-
-       * dcigettext.c (DCIGETTEXT): Restore errno only right before
-       returning.
-
-2002-09-01  Roland McGrath  <roland@redhat.com>
-
-       * localealias.c [__GNUC__]: #undef alloca before #define.
-
-2002-08-30  Roland McGrath  <roland@redhat.com>
-
-       * dcigettext.c (DCIGETTEXT) [_LIBC]: Check for bogus CATEGORY.
-       [_LIBC] (category_to_name): Don't define the function.  Instead define
-       a macro using _nl_category_names.
-
-2002-08-04  Ulrich Drepper  <drepper@redhat.com>
-
-       * dcigettext.c: Define _nl_default_dirname_internal as hidden alias
-       and use it.
-       * bindtextdom.c: Use _nl_default_dirname_internal.
-
-2002-08-03  Roland McGrath  <roland@redhat.com>
-
-       * dcigettext.c (guess_category_value): Use __current_locale_name
-       instead of calling setlocale.
-
-2002-08-02  Roland McGrath  <roland@redhat.com>
-
-       * loadmsgcat.c (_nl_init_domain_conv): Use _NL_CURRENT.
-
-2002-07-30  Roland McGrath  <roland@redhat.com>
-
-       * loadmsgcat.c [__GNUC__]: #undef alloca before defining it.
-
-2002-05-01  Ulrich Drepper  <drepper@redhat.com>
-
-       Revert 2002-04-09 change.
-       * dcngettext.c (__dcngettext_internal): Remove alias.
-       * dngettext.c: Use __dcngettext instead of __dcngettext_internal.
-       * ngettext.c: Likewise.
-
-2002-11-07  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (mostlyclean): Remove object files on OS/2 as well.
-       Reported by Andreas Buening <andreas.buening@nexgo.de>.
-
-2002-10-16  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (ps, pdf, html, ctags): New targets, for automake-1.7
-       compatibility.
-       (CTAGS): New rule.
-
-2002-09-18  Bruno Haible  <bruno@clisp.org>
-
-       * libgnuintl.h (_INTL_REDIRECT_ASM): Don't define when using Apple cc.
-       Reported by Julien Chiron <julien.chiron@univ.u-3mrs.fr>.
-
-2002-08-06  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.11.5 released.
-
-2002-07-25  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.11.4 released.
-
-2002-07-25  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 4:0:2.
-
-2002-07-23  Bruno Haible  <bruno@clisp.org>
-
-       * loadmsgcat.c (PRI*): Redefine the macros if PRI_MACROS_BROKEN is set.
-
-2002-07-21  Bruno Haible  <bruno@clisp.org>
-
-       * libgnuintl.h (__GNU_GETTEXT_SUPPORTED_REVISION): New macro.
-       * gmo.h (struct mo_file_header): New fields n_sysdep_segments,
-       sysdep_segments_offset, n_sysdep_strings, orig_sysdep_tab_offset,
-       trans_sysdep_tab_offset.
-       (struct sysdep_segment): New type.
-       (struct sysdep_string): New type.
-       (SEGMENTS_END): New macro.
-       * gettextP.h (struct sysdep_string_desc): New type.
-       (struct loaded_domain): New fields malloced, n_sysdep_strings,
-       orig_sysdep_tab, trans_sysdep_tab, must_swap_hash_tab. Make fields
-       orig_tab, trans_tab, hash_tab to const pointers because they point
-       into read-only memory.
-       * loadmsgcat.c: Include stdint.h, inttypes.h, hash-string.h.
-       (PRI*): Define fallback values.
-       (get_sysdep_segment_value): New function.
-       (_nl_load_domain): Distinguish major and minor revision parts. Add
-       support for minor revision 1 with system dependent strings.
-       (_nl_unload_domain): Also free the 'malloced' field.
-       * dcigettext.c (_nl_find_msg): Remove test for domain->hash_size, now
-       done in loadmsgcat.c. Add support for system dependent strings.
-
-2002-07-17  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.11.3 released.
-
-2002-07-16  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 3:0:1.
-
-2002-07-13  Bruno Haible  <bruno@clisp.org>
-
-       * dcigettext.c (freea): New macro.
-       (FREE_BLOCKS): Free also the registered blocks.
-       (DCIGETTEXT): Free the 'search' variable.
-       Reported by Andreas Fischer <a.fischer@asentics.de>.
-
-2002-06-13  Bruno Haible  <bruno@clisp.org>
-
-       Make absolute pathnames inside $LANGUAGE work.
-       * l10nflist.c (_nl_make_l10nflist): Ignore dirlist if language is an
-       absolute path. Fix sizes passed to malloc. Simplify linked list
-       handling.
-
-2002-06-13  Bruno Haible  <bruno@clisp.org>
-
-       * localename.c [WIN32] (LANG_DIVEHI, LANG_GALICIAN, LANG_KYRGYZ,
-       LANG_MONGOLIAN, LANG_SYRIAC): Provide fallback definitions.
-       (_nl_locale_name): Add Amharic, Burmese, Cambodian, Cherokee, Divehi,
-       Edo, Frisian, Fulfulde, Gaelic, Guarani, Hausa, Hawaiian, Ibibio,
-       Igbo, Inuktitut, Kanuri, Kyrgyz, Lao, Latin, Maltese, Mongolian,
-       Oromo, Papiamentu, Pashto, Rhaeto-Romance, Sami, Sinhalese, Somali,
-       Syriac, Tagalog, Tajik, Tomazight, Tibetan, Tigrinya, Tsonga, Turkmen,
-       Venda, Welsh, Xhosa, Yi, Yiddish, Yoruba, Zulu. Fix Swahili, Tatar.
-
-2002-06-07  Bruno Haible  <bruno@clisp.org>
-
-       * dcigettext.c (INTDIV0_RAISES_SIGFPE): Define a fallback.
-       Include <signal.h>.
-       * eval-plural.h (plural_eval): Let division by zero cause SIGFPE on
-       all platforms.
-
-2002-05-30  Bruno Haible  <bruno@clisp.org>
-
-       * libgnuintl.h (_INTL_REDIRECT_ASM, _INTL_REDIRECT_INLINE,
-       _INTL_REDIRECT_MACROS, _INTL_ASM, _INTL_ASMNAME, _INTL_STRINGIFY):
-       New macros. Use them instead of plain preprocessor level indirection
-       when appropriate.
-       * intl-compat.c: Define _INTL_REDIRECT_MACROS.
-
-2002-05-28  Bruno Haible  <bruno@clisp.org>
-
-       * localename.c (LANG_SORBIAN): Provide a default value, for mingw32.
-       Reported by Michael Opdenacker <m-opdenacker@ti.com>
-       and Rob Leslie <rob@mars.org>.
-
-2002-05-09  Bruno Haible  <bruno@clisp.org>
-
-       * config.charset: Update for newest glibc. Add canonical names
-       ISO-8859-14, KOI8-T, TCVN5712-1, GEORGIAN-PS.
-
-2002-05-09  Bruno Haible  <bruno@clisp.org>
-
-       * localcharset.c (get_charset_aliases): Add more Windows specific
-       aliases.
-
-2002-05-08  Owen Taylor  <otaylor@redhat.com>
-
-       * config.charset: A few additions for Solaris.
-
-2001-12-05  Bruno Haible  <bruno@clisp.org>
-
-       * localcharset.c (locale_charset): Don't return an empty string.
-
-2001-10-23  Bruno Haible  <haible@clisp.cons.org>
-
-       * config.charset: msdos in uk_UA uses CP1125.
-
-2001-08-05  Bruno Haible  <haible@clisp.cons.org>
-
-       Make it possible to build libcharset with CC=gcc CFLAGS="-x c++".
-       * localcharset.c (locale_charset): Declare as extern "C".
-       (get_charset_aliases): Cast malloc and realloc results to 'char *'.
-
-2002-04-30  Bruno Haible  <bruno@clisp.org>
-
-       * loadmsgcat.c (_nl_init_domain_conv): Don't append //TRANSLIT to
-       the encoding if it already has slashes.
-       Reported by Perry Rapp <prapp@erols.com>.
-
-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.
-
-2002-04-24  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 2:1:0.
-
-2002-04-19  Bruno Haible  <bruno@clisp.org>
-
-       * gettextP.h (attribute_hidden): Define as empty macro if not
-       already defined.
-
-2002-04-09  Ulrich Drepper  <drepper@redhat.com>
-
-       * dcngettext.c [_LIBC]: Use INTUSE for __dcngettext.
-       * dngettext.c [_LIBC] (DCNGETTEXT): Use INTUSE.
-       * ngettext.c: Likewise.
-       * l10nflist.c [_LIBC]: Use INTUSE for __argz_count and
-       __argz_stringify.
-
-2002-04-08  Ulrich Drepper  <drepper@redhat.com>
-
-       * dcgettext.c (__dcgettext): Use INTDEF to define alias.
-       * dgettext.c: Call __dcgettext_internal instead of __dcgettext.
-       * gettext.c: Likewise.
-
-2002-03-12  Ulrich Drepper  <drepper@redhat.com>
-
-       * plural-exp.h (attribute_hidden): Define as empty macro if not
-       already defined.
-       (GERMANIC_PLURAL): Declare as hidden.
-       * dcigettext.c (_nl_default_default_domain): Define as hidden.
-       (_nl_current_default_domain): Likewise
-       (_nl_state_lock): Likewise.
-       * textdomain.c (_nl_default_default_domain): Declare as hidden.
-       (_nl_current_default_domain): Likewise
-       (_nl_state_lock): Likewise.
-       * bindtextdom.c (_nl_state_lock): Likewise.
-
-2002-03-15  Andrew Zabolotny  <zap@cobra.ru>
-
-       * os2compat.h: Use prefix _nlos2 instead of _os2, to avoid any
-       possible name clashes.
-       * os2compat.c: Likewise.
-
-2002-03-15  Bruno Haible  <bruno@clisp.org>
-
-       * libgnuintl.h (LC_MESSAGES): Don't define on Solaris 2.5, to avoid
-       a warning.
-       Reported by Stephen Gildea <gildea@stop.mail-abuse.org>.
-
-2002-03-12  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.11.1 released.
-
-2002-02-15  Bruno Haible  <bruno@clisp.org>
-
-       * config.charset [msdosdjgpp]: For Russian, use CP866.
-
-2002-02-14  Andrew Zabolotny  <zap@cobra.ru>
-
-       * os2compat.c (_nl_default_dirname__): Renamed from
-       _nl_default_dirname.
-
-2002-02-10  Bruno Haible  <bruno@clisp.org>
-
-       * localename.c: Change copyright notice from GPL to LGPL.
-       * eval-plural.h: Likewise.
-
-2002-02-11  Bruno Haible  <bruno@clisp.org>
-
-       * config.charset: Add support for NetBSD.
-
-2002-01-31  Bruno Haible  <bruno@clisp.org>
-
-       * gettext-0.11 released.
-
-2002-01-31  Bruno Haible  <bruno@clisp.org>
-
-       * eval-plural.h: Renamed from plural-eval.c.
-       * dcigettext.c: Include eval-plural.h instead of plural-eval.c.
-       * Makefile.in (COMHDRS): Remove plural-eval.c, add eval-plural.h.
-       (DISTFILES.obsolete): Add plural-eval.c.
-
-2002-01-24  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (libintl.la): Use @LTLIBICONV@ instead of @LIBICONV@.
-
-2002-01-10  Andrew Zabolotny  <zap@cobra.ru>
-           Bruno Haible  <bruno@clisp.org>
-
-       * dcigettext.c (_nl_default_dirname): On OS/2, declare, not define.
-       * localcharset.c: Rework OS/2 support.
-       * config.charset: Add OS/2 support.
-       * os2compat.c: Renamed from os2.c.
-       (_nl_default_dirname): Define here.
-       * os2compat.h: Moved here from ../os2/.
-       * osdep.c: Update.
-       * Makefile.in (COMHDRS): Add os2compat.h.
-       (COMSRCS): Add os2compat.c, remove os2.c.
-
-2002-01-05  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (libintl.la): Add -lc. Needed on AIX.
-
-2002-01-02  Bruno Haible  <bruno@clisp.org>
-
-       * loadmsgcat.c (_nl_init_domain_conv): Convert extern declaration to
-       K&R syntax.
-
-2002-01-02  Bruno Haible  <bruno@clisp.org>
-
-       * plural.y: Fix %expect count.
-
-2001-12-23  Bruno Haible  <bruno@clisp.org>
-
-       * os2.c (os2_initialize): Use LOCALEDIR_MAX macro.
-
-2001-12-21  Bruno Haible  <bruno@clisp.org>
-
-       * localcharset.c (ISSLASH): Provide definition for DOS-like systems.
-
-2001-12-21  Bruno Haible  <bruno@clisp.org>
-
-       * libgettext.h: Moved to ../lib/gettext.h.
-       * Makefile.in (HEADERS): Remove libgettext.h.
-       (DISTFILES.obsolete): Add libgettext.h.
-
-2001-12-21  Bruno Haible  <bruno@clisp.org>
-
-       * gmo.h: Renamed from gettext.h.
-       * gettext.h: Remove file.
-       * gettextP.h: Update accordingly.
-       * loadmsgcat.c: Likewise.
-       * Makefile.in (COMHDRS): Add gmo.h, remove gettext.h.
-       (DISTFILES.obsolete): Add gettext.h.
-       Update dependencies.
-
-2001-12-18  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 2:0:0.
-       Used to force an soname of at least libintl.so.2 on Solaris, which
-       already has a different libintl.so.1 in /usr/lib.
-
-2001-12-15  Andrew Zabolotny  <zap@cobra.ru>
-           Bruno Haible  <bruno@clisp.org>
-
-       * osdep.c: New file.
-       * os2.c: New file.
-       * dcigettext.c (DCIGETTEXT): Add backward compatibility support for
-       OS/2.
-       * localcharset.c: Add OS/2 support.
-       * localealias.c (_nl_expand_alias): Initialize locale_alias_path once,
-       but not statically.
-       * Makefile.in (COMSRCS): Add osdep.c, os2.c.
-       (OBJECTS): Add osdep.$lo.
-
-2001-12-12  Bruno Haible  <bruno@clisp.org>
-
-       * libgettext.h [!ENABLE_NLS]: Cast all function results to
-       'const char *'.
-       Reported by Alexandre Duret-Lutz <duret_g@lrde.epita.fr>.
-
-2001-12-03  Bruno Haible  <bruno@clisp.org>
-
-       * Makefile.in (install-exec): Don't create an empty libdir.
-       (installdirs): Update accordingly.
-
-2001-11-30  Bruno Haible  <bruno@clisp.org>
-
-       * plural-exp.h (plural_eval): Add back declaration.
-       * Makefile.in (OBJECTS): Remove plural-eval.$lo.
-       (COMSRCS): Remove plural-eval.c.
-       (COMHDRS): Add plural-eval.c.
-       (plural-eval.$lo): Remove dependency.
-       (dcigettext.$lo): Depend on plural-eval.c.
-
-2001-11-29  Bruno Haible  <bruno@clisp.org>
-
-       * gettextP.h (_nl_locale_name): Don't declare inside glibc.
-       * localename.c (_nl_locale_name): Remove _LIBC conditional.
-
-2001-11-27  Ulrich Drepper  <drepper@redhat.com>
-
-       * dcigettext.c (guess_category_value): Inside glibc, use setlocale
-       directly, not _nl_locale_name.
-
-2001-11-27  Ulrich Drepper  <drepper@redhat.com>
-
-       * loadmsgcat.c (_nl_init_domain_conv): Modify #if expression.
-
-2001-11-27  Ulrich Drepper  <drepper@redhat.com>
-
-       * plural-eval.c (plural_eval): Rename back from PLURAL_EVAL.
-       * plural-exp.h (PLURAL_EVAL): Remove declaration.
-       * dcigettext.c Include plural-eval.c.
-       (plural_lookup): Call plural_eval instead of PLURAL_EVAL.
-
-2001-11-22  Bruno Haible  <bruno@clisp.org>
-
-       * plural-exp.h (GERMANIC_PLURAL): New declaration.
-       * plural-exp.c (GERMANIC_PLURAL): Renamed from germanic_plural.
-       * loadmsgcat.c (_nl_unload_domain): Update.
-
-2001-07-17  Ulrich Drepper  <drepper@redhat.com>
-
-       * localealias.c (read_alias_file): Disable implicit locking
-       for the stream.  Use _unlocked functions for glibc.
-
-2001-11-11  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (dist): Avoid using hard links, because the automake-1.5
-       generated toplevel 'distdir' target chmods all the distributed files.
-
-2001-11-10  Bruno Haible  <haible@clisp.cons.org>
-
-       * libgnuintl.h (_INTL_PARAMS): Renamed from PARAMS, to avoid polluting
-       the user's namespace.
-       Also test for __GNUC__, __SUNPRO_C and __PROTOTYPES because on
-       64-bit Solaris, we need prototypes although __STDC__ is often defined
-       to 0. __GNUC__ covers GCC, __SUNPRO_C covers Sun cc, regardless of
-       compilation flags. __PROTOTYPES covers other compilers when compiling
-       programs using autoconf's AC_C_PROTOTYPES.
-       * gettextP.h (PARAMS): Also test for __SUNPRO_C, because 64-bit Solaris
-       cc needs prototypes although it defines __STDC__ to 0 by default.
-       Also test for __cplusplus and __PROTOTYPES, just for consistency with
-       libgnuintl.h.
-       * hash-string.h (PARAMS): Likewise.
-       * loadinfo.h (PARAMS): Likewise.
-       * plural-exp.h (PARAMS): Likewise.
-
-2001-10-31  Bruno Haible  <haible@clisp.cons.org>
-
-       * plural.y: Include <stddef.h>, needed for NULL with SunOS 4 cc.
-
-2001-10-31  Bruno Haible  <haible@clisp.cons.org>
-
-       * COPYING.LIB-2.0: Renamed from COPYING.LIB-2.
-       * Makefile.in (DISTFILES.gettext, install-data, uninstall): Update.
-       (DISTFILES.obsolete): Add COPYING.LIB-2.
-
-2001-10-09  Bruno Haible  <haible@clisp.cons.org>
-
-       * localcharset.c (getc): Define as getc_unlocked if available.
-
-2001-09-27  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (install-strip, installdirs): New rules.
-
-2001-09-24  Bruno Haible  <haible@clisp.cons.org>
-
-       * localename.c: New file, integrating a function from
-       Tor Lillqvist <tml@iki.fi>.
-       * gettextP.h: New declaration.
-       * dcigettext.c (guess_category_value): Call _nl_locale_name.
-       * Makefile.in (COMSRCS): Add localename.c.
-       (OBJECTS): Add localename.$lo.
-
-2001-09-22  Bruno Haible  <haible@clisp.cons.org>
-
-       * plural-eval.c: New file, extracted from dcigettext.c.
-       * plural-exp.h (PLURAL_EVAL): New declaration.
-       * dcigettext.c (plural_eval): Remove function, moved to plural-eval.c.
-       (plural_lookup): Call PLURAL_EVAL instead of plural_eval.
-       * Makefile.in (COMSRCS): Add plural-eval.c.
-       (OBJECTS): Add plural-eval.$lo.
-
-2001-09-22  Bruno Haible  <haible@clisp.cons.org>
-
-       * plural-exp.c (EXTRACT_PLURAL_EXPRESSION): Reject numbers that don't
-       start with a digit; nplurals must be positive.
-
-2001-10-20  Bruno Haible  <haible@clisp.cons.org>
-
-       Assume strchr() exists. (Without it, explodename.c wouldn't link
-       anyway.)
-       * dcigettext.c (strchr): Remove fallback definition; it conflicts with
-       the variable 'index' in plural_lookup.
-       * l10nflist.c (strchr): Likewise.
-       * localealias.c (strchr): Likewise.
-
-2001-09-24  Bruno Haible  <haible@clisp.cons.org>
-
-       * loadmsgcat.c (_nl_init_domain_conv): Also enable transliteration
-       when building on a glibc system but outside glibc.
-
-2001-09-02  Bruno Haible  <haible@clisp.cons.org>
-
-       * plural-exp.h: New file, extracted from gettextP.h.
-       * plural-exp.c: New file, extracted from loadmsgcat.c.
-       * gettextP.h (struct expression, struct parse_args,
-       __gettext_free_exp, __gettextparse): Move to plural-exp.h.
-       * loadmsgcat.c: Include plural-exp.h.
-       (PLURAL_PARSE): Move macro to plural-exp.h.
-       (plvar, plone, germanic_plural, INIT_GERMANIC_PLURAL): Move to
-       plural-exp.c.
-       (_nl_load_domain): Move plural handling code to plural-exp.c. Call
-       EXTRACT_PLURAL_EXPRESSION.
-       * dcigettext.c: Include plural-exp.h.
-       * plural.y: Include plural-exp.h, not gettextP.h.
-       (FREE_EXPRESSION): Move macro to plural-exp.h.
-       * Makefile.in (DEFS): Define IN_LIBINTL.
-       (COMHDRS): Add plural-exp.h.
-       (COMSRCS): Add plural-exp.c.
-       (OBJECTS): Add plural-exp.$lo.
-       Update dependencies.
-
-2001-07-28  Bruno Haible  <haible@clisp.cons.org>
-
-       * l10nflist.c (_nl_normalize_codeset): Cast isalnum, isalpha, isdigit,
-       tolower argument to 'unsigned char'.
-       * loadmsgcat.c (_nl_load_domain): Cast isspace argument to
-       'unsigned char'.
-       * localealias.c (read_alias_file): Cast isspace argument to
-       'unsigned char'.
-
-2001-07-23  Bruno Haible  <haible@clisp.cons.org>
-
-       * gettext.h: Assume <limits.h> exists.
-
-2001-09-13  Bruno Haible  <haible@clisp.cons.org>
-
-       * gettext-0.10.40 released.
-
-2001-07-11  Ulrich Drepper  <drepper@redhat.com>
-
-       * locale.alias: Use he language code for hebrew, not iw.
-
-2001-09-13  Bruno Haible  <haible@clisp.cons.org>
-
-       * *.h, *.c, *.y, Makefile.in: Change copyright notice from GPL to LGPL.
-       This is a reaction to a blackmail from the GNOME project which
-       threatened to distribute an LGPLed clone of libintl.
-       * COPYING.LIB-2, COPYING.LIB-2.1: New files.
-       * Makefile.in (DISTFILES.gettext): Add them.
-       (install-data): Install them.
-       (uninstall): Uninstall them.
-
-2001-07-24  Bruno Haible  <haible@clisp.cons.org>
-
-       * gettext-0.10.39 released.
-
-2001-06-24  Bruno Haible  <haible@clisp.cons.org>
-
-       * config.charset: Change canonical name of BIG5HKSCS to BIG5-HKSCS.
-       Change canonical name of SJIS to SHIFT_JIS.
-
-2001-06-12  Bruno Haible  <haible@clisp.cons.org>
-
-       * dcigettext.c (DCIGETTEXT): Release the lock before returning.
-
-2001-04-30  Bruno Haible  <haible@clisp.cons.org>
-
-       Silence "gcc -Wall -Wwrite-strings" warnings.
-       * localcharset.c (charset_aliases): Change type to 'const char *'.
-       (get_charset_aliases): Change type of 'cp' to 'const char *'.
-
-2001-05-23  Bruno Haible  <haible@clisp.cons.org>
-
-       * gettext-0.10.38 released.
-
-2001-05-22  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (install-data): Install plural.c as well.
-       (uninstall): Uninstall plural.c as well.
-
-2001-05-18  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (dist): Don't assume $(srcdir) = ".". Distribute
-       file in either current directory or $(srcdir), whichever exists.
-
-2001-05-11  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (install-exec): Don't install charset.alias on glibc 2.1
-       systems.
-
-2001-04-30  Bruno Haible  <haible@clisp.cons.org>
-
-       * dcigettext.c (getuid, getgid, geteuid, getegid): Provide default
-       definitions. Needed for mingw32.
-
-2001-04-19  Bruno Haible  <haible@clisp.cons.org>
-
-       * gettext-0.10.37 released.
-
-2001-04-19  Bruno Haible <haible@clisp.cons.org>
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 1:1:0.
-
-2001-04-19  Bruno Haible <haible@clisp.cons.org>
-
-       * loadmsgcat.c (_nl_init_domain_conv): Don't append //TRANSLIT when
-       the libiconv version is smaller than 1.5.
-
-2001-04-09  Bruno Haible <haible@clisp.cons.org>
-
-       * loadmsgcat.c: Don't use GNU C extensions if __APPLE_CC__ is defined.
-       Apple's MacOS X compiler has not all the features that the regular
-       GCC with the same version number has.
-
-2001-04-07  Bruno Haible <haible@clisp.cons.org>
-
-       * gettextP.h (struct loaded_domain): Add codeset_cntr field.
-       (struct binding): Add codeset_cntr field.
-       (_nl_load_domain): Add domainbinding argument.
-       (_nl_init_domain_conv, _nl_free_domain_conv): New declarations.
-       (_nl_find_msg): New declaration, moved here from loadinfo.h.
-       * loadinfo.h (struct loaded_l10nfile): Remove domainbinding field.
-       (_nl_make_l10nflist): Remove domainbinding argument.
-       (_nl_find_msg): Move declaration to gettextP.h.
-       * bindtextdom.c (set_binding_values): Initialize ->codeset_cntr to 0.
-       Increment it when ->codeset is changed.
-       * dcigettext.c (DCIGETTEXT): Pass binding to _nl_find_msg.
-       (_nl_find_msg): Add domainbinding argument. Reinitialize the converter
-       if domainbinding->codeset_cntr has been incremented.
-       * finddomain.c (_nl_find_domain): Don't pass domainbinding to
-       _nl_make_l10nflist(). Pass it to _nl_load_domain() instead.
-       * l10nflist.c (_nl_make_l10nflist): Remove domainbinding argument.
-       * loadmsgcat.c (_nl_init_domain_conv): New function, extracted from
-       _nl_load_domain. Append //TRANSLIT also when using libiconv.
-       (_nl_free_domain_conv): New function, extracted from _nl_unload_domain.
-       (_nl_load_domain): Add domainbinding argument. Call
-       _nl_init_domain_conv.
-       (_nl_unload_domain): Call _nl_free_domain_conv.
-
-2001-04-09  Bruno Haible  <haible@clisp.cons.org>
-
-       * dcigettext.c (HAVE_LOCALE_NULL): Don't define if __GNU_LIBRARY__ < 2
-       (Linux libc5).
-
-2001-04-04  Bruno Haible  <haible@clisp.cons.org>
-
-       * dcigettext.c (HAVE_LOCALE_NULL): Define also if __GNU_LIBRARY__.
-
-2001-04-04  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (libdir, includedir, datadir): Use the autoconf
-       determined value, in order to respect the configure arguments.
-       (gettextsrcdir): Use $(datadir), not @datadir@.
-
-2001-03-29  Bruno Haible  <haible@clisp.cons.org>
-
-       * gettext-0.10.36 released.
-
-2001-03-25  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (install-data): Set execution bits on installed
-       config.charset.
-
-2001-03-23  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (YACC): Use @INTLBISON@ instead of bison.
-
-2001-03-21  Bruno Haible  <haible@clisp.cons.org>
-
-       * dcigettext.c (_nl_state_lock): Mark as #ifdef _LIBC. AIX 3 xlc
-       chokes on empty macro arguments.
-       * plural.y: Add #pragma for alloca on AIX 3.
-
-2001-03-20  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (DISTFILES.generated): New variable.
-       (DISTFILES.gettext): Remove plural.c.
-       (dist): Use DISTFILES.generated.
-       (YACC): Use "bison -y" instead of @YACC@.
-       Needed for "make dist" to work in normal packages.
-
-2001-03-20  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (dist): Don't depend on $(DISTFILES). Instead, generate
-       the files to be distributed through a recursive 'make' call.
-
-2001-03-17  Bruno Haible  <haible@clisp.cons.org>
-
-       * gettextP.h (struct expression): Add operators lnot, less_than,
-       greater_than, less_or_equal, greater_or_equal. Replace args2/args3
-       union by a 'nargs' counter and an 'args[]' array.
-       * plural.y: Don't include stdarg.h.
-       (new_exp): New function.
-       (new_exp_0, new_exp_2, new_exp_3): Rewritten to call new_exp.
-       (new_exp_1): New function.
-       ('?' ':'): Make right-associative.
-       (EQUOP2): New token, replaces '=' and '!'.
-       (CMPOP2): New token.
-       (ADDOP2): New token, replaces '+' and '-'.
-       (MULOP2): New token, replaces '*', '/' and '%'.
-       ('!'): New token.
-       (exp): Add rules for CMPOP2 and '!'. Don't call YYABORT.
-       (start): Call YYABORT here.
-       (FREE_EXPRESSION): Update.
-       (yylex): Don't skip "\\n". Recognize comparison and '!' operators.
-       Update for new token symbols.
-       * loadmsgcat.c (plvar, plone, germanic_plural, init_germanic_plural):
-       Update.
-       * dcigettext.c (_nl_find_msg): Optimize for space.
-       (plural_eval): Recognize comparison and '!' operators. Optimize for
-       space.
-
-       * dcigettext.c (transcmp): New declaration.
-
-2001-03-10  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (libintl.la): Pass -liconv and flag -no-undefined.
-       Needed on platforms like BeOS.
-
-       * Makefile.in (all-no-yes): Depend on libgnuintl.$la, not libintl.$la.
-       (libgnuintl.a, libgnuintl.la): New targets. Needed for linking
-       ../tests/tstgettext on systems which have gettext() in libintl.so.
-
-       * localcharset.c (locale_charset): Allow wildcard syntax. Resolve
-       alias also if codeset is empty.
-       * config.charset (BeOS): Use wildcard syntax.
-
-       * loadmsgcat.c (_nl_load_domain): locale_charset() doesn't return NULL
-       any more.
-
-2001-03-09  Bruno Haible  <haible@clisp.cons.org>
-
-       * config.charset: Update from libiconv-1.6.
-       * localcharset.c: Likewise.
-
-2001-02-25  Ulrich Drepper  <drepper@redhat.com>
-
-       * locale.alias: Don't use nb_NO but define aliases for it.
-
-2001-01-26  Ulrich Drepper  <drepper@redhat.com>
-
-       * loadmsgcat.c: Include <locale.h> for _LIBC.
-
-2001-03-09  Bruno Haible  <haible@clisp.cons.org>
-
-       * dcigettext.c (transmem_block_t): Change to unsigned char, to avoid
-       compiler warning.
-       (_nl_find_msg): Add casts to avoid compiler warnings.
-
-2001-03-09  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (DISTFILES.common): Remove ChangeLog.
-       (DISTFILES.obsolete): New variable.
-       (install-data): Install ChangeLog.inst as ChangeLog. Remove the files
-       listed in DISTFILES.obsolete.
-       (uninstall): Simplify.
-       (distclean): Remove ChangeLog.inst.
-       (dist): Mention ChangeLog explicitly.
-
-2001-03-04  Bruno Haible  <haible@clisp.cons.org>
-       * dcigettext.c (ISSLASH, HAS_DEVICE, IS_ABSOLUTE_PATH,
-       IS_PATH_WITH_DIR): New macros.
-       (DCIGETTEXT): Use IS_ABSOLUTE_PATH and IS_PATH_WITH_DIR. Increment
-       path_max proportionally.
-       * loadinfo.h (PATH_SEPARATOR): New macro.
-       * l10nflist.c (_nl_make_l10nflist): Use PATH_SEPARATOR instead of ':'.
-       * localealias.c (_nl_expand_alias): Likewise.
-       * libgnuintl.h (gettext) [DJGPP]: Define as a macro as well.
-
-2001-03-06  Bruno Haible  <haible@clisp.cons.org>
-
-       * libgnuintl.h (LC_MESSAGES): Don't define on Solaris.
-
-2001-02-24  Bruno Haible  <haible@clisp.cons.org>
-
-       * dcigettext.c: Update comment about HAVE_LOCALE_NULL.
-
-2001-02-05  Bruno Haible  <haible@clisp.cons.org>
-
-       * libgnuintl.h (LC_MESSAGES): Provide a default value.
-
-2001-01-30  Bruno Haible  <haible@clisp.cons.org>
-
-       * config.charset: Update for FreeBSD 4.2.
-
-2001-01-21  Bruno Haible  <haible@clisp.cons.org>
-
-       Use libtool.
-       * Makefile.in (l): Use INTL_LIBTOOL_SUFFIX_PREFIX instead of l.
-       (all-no): When USE_INCLUDED_LIBINTL is 'no' but BUILD_INCLUDED_LIBINTL
-       is 'yes', still build libintl.$la because the testsuite needs it.
-       (libintl.la): Add $(CPPFLAGS) $(CFLAGS) $(XCFLAGS). Linking via $(CC)
-       must use all $(CFLAGS).
-       (install-exec): Use libtool to install libintl.$la.
-       (uninstall): Use libtool to uninstall libintl.$la.
-       (mostlyclean): Remove *.la and the .libs subdir.
-       * intl-compat.c: Reorder. Add comment.
-
-2001-01-20  Bruno Haible  <haible@clisp.cons.org>
-
-       * loadmsgcat.c (O_BINARY): Define on platforms that don't have it.
-       (_nl_load_domain): Open the catalog file in binary mode.
-
-2001-01-24  Bruno Haible  <haible@clisp.cons.org>
-
-       * gettextP.h (SWAP): Remove declaration, to work around a compilation
-       failure on alphaev5-cray-unicosmk2.0.5.X.
-
-2001-01-15  Bruno Haible  <haible@clisp.cons.org>
-
-       * dcigettext.c (_nl_find_msg): Cast the second iconv() arg, to avoid
-       a warning.
-
-2001-01-07  Bruno Haible  <haible@clisp.cons.org>
-
-       * gettextP.h (__gettextdebug): Remove declaration.
-       (gettext_free_exp__, gettextparse__): New non-libc declarations.
-       * plural.y [!_LIBC]: Define gettextparse__, gettext_free_exp__, not
-       __gettextparse, __gettext_free_exp.
-       * loadmsgcat.c [!_LIBC]: Use gettextparse__, not __gettextparse.
-
-2001-01-07  Bruno Haible  <haible@clisp.cons.org>
-
-       * libgnuintl.h: Renamed from intlh.inst.in.
-       Remove comment about __builtin_constant_p.
-       (gettext): Use NULL.
-       * libgettext.h: Completely rewritten. Now a conditional wrapper around
-       <libintl.h>. Keep the handling of ENABLE_NLS and gettext_noop, remove
-       everything else.
-       * gettextP.h: Include gettext.h, for nls_uint32.
-       (gettext__, dgettext__, dcgettext__, textdomain__, bindtextdomain__,
-       bind_textdomain_codeset__): New declarations, from old libgettext.h.
-       * gettext.h: Don't include <stdio.h>.
-       * Makefile.in (HEADERS): Add libgnuintl.h.
-       (DISTFILES.gettext): Remove intlh.inst.in.
-       (all-yes): Depend on libintl.h instead of intlh.inst.
-       (libintl.h): New target. Create as a copy of libgnuintl.h.
-       (intlh.inst): Remove target.
-       (install-exec): Update.
-       ($(OBJECTS): Depend on libgnuintl.h, not libgettext.h.
-       (mostlyclean): Remove libintl.h instead of intlh.inst.
-       (dist-libc): Remove target.
-       * bindtextdom.c: Include libgnuintl.h instead of libgettext.h. Don't
-       include gettext.h.
-       * dcgettext.c: Likewise.
-       * dcigettext.c: Likewise.
-       * dcngettext.c: Likewise.
-       * dngettext.c: Likewise.
-       * finddomain.c: Likewise.
-       * ngettext.c: Likewise.
-       * textdomain.c: Likewise.
-       * dgettext.c: Include libgnuintl.h instead of libgettext.h. Include
-       gettextP.h.
-       * gettext.c: Likewise.
-       * intl-compat.c: Likewise.
-       * localealias.c: Don't include gettext.h.
-       * plural.y: Likewise.
-
-2001-01-07  Bruno Haible  <haible@clisp.cons.org>
-
-       Assume <stddef.h>, <stdlib.h>, <string.h>, <locale.h> exist.
-       * intlh.inst.in: Likewise.
-       * libgettext.h: Likewise.
-       * gettextP.h: Likewise.
-       * bindtextdom.c: Likewise.
-       * dcigettext.c: Likewise.
-       * dgettext.c: Likewise.
-       * dngettext.c: Likewise.
-       * explodename.c: Likewise.
-       * finddomain.c: Likewise.
-       * gettext.c: Likewise.
-       * l10nflist.c: Likewise.
-       * loadmsgcat.c: Likewise.
-       * localealias.c: Likewise.
-       * ngettext.c: Likewise.
-       * textdomain.c: Likewise.
-
-2001-01-06  Bruno Haible  <haible@clisp.cons.org>
-
-       Remove catgets fallback code.
-       - It does not handle message clash prevention through domains and
-         dgettext().
-       - It does not handle message catalog inheritance and the LANGUAGE
-         environment variable.
-       - It does not handle locale aliases.
-       - It does not handle automatic charset conversion.
-       - It does not handle plural form handling and ngettext().
-       - It uses a slow string to integer conversion.
-       - It is sensitive against installation problems.
-       * cat-compat.c: Remove file.
-       * po2msg.sin, po2tbl.sin: Remove files.
-       * Makefile.in (datadir): Assume DATADIRNAME = share.
-       (SOURCES): Remove cat-compat.c.
-       (DISTFILES.common): Remove po2msg.sin, po2tbl.sin.
-       (distclean): No need to remove po2msg.sed, po2tbl.sed.
-       (../po/cat-id-tbl.$lo): Remove rule.
-       * libgettext.h (_msg_ent): Remove.
-       (_msg_tbl, _msg_tbl_length): Remove declarations.
-       (gettext, dgettext, ngettext, dngettext): Don't depend on
-       !HAVE_CATGETS.
-
-2001-01-04  Ulrich Drepper  <drepper@redhat.com>
-
-       * plural.y (yylex): Minimal improvement in number scanner.
-
-2001-01-02  Ulrich Drepper  <drepper@redhat.com>
-
-       * dcigettext.c (guess_category_value): Rewrite so that LANGUAGE value
-       is ignored if the selected locale is the C locale.
-
-2000-11-20  Ulrich Drepper  <drepper@redhat.com>
-
-       * dcigettext.c (transcmp): Make s1 and s2 const.
-       * loadmsgcat.c (_nl_load_domain): Rearrange domain initialization to
-       avoid warning.
-
-2000-11-09  Ulrich Drepper  <drepper@redhat.com>
-
-       * locale.alias: Add thai.
-       Patch by Chanop Silpa-Anan <chanop@syseng.anu.edu.au>.
-
-2001-01-05  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (INCLUDES): Remove reference to $(top_srcdir)/lib.
-       (.SUFFIXES): Put .c before .y, so that Solaris "make" uses the .c.o
-       rule, not the builtin .y.o rule.
-       (.y.c): Use $< instead of $^. $^ is not supported by SUSV2 "make"
-       specification. Remove $*.h explicitly: we don't need plural.h.
-       * gettextP.h: Include <stddef.h>.
-       (__gettext_free_exp, __gettextparse): Convert prototype to K&R C
-       syntax.
-       * bindtextdom.c (offsetof): Provide fallback for platforms that lack
-       it, like SunOS4.
-       (set_binding_values): Convert prototype to K&R C syntax.
-       * cat-compat.c: Include stdlib.h, string.h whenever possible.
-       * dcigettext.c: Ignore the value of C_ALLOCA, because libintl.a
-       must not depend on external .o files.
-       (offsetof): Provide fallback for platforms that lack it, like SunOS4.
-       (transcmp): Convert to K&R C syntax.
-       * explodename.c Include stdlib.h whenever possible.
-       (_nl_find_language): Convert to K&R C syntax.
-       * finddomain.c: Include stdlib.h whenever possible.
-       * l10nflist.c Include stdlib.h whenever possible.
-       (_nl_normalize_codeset): Use tolower, not _tolower.
-       * loadmsgcat.c: Include stdlib.h whenever possible.
-       Include headers needed for alloca().
-       (freea): New macro.
-       (_nl_load_domain): Add fallback code for platforms lacking strtoul,
-       like SunOS4. Add fallback code for platforms lacking alloca.
-       * localealias.c: Include stdlib.h whenever possible.
-       (ADD_BLOCK, FREE_BLOCK): Remove macros.
-       (freea): New macro.
-       (read_alias_file): Simplify fallback code for platforms lacking alloca.
-       * plural.y (new_exp_0, new_exp_2, new_exp_3): New functions.
-       (new_exp): Remove function.
-       (__gettext_free_exp, yylex, yyerror): Convert to K&R C syntax.
-       * textdomain.c: Include stdlib.h whenever possible.
-       * gettext.c: Likewise.
-       * ngettext.c: Likewise.
-       * localcharset.c (volatile): Define to empty if not using ANSI C.
-
-2001-01-01  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (mostlyclean): Remove intlh.inst, charset.alias,
-       ref-add.sed, ref-del.sed.
-       (distclean): In the gettext package, remove VERSION.
-
-2001-01-01  Bruno Haible  <haible@clisp.cons.org>
-
-       Finish implementation of plural form handling.
-       * dcigettext.c (known_translation_t): Rename 'domain' field to
-       'domainname'. Remove 'plindex' field. Add 'domain' and
-       'translation_length' fields.
-       (transcmp): Don't compare 'plindex' fields.
-       (plural_lookup): New function.
-       (DCIGETTEXT): Change cache handing in the plural case. Don't call
-       plural_eval before the translation and its catalog file have been
-       found. Remove plindex from cache key. Add 'translation_length' and
-       'domain' to cache result. 
-       (_nl_find_msg): Remove index argument, return length of translation
-       to the caller instead. Weaken comparison of string lengths, to account
-       for plural entries. Call iconv() on the entire result string, not
-       only on the portion needed so far.
-       * loadinfo.h (_nl_find_msg): Remove index argument, add lengthp
-       argument.
-       * loadmsgcat.c (_nl_load_domain): Adapt to _nl_find_msg change.
-
-       * intl-compat.c (dcngettext, dngettext, ngettext): New functions.
-       * libgettext.h (ngettext__, dngettext__, dcngettext__): New
-       declarations.
-       (ngettext, dngettext): Add missing macro argument.
-
-       * intlh.inst.in (ngettext, dngettext): Add missing macro argument.
-
-2000-12-31  Bruno Haible  <haible@clisp.cons.org>
-
-       * gettextP.h (ZERO): New macro.
-       (struct binding): Always use ZERO.
-       * bindtextdom.c (set_binding_values): Use offsetof, not sizeof.
-       Include <stddef.h> whenever possible.
-       * dcigettext.c (ZERO): Remove macro.
-       (struct transmem_list): Use ZERO.
-       (DCIGETTEXT): Use offsetof, not sizeof.
-       Include <stddef.h> whenever possible.
-
-       * config.charset: Update from libiconv-1.5.1.
-       * localcharset.c: Likewise.
-
-2000-12-30  Bruno Haible  <haible@clisp.cons.org>
-
-       * locale.alias: New file, moved here from ../misc/locale.alias. Add
-       "Packages using this file" line.
-       * Makefile.in (DISTFILES.common): Add locale.alias.
-       (install-exec, uninstall): Install/deinstall locale.alias.
-
-2000-10-30  Ulrich Drepper  <drepper@redhat.com>
-
-       * dcigettext.c (guess_category_value): For libc always use the
-       setlocale() method.
-
-2000-10-20  Ulrich Drepper  <drepper@redhat.com>
-
-       * libintl.glibc (ngettext macro): Add missing parameter.
-       (dngettext macro): Likewise.
-
-2000-10-14  Ulrich Drepper  <drepper@redhat.com>
-
-       * localealias.c (read_alias_file): Update string pointers in map[]
-       if realloc() changed the values.
-       Patch by Jakub Jelinek <jakub@redhat.com>.
-
-2000-08-31  Ulrich Drepper  <drepper@redhat.com>
-
-       * loadmsgcat.c: Use *stat64 instead of *stat internally.
-
-       * dcigettext.c (free_mem): Correct freeing of _nl_domain_bindings
-       list.
-
-2000-08-27  Ulrich Drepper  <drepper@redhat.com>
-
-       * dcigettext.c (DCIGETTEXT): Remove _nl_find_language in code to
-       determine invalid locale name.
-
-2000-08-20  Ulrich Drepper  <drepper@redhat.com>
-
-       * dcigettext.c: Unify use of function aliases to make more compact
-       PLT.
-
-       * loadmsgcat.c (_nl_unload_domain): Also free conv_tab element.
-       Pretty printing.
-       * plural.y (new_exp): Take number of optional parameters in second
-       parameter.  Test for correct number of parameters and free correctly
-       in case of failure.  Adjust all callers.
-       (yylex): Fix handling of '\0'.  Allow ';' as terminator character.
-
-2000-07-14  Bruno Haible  <haible@clisp.cons.org>
-
-       * dcigettext.c (dcigettext): Call plural_eval on all platforms, not
-       only those having tsearch.
-
-2000-06-30  Ulrich Drepper  <drepper@redhat.com>
-
-       * dcigettext.c (_nl_find_msg): Correct reallocation of buffers in
-       case the translation is too large.  Remember allocated memory blocks
-       in a list.
-       (free_mem): Free memory for translations.
-
-2000-06-16  Ulrich Drepper  <drepper@redhat.com>
-
-       * loadmsgcat.c (_nl_load_domain): Call norm_add_slashes with new
-       parameter to always enable transliteration.
-
-1998-10-20  Paul Eggert  <eggert@twinsun.com>
-
-       * po2tbl.sin: Escape trigraphs.
-
-2000-10-12  Bruno Haible  <haible@clisp.cons.org>
-
-       * finddomain.c: Remove unneeded includes.
-
-2000-10-12  Bruno Haible  <haible@clisp.cons.org>
-
-       * localealias.c (memcpy): Return first argument, just like the real
-       memcpy function does.
-       * bindtextdom.c (memcpy): Likewise.
-       * finddomain.c (memcpy): Likewise.
-       * l10nflist.c (memcpy): Likewise.
-       * textdomain.c (memcpy): Likewise.
-       From Paul Eggert <eggert@twinsun.com>.
-
-2000-09-29  Bruno Haible  <haible@clisp.cons.org>
-
-       * libintl.glibc: Update from current glibc version.
-
-2000-09-18  Bruno Haible  <haible@clisp.cons.org>
-
-       * dcigettext.c: Outside libc, use local variable names that don't
-       clash with those in libc.
-       * bindtextdom.c: Likewise.
-       * textdomain.c: Likewise.
-
-2000-07-31  Bruno Haible  <haible@clisp.cons.org>
-
-       * plural.y: Include config.h. Needed to define 'inline' away for C
-       compilers that don't support it.
-       (yylex): Don't use gcc specific case range syntax.
-       * loadmsgcat.y (INIT_GERMANIC_PLURAL): New macro, for old compilers.
-
-2000-07-28  Bruno Haible  <haible@clisp.cons.org>
-
-       Simplification: In all cases where $(gnulocaledir) is used, it is
-       identical to $(localedir).
-       * Makefile.in (DEFS): Remove setting for GNULOCALEDIR.
-       * dcigettext.c (_nl_default_dirname): Initialize with LOCALEDIR.
-
-2000-07-28  Bruno Haible  <haible@clisp.cons.org>
-
-       * xopen-msg.sed: Renamed to ...
-       * po2msg.sin: ... here.
-       * linux-msg.sed: Remove file.
-       * Makefile.in (DISTFILES.common): Update.
-
-2000-07-28  Bruno Haible  <haible@clisp.cons.org>
-
-       * po2tbl.sed.in: Renamed to ...
-       * po2tbl.sin: ... here.
-       * Makefile.in (DISTFILES.common): Update.
-
-2000-07-28  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (uninstall): Synchronize with the install target.
-       Really remove charset.alias when its reference count drops to 0.
-
-2000-07-28  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (mkinstalldirs): New macro. Needed when configured with
-       --srcdir=<relative pathname>; then ac_aux_dir will be a relative
-       pathname rooted at the top builddir, and @MKINSTALLDIRS@ likewise.
-       (install-exec, install-data): Use it.
-
-2000-07-26  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (install-exec, install-data): Use $(SHELL) for calling
-       $(MKINSTALLDIRS), don't rely on its execution permissions.
-
-       * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): New variables.
-       (libintl.la): Use them.
-
-       * Makefile.in (install-exec, install-data, uninstall): Provide DESTDIR
-       support, as recommended by GNU standards. Fix misapplied 2000-06-16
-       patch.
-
-2000-06-16  Bruno Haible  <haible@clisp.cons.org>
-
-       * Makefile.in (COMSRCS): Add localcharset.c.
-       (OBJECTS): Add localcharset.$lo.
-       (DISTFILES.common): Add config.charset, ref-{add,del}.sin.
-       (DEFS): Add -DLIBDIR.
-       (all-yes): Add charset.alias, ref-{add,del}.sed.
-       (.SUFFIXES): Add .sin and .sed.
-       (.sin.sed, charset.alias): New rules.
-       (install-exec, uninstall): Install/deinstall charset.alias.
-       * localcharset.c: New file, from fileutils-4.0u.
-       * config.charset: New file, from fileutils-4.0u.
-       * red-add.sin, ref-del.sin: New files, from fileutils-4.0u.
-
-       * intlh.inst.in (bind_textdomain_codeset): New declaration.
-       * libgettext.h (bind_textdomain_codeset, bind_textdomain_codeset__):
-       New declarations.
-       (bind_textdomain_codeset) [!ENABLE_NLS]: New macro.
-       * cat-compat.c (bind_textdomain_codeset): New function.
-       * intl-compat.c (bind_textdomain_codeset): New function.
-
-       * libgettext.h (ngettext, dngettext, dcngettext): New
-       declarations.
-       (dcgettext): Remove macro definition.
-       (textdomain, bindtextdomain) [!ENABLE_NLS]: Parenthesize argument.
-       * intlh.inst.in (ngettext, dngettext, dcngettext): New
-       declarations.
-       (dcgettext): Remove macro definition.
-
-       * *.h, *.c, *.y: Change copyright notice from LGPL to GPL.
-
-2000-05-21  Ulrich Drepper  <drepper@redhat.com>
-
-       * dcigettext.c: Fix typo in comment.
-
-2000-05-08  Andreas Jaeger  <aj@suse.de>
-
-       * bindtextdom.c (set_binding_values): Add prototype.
-
-2000-05-05  Bruno Haible  <haible@clisp.cons.org>
-
-       * dcigettext.c (alignof): New macro.
-       (_nl_find_msg): Use it instead of __alignof__. Pass correct output
-       buffer length to __gconv/iconv. If malloc (freemem_size) fails, set
-       freemem_size to 0.
-
-2000-05-05  Bruno Haible  <haible@clisp.cons.org>
-
-       * dcigettext.c (dcigettext): Fix interpretation of tsearch
-       return value.
-
-2000-05-06  Ulrich Drepper  <drepper@redhat.com>
-
-       * dcigettext.c (DCIGETTEXT): Always define local variable `index'.
-       (mempcpy): Correct typo in parameter list.
-
-       * hash-string.h: Don't include <values.h>.
-
-       * *.c, *.h, *.y: Update from glibc version.
-
-1998-04-29  Paul Eggert  <eggert@twinsun.com>
-
-       * Makefile.in (aliaspath): Don't put `.' at the end.
-
-1998-06-01  Ulrich Drepper  <drepper@cygnus.com>
-
-       * localealias.c (read_alias_file): Undo last change.
-       * l10nflist.c (_nl_normalize_codeset): Likewise.
-       * loadinfo.h: Likewise.
-
-1998-05-23  Ulrich Drepper  <drepper@cygnus.com>
-
-       * dcgettext.c: Don't use any alloca hack when C_ALLOCA is defined.
-
-1998-05-01 08:47  Ulrich Drepper  <drepper@cygnus.com>
-
-       * gettext-0.10.35 released.
-
-1998-04-29  Ulrich Drepper  <drepper@cygnus.com>
-
-       * intl/localealias.c (read_alias_file): Use unsigned char for
-       local variables.  Remove unused variable tp.
-       * intl/l10nflist.c (_nl_normalize_codeset): Use unsigned char *
-       for type of codeset.  For loosing Solaris systems.
-       * intl/loadinfo.h: Adapt prototype of _nl_normalize_codeset.
-       * intl/bindtextdom.c (BINDTEXTDOMAIN): Don't define local variable
-       len if not needed.
-       Patches by Jim Meyering.
-
-1998-04-28  Ulrich Drepper  <drepper@cygnus.com>
-
-       * loadmsgcat.c (_nl_load_domain): Don't assign the element use_mmap if
-       mmap is not supported.
-
-       * hash-string.h: Don't include <values.h>.
-
-1998-04-27  Ulrich Drepper  <drepper@cygnus.com>
-
-       * textdomain.c: Use strdup is available.
-
-       * localealias.c: Define HAVE_MEMPCPY so that we can use this
-       function.  Define and use semapahores to protect modfication of
-       global objects when compiling for glibc.  Add code to allow
-       freeing alias table.
-
-       * l10nflist.c: Don't assume stpcpy not being a macro.
-
-       * gettextP.h: Define internal_function macri if not already done.
-       Use glibc byte-swap macros instead of defining SWAP when compiled
-       for glibc.
-       (struct loaded_domain): Add elements to allow unloading.
-
-       * Makefile.in (distclean): Don't remove libintl.h here.
-
-       * bindtextdomain.c: Carry over changes from glibc.  Use strdup if
-       available.
-
-       * dcgettext.c: Don't assume stpcpy not being a macro.  Mark internal
-       functions.  Add memory freeing code for glibc.
-
-       * dgettext.c: Update copyright.
-
-       * explodename.c: Include stdlib.h and string.h only if they exist.
-       Use strings.h eventually.
-
-       * finddomain.c: Mark internal functions.  Use strdup if available.
-       Add memory freeing code for glibc.
-
-1997-10-10 20:00  Ulrich Drepper  <drepper@cygnus.com>
-
-       * libgettext.h: Fix dummy textdomain and bindtextdomain macros.
-       They should return reasonable values.
-       Reported by Tom Tromey <tromey@cygnus.com>.
-
-1997-09-16 03:33  Ulrich Drepper  <drepper@cygnus.com>
-
-       * libgettext.h: Define PARAMS also to `args' if __cplusplus is defined.
-       * intlh.inst.in: Likewise.
-       Reported by Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>.
-
-       * libintl.glibc: Update from current glibc version.
-
-1997-09-06 02:10  Ulrich Drepper  <drepper@cygnus.com>
-
-       * intlh.inst.in: Reformat copyright.
-
-1997-08-19 15:22  Ulrich Drepper  <drepper@cygnus.com>
-
-       * dcgettext.c (DCGETTEXT): Remove wrong comment.
-
-1997-08-16 00:13  Ulrich Drepper  <drepper@cygnus.com>
-
-       * Makefile.in (install-data): Don't change directory to install.
-
-1997-08-01 14:30  Ulrich Drepper  <drepper@cygnus.com>
-
-       * cat-compat.c: Fix copyright.
-
-       * localealias.c: Don't define strchr unless !HAVE_STRCHR.
-
-       * loadmsgcat.c: Update copyright.  Fix typos.
-
-       * l10nflist.c: Don't define strchr unless !HAVE_STRCHR.
-       (_nl_make_l10nflist): Handle sponsor and revision correctly.
-
-       * gettext.c: Update copyright.
-       * gettext.h: Likewise.
-       * hash-string.h: Likewise.
-
-       * finddomain.c: Remoave dead code.  Define strchr only if
-       !HAVE_STRCHR.
-
-       * explodename.c: Include <sys/types.h>.
-
-       * explodename.c: Reformat copyright text.
-       (_nl_explode_name): Fix typo.
-
-       * dcgettext.c: Define and use __set_errno.
-       (guess_category_value): Don't use setlocale if HAVE_LC_MESSAGES is
-       not defined.
-
-       * bindtextdom.c: Pretty printing.
-
-1997-05-01 02:25  Ulrich Drepper  <drepper@cygnus.com>
-
-       * dcgettext.c (guess_category_value): Don't depend on
-       HAVE_LC_MESSAGES.  We don't need the macro here.
-       Patch by Bruno Haible <haible@ilog.fr>.
-
-       * cat-compat.c (textdomain): DoN't refer to HAVE_SETLOCALE_NULL
-       macro.  Instead use HAVE_LOCALE_NULL and define it when using
-       glibc, as in dcgettext.c.
-       Patch by Bruno Haible <haible@ilog.fr>.
-
-       * Makefile.in (CPPFLAGS): New variable.  Reported by François
-       Pinard.
-
-Mon Mar 10 06:51:17 1997  Ulrich Drepper  <drepper@cygnus.com>
-
-       * Makefile.in: Implement handling of libtool.
-
-       * gettextP.h: Change data structures for use of generic lowlevel
-       i18n file handling.
-
-Wed Dec  4 20:21:18 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * textdomain.c: Put parentheses around arguments of memcpy macro
-       definition.
-       * localealias.c: Likewise.
-       * l10nflist.c: Likewise.
-       * finddomain.c: Likewise.
-       * bindtextdom.c: Likewise.
-       Reported by Thomas Esken.
-
-Mon Nov 25 22:57:51 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * textdomain.c: Move definition of `memcpy` macro to right
-       position.
-
-Fri Nov 22 04:01:58 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * finddomain.c [!HAVE_STRING_H && !_LIBC]: Define memcpy using
-       bcopy if not already defined.  Reported by Thomas Esken.
-       * bindtextdom.c: Likewise.
-       * l10nflist.c: Likewise.
-       * localealias.c: Likewise.
-       * textdomain.c: Likewise.
-
-Tue Oct 29 11:10:27 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * Makefile.in (libdir): Change to use exec_prefix instead of
-       prefix.  Reported by Knut-HÃ¥vardAksnes <etokna@eto.ericsson.se>.
-
-Sat Aug 31 03:07:09 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * l10nflist.c (_nl_normalize_codeset): We convert to lower case,
-       so don't prepend uppercase `ISO' for only numeric arg.
-
-Fri Jul 19 00:15:46 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * l10nflist.c: Move inclusion of argz.h, ctype.h, stdlib.h after
-       definition of _GNU_SOURCE.  Patch by Roland McGrath.
-
-       * Makefile.in (uninstall): Fix another bug with `for' loop and
-       empty arguments.  Patch by Jim Meyering.  Correct name os
-       uninstalled files: no intl- prefix anymore.
-
-       * Makefile.in (install-data): Again work around shells which
-       cannot handle mpty for list.  Reported by Jim Meyering.
-
-Sat Jul 13 18:11:35 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * Makefile.in (install): Split goal.  Now depend on install-exec
-        and install-data.
-       (install-exec, install-data): New goals.  Created from former
-       install goal.
-       Reported by Karl Berry.
-
-Sat Jun 22 04:58:14 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * Makefile.in (MKINSTALLDIRS): New variable.  Path to
-        mkinstalldirs script.
-       (install): use MKINSTALLDIRS variable or if the script is not present
-       try to find it in the $top_scrdir).
-
-Wed Jun 19 02:56:56 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * l10nflist.c: Linux libc *partly* includes the argz_* functions.
-       Grr.  Work around by renaming the static version and use macros
-       for renaming.
-
-Tue Jun 18 20:11:17 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * l10nflist.c: Correct presence test macros of __argz_* functions.
-
-       * l10nflist.c: Include <argz.h> based on test of it instead when
-       __argz_* functions are available.
-       Reported by Andreas Schwab.
-
-Thu Jun 13 15:17:44 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * explodename.c, l10nflist.c: Define NULL for dumb systems.
-
-Tue Jun 11 17:05:13 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * intlh.inst.in, libgettext.h (dcgettext): Rename local variable
-       result to __result to prevent name clash.
-
-       * l10nflist.c, localealias.c, dcgettext.c: Define _GNU_SOURCE to
-        get prototype for stpcpy and strcasecmp.
-
-       * intlh.inst.in, libgettext.h: Move declaration of
-       `_nl_msg_cat_cntr' outside __extension__ block to prevent warning
-       from gcc's -Wnested-extern option.
-
-Fri Jun  7 01:58:00 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * Makefile.in (install): Remove comment.
-
-Thu Jun  6 17:28:17 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * Makefile.in (install): Work around for another Buglix stupidity.
-       Always use an `else' close for `if's.  Reported by Nelson Beebe.
-
-       * Makefile.in (intlh.inst): Correct typo in phony rule.
-       Reported by Nelson Beebe.
-
-Thu Jun  6 01:49:52 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * dcgettext.c (read_alias_file): Rename variable alloca_list to
-       block_list as the macro calls assume.
-       Patch by Eric Backus.
-
-       * localealias.c [!HAVE_ALLOCA]: Define alloca as macro using
-        malloc.
-       (read_alias_file): Rename varriabe alloca_list to block_list as the
-       macro calls assume.
-       Patch by Eric Backus.
-
-       * l10nflist.c: Correct conditional for <argz.h> inclusion.
-       Reported by Roland McGrath.
-
-       * Makefile.in (all): Depend on all-@USE_INCLUDED_LIBINTL@, not
-        all-@USE_NLS@.
-
-       * Makefile.in (install): intlh.inst comes from local dir, not
-        $(srcdir).
-
-       * Makefile.in (intlh.inst): Special handling of this goal.  If
-       used in gettext, this is really a rul to construct this file.  If
-       used in any other package it is defined as a .PHONY rule with
-       empty body.
-
-       * finddomain.c: Extract locale file information handling into
-       l10nfile.c.  Rename local stpcpy__ function to stpcpy.
-
-       * dcgettext.c (stpcpy): Add local definition.
-
-       * l10nflist.c: Solve some portability problems.  Patches partly by
-       Thomas Esken.  Add local definition of stpcpy.
-
-Tue Jun  4 02:47:49 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * intlh.inst.in: Don't depend including <locale.h> on
-       HAVE_LOCALE_H.  Instead configure must rewrite this fiile
-       depending on the result of the configure run.
-
-       * Makefile.in (install): libintl.inst is now called intlh.inst.
-       Add rules for updating intlh.inst from intlh.inst.in.
-
-       * libintl.inst: Renamed to intlh.inst.in.
-
-       * localealias.c, dcgettext.c [__GNUC__]: Define HAVE_ALLOCA to 1
-        because gcc has __buitlin_alloca.
-       Reported by Roland McGrath.
-
-Mon Jun  3 00:32:16 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * Makefile.in (installcheck): New goal to fulfill needs of
-        automake's distcheck.
-
-       * Makefile.in (install): Reorder commands so that VERSION is
-        found.
-
-       * Makefile.in (gettextsrcdir): Now use subdirectory intl/ in
-        @datadir@/gettext.
-       (COMSRCS): Add l10nfile.c.
-       (OBJECTS): Add l10nfile.o.
-       (DISTFILES): Rename to DISTFILE.normal.  Remove $(DISTFILES.common).
-       (DISTFILE.gettext): Remove $(DISTFILES.common).
-       (all-gettext): Remove goal.
-       (install): If $(PACKAGE) = gettext install, otherwose do nothing.  No
-       package but gettext itself should install libintl.h + headers.
-       (dist): Extend goal to work for gettext, too.
-       (dist-gettext): Remove goal.
-
-       * dcgettext.c [!HAVE_ALLOCA]: Define macro alloca by using malloc.
-
-Sun Jun  2 17:33:06 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * loadmsgcat.c (_nl_load_domain): Parameter is now comes from
-        find_l10nfile.
-
-Sat Jun  1 02:23:03 1996  Ulrich Drepper  <drepper@cygnus.com>
-
-       * l10nflist.c (__argz_next): Add definition.
-
-       * dcgettext.c [!HAVE_ALLOCA]: Add code for handling missing alloca
-       code.  Use new l10nfile handling.
-
-       * localealias.c [!HAVE_ALLOCA]: Add code for handling missing
-        alloca code.
-
-       * l10nflist.c: Initial revision.
-
-Tue Apr  2 18:51:18 1996  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (all-gettext): New goal.  Same as all-yes.
-
-Thu Mar 28 23:01:22 1996  Karl Eichwalder  <ke@ke.central.de>
-
-       * Makefile.in (gettextsrcdir): Define using @datadir@.
-
-Tue Mar 26 12:39:14 1996  Ulrich Drepper  <drepper@myware>
-
-       * finddomain.c: Include <ctype.h>.  Reported by Roland McGrath.
-
-Sat Mar 23 02:00:35 1996  Ulrich Drepper  <drepper@myware>
-
-       * finddomain.c (stpcpy): Rename to stpcpy__ to prevent clashing
-        with external declaration.
-
-Sat Mar  2 00:47:09 1996  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (all-no): Rename from all_no.
-
-Sat Feb 17 00:25:59 1996  Ulrich Drepper  <drepper@myware>
-
-       * gettextP.h [loaded_domain]: Array `successor' must now contain up
-        to 63 elements (because of codeset name normalization).
-
-       * finddomain.c: Implement codeset name normalization.
-
-Thu Feb 15 04:39:09 1996  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (all): Define to `all-@USE_NLS@'.
-       (all-yes, all_no): New goals.  `all-no' is noop, `all-yes'
-       is former all.
-
-Mon Jan 15 21:46:01 1996  Howard Gayle  <howard@hal.com>
-
-       * localealias.c (alias_compare): Increment string pointers in loop
-        of strcasecmp replacement.
-
-Fri Dec 29 21:16:34 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (install-src): Who commented this goal out ? :-)
-
-Fri Dec 29 15:08:16 1995  Ulrich Drepper  <drepper@myware>
-
-       * dcgettext.c (DCGETTEXT): Save `errno'.  Failing system calls
-       should not effect it because a missing catalog is no error.
-       Reported by Harald K<o:>nig <koenig@tat.physik.uni-tuebingen.de>.
-
-Tue Dec 19 22:09:13 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (Makefile): Explicitly use $(SHELL) for running
-        shell scripts.
-
-Fri Dec 15 17:34:59 1995  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
-
-       * Makefile.in (install-src): Only install library and header when
-       we use the own implementation.  Don't do it when using the
-       system's gettext or catgets functions.
-
-       * dcgettext.c (find_msg): Must not swap domain->hash_size here.
-
-Sat Dec  9 16:24:37 1995  Ulrich Drepper  <drepper@myware>
-
-       * localealias.c, libintl.inst, libgettext.h, hash-string.h,
-       gettextP.h, finddomain.c, dcgettext.c, cat-compat.c:
-       Use PARAMS instead of __P.  Suggested by Roland McGrath.
-
-Tue Dec  5 11:39:14 1995  Larry Schwimmer  <rosebud@cyclone.stanford.edu>
-
-       * libgettext.h: Use `#if !defined (_LIBINTL_H)' instead of `#if
-       !_LIBINTL_H' because Solaris defines _LIBINTL_H as empty.
-
-Mon Dec  4 15:42:07 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (install-src):
-       Install libintl.inst instead of libintl.h.install.
-
-Sat Dec  2 22:51:38 1995  Marcus Daniels  <marcus@sysc.pdx.edu>
-
-       * cat-compat.c (textdomain):
-       Reverse order in which files are tried you load.  First
-       try local file, when this failed absolute path.
-
-Wed Nov 29 02:03:53 1995  Nelson H. F. Beebe  <beebe@math.utah.edu>
-
-       * cat-compat.c (bindtextdomain): Add missing { }.
-
-Sun Nov 26 18:21:41 1995  Ulrich Drepper  <drepper@myware>
-
-       * libintl.inst: Add missing __P definition.  Reported by Nelson Beebe.
-
-       * Makefile.in:
-       Add dummy `all' and `dvi' goals.  Reported by Tom Tromey.
-
-Sat Nov 25 16:12:01 1995  François Pinard  <pinard@iro.umontreal.ca>
-
-       * hash-string.h: Capitalize arguments of macros.
-
-Sat Nov 25 12:01:36 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (DISTFILES): Prevent files names longer than 13
-       characters.  libintl.h.glibc->libintl.glibc,
-       libintl.h.install->libintl.inst.  Reported by Joshua R. Poulson.
-
-Sat Nov 25 11:31:12 1995  Eric Backus  <ericb@lsid.hp.com>
-
-       * dcgettext.c: Fix bug in preprocessor conditionals.
-
-Sat Nov 25 02:35:27 1995  Nelson H. F. Beebe  <beebe@math.utah.edu>
-
-       * libgettext.h: Solaris cc does not understand
-        #if !SYMBOL1 && !SYMBOL2.  Sad but true.
-
-Thu Nov 23 16:22:14 1995  Ulrich Drepper  <drepper@myware>
-
-       * hash-string.h (hash_string):
-       Fix for machine with >32 bit `unsigned long's.
-
-       * dcgettext.c (DCGETTEXT):
-       Fix horrible bug in loop for alternative translation.
-
-Thu Nov 23 01:45:29 1995  Ulrich Drepper  <drepper@myware>
-
-       * po2tbl.sed.in, linux-msg.sed, xopen-msg.sed:
-       Some further simplifications in message number generation.
-
-Mon Nov 20 21:08:43 1995  Ulrich Drepper  <drepper@myware>
-
-       * libintl.h.glibc: Use __const instead of const in prototypes.
-
-       * Makefile.in (install-src):
-       Install libintl.h.install instead of libintl.h.  This
-       is a stripped-down version.  Suggested by Peter Miller.
-
-       * libintl.h.install, libintl.h.glibc: Initial revision.
-
-       * localealias.c (_nl_expand_alias, read_alias_file):
-       Protect prototypes in type casts by __P.
-
-Tue Nov 14 16:43:58 1995  Ulrich Drepper  <drepper@myware>
-
-       * hash-string.h: Correct prototype for hash_string.
-
-Sun Nov 12 12:42:30 1995  Ulrich Drepper  <drepper@myware>
-
-       * hash-string.h (hash_string): Add prototype.
-
-       * gettextP.h: Fix copyright.
-       (SWAP): Add prototype.
-
-Wed Nov  8 22:56:33 1995  Ulrich Drepper  <drepper@myware>
-
-       * localealias.c (read_alias_file): Forgot sizeof.
-       Avoid calling *printf function.  This introduces a big overhead.
-       Patch by Roland McGrath.
-
-Tue Nov  7 14:21:08 1995  Ulrich Drepper  <drepper@myware>
-
-       * finddomain.c, cat-compat.c: Wrong indentation in #if for stpcpy.
-
-       * finddomain.c (stpcpy):
-       Define substitution function local.  The macro was to flaky.
-
-       * cat-compat.c: Fix typo.
-
-       * xopen-msg.sed, linux-msg.sed:
-       While bringing message number to right place only accept digits.
-
-       * linux-msg.sed, xopen-msg.sed: Now that the counter does not have
-       leading 0s we don't need to remove them.  Reported by Marcus
-       Daniels.
-
-       * Makefile.in (../po/cat-id-tbl.o): Use $(top_srdir) in
-       dependency.  Reported by Marcus Daniels.
-
-       * cat-compat.c: (stpcpy) [!_LIBC && !HAVE_STPCPY]: Define replacement.
-       Generally cleanup using #if instead of #ifndef.
-
-       * Makefile.in: Correct typos in comment.  By François Pinard.
-
-Mon Nov  6 00:27:02 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (install-src): Don't install libintl.h and libintl.a
-       if we use an available gettext implementation.
-
-Sun Nov  5 22:02:08 1995  Ulrich Drepper  <drepper@myware>
-
-       * libgettext.h: Fix typo: HAVE_CATGETTS -> HAVE_CATGETS.  Reported
-       by François Pinard.
-
-       * libgettext.h: Use #if instead of #ifdef/#ifndef.
-
-       * finddomain.c:
-       Comments describing what has to be done should start with FIXME.
-
-Sun Nov  5 19:38:01 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (DISTFILES): Split.  Use DISTFILES with normal meaning.
-       DISTFILES.common names the files common to both dist goals.
-       DISTFILES.gettext are the files only distributed in GNU gettext.
-
-Sun Nov  5 17:32:54 1995  Ulrich Drepper  <drepper@myware>
-
-       * dcgettext.c (DCGETTEXT): Correct searching in derived locales.
-       This was necessary since a change in _nl_find_msg several weeks
-       ago.  I really don't know this is still not fixed.
-
-Sun Nov  5 12:43:12 1995  Ulrich Drepper  <drepper@myware>
-
-       * loadmsgcat.c (_nl_load_domain): Test for FILENAME == NULL.  This
-       might mark a special condition.
-
-       * finddomain.c (make_entry_rec): Don't make illegal entry as decided.
-
-       * Makefile.in (dist): Suppress error message when ln failed.
-       Get files from $(srcdir) explicitly.
-
-       * libgettext.h (gettext_const): Rename to gettext_noop.
-
-Fri Nov  3 07:36:50 1995  Ulrich Drepper  <drepper@myware>
-
-       * finddomain.c (make_entry_rec):
-       Protect against wrong locale names by testing mask.
-
-       * libgettext.h (gettext_const): Add macro definition.
-       Capitalize macro arguments.
-
-Thu Nov  2 23:15:51 1995  Ulrich Drepper  <drepper@myware>
-
-       * finddomain.c (_nl_find_domain):
-       Test for pointer != NULL before accessing value.
-       Reported by Tom Tromey.
-
-       * gettext.c (NULL):
-       Define as (void*)0 instad of 0.  Reported by François Pinard.
-
-Mon Oct 30 21:28:52 1995  Ulrich Drepper  <drepper@myware>
-
-       * po2tbl.sed.in: Serious typo bug fixed by Jim Meyering.
-
-Sat Oct 28 23:20:47 1995  Ulrich Drepper  <drepper@myware>
-
-       * libgettext.h: Disable dcgettext optimization for Solaris 2.3.
-
-       * localealias.c (alias_compare):
-       Peter Miller reported that tolower in some systems is
-       even dumber than I thought.  Protect call by `isupper'.
-
-Fri Oct 27 22:22:51 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (libdir, includedir): New variables.
-       (install-src): Install libintl.a and libintl.h in correct dirs.
-
-Fri Oct 27 22:07:29 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (SOURCES): Fix typo: intrl.compat.c -> intl-compat.c.
-
-       * po2tbl.sed.in: Patch for buggy SEDs by Christian von Roques.
-
-       * localealias.c:
-       Fix typo and superflous test.  Reported by Christian von Roques.
-
-Fri Oct  6 11:52:05 1995  Ulrich Drepper  <drepper@myware>
-
-       * finddomain.c (_nl_find_domain):
-       Correct some remainder from the pre-CEN syntax.  Now
-       we don't have a constant number of successors anymore.
-
-Wed Sep 27 21:41:13 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (DISTFILES): Add libintl.h.glibc.
-
-       * Makefile.in (dist-libc): Add goal for packing sources for glibc.
-       (COMSRCS, COMHDRS): Splitted to separate sources shared with glibc.
-
-       * loadmsgcat.c: Forget to continue #if line.
-
-       * localealias.c:
-       [_LIBC]: Rename strcasecmp to __strcasecmp to keep ANSI C name
-       space clean.
-
-       * dcgettext.c, finddomain.c: Better comment to last change.
-
-       * loadmsgcat.c:
-       [_LIBC]: Rename fstat, open, close, read, mmap, and munmap to
-       __fstat, __open, __close, __read, __mmap, and __munmap resp
-       to keep ANSI C name space clean.
-
-       * finddomain.c:
-       [_LIBC]: Rename stpcpy to __stpcpy to keep ANSI C name space clean.
-
-       * dcgettext.c:
-       [_LIBC]: Rename getced and stpcpy to __getcwd and __stpcpy resp to
-       keep ANSI C name space clean.
-
-       * libgettext.h:
-       Include sys/types.h for those old SysV systems out there.
-       Reported by Francesco Potorti`.
-
-       * loadmsgcat.c (use_mmap): Define if compiled for glibc.
-
-       * bindtextdom.c: Include all those standard headers
-       unconditionally if _LIBC is defined.
-
-       * finddomain.c: Fix 2 times defiend -> defined.
-
-       * textdomain.c: Include libintl.h instead of libgettext.h when
-       compiling for glibc.  Include all those standard headers
-       unconditionally if _LIBC is defined.
-
-       * localealias.c, loadmsgcat.c: Prepare to be compiled in glibc.
-
-       * gettext.c:
-       Include libintl.h instead of libgettext.h when compiling for glibc.
-       Get NULL from stddef.h if we compile for glibc.
-
-       * finddomain.c: Include libintl.h instead of libgettext.h when
-       compiling for glibc.  Include all those standard headers
-       unconditionally if _LIBC is defined.
-
-       * dcgettext.c: Include all those standard headers unconditionally
-       if _LIBC is defined.
-
-       * dgettext.c: If compiled in glibc include libintl.h instead of
-       libgettext.h.
-       (locale.h): Don't rely on HAVE_LOCALE_H when compiling for glibc.
-
-       * dcgettext.c: If compiled in glibc include libintl.h instead of
-       libgettext.h.
-       (getcwd): Don't rely on HAVE_GETCWD when compiling for glibc.
-
-       * bindtextdom.c:
-       If compiled in glibc include libintl.h instead of libgettext.h.
-
-Mon Sep 25 22:23:06 1995  Ulrich Drepper  <drepper@myware>
-
-       * localealias.c (_nl_expand_alias): Don't call bsearch if NMAP <= 0.
-       Reported by Marcus Daniels.
-
-       * cat-compat.c (bindtextdomain):
-       String used in putenv must not be recycled.
-       Reported by Marcus Daniels.
-
-       * libgettext.h (__USE_GNU_GETTEXT):
-       Additional symbol to signal that we use GNU gettext
-       library.
-
-       * cat-compat.c (bindtextdomain):
-       Fix bug with the strange stpcpy replacement.
-       Reported by Nelson Beebe.
-
-Sat Sep 23 08:23:51 1995  Ulrich Drepper  <drepper@myware>
-
-       * cat-compat.c: Include <string.h> for stpcpy prototype.
-
-       * localealias.c (read_alias_file):
-       While expand strdup code temporary variable `cp' hided
-       higher level variable with same name.  Rename to `tp'.
-
-       * textdomain.c (textdomain):
-       Avoid warning by using temporary variable in strdup code.
-
-       * finddomain.c (_nl_find_domain): Remove unused variable `application'.
-
-Thu Sep 21 15:51:44 1995  Ulrich Drepper  <drepper@myware>
-
-       * localealias.c (alias_compare):
-       Use strcasecmp() only if available.  Else use
-       implementation in place.
-
-       * intl-compat.c:
-       Wrapper functions now call *__ functions instead of __*.
-
-       * libgettext.h: Declare prototypes for *__ functions instead for __*.
-
-       * cat-compat.c, loadmsgcat.c:
-       Don't use xmalloc, xstrdup, and stpcpy.  These functions are not part
-       of the standard libc and so prevent libintl.a from being used
-       standalone.
-
-       * bindtextdom.c:
-       Don't use xmalloc, xstrdup, and stpcpy.  These functions are not part
-       of the standard libc and so prevent libintl.a from being used
-       standalone.
-       Rename to bindtextdomain__ if not used in GNU C Library.
-
-       * dgettext.c:
-       Rename function to dgettext__ if not used in GNU C Library.
-
-       * gettext.c:
-       Don't use xmalloc, xstrdup, and stpcpy.  These functions are not part
-       of the standard libc and so prevent libintl.a from being used
-       standalone.
-       Functions now called gettext__ if not used in GNU C Library.
-
-       * dcgettext.c, localealias.c, textdomain.c, finddomain.c:
-       Don't use xmalloc, xstrdup, and stpcpy.  These functions are not part
-       of the standard libc and so prevent libintl.a from being used
-       standalone.
-
-Sun Sep 17 23:14:49 1995  Ulrich Drepper  <drepper@myware>
-
-       * finddomain.c: Correct some bugs in handling of CEN standard
-       locale definitions.
-
-Thu Sep  7 01:49:28 1995  Ulrich Drepper  <drepper@myware>
-
-       * finddomain.c: Implement CEN syntax.
-
-       * gettextP.h (loaded_domain): Extend number of successors to 31.
-
-Sat Aug 19 19:25:29 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (aliaspath): Remove path to X11 locale dir.
-
-       * Makefile.in: Make install-src depend on install.  This helps
-       gettext to install the sources and other packages can use the
-       install goal.
-
-Sat Aug 19 15:19:33 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (uninstall): Remove stuff installed by install-src.
-
-Tue Aug 15 13:13:53 1995  Ulrich Drepper  <drepper@myware>
-
-       * VERSION.in: Initial revision.
-
-       * Makefile.in (DISTFILES):
-       Add VERSION file.  This is not necessary for gettext, but
-       for other packages using this library.
-
-Tue Aug 15 06:16:44 1995  Ulrich Drepper  <drepper@myware>
-
-       * gettextP.h (_nl_find_domain):
-       New prototype after changing search strategy.
-
-       * finddomain.c (_nl_find_domain):
-       We now try only to find a specified catalog.  Fall back to other
-       catalogs listed in the locale list is now done in __dcgettext.
-
-       * dcgettext.c (__dcgettext):
-       Now we provide message fall back even to different languages.
-       I.e. if a message is not available in one language all the other
-       in the locale list a tried.  Formerly fall back was only possible
-       within one language.  Implemented by moving one loop from
-       _nl_find_domain to here.
-
-Mon Aug 14 23:45:50 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (gettextsrcdir):
-       Directory where source of GNU gettext library are made
-       available.
-       (INSTALL, INSTALL_DATA): Programs used for installing sources.
-       (gettext-src): New.  Rule to install GNU gettext sources for use in
-       gettextize shell script.
-
-Sun Aug 13 14:40:48 1995  Ulrich Drepper  <drepper@myware>
-
-       * loadmsgcat.c (_nl_load_domain):
-       Use mmap for loading only when munmap function is
-       also available.
-
-       * Makefile.in (install): Depend on `all' goal.
-
-Wed Aug  9 11:04:33 1995  Ulrich Drepper  <drepper@myware>
-
-       * localealias.c (read_alias_file):
-       Do not overwrite '\n' when terminating alias value string.
-
-       * localealias.c (read_alias_file):
-       Handle long lines.  Ignore the rest not fitting in
-       the buffer after the initial `fgets' call.
-
-Wed Aug  9 00:54:29 1995  Ulrich Drepper  <drepper@myware>
-
-       * gettextP.h (_nl_load_domain):
-       Add prototype, replacing prototype for _nl_load_msg_cat.
-
-       * finddomain.c (_nl_find_domain):
-       Remove unneeded variable filename and filename_len.
-       (expand_alias): Remove prototype because functions does not
-       exist anymore.
-
-       * localealias.c (read_alias_file):
-       Change type of fname_len parameter to int.
-       (xmalloc): Add prototype.
-
-       * loadmsgcat.c: Better prototypes for xmalloc.
-
-Tue Aug  8 22:30:39 1995  Ulrich Drepper  <drepper@myware>
-
-       * finddomain.c (_nl_find_domain):
-       Allow alias name to be constructed from the four components.
-
-       * Makefile.in (aliaspath): New variable.  Set to preliminary value.
-       (SOURCES): Add localealias.c.
-       (OBJECTS): Add localealias.o.
-
-       * gettextP.h: Add prototype for _nl_expand_alias.
-
-       * finddomain.c: Aliasing handled in intl/localealias.c.
-
-       * localealias.c: Aliasing for locale names.
-
-       * bindtextdom.c: Better prototypes for xmalloc and xstrdup.
-
-Mon Aug  7 23:47:42 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (DISTFILES): gettext.perl is now found in misc/.
-
-       * cat-compat.c (bindtextdomain):
-       Correct implementation.  dirname parameter was not used.
-       Reported by Marcus Daniels.
-
-       * gettextP.h (loaded_domain):
-       New fields `successor' and `decided' for oo, lazy
-       message handling implementation.
-
-       * dcgettext.c:
-       Adopt for oo, lazy message handliing.
-       Now we can inherit translations from less specific locales.
-       (find_msg): New function.
-
-       * loadmsgcat.c, finddomain.c:
-       Complete rewrite.  Implement oo, lazy message handling :-).
-       We now have an additional environment variable `LANGUAGE' with
-       a higher priority than LC_ALL for the LC_MESSAGE locale.
-       Here we can set a colon separated list of specifications each
-       of the form `language[_territory[.codeset]][@modifier]'.
-
-Sat Aug  5 09:55:42 1995  Ulrich Drepper  <drepper@myware>
-
-       * finddomain.c (unistd.h):
-       Include to get _PC_PATH_MAX defined on system having it.
-
-Fri Aug  4 22:42:00 1995  Ulrich Drepper  <drepper@myware>
-
-       * finddomain.c (stpcpy): Include prototype.
-
-       * Makefile.in (dist): Remove `copying instead' message.
-
-Wed Aug  2 18:52:03 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (ID, TAGS): Do not use $^.
-
-Tue Aug  1 20:07:11 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (TAGS, ID): Use $^ as command argument.
-       (TAGS): Give etags -o option t write to current directory,
-       not $(srcdir).
-       (ID): Use $(srcdir) instead os $(top_srcdir)/src.
-       (distclean): Remove ID.
-
-Sun Jul 30 11:51:46 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (gnulocaledir):
-       New variable, always using share/ for data directory.
-       (DEFS): Add GNULOCALEDIR, used in finddomain.c.
-
-       * finddomain.c (_nl_default_dirname):
-       Set to GNULOCALEDIR, because it always has to point
-       to the directory where GNU gettext Library writes it to.
-
-       * intl-compat.c (textdomain, bindtextdomain):
-       Undefine macros before function definition.
-
-Sat Jul 22 01:10:02 1995  Ulrich Drepper  <drepper@myware>
-
-       * libgettext.h (_LIBINTL_H):
-       Protect definition in case where this file is included as
-       libgettext.h on Solaris machines.  Add comment about this.
-
-Wed Jul 19 02:36:42 1995  Ulrich Drepper  <drepper@myware>
-
-       * intl-compat.c (textdomain): Correct typo.
-
-Wed Jul 19 01:51:35 1995  Ulrich Drepper  <drepper@myware>
-
-       * dcgettext.c (dcgettext): Function now called __dcgettext.
-
-       * dgettext.c (dgettext): Now called __dgettext and calls
-       __dcgettext.
-
-       * gettext.c (gettext):
-       Function now called __gettext and calls __dgettext.
-
-       * textdomain.c (textdomain): Function now called __textdomain.
-
-       * bindtextdom.c (bindtextdomain): Function now called
-       __bindtextdomain.
-
-       * intl-compat.c: Initial revision.
-
-       * Makefile.in (SOURCES): Add intl-compat.c.
-       (OBJECTS): We always compile the GNU gettext library functions.
-       OBJECTS contains all objects but cat-compat.o, ../po/cat-if-tbl.o,
-       and intl-compat.o.
-       (GETTOBJS): Contains now only intl-compat.o.
-
-       * libgettext.h:
-       Re-include protection matches dualistic character of libgettext.h.
-       For all functions in GNU gettext library define __ counter part.
-
-       * finddomain.c (strchr): Define as index if not found in C library.
-       (_nl_find_domain): For relative paths paste / in between.
-
-Tue Jul 18 16:37:45 1995  Ulrich Drepper  <drepper@myware>
-
-       * loadmsgcat.c, finddomain.c: Add inclusion of sys/types.h.
-
-       * xopen-msg.sed: Fix bug with `msgstr ""' lines.
-       A little bit better comments.
-
-Tue Jul 18 01:18:27 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in:
-       po-mode.el, makelinks, combine-sh are now found in ../misc.
-
-       * po-mode.el, makelinks, combine-sh, elisp-comp:
-       Moved to ../misc/.
-
-       * libgettext.h, gettextP.h, gettext.h: Uniform test for __STDC__.
-
-Sun Jul 16 22:33:02 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (INSTALL, INSTALL_DATA): New variables.
-       (install-data, uninstall): Install/uninstall .elc file.
-
-       * po-mode.el (Installation comment):
-       Add .pox as possible extension of .po files.
-
-Sun Jul 16 13:23:27 1995  Ulrich Drepper  <drepper@myware>
-
-       * elisp-comp: Complete new version by François: This does not
-       fail when not compiling in the source directory.
-
-Sun Jul 16 00:12:17 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (../po/cat-id-tbl.o):
-       Use $(MAKE) instead of make for recursive make.
-
-       * Makefile.in (.el.elc): Use $(SHELL) instead of /bin/sh.
-       (install-exec): Add missing dummy goal.
-       (install-data, uninstall): @ in multi-line shell command at
-       beginning, not in front of echo.  Reported by Eric Backus.
-
-Sat Jul 15 00:21:28 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (DISTFILES):
-       Rename libgettext.perl to gettext.perl to fit in 14 chars
-       file systems.
-
-       * gettext.perl:
-       Rename to gettext.perl to fit in 14 chars file systems.
-
-Thu Jul 13 23:17:20 1995  Ulrich Drepper  <drepper@myware>
-
-       * cat-compat.c: If !STDC_HEADERS try to include malloc.h.
-
-Thu Jul 13 20:55:02 1995  Ulrich Drepper  <drepper@myware>
-
-       * po2tbl.sed.in: Pretty printing.
-
-       * linux-msg.sed, xopen-msg.sed:
-       Correct bugs with handling substitute flags in branches.
-
-       * hash-string.h (hash_string):
-       Old K&R compilers don't under stand `unsigned char'.
-
-       * gettext.h (nls_uint32):
-       Some old K&R compilers (eg HP) don't understand `unsigned int'.
-
-       * cat-compat.c (msg_to_cat_id): De-ANSI-fy prototypes.
-
-Thu Jul 13 01:34:33 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (ELCFILES): New variable.
-       (DISTFILES): Add elisp-comp.
-       Add implicit rule for .el -> .elc compilation.
-       (install-data): install $ELCFILES
-       (clean): renamed po-to-tbl and po-to-msg to po2tbl and po2msg resp.
-
-       * elisp-comp: Initial revision
-
-Wed Jul 12 16:14:52 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in:
-       cat-id-tbl.c is now found in po/.  This enables us to use an identical
-       intl/ directory in all packages.
-
-       * dcgettext.c (dcgettext): hashing does not work for table size <= 2.
-
-       * textdomain.c: fix typo (#if def -> #if defined)
-
-Tue Jul 11 18:44:43 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in (stamp-cat-id): use top_srcdir to address source files
-       (DISTFILES,distclean): move tupdate.perl to src/
-
-       * po-to-tbl.sed.in:
-       add additional jump to clear change flag to recognize multiline strings
-
-Tue Jul 11 01:32:50 1995  Ulrich Drepper  <drepper@myware>
-
-       * textdomain.c: Protect inclusion of stdlib.h and string.h.
-
-       * loadmsgcat.c: Protect inclusion of stdlib.h.
-
-       * libgettext.h: Protect inclusion of locale.h.
-       Allow use in C++ programs.
-       Define NULL is not happened already.
-
-       * Makefile.in (DISTFILES): ship po-to-tbl.sed.in instead of
-       po-to-tbl.sed.
-       (distclean): remove po-to-tbl.sed and tupdate.perl.
-
-       * tupdate.perl.in: Substitute Perl path even in exec line.
-       Don't include entries without translation from old .po file.
-
-Tue Jul  4 00:41:51 1995  Ulrich Drepper  <drepper@myware>
-
-       * tupdate.perl.in: use "Updated: " in msgid "".
-
-       * cat-compat.c: Fix typo (LOCALDIR -> LOCALEDIR).
-       Define getenv if !__STDC__.
-
-       * bindtextdom.c: Protect stdlib.h and string.h inclusion.
-       Define free if !__STDC__.
-
-       * finddomain.c: Change DEF_MSG_DOM_DIR to LOCALEDIR.
-       Define free if !__STDC__.
-
-       * cat-compat.c: Change DEF_MSG_DOM_DIR to LOCALEDIR.
-
-Mon Jul  3 23:56:30 1995  Ulrich Drepper  <drepper@myware>
-
-       * Makefile.in: Use LOCALEDIR instead of DEF_MSG_DOM_DIR.
-       Remove unneeded $(srcdir) from Makefile.in dependency.
-
-       * makelinks: Add copyright and short description.
-
-       * po-mode.el: Last version for 0.7.
-
-       * tupdate.perl.in: Fix die message.
-
-       * dcgettext.c: Protect include of string.h.
-
-       * gettext.c: Protect include of stdlib.h and further tries to get NULL.
-
-       * finddomain.c: Some corrections in includes.
-
-       * Makefile.in (INCLUDES): Prune list correct path to Makefile.in.
-
-       * po-to-tbl.sed: Adopt for new .po file format.
-
-       * linux-msg.sed, xopen-msg.sed: Adopt for new .po file format.
-
-Sun Jul  2 23:55:03 1995  Ulrich Drepper  <drepper@myware>
-
-       * tupdate.perl.in: Complete rewrite for new .po file format.
-
-Sun Jul  2 02:06:50 1995  Ulrich Drepper  <drepper@myware>
-
-       * First official release.  This directory contains all the code
-       needed to internationalize own packages.  It provides functions
-       which allow to use the X/Open catgets function with an interface
-       like the Uniforum gettext function.  For system which does not
-       have neither of those a complete implementation is provided.
index 74cfd9e..c1d5fbd 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for directory with message catalog handling library of GNU gettext
-# Copyright (C) 1995-1998, 2000-2005 Free Software Foundation, Inc.
+# Copyright (C) 1995-1998, 2000-2006 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
@@ -24,6 +24,17 @@ SHELL = /bin/sh
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 top_builddir = ..
+
+# The VPATH variables allows builds with $builddir != $srcdir, assuming a
+# 'make' program that supports VPATH (such as GNU make). This line is removed
+# by autoconf automatically when "$(srcdir)" = ".".
+# In this directory, the VPATH handling is particular:
+# 1. If INTL_LIBTOOL_SUFFIX_PREFIX is 'l' (indicating a build with libtool),
+#    the .c -> .lo rules carefully use $(srcdir), so that VPATH can be omitted.
+# 2. If PACKAGE = gettext-tools, VPATH _must_ be omitted, because otherwise
+#    'make' does the wrong thing if GNU gettext was configured with
+#    "./configure --srcdir=`pwd`", namely it gets confused by the .lo and .la
+#    files it finds in srcdir = ../../gettext-runtime/intl.
 VPATH = $(srcdir)
 
 prefix = @prefix@
@@ -31,6 +42,7 @@ exec_prefix = @exec_prefix@
 transform = @program_transform_name@
 libdir = @libdir@
 includedir = @includedir@
+datarootdir = @datarootdir@
 datadir = @datadir@
 localedir = $(datadir)/locale
 gettextsrcdir = $(datadir)/gettext/intl
@@ -39,8 +51,8 @@ subdir = intl
 
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
-MKINSTALLDIRS = @MKINSTALLDIRS@
-mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
+mkinstalldirs = @install_sh@ -d
+mkdir_p = @mkdir_p@
 
 l = @INTL_LIBTOOL_SUFFIX_PREFIX@
 
@@ -51,15 +63,19 @@ RANLIB = @RANLIB@
 YACC = @INTLBISON@ -y -d
 YFLAGS = --name-prefix=__gettext
 
+# -DBUILDING_LIBINTL: Change expansion of LIBINTL_DLL_EXPORTED macro.
+# -DBUILDING_DLL: Change expansion of RELOCATABLE_DLL_EXPORTED macro.
 DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
--DLIBDIR=\"$(libdir)\" -DIN_LIBINTL \
+-DLIBDIR=\"$(libdir)\" -DBUILDING_LIBINTL -DBUILDING_DLL -DIN_LIBINTL \
 -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \
 -Dset_relocation_prefix=libintl_set_relocation_prefix \
 -Drelocate=libintl_relocate \
 -DDEPENDS_ON_LIBICONV=1 @DEFS@
 CPPFLAGS = @CPPFLAGS@
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@
+CFLAGS = @CFLAGS@ @CFLAG_VISIBILITY@
+LDFLAGS = @LDFLAGS@ $(LDFLAGS_@WOE32DLL@)
+LDFLAGS_yes = -Wl,--export-all-symbols
+LDFLAGS_no =
 LIBS = @LIBS@
 
 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
@@ -72,19 +88,21 @@ HEADERS = \
   plural-exp.h \
   eval-plural.h \
   localcharset.h \
+  lock.h \
   relocatable.h \
   xsize.h \
   printf-args.h printf-args.c \
   printf-parse.h wprintf-parse.h printf-parse.c \
   vasnprintf.h vasnwprintf.h vasnprintf.c \
   os2compat.h \
-  libgnuintl.h
+  libgnuintl.h.in
 SOURCES = \
   bindtextdom.c \
   dcgettext.c \
   dgettext.c \
   gettext.c \
   finddomain.c \
+  hash-string.c \
   loadmsgcat.c \
   localealias.c \
   textdomain.c \
@@ -97,13 +115,16 @@ SOURCES = \
   plural.y \
   plural-exp.c \
   localcharset.c \
+  lock.c \
   relocatable.c \
   langprefs.c \
   localename.c \
   log.c \
   printf.c \
+  version.c \
   osdep.c \
   os2compat.c \
+  intl-exports.c \
   intl-compat.c
 OBJECTS = \
   bindtextdom.$lo \
@@ -111,6 +132,7 @@ OBJECTS = \
   dgettext.$lo \
   gettext.$lo \
   finddomain.$lo \
+  hash-string.$lo \
   loadmsgcat.$lo \
   localealias.$lo \
   textdomain.$lo \
@@ -123,15 +145,18 @@ OBJECTS = \
   plural.$lo \
   plural-exp.$lo \
   localcharset.$lo \
+  lock.$lo \
   relocatable.$lo \
   langprefs.$lo \
   localename.$lo \
   log.$lo \
   printf.$lo \
+  version.$lo \
   osdep.$lo \
   intl-compat.$lo
 DISTFILES.common = Makefile.in \
-config.charset locale.alias ref-add.sin ref-del.sin $(HEADERS) $(SOURCES)
+config.charset locale.alias ref-add.sin ref-del.sin export.h \
+$(HEADERS) $(SOURCES)
 DISTFILES.generated = plural.c
 DISTFILES.normal = VERSION
 DISTFILES.gettext = COPYING.LIB-2.0 COPYING.LIB-2.1 libintl.glibc \
@@ -154,7 +179,7 @@ libintl.a libgnuintl.a: $(OBJECTS)
 libintl.la libgnuintl.la: $(OBJECTS)
        $(LIBTOOL) --mode=link \
          $(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \
-         $(OBJECTS) @LTLIBICONV@ @INTL_MACOSX_LIBS@ $(LIBS) -lc \
+         $(OBJECTS) @LTLIBICONV@ @INTL_MACOSX_LIBS@ $(LIBS) @LTLIBTHREAD@ -lc \
          -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
          -rpath $(libdir) \
          -no-undefined
@@ -164,9 +189,9 @@ libintl.la libgnuintl.la: $(OBJECTS)
 # according to the libtool documentation, section "Library interface versions".
 # Maintainers of other packages that include the intl directory must *not*
 # change these values.
-LTV_CURRENT=7
-LTV_REVISION=3
-LTV_AGE=4
+LTV_CURRENT=8
+LTV_REVISION=0
+LTV_AGE=0
 
 .SUFFIXES:
 .SUFFIXES: .c .y .o .lo .sin .sed
@@ -188,6 +213,8 @@ gettext.lo: $(srcdir)/gettext.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/gettext.c
 finddomain.lo: $(srcdir)/finddomain.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/finddomain.c
+hash-string.lo: $(srcdir)/hash-string.c
+       $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/hash-string.c
 loadmsgcat.lo: $(srcdir)/loadmsgcat.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/loadmsgcat.c
 localealias.lo: $(srcdir)/localealias.c
@@ -212,6 +239,8 @@ plural-exp.lo: $(srcdir)/plural-exp.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/plural-exp.c
 localcharset.lo: $(srcdir)/localcharset.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localcharset.c
+lock.lo: $(srcdir)/lock.c
+       $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/lock.c
 relocatable.lo: $(srcdir)/relocatable.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/relocatable.c
 langprefs.lo: $(srcdir)/langprefs.c
@@ -222,6 +251,8 @@ log.lo: $(srcdir)/log.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/log.c
 printf.lo: $(srcdir)/printf.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/printf.c
+version.lo: $(srcdir)/version.c
+       $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/version.c
 osdep.lo: $(srcdir)/osdep.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/osdep.c
 intl-compat.lo: $(srcdir)/intl-compat.c
@@ -236,8 +267,30 @@ ref-del.sed: $(srcdir)/ref-del.sin
 
 INCLUDES = -I. -I$(srcdir) -I..
 
-libintl.h: libgnuintl.h
-       cp libgnuintl.h libintl.h
+libgnuintl.h: $(srcdir)/libgnuintl.h.in
+       sed -e '/IN_LIBGLOCALE/d' \
+           -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \
+           -e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \
+           -e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \
+           -e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \
+         < $(srcdir)/libgnuintl.h.in \
+       | if test '@WOE32DLL@' = yes; then \
+           sed -e 's/extern \([^()]*\);/extern __declspec (dllimport) \1;/'; \
+         else \
+           cat; \
+         fi \
+       | sed -e 's/extern \([^"]\)/extern LIBINTL_DLL_EXPORTED \1/' \
+             -e "/#define _LIBINTL_H/r $(srcdir)/export.h" \
+       | sed -e 's,@''HAVE_VISIBILITY''@,@HAVE_VISIBILITY@,g' \
+         > libgnuintl.h
+
+libintl.h: $(srcdir)/libgnuintl.h.in
+       sed -e '/IN_LIBGLOCALE/d' \
+           -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \
+           -e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \
+           -e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \
+           -e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \
+         < $(srcdir)/libgnuintl.h.in > libintl.h
 
 charset.alias: $(srcdir)/config.charset
        $(SHELL) $(srcdir)/config.charset '@host@' > t-$@
@@ -254,7 +307,7 @@ install: install-exec install-data
 install-exec: all
        if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
           && test '@USE_INCLUDED_LIBINTL@' = yes; then \
-         $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
+         $(mkdir_p) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
          $(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \
          $(LIBTOOL) --mode=install \
            $(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \
@@ -270,7 +323,7 @@ install-exec: all
        if test "$(PACKAGE)" = "gettext-tools" \
           && test '@USE_INCLUDED_LIBINTL@' = no \
           && test @GLIBC2@ != no; then \
-         $(mkinstalldirs) $(DESTDIR)$(libdir); \
+         $(mkdir_p) $(DESTDIR)$(libdir); \
          $(LIBTOOL) --mode=install \
            $(INSTALL_DATA) libgnuintl.$la $(DESTDIR)$(libdir)/libgnuintl.$la; \
          rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so; \
@@ -281,7 +334,7 @@ install-exec: all
          : ; \
        fi
        if test '@USE_INCLUDED_LIBINTL@' = yes; then \
-         test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir); \
+         test @GLIBC21@ != no || $(mkdir_p) $(DESTDIR)$(libdir); \
          temp=$(DESTDIR)$(libdir)/t-charset.alias; \
          dest=$(DESTDIR)$(libdir)/charset.alias; \
          if test -f $(DESTDIR)$(libdir)/charset.alias; then \
@@ -297,7 +350,7 @@ install-exec: all
              rm -f $$temp; \
            fi; \
          fi; \
-         $(mkinstalldirs) $(DESTDIR)$(localedir); \
+         $(mkdir_p) $(DESTDIR)$(localedir); \
          test -f $(DESTDIR)$(localedir)/locale.alias \
            && orig=$(DESTDIR)$(localedir)/locale.alias \
            || orig=$(srcdir)/locale.alias; \
@@ -311,7 +364,7 @@ install-exec: all
        fi
 install-data: all
        if test "$(PACKAGE)" = "gettext-tools"; then \
-         $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
+         $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
          $(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \
          $(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \
          dists="COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common)"; \
@@ -339,25 +392,25 @@ install-strip: install
 installdirs:
        if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
           && test '@USE_INCLUDED_LIBINTL@' = yes; then \
-         $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
+         $(mkdir_p) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
        else \
          : ; \
        fi
        if test "$(PACKAGE)" = "gettext-tools" \
           && test '@USE_INCLUDED_LIBINTL@' = no \
           && test @GLIBC2@ != no; then \
-         $(mkinstalldirs) $(DESTDIR)$(libdir); \
+         $(mkdir_p) $(DESTDIR)$(libdir); \
        else \
          : ; \
        fi
        if test '@USE_INCLUDED_LIBINTL@' = yes; then \
-         test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir); \
-         $(mkinstalldirs) $(DESTDIR)$(localedir); \
+         test @GLIBC21@ != no || $(mkdir_p) $(DESTDIR)$(libdir); \
+         $(mkdir_p) $(DESTDIR)$(localedir); \
        else \
          : ; \
        fi
        if test "$(PACKAGE)" = "gettext-tools"; then \
-         $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
+         $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
        else \
          : ; \
        fi
@@ -419,14 +472,20 @@ info dvi ps pdf html:
 
 $(OBJECTS): ../config.h libgnuintl.h
 bindtextdom.$lo dcgettext.$lo dcigettext.$lo dcngettext.$lo dgettext.$lo dngettext.$lo finddomain.$lo gettext.$lo intl-compat.$lo loadmsgcat.$lo localealias.$lo ngettext.$lo textdomain.$lo: $(srcdir)/gettextP.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h
-dcigettext.$lo loadmsgcat.$lo: $(srcdir)/hash-string.h
+hash-string.$lo dcigettext.$lo loadmsgcat.$lo: $(srcdir)/hash-string.h
 explodename.$lo l10nflist.$lo: $(srcdir)/loadinfo.h
 dcigettext.$lo loadmsgcat.$lo plural.$lo plural-exp.$lo: $(srcdir)/plural-exp.h
 dcigettext.$lo: $(srcdir)/eval-plural.h
 localcharset.$lo: $(srcdir)/localcharset.h
+bindtextdom.$lo dcigettext.$lo finddomain.$lo loadmsgcat.$lo localealias.$lo lock.$lo log.$lo: $(srcdir)/lock.h
 localealias.$lo localcharset.$lo relocatable.$lo: $(srcdir)/relocatable.h
 printf.$lo: $(srcdir)/printf-args.h $(srcdir)/printf-args.c $(srcdir)/printf-parse.h $(srcdir)/wprintf-parse.h $(srcdir)/xsize.h $(srcdir)/printf-parse.c $(srcdir)/vasnprintf.h $(srcdir)/vasnwprintf.h $(srcdir)/vasnprintf.c
 
+# A bison-2.1 generated plural.c includes <libintl.h> if ENABLE_NLS.
+PLURAL_DEPS_yes = libintl.h
+PLURAL_DEPS_no =
+plural.$lo: $(PLURAL_DEPS_@USE_INCLUDED_LIBINTL@)
+
 tags: TAGS
 
 TAGS: $(HEADERS) $(SOURCES)
@@ -445,7 +504,7 @@ ID: $(HEADERS) $(SOURCES)
 
 mostlyclean:
        rm -f *.a *.la *.o *.obj *.lo core core.*
-       rm -f libintl.h charset.alias ref-add.sed ref-del.sed
+       rm -f libgnuintl.h libintl.h charset.alias ref-add.sed ref-del.sed
        rm -f -r .libs _libs
 
 clean: mostlyclean
@@ -486,9 +545,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        cd $(top_builddir) && $(SHELL) ./config.status
 # This would be more efficient, but doesn't work any more with autoconf-2.57,
 # when AC_CONFIG_FILES([intl/Makefile:somedir/Makefile.in]) is used.
-#      cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+#      cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
 # Tell versions [3.59,3.63) of GNU make not to export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
--include ../cflags.mk
index ea89761..fb7452c 100644 (file)
@@ -1 +1 @@
-GNU gettext library from gettext-0.14.5
+GNU gettext library from gettext-0.15
index 7a26062..d1b1f90 100644 (file)
@@ -1,5 +1,5 @@
 /* Implementation of the bindtextdomain(3) function
-   Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2003, 2005-2006 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
 #include <stdlib.h>
 #include <string.h>
 
+#include "gettextP.h"
 #ifdef _LIBC
 # include <libintl.h>
 #else
 # include "libgnuintl.h"
 #endif
-#include "gettextP.h"
 
+/* Handle multi-threaded applications.  */
 #ifdef _LIBC
-/* We have to handle multi-threaded applications.  */
 # include <bits/libc-lock.h>
+# define gl_rwlock_define __libc_rwlock_define
+# define gl_rwlock_wrlock __libc_rwlock_wrlock
+# define gl_rwlock_unlock __libc_rwlock_unlock
 #else
-/* Provide dummy implementation if this is outside glibc.  */
-# define __libc_rwlock_define(CLASS, NAME)
-# define __libc_rwlock_wrlock(NAME)
-# define __libc_rwlock_unlock(NAME)
+# include "lock.h"
 #endif
 
 /* The internal variables in the standalone libintl.a must have different
 /* Contains the default location of the message catalogs.  */
 extern const char _nl_default_dirname[];
 #ifdef _LIBC
-extern const char _nl_default_dirname_internal[] attribute_hidden;
-#else
-# define INTUSE(name) name
+libc_hidden_proto (_nl_default_dirname)
 #endif
 
 /* List with bindings of specific domains.  */
 extern struct binding *_nl_domain_bindings;
 
 /* Lock variable to protect the global data in the gettext implementation.  */
-__libc_rwlock_define (extern, _nl_state_lock attribute_hidden)
+gl_rwlock_define (extern, _nl_state_lock attribute_hidden)
 
 
 /* Names for the libintl functions are a problem.  They must not clash
@@ -109,7 +107,7 @@ set_binding_values (const char *domainname,
       return;
     }
 
-  __libc_rwlock_wrlock (_nl_state_lock);
+  gl_rwlock_wrlock (_nl_state_lock);
 
   modified = 0;
 
@@ -144,8 +142,8 @@ set_binding_values (const char *domainname,
              char *result = binding->dirname;
              if (strcmp (dirname, result) != 0)
                {
-                 if (strcmp (dirname, INTUSE(_nl_default_dirname)) == 0)
-                   result = (char *) INTUSE(_nl_default_dirname);
+                 if (strcmp (dirname, _nl_default_dirname) == 0)
+                   result = (char *) _nl_default_dirname;
                  else
                    {
 #if defined _LIBC || defined HAVE_STRDUP
@@ -160,7 +158,7 @@ set_binding_values (const char *domainname,
 
                  if (__builtin_expect (result != NULL, 1))
                    {
-                     if (binding->dirname != INTUSE(_nl_default_dirname))
+                     if (binding->dirname != _nl_default_dirname)
                        free (binding->dirname);
 
                      binding->dirname = result;
@@ -201,7 +199,6 @@ set_binding_values (const char *domainname,
                        free (binding->codeset);
 
                      binding->codeset = result;
-                     binding->codeset_cntr++;
                      modified = 1;
                    }
                }
@@ -214,7 +211,7 @@ set_binding_values (const char *domainname,
     {
       /* Simply return the default values.  */
       if (dirnamep)
-       *dirnamep = INTUSE(_nl_default_dirname);
+       *dirnamep = _nl_default_dirname;
       if (codesetp)
        *codesetp = NULL;
     }
@@ -236,11 +233,11 @@ set_binding_values (const char *domainname,
 
          if (dirname == NULL)
            /* The default value.  */
-           dirname = INTUSE(_nl_default_dirname);
+           dirname = _nl_default_dirname;
          else
            {
-             if (strcmp (dirname, INTUSE(_nl_default_dirname)) == 0)
-               dirname = INTUSE(_nl_default_dirname);
+             if (strcmp (dirname, _nl_default_dirname) == 0)
+               dirname = _nl_default_dirname;
              else
                {
                  char *result;
@@ -263,9 +260,7 @@ set_binding_values (const char *domainname,
        }
       else
        /* The default value.  */
-       new_binding->dirname = (char *) INTUSE(_nl_default_dirname);
-
-      new_binding->codeset_cntr = 0;
+       new_binding->dirname = (char *) _nl_default_dirname;
 
       if (codesetp)
        {
@@ -287,7 +282,6 @@ set_binding_values (const char *domainname,
              memcpy (result, codeset, len);
 #endif
              codeset = result;
-             new_binding->codeset_cntr++;
            }
          *codesetp = codeset;
          new_binding->codeset = (char *) codeset;
@@ -319,7 +313,7 @@ set_binding_values (const char *domainname,
       if (0)
        {
        failed_codeset:
-         if (new_binding->dirname != INTUSE(_nl_default_dirname))
+         if (new_binding->dirname != _nl_default_dirname)
            free (new_binding->dirname);
        failed_dirname:
          free (new_binding);
@@ -335,7 +329,7 @@ set_binding_values (const char *domainname,
   if (modified)
     ++_nl_msg_cat_cntr;
 
-  __libc_rwlock_unlock (_nl_state_lock);
+  gl_rwlock_unlock (_nl_state_lock);
 }
 
 /* Specify that the DOMAINNAME message catalog will be found
old mode 100644 (file)
new mode 100755 (executable)
index 9090c80..e8c258b
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Output a system dependent table of character encoding aliases.
 #
-#   Copyright (C) 2000-2004 Free Software Foundation, Inc.
+#   Copyright (C) 2000-2004, 2006 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
 # The current list of GNU canonical charset names is as follows.
 #
 #       name              MIME?             used by which systems
-#   ASCII, ANSI_X3.4-1968       glibc solaris freebsd darwin
-#   ISO-8859-1              Y   glibc aix hpux irix osf solaris freebsd darwin
-#   ISO-8859-2              Y   glibc aix hpux irix osf solaris freebsd darwin
+#   ASCII, ANSI_X3.4-1968       glibc solaris freebsd netbsd darwin
+#   ISO-8859-1              Y   glibc aix hpux irix osf solaris freebsd netbsd darwin
+#   ISO-8859-2              Y   glibc aix hpux irix osf solaris freebsd netbsd darwin
 #   ISO-8859-3              Y   glibc solaris
-#   ISO-8859-4              Y   osf solaris freebsd darwin
-#   ISO-8859-5              Y   glibc aix hpux irix osf solaris freebsd darwin
+#   ISO-8859-4              Y   osf solaris freebsd netbsd darwin
+#   ISO-8859-5              Y   glibc aix hpux irix osf solaris freebsd netbsd darwin
 #   ISO-8859-6              Y   glibc aix hpux solaris
-#   ISO-8859-7              Y   glibc aix hpux irix osf solaris darwin
+#   ISO-8859-7              Y   glibc aix hpux irix osf solaris netbsd darwin
 #   ISO-8859-8              Y   glibc aix hpux osf solaris
 #   ISO-8859-9              Y   glibc aix hpux irix osf solaris darwin
-#   ISO-8859-13                 glibc darwin
+#   ISO-8859-13                 glibc netbsd darwin
 #   ISO-8859-14                 glibc
 #   ISO-8859-15                 glibc aix osf solaris freebsd darwin
-#   KOI8-R                  Y   glibc solaris freebsd darwin
-#   KOI8-U                  Y   glibc freebsd darwin
+#   KOI8-R                  Y   glibc solaris freebsd netbsd darwin
+#   KOI8-U                  Y   glibc freebsd netbsd darwin
 #   KOI8-T                      glibc
 #   CP437                       dos
 #   CP775                       dos
@@ -58,7 +58,7 @@
 #   CP862                       dos
 #   CP864                       dos
 #   CP865                       dos
-#   CP866                       freebsd darwin dos
+#   CP866                       freebsd netbsd darwin dos
 #   CP869                       dos
 #   CP874                       woe32 dos
 #   CP922                       aix
 #   CP1125                      dos
 #   CP1129                      aix
 #   CP1250                      woe32
-#   CP1251                      glibc solaris darwin woe32
+#   CP1251                      glibc solaris netbsd darwin woe32
 #   CP1252                      aix woe32
 #   CP1253                      woe32
 #   CP1254                      woe32
 #   CP1255                      glibc woe32
 #   CP1256                      woe32
 #   CP1257                      woe32
-#   GB2312                  Y   glibc aix hpux irix solaris freebsd darwin
-#   EUC-JP                  Y   glibc aix hpux irix osf solaris freebsd darwin
-#   EUC-KR                  Y   glibc aix hpux irix osf solaris freebsd darwin
-#   EUC-TW                      glibc aix hpux irix osf solaris
-#   BIG5                    Y   glibc aix hpux osf solaris freebsd darwin
+#   GB2312                  Y   glibc aix hpux irix solaris freebsd netbsd darwin
+#   EUC-JP                  Y   glibc aix hpux irix osf solaris freebsd netbsd darwin
+#   EUC-KR                  Y   glibc aix hpux irix osf solaris freebsd netbsd darwin
+#   EUC-TW                      glibc aix hpux irix osf solaris netbsd
+#   BIG5                    Y   glibc aix hpux osf solaris freebsd netbsd darwin
 #   BIG5-HKSCS                  glibc solaris
 #   GBK                         glibc aix osf solaris woe32 dos
-#   GB18030                     glibc solaris
-#   SHIFT_JIS               Y   hpux osf solaris freebsd darwin
+#   GB18030                     glibc solaris netbsd
+#   SHIFT_JIS               Y   hpux osf solaris freebsd netbsd darwin
 #   JOHAB                       glibc solaris woe32
 #   TIS-620                     glibc aix hpux osf solaris
 #   VISCII                  Y   glibc
 #   HP-KANA8                    hpux
 #   DEC-KANJI                   osf
 #   DEC-HANYU                   osf
-#   UTF-8                   Y   glibc aix hpux osf solaris darwin
+#   UTF-8                   Y   glibc aix hpux osf solaris netbsd darwin
 #
 # Note: Names which are not marked as being a MIME name should not be used in
 # Internet protocols for information interchange (mail, news, etc.).
@@ -388,6 +388,8 @@ case "$os" in
        echo "ISO8859-2 ISO-8859-2"
        echo "ISO8859-4 ISO-8859-4"
        echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-13 ISO-8859-13"
        echo "ISO8859-15 ISO-8859-15"
        echo "eucCN GB2312"
        echo "eucJP EUC-JP"
@@ -480,7 +482,7 @@ case "$os" in
        echo "# If you find that the encoding given for your language and"
        echo "# country is not the one your DOS machine actually uses, just"
        echo "# correct it in this file, and send a mail to"
-       echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>"
+       echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>"
        echo "# and Bruno Haible <bruno@clisp.org>."
        echo "#"
        echo "C ASCII"
index 7e9653c..5839768 100644 (file)
@@ -1,5 +1,5 @@
 /* Implementation of the internal dcigettext function.
-   Copyright (C) 1995-1999, 2000-2005 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000-2006 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
@@ -27,6 +27,9 @@
 # include <config.h>
 #endif
 
+/* NL_LOCALE_NAME does not work in glibc-2.4.  Ignore it.  */
+#undef HAVE_NL_LOCALE_NAME
+
 #include <sys/types.h>
 
 #ifdef __GNUC__
@@ -87,26 +90,31 @@ extern int errno;
 # include <sys/param.h>
 #endif
 
+#if !defined _LIBC && HAVE_NL_LOCALE_NAME
+# include <langinfo.h>
+#endif
+
 #include "gettextP.h"
 #include "plural-exp.h"
 #ifdef _LIBC
 # include <libintl.h>
 #else
+# ifdef IN_LIBGLOCALE
+#  include <libintl.h>
+# endif
 # include "libgnuintl.h"
 #endif
 #include "hash-string.h"
 
-/* Thread safetyness.  */
+/* Handle multi-threaded applications.  */
 #ifdef _LIBC
 # include <bits/libc-lock.h>
+# define gl_rwlock_define_initialized __libc_rwlock_define_initialized
+# define gl_rwlock_rdlock __libc_rwlock_rdlock
+# define gl_rwlock_wrlock __libc_rwlock_wrlock
+# define gl_rwlock_unlock __libc_rwlock_unlock
 #else
-/* Provide dummy implementation if this is outside glibc.  */
-# define __libc_lock_define_initialized(CLASS, NAME)
-# define __libc_lock_lock(NAME)
-# define __libc_lock_unlock(NAME)
-# define __libc_rwlock_define_initialized(CLASS, NAME)
-# define __libc_rwlock_rdlock(NAME)
-# define __libc_rwlock_unlock(NAME)
+# include "lock.h"
 #endif
 
 /* Alignment of types.  */
@@ -216,16 +224,31 @@ static void *mempcpy (void *dest, const void *src, size_t n);
 # define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
 #endif
 
+/* Whether to support different locales in different threads.  */
+#if defined _LIBC || HAVE_NL_LOCALE_NAME || (HAVE_STRUCT___LOCALE_STRUCT___NAMES && defined USE_IN_GETTEXT_TESTS) || defined IN_LIBGLOCALE
+# define HAVE_PER_THREAD_LOCALE
+#endif
+
 /* This is the type used for the search tree where known translations
    are stored.  */
 struct known_translation_t
 {
   /* Domain in which to search.  */
-  char *domainname;
+  const char *domainname;
 
   /* The category.  */
   int category;
 
+#ifdef HAVE_PER_THREAD_LOCALE
+  /* Name of the relevant locale category, or "" for the global locale.  */
+  const char *localename;
+#endif
+
+#ifdef IN_LIBGLOCALE
+  /* The character encoding.  */
+  const char *encoding;
+#endif
+
   /* State of the catalog counter at the point the string was found.  */
   int counter;
 
@@ -245,6 +268,8 @@ struct known_translation_t
 #if defined HAVE_TSEARCH || defined _LIBC
 # include <search.h>
 
+gl_rwlock_define_initialized (static, tree_lock)
+
 static void *root;
 
 # ifdef _LIBC
@@ -267,57 +292,86 @@ transcmp (const void *p1, const void *p2)
     {
       result = strcmp (s1->domainname, s2->domainname);
       if (result == 0)
-       /* We compare the category last (though this is the cheapest
-          operation) since it is hopefully always the same (namely
-          LC_MESSAGES).  */
-       result = s1->category - s2->category;
+       {
+#ifdef HAVE_PER_THREAD_LOCALE
+         result = strcmp (s1->localename, s2->localename);
+         if (result == 0)
+#endif
+           {
+#ifdef IN_LIBGLOCALE
+             result = strcmp (s1->encoding, s2->encoding);
+             if (result == 0)
+#endif
+               /* We compare the category last (though this is the cheapest
+                  operation) since it is hopefully always the same (namely
+                  LC_MESSAGES).  */
+               result = s1->category - s2->category;
+           }
+       }
     }
 
   return result;
 }
 #endif
 
-#ifndef INTVARDEF
-# define INTVARDEF(name)
-#endif
-#ifndef INTUSE
-# define INTUSE(name) name
-#endif
-
 /* Name of the default domain used for gettext(3) prior any call to
    textdomain(3).  The default value for this is "messages".  */
 const char _nl_default_default_domain[] attribute_hidden = "messages";
 
+#ifndef IN_LIBGLOCALE
 /* Value used as the default domain for gettext(3).  */
 const char *_nl_current_default_domain attribute_hidden
      = _nl_default_default_domain;
+#endif
 
 /* Contains the default location of the message catalogs.  */
 #if defined __EMX__
 extern const char _nl_default_dirname[];
 #else
+# ifdef _LIBC
+extern const char _nl_default_dirname[];
+libc_hidden_proto (_nl_default_dirname)
+# endif
 const char _nl_default_dirname[] = LOCALEDIR;
-INTVARDEF (_nl_default_dirname)
+# ifdef _LIBC
+libc_hidden_data_def (_nl_default_dirname)
+# endif
 #endif
 
+#ifndef IN_LIBGLOCALE
 /* List with bindings of specific domains created by bindtextdomain()
    calls.  */
 struct binding *_nl_domain_bindings;
+#endif
 
 /* Prototypes for local functions.  */
 static char *plural_lookup (struct loaded_l10nfile *domain,
                            unsigned long int n,
                            const char *translation, size_t translation_len)
      internal_function;
+
+#ifdef IN_LIBGLOCALE
+static const char *guess_category_value (int category,
+                                        const char *categoryname,
+                                        const char *localename)
+     internal_function;
+#else
 static const char *guess_category_value (int category,
                                         const char *categoryname)
      internal_function;
+#endif
+
 #ifdef _LIBC
 # include "../locale/localeinfo.h"
-# define category_to_name(category)    _nl_category_names[category]
+# define category_to_name(category) \
+  _nl_category_names.str + _nl_category_name_idxs[category]
 #else
 static const char *category_to_name (int category) internal_function;
 #endif
+#if (defined _LIBC || HAVE_ICONV) && !defined IN_LIBGLOCALE
+static const char *get_output_charset (struct binding *domainbinding)
+     internal_function;
+#endif
 
 
 /* For those loosing systems which don't have `alloca' we have to add
@@ -383,9 +437,7 @@ typedef unsigned char transmem_block_t;
 #endif
 
 /* Lock variable to protect the global data in the gettext implementation.  */
-#ifdef _LIBC
-__libc_rwlock_define_initialized (, _nl_state_lock attribute_hidden)
-#endif
+gl_rwlock_define_initialized (, _nl_state_lock attribute_hidden)
 
 /* Checking whether the binaries runs SUID must be done and glibc provides
    easier methods therefore we make a difference here.  */
@@ -423,9 +475,18 @@ static int enable_secure;
 /* Look up MSGID in the DOMAINNAME message catalog for the current
    CATEGORY locale and, if PLURAL is nonzero, search over string
    depending on the plural form determined by N.  */
+#ifdef IN_LIBGLOCALE
+char *
+gl_dcigettext (const char *domainname,
+              const char *msgid1, const char *msgid2,
+              int plural, unsigned long int n,
+              int category,
+              const char *localename, const char *encoding)
+#else
 char *
 DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
            int plural, unsigned long int n, int category)
+#endif
 {
 #ifndef HAVE_ALLOCA
   struct block_list *block_list = NULL;
@@ -434,7 +495,8 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
   struct binding *binding;
   const char *categoryname;
   const char *categoryvalue;
-  char *dirname, *xdomainname;
+  const char *dirname;
+  char *xdomainname;
   char *single_locale;
   char *retval;
   size_t retlen;
@@ -443,6 +505,9 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
   struct known_translation_t *search;
   struct known_translation_t **foundp = NULL;
   size_t msgid_len;
+# if defined HAVE_PER_THREAD_LOCALE && !defined IN_LIBGLOCALE
+  const char *localename;
+# endif
 #endif
   size_t domainname_len;
 
@@ -459,7 +524,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
            : n == 1 ? (char *) msgid1 : (char *) msgid2);
 #endif
 
-  __libc_rwlock_rdlock (_nl_state_lock);
+  gl_rwlock_rdlock (_nl_state_lock);
 
   /* If DOMAINNAME is NULL, we are interested in the default domain.  If
      CATEGORY is not LC_MESSAGES this might not make much sense but the
@@ -481,10 +546,45 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
   search = (struct known_translation_t *)
           alloca (offsetof (struct known_translation_t, msgid) + msgid_len);
   memcpy (search->msgid, msgid1, msgid_len);
-  search->domainname = (char *) domainname;
+  search->domainname = domainname;
   search->category = category;
+# ifdef HAVE_PER_THREAD_LOCALE
+#  ifndef IN_LIBGLOCALE
+#   ifdef _LIBC
+  localename = __current_locale_name (category);
+#   else
+#    if HAVE_NL_LOCALE_NAME
+  /* NL_LOCALE_NAME is public glibc API introduced in glibc-2.4.  */
+  localename = nl_langinfo (NL_LOCALE_NAME (category));
+#    else
+#     if HAVE_STRUCT___LOCALE_STRUCT___NAMES && defined USE_IN_GETTEXT_TESTS
+  /* The __names field is not public glibc API and must therefore not be used
+     in code that is installed in public locations.  */
+  {
+    locale_t thread_locale = uselocale (NULL);
+    if (thread_locale != LC_GLOBAL_LOCALE)
+      localename = thread_locale->__names[category];
+    else
+      localename = "";
+  }
+#     endif
+#    endif
+#   endif
+#  endif
+  search->localename = localename;
+#  ifdef IN_LIBGLOCALE
+  search->encoding = encoding;
+#  endif
+# endif
+
+  /* Since tfind/tsearch manage a balanced tree, concurrent tfind and
+     tsearch calls can be fatal.  */
+  gl_rwlock_rdlock (tree_lock);
 
   foundp = (struct known_translation_t **) tfind (search, &root, transcmp);
+
+  gl_rwlock_unlock (tree_lock);
+
   freea (search);
   if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr)
     {
@@ -495,7 +595,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
       else
        retval = (char *) (*foundp)->translation;
 
-      __libc_rwlock_unlock (_nl_state_lock);
+      gl_rwlock_unlock (_nl_state_lock);
       return retval;
     }
 #endif
@@ -507,6 +607,12 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
   DETERMINE_SECURE;
 
   /* First find matching binding.  */
+#ifdef IN_LIBGLOCALE
+  /* We can use a trivial binding, since _nl_find_msg will ignore it anyway,
+     and _nl_load_domain and _nl_find_domain just pass it through.  */
+  binding = NULL;
+  dirname = bindtextdomain (domainname, NULL);
+#else
   for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
     {
       int compare = strcmp (domainname, binding->domainname);
@@ -522,44 +628,55 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
     }
 
   if (binding == NULL)
-    dirname = (char *) INTUSE(_nl_default_dirname);
-  else if (IS_ABSOLUTE_PATH (binding->dirname))
-    dirname = binding->dirname;
+    dirname = _nl_default_dirname;
   else
     {
-      /* We have a relative path.  Make it absolute now.  */
-      size_t dirname_len = strlen (binding->dirname) + 1;
-      size_t path_max;
-      char *ret;
+      dirname = binding->dirname;
+#endif
+      if (!IS_ABSOLUTE_PATH (dirname))
+       {
+         /* We have a relative path.  Make it absolute now.  */
+         size_t dirname_len = strlen (dirname) + 1;
+         size_t path_max;
+         char *resolved_dirname;
+         char *ret;
 
-      path_max = (unsigned int) PATH_MAX;
-      path_max += 2;           /* The getcwd docs say to do this.  */
+         path_max = (unsigned int) PATH_MAX;
+         path_max += 2;                /* The getcwd docs say to do this.  */
 
-      for (;;)
-       {
-         dirname = (char *) alloca (path_max + dirname_len);
-         ADD_BLOCK (block_list, dirname);
+         for (;;)
+           {
+             resolved_dirname = (char *) alloca (path_max + dirname_len);
+             ADD_BLOCK (block_list, tmp_dirname);
 
-         __set_errno (0);
-         ret = getcwd (dirname, path_max);
-         if (ret != NULL || errno != ERANGE)
-           break;
+             __set_errno (0);
+             ret = getcwd (resolved_dirname, path_max);
+             if (ret != NULL || errno != ERANGE)
+               break;
 
-         path_max += path_max / 2;
-         path_max += PATH_INCR;
-       }
+             path_max += path_max / 2;
+             path_max += PATH_INCR;
+           }
 
-      if (ret == NULL)
-       /* We cannot get the current working directory.  Don't signal an
-          error but simply return the default string.  */
-       goto return_untranslated;
+         if (ret == NULL)
+           /* We cannot get the current working directory.  Don't signal an
+              error but simply return the default string.  */
+           goto return_untranslated;
 
-      stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
+         stpcpy (stpcpy (strchr (resolved_dirname, '\0'), "/"), dirname);
+         dirname = resolved_dirname;
+       }
+#ifndef IN_LIBGLOCALE
     }
+#endif
 
   /* Now determine the symbolic name of CATEGORY and its value.  */
   categoryname = category_to_name (category);
+#ifdef IN_LIBGLOCALE
+  categoryvalue = guess_category_value (category, categoryname, localename);
+#else
   categoryvalue = guess_category_value (category, categoryname);
+#endif
 
   domainname_len = strlen (domainname);
   xdomainname = (char *) alloca (strlen (categoryname)
@@ -617,7 +734,11 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
 
       if (domain != NULL)
        {
-         retval = _nl_find_msg (domain, binding, msgid1, &retlen);
+#if defined IN_LIBGLOCALE
+         retval = _nl_find_msg (domain, binding, encoding, msgid1, &retlen);
+#else
+         retval = _nl_find_msg (domain, binding, msgid1, 1, &retlen);
+#endif
 
          if (retval == NULL)
            {
@@ -625,8 +746,13 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
 
              for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
                {
+#if defined IN_LIBGLOCALE
+                 retval = _nl_find_msg (domain->successor[cnt], binding,
+                                        encoding, msgid1, &retlen);
+#else
                  retval = _nl_find_msg (domain->successor[cnt], binding,
-                                        msgid1, &retlen);
+                                        msgid1, 1, &retlen);
+#endif
 
                  if (retval != NULL)
                    {
@@ -636,6 +762,12 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
                }
            }
 
+         /* Returning -1 means that some resource problem exists
+            (likely memory) and that the strings could not be
+            converted.  Return the original strings.  */
+         if (__builtin_expect (retval == (char *) -1, 0))
+           break;
+
          if (retval != NULL)
            {
              /* Found the translation of MSGID1 in domain DOMAIN:
@@ -645,25 +777,49 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
              if (foundp == NULL)
                {
                  /* Create a new entry and add it to the search tree.  */
+                 size_t size;
                  struct known_translation_t *newp;
 
-                 newp = (struct known_translation_t *)
-                   malloc (offsetof (struct known_translation_t, msgid)
-                           + msgid_len + domainname_len + 1);
+                 size = offsetof (struct known_translation_t, msgid)
+                        + msgid_len + domainname_len + 1;
+# ifdef HAVE_PER_THREAD_LOCALE
+                 size += strlen (localename) + 1;
+# endif
+                 newp = (struct known_translation_t *) malloc (size);
                  if (newp != NULL)
                    {
-                     newp->domainname =
-                       mempcpy (newp->msgid, msgid1, msgid_len);
-                     memcpy (newp->domainname, domainname, domainname_len + 1);
+                     char *new_domainname;
+# ifdef HAVE_PER_THREAD_LOCALE
+                     char *new_localename;
+# endif
+
+                     new_domainname = mempcpy (newp->msgid, msgid1, msgid_len);
+                     memcpy (new_domainname, domainname, domainname_len + 1);
+# ifdef HAVE_PER_THREAD_LOCALE
+                     new_localename = new_domainname + domainname_len + 1;
+                     strcpy (new_localename, localename);
+# endif
+                     newp->domainname = new_domainname;
                      newp->category = category;
+# ifdef HAVE_PER_THREAD_LOCALE
+                     newp->localename = new_localename;
+# endif
+# ifdef IN_LIBGLOCALE
+                     newp->encoding = encoding;
+# endif
                      newp->counter = _nl_msg_cat_cntr;
                      newp->domain = domain;
                      newp->translation = retval;
                      newp->translation_length = retlen;
 
+                     gl_rwlock_wrlock (tree_lock);
+
                      /* Insert the entry in the search tree.  */
                      foundp = (struct known_translation_t **)
                        tsearch (newp, &root, transcmp);
+
+                     gl_rwlock_unlock (tree_lock);
+
                      if (foundp == NULL
                          || __builtin_expect (*foundp != newp, 0))
                        /* The insert failed.  */
@@ -685,7 +841,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
              if (plural)
                retval = plural_lookup (domain, n, retval, retlen);
 
-             __libc_rwlock_unlock (_nl_state_lock);
+             gl_rwlock_unlock (_nl_state_lock);
              return retval;
            }
        }
@@ -694,7 +850,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
  return_untranslated:
   /* Return the untranslated MSGID.  */
   FREE_BLOCKS (block_list);
-  __libc_rwlock_unlock (_nl_state_lock);
+  gl_rwlock_unlock (_nl_state_lock);
 #ifndef _LIBC
   if (!ENABLE_SECURE)
     {
@@ -716,11 +872,24 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
 }
 
 
+/* Look up the translation of msgid within DOMAIN_FILE and DOMAINBINDING.
+   Return it if found.  Return NULL if not found or in case of a conversion
+   failure (problem in the particular message catalog).  Return (char *) -1
+   in case of a memory allocation failure during conversion (only if
+   ENCODING != NULL resp. CONVERT == true).  */
 char *
 internal_function
+#ifdef IN_LIBGLOCALE
 _nl_find_msg (struct loaded_l10nfile *domain_file,
-             struct binding *domainbinding, const char *msgid,
+             struct binding *domainbinding, const char *encoding,
+             const char *msgid,
              size_t *lengthp)
+#else
+_nl_find_msg (struct loaded_l10nfile *domain_file,
+             struct binding *domainbinding,
+             const char *msgid, int convert,
+             size_t *lengthp)
+#endif
 {
   struct loaded_domain *domain;
   nls_uint32 nstrings;
@@ -728,7 +897,7 @@ _nl_find_msg (struct loaded_l10nfile *domain_file,
   char *result;
   size_t resultlen;
 
-  if (domain_file->decided == 0)
+  if (domain_file->decided <= 0)
     _nl_load_domain (domain_file, domainbinding);
 
   if (domain_file->data == NULL)
@@ -743,7 +912,7 @@ _nl_find_msg (struct loaded_l10nfile *domain_file,
     {
       /* Use the hashing table.  */
       nls_uint32 len = strlen (msgid);
-      nls_uint32 hash_val = hash_string (msgid);
+      nls_uint32 hash_val = __hash_string (msgid);
       nls_uint32 idx = hash_val % domain->hash_size;
       nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
 
@@ -826,195 +995,345 @@ _nl_find_msg (struct loaded_l10nfile *domain_file,
     }
 
 #if defined _LIBC || HAVE_ICONV
-  if (domain->codeset_cntr
-      != (domainbinding != NULL ? domainbinding->codeset_cntr : 0))
+# ifdef IN_LIBGLOCALE
+  if (encoding != NULL)
+# else
+  if (convert)
+# endif
     {
-      /* The domain's codeset has changed through bind_textdomain_codeset()
-        since the message catalog was initialized or last accessed.  We
-        have to reinitialize the converter.  */
-      _nl_free_domain_conv (domain);
-      _nl_init_domain_conv (domain_file, domain, domainbinding);
-    }
+      /* We are supposed to do a conversion.  */
+# ifndef IN_LIBGLOCALE
+      const char *encoding = get_output_charset (domainbinding);
+# endif
+
+      /* Search whether a table with converted translations for this
+        encoding has already been allocated.  */
+      size_t nconversions = domain->nconversions;
+      struct converted_domain *convd = NULL;
+      size_t i;
+
+      for (i = nconversions; i > 0; )
+       {
+         i--;
+         if (strcmp (domain->conversions[i].encoding, encoding) == 0)
+           {
+             convd = &domain->conversions[i];
+             break;
+           }
+       }
 
-  if (
+      if (convd == NULL)
+       {
+         /* Allocate a table for the converted translations for this
+            encoding.  */
+         struct converted_domain *new_conversions =
+           (struct converted_domain *)
+           (domain->conversions != NULL
+            ? realloc (domain->conversions,
+                       (nconversions + 1) * sizeof (struct converted_domain))
+            : malloc ((nconversions + 1) * sizeof (struct converted_domain)));
+
+         if (__builtin_expect (new_conversions == NULL, 0))
+           /* Nothing we can do, no more memory.  We cannot use the
+              translation because it might be encoded incorrectly.  */
+           return (char *) -1;
+
+         domain->conversions = new_conversions;
+
+         /* Copy the 'encoding' string to permanent storage.  */
+         encoding = strdup (encoding);
+         if (__builtin_expect (encoding == NULL, 0))
+           /* Nothing we can do, no more memory.  We cannot use the
+              translation because it might be encoded incorrectly.  */
+           return (char *) -1;
+
+         convd = &new_conversions[nconversions];
+         convd->encoding = encoding;
+
+         /* Find out about the character set the file is encoded with.
+            This can be found (in textual form) in the entry "".  If this
+            entry does not exist or if this does not contain the 'charset='
+            information, we will assume the charset matches the one the
+            current locale and we don't have to perform any conversion.  */
 # ifdef _LIBC
-      domain->conv != (__gconv_t) -1
+         convd->conv = (__gconv_t) -1;
 # else
 #  if HAVE_ICONV
-      domain->conv != (iconv_t) -1
+         convd->conv = (iconv_t) -1;
 #  endif
 # endif
-      )
-    {
-      /* We are supposed to do a conversion.  First allocate an
-        appropriate table with the same structure as the table
-        of translations in the file, where we can put the pointers
-        to the converted strings in.
-        There is a slight complication with plural entries.  They
-        are represented by consecutive NUL terminated strings.  We
-        handle this case by converting RESULTLEN bytes, including
-        NULs.  */
-
-      if (domain->conv_tab == NULL
-         && ((domain->conv_tab =
-                (char **) calloc (nstrings + domain->n_sysdep_strings,
-                                  sizeof (char *)))
-             == NULL))
-       /* Mark that we didn't succeed allocating a table.  */
-       domain->conv_tab = (char **) -1;
-
-      if (__builtin_expect (domain->conv_tab == (char **) -1, 0))
-       /* Nothing we can do, no more memory.  */
-       goto converted;
-
-      if (domain->conv_tab[act] == NULL)
+         {
+           char *nullentry;
+           size_t nullentrylen;
+
+           /* Get the header entry.  This is a recursion, but it doesn't
+              reallocate domain->conversions because we pass
+              encoding = NULL or convert = 0, respectively.  */
+           nullentry =
+# ifdef IN_LIBGLOCALE
+             _nl_find_msg (domain_file, domainbinding, NULL, "",
+                           &nullentrylen);
+# else
+             _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
+# endif
+
+           if (nullentry != NULL)
+             {
+               const char *charsetstr;
+
+               charsetstr = strstr (nullentry, "charset=");
+               if (charsetstr != NULL)
+                 {
+                   size_t len;
+                   char *charset;
+                   const char *outcharset;
+
+                   charsetstr += strlen ("charset=");
+                   len = strcspn (charsetstr, " \t\n");
+
+                   charset = (char *) alloca (len + 1);
+# if defined _LIBC || HAVE_MEMPCPY
+                   *((char *) mempcpy (charset, charsetstr, len)) = '\0';
+# else
+                   memcpy (charset, charsetstr, len);
+                   charset[len] = '\0';
+# endif
+
+                   outcharset = encoding;
+
+# ifdef _LIBC
+                   /* We always want to use transliteration.  */
+                   outcharset = norm_add_slashes (outcharset, "TRANSLIT");
+                   charset = norm_add_slashes (charset, "");
+                   int r = __gconv_open (outcharset, charset, &convd->conv,
+                                         GCONV_AVOID_NOCONV);
+                   if (__builtin_expect (r != __GCONV_OK, 0))
+                     {
+                       /* If the output encoding is the same there is
+                          nothing to do.  Otherwise do not use the
+                          translation at all.  */
+                       if (__builtin_expect (r != __GCONV_NOCONV, 1))
+                         return NULL;
+
+                       convd->conv = (__gconv_t) -1;
+                     }
+# else
+#  if HAVE_ICONV
+                   /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5,
+                      we want to use transliteration.  */
+#   if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \
+       || _LIBICONV_VERSION >= 0x0105
+                   if (strchr (outcharset, '/') == NULL)
+                     {
+                       char *tmp;
+
+                       len = strlen (outcharset);
+                       tmp = (char *) alloca (len + 10 + 1);
+                       memcpy (tmp, outcharset, len);
+                       memcpy (tmp + len, "//TRANSLIT", 10 + 1);
+                       outcharset = tmp;
+
+                       convd->conv = iconv_open (outcharset, charset);
+
+                       freea (outcharset);
+                     }
+                   else
+#   endif
+                     convd->conv = iconv_open (outcharset, charset);
+#  endif
+# endif
+
+                   freea (charset);
+                 }
+             }
+         }
+         convd->conv_tab = NULL;
+         /* Here domain->conversions is still == new_conversions.  */
+         domain->nconversions++;
+       }
+
+      if (
+# ifdef _LIBC
+         convd->conv != (__gconv_t) -1
+# else
+#  if HAVE_ICONV
+         convd->conv != (iconv_t) -1
+#  endif
+# endif
+         )
        {
-         /* We haven't used this string so far, so it is not
-            translated yet.  Do this now.  */
-         /* We use a bit more efficient memory handling.
-            We allocate always larger blocks which get used over
-            time.  This is faster than many small allocations.   */
-         __libc_lock_define_initialized (static, lock)
+         /* We are supposed to do a conversion.  First allocate an
+            appropriate table with the same structure as the table
+            of translations in the file, where we can put the pointers
+            to the converted strings in.
+            There is a slight complication with plural entries.  They
+            are represented by consecutive NUL terminated strings.  We
+            handle this case by converting RESULTLEN bytes, including
+            NULs.  */
+
+         if (convd->conv_tab == NULL
+             && ((convd->conv_tab =
+                   (char **) calloc (nstrings + domain->n_sysdep_strings,
+                                     sizeof (char *)))
+                 == NULL))
+           /* Mark that we didn't succeed allocating a table.  */
+           convd->conv_tab = (char **) -1;
+
+         if (__builtin_expect (convd->conv_tab == (char **) -1, 0))
+           /* Nothing we can do, no more memory.  We cannot use the
+              translation because it might be encoded incorrectly.  */
+           return (char *) -1;
+
+         if (convd->conv_tab[act] == NULL)
+           {
+             /* We haven't used this string so far, so it is not
+                translated yet.  Do this now.  */
+             /* We use a bit more efficient memory handling.
+                We allocate always larger blocks which get used over
+                time.  This is faster than many small allocations.   */
+             __libc_lock_define_initialized (static, lock)
 # define INITIAL_BLOCK_SIZE    4080
-         static unsigned char *freemem;
-         static size_t freemem_size;
+             static unsigned char *freemem;
+             static size_t freemem_size;
 
-         const unsigned char *inbuf;
-         unsigned char *outbuf;
-         int malloc_count;
+             const unsigned char *inbuf;
+             unsigned char *outbuf;
+             int malloc_count;
 # ifndef _LIBC
-         transmem_block_t *transmem_list = NULL;
+             transmem_block_t *transmem_list = NULL;
 # endif
 
-         __libc_lock_lock (lock);
+             __libc_lock_lock (lock);
 
-         inbuf = (const unsigned char *) result;
-         outbuf = freemem + sizeof (size_t);
+             inbuf = (const unsigned char *) result;
+             outbuf = freemem + sizeof (size_t);
 
-         malloc_count = 0;
-         while (1)
-           {
-             transmem_block_t *newmem;
+             malloc_count = 0;
+             while (1)
+               {
+                 transmem_block_t *newmem;
 # ifdef _LIBC
-             size_t non_reversible;
-             int res;
+                 size_t non_reversible;
+                 int res;
 
-             if (freemem_size < sizeof (size_t))
-               goto resize_freemem;
+                 if (freemem_size < sizeof (size_t))
+                   goto resize_freemem;
 
-             res = __gconv (domain->conv,
-                            &inbuf, inbuf + resultlen,
-                            &outbuf,
-                            outbuf + freemem_size - sizeof (size_t),
-                            &non_reversible);
+                 res = __gconv (convd->conv,
+                                &inbuf, inbuf + resultlen,
+                                &outbuf,
+                                outbuf + freemem_size - sizeof (size_t),
+                                &non_reversible);
 
-             if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT)
-               break;
+                 if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT)
+                   break;
 
-             if (res != __GCONV_FULL_OUTPUT)
-               {
-                 __libc_lock_unlock (lock);
-                 goto converted;
-               }
+                 if (res != __GCONV_FULL_OUTPUT)
+                   {
+                     /* We should not use the translation at all, it
+                        is incorrectly encoded.  */
+                     __libc_lock_unlock (lock);
+                     return NULL;
+                   }
 
-             inbuf = result;
+                 inbuf = (const unsigned char *) result;
 # else
 #  if HAVE_ICONV
-             const char *inptr = (const char *) inbuf;
-             size_t inleft = resultlen;
-             char *outptr = (char *) outbuf;
-             size_t outleft;
-
-             if (freemem_size < sizeof (size_t))
-               goto resize_freemem;
-
-             outleft = freemem_size - sizeof (size_t);
-             if (iconv (domain->conv,
-                        (const char **) &inptr, &inleft,
-                        &outptr, &outleft)
-                 != (size_t) (-1))
-               {
-                 outbuf = (unsigned char *) outptr;
-                 break;
-               }
-             if (errno != E2BIG)
-               {
-                 __libc_lock_unlock (lock);
-                 goto converted;
-               }
+                 const char *inptr = (const char *) inbuf;
+                 size_t inleft = resultlen;
+                 char *outptr = (char *) outbuf;
+                 size_t outleft;
+
+                 if (freemem_size < sizeof (size_t))
+                   goto resize_freemem;
+
+                 outleft = freemem_size - sizeof (size_t);
+                 if (iconv (convd->conv,
+                            (ICONV_CONST char **) &inptr, &inleft,
+                            &outptr, &outleft)
+                     != (size_t) (-1))
+                   {
+                     outbuf = (unsigned char *) outptr;
+                     break;
+                   }
+                 if (errno != E2BIG)
+                   {
+                     __libc_lock_unlock (lock);
+                     return NULL;
+                   }
 #  endif
 # endif
 
-           resize_freemem:
-             /* We must allocate a new buffer or resize the old one.  */
-             if (malloc_count > 0)
-               {
-                 ++malloc_count;
-                 freemem_size = malloc_count * INITIAL_BLOCK_SIZE;
-                 newmem = (transmem_block_t *) realloc (transmem_list,
-                                                        freemem_size);
+               resize_freemem:
+                 /* We must allocate a new buffer or resize the old one.  */
+                 if (malloc_count > 0)
+                   {
+                     ++malloc_count;
+                     freemem_size = malloc_count * INITIAL_BLOCK_SIZE;
+                     newmem = (transmem_block_t *) realloc (transmem_list,
+                                                            freemem_size);
 # ifdef _LIBC
-                 if (newmem != NULL)
-                   transmem_list = transmem_list->next;
+                     if (newmem != NULL)
+                       transmem_list = transmem_list->next;
+                     else
+                       {
+                         struct transmem_list *old = transmem_list;
+
+                         transmem_list = transmem_list->next;
+                         free (old);
+                       }
+# endif
+                   }
                  else
                    {
-                     struct transmem_list *old = transmem_list;
-
-                     transmem_list = transmem_list->next;
-                     free (old);
+                     malloc_count = 1;
+                     freemem_size = INITIAL_BLOCK_SIZE;
+                     newmem = (transmem_block_t *) malloc (freemem_size);
+                   }
+                 if (__builtin_expect (newmem == NULL, 0))
+                   {
+                     freemem = NULL;
+                     freemem_size = 0;
+                     __libc_lock_unlock (lock);
+                     return (char *) -1;
                    }
-# endif
-               }
-             else
-               {
-                 malloc_count = 1;
-                 freemem_size = INITIAL_BLOCK_SIZE;
-                 newmem = (transmem_block_t *) malloc (freemem_size);
-               }
-             if (__builtin_expect (newmem == NULL, 0))
-               {
-                 freemem = NULL;
-                 freemem_size = 0;
-                 __libc_lock_unlock (lock);
-                 goto converted;
-               }
 
 # ifdef _LIBC
-             /* Add the block to the list of blocks we have to free
-                 at some point.  */
-             newmem->next = transmem_list;
-             transmem_list = newmem;
+                 /* Add the block to the list of blocks we have to free
+                    at some point.  */
+                 newmem->next = transmem_list;
+                 transmem_list = newmem;
 
-             freemem = newmem->data;
-             freemem_size -= offsetof (struct transmem_list, data);
+                 freemem = (unsigned char *) newmem->data;
+                 freemem_size -= offsetof (struct transmem_list, data);
 # else
-             transmem_list = newmem;
-             freemem = newmem;
+                 transmem_list = newmem;
+                 freemem = newmem;
 # endif
 
-             outbuf = freemem + sizeof (size_t);
+                 outbuf = freemem + sizeof (size_t);
+               }
+
+             /* We have now in our buffer a converted string.  Put this
+                into the table of conversions.  */
+             *(size_t *) freemem = outbuf - freemem - sizeof (size_t);
+             convd->conv_tab[act] = (char *) freemem;
+             /* Shrink freemem, but keep it aligned.  */
+             freemem_size -= outbuf - freemem;
+             freemem = outbuf;
+             freemem += freemem_size & (alignof (size_t) - 1);
+             freemem_size = freemem_size & ~ (alignof (size_t) - 1);
+
+             __libc_lock_unlock (lock);
            }
 
-         /* We have now in our buffer a converted string.  Put this
-            into the table of conversions.  */
-         *(size_t *) freemem = outbuf - freemem - sizeof (size_t);
-         domain->conv_tab[act] = (char *) freemem;
-         /* Shrink freemem, but keep it aligned.  */
-         freemem_size -= outbuf - freemem;
-         freemem = outbuf;
-         freemem += freemem_size & (alignof (size_t) - 1);
-         freemem_size = freemem_size & ~ (alignof (size_t) - 1);
-
-         __libc_lock_unlock (lock);
+         /* Now convd->conv_tab[act] contains the translation of all
+            the plural variants.  */
+         result = convd->conv_tab[act] + sizeof (size_t);
+         resultlen = *(size_t *) convd->conv_tab[act];
        }
-
-      /* Now domain->conv_tab[act] contains the translation of all
-        the plural variants.  */
-      result = domain->conv_tab[act] + sizeof (size_t);
-      resultlen = *(size_t *) domain->conv_tab[act];
     }
 
- converted:
   /* The result string is converted.  */
 
 #endif /* _LIBC || HAVE_ICONV */
@@ -1126,13 +1445,21 @@ category_to_name (int category)
    or system-dependent defaults.  */
 static const char *
 internal_function
+#ifdef IN_LIBGLOCALE
+guess_category_value (int category, const char *categoryname,
+                     const char *locale)
+
+#else
 guess_category_value (int category, const char *categoryname)
+#endif
 {
   const char *language;
+#ifndef IN_LIBGLOCALE
   const char *locale;
-#ifndef _LIBC
+# ifndef _LIBC
   const char *language_default;
   int locale_defaulted;
+# endif
 #endif
 
   /* We use the settings in the following order:
@@ -1149,19 +1476,34 @@ guess_category_value (int category, const char *categoryname)
        - If the system provides both a list of languages and a default locale,
          the former is used.  */
 
+#ifndef IN_LIBGLOCALE
   /* Fetch the locale name, through the POSIX method of looking to `LC_ALL',
      `LC_xxx', and `LANG'.  On some systems this can be done by the
      `setlocale' function itself.  */
-#ifdef _LIBC
+# ifdef _LIBC
   locale = __current_locale_name (category);
-#else
-  locale = _nl_locale_name_posix (category, categoryname);
-  locale_defaulted = 0;
-  if (locale == NULL)
+# else
+#  if HAVE_STRUCT___LOCALE_STRUCT___NAMES && defined USE_IN_GETTEXT_TESTS
+  /* The __names field is not public glibc API and must therefore not be used
+     in code that is installed in public locations.  */
+  locale_t thread_locale = uselocale (NULL);
+  if (thread_locale != LC_GLOBAL_LOCALE)
+    {
+      locale = thread_locale->__names[category];
+      locale_defaulted = 0;
+    }
+  else
+#  endif
     {
-      locale = _nl_locale_name_default ();
-      locale_defaulted = 1;
+      locale = _nl_locale_name_posix (category, categoryname);
+      locale_defaulted = 0;
+      if (locale == NULL)
+       {
+         locale = _nl_locale_name_default ();
+         locale_defaulted = 1;
+       }
     }
+# endif
 #endif
 
   /* Ignore LANGUAGE and its system-dependent analogon if the locale is set
@@ -1183,7 +1525,7 @@ guess_category_value (int category, const char *categoryname)
   language = getenv ("LANGUAGE");
   if (language != NULL && language[0] != '\0')
     return language;
-#ifndef _LIBC
+#if !defined IN_LIBGLOCALE && !defined _LIBC
   /* The next priority value is the locale name, if not defaulted.  */
   if (locale_defaulted)
     {
@@ -1197,6 +1539,60 @@ guess_category_value (int category, const char *categoryname)
   return locale;
 }
 
+#if (defined _LIBC || HAVE_ICONV) && !defined IN_LIBGLOCALE
+/* Returns the output charset.  */
+static const char *
+internal_function
+get_output_charset (struct binding *domainbinding)
+{
+  /* The output charset should normally be determined by the locale.  But
+     sometimes the locale is not used or not correctly set up, so we provide
+     a possibility for the user to override this: the OUTPUT_CHARSET
+     environment variable.  Moreover, the value specified through
+     bind_textdomain_codeset overrides both.  */
+  if (domainbinding != NULL && domainbinding->codeset != NULL)
+    return domainbinding->codeset;
+  else
+    {
+      /* For speed reasons, we look at the value of OUTPUT_CHARSET only
+        once.  This is a user variable that is not supposed to change
+        during a program run.  */
+      static char *output_charset_cache;
+      static int output_charset_cached;
+
+      if (!output_charset_cached)
+       {
+         const char *value = getenv ("OUTPUT_CHARSET");
+
+         if (value != NULL && value[0] != '\0')
+           {
+             size_t len = strlen (value) + 1;
+             char *value_copy = (char *) malloc (len);
+
+             if (value_copy != NULL)
+               memcpy (value_copy, value, len);
+             output_charset_cache = value_copy;
+           }
+         output_charset_cached = 1;
+       }
+
+      if (output_charset_cache != NULL)
+       return output_charset_cache;
+      else
+       {
+# ifdef _LIBC
+         return _NL_CURRENT (LC_CTYPE, CODESET);
+# else
+#  if HAVE_ICONV
+         extern const char *locale_charset (void);
+         return locale_charset ();
+#  endif
+# endif
+       }
+    }
+}
+#endif
+
 /* @@ begin of epilog @@ */
 
 /* We don't want libintl.a to depend on any other library.  So we
@@ -1233,7 +1629,7 @@ libc_freeres_fn (free_mem)
     {
       struct binding *oldp = _nl_domain_bindings;
       _nl_domain_bindings = _nl_domain_bindings->next;
-      if (oldp->dirname != INTUSE(_nl_default_dirname))
+      if (oldp->dirname != _nl_default_dirname)
        /* Yes, this is a pointer comparison.  */
        free (oldp->dirname);
       free (oldp->codeset);
index 1361418..8d3e146 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1998, 2000-2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1998, 2000-2001, 2003, 2005 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
    This program is free software; you can redistribute it and/or modify it
 
 /* @@ end of prolog @@ */
 
-char *
+/* Split a locale name NAME into a leading language part and all the
+   rest.  Return a pointer to the first character after the language,
+   i.e. to the first byte of the rest.  */
+static char *_nl_find_language (const char *name);
+
+static char *
 _nl_find_language (const char *name)
 {
-  while (name[0] != '\0' && name[0] != '_' && name[0] != '@'
-        && name[0] != '+' && name[0] != ',')
+  while (name[0] != '\0' && name[0] != '_' && name[0] != '@' && name[0] != '.')
     ++name;
 
   return (char *) name;
@@ -52,10 +56,8 @@ int
 _nl_explode_name (char *name,
                  const char **language, const char **modifier,
                  const char **territory, const char **codeset,
-                 const char **normalized_codeset, const char **special,
-                 const char **sponsor, const char **revision)
+                 const char **normalized_codeset)
 {
-  enum { undecided, xpg, cen } syntax;
   char *cp;
   int mask;
 
@@ -63,15 +65,10 @@ _nl_explode_name (char *name,
   *territory = NULL;
   *codeset = NULL;
   *normalized_codeset = NULL;
-  *special = NULL;
-  *sponsor = NULL;
-  *revision = NULL;
 
   /* Now we determine the single parts of the locale name.  First
-     look for the language.  Termination symbols are `_' and `@' if
-     we use XPG4 style, and `_', `+', and `,' if we use CEN syntax.  */
+     look for the language.  Termination symbols are `_', '.', and `@'.  */
   mask = 0;
-  syntax = undecided;
   *language = cp = name;
   cp = _nl_find_language (*language);
 
@@ -79,22 +76,23 @@ _nl_explode_name (char *name,
     /* This does not make sense: language has to be specified.  Use
        this entry as it is without exploding.  Perhaps it is an alias.  */
     cp = strchr (*language, '\0');
-  else if (cp[0] == '_')
+  else
     {
-      /* Next is the territory.  */
-      cp[0] = '\0';
-      *territory = ++cp;
+      if (cp[0] == '_')
+       {
+         /* Next is the territory.  */
+         cp[0] = '\0';
+         *territory = ++cp;
 
-      while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@'
-            && cp[0] != '+' && cp[0] != ',' && cp[0] != '_')
-       ++cp;
+         while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@')
+           ++cp;
 
-      mask |= TERRITORY;
+         mask |= XPG_TERRITORY;
+       }
 
       if (cp[0] == '.')
        {
          /* Next is the codeset.  */
-         syntax = xpg;
          cp[0] = '\0';
          *codeset = ++cp;
 
@@ -115,71 +113,21 @@ _nl_explode_name (char *name,
        }
     }
 
-  if (cp[0] == '@' || (syntax != xpg && cp[0] == '+'))
+  if (cp[0] == '@')
     {
       /* Next is the modifier.  */
-      syntax = cp[0] == '@' ? xpg : cen;
       cp[0] = '\0';
       *modifier = ++cp;
 
-      while (syntax == cen && cp[0] != '\0' && cp[0] != '+'
-            && cp[0] != ',' && cp[0] != '_')
-       ++cp;
-
-      mask |= XPG_MODIFIER | CEN_AUDIENCE;
-    }
-
-  if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_'))
-    {
-      syntax = cen;
-
-      if (cp[0] == '+')
-       {
-         /* Next is special application (CEN syntax).  */
-         cp[0] = '\0';
-         *special = ++cp;
-
-         while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_')
-           ++cp;
-
-         mask |= CEN_SPECIAL;
-       }
-
-      if (cp[0] == ',')
-       {
-         /* Next is sponsor (CEN syntax).  */
-         cp[0] = '\0';
-         *sponsor = ++cp;
-
-         while (cp[0] != '\0' && cp[0] != '_')
-           ++cp;
-
-         mask |= CEN_SPONSOR;
-       }
-
-      if (cp[0] == '_')
-       {
-         /* Next is revision (CEN syntax).  */
-         cp[0] = '\0';
-         *revision = ++cp;
-
-         mask |= CEN_REVISION;
-       }
+      if (cp[0] != '\0')
+       mask |= XPG_MODIFIER;
     }
 
-  /* For CEN syntax values it might be important to have the
-     separator character in the file name, not for XPG syntax.  */
-  if (syntax == xpg)
-    {
-      if (*territory != NULL && (*territory)[0] == '\0')
-       mask &= ~TERRITORY;
-
-      if (*codeset != NULL && (*codeset)[0] == '\0')
-       mask &= ~XPG_CODESET;
+  if (*territory != NULL && (*territory)[0] == '\0')
+    mask &= ~XPG_TERRITORY;
 
-      if (*modifier != NULL && (*modifier)[0] == '\0')
-       mask &= ~XPG_MODIFIER;
-    }
+  if (*codeset != NULL && (*codeset)[0] == '\0')
+    mask &= ~XPG_CODESET;
 
   return mask;
 }
diff --git a/intl/export.h b/intl/export.h
new file mode 100644 (file)
index 0000000..b5c47ad
--- /dev/null
@@ -0,0 +1,6 @@
+
+#if @HAVE_VISIBILITY@ && BUILDING_LIBINTL
+#define LIBINTL_DLL_EXPORTED __attribute__((__visibility__("default")))
+#else
+#define LIBINTL_DLL_EXPORTED
+#endif
index 498f858..a25bebc 100644 (file)
@@ -1,5 +1,5 @@
 /* Handle list of needed message catalogs
-   Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000-2001, 2003-2006 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@gnu.org>, 1995.
 
    This program is free software; you can redistribute it and/or modify it
 # include "libgnuintl.h"
 #endif
 
+/* Handle multi-threaded applications.  */
+#ifdef _LIBC
+# include <bits/libc-lock.h>
+# define gl_rwlock_define_initialized __libc_rwlock_define_initialized
+# define gl_rwlock_rdlock __libc_rwlock_rdlock
+# define gl_rwlock_wrlock __libc_rwlock_wrlock
+# define gl_rwlock_unlock __libc_rwlock_unlock
+#else
+# include "lock.h"
+#endif
+
 /* @@ end of prolog @@ */
 /* List of already loaded domains.  */
 static struct loaded_l10nfile *_nl_loaded_domains;
@@ -56,44 +67,41 @@ _nl_find_domain (const char *dirname, char *locale,
   const char *territory;
   const char *codeset;
   const char *normalized_codeset;
-  const char *special;
-  const char *sponsor;
-  const char *revision;
   const char *alias_value;
   int mask;
 
   /* LOCALE can consist of up to four recognized parts for the XPG syntax:
 
-               language[_territory[.codeset]][@modifier]
-
-     and six parts for the CEN syntax:
-
-       language[_territory][+audience][+special][,[sponsor][_revision]]
+               language[_territory][.codeset][@modifier]
 
      Beside the first part all of them are allowed to be missing.  If
      the full specified locale is not found, the less specific one are
      looked for.  The various parts will be stripped off according to
      the following order:
-               (1) revision
-               (2) sponsor
-               (3) special
-               (4) codeset
-               (5) normalized codeset
-               (6) territory
-               (7) audience/modifier
+               (1) codeset
+               (2) normalized codeset
+               (3) territory
+               (4) modifier
    */
 
+  /* We need to protect modifying the _NL_LOADED_DOMAINS data.  */
+  gl_rwlock_define_initialized (static, lock);
+  gl_rwlock_rdlock (lock);
+
   /* If we have already tested for this locale entry there has to
      be one data set in the list of loaded domains.  */
   retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
                               strlen (dirname) + 1, 0, locale, NULL, NULL,
-                              NULL, NULL, NULL, NULL, NULL, domainname, 0);
+                              NULL, NULL, domainname, 0);
+
+  gl_rwlock_unlock (lock);
+
   if (retval != NULL)
     {
       /* We know something about this locale.  */
       int cnt;
 
-      if (retval->decided == 0)
+      if (retval->decided <= 0)
        _nl_load_domain (retval, domainbinding);
 
       if (retval->data != NULL)
@@ -101,13 +109,14 @@ _nl_find_domain (const char *dirname, char *locale,
 
       for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
        {
-         if (retval->successor[cnt]->decided == 0)
+         if (retval->successor[cnt]->decided <= 0)
            _nl_load_domain (retval->successor[cnt], domainbinding);
 
          if (retval->successor[cnt]->data != NULL)
            break;
        }
-      return cnt >= 0 ? retval : NULL;
+
+      return retval;
       /* NOTREACHED */
     }
 
@@ -132,30 +141,34 @@ _nl_find_domain (const char *dirname, char *locale,
     }
 
   /* Now we determine the single parts of the locale name.  First
-     look for the language.  Termination symbols are `_' and `@' if
-     we use XPG4 style, and `_', `+', and `,' if we use CEN syntax.  */
+     look for the language.  Termination symbols are `_', '.', and `@'.  */
   mask = _nl_explode_name (locale, &language, &modifier, &territory,
-                          &codeset, &normalized_codeset, &special,
-                          &sponsor, &revision);
+                          &codeset, &normalized_codeset);
+
+  /* We need to protect modifying the _NL_LOADED_DOMAINS data.  */
+  gl_rwlock_wrlock (lock);
 
   /* Create all possible locale entries which might be interested in
      generalization.  */
   retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
                               strlen (dirname) + 1, mask, language, territory,
-                              codeset, normalized_codeset, modifier, special,
-                              sponsor, revision, domainname, 1);
+                              codeset, normalized_codeset, modifier,
+                              domainname, 1);
+
+  gl_rwlock_unlock (lock);
+
   if (retval == NULL)
     /* This means we are out of core.  */
     return NULL;
 
-  if (retval->decided == 0)
+  if (retval->decided <= 0)
     _nl_load_domain (retval, domainbinding);
   if (retval->data == NULL)
     {
       int cnt;
       for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
        {
-         if (retval->successor[cnt]->decided == 0)
+         if (retval->successor[cnt]->decided <= 0)
            _nl_load_domain (retval->successor[cnt], domainbinding);
          if (retval->successor[cnt]->data != NULL)
            break;
@@ -175,7 +188,10 @@ _nl_find_domain (const char *dirname, char *locale,
 
 
 #ifdef _LIBC
-libc_freeres_fn (free_mem)
+/* This is called from iconv/gconv_db.c's free_mem, as locales must
+   be freed before freeing gconv steps arrays.  */
+void __libc_freeres_fn_section
+_nl_finddomain_subfreeres ()
 {
   struct loaded_l10nfile *runp = _nl_loaded_domains;
 
index 0816bfb..8be38d2 100644 (file)
 # endif
 #endif
 
+#ifdef _LIBC
+extern char *__gettext (const char *__msgid);
+extern char *__dgettext (const char *__domainname, const char *__msgid);
+extern char *__dcgettext (const char *__domainname, const char *__msgid,
+                         int __category);
+extern char *__ngettext (const char *__msgid1, const char *__msgid2,
+                        unsigned long int __n);
+extern char *__dngettext (const char *__domainname,
+                         const char *__msgid1, const char *__msgid2,
+                         unsigned long int n);
+extern char *__dcngettext (const char *__domainname,
+                          const char *__msgid1, const char *__msgid2,
+                          unsigned long int __n, int __category);
+extern char *__dcigettext (const char *__domainname,
+                          const char *__msgid1, const char *__msgid2,
+                          int __plural, unsigned long int __n,
+                          int __category);
+extern char *__textdomain (const char *__domainname);
+extern char *__bindtextdomain (const char *__domainname,
+                              const char *__dirname);
+extern char *__bind_textdomain_codeset (const char *__domainname,
+                                       const char *__codeset);
+extern void _nl_finddomain_subfreeres (void) attribute_hidden;
+extern void _nl_unload_domain (struct loaded_domain *__domain)
+     internal_function attribute_hidden;
+#else
+/* Declare the exported libintl_* functions, in a way that allows us to
+   call them under their real name.  */
+# undef _INTL_REDIRECT_INLINE
+# undef _INTL_REDIRECT_MACROS
+# define _INTL_REDIRECT_MACROS
+# include "libgnuintl.h"
+# ifdef IN_LIBGLOCALE
+extern char *gl_dcigettext (const char *__domainname,
+                           const char *__msgid1, const char *__msgid2,
+                           int __plural, unsigned long int __n,
+                           int __category,
+                           const char *__localename, const char *__encoding);
+# else
+extern char *libintl_dcigettext (const char *__domainname,
+                                const char *__msgid1, const char *__msgid2,
+                                int __plural, unsigned long int __n,
+                                int __category);
+# endif
+#endif
+
 #include "loadinfo.h"
 
 #include "gmo.h"               /* Get nls_uint32.  */
@@ -77,6 +123,26 @@ struct sysdep_string_desc
   const char *pointer;
 };
 
+/* Cache of translated strings after charset conversion.
+   Note: The strings are converted to the target encoding only on an as-needed
+   basis.  */
+struct converted_domain
+{
+  /* The target encoding name.  */
+  const char *encoding;
+  /* The descriptor for conversion from the message catalog's encoding to
+     this target encoding.  */
+#ifdef _LIBC
+  __gconv_t conv;
+#else
+# if HAVE_ICONV
+  iconv_t conv;
+# endif
+#endif
+  /* The table of translated strings after charset conversion.  */
+  char **conv_tab;
+};
+
 /* The representation of an opened message catalog.  */
 struct loaded_domain
 {
@@ -112,15 +178,9 @@ struct loaded_domain
   /* 1 if the hash table uses a different endianness than this machine.  */
   int must_swap_hash_tab;
 
-  int codeset_cntr;
-#ifdef _LIBC
-  __gconv_t conv;
-#else
-# if HAVE_ICONV
-  iconv_t conv;
-# endif
-#endif
-  char **conv_tab;
+  /* Cache of charset conversions of the translated strings.  */
+  struct converted_domain *conversions;
+  size_t nconversions;
 
   struct expression *plural;
   unsigned long int nplurals;
@@ -140,7 +200,6 @@ struct binding
 {
   struct binding *next;
   char *dirname;
-  int codeset_cntr;    /* Incremented each time codeset changes.  */
   char *codeset;
   char domainname[ZERO];
 };
@@ -148,7 +207,12 @@ struct binding
 /* A counter which is incremented each time some previous translations
    become invalid.
    This variable is part of the external ABI of the GNU libintl.  */
-extern int _nl_msg_cat_cntr;
+#ifdef IN_LIBGLOCALE
+# include <glocale/config.h>
+extern LIBGLOCALE_DLL_EXPORTED int _nl_msg_cat_cntr;
+#else
+extern LIBINTL_DLL_EXPORTED int _nl_msg_cat_cntr;
+#endif
 
 #ifndef _LIBC
 const char *_nl_language_preferences_default (void);
@@ -164,53 +228,18 @@ struct loaded_l10nfile *_nl_find_domain (const char *__dirname, char *__locale,
 void _nl_load_domain (struct loaded_l10nfile *__domain,
                      struct binding *__domainbinding)
      internal_function;
-void _nl_unload_domain (struct loaded_domain *__domain)
-     internal_function;
-const char *_nl_init_domain_conv (struct loaded_l10nfile *__domain_file,
-                                 struct loaded_domain *__domain,
-                                 struct binding *__domainbinding)
-     internal_function;
-void _nl_free_domain_conv (struct loaded_domain *__domain)
-     internal_function;
 
+#ifdef IN_LIBGLOCALE
 char *_nl_find_msg (struct loaded_l10nfile *domain_file,
-                   struct binding *domainbinding, const char *msgid,
+                   struct binding *domainbinding, const char *encoding,
+                   const char *msgid,
                    size_t *lengthp)
      internal_function;
-
-#ifdef _LIBC
-extern char *__gettext (const char *__msgid);
-extern char *__dgettext (const char *__domainname, const char *__msgid);
-extern char *__dcgettext (const char *__domainname, const char *__msgid,
-                         int __category);
-extern char *__ngettext (const char *__msgid1, const char *__msgid2,
-                        unsigned long int __n);
-extern char *__dngettext (const char *__domainname,
-                         const char *__msgid1, const char *__msgid2,
-                         unsigned long int n);
-extern char *__dcngettext (const char *__domainname,
-                          const char *__msgid1, const char *__msgid2,
-                          unsigned long int __n, int __category);
-extern char *__dcigettext (const char *__domainname,
-                          const char *__msgid1, const char *__msgid2,
-                          int __plural, unsigned long int __n,
-                          int __category);
-extern char *__textdomain (const char *__domainname);
-extern char *__bindtextdomain (const char *__domainname,
-                              const char *__dirname);
-extern char *__bind_textdomain_codeset (const char *__domainname,
-                                       const char *__codeset);
 #else
-/* Declare the exported libintl_* functions, in a way that allows us to
-   call them under their real name.  */
-# undef _INTL_REDIRECT_INLINE
-# undef _INTL_REDIRECT_MACROS
-# define _INTL_REDIRECT_MACROS
-# include "libgnuintl.h"
-extern char *libintl_dcigettext (const char *__domainname,
-                                const char *__msgid1, const char *__msgid2,
-                                int __plural, unsigned long int __n,
-                                int __category);
+char *_nl_find_msg (struct loaded_l10nfile *domain_file,
+                   struct binding *domainbinding, const char *msgid,
+                   int convert, size_t *lengthp)
+     internal_function;
 #endif
 
 /* @@ begin of epilog @@ */
diff --git a/intl/hash-string.c b/intl/hash-string.c
new file mode 100644 (file)
index 0000000..3c513f0
--- /dev/null
@@ -0,0 +1,51 @@
+/* Implements a string hashing function.
+   Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Specification.  */
+#include "hash-string.h"
+
+
+/* Defines the so called `hashpjw' function by P.J. Weinberger
+   [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
+   1986, 1987 Bell Telephone Laboratories, Inc.]  */
+unsigned long int
+__hash_string (const char *str_param)
+{
+  unsigned long int hval, g;
+  const char *str = str_param;
+
+  /* Compute the hash value for the given string.  */
+  hval = 0;
+  while (*str != '\0')
+    {
+      hval <<= 4;
+      hval += (unsigned char) *str++;
+      g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
+      if (g != 0)
+       {
+         hval ^= g >> (HASHWORDBITS - 8);
+         hval ^= g;
+       }
+    }
+  return hval;
+}
index 2c9a3a5..98c07e4 100644 (file)
@@ -1,5 +1,5 @@
 /* Description of GNU message catalog format: string hashing function.
-   Copyright (C) 1995, 1997-1998, 2000-2003 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1997-1998, 2000-2003, 2005 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
 #define HASHWORDBITS 32
 
 
+#ifndef _LIBC
+# ifdef IN_LIBINTL
+#  define __hash_string libintl_hash_string
+# else
+#  define __hash_string hash_string
+# endif
+#endif
+
 /* Defines the so called `hashpjw' function by P.J. Weinberger
    [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
    1986, 1987 Bell Telephone Laboratories, Inc.]  */
-static inline unsigned long int
-hash_string (const char *str_param)
-{
-  unsigned long int hval, g;
-  const char *str = str_param;
-
-  /* Compute the hash value for the given string.  */
-  hval = 0;
-  while (*str != '\0')
-    {
-      hval <<= 4;
-      hval += (unsigned char) *str++;
-      g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
-      if (g != 0)
-       {
-         hval ^= g >> (HASHWORDBITS - 8);
-         hval ^= g;
-       }
-    }
-  return hval;
-}
+extern unsigned long int __hash_string (const char *str_param);
index 15be09c..9b9ecbb 100644 (file)
@@ -1,6 +1,6 @@
 /* intl-compat.c - Stub functions to call gettext functions from GNU gettext
    Library.
-   Copyright (C) 1995, 2000-2003 Software Foundation, Inc.
+   Copyright (C) 1995, 2000-2003, 2005 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
@@ -49,7 +49,9 @@
 /* When building a DLL, we must export some functions.  Note that because
    the functions are only defined for binary backward compatibility, we
    don't need to use __declspec(dllimport) in any case.  */
-#if defined _MSC_VER && BUILDING_DLL
+#if HAVE_VISIBILITY && BUILDING_DLL
+# define DLL_EXPORTED __attribute__((__visibility__("default")))
+#elif defined _MSC_VER && BUILDING_DLL
 # define DLL_EXPORTED __declspec(dllexport)
 #else
 # define DLL_EXPORTED
diff --git a/intl/intl-exports.c b/intl/intl-exports.c
new file mode 100644 (file)
index 0000000..7176589
--- /dev/null
@@ -0,0 +1,36 @@
+/* List of exported symbols of libintl on Cygwin.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2006.
+
+   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
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+ /* IMP(x) is a symbol that contains the address of x.  */
+#define IMP(x) _imp__##x
+
+ /* Ensure that the variable x is exported from the library, and that a
+    pseudo-variable IMP(x) is available.  */
+#define VARIABLE(x) \
+ /* Export x without redefining x.  This code was found by compiling a \
+    snippet:                                                           \
+      extern __declspec(dllexport) int x; int x = 42;  */              \
+ asm (".section .drectve\n");                                          \
+ asm (".ascii \" -export:" #x ",data\"\n");                            \
+ asm (".data\n");                                                      \
+ /* Allocate a pseudo-variable IMP(x).  */                             \
+ extern int x;                                                         \
+ void * IMP(x) = &x;
+
+VARIABLE(libintl_version)
index 0501b97..365aeb7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999, 2000-2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000-2006 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
    This program is free software; you can redistribute it and/or modify it
@@ -82,7 +82,12 @@ static char *stpcpy (char *dest, const char *src);
 
 /* Define function which are usually not available.  */
 
-#if !defined _LIBC && !defined HAVE___ARGZ_COUNT
+#ifdef _LIBC
+# define __argz_count(argz, len) INTUSE(__argz_count) (argz, len)
+#elif defined HAVE_ARGZ_COUNT
+# undef __argz_count
+# define __argz_count argz_count
+#else
 /* Returns the number of strings in ARGZ.  */
 static size_t
 argz_count__ (const char *argz, size_t len)
@@ -99,13 +104,15 @@ argz_count__ (const char *argz, size_t len)
 }
 # undef __argz_count
 # define __argz_count(argz, len) argz_count__ (argz, len)
-#else
-# ifdef _LIBC
-#  define __argz_count(argz, len) INTUSE(__argz_count) (argz, len)
-# endif
-#endif /* !_LIBC && !HAVE___ARGZ_COUNT */
+#endif /* !_LIBC && !HAVE_ARGZ_COUNT */
 
-#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY
+#ifdef _LIBC
+# define __argz_stringify(argz, len, sep) \
+  INTUSE(__argz_stringify) (argz, len, sep)
+#elif defined HAVE_ARGZ_STRINGIFY
+# undef __argz_stringify
+# define __argz_stringify argz_stringify
+#else
 /* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
    except the last into the character SEP.  */
 static void
@@ -122,14 +129,13 @@ argz_stringify__ (char *argz, size_t len, int sep)
 }
 # undef __argz_stringify
 # define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
-#else
-# ifdef _LIBC
-#  define __argz_stringify(argz, len, sep) \
-  INTUSE(__argz_stringify) (argz, len, sep)
-# endif
-#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */
+#endif /* !_LIBC && !HAVE_ARGZ_STRINGIFY */
 
-#if !defined _LIBC && !defined HAVE___ARGZ_NEXT
+#ifdef _LIBC
+#elif defined HAVE_ARGZ_NEXT
+# undef __argz_next
+# define __argz_next argz_next
+#else
 static char *
 argz_next__ (char *argz, size_t argz_len, const char *entry)
 {
@@ -148,7 +154,7 @@ argz_next__ (char *argz, size_t argz_len, const char *entry)
 }
 # undef __argz_next
 # define __argz_next(argz, len, entry) argz_next__ (argz, len, entry)
-#endif /* !_LIBC && !HAVE___ARGZ_NEXT */
+#endif /* !_LIBC && !HAVE_ARGZ_NEXT */
 
 
 /* Return number of bits set in X.  */
@@ -170,8 +176,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
                    const char *dirlist, size_t dirlist_len,
                    int mask, const char *language, const char *territory,
                    const char *codeset, const char *normalized_codeset,
-                   const char *modifier, const char *special,
-                   const char *sponsor, const char *revision,
+                   const char *modifier,
                    const char *filename, int do_allocate)
 {
   char *abs_filename;
@@ -190,23 +195,14 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
   /* Allocate room for the full file name.  */
   abs_filename = (char *) malloc (dirlist_len
                                  + strlen (language)
-                                 + ((mask & TERRITORY) != 0
+                                 + ((mask & XPG_TERRITORY) != 0
                                     ? strlen (territory) + 1 : 0)
                                  + ((mask & XPG_CODESET) != 0
                                     ? strlen (codeset) + 1 : 0)
                                  + ((mask & XPG_NORM_CODESET) != 0
                                     ? strlen (normalized_codeset) + 1 : 0)
-                                 + (((mask & XPG_MODIFIER) != 0
-                                     || (mask & CEN_AUDIENCE) != 0)
+                                 + ((mask & XPG_MODIFIER) != 0
                                     ? strlen (modifier) + 1 : 0)
-                                 + ((mask & CEN_SPECIAL) != 0
-                                    ? strlen (special) + 1 : 0)
-                                 + (((mask & CEN_SPONSOR) != 0
-                                     || (mask & CEN_REVISION) != 0)
-                                    ? (1 + ((mask & CEN_SPONSOR) != 0
-                                            ? strlen (sponsor) : 0)
-                                       + ((mask & CEN_REVISION) != 0
-                                          ? strlen (revision) + 1 : 0)) : 0)
                                  + 1 + strlen (filename) + 1);
 
   if (abs_filename == NULL)
@@ -224,7 +220,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
 
   cp = stpcpy (cp, language);
 
-  if ((mask & TERRITORY) != 0)
+  if ((mask & XPG_TERRITORY) != 0)
     {
       *cp++ = '_';
       cp = stpcpy (cp, territory);
@@ -239,29 +235,11 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
       *cp++ = '.';
       cp = stpcpy (cp, normalized_codeset);
     }
-  if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0)
+  if ((mask & XPG_MODIFIER) != 0)
     {
-      /* This component can be part of both syntaces but has different
-        leading characters.  For CEN we use `+', else `@'.  */
-      *cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@';
+      *cp++ = '@';
       cp = stpcpy (cp, modifier);
     }
-  if ((mask & CEN_SPECIAL) != 0)
-    {
-      *cp++ = '+';
-      cp = stpcpy (cp, special);
-    }
-  if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0)
-    {
-      *cp++ = ',';
-      if ((mask & CEN_SPONSOR) != 0)
-       cp = stpcpy (cp, sponsor);
-      if ((mask & CEN_REVISION) != 0)
-       {
-         *cp++ = '_';
-         cp = stpcpy (cp, revision);
-       }
-    }
 
   *cp++ = '/';
   stpcpy (cp, filename);
@@ -301,7 +279,10 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
            + (((dirlist_count << pop (mask)) + (dirlist_count > 1 ? 1 : 0))
               * sizeof (struct loaded_l10nfile *)));
   if (retval == NULL)
-    return NULL;
+    {
+      free (abs_filename);
+      return NULL;
+    }
 
   retval->filename = abs_filename;
 
@@ -332,8 +313,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
      normalized_codeset.  */
   for (cnt = dirlist_count > 1 ? mask : mask - 1; cnt >= 0; --cnt)
     if ((cnt & ~mask) == 0
-       && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0)
-       && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0))
+       && !((cnt & XPG_CODESET) != 0 && (cnt & XPG_NORM_CODESET) != 0))
       {
        if (dirlist_count > 1)
          {
@@ -345,15 +325,14 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
              retval->successor[entries++]
                = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1,
                                      cnt, language, territory, codeset,
-                                     normalized_codeset, modifier, special,
-                                     sponsor, revision, filename, 1);
+                                     normalized_codeset, modifier, filename,
+                                     1);
          }
        else
          retval->successor[entries++]
            = _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len,
                                  cnt, language, territory, codeset,
-                                 normalized_codeset, modifier, special,
-                                 sponsor, revision, filename, 1);
+                                 normalized_codeset, modifier, filename, 1);
       }
   retval->successor[entries] = NULL;
 
index 20137b6..5436040 100644 (file)
 
 #if HAVE_CFPREFERENCESCOPYAPPVALUE
 # include <string.h>
-# include <CFPreferences.h>
-# include <CFPropertyList.h>
-# include <CFArray.h>
-# include <CFString.h>
+# include <CoreFoundation/CFPreferences.h>
+# include <CoreFoundation/CFPropertyList.h>
+# include <CoreFoundation/CFArray.h>
+# include <CoreFoundation/CFString.h>
 extern void _nl_locale_name_canonicalize (char *name);
 #endif
 
diff --git a/intl/libgnuintl.h.in b/intl/libgnuintl.h.in
new file mode 100644 (file)
index 0000000..1a053f3
--- /dev/null
@@ -0,0 +1,419 @@
+/* Message catalogs for internationalization.
+   Copyright (C) 1995-1997, 2000-2006 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
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+#ifndef _LIBINTL_H
+#define _LIBINTL_H     1
+
+#include <locale.h>
+
+/* The LC_MESSAGES locale category is the category used by the functions
+   gettext() and dgettext().  It is specified in POSIX, but not in ANSI C.
+   On systems that don't define it, use an arbitrary value instead.
+   On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
+   then includes <libintl.h> (i.e. this file!) and then only defines
+   LC_MESSAGES.  To avoid a redefinition warning, don't define LC_MESSAGES
+   in this case.  */
+#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
+# define LC_MESSAGES 1729
+#endif
+
+/* We define an additional symbol to signal that we use the GNU
+   implementation of gettext.  */
+#define __USE_GNU_GETTEXT 1
+
+/* Provide information about the supported file formats.  Returns the
+   maximum minor revision number supported for a given major revision.  */
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
+  ((major) == 0 || (major) == 1 ? 1 : -1)
+
+/* Resolve a platform specific conflict on DJGPP.  GNU gettext takes
+   precedence over _conio_gettext.  */
+#ifdef __DJGPP__
+# undef gettext
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Version number: (major<<16) + (minor<<8) + subminor */
+#define LIBINTL_VERSION 0x000F00
+extern int libintl_version;
+
+
+/* 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.
+
+   The redirection happens by default through macros in C, so that &gettext
+   is independent of the compilation unit, but through inline functions in
+   C++, in order not to interfere with the name mangling of class fields or
+   class methods called 'gettext'.  */
+
+/* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
+   If he doesn't, we choose the method.  A third possible method is
+   _INTL_REDIRECT_ASM, supported only by GCC.  */
+#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
+# if __GNUC__ >= 2 && !(__APPLE_CC__ > 1) && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
+#  define _INTL_REDIRECT_ASM
+# else
+#  ifdef __cplusplus
+#   define _INTL_REDIRECT_INLINE
+#  else
+#   define _INTL_REDIRECT_MACROS
+#  endif
+# endif
+#endif
+/* Auxiliary macros.  */
+#ifdef _INTL_REDIRECT_ASM
+# define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
+# define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
+# define _INTL_STRINGIFY(prefix) #prefix
+#else
+# define _INTL_ASM(cname)
+#endif
+
+/* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
+   its n-th argument literally.  This enables GCC to warn for example about
+   printf (gettext ("foo %y")).  */
+#if __GNUC__ >= 3 && !(__APPLE_CC__ > 1 && defined __cplusplus)
+# define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
+#else
+# define _INTL_MAY_RETURN_STRING_ARG(n)
+#endif
+
+/* Look up MSGID in the current default message catalog for the current
+   LC_MESSAGES locale.  If not found, returns MSGID itself (the default
+   text).  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_gettext (const char *__msgid)
+       _INTL_MAY_RETURN_STRING_ARG (1);
+static inline char *gettext (const char *__msgid)
+{
+  return libintl_gettext (__msgid);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define gettext libintl_gettext
+#endif
+extern char *gettext (const char *__msgid)
+       _INTL_ASM (libintl_gettext)
+       _INTL_MAY_RETURN_STRING_ARG (1);
+#endif
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current
+   LC_MESSAGES locale.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_dgettext (const char *__domainname, const char *__msgid)
+       _INTL_MAY_RETURN_STRING_ARG (2);
+static inline char *dgettext (const char *__domainname, const char *__msgid)
+{
+  return libintl_dgettext (__domainname, __msgid);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define dgettext libintl_dgettext
+#endif
+extern char *dgettext (const char *__domainname, const char *__msgid)
+       _INTL_ASM (libintl_dgettext)
+       _INTL_MAY_RETURN_STRING_ARG (2);
+#endif
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
+   locale.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
+                               int __category)
+       _INTL_MAY_RETURN_STRING_ARG (2);
+static inline char *dcgettext (const char *__domainname, const char *__msgid,
+                              int __category)
+{
+  return libintl_dcgettext (__domainname, __msgid, __category);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define dcgettext libintl_dcgettext
+#endif
+extern char *dcgettext (const char *__domainname, const char *__msgid,
+                       int __category)
+       _INTL_ASM (libintl_dcgettext)
+       _INTL_MAY_RETURN_STRING_ARG (2);
+#endif
+
+
+/* Similar to `gettext' but select the plural form corresponding to the
+   number N.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
+                              unsigned long int __n)
+       _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
+static inline char *ngettext (const char *__msgid1, const char *__msgid2,
+                             unsigned long int __n)
+{
+  return libintl_ngettext (__msgid1, __msgid2, __n);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define ngettext libintl_ngettext
+#endif
+extern char *ngettext (const char *__msgid1, const char *__msgid2,
+                      unsigned long int __n)
+       _INTL_ASM (libintl_ngettext)
+       _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
+#endif
+
+/* Similar to `dgettext' but select the plural form corresponding to the
+   number N.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
+                               const char *__msgid2, unsigned long int __n)
+       _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
+static inline char *dngettext (const char *__domainname, const char *__msgid1,
+                              const char *__msgid2, unsigned long int __n)
+{
+  return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define dngettext libintl_dngettext
+#endif
+extern char *dngettext (const char *__domainname,
+                       const char *__msgid1, const char *__msgid2,
+                       unsigned long int __n)
+       _INTL_ASM (libintl_dngettext)
+       _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
+#endif
+
+/* Similar to `dcgettext' but select the plural form corresponding to the
+   number N.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_dcngettext (const char *__domainname,
+                                const char *__msgid1, const char *__msgid2,
+                                unsigned long int __n, int __category)
+       _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
+static inline char *dcngettext (const char *__domainname,
+                               const char *__msgid1, const char *__msgid2,
+                               unsigned long int __n, int __category)
+{
+  return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define dcngettext libintl_dcngettext
+#endif
+extern char *dcngettext (const char *__domainname,
+                        const char *__msgid1, const char *__msgid2,
+                        unsigned long int __n, int __category)
+       _INTL_ASM (libintl_dcngettext)
+       _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
+#endif
+
+
+#ifndef IN_LIBGLOCALE
+
+/* 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".  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_textdomain (const char *__domainname);
+static inline char *textdomain (const char *__domainname)
+{
+  return libintl_textdomain (__domainname);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define textdomain libintl_textdomain
+#endif
+extern char *textdomain (const char *__domainname)
+       _INTL_ASM (libintl_textdomain);
+#endif
+
+/* Specify that the DOMAINNAME message catalog will be found
+   in DIRNAME rather than in the system locale data base.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_bindtextdomain (const char *__domainname,
+                                    const char *__dirname);
+static inline char *bindtextdomain (const char *__domainname,
+                                   const char *__dirname)
+{
+  return libintl_bindtextdomain (__domainname, __dirname);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define bindtextdomain libintl_bindtextdomain
+#endif
+extern char *bindtextdomain (const char *__domainname, const char *__dirname)
+       _INTL_ASM (libintl_bindtextdomain);
+#endif
+
+/* Specify the character encoding in which the messages from the
+   DOMAINNAME message catalog will be returned.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_bind_textdomain_codeset (const char *__domainname,
+                                             const char *__codeset);
+static inline char *bind_textdomain_codeset (const char *__domainname,
+                                            const char *__codeset)
+{
+  return libintl_bind_textdomain_codeset (__domainname, __codeset);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define bind_textdomain_codeset libintl_bind_textdomain_codeset
+#endif
+extern char *bind_textdomain_codeset (const char *__domainname,
+                                     const char *__codeset)
+       _INTL_ASM (libintl_bind_textdomain_codeset);
+#endif
+
+#endif /* IN_LIBGLOCALE */
+
+
+/* Support for format strings with positions in *printf(), following the
+   POSIX/XSI specification.
+   Note: These replacements for the *printf() functions are visible only
+   in source files that #include <libintl.h> or #include "gettext.h".
+   Packages that use *printf() in source files that don't refer to _()
+   or gettext() but for which the format string could be the return value
+   of _() or gettext() need to add this #include.  Oh well.  */
+
+#if !@HAVE_POSIX_PRINTF@
+
+#include <stdio.h>
+#include <stddef.h>
+
+/* Get va_list.  */
+#if __STDC__ || defined __cplusplus || defined _MSC_VER
+# include <stdarg.h>
+#else
+# include <varargs.h>
+#endif
+
+#undef fprintf
+#define fprintf libintl_fprintf
+extern int fprintf (FILE *, const char *, ...);
+#undef vfprintf
+#define vfprintf libintl_vfprintf
+extern int vfprintf (FILE *, const char *, va_list);
+
+#undef printf
+#if defined __NetBSD__ || defined __CYGWIN__ || defined __MINGW32__
+/* Don't break __attribute__((format(printf,M,N))).
+   This redefinition is only possible because the libc in NetBSD, Cygwin,
+   mingw does not have a function __printf__.  */
+# define libintl_printf __printf__
+#endif
+#define printf libintl_printf
+extern int printf (const char *, ...);
+#undef vprintf
+#define vprintf libintl_vprintf
+extern int vprintf (const char *, va_list);
+
+#undef sprintf
+#define sprintf libintl_sprintf
+extern int sprintf (char *, const char *, ...);
+#undef vsprintf
+#define vsprintf libintl_vsprintf
+extern int vsprintf (char *, const char *, va_list);
+
+#if @HAVE_SNPRINTF@
+
+#undef snprintf
+#define snprintf libintl_snprintf
+extern int snprintf (char *, size_t, const char *, ...);
+#undef vsnprintf
+#define vsnprintf libintl_vsnprintf
+extern int vsnprintf (char *, size_t, const char *, va_list);
+
+#endif
+
+#if @HAVE_ASPRINTF@
+
+#undef asprintf
+#define asprintf libintl_asprintf
+extern int asprintf (char **, const char *, ...);
+#undef vasprintf
+#define vasprintf libintl_vasprintf
+extern int vasprintf (char **, const char *, va_list);
+
+#endif
+
+#if @HAVE_WPRINTF@
+
+#undef fwprintf
+#define fwprintf libintl_fwprintf
+extern int fwprintf (FILE *, const wchar_t *, ...);
+#undef vfwprintf
+#define vfwprintf libintl_vfwprintf
+extern int vfwprintf (FILE *, const wchar_t *, va_list);
+
+#undef wprintf
+#define wprintf libintl_wprintf
+extern int wprintf (const wchar_t *, ...);
+#undef vwprintf
+#define vwprintf libintl_vwprintf
+extern int vwprintf (const wchar_t *, va_list);
+
+#undef swprintf
+#define swprintf libintl_swprintf
+extern int swprintf (wchar_t *, size_t, const wchar_t *, ...);
+#undef vswprintf
+#define vswprintf libintl_vswprintf
+extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list);
+
+#endif
+
+#endif
+
+
+/* Support for relocatable packages.  */
+
+/* Sets the original and the current installation prefix of the package.
+   Relocation simply replaces a pathname starting with the original prefix
+   by the corresponding pathname with the current prefix instead.  Both
+   prefixes should be directory names without trailing slash (i.e. use ""
+   instead of "/").  */
+#define libintl_set_relocation_prefix libintl_set_relocation_prefix
+extern void
+       libintl_set_relocation_prefix (const char *orig_prefix,
+                                     const char *curr_prefix);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* libintl.h */
index d6408f2..a7a1970 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999, 2000-2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999, 2000-2003, 2005-2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
 # define internal_function
 #endif
 
+#ifndef LIBINTL_DLL_EXPORTED
+# define LIBINTL_DLL_EXPORTED
+#endif
+
 /* Tell the compiler when a conditional or integer expression is
    almost always true or almost always false.  */
 #ifndef HAVE_BUILTIN_EXPECT
@@ -43,7 +47,7 @@
 #endif
 
 /* Separator in PATH like lists of pathnames.  */
-#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
+#if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
   /* Win32, OS/2, DOS */
 # define PATH_SEPARATOR ';'
 #else
 #endif
 
 /* Encoding of locale name parts.  */
-#define CEN_REVISION           1
-#define CEN_SPONSOR            2
-#define CEN_SPECIAL            4
-#define XPG_NORM_CODESET       8
-#define XPG_CODESET            16
-#define TERRITORY              32
-#define CEN_AUDIENCE           64
-#define XPG_MODIFIER           128
-
-#define CEN_SPECIFIC   (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
-#define XPG_SPECIFIC   (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
+#define XPG_NORM_CODESET       1
+#define XPG_CODESET            2
+#define XPG_TERRITORY          4
+#define XPG_MODIFIER           8
 
 
 struct loaded_l10nfile
@@ -89,9 +86,9 @@ extern const char *_nl_normalize_codeset (const char *codeset,
    files of the same kind, sorted in decreasing order of ->filename.
    DIRLIST and DIRLIST_LEN are an argz list of directories in which to
    look, containing at least one directory (i.e. DIRLIST_LEN > 0).
-   MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER,
-   SPECIAL, SPONSOR, REVISION are the pieces of the locale name, as
-   produced by _nl_explode_name().  FILENAME is the filename suffix.
+   MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER
+   are the pieces of the locale name, as produced by _nl_explode_name().
+   FILENAME is the filename suffix.
    The return value is the lookup result, either found in *L10NFILE_LIST,
    or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL.
    If the return value is non-NULL, it is added to *L10NFILE_LIST, and
@@ -103,43 +100,33 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
                    const char *dirlist, size_t dirlist_len, int mask,
                    const char *language, const char *territory,
                    const char *codeset, const char *normalized_codeset,
-                   const char *modifier, const char *special,
-                   const char *sponsor, const char *revision,
+                   const char *modifier,
                    const char *filename, int do_allocate);
 
 /* Lookup the real locale name for a locale alias NAME, or NULL if
    NAME is not a locale alias (but possibly a real locale name).
    The return value is statically allocated and must not be freed.  */
-extern const char *_nl_expand_alias (const char *name);
+/* Part of the libintl ABI only for the sake of the gettext.m4 macro.  */
+extern LIBINTL_DLL_EXPORTED const char *_nl_expand_alias (const char *name);
 
 /* Split a locale name NAME into its pieces: language, modifier,
-   territory, codeset, special, sponsor, revision.
+   territory, codeset.
    NAME gets destructively modified: NUL bytes are inserted here and
    there.  *LANGUAGE gets assigned NAME.  Each of *MODIFIER, *TERRITORY,
-   *CODESET, *SPECIAL, *SPONSOR, *REVISION gets assigned either a
-   pointer into the old NAME string, or NULL.  *NORMALIZED_CODESET
-   gets assigned the expanded *CODESET, if it is different from *CODESET;
-   this one is dynamically allocated and has to be freed by the caller.
+   *CODESET gets assigned either a pointer into the old NAME string, or
+   NULL.  *NORMALIZED_CODESET gets assigned the expanded *CODESET, if it
+   is different from *CODESET; this one is dynamically allocated and has
+   to be freed by the caller.
    The return value is a bitmask, where each bit corresponds to one
    filled-in value:
-     XPG_MODIFIER, CEN_AUDIENCE  for *MODIFIER,
-     TERRITORY                   for *TERRITORY,
+     XPG_MODIFIER                for *MODIFIER,
+     XPG_TERRITORY               for *TERRITORY,
      XPG_CODESET                 for *CODESET,
-     XPG_NORM_CODESET            for *NORMALIZED_CODESET,
-     CEN_SPECIAL                 for *SPECIAL,
-     CEN_SPONSOR                 for *SPONSOR,
-     CEN_REVISION                for *REVISION.
+     XPG_NORM_CODESET            for *NORMALIZED_CODESET.
  */
 extern int _nl_explode_name (char *name, const char **language,
                             const char **modifier, const char **territory,
                             const char **codeset,
-                            const char **normalized_codeset,
-                            const char **special, const char **sponsor,
-                            const char **revision);
-
-/* Split a locale name NAME into a leading language part and all the
-   rest.  Return a pointer to the first character after the language,
-   i.e. to the first byte of the rest.  */
-extern char *_nl_find_language (const char *name);
+                            const char **normalized_codeset);
 
 #endif /* loadinfo.h */
index 0d59ad8..2520c8c 100644 (file)
@@ -1,5 +1,5 @@
 /* Load needed message catalogs.
-   Copyright (C) 1995-1999, 2000-2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000-2005 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
@@ -91,6 +91,14 @@ char *alloca ();
 
 #ifdef _LIBC
 # include "../locale/localeinfo.h"
+# include <not-cancel.h>
+#endif
+
+/* Handle multi-threaded applications.  */
+#ifdef _LIBC
+# include <bits/libc-lock.h>
+#else
+# include "lock.h"
 #endif
 
 /* Provide fallback values for macros that ought to be defined in <inttypes.h>.
@@ -457,11 +465,12 @@ char *alloca ();
 /* Rename the non ISO C functions.  This is required by the standard
    because some ISO C functions will require linking with this object
    file and the name space must not be polluted.  */
-# define open   __open
-# define close  __close
-# define read   __read
-# define mmap   __mmap
-# define munmap __munmap
+# define open(name, flags)     open_not_cancel_2 (name, flags)
+# define close(fd)             close_not_cancel_no_status (fd)
+# define read(fd, buf, n)      read_not_cancel (fd, buf, n)
+# define mmap(addr, len, prot, flags, fd, offset) \
+  __mmap (addr, len, prot, flags, fd, offset)
+# define munmap(addr, len)     __munmap (addr, len)
 #endif
 
 /* For those losing systems which don't have `alloca' we have to add
@@ -764,144 +773,6 @@ get_sysdep_segment_value (const char *name)
   return NULL;
 }
 
-/* Initialize the codeset dependent parts of an opened message catalog.
-   Return the header entry.  */
-const char *
-internal_function
-_nl_init_domain_conv (struct loaded_l10nfile *domain_file,
-                     struct loaded_domain *domain,
-                     struct binding *domainbinding)
-{
-  /* Find out about the character set the file is encoded with.
-     This can be found (in textual form) in the entry "".  If this
-     entry does not exist or if this does not contain the `charset='
-     information, we will assume the charset matches the one the
-     current locale and we don't have to perform any conversion.  */
-  char *nullentry;
-  size_t nullentrylen;
-
-  /* Preinitialize fields, to avoid recursion during _nl_find_msg.  */
-  domain->codeset_cntr =
-    (domainbinding != NULL ? domainbinding->codeset_cntr : 0);
-#ifdef _LIBC
-  domain->conv = (__gconv_t) -1;
-#else
-# if HAVE_ICONV
-  domain->conv = (iconv_t) -1;
-# endif
-#endif
-  domain->conv_tab = NULL;
-
-  /* Get the header entry.  */
-  nullentry = _nl_find_msg (domain_file, domainbinding, "", &nullentrylen);
-
-  if (nullentry != NULL)
-    {
-#if defined _LIBC || HAVE_ICONV
-      const char *charsetstr;
-
-      charsetstr = strstr (nullentry, "charset=");
-      if (charsetstr != NULL)
-       {
-         size_t len;
-         char *charset;
-         const char *outcharset;
-
-         charsetstr += strlen ("charset=");
-         len = strcspn (charsetstr, " \t\n");
-
-         charset = (char *) alloca (len + 1);
-# if defined _LIBC || HAVE_MEMPCPY
-         *((char *) mempcpy (charset, charsetstr, len)) = '\0';
-# else
-         memcpy (charset, charsetstr, len);
-         charset[len] = '\0';
-# endif
-
-         /* The output charset should normally be determined by the
-            locale.  But sometimes the locale is not used or not correctly
-            set up, so we provide a possibility for the user to override
-            this.  Moreover, the value specified through
-            bind_textdomain_codeset overrides both.  */
-         if (domainbinding != NULL && domainbinding->codeset != NULL)
-           outcharset = domainbinding->codeset;
-         else
-           {
-             outcharset = getenv ("OUTPUT_CHARSET");
-             if (outcharset == NULL || outcharset[0] == '\0')
-               {
-# ifdef _LIBC
-                 outcharset = _NL_CURRENT (LC_CTYPE, CODESET);
-# else
-#  if HAVE_ICONV
-                 extern const char *locale_charset (void);
-                 outcharset = locale_charset ();
-#  endif
-# endif
-               }
-           }
-
-# ifdef _LIBC
-         /* We always want to use transliteration.  */
-         outcharset = norm_add_slashes (outcharset, "TRANSLIT");
-         charset = norm_add_slashes (charset, NULL);
-         if (__gconv_open (outcharset, charset, &domain->conv,
-                           GCONV_AVOID_NOCONV)
-             != __GCONV_OK)
-           domain->conv = (__gconv_t) -1;
-# else
-#  if HAVE_ICONV
-         /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5,
-            we want to use transliteration.  */
-#   if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \
-       || _LIBICONV_VERSION >= 0x0105
-         if (strchr (outcharset, '/') == NULL)
-           {
-             char *tmp;
-
-             len = strlen (outcharset);
-             tmp = (char *) alloca (len + 10 + 1);
-             memcpy (tmp, outcharset, len);
-             memcpy (tmp + len, "//TRANSLIT", 10 + 1);
-             outcharset = tmp;
-
-             domain->conv = iconv_open (outcharset, charset);
-
-             freea (outcharset);
-           }
-         else
-#   endif
-           domain->conv = iconv_open (outcharset, charset);
-#  endif
-# endif
-
-         freea (charset);
-       }
-#endif /* _LIBC || HAVE_ICONV */
-    }
-
-  return nullentry;
-}
-
-/* Frees the codeset dependent parts of an opened message catalog.  */
-void
-internal_function
-_nl_free_domain_conv (struct loaded_domain *domain)
-{
-  if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1)
-    free (domain->conv_tab);
-
-#ifdef _LIBC
-  if (domain->conv != (__gconv_t) -1)
-    __gconv_close (domain->conv);
-#else
-# if HAVE_ICONV
-  if (domain->conv != (iconv_t) -1)
-    iconv_close (domain->conv);
-# endif
-#endif
-}
-
 /* Load the message catalogs specified by FILENAME.  If it is no valid
    message catalog do nothing.  */
 void
@@ -909,7 +780,8 @@ internal_function
 _nl_load_domain (struct loaded_l10nfile *domain_file,
                 struct binding *domainbinding)
 {
-  int fd;
+  __libc_lock_define_initialized_recursive (static, lock)
+  int fd = -1;
   size_t size;
 #ifdef _LIBC
   struct stat64 st;
@@ -921,8 +793,24 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
   struct loaded_domain *domain;
   int revision;
   const char *nullentry;
+  size_t nullentrylen;
 
-  domain_file->decided = 1;
+  __libc_lock_lock_recursive (lock);
+  if (domain_file->decided != 0)
+    {
+      /* There are two possibilities:
+
+        + this is the same thread calling again during this initialization
+          via _nl_find_msg.  We have initialized everything this call needs.
+
+        + this is another thread which tried to initialize this object.
+          Not necessary anymore since if the lock is available this
+          is finished.
+      */
+      goto done;
+    }
+
+  domain_file->decided = -1;
   domain_file->data = NULL;
 
   /* Note that it would be useless to store domainbinding in domain_file
@@ -934,12 +822,12 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
      specification the locale file name is different for XPG and CEN
      syntax.  */
   if (domain_file->filename == NULL)
-    return;
+    goto out;
 
   /* Try to open the addressed file.  */
   fd = open (domain_file->filename, O_RDONLY | O_BINARY);
   if (fd == -1)
-    return;
+    goto out;
 
   /* We must know about the size of the file.  */
   if (
@@ -950,11 +838,8 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
 #endif
       || __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0)
       || __builtin_expect (size < sizeof (struct mo_file_header), 0))
-    {
-      /* Something went wrong.  */
-      close (fd);
-      return;
-    }
+    /* Something went wrong.  */
+    goto out;
 
 #ifdef HAVE_MMAP
   /* Now we are ready to load the file.  If mmap() is available we try
@@ -966,6 +851,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
     {
       /* mmap() call was successful.  */
       close (fd);
+      fd = -1;
       use_mmap = 1;
     }
 #endif
@@ -979,7 +865,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
 
       data = (struct mo_file_header *) malloc (size);
       if (data == NULL)
-       return;
+       goto out;
 
       to_read = size;
       read_ptr = (char *) data;
@@ -992,8 +878,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
              if (nb == -1 && errno == EINTR)
                continue;
 #endif
-             close (fd);
-             return;
+             goto out;
            }
          read_ptr += nb;
          to_read -= nb;
@@ -1001,6 +886,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
       while (to_read > 0);
 
       close (fd);
+      fd = -1;
     }
 
   /* Using the magic number we can test whether it really is a message
@@ -1015,12 +901,12 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
       else
 #endif
        free (data);
-      return;
+      goto out;
     }
 
   domain = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
   if (domain == NULL)
-    return;
+    goto out;
   domain_file->data = domain;
 
   domain->data = (char *) data;
@@ -1321,7 +1207,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
                    for (i = 0; i < n_inmem_sysdep_strings; i++)
                      {
                        const char *msgid = inmem_orig_sysdep_tab[i].pointer;
-                       nls_uint32 hash_val = hash_string (msgid);
+                       nls_uint32 hash_val = __hash_string (msgid);
                        nls_uint32 idx = hash_val % domain->hash_size;
                        nls_uint32 incr =
                          1 + (hash_val % (domain->hash_size - 2));
@@ -1382,28 +1268,55 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
        free (data);
       free (domain);
       domain_file->data = NULL;
-      return;
+      goto out;
     }
 
-  /* Now initialize the character set converter from the character set
-     the file is encoded with (found in the header entry) to the domain's
-     specified character set or the locale's character set.  */
-  nullentry = _nl_init_domain_conv (domain_file, domain, domainbinding);
+  /* No caches of converted translations so far.  */
+  domain->conversions = NULL;
+  domain->nconversions = 0;
 
-  /* Also look for a plural specification.  */
+  /* Get the header entry and look for a plural specification.  */
+#ifdef IN_LIBGLOCALE
+  nullentry =
+    _nl_find_msg (domain_file, domainbinding, NULL, "", &nullentrylen);
+#else
+  nullentry = _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
+#endif
   EXTRACT_PLURAL_EXPRESSION (nullentry, &domain->plural, &domain->nplurals);
+
+ out:
+  if (fd != -1)
+    close (fd);
+
+  domain_file->decided = 1;
+
+ done:
+  __libc_lock_unlock_recursive (lock);
 }
 
 
 #ifdef _LIBC
 void
-internal_function
+internal_function __libc_freeres_fn_section
 _nl_unload_domain (struct loaded_domain *domain)
 {
+  size_t i;
+
   if (domain->plural != &__gettext_germanic_plural)
     __gettext_free_exp (domain->plural);
 
-  _nl_free_domain_conv (domain);
+  for (i = 0; i < domain->nconversions; i++)
+    {
+      struct converted_domain *convd = &domain->conversions[i];
+
+      free (convd->encoding);
+      if (convd->conv_tab != NULL && convd->conv_tab != (char **) -1)
+       free (convd->conv_tab);
+      if (convd->conv != (__gconv_t) -1)
+       __gconv_close (convd->conv);
+    }
+  if (domain->conversions != NULL)
+    free (domain->conversions);
 
   if (domain->malloced)
     free (domain->malloced);
index 1252f3f..e8505bf 100644 (file)
@@ -1,6 +1,6 @@
 /* Determine a canonical name for the current locale's character encoding.
 
-   Copyright (C) 2000-2004 Free Software Foundation, Inc.
+   Copyright (C) 2000-2006 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
@@ -41,8 +41,7 @@
 #endif
 
 #if defined _WIN32 || defined __WIN32__
-# undef WIN32   /* avoid warning on mingw32 */
-# define WIN32
+# define WIN32_NATIVE
 #endif
 
 #if defined __EMX__
@@ -50,7 +49,7 @@
 # define OS2
 #endif
 
-#if !defined WIN32
+#if !defined WIN32_NATIVE
 # if HAVE_LANGINFO_CODESET
 #  include <langinfo.h>
 # else
 #   include <locale.h>
 #  endif
 # endif
-#elif defined WIN32
+# ifdef __CYGWIN__
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+# endif
+#elif defined WIN32_NATIVE
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 #endif
@@ -107,14 +110,14 @@ static const char * volatile charset_aliases;
 
 /* Return a pointer to the contents of the charset.alias file.  */
 static const char *
-get_charset_aliases ()
+get_charset_aliases (void)
 {
   const char *cp;
 
   cp = charset_aliases;
   if (cp == NULL)
     {
-#if !(defined VMS || defined WIN32)
+#if !(defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
       FILE *fp;
       const char *dir;
       const char *base = "charset.alias";
@@ -240,7 +243,7 @@ get_charset_aliases ()
           "DECKOREAN" "\0" "EUC-KR" "\0";
 # endif
 
-# if defined WIN32
+# if defined WIN32_NATIVE || defined __CYGWIN__
       /* To avoid the troubles of installing a separate file in the same
         directory as the DLL and of retrieving the DLL's directory at
         runtime, simply inline the aliases here.  */
@@ -249,6 +252,7 @@ get_charset_aliases ()
           "CP1361" "\0" "JOHAB" "\0"
           "CP20127" "\0" "ASCII" "\0"
           "CP20866" "\0" "KOI8-R" "\0"
+          "CP20936" "\0" "GB2312" "\0"
           "CP21866" "\0" "KOI8-RU" "\0"
           "CP28591" "\0" "ISO-8859-1" "\0"
           "CP28592" "\0" "ISO-8859-2" "\0"
@@ -259,7 +263,14 @@ get_charset_aliases ()
           "CP28597" "\0" "ISO-8859-7" "\0"
           "CP28598" "\0" "ISO-8859-8" "\0"
           "CP28599" "\0" "ISO-8859-9" "\0"
-          "CP28605" "\0" "ISO-8859-15" "\0";
+          "CP28605" "\0" "ISO-8859-15" "\0"
+          "CP38598" "\0" "ISO-8859-8" "\0"
+          "CP51932" "\0" "EUC-JP" "\0"
+          "CP51936" "\0" "GB2312" "\0"
+          "CP51949" "\0" "EUC-KR" "\0"
+          "CP51950" "\0" "EUC-TW" "\0"
+          "CP54936" "\0" "GB18030" "\0"
+          "CP65001" "\0" "UTF-8" "\0";
 # endif
 #endif
 
@@ -279,18 +290,65 @@ get_charset_aliases ()
 STATIC
 #endif
 const char *
-locale_charset ()
+locale_charset (void)
 {
   const char *codeset;
   const char *aliases;
 
-#if !(defined WIN32 || defined OS2)
+#if !(defined WIN32_NATIVE || defined OS2)
 
 # if HAVE_LANGINFO_CODESET
 
   /* Most systems support nl_langinfo (CODESET) nowadays.  */
   codeset = nl_langinfo (CODESET);
 
+#  ifdef __CYGWIN__
+  /* Cygwin 2006 does not have locales.  nl_langinfo (CODESET) always
+     returns "US-ASCII".  As long as this is not fixed, return the suffix
+     of the locale name from the environment variables (if present) or
+     the codepage as a number.  */
+  if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
+    {
+      const char *locale;
+      static char buf[2 + 10 + 1];
+
+      locale = getenv ("LC_ALL");
+      if (locale == NULL || locale[0] == '\0')
+       {
+         locale = getenv ("LC_CTYPE");
+         if (locale == NULL || locale[0] == '\0')
+           locale = getenv ("LANG");
+       }
+      if (locale != NULL && locale[0] != '\0')
+       {
+         /* If the locale name contains an encoding after the dot, return
+            it.  */
+         const char *dot = strchr (locale, '.');
+
+         if (dot != NULL)
+           {
+             const char *modifier;
+
+             dot++;
+             /* Look for the possible @... trailer and remove it, if any.  */
+             modifier = strchr (dot, '@');
+             if (modifier == NULL)
+               return dot;
+             if (modifier - dot < sizeof (buf))
+               {
+                 memcpy (buf, dot, modifier - dot);
+                 buf [modifier - dot] = '\0';
+                 return buf;
+               }
+           }
+       }
+
+      /* Woe32 has a function returning the locale's codepage as a number.  */
+      sprintf (buf, "CP%u", GetACP ());
+      codeset = buf;
+    }
+#  endif
+
 # else
 
   /* On old systems which lack it, use setlocale or getenv.  */
@@ -321,7 +379,7 @@ locale_charset ()
 
 # endif
 
-#elif defined WIN32
+#elif defined WIN32_NATIVE
 
   static char buf[2 + 10 + 1];
 
index 7a092a0..26122a0 100644 (file)
@@ -1,5 +1,5 @@
 /* Handle aliases for locale names.
-   Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000-2001, 2003, 2005 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
@@ -81,11 +81,13 @@ char *alloca ();
 # endif
 # define HAVE_MEMPCPY  1
 # define HAVE___FSETLOCKING    1
+#endif
 
-/* We need locking here since we can be called from different places.  */
+/* Handle multi-threaded applications.  */
+#ifdef _LIBC
 # include <bits/libc-lock.h>
-
-__libc_lock_define_initialized (static, lock);
+#else
+# include "lock.h"
 #endif
 
 #ifndef internal_function
@@ -120,6 +122,9 @@ __libc_lock_define_initialized (static, lock);
 #endif
 
 
+__libc_lock_define_initialized (static, lock)
+
+
 struct alias_map
 {
   const char *alias;
@@ -155,9 +160,7 @@ _nl_expand_alias (const char *name)
   const char *result = NULL;
   size_t added;
 
-#ifdef _LIBC
   __libc_lock_lock (lock);
-#endif
 
   if (locale_alias_path == NULL)
     locale_alias_path = LOCALE_ALIAS_PATH;
@@ -204,9 +207,7 @@ _nl_expand_alias (const char *name)
     }
   while (added != 0);
 
-#ifdef _LIBC
   __libc_lock_unlock (lock);
-#endif
 
   return result;
 }
@@ -230,7 +231,13 @@ read_alias_file (const char *fname, int fname_len)
   memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
 #endif
 
+#ifdef _LIBC
+  /* Note the file is opened with cancellation in the I/O functions
+     disabled.  */
+  fp = fopen (relocate (full_fname), "rc");
+#else
   fp = fopen (relocate (full_fname), "r");
+#endif
   freea (full_fname);
   if (fp == NULL)
     return 0;
@@ -254,11 +261,15 @@ read_alias_file (const char *fname, int fname_len)
       char *alias;
       char *value;
       char *cp;
+      int complete_line;
 
       if (FGETS (buf, sizeof buf, fp) == NULL)
        /* EOF reached.  */
        break;
 
+      /* Determine whether the line is complete.  */
+      complete_line = strchr (buf, '\n') != NULL;
+
       cp = buf;
       /* Ignore leading white space.  */
       while (isspace ((unsigned char) cp[0]))
@@ -280,9 +291,6 @@ read_alias_file (const char *fname, int fname_len)
 
          if (cp[0] != '\0')
            {
-             size_t alias_len;
-             size_t value_len;
-
              value = cp++;
              while (cp[0] != '\0' && !isspace ((unsigned char) cp[0]))
                ++cp;
@@ -298,60 +306,75 @@ read_alias_file (const char *fname, int fname_len)
              else if (cp[0] != '\0')
                *cp++ = '\0';
 
-             if (nmap >= maxmap)
-               if (__builtin_expect (extend_alias_table (), 0))
-                 return added;
+#ifdef IN_LIBGLOCALE
+             /* glibc's locale.alias contains entries for ja_JP and ko_KR
+                that make it impossible to use a Japanese or Korean UTF-8
+                locale under the name "ja_JP" or "ko_KR".  Ignore these
+                entries.  */
+             if (strchr (alias, '_') == NULL)
+#endif
+               {
+                 size_t alias_len;
+                 size_t value_len;
 
-             alias_len = strlen (alias) + 1;
-             value_len = strlen (value) + 1;
+                 if (nmap >= maxmap)
+                   if (__builtin_expect (extend_alias_table (), 0))
+                     goto out;
 
-             if (string_space_act + alias_len + value_len > string_space_max)
-               {
-                 /* Increase size of memory pool.  */
-                 size_t new_size = (string_space_max
-                                    + (alias_len + value_len > 1024
-                                       ? alias_len + value_len : 1024));
-                 char *new_pool = (char *) realloc (string_space, new_size);
-                 if (new_pool == NULL)
-                   return added;
-
-                 if (__builtin_expect (string_space != new_pool, 0))
-                   {
-                     size_t i;
+                 alias_len = strlen (alias) + 1;
+                 value_len = strlen (value) + 1;
 
-                     for (i = 0; i < nmap; i++)
+                 if (string_space_act + alias_len + value_len > string_space_max)
+                   {
+                     /* Increase size of memory pool.  */
+                     size_t new_size = (string_space_max
+                                        + (alias_len + value_len > 1024
+                                           ? alias_len + value_len : 1024));
+                     char *new_pool = (char *) realloc (string_space, new_size);
+                     if (new_pool == NULL)
+                       goto out;
+
+                     if (__builtin_expect (string_space != new_pool, 0))
                        {
-                         map[i].alias += new_pool - string_space;
-                         map[i].value += new_pool - string_space;
+                         size_t i;
+
+                         for (i = 0; i < nmap; i++)
+                           {
+                             map[i].alias += new_pool - string_space;
+                             map[i].value += new_pool - string_space;
+                           }
                        }
-                   }
 
-                 string_space = new_pool;
-                 string_space_max = new_size;
-               }
+                     string_space = new_pool;
+                     string_space_max = new_size;
+                   }
 
-             map[nmap].alias = memcpy (&string_space[string_space_act],
-                                       alias, alias_len);
-             string_space_act += alias_len;
+                 map[nmap].alias = memcpy (&string_space[string_space_act],
+                                           alias, alias_len);
+                 string_space_act += alias_len;
 
-             map[nmap].value = memcpy (&string_space[string_space_act],
-                                       value, value_len);
-             string_space_act += value_len;
+                 map[nmap].value = memcpy (&string_space[string_space_act],
+                                           value, value_len);
+                 string_space_act += value_len;
 
-             ++nmap;
-             ++added;
+                 ++nmap;
+                 ++added;
+               }
            }
        }
 
       /* Possibly not the whole line fits into the buffer.  Ignore
         the rest of the line.  */
-      while (strchr (buf, '\n') == NULL)
-       if (FGETS (buf, sizeof buf, fp) == NULL)
-         /* Make sure the inner loop will be left.  The outer loop
-            will exit at the `feof' test.  */
-         break;
+      if (! complete_line)
+       do
+         if (FGETS (buf, sizeof buf, fp) == NULL)
+           /* Make sure the inner loop will be left.  The outer loop
+              will exit at the `feof' test.  */
+           break;
+       while (strchr (buf, '\n') == NULL);
     }
 
+ out:
   /* Should we test for ferror()?  I think we have to silently ignore
      errors.  --drepper  */
   fclose (fp);
index b855ace..1b8b99a 100644 (file)
@@ -1,5 +1,5 @@
 /* Determine the current selected locale.
-   Copyright (C) 1995-1999, 2000-2005 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000-2006 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
 
 #if HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE
 # include <string.h>
-# include <CFString.h>
+# include <CoreFoundation/CFString.h>
 # if HAVE_CFLOCALECOPYCURRENT
-#  include <CFLocale.h>
+#  include <CoreFoundation/CFLocale.h>
 # elif HAVE_CFPREFERENCESCOPYAPPVALUE
-#  include <CFPreferences.h>
+#  include <CoreFoundation/CFPreferences.h>
 # endif
 #endif
 
 #if defined _WIN32 || defined __WIN32__
-# undef WIN32   /* avoid warning on mingw32 */
-# define WIN32
+# define WIN32_NATIVE
 #endif
 
-#ifdef WIN32
+#ifdef WIN32_NATIVE
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* List of language codes, sorted by value:
@@ -1023,7 +1022,7 @@ _nl_locale_name_default (void)
       locale, customizing it for each location.  POSIX:2001 does not require
       such a facility.  */
 
-#if !(HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE || defined(WIN32))
+#if !(HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE || defined(WIN32_NATIVE))
 
   /* The system does not have a way of setting the locale, other than the
      POSIX specified environment variables.  We use C as default locale.  */
@@ -1077,7 +1076,7 @@ _nl_locale_name_default (void)
 
 # endif
 
-# if defined(WIN32) /* WIN32 */
+# if defined(WIN32_NATIVE) /* WIN32, not Cygwin */
   {
     LCID lcid;
     LANGID langid;
diff --git a/intl/lock.c b/intl/lock.c
new file mode 100644 (file)
index 0000000..a860459
--- /dev/null
@@ -0,0 +1,924 @@
+/* Locking in multithreaded situations.
+   Copyright (C) 2005 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
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h,
+   gthr-win32.h.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "lock.h"
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS
+
+/* Use the POSIX threads library.  */
+
+# if PTHREAD_IN_USE_DETECTION_HARD
+
+/* The function to be executed by a dummy thread.  */
+static void *
+dummy_thread_func (void *arg)
+{
+  return arg;
+}
+
+int
+glthread_in_use (void)
+{
+  static int tested;
+  static int result; /* 1: linked with -lpthread, 0: only with libc */
+
+  if (!tested)
+    {
+      pthread_t thread;
+
+      if (pthread_create (&thread, NULL, dummy_thread_func, NULL) != 0)
+       /* Thread creation failed.  */
+       result = 0;
+      else
+       {
+         /* Thread creation works.  */
+         void *retval;
+         if (pthread_join (thread, &retval) != 0)
+           abort ();
+         result = 1;
+       }
+      tested = 1;
+    }
+  return result;
+}
+
+# endif
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+# if HAVE_PTHREAD_RWLOCK
+
+#  if !defined PTHREAD_RWLOCK_INITIALIZER
+
+void
+glthread_rwlock_init (gl_rwlock_t *lock)
+{
+  if (pthread_rwlock_init (&lock->rwlock, NULL) != 0)
+    abort ();
+  lock->initialized = 1;
+}
+
+void
+glthread_rwlock_rdlock (gl_rwlock_t *lock)
+{
+  if (!lock->initialized)
+    {
+      if (pthread_mutex_lock (&lock->guard) != 0)
+       abort ();
+      if (!lock->initialized)
+       glthread_rwlock_init (lock);
+      if (pthread_mutex_unlock (&lock->guard) != 0)
+       abort ();
+    }
+  if (pthread_rwlock_rdlock (&lock->rwlock) != 0)
+    abort ();
+}
+
+void
+glthread_rwlock_wrlock (gl_rwlock_t *lock)
+{
+  if (!lock->initialized)
+    {
+      if (pthread_mutex_lock (&lock->guard) != 0)
+       abort ();
+      if (!lock->initialized)
+       glthread_rwlock_init (lock);
+      if (pthread_mutex_unlock (&lock->guard) != 0)
+       abort ();
+    }
+  if (pthread_rwlock_wrlock (&lock->rwlock) != 0)
+    abort ();
+}
+
+void
+glthread_rwlock_unlock (gl_rwlock_t *lock)
+{
+  if (!lock->initialized)
+    abort ();
+  if (pthread_rwlock_unlock (&lock->rwlock) != 0)
+    abort ();
+}
+
+void
+glthread_rwlock_destroy (gl_rwlock_t *lock)
+{
+  if (!lock->initialized)
+    abort ();
+  if (pthread_rwlock_destroy (&lock->rwlock) != 0)
+    abort ();
+  lock->initialized = 0;
+}
+
+#  endif
+
+# else
+
+void
+glthread_rwlock_init (gl_rwlock_t *lock)
+{
+  if (pthread_mutex_init (&lock->lock, NULL) != 0)
+    abort ();
+  if (pthread_cond_init (&lock->waiting_readers, NULL) != 0)
+    abort ();
+  if (pthread_cond_init (&lock->waiting_writers, NULL) != 0)
+    abort ();
+  lock->waiting_writers_count = 0;
+  lock->runcount = 0;
+}
+
+void
+glthread_rwlock_rdlock (gl_rwlock_t *lock)
+{
+  if (pthread_mutex_lock (&lock->lock) != 0)
+    abort ();
+  /* Test whether only readers are currently running, and whether the runcount
+     field will not overflow.  */
+  /* POSIX says: "It is implementation-defined whether the calling thread
+     acquires the lock when a writer does not hold the lock and there are
+     writers blocked on the lock."  Let's say, no: give the writers a higher
+     priority.  */
+  while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0))
+    {
+      /* This thread has to wait for a while.  Enqueue it among the
+        waiting_readers.  */
+      if (pthread_cond_wait (&lock->waiting_readers, &lock->lock) != 0)
+       abort ();
+    }
+  lock->runcount++;
+  if (pthread_mutex_unlock (&lock->lock) != 0)
+    abort ();
+}
+
+void
+glthread_rwlock_wrlock (gl_rwlock_t *lock)
+{
+  if (pthread_mutex_lock (&lock->lock) != 0)
+    abort ();
+  /* Test whether no readers or writers are currently running.  */
+  while (!(lock->runcount == 0))
+    {
+      /* This thread has to wait for a while.  Enqueue it among the
+        waiting_writers.  */
+      lock->waiting_writers_count++;
+      if (pthread_cond_wait (&lock->waiting_writers, &lock->lock) != 0)
+       abort ();
+      lock->waiting_writers_count--;
+    }
+  lock->runcount--; /* runcount becomes -1 */
+  if (pthread_mutex_unlock (&lock->lock) != 0)
+    abort ();
+}
+
+void
+glthread_rwlock_unlock (gl_rwlock_t *lock)
+{
+  if (pthread_mutex_lock (&lock->lock) != 0)
+    abort ();
+  if (lock->runcount < 0)
+    {
+      /* Drop a writer lock.  */
+      if (!(lock->runcount == -1))
+       abort ();
+      lock->runcount = 0;
+    }
+  else
+    {
+      /* Drop a reader lock.  */
+      if (!(lock->runcount > 0))
+       abort ();
+      lock->runcount--;
+    }
+  if (lock->runcount == 0)
+    {
+      /* POSIX recommends that "write locks shall take precedence over read
+        locks", to avoid "writer starvation".  */
+      if (lock->waiting_writers_count > 0)
+       {
+         /* Wake up one of the waiting writers.  */
+         if (pthread_cond_signal (&lock->waiting_writers) != 0)
+           abort ();
+       }
+      else
+       {
+         /* Wake up all waiting readers.  */
+         if (pthread_cond_broadcast (&lock->waiting_readers) != 0)
+           abort ();
+       }
+    }
+  if (pthread_mutex_unlock (&lock->lock) != 0)
+    abort ();
+}
+
+void
+glthread_rwlock_destroy (gl_rwlock_t *lock)
+{
+  if (pthread_mutex_destroy (&lock->lock) != 0)
+    abort ();
+  if (pthread_cond_destroy (&lock->waiting_readers) != 0)
+    abort ();
+  if (pthread_cond_destroy (&lock->waiting_writers) != 0)
+    abort ();
+}
+
+# endif
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+# if HAVE_PTHREAD_MUTEX_RECURSIVE
+
+#  if !(defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+
+void
+glthread_recursive_lock_init (gl_recursive_lock_t *lock)
+{
+  pthread_mutexattr_t attributes;
+
+  if (pthread_mutexattr_init (&attributes) != 0)
+    abort ();
+  if (pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE) != 0)
+    abort ();
+  if (pthread_mutex_init (&lock->recmutex, &attributes) != 0)
+    abort ();
+  if (pthread_mutexattr_destroy (&attributes) != 0)
+    abort ();
+  lock->initialized = 1;
+}
+
+void
+glthread_recursive_lock_lock (gl_recursive_lock_t *lock)
+{
+  if (!lock->initialized)
+    {
+      if (pthread_mutex_lock (&lock->guard) != 0)
+       abort ();
+      if (!lock->initialized)
+       glthread_recursive_lock_init (lock);
+      if (pthread_mutex_unlock (&lock->guard) != 0)
+       abort ();
+    }
+  if (pthread_mutex_lock (&lock->recmutex) != 0)
+    abort ();
+}
+
+void
+glthread_recursive_lock_unlock (gl_recursive_lock_t *lock)
+{
+  if (!lock->initialized)
+    abort ();
+  if (pthread_mutex_unlock (&lock->recmutex) != 0)
+    abort ();
+}
+
+void
+glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
+{
+  if (!lock->initialized)
+    abort ();
+  if (pthread_mutex_destroy (&lock->recmutex) != 0)
+    abort ();
+  lock->initialized = 0;
+}
+
+#  endif
+
+# else
+
+void
+glthread_recursive_lock_init (gl_recursive_lock_t *lock)
+{
+  if (pthread_mutex_init (&lock->mutex, NULL) != 0)
+    abort ();
+  lock->owner = (pthread_t) 0;
+  lock->depth = 0;
+}
+
+void
+glthread_recursive_lock_lock (gl_recursive_lock_t *lock)
+{
+  pthread_t self = pthread_self ();
+  if (lock->owner != self)
+    {
+      if (pthread_mutex_lock (&lock->mutex) != 0)
+       abort ();
+      lock->owner = self;
+    }
+  if (++(lock->depth) == 0) /* wraparound? */
+    abort ();
+}
+
+void
+glthread_recursive_lock_unlock (gl_recursive_lock_t *lock)
+{
+  if (lock->owner != pthread_self ())
+    abort ();
+  if (lock->depth == 0)
+    abort ();
+  if (--(lock->depth) == 0)
+    {
+      lock->owner = (pthread_t) 0;
+      if (pthread_mutex_unlock (&lock->mutex) != 0)
+       abort ();
+    }
+}
+
+void
+glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
+{
+  if (lock->owner != (pthread_t) 0)
+    abort ();
+  if (pthread_mutex_destroy (&lock->mutex) != 0)
+    abort ();
+}
+
+# endif
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT;
+
+int
+glthread_once_singlethreaded (pthread_once_t *once_control)
+{
+  /* We don't know whether pthread_once_t is an integer type, a floating-point
+     type, a pointer type, or a structure type.  */
+  char *firstbyte = (char *)once_control;
+  if (*firstbyte == *(const char *)&fresh_once)
+    {
+      /* First time use of once_control.  Invert the first byte.  */
+      *firstbyte = ~ *(const char *)&fresh_once;
+      return 1;
+    }
+  else
+    return 0;
+}
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_PTH_THREADS
+
+/* Use the GNU Pth threads library.  */
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+void
+glthread_once_call (void *arg)
+{
+  void (**gl_once_temp_addr) (void) = (void (**) (void)) arg;
+  void (*initfunction) (void) = *gl_once_temp_addr;
+  initfunction ();
+}
+
+int
+glthread_once_singlethreaded (pth_once_t *once_control)
+{
+  /* We know that pth_once_t is an integer type.  */
+  if (*once_control == PTH_ONCE_INIT)
+    {
+      /* First time use of once_control.  Invert the marker.  */
+      *once_control = ~ PTH_ONCE_INIT;
+      return 1;
+    }
+  else
+    return 0;
+}
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_SOLARIS_THREADS
+
+/* Use the old Solaris threads library.  */
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+void
+glthread_recursive_lock_init (gl_recursive_lock_t *lock)
+{
+  if (mutex_init (&lock->mutex, USYNC_THREAD, NULL) != 0)
+    abort ();
+  lock->owner = (thread_t) 0;
+  lock->depth = 0;
+}
+
+void
+glthread_recursive_lock_lock (gl_recursive_lock_t *lock)
+{
+  thread_t self = thr_self ();
+  if (lock->owner != self)
+    {
+      if (mutex_lock (&lock->mutex) != 0)
+       abort ();
+      lock->owner = self;
+    }
+  if (++(lock->depth) == 0) /* wraparound? */
+    abort ();
+}
+
+void
+glthread_recursive_lock_unlock (gl_recursive_lock_t *lock)
+{
+  if (lock->owner != thr_self ())
+    abort ();
+  if (lock->depth == 0)
+    abort ();
+  if (--(lock->depth) == 0)
+    {
+      lock->owner = (thread_t) 0;
+      if (mutex_unlock (&lock->mutex) != 0)
+       abort ();
+    }
+}
+
+void
+glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
+{
+  if (lock->owner != (thread_t) 0)
+    abort ();
+  if (mutex_destroy (&lock->mutex) != 0)
+    abort ();
+}
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+void
+glthread_once (gl_once_t *once_control, void (*initfunction) (void))
+{
+  if (!once_control->inited)
+    {
+      /* Use the mutex to guarantee that if another thread is already calling
+        the initfunction, this thread waits until it's finished.  */
+      if (mutex_lock (&once_control->mutex) != 0)
+       abort ();
+      if (!once_control->inited)
+       {
+         once_control->inited = 1;
+         initfunction ();
+       }
+      if (mutex_unlock (&once_control->mutex) != 0)
+       abort ();
+    }
+}
+
+int
+glthread_once_singlethreaded (gl_once_t *once_control)
+{
+  /* We know that gl_once_t contains an integer type.  */
+  if (!once_control->inited)
+    {
+      /* First time use of once_control.  Invert the marker.  */
+      once_control->inited = ~ 0;
+      return 1;
+    }
+  else
+    return 0;
+}
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_WIN32_THREADS
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+void
+glthread_lock_init (gl_lock_t *lock)
+{
+  InitializeCriticalSection (&lock->lock);
+  lock->guard.done = 1;
+}
+
+void
+glthread_lock_lock (gl_lock_t *lock)
+{
+  if (!lock->guard.done)
+    {
+      if (InterlockedIncrement (&lock->guard.started) == 0)
+       /* This thread is the first one to need this lock.  Initialize it.  */
+       glthread_lock_init (lock);
+      else
+       /* Yield the CPU while waiting for another thread to finish
+          initializing this lock.  */
+       while (!lock->guard.done)
+         Sleep (0);
+    }
+  EnterCriticalSection (&lock->lock);
+}
+
+void
+glthread_lock_unlock (gl_lock_t *lock)
+{
+  if (!lock->guard.done)
+    abort ();
+  LeaveCriticalSection (&lock->lock);
+}
+
+void
+glthread_lock_destroy (gl_lock_t *lock)
+{
+  if (!lock->guard.done)
+    abort ();
+  DeleteCriticalSection (&lock->lock);
+  lock->guard.done = 0;
+}
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+static inline void
+gl_waitqueue_init (gl_waitqueue_t *wq)
+{
+  wq->array = NULL;
+  wq->count = 0;
+  wq->alloc = 0;
+  wq->offset = 0;
+}
+
+/* Enqueues the current thread, represented by an event, in a wait queue.
+   Returns INVALID_HANDLE_VALUE if an allocation failure occurs.  */
+static HANDLE
+gl_waitqueue_add (gl_waitqueue_t *wq)
+{
+  HANDLE event;
+  unsigned int index;
+
+  if (wq->count == wq->alloc)
+    {
+      unsigned int new_alloc = 2 * wq->alloc + 1;
+      HANDLE *new_array =
+       (HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE));
+      if (new_array == NULL)
+       /* No more memory.  */
+       return INVALID_HANDLE_VALUE;
+      /* Now is a good opportunity to rotate the array so that its contents
+        starts at offset 0.  */
+      if (wq->offset > 0)
+       {
+         unsigned int old_count = wq->count;
+         unsigned int old_alloc = wq->alloc;
+         unsigned int old_offset = wq->offset;
+         unsigned int i;
+         if (old_offset + old_count > old_alloc)
+           {
+             unsigned int limit = old_offset + old_count - old_alloc;
+             for (i = 0; i < limit; i++)
+               new_array[old_alloc + i] = new_array[i];
+           }
+         for (i = 0; i < old_count; i++)
+           new_array[i] = new_array[old_offset + i];
+         wq->offset = 0;
+       }
+      wq->array = new_array;
+      wq->alloc = new_alloc;
+    }
+  event = CreateEvent (NULL, TRUE, FALSE, NULL);
+  if (event == INVALID_HANDLE_VALUE)
+    /* No way to allocate an event.  */
+    return INVALID_HANDLE_VALUE;
+  index = wq->offset + wq->count;
+  if (index >= wq->alloc)
+    index -= wq->alloc;
+  wq->array[index] = event;
+  wq->count++;
+  return event;
+}
+
+/* Notifies the first thread from a wait queue and dequeues it.  */
+static inline void
+gl_waitqueue_notify_first (gl_waitqueue_t *wq)
+{
+  SetEvent (wq->array[wq->offset + 0]);
+  wq->offset++;
+  wq->count--;
+  if (wq->count == 0 || wq->offset == wq->alloc)
+    wq->offset = 0;
+}
+
+/* Notifies all threads from a wait queue and dequeues them all.  */
+static inline void
+gl_waitqueue_notify_all (gl_waitqueue_t *wq)
+{
+  unsigned int i;
+
+  for (i = 0; i < wq->count; i++)
+    {
+      unsigned int index = wq->offset + i;
+      if (index >= wq->alloc)
+       index -= wq->alloc;
+      SetEvent (wq->array[index]);
+    }
+  wq->count = 0;
+  wq->offset = 0;
+}
+
+void
+glthread_rwlock_init (gl_rwlock_t *lock)
+{
+  InitializeCriticalSection (&lock->lock);
+  gl_waitqueue_init (&lock->waiting_readers);
+  gl_waitqueue_init (&lock->waiting_writers);
+  lock->runcount = 0;
+  lock->guard.done = 1;
+}
+
+void
+glthread_rwlock_rdlock (gl_rwlock_t *lock)
+{
+  if (!lock->guard.done)
+    {
+      if (InterlockedIncrement (&lock->guard.started) == 0)
+       /* This thread is the first one to need this lock.  Initialize it.  */
+       glthread_rwlock_init (lock);
+      else
+       /* Yield the CPU while waiting for another thread to finish
+          initializing this lock.  */
+       while (!lock->guard.done)
+         Sleep (0);
+    }
+  EnterCriticalSection (&lock->lock);
+  /* Test whether only readers are currently running, and whether the runcount
+     field will not overflow.  */
+  if (!(lock->runcount + 1 > 0))
+    {
+      /* This thread has to wait for a while.  Enqueue it among the
+        waiting_readers.  */
+      HANDLE event = gl_waitqueue_add (&lock->waiting_readers);
+      if (event != INVALID_HANDLE_VALUE)
+       {
+         DWORD result;
+         LeaveCriticalSection (&lock->lock);
+         /* Wait until another thread signals this event.  */
+         result = WaitForSingleObject (event, INFINITE);
+         if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
+           abort ();
+         CloseHandle (event);
+         /* The thread which signalled the event already did the bookkeeping:
+            removed us from the waiting_readers, incremented lock->runcount.  */
+         if (!(lock->runcount > 0))
+           abort ();
+         return;
+       }
+      else
+       {
+         /* Allocation failure.  Weird.  */
+         do
+           {
+             LeaveCriticalSection (&lock->lock);
+             Sleep (1);
+             EnterCriticalSection (&lock->lock);
+           }
+         while (!(lock->runcount + 1 > 0));
+       }
+    }
+  lock->runcount++;
+  LeaveCriticalSection (&lock->lock);
+}
+
+void
+glthread_rwlock_wrlock (gl_rwlock_t *lock)
+{
+  if (!lock->guard.done)
+    {
+      if (InterlockedIncrement (&lock->guard.started) == 0)
+       /* This thread is the first one to need this lock.  Initialize it.  */
+       glthread_rwlock_init (lock);
+      else
+       /* Yield the CPU while waiting for another thread to finish
+          initializing this lock.  */
+       while (!lock->guard.done)
+         Sleep (0);
+    }
+  EnterCriticalSection (&lock->lock);
+  /* Test whether no readers or writers are currently running.  */
+  if (!(lock->runcount == 0))
+    {
+      /* This thread has to wait for a while.  Enqueue it among the
+        waiting_writers.  */
+      HANDLE event = gl_waitqueue_add (&lock->waiting_writers);
+      if (event != INVALID_HANDLE_VALUE)
+       {
+         DWORD result;
+         LeaveCriticalSection (&lock->lock);
+         /* Wait until another thread signals this event.  */
+         result = WaitForSingleObject (event, INFINITE);
+         if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
+           abort ();
+         CloseHandle (event);
+         /* The thread which signalled the event already did the bookkeeping:
+            removed us from the waiting_writers, set lock->runcount = -1.  */
+         if (!(lock->runcount == -1))
+           abort ();
+         return;
+       }
+      else
+       {
+         /* Allocation failure.  Weird.  */
+         do
+           {
+             LeaveCriticalSection (&lock->lock);
+             Sleep (1);
+             EnterCriticalSection (&lock->lock);
+           }
+         while (!(lock->runcount == 0));
+       }
+    }
+  lock->runcount--; /* runcount becomes -1 */
+  LeaveCriticalSection (&lock->lock);
+}
+
+void
+glthread_rwlock_unlock (gl_rwlock_t *lock)
+{
+  if (!lock->guard.done)
+    abort ();
+  EnterCriticalSection (&lock->lock);
+  if (lock->runcount < 0)
+    {
+      /* Drop a writer lock.  */
+      if (!(lock->runcount == -1))
+       abort ();
+      lock->runcount = 0;
+    }
+  else
+    {
+      /* Drop a reader lock.  */
+      if (!(lock->runcount > 0))
+       abort ();
+      lock->runcount--;
+    }
+  if (lock->runcount == 0)
+    {
+      /* POSIX recommends that "write locks shall take precedence over read
+        locks", to avoid "writer starvation".  */
+      if (lock->waiting_writers.count > 0)
+       {
+         /* Wake up one of the waiting writers.  */
+         lock->runcount--;
+         gl_waitqueue_notify_first (&lock->waiting_writers);
+       }
+      else
+       {
+         /* Wake up all waiting readers.  */
+         lock->runcount += lock->waiting_readers.count;
+         gl_waitqueue_notify_all (&lock->waiting_readers);
+       }
+    }
+  LeaveCriticalSection (&lock->lock);
+}
+
+void
+glthread_rwlock_destroy (gl_rwlock_t *lock)
+{
+  if (!lock->guard.done)
+    abort ();
+  if (lock->runcount != 0)
+    abort ();
+  DeleteCriticalSection (&lock->lock);
+  if (lock->waiting_readers.array != NULL)
+    free (lock->waiting_readers.array);
+  if (lock->waiting_writers.array != NULL)
+    free (lock->waiting_writers.array);
+  lock->guard.done = 0;
+}
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+void
+glthread_recursive_lock_init (gl_recursive_lock_t *lock)
+{
+  lock->owner = 0;
+  lock->depth = 0;
+  InitializeCriticalSection (&lock->lock);
+  lock->guard.done = 1;
+}
+
+void
+glthread_recursive_lock_lock (gl_recursive_lock_t *lock)
+{
+  if (!lock->guard.done)
+    {
+      if (InterlockedIncrement (&lock->guard.started) == 0)
+       /* This thread is the first one to need this lock.  Initialize it.  */
+       glthread_recursive_lock_init (lock);
+      else
+       /* Yield the CPU while waiting for another thread to finish
+          initializing this lock.  */
+       while (!lock->guard.done)
+         Sleep (0);
+    }
+  {
+    DWORD self = GetCurrentThreadId ();
+    if (lock->owner != self)
+      {
+       EnterCriticalSection (&lock->lock);
+       lock->owner = self;
+      }
+    if (++(lock->depth) == 0) /* wraparound? */
+      abort ();
+  }
+}
+
+void
+glthread_recursive_lock_unlock (gl_recursive_lock_t *lock)
+{
+  if (lock->owner != GetCurrentThreadId ())
+    abort ();
+  if (lock->depth == 0)
+    abort ();
+  if (--(lock->depth) == 0)
+    {
+      lock->owner = 0;
+      LeaveCriticalSection (&lock->lock);
+    }
+}
+
+void
+glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
+{
+  if (lock->owner != 0)
+    abort ();
+  DeleteCriticalSection (&lock->lock);
+  lock->guard.done = 0;
+}
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+void
+glthread_once (gl_once_t *once_control, void (*initfunction) (void))
+{
+  if (once_control->inited <= 0)
+    {
+      if (InterlockedIncrement (&once_control->started) == 0)
+       {
+         /* This thread is the first one to come to this once_control.  */
+         InitializeCriticalSection (&once_control->lock);
+         EnterCriticalSection (&once_control->lock);
+         once_control->inited = 0;
+         initfunction ();
+         once_control->inited = 1;
+         LeaveCriticalSection (&once_control->lock);
+       }
+      else
+       {
+         /* Undo last operation.  */
+         InterlockedDecrement (&once_control->started);
+         /* Some other thread has already started the initialization.
+            Yield the CPU while waiting for the other thread to finish
+            initializing and taking the lock.  */
+         while (once_control->inited < 0)
+           Sleep (0);
+         if (once_control->inited <= 0)
+           {
+             /* Take the lock.  This blocks until the other thread has
+                finished calling the initfunction.  */
+             EnterCriticalSection (&once_control->lock);
+             LeaveCriticalSection (&once_control->lock);
+             if (!(once_control->inited > 0))
+               abort ();
+           }
+       }
+    }
+}
+
+#endif
+
+/* ========================================================================= */
diff --git a/intl/lock.h b/intl/lock.h
new file mode 100644 (file)
index 0000000..be99139
--- /dev/null
@@ -0,0 +1,801 @@
+/* Locking in multithreaded situations.
+   Copyright (C) 2005 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
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h,
+   gthr-win32.h.  */
+
+/* This file contains locking primitives for use with a given thread library.
+   It does not contain primitives for creating threads or for other
+   synchronization primitives.
+
+   Normal (non-recursive) locks:
+     Type:                gl_lock_t
+     Declaration:         gl_lock_define(extern, name)
+     Initializer:         gl_lock_define_initialized(, name)
+     Initialization:      gl_lock_init (name);
+     Taking the lock:     gl_lock_lock (name);
+     Releasing the lock:  gl_lock_unlock (name);
+     De-initialization:   gl_lock_destroy (name);
+
+   Read-Write (non-recursive) locks:
+     Type:                gl_rwlock_t
+     Declaration:         gl_rwlock_define(extern, name)
+     Initializer:         gl_rwlock_define_initialized(, name)
+     Initialization:      gl_rwlock_init (name);
+     Taking the lock:     gl_rwlock_rdlock (name);
+                          gl_rwlock_wrlock (name);
+     Releasing the lock:  gl_rwlock_unlock (name);
+     De-initialization:   gl_rwlock_destroy (name);
+
+   Recursive locks:
+     Type:                gl_recursive_lock_t
+     Declaration:         gl_recursive_lock_define(extern, name)
+     Initializer:         gl_recursive_lock_define_initialized(, name)
+     Initialization:      gl_recursive_lock_init (name);
+     Taking the lock:     gl_recursive_lock_lock (name);
+     Releasing the lock:  gl_recursive_lock_unlock (name);
+     De-initialization:   gl_recursive_lock_destroy (name);
+
+  Once-only execution:
+     Type:                gl_once_t
+     Initializer:         gl_once_define(extern, name)
+     Execution:           gl_once (name, initfunction);
+*/
+
+
+#ifndef _LOCK_H
+#define _LOCK_H
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS
+
+/* Use the POSIX threads library.  */
+
+# include <pthread.h>
+# include <stdlib.h>
+
+# if PTHREAD_IN_USE_DETECTION_HARD
+
+/* The pthread_in_use() detection needs to be done at runtime.  */
+#  define pthread_in_use() \
+     glthread_in_use ()
+extern int glthread_in_use (void);
+
+# endif
+
+# if USE_POSIX_THREADS_WEAK
+
+/* Use weak references to the POSIX threads library.  */
+
+/* Weak references avoid dragging in external libraries if the other parts
+   of the program don't use them.  Here we use them, because we don't want
+   every program that uses libintl to depend on libpthread.  This assumes
+   that libpthread would not be loaded after libintl; i.e. if libintl is
+   loaded first, by an executable that does not depend on libpthread, and
+   then a module is dynamically loaded that depends on libpthread, libintl
+   will not be multithread-safe.  */
+
+/* The way to test at runtime whether libpthread is present is to test
+   whether a function pointer's value, such as &pthread_mutex_init, is
+   non-NULL.  However, some versions of GCC have a bug through which, in
+   PIC mode, &foo != NULL always evaluates to true if there is a direct
+   call to foo(...) in the same function.  To avoid this, we test the
+   address of a function in libpthread that we don't use.  */
+
+#  pragma weak pthread_mutex_init
+#  pragma weak pthread_mutex_lock
+#  pragma weak pthread_mutex_unlock
+#  pragma weak pthread_mutex_destroy
+#  pragma weak pthread_rwlock_init
+#  pragma weak pthread_rwlock_rdlock
+#  pragma weak pthread_rwlock_wrlock
+#  pragma weak pthread_rwlock_unlock
+#  pragma weak pthread_rwlock_destroy
+#  pragma weak pthread_once
+#  pragma weak pthread_cond_init
+#  pragma weak pthread_cond_wait
+#  pragma weak pthread_cond_signal
+#  pragma weak pthread_cond_broadcast
+#  pragma weak pthread_cond_destroy
+#  pragma weak pthread_mutexattr_init
+#  pragma weak pthread_mutexattr_settype
+#  pragma weak pthread_mutexattr_destroy
+#  ifndef pthread_self
+#   pragma weak pthread_self
+#  endif
+
+#  if !PTHREAD_IN_USE_DETECTION_HARD
+#   pragma weak pthread_cancel
+#   define pthread_in_use() (pthread_cancel != NULL)
+#  endif
+
+# else
+
+#  if !PTHREAD_IN_USE_DETECTION_HARD
+#   define pthread_in_use() 1
+#  endif
+
+# endif
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+typedef pthread_mutex_t gl_lock_t;
+# define gl_lock_define(STORAGECLASS, NAME) \
+    STORAGECLASS pthread_mutex_t NAME;
+# define gl_lock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS pthread_mutex_t NAME = gl_lock_initializer;
+# define gl_lock_initializer \
+    PTHREAD_MUTEX_INITIALIZER
+# define gl_lock_init(NAME) \
+    if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) abort ()
+# define gl_lock_lock(NAME) \
+    if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) abort ()
+# define gl_lock_unlock(NAME) \
+    if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) abort ()
+# define gl_lock_destroy(NAME) \
+    if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) abort ()
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+# if HAVE_PTHREAD_RWLOCK
+
+#  ifdef PTHREAD_RWLOCK_INITIALIZER
+
+typedef pthread_rwlock_t gl_rwlock_t;
+#   define gl_rwlock_define(STORAGECLASS, NAME) \
+      STORAGECLASS pthread_rwlock_t NAME;
+#   define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
+      STORAGECLASS pthread_rwlock_t NAME = gl_rwlock_initializer;
+#   define gl_rwlock_initializer \
+      PTHREAD_RWLOCK_INITIALIZER
+#   define gl_rwlock_init(NAME) \
+      if (pthread_in_use () && pthread_rwlock_init (&NAME, NULL) != 0) abort ()
+#   define gl_rwlock_rdlock(NAME) \
+      if (pthread_in_use () && pthread_rwlock_rdlock (&NAME) != 0) abort ()
+#   define gl_rwlock_wrlock(NAME) \
+      if (pthread_in_use () && pthread_rwlock_wrlock (&NAME) != 0) abort ()
+#   define gl_rwlock_unlock(NAME) \
+      if (pthread_in_use () && pthread_rwlock_unlock (&NAME) != 0) abort ()
+#   define gl_rwlock_destroy(NAME) \
+      if (pthread_in_use () && pthread_rwlock_destroy (&NAME) != 0) abort ()
+
+#  else
+
+typedef struct
+        {
+          int initialized;
+          pthread_mutex_t guard;   /* protects the initialization */
+          pthread_rwlock_t rwlock; /* read-write lock */
+        }
+        gl_rwlock_t;
+#   define gl_rwlock_define(STORAGECLASS, NAME) \
+      STORAGECLASS gl_rwlock_t NAME;
+#   define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
+      STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
+#   define gl_rwlock_initializer \
+      { 0, PTHREAD_MUTEX_INITIALIZER }
+#   define gl_rwlock_init(NAME) \
+      if (pthread_in_use ()) glthread_rwlock_init (&NAME)
+#   define gl_rwlock_rdlock(NAME) \
+      if (pthread_in_use ()) glthread_rwlock_rdlock (&NAME)
+#   define gl_rwlock_wrlock(NAME) \
+      if (pthread_in_use ()) glthread_rwlock_wrlock (&NAME)
+#   define gl_rwlock_unlock(NAME) \
+      if (pthread_in_use ()) glthread_rwlock_unlock (&NAME)
+#   define gl_rwlock_destroy(NAME) \
+      if (pthread_in_use ()) glthread_rwlock_destroy (&NAME)
+extern void glthread_rwlock_init (gl_rwlock_t *lock);
+extern void glthread_rwlock_rdlock (gl_rwlock_t *lock);
+extern void glthread_rwlock_wrlock (gl_rwlock_t *lock);
+extern void glthread_rwlock_unlock (gl_rwlock_t *lock);
+extern void glthread_rwlock_destroy (gl_rwlock_t *lock);
+
+#  endif
+
+# else
+
+typedef struct
+        {
+          pthread_mutex_t lock; /* protects the remaining fields */
+          pthread_cond_t waiting_readers; /* waiting readers */
+          pthread_cond_t waiting_writers; /* waiting writers */
+          unsigned int waiting_writers_count; /* number of waiting writers */
+          int runcount; /* number of readers running, or -1 when a writer runs */
+        }
+        gl_rwlock_t;
+# define gl_rwlock_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_rwlock_t NAME;
+# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
+# define gl_rwlock_initializer \
+    { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
+# define gl_rwlock_init(NAME) \
+    if (pthread_in_use ()) glthread_rwlock_init (&NAME)
+# define gl_rwlock_rdlock(NAME) \
+    if (pthread_in_use ()) glthread_rwlock_rdlock (&NAME)
+# define gl_rwlock_wrlock(NAME) \
+    if (pthread_in_use ()) glthread_rwlock_wrlock (&NAME)
+# define gl_rwlock_unlock(NAME) \
+    if (pthread_in_use ()) glthread_rwlock_unlock (&NAME)
+# define gl_rwlock_destroy(NAME) \
+    if (pthread_in_use ()) glthread_rwlock_destroy (&NAME)
+extern void glthread_rwlock_init (gl_rwlock_t *lock);
+extern void glthread_rwlock_rdlock (gl_rwlock_t *lock);
+extern void glthread_rwlock_wrlock (gl_rwlock_t *lock);
+extern void glthread_rwlock_unlock (gl_rwlock_t *lock);
+extern void glthread_rwlock_destroy (gl_rwlock_t *lock);
+
+# endif
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+# if HAVE_PTHREAD_MUTEX_RECURSIVE
+
+#  if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+
+typedef pthread_mutex_t gl_recursive_lock_t;
+#   define gl_recursive_lock_define(STORAGECLASS, NAME) \
+      STORAGECLASS pthread_mutex_t NAME;
+#   define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
+      STORAGECLASS pthread_mutex_t NAME = gl_recursive_lock_initializer;
+#   ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#    define gl_recursive_lock_initializer \
+       PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#   else
+#    define gl_recursive_lock_initializer \
+       PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#   endif
+#   define gl_recursive_lock_init(NAME) \
+      if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) abort ()
+#   define gl_recursive_lock_lock(NAME) \
+      if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) abort ()
+#   define gl_recursive_lock_unlock(NAME) \
+      if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) abort ()
+#   define gl_recursive_lock_destroy(NAME) \
+      if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) abort ()
+
+#  else
+
+typedef struct
+        {
+          pthread_mutex_t recmutex; /* recursive mutex */
+          pthread_mutex_t guard;    /* protects the initialization */
+          int initialized;
+        }
+        gl_recursive_lock_t;
+#   define gl_recursive_lock_define(STORAGECLASS, NAME) \
+      STORAGECLASS gl_recursive_lock_t NAME;
+#   define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
+      STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
+#   define gl_recursive_lock_initializer \
+      { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 0 }
+#   define gl_recursive_lock_init(NAME) \
+      if (pthread_in_use ()) glthread_recursive_lock_init (&NAME)
+#   define gl_recursive_lock_lock(NAME) \
+      if (pthread_in_use ()) glthread_recursive_lock_lock (&NAME)
+#   define gl_recursive_lock_unlock(NAME) \
+      if (pthread_in_use ()) glthread_recursive_lock_unlock (&NAME)
+#   define gl_recursive_lock_destroy(NAME) \
+      if (pthread_in_use ()) glthread_recursive_lock_destroy (&NAME)
+extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
+extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
+extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
+extern void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock);
+
+#  endif
+
+# else
+
+/* Old versions of POSIX threads on Solaris did not have recursive locks.
+   We have to implement them ourselves.  */
+
+typedef struct
+        {
+          pthread_mutex_t mutex;
+          pthread_t owner;
+          unsigned long depth;
+        }
+        gl_recursive_lock_t;
+#  define gl_recursive_lock_define(STORAGECLASS, NAME) \
+     STORAGECLASS gl_recursive_lock_t NAME;
+#  define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
+     STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
+#  define gl_recursive_lock_initializer \
+     { PTHREAD_MUTEX_INITIALIZER, (pthread_t) 0, 0 }
+#  define gl_recursive_lock_init(NAME) \
+     if (pthread_in_use ()) glthread_recursive_lock_init (&NAME)
+#  define gl_recursive_lock_lock(NAME) \
+     if (pthread_in_use ()) glthread_recursive_lock_lock (&NAME)
+#  define gl_recursive_lock_unlock(NAME) \
+     if (pthread_in_use ()) glthread_recursive_lock_unlock (&NAME)
+#  define gl_recursive_lock_destroy(NAME) \
+     if (pthread_in_use ()) glthread_recursive_lock_destroy (&NAME)
+extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
+extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
+extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
+extern void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock);
+
+# endif
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef pthread_once_t gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+    STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT;
+# define gl_once(NAME, INITFUNCTION) \
+    do                                                   \
+      {                                                  \
+        if (pthread_in_use ())                           \
+          {                                              \
+            if (pthread_once (&NAME, INITFUNCTION) != 0) \
+              abort ();                                  \
+          }                                              \
+        else                                             \
+          {                                              \
+            if (glthread_once_singlethreaded (&NAME))    \
+              INITFUNCTION ();                           \
+          }                                              \
+      }                                                  \
+    while (0)
+extern int glthread_once_singlethreaded (pthread_once_t *once_control);
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_PTH_THREADS
+
+/* Use the GNU Pth threads library.  */
+
+# include <pth.h>
+# include <stdlib.h>
+
+# if USE_PTH_THREADS_WEAK
+
+/* Use weak references to the GNU Pth threads library.  */
+
+#  pragma weak pth_mutex_init
+#  pragma weak pth_mutex_acquire
+#  pragma weak pth_mutex_release
+#  pragma weak pth_rwlock_init
+#  pragma weak pth_rwlock_acquire
+#  pragma weak pth_rwlock_release
+#  pragma weak pth_once
+
+#  pragma weak pth_cancel
+#  define pth_in_use() (pth_cancel != NULL)
+
+# else
+
+#  define pth_in_use() 1
+
+# endif
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+typedef pth_mutex_t gl_lock_t;
+# define gl_lock_define(STORAGECLASS, NAME) \
+    STORAGECLASS pth_mutex_t NAME;
+# define gl_lock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS pth_mutex_t NAME = gl_lock_initializer;
+# define gl_lock_initializer \
+    PTH_MUTEX_INIT
+# define gl_lock_init(NAME) \
+    if (pth_in_use() && !pth_mutex_init (&NAME)) abort ()
+# define gl_lock_lock(NAME) \
+    if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) abort ()
+# define gl_lock_unlock(NAME) \
+    if (pth_in_use() && !pth_mutex_release (&NAME)) abort ()
+# define gl_lock_destroy(NAME) \
+    (void)(&NAME)
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+typedef pth_rwlock_t gl_rwlock_t;
+#  define gl_rwlock_define(STORAGECLASS, NAME) \
+     STORAGECLASS pth_rwlock_t NAME;
+#  define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
+     STORAGECLASS pth_rwlock_t NAME = gl_rwlock_initializer;
+#  define gl_rwlock_initializer \
+     PTH_RWLOCK_INIT
+#  define gl_rwlock_init(NAME) \
+     if (pth_in_use() && !pth_rwlock_init (&NAME)) abort ()
+#  define gl_rwlock_rdlock(NAME) \
+     if (pth_in_use() && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RD, 0, NULL)) abort ()
+#  define gl_rwlock_wrlock(NAME) \
+     if (pth_in_use() && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RW, 0, NULL)) abort ()
+#  define gl_rwlock_unlock(NAME) \
+     if (pth_in_use() && !pth_rwlock_release (&NAME)) abort ()
+#  define gl_rwlock_destroy(NAME) \
+     (void)(&NAME)
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+/* In Pth, mutexes are recursive by default.  */
+typedef pth_mutex_t gl_recursive_lock_t;
+#  define gl_recursive_lock_define(STORAGECLASS, NAME) \
+     STORAGECLASS pth_mutex_t NAME;
+#  define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
+     STORAGECLASS pth_mutex_t NAME = gl_recursive_lock_initializer;
+#  define gl_recursive_lock_initializer \
+     PTH_MUTEX_INIT
+#  define gl_recursive_lock_init(NAME) \
+     if (pth_in_use() && !pth_mutex_init (&NAME)) abort ()
+#  define gl_recursive_lock_lock(NAME) \
+     if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) abort ()
+#  define gl_recursive_lock_unlock(NAME) \
+     if (pth_in_use() && !pth_mutex_release (&NAME)) abort ()
+#  define gl_recursive_lock_destroy(NAME) \
+     (void)(&NAME)
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef pth_once_t gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+    STORAGECLASS pth_once_t NAME = PTH_ONCE_INIT;
+# define gl_once(NAME, INITFUNCTION) \
+    do                                                                \
+      {                                                               \
+        if (pth_in_use ())                                            \
+          {                                                           \
+            void (*gl_once_temp) (void) = INITFUNCTION;               \
+            if (!pth_once (&NAME, glthread_once_call, &gl_once_temp)) \
+              abort ();                                               \
+          }                                                           \
+        else                                                          \
+          {                                                           \
+            if (glthread_once_singlethreaded (&NAME))                 \
+              INITFUNCTION ();                                        \
+          }                                                           \
+      }                                                               \
+    while (0)
+extern void glthread_once_call (void *arg);
+extern int glthread_once_singlethreaded (pth_once_t *once_control);
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_SOLARIS_THREADS
+
+/* Use the old Solaris threads library.  */
+
+# include <thread.h>
+# include <synch.h>
+# include <stdlib.h>
+
+# if USE_SOLARIS_THREADS_WEAK
+
+/* Use weak references to the old Solaris threads library.  */
+
+#  pragma weak mutex_init
+#  pragma weak mutex_lock
+#  pragma weak mutex_unlock
+#  pragma weak mutex_destroy
+#  pragma weak rwlock_init
+#  pragma weak rw_rdlock
+#  pragma weak rw_wrlock
+#  pragma weak rw_unlock
+#  pragma weak rwlock_destroy
+#  pragma weak thr_self
+
+#  pragma weak thr_suspend
+#  define thread_in_use() (thr_suspend != NULL)
+
+# else
+
+#  define thread_in_use() 1
+
+# endif
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+typedef mutex_t gl_lock_t;
+# define gl_lock_define(STORAGECLASS, NAME) \
+    STORAGECLASS mutex_t NAME;
+# define gl_lock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS mutex_t NAME = gl_lock_initializer;
+# define gl_lock_initializer \
+    DEFAULTMUTEX
+# define gl_lock_init(NAME) \
+    if (thread_in_use () && mutex_init (&NAME, USYNC_THREAD, NULL) != 0) abort ()
+# define gl_lock_lock(NAME) \
+    if (thread_in_use () && mutex_lock (&NAME) != 0) abort ()
+# define gl_lock_unlock(NAME) \
+    if (thread_in_use () && mutex_unlock (&NAME) != 0) abort ()
+# define gl_lock_destroy(NAME) \
+    if (thread_in_use () && mutex_destroy (&NAME) != 0) abort ()
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+typedef rwlock_t gl_rwlock_t;
+# define gl_rwlock_define(STORAGECLASS, NAME) \
+    STORAGECLASS rwlock_t NAME;
+# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS rwlock_t NAME = gl_rwlock_initializer;
+# define gl_rwlock_initializer \
+    DEFAULTRWLOCK
+# define gl_rwlock_init(NAME) \
+    if (thread_in_use () && rwlock_init (&NAME, USYNC_THREAD, NULL) != 0) abort ()
+# define gl_rwlock_rdlock(NAME) \
+    if (thread_in_use () && rw_rdlock (&NAME) != 0) abort ()
+# define gl_rwlock_wrlock(NAME) \
+    if (thread_in_use () && rw_wrlock (&NAME) != 0) abort ()
+# define gl_rwlock_unlock(NAME) \
+    if (thread_in_use () && rw_unlock (&NAME) != 0) abort ()
+# define gl_rwlock_destroy(NAME) \
+    if (thread_in_use () && rwlock_destroy (&NAME) != 0) abort ()
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+/* Old Solaris threads did not have recursive locks.
+   We have to implement them ourselves.  */
+
+typedef struct
+        {
+          mutex_t mutex;
+          thread_t owner;
+          unsigned long depth;
+        }
+        gl_recursive_lock_t;
+# define gl_recursive_lock_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_recursive_lock_t NAME;
+# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
+# define gl_recursive_lock_initializer \
+    { DEFAULTMUTEX, (thread_t) 0, 0 }
+# define gl_recursive_lock_init(NAME) \
+    if (thread_in_use ()) glthread_recursive_lock_init (&NAME)
+# define gl_recursive_lock_lock(NAME) \
+    if (thread_in_use ()) glthread_recursive_lock_lock (&NAME)
+# define gl_recursive_lock_unlock(NAME) \
+    if (thread_in_use ()) glthread_recursive_lock_unlock (&NAME)
+# define gl_recursive_lock_destroy(NAME) \
+    if (thread_in_use ()) glthread_recursive_lock_destroy (&NAME)
+extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
+extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
+extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
+extern void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock);
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef struct
+        {
+          volatile int inited;
+          mutex_t mutex;
+        }
+        gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_once_t NAME = { 0, DEFAULTMUTEX };
+# define gl_once(NAME, INITFUNCTION) \
+    do                                                \
+      {                                               \
+        if (thread_in_use ())                         \
+          {                                           \
+            glthread_once (&NAME, INITFUNCTION);      \
+          }                                           \
+        else                                          \
+          {                                           \
+            if (glthread_once_singlethreaded (&NAME)) \
+              INITFUNCTION ();                        \
+          }                                           \
+      }                                               \
+    while (0)
+extern void glthread_once (gl_once_t *once_control, void (*initfunction) (void));
+extern int glthread_once_singlethreaded (gl_once_t *once_control);
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_WIN32_THREADS
+
+# include <windows.h>
+
+/* We can use CRITICAL_SECTION directly, rather than the Win32 Event, Mutex,
+   Semaphore types, because
+     - we need only to synchronize inside a single process (address space),
+       not inter-process locking,
+     - we don't need to support trylock operations.  (TryEnterCriticalSection
+       does not work on Windows 95/98/ME.  Packages that need trylock usually
+       define their own mutex type.)  */
+
+/* There is no way to statically initialize a CRITICAL_SECTION.  It needs
+   to be done lazily, once only.  For this we need spinlocks.  */
+
+typedef struct { volatile int done; volatile long started; } gl_spinlock_t;
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+typedef struct
+        {
+          gl_spinlock_t guard; /* protects the initialization */
+          CRITICAL_SECTION lock;
+        }
+        gl_lock_t;
+# define gl_lock_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_lock_t NAME;
+# define gl_lock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS gl_lock_t NAME = gl_lock_initializer;
+# define gl_lock_initializer \
+    { { 0, -1 } }
+# define gl_lock_init(NAME) \
+    glthread_lock_init (&NAME)
+# define gl_lock_lock(NAME) \
+    glthread_lock_lock (&NAME)
+# define gl_lock_unlock(NAME) \
+    glthread_lock_unlock (&NAME)
+# define gl_lock_destroy(NAME) \
+    glthread_lock_destroy (&NAME)
+extern void glthread_lock_init (gl_lock_t *lock);
+extern void glthread_lock_lock (gl_lock_t *lock);
+extern void glthread_lock_unlock (gl_lock_t *lock);
+extern void glthread_lock_destroy (gl_lock_t *lock);
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+/* It is impossible to implement read-write locks using plain locks, without
+   introducing an extra thread dedicated to managing read-write locks.
+   Therefore here we need to use the low-level Event type.  */
+
+typedef struct
+        {
+          HANDLE *array; /* array of waiting threads, each represented by an event */
+          unsigned int count; /* number of waiting threads */
+          unsigned int alloc; /* length of allocated array */
+          unsigned int offset; /* index of first waiting thread in array */
+        }
+        gl_waitqueue_t;
+typedef struct
+        {
+          gl_spinlock_t guard; /* protects the initialization */
+          CRITICAL_SECTION lock; /* protects the remaining fields */
+          gl_waitqueue_t waiting_readers; /* waiting readers */
+          gl_waitqueue_t waiting_writers; /* waiting writers */
+          int runcount; /* number of readers running, or -1 when a writer runs */
+        }
+        gl_rwlock_t;
+# define gl_rwlock_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_rwlock_t NAME;
+# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
+# define gl_rwlock_initializer \
+    { { 0, -1 } }
+# define gl_rwlock_init(NAME) \
+    glthread_rwlock_init (&NAME)
+# define gl_rwlock_rdlock(NAME) \
+    glthread_rwlock_rdlock (&NAME)
+# define gl_rwlock_wrlock(NAME) \
+    glthread_rwlock_wrlock (&NAME)
+# define gl_rwlock_unlock(NAME) \
+    glthread_rwlock_unlock (&NAME)
+# define gl_rwlock_destroy(NAME) \
+    glthread_rwlock_destroy (&NAME)
+extern void glthread_rwlock_init (gl_rwlock_t *lock);
+extern void glthread_rwlock_rdlock (gl_rwlock_t *lock);
+extern void glthread_rwlock_wrlock (gl_rwlock_t *lock);
+extern void glthread_rwlock_unlock (gl_rwlock_t *lock);
+extern void glthread_rwlock_destroy (gl_rwlock_t *lock);
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+/* The Win32 documentation says that CRITICAL_SECTION already implements a
+   recursive lock.  But we need not rely on it: It's easy to implement a
+   recursive lock without this assumption.  */
+
+typedef struct
+        {
+          gl_spinlock_t guard; /* protects the initialization */
+          DWORD owner;
+          unsigned long depth;
+          CRITICAL_SECTION lock;
+        }
+        gl_recursive_lock_t;
+# define gl_recursive_lock_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_recursive_lock_t NAME;
+# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
+# define gl_recursive_lock_initializer \
+    { { 0, -1 }, 0, 0 }
+# define gl_recursive_lock_init(NAME) \
+    glthread_recursive_lock_init (&NAME)
+# define gl_recursive_lock_lock(NAME) \
+    glthread_recursive_lock_lock (&NAME)
+# define gl_recursive_lock_unlock(NAME) \
+    glthread_recursive_lock_unlock (&NAME)
+# define gl_recursive_lock_destroy(NAME) \
+    glthread_recursive_lock_destroy (&NAME)
+extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
+extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
+extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
+extern void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock);
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef struct
+        {
+          volatile int inited;
+          volatile long started;
+          CRITICAL_SECTION lock;
+        }
+        gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_once_t NAME = { -1, -1 };
+# define gl_once(NAME, INITFUNCTION) \
+    glthread_once (&NAME, INITFUNCTION)
+extern void glthread_once (gl_once_t *once_control, void (*initfunction) (void));
+
+#endif
+
+/* ========================================================================= */
+
+#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WIN32_THREADS)
+
+/* Provide dummy implementation if threads are not supported.  */
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+typedef int gl_lock_t;
+# define gl_lock_define(STORAGECLASS, NAME)
+# define gl_lock_define_initialized(STORAGECLASS, NAME)
+# define gl_lock_init(NAME)
+# define gl_lock_lock(NAME)
+# define gl_lock_unlock(NAME)
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+typedef int gl_rwlock_t;
+# define gl_rwlock_define(STORAGECLASS, NAME)
+# define gl_rwlock_define_initialized(STORAGECLASS, NAME)
+# define gl_rwlock_init(NAME)
+# define gl_rwlock_rdlock(NAME)
+# define gl_rwlock_wrlock(NAME)
+# define gl_rwlock_unlock(NAME)
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+typedef int gl_recursive_lock_t;
+# define gl_recursive_lock_define(STORAGECLASS, NAME)
+# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME)
+# define gl_recursive_lock_init(NAME)
+# define gl_recursive_lock_lock(NAME)
+# define gl_recursive_lock_unlock(NAME)
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef int gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_once_t NAME = 0;
+# define gl_once(NAME, INITFUNCTION) \
+    do                       \
+      {                      \
+        if (NAME == 0)       \
+          {                  \
+            NAME = ~ 0;      \
+            INITFUNCTION (); \
+          }                  \
+      }                      \
+    while (0)
+
+#endif
+
+/* ========================================================================= */
+
+#endif /* _LOCK_H */
index 89f82df..e3ab5d0 100644 (file)
@@ -1,5 +1,5 @@
 /* Log file output.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 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
 #include <stdlib.h>
 #include <string.h>
 
+/* Handle multi-threaded applications.  */
+#ifdef _LIBC
+# include <bits/libc-lock.h>
+#else
+# include "lock.h"
+#endif
+
 /* Print an ASCII string with quotes and escape sequences where needed.  */
 static void
 print_escaped (FILE *stream, const char *str)
@@ -48,13 +55,14 @@ print_escaped (FILE *stream, const char *str)
   putc ('"', stream);
 }
 
-/* Add to the log file an entry denoting a failed translation.  */
-void
-_nl_log_untranslated (const char *logfilename, const char *domainname,
-                     const char *msgid1, const char *msgid2, int plural)
+static char *last_logfilename = NULL;
+static FILE *last_logfile = NULL;
+__libc_lock_define_initialized (static, lock)
+
+static inline void
+_nl_log_untranslated_locked (const char *logfilename, const char *domainname,
+                            const char *msgid1, const char *msgid2, int plural)
 {
-  static char *last_logfilename = NULL;
-  static FILE *last_logfile = NULL;
   FILE *logfile;
 
   /* Can we reuse the last opened logfile?  */
@@ -96,3 +104,13 @@ _nl_log_untranslated (const char *logfilename, const char *domainname,
     fprintf (logfile, "\nmsgstr \"\"\n");
   putc ('\n', logfile);
 }
+
+/* Add to the log file an entry denoting a failed translation.  */
+void
+_nl_log_untranslated (const char *logfilename, const char *domainname,
+                     const char *msgid1, const char *msgid2, int plural)
+{
+  __libc_lock_lock (lock);
+  _nl_log_untranslated_locked (logfilename, domainname, msgid1, msgid2, plural);
+  __libc_lock_unlock (lock);
+}
index d2d8575..3cc35c0 100644 (file)
@@ -1,5 +1,5 @@
 /* OS dependent parts of libintl.
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
+   Copyright (C) 2001-2002, 2006 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
@@ -16,7 +16,9 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    USA.  */
 
-#if defined __EMX__
+#if defined __CYGWIN__
+# include "intl-exports.c"
+#elif defined __EMX__
 # include "os2compat.c"
 #else
 /* Avoid AIX compiler warning.  */
index 1873be9..f518bf1 100644 (file)
@@ -1,5 +1,5 @@
 /* Expression parsing for plural form selection.
-   Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2003, 2005 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
 
    This program is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
 
 #include "plural-exp.h"
 
-#if (defined __GNUC__ && !defined __APPLE_CC__) \
+#if (defined __GNUC__ && !(__APPLE_CC__ > 1)) \
     || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
 
 /* These structs are the constant expression for the germanic plural
index f540184..dc590d3 100644 (file)
@@ -1,5 +1,5 @@
 /* Expression parsing and evaluation for plural form selection.
-   Copyright (C) 2000-2003 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2005 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
 
    This program is free software; you can redistribute it and/or modify it
@@ -110,7 +110,7 @@ extern void EXTRACT_PLURAL_EXPRESSION (const char *nullentry,
                                       unsigned long int *npluralsp)
      internal_function;
 
-#if !defined (_LIBC) && !defined (IN_LIBINTL)
+#if !defined (_LIBC) && !defined (IN_LIBINTL) && !defined (IN_LIBGLOCALE)
 extern unsigned long int plural_eval (struct expression *pexp,
                                      unsigned long int n);
 #endif
index 78a223d..5f73b40 100644 (file)
@@ -19,7 +19,7 @@
 #line 1 "plural.y"
 
 /* Expression parsing for plural form selection.
-   Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2003, 2005 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
 
    This program is free software; you can redistribute it and/or modify it
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    USA.  */
 
-/* The bison generated parser uses alloca.  AIX 3 forces us to put this
-   declaration at the beginning of the file.  The declaration in bison's
-   skeleton file comes too late.  This must come before <config.h>
-   because <config.h> may include arbitrary system headers.  */
+/* For bison < 2.0, the bison generated parser uses alloca.  AIX 3 forces us
+   to put this declaration at the beginning of the file.  The declaration in
+   bison's skeleton file comes too late.  This must come before <config.h>
+   because <config.h> may include arbitrary system headers.
+   This can go away once the AM_INTL_SUBDIR macro requires bison >= 2.0.  */
 #if defined _AIX && !defined __GNUC__
  #pragma alloca
 #endif
@@ -51,6 +52,7 @@
 
 #include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 #include "plural-exp.h"
 
 /* The main function generated by the parser is called __gettextparse,
@@ -62,7 +64,7 @@
 #define YYLEX_PARAM    &((struct parse_args *) arg)->cp
 #define YYPARSE_PARAM  arg
 
-#line 49 "plural.y"
+#line 51 "plural.y"
 #ifndef YYSTYPE
 typedef union {
   unsigned long int num;
@@ -72,7 +74,7 @@ typedef union {
 # define YYSTYPE yystype
 # define YYSTYPE_IS_TRIVIAL 1
 #endif
-#line 55 "plural.y"
+#line 57 "plural.y"
 
 /* Prototypes for local functions.  */
 static int yylex (YYSTYPE *lval, const char **pexp);
@@ -212,8 +214,8 @@ static const short yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
 static const short yyrline[] =
 {
-       0,   150,   158,   162,   166,   170,   174,   178,   182,   186,
-     190,   194,   199
+       0,   152,   160,   164,   168,   172,   176,   180,   184,   188,
+     192,   196,   201
 };
 #endif
 
@@ -296,7 +298,7 @@ static const short yycheck[] =
 #define YYPURE 1
 
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "/home/haible/gnu/arch/linuxlibc6/share/bison/bison.simple"
+#line 3 "bison.simple"
 
 /* Skeleton output parser for bison,
 
@@ -609,7 +611,7 @@ yystpcpy (yydest, yysrc)
 # endif
 #endif
 \f
-#line 315 "/home/haible/gnu/arch/linuxlibc6/share/bison/bison.simple"
+#line 315 "bison.simple"
 
 
 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
@@ -1003,7 +1005,7 @@ yyreduce:
   switch (yyn) {
 
 case 1:
-#line 151 "plural.y"
+#line 153 "plural.y"
 {
            if (yyvsp[0].exp == NULL)
              YYABORT;
@@ -1011,75 +1013,75 @@ case 1:
          }
     break;
 case 2:
-#line 159 "plural.y"
+#line 161 "plural.y"
 {
            yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
          }
     break;
 case 3:
-#line 163 "plural.y"
+#line 165 "plural.y"
 {
            yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
          }
     break;
 case 4:
-#line 167 "plural.y"
+#line 169 "plural.y"
 {
            yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
          }
     break;
 case 5:
-#line 171 "plural.y"
+#line 173 "plural.y"
 {
            yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
          }
     break;
 case 6:
-#line 175 "plural.y"
+#line 177 "plural.y"
 {
            yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
          }
     break;
 case 7:
-#line 179 "plural.y"
+#line 181 "plural.y"
 {
            yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
          }
     break;
 case 8:
-#line 183 "plural.y"
+#line 185 "plural.y"
 {
            yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
          }
     break;
 case 9:
-#line 187 "plural.y"
+#line 189 "plural.y"
 {
            yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
          }
     break;
 case 10:
-#line 191 "plural.y"
+#line 193 "plural.y"
 {
            yyval.exp = new_exp_0 (var);
          }
     break;
 case 11:
-#line 195 "plural.y"
+#line 197 "plural.y"
 {
            if ((yyval.exp = new_exp_0 (num)) != NULL)
              yyval.exp->val.num = yyvsp[0].num;
          }
     break;
 case 12:
-#line 200 "plural.y"
+#line 202 "plural.y"
 {
            yyval.exp = yyvsp[-1].exp;
          }
     break;
 }
 
-#line 705 "/home/haible/gnu/arch/linuxlibc6/share/bison/bison.simple"
+#line 705 "bison.simple"
 
 \f
   yyvsp -= yylen;
@@ -1310,7 +1312,7 @@ yyreturn:
 #endif
   return yyresult;
 }
-#line 205 "plural.y"
+#line 207 "plural.y"
 
 
 void
index fe79112..45d68e9 100644 (file)
@@ -1,6 +1,6 @@
 %{
 /* Expression parsing for plural form selection.
-   Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2003, 2005 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
 
    This program is free software; you can redistribute it and/or modify it
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    USA.  */
 
-/* The bison generated parser uses alloca.  AIX 3 forces us to put this
-   declaration at the beginning of the file.  The declaration in bison's
-   skeleton file comes too late.  This must come before <config.h>
-   because <config.h> may include arbitrary system headers.  */
+/* For bison < 2.0, the bison generated parser uses alloca.  AIX 3 forces us
+   to put this declaration at the beginning of the file.  The declaration in
+   bison's skeleton file comes too late.  This must come before <config.h>
+   because <config.h> may include arbitrary system headers.
+   This can go away once the AM_INTL_SUBDIR macro requires bison >= 2.0.  */
 #if defined _AIX && !defined __GNUC__
  #pragma alloca
 #endif
@@ -32,6 +33,7 @@
 
 #include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 #include "plural-exp.h"
 
 /* The main function generated by the parser is called __gettextparse,
index f975901..47b73d2 100644 (file)
@@ -1,5 +1,5 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005-2006 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
@@ -80,15 +80,40 @@ printf_fetchargs (va_list args, arguments *a)
        break;
 #ifdef HAVE_WINT_T
       case TYPE_WIDE_CHAR:
-       ap->a.a_wide_char = va_arg (args, wint_t);
+       /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
+          default argument promotions", this is not the case in mingw32,
+          where wint_t is 'unsigned short'.  */
+       ap->a.a_wide_char =
+         (sizeof (wint_t) < sizeof (int)
+          ? va_arg (args, int)
+          : va_arg (args, wint_t));
        break;
 #endif
       case TYPE_STRING:
        ap->a.a_string = va_arg (args, const char *);
+       /* A null pointer is an invalid argument for "%s", but in practice
+          it occurs quite frequently in printf statements that produce
+          debug output.  Use a fallback in this case.  */
+       if (ap->a.a_string == NULL)
+         ap->a.a_string = "(NULL)";
        break;
 #ifdef HAVE_WCHAR_T
       case TYPE_WIDE_STRING:
        ap->a.a_wide_string = va_arg (args, const wchar_t *);
+       /* A null pointer is an invalid argument for "%ls", but in practice
+          it occurs quite frequently in printf statements that produce
+          debug output.  Use a fallback in this case.  */
+       if (ap->a.a_wide_string == NULL)
+         {
+           static const wchar_t wide_null_string[] =
+             {
+               (wchar_t)'(',
+               (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
+               (wchar_t)')',
+               (wchar_t)0
+             };
+           ap->a.a_wide_string = wide_null_string;
+         }
        break;
 #endif
       case TYPE_POINTER:
index 5e112b6..275968b 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings, using POSIX/XSI format strings with positions.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software; you can redistribute it and/or modify it
@@ -61,6 +61,14 @@ char *alloca ();
 
 #define STATIC static
 
+/* This needs to be consistent with libgnuintl.h.in.  */
+#if defined __NetBSD__ || defined __CYGWIN__ || defined __MINGW32__
+/* Don't break __attribute__((format(printf,M,N))).
+   This redefinition is only possible because the libc in NetBSD, Cygwin,
+   mingw does not have a function __printf__.  */
+# define libintl_printf __printf__
+#endif
+
 /* Define auxiliary functions declared in "printf-args.h".  */
 #include "printf-args.c"
 
index 5b43d12..7cc8daf 100644 (file)
@@ -1,5 +1,5 @@
 /* Provide relocatable packages.
-   Copyright (C) 2003-2004 Free Software Foundation, Inc.
+   Copyright (C) 2003-2005 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
 # include "xalloc.h"
 #endif
 
-#if defined _WIN32 || defined __WIN32__
+#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 #endif
@@ -234,6 +234,9 @@ compute_curr_prefix (const char *orig_installprefix,
                  same = true;
                break;
              }
+           /* Do case-insensitive comparison if the filesystem is always or
+              often case-insensitive.  It's better to accept the comparison
+              if the difference is only in case, rather than to fail.  */
 #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
            /* Win32, Cygwin, OS/2, DOS - case insignificant filesystem */
            if ((*rpi >= 'a' && *rpi <= 'z' ? *rpi - 'a' + 'A' : *rpi)
@@ -280,7 +283,7 @@ compute_curr_prefix (const char *orig_installprefix,
 /* Full pathname of shared library, or NULL.  */
 static char *shared_library_fullname;
 
-#if defined _WIN32 || defined __WIN32__
+#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__
 
 /* Determine the full pathname of the shared library when it is loaded.  */
 
@@ -302,13 +305,31 @@ DllMain (HINSTANCE module_handle, DWORD event, LPVOID reserved)
        /* Shouldn't happen.  */
        return FALSE;
 
-      shared_library_fullname = strdup (location);
+      {
+#if defined __CYGWIN__
+       /* On Cygwin, we need to convert paths coming from Win32 system calls
+          to the Unix-like slashified notation.  */
+       static char location_as_posix_path[2 * MAX_PATH];
+       /* There's no error return defined for cygwin_conv_to_posix_path.
+          See cygwin-api/func-cygwin-conv-to-posix-path.html.
+          Does it overflow the buffer of expected size MAX_PATH or does it
+          truncate the path?  I don't know.  Let's catch both.  */
+       cygwin_conv_to_posix_path (location, location_as_posix_path);
+       location_as_posix_path[MAX_PATH - 1] = '\0';
+       if (strlen (location_as_posix_path) >= MAX_PATH - 1)
+         /* A sign of buffer overflow or path truncation.  */
+         return FALSE;
+       shared_library_fullname = strdup (location_as_posix_path);
+#else
+       shared_library_fullname = strdup (location);
+#endif
+      }
     }
 
   return TRUE;
 }
 
-#else /* Unix */
+#else /* Unix except Cygwin */
 
 static void
 find_shared_library_fullname ()
@@ -359,15 +380,15 @@ find_shared_library_fullname ()
 #endif
 }
 
-#endif /* WIN32 / Unix */
+#endif /* (WIN32 or Cygwin) / (Unix except Cygwin) */
 
 /* Return the full pathname of the current shared library.
    Return NULL if unknown.
-   Guaranteed to work only on Linux and Woe32.  */
+   Guaranteed to work only on Linux, Cygwin and Woe32.  */
 static char *
 get_shared_library_fullname ()
 {
-#if !(defined _WIN32 || defined __WIN32__)
+#if !(defined _WIN32 || defined __WIN32__ || defined __CYGWIN__)
   static bool tried_find_shared_library_fullname;
   if (!tried_find_shared_library_fullname)
     {
index 614e64e..f6d3832 100644 (file)
@@ -1,5 +1,5 @@
 /* Provide relocatable packages.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software; you can redistribute it and/or modify it
@@ -31,7 +31,9 @@ extern "C" {
 /* When building a DLL, we must export some functions.  Note that because
    this is a private .h file, we don't need to use __declspec(dllimport)
    in any case.  */
-#if defined _MSC_VER && BUILDING_DLL
+#if HAVE_VISIBILITY && BUILDING_DLL
+# define RELOCATABLE_DLL_EXPORTED __attribute__((__visibility__("default")))
+#elif defined _MSC_VER && BUILDING_DLL
 # define RELOCATABLE_DLL_EXPORTED __declspec(dllexport)
 #else
 # define RELOCATABLE_DLL_EXPORTED
index 2bf6240..c316460 100644 (file)
@@ -1,5 +1,5 @@
 /* Implementation of the textdomain(3) function.
-   Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2003, 2005-2006 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
 #include <stdlib.h>
 #include <string.h>
 
+#include "gettextP.h"
 #ifdef _LIBC
 # include <libintl.h>
 #else
 # include "libgnuintl.h"
 #endif
-#include "gettextP.h"
 
+/* Handle multi-threaded applications.  */
 #ifdef _LIBC
-/* We have to handle multi-threaded applications.  */
 # include <bits/libc-lock.h>
+# define gl_rwlock_define __libc_rwlock_define
+# define gl_rwlock_wrlock __libc_rwlock_wrlock
+# define gl_rwlock_unlock __libc_rwlock_unlock
 #else
-/* Provide dummy implementation if this is outside glibc.  */
-# define __libc_rwlock_define(CLASS, NAME)
-# define __libc_rwlock_wrlock(NAME)
-# define __libc_rwlock_unlock(NAME)
+# include "lock.h"
 #endif
 
 /* The internal variables in the standalone libintl.a must have different
@@ -71,7 +71,7 @@ extern const char *_nl_current_default_domain attribute_hidden;
 #endif
 
 /* Lock variable to protect the global data in the gettext implementation.  */
-__libc_rwlock_define (extern, _nl_state_lock attribute_hidden)
+gl_rwlock_define (extern, _nl_state_lock attribute_hidden)
 
 /* Set the current default message catalog to DOMAINNAME.
    If DOMAINNAME is null, return the current default.
@@ -86,7 +86,7 @@ TEXTDOMAIN (const char *domainname)
   if (domainname == NULL)
     return (char *) _nl_current_default_domain;
 
-  __libc_rwlock_wrlock (_nl_state_lock);
+  gl_rwlock_wrlock (_nl_state_lock);
 
   old_domain = (char *) _nl_current_default_domain;
 
@@ -130,7 +130,7 @@ TEXTDOMAIN (const char *domainname)
        free (old_domain);
     }
 
-  __libc_rwlock_unlock (_nl_state_lock);
+  gl_rwlock_unlock (_nl_state_lock);
 
   return new_domain;
 }
index f59968f..cef29a7 100644 (file)
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 1999, 2002-2005 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2006 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
@@ -335,28 +335,28 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
                        tmp_length =
                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
                                          * 0.30103 /* binary -> decimal */
-                                         * 2 /* estimate for FLAG_GROUP */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 1; /* account for leading sign */
+                         + 1; /* turn floor into ceil */
                      else
 # endif
                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
                        tmp_length =
                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
                                          * 0.30103 /* binary -> decimal */
-                                         * 2 /* estimate for FLAG_GROUP */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 1; /* account for leading sign */
+                         + 1; /* turn floor into ceil */
                      else
                        tmp_length =
                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
                                          * 0.30103 /* binary -> decimal */
-                                         * 2 /* estimate for FLAG_GROUP */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 1; /* account for leading sign */
+                         + 1; /* turn floor into ceil */
+                     if (tmp_length < precision)
+                       tmp_length = precision;
+                     /* Multiply by 2, as an estimate for FLAG_GROUP.  */
+                     tmp_length = xsum (tmp_length, tmp_length);
+                     /* Add 1, to account for a leading sign.  */
+                     tmp_length = xsum (tmp_length, 1);
                      break;
 
                    case 'o':
@@ -366,8 +366,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
                                          * 0.333334 /* binary -> octal */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 1; /* account for leading sign */
+                         + 1; /* turn floor into ceil */
                      else
 # endif
                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
@@ -375,15 +374,17 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
                                          * 0.333334 /* binary -> octal */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 1; /* account for leading sign */
+                         + 1; /* turn floor into ceil */
                      else
                        tmp_length =
                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
                                          * 0.333334 /* binary -> octal */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 1; /* account for leading sign */
+                         + 1; /* turn floor into ceil */
+                     if (tmp_length < precision)
+                       tmp_length = precision;
+                     /* Add 1, to account for a leading sign.  */
+                     tmp_length = xsum (tmp_length, 1);
                      break;
 
                    case 'x': case 'X':
@@ -393,8 +394,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
                                          * 0.25 /* binary -> hexadecimal */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 2; /* account for leading sign or alternate form */
+                         + 1; /* turn floor into ceil */
                      else
 # endif
                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
@@ -402,15 +402,17 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
                                          * 0.25 /* binary -> hexadecimal */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 2; /* account for leading sign or alternate form */
+                         + 1; /* turn floor into ceil */
                      else
                        tmp_length =
                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
                                          * 0.25 /* binary -> hexadecimal */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 2; /* account for leading sign or alternate form */
+                         + 1; /* turn floor into ceil */
+                     if (tmp_length < precision)
+                       tmp_length = precision;
+                     /* Add 2, to account for a leading sign or alternate form.  */
+                     tmp_length = xsum (tmp_length, 2);
                      break;
 
                    case 'f': case 'F':
diff --git a/intl/version.c b/intl/version.c
new file mode 100644 (file)
index 0000000..a968cf7
--- /dev/null
@@ -0,0 +1,26 @@
+/* libintl library version.
+   Copyright (C) 2005 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
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "libgnuintl.h"
+
+/* Version number: (major<<16) + (minor<<8) + subminor */
+int libintl_version = LIBINTL_VERSION;
diff --git a/snprintf.c b/snprintf.c
deleted file mode 100644 (file)
index fcfcbb7..0000000
+++ /dev/null
@@ -1,794 +0,0 @@
-/**************************************************************
- * Original:
- * Patrick Powell Tue Apr 11 09:48:21 PDT 1995
- * A bombproof version of doprnt (dopr) included.
- * Sigh.  This sort of thing is always nasty do deal with.  Note that
- * the version here does not include floating point...
- *
- * snprintf() is used instead of sprintf() as it does limit checks
- * for string length.  This covers a nasty loophole.
- *
- * The other functions are there to prevent NULL pointers from
- * causing nast effects.
- *
- * More Recently:
- *  Brandon Long <blong@fiction.net> 9/15/96 for mutt 0.43
- *  This was ugly.  It is still ugly.  I opted out of floating point
- *  numbers, but the formatter understands just about everything
- *  from the normal C string format, at least as far as I can tell from
- *  the Solaris 2.5 printf(3S) man page.
- *
- *  Brandon Long <blong@fiction.net> 10/22/97 for mutt 0.87.1
- *    Ok, added some minimal floating point support, which means this
- *    probably requires libm on most operating systems.  Don't yet
- *    support the exponent (e,E) and sigfig (g,G).  Also, fmtint()
- *    was pretty badly broken, it just wasn't being exercised in ways
- *    which showed it, so that's been fixed.  Also, formated the code
- *    to mutt conventions, and removed dead code left over from the
- *    original.  Also, there is now a builtin-test, just compile with:
- *           gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
- *    and run snprintf for results.
- * 
- *  Thomas Roessler <roessler@does-not-exist.org> 01/27/98 for mutt 0.89i
- *    The PGP code was using unsigned hexadecimal formats. 
- *    Unfortunately, unsigned formats simply didn't work.
- *
- *  Michael Elkins <me@mutt.org> 03/05/98 for mutt 0.90.8
- *    The original code assumed that both snprintf() and vsnprintf() were
- *    missing.  Some systems only have snprintf() but not vsnprintf(), so
- *    the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF.
- *
- **************************************************************/
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
-
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include "lib/str.h"
-#include "lib/debug.h"
-
-/* Define this as a fall through, HAVE_STDARG_H is probably already set */
-
-#define HAVE_VARARGS_H
-
-/* varargs declarations: */
-
-#if defined(HAVE_STDARG_H)
-# include <stdarg.h>
-# define HAVE_STDARGS           /* let's hope that works everywhere (mj) */
-# define VA_LOCAL_DECL   va_list ap
-# define VA_START(f)     va_start(ap, f)
-# define VA_SHIFT(v,t)  ;       /* no-op for ANSI */
-# define VA_END          va_end(ap)
-#else
-# if defined(HAVE_VARARGS_H)
-#  include <varargs.h>
-#  undef HAVE_STDARGS
-#  define VA_LOCAL_DECL   va_list ap
-#  define VA_START(f)     va_start(ap)  /* f is ignored! */
-#  define VA_SHIFT(v,t) v = va_arg(ap,t)
-#  define VA_END        va_end(ap)
-# else
-/*XX ** NO VARARGS ** XX*/
-# endif
-#endif
-
-/*int snprintf (char *str, size_t count, const char *fmt, ...);*/
-/*int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);*/
-
-static void dopr (char *buffer, size_t maxlen, const char *format,
-                  va_list args);
-static void fmtstr (char *buffer, size_t * currlen, size_t maxlen,
-                    char *value, int flags, int min, int max);
-static void fmtint (char *buffer, size_t * currlen, size_t maxlen,
-                    long value, int base, int min, int max, int flags);
-static void fmtfp (char *buffer, size_t * currlen, size_t maxlen,
-                   long double fvalue, int min, int max, int flags);
-static void dopr_outch (char *buffer, size_t * currlen, size_t maxlen,
-                        char c);
-
-/*
- * dopr(): poor man's version of doprintf
- */
-
-/* format read states */
-#define DP_S_DEFAULT 0
-#define DP_S_FLAGS   1
-#define DP_S_MIN     2
-#define DP_S_DOT     3
-#define DP_S_MAX     4
-#define DP_S_MOD     5
-#define DP_S_CONV    6
-#define DP_S_DONE    7
-
-/* format flags - Bits */
-#define DP_F_MINUS     (1 << 0)
-#define DP_F_PLUS      (1 << 1)
-#define DP_F_SPACE     (1 << 2)
-#define DP_F_NUM       (1 << 3)
-#define DP_F_ZERO      (1 << 4)
-#define DP_F_UP        (1 << 5)
-#define DP_F_UNSIGNED  (1 << 6)
-
-/* Conversion Flags */
-#define DP_C_SHORT   1
-#define DP_C_LONG    2
-#define DP_C_LDOUBLE 3
-
-#define char_to_int(p) (p - '0')
-#undef MAX
-#define MAX(p,q) ((p >= q) ? p : q)
-
-static void dopr (char *buffer, size_t maxlen, const char *format,
-                  va_list args)
-{
-  char ch;
-  long value;
-  long double fvalue;
-  char *strvalue;
-  int min;
-  int max;
-  int state;
-  int flags;
-  int cflags;
-  size_t currlen;
-
-  state = DP_S_DEFAULT;
-  currlen = flags = cflags = min = 0;
-  max = -1;
-  ch = *format++;
-
-  while (state != DP_S_DONE) {
-    if ((ch == '\0') || (currlen >= maxlen))
-      state = DP_S_DONE;
-
-    switch (state) {
-    case DP_S_DEFAULT:
-      if (ch == '%')
-        state = DP_S_FLAGS;
-      else
-        dopr_outch (buffer, &currlen, maxlen, ch);
-      ch = *format++;
-      break;
-    case DP_S_FLAGS:
-      switch (ch) {
-      case '-':
-        flags |= DP_F_MINUS;
-        ch = *format++;
-        break;
-      case '+':
-        flags |= DP_F_PLUS;
-        ch = *format++;
-        break;
-      case ' ':
-        flags |= DP_F_SPACE;
-        ch = *format++;
-        break;
-      case '#':
-        flags |= DP_F_NUM;
-        ch = *format++;
-        break;
-      case '0':
-        flags |= DP_F_ZERO;
-        ch = *format++;
-        break;
-      default:
-        state = DP_S_MIN;
-        break;
-      }
-      break;
-    case DP_S_MIN:
-      if (isdigit ((unsigned char) ch)) {
-        min = 10 * min + char_to_int (ch);
-        ch = *format++;
-      }
-      else if (ch == '*') {
-        min = va_arg (args, int);
-
-        ch = *format++;
-        state = DP_S_DOT;
-      }
-      else
-        state = DP_S_DOT;
-      break;
-    case DP_S_DOT:
-      if (ch == '.') {
-        state = DP_S_MAX;
-        ch = *format++;
-      }
-      else
-        state = DP_S_MOD;
-      break;
-    case DP_S_MAX:
-      if (isdigit ((unsigned char) ch)) {
-        if (max < 0)
-          max = 0;
-        max = 10 * max + char_to_int (ch);
-        ch = *format++;
-      }
-      else if (ch == '*') {
-        max = va_arg (args, int);
-
-        ch = *format++;
-        state = DP_S_MOD;
-      }
-      else
-        state = DP_S_MOD;
-      break;
-    case DP_S_MOD:
-      /* Currently, we don't support Long Long, bummer */
-      switch (ch) {
-      case 'h':
-        cflags = DP_C_SHORT;
-        ch = *format++;
-        break;
-      case 'l':
-        cflags = DP_C_LONG;
-        ch = *format++;
-        break;
-      case 'L':
-        cflags = DP_C_LDOUBLE;
-        ch = *format++;
-        break;
-      default:
-        break;
-      }
-      state = DP_S_CONV;
-      break;
-    case DP_S_CONV:
-      switch (ch) {
-      case 'd':
-      case 'i':
-        if (cflags == DP_C_SHORT)
-          value = va_arg (args, short int);
-
-        else if (cflags == DP_C_LONG)
-          value = va_arg (args, long int);
-
-        else
-          value = va_arg (args, int);
-
-        fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
-        break;
-      case 'o':
-        flags |= DP_F_UNSIGNED;
-        if (cflags == DP_C_SHORT)
-          value = va_arg (args, unsigned short int);
-
-        else if (cflags == DP_C_LONG)
-          value = va_arg (args, unsigned long int);
-
-        else
-          value = va_arg (args, unsigned int);
-
-        fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags);
-        break;
-      case 'u':
-        flags |= DP_F_UNSIGNED;
-        if (cflags == DP_C_SHORT)
-          value = va_arg (args, unsigned short int);
-
-        else if (cflags == DP_C_LONG)
-          value = va_arg (args, unsigned long int);
-
-        else
-          value = va_arg (args, unsigned int);
-
-        fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
-        break;
-      case 'X':
-        flags |= DP_F_UP;
-      case 'x':
-        flags |= DP_F_UNSIGNED;
-        if (cflags == DP_C_SHORT)
-          value = va_arg (args, unsigned short int);
-
-        else if (cflags == DP_C_LONG)
-          value = va_arg (args, unsigned long int);
-
-        else
-          value = va_arg (args, unsigned int);
-
-        fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags);
-        break;
-      case 'f':
-        if (cflags == DP_C_LDOUBLE)
-          fvalue = va_arg (args, long double);
-
-        else
-          fvalue = va_arg (args, double);
-
-        /* um, floating point? */
-        fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags);
-        break;
-      case 'E':
-        flags |= DP_F_UP;
-      case 'e':
-        if (cflags == DP_C_LDOUBLE)
-          fvalue = va_arg (args, long double);
-
-        else
-          fvalue = va_arg (args, double);
-
-        break;
-      case 'G':
-        flags |= DP_F_UP;
-      case 'g':
-        if (cflags == DP_C_LDOUBLE)
-          fvalue = va_arg (args, long double);
-
-        else
-          fvalue = va_arg (args, double);
-
-        break;
-      case 'c':
-        dopr_outch (buffer, &currlen, maxlen, va_arg (args, int));
-
-        break;
-      case 's':
-        strvalue = va_arg (args, char *);
-
-        if (max < 0)
-          max = maxlen;         /* ie, no max */
-        fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max);
-        break;
-      case 'p':
-        strvalue = va_arg (args, void *);
-
-        fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max,
-                flags);
-        break;
-      case 'n':
-        if (cflags == DP_C_SHORT) {
-          short int *num;
-          num = va_arg (args, short int *);
-
-          *num = currlen;
-        }
-        else if (cflags == DP_C_LONG) {
-          long int *num;
-          num = va_arg (args, long int *);
-
-          *num = currlen;
-        }
-        else {
-          int *num;
-          num = va_arg (args, int *);
-
-          *num = currlen;
-        }
-        break;
-      case '%':
-        dopr_outch (buffer, &currlen, maxlen, ch);
-        break;
-      case 'w':
-        /* not supported yet, treat as next char */
-        ch = *format++;
-        break;
-      default:
-        /* Unknown, skip */
-        break;
-      }
-      ch = *format++;
-      state = DP_S_DEFAULT;
-      flags = cflags = min = 0;
-      max = -1;
-      break;
-    case DP_S_DONE:
-      break;
-    default:
-      /* hmm? */
-      break;                    /* some picky compilers need this */
-    }
-  }
-  if (currlen < maxlen - 1)
-    buffer[currlen] = '\0';
-  else
-    buffer[maxlen - 1] = '\0';
-}
-
-static void fmtstr (char *buffer, size_t * currlen, size_t maxlen,
-                    char *value, int flags, int min, int max)
-{
-  int padlen, strln;            /* amount to pad */
-  int cnt = 0;
-
-  if (value == 0) {
-    value = "<NULL>";
-  }
-
-  for (strln = 0; value[strln]; ++strln);       /* str_len */
-  padlen = min - strln;
-  if (padlen < 0)
-    padlen = 0;
-  if (flags & DP_F_MINUS)
-    padlen = -padlen;           /* Left Justify */
-
-  while ((padlen > 0) && (cnt < max)) {
-    dopr_outch (buffer, currlen, maxlen, ' ');
-    --padlen;
-    ++cnt;
-  }
-  while (*value && (cnt < max)) {
-    dopr_outch (buffer, currlen, maxlen, *value++);
-    ++cnt;
-  }
-  while ((padlen < 0) && (cnt < max)) {
-    dopr_outch (buffer, currlen, maxlen, ' ');
-    ++padlen;
-    ++cnt;
-  }
-}
-
-/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
-
-static void fmtint (char *buffer, size_t * currlen, size_t maxlen,
-                    long value, int base, int min, int max, int flags)
-{
-  int signvalue = 0;
-  unsigned long uvalue;
-  char convert[20];
-  int place = 0;
-  int spadlen = 0;              /* amount to space pad */
-  int zpadlen = 0;              /* amount to zero pad */
-  int caps = 0;
-
-  if (max < 0)
-    max = 0;
-
-  uvalue = value;
-
-  if (!(flags & DP_F_UNSIGNED)) {
-    if (value < 0) {
-      signvalue = '-';
-      uvalue = -value;
-    }
-    else if (flags & DP_F_PLUS) /* Do a sign (+/i) */
-      signvalue = '+';
-    else if (flags & DP_F_SPACE)
-      signvalue = ' ';
-  }
-
-  if (flags & DP_F_UP)
-    caps = 1;                   /* Should characters be upper case? */
-
-  do {
-    convert[place++] = (caps ? "0123456789ABCDEF" : "0123456789abcdef")
-      [uvalue % (unsigned) base];
-    uvalue = (uvalue / (unsigned) base);
-  } while (uvalue && (place < 20));
-  if (place == 20)
-    place--;
-  convert[place] = 0;
-
-  zpadlen = max - place;
-  spadlen = min - MAX (max, place) - (signvalue ? 1 : 0);
-  if (zpadlen < 0)
-    zpadlen = 0;
-  if (spadlen < 0)
-    spadlen = 0;
-  if (flags & DP_F_ZERO) {
-    zpadlen = MAX (zpadlen, spadlen);
-    spadlen = 0;
-  }
-  if (flags & DP_F_MINUS)
-    spadlen = -spadlen;         /* Left Justifty */
-
-#ifdef DEBUG_SNPRINTF
-  debug_print (1, ("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
-              zpadlen, spadlen, min, max, place));
-#endif
-
-  /* Spaces */
-  while (spadlen > 0) {
-    dopr_outch (buffer, currlen, maxlen, ' ');
-    --spadlen;
-  }
-
-  /* Sign */
-  if (signvalue)
-    dopr_outch (buffer, currlen, maxlen, signvalue);
-
-  /* Zeros */
-  if (zpadlen > 0) {
-    while (zpadlen > 0) {
-      dopr_outch (buffer, currlen, maxlen, '0');
-      --zpadlen;
-    }
-  }
-
-  /* Digits */
-  while (place > 0)
-    dopr_outch (buffer, currlen, maxlen, convert[--place]);
-
-  /* Left Justified spaces */
-  while (spadlen < 0) {
-    dopr_outch (buffer, currlen, maxlen, ' ');
-    ++spadlen;
-  }
-}
-
-static long double abs_val (long double value)
-{
-  long double result = value;
-
-  if (value < 0)
-    result = -value;
-
-  return result;
-}
-
-static long double pow10 (int exp)
-{
-  long double result = 1;
-
-  while (exp) {
-    result *= 10;
-    exp--;
-  }
-
-  return result;
-}
-
-static long round (long double value)
-{
-  long intpart;
-
-  intpart = value;
-  value = value - intpart;
-  if (value >= 0.5)
-    intpart++;
-
-  return intpart;
-}
-
-static void fmtfp (char *buffer, size_t * currlen, size_t maxlen,
-                   long double fvalue, int min, int max, int flags)
-{
-  int signvalue = 0;
-  long double ufvalue;
-  char iconvert[20];
-  char fconvert[20];
-  int iplace = 0;
-  int fplace = 0;
-  int padlen = 0;               /* amount to pad */
-  int zpadlen = 0;
-  int caps = 0;
-  long intpart;
-  long fracpart;
-
-  /* 
-   * AIX manpage says the default is 0, but Solaris says the default
-   * is 6, and sprintf on AIX defaults to 6
-   */
-  if (max < 0)
-    max = 6;
-
-  ufvalue = abs_val (fvalue);
-
-  if (fvalue < 0)
-    signvalue = '-';
-  else if (flags & DP_F_PLUS)   /* Do a sign (+/i) */
-    signvalue = '+';
-  else if (flags & DP_F_SPACE)
-    signvalue = ' ';
-
-#if 0
-  if (flags & DP_F_UP)
-    caps = 1;                   /* Should characters be upper case? */
-#endif
-
-  intpart = ufvalue;
-
-  /* 
-   * Sorry, we only support 9 digits past the decimal because of our 
-   * conversion method
-   */
-  if (max > 9)
-    max = 9;
-
-  /* We "cheat" by converting the fractional part to integer by
-   * multiplying by a factor of 10
-   */
-  fracpart = round ((pow10 (max)) * (ufvalue - intpart));
-
-  if (fracpart >= pow10 (max)) {
-    intpart++;
-    fracpart -= pow10 (max);
-  }
-
-#ifdef DEBUG_SNPRINTF
-  debug_print (1, ("fmtfp: %f =? %d.%d\n", fvalue, intpart, fracpart));
-#endif
-
-  /* Convert integer part */
-  do {
-    iconvert[iplace++] =
-      (caps ? "0123456789ABCDEF" : "0123456789abcdef")[intpart % 10];
-    intpart = (intpart / 10);
-  } while (intpart && (iplace < 20));
-  if (iplace == 20)
-    iplace--;
-  iconvert[iplace] = 0;
-
-  /* Convert fractional part */
-  do {
-    fconvert[fplace++] =
-      (caps ? "0123456789ABCDEF" : "0123456789abcdef")[fracpart % 10];
-    fracpart = (fracpart / 10);
-  } while (fracpart && (fplace < 20));
-  if (fplace == 20)
-    fplace--;
-  fconvert[fplace] = 0;
-
-  /* -1 for decimal point, another -1 if we are printing a sign */
-  padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
-  zpadlen = max - fplace;
-  if (zpadlen < 0)
-    zpadlen = 0;
-  if (padlen < 0)
-    padlen = 0;
-  if (flags & DP_F_MINUS)
-    padlen = -padlen;           /* Left Justifty */
-
-  if ((flags & DP_F_ZERO) && (padlen > 0)) {
-    if (signvalue) {
-      dopr_outch (buffer, currlen, maxlen, signvalue);
-      --padlen;
-      signvalue = 0;
-    }
-    while (padlen > 0) {
-      dopr_outch (buffer, currlen, maxlen, '0');
-      --padlen;
-    }
-  }
-  while (padlen > 0) {
-    dopr_outch (buffer, currlen, maxlen, ' ');
-    --padlen;
-  }
-  if (signvalue)
-    dopr_outch (buffer, currlen, maxlen, signvalue);
-
-  while (iplace > 0)
-    dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]);
-
-  /*
-   * Decimal point.  This should probably use locale to find the correct
-   * char to print out.
-   */
-  dopr_outch (buffer, currlen, maxlen, '.');
-
-  while (fplace > 0)
-    dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
-
-  while (zpadlen > 0) {
-    dopr_outch (buffer, currlen, maxlen, '0');
-    --zpadlen;
-  }
-
-  while (padlen < 0) {
-    dopr_outch (buffer, currlen, maxlen, ' ');
-    ++padlen;
-  }
-}
-
-static void dopr_outch (char *buffer, size_t * currlen, size_t maxlen, char c)
-{
-  if (*currlen < maxlen)
-    buffer[(*currlen)++] = c;
-}
-#endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */
-
-#ifndef HAVE_VSNPRINTF
-int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
-{
-  str[0] = 0;
-  dopr (str, count, fmt, args);
-  return (str_len (str));
-}
-#endif /* !HAVE_VSNPRINTF */
-
-#ifndef HAVE_SNPRINTF
-/* VARARGS3 */
-#ifdef HAVE_STDARGS
-int snprintf (char *str, size_t count, const char *fmt, ...)
-#else
-int snprintf (va_alist)
-     va_dcl
-#endif
-{
-#ifndef HAVE_STDARGS
-  char *str;
-  size_t count;
-  char *fmt;
-#endif
-  VA_LOCAL_DECL;
-
-  VA_START (fmt);
-  VA_SHIFT (str, char *);
-
-  VA_SHIFT (count, size_t);
-  VA_SHIFT (fmt, char *);
-
-  (void) vsnprintf (str, count, fmt, ap);
-  VA_END;
-  return (str_len (str));
-}
-
-#ifdef TEST_SNPRINTF
-#ifndef LONG_STRING
-#define LONG_STRING 1024
-#endif
-int main (void)
-{
-  char buf1[LONG_STRING];
-  char buf2[LONG_STRING];
-  char *fp_fmt[] = {
-    "%-1.5f",
-    "%1.5f",
-    "%123.9f",
-    "%10.5f",
-    "% 10.5f",
-    "%+22.9f",
-    "%+4.9f",
-    "%01.3f",
-    "%4f",
-    "%3.1f",
-    "%3.2f",
-    NULL
-  };
-  double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996,
-    0.9996, 1.996, 4.136, 0
-  };
-  char *int_fmt[] = {
-    "%-1.5d",
-    "%1.5d",
-    "%123.9d",
-    "%5.5d",
-    "%10.5d",
-    "% 10.5d",
-    "%+22.33d",
-    "%01.3d",
-    "%4d",
-    NULL
-  };
-  long int_nums[] = { -1, 134, 91340, 341, 0203, 0 };
-  int x, y;
-  int fail = 0;
-  int num = 0;
-
-  printf ("Testing snprintf format codes against system sprintf...\n");
-
-  for (x = 0; fp_fmt[x] != NULL; x++)
-    for (y = 0; fp_nums[y] != 0; y++) {
-      snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]);
-      sprintf (buf2, fp_fmt[x], fp_nums[y]);
-      if (str_cmp (buf1, buf2)) {
-        printf ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf  = %s\n",        /* __SPRINTF_CHECKED__ */
-                fp_fmt[x], buf1, buf2);
-        fail++;
-      }
-      num++;
-    }
-
-  for (x = 0; int_fmt[x] != NULL; x++)
-    for (y = 0; int_nums[y] != 0; y++) {
-      snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]);
-      sprintf (buf2, int_fmt[x], int_nums[y]);
-      if (str_cmp (buf1, buf2)) {
-        printf ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf  = %s\n",        /* __SPRINTF_CHECKED__ */
-                int_fmt[x], buf1, buf2);
-        fail++;
-      }
-      num++;
-    }
-  printf ("%d tests failed out of %d.\n", fail, num);
-}
-#endif /* SNPRINTF_TEST */
-
-#endif /* !HAVE_SNPRINTF */