diff options
Diffstat (limited to 'm4/gettext.m4')
-rw-r--r-- | m4/gettext.m4 | 587 |
1 files changed, 587 insertions, 0 deletions
diff --git a/m4/gettext.m4 b/m4/gettext.m4 new file mode 100644 index 0000000..45cad85 --- /dev/null +++ b/m4/gettext.m4 | |||
@@ -0,0 +1,587 @@ | |||
1 | # gettext.m4 serial 17 (gettext-0.11.5) | ||
2 | dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | dnl | ||
9 | dnl This file can can be used in projects which are not available under | ||
10 | dnl the GNU General Public License or the GNU Library General Public | ||
11 | dnl License but which still want to provide support for the GNU gettext | ||
12 | dnl functionality. | ||
13 | dnl Please note that the actual code of the GNU gettext library is covered | ||
14 | dnl by the GNU Library General Public License, and the rest of the GNU | ||
15 | dnl gettext package package is covered by the GNU General Public License. | ||
16 | dnl They are *not* in the public domain. | ||
17 | |||
18 | dnl Authors: | ||
19 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. | ||
20 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2002. | ||
21 | |||
22 | dnl Macro to add for using GNU gettext. | ||
23 | |||
24 | dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). | ||
25 | dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The | ||
26 | dnl default (if it is not specified or empty) is 'no-libtool'. | ||
27 | dnl INTLSYMBOL should be 'external' for packages with no intl directory, | ||
28 | dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. | ||
29 | dnl If INTLSYMBOL is 'use-libtool', then a libtool library | ||
30 | dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, | ||
31 | dnl depending on --{enable,disable}-{shared,static} and on the presence of | ||
32 | dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library | ||
33 | dnl $(top_builddir)/intl/libintl.a will be created. | ||
34 | dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext | ||
35 | dnl implementations (in libc or libintl) without the ngettext() function | ||
36 | dnl will be ignored. If NEEDSYMBOL is specified and is | ||
37 | dnl 'need-formatstring-macros', then GNU gettext implementations that don't | ||
38 | dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored. | ||
39 | dnl INTLDIR is used to find the intl libraries. If empty, | ||
40 | dnl the value `$(top_builddir)/intl/' is used. | ||
41 | dnl | ||
42 | dnl The result of the configuration is one of three cases: | ||
43 | dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled | ||
44 | dnl and used. | ||
45 | dnl Catalog format: GNU --> install in $(datadir) | ||
46 | dnl Catalog extension: .mo after installation, .gmo in source tree | ||
47 | dnl 2) GNU gettext has been found in the system's C library. | ||
48 | dnl Catalog format: GNU --> install in $(datadir) | ||
49 | dnl Catalog extension: .mo after installation, .gmo in source tree | ||
50 | dnl 3) No internationalization, always use English msgid. | ||
51 | dnl Catalog format: none | ||
52 | dnl Catalog extension: none | ||
53 | dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. | ||
54 | dnl The use of .gmo is historical (it was needed to avoid overwriting the | ||
55 | dnl GNU format catalogs when building on a platform with an X/Open gettext), | ||
56 | dnl but we keep it in order not to force irrelevant filename changes on the | ||
57 | dnl maintainers. | ||
58 | dnl | ||
59 | AC_DEFUN([AM_GNU_GETTEXT], | ||
60 | [ | ||
61 | dnl Argument checking. | ||
62 | ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , | ||
63 | [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT | ||
64 | ])])])])]) | ||
65 | ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , | ||
66 | [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT | ||
67 | ])])])]) | ||
68 | define(gt_included_intl, ifelse([$1], [external], [no], [yes])) | ||
69 | define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) | ||
70 | |||
71 | AC_REQUIRE([AM_PO_SUBDIRS])dnl | ||
72 | ifelse(gt_included_intl, yes, [ | ||
73 | AC_REQUIRE([AM_INTL_SUBDIR])dnl | ||
74 | ]) | ||
75 | |||
76 | dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. | ||
77 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | ||
78 | AC_REQUIRE([AC_LIB_RPATH]) | ||
79 | |||
80 | dnl Sometimes libintl requires libiconv, so first search for libiconv. | ||
81 | dnl Ideally we would do this search only after the | ||
82 | dnl if test "$USE_NLS" = "yes"; then | ||
83 | dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then | ||
84 | dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT | ||
85 | dnl the configure script would need to contain the same shell code | ||
86 | dnl again, outside any 'if'. There are two solutions: | ||
87 | dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. | ||
88 | dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. | ||
89 | dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not | ||
90 | dnl documented, we avoid it. | ||
91 | ifelse(gt_included_intl, yes, , [ | ||
92 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) | ||
93 | ]) | ||
94 | |||
95 | AC_MSG_CHECKING([whether NLS is requested]) | ||
96 | dnl Default is enabled NLS | ||
97 | AC_ARG_ENABLE(nls, | ||
98 | [ --disable-nls do not use Native Language Support], | ||
99 | USE_NLS=$enableval, USE_NLS=yes) | ||
100 | AC_MSG_RESULT($USE_NLS) | ||
101 | AC_SUBST(USE_NLS) | ||
102 | |||
103 | ifelse(gt_included_intl, yes, [ | ||
104 | BUILD_INCLUDED_LIBINTL=no | ||
105 | USE_INCLUDED_LIBINTL=no | ||
106 | ]) | ||
107 | LIBINTL= | ||
108 | LTLIBINTL= | ||
109 | POSUB= | ||
110 | |||
111 | dnl If we use NLS figure out what method | ||
112 | if test "$USE_NLS" = "yes"; then | ||
113 | gt_use_preinstalled_gnugettext=no | ||
114 | ifelse(gt_included_intl, yes, [ | ||
115 | AC_MSG_CHECKING([whether included gettext is requested]) | ||
116 | AC_ARG_WITH(included-gettext, | ||
117 | [ --with-included-gettext use the GNU gettext library included here], | ||
118 | nls_cv_force_use_gnu_gettext=$withval, | ||
119 | nls_cv_force_use_gnu_gettext=no) | ||
120 | AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) | ||
121 | |||
122 | nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" | ||
123 | if test "$nls_cv_force_use_gnu_gettext" != "yes"; then | ||
124 | ]) | ||
125 | dnl User does not insist on using GNU NLS library. Figure out what | ||
126 | dnl to use. If GNU gettext is available we use this. Else we have | ||
127 | dnl to fall back to GNU NLS library. | ||
128 | |||
129 | dnl Add a version number to the cache macros. | ||
130 | define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) | ||
131 | define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) | ||
132 | define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) | ||
133 | |||
134 | AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, | ||
135 | [AC_TRY_LINK([#include <libintl.h> | ||
136 | ]ifelse([$2], [need-formatstring-macros], | ||
137 | [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION | ||
138 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) | ||
139 | #endif | ||
140 | changequote(,)dnl | ||
141 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; | ||
142 | changequote([,])dnl | ||
143 | ], [])[extern int _nl_msg_cat_cntr; | ||
144 | extern int *_nl_domain_bindings;], | ||
145 | [bindtextdomain ("", ""); | ||
146 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], | ||
147 | gt_cv_func_gnugettext_libc=yes, | ||
148 | gt_cv_func_gnugettext_libc=no)]) | ||
149 | |||
150 | if test "$gt_cv_func_gnugettext_libc" != "yes"; then | ||
151 | dnl Sometimes libintl requires libiconv, so first search for libiconv. | ||
152 | ifelse(gt_included_intl, yes, , [ | ||
153 | AM_ICONV_LINK | ||
154 | ]) | ||
155 | dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL | ||
156 | dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) | ||
157 | dnl because that would add "-liconv" to LIBINTL and LTLIBINTL | ||
158 | dnl even if libiconv doesn't exist. | ||
159 | AC_LIB_LINKFLAGS_BODY([intl]) | ||
160 | AC_CACHE_CHECK([for GNU gettext in libintl], | ||
161 | gt_cv_func_gnugettext_libintl, | ||
162 | [gt_save_CPPFLAGS="$CPPFLAGS" | ||
163 | CPPFLAGS="$CPPFLAGS $INCINTL" | ||
164 | gt_save_LIBS="$LIBS" | ||
165 | LIBS="$LIBS $LIBINTL" | ||
166 | dnl Now see whether libintl exists and does not depend on libiconv. | ||
167 | AC_TRY_LINK([#include <libintl.h> | ||
168 | ]ifelse([$2], [need-formatstring-macros], | ||
169 | [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION | ||
170 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) | ||
171 | #endif | ||
172 | changequote(,)dnl | ||
173 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; | ||
174 | changequote([,])dnl | ||
175 | ], [])[extern int _nl_msg_cat_cntr; | ||
176 | extern | ||
177 | #ifdef __cplusplus | ||
178 | "C" | ||
179 | #endif | ||
180 | const char *_nl_expand_alias ();], | ||
181 | [bindtextdomain ("", ""); | ||
182 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], | ||
183 | gt_cv_func_gnugettext_libintl=yes, | ||
184 | gt_cv_func_gnugettext_libintl=no) | ||
185 | dnl Now see whether libintl exists and depends on libiconv. | ||
186 | if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then | ||
187 | LIBS="$LIBS $LIBICONV" | ||
188 | AC_TRY_LINK([#include <libintl.h> | ||
189 | ]ifelse([$2], [need-formatstring-macros], | ||
190 | [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION | ||
191 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) | ||
192 | #endif | ||
193 | changequote(,)dnl | ||
194 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; | ||
195 | changequote([,])dnl | ||
196 | ], [])[extern int _nl_msg_cat_cntr; | ||
197 | extern | ||
198 | #ifdef __cplusplus | ||
199 | "C" | ||
200 | #endif | ||
201 | const char *_nl_expand_alias ();], | ||
202 | [bindtextdomain ("", ""); | ||
203 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], | ||
204 | [LIBINTL="$LIBINTL $LIBICONV" | ||
205 | LTLIBINTL="$LTLIBINTL $LTLIBICONV" | ||
206 | gt_cv_func_gnugettext_libintl=yes | ||
207 | ]) | ||
208 | fi | ||
209 | CPPFLAGS="$gt_save_CPPFLAGS" | ||
210 | LIBS="$gt_save_LIBS"]) | ||
211 | fi | ||
212 | |||
213 | dnl If an already present or preinstalled GNU gettext() is found, | ||
214 | dnl use it. But if this macro is used in GNU gettext, and GNU | ||
215 | dnl gettext is already preinstalled in libintl, we update this | ||
216 | dnl libintl. (Cf. the install rule in intl/Makefile.in.) | ||
217 | if test "$gt_cv_func_gnugettext_libc" = "yes" \ | ||
218 | || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ | ||
219 | && test "$PACKAGE" != gettext; }; then | ||
220 | gt_use_preinstalled_gnugettext=yes | ||
221 | else | ||
222 | dnl Reset the values set by searching for libintl. | ||
223 | LIBINTL= | ||
224 | LTLIBINTL= | ||
225 | INCINTL= | ||
226 | fi | ||
227 | |||
228 | ifelse(gt_included_intl, yes, [ | ||
229 | if test "$gt_use_preinstalled_gnugettext" != "yes"; then | ||
230 | dnl GNU gettext is not found in the C library. | ||
231 | dnl Fall back on included GNU gettext library. | ||
232 | nls_cv_use_gnu_gettext=yes | ||
233 | fi | ||
234 | fi | ||
235 | |||
236 | if test "$nls_cv_use_gnu_gettext" = "yes"; then | ||
237 | dnl Mark actions used to generate GNU NLS library. | ||
238 | INTLOBJS="\$(GETTOBJS)" | ||
239 | BUILD_INCLUDED_LIBINTL=yes | ||
240 | USE_INCLUDED_LIBINTL=yes | ||
241 | LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" | ||
242 | LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" | ||
243 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` | ||
244 | fi | ||
245 | |||
246 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ | ||
247 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | ||
248 | dnl Mark actions to use GNU gettext tools. | ||
249 | CATOBJEXT=.gmo | ||
250 | fi | ||
251 | ]) | ||
252 | |||
253 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ | ||
254 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | ||
255 | AC_DEFINE(ENABLE_NLS, 1, | ||
256 | [Define to 1 if translation of program messages to the user's native language | ||
257 | is requested.]) | ||
258 | else | ||
259 | USE_NLS=no | ||
260 | fi | ||
261 | fi | ||
262 | |||
263 | if test "$USE_NLS" = "yes"; then | ||
264 | |||
265 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then | ||
266 | if test "$gt_cv_func_gnugettext_libintl" = "yes"; then | ||
267 | AC_MSG_CHECKING([how to link with libintl]) | ||
268 | AC_MSG_RESULT([$LIBINTL]) | ||
269 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) | ||
270 | fi | ||
271 | |||
272 | dnl For backward compatibility. Some packages may be using this. | ||
273 | AC_DEFINE(HAVE_GETTEXT, 1, | ||
274 | [Define if the GNU gettext() function is already present or preinstalled.]) | ||
275 | AC_DEFINE(HAVE_DCGETTEXT, 1, | ||
276 | [Define if the GNU dcgettext() function is already present or preinstalled.]) | ||
277 | fi | ||
278 | |||
279 | dnl We need to process the po/ directory. | ||
280 | POSUB=po | ||
281 | fi | ||
282 | |||
283 | ifelse(gt_included_intl, yes, [ | ||
284 | dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL | ||
285 | dnl to 'yes' because some of the testsuite requires it. | ||
286 | if test "$PACKAGE" = gettext; then | ||
287 | BUILD_INCLUDED_LIBINTL=yes | ||
288 | fi | ||
289 | |||
290 | dnl Make all variables we use known to autoconf. | ||
291 | AC_SUBST(BUILD_INCLUDED_LIBINTL) | ||
292 | AC_SUBST(USE_INCLUDED_LIBINTL) | ||
293 | AC_SUBST(CATOBJEXT) | ||
294 | AC_SUBST(INTLOBJS) | ||
295 | |||
296 | dnl For backward compatibility. Some configure.ins may be using this. | ||
297 | nls_cv_header_intl= | ||
298 | nls_cv_header_libgt= | ||
299 | |||
300 | dnl For backward compatibility. Some Makefiles may be using this. | ||
301 | DATADIRNAME=share | ||
302 | AC_SUBST(DATADIRNAME) | ||
303 | |||
304 | dnl For backward compatibility. Some Makefiles may be using this. | ||
305 | INSTOBJEXT=.mo | ||
306 | AC_SUBST(INSTOBJEXT) | ||
307 | |||
308 | dnl For backward compatibility. Some Makefiles may be using this. | ||
309 | GENCAT=gencat | ||
310 | AC_SUBST(GENCAT) | ||
311 | |||
312 | dnl Enable libtool support if the surrounding package wishes it. | ||
313 | INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix | ||
314 | AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) | ||
315 | ]) | ||
316 | |||
317 | dnl For backward compatibility. Some Makefiles may be using this. | ||
318 | INTLLIBS="$LIBINTL" | ||
319 | AC_SUBST(INTLLIBS) | ||
320 | |||
321 | dnl Make all documented variables known to autoconf. | ||
322 | AC_SUBST(LIBINTL) | ||
323 | AC_SUBST(LTLIBINTL) | ||
324 | AC_SUBST(POSUB) | ||
325 | ]) | ||
326 | |||
327 | |||
328 | dnl Checks for all prerequisites of the po subdirectory, | ||
329 | dnl except for USE_NLS. | ||
330 | AC_DEFUN([AM_PO_SUBDIRS], | ||
331 | [ | ||
332 | AC_REQUIRE([AC_PROG_MAKE_SET])dnl | ||
333 | AC_REQUIRE([AC_PROG_INSTALL])dnl | ||
334 | AC_REQUIRE([AM_MKINSTALLDIRS])dnl | ||
335 | |||
336 | dnl Perform the following tests also if --disable-nls has been given, | ||
337 | dnl because they are needed for "make dist" to work. | ||
338 | |||
339 | dnl Search for GNU msgfmt in the PATH. | ||
340 | dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. | ||
341 | dnl The second test excludes FreeBSD msgfmt. | ||
342 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, | ||
343 | [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && | ||
344 | (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], | ||
345 | :) | ||
346 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) | ||
347 | |||
348 | dnl Search for GNU xgettext 0.11 or newer in the PATH. | ||
349 | dnl The first test excludes Solaris xgettext and early GNU xgettext versions. | ||
350 | dnl The second test excludes FreeBSD xgettext. | ||
351 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, | ||
352 | [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && | ||
353 | (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], | ||
354 | :) | ||
355 | dnl Remove leftover from FreeBSD xgettext call. | ||
356 | rm -f messages.po | ||
357 | |||
358 | dnl Search for GNU msgmerge 0.11 or newer in the PATH. | ||
359 | AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, | ||
360 | [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) | ||
361 | |||
362 | dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. | ||
363 | dnl Test whether we really found GNU msgfmt. | ||
364 | if test "$GMSGFMT" != ":"; then | ||
365 | dnl If it is no GNU msgfmt we define it as : so that the | ||
366 | dnl Makefiles still can work. | ||
367 | if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && | ||
368 | (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then | ||
369 | : ; | ||
370 | else | ||
371 | GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` | ||
372 | AC_MSG_RESULT( | ||
373 | [found $GMSGFMT program is not GNU msgfmt; ignore it]) | ||
374 | GMSGFMT=":" | ||
375 | fi | ||
376 | fi | ||
377 | |||
378 | dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. | ||
379 | dnl Test whether we really found GNU xgettext. | ||
380 | if test "$XGETTEXT" != ":"; then | ||
381 | dnl If it is no GNU xgettext we define it as : so that the | ||
382 | dnl Makefiles still can work. | ||
383 | if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && | ||
384 | (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then | ||
385 | : ; | ||
386 | else | ||
387 | AC_MSG_RESULT( | ||
388 | [found xgettext program is not GNU xgettext; ignore it]) | ||
389 | XGETTEXT=":" | ||
390 | fi | ||
391 | dnl Remove leftover from FreeBSD xgettext call. | ||
392 | rm -f messages.po | ||
393 | fi | ||
394 | |||
395 | AC_OUTPUT_COMMANDS([ | ||
396 | for ac_file in $CONFIG_FILES; do | ||
397 | # Support "outfile[:infile[:infile...]]" | ||
398 | case "$ac_file" in | ||
399 | *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; | ||
400 | esac | ||
401 | # PO directories have a Makefile.in generated from Makefile.in.in. | ||
402 | case "$ac_file" in */Makefile.in) | ||
403 | # Adjust a relative srcdir. | ||
404 | ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` | ||
405 | ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" | ||
406 | ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` | ||
407 | # In autoconf-2.13 it is called $ac_given_srcdir. | ||
408 | # In autoconf-2.50 it is called $srcdir. | ||
409 | test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" | ||
410 | case "$ac_given_srcdir" in | ||
411 | .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; | ||
412 | /*) top_srcdir="$ac_given_srcdir" ;; | ||
413 | *) top_srcdir="$ac_dots$ac_given_srcdir" ;; | ||
414 | esac | ||
415 | if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then | ||
416 | rm -f "$ac_dir/POTFILES" | ||
417 | test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" | ||
418 | cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" | ||
419 | # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend | ||
420 | # on $ac_dir but don't depend on user-specified configuration | ||
421 | # parameters. | ||
422 | if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then | ||
423 | # The LINGUAS file contains the set of available languages. | ||
424 | if test -n "$ALL_LINGUAS"; then | ||
425 | test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" | ||
426 | fi | ||
427 | ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` | ||
428 | # Hide the ALL_LINGUAS assigment from automake. | ||
429 | eval 'ALL_LINGUAS''=$ALL_LINGUAS_' | ||
430 | fi | ||
431 | case "$ac_given_srcdir" in | ||
432 | .) srcdirpre= ;; | ||
433 | *) srcdirpre='$(srcdir)/' ;; | ||
434 | esac | ||
435 | POFILES= | ||
436 | GMOFILES= | ||
437 | UPDATEPOFILES= | ||
438 | DUMMYPOFILES= | ||
439 | for lang in $ALL_LINGUAS; do | ||
440 | POFILES="$POFILES $srcdirpre$lang.po" | ||
441 | GMOFILES="$GMOFILES $srcdirpre$lang.gmo" | ||
442 | UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" | ||
443 | DUMMYPOFILES="$DUMMYPOFILES $lang.nop" | ||
444 | done | ||
445 | # CATALOGS depends on both $ac_dir and the user's LINGUAS | ||
446 | # environment variable. | ||
447 | INST_LINGUAS= | ||
448 | if test -n "$ALL_LINGUAS"; then | ||
449 | for presentlang in $ALL_LINGUAS; do | ||
450 | useit=no | ||
451 | if test "%UNSET%" != "$LINGUAS"; then | ||
452 | desiredlanguages="$LINGUAS" | ||
453 | else | ||
454 | desiredlanguages="$ALL_LINGUAS" | ||
455 | fi | ||
456 | for desiredlang in $desiredlanguages; do | ||
457 | # Use the presentlang catalog if desiredlang is | ||
458 | # a. equal to presentlang, or | ||
459 | # b. a variant of presentlang (because in this case, | ||
460 | # presentlang can be used as a fallback for messages | ||
461 | # which are not translated in the desiredlang catalog). | ||
462 | case "$desiredlang" in | ||
463 | "$presentlang"*) useit=yes;; | ||
464 | esac | ||
465 | done | ||
466 | if test $useit = yes; then | ||
467 | INST_LINGUAS="$INST_LINGUAS $presentlang" | ||
468 | fi | ||
469 | done | ||
470 | fi | ||
471 | CATALOGS= | ||
472 | if test -n "$INST_LINGUAS"; then | ||
473 | for lang in $INST_LINGUAS; do | ||
474 | CATALOGS="$CATALOGS $lang.gmo" | ||
475 | done | ||
476 | fi | ||
477 | test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" | ||
478 | sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" | ||
479 | for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do | ||
480 | if test -f "$f"; then | ||
481 | case "$f" in | ||
482 | *.orig | *.bak | *~) ;; | ||
483 | *) cat "$f" >> "$ac_dir/Makefile" ;; | ||
484 | esac | ||
485 | fi | ||
486 | done | ||
487 | fi | ||
488 | ;; | ||
489 | esac | ||
490 | done], | ||
491 | [# Capture the value of obsolete ALL_LINGUAS because we need it to compute | ||
492 | # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it | ||
493 | # from automake. | ||
494 | eval 'ALL_LINGUAS''="$ALL_LINGUAS"' | ||
495 | # Capture the value of LINGUAS because we need it to compute CATALOGS. | ||
496 | LINGUAS="${LINGUAS-%UNSET%}" | ||
497 | ]) | ||
498 | ]) | ||
499 | |||
500 | |||
501 | dnl Checks for all prerequisites of the intl subdirectory, | ||
502 | dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, | ||
503 | dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. | ||
504 | AC_DEFUN([AM_INTL_SUBDIR], | ||
505 | [ | ||
506 | AC_REQUIRE([AC_PROG_INSTALL])dnl | ||
507 | AC_REQUIRE([AM_MKINSTALLDIRS])dnl | ||
508 | AC_REQUIRE([AC_PROG_CC])dnl | ||
509 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | ||
510 | AC_REQUIRE([AC_PROG_RANLIB])dnl | ||
511 | AC_REQUIRE([AC_ISC_POSIX])dnl | ||
512 | AC_REQUIRE([AC_HEADER_STDC])dnl | ||
513 | AC_REQUIRE([AC_C_CONST])dnl | ||
514 | AC_REQUIRE([AC_C_INLINE])dnl | ||
515 | AC_REQUIRE([AC_TYPE_OFF_T])dnl | ||
516 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl | ||
517 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl | ||
518 | AC_REQUIRE([AC_FUNC_MMAP])dnl | ||
519 | AC_REQUIRE([jm_GLIBC21])dnl | ||
520 | AC_REQUIRE([gt_INTDIV0])dnl | ||
521 | AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl | ||
522 | AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl | ||
523 | AC_REQUIRE([gt_INTTYPES_PRI])dnl | ||
524 | |||
525 | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ | ||
526 | stdlib.h string.h unistd.h sys/param.h]) | ||
527 | AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ | ||
528 | geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ | ||
529 | strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) | ||
530 | |||
531 | AM_ICONV | ||
532 | AM_LANGINFO_CODESET | ||
533 | if test $ac_cv_header_locale_h = yes; then | ||
534 | AM_LC_MESSAGES | ||
535 | fi | ||
536 | |||
537 | dnl intl/plural.c is generated from intl/plural.y. It requires bison, | ||
538 | dnl because plural.y uses bison specific features. It requires at least | ||
539 | dnl bison-1.26 because earlier versions generate a plural.c that doesn't | ||
540 | dnl compile. | ||
541 | dnl bison is only needed for the maintainer (who touches plural.y). But in | ||
542 | dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put | ||
543 | dnl the rule in general Makefile. Now, some people carelessly touch the | ||
544 | dnl files or have a broken "make" program, hence the plural.c rule will | ||
545 | dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not | ||
546 | dnl present or too old. | ||
547 | AC_CHECK_PROGS([INTLBISON], [bison]) | ||
548 | if test -z "$INTLBISON"; then | ||
549 | ac_verc_fail=yes | ||
550 | else | ||
551 | dnl Found it, now check the version. | ||
552 | AC_MSG_CHECKING([version of bison]) | ||
553 | changequote(<<,>>)dnl | ||
554 | ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` | ||
555 | case $ac_prog_version in | ||
556 | '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; | ||
557 | 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) | ||
558 | changequote([,])dnl | ||
559 | ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; | ||
560 | *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; | ||
561 | esac | ||
562 | AC_MSG_RESULT([$ac_prog_version]) | ||
563 | fi | ||
564 | if test $ac_verc_fail = yes; then | ||
565 | INTLBISON=: | ||
566 | fi | ||
567 | ]) | ||
568 | |||
569 | |||
570 | AC_DEFUN([AM_MKINSTALLDIRS], | ||
571 | [ | ||
572 | dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly | ||
573 | dnl find the mkinstalldirs script in another subdir but $(top_srcdir). | ||
574 | dnl Try to locate is. | ||
575 | MKINSTALLDIRS= | ||
576 | if test -n "$ac_aux_dir"; then | ||
577 | MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" | ||
578 | fi | ||
579 | if test -z "$MKINSTALLDIRS"; then | ||
580 | MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" | ||
581 | fi | ||
582 | AC_SUBST(MKINSTALLDIRS) | ||
583 | ]) | ||
584 | |||
585 | |||
586 | dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) | ||
587 | AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) | ||