configure.ac 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870
  1. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  2. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  3. m4_define([v_maj], [4])
  4. m4_define([v_min], [7])
  5. m4_define([v_mic], [0])
  6. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  7. m4_define([v_ver], [v_maj.v_min.v_mic-scrypt-wrk])
  8. m4_define([lt_rev], m4_eval(v_maj + v_min))
  9. m4_define([lt_cur], v_mic)
  10. m4_define([lt_age], v_min)
  11. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  12. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  13. AC_INIT([cgminer], [v_ver], [kernel@kolivas.org])
  14. AC_PREREQ(2.59)
  15. AC_CANONICAL_SYSTEM
  16. AC_CONFIG_MACRO_DIR([m4])
  17. AC_CONFIG_SRCDIR([cgminer.c])
  18. AC_CONFIG_HEADERS([config.h])
  19. AM_INIT_AUTOMAKE([foreign subdir-objects])
  20. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  21. AC_USE_SYSTEM_EXTENSIONS
  22. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  23. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  24. m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
  25. m4_ifdef([v_rel], , [m4_define([v_rel], [])])
  26. AC_DEFINE_UNQUOTED(CGMINER_MAJOR_VERSION, [v_maj], [Major version])
  27. AC_DEFINE_UNQUOTED(CGMINER_MINOR_VERSION, [v_min], [Minor version])
  28. AC_DEFINE_UNQUOTED(CGMINER_MINOR_SUBVERSION, [v_mic], [Micro version])
  29. version_info="lt_rev:lt_cur:lt_age"
  30. release_info="v_rel"
  31. AC_SUBST(version_info)
  32. AC_SUBST(release_info)
  33. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  34. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  35. VMAJ=v_maj
  36. AC_SUBST(VMAJ)
  37. AC_CANONICAL_BUILD
  38. AC_CANONICAL_HOST
  39. dnl Make sure anyone changing configure.ac/Makefile.am has a clue
  40. AM_MAINTAINER_MODE
  41. dnl Checks for programs
  42. AC_PROG_CC
  43. gl_EARLY
  44. AC_PROG_GCC_TRADITIONAL
  45. AM_PROG_CC_C_O
  46. LT_INIT([disable-shared])
  47. gl_INIT
  48. dnl Checks for header files.
  49. AC_HEADER_STDC
  50. AC_CHECK_HEADERS(syslog.h)
  51. AC_FUNC_ALLOCA
  52. have_win32=false
  53. PTHREAD_FLAGS="-lpthread"
  54. DLOPEN_FLAGS="-ldl"
  55. WS2_LIBS=""
  56. MM_LIBS=""
  57. MATH_LIBS="-lm"
  58. RT_LIBS="-lrt"
  59. case $target in
  60. amd64-*)
  61. have_x86_64=true
  62. ;;
  63. x86_64-*)
  64. have_x86_64=true
  65. ;;
  66. *)
  67. have_x86_64=false
  68. ;;
  69. esac
  70. case $target in
  71. *-*-linux-gnu*)
  72. have_linux=true
  73. ;;
  74. *-*-mingw*)
  75. have_win32=true
  76. PTHREAD_FLAGS=""
  77. DLOPEN_FLAGS=""
  78. WS2_LIBS="-lws2_32"
  79. MM_LIBS="-lwinmm"
  80. RT_LIBS=""
  81. AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support")
  82. ;;
  83. powerpc-*-darwin*)
  84. have_darwin=true
  85. CFLAGS="$CFLAGS -faltivec"
  86. PTHREAD_FLAGS=""
  87. RT_LIBS=""
  88. ;;
  89. *-*-darwin*)
  90. have_darwin=true
  91. PTHREAD_FLAGS=""
  92. RT_LIBS=""
  93. ;;
  94. esac
  95. has_winpthread=false
  96. if test "x$have_win32" = xtrue; then
  97. has_winpthread=true
  98. AC_CHECK_LIB(winpthread, nanosleep, , has_winpthread=false)
  99. PTHREAD_LIBS=-lwinpthread
  100. fi
  101. if test "x$has_winpthread" != xtrue; then
  102. AC_CHECK_LIB(pthread, pthread_create, ,
  103. AC_MSG_ERROR([Could not find pthread library - please install libpthread]))
  104. PTHREAD_LIBS=-lpthread
  105. fi
  106. scrypt="no"
  107. AC_ARG_ENABLE([scrypt],
  108. [AC_HELP_STRING([--enable-scrypt],[Compile support for scrypt mining (default disabled)])],
  109. [scrypt=$enableval]
  110. )
  111. if test "x$scrypt" = xyes; then
  112. AC_DEFINE([USE_SCRYPT], [1], [Defined to 1 if scrypt support is wanted])
  113. fi
  114. AM_CONDITIONAL([HAS_SCRYPT], [test x$scrypt = xyes])
  115. # Drivers that are designed to be run on dedicated hardware should set standalone to yes
  116. # All drivers should prepend an x to the drivercount
  117. standalone="no"
  118. ants1="no"
  119. drivercount=""
  120. AC_ARG_ENABLE([ants1],
  121. [AC_HELP_STRING([--enable-ants1],[Compile support for Antminer S1 Bitmain STANDALONE(default disabled)])],
  122. [ants1=$enableval]
  123. )
  124. if test "x$ants1" = xyes; then
  125. AC_DEFINE([USE_ANT_S1], [1], [Defined to 1 if Antminer S1 Bitmain support is wanted])
  126. drivercount=x$drivercount
  127. standalone="yes"
  128. fi
  129. AM_CONDITIONAL([HAS_ANT_S1], [test x$ants1 = xyes])
  130. ants2="no"
  131. AC_ARG_ENABLE([ants2],
  132. [AC_HELP_STRING([--enable-ants2],[Compile support for Antminer S2 Bitmain STANDALONE(default disabled)])],
  133. [ants2=$enableval]
  134. )
  135. if test "x$ants2" = xyes; then
  136. AC_DEFINE([USE_ANT_S2], [1], [Defined to 1 if Antminer S2 Bitmain support is wanted])
  137. drivercount=x$drivercount
  138. standalone="yes"
  139. fi
  140. AM_CONDITIONAL([HAS_ANT_S2], [test x$ants2 = xyes])
  141. avalon="no"
  142. AC_ARG_ENABLE([avalon],
  143. [AC_HELP_STRING([--enable-avalon],[Compile support for Avalon (default disabled)])],
  144. [avalon=$enableval]
  145. )
  146. if test "x$avalon" = xyes; then
  147. AC_DEFINE([USE_AVALON], [1], [Defined to 1 if Avalon support is wanted])
  148. drivercount=x$drivercount
  149. fi
  150. AM_CONDITIONAL([HAS_AVALON], [test x$avalon = xyes])
  151. avalon2="no"
  152. AC_ARG_ENABLE([avalon2],
  153. [AC_HELP_STRING([--enable-avalon2],[Compile support for Avalon2 (default disabled)])],
  154. [avalon2=$enableval]
  155. )
  156. if test "x$avalon2" = xyes; then
  157. AC_DEFINE([USE_AVALON2], [1], [Defined to 1 if Avalon2 support is wanted])
  158. drivercount=x$drivercount
  159. fi
  160. AM_CONDITIONAL([HAS_AVALON2], [test x$avalon2 = xyes])
  161. bab="no"
  162. AC_ARG_ENABLE([bab],
  163. [AC_HELP_STRING([--enable-bab],[Compile support for BlackArrow Bitfury STANDALONE(default disabled)])],
  164. [bab=$enableval]
  165. )
  166. if test "x$bab" = xyes; then
  167. AC_DEFINE([USE_BAB], [1], [Defined to 1 if BlackArrow Bitfury support is wanted])
  168. drivercount=x$drivercount
  169. standalone="yes"
  170. fi
  171. AM_CONDITIONAL([HAS_BAB], [test x$bab = xyes])
  172. bflsc="no"
  173. AC_ARG_ENABLE([bflsc],
  174. [AC_HELP_STRING([--enable-bflsc],[Compile support for BFL ASICs (default disabled)])],
  175. [bflsc=$enableval]
  176. )
  177. if test "x$bflsc" = xyes; then
  178. AC_DEFINE([USE_BFLSC], [1], [Defined to 1 if BFL ASIC support is wanted])
  179. drivercount=x$drivercount
  180. fi
  181. AM_CONDITIONAL([HAS_BFLSC], [test x$bflsc = xyes])
  182. bitforce="no"
  183. AC_ARG_ENABLE([bitforce],
  184. [AC_HELP_STRING([--enable-bitforce],[Compile support for BitForce FPGAs (default disabled)])],
  185. [bitforce=$enableval]
  186. )
  187. if test "x$bitforce" = xyes; then
  188. AC_DEFINE([USE_BITFORCE], [1], [Defined to 1 if BitForce support is wanted])
  189. drivercount=x$drivercount
  190. fi
  191. AM_CONDITIONAL([HAS_BITFORCE], [test x$bitforce = xyes])
  192. bitfury="no"
  193. AC_ARG_ENABLE([bitfury],
  194. [AC_HELP_STRING([--enable-bitfury],[Compile support for BitFury ASICs (default disabled)])],
  195. [bitfury=$enableval]
  196. )
  197. if test "x$bitfury" = xyes; then
  198. AC_DEFINE([USE_BITFURY], [1], [Defined to 1 if BitFury ASIC support is wanted])
  199. drivercount=x$drivercount
  200. fi
  201. AM_CONDITIONAL([HAS_BITFURY], [test x$bitfury = xyes])
  202. bitmine_A1="no"
  203. AC_ARG_ENABLE([bitmine_A1],
  204. [AC_HELP_STRING([--enable-bitmine_A1],[Compile support for Bitmine.ch A1 ASICs STANDALONE(default disabled)])],
  205. [bitmine_A1=$enableval]
  206. )
  207. if test "x$bitmine_A1" = xyes; then
  208. AC_DEFINE([USE_BITMINE_A1], [1], [Defined to 1 if Bitmine A1 support is wanted])
  209. drivercount=x$drivercount
  210. standalone="yes"
  211. fi
  212. AM_CONDITIONAL([HAS_BITMINE_A1], [test x$bitmine_A1 = xyes])
  213. blockerupter="no"
  214. AC_ARG_ENABLE([blockerupter],
  215. [AC_HELP_STRING([--enable-blockerupter],[Compile support for BlockErupter (default disabled)])],
  216. [blockerupter=$enableval]
  217. )
  218. if test "x$blockerupter" = xyes; then
  219. AC_DEFINE([USE_BLOCKERUPTER], [1], [Defined to 1 if BlockErupter support is wanted])
  220. drivercount=x$drivercount
  221. fi
  222. AM_CONDITIONAL([HAS_BLOCKERUPTER], [test x$blockerupter = xyes])
  223. cointerra="no"
  224. AC_ARG_ENABLE([cointerra],
  225. [AC_HELP_STRING([--enable-cointerra],[Compile support for Cointerra ASICs (default disabled)])],
  226. [cointerra=$enableval]
  227. )
  228. if test "x$cointerra" = xyes; then
  229. AC_DEFINE([USE_COINTERRA], [1], [Defined to 1 if Cointerra support is wanted])
  230. drivercount=x$drivercount
  231. fi
  232. AM_CONDITIONAL([HAS_COINTERRA], [test x$cointerra = xyes])
  233. drillbit="no"
  234. AC_ARG_ENABLE([drillbit],
  235. [AC_HELP_STRING([--enable-drillbit],[Compile support for Drillbit BitFury ASICs (default disabled)])],
  236. [drillbit=$enableval]
  237. )
  238. if test "x$drillbit" = xyes; then
  239. AC_DEFINE([USE_DRILLBIT], [1], [Defined to 1 if Drillbit BitFury support is wanted])
  240. drivercount=x$drivercount
  241. fi
  242. AM_CONDITIONAL([HAS_DRILLBIT], [test x$drillbit = xyes])
  243. hashfast="no"
  244. AC_ARG_ENABLE([hashfast],
  245. [AC_HELP_STRING([--enable-hashfast],[Compile support for Hashfast (default disabled)])],
  246. [hashfast=$enableval]
  247. )
  248. if test "x$hashfast" = xyes; then
  249. AC_DEFINE([USE_HASHFAST], [1], [Defined to 1 if Hashfast support is wanted])
  250. drivercount=x$drivercount
  251. fi
  252. AM_CONDITIONAL([HAS_HASHFAST], [test x$hashfast = xyes])
  253. hashratio="no"
  254. AC_ARG_ENABLE([hashratio],
  255. [AC_HELP_STRING([--enable-hashratio],[Compile support for Hashratio (default disabled)])],
  256. [hashratio=$enableval]
  257. )
  258. if test "x$hashratio" = xyes; then
  259. AC_DEFINE([USE_HASHRATIO], [1], [Defined to 1 if Hashratiosupport is wanted])
  260. drivercount=x$drivercount
  261. fi
  262. AM_CONDITIONAL([HAS_HASHRATIO], [test x$hashratio = xyes])
  263. icarus="no"
  264. AC_ARG_ENABLE([icarus],
  265. [AC_HELP_STRING([--enable-icarus],[Compile support for Icarus (default disabled)])],
  266. [icarus=$enableval]
  267. )
  268. if test "x$icarus" = xyes; then
  269. AC_DEFINE([USE_ICARUS], [1], [Defined to 1 if Icarus support is wanted])
  270. drivercount=x$drivercount
  271. fi
  272. AM_CONDITIONAL([HAS_ICARUS], [test x$icarus = xyes])
  273. klondike="no"
  274. AC_ARG_ENABLE([klondike],
  275. [AC_HELP_STRING([--enable-klondike],[Compile support for Klondike (default disabled)])],
  276. [klondike=$enableval]
  277. )
  278. if test "x$klondike" = xyes; then
  279. AC_DEFINE([USE_KLONDIKE], [1], [Defined to 1 if Klondike support is wanted])
  280. drivercount=x$drivercount
  281. fi
  282. AM_CONDITIONAL([HAS_KLONDIKE], [test x$klondike = xyes])
  283. knc="no"
  284. AC_ARG_ENABLE([knc],
  285. [AC_HELP_STRING([--enable-knc],[Compile support for KnC miners STANDALONE(default disabled)])],
  286. [knc=$enableval]
  287. )
  288. if test "x$knc" = xyes; then
  289. AC_DEFINE([USE_KNC], [1], [Defined to 1 if KnC miner support is wanted])
  290. drivercount=x$drivercount
  291. standalone="yes"
  292. fi
  293. AM_CONDITIONAL([HAS_KNC], [test x$knc = xyes])
  294. minion="no"
  295. AC_ARG_ENABLE([minion],
  296. [AC_HELP_STRING([--enable-minion],[Compile support for Minion BlackArrow ASIC STANDALONE(default disabled)])],
  297. [minion=$enableval]
  298. )
  299. if test "x$minion" = xyes; then
  300. AC_DEFINE([USE_MINION], [1], [Defined to 1 if Minion BlackArrow ASIC support is wanted])
  301. drivercount=x$drivercount
  302. standalone="yes"
  303. fi
  304. AM_CONDITIONAL([HAS_MINION], [test x$minion = xyes])
  305. modminer="no"
  306. AC_ARG_ENABLE([modminer],
  307. [AC_HELP_STRING([--enable-modminer],[Compile support for ModMiner FPGAs(default disabled)])],
  308. [modminer=$enableval]
  309. )
  310. if test "x$modminer" = xyes; then
  311. AC_DEFINE([USE_MODMINER], [1], [Defined to 1 if ModMiner support is wanted])
  312. drivercount=x$drivercount
  313. fi
  314. AM_CONDITIONAL([HAS_MODMINER], [test x$modminer = xyes])
  315. sp10="no"
  316. AC_ARG_ENABLE([sp10],
  317. [AC_HELP_STRING([--enable-sp10],[Compile support for Spondoolies SP10 STANDALONE(default disabled)])],
  318. [sp10=$enableval]
  319. )
  320. if test "x$sp10" = xyes; then
  321. AC_DEFINE([USE_SP10], [1], [Defined to 1 if Spondoolies SP10 support is wanted])
  322. drivercount=x$drivercount
  323. standalone="yes"
  324. fi
  325. AM_CONDITIONAL([HAS_SP10], [test x$sp10 = xyes])
  326. sp30="no"
  327. AC_ARG_ENABLE([sp30],
  328. [AC_HELP_STRING([--enable-sp30],[Compile support for Spondoolies SP30 STANDALONE(default disabled)])],
  329. [sp30=$enableval]
  330. )
  331. if test "x$sp30" = xyes; then
  332. AC_DEFINE([USE_SP30], [1], [Defined to 1 if SP30 support is wanted])
  333. drivercount=x$drivercount
  334. standalone="yes"
  335. fi
  336. AM_CONDITIONAL([HAS_SP30], [test x$sp30 = xyes])
  337. gridseed="no"
  338. AC_ARG_ENABLE([gridseed],
  339. [AC_HELP_STRING([--enable-gridseed],[Compile support for GridSeed (default disabled)])],
  340. [gridseed=$enableval]
  341. )
  342. if test "x$gridseed" = xyes; then
  343. AC_DEFINE([USE_FPGA_SERIAL], [1], [Defined to 1 if serial support required])
  344. AC_DEFINE([USE_GRIDSEED], [1], [Defined to 1 if GridSeed support is wanted])
  345. drivercount=x$drivercount
  346. fi
  347. AM_CONDITIONAL([HAS_GRIDSEED], [test x$gridseed = xyes])
  348. zeus="no"
  349. AC_ARG_ENABLE([zeus],
  350. [AC_HELP_STRING([--enable-zeus],[Compile support for Zeusminer (default disabled) (EXPERIMENTAL)])],
  351. [zeus=$enableval]
  352. )
  353. if test "x$zeus" = xyes; then
  354. AC_DEFINE([USE_FPGA_SERIAL], [1], [Defined to 1 if serial support required])
  355. AC_DEFINE([USE_ZEUS], [1], [Defined to 1 if Zeus support is wanted])
  356. drivercount=x$drivercount
  357. fi
  358. AM_CONDITIONAL([HAS_ZEUS], [test x$zeus = xyes])
  359. lketc="no"
  360. AC_ARG_ENABLE([lketc],
  361. [AC_HELP_STRING([--enable-lketc],[Compile support for Lketcminer (default disabled)])],
  362. [lketc=$enableval]
  363. )
  364. if test "x$lketc" = xyes; then
  365. AC_DEFINE([USE_FPGA_SERIAL], [1], [Defined to 1 if serial support required])
  366. AC_DEFINE([USE_LKETC], [1], [Defined to 1 if Lketc support is wanted])
  367. fi
  368. AM_CONDITIONAL([HAS_LKETC], [test x$lketc = xyes])
  369. curses="auto"
  370. AC_ARG_WITH([curses],
  371. [AC_HELP_STRING([--without-curses],[Compile support for curses TUI (default enabled)])],
  372. [curses=$withval]
  373. )
  374. if test "x$curses" = "xno"; then
  375. cursesmsg='User specified --without-curses. TUI support DISABLED'
  376. else
  377. AC_SEARCH_LIBS(addstr, ncurses pdcurses, [
  378. curses=yes
  379. cursesmsg="FOUND: ${ac_cv_search_addstr}"
  380. AC_DEFINE([HAVE_CURSES], [1], [Defined to 1 if curses TUI support is wanted])
  381. ], [
  382. if test "x$curses" = "xyes"; then
  383. AC_MSG_ERROR([Could not find curses library - please install libncurses-dev or pdcurses-dev (or configure --without-curses)])
  384. else
  385. AC_MSG_WARN([Could not find curses library - if you want a TUI, install libncurses-dev or pdcurses-dev])
  386. curses=no
  387. cursesmsg='NOT FOUND. TUI support DISABLED'
  388. fi
  389. ])
  390. fi
  391. #Add a new device to this list if it needs libusb, along with a no on the end.
  392. if test x$avalon$avalon2$bitforce$bitfury$blockerupter$modminer$bflsc$icarus$hashfast$hashratio$klondike$drillbit$cointerra$ants1$ants2$gridseed$zeus$lketc != xnononononononononononononononononono; then
  393. want_usbutils=true
  394. else
  395. want_usbutils=false
  396. fi
  397. if test x$bitfury != xno; then
  398. want_libbitfury=true
  399. else
  400. want_libbitfury=false
  401. fi
  402. if test x$gridseed$zeus$lketc != xnonono; then
  403. want_libudev=true
  404. else
  405. want_libudev=false
  406. fi
  407. if test x$avalon2$hashratio != xnono; then
  408. want_crc16=true
  409. else
  410. want_crc16=false
  411. fi
  412. AM_CONDITIONAL([NEED_FPGAUTILS], [test x$modminer$gridseed$zeus$lketc != xnononono])
  413. AM_CONDITIONAL([WANT_USBUTILS], [test x$want_usbutils != xfalse])
  414. AM_CONDITIONAL([WANT_LIBBITFURY], [test x$want_libbitfury != xfalse])
  415. AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
  416. AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
  417. AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
  418. AM_CONDITIONAL([WANT_CRC16], [test x$want_crc16 != xfalse])
  419. if test "x$want_usbutils" != xfalse; then
  420. dlibusb="no"
  421. AC_DEFINE([USE_USBUTILS], [1], [Defined to 1 if usbutils support required])
  422. AC_ARG_WITH([system-libusb],
  423. [AC_HELP_STRING([--with-system-libusb],[NOT RECOMMENDED! Compile against dynamic system libusb. (Default use included static libusb)])],
  424. [dlibusb=$withval]
  425. )
  426. if test "x$dlibusb" != xno; then
  427. case $target in
  428. *-*-freebsd*)
  429. LIBUSB_LIBS="-lusb"
  430. LIBUSB_CFLAGS=""
  431. AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have libusb-1.0])
  432. ;;
  433. *)
  434. PKG_CHECK_MODULES(LIBUSB, libusb-1.0, [AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have libusb-1.0])], [AC_MSG_ERROR([Could not find usb library - please install libusb-1.0])])
  435. ;;
  436. esac
  437. else
  438. AC_CONFIG_SUBDIRS([compat/libusb-1.0])
  439. LIBUSB_LIBS="compat/libusb-1.0/libusb/.libs/libusb-1.0.a"
  440. if test "x$have_linux" = "xtrue"; then
  441. AC_ARG_ENABLE([udev],
  442. [AC_HELP_STRING([--disable-udev],[Disable building libusb with udev])],
  443. [udev=$enableval]
  444. )
  445. if test "x$udev" != xno; then
  446. LIBUSB_LIBS+=" -ludev"
  447. fi
  448. fi
  449. if test "x$have_darwin" = "xtrue"; then
  450. LIBUSB_LIBS+=" -lobjc"
  451. LDFLAGS+=" -framework CoreFoundation -framework IOKit"
  452. fi
  453. fi
  454. else
  455. LIBUSB_LIBS=""
  456. fi
  457. if test "x$want_libudev" != xfalse; then
  458. if test "x$have_linux" = "xtrue"; then
  459. AC_DEFINE([HAVE_LIBUDEV], [1], [Defined to 1 if udev support available])
  460. LIBUDEV_LIBS="-ludev"
  461. fi
  462. else
  463. LIBUDEV_LIBS=""
  464. fi
  465. AM_CONDITIONAL([WANT_STATIC_LIBUSB], [test x$dlibusb = xno])
  466. AC_CONFIG_SUBDIRS([compat/jansson-2.6])
  467. JANSSON_LIBS="compat/jansson-2.6/src/.libs/libjansson.a"
  468. PKG_PROG_PKG_CONFIG()
  469. if test "x$have_cgminer_sdk" = "xtrue"; then
  470. if test "x$have_x86_64" = xtrue; then
  471. ARCH_DIR=x86_64
  472. else
  473. ARCH_DIR=x86
  474. fi
  475. PKG_CONFIG="${PKG_CONFIG:-pkg-config} --define-variable=arch=$ARCH_DIR --define-variable=target=$target --define-variable=cgminersdkdir=$CGMINER_SDK"
  476. PKG_CONFIG_PATH="$CGMINER_SDK/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
  477. fi
  478. AC_SUBST(LIBUSB_LIBS)
  479. AC_SUBST(LIBUSB_CFLAGS)
  480. AC_SUBST(LIBUDEV_LIBS)
  481. AC_ARG_ENABLE([libcurl],
  482. [AC_HELP_STRING([--disable-libcurl],[Disable building with libcurl for getwork and GBT support])],
  483. [libcurl=$enableval]
  484. )
  485. if test "x$libcurl" != xno; then
  486. if test "x$have_win32" != xtrue; then
  487. PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.25.0], [AC_DEFINE([CURL_HAS_KEEPALIVE], [1], [Defined if version of curl supports keepalive.])],
  488. [PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.18.2], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.18.2])])])
  489. else
  490. PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.25.0], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.25.0])])
  491. AC_DEFINE([CURL_HAS_KEEPALIVE], [1])
  492. fi
  493. AC_DEFINE([HAVE_LIBCURL], [1], [Defined to 1 if libcurl support built in])
  494. else
  495. LIBCURL_LIBS=""
  496. fi
  497. AC_SUBST(LIBCURL_LIBS)
  498. #check execv signature
  499. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  500. #include <process.h>
  501. int execv(const char*, const char*const*);
  502. ])],
  503. AC_DEFINE([EXECV_2ND_ARG_TYPE], [const char* const*], [int execv(const char*, const char*const*);]),
  504. AC_DEFINE([EXECV_2ND_ARG_TYPE], [char* const*], [int execv(const char*, char*const*);]))
  505. dnl CCAN wants to know a lot of vars.
  506. # All the configuration checks. Regrettably, the __attribute__ checks will
  507. # give false positives on old GCCs, since they just cause warnings. But that's
  508. # fairly harmless.
  509. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((cold)) cleanup(void) { }])],
  510. AC_DEFINE([HAVE_ATTRIBUTE_COLD], [1],
  511. [Define if __attribute__((cold))]))
  512. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((const)) cleanup(void) { }])],
  513. AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1],
  514. [Define if __attribute__((const))]))
  515. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((noreturn)) cleanup(void) { exit(1); }])],
  516. AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
  517. [Define if __attribute__((noreturn))]))
  518. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((format(__printf__, 1, 2))) cleanup(const char *fmt, ...) { }])],
  519. AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1],
  520. [Define if __attribute__((format(__printf__)))]))
  521. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((unused)) cleanup(void) { }])],
  522. AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1],
  523. [Define if __attribute__((unused))]))
  524. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((used)) cleanup(void) { }])],
  525. AC_DEFINE([HAVE_ATTRIBUTE_USED], [1],
  526. [Define if __attribute__((used))]))
  527. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_constant_p(1) ? 0 : 1; }])],
  528. AC_DEFINE([HAVE_BUILTIN_CONSTANT_P], [1],
  529. [Define if have __builtin_constant_p]))
  530. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_types_compatible_p(char *, int) ? 1 : 0; }])],
  531. AC_DEFINE([HAVE_BUILTIN_TYPES_COMPATIBLE_P], [1],
  532. [Define if have __builtin_types_compatible_p]))
  533. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static int __attribute__((warn_unused_result)) func(int x) { return x; }])],
  534. AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1],
  535. [Define if __attribute__((warn_unused_result))]))
  536. if test "x$prefix" = xNONE; then
  537. prefix=/usr/local
  538. fi
  539. AC_DEFINE_UNQUOTED([CGMINER_PREFIX], ["$prefix/bin"], [Path to cgminer install])
  540. AC_SUBST(JANSSON_LIBS)
  541. AC_SUBST(PTHREAD_FLAGS)
  542. AC_SUBST(DLOPEN_FLAGS)
  543. AC_SUBST(PTHREAD_LIBS)
  544. AC_SUBST(NCURSES_LIBS)
  545. AC_SUBST(PDCURSES_LIBS)
  546. AC_SUBST(WS2_LIBS)
  547. AC_SUBST(MM_LIBS)
  548. AC_SUBST(MATH_LIBS)
  549. AC_SUBST(RT_LIBS)
  550. AC_CONFIG_FILES([
  551. Makefile
  552. compat/Makefile
  553. ccan/Makefile
  554. lib/Makefile
  555. ])
  556. AC_OUTPUT
  557. echo
  558. echo
  559. echo
  560. echo "------------------------------------------------------------------------"
  561. echo "$PACKAGE $VERSION"
  562. echo "------------------------------------------------------------------------"
  563. echo
  564. echo
  565. echo "Configuration Options Summary:"
  566. echo
  567. if test "x$libcurl" != xno; then
  568. echo " libcurl(GBT+getwork).: Enabled: $LIBCURL_LIBS"
  569. else
  570. echo " libcurl(GBT+getwork).: Disabled"
  571. fi
  572. echo " curses.TUI...........: $cursesmsg"
  573. if test "x$scrypt" != xno; then
  574. echo " scrypt...............: Enabled"
  575. else
  576. echo " scrypt...............: Disabled"
  577. fi
  578. echo
  579. if test "x$ants1" = xyes; then
  580. echo " Antminer.S1.Bitmain..: Enabled"
  581. else
  582. echo " Antminer.S1.Bitmain..: Disabled"
  583. fi
  584. if test "x$ants2" = xyes; then
  585. echo " Antminer.S2.Bitmain..: Enabled"
  586. else
  587. echo " Antminer.S2.Bitmain..: Disabled"
  588. fi
  589. if test "x$avalon" = xyes; then
  590. echo " Avalon.ASICs.........: Enabled"
  591. else
  592. echo " Avalon.ASICs.........: Disabled"
  593. fi
  594. if test "x$avalon2" = xyes; then
  595. echo " Avalon2.ASICs........: Enabled"
  596. else
  597. echo " Avalon2.ASICs........: Disabled"
  598. fi
  599. if test "x$minion" = xyes; then
  600. echo " BlackArrowMinion.ASIC: Enabled"
  601. else
  602. echo " BlackArrowMinion.ASIC: Disabled"
  603. fi
  604. if test "x$bab" = xyes; then
  605. echo " BlackArrow.ASICs.....: Enabled"
  606. else
  607. echo " BlackArrow.ASICs.....: Disabled"
  608. fi
  609. if test "x$bflsc" = xyes; then
  610. echo " BFL.ASICs............: Enabled"
  611. else
  612. echo " BFL.ASICs............: Disabled"
  613. fi
  614. if test "x$bitforce" = xyes; then
  615. echo " BitForce.FPGAs.......: Enabled"
  616. else
  617. echo " BitForce.FPGAs.......: Disabled"
  618. fi
  619. if test "x$bitfury" = xyes; then
  620. echo " BitFury.ASICs........: Enabled"
  621. else
  622. echo " BitFury.ASICs........: Disabled"
  623. fi
  624. if test "x$blockerupter" = xyes; then
  625. echo " BlockErupter.ASICs...: Enabled"
  626. else
  627. echo " BlockErupter.ASICs...: Disabled"
  628. fi
  629. if test "x$cointerra" = xyes; then
  630. echo " Cointerra.ASICs......: Enabled"
  631. else
  632. echo " Cointerra.ASICs......: Disabled"
  633. fi
  634. if test "x$sp10" = xyes; then
  635. echo " Spond-sp10.ASICs.....: Enabled"
  636. else
  637. echo " Spond-sp10.ASICs.....: Disabled"
  638. fi
  639. if test "x$sp30" = xyes; then
  640. echo " Spond-sp30.ASICs.....: Enabled"
  641. else
  642. echo " Spond-sp30.ASICs.....: Disabled"
  643. fi
  644. if test "x$bitmine_A1" = xyes; then
  645. echo " Bitmine-A1.ASICs.....: Enabled"
  646. else
  647. echo " Bitmine-A1.ASICs.....: Disabled"
  648. fi
  649. if test "x$drillbit" = xyes; then
  650. echo " Drillbit.BitFury.....: Enabled"
  651. else
  652. echo " Drillbit.BitFury.....: Disabled"
  653. fi
  654. if test "x$hashfast" = xyes; then
  655. echo " Hashfast.ASICs.......: Enabled"
  656. else
  657. echo " Hashfast.ASICs.......: Disabled"
  658. fi
  659. if test "x$hashratio" = xyes; then
  660. echo " Hashratio.ASICs......: Enabled"
  661. else
  662. echo " Hashratio.ASICs......: Disabled"
  663. fi
  664. if test "x$icarus" = xyes; then
  665. echo " Icarus.ASICs/FPGAs...: Enabled"
  666. else
  667. echo " Icarus.ASICs/FPGAs...: Disabled"
  668. fi
  669. if test "x$klondike" = xyes; then
  670. echo " Klondike.ASICs.......: Enabled"
  671. else
  672. echo " Klondike.ASICs.......: Disabled"
  673. fi
  674. if test "x$knc" = xyes; then
  675. echo " KnC.ASICs............: Enabled"
  676. else
  677. echo " KnC.ASICs............: Disabled"
  678. fi
  679. if test "x$modminer" = xyes; then
  680. echo " ModMiner.FPGAs.......: Enabled"
  681. else
  682. echo " ModMiner.FPGAs.......: Disabled"
  683. fi
  684. if test "x$gridseed" = xyes; then
  685. echo " GridSeed.ASICs.......: Enabled"
  686. else
  687. echo " GridSeed.ASICs.......: Disabled"
  688. fi
  689. if test "x$zeus" = xyes; then
  690. echo " Zeus.ASICs...........: Enabled"
  691. else
  692. echo " Zeus.ASICs...........: Disabled"
  693. fi
  694. if test "x$lketc" = xyes; then
  695. echo " Lketc.ASICs..........: Enabled"
  696. else
  697. echo " Lketc.ASICs..........: Disabled"
  698. fi
  699. #Add any new device to this, along with a no on the end of the test
  700. if test "x$avalon$avalon2$bab$bflsc$bitforce$bitfury$blockerupter$hashfast$hashratio$icarus$klondike$knc$modminer$drillbit$minion$cointerra$bitmine_A1$ants1$ants2$sp10$sp30$gridseed$zeus$lketc" = xnononononononononononononononononononononononono; then
  701. AC_MSG_ERROR([No mining devices configured in])
  702. fi
  703. if test "x$standalone" = xyes; then
  704. if test $drivercount != x; then
  705. AC_MSG_ERROR([You have configured more than one driver in with a driver that is designed to be standalone only (see ./configure --help)])
  706. fi
  707. fi
  708. echo
  709. echo "Compilation............: make (or gmake)"
  710. echo " CPPFLAGS.............: $CPPFLAGS"
  711. echo " CFLAGS...............: $CFLAGS"
  712. echo " LDFLAGS..............: $LDFLAGS $PTHREAD_FLAGS"
  713. echo " LDADD................: $DLOPEN_FLAGS $LIBCURL_LIBS $JANSSON_LIBS $PTHREAD_LIBS $NCURSES_LIBS $PDCURSES_LIBS $WS2_LIBS $MATH_LIBS $LIBUSB_LIBS $LIBUDEV_LIBS $RT_LIBS"
  714. echo
  715. echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
  716. echo " prefix...............: $prefix"
  717. echo
  718. if test "x$want_usbutils$dlibusb" = xyesyes; then
  719. echo "*** SYSTEM LIBUSB BEING ADDED - NOT RECOMMENDED UNLESS YOU ARE UNABLE TO COMPILE THE INCLUDED LIBUSB ***"
  720. echo
  721. fi