diff --git a/configure.ac b/configure.ac
index 62af699452c0bab75ef427449717595468465250..418401291255628192ca99efab107a2c639482d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -665,10 +665,11 @@ AC_SEARCH_LIBS([inet_pton], [nsl], [
 LIBS="${LIBS} ${SOCKET_LIBS}"
 AC_LINK_IFELSE([
     AC_LANG_PROGRAM([#ifdef _WIN32
+        #include <ws2tcpip.h>
+        #include <windows.h>
         # if _WIN32_WINNT < 0x600
         #  error Needs vista+
         # endif
-        #include <ws2tcpip.h>
         #else
         #include <sys/socket.h>
         #include <arpa/inet.h>