2N/Adnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc.
2N/Adnl This file is free software; the Free Software Foundation
2N/Adnl gives unlimited permission to copy
and/or distribute it,
2N/Adnl with or without modifications, as long as this notice is preserved.
2N/Adnl From Bruno Haible.
2N/Adnl Determine the name of a japanese locale with EUC-JP encoding.
2N/AAC_DEFUN([gt_LOCALE_JA],
2N/A AC_REQUIRE([AC_CANONICAL_HOST])
2N/A AC_REQUIRE([AM_LANGINFO_CODESET])
2N/A AC_CACHE_CHECK([for a traditional japanese locale], [gt_cv_locale_ja], [
2N/A AC_LANG_CONFTEST([AC_LANG_SOURCE([
2N/A#if HAVE_LANGINFO_CODESET
2N/A /* Check whether the given locale name is recognized by the system. */
2N/A if (setlocale (LC_ALL, "") == NULL) return 1;
2N/A /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
2N/A On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
2N/A is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
2N/A On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
2N/A succeeds but then nl_langinfo(CODESET) is "646". In this situation,
2N/A some unit tests fail. */
2N/A#if HAVE_LANGINFO_CODESET
2N/A const char *cs = nl_langinfo (CODESET);
2N/A if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
2N/A /* On Cygwin, avoid locale names without encoding suffix, because the
2N/A locale_charset() function relies on the encoding suffix. Note that
2N/A LC_ALL is set on the command line. */
2N/A if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
2N/A /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales
2N/A if (MB_CUR_MAX == 1)
2N/A /* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
2N/A This excludes the UTF-8 encoding. */
2N/A if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
2N/A for (p = buf; *p != '\0'; p++)
2N/A if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0)
2N/A if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
2N/A # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
2N/A # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
2N/A # configure script would override the LC_ALL setting. Likewise for
2N/A # LC_CTYPE, which is also set at the beginning of the configure script.
2N/A # Test for the AIX locale name.
2N/A if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>
/dev/null; then
2N/A gt_cv_locale_ja=ja_JP
2N/A # Test for the locale name with explicit encoding suffix.
2N/A # Test for the HP-UX, OSF/1, NetBSD locale name.
2N/A # Test for the IRIX, FreeBSD locale name.
2N/A # Test for the Solaris 7 locale name.
2N/A if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>
/dev/null; then
2N/A # Special test for NetBSD 1.6.
2N/A gt_cv_locale_ja=none
2N/A LOCALE_JA=$gt_cv_locale_ja
2N/A AC_SUBST([LOCALE_JA])