Index: src/relpsrv.c
--- src/relpsrv.c.orig	2014-03-24 15:03:33.000000000 +0100
+++ src/relpsrv.c	2014-07-19 08:57:53.360418886 +0200
@@ -33,6 +33,8 @@
 #include "config.h"
 #include <stdlib.h>
 #include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
 #include <netinet/in.h>
 #include <assert.h>
 #include <sys/socket.h>
Index: src/tcp.c
--- src/tcp.c.orig	2014-04-22 15:33:25.000000000 +0200
+++ src/tcp.c	2014-07-19 08:59:39.150461735 +0200
@@ -637,7 +637,7 @@
 		goto done;
 	}
 
-#	if defined(TCP_KEEPCNT)
+#	if defined(TCP_KEEPCNT) && defined(SOL_TCP)
 	if(pSrv->iKeepAliveProbes > 0) {
 		optval = pSrv->iKeepAliveProbes;
 		optlen = sizeof(optval);
@@ -653,7 +653,7 @@
 			  RELP_RET_WRN_NO_KEEPALIVE);
 	}
 
-#	if defined(TCP_KEEPCNT)
+#	if defined(TCP_KEEPCNT) && defined(SOL_TCP)
 	if(pSrv->iKeepAliveTime > 0) {
 		optval = pSrv->iKeepAliveTime;
 		optlen = sizeof(optval);
@@ -669,7 +669,7 @@
 			  RELP_RET_WRN_NO_KEEPALIVE);
 	}
 
-#	if defined(TCP_KEEPCNT)
+#	if defined(TCP_KEEPCNT) && defined(SOL_TCP)
 	if(pSrv->iKeepAliveIntvl > 0) {
 		optval = pSrv->iKeepAliveIntvl;
 		optlen = sizeof(optval);
