Index: pkg-config-0.23-aix.orig/pkg-config.1 =================================================================== --- pkg-config-0.23-aix.orig/pkg-config.1 2008-01-16 22:26:50.000000000 +0100 +++ pkg-config-0.23-aix/pkg-config.1 2008-10-05 10:43:06.000000000 +0200 @@ -33,6 +33,7 @@ [\-\-libs-only-l] [\-\-cflags-only-I] [\-\-variable=VARIABLENAME] [\-\-define-variable=VARIABLENAME=VARIABLEVALUE] +[\-\-print-variables] [\-\-uninstalled] [\-\-exists] [\-\-atleast-version=VERSION] [\-\-exact-version=VERSION] [\-\-max-version=VERSION] [LIBRARIES...] @@ -156,6 +157,10 @@ .fi .TP +.I "--print-variables" +Returns a list of all variables defined in the package. + +.TP .I "--uninstalled" Normally if you request the package "foo" and the package "foo-uninstalled" exists, \fIpkg-config\fP will prefer the Index: pkg-config-0.23-aix/main.c =================================================================== --- pkg-config-0.23-aix.orig/main.c 2008-01-16 23:06:48.000000000 +0100 +++ pkg-config-0.23-aix/main.c 2008-10-05 10:43:29.000000000 +0200 @@ -170,6 +170,14 @@ return FALSE; } +void +print_hashtable_key (gpointer key, + gpointer value, + gpointer user_data) +{ + printf("%s\n", (gchar*)key); +} + int main (int argc, char **argv) { @@ -202,6 +210,7 @@ char **search_dirs; char **iter; gboolean need_newline; + int want_variable_list = 0; const char *pkgname; Package *pkg; @@ -238,6 +247,8 @@ "get the value of a variable", "VARIABLENAME" }, { "define-variable", 0, POPT_ARG_STRING, NULL, DEFINE_VARIABLE, "set the value of a variable", "VARIABLENAME=VARIABLEVALUE" }, + { "print-variables", 0, POPT_ARG_NONE, &want_variable_list, 0, + "output list of variables defined by the module" }, { "exists", 0, POPT_ARG_NONE, &want_exists, 0, "return 0 if the module(s) exist" }, { "uninstalled", 0, POPT_ARG_NONE, &want_uninstalled, 0, @@ -404,7 +415,8 @@ want_other_libs || want_I_cflags || want_other_cflags || - want_list) + want_list || + want_variable_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); @@ -522,6 +534,23 @@ return 1; } + if (want_variable_list) + { + GSList *tmp; + gchar *str; + tmp = packages; + while (tmp != NULL) + { + Package *pkg = tmp->data; + g_hash_table_foreach(pkg->vars, + &print_hashtable_key, + NULL); + tmp = g_slist_next (tmp); + if (tmp) printf ("\n"); + } + need_newline = FALSE; + } + } g_string_free (str, TRUE);