]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix readline build on mingw
authorTom Tromey <tom@tromey.com>
Sat, 16 Nov 2024 20:43:22 +0000 (13:43 -0700)
committerTom Tromey <tom@tromey.com>
Mon, 16 Dec 2024 20:04:35 +0000 (13:04 -0700)
Upstream readline 8.2 does not build on mingw.  This patch fixes the
build, but I do not know how well it works.

I've submitted this to readline here:

    https://lists.gnu.org/archive/html/bug-readline/2024-11/msg00007.html

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32265

readline/readline/input.c
readline/readline/rlprivate.h

index f68fcac553c33a1a75e4c43912d4f4464d421db1..39bbff1398a69c266e04aa7e7ef22dc3f5359e18 100644 (file)
 
 #define READLINE_LIBRARY
 
+#if defined (__MINGW32__)
+/* These are needed to get the declaration of 'alarm' when including
+   <unistd.h>.  */
+#define __USE_MINGW_ALARM
+#define _POSIX
+#endif
+
 #if defined (__TANDEM)
 #  define _XOPEN_SOURCE_EXTENDED 1
 #  define _TANDEM_SOURCE 1
@@ -834,7 +841,7 @@ rl_getc (FILE *stream)
       /* We know at this point that _rl_caught_signal == 0 */
 
 #if defined (__MINGW32__)
-      if (isatty (fd)
+      if (isatty (fd))
        return (_getch ());     /* "There is no error return." */
 #endif
       result = 0;
index d87d07a72ee19c06b24338ac2f7c4ab80eb83870..cb9cf1791e2b653acdea3f67f556e5ef8fe4e960 100644 (file)
@@ -303,7 +303,7 @@ extern int _rl_pushed_input_available (void);
 
 extern int _rl_timeout_init (void);
 extern int _rl_timeout_handle_sigalrm (void);
-#if defined (_POSIXSELECT_H_)
+#if defined (RL_TIMEOUT_USE_SELECT)
 /* use as a sentinel for fd_set, struct timeval,  and sigset_t definitions */
 extern int _rl_timeout_select (int, fd_set *, fd_set *, fd_set *, const struct timeval *, const sigset_t *);
 #endif