[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
locale dependent tests on mingw
From: |
Bruno Haible |
Subject: |
locale dependent tests on mingw |
Date: |
Sat, 12 Feb 2011 16:57:03 +0100 |
User-agent: |
KMail/1.9.9 |
Hi,
For the wwchar_t stuff, I'll need to add locale dependent tests that are run
on mingw. So far, normally all locale dependent tests were skipped on mingw.
The major problem on mingw is that setlocale(LC_ALL,"") does not look at the
environment variables. On POSIX systems it does, but on mingw it doesn't.
The second problem is the detection whether setlocale succeeded: When passed
a string with supported language and country, but unsupported encoding,
setlocale succeeds but leaves the LC_CTYPE facet in an unusable state.
Example: setlocale (LC_ALL, "French_France.65001") succeeds and then
setlocale (LC_ALL, NULL) is (newlines inserted by me):
LC_COLLATE=French_France.65001;
LC_CTYPE=C;
LC_MONETARY=French_France.65001;
LC_NUMERIC=French_France.65001;
LC_TIME=French_France.65001
The third problem is that the setlocale function accepts different names,
not based on ISO 639 and ISO 3166.
First of all, fix the detection of the supported locales.
These are two patches, the first patch against problem 1 and 2, the
second one against problem 3.
2011-02-11 Bruno Haible <address@hidden>
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/m4/locale-ar.m4 b/m4/locale-ar.m4
index 1ac23d2..91d8405 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 2616f91..aa8b161 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 40b4d65..ac01c32 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 f1f71bb..d0545c5 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 81c2e2b..c82d17b 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.
--
1.6.3.2
2011-02-11 Bruno Haible <address@hidden>
Prepare for locale dependent tests on mingw.
* m4/locale-ar.m4 (gt_LOCALE_AR): On native Windows, don't try "ar"
because it has the wrong locale encoding.
* m4/locale-fr.m4 (gt_LOCALE_FR): On native Windows, try
French_France.1252 instead of "fr".
(gt_LOCALE_FR_UTF8): On native Windows, try French_France.65001.
* m4/locale-ja.m4 (gt_LOCALE_JA): On native Windows, don't try "ja"
because it has the wrong locale encoding.
* m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Require AC_CANONICAL_HOST. On
native Windows, try Turkish_Turkey.65001.
* m4/locale-zh.m4 (gt_LOCALE_ZH_CN): On native Windows, try
Chinese_China.54936.
diff --git a/m4/locale-ar.m4 b/m4/locale-ar.m4
index 91d8405..bbf7505 100644
--- a/m4/locale-ar.m4
+++ b/m4/locale-ar.m4
@@ -57,24 +57,40 @@ int main () {
changequote([,])dnl
])])
if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
- # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
- # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
- # configure script would override the LC_ALL setting. Likewise for
- # LC_CTYPE, which is also set at the beginning of the configure script.
- # Values tested:
- # - The usual locale name: ar_SA
- # - The locale name with explicit encoding suffix: ar_SA.ISO-8859-6
- # - The HP-UX locale name: ar_SA.iso88596
- # - The Solaris 7 locale name: ar
- # Also try ar_EG instead of ar_SA because Egypt is a large country too.
- for gt_cv_locale_ar in ar_SA ar_SA.ISO-8859-6 ar_SA.iso88596 ar_EG
ar_EG.ISO-8859-6 ar_EG.iso88596 ar none; do
- if test $gt_cv_locale_ar = none; then
- break
- fi
- if (LC_ALL=$gt_cv_locale_ar LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- break
- fi
- done
+ case "$host_os" in
+ # Handle native Windows specially, because there setlocale() interprets
+ # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+ # "fr" or "fra" as "French" or "French_France.1252",
+ # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+ # "ja" as "Japanese" or "Japanese_Japan.932",
+ # and similar.
+ mingw*)
+ # Note that on native Win32, the Arabic locale is
+ # "Arabic_Saudi Arabia.1256", and CP1256 is very different from
+ # ISO-8859-6, so we cannot use it here.
+ gt_cv_locale_ar=none
+ ;;
+ *)
+ # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+ # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+ # configure script would override the LC_ALL setting. Likewise for
+ # LC_CTYPE, which is also set at the beginning of the configure
script.
+ # Values tested:
+ # - The usual locale name: ar_SA
+ # - The locale name with explicit encoding suffix: ar_SA.ISO-8859-6
+ # - The HP-UX locale name: ar_SA.iso88596
+ # - The Solaris 7 locale name: ar
+ # Also try ar_EG instead of ar_SA because Egypt is a large country
too.
+ for gt_cv_locale_ar in ar_SA ar_SA.ISO-8859-6 ar_SA.iso88596 ar_EG
ar_EG.ISO-8859-6 ar_EG.iso88596 ar none; do
+ if test $gt_cv_locale_ar = none; then
+ break
+ fi
+ if (LC_ALL=$gt_cv_locale_ar LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ break
+ fi
+ done
+ ;;
+ esac
fi
rm -fr conftest*
])
diff --git a/m4/locale-fr.m4 b/m4/locale-fr.m4
index aa8b161..3f4f954 100644
--- a/m4/locale-fr.m4
+++ b/m4/locale-fr.m4
@@ -72,37 +72,56 @@ int main () {
changequote([,])dnl
])])
if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
- # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
- # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
- # configure script would override the LC_ALL setting. Likewise for
- # LC_CTYPE, which is also set at the beginning of the configure script.
- # Test for the usual locale name.
- if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
- gt_cv_locale_fr=fr_FR
- else
- # Test for the locale name with explicit encoding suffix.
- if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_fr=fr_FR.ISO-8859-1
- else
- # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name.
- if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_fr=fr_FR.ISO8859-1
+ case "$host_os" in
+ # Handle native Windows specially, because there setlocale() interprets
+ # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+ # "fr" or "fra" as "French" or "French_France.1252",
+ # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+ # "ja" as "Japanese" or "Japanese_Japan.932",
+ # and similar.
+ mingw*)
+ # Test for the native Win32 locale name.
+ if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_fr=French_France.1252
else
- # Test for the HP-UX locale name.
- if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_fr=fr_FR.iso88591
+ # None found.
+ gt_cv_locale_fr=none
+ fi
+ ;;
+ *)
+ # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+ # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+ # configure script would override the LC_ALL setting. Likewise for
+ # LC_CTYPE, which is also set at the beginning of the configure
script.
+ # Test for the usual locale name.
+ if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null;
then
+ gt_cv_locale_fr=fr_FR
+ else
+ # Test for the locale name with explicit encoding suffix.
+ if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_fr=fr_FR.ISO-8859-1
else
- # Test for the Solaris 7 locale name.
- if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null;
then
- gt_cv_locale_fr=fr
+ # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name.
+ if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_fr=fr_FR.ISO8859-1
else
- # None found.
- gt_cv_locale_fr=none
+ # Test for the HP-UX locale name.
+ if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_fr=fr_FR.iso88591
+ else
+ # Test for the Solaris 7 locale name.
+ if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_fr=fr
+ else
+ # None found.
+ gt_cv_locale_fr=none
+ fi
+ fi
fi
fi
fi
- fi
- fi
+ ;;
+ esac
fi
rm -fr conftest*
])
@@ -179,27 +198,46 @@ int main () {
changequote([,])dnl
])])
if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
- # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
- # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
- # configure script would override the LC_ALL setting. Likewise for
- # LC_CTYPE, which is also set at the beginning of the configure script.
- # Test for the usual locale name.
- if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
- gt_cv_locale_fr_utf8=fr_FR
- else
- # Test for the locale name with explicit encoding suffix.
- if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_fr_utf8=fr_FR.UTF-8
- else
- # Test for the Solaris 7 locale name.
- if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_fr_utf8=fr.UTF-8
+ case "$host_os" in
+ # Handle native Windows specially, because there setlocale() interprets
+ # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+ # "fr" or "fra" as "French" or "French_France.1252",
+ # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+ # "ja" as "Japanese" or "Japanese_Japan.932",
+ # and similar.
+ mingw*)
+ # Test for the hypothetical native Win32 locale name.
+ if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_fr_utf8=French_France.65001
else
# None found.
gt_cv_locale_fr_utf8=none
fi
- fi
- fi
+ ;;
+ *)
+ # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+ # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+ # configure script would override the LC_ALL setting. Likewise for
+ # LC_CTYPE, which is also set at the beginning of the configure
script.
+ # Test for the usual locale name.
+ if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null;
then
+ gt_cv_locale_fr_utf8=fr_FR
+ else
+ # Test for the locale name with explicit encoding suffix.
+ if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_fr_utf8=fr_FR.UTF-8
+ else
+ # Test for the Solaris 7 locale name.
+ if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_fr_utf8=fr.UTF-8
+ else
+ # None found.
+ gt_cv_locale_fr_utf8=none
+ fi
+ fi
+ fi
+ ;;
+ esac
fi
rm -fr conftest*
])
diff --git a/m4/locale-ja.m4 b/m4/locale-ja.m4
index ac01c32..d44c2c8 100644
--- a/m4/locale-ja.m4
+++ b/m4/locale-ja.m4
@@ -76,42 +76,57 @@ int main ()
changequote([,])dnl
])])
if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
- # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
- # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
- # configure script would override the LC_ALL setting. Likewise for
- # LC_CTYPE, which is also set at the beginning of the configure script.
- # Test for the AIX locale name.
- if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
- gt_cv_locale_ja=ja_JP
- else
- # Test for the locale name with explicit encoding suffix.
- if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_ja=ja_JP.EUC-JP
- else
- # Test for the HP-UX, OSF/1, NetBSD locale name.
- if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_ja=ja_JP.eucJP
+ case "$host_os" in
+ # Handle native Windows specially, because there setlocale() interprets
+ # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+ # "fr" or "fra" as "French" or "French_France.1252",
+ # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+ # "ja" as "Japanese" or "Japanese_Japan.932",
+ # and similar.
+ mingw*)
+ # Note that on native Win32, the Japanese locale is
Japanese_Japan.932,
+ # and CP932 is very different from EUC-JP, so we cannot use it here.
+ gt_cv_locale_ja=none
+ ;;
+ *)
+ # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+ # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+ # configure script would override the LC_ALL setting. Likewise for
+ # LC_CTYPE, which is also set at the beginning of the configure
script.
+ # Test for the AIX locale name.
+ if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null;
then
+ gt_cv_locale_ja=ja_JP
else
- # Test for the IRIX, FreeBSD locale name.
- if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_ja=ja_JP.EUC
+ # Test for the locale name with explicit encoding suffix.
+ if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_ja=ja_JP.EUC-JP
else
- # Test for the Solaris 7 locale name.
- if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null;
then
- gt_cv_locale_ja=ja
+ # Test for the HP-UX, OSF/1, NetBSD locale name.
+ if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_ja=ja_JP.eucJP
else
- # Special test for NetBSD 1.6.
- if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then
- gt_cv_locale_ja=ja_JP.eucJP
+ # Test for the IRIX, FreeBSD locale name.
+ if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_ja=ja_JP.EUC
else
- # None found.
- gt_cv_locale_ja=none
+ # Test for the Solaris 7 locale name.
+ if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_ja=ja
+ else
+ # Special test for NetBSD 1.6.
+ if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then
+ gt_cv_locale_ja=ja_JP.eucJP
+ else
+ # None found.
+ gt_cv_locale_ja=none
+ fi
+ fi
fi
fi
fi
fi
- fi
- fi
+ ;;
+ esac
fi
rm -fr conftest*
])
diff --git a/m4/locale-tr.m4 b/m4/locale-tr.m4
index d0545c5..19ded1b 100644
--- a/m4/locale-tr.m4
+++ b/m4/locale-tr.m4
@@ -9,6 +9,7 @@ dnl From Bruno Haible.
dnl Determine the name of a turkish locale with UTF-8 encoding.
AC_DEFUN([gt_LOCALE_TR_UTF8],
[
+ AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AM_LANGINFO_CODESET])
AC_CACHE_CHECK([for a turkish Unicode locale], [gt_cv_locale_tr_utf8], [
AC_LANG_CONFTEST([AC_LANG_SOURCE([
@@ -76,27 +77,46 @@ int main () {
changequote([,])dnl
])])
if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
- # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
- # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
- # configure script would override the LC_ALL setting. Likewise for
- # LC_CTYPE, which is also set at the beginning of the configure script.
- # Test for the usual locale name.
- if (LC_ALL=tr_TR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
- gt_cv_locale_tr_utf8=tr_TR
- else
- # Test for the locale name with explicit encoding suffix.
- if (LC_ALL=tr_TR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_tr_utf8=tr_TR.UTF-8
- else
- # Test for the Solaris 7 locale name.
- if (LC_ALL=tr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_tr_utf8=tr.UTF-8
+ case "$host_os" in
+ # Handle native Windows specially, because there setlocale() interprets
+ # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+ # "fr" or "fra" as "French" or "French_France.1252",
+ # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+ # "ja" as "Japanese" or "Japanese_Japan.932",
+ # and similar.
+ mingw*)
+ # Test for the hypothetical native Win32 locale name.
+ if (LC_ALL=Turkish_Turkey.65001 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_tr_utf8=Turkish_Turkey.65001
else
# None found.
gt_cv_locale_tr_utf8=none
fi
- fi
- fi
+ ;;
+ *)
+ # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+ # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+ # configure script would override the LC_ALL setting. Likewise for
+ # LC_CTYPE, which is also set at the beginning of the configure
script.
+ # Test for the usual locale name.
+ if (LC_ALL=tr_TR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null;
then
+ gt_cv_locale_tr_utf8=tr_TR
+ else
+ # Test for the locale name with explicit encoding suffix.
+ if (LC_ALL=tr_TR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_tr_utf8=tr_TR.UTF-8
+ else
+ # Test for the Solaris 7 locale name.
+ if (LC_ALL=tr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_tr_utf8=tr.UTF-8
+ else
+ # None found.
+ gt_cv_locale_tr_utf8=none
+ fi
+ fi
+ fi
+ ;;
+ esac
else
gt_cv_locale_tr_utf8=none
fi
diff --git a/m4/locale-zh.m4 b/m4/locale-zh.m4
index c82d17b..e03f91f 100644
--- a/m4/locale-zh.m4
+++ b/m4/locale-zh.m4
@@ -77,22 +77,41 @@ int main ()
changequote([,])dnl
])])
if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
- # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
- # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
- # configure script would override the LC_ALL setting. Likewise for
- # LC_CTYPE, which is also set at the beginning of the configure script.
- # Test for the locale name without encoding suffix.
- if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
- gt_cv_locale_zh_CN=zh_CN
- else
- # Test for the locale name with explicit encoding suffix.
- if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_zh_CN=zh_CN.GB18030
- else
- # None found.
- gt_cv_locale_zh_CN=none
- fi
- fi
+ case "$host_os" in
+ # Handle native Windows specially, because there setlocale() interprets
+ # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+ # "fr" or "fra" as "French" or "French_France.1252",
+ # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+ # "ja" as "Japanese" or "Japanese_Japan.932",
+ # and similar.
+ mingw*)
+ # Test for the hypothetical native Win32 locale name.
+ if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_zh_CN=Chinese_China.54936
+ else
+ # None found.
+ gt_cv_locale_zh_CN=none
+ fi
+ ;;
+ *)
+ # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+ # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+ # configure script would override the LC_ALL setting. Likewise for
+ # LC_CTYPE, which is also set at the beginning of the configure
script.
+ # Test for the locale name without encoding suffix.
+ if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null;
then
+ gt_cv_locale_zh_CN=zh_CN
+ else
+ # Test for the locale name with explicit encoding suffix.
+ if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_zh_CN=zh_CN.GB18030
+ else
+ # None found.
+ gt_cv_locale_zh_CN=none
+ fi
+ fi
+ ;;
+ esac
else
# If there was a link error, due to mblen(), the system is so old that
# it certainly doesn't have a chinese locale.
--
1.6.3.2
--
In memoriam France Bloch-Sérazin
<http://en.wikipedia.org/wiki/France_Bloch-Sérazin>
- locale dependent tests on mingw,
Bruno Haible <=
- new module 'setlocale', Bruno Haible, 2011/02/12
- Re: new module 'setlocale', Bruno Haible, 2011/02/12
- Re: new module 'setlocale', Bruno Haible, 2011/02/12
- Re: new module 'setlocale', Eric Blake, 2011/02/17
- Re: new module 'setlocale', Bruno Haible, 2011/02/17
- Re: new module 'setlocale', Eric Blake, 2011/02/17
- Re: new module 'setlocale', Bruno Haible, 2011/02/17
- Re: new module 'setlocale', Eric Blake, 2011/02/18
Re: locale dependent tests on mingw, Ben Pfaff, 2011/02/12