1
# locale-fr.m4 serial 11
2
dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc.
3
dnl This file is free software; the Free Software Foundation
4
dnl gives unlimited permission to copy and/or distribute it,
5
dnl with or without modifications, as long as this notice is preserved.
9
dnl Determine the name of a french locale with traditional encoding.
10
AC_DEFUN([gt_LOCALE_FR],
12
AC_REQUIRE([AC_CANONICAL_HOST])
13
AC_REQUIRE([AM_LANGINFO_CODESET])
14
AC_CACHE_CHECK([for a traditional french locale], [gt_cv_locale_fr], [
15
AC_LANG_CONFTEST([AC_LANG_SOURCE([
19
#if HAVE_LANGINFO_CODESET
20
# include <langinfo.h>
27
/* Check whether the given locale name is recognized by the system. */
28
if (setlocale (LC_ALL, "") == NULL) return 1;
29
/* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
30
On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
31
is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
32
On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
33
succeeds but then nl_langinfo(CODESET) is "646". In this situation,
34
some unit tests fail. */
35
#if HAVE_LANGINFO_CODESET
37
const char *cs = nl_langinfo (CODESET);
38
if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
43
/* On Cygwin, avoid locale names without encoding suffix, because the
44
locale_charset() function relies on the encoding suffix. Note that
45
LC_ALL is set on the command line. */
46
if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
48
/* Check whether in the abbreviation of the second month, the second
49
character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only
50
one byte long. This excludes the UTF-8 encoding. */
51
t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
52
if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1;
53
/* Check whether the decimal separator is a comma.
54
On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point
55
are nl_langinfo(RADIXCHAR) are both ".". */
56
if (localeconv () ->decimal_point[0] != ',') return 1;
61
if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
62
# Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
63
# otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
64
# configure script would override the LC_ALL setting. Likewise for
65
# LC_CTYPE, which is also set at the beginning of the configure script.
66
# Test for the usual locale name.
67
if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
70
# Test for the locale name with explicit encoding suffix.
71
if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
72
gt_cv_locale_fr=fr_FR.ISO-8859-1
74
# Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name.
75
if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
76
gt_cv_locale_fr=fr_FR.ISO8859-1
78
# Test for the HP-UX locale name.
79
if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
80
gt_cv_locale_fr=fr_FR.iso88591
82
# Test for the Solaris 7 locale name.
83
if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
96
LOCALE_FR=$gt_cv_locale_fr
100
dnl Determine the name of a french locale with UTF-8 encoding.
101
AC_DEFUN([gt_LOCALE_FR_UTF8],
103
AC_REQUIRE([AM_LANGINFO_CODESET])
104
AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [
105
AC_LANG_CONFTEST([AC_LANG_SOURCE([
109
#if HAVE_LANGINFO_CODESET
110
# include <langinfo.h>
117
/* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl
118
imitates locale dependent behaviour by looking at the environment
119
variables, and all locales use the UTF-8 encoding. */
120
#if !(defined __BEOS__ || defined __HAIKU__)
121
/* Check whether the given locale name is recognized by the system. */
122
if (setlocale (LC_ALL, "") == NULL) return 1;
123
/* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
124
On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
125
is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
126
On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
127
succeeds but then nl_langinfo(CODESET) is "646". In this situation,
128
some unit tests fail. */
129
# if HAVE_LANGINFO_CODESET
131
const char *cs = nl_langinfo (CODESET);
132
if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
137
/* On Cygwin, avoid locale names without encoding suffix, because the
138
locale_charset() function relies on the encoding suffix. Note that
139
LC_ALL is set on the command line. */
140
if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
142
/* Check whether in the abbreviation of the second month, the second
143
character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is
144
two bytes long, with UTF-8 encoding. */
145
t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
146
if (strftime (buf, sizeof (buf), "%b", &t) < 4
147
|| buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v')
150
/* Check whether the decimal separator is a comma.
151
On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point
152
are nl_langinfo(RADIXCHAR) are both ".". */
153
if (localeconv () ->decimal_point[0] != ',') return 1;
158
if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
159
# Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
160
# otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
161
# configure script would override the LC_ALL setting. Likewise for
162
# LC_CTYPE, which is also set at the beginning of the configure script.
163
# Test for the usual locale name.
164
if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
165
gt_cv_locale_fr_utf8=fr_FR
167
# Test for the locale name with explicit encoding suffix.
168
if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
169
gt_cv_locale_fr_utf8=fr_FR.UTF-8
171
# Test for the Solaris 7 locale name.
172
if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
173
gt_cv_locale_fr_utf8=fr.UTF-8
176
gt_cv_locale_fr_utf8=none
183
LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8
184
AC_SUBST([LOCALE_FR_UTF8])