~ubuntu-branches/ubuntu/gutsy/findutils/gutsy-proposed

« back to all changes in this revision

Viewing changes to gnulib/m4/gettext.m4

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Metzler
  • Date: 2005-07-04 11:37:37 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050704113737-ll89ui8be35r0pir
Tags: 4.2.22-2
* Remove locatedb on purge. (Closes: #315343)
* revert regex-syntax back to emacs-re. (Closes: #315136) Future versions
  will allow to select this by commandline parameter.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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.
 
1
# gettext.m4 serial 37 (gettext-0.14.4)
 
2
dnl Copyright (C) 1995-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.
8
6
dnl
9
7
dnl This file can can be used in projects which are not available under
10
8
dnl the GNU General Public License or the GNU Library General Public
17
15
 
18
16
dnl Authors:
19
17
dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
20
 
dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2002.
 
18
dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
21
19
 
22
20
dnl Macro to add for using GNU gettext.
23
21
 
65
63
  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
66
64
    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
67
65
])])])])
68
 
  define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
69
 
  define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
 
66
  define([gt_included_intl], ifelse([$1], [external], [no], [yes]))
 
67
  define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
70
68
 
71
69
  AC_REQUIRE([AM_PO_SUBDIRS])dnl
72
70
  ifelse(gt_included_intl, yes, [
92
90
    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
93
91
  ])
94
92
 
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)
 
93
  dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
 
94
  gt_INTL_MACOSX
 
95
 
 
96
  dnl Set USE_NLS.
 
97
  AM_NLS
102
98
 
103
99
  ifelse(gt_included_intl, yes, [
104
100
    BUILD_INCLUDED_LIBINTL=no
143
139
], [])[extern int _nl_msg_cat_cntr;
144
140
extern int *_nl_domain_bindings;],
145
141
            [bindtextdomain ("", "");
146
 
return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
 
142
return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
147
143
            gt_cv_func_gnugettext_libc=yes,
148
144
            gt_cv_func_gnugettext_libc=no)])
149
145
 
177
173
#ifdef __cplusplus
178
174
"C"
179
175
#endif
180
 
const char *_nl_expand_alias ();],
 
176
const char *_nl_expand_alias (const char *);],
181
177
              [bindtextdomain ("", "");
182
 
return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
 
178
return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
183
179
              gt_cv_func_gnugettext_libintl=yes,
184
180
              gt_cv_func_gnugettext_libintl=no)
185
181
            dnl Now see whether libintl exists and depends on libiconv.
198
194
#ifdef __cplusplus
199
195
"C"
200
196
#endif
201
 
const char *_nl_expand_alias ();],
 
197
const char *_nl_expand_alias (const char *);],
202
198
                [bindtextdomain ("", "");
203
 
return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
 
199
return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
204
200
               [LIBINTL="$LIBINTL $LIBICONV"
205
201
                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
206
202
                gt_cv_func_gnugettext_libintl=yes
216
212
        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
217
213
        if test "$gt_cv_func_gnugettext_libc" = "yes" \
218
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
217
          gt_use_preinstalled_gnugettext=yes
221
218
        else
222
219
          dnl Reset the values set by searching for libintl.
235
232
 
236
233
      if test "$nls_cv_use_gnu_gettext" = "yes"; then
237
234
        dnl Mark actions used to generate GNU NLS library.
238
 
        INTLOBJS="\$(GETTOBJS)"
239
235
        BUILD_INCLUDED_LIBINTL=yes
240
236
        USE_INCLUDED_LIBINTL=yes
241
237
        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
243
239
        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
244
240
      fi
245
241
 
 
242
      CATOBJEXT=
246
243
      if test "$gt_use_preinstalled_gnugettext" = "yes" \
247
244
         || test "$nls_cv_use_gnu_gettext" = "yes"; then
248
245
        dnl Mark actions to use GNU gettext tools.
250
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
259
    if test "$gt_use_preinstalled_gnugettext" = "yes" \
254
260
       || test "$nls_cv_use_gnu_gettext" = "yes"; then
255
261
      AC_DEFINE(ENABLE_NLS, 1,
260
266
    fi
261
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
285
  if test "$USE_NLS" = "yes"; then
264
286
 
265
287
    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
283
305
  ifelse(gt_included_intl, yes, [
284
306
    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
285
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
309
      BUILD_INCLUDED_LIBINTL=yes
288
310
    fi
289
311
 
291
313
    AC_SUBST(BUILD_INCLUDED_LIBINTL)
292
314
    AC_SUBST(USE_INCLUDED_LIBINTL)
293
315
    AC_SUBST(CATOBJEXT)
294
 
    AC_SUBST(INTLOBJS)
295
316
 
296
317
    dnl For backward compatibility. Some configure.ins may be using this.
297
318
    nls_cv_header_intl=
309
330
    GENCAT=gencat
310
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
340
    dnl Enable libtool support if the surrounding package wishes it.
313
341
    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
314
342
    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
325
353
])
326
354
 
327
355
 
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
356
dnl Checks for all prerequisites of the intl subdirectory,
502
357
dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
503
358
dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
507
362
  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
508
363
  AC_REQUIRE([AC_PROG_CC])dnl
509
364
  AC_REQUIRE([AC_CANONICAL_HOST])dnl
 
365
  AC_REQUIRE([gt_GLIBC2])dnl
510
366
  AC_REQUIRE([AC_PROG_RANLIB])dnl
511
367
  AC_REQUIRE([AC_ISC_POSIX])dnl
512
368
  AC_REQUIRE([AC_HEADER_STDC])dnl
513
369
  AC_REQUIRE([AC_C_CONST])dnl
 
370
  AC_REQUIRE([bh_C_SIGNED])dnl
514
371
  AC_REQUIRE([AC_C_INLINE])dnl
515
372
  AC_REQUIRE([AC_TYPE_OFF_T])dnl
516
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
382
  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
518
383
  AC_REQUIRE([AC_FUNC_MMAP])dnl
519
 
  AC_REQUIRE([jm_GLIBC21])dnl
 
384
  AC_REQUIRE([gl_GLIBC21])dnl
520
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
387
  AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
523
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
396
  AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
526
397
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])
 
398
  AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \
 
399
mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \
 
400
strtoul 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
441
  AM_ICONV
532
442
  AM_LANGINFO_CODESET
533
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
449
  fi
536
450
 
537
451
  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
567
481
])
568
482
 
569
483
 
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)
 
484
dnl Checks for special options needed on MacOS X.
 
485
dnl Defines INTL_MACOSX_LIBS.
 
486
AC_DEFUN([gt_INTL_MACOSX],
 
487
[
 
488
  dnl Check for API introduced in MacOS X 10.2.
 
489
  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
 
490
    gt_cv_func_CFPreferencesCopyAppValue,
 
491
    [gt_save_CPPFLAGS="$CPPFLAGS"
 
492
     CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
 
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"
 
523
  fi
 
524
  AC_SUBST([INTL_MACOSX_LIBS])
 
525
])
 
526
 
 
527
 
 
528
dnl gt_CHECK_DECL(FUNC, INCLUDES)
 
529
dnl Check whether a function is declared.
 
530
AC_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
 
542
  fi
 
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