From d8f1f7a29c277c9a643fd048b87f530e37773676 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Fri, 14 Sep 2012 10:03:18 +0200
Subject: use qmake to get PKG_CONFIG in configure script

The value of PKG_CONFIG might depend on device options.
For example, "-device-option PKG_CONFIG" might be used with configure
or a mkspec might prefix PKG_CONFIG with CROSS_COMPILE which is
specified as a device option.

The shell functions of configure for parsing mkspecs do not take
device options into account, but qmake is pretty good at it now.

backport of qt5/qtbase 01864d4854557d2cf8b067e229d77cd7c9c553ee

Change-Id: I1c9558e550c48e8441ebdac34b82066473c2ce3a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
---
 configure | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 3488769..b6e2d11 100755
--- a/configure
+++ b/configure
@@ -5010,8 +5010,12 @@ else
 fi
 
 if [ -z "$PKG_CONFIG" ]; then
-    # See if PKG_CONFIG is set in the mkspec:
-    PKG_CONFIG=`getXQMakeConf PKG_CONFIG`
+    # See if PKG_CONFIG is set in the mkspec or device options
+    (echo TEMPLATE = subdirs
+     echo 'message($$PKG_CONFIG)') > "$outpath/dummy.pro"
+    echo "QT_BUILD_TREE = $outpath" > "$outpath/.qmake.cache.pkgconfig"
+    PKG_CONFIG=`"$outpath/bin/qmake" -cache "$outpath/.qmake.cache.pkgconfig" -spec "$XQMAKESPEC" "$outpath/dummy.pro" -o /dev/null 2>&1 > /dev/null | sed -n -e 's,Project MESSAGE: \(.*\),\1,p'`
+    rm "$outpath/.qmake.cache.pkgconfig" "$outpath/dummy.pro"
 fi
 if [ -z "$PKG_CONFIG" ]; then
     PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
-- 
cgit v0.12