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.m445
1 files changed, 26 insertions, 19 deletions
diff --git a/gl/m4/locale-ja.m4 b/gl/m4/locale-ja.m4
index 132a3e77..25901730 100644
--- a/gl/m4/locale-ja.m4
+++ b/gl/m4/locale-ja.m4
@@ -1,5 +1,5 @@
1# locale-ja.m4 serial 12 1# locale-ja.m4 serial 15
2dnl Copyright (C) 2003, 2005-2013 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2005-2023 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.
@@ -12,8 +12,7 @@ AC_DEFUN([gt_LOCALE_JA],
12 AC_REQUIRE([AC_CANONICAL_HOST]) 12 AC_REQUIRE([AC_CANONICAL_HOST])
13 AC_REQUIRE([AM_LANGINFO_CODESET]) 13 AC_REQUIRE([AM_LANGINFO_CODESET])
14 AC_CACHE_CHECK([for a traditional japanese locale], [gt_cv_locale_ja], [ 14 AC_CACHE_CHECK([for a traditional japanese locale], [gt_cv_locale_ja], [
15 AC_LANG_CONFTEST([AC_LANG_SOURCE([ 15 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
16changequote(,)dnl
17#include <locale.h> 16#include <locale.h>
18#include <time.h> 17#include <time.h>
19#if HAVE_LANGINFO_CODESET 18#if HAVE_LANGINFO_CODESET
@@ -25,9 +24,14 @@ struct tm t;
25char buf[16]; 24char buf[16];
26int main () 25int main ()
27{ 26{
28 const char *p; 27 /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl
28 imitates locale dependent behaviour by looking at the environment
29 variables, and all locales use the UTF-8 encoding. */
30#if defined __BEOS__ || defined __HAIKU__
31 return 1;
32#else
29 /* Check whether the given locale name is recognized by the system. */ 33 /* Check whether the given locale name is recognized by the system. */
30#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ 34# if defined _WIN32 && !defined __CYGWIN__
31 /* On native Windows, setlocale(category, "") looks at the system settings, 35 /* On native Windows, setlocale(category, "") looks at the system settings,
32 not at the environment variables. Also, when an encoding suffix such 36 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 37 as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
@@ -35,9 +39,9 @@ int main ()
35 if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL 39 if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
36 || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) 40 || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
37 return 1; 41 return 1;
38#else 42# else
39 if (setlocale (LC_ALL, "") == NULL) return 1; 43 if (setlocale (LC_ALL, "") == NULL) return 1;
40#endif 44# endif
41 /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". 45 /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
42 On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) 46 On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
43 is empty, and the behaviour of Tcl 8.4 in this locale is not useful. 47 is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
@@ -46,35 +50,38 @@ int main ()
46 some unit tests fail. 50 some unit tests fail.
47 On MirBSD 10, when an unsupported locale is specified, setlocale() 51 On MirBSD 10, when an unsupported locale is specified, setlocale()
48 succeeds but then nl_langinfo(CODESET) is "UTF-8". */ 52 succeeds but then nl_langinfo(CODESET) is "UTF-8". */
49#if HAVE_LANGINFO_CODESET 53# if HAVE_LANGINFO_CODESET
50 { 54 {
51 const char *cs = nl_langinfo (CODESET); 55 const char *cs = nl_langinfo (CODESET);
52 if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 56 if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
53 || strcmp (cs, "UTF-8") == 0) 57 || strcmp (cs, "UTF-8") == 0)
54 return 1; 58 return 1;
55 } 59 }
56#endif 60# endif
57#ifdef __CYGWIN__ 61# ifdef __CYGWIN__
58 /* On Cygwin, avoid locale names without encoding suffix, because the 62 /* On Cygwin, avoid locale names without encoding suffix, because the
59 locale_charset() function relies on the encoding suffix. Note that 63 locale_charset() function relies on the encoding suffix. Note that
60 LC_ALL is set on the command line. */ 64 LC_ALL is set on the command line. */
61 if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; 65 if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
62#endif 66# endif
63 /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales 67 /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales
64 on Cygwin 1.5.x. */ 68 on Cygwin 1.5.x. */
65 if (MB_CUR_MAX == 1) 69 if (MB_CUR_MAX == 1)
66 return 1; 70 return 1;
67 /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. 71 /* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
68 This excludes the UTF-8 encoding (except on MirBSD). */ 72 This excludes the UTF-8 encoding (except on MirBSD). */
69 t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; 73 {
70 if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; 74 const char *p;
71 for (p = buf; *p != '\0'; p++) 75 t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
72 if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) 76 if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
73 return 1; 77 for (p = buf; *p != '\0'; p++)
78 if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0)
79 return 1;
80 }
74 return 0; 81 return 0;
82#endif
75} 83}
76changequote([,])dnl 84 ]])])
77 ])])
78 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 85 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
79 case "$host_os" in 86 case "$host_os" in
80 # Handle native Windows specially, because there setlocale() interprets 87 # Handle native Windows specially, because there setlocale() interprets