6671
6671
AC_MSG_RESULT([$SED])
6674
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
6676
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
6678
# This program is free software; you can redistribute it and/or modify
6679
# it under the terms of the GNU General Public License as published by
6680
# the Free Software Foundation; either version 2 of the License, or
6681
# (at your option) any later version.
6683
# This program is distributed in the hope that it will be useful, but
6684
# WITHOUT ANY WARRANTY; without even the implied warranty of
6685
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6686
# General Public License for more details.
6688
# You should have received a copy of the GNU General Public License
6689
# along with this program; if not, write to the Free Software
6690
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6692
# As a special exception to the GNU General Public License, if you
6693
# distribute this file as part of a program that contains a
6694
# configuration script generated by Autoconf, you may include it under
6695
# the same distribution terms that you use for the rest of that program.
6697
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
6698
# ----------------------------------
6699
AC_DEFUN([PKG_PROG_PKG_CONFIG],
6700
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
6701
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
6702
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
6703
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
6704
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
6706
if test -n "$PKG_CONFIG"; then
6707
_pkg_min_version=m4_default([$1], [0.9.0])
6708
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
6709
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
6710
AC_MSG_RESULT([yes])
6717
])# PKG_PROG_PKG_CONFIG
6719
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
6721
# Check to see whether a particular set of modules exists. Similar
6722
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
6725
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
6726
# this or PKG_CHECK_MODULES is called, or make sure to call
6727
# PKG_CHECK_EXISTS manually
6728
# --------------------------------------------------------------
6729
AC_DEFUN([PKG_CHECK_EXISTS],
6730
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
6731
if test -n "$PKG_CONFIG" && \
6732
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
6733
m4_ifval([$2], [$2], [:])
6734
m4_ifvaln([$3], [else
6739
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
6740
# ---------------------------------------------
6741
m4_define([_PKG_CONFIG],
6742
[if test -n "$PKG_CONFIG"; then
6743
if test -n "$$1"; then
6746
PKG_CHECK_EXISTS([$3],
6747
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
6755
# _PKG_SHORT_ERRORS_SUPPORTED
6756
# -----------------------------
6757
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
6758
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
6759
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
6760
_pkg_short_errors_supported=yes
6762
_pkg_short_errors_supported=no
6764
])# _PKG_SHORT_ERRORS_SUPPORTED
6767
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
6768
# [ACTION-IF-NOT-FOUND])
6771
# Note that if there is a possibility the first call to
6772
# PKG_CHECK_MODULES might not happen, you should be sure to include an
6773
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
6776
# --------------------------------------------------------------
6777
AC_DEFUN([PKG_CHECK_MODULES],
6778
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
6779
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
6780
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
6783
AC_MSG_CHECKING([for $1])
6785
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
6786
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
6788
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
6789
and $1[]_LIBS to avoid the need to call pkg-config.
6790
See the pkg-config man page for more details.])
6792
if test $pkg_failed = yes; then
6793
_PKG_SHORT_ERRORS_SUPPORTED
6794
if test $_pkg_short_errors_supported = yes; then
6795
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
6797
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
6799
# Put the nasty error message in config.log where it belongs
6800
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
6802
ifelse([$4], , [AC_MSG_ERROR(dnl
6803
[Package requirements ($2) were not met:
6807
Consider adjusting the PKG_CONFIG_PATH environment variable if you
6808
installed software in a non-standard prefix.
6812
[AC_MSG_RESULT([no])
6814
elif test $pkg_failed = untried; then
6815
ifelse([$4], , [AC_MSG_FAILURE(dnl
6816
[The pkg-config script could not be found or is too old. Make sure it
6817
is in your PATH or set the PKG_CONFIG environment variable to the full
6822
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
6825
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
6826
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
6827
AC_MSG_RESULT([yes])
6828
ifelse([$3], , :, [$3])
6830
])# PKG_CHECK_MODULES
6674
6832
# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
6676
6834
# This file is free software; the Free Software Foundation