~ubuntu-branches/ubuntu/saucy/libgphoto2/saucy-proposed

« back to all changes in this revision

Viewing changes to auto-m4/gettext.m4

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-07-31 07:00:09 UTC
  • mfrom: (1.4.4)
  • Revision ID: package-import@ubuntu.com-20130731070009-enrbvg3hry64cxl1
Tags: 2.5.2-0ubuntu1
* New upstream release.
* Drop 01-increase_max_entries.patch, 02-libusbx_no_debug.patch,
  03-libusbx-fixes.patch: fixed upstream.
* Add libxml2-dev build dependency for new optional features.
* ABI changes: libgphoto2-2 → libgphoto2-6,
  libgphoto2-port0 → libgphoto2-port10
* debian/libgphoto2-dev-doc.install: Adjust to changed HTML API doc folder
  name.
* debian/libgphoto2-port10.install: Adjust for changed libgphoto-port ABI.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# gettext.m4 serial 63 (gettext-0.18)
2
 
dnl Copyright (C) 1995-2010 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.
 
1
# gettext.m4 serial 28 (gettext-0.13)
 
2
dnl Copyright (C) 1995-2003 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.
6
8
dnl
7
9
dnl This file can can be used in projects which are not available under
8
10
dnl the GNU General Public License or the GNU Library General Public
15
17
 
16
18
dnl Authors:
17
19
dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18
 
dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
 
20
dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
19
21
 
20
22
dnl Macro to add for using GNU gettext.
21
23
 
60
62
  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
61
63
    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
62
64
])])])])])
63
 
  ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
64
 
    [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])])
65
65
  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
66
66
    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
67
67
])])])])
68
 
  define([gt_included_intl],
69
 
    ifelse([$1], [external],
70
 
      ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]),
71
 
      [yes]))
72
 
  define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
73
 
  gt_NEEDS_INIT
74
 
  AM_GNU_GETTEXT_NEED([$2])
 
68
  define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
 
69
  define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
75
70
 
76
71
  AC_REQUIRE([AM_PO_SUBDIRS])dnl
77
72
  ifelse(gt_included_intl, yes, [
85
80
  dnl Sometimes libintl requires libiconv, so first search for libiconv.
86
81
  dnl Ideally we would do this search only after the
87
82
  dnl      if test "$USE_NLS" = "yes"; then
88
 
  dnl        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
 
83
  dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
89
84
  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
90
85
  dnl the configure script would need to contain the same shell code
91
86
  dnl again, outside any 'if'. There are two solutions:
97
92
    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
98
93
  ])
99
94
 
100
 
  dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
101
 
  gt_INTL_MACOSX
102
 
 
103
95
  dnl Set USE_NLS.
104
 
  AC_REQUIRE([AM_NLS])
 
96
  AM_NLS
105
97
 
106
98
  ifelse(gt_included_intl, yes, [
107
99
    BUILD_INCLUDED_LIBINTL=no
111
103
  LTLIBINTL=
112
104
  POSUB=
113
105
 
114
 
  dnl Add a version number to the cache macros.
115
 
  case " $gt_needs " in
116
 
    *" need-formatstring-macros "*) gt_api_version=3 ;;
117
 
    *" need-ngettext "*) gt_api_version=2 ;;
118
 
    *) gt_api_version=1 ;;
119
 
  esac
120
 
  gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
121
 
  gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
122
 
 
123
106
  dnl If we use NLS figure out what method
124
107
  if test "$USE_NLS" = "yes"; then
125
108
    gt_use_preinstalled_gnugettext=no
126
109
    ifelse(gt_included_intl, yes, [
127
110
      AC_MSG_CHECKING([whether included gettext is requested])
128
 
      AC_ARG_WITH([included-gettext],
 
111
      AC_ARG_WITH(included-gettext,
129
112
        [  --with-included-gettext use the GNU gettext library included here],
130
113
        nls_cv_force_use_gnu_gettext=$withval,
131
114
        nls_cv_force_use_gnu_gettext=no)
132
 
      AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext])
 
115
      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
133
116
 
134
117
      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
135
118
      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
138
121
        dnl to use.  If GNU gettext is available we use this.  Else we have
139
122
        dnl to fall back to GNU NLS library.
140
123
 
141
 
        if test $gt_api_version -ge 3; then
142
 
          gt_revision_test_code='
143
 
#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
144
 
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
145
 
#endif
146
 
changequote(,)dnl
147
 
typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
148
 
changequote([,])dnl
149
 
'
150
 
        else
151
 
          gt_revision_test_code=
152
 
        fi
153
 
        if test $gt_api_version -ge 2; then
154
 
          gt_expression_test_code=' + * ngettext ("", "", 0)'
155
 
        else
156
 
          gt_expression_test_code=
157
 
        fi
 
124
        dnl Add a version number to the cache macros.
 
125
        define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
 
126
        define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
 
127
        define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
158
128
 
159
 
        AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
 
129
        AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
160
130
         [AC_TRY_LINK([#include <libintl.h>
161
 
$gt_revision_test_code
162
 
extern int _nl_msg_cat_cntr;
 
131
]ifelse([$2], [need-formatstring-macros],
 
132
[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
 
133
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
 
134
#endif
 
135
changequote(,)dnl
 
136
typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
 
137
changequote([,])dnl
 
138
], [])[extern int _nl_msg_cat_cntr;
163
139
extern int *_nl_domain_bindings;],
164
140
            [bindtextdomain ("", "");
165
 
return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings],
166
 
            [eval "$gt_func_gnugettext_libc=yes"],
167
 
            [eval "$gt_func_gnugettext_libc=no"])])
 
141
return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
 
142
            gt_cv_func_gnugettext_libc=yes,
 
143
            gt_cv_func_gnugettext_libc=no)])
168
144
 
169
 
        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
 
145
        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
170
146
          dnl Sometimes libintl requires libiconv, so first search for libiconv.
171
147
          ifelse(gt_included_intl, yes, , [
172
148
            AM_ICONV_LINK
177
153
          dnl even if libiconv doesn't exist.
178
154
          AC_LIB_LINKFLAGS_BODY([intl])
179
155
          AC_CACHE_CHECK([for GNU gettext in libintl],
180
 
            [$gt_func_gnugettext_libintl],
 
156
            gt_cv_func_gnugettext_libintl,
181
157
           [gt_save_CPPFLAGS="$CPPFLAGS"
182
158
            CPPFLAGS="$CPPFLAGS $INCINTL"
183
159
            gt_save_LIBS="$LIBS"
184
160
            LIBS="$LIBS $LIBINTL"
185
161
            dnl Now see whether libintl exists and does not depend on libiconv.
186
162
            AC_TRY_LINK([#include <libintl.h>
187
 
$gt_revision_test_code
188
 
extern int _nl_msg_cat_cntr;
 
163
]ifelse([$2], [need-formatstring-macros],
 
164
[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
 
165
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
 
166
#endif
 
167
changequote(,)dnl
 
168
typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
 
169
changequote([,])dnl
 
170
], [])[extern int _nl_msg_cat_cntr;
189
171
extern
190
172
#ifdef __cplusplus
191
173
"C"
192
174
#endif
193
 
const char *_nl_expand_alias (const char *);],
 
175
const char *_nl_expand_alias ();],
194
176
              [bindtextdomain ("", "");
195
 
return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
196
 
              [eval "$gt_func_gnugettext_libintl=yes"],
197
 
              [eval "$gt_func_gnugettext_libintl=no"])
 
177
return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
 
178
              gt_cv_func_gnugettext_libintl=yes,
 
179
              gt_cv_func_gnugettext_libintl=no)
198
180
            dnl Now see whether libintl exists and depends on libiconv.
199
 
            if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
 
181
            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
200
182
              LIBS="$LIBS $LIBICONV"
201
183
              AC_TRY_LINK([#include <libintl.h>
202
 
$gt_revision_test_code
203
 
extern int _nl_msg_cat_cntr;
 
184
]ifelse([$2], [need-formatstring-macros],
 
185
[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
 
186
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
 
187
#endif
 
188
changequote(,)dnl
 
189
typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
 
190
changequote([,])dnl
 
191
], [])[extern int _nl_msg_cat_cntr;
204
192
extern
205
193
#ifdef __cplusplus
206
194
"C"
207
195
#endif
208
 
const char *_nl_expand_alias (const char *);],
 
196
const char *_nl_expand_alias ();],
209
197
                [bindtextdomain ("", "");
210
 
return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
 
198
return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
211
199
               [LIBINTL="$LIBINTL $LIBICONV"
212
200
                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
213
 
                eval "$gt_func_gnugettext_libintl=yes"
 
201
                gt_cv_func_gnugettext_libintl=yes
214
202
               ])
215
203
            fi
216
204
            CPPFLAGS="$gt_save_CPPFLAGS"
221
209
        dnl use it.  But if this macro is used in GNU gettext, and GNU
222
210
        dnl gettext is already preinstalled in libintl, we update this
223
211
        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
224
 
        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
225
 
           || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
 
212
        if test "$gt_cv_func_gnugettext_libc" = "yes" \
 
213
           || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
226
214
                && test "$PACKAGE" != gettext-runtime \
227
215
                && test "$PACKAGE" != gettext-tools; }; then
228
216
          gt_use_preinstalled_gnugettext=yes
245
233
        dnl Mark actions used to generate GNU NLS library.
246
234
        BUILD_INCLUDED_LIBINTL=yes
247
235
        USE_INCLUDED_LIBINTL=yes
248
 
        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD"
249
 
        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD"
 
236
        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
 
237
        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
250
238
        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
251
239
      fi
252
240
 
253
 
      CATOBJEXT=
254
241
      if test "$gt_use_preinstalled_gnugettext" = "yes" \
255
242
         || test "$nls_cv_use_gnu_gettext" = "yes"; then
256
243
        dnl Mark actions to use GNU gettext tools.
258
245
      fi
259
246
    ])
260
247
 
261
 
    if test -n "$INTL_MACOSX_LIBS"; then
262
 
      if test "$gt_use_preinstalled_gnugettext" = "yes" \
263
 
         || test "$nls_cv_use_gnu_gettext" = "yes"; then
264
 
        dnl Some extra flags are needed during linking.
265
 
        LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
266
 
        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
267
 
      fi
268
 
    fi
269
 
 
270
248
    if test "$gt_use_preinstalled_gnugettext" = "yes" \
271
249
       || test "$nls_cv_use_gnu_gettext" = "yes"; then
272
 
      AC_DEFINE([ENABLE_NLS], [1],
 
250
      AC_DEFINE(ENABLE_NLS, 1,
273
251
        [Define to 1 if translation of program messages to the user's native language
274
252
   is requested.])
275
253
    else
282
260
  if test "$USE_NLS" = "yes"; then
283
261
    AC_MSG_CHECKING([where the gettext function comes from])
284
262
    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
285
 
      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
 
263
      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
286
264
        gt_source="external libintl"
287
265
      else
288
266
        gt_source="libc"
296
274
  if test "$USE_NLS" = "yes"; then
297
275
 
298
276
    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
299
 
      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
 
277
      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
300
278
        AC_MSG_CHECKING([how to link with libintl])
301
279
        AC_MSG_RESULT([$LIBINTL])
302
280
        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
303
281
      fi
304
282
 
305
283
      dnl For backward compatibility. Some packages may be using this.
306
 
      AC_DEFINE([HAVE_GETTEXT], [1],
 
284
      AC_DEFINE(HAVE_GETTEXT, 1,
307
285
       [Define if the GNU gettext() function is already present or preinstalled.])
308
 
      AC_DEFINE([HAVE_DCGETTEXT], [1],
 
286
      AC_DEFINE(HAVE_DCGETTEXT, 1,
309
287
       [Define if the GNU dcgettext() function is already present or preinstalled.])
310
288
    fi
311
289
 
321
299
    fi
322
300
 
323
301
    dnl Make all variables we use known to autoconf.
324
 
    AC_SUBST([BUILD_INCLUDED_LIBINTL])
325
 
    AC_SUBST([USE_INCLUDED_LIBINTL])
326
 
    AC_SUBST([CATOBJEXT])
 
302
    AC_SUBST(BUILD_INCLUDED_LIBINTL)
 
303
    AC_SUBST(USE_INCLUDED_LIBINTL)
 
304
    AC_SUBST(CATOBJEXT)
327
305
 
328
306
    dnl For backward compatibility. Some configure.ins may be using this.
329
307
    nls_cv_header_intl=
331
309
 
332
310
    dnl For backward compatibility. Some Makefiles may be using this.
333
311
    DATADIRNAME=share
334
 
    AC_SUBST([DATADIRNAME])
 
312
    AC_SUBST(DATADIRNAME)
335
313
 
336
314
    dnl For backward compatibility. Some Makefiles may be using this.
337
315
    INSTOBJEXT=.mo
338
 
    AC_SUBST([INSTOBJEXT])
 
316
    AC_SUBST(INSTOBJEXT)
339
317
 
340
318
    dnl For backward compatibility. Some Makefiles may be using this.
341
319
    GENCAT=gencat
342
 
    AC_SUBST([GENCAT])
 
320
    AC_SUBST(GENCAT)
343
321
 
344
322
    dnl For backward compatibility. Some Makefiles may be using this.
345
 
    INTLOBJS=
346
323
    if test "$USE_INCLUDED_LIBINTL" = yes; then
347
324
      INTLOBJS="\$(GETTOBJS)"
348
325
    fi
349
 
    AC_SUBST([INTLOBJS])
 
326
    AC_SUBST(INTLOBJS)
350
327
 
351
328
    dnl Enable libtool support if the surrounding package wishes it.
352
329
    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
353
 
    AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX])
 
330
    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
354
331
  ])
355
332
 
356
333
  dnl For backward compatibility. Some Makefiles may be using this.
357
334
  INTLLIBS="$LIBINTL"
358
 
  AC_SUBST([INTLLIBS])
 
335
  AC_SUBST(INTLLIBS)
359
336
 
360
337
  dnl Make all documented variables known to autoconf.
361
 
  AC_SUBST([LIBINTL])
362
 
  AC_SUBST([LTLIBINTL])
363
 
  AC_SUBST([POSUB])
364
 
])
365
 
 
366
 
 
367
 
dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
368
 
m4_define([gt_NEEDS_INIT],
369
 
[
370
 
  m4_divert_text([DEFAULTS], [gt_needs=])
371
 
  m4_define([gt_NEEDS_INIT], [])
372
 
])
373
 
 
374
 
 
375
 
dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
376
 
AC_DEFUN([AM_GNU_GETTEXT_NEED],
377
 
[
378
 
  m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
 
338
  AC_SUBST(LIBINTL)
 
339
  AC_SUBST(LTLIBINTL)
 
340
  AC_SUBST(POSUB)
 
341
])
 
342
 
 
343
 
 
344
dnl Checks for all prerequisites of the intl subdirectory,
 
345
dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
 
346
dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
 
347
AC_DEFUN([AM_INTL_SUBDIR],
 
348
[
 
349
  AC_REQUIRE([AC_PROG_INSTALL])dnl
 
350
  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
 
351
  AC_REQUIRE([AC_PROG_CC])dnl
 
352
  AC_REQUIRE([AC_CANONICAL_HOST])dnl
 
353
  AC_REQUIRE([AC_PROG_RANLIB])dnl
 
354
  AC_REQUIRE([AC_ISC_POSIX])dnl
 
355
  AC_REQUIRE([AC_HEADER_STDC])dnl
 
356
  AC_REQUIRE([AC_C_CONST])dnl
 
357
  AC_REQUIRE([bh_C_SIGNED])dnl
 
358
  AC_REQUIRE([AC_C_INLINE])dnl
 
359
  AC_REQUIRE([AC_TYPE_OFF_T])dnl
 
360
  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
 
361
  AC_REQUIRE([jm_AC_TYPE_LONG_LONG])dnl
 
362
  AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
 
363
  AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
 
364
  AC_REQUIRE([gt_TYPE_WINT_T])dnl
 
365
  AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
 
366
  AC_REQUIRE([jm_AC_HEADER_STDINT_H])
 
367
  AC_REQUIRE([gt_TYPE_INTMAX_T])
 
368
  AC_REQUIRE([gt_PRINTF_POSIX])
 
369
  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
 
370
  AC_REQUIRE([AC_FUNC_MMAP])dnl
 
371
  AC_REQUIRE([jm_GLIBC21])dnl
 
372
  AC_REQUIRE([gt_INTDIV0])dnl
 
373
  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
 
374
  AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
 
375
  AC_REQUIRE([gt_INTTYPES_PRI])dnl
 
376
  AC_REQUIRE([gl_XSIZE])dnl
 
377
 
 
378
  AC_CHECK_TYPE([ptrdiff_t], ,
 
379
    [AC_DEFINE([ptrdiff_t], [long],
 
380
       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
 
381
    ])
 
382
  AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
 
383
stdlib.h string.h unistd.h sys/param.h])
 
384
  AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \
 
385
mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \
 
386
strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \
 
387
__fsetlocking])
 
388
 
 
389
  dnl Use the _snprintf function only if it is declared (because on NetBSD it
 
390
  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
 
391
  gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
 
392
  gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
 
393
 
 
394
  dnl Use the *_unlocked functions only if they are declared.
 
395
  dnl (because some of them were defined without being declared in Solaris
 
396
  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
 
397
  dnl on Solaris 2.5.1 to run on Solaris 2.6).
 
398
  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
 
399
  gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
 
400
  gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
 
401
  gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
 
402
 
 
403
  case $gt_cv_func_printf_posix in
 
404
    *yes) HAVE_POSIX_PRINTF=1 ;;
 
405
    *) HAVE_POSIX_PRINTF=0 ;;
 
406
  esac
 
407
  AC_SUBST([HAVE_POSIX_PRINTF])
 
408
  if test "$ac_cv_func_asprintf" = yes; then
 
409
    HAVE_ASPRINTF=1
 
410
  else
 
411
    HAVE_ASPRINTF=0
 
412
  fi
 
413
  AC_SUBST([HAVE_ASPRINTF])
 
414
  if test "$ac_cv_func_snprintf" = yes; then
 
415
    HAVE_SNPRINTF=1
 
416
  else
 
417
    HAVE_SNPRINTF=0
 
418
  fi
 
419
  AC_SUBST([HAVE_SNPRINTF])
 
420
  if test "$ac_cv_func_wprintf" = yes; then
 
421
    HAVE_WPRINTF=1
 
422
  else
 
423
    HAVE_WPRINTF=0
 
424
  fi
 
425
  AC_SUBST([HAVE_WPRINTF])
 
426
 
 
427
  AM_ICONV
 
428
  AM_LANGINFO_CODESET
 
429
  if test $ac_cv_header_locale_h = yes; then
 
430
    AM_LC_MESSAGES
 
431
  fi
 
432
 
 
433
  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
 
434
  dnl because plural.y uses bison specific features. It requires at least
 
435
  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
 
436
  dnl compile.
 
437
  dnl bison is only needed for the maintainer (who touches plural.y). But in
 
438
  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
 
439
  dnl the rule in general Makefile. Now, some people carelessly touch the
 
440
  dnl files or have a broken "make" program, hence the plural.c rule will
 
441
  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
 
442
  dnl present or too old.
 
443
  AC_CHECK_PROGS([INTLBISON], [bison])
 
444
  if test -z "$INTLBISON"; then
 
445
    ac_verc_fail=yes
 
446
  else
 
447
    dnl Found it, now check the version.
 
448
    AC_MSG_CHECKING([version of bison])
 
449
changequote(<<,>>)dnl
 
450
    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
 
451
    case $ac_prog_version in
 
452
      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
 
453
      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
 
454
changequote([,])dnl
 
455
         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
 
456
      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
 
457
    esac
 
458
    AC_MSG_RESULT([$ac_prog_version])
 
459
  fi
 
460
  if test $ac_verc_fail = yes; then
 
461
    INTLBISON=:
 
462
  fi
 
463
])
 
464
 
 
465
 
 
466
dnl gt_CHECK_DECL(FUNC, INCLUDES)
 
467
dnl Check whether a function is declared.
 
468
AC_DEFUN([gt_CHECK_DECL],
 
469
[
 
470
  AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
 
471
    [AC_TRY_COMPILE([$2], [
 
472
#ifndef $1
 
473
  char *p = (char *) $1;
 
474
#endif
 
475
], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
 
476
  if test $ac_cv_have_decl_$1 = yes; then
 
477
    gt_value=1
 
478
  else
 
479
    gt_value=0
 
480
  fi
 
481
  AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
 
482
    [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
379
483
])
380
484
 
381
485