]> git.lyx.org Git - lyx.git/commitdiff
Check path of Qt tools if qtchooser is detected
authorEnrico Forestieri <forenr@lyx.org>
Sun, 17 Jul 2016 10:31:24 +0000 (12:31 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Sun, 17 Jul 2016 10:31:24 +0000 (12:31 +0200)
The full path of the tools is retained only if the Qt directory is
specified using --with-qt-dir. Now, when qtchooser was detected it
was blindly assumed that the corresponding system tools were being
used. These tools discriminate between Qt4 and Qt5 through the
option -qt=qt4 or -qt=qt5. However, the original Qt tools don't
understand these options, so that if they come first in the PATH,
configuration fails. So, only use those options if we are reasonably
sure that the system Qt is wanted. This is achieved by comparing the
paths of qtchooser and tools as, typically, they are located in the
same directory. In this way, if one prepends the bin directory of a
custom Qt build to PATH (and accordingly adjusts PKG_CONFIG_PATH),
configuration succeeds even if --with-qt-dir is not specified.

config/qt4.m4

index f39c0ed67ef612f9570649e964d85ccb63e7706f..03f0c05341f7c128f6495013cf9d2d80dd0db89b 100644 (file)
@@ -75,7 +75,13 @@ AC_DEFUN([QT_FIND_TOOL],
        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_CHECK_PROG($1, $2, [$2 -qt=$qt_ext],, [$PATH])
+               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_CHECK_PROGS($1, [$2-$qt_ext $2],[],$PATH)