/usr/local support

Damjan Jovanovic damjan.jov at gmail.com
Fri Jul 13 02:27:15 PDT 2007


Hi

By default, a "./configure --prefix=/usr" will make pkg-config search
/usr/lib/pkgconfig and /usr/share/pkgconfig, and completely ignore
/usr/local/lib/pkgconfig and /usr/local/share/pkgconfig. Therefore any
software that installs into /usr/local, and publishes itself to
pkg-config, is still inaccessible without setting $PKG_CONFIG_PATH.

The Freedesktop specs support menus and icons in /usr/local, man and
info look for documents in /usr/local, gcc and binutils look for
headers and libraries in /usr/local, and yet pkg-config doesn't
support /usr/local like a first-class citizen. I realise that some
distros run ./configure with the switch to add the /usr/local
directories to PKG_CONFIG_PC_PATH, but many don't, and not only is it
better for pkg-config to support this as a matter of policy, but it's
easier fixing the problem at the core than persuading every Linux
distribution to configure pkg-config a certain way.

Here is a proposed patch (for 0.22) to add support for /usr/local.
I've also made pkg-config unconditionaly search /usr/lib so that it
finds the files there no matter which prefix it is installed to.

--- a/main.c	2007-06-18 23:35:05.000000000 +0200
+++ b/main.c	2007-07-12 19:54:11.694677194 +0200
@@ -293,6 +293,12 @@
   else
     {
       add_search_dirs(PKG_CONFIG_PC_PATH, G_SEARCHPATH_SEPARATOR_S);
+#ifndef G_OS_WIN32
+      add_search_dir("/usr/lib/pkgconfig");
+      add_search_dir("/usr/share/pkgconfig");
+      add_search_dir("/usr/local/lib/pkgconfig");
+      add_search_dir("/usr/local/share/pkgconfig");
+#endif
     }

 #ifdef G_OS_WIN32

Please let me know whether this is okay or if there is a better way to
do this. It also would be nice if the patch could be backported to
previous versions of pkg-config.

Thank you
Damjan Jovanovic


More information about the pkg-config mailing list