summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--m4/locale-ar.m452
-rw-r--r--m4/locale-fr.m4122
-rw-r--r--m4/locale-ja.m471
-rw-r--r--m4/locale-tr.m454
-rw-r--r--m4/locale-zh.m451
6 files changed, 242 insertions, 121 deletions
diff --git a/ChangeLog b/ChangeLog
index bcaa894ea3..406353ef4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,19 @@
2011-02-11 Bruno Haible <bruno@clisp.org>
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.
+
+ 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.
diff --git a/m4/locale-ar.m4 b/m4/locale-ar.m4
index 91d8405069..bbf75055f9 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 aa8b16174a..3f4f954e50 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 ac01c3284f..d44c2c8089 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 d0545c5301..19ded1b4aa 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 c82d17b588..e03f91f06a 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.