19
19
If you have problems, you may need to regenerate the build system entirely.
20
20
To do so, use the procedure documented by the package, typically `autoreconf'.])])
22
# Copyright (C) 1995-2002 Free Software Foundation, Inc.
23
# Copyright (C) 2001-2003,2004 Red Hat, Inc.
25
# This file is free software, distributed under the terms of the GNU
26
# General Public License. As a special exception to the GNU General
27
# Public License, this file may be distributed as part of a program
28
# that contains a configuration script generated by Autoconf, under
29
# the same distribution terms as the rest of that program.
31
# This file can be copied and used freely without restrictions. It can
32
# be used in projects which are not available under the GNU Public License
33
# but which still want to provide support for the GNU gettext functionality.
35
# Macro to add for using GNU gettext.
36
# Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
38
# Modified to never use included libintl.
39
# Owen Taylor <otaylor@redhat.com>, 12/15/1998
41
# Major rework to remove unused code
42
# Owen Taylor <otaylor@redhat.com>, 12/11/2002
44
# Added better handling of ALL_LINGUAS from GNU gettext version
45
# written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
47
# Modified to require ngettext
48
# Matthias Clasen <mclasen@redhat.com> 08/06/2004
50
# We need this here as well, since someone might use autoconf-2.5x
51
# to configure GLib then an older version to configure a package
52
# using AM_GLIB_GNU_GETTEXT
56
dnl We go to great lengths to make sure that aclocal won't
57
dnl try to pull in the installed version of these macros
58
dnl when running aclocal in the glib directory.
60
m4_copy([AC_DEFUN],[glib_DEFUN])
61
m4_copy([AC_REQUIRE],[glib_REQUIRE])
63
dnl At the end, if we're not within glib, we'll define the public
64
dnl definitions in terms of our private definitions.
69
glib_DEFUN([GLIB_LC_MESSAGES],
70
[AC_CHECK_HEADERS([locale.h])
71
if test $ac_cv_header_locale_h = yes; then
72
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
73
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
74
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
75
if test $am_cv_val_LC_MESSAGES = yes; then
76
AC_DEFINE(HAVE_LC_MESSAGES, 1,
77
[Define if your <locale.h> file defines LC_MESSAGES.])
81
# GLIB_PATH_PROG_WITH_TEST
82
#----------------------------
83
dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
84
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
85
glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
86
[# Extract the first word of "$2", so it can be a program name with args.
87
set dummy $2; ac_word=[$]2
88
AC_MSG_CHECKING([for $ac_word])
89
AC_CACHE_VAL(ac_cv_path_$1,
92
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
95
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
96
for ac_dir in ifelse([$5], , $PATH, [$5]); do
97
test -z "$ac_dir" && ac_dir=.
98
if test -f $ac_dir/$ac_word; then
100
ac_cv_path_$1="$ac_dir/$ac_word"
106
dnl If no 4th arg is given, leave the cache variable unset,
107
dnl so AC_PATH_PROGS will keep looking.
108
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
113
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
123
glib_DEFUN([GLIB_WITH_NLS],
124
dnl NLS is obligatory
128
gt_cv_have_gettext=no
134
AC_CHECK_HEADER(libintl.h,
135
[gt_cv_func_dgettext_libintl="no"
136
libintl_extra_libs=""
139
# First check in libc
141
AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc,
145
[return !ngettext ("","", 1)],
146
gt_cv_func_ngettext_libc=yes,
147
gt_cv_func_ngettext_libc=no)
150
if test "$gt_cv_func_ngettext_libc" = "yes" ; then
151
AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
155
[return !dgettext ("","")],
156
gt_cv_func_dgettext_libc=yes,
157
gt_cv_func_dgettext_libc=no)
161
if test "$gt_cv_func_ngettext_libc" = "yes" ; then
162
AC_CHECK_FUNCS(bind_textdomain_codeset)
166
# If we don't have everything we want, check in libintl
168
if test "$gt_cv_func_dgettext_libc" != "yes" \
169
|| test "$gt_cv_func_ngettext_libc" != "yes" \
170
|| test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
172
AC_CHECK_LIB(intl, bindtextdomain,
173
[AC_CHECK_LIB(intl, ngettext,
174
[AC_CHECK_LIB(intl, dgettext,
175
gt_cv_func_dgettext_libintl=yes)])])
177
if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
178
AC_MSG_CHECKING([if -liconv is needed to use gettext])
180
AC_CHECK_LIB(intl, ngettext,
181
[AC_CHECK_LIB(intl, dcgettext,
182
[gt_cv_func_dgettext_libintl=yes
183
libintl_extra_libs=-liconv],
189
# If we found libintl, then check in it for bind_textdomain_codeset();
190
# we'll prefer libc if neither have bind_textdomain_codeset(),
191
# and both have dgettext and ngettext
193
if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
194
glib_save_LIBS="$LIBS"
195
LIBS="$LIBS -lintl $libintl_extra_libs"
196
unset ac_cv_func_bind_textdomain_codeset
197
AC_CHECK_FUNCS(bind_textdomain_codeset)
198
LIBS="$glib_save_LIBS"
200
if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
201
gt_cv_func_dgettext_libc=no
203
if test "$gt_cv_func_dgettext_libc" = "yes" \
204
&& test "$gt_cv_func_ngettext_libc" = "yes"; then
205
gt_cv_func_dgettext_libintl=no
211
if test "$gt_cv_func_dgettext_libc" = "yes" \
212
|| test "$gt_cv_func_dgettext_libintl" = "yes"; then
213
gt_cv_have_gettext=yes
216
if test "$gt_cv_func_dgettext_libintl" = "yes"; then
217
INTLLIBS="-lintl $libintl_extra_libs"
220
if test "$gt_cv_have_gettext" = "yes"; then
221
AC_DEFINE(HAVE_GETTEXT,1,
222
[Define if the GNU gettext() function is already present or preinstalled.])
223
GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
224
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
225
if test "$MSGFMT" != "no"; then
226
glib_save_LIBS="$LIBS"
227
LIBS="$LIBS $INTLLIBS"
228
AC_CHECK_FUNCS(dcgettext)
230
AC_MSG_CHECKING([if msgfmt accepts -c])
231
GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[
234
"Content-Type: text/plain; charset=UTF-8\n"
235
"Project-Id-Version: test 1.0\n"
236
"PO-Revision-Date: 2007-02-15 12:01+0100\n"
237
"Last-Translator: test <foo@bar.xx>\n"
238
"Language-Team: C <LL@li.org>\n"
239
"MIME-Version: 1.0\n"
240
"Content-Transfer-Encoding: 8bit\n"
241
], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
242
AC_SUBST(MSGFMT_OPTS)
243
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
244
GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
245
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
246
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
247
return _nl_msg_cat_cntr],
252
dnl On Solaris, if bind_textdomain_codeset is in libc,
253
dnl GNU format message catalog is always supported,
254
dnl since both are added to the libc all together.
255
dnl Hence, we'd like to go with DATADIRNAME=share and
256
dnl and CATOBJEXT=.gmo in this case.
257
AC_CHECK_FUNC(bind_textdomain_codeset,
268
LIBS="$glib_save_LIBS"
271
gt_cv_have_gettext=no
276
if test "$gt_cv_have_gettext" = "yes" ; then
277
AC_DEFINE(ENABLE_NLS, 1,
278
[always defined to indicate that i18n is enabled])
281
dnl Test whether we really found GNU xgettext.
282
if test "$XGETTEXT" != ":"; then
283
dnl If it is not GNU xgettext we define it as : so that the
284
dnl Makefiles still can work.
285
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
289
[found xgettext program is not GNU xgettext; ignore it])
294
# We need to process the po/ directory.
298
[case "$CONFIG_FILES" in *po/Makefile.in*)
299
sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
302
dnl These rules are solely for the distribution goal. While doing this
303
dnl we only have to keep exactly one list of the available catalogs
305
for lang in $ALL_LINGUAS; do
306
GMOFILES="$GMOFILES $lang.gmo"
307
POFILES="$POFILES $lang.po"
310
dnl Make all variables we use known to autoconf.
313
AC_SUBST(DATADIRNAME)
317
AC_SUBST(PO_IN_DATADIR_TRUE)
318
AC_SUBST(PO_IN_DATADIR_FALSE)
323
# AM_GLIB_GNU_GETTEXT
324
# -------------------
325
# Do checks necessary for use of gettext. If a suitable implementation
326
# of gettext is found in either in libintl or in the C library,
327
# it will set INTLLIBS to the libraries needed for use of gettext
328
# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
329
# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
330
# on various variables needed by the Makefile.in.in installed by
333
glib_DEFUN([GLIB_GNU_GETTEXT],
334
[AC_REQUIRE([AC_PROG_CC])dnl
335
AC_REQUIRE([AC_HEADER_STDC])dnl
340
if test "$gt_cv_have_gettext" = "yes"; then
341
if test "x$ALL_LINGUAS" = "x"; then
344
AC_MSG_CHECKING(for catalogs to be installed)
346
for presentlang in $ALL_LINGUAS; do
348
if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
349
desiredlanguages="$LINGUAS"
351
desiredlanguages="$ALL_LINGUAS"
353
for desiredlang in $desiredlanguages; do
354
# Use the presentlang catalog if desiredlang is
355
# a. equal to presentlang, or
356
# b. a variant of presentlang (because in this case,
357
# presentlang can be used as a fallback for messages
358
# which are not translated in the desiredlang catalog).
359
case "$desiredlang" in
360
"$presentlang"*) useit=yes;;
363
if test $useit = yes; then
364
NEW_LINGUAS="$NEW_LINGUAS $presentlang"
368
AC_MSG_RESULT($LINGUAS)
371
dnl Construct list of names of catalog files to be constructed.
372
if test -n "$LINGUAS"; then
373
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
377
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
378
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
379
dnl Try to locate is.
381
if test -n "$ac_aux_dir"; then
382
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
384
if test -z "$MKINSTALLDIRS"; then
385
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
387
AC_SUBST(MKINSTALLDIRS)
389
dnl Generate list of files to be processed by xgettext which will
390
dnl be included in po/Makefile.
391
test -d po || mkdir po
392
if test "x$srcdir" != "x."; then
393
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
394
posrcprefix="$srcdir/"
396
posrcprefix="../$srcdir/"
402
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
403
< $srcdir/po/POTFILES.in > po/POTFILES
406
# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
407
# -------------------------------
408
# Define VARIABLE to the location where catalog files will
409
# be installed by po/Makefile.
410
glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
411
[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
412
glib_save_prefix="$prefix"
413
glib_save_exec_prefix="$exec_prefix"
414
glib_save_datarootdir="$datarootdir"
415
test "x$prefix" = xNONE && prefix=$ac_default_prefix
416
test "x$exec_prefix" = xNONE && exec_prefix=$prefix
417
datarootdir=`eval echo "${datarootdir}"`
418
if test "x$CATOBJEXT" = "x.mo" ; then
419
localedir=`eval echo "${libdir}/locale"`
421
localedir=`eval echo "${datadir}/locale"`
423
prefix="$glib_save_prefix"
424
exec_prefix="$glib_save_exec_prefix"
425
datarootdir="$glib_save_datarootdir"
426
AC_DEFINE_UNQUOTED($1, "$localedir",
427
[Define the location where the catalogs will be installed])
431
dnl Now the definitions that aclocal will find
433
ifdef(glib_configure_ac,[],[
434
AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
435
AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])
438
# GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL])
440
# Create a temporary file with TEST-FILE as its contents and pass the
441
# file name to PROGRAM. Perform ACTION-IF-PASS if PROGRAM exits with
442
# 0 and perform ACTION-IF-FAIL for any other exit status.
443
AC_DEFUN([GLIB_RUN_PROG],
444
[cat >conftest.foo <<_ACEOF
447
if AC_RUN_LOG([$1 conftest.foo]); then
448
m4_ifval([$3], [$3], [:])
449
m4_ifvaln([$4], [else $4])dnl
450
echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD
451
sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD
455
# nls.m4 serial 5 (gettext-0.18)
456
dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation,
458
dnl This file is free software; the Free Software Foundation
459
dnl gives unlimited permission to copy and/or distribute it,
460
dnl with or without modifications, as long as this notice is preserved.
462
dnl This file can can be used in projects which are not available under
463
dnl the GNU General Public License or the GNU Library General Public
464
dnl License but which still want to provide support for the GNU gettext
466
dnl Please note that the actual code of the GNU gettext library is covered
467
dnl by the GNU Library General Public License, and the rest of the GNU
468
dnl gettext package package is covered by the GNU General Public License.
469
dnl They are *not* in the public domain.
472
dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
473
dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
479
AC_MSG_CHECKING([whether NLS is requested])
480
dnl Default is enabled NLS
482
[ --disable-nls do not use Native Language Support],
483
USE_NLS=$enableval, USE_NLS=yes)
484
AC_MSG_RESULT([$USE_NLS])
22
488
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
23
489
# serial 1 (pkg-config-0.24)