1033
1033
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1035
1035
if test -n "$PKG_CONFIG"; then
1036
_pkg_min_version=m4_default([$1], [0.9.0])
1036
_pkg_min_version=m4_ifval([$1], [$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])
1046
1046
])# PKG_PROG_PKG_CONFIG
1048
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1050
# Check to see whether a particular set of modules exists. Similar
1051
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1054
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1055
# this or PKG_CHECK_MODULES is called, or make sure to call
1056
# PKG_CHECK_EXISTS manually
1057
# --------------------------------------------------------------
1058
AC_DEFUN([PKG_CHECK_EXISTS],
1059
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1060
if test -n "$PKG_CONFIG" && \
1061
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1062
m4_ifval([$2], [$2], [:])
1063
m4_ifvaln([$3], [else
1068
1048
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1069
1049
# ---------------------------------------------
1070
1050
m4_define([_PKG_CONFIG],
1071
[if test -n "$PKG_CONFIG"; then
1072
if test -n "$$1"; then
1075
PKG_CHECK_EXISTS([$3],
1076
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1051
[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then
1052
pkg_cv_[]$1=$ac_cv_env_[]$1[]_value
1053
elif test -n "$PKG_CONFIG"; then
1054
if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then
1055
pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1080
1060
pkg_failed=untried
1082
1062
])# _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
1096
1064
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1097
1065
# [ACTION-IF-NOT-FOUND])
1100
1068
# Note that if there is a possibility the first call to
1101
1069
# PKG_CHECK_MODULES might not happen, you should be sure to include an
1102
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1070
# explicit call to PKG_PROG_PKG_CONFIG in your configure.in
1105
1073
# --------------------------------------------------------------
1109
1077
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1112
AC_MSG_CHECKING([for $1])
1114
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
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.])
1080
AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS],
1081
[_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])])
1082
AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS],
1083
[_PKG_CONFIG([$1][_LIBS], [libs], [$2])])
1121
1085
if test $pkg_failed = yes; then
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"`
1086
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1128
1087
# Put the nasty error message in config.log where it belongs
1129
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1088
echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD
1131
1090
ifelse([$4], , [AC_MSG_ERROR(dnl
1132
[Package requirements ($2) were not met:
1091
[Package requirements ($2) were not met.
1136
1092
Consider adjusting the PKG_CONFIG_PATH environment variable if you
1137
1093
installed software in a non-standard prefix.
1095
Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
1096
to avoid the need to call pkg-config. See the pkg-config man page for
1142
1099
elif test $pkg_failed = untried; then
1143
1100
ifelse([$4], , [AC_MSG_FAILURE(dnl
1145
1102
is in your PATH or set the PKG_CONFIG environment variable to the full
1146
1103
path to pkg-config.
1105
Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
1106
to avoid the need to call pkg-config. See the pkg-config man page for
1150
1109
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
1153
1112
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1154
1113
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1155
AC_MSG_RESULT([yes])
1156
1114
ifelse([$3], , :, [$3])
1158
1116
])# PKG_CHECK_MODULES