configure.ac 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  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. fi
  422. AM_CONDITIONAL([HAS_BITFURY], [test x$bitfury = xyes])
  423. bfsb=no
  424. AC_ARG_ENABLE([bfsb],
  425. [AC_HELP_STRING([--disable-bfsb],[Compile support for BFSB (default disabled)])],
  426. [bfsb=$enableval]
  427. )
  428. if test "x$bfsb" = "xyes"; then
  429. if test "x$bitfury" = "xno"; then
  430. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled BFSB])
  431. fi
  432. AC_DEFINE([USE_BFSB], [1], [Defined to 1 if BFSB support is wanted])
  433. fi
  434. AM_CONDITIONAL([HAS_BFSB], [test x$bfsb = xyes])
  435. littlefury=auto
  436. AC_ARG_ENABLE([littlefury],
  437. [AC_HELP_STRING([--disable-littlefury],[Compile support for LittleFury (default enabled)])],
  438. [littlefury=$enableval]
  439. )
  440. if test "x$littlefury" = "xno"; then
  441. true
  442. elif test "x$bitfury" = "xyes"; then
  443. littlefury=yes
  444. elif test "x$littlefury" = "xyes"; then
  445. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled LittleFury])
  446. else
  447. littlefury=no
  448. fi
  449. if test "x$littlefury" = "xyes"; then
  450. AC_DEFINE([USE_LITTLEFURY], [1], [Defined to 1 if LittleFury support is wanted])
  451. need_fpgautils=yes
  452. fi
  453. AM_CONDITIONAL([HAS_LITTLEFURY], [test x$littlefury = xyes])
  454. metabank=no
  455. AC_ARG_ENABLE([metabank],
  456. [AC_HELP_STRING([--disable-metabank],[Compile support for Metabank (default disabled)])],
  457. [metabank=$enableval]
  458. )
  459. if test "x$metabank" = "xyes"; then
  460. if test "x$bitfury" = "xno"; then
  461. AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled Metabank])
  462. fi
  463. AC_DEFINE([USE_METABANK], [1], [Defined to 1 if Metabank support is wanted])
  464. fi
  465. AM_CONDITIONAL([HAS_METABANK], [test x$metabank = xyes])
  466. if test "x$x6500$ztex" = "xnono"; then
  467. libusb=no
  468. LIBUSB_LIBS=''
  469. LIBUSB_CFLAGS=''
  470. fi
  471. if test "x$libusb" = xyes; then
  472. AC_DEFINE([HAVE_LIBUSB], [1], [Define if you have libusb-1.0])
  473. save_CFLAGS="$CFLAGS"
  474. CFLAGS="$LIBUSB_CFLAGS $CFLAGS"
  475. AC_CHECK_DECLS([libusb_error_name],[true],[true],[#include <libusb.h>])
  476. CFLAGS="$save_CFLAGS"
  477. fi
  478. scrypt="no"
  479. AC_ARG_ENABLE([scrypt],
  480. [AC_HELP_STRING([--enable-scrypt],[Compile support for scrypt mining (default disabled)])],
  481. [scrypt=$enableval]
  482. )
  483. if test "x$scrypt" = xyes; then
  484. AC_DEFINE([USE_SCRYPT], [1], [Defined to 1 if scrypt support is wanted])
  485. fi
  486. if test x$need_fpgautils = xyes; then
  487. AC_DEFINE([HAVE_FPGAUTILS], [1], [Defined to 1 if fpgautils is being used])
  488. if $have_win32; then
  489. echo '#include <iospeeds.h>' >iospeeds_local.h
  490. else
  491. AC_MSG_CHECKING([what baud rates your system supports])
  492. echo '#include <termios.h>' | ${CPP} -dM - 2>/dev/null | sed 's/.*[ ]B\([0-9][0-9]*\)[ ].*/IOSPEED(\1)/' | grep IOSPEED >iospeeds_local.h
  493. if grep -q IOSPEED iospeeds_local.h; then
  494. AC_MSG_RESULT([done])
  495. else
  496. AC_MSG_RESULT([failed, using standard POSIX])
  497. echo '#include <iospeeds_posix.h>' >iospeeds_local.h
  498. fi
  499. fi
  500. fi
  501. curses="auto"
  502. AC_ARG_WITH([curses],
  503. [AC_HELP_STRING([--without-curses],[Compile support for curses TUI (default enabled)])],
  504. [curses=$withval]
  505. )
  506. if test "x$curses" = "xno"; then
  507. cursesmsg='User specified --without-curses. TUI support DISABLED'
  508. else
  509. orig_libs="$LIBS"
  510. if test "x${curses}" = "xyes"; then
  511. preferl=''
  512. else
  513. preferl="${curses} ${curses}6 ${curses}5"
  514. fi
  515. for wideornot in w u ''; do
  516. for ncursesver in '' 6 5; do
  517. preferl="${preferl} ncurses${wideornot}${ncursesver}"
  518. done
  519. preferl="${preferl} pdcurses${wideornot}"
  520. done
  521. if test "x$cross_compiling" != "xyes"; then
  522. AC_MSG_CHECKING([for best native curses library])
  523. orig_cflags="$CFLAGS"
  524. for curses_lib in ${preferl}; do
  525. if ! ${curses_lib}-config --cflags >/dev/null 2>/dev/null; then
  526. continue
  527. fi
  528. CFLAGS="$orig_cflags $(${curses_lib}-config --cflags)"
  529. LIBS="$orig_libs $(${curses_lib}-config --libs)"
  530. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  531. #include <curses.h>
  532. ]], [[
  533. WINDOW *w = NULL;
  534. mvwprintw(w, 2, 2, "Testing %s", "o hai");
  535. ]])], [
  536. curses=yes
  537. cursesmsg="FOUND: ${curses_lib}"
  538. AC_MSG_RESULT([$curses_lib])
  539. NCURSES_LIBS=`${curses_lib}-config --libs`
  540. NCURSES_CPPFLAGS=`${curses_lib}-config --cflags`
  541. break
  542. ], [
  543. AC_MSG_WARN([${curses_lib} doesn't seem to be installed properly])
  544. ])
  545. done
  546. CFLAGS="$orig_cflags"
  547. if test "x$curses" != "xyes"; then
  548. AC_MSG_RESULT([none?])
  549. fi
  550. fi
  551. if test "x$curses" != "xyes"; then
  552. sym=addstr
  553. AC_SEARCH_LIBS(${sym}, ${preferl}, [
  554. curses=yes
  555. eval "curseslib=\"\${ac_cv_search_${sym}}\""
  556. barelib="${curseslib/-l/}"
  557. cursesmsg="FOUND: ${barelib}"
  558. if test "x${curseslib}" != "xnone required"; then
  559. NCURSES_LIBS="${curseslib}"
  560. fi
  561. # Need to check for headers in subdirectories, to ensure we get wide stuff
  562. AC_MSG_CHECKING([for curses header subdirectory])
  563. barelib="${barelib/6/}"
  564. barelib="${barelib/5/}"
  565. cursesincl=`echo "#include <${barelib}/curses.h>" | ${CPP} -M - 2>/dev/null | tr -d '\\n\\r\\\\' | sed 's/^[^:]*:[[:space:]]*\([^[:space:]]*\)\/.*/\1/'`
  566. if test "x$cursesincl" != "x"; then
  567. NCURSES_CPPFLAGS="-I${cursesincl}"
  568. AC_MSG_RESULT([$cursesincl])
  569. else
  570. AC_MSG_RESULT([none found])
  571. fi
  572. break
  573. ], [
  574. if test "x$curses" = "xyes"; then
  575. AC_MSG_ERROR([Could not find curses library - please install libncurses-dev or pdcurses-dev (or configure --without-curses)])
  576. else
  577. AC_MSG_WARN([Could not find curses library - if you want a TUI, install libncurses-dev or pdcurses-dev])
  578. curses=no
  579. cursesmsg='NOT FOUND. TUI support DISABLED'
  580. fi
  581. ])
  582. fi
  583. if test "x$curses" = "xyes"; then
  584. AC_DEFINE([HAVE_CURSES], [1], [Defined to 1 if curses TUI support is wanted])
  585. AC_MSG_CHECKING([whether curses library supports wide characters])
  586. LIBS="$orig_libs $NCURSES_CPPFLAGS $NCURSES_LIBS"
  587. AC_LINK_IFELSE([
  588. AC_LANG_PROGRAM([
  589. #define PDC_WIDE
  590. #include <curses.h>
  591. ],[
  592. addwstr(L"test");
  593. add_wch(WACS_VLINE);
  594. ])
  595. ],[
  596. AC_MSG_RESULT([yes])
  597. AC_DEFINE([USE_UNICODE],[1],[Defined to 1 if curses supports wide characters])
  598. ],[
  599. AC_MSG_RESULT([no])
  600. ])
  601. fi
  602. LIBS="$orig_libs"
  603. fi
  604. 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])
  605. if test "x$with_system_libblkmaker" = "xyes"; then
  606. PKG_CHECK_MODULES([libblkmaker],[libblkmaker_jansson-0.1],[
  607. true
  608. ],[
  609. AC_MSG_ERROR([Could not find system libblkmaker])
  610. ])
  611. else
  612. save_LDFLAGS="$LDFLAGS"
  613. LDFLAGS="$LDFLAGS -Wl,-zorigin"
  614. origin_LDFLAGS=
  615. AC_MSG_CHECKING([whether the linker recognizes the -zorigin option])
  616. AC_TRY_LINK([],[],[
  617. AC_MSG_RESULT([yes])
  618. origin_LDFLAGS=',-zorigin'
  619. ],[
  620. AC_MSG_RESULT([no])
  621. ])
  622. LDFLAGS="$save_LDFLAGS"
  623. libblkmaker_CFLAGS='-Ilibblkmaker'
  624. libblkmaker_LDFLAGS='-Llibblkmaker/.libs -Wl,-rpath,\$$ORIGIN/libblkmaker/.libs'"$origin_LDFLAGS"
  625. libblkmaker_LIBS='-lblkmaker_jansson-0.1 -lblkmaker-0.1'
  626. AC_CONFIG_SUBDIRS([libblkmaker])
  627. fi
  628. AC_SUBST(libblkmaker_CFLAGS)
  629. AC_SUBST(libblkmaker_LDFLAGS)
  630. AC_SUBST(libblkmaker_LIBS)
  631. AM_CONDITIONAL([NEED_LIBBLKMAKER], [test x$with_system_libblkmaker != xyes])
  632. AM_CONDITIONAL([NEED_DYNCLOCK], [test x$need_dynclock = xyes])
  633. AM_CONDITIONAL([NEED_FPGAUTILS], [test x$need_fpgautils = xyes])
  634. AM_CONDITIONAL([HAS_SCRYPT], [test x$scrypt = xyes])
  635. AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
  636. AM_CONDITIONAL([HAVE_SENSORS], [test x$with_sensors = xyes])
  637. AM_CONDITIONAL([HAVE_CYGWIN], [test x$have_cygwin = xtrue])
  638. AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
  639. AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
  640. AM_CONDITIONAL([HAS_FPGA], [test x$bitforce$icarus$modminer$x6500$ztex != xnonononono])
  641. AM_CONDITIONAL([HAS_ASIC], [test x$avalon$icarus$httpsrv != xnonono])
  642. dnl Find YASM
  643. has_yasm=false
  644. if test "x$have_x86_32$have_x86_64" != "xfalsefalse"; then
  645. AC_PATH_PROG([YASM],[yasm],[false])
  646. if test "x$YASM" != "xfalse" ; then
  647. AC_MSG_CHECKING([if yasm version is greater than 1.0.1])
  648. yasmver=`"$YASM" --version | head -1 | cut -d\ -f2`
  649. yamajor=`echo $yasmver | cut -d. -f1`
  650. yaminor=`echo $yasmver | cut -d. -f2`
  651. yamini=`echo $yasmver | cut -d. -f3`
  652. if test "$yamajor" -ge "1" ; then
  653. if test "$yamajor" -eq "1" ; then
  654. if test "$yaminor" -ge "0" ; then
  655. if test "$yaminor" -eq "0"; then
  656. if test "$yamini" -ge "1"; then
  657. has_yasm=true
  658. fi
  659. else
  660. has_yasm=true
  661. fi
  662. fi
  663. fi
  664. else
  665. has_yasm=false
  666. fi
  667. if test "x$has_yasm" = "xtrue" ; then
  668. AC_MSG_RESULT([yes])
  669. else
  670. AC_MSG_RESULT([no])
  671. fi
  672. fi
  673. if test "x$has_yasm" = "xfalse" ; then
  674. AC_MSG_NOTICE([yasm is required for the assembly algorithms. They will be skipped.])
  675. else
  676. AC_DEFINE([HAVE_YASM], [1], [Defined to 1 if yasm is being used])
  677. if test "x$have_win32$have_cygwin" != "xfalsefalse"; then
  678. if test "x$have_x86_64" = xtrue; then
  679. YASM_FMT="win64"
  680. else
  681. YASM_FMT="coff"
  682. fi
  683. elif test "x$have_macho" = "xtrue"; then
  684. YASM_FMT="macho$bitness"
  685. else
  686. YASM_FMT="elf$bitness"
  687. fi
  688. fi
  689. fi
  690. AM_CONDITIONAL([HAS_YASM], [test x$has_yasm = xtrue])
  691. have_sse2=no
  692. if test "x$cpumining$have_x86_32" = "xyestrue"; then
  693. AC_MSG_CHECKING([if SSE2 code compiles])
  694. save_CFLAGS="$CFLAGS"
  695. for flags in '' '-msse2'; do
  696. CFLAGS="$CFLAGS $flags"
  697. AC_TRY_LINK([
  698. #include <xmmintrin.h>
  699. ],[
  700. int *i = (int *)0xdeadbeef;
  701. __m128i a, b;
  702. a = _mm_set1_epi32(i[0]);
  703. b = _mm_set_epi32(i[0], i[1], i[2], i[3]);
  704. a = _mm_add_epi32(a, b);
  705. a = _mm_andnot_si128(a, b);
  706. a = _mm_or_si128(a, b);
  707. a = _mm_slli_epi32(a, i[4]);
  708. a = _mm_and_si128(a, b);
  709. a = _mm_xor_si128(a, b);
  710. ],[
  711. if test "x$flags" = "x"; then
  712. AC_MSG_RESULT([yes])
  713. else
  714. AC_MSG_RESULT([with $flags])
  715. fi
  716. SSE2_CFLAGS="$flags"
  717. have_sse2=yes
  718. break
  719. ],[
  720. true
  721. ])
  722. done
  723. CFLAGS="${save_CFLAGS}"
  724. if test "x$have_sse2" = "xyes"; then
  725. AC_DEFINE([HAVE_SSE2], [1], [Defined to 1 if yasm is being used])
  726. else
  727. AC_MSG_RESULT([no])
  728. fi
  729. fi
  730. AM_CONDITIONAL([HAVE_SSE2], [test "x$have_sse2" = "xyes"])
  731. if test "x$need_fpgautils" = "xyes"; then
  732. AC_ARG_WITH([libudev], [AC_HELP_STRING([--without-libudev], [Autodetect FPGAs using libudev (default enabled)])],
  733. [libudev=$withval],
  734. [libudev=auto]
  735. )
  736. if test "x$libudev" != "xno"; then
  737. AC_CHECK_HEADER([libudev.h],[
  738. libudev=yes
  739. UDEV_LIBS=-ludev
  740. AC_DEFINE([HAVE_LIBUDEV], [1], [Defined to 1 if libudev is wanted])
  741. ], [
  742. if test "x$libudev" = "xyes"; then
  743. AC_MSG_ERROR([libudev not found])
  744. fi
  745. libudev=no
  746. ])
  747. fi
  748. fi
  749. AM_CONDITIONAL([HAVE_LIBUDEV], [test x$libudev != xno])
  750. AC_SUBST(LIBUSB_LIBS)
  751. AC_SUBST(LIBUSB_CFLAGS)
  752. PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.18.2], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.18.2])])
  753. if echo "$LIBCURL_CFLAGS" | grep '@CPPFLAG_CURL_STATICLIB@' >/dev/null 2>&1; then
  754. AC_MSG_WARN([Your libcurl pkgconfig file is broken, applying workaround])
  755. LIBCURL_CFLAGS=`echo "$LIBCURL_CFLAGS" | sed 's/@CPPFLAG_CURL_STATICLIB@//'`
  756. fi
  757. AC_SUBST(LIBCURL_LIBS)
  758. AC_CHECK_FUNCS([setrlimit])
  759. dnl CCAN wants to know a lot of vars.
  760. # All the configuration checks. Regrettably, the __attribute__ checks will
  761. # give false positives on old GCCs, since they just cause warnings. But that's
  762. # fairly harmless.
  763. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((cold)) cleanup(void) { }])],
  764. AC_DEFINE([HAVE_ATTRIBUTE_COLD], [1],
  765. [Define if __attribute__((cold))]))
  766. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((const)) cleanup(void) { }])],
  767. AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1],
  768. [Define if __attribute__((const))]))
  769. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((noreturn)) cleanup(void) { exit(1); }])],
  770. [
  771. AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
  772. [Define if __attribute__((noreturn))])
  773. AC_DEFINE_UNQUOTED([NORETURN], [__attribute__((noreturn))], [Syntax of noreturn attribute])
  774. ], [
  775. AC_DEFINE_UNQUOTED([NORETURN], [])
  776. ]
  777. )
  778. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((format(__printf__, 1, 2))) cleanup(const char *fmt, ...) { }])],
  779. AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1],
  780. [Define if __attribute__((format(__printf__)))]))
  781. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((unused)) cleanup(void) { }])],
  782. AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1],
  783. [Define if __attribute__((unused))]))
  784. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((used)) cleanup(void) { }])],
  785. AC_DEFINE([HAVE_ATTRIBUTE_USED], [1],
  786. [Define if __attribute__((used))]))
  787. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_constant_p(1) ? 0 : 1; }])],
  788. AC_DEFINE([HAVE_BUILTIN_CONSTANT_P], [1],
  789. [Define if have __builtin_constant_p]))
  790. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_types_compatible_p(char *, int) ? 1 : 0; }])],
  791. AC_DEFINE([HAVE_BUILTIN_TYPES_COMPATIBLE_P], [1],
  792. [Define if have __builtin_types_compatible_p]))
  793. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static int __attribute__((warn_unused_result)) func(int x) { return x; }])],
  794. AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1],
  795. [Define if __attribute__((warn_unused_result))]))
  796. AC_MSG_CHECKING([for roundl function])
  797. save_LIBS="${LIBS}"
  798. LIBS="$LIBS -lm"
  799. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  800. #include <math.h>
  801. ]], [[
  802. return (roundl(*(long double *)0xdeadbeef) == 1.0);
  803. ]])], [
  804. AC_MSG_RESULT([yes])
  805. ], [
  806. AC_MSG_RESULT([no])
  807. AC_DEFINE([NEED_ROUNDL], [1], [Defined to 1 if C99 roundl is missing])
  808. ])
  809. LIBS="${save_LIBS}"
  810. # byteswap functions
  811. AH_TEMPLATE([HAVE_BYTESWAP_H], [Define to use byteswap macros from byteswap.h])
  812. AH_TEMPLATE([HAVE_ENDIAN_H], [Define to use byteswap macros from endian.h])
  813. AH_TEMPLATE([HAVE_SYS_ENDIAN_H], [Define to use byteswap macros from sys/endian.h])
  814. AH_TEMPLATE([HAVE_LIBKERN_OSBYTEORDER_H], [Define to use byteswap macros from libkern/OSByteOrder.h])
  815. BSWAP=''
  816. for sym in bswap_ __builtin_bswap __bswap_ __swap swap OSSwapInt; do
  817. AC_MSG_CHECKING([for ${sym}* functions])
  818. for headerfile in '' byteswap.h endian.h sys/endian.h libkern/OSByteOrder.h; do
  819. BFG_INCLUDE([headerinclude], [${headerfile}])
  820. AC_LINK_IFELSE([
  821. AC_LANG_PROGRAM([
  822. ${headerinclude}
  823. ], [
  824. (void) ${sym}16(0);
  825. (void) ${sym}32(0);
  826. (void) ${sym}64(0);
  827. ])
  828. ], [
  829. BSWAP="${sym}"
  830. if test "x${headerfile}" = "x"; then
  831. AC_MSG_RESULT([yes])
  832. else
  833. AC_MSG_RESULT([found in ${headerfile}])
  834. AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$headerfile]), 1)
  835. fi
  836. break 2
  837. ])
  838. done
  839. AC_MSG_RESULT([no])
  840. done
  841. if test "x$BSWAP" = "x"; then
  842. true # Substitutes are provided in miner.h
  843. elif test "x$BSWAP" = "xbswap_"; then
  844. AC_MSG_CHECKING([if bswap_16 is already a macro])
  845. BFG_PREPROC_IFELSE([defined(bswap_16)], $headerfile, [
  846. AC_MSG_RESULT([yes])
  847. BSWAP=""
  848. ],[
  849. AC_MSG_RESULT([no])
  850. ])
  851. fi
  852. if test "x$BSWAP" != "x"; then
  853. AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, [Define to 16-bit byteswap macro])
  854. AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, [Define to 16-bit byteswap macro])
  855. AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, [Define to 16-bit byteswap macro])
  856. fi
  857. # endian definition macros
  858. AC_MSG_CHECKING([for platform endian])
  859. found_endian=no
  860. for headerfile in '' endian.h sys/endian.h sys/param.h; do
  861. for pfx in '' '__'; do
  862. 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}, [
  863. if test "x$headerfile" = "x"; then
  864. headerfilec=''
  865. else
  866. headerfilec=" (${headerfile})"
  867. fi
  868. BFG_PREPROC_IFELSE([${pfx}BYTE_ORDER == ${pfx}BIG_ENDIAN], ${headerfile}, [
  869. AC_MSG_RESULT([big endian${headerfilec}])
  870. AC_DEFINE(WORDS_BIGENDIAN, 1, [Define if your platform is big endian])
  871. ], [
  872. AC_MSG_RESULT([little endian${headerfilec}])
  873. ])
  874. found_endian=yes
  875. break 2
  876. ],[true])
  877. done
  878. done
  879. if test "x$found_endian" = "xno"; then
  880. if $have_win32 || $have_cygwin; then
  881. AC_MSG_RESULT([assuming little endian (Windows)])
  882. else
  883. # AC_C_BIGENDIAN is reported to have problems, and invasive even if buried in a conditional, so don't use it
  884. AC_MSG_RESULT([unknown])
  885. AC_MSG_ERROR([Unable to identify platform endian])
  886. fi
  887. fi
  888. AC_MSG_CHECKING([if GNU format attribute compiles])
  889. AC_TRY_COMPILE([
  890. #define FORMAT_SYNTAX_CHECK(...) __attribute__(( format(__VA_ARGS__) ))
  891. int myfunc(char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
  892. int myfunc(char *fmt, ...) {
  893. return 42;
  894. }
  895. ], [
  896. myfunc("abc%d", 42);
  897. ], [
  898. AC_MSG_RESULT([yes])
  899. AC_DEFINE_UNQUOTED([FORMAT_SYNTAX_CHECK(...)], [__attribute__(( format(__VA_ARGS__) ))], [Syntax of format-checking attribute])
  900. ], [
  901. AC_MSG_RESULT([no])
  902. AC_DEFINE_UNQUOTED([FORMAT_SYNTAX_CHECK(...)], [])
  903. ])
  904. AC_MSG_CHECKING([for clock_gettime(CLOCK_MONOTONIC)])
  905. AC_TRY_COMPILE([
  906. #define _GNU_SOURCE
  907. #include <time.h>
  908. ],[
  909. struct timespec ts;
  910. clock_gettime(CLOCK_MONOTONIC, &ts);
  911. ],[
  912. AC_MSG_RESULT([yes])
  913. AC_DEFINE([HAVE_CLOCK_GETTIME_MONOTONIC], [1], [Defined to 1 if clock_gettime(CLOCK_MONOTONIC) is defined])
  914. save_LIBS="${LIBS}"
  915. AC_SEARCH_LIBS([clock_gettime],[rt posix4],[
  916. if test "x${ac_cv_search_clock_gettime}" != "xnone required"; then
  917. RT_LIBS="${ac_cv_search_clock_gettime}"
  918. fi
  919. ])
  920. LIBS="${save_LIBS}"
  921. AC_CHECK_FUNCS([clock_nanosleep])
  922. AC_MSG_CHECKING([for clock_gettime(CLOCK_MONOTONIC_RAW)])
  923. AC_TRY_COMPILE([
  924. #define _GNU_SOURCE
  925. #include <time.h>
  926. ],[
  927. struct timespec ts;
  928. clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
  929. ],[
  930. AC_MSG_RESULT([yes])
  931. AC_DEFINE([HAVE_CLOCK_GETTIME_MONOTONIC_RAW], [1], [Defined to 1 if clock_gettime(CLOCK_MONOTONIC_RAW) is defined])
  932. ],[
  933. AC_MSG_RESULT([no])
  934. ])
  935. ],[
  936. AC_MSG_RESULT([no])
  937. ])
  938. if test "x$prefix" = xNONE; then
  939. prefix=/usr/local
  940. fi
  941. AM_CONDITIONAL([NEED_BITSTREAM_FPGAMINER], [test x$modminer$x6500 != xnono])
  942. AC_DEFINE_UNQUOTED([PHATK_KERNNAME], ["phatk121016"], [Filename for phatk kernel])
  943. AC_DEFINE_UNQUOTED([POCLBM_KERNNAME], ["poclbm130302"], [Filename for poclbm kernel])
  944. AC_DEFINE_UNQUOTED([DIAKGCN_KERNNAME], ["diakgcn121016"], [Filename for diakgcn kernel])
  945. AC_DEFINE_UNQUOTED([DIABLO_KERNNAME], ["diablo130302"], [Filename for diablo kernel])
  946. AC_DEFINE_UNQUOTED([SCRYPT_KERNNAME], ["scrypt130511"], [Filename for scrypt kernel])
  947. AC_SUBST(PTHREAD_FLAGS)
  948. AC_SUBST(DLOPEN_FLAGS)
  949. AC_SUBST(PTHREAD_LIBS)
  950. AC_SUBST(NCURSES_CPPFLAGS)
  951. AC_SUBST(NCURSES_LIBS)
  952. AC_SUBST(PDCURSES_LIBS)
  953. AC_SUBST(WS2_LIBS)
  954. AC_SUBST(MM_LIBS)
  955. AC_SUBST(MATH_LIBS)
  956. AC_SUBST(RT_LIBS)
  957. AC_SUBST(UDEV_LIBS)
  958. AC_SUBST(SSE2_CFLAGS)
  959. AC_SUBST(YASM_FMT)
  960. AC_CONFIG_FILES([
  961. Makefile
  962. x86_64/Makefile
  963. x86_32/Makefile
  964. ccan/Makefile
  965. lib/Makefile
  966. ])
  967. AC_OUTPUT
  968. echo
  969. echo
  970. echo
  971. echo "------------------------------------------------------------------------"
  972. echo "$PACKAGE $VERSION"
  973. echo "------------------------------------------------------------------------"
  974. echo
  975. echo
  976. echo "Configuration Options Summary:"
  977. echo
  978. echo " curses.TUI...........: $cursesmsg"
  979. if test "x$scrypt" != xno; then
  980. echo " scrypt...............: Enabled"
  981. else
  982. echo " scrypt...............: Disabled"
  983. fi
  984. echo
  985. if test "x$opencl" = xyes; then
  986. echo " OpenCL...............: Enabled"
  987. else
  988. echo " OpenCL...............: Disabled"
  989. fi
  990. if test "x$with_sensors" = xyes; then
  991. echo " sensors.monitoring.: Enabled"
  992. elif test "x$opencl" = xyes; then
  993. echo " sensors.monitoring.: Disabled"
  994. else
  995. echo " sensors.monitoring.: n/a"
  996. fi
  997. if test "x$adl" = xyes; then
  998. echo " ADL.monitoring.....: Enabled"
  999. elif test "x$opencl" = xyes; then
  1000. echo " ADL.monitoring.....: Disabled"
  1001. else
  1002. echo " ADL.monitoring.....: n/a"
  1003. fi
  1004. if test "x$avalon" = xyes; then
  1005. echo " Avalon.ASICs.........: Enabled"
  1006. else
  1007. echo " Avalon.ASICs.........: Disabled"
  1008. fi
  1009. if test "x$bigpic" = xyes; then
  1010. echo " BPM.USB.ASICs........: Enabled"
  1011. else
  1012. echo " BPM.USB.ASICs........: Disabled"
  1013. fi
  1014. if test "x$bitforce" = xyes; then
  1015. echo " BitForce.devices.....: Enabled"
  1016. else
  1017. echo " BitForce.devices.....: Disabled"
  1018. fi
  1019. if test "x$icarus" = xyes; then
  1020. echo " Icarus.FPGAs.........: Enabled"
  1021. else
  1022. echo " Icarus.FPGAs.........: Disabled"
  1023. fi
  1024. if test "x$modminer" = xyes; then
  1025. echo " ModMiner.FPGAs.......: Enabled"
  1026. else
  1027. echo " ModMiner.FPGAs.......: Disabled"
  1028. fi
  1029. if test "x$x6500" = xyes; then
  1030. echo " X6500.FPGAs..........: Enabled"
  1031. elif test "x$ztexwarn" = xyes; then
  1032. echo " X6500.FPGAs..........: Disabled (libusb not found)"
  1033. else
  1034. echo " X6500.FPGAs..........: Disabled"
  1035. fi
  1036. if test "x$ztex" = xyes; then
  1037. echo " ZTEX.FPGAs...........: Enabled"
  1038. elif test "x$ztexwarn" = xyes; then
  1039. echo " ZTEX.FPGAs...........: Disabled (libusb not found)"
  1040. else
  1041. echo " ZTEX.FPGAs...........: Disabled"
  1042. fi
  1043. if test "x$need_fpgautils" = xyes; then
  1044. echo " libudev.detection....: $libudev"
  1045. fi
  1046. if test "x$bitfury" = xyes; then
  1047. echo " Bitfury.ASICs........: Enabled"
  1048. else
  1049. echo " Bitfury.ASICs........: Disabled"
  1050. fi
  1051. echo
  1052. if test "x$cpumining" = xyes; then
  1053. echo " CPU Mining...........: Enabled"
  1054. echo " ASM.(for CPU mining).: $has_yasm"
  1055. else
  1056. echo " CPU Mining...........: Disabled"
  1057. fi
  1058. echo
  1059. echo "Compilation............: make (or gmake)"
  1060. echo " CPPFLAGS.............:" $CPPFLAGS $NCURSES_CPPFLAGS $PTHREAD_FLAGS
  1061. echo " CFLAGS...............:" $CFLAGS $LIBUSB_CFLAGS $JANSSON_CFLAGS $PTHREAD_FLAGS
  1062. echo " LDFLAGS..............:" $LDFLAGS $PTHREAD_FLAGS $PTHREAD_LIBS
  1063. echo " LDADD................:" $LIBS $DLOPEN_FLAGS $LIBCURL_LIBS $JANSSON_LIBS $NCURSES_LIBS $PDCURSES_LIBS $WS2_LIBS $MATH_LIBS $UDEV_LIBS $LIBUSB_LIBS
  1064. echo
  1065. echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
  1066. echo " prefix...............: $prefix"
  1067. echo