From 32fb5bc1261d7248b6f887a79d5ee3e2faf6731f Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 18 Jan 2025 14:17:09 +0200
Subject: [PATCH 21/21] Drop qt5 configure options

See RM #1218

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 INSTALL                          |  10 +-
 Makefile.am                      |   2 -
 configure.ac                     |   8 +-
 doc/INSTALL.meson                |   4 +-
 doc/README.packaging             |   1 +
 gen_headers/meson_fc_config.h.in |   3 -
 m4/compiler.m4                   |  12 +-
 m4/features.m4                   |   2 +-
 m4/qt.m4                         |   5 -
 m4/qt5-darwin.m4                 | 101 ----------------
 m4/qt5.m4                        | 192 -------------------------------
 meson.build                      |  31 +----
 meson_options.txt                |   4 +-
 13 files changed, 19 insertions(+), 356 deletions(-)
 delete mode 100644 m4/qt5-darwin.m4
 delete mode 100644 m4/qt5.m4

diff --git a/INSTALL b/INSTALL
index fdd9c1fb0d..2506e432cf 100644
--- a/INSTALL
+++ b/INSTALL
@@ -8,7 +8,7 @@ Installing Freeciv:
 
 This file describes how to compile and install Freeciv. Last time we
 made sure this file is up to date was 16-Jul-06.
-Last minor update was 10-Jul-24.
+Last minor update was 18-Jan-25.
 
 There may be a localized version of this file in the ./doc directory,
 named INSTALL.<locale> (e.g., INSTALL.de).
@@ -328,8 +328,7 @@ following order: pkgconf, Glib, Atk, Pango, Gdk-Pixbuf, Gtk.
  - C++ compiler.
 
    Qt-client is written in C++, so you need appropriate compiler.
-   Compiler needs to support c++17 standard, or,
-   in case of --with-qtver=qt5 build, just c++11 standard
+   Compiler needs to support c++17 standard.
 
    In Freeciv development, g++ has been the primary C++ compiler.
    Also clang++ has been used.
@@ -337,7 +336,7 @@ following order: pkgconf, Glib, Atk, Pango, Gdk-Pixbuf, Gtk.
  - Qt Meta Object Compiler (moc)
 
    Qt's Meta Object Compiler is a command usually called 'moc', or
-   'moc-qt6' or 'moc-qt5' depending on Qt version in some systems.
+   'moc-qt6'.
    You may want install 'qtchooser' to find correct moc version for you
    when you have multiple Qt versions installed in parallel.
 
@@ -347,9 +346,6 @@ following order: pkgconf, Glib, Atk, Pango, Gdk-Pixbuf, Gtk.
 
  - Qt6Core, Qt6Gui, and Qt6Widgets libraries and headers.
    At least version 6.0 is required.
-   If one configures with Qt5 compatibility switch --with-qtver=qt5,
-   required libraries and headers are Qt5Core, Qt5Gui, and Qt5Widgets
-   and at least version 5.15 of Qt is required.
 
 
 2. Generating Makefiles
diff --git a/Makefile.am b/Makefile.am
index 6349e32324..aa793c0cc8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -85,9 +85,7 @@ EXTRA_DIST =	autogen.sh 			\
 		m4/postgres.m4			\
 		m4/progtest.m4			\
 		m4/qt.m4			\
-		m4/qt5.m4			\
 		m4/qt6.m4			\
-		m4/qt5-darwin.m4		\
 		m4/qt6-darwin.m4		\
 		m4/qt-client.m4			\
 		m4/readline.m4			\
diff --git a/configure.ac b/configure.ac
index 453d3da9e6..74b49155f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -674,22 +674,18 @@ PKG_CHECK_MODULES([ICU], [icu-uc],,
 UTILITY_CFLAGS="${UTILITY_CFLAGS} ${ICU_CFLAGS}"
 UTILITY_LIBS="${UTILITY_LIBS} ${ICU_LIBS}"
 
-dnl Should we build Qt5 versions of Qt programs?
 dnl This needs to be before C++ compiler check FC_WORKING_CXX, and
 dnl that in turn needs to be before FC_DEBUG that will depend on compiler
 dnl when setting compiler flags.
 AC_ARG_WITH([qtver],
-  AS_HELP_STRING([--with-qtver], [which Qt version to build against qt5/qt6/qt6x]),
+  AS_HELP_STRING([--with-qtver], [which Qt version to build against qt6/qt6x]),
 [case "${withval}" in
- qt5|Qt5) qt_ver="Qt5" ;;
  qt6|Qt6) qt_ver="Qt6" ;;
  qt6x|Qt6x) qt_ver="Qt6x" ;;
  *) AC_MSG_ERROR([bad value ${enableval} for --with-qtver]) ;;
 esac], [qt_ver="Qt6"])
 
-if test "x$qt_ver" = "xQt5" ; then
-  AC_DEFINE([FC_QT5_MODE], [1], [this is Qt5 based build])
-elif test "x$qt_ver" = "xQt6x" ; then
+if test "x$qt_ver" = "xQt6x" ; then
   AC_DEFINE([FC_QT6X_MODE], [1], [this is build based on current Qt6 version])
 fi
 
diff --git a/doc/INSTALL.meson b/doc/INSTALL.meson
index ad509a4856..7da3c19b1f 100644
--- a/doc/INSTALL.meson
+++ b/doc/INSTALL.meson
@@ -176,8 +176,8 @@ appimage (boolean):
 gen-packets-args (array):
   Additional packet generator arguments passed to common/generate_packets.py.
 
-qtver ('qt5'/'qt6'/'qt6x'):
-  Whether to build Qt5, Qt6, or experimental Qt6 versions of the binaries.
+qtver ('qt6'/'qt6x'):
+  Whether to build Qt6, or experimental Qt6 versions of the binaries.
 
 project-definition (string):
   Filename of the project definition to use. See below for contents of
diff --git a/doc/README.packaging b/doc/README.packaging
index 2a3ca9ea9d..f9f53417fd 100644
--- a/doc/README.packaging
+++ b/doc/README.packaging
@@ -16,6 +16,7 @@ Updating from 3.3 to 3.4
   load options from old client files generated by former version of Freeciv
   (e.g. ~/.freeciv/freeciv-client-rc-3.3 generated by Freeciv 3.3,
    ~/.freeciv-client-rc-3.2 generated by Freeciv 3.2).
+* Qt5 support removed
 
 ----------------------------------------------------------------------
 Compatibility of modified versions
diff --git a/gen_headers/meson_fc_config.h.in b/gen_headers/meson_fc_config.h.in
index 0ccc994c94..636509c339 100644
--- a/gen_headers/meson_fc_config.h.in
+++ b/gen_headers/meson_fc_config.h.in
@@ -52,9 +52,6 @@
 /* Have Sqlite3 database backend */
 #mesondefine HAVE_FCDB_SQLITE3
 
-/* Build in Qt5 mode */
-#mesondefine FC_QT5_MODE
-
 /* Build in Qt6x mode */
 #mesondefine FC_QT6X_MODE
 
diff --git a/m4/compiler.m4 b/m4/compiler.m4
index 873c79beda..d90221c964 100644
--- a/m4/compiler.m4
+++ b/m4/compiler.m4
@@ -97,11 +97,7 @@ LDFLAGS="$flags_save"
 # Sets variable cxx_works accordingly.
 AC_DEFUN([FC_WORKING_CXX],
 [
-if test "x$qt_ver" = "xQt5" ; then
-  AX_CXX_COMPILE_STDCXX([11], [], [optional])
-elif test "x$qt_ver" = "xQt6" || test "x$qt_ver" = "xQt6x" ; then
-  AX_CXX_COMPILE_STDCXX([17], [], [optional])
-fi
+AX_CXX_COMPILE_STDCXX([17], [], [optional])
 
 AC_MSG_CHECKING([whether C++ compiler works])
 
@@ -117,11 +113,7 @@ cxx_works=no])
 
 AC_LANG_POP([C++])
 
-if test "x$qt_ver" = "xQt5" && test "x$HAVE_CXX11" = "x" ; then
-  dnl Qt5 requires C++11.
-  AC_MSG_WARN([The C++ compiler doesn't support C++11])
-  cxx_works=no
-elif test "x$qt_ver" = "xQt6" && test "x$HAVE_CXX17" = "x" ; then
+if test "x$HAVE_CXX17" = "x" ; then
   dnl Qt6 requires C++17.
   AC_MSG_WARN([The C++ compiler doesn't support C++17])
   cxx_works=no
diff --git a/m4/features.m4 b/m4/features.m4
index 713f0d69dc..92c3179a1b 100644
--- a/m4/features.m4
+++ b/m4/features.m4
@@ -29,7 +29,7 @@ if test "x$list_missing_features" = "xyes" ; then
   FC_FEATURE([threads suitable for threaded ai], [$feature_thr_cond], [pthreads])
   FC_FEATURE([lua linked from system], [$feature_syslua], [lua-5.4])
   FC_FEATURE([tolua command from system], [$feature_systolua_cmd], [tolua])
-  FC_FEATURE([Ruleset Editor], [$feature_ruledit], [Qt6, or Qt5, development packages])
+  FC_FEATURE([Ruleset Editor], [$feature_ruledit], [Qt6 development packages])
 
   if test "x$missing_list" = "x" ; then
     AC_MSG_NOTICE([
diff --git a/m4/qt.m4 b/m4/qt.m4
index 4dcec96988..1b8487033d 100644
--- a/m4/qt.m4
+++ b/m4/qt.m4
@@ -13,10 +13,5 @@ AC_DEFUN([FC_QT],
       FC_QT_CXXFLAGS="$FC_QT6_CXXFLAGS"
       FC_QT_LIBS="$FC_QT6_LIBS"
       fc_qt_usable="$fc_qt6_usable" ;;
-    xqt5|xQt5) FC_QT5
-      FC_QT_CPPFLAGS="$FC_QT5_CPPFLAGS"
-      FC_QT_CXXFLAGS="$FC_QT5_CXXFLAGS"
-      FC_QT_LIBS="$FC_QT5_LIBS"
-      fc_qt_usable="$fc_qt5_usable" ;;
   esac
 ])
diff --git a/m4/qt5-darwin.m4 b/m4/qt5-darwin.m4
deleted file mode 100644
index 26e41b2db8..0000000000
--- a/m4/qt5-darwin.m4
+++ /dev/null
@@ -1,101 +0,0 @@
-# Detect Qt5 headers and libraries and set flag variables for Mac OS X 10.10+
-
-AC_DEFUN([FC_QT5_DARWIN],
-[
-  AC_ARG_WITH([qt5-framework],
-    AS_HELP_STRING([--with-qt5-framework], [path to root of Qt5 framework (MacOS, autodetected if wasn't specified)]),
-    [qt5_path="${withval}"])
-
-  AC_ARG_WITH([qt5-framework-bin],
-    AS_HELP_STRING([--with-qt5-framework-bin], [path to binares of Qt5 framework (MacOS X, autodetected if wasn't specified)]),
-    [qt5_framework_bin="${withval}"])
-
-  if test "x$qt5_framework_bin" = "x" ; then
-    AC_CHECK_PROG([QTPATHS], [qtpaths], [qtpaths], [no])
-  elif test -x "$qt5_framework_bin/qtpaths" ; then
-    QTPATHS="$qt5_framework_bin/qtpaths"
-  fi
-
-  if test "x$qt5_path" != "x" || test "x$QTPATHS" != "xno" ; then
-
-    AC_MSG_CHECKING([Qt5 framework])
-
-    if test "x$qt5_framework_bin" = "x" ; then
-      if test "x$QTPATHS" != "xno" ; then
-        qt5_framework_bin="$($QTPATHS --binaries-dir)"
-      fi
-    fi
-    if test "x$qt5_path" = "x" ; then
-      qt5_path="$($QTPATHS --install-prefix)"
-    fi
-
-    if test "x$qt5_path" != "x" ; then
-      AC_LANG_PUSH([C++])
-      FC_QT5_DARWIN_COMPILETEST([$qt5_path])
-      if test "x$qt5_headers" = "xyes" ; then
-        FC_QT5_DARWIN_LINKTEST([$qt5_path])
-      else
-        fc_qt5_usable=false
-      fi
-      AC_LANG_POP([C++])
-
-      if test "x$qt5_libs" = "xyes" ; then
-        if test "x$qt5_framework_bin" != "x" ; then
-          AS_IF([test "x$MOCCMD" = "x"], [MOCCMD="$qt5_framework_bin/moc"])
-        fi
-        AS_IF([test -x $MOCCMD], [fc_qt5_usable=true], [fc_qt5_usable=false])
-      else
-        fc_qt5_usable=false
-      fi
-    fi
-
-    if test "x$fc_qt5_usable" = "xtrue" ; then
-      AC_MSG_RESULT([found])
-    else
-      AC_MSG_RESULT([not found])
-    fi
-  fi
-])
-
-dnl Test if Qt5 headers are found from given path
-AC_DEFUN([FC_QT5_DARWIN_COMPILETEST],
-[
-  CPPFADD=" -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I$1/lib/QtWidgets.framework/Versions/5/Headers -I$1/lib/QtGui.framework/Versions/5/Headers -I$1/lib/QtCore.framework/Versions/5/Headers -I. -I$1/mkspecs/macx-clang -F$1/lib "
-
-  CPPFLAGS_SAVE="$CPPFLAGS"
-  CPPFLAGS="${CPPFLAGS}${CPPFADD}"
-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QApplication>]],
-[[int a; QApplication app(a, 0);]])],
-    [qt5_headers=yes
-     FC_QT5_CPPFLAGS="${FC_QT5_CPPFLAGS}${CPPFADD}"],
-    [CXXFLAGS_SAVE="${CXXFLAGS}"
-     CXXFLAGS="${CXXFLAGS} -fPIC"
-     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QApplication>]],
-[[int a; QApplication app(a, 0);]])],
-      [qt5_headers=yes
-       FC_QT5_CPPFLAGS="${FC_QT5_CPPFLAGS}${CPPFADD}"
-       FC_QT5_CXXFLAGS="${FC_QT5_CXXFLAGS} -fPIC"])
-     CXXFLAGS="${CXXFLAGS_SAVE}"])
-
-  CPPFLAGS="$CPPFLAGS_SAVE"
-])
-
-dnl Test Qt application linking with current flags
-AC_DEFUN([FC_QT5_DARWIN_LINKTEST],
-[
-  LIBSADD=" -F$1/lib -framework QtWidgets -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL"
-
-  CPPFLAGS_SAVE="$CPPFLAGS"
-  CPPFLAGS="$CPPFLAGS $FC_QT5_CPPFLAGS"
-  CXXFLAGS_SAVE="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAGS $FC_QT5_CXXFLAGS"
-  LIBS_SAVE="$LIBS"
-  LIBS="${LIBS}${LIBSADD}"
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <QApplication>]],
-[[int a; QApplication app(a, 0);]])],
-[qt5_libs=yes
- FC_QT5_LIBS="${FC_QT5_LIBS}${LIBSADD}"])
- LIBS="$LIBS_SAVE"
- CPPFLAGS="${CPPFLAGS_SAVE}"
- CXXFLAGS="${CXXFLAGS_SAVE}"
-])
diff --git a/m4/qt5.m4 b/m4/qt5.m4
deleted file mode 100644
index 2257bfa3c1..0000000000
--- a/m4/qt5.m4
+++ /dev/null
@@ -1,192 +0,0 @@
-# Detect Qt5 headers and libraries and set flag variables
-
-AC_DEFUN([FC_QT5],
-[
-  if test "x$fc_qt5_usable" = "x" ; then
-    FC_QT5_CPPFLAGS="-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00"
-    case $host_os in
-    darwin*) FC_QT5_DARWIN;;
-    *) FC_QT5_GENERIC;;
-    esac
-  fi
-])
-
-AC_DEFUN([FC_QT5_GENERIC],
-[
-  AC_LANG_PUSH([C++])
-
-  AC_MSG_CHECKING([Qt5 headers])
-
-  AC_ARG_WITH([qt5-includes],
-    AS_HELP_STRING([--with-qt5-includes], [path to Qt5 includes]),
-              [FC_QT5_COMPILETEST([$withval])],
-[POTENTIAL_PATHS="/usr/include /usr/include/qt5 /usr/include/qt"
-
-  # search multiarch paths too (if the multiarch tuple can be found)
-  FC_MULTIARCH_TUPLE()
-  AS_IF(test "x$MULTIARCH_TUPLE" != "x",
-    POTENTIAL_PATHS="$POTENTIAL_PATHS /usr/include/$MULTIARCH_TUPLE/qt5")
-
-  dnl First test without any additional include paths to see if it works already
-  FC_QT5_COMPILETEST
-  for TEST_PATH in $POTENTIAL_PATHS
-  do
-    if test "x$qt5_headers" != "xyes" ; then
-      FC_QT5_COMPILETEST($TEST_PATH)
-    fi
-  done])
-
-  if test "x$qt5_headers" = "xyes" ; then
-    AC_MSG_RESULT([found])
-
-    AC_MSG_CHECKING([Qt5 libraries])
-    AC_ARG_WITH([qt5-libs],
-      AS_HELP_STRING([--with-qt5-libs], [path to Qt5 libraries]),
-                [FC_QT5_LINKTEST([$withval])],
-[POTENTIAL_PATHS="/usr/lib/qt5 /usr/lib/qt"
-
-    # search multiarch paths too (if the multiarch tuple can be found)
-    FC_MULTIARCH_TUPLE()
-    AS_IF(test "x$MULTIARCH_TUPLE" != "x",
-      POTENTIAL_PATHS="$POTENTIAL_PATHS /usr/lib/$MULTIARCH_TUPLE/qt5")
-
-    dnl First test without any additional library paths to see if it works already
-    FC_QT5_LINKTEST
-    for TEST_PATH in $POTENTIAL_PATHS
-    do
-      if test "x$qt5_libs" != "xyes" ; then
-        FC_QT5_LINKTEST($TEST_PATH)
-      fi
-    done])
-  fi
-
-  if test "x$qt5_libs" = "xyes" ; then
-    AC_MSG_RESULT([found])
-    AC_MSG_CHECKING([for Qt5 >= 5.15])
-    FC_QT5_VERSION_CHECK
-  fi
-
-  AC_LANG_POP([C++])
-  if test "x$fc_qt5_min_ver" = "xyes" ; then
-    AC_MSG_RESULT([ok])
-    FC_QT5_VALIDATE_MOC([fc_qt5_usable=true], [fc_qt5_usable=false])
-  else
-    AC_MSG_RESULT([not found])
-    fc_qt5_usable=false
-  fi
-])
-
-dnl Test if Qt headers are found from given path
-AC_DEFUN([FC_QT5_COMPILETEST],
-[
-  if test "x$1" != "x" ; then
-    CPPFADD=" -I$1 -I$1/QtCore -I$1/QtGui -I$1/QtWidgets"
-  else
-    CPPFADD=""
-  fi
-
-  CPPFLAGS_SAVE="$CPPFLAGS"
-  CPPFLAGS="${CPPFLAGS}${CPPFADD}"
-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QApplication>]],
-[[int a; QApplication app(a, 0);]])],
-    [qt5_headers=yes
-     FC_QT5_CPPFLAGS="${FC_QT5_CPPFLAGS}${CPPFADD}"],
-    [CXXFLAGS_SAVE="${CXXFLAGS}"
-     CXXFLAGS="${CXXFLAGS} -fPIC"
-     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QApplication>]],
-[[int a; QApplication app(a, 0);]])],
-       [qt5_headers=yes
-        FC_QT5_CPPFLAGS="${FC_QT5_CPPFLAGS}${CPPFADD}"
-        FC_QT5_CXXFLAGS="${FC_QT5_CXXFLAGS} -fPIC"
-        dnl So, Qt requires -fPIC. At the same time it might conflict with -fPIE
-        dnl Try to disable pie (but even if that fails, we have -fPIC)
-        dnl Only add -no-pie if it works also with -Werror
-        CXXFLAGS="${CXXFLAGS} -no-pie -Werror"
-        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QApplication>]],
-[[int a; QApplication app(a, 0);]])],
-          [FC_QT5_CXXFLAGS="${FC_QT5_CXXFLAGS} -no-pie"])
-       ])
-     CXXFLAGS="${CXXFLAGS_SAVE}"])
-
-  CPPFLAGS="$CPPFLAGS_SAVE"
-])
-
-dnl Check if the included version of Qt is at least Qt5.15
-dnl Output: fc_qt5_min_ver=yes|no
-AC_DEFUN([FC_QT5_VERSION_CHECK],
-[
-  CPPFLAGS_SAVE="$CPPFLAGS"
-  CPPFLAGS="$CPPFLAGS $FC_QT5_CPPFLAGS"
-  CXXFLAGS_SAVE="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAGS $FC_QT5_CXXFLAGS"
-  LIBS_SAVE="$LIBS"
-  LIBS="${LIBS}${LIBSADD}"
-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
-    [[#include <QtCore>]],[[
-      #if QT_VERSION < 0x050f00
-        fail
-      #endif
-    ]])],
-    [fc_qt5_min_ver=yes],
-    [fc_qt5_min_ver=no])
-  LIBS="$LIBS_SAVE"
-  CPPFLAGS="${CPPFLAGS_SAVE}"
-  CXXFLAGS="${CXXFLAGS_SAVE}"
-])
-
-
-dnl Test Qt application linking with current flags
-AC_DEFUN([FC_QT5_LINKTEST],
-[
-  if test "x$1" != "x" ; then
-    LIBSADD=" -L$1 -lQt5Gui -lQt5Core -lQt5Widgets"
-  else
-    LIBSADD=" -lQt5Gui -lQt5Core -lQt5Widgets"
-  fi
-
-  CPPFLAGS_SAVE="$CPPFLAGS"
-  CPPFLAGS="$CPPFLAGS $FC_QT5_CPPFLAGS"
-  CXXFLAGS_SAVE="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAGS $FC_QT5_CXXFLAGS"
-  LIBS_SAVE="$LIBS"
-  LIBS="${LIBS}${LIBSADD}"
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <QApplication>]],
-[[int a; QApplication app(a, 0);]])],
-[qt5_libs=yes
- FC_QT5_LIBS="${FC_QT5_LIBS}${LIBSADD}"])
- LIBS="$LIBS_SAVE"
- CPPFLAGS="${CPPFLAGS_SAVE}"
- CXXFLAGS="${CXXFLAGS_SAVE}"
-])
-
-dnl If $1 is Qt 5's moc command then $2 else $3
-AC_DEFUN([FC_QT5_IF_QT5_MOC],
-  AS_IF([$1 -v >/dev/null 2>/dev/null &&
-         (test "`$1 -v 2<&1 | grep -o 'Qt [[[0-9]]]\+'`" = "Qt 5" ||
-          test "`$1 -v 2<&1 | grep -o 'moc [[[0-9]]]\+'`" = "moc 5" ||
-          test "`$1 -v 2<&1 | grep -o 'moc-qt[[[0-9]]]\+'`" = "moc-qt5")],
-    [$2], [$3]))
-
-dnl Set MOCCMD to $1 if it is the Qt 5 "moc". If not run $2 parameter.
-AC_DEFUN([FC_QT5_TRY_MOC],
-  [FC_QT5_IF_QT5_MOC([$1], [MOCCMD="$1"], [$2])])
-
-
-dnl If a usable moc command is found do $1 else do $2
-AC_DEFUN([FC_QT5_VALIDATE_MOC], [
-  AC_MSG_CHECKING([the Qt 5 moc command])
-
-  dnl Try to find a Qt 5 'moc' if MOCCMD isn't set.
-  dnl Test that the supplied MOCCMD is a Qt 5 'moc' if it is set.
-  AS_IF([test "x$MOCCMD" = "x"],
-    [FC_QT5_TRY_MOC([moc],
-      [FC_QT5_TRY_MOC([qtchooser -run-tool=moc -qt=5],
-        [FC_QT5_TRY_MOC([moc-qt5],
-          [MOCCMD=""])])])],
-    [FC_QT5_TRY_MOC([$MOCCMD],
-      AC_MSG_ERROR(["MOCCMD set to a bad value ($MOCCMD)"]))])
-
-  dnl If no Qt 5 'moc' was found do $2, else do $1
-  AS_IF([test "x$MOCCMD" = "x"],
-    [AC_MSG_RESULT([not found]); $2],
-    [AC_MSG_RESULT([$MOCCMD]); $1])])
diff --git a/meson.build b/meson.build
index 3b284bcacf..677c26db04 100644
--- a/meson.build
+++ b/meson.build
@@ -928,13 +928,7 @@ if get_option('audio') == 'sdl3' or get_option('clients').contains('sdl3')
   endif
 endif
 
-if qtver == 'qt5'
-  qt_minver='0x050f00'
-  add_global_arguments('-DQT_DISABLE_DEPRECATED_BEFORE=' + qt_minver, language : 'cpp')
-  priv_conf_data.set('FC_QT5_MODE', 1)
-  qt_opts = []
-  qt_cppflags = '-fPIC'
-elif qtver == 'qt6x'
+if qtver == 'qt6x'
   qt_minver='0x060700'
   add_global_arguments('-DQT_DISABLE_DEPRECATED_BEFORE=' + qt_minver, language : 'cpp')
   priv_conf_data.set('FC_QT6X_MODE', 1)
@@ -3630,15 +3624,8 @@ if gtk4_theme
                              'freeciv/themes/gtk4/Freeciv/gtk-4.0'))
 endif
 
-if qtver == 'qt6' or qtver == 'qt6x'
-  qt_mod = import('qt6')
-
-  qt_dep = dependency('Qt6', modules: ['Core', 'Gui', 'Widgets'], required: false)
-else
-  qt_mod = import('qt5')
-
-  qt_dep = dependency('Qt5', modules: ['Core', 'Gui', 'Widgets'], required: false)
-endif
+qt_mod = import('qt6')
+qt_dep = dependency('Qt6', modules: ['Core', 'Gui', 'Widgets'], required: false)
 
 if qt_dep.found() and cxx_build
   if cxx_compiler.compiles(
@@ -3667,10 +3654,8 @@ if get_option('clients').contains('qt')
 if not qtfine
   if qtver == 'qt6'
     error('Qt6 >= 6.0 required for qt-client in Qt6 mode, but not found')
-  elif qtver == 'qt6x'
+  elser
     error('Qt6 >= 6.7 required for qt-client in Qt6x mode, but not found')
-  else
-    error('Qt5 >= 5.15 required for qt-client in Qt5 mode, but not found')
   endif
 endif
 
@@ -4365,10 +4350,8 @@ if get_option('fcmp').contains('qt')
 if not qtfine
   if qtver == 'qt6'
     error('Qt6 >= 6.0 required for qt-modpack-installer in Qt6 mode, but not found')
-  elif qtver == 'qt6x'
-    error('Qt6 >= 6.7 required for qt-modpack-installer in Qt6x mode, but not found')
   else
-    error('Qt5 >= 5.15 required for qt-modpack-installer in Qt5 mode, but not found')
+    error('Qt6 >= 6.7 required for qt-modpack-installer in Qt6x mode, but not found')
   endif
 endif
 
@@ -4455,10 +4438,8 @@ if get_option('tools').contains('ruledit')
 if not qtfine
   if qtver == 'qt6'
     error('Qt6 >= 6.0 required for ruledit in Qt6 mode, but not found')
-  elif qtver == 'qt6x'
-    error('Qt6 >= 6.7 required for ruledit in Qt6x mode, but not found')
   else
-    error('Qt5 >= 5.15 required for ruledit in Qt5 mode, but not found')
+    error('Qt6 >= 6.7 required for ruledit in Qt6x mode, but not found')
   endif
 endif
 
diff --git a/meson_options.txt b/meson_options.txt
index 9d36a0cb97..8708934439 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -85,9 +85,9 @@ option('gen-packets-args',
 
 option('qtver',
        type: 'combo',
-       choices: ['qt5', 'qt6', 'qt6x'],
+       choices: ['qt6', 'qt6x'],
        value: 'qt6',
-       description: 'Whether to build Qt5, Qt6, or experimental Qt6 versions of the binaries')
+       description: 'Whether to build Qt6, or experimental Qt6 versions of the binaries')
 
 option('project-definition',
        type: 'string',
-- 
2.45.2

