diff -upk.orig pkg-config-0.20.orig/main.c pkg-config-0.20/main.c --- pkg-config-0.20.orig/main.c 2005-10-16 18:04:50 +0000 +++ pkg-config-0.20/main.c 2006-02-02 00:17:40 +0000 @@ -188,6 +188,8 @@ main (int argc, char **argv) int want_uninstalled = 0; char *variable_name = NULL; int want_exists = 0; + int want_prov = 0; + int want_req = 0; char *required_atleast_version = NULL; char *required_exact_version = NULL; char *required_max_version = NULL; @@ -257,6 +259,10 @@ main (int argc, char **argv) "show verbose information about missing or conflicting packages" }, { "errors-to-stdout", 0, POPT_ARG_NONE, &want_stdout_errors, 0, "print errors from --print-errors to stdout not stderr" }, + { "print-provides", 0, POPT_ARG_NONE, &want_prov, 0, + "print which packages the package provides" }, + { "print-requires", 0, POPT_ARG_NONE, &want_req, 0, + "print which packages the package requires" }, #ifdef G_OS_WIN32 { "dont-define-prefix", 0, POPT_ARG_NONE, &dont_define_prefix, 0, "don't try to override the value of prefix for each .pc file found with " @@ -560,6 +566,47 @@ main (int argc, char **argv) } } + if (want_prov) + { + GSList *tmp; + tmp = packages; + while (tmp != NULL) + { + Package *pkg = tmp->data; + char *key; + key = pkg->key; + while (*key == '/') + key++; + if (strlen(key) > 0) + printf ("%s = %s\n", key, pkg->version); + tmp = g_slist_next (tmp); + } + } + + if (want_req) + { + GSList *pkgtmp = packages; + while (pkgtmp != NULL) + { + Package *pkg = pkgtmp->data; + GSList *reqtmp = pkg->requires; + while (reqtmp != NULL) + { + Package *deppkg = reqtmp->data; + RequiredVersion *req; + req = g_hash_table_lookup(pkg->required_versions, deppkg->key); + if ((req == NULL) || (req->comparison == ALWAYS_MATCH)) + printf ("%s\n", deppkg->key); + else + printf ("%s %s %s\n", deppkg->key, + comparison_to_str(req->comparison), + req->version); + reqtmp = g_slist_next (reqtmp); + } + pkgtmp = g_slist_next (pkgtmp); + } + } + if (required_exact_version) { Package *pkg = packages->data; diff -upk.orig pkg-config-0.20.orig/pkg-config.1 pkg-config-0.20/pkg-config.1 --- pkg-config-0.20.orig/pkg-config.1 2005-10-16 17:09:39 +0000 +++ pkg-config-0.20/pkg-config.1 2006-02-02 00:21:03 +0000 @@ -93,6 +93,14 @@ command line) or with other options. The environment variable overrides this option. .TP +.I "--print-provides" +Print which packages the package provides. + +.TP +.I "--print-requires" +Print which packages the package requires. + +.TP .I "--silence-errors" If one or more of the modules on the command line, or their dependencies, are not found, or if an error occurs in parsing a