From 16865ace024d35f59c7c4fd65a94ee6a2bd8a5a5 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Tue, 22 Oct 2024 19:31:24 +0300
Subject: [PATCH 51/51] Autotools: Require --enable-ack-legacy to configure

Disallow autotools configure unless new --enable-ack-legacy
configure option is given.

See RM #1006

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 configure.ac                                        | 13 +++++++++++++
 doc/README.packaging                                |  2 ++
 .../windows/installer_msys2/Makefile.autotools      |  6 +++---
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9dd30fb205..ed0f00a6c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -121,6 +121,19 @@ fcdb_odbc=no
 fcdb_postgres=no
 fcdb_sqlite3=no
 
+AC_ARG_ENABLE([ack-legacy],
+  AS_HELP_STRING([--enable-ack-legacy],
+                 [acknowledge that using autotools to build freeciv is a legacy system]),
+[case "${enableval}" in
+  yes) ack_legacy=yes ;;
+  no)  ack_legacy=no ;;
+  *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ack-legacy) ;;
+esac], [ack_legacy=no])
+if test "x$ack_legacy" != "xyes" ; then
+  AC_MSG_ERROR([Recommended build system for freeciv is meson. See doc/INSTALL.meson.
+To still build with autotools, configure with --enable-ack-legacy option.])
+fi
+
 dnl checks for databases
 dnl all:                  Autodetect as many as possible [default].
 dnl mysql:                use mysql database
diff --git a/doc/README.packaging b/doc/README.packaging
index 00cc3c515c..d0d0403404 100644
--- a/doc/README.packaging
+++ b/doc/README.packaging
@@ -19,6 +19,8 @@ Updating from 3.2 to 3.3
 * Minimum version of Qt is Qt-5.15, when building in Qt5-mode
 * Configuring source directory is no longer allowed in autotools builds.
   You have to use separate build dir(s)
+* One needs to use configure option --enable-ack-legacy to build
+  with autotools. Use meson based system instead, if possible
 * Minimum autoconf version, for autotools based builds, is now 2.69
 * New 'qt6x' mode for building Qt based components linked against
   relatively new Qt6 versions
diff --git a/platforms/windows/installer_msys2/Makefile.autotools b/platforms/windows/installer_msys2/Makefile.autotools
index 1c31695e39..9b05825ff3 100644
--- a/platforms/windows/installer_msys2/Makefile.autotools
+++ b/platforms/windows/installer_msys2/Makefile.autotools
@@ -130,19 +130,19 @@ configure-freeciv-common:
 	# Create build directory
 	mkdir -p $(BUILD_DIR)/$(WINARCH)-$(GUI)
 	# Configure
-	cd $(BUILD_DIR)/$(WINARCH)-$(GUI); $(SRC_ROOT)/../../../configure FREECIV_LABEL_FORCE="<base>-msys2" CPPFLAGS="-D_WIN32_WINNT=$(MIN_WIN_VER)" --enable-client=$(CLIENT) --with-followtag="windows-S3_3" --with-tinycthread --without-readline --disable-sys-lua --enable-fcdb=sqlite3 --with-sqlite3-prefix=/$(ARCHDIR) --enable-fcmp=$(FCMP) --with-cacert-path="./ssl/certs/ca-bundle.crt" $(EXTRA_CONFIG)
+	cd $(BUILD_DIR)/$(WINARCH)-$(GUI); $(SRC_ROOT)/../../../configure FREECIV_LABEL_FORCE="<base>-msys2" CPPFLAGS="-D_WIN32_WINNT=$(MIN_WIN_VER)" --enable-client=$(CLIENT) --with-followtag="windows-S3_3" --with-tinycthread --without-readline --disable-sys-lua --enable-fcdb=sqlite3 --with-sqlite3-prefix=/$(ARCHDIR) --enable-fcmp=$(FCMP) --with-cacert-path="./ssl/certs/ca-bundle.crt" --enable-ack-legacy $(EXTRA_CONFIG)
 
 configure-freeciv-ruledit-qt5:
 	# Create build directory
 	mkdir -p $(BUILD_DIR)/$(WINARCH)-ruledit-qt5
 	# Configure
-	cd $(BUILD_DIR)/$(WINARCH)-ruledit-qt5; $(SRC_ROOT)/../../../configure FREECIV_LABEL_FORCE="<base>-msys2" CPPFLAGS="-D_WIN32_WINNT=$(MIN_WIN_VER)" --with-qtver=qt5 --disable-client --disable-server --disable-fcmp --disable-freeciv-manual --disable-sys-lua --enable-ruledit --enable-ai-static=stub --with-cacert-path="./ssl/certs/ca-bundle.crt" --with-qt5-includes=/$(ARCHDIR)/include --with-qt5-libs=/$(ARCHDIR)/lib $(EXTRA_CONFIG)
+	cd $(BUILD_DIR)/$(WINARCH)-ruledit-qt5; $(SRC_ROOT)/../../../configure FREECIV_LABEL_FORCE="<base>-msys2" CPPFLAGS="-D_WIN32_WINNT=$(MIN_WIN_VER)" --with-qtver=qt5 --disable-client --disable-server --disable-fcmp --disable-freeciv-manual --disable-sys-lua --enable-ruledit --enable-ai-static=stub --with-cacert-path="./ssl/certs/ca-bundle.crt" --with-qt5-includes=/$(ARCHDIR)/include --with-qt5-libs=/$(ARCHDIR)/lib --enable-ack-legacy $(EXTRA_CONFIG)
 
 configure-freeciv-ruledit-qt6:
 	# Create build directory
 	mkdir -p $(BUILD_DIR)/$(WINARCH)-ruledit-qt6
 	# Configure
-	cd $(BUILD_DIR)/$(WINARCH)-ruledit-qt6; $(SRC_ROOT)/../../../configure FREECIV_LABEL_FORCE="<base>-msys2" CPPFLAGS="-D_WIN32_WINNT=$(MIN_WIN_VER)" --with-qtver=qt6 --disable-client --disable-server --disable-fcmp --disable-freeciv-manual --disable-sys-lua --enable-ruledit --enable-ai-static=stub --with-cacert-path="./ssl/certs/ca-bundle.crt" --with-qt6-includes=/$(ARCHDIR)/include/qt6 --with-qt6-libs=/$(ARCHDIR)/lib $(EXTRA_CONFIG)
+	cd $(BUILD_DIR)/$(WINARCH)-ruledit-qt6; $(SRC_ROOT)/../../../configure FREECIV_LABEL_FORCE="<base>-msys2" CPPFLAGS="-D_WIN32_WINNT=$(MIN_WIN_VER)" --with-qtver=qt6 --disable-client --disable-server --disable-fcmp --disable-freeciv-manual --disable-sys-lua --enable-ruledit --enable-ai-static=stub --with-cacert-path="./ssl/certs/ca-bundle.crt" --with-qt6-includes=/$(ARCHDIR)/include/qt6 --with-qt6-libs=/$(ARCHDIR)/lib --enable-ack-legacy $(EXTRA_CONFIG)
 
 # Install Freeciv
 
-- 
2.45.2

