1 dnl PKG_CHECK_VAR(prefix, var, desc, pkg, [action-if-ok], [action-if-fail])
2 AC_DEFUN([PKG_CHECK_VAR],
3 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
4 AC_ARG_VAR(m4_toupper([$1][_$2]), [$3, overriding pkg-config])dnl
6 m4_define([_PKG_VAR_TEXT], [dnl
7 Alternately, you may set the environment variable m4_toupper([$1][_$2]) to
8 avoid the need to call pkg-config.
9 See the pkg-config man page for more details.])
12 AC_MSG_CHECKING([for $3])
13 if test x"$[]m4_toupper([$1][_$2])" = x; then
14 _PKG_CONFIG([$1][_$2], [variable=$2], [$4])
16 pkg_cv_$1[]_$2="$[]m4_toupper([$1][_$2])"
19 if test x"[$pkg_cv_$1][_$2]" = x; then
20 if test $pkg_failed = yes; then
21 _PKG_SHORT_ERRORS_SUPPORTED
22 if test $_pkg_short_errors_supported = yes; then
23 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$4" 2>&1`
25 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$4" 2>&1`
27 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
31 Package requirements ($4) were not met:
35 Consider adjusting the PKG_CONFIG_PATH environment variable if you installed
36 software in a non-standard prefix.
40 [AC_MSG_RESULT([unknown])
42 elif test $pkg_failed = untried; then
45 The pkg-config script could not be found or is too old. Make sure it is in
46 your PATH or set the PKG_CONFIG environment variable to the full path to
51 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
56 The variable ``$2'' was not defined in the package description database for dnl
57 m4_apply([m4_car], m4_split([$4])).
59 Consider adjusting the PKG_CONFIG_PATH environment variable if you installed
60 software in a non-standard prefix.
64 [AC_MSG_RESULT([unknown])
68 $1[]_$2=$pkg_cv_$1[]_$2
69 AC_MSG_RESULT([$$1][_$2])
70 ifelse([$5], , :, [$5])