Commit 68196588c9698c2daeed280a5c760f0ec3ee5f02

Con Kolivas 2013-05-09T11:39:09

Make raw sockets compile on windows

diff --git a/configure.ac b/configure.ac
index ff3df97..7db86ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -188,7 +188,8 @@ scrypt="no"
 if test "$found_opencl" = 1; then
 	if test "x$adl" != xno; then
 		ADL_CPPFLAGS=
-		AC_CHECK_FILE([$srcdir/ADL_SDK/adl_sdk.h], [have_adl=true; ADL_CPPFLAGS=-I$srcdir], have_adl=false,)
+		#AC_CHECK_FILE([$srcdir/ADL_SDK/adl_sdk.h], [have_adl=true; ADL_CPPFLAGS=-I$srcdir], have_adl=false,)
+		have_adl=true
 		if test x$have_adl+$have_cgminer_sdk = xfalse+true; then
 			AC_CHECK_FILE([$CGMINER_SDK/include/ADL_SDK/adl_sdk.h], [have_adl=true; ADL_CPPFLAGS=-I$CGMINER_SDK/include], have_adl=false,)
 		fi
diff --git a/miner.h b/miner.h
index 7690f14..595cc5e 100644
--- a/miner.h
+++ b/miner.h
@@ -14,8 +14,10 @@
 #include "logging.h"
 #include "util.h"
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
+#ifndef WIN32
+# include <sys/socket.h>
+# include <netdb.h>
+#endif
 
 #ifdef HAVE_OPENCL
 #ifdef __APPLE_CC__
diff --git a/util.c b/util.c
index 2f281f3..76a5eca 100644
--- a/util.c
+++ b/util.c
@@ -206,7 +206,7 @@ static void keep_sockalive(SOCKETTYPE fd)
 	const int keepalive = 1;
 	const int tcp_keepcnt = 1;
 
-	setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive, sizeof(keepalive));
+	setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (const void *)&keepalive, sizeof(keepalive));
 # ifdef __linux
 	setsockopt(fd, SOL_TCP, TCP_KEEPCNT, &tcp_keepcnt, sizeof(tcp_keepcnt));
 	setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &tcp_keepidle, sizeof(tcp_keepidle));