Include PKG_CHECK_VAR macro for reading variables in .pc files

Freedesktop #48098 (https://bugs.freedesktop.org/show_bug.cgi?id=48098)
This commit is contained in:
David Michael 2012-12-11 19:42:02 -05:00 committed by Dan Nicholson
parent 86c45f0422
commit 5b463c927b
2 changed files with 22 additions and 0 deletions

View file

@ -362,6 +362,13 @@ module should install arch-independent pkg-config .pc files. By default
the directory is $datadir/pkgconfig, but the default can be changed by
passing DIRECTORY. The user can override through the
--with-noarch-pkgconfigdir parameter.
.TP
.I "PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])"
Retrieves the value of the pkg-config variable CONFIG-VARIABLE from
MODULE and stores it in VARIABLE. Note that repeated usage of VARIABLE
is not recommended as the check will be skipped if the variable is
already set.
.SH METADATA FILE SYNTAX
To add a library to the set of packages \fIpkg-config\fP knows about,

15
pkg.m4
View file

@ -197,3 +197,18 @@ AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_NOARCH_INSTALLDIR
# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -------------------------------------------
# Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])# PKG_CHECK_VAR