On Tue, Aug 12, 2014 at 9:43 AM, Noah Misch <n...@leadboat.com> wrote:
>
> Somehow or other, we must bring these parts into agreement.


It is interesting to see that with MinGW-32b getaddrinfo is still set
to no at configure phase. What if we simply wrap "undef gai_strerror"
like in the patch attached? I just set up an environment with MinGW-64
and I was able to build the code (tested as well with MinGW-32 btw).

Another idea would be to enforce getaddrinfo to no at configure for
MinGW environments.
Thoughts?
-- 
Michael
From 284aff1932d085587aa98a6023d8a6bc4ab9a16a Mon Sep 17 00:00:00 2001
From: Michael Paquier <mich...@otacoo.com>
Date: Mon, 11 Aug 2014 19:11:45 -0700
Subject: [PATCH] Fix build error of MinGW-64 caused by incorrect gai_strerror

Since commit a16bac3, configure detects HAVE_GETADDRINFO at configure
phase in builds done with MinGW-64, resulting in an incorrect definition
of gai_strerror as this is inconditionally undefined in
src/include/port/win32/sys/socket.h. This commit simply prevents
gai_strerror from being undefined when HAVE_GETADDRINFO is detected.

This error has been first triggered with libpq, but with no doubts it
may have been present in other places, libpq being only the first one
to fail.
---
 src/include/port/win32/sys/socket.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/include/port/win32/sys/socket.h b/src/include/port/win32/sys/socket.h
index edaee6a..33e697a 100644
--- a/src/include/port/win32/sys/socket.h
+++ b/src/include/port/win32/sys/socket.h
@@ -28,6 +28,8 @@
  * they are defined inline in the MS header files. So we'll use our
  * own
  */
+#if !defined(HAVE_GETADDRINFO)
 #undef gai_strerror
+#endif
 
 #endif   /* WIN32_SYS_SOCKET_H */
-- 
2.0.4

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to