The current logic only strips one or the other. See:
Created attachment 16969 [details] [review]
exclude both /usr/lib and /usr/lib64
This is related to <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482884>. For multiarch support (at least on Debian), pkg-config should also strip anything the linker will search by default, notably:
* /usr/lib32 and /emul/ia32-linux/usr/lib on Debian amd64, powerpc
* "/usr/lib/TRIPLET for each architecture (where TRIPLET is like x86_64-linux-gnu or i486-freebsd), "including the non-default biarch and triarch directories"
The "non-default biarch and triarch directories" are non-trivial to determine, but appear to include at least:
* 64-bit versions of s390, sparc, i386, powerpc, mips and mipsel
* 32-bit versions of amd64, ppc64
* n32 versions of mips and mipsel
I've prepared a branch which takes Colin's patch but also makes this more configurable, both at compile time and via environment variables.
Rationale: pkg-config upstream can't be expected to know what the system directories are for every OS in existence, but packagers for particular OS distributions (Debian is the one I'm interested in) can set the right system directories at compile time. The /usr/lib vs. /usr/lib64 thing is probably common enough, and easy enough to detect, to deserve a special case.
Created attachment 45161 [details] [review]
Rename subiter to system_dir_iter to match logic for header files
The name @subiter doesn't seem appropriate; it iterates over a separate
list, not over an item of @iter.
Also remove some trailing whitespace.
Created attachment 45162 [details] [review]
Add --with-system-include-path etc.
Instead of hard-coding /usr/include, we now use the environment variable
PKG_CONFIG_SYSTEM_INCLUDE_PATH, defaulting to the argument of
./configure --with-system-include-path, which in turn defaults to
Similarly, PKG_CONFIG_SYSTEM_LIBRARY_PATH defaults to /usr/lib or
/usr/lib:/usr/lib64 as appropriate.
(As currently implemented, this causes a behaviour change on Win32 -
the option -I/usr/include will now be filtered out.)
The intended usage is for Debian to configure pkg-config with
and the corresponding library path, for multiarch support
Thanks, merged in http://cgit.freedesktop.org/pkg-config/commit/?id=01005bbbd0155b606c1f3df845ccfaff81e0c6ff