From 55e0ca2aa1f2216121ecf17126caf8bdd4f3094b Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Tue, 12 May 2015 14:59:02 +0200
Subject: Gracefully handle pkg-config when Qt is not installed

Test-Information:

Tested on Elementary OS 0.2.0. Without this patch scons crashed if not
all required Qt libs are installed. Now it marks Qt as unavailable and
will configure a build without Swift.

Change-Id: I5aa28ab8438e4c326d16413deb3a3fa739c94480

diff --git a/BuildTools/SCons/Tools/qt4.py b/BuildTools/SCons/Tools/qt4.py
index 17292d9..f4b59e3 100644
--- a/BuildTools/SCons/Tools/qt4.py
+++ b/BuildTools/SCons/Tools/qt4.py
@@ -506,6 +506,13 @@ def enable_modules(self, modules, debug=False, crosscompiling=False, version='4'
 			modules_str = " ".join(modules)
 			if not version == '4' :
 				modules_str = modules_str.replace('Qt', 'Qt5')
+
+			# Check if Qt is registed at pkg-config
+			ret = test_env.TryAction('pkg-config --exists \'%s\'' % modules_str)[0]
+			test_env.Result( ret )
+			if not ret:
+				print("Qt not found.")
+				return
 			test_env.ParseConfig("pkg-config --cflags --libs " + modules_str)
 			self.AppendUnique(LIBS=test_env["LIBS"], LIBPATH=test_env["LIBPATH"], CPPPATH=test_env["CPPPATH"])
 			self["QT4_MOCCPPPATH"] = self["CPPPATH"]
-- 
cgit v0.10.2-6-g49f6