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