79
80
AC_DEFUN([PKG_PROG_PKG_CONFIG],
80
81
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
81
82
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
82
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
83
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
84
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
85
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
83
87
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
84
88
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
101
104
# Check to see whether a particular set of modules exists. Similar
102
105
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
105
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
106
# this or PKG_CHECK_MODULES is called, or make sure to call
107
# PKG_CHECK_EXISTS manually
107
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
108
# only at the first occurence in configure.ac, so if the first place
109
# it's called might be skipped (such as if it is within an "if", you
110
# have to call PKG_CHECK_EXISTS manually
108
111
# --------------------------------------------------------------
109
112
AC_DEFUN([PKG_CHECK_EXISTS],
110
113
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
111
114
if test -n "$PKG_CONFIG" && \
112
115
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
113
m4_ifval([$2], [$2], [:])
116
m4_default([$2], [:])
114
117
m4_ifvaln([$3], [else
119
121
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
120
122
# ---------------------------------------------
121
123
m4_define([_PKG_CONFIG],
122
[if test -n "$PKG_CONFIG"; then
123
if test -n "$$1"; then
126
PKG_CHECK_EXISTS([$3],
127
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
124
[if test -n "$$1"; then
126
elif test -n "$PKG_CONFIG"; then
127
PKG_CHECK_EXISTS([$3],
128
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
170
170
See the pkg-config man page for more details.])
172
172
if test $pkg_failed = yes; then
173
174
_PKG_SHORT_ERRORS_SUPPORTED
174
175
if test $_pkg_short_errors_supported = yes; then
175
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
176
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
177
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
178
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
179
180
# Put the nasty error message in config.log where it belongs
180
181
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
182
ifelse([$4], , [AC_MSG_ERROR(dnl
183
m4_default([$4], [AC_MSG_ERROR(
183
184
[Package requirements ($2) were not met:
187
188
Consider adjusting the PKG_CONFIG_PATH environment variable if you
188
189
installed software in a non-standard prefix.
194
193
elif test $pkg_failed = untried; then
195
ifelse([$4], , [AC_MSG_FAILURE(dnl
195
m4_default([$4], [AC_MSG_FAILURE(
196
196
[The pkg-config script could not be found or is too old. Make sure it
197
197
is in your PATH or set the PKG_CONFIG environment variable to the full
198
198
path to pkg-config.
202
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
202
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
205
205
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
206
206
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
207
207
AC_MSG_RESULT([yes])
208
ifelse([$3], , :, [$3])
210
210
])# PKG_CHECK_MODULES