From d234ef6c7fdab464ce7b7da4f553f93fe70ee9d1 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 24 Jun 2023 11:32:06 +0300 Subject: [PATCH 27/27] Configure: Fix EMERGENCY_VERSION redefinition Handle EMERGENCY_VERSION on autotools builds like in meson builds: Do not define EMERGENCY_VERSION to fc_config.h directly, but include version_gen.h there. This fixes the issue that sometimes the definition in fc_config.h was conflicting with one in version_gen.h in any case. See osdn #48283 Signed-off-by: Marko Lindqvist --- client/packhand.c | 6 ++++-- common/capstr.c | 3 --- common/version.h | 6 +++--- configure.ac | 9 +++++---- server/connecthand.c | 6 ++++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/client/packhand.c b/client/packhand.c index c8f8262db7..61d1f73d76 100644 --- a/client/packhand.c +++ b/client/packhand.c @@ -422,11 +422,13 @@ void handle_server_join_reply(bool you_can_join, const char *message, } client_info.gui = get_gui_type(); + #ifdef EMERGENCY_VERSION client_info.emerg_version = EMERGENCY_VERSION; -#else +#else /* EMERGENCY_VERSION */ client_info.emerg_version = 0; -#endif +#endif /* EMERGENCY_VERSION */ + strncpy(client_info.distribution, FREECIV_DISTRIBUTOR, sizeof(client_info.distribution)); send_packet_client_info(&client.conn, &client_info); diff --git a/common/capstr.c b/common/capstr.c index 1f7764eb14..7fcb68223b 100644 --- a/common/capstr.c +++ b/common/capstr.c @@ -17,9 +17,6 @@ #include /* getenv() */ -/* gen_headers */ -#include "version_gen.h" - /* utility */ #include "support.h" diff --git a/common/version.h b/common/version.h index e204b8fe40..fc1089c7dc 100644 --- a/common/version.h +++ b/common/version.h @@ -25,10 +25,10 @@ extern "C" { * The month[] array is defined in version.c (index: 1 == Jan, 2 == Feb, ...). */ #ifndef NEXT_RELEASE_MONTH -#define NEXT_RELEASE_MONTH (month[FREECIV_RELEASE_MONTH]) +#define NEXT_RELEASE_MONTH (month[FREECIV_RELEASE_MONTH]) #endif -/* version informational strings */ +/* Version informational strings */ const char *freeciv_name_version(void); const char *word_version(void); const char *fc_git_revision(void); @@ -46,4 +46,4 @@ const char *unstable_message(void); } #endif /* __cplusplus */ -#endif /* FC__VERSION_H */ +#endif /* FC__VERSION_H */ diff --git a/configure.ac b/configure.ac index 858518e4f7..5f2dbeee39 100644 --- a/configure.ac +++ b/configure.ac @@ -35,7 +35,11 @@ dnl Explain fc_config.h to end users (e.g., on Windows) AH_TOP( [/* This header file is shipped in some binary distributions. * It is included purely for reference as to how the executables were built, - * and changing it will have no functional effect on pre-built binaries. */]) + * and changing it will have no functional effect on pre-built binaries. */ + +/* gen_headers */ +#include "version_gen.h" +]) AC_DEFINE(FC_CONFIG_H, 1, [Configuration autogenerated]) AC_DEFINE_UNQUOTED([BUG_URL], ["$BUG_URL"], [Bug reporting URL]) @@ -59,9 +63,6 @@ AC_ARG_VAR([MOCCMD], [QT moc command (autodetected if not set)]) AC_DEFINE_UNQUOTED([MAJOR_VERSION], [$MAJOR_VERSION], [Major version]) AC_DEFINE_UNQUOTED([MINOR_VERSION], [$MINOR_VERSION], [Minor version]) AC_DEFINE_UNQUOTED([PATCH_VERSION], [$PATCH_VERSION], [Patch version]) -if test x$EMERGENCY_VERSION != x ; then - AC_DEFINE_UNQUOTED([EMERGENCY_VERSION], [$EMERGENCY_VERSION], [Emergency version]) -fi AC_DEFINE_UNQUOTED([VERSION_LABEL], ["${VERSION_LABEL}"], [Version label]) AC_DEFINE_UNQUOTED([VERSION_STRING], ["${VERSION_STRING}"], [Version string]) AC_DEFINE_UNQUOTED([IS_DEVEL_VERSION], [$IS_DEVEL_VERSION], [Is this a devel version]) diff --git a/server/connecthand.c b/server/connecthand.c index 7d7adc5289..868f6e7d8c 100644 --- a/server/connecthand.c +++ b/server/connecthand.c @@ -454,11 +454,13 @@ bool handle_login_request(struct connection *pconn, info.major_version = MAJOR_VERSION; info.minor_version = MINOR_VERSION; info.patch_version = PATCH_VERSION; + #ifdef EMERGENCY_VERSION info.emerg_version = EMERGENCY_VERSION; -#else +#else /* EMERGENCY_VERSION */ info.emerg_version = 0; -#endif +#endif /* EMERGENCY_VERSION */ + sz_strlcpy(info.version_label, VERSION_LABEL); send_packet_server_info(pconn, &info); } -- 2.40.1