define-prefix: skip one level if it ends up in /lib

Open Luca Boccassi requested to merge bluca/pkg-config:define_prefix_multiarch into master

In Debian and Ubuntu the multiarch filesystem layout looks as follows:

/usr/lib/x86_64-linux-gnu/pkgconfig/ /usr/lib/i386-linux-gnu/pkgconfig/

Which means when --define-prefix skips to the grand-parent directory of pkgconfig, it ends up in /usr/lib rather than /usr as it's supposed to.

This causes for example the include path to be printed as: /usr/lib/include which is wrong and breaks applications.

Check if the new directory is 'lib' and if it is go one step above. A new series of unit tests is added with this layout.

Merge request reports