1033
1033
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1035
1035
if test -n "$PKG_CONFIG"; then
1036
_pkg_min_version=m4_ifval([$1], [$1], [0.9.0])
1036
_pkg_min_version=m4_default([$1], [0.9.0])
1037
1037
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1038
1038
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1039
1039
AC_MSG_RESULT([yes])
1069
1069
# ---------------------------------------------
1070
1070
m4_define([_PKG_CONFIG],
1071
1071
[if test -n "$PKG_CONFIG"; then
1072
if test -n "$$1"; then
1072
1075
PKG_CHECK_EXISTS([$3],
1073
1076
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1074
1077
[pkg_failed=yes])
1076
1080
pkg_failed=untried
1078
1082
])# _PKG_CONFIG
1084
# _PKG_SHORT_ERRORS_SUPPORTED
1085
# -----------------------------
1086
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1087
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1088
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1089
_pkg_short_errors_supported=yes
1091
_pkg_short_errors_supported=no
1093
])# _PKG_SHORT_ERRORS_SUPPORTED
1080
1096
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1081
1097
# [ACTION-IF-NOT-FOUND])
1098
1114
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1099
1115
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1117
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1118
and $1[]_LIBS to avoid the need to call pkg-config.
1119
See the pkg-config man page for more details.])
1101
1121
if test $pkg_failed = yes; then
1102
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1122
_PKG_SHORT_ERRORS_SUPPORTED
1123
if test $_pkg_short_errors_supported = yes; then
1124
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
1126
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1103
1128
# Put the nasty error message in config.log where it belongs
1104
echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD
1129
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1106
1131
ifelse([$4], , [AC_MSG_ERROR(dnl
1107
[Package requirements ($2) were not met.
1132
[Package requirements ($2) were not met:
1108
1136
Consider adjusting the PKG_CONFIG_PATH environment variable if you
1109
1137
installed software in a non-standard prefix.
1111
Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
1112
to avoid the need to call pkg-config. See the pkg-config man page for
1115
1142
elif test $pkg_failed = untried; then
1116
1143
ifelse([$4], , [AC_MSG_FAILURE(dnl
1118
1145
is in your PATH or set the PKG_CONFIG environment variable to the full
1119
1146
path to pkg-config.
1121
Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
1122
to avoid the need to call pkg-config. See the pkg-config man page for
1125
1150
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],