20
20
If you have problems, you may need to regenerate the build system entirely.
21
21
To do so, use the procedure documented by the package, typically `autoreconf'.])])
23
# Copyright (C) 1995-2002 Free Software Foundation, Inc.
24
# Copyright (C) 2001-2003,2004 Red Hat, Inc.
26
# This file is free software, distributed under the terms of the GNU
27
# General Public License. As a special exception to the GNU General
28
# Public License, this file may be distributed as part of a program
29
# that contains a configuration script generated by Autoconf, under
30
# the same distribution terms as the rest of that program.
32
# This file can be copied and used freely without restrictions. It can
33
# be used in projects which are not available under the GNU Public License
34
# but which still want to provide support for the GNU gettext functionality.
36
# Macro to add for using GNU gettext.
37
# Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
39
# Modified to never use included libintl.
40
# Owen Taylor <otaylor@redhat.com>, 12/15/1998
42
# Major rework to remove unused code
43
# Owen Taylor <otaylor@redhat.com>, 12/11/2002
45
# Added better handling of ALL_LINGUAS from GNU gettext version
46
# written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
48
# Modified to require ngettext
49
# Matthias Clasen <mclasen@redhat.com> 08/06/2004
51
# We need this here as well, since someone might use autoconf-2.5x
52
# to configure GLib then an older version to configure a package
53
# using AM_GLIB_GNU_GETTEXT
57
dnl We go to great lengths to make sure that aclocal won't
58
dnl try to pull in the installed version of these macros
59
dnl when running aclocal in the glib directory.
61
m4_copy([AC_DEFUN],[glib_DEFUN])
62
m4_copy([AC_REQUIRE],[glib_REQUIRE])
64
dnl At the end, if we're not within glib, we'll define the public
65
dnl definitions in terms of our private definitions.
70
glib_DEFUN([GLIB_LC_MESSAGES],
71
[AC_CHECK_HEADERS([locale.h])
72
if test $ac_cv_header_locale_h = yes; then
73
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
74
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
75
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
76
if test $am_cv_val_LC_MESSAGES = yes; then
77
AC_DEFINE(HAVE_LC_MESSAGES, 1,
78
[Define if your <locale.h> file defines LC_MESSAGES.])
82
# GLIB_PATH_PROG_WITH_TEST
83
#----------------------------
84
dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
85
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
86
glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
87
[# Extract the first word of "$2", so it can be a program name with args.
88
set dummy $2; ac_word=[$]2
89
AC_MSG_CHECKING([for $ac_word])
90
AC_CACHE_VAL(ac_cv_path_$1,
93
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
96
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
97
for ac_dir in ifelse([$5], , $PATH, [$5]); do
98
test -z "$ac_dir" && ac_dir=.
99
if test -f $ac_dir/$ac_word; then
101
ac_cv_path_$1="$ac_dir/$ac_word"
107
dnl If no 4th arg is given, leave the cache variable unset,
108
dnl so AC_PATH_PROGS will keep looking.
109
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
114
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
124
glib_DEFUN([GLIB_WITH_NLS],
125
dnl NLS is obligatory
129
gt_cv_have_gettext=no
135
AC_CHECK_HEADER(libintl.h,
136
[gt_cv_func_dgettext_libintl="no"
137
libintl_extra_libs=""
140
# First check in libc
142
AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc,
146
[return !ngettext ("","", 1)],
147
gt_cv_func_ngettext_libc=yes,
148
gt_cv_func_ngettext_libc=no)
151
if test "$gt_cv_func_ngettext_libc" = "yes" ; then
152
AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
156
[return !dgettext ("","")],
157
gt_cv_func_dgettext_libc=yes,
158
gt_cv_func_dgettext_libc=no)
162
if test "$gt_cv_func_ngettext_libc" = "yes" ; then
163
AC_CHECK_FUNCS(bind_textdomain_codeset)
167
# If we don't have everything we want, check in libintl
169
if test "$gt_cv_func_dgettext_libc" != "yes" \
170
|| test "$gt_cv_func_ngettext_libc" != "yes" \
171
|| test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
173
AC_CHECK_LIB(intl, bindtextdomain,
174
[AC_CHECK_LIB(intl, ngettext,
175
[AC_CHECK_LIB(intl, dgettext,
176
gt_cv_func_dgettext_libintl=yes)])])
178
if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
179
AC_MSG_CHECKING([if -liconv is needed to use gettext])
181
AC_CHECK_LIB(intl, ngettext,
182
[AC_CHECK_LIB(intl, dcgettext,
183
[gt_cv_func_dgettext_libintl=yes
184
libintl_extra_libs=-liconv],
190
# If we found libintl, then check in it for bind_textdomain_codeset();
191
# we'll prefer libc if neither have bind_textdomain_codeset(),
192
# and both have dgettext and ngettext
194
if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
195
glib_save_LIBS="$LIBS"
196
LIBS="$LIBS -lintl $libintl_extra_libs"
197
unset ac_cv_func_bind_textdomain_codeset
198
AC_CHECK_FUNCS(bind_textdomain_codeset)
199
LIBS="$glib_save_LIBS"
201
if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
202
gt_cv_func_dgettext_libc=no
204
if test "$gt_cv_func_dgettext_libc" = "yes" \
205
&& test "$gt_cv_func_ngettext_libc" = "yes"; then
206
gt_cv_func_dgettext_libintl=no
212
if test "$gt_cv_func_dgettext_libc" = "yes" \
213
|| test "$gt_cv_func_dgettext_libintl" = "yes"; then
214
gt_cv_have_gettext=yes
217
if test "$gt_cv_func_dgettext_libintl" = "yes"; then
218
INTLLIBS="-lintl $libintl_extra_libs"
221
if test "$gt_cv_have_gettext" = "yes"; then
222
AC_DEFINE(HAVE_GETTEXT,1,
223
[Define if the GNU gettext() function is already present or preinstalled.])
224
GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
225
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
226
if test "$MSGFMT" != "no"; then
227
glib_save_LIBS="$LIBS"
228
LIBS="$LIBS $INTLLIBS"
229
AC_CHECK_FUNCS(dcgettext)
231
AC_MSG_CHECKING([if msgfmt accepts -c])
232
GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[
235
"Content-Type: text/plain; charset=UTF-8\n"
236
"Project-Id-Version: test 1.0\n"
237
"PO-Revision-Date: 2007-02-15 12:01+0100\n"
238
"Last-Translator: test <foo@bar.xx>\n"
239
"Language-Team: C <LL@li.org>\n"
240
"MIME-Version: 1.0\n"
241
"Content-Transfer-Encoding: 8bit\n"
242
], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
243
AC_SUBST(MSGFMT_OPTS)
244
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
245
GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
246
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
247
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
248
return _nl_msg_cat_cntr],
253
dnl On Solaris, if bind_textdomain_codeset is in libc,
254
dnl GNU format message catalog is always supported,
255
dnl since both are added to the libc all together.
256
dnl Hence, we'd like to go with DATADIRNAME=share and
257
dnl and CATOBJEXT=.gmo in this case.
258
AC_CHECK_FUNC(bind_textdomain_codeset,
273
LIBS="$glib_save_LIBS"
276
gt_cv_have_gettext=no
281
if test "$gt_cv_have_gettext" = "yes" ; then
282
AC_DEFINE(ENABLE_NLS, 1,
283
[always defined to indicate that i18n is enabled])
286
dnl Test whether we really found GNU xgettext.
287
if test "$XGETTEXT" != ":"; then
288
dnl If it is not GNU xgettext we define it as : so that the
289
dnl Makefiles still can work.
290
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
294
[found xgettext program is not GNU xgettext; ignore it])
299
# We need to process the po/ directory.
303
[case "$CONFIG_FILES" in *po/Makefile.in*)
304
sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
307
dnl These rules are solely for the distribution goal. While doing this
308
dnl we only have to keep exactly one list of the available catalogs
310
for lang in $ALL_LINGUAS; do
311
GMOFILES="$GMOFILES $lang.gmo"
312
POFILES="$POFILES $lang.po"
315
dnl Make all variables we use known to autoconf.
318
AC_SUBST(DATADIRNAME)
322
AC_SUBST(PO_IN_DATADIR_TRUE)
323
AC_SUBST(PO_IN_DATADIR_FALSE)
328
# AM_GLIB_GNU_GETTEXT
329
# -------------------
330
# Do checks necessary for use of gettext. If a suitable implementation
331
# of gettext is found in either in libintl or in the C library,
332
# it will set INTLLIBS to the libraries needed for use of gettext
333
# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
334
# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
335
# on various variables needed by the Makefile.in.in installed by
338
glib_DEFUN([GLIB_GNU_GETTEXT],
339
[AC_REQUIRE([AC_PROG_CC])dnl
340
AC_REQUIRE([AC_HEADER_STDC])dnl
345
if test "$gt_cv_have_gettext" = "yes"; then
346
if test "x$ALL_LINGUAS" = "x"; then
349
AC_MSG_CHECKING(for catalogs to be installed)
351
for presentlang in $ALL_LINGUAS; do
353
if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
354
desiredlanguages="$LINGUAS"
356
desiredlanguages="$ALL_LINGUAS"
358
for desiredlang in $desiredlanguages; do
359
# Use the presentlang catalog if desiredlang is
360
# a. equal to presentlang, or
361
# b. a variant of presentlang (because in this case,
362
# presentlang can be used as a fallback for messages
363
# which are not translated in the desiredlang catalog).
364
case "$desiredlang" in
365
"$presentlang"*) useit=yes;;
368
if test $useit = yes; then
369
NEW_LINGUAS="$NEW_LINGUAS $presentlang"
373
AC_MSG_RESULT($LINGUAS)
376
dnl Construct list of names of catalog files to be constructed.
377
if test -n "$LINGUAS"; then
378
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
382
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
383
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
384
dnl Try to locate is.
386
if test -n "$ac_aux_dir"; then
387
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
389
if test -z "$MKINSTALLDIRS"; then
390
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
392
AC_SUBST(MKINSTALLDIRS)
394
dnl Generate list of files to be processed by xgettext which will
395
dnl be included in po/Makefile.
396
test -d po || mkdir po
397
if test "x$srcdir" != "x."; then
398
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
399
posrcprefix="$srcdir/"
401
posrcprefix="../$srcdir/"
407
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
408
< $srcdir/po/POTFILES.in > po/POTFILES
411
# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
412
# -------------------------------
413
# Define VARIABLE to the location where catalog files will
414
# be installed by po/Makefile.
415
glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
416
[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
417
glib_save_prefix="$prefix"
418
glib_save_exec_prefix="$exec_prefix"
419
glib_save_datarootdir="$datarootdir"
420
test "x$prefix" = xNONE && prefix=$ac_default_prefix
421
test "x$exec_prefix" = xNONE && exec_prefix=$prefix
422
datarootdir=`eval echo "${datarootdir}"`
423
if test "x$CATOBJEXT" = "x.mo" ; then
424
localedir=`eval echo "${libdir}/locale"`
426
localedir=`eval echo "${datadir}/locale"`
428
prefix="$glib_save_prefix"
429
exec_prefix="$glib_save_exec_prefix"
430
datarootdir="$glib_save_datarootdir"
431
AC_DEFINE_UNQUOTED($1, "$localedir",
432
[Define the location where the catalogs will be installed])
436
dnl Now the definitions that aclocal will find
438
ifdef(glib_configure_ac,[],[
439
AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
440
AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])
443
# GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL])
445
# Create a temporary file with TEST-FILE as its contents and pass the
446
# file name to PROGRAM. Perform ACTION-IF-PASS if PROGRAM exits with
447
# 0 and perform ACTION-IF-FAIL for any other exit status.
448
AC_DEFUN([GLIB_RUN_PROG],
449
[cat >conftest.foo <<_ACEOF
452
if AC_RUN_LOG([$1 conftest.foo]); then
453
m4_ifval([$3], [$3], [:])
454
m4_ifvaln([$4], [else $4])dnl
455
echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD
456
sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD
460
# nls.m4 serial 5 (gettext-0.18)
461
dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation,
463
dnl This file is free software; the Free Software Foundation
464
dnl gives unlimited permission to copy and/or distribute it,
465
dnl with or without modifications, as long as this notice is preserved.
467
dnl This file can can be used in projects which are not available under
468
dnl the GNU General Public License or the GNU Library General Public
469
dnl License but which still want to provide support for the GNU gettext
471
dnl Please note that the actual code of the GNU gettext library is covered
472
dnl by the GNU Library General Public License, and the rest of the GNU
473
dnl gettext package package is covered by the GNU General Public License.
474
dnl They are *not* in the public domain.
477
dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
478
dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
484
AC_MSG_CHECKING([whether NLS is requested])
485
dnl Default is enabled NLS
487
[ --disable-nls do not use Native Language Support],
488
USE_NLS=$enableval, USE_NLS=yes)
489
AC_MSG_RESULT([$USE_NLS])
493
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
494
# serial 1 (pkg-config-0.24)
496
# Copyright Ā© 2004 Scott James Remnant <scott@netsplit.com>.
498
# This program is free software; you can redistribute it and/or modify
499
# it under the terms of the GNU General Public License as published by
500
# the Free Software Foundation; either version 2 of the License, or
501
# (at your option) any later version.
503
# This program is distributed in the hope that it will be useful, but
504
# WITHOUT ANY WARRANTY; without even the implied warranty of
505
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
506
# General Public License for more details.
508
# You should have received a copy of the GNU General Public License
509
# along with this program; if not, write to the Free Software
510
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
512
# As a special exception to the GNU General Public License, if you
513
# distribute this file as part of a program that contains a
514
# configuration script generated by Autoconf, you may include it under
515
# the same distribution terms that you use for the rest of that program.
517
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
518
# ----------------------------------
519
AC_DEFUN([PKG_PROG_PKG_CONFIG],
520
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
521
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
522
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
523
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
524
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
525
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
527
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
528
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
530
if test -n "$PKG_CONFIG"; then
531
_pkg_min_version=m4_default([$1], [0.9.0])
532
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
533
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
540
])# PKG_PROG_PKG_CONFIG
542
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
544
# Check to see whether a particular set of modules exists. Similar
545
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
547
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
548
# only at the first occurence in configure.ac, so if the first place
549
# it's called might be skipped (such as if it is within an "if", you
550
# have to call PKG_CHECK_EXISTS manually
551
# --------------------------------------------------------------
552
AC_DEFUN([PKG_CHECK_EXISTS],
553
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
554
if test -n "$PKG_CONFIG" && \
555
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
556
m4_default([$2], [:])
557
m4_ifvaln([$3], [else
561
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
562
# ---------------------------------------------
563
m4_define([_PKG_CONFIG],
564
[if test -n "$$1"; then
566
elif test -n "$PKG_CONFIG"; then
567
PKG_CHECK_EXISTS([$3],
568
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
569
test "x$?" != "x0" && pkg_failed=yes ],
576
# _PKG_SHORT_ERRORS_SUPPORTED
577
# -----------------------------
578
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
579
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
580
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
581
_pkg_short_errors_supported=yes
583
_pkg_short_errors_supported=no
585
])# _PKG_SHORT_ERRORS_SUPPORTED
588
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
589
# [ACTION-IF-NOT-FOUND])
592
# Note that if there is a possibility the first call to
593
# PKG_CHECK_MODULES might not happen, you should be sure to include an
594
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
597
# --------------------------------------------------------------
598
AC_DEFUN([PKG_CHECK_MODULES],
599
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
600
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
601
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
604
AC_MSG_CHECKING([for $1])
606
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
607
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
609
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
610
and $1[]_LIBS to avoid the need to call pkg-config.
611
See the pkg-config man page for more details.])
613
if test $pkg_failed = yes; then
615
_PKG_SHORT_ERRORS_SUPPORTED
616
if test $_pkg_short_errors_supported = yes; then
617
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
619
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
621
# Put the nasty error message in config.log where it belongs
622
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
624
m4_default([$4], [AC_MSG_ERROR(
625
[Package requirements ($2) were not met:
629
Consider adjusting the PKG_CONFIG_PATH environment variable if you
630
installed software in a non-standard prefix.
634
elif test $pkg_failed = untried; then
636
m4_default([$4], [AC_MSG_FAILURE(
637
[The pkg-config script could not be found or is too old. Make sure it
638
is in your PATH or set the PKG_CONFIG environment variable to the full
643
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
646
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
647
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
651
])# PKG_CHECK_MODULES
23
653
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
24
654
# Foundation, Inc.
1115
1745
AC_MSG_ERROR([Vala $1 not found.])])])])
1118
# nls.m4 serial 5 (gettext-0.18)
1119
dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation,
1121
dnl This file is free software; the Free Software Foundation
1122
dnl gives unlimited permission to copy and/or distribute it,
1123
dnl with or without modifications, as long as this notice is preserved.
1125
dnl This file can can be used in projects which are not available under
1126
dnl the GNU General Public License or the GNU Library General Public
1127
dnl License but which still want to provide support for the GNU gettext
1129
dnl Please note that the actual code of the GNU gettext library is covered
1130
dnl by the GNU Library General Public License, and the rest of the GNU
1131
dnl gettext package package is covered by the GNU General Public License.
1132
dnl They are *not* in the public domain.
1135
dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1136
dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
1142
AC_MSG_CHECKING([whether NLS is requested])
1143
dnl Default is enabled NLS
1144
AC_ARG_ENABLE([nls],
1145
[ --disable-nls do not use Native Language Support],
1146
USE_NLS=$enableval, USE_NLS=yes)
1147
AC_MSG_RESULT([$USE_NLS])
1151
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
1152
# serial 1 (pkg-config-0.24)
1154
# Copyright Ā© 2004 Scott James Remnant <scott@netsplit.com>.
1156
# This program is free software; you can redistribute it and/or modify
1157
# it under the terms of the GNU General Public License as published by
1158
# the Free Software Foundation; either version 2 of the License, or
1159
# (at your option) any later version.
1161
# This program is distributed in the hope that it will be useful, but
1162
# WITHOUT ANY WARRANTY; without even the implied warranty of
1163
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1164
# General Public License for more details.
1166
# You should have received a copy of the GNU General Public License
1167
# along with this program; if not, write to the Free Software
1168
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1170
# As a special exception to the GNU General Public License, if you
1171
# distribute this file as part of a program that contains a
1172
# configuration script generated by Autoconf, you may include it under
1173
# the same distribution terms that you use for the rest of that program.
1175
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1176
# ----------------------------------
1177
AC_DEFUN([PKG_PROG_PKG_CONFIG],
1178
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1179
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1180
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1181
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1182
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1183
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1185
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1186
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1188
if test -n "$PKG_CONFIG"; then
1189
_pkg_min_version=m4_default([$1], [0.9.0])
1190
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1191
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1192
AC_MSG_RESULT([yes])
1198
])# PKG_PROG_PKG_CONFIG
1200
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1202
# Check to see whether a particular set of modules exists. Similar
1203
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1205
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1206
# only at the first occurence in configure.ac, so if the first place
1207
# it's called might be skipped (such as if it is within an "if", you
1208
# have to call PKG_CHECK_EXISTS manually
1209
# --------------------------------------------------------------
1210
AC_DEFUN([PKG_CHECK_EXISTS],
1211
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1212
if test -n "$PKG_CONFIG" && \
1213
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1214
m4_default([$2], [:])
1215
m4_ifvaln([$3], [else
1219
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1220
# ---------------------------------------------
1221
m4_define([_PKG_CONFIG],
1222
[if test -n "$$1"; then
1224
elif test -n "$PKG_CONFIG"; then
1225
PKG_CHECK_EXISTS([$3],
1226
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1227
test "x$?" != "x0" && pkg_failed=yes ],
1234
# _PKG_SHORT_ERRORS_SUPPORTED
1235
# -----------------------------
1236
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1237
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1238
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1239
_pkg_short_errors_supported=yes
1241
_pkg_short_errors_supported=no
1243
])# _PKG_SHORT_ERRORS_SUPPORTED
1246
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1247
# [ACTION-IF-NOT-FOUND])
1250
# Note that if there is a possibility the first call to
1251
# PKG_CHECK_MODULES might not happen, you should be sure to include an
1252
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1255
# --------------------------------------------------------------
1256
AC_DEFUN([PKG_CHECK_MODULES],
1257
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1258
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1259
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1262
AC_MSG_CHECKING([for $1])
1264
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1265
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1267
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1268
and $1[]_LIBS to avoid the need to call pkg-config.
1269
See the pkg-config man page for more details.])
1271
if test $pkg_failed = yes; then
1273
_PKG_SHORT_ERRORS_SUPPORTED
1274
if test $_pkg_short_errors_supported = yes; then
1275
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1277
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1279
# Put the nasty error message in config.log where it belongs
1280
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1282
m4_default([$4], [AC_MSG_ERROR(
1283
[Package requirements ($2) were not met:
1287
Consider adjusting the PKG_CONFIG_PATH environment variable if you
1288
installed software in a non-standard prefix.
1292
elif test $pkg_failed = untried; then
1294
m4_default([$4], [AC_MSG_FAILURE(
1295
[The pkg-config script could not be found or is too old. Make sure it
1296
is in your PATH or set the PKG_CONFIG environment variable to the full
1301
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1304
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1305
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1306
AC_MSG_RESULT([yes])
1309
])# PKG_CHECK_MODULES
1311
# Copyright (C) 1995-2002 Free Software Foundation, Inc.
1312
# Copyright (C) 2001-2003,2004 Red Hat, Inc.
1314
# This file is free software, distributed under the terms of the GNU
1315
# General Public License. As a special exception to the GNU General
1316
# Public License, this file may be distributed as part of a program
1317
# that contains a configuration script generated by Autoconf, under
1318
# the same distribution terms as the rest of that program.
1320
# This file can be copied and used freely without restrictions. It can
1321
# be used in projects which are not available under the GNU Public License
1322
# but which still want to provide support for the GNU gettext functionality.
1324
# Macro to add for using GNU gettext.
1325
# Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
1327
# Modified to never use included libintl.
1328
# Owen Taylor <otaylor@redhat.com>, 12/15/1998
1330
# Major rework to remove unused code
1331
# Owen Taylor <otaylor@redhat.com>, 12/11/2002
1333
# Added better handling of ALL_LINGUAS from GNU gettext version
1334
# written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
1336
# Modified to require ngettext
1337
# Matthias Clasen <mclasen@redhat.com> 08/06/2004
1339
# We need this here as well, since someone might use autoconf-2.5x
1340
# to configure GLib then an older version to configure a package
1341
# using AM_GLIB_GNU_GETTEXT
1345
dnl We go to great lengths to make sure that aclocal won't
1346
dnl try to pull in the installed version of these macros
1347
dnl when running aclocal in the glib directory.
1349
m4_copy([AC_DEFUN],[glib_DEFUN])
1350
m4_copy([AC_REQUIRE],[glib_REQUIRE])
1352
dnl At the end, if we're not within glib, we'll define the public
1353
dnl definitions in terms of our private definitions.
1357
#--------------------
1358
glib_DEFUN([GLIB_LC_MESSAGES],
1359
[AC_CHECK_HEADERS([locale.h])
1360
if test $ac_cv_header_locale_h = yes; then
1361
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1362
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1363
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1364
if test $am_cv_val_LC_MESSAGES = yes; then
1365
AC_DEFINE(HAVE_LC_MESSAGES, 1,
1366
[Define if your <locale.h> file defines LC_MESSAGES.])
1370
# GLIB_PATH_PROG_WITH_TEST
1371
#----------------------------
1372
dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1373
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1374
glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
1375
[# Extract the first word of "$2", so it can be a program name with args.
1376
set dummy $2; ac_word=[$]2
1377
AC_MSG_CHECKING([for $ac_word])
1378
AC_CACHE_VAL(ac_cv_path_$1,
1381
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1384
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1385
for ac_dir in ifelse([$5], , $PATH, [$5]); do
1386
test -z "$ac_dir" && ac_dir=.
1387
if test -f $ac_dir/$ac_word; then
1389
ac_cv_path_$1="$ac_dir/$ac_word"
1395
dnl If no 4th arg is given, leave the cache variable unset,
1396
dnl so AC_PATH_PROGS will keep looking.
1397
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1402
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
1403
AC_MSG_RESULT([$]$1)
1412
glib_DEFUN([GLIB_WITH_NLS],
1413
dnl NLS is obligatory
1417
gt_cv_have_gettext=no
1423
AC_CHECK_HEADER(libintl.h,
1424
[gt_cv_func_dgettext_libintl="no"
1425
libintl_extra_libs=""
1428
# First check in libc
1430
AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc,
1432
#include <libintl.h>
1434
[return !ngettext ("","", 1)],
1435
gt_cv_func_ngettext_libc=yes,
1436
gt_cv_func_ngettext_libc=no)
1439
if test "$gt_cv_func_ngettext_libc" = "yes" ; then
1440
AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
1442
#include <libintl.h>
1444
[return !dgettext ("","")],
1445
gt_cv_func_dgettext_libc=yes,
1446
gt_cv_func_dgettext_libc=no)
1450
if test "$gt_cv_func_ngettext_libc" = "yes" ; then
1451
AC_CHECK_FUNCS(bind_textdomain_codeset)
1455
# If we don't have everything we want, check in libintl
1457
if test "$gt_cv_func_dgettext_libc" != "yes" \
1458
|| test "$gt_cv_func_ngettext_libc" != "yes" \
1459
|| test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
1461
AC_CHECK_LIB(intl, bindtextdomain,
1462
[AC_CHECK_LIB(intl, ngettext,
1463
[AC_CHECK_LIB(intl, dgettext,
1464
gt_cv_func_dgettext_libintl=yes)])])
1466
if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
1467
AC_MSG_CHECKING([if -liconv is needed to use gettext])
1469
AC_CHECK_LIB(intl, ngettext,
1470
[AC_CHECK_LIB(intl, dcgettext,
1471
[gt_cv_func_dgettext_libintl=yes
1472
libintl_extra_libs=-liconv],
1478
# If we found libintl, then check in it for bind_textdomain_codeset();
1479
# we'll prefer libc if neither have bind_textdomain_codeset(),
1480
# and both have dgettext and ngettext
1482
if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
1483
glib_save_LIBS="$LIBS"
1484
LIBS="$LIBS -lintl $libintl_extra_libs"
1485
unset ac_cv_func_bind_textdomain_codeset
1486
AC_CHECK_FUNCS(bind_textdomain_codeset)
1487
LIBS="$glib_save_LIBS"
1489
if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
1490
gt_cv_func_dgettext_libc=no
1492
if test "$gt_cv_func_dgettext_libc" = "yes" \
1493
&& test "$gt_cv_func_ngettext_libc" = "yes"; then
1494
gt_cv_func_dgettext_libintl=no
1500
if test "$gt_cv_func_dgettext_libc" = "yes" \
1501
|| test "$gt_cv_func_dgettext_libintl" = "yes"; then
1502
gt_cv_have_gettext=yes
1505
if test "$gt_cv_func_dgettext_libintl" = "yes"; then
1506
INTLLIBS="-lintl $libintl_extra_libs"
1509
if test "$gt_cv_have_gettext" = "yes"; then
1510
AC_DEFINE(HAVE_GETTEXT,1,
1511
[Define if the GNU gettext() function is already present or preinstalled.])
1512
GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1513
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
1514
if test "$MSGFMT" != "no"; then
1515
glib_save_LIBS="$LIBS"
1516
LIBS="$LIBS $INTLLIBS"
1517
AC_CHECK_FUNCS(dcgettext)
1519
AC_MSG_CHECKING([if msgfmt accepts -c])
1520
GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[
1523
"Content-Type: text/plain; charset=UTF-8\n"
1524
"Project-Id-Version: test 1.0\n"
1525
"PO-Revision-Date: 2007-02-15 12:01+0100\n"
1526
"Last-Translator: test <foo@bar.xx>\n"
1527
"Language-Team: C <LL@li.org>\n"
1528
"MIME-Version: 1.0\n"
1529
"Content-Transfer-Encoding: 8bit\n"
1530
], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
1531
AC_SUBST(MSGFMT_OPTS)
1532
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1533
GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1534
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
1535
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
1536
return _nl_msg_cat_cntr],
1541
dnl On Solaris, if bind_textdomain_codeset is in libc,
1542
dnl GNU format message catalog is always supported,
1543
dnl since both are added to the libc all together.
1544
dnl Hence, we'd like to go with DATADIRNAME=share and
1545
dnl and CATOBJEXT=.gmo in this case.
1546
AC_CHECK_FUNC(bind_textdomain_codeset,
1561
LIBS="$glib_save_LIBS"
1564
gt_cv_have_gettext=no
1569
if test "$gt_cv_have_gettext" = "yes" ; then
1570
AC_DEFINE(ENABLE_NLS, 1,
1571
[always defined to indicate that i18n is enabled])
1574
dnl Test whether we really found GNU xgettext.
1575
if test "$XGETTEXT" != ":"; then
1576
dnl If it is not GNU xgettext we define it as : so that the
1577
dnl Makefiles still can work.
1578
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
1582
[found xgettext program is not GNU xgettext; ignore it])
1587
# We need to process the po/ directory.
1591
[case "$CONFIG_FILES" in *po/Makefile.in*)
1592
sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
1595
dnl These rules are solely for the distribution goal. While doing this
1596
dnl we only have to keep exactly one list of the available catalogs
1597
dnl in configure.ac.
1598
for lang in $ALL_LINGUAS; do
1599
GMOFILES="$GMOFILES $lang.gmo"
1600
POFILES="$POFILES $lang.po"
1603
dnl Make all variables we use known to autoconf.
1606
AC_SUBST(DATADIRNAME)
1608
AC_SUBST(INSTOBJEXT)
1610
AC_SUBST(PO_IN_DATADIR_TRUE)
1611
AC_SUBST(PO_IN_DATADIR_FALSE)
1616
# AM_GLIB_GNU_GETTEXT
1617
# -------------------
1618
# Do checks necessary for use of gettext. If a suitable implementation
1619
# of gettext is found in either in libintl or in the C library,
1620
# it will set INTLLIBS to the libraries needed for use of gettext
1621
# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
1622
# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
1623
# on various variables needed by the Makefile.in.in installed by
1626
glib_DEFUN([GLIB_GNU_GETTEXT],
1627
[AC_REQUIRE([AC_PROG_CC])dnl
1628
AC_REQUIRE([AC_HEADER_STDC])dnl
1633
if test "$gt_cv_have_gettext" = "yes"; then
1634
if test "x$ALL_LINGUAS" = "x"; then
1637
AC_MSG_CHECKING(for catalogs to be installed)
1639
for presentlang in $ALL_LINGUAS; do
1641
if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
1642
desiredlanguages="$LINGUAS"
1644
desiredlanguages="$ALL_LINGUAS"
1646
for desiredlang in $desiredlanguages; do
1647
# Use the presentlang catalog if desiredlang is
1648
# a. equal to presentlang, or
1649
# b. a variant of presentlang (because in this case,
1650
# presentlang can be used as a fallback for messages
1651
# which are not translated in the desiredlang catalog).
1652
case "$desiredlang" in
1653
"$presentlang"*) useit=yes;;
1656
if test $useit = yes; then
1657
NEW_LINGUAS="$NEW_LINGUAS $presentlang"
1660
LINGUAS=$NEW_LINGUAS
1661
AC_MSG_RESULT($LINGUAS)
1664
dnl Construct list of names of catalog files to be constructed.
1665
if test -n "$LINGUAS"; then
1666
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1670
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1671
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
1672
dnl Try to locate is.
1674
if test -n "$ac_aux_dir"; then
1675
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1677
if test -z "$MKINSTALLDIRS"; then
1678
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1680
AC_SUBST(MKINSTALLDIRS)
1682
dnl Generate list of files to be processed by xgettext which will
1683
dnl be included in po/Makefile.
1684
test -d po || mkdir po
1685
if test "x$srcdir" != "x."; then
1686
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
1687
posrcprefix="$srcdir/"
1689
posrcprefix="../$srcdir/"
1695
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
1696
< $srcdir/po/POTFILES.in > po/POTFILES
1699
# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
1700
# -------------------------------
1701
# Define VARIABLE to the location where catalog files will
1702
# be installed by po/Makefile.
1703
glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
1704
[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
1705
glib_save_prefix="$prefix"
1706
glib_save_exec_prefix="$exec_prefix"
1707
glib_save_datarootdir="$datarootdir"
1708
test "x$prefix" = xNONE && prefix=$ac_default_prefix
1709
test "x$exec_prefix" = xNONE && exec_prefix=$prefix
1710
datarootdir=`eval echo "${datarootdir}"`
1711
if test "x$CATOBJEXT" = "x.mo" ; then
1712
localedir=`eval echo "${libdir}/locale"`
1714
localedir=`eval echo "${datadir}/locale"`
1716
prefix="$glib_save_prefix"
1717
exec_prefix="$glib_save_exec_prefix"
1718
datarootdir="$glib_save_datarootdir"
1719
AC_DEFINE_UNQUOTED($1, "$localedir",
1720
[Define the location where the catalogs will be installed])
1724
dnl Now the definitions that aclocal will find
1726
ifdef(glib_configure_ac,[],[
1727
AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
1728
AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])
1731
# GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL])
1733
# Create a temporary file with TEST-FILE as its contents and pass the
1734
# file name to PROGRAM. Perform ACTION-IF-PASS if PROGRAM exits with
1735
# 0 and perform ACTION-IF-FAIL for any other exit status.
1736
AC_DEFUN([GLIB_RUN_PROG],
1737
[cat >conftest.foo <<_ACEOF
1740
if AC_RUN_LOG([$1 conftest.foo]); then
1741
m4_ifval([$3], [$3], [:])
1742
m4_ifvaln([$4], [else $4])dnl
1743
echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD
1744
sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD
1748
1748
m4_include([m4/intltool.m4])
1749
1749
m4_include([m4/libtool.m4])
1750
1750
m4_include([m4/ltoptions.m4])