configure.ac 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047
  1. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  2. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  3. m4_define([v_maj], [4])
  4. m4_define([v_min], [11])
  5. m4_define([v_mic], [1])
  6. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  7. m4_define([v_ver], [v_maj.v_min.v_mic-mod])
  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. # This breaks autoreconf so disable it
  47. # LT_INIT([disable-shared])
  48. gl_INIT
  49. dnl Checks for header files.
  50. AC_HEADER_STDC
  51. AC_CHECK_HEADERS(syslog.h)
  52. AC_FUNC_ALLOCA
  53. have_win32=false
  54. PTHREAD_FLAGS="-lpthread"
  55. ##LIBZ_LIBS="-lz"
  56. DLOPEN_FLAGS="-ldl"
  57. WS2_LIBS=""
  58. MM_LIBS=""
  59. MATH_LIBS="-lm"
  60. RT_LIBS="-lrt"
  61. case $target in
  62. amd64-*)
  63. have_x86_64=true
  64. ;;
  65. x86_64-*)
  66. have_x86_64=true
  67. ;;
  68. *)
  69. have_x86_64=false
  70. ;;
  71. esac
  72. case $target in
  73. *-*-linux-gnu*)
  74. have_linux=true
  75. ;;
  76. *-*-mingw*)
  77. have_win32=true
  78. PTHREAD_FLAGS=""
  79. DLOPEN_FLAGS=""
  80. WS2_LIBS="-lws2_32"
  81. MM_LIBS="-lwinmm"
  82. RT_LIBS=""
  83. #AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support")
  84. ;;
  85. powerpc-*-darwin*)
  86. have_darwin=true
  87. CFLAGS="$CFLAGS -faltivec"
  88. PTHREAD_FLAGS=""
  89. RT_LIBS=""
  90. ;;
  91. *-*-darwin*)
  92. have_darwin=true
  93. PTHREAD_FLAGS=""
  94. RT_LIBS=""
  95. ;;
  96. *-*-freebsd*)
  97. PTHREAD_FLAGS=""
  98. DLOPEN_FLAGS=""
  99. RT_LIBS=""
  100. ;;
  101. esac
  102. has_winpthread=false
  103. if test "x$have_win32" = xtrue; then
  104. has_winpthread=true
  105. AC_CHECK_LIB(winpthread, nanosleep, , has_winpthread=false)
  106. PTHREAD_LIBS=-lwinpthread
  107. fi
  108. if test "x$has_winpthread" != xtrue; then
  109. AC_CHECK_LIB(pthread, pthread_create, ,
  110. AC_MSG_ERROR([Could not find pthread library - please install libpthread]))
  111. PTHREAD_LIBS=-lpthread
  112. fi
  113. # Drivers that are designed to be run on dedicated hardware should set standalone to yes
  114. # All drivers should prepend an x to the drivercount
  115. standalone="no"
  116. drivercount=""
  117. ants1="no"
  118. AC_ARG_ENABLE([ants1],
  119. [AC_HELP_STRING([--enable-ants1],[Compile support for Antminer S1 Bitmain STANDALONE(default disabled)])],
  120. [ants1=$enableval]
  121. )
  122. if test "x$ants1" = xyes; then
  123. AC_DEFINE([USE_ANT_S1], [1], [Defined to 1 if Antminer S1 Bitmain support is wanted])
  124. drivercount=x$drivercount
  125. standalone="yes"
  126. fi
  127. AM_CONDITIONAL([HAS_ANT_S1], [test x$ants1 = xyes])
  128. ants2="no"
  129. AC_ARG_ENABLE([ants2],
  130. [AC_HELP_STRING([--enable-ants2],[Compile support for Antminer S2 Bitmain STANDALONE(default disabled)])],
  131. [ants2=$enableval]
  132. )
  133. if test "x$ants2" = xyes; then
  134. AC_DEFINE([USE_ANT_S2], [1], [Defined to 1 if Antminer S2 Bitmain support is wanted])
  135. drivercount=x$drivercount
  136. standalone="yes"
  137. fi
  138. AM_CONDITIONAL([HAS_ANT_S2], [test x$ants2 = xyes])
  139. ants3="no"
  140. AC_ARG_ENABLE([ants3],
  141. [AC_HELP_STRING([--enable-ants3],[Compile support for Antminer S3 Bitmain STANDALONE(default disabled)])],
  142. [ants3=$enableval]
  143. )
  144. if test "x$ants3" = xyes; then
  145. AC_DEFINE([USE_ANT_S3], [1], [Defined to 1 if Antminer S3 Bitmain support is wanted])
  146. drivercount=x$drivercount
  147. standalone="yes"
  148. fi
  149. AM_CONDITIONAL([HAS_ANT_S3], [test x$ants3 = xyes])
  150. avalon="no"
  151. AC_ARG_ENABLE([avalon],
  152. [AC_HELP_STRING([--enable-avalon],[Compile support for Avalon (default disabled)])],
  153. [avalon=$enableval]
  154. )
  155. if test "x$avalon" = xyes; then
  156. AC_DEFINE([USE_AVALON], [1], [Defined to 1 if Avalon support is wanted])
  157. drivercount=x$drivercount
  158. fi
  159. AM_CONDITIONAL([HAS_AVALON], [test x$avalon = xyes])
  160. avalon2="no"
  161. AC_ARG_ENABLE([avalon2],
  162. [AC_HELP_STRING([--enable-avalon2],[Compile support for Avalon2 (default disabled)])],
  163. [avalon2=$enableval]
  164. )
  165. if test "x$avalon2" = xyes; then
  166. AC_DEFINE([USE_AVALON2], [1], [Defined to 1 if Avalon2 support is wanted])
  167. drivercount=x$drivercount
  168. fi
  169. AM_CONDITIONAL([HAS_AVALON2], [test x$avalon2 = xyes])
  170. avalon4="no"
  171. AC_ARG_ENABLE([avalon4],
  172. [AC_HELP_STRING([--enable-avalon4],[Compile support for Avalon4 (default disabled)])],
  173. [avalon4=$enableval]
  174. )
  175. if test "x$avalon4" = xyes; then
  176. AC_DEFINE([USE_AVALON4], [1], [Defined to 1 if Avalon4 support is wanted])
  177. fi
  178. AM_CONDITIONAL([HAS_AVALON4], [test x$avalon4 = xyes])
  179. avalon7="no"
  180. AC_ARG_ENABLE([avalon7],
  181. [AC_HELP_STRING([--enable-avalon7],[Compile support for Avalon7 (default disabled)])],
  182. [avalon7=$enableval]
  183. )
  184. if test "x$avalon7" = xyes; then
  185. AC_DEFINE([USE_AVALON7], [1], [Defined to 1 if Avalon7 support is wanted])
  186. fi
  187. AM_CONDITIONAL([HAS_AVALON7], [test x$avalon7 = xyes])
  188. avalon8="no"
  189. AC_ARG_ENABLE([avalon8],
  190. [AC_HELP_STRING([--enable-avalon8],[Compile support for Avalon8 (default disabled)])],
  191. [avalon8=$enableval]
  192. )
  193. if test "x$avalon8" = xyes; then
  194. AC_DEFINE([USE_AVALON8], [1], [Defined to 1 if Avalon8 support is wanted])
  195. fi
  196. AM_CONDITIONAL([HAS_AVALON8], [test x$avalon8 = xyes])
  197. avalon_miner="no"
  198. AC_ARG_ENABLE([avalon_miner],
  199. [AC_HELP_STRING([--enable-avalon-miner],[Compile support for Avalon miner(default disabled)])],
  200. [avalon_miner=$enableval]
  201. )
  202. if test "x$avalon_miner" = xyes; then
  203. AC_DEFINE([USE_AVALON_MINER], [1], [Defined to 1 if Avalon miner support is wanted])
  204. fi
  205. AM_CONDITIONAL([HAS_AVALON_MINER], [test x$avalon_miner = xyes])
  206. bab="no"
  207. AC_ARG_ENABLE([bab],
  208. [AC_HELP_STRING([--enable-bab],[Compile support for BlackArrow Bitfury STANDALONE(default disabled)])],
  209. [bab=$enableval]
  210. )
  211. if test "x$bab" = xyes; then
  212. AC_DEFINE([USE_BAB], [1], [Defined to 1 if BlackArrow Bitfury support is wanted])
  213. drivercount=x$drivercount
  214. standalone="yes"
  215. fi
  216. AM_CONDITIONAL([HAS_BAB], [test x$bab = xyes])
  217. bflsc="no"
  218. AC_ARG_ENABLE([bflsc],
  219. [AC_HELP_STRING([--enable-bflsc],[Compile support for BFL ASICs (default disabled)])],
  220. [bflsc=$enableval]
  221. )
  222. if test "x$bflsc" = xyes; then
  223. AC_DEFINE([USE_BFLSC], [1], [Defined to 1 if BFL ASIC support is wanted])
  224. drivercount=x$drivercount
  225. fi
  226. AM_CONDITIONAL([HAS_BFLSC], [test x$bflsc = xyes])
  227. bitforce="no"
  228. AC_ARG_ENABLE([bitforce],
  229. [AC_HELP_STRING([--enable-bitforce],[Compile support for BitForce FPGAs (default disabled)])],
  230. [bitforce=$enableval]
  231. )
  232. if test "x$bitforce" = xyes; then
  233. AC_DEFINE([USE_BITFORCE], [1], [Defined to 1 if BitForce support is wanted])
  234. drivercount=x$drivercount
  235. fi
  236. AM_CONDITIONAL([HAS_BITFORCE], [test x$bitforce = xyes])
  237. bitfury="no"
  238. AC_ARG_ENABLE([bitfury],
  239. [AC_HELP_STRING([--enable-bitfury],[Compile support for BitFury ASICs (default disabled)])],
  240. [bitfury=$enableval]
  241. )
  242. if test "x$bitfury" = xyes; then
  243. AC_DEFINE([USE_BITFURY], [1], [Defined to 1 if BitFury ASIC support is wanted])
  244. drivercount=x$drivercount
  245. fi
  246. AM_CONDITIONAL([HAS_BITFURY], [test x$bitfury = xyes])
  247. bitfury16="no"
  248. AC_ARG_ENABLE([bitfury16],
  249. [AC_HELP_STRING([--enable-bitfury16],[Compile support for BitFury 16nm ASICs STANDALONE(default disabled)])],
  250. [bitfury16=$enableval]
  251. )
  252. if test "x$bitfury16" = xyes; then
  253. AC_DEFINE([USE_BITFURY16], [1], [Defined to 1 if BitFury 16nm ASIC support is wanted])
  254. drivercount=x$drivercount
  255. standalone="yes"
  256. fi
  257. AM_CONDITIONAL([HAS_BITFURY16], [test x$bitfury16 = xyes])
  258. bitmain_soc="no"
  259. bitmain_R4="no"
  260. bitmain_S9="no"
  261. bitmain_T9="no"
  262. bitmain_T9P="no"
  263. AC_ARG_ENABLE([bitmain_soc],
  264. [AC_HELP_STRING([--enable-bitmain_soc],[Compile support for Bitmain ASICs STANDALONE(default disabled)])],
  265. [bitmain_soc=$enableval]
  266. )
  267. AC_ARG_ENABLE([bitmain_R4],
  268. [AC_HELP_STRING([--enable-bitmain_R4],[Compile support for Bitmain R4])],
  269. [bitmain_R4=$enableval]
  270. )
  271. AC_ARG_ENABLE([bitmain_S9],
  272. [AC_HELP_STRING([--enable-bitmain_S9],[Compile support for Bitmain S9])],
  273. [bitmain_S9=$enableval]
  274. )
  275. AC_ARG_ENABLE([bitmain_T9],
  276. [AC_HELP_STRING([--enable-bitmain_T9],[Compile support for Bitmain T9])],
  277. [bitmain_T9=$enableval]
  278. )
  279. AC_ARG_ENABLE([bitmain_T9P],
  280. [AC_HELP_STRING([--enable-bitmain_T9P],[Compile support for Bitmain T9+])],
  281. [bitmain_T9P=$enableval]
  282. )
  283. if test "x$bitmain_soc" = xyes; then
  284. AC_DEFINE([USE_BITMAIN_SOC], [1], [Defined to 1 if Bitmain ASICs support is wanted])
  285. if test "x$bitmain_R4" = xyes; then
  286. AC_DEFINE([R4], [1], [Defined to 1 for R4])
  287. fi
  288. if test "x$bitmain_S9" = xyes; then
  289. AC_DEFINE([S9_63], [1], [Defined to 1 for S9])
  290. fi
  291. if test "x$bitmain_T9" = xyes; then
  292. AC_DEFINE([S9_PLUS], [1], [Defined to 1 for T9])
  293. fi
  294. if test "x$bitmain_T9P" = xyes; then
  295. AC_DEFINE([T9_18], [1], [Defined to 1 for T9+])
  296. fi
  297. if test "x$bitmain_R4$bitmain_S9$bitmain_T9$bitmain_T9P" = xnononono; then
  298. AC_DEFINE([S9_63], [1], [Defined to 1 for default])
  299. fi
  300. drivercount=x$drivercount
  301. standalone="yes"
  302. LIBZ_LIBS="-lz"
  303. fi
  304. AM_CONDITIONAL([HAS_BITMAIN_SOC], [test x$bitmain_soc = xyes])
  305. bitmine_A1="no"
  306. AC_ARG_ENABLE([bitmine_A1],
  307. [AC_HELP_STRING([--enable-bitmine_A1],[Compile support for Bitmine.ch A1 ASICs STANDALONE(default disabled)])],
  308. [bitmine_A1=$enableval]
  309. )
  310. if test "x$bitmine_A1" = xyes; then
  311. AC_DEFINE([USE_BITMINE_A1], [1], [Defined to 1 if Bitmine A1 support is wanted])
  312. drivercount=x$drivercount
  313. standalone="yes"
  314. fi
  315. AM_CONDITIONAL([HAS_BITMINE_A1], [test x$bitmine_A1 = xyes])
  316. blockerupter="no"
  317. AC_ARG_ENABLE([blockerupter],
  318. [AC_HELP_STRING([--enable-blockerupter],[Compile support for BlockErupter BROKEN DRIVER (default disabled)])],
  319. [blockerupter=$enableval]
  320. )
  321. if test "x$blockerupter" = xyes; then
  322. AC_DEFINE([USE_BLOCKERUPTER], [1], [Defined to 1 if BlockErupter support is wanted])
  323. drivercount=x$drivercount
  324. fi
  325. AM_CONDITIONAL([HAS_BLOCKERUPTER], [test x$blockerupter = xyes])
  326. cointerra="no"
  327. AC_ARG_ENABLE([cointerra],
  328. [AC_HELP_STRING([--enable-cointerra],[Compile support for Cointerra ASICs (default disabled)])],
  329. [cointerra=$enableval]
  330. )
  331. if test "x$cointerra" = xyes; then
  332. AC_DEFINE([USE_COINTERRA], [1], [Defined to 1 if Cointerra support is wanted])
  333. drivercount=x$drivercount
  334. fi
  335. AM_CONDITIONAL([HAS_COINTERRA], [test x$cointerra = xyes])
  336. dragonmint_t1="no"
  337. AC_ARG_ENABLE([dragonmint_t1],
  338. [AC_HELP_STRING([--enable-dragonmint_t1],[Compile support for Dragonmint T1 ASICs STANDALONE(default disabled)])],
  339. [dragonmint_t1=$enableval]
  340. )
  341. if test "x$dragonmint_t1" = xyes; then
  342. AC_DEFINE([USE_DRAGONMINT_T1], [1], [Defined to 1 if Dragonmint T1 support is wanted])
  343. AC_DEFINE([USE_VMASK], [1], [Defined to 1 if version mask rolling is wanted])
  344. drivercount=x$drivercount
  345. standalone="yes"
  346. fi
  347. AM_CONDITIONAL([HAS_DRAGONMINT_T1], [test x$dragonmint_t1 = xyes])
  348. drillbit="no"
  349. AC_ARG_ENABLE([drillbit],
  350. [AC_HELP_STRING([--enable-drillbit],[Compile support for Drillbit BitFury ASICs (default disabled)])],
  351. [drillbit=$enableval]
  352. )
  353. if test "x$drillbit" = xyes; then
  354. AC_DEFINE([USE_DRILLBIT], [1], [Defined to 1 if Drillbit BitFury support is wanted])
  355. drivercount=x$drivercount
  356. fi
  357. AM_CONDITIONAL([HAS_DRILLBIT], [test x$drillbit = xyes])
  358. hashfast="no"
  359. AC_ARG_ENABLE([hashfast],
  360. [AC_HELP_STRING([--enable-hashfast],[Compile support for Hashfast (default disabled)])],
  361. [hashfast=$enableval]
  362. )
  363. if test "x$hashfast" = xyes; then
  364. AC_DEFINE([USE_HASHFAST], [1], [Defined to 1 if Hashfast support is wanted])
  365. drivercount=x$drivercount
  366. fi
  367. AM_CONDITIONAL([HAS_HASHFAST], [test x$hashfast = xyes])
  368. hashratio="no"
  369. AC_ARG_ENABLE([hashratio],
  370. [AC_HELP_STRING([--enable-hashratio],[Compile support for Hashratio (default disabled)])],
  371. [hashratio=$enableval]
  372. )
  373. if test "x$hashratio" = xyes; then
  374. AC_DEFINE([USE_HASHRATIO], [1], [Defined to 1 if Hashratiosupport is wanted])
  375. drivercount=x$drivercount
  376. fi
  377. AM_CONDITIONAL([HAS_HASHRATIO], [test x$hashratio = xyes])
  378. icarus="no"
  379. AC_ARG_ENABLE([icarus],
  380. [AC_HELP_STRING([--enable-icarus],[Compile support for Icarus (default disabled)])],
  381. [icarus=$enableval]
  382. )
  383. if test "x$icarus" = xyes; then
  384. AC_DEFINE([USE_ICARUS], [1], [Defined to 1 if Icarus support is wanted])
  385. drivercount=x$drivercount
  386. fi
  387. AM_CONDITIONAL([HAS_ICARUS], [test x$icarus = xyes])
  388. klondike="no"
  389. AC_ARG_ENABLE([klondike],
  390. [AC_HELP_STRING([--enable-klondike],[Compile support for Klondike (default disabled)])],
  391. [klondike=$enableval]
  392. )
  393. if test "x$klondike" = xyes; then
  394. AC_DEFINE([USE_KLONDIKE], [1], [Defined to 1 if Klondike support is wanted])
  395. drivercount=x$drivercount
  396. fi
  397. AM_CONDITIONAL([HAS_KLONDIKE], [test x$klondike = xyes])
  398. knc="no"
  399. AC_ARG_ENABLE([knc],
  400. [AC_HELP_STRING([--enable-knc],[Compile support for KnC miners STANDALONE(default disabled)])],
  401. [knc=$enableval]
  402. )
  403. if test "x$knc" = xyes; then
  404. AC_DEFINE([USE_KNC], [1], [Defined to 1 if KnC miner support is wanted])
  405. drivercount=x$drivercount
  406. standalone="yes"
  407. fi
  408. AM_CONDITIONAL([HAS_KNC], [test x$knc = xyes])
  409. minion="no"
  410. AC_ARG_ENABLE([minion],
  411. [AC_HELP_STRING([--enable-minion],[Compile support for Minion BlackArrow ASIC STANDALONE(default disabled)])],
  412. [minion=$enableval]
  413. )
  414. if test "x$minion" = xyes; then
  415. AC_DEFINE([USE_MINION], [1], [Defined to 1 if Minion BlackArrow ASIC support is wanted])
  416. drivercount=x$drivercount
  417. standalone="yes"
  418. fi
  419. AM_CONDITIONAL([HAS_MINION], [test x$minion = xyes])
  420. modminer="no"
  421. AC_ARG_ENABLE([modminer],
  422. [AC_HELP_STRING([--enable-modminer],[Compile support for ModMiner FPGAs(default disabled)])],
  423. [modminer=$enableval]
  424. )
  425. if test "x$modminer" = xyes; then
  426. AC_DEFINE([USE_MODMINER], [1], [Defined to 1 if ModMiner support is wanted])
  427. drivercount=x$drivercount
  428. fi
  429. AM_CONDITIONAL([HAS_MODMINER], [test x$modminer = xyes])
  430. sp10="no"
  431. AC_ARG_ENABLE([sp10],
  432. [AC_HELP_STRING([--enable-sp10],[Compile support for Spondoolies SP10 STANDALONE(default disabled)])],
  433. [sp10=$enableval]
  434. )
  435. if test "x$sp10" = xyes; then
  436. AC_DEFINE([USE_SP10], [1], [Defined to 1 if Spondoolies SP10 support is wanted])
  437. drivercount=x$drivercount
  438. standalone="yes"
  439. fi
  440. AM_CONDITIONAL([HAS_SP10], [test x$sp10 = xyes])
  441. sp30="no"
  442. AC_ARG_ENABLE([sp30],
  443. [AC_HELP_STRING([--enable-sp30],[Compile support for Spondoolies SP30 STANDALONE(default disabled)])],
  444. [sp30=$enableval]
  445. )
  446. if test "x$sp30" = xyes; then
  447. AC_DEFINE([USE_SP30], [1], [Defined to 1 if SP30 support is wanted])
  448. drivercount=x$drivercount
  449. standalone="yes"
  450. fi
  451. AM_CONDITIONAL([HAS_SP30], [test x$sp30 = xyes])
  452. forcecombo="no"
  453. AC_ARG_ENABLE([forcecombo],
  454. [AC_HELP_STRING([--enable-forcecombo],[Allow combinations of drivers not intended to be built together(default disabled)])],
  455. [forcecombo=$enableval]
  456. )
  457. if test "x$forcecombo" = xyes; then
  458. standalone="no"
  459. fi
  460. curses="auto"
  461. AC_ARG_WITH([curses],
  462. [AC_HELP_STRING([--without-curses],[Compile support for curses TUI (default enabled)])],
  463. [curses=$withval]
  464. )
  465. if test "x$curses" = "xno"; then
  466. cursesmsg='User specified --without-curses. TUI support DISABLED'
  467. else
  468. AC_SEARCH_LIBS(addstr, pdcurses ncurses pdcurses, [
  469. curses=yes
  470. cursesmsg="FOUND: ${ac_cv_search_addstr}"
  471. AC_DEFINE([HAVE_CURSES], [1], [Defined to 1 if curses TUI support is wanted])
  472. ], [
  473. if test "x$curses" = "xyes"; then
  474. AC_MSG_ERROR([Could not find curses library - please install libncurses-dev or pdcurses-dev (or configure --without-curses)])
  475. else
  476. AC_MSG_WARN([Could not find curses library - if you want a TUI, install libncurses-dev or pdcurses-dev])
  477. curses=no
  478. cursesmsg='NOT FOUND. TUI support DISABLED'
  479. fi
  480. ])
  481. fi
  482. #Add a new device to this list if it needs libusb, along with a no on the end.
  483. if test x$avalon$avalon2$avalon4$avalon7$avalon8$avalon_miner$bitforce$bitfury$blockerupter$modminer$bflsc$icarus$hashfast$hashratio$klondike$drillbit$cointerra$ants1$ants3 != xnonononononononononononononononononono; then
  484. want_usbutils=true
  485. else
  486. want_usbutils=false
  487. fi
  488. if test x$bitfury != xno; then
  489. want_libbitfury=true
  490. else
  491. want_libbitfury=false
  492. fi
  493. if test x$avalon2$avalon4$avalon7$avalon8$avalon_miner$hashratio != xnononononono; then
  494. want_crc16=true
  495. else
  496. want_crc16=false
  497. fi
  498. AM_CONDITIONAL([NEED_FPGAUTILS], [test x$modminer != xno])
  499. AM_CONDITIONAL([WANT_USBUTILS], [test x$want_usbutils != xfalse])
  500. AM_CONDITIONAL([NEED_LIBZ], [test x$bitmain_soc != xno])
  501. AM_CONDITIONAL([WANT_LIBBITFURY], [test x$want_libbitfury != xfalse])
  502. AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
  503. AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
  504. AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
  505. AM_CONDITIONAL([WANT_CRC16], [test x$want_crc16 != xfalse])
  506. AM_CONDITIONAL([NEED_I2C_CONTEXT], [test x$avalon4$avalon7$avalon8 != xnonono])
  507. if test "x$want_usbutils" != xfalse; then
  508. dlibusb="no"
  509. AC_DEFINE([USE_USBUTILS], [1], [Defined to 1 if usbutils support required])
  510. AC_ARG_WITH([system-libusb],
  511. [AC_HELP_STRING([--with-system-libusb],[NOT RECOMMENDED! Compile against dynamic system libusb. (Default use included static libusb)])],
  512. [dlibusb=$withval]
  513. )
  514. if test "x$dlibusb" != xno; then
  515. case $target in
  516. *-*-freebsd*)
  517. LIBUSB_LIBS="-lusb"
  518. LIBUSB_CFLAGS=""
  519. AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have libusb-1.0])
  520. ;;
  521. *)
  522. 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])])
  523. ;;
  524. esac
  525. else
  526. AC_CONFIG_SUBDIRS([compat/libusb-1.0])
  527. LIBUSB_LIBS="compat/libusb-1.0/libusb/.libs/libusb-1.0.a"
  528. if test "x$have_linux" = "xtrue"; then
  529. AC_ARG_ENABLE([udev],
  530. [AC_HELP_STRING([--disable-udev],[Disable building libusb with udev])],
  531. [udev=$enableval]
  532. )
  533. if test "x$udev" != xno; then
  534. LIBUSB_LIBS+=" -ludev"
  535. fi
  536. fi
  537. if test "x$have_darwin" = "xtrue"; then
  538. LIBUSB_LIBS+=" -lobjc"
  539. LDFLAGS+=" -framework CoreFoundation -framework IOKit"
  540. fi
  541. fi
  542. else
  543. LIBUSB_LIBS=""
  544. fi
  545. AM_CONDITIONAL([WANT_STATIC_LIBUSB], [test x$dlibusb = xno])
  546. djansson="no"
  547. AC_ARG_WITH([system-jansson],
  548. [AC_HELP_STRING([--with-system-jansson],[NOT RECOMMENDED! Compile against dynamic system jansson. (Default use included static jansson)])],
  549. [djansson=$withval]
  550. )
  551. if test "x$djansson" != xno; then
  552. case $target in
  553. *-*-freebsd*)
  554. JANSSON_LIBS="-ljansson"
  555. JANSSON_CFLAGS=""
  556. AC_DEFINE(HAVE_JANSSON, 1, [Define if you have jansson >= 2.6])
  557. ;;
  558. *)
  559. PKG_CHECK_MODULES(JANSSON, jansson >= 2.6, [AC_DEFINE(HAVE_JANSSON, 1, [Define if you have jansson >= 2.6])], [AC_MSG_ERROR([Could not find jansson library - please install jansson >= 2.6])])
  560. ;;
  561. esac
  562. else
  563. AC_CONFIG_SUBDIRS([compat/jansson-2.9])
  564. JANSSON_LIBS="compat/jansson-2.9/src/.libs/libjansson.a"
  565. fi
  566. AM_CONDITIONAL([WANT_STATIC_JANSSON], [test x$djansson = xno])
  567. AC_CHECK_HEADERS([uthash.h])
  568. PKG_PROG_PKG_CONFIG()
  569. if test "x$have_cgminer_sdk" = "xtrue"; then
  570. if test "x$have_x86_64" = xtrue; then
  571. ARCH_DIR=x86_64
  572. else
  573. ARCH_DIR=x86
  574. fi
  575. PKG_CONFIG="${PKG_CONFIG:-pkg-config} --define-variable=arch=$ARCH_DIR --define-variable=target=$target --define-variable=cgminersdkdir=$CGMINER_SDK"
  576. PKG_CONFIG_PATH="$CGMINER_SDK/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
  577. fi
  578. AC_SUBST(LIBUSB_LIBS)
  579. AC_SUBST(LIBUSB_CFLAGS)
  580. AC_ARG_ENABLE([libcurl],
  581. [AC_HELP_STRING([--disable-libcurl],[Disable building with libcurl for GBT support])],
  582. [libcurl=$enableval]
  583. )
  584. static_curl="no"
  585. if test "x$libcurl" != xno; then
  586. if test "x$have_win32" != xtrue; then
  587. PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.25.0], [AC_DEFINE([CURL_HAS_KEEPALIVE], [1], [Defined if version of curl supports keepalive.])],
  588. [PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.18.2], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.18.2])])])
  589. else
  590. PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.25.0], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.25.0])])
  591. AC_DEFINE([CURL_HAS_KEEPALIVE], [1])
  592. static_curl="yes"
  593. fi
  594. AC_DEFINE([HAVE_LIBCURL], [1], [Defined to 1 if libcurl support built in])
  595. else
  596. LIBCURL_LIBS=""
  597. fi
  598. AC_SUBST(LIBCURL_LIBS)
  599. AM_CONDITIONAL([STATIC_CURL], [test x$static_curl = xyes])
  600. libsystemd="no"
  601. AC_ARG_ENABLE([libsystemd],
  602. [AC_HELP_STRING([--enable-libsystemd],[Enable building with libsystemd for watchdog and status notification support])],
  603. [libsystemd=$enableval]
  604. )
  605. if test "x$libsystemd" != xno; then
  606. if test "x$have_linux" != xtrue; then
  607. AC_MSG_ERROR([libsystemd is only supported on Linux platforms])
  608. fi
  609. PKG_CHECK_MODULES(LIBSYSTEMD, libsystemd, , AC_MSG_ERROR(Could not find libsystemd dev))
  610. AC_DEFINE([USE_LIBSYSTEMD], [1], [Defined to 1 if libsystemd support is wanted])
  611. else
  612. LIBSYSTEMD_LIBS=""
  613. fi
  614. #check execv signature
  615. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  616. #include <process.h>
  617. int execv(const char*, const char*const*);
  618. ])],
  619. AC_DEFINE([EXECV_2ND_ARG_TYPE], [const char* const*], [int execv(const char*, const char*const*);]),
  620. AC_DEFINE([EXECV_2ND_ARG_TYPE], [char* const*], [int execv(const char*, char*const*);]))
  621. dnl CCAN wants to know a lot of vars.
  622. # All the configuration checks. Regrettably, the __attribute__ checks will
  623. # give false positives on old GCCs, since they just cause warnings. But that's
  624. # fairly harmless.
  625. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((cold)) cleanup(void) { }])],
  626. AC_DEFINE([HAVE_ATTRIBUTE_COLD], [1],
  627. [Define if __attribute__((cold))]))
  628. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((const)) cleanup(void) { }])],
  629. AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1],
  630. [Define if __attribute__((const))]))
  631. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((noreturn)) cleanup(void) { exit(1); }])],
  632. AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
  633. [Define if __attribute__((noreturn))]))
  634. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((format(__printf__, 1, 2))) cleanup(const char *fmt, ...) { }])],
  635. AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1],
  636. [Define if __attribute__((format(__printf__)))]))
  637. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((unused)) cleanup(void) { }])],
  638. AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1],
  639. [Define if __attribute__((unused))]))
  640. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((used)) cleanup(void) { }])],
  641. AC_DEFINE([HAVE_ATTRIBUTE_USED], [1],
  642. [Define if __attribute__((used))]))
  643. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_constant_p(1) ? 0 : 1; }])],
  644. AC_DEFINE([HAVE_BUILTIN_CONSTANT_P], [1],
  645. [Define if have __builtin_constant_p]))
  646. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_types_compatible_p(char *, int) ? 1 : 0; }])],
  647. AC_DEFINE([HAVE_BUILTIN_TYPES_COMPATIBLE_P], [1],
  648. [Define if have __builtin_types_compatible_p]))
  649. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static int __attribute__((warn_unused_result)) func(int x) { return x; }])],
  650. AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1],
  651. [Define if __attribute__((warn_unused_result))]))
  652. if test "x$prefix" = xNONE; then
  653. prefix=/usr/local
  654. fi
  655. AC_DEFINE_UNQUOTED([CGMINER_PREFIX], ["$prefix/bin"], [Path to cgminer install])
  656. AC_SUBST(JANSSON_LIBS)
  657. AC_SUBST(LIBZ_LIBS)
  658. AC_SUBST(PTHREAD_FLAGS)
  659. AC_SUBST(DLOPEN_FLAGS)
  660. AC_SUBST(PTHREAD_LIBS)
  661. AC_SUBST(NCURSES_LIBS)
  662. AC_SUBST(PDCURSES_LIBS)
  663. AC_SUBST(WS2_LIBS)
  664. AC_SUBST(MM_LIBS)
  665. AC_SUBST(MATH_LIBS)
  666. AC_SUBST(RT_LIBS)
  667. AC_CONFIG_FILES([
  668. Makefile
  669. compat/Makefile
  670. ccan/Makefile
  671. lib/Makefile
  672. ])
  673. AC_OUTPUT
  674. echo
  675. echo
  676. echo
  677. echo "------------------------------------------------------------------------"
  678. echo "$PACKAGE $VERSION"
  679. echo "------------------------------------------------------------------------"
  680. echo
  681. echo
  682. echo "Configuration Options Summary:"
  683. echo
  684. if test "x$libcurl" != xno; then
  685. echo " libcurl(GBT).: Enabled: $LIBCURL_LIBS"
  686. else
  687. echo " libcurl(GBT).: Disabled"
  688. fi
  689. if test "x$libsystemd" != xno; then
  690. echo " libsystemd...........: Enabled: $LIBSYSTEMD_LIBS"
  691. else
  692. echo " libsystemd...........: Disabled"
  693. fi
  694. echo " curses.TUI...........: $cursesmsg"
  695. echo
  696. if test "x$dragonmint_t1" = xyes; then
  697. echo " DragonMint.T1.Halong.: Enabled"
  698. else
  699. echo " DragonMint.T1.Halong.: Disabled"
  700. fi
  701. if test "x$ants1" = xyes; then
  702. echo " Antminer.S1.Bitmain..: Enabled"
  703. else
  704. echo " Antminer.S1.Bitmain..: Disabled"
  705. fi
  706. if test "x$ants2" = xyes; then
  707. echo " Antminer.S2.Bitmain..: Enabled"
  708. else
  709. echo " Antminer.S2.Bitmain..: Disabled"
  710. fi
  711. if test "x$ants3" = xyes; then
  712. echo " Antminer.S3.Bitmain..: Enabled"
  713. else
  714. echo " Antminer.S3.Bitmain..: Disabled"
  715. fi
  716. if test "x$avalon" = xyes; then
  717. echo " Avalon.ASICs.........: Enabled"
  718. else
  719. echo " Avalon.ASICs.........: Disabled"
  720. fi
  721. if test "x$avalon2" = xyes; then
  722. echo " Avalon2.ASICs........: Enabled"
  723. else
  724. echo " Avalon2.ASICs........: Disabled"
  725. fi
  726. if test "x$avalon4" = xyes; then
  727. echo " Avalon4.ASICs........: Enabled"
  728. else
  729. echo " Avalon4.ASICs........: Disabled"
  730. fi
  731. if test "x$avalon7" = xyes; then
  732. echo " Avalon7.ASICs........: Enabled"
  733. else
  734. echo " Avalon7.ASICs........: Disabled"
  735. fi
  736. if test "x$avalon8" = xyes; then
  737. echo " Avalon8.ASICs........: Enabled"
  738. else
  739. echo " Avalon8.ASICs........: Disabled"
  740. fi
  741. if test "x$avalon_miner" = xyes; then
  742. echo " Avalon miner.ASICs...: Enabled"
  743. else
  744. echo " Avalon miner.ASICs...: Disabled"
  745. fi
  746. if test "x$minion" = xyes; then
  747. echo " BlackArrowMinion.ASIC: Enabled"
  748. else
  749. echo " BlackArrowMinion.ASIC: Disabled"
  750. fi
  751. if test "x$bab" = xyes; then
  752. echo " BlackArrow.ASICs.....: Enabled"
  753. else
  754. echo " BlackArrow.ASICs.....: Disabled"
  755. fi
  756. if test "x$bflsc" = xyes; then
  757. echo " BFL.ASICs............: Enabled"
  758. else
  759. echo " BFL.ASICs............: Disabled"
  760. fi
  761. if test "x$bitforce" = xyes; then
  762. echo " BitForce.FPGAs.......: Enabled"
  763. else
  764. echo " BitForce.FPGAs.......: Disabled"
  765. fi
  766. if test "x$bitfury" = xyes; then
  767. echo " BitFury.ASICs........: Enabled"
  768. else
  769. echo " BitFury.ASICs........: Disabled"
  770. fi
  771. if test "x$bitfury16" = xyes; then
  772. echo " BitFury16.ASICs......: Enabled"
  773. else
  774. echo " BitFury16.ASICs......: Disabled"
  775. fi
  776. if test "x$bitmain_soc" = xyes; then
  777. echo " Bitmain.ASICs........: Enabled"
  778. else
  779. echo " Bitmain.ASICs........: Disabled"
  780. fi
  781. if test "x$blockerupter" = xyes; then
  782. echo " BlockErupter.ASICs...: Enabled"
  783. else
  784. echo " BlockErupter.ASICs...: Disabled"
  785. fi
  786. if test "x$cointerra" = xyes; then
  787. echo " Cointerra.ASICs......: Enabled"
  788. else
  789. echo " Cointerra.ASICs......: Disabled"
  790. fi
  791. if test "x$sp10" = xyes; then
  792. echo " Spond-sp10.ASICs.....: Enabled"
  793. else
  794. echo " Spond-sp10.ASICs.....: Disabled"
  795. fi
  796. if test "x$sp30" = xyes; then
  797. echo " Spond-sp30.ASICs.....: Enabled"
  798. else
  799. echo " Spond-sp30.ASICs.....: Disabled"
  800. fi
  801. if test "x$bitmine_A1" = xyes; then
  802. echo " Bitmine-A1.ASICs.....: Enabled"
  803. else
  804. echo " Bitmine-A1.ASICs.....: Disabled"
  805. fi
  806. if test "x$dragonmint_t1" = xyes; then
  807. echo " Dragonmint.T1.ASICs..: Enabled"
  808. else
  809. echo " Dragonmint.T1.ASICs..: Disabled"
  810. fi
  811. if test "x$drillbit" = xyes; then
  812. echo " Drillbit.BitFury.....: Enabled"
  813. else
  814. echo " Drillbit.BitFury.....: Disabled"
  815. fi
  816. if test "x$hashfast" = xyes; then
  817. echo " Hashfast.ASICs.......: Enabled"
  818. else
  819. echo " Hashfast.ASICs.......: Disabled"
  820. fi
  821. if test "x$hashratio" = xyes; then
  822. echo " Hashratio.ASICs......: Enabled"
  823. else
  824. echo " Hashratio.ASICs......: Disabled"
  825. fi
  826. if test "x$icarus" = xyes; then
  827. echo " Icarus.ASICs/FPGAs...: Enabled"
  828. else
  829. echo " Icarus.ASICs/FPGAs...: Disabled"
  830. fi
  831. if test "x$klondike" = xyes; then
  832. echo " Klondike.ASICs.......: Enabled"
  833. else
  834. echo " Klondike.ASICs.......: Disabled"
  835. fi
  836. if test "x$knc" = xyes; then
  837. echo " KnC.ASICs............: Enabled"
  838. else
  839. echo " KnC.ASICs............: Disabled"
  840. fi
  841. if test "x$modminer" = xyes; then
  842. echo " ModMiner.FPGAs.......: Enabled"
  843. else
  844. echo " ModMiner.FPGAs.......: Disabled"
  845. fi
  846. #Add any new device to this, along with a no on the end of the test
  847. if test "x$avalon$avalon2$avalon4$avalon7$avalon8$avalon_miner$bab$bflsc$bitforce$bitfury$bitfury16$bitmain_soc$blockerupter$hashfast$hashratio$icarus$klondike$knc$modminer$drillbit$minion$cointerra$bitmine_A1$ants1$ants2$ants3$sp10$sp30$dragonmint_t1" = xnonononononononononononononononononononononononononononono; then
  848. echo
  849. AC_MSG_ERROR([No mining devices configured in])
  850. echo
  851. fi
  852. if test "x$standalone" = xyes; then
  853. if test $drivercount != x; then
  854. echo
  855. AC_MSG_ERROR([You have configured more than one driver in with a driver that is designed to be standalone only (see ./configure --help)])
  856. echo
  857. fi
  858. fi
  859. echo
  860. echo "Compilation............: make (or gmake)"
  861. echo " CPPFLAGS.............: $CPPFLAGS"
  862. echo " CFLAGS...............: $CFLAGS"
  863. echo " LDFLAGS..............: $LDFLAGS $PTHREAD_FLAGS"
  864. echo " LDADD................: $DLOPEN_FLAGS $LIBCURL_LIBS $LIBSYSTEMD_LIBS $JANSSON_LIBS $LIBZ_LIBS $PTHREAD_LIBS $NCURSES_LIBS $PDCURSES_LIBS $WS2_LIBS $MATH_LIBS $LIBUSB_LIBS $RT_LIBS"
  865. echo
  866. echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
  867. echo " prefix...............: $prefix"
  868. echo
  869. if test "x$want_usbutils$dlibusb" = xyesyes; then
  870. echo "*** SYSTEM LIBUSB BEING ADDED - NOT RECOMMENDED UNLESS YOU ARE UNABLE TO COMPILE THE INCLUDED LIBUSB ***"
  871. echo
  872. fi
  873. if test "x$djansson" = xyes; then
  874. echo "*** SYSTEM JANSSON BEING ADDED - NOT RECOMMENDED UNLESS YOU ARE UNABLE TO COMPILE THE INCLUDED JANSSON ***"
  875. echo
  876. fi