From 284aff1932d085587aa98a6023d8a6bc4ab9a16a Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@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

