configure.ac 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  2. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  3. m4_define([v_maj], [2])
  4. m4_define([v_min], [5])
  5. m4_define([v_mic], [2])
  6. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  7. m4_define([v_ver], [v_maj.v_min.v_mic])
  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([bfgminer], [v_ver], [luke-jr+bfgminer@utopios.org])
  14. AC_PREREQ([2.59c])
  15. AC_CANONICAL_SYSTEM
  16. AC_CONFIG_MACRO_DIR([m4])
  17. AC_CONFIG_SRCDIR([miner.c])
  18. AC_CONFIG_HEADERS([config.h])
  19. AM_INIT_AUTOMAKE([foreign])
  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_C99
  43. gl_EARLY
  44. AC_PROG_GCC_TRADITIONAL
  45. AM_PROG_CC_C_O
  46. AC_PROG_RANLIB
  47. gl_INIT
  48. dnl Checks for header files.
  49. AC_HEADER_STDC
  50. AC_CHECK_HEADERS(syslog.h)
  51. AC_CHECK_HEADERS([sys/epoll.h])
  52. AC_FUNC_ALLOCA
  53. have_win32=false
  54. PTHREAD_FLAGS="-lpthread"
  55. USB_LIBS=""
  56. USB_FLAGS=""
  57. DLOPEN_FLAGS="-ldl"
  58. WS2_LIBS=""
  59. MATH_LIBS="-lm"
  60. case $target in
  61. x86_64-*)
  62. have_x86_64=true
  63. ;;
  64. *)
  65. have_x86_64=false
  66. ;;
  67. esac
  68. case $target in
  69. x86_64-w64-mingw32)
  70. have_x86_64=true
  71. have_win32=true
  72. PTHREAD_FLAGS=""
  73. DLOPEN_FLAGS=""
  74. WS2_LIBS="-lws2_32"
  75. ;;
  76. *-*-mingw*)
  77. have_x86_64=false
  78. have_win32=true
  79. PTHREAD_FLAGS=""
  80. DLOPEN_FLAGS=""
  81. WS2_LIBS="-lws2_32"
  82. ;;
  83. powerpc-*-darwin*)
  84. CFLAGS="$CFLAGS -faltivec"
  85. PTHREAD_FLAGS=""
  86. ;;
  87. *-*-darwin*)
  88. PTHREAD_FLAGS=""
  89. ;;
  90. esac
  91. cpumining="no"
  92. AC_ARG_ENABLE([cpumining],
  93. [AC_HELP_STRING([--enable-cpumining],[Build with cpu mining support(default disabled)])],
  94. [cpumining=$enableval]
  95. )
  96. if test "x$cpumining" = xyes; then
  97. AC_DEFINE_UNQUOTED([WANT_CPUMINE], [1], [Enable CPUMINING])
  98. fi
  99. AM_CONDITIONAL([HAS_CPUMINE], [test x$cpumining = xyes])
  100. opencl="yes"
  101. AC_ARG_ENABLE([opencl],
  102. [AC_HELP_STRING([--disable-opencl],[Build without support for OpenCL (default enabled)])],
  103. [opencl=$enableval]
  104. )
  105. if test "x$opencl" = xyes; then
  106. AC_DEFINE([HAVE_OPENCL], [1], [Defined to 1 if OpenCL support is wanted])
  107. fi
  108. AM_CONDITIONAL([HAVE_OPENCL], [test x$opencl = xyes])
  109. AC_CHECK_LIB(pthread, pthread_create, ,
  110. AC_MSG_ERROR([Could not find pthread library - please install libpthread]))
  111. PTHREAD_LIBS=-lpthread
  112. AC_CHECK_LIB(jansson, json_loads, request_jansson=false, request_jansson=true)
  113. AC_ARG_ENABLE([adl],
  114. [AC_HELP_STRING([--disable-adl],[Override detection and disable building with adl])],
  115. [adl=$enableval]
  116. )
  117. scrypt="no"
  118. if test "x$opencl" = xyes; then
  119. if test "x$adl" != xno; then
  120. if test -f ADL_SDK/adl_sdk.h; then
  121. have_adl=true
  122. else
  123. have_adl=false
  124. fi
  125. if test x$have_adl = xtrue
  126. then
  127. AC_DEFINE([HAVE_ADL], [1], [Defined if ADL headers were found])
  128. else
  129. DLOPEN_FLAGS=""
  130. fi
  131. fi
  132. AC_ARG_ENABLE([scrypt],
  133. [AC_HELP_STRING([--enable-scrypt],[Compile support for scrypt litecoin mining (default disabled)])],
  134. [scrypt=$enableval]
  135. )
  136. if test "x$scrypt" = xyes; then
  137. AC_DEFINE([USE_SCRYPT], [1], [Defined to 1 if scrypt support is wanted])
  138. fi
  139. else
  140. DLOPEN_FLAGS=""
  141. fi
  142. AM_CONDITIONAL([HAS_SCRYPT], [test x$scrypt = xyes])
  143. bitforce="no"
  144. AC_ARG_ENABLE([bitforce],
  145. [AC_HELP_STRING([--enable-bitforce],[Compile support for BitForce FPGAs(default disabled)])],
  146. [bitforce=$enableval]
  147. )
  148. if test "x$bitforce" = xyes; then
  149. AC_DEFINE([USE_BITFORCE], [1], [Defined to 1 if BitForce support is wanted])
  150. fi
  151. AM_CONDITIONAL([HAS_BITFORCE], [test x$bitforce = xyes])
  152. icarus="no"
  153. AC_ARG_ENABLE([icarus],
  154. [AC_HELP_STRING([--enable-icarus],[Compile support for Icarus (default disabled)])],
  155. [icarus=$enableval]
  156. )
  157. if test "x$icarus" = xyes; then
  158. AC_DEFINE([USE_ICARUS], [1], [Defined to 1 if Icarus support is wanted])
  159. fi
  160. AM_CONDITIONAL([HAS_ICARUS], [test x$icarus = xyes])
  161. modminer="no"
  162. AC_ARG_ENABLE([modminer],
  163. [AC_HELP_STRING([--enable-modminer],[Compile support for ModMiner FPGAs(default disabled)])],
  164. [modminer=$enableval]
  165. )
  166. if test "x$modminer" = xyes; then
  167. AC_DEFINE([USE_MODMINER], [1], [Defined to 1 if ModMiner support is wanted])
  168. fi
  169. AM_CONDITIONAL([HAS_MODMINER], [test x$modminer = xyes])
  170. ztex="no"
  171. AC_ARG_ENABLE([ztex],
  172. [AC_HELP_STRING([--enable-ztex],[Compile support for Ztex (default disabled)])],
  173. [ztex=$enableval]
  174. )
  175. if test "x$ztex" = xyes; then
  176. AC_DEFINE([USE_ZTEX], [1], [Defined to 1 if Ztex support is wanted])
  177. fi
  178. AM_CONDITIONAL([HAS_ZTEX], [test x$ztex = xyes])
  179. curses="auto"
  180. AC_ARG_WITH([curses],
  181. [AC_HELP_STRING([--without-curses],[Compile support for curses TUI (default enabled)])],
  182. [curses=$withval]
  183. )
  184. if test "x$curses" = "xno"; then
  185. cursesmsg='User specified --without-curses. TUI support DISABLED'
  186. else
  187. AC_SEARCH_LIBS(addstr, ncurses pdcurses, [
  188. curses=yes
  189. cursesmsg="FOUND: ${ac_cv_search_addstr:2}"
  190. AC_DEFINE([HAVE_CURSES], [1], [Defined to 1 if curses TUI support is wanted])
  191. ], [
  192. if test "x$curses" = "xyes"; then
  193. AC_MSG_ERROR([Could not find curses library - please install libncurses-dev or pdcurses-dev (or configure --without-curses)])
  194. else
  195. AC_MSG_WARN([Could not find curses library - if you want a TUI, install libncurses-dev or pdcurses-dev])
  196. curses=no
  197. cursesmsg='NOT FOUND. TUI support DISABLED'
  198. fi
  199. ])
  200. fi
  201. AM_CONDITIONAL([NEED_FPGAUTILS], [test x$icarus$bitforce$modminer$ztex != xnononono])
  202. AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
  203. AM_CONDITIONAL([WANT_JANSSON], [test x$request_jansson = xtrue])
  204. AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
  205. AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
  206. if test x$request_jansson = xtrue
  207. then
  208. JANSSON_LIBS="compat/jansson/libjansson.a"
  209. else
  210. JANSSON_LIBS=-ljansson
  211. fi
  212. dnl Find YASM
  213. has_yasm=false
  214. AC_PATH_PROG([YASM],[yasm],[false])
  215. if test "x$YASM" != "xfalse" ; then
  216. AC_MSG_CHECKING([if yasm version is greater than 1.0.1])
  217. yasmver=`yasm --version | head -1 | cut -d\ -f2`
  218. yamajor=`echo $yasmver | cut -d. -f1`
  219. yaminor=`echo $yasmver | cut -d. -f2`
  220. yamini=`echo $yasmver | cut -d. -f3`
  221. if test "$yamajor" -ge "1" ; then
  222. if test "$yamajor" -eq "1" ; then
  223. if test "$yaminor" -ge "0" ; then
  224. if test "$yaminor" -eq "0"; then
  225. if test "$yamini" -ge "1"; then
  226. has_yasm=true
  227. fi
  228. else
  229. has_yasm=true
  230. fi
  231. fi
  232. fi
  233. else
  234. has_yasm=false
  235. fi
  236. if test "x$has_yasm" = "xtrue" ; then
  237. AC_MSG_RESULT([yes])
  238. else
  239. AC_MSG_RESULT([no])
  240. fi
  241. fi
  242. if test "x$has_yasm" = "xfalse" ; then
  243. AC_MSG_NOTICE([yasm is required for the assembly algorithms. They will be skipped.])
  244. fi
  245. AM_CONDITIONAL([HAS_YASM], [test x$has_yasm = xtrue])
  246. if test "x$bitforce$modminer" != xnono; then
  247. AC_ARG_WITH([libudev], [AC_HELP_STRING([--without-libudev], [Autodetect FPGAs using libudev (default enabled)])],
  248. [libudev=$withval],
  249. [libudev=auto]
  250. )
  251. if test "x$libudev" != "xno"; then
  252. AC_CHECK_HEADER([libudev.h],[
  253. libudev=yes
  254. UDEV_LIBS=-ludev
  255. AC_DEFINE([HAVE_LIBUDEV], [1], [Defined to 1 if libudev is wanted])
  256. ], [
  257. if test "x$libudev" = "xyes"; then
  258. AC_MSG_ERROR([libudev not found])
  259. fi
  260. libudev=no
  261. ])
  262. fi
  263. fi
  264. AM_CONDITIONAL([HAVE_LIBUDEV], [test x$libudev != xno])
  265. if test "x$ztex" != xno; then
  266. AC_CHECK_LIB(usb-1.0, libusb_init, ,
  267. AC_MSG_ERROR([Could not find usb library - please install libusb]))
  268. AC_DEFINE([HAVE_LIBUSB], [1], [Defined to 1 if libusb is wanted])
  269. USB_LIBS="-lusb-1.0"
  270. USB_FLAGS=""
  271. fi
  272. PKG_PROG_PKG_CONFIG()
  273. PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.15.6], [AC_DEFINE([CURL_HAS_SOCKOPT], [1], [Defined if version of curl supports sockopts.])],
  274. [PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.10.1], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.10.1])])])
  275. AC_SUBST(LIBCURL_LIBS)
  276. dnl CCAN wants to know a lot of vars.
  277. # All the configuration checks. Regrettably, the __attribute__ checks will
  278. # give false positives on old GCCs, since they just cause warnings. But that's
  279. # fairly harmless.
  280. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((cold)) cleanup(void) { }])],
  281. AC_DEFINE([HAVE_ATTRIBUTE_COLD], [1],
  282. [Define if __attribute__((cold))]))
  283. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((const)) cleanup(void) { }])],
  284. AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1],
  285. [Define if __attribute__((const))]))
  286. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((noreturn)) cleanup(void) { exit(1); }])],
  287. AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
  288. [Define if __attribute__((noreturn))]))
  289. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((format(__printf__, 1, 2))) cleanup(const char *fmt, ...) { }])],
  290. AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1],
  291. [Define if __attribute__((format(__printf__)))]))
  292. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((unused)) cleanup(void) { }])],
  293. AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1],
  294. [Define if __attribute__((unused))]))
  295. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((used)) cleanup(void) { }])],
  296. AC_DEFINE([HAVE_ATTRIBUTE_USED], [1],
  297. [Define if __attribute__((used))]))
  298. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_constant_p(1) ? 0 : 1; }])],
  299. AC_DEFINE([HAVE_BUILTIN_CONSTANT_P], [1],
  300. [Define if have __builtin_constant_p]))
  301. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_types_compatible_p(char *, int) ? 1 : 0; }])],
  302. AC_DEFINE([HAVE_BUILTIN_TYPES_COMPATIBLE_P], [1],
  303. [Define if have __builtin_types_compatible_p]))
  304. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static int __attribute__((warn_unused_result)) func(int x) { return x; }])],
  305. AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1],
  306. [Define if __attribute__((warn_unused_result))]))
  307. if test "x$prefix" = xNONE; then
  308. prefix=/usr/local
  309. fi
  310. AC_DEFINE_UNQUOTED([CGMINER_PREFIX], ["$prefix/bin"], [Path to bfgminer install])
  311. AC_DEFINE_UNQUOTED([PHATK_KERNNAME], ["phatk120724"], [Filename for phatk kernel])
  312. AC_DEFINE_UNQUOTED([POCLBM_KERNNAME], ["poclbm120724"], [Filename for poclbm kernel])
  313. AC_DEFINE_UNQUOTED([DIAKGCN_KERNNAME], ["diakgcn120724"], [Filename for diakgcn kernel])
  314. AC_DEFINE_UNQUOTED([DIABLO_KERNNAME], ["diablo120724"], [Filename for diablo kernel])
  315. AC_DEFINE_UNQUOTED([SCRYPT_KERNNAME], ["scrypt120724"], [Filename for scrypt kernel])
  316. AC_SUBST(JANSSON_LIBS)
  317. AC_SUBST(PTHREAD_FLAGS)
  318. AC_SUBST(DLOPEN_FLAGS)
  319. AC_SUBST(PTHREAD_LIBS)
  320. AC_SUBST(NCURSES_LIBS)
  321. AC_SUBST(PDCURSES_LIBS)
  322. AC_SUBST(WS2_LIBS)
  323. AC_SUBST(MATH_LIBS)
  324. AC_SUBST(UDEV_LIBS)
  325. AC_SUBST(USB_LIBS)
  326. AC_SUBST(USB_FLAGS)
  327. AC_CONFIG_FILES([
  328. Makefile
  329. compat/Makefile
  330. compat/jansson/Makefile
  331. x86_64/Makefile
  332. x86_32/Makefile
  333. ccan/Makefile
  334. lib/Makefile
  335. ])
  336. AC_OUTPUT
  337. echo
  338. echo
  339. echo
  340. echo "------------------------------------------------------------------------"
  341. echo "$PACKAGE $VERSION"
  342. echo "------------------------------------------------------------------------"
  343. echo
  344. echo
  345. echo "Configuration Options Summary:"
  346. echo
  347. echo " curses.TUI...........: $cursesmsg"
  348. echo
  349. if test "x$opencl" = xyes; then
  350. echo " OpenCL...............: Enabled"
  351. if test "x$scrypt" != xno; then
  352. echo " scrypt...............: Enabled"
  353. else
  354. echo " scrypt...............: Disabled"
  355. fi
  356. else
  357. echo " OpenCL...............: Disabled"
  358. echo " scrypt...............: Disabled (needs OpenCL)"
  359. fi
  360. if test "x$adl" != xno; then
  361. if test x$have_adl = xtrue; then
  362. echo " ADL................: SDK found, GPU monitoring support enabled"
  363. else
  364. echo " ADL................: SDK NOT found, GPU monitoring support DISABLED"
  365. fi
  366. else
  367. echo " ADL................: Detection overrided. GPU monitoring support DISABLED"
  368. fi
  369. if test "x$bitforce" = xyes; then
  370. echo " BitForce.FPGAs.......: Enabled"
  371. else
  372. echo " BitForce.FPGAs.......: Disabled"
  373. fi
  374. if test "x$icarus" = xyes; then
  375. echo " Icarus.FPGAs.........: Enabled"
  376. else
  377. echo " Icarus.FPGAs.........: Disabled"
  378. fi
  379. if test "x$modminer" = xyes; then
  380. echo " ModMiner.FPGAs.......: Enabled"
  381. else
  382. echo " ModMiner.FPGAs.......: Disabled"
  383. fi
  384. if test "x$ztex" = xyes; then
  385. echo " Ztex.FPGAs...........: Enabled"
  386. else
  387. echo " Ztex.FPGAs...........: Disabled"
  388. fi
  389. if test "x$bitforce$modminer" != xnono; then
  390. echo " libudev.detection....: $libudev"
  391. fi
  392. echo
  393. if test "x$cpumining" = xyes; then
  394. echo " CPU Mining...........: Enabled"
  395. echo " ASM.(for CPU mining).: $has_yasm"
  396. else
  397. echo " CPU Mining...........: Disabled"
  398. fi
  399. echo
  400. echo "Compilation............: make (or gmake)"
  401. echo " CPPFLAGS.............: $CPPFLAGS"
  402. echo " CFLAGS...............: $CFLAGS"
  403. echo " LDFLAGS..............: $LDFLAGS $PTHREAD_FLAGS $USB_FLAGS"
  404. echo " LDADD................: $DLOPEN_FLAGS $LIBCURL_LIBS $JANSSON_LIBS $PTHREAD_LIBS $NCURSES_LIBS $PDCURSES_LIBS $WS2_LIBS $MATH_LIBS $UDEV_LIBS $USB_LIBS"
  405. echo
  406. echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
  407. echo " prefix...............: $prefix"
  408. echo