main: implement support for PKG_CONFIG_TOP_BUILD_DIR (issue #6)

pull/15/merge
William Pitcock 2012-05-07 03:33:00 -05:00
parent a5347c8b4f
commit 1b845b4310
1 changed files with 6 additions and 0 deletions

6
main.c
View File

@ -482,6 +482,7 @@ main(int argc, char *argv[])
int ret; int ret;
pkg_queue_t *pkgq = NULL; pkg_queue_t *pkgq = NULL;
pkg_queue_t *pkgq_head = NULL; pkg_queue_t *pkgq_head = NULL;
char *builddir;
struct option options[] = { struct option options[] = {
{ "version", no_argument, &want_version, 1, }, { "version", no_argument, &want_version, 1, },
@ -574,6 +575,11 @@ main(int argc, char *argv[])
if (getenv("PKG_CONFIG_ALLOW_SYSTEM_LIBS") != NULL) if (getenv("PKG_CONFIG_ALLOW_SYSTEM_LIBS") != NULL)
want_keep_system_libs = 1; want_keep_system_libs = 1;
if ((builddir = getenv("PKG_CONFIG_TOP_BUILD_DIR")) != NULL)
pkg_tuple_add_global("pc_top_builddir", builddir);
else
pkg_tuple_add_global("pc_top_builddir", "$(top_builddir)");
if (required_pkgconfig_version != NULL) if (required_pkgconfig_version != NULL)
{ {
if (pkg_compare_version(PKG_PKGCONFIG_VERSION_EQUIV, required_pkgconfig_version) >= 0) if (pkg_compare_version(PKG_PKGCONFIG_VERSION_EQUIV, required_pkgconfig_version) >= 0)