Check path of Qt tools if qtchooser is detected

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.
This commit is contained in:
Enrico Forestieri 2016-07-17 12:31:24 +02:00
parent c4a6d8d568
commit 0c7bd9a57f

View 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)