From 2c2a7ed0ef6ccb8d5a56f09873cea5561f9c2664 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 6 Dec 2022 22:16:25 +0200 Subject: [PATCH 21/21] fc_prehrds.h: Make sure zlib.h is included before readline Fixes a problem seen with tcc. When readline was being included first, it sometimes defined macros that system headers tried to define again. See osdn #46225 Signed-off-by: Marko Lindqvist --- server/console.c | 2 ++ server/stdinhand.c | 2 ++ utility/fc_prehdrs.h | 10 ++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/server/console.c b/server/console.c index 8f366714a9..bcebdeade0 100644 --- a/server/console.c +++ b/server/console.c @@ -15,6 +15,8 @@ #include #endif +#include "fc_prehdrs.h" + #include #include #include diff --git a/server/stdinhand.c b/server/stdinhand.c index 94af434de4..c896c9a85b 100644 --- a/server/stdinhand.c +++ b/server/stdinhand.c @@ -15,6 +15,8 @@ #include #endif +#include "fc_prehdrs.h" + #include #include #include diff --git a/utility/fc_prehdrs.h b/utility/fc_prehdrs.h index 823fbfc8aa..4b8658c09b 100644 --- a/utility/fc_prehdrs.h +++ b/utility/fc_prehdrs.h @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,8 +33,14 @@ extern "C" { #endif /* FREECIV_HAVE_WINSOCK2 */ #endif /* FREECIV_HAVE_WINSOCK */ +/* Make sure zlib.h is included before readline, as we don't want + readline to define macros that should come from the system. */ +#if defined(FREECIV_HAVE_LIBREADLINE) && defined(FREECIV_HAVE_LIBZ) +#include +#endif + #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* FC__PREHDRS_H */ +#endif /* FC__PREHDRS_H */ -- 2.35.1