From 4310430a38fd53254df2d27d0f14b906bd9cf63c Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sat, 19 Nov 2022 19:28:07 +0100 Subject: [PATCH] autoconf: remove support for compiling against Qt4 Most of the changes consist in assuming that USE_QT5=yes. Update INSTALL and README accordingly. --- INSTALL | 15 ++++----- README | 3 +- TODO.killqt4 | 3 -- config/lyxinclude.m4 | 17 ++-------- config/qt.m4 | 78 ++++++++++++-------------------------------- configure.ac | 3 -- 6 files changed, 31 insertions(+), 88 deletions(-) diff --git a/INSTALL b/INSTALL index f26fba6aa9..330e7e11ea 100644 --- a/INSTALL +++ b/INSTALL @@ -52,18 +52,17 @@ You will also probably need GNU m4 (perhaps installed as gm4). Requirements ------------ -First of all, you will need a C++11 standard conforming compiler, like gcc (at -least 4.9) or clang. +First of all, you will need a C++11 standard conforming compiler, like g++ (at +least 4.9, to have proper srd::regex) or clang++. LyX makes great use of the C++ Standard Template Library (STL). This means that gcc users will have to install the relevant libstdc++ library to be able to compile this version of LyX. For full LyX usability we suggest to use Qt 5.6 and higher, or at the -very least Qt 5.4. For compilation you need to compile against at least -Qt 4.8 which has been widely tested, and for Windows we advise at least -Qt 4.8.4. The only special point to make is that you must ensure that -both LyX and the Qt libraries are compiled with the same C++ compiler. +very least Qt 5.4. It is also possible to compile against Qt 6.The +only special point to make is that you must ensure that both LyX and +the Qt libraries are compiled with the same C++ compiler. To build LyX with spell checking capabilities included you have to install at least one of the development packages of the spell checker @@ -124,8 +123,8 @@ flags: The `gprof' build type compiles and links with -pg option with gcc. - o --disable-qt5 that forces configuration with Qt 4.x when Qt 5.x is - also available. By default Qt5 is tried first, and then Qt4. + o --enable-qt6 that checks configuration with Qt 6.x, and then Qt + 5.x. By default, only Qt5 is tried. o --with-extra-lib=DIRECTORY that specifies the path where LyX will find extra libraries (like Qt) it needs. Defaults to NONE diff --git a/README b/README index a0a44dc75b..b6b7a2ffb3 100644 --- a/README +++ b/README @@ -91,8 +91,7 @@ What do I need to compile LyX from the source distribution? need at least gcc 4.9. * The Qt library, at least version 5.2 (5.6 recommended). It is - still possible to compile with Qt 4.8, but this is not - recommended. + also possible to compile with Qt 6.x. Read the file "INSTALL" for more information on compiling. diff --git a/TODO.killqt4 b/TODO.killqt4 index 05e7bb3b1d..d36c4ea736 100644 --- a/TODO.killqt4 +++ b/TODO.killqt4 @@ -1,10 +1,7 @@ Things left to do after killing Qt4 (obtained by grepping for Qt4 and 'Qt 4'): * look at the FIXME KILLQT4 comments in src/ and resolve them -* update README -* update INSTALL * update INSTALL.cmake * update INSTALL.MacOSX -* update autoconf * update cmake * check whether development/autotests/keytest.py really needs QT4 investigate references to Qt4 in keytest diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index e6cab08e3b..b6c26cadc2 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -74,18 +74,6 @@ AC_MSG_RESULT([$USE_QT6]) AC_SUBST([USE_QT6]) ]) dnl -AC_DEFUN([LYX_CHECK_QT5],[ -AC_MSG_CHECKING([whether Qt5 is disabled]) -AC_ARG_ENABLE([qt5], - [AS_HELP_STRING([--disable-qt5],[do not use Qt5 for building])], - USE_QT5=$enableval, USE_QT5=yes) -if test x$USE_QT5 != xno ; then - AC_MSG_RESULT([no]) -else - AC_MSG_RESULT([yes]) -fi -AC_SUBST([USE_QT5]) -]) dnl Usage: LYX_WARNING(message) Displays the warning "message" and sets the @@ -381,9 +369,8 @@ if test x$GXX = xyes; then AM_CXXFLAGS="$AM_CXXFLAGS -fno-omit-frame-pointer" fi - if test x$USE_QT5 = xyes -o x$USE_QT6 = xyes; then - AS_CASE([$host], [*mingw*|*cygwin*], [], [AM_CXXFLAGS="-fPIC $AM_CXXFLAGS"]) - fi + AS_CASE([$host], [*mingw*|*cygwin*], [], [AM_CXXFLAGS="-fPIC $AM_CXXFLAGS"]) + dnl Warnings are for preprocessor too if test x$enable_warnings = xyes ; then AM_CPPFLAGS="$AM_CPPFLAGS -Wall -Wextra" diff --git a/config/qt.m4 b/config/qt.m4 index 2cd4263f06..d89f30ada5 100644 --- a/config/qt.m4 +++ b/config/qt.m4 @@ -29,7 +29,7 @@ AC_DEFUN([QT_CHECK_COMPILE], if test $USE_QT6 = "yes" ; then qt_corelibs="-lQt6Core -lQt6Core5Compat" qt_guilibs="-lQt6Core -lQt6Core5Compat -lQt6Concurrent -lQt6Gui -lQt6Svg -lQt6Widgets" - elif test $USE_QT5 = "yes" ; then + else qt_corelibs="-lQt5Core" qt_guilibs="-lQt5Core -lQt5Concurrent -lQt5Gui -lQt5Svg -lQt5Widgets" fi @@ -58,8 +58,6 @@ AC_DEFUN([QT_CHECK_COMPILE], if test -z "$qt_cv_libname"; then if test x$USE_QT6 = xyes ; then AC_MSG_RESULT([failed, retrying with Qt5]) - elif test x$USE_QT5 = xyes ; then - AC_MSG_RESULT([failed, retrying with Qt4]) else AC_MSG_RESULT([failed]) AC_MSG_ERROR([cannot compile a simple Qt executable. Check you have the right \$QTDIR.]) @@ -73,11 +71,9 @@ AC_DEFUN([QT_CHECK_COMPILE], AC_DEFUN([QT_FIND_TOOL], [ $1= - qt_major=4 + qt_major=5 if test "x$USE_QT6" != "xno" ; then qt_major=6 - elif test "x$USE_QT5" != "xno" ; then - qt_major=5 fi qt_ext="qt$qt_major" @@ -191,23 +187,7 @@ AC_DEFUN([QT_DO_IT_ALL], dnl Try again with Qt5 and then Qt4 if configuring for Qt6/5 fails if test x$USE_QT6 = xyes ; then USE_QT6=no - USE_QT5=yes - AC_SUBST([USE_QT6]) - AC_SUBST([USE_QT5]) - if test -n "$PKG_CONFIG" ; then - QT_DO_PKG_CONFIG - fi - if test "$pkg_failed" != "no" ; then - QT_DO_MANUAL_CONFIG - fi - if test -z "$QT_LIB"; then - AC_MSG_ERROR([cannot find qt libraries.]) - fi - elif test x$USE_QT5 = xyes ; then - USE_QT6=no - USE_QT5=no AC_SUBST([USE_QT6]) - AC_SUBST([USE_QT5]) if test -n "$PKG_CONFIG" ; then QT_DO_PKG_CONFIG fi @@ -246,25 +226,13 @@ AC_DEFUN([QT_DO_IT_ALL], [AC_MSG_RESULT(yes) AC_DEFINE(QPA_XCB, 1, [Define if Qt uses the X Window System])], [AC_MSG_RESULT(no)]) - elif test x$USE_QT5 = xyes ; then + else AC_EGREP_CPP(xcb, [#include <$lyx_qt5_config> QT_QPA_DEFAULT_PLATFORM_NAME], [AC_MSG_RESULT(yes) AC_DEFINE(QPA_XCB, 1, [Define if Qt uses the X Window System])], [AC_MSG_RESULT(no)]) - else - AC_PREPROC_IFELSE([AC_LANG_SOURCE([ - [#include ], - [#ifndef Q_WS_X11], - [#error Fail], - [#endif]])], - qt_use_x11=yes, - qt_use_x11=no) - AC_MSG_RESULT($qt_use_x11) - if test "x$qt_use_x11" = "xyes"; then - QT_LIB="$QT_LIB -lX11" - fi fi CPPFLAGS=$save_CPPFLAGS @@ -287,28 +255,24 @@ AC_DEFUN([QT_DO_PKG_CONFIG], PKG_CONFIG_PATH=$qt_cv_dir/lib:$qt_cv_dir/lib/pkgconfig:$PKG_CONFIG_PATH export PKG_CONFIG_PATH fi - qt_corelibs="QtCore" - qt_guilibs="QtCore QtGui QtSvg" - if test "x$USE_QT5" != "xno" ; then - qt_corelibs="Qt5Core" - qt_guilibs="Qt5Core Qt5Concurrent Qt5Gui Qt5Svg Qt5Widgets" - lyx_use_x11extras=false - PKG_CHECK_EXISTS(Qt5X11Extras, [lyx_use_x11extras=true], []) - if $lyx_use_x11extras; then - qt_guilibs="$qt_guilibs Qt5X11Extras xcb" - AC_DEFINE(HAVE_QT5_X11_EXTRAS, 1, - [Define if you have the Qt5X11Extras module]) - fi - lyx_use_winextras=false - PKG_CHECK_EXISTS(Qt5WinExtras, [lyx_use_winextras=true], []) - if $lyx_use_winextras; then - qt_guilibs="$qt_guilibs Qt5WinExtras" - fi - lyx_use_macextras=false - PKG_CHECK_EXISTS(Qt5MacExtras, [lyx_use_macextras=true], []) - if $lyx_use_macextras; then - qt_guilibs="$qt_guilibs Qt5MacExtras" - fi + qt_corelibs="Qt5Core" + qt_guilibs="Qt5Core Qt5Concurrent Qt5Gui Qt5Svg Qt5Widgets" + lyx_use_x11extras=false + PKG_CHECK_EXISTS(Qt5X11Extras, [lyx_use_x11extras=true], []) + if $lyx_use_x11extras; then + qt_guilibs="$qt_guilibs Qt5X11Extras xcb" + AC_DEFINE(HAVE_QT5_X11_EXTRAS, 1, + [Define if you have the Qt5X11Extras module]) + fi + lyx_use_winextras=false + PKG_CHECK_EXISTS(Qt5WinExtras, [lyx_use_winextras=true], []) + if $lyx_use_winextras; then + qt_guilibs="$qt_guilibs Qt5WinExtras" + fi + lyx_use_macextras=false + PKG_CHECK_EXISTS(Qt5MacExtras, [lyx_use_macextras=true], []) + if $lyx_use_macextras; then + qt_guilibs="$qt_guilibs Qt5MacExtras" fi PKG_CHECK_MODULES(QT_CORE, $qt_corelibs,,[:]) if test "$pkg_failed" = "no" ; then diff --git a/configure.ac b/configure.ac index eabbcf86cf..8c0ad6caf0 100644 --- a/configure.ac +++ b/configure.ac @@ -14,9 +14,6 @@ AC_CONFIG_AUX_DIR(config) LYX_CHECK_VERSION LYX_VERSION_SUFFIX LYX_CHECK_QT6 -if test x$USE_QT6 = xno ; then -LYX_CHECK_QT5 -fi # Check how the files should be packaged AC_CANONICAL_TARGET LYX_USE_PACKAGING -- 2.39.5