commit 874bbe216608e3d4db4ae8692a82d1525d0f6951
Author: Enrico Forestieri <[email protected]>
Date: Mon Aug 29 22:35:09 2016 +0200
If available, use qtchooser to select correct Qt tools
When the Qt directory is specified by --with-qt-dir, the tools
are only searched for in the corresponding bin subdir and their
full path is retained, so that it is not necessary modifying the
PATH and PKG_CONFIG_PATH environment variables to select a custom
Qt version. Otherwise, if qtchooser is detected early in the PATH,
the generic names are attempted with proper arguments to select the
desired Qt version (e.g., "moc -qt=qt5" if --enable-qt5 is specified).
Failing all of the above, the generic names with and without proper
suffixes (either -qt4 or -qt5) are checked in the PATH.
Eventually, a check is performed and a warning is issued if the
selected tools do not match the chosen Qt libraries.
---
config/qt4.m4 | 11 ++++++++++-
status.22x | 1 +
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/config/qt4.m4 b/config/qt4.m4
index 33029b9..9366371 100644
--- a/config/qt4.m4
+++ b/config/qt4.m4
@@ -71,11 +71,20 @@ AC_DEFUN([QT_FIND_TOOL],
if test "x$USE_QT5" != "xno" ; then
qt_ext=qt5
fi
+
if test -n "$qt_cv_bin" ; then
AC_PATH_PROGS($1, [$2], [], $qt_cv_bin)
+ elif qtchooser -l 2>/dev/null | grep -q ^$qt_ext\$ >/dev/null ; then
+ AC_PATH_PROG(qtc_path, qtchooser, [], [$PATH])
+ AC_PATH_PROG($2_path, $2, [], [$PATH])
+ qtc_path=`dirname "$qtc_path"`
+ $2_path=`dirname "$$2_path"`
+ if test "$qtc_path" = "$$2_path" ; then
+ AC_CHECK_PROG($1, $2, [$2 -qt=$qt_ext],, [$PATH])
+ fi
fi
if test -z "$$1"; then
- AC_PATH_PROGS($1, [$2-$qt_ext $2],[],$PATH)
+ AC_CHECK_PROGS($1, [$2-$qt_ext $2],[],$PATH)
fi
if test -z "$$1"; then
AC_MSG_ERROR([cannot find $2 binary.])
diff --git a/status.22x b/status.22x
index b27f6d7..327f979 100644
--- a/status.22x
+++ b/status.22x
@@ -40,6 +40,7 @@ What's new
* BUILD/INSTALLATION
+- If available, use qtchooser to select correct Qt tools when configuring.