configure.ac 20 KB

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