2
# Macro to add for using GNU gettext.
3
# Ulrich Drepper <drepper@cygnus.com>, 1995.
5
# Modified to never use included libintl.
6
# Owen Taylor <otaylor@redhat.com>, 12/15/1998
9
# This file can be copied and used freely without restrictions. It can
10
# be used in projects which are not available under the GNU Public License
11
# but which still want to provide support for the GNU gettext functionality.
12
# Please note that the actual code is *not* freely available.
16
AC_DEFUN(AM_GCONF_WITH_NLS,
17
[AC_MSG_CHECKING([whether NLS is requested])
18
dnl Default is enabled NLS
20
[ --disable-nls do not use Native Language Support],
21
USE_NLS=$enableval, USE_NLS=yes)
22
AC_MSG_RESULT($USE_NLS)
25
BUILD_INCLUDED_LIBINTL=no
26
USE_INCLUDED_LIBINTL=no
28
dnl If we use NLS figure out what method
29
if test "$USE_NLS" = "yes"; then
30
# AC_DEFINE(ENABLE_NLS)
31
# AC_MSG_CHECKING([whether included gettext is requested])
32
# AC_ARG_WITH(included-gettext,
33
# [ --with-included-gettext use the GNU gettext library included here],
34
# nls_cv_force_use_gnu_gettext=$withval,
35
# nls_cv_force_use_gnu_gettext=no)
36
# AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
37
nls_cv_force_use_gnu_gettext="no"
39
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
40
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
41
dnl User does not insist on using GNU NLS library. Figure out what
42
dnl to use. If gettext or catgets are available (in this order) we
43
dnl use this. Else we have to fall back to GNU NLS library.
44
dnl catgets is only used if permitted by option --with-catgets.
49
AC_CHECK_HEADER(libintl.h,
50
[AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
51
[AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")],
52
gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)])
54
if test "$gt_cv_func_dgettext_libc" != "yes"; then
55
AC_CHECK_LIB(intl, bindtextdomain,
56
[AC_CACHE_CHECK([for dgettext in libintl],
57
gt_cv_func_dgettext_libintl,
58
[AC_CHECK_LIB(intl, dgettext,
59
gt_cv_func_dgettext_libintl=yes,
60
gt_cv_func_dgettext_libintl=no)],
61
gt_cv_func_dgettext_libintl=no)])
64
if test "$gt_cv_func_dgettext_libintl" = "yes"; then
68
if test "$gt_cv_func_dgettext_libc" = "yes" \
69
|| test "$gt_cv_func_dgettext_libintl" = "yes"; then
70
AC_DEFINE(HAVE_GETTEXT)
71
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
72
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
73
if test "$MSGFMT" != "no"; then
74
AC_CHECK_FUNCS(dcgettext)
75
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
76
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
77
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
78
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
79
return _nl_msg_cat_cntr],
88
# Added by Martin Baulig 12/15/98 for libc5 systems
89
if test "$gt_cv_func_dgettext_libc" != "yes" \
90
&& test "$gt_cv_func_dgettext_libintl" = "yes"; then
92
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
96
if test "$CATOBJEXT" = "NONE"; then
97
AC_MSG_CHECKING([whether catgets can be used])
99
[ --with-catgets use catgets functions if available],
100
nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
101
AC_MSG_RESULT($nls_cv_use_catgets)
103
if test "$nls_cv_use_catgets" = "yes"; then
104
dnl No gettext in C library. Try catgets next.
105
AC_CHECK_LIB(i, main)
106
AC_CHECK_FUNC(catgets,
107
[AC_DEFINE(HAVE_CATGETS)
108
INTLOBJS="\$(CATOBJS)"
109
AC_PATH_PROG(GENCAT, gencat, no)dnl
110
# if test "$GENCAT" != "no"; then
111
# AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
112
# if test "$GMSGFMT" = "no"; then
113
# AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
114
# [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
116
# AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
117
# [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
118
# USE_INCLUDED_LIBINTL=yes
122
# INTLDEPS='$(top_builddir)/intl/libintl.a'
124
# LIBS=`echo $LIBS | sed -e 's/-lintl//'`
125
# nls_cv_header_intl=intl/libintl.h
126
# nls_cv_header_libgt=intl/libgettext.h
132
if test "$CATOBJEXT" = "NONE"; then
133
dnl Neither gettext nor catgets in included in the C library.
134
dnl Fall back on GNU gettext library.
135
nls_cv_use_gnu_gettext=yes
139
if test "$nls_cv_use_gnu_gettext" != "yes"; then
140
AC_DEFINE(ENABLE_NLS)
142
# Unset this variable since we use the non-zero value as a flag.
144
# dnl Mark actions used to generate GNU NLS library.
145
# INTLOBJS="\$(GETTOBJS)"
146
# AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
147
# [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
148
# AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
149
# AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
150
# [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
152
# USE_INCLUDED_LIBINTL=yes
156
# INTLDEPS='$(top_builddir)/intl/libintl.a'
158
# LIBS=`echo $LIBS | sed -e 's/-lintl//'`
159
# nls_cv_header_intl=intl/libintl.h
160
# nls_cv_header_libgt=intl/libgettext.h
163
dnl Test whether we really found GNU xgettext.
164
if test "$XGETTEXT" != ":"; then
165
dnl If it is no GNU xgettext we define it as : so that the
166
dnl Makefiles still can work.
167
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
171
[found xgettext program is not GNU xgettext; ignore it])
176
# We need to process the po/ directory.
180
nls_cv_header_intl=intl/libintl.h
181
nls_cv_header_libgt=intl/libgettext.h
183
AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
185
[case "$CONFIG_FILES" in *po/Makefile.in*)
186
sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
190
# # If this is used in GNU gettext we have to set USE_NLS to `yes'
191
# # because some of the sources are only built for this goal.
192
# if test "$PACKAGE" = gettext; then
194
# USE_INCLUDED_LIBINTL=yes
197
dnl These rules are solely for the distribution goal. While doing this
198
dnl we only have to keep exactly one list of the available catalogs
200
for lang in $ALL_LINGUAS; do
201
GMOFILES="$GMOFILES $lang.gmo"
202
POFILES="$POFILES $lang.po"
205
dnl Make all variables we use known to autoconf.
206
AC_SUBST(BUILD_INCLUDED_LIBINTL)
207
AC_SUBST(USE_INCLUDED_LIBINTL)
210
AC_SUBST(DATADIRNAME)
220
AC_DEFUN(AM_GCONF_GNU_GETTEXT,
221
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
222
AC_REQUIRE([AC_PROG_CC])dnl
223
AC_REQUIRE([AC_PROG_RANLIB])dnl
224
AC_REQUIRE([AC_ISC_POSIX])dnl
225
AC_REQUIRE([AC_HEADER_STDC])dnl
226
AC_REQUIRE([AC_C_CONST])dnl
227
AC_REQUIRE([AC_C_INLINE])dnl
228
AC_REQUIRE([AC_TYPE_OFF_T])dnl
229
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
230
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
231
AC_REQUIRE([AC_FUNC_MMAP])dnl
233
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
234
unistd.h sys/param.h])
235
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
236
strdup __argz_count __argz_stringify __argz_next])
238
if test "${ac_cv_func_stpcpy+set}" != "set"; then
239
AC_CHECK_FUNCS(stpcpy)
241
if test "${ac_cv_func_stpcpy}" = "yes"; then
242
AC_DEFINE(HAVE_STPCPY)
248
if test "x$CATOBJEXT" != "x"; then
249
if test "x$ALL_LINGUAS" = "x"; then
252
AC_MSG_CHECKING(for catalogs to be installed)
254
for lang in ${LINGUAS=$ALL_LINGUAS}; do
255
case "$ALL_LINGUAS" in
256
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
260
AC_MSG_RESULT($LINGUAS)
263
dnl Construct list of names of catalog files to be constructed.
264
if test -n "$LINGUAS"; then
265
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
269
dnl The reference to <locale.h> in the installed <libintl.h> file
270
dnl must be resolved because we cannot expect the users of this
271
dnl to define HAVE_LOCALE_H.
272
if test $ac_cv_header_locale_h = yes; then
273
INCLUDE_LOCALE_H="#include <locale.h>"
276
/* The system does not provide the header <locale.h>. Take care yourself. */"
278
AC_SUBST(INCLUDE_LOCALE_H)
280
dnl Determine which catalog format we have (if any is needed)
281
dnl For now we know about two different formats:
282
dnl Linux libc-5 and the normal X/Open format
283
test -d intl || mkdir intl
284
if test "$CATOBJEXT" = ".cat"; then
285
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
287
dnl Transform the SED scripts while copying because some dumb SEDs
288
dnl cannot handle comments.
289
sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
291
dnl po2tbl.sed is always needed.
292
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
293
$srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
295
dnl In the intl/Makefile.in we have a special dependency which makes
296
dnl only sense for gettext. We comment this out for non-gettext
298
if test "$PACKAGE" = "gettext"; then
308
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
309
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
310
dnl Try to locate is.
312
if test -n "$ac_aux_dir"; then
313
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
315
if test -z "$MKINSTALLDIRS"; then
316
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
318
AC_SUBST(MKINSTALLDIRS)
320
dnl *** For now the libtool support in intl/Makefile is not for real.
324
dnl Generate list of files to be processed by xgettext which will
325
dnl be included in po/Makefile.
326
test -d po || mkdir po
327
if test "x$srcdir" != "x."; then
328
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
329
posrcprefix="$srcdir/"
331
posrcprefix="../$srcdir/"
337
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
338
< $srcdir/po/POTFILES.in > po/POTFILES