configure.ac 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041
  1. dnl * Copyright 2012-2013 Luke Dashjr
  2. dnl * Copyright 2011-2013 Con Kolivas
  3. dnl * Copyright 2010-2011 Jeff Garzik
  4. dnl * Copyright 2012 Xiangfu
  5. dnl * Copyright 2011 Rusty Russell
  6. dnl * Copyright 2011 Mark Crichton
  7. dnl *
  8. dnl * This program is free software; you can redistribute it and/or modify it
  9. dnl * under the terms of the GNU General Public License as published by the Free
  10. dnl * Software Foundation; either version 3 of the License, or (at your option)
  11. dnl * any later version. See COPYING for more details.
  12. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  13. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  14. m4_define([v_maj], [3])
  15. m4_define([v_min], [1])
  16. m4_define([v_mic], [3])
  17. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  18. m4_define([v_ver], [v_maj.v_min.v_mic])
  19. m4_define([lt_rev], m4_eval(v_maj + v_min))
  20. m4_define([lt_cur], v_mic)
  21. m4_define([lt_age], v_min)
  22. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  23. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  24. AC_INIT([bfgminer], [v_ver], [luke-jr+bfgminer@utopios.org])
  25. AC_PREREQ([2.59c])
  26. AC_CANONICAL_SYSTEM
  27. AC_CONFIG_MACRO_DIR([m4])
  28. AC_CONFIG_SRCDIR([miner.c])
  29. AC_CONFIG_HEADERS([config.h])
  30. AM_INIT_AUTOMAKE([foreign])
  31. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  32. AC_USE_SYSTEM_EXTENSIONS
  33. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  34. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  35. m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
  36. m4_ifdef([v_rel], , [m4_define([v_rel], [])])
  37. AC_DEFINE_UNQUOTED(CGMINER_MAJOR_VERSION, [v_maj], [Major version])
  38. AC_DEFINE_UNQUOTED(CGMINER_MINOR_VERSION, [v_min], [Minor version])
  39. AC_DEFINE_UNQUOTED(CGMINER_MINOR_SUBVERSION, [v_mic], [Micro version])
  40. version_info="lt_rev:lt_cur:lt_age"
  41. release_info="v_rel"
  42. AC_SUBST(version_info)
  43. AC_SUBST(release_info)
  44. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  45. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  46. VMAJ=v_maj
  47. AC_SUBST(VMAJ)
  48. AC_CANONICAL_BUILD
  49. AC_CANONICAL_HOST
  50. dnl Make sure anyone changing configure.ac/Makefile.am has a clue
  51. AM_MAINTAINER_MODE([enable])
  52. dnl Checks for programs
  53. AC_PROG_CC_C99
  54. gl_EARLY
  55. AC_PROG_GCC_TRADITIONAL
  56. AM_PROG_CC_C_O
  57. AC_PROG_RANLIB
  58. gl_INIT
  59. dnl Checks for header files.
  60. AC_HEADER_STDC
  61. AC_CHECK_HEADERS(syslog.h)
  62. AC_CHECK_HEADERS([sys/epoll.h])
  63. AC_CHECK_HEADERS([sys/prctl.h])
  64. AC_FUNC_ALLOCA
  65. have_cygwin=false
  66. have_win32=false
  67. have_macho=false
  68. DLOPEN_FLAGS="-ldl"
  69. WS2_LIBS=""
  70. MM_LIBS=""
  71. MATH_LIBS="-lm"
  72. case $target in
  73. amd64-* | x86_64-*)
  74. have_x86_32=false
  75. have_x86_64=true
  76. bitness="64"
  77. ;;
  78. i386-* | i486-* | i586-* | i686-* | x86-*)
  79. have_x86_32=true
  80. have_x86_64=false
  81. bitness="32"
  82. ;;
  83. *)
  84. have_x86_32=false
  85. have_x86_64=false
  86. ;;
  87. esac
  88. case $target in
  89. *-*-mingw*)
  90. have_win32=true
  91. DLOPEN_FLAGS=""
  92. WS2_LIBS="-lws2_32"
  93. MM_LIBS="-lwinmm"
  94. AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support")
  95. AC_DEFINE([FD_SETSIZE], [4096], [Maximum sockets before fd_set overflows])
  96. ;;
  97. *-*-cygwin*)
  98. have_cygwin=true
  99. ;;
  100. powerpc-*-darwin*)
  101. CFLAGS="$CFLAGS -faltivec"
  102. have_macho=true
  103. ;;
  104. *-*-darwin*)
  105. have_macho=true
  106. ;;
  107. esac
  108. m4_define([BFG_INCLUDE],
  109. if test "x$2" = "x"; then
  110. $1=''
  111. else
  112. $1="[#]include <$2>"
  113. fi
  114. )
  115. m4_define([BFG_PREPROC_IFELSE],
  116. BFG_INCLUDE([headerinclude], $2)
  117. AC_COMPILE_IFELSE([
  118. AC_LANG_PROGRAM([
  119. ${headerinclude}
  120. ], [
  121. #if !( $1 )
  122. #error "$1 false in preprocessor"
  123. #endif
  124. ])
  125. ],[$3],[$4])
  126. )
  127. AC_CHECK_DECL([HASH_ITER],[
  128. AC_CHECK_DECL([DL_FOREACH_SAFE],[
  129. true
  130. ],[
  131. AC_MSG_ERROR([Could not find DL_FOREACH_SAFE - install uthash-dev 1.9.2+])
  132. ],[
  133. #include <utlist.h>
  134. ])
  135. ],[
  136. AC_MSG_ERROR([Could not find HASH_ITER - please install uthash-dev 1.9.2+])
  137. ],[
  138. #include <uthash.h>
  139. ])
  140. cpumining="no"
  141. AC_ARG_ENABLE([cpumining],
  142. [AC_HELP_STRING([--enable-cpumining],[Build with CPU mining support (default disabled)])],
  143. [cpumining=$enableval]
  144. )
  145. if test "x$cpumining" = xyes; then
  146. AC_DEFINE_UNQUOTED([WANT_CPUMINE], [1], [Enable CPUMINING])
  147. fi
  148. AM_CONDITIONAL([HAS_CPUMINE], [test x$cpumining = xyes])
  149. opencl="yes"
  150. AC_ARG_ENABLE([opencl],
  151. [AC_HELP_STRING([--disable-opencl],[Build without support for OpenCL (default enabled)])],
  152. [opencl=$enableval]
  153. )
  154. if test "x$opencl" = xyes; then
  155. AC_DEFINE([HAVE_OPENCL], [1], [Defined to 1 if OpenCL support is wanted])
  156. else
  157. DLOPEN_FLAGS=""
  158. fi
  159. AM_CONDITIONAL([HAVE_OPENCL], [test x$opencl = xyes])
  160. m4_define([BFG_PTHREAD_FLAG_CHECK],
  161. AC_MSG_CHECKING([for $1])
  162. for cflag in ' -pthread' ''; do
  163. for lib in ' -lpthread' ' -lwinpthread' ''; do
  164. CFLAGS="${save_CFLAGS}${cflag}"
  165. LIBS="${save_LIBS}${lib}"
  166. AC_LINK_IFELSE([
  167. AC_LANG_PROGRAM([
  168. #include <pthread.h>
  169. ], [
  170. void *f = $1;
  171. ])
  172. ], [
  173. found_pthread=true
  174. PTHREAD_FLAGS="${cflag}"
  175. PTHREAD_LIBS="${lib}"
  176. if test "x${cflag}${lib}" = "x"; then
  177. AC_MSG_RESULT([yes])
  178. else
  179. AC_MSG_RESULT([with${cflag}${lib}])
  180. fi
  181. $2
  182. break 2
  183. ])
  184. done
  185. done
  186. if test "x${found_pthread}" = "xfalse"; then
  187. AC_MSG_RESULT([no])
  188. fi
  189. )
  190. save_CFLAGS="${CFLAGS}"
  191. save_LIBS="${LIBS}"
  192. found_pthread=false
  193. BFG_PTHREAD_FLAG_CHECK([pthread_cancel],[
  194. AC_DEFINE([HAVE_PTHREAD_CANCEL], [1], [Define if you have a native pthread_cancel])
  195. ])
  196. if test "x${found_pthread}" = "xfalse"; then
  197. BFG_PTHREAD_FLAG_CHECK([pthread_create])
  198. if test "x${found_pthread}" = "xfalse"; then
  199. AC_MSG_ERROR([Could not find pthread library - please install libpthread])
  200. fi
  201. fi
  202. # check for nanosleep here, since it is provided by winpthread
  203. AC_CHECK_FUNCS([nanosleep])
  204. CFLAGS="${save_CFLAGS}"
  205. LIBS="${save_LIBS}"
  206. PKG_CHECK_MODULES([JANSSON],[jansson],[
  207. true
  208. ],[
  209. AC_MSG_CHECKING([for jansson in system-default locations])
  210. LIBS="$LIBS -ljansson"
  211. AC_TRY_LINK([
  212. #include <jansson.h>
  213. ],[
  214. json_object();
  215. ],[
  216. AC_MSG_RESULT([found])
  217. JANSSON_LIBS=-ljansson
  218. ],[
  219. AC_MSG_RESULT([not found])
  220. AC_MSG_ERROR([Could not find jansson library])
  221. ])
  222. LIBS="${save_LIBS}"
  223. ])
  224. AC_SUBST(JANSSON_CFLAGS)
  225. AC_SUBST(JANSSON_LIBS)
  226. if test "x$opencl" = xyes; then
  227. adl="yes"
  228. AC_ARG_WITH([sensors],[Build with libsensors monitoring],[true],[with_sensors=auto])
  229. if test "x$opencl" != xyes; then
  230. with_sensors=no
  231. fi
  232. if test "x$with_sensors" != xno; then
  233. AC_MSG_CHECKING([for libsensors])
  234. save_LIBS="${LIBS}"
  235. LIBS="$LIBS -lsensors"
  236. AC_LINK_IFELSE([AC_LANG_PROGRAM([
  237. #include <stddef.h>
  238. #include <sensors/sensors.h>
  239. ],[
  240. const sensors_chip_name *cn;
  241. cn = sensors_get_detected_chips(NULL, NULL);
  242. ])],[
  243. with_sensors=yes
  244. sensors_LIBS="-lsensors"
  245. AC_DEFINE([HAVE_SENSORS], [1], [Defined if libsensors was found])
  246. AC_MSG_RESULT([yes])
  247. ],[
  248. with_sensors=no
  249. AC_MSG_RESULT([no])
  250. ])
  251. LIBS="$save_LIBS"
  252. fi
  253. AC_SUBST(sensors_LIBS)
  254. AC_ARG_ENABLE([adl],
  255. [AC_HELP_STRING([--disable-adl],[Build without ADL monitoring (default enabled)])],
  256. [adl=$enableval]
  257. )
  258. if test x$adl = xyes
  259. then
  260. AC_DEFINE([HAVE_ADL], [1], [Defined if ADL headers were found])
  261. fi
  262. else
  263. adl="no"
  264. fi
  265. AC_ARG_ENABLE([bitforce],
  266. [AC_HELP_STRING([--disable-bitforce],[Compile support for BitForce (default enabled)])],
  267. [bitforce=$enableval],
  268. [bitforce=yes]
  269. )
  270. if test "x$bitforce" = xyes; then
  271. AC_DEFINE([USE_BITFORCE], [1], [Defined to 1 if BitForce support is wanted])
  272. fi
  273. AM_CONDITIONAL([HAS_BITFORCE], [test x$bitforce = xyes])
  274. AC_ARG_ENABLE([icarus],
  275. [AC_HELP_STRING([--disable-icarus],[Compile support for Icarus (default enabled)])],
  276. [icarus=$enableval],
  277. [icarus=yes]
  278. )
  279. if test "x$icarus" = xyes; then
  280. AC_DEFINE([USE_ICARUS], [1], [Defined to 1 if Icarus support is wanted])
  281. fi
  282. AM_CONDITIONAL([HAS_ICARUS], [test x$icarus = xyes])
  283. avalon="no"
  284. AC_ARG_ENABLE([avalon],
  285. [AC_HELP_STRING([--disable-avalon],[Compile support for Avalon (default enabled)])],
  286. [avalon=$enableval],
  287. [avalon=yes]
  288. )
  289. if test "x$avalon" = xyes; then
  290. AC_DEFINE([USE_AVALON], [1], [Defined to 1 if Avalon support is wanted])
  291. fi
  292. AM_CONDITIONAL([HAS_AVALON], [test x$avalon = xyes])
  293. AC_ARG_ENABLE([modminer],
  294. [AC_HELP_STRING([--disable-modminer],[Compile support for ModMiner (default enabled)])],
  295. [modminer=$enableval],
  296. [modminer=yes]
  297. )
  298. if test "x$modminer" = xyes; then
  299. AC_DEFINE([USE_MODMINER], [1], [Defined to 1 if ModMiner support is wanted])
  300. fi
  301. AM_CONDITIONAL([HAS_MODMINER], [test x$modminer = xyes])
  302. PKG_PROG_PKG_CONFIG()
  303. libusb=no
  304. libusb_include_path=""
  305. PKG_CHECK_MODULES([LIBUSB], [libusb-1.0],[
  306. libusb=yes
  307. ],[
  308. for usb_lib in usb-1.0 usb; do
  309. AC_CHECK_LIB($usb_lib, libusb_init, [
  310. libusb=yes
  311. break
  312. ])
  313. done
  314. if test "x$libusb" = xyes; then
  315. AC_CHECK_DECL([libusb_init],[
  316. true
  317. ],[
  318. AC_PROG_CPP
  319. AC_MSG_CHECKING([whether libusb_init is declared in subdirectory])
  320. libusb_include_path=`echo '#include <libusb-1.0/libusb.h>' | ${CPP} -M - 2>/dev/null | sed 's/^[^[:space:]]\+[[:space:]]\+\([^[:space:]]\+\)\/.*$/\1/;t;d'`
  321. if test "x$libusb_include_path" != "x"; then
  322. LIBUSB_LIBS="-l$usb_lib"
  323. LIBUSB_CFLAGS="-I$libusb_include_path"
  324. AC_MSG_RESULT([yes])
  325. else
  326. libusb=no
  327. AC_MSG_RESULT([no])
  328. fi
  329. ],[#include <libusb.h>])
  330. fi
  331. ])
  332. AC_ARG_ENABLE([x6500],
  333. [AC_HELP_STRING([--disable-x6500],[Compile support for X6500 (default if libusb)])],
  334. [x6500=$enableval],
  335. [x6500=auto]
  336. )
  337. if test "x$x6500$libusb" = xyesno; then
  338. AC_MSG_ERROR([Could not find libusb, required for X6500 support])
  339. elif test "x$x6500" = xauto; then
  340. x6500="$libusb"
  341. if test "x$libusb" = xno; then
  342. AC_MSG_WARN([Could not find libusb, required for X6500 support])
  343. x6500warn=yes
  344. fi
  345. fi
  346. if test "x$x6500" = xyes; then
  347. AC_DEFINE([USE_X6500], [1], [Defined to 1 if X6500 support is wanted])
  348. fi
  349. AM_CONDITIONAL([HAS_X6500], [test x$x6500 = xyes])
  350. AC_ARG_ENABLE([ztex],
  351. [AC_HELP_STRING([--disable-ztex],[Compile support for ZTEX (default if libusb)])],
  352. [ztex=$enableval],
  353. [ztex=auto]
  354. )
  355. if test "x$ztex$libusb" = xyesno; then
  356. AC_MSG_ERROR([Could not find libusb, required for ZTEX support])
  357. elif test "x$ztex" = xauto; then
  358. ztex="$libusb"
  359. if test "x$libusb" = xno; then
  360. AC_MSG_WARN([Could not find libusb, required for ZTEX support])
  361. ztexwarn=yes
  362. fi
  363. fi
  364. if test "x$ztex" = xyes; then
  365. AC_DEFINE([USE_ZTEX], [1], [Defined to 1 if ZTEX support is wanted])
  366. fi
  367. AM_CONDITIONAL([HAS_ZTEX], [test x$ztex = xyes])
  368. if test "x$x6500$ztex" = "xnono"; then
  369. libusb=no
  370. LIBUSB_LIBS=''
  371. LIBUSB_CFLAGS=''
  372. fi
  373. if test "x$libusb" = xyes; then
  374. AC_DEFINE([HAVE_LIBUSB], [1], [Define if you have libusb-1.0])
  375. save_CFLAGS="$CFLAGS"
  376. CFLAGS="$LIBUSB_CFLAGS $CFLAGS"
  377. AC_CHECK_DECLS([libusb_error_name],[true],[true],[#include <libusb.h>])
  378. CFLAGS="$save_CFLAGS"
  379. fi
  380. scrypt="no"
  381. AC_ARG_ENABLE([scrypt],
  382. [AC_HELP_STRING([--enable-scrypt],[Compile support for scrypt mining (default disabled)])],
  383. [scrypt=$enableval]
  384. )
  385. if test "x$scrypt" = xyes; then
  386. AC_DEFINE([USE_SCRYPT], [1], [Defined to 1 if scrypt support is wanted])
  387. fi
  388. need_fpgautils=no
  389. if test x$avalon$icarus$bitforce$modminer$x6500$ztex != xnononononono; then
  390. need_fpgautils=yes
  391. AC_DEFINE([HAVE_FPGAUTILS], [1], [Defined to 1 if fpgautils is being used])
  392. if $have_win32; then
  393. echo '#include <iospeeds.h>' >iospeeds_local.h
  394. else
  395. AC_PROG_CPP
  396. AC_MSG_CHECKING([what baud rates your system supports])
  397. echo '#include <termios.h>' | ${CPP} -dM - 2>/dev/null | sed 's/.*[ ]B\([0-9][0-9]*\)[ ].*/IOSPEED(\1)/' | grep IOSPEED >iospeeds_local.h
  398. if grep -q IOSPEED iospeeds_local.h; then
  399. AC_MSG_RESULT([done])
  400. else
  401. AC_MSG_RESULT([failed, using standard POSIX])
  402. echo '#include <iospeeds_posix.h>' >iospeeds_local.h
  403. fi
  404. fi
  405. fi
  406. curses="auto"
  407. AC_ARG_WITH([curses],
  408. [AC_HELP_STRING([--without-curses],[Compile support for curses TUI (default enabled)])],
  409. [curses=$withval]
  410. )
  411. if test "x$curses" = "xno"; then
  412. cursesmsg='User specified --without-curses. TUI support DISABLED'
  413. else
  414. orig_libs="$LIBS"
  415. if test "x${curses}" = "xyes"; then
  416. preferl=''
  417. else
  418. preferl="${curses} ${curses}6 ${curses}5"
  419. fi
  420. for wideornot in w u ''; do
  421. for ncursesver in '' 6 5; do
  422. preferl="${preferl} ncurses${wideornot}${ncursesver}"
  423. done
  424. preferl="${preferl} pdcurses${wideornot}"
  425. done
  426. if test "x$cross_compiling" != "xyes"; then
  427. AC_MSG_CHECKING([for best native curses library])
  428. orig_cflags="$CFLAGS"
  429. for curses_lib in ${preferl}; do
  430. if ! ${curses_lib}-config --cflags >/dev/null 2>/dev/null; then
  431. continue
  432. fi
  433. CFLAGS="$orig_cflags $(${curses_lib}-config --cflags)"
  434. LIBS="$orig_libs $(${curses_lib}-config --libs)"
  435. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  436. #include <curses.h>
  437. ]], [[
  438. WINDOW *w = NULL;
  439. mvwprintw(w, 2, 2, "Testing %s", "o hai");
  440. ]])], [
  441. curses=yes
  442. cursesmsg="FOUND: ${curses_lib}"
  443. AC_MSG_RESULT([$curses_lib])
  444. NCURSES_LIBS=`${curses_lib}-config --libs`
  445. NCURSES_CPPFLAGS=`${curses_lib}-config --cflags`
  446. break
  447. ], [
  448. AC_MSG_WARN([${curses_lib} doesn't seem to be installed properly])
  449. ])
  450. done
  451. CFLAGS="$orig_cflags"
  452. if test "x$curses" != "xyes"; then
  453. AC_MSG_RESULT([none?])
  454. fi
  455. fi
  456. if test "x$curses" != "xyes"; then
  457. for sym in addwstr addstr; do
  458. AC_SEARCH_LIBS(${sym}, ${preferl}, [
  459. curses=yes
  460. eval "curseslib=\"\${ac_cv_search_${sym}}\""
  461. cursesmsg="FOUND: ${curseslib}"
  462. cursesmsg="${cursesmsg/-l/}"
  463. if test "x${curseslib}" != "xnone required"; then
  464. NCURSES_LIBS="${curseslib}"
  465. fi
  466. break
  467. ], [
  468. test "x$sym" != "addstr" && continue
  469. if test "x$curses" = "xyes"; then
  470. AC_MSG_ERROR([Could not find curses library - please install libncurses-dev or pdcurses-dev (or configure --without-curses)])
  471. else
  472. AC_MSG_WARN([Could not find curses library - if you want a TUI, install libncurses-dev or pdcurses-dev])
  473. curses=no
  474. cursesmsg='NOT FOUND. TUI support DISABLED'
  475. fi
  476. ])
  477. done
  478. fi
  479. if test "x$curses" = "xyes"; then
  480. AC_DEFINE([HAVE_CURSES], [1], [Defined to 1 if curses TUI support is wanted])
  481. AC_MSG_CHECKING([whether curses library supports wide characters])
  482. LIBS="$orig_libs $NCURSES_CPPFLAGS $NCURSES_LIBS"
  483. AC_LINK_IFELSE([
  484. AC_LANG_PROGRAM([
  485. #define PDC_WIDE
  486. #include <curses.h>
  487. ],[
  488. addwstr(L"test");
  489. ])
  490. ],[
  491. AC_MSG_RESULT([yes])
  492. AC_DEFINE([USE_UNICODE],[1],[Defined to 1 if curses supports wide characters])
  493. ],[
  494. AC_MSG_RESULT([no])
  495. ])
  496. fi
  497. LIBS="$orig_libs"
  498. fi
  499. AC_ARG_WITH([system-libblkmaker], [AC_HELP_STRING([--with-system-libblkmaker], [Use system libblkmaker rather than bundled one (default disabled)])],[true],[with_system_libblkmaker=no])
  500. if test "x$with_system_libblkmaker" = "xyes"; then
  501. PKG_CHECK_MODULES([libblkmaker],[libblkmaker_jansson-0.1],[
  502. true
  503. ],[
  504. AC_MSG_ERROR([Could not find system libblkmaker])
  505. ])
  506. else
  507. save_LDFLAGS="$LDFLAGS"
  508. LDFLAGS="$LDFLAGS -Wl,-zorigin"
  509. origin_LDFLAGS=
  510. AC_MSG_CHECKING([whether the linker recognizes the -zorigin option])
  511. AC_TRY_LINK([],[],[
  512. AC_MSG_RESULT([yes])
  513. origin_LDFLAGS=',-zorigin'
  514. ],[
  515. AC_MSG_RESULT([no])
  516. ])
  517. LDFLAGS="$save_LDFLAGS"
  518. libblkmaker_CFLAGS='-Ilibblkmaker'
  519. libblkmaker_LDFLAGS='-Llibblkmaker/.libs -Wl,-rpath,\$$ORIGIN/libblkmaker/.libs'"$origin_LDFLAGS"
  520. libblkmaker_LIBS='-lblkmaker_jansson-0.1 -lblkmaker-0.1'
  521. AC_CONFIG_SUBDIRS([libblkmaker])
  522. fi
  523. AC_SUBST(libblkmaker_CFLAGS)
  524. AC_SUBST(libblkmaker_LDFLAGS)
  525. AC_SUBST(libblkmaker_LIBS)
  526. AM_CONDITIONAL([NEED_LIBBLKMAKER], [test x$with_system_libblkmaker != xyes])
  527. AM_CONDITIONAL([NEED_DYNCLOCK], [test x$icarus$modminer$x6500$ztex != xnonono])
  528. AM_CONDITIONAL([NEED_FPGAUTILS], [test x$need_fpgautils = xyes])
  529. AM_CONDITIONAL([HAS_SCRYPT], [test x$scrypt = xyes])
  530. AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
  531. AM_CONDITIONAL([HAVE_SENSORS], [test x$with_sensors = xyes])
  532. AM_CONDITIONAL([HAVE_CYGWIN], [test x$have_cygwin = xtrue])
  533. AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
  534. AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
  535. AM_CONDITIONAL([HAS_FPGA], [test x$bitforce$icarus$modminer$x6500$ztex != xnonononono])
  536. dnl Find YASM
  537. has_yasm=false
  538. if test "x$have_x86_32$have_x86_64" != "xfalsefalse"; then
  539. AC_PATH_PROG([YASM],[yasm],[false])
  540. if test "x$YASM" != "xfalse" ; then
  541. AC_MSG_CHECKING([if yasm version is greater than 1.0.1])
  542. yasmver=`"$YASM" --version | head -1 | cut -d\ -f2`
  543. yamajor=`echo $yasmver | cut -d. -f1`
  544. yaminor=`echo $yasmver | cut -d. -f2`
  545. yamini=`echo $yasmver | cut -d. -f3`
  546. if test "$yamajor" -ge "1" ; then
  547. if test "$yamajor" -eq "1" ; then
  548. if test "$yaminor" -ge "0" ; then
  549. if test "$yaminor" -eq "0"; then
  550. if test "$yamini" -ge "1"; then
  551. has_yasm=true
  552. fi
  553. else
  554. has_yasm=true
  555. fi
  556. fi
  557. fi
  558. else
  559. has_yasm=false
  560. fi
  561. if test "x$has_yasm" = "xtrue" ; then
  562. AC_MSG_RESULT([yes])
  563. else
  564. AC_MSG_RESULT([no])
  565. fi
  566. fi
  567. if test "x$has_yasm" = "xfalse" ; then
  568. AC_MSG_NOTICE([yasm is required for the assembly algorithms. They will be skipped.])
  569. else
  570. AC_DEFINE([HAVE_YASM], [1], [Defined to 1 if yasm is being used])
  571. if test "x$have_win32$have_cygwin" != "xfalsefalse"; then
  572. if test "x$have_x86_64" = xtrue; then
  573. YASM_FMT="win64"
  574. else
  575. YASM_FMT="coff"
  576. fi
  577. elif test "x$have_macho" = "xtrue"; then
  578. YASM_FMT="macho$bitness"
  579. else
  580. YASM_FMT="elf$bitness"
  581. fi
  582. fi
  583. fi
  584. AM_CONDITIONAL([HAS_YASM], [test x$has_yasm = xtrue])
  585. have_sse2=no
  586. if test "x$cpumining$have_x86_32" = "xyestrue"; then
  587. AC_MSG_CHECKING([if SSE2 code compiles])
  588. save_CFLAGS="$CFLAGS"
  589. for flags in '' '-msse2'; do
  590. CFLAGS="$CFLAGS $flags"
  591. AC_TRY_LINK([
  592. #include <xmmintrin.h>
  593. ],[
  594. int *i = (int *)0xdeadbeef;
  595. __m128i a, b;
  596. a = _mm_set1_epi32(i[0]);
  597. b = _mm_set_epi32(i[0], i[1], i[2], i[3]);
  598. a = _mm_add_epi32(a, b);
  599. a = _mm_andnot_si128(a, b);
  600. a = _mm_or_si128(a, b);
  601. a = _mm_slli_epi32(a, i[4]);
  602. a = _mm_and_si128(a, b);
  603. a = _mm_xor_si128(a, b);
  604. ],[
  605. if test "x$flags" = "x"; then
  606. AC_MSG_RESULT([yes])
  607. else
  608. AC_MSG_RESULT([with $flags])
  609. fi
  610. SSE2_CFLAGS="$flags"
  611. have_sse2=yes
  612. break
  613. ],[
  614. true
  615. ])
  616. done
  617. CFLAGS="${save_CFLAGS}"
  618. if test "x$have_sse2" = "xyes"; then
  619. AC_DEFINE([HAVE_SSE2], [1], [Defined to 1 if yasm is being used])
  620. else
  621. AC_MSG_RESULT([no])
  622. fi
  623. fi
  624. AM_CONDITIONAL([HAVE_SSE2], [test "x$have_sse2" = "xyes"])
  625. if test "x$bitforce$modminer$icarus" != "xnonono"; then
  626. AC_ARG_WITH([libudev], [AC_HELP_STRING([--without-libudev], [Autodetect FPGAs using libudev (default enabled)])],
  627. [libudev=$withval],
  628. [libudev=auto]
  629. )
  630. if test "x$libudev" != "xno"; then
  631. AC_CHECK_HEADER([libudev.h],[
  632. libudev=yes
  633. UDEV_LIBS=-ludev
  634. AC_DEFINE([HAVE_LIBUDEV], [1], [Defined to 1 if libudev is wanted])
  635. ], [
  636. if test "x$libudev" = "xyes"; then
  637. AC_MSG_ERROR([libudev not found])
  638. fi
  639. libudev=no
  640. ])
  641. fi
  642. fi
  643. AM_CONDITIONAL([HAVE_LIBUDEV], [test x$libudev != xno])
  644. AC_SUBST(LIBUSB_LIBS)
  645. AC_SUBST(LIBUSB_CFLAGS)
  646. PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.18.2], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.18.2])])
  647. if echo "$LIBCURL_CFLAGS" | grep '@CPPFLAG_CURL_STATICLIB@' >/dev/null 2>&1; then
  648. AC_MSG_WARN([Your libcurl pkgconfig file is broken, applying workaround])
  649. LIBCURL_CFLAGS=`echo "$LIBCURL_CFLAGS" | sed 's/@CPPFLAG_CURL_STATICLIB@//'`
  650. fi
  651. AC_SUBST(LIBCURL_LIBS)
  652. AC_CHECK_FUNCS([setrlimit])
  653. dnl CCAN wants to know a lot of vars.
  654. # All the configuration checks. Regrettably, the __attribute__ checks will
  655. # give false positives on old GCCs, since they just cause warnings. But that's
  656. # fairly harmless.
  657. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((cold)) cleanup(void) { }])],
  658. AC_DEFINE([HAVE_ATTRIBUTE_COLD], [1],
  659. [Define if __attribute__((cold))]))
  660. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((const)) cleanup(void) { }])],
  661. AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1],
  662. [Define if __attribute__((const))]))
  663. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((noreturn)) cleanup(void) { exit(1); }])],
  664. [
  665. AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
  666. [Define if __attribute__((noreturn))])
  667. AC_DEFINE_UNQUOTED([NORETURN], [__attribute__((noreturn))], [Syntax of noreturn attribute])
  668. ], [
  669. AC_DEFINE_UNQUOTED([NORETURN], [])
  670. ]
  671. )
  672. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((format(__printf__, 1, 2))) cleanup(const char *fmt, ...) { }])],
  673. AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1],
  674. [Define if __attribute__((format(__printf__)))]))
  675. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((unused)) cleanup(void) { }])],
  676. AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1],
  677. [Define if __attribute__((unused))]))
  678. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((used)) cleanup(void) { }])],
  679. AC_DEFINE([HAVE_ATTRIBUTE_USED], [1],
  680. [Define if __attribute__((used))]))
  681. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_constant_p(1) ? 0 : 1; }])],
  682. AC_DEFINE([HAVE_BUILTIN_CONSTANT_P], [1],
  683. [Define if have __builtin_constant_p]))
  684. AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_types_compatible_p(char *, int) ? 1 : 0; }])],
  685. AC_DEFINE([HAVE_BUILTIN_TYPES_COMPATIBLE_P], [1],
  686. [Define if have __builtin_types_compatible_p]))
  687. AC_COMPILE_IFELSE([AC_LANG_SOURCE([static int __attribute__((warn_unused_result)) func(int x) { return x; }])],
  688. AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1],
  689. [Define if __attribute__((warn_unused_result))]))
  690. AC_MSG_CHECKING([for roundl function])
  691. save_LIBS="${LIBS}"
  692. LIBS="$LIBS -lm"
  693. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  694. #include <math.h>
  695. ]], [[
  696. return (roundl(*(long double *)0xdeadbeef) == 1.0);
  697. ]])], [
  698. AC_MSG_RESULT([yes])
  699. ], [
  700. AC_MSG_RESULT([no])
  701. AC_DEFINE([NEED_ROUNDL], [1], [Defined to 1 if C99 roundl is missing])
  702. ])
  703. LIBS="${save_LIBS}"
  704. # byteswap functions
  705. AH_TEMPLATE([HAVE_BYTESWAP_H], [Define to use byteswap macros from byteswap.h])
  706. AH_TEMPLATE([HAVE_ENDIAN_H], [Define to use byteswap macros from endian.h])
  707. AH_TEMPLATE([HAVE_SYS_ENDIAN_H], [Define to use byteswap macros from sys/endian.h])
  708. AH_TEMPLATE([HAVE_LIBKERN_OSBYTEORDER_H], [Define to use byteswap macros from libkern/OSByteOrder.h])
  709. BSWAP=''
  710. for sym in bswap_ __builtin_bswap __bswap_ __swap swap OSSwapInt; do
  711. AC_MSG_CHECKING([for ${sym}* functions])
  712. for headerfile in '' byteswap.h endian.h sys/endian.h libkern/OSByteOrder.h; do
  713. BFG_INCLUDE([headerinclude], [${headerfile}])
  714. AC_LINK_IFELSE([
  715. AC_LANG_PROGRAM([
  716. ${headerinclude}
  717. ], [
  718. (void) ${sym}16(0);
  719. (void) ${sym}32(0);
  720. (void) ${sym}64(0);
  721. ])
  722. ], [
  723. BSWAP="${sym}"
  724. if test "x${headerfile}" = "x"; then
  725. AC_MSG_RESULT([yes])
  726. else
  727. AC_MSG_RESULT([found in ${headerfile}])
  728. AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$headerfile]), 1)
  729. fi
  730. break 2
  731. ])
  732. done
  733. AC_MSG_RESULT([no])
  734. done
  735. if test "x$BSWAP" = "x"; then
  736. true # Substitutes are provided in miner.h
  737. elif test "x$BSWAP" = "xbswap_"; then
  738. AC_MSG_CHECKING([if bswap_16 is already a macro])
  739. BFG_PREPROC_IFELSE([defined(bswap_16)], $headerfile, [
  740. AC_MSG_RESULT([yes])
  741. BSWAP=""
  742. ],[
  743. AC_MSG_RESULT([no])
  744. ])
  745. fi
  746. if test "x$BSWAP" != "x"; then
  747. AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, [Define to 16-bit byteswap macro])
  748. AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, [Define to 16-bit byteswap macro])
  749. AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, [Define to 16-bit byteswap macro])
  750. fi
  751. # endian definition macros
  752. AC_MSG_CHECKING([for platform endian])
  753. found_endian=no
  754. for headerfile in '' endian.h sys/endian.h sys/param.h; do
  755. for pfx in '' '__'; do
  756. 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}, [
  757. if test "x$headerfile" = "x"; then
  758. headerfilec=''
  759. else
  760. headerfilec=" (${headerfile})"
  761. fi
  762. BFG_PREPROC_IFELSE([${pfx}BYTE_ORDER == ${pfx}BIG_ENDIAN], ${headerfile}, [
  763. AC_MSG_RESULT([big endian${headerfilec}])
  764. AC_DEFINE(WORDS_BIGENDIAN, 1, [Define if your platform is big endian])
  765. ], [
  766. AC_MSG_RESULT([little endian${headerfilec}])
  767. ])
  768. found_endian=yes
  769. break 2
  770. ],[true])
  771. done
  772. done
  773. if test "x$found_endian" = "xno"; then
  774. if $have_win32 || $have_cygwin; then
  775. AC_MSG_RESULT([assuming little endian (Windows)])
  776. else
  777. # AC_C_BIGENDIAN is reported to have problems, and invasive even if buried in a conditional, so don't use it
  778. AC_MSG_RESULT([unknown])
  779. AC_MSG_ERROR([Unable to identify platform endian])
  780. fi
  781. fi
  782. AC_MSG_CHECKING([if GNU format attribute compiles])
  783. AC_TRY_COMPILE([
  784. #define FORMAT_SYNTAX_CHECK(...) __attribute__(( format(__VA_ARGS__) ))
  785. int myfunc(char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
  786. int myfunc(char *fmt, ...) {
  787. return 42;
  788. }
  789. ], [
  790. myfunc("abc%d", 42);
  791. ], [
  792. AC_MSG_RESULT([yes])
  793. AC_DEFINE_UNQUOTED([FORMAT_SYNTAX_CHECK(...)], [__attribute__(( format(__VA_ARGS__) ))], [Syntax of format-checking attribute])
  794. ], [
  795. AC_MSG_RESULT([no])
  796. AC_DEFINE_UNQUOTED([FORMAT_SYNTAX_CHECK(...)], [])
  797. ])
  798. AC_MSG_CHECKING([for clock_gettime(CLOCK_MONOTONIC)])
  799. AC_TRY_COMPILE([
  800. #define _GNU_SOURCE
  801. #include <time.h>
  802. ],[
  803. struct timespec ts;
  804. clock_gettime(CLOCK_MONOTONIC, &ts);
  805. ],[
  806. AC_MSG_RESULT([yes])
  807. AC_DEFINE([HAVE_CLOCK_GETTIME_MONOTONIC], [1], [Defined to 1 if clock_gettime(CLOCK_MONOTONIC) is defined])
  808. AC_SEARCH_LIBS([clock_gettime],[rt posix4])
  809. AC_MSG_CHECKING([for clock_gettime(CLOCK_MONOTONIC_RAW)])
  810. AC_TRY_COMPILE([
  811. #define _GNU_SOURCE
  812. #include <time.h>
  813. ],[
  814. struct timespec ts;
  815. clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
  816. ],[
  817. AC_MSG_RESULT([yes])
  818. AC_DEFINE([HAVE_CLOCK_GETTIME_MONOTONIC_RAW], [1], [Defined to 1 if clock_gettime(CLOCK_MONOTONIC_RAW) is defined])
  819. ],[
  820. AC_MSG_RESULT([no])
  821. ])
  822. ],[
  823. AC_MSG_RESULT([no])
  824. ])
  825. if test "x$prefix" = xNONE; then
  826. prefix=/usr/local
  827. fi
  828. AM_CONDITIONAL([NEED_BITSTREAM_FPGAMINER], [test x$modminer$x6500 != xnono])
  829. AC_DEFINE_UNQUOTED([PHATK_KERNNAME], ["phatk121016"], [Filename for phatk kernel])
  830. AC_DEFINE_UNQUOTED([POCLBM_KERNNAME], ["poclbm130302"], [Filename for poclbm kernel])
  831. AC_DEFINE_UNQUOTED([DIAKGCN_KERNNAME], ["diakgcn121016"], [Filename for diakgcn kernel])
  832. AC_DEFINE_UNQUOTED([DIABLO_KERNNAME], ["diablo130302"], [Filename for diablo kernel])
  833. AC_DEFINE_UNQUOTED([SCRYPT_KERNNAME], ["scrypt130511"], [Filename for scrypt kernel])
  834. AC_SUBST(PTHREAD_FLAGS)
  835. AC_SUBST(DLOPEN_FLAGS)
  836. AC_SUBST(PTHREAD_LIBS)
  837. AC_SUBST(NCURSES_CPPFLAGS)
  838. AC_SUBST(NCURSES_LIBS)
  839. AC_SUBST(PDCURSES_LIBS)
  840. AC_SUBST(WS2_LIBS)
  841. AC_SUBST(MM_LIBS)
  842. AC_SUBST(MATH_LIBS)
  843. AC_SUBST(UDEV_LIBS)
  844. AC_SUBST(SSE2_CFLAGS)
  845. AC_SUBST(YASM_FMT)
  846. AC_CONFIG_FILES([
  847. Makefile
  848. x86_64/Makefile
  849. x86_32/Makefile
  850. ccan/Makefile
  851. lib/Makefile
  852. ])
  853. AC_OUTPUT
  854. echo
  855. echo
  856. echo
  857. echo "------------------------------------------------------------------------"
  858. echo "$PACKAGE $VERSION"
  859. echo "------------------------------------------------------------------------"
  860. echo
  861. echo
  862. echo "Configuration Options Summary:"
  863. echo
  864. echo " curses.TUI...........: $cursesmsg"
  865. if test "x$scrypt" != xno; then
  866. echo " scrypt...............: Enabled"
  867. else
  868. echo " scrypt...............: Disabled"
  869. fi
  870. echo
  871. if test "x$opencl" = xyes; then
  872. echo " OpenCL...............: Enabled"
  873. else
  874. echo " OpenCL...............: Disabled"
  875. fi
  876. if test "x$with_sensors" = xyes; then
  877. echo " sensors.monitoring.: Enabled"
  878. elif test "x$opencl" = xyes; then
  879. echo " sensors.monitoring.: Disabled"
  880. else
  881. echo " sensors.monitoring.: n/a"
  882. fi
  883. if test "x$adl" = xyes; then
  884. echo " ADL.monitoring.....: Enabled"
  885. elif test "x$opencl" = xyes; then
  886. echo " ADL.monitoring.....: Disabled"
  887. else
  888. echo " ADL.monitoring.....: n/a"
  889. fi
  890. if test "x$avalon" = xyes; then
  891. echo " Avalon.ASICs.........: Enabled"
  892. else
  893. echo " Avalon.ASICs.........: Disabled"
  894. fi
  895. if test "x$bitforce" = xyes; then
  896. echo " BitForce.devices.....: Enabled"
  897. else
  898. echo " BitForce.devices.....: Disabled"
  899. fi
  900. if test "x$icarus" = xyes; then
  901. echo " Icarus.FPGAs.........: Enabled"
  902. else
  903. echo " Icarus.FPGAs.........: Disabled"
  904. fi
  905. if test "x$modminer" = xyes; then
  906. echo " ModMiner.FPGAs.......: Enabled"
  907. else
  908. echo " ModMiner.FPGAs.......: Disabled"
  909. fi
  910. if test "x$x6500" = xyes; then
  911. echo " X6500.FPGAs..........: Enabled"
  912. elif test "x$ztexwarn" = xyes; then
  913. echo " X6500.FPGAs..........: Disabled (libusb not found)"
  914. else
  915. echo " X6500.FPGAs..........: Disabled"
  916. fi
  917. if test "x$ztex" = xyes; then
  918. echo " ZTEX.FPGAs...........: Enabled"
  919. elif test "x$ztexwarn" = xyes; then
  920. echo " ZTEX.FPGAs...........: Disabled (libusb not found)"
  921. else
  922. echo " ZTEX.FPGAs...........: Disabled"
  923. fi
  924. if test "x$bitforce$modminer" != xnono; then
  925. echo " libudev.detection....: $libudev"
  926. fi
  927. echo
  928. if test "x$cpumining" = xyes; then
  929. echo " CPU Mining...........: Enabled"
  930. echo " ASM.(for CPU mining).: $has_yasm"
  931. else
  932. echo " CPU Mining...........: Disabled"
  933. fi
  934. echo
  935. echo "Compilation............: make (or gmake)"
  936. echo " CPPFLAGS.............:" $CPPFLAGS $NCURSES_CPPFLAGS $PTHREAD_FLAGS
  937. echo " CFLAGS...............:" $CFLAGS $LIBUSB_CFLAGS $JANSSON_CFLAGS $PTHREAD_FLAGS
  938. echo " LDFLAGS..............:" $LDFLAGS $PTHREAD_FLAGS $PTHREAD_LIBS
  939. echo " LDADD................:" $LIBS $DLOPEN_FLAGS $LIBCURL_LIBS $JANSSON_LIBS $NCURSES_LIBS $PDCURSES_LIBS $WS2_LIBS $MATH_LIBS $UDEV_LIBS $LIBUSB_LIBS
  940. echo
  941. echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
  942. echo " prefix...............: $prefix"
  943. echo