summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Michael <fedora.dm0@gmail.com>2012-12-11 19:42:02 -0500
committerDan Nicholson <dbn.lists@gmail.com>2012-12-14 14:13:41 -0800
commit5b463c927b6caeb332bb147572ea82b1650ceb7d (patch)
treeb83a9acce6ca0a9653220a20c14c358750ed372d
parent86c45f0422e375373407e965f68d0bd4984d547c (diff)
downloadpkg-config-5b463c927b6caeb332bb147572ea82b1650ceb7d.tar.gz
Include PKG_CHECK_VAR macro for reading variables in .pc files
Freedesktop #48098 (https://bugs.freedesktop.org/show_bug.cgi?id=48098)
-rw-r--r--pkg-config.17
-rw-r--r--pkg.m415
2 files changed, 22 insertions, 0 deletions
diff --git a/pkg-config.1 b/pkg-config.1
index a5c1513..d76fd51 100644
--- a/pkg-config.1
+++ b/pkg-config.1
@@ -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,
diff --git a/pkg.m4 b/pkg.m4
index f26f84c..c5b26b5 100644
--- a/pkg.m4
+++ b/pkg.m4
@@ -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