configure.ac 54 KB

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