From 46000e498262feded366290aa16746218b013370 Mon Sep 17 00:00:00 2001 From: "Sven M. Hallberg" Date: Tue, 26 Aug 2014 14:50:53 +0200 Subject: [PATCH] start of a windows compatibility layer --- compat/windows/include/arpa/inet.h | 1 + compat/windows/include/net/if.h | 1 + compat/windows/include/netinet/in.h | 1 + compat/windows/include/sys/ioctl.h | 1 + compat/windows/include/sys/poll.h | 1 + compat/windows/include/sys/select.h | 1 + compat/windows/include/sys/socket.h | 1 + compat/windows/wincompat.h | 12 ++++++++++++ configure.ac | 4 ++++ src/Makefile.am | 4 ++++ 10 files changed, 27 insertions(+) create mode 100644 compat/windows/include/arpa/inet.h create mode 100644 compat/windows/include/net/if.h create mode 100644 compat/windows/include/netinet/in.h create mode 100644 compat/windows/include/sys/ioctl.h create mode 100644 compat/windows/include/sys/poll.h create mode 100644 compat/windows/include/sys/select.h create mode 100644 compat/windows/include/sys/socket.h create mode 100644 compat/windows/wincompat.h diff --git a/compat/windows/include/arpa/inet.h b/compat/windows/include/arpa/inet.h new file mode 100644 index 0000000..cc77ee8 --- /dev/null +++ b/compat/windows/include/arpa/inet.h @@ -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 index 0000000..cc77ee8 --- /dev/null +++ b/compat/windows/include/net/if.h @@ -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 index 0000000..cc77ee8 --- /dev/null +++ b/compat/windows/include/netinet/in.h @@ -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 index 0000000..cc77ee8 --- /dev/null +++ b/compat/windows/include/sys/ioctl.h @@ -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 index 0000000..cc77ee8 --- /dev/null +++ b/compat/windows/include/sys/poll.h @@ -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 index 0000000..cc77ee8 --- /dev/null +++ b/compat/windows/include/sys/select.h @@ -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 index 0000000..cc77ee8 --- /dev/null +++ b/compat/windows/include/sys/socket.h @@ -0,0 +1 @@ +#include "../../wincompat.h" diff --git a/compat/windows/wincompat.h b/compat/windows/wincompat.h new file mode 100644 index 0000000..37ba883 --- /dev/null +++ b/compat/windows/wincompat.h @@ -0,0 +1,12 @@ +#ifndef foowincompatfoo +#define foowincompatfoo + +#undef WINVER +#undef _WIN32_WINNT + +#define WINVER 0x0600 // Vista +#define _WIN32_WINNT WINVER + +#include + +#endif diff --git a/configure.ac b/configure.ac index 5925560..7a7dc40 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,10 @@ if test x"$ac_cv_prog_cc_c99" = x"no"; then 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], diff --git a/src/Makefile.am b/src/Makefile.am index 236f951..ebc34c1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,6 +17,10 @@ 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")' -- 2.39.5