configure.ac 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  2. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  3. m4_define([v_maj], [2])
  4. m4_define([v_min], [10])
  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_CHECK_HEADERS([sys/prctl.h])
  53. AC_FUNC_ALLOCA
  54. have_cygwin=false
  55. have_win32=false
  56. PTHREAD_FLAGS="-lpthread"
  57. DLOPEN_FLAGS="-ldl"
  58. WS2_LIBS=""
  59. MATH_LIBS="-lm"
  60. case $target in
  61. amd64-*)
  62. have_x86_64=true
  63. ;;
  64. x86_64-*)
  65. have_x86_64=true
  66. ;;
  67. *)
  68. have_x86_64=false
  69. ;;
  70. esac
  71. case $target in
  72. *-*-mingw*)
  73. have_x86_64=false
  74. have_win32=true
  75. PTHREAD_FLAGS=""
  76. DLOPEN_FLAGS=""
  77. WS2_LIBS="-lws2_32"
  78. AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support")
  79. ;;
  80. *-*-cygwin*)
  81. have_cygwin=true
  82. ;;
  83. powerpc-*-darwin*)
  84. CFLAGS="$CFLAGS -faltivec"
  85. PTHREAD_FLAGS=""
  86. ;;
  87. *-*-darwin*)
  88. PTHREAD_FLAGS=""
  89. ;;
  90. esac
  91. m4_define([BFG_INCLUDE],
  92. if test "x$2" = "x"; then
  93. $1=''
  94. else
  95. $1="[#]include <$2>"
  96. fi
  97. )
  98. m4_define([BFG_PREPROC_IFELSE],
  99. BFG_INCLUDE([headerinclude], $2)
  100. AC_COMPILE_IFELSE([
  101. AC_LANG_PROGRAM([
  102. ${headerinclude}
  103. ], [
  104. #if !( $1 )
  105. #error "$1 false in preprocessor"
  106. #endif
  107. ])
  108. ],$3,$4)
  109. )
  110. cpumining="no"
  111. AC_ARG_ENABLE([cpumining],
  112. [AC_HELP_STRING([--enable-cpumining],[Build with cpu mining support(default disabled)])],
  113. [cpumining=$enableval]
  114. )
  115. if test "x$cpumining" = xyes; then
  116. AC_DEFINE_UNQUOTED([WANT_CPUMINE], [1], [Enable CPUMINING])
  117. fi
  118. AM_CONDITIONAL([HAS_CPUMINE], [test x$cpumining = xyes])
  119. opencl="yes"
  120. AC_ARG_ENABLE([opencl],
  121. [AC_HELP_STRING([--disable-opencl],[Build without support for OpenCL (default enabled)])],
  122. [opencl=$enableval]
  123. )
  124. if test "x$opencl" = xyes; then
  125. AC_DEFINE([HAVE_OPENCL], [1], [Defined to 1 if OpenCL support is wanted])
  126. else
  127. DLOPEN_FLAGS=""
  128. fi
  129. AM_CONDITIONAL([HAVE_OPENCL], [test x$opencl = xyes])
  130. AC_CHECK_LIB(pthread, pthread_create, [
  131. true
  132. ],
  133. AC_MSG_ERROR([Could not find pthread library - please install libpthread]))
  134. PTHREAD_LIBS=-lpthread
  135. AC_CHECK_LIB(jansson, json_loads, [
  136. true
  137. ],
  138. AC_MSG_ERROR([Could not find jansson library]))
  139. if test "x$opencl" = xyes; then
  140. adl="yes"
  141. AC_ARG_ENABLE([adl],
  142. [AC_HELP_STRING([--disable-adl],[Build without ADL monitoring (default enabled)])],
  143. [adl=$enableval]
  144. )
  145. if test x$adl = xyes
  146. then
  147. AC_DEFINE([HAVE_ADL], [1], [Defined if ADL headers were found])
  148. fi
  149. else
  150. adl="no"
  151. fi
  152. AC_ARG_ENABLE([bitforce],
  153. [AC_HELP_STRING([--disable-bitforce],[Compile support for BitForce (default enabled)])],
  154. [bitforce=$enableval],
  155. [bitforce=yes]
  156. )
  157. if test "x$bitforce" = xyes; then
  158. AC_DEFINE([USE_BITFORCE], [1], [Defined to 1 if BitForce support is wanted])
  159. fi
  160. AM_CONDITIONAL([HAS_BITFORCE], [test x$bitforce = xyes])
  161. AC_ARG_ENABLE([icarus],
  162. [AC_HELP_STRING([--disable-icarus],[Compile support for Icarus (default enabled)])],
  163. [icarus=$enableval],
  164. [icarus=yes]
  165. )
  166. if test "x$icarus" = xyes; then
  167. AC_DEFINE([USE_ICARUS], [1], [Defined to 1 if Icarus support is wanted])
  168. fi
  169. AM_CONDITIONAL([HAS_ICARUS], [test x$icarus = xyes])
  170. AC_ARG_ENABLE([modminer],
  171. [AC_HELP_STRING([--disable-modminer],[Compile support for ModMiner (default enabled)])],
  172. [modminer=$enableval],
  173. [modminer=yes]
  174. )
  175. if test "x$modminer" = xyes; then
  176. AC_DEFINE([USE_MODMINER], [1], [Defined to 1 if ModMiner support is wanted])
  177. fi
  178. AM_CONDITIONAL([HAS_MODMINER], [test x$modminer = xyes])
  179. PKG_PROG_PKG_CONFIG()
  180. libusb=no
  181. libusb_include_path=""
  182. PKG_CHECK_MODULES([LIBUSB], [libusb-1.0],[
  183. libusb=yes
  184. ],[
  185. for usb_lib in usb-1.0 usb; do
  186. AC_CHECK_LIB($usb_lib, libusb_init, [
  187. libusb=yes
  188. break
  189. ], [])
  190. done
  191. if test "x$libusb" = xyes; then
  192. AC_CHECK_DECL([libusb_init],[
  193. ],[
  194. AC_PROG_CPP
  195. AC_MSG_CHECKING([whether libusb_init is declared in subdirectory])
  196. libusb_include_path=`echo '#include <libusb-1.0/libusb.h>' | ${CPP} -M - 2>/dev/null | sed 's/^[^[:space:]]\+[[:space:]]\+\([^[:space:]]\+\)\/.*$/\1/;t;d'`
  197. if test "x$libusb_include_path" != "x"; then
  198. LIBUSB_LIBS="-l$usb_lib"
  199. LIBUSB_CFLAGS="-I$libusb_include_path"
  200. AC_MSG_RESULT([yes])
  201. else
  202. libusb=no
  203. AC_MSG_RESULT([no])
  204. fi
  205. ],[#include <libusb.h>])
  206. fi
  207. ])
  208. if test "x$libusb" = xyes; then
  209. AC_DEFINE([HAVE_LIBUSB], [1], [Define if you have libusb-1.0])
  210. save_CFLAGS="$CFLAGS"
  211. CFLAGS="$LIBUSB_CFLAGS $CFLAGS"
  212. AC_CHECK_DECLS([libusb_error_name],[],[],[#include <libusb.h>])
  213. CFLAGS="$save_CFLAGS"
  214. fi
  215. AC_ARG_ENABLE([x6500],
  216. [AC_HELP_STRING([--disable-x6500],[Compile support for X6500 (default if libusb)])],
  217. [x6500=$enableval],
  218. [x6500=auto]
  219. )
  220. if test "x$x6500$libusb" = xyesno; then
  221. AC_MSG_ERROR([Could not find libusb, required for X6500 support])
  222. elif test "x$x6500" = xauto; then
  223. x6500="$libusb"
  224. if test "x$libusb" = xno; then
  225. AC_MSG_WARN([Could not find libusb, required for X6500 support])
  226. x6500warn=yes
  227. fi
  228. fi
  229. if test "x$x6500" = xyes; then
  230. AC_DEFINE([USE_X6500], [1], [Defined to 1 if X6500 support is wanted])
  231. fi
  232. AM_CONDITIONAL([HAS_X6500], [test x$x6500 = xyes])
  233. AC_ARG_ENABLE([ztex],
  234. [AC_HELP_STRING([--disable-ztex],[Compile support for Ztex (default if libusb)])],
  235. [ztex=$enableval],
  236. [ztex=auto]
  237. )
  238. if test "x$ztex$libusb" = xyesno; then
  239. AC_MSG_ERROR([Could not find libusb, required for Ztex support])
  240. elif test "x$ztex" = xauto; then
  241. ztex="$libusb"
  242. if test "x$libusb" = xno; then
  243. AC_MSG_WARN([Could not find libusb, required for Ztex support])
  244. ztexwarn=yes
  245. fi
  246. fi
  247. if test "x$ztex" = xyes; then
  248. AC_DEFINE([USE_ZTEX], [1], [Defined to 1 if Ztex support is wanted])
  249. fi
  250. AM_CONDITIONAL([HAS_ZTEX], [test x$ztex = xyes])
  251. scrypt="no"
  252. AC_ARG_ENABLE([scrypt],
  253. [AC_HELP_STRING([--enable-scrypt],[Compile support for scrypt mining (default disabled)])],
  254. [scrypt=$enableval]
  255. )
  256. if test "x$scrypt" = xyes; then
  257. AC_DEFINE([USE_SCRYPT], [1], [Defined to 1 if scrypt support is wanted])
  258. fi
  259. curses="auto"
  260. AC_ARG_WITH([curses],
  261. [AC_HELP_STRING([--without-curses],[Compile support for curses TUI (default enabled)])],
  262. [curses=$withval]
  263. )
  264. if test "x$curses" = "xno"; then
  265. cursesmsg='User specified --without-curses. TUI support DISABLED'
  266. else
  267. if test "x$cross_compiling" != "xyes"; then
  268. AC_MSG_CHECKING([for best native curses library])
  269. orig_libs="$LIBS"
  270. orig_cflags="$CFLAGS"
  271. for curses_lib in ncurses{w,}{,6,5}; do
  272. if ! ${curses_lib}-config --cflags >/dev/null 2>/dev/null; then
  273. continue
  274. fi
  275. CFLAGS="$orig_cflags $(${curses_lib}-config --cflags)"
  276. LIBS="$orig_libs $(${curses_lib}-config --libs)"
  277. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  278. #include <curses.h>
  279. ]], [[
  280. WINDOW *w = NULL;
  281. mvwprintw(w, 2, 2, "Testing %s", "o hai");
  282. ]])], [
  283. curses=yes
  284. cursesmsg="FOUND: ${curses_lib}"
  285. AC_MSG_RESULT([$curses_lib])
  286. NCURSES_LIBS=`${curses_lib}-config --libs`
  287. NCURSES_CPPFLAGS=`${curses_lib}-config --cflags`
  288. break
  289. ], [
  290. AC_MSG_WARN([${curses_lib} doesn't seem to be installed properly])
  291. ])
  292. done
  293. LIBS="$orig_libs"
  294. CFLAGS="$orig_cflags"
  295. if test "x$curses" != "xyes"; then
  296. AC_MSG_RESULT([none?])
  297. fi
  298. fi
  299. if test "x$curses" != "xyes"; then
  300. AC_SEARCH_LIBS(addstr, ncursesw ncurses pdcurses, [
  301. curses=yes
  302. cursesmsg="FOUND: ${ac_cv_search_addstr}"
  303. cursesmsg="${cursesmsg/-l/}"
  304. ], [
  305. if test "x$curses" = "xyes"; then
  306. AC_MSG_ERROR([Could not find curses library - please install libncurses-dev or pdcurses-dev (or configure --without-curses)])
  307. else
  308. AC_MSG_WARN([Could not find curses library - if you want a TUI, install libncurses-dev or pdcurses-dev])
  309. curses=no
  310. cursesmsg='NOT FOUND. TUI support DISABLED'
  311. fi
  312. ])
  313. fi
  314. if test "x$curses" = "xyes"; then
  315. AC_DEFINE([HAVE_CURSES], [1], [Defined to 1 if curses TUI support is wanted])
  316. fi
  317. fi
  318. AC_CONFIG_SUBDIRS([libblkmaker])
  319. AM_CONDITIONAL([NEED_LIBBLKMAKER], [true])
  320. AM_CONDITIONAL([NEED_DYNCLOCK], [test x$icarus$modminer$x6500$ztex != xnonono])
  321. AM_CONDITIONAL([NEED_FPGAUTILS], [test x$icarus$bitforce$modminer$x6500$ztex != xnononono])
  322. AM_CONDITIONAL([HAS_SCRYPT], [test x$scrypt = xyes])
  323. AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
  324. AM_CONDITIONAL([HAVE_CYGWIN], [test x$have_cygwin = xtrue])
  325. AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
  326. AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
  327. JANSSON_LIBS=-ljansson
  328. dnl Find YASM
  329. has_yasm=false
  330. AC_PATH_PROG([YASM],[yasm],[false])
  331. if test "x$YASM" != "xfalse" ; then
  332. AC_MSG_CHECKING([if yasm version is greater than 1.0.1])
  333. yasmver=`yasm --version | head -1 | cut -d\ -f2`
  334. yamajor=`echo $yasmver | cut -d. -f1`
  335. yaminor=`echo $yasmver | cut -d. -f2`
  336. yamini=`echo $yasmver | cut -d. -f3`
  337. if test "$yamajor" -ge "1" ; then
  338. if test "$yamajor" -eq "1" ; then
  339. if test "$yaminor" -ge "0" ; then
  340. if test "$yaminor" -eq "0"; then
  341. if test "$yamini" -ge "1"; then
  342. has_yasm=true
  343. fi
  344. else
  345. has_yasm=true
  346. fi
  347. fi
  348. fi
  349. else
  350. has_yasm=false
  351. fi
  352. if test "x$has_yasm" = "xtrue" ; then
  353. AC_MSG_RESULT([yes])
  354. else
  355. AC_MSG_RESULT([no])
  356. fi
  357. fi
  358. if test "x$has_yasm" = "xfalse" ; then
  359. AC_MSG_NOTICE([yasm is required for the assembly algorithms. They will be skipped.])
  360. fi
  361. AM_CONDITIONAL([HAS_YASM], [test x$has_yasm = xtrue])
  362. if test "x$bitforce$modminer" != xnono; then
  363. AC_ARG_WITH([libudev], [AC_HELP_STRING([--without-libudev], [Autodetect FPGAs using libudev (default enabled)])],
  364. [libudev=$withval],
  365. [libudev=auto]
  366. )
  367. if test "x$libudev" != "xno"; then
  368. AC_CHECK_HEADER([libudev.h],[
  369. libudev=yes
  370. UDEV_LIBS=-ludev
  371. AC_DEFINE([HAVE_LIBUDEV], [1], [Defined to 1 if libudev is wanted])
  372. ], [
  373. if test "x$libudev" = "xyes"; then
  374. AC_MSG_ERROR([libudev not found])
  375. fi
  376. libudev=no
  377. ])
  378. fi
  379. fi
  380. AM_CONDITIONAL([HAVE_LIBUDEV], [test x$libudev != xno])
  381. AC_SUBST(LIBUSB_LIBS)
  382. AC_SUBST(LIBUSB_CFLAGS)
  383. PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.18.2], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.18.2])])
  384. if echo "$LIBCURL_CFLAGS" | grep '@CPPFLAG_CURL_STATICLIB@' >/dev/null 2>&1; then
  385. AC_MSG_WARN([Your libcurl pkgconfig file is broken, applying workaround])
  386. LIBCURL_CFLAGS=`echo "$LIBCURL_CFLAGS" | sed 's/@CPPFLAG_CURL_STATICLIB@//'`
  387. fi
  388. AC_SUBST(LIBCURL_LIBS)
  389. dnl CCAN wants to know a lot of vars.
  390. # All the configuration checks. Regrettably, the __attribute__ checks will
  391. # give false positives on old GCCs, since they just cause warnings. But that's
  392. # fairly harmless.
  393. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((cold)) cleanup(void) { }])],
  394. AC_DEFINE([HAVE_ATTRIBUTE_COLD], [1],
  395. [Define if __attribute__((cold))]))
  396. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((const)) cleanup(void) { }])],
  397. AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1],
  398. [Define if __attribute__((const))]))
  399. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((noreturn)) cleanup(void) { exit(1); }])],
  400. AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
  401. [Define if __attribute__((noreturn))]))
  402. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((format(__printf__, 1, 2))) cleanup(const char *fmt, ...) { }])],
  403. AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1],
  404. [Define if __attribute__((format(__printf__)))]))
  405. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((unused)) cleanup(void) { }])],
  406. AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1],
  407. [Define if __attribute__((unused))]))
  408. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((used)) cleanup(void) { }])],
  409. AC_DEFINE([HAVE_ATTRIBUTE_USED], [1],
  410. [Define if __attribute__((used))]))
  411. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_constant_p(1) ? 0 : 1; }])],
  412. AC_DEFINE([HAVE_BUILTIN_CONSTANT_P], [1],
  413. [Define if have __builtin_constant_p]))
  414. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_types_compatible_p(char *, int) ? 1 : 0; }])],
  415. AC_DEFINE([HAVE_BUILTIN_TYPES_COMPATIBLE_P], [1],
  416. [Define if have __builtin_types_compatible_p]))
  417. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static int __attribute__((warn_unused_result)) func(int x) { return x; }])],
  418. AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1],
  419. [Define if __attribute__((warn_unused_result))]))
  420. # byteswap functions
  421. AH_TEMPLATE([HAVE_BYTESWAP_H], [Define to use byteswap macros from byteswap.h])
  422. AH_TEMPLATE([HAVE_ENDIAN_H], [Define to use byteswap macros from endian.h])
  423. AH_TEMPLATE([HAVE_SYS_ENDIAN_H], [Define to use byteswap macros from sys/endian.h])
  424. AH_TEMPLATE([HAVE_LIBKERN_OSBYTEORDER_H], [Define to use byteswap macros from libkern/OSByteOrder.h])
  425. BSWAP=''
  426. for sym in bswap_ __builtin_bswap __bswap_ __swap swap OSSwapInt; do
  427. AC_MSG_CHECKING([for ${sym}* functions])
  428. for headerfile in '' byteswap.h endian.h sys/endian.h libkern/OSByteOrder.h; do
  429. BFG_INCLUDE([headerinclude], [${headerfile}])
  430. AC_LINK_IFELSE([
  431. AC_LANG_PROGRAM([
  432. ${headerinclude}
  433. ], [
  434. (void) ${sym}16(0);
  435. (void) ${sym}32(0);
  436. (void) ${sym}64(0);
  437. ])
  438. ], [
  439. BSWAP="${sym}"
  440. if test "x${headerfile}" = "x"; then
  441. AC_MSG_RESULT([yes])
  442. else
  443. AC_MSG_RESULT([found in ${headerfile}])
  444. AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$headerfile]), 1)
  445. fi
  446. break 2
  447. ],[])
  448. done
  449. AC_MSG_RESULT([no])
  450. done
  451. if test "x$BSWAP" = "x"; then
  452. true # Substitutes are provided in miner.h
  453. elif test "x$BSWAP" = "xbswap_"; then
  454. AC_MSG_CHECKING([if bswap_16 is already a macro])
  455. BFG_PREPROC_IFELSE([defined(bswap_16)], $headerfile, [
  456. AC_MSG_RESULT([yes])
  457. BSWAP=""
  458. ],[
  459. AC_MSG_RESULT([no])
  460. ])
  461. fi
  462. if test "x$BSWAP" != "x"; then
  463. AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, [Define to 16-bit byteswap macro])
  464. AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, [Define to 16-bit byteswap macro])
  465. AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, [Define to 16-bit byteswap macro])
  466. fi
  467. # endian definition macros
  468. AC_MSG_CHECKING([for platform endian])
  469. found_endian=no
  470. for headerfile in '' endian.h sys/endian.h sys/param.h; do
  471. for pfx in '' '__'; do
  472. 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}, [
  473. if test "x$headerfile" != "x"; then
  474. headerfile=" (${headerfile})"
  475. fi
  476. BFG_PREPROC_IFELSE([${pfx}BYTE_ORDER == ${pfx}BIG_ENDIAN], ${headerfile}, [
  477. AC_MSG_RESULT([big endian$headerfile])
  478. AC_DEFINE(WORDS_BIGENDIAN, 1, [Define if your platform is big endian])
  479. ], [
  480. AC_MSG_RESULT([little endian$headerfile])
  481. ])
  482. found_endian=yes
  483. break 2
  484. ],[true])
  485. done
  486. done
  487. if test "x$found_endian" = "xno"; then
  488. if $have_win32 || $have_cygwin; then
  489. AC_MSG_RESULT([assuming little endian (Windows)])
  490. else
  491. # AC_C_BIGENDIAN is reported to have problems, and invasive even if buried in a conditional, so don't use it
  492. AC_MSG_RESULT([unknown])
  493. AC_MSG_ERROR([Unable to identify platform endian])
  494. fi
  495. fi
  496. AC_MSG_CHECKING([if GNU format attribute compiles])
  497. AC_TRY_COMPILE([
  498. #define FORMAT_SYNTAX_CHECK(...) __attribute__(( format(__VA_ARGS__) ))
  499. int myfunc(char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
  500. int myfunc(char *fmt, ...) {
  501. return 42;
  502. }
  503. ], [
  504. myfunc("abc%d", 42);
  505. ], [
  506. AC_MSG_RESULT([yes])
  507. AC_DEFINE_UNQUOTED([FORMAT_SYNTAX_CHECK(...)], [__attribute__(( format(__VA_ARGS__) ))], [Syntax of format-checking attribute])
  508. ], [
  509. AC_MSG_RESULT([no])
  510. AC_DEFINE_UNQUOTED([FORMAT_SYNTAX_CHECK(...)], [])
  511. ])
  512. if test "x$prefix" = xNONE; then
  513. prefix=/usr/local
  514. fi
  515. AC_DEFINE_UNQUOTED([CGMINER_PREFIX], ["$prefix/bin"], [Path to bfgminer install])
  516. AC_DEFINE_UNQUOTED([PHATK_KERNNAME], ["phatk121016"], [Filename for phatk kernel])
  517. AC_DEFINE_UNQUOTED([POCLBM_KERNNAME], ["poclbm121016"], [Filename for poclbm kernel])
  518. AC_DEFINE_UNQUOTED([DIAKGCN_KERNNAME], ["diakgcn121016"], [Filename for diakgcn kernel])
  519. AC_DEFINE_UNQUOTED([DIABLO_KERNNAME], ["diablo121016"], [Filename for diablo kernel])
  520. AC_DEFINE_UNQUOTED([SCRYPT_KERNNAME], ["scrypt121016"], [Filename for scrypt kernel])
  521. AC_SUBST(JANSSON_LIBS)
  522. AC_SUBST(PTHREAD_FLAGS)
  523. AC_SUBST(DLOPEN_FLAGS)
  524. AC_SUBST(PTHREAD_LIBS)
  525. AC_SUBST(NCURSES_CPPFLAGS)
  526. AC_SUBST(NCURSES_LIBS)
  527. AC_SUBST(PDCURSES_LIBS)
  528. AC_SUBST(WS2_LIBS)
  529. AC_SUBST(MATH_LIBS)
  530. AC_SUBST(UDEV_LIBS)
  531. AC_CONFIG_FILES([
  532. Makefile
  533. x86_64/Makefile
  534. x86_32/Makefile
  535. ccan/Makefile
  536. lib/Makefile
  537. ])
  538. AC_OUTPUT
  539. echo
  540. echo
  541. echo
  542. echo "------------------------------------------------------------------------"
  543. echo "$PACKAGE $VERSION"
  544. echo "------------------------------------------------------------------------"
  545. echo
  546. echo
  547. echo "Configuration Options Summary:"
  548. echo
  549. echo " curses.TUI...........: $cursesmsg"
  550. if test "x$scrypt" != xno; then
  551. echo " scrypt...............: Enabled"
  552. else
  553. echo " scrypt...............: Disabled"
  554. fi
  555. echo
  556. if test "x$opencl" = xyes; then
  557. echo " OpenCL...............: Enabled"
  558. else
  559. echo " OpenCL...............: Disabled"
  560. fi
  561. if test "x$adl" = xyes; then
  562. echo " ADL.monitoring.....: Enabled"
  563. elif test "x$opencl" = xyes; then
  564. echo " ADL.monitoring.....: Disabled"
  565. else
  566. echo " ADL.monitoring.....: n/a"
  567. fi
  568. if test "x$bitforce" = xyes; then
  569. echo " BitForce.FPGAs.......: Enabled"
  570. else
  571. echo " BitForce.FPGAs.......: Disabled"
  572. fi
  573. if test "x$icarus" = xyes; then
  574. echo " Icarus.FPGAs.........: Enabled"
  575. else
  576. echo " Icarus.FPGAs.........: Disabled"
  577. fi
  578. if test "x$modminer" = xyes; then
  579. echo " ModMiner.FPGAs.......: Enabled"
  580. else
  581. echo " ModMiner.FPGAs.......: Disabled"
  582. fi
  583. if test "x$x6500" = xyes; then
  584. echo " X6500.FPGAs..........: Enabled"
  585. elif test "x$ztexwarn" = xyes; then
  586. echo " X6500.FPGAs..........: Disabled (libusb not found)"
  587. else
  588. echo " X6500.FPGAs..........: Disabled"
  589. fi
  590. if test "x$ztex" = xyes; then
  591. echo " Ztex.FPGAs...........: Enabled"
  592. elif test "x$ztexwarn" = xyes; then
  593. echo " Ztex.FPGAs...........: Disabled (libusb not found)"
  594. else
  595. echo " Ztex.FPGAs...........: Disabled"
  596. fi
  597. if test "x$bitforce$modminer" != xnono; then
  598. echo " libudev.detection....: $libudev"
  599. fi
  600. echo
  601. if test "x$cpumining" = xyes; then
  602. echo " CPU Mining...........: Enabled"
  603. echo " ASM.(for CPU mining).: $has_yasm"
  604. else
  605. echo " CPU Mining...........: Disabled"
  606. fi
  607. echo
  608. echo "Compilation............: make (or gmake)"
  609. echo " CPPFLAGS.............:" $CPPFLAGS $NCURSES_CPPFLAGS
  610. echo " CFLAGS...............:" $CFLAGS $LIBUSB_CFLAGS
  611. echo " LDFLAGS..............:" $LDFLAGS $PTHREAD_FLAGS
  612. echo " LDADD................:" $LIBS $DLOPEN_FLAGS $LIBCURL_LIBS $JANSSON_LIBS $PTHREAD_LIBS $NCURSES_LIBS $PDCURSES_LIBS $WS2_LIBS $MATH_LIBS $UDEV_LIBS $LIBUSB_LIBS
  613. echo
  614. echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
  615. echo " prefix...............: $prefix"
  616. echo