From: Arch Librarian Date: Thu, 14 Jul 2005 13:06:23 +0000 (+0000) Subject: 2005-03-18 Tollef Fog Heen X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2080ec6d8503f6a97f1db8d6dcfbf14cb98d736;p=pkg-config 2005-03-18 Tollef Fog Heen Author: tfheen Date: 2005-03-26 14:59:26 GMT 2005-03-18 Tollef Fog Heen * main.c (main): Use add_search_dirs for both the compile-time defined pc_path and the run-time defined PKG_CONFIG_PATH. * pkg.h: Add prototype for add_search_dirs. * pkg.c (add_search_dirs): Add new function which takes a delimiter-separated list as input and add_search_dir's it. (package_init): Remove knowledge about which dirs should be initially added. Moved this to main.c(main) * ChangeLog: Add emacs variables to set the date to this ChangeLog's standard format * Makefile.am (INCLUDES): Pass PKG_CONFIG_PCPATH on to main.c * configure.in: Add --with-pc-path to define the default search path for .pc files. (Freedesktop #119, #648) --- diff --git a/ChangeLog b/ChangeLog index 7e5599c..af4ac82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,11 +11,32 @@ (Freedesktop #191, Debian #232719) +2005-03-18 Tollef Fog Heen + + * main.c (main): Use add_search_dirs for both the compile-time + defined pc_path and the run-time defined PKG_CONFIG_PATH. + + * pkg.h: Add prototype for add_search_dirs. + + * pkg.c (add_search_dirs): Add new function which takes a + delimiter-separated list as input and add_search_dir's it. + (package_init): Remove knowledge about which dirs should be + initially added. Moved this to main.c(main) + + * ChangeLog: Add emacs variables to set the date to this + ChangeLog's standard format + + * Makefile.am (INCLUDES): Pass PKG_CONFIG_PCPATH on to main.c + + * configure.in: Add --with-pc-path to define the default search + path for .pc files. (Freedesktop #119, #648) + 2005-03-18 Tollef Fog Heen * glib-patches/pthread-config-fix.diff: Add patch to detect pthreads properly on some architectures. Thanks to Michael Haubenwallner for reporting this bug and providing a patch. + (Freedesktop #1617) 2005-02-21 Tollef Fog Heen @@ -801,3 +822,8 @@ Tue Jun 6 2000 Martijn van Beers * pkg-config: removed the pc_name_pkg functionality * pkg-config: show help and error out when there are no arguments * pkg-config: get the version from configure + +;; +;; Local variables: +;; add-log-time-format: add-log-iso8601-time-string +;; End: diff --git a/Makefile.am b/Makefile.am index 18a597e..b0eda07 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,7 +15,7 @@ EXTRA_DIST = $(m4_DATA) $(man_MANS) README.win32 bin_PROGRAMS = pkg-config -INCLUDES=-DPKGLIBDIR="\"$(pkglibdir)\"" $(included_glib_includes) +INCLUDES=-DPKG_CONFIG_PC_PATH="\"$(pc_path)\"" $(included_glib_includes) pkg_config_SOURCES= \ pkg.h \ diff --git a/configure.in b/configure.in index 4344d17..1965662 100644 --- a/configure.in +++ b/configure.in @@ -10,6 +10,20 @@ AM_PROG_LIBTOOL AC_PROG_CC +AC_DEFUN([PKG_CONFIG_FIND_PC_PATH], +[AC_ARG_WITH(pc_path, + [ --with-pc-path" Override the default search path for .pc files ], + [ pc_path="$withval" + AC_MSG_CHECKING([for default search path for .pc files]) + AC_MSG_RESULT([$pc_path])], + [pc_path=`echo $pkglibdir:$pkgdatadir`]) + AC_SUBST([pc_path]) +dnl AC_DEFINE_UNQUOTED(PKG_CONFIG_PC_PATH,["$pc_path"],[Default search path for .pc files]) + +]) + +PKG_CONFIG_FIND_PC_PATH + AC_MSG_CHECKING([for Win32]) case "$host" in *-*-mingw*) diff --git a/main.c b/main.c index 599f775..2ede2c4 100644 --- a/main.c +++ b/main.c @@ -36,6 +36,13 @@ #undef STRICT #endif +#ifdef G_OS_WIN32 +/* No hardcoded paths in the binary, thanks */ +#undef PKGLIBDIR +/* It's OK to leak this, as PKGLIBDIR is invoked only once */ +#define PKG_CONFIG_PATH g_strconcat (g_win32_get_package_installation_directory (PACKAGE, NULL), "\\lib\\pkgconfig", NULL) +#endif + static int want_debug_spew = 0; static int want_verbose_errors = 0; static int want_stdout_errors = 0; @@ -188,6 +195,9 @@ main (int argc, char **argv) GSList *packages = NULL; char *search_path; char *pcbuilddir; + const char *pkglibdir; + char **search_dirs; + char **iter; gboolean need_newline; const char *pkgname; @@ -266,26 +276,13 @@ main (int argc, char **argv) } search_path = getenv ("PKG_CONFIG_PATH"); - if (search_path) + if (search_path) { - char **search_dirs; - char **iter; - - search_dirs = g_strsplit (search_path, G_SEARCHPATH_SEPARATOR_S, -1); - - iter = search_dirs; - while (*iter) - { - debug_spew ("Adding directory '%s' from PKG_CONFIG_PATH\n", - *iter); - add_search_dir (*iter); - - ++iter; - } - - g_strfreev (search_dirs); + add_search_dirs(search_path, G_SEARCHPATH_SEPARATOR_S); } + add_search_dirs(PKG_CONFIG_PC_PATH, G_SEARCHPATH_SEPARATOR_S); + #ifdef G_OS_WIN32 { /* Add search directories from the Registry */ diff --git a/pkg.c b/pkg.c index 0a327d1..6bcaceb 100644 --- a/pkg.c +++ b/pkg.c @@ -44,13 +44,6 @@ #include #include -#ifdef G_OS_WIN32 -/* No hardcoded paths in the binary, thanks */ -#undef PKGLIBDIR -/* It's OK to leak this, as PKGLIBDIR is invoked only once */ -#define PKGLIBDIR g_strconcat (g_win32_get_package_installation_directory (PACKAGE, NULL), "\\lib\\pkgconfig", NULL) -#endif - static void verify_package (Package *pkg); static GHashTable *packages = NULL; @@ -69,6 +62,27 @@ add_search_dir (const char *path) search_dirs = g_slist_append (search_dirs, g_strdup (path)); } +void +add_search_dirs (const char *path, const char *separator) +{ + char **search_dirs; + char **iter; + + search_dirs = g_strsplit (path, separator, -1); + + iter = search_dirs; + while (*iter) + { + debug_spew ("Adding directory '%s' from PKG_CONFIG_PATH\n", + *iter); + add_search_dir (*iter); + + ++iter; + } + + g_strfreev (search_dirs); +} + #ifdef G_OS_WIN32 /* Guard against .pc file being installed with UPPER CASE name */ # define FOLD(x) tolower(x) @@ -208,11 +222,6 @@ void package_init () { static gboolean initted = FALSE; - const char *pkglibdir; - - pkglibdir = g_getenv ("PKG_CONFIG_LIBDIR"); - if (pkglibdir == NULL) - pkglibdir = PKGLIBDIR; if (!initted) { @@ -225,7 +234,6 @@ package_init () add_virtual_pkgconfig_package (); g_slist_foreach (search_dirs, (GFunc)scan_dir, NULL); - scan_dir (pkglibdir); } } diff --git a/pkg.h b/pkg.h index 92df2f9..a63aa3f 100644 --- a/pkg.h +++ b/pkg.h @@ -94,6 +94,7 @@ char * packages_get_var (GSList *pkgs, void add_search_dir (const char *path); +void add_search_dirs (const char *path, const char *separator); void package_init (void); int compare_versions (const char * a, const char *b); gboolean version_test (ComparisonType comparison,