configure.ac 47 KB

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