configure.ac 20 KB

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