Browse Source

Merge commit '4174a1d' into bfgminer

Luke Dashjr 12 years ago
parent
commit
87be620789
6 changed files with 44 additions and 22 deletions
  1. 1 0
      .gitignore
  2. 1 1
      Makefile.am
  3. 21 1
      configure.ac
  4. 3 3
      fpgautils.c
  5. 1 17
      iospeeds.h
  6. 17 0
      iospeeds_posix.h

+ 1 - 0
.gitignore

@@ -49,6 +49,7 @@ lib/signal.h
 lib/string.h
 lib/stdint.h
 lib/warn-on-use.h
+iospeeds_local.h
 
 mkinstalldirs
 

+ 1 - 1
Makefile.am

@@ -158,7 +158,7 @@ if NEED_FPGAUTILS
 bfgminer_SOURCES += fpgautils.c fpgautils.h
 if HAVE_WINDOWS
 else
-bfgminer_SOURCES += iospeeds.h
+bfgminer_SOURCES += iospeeds.h iospeeds_posix.h
 endif
 endif
 

+ 21 - 1
configure.ac

@@ -431,6 +431,26 @@ if test "x$scrypt" = xyes; then
 fi
 
 
+need_fpgautils=no
+if test x$avalon$icarus$bitforce$modminer$opencl$x6500$ztex != xnonononononono; then
+	need_fpgautils=yes
+	
+	if $have_win32; then
+		echo '#include <iospeeds.h>' >iospeeds_local.h
+	else
+		AC_PROG_CPP
+		AC_MSG_CHECKING([what baud rates your system supports])
+		echo '#include <termios.h>' | ${CPP} -dM - 2>/dev/null | sed 's/.* B\([0-9]\+\) .*/IOSPEED(\1)/;t;d' >iospeeds_local.h
+		if grep -q IOSPEED iospeeds_local.h; then
+			AC_MSG_RESULT([done])
+		else
+			AC_MSG_RESULT([failed, using standard POSIX])
+			echo '#include <iospeeds_posix.h>' >iospeeds_local.h
+		fi
+	fi
+fi
+
+
 curses="auto"
 
 AC_ARG_WITH([curses],
@@ -537,7 +557,7 @@ AC_SUBST(libblkmaker_LIBS)
 
 AM_CONDITIONAL([NEED_LIBBLKMAKER], [test x$with_system_libblkmaker != xyes])
 AM_CONDITIONAL([NEED_DYNCLOCK], [test x$icarus$modminer$x6500$ztex != xnonono])
-AM_CONDITIONAL([NEED_FPGAUTILS], [test x$avalon$icarus$bitforce$modminer$opencl$x6500$ztex != xnonononononono])
+AM_CONDITIONAL([NEED_FPGAUTILS], [test x$need_fpgautils = xyes])
 AM_CONDITIONAL([HAS_SCRYPT], [test x$scrypt = xyes])
 AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
 AM_CONDITIONAL([HAVE_SENSORS], [test x$with_sensors = xyes])

+ 3 - 3
fpgautils.c

@@ -672,7 +672,7 @@ int tiospeed(speed_t speed)
 		case B ## baud:  \
 			return baud;  \
 // END
-#include "iospeeds.h"
+#include "iospeeds_local.h"
 #undef IOSPEED
 	default:
 		return -1;
@@ -772,7 +772,7 @@ speed_t tiospeed_t(int baud)
 		case baud:  \
 			return B ## baud;  \
 // END
-#include "iospeeds.h"
+#include "iospeeds_local.h"
 #undef IOSPEED
 	default:
 		return B0;
@@ -788,7 +788,7 @@ bool valid_baud(int baud)
 		case baud:  \
 			return true;  \
 // END
-#include "iospeeds.h"
+#include "iospeeds_local.h"
 #undef IOSPEED
 		default:
 			return false;

+ 1 - 17
iospeeds.h

@@ -1,20 +1,4 @@
-IOSPEED(0)
-IOSPEED(50)
-IOSPEED(110)
-IOSPEED(134)
-IOSPEED(200)
-
-IOSPEED(75)
-IOSPEED(150)
-IOSPEED(300)
-IOSPEED(600)
-IOSPEED(1200)
-IOSPEED(1800)
-IOSPEED(2400)
-IOSPEED(4800)
-IOSPEED(9600)
-IOSPEED(19200)
-IOSPEED(38400)
+#include <iospeeds_posix.h>
 
 IOSPEED(57600)
 IOSPEED(115200)

+ 17 - 0
iospeeds_posix.h

@@ -0,0 +1,17 @@
+IOSPEED(0)
+IOSPEED(50)
+IOSPEED(110)
+IOSPEED(134)
+IOSPEED(200)
+
+IOSPEED(75)
+IOSPEED(150)
+IOSPEED(300)
+IOSPEED(600)
+IOSPEED(1200)
+IOSPEED(1800)
+IOSPEED(2400)
+IOSPEED(4800)
+IOSPEED(9600)
+IOSPEED(19200)
+IOSPEED(38400)