diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-01-31 13:46:01 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-01-31 13:46:01 (GMT) |
commit | e8bd88d1fcded01ccd066572eeaae1b507989cb3 (patch) | |
tree | c8e7be6c07c6f635f6e803e6a6ba9e7a95fee7c0 /gl/m4/locale-zh.m4 | |
parent | 2ad962c13473607ca0d974bfaa516a0ed53ec73d (diff) | |
download | monitoring-plugins-e8bd88d1fcded01ccd066572eeaae1b507989cb3.tar.gz |
Sync with the latest Gnulib code 668c0b8ffa
Diffstat (limited to 'gl/m4/locale-zh.m4')
-rw-r--r-- | gl/m4/locale-zh.m4 | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/gl/m4/locale-zh.m4 b/gl/m4/locale-zh.m4 index 4eed73f..b9f9eef 100644 --- a/gl/m4/locale-zh.m4 +++ b/gl/m4/locale-zh.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # locale-zh.m4 serial 12 | 1 | # locale-zh.m4 serial 15 |
2 | dnl Copyright (C) 2003, 2005-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -12,8 +12,7 @@ AC_DEFUN([gt_LOCALE_ZH_CN], | |||
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 transitional chinese locale], [gt_cv_locale_zh_CN], [ | 14 | AC_CACHE_CHECK([for a transitional chinese locale], [gt_cv_locale_zh_CN], [ |
15 | AC_LANG_CONFTEST([AC_LANG_SOURCE([ | 15 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[ |
16 | changequote(,)dnl | ||
17 | #include <locale.h> | 16 | #include <locale.h> |
18 | #include <stdlib.h> | 17 | #include <stdlib.h> |
19 | #include <time.h> | 18 | #include <time.h> |
@@ -26,9 +25,14 @@ struct tm t; | |||
26 | char buf[16]; | 25 | char buf[16]; |
27 | int main () | 26 | int main () |
28 | { | 27 | { |
29 | const char *p; | 28 | /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl |
29 | imitates locale dependent behaviour by looking at the environment | ||
30 | variables, and all locales use the UTF-8 encoding. */ | ||
31 | #if defined __BEOS__ || defined __HAIKU__ | ||
32 | return 1; | ||
33 | #else | ||
30 | /* Check whether the given locale name is recognized by the system. */ | 34 | /* Check whether the given locale name is recognized by the system. */ |
31 | #if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ | 35 | # if defined _WIN32 && !defined __CYGWIN__ |
32 | /* On native Windows, setlocale(category, "") looks at the system settings, | 36 | /* On native Windows, setlocale(category, "") looks at the system settings, |
33 | not at the environment variables. Also, when an encoding suffix such | 37 | not at the environment variables. Also, when an encoding suffix such |
34 | as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE | 38 | as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE |
@@ -36,9 +40,9 @@ int main () | |||
36 | if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL | 40 | if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL |
37 | || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) | 41 | || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) |
38 | return 1; | 42 | return 1; |
39 | #else | 43 | # else |
40 | if (setlocale (LC_ALL, "") == NULL) return 1; | 44 | if (setlocale (LC_ALL, "") == NULL) return 1; |
41 | #endif | 45 | # endif |
42 | /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". | 46 | /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". |
43 | On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) | 47 | On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) |
44 | is empty, and the behaviour of Tcl 8.4 in this locale is not useful. | 48 | is empty, and the behaviour of Tcl 8.4 in this locale is not useful. |
@@ -47,35 +51,38 @@ int main () | |||
47 | some unit tests fail. | 51 | some unit tests fail. |
48 | On MirBSD 10, when an unsupported locale is specified, setlocale() | 52 | On MirBSD 10, when an unsupported locale is specified, setlocale() |
49 | succeeds but then nl_langinfo(CODESET) is "UTF-8". */ | 53 | succeeds but then nl_langinfo(CODESET) is "UTF-8". */ |
50 | #if HAVE_LANGINFO_CODESET | 54 | # if HAVE_LANGINFO_CODESET |
51 | { | 55 | { |
52 | const char *cs = nl_langinfo (CODESET); | 56 | const char *cs = nl_langinfo (CODESET); |
53 | if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 | 57 | if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 |
54 | || strcmp (cs, "UTF-8") == 0) | 58 | || strcmp (cs, "UTF-8") == 0) |
55 | return 1; | 59 | return 1; |
56 | } | 60 | } |
57 | #endif | 61 | # endif |
58 | #ifdef __CYGWIN__ | 62 | # ifdef __CYGWIN__ |
59 | /* On Cygwin, avoid locale names without encoding suffix, because the | 63 | /* On Cygwin, avoid locale names without encoding suffix, because the |
60 | locale_charset() function relies on the encoding suffix. Note that | 64 | locale_charset() function relies on the encoding suffix. Note that |
61 | LC_ALL is set on the command line. */ | 65 | LC_ALL is set on the command line. */ |
62 | if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; | 66 | if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; |
63 | #endif | 67 | # endif |
64 | /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. | 68 | /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. |
65 | This excludes the UTF-8 encoding (except on MirBSD). */ | 69 | This excludes the UTF-8 encoding (except on MirBSD). */ |
66 | t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; | 70 | { |
67 | if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; | 71 | const char *p; |
68 | for (p = buf; *p != '\0'; p++) | 72 | t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; |
69 | if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) | 73 | if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; |
70 | return 1; | 74 | for (p = buf; *p != '\0'; p++) |
75 | if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) | ||
76 | return 1; | ||
77 | } | ||
71 | /* Check whether a typical GB18030 multibyte sequence is recognized as a | 78 | /* Check whether a typical GB18030 multibyte sequence is recognized as a |
72 | single wide character. This excludes the GB2312 and GBK encodings. */ | 79 | single wide character. This excludes the GB2312 and GBK encodings. */ |
73 | if (mblen ("\203\062\332\066", 5) != 4) | 80 | if (mblen ("\203\062\332\066", 5) != 4) |
74 | return 1; | 81 | return 1; |
75 | return 0; | 82 | return 0; |
83 | #endif | ||
76 | } | 84 | } |
77 | changequote([,])dnl | 85 | ]])]) |
78 | ])]) | ||
79 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 86 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
80 | case "$host_os" in | 87 | case "$host_os" in |
81 | # Handle native Windows specially, because there setlocale() interprets | 88 | # Handle native Windows specially, because there setlocale() interprets |