]> git.meshlink.io Git - catta/commitdiff
start of a windows compatibility layer
authorSven M. Hallberg <pesco@khjk.org>
Tue, 26 Aug 2014 12:50:53 +0000 (14:50 +0200)
committerSven M. Hallberg <pesco@khjk.org>
Tue, 26 Aug 2014 12:50:53 +0000 (14:50 +0200)
compat/windows/include/arpa/inet.h [new file with mode: 0644]
compat/windows/include/net/if.h [new file with mode: 0644]
compat/windows/include/netinet/in.h [new file with mode: 0644]
compat/windows/include/sys/ioctl.h [new file with mode: 0644]
compat/windows/include/sys/poll.h [new file with mode: 0644]
compat/windows/include/sys/select.h [new file with mode: 0644]
compat/windows/include/sys/socket.h [new file with mode: 0644]
compat/windows/wincompat.h [new file with mode: 0644]
configure.ac
src/Makefile.am

diff --git a/compat/windows/include/arpa/inet.h b/compat/windows/include/arpa/inet.h
new file mode 100644 (file)
index 0000000..cc77ee8
--- /dev/null
@@ -0,0 +1 @@
+#include "../../wincompat.h"
diff --git a/compat/windows/include/net/if.h b/compat/windows/include/net/if.h
new file mode 100644 (file)
index 0000000..cc77ee8
--- /dev/null
@@ -0,0 +1 @@
+#include "../../wincompat.h"
diff --git a/compat/windows/include/netinet/in.h b/compat/windows/include/netinet/in.h
new file mode 100644 (file)
index 0000000..cc77ee8
--- /dev/null
@@ -0,0 +1 @@
+#include "../../wincompat.h"
diff --git a/compat/windows/include/sys/ioctl.h b/compat/windows/include/sys/ioctl.h
new file mode 100644 (file)
index 0000000..cc77ee8
--- /dev/null
@@ -0,0 +1 @@
+#include "../../wincompat.h"
diff --git a/compat/windows/include/sys/poll.h b/compat/windows/include/sys/poll.h
new file mode 100644 (file)
index 0000000..cc77ee8
--- /dev/null
@@ -0,0 +1 @@
+#include "../../wincompat.h"
diff --git a/compat/windows/include/sys/select.h b/compat/windows/include/sys/select.h
new file mode 100644 (file)
index 0000000..cc77ee8
--- /dev/null
@@ -0,0 +1 @@
+#include "../../wincompat.h"
diff --git a/compat/windows/include/sys/socket.h b/compat/windows/include/sys/socket.h
new file mode 100644 (file)
index 0000000..cc77ee8
--- /dev/null
@@ -0,0 +1 @@
+#include "../../wincompat.h"
diff --git a/compat/windows/wincompat.h b/compat/windows/wincompat.h
new file mode 100644 (file)
index 0000000..37ba883
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef foowincompatfoo
+#define foowincompatfoo
+
+#undef WINVER
+#undef _WIN32_WINNT
+
+#define WINVER 0x0600       // Vista
+#define _WIN32_WINNT WINVER
+
+#include <winsock2.h>
+
+#endif
index 59255603f0872c7344aa66bf0fe38d284f0e602e..7a7dc40f528f9d4532703be58b037c7920b9e3ed 100644 (file)
@@ -55,6 +55,10 @@ if test x"$ac_cv_prog_cc_c99" = x"no"; then
     AC_MSG_ERROR([C99 support is required])
 fi
 
     AC_MSG_ERROR([C99 support is required])
 fi
 
+# Windows stuff
+AC_CHECK_DECL(_WIN32)
+AM_CONDITIONAL([WINDOWS], [ test "x$ac_cv_have_decl__WIN32" = "xyes" ])
+
 # -fstack-protector
 AC_ARG_ENABLE([stack-protector],
     [AS_HELP_STRING([--disable-stack-protector],
 # -fstack-protector
 AC_ARG_ENABLE([stack-protector],
     [AS_HELP_STRING([--disable-stack-protector],
index 236f9517a5ae32f7ed84ee1c4a9681246818382f..ebc34c14ecb2dc1041c8d2302c6c10b9ec9df9b1 100644 (file)
 
 AM_CFLAGS=-I$(top_srcdir)/include
 
 
 AM_CFLAGS=-I$(top_srcdir)/include
 
+if WINDOWS
+AM_CFLAGS += -I$(top_srcdir)/compat/windows/include
+endif
+
 # This cool debug trap works on i386/gcc only
 AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
 
 # This cool debug trap works on i386/gcc only
 AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'