1
# gettext.m4 serial 71 (gettext-0.20.2)
2
dnl Copyright (C) 1995-2014, 2016, 2018-2020 Free Software Foundation, Inc.
1
# gettext.m4 serial 63 (gettext-0.18)
2
dnl Copyright (C) 1995-2010 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
7
dnl This file can be used in projects which are not available under
8
dnl the GNU General Public License or the GNU Lesser General Public
7
dnl This file can can be used in projects which are not available under
8
dnl the GNU General Public License or the GNU Library General Public
9
9
dnl License but which still want to provide support for the GNU gettext
11
11
dnl Please note that the actual code of the GNU gettext library is covered
12
dnl by the GNU Lesser General Public License, and the rest of the GNU
13
dnl gettext package is covered by the GNU General Public License.
12
dnl by the GNU Library General Public License, and the rest of the GNU
13
dnl gettext package package is covered by the GNU General Public License.
14
14
dnl They are *not* in the public domain.
20
20
dnl Macro to add for using GNU gettext.
22
22
dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
23
dnl INTLSYMBOL must be one of 'external', 'use-libtool'.
24
dnl INTLSYMBOL should be 'external' for packages other than GNU gettext, and
25
dnl 'use-libtool' for the packages 'gettext-runtime' and 'gettext-tools'.
23
dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
24
dnl default (if it is not specified or empty) is 'no-libtool'.
25
dnl INTLSYMBOL should be 'external' for packages with no intl directory,
26
dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
26
27
dnl If INTLSYMBOL is 'use-libtool', then a libtool library
27
28
dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
28
29
dnl depending on --{enable,disable}-{shared,static} and on the presence of
29
dnl AM-DISABLE-SHARED).
30
dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
31
dnl $(top_builddir)/intl/libintl.a will be created.
30
32
dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
31
33
dnl implementations (in libc or libintl) without the ngettext() function
32
34
dnl will be ignored. If NEEDSYMBOL is specified and is
33
35
dnl 'need-formatstring-macros', then GNU gettext implementations that don't
34
36
dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
35
37
dnl INTLDIR is used to find the intl libraries. If empty,
36
dnl the value '$(top_builddir)/intl/' is used.
38
dnl the value `$(top_builddir)/intl/' is used.
38
40
dnl The result of the configuration is one of three cases:
39
41
dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
55
57
AC_DEFUN([AM_GNU_GETTEXT],
57
59
dnl Argument checking.
58
ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [use-libtool], ,
60
ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
59
61
[errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
61
63
ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
62
[errprint([ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported.
64
[AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])])
64
65
ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
65
66
[errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
67
68
define([gt_included_intl],
68
ifelse([$1], [external], [no], [yes]))
69
ifelse([$1], [external],
70
ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]),
72
define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
70
74
AM_GNU_GETTEXT_NEED([$2])
87
91
dnl again, outside any 'if'. There are two solutions:
88
92
dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
89
93
dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
90
dnl Since AC_PROVIDE_IFELSE is not documented, we avoid it.
94
dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
95
dnl documented, we avoid it.
91
96
ifelse(gt_included_intl, yes, , [
92
97
AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
95
dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation.
100
dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
154
159
AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
159
#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
160
[AC_TRY_LINK([#include <libintl.h>
161
$gt_revision_test_code
160
162
extern int _nl_msg_cat_cntr;
161
extern int *_nl_domain_bindings;
162
#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings)
164
#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
166
$gt_revision_test_code
169
bindtextdomain ("", "");
170
return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
163
extern int *_nl_domain_bindings;],
164
[bindtextdomain ("", "");
165
return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings],
172
166
[eval "$gt_func_gnugettext_libc=yes"],
173
167
[eval "$gt_func_gnugettext_libc=no"])])
189
183
gt_save_LIBS="$LIBS"
190
184
LIBS="$LIBS $LIBINTL"
191
185
dnl Now see whether libintl exists and does not depend on libiconv.
196
#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
186
AC_TRY_LINK([#include <libintl.h>
187
$gt_revision_test_code
197
188
extern int _nl_msg_cat_cntr;
199
190
#ifdef __cplusplus
202
const char *_nl_expand_alias (const char *);
203
#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
205
#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
207
$gt_revision_test_code
210
bindtextdomain ("", "");
211
return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
193
const char *_nl_expand_alias (const char *);],
194
[bindtextdomain ("", "");
195
return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
213
196
[eval "$gt_func_gnugettext_libintl=yes"],
214
197
[eval "$gt_func_gnugettext_libintl=no"])
215
198
dnl Now see whether libintl exists and depends on libiconv.
216
199
if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
217
200
LIBS="$LIBS $LIBICONV"
222
#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
201
AC_TRY_LINK([#include <libintl.h>
202
$gt_revision_test_code
223
203
extern int _nl_msg_cat_cntr;
225
205
#ifdef __cplusplus
228
const char *_nl_expand_alias (const char *);
229
#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
231
#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
233
$gt_revision_test_code
236
bindtextdomain ("", "");
237
return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
239
[LIBINTL="$LIBINTL $LIBICONV"
240
LTLIBINTL="$LTLIBINTL $LTLIBICONV"
241
eval "$gt_func_gnugettext_libintl=yes"
208
const char *_nl_expand_alias (const char *);],
209
[bindtextdomain ("", "");
210
return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
211
[LIBINTL="$LIBINTL $LIBICONV"
212
LTLIBINTL="$LTLIBINTL $LTLIBICONV"
213
eval "$gt_func_gnugettext_libintl=yes"
244
216
CPPFLAGS="$gt_save_CPPFLAGS"
245
217
LIBS="$gt_save_LIBS"])
273
245
dnl Mark actions used to generate GNU NLS library.
274
246
BUILD_INCLUDED_LIBINTL=yes
275
247
USE_INCLUDED_LIBINTL=yes
276
LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD"
277
LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD"
248
LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD"
249
LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD"
278
250
LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
344
316
ifelse(gt_included_intl, yes, [
345
dnl In GNU gettext we have to set BUILD_INCLUDED_LIBINTL to 'yes'
346
dnl because some of the testsuite requires it.
347
BUILD_INCLUDED_LIBINTL=yes
317
dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
318
dnl to 'yes' because some of the testsuite requires it.
319
if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
320
BUILD_INCLUDED_LIBINTL=yes
349
323
dnl Make all variables we use known to autoconf.
350
324
AC_SUBST([BUILD_INCLUDED_LIBINTL])
351
325
AC_SUBST([USE_INCLUDED_LIBINTL])
352
326
AC_SUBST([CATOBJEXT])
328
dnl For backward compatibility. Some configure.ins may be using this.
332
dnl For backward compatibility. Some Makefiles may be using this.
334
AC_SUBST([DATADIRNAME])
336
dnl For backward compatibility. Some Makefiles may be using this.
338
AC_SUBST([INSTOBJEXT])
340
dnl For backward compatibility. Some Makefiles may be using this.
344
dnl For backward compatibility. Some Makefiles may be using this.
346
if test "$USE_INCLUDED_LIBINTL" = yes; then
347
INTLOBJS="\$(GETTOBJS)"
351
dnl Enable libtool support if the surrounding package wishes it.
352
INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
353
AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX])
355
356
dnl For backward compatibility. Some Makefiles may be using this.
381
382
dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
382
383
AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
385
dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version])
386
AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], [])