/usr/local support

Daniel Macks dmacks at netspace.org
Sun Jul 15 19:51:57 PDT 2007


On Fri, Jul 13, 2007 at 11:27:15AM +0200, Damjan Jovanovic wrote:
> 
> 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.

Makes sense. However, I don't think changing the behavior
of existing ./configure flags is good:

> 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

It is indeed *unconditionally*, which means the --with-pc-path flag
(propagated as PKG_CONFIG_PC_PATH) no longer works as advertised
("*Override* the default search path for .pc files", emphasis added).
One may indeed *not* want those searched...just because the default
behavior of some (or even all) compilers is a certain way doesn't mean
there aren't times one doesn't want pkg-config do do this. Please
don't force /usr/lib upon folks who don't want it.

For a real-world exampls, there are several gnome-bugzilla reports
where users are trying to set up self-contained gnome platforms in
user-space (newer version than vendor-supplied), and have problems due
to mixing with system-installed libraries. Don't want to make it worse
for them by having pkgconfig suddenly falling back on those libs.

A safer solution would be to alter the *default* search path
($pc_path) in configure.in.

dan

-- 
Daniel Macks
dmacks at netspace.org
http://www.netspace.org/~dmacks



More information about the pkg-config mailing list