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.
This commit is contained in:
Enrico Forestieri 2016-08-29 22:35:09 +02:00
parent 36d0e3032d
commit 874bbe2166
2 changed files with 11 additions and 1 deletions

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

View File

@ -40,6 +40,7 @@ What's new
* BUILD/INSTALLATION
- If available, use qtchooser to select correct Qt tools when configuring.