Since we do not use relocation (and it was not easy to get to compile on Windows) we have removed it, as well as OS/2 compatibility. Also, we do not install or use locale.alias, and charset.alias is compiled in (via charsetalias.h) rather than read at runtime. Since the packages will need libintl.h, we need to install it. We also need to ensure that we get our version and not, e.g. the Solaris version. Since this is made with visibility hidden, we need to add visibility to some entry points. On Windows we needed to override the way the locale_charset is found, and map some Windows locale names to XPG ones. And we use localeCP not getACP, since the latter refers to the default codepage irrespective of locales. Various small changes were made to avoid warnings. BDR --- ./dcigettext.c 2006-11-27 17:02:00.000000000 +0000 +++ ../../extra/intl/dcigettext.c 2007-08-30 14:40:53.890625000 +0100 @@ -159,7 +159,10 @@ # if VMS # define getcwd(buf, max) (getcwd) (buf, max, 0) # else +/* This is naughty if already declared, but harmful on Win64 */ +# ifndef WIN64 char *getcwd (); +# endif # endif # endif # ifndef HAVE_STPCPY @@ -260,6 +263,9 @@ size_t translation_length; /* Pointer to the string in question. */ +#ifdef __GNUC__ + __extension__ +#endif char msgid[ZERO]; }; @@ -1503,6 +1523,22 @@ locale_defaulted = 1; } } +# ifdef WIN32 + /* Need to translate some Windows locale names */ + if(strcmp(locale, "chs") == 0) locale = "zh_CN"; + if(strcmp(locale, "chinese") == 0) locale = "zh_TW"; + if(strcmp(locale, "cht") == 0) locale = "zh_TW"; + if(strcmp(locale, "ptb") == 0) locale = "pt_BR"; + /* Vista has got a lot pickier, so e.g. 'LC_ALL=ru' does not work */ + if(strncmp(locale, "de", 2) == 0) locale = "de_DE"; + if(strcmp(locale, "esp") == 0) locale = "es_ES"; + if(strncmp(locale, "fr", 2) == 0) locale = "fr_FR"; + if(strncmp(locale, "it", 2) == 0) locale = "it_IT"; + if(strncmp(locale, "ko", 2) == 0) locale = "ko_KO"; + if(strcmp(locale, "jpn") == 0) locale = "ja_JP"; + if(strncmp(locale, "rus", 3) == 0) locale = "ru_RU"; + if(strcmp(locale, "spanish") == 0) locale = "es_ES"; +# endif # endif #endif --- ./dgettext.c 2006-11-27 17:02:00.000000000 +0000 +++ ../../extra/intl/dgettext.c 2007-05-12 05:55:38.000000000 +0100 @@ -46,7 +46,10 @@ /* Look up MSGID in the DOMAINNAME message catalog of the current LC_MESSAGES locale. */ -char * +#ifdef HAVE_VISIBILITY_ATTRIBUTE +__attribute__ ((visibility ("default"))) +#endif +char * DGETTEXT (const char *domainname, const char *msgid) { return DCGETTEXT (domainname, msgid, LC_MESSAGES); --- ./finddomain.c 2006-11-27 17:02:00.000000000 +0000 +++ ../../extra/intl/finddomain.c 2007-05-12 05:26:42.000000000 +0100 @@ -67,7 +67,9 @@ const char *territory; const char *codeset; const char *normalized_codeset; +#ifdef NOT_USED const char *alias_value; +#endif int mask; /* LOCALE can consist of up to four recognized parts for the XPG syntax: @@ -120,6 +122,7 @@ /* NOTREACHED */ } +#ifdef NOT_USED /* R change */ /* See whether the locale value is an alias. If yes its value *overwrites* the alias name. No test for the original value is done. */ @@ -139,6 +142,7 @@ memcpy (locale, alias_value, len); #endif } +#endif /* Now we determine the single parts of the locale name. First look for the language. Termination symbols are `_', '.', and `@'. */ @@ -175,9 +179,12 @@ } } + +#ifdef NOT_USED /* The room for an alias was dynamically allocated. Free it now. */ if (alias_value != NULL) free (locale); +#endif /* The space for normalized_codeset is dynamically allocated. Free it. */ if (mask & XPG_NORM_CODESET) --- ./gettext.c 2006-11-27 17:02:00.000000000 +0000 +++ ../../extra/intl/gettext.c 2007-05-12 05:56:24.000000000 +0100 @@ -51,6 +51,9 @@ /* 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 HAVE_VISIBILITY_ATTRIBUTE +__attribute__ ((visibility ("default"))) +#endif char * GETTEXT (const char *msgid) { --- ./gettextP.h 2006-11-27 17:02:00.000000000 +0000 +++ ../../extra/intl/gettextP.h 2007-05-12 04:02:42.000000000 +0100 @@ -201,6 +201,9 @@ struct binding *next; char *dirname; char *codeset; +#ifdef __GNUC__ + __extension__ +#endif char domainname[ZERO]; }; --- ./l10nflist.c 2006-11-27 17:02:00.000000000 +0000 +++ ../../extra/intl/l10nflist.c 2007-08-21 09:38:31.656250000 +0100 @@ -318,10 +318,9 @@ if (dirlist_count > 1) { /* Iterate over all elements of the DIRLIST. */ - char *dir = NULL; + char *dir = NULL, *nd = (char *) dirlist; - while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir)) - != NULL) + while ((dir = __argz_next (nd, dirlist_len, dir)) != NULL) retval->successor[entries++] = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt, language, territory, codeset, --- ./localcharset.c 2006-11-27 17:02:00.000000000 +0000 +++ ../../extra/intl/localcharset.c 2007-08-30 10:16:31.703125000 +0100 @@ -19,7 +19,9 @@ /* Written by Bruno Haible . */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif /* Specification. */ #include "localcharset.h" @@ -65,10 +67,12 @@ # define relocate(pathname) (pathname) #endif +#if 0 /* Get LIBDIR. */ #ifndef LIBDIR # include "configmake.h" #endif +#endif #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ /* Win32, Cygwin, OS/2, DOS */ @@ -112,6 +116,9 @@ if (cp == NULL) { #if !(defined VMS || defined WIN32_NATIVE || defined __CYGWIN__) +/* we convert charset.alias to a header file at compile time */ +#include "charsetalias.h" +#if 0 FILE *fp; const char *dir; const char *base = "charset.alias"; @@ -209,7 +216,7 @@ if (file_name != NULL) free (file_name); - +#endif #else # if defined VMS @@ -280,6 +287,8 @@ If the canonical name cannot be determined, the result is a non-canonical name. */ +extern unsigned int localeCP; /* from Defn.h */ + #ifdef STATIC STATIC #endif @@ -377,8 +386,9 @@ static char buf[2 + 10 + 1]; - /* Woe32 has a function returning the locale's codepage as a number. */ - sprintf (buf, "CP%u", GetACP ()); + /* Woe32 has a function returning the locale's codepage as a number. + sprintf (buf, "CP%u", GetACP ()); */ + sprintf (buf, "CP%u", localeCP); codeset = buf; #elif defined OS2 --- ./localename.c 2006-11-27 17:02:00.000000000 +0000 +++ ../../extra/intl/localename.c 2007-05-12 04:28:12.000000000 +0100 @@ -1142,7 +1142,7 @@ switch (sub) { case SUBLANG_BENGALI_INDIA: return "bn_IN"; - case SUBLANG_BENGALI_BANGLADESH: return "bn_BD"; + // case SUBLANG_BENGALI_BANGLADESH: return "bn_BD"; } return "bn"; case LANG_BULGARIAN: return "bg_BG"; @@ -1356,7 +1356,7 @@ switch (sub) { case SUBLANG_PUNJABI_INDIA: return "pa_IN"; /* Gurmukhi script */ - case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */ + // case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */ } return "pa"; case LANG_RHAETO_ROMANCE: return "rm_CH"; @@ -1364,7 +1364,7 @@ switch (sub) { case SUBLANG_ROMANIAN_ROMANIA: return "ro_RO"; - case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD"; + // case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD"; } return "ro"; case LANG_RUSSIAN: --- ./ngettext.c 2006-11-27 17:02:00.000000000 +0000 +++ ../../extra/intl/ngettext.c 2007-05-12 07:34:56.562500000 +0100 @@ -53,6 +53,9 @@ /* 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 HAVE_VISIBILITY_ATTRIBUTE +__attribute__ ((visibility ("default"))) +#endif char * NGETTEXT (const char *msgid1, const char *msgid2, unsigned long int n) { --- ./printf-args.c 2006-11-27 17:02:00.000000000 +0000 +++ ../../extra/intl/printf-args.c 2007-05-12 06:30:01.000000000 +0100 @@ -16,7 +16,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif /* Specification. */ #include "printf-args.h" --- ./printf-parse.c 2006-11-27 17:02:00.000000000 +0000 +++ ../../extra/intl/printf-parse.c 2007-05-12 06:29:52.000000000 +0100 @@ -16,7 +16,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif /* Specification. */ #if WIDE_CHAR_VERSION --- ./vasnprintf.c 2006-11-27 17:02:00.000000000 +0000 +++ ../../extra/intl/vasnprintf.c 2007-05-12 06:30:18.000000000 +0100 @@ -23,7 +23,9 @@ # define _GNU_SOURCE 1 #endif -#include +#ifdef HAVE_CONFIG_H +# include +#endif #ifndef IN_LIBINTL # include #endif