On Sun, Jul 17, 2016 at 06:37:31PM +0200, Jean-Marc Lasgouttes wrote: > > When everything is sorted out, can you do the backport to 2.2.2? I think you > are the one who knows best what commits should be cherry-picked.
This would be the attached patch. -- Enrico
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. 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.])