configure.ac 45 KB

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