]> git.lyx.org Git - features.git/commitdiff
If available, use qtchooser to select correct Qt tools
authorEnrico Forestieri <forenr@lyx.org>
Mon, 29 Aug 2016 20:35:09 +0000 (22:35 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Mon, 29 Aug 2016 20:35:09 +0000 (22:35 +0200)
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
status.22x

index 33029b933d0010ffa6d4e1c3f924a4fa3ca8e2b3..93663712fc32153df43a1e492a9a54436060ca44 100644 (file)
@@ -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.])
index b27f6d771091dd3bea20f12754354d906338c998..327f979cd43261c33240286cfbdd7760aa0e8c03 100644 (file)
@@ -40,6 +40,7 @@ What's new
 
 * BUILD/INSTALLATION
 
+- If available, use qtchooser to select correct Qt tools when configuring.