xref: /freebsd/sys/contrib/openzfs/config/gettext.m4 (revision e25152834cdf3b353892835a4f3b157e066a8ed4)
1*eda14cbcSMatt Macy# gettext.m4 serial 70 (gettext-0.20)
2*eda14cbcSMatt Macydnl Copyright (C) 1995-2014, 2016, 2018 Free Software Foundation, Inc.
3*eda14cbcSMatt Macydnl This file is free software; the Free Software Foundation
4*eda14cbcSMatt Macydnl gives unlimited permission to copy and/or distribute it,
5*eda14cbcSMatt Macydnl with or without modifications, as long as this notice is preserved.
6*eda14cbcSMatt Macydnl
7*eda14cbcSMatt Macydnl This file can be used in projects which are not available under
8*eda14cbcSMatt Macydnl the GNU General Public License or the GNU Library General Public
9*eda14cbcSMatt Macydnl License but which still want to provide support for the GNU gettext
10*eda14cbcSMatt Macydnl functionality.
11*eda14cbcSMatt Macydnl Please note that the actual code of the GNU gettext library is covered
12*eda14cbcSMatt Macydnl by the GNU Library General Public License, and the rest of the GNU
13*eda14cbcSMatt Macydnl gettext package is covered by the GNU General Public License.
14*eda14cbcSMatt Macydnl They are *not* in the public domain.
15*eda14cbcSMatt Macy
16*eda14cbcSMatt Macydnl Authors:
17*eda14cbcSMatt Macydnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18*eda14cbcSMatt Macydnl   Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
19*eda14cbcSMatt Macy
20*eda14cbcSMatt Macydnl Macro to add for using GNU gettext.
21*eda14cbcSMatt Macy
22*eda14cbcSMatt Macydnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
23*eda14cbcSMatt Macydnl INTLSYMBOL must be one of 'external', 'use-libtool'.
24*eda14cbcSMatt Macydnl    INTLSYMBOL should be 'external' for packages other than GNU gettext, and
25*eda14cbcSMatt Macydnl    'use-libtool' for the packages 'gettext-runtime' and 'gettext-tools'.
26*eda14cbcSMatt Macydnl    If INTLSYMBOL is 'use-libtool', then a libtool library
27*eda14cbcSMatt Macydnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
28*eda14cbcSMatt Macydnl    depending on --{enable,disable}-{shared,static} and on the presence of
29*eda14cbcSMatt Macydnl    AM-DISABLE-SHARED).
30*eda14cbcSMatt Macydnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
31*eda14cbcSMatt Macydnl    implementations (in libc or libintl) without the ngettext() function
32*eda14cbcSMatt Macydnl    will be ignored.  If NEEDSYMBOL is specified and is
33*eda14cbcSMatt Macydnl    'need-formatstring-macros', then GNU gettext implementations that don't
34*eda14cbcSMatt Macydnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
35*eda14cbcSMatt Macydnl INTLDIR is used to find the intl libraries.  If empty,
36*eda14cbcSMatt Macydnl    the value '$(top_builddir)/intl/' is used.
37*eda14cbcSMatt Macydnl
38*eda14cbcSMatt Macydnl The result of the configuration is one of three cases:
39*eda14cbcSMatt Macydnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
40*eda14cbcSMatt Macydnl    and used.
41*eda14cbcSMatt Macydnl    Catalog format: GNU --> install in $(datadir)
42*eda14cbcSMatt Macydnl    Catalog extension: .mo after installation, .gmo in source tree
43*eda14cbcSMatt Macydnl 2) GNU gettext has been found in the system's C library.
44*eda14cbcSMatt Macydnl    Catalog format: GNU --> install in $(datadir)
45*eda14cbcSMatt Macydnl    Catalog extension: .mo after installation, .gmo in source tree
46*eda14cbcSMatt Macydnl 3) No internationalization, always use English msgid.
47*eda14cbcSMatt Macydnl    Catalog format: none
48*eda14cbcSMatt Macydnl    Catalog extension: none
49*eda14cbcSMatt Macydnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
50*eda14cbcSMatt Macydnl The use of .gmo is historical (it was needed to avoid overwriting the
51*eda14cbcSMatt Macydnl GNU format catalogs when building on a platform with an X/Open gettext),
52*eda14cbcSMatt Macydnl but we keep it in order not to force irrelevant filename changes on the
53*eda14cbcSMatt Macydnl maintainers.
54*eda14cbcSMatt Macydnl
55*eda14cbcSMatt MacyAC_DEFUN([AM_GNU_GETTEXT],
56*eda14cbcSMatt Macy[
57*eda14cbcSMatt Macy  dnl Argument checking.
58*eda14cbcSMatt Macy  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [use-libtool], ,
59*eda14cbcSMatt Macy    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
60*eda14cbcSMatt Macy])])])])
61*eda14cbcSMatt Macy  ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
62*eda14cbcSMatt Macy    [errprint([ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported.
63*eda14cbcSMatt Macy])])
64*eda14cbcSMatt Macy  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
65*eda14cbcSMatt Macy    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
66*eda14cbcSMatt Macy])])])])
67*eda14cbcSMatt Macy  define([gt_included_intl],
68*eda14cbcSMatt Macy    ifelse([$1], [external], [no], [yes]))
69*eda14cbcSMatt Macy  gt_NEEDS_INIT
70*eda14cbcSMatt Macy  AM_GNU_GETTEXT_NEED([$2])
71*eda14cbcSMatt Macy
72*eda14cbcSMatt Macy  AC_REQUIRE([AM_PO_SUBDIRS])dnl
73*eda14cbcSMatt Macy  ifelse(gt_included_intl, yes, [
74*eda14cbcSMatt Macy    AC_REQUIRE([AM_INTL_SUBDIR])dnl
75*eda14cbcSMatt Macy  ])
76*eda14cbcSMatt Macy
77*eda14cbcSMatt Macy  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
78*eda14cbcSMatt Macy  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
79*eda14cbcSMatt Macy  AC_REQUIRE([AC_LIB_RPATH])
80*eda14cbcSMatt Macy
81*eda14cbcSMatt Macy  dnl Sometimes libintl requires libiconv, so first search for libiconv.
82*eda14cbcSMatt Macy  dnl Ideally we would do this search only after the
83*eda14cbcSMatt Macy  dnl      if test "$USE_NLS" = "yes"; then
84*eda14cbcSMatt Macy  dnl        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
85*eda14cbcSMatt Macy  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
86*eda14cbcSMatt Macy  dnl the configure script would need to contain the same shell code
87*eda14cbcSMatt Macy  dnl again, outside any 'if'. There are two solutions:
88*eda14cbcSMatt Macy  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
89*eda14cbcSMatt Macy  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
90*eda14cbcSMatt Macy  dnl Since AC_PROVIDE_IFELSE is not documented, we avoid it.
91*eda14cbcSMatt Macy  ifelse(gt_included_intl, yes, , [
92*eda14cbcSMatt Macy    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
93*eda14cbcSMatt Macy  ])
94*eda14cbcSMatt Macy
95*eda14cbcSMatt Macy  dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation.
96*eda14cbcSMatt Macy  gt_INTL_MACOSX
97*eda14cbcSMatt Macy
98*eda14cbcSMatt Macy  dnl Set USE_NLS.
99*eda14cbcSMatt Macy  AC_REQUIRE([AM_NLS])
100*eda14cbcSMatt Macy
101*eda14cbcSMatt Macy  ifelse(gt_included_intl, yes, [
102*eda14cbcSMatt Macy    BUILD_INCLUDED_LIBINTL=no
103*eda14cbcSMatt Macy    USE_INCLUDED_LIBINTL=no
104*eda14cbcSMatt Macy  ])
105*eda14cbcSMatt Macy  LIBINTL=
106*eda14cbcSMatt Macy  LTLIBINTL=
107*eda14cbcSMatt Macy  POSUB=
108*eda14cbcSMatt Macy
109*eda14cbcSMatt Macy  dnl Add a version number to the cache macros.
110*eda14cbcSMatt Macy  case " $gt_needs " in
111*eda14cbcSMatt Macy    *" need-formatstring-macros "*) gt_api_version=3 ;;
112*eda14cbcSMatt Macy    *" need-ngettext "*) gt_api_version=2 ;;
113*eda14cbcSMatt Macy    *) gt_api_version=1 ;;
114*eda14cbcSMatt Macy  esac
115*eda14cbcSMatt Macy  gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
116*eda14cbcSMatt Macy  gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
117*eda14cbcSMatt Macy
118*eda14cbcSMatt Macy  dnl If we use NLS figure out what method
119*eda14cbcSMatt Macy  if test "$USE_NLS" = "yes"; then
120*eda14cbcSMatt Macy    gt_use_preinstalled_gnugettext=no
121*eda14cbcSMatt Macy    ifelse(gt_included_intl, yes, [
122*eda14cbcSMatt Macy      AC_MSG_CHECKING([whether included gettext is requested])
123*eda14cbcSMatt Macy      AC_ARG_WITH([included-gettext],
124*eda14cbcSMatt Macy        [  --with-included-gettext use the GNU gettext library included here],
125*eda14cbcSMatt Macy        nls_cv_force_use_gnu_gettext=$withval,
126*eda14cbcSMatt Macy        nls_cv_force_use_gnu_gettext=no)
127*eda14cbcSMatt Macy      AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext])
128*eda14cbcSMatt Macy
129*eda14cbcSMatt Macy      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
130*eda14cbcSMatt Macy      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
131*eda14cbcSMatt Macy    ])
132*eda14cbcSMatt Macy        dnl User does not insist on using GNU NLS library.  Figure out what
133*eda14cbcSMatt Macy        dnl to use.  If GNU gettext is available we use this.  Else we have
134*eda14cbcSMatt Macy        dnl to fall back to GNU NLS library.
135*eda14cbcSMatt Macy
136*eda14cbcSMatt Macy        if test $gt_api_version -ge 3; then
137*eda14cbcSMatt Macy          gt_revision_test_code='
138*eda14cbcSMatt Macy#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
139*eda14cbcSMatt Macy#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
140*eda14cbcSMatt Macy#endif
141*eda14cbcSMatt Macychangequote(,)dnl
142*eda14cbcSMatt Macytypedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
143*eda14cbcSMatt Macychangequote([,])dnl
144*eda14cbcSMatt Macy'
145*eda14cbcSMatt Macy        else
146*eda14cbcSMatt Macy          gt_revision_test_code=
147*eda14cbcSMatt Macy        fi
148*eda14cbcSMatt Macy        if test $gt_api_version -ge 2; then
149*eda14cbcSMatt Macy          gt_expression_test_code=' + * ngettext ("", "", 0)'
150*eda14cbcSMatt Macy        else
151*eda14cbcSMatt Macy          gt_expression_test_code=
152*eda14cbcSMatt Macy        fi
153*eda14cbcSMatt Macy
154*eda14cbcSMatt Macy        AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
155*eda14cbcSMatt Macy         [AC_LINK_IFELSE(
156*eda14cbcSMatt Macy            [AC_LANG_PROGRAM(
157*eda14cbcSMatt Macy               [[
158*eda14cbcSMatt Macy#include <libintl.h>
159*eda14cbcSMatt Macy#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
160*eda14cbcSMatt Macyextern int _nl_msg_cat_cntr;
161*eda14cbcSMatt Macyextern int *_nl_domain_bindings;
162*eda14cbcSMatt Macy#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings)
163*eda14cbcSMatt Macy#else
164*eda14cbcSMatt Macy#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
165*eda14cbcSMatt Macy#endif
166*eda14cbcSMatt Macy$gt_revision_test_code
167*eda14cbcSMatt Macy               ]],
168*eda14cbcSMatt Macy               [[
169*eda14cbcSMatt Macybindtextdomain ("", "");
170*eda14cbcSMatt Macyreturn * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
171*eda14cbcSMatt Macy               ]])],
172*eda14cbcSMatt Macy            [eval "$gt_func_gnugettext_libc=yes"],
173*eda14cbcSMatt Macy            [eval "$gt_func_gnugettext_libc=no"])])
174*eda14cbcSMatt Macy
175*eda14cbcSMatt Macy        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
176*eda14cbcSMatt Macy          dnl Sometimes libintl requires libiconv, so first search for libiconv.
177*eda14cbcSMatt Macy          ifelse(gt_included_intl, yes, , [
178*eda14cbcSMatt Macy            AM_ICONV_LINK
179*eda14cbcSMatt Macy          ])
180*eda14cbcSMatt Macy          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
181*eda14cbcSMatt Macy          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
182*eda14cbcSMatt Macy          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
183*eda14cbcSMatt Macy          dnl even if libiconv doesn't exist.
184*eda14cbcSMatt Macy          AC_LIB_LINKFLAGS_BODY([intl])
185*eda14cbcSMatt Macy          AC_CACHE_CHECK([for GNU gettext in libintl],
186*eda14cbcSMatt Macy            [$gt_func_gnugettext_libintl],
187*eda14cbcSMatt Macy           [gt_save_CPPFLAGS="$CPPFLAGS"
188*eda14cbcSMatt Macy            CPPFLAGS="$CPPFLAGS $INCINTL"
189*eda14cbcSMatt Macy            gt_save_LIBS="$LIBS"
190*eda14cbcSMatt Macy            LIBS="$LIBS $LIBINTL"
191*eda14cbcSMatt Macy            dnl Now see whether libintl exists and does not depend on libiconv.
192*eda14cbcSMatt Macy            AC_LINK_IFELSE(
193*eda14cbcSMatt Macy              [AC_LANG_PROGRAM(
194*eda14cbcSMatt Macy                 [[
195*eda14cbcSMatt Macy#include <libintl.h>
196*eda14cbcSMatt Macy#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
197*eda14cbcSMatt Macyextern int _nl_msg_cat_cntr;
198*eda14cbcSMatt Macyextern
199*eda14cbcSMatt Macy#ifdef __cplusplus
200*eda14cbcSMatt Macy"C"
201*eda14cbcSMatt Macy#endif
202*eda14cbcSMatt Macyconst char *_nl_expand_alias (const char *);
203*eda14cbcSMatt Macy#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
204*eda14cbcSMatt Macy#else
205*eda14cbcSMatt Macy#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
206*eda14cbcSMatt Macy#endif
207*eda14cbcSMatt Macy$gt_revision_test_code
208*eda14cbcSMatt Macy                 ]],
209*eda14cbcSMatt Macy                 [[
210*eda14cbcSMatt Macybindtextdomain ("", "");
211*eda14cbcSMatt Macyreturn * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
212*eda14cbcSMatt Macy                 ]])],
213*eda14cbcSMatt Macy              [eval "$gt_func_gnugettext_libintl=yes"],
214*eda14cbcSMatt Macy              [eval "$gt_func_gnugettext_libintl=no"])
215*eda14cbcSMatt Macy            dnl Now see whether libintl exists and depends on libiconv.
216*eda14cbcSMatt Macy            if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
217*eda14cbcSMatt Macy              LIBS="$LIBS $LIBICONV"
218*eda14cbcSMatt Macy              AC_LINK_IFELSE(
219*eda14cbcSMatt Macy                [AC_LANG_PROGRAM(
220*eda14cbcSMatt Macy                   [[
221*eda14cbcSMatt Macy#include <libintl.h>
222*eda14cbcSMatt Macy#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
223*eda14cbcSMatt Macyextern int _nl_msg_cat_cntr;
224*eda14cbcSMatt Macyextern
225*eda14cbcSMatt Macy#ifdef __cplusplus
226*eda14cbcSMatt Macy"C"
227*eda14cbcSMatt Macy#endif
228*eda14cbcSMatt Macyconst char *_nl_expand_alias (const char *);
229*eda14cbcSMatt Macy#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
230*eda14cbcSMatt Macy#else
231*eda14cbcSMatt Macy#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
232*eda14cbcSMatt Macy#endif
233*eda14cbcSMatt Macy$gt_revision_test_code
234*eda14cbcSMatt Macy                   ]],
235*eda14cbcSMatt Macy                   [[
236*eda14cbcSMatt Macybindtextdomain ("", "");
237*eda14cbcSMatt Macyreturn * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
238*eda14cbcSMatt Macy                   ]])],
239*eda14cbcSMatt Macy                [LIBINTL="$LIBINTL $LIBICONV"
240*eda14cbcSMatt Macy                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
241*eda14cbcSMatt Macy                 eval "$gt_func_gnugettext_libintl=yes"
242*eda14cbcSMatt Macy                ])
243*eda14cbcSMatt Macy            fi
244*eda14cbcSMatt Macy            CPPFLAGS="$gt_save_CPPFLAGS"
245*eda14cbcSMatt Macy            LIBS="$gt_save_LIBS"])
246*eda14cbcSMatt Macy        fi
247*eda14cbcSMatt Macy
248*eda14cbcSMatt Macy        dnl If an already present or preinstalled GNU gettext() is found,
249*eda14cbcSMatt Macy        dnl use it.  But if this macro is used in GNU gettext, and GNU
250*eda14cbcSMatt Macy        dnl gettext is already preinstalled in libintl, we update this
251*eda14cbcSMatt Macy        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
252*eda14cbcSMatt Macy        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
253*eda14cbcSMatt Macy           || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
254*eda14cbcSMatt Macy                && test "$PACKAGE" != gettext-runtime \
255*eda14cbcSMatt Macy                && test "$PACKAGE" != gettext-tools; }; then
256*eda14cbcSMatt Macy          gt_use_preinstalled_gnugettext=yes
257*eda14cbcSMatt Macy        else
258*eda14cbcSMatt Macy          dnl Reset the values set by searching for libintl.
259*eda14cbcSMatt Macy          LIBINTL=
260*eda14cbcSMatt Macy          LTLIBINTL=
261*eda14cbcSMatt Macy          INCINTL=
262*eda14cbcSMatt Macy        fi
263*eda14cbcSMatt Macy
264*eda14cbcSMatt Macy    ifelse(gt_included_intl, yes, [
265*eda14cbcSMatt Macy        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
266*eda14cbcSMatt Macy          dnl GNU gettext is not found in the C library.
267*eda14cbcSMatt Macy          dnl Fall back on included GNU gettext library.
268*eda14cbcSMatt Macy          nls_cv_use_gnu_gettext=yes
269*eda14cbcSMatt Macy        fi
270*eda14cbcSMatt Macy      fi
271*eda14cbcSMatt Macy
272*eda14cbcSMatt Macy      if test "$nls_cv_use_gnu_gettext" = "yes"; then
273*eda14cbcSMatt Macy        dnl Mark actions used to generate GNU NLS library.
274*eda14cbcSMatt Macy        BUILD_INCLUDED_LIBINTL=yes
275*eda14cbcSMatt Macy        USE_INCLUDED_LIBINTL=yes
276*eda14cbcSMatt Macy        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD"
277*eda14cbcSMatt Macy        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD"
278*eda14cbcSMatt Macy        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
279*eda14cbcSMatt Macy      fi
280*eda14cbcSMatt Macy
281*eda14cbcSMatt Macy      CATOBJEXT=
282*eda14cbcSMatt Macy      if test "$gt_use_preinstalled_gnugettext" = "yes" \
283*eda14cbcSMatt Macy         || test "$nls_cv_use_gnu_gettext" = "yes"; then
284*eda14cbcSMatt Macy        dnl Mark actions to use GNU gettext tools.
285*eda14cbcSMatt Macy        CATOBJEXT=.gmo
286*eda14cbcSMatt Macy      fi
287*eda14cbcSMatt Macy    ])
288*eda14cbcSMatt Macy
289*eda14cbcSMatt Macy    if test -n "$INTL_MACOSX_LIBS"; then
290*eda14cbcSMatt Macy      if test "$gt_use_preinstalled_gnugettext" = "yes" \
291*eda14cbcSMatt Macy         || test "$nls_cv_use_gnu_gettext" = "yes"; then
292*eda14cbcSMatt Macy        dnl Some extra flags are needed during linking.
293*eda14cbcSMatt Macy        LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
294*eda14cbcSMatt Macy        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
295*eda14cbcSMatt Macy      fi
296*eda14cbcSMatt Macy    fi
297*eda14cbcSMatt Macy
298*eda14cbcSMatt Macy    if test "$gt_use_preinstalled_gnugettext" = "yes" \
299*eda14cbcSMatt Macy       || test "$nls_cv_use_gnu_gettext" = "yes"; then
300*eda14cbcSMatt Macy      AC_DEFINE([ENABLE_NLS], [1],
301*eda14cbcSMatt Macy        [Define to 1 if translation of program messages to the user's native language
302*eda14cbcSMatt Macy   is requested.])
303*eda14cbcSMatt Macy    else
304*eda14cbcSMatt Macy      USE_NLS=no
305*eda14cbcSMatt Macy    fi
306*eda14cbcSMatt Macy  fi
307*eda14cbcSMatt Macy
308*eda14cbcSMatt Macy  AC_MSG_CHECKING([whether to use NLS])
309*eda14cbcSMatt Macy  AC_MSG_RESULT([$USE_NLS])
310*eda14cbcSMatt Macy  if test "$USE_NLS" = "yes"; then
311*eda14cbcSMatt Macy    AC_MSG_CHECKING([where the gettext function comes from])
312*eda14cbcSMatt Macy    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
313*eda14cbcSMatt Macy      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
314*eda14cbcSMatt Macy        gt_source="external libintl"
315*eda14cbcSMatt Macy      else
316*eda14cbcSMatt Macy        gt_source="libc"
317*eda14cbcSMatt Macy      fi
318*eda14cbcSMatt Macy    else
319*eda14cbcSMatt Macy      gt_source="included intl directory"
320*eda14cbcSMatt Macy    fi
321*eda14cbcSMatt Macy    AC_MSG_RESULT([$gt_source])
322*eda14cbcSMatt Macy  fi
323*eda14cbcSMatt Macy
324*eda14cbcSMatt Macy  if test "$USE_NLS" = "yes"; then
325*eda14cbcSMatt Macy
326*eda14cbcSMatt Macy    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
327*eda14cbcSMatt Macy      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
328*eda14cbcSMatt Macy        AC_MSG_CHECKING([how to link with libintl])
329*eda14cbcSMatt Macy        AC_MSG_RESULT([$LIBINTL])
330*eda14cbcSMatt Macy        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
331*eda14cbcSMatt Macy      fi
332*eda14cbcSMatt Macy
333*eda14cbcSMatt Macy      dnl For backward compatibility. Some packages may be using this.
334*eda14cbcSMatt Macy      AC_DEFINE([HAVE_GETTEXT], [1],
335*eda14cbcSMatt Macy       [Define if the GNU gettext() function is already present or preinstalled.])
336*eda14cbcSMatt Macy      AC_DEFINE([HAVE_DCGETTEXT], [1],
337*eda14cbcSMatt Macy       [Define if the GNU dcgettext() function is already present or preinstalled.])
338*eda14cbcSMatt Macy    fi
339*eda14cbcSMatt Macy
340*eda14cbcSMatt Macy    dnl We need to process the po/ directory.
341*eda14cbcSMatt Macy    POSUB=po
342*eda14cbcSMatt Macy  fi
343*eda14cbcSMatt Macy
344*eda14cbcSMatt Macy  ifelse(gt_included_intl, yes, [
345*eda14cbcSMatt Macy    dnl In GNU gettext we have to set BUILD_INCLUDED_LIBINTL to 'yes'
346*eda14cbcSMatt Macy    dnl because some of the testsuite requires it.
347*eda14cbcSMatt Macy    BUILD_INCLUDED_LIBINTL=yes
348*eda14cbcSMatt Macy
349*eda14cbcSMatt Macy    dnl Make all variables we use known to autoconf.
350*eda14cbcSMatt Macy    AC_SUBST([BUILD_INCLUDED_LIBINTL])
351*eda14cbcSMatt Macy    AC_SUBST([USE_INCLUDED_LIBINTL])
352*eda14cbcSMatt Macy    AC_SUBST([CATOBJEXT])
353*eda14cbcSMatt Macy  ])
354*eda14cbcSMatt Macy
355*eda14cbcSMatt Macy  dnl For backward compatibility. Some Makefiles may be using this.
356*eda14cbcSMatt Macy  INTLLIBS="$LIBINTL"
357*eda14cbcSMatt Macy  AC_SUBST([INTLLIBS])
358*eda14cbcSMatt Macy
359*eda14cbcSMatt Macy  dnl Make all documented variables known to autoconf.
360*eda14cbcSMatt Macy  AC_SUBST([LIBINTL])
361*eda14cbcSMatt Macy  AC_SUBST([LTLIBINTL])
362*eda14cbcSMatt Macy  AC_SUBST([POSUB])
363*eda14cbcSMatt Macy])
364*eda14cbcSMatt Macy
365*eda14cbcSMatt Macy
366*eda14cbcSMatt Macydnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
367*eda14cbcSMatt Macym4_define([gt_NEEDS_INIT],
368*eda14cbcSMatt Macy[
369*eda14cbcSMatt Macy  m4_divert_text([DEFAULTS], [gt_needs=])
370*eda14cbcSMatt Macy  m4_define([gt_NEEDS_INIT], [])
371*eda14cbcSMatt Macy])
372*eda14cbcSMatt Macy
373*eda14cbcSMatt Macy
374*eda14cbcSMatt Macydnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
375*eda14cbcSMatt MacyAC_DEFUN([AM_GNU_GETTEXT_NEED],
376*eda14cbcSMatt Macy[
377*eda14cbcSMatt Macy  m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
378*eda14cbcSMatt Macy])
379*eda14cbcSMatt Macy
380*eda14cbcSMatt Macy
381*eda14cbcSMatt Macydnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
382*eda14cbcSMatt MacyAC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
383*eda14cbcSMatt Macy
384*eda14cbcSMatt Macy
385*eda14cbcSMatt Macydnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version])
386*eda14cbcSMatt MacyAC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], [])
387