summaryrefslogtreecommitdiffstats
path: root/gl/m4/locale-ja.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/locale-ja.m4')
-rw-r--r--gl/m4/locale-ja.m497
1 files changed, 63 insertions, 34 deletions
diff --git a/gl/m4/locale-ja.m4 b/gl/m4/locale-ja.m4
index 0eedaf1..132a3e7 100644
--- a/gl/m4/locale-ja.m4
+++ b/gl/m4/locale-ja.m4
@@ -1,5 +1,5 @@
1# locale-ja.m4 serial 7 1# locale-ja.m4 serial 12
2dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2005-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -27,17 +27,30 @@ int main ()
27{ 27{
28 const char *p; 28 const char *p;
29 /* Check whether the given locale name is recognized by the system. */ 29 /* Check whether the given locale name is recognized by the system. */
30#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
31 /* On native Windows, setlocale(category, "") looks at the system settings,
32 not at the environment variables. Also, when an encoding suffix such
33 as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
34 category of the locale to "C". */
35 if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
36 || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
37 return 1;
38#else
30 if (setlocale (LC_ALL, "") == NULL) return 1; 39 if (setlocale (LC_ALL, "") == NULL) return 1;
40#endif
31 /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". 41 /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
32 On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) 42 On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
33 is empty, and the behaviour of Tcl 8.4 in this locale is not useful. 43 is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
34 On OpenBSD 4.0, when an unsupported locale is specified, setlocale() 44 On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
35 succeeds but then nl_langinfo(CODESET) is "646". In this situation, 45 succeeds but then nl_langinfo(CODESET) is "646". In this situation,
36 some unit tests fail. */ 46 some unit tests fail.
47 On MirBSD 10, when an unsupported locale is specified, setlocale()
48 succeeds but then nl_langinfo(CODESET) is "UTF-8". */
37#if HAVE_LANGINFO_CODESET 49#if HAVE_LANGINFO_CODESET
38 { 50 {
39 const char *cs = nl_langinfo (CODESET); 51 const char *cs = nl_langinfo (CODESET);
40 if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) 52 if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
53 || strcmp (cs, "UTF-8") == 0)
41 return 1; 54 return 1;
42 } 55 }
43#endif 56#endif
@@ -52,7 +65,7 @@ int main ()
52 if (MB_CUR_MAX == 1) 65 if (MB_CUR_MAX == 1)
53 return 1; 66 return 1;
54 /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. 67 /* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
55 This excludes the UTF-8 encoding. */ 68 This excludes the UTF-8 encoding (except on MirBSD). */
56 t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; 69 t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
57 if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; 70 if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
58 for (p = buf; *p != '\0'; p++) 71 for (p = buf; *p != '\0'; p++)
@@ -63,42 +76,58 @@ int main ()
63changequote([,])dnl 76changequote([,])dnl
64 ])]) 77 ])])
65 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 78 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
66 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because 79 case "$host_os" in
67 # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the 80 # Handle native Windows specially, because there setlocale() interprets
68 # configure script would override the LC_ALL setting. Likewise for 81 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
69 # LC_CTYPE, which is also set at the beginning of the configure script. 82 # "fr" or "fra" as "French" or "French_France.1252",
70 # Test for the AIX locale name. 83 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
71 if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 84 # "ja" as "Japanese" or "Japanese_Japan.932",
72 gt_cv_locale_ja=ja_JP 85 # and similar.
73 else 86 mingw*)
74 # Test for the locale name with explicit encoding suffix. 87 # Note that on native Windows, the Japanese locale is
75 if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 88 # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we
76 gt_cv_locale_ja=ja_JP.EUC-JP 89 # cannot use it here.
77 else 90 gt_cv_locale_ja=none
78 # Test for the HP-UX, OSF/1, NetBSD locale name. 91 ;;
79 if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 92 *)
80 gt_cv_locale_ja=ja_JP.eucJP 93 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
94 # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the
95 # configure script would override the LC_ALL setting. Likewise for
96 # LC_CTYPE, which is also set at the beginning of the configure script.
97 # Test for the AIX locale name.
98 if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
99 gt_cv_locale_ja=ja_JP
81 else 100 else
82 # Test for the IRIX, FreeBSD locale name. 101 # Test for the locale name with explicit encoding suffix.
83 if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 102 if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
84 gt_cv_locale_ja=ja_JP.EUC 103 gt_cv_locale_ja=ja_JP.EUC-JP
85 else 104 else
86 # Test for the Solaris 7 locale name. 105 # Test for the HP-UX, OSF/1, NetBSD locale name.
87 if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 106 if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
88 gt_cv_locale_ja=ja 107 gt_cv_locale_ja=ja_JP.eucJP
89 else 108 else
90 # Special test for NetBSD 1.6. 109 # Test for the IRIX, FreeBSD locale name.
91 if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then 110 if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
92 gt_cv_locale_ja=ja_JP.eucJP 111 gt_cv_locale_ja=ja_JP.EUC
93 else 112 else
94 # None found. 113 # Test for the Solaris 7 locale name.
95 gt_cv_locale_ja=none 114 if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
115 gt_cv_locale_ja=ja
116 else
117 # Special test for NetBSD 1.6.
118 if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then
119 gt_cv_locale_ja=ja_JP.eucJP
120 else
121 # None found.
122 gt_cv_locale_ja=none
123 fi
124 fi
96 fi 125 fi
97 fi 126 fi
98 fi 127 fi
99 fi 128 fi
100 fi 129 ;;
101 fi 130 esac
102 fi 131 fi
103 rm -fr conftest* 132 rm -fr conftest*
104 ]) 133 ])