unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: John Ralls <jralls@ceridwen.us>
To: 35405@debbugs.gnu.org
Subject: bug#35405: Patch for 35405
Date: Tue, 23 Apr 2019 15:12:51 -0700	[thread overview]
Message-ID: <A8A95A57-DF24-4A3E-BC49-B8C9A428CE2B@ceridwen.us> (raw)
In-Reply-To: <74A3FAC1-5988-4FA5-9E89-DAE0A6D7B0B0@ceridwen.us>

[-- Attachment #1: 0001-Fix-build-on-MinGW-w64.patch --]
[-- Type: application/octet-stream, Size: 2222 bytes --]

From f2de9d206b33bc2e27acde1e751df9ba8faf60a9 Mon Sep 17 00:00:00 2001
From: John Ralls <jralls@ceridwen.us>
Date: Tue, 23 Apr 2019 15:06:48 -0700
Subject: [PATCH] Fix build on MinGW-w64

Fixes bug 35405

       * lib/poll.h: MinGW provides struct pollfd in winsock2.h and
         lib/threads.h includes it so disable declaring it in poll.h and
         get the declaration from winsock2.h. Otherwise gcc complains that
         poll() has a different signature between the declaration and
         definition.
       * libguile/socket.c: TCP declarations are in winsock.h on Windows.
       * libguile/timegm.c: MinGW doesn't include mktime so include mktime.c to
         provide it.
---
 lib/poll.in.h     | 5 +++++
 lib/timegm.c      | 2 ++
 libguile/socket.c | 6 +++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/poll.in.h b/lib/poll.in.h
index e9b141d8f..3b0a99165 100644
--- a/lib/poll.in.h
+++ b/lib/poll.in.h
@@ -40,6 +40,9 @@
 
 
 #if !@HAVE_POLL_H@
+# ifdef __MINGW32__
+#  include <winsock2.h>
+# endif
 
 /* fake a poll(2) environment */
 # define POLLIN      0x0001      /* any readable data available   */
@@ -55,12 +58,14 @@
 
 # if !GNULIB_defined_poll_types
 
+#  ifndef __MINGW32__
 struct pollfd
 {
   int fd;                       /* which file descriptor to poll */
   short events;                 /* events we are interested in   */
   short revents;                /* events found on return        */
 };
+#  endif
 
 typedef unsigned long nfds_t;
 
diff --git a/lib/timegm.c b/lib/timegm.c
index 168da8ead..35bc67dc1 100644
--- a/lib/timegm.c
+++ b/lib/timegm.c
@@ -38,3 +38,5 @@ timegm (struct tm *tmp)
   tmp->tm_isdst = 0;
   return __mktime_internal (tmp, __gmtime_r, &gmtime_offset);
 }
+
+#include "mktime.c"
diff --git a/libguile/socket.c b/libguile/socket.c
index 71c17e892..f5371b6c8 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -40,7 +40,11 @@
 #include <sys/un.h>
 #endif
 #include <netinet/in.h>
-#include <netinet/tcp.h>
+#ifdef __MINGW32__
+# include <winsock.h>
+#else
+# include <netinet/tcp.h>
+#endif
 #include <netdb.h>
 #include <arpa/inet.h>
 
-- 
2.20.1


  reply	other threads:[~2019-04-23 22:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23 22:04 bug#35405: Guile stable-2.2 HEAD fails to compile on MingGW-W64 John Ralls
2019-04-23 22:12 ` John Ralls [this message]
2019-06-30 15:30   ` bug#35405: Patch for 35405 Ludovic Courtès
2019-06-30 15:30   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A8A95A57-DF24-4A3E-BC49-B8C9A428CE2B@ceridwen.us \
    --to=jralls@ceridwen.us \
    --cc=35405@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).