diff --git a/config.subr b/config.subr
index a9468bf..f8dd279 100644
--- a/config.subr
+++ b/config.subr
@@ -399,6 +399,16 @@ config_subdirs() {
done
}
+config_win32() {
+ if uname -s | grep -qi mingw32; then
+ HAVE_WIN32=true
+ CPPFLAGS="$CPPFLAGS -mwin32 -municode -DWIN32"
+ else
+ HAVE_WIN32=false
+ fi
+ echo "HAVE_WIN32 = ${HAVE_WIN32}" >> ${CONFIG_MK}
+}
+
cpp_o_rule() {
"$CXX" $CPPFLAGS $CXXFLAGS -M "$1" || {
echo "$1" | sed -e 's/^\(.*\)\.cpp$/\1.o: \1.cpp/'
diff --git a/http/configure b/http/configure
index 9224165..2f406da 100755
--- a/http/configure
+++ b/http/configure
@@ -46,6 +46,7 @@ LDFLAGS="-export-dynamic $LDFLAGS -rdynamic"
config_asan
config_gnu
config_i386
+config_win32
pkg_config libbsd-overlay
pkg_config libevent
pkg_config libffi
diff --git a/http/types.h b/http/types.h
index 262c52b..385dee8 100644
--- a/http/types.h
+++ b/http/types.h
@@ -13,7 +13,12 @@
#ifndef HTTP_TYPES_H
#define HTTP_TYPES_H
-#include <sys/socket.h>
+#ifdef WIN32
+# include <winsock2.h>
+#else
+# include <sys/socket.h>
+#endif
+
#include <libkc3/types.h>
/* 1 */