From 932deeaf2dcdf8d1665bf8ebe53e9828019bff73 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH] readline: define _XOPEN_SOURCE at the top of files It is a requirement to define feature_test_macros(7) as soon as possible before including any files, otherwise the headers may not allow further configuration, as reconfiguration maybe denied. You need to pick the standard you wish to work with for the compilation unit (the file). This can be seen with an error for lack of symbol `wcwidth()` from wchar.h Moving the order slightly fixes the compile failure issue. See feature_test_macros(7) for more info. GCC14 --without-tk --without-tcl (without system libreadline-dev) --- readline/readline-4.3/display.c | 3 ++- readline/readline-4.3/mbutil.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/readline/readline-4.3/display.c b/readline/readline-4.3/display.c index 83f12f26..ab6e39b1 100644 --- a/readline/readline-4.3/display.c +++ b/readline/readline-4.3/display.c @@ -21,6 +21,8 @@ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #define READLINE_LIBRARY +#define _XOPEN_SOURCE /* See feature_test_macros(7) */ + #if defined (HAVE_CONFIG_H) # include #endif @@ -41,7 +43,6 @@ #include -#define _XOPEN_SOURCE /* See feature_test_macros(7) */ #include /* System-specific feature definitions and include files. */ diff --git a/readline/readline-4.3/mbutil.c b/readline/readline-4.3/mbutil.c index 397c22a6..32cbee1f 100644 --- a/readline/readline-4.3/mbutil.c +++ b/readline/readline-4.3/mbutil.c @@ -25,6 +25,8 @@ # include #endif +#define _XOPEN_SOURCE /* See feature_test_macros(7) */ + #include #include #include