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
22
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
224
24
# This file is free software; the Free Software Foundation
1529
1329
AC_SUBST([am__untar])
1530
1330
]) # _AM_PROG_TAR
1332
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
1333
# serial 1 (pkg-config-0.24)
1335
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1337
# This program is free software; you can redistribute it and/or modify
1338
# it under the terms of the GNU General Public License as published by
1339
# the Free Software Foundation; either version 2 of the License, or
1340
# (at your option) any later version.
1342
# This program is distributed in the hope that it will be useful, but
1343
# WITHOUT ANY WARRANTY; without even the implied warranty of
1344
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1345
# General Public License for more details.
1347
# You should have received a copy of the GNU General Public License
1348
# along with this program; if not, write to the Free Software
1349
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1351
# As a special exception to the GNU General Public License, if you
1352
# distribute this file as part of a program that contains a
1353
# configuration script generated by Autoconf, you may include it under
1354
# the same distribution terms that you use for the rest of that program.
1356
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1357
# ----------------------------------
1358
AC_DEFUN([PKG_PROG_PKG_CONFIG],
1359
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1360
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1361
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1362
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1363
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1364
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1366
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1367
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1369
if test -n "$PKG_CONFIG"; then
1370
_pkg_min_version=m4_default([$1], [0.9.0])
1371
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1372
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1373
AC_MSG_RESULT([yes])
1379
])# PKG_PROG_PKG_CONFIG
1381
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1383
# Check to see whether a particular set of modules exists. Similar
1384
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1386
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1387
# only at the first occurence in configure.ac, so if the first place
1388
# it's called might be skipped (such as if it is within an "if", you
1389
# have to call PKG_CHECK_EXISTS manually
1390
# --------------------------------------------------------------
1391
AC_DEFUN([PKG_CHECK_EXISTS],
1392
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1393
if test -n "$PKG_CONFIG" && \
1394
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1395
m4_default([$2], [:])
1396
m4_ifvaln([$3], [else
1400
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1401
# ---------------------------------------------
1402
m4_define([_PKG_CONFIG],
1403
[if test -n "$$1"; then
1405
elif test -n "$PKG_CONFIG"; then
1406
PKG_CHECK_EXISTS([$3],
1407
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1408
test "x$?" != "x0" && pkg_failed=yes ],
1415
# _PKG_SHORT_ERRORS_SUPPORTED
1416
# -----------------------------
1417
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1418
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1419
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1420
_pkg_short_errors_supported=yes
1422
_pkg_short_errors_supported=no
1424
])# _PKG_SHORT_ERRORS_SUPPORTED
1427
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1428
# [ACTION-IF-NOT-FOUND])
1431
# Note that if there is a possibility the first call to
1432
# PKG_CHECK_MODULES might not happen, you should be sure to include an
1433
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1436
# --------------------------------------------------------------
1437
AC_DEFUN([PKG_CHECK_MODULES],
1438
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1439
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1440
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1443
AC_MSG_CHECKING([for $1])
1445
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1446
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1448
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1449
and $1[]_LIBS to avoid the need to call pkg-config.
1450
See the pkg-config man page for more details.])
1452
if test $pkg_failed = yes; then
1454
_PKG_SHORT_ERRORS_SUPPORTED
1455
if test $_pkg_short_errors_supported = yes; then
1456
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1458
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1460
# Put the nasty error message in config.log where it belongs
1461
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1463
m4_default([$4], [AC_MSG_ERROR(
1464
[Package requirements ($2) were not met:
1468
Consider adjusting the PKG_CONFIG_PATH environment variable if you
1469
installed software in a non-standard prefix.
1473
elif test $pkg_failed = untried; then
1475
m4_default([$4], [AC_MSG_FAILURE(
1476
[The pkg-config script could not be found or is too old. Make sure it
1477
is in your PATH or set the PKG_CONFIG environment variable to the full
1482
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1485
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1486
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1487
AC_MSG_RESULT([yes])
1490
])# PKG_CHECK_MODULES
1493
# PKG_INSTALLDIR(DIRECTORY)
1494
# -------------------------
1495
# Substitutes the variable pkgconfigdir as the location where a module
1496
# should install pkg-config .pc files. By default the directory is
1497
# $libdir/pkgconfig, but the default can be changed by passing
1498
# DIRECTORY. The user can override through the --with-pkgconfigdir
1500
AC_DEFUN([PKG_INSTALLDIR],
1501
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1502
m4_pushdef([pkg_description],
1503
[pkg-config installation directory @<:@]pkg_default[@:>@])
1504
AC_ARG_WITH([pkgconfigdir],
1505
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1506
[with_pkgconfigdir=]pkg_default)
1507
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1508
m4_popdef([pkg_default])
1509
m4_popdef([pkg_description])
1510
]) dnl PKG_INSTALLDIR
1513
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
1514
# -------------------------
1515
# Substitutes the variable noarch_pkgconfigdir as the location where a
1516
# module should install arch-independent pkg-config .pc files. By
1517
# default the directory is $datadir/pkgconfig, but the default can be
1518
# changed by passing DIRECTORY. The user can override through the
1519
# --with-noarch-pkgconfigdir parameter.
1520
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
1521
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1522
m4_pushdef([pkg_description],
1523
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1524
AC_ARG_WITH([noarch-pkgconfigdir],
1525
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1526
[with_noarch_pkgconfigdir=]pkg_default)
1527
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1528
m4_popdef([pkg_default])
1529
m4_popdef([pkg_description])
1530
]) dnl PKG_NOARCH_INSTALLDIR
1532
1532
m4_include([m4macros/attributes.m4])
1533
1533
m4_include([m4macros/gtk-doc.m4])
1534
1534
m4_include([m4macros/libtool.m4])