configure: add -pkg-config option to control pkg-config usage
authorGirish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Wed, 4 Apr 2012 22:02:11 +0000 (15:02 -0700)
committerQt by Nokia <qt-info@nokia.com>
Wed, 11 Apr 2012 17:14:43 +0000 (19:14 +0200)
commit0991eae04871f1cb4a6d149658354bf129367074
tree8038245752a4498a8401da1750013ee3c8be1db5
parentce84af7c9b57f7f8cef5d57c5486b1409e13bcdd
configure: add -pkg-config option to control pkg-config usage

Currently, for host builds, pkg-config usage is autodetected based
on it's availability in the mkspec or the PATH. For xcompile builds,
pkg-config is disabled unless -force-pkg-config is passed.

-force-pkg-config is poorly named since it doesn't reflect the fact
that it applies only to xplatform builds. It is in fact the only way to
enable pkg-config in xcompile builds. And when passed, it doesn't actually
force anything since all it does is check env variables. To add to the
confusion, it prints a warning even if the env variables are setup correctly.

This patch remedies the situation. It adds (-no)-pkg-config. The flag works
for both host and xcompile builds.

By default, the value is 'auto'. In this mode, it will try try to detect pkg-config
from the path. If found, it will be used. For xcompiled builds, we use some heuristics
to determine if the pkg-config is actually usable:
1. if -sysroot is not set and the environment variables PKG_CONFIG_LIBDIR or
    PKG_CONFIG_SYSROOT_DIR are not set, we disable pkg-config.
2. if -sysroot is set, then we setup PKG_CONFIG_LIBDIR and PKG_CONFIG_SYSROOT_DIR
   automatically (provided $SYSROOT/usr/lib/pkgconfig exists).

If the value is 'yes', configure will error if it's heuristics fail to detect a usable
pkg-config.

If the value is 'no', pkg-config usage is disabled.

If the value is 'force', configure will skip it's heuristics and use pkg-config anyway.
This mode is useful, for example, when compiling for 32-bit on 64-bit systems.

This change also removes references to PKG_CONFIG_SYSROOT (PKG_CONFIG_SYSROOT_DIR
is the correct environment variable).

Change-Id: I07fc8d48603c65a60de0336fc6276e90fcb41430
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
configure