| 1254 |
@@ -1254,3 +1254,158 @@ |
| 1254 |
])# PKG_CHECK_MODULES
|
| 1255 |
|
| 1256 |
|
| 1257 |
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
| 1258 |
#
|
| 1259 |
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
| 1260 |
#
|
| 1261 |
# This program is free software; you can redistribute it and/or modify
|
| 1262 |
# it under the terms of the GNU General Public License as published by
|
| 1263 |
# the Free Software Foundation; either version 2 of the License, or
|
| 1264 |
# (at your option) any later version.
|
| 1265 |
#
|
| 1266 |
# This program is distributed in the hope that it will be useful, but
|
| 1267 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 1268 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 1269 |
# General Public License for more details.
|
| 1270 |
#
|
| 1271 |
# You should have received a copy of the GNU General Public License
|
| 1272 |
# along with this program; if not, write to the Free Software
|
| 1273 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 1274 |
#
|
| 1275 |
# As a special exception to the GNU General Public License, if you
|
| 1276 |
# distribute this file as part of a program that contains a
|
| 1277 |
# configuration script generated by Autoconf, you may include it under
|
| 1278 |
# the same distribution terms that you use for the rest of that program.
|
| 1279 |
|
| 1280 |
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
| 1281 |
# ----------------------------------
|
| 1282 |
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
| 1283 |
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
| 1284 |
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
|
| 1285 |
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
|
| 1286 |
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
| 1287 |
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
| 1288 |
fi
|
| 1289 |
if test -n "$PKG_CONFIG"; then
|
| 1290 |
_pkg_min_version=m4_default([$1], [0.9.0])
|
| 1291 |
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
| 1292 |
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
| 1293 |
AC_MSG_RESULT([yes])
|
| 1294 |
else
|
| 1295 |
AC_MSG_RESULT([no])
|
| 1296 |
PKG_CONFIG=""
|
| 1297 |
fi
|
| 1298 |
|
| 1299 |
fi[]dnl
|
| 1300 |
])# PKG_PROG_PKG_CONFIG
|
| 1301 |
|
| 1302 |
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
| 1303 |
#
|
| 1304 |
# Check to see whether a particular set of modules exists. Similar
|
| 1305 |
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
|
| 1306 |
#
|
| 1307 |
#
|
| 1308 |
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
|
| 1309 |
# this or PKG_CHECK_MODULES is called, or make sure to call
|
| 1310 |
# PKG_CHECK_EXISTS manually
|
| 1311 |
# --------------------------------------------------------------
|
| 1312 |
AC_DEFUN([PKG_CHECK_EXISTS],
|
| 1313 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
| 1314 |
if test -n "$PKG_CONFIG" && \
|
| 1315 |
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
| 1316 |
m4_ifval([$2], [$2], [:])
|
| 1317 |
m4_ifvaln([$3], [else
|
| 1318 |
$3])dnl
|
| 1319 |
fi])
|
| 1320 |
|
| 1321 |
|
| 1322 |
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
| 1323 |
# ---------------------------------------------
|
| 1324 |
m4_define([_PKG_CONFIG],
|
| 1325 |
[if test -n "$$1"; then
|
| 1326 |
pkg_cv_[]$1="$$1"
|
| 1327 |
elif test -n "$PKG_CONFIG"; then
|
| 1328 |
PKG_CHECK_EXISTS([$3],
|
| 1329 |
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
|
| 1330 |
[pkg_failed=yes])
|
| 1331 |
else
|
| 1332 |
pkg_failed=untried
|
| 1333 |
fi[]dnl
|
| 1334 |
])# _PKG_CONFIG
|
| 1335 |
|
| 1336 |
# _PKG_SHORT_ERRORS_SUPPORTED
|
| 1337 |
# -----------------------------
|
| 1338 |
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
| 1339 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
| 1340 |
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
| 1341 |
_pkg_short_errors_supported=yes
|
| 1342 |
else
|
| 1343 |
_pkg_short_errors_supported=no
|
| 1344 |
fi[]dnl
|
| 1345 |
])# _PKG_SHORT_ERRORS_SUPPORTED
|
| 1346 |
|
| 1347 |
|
| 1348 |
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
| 1349 |
# [ACTION-IF-NOT-FOUND])
|
| 1350 |
#
|
| 1351 |
#
|
| 1352 |
# Note that if there is a possibility the first call to
|
| 1353 |
# PKG_CHECK_MODULES might not happen, you should be sure to include an
|
| 1354 |
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
| 1355 |
#
|
| 1356 |
#
|
| 1357 |
# --------------------------------------------------------------
|
| 1358 |
AC_DEFUN([PKG_CHECK_MODULES],
|
| 1359 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
| 1360 |
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
| 1361 |
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
| 1362 |
|
| 1363 |
pkg_failed=no
|
| 1364 |
AC_MSG_CHECKING([for $1])
|
| 1365 |
|
| 1366 |
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
| 1367 |
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
| 1368 |
|
| 1369 |
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
| 1370 |
and $1[]_LIBS to avoid the need to call pkg-config.
|
| 1371 |
See the pkg-config man page for more details.])
|
| 1372 |
|
| 1373 |
if test $pkg_failed = yes; then
|
| 1374 |
_PKG_SHORT_ERRORS_SUPPORTED
|
| 1375 |
if test $_pkg_short_errors_supported = yes; then
|
| 1376 |
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
|
| 1377 |
else
|
| 1378 |
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
|
| 1379 |
fi
|
| 1380 |
# Put the nasty error message in config.log where it belongs
|
| 1381 |
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
| 1382 |
|
| 1383 |
ifelse([$4], , [AC_MSG_ERROR(dnl
|
| 1384 |
[Package requirements ($2) were not met:
|
| 1385 |
|
| 1386 |
$$1_PKG_ERRORS
|
| 1387 |
|
| 1388 |
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
| 1389 |
installed software in a non-standard prefix.
|
| 1390 |
|
| 1391 |
_PKG_TEXT
|
| 1392 |
])],
|
| 1393 |
[AC_MSG_RESULT([no])
|
| 1394 |
$4])
|
| 1395 |
elif test $pkg_failed = untried; then
|
| 1396 |
ifelse([$4], , [AC_MSG_FAILURE(dnl
|
| 1397 |
[The pkg-config script could not be found or is too old. Make sure it
|
| 1398 |
is in your PATH or set the PKG_CONFIG environment variable to the full
|
| 1399 |
path to pkg-config.
|
| 1400 |
|
| 1401 |
_PKG_TEXT
|
| 1402 |
|
| 1403 |
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
|
| 1404 |
[$4])
|
| 1405 |
else
|
| 1406 |
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
| 1407 |
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
| 1408 |
AC_MSG_RESULT([yes])
|
| 1409 |
ifelse([$3], , :, [$3])
|
| 1410 |
fi[]dnl
|
| 1411 |
])# PKG_CHECK_MODULES
|
| ... |
|