winsock2.h must be included before windows.h, but windows.h is included by various standard C headers
@@ -12,10 +12,6 @@
#include "config.h"
-#ifdef WIN32
-#include <winsock2.h>
-#endif
-
#include <stdbool.h>
#if !(defined(WIN32) || defined(unix))
@@ -31,6 +31,12 @@ AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([miner.c])
AC_CONFIG_HEADERS([config.h])
+AH_BOTTOM([
+#ifdef WIN32
+#include <winsock2.h>
+#endif
+])
+
AM_INIT_AUTOMAKE([foreign subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_USE_SYSTEM_EXTENSIONS
@@ -32,10 +32,6 @@
#include "miner.h"
#include <limits.h>
#include <pthread.h>
@@ -11,10 +11,6 @@
#ifdef HAVE_CURSES
// Must be before stdbool, since pdcurses typedefs bool :/
#include <curses.h>
@@ -10,10 +10,6 @@
#include <math.h>
@@ -9,10 +9,6 @@
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
@@ -13,7 +13,6 @@
#include <dlfcn.h>
typedef void *dlh_t;
#else
#include <windows.h>
#define dlopen(lib, flags) LoadLibrary(lib)
#define dlsym(h, sym) ((void*)GetProcAddress(h, sym))
#include <ctype.h>
#include <stdarg.h>
@@ -19,14 +19,6 @@
#include <stdio.h>
#include <sys/types.h>
- #include <winsock2.h>
-#else
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <netdb.h>
#include <time.h>
#include <sys/time.h>