Browse Source

Merge commit '3b5ef34' into cg_merges_20130524b

Conflicts:
	Makefile.am
Luke Dashjr 12 years ago
parent
commit
677d2b4dcd
3 changed files with 11 additions and 1 deletions
  1. 1 1
      Makefile.am
  2. 3 0
      configure.ac
  3. 7 0
      util.c

+ 1 - 1
Makefile.am

@@ -19,7 +19,7 @@ bin_SCRIPTS	= $(top_srcdir)/*.cl
 bfgminer_LDFLAGS	= $(PTHREAD_FLAGS)
 bfgminer_LDFLAGS	= $(PTHREAD_FLAGS)
 bfgminer_LDADD	= $(DLOPEN_FLAGS) @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ \
 bfgminer_LDADD	= $(DLOPEN_FLAGS) @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ \
 		  @NCURSES_LIBS@ @PDCURSES_LIBS@ @WS2_LIBS@ \
 		  @NCURSES_LIBS@ @PDCURSES_LIBS@ @WS2_LIBS@ \
-		  @UDEV_LIBS@ @LIBUSB_LIBS@ \
+		  @UDEV_LIBS@ @LIBUSB_LIBS@ @MM_LIBS@ \
 		  @MATH_LIBS@ lib/libgnu.a ccan/libccan.a
 		  @MATH_LIBS@ lib/libgnu.a ccan/libccan.a
 bfgminer_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib @LIBUSB_CFLAGS@ @LIBCURL_CFLAGS@
 bfgminer_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib @LIBUSB_CFLAGS@ @LIBCURL_CFLAGS@
 
 

+ 3 - 0
configure.ac

@@ -66,6 +66,7 @@ have_cygwin=false
 have_win32=false
 have_win32=false
 DLOPEN_FLAGS="-ldl"
 DLOPEN_FLAGS="-ldl"
 WS2_LIBS=""
 WS2_LIBS=""
+MM_LIBS=""
 MATH_LIBS="-lm"
 MATH_LIBS="-lm"
 
 
 case $target in
 case $target in
@@ -88,6 +89,7 @@ case $target in
     have_win32=true
     have_win32=true
     DLOPEN_FLAGS=""
     DLOPEN_FLAGS=""
     WS2_LIBS="-lws2_32"
     WS2_LIBS="-lws2_32"
+    MM_LIBS="-lwinmm"
     AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support")
     AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support")
     AC_DEFINE([FD_SETSIZE], [4096], [Maximum sockets before fd_set overflows])
     AC_DEFINE([FD_SETSIZE], [4096], [Maximum sockets before fd_set overflows])
     ;;
     ;;
@@ -752,6 +754,7 @@ AC_SUBST(NCURSES_CPPFLAGS)
 AC_SUBST(NCURSES_LIBS)
 AC_SUBST(NCURSES_LIBS)
 AC_SUBST(PDCURSES_LIBS)
 AC_SUBST(PDCURSES_LIBS)
 AC_SUBST(WS2_LIBS)
 AC_SUBST(WS2_LIBS)
+AC_SUBST(MM_LIBS)
 AC_SUBST(MATH_LIBS)
 AC_SUBST(MATH_LIBS)
 AC_SUBST(UDEV_LIBS)
 AC_SUBST(UDEV_LIBS)
 AC_SUBST(YASM_FMT)
 AC_SUBST(YASM_FMT)

+ 7 - 0
util.c

@@ -40,6 +40,7 @@
 # include <netinet/tcp.h>
 # include <netinet/tcp.h>
 # include <netdb.h>
 # include <netdb.h>
 #else
 #else
+# include <windows.h>
 # include <winsock2.h>
 # include <winsock2.h>
 # include <mstcpip.h>
 # include <mstcpip.h>
 # include <ws2tcpip.h>
 # include <ws2tcpip.h>
@@ -1044,6 +1045,9 @@ void nmsleep(unsigned int msecs)
 	int ret;
 	int ret;
 	ldiv_t d;
 	ldiv_t d;
 
 
+#ifdef WIN32
+	timeBeginPeriod(1);
+#endif
 	d = ldiv(msecs, 1000);
 	d = ldiv(msecs, 1000);
 	tleft.tv_sec = d.quot;
 	tleft.tv_sec = d.quot;
 	tleft.tv_nsec = d.rem * 1000000;
 	tleft.tv_nsec = d.rem * 1000000;
@@ -1052,6 +1056,9 @@ void nmsleep(unsigned int msecs)
 		twait.tv_nsec = tleft.tv_nsec;
 		twait.tv_nsec = tleft.tv_nsec;
 		ret = nanosleep(&twait, &tleft);
 		ret = nanosleep(&twait, &tleft);
 	} while (ret == -1 && errno == EINTR);
 	} while (ret == -1 && errno == EINTR);
+#ifdef WIN32
+	timeEndPeriod(1);
+#endif
 }
 }
 
 
 /* Returns the microseconds difference between end and start times as a double */
 /* Returns the microseconds difference between end and start times as a double */