diff -ur pkgconfig-0.15.0/main.c pkgconfig/main.c --- pkgconfig-0.15.0/main.c 2003-01-15 06:01:00.000000000 +0100 +++ pkgconfig/main.c 2003-11-21 23:49:39.000000000 +0100 @@ -168,6 +168,9 @@ static int want_other_libs = 0; static int want_I_cflags = 0; static int want_other_cflags = 0; + static int want_locate = 0; + static int want_package = 0; + static int want_describe = 0; static int want_list = 0; static int result; static int want_uninstalled = 0; @@ -225,6 +228,12 @@ "return 0 if the module is at exactly version VERSION", "VERSION" }, { "max-version", 0, POPT_ARG_STRING, &required_max_version, 0, "return 0 if the module is at no newer than version VERSION", "VERSION" }, + { "locate", 0, POPT_ARG_NONE, &want_locate, 0, + "show config path for module .pc file(s)" }, + { "package", 0, POPT_ARG_NONE, &want_package, 0, + "show package name for the module" }, + { "describe", 0, POPT_ARG_NONE, &want_describe, 0, + "show brief description for the module" }, { "list-all", 0, POPT_ARG_NONE, &want_list, 0, "list all known packages" }, { "debug", 0, POPT_ARG_NONE, &want_debug_spew, 0, @@ -378,9 +387,12 @@ want_other_libs || want_I_cflags || want_other_cflags || + want_locate || + want_package || + want_describe || want_list) { - debug_spew ("Error printing enabled by default due to use of --version, --libs, --cflags, --libs-only-l, --libs-only-L, --libs-only-other, --cflags-only-I, --cflags-only-other or --list. Value of --silence-errors: %d\n", want_silence_errors); + debug_spew ("Error printing enabled by default due to use of --version, --libs, --cflags, --libs-only-l, --libs-only-L, --libs-only-other, --cflags-only-I, --cflags-only-other, --locate, --package, --describe or --list. Value of --silence-errors: %d\n", want_silence_errors); if (want_silence_errors && getenv ("PKG_CONFIG_DEBUG_SPEW") == NULL) want_verbose_errors = FALSE; @@ -507,7 +519,7 @@ return 1; } - if (want_version) + if (want_locate || want_package || want_version || want_describe) { GSList *tmp; tmp = packages; @@ -515,7 +527,13 @@ { Package *pkg = tmp->data; - printf ("%s\n", pkg->version); + if (want_locate && pkg->pcfiledir) printf ("%s", pkg->pcfiledir); + if (want_locate && want_package|want_version) printf (" "); + if (want_package && pkg->name) printf ("%s", pkg->name); + if (want_package && want_version) printf (" = "); + if (want_version && pkg->version) printf ("%s", pkg->version); + if (want_describe && pkg->description) printf (" \"%s\"", pkg->description); + printf ("\n"); tmp = g_slist_next (tmp); } diff -ur pkgconfig-0.15.0/pkg.c pkgconfig/pkg.c --- pkgconfig-0.15.0/pkg.c 2003-01-16 22:07:09.000000000 +0100 +++ pkgconfig/pkg.c 2003-11-21 23:52:39.000000000 +0100 @@ -220,6 +220,14 @@ return FALSE; } +static Package my_pkg = { + PACKAGE, /* .key */ + PACKAGE, /* .name */ + VERSION, /* .version */ + "returns metainformation about installed libraries", /* .description */ + PKGLIBDIR, /* .pcfiledir */ + 0 /* keep the rest as null */ +}; static Package * internal_get_package (const char *name, gboolean warn, gboolean check_compat) @@ -232,6 +240,9 @@ if (pkg) return pkg; + if (!strcmp (PACKAGE, name) || !strcmp ("...", name)) + return & my_pkg; + debug_spew ("Looking for package '%s'\n", name); /* treat "name" as a filename if it ends in .pc and exists */