summaryrefslogtreecommitdiffstats
path: root/m4/gettext.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/gettext.m4')
-rw-r--r--m4/gettext.m4392
1 files changed, 177 insertions, 215 deletions
diff --git a/m4/gettext.m4 b/m4/gettext.m4
index 45cad85..624a807 100644
--- a/m4/gettext.m4
+++ b/m4/gettext.m4
@@ -1,10 +1,8 @@
1# gettext.m4 serial 17 (gettext-0.11.5) 1# gettext.m4 serial 37 (gettext-0.14.4)
2dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2005 Free Software Foundation, Inc.
3dnl This file is free software, distributed under the terms of the GNU 3dnl This file is free software; the Free Software Foundation
4dnl General Public License. As a special exception to the GNU General 4dnl gives unlimited permission to copy and/or distribute it,
5dnl Public License, this file may be distributed as part of a program 5dnl with or without modifications, as long as this notice is preserved.
6dnl that contains a configuration script generated by Autoconf, under
7dnl the same distribution terms as the rest of that program.
8dnl 6dnl
9dnl This file can can be used in projects which are not available under 7dnl This file can can be used in projects which are not available under
10dnl the GNU General Public License or the GNU Library General Public 8dnl the GNU General Public License or the GNU Library General Public
@@ -17,7 +15,7 @@ dnl They are *not* in the public domain.
17 15
18dnl Authors: 16dnl Authors:
19dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. 17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
20dnl Bruno Haible <haible@clisp.cons.org>, 2000-2002. 18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
21 19
22dnl Macro to add for using GNU gettext. 20dnl Macro to add for using GNU gettext.
23 21
@@ -65,8 +63,8 @@ AC_DEFUN([AM_GNU_GETTEXT],
65 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , 63 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
66 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT 64 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
67])])])]) 65])])])])
68 define(gt_included_intl, ifelse([$1], [external], [no], [yes])) 66 define([gt_included_intl], ifelse([$1], [external], [no], [yes]))
69 define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) 67 define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
70 68
71 AC_REQUIRE([AM_PO_SUBDIRS])dnl 69 AC_REQUIRE([AM_PO_SUBDIRS])dnl
72 ifelse(gt_included_intl, yes, [ 70 ifelse(gt_included_intl, yes, [
@@ -92,13 +90,11 @@ AC_DEFUN([AM_GNU_GETTEXT],
92 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) 90 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
93 ]) 91 ])
94 92
95 AC_MSG_CHECKING([whether NLS is requested]) 93 dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
96 dnl Default is enabled NLS 94 gt_INTL_MACOSX
97 AC_ARG_ENABLE(nls, 95
98 [ --disable-nls do not use Native Language Support], 96 dnl Set USE_NLS.
99 USE_NLS=$enableval, USE_NLS=yes) 97 AM_NLS
100 AC_MSG_RESULT($USE_NLS)
101 AC_SUBST(USE_NLS)
102 98
103 ifelse(gt_included_intl, yes, [ 99 ifelse(gt_included_intl, yes, [
104 BUILD_INCLUDED_LIBINTL=no 100 BUILD_INCLUDED_LIBINTL=no
@@ -143,7 +139,7 @@ changequote([,])dnl
143], [])[extern int _nl_msg_cat_cntr; 139], [])[extern int _nl_msg_cat_cntr;
144extern int *_nl_domain_bindings;], 140extern int *_nl_domain_bindings;],
145 [bindtextdomain ("", ""); 141 [bindtextdomain ("", "");
146return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], 142return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
147 gt_cv_func_gnugettext_libc=yes, 143 gt_cv_func_gnugettext_libc=yes,
148 gt_cv_func_gnugettext_libc=no)]) 144 gt_cv_func_gnugettext_libc=no)])
149 145
@@ -177,9 +173,9 @@ extern
177#ifdef __cplusplus 173#ifdef __cplusplus
178"C" 174"C"
179#endif 175#endif
180const char *_nl_expand_alias ();], 176const char *_nl_expand_alias (const char *);],
181 [bindtextdomain ("", ""); 177 [bindtextdomain ("", "");
182return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], 178return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
183 gt_cv_func_gnugettext_libintl=yes, 179 gt_cv_func_gnugettext_libintl=yes,
184 gt_cv_func_gnugettext_libintl=no) 180 gt_cv_func_gnugettext_libintl=no)
185 dnl Now see whether libintl exists and depends on libiconv. 181 dnl Now see whether libintl exists and depends on libiconv.
@@ -198,9 +194,9 @@ extern
198#ifdef __cplusplus 194#ifdef __cplusplus
199"C" 195"C"
200#endif 196#endif
201const char *_nl_expand_alias ();], 197const char *_nl_expand_alias (const char *);],
202 [bindtextdomain ("", ""); 198 [bindtextdomain ("", "");
203return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], 199return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
204 [LIBINTL="$LIBINTL $LIBICONV" 200 [LIBINTL="$LIBINTL $LIBICONV"
205 LTLIBINTL="$LTLIBINTL $LTLIBICONV" 201 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
206 gt_cv_func_gnugettext_libintl=yes 202 gt_cv_func_gnugettext_libintl=yes
@@ -216,7 +212,8 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
216 dnl libintl. (Cf. the install rule in intl/Makefile.in.) 212 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
217 if test "$gt_cv_func_gnugettext_libc" = "yes" \ 213 if test "$gt_cv_func_gnugettext_libc" = "yes" \
218 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ 214 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
219 && test "$PACKAGE" != gettext; }; then 215 && test "$PACKAGE" != gettext-runtime \
216 && test "$PACKAGE" != gettext-tools; }; then
220 gt_use_preinstalled_gnugettext=yes 217 gt_use_preinstalled_gnugettext=yes
221 else 218 else
222 dnl Reset the values set by searching for libintl. 219 dnl Reset the values set by searching for libintl.
@@ -235,7 +232,6 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
235 232
236 if test "$nls_cv_use_gnu_gettext" = "yes"; then 233 if test "$nls_cv_use_gnu_gettext" = "yes"; then
237 dnl Mark actions used to generate GNU NLS library. 234 dnl Mark actions used to generate GNU NLS library.
238 INTLOBJS="\$(GETTOBJS)"
239 BUILD_INCLUDED_LIBINTL=yes 235 BUILD_INCLUDED_LIBINTL=yes
240 USE_INCLUDED_LIBINTL=yes 236 USE_INCLUDED_LIBINTL=yes
241 LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" 237 LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
@@ -243,6 +239,7 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
243 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` 239 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
244 fi 240 fi
245 241
242 CATOBJEXT=
246 if test "$gt_use_preinstalled_gnugettext" = "yes" \ 243 if test "$gt_use_preinstalled_gnugettext" = "yes" \
247 || test "$nls_cv_use_gnu_gettext" = "yes"; then 244 || test "$nls_cv_use_gnu_gettext" = "yes"; then
248 dnl Mark actions to use GNU gettext tools. 245 dnl Mark actions to use GNU gettext tools.
@@ -250,6 +247,15 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
250 fi 247 fi
251 ]) 248 ])
252 249
250 if test -n "$INTL_MACOSX_LIBS"; then
251 if test "$gt_use_preinstalled_gnugettext" = "yes" \
252 || test "$nls_cv_use_gnu_gettext" = "yes"; then
253 dnl Some extra flags are needed during linking.
254 LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
255 LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
256 fi
257 fi
258
253 if test "$gt_use_preinstalled_gnugettext" = "yes" \ 259 if test "$gt_use_preinstalled_gnugettext" = "yes" \
254 || test "$nls_cv_use_gnu_gettext" = "yes"; then 260 || test "$nls_cv_use_gnu_gettext" = "yes"; then
255 AC_DEFINE(ENABLE_NLS, 1, 261 AC_DEFINE(ENABLE_NLS, 1,
@@ -260,6 +266,22 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
260 fi 266 fi
261 fi 267 fi
262 268
269 AC_MSG_CHECKING([whether to use NLS])
270 AC_MSG_RESULT([$USE_NLS])
271 if test "$USE_NLS" = "yes"; then
272 AC_MSG_CHECKING([where the gettext function comes from])
273 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
274 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
275 gt_source="external libintl"
276 else
277 gt_source="libc"
278 fi
279 else
280 gt_source="included intl directory"
281 fi
282 AC_MSG_RESULT([$gt_source])
283 fi
284
263 if test "$USE_NLS" = "yes"; then 285 if test "$USE_NLS" = "yes"; then
264 286
265 if test "$gt_use_preinstalled_gnugettext" = "yes"; then 287 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
@@ -283,7 +305,7 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
283 ifelse(gt_included_intl, yes, [ 305 ifelse(gt_included_intl, yes, [
284 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL 306 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. 307 dnl to 'yes' because some of the testsuite requires it.
286 if test "$PACKAGE" = gettext; then 308 if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
287 BUILD_INCLUDED_LIBINTL=yes 309 BUILD_INCLUDED_LIBINTL=yes
288 fi 310 fi
289 311
@@ -291,7 +313,6 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
291 AC_SUBST(BUILD_INCLUDED_LIBINTL) 313 AC_SUBST(BUILD_INCLUDED_LIBINTL)
292 AC_SUBST(USE_INCLUDED_LIBINTL) 314 AC_SUBST(USE_INCLUDED_LIBINTL)
293 AC_SUBST(CATOBJEXT) 315 AC_SUBST(CATOBJEXT)
294 AC_SUBST(INTLOBJS)
295 316
296 dnl For backward compatibility. Some configure.ins may be using this. 317 dnl For backward compatibility. Some configure.ins may be using this.
297 nls_cv_header_intl= 318 nls_cv_header_intl=
@@ -309,6 +330,13 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
309 GENCAT=gencat 330 GENCAT=gencat
310 AC_SUBST(GENCAT) 331 AC_SUBST(GENCAT)
311 332
333 dnl For backward compatibility. Some Makefiles may be using this.
334 INTLOBJS=
335 if test "$USE_INCLUDED_LIBINTL" = yes; then
336 INTLOBJS="\$(GETTOBJS)"
337 fi
338 AC_SUBST(INTLOBJS)
339
312 dnl Enable libtool support if the surrounding package wishes it. 340 dnl Enable libtool support if the surrounding package wishes it.
313 INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix 341 INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
314 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) 342 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
@@ -325,179 +353,6 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
325]) 353])
326 354
327 355
328dnl Checks for all prerequisites of the po subdirectory,
329dnl except for USE_NLS.
330AC_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
501dnl Checks for all prerequisites of the intl subdirectory, 356dnl Checks for all prerequisites of the intl subdirectory,
502dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, 357dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
503dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. 358dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
@@ -507,31 +362,90 @@ AC_DEFUN([AM_INTL_SUBDIR],
507 AC_REQUIRE([AM_MKINSTALLDIRS])dnl 362 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
508 AC_REQUIRE([AC_PROG_CC])dnl 363 AC_REQUIRE([AC_PROG_CC])dnl
509 AC_REQUIRE([AC_CANONICAL_HOST])dnl 364 AC_REQUIRE([AC_CANONICAL_HOST])dnl
365 AC_REQUIRE([gt_GLIBC2])dnl
510 AC_REQUIRE([AC_PROG_RANLIB])dnl 366 AC_REQUIRE([AC_PROG_RANLIB])dnl
511 AC_REQUIRE([AC_ISC_POSIX])dnl 367 AC_REQUIRE([AC_ISC_POSIX])dnl
512 AC_REQUIRE([AC_HEADER_STDC])dnl 368 AC_REQUIRE([AC_HEADER_STDC])dnl
513 AC_REQUIRE([AC_C_CONST])dnl 369 AC_REQUIRE([AC_C_CONST])dnl
370 AC_REQUIRE([bh_C_SIGNED])dnl
514 AC_REQUIRE([AC_C_INLINE])dnl 371 AC_REQUIRE([AC_C_INLINE])dnl
515 AC_REQUIRE([AC_TYPE_OFF_T])dnl 372 AC_REQUIRE([AC_TYPE_OFF_T])dnl
516 AC_REQUIRE([AC_TYPE_SIZE_T])dnl 373 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
374 AC_REQUIRE([gl_AC_TYPE_LONG_LONG])dnl
375 AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
376 AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
377 AC_REQUIRE([gt_TYPE_WINT_T])dnl
378 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
379 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
380 AC_REQUIRE([gt_TYPE_INTMAX_T])
381 AC_REQUIRE([gt_PRINTF_POSIX])
517 AC_REQUIRE([AC_FUNC_ALLOCA])dnl 382 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
518 AC_REQUIRE([AC_FUNC_MMAP])dnl 383 AC_REQUIRE([AC_FUNC_MMAP])dnl
519 AC_REQUIRE([jm_GLIBC21])dnl 384 AC_REQUIRE([gl_GLIBC21])dnl
520 AC_REQUIRE([gt_INTDIV0])dnl 385 AC_REQUIRE([gt_INTDIV0])dnl
521 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl 386 AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
522 AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl 387 AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
523 AC_REQUIRE([gt_INTTYPES_PRI])dnl 388 AC_REQUIRE([gt_INTTYPES_PRI])dnl
389 AC_REQUIRE([gl_XSIZE])dnl
390 AC_REQUIRE([gt_INTL_MACOSX])dnl
524 391
392 AC_CHECK_TYPE([ptrdiff_t], ,
393 [AC_DEFINE([ptrdiff_t], [long],
394 [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
395 ])
525 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ 396 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
526stdlib.h string.h unistd.h sys/param.h]) 397stdlib.h string.h unistd.h sys/param.h])
527 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ 398 AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \
528geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ 399mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \
529strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) 400strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \
401__fsetlocking])
402
403 dnl Use the _snprintf function only if it is declared (because on NetBSD it
404 dnl is defined as a weak alias of snprintf; we prefer to use the latter).
405 gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
406 gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
407
408 dnl Use the *_unlocked functions only if they are declared.
409 dnl (because some of them were defined without being declared in Solaris
410 dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
411 dnl on Solaris 2.5.1 to run on Solaris 2.6).
412 dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
413 gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
414 gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
415 gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
416
417 case $gt_cv_func_printf_posix in
418 *yes) HAVE_POSIX_PRINTF=1 ;;
419 *) HAVE_POSIX_PRINTF=0 ;;
420 esac
421 AC_SUBST([HAVE_POSIX_PRINTF])
422 if test "$ac_cv_func_asprintf" = yes; then
423 HAVE_ASPRINTF=1
424 else
425 HAVE_ASPRINTF=0
426 fi
427 AC_SUBST([HAVE_ASPRINTF])
428 if test "$ac_cv_func_snprintf" = yes; then
429 HAVE_SNPRINTF=1
430 else
431 HAVE_SNPRINTF=0
432 fi
433 AC_SUBST([HAVE_SNPRINTF])
434 if test "$ac_cv_func_wprintf" = yes; then
435 HAVE_WPRINTF=1
436 else
437 HAVE_WPRINTF=0
438 fi
439 AC_SUBST([HAVE_WPRINTF])
530 440
531 AM_ICONV 441 AM_ICONV
532 AM_LANGINFO_CODESET 442 AM_LANGINFO_CODESET
533 if test $ac_cv_header_locale_h = yes; then 443 if test $ac_cv_header_locale_h = yes; then
534 AM_LC_MESSAGES 444 gt_LC_MESSAGES
445 fi
446
447 if test -n "$INTL_MACOSX_LIBS"; then
448 CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
535 fi 449 fi
536 450
537 dnl intl/plural.c is generated from intl/plural.y. It requires bison, 451 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
@@ -567,19 +481,67 @@ changequote([,])dnl
567]) 481])
568 482
569 483
570AC_DEFUN([AM_MKINSTALLDIRS], 484dnl Checks for special options needed on MacOS X.
485dnl Defines INTL_MACOSX_LIBS.
486AC_DEFUN([gt_INTL_MACOSX],
571[ 487[
572 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly 488 dnl Check for API introduced in MacOS X 10.2.
573 dnl find the mkinstalldirs script in another subdir but $(top_srcdir). 489 AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
574 dnl Try to locate is. 490 gt_cv_func_CFPreferencesCopyAppValue,
575 MKINSTALLDIRS= 491 [gt_save_CPPFLAGS="$CPPFLAGS"
576 if test -n "$ac_aux_dir"; then 492 CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
577 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" 493 gt_save_LIBS="$LIBS"
494 LIBS="$LIBS -framework CoreFoundation"
495 AC_TRY_LINK([#include <CFPreferences.h>],
496 [CFPreferencesCopyAppValue(NULL, NULL)],
497 [gt_cv_func_CFPreferencesCopyAppValue=yes],
498 [gt_cv_func_CFPreferencesCopyAppValue=no])
499 CPPFLAGS="$gt_save_CPPFLAGS"
500 LIBS="$gt_save_LIBS"])
501 if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
502 AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1,
503 [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
504 fi
505 dnl Check for API introduced in MacOS X 10.3.
506 AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent,
507 [gt_save_CPPFLAGS="$CPPFLAGS"
508 CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
509 gt_save_LIBS="$LIBS"
510 LIBS="$LIBS -framework CoreFoundation"
511 AC_TRY_LINK([#include <CFLocale.h>], [CFLocaleCopyCurrent();],
512 [gt_cv_func_CFLocaleCopyCurrent=yes],
513 [gt_cv_func_CFLocaleCopyCurrent=no])
514 CPPFLAGS="$gt_save_CPPFLAGS"
515 LIBS="$gt_save_LIBS"])
516 if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
517 AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1,
518 [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
519 fi
520 INTL_MACOSX_LIBS=
521 if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
522 INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
578 fi 523 fi
579 if test -z "$MKINSTALLDIRS"; then 524 AC_SUBST([INTL_MACOSX_LIBS])
580 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" 525])
526
527
528dnl gt_CHECK_DECL(FUNC, INCLUDES)
529dnl Check whether a function is declared.
530AC_DEFUN([gt_CHECK_DECL],
531[
532 AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
533 [AC_TRY_COMPILE([$2], [
534#ifndef $1
535 char *p = (char *) $1;
536#endif
537], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
538 if test $ac_cv_have_decl_$1 = yes; then
539 gt_value=1
540 else
541 gt_value=0
581 fi 542 fi
582 AC_SUBST(MKINSTALLDIRS) 543 AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
544 [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
583]) 545])
584 546
585 547