configure.ac 33 KB

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