bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Building readline 8.2 on mingw


From: Tom Tromey
Subject: Building readline 8.2 on mingw
Date: Sat, 16 Nov 2024 13:15:16 -0700

Hi.  I tried importing readline 8.2 into the gdb repository.

It did not build on mingw.  The appended patch fixes all the problems.

* A call to isatty is missing a close paren

* rlprivate.h declares _rl_timeout_select based on whether posixselect.h
  was included, but this causes a build failure.  The patch changes it
  to use the same define that other spots check.

* mingw <unistd.h> does not declare alarm() by default.  You have to
  define _POSIX and __USE_MINGW_ALARM.  TBH I am not sure if this is the
  ideal approach.  Also I can't say whether or not the result works.

Tom

diff --git a/input.c b/input.c
index f68fcac..39bbff1 100644
--- a/input.c
+++ b/input.c
@@ -21,6 +21,13 @@
 
 #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;
diff --git a/rlprivate.h b/rlprivate.h
index d87d07a..cb9cf17 100644
--- a/rlprivate.h
+++ b/rlprivate.h
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]