1*440a403fSchristos# gettext.m4 serial 20 (gettext-0.12)
2*440a403fSchristosdnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
3*440a403fSchristosdnl This file is free software, distributed under the terms of the GNU
4*440a403fSchristosdnl General Public License.  As a special exception to the GNU General
5*440a403fSchristosdnl Public License, this file may be distributed as part of a program
6*440a403fSchristosdnl that contains a configuration script generated by Autoconf, under
7*440a403fSchristosdnl the same distribution terms as the rest of that program.
8*440a403fSchristosdnl
9*440a403fSchristosdnl This file can can be used in projects which are not available under
10*440a403fSchristosdnl the GNU General Public License or the GNU Library General Public
11*440a403fSchristosdnl License but which still want to provide support for the GNU gettext
12*440a403fSchristosdnl functionality.
13*440a403fSchristosdnl Please note that the actual code of the GNU gettext library is covered
14*440a403fSchristosdnl by the GNU Library General Public License, and the rest of the GNU
15*440a403fSchristosdnl gettext package package is covered by the GNU General Public License.
16*440a403fSchristosdnl They are *not* in the public domain.
17*440a403fSchristos
18*440a403fSchristosdnl Authors:
19*440a403fSchristosdnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
20*440a403fSchristosdnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
21*440a403fSchristos
22*440a403fSchristosdnl Macro to add for using GNU gettext.
23*440a403fSchristos
24*440a403fSchristosdnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
25*440a403fSchristosdnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
26*440a403fSchristosdnl    default (if it is not specified or empty) is 'no-libtool'.
27*440a403fSchristosdnl    INTLSYMBOL should be 'external' for packages with no intl directory,
28*440a403fSchristosdnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
29*440a403fSchristosdnl    If INTLSYMBOL is 'use-libtool', then a libtool library
30*440a403fSchristosdnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
31*440a403fSchristosdnl    depending on --{enable,disable}-{shared,static} and on the presence of
32*440a403fSchristosdnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
33*440a403fSchristosdnl    $(top_builddir)/intl/libintl.a will be created.
34*440a403fSchristosdnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
35*440a403fSchristosdnl    implementations (in libc or libintl) without the ngettext() function
36*440a403fSchristosdnl    will be ignored.  If NEEDSYMBOL is specified and is
37*440a403fSchristosdnl    'need-formatstring-macros', then GNU gettext implementations that don't
38*440a403fSchristosdnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
39*440a403fSchristosdnl INTLDIR is used to find the intl libraries.  If empty,
40*440a403fSchristosdnl    the value `$(top_builddir)/intl/' is used.
41*440a403fSchristosdnl
42*440a403fSchristosdnl The result of the configuration is one of three cases:
43*440a403fSchristosdnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
44*440a403fSchristosdnl    and used.
45*440a403fSchristosdnl    Catalog format: GNU --> install in $(datadir)
46*440a403fSchristosdnl    Catalog extension: .mo after installation, .gmo in source tree
47*440a403fSchristosdnl 2) GNU gettext has been found in the system's C library.
48*440a403fSchristosdnl    Catalog format: GNU --> install in $(datadir)
49*440a403fSchristosdnl    Catalog extension: .mo after installation, .gmo in source tree
50*440a403fSchristosdnl 3) No internationalization, always use English msgid.
51*440a403fSchristosdnl    Catalog format: none
52*440a403fSchristosdnl    Catalog extension: none
53*440a403fSchristosdnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
54*440a403fSchristosdnl The use of .gmo is historical (it was needed to avoid overwriting the
55*440a403fSchristosdnl GNU format catalogs when building on a platform with an X/Open gettext),
56*440a403fSchristosdnl but we keep it in order not to force irrelevant filename changes on the
57*440a403fSchristosdnl maintainers.
58*440a403fSchristosdnl
59*440a403fSchristosAC_DEFUN([AM_GNU_GETTEXT],
60*440a403fSchristos[
61*440a403fSchristos  dnl Argument checking.
62*440a403fSchristos  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
63*440a403fSchristos    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
64*440a403fSchristos])])])])])
65*440a403fSchristos  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
66*440a403fSchristos    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
67*440a403fSchristos])])])])
68*440a403fSchristos  define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
69*440a403fSchristos  define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
70*440a403fSchristos
71*440a403fSchristos  AC_REQUIRE([AM_PO_SUBDIRS])dnl
72*440a403fSchristos  ifelse(gt_included_intl, yes, [
73*440a403fSchristos    AC_REQUIRE([AM_INTL_SUBDIR])dnl
74*440a403fSchristos  ])
75*440a403fSchristos
76*440a403fSchristos  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
77*440a403fSchristos  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
78*440a403fSchristos  AC_REQUIRE([AC_LIB_RPATH])
79*440a403fSchristos
80*440a403fSchristos  dnl Sometimes libintl requires libiconv, so first search for libiconv.
81*440a403fSchristos  dnl Ideally we would do this search only after the
82*440a403fSchristos  dnl      if test "$USE_NLS" = "yes"; then
83*440a403fSchristos  dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
84*440a403fSchristos  dnl tests. But if configure.ac invokes AM_ICONV after AM_GNU_GETTEXT
85*440a403fSchristos  dnl the configure script would need to contain the same shell code
86*440a403fSchristos  dnl again, outside any 'if'. There are two solutions:
87*440a403fSchristos  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
88*440a403fSchristos  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
89*440a403fSchristos  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
90*440a403fSchristos  dnl documented, we avoid it.
91*440a403fSchristos  ifelse(gt_included_intl, yes, , [
92*440a403fSchristos    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
93*440a403fSchristos  ])
94*440a403fSchristos
95*440a403fSchristos  dnl Set USE_NLS.
96*440a403fSchristos  AM_NLS
97*440a403fSchristos
98*440a403fSchristos  ifelse(gt_included_intl, yes, [
99*440a403fSchristos    BUILD_INCLUDED_LIBINTL=no
100*440a403fSchristos    USE_INCLUDED_LIBINTL=no
101*440a403fSchristos  ])
102*440a403fSchristos  LIBINTL=
103*440a403fSchristos  LTLIBINTL=
104*440a403fSchristos  POSUB=
105*440a403fSchristos
106*440a403fSchristos  dnl If we use NLS figure out what method
107*440a403fSchristos  if test "$USE_NLS" = "yes"; then
108*440a403fSchristos    gt_use_preinstalled_gnugettext=no
109*440a403fSchristos    ifelse(gt_included_intl, yes, [
110*440a403fSchristos      AC_MSG_CHECKING([whether included gettext is requested])
111*440a403fSchristos      AC_ARG_WITH(included-gettext,
112*440a403fSchristos        [  --with-included-gettext use the GNU gettext library included here],
113*440a403fSchristos        nls_cv_force_use_gnu_gettext=$withval,
114*440a403fSchristos        nls_cv_force_use_gnu_gettext=no)
115*440a403fSchristos      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
116*440a403fSchristos
117*440a403fSchristos      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
118*440a403fSchristos      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
119*440a403fSchristos    ])
120*440a403fSchristos        dnl User does not insist on using GNU NLS library.  Figure out what
121*440a403fSchristos        dnl to use.  If GNU gettext is available we use this.  Else we have
122*440a403fSchristos        dnl to fall back to GNU NLS library.
123*440a403fSchristos
124*440a403fSchristos        dnl Add a version number to the cache macros.
125*440a403fSchristos        define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
126*440a403fSchristos        define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
127*440a403fSchristos        define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
128*440a403fSchristos
129*440a403fSchristos        AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
130*440a403fSchristos         [AC_TRY_LINK([#include <libintl.h>
131*440a403fSchristos]ifelse([$2], [need-formatstring-macros],
132*440a403fSchristos[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
133*440a403fSchristos#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
134*440a403fSchristos#endif
135*440a403fSchristoschangequote(,)dnl
136*440a403fSchristostypedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
137*440a403fSchristoschangequote([,])dnl
138*440a403fSchristos], [])[extern int _nl_msg_cat_cntr;
139*440a403fSchristosextern int *_nl_domain_bindings;],
140*440a403fSchristos            [bindtextdomain ("", "");
141*440a403fSchristosreturn (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
142*440a403fSchristos            gt_cv_func_gnugettext_libc=yes,
143*440a403fSchristos            gt_cv_func_gnugettext_libc=no)])
144*440a403fSchristos
145*440a403fSchristos        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
146*440a403fSchristos          dnl Sometimes libintl requires libiconv, so first search for libiconv.
147*440a403fSchristos          ifelse(gt_included_intl, yes, , [
148*440a403fSchristos            AM_ICONV_LINK
149*440a403fSchristos          ])
150*440a403fSchristos          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
151*440a403fSchristos          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
152*440a403fSchristos          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
153*440a403fSchristos          dnl even if libiconv doesn't exist.
154*440a403fSchristos          AC_LIB_LINKFLAGS_BODY([intl])
155*440a403fSchristos          AC_CACHE_CHECK([for GNU gettext in libintl],
156*440a403fSchristos            gt_cv_func_gnugettext_libintl,
157*440a403fSchristos           [gt_save_CPPFLAGS="$CPPFLAGS"
158*440a403fSchristos            CPPFLAGS="$CPPFLAGS $INCINTL"
159*440a403fSchristos            gt_save_LIBS="$LIBS"
160*440a403fSchristos            LIBS="$LIBS $LIBINTL"
161*440a403fSchristos            dnl Now see whether libintl exists and does not depend on libiconv.
162*440a403fSchristos            AC_TRY_LINK([#include <libintl.h>
163*440a403fSchristos]ifelse([$2], [need-formatstring-macros],
164*440a403fSchristos[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
165*440a403fSchristos#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
166*440a403fSchristos#endif
167*440a403fSchristoschangequote(,)dnl
168*440a403fSchristostypedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
169*440a403fSchristoschangequote([,])dnl
170*440a403fSchristos], [])[extern int _nl_msg_cat_cntr;
171*440a403fSchristosextern
172*440a403fSchristos#ifdef __cplusplus
173*440a403fSchristos"C"
174*440a403fSchristos#endif
175*440a403fSchristosconst char *_nl_expand_alias ();],
176*440a403fSchristos              [bindtextdomain ("", "");
177*440a403fSchristosreturn (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
178*440a403fSchristos              gt_cv_func_gnugettext_libintl=yes,
179*440a403fSchristos              gt_cv_func_gnugettext_libintl=no)
180*440a403fSchristos            dnl Now see whether libintl exists and depends on libiconv.
181*440a403fSchristos            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
182*440a403fSchristos              LIBS="$LIBS $LIBICONV"
183*440a403fSchristos              AC_TRY_LINK([#include <libintl.h>
184*440a403fSchristos]ifelse([$2], [need-formatstring-macros],
185*440a403fSchristos[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
186*440a403fSchristos#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
187*440a403fSchristos#endif
188*440a403fSchristoschangequote(,)dnl
189*440a403fSchristostypedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
190*440a403fSchristoschangequote([,])dnl
191*440a403fSchristos], [])[extern int _nl_msg_cat_cntr;
192*440a403fSchristosextern
193*440a403fSchristos#ifdef __cplusplus
194*440a403fSchristos"C"
195*440a403fSchristos#endif
196*440a403fSchristosconst char *_nl_expand_alias ();],
197*440a403fSchristos                [bindtextdomain ("", "");
198*440a403fSchristosreturn (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
199*440a403fSchristos               [LIBINTL="$LIBINTL $LIBICONV"
200*440a403fSchristos                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
201*440a403fSchristos                gt_cv_func_gnugettext_libintl=yes
202*440a403fSchristos               ])
203*440a403fSchristos            fi
204*440a403fSchristos            CPPFLAGS="$gt_save_CPPFLAGS"
205*440a403fSchristos            LIBS="$gt_save_LIBS"])
206*440a403fSchristos        fi
207*440a403fSchristos
208*440a403fSchristos        dnl If an already present or preinstalled GNU gettext() is found,
209*440a403fSchristos        dnl use it.  But if this macro is used in GNU gettext, and GNU
210*440a403fSchristos        dnl gettext is already preinstalled in libintl, we update this
211*440a403fSchristos        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
212*440a403fSchristos        if test "$gt_cv_func_gnugettext_libc" = "yes" \
213*440a403fSchristos           || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
214*440a403fSchristos                && test "$PACKAGE" != gettext-runtime \
215*440a403fSchristos                && test "$PACKAGE" != gettext-tools; }; then
216*440a403fSchristos          gt_use_preinstalled_gnugettext=yes
217*440a403fSchristos        else
218*440a403fSchristos          dnl Reset the values set by searching for libintl.
219*440a403fSchristos          LIBINTL=
220*440a403fSchristos          LTLIBINTL=
221*440a403fSchristos          INCINTL=
222*440a403fSchristos        fi
223*440a403fSchristos
224*440a403fSchristos    ifelse(gt_included_intl, yes, [
225*440a403fSchristos        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
226*440a403fSchristos          dnl GNU gettext is not found in the C library.
227*440a403fSchristos          dnl Fall back on included GNU gettext library.
228*440a403fSchristos          nls_cv_use_gnu_gettext=yes
229*440a403fSchristos        fi
230*440a403fSchristos      fi
231*440a403fSchristos
232*440a403fSchristos      if test "$nls_cv_use_gnu_gettext" = "yes"; then
233*440a403fSchristos        dnl Mark actions used to generate GNU NLS library.
234*440a403fSchristos        BUILD_INCLUDED_LIBINTL=yes
235*440a403fSchristos        USE_INCLUDED_LIBINTL=yes
236*440a403fSchristos        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
237*440a403fSchristos        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
238*440a403fSchristos        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
239*440a403fSchristos      fi
240*440a403fSchristos
241*440a403fSchristos      if test "$gt_use_preinstalled_gnugettext" = "yes" \
242*440a403fSchristos         || test "$nls_cv_use_gnu_gettext" = "yes"; then
243*440a403fSchristos        dnl Mark actions to use GNU gettext tools.
244*440a403fSchristos        CATOBJEXT=.gmo
245*440a403fSchristos      fi
246*440a403fSchristos    ])
247*440a403fSchristos
248*440a403fSchristos    if test "$gt_use_preinstalled_gnugettext" = "yes" \
249*440a403fSchristos       || test "$nls_cv_use_gnu_gettext" = "yes"; then
250*440a403fSchristos      AC_DEFINE(ENABLE_NLS, 1,
251*440a403fSchristos        [Define to 1 if translation of program messages to the user's native language
252*440a403fSchristos   is requested.])
253*440a403fSchristos    else
254*440a403fSchristos      USE_NLS=no
255*440a403fSchristos    fi
256*440a403fSchristos  fi
257*440a403fSchristos
258*440a403fSchristos  AC_MSG_CHECKING([whether to use NLS])
259*440a403fSchristos  AC_MSG_RESULT([$USE_NLS])
260*440a403fSchristos  if test "$USE_NLS" = "yes"; then
261*440a403fSchristos    AC_MSG_CHECKING([where the gettext function comes from])
262*440a403fSchristos    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
263*440a403fSchristos      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
264*440a403fSchristos        gt_source="external libintl"
265*440a403fSchristos      else
266*440a403fSchristos        gt_source="libc"
267*440a403fSchristos      fi
268*440a403fSchristos    else
269*440a403fSchristos      gt_source="included intl directory"
270*440a403fSchristos    fi
271*440a403fSchristos    AC_MSG_RESULT([$gt_source])
272*440a403fSchristos  fi
273*440a403fSchristos
274*440a403fSchristos  if test "$USE_NLS" = "yes"; then
275*440a403fSchristos
276*440a403fSchristos    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
277*440a403fSchristos      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
278*440a403fSchristos        AC_MSG_CHECKING([how to link with libintl])
279*440a403fSchristos        AC_MSG_RESULT([$LIBINTL])
280*440a403fSchristos        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
281*440a403fSchristos      fi
282*440a403fSchristos
283*440a403fSchristos      dnl For backward compatibility. Some packages may be using this.
284*440a403fSchristos      AC_DEFINE(HAVE_GETTEXT, 1,
285*440a403fSchristos       [Define if the GNU gettext() function is already present or preinstalled.])
286*440a403fSchristos      AC_DEFINE(HAVE_DCGETTEXT, 1,
287*440a403fSchristos       [Define if the GNU dcgettext() function is already present or preinstalled.])
288*440a403fSchristos    fi
289*440a403fSchristos
290*440a403fSchristos    dnl We need to process the po/ directory.
291*440a403fSchristos    POSUB=po
292*440a403fSchristos  fi
293*440a403fSchristos
294*440a403fSchristos  ifelse(gt_included_intl, yes, [
295*440a403fSchristos    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
296*440a403fSchristos    dnl to 'yes' because some of the testsuite requires it.
297*440a403fSchristos    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
298*440a403fSchristos      BUILD_INCLUDED_LIBINTL=yes
299*440a403fSchristos    fi
300*440a403fSchristos
301*440a403fSchristos    dnl Make all variables we use known to autoconf.
302*440a403fSchristos    AC_SUBST(BUILD_INCLUDED_LIBINTL)
303*440a403fSchristos    AC_SUBST(USE_INCLUDED_LIBINTL)
304*440a403fSchristos    AC_SUBST(CATOBJEXT)
305*440a403fSchristos
306*440a403fSchristos    dnl For backward compatibility. Some configure.acs may be using this.
307*440a403fSchristos    nls_cv_header_intl=
308*440a403fSchristos    nls_cv_header_libgt=
309*440a403fSchristos
310*440a403fSchristos    dnl For backward compatibility. Some Makefiles may be using this.
311*440a403fSchristos    DATADIRNAME=share
312*440a403fSchristos    AC_SUBST(DATADIRNAME)
313*440a403fSchristos
314*440a403fSchristos    dnl For backward compatibility. Some Makefiles may be using this.
315*440a403fSchristos    INSTOBJEXT=.mo
316*440a403fSchristos    AC_SUBST(INSTOBJEXT)
317*440a403fSchristos
318*440a403fSchristos    dnl For backward compatibility. Some Makefiles may be using this.
319*440a403fSchristos    GENCAT=gencat
320*440a403fSchristos    AC_SUBST(GENCAT)
321*440a403fSchristos
322*440a403fSchristos    dnl For backward compatibility. Some Makefiles may be using this.
323*440a403fSchristos    if test "$USE_INCLUDED_LIBINTL" = yes; then
324*440a403fSchristos      INTLOBJS="\$(GETTOBJS)"
325*440a403fSchristos    fi
326*440a403fSchristos    AC_SUBST(INTLOBJS)
327*440a403fSchristos
328*440a403fSchristos    dnl Enable libtool support if the surrounding package wishes it.
329*440a403fSchristos    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
330*440a403fSchristos    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
331*440a403fSchristos  ])
332*440a403fSchristos
333*440a403fSchristos  dnl For backward compatibility. Some Makefiles may be using this.
334*440a403fSchristos  INTLLIBS="$LIBINTL"
335*440a403fSchristos  AC_SUBST(INTLLIBS)
336*440a403fSchristos
337*440a403fSchristos  dnl Make all documented variables known to autoconf.
338*440a403fSchristos  AC_SUBST(LIBINTL)
339*440a403fSchristos  AC_SUBST(LTLIBINTL)
340*440a403fSchristos  AC_SUBST(POSUB)
341*440a403fSchristos])
342*440a403fSchristos
343*440a403fSchristos
344*440a403fSchristosdnl Checks for all prerequisites of the intl subdirectory,
345*440a403fSchristosdnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
346*440a403fSchristosdnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
347*440a403fSchristosAC_DEFUN([AM_INTL_SUBDIR],
348*440a403fSchristos[
349*440a403fSchristos  AC_REQUIRE([AC_PROG_INSTALL])dnl
350*440a403fSchristos  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
351*440a403fSchristos  AC_REQUIRE([AC_PROG_CC])dnl
352*440a403fSchristos  AC_REQUIRE([AC_CANONICAL_HOST])dnl
353*440a403fSchristos  AC_REQUIRE([AC_PROG_RANLIB])dnl
354*440a403fSchristos  AC_REQUIRE([AC_ISC_POSIX])dnl
355*440a403fSchristos  AC_REQUIRE([AC_HEADER_STDC])dnl
356*440a403fSchristos  AC_REQUIRE([AC_C_CONST])dnl
357*440a403fSchristos  AC_REQUIRE([AC_C_INLINE])dnl
358*440a403fSchristos  AC_REQUIRE([AC_TYPE_OFF_T])dnl
359*440a403fSchristos  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
360*440a403fSchristos  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
361*440a403fSchristos  AC_REQUIRE([AC_FUNC_MMAP])dnl
362*440a403fSchristos  AC_REQUIRE([jm_GLIBC21])dnl
363*440a403fSchristos  AC_REQUIRE([gt_INTDIV0])dnl
364*440a403fSchristos  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
365*440a403fSchristos  AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
366*440a403fSchristos  AC_REQUIRE([gt_INTTYPES_PRI])dnl
367*440a403fSchristos
368*440a403fSchristos  AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
369*440a403fSchristosstdlib.h string.h unistd.h sys/param.h])
370*440a403fSchristos  AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
371*440a403fSchristosgeteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
372*440a403fSchristosstrcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
373*440a403fSchristos__fsetlocking])
374*440a403fSchristos
375*440a403fSchristos  AM_ICONV
376*440a403fSchristos  AM_LANGINFO_CODESET
377*440a403fSchristos  if test $ac_cv_header_locale_h = yes; then
378*440a403fSchristos    AM_LC_MESSAGES
379*440a403fSchristos  fi
380*440a403fSchristos
381*440a403fSchristos  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
382*440a403fSchristos  dnl because plural.y uses bison specific features. It requires at least
383*440a403fSchristos  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
384*440a403fSchristos  dnl compile.
385*440a403fSchristos  dnl bison is only needed for the maintainer (who touches plural.y). But in
386*440a403fSchristos  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
387*440a403fSchristos  dnl the rule in general Makefile. Now, some people carelessly touch the
388*440a403fSchristos  dnl files or have a broken "make" program, hence the plural.c rule will
389*440a403fSchristos  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
390*440a403fSchristos  dnl present or too old.
391*440a403fSchristos  AC_CHECK_PROGS([INTLBISON], [bison])
392*440a403fSchristos  if test -z "$INTLBISON"; then
393*440a403fSchristos    ac_verc_fail=yes
394*440a403fSchristos  else
395*440a403fSchristos    dnl Found it, now check the version.
396*440a403fSchristos    AC_MSG_CHECKING([version of bison])
397*440a403fSchristoschangequote(<<,>>)dnl
398*440a403fSchristos    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
399*440a403fSchristos    case $ac_prog_version in
400*440a403fSchristos      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
401*440a403fSchristos      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
402*440a403fSchristoschangequote([,])dnl
403*440a403fSchristos         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
404*440a403fSchristos      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
405*440a403fSchristos    esac
406*440a403fSchristos    AC_MSG_RESULT([$ac_prog_version])
407*440a403fSchristos  fi
408*440a403fSchristos  if test $ac_verc_fail = yes; then
409*440a403fSchristos    INTLBISON=:
410*440a403fSchristos  fi
411*440a403fSchristos])
412*440a403fSchristos
413*440a403fSchristos
414*440a403fSchristosdnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
415*440a403fSchristosAC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
416