8048
8048
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
8050
8050
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
8051
# serial 1 (pkg-config-0.24)
8052
8053
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
8075
8076
AC_DEFUN([PKG_PROG_PKG_CONFIG],
8076
8077
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8077
8078
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
8078
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
8079
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8080
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8081
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
8079
8083
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8080
8084
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
8097
8100
# Check to see whether a particular set of modules exists. Similar
8098
8101
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
8101
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
8102
# this or PKG_CHECK_MODULES is called, or make sure to call
8103
# PKG_CHECK_EXISTS manually
8103
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
8104
# only at the first occurence in configure.ac, so if the first place
8105
# it's called might be skipped (such as if it is within an "if", you
8106
# have to call PKG_CHECK_EXISTS manually
8104
8107
# --------------------------------------------------------------
8105
8108
AC_DEFUN([PKG_CHECK_EXISTS],
8106
8109
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
8107
8110
if test -n "$PKG_CONFIG" && \
8108
8111
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
8109
m4_ifval([$2], [$2], [:])
8112
m4_default([$2], [:])
8110
8113
m4_ifvaln([$3], [else
8115
8117
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
8116
8118
# ---------------------------------------------
8117
8119
m4_define([_PKG_CONFIG],
8118
[if test -n "$PKG_CONFIG"; then
8119
if test -n "$$1"; then
8122
PKG_CHECK_EXISTS([$3],
8123
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
8120
[if test -n "$$1"; then
8122
elif test -n "$PKG_CONFIG"; then
8123
PKG_CHECK_EXISTS([$3],
8124
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
8129
8129
])# _PKG_CONFIG
8166
8166
See the pkg-config man page for more details.])
8168
8168
if test $pkg_failed = yes; then
8169
8170
_PKG_SHORT_ERRORS_SUPPORTED
8170
8171
if test $_pkg_short_errors_supported = yes; then
8171
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
8172
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
8173
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
8174
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
8175
8176
# Put the nasty error message in config.log where it belongs
8176
8177
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
8178
ifelse([$4], , [AC_MSG_ERROR(dnl
8179
m4_default([$4], [AC_MSG_ERROR(
8179
8180
[Package requirements ($2) were not met:
8183
8184
Consider adjusting the PKG_CONFIG_PATH environment variable if you
8184
8185
installed software in a non-standard prefix.
8188
[AC_MSG_RESULT([no])
8190
8189
elif test $pkg_failed = untried; then
8191
ifelse([$4], , [AC_MSG_FAILURE(dnl
8191
m4_default([$4], [AC_MSG_FAILURE(
8192
8192
[The pkg-config script could not be found or is too old. Make sure it
8193
8193
is in your PATH or set the PKG_CONFIG environment variable to the full
8194
8194
path to pkg-config.
8198
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
8198
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
8201
8201
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
8202
8202
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
8203
8203
AC_MSG_RESULT([yes])
8204
ifelse([$3], , :, [$3])
8206
8206
])# PKG_CHECK_MODULES