summaryrefslogtreecommitdiff
path: root/nt
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2018-07-28 15:34:00 +0300
committerEli Zaretskii <eliz@gnu.org>2018-07-28 15:34:00 +0300
commit024d20f81e643fe1739d28d16501a8c4f7a860c6 (patch)
treeffd64f180b8ac8d5f07d3345ab7edec8c19f496a /nt
parent38b67488566de6f7c9b405ae62664b16ab135713 (diff)
downloademacs-024d20f81e643fe1739d28d16501a8c4f7a860c6.tar.gz
Fix compilation with mingw.org's MinGW 5.x headers
Diffstat (limited to 'nt')
-rw-r--r--nt/inc/ms-w32.h7
-rw-r--r--nt/inc/sys/socket.h5
2 files changed, 11 insertions, 1 deletions
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index ff4317817e0..0ab46e98328 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -455,7 +455,12 @@ extern char *get_emacs_configuration_options (void);
windows.h. For this to have proper effect, config.h must always be
included before windows.h. */
#define _WINSOCKAPI_ 1
-#define _WINSOCK_H
+#if defined __MINGW32_VERSION && __MINGW32_VERSION < 5000000L
+/* mingw.org's MinGW 5.x changed how it includes winsock.h and time.h,
+ and now defining _WINSOCK_H skips the definition of struct timeval,
+ which we don't want. */
+# define _WINSOCK_H
+#endif
/* Defines size_t and alloca (). */
#include <stdlib.h>
diff --git a/nt/inc/sys/socket.h b/nt/inc/sys/socket.h
index 2582cbdaef1..3ea9542b05c 100644
--- a/nt/inc/sys/socket.h
+++ b/nt/inc/sys/socket.h
@@ -49,6 +49,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#define timeval ws_timeval
#endif
+#if defined __MINGW32_VERSION && __MINGW32_VERSION >= 5000000L
+/* Need winerror.h before winsock2.h with mingw.org's MinGW 5.x,
+ otherwise some error codes are not defined. */
+# include <winerror.h>
+#endif
#include <winsock2.h>
#include <ws2tcpip.h>
/* process.c uses uint16_t (from C99) for IPv6, but