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.
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.
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...
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.
You can query current git using: > ./pkg-config --variable pc_path pkg-config /usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.