xref: /minix3/external/bsd/flex/dist/m4/gettext.m4 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc# gettext.m4 serial 63 (gettext-0.18)
2*0a6a1f1dSLionel Sambucdnl Copyright (C) 1995-2010 Free Software Foundation, Inc.
3*0a6a1f1dSLionel Sambucdnl This file is free software; the Free Software Foundation
4*0a6a1f1dSLionel Sambucdnl gives unlimited permission to copy and/or distribute it,
5*0a6a1f1dSLionel Sambucdnl with or without modifications, as long as this notice is preserved.
6357f1050SThomas Veermandnl
7357f1050SThomas Veermandnl This file can can be used in projects which are not available under
8357f1050SThomas Veermandnl the GNU General Public License or the GNU Library General Public
9357f1050SThomas Veermandnl License but which still want to provide support for the GNU gettext
10357f1050SThomas Veermandnl functionality.
11357f1050SThomas Veermandnl Please note that the actual code of the GNU gettext library is covered
12357f1050SThomas Veermandnl by the GNU Library General Public License, and the rest of the GNU
13357f1050SThomas Veermandnl gettext package package is covered by the GNU General Public License.
14357f1050SThomas Veermandnl They are *not* in the public domain.
15357f1050SThomas Veerman
16357f1050SThomas Veermandnl Authors:
17357f1050SThomas Veermandnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18*0a6a1f1dSLionel Sambucdnl   Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
19357f1050SThomas Veerman
20357f1050SThomas Veermandnl Macro to add for using GNU gettext.
21357f1050SThomas Veerman
22357f1050SThomas Veermandnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
23357f1050SThomas Veermandnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
24357f1050SThomas Veermandnl    default (if it is not specified or empty) is 'no-libtool'.
25357f1050SThomas Veermandnl    INTLSYMBOL should be 'external' for packages with no intl directory,
26357f1050SThomas Veermandnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
27357f1050SThomas Veermandnl    If INTLSYMBOL is 'use-libtool', then a libtool library
28357f1050SThomas Veermandnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
29357f1050SThomas Veermandnl    depending on --{enable,disable}-{shared,static} and on the presence of
30357f1050SThomas Veermandnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
31357f1050SThomas Veermandnl    $(top_builddir)/intl/libintl.a will be created.
32357f1050SThomas Veermandnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
33357f1050SThomas Veermandnl    implementations (in libc or libintl) without the ngettext() function
34357f1050SThomas Veermandnl    will be ignored.  If NEEDSYMBOL is specified and is
35357f1050SThomas Veermandnl    'need-formatstring-macros', then GNU gettext implementations that don't
36357f1050SThomas Veermandnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
37357f1050SThomas Veermandnl INTLDIR is used to find the intl libraries.  If empty,
38357f1050SThomas Veermandnl    the value `$(top_builddir)/intl/' is used.
39357f1050SThomas Veermandnl
40357f1050SThomas Veermandnl The result of the configuration is one of three cases:
41357f1050SThomas Veermandnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
42357f1050SThomas Veermandnl    and used.
43357f1050SThomas Veermandnl    Catalog format: GNU --> install in $(datadir)
44357f1050SThomas Veermandnl    Catalog extension: .mo after installation, .gmo in source tree
45357f1050SThomas Veermandnl 2) GNU gettext has been found in the system's C library.
46357f1050SThomas Veermandnl    Catalog format: GNU --> install in $(datadir)
47357f1050SThomas Veermandnl    Catalog extension: .mo after installation, .gmo in source tree
48357f1050SThomas Veermandnl 3) No internationalization, always use English msgid.
49357f1050SThomas Veermandnl    Catalog format: none
50357f1050SThomas Veermandnl    Catalog extension: none
51357f1050SThomas Veermandnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
52357f1050SThomas Veermandnl The use of .gmo is historical (it was needed to avoid overwriting the
53357f1050SThomas Veermandnl GNU format catalogs when building on a platform with an X/Open gettext),
54357f1050SThomas Veermandnl but we keep it in order not to force irrelevant filename changes on the
55357f1050SThomas Veermandnl maintainers.
56357f1050SThomas Veermandnl
57357f1050SThomas VeermanAC_DEFUN([AM_GNU_GETTEXT],
58357f1050SThomas Veerman[
59357f1050SThomas Veerman  dnl Argument checking.
60357f1050SThomas Veerman  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
61357f1050SThomas Veerman    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
62357f1050SThomas Veerman])])])])])
63*0a6a1f1dSLionel Sambuc  ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
64*0a6a1f1dSLionel Sambuc    [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])])
65357f1050SThomas Veerman  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
66357f1050SThomas Veerman    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
67357f1050SThomas Veerman])])])])
68*0a6a1f1dSLionel Sambuc  define([gt_included_intl],
69*0a6a1f1dSLionel Sambuc    ifelse([$1], [external],
70*0a6a1f1dSLionel Sambuc      ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]),
71*0a6a1f1dSLionel Sambuc      [yes]))
72*0a6a1f1dSLionel Sambuc  define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
73*0a6a1f1dSLionel Sambuc  gt_NEEDS_INIT
74*0a6a1f1dSLionel Sambuc  AM_GNU_GETTEXT_NEED([$2])
75357f1050SThomas Veerman
76357f1050SThomas Veerman  AC_REQUIRE([AM_PO_SUBDIRS])dnl
77357f1050SThomas Veerman  ifelse(gt_included_intl, yes, [
78357f1050SThomas Veerman    AC_REQUIRE([AM_INTL_SUBDIR])dnl
79357f1050SThomas Veerman  ])
80357f1050SThomas Veerman
81357f1050SThomas Veerman  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
82357f1050SThomas Veerman  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
83357f1050SThomas Veerman  AC_REQUIRE([AC_LIB_RPATH])
84357f1050SThomas Veerman
85357f1050SThomas Veerman  dnl Sometimes libintl requires libiconv, so first search for libiconv.
86357f1050SThomas Veerman  dnl Ideally we would do this search only after the
87357f1050SThomas Veerman  dnl      if test "$USE_NLS" = "yes"; then
88*0a6a1f1dSLionel Sambuc  dnl        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
89357f1050SThomas Veerman  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
90357f1050SThomas Veerman  dnl the configure script would need to contain the same shell code
91357f1050SThomas Veerman  dnl again, outside any 'if'. There are two solutions:
92357f1050SThomas Veerman  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
93357f1050SThomas Veerman  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
94357f1050SThomas Veerman  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
95357f1050SThomas Veerman  dnl documented, we avoid it.
96357f1050SThomas Veerman  ifelse(gt_included_intl, yes, , [
97357f1050SThomas Veerman    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
98357f1050SThomas Veerman  ])
99357f1050SThomas Veerman
100*0a6a1f1dSLionel Sambuc  dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
101*0a6a1f1dSLionel Sambuc  gt_INTL_MACOSX
102*0a6a1f1dSLionel Sambuc
103357f1050SThomas Veerman  dnl Set USE_NLS.
104*0a6a1f1dSLionel Sambuc  AC_REQUIRE([AM_NLS])
105357f1050SThomas Veerman
106357f1050SThomas Veerman  ifelse(gt_included_intl, yes, [
107357f1050SThomas Veerman    BUILD_INCLUDED_LIBINTL=no
108357f1050SThomas Veerman    USE_INCLUDED_LIBINTL=no
109357f1050SThomas Veerman  ])
110357f1050SThomas Veerman  LIBINTL=
111357f1050SThomas Veerman  LTLIBINTL=
112357f1050SThomas Veerman  POSUB=
113357f1050SThomas Veerman
114*0a6a1f1dSLionel Sambuc  dnl Add a version number to the cache macros.
115*0a6a1f1dSLionel Sambuc  case " $gt_needs " in
116*0a6a1f1dSLionel Sambuc    *" need-formatstring-macros "*) gt_api_version=3 ;;
117*0a6a1f1dSLionel Sambuc    *" need-ngettext "*) gt_api_version=2 ;;
118*0a6a1f1dSLionel Sambuc    *) gt_api_version=1 ;;
119*0a6a1f1dSLionel Sambuc  esac
120*0a6a1f1dSLionel Sambuc  gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
121*0a6a1f1dSLionel Sambuc  gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
122*0a6a1f1dSLionel Sambuc
123357f1050SThomas Veerman  dnl If we use NLS figure out what method
124357f1050SThomas Veerman  if test "$USE_NLS" = "yes"; then
125357f1050SThomas Veerman    gt_use_preinstalled_gnugettext=no
126357f1050SThomas Veerman    ifelse(gt_included_intl, yes, [
127357f1050SThomas Veerman      AC_MSG_CHECKING([whether included gettext is requested])
128*0a6a1f1dSLionel Sambuc      AC_ARG_WITH([included-gettext],
129357f1050SThomas Veerman        [  --with-included-gettext use the GNU gettext library included here],
130357f1050SThomas Veerman        nls_cv_force_use_gnu_gettext=$withval,
131357f1050SThomas Veerman        nls_cv_force_use_gnu_gettext=no)
132*0a6a1f1dSLionel Sambuc      AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext])
133357f1050SThomas Veerman
134357f1050SThomas Veerman      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
135357f1050SThomas Veerman      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
136357f1050SThomas Veerman    ])
137357f1050SThomas Veerman        dnl User does not insist on using GNU NLS library.  Figure out what
138357f1050SThomas Veerman        dnl to use.  If GNU gettext is available we use this.  Else we have
139357f1050SThomas Veerman        dnl to fall back to GNU NLS library.
140357f1050SThomas Veerman
141*0a6a1f1dSLionel Sambuc        if test $gt_api_version -ge 3; then
142*0a6a1f1dSLionel Sambuc          gt_revision_test_code='
143*0a6a1f1dSLionel Sambuc#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
144357f1050SThomas Veerman#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
145357f1050SThomas Veerman#endif
146357f1050SThomas Veermanchangequote(,)dnl
147357f1050SThomas Veermantypedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
148357f1050SThomas Veermanchangequote([,])dnl
149*0a6a1f1dSLionel Sambuc'
150*0a6a1f1dSLionel Sambuc        else
151*0a6a1f1dSLionel Sambuc          gt_revision_test_code=
152*0a6a1f1dSLionel Sambuc        fi
153*0a6a1f1dSLionel Sambuc        if test $gt_api_version -ge 2; then
154*0a6a1f1dSLionel Sambuc          gt_expression_test_code=' + * ngettext ("", "", 0)'
155*0a6a1f1dSLionel Sambuc        else
156*0a6a1f1dSLionel Sambuc          gt_expression_test_code=
157*0a6a1f1dSLionel Sambuc        fi
158*0a6a1f1dSLionel Sambuc
159*0a6a1f1dSLionel Sambuc        AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
160*0a6a1f1dSLionel Sambuc         [AC_TRY_LINK([#include <libintl.h>
161*0a6a1f1dSLionel Sambuc$gt_revision_test_code
162*0a6a1f1dSLionel Sambucextern int _nl_msg_cat_cntr;
163357f1050SThomas Veermanextern int *_nl_domain_bindings;],
164357f1050SThomas Veerman            [bindtextdomain ("", "");
165*0a6a1f1dSLionel Sambucreturn * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings],
166*0a6a1f1dSLionel Sambuc            [eval "$gt_func_gnugettext_libc=yes"],
167*0a6a1f1dSLionel Sambuc            [eval "$gt_func_gnugettext_libc=no"])])
168357f1050SThomas Veerman
169*0a6a1f1dSLionel Sambuc        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
170357f1050SThomas Veerman          dnl Sometimes libintl requires libiconv, so first search for libiconv.
171357f1050SThomas Veerman          ifelse(gt_included_intl, yes, , [
172357f1050SThomas Veerman            AM_ICONV_LINK
173357f1050SThomas Veerman          ])
174357f1050SThomas Veerman          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
175357f1050SThomas Veerman          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
176357f1050SThomas Veerman          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
177357f1050SThomas Veerman          dnl even if libiconv doesn't exist.
178357f1050SThomas Veerman          AC_LIB_LINKFLAGS_BODY([intl])
179357f1050SThomas Veerman          AC_CACHE_CHECK([for GNU gettext in libintl],
180*0a6a1f1dSLionel Sambuc            [$gt_func_gnugettext_libintl],
181357f1050SThomas Veerman           [gt_save_CPPFLAGS="$CPPFLAGS"
182357f1050SThomas Veerman            CPPFLAGS="$CPPFLAGS $INCINTL"
183357f1050SThomas Veerman            gt_save_LIBS="$LIBS"
184357f1050SThomas Veerman            LIBS="$LIBS $LIBINTL"
185357f1050SThomas Veerman            dnl Now see whether libintl exists and does not depend on libiconv.
186357f1050SThomas Veerman            AC_TRY_LINK([#include <libintl.h>
187*0a6a1f1dSLionel Sambuc$gt_revision_test_code
188*0a6a1f1dSLionel Sambucextern int _nl_msg_cat_cntr;
189357f1050SThomas Veermanextern
190357f1050SThomas Veerman#ifdef __cplusplus
191357f1050SThomas Veerman"C"
192357f1050SThomas Veerman#endif
193*0a6a1f1dSLionel Sambucconst char *_nl_expand_alias (const char *);],
194357f1050SThomas Veerman              [bindtextdomain ("", "");
195*0a6a1f1dSLionel Sambucreturn * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
196*0a6a1f1dSLionel Sambuc              [eval "$gt_func_gnugettext_libintl=yes"],
197*0a6a1f1dSLionel Sambuc              [eval "$gt_func_gnugettext_libintl=no"])
198357f1050SThomas Veerman            dnl Now see whether libintl exists and depends on libiconv.
199*0a6a1f1dSLionel Sambuc            if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
200357f1050SThomas Veerman              LIBS="$LIBS $LIBICONV"
201357f1050SThomas Veerman              AC_TRY_LINK([#include <libintl.h>
202*0a6a1f1dSLionel Sambuc$gt_revision_test_code
203*0a6a1f1dSLionel Sambucextern int _nl_msg_cat_cntr;
204357f1050SThomas Veermanextern
205357f1050SThomas Veerman#ifdef __cplusplus
206357f1050SThomas Veerman"C"
207357f1050SThomas Veerman#endif
208*0a6a1f1dSLionel Sambucconst char *_nl_expand_alias (const char *);],
209357f1050SThomas Veerman                [bindtextdomain ("", "");
210*0a6a1f1dSLionel Sambucreturn * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
211357f1050SThomas Veerman               [LIBINTL="$LIBINTL $LIBICONV"
212357f1050SThomas Veerman                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
213*0a6a1f1dSLionel Sambuc                eval "$gt_func_gnugettext_libintl=yes"
214357f1050SThomas Veerman               ])
215357f1050SThomas Veerman            fi
216357f1050SThomas Veerman            CPPFLAGS="$gt_save_CPPFLAGS"
217357f1050SThomas Veerman            LIBS="$gt_save_LIBS"])
218357f1050SThomas Veerman        fi
219357f1050SThomas Veerman
220357f1050SThomas Veerman        dnl If an already present or preinstalled GNU gettext() is found,
221357f1050SThomas Veerman        dnl use it.  But if this macro is used in GNU gettext, and GNU
222357f1050SThomas Veerman        dnl gettext is already preinstalled in libintl, we update this
223357f1050SThomas Veerman        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
224*0a6a1f1dSLionel Sambuc        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
225*0a6a1f1dSLionel Sambuc           || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
226357f1050SThomas Veerman                && test "$PACKAGE" != gettext-runtime \
227357f1050SThomas Veerman                && test "$PACKAGE" != gettext-tools; }; then
228357f1050SThomas Veerman          gt_use_preinstalled_gnugettext=yes
229357f1050SThomas Veerman        else
230357f1050SThomas Veerman          dnl Reset the values set by searching for libintl.
231357f1050SThomas Veerman          LIBINTL=
232357f1050SThomas Veerman          LTLIBINTL=
233357f1050SThomas Veerman          INCINTL=
234357f1050SThomas Veerman        fi
235357f1050SThomas Veerman
236357f1050SThomas Veerman    ifelse(gt_included_intl, yes, [
237357f1050SThomas Veerman        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
238357f1050SThomas Veerman          dnl GNU gettext is not found in the C library.
239357f1050SThomas Veerman          dnl Fall back on included GNU gettext library.
240357f1050SThomas Veerman          nls_cv_use_gnu_gettext=yes
241357f1050SThomas Veerman        fi
242357f1050SThomas Veerman      fi
243357f1050SThomas Veerman
244357f1050SThomas Veerman      if test "$nls_cv_use_gnu_gettext" = "yes"; then
245357f1050SThomas Veerman        dnl Mark actions used to generate GNU NLS library.
246357f1050SThomas Veerman        BUILD_INCLUDED_LIBINTL=yes
247357f1050SThomas Veerman        USE_INCLUDED_LIBINTL=yes
248*0a6a1f1dSLionel Sambuc        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD"
249*0a6a1f1dSLionel Sambuc        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD"
250357f1050SThomas Veerman        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
251357f1050SThomas Veerman      fi
252357f1050SThomas Veerman
253*0a6a1f1dSLionel Sambuc      CATOBJEXT=
254357f1050SThomas Veerman      if test "$gt_use_preinstalled_gnugettext" = "yes" \
255357f1050SThomas Veerman         || test "$nls_cv_use_gnu_gettext" = "yes"; then
256357f1050SThomas Veerman        dnl Mark actions to use GNU gettext tools.
257357f1050SThomas Veerman        CATOBJEXT=.gmo
258357f1050SThomas Veerman      fi
259357f1050SThomas Veerman    ])
260357f1050SThomas Veerman
261*0a6a1f1dSLionel Sambuc    if test -n "$INTL_MACOSX_LIBS"; then
262357f1050SThomas Veerman      if test "$gt_use_preinstalled_gnugettext" = "yes" \
263357f1050SThomas Veerman         || test "$nls_cv_use_gnu_gettext" = "yes"; then
264*0a6a1f1dSLionel Sambuc        dnl Some extra flags are needed during linking.
265*0a6a1f1dSLionel Sambuc        LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
266*0a6a1f1dSLionel Sambuc        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
267*0a6a1f1dSLionel Sambuc      fi
268*0a6a1f1dSLionel Sambuc    fi
269*0a6a1f1dSLionel Sambuc
270*0a6a1f1dSLionel Sambuc    if test "$gt_use_preinstalled_gnugettext" = "yes" \
271*0a6a1f1dSLionel Sambuc       || test "$nls_cv_use_gnu_gettext" = "yes"; then
272*0a6a1f1dSLionel Sambuc      AC_DEFINE([ENABLE_NLS], [1],
273357f1050SThomas Veerman        [Define to 1 if translation of program messages to the user's native language
274357f1050SThomas Veerman   is requested.])
275357f1050SThomas Veerman    else
276357f1050SThomas Veerman      USE_NLS=no
277357f1050SThomas Veerman    fi
278357f1050SThomas Veerman  fi
279357f1050SThomas Veerman
280357f1050SThomas Veerman  AC_MSG_CHECKING([whether to use NLS])
281357f1050SThomas Veerman  AC_MSG_RESULT([$USE_NLS])
282357f1050SThomas Veerman  if test "$USE_NLS" = "yes"; then
283357f1050SThomas Veerman    AC_MSG_CHECKING([where the gettext function comes from])
284357f1050SThomas Veerman    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
285*0a6a1f1dSLionel Sambuc      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
286357f1050SThomas Veerman        gt_source="external libintl"
287357f1050SThomas Veerman      else
288357f1050SThomas Veerman        gt_source="libc"
289357f1050SThomas Veerman      fi
290357f1050SThomas Veerman    else
291357f1050SThomas Veerman      gt_source="included intl directory"
292357f1050SThomas Veerman    fi
293357f1050SThomas Veerman    AC_MSG_RESULT([$gt_source])
294357f1050SThomas Veerman  fi
295357f1050SThomas Veerman
296357f1050SThomas Veerman  if test "$USE_NLS" = "yes"; then
297357f1050SThomas Veerman
298357f1050SThomas Veerman    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
299*0a6a1f1dSLionel Sambuc      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
300357f1050SThomas Veerman        AC_MSG_CHECKING([how to link with libintl])
301357f1050SThomas Veerman        AC_MSG_RESULT([$LIBINTL])
302357f1050SThomas Veerman        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
303357f1050SThomas Veerman      fi
304357f1050SThomas Veerman
305357f1050SThomas Veerman      dnl For backward compatibility. Some packages may be using this.
306*0a6a1f1dSLionel Sambuc      AC_DEFINE([HAVE_GETTEXT], [1],
307357f1050SThomas Veerman       [Define if the GNU gettext() function is already present or preinstalled.])
308*0a6a1f1dSLionel Sambuc      AC_DEFINE([HAVE_DCGETTEXT], [1],
309357f1050SThomas Veerman       [Define if the GNU dcgettext() function is already present or preinstalled.])
310357f1050SThomas Veerman    fi
311357f1050SThomas Veerman
312357f1050SThomas Veerman    dnl We need to process the po/ directory.
313357f1050SThomas Veerman    POSUB=po
314357f1050SThomas Veerman  fi
315357f1050SThomas Veerman
316357f1050SThomas Veerman  ifelse(gt_included_intl, yes, [
317357f1050SThomas Veerman    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
318357f1050SThomas Veerman    dnl to 'yes' because some of the testsuite requires it.
319357f1050SThomas Veerman    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
320357f1050SThomas Veerman      BUILD_INCLUDED_LIBINTL=yes
321357f1050SThomas Veerman    fi
322357f1050SThomas Veerman
323357f1050SThomas Veerman    dnl Make all variables we use known to autoconf.
324*0a6a1f1dSLionel Sambuc    AC_SUBST([BUILD_INCLUDED_LIBINTL])
325*0a6a1f1dSLionel Sambuc    AC_SUBST([USE_INCLUDED_LIBINTL])
326*0a6a1f1dSLionel Sambuc    AC_SUBST([CATOBJEXT])
327357f1050SThomas Veerman
328357f1050SThomas Veerman    dnl For backward compatibility. Some configure.ins may be using this.
329357f1050SThomas Veerman    nls_cv_header_intl=
330357f1050SThomas Veerman    nls_cv_header_libgt=
331357f1050SThomas Veerman
332357f1050SThomas Veerman    dnl For backward compatibility. Some Makefiles may be using this.
333357f1050SThomas Veerman    DATADIRNAME=share
334*0a6a1f1dSLionel Sambuc    AC_SUBST([DATADIRNAME])
335357f1050SThomas Veerman
336357f1050SThomas Veerman    dnl For backward compatibility. Some Makefiles may be using this.
337357f1050SThomas Veerman    INSTOBJEXT=.mo
338*0a6a1f1dSLionel Sambuc    AC_SUBST([INSTOBJEXT])
339357f1050SThomas Veerman
340357f1050SThomas Veerman    dnl For backward compatibility. Some Makefiles may be using this.
341357f1050SThomas Veerman    GENCAT=gencat
342*0a6a1f1dSLionel Sambuc    AC_SUBST([GENCAT])
343357f1050SThomas Veerman
344357f1050SThomas Veerman    dnl For backward compatibility. Some Makefiles may be using this.
345*0a6a1f1dSLionel Sambuc    INTLOBJS=
346357f1050SThomas Veerman    if test "$USE_INCLUDED_LIBINTL" = yes; then
347357f1050SThomas Veerman      INTLOBJS="\$(GETTOBJS)"
348357f1050SThomas Veerman    fi
349*0a6a1f1dSLionel Sambuc    AC_SUBST([INTLOBJS])
350357f1050SThomas Veerman
351357f1050SThomas Veerman    dnl Enable libtool support if the surrounding package wishes it.
352357f1050SThomas Veerman    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
353*0a6a1f1dSLionel Sambuc    AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX])
354357f1050SThomas Veerman  ])
355357f1050SThomas Veerman
356357f1050SThomas Veerman  dnl For backward compatibility. Some Makefiles may be using this.
357357f1050SThomas Veerman  INTLLIBS="$LIBINTL"
358*0a6a1f1dSLionel Sambuc  AC_SUBST([INTLLIBS])
359357f1050SThomas Veerman
360357f1050SThomas Veerman  dnl Make all documented variables known to autoconf.
361*0a6a1f1dSLionel Sambuc  AC_SUBST([LIBINTL])
362*0a6a1f1dSLionel Sambuc  AC_SUBST([LTLIBINTL])
363*0a6a1f1dSLionel Sambuc  AC_SUBST([POSUB])
364357f1050SThomas Veerman])
365357f1050SThomas Veerman
366357f1050SThomas Veerman
367*0a6a1f1dSLionel Sambucdnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
368*0a6a1f1dSLionel Sambucm4_define([gt_NEEDS_INIT],
369357f1050SThomas Veerman[
370*0a6a1f1dSLionel Sambuc  m4_divert_text([DEFAULTS], [gt_needs=])
371*0a6a1f1dSLionel Sambuc  m4_define([gt_NEEDS_INIT], [])
372*0a6a1f1dSLionel Sambuc])
373357f1050SThomas Veerman
374357f1050SThomas Veerman
375*0a6a1f1dSLionel Sambucdnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
376*0a6a1f1dSLionel SambucAC_DEFUN([AM_GNU_GETTEXT_NEED],
377*0a6a1f1dSLionel Sambuc[
378*0a6a1f1dSLionel Sambuc  m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
379357f1050SThomas Veerman])
380357f1050SThomas Veerman
381357f1050SThomas Veerman
382357f1050SThomas Veermandnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
383357f1050SThomas VeermanAC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
384