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
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
23
# serial 1 (pkg-config-0.24)
25
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
27
# This program is free software; you can redistribute it and/or modify
28
# it under the terms of the GNU General Public License as published by
29
# the Free Software Foundation; either version 2 of the License, or
30
# (at your option) any later version.
32
# This program is distributed in the hope that it will be useful, but
33
# WITHOUT ANY WARRANTY; without even the implied warranty of
34
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35
# General Public License for more details.
37
# You should have received a copy of the GNU General Public License
38
# along with this program; if not, write to the Free Software
39
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
41
# As a special exception to the GNU General Public License, if you
42
# distribute this file as part of a program that contains a
43
# configuration script generated by Autoconf, you may include it under
44
# the same distribution terms that you use for the rest of that program.
46
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
47
# ----------------------------------
48
AC_DEFUN([PKG_PROG_PKG_CONFIG],
49
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
50
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
51
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
52
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
53
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
54
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
56
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
57
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
59
if test -n "$PKG_CONFIG"; then
60
_pkg_min_version=m4_default([$1], [0.9.0])
61
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
62
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
69
])# PKG_PROG_PKG_CONFIG
71
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
73
# Check to see whether a particular set of modules exists. Similar
74
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
76
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
77
# only at the first occurence in configure.ac, so if the first place
78
# it's called might be skipped (such as if it is within an "if", you
79
# have to call PKG_CHECK_EXISTS manually
80
# --------------------------------------------------------------
81
AC_DEFUN([PKG_CHECK_EXISTS],
82
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
83
if test -n "$PKG_CONFIG" && \
84
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
90
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
91
# ---------------------------------------------
92
m4_define([_PKG_CONFIG],
93
[if test -n "$$1"; then
95
elif test -n "$PKG_CONFIG"; then
96
PKG_CHECK_EXISTS([$3],
97
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
98
test "x$?" != "x0" && pkg_failed=yes ],
105
# _PKG_SHORT_ERRORS_SUPPORTED
106
# -----------------------------
107
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
108
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
109
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
110
_pkg_short_errors_supported=yes
112
_pkg_short_errors_supported=no
114
])# _PKG_SHORT_ERRORS_SUPPORTED
117
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
118
# [ACTION-IF-NOT-FOUND])
121
# Note that if there is a possibility the first call to
122
# PKG_CHECK_MODULES might not happen, you should be sure to include an
123
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
126
# --------------------------------------------------------------
127
AC_DEFUN([PKG_CHECK_MODULES],
128
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
130
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
133
AC_MSG_CHECKING([for $1])
135
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
136
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
138
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
139
and $1[]_LIBS to avoid the need to call pkg-config.
140
See the pkg-config man page for more details.])
142
if test $pkg_failed = yes; then
144
_PKG_SHORT_ERRORS_SUPPORTED
145
if test $_pkg_short_errors_supported = yes; then
146
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
148
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
150
# Put the nasty error message in config.log where it belongs
151
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
153
m4_default([$4], [AC_MSG_ERROR(
154
[Package requirements ($2) were not met:
158
Consider adjusting the PKG_CONFIG_PATH environment variable if you
159
installed software in a non-standard prefix.
163
elif test $pkg_failed = untried; then
165
m4_default([$4], [AC_MSG_FAILURE(
166
[The pkg-config script could not be found or is too old. Make sure it
167
is in your PATH or set the PKG_CONFIG environment variable to the full
172
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
175
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
176
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
180
])# PKG_CHECK_MODULES
183
# PKG_INSTALLDIR(DIRECTORY)
184
# -------------------------
185
# Substitutes the variable pkgconfigdir as the location where a module
186
# should install pkg-config .pc files. By default the directory is
187
# $libdir/pkgconfig, but the default can be changed by passing
188
# DIRECTORY. The user can override through the --with-pkgconfigdir
190
AC_DEFUN([PKG_INSTALLDIR],
191
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
192
m4_pushdef([pkg_description],
193
[pkg-config installation directory @<:@]pkg_default[@:>@])
194
AC_ARG_WITH([pkgconfigdir],
195
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
196
[with_pkgconfigdir=]pkg_default)
197
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
198
m4_popdef([pkg_default])
199
m4_popdef([pkg_description])
200
]) dnl PKG_INSTALLDIR
203
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
204
# -------------------------
205
# Substitutes the variable noarch_pkgconfigdir as the location where a
206
# module should install arch-independent pkg-config .pc files. By
207
# default the directory is $datadir/pkgconfig, but the default can be
208
# changed by passing DIRECTORY. The user can override through the
209
# --with-noarch-pkgconfigdir parameter.
210
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
211
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
212
m4_pushdef([pkg_description],
213
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
214
AC_ARG_WITH([noarch-pkgconfigdir],
215
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
216
[with_noarch_pkgconfigdir=]pkg_default)
217
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
218
m4_popdef([pkg_default])
219
m4_popdef([pkg_description])
220
]) dnl PKG_NOARCH_INSTALLDIR
222
AC_DEFUN([YELP_HELP_INIT],
224
AC_REQUIRE([AC_PROG_LN_S])
225
m4_pattern_allow([AM_V_at])
226
m4_pattern_allow([AM_V_GEN])
227
m4_pattern_allow([AM_DEFAULT_VERBOSITY])
228
AC_ARG_WITH([help-dir],
229
AC_HELP_STRING([--with-help-dir=DIR],
230
[path where help files are installed]),,
231
[with_help_dir='${datadir}/help'])
232
HELP_DIR="$with_help_dir"
235
AC_ARG_VAR([ITSTOOL], [Path to the `itstool` command])
236
AC_CHECK_PROG([ITSTOOL], [itstool], [itstool])
237
if test x"$ITSTOOL" = x; then
238
AC_MSG_ERROR([itstool not found])
241
AC_ARG_VAR([XMLLINT], [Path to the `xmllint` command])
242
AC_CHECK_PROG([XMLLINT], [xmllint], [xmllint])
243
if test x"$XMLLINT" = x; then
244
AC_MSG_ERROR([xmllint not found])
255
_HELP_LINGUAS = $(if $(filter environment,$(origin LINGUAS)),$(filter $(LINGUAS),$(HELP_LINGUAS)),$(HELP_LINGUAS))
256
_HELP_POTFILE = $(if $(HELP_POT),$(HELP_POT),$(if $(HELP_ID),$(HELP_ID).pot))
257
_HELP_POFILES = $(if $(HELP_ID),$(foreach lc,$(_HELP_LINGUAS),$(lc)/$(lc).po))
258
_HELP_MOFILES = $(patsubst %.po,%.mo,$(_HELP_POFILES))
259
_HELP_C_FILES = $(foreach f,$(HELP_FILES),C/$(f))
260
_HELP_C_EXTRA = $(foreach f,$(HELP_EXTRA),C/$(f))
261
_HELP_C_MEDIA = $(foreach f,$(HELP_MEDIA),C/$(f))
262
_HELP_LC_FILES = $(foreach lc,$(_HELP_LINGUAS),$(foreach f,$(HELP_FILES),$(lc)/$(f)))
263
_HELP_LC_STAMPS = $(foreach lc,$(_HELP_LINGUAS),$(lc)/$(lc).stamp)
265
_HELP_DEFAULT_V = $(if $(AM_DEFAULT_VERBOSITY),$(AM_DEFAULT_VERBOSITY),1)
266
_HELP_V = $(if $(V),$(V),$(_HELP_DEFAULT_V))
267
_HELP_LC_VERBOSE = $(_HELP_LC_VERBOSE_$(_HELP_V))
268
_HELP_LC_VERBOSE_ = $(_HELP_LC_VERBOSE_$(_HELP_DEFAULT_V))
269
_HELP_LC_VERBOSE_0 = @echo " GEN "$(dir [$]@);
271
all: $(_HELP_C_FILES) $(_HELP_C_EXTRA) $(_HELP_C_MEDIA) $(_HELP_LC_FILES) $(_HELP_POFILES)
274
pot: $(_HELP_POTFILE)
275
$(_HELP_POTFILE): $(_HELP_C_FILES) $(_HELP_C_EXTRA) $(_HELP_C_MEDIA)
276
$(AM_V_GEN)$(ITSTOOL) -o "[$]@" $(_HELP_C_FILES)
279
repo: $(_HELP_POTFILE)
280
$(AM_V_at)for po in $(_HELP_POFILES); do \
281
if test "x[$](_HELP_V)" = "x0"; then echo " GEN $${po}"; fi; \
282
msgmerge -q -o "$${po}" "$${po}" "$(_HELP_POTFILE)"; \
286
$(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
287
$(AM_V_at)if test ! -f "[$]@" -a -f "$(srcdir)/[$]@"; then cp "$(srcdir)/[$]@" "[$]@"; fi
288
$(AM_V_GEN)if ! test -f "[$]@"; then \
289
(cd "$(dir [$]@)" && \
290
$(ITSTOOL) -o "$(notdir [$]@).tmp" $(_HELP_C_FILES) && \
291
mv "$(notdir [$]@).tmp" "$(notdir [$]@)"); \
293
(cd "$(dir [$]@)" && \
294
$(ITSTOOL) -o "$(notdir [$]@).tmp" $(_HELP_C_FILES) && \
295
msgmerge -o "$(notdir [$]@)" "$(notdir [$]@)" "$(notdir [$]@).tmp" && \
296
rm "$(notdir [$]@).tmp"); \
299
$(_HELP_MOFILES): %.mo: %.po
300
$(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
301
$(AM_V_GEN)msgfmt -o "[$]@" "$<"
303
$(_HELP_LC_FILES): $(_HELP_LINGUAS)
304
$(_HELP_LINGUAS): $(_HELP_LC_STAMPS)
305
$(_HELP_LC_STAMPS): %.stamp: %.mo
306
$(_HELP_LC_STAMPS): $(_HELP_C_FILES) $(_HELP_C_EXTRA)
307
$(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
308
$(_HELP_LC_VERBOSE)if test -d "C"; then d="../"; else d="$(abs_srcdir)/"; fi; \
309
mo="$(dir [$]@)$(patsubst %/$(notdir [$]@),%,[$]@).mo"; \
310
if test -f "$${mo}"; then mo="../$${mo}"; else mo="$(abs_srcdir)/$${mo}"; fi; \
311
(cd "$(dir [$]@)" && $(ITSTOOL) -m "$${mo}" $(foreach f,$(_HELP_C_FILES),$${d}/$(f))) && \
315
mostlyclean-am: $(if $(HELP_ID),clean-help)
317
rm -f $(_HELP_LC_FILES) $(_HELP_LC_STAMPS) $(_HELP_MOFILES)
320
EXTRA_DIST += $(_HELP_C_EXTRA) $(_HELP_C_MEDIA)
321
EXTRA_DIST += $(foreach lc,$(HELP_LINGUAS),$(lc)/$(lc).stamp)
322
EXTRA_DIST += $(foreach lc,$(HELP_LINGUAS),$(lc)/$(lc).po)
323
EXTRA_DIST += $(foreach f,$(HELP_MEDIA),$(foreach lc,$(HELP_LINGUAS),$(wildcard $(lc)/$(f))))
325
distdir: distdir-help-files
327
@for lc in C $(HELP_LINGUAS); do \
328
$(MKDIR_P) "$(distdir)/$$lc"; \
329
for file in $(HELP_FILES); do \
330
if test -f "$$lc/$$file"; then d=./; else d=$(srcdir)/; fi; \
331
cp -p "$$d$$lc/$$file" "$(distdir)/$$lc/" || exit 1; \
338
for lc in C $(_HELP_LINGUAS); do \
344
xmlpath="$$lc:$(srcdir)/$$lc"; \
346
for page in $(HELP_FILES); do \
347
echo "$(XMLLINT) --noout --noent --path $$xmlpath --xinclude $$d$$lc/$$page"; \
348
$(XMLLINT) --noout --noent --path "$$xmlpath" --xinclude "$$d$$lc/$$page"; \
354
install-data-am: $(if $(HELP_ID),install-help)
356
@for lc in C $(_HELP_LINGUAS); do \
357
$(mkinstalldirs) "$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)" || exit 1; \
359
@for lc in C $(_HELP_LINGUAS); do for f in $(HELP_FILES); do \
360
if test -f "$$lc/$$f"; then d=; else d="$(srcdir)/"; fi; \
361
helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
362
if ! test -d "$$helpdir"; then $(mkinstalldirs) "$$helpdir"; fi; \
363
echo "$(INSTALL_DATA) $$d$$lc/$$f $$helpdir`basename $$f`"; \
364
$(INSTALL_DATA) "$$d$$lc/$$f" "$$helpdir`basename $$f`" || exit 1; \
366
@for f in $(_HELP_C_EXTRA); do \
367
lc=`dirname "$$f"`; lc=`basename "$$lc"`; \
368
if test -f "$$f"; then d=; else d="$(srcdir)/"; fi; \
369
helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
370
if ! test -d "$$helpdir"; then $(mkinstalldirs) "$$helpdir"; fi; \
371
echo "$(INSTALL_DATA) $$d$$f $$helpdir`basename $$f`"; \
372
$(INSTALL_DATA) "$$d$$f" "$$helpdir`basename $$f`" || exit 1; \
374
@for f in $(HELP_MEDIA); do \
375
for lc in C $(_HELP_LINGUAS); do \
376
if test -f "$$lc$$f"; then d=; else d="$(srcdir)/"; fi; \
377
helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
378
mdir=`dirname "$$f"`; \
379
if test "x$mdir" = "x."; then mdir=""; fi; \
380
if ! test -d "$$helpdir$$mdir"; then $(mkinstalldirs) "$$helpdir$$mdir"; fi; \
381
if test -f "$$d$$lc/$$f"; then \
382
echo "$(INSTALL_DATA) $$d$$lc/$$f $$helpdir$$f"; \
383
$(INSTALL_DATA) "$$d$$lc/$$f" "$$helpdir$$f" || exit 1; \
384
elif test "x$$lc" != "xC"; then \
385
echo "$(LN_S) -f $(HELP_DIR)/C/$(HELP_ID)/$$f $$helpdir$$f"; \
386
$(LN_S) -f "$(HELP_DIR)/C/$(HELP_ID)/$$f" "$$helpdir$$f" || exit 1; \
391
.PHONY: uninstall-help
392
uninstall-am: $(if $(HELP_ID),uninstall-help)
394
for lc in C $(_HELP_LINGUAS); do for f in $(HELP_FILES); do \
395
helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
396
echo "rm -f $$helpdir`basename $$f`"; \
397
rm -f "$$helpdir`basename $$f`"; \
399
@for f in $(_HELP_C_EXTRA); do \
400
lc=`dirname "$$f"`; lc=`basename "$$lc"`; \
401
helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
402
echo "rm -f $$helpdir`basename $$f`"; \
403
rm -f "$$helpdir`basename $$f`"; \
405
@for f in $(HELP_MEDIA); do \
406
for lc in C $(_HELP_LINGUAS); do \
407
helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
408
echo "rm -f $$helpdir$$f"; \
409
rm -f "$$helpdir$$f"; \
413
AC_SUBST([YELP_HELP_RULES])
414
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([YELP_HELP_RULES])])
22
417
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
24
419
# This file is free software; the Free Software Foundation
1266
1661
AC_SUBST([am__untar])
1267
1662
]) # _AM_PROG_TAR
1269
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
1270
# serial 1 (pkg-config-0.24)
1272
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1274
# This program is free software; you can redistribute it and/or modify
1275
# it under the terms of the GNU General Public License as published by
1276
# the Free Software Foundation; either version 2 of the License, or
1277
# (at your option) any later version.
1279
# This program is distributed in the hope that it will be useful, but
1280
# WITHOUT ANY WARRANTY; without even the implied warranty of
1281
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1282
# General Public License for more details.
1284
# You should have received a copy of the GNU General Public License
1285
# along with this program; if not, write to the Free Software
1286
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1288
# As a special exception to the GNU General Public License, if you
1289
# distribute this file as part of a program that contains a
1290
# configuration script generated by Autoconf, you may include it under
1291
# the same distribution terms that you use for the rest of that program.
1293
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1294
# ----------------------------------
1295
AC_DEFUN([PKG_PROG_PKG_CONFIG],
1296
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1297
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1298
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1299
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1300
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1301
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1303
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1304
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1306
if test -n "$PKG_CONFIG"; then
1307
_pkg_min_version=m4_default([$1], [0.9.0])
1308
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1309
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1310
AC_MSG_RESULT([yes])
1316
])# PKG_PROG_PKG_CONFIG
1318
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1320
# Check to see whether a particular set of modules exists. Similar
1321
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1323
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1324
# only at the first occurence in configure.ac, so if the first place
1325
# it's called might be skipped (such as if it is within an "if", you
1326
# have to call PKG_CHECK_EXISTS manually
1327
# --------------------------------------------------------------
1328
AC_DEFUN([PKG_CHECK_EXISTS],
1329
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1330
if test -n "$PKG_CONFIG" && \
1331
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1332
m4_default([$2], [:])
1333
m4_ifvaln([$3], [else
1337
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1338
# ---------------------------------------------
1339
m4_define([_PKG_CONFIG],
1340
[if test -n "$$1"; then
1342
elif test -n "$PKG_CONFIG"; then
1343
PKG_CHECK_EXISTS([$3],
1344
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1345
test "x$?" != "x0" && pkg_failed=yes ],
1352
# _PKG_SHORT_ERRORS_SUPPORTED
1353
# -----------------------------
1354
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1355
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1356
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1357
_pkg_short_errors_supported=yes
1359
_pkg_short_errors_supported=no
1361
])# _PKG_SHORT_ERRORS_SUPPORTED
1364
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1365
# [ACTION-IF-NOT-FOUND])
1368
# Note that if there is a possibility the first call to
1369
# PKG_CHECK_MODULES might not happen, you should be sure to include an
1370
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1373
# --------------------------------------------------------------
1374
AC_DEFUN([PKG_CHECK_MODULES],
1375
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1376
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1377
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1380
AC_MSG_CHECKING([for $1])
1382
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1383
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1385
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1386
and $1[]_LIBS to avoid the need to call pkg-config.
1387
See the pkg-config man page for more details.])
1389
if test $pkg_failed = yes; then
1391
_PKG_SHORT_ERRORS_SUPPORTED
1392
if test $_pkg_short_errors_supported = yes; then
1393
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1395
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1397
# Put the nasty error message in config.log where it belongs
1398
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1400
m4_default([$4], [AC_MSG_ERROR(
1401
[Package requirements ($2) were not met:
1405
Consider adjusting the PKG_CONFIG_PATH environment variable if you
1406
installed software in a non-standard prefix.
1410
elif test $pkg_failed = untried; then
1412
m4_default([$4], [AC_MSG_FAILURE(
1413
[The pkg-config script could not be found or is too old. Make sure it
1414
is in your PATH or set the PKG_CONFIG environment variable to the full
1419
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1422
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1423
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1424
AC_MSG_RESULT([yes])
1427
])# PKG_CHECK_MODULES
1430
# PKG_INSTALLDIR(DIRECTORY)
1431
# -------------------------
1432
# Substitutes the variable pkgconfigdir as the location where a module
1433
# should install pkg-config .pc files. By default the directory is
1434
# $libdir/pkgconfig, but the default can be changed by passing
1435
# DIRECTORY. The user can override through the --with-pkgconfigdir
1437
AC_DEFUN([PKG_INSTALLDIR],
1438
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1439
m4_pushdef([pkg_description],
1440
[pkg-config installation directory @<:@]pkg_default[@:>@])
1441
AC_ARG_WITH([pkgconfigdir],
1442
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1443
[with_pkgconfigdir=]pkg_default)
1444
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1445
m4_popdef([pkg_default])
1446
m4_popdef([pkg_description])
1447
]) dnl PKG_INSTALLDIR
1450
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
1451
# -------------------------
1452
# Substitutes the variable noarch_pkgconfigdir as the location where a
1453
# module should install arch-independent pkg-config .pc files. By
1454
# default the directory is $datadir/pkgconfig, but the default can be
1455
# changed by passing DIRECTORY. The user can override through the
1456
# --with-noarch-pkgconfigdir parameter.
1457
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
1458
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1459
m4_pushdef([pkg_description],
1460
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1461
AC_ARG_WITH([noarch-pkgconfigdir],
1462
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1463
[with_noarch_pkgconfigdir=]pkg_default)
1464
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1465
m4_popdef([pkg_default])
1466
m4_popdef([pkg_description])
1467
]) dnl PKG_NOARCH_INSTALLDIR
1469
AC_DEFUN([YELP_HELP_INIT],
1471
AC_REQUIRE([AC_PROG_LN_S])
1472
m4_pattern_allow([AM_V_at])
1473
m4_pattern_allow([AM_V_GEN])
1474
m4_pattern_allow([AM_DEFAULT_VERBOSITY])
1475
AC_ARG_WITH([help-dir],
1476
AC_HELP_STRING([--with-help-dir=DIR],
1477
[path where help files are installed]),,
1478
[with_help_dir='${datadir}/help'])
1479
HELP_DIR="$with_help_dir"
1482
AC_ARG_VAR([ITSTOOL], [Path to the `itstool` command])
1483
AC_CHECK_PROG([ITSTOOL], [itstool], [itstool])
1484
if test x"$ITSTOOL" = x; then
1485
AC_MSG_ERROR([itstool not found])
1488
AC_ARG_VAR([XMLLINT], [Path to the `xmllint` command])
1489
AC_CHECK_PROG([XMLLINT], [xmllint], [xmllint])
1490
if test x"$XMLLINT" = x; then
1491
AC_MSG_ERROR([xmllint not found])
1502
_HELP_LINGUAS = $(if $(filter environment,$(origin LINGUAS)),$(filter $(LINGUAS),$(HELP_LINGUAS)),$(HELP_LINGUAS))
1503
_HELP_POTFILE = $(if $(HELP_POT),$(HELP_POT),$(if $(HELP_ID),$(HELP_ID).pot))
1504
_HELP_POFILES = $(if $(HELP_ID),$(foreach lc,$(_HELP_LINGUAS),$(lc)/$(lc).po))
1505
_HELP_MOFILES = $(patsubst %.po,%.mo,$(_HELP_POFILES))
1506
_HELP_C_FILES = $(foreach f,$(HELP_FILES),C/$(f))
1507
_HELP_C_EXTRA = $(foreach f,$(HELP_EXTRA),C/$(f))
1508
_HELP_C_MEDIA = $(foreach f,$(HELP_MEDIA),C/$(f))
1509
_HELP_LC_FILES = $(foreach lc,$(_HELP_LINGUAS),$(foreach f,$(HELP_FILES),$(lc)/$(f)))
1510
_HELP_LC_STAMPS = $(foreach lc,$(_HELP_LINGUAS),$(lc)/$(lc).stamp)
1512
_HELP_DEFAULT_V = $(if $(AM_DEFAULT_VERBOSITY),$(AM_DEFAULT_VERBOSITY),1)
1513
_HELP_V = $(if $(V),$(V),$(_HELP_DEFAULT_V))
1514
_HELP_LC_VERBOSE = $(_HELP_LC_VERBOSE_$(_HELP_V))
1515
_HELP_LC_VERBOSE_ = $(_HELP_LC_VERBOSE_$(_HELP_DEFAULT_V))
1516
_HELP_LC_VERBOSE_0 = @echo " GEN "$(dir [$]@);
1518
all: $(_HELP_C_FILES) $(_HELP_C_EXTRA) $(_HELP_C_MEDIA) $(_HELP_LC_FILES) $(_HELP_POFILES)
1521
pot: $(_HELP_POTFILE)
1522
$(_HELP_POTFILE): $(_HELP_C_FILES) $(_HELP_C_EXTRA) $(_HELP_C_MEDIA)
1523
$(AM_V_GEN)$(ITSTOOL) -o "[$]@" $(_HELP_C_FILES)
1526
repo: $(_HELP_POTFILE)
1527
$(AM_V_at)for po in $(_HELP_POFILES); do \
1528
if test "x[$](_HELP_V)" = "x0"; then echo " GEN $${po}"; fi; \
1529
msgmerge -q -o "$${po}" "$${po}" "$(_HELP_POTFILE)"; \
1533
$(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
1534
$(AM_V_at)if test ! -f "[$]@" -a -f "$(srcdir)/[$]@"; then cp "$(srcdir)/[$]@" "[$]@"; fi
1535
$(AM_V_GEN)if ! test -f "[$]@"; then \
1536
(cd "$(dir [$]@)" && \
1537
$(ITSTOOL) -o "$(notdir [$]@).tmp" $(_HELP_C_FILES) && \
1538
mv "$(notdir [$]@).tmp" "$(notdir [$]@)"); \
1540
(cd "$(dir [$]@)" && \
1541
$(ITSTOOL) -o "$(notdir [$]@).tmp" $(_HELP_C_FILES) && \
1542
msgmerge -o "$(notdir [$]@)" "$(notdir [$]@)" "$(notdir [$]@).tmp" && \
1543
rm "$(notdir [$]@).tmp"); \
1546
$(_HELP_MOFILES): %.mo: %.po
1547
$(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
1548
$(AM_V_GEN)msgfmt -o "[$]@" "$<"
1550
$(_HELP_LC_FILES): $(_HELP_LINGUAS)
1551
$(_HELP_LINGUAS): $(_HELP_LC_STAMPS)
1552
$(_HELP_LC_STAMPS): %.stamp: %.mo
1553
$(_HELP_LC_STAMPS): $(_HELP_C_FILES) $(_HELP_C_EXTRA)
1554
$(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
1555
$(_HELP_LC_VERBOSE)if test -d "C"; then d="../"; else d="$(abs_srcdir)/"; fi; \
1556
mo="$(dir [$]@)$(patsubst %/$(notdir [$]@),%,[$]@).mo"; \
1557
if test -f "$${mo}"; then mo="../$${mo}"; else mo="$(abs_srcdir)/$${mo}"; fi; \
1558
(cd "$(dir [$]@)" && $(ITSTOOL) -m "$${mo}" $(foreach f,$(_HELP_C_FILES),$${d}/$(f))) && \
1562
mostlyclean-am: $(if $(HELP_ID),clean-help)
1564
rm -f $(_HELP_LC_FILES) $(_HELP_LC_STAMPS) $(_HELP_MOFILES)
1567
EXTRA_DIST += $(_HELP_C_EXTRA) $(_HELP_C_MEDIA)
1568
EXTRA_DIST += $(foreach lc,$(HELP_LINGUAS),$(lc)/$(lc).stamp)
1569
EXTRA_DIST += $(foreach lc,$(HELP_LINGUAS),$(lc)/$(lc).po)
1570
EXTRA_DIST += $(foreach f,$(HELP_MEDIA),$(foreach lc,$(HELP_LINGUAS),$(wildcard $(lc)/$(f))))
1572
distdir: distdir-help-files
1574
@for lc in C $(HELP_LINGUAS); do \
1575
$(MKDIR_P) "$(distdir)/$$lc"; \
1576
for file in $(HELP_FILES); do \
1577
if test -f "$$lc/$$file"; then d=./; else d=$(srcdir)/; fi; \
1578
cp -p "$$d$$lc/$$file" "$(distdir)/$$lc/" || exit 1; \
1585
for lc in C $(_HELP_LINGUAS); do \
1586
if test -d "$$lc"; \
1591
xmlpath="$$lc:$(srcdir)/$$lc"; \
1593
for page in $(HELP_FILES); do \
1594
echo "$(XMLLINT) --noout --noent --path $$xmlpath --xinclude $$d$$lc/$$page"; \
1595
$(XMLLINT) --noout --noent --path "$$xmlpath" --xinclude "$$d$$lc/$$page"; \
1600
.PHONY: install-help
1601
install-data-am: $(if $(HELP_ID),install-help)
1603
@for lc in C $(_HELP_LINGUAS); do \
1604
$(mkinstalldirs) "$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)" || exit 1; \
1606
@for lc in C $(_HELP_LINGUAS); do for f in $(HELP_FILES); do \
1607
if test -f "$$lc/$$f"; then d=; else d="$(srcdir)/"; fi; \
1608
helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
1609
if ! test -d "$$helpdir"; then $(mkinstalldirs) "$$helpdir"; fi; \
1610
echo "$(INSTALL_DATA) $$d$$lc/$$f $$helpdir`basename $$f`"; \
1611
$(INSTALL_DATA) "$$d$$lc/$$f" "$$helpdir`basename $$f`" || exit 1; \
1613
@for f in $(_HELP_C_EXTRA); do \
1614
lc=`dirname "$$f"`; lc=`basename "$$lc"`; \
1615
if test -f "$$f"; then d=; else d="$(srcdir)/"; fi; \
1616
helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
1617
if ! test -d "$$helpdir"; then $(mkinstalldirs) "$$helpdir"; fi; \
1618
echo "$(INSTALL_DATA) $$d$$f $$helpdir`basename $$f`"; \
1619
$(INSTALL_DATA) "$$d$$f" "$$helpdir`basename $$f`" || exit 1; \
1621
@for f in $(HELP_MEDIA); do \
1622
for lc in C $(_HELP_LINGUAS); do \
1623
if test -f "$$lc$$f"; then d=; else d="$(srcdir)/"; fi; \
1624
helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
1625
mdir=`dirname "$$f"`; \
1626
if test "x$mdir" = "x."; then mdir=""; fi; \
1627
if ! test -d "$$helpdir$$mdir"; then $(mkinstalldirs) "$$helpdir$$mdir"; fi; \
1628
if test -f "$$d$$lc/$$f"; then \
1629
echo "$(INSTALL_DATA) $$d$$lc/$$f $$helpdir$$f"; \
1630
$(INSTALL_DATA) "$$d$$lc/$$f" "$$helpdir$$f" || exit 1; \
1631
elif test "x$$lc" != "xC"; then \
1632
echo "$(LN_S) -f $(HELP_DIR)/C/$(HELP_ID)/$$f $$helpdir$$f"; \
1633
$(LN_S) -f "$(HELP_DIR)/C/$(HELP_ID)/$$f" "$$helpdir$$f" || exit 1; \
1638
.PHONY: uninstall-help
1639
uninstall-am: $(if $(HELP_ID),uninstall-help)
1641
for lc in C $(_HELP_LINGUAS); do for f in $(HELP_FILES); do \
1642
helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
1643
echo "rm -f $$helpdir`basename $$f`"; \
1644
rm -f "$$helpdir`basename $$f`"; \
1646
@for f in $(_HELP_C_EXTRA); do \
1647
lc=`dirname "$$f"`; lc=`basename "$$lc"`; \
1648
helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
1649
echo "rm -f $$helpdir`basename $$f`"; \
1650
rm -f "$$helpdir`basename $$f`"; \
1652
@for f in $(HELP_MEDIA); do \
1653
for lc in C $(_HELP_LINGUAS); do \
1654
helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
1655
echo "rm -f $$helpdir$$f"; \
1656
rm -f "$$helpdir$$f"; \
1660
AC_SUBST([YELP_HELP_RULES])
1661
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([YELP_HELP_RULES])])
1664
1664
m4_include([m4/gettext.m4])
1665
1665
m4_include([m4/iconv.m4])
1666
1666
m4_include([m4/intlmacosx.m4])