[PATCH] Add option to print the path used by pkg-config
Dan Nicholson
dbn.lists at gmail.com
Thu Feb 18 09:32:39 PST 2010
The --print-pc-path option provides a means to find out what the built
in search path being used by pkg-config is.
---
main.c | 9 +++++++++
pkg.c | 6 ++++++
pkg.h | 1 +
3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/main.c b/main.c
index b9442fc..3a78a5e 100644
--- a/main.c
+++ b/main.c
@@ -176,6 +176,7 @@ main (int argc, char **argv)
static int want_I_cflags = 0;
static int want_other_cflags = 0;
static int want_list = 0;
+ static int want_pc_path = 0;
static int want_static_lib_list = ENABLE_INDIRECT_DEPS;
static int want_short_errors = 0;
static int want_uninstalled = 0;
@@ -243,6 +244,8 @@ main (int argc, char **argv)
"return 0 if the module is at no newer than version VERSION", "VERSION" },
{ "list-all", 0, POPT_ARG_NONE, &want_list, 0,
"list all known packages" },
+ { "print-pc-path", 0, POPT_ARG_NONE, &want_pc_path, 0,
+ "print the pkg-config path to stdout" },
{ "debug", 0, POPT_ARG_NONE, &want_debug_spew, 0,
"show verbose debug information" },
{ "print-errors", 0, POPT_ARG_NONE, &want_verbose_errors, 0,
@@ -410,6 +413,12 @@ main (int argc, char **argv)
return 0;
}
+ if (want_pc_path)
+ {
+ print_pc_path();
+ return 0;
+ }
+
str = g_string_new ("");
while (1)
{
diff --git a/pkg.c b/pkg.c
index 0409531..17d03a3 100644
--- a/pkg.c
+++ b/pkg.c
@@ -1517,6 +1517,12 @@ print_package_list (void)
}
void
+print_pc_path (void)
+{
+ g_slist_foreach (search_dirs, (GFunc)puts, NULL);
+}
+
+void
enable_private_libs(void)
{
ignore_private_libs = FALSE;
diff --git a/pkg.h b/pkg.h
index 984a461..6777e42 100644
--- a/pkg.h
+++ b/pkg.h
@@ -119,6 +119,7 @@ gboolean version_test (ComparisonType comparison,
const char *comparison_to_str (ComparisonType comparison);
void print_package_list (void);
+void print_pc_path (void);
void define_global_variable (const char *varname,
const char *varval);
--
1.6.6
More information about the pkg-config
mailing list