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