On Thu, Jul 17, 2014 at 12:49:40AM +0200, Enrico Forestieri wrote:
> On Wed, Jul 16, 2014 at 12:40:34PM +0200, Enrico Forestieri wrote:
> > 
> > 4) The autotools machinery need to be updated. Currently, I simply
> >    patch the generated configure script to be able to compile with
> >    Qt5.
> 
> I attach here two patches that allow to build against Qt5 using autotools.
> The first one (enable-qt5-minimal.diff) only touches qt4.m4, while the
> second one (enable-qt5-full.diff) is functionally equivalent but also
> renames all variables having qt4 or QT4 in their names. Thus, it also
> touches the Makefile.am's and some script for Mac, but only to rename
> the relevant variables.
> 
> The patch introduces the switch --enable-qt5 that allows to properly
> configure LyX for using the Qt5 libraries. Without that switch, the
> configure goes exactly as before (Qt4 is the default).
> 
> I plan to apply the patch if I get no objections.

Now with the patches ;)

-- 
Enrico
diff --git a/config/qt4.m4 b/config/qt4.m4
index 58edd85..0ce2ddb 100644
--- a/config/qt4.m4
+++ b/config/qt4.m4
@@ -28,7 +28,13 @@ AC_DEFUN([QT4_CHECK_COMPILE],
                AC_LANG_CPLUSPLUS
                SAVE_CXXFLAGS=$CXXFLAGS
                CXXFLAGS="$CXXFLAGS $QT4_INCLUDES $QT4_LDFLAGS"
-               for libname in -lQtCore -lQtCore4 '-framework QtCore'
+               qt_corelibs="-lQtCore -lQtCore4"
+               qt_guilibs="'-lQtCore -lQtGui' '-lQtCore4 -lQtGui4'"
+               if test $USE_QT5 = "yes" ; then
+                   qt_corelibs="-lQt5Core"
+                   qt_guilibs="-lQt5Core -lQt5Concurrent -lQt5Gui -lQt5Widgets"
+               fi
+               for libname in $qt_corelibs '-framework QtCore'
                do
                        QT4_TRY_LINK($libname)
                        if test -n "$qt4_cv_libname"; then
@@ -37,8 +43,7 @@ AC_DEFUN([QT4_CHECK_COMPILE],
                        fi
                done
                qt4_cv_libname=
-               for libname in '-lQtCore -lQtGui' \
-                              '-lQtCore4 -lQtGui4' \
+               for libname in $qt_guilibs \
                               '-framework QtCore -framework QtConcurrent 
-framework QtWidgets -framework QtGui'\
                               '-framework QtCore -framework QtGui'
                do
@@ -62,11 +67,15 @@ AC_DEFUN([QT4_CHECK_COMPILE],
 AC_DEFUN([QT4_FIND_TOOL],
 [
        $1=
+       qt_ext=qt4
+       if test $USE_QT5 = "yes" ; then
+               qt_ext=qt5
+       fi
        if test -n "$qt4_cv_bin" ; then
                AC_PATH_PROGS($1, [$2], [], $qt4_cv_bin)
        fi
        if test -z "$$1"; then
-               AC_PATH_PROGS($1, [$2-qt4 $2],[],$PATH)
+               AC_PATH_PROGS($1, [$2-$qt_ext $2],[],$PATH)
        fi
        if test -z "$$1"; then
                AC_MSG_ERROR([cannot find $2 binary.])
@@ -103,6 +112,14 @@ EOF
 dnl start here
 AC_DEFUN([QT4_DO_IT_ALL],
 [
+       AC_MSG_CHECKING([whether Qt5 is requested])
+       dnl Default is Qt4
+       AC_ARG_ENABLE([qt5],
+         [  --enable-qt5            use Qt5 for building],
+         USE_QT5=$enableval, USE_QT5=no)
+       AC_MSG_RESULT([$USE_QT5])
+       AC_SUBST([USE_QT5])
+
        dnl this variable is precious
        AC_ARG_VAR(QT4DIR, [the place where the Qt 4 files are, e.g. 
/usr/lib/qt4])
 
@@ -173,27 +190,33 @@ AC_DEFUN([QT4_DO_PKG_CONFIG],
          
PKG_CONFIG_PATH=$qt4_cv_dir/lib:$qt4_cv_dir/lib/pkgconfig:$PKG_CONFIG_PATH
          export PKG_CONFIG_PATH
        fi
-       PKG_CHECK_MODULES(QT4_CORE, QtCore,,[:])
+       qt_corelibs="QtCore"
+       qt_guilibs="QtCore QtGui"
+       if test $USE_QT5 = "yes" ; then
+               qt_corelibs="Qt5Core"
+               qt_guilibs="Qt5Core Qt5Concurrent Qt5Gui Qt5Widgets"
+       fi
+       PKG_CHECK_MODULES(QT4_CORE, $qt_corelibs,,[:])
        if test "$pkg_failed" = "no" ; then
                QT4_CORE_INCLUDES=$QT4_CORE_CFLAGS
                AC_SUBST(QT4_CORE_INCLUDES)
-               QT4_CORE_LDFLAGS=`$PKG_CONFIG --libs-only-L QtCore`
+               QT4_CORE_LDFLAGS=`$PKG_CONFIG --libs-only-L $qt_corelibs`
                AC_SUBST(QT4_CORE_LDFLAGS)
-               QT4_CORE_LIB=`$PKG_CONFIG --libs-only-l QtCore`
+               QT4_CORE_LIB=`$PKG_CONFIG --libs-only-l $qt_corelibs`
                AC_SUBST(QT4_CORE_LIB)
        fi
-       PKG_CHECK_MODULES(QT4_FRONTEND, QtCore QtGui,,[:])
+       PKG_CHECK_MODULES(QT4_FRONTEND, $qt_guilibs,,[:])
        if test "$pkg_failed" = "no" ; then
                QT4_INCLUDES=$QT4_FRONTEND_CFLAGS
                dnl QT4_LDFLAGS=$QT4_FRONTEND_LIBS
-               QT4_LDFLAGS=`$PKG_CONFIG --libs-only-L QtCore QtGui`
+               QT4_LDFLAGS=`$PKG_CONFIG --libs-only-L $qt_guilibs`
                AC_SUBST(QT4_INCLUDES)
                AC_SUBST(QT4_LDFLAGS)
-               QT4_VERSION=`$PKG_CONFIG --modversion QtCore`
+               QT4_VERSION=`$PKG_CONFIG --modversion $qt_corelibs`
                AC_SUBST(QT4_VERSION)
-               QT4_LIB=`$PKG_CONFIG --libs-only-l QtCore QtGui`
+               QT4_LIB=`$PKG_CONFIG --libs-only-l $qt_guilibs`
                AC_SUBST(QT4_LIB)
-               dnl LIBS="$LIBS `$PKG_CONFIG --libs-only-other QtCore QtGui`"
+               dnl LIBS="$LIBS `$PKG_CONFIG --libs-only-other $qt_guilibs`"
        fi
        PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH
        dnl Actually, the values of QT4_LIB and QT4_CORE_LIB can be completely
diff --git a/INSTALL b/INSTALL
index a330a0b..2c36846 100644
--- a/INSTALL
+++ b/INSTALL
@@ -14,8 +14,8 @@ These four steps will compile, test and install LyX:
           distribution).
 
        1) ./configure configures LyX according to your system. You
-          may have to set --with-qt4-dir=<path-to-your-qt4-installation>
-          (for example, "--with-qt4-dir=/usr/share/qt4/") if the
+          may have to set --with-qt-dir=<path-to-your-qt-installation>
+          (for example, "--with-qt-dir=/usr/share/qt4/") if the
           environment variable QTDIR is not set and pkg-config is not
           available.
 
diff --git a/INSTALL.MacOSX b/INSTALL.MacOSX
index 666e4a7..3acceb6 100644
--- a/INSTALL.MacOSX
+++ b/INSTALL.MacOSX
@@ -166,10 +166,10 @@ adjust some environment variables to do so.
 
    The required compiler flags to compile a Qt4 application has to be provided.
 
-   export QT4_CORE_CFLAGS="-FQtCore"
-   export QT4_CORE_LIBS="-framework QtCore"
-   export QT4_FRONTEND_CFLAGS="-FQtGui"
-   export QT4_FRONTEND_LIBS="-framework QtGui"
+   export QT_CORE_CFLAGS="-FQtCore"
+   export QT_CORE_LIBS="-framework QtCore"
+   export QT_FRONTEND_CFLAGS="-FQtGui"
+   export QT_FRONTEND_LIBS="-framework QtGui"
 
    Depending on the architecture and target os add the compiler flags:
 
@@ -202,7 +202,7 @@ adjust some environment variables to do so.
          --with-libiconv-prefix=/usr \
          --with-x=no \
          --prefix=/path/to/LyX.app \
-         --with-qt4-dir=/path/to/Qt4
+         --with-qt-dir=/path/to/Qt4
      make
      make install-strip
 
@@ -224,7 +224,7 @@ Instead of the instructions above, do the following:
          --with-x=no \
          --disable-stdlib-debug \
          --prefix=/path/to/LyX.app \
-         --with-qt4-dir=/path/to/Qt4
+         --with-qt-dir=/path/to/Qt4
      make
      make install-strip
 
@@ -239,7 +239,7 @@ Please read the script if you're about to make a 
distributable disk image.
 
 To use it, cd to the top of the LyX source hierarchy, and enter:
 
-   sh development/LyX-Mac-binary-release.sh --with-qt4-dir=/path/to/Qt4
+   sh development/LyX-Mac-binary-release.sh --with-qt-dir=/path/to/Qt4
 
 This script automates all steps of the build process.
 It detects the sources for Qt4, Aspell and Hunspell when placed in a
diff --git a/config/qt4.m4 b/config/qt4.m4
index 58edd85..9a458cf 100644
--- a/config/qt4.m4
+++ b/config/qt4.m4
@@ -1,5 +1,5 @@
 dnl check a particular libname
-AC_DEFUN([QT4_TRY_LINK],
+AC_DEFUN([QT_TRY_LINK],
 [
        SAVE_LIBS="$LIBS"
        LIBS="$LIBS $1"
@@ -13,60 +13,69 @@ AC_DEFUN([QT4_TRY_LINK],
        break_me_(\\\);
        #endif
        ],
-       qt4_cv_libname=$1,
+       qt_cv_libname=$1,
        )
        LIBS="$SAVE_LIBS"
 ])
 
 dnl check we can do a compile
-AC_DEFUN([QT4_CHECK_COMPILE],
+AC_DEFUN([QT_CHECK_COMPILE],
 [
-       AC_MSG_CHECKING([for Qt 4 library name])
+       AC_MSG_CHECKING([for Qt library name])
 
-       AC_CACHE_VAL(qt4_cv_libname,
+       AC_CACHE_VAL(qt_cv_libname,
        [
                AC_LANG_CPLUSPLUS
                SAVE_CXXFLAGS=$CXXFLAGS
-               CXXFLAGS="$CXXFLAGS $QT4_INCLUDES $QT4_LDFLAGS"
-               for libname in -lQtCore -lQtCore4 '-framework QtCore'
+               CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QT_LDFLAGS"
+               qt_corelibs="-lQtCore -lQtCore4"
+               qt_guilibs="'-lQtCore -lQtGui' '-lQtCore4 -lQtGui4'"
+               if test $USE_QT5 = "yes" ; then
+                   qt_corelibs="-lQt5Core"
+                   qt_guilibs="-lQt5Core -lQt5Concurrent -lQt5Gui -lQt5Widgets"
+               fi
+               for libname in $qt_corelibs '-framework QtCore'
                do
-                       QT4_TRY_LINK($libname)
-                       if test -n "$qt4_cv_libname"; then
-                               QT4_CORE_LIB="$qt4_cv_libname"
+                       QT_TRY_LINK($libname)
+                       if test -n "$qt_cv_libname"; then
+                               QT_CORE_LIB="$qt_cv_libname"
                                break;
                        fi
                done
-               qt4_cv_libname=
-               for libname in '-lQtCore -lQtGui' \
-                              '-lQtCore4 -lQtGui4' \
+               qt_cv_libname=
+               for libname in $qt_guilibs \
                               '-framework QtCore -framework QtConcurrent 
-framework QtWidgets -framework QtGui'\
                               '-framework QtCore -framework QtGui'
                do
-                       QT4_TRY_LINK($libname)
-                       if test -n "$qt4_cv_libname"; then
+                       QT_TRY_LINK($libname)
+                       if test -n "$qt_cv_libname"; then
                                break;
                        fi
                done
                CXXFLAGS=$SAVE_CXXFLAGS
        ])
 
-       if test -z "$qt4_cv_libname"; then
+       if test -z "$qt_cv_libname"; then
                AC_MSG_RESULT([failed])
-               AC_MSG_ERROR([cannot compile a simple Qt 4 executable. Check 
you have the right \$QT4DIR.])
+               AC_MSG_ERROR([cannot compile a simple Qt executable. Check you 
have the right \$QTDIR.])
        else
-               AC_MSG_RESULT([$qt4_cv_libname])
+               AC_MSG_RESULT([$qt_cv_libname])
        fi
 ])
 
 
-AC_DEFUN([QT4_FIND_TOOL],
+AC_DEFUN([QT_FIND_TOOL],
 [
        $1=
-       if test -n "$qt4_cv_bin" ; then
-               AC_PATH_PROGS($1, [$2], [], $qt4_cv_bin)
+       qt_ext=qt4
+       if test $USE_QT5 = "yes" ; then
+               qt_ext=qt5
+       fi
+       if test -n "$qt_cv_bin" ; then
+               AC_PATH_PROGS($1, [$2], [], $qt_cv_bin)
        fi
        if test -z "$$1"; then
-               AC_PATH_PROGS($1, [$2-qt4 $2],[],$PATH)
+               AC_PATH_PROGS($1, [$2-$qt_ext $2],[],$PATH)
        fi
        if test -z "$$1"; then
                AC_MSG_ERROR([cannot find $2 binary.])
@@ -75,13 +84,13 @@ AC_DEFUN([QT4_FIND_TOOL],
 
 
 dnl get Qt version we're using
-AC_DEFUN([QT4_GET_VERSION],
+AC_DEFUN([QT_GET_VERSION],
 [
-       AC_CACHE_CHECK([Qt 4 version],lyx_cv_qt4version,
+       AC_CACHE_CHECK([Qt version],lyx_cv_qtversion,
        [
                AC_LANG_CPLUSPLUS
                SAVE_CPPFLAGS=$CPPFLAGS
-               CPPFLAGS="$CPPFLAGS $QT4_INCLUDES"
+               CPPFLAGS="$CPPFLAGS $QT_INCLUDES"
 
                cat > conftest.$ac_ext <<EOF
 #line __oline__ "configure"
@@ -89,124 +98,138 @@ AC_DEFUN([QT4_GET_VERSION],
 #include <qglobal.h>
 "%%%"QT_VERSION_STR"%%%"
 EOF
-               lyx_cv_qt4version=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
+               lyx_cv_qtversion=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
                        grep '^"%%%"'  2>/dev/null | \
                        sed -e 's/"%%%"//g' -e 's/"//g'`
                rm -f conftest.$ac_ext
                CPPFLAGS=$SAVE_CPPFLAGS
        ])
 
-       QT4_VERSION=$lyx_cv_qt4version
-       AC_SUBST(QT4_VERSION)
+       QTLIB_VERSION=$lyx_cv_qtversion
+       AC_SUBST(QTLIB_VERSION)
 ])
 
 dnl start here
-AC_DEFUN([QT4_DO_IT_ALL],
+AC_DEFUN([QT_DO_IT_ALL],
 [
+       AC_MSG_CHECKING([whether Qt5 is requested])
+       dnl Default is Qt4
+       AC_ARG_ENABLE([qt5],
+         [  --enable-qt5            use Qt5 for building],
+         USE_QT5=$enableval, USE_QT5=no)
+       AC_MSG_RESULT([$USE_QT5])
+       AC_SUBST([USE_QT5])
+
        dnl this variable is precious
-       AC_ARG_VAR(QT4DIR, [the place where the Qt 4 files are, e.g. 
/usr/lib/qt4])
+       AC_ARG_VAR(QTDIR, [the place where the Qt files are, e.g. /usr/lib/qt4])
 
-       AC_ARG_WITH(qt4-dir, [AC_HELP_STRING([--with-qt4-dir], [where the root 
of Qt 4 is installed])],
-               [ qt4_cv_dir=`eval echo "$withval"/` ])
+       AC_ARG_WITH(qt-dir, [AC_HELP_STRING([--with-qt-dir], [where the root of 
Qt is installed])],
+               [ qt_cv_dir=`eval echo "$withval"/` ])
 
-       AC_ARG_WITH(qt4-includes, [AC_HELP_STRING([--with-qt4-includes], [where 
the Qt 4 includes are])],
-               [ qt4_cv_includes=`eval echo "$withval"` ])
+       AC_ARG_WITH(qt-includes, [AC_HELP_STRING([--with-qt-includes], [where 
the Qt includes are])],
+               [ qt_cv_includes=`eval echo "$withval"` ])
 
-       AC_ARG_WITH(qt4-libraries, [AC_HELP_STRING([--with-qt4-libraries], 
[where the Qt 4 library is installed])],
-               [  qt4_cv_libraries=`eval echo "$withval"` ])
+       AC_ARG_WITH(qt-libraries, [AC_HELP_STRING([--with-qt-libraries], [where 
the Qt library is installed])],
+               [  qt_cv_libraries=`eval echo "$withval"` ])
 
-       dnl pay attention to $QT4DIR unless overridden
-       if test -z "$qt4_cv_dir"; then
-               qt4_cv_dir=$QT4DIR
+       dnl pay attention to $QTDIR unless overridden
+       if test -z "$qt_cv_dir"; then
+               qt_cv_dir=$QTDIR
        fi
 
        dnl derive inc/lib if needed
-       if test -n "$qt4_cv_dir"; then
-               if test -z "$qt4_cv_includes"; then
-                       qt4_cv_includes=$qt4_cv_dir/include
+       if test -n "$qt_cv_dir"; then
+               if test -z "$qt_cv_includes"; then
+                       qt_cv_includes=$qt_cv_dir/include
                fi
-               if test -z "$qt4_cv_libraries"; then
-                       qt4_cv_libraries=$qt4_cv_dir/lib
+               if test -z "$qt_cv_libraries"; then
+                       qt_cv_libraries=$qt_cv_dir/lib
                fi
        fi
 
        dnl compute the binary dir too
-       if test -n "$qt4_cv_dir"; then
-               qt4_cv_bin=$qt4_cv_dir/bin
+       if test -n "$qt_cv_dir"; then
+               qt_cv_bin=$qt_cv_dir/bin
        fi
 
        dnl Preprocessor flags
-       QT4_CPPFLAGS="-DQT_NO_STL -DQT_NO_KEYWORDS"
+       QT_CPPFLAGS="-DQT_NO_STL -DQT_NO_KEYWORDS"
        case ${host} in
-       *mingw*) QT4_CPPFLAGS="-DQT_DLL $QT4_CPPFLAGS";;
+       *mingw*) QT_CPPFLAGS="-DQT_DLL $QT_CPPFLAGS";;
        esac
-       AC_SUBST(QT4_CPPFLAGS)
+       AC_SUBST(QT_CPPFLAGS)
 
        dnl Check if it possible to do a pkg-config
        PKG_PROG_PKG_CONFIG
        if test -n "$PKG_CONFIG" ; then
-               QT4_DO_PKG_CONFIG
+               QT_DO_PKG_CONFIG
        fi
        if test "$pkg_failed" != "no" ; then
-               QT4_DO_MANUAL_CONFIG
+               QT_DO_MANUAL_CONFIG
        fi
 
-       if test -z "$QT4_LIB"; then
-         AC_MSG_ERROR([cannot find qt4 library.])
+       if test -z "$QT_LIB"; then
+         AC_MSG_ERROR([cannot find qt libraries.])
        fi
 
        dnl Check qt version
-       AS_VERSION_COMPARE($QT4_VERSION, $1,
-       [AC_MSG_ERROR([LyX requires at least version $1 of Qt. Only version 
$QT4_VERSION has been found.])
+       AS_VERSION_COMPARE($QTLIB_VERSION, $1,
+       [AC_MSG_ERROR([LyX requires at least version $1 of Qt. Only version 
$QTLIB_VERSION has been found.])
        ])
 
-       QT4_FIND_TOOL([MOC4], [moc])
-       QT4_FIND_TOOL([UIC4], [uic])
-       QT4_FIND_TOOL([RCC4], [rcc])
+       QT_FIND_TOOL([QT_MOC], [moc])
+       QT_FIND_TOOL([QT_UIC], [uic])
+       QT_FIND_TOOL([QT_RCC], [rcc])
 ])
 
-AC_DEFUN([QT4_DO_PKG_CONFIG],
+AC_DEFUN([QT_DO_PKG_CONFIG],
 [
-       dnl tell pkg-config to look also in $qt4_cv_dir/lib.
+       dnl tell pkg-config to look also in $qt_cv_dir/lib.
        save_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
-       if test -n "$qt4_cv_dir" ; then
-         
PKG_CONFIG_PATH=$qt4_cv_dir/lib:$qt4_cv_dir/lib/pkgconfig:$PKG_CONFIG_PATH
+       if test -n "$qt_cv_dir" ; then
+         
PKG_CONFIG_PATH=$qt_cv_dir/lib:$qt_cv_dir/lib/pkgconfig:$PKG_CONFIG_PATH
          export PKG_CONFIG_PATH
        fi
-       PKG_CHECK_MODULES(QT4_CORE, QtCore,,[:])
+       qt_corelibs="QtCore"
+       qt_guilibs="QtCore QtGui"
+       if test $USE_QT5 = "yes" ; then
+               qt_corelibs="Qt5Core"
+               qt_guilibs="Qt5Core Qt5Concurrent Qt5Gui Qt5Widgets"
+       fi
+       PKG_CHECK_MODULES(QT_CORE, $qt_corelibs,,[:])
        if test "$pkg_failed" = "no" ; then
-               QT4_CORE_INCLUDES=$QT4_CORE_CFLAGS
-               AC_SUBST(QT4_CORE_INCLUDES)
-               QT4_CORE_LDFLAGS=`$PKG_CONFIG --libs-only-L QtCore`
-               AC_SUBST(QT4_CORE_LDFLAGS)
-               QT4_CORE_LIB=`$PKG_CONFIG --libs-only-l QtCore`
-               AC_SUBST(QT4_CORE_LIB)
+               QT_CORE_INCLUDES=$QT_CORE_CFLAGS
+               AC_SUBST(QT_CORE_INCLUDES)
+               QT_CORE_LDFLAGS=`$PKG_CONFIG --libs-only-L $qt_corelibs`
+               AC_SUBST(QT_CORE_LDFLAGS)
+               QT_CORE_LIB=`$PKG_CONFIG --libs-only-l $qt_corelibs`
+               AC_SUBST(QT_CORE_LIB)
        fi
-       PKG_CHECK_MODULES(QT4_FRONTEND, QtCore QtGui,,[:])
+       PKG_CHECK_MODULES(QT_FRONTEND, $qt_guilibs,,[:])
        if test "$pkg_failed" = "no" ; then
-               QT4_INCLUDES=$QT4_FRONTEND_CFLAGS
-               dnl QT4_LDFLAGS=$QT4_FRONTEND_LIBS
-               QT4_LDFLAGS=`$PKG_CONFIG --libs-only-L QtCore QtGui`
-               AC_SUBST(QT4_INCLUDES)
-               AC_SUBST(QT4_LDFLAGS)
-               QT4_VERSION=`$PKG_CONFIG --modversion QtCore`
-               AC_SUBST(QT4_VERSION)
-               QT4_LIB=`$PKG_CONFIG --libs-only-l QtCore QtGui`
-               AC_SUBST(QT4_LIB)
-               dnl LIBS="$LIBS `$PKG_CONFIG --libs-only-other QtCore QtGui`"
+               QT_INCLUDES=$QT_FRONTEND_CFLAGS
+               dnl QT_LDFLAGS=$QT_FRONTEND_LIBS
+               QT_LDFLAGS=`$PKG_CONFIG --libs-only-L $qt_guilibs`
+               AC_SUBST(QT_INCLUDES)
+               AC_SUBST(QT_LDFLAGS)
+               QTLIB_VERSION=`$PKG_CONFIG --modversion $qt_corelibs`
+               AC_SUBST(QTLIB_VERSION)
+               QT_LIB=`$PKG_CONFIG --libs-only-l $qt_guilibs`
+               AC_SUBST(QT_LIB)
+               dnl LIBS="$LIBS `$PKG_CONFIG --libs-only-other $qt_guilibs`"
        fi
        PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH
-       dnl Actually, the values of QT4_LIB and QT4_CORE_LIB can be completely
+       dnl Actually, the values of QT_LIB and QT_CORE_LIB can be completely
        dnl wrong on OS X, where everything goes to --libs-only-other.
        dnl As a quick workaround, let us assign better values. A better patch
        dnl exists for next cycle.
-       QT4_CORE_LIB=$QT4_CORE_LIBS
-       QT4_CORE_LDFLAGS=
-       QT4_LIB=$QT4_FRONTEND_LIBS
-       QT4_LDFLAGS=
+       QT_CORE_LIB=$QT_CORE_LIBS
+       QT_CORE_LDFLAGS=
+       QT_LIB=$QT_FRONTEND_LIBS
+       QT_LDFLAGS=
 ])
 
-AC_DEFUN([QT4_DO_MANUAL_CONFIG],
+AC_DEFUN([QT_DO_MANUAL_CONFIG],
 [
        dnl Check for X libraries
        AC_PATH_X
@@ -219,41 +242,41 @@ AC_DEFUN([QT4_DO_MANUAL_CONFIG],
        esac
 
        dnl flags for compilation
-       QT4_INCLUDES=
-       QT4_LDFLAGS=
-       QT4_CORE_INCLUDES=
-       QT4_CORE_LDFLAGS=
-       if test -n "$qt4_cv_includes"; then
-               QT4_INCLUDES="-I$qt4_cv_includes"
+       QT_INCLUDES=
+       QT_LDFLAGS=
+       QT_CORE_INCLUDES=
+       QT_CORE_LDFLAGS=
+       if test -n "$qt_cv_includes"; then
+               QT_INCLUDES="-I$qt_cv_includes"
                for i in Qt QtCore QtGui QtWidgets QtConcurrent; do
-                       QT4_INCLUDES="$QT4_INCLUDES -I$qt4_cv_includes/$i"
+                       QT_INCLUDES="$QT_INCLUDES -I$qt_cv_includes/$i"
                done
-               QT4_CORE_INCLUDES="-I$qt4_cv_includes -I$qt4_cv_includes/QtCore"
+               QT_CORE_INCLUDES="-I$qt_cv_includes -I$qt_cv_includes/QtCore"
        fi
-       case "$qt4_cv_libraries" in
+       case "$qt_cv_libraries" in
        *framework*)
-               QT4_LDFLAGS="-F$qt4_cv_libraries"
-               QT4_CORE_LDFLAGS="-F$qt4_cv_libraries"
+               QT_LDFLAGS="-F$qt_cv_libraries"
+               QT_CORE_LDFLAGS="-F$qt_cv_libraries"
                ;;
        "")
                ;;
        *)
-               QT4_LDFLAGS="-L$qt4_cv_libraries"
-               QT4_CORE_LDFLAGS="-L$qt4_cv_libraries"
+               QT_LDFLAGS="-L$qt_cv_libraries"
+               QT_CORE_LDFLAGS="-L$qt_cv_libraries"
                ;;
        esac
-       AC_SUBST(QT4_INCLUDES)
-       AC_SUBST(QT4_CORE_INCLUDES)
-       AC_SUBST(QT4_LDFLAGS)
-       AC_SUBST(QT4_CORE_LDFLAGS)
+       AC_SUBST(QT_INCLUDES)
+       AC_SUBST(QT_CORE_INCLUDES)
+       AC_SUBST(QT_LDFLAGS)
+       AC_SUBST(QT_CORE_LDFLAGS)
 
-       QT4_CHECK_COMPILE
+       QT_CHECK_COMPILE
 
-       QT4_LIB=$qt4_cv_libname;
-       AC_SUBST(QT4_LIB)
-       AC_SUBST(QT4_CORE_LIB)
+       QT_LIB=$qt_cv_libname;
+       AC_SUBST(QT_LIB)
+       AC_SUBST(QT_CORE_LIB)
 
-       if test -n "$qt4_cv_libname"; then
-               QT4_GET_VERSION
+       if test -n "$qt_cv_libname"; then
+               QT_GET_VERSION
        fi
 ])
diff --git a/configure.ac b/configure.ac
index 9b87677..7ba65bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,7 +36,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 PACKAGE=$save_PACKAGE
 
 # Allow to build some parts of the code as one big chunk
-m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt4])
+m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt])
 AC_ARG_ENABLE(monolithic-build,
   AC_HELP_STRING([--enable-monolithic-build@<:@=LIST@:>@],
                [Use monolithic build for modules in LIST (default: ALLPARTS)]),
@@ -55,7 +55,7 @@ AM_CONDITIONAL(MONOLITHIC_INSETS, test 
"x$enable_monolithic_insets" = "xyes")
 AM_CONDITIONAL(MONOLITHIC_MATHED, test "x$enable_monolithic_mathed" = "xyes")
 AM_CONDITIONAL(MONOLITHIC_CORE, test "x$enable_monolithic_core" = "xyes")
 AM_CONDITIONAL(MONOLITHIC_TEX2LYX, test "x$enable_monolithic_tex2lyx" = "xyes")
-AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT4, test 
"x$enable_monolithic_frontend_qt4" = "xyes")
+AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT, test "x$enable_monolithic_frontend_qt" 
= "xyes")
 
 ### Set the execute permissions of the various scripts correctly
 for file in config/install-sh ; do
@@ -128,14 +128,14 @@ AC_CHECK_HEADERS(magic.h,
    is correctly installed on your system.
    Falling back to builtin file format detection.])])
 
-### setup the qt4 frontend.
+### setup the qt frontend.
 dnl The code below is not in a macro, because this would cause big
-dnl problems with the AC_REQUIRE contained in QT4_DO_IT_ALL.
-QT4_DO_IT_ALL([4.5.0])
+dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
+QT_DO_IT_ALL([4.5.0])
 AC_SUBST([FRONTENDS_SUBDIRS], [qt4])
 FRONTEND_INFO="${FRONTEND_INFO}\
-  Qt 4 Frontend:\n\
-      Qt 4 version:\t\t${QT4_VERSION}\n"
+  Qt Frontend:\n\
+      Qt version:\t\t${QTLIB_VERSION}\n"
 
 # fix the value of the prefixes.
 test "x$prefix" = xNONE && prefix=$default_prefix
diff --git a/development/LyX-Mac-binary-release.sh 
b/development/LyX-Mac-binary-release.sh
index 2ba1c67..34db8bf 100644
--- a/development/LyX-Mac-binary-release.sh
+++ b/development/LyX-Mac-binary-release.sh
@@ -157,7 +157,7 @@ while [ $# -gt 0 ]; do
                fi
                shift
                ;;
-       --with-qt4-dir=*)
+       --with-qt-dir=*)
                QTDIR=$(echo ${1}|cut -d= -f2)
                shift
                ;;
@@ -624,10 +624,10 @@ build_lyx() {
                HOSTSYSTEM=$(eval "echo \\$HostSystem_$arch")
 
                if [ "$configure_qt4_frameworks" = "yes" ]; then
-                       export QT4_CORE_CFLAGS="-FQtCore"
-                       export QT4_CORE_LIBS="-framework QtCore"
-                       export QT4_FRONTEND_CFLAGS="-FQtGui"
-                       export QT4_FRONTEND_LIBS="-framework QtGui"
+                       export QT_CORE_CFLAGS="-FQtCore"
+                       export QT_CORE_LIBS="-framework QtCore"
+                       export QT_FRONTEND_CFLAGS="-FQtGui"
+                       export QT_FRONTEND_LIBS="-framework QtGui"
                        CPPFLAGS="${CPPFLAGS} 
-I${SDKROOT}/Library/Frameworks/QtCore.framework/Headers"
                        CPPFLAGS="${CPPFLAGS} 
-I${SDKROOT}/Library/Frameworks/QtGui.framework/Headers"
                fi
@@ -636,10 +636,10 @@ build_lyx() {
                export LDFLAGS
                echo CPPFLAGS="${CPPFLAGS}"
                export CPPFLAGS
-               echo CONFIGURE_OPTIONS="${LyXConfigureOptions}" 
${QtInstallDir:+"--with-qt4-dir=${QtInstallDir}"}
+               echo CONFIGURE_OPTIONS="${LyXConfigureOptions}" 
${QtInstallDir:+"--with-qt-dir=${QtInstallDir}"}
                "${LyxSourceDir}/configure"\
                        --prefix="${LyxAppPrefix}" 
--with-version-suffix="-${LyXVersionSuffix}"\
-                       ${QtInstallDir:+"--with-qt4-dir=${QtInstallDir}"} \
+                       ${QtInstallDir:+"--with-qt-dir=${QtInstallDir}"} \
                        ${LyXConfigureOptions}\
                        --enable-build-type=rel && \
                make ${MAKEJOBS} && make install${strip}
diff --git a/development/attic/lyxled/Makefile.am 
b/development/attic/lyxled/Makefile.am
index 125c647..6ea7747 100644
--- a/development/attic/lyxled/Makefile.am
+++ b/development/attic/lyxled/Makefile.am
@@ -8,15 +8,15 @@ CLEANFILES += $(BUILT_SOURCES)
 
 #########################  Qt stuff  #############################
 # Use _() for localization instead of tr() or trUtf8()
-UIC4FLAGS=-tr lyx::qt_
+UICFLAGS=-tr lyx::qt_
 
 ui_%.h: ui/%.ui
-       $(UIC4) $(UIC4FLAGS) $< -o $@
+       $(QT_UIC) $(UICFLAGS) $< -o $@
 
 MOCEDFILES = $(MOCHEADER:%.h=%_moc.cpp)
 
 %_moc.cpp: %.h
-       $(MOC4) -o $@ $<
+       $(QT_MOC) -o $@ $<
 
 #Resources.qrc: Makefile
 #      echo "<!DOCTYPE RCC><RCC version='1.0'><qresource>" > $@
@@ -26,21 +26,21 @@ MOCEDFILES = $(MOCHEADER:%.h=%_moc.cpp)
 #      echo "</qresource></RCC>" >> $@
 #
 #Resources.cpp: Resources.qrc
-#      $(RCC4) $< -name Resources -o $@
+#      $(QT_RCC) $< -name Resources -o $@
 
 
 #########################  LIBRARIES  #############################
 
 bin_PROGRAMS = lyxled
 
-lyxled_LDADD = $(QT4_LIB)
+lyxled_LDADD = $(QT_LIB)
 lyxled_DEPENDENCIES = $(MOCEDFILES)
 
 AM_CPPFLAGS += \
-       $(QT4_CPPFLAGS) \
+       $(QT_CPPFLAGS) \
        -UQT_NO_KEYWORDS \
        -I$(top_srcdir)/src \
-       $(QT4_INCLUDES)
+       $(QT_INCLUDES)
 
 SOURCEFILES = \
        main.cpp \
@@ -74,15 +74,15 @@ CLEANFILES += $(BUILT_SOURCES)
 
 #########################  Qt stuff  #############################
 # Use _() for localization instead of tr() or trUtf8()
-UIC4FLAGS=-tr lyx::qt_
+UICFLAGS=-tr lyx::qt_
 
 ui_%.h: ui/%.ui
-       $(UIC4) $(UIC4FLAGS) $< -o $@
+       $(QT_UIC) $(UICFLAGS) $< -o $@
 
 MOCEDFILES = $(MOCHEADER:%.h=%_moc.cpp)
 
 %_moc.cpp: %.h
-       $(MOC4) -o $@ $<
+       $(QT_MOC) -o $@ $<
 
 #Resources.qrc: Makefile
 #      echo "<!DOCTYPE RCC><RCC version='1.0'><qresource>" > $@
@@ -92,21 +92,21 @@ MOCEDFILES = $(MOCHEADER:%.h=%_moc.cpp)
 #      echo "</qresource></RCC>" >> $@
 #
 #Resources.cpp: Resources.qrc
-#      $(RCC4) $< -name Resources -o $@
+#      $(QT_RCC) $< -name Resources -o $@
 
 
 #########################  LIBRARIES  #############################
 
 bin_PROGRAMS = lyxled
 
-lyxled_LDADD = $(QT4_LIB)
+lyxled_LDADD = $(QT_LIB)
 lyxled_DEPENDENCIES = $(MOCEDFILES)
 
 AM_CPPFLAGS += \
-       $(QT4_CPPFLAGS) \
+       $(QT_CPPFLAGS) \
        -UQT_NO_KEYWORDS \
        -I$(top_srcdir)/src \
-       $(QT4_INCLUDES)
+       $(QT_INCLUDES)
 
 SOURCEFILES = \
        main.cpp \
diff --git a/src/Makefile.am b/src/Makefile.am
index 3203945..e40a3bc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@ include $(top_srcdir)/config/common.am
 ############################### Core  ##############################
 
 AM_CPPFLAGS += $(PCH_FLAGS) -I$(top_srcdir)/src $(BOOST_INCLUDES) 
$(ENCHANT_CFLAGS) $(HUNSPELL_CFLAGS)
-AM_CPPFLAGS += $(QT4_CPPFLAGS) $(QT4_CORE_INCLUDES)
+AM_CPPFLAGS += $(QT_CPPFLAGS) $(QT_CORE_INCLUDES)
 
 if BUILD_CLIENT_SUBDIR
 CLIENT = client
@@ -28,8 +28,8 @@ lyx_LDADD = \
        liblyxgraphics.a \
        support/liblyxsupport.a \
        $(OTHERLIBS) \
-       $(QT4_LDFLAGS) \
-       $(QT4_LIB)
+       $(QT_LDFLAGS) \
+       $(QT_LIB)
 
 if LYX_WIN_RESOURCE
 .rc.o:
@@ -331,7 +331,7 @@ BUILT_SOURCES += $(MOCEDFILES)
 CLEANFILES += $(MOCEDFILES)
 
 moc_%.cpp: %.h
-       $(MOC4) $(MOCFLAG) -o $@ $<
+       $(QT_MOC) $(MOCFLAG) -o $@ $<
 
 liblyxcore_a_DEPENDENCIES = $(MOCEDFILES)
 
@@ -692,8 +692,8 @@ ADD_FRAMEWORKS = -framework QtGui -framework QtCore 
-framework AppKit -framework
 endif
 
 check_layout_CPPFLAGS = $(AM_CPPFLAGS)
-check_layout_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ 
$(QT4_CORE_LIBS) $(LIBSHLWAPI)
-check_layout_LDFLAGS = $(QT4_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
+check_layout_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ 
$(QT_CORE_LIBS) $(LIBSHLWAPI)
+check_layout_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
 check_layout_SOURCES = \
        insets/InsetLayout.cpp \
        Color.cpp \
diff --git a/src/client/Makefile.am b/src/client/Makefile.am
index d3c4da4..3251ac1 100644
--- a/src/client/Makefile.am
+++ b/src/client/Makefile.am
@@ -13,7 +13,7 @@ AM_CPPFLAGS += -I$(srcdir)/.. $(BOOST_INCLUDES)
 lyxclient_LDADD = \
        $(top_builddir)/src/support/liblyxsupport.a \
        $(BOOST_LIBS) @LIBS@ $(SOCKET_LIBS) \
-       $(QT4_LIB) $(QT4_LDFLAGS) $(LIBSHLWAPI) $(LIBPSAPI)
+       $(QT_LIB) $(QT_LDFLAGS) $(LIBSHLWAPI) $(LIBPSAPI)
 
 if INSTALL_MACOSX
 lyxclient_LDFLAGS = -framework AppKit
diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am
index fc42e9b..5270ba4 100644
--- a/src/frontends/qt4/Makefile.am
+++ b/src/frontends/qt4/Makefile.am
@@ -8,20 +8,20 @@ CLEANFILES += $(BUILT_SOURCES)
 
 #########################  Qt stuff  #############################
 # Use _() for localization instead of tr() or trUtf8()
-UIC4FLAGS=-tr lyx::qt_
+UICFLAGS=-tr lyx::qt_
 
 # The ui_%.h pattern must match the filter in ../../../po/Rules-lyx
 ui_%.h: ui/%.ui
-       $(AM_V_GEN)$(UIC4) $(UIC4FLAGS) $< -o $@
+       $(AM_V_GEN)$(QT_UIC) $(UICFLAGS) $< -o $@
 
 MOCEDFILES = $(MOCHEADER:%.h=moc_%.cpp)
 
-QT_VERSION = $(shell IFS=.; set -- `echo $(QT4_VERSION)`; \
+QT_VERSION = $(shell IFS=.; set -- `echo $(QTLIB_VERSION)`; \
             echo 0x0`echo "obase=16; $$1*65536+$$2*256+$$3" | bc`)
 
 # The moc_%.cpp pattern must match the filter in ../../../po/Rules-lyx
 moc_%.cpp: %.h
-       $(AM_V_GEN)$(MOC4) -DQT_VERSION=$(QT_VERSION) -o $@ $<
+       $(AM_V_GEN)$(QT_MOC) -DQT_VERSION=$(QT_VERSION) -o $@ $<
 
 Resources.qrc: Makefile
        $(AM_V_GEN)echo "<!DOCTYPE RCC><RCC version='1.0'><qresource>" > $@ ; \
@@ -31,7 +31,7 @@ Resources.qrc: Makefile
        echo "</qresource></RCC>" >> $@
 
 Resources.cpp: Resources.qrc
-       $(AM_V_GEN)$(RCC4) $< -name Resources -o $@
+       $(AM_V_GEN)$(QT_RCC) $< -name Resources -o $@
 
 
 #########################  LIBRARIES  #############################
@@ -41,13 +41,13 @@ noinst_LIBRARIES = liblyxqt4.a
 liblyxqt4_a_DEPENDENCIES = $(MOCEDFILES)
 
 AM_CPPFLAGS += \
-       $(QT4_CPPFLAGS) \
+       $(QT_CPPFLAGS) \
        -DQT_NO_CAST_TO_ASCII \
        -DQT_NO_STL \
        -I$(top_srcdir)/src \
        -I$(top_srcdir)/src/frontends \
        -I$(top_srcdir)/images \
-       $(QT4_INCLUDES) $(BOOST_INCLUDES)
+       $(QT_INCLUDES) $(BOOST_INCLUDES)
 
 SOURCEFILES = \
        ButtonPolicy.cpp \
@@ -361,7 +361,7 @@ UIFILES = \
 liblyxqt4.cpp:
        @echo -e '$(SOURCEFILES:%=\n#include "%")\n' > $@
 
-if MONOLITHIC_FRONTEND_QT4
+if MONOLITHIC_FRONTEND_QT
 
 liblyxqt4_a_SOURCES = \
        liblyxqt4.cpp \
diff --git a/src/support/Makefile.am b/src/support/Makefile.am
index 76035c4..52e31aa 100644
--- a/src/support/Makefile.am
+++ b/src/support/Makefile.am
@@ -20,7 +20,7 @@ CLEANFILES += $(MOCEDFILES)
 BUILT_SOURCES += $(MOCEDFILES)
 
 moc_%.cpp: %.h
-       $(MOC4) -o $@ $<
+       $(QT_MOC) -o $@ $<
 
 liblyxsupport_a_DEPENDENCIES = $(MOCEDFILES)
 
@@ -28,7 +28,7 @@ liblyxsupport_a_DEPENDENCIES = $(MOCEDFILES)
 ##################################################################
 
 AM_CPPFLAGS += $(PCH_FLAGS) -I$(srcdir)/.. $(BOOST_INCLUDES)
-AM_CPPFLAGS += $(QT4_CPPFLAGS) $(QT4_INCLUDES)
+AM_CPPFLAGS += $(QT_CPPFLAGS) $(QT_INCLUDES)
 
 liblyxsupport_a_SOURCES = \
        FileMonitor.h \
@@ -159,22 +159,22 @@ if INSTALL_MACOSX
 ADD_FRAMEWORKS = -framework QtGui -framework QtCore -framework AppKit 
-framework ApplicationServices
 endif
 
-check_convert_LDADD = liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) 
$(QT4_CORE_LIBS) $(LIBSHLWAPI) @LIBS@
-check_convert_LDFLAGS = $(QT4_LDFLAGS) $(ADD_FRAMEWORKS)
+check_convert_LDADD = liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) 
$(QT_CORE_LIBS) $(LIBSHLWAPI) @LIBS@
+check_convert_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
 check_convert_SOURCES = \
        tests/check_convert.cpp \
        tests/dummy_functions.cpp \
        tests/boost.cpp
 
-check_filetools_LDADD = liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) 
$(QT4_CORE_LIBS) $(LIBSHLWAPI) @LIBS@
-check_filetools_LDFLAGS = $(QT4_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
+check_filetools_LDADD = liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) 
$(QT_CORE_LIBS) $(LIBSHLWAPI) @LIBS@
+check_filetools_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
 check_filetools_SOURCES = \
        tests/check_filetools.cpp \
        tests/dummy_functions.cpp \
        tests/boost.cpp
 
-check_lstrings_LDADD = liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) 
$(QT4_CORE_LIBS) $(LIBSHLWAPI) @LIBS@
-check_lstrings_LDFLAGS = $(QT4_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
+check_lstrings_LDADD = liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) 
$(QT_CORE_LIBS) $(LIBSHLWAPI) @LIBS@
+check_lstrings_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
 check_lstrings_SOURCES = \
        tests/check_lstrings.cpp \
        tests/dummy_functions.cpp \
diff --git a/src/tex2lyx/Makefile.am b/src/tex2lyx/Makefile.am
index 0aa887e..fe36218 100644
--- a/src/tex2lyx/Makefile.am
+++ b/src/tex2lyx/Makefile.am
@@ -111,7 +111,7 @@ tex2lyx_SOURCES = \
 tex2lyx_LDADD = \
        $(top_builddir)/src/support/liblyxsupport.a \
        $(LIBICONV) $(BOOST_LIBS) \
-       $(QT4_LIB) $(QT4_LDFLAGS) \
+       $(QT_LIB) $(QT_LDFLAGS) \
        @LIBS@ $(LIBSHLWAPI) $(LIBPSAPI)
 
 if INSTALL_MACOSX

Reply via email to