configure.ac 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210
  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], [3])
  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. AM_INIT_AUTOMAKE([foreign])
  31. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  32. AC_USE_SYSTEM_EXTENSIONS
  33. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  34. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  35. m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
  36. m4_ifdef([v_rel], , [m4_define([v_rel], [])])
  37. AC_DEFINE_UNQUOTED(CGMINER_MAJOR_VERSION, [v_maj], [Major version])
  38. AC_DEFINE_UNQUOTED(CGMINER_MINOR_VERSION, [v_min], [Minor version])
  39. AC_DEFINE_UNQUOTED(CGMINER_MINOR_SUBVERSION, [v_mic], [Micro version])
  40. version_info="lt_rev:lt_cur:lt_age"
  41. release_info="v_rel"
  42. AC_SUBST(version_info)
  43. AC_SUBST(release_info)
  44. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  45. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  46. VMAJ=v_maj
  47. AC_SUBST(VMAJ)
  48. AC_CANONICAL_BUILD
  49. AC_CANONICAL_HOST
  50. dnl Make sure anyone changing configure.ac/Makefile.am has a clue
  51. AM_MAINTAINER_MODE([enable])
  52. dnl Checks for programs
  53. AC_PROG_CC_C99
  54. gl_EARLY
  55. AC_PROG_GCC_TRADITIONAL
  56. AM_PROG_CC_C_O
  57. AC_PROG_RANLIB
  58. AC_PROG_CPP
  59. gl_INIT
  60. AC_SYS_LARGEFILE
  61. dnl Checks for header files.
  62. AC_HEADER_STDC
  63. AC_CHECK_HEADERS(syslog.h)
  64. AC_CHECK_HEADERS([sys/epoll.h])
  65. AC_CHECK_HEADERS([sys/prctl.h])
  66. AC_CHECK_HEADERS([sys/file.h])
  67. AC_CHECK_HEADERS([linux/spi/spidev.h])
  68. AC_CHECK_HEADERS([sys/file.h])
  69. # Setuid
  70. AC_CHECK_HEADERS([pwd.h])
  71. # Check for chroot support
  72. AC_CHECK_FUNCS([chroot])
  73. AC_FUNC_ALLOCA
  74. driverlist=
  75. algolist=SHA256d
  76. optlist=
  77. need_dynclock=no
  78. need_fpgautils=no
  79. have_cygwin=false
  80. have_win32=false
  81. have_macho=false
  82. DLOPEN_FLAGS="-ldl"
  83. WS2_LIBS=""
  84. MM_LIBS=""
  85. MATH_LIBS="-lm"
  86. RT_LIBS=""
  87. case $target in
  88. amd64-* | x86_64-*)
  89. have_x86_32=false
  90. have_x86_64=true
  91. bitness="64"
  92. ;;
  93. i386-* | i486-* | i586-* | i686-* | x86-*)
  94. have_x86_32=true
  95. have_x86_64=false
  96. bitness="32"
  97. ;;
  98. *)
  99. have_x86_32=false
  100. have_x86_64=false
  101. ;;
  102. esac
  103. case $target in
  104. *-*-mingw*)
  105. have_win32=true
  106. DLOPEN_FLAGS=""
  107. WS2_LIBS="-lws2_32"
  108. MM_LIBS="-lwinmm"
  109. AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support")
  110. AC_DEFINE([FD_SETSIZE], [4096], [Maximum sockets before fd_set overflows])
  111. ;;
  112. *-*-cygwin*)
  113. have_cygwin=true
  114. ;;
  115. powerpc-*-darwin*)
  116. CFLAGS="$CFLAGS -faltivec"
  117. have_macho=true
  118. ;;
  119. *-*-darwin*)
  120. have_macho=true
  121. ;;
  122. esac
  123. m4_define([BFG_INCLUDE],
  124. if test "x$2" = "x"; then
  125. $1=''
  126. else
  127. $1="[#]include <$2>"
  128. fi
  129. )
  130. m4_define([BFG_PREPROC_IFELSE],
  131. BFG_INCLUDE([headerinclude], $2)
  132. AC_COMPILE_IFELSE([
  133. AC_LANG_PROGRAM([
  134. ${headerinclude}
  135. ], [
  136. #if !( $1 )
  137. #error "$1 false in preprocessor"
  138. #endif
  139. ])
  140. ],[$3],[$4])
  141. )
  142. AC_CHECK_DECL([HASH_ITER],[
  143. AC_CHECK_DECL([DL_FOREACH_SAFE],[
  144. true
  145. ],[
  146. AC_MSG_ERROR([Could not find DL_FOREACH_SAFE - install uthash-dev 1.9.2+])
  147. ],[
  148. #include <utlist.h>
  149. ])
  150. ],[
  151. AC_MSG_ERROR([Could not find HASH_ITER - please install uthash-dev 1.9.2+])
  152. ],[
  153. #include <uthash.h>
  154. ])
  155. driverlist="$driverlist cpu/cpumining"
  156. cpumining="no"
  157. AC_ARG_ENABLE([cpumining],
  158. [AC_HELP_STRING([--enable-cpumining],[Build with CPU mining support (default disabled)])],
  159. [cpumining=$enableval]
  160. )
  161. if test "x$cpumining" = xyes; then
  162. AC_DEFINE_UNQUOTED([WANT_CPUMINE], [1], [Enable CPUMINING])
  163. driverlist="$driverlist cpu:asm/has_yasm"
  164. driverlist="$driverlist cpu:sse2/have_sse2"
  165. fi
  166. AM_CONDITIONAL([HAS_CPUMINE], [test x$cpumining = xyes])
  167. driverlist="$driverlist opencl"
  168. opencl="yes"
  169. AC_ARG_ENABLE([opencl],
  170. [AC_HELP_STRING([--disable-opencl],[Build without support for OpenCL (default enabled)])],
  171. [opencl=$enableval]
  172. )
  173. if test "x$opencl" = xyes; then
  174. AC_DEFINE([HAVE_OPENCL], [1], [Defined to 1 if OpenCL support is wanted])
  175. else
  176. DLOPEN_FLAGS=""
  177. fi
  178. AM_CONDITIONAL([HAVE_OPENCL], [test x$opencl = xyes])
  179. m4_define([BFG_PTHREAD_FLAG_CHECK],
  180. AC_MSG_CHECKING([for $1])
  181. for cflag in ' -pthread' ''; do
  182. for lib in ' -lpthread' ' -lwinpthread' ''; do
  183. CFLAGS="${save_CFLAGS}${cflag}"
  184. LIBS="${save_LIBS}${lib}"
  185. AC_LINK_IFELSE([
  186. AC_LANG_PROGRAM([
  187. #include <pthread.h>
  188. ], [
  189. void *f = $1;
  190. ])
  191. ], [
  192. found_pthread=true
  193. PTHREAD_FLAGS="${cflag}"
  194. PTHREAD_LIBS="${lib}"
  195. if test "x${cflag}${lib}" = "x"; then
  196. AC_MSG_RESULT([yes])
  197. else
  198. AC_MSG_RESULT([with${cflag}${lib}])
  199. fi
  200. $2
  201. break 2
  202. ])
  203. done
  204. done
  205. if test "x${found_pthread}" = "xfalse"; then
  206. AC_MSG_RESULT([no])
  207. fi
  208. )
  209. save_CFLAGS="${CFLAGS}"
  210. save_LIBS="${LIBS}"
  211. found_pthread=false
  212. BFG_PTHREAD_FLAG_CHECK([pthread_cancel],[
  213. AC_DEFINE([HAVE_PTHREAD_CANCEL], [1], [Define if you have a native pthread_cancel])
  214. ])
  215. if test "x${found_pthread}" = "xfalse"; then
  216. BFG_PTHREAD_FLAG_CHECK([pthread_create])
  217. if test "x${found_pthread}" = "xfalse"; then
  218. AC_MSG_ERROR([Could not find pthread library - please install libpthread])
  219. fi
  220. fi
  221. # check for nanosleep here, since it is provided by winpthread
  222. AC_CHECK_FUNCS([nanosleep])
  223. CFLAGS="${save_CFLAGS}"
  224. LIBS="${save_LIBS}"
  225. PKG_CHECK_MODULES([JANSSON],[jansson],[
  226. true
  227. ],[
  228. AC_MSG_CHECKING([for jansson in system-default locations])
  229. LIBS="$LIBS -ljansson"
  230. AC_TRY_LINK([
  231. #include <jansson.h>
  232. ],[
  233. json_object();
  234. ],[
  235. AC_MSG_RESULT([found])
  236. JANSSON_LIBS=-ljansson
  237. ],[
  238. AC_MSG_RESULT([not found])
  239. AC_MSG_ERROR([Could not find jansson library])
  240. ])
  241. LIBS="${save_LIBS}"
  242. ])
  243. AC_SUBST(JANSSON_CFLAGS)
  244. AC_SUBST(JANSSON_LIBS)
  245. if test "x$opencl" = xyes; then
  246. adl="yes"
  247. driverlist="$driverlist opencl:sensors/with_sensors"
  248. AC_ARG_WITH([sensors],
  249. [AC_HELP_STRING([--without-sensors],[Build with libsensors monitoring (default enabled)])],
  250. [true],[with_sensors=auto])
  251. if test "x$opencl" != xyes; then
  252. with_sensors=no
  253. fi
  254. if test "x$with_sensors" != xno; then
  255. AC_MSG_CHECKING([for libsensors])
  256. save_LIBS="${LIBS}"
  257. LIBS="$LIBS -lsensors"
  258. AC_LINK_IFELSE([AC_LANG_PROGRAM([
  259. #include <stddef.h>
  260. #include <sensors/sensors.h>
  261. ],[
  262. const sensors_chip_name *cn;
  263. cn = sensors_get_detected_chips(NULL, NULL);
  264. ])],[
  265. with_sensors=yes
  266. sensors_LIBS="-lsensors"
  267. AC_DEFINE([HAVE_SENSORS], [1], [Defined if libsensors was found])
  268. AC_MSG_RESULT([yes])
  269. ],[
  270. with_sensors=no
  271. AC_MSG_RESULT([no])
  272. if ! $have_win32; then
  273. with_sensors_enableaction="install libsensors"
  274. fi
  275. ])
  276. LIBS="$save_LIBS"
  277. fi
  278. AC_SUBST(sensors_LIBS)
  279. driverlist="$driverlist opencl:adl/adl"
  280. AC_ARG_ENABLE([adl],
  281. [AC_HELP_STRING([--disable-adl],[Build without ADL monitoring (default enabled)])],
  282. [adl=$enableval]
  283. )
  284. if test x$adl = xyes
  285. then
  286. AC_DEFINE([HAVE_ADL], [1], [Defined if ADL headers were found])
  287. fi
  288. else
  289. adl="no"
  290. fi
  291. driverlist="$driverlist bitforce"
  292. AC_ARG_ENABLE([bitforce],
  293. [AC_HELP_STRING([--disable-bitforce],[Compile support for BitForce (default enabled)])],
  294. [bitforce=$enableval],
  295. [bitforce=yes]
  296. )
  297. if test "x$bitforce" = xyes; then
  298. AC_DEFINE([USE_BITFORCE], [1], [Defined to 1 if BitForce support is wanted])
  299. need_fpgautils=yes
  300. fi
  301. AM_CONDITIONAL([HAS_BITFORCE], [test x$bitforce = xyes])
  302. driverlist="$driverlist icarus cairnsmore/icarus erupter/icarus"
  303. AC_ARG_ENABLE([icarus],
  304. [AC_HELP_STRING([--disable-icarus],[Compile support for Icarus (default enabled)])],
  305. [icarus=$enableval],
  306. [icarus=yes]
  307. )
  308. if test "x$icarus" = xyes; then
  309. AC_DEFINE([USE_ICARUS], [1], [Defined to 1 if Icarus support is wanted])
  310. need_dynclock=yes
  311. need_fpgautils=yes
  312. fi
  313. AM_CONDITIONAL([HAS_ICARUS], [test x$icarus = xyes])
  314. driverlist="$driverlist avalon"
  315. avalon="no"
  316. AC_ARG_ENABLE([avalon],
  317. [AC_HELP_STRING([--disable-avalon],[Compile support for Avalon (default enabled)])],
  318. [avalon=$enableval],
  319. [avalon=yes]
  320. )
  321. if test "x$avalon" = xyes; then
  322. AC_DEFINE([USE_AVALON], [1], [Defined to 1 if Avalon support is wanted])
  323. need_fpgautils=yes
  324. fi
  325. AM_CONDITIONAL([HAS_AVALON], [test x$avalon = xyes])
  326. httpsrv=auto
  327. AC_ARG_WITH([libmicrohttpd],
  328. [AC_HELP_STRING([--without-libmicrohttpd],[Compile support for libmicrohttpd getwork server (default enabled)])],
  329. [httpsrv=$withval]
  330. )
  331. if test "x$httpsrv" != "xno"; then
  332. PKG_CHECK_MODULES([libmicrohttpd],[libmicrohttpd >= 0.9.5],[
  333. AC_DEFINE([USE_LIBMICROHTTPD],[1],[Defined to 1 if libmicrohttpd support is wanted])
  334. httpsrv=yes
  335. ],[
  336. httpsrv=no
  337. httpsrv_enableaction="install libmicrohttpd 0.9.5+"
  338. need_bfg_driver_proxy_enableaction="install libmicrohttpd 0.9.5+"
  339. if test "x$httpsrv" = "xyes"; then
  340. AC_MSG_ERROR([Unable to find libmicrohttpd 0.9.5+])
  341. else
  342. AC_MSG_WARN([libmicrohttpd 0.9.5+ not found; getwork proxy will be unavailable])
  343. fi
  344. ])
  345. fi
  346. AM_CONDITIONAL([USE_LIBMICROHTTPD], [test x$httpsrv = xyes])
  347. libevent=auto
  348. AC_ARG_WITH([libevent],
  349. [AC_HELP_STRING([--without-libevent],[Compile support for libevent stratum server (default enabled)])],
  350. [libevent=$withval]
  351. )
  352. if test "x$libevent" != "xno"; then
  353. PKG_CHECK_MODULES([libevent],[libevent >= 2.0.3],[
  354. AC_DEFINE([USE_LIBEVENT],[1],[Defined to 1 if libevent support is wanted])
  355. libevent=yes
  356. ],[
  357. libevent=no
  358. libevent_enableaction="install libevent 2.0.3+"
  359. if test -n "$need_bfg_driver_proxy_enableaction"; then
  360. need_bfg_driver_proxy_enableaction="${need_bfg_driver_proxy_enableaction} (getwork) or libevent 2.0.3+ (stratum)"
  361. else
  362. need_bfg_driver_proxy_enableaction="install libevent 2.0.3+"
  363. fi
  364. if test "x$libevent" = "xyes"; then
  365. AC_MSG_ERROR([Unable to find libevent 2.0.3+])
  366. else
  367. AC_MSG_WARN([libevent 2.0.3+ not found; stratum proxy will be unavailable])
  368. fi
  369. ])
  370. fi
  371. AM_CONDITIONAL([USE_LIBEVENT], [test x$libevent = xyes])
  372. driverlist="$driverlist proxy/need_bfg_driver_proxy"
  373. if test x$libevent$httpsrv = xnono; then
  374. need_bfg_driver_proxy=no
  375. else
  376. need_bfg_driver_proxy=yes
  377. driverlist="$driverlist proxy:getwork/httpsrv proxy:stratum/libevent"
  378. fi
  379. AM_CONDITIONAL([NEED_BFG_DRIVER_PROXY], [test x$libevent$httpsrv != xnono])
  380. driverlist="$driverlist modminer"
  381. AC_ARG_ENABLE([modminer],
  382. [AC_HELP_STRING([--disable-modminer],[Compile support for ModMiner (default enabled)])],
  383. [modminer=$enableval],
  384. [modminer=yes]
  385. )
  386. if test "x$modminer" = xyes; then
  387. AC_DEFINE([USE_MODMINER], [1], [Defined to 1 if ModMiner support is wanted])
  388. need_dynclock=yes
  389. need_fpgautils=yes
  390. fi
  391. AM_CONDITIONAL([HAS_MODMINER], [test x$modminer = xyes])
  392. PKG_PROG_PKG_CONFIG()
  393. libusb=no
  394. libusb_include_path=""
  395. PKG_CHECK_MODULES([LIBUSB], [libusb-1.0],[
  396. libusb=yes
  397. ],[
  398. for usb_lib in usb-1.0 usb; do
  399. AC_CHECK_LIB($usb_lib, libusb_init, [
  400. libusb=yes
  401. break
  402. ])
  403. done
  404. if test "x$libusb" = xyes; then
  405. AC_CHECK_DECL([libusb_init],[
  406. true
  407. ],[
  408. AC_MSG_CHECKING([whether libusb_init is declared in subdirectory])
  409. libusb_include_path=`echo '#include <libusb-1.0/libusb.h>' | ${CPP} -M - 2>/dev/null | tr -d '\\n\\r\\\\' | sed -e 's/^.*[[:space:]:]\(\/[^[:space:]]*\)libusb\.h[[:space:]].*$/\1/' -e t -e d`
  410. if test "x$libusb_include_path" != "x"; then
  411. LIBUSB_LIBS="-l$usb_lib"
  412. LIBUSB_CFLAGS="-I$libusb_include_path"
  413. AC_MSG_RESULT([yes])
  414. else
  415. libusb=no
  416. AC_MSG_RESULT([no])
  417. fi
  418. ],[#include <libusb.h>])
  419. fi
  420. ])
  421. driverlist="$driverlist x6500"
  422. AC_ARG_ENABLE([x6500],
  423. [AC_HELP_STRING([--disable-x6500],[Compile support for X6500 (default if libusb)])],
  424. [x6500=$enableval],
  425. [x6500=auto]
  426. )
  427. if test "x$x6500$libusb" = xyesno; then
  428. AC_MSG_ERROR([Could not find libusb, required for X6500 support])
  429. elif test "x$x6500" = xauto; then
  430. x6500="$libusb"
  431. if test "x$libusb" = xno; then
  432. AC_MSG_WARN([Could not find libusb, required for X6500 support])
  433. x6500_enableaction="install libusb 1.0+"
  434. fi
  435. fi
  436. if test "x$x6500" = xyes; then
  437. AC_DEFINE([USE_X6500], [1], [Defined to 1 if X6500 support is wanted])
  438. need_dynclock=yes
  439. need_fpgautils=yes
  440. fi
  441. AM_CONDITIONAL([HAS_X6500], [test x$x6500 = xyes])
  442. driverlist="$driverlist ztex"
  443. AC_ARG_ENABLE([ztex],
  444. [AC_HELP_STRING([--disable-ztex],[Compile support for ZTEX (default if libusb)])],
  445. [ztex=$enableval],
  446. [ztex=auto]
  447. )
  448. if test "x$ztex$libusb" = xyesno; then
  449. AC_MSG_ERROR([Could not find libusb, required for ZTEX support])
  450. elif test "x$ztex" = xauto; then
  451. ztex="$libusb"
  452. if test "x$libusb" = xno; then
  453. AC_MSG_WARN([Could not find libusb, required for ZTEX support])
  454. ztex_enableaction="install libusb 1.0+"
  455. fi
  456. fi
  457. if test "x$ztex" = xyes; then
  458. AC_DEFINE([USE_ZTEX], [1], [Defined to 1 if ZTEX support is wanted])
  459. need_dynclock=yes
  460. need_fpgautils=yes
  461. fi
  462. AM_CONDITIONAL([HAS_ZTEX], [test x$ztex = xyes])
  463. driverlist="$driverlist bitfury_gpio/bitfury"
  464. bitfury=yes
  465. AC_ARG_ENABLE([bitfury],
  466. [AC_HELP_STRING([--disable-bitfury],[Compile support for Bitfury (default enabled)])],
  467. [bitfury=$enableval]
  468. )
  469. if test "x$bitfury" = xyes; then
  470. AC_DEFINE([USE_BITFURY], [1], [Defined to 1 if Bitfury support is wanted])
  471. fi
  472. AM_CONDITIONAL([HAS_BITFURY], [test x$bitfury = xyes])
  473. driverlist="$driverlist bfsb"
  474. bfsb=no
  475. AC_ARG_ENABLE([bfsb],
  476. [AC_HELP_STRING([--enable-bfsb],[Compile support for BFSB (default disabled)])],
  477. [bfsb=$enableval]
  478. )
  479. if test "x$bfsb" = "xyes"; then
  480. if test "x$bitfury" = "xno"; then
  481. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled BFSB])
  482. fi
  483. AC_DEFINE([USE_BFSB], [1], [Defined to 1 if BFSB support is wanted])
  484. fi
  485. AM_CONDITIONAL([HAS_BFSB], [test x$bfsb = xyes])
  486. driverlist="$driverlist bigpic"
  487. bigpic=auto
  488. AC_ARG_ENABLE([bigpic],
  489. [AC_HELP_STRING([--disable-bigpic],[Compile support for Big Picture Mining USB (default enabled)])],
  490. [bigpic=$enableval]
  491. )
  492. if test "x$bigpic" = "xno"; then
  493. true
  494. elif test "x$bitfury" = "xyes"; then
  495. bigpic=yes
  496. elif test "x$bigpic" = "xyes"; then
  497. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled BigPic])
  498. else
  499. bigpic=no
  500. fi
  501. if test "x$bigpic" = "xyes"; then
  502. AC_DEFINE([USE_BIGPIC], [1], [Defined to 1 if Big Picture Mining USB support is wanted])
  503. need_fpgautils=yes
  504. fi
  505. AM_CONDITIONAL([HAS_BIGPIC], [test x$bigpic = xyes])
  506. driverlist="$driverlist littlefury"
  507. littlefury=auto
  508. AC_ARG_ENABLE([littlefury],
  509. [AC_HELP_STRING([--disable-littlefury],[Compile support for LittleFury (default enabled)])],
  510. [littlefury=$enableval]
  511. )
  512. if test "x$littlefury" = "xno"; then
  513. true
  514. elif test "x$bitfury" = "xyes"; then
  515. littlefury=yes
  516. elif test "x$littlefury" = "xyes"; then
  517. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled LittleFury])
  518. else
  519. littlefury=no
  520. fi
  521. if test "x$littlefury" = "xyes"; then
  522. AC_DEFINE([USE_LITTLEFURY], [1], [Defined to 1 if LittleFury support is wanted])
  523. need_fpgautils=yes
  524. fi
  525. AM_CONDITIONAL([HAS_LITTLEFURY], [test x$littlefury = xyes])
  526. driverlist="$driverlist metabank"
  527. metabank=no
  528. AC_ARG_ENABLE([metabank],
  529. [AC_HELP_STRING([--enable-metabank],[Compile support for Metabank (default disabled)])],
  530. [metabank=$enableval]
  531. )
  532. if test "x$metabank" = "xyes"; then
  533. if test "x$bitfury" = "xno"; then
  534. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled Metabank])
  535. fi
  536. AC_DEFINE([USE_METABANK], [1], [Defined to 1 if Metabank support is wanted])
  537. fi
  538. AM_CONDITIONAL([HAS_METABANK], [test x$metabank = xyes])
  539. if test "x$x6500$ztex" = "xnono"; then
  540. libusb=no
  541. LIBUSB_LIBS=''
  542. LIBUSB_CFLAGS=''
  543. fi
  544. if test "x$libusb" = xyes; then
  545. AC_DEFINE([HAVE_LIBUSB], [1], [Define if you have libusb-1.0])
  546. save_CFLAGS="$CFLAGS"
  547. CFLAGS="$LIBUSB_CFLAGS $CFLAGS"
  548. AC_CHECK_DECLS([libusb_error_name],[true],[true],[#include <libusb.h>])
  549. CFLAGS="$save_CFLAGS"
  550. fi
  551. algolist="$algolist scrypt"
  552. scrypt="no"
  553. AC_ARG_ENABLE([scrypt],
  554. [AC_HELP_STRING([--enable-scrypt],[Compile support for scrypt mining (default disabled)])],
  555. [scrypt=$enableval]
  556. )
  557. if test "x$scrypt" = xyes; then
  558. AC_DEFINE([USE_SCRYPT], [1], [Defined to 1 if scrypt support is wanted])
  559. fi
  560. if test x$need_fpgautils = xyes; then
  561. AC_DEFINE([HAVE_FPGAUTILS], [1], [Defined to 1 if fpgautils is being used])
  562. if $have_win32; then
  563. echo '#include <iospeeds.h>' >iospeeds_local.h
  564. else
  565. AC_MSG_CHECKING([what baud rates your system supports])
  566. echo '#include <termios.h>' | ${CPP} -dM - 2>/dev/null | sed 's/.*[ ]B\([0-9][0-9]*\)[ ].*/IOSPEED(\1)/' | grep IOSPEED >iospeeds_local.h
  567. if grep -q IOSPEED iospeeds_local.h; then
  568. AC_MSG_RESULT([done])
  569. else
  570. AC_MSG_RESULT([failed, using standard POSIX])
  571. echo '#include <iospeeds_posix.h>' >iospeeds_local.h
  572. fi
  573. fi
  574. fi
  575. curses="auto"
  576. AC_ARG_WITH([curses],
  577. [AC_HELP_STRING([--without-curses],[Compile support for curses TUI (default enabled)])],
  578. [curses=$withval]
  579. )
  580. if test "x$curses" = "xno"; then
  581. optlist="$optlist curses"
  582. else
  583. curses_enableaction="install a curses library"
  584. orig_libs="$LIBS"
  585. if test "x${curses}" = "xyes"; then
  586. preferl=''
  587. else
  588. preferl="${curses} ${curses}6 ${curses}5"
  589. fi
  590. for wideornot in w u ''; do
  591. for ncursesver in '' 6 5; do
  592. preferl="${preferl} ncurses${wideornot}${ncursesver}"
  593. done
  594. preferl="${preferl} pdcurses${wideornot}"
  595. done
  596. if test "x$cross_compiling" != "xyes"; then
  597. AC_MSG_CHECKING([for best native curses library])
  598. orig_cflags="$CFLAGS"
  599. for curses_lib in ${preferl}; do
  600. if ! ${curses_lib}-config --cflags >/dev/null 2>/dev/null; then
  601. continue
  602. fi
  603. CFLAGS="$orig_cflags $(${curses_lib}-config --cflags)"
  604. LIBS="$orig_libs $(${curses_lib}-config --libs)"
  605. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  606. #include <curses.h>
  607. ]], [[
  608. WINDOW *w = NULL;
  609. mvwprintw(w, 2, 2, "Testing %s", "o hai");
  610. ]])], [
  611. curses=yes
  612. optlist="$optlist ${curses_lib}/curses"
  613. AC_MSG_RESULT([$curses_lib])
  614. NCURSES_LIBS=`${curses_lib}-config --libs`
  615. NCURSES_CPPFLAGS=`${curses_lib}-config --cflags`
  616. break
  617. ], [
  618. AC_MSG_WARN([${curses_lib} doesn't seem to be installed properly])
  619. ])
  620. done
  621. CFLAGS="$orig_cflags"
  622. if test "x$curses" != "xyes"; then
  623. AC_MSG_RESULT([none?])
  624. fi
  625. fi
  626. if test "x$curses" != "xyes"; then
  627. sym=addstr
  628. AC_SEARCH_LIBS(${sym}, ${preferl}, [
  629. curses=yes
  630. eval "curseslib=\"\${ac_cv_search_${sym}}\""
  631. barelib="${curseslib/-l/}"
  632. optlist="$optlist ${barelib}/curses"
  633. if test "x${curseslib}" != "xnone required"; then
  634. NCURSES_LIBS="${curseslib}"
  635. fi
  636. # Need to check for headers in subdirectories, to ensure we get wide stuff
  637. AC_MSG_CHECKING([for curses header subdirectory])
  638. barelib="${barelib/6/}"
  639. barelib="${barelib/5/}"
  640. cursesincl=`echo "#include <${barelib}/curses.h>" | ${CPP} -M - 2>/dev/null | tr -d '\\n\\r\\\\' | sed -e 's/^.*[[:space:]:]\(\/[^[:space:]]*\)libusb\.h[[:space:]].*$/\1/' -e t -e d`
  641. if test "x$cursesincl" != "x"; then
  642. NCURSES_CPPFLAGS="-I${cursesincl}"
  643. AC_MSG_RESULT([$cursesincl])
  644. else
  645. AC_MSG_RESULT([none found])
  646. fi
  647. break
  648. ], [
  649. if test "x$curses" = "xyes"; then
  650. AC_MSG_ERROR([Could not find curses library - please install libncurses-dev or pdcurses-dev (or configure --without-curses)])
  651. else
  652. AC_MSG_WARN([Could not find curses library - if you want a TUI, install libncurses-dev or pdcurses-dev])
  653. curses=no
  654. optlist="$optlist curses"
  655. fi
  656. ])
  657. fi
  658. if test "x$curses" = "xyes"; then
  659. AC_DEFINE([HAVE_CURSES], [1], [Defined to 1 if curses TUI support is wanted])
  660. AC_MSG_CHECKING([whether curses library supports wide characters])
  661. LIBS="$orig_libs $NCURSES_CPPFLAGS $NCURSES_LIBS"
  662. AC_LINK_IFELSE([
  663. AC_LANG_PROGRAM([
  664. #define PDC_WIDE
  665. #include <curses.h>
  666. ],[
  667. addwstr(L"test");
  668. add_wch(WACS_VLINE);
  669. ])
  670. ],[
  671. AC_MSG_RESULT([yes])
  672. AC_DEFINE([USE_UNICODE],[1],[Defined to 1 if curses supports wide characters])
  673. ],[
  674. AC_MSG_RESULT([no])
  675. ])
  676. fi
  677. LIBS="$orig_libs"
  678. fi
  679. maybe_ldconfig=
  680. 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])
  681. if test "x$with_system_libblkmaker" = "xyes"; then
  682. PKG_CHECK_MODULES([libblkmaker],[libblkmaker_jansson-0.1],[
  683. true
  684. ],[
  685. AC_MSG_ERROR([Could not find system libblkmaker])
  686. ])
  687. else
  688. save_LDFLAGS="$LDFLAGS"
  689. LDFLAGS="$LDFLAGS -Wl,-zorigin"
  690. origin_LDFLAGS=
  691. AC_MSG_CHECKING([whether the linker recognizes the -zorigin option])
  692. AC_TRY_LINK([],[],[
  693. AC_MSG_RESULT([yes])
  694. origin_LDFLAGS=',-zorigin'
  695. ],[
  696. AC_MSG_RESULT([no])
  697. ])
  698. LDFLAGS="$save_LDFLAGS"
  699. libblkmaker_CFLAGS='-Ilibblkmaker'
  700. libblkmaker_LDFLAGS='-Llibblkmaker/.libs -Wl,-rpath,\$$ORIGIN/libblkmaker/.libs'"$origin_LDFLAGS"
  701. libblkmaker_LIBS='-lblkmaker_jansson-0.1 -lblkmaker-0.1'
  702. AC_CONFIG_SUBDIRS([libblkmaker])
  703. _ROOTPATH=$PATH$PATH_SEPARATOR`echo $PATH | sed s/bin/sbin/g`
  704. possible_ldconfigs="${target}-ldconfig"
  705. if test "x$cross_compiling" != "xyes"; then
  706. possible_ldconfigs="${possible_ldconfigs} ldconfig"
  707. fi
  708. AC_CHECK_PROGS([LDCONFIG],[${possible_ldconfigs}],[],[$_ROOTPATH])
  709. if test "x$LDCONFIG" != "x"; then
  710. maybe_ldconfig=" && $LDCONFIG"
  711. fi
  712. fi
  713. AC_SUBST(libblkmaker_CFLAGS)
  714. AC_SUBST(libblkmaker_LDFLAGS)
  715. AC_SUBST(libblkmaker_LIBS)
  716. AM_CONDITIONAL([NEED_LIBBLKMAKER], [test x$with_system_libblkmaker != xyes])
  717. AM_CONDITIONAL([NEED_DYNCLOCK], [test x$need_dynclock = xyes])
  718. AM_CONDITIONAL([NEED_FPGAUTILS], [test x$need_fpgautils = xyes])
  719. AM_CONDITIONAL([HAS_SCRYPT], [test x$scrypt = xyes])
  720. AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
  721. AM_CONDITIONAL([HAVE_SENSORS], [test x$with_sensors = xyes])
  722. AM_CONDITIONAL([HAVE_CYGWIN], [test x$have_cygwin = xtrue])
  723. AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
  724. AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
  725. AM_CONDITIONAL([HAS_FPGA], [test x$bitforce$icarus$modminer$x6500$ztex != xnonononono])
  726. AM_CONDITIONAL([HAS_ASIC], [test x$avalon$bfsb$bigpic$icarus$httpsrv$metabank != xnononononono])
  727. dnl Find YASM
  728. has_yasm=false
  729. if test "x$have_x86_32$have_x86_64" != "xfalsefalse"; then
  730. AC_PATH_PROG([YASM],[yasm],[false])
  731. if test "x$YASM" != "xfalse" ; then
  732. has_yasm_enableaction="install yasm 1.0.1+"
  733. AC_MSG_CHECKING([if yasm version is greater than 1.0.1])
  734. yasmver=`"$YASM" --version | head -1 | cut -d\ -f2`
  735. yamajor=`echo $yasmver | cut -d. -f1`
  736. yaminor=`echo $yasmver | cut -d. -f2`
  737. yamini=`echo $yasmver | cut -d. -f3`
  738. if test "$yamajor" -ge "1" ; then
  739. if test "$yamajor" -eq "1" ; then
  740. if test "$yaminor" -ge "0" ; then
  741. if test "$yaminor" -eq "0"; then
  742. if test "$yamini" -ge "1"; then
  743. has_yasm=true
  744. fi
  745. else
  746. has_yasm=true
  747. fi
  748. fi
  749. fi
  750. else
  751. has_yasm=false
  752. fi
  753. if test "x$has_yasm" = "xtrue" ; then
  754. AC_MSG_RESULT([yes])
  755. else
  756. AC_MSG_RESULT([no])
  757. fi
  758. fi
  759. if test "x$has_yasm" = "xfalse" ; then
  760. AC_MSG_NOTICE([yasm is required for the assembly algorithms. They will be skipped.])
  761. else
  762. AC_DEFINE([HAVE_YASM], [1], [Defined to 1 if yasm is being used])
  763. if test "x$have_win32$have_cygwin" != "xfalsefalse"; then
  764. if test "x$have_x86_64" = xtrue; then
  765. YASM_FMT="win64"
  766. else
  767. YASM_FMT="coff"
  768. fi
  769. elif test "x$have_macho" = "xtrue"; then
  770. YASM_FMT="macho$bitness"
  771. else
  772. YASM_FMT="elf$bitness"
  773. fi
  774. fi
  775. fi
  776. AM_CONDITIONAL([HAS_YASM], [test x$has_yasm = xtrue])
  777. have_sse2=no
  778. if test "x$cpumining$have_x86_32" = "xyestrue"; then
  779. AC_MSG_CHECKING([if SSE2 code compiles])
  780. save_CFLAGS="$CFLAGS"
  781. for flags in '' '-msse2'; do
  782. CFLAGS="$CFLAGS $flags"
  783. AC_TRY_LINK([
  784. #include <xmmintrin.h>
  785. ],[
  786. int *i = (int *)0xdeadbeef;
  787. __m128i a, b;
  788. a = _mm_set1_epi32(i[0]);
  789. b = _mm_set_epi32(i[0], i[1], i[2], i[3]);
  790. a = _mm_add_epi32(a, b);
  791. a = _mm_andnot_si128(a, b);
  792. a = _mm_or_si128(a, b);
  793. a = _mm_slli_epi32(a, i[4]);
  794. a = _mm_and_si128(a, b);
  795. a = _mm_xor_si128(a, b);
  796. ],[
  797. if test "x$flags" = "x"; then
  798. AC_MSG_RESULT([yes])
  799. else
  800. AC_MSG_RESULT([with $flags])
  801. fi
  802. SSE2_CFLAGS="$flags"
  803. have_sse2=yes
  804. break
  805. ],[
  806. true
  807. ])
  808. done
  809. CFLAGS="${save_CFLAGS}"
  810. if test "x$have_sse2" = "xyes"; then
  811. AC_DEFINE([HAVE_SSE2], [1], [Defined to 1 if yasm is being used])
  812. else
  813. AC_MSG_RESULT([no])
  814. fi
  815. fi
  816. AM_CONDITIONAL([HAVE_SSE2], [test "x$have_sse2" = "xyes"])
  817. if test "x$need_fpgautils" = "xyes"; then
  818. AC_ARG_WITH([libudev], [AC_HELP_STRING([--without-libudev], [Autodetect FPGAs using libudev (default enabled)])],
  819. [libudev=$withval],
  820. [libudev=auto]
  821. )
  822. if test "x$libudev" != "xno"; then
  823. AC_CHECK_HEADER([libudev.h],[
  824. libudev=yes
  825. UDEV_LIBS=-ludev
  826. AC_DEFINE([HAVE_LIBUDEV], [1], [Defined to 1 if libudev is wanted])
  827. ], [
  828. if test "x$libudev" = "xyes"; then
  829. AC_MSG_ERROR([libudev not found])
  830. fi
  831. libudev=no
  832. ])
  833. fi
  834. fi
  835. AM_CONDITIONAL([HAVE_LIBUDEV], [test x$libudev != xno])
  836. AC_SUBST(LIBUSB_LIBS)
  837. AC_SUBST(LIBUSB_CFLAGS)
  838. PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.18.2], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.18.2])])
  839. if echo "$LIBCURL_CFLAGS" | grep '@CPPFLAG_CURL_STATICLIB@' >/dev/null 2>&1; then
  840. AC_MSG_WARN([Your libcurl pkgconfig file is broken, applying workaround])
  841. LIBCURL_CFLAGS=`echo "$LIBCURL_CFLAGS" | sed 's/@CPPFLAG_CURL_STATICLIB@//'`
  842. fi
  843. AC_SUBST(LIBCURL_LIBS)
  844. AC_CHECK_FUNCS([setrlimit])
  845. dnl CCAN wants to know a lot of vars.
  846. # All the configuration checks. Regrettably, the __attribute__ checks will
  847. # give false positives on old GCCs, since they just cause warnings. But that's
  848. # fairly harmless.
  849. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((cold)) cleanup(void) { }])],
  850. AC_DEFINE([HAVE_ATTRIBUTE_COLD], [1],
  851. [Define if __attribute__((cold))]))
  852. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((const)) cleanup(void) { }])],
  853. AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1],
  854. [Define if __attribute__((const))]))
  855. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((noreturn)) cleanup(void) { exit(1); }])],
  856. [
  857. AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
  858. [Define if __attribute__((noreturn))])
  859. AC_DEFINE_UNQUOTED([NORETURN], [__attribute__((noreturn))], [Syntax of noreturn attribute])
  860. ], [
  861. AC_DEFINE_UNQUOTED([NORETURN], [])
  862. ]
  863. )
  864. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((format(__printf__, 1, 2))) cleanup(const char *fmt, ...) { }])],
  865. AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1],
  866. [Define if __attribute__((format(__printf__)))]))
  867. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((unused)) cleanup(void) { }])],
  868. AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1],
  869. [Define if __attribute__((unused))]))
  870. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((used)) cleanup(void) { }])],
  871. AC_DEFINE([HAVE_ATTRIBUTE_USED], [1],
  872. [Define if __attribute__((used))]))
  873. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_constant_p(1) ? 0 : 1; }])],
  874. AC_DEFINE([HAVE_BUILTIN_CONSTANT_P], [1],
  875. [Define if have __builtin_constant_p]))
  876. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_types_compatible_p(char *, int) ? 1 : 0; }])],
  877. AC_DEFINE([HAVE_BUILTIN_TYPES_COMPATIBLE_P], [1],
  878. [Define if have __builtin_types_compatible_p]))
  879. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static int __attribute__((warn_unused_result)) func(int x) { return x; }])],
  880. AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1],
  881. [Define if __attribute__((warn_unused_result))]))
  882. AC_MSG_CHECKING([for roundl function])
  883. save_LIBS="${LIBS}"
  884. LIBS="$LIBS -lm"
  885. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  886. #include <math.h>
  887. ]], [[
  888. return (roundl(*(long double *)0xdeadbeef) == 1.0);
  889. ]])], [
  890. AC_MSG_RESULT([yes])
  891. ], [
  892. AC_MSG_RESULT([no])
  893. AC_DEFINE([NEED_ROUNDL], [1], [Defined to 1 if C99 roundl is missing])
  894. ])
  895. LIBS="${save_LIBS}"
  896. # byteswap functions
  897. AH_TEMPLATE([HAVE_BYTESWAP_H], [Define to use byteswap macros from byteswap.h])
  898. AH_TEMPLATE([HAVE_ENDIAN_H], [Define to use byteswap macros from endian.h])
  899. AH_TEMPLATE([HAVE_SYS_ENDIAN_H], [Define to use byteswap macros from sys/endian.h])
  900. AH_TEMPLATE([HAVE_LIBKERN_OSBYTEORDER_H], [Define to use byteswap macros from libkern/OSByteOrder.h])
  901. BSWAP=''
  902. for sym in bswap_ __builtin_bswap __bswap_ __swap swap OSSwapInt; do
  903. AC_MSG_CHECKING([for ${sym}* functions])
  904. for headerfile in '' byteswap.h endian.h sys/endian.h libkern/OSByteOrder.h; do
  905. BFG_INCLUDE([headerinclude], [${headerfile}])
  906. AC_LINK_IFELSE([
  907. AC_LANG_PROGRAM([
  908. ${headerinclude}
  909. ], [
  910. (void) ${sym}16(0);
  911. (void) ${sym}32(0);
  912. (void) ${sym}64(0);
  913. ])
  914. ], [
  915. BSWAP="${sym}"
  916. if test "x${headerfile}" = "x"; then
  917. AC_MSG_RESULT([yes])
  918. else
  919. AC_MSG_RESULT([found in ${headerfile}])
  920. AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$headerfile]), 1)
  921. fi
  922. break 2
  923. ])
  924. done
  925. AC_MSG_RESULT([no])
  926. done
  927. if test "x$BSWAP" = "x"; then
  928. true # Substitutes are provided in miner.h
  929. elif test "x$BSWAP" = "xbswap_"; then
  930. AC_MSG_CHECKING([if bswap_16 is already a macro])
  931. BFG_PREPROC_IFELSE([defined(bswap_16)], $headerfile, [
  932. AC_MSG_RESULT([yes])
  933. BSWAP=""
  934. ],[
  935. AC_MSG_RESULT([no])
  936. ])
  937. fi
  938. if test "x$BSWAP" != "x"; then
  939. AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, [Define to 16-bit byteswap macro])
  940. AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, [Define to 16-bit byteswap macro])
  941. AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, [Define to 16-bit byteswap macro])
  942. fi
  943. # endian definition macros
  944. AC_MSG_CHECKING([for platform endian])
  945. found_endian=no
  946. for headerfile in '' endian.h sys/endian.h sys/param.h; do
  947. for pfx in '' '__'; do
  948. 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}, [
  949. if test "x$headerfile" = "x"; then
  950. headerfilec=''
  951. else
  952. headerfilec=" (${headerfile})"
  953. fi
  954. BFG_PREPROC_IFELSE([${pfx}BYTE_ORDER == ${pfx}BIG_ENDIAN], ${headerfile}, [
  955. AC_MSG_RESULT([big endian${headerfilec}])
  956. AC_DEFINE(WORDS_BIGENDIAN, 1, [Define if your platform is big endian])
  957. ], [
  958. AC_MSG_RESULT([little endian${headerfilec}])
  959. ])
  960. found_endian=yes
  961. break 2
  962. ],[true])
  963. done
  964. done
  965. if test "x$found_endian" = "xno"; then
  966. if $have_win32 || $have_cygwin; then
  967. AC_MSG_RESULT([assuming little endian (Windows)])
  968. else
  969. # AC_C_BIGENDIAN is reported to have problems, and invasive even if buried in a conditional, so don't use it
  970. AC_MSG_RESULT([unknown])
  971. AC_MSG_ERROR([Unable to identify platform endian])
  972. fi
  973. fi
  974. AC_MSG_CHECKING([if GNU format attribute compiles])
  975. AC_TRY_COMPILE([
  976. #define FORMAT_SYNTAX_CHECK(...) __attribute__(( format(__VA_ARGS__) ))
  977. int myfunc(char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
  978. int myfunc(char *fmt, ...) {
  979. return 42;
  980. }
  981. ], [
  982. myfunc("abc%d", 42);
  983. ], [
  984. AC_MSG_RESULT([yes])
  985. AC_DEFINE_UNQUOTED([FORMAT_SYNTAX_CHECK(...)], [__attribute__(( format(__VA_ARGS__) ))], [Syntax of format-checking attribute])
  986. ], [
  987. AC_MSG_RESULT([no])
  988. AC_DEFINE_UNQUOTED([FORMAT_SYNTAX_CHECK(...)], [])
  989. ])
  990. AC_MSG_CHECKING([for clock_gettime(CLOCK_MONOTONIC)])
  991. AC_TRY_COMPILE([
  992. #define _GNU_SOURCE
  993. #include <time.h>
  994. ],[
  995. struct timespec ts;
  996. clock_gettime(CLOCK_MONOTONIC, &ts);
  997. ],[
  998. AC_MSG_RESULT([yes])
  999. AC_DEFINE([HAVE_CLOCK_GETTIME_MONOTONIC], [1], [Defined to 1 if clock_gettime(CLOCK_MONOTONIC) is defined])
  1000. save_LIBS="${LIBS}"
  1001. AC_SEARCH_LIBS([clock_gettime],[rt posix4],[
  1002. if test "x${ac_cv_search_clock_gettime}" != "xnone required"; then
  1003. RT_LIBS="${ac_cv_search_clock_gettime}"
  1004. fi
  1005. ])
  1006. LIBS="${save_LIBS}"
  1007. AC_CHECK_FUNCS([clock_nanosleep])
  1008. AC_MSG_CHECKING([for clock_gettime(CLOCK_MONOTONIC_RAW)])
  1009. AC_TRY_COMPILE([
  1010. #define _GNU_SOURCE
  1011. #include <time.h>
  1012. ],[
  1013. struct timespec ts;
  1014. clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
  1015. ],[
  1016. AC_MSG_RESULT([yes])
  1017. AC_DEFINE([HAVE_CLOCK_GETTIME_MONOTONIC_RAW], [1], [Defined to 1 if clock_gettime(CLOCK_MONOTONIC_RAW) is defined])
  1018. ],[
  1019. AC_MSG_RESULT([no])
  1020. ])
  1021. ],[
  1022. AC_MSG_RESULT([no])
  1023. ])
  1024. if test "x$prefix" = xNONE; then
  1025. prefix=/usr/local
  1026. fi
  1027. AM_CONDITIONAL([NEED_BITSTREAM_FPGAMINER], [test x$modminer$x6500 != xnono])
  1028. AC_DEFINE_UNQUOTED([PHATK_KERNNAME], ["phatk121016"], [Filename for phatk kernel])
  1029. AC_DEFINE_UNQUOTED([POCLBM_KERNNAME], ["poclbm130302"], [Filename for poclbm kernel])
  1030. AC_DEFINE_UNQUOTED([DIAKGCN_KERNNAME], ["diakgcn121016"], [Filename for diakgcn kernel])
  1031. AC_DEFINE_UNQUOTED([DIABLO_KERNNAME], ["diablo130302"], [Filename for diablo kernel])
  1032. AC_DEFINE_UNQUOTED([SCRYPT_KERNNAME], ["scrypt130511"], [Filename for scrypt kernel])
  1033. AC_SUBST(PTHREAD_FLAGS)
  1034. AC_SUBST(DLOPEN_FLAGS)
  1035. AC_SUBST(PTHREAD_LIBS)
  1036. AC_SUBST(NCURSES_CPPFLAGS)
  1037. AC_SUBST(NCURSES_LIBS)
  1038. AC_SUBST(PDCURSES_LIBS)
  1039. AC_SUBST(WS2_LIBS)
  1040. AC_SUBST(MM_LIBS)
  1041. AC_SUBST(MATH_LIBS)
  1042. AC_SUBST(RT_LIBS)
  1043. AC_SUBST(UDEV_LIBS)
  1044. AC_SUBST(SSE2_CFLAGS)
  1045. AC_SUBST(YASM_FMT)
  1046. AC_CONFIG_FILES([
  1047. Makefile
  1048. x86_64/Makefile
  1049. x86_32/Makefile
  1050. ccan/Makefile
  1051. lib/Makefile
  1052. ])
  1053. AC_OUTPUT
  1054. echo
  1055. echo
  1056. echo
  1057. echo "------------------------------------------------------------------------"
  1058. echo "$PACKAGE $VERSION"
  1059. echo "------------------------------------------------------------------------"
  1060. echo
  1061. echo
  1062. echo "Configuration Options Summary:"
  1063. echo
  1064. m4_define([BFG_PRINT_LIST],[
  1065. eval _mylist="\$$2"
  1066. _yeslist=
  1067. _nolist=
  1068. _enableactions=
  1069. for _opt in $_mylist; do
  1070. IFS=/ read _opt _var <<EOF
  1071. $_opt
  1072. EOF
  1073. test -n "$_var" || _var="$_opt"
  1074. eval "_val=\"\$${_var}\""
  1075. if test "x$_val" = "xno" || test "x$_val" = "xfalse"; then
  1076. _nolist="$_nolist $_opt"
  1077. eval "_enableaction=\"\$${_var}_enableaction\""
  1078. if test -n "$_enableaction"; then
  1079. _enableactions="${_enableactions}~ To enable ${_opt}, ${_enableaction}"
  1080. fi
  1081. else
  1082. _yeslist="$_yeslist $_opt"
  1083. fi
  1084. done
  1085. _yeslist=`echo "$_yeslist" | tr ' ' '\n' | sort | tr '\n' ' '`
  1086. _nolist=`echo "$_nolist" | tr ' ' '\n' | sort | tr '\n' ' '`
  1087. echo " Enabled..$1..:$_yeslist"
  1088. echo " Disabled.$1..:$_nolist"
  1089. if test -n "$_enableactions"; then
  1090. echo "${_enableactions:1}" | tr '~' '\n'
  1091. fi
  1092. ])
  1093. BFG_PRINT_LIST([Drivers...],[driverlist])
  1094. BFG_PRINT_LIST([Algorithms],[algolist])
  1095. BFG_PRINT_LIST([Options...],[optlist])
  1096. echo
  1097. echo "Compilation............: make (or gmake)"
  1098. echo " CFLAGS...............: $CPPFLAGS $NCURSES_CPPFLAGS $PTHREAD_FLAGS $CFLAGS $LIBUSB_CFLAGS $JANSSON_CFLAGS $PTHREAD_FLAGS $libblkmaker_CFLAGS"
  1099. echo " LDFLAGS..............: $LDFLAGS $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"
  1100. echo
  1101. echo "Installation...........: make install$maybe_ldconfig #(as root if needed, with 'su' or 'sudo')"
  1102. echo " prefix...............: $prefix"
  1103. echo