configure.ac 34 KB

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