configure.ac 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838
  1. dnl * Copyright 2011-2014 Luke Dashjr
  2. dnl * Copyright 2011-2013 Con Kolivas
  3. dnl * Copyright 2010-2011 Jeff Garzik
  4. dnl * Copyright 2012 Xiangfu
  5. dnl * Copyright 2011 Rusty Russell
  6. dnl * Copyright 2011 Mark Crichton
  7. dnl * Copyright 2013-2014 Nate Woolls
  8. dnl *
  9. dnl * This program is free software; you can redistribute it and/or modify it
  10. dnl * under the terms of the GNU General Public License as published by the Free
  11. dnl * Software Foundation; either version 3 of the License, or (at your option)
  12. dnl * any later version. See COPYING for more details.
  13. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  14. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  15. m4_define([v_maj], [4])
  16. m4_define([v_min], [5])
  17. m4_define([v_mic], [0])
  18. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  19. m4_define([v_ver], [v_maj.v_min.v_mic])
  20. m4_define([lt_rev], m4_eval(v_maj + v_min))
  21. m4_define([lt_cur], v_mic)
  22. m4_define([lt_age], v_min)
  23. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  24. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  25. AC_INIT([bfgminer], [v_ver], [luke-jr+bfgminer@utopios.org])
  26. AC_PREREQ([2.59c])
  27. AC_CANONICAL_SYSTEM
  28. AC_CONFIG_MACRO_DIR([m4])
  29. AC_CONFIG_SRCDIR([miner.c])
  30. AC_CONFIG_HEADERS([config.h])
  31. AH_BOTTOM([
  32. #ifdef WIN32
  33. #include <winsock2.h>
  34. #endif
  35. ])
  36. AM_INIT_AUTOMAKE([foreign subdir-objects])
  37. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  38. AC_USE_SYSTEM_EXTENSIONS
  39. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  40. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  41. m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
  42. m4_ifdef([v_rel], , [m4_define([v_rel], [])])
  43. AC_DEFINE_UNQUOTED(CGMINER_MAJOR_VERSION, [v_maj], [Major version])
  44. AC_DEFINE_UNQUOTED(CGMINER_MINOR_VERSION, [v_min], [Minor version])
  45. AC_DEFINE_UNQUOTED(CGMINER_MINOR_SUBVERSION, [v_mic], [Micro version])
  46. version_info="lt_rev:lt_cur:lt_age"
  47. release_info="v_rel"
  48. AC_SUBST(version_info)
  49. AC_SUBST(release_info)
  50. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  51. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  52. VMAJ=v_maj
  53. AC_SUBST(VMAJ)
  54. AC_CANONICAL_BUILD
  55. AC_CANONICAL_HOST
  56. dnl Make sure anyone changing configure.ac/Makefile.am has a clue
  57. AM_MAINTAINER_MODE([enable])
  58. dnl Checks for programs
  59. AC_PROG_CC_C99
  60. gl_EARLY
  61. AC_PROG_GCC_TRADITIONAL
  62. AM_PROG_CC_C_O
  63. AC_PROG_RANLIB
  64. AC_PROG_CPP
  65. gl_INIT
  66. AC_SYS_LARGEFILE
  67. dnl Checks for header files.
  68. AC_HEADER_STDC
  69. AC_CHECK_HEADERS(syslog.h)
  70. AC_CHECK_HEADERS([sys/epoll.h])
  71. AC_CHECK_HEADERS([sys/mman.h])
  72. AC_CHECK_HEADERS([sys/prctl.h])
  73. AC_CHECK_HEADERS([sys/file.h])
  74. AC_CHECK_HEADERS([sys/termios.h])
  75. AC_CHECK_HEADERS([linux/spi/spidev.h])
  76. AC_CHECK_MEMBER([struct i2c_msg.buf],[
  77. true
  78. ],[
  79. dnl Note the member is different here to avoid caching screwing things up
  80. AC_CHECK_MEMBER([struct i2c_msg.len],[
  81. AC_DEFINE([NEED_LINUX_I2C_H],[1],[Defined if linux/i2c.h is needed to supplement linux/i2c-dev.h])
  82. ],[
  83. true
  84. ],[
  85. AC_INCLUDES_DEFAULT
  86. #include <linux/i2c.h>
  87. #include <linux/i2c-dev.h>
  88. ])
  89. ],[
  90. AC_INCLUDES_DEFAULT
  91. #include <linux/i2c-dev.h>
  92. ])
  93. # Setuid
  94. AC_CHECK_HEADERS([pwd.h])
  95. # Check for chroot support
  96. AC_CHECK_FUNCS([chroot])
  97. AC_CHECK_FUNCS([sleep])
  98. AC_FUNC_ALLOCA
  99. lowllist=
  100. driverlist=
  101. algolist=SHA256d
  102. optlist=
  103. has_fpga=no
  104. has_asic=no
  105. need_binloader=no
  106. need_dynclock=no
  107. need_gc3355=no
  108. need_lowl_vcom=no
  109. need_lowlevel=no
  110. need_lowl_ftdi=no
  111. need_lowl_hid=no
  112. need_lowl_mswin=no
  113. need_lowl_pci=no
  114. need_lowl_spi=no
  115. need_lowl_usb=no
  116. need_work2d=no
  117. have_cygwin=false
  118. have_win32=false
  119. have_macho=false
  120. use_udevrules=true
  121. have_udevrules=false
  122. AUTOSCAN_CPPFLAGS=""
  123. AUTOSCAN_LIBS=""
  124. DLOPEN_FLAGS="-ldl"
  125. WS2_LIBS=""
  126. MM_LIBS=""
  127. MATH_LIBS="-lm"
  128. RT_LIBS=""
  129. case $target in
  130. amd64-* | x86_64-*)
  131. have_x86_32=false
  132. have_x86_64=true
  133. bitness="64"
  134. ;;
  135. i386-* | i486-* | i586-* | i686-* | x86-*)
  136. have_x86_32=true
  137. have_x86_64=false
  138. bitness="32"
  139. ;;
  140. *)
  141. have_x86_32=false
  142. have_x86_64=false
  143. ;;
  144. esac
  145. case $target in
  146. *-*-mingw*)
  147. have_win32=true
  148. use_udevrules=false
  149. DLOPEN_FLAGS=""
  150. WS2_LIBS="-lws2_32"
  151. MM_LIBS="-lwinmm"
  152. AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support")
  153. AC_DEFINE([FD_SETSIZE], [4096], [Maximum sockets before fd_set overflows])
  154. ;;
  155. *-*-cygwin*)
  156. have_cygwin=true
  157. use_udevrules=false
  158. ;;
  159. powerpc-*-darwin*)
  160. CFLAGS="$CFLAGS -faltivec"
  161. have_macho=true
  162. use_udevrules=false
  163. ;;
  164. *-*-darwin*)
  165. LDFLAGS="$LDFLAGS -framework IOKit -framework CoreFoundation"
  166. have_macho=true
  167. use_udevrules=false
  168. ;;
  169. esac
  170. m4_define([BFG_INCLUDE],
  171. if test "x$2" = "x"; then
  172. $1=''
  173. else
  174. $1="[#]include <$2>"
  175. fi
  176. )
  177. m4_define([BFG_PREPROC_IFELSE],
  178. BFG_INCLUDE([headerinclude], $2)
  179. AC_COMPILE_IFELSE([
  180. AC_LANG_PROGRAM([
  181. ${headerinclude}
  182. ], [
  183. #if !( $1 )
  184. #error "$1 false in preprocessor"
  185. #endif
  186. ])
  187. ],[$3],[$4])
  188. )
  189. AC_CHECK_DECL([HASH_ITER],[
  190. AC_CHECK_DECL([DL_CONCAT],[
  191. true
  192. ],[
  193. AC_MSG_ERROR([Could not find DL_FOREACH_SAFE - install uthash-dev 1.9.4+])
  194. ],[
  195. #include <utlist.h>
  196. ])
  197. ],[
  198. AC_MSG_ERROR([Could not find HASH_ITER - please install uthash-dev 1.9.4+])
  199. ],[
  200. #include <uthash.h>
  201. ])
  202. ddyes=yes
  203. ddauto=auto
  204. ddno=no
  205. AC_ARG_ENABLE([other-drivers],
  206. [AC_HELP_STRING([--disable-other-drivers],[Build without drivers by default unless explicitly enabled])],
  207. [
  208. if test x$enableval = xyes; then
  209. ddno=yes
  210. else
  211. ddyes=no
  212. ddauto=no
  213. fi
  214. ]
  215. )
  216. broad_udevrules=false
  217. AC_ARG_ENABLE([broad-udevrules],
  218. [AC_HELP_STRING([--enable-broad-udevrules],[Include udev rules for ambiguous devices which may not be miners])],
  219. [
  220. if test "x$enableval" = "xyes"; then
  221. broad_udevrules=true
  222. fi
  223. ]
  224. )
  225. algolist="$algolist scrypt"
  226. AC_ARG_ENABLE([scrypt],
  227. [AC_HELP_STRING([--enable-scrypt],[Compile support for scrypt mining (default disabled)])],
  228. [scrypt=$enableval],
  229. [scrypt=no])
  230. if test "x$scrypt" = xyes; then
  231. AC_DEFINE([USE_SCRYPT], [1], [Defined to 1 if scrypt support is wanted])
  232. fi
  233. lowl_pci=no
  234. if test "x$ac_cv_header_sys_mman_h" = "xyes"; then
  235. AC_ARG_WITH([uio],
  236. [AC_HELP_STRING([--without-uio],[Compile support for PCI devices via Linux UIO interface (default enabled)])],
  237. [uio=$withval],
  238. [uio=$ddyes])
  239. AC_ARG_WITH([vfio],
  240. [AC_HELP_STRING([--without-vfio],[Compile support for PCI devices via Linux VFIO interface (default enabled)])],
  241. [vfio=$enableval],
  242. [vfio=$ddauto])
  243. if test "x$vfio" != "xno"; then
  244. AC_CHECK_HEADER([linux/vfio.h],[
  245. vfio=yes
  246. ],[
  247. if test "x$vfio" = "xyes"; then
  248. AC_MSG_ERROR([Unable to find linux/vfio.h])
  249. elif test "x$uio" = "xyes"; then
  250. AC_MSG_WARN([linux/vfio.h not found; PCI device support will require UIO (and root access)])
  251. else
  252. AC_MSG_WARN([linux/vfio.h not found; PCI device support will not be available])
  253. fi
  254. vfio=no
  255. ])
  256. fi
  257. if test "x$vfio$uio" != xnono; then
  258. lowl_pci=yes
  259. fi
  260. fi
  261. driverlist="$driverlist cpu/cpumining"
  262. AC_ARG_ENABLE([cpumining],
  263. [AC_HELP_STRING([--enable-cpumining],[Build with CPU mining support (default disabled)])],
  264. [cpumining=$enableval],
  265. [cpumining=$ddno]
  266. )
  267. if test "x$cpumining" = xyes; then
  268. AC_DEFINE_UNQUOTED([WANT_CPUMINE], [1], [Enable CPUMINING])
  269. driverlist="$driverlist cpu:asm/has_yasm"
  270. driverlist="$driverlist cpu:sse2/have_sse2"
  271. fi
  272. AM_CONDITIONAL([HAS_CPUMINE], [test x$cpumining = xyes])
  273. driverlist="$driverlist opencl"
  274. AC_ARG_ENABLE([opencl],
  275. [AC_HELP_STRING([--enable-opencl],[Compile support for OpenCL (default disabled)])],
  276. [opencl=$enableval],
  277. [opencl=$ddno]
  278. )
  279. if test "x$opencl" = xyes; then
  280. AC_DEFINE([HAVE_OPENCL], [1], [Defined to 1 if OpenCL support is wanted])
  281. fi
  282. AM_CONDITIONAL([HAVE_OPENCL], [test x$opencl = xyes])
  283. m4_define([BFG_PTHREAD_FLAG_CHECK],
  284. AC_MSG_CHECKING([for $1])
  285. for cflag in ' -pthread' ''; do
  286. for lib in ' -lpthread' ' -lwinpthread' ''; do
  287. CFLAGS="${save_CFLAGS}${cflag}"
  288. LIBS="${save_LIBS}${lib}"
  289. AC_LINK_IFELSE([
  290. AC_LANG_PROGRAM([
  291. #include <pthread.h>
  292. ], [
  293. void *f = $1;
  294. ])
  295. ], [
  296. found_pthread=true
  297. PTHREAD_FLAGS="${cflag}"
  298. PTHREAD_LIBS="${lib}"
  299. if test "x${cflag}${lib}" = "x"; then
  300. AC_MSG_RESULT([yes])
  301. else
  302. AC_MSG_RESULT([with${cflag}${lib}])
  303. fi
  304. $2
  305. break 2
  306. ])
  307. done
  308. done
  309. if test "x${found_pthread}" = "xfalse"; then
  310. AC_MSG_RESULT([no])
  311. fi
  312. )
  313. save_CFLAGS="${CFLAGS}"
  314. save_LIBS="${LIBS}"
  315. found_pthread=false
  316. BFG_PTHREAD_FLAG_CHECK([pthread_cancel],[
  317. AC_DEFINE([HAVE_PTHREAD_CANCEL], [1], [Define if you have a native pthread_cancel])
  318. ])
  319. if test "x${found_pthread}" = "xfalse"; then
  320. BFG_PTHREAD_FLAG_CHECK([pthread_create])
  321. if test "x${found_pthread}" = "xfalse"; then
  322. AC_MSG_ERROR([Could not find pthread library - please install libpthread])
  323. fi
  324. fi
  325. # check for nanosleep here, since it is provided by winpthread
  326. AC_CHECK_FUNCS([nanosleep])
  327. CFLAGS="${save_CFLAGS}"
  328. LIBS="${save_LIBS}"
  329. PKG_CHECK_MODULES([JANSSON],[jansson],[
  330. true
  331. ],[
  332. AC_MSG_CHECKING([for jansson in system-default locations])
  333. LIBS="$LIBS -ljansson"
  334. AC_TRY_LINK([
  335. #include <jansson.h>
  336. ],[
  337. json_object();
  338. ],[
  339. AC_MSG_RESULT([found])
  340. JANSSON_LIBS=-ljansson
  341. ],[
  342. AC_MSG_RESULT([not found])
  343. AC_MSG_ERROR([Could not find jansson library])
  344. ])
  345. LIBS="${save_LIBS}"
  346. ])
  347. AC_SUBST(JANSSON_CFLAGS)
  348. AC_SUBST(JANSSON_LIBS)
  349. if test "x$opencl" = xyes; then
  350. adl="$ddyes"
  351. driverlist="$driverlist opencl:sensors/with_sensors"
  352. AC_ARG_WITH([sensors],
  353. [AC_HELP_STRING([--without-sensors],[Build with libsensors monitoring (default enabled)])],
  354. [true],[with_sensors=$ddauto])
  355. if test "x$opencl" != xyes; then
  356. with_sensors=no
  357. fi
  358. if test "x$with_sensors" != xno; then
  359. AC_MSG_CHECKING([for libsensors])
  360. save_LIBS="${LIBS}"
  361. LIBS="$LIBS -lsensors"
  362. AC_LINK_IFELSE([AC_LANG_PROGRAM([
  363. #include <stddef.h>
  364. #include <sensors/sensors.h>
  365. ],[
  366. const sensors_chip_name *cn;
  367. cn = sensors_get_detected_chips(NULL, NULL);
  368. ])],[
  369. with_sensors=yes
  370. sensors_LIBS="-lsensors"
  371. AC_DEFINE([HAVE_SENSORS], [1], [Defined if libsensors was found])
  372. AC_MSG_RESULT([yes])
  373. ],[
  374. with_sensors=no
  375. AC_MSG_RESULT([no])
  376. if ! $have_win32; then
  377. with_sensors_enableaction="install libsensors"
  378. fi
  379. ])
  380. LIBS="$save_LIBS"
  381. fi
  382. AC_SUBST(sensors_LIBS)
  383. driverlist="$driverlist opencl:adl/adl"
  384. AC_ARG_ENABLE([adl],
  385. [AC_HELP_STRING([--disable-adl],[Build without ADL monitoring (default enabled)])],
  386. [adl=$enableval]
  387. )
  388. if test x$adl = xyes
  389. then
  390. AC_DEFINE([HAVE_ADL], [1], [Defined if ADL headers were found])
  391. fi
  392. else
  393. adl="no"
  394. fi
  395. driverlist="$driverlist bitforce"
  396. AC_ARG_ENABLE([bitforce],
  397. [AC_HELP_STRING([--disable-bitforce],[Compile support for BitForce (default enabled)])],
  398. [bitforce=$enableval],
  399. [bitforce=$ddyes]
  400. )
  401. if test "x$bitforce" = xyes; then
  402. AC_DEFINE([USE_BITFORCE], [1], [Defined to 1 if BitForce support is wanted])
  403. driverlist="$driverlist bitforce:pci/need_lowl_pci"
  404. if test "x$lowl_pci" = "xyes"; then
  405. need_lowl_pci=yes
  406. fi
  407. need_lowl_vcom=yes
  408. driverlist="$driverlist bitforce:mswin/need_lowl_mswin"
  409. if test x$have_win32 = xtrue; then
  410. need_lowl_mswin=yes
  411. fi
  412. has_fpga=yes
  413. has_asic=yes
  414. have_udevrules=true
  415. fi
  416. AM_CONDITIONAL([HAS_BITFORCE], [test x$bitforce = xyes])
  417. driverlist="$driverlist icarus cairnsmore/icarus erupter/icarus antminer/icarus"
  418. AC_ARG_ENABLE([icarus],
  419. [AC_HELP_STRING([--disable-icarus],[Compile support for Icarus (default enabled)])],
  420. [icarus=$enableval],
  421. [icarus=$ddyes]
  422. )
  423. if test "x$icarus" = xyes; then
  424. AC_DEFINE([USE_ICARUS], [1], [Defined to 1 if Icarus support is wanted])
  425. need_dynclock=yes
  426. need_lowl_vcom=yes
  427. has_fpga=yes
  428. has_asic=yes
  429. have_udevrules=true
  430. fi
  431. AM_CONDITIONAL([HAS_ICARUS], [test x$icarus = xyes])
  432. driverlist="$driverlist dualminer"
  433. AC_ARG_ENABLE([dualminer],
  434. [AC_HELP_STRING([--disable-dualminer],[Compile support for DualMiner (default enabled)])],
  435. [dualminer=$enableval],
  436. [dualminer=$ddauto]
  437. )
  438. if test "x$dualminer" = "xno"; then
  439. true
  440. elif test "x$icarus" = "xyes"; then
  441. dualminer=yes
  442. elif test "x$dualminer" = "xyes"; then
  443. AC_MSG_ERROR([You explicitly disabled Icarus and explicitly enabled DualMiner])
  444. else
  445. dualminer=no
  446. fi
  447. if test "x$dualminer" = "xyes"; then
  448. AC_DEFINE([USE_DUALMINER], [1], [Defined to 1 if DualMiner support is wanted])
  449. need_gc3355=yes
  450. $broad_udevrules && have_udevrules=true
  451. fi
  452. AM_CONDITIONAL([USE_DUALMINER], [test x$dualminer = xyes])
  453. driverlist="$driverlist zeusminer"
  454. AC_ARG_ENABLE([zeusminer],
  455. [AC_HELP_STRING([--disable-zeusminer],[Compile support for ZeusMiner (default enabled with scrypt)])],
  456. [zeusminer=$enableval],
  457. [zeusminer=$ddauto])
  458. if test "x$zeusminer" = "xno"; then
  459. true
  460. elif test "x$icarus$scrypt" = "xyesyes"; then
  461. zeusminer=yes
  462. elif test "x$zeusminer" = "xauto"; then
  463. zeusminer=no
  464. elif test "x$scrypt" = "xno"; then
  465. AC_MSG_ERROR([You explicitly enabled ZeusMiner, but did not enable scrypt])
  466. elif test "x$icarus" = "xno"; then
  467. AC_MSG_ERROR([You explicitly disabled Icarus and explicitly enabled ZeusMiner])
  468. fi
  469. if test "x$zeusminer" = "xyes"; then
  470. AC_DEFINE([USE_ZEUSMINER], [1], [Defined to 1 if ZeusMiner support is wanted])
  471. need_lowl_vcom=yes
  472. has_asic=yes
  473. $broad_udevrules && have_udevrules=true
  474. fi
  475. AM_CONDITIONAL([USE_ZEUSMINER], [test x$zeusminer = xyes])
  476. driverlist="$driverlist gridseed"
  477. AC_ARG_ENABLE([gridseed],
  478. [AC_HELP_STRING([--disable-gridseed],[Compile support for GridSeed (default enabled with scrypt)])],
  479. [gridseed=$enableval],
  480. [gridseed=$scrypt])
  481. if test "x$gridseed" = "xyes"; then
  482. if test "x$scrypt" = "xno"; then
  483. AC_MSG_ERROR([You explicitly enabled GridSeed, but did not enable scrypt (SHA2 not supported)])
  484. fi
  485. AC_DEFINE([USE_GRIDSEED], [1], [Defined to 1 if GridSeed support is wanted])
  486. need_gc3355=yes
  487. need_lowl_vcom=yes
  488. has_asic=yes
  489. $broad_udevrules && have_udevrules=true
  490. fi
  491. AM_CONDITIONAL([USE_GRIDSEED], [test x$gridseed = xyes])
  492. driverlist="$driverlist avalon"
  493. avalon="no"
  494. AC_ARG_ENABLE([avalon],
  495. [AC_HELP_STRING([--disable-avalon],[Compile support for Avalon (default enabled)])],
  496. [avalon=$enableval],
  497. [avalon=$ddyes]
  498. )
  499. if test "x$avalon" = xyes; then
  500. AC_DEFINE([USE_AVALON], [1], [Defined to 1 if Avalon support is wanted])
  501. need_lowl_vcom=yes
  502. has_asic=yes
  503. $broad_udevrules && have_udevrules=true
  504. fi
  505. AM_CONDITIONAL([HAS_AVALON], [test x$avalon = xyes])
  506. driverlist="$driverlist knc"
  507. AC_ARG_ENABLE([knc],
  508. [AC_HELP_STRING([--enable-knc],[Compile support for KnC (default disabled)])],
  509. [knc=$enableval],
  510. [knc=$ddno]
  511. )
  512. if test "x$knc" = xyes; then
  513. AC_CHECK_HEADERS([linux/i2c-dev-user.h])
  514. AC_CHECK_DECL([i2c_smbus_read_word_data],[true],[
  515. AC_MSG_ERROR([linux/i2c-dev.h header from i2c-tools/libi2c-dev (NOT linux headers) is required for knc driver])
  516. ],[
  517. #include <stddef.h>
  518. #ifdef HAVE_LINUX_I2C_DEV_USER_H
  519. #include <linux/i2c-dev-user.h>
  520. #else
  521. #ifdef NEED_LINUX_I2C_H
  522. #include <linux/i2c.h>
  523. #endif
  524. #include <linux/i2c-dev.h>
  525. #endif
  526. ])
  527. AC_DEFINE([USE_KNC], [1], [Defined to 1 if KnC support is wanted])
  528. need_lowl_spi=yes
  529. fi
  530. AM_CONDITIONAL([USE_KNC], [test x$knc = xyes])
  531. AC_ARG_WITH([libmicrohttpd],
  532. [AC_HELP_STRING([--without-libmicrohttpd],[Compile support for libmicrohttpd getwork server (default enabled)])],
  533. [httpsrv=$withval],
  534. [httpsrv=$ddauto]
  535. )
  536. if test "x$httpsrv" != "xno"; then
  537. PKG_CHECK_MODULES([libmicrohttpd],[libmicrohttpd >= 0.9.5],[
  538. AC_DEFINE([USE_LIBMICROHTTPD],[1],[Defined to 1 if libmicrohttpd support is wanted])
  539. httpsrv=yes
  540. ],[
  541. httpsrv=no
  542. httpsrv_enableaction="install libmicrohttpd 0.9.5+"
  543. need_bfg_driver_proxy_enableaction="install libmicrohttpd 0.9.5+"
  544. if test "x$httpsrv" = "xyes"; then
  545. AC_MSG_ERROR([Unable to find libmicrohttpd 0.9.5+])
  546. else
  547. AC_MSG_WARN([libmicrohttpd 0.9.5+ not found; getwork proxy will be unavailable])
  548. fi
  549. ])
  550. fi
  551. AM_CONDITIONAL([USE_LIBMICROHTTPD], [test x$httpsrv = xyes])
  552. AC_ARG_WITH([libevent],
  553. [AC_HELP_STRING([--without-libevent],[Compile support for libevent stratum server (default enabled)])],
  554. [libevent=$withval],
  555. [libevent=$ddauto]
  556. )
  557. if test "x$libevent" != "xno"; then
  558. PKG_CHECK_MODULES([libevent],[libevent >= 2.0.3],[
  559. AC_DEFINE([USE_LIBEVENT],[1],[Defined to 1 if libevent support is wanted])
  560. libevent=yes
  561. ],[
  562. libevent=no
  563. libevent_enableaction="install libevent 2.0.3+"
  564. if test -n "$need_bfg_driver_proxy_enableaction"; then
  565. need_bfg_driver_proxy_enableaction="${need_bfg_driver_proxy_enableaction} (getwork) or libevent 2.0.3+ (stratum)"
  566. else
  567. need_bfg_driver_proxy_enableaction="install libevent 2.0.3+"
  568. fi
  569. if test "x$libevent" = "xyes"; then
  570. AC_MSG_ERROR([Unable to find libevent 2.0.3+])
  571. else
  572. AC_MSG_WARN([libevent 2.0.3+ not found; stratum proxy will be unavailable])
  573. fi
  574. ])
  575. if test "x$libevent" = "xyes"; then
  576. need_work2d=yes
  577. fi
  578. fi
  579. AM_CONDITIONAL([USE_LIBEVENT], [test x$libevent = xyes])
  580. driverlist="$driverlist proxy/need_bfg_driver_proxy"
  581. if test x$libevent$httpsrv = xnono; then
  582. need_bfg_driver_proxy=no
  583. else
  584. need_bfg_driver_proxy=yes
  585. driverlist="$driverlist proxy:getwork/httpsrv proxy:stratum/libevent"
  586. fi
  587. AM_CONDITIONAL([NEED_BFG_DRIVER_PROXY], [test x$libevent$httpsrv != xnono])
  588. driverlist="$driverlist modminer"
  589. AC_ARG_ENABLE([modminer],
  590. [AC_HELP_STRING([--disable-modminer],[Compile support for ModMiner (default enabled)])],
  591. [modminer=$enableval],
  592. [modminer=$ddyes]
  593. )
  594. if test "x$modminer" = xyes; then
  595. AC_DEFINE([USE_MODMINER], [1], [Defined to 1 if ModMiner support is wanted])
  596. need_dynclock=yes
  597. need_lowl_vcom=yes
  598. need_binloader=yes
  599. has_fpga=yes
  600. have_udevrules=true
  601. fi
  602. AM_CONDITIONAL([HAS_MODMINER], [test x$modminer = xyes])
  603. PKG_PROG_PKG_CONFIG()
  604. libusb=no
  605. libusb_include_path=""
  606. AC_ARG_WITH([libusb],
  607. [AC_HELP_STRING([--without-libusb],[Compile using libusb (default enabled)])],
  608. [want_libusb=$withval],
  609. [want_libusb=auto]
  610. )
  611. if test "x$want_libusb" != "xno"; then
  612. PKG_CHECK_MODULES([LIBUSB], [libusb-1.0],[
  613. libusb=yes
  614. ],[
  615. for usb_lib in usb-1.0 usb; do
  616. AC_CHECK_LIB($usb_lib, libusb_init, [
  617. libusb=yes
  618. break
  619. ])
  620. done
  621. if test "x$libusb" = xyes; then
  622. AC_CHECK_DECL([libusb_init],[
  623. LIBUSB_LIBS="-l$usb_lib"
  624. ],[
  625. AC_MSG_CHECKING([whether libusb_init is declared in subdirectory])
  626. libusb_include_path=`echo '#include <libusb-1.0/libusb.h>' | ${CPP} -M - 2>/dev/null | sed -E -e 's/^[^:]+:[[:space:]]*(([^[:space:]]|\\\\[[:space:]])*)libusb\\.h([[:space:]].*|$)$/\\1/' -e 't my' -e d -e ': my' -e 's/\\\\?([\\\\[:space:]])/\\\\\\1/g'`
  627. if test "x$libusb_include_path" != "x"; then
  628. LIBUSB_LIBS="-l$usb_lib"
  629. LIBUSB_CFLAGS="-I$libusb_include_path"
  630. AC_MSG_RESULT([yes])
  631. else
  632. libusb=no
  633. AC_MSG_RESULT([no])
  634. fi
  635. ],[#include <libusb.h>])
  636. fi
  637. ])
  638. fi
  639. driverlist="$driverlist klondike hashbusteravalon/klondike"
  640. AC_ARG_ENABLE([klondike],
  641. [AC_HELP_STRING([--disable-klondike],[Compile support for Klondike (default enabled)])],
  642. [klondike=$enableval],
  643. [klondike=$ddauto]
  644. )
  645. if test "x$klondike$want_libusb" = xyesno; then
  646. AC_MSG_ERROR([You disabled libusb, required for Klondike support])
  647. elif test "x$klondike$libusb" = xyesno; then
  648. AC_MSG_ERROR([Could not find libusb, required for Klondike support])
  649. elif test "x$klondike" = xauto; then
  650. klondike="$libusb"
  651. if test "x$libusb" = xno; then
  652. AC_MSG_WARN([Could not find libusb, required for Klondike support])
  653. klondike_enableaction="install libusb 1.0+"
  654. fi
  655. fi
  656. if test "x$klondike" = xyes; then
  657. AC_DEFINE([USE_KLONDIKE], [1], [Defined to 1 if Klondike support is wanted])
  658. need_lowl_usb=yes
  659. has_asic=yes
  660. have_udevrules=true
  661. fi
  662. AM_CONDITIONAL([HAS_KLONDIKE], [test x$klondike = xyes])
  663. driverlist="$driverlist x6500"
  664. AC_ARG_ENABLE([x6500],
  665. [AC_HELP_STRING([--disable-x6500],[Compile support for X6500 (default if libusb)])],
  666. [x6500=$enableval],
  667. [x6500=$ddauto]
  668. )
  669. if test "x$x6500$want_libusb" = xyesno; then
  670. AC_MSG_ERROR([You disabled libusb, required for X6500 support])
  671. elif test "x$x6500$libusb" = xyesno; then
  672. AC_MSG_ERROR([Could not find libusb, required for X6500 support])
  673. elif test "x$x6500" = xauto; then
  674. x6500="$libusb"
  675. if test "x$libusb" = xno; then
  676. AC_MSG_WARN([Could not find libusb, required for X6500 support])
  677. x6500_enableaction="install libusb 1.0+"
  678. fi
  679. fi
  680. if test "x$x6500" = xyes; then
  681. AC_DEFINE([USE_X6500], [1], [Defined to 1 if X6500 support is wanted])
  682. need_dynclock=yes
  683. need_lowl_ftdi=yes
  684. need_binloader=yes
  685. has_fpga=yes
  686. have_udevrules=true
  687. fi
  688. AM_CONDITIONAL([HAS_X6500], [test x$x6500 = xyes])
  689. driverlist="$driverlist ztex"
  690. AC_ARG_ENABLE([ztex],
  691. [AC_HELP_STRING([--disable-ztex],[Compile support for ZTEX (default if libusb)])],
  692. [ztex=$enableval],
  693. [ztex=$ddauto]
  694. )
  695. if test "x$ztex$want_libusb" = xyesno; then
  696. AC_MSG_ERROR([You disabled libusb, required for ZTEX support])
  697. elif test "x$ztex$libusb" = xyesno; then
  698. AC_MSG_ERROR([Could not find libusb, required for ZTEX support])
  699. elif test "x$ztex" = xauto; then
  700. ztex="$libusb"
  701. if test "x$libusb" = xno; then
  702. AC_MSG_WARN([Could not find libusb, required for ZTEX support])
  703. ztex_enableaction="install libusb 1.0+"
  704. fi
  705. fi
  706. if test "x$ztex" = xyes; then
  707. AC_DEFINE([USE_ZTEX], [1], [Defined to 1 if ZTEX support is wanted])
  708. need_dynclock=yes
  709. need_lowl_usb=yes
  710. need_binloader=yes
  711. has_fpga=yes
  712. have_udevrules=true
  713. fi
  714. AM_CONDITIONAL([HAS_ZTEX], [test x$ztex = xyes])
  715. driverlist="$driverlist bifury"
  716. AC_ARG_ENABLE([bifury],
  717. [AC_HELP_STRING([--disable-bifury],[Compile support for Bi*Fury (default enabled)])],
  718. [bifury=$enableval],
  719. [bifury=$ddyes]
  720. )
  721. if test "x$bifury" = "xyes"; then
  722. AC_DEFINE([USE_BIFURY], [1], [Defined to 1 if Bi*Fury support is wanted])
  723. need_lowl_vcom=yes
  724. has_asic=yes
  725. have_udevrules=true
  726. fi
  727. AM_CONDITIONAL([USE_BIFURY], [test x$bifury = xyes])
  728. driverlist="$driverlist bitfury_gpio/bitfury"
  729. AC_ARG_ENABLE([bitfury],
  730. [AC_HELP_STRING([--disable-bitfury],[Compile support for Bitfury (default enabled)])],
  731. [bitfury=$enableval],
  732. [bitfury=$ddyes]
  733. )
  734. if test "x$bitfury" = xyes; then
  735. AC_DEFINE([USE_BITFURY], [1], [Defined to 1 if Bitfury support is wanted])
  736. need_lowl_spi=yes
  737. fi
  738. AM_CONDITIONAL([HAS_BITFURY], [test x$bitfury = xyes])
  739. driverlist="$driverlist bfsb"
  740. AC_ARG_ENABLE([bfsb],
  741. [AC_HELP_STRING([--enable-bfsb],[Compile support for BFSB (default disabled)])],
  742. [bfsb=$enableval],
  743. [bfsb=$ddno]
  744. )
  745. if test "x$bfsb" = "xyes"; then
  746. if test "x$bitfury" = "xno"; then
  747. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled BFSB])
  748. fi
  749. AC_DEFINE([USE_BFSB], [1], [Defined to 1 if BFSB support is wanted])
  750. fi
  751. AM_CONDITIONAL([HAS_BFSB], [test x$bfsb = xyes])
  752. driverlist="$driverlist bigpic"
  753. AC_ARG_ENABLE([bigpic],
  754. [AC_HELP_STRING([--disable-bigpic],[Compile support for Big Picture Mining USB (default enabled)])],
  755. [bigpic=$enableval],
  756. [bigpic=$ddauto]
  757. )
  758. if test "x$bigpic" = "xno"; then
  759. true
  760. elif test "x$bitfury" = "xyes"; then
  761. bigpic=yes
  762. elif test "x$bigpic" = "xyes"; then
  763. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled BigPic])
  764. else
  765. bigpic=no
  766. fi
  767. if test "x$bigpic" = "xyes"; then
  768. AC_DEFINE([USE_BIGPIC], [1], [Defined to 1 if Big Picture Mining USB support is wanted])
  769. need_lowl_vcom=yes
  770. has_asic=yes
  771. have_udevrules=true
  772. fi
  773. AM_CONDITIONAL([HAS_BIGPIC], [test x$bigpic = xyes])
  774. driverlist="$driverlist bfx"
  775. AC_ARG_ENABLE([bfx],
  776. [AC_HELP_STRING([--disable-bfx],[Compile support for BFx2 (default if libusb)])],
  777. [bfx=$enableval],
  778. [bfx=$ddauto]
  779. )
  780. if test "x$bfx" = "xno"; then
  781. true
  782. elif test "x$bitfury$libusb" = "xyesyes"; then
  783. bfx=yes
  784. elif test "x$bfx" = "xyes"; then
  785. if test "x$want_libusb" = "xno"; then
  786. AC_MSG_ERROR([You disabled libusb, required for BFx2 support])
  787. elif test "x$libusb" = "xno"; then
  788. AC_MSG_ERROR([Could not find libusb, required for BFx2 support])
  789. else
  790. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled BFx2])
  791. fi
  792. elif test "x$bfx" = "xauto"; then
  793. bfx="$libusb"
  794. if test "x$libusb" = xno; then
  795. AC_MSG_WARN([Could not find libusb, required for BFx2 support])
  796. bfx_enableaction="install libusb 1.0+"
  797. fi
  798. fi
  799. if test "x$bfx" = xyes; then
  800. AC_DEFINE([USE_BFX], [1], [Defined to 1 if BFx2 support is wanted])
  801. need_lowl_ftdi=yes
  802. has_asic=yes
  803. $broad_udevrules && have_udevrules=true
  804. fi
  805. AM_CONDITIONAL([USE_BFX], [test x$bfx = xyes])
  806. driverlist="$driverlist drillbit"
  807. AC_ARG_ENABLE([drillbit],
  808. [AC_HELP_STRING([--disable-drillbit],[Compile support for DrillBit (default enabled)])],
  809. [drillbit=$enableval],
  810. [drillbit=$ddauto]
  811. )
  812. if test "x$drillbit" = "xno"; then
  813. true
  814. elif test "x$bitfury" = "xyes"; then
  815. drillbit=yes
  816. elif test "x$drillbit" = "xyes"; then
  817. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled DrillBit])
  818. else
  819. drillbit=no
  820. fi
  821. if test "x$drillbit" = "xyes"; then
  822. AC_DEFINE([USE_DRILLBIT], [1], [Defined to 1 if DrillBit support is wanted])
  823. need_lowl_vcom=yes
  824. has_asic=yes
  825. have_udevrules=true
  826. fi
  827. AM_CONDITIONAL([USE_DRILLBIT], [test x$drillbit = xyes])
  828. driverlist="$driverlist twinfury"
  829. AC_ARG_ENABLE([twinfury],
  830. [AC_HELP_STRING([--disable-twinfury],[Compile support for Twinfury USB miner (default enabled)])],
  831. [twinfury=$enableval],
  832. [twinfury=$ddauto]
  833. )
  834. if test "x$twinfury" = "xno"; then
  835. true
  836. elif test "x$bitfury" = "xyes"; then
  837. twinfury=yes
  838. elif test "x$twinfury" = "xyes"; then
  839. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled Twinfury])
  840. else
  841. twinfury=no
  842. fi
  843. if test "x$twinfury" = "xyes"; then
  844. AC_DEFINE([USE_TWINFURY], [1], [Defined to 1 if Twinfury USB miner support is wanted])
  845. need_lowl_vcom=yes
  846. has_asic=yes
  847. have_udevrules=true
  848. fi
  849. AM_CONDITIONAL([HAS_TWINFURY], [test x$twinfury = xyes])
  850. driverlist="$driverlist littlefury"
  851. AC_ARG_ENABLE([littlefury],
  852. [AC_HELP_STRING([--disable-littlefury],[Compile support for LittleFury (default enabled)])],
  853. [littlefury=$enableval],
  854. [littlefury=$ddauto]
  855. )
  856. if test "x$littlefury" = "xno"; then
  857. true
  858. elif test "x$bitfury" = "xyes"; then
  859. littlefury=yes
  860. elif test "x$littlefury" = "xyes"; then
  861. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled LittleFury])
  862. else
  863. littlefury=no
  864. fi
  865. if test "x$littlefury" = "xyes"; then
  866. AC_DEFINE([USE_LITTLEFURY], [1], [Defined to 1 if LittleFury support is wanted])
  867. need_lowl_vcom=yes
  868. has_asic=yes
  869. have_udevrules=true
  870. fi
  871. AM_CONDITIONAL([HAS_LITTLEFURY], [test x$littlefury = xyes])
  872. found_hidapi=false
  873. for _hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
  874. PKG_CHECK_MODULES([hidapi],[$_hidapi_lib],[
  875. found_hidapi=true
  876. break
  877. ],[
  878. true
  879. ])
  880. done
  881. driverlist="$driverlist nanofury"
  882. AC_ARG_ENABLE([nanofury],
  883. [AC_HELP_STRING([--disable-nanofury],[Compile support for NanoFury (default enabled)])],
  884. [nanofury=$enableval],
  885. [nanofury=$ddauto]
  886. )
  887. if test "x$nanofury" = "xno"; then
  888. true
  889. elif test "x$bitfury" = "xyes"; then
  890. if test x$found_hidapi = xtrue; then
  891. nanofury=yes
  892. else
  893. if test x$nanofury = xauto; then
  894. nanofury=no
  895. nanofury_enableaction="install hidapi"
  896. else
  897. AC_MSG_ERROR([Could not find hidapi, required for NanoFury support])
  898. fi
  899. fi
  900. elif test "x$nanofury" = "xyes"; then
  901. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled NanoFury])
  902. else
  903. nanofury=no
  904. fi
  905. if test "x$nanofury" = "xyes"; then
  906. AC_DEFINE([USE_NANOFURY], [1], [Defined to 1 if NanoFury support is wanted])
  907. need_lowl_hid=yes
  908. has_asic=yes
  909. have_udevrules=true
  910. fi
  911. AM_CONDITIONAL([HAS_NANOFURY], [test x$nanofury = xyes])
  912. driverlist="$driverlist hashbuster"
  913. AC_ARG_ENABLE([hashbuster],
  914. [AC_HELP_STRING([--disable-hashbuster],[Compile support for HashBuster Nano (default enabled)])],
  915. [hashbuster=$enableval],
  916. [hashbuster=$ddauto],
  917. )
  918. if test "x$hashbuster" = "xno"; then
  919. true
  920. elif test "x$bitfury" = "xyes"; then
  921. if test x$found_hidapi = xtrue; then
  922. hashbuster=yes
  923. else
  924. if test x$hashbuster = xauto; then
  925. hashbuster=no
  926. hashbuster_enableaction="install hidapi"
  927. else
  928. AC_MSG_ERROR([Could not find hidapi, required for HashBuster Nano support])
  929. fi
  930. fi
  931. elif test "x$hashbuster" = "xyes"; then
  932. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled HashBuster Nano])
  933. else
  934. hashbuster=no
  935. fi
  936. if test "x$hashbuster" = "xyes"; then
  937. AC_DEFINE([USE_HASHBUSTER], [1], [Defined to 1 if HashBuster Nano support is wanted])
  938. need_lowl_hid=yes
  939. has_asic=yes
  940. have_udevrules=true
  941. fi
  942. AM_CONDITIONAL([USE_HASHBUSTER], [test x$hashbuster = xyes])
  943. driverlist="$driverlist hashbusterusb"
  944. AC_ARG_ENABLE([hashbusterusb],
  945. [AC_HELP_STRING([--disable-hashbusterusb],[Compile support for HashBuster Micro (default if libusb)])],
  946. [hashbusterusb=$enableval],
  947. [hashbusterusb=$ddauto]
  948. )
  949. if test "x$hashbusterusb$want_libusb" = xyesno; then
  950. AC_MSG_ERROR([You disabled libusb, required for HashBuster Micro support])
  951. elif test "x$hashbusterusb$libusb" = xyesno; then
  952. AC_MSG_ERROR([Could not find libusb, required for HashBuster Micro support])
  953. elif test "x$hashbusterusb" = xauto; then
  954. hashbusterusb="$libusb"
  955. if test "x$libusb" = xno; then
  956. AC_MSG_WARN([Could not find libusb, required for HashBuster Micro support])
  957. hashbusterusb_enableaction="install libusb 1.0+"
  958. fi
  959. fi
  960. if test "x$hashbusterusb" = xyes; then
  961. AC_DEFINE([USE_HASHBUSTERUSB], [1], [Defined to 1 if HashBuster Micro support is wanted])
  962. need_lowl_usb=yes
  963. has_asic=yes
  964. have_udevrules=true
  965. fi
  966. AM_CONDITIONAL([USE_HASHBUSTERUSB], [test x$hashbusterusb = xyes])
  967. driverlist="$driverlist hashfast"
  968. AC_ARG_ENABLE([hashfast],
  969. [AC_HELP_STRING([--disable-hashfast],[Compile support for HashFast (default enabled)])],
  970. [hashfast=$enableval],
  971. [hashfast=$ddyes]
  972. )
  973. if test "x$hashfast" = xyes; then
  974. AC_DEFINE([USE_HASHFAST], [1], [Defined to 1 if HashFast support is wanted])
  975. need_lowl_vcom=yes
  976. has_asic=yes
  977. have_udevrules=true
  978. fi
  979. AM_CONDITIONAL([USE_HASHFAST], [test x$hashfast = xyes])
  980. driverlist="$driverlist jingtian"
  981. AC_ARG_ENABLE([jingtian],
  982. [AC_HELP_STRING([--enable-jingtian],[Compile support for JingTian (default disabled)])],
  983. [jingtian=$enableval],
  984. [jingtian=$ddno]
  985. )
  986. if test "x$jingtian" = "xyes"; then
  987. AC_DEFINE([USE_JINGTIAN], [1], [Defined to 1 if JingTian support is wanted])
  988. need_lowl_spi=yes
  989. has_asic=yes
  990. fi
  991. AM_CONDITIONAL([USE_JINGTIAN], [test x$jingtian = xyes])
  992. driverlist="$driverlist metabank"
  993. AC_ARG_ENABLE([metabank],
  994. [AC_HELP_STRING([--enable-metabank],[Compile support for Metabank (default disabled)])],
  995. [metabank=$enableval],
  996. [metabank=$ddno]
  997. )
  998. if test "x$metabank" = "xyes"; then
  999. if test "x$bitfury" = "xno"; then
  1000. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled Metabank])
  1001. fi
  1002. AC_DEFINE([USE_METABANK], [1], [Defined to 1 if Metabank support is wanted])
  1003. fi
  1004. AM_CONDITIONAL([HAS_METABANK], [test x$metabank = xyes])
  1005. driverlist="$driverlist rockminer"
  1006. AC_ARG_ENABLE([rockminer],
  1007. [AC_HELP_STRING([--disable-rockminer],[Compile support for RockMiner (default enabled)])],
  1008. [rockminer=$enableval],
  1009. [rockminer=$ddyes]
  1010. )
  1011. if test "x$rockminer" = xyes; then
  1012. AC_DEFINE([USE_ROCKMINER], [1], [Defined to 1 if RockMiner support is wanted])
  1013. need_lowl_vcom=yes
  1014. has_asic=yes
  1015. have_udevrules=true
  1016. fi
  1017. AM_CONDITIONAL([USE_ROCKMINER], [test x$rockminer = xyes])
  1018. if test "x$need_lowl_vcom" != "xno"; then
  1019. # Lowlevel VCOM doesn't need libusb, but it can take advantage of it to reattach drivers
  1020. if test "x$libusb" != xno; then
  1021. need_lowl_usb=yes
  1022. elif test "x$libusb$want_libusb" = xnoyes; then
  1023. AC_MSG_ERROR([Could not find libusb, which you specifically requested])
  1024. fi
  1025. fi
  1026. lowllist="$lowllist ftdi/need_lowl_ftdi"
  1027. if test x$need_lowl_ftdi = xyes; then
  1028. AC_DEFINE([NEED_BFG_LOWL_FTDI], [1], [Defined to 1 if lowlevel ftdi drivers are being used])
  1029. need_lowl_usb=yes
  1030. fi
  1031. lowllist="$lowllist spi/need_lowl_spi"
  1032. if test x$need_lowl_spi = xyes; then
  1033. AC_DEFINE([NEED_BFG_LOWL_SPI], [1], [Defined to 1 if lowlevel SPI drivers are being used])
  1034. fi
  1035. if test "x$need_lowl_usb" = "xno"; then
  1036. libusb=no
  1037. LIBUSB_LIBS=''
  1038. LIBUSB_CFLAGS=''
  1039. fi
  1040. if test "x$libusb" = xyes; then
  1041. AC_DEFINE([HAVE_LIBUSB], [1], [Define if you have libusb-1.0])
  1042. save_CFLAGS="$CFLAGS"
  1043. CFLAGS="$LIBUSB_CFLAGS $CFLAGS"
  1044. AC_CHECK_DECLS([libusb_error_name],[true],[true],[#include <libusb.h>])
  1045. CFLAGS="$save_CFLAGS"
  1046. fi
  1047. if test x$need_lowl_vcom = xyes; then
  1048. AC_DEFINE([NEED_BFG_LOWL_VCOM], [1], [Defined to 1 if lowlevel VCOM drivers are being used])
  1049. need_lowlevel=yes
  1050. if $have_win32; then
  1051. echo '#include <iospeeds.h>' >iospeeds_local.h
  1052. found_ddkusb=false
  1053. AC_CHECK_HEADER([usbiodef.h],[
  1054. found_ddkusb=true
  1055. ],[
  1056. AC_CHECK_HEADER([ddk/usbiodef.h],[
  1057. found_ddkusb=true
  1058. AUTOSCAN_CPPFLAGS="-I"`echo '#include <ddk/usbiodef.h>' | ${CPP} -M - 2>/dev/null | sed -E -e 's/^[^:]+:[[:space:]]*(([^[:space:]]|\\\\[[:space:]])*)usbiodef\\.h([[:space:]].*|$)$/\\1/' -e 't my' -e d -e ': my' -e 's/\\\\?([\\\\[:space:]])/\\\\\\1/g'`
  1059. ],[
  1060. true
  1061. ],[
  1062. #include <windows.h>
  1063. #include <ddk/usbioctl.h>
  1064. AC_INCLUDES_DEFAULT
  1065. ])
  1066. ],[
  1067. #include <windows.h>
  1068. #include <usbioctl.h>
  1069. AC_INCLUDES_DEFAULT
  1070. ])
  1071. if $found_ddkusb; then
  1072. AUTOSCAN_LIBS="-lsetupapi"
  1073. AC_DEFINE([HAVE_WIN_DDKUSB],[1],[Defined to 1 if Windows DDK USB headers are being used])
  1074. fi
  1075. else
  1076. AC_MSG_CHECKING([what baud rates your system supports])
  1077. echo '#include <termios.h>' | ${CPP} -dM - 2>/dev/null | sed 's/.*[ ]B\([0-9][0-9]*\)[ ].*/IOSPEED(\1)/' | grep IOSPEED >iospeeds_local.h
  1078. if grep -q IOSPEED iospeeds_local.h; then
  1079. AC_MSG_RESULT([done])
  1080. else
  1081. AC_MSG_RESULT([failed, using standard POSIX])
  1082. echo '#include <iospeeds_posix.h>' >iospeeds_local.h
  1083. fi
  1084. fi
  1085. fi
  1086. if test "x$opencl$need_lowl_hid" = xnono; then
  1087. DLOPEN_FLAGS=""
  1088. fi
  1089. lowllist="$lowllist hid/need_lowl_hid"
  1090. if test x$need_lowl_hid = xyes; then
  1091. AC_DEFINE([NEED_BFG_LOWL_HID], [1], [Defined to 1 if lowlevel hid drivers are being used])
  1092. need_lowlevel=yes
  1093. fi
  1094. lowllist="$lowllist mswin/need_lowl_mswin"
  1095. if test x$need_lowl_mswin = xyes; then
  1096. AC_DEFINE([NEED_BFG_LOWL_MSWIN], [1], [Defined to 1 if lowlevel mswin drivers are being used])
  1097. need_lowlevel=yes
  1098. fi
  1099. lowllist="$lowllist pci/need_lowl_pci"
  1100. if test x$need_lowl_pci = xyes; then
  1101. AC_DEFINE([NEED_BFG_LOWL_PCI], [1], [Defined to 1 if lowlevel PCI drivers are being used])
  1102. need_lowlevel=yes
  1103. lowllist="$lowllist pci:uio/uio"
  1104. if test x$uio = xyes; then
  1105. AC_DEFINE([USE_UIO], [1], [Defined to 1 if lowlevel PCI drivers should support UIO])
  1106. fi
  1107. lowllist="$lowllist pci:vfio/vfio"
  1108. if test x$vfio = xyes; then
  1109. AC_DEFINE([USE_VFIO], [1], [Defined to 1 if lowlevel PCI drivers should support VFIO])
  1110. fi
  1111. fi
  1112. AM_CONDITIONAL([USE_VFIO], [test x$need_lowl_pci$vfio = xyesyes])
  1113. lowllist="$lowllist usb/need_lowl_usb"
  1114. if test x$need_lowl_usb = xyes; then
  1115. need_lowlevel=yes
  1116. fi
  1117. lowllist="$lowllist vcom/need_lowl_vcom"
  1118. if test x$need_lowl_vcom = xyes; then
  1119. need_lowlevel=yes
  1120. fi
  1121. if test x$need_lowlevel = xyes; then
  1122. AC_DEFINE([HAVE_BFG_LOWLEVEL], [1], [Defined to 1 if lowlevel drivers are being used])
  1123. fi
  1124. curses="auto"
  1125. AC_ARG_WITH([curses],
  1126. [AC_HELP_STRING([--without-curses],[Compile support for curses TUI (default enabled)])],
  1127. [curses=$withval]
  1128. )
  1129. if test "x$curses" = "xno"; then
  1130. optlist="$optlist curses"
  1131. else
  1132. curses_enableaction="install a curses library"
  1133. orig_libs="$LIBS"
  1134. if test "x${curses}" = "xyes"; then
  1135. preferl=''
  1136. else
  1137. preferl="${curses} ${curses}6 ${curses}5"
  1138. fi
  1139. for wideornot in w u ''; do
  1140. for ncursesver in '' 6 5; do
  1141. preferl="${preferl} ncurses${wideornot}${ncursesver}"
  1142. done
  1143. preferl="${preferl} pdcurses${wideornot}"
  1144. done
  1145. if test "x$cross_compiling" != "xyes"; then
  1146. AC_MSG_CHECKING([for best native curses library])
  1147. orig_cflags="$CFLAGS"
  1148. for curses_lib in ${preferl}; do
  1149. if ! ${curses_lib}-config --cflags >/dev/null 2>/dev/null; then
  1150. continue
  1151. fi
  1152. CFLAGS="$orig_cflags $(${curses_lib}-config --cflags)"
  1153. LIBS="$orig_libs $(${curses_lib}-config --libs)"
  1154. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  1155. #include <curses.h>
  1156. ]], [[
  1157. WINDOW *w = NULL;
  1158. mvwprintw(w, 2, 2, "Testing %s", "o hai");
  1159. ]])], [
  1160. curses=yes
  1161. optlist="$optlist ${curses_lib}/curses"
  1162. AC_MSG_RESULT([$curses_lib])
  1163. NCURSES_LIBS=`${curses_lib}-config --libs`
  1164. NCURSES_CPPFLAGS=`${curses_lib}-config --cflags`
  1165. break
  1166. ], [
  1167. AC_MSG_WARN([${curses_lib} doesn't seem to be installed properly])
  1168. ])
  1169. done
  1170. CFLAGS="$orig_cflags"
  1171. if test "x$curses" != "xyes"; then
  1172. AC_MSG_RESULT([none?])
  1173. fi
  1174. fi
  1175. if test "x$curses" != "xyes"; then
  1176. sym=addstr
  1177. AC_SEARCH_LIBS(${sym}, ${preferl}, [
  1178. curses=yes
  1179. eval "curseslib=\"\${ac_cv_search_${sym}}\""
  1180. barelib="${curseslib/-l/}"
  1181. optlist="$optlist ${barelib}/curses"
  1182. if test "x${curseslib}" != "xnone required"; then
  1183. NCURSES_LIBS="${curseslib}"
  1184. fi
  1185. # Need to check for headers in subdirectories, to ensure we get wide stuff
  1186. AC_MSG_CHECKING([for curses header subdirectory])
  1187. barelib="${barelib/6/}"
  1188. barelib="${barelib/5/}"
  1189. cursesincl=`echo '#include <'"${barelib}"'/curses.h>' | ${CPP} -M - 2>/dev/null | sed -E -e 's/^[^:]+:[[:space:]]*(([^[:space:]]|\\\\[[:space:]])*)curses\\.h([[:space:]].*|$)$/\\1/' -e 't my' -e d -e ': my' -e 's/\\\\?([\\\\[:space:]])/\\\\\\1/g'`
  1190. if test "x$cursesincl" != "x"; then
  1191. NCURSES_CPPFLAGS="-I${cursesincl}"
  1192. AC_MSG_RESULT([$cursesincl])
  1193. else
  1194. AC_MSG_RESULT([none found])
  1195. fi
  1196. break
  1197. ], [
  1198. if test "x$curses" = "xyes"; then
  1199. AC_MSG_ERROR([Could not find curses library - please install libncurses-dev or pdcurses-dev (or configure --without-curses)])
  1200. else
  1201. AC_MSG_WARN([Could not find curses library - if you want a TUI, install libncurses-dev or pdcurses-dev])
  1202. curses=no
  1203. optlist="$optlist curses"
  1204. fi
  1205. ])
  1206. fi
  1207. if test "x$curses" = "xyes"; then
  1208. AC_DEFINE([HAVE_CURSES], [1], [Defined to 1 if curses TUI support is wanted])
  1209. AC_MSG_CHECKING([whether curses library supports wide characters])
  1210. LIBS="$orig_libs $NCURSES_CPPFLAGS $NCURSES_LIBS"
  1211. AC_LINK_IFELSE([
  1212. AC_LANG_PROGRAM([
  1213. #define PDC_WIDE
  1214. #include <curses.h>
  1215. ],[
  1216. addwstr(L"test");
  1217. add_wch(WACS_VLINE);
  1218. ])
  1219. ],[
  1220. AC_MSG_RESULT([yes])
  1221. AC_DEFINE([USE_UNICODE],[1],[Defined to 1 if curses supports wide characters])
  1222. ],[
  1223. AC_MSG_RESULT([no])
  1224. ])
  1225. fi
  1226. LIBS="$orig_libs"
  1227. fi
  1228. maybe_ldconfig=
  1229. AC_ARG_WITH([system-libblkmaker], [AC_HELP_STRING([--with-system-libblkmaker], [Use system libblkmaker rather than bundled one (default disabled)])],[true],[with_system_libblkmaker=no])
  1230. if test "x$with_system_libblkmaker" = "xyes"; then
  1231. PKG_CHECK_MODULES([libblkmaker],[libblkmaker_jansson-0.1],[
  1232. true
  1233. ],[
  1234. AC_MSG_ERROR([Could not find system libblkmaker])
  1235. ])
  1236. else
  1237. save_LDFLAGS="$LDFLAGS"
  1238. LDFLAGS="$LDFLAGS -Wl,-zorigin"
  1239. origin_LDFLAGS=
  1240. AC_MSG_CHECKING([whether the linker recognizes the -zorigin option])
  1241. AC_TRY_LINK([],[],[
  1242. AC_MSG_RESULT([yes])
  1243. origin_LDFLAGS=',-zorigin'
  1244. ],[
  1245. AC_MSG_RESULT([no])
  1246. ])
  1247. LDFLAGS="$save_LDFLAGS"
  1248. libblkmaker_CFLAGS='-Ilibblkmaker'
  1249. libblkmaker_LDFLAGS='-Llibblkmaker/.libs -Wl,-rpath,\$$ORIGIN/libblkmaker/.libs'"$origin_LDFLAGS"
  1250. libblkmaker_LIBS='-lblkmaker_jansson-0.1 -lblkmaker-0.1'
  1251. AC_CONFIG_SUBDIRS([libblkmaker])
  1252. _ROOTPATH=$PATH$PATH_SEPARATOR`echo $PATH | sed s/bin/sbin/g`
  1253. possible_ldconfigs="${target}-ldconfig"
  1254. if test "x$cross_compiling" != "xyes"; then
  1255. possible_ldconfigs="${possible_ldconfigs} ldconfig"
  1256. fi
  1257. AC_CHECK_PROGS([LDCONFIG],[${possible_ldconfigs}],[],[$_ROOTPATH])
  1258. if test "x$LDCONFIG" != "x"; then
  1259. maybe_ldconfig=" && $LDCONFIG"
  1260. fi
  1261. fi
  1262. AC_SUBST(libblkmaker_CFLAGS)
  1263. AC_SUBST(libblkmaker_LDFLAGS)
  1264. AC_SUBST(libblkmaker_LIBS)
  1265. $have_udevrules || use_udevrules=false
  1266. if $use_udevrules; then
  1267. AC_ARG_WITH([udevrulesdir],
  1268. AS_HELP_STRING([--with-udevrulesdir=DIR], [Install udev rules into this directory]),
  1269. [], [
  1270. if test -d /lib/udev/rules.d; then
  1271. with_udevrulesdir=/lib/udev/rules.d
  1272. else
  1273. with_udevrulesdir=no
  1274. fi
  1275. ]
  1276. )
  1277. if test "x$with_udevrulesdir" = "xno"; then
  1278. use_udevrules=false
  1279. fi
  1280. if $use_udevrules; then
  1281. AC_SUBST([udevrulesdir], [$with_udevrulesdir])
  1282. fi
  1283. fi
  1284. AM_CONDITIONAL([NEED_LIBBLKMAKER], [test x$with_system_libblkmaker != xyes])
  1285. AM_CONDITIONAL([NEED_BFG_BINLOADER], [test x$need_binloader = xyes])
  1286. AM_CONDITIONAL([NEED_DYNCLOCK], [test x$need_dynclock = xyes])
  1287. AM_CONDITIONAL([USE_GC3355], [test x$need_gc3355 = xyes])
  1288. AM_CONDITIONAL([NEED_BFG_LOWL_VCOM], [test x$need_lowl_vcom = xyes])
  1289. AM_CONDITIONAL([NEED_BFG_LOWL_FTDI], [test x$need_lowl_ftdi = xyes])
  1290. AM_CONDITIONAL([NEED_BFG_LOWL_HID], [test x$need_lowl_hid = xyes])
  1291. AM_CONDITIONAL([NEED_BFG_LOWL_MSWIN], [test x$need_lowl_mswin = xyes])
  1292. AM_CONDITIONAL([NEED_BFG_LOWL_PCI], [test x$need_lowl_pci = xyes])
  1293. AM_CONDITIONAL([NEED_BFG_LOWL_SPI], [test x$need_lowl_spi = xyes])
  1294. AM_CONDITIONAL([NEED_BFG_LOWLEVEL], [test x$need_lowlevel = xyes])
  1295. AM_CONDITIONAL([NEED_BFG_WORK2D], [test x$need_work2d = xyes])
  1296. AM_CONDITIONAL([HAS_SCRYPT], [test x$scrypt = xyes])
  1297. AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
  1298. AM_CONDITIONAL([HAVE_SENSORS], [test x$with_sensors = xyes])
  1299. AM_CONDITIONAL([HAVE_CYGWIN], [test x$have_cygwin = xtrue])
  1300. AM_CONDITIONAL([HAVE_LIBUSB], [test x$libusb = xyes])
  1301. AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
  1302. AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
  1303. AM_CONDITIONAL([HAVE_WIN_DDKUSB], [test x$found_ddkusb = xtrue])
  1304. AM_CONDITIONAL([HAS_FPGA], [test x$has_fpga != xno])
  1305. AM_CONDITIONAL([HAS_ASIC], [test x$has_asic != xno])
  1306. AM_CONDITIONAL([USE_UDEVRULES], [$use_udevrules])
  1307. AM_CONDITIONAL([BROAD_UDEVRULES], [$broad_udevrules])
  1308. dnl Find YASM
  1309. has_yasm=false
  1310. if test "x$have_x86_32$have_x86_64" != "xfalsefalse"; then
  1311. AC_PATH_PROG([YASM],[yasm],[false])
  1312. if test "x$YASM" != "xfalse" ; then
  1313. has_yasm_enableaction="install yasm 1.0.1+"
  1314. AC_MSG_CHECKING([if yasm version is greater than 1.0.1])
  1315. yasmver=`"$YASM" --version | head -1 | cut -d\ -f2`
  1316. yamajor=`echo $yasmver | cut -d. -f1`
  1317. yaminor=`echo $yasmver | cut -d. -f2`
  1318. yamini=`echo $yasmver | cut -d. -f3`
  1319. if test "$yamajor" -ge "1" ; then
  1320. if test "$yamajor" -eq "1" ; then
  1321. if test "$yaminor" -ge "0" ; then
  1322. if test "$yaminor" -eq "0"; then
  1323. if test "$yamini" -ge "1"; then
  1324. has_yasm=true
  1325. fi
  1326. else
  1327. has_yasm=true
  1328. fi
  1329. fi
  1330. fi
  1331. else
  1332. has_yasm=false
  1333. fi
  1334. if test "x$has_yasm" = "xtrue" ; then
  1335. AC_MSG_RESULT([yes])
  1336. else
  1337. AC_MSG_RESULT([no])
  1338. fi
  1339. fi
  1340. if test "x$has_yasm" = "xfalse" ; then
  1341. AC_MSG_NOTICE([yasm is required for the assembly algorithms. They will be skipped.])
  1342. else
  1343. AC_DEFINE([HAVE_YASM], [1], [Defined to 1 if yasm is being used])
  1344. if test "x$have_win32$have_cygwin" != "xfalsefalse"; then
  1345. if test "x$have_x86_64" = xtrue; then
  1346. YASM_FMT="win64"
  1347. else
  1348. YASM_FMT="coff"
  1349. fi
  1350. elif test "x$have_macho" = "xtrue"; then
  1351. YASM_FMT="macho$bitness"
  1352. else
  1353. YASM_FMT="elf$bitness"
  1354. fi
  1355. fi
  1356. fi
  1357. AM_CONDITIONAL([HAS_YASM], [test x$has_yasm = xtrue])
  1358. have_sse2=no
  1359. if test "x$cpumining$have_x86_32" = "xyestrue"; then
  1360. AC_MSG_CHECKING([if SSE2 code compiles])
  1361. save_CFLAGS="$CFLAGS"
  1362. for flags in '' '-msse2'; do
  1363. CFLAGS="$CFLAGS $flags"
  1364. AC_TRY_LINK([
  1365. #include <xmmintrin.h>
  1366. ],[
  1367. int *i = (int *)0xdeadbeef;
  1368. __m128i a, b;
  1369. a = _mm_set1_epi32(i[0]);
  1370. b = _mm_set_epi32(i[0], i[1], i[2], i[3]);
  1371. a = _mm_add_epi32(a, b);
  1372. a = _mm_andnot_si128(a, b);
  1373. a = _mm_or_si128(a, b);
  1374. a = _mm_slli_epi32(a, i[4]);
  1375. a = _mm_and_si128(a, b);
  1376. a = _mm_xor_si128(a, b);
  1377. ],[
  1378. if test "x$flags" = "x"; then
  1379. AC_MSG_RESULT([yes])
  1380. else
  1381. AC_MSG_RESULT([with $flags])
  1382. fi
  1383. SSE2_CFLAGS="$flags"
  1384. have_sse2=yes
  1385. break
  1386. ],[
  1387. true
  1388. ])
  1389. done
  1390. CFLAGS="${save_CFLAGS}"
  1391. if test "x$have_sse2" = "xyes"; then
  1392. AC_DEFINE([HAVE_SSE2], [1], [Defined to 1 if yasm is being used])
  1393. else
  1394. AC_MSG_RESULT([no])
  1395. fi
  1396. fi
  1397. AM_CONDITIONAL([HAVE_SSE2], [test "x$have_sse2" = "xyes"])
  1398. if test "x$need_lowl_vcom" = "xyes"; then
  1399. AC_ARG_WITH([libudev], [AC_HELP_STRING([--without-libudev], [Autodetect FPGAs using libudev (default enabled)])],
  1400. [libudev=$withval],
  1401. [libudev=auto]
  1402. )
  1403. if test "x$libudev" != "xno"; then
  1404. AC_CHECK_HEADER([libudev.h],[
  1405. libudev=yes
  1406. UDEV_LIBS=-ludev
  1407. AC_DEFINE([HAVE_LIBUDEV], [1], [Defined to 1 if libudev is wanted])
  1408. ], [
  1409. if test "x$libudev" = "xyes"; then
  1410. AC_MSG_ERROR([libudev not found])
  1411. fi
  1412. libudev=no
  1413. ])
  1414. fi
  1415. fi
  1416. AM_CONDITIONAL([HAVE_LIBUDEV], [test x$libudev != xno])
  1417. AC_SUBST(LIBUSB_LIBS)
  1418. AC_SUBST(LIBUSB_CFLAGS)
  1419. PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.18.2], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.18.2])])
  1420. if echo "$LIBCURL_CFLAGS" | grep '@CPPFLAG_CURL_STATICLIB@' >/dev/null 2>&1; then
  1421. AC_MSG_WARN([Your libcurl pkgconfig file is broken, applying workaround])
  1422. LIBCURL_CFLAGS=`echo "$LIBCURL_CFLAGS" | sed 's/@CPPFLAG_CURL_STATICLIB@//'`
  1423. fi
  1424. AC_SUBST(LIBCURL_LIBS)
  1425. AC_CHECK_FUNCS([setrlimit])
  1426. dnl CCAN wants to know a lot of vars.
  1427. # All the configuration checks. Regrettably, the __attribute__ checks will
  1428. # give false positives on old GCCs, since they just cause warnings. But that's
  1429. # fairly harmless.
  1430. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((cold)) cleanup(void) { }])],
  1431. AC_DEFINE([HAVE_ATTRIBUTE_COLD], [1],
  1432. [Define if __attribute__((cold))]))
  1433. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((const)) cleanup(void) { }])],
  1434. AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1],
  1435. [Define if __attribute__((const))]))
  1436. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((noreturn)) cleanup(void) { exit(1); }])],
  1437. [
  1438. AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
  1439. [Define if __attribute__((noreturn))])
  1440. AC_DEFINE_UNQUOTED([NORETURN], [__attribute__((noreturn))], [Syntax of noreturn attribute])
  1441. ], [
  1442. AC_DEFINE_UNQUOTED([NORETURN], [])
  1443. ]
  1444. )
  1445. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((format(__printf__, 1, 2))) cleanup(const char *fmt, ...) { }])],
  1446. AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1],
  1447. [Define if __attribute__((format(__printf__)))]))
  1448. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((unused)) cleanup(void) { }])],
  1449. AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1],
  1450. [Define if __attribute__((unused))]))
  1451. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((used)) cleanup(void) { }])],
  1452. AC_DEFINE([HAVE_ATTRIBUTE_USED], [1],
  1453. [Define if __attribute__((used))]))
  1454. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_constant_p(1) ? 0 : 1; }])],
  1455. AC_DEFINE([HAVE_BUILTIN_CONSTANT_P], [1],
  1456. [Define if have __builtin_constant_p]))
  1457. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_types_compatible_p(char *, int) ? 1 : 0; }])],
  1458. AC_DEFINE([HAVE_BUILTIN_TYPES_COMPATIBLE_P], [1],
  1459. [Define if have __builtin_types_compatible_p]))
  1460. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static int __attribute__((warn_unused_result)) func(int x) { return x; }])],
  1461. AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1],
  1462. [Define if __attribute__((warn_unused_result))]))
  1463. # byteswap functions
  1464. AH_TEMPLATE([HAVE_BYTESWAP_H], [Define to use byteswap macros from byteswap.h])
  1465. AH_TEMPLATE([HAVE_ENDIAN_H], [Define to use byteswap macros from endian.h])
  1466. AH_TEMPLATE([HAVE_SYS_ENDIAN_H], [Define to use byteswap macros from sys/endian.h])
  1467. AH_TEMPLATE([HAVE_LIBKERN_OSBYTEORDER_H], [Define to use byteswap macros from libkern/OSByteOrder.h])
  1468. BSWAP=''
  1469. for sym in bswap_ __builtin_bswap __bswap_ __swap swap OSSwapInt; do
  1470. AC_MSG_CHECKING([for ${sym}* functions])
  1471. for headerfile in '' byteswap.h endian.h sys/endian.h libkern/OSByteOrder.h; do
  1472. BFG_INCLUDE([headerinclude], [${headerfile}])
  1473. AC_LINK_IFELSE([
  1474. AC_LANG_PROGRAM([
  1475. ${headerinclude}
  1476. ], [
  1477. (void) ${sym}16(0);
  1478. (void) ${sym}32(0);
  1479. (void) ${sym}64(0);
  1480. ])
  1481. ], [
  1482. BSWAP="${sym}"
  1483. if test "x${headerfile}" = "x"; then
  1484. AC_MSG_RESULT([yes])
  1485. else
  1486. AC_MSG_RESULT([found in ${headerfile}])
  1487. AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$headerfile]), 1)
  1488. fi
  1489. break 2
  1490. ])
  1491. done
  1492. AC_MSG_RESULT([no])
  1493. done
  1494. if test "x$BSWAP" = "x"; then
  1495. true # Substitutes are provided in miner.h
  1496. elif test "x$BSWAP" = "xbswap_"; then
  1497. AC_MSG_CHECKING([if bswap_16 is already a macro])
  1498. BFG_PREPROC_IFELSE([defined(bswap_16)], $headerfile, [
  1499. AC_MSG_RESULT([yes])
  1500. BSWAP=""
  1501. ],[
  1502. AC_MSG_RESULT([no])
  1503. ])
  1504. fi
  1505. if test "x$BSWAP" != "x"; then
  1506. AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, [Define to 16-bit byteswap macro])
  1507. AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, [Define to 16-bit byteswap macro])
  1508. AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, [Define to 16-bit byteswap macro])
  1509. fi
  1510. # endian definition macros
  1511. AC_MSG_CHECKING([for platform endian])
  1512. found_endian=no
  1513. for headerfile in '' endian.h sys/endian.h sys/param.h; do
  1514. for pfx in '' '__'; do
  1515. BFG_PREPROC_IFELSE([defined(${pfx}BYTE_ORDER) && defined(${pfx}BIG_ENDIAN) && defined(${pfx}LITTLE_ENDIAN) && (${pfx}BYTE_ORDER == ${pfx}BIG_ENDIAN || ${pfx}BYTE_ORDER == ${pfx}LITTLE_ENDIAN)], ${headerfile}, [
  1516. if test "x$headerfile" = "x"; then
  1517. headerfilec=''
  1518. else
  1519. headerfilec=" (${headerfile})"
  1520. fi
  1521. BFG_PREPROC_IFELSE([${pfx}BYTE_ORDER == ${pfx}BIG_ENDIAN], ${headerfile}, [
  1522. AC_MSG_RESULT([big endian${headerfilec}])
  1523. AC_DEFINE(WORDS_BIGENDIAN, 1, [Define if your platform is big endian])
  1524. ], [
  1525. AC_MSG_RESULT([little endian${headerfilec}])
  1526. ])
  1527. found_endian=yes
  1528. break 2
  1529. ],[true])
  1530. done
  1531. done
  1532. if test "x$found_endian" = "xno"; then
  1533. if $have_win32 || $have_cygwin; then
  1534. AC_MSG_RESULT([assuming little endian (Windows)])
  1535. else
  1536. # AC_C_BIGENDIAN is reported to have problems, and invasive even if buried in a conditional, so don't use it
  1537. AC_MSG_RESULT([unknown])
  1538. AC_MSG_ERROR([Unable to identify platform endian])
  1539. fi
  1540. fi
  1541. AC_MSG_CHECKING([if good static asserts compile])
  1542. AC_TRY_LINK([
  1543. #include <stddef.h>
  1544. ], [
  1545. _Static_assert(1, ":)");
  1546. ], [
  1547. AC_MSG_RESULT([yes])
  1548. ], [
  1549. AC_MSG_RESULT([no])
  1550. AC_DEFINE_UNQUOTED([_Static_assert(...)], [], [Turns _Static_assert into noop for compilers that don't support it])
  1551. ])
  1552. AC_MSG_CHECKING([if GNU format attribute compiles])
  1553. AC_TRY_COMPILE([
  1554. #define FORMAT_SYNTAX_CHECK(...) __attribute__(( format(__VA_ARGS__) ))
  1555. int myfunc(char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
  1556. int myfunc(char *fmt, ...) {
  1557. return 42;
  1558. }
  1559. ], [
  1560. myfunc("abc%d", 42);
  1561. ], [
  1562. AC_MSG_RESULT([yes])
  1563. AC_DEFINE_UNQUOTED([FORMAT_SYNTAX_CHECK(...)], [__attribute__(( format(__VA_ARGS__) ))], [Syntax of format-checking attribute])
  1564. ], [
  1565. AC_MSG_RESULT([no])
  1566. AC_DEFINE_UNQUOTED([FORMAT_SYNTAX_CHECK(...)], [])
  1567. ])
  1568. AC_MSG_CHECKING([for clock_gettime(CLOCK_MONOTONIC)])
  1569. AC_TRY_COMPILE([
  1570. #define _GNU_SOURCE
  1571. #include <time.h>
  1572. ],[
  1573. struct timespec ts;
  1574. clock_gettime(CLOCK_MONOTONIC, &ts);
  1575. ],[
  1576. AC_MSG_RESULT([yes])
  1577. AC_DEFINE([HAVE_CLOCK_GETTIME_MONOTONIC], [1], [Defined to 1 if clock_gettime(CLOCK_MONOTONIC) is defined])
  1578. save_LIBS="${LIBS}"
  1579. AC_SEARCH_LIBS([clock_gettime],[rt posix4],[
  1580. if test "x${ac_cv_search_clock_gettime}" != "xnone required"; then
  1581. RT_LIBS="${ac_cv_search_clock_gettime}"
  1582. fi
  1583. ])
  1584. LIBS="${save_LIBS}"
  1585. AC_CHECK_FUNCS([clock_nanosleep])
  1586. AC_MSG_CHECKING([for clock_gettime(CLOCK_MONOTONIC_RAW)])
  1587. AC_TRY_COMPILE([
  1588. #define _GNU_SOURCE
  1589. #include <time.h>
  1590. ],[
  1591. struct timespec ts;
  1592. clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
  1593. ],[
  1594. AC_MSG_RESULT([yes])
  1595. AC_DEFINE([HAVE_CLOCK_GETTIME_MONOTONIC_RAW], [1], [Defined to 1 if clock_gettime(CLOCK_MONOTONIC_RAW) is defined])
  1596. ],[
  1597. AC_MSG_RESULT([no])
  1598. ])
  1599. ],[
  1600. AC_MSG_RESULT([no])
  1601. ])
  1602. save_LIBS="$LIBS"
  1603. LIBS="$LIBS $MATH_LIBS"
  1604. AC_CHECK_FUNCS([log2])
  1605. LIBS="$save_LIBS"
  1606. if test "x$prefix" = xNONE; then
  1607. prefix=/usr/local
  1608. fi
  1609. AM_CONDITIONAL([NEED_BITSTREAM_FPGAMINER], [test x$modminer$x6500 != xnono])
  1610. m4_define([BFG_PRINT_LIST],[
  1611. eval _mylist="\$$2"
  1612. _yeslist=
  1613. _nolist=
  1614. _enableactions=
  1615. for _opt in $_mylist; do
  1616. IFS=/ read _opt _var <<EOF
  1617. $_opt
  1618. EOF
  1619. test -n "$_var" || _var="$_opt"
  1620. eval "_val=\"\$${_var}\""
  1621. if test "x$_val" = "xno" || test "x$_val" = "xfalse"; then
  1622. _nolist="$_nolist $_opt"
  1623. eval "_enableaction=\"\$${_var}_enableaction\""
  1624. if test -n "$_enableaction"; then
  1625. _enableactions="${_enableactions}~ To enable ${_opt}, ${_enableaction}"
  1626. fi
  1627. else
  1628. _yeslist="$_yeslist $_opt"
  1629. fi
  1630. done
  1631. _yeslist=`echo "$_yeslist" | tr ' ' '\n' | sort | tr '\n' ' '`
  1632. _nolist=`echo "$_nolist" | tr ' ' '\n' | sort | tr '\n' ' '`
  1633. AC_DEFINE_UNQUOTED(AS_TR_CPP([BFG_$2]),["$_yeslist"],[List of drivers being built])
  1634. $2_print=" Enabled..$1..:${_yeslist}~ Disabled.$1..:${_nolist}${_enableactions}"
  1635. ])
  1636. BFG_PRINT_LIST([Lowlevel..],[lowllist])
  1637. BFG_PRINT_LIST([Drivers...],[driverlist])
  1638. BFG_PRINT_LIST([Algorithms],[algolist])
  1639. BFG_PRINT_LIST([Options...],[optlist])
  1640. AC_SUBST(AUTOSCAN_CPPFLAGS)
  1641. AC_SUBST(AUTOSCAN_LIBS)
  1642. AC_SUBST(PTHREAD_FLAGS)
  1643. AC_SUBST(DLOPEN_FLAGS)
  1644. AC_SUBST(PTHREAD_LIBS)
  1645. AC_SUBST(NCURSES_CPPFLAGS)
  1646. AC_SUBST(NCURSES_LIBS)
  1647. AC_SUBST(PDCURSES_LIBS)
  1648. AC_SUBST(WS2_LIBS)
  1649. AC_SUBST(MM_LIBS)
  1650. AC_SUBST(MATH_LIBS)
  1651. AC_SUBST(RT_LIBS)
  1652. AC_SUBST(UDEV_LIBS)
  1653. AC_SUBST(SSE2_CFLAGS)
  1654. AC_SUBST(YASM_FMT)
  1655. AC_CONFIG_FILES([
  1656. Makefile
  1657. x86_64/Makefile
  1658. x86_32/Makefile
  1659. ccan.bfg/Makefile
  1660. lib/Makefile
  1661. ])
  1662. if $use_udevrules; then
  1663. AC_CONFIG_FILES([70-bfgminer.rules])
  1664. fi
  1665. AC_OUTPUT
  1666. wordfilter ()
  1667. {
  1668. echo "$1" | sed 's/ \+/ /g;s/^ *//;s/ *$//'
  1669. }
  1670. echo
  1671. echo "------------------------------------------------------------------------"
  1672. echo "$PACKAGE $VERSION configuration options summary"
  1673. echo "------------------------------------------------------------------------"
  1674. echo
  1675. echo " CFLAGS...............: "`wordfilter "$CPPFLAGS $AUTOSCAN_CPPFLAGS $NCURSES_CPPFLAGS $PTHREAD_FLAGS $CFLAGS $LIBUSB_CFLAGS $JANSSON_CFLAGS $PTHREAD_FLAGS $libblkmaker_CFLAGS $hidapi_CFLAGS"`
  1676. echo " LDFLAGS..............: "`wordfilter "$LDFLAGS $AUTOSCAN_LIBS $PTHREAD_FLAGS $libblkmaker_LDFLAGS $PTHREAD_LIBS $LIBS $DLOPEN_FLAGS $LIBCURL_LIBS $JANSSON_LIBS $NCURSES_LIBS $PDCURSES_LIBS $WS2_LIBS $MATH_LIBS $UDEV_LIBS $LIBUSB_LIBS $RT_LIBS $sensors_LIBS $libblkmaker_LIBS"`
  1677. echo " Installation.prefix..: $prefix"
  1678. echo
  1679. echo "${lowllist_print}" | tr '~' '\n'
  1680. echo "${driverlist_print}" | tr '~' '\n'
  1681. echo "${algolist_print}" | tr '~' '\n'
  1682. echo "${optlist_print}" | tr '~' '\n'
  1683. echo