From: Bruno Haible Date: Fri, 11 Feb 2011 19:55:01 +0000 (+0100) Subject: Prepare for locale dependent tests on mingw. X-Git-Tag: v0.1~3195 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=308adebf1627d0f44bac6595c4389b56919679d3;p=gnulib.git Prepare for locale dependent tests on mingw. * m4/locale-ar.m4 (gt_LOCALE_AR): On native Windows, call setlocale differently. * m4/locale-fr.m4 (gt_LOCALE_FR, gt_LOCALE_FR_UTF8): Likewise. * m4/locale-ja.m4 (gt_LOCALE_JA): Likewise. * m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Likewise. * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Likewise. --- diff --git a/ChangeLog b/ChangeLog index eea655040..bcaa894ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-02-11 Bruno Haible + + Prepare for locale dependent tests on mingw. + * m4/locale-ar.m4 (gt_LOCALE_AR): On native Windows, call setlocale + differently. + * m4/locale-fr.m4 (gt_LOCALE_FR, gt_LOCALE_FR_UTF8): Likewise. + * m4/locale-ja.m4 (gt_LOCALE_JA): Likewise. + * m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Likewise. + * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Likewise. + 2011-02-11 Eric Blake strptime: avoid compiler warnings diff --git a/m4/locale-ar.m4 b/m4/locale-ar.m4 index 1ac23d2b2..91d840506 100644 --- a/m4/locale-ar.m4 +++ b/m4/locale-ar.m4 @@ -1,4 +1,4 @@ -# locale-ar.m4 serial 2 +# locale-ar.m4 serial 3 dnl Copyright (C) 2003, 2005-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -25,7 +25,17 @@ struct tm t; char buf[16]; int main () { /* Check whether the given locale name is recognized by the system. */ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + /* On native Win32, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is speficied, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +#else if (setlocale (LC_ALL, "") == NULL) return 1; +#endif /* Check that nl_langinfo(CODESET) is nonempty and not "ASCII" or "646" and ends in "6". */ #if HAVE_LANGINFO_CODESET diff --git a/m4/locale-fr.m4 b/m4/locale-fr.m4 index 2616f9119..aa8b16174 100644 --- a/m4/locale-fr.m4 +++ b/m4/locale-fr.m4 @@ -1,4 +1,4 @@ -# locale-fr.m4 serial 12 +# locale-fr.m4 serial 13 dnl Copyright (C) 2003, 2005-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -25,7 +25,17 @@ struct tm t; char buf[16]; int main () { /* Check whether the given locale name is recognized by the system. */ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + /* On native Win32, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is speficied, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +#else if (setlocale (LC_ALL, "") == NULL) return 1; +#endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. @@ -122,7 +132,17 @@ int main () { variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ +# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + /* On native Win32, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is speficied, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +# else if (setlocale (LC_ALL, "") == NULL) return 1; +# endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. diff --git a/m4/locale-ja.m4 b/m4/locale-ja.m4 index 40b4d658b..ac01c3284 100644 --- a/m4/locale-ja.m4 +++ b/m4/locale-ja.m4 @@ -1,4 +1,4 @@ -# locale-ja.m4 serial 8 +# locale-ja.m4 serial 9 dnl Copyright (C) 2003, 2005-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -27,7 +27,17 @@ int main () { const char *p; /* Check whether the given locale name is recognized by the system. */ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + /* On native Win32, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is speficied, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +#else if (setlocale (LC_ALL, "") == NULL) return 1; +#endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. diff --git a/m4/locale-tr.m4 b/m4/locale-tr.m4 index f1f71bb21..d0545c530 100644 --- a/m4/locale-tr.m4 +++ b/m4/locale-tr.m4 @@ -1,4 +1,4 @@ -# locale-tr.m4 serial 6 +# locale-tr.m4 serial 7 dnl Copyright (C) 2003, 2005-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -29,7 +29,17 @@ int main () { implement the Turkish upper-/lowercase mappings. Therefore, let this program return 1 on BeOS. */ /* Check whether the given locale name is recognized by the system. */ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + /* On native Win32, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is speficied, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +#else if (setlocale (LC_ALL, "") == NULL) return 1; +#endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On MacOS X 10.3.5 (Darwin 7.5) in the tr_TR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. diff --git a/m4/locale-zh.m4 b/m4/locale-zh.m4 index 81c2e2be6..c82d17b58 100644 --- a/m4/locale-zh.m4 +++ b/m4/locale-zh.m4 @@ -1,4 +1,4 @@ -# locale-zh.m4 serial 7 +# locale-zh.m4 serial 8 dnl Copyright (C) 2003, 2005-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -28,7 +28,17 @@ int main () { const char *p; /* Check whether the given locale name is recognized by the system. */ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + /* On native Win32, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is speficied, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +#else if (setlocale (LC_ALL, "") == NULL) return 1; +#endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful.