configure.ac 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623
  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], [5])
  16. m4_define([v_min], [4])
  17. m4_define([v_mic], [2])
  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. AC_PROG_SED
  66. gl_INIT
  67. AC_SYS_LARGEFILE
  68. dnl Checks for header files.
  69. AC_HEADER_STDC
  70. AC_CHECK_HEADERS(syslog.h)
  71. AC_CHECK_HEADERS([sys/epoll.h])
  72. AC_CHECK_HEADERS([sys/mman.h])
  73. AC_CHECK_HEADERS([sys/prctl.h])
  74. AC_CHECK_HEADERS([sys/file.h])
  75. AC_CHECK_HEADERS([sys/termios.h])
  76. AC_CHECK_HEADERS([linux/spi/spidev.h])
  77. AC_CHECK_MEMBER([struct i2c_msg.buf],[
  78. true
  79. ],[
  80. dnl Note the member is different here to avoid caching screwing things up
  81. AC_CHECK_MEMBER([struct i2c_msg.len],[
  82. AC_DEFINE([NEED_LINUX_I2C_H],[1],[Defined if linux/i2c.h is needed to supplement linux/i2c-dev.h])
  83. ],[
  84. true
  85. ],[
  86. AC_INCLUDES_DEFAULT
  87. #include <linux/i2c.h>
  88. #include <linux/i2c-dev.h>
  89. ])
  90. ],[
  91. AC_INCLUDES_DEFAULT
  92. #include <linux/i2c-dev.h>
  93. ])
  94. # Setuid
  95. AC_CHECK_HEADERS([pwd.h])
  96. # Check for chroot support
  97. AC_CHECK_FUNCS([chroot])
  98. AC_CHECK_FUNCS([sleep])
  99. AC_FUNC_ALLOCA
  100. lowllist=
  101. driverlist=
  102. algolist=
  103. optlist=
  104. has_fpga=no
  105. has_asic=no
  106. need_binloader=no
  107. need_dynclock=no
  108. need_gc3355=no
  109. need_linux_i2c_dev=no
  110. need_lowl_vcom=no
  111. need_lowlevel=no
  112. need_lowl_ftdi=no
  113. need_lowl_hid=no
  114. need_lowl_mswin=no
  115. need_lowl_pci=no
  116. need_lowl_spi=no
  117. need_lowl_usb=no
  118. need_knc_asic=no
  119. need_work2d=no
  120. have_cygwin=false
  121. have_win32=false
  122. have_macho=false
  123. use_udevrules=true
  124. have_udevrules=false
  125. AUTOSCAN_CPPFLAGS=""
  126. AUTOSCAN_LIBS=""
  127. DLOPEN_FLAGS="-ldl"
  128. WS2_LIBS=""
  129. MM_LIBS=""
  130. MATH_LIBS="-lm"
  131. RT_LIBS=""
  132. case $target in
  133. amd64-* | x86_64-*)
  134. have_x86_32=false
  135. have_x86_64=true
  136. bitness="64"
  137. ;;
  138. i386-* | i486-* | i586-* | i686-* | x86-*)
  139. have_x86_32=true
  140. have_x86_64=false
  141. bitness="32"
  142. ;;
  143. *)
  144. have_x86_32=false
  145. have_x86_64=false
  146. ;;
  147. esac
  148. case $target in
  149. *-*-mingw*)
  150. have_win32=true
  151. use_udevrules=false
  152. DLOPEN_FLAGS=""
  153. WS2_LIBS="-lws2_32"
  154. MM_LIBS="-lwinmm"
  155. AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support")
  156. AC_DEFINE([FD_SETSIZE], [4096], [Maximum sockets before fd_set overflows])
  157. ;;
  158. *-*-cygwin*)
  159. have_cygwin=true
  160. use_udevrules=false
  161. ;;
  162. powerpc-*-darwin*)
  163. CFLAGS="$CFLAGS -faltivec"
  164. have_macho=true
  165. use_udevrules=false
  166. ;;
  167. *-*-darwin*)
  168. LDFLAGS="$LDFLAGS -framework IOKit -framework CoreFoundation"
  169. have_macho=true
  170. use_udevrules=false
  171. ;;
  172. esac
  173. m4_define([BFG_INCLUDE],
  174. if test "x$2" = "x"; then
  175. $1=''
  176. else
  177. $1="[#]include <$2>"
  178. fi
  179. )
  180. m4_define([BFG_PREPROC_IFELSE],
  181. BFG_INCLUDE([headerinclude], $2)
  182. AC_COMPILE_IFELSE([
  183. AC_LANG_PROGRAM([
  184. ${headerinclude}
  185. ], [
  186. #if !( $1 )
  187. #error "$1 false in preprocessor"
  188. #endif
  189. ])
  190. ],[$3],[$4])
  191. )
  192. m4_define([BFG_FIND_INCLUDE_PATH],[
  193. m4_pushdef([_rel_path],[$1])
  194. m4_pushdef([_header_file],[$2])
  195. m4_pushdef([_iffound],[$3])
  196. m4_pushdef([_ifnotfound],[$4])
  197. m4_pushdef([_includes],[$5])
  198. m4_pushdef([_result_var],[inclpath_[]patsubst(_header_file,[[./]],[_])])
  199. AC_CHECK_HEADER([_rel_path/_header_file],[
  200. AC_MSG_CHECKING([_header_file path])
  201. _result_var=`echo '[#]include <'"_rel_path"'/_header_file>' | ${CPP} -M - 2>/dev/null | ${SED} [-E -e ':a' -e '/\\$/!b b' -e N -e 's/\\\n/ /' -e 't a' -e ':b' -e 's/^[^:]*:[[:space:]]*(([^[:space:]\]|\\.)*[[:space:]])*(([^[:space:]\]|\\.)*)(\\|\\\\|\/)?]patsubst([_header_file],[\.],[\\.])[([[:space:]].*)?$/\3/' -e 't' -e d]`
  202. if test "x$_result_var" = "x"; then
  203. AC_MSG_RESULT([failed])
  204. AC_MSG_ERROR([Couldn't determine include path for _header_file])
  205. else
  206. AC_MSG_RESULT([$_result_var])
  207. _iffound
  208. fi
  209. ],[
  210. true
  211. _ifnotfound
  212. ],[
  213. _includes
  214. ])
  215. m4_popdef([_rel_path],[_header_file],[_iffound],[_ifnotfound],[_result_var])
  216. ])
  217. bfg_enableaction() {
  218. _var=$1
  219. eval "_missingdeps=\"\$${_var}_missingdeps\""
  220. if test -n "$_missingdeps"; then
  221. _enableaction=
  222. for _missingdep in $_missingdeps; do
  223. eval "_howto=\"\$howto_${_missingdep}\""
  224. if test "x$_howto" = "x"; then
  225. eval "_label=\"\${label_${_missingdep}-${_missingdep}}\""
  226. _howto="enable $_label"
  227. fi
  228. if test "$_howto" != "x"; then
  229. _enableaction="$_enableaction; $_howto"
  230. fi
  231. done
  232. _enableaction="${_enableaction:2}"
  233. else
  234. eval "_enableaction=\"\$${_var}_enableaction\""
  235. fi
  236. echo "$_enableaction"
  237. }
  238. dnl _BFG_AUTOITEM(list,driver,DriverName,dependency list,default:no/auto,CodeIfEnabled)
  239. m4_define([_BFG_AUTOITEM],[
  240. m4_pushdef([_list],[$1])
  241. m4_pushdef([_this_drv],m4_default([$2],m4_tolower([$3])))
  242. m4_pushdef([_this_drvuc],m4_toupper(_this_drv))
  243. m4_pushdef([_this_USE],USE_[]_this_drvuc)
  244. m4_pushdef([_this_name],[$3])
  245. m4_pushdef([_deplist],[$4])
  246. m4_pushdef([_this_default],[$5])
  247. m4_pushdef([_this_enablecode],[$6])
  248. m4_case(_list,
  249. [algo],[algolist="$algolist []_this_name/[]_this_USE"],
  250. [driver],[driverlist="$driverlist []_this_drv/[]_this_USE"],
  251. []
  252. )
  253. label_[]_this_drvuc="[]_this_name"
  254. AC_ARG_ENABLE([]_this_drv,
  255. m4_bmatch(_this_default,[.*no$],
  256. AC_HELP_STRING([--enable-[]_this_drv],[Compile support for ]_this_name[ (default disabled)]),
  257. AC_HELP_STRING([--disable-[]_this_drv],[Compile support for ]_this_name[ (default enabled)])),
  258. [[]_this_USE=$enableval],
  259. [[]_this_USE=[]_this_default]
  260. )
  261. []_this_drv[]_opt=
  262. if test "x$[]_this_USE" = "xno"; then
  263. true
  264. else
  265. if test "x$[]_this_USE" = xauto; then
  266. _wasauto=yes
  267. else
  268. _wasauto=no
  269. fi
  270. if test "x$[]_this_USE" != xyes; then
  271. if test "x$[]_this_USE" != xauto; then
  272. []_this_drv[]_opt="$[]_this_USE"
  273. fi
  274. []_this_USE=yes
  275. fi
  276. for __drvdep in []m4_toupper(_deplist); do
  277. eval "_drvdep=\"\$USE_$__drvdep\""
  278. if test "x$_drvdep" != "xyes"; then
  279. []_this_USE[]_missingdeps="$[]_this_USE[]_missingdeps $__drvdep"
  280. []_this_USE=no
  281. fi
  282. done
  283. if test "x$[]_this_USE[]$_wasauto" = xnono; then
  284. _enableaction=`bfg_enableaction []_this_USE`
  285. AC_MSG_ERROR([To enable []_this_name: $_enableaction])
  286. fi
  287. fi
  288. if test "x$[]_this_USE" = "xyes"; then
  289. AC_DEFINE([]_this_USE,[1],[Defined to 1 if []_this_name support is wanted])
  290. []_this_enablecode
  291. fi
  292. AM_CONDITIONAL([]_this_USE,[test x$[]_this_USE = xyes])
  293. m4_popdef([_this_drv],[_this_drvuc],[_this_USE],[_this_name],[_deplist],[_this_default],[_this_enablecode])
  294. ])
  295. dnl BFG_ALGO(AlgoName,default:no/yes,CodeIfEnabled)
  296. m4_define([BFG_ALGO],[
  297. _BFG_AUTOITEM([algo],,[$1],,[$2],[$3])
  298. ])
  299. dnl BFG_DRIVER(driver,DriverName,dependency list,default:no/auto,CodeIfEnabled)
  300. m4_define([BFG_DRIVER],[
  301. _BFG_AUTOITEM([driver],[$1],[$2],[$3],$dd[$4],[$5])
  302. ])
  303. AC_CHECK_DECL([HASH_ITER],[
  304. AC_CHECK_DECL([DL_CONCAT],[
  305. true
  306. ],[
  307. AC_MSG_ERROR([Could not find DL_FOREACH_SAFE - install uthash-dev 1.9.4+])
  308. ],[
  309. #include <utlist.h>
  310. ])
  311. ],[
  312. AC_MSG_ERROR([Could not find HASH_ITER - please install uthash-dev 1.9.4+])
  313. ],[
  314. #include <uthash.h>
  315. ])
  316. ddyes=yes
  317. ddauto=auto
  318. ddno=no
  319. AC_ARG_ENABLE([other-drivers],
  320. [AC_HELP_STRING([--disable-other-drivers],[Build without drivers by default unless explicitly enabled])],
  321. [
  322. if test x$enableval = xyes; then
  323. ddno=yes
  324. else
  325. ddyes=no
  326. ddauto=no
  327. fi
  328. ]
  329. )
  330. broad_udevrules=false
  331. AC_ARG_ENABLE([broad-udevrules],
  332. [AC_HELP_STRING([--enable-broad-udevrules],[Include udev rules for ambiguous devices which may not be miners])],
  333. [
  334. if test "x$enableval" = "xyes"; then
  335. broad_udevrules=true
  336. fi
  337. ]
  338. )
  339. use_udevrules_group=true
  340. udevrules_group="video"
  341. AC_ARG_WITH([udevrules-group],
  342. [AC_HELP_STRING([--with-udevrules-group=groupname],[Configure mining devices to be owned by a specific group (default `video')])],
  343. [
  344. if test "x$withval" = "xno"; then
  345. use_udevrules_group=false
  346. else
  347. udevrules_group="$withval"
  348. fi
  349. ]
  350. )
  351. AM_CONDITIONAL([USE_UDEVRULES_GROUP], [$use_udevrules_group])
  352. AC_SUBST([UDEVRULES_GROUP], [$udevrules_group])
  353. BFG_ALGO(Keccak,no)
  354. BFG_ALGO(SHA256d,yes)
  355. BFG_ALGO(scrypt,no)
  356. lowl_pci=no
  357. if test "x$ac_cv_header_sys_mman_h" = "xyes"; then
  358. AC_ARG_WITH([uio],
  359. [AC_HELP_STRING([--without-uio],[Compile support for PCI devices via Linux UIO interface (default enabled)])],
  360. [uio=$withval],
  361. [uio=yes])
  362. AC_ARG_WITH([vfio],
  363. [AC_HELP_STRING([--without-vfio],[Compile support for PCI devices via Linux VFIO interface (default enabled)])],
  364. [vfio=$withval],
  365. [vfio=auto])
  366. if test "x$vfio" != "xno"; then
  367. AC_CHECK_HEADER([linux/vfio.h],[
  368. vfio=yes
  369. ],[
  370. if test "x$vfio" = "xyes"; then
  371. AC_MSG_ERROR([Unable to find linux/vfio.h])
  372. elif test "x$uio" = "xyes"; then
  373. AC_MSG_WARN([linux/vfio.h not found; PCI device support will require UIO (and root access)])
  374. else
  375. AC_MSG_WARN([linux/vfio.h not found; PCI device support will not be available])
  376. fi
  377. vfio=no
  378. ])
  379. fi
  380. if test "x$vfio$uio" != xnono; then
  381. lowl_pci=yes
  382. fi
  383. fi
  384. BFG_DRIVER(cpumining,CPU mining,,no,[
  385. driverlist="$driverlist cpu:asm/has_yasm"
  386. driverlist="$driverlist cpu:sse2/have_sse2"
  387. ])
  388. driverlist=`echo "${driverlist}" | ${SED} -e 's/ cpumining/ cpu/'`
  389. BFG_DRIVER(,OpenCL,,no)
  390. m4_define([BFG_PTHREAD_FLAG_CHECK],
  391. AC_MSG_CHECKING([for $1])
  392. for cflag in ' -pthread' ''; do
  393. for lib in ' -lpthread' ' -lwinpthread' ''; do
  394. CFLAGS="${save_CFLAGS}${cflag}"
  395. LIBS="${save_LIBS}${lib}"
  396. AC_LINK_IFELSE([
  397. AC_LANG_PROGRAM([
  398. #include <pthread.h>
  399. ], [
  400. void *f = $1;
  401. ])
  402. ], [
  403. found_pthread=true
  404. PTHREAD_FLAGS="${cflag}"
  405. PTHREAD_LIBS="${lib}"
  406. if test "x${cflag}${lib}" = "x"; then
  407. AC_MSG_RESULT([yes])
  408. else
  409. AC_MSG_RESULT([with${cflag}${lib}])
  410. fi
  411. $2
  412. break 2
  413. ])
  414. done
  415. done
  416. if test "x${found_pthread}" = "xfalse"; then
  417. AC_MSG_RESULT([no])
  418. fi
  419. )
  420. save_CFLAGS="${CFLAGS}"
  421. save_LIBS="${LIBS}"
  422. found_pthread=false
  423. BFG_PTHREAD_FLAG_CHECK([pthread_cancel],[
  424. AC_DEFINE([HAVE_PTHREAD_CANCEL], [1], [Define if you have a native pthread_cancel])
  425. ])
  426. if test "x${found_pthread}" = "xfalse"; then
  427. BFG_PTHREAD_FLAG_CHECK([pthread_create])
  428. if test "x${found_pthread}" = "xfalse"; then
  429. AC_MSG_ERROR([Could not find pthread library - please install libpthread])
  430. fi
  431. fi
  432. # check for nanosleep here, since it is provided by winpthread
  433. AC_CHECK_FUNCS([nanosleep])
  434. CFLAGS="${save_CFLAGS}"
  435. LIBS="${save_LIBS}"
  436. PKG_CHECK_MODULES([JANSSON],[jansson],[
  437. true
  438. ],[
  439. AC_MSG_CHECKING([for jansson in system-default locations])
  440. LIBS="$LIBS -ljansson"
  441. AC_TRY_LINK([
  442. #include <jansson.h>
  443. ],[
  444. json_object();
  445. ],[
  446. AC_MSG_RESULT([found])
  447. JANSSON_LIBS=-ljansson
  448. ],[
  449. AC_MSG_RESULT([not found])
  450. AC_MSG_ERROR([Could not find jansson library])
  451. ])
  452. LIBS="${save_LIBS}"
  453. ])
  454. AC_SUBST(JANSSON_CFLAGS)
  455. AC_SUBST(JANSSON_LIBS)
  456. if test "x$USE_OPENCL" = xyes; then
  457. adl="yes"
  458. if test "x$USE_KECCAK" = xyes; then
  459. AC_DEFINE([USE_OPENCL_FULLHEADER],[1],[Defined to 1 if OpenCL fullheader kernel interface is wanted])
  460. fi
  461. driverlist="$driverlist opencl:sensors/with_sensors"
  462. AC_ARG_WITH([sensors],
  463. [AC_HELP_STRING([--without-sensors],[Build with libsensors monitoring (default enabled)])],
  464. [true],[with_sensors=auto])
  465. if test "x$USE_OPENCL" != xyes; then
  466. with_sensors=no
  467. fi
  468. if test "x$with_sensors" != xno; then
  469. AC_MSG_CHECKING([for libsensors])
  470. save_LIBS="${LIBS}"
  471. LIBS="$LIBS -lsensors"
  472. AC_LINK_IFELSE([AC_LANG_PROGRAM([
  473. #include <stddef.h>
  474. #include <sensors/sensors.h>
  475. ],[
  476. const sensors_chip_name *cn;
  477. cn = sensors_get_detected_chips(NULL, NULL);
  478. ])],[
  479. with_sensors=yes
  480. sensors_LIBS="-lsensors"
  481. AC_DEFINE([HAVE_SENSORS], [1], [Defined if libsensors was found])
  482. AC_MSG_RESULT([yes])
  483. ],[
  484. with_sensors=no
  485. AC_MSG_RESULT([no])
  486. if ! $have_win32; then
  487. with_sensors_enableaction="install libsensors"
  488. fi
  489. ])
  490. LIBS="$save_LIBS"
  491. fi
  492. AC_SUBST(sensors_LIBS)
  493. driverlist="$driverlist opencl:adl/adl"
  494. AC_ARG_ENABLE([adl],
  495. [AC_HELP_STRING([--disable-adl],[Build without ADL monitoring (default enabled)])],
  496. [adl=$enableval]
  497. )
  498. if test x$adl = xyes
  499. then
  500. AC_DEFINE([HAVE_ADL], [1], [Defined if ADL headers were found])
  501. fi
  502. else
  503. adl="no"
  504. fi
  505. BFG_DRIVER(,AlcheMist,scrypt,no,[
  506. need_lowl_vcom=yes
  507. has_asic=yes
  508. ])
  509. BFG_DRIVER(,BitForce,SHA256d,auto,[
  510. driverlist="$driverlist bitforce:pci/need_lowl_pci"
  511. if test "x$lowl_pci" = "xyes"; then
  512. need_lowl_pci=yes
  513. fi
  514. need_lowl_vcom=yes
  515. driverlist="$driverlist bitforce:mswin/need_lowl_mswin"
  516. if test x$have_win32 = xtrue; then
  517. need_lowl_mswin=yes
  518. fi
  519. has_fpga=yes
  520. has_asic=yes
  521. have_udevrules=true
  522. ])
  523. BFG_DRIVER(bitmain,Bitmain Antminer S* series,SHA256d,no,[
  524. need_lowl_vcom=yes
  525. has_asic=yes
  526. ])
  527. BFG_DRIVER(,FutureBit,scrypt,no,[
  528. need_lowl_vcom=yes
  529. has_asic=yes
  530. ])
  531. BFG_DRIVER(,Icarus,SHA256d,auto,[
  532. need_dynclock=yes
  533. need_lowl_vcom=yes
  534. has_fpga=yes
  535. has_asic=yes
  536. have_udevrules=true
  537. ])
  538. driverlist="$driverlist cairnsmore/USE_ICARUS erupter/USE_ICARUS antminer/USE_ICARUS compac/USE_ICARUS"
  539. BFG_DRIVER(,DualMiner,Icarus,auto,[
  540. need_gc3355=yes
  541. $broad_udevrules && have_udevrules=true
  542. ])
  543. BFG_DRIVER(,ZeusMiner,scrypt Icarus,auto,[
  544. need_lowl_vcom=yes
  545. has_asic=yes
  546. $broad_udevrules && have_udevrules=true
  547. ])
  548. BFG_DRIVER(,GridSeed,scrypt,auto,[
  549. need_gc3355=yes
  550. need_lowl_vcom=yes
  551. has_asic=yes
  552. $broad_udevrules && have_udevrules=true
  553. ])
  554. BFG_DRIVER(,Avalon,SHA256d,auto,[
  555. need_lowl_vcom=yes
  556. has_asic=yes
  557. $broad_udevrules && have_udevrules=true
  558. ])
  559. BFG_DRIVER(avalonmm,Avalon2/3,SHA256d,auto,[
  560. need_lowl_vcom=yes
  561. need_work2d=yes
  562. has_asic=yes
  563. $broad_udevrules && have_udevrules=true
  564. ])
  565. BFG_DRIVER(,KnC,SHA256d,no,[
  566. need_linux_i2c_dev=yes
  567. need_lowl_spi=yes
  568. ])
  569. BFG_DRIVER(kncasic,KnC gen 2,SHA256d,no,[
  570. kncasic_controller="$kncasic_opt"
  571. if test "x$kncasic_opt" = "x"; then
  572. kncasic_controller=BBB
  573. fi
  574. need_knc_asic=yes
  575. AC_DEFINE_UNQUOTED([CONTROLLER_BOARD_$kncasic_controller],[1])
  576. ])
  577. AC_ARG_WITH([libmicrohttpd],
  578. [AC_HELP_STRING([--without-libmicrohttpd],[Compile support for libmicrohttpd getwork server (default enabled)])],
  579. [httpsrv=$withval],
  580. [httpsrv=$ddauto]
  581. )
  582. if test "x$httpsrv" != "xno"; then
  583. PKG_CHECK_MODULES([libmicrohttpd],[libmicrohttpd >= 0.9.5],[
  584. AC_DEFINE([USE_LIBMICROHTTPD],[1],[Defined to 1 if libmicrohttpd support is wanted])
  585. httpsrv=yes
  586. ],[
  587. httpsrv=no
  588. httpsrv_enableaction="install libmicrohttpd 0.9.5+"
  589. need_bfg_driver_proxy_enableaction="install libmicrohttpd 0.9.5+"
  590. if test "x$httpsrv" = "xyes"; then
  591. AC_MSG_ERROR([Unable to find libmicrohttpd 0.9.5+])
  592. else
  593. AC_MSG_WARN([libmicrohttpd 0.9.5+ not found; getwork proxy will be unavailable])
  594. fi
  595. ])
  596. fi
  597. AM_CONDITIONAL([USE_LIBMICROHTTPD], [test x$httpsrv = xyes])
  598. AC_ARG_WITH([libevent],
  599. [AC_HELP_STRING([--without-libevent],[Compile support for libevent stratum server (default enabled)])],
  600. [libevent=$withval],
  601. [libevent=$ddauto]
  602. )
  603. if test "x$libevent" != "xno"; then
  604. PKG_CHECK_MODULES([libevent],[libevent >= 2.0.3],[
  605. PKG_CHECK_MODULES([libevent_pthreads],[libevent_pthreads],[
  606. libevent_CFLAGS="${libevent_CFLAGS} ${libevent_pthreads_CFLAGS}"
  607. libevent_LIBS="${libevent_LIBS} ${libevent_pthreads_LIBS}"
  608. ],[true])
  609. AC_MSG_CHECKING([if libevent supports threading])
  610. BFG_PREPROC_IFELSE([EVTHREAD_USE_PTHREADS_IMPLEMENTED || EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED],[event2/thread.h],[
  611. AC_MSG_RESULT([yes])
  612. have_libevent=yes
  613. ],[
  614. AC_MSG_RESULT([no])
  615. ])
  616. ])
  617. if test "x$have_libevent" = "xyes"; then
  618. libevent=yes
  619. need_work2d=yes
  620. AC_DEFINE([USE_LIBEVENT],[1],[Defined to 1 if libevent support is wanted])
  621. else
  622. libevent_enableaction="install libevent 2.0.3+"
  623. if test -n "$need_bfg_driver_proxy_enableaction"; then
  624. need_bfg_driver_proxy_enableaction="${need_bfg_driver_proxy_enableaction} (getwork) or libevent 2.0.3+ (stratum)"
  625. else
  626. need_bfg_driver_proxy_enableaction="install libevent 2.0.3+"
  627. fi
  628. if test "x$libevent" = "xyes"; then
  629. AC_MSG_ERROR([Unable to find libevent 2.0.3+])
  630. else
  631. AC_MSG_WARN([libevent 2.0.3+ not found; stratum proxy will be unavailable])
  632. fi
  633. libevent=no
  634. fi
  635. fi
  636. AM_CONDITIONAL([USE_LIBEVENT], [test x$libevent = xyes])
  637. driverlist="$driverlist proxy/need_bfg_driver_proxy"
  638. if test x$libevent$httpsrv = xnono; then
  639. need_bfg_driver_proxy=no
  640. else
  641. need_bfg_driver_proxy=yes
  642. driverlist="$driverlist proxy:getwork/httpsrv proxy:stratum/libevent"
  643. fi
  644. AM_CONDITIONAL([NEED_BFG_DRIVER_PROXY], [test x$libevent$httpsrv != xnono])
  645. BFG_DRIVER(,ModMiner,SHA256d,auto,[
  646. need_dynclock=yes
  647. need_lowl_vcom=yes
  648. need_binloader=yes
  649. has_fpga=yes
  650. have_udevrules=true
  651. ])
  652. PKG_PROG_PKG_CONFIG()
  653. label_LIBUSB=libusb
  654. USE_LIBUSB=no
  655. libusb_include_path=""
  656. AC_ARG_WITH([libusb],
  657. [AC_HELP_STRING([--without-libusb],[Compile using libusb (default enabled)])],
  658. [want_libusb=$withval],
  659. [want_libusb=auto]
  660. )
  661. if test "x$want_libusb" != "xno"; then
  662. howto_LIBUSB="install libusb 1.0+"
  663. PKG_CHECK_MODULES([LIBUSB], [libusb-1.0],[
  664. USE_LIBUSB=yes
  665. ],[
  666. for usb_lib in usb-1.0 usb; do
  667. AC_CHECK_LIB($usb_lib, libusb_init, [
  668. USE_LIBUSB=yes
  669. break
  670. ])
  671. done
  672. if test "x$USE_LIBUSB" = xyes; then
  673. AC_CHECK_DECL([libusb_init],[
  674. LIBUSB_LIBS="-l$usb_lib"
  675. ],[
  676. BFG_FIND_INCLUDE_PATH([libusb-1.0],[libusb.h],[
  677. LIBUSB_LIBS="-l$usb_lib"
  678. LIBUSB_CFLAGS="-I${inclpath_libusb_h}"
  679. ],[
  680. USE_LIBUSB=no
  681. ])
  682. ],[#include <libusb.h>])
  683. fi
  684. ])
  685. fi
  686. BFG_DRIVER(,CoinTerra,SHA256d libusb,auto,[
  687. need_lowl_usb=yes
  688. has_asic=yes
  689. have_udevrules=true
  690. ])
  691. BFG_DRIVER(,Klondike,SHA256d libusb,auto,[
  692. need_lowl_usb=yes
  693. has_asic=yes
  694. have_udevrules=true
  695. ])
  696. BFG_DRIVER(titan,KnC Titan,scrypt,no,[
  697. if test "x$titan_opt" = "x"; then
  698. if test "x$USE_KNCASIC" = "xyes"; then
  699. titan_controller="$kncasic_controller"
  700. else
  701. titan_controller=RPI
  702. fi
  703. else
  704. titan_controller=$titan_opt
  705. if test "x$USE_KNCASIC" = "xyes"; then
  706. if test "x$kncasic_controller" != "$titan_controller"; then
  707. AC_MSG_ERROR([Can only build kncasic and titan drivers together for the same controller (kncasic=$kncasic_controller vs titan=$titan_controller)])
  708. fi
  709. fi
  710. fi
  711. need_knc_asic=yes
  712. AC_DEFINE_UNQUOTED([CONTROLLER_BOARD_$titan_controller],[1])
  713. AH_TEMPLATE([CONTROLLER_BOARD_BACKPLANE])
  714. AH_TEMPLATE([CONTROLLER_BOARD_BBB])
  715. AH_TEMPLATE([CONTROLLER_BOARD_RPI])
  716. ])
  717. BFG_DRIVER(,X6500,SHA256d libusb,auto,[
  718. need_dynclock=yes
  719. need_lowl_ftdi=yes
  720. need_binloader=yes
  721. has_fpga=yes
  722. have_udevrules=true
  723. ])
  724. BFG_DRIVER(,ZTEX,SHA256d libusb,auto,[
  725. need_dynclock=yes
  726. need_lowl_usb=yes
  727. need_binloader=yes
  728. has_fpga=yes
  729. have_udevrules=true
  730. ])
  731. BFG_DRIVER(bifury,Bi*Fury,SHA256d,auto,[
  732. need_lowl_vcom=yes
  733. has_asic=yes
  734. have_udevrules=true
  735. ])
  736. BFG_DRIVER(,Bitfury,SHA256d,auto,[
  737. need_lowl_spi=yes
  738. ])
  739. BFG_DRIVER(,BFSB,SHA256d Bitfury,no)
  740. BFG_DRIVER(bigpic,Big Picture Mining USB,SHA256d Bitfury,auto,[
  741. need_lowl_vcom=yes
  742. has_asic=yes
  743. have_udevrules=true
  744. ])
  745. BFG_DRIVER(bfx,BFx2,SHA256d libusb Bitfury,auto,[
  746. need_lowl_ftdi=yes
  747. has_asic=yes
  748. $broad_udevrules && have_udevrules=true
  749. ])
  750. BFG_DRIVER(,DrillBit,SHA256d Bitfury,auto,[
  751. need_lowl_vcom=yes
  752. has_asic=yes
  753. have_udevrules=true
  754. ])
  755. BFG_DRIVER(,Twinfury,SHA256d Bitfury,auto,[
  756. need_lowl_vcom=yes
  757. has_asic=yes
  758. have_udevrules=true
  759. ])
  760. BFG_DRIVER(,LittleFury,SHA256d Bitfury,auto,[
  761. need_lowl_vcom=yes
  762. has_asic=yes
  763. have_udevrules=true
  764. ])
  765. label_HIDAPI=hidapi
  766. howto_HIDAPI="install hidapi"
  767. USE_HIDAPI=no
  768. for _hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
  769. PKG_CHECK_MODULES([hidapi],[$_hidapi_lib],[
  770. USE_HIDAPI=yes
  771. break
  772. ],[
  773. true
  774. ])
  775. done
  776. BFG_DRIVER(,NanoFury,SHA256d hidapi Bitfury,auto,[
  777. need_lowl_hid=yes
  778. has_asic=yes
  779. have_udevrules=true
  780. ])
  781. BFG_DRIVER(hashbuster,HashBuster Nano,SHA256d hidapi Bitfury,auto,[
  782. need_lowl_hid=yes
  783. has_asic=yes
  784. have_udevrules=true
  785. ])
  786. BFG_DRIVER(hashbusterusb,HashBuster Micro,SHA256d libusb Bitfury,auto,[
  787. need_lowl_usb=yes
  788. has_asic=yes
  789. have_udevrules=true
  790. ])
  791. BFG_DRIVER(,HashFast,SHA256d,auto,[
  792. need_lowl_vcom=yes
  793. has_asic=yes
  794. have_udevrules=true
  795. ])
  796. BFG_DRIVER(,JingTian,SHA256d,no,[
  797. need_lowl_spi=yes
  798. has_asic=yes
  799. ])
  800. BFG_DRIVER(,Metabank,SHA256d Bitfury,no)
  801. BFG_DRIVER(minergate,Spondoolies minergate interface,SHA256d,no,[
  802. need_lowlevel=yes
  803. has_asic=yes
  804. ])
  805. BFG_DRIVER(,Minion,SHA256d,no,[
  806. need_lowl_spi=yes
  807. has_asic=yes
  808. ])
  809. BFG_DRIVER(,RockMiner,SHA256d,auto,[
  810. need_lowl_vcom=yes
  811. has_asic=yes
  812. have_udevrules=true
  813. ])
  814. if test "x$need_lowl_vcom" != "xno"; then
  815. # Lowlevel VCOM doesn't need libusb, but it can take advantage of it to reattach drivers
  816. if test "x$USE_LIBUSB" != xno; then
  817. need_lowl_usb=yes
  818. elif test "x$USE_LIBUSB$want_libusb" = xnoyes; then
  819. AC_MSG_ERROR([Could not find libusb, which you specifically requested])
  820. fi
  821. fi
  822. lowllist="$lowllist ftdi/need_lowl_ftdi"
  823. if test x$need_lowl_ftdi = xyes; then
  824. AC_DEFINE([NEED_BFG_LOWL_FTDI], [1], [Defined to 1 if lowlevel ftdi drivers are being used])
  825. need_lowl_usb=yes
  826. fi
  827. lowllist="$lowllist spi/need_lowl_spi"
  828. if test x$need_lowl_spi = xyes; then
  829. AC_DEFINE([NEED_BFG_LOWL_SPI], [1], [Defined to 1 if lowlevel SPI drivers are being used])
  830. fi
  831. if test "x$need_lowl_usb" = "xno"; then
  832. USE_LIBUSB=no
  833. LIBUSB_LIBS=''
  834. LIBUSB_CFLAGS=''
  835. fi
  836. if test "x$USE_LIBUSB" = xyes; then
  837. AC_DEFINE([HAVE_LIBUSB], [1], [Define if you have libusb-1.0])
  838. save_CFLAGS="$CFLAGS"
  839. CFLAGS="$LIBUSB_CFLAGS $CFLAGS"
  840. AC_CHECK_DECLS([libusb_error_name],[true],[true],[#include <libusb.h>])
  841. CFLAGS="$save_CFLAGS"
  842. fi
  843. if test x$need_lowl_vcom = xyes; then
  844. AC_DEFINE([NEED_BFG_LOWL_VCOM], [1], [Defined to 1 if lowlevel VCOM drivers are being used])
  845. need_lowlevel=yes
  846. if $have_win32; then
  847. echo '#include <iospeeds.h>' >iospeeds_local.h
  848. found_ddkusb=false
  849. AC_CHECK_HEADER([usbiodef.h],[
  850. found_ddkusb=true
  851. ],[
  852. BFG_FIND_INCLUDE_PATH([ddk],[usbiodef.h],[
  853. found_ddkusb=true
  854. AUTOSCAN_CPPFLAGS="-I${inclpath_usbiodef_h}"
  855. ],[],[
  856. #include <windows.h>
  857. #include <ddk/usbioctl.h>
  858. AC_INCLUDES_DEFAULT
  859. ])
  860. ],[
  861. #include <windows.h>
  862. #include <usbioctl.h>
  863. AC_INCLUDES_DEFAULT
  864. ])
  865. if $found_ddkusb; then
  866. AUTOSCAN_LIBS="-lsetupapi"
  867. AC_DEFINE([HAVE_WIN_DDKUSB],[1],[Defined to 1 if Windows DDK USB headers are being used])
  868. fi
  869. else
  870. AC_MSG_CHECKING([what baud rates your system supports])
  871. echo '#include <termios.h>' | ${CPP} -dM - 2>/dev/null | ${SED} 's/.*[ ]B\([0-9][0-9]*\)[ ].*/IOSPEED(\1)/' | grep IOSPEED >iospeeds_local.h
  872. if grep -q IOSPEED iospeeds_local.h; then
  873. AC_MSG_RESULT([done])
  874. else
  875. AC_MSG_RESULT([failed, using standard POSIX])
  876. echo '#include <iospeeds_posix.h>' >iospeeds_local.h
  877. fi
  878. fi
  879. fi
  880. if test "x$USE_OPENCL$need_lowl_hid" = xnono; then
  881. DLOPEN_FLAGS=""
  882. fi
  883. lowllist="$lowllist hid/need_lowl_hid"
  884. if test x$need_lowl_hid = xyes; then
  885. AC_DEFINE([NEED_BFG_LOWL_HID], [1], [Defined to 1 if lowlevel hid drivers are being used])
  886. need_lowlevel=yes
  887. fi
  888. lowllist="$lowllist mswin/need_lowl_mswin"
  889. if test x$need_lowl_mswin = xyes; then
  890. AC_DEFINE([NEED_BFG_LOWL_MSWIN], [1], [Defined to 1 if lowlevel mswin drivers are being used])
  891. need_lowlevel=yes
  892. fi
  893. lowllist="$lowllist pci/need_lowl_pci"
  894. if test x$need_lowl_pci = xyes; then
  895. AC_DEFINE([NEED_BFG_LOWL_PCI], [1], [Defined to 1 if lowlevel PCI drivers are being used])
  896. need_lowlevel=yes
  897. lowllist="$lowllist pci:uio/uio"
  898. if test x$uio = xyes; then
  899. AC_DEFINE([USE_UIO], [1], [Defined to 1 if lowlevel PCI drivers should support UIO])
  900. fi
  901. lowllist="$lowllist pci:vfio/vfio"
  902. if test x$vfio = xyes; then
  903. AC_DEFINE([USE_VFIO], [1], [Defined to 1 if lowlevel PCI drivers should support VFIO])
  904. fi
  905. fi
  906. AM_CONDITIONAL([USE_VFIO], [test x$need_lowl_pci$vfio = xyesyes])
  907. lowllist="$lowllist usb/need_lowl_usb"
  908. if test x$need_lowl_usb = xyes; then
  909. need_lowlevel=yes
  910. fi
  911. lowllist="$lowllist vcom/need_lowl_vcom"
  912. if test x$need_lowl_vcom = xyes; then
  913. need_lowlevel=yes
  914. fi
  915. if test x$need_lowlevel = xyes; then
  916. AC_DEFINE([HAVE_BFG_LOWLEVEL], [1], [Defined to 1 if lowlevel drivers are being used])
  917. fi
  918. if test x$need_linux_i2c_dev = xyes; then
  919. AC_CHECK_HEADERS([linux/i2c-dev-user.h])
  920. AC_CHECK_DECL([i2c_smbus_read_word_data],[true],[
  921. AC_MSG_ERROR([linux/i2c-dev.h header from i2c-tools/libi2c-dev (NOT linux headers) is required for KnCMiner drivers])
  922. ],[
  923. #include <stddef.h>
  924. #ifdef HAVE_LINUX_I2C_DEV_USER_H
  925. #include <linux/i2c-dev-user.h>
  926. #else
  927. #ifdef NEED_LINUX_I2C_H
  928. #include <linux/i2c.h>
  929. #endif
  930. #include <linux/i2c-dev.h>
  931. #endif
  932. ])
  933. fi
  934. curses="auto"
  935. AC_ARG_WITH([curses],
  936. [AC_HELP_STRING([--without-curses],[Compile support for curses TUI (default enabled)])],
  937. [curses=$withval]
  938. )
  939. if test "x$curses" = "xno"; then
  940. optlist="$optlist curses"
  941. else
  942. curses_enableaction="install a curses library"
  943. orig_libs="$LIBS"
  944. if test "x${curses}" = "xyes"; then
  945. preferl=''
  946. else
  947. preferl="${curses} ${curses}6 ${curses}5"
  948. fi
  949. for wideornot in w u ''; do
  950. for ncursesver in '' 6 5; do
  951. preferl="${preferl} ncurses${wideornot}${ncursesver}"
  952. done
  953. preferl="${preferl} pdcurses${wideornot}"
  954. done
  955. if test "x$cross_compiling" != "xyes"; then
  956. AC_MSG_CHECKING([for best native curses library])
  957. orig_cflags="$CFLAGS"
  958. for curses_lib in ${preferl}; do
  959. if ! ${curses_lib}-config --cflags >/dev/null 2>/dev/null; then
  960. continue
  961. fi
  962. CFLAGS="$orig_cflags $(${curses_lib}-config --cflags)"
  963. LIBS="$orig_libs $(${curses_lib}-config --libs)"
  964. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  965. #include <curses.h>
  966. ]], [[
  967. WINDOW *w = NULL;
  968. mvwprintw(w, 2, 2, "Testing %s", "o hai");
  969. ]])], [
  970. curses=yes
  971. optlist="$optlist ${curses_lib}/curses"
  972. AC_MSG_RESULT([$curses_lib])
  973. NCURSES_LIBS=`${curses_lib}-config --libs`
  974. NCURSES_CPPFLAGS=`${curses_lib}-config --cflags`
  975. break
  976. ], [
  977. AC_MSG_WARN([${curses_lib} doesn't seem to be installed properly])
  978. ])
  979. done
  980. CFLAGS="$orig_cflags"
  981. if test "x$curses" != "xyes"; then
  982. AC_MSG_RESULT([none?])
  983. fi
  984. fi
  985. if test "x$curses" != "xyes"; then
  986. sym=addstr
  987. AC_SEARCH_LIBS(${sym}, ${preferl}, [
  988. curses=yes
  989. eval "curseslib=\"\${ac_cv_search_${sym}}\""
  990. barelib=`echo "${curseslib}" | ${SED} -e 's/-l//'`
  991. optlist="$optlist ${barelib}/curses"
  992. if test "x${curseslib}" != "xnone required"; then
  993. NCURSES_LIBS="${curseslib}"
  994. fi
  995. # Need to check for headers in subdirectories, to ensure we get wide stuff
  996. barelib=`echo "${barelib}" | ${SED} -e 's/6//'`
  997. barelib=`echo "${barelib}" | ${SED} -e 's/5//'`
  998. BFG_FIND_INCLUDE_PATH([${barelib}],[curses.h],[
  999. NCURSES_CPPFLAGS="-I${inclpath_curses_h}"
  1000. ])
  1001. break
  1002. ], [
  1003. if test "x$curses" = "xyes"; then
  1004. AC_MSG_ERROR([Could not find curses library - please install libncurses-dev or pdcurses-dev (or configure --without-curses)])
  1005. else
  1006. AC_MSG_WARN([Could not find curses library - if you want a TUI, install libncurses-dev or pdcurses-dev])
  1007. curses=no
  1008. optlist="$optlist curses"
  1009. fi
  1010. ])
  1011. fi
  1012. if test "x$curses" = "xyes"; then
  1013. AC_DEFINE([HAVE_CURSES], [1], [Defined to 1 if curses TUI support is wanted])
  1014. AC_MSG_CHECKING([whether curses library supports wide characters])
  1015. orig_cflags="$CFLAGS"
  1016. CFLAGS="$orig_cflags $NCURSES_CPPFLAGS"
  1017. LIBS="$orig_libs $NCURSES_LIBS"
  1018. AC_LINK_IFELSE([
  1019. AC_LANG_PROGRAM([
  1020. #define PDC_WIDE
  1021. #include <curses.h>
  1022. ],[
  1023. addwstr(L"test");
  1024. add_wch(WACS_VLINE);
  1025. ])
  1026. ],[
  1027. AC_MSG_RESULT([yes])
  1028. AC_DEFINE([USE_UNICODE],[1],[Defined to 1 if curses supports wide characters])
  1029. ],[
  1030. AC_MSG_RESULT([no])
  1031. ])
  1032. CFLAGS="$orig_cflags"
  1033. fi
  1034. LIBS="$orig_libs"
  1035. fi
  1036. BFG_BUNDLED_LIB([libbase58],[libbase58],[auto],[libbase58],[base58],[],[--disable-tool --disable-static --enable-shared])
  1037. BFG_BUNDLED_LIB([libblkmaker],[libblkmaker_jansson-0.1],[no],[libblkmaker],[blkmaker_jansson-0.1 blkmaker-0.1],[libbase58])
  1038. $have_udevrules || use_udevrules=false
  1039. if $use_udevrules; then
  1040. AC_ARG_WITH([udevrulesdir],
  1041. AS_HELP_STRING([--with-udevrulesdir=DIR], [Install udev rules into this directory]),
  1042. [], [
  1043. if test -d /lib/udev/rules.d; then
  1044. with_udevrulesdir=/lib/udev/rules.d
  1045. else
  1046. with_udevrulesdir=no
  1047. fi
  1048. ]
  1049. )
  1050. if test "x$with_udevrulesdir" = "xno"; then
  1051. use_udevrules=false
  1052. fi
  1053. if $use_udevrules; then
  1054. AC_SUBST([udevrulesdir], [$with_udevrulesdir])
  1055. fi
  1056. fi
  1057. AM_CONDITIONAL([NEED_BFG_BINLOADER], [test x$need_binloader = xyes])
  1058. AM_CONDITIONAL([NEED_DYNCLOCK], [test x$need_dynclock = xyes])
  1059. AM_CONDITIONAL([USE_GC3355], [test x$need_gc3355 = xyes])
  1060. AM_CONDITIONAL([NEED_BFG_LOWL_VCOM], [test x$need_lowl_vcom = xyes])
  1061. AM_CONDITIONAL([NEED_BFG_LOWL_FTDI], [test x$need_lowl_ftdi = xyes])
  1062. AM_CONDITIONAL([NEED_BFG_LOWL_HID], [test x$need_lowl_hid = xyes])
  1063. AM_CONDITIONAL([NEED_BFG_LOWL_MSWIN], [test x$need_lowl_mswin = xyes])
  1064. AM_CONDITIONAL([NEED_BFG_LOWL_PCI], [test x$need_lowl_pci = xyes])
  1065. AM_CONDITIONAL([NEED_BFG_LOWL_SPI], [test x$need_lowl_spi = xyes])
  1066. AM_CONDITIONAL([NEED_BFG_LOWLEVEL], [test x$need_lowlevel = xyes])
  1067. AM_CONDITIONAL([NEED_BFG_WORK2D], [test x$need_work2d = xyes])
  1068. AM_CONDITIONAL([NEED_KNC_ASIC], [test x$need_knc_asic = xyes])
  1069. AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
  1070. AM_CONDITIONAL([HAVE_SENSORS], [test x$with_sensors = xyes])
  1071. AM_CONDITIONAL([HAVE_CYGWIN], [test x$have_cygwin = xtrue])
  1072. AM_CONDITIONAL([HAVE_LIBUSB], [test x$USE_LIBUSB = xyes])
  1073. AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
  1074. AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
  1075. AM_CONDITIONAL([HAVE_WIN_DDKUSB], [test x$found_ddkusb = xtrue])
  1076. AM_CONDITIONAL([HAS_FPGA], [test x$has_fpga != xno])
  1077. AM_CONDITIONAL([HAS_ASIC], [test x$has_asic != xno])
  1078. AM_CONDITIONAL([USE_UDEVRULES], [$use_udevrules])
  1079. AM_CONDITIONAL([BROAD_UDEVRULES], [$broad_udevrules])
  1080. dnl Find YASM
  1081. has_yasm=false
  1082. if test "x$have_x86_32$have_x86_64" != "xfalsefalse"; then
  1083. AC_PATH_PROG([YASM],[yasm],[false])
  1084. if test "x$YASM" != "xfalse" ; then
  1085. has_yasm_enableaction="install yasm 1.0.1+"
  1086. AC_MSG_CHECKING([if yasm version is greater than 1.0.1])
  1087. yasmver=`"$YASM" --version | head -1 | cut -d\ -f2`
  1088. yamajor=`echo $yasmver | cut -d. -f1`
  1089. yaminor=`echo $yasmver | cut -d. -f2`
  1090. yamini=`echo $yasmver | cut -d. -f3`
  1091. if test "$yamajor" -ge "1" ; then
  1092. if test "$yamajor" -eq "1" ; then
  1093. if test "$yaminor" -ge "0" ; then
  1094. if test "$yaminor" -eq "0"; then
  1095. if test "$yamini" -ge "1"; then
  1096. has_yasm=true
  1097. fi
  1098. else
  1099. has_yasm=true
  1100. fi
  1101. fi
  1102. fi
  1103. else
  1104. has_yasm=false
  1105. fi
  1106. if test "x$has_yasm" = "xtrue" ; then
  1107. AC_MSG_RESULT([yes])
  1108. else
  1109. AC_MSG_RESULT([no])
  1110. fi
  1111. fi
  1112. if test "x$has_yasm" = "xfalse" ; then
  1113. AC_MSG_NOTICE([yasm is required for the assembly algorithms. They will be skipped.])
  1114. else
  1115. AC_DEFINE([HAVE_YASM], [1], [Defined to 1 if yasm is being used])
  1116. if test "x$have_win32$have_cygwin" != "xfalsefalse"; then
  1117. if test "x$have_x86_64" = xtrue; then
  1118. YASM_FMT="win64"
  1119. else
  1120. YASM_FMT="coff"
  1121. fi
  1122. elif test "x$have_macho" = "xtrue"; then
  1123. YASM_FMT="macho$bitness"
  1124. else
  1125. YASM_FMT="elf$bitness"
  1126. fi
  1127. fi
  1128. fi
  1129. AM_CONDITIONAL([HAS_YASM], [test x$has_yasm = xtrue])
  1130. have_sse2=no
  1131. if test "x$USE_CPUMINING$have_x86_32" = "xyestrue"; then
  1132. AC_MSG_CHECKING([if SSE2 code compiles])
  1133. save_CFLAGS="$CFLAGS"
  1134. for flags in '' '-msse2'; do
  1135. CFLAGS="$CFLAGS $flags"
  1136. AC_TRY_LINK([
  1137. #include <xmmintrin.h>
  1138. ],[
  1139. int *i = (int *)0xdeadbeef;
  1140. __m128i a, b;
  1141. a = _mm_set1_epi32(i[0]);
  1142. b = _mm_set_epi32(i[0], i[1], i[2], i[3]);
  1143. a = _mm_add_epi32(a, b);
  1144. a = _mm_andnot_si128(a, b);
  1145. a = _mm_or_si128(a, b);
  1146. a = _mm_slli_epi32(a, i[4]);
  1147. a = _mm_and_si128(a, b);
  1148. a = _mm_xor_si128(a, b);
  1149. ],[
  1150. if test "x$flags" = "x"; then
  1151. AC_MSG_RESULT([yes])
  1152. else
  1153. AC_MSG_RESULT([with $flags])
  1154. fi
  1155. SSE2_CFLAGS="$flags"
  1156. have_sse2=yes
  1157. break
  1158. ],[
  1159. true
  1160. ])
  1161. done
  1162. CFLAGS="${save_CFLAGS}"
  1163. if test "x$have_sse2" = "xyes"; then
  1164. AC_DEFINE([HAVE_SSE2], [1], [Defined to 1 if yasm is being used])
  1165. else
  1166. AC_MSG_RESULT([no])
  1167. fi
  1168. fi
  1169. AM_CONDITIONAL([HAVE_SSE2], [test "x$have_sse2" = "xyes"])
  1170. if test "x$need_lowl_vcom" = "xyes"; then
  1171. AC_ARG_WITH([libudev], [AC_HELP_STRING([--without-libudev], [Autodetect FPGAs using libudev (default enabled)])],
  1172. [libudev=$withval],
  1173. [libudev=auto]
  1174. )
  1175. if test "x$libudev" != "xno"; then
  1176. AC_CHECK_HEADER([libudev.h],[
  1177. libudev=yes
  1178. UDEV_LIBS=-ludev
  1179. AC_DEFINE([HAVE_LIBUDEV], [1], [Defined to 1 if libudev is wanted])
  1180. ], [
  1181. if test "x$libudev" = "xyes"; then
  1182. AC_MSG_ERROR([libudev not found])
  1183. fi
  1184. libudev=no
  1185. ])
  1186. fi
  1187. fi
  1188. AM_CONDITIONAL([HAVE_LIBUDEV], [test x$libudev != xno])
  1189. AC_SUBST(LIBUSB_LIBS)
  1190. AC_SUBST(LIBUSB_CFLAGS)
  1191. PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.18.2], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.18.2])])
  1192. if echo "$LIBCURL_CFLAGS" | grep '@CPPFLAG_CURL_STATICLIB@' >/dev/null 2>&1; then
  1193. AC_MSG_WARN([Your libcurl pkgconfig file is broken, applying workaround])
  1194. LIBCURL_CFLAGS=`echo "$LIBCURL_CFLAGS" | ${SED} 's/@CPPFLAG_CURL_STATICLIB@//'`
  1195. fi
  1196. AC_SUBST(LIBCURL_LIBS)
  1197. AC_CHECK_FUNCS([setrlimit])
  1198. dnl CCAN wants to know a lot of vars.
  1199. # All the configuration checks. Regrettably, the __attribute__ checks will
  1200. # give false positives on old GCCs, since they just cause warnings. But that's
  1201. # fairly harmless.
  1202. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((cold)) cleanup(void) { }])],
  1203. AC_DEFINE([HAVE_ATTRIBUTE_COLD], [1],
  1204. [Define if __attribute__((cold))]))
  1205. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((const)) cleanup(void) { }])],
  1206. AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1],
  1207. [Define if __attribute__((const))]))
  1208. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((noreturn)) cleanup(void) { exit(1); }])],
  1209. [
  1210. AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
  1211. [Define if __attribute__((noreturn))])
  1212. AC_DEFINE_UNQUOTED([NORETURN], [__attribute__((noreturn))], [Syntax of noreturn attribute])
  1213. ], [
  1214. AC_DEFINE_UNQUOTED([NORETURN], [])
  1215. ]
  1216. )
  1217. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((format(__printf__, 1, 2))) cleanup(const char *fmt, ...) { }])],
  1218. AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1],
  1219. [Define if __attribute__((format(__printf__)))]))
  1220. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((unused)) cleanup(void) { }])],
  1221. AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1],
  1222. [Define if __attribute__((unused))]))
  1223. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((used)) cleanup(void) { }])],
  1224. AC_DEFINE([HAVE_ATTRIBUTE_USED], [1],
  1225. [Define if __attribute__((used))]))
  1226. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_constant_p(1) ? 0 : 1; }])],
  1227. AC_DEFINE([HAVE_BUILTIN_CONSTANT_P], [1],
  1228. [Define if have __builtin_constant_p]))
  1229. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_types_compatible_p(char *, int) ? 1 : 0; }])],
  1230. AC_DEFINE([HAVE_BUILTIN_TYPES_COMPATIBLE_P], [1],
  1231. [Define if have __builtin_types_compatible_p]))
  1232. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static int __attribute__((warn_unused_result)) func(int x) { return x; }])],
  1233. AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1],
  1234. [Define if __attribute__((warn_unused_result))]))
  1235. # byteswap functions
  1236. AH_TEMPLATE([HAVE_BYTESWAP_H], [Define to use byteswap macros from byteswap.h])
  1237. AH_TEMPLATE([HAVE_ENDIAN_H], [Define to use byteswap macros from endian.h])
  1238. AH_TEMPLATE([HAVE_SYS_ENDIAN_H], [Define to use byteswap macros from sys/endian.h])
  1239. AH_TEMPLATE([HAVE_LIBKERN_OSBYTEORDER_H], [Define to use byteswap macros from libkern/OSByteOrder.h])
  1240. BSWAP=''
  1241. for sym in bswap_ __builtin_bswap __bswap_ __swap swap OSSwapInt; do
  1242. AC_MSG_CHECKING([for ${sym}* functions])
  1243. for headerfile in '' byteswap.h endian.h sys/endian.h libkern/OSByteOrder.h; do
  1244. BFG_INCLUDE([headerinclude], [${headerfile}])
  1245. AC_LINK_IFELSE([
  1246. AC_LANG_PROGRAM([
  1247. ${headerinclude}
  1248. ], [
  1249. (void) ${sym}16(0);
  1250. (void) ${sym}32(0);
  1251. (void) ${sym}64(0);
  1252. ])
  1253. ], [
  1254. BSWAP="${sym}"
  1255. if test "x${headerfile}" = "x"; then
  1256. AC_MSG_RESULT([yes])
  1257. else
  1258. AC_MSG_RESULT([found in ${headerfile}])
  1259. AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$headerfile]), 1)
  1260. fi
  1261. break 2
  1262. ])
  1263. done
  1264. AC_MSG_RESULT([no])
  1265. done
  1266. if test "x$BSWAP" = "x"; then
  1267. true # Substitutes are provided in miner.h
  1268. elif test "x$BSWAP" = "xbswap_"; then
  1269. AC_MSG_CHECKING([if bswap_16 is already a macro])
  1270. BFG_PREPROC_IFELSE([defined(bswap_16)], $headerfile, [
  1271. AC_MSG_RESULT([yes])
  1272. BSWAP=""
  1273. ],[
  1274. AC_MSG_RESULT([no])
  1275. ])
  1276. fi
  1277. if test "x$BSWAP" != "x"; then
  1278. AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, [Define to 16-bit byteswap macro])
  1279. AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, [Define to 16-bit byteswap macro])
  1280. AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, [Define to 16-bit byteswap macro])
  1281. fi
  1282. # endian definition macros
  1283. AC_MSG_CHECKING([for platform endian])
  1284. found_endian=no
  1285. for headerfile in '' endian.h sys/endian.h sys/param.h; do
  1286. for pfx in '' '__'; do
  1287. 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}, [
  1288. if test "x$headerfile" = "x"; then
  1289. headerfilec=''
  1290. else
  1291. headerfilec=" (${headerfile})"
  1292. fi
  1293. BFG_PREPROC_IFELSE([${pfx}BYTE_ORDER == ${pfx}BIG_ENDIAN], ${headerfile}, [
  1294. AC_MSG_RESULT([big endian${headerfilec}])
  1295. AC_DEFINE(WORDS_BIGENDIAN, 1, [Define if your platform is big endian])
  1296. ], [
  1297. AC_MSG_RESULT([little endian${headerfilec}])
  1298. ])
  1299. found_endian=yes
  1300. break 2
  1301. ],[true])
  1302. done
  1303. done
  1304. if test "x$found_endian" = "xno"; then
  1305. if $have_win32 || $have_cygwin; then
  1306. AC_MSG_RESULT([assuming little endian (Windows)])
  1307. else
  1308. # AC_C_BIGENDIAN is reported to have problems, and invasive even if buried in a conditional, so don't use it
  1309. AC_MSG_RESULT([unknown])
  1310. AC_MSG_ERROR([Unable to identify platform endian])
  1311. fi
  1312. fi
  1313. AC_MSG_CHECKING([if good static asserts compile])
  1314. AC_TRY_LINK([
  1315. #include <stddef.h>
  1316. ], [
  1317. _Static_assert(1, ":)");
  1318. ], [
  1319. AC_MSG_RESULT([yes])
  1320. ], [
  1321. AC_MSG_RESULT([no])
  1322. AC_DEFINE_UNQUOTED([_Static_assert(...)], [], [Turns _Static_assert into noop for compilers that don't support it])
  1323. ])
  1324. AC_MSG_CHECKING([if GNU format attribute compiles])
  1325. AC_TRY_COMPILE([
  1326. #define FORMAT_SYNTAX_CHECK(...) __attribute__(( format(__VA_ARGS__) ))
  1327. int myfunc(char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
  1328. int myfunc(char *fmt, ...) {
  1329. return 42;
  1330. }
  1331. ], [
  1332. myfunc("abc%d", 42);
  1333. ], [
  1334. AC_MSG_RESULT([yes])
  1335. AC_DEFINE_UNQUOTED([FORMAT_SYNTAX_CHECK(...)], [__attribute__(( format(__VA_ARGS__) ))], [Syntax of format-checking attribute])
  1336. ], [
  1337. AC_MSG_RESULT([no])
  1338. AC_DEFINE_UNQUOTED([FORMAT_SYNTAX_CHECK(...)], [])
  1339. ])
  1340. AC_MSG_CHECKING([for clock_gettime(CLOCK_MONOTONIC)])
  1341. AC_TRY_COMPILE([
  1342. #define _GNU_SOURCE
  1343. #include <time.h>
  1344. ],[
  1345. struct timespec ts;
  1346. clock_gettime(CLOCK_MONOTONIC, &ts);
  1347. ],[
  1348. AC_MSG_RESULT([yes])
  1349. AC_DEFINE([HAVE_CLOCK_GETTIME_MONOTONIC], [1], [Defined to 1 if clock_gettime(CLOCK_MONOTONIC) is defined])
  1350. save_LIBS="${LIBS}"
  1351. AC_SEARCH_LIBS([clock_gettime],[rt posix4],[
  1352. if test "x${ac_cv_search_clock_gettime}" != "xnone required"; then
  1353. RT_LIBS="${ac_cv_search_clock_gettime}"
  1354. fi
  1355. ])
  1356. LIBS="${save_LIBS}"
  1357. AC_CHECK_FUNCS([clock_nanosleep])
  1358. AC_MSG_CHECKING([for clock_gettime(CLOCK_MONOTONIC_RAW)])
  1359. AC_TRY_COMPILE([
  1360. #define _GNU_SOURCE
  1361. #include <time.h>
  1362. ],[
  1363. struct timespec ts;
  1364. clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
  1365. ],[
  1366. AC_MSG_RESULT([yes])
  1367. AC_DEFINE([HAVE_CLOCK_GETTIME_MONOTONIC_RAW], [1], [Defined to 1 if clock_gettime(CLOCK_MONOTONIC_RAW) is defined])
  1368. ],[
  1369. AC_MSG_RESULT([no])
  1370. ])
  1371. ],[
  1372. AC_MSG_RESULT([no])
  1373. ])
  1374. save_LIBS="$LIBS"
  1375. LIBS="$LIBS $MATH_LIBS"
  1376. AC_CHECK_FUNCS([log2])
  1377. LIBS="$save_LIBS"
  1378. if test "x$prefix" = xNONE; then
  1379. prefix=/usr/local
  1380. fi
  1381. AM_CONDITIONAL([NEED_BITSTREAM_FPGAMINER], [test x$USE_MODMINER$USE_X6500 != xnono])
  1382. dnl Hide unnecessary explanations, only after any fatal errors
  1383. howto_SHA256D=x
  1384. if test "x$USE_SHA256D" = xno; then
  1385. howto_BITFURY=x
  1386. fi
  1387. if test "x$want_libusb" = xno; then
  1388. howto_LIBUSB=x
  1389. fi
  1390. m4_define([BFG_PRINT_LIST],[
  1391. eval _mylist="\$$2"
  1392. _yeslist=
  1393. _nolist=
  1394. _enableactions=
  1395. foundone=no
  1396. for _opt in $_mylist; do
  1397. IFS=/ read _opt _var <<EOF
  1398. $_opt
  1399. EOF
  1400. test -n "$_var" || _var="$_opt"
  1401. eval "_val=\"\$${_var}\""
  1402. if test "x$_val" = "xno" || test "x$_val" = "xfalse"; then
  1403. _nolist="$_nolist $_opt"
  1404. _enableaction=`bfg_enableaction $_var`
  1405. if test -n "$_enableaction"; then
  1406. _enableactions="${_enableactions}~ To enable ${_opt}: ${_enableaction}"
  1407. fi
  1408. else
  1409. _yeslist="$_yeslist $_opt"
  1410. foundone=yes
  1411. fi
  1412. done
  1413. _yeslist=`echo "$_yeslist" | tr ' ' '\n' | sort | tr '\n' ' '`
  1414. _nolist=`echo "$_nolist" | tr ' ' '\n' | sort | tr '\n' ' '`
  1415. AC_DEFINE_UNQUOTED(AS_TR_CPP([BFG_$2]),["$_yeslist"],[List of drivers being built])
  1416. $2_print=" Enabled..$1..:${_yeslist}~ Disabled.$1..:${_nolist}${_enableactions}"
  1417. ])
  1418. BFG_PRINT_LIST([Lowlevel..],[lowllist])
  1419. BFG_PRINT_LIST([Drivers...],[driverlist])
  1420. BFG_PRINT_LIST([Algorithms],[algolist])
  1421. if test "x$foundone" = "xno"; then
  1422. AC_MSG_ERROR([No mining algorithms configured!])
  1423. fi
  1424. BFG_PRINT_LIST([Options...],[optlist])
  1425. AC_SUBST(AUTOSCAN_CPPFLAGS)
  1426. AC_SUBST(AUTOSCAN_LIBS)
  1427. AC_SUBST(PTHREAD_FLAGS)
  1428. AC_SUBST(DLOPEN_FLAGS)
  1429. AC_SUBST(PTHREAD_LIBS)
  1430. AC_SUBST(NCURSES_CPPFLAGS)
  1431. AC_SUBST(NCURSES_LIBS)
  1432. AC_SUBST(PDCURSES_LIBS)
  1433. AC_SUBST(WS2_LIBS)
  1434. AC_SUBST(MM_LIBS)
  1435. AC_SUBST(MATH_LIBS)
  1436. AC_SUBST(RT_LIBS)
  1437. AC_SUBST(UDEV_LIBS)
  1438. AC_SUBST(SSE2_CFLAGS)
  1439. AC_SUBST(YASM_FMT)
  1440. AC_CONFIG_FILES([
  1441. Makefile
  1442. x86_64/Makefile
  1443. x86_32/Makefile
  1444. ccan.bfg/Makefile
  1445. lib/Makefile
  1446. ])
  1447. if $use_udevrules; then
  1448. AC_CONFIG_FILES([70-bfgminer.rules])
  1449. fi
  1450. AC_OUTPUT
  1451. BFG_CUSTOM_SUBDIRS_OUTPUT
  1452. wordfilter ()
  1453. {
  1454. echo "$1" | ${SED} 's/ \+/ /g;s/^ *//;s/ *$//'
  1455. }
  1456. echo
  1457. echo "------------------------------------------------------------------------"
  1458. echo "$PACKAGE $VERSION configuration options summary"
  1459. echo "------------------------------------------------------------------------"
  1460. echo
  1461. echo " CFLAGS...............: "`wordfilter "$CPPFLAGS $AUTOSCAN_CPPFLAGS $NCURSES_CPPFLAGS $PTHREAD_FLAGS $CFLAGS $LIBUSB_CFLAGS $JANSSON_CFLAGS $PTHREAD_FLAGS $libbase58_CFLAGS $libblkmaker_CFLAGS $hidapi_CFLAGS"`
  1462. 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"`
  1463. echo " Installation.prefix..: $prefix"
  1464. echo
  1465. echo "${lowllist_print}" | tr '~' '\n'
  1466. echo "${driverlist_print}" | tr '~' '\n'
  1467. echo "${algolist_print}" | tr '~' '\n'
  1468. echo "${optlist_print}" | tr '~' '\n'
  1469. echo