[PATCH 1/2] Search both qmake and qmake-qt4

Thiago Macieira thiago at macieira.org
Tue May 14 14:23:39 PDT 2013


Some Linux distributions do not ship a "qmake" binary, despite
recommendations from the Qt Project. We need to cope with that, so we
search for qmake-qt4 if qmake fails.

We use "qmake -query QT_VERSION" instead of qmake -v because that is
known to produce an error for Qt 3's qmake.

Signed-off-by: Thiago Macieira <thiago at macieira.org>
---
 Configure.mk | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/Configure.mk b/Configure.mk
index 96508c6..f8bd33e 100644
--- a/Configure.mk
+++ b/Configure.mk
@@ -5,9 +5,6 @@ all:
 PKGCONFIG=pkg-config
 XML2CONFIG=xml2-config
 XSLCONFIG=xslt-config
-QMAKE=qmake
-MOC=moc
-UIC=uic
 
 CONFIGFILE = config.cache
 ifeq ($(CONFIGURING),1)
@@ -70,6 +67,19 @@ endif
 # about it if it doesn't.
 LIBUSB = $(shell $(PKGCONFIG) --libs libusb-1.0 2> /dev/null)
 
+# Find qmake. Rules are:
+#  - use qmake if it is in $PATH
+#    [qmake -query QT_VERSION  will fail if it's Qt 3's qmake]
+#  - if that fails, try qmake-qt4
+#  - if that fails, print an error
+# We specifically do not search for qmake-qt5 since that is not supposed
+# to exist.
+QMAKE = $(shell { qmake -query QT_VERSION >/dev/null 2>&1 && echo qmake; } || \
+		{ qmake-qt4 -v >/dev/null 2>&1 && echo qmake-qt4; })
+ifeq ($(strip $(QMAKE)),)
+$(error Could not find qmake or qmake-qt4 in $$PATH or they failed)
+endif
+
 # Use qmake to find out which Qt version we are building for.
 QT_VERSION_MAJOR = $(shell $(QMAKE) -query QT_VERSION | cut -d. -f1)
 ifeq ($(QT_VERSION_MAJOR), 5)
-- 
1.7.11.7



More information about the subsurface mailing list