On Mon, 09 May 2016 at 06:47:38 +0200, Helmut Grohne wrote: > In order for pkg-config to be "better" than your foo-config script, you > need to tell it about the current host architecture by prefixing it with > the triplet. Instead of calling pkg-config, you should be calling > $DEB_HOST_GNU_TYPE-pkg-config. The tricky question is: Where to obtain > that value. The answer is: By parsing $0.
The reason this works is that third-party configure scripts (for users of foo) normally call the PKG_PROG_PKG_CONFIG Autoconf macro, either directly or via PKG_CHECK_MODULES or PKG_CHECK_EXISTS, and PKG_PROG_PKG_CONFIG correctly uses AC_PATH_TOOL to look for the tuple-prefixed version before the unprefixed version. If users of foo normally call foo-config directly, no amount of adding prefixes is going to make them cross-build without modification. S