931
931
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
933
933
if test -n "$PKG_CONFIG"; then
934
_pkg_min_version=m4_ifval([$1], [$1], [0.9.0])
934
_pkg_min_version=m4_default([$1], [0.9.0])
935
935
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
936
936
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
937
937
AC_MSG_RESULT([yes])
967
967
# ---------------------------------------------
968
968
m4_define([_PKG_CONFIG],
969
969
[if test -n "$PKG_CONFIG"; then
970
if test -n "$$1"; then
970
973
PKG_CHECK_EXISTS([$3],
971
974
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
972
975
[pkg_failed=yes])
974
978
pkg_failed=untried
982
# _PKG_SHORT_ERRORS_SUPPORTED
983
# -----------------------------
984
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
985
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
986
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
987
_pkg_short_errors_supported=yes
989
_pkg_short_errors_supported=no
991
])# _PKG_SHORT_ERRORS_SUPPORTED
978
994
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
979
995
# [ACTION-IF-NOT-FOUND])
996
1012
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
997
1013
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1015
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1016
and $1[]_LIBS to avoid the need to call pkg-config.
1017
See the pkg-config man page for more details.])
999
1019
if test $pkg_failed = yes; then
1000
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1020
_PKG_SHORT_ERRORS_SUPPORTED
1021
if test $_pkg_short_errors_supported = yes; then
1022
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
1024
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1001
1026
# Put the nasty error message in config.log where it belongs
1002
echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD
1027
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1004
1029
ifelse([$4], , [AC_MSG_ERROR(dnl
1005
[Package requirements ($2) were not met.
1030
[Package requirements ($2) were not met:
1006
1034
Consider adjusting the PKG_CONFIG_PATH environment variable if you
1007
1035
installed software in a non-standard prefix.
1009
Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
1010
to avoid the need to call pkg-config. See the pkg-config man page for
1013
1040
elif test $pkg_failed = untried; then
1014
1041
ifelse([$4], , [AC_MSG_FAILURE(dnl
1016
1043
is in your PATH or set the PKG_CONFIG environment variable to the full
1017
1044
path to pkg-config.
1019
Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
1020
to avoid the need to call pkg-config. See the pkg-config man page for
1023
1048
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],