On Wed, Jul 13, 2016 at 07:28:36PM -0400, Scott Kostyshak wrote:
> On Thu, Jul 14, 2016 at 12:18:02AM +0200, Enrico Forestieri wrote:
> 
> > This is because the code first checks for the existence of qtchooser
> > and then assumes that moc & company understand the -qt=qt5 option.
> > Given that you first set the correct PATH, the moc in
> > /usr/BUILD/BuildQt5-dev/qtbase/bin is actually executed, and it
> > doesn't understand that option. Essentially, this occurs because
> > the full path to the qt tools is not retained anymore.
> > I have a setup similar to yours and incurred in a similar problem
> > which I tried to correct at f0aa1299. The solution is using the
> > --with-qt-dir option, without setting PATH and PKG_CONFIG_PATH.
> > This should work:
> > 
> >   export MYQTDIR=/usr/BUILD/BuildQt5-dev/qtbase
> >   ./autogen.sh && ./configure --enable-qt5 --with-qt-dir=$MYQTDIR && make
> 
> Nice that is cleaner. I might transition to it. I often use my build
> script for older commits though so if that only works as of f0aa1299, I
> will wait.

This works also for commits before this one. It will not work only for
all commits between this one and f0aa1299.

> > > The following command also does not work with this commit:
> > > 
> > >   ./autogen.sh && ./configure --enable-qt5 && make
> > > 
> > > It gives the following error:
> > > 
> > >   configure: error: cannot compile a simple Qt executable. Check you have
> > >   the right $QTDIR.
> > 
> > Strange, this should work and use the Qt5 from the system.
> 
> I was not clear. I don't have Qt 5 dev libs; I have Qt 4 deb libs.

Then this expected, because --enable-qt5 includes libraries not
present in Qt4.

> > However, I agree that setting PATH and PKG_CONFIG_PATH as you do
> > it has to work. Please try the attached patch.
> 
> The patch works well for me. Thanks.

Attached a refined version that accounts for the path of the actually
checked tool, instead of always using the moc path (even if they are
the same in practice).

-- 
Enrico
diff --git a/config/qt4.m4 b/config/qt4.m4
index f39c0ed..03f0c05 100644
--- a/config/qt4.m4
+++ b/config/qt4.m4
@@ -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)

Reply via email to