1 # locale-fr.m4 serial 2 (gettext-0.14.2)
2 dnl Copyright (C) 2003, 2005 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_CACHE_CHECK([for a traditional french locale], gt_cv_locale_fr, [
19 if test -n "$macosx"; then
20 # On Darwin 7 (MacOS X), the libc supports some locales in non-UTF-8
21 # encodings, but the kernel does not support them. The documentation
23 # "... all code that calls BSD system routines should ensure
24 # that the const *char parameters of these routines are in UTF-8
25 # encoding. All BSD system functions expect their string
26 # parameters to be in UTF-8 encoding and nothing else."
27 # See the comments in config.charset. Therefore we bypass the test.
31 cat <<EOF > conftest.$ac_ext
37 /* Check whether the given locale name is recognized by the system. */
38 if (setlocale (LC_ALL, "") == NULL) return 1;
39 /* Check whether in the abbreviation of the second month, the second
40 character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only
41 one byte long. This excludes the UTF-8 encoding. */
42 t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
43 if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1;
48 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
49 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
50 # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
51 # configure script would override the LC_ALL setting.
52 # Test for the usual locale name.
53 if (LC_ALL=fr_FR LC_TIME= ./conftest; exit) 2>/dev/null; then
56 # Test for the locale name with explicit encoding suffix.
57 if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= ./conftest; exit) 2>/dev/null; then
58 gt_cv_locale_fr=fr_FR.ISO-8859-1
60 # Test for the AIX, OSF/1, FreeBSD, NetBSD locale name.
61 if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= ./conftest; exit) 2>/dev/null; then
62 gt_cv_locale_fr=fr_FR.ISO8859-1
64 # Test for the HP-UX locale name.
65 if (LC_ALL=fr_FR.iso88591 LC_TIME= ./conftest; exit) 2>/dev/null; then
66 gt_cv_locale_fr=fr_FR.iso88591
68 # Test for the Solaris 7 locale name.
69 if (LC_ALL=fr LC_TIME= ./conftest; exit) 2>/dev/null; then
72 # Special test for NetBSD 1.6.
73 if test -f /usr/share/locale/fr_FR.ISO8859-1/LC_CTYPE; then
74 gt_cv_locale_fr=fr_FR.ISO8859-1
88 LOCALE_FR=$gt_cv_locale_fr
92 dnl Determine the name of a french locale with UTF-8 encoding.
93 AC_DEFUN([gt_LOCALE_FR_UTF8],
95 AC_CACHE_CHECK([for a french Unicode locale], gt_cv_locale_fr_utf8, [
97 cat <<EOF > conftest.$ac_ext
103 /* On BeOS, locales are not implemented in libc. Rather, libintl
104 imitates locale dependent behaviour by looking at the environment
105 variables, and all locales use the UTF-8 encoding. */
106 #if !defined(__BEOS__)
107 /* Check whether the given locale name is recognized by the system. */
108 if (setlocale (LC_ALL, "") == NULL) return 1;
109 /* Check whether in the abbreviation of the second month, the second
110 character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is
111 two bytes long, with UTF-8 encoding. */
112 t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
113 if (strftime (buf, sizeof (buf), "%b", &t) < 4
114 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v')
121 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
122 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
123 # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
124 # configure script would override the LC_ALL setting.
125 # Test for the usual locale name.
126 if (LC_ALL=fr_FR LC_TIME= ./conftest; exit) 2>/dev/null; then
127 gt_cv_locale_fr_utf8=fr_FR
129 # Test for the locale name with explicit encoding suffix.
130 if (LC_ALL=fr_FR.UTF-8 LC_TIME= ./conftest; exit) 2>/dev/null; then
131 gt_cv_locale_fr_utf8=fr_FR.UTF-8
133 # Test for the Solaris 7 locale name.
134 if (LC_ALL=fr.UTF-8 LC_TIME= ./conftest; exit) 2>/dev/null; then
135 gt_cv_locale_fr_utf8=fr.UTF-8
138 gt_cv_locale_fr_utf8=none
145 LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8
146 AC_SUBST([LOCALE_FR_UTF8])