Build dlopenable modules with `-module'.
[bpt/guile.git] / m4 / locale-fr.m4
CommitLineData
f240aacb 1# locale-fr.m4 serial 11
61cd9dc9 2dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc.
7f8e40b7
NJ
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Bruno Haible.
8
9dnl Determine the name of a french locale with traditional encoding.
10AC_DEFUN([gt_LOCALE_FR],
11[
12 AC_REQUIRE([AC_CANONICAL_HOST])
13 AC_REQUIRE([AM_LANGINFO_CODESET])
f240aacb
LC
14 AC_CACHE_CHECK([for a traditional french locale], [gt_cv_locale_fr], [
15 AC_LANG_CONFTEST([AC_LANG_SOURCE([
7f8e40b7
NJ
16changequote(,)dnl
17#include <locale.h>
18#include <time.h>
19#if HAVE_LANGINFO_CODESET
20# include <langinfo.h>
21#endif
22#include <stdlib.h>
23#include <string.h>
24struct tm t;
25char buf[16];
26int main () {
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
36 {
37 const char *cs = nl_langinfo (CODESET);
38 if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
39 return 1;
40 }
41#endif
42#ifdef __CYGWIN__
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;
47#endif
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;
57 return 0;
58}
59changequote([,])dnl
f240aacb
LC
60 ])])
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
68 gt_cv_locale_fr=fr_FR
69 else
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
7f8e40b7 73 else
f240aacb
LC
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
7f8e40b7 77 else
f240aacb
LC
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
7f8e40b7 81 else
f240aacb
LC
82 # Test for the Solaris 7 locale name.
83 if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
84 gt_cv_locale_fr=fr
7f8e40b7 85 else
f240aacb
LC
86 # None found.
87 gt_cv_locale_fr=none
7f8e40b7
NJ
88 fi
89 fi
90 fi
91 fi
92 fi
7f8e40b7 93 fi
f240aacb 94 rm -fr conftest*
7f8e40b7
NJ
95 ])
96 LOCALE_FR=$gt_cv_locale_fr
97 AC_SUBST([LOCALE_FR])
98])
99
100dnl Determine the name of a french locale with UTF-8 encoding.
101AC_DEFUN([gt_LOCALE_FR_UTF8],
102[
103 AC_REQUIRE([AM_LANGINFO_CODESET])
f240aacb 104 AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [
7f8e40b7
NJ
105 AC_LANG_CONFTEST([AC_LANG_SOURCE([
106changequote(,)dnl
107#include <locale.h>
108#include <time.h>
109#if HAVE_LANGINFO_CODESET
110# include <langinfo.h>
111#endif
112#include <stdlib.h>
113#include <string.h>
114struct tm t;
115char buf[16];
116int main () {
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
130 {
131 const char *cs = nl_langinfo (CODESET);
132 if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
133 return 1;
134 }
135# endif
136# ifdef __CYGWIN__
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;
141# endif
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')
148 return 1;
149#endif
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;
154 return 0;
155}
156changequote([,])dnl
157 ])])
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
166 else
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
170 else
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
174 else
175 # None found.
176 gt_cv_locale_fr_utf8=none
177 fi
178 fi
179 fi
180 fi
181 rm -fr conftest*
182 ])
183 LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8
184 AC_SUBST([LOCALE_FR_UTF8])
185])