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