diff options
| author | Eli Zaretskii | 2018-07-28 15:34:00 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2018-07-28 15:34:00 +0300 |
| commit | 024d20f81e643fe1739d28d16501a8c4f7a860c6 (patch) | |
| tree | ffd64f180b8ac8d5f07d3345ab7edec8c19f496a | |
| parent | 38b67488566de6f7c9b405ae62664b16ab135713 (diff) | |
| download | emacs-024d20f81e643fe1739d28d16501a8c4f7a860c6.tar.gz emacs-024d20f81e643fe1739d28d16501a8c4f7a860c6.zip | |
Fix compilation with mingw.org's MinGW 5.x headers
| -rw-r--r-- | lib-src/pop.c | 8 | ||||
| -rw-r--r-- | nt/inc/ms-w32.h | 7 | ||||
| -rw-r--r-- | nt/inc/sys/socket.h | 5 |
3 files changed, 17 insertions, 3 deletions
diff --git a/lib-src/pop.c b/lib-src/pop.c index 10aac957d4b..0b9204576bd 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c | |||
| @@ -30,8 +30,12 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 30 | #include "ntlib.h" | 30 | #include "ntlib.h" |
| 31 | #undef _WIN32_WINNT | 31 | #undef _WIN32_WINNT |
| 32 | #define _WIN32_WINNT 0x0501 /* for getaddrinfo stuff */ | 32 | #define _WIN32_WINNT 0x0501 /* for getaddrinfo stuff */ |
| 33 | #include <winsock2.h> | 33 | #if defined __MINGW32_VERSION && __MINGW32_VERSION >= 5000000L |
| 34 | #include <ws2tcpip.h> | 34 | # include <windows.h> |
| 35 | #else | ||
| 36 | # include <winsock2.h> | ||
| 37 | #endif | ||
| 38 | # include <ws2tcpip.h> | ||
| 35 | #undef getaddrinfo | 39 | #undef getaddrinfo |
| 36 | #define getaddrinfo sys_getaddrinfo | 40 | #define getaddrinfo sys_getaddrinfo |
| 37 | #undef freeaddrinfo | 41 | #undef freeaddrinfo |
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); | |||
| 455 | windows.h. For this to have proper effect, config.h must always be | 455 | windows.h. For this to have proper effect, config.h must always be |
| 456 | included before windows.h. */ | 456 | included before windows.h. */ |
| 457 | #define _WINSOCKAPI_ 1 | 457 | #define _WINSOCKAPI_ 1 |
| 458 | #define _WINSOCK_H | 458 | #if defined __MINGW32_VERSION && __MINGW32_VERSION < 5000000L |
| 459 | /* mingw.org's MinGW 5.x changed how it includes winsock.h and time.h, | ||
| 460 | and now defining _WINSOCK_H skips the definition of struct timeval, | ||
| 461 | which we don't want. */ | ||
| 462 | # define _WINSOCK_H | ||
| 463 | #endif | ||
| 459 | 464 | ||
| 460 | /* Defines size_t and alloca (). */ | 465 | /* Defines size_t and alloca (). */ |
| 461 | #include <stdlib.h> | 466 | #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/>. */ | |||
| 49 | #define timeval ws_timeval | 49 | #define timeval ws_timeval |
| 50 | #endif | 50 | #endif |
| 51 | 51 | ||
| 52 | #if defined __MINGW32_VERSION && __MINGW32_VERSION >= 5000000L | ||
| 53 | /* Need winerror.h before winsock2.h with mingw.org's MinGW 5.x, | ||
| 54 | otherwise some error codes are not defined. */ | ||
| 55 | # include <winerror.h> | ||
| 56 | #endif | ||
| 52 | #include <winsock2.h> | 57 | #include <winsock2.h> |
| 53 | #include <ws2tcpip.h> | 58 | #include <ws2tcpip.h> |
| 54 | /* process.c uses uint16_t (from C99) for IPv6, but | 59 | /* process.c uses uint16_t (from C99) for IPv6, but |