configure.ac 47 KB

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