Bug 14975 - Provide way to query *.pc installation paths
Provide way to query *.pc installation paths
Product: pkg-config
Classification: Unclassified
Component: src
Other All
: medium normal
Assigned To: Tollef Fog Heen
Depends on:
  Show dependency treegraph
Reported: 2008-03-12 13:19 UTC by Ville Skyttä
Modified: 2009-12-06 12:45 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Add .pc file for pkg-config itself (902 bytes, patch)
2008-12-01 14:01 UTC, Ville Skyttä
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Ville Skyttä 2008-03-12 13:19:36 UTC
I think it's pretty ironic that a tool like pkg-config cannot be queried where it reads *.pc files by default, especially because it allows people to configure it at build time :)

If my autotools skills were up to the task of implementing this with reasonable effort, I think I'd approach it like:

1) Provide --with-pclibdir and --with-pcsharedir configure options; pclibdir is for architecture dependent and pcsharedir architecture independent *.pc file directories (for example /usr/lib/pkgconfig and /usr/share/pkgconfig respectively)

2) If pcsharedir is not given, default its value to pclibdir.  If pclibdir is not given, default it (and pcsharedir if not given) to the first component of pc-path (or its default if it's not given).

3) Update the manual page to reflect these; spell out complete paths instead of talking about prefixes and libdirs which aren't really too meaningful for other packages that wish to install their *.pc files.

4) Ship a pkg-config.pc file which can be queried like "pkg-config --variable=pclibdir pkg-config" to get the default architecture dependent *.pc dir and "--variable=pcsharedir" to get the architecture independent one.

Could something like this be added?  If this gets a green light and nobody beats me to it, I'll try to come up with a patch eventually.
Comment 1 Ville Skyttä 2008-03-12 13:48:23 UTC
If this is seen too complex, I think just shipping a *.pc file with the default colon separated path queryable with "pkg-config --variable=pcpath pkg-config" and then subsequently split into dirs by apps that need it would be a good improvement too.
Comment 2 Ville Skyttä 2008-12-01 14:01:33 UTC
Created attachment 20719 [details] [review]
Add .pc file for pkg-config itself

Here's a start (see comment 1), can be used with "pkg-config pkg --variable=pc_path" to find out the full default path for .pc files.

Strangely, "pkg-config pkg-config ..." did not work for me, therefore I named the .pc to pkg.pc (consistent with the .m4).

By the way, FWIW, the shell script version which still exists in bzr had a --print-pc-path option...
Comment 3 Ville Skyttä 2008-12-01 14:04:41 UTC
Also, note that the patch itself kind of manifests the problem at hand which was described in the initial comment: where should I install my *.pc file?  Currently it's "hardcoded" to $(libdir)/pkgconfig but that might not be correct, depending on --with-pc-path passed to configure.  That's something I bet quite a few projects are struggling with.
Comment 4 Tollef Fog Heen 2009-12-06 12:45:44 UTC
You can query current git using:

> ./pkg-config --variable pc_path pkg-config