You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.ac 37KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  1. dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
  2. AC_PREREQ([2.60])
  3. define(_CLIENT_VERSION_MAJOR, 0)
  4. define(_CLIENT_VERSION_MINOR, 12)
  5. define(_CLIENT_VERSION_REVISION, 99)
  6. define(_CLIENT_VERSION_BUILD, 0)
  7. define(_CLIENT_VERSION_IS_RELEASE, false)
  8. define(_COPYRIGHT_YEAR, 2016)
  9. define(_COPYRIGHT_HOLDERS,[The %s developers])
  10. define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[Bitcoin Core])
  11. AC_INIT([Bitcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/bitcoin/bitcoin/issues],[bitcoin],[https://bitcoincore.org/])
  12. AC_CONFIG_SRCDIR([src/main.cpp])
  13. AC_CONFIG_HEADERS([src/config/bitcoin-config.h])
  14. AC_CONFIG_AUX_DIR([build-aux])
  15. AC_CONFIG_MACRO_DIR([build-aux/m4])
  16. AC_CANONICAL_HOST
  17. AH_TOP([#ifndef BITCOIN_CONFIG_H])
  18. AH_TOP([#define BITCOIN_CONFIG_H])
  19. AH_BOTTOM([#endif //BITCOIN_CONFIG_H])
  20. dnl faketime breaks configure and is only needed for make. Disable it here.
  21. unset FAKETIME
  22. dnl Automake init set-up and checks
  23. AM_INIT_AUTOMAKE([no-define subdir-objects foreign])
  24. dnl faketime messes with timestamps and causes configure to be re-run.
  25. dnl --disable-maintainer-mode can be used to bypass this.
  26. AM_MAINTAINER_MODE([enable])
  27. dnl make the compilation flags quiet unless V=1 is used
  28. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  29. dnl Compiler checks (here before libtool).
  30. if test "x${CXXFLAGS+set}" = "xset"; then
  31. CXXFLAGS_overridden=yes
  32. else
  33. CXXFLAGS_overridden=no
  34. fi
  35. AC_PROG_CXX
  36. m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX])
  37. dnl By default, libtool for mingw refuses to link static libs into a dll for
  38. dnl fear of mixing pic/non-pic objects, and import/export complications. Since
  39. dnl we have those under control, re-enable that functionality.
  40. case $host in
  41. *mingw*)
  42. lt_cv_deplibs_check_method="pass_all"
  43. ;;
  44. esac
  45. dnl Libtool init checks.
  46. LT_INIT([pic-only])
  47. dnl Check/return PATH for base programs.
  48. AC_PATH_TOOL(AR, ar)
  49. AC_PATH_TOOL(RANLIB, ranlib)
  50. AC_PATH_TOOL(STRIP, strip)
  51. AC_PATH_TOOL(GCOV, gcov)
  52. AC_PATH_PROG(LCOV, lcov)
  53. AC_PATH_PROG(JAVA, java)
  54. AC_PATH_PROG(PYTHON, python)
  55. AC_PATH_PROG(GENHTML, genhtml)
  56. AC_PATH_PROG([GIT], [git])
  57. AC_PATH_PROG(CCACHE,ccache)
  58. AC_PATH_PROG(XGETTEXT,xgettext)
  59. AC_PATH_PROG(HEXDUMP,hexdump)
  60. AC_PATH_TOOL(READELF, readelf)
  61. AC_PATH_TOOL(CPPFILT, c++filt)
  62. AC_ARG_VAR(PYTHONPATH, Augments the default search path for python module files)
  63. dnl pkg-config check.
  64. PKG_PROG_PKG_CONFIG
  65. # Enable wallet
  66. AC_ARG_ENABLE([wallet],
  67. [AS_HELP_STRING([--disable-wallet],
  68. [disable wallet (enabled by default)])],
  69. [enable_wallet=$enableval],
  70. [enable_wallet=yes])
  71. AC_ARG_WITH([miniupnpc],
  72. [AS_HELP_STRING([--with-miniupnpc],
  73. [enable UPNP (default is yes if libminiupnpc is found)])],
  74. [use_upnp=$withval],
  75. [use_upnp=auto])
  76. AC_ARG_ENABLE([upnp-default],
  77. [AS_HELP_STRING([--enable-upnp-default],
  78. [if UPNP is enabled, turn it on at startup (default is no)])],
  79. [use_upnp_default=$enableval],
  80. [use_upnp_default=no])
  81. AC_ARG_ENABLE(tests,
  82. AS_HELP_STRING([--disable-tests],[do not compile tests (default is to compile)]),
  83. [use_tests=$enableval],
  84. [use_tests=yes])
  85. AC_ARG_ENABLE(bench,
  86. AS_HELP_STRING([--disable-bench],[do not compile benchmarks (default is to compile)]),
  87. [use_bench=$enableval],
  88. [use_bench=yes])
  89. AC_ARG_WITH([comparison-tool],
  90. AS_HELP_STRING([--with-comparison-tool],[path to java comparison tool (requires --enable-tests)]),
  91. [use_comparison_tool=$withval],
  92. [use_comparison_tool=no])
  93. AC_ARG_ENABLE([comparison-tool-reorg-tests],
  94. AS_HELP_STRING([--enable-comparison-tool-reorg-tests],[enable expensive reorg tests in the comparison tool (default no)]),
  95. [use_comparison_tool_reorg_tests=$enableval],
  96. [use_comparison_tool_reorg_tests=no])
  97. AC_ARG_ENABLE([extended-rpc-tests],
  98. AS_HELP_STRING([--enable-extended-rpc-tests],[enable expensive RPC tests when using lcov (default no)]),
  99. [use_extended_rpc_tests=$enableval],
  100. [use_extended_rpc_tests=no])
  101. AC_ARG_WITH([qrencode],
  102. [AS_HELP_STRING([--with-qrencode],
  103. [enable QR code support (default is yes if qt is enabled and libqrencode is found)])],
  104. [use_qr=$withval],
  105. [use_qr=auto])
  106. AC_ARG_ENABLE([hardening],
  107. [AS_HELP_STRING([--disable-hardening],
  108. [do not attempt to harden the resulting executables (default is to harden)])],
  109. [use_hardening=$enableval],
  110. [use_hardening=yes])
  111. AC_ARG_ENABLE([reduce-exports],
  112. [AS_HELP_STRING([--enable-reduce-exports],
  113. [attempt to reduce exported symbols in the resulting executables (default is no)])],
  114. [use_reduce_exports=$enableval],
  115. [use_reduce_exports=no])
  116. AC_ARG_ENABLE([ccache],
  117. [AS_HELP_STRING([--disable-ccache],
  118. [do not use ccache for building (default is to use if found)])],
  119. [use_ccache=$enableval],
  120. [use_ccache=auto])
  121. AC_ARG_ENABLE([lcov],
  122. [AS_HELP_STRING([--enable-lcov],
  123. [enable lcov testing (default is no)])],
  124. [use_lcov=yes],
  125. [use_lcov=no])
  126. AC_ARG_ENABLE([glibc-back-compat],
  127. [AS_HELP_STRING([--enable-glibc-back-compat],
  128. [enable backwards compatibility with glibc])],
  129. [use_glibc_compat=$enableval],
  130. [use_glibc_compat=no])
  131. AC_ARG_WITH([system-univalue],
  132. [AS_HELP_STRING([--with-system-univalue],
  133. [Build with system UniValue (default is no)])],
  134. [system_univalue=$withval],
  135. [system_univalue=no]
  136. )
  137. AC_ARG_ENABLE([zmq],
  138. [AS_HELP_STRING([--disable-zmq],
  139. [disable ZMQ notifications])],
  140. [use_zmq=$enableval],
  141. [use_zmq=yes])
  142. AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], [])
  143. # Enable debug
  144. AC_ARG_ENABLE([debug],
  145. [AS_HELP_STRING([--enable-debug],
  146. [use debug compiler flags and macros (default is no)])],
  147. [enable_debug=$enableval],
  148. [enable_debug=no])
  149. if test "x$enable_debug" = xyes; then
  150. CPPFLAGS="$CPPFLAGS -DDEBUG -DDEBUG_LOCKORDER"
  151. if test "x$GCC" = xyes; then
  152. CFLAGS="$CFLAGS -g3 -O0"
  153. fi
  154. if test "x$GXX" = xyes; then
  155. CXXFLAGS="$CXXFLAGS -g3 -O0"
  156. fi
  157. fi
  158. ## TODO: Remove these hard-coded paths and flags. They are here for the sake of
  159. ## compatibility with the legacy buildsystem.
  160. ##
  161. if test "x$CXXFLAGS_overridden" = "xno"; then
  162. CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wno-self-assign"
  163. fi
  164. CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS"
  165. AC_ARG_WITH([utils],
  166. [AS_HELP_STRING([--with-utils],
  167. [build bitcoin-cli bitcoin-tx (default=yes)])],
  168. [build_bitcoin_utils=$withval],
  169. [build_bitcoin_utils=yes])
  170. AC_ARG_WITH([libs],
  171. [AS_HELP_STRING([--with-libs],
  172. [build libraries (default=yes)])],
  173. [build_bitcoin_libs=$withval],
  174. [build_bitcoin_libs=yes])
  175. AC_ARG_WITH([daemon],
  176. [AS_HELP_STRING([--with-daemon],
  177. [build bitcoind daemon (default=yes)])],
  178. [build_bitcoind=$withval],
  179. [build_bitcoind=yes])
  180. AC_LANG_PUSH([C++])
  181. use_pkgconfig=yes
  182. case $host in
  183. *mingw*)
  184. #pkgconfig does more harm than good with MinGW
  185. use_pkgconfig=no
  186. TARGET_OS=windows
  187. AC_CHECK_LIB([mingwthrd], [main],, AC_MSG_ERROR(lib missing))
  188. AC_CHECK_LIB([kernel32], [main],, AC_MSG_ERROR(lib missing))
  189. AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(lib missing))
  190. AC_CHECK_LIB([gdi32], [main],, AC_MSG_ERROR(lib missing))
  191. AC_CHECK_LIB([comdlg32], [main],, AC_MSG_ERROR(lib missing))
  192. AC_CHECK_LIB([winspool], [main],, AC_MSG_ERROR(lib missing))
  193. AC_CHECK_LIB([winmm], [main],, AC_MSG_ERROR(lib missing))
  194. AC_CHECK_LIB([shell32], [main],, AC_MSG_ERROR(lib missing))
  195. AC_CHECK_LIB([comctl32], [main],, AC_MSG_ERROR(lib missing))
  196. AC_CHECK_LIB([ole32], [main],, AC_MSG_ERROR(lib missing))
  197. AC_CHECK_LIB([oleaut32], [main],, AC_MSG_ERROR(lib missing))
  198. AC_CHECK_LIB([uuid], [main],, AC_MSG_ERROR(lib missing))
  199. AC_CHECK_LIB([rpcrt4], [main],, AC_MSG_ERROR(lib missing))
  200. AC_CHECK_LIB([advapi32], [main],, AC_MSG_ERROR(lib missing))
  201. AC_CHECK_LIB([ws2_32], [main],, AC_MSG_ERROR(lib missing))
  202. AC_CHECK_LIB([mswsock], [main],, AC_MSG_ERROR(lib missing))
  203. AC_CHECK_LIB([shlwapi], [main],, AC_MSG_ERROR(lib missing))
  204. AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(lib missing))
  205. AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(lib missing))
  206. # -static is interpreted by libtool, where it has a different meaning.
  207. # In libtool-speak, it's -all-static.
  208. AX_CHECK_LINK_FLAG([[-static]],[LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static"])
  209. AC_PATH_PROG([MAKENSIS], [makensis], none)
  210. if test x$MAKENSIS = xnone; then
  211. AC_MSG_WARN("makensis not found. Cannot create installer.")
  212. fi
  213. AC_PATH_TOOL(WINDRES, windres, none)
  214. if test x$WINDRES = xnone; then
  215. AC_MSG_ERROR("windres not found")
  216. fi
  217. CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB"
  218. LEVELDB_TARGET_FLAGS="TARGET_OS=OS_WINDOWS_CROSSCOMPILE"
  219. if test "x$CXXFLAGS_overridden" = "xno"; then
  220. CXXFLAGS="$CXXFLAGS -w"
  221. fi
  222. case $host in
  223. i?86-*) WINDOWS_BITS=32 ;;
  224. x86_64-*) WINDOWS_BITS=64 ;;
  225. *) AC_MSG_ERROR("Could not determine win32/win64 for installer") ;;
  226. esac
  227. AC_SUBST(WINDOWS_BITS)
  228. dnl libtool insists upon adding -nostdlib and a list of objects/libs to link against.
  229. dnl That breaks our ability to build dll's with static libgcc/libstdc++/libssp. Override
  230. dnl its command here, with the predeps/postdeps removed, and -static inserted. Postdeps are
  231. dnl also overridden to prevent their insertion later.
  232. dnl This should only affect dll's.
  233. archive_cmds_CXX="\$CC -shared \$libobjs \$deplibs \$compiler_flags -static -o \$output_objdir/\$soname \${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker \$lib"
  234. postdeps_CXX=
  235. ;;
  236. *darwin*)
  237. TARGET_OS=darwin
  238. LEVELDB_TARGET_FLAGS="TARGET_OS=Darwin"
  239. if test x$cross_compiling != xyes; then
  240. BUILD_OS=darwin
  241. AC_CHECK_PROG([PORT],port, port)
  242. if test x$PORT = xport; then
  243. dnl add default macports paths
  244. CPPFLAGS="$CPPFLAGS -isystem /opt/local/include"
  245. LIBS="$LIBS -L/opt/local/lib"
  246. if test -d /opt/local/include/db48; then
  247. CPPFLAGS="$CPPFLAGS -I/opt/local/include/db48"
  248. LIBS="$LIBS -L/opt/local/lib/db48"
  249. fi
  250. fi
  251. AC_CHECK_PROG([BREW],brew, brew)
  252. if test x$BREW = xbrew; then
  253. dnl These Homebrew packages may be keg-only, meaning that they won't be found
  254. dnl in expected paths because they may conflict with system files. Ask
  255. dnl Homebrew where each one is located, then adjust paths accordingly.
  256. dnl It's safe to add these paths even if the functionality is disabled by
  257. dnl the user (--without-wallet or --without-gui for example).
  258. openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
  259. bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null`
  260. qt5_prefix=`$BREW --prefix qt5 2>/dev/null`
  261. if test x$openssl_prefix != x; then
  262. PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
  263. export PKG_CONFIG_PATH
  264. fi
  265. if test x$bdb_prefix != x; then
  266. CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include"
  267. LIBS="$LIBS -L$bdb_prefix/lib"
  268. fi
  269. if test x$qt5_prefix != x; then
  270. PKG_CONFIG_PATH="$qt5_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
  271. export PKG_CONFIG_PATH
  272. fi
  273. fi
  274. else
  275. case $build_os in
  276. *darwin*)
  277. BUILD_OS=darwin
  278. ;;
  279. *)
  280. AC_PATH_TOOL([INSTALLNAMETOOL], [install_name_tool], install_name_tool)
  281. AC_PATH_TOOL([OTOOL], [otool], otool)
  282. AC_PATH_PROGS([GENISOIMAGE], [genisoimage mkisofs],genisoimage)
  283. AC_PATH_PROGS([RSVG_CONVERT], [rsvg-convert rsvg],rsvg-convert)
  284. AC_PATH_PROGS([IMAGEMAGICK_CONVERT], [convert],convert)
  285. AC_PATH_PROGS([TIFFCP], [tiffcp],tiffcp)
  286. dnl libtool will try to strip the static lib, which is a problem for
  287. dnl cross-builds because strip attempts to call a hard-coded ld,
  288. dnl which may not exist in the path. Stripping the .a is not
  289. dnl necessary, so just disable it.
  290. old_striplib=
  291. ;;
  292. esac
  293. fi
  294. AX_CHECK_LINK_FLAG([[-Wl,-headerpad_max_install_names]], [LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"])
  295. CPPFLAGS="$CPPFLAGS -DMAC_OSX"
  296. OBJCXXFLAGS="$CXXFLAGS"
  297. ;;
  298. *linux*)
  299. TARGET_OS=linux
  300. ;;
  301. *)
  302. ;;
  303. esac
  304. if test x$use_comparison_tool != xno; then
  305. AC_SUBST(JAVA_COMPARISON_TOOL, $use_comparison_tool)
  306. fi
  307. if test x$use_comparison_tool_reorg_tests != xno; then
  308. if test x$use_comparison_tool = x; then
  309. AC_MSG_ERROR("comparison tool reorg tests but comparison tool was not specified")
  310. fi
  311. AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 1)
  312. else
  313. AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 0)
  314. fi
  315. if test x$use_extended_rpc_tests != xno; then
  316. AC_SUBST(EXTENDED_RPC_TESTS, -extended)
  317. fi
  318. if test x$use_lcov = xyes; then
  319. if test x$LCOV = x; then
  320. AC_MSG_ERROR("lcov testing requested but lcov not found")
  321. fi
  322. if test x$GCOV = x; then
  323. AC_MSG_ERROR("lcov testing requested but gcov not found")
  324. fi
  325. if test x$JAVA = x; then
  326. AC_MSG_ERROR("lcov testing requested but java not found")
  327. fi
  328. if test x$PYTHON = x; then
  329. AC_MSG_ERROR("lcov testing requested but python not found")
  330. fi
  331. if test x$GENHTML = x; then
  332. AC_MSG_ERROR("lcov testing requested but genhtml not found")
  333. fi
  334. if test x$use_comparison_tool = x; then
  335. AC_MSG_ERROR("lcov testing requested but comparison tool was not specified")
  336. fi
  337. LCOV="$LCOV --gcov-tool=$GCOV"
  338. AX_CHECK_COMPILE_FLAG([--coverage],[CXXFLAGS="$CXXFLAGS --coverage"],
  339. [AC_MSG_ERROR("lcov testing requested but --coverage flag does not work")])
  340. fi
  341. dnl Check for endianness
  342. AC_C_BIGENDIAN
  343. dnl Check for pthread compile/link requirements
  344. AX_PTHREAD
  345. # The following macro will add the necessary defines to bitcoin-config.h, but
  346. # they also need to be passed down to any subprojects. Pull the results out of
  347. # the cache and add them to CPPFLAGS.
  348. AC_SYS_LARGEFILE
  349. # detect POSIX or GNU variant of strerror_r
  350. AC_FUNC_STRERROR_R
  351. if test x$ac_cv_sys_file_offset_bits != x &&
  352. test x$ac_cv_sys_file_offset_bits != xno &&
  353. test x$ac_cv_sys_file_offset_bits != xunknown; then
  354. CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
  355. fi
  356. if test x$ac_cv_sys_large_files != x &&
  357. test x$ac_cv_sys_large_files != xno &&
  358. test x$ac_cv_sys_large_files != xunknown; then
  359. CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files"
  360. fi
  361. AX_CHECK_LINK_FLAG([[-Wl,--large-address-aware]], [LDFLAGS="$LDFLAGS -Wl,--large-address-aware"])
  362. AX_GCC_FUNC_ATTRIBUTE([visibility])
  363. AX_GCC_FUNC_ATTRIBUTE([dllexport])
  364. AX_GCC_FUNC_ATTRIBUTE([dllimport])
  365. if test x$use_glibc_compat != xno; then
  366. #glibc absorbed clock_gettime in 2.17. librt (its previous location) is safe to link
  367. #in anyway for back-compat.
  368. AC_CHECK_LIB([rt],[clock_gettime],, AC_MSG_ERROR(lib missing))
  369. #__fdelt_chk's params and return type have changed from long unsigned int to long int.
  370. # See which one is present here.
  371. AC_MSG_CHECKING(__fdelt_chk type)
  372. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef _FORTIFY_SOURCE
  373. #undef _FORTIFY_SOURCE
  374. #endif
  375. #define _FORTIFY_SOURCE 2
  376. #include <sys/select.h>
  377. extern "C" long unsigned int __fdelt_warn(long unsigned int);]],[[]])],
  378. [ fdelt_type="long unsigned int"],
  379. [ fdelt_type="long int"])
  380. AC_MSG_RESULT($fdelt_type)
  381. AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk])
  382. else
  383. AC_SEARCH_LIBS([clock_gettime],[rt])
  384. fi
  385. if test x$TARGET_OS != xwindows; then
  386. # All windows code is PIC, forcing it on just adds useless compile warnings
  387. AX_CHECK_COMPILE_FLAG([-fPIC],[PIC_FLAGS="-fPIC"])
  388. fi
  389. if test x$use_hardening != xno; then
  390. AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
  391. AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"])
  392. AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[
  393. AX_CHECK_PREPROC_FLAG([-U_FORTIFY_SOURCE],[
  394. HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -U_FORTIFY_SOURCE"
  395. ])
  396. HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -D_FORTIFY_SOURCE=2"
  397. ])
  398. AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"])
  399. AX_CHECK_LINK_FLAG([[-Wl,--nxcompat]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"])
  400. AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"])
  401. AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"])
  402. if test x$TARGET_OS != xwindows; then
  403. AX_CHECK_COMPILE_FLAG([-fPIE],[PIE_FLAGS="-fPIE"])
  404. AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"])
  405. fi
  406. case $host in
  407. *mingw*)
  408. AC_CHECK_LIB([ssp], [main],, AC_MSG_ERROR(lib missing))
  409. ;;
  410. esac
  411. fi
  412. dnl this flag screws up non-darwin gcc even when the check fails. special-case it.
  413. if test x$TARGET_OS = xdarwin; then
  414. AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"])
  415. fi
  416. AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h])
  417. AC_SEARCH_LIBS([getaddrinfo_a], [anl], [AC_DEFINE(HAVE_GETADDRINFO_A, 1, [Define this symbol if you have getaddrinfo_a])])
  418. AC_SEARCH_LIBS([inet_pton], [nsl resolv], [AC_DEFINE(HAVE_INET_PTON, 1, [Define this symbol if you have inet_pton])])
  419. AC_CHECK_DECLS([strnlen])
  420. AC_CHECK_DECLS([le16toh, le32toh, le64toh, htole16, htole32, htole64, be16toh, be32toh, be64toh, htobe16, htobe32, htobe64],,,
  421. [#if HAVE_ENDIAN_H
  422. #include <endian.h>
  423. #elif HAVE_SYS_ENDIAN_H
  424. #include <sys/endian.h>
  425. #endif])
  426. AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64],,,
  427. [#if HAVE_BYTESWAP_H
  428. #include <byteswap.h>
  429. #endif])
  430. dnl Check for MSG_NOSIGNAL
  431. AC_MSG_CHECKING(for MSG_NOSIGNAL)
  432. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]],
  433. [[ int f = MSG_NOSIGNAL; ]])],
  434. [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MSG_NOSIGNAL, 1,[Define this symbol if you have MSG_NOSIGNAL]) ],
  435. [ AC_MSG_RESULT(no)]
  436. )
  437. AC_MSG_CHECKING([for visibility attribute])
  438. AC_LINK_IFELSE([AC_LANG_SOURCE([
  439. int foo_def( void ) __attribute__((visibility("default")));
  440. int main(){}
  441. ])],
  442. [
  443. AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE,1,[Define if the visibility attribute is supported.])
  444. AC_MSG_RESULT(yes)
  445. ],
  446. [
  447. AC_MSG_RESULT(no)
  448. if test x$use_reduce_exports = xyes; then
  449. AC_MSG_ERROR([Cannot find a working visibility attribute. Use --disable-reduce-exports.])
  450. fi
  451. ]
  452. )
  453. if test x$use_reduce_exports = xyes; then
  454. AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[RE_CXXFLAGS="-fvisibility=hidden"],
  455. [AC_MSG_ERROR([Cannot set default symbol visibility. Use --disable-reduce-exports.])])
  456. fi
  457. LEVELDB_CPPFLAGS=
  458. LIBLEVELDB=
  459. LIBMEMENV=
  460. AM_CONDITIONAL([EMBEDDED_LEVELDB],[true])
  461. AC_SUBST(LEVELDB_CPPFLAGS)
  462. AC_SUBST(LIBLEVELDB)
  463. AC_SUBST(LIBMEMENV)
  464. if test x$enable_wallet != xno; then
  465. dnl Check for libdb_cxx only if wallet enabled
  466. BITCOIN_FIND_BDB48
  467. fi
  468. dnl Check for libminiupnpc (optional)
  469. if test x$use_upnp != xno; then
  470. AC_CHECK_HEADERS(
  471. [miniupnpc/miniwget.h miniupnpc/miniupnpc.h miniupnpc/upnpcommands.h miniupnpc/upnperrors.h],
  472. [AC_CHECK_LIB([miniupnpc], [main],[MINIUPNPC_LIBS=-lminiupnpc], [have_miniupnpc=no])],
  473. [have_miniupnpc=no]
  474. )
  475. fi
  476. BITCOIN_QT_INIT
  477. dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus
  478. BITCOIN_QT_CONFIGURE([$use_pkgconfig], [qt5])
  479. if test x$build_bitcoin_utils$build_bitcoind$bitcoin_enable_qt$use_tests = xnononono; then
  480. use_boost=no
  481. else
  482. use_boost=yes
  483. fi
  484. if test x$use_boost = xyes; then
  485. dnl Check for boost libs
  486. AX_BOOST_BASE
  487. AX_BOOST_SYSTEM
  488. AX_BOOST_FILESYSTEM
  489. AX_BOOST_PROGRAM_OPTIONS
  490. AX_BOOST_THREAD
  491. AX_BOOST_CHRONO
  492. if test x$use_reduce_exports = xyes; then
  493. AC_MSG_CHECKING([for working boost reduced exports])
  494. TEMP_CPPFLAGS="$CPPFLAGS"
  495. CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
  496. AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
  497. @%:@include <boost/version.hpp>
  498. ]], [[
  499. #if BOOST_VERSION >= 104900
  500. // Everything is okay
  501. #else
  502. # error Boost version is too old
  503. #endif
  504. ]])],[
  505. AC_MSG_RESULT(yes)
  506. ],[
  507. AC_MSG_ERROR([boost versions < 1.49 are known to be broken with reduced exports. Use --disable-reduce-exports.])
  508. ])
  509. CPPFLAGS="$TEMP_CPPFLAGS"
  510. fi
  511. fi
  512. if test x$use_reduce_exports = xyes; then
  513. CXXFLAGS="$CXXFLAGS $RE_CXXFLAGS"
  514. AX_CHECK_LINK_FLAG([[-Wl,--exclude-libs,ALL]], [RELDFLAGS="-Wl,--exclude-libs,ALL"])
  515. fi
  516. if test x$use_tests = xyes; then
  517. if test x$HEXDUMP = x; then
  518. AC_MSG_ERROR(hexdump is required for tests)
  519. fi
  520. if test x$use_boost = xyes; then
  521. AX_BOOST_UNIT_TEST_FRAMEWORK
  522. dnl Determine if -DBOOST_TEST_DYN_LINK is needed
  523. AC_MSG_CHECKING([for dynamic linked boost test])
  524. TEMP_LIBS="$LIBS"
  525. LIBS="$LIBS $BOOST_LDFLAGS $BOOST_UNIT_TEST_FRAMEWORK_LIB"
  526. TEMP_CPPFLAGS="$CPPFLAGS"
  527. CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
  528. AC_LINK_IFELSE([AC_LANG_SOURCE([
  529. #define BOOST_TEST_DYN_LINK
  530. #define BOOST_TEST_MAIN
  531. #include <boost/test/unit_test.hpp>
  532. ])],
  533. [AC_MSG_RESULT(yes)]
  534. [TESTDEFS="$TESTDEFS -DBOOST_TEST_DYN_LINK"],
  535. [AC_MSG_RESULT(no)])
  536. LIBS="$TEMP_LIBS"
  537. CPPFLAGS="$TEMP_CPPFLAGS"
  538. fi
  539. fi
  540. if test x$use_boost = xyes; then
  541. BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_PROGRAM_OPTIONS_LIB $BOOST_THREAD_LIB $BOOST_CHRONO_LIB"
  542. dnl If boost (prior to 1.57) was built without c++11, it emulated scoped enums
  543. dnl using c++98 constructs. Unfortunately, this implementation detail leaked into
  544. dnl the abi. This was fixed in 1.57.
  545. dnl When building against that installed version using c++11, the headers pick up
  546. dnl on the native c++11 scoped enum support and enable it, however it will fail to
  547. dnl link. This can be worked around by disabling c++11 scoped enums if linking will
  548. dnl fail.
  549. dnl BOOST_NO_SCOPED_ENUMS was changed to BOOST_NO_CXX11_SCOPED_ENUMS in 1.51.
  550. TEMP_LIBS="$LIBS"
  551. LIBS="$BOOST_LIBS $LIBS"
  552. TEMP_CPPFLAGS="$CPPFLAGS"
  553. CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
  554. AC_MSG_CHECKING([for mismatched boost c++11 scoped enums])
  555. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  556. #include "boost/config.hpp"
  557. #include "boost/version.hpp"
  558. #if !defined(BOOST_NO_SCOPED_ENUMS) && !defined(BOOST_NO_CXX11_SCOPED_ENUMS) && BOOST_VERSION < 105700
  559. #define BOOST_NO_SCOPED_ENUMS
  560. #define BOOST_NO_CXX11_SCOPED_ENUMS
  561. #define CHECK
  562. #endif
  563. #include "boost/filesystem.hpp"
  564. ]],[[
  565. #if defined(CHECK)
  566. boost::filesystem::copy_file("foo", "bar");
  567. #else
  568. choke;
  569. #endif
  570. ]])],
  571. [AC_MSG_RESULT(mismatched); BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_NO_SCOPED_ENUMS -DBOOST_NO_CXX11_SCOPED_ENUMS"], [AC_MSG_RESULT(ok)])
  572. LIBS="$TEMP_LIBS"
  573. CPPFLAGS="$TEMP_CPPFLAGS"
  574. dnl Boost >= 1.50 uses sleep_for rather than the now-deprecated sleep, however
  575. dnl it was broken from 1.50 to 1.52 when backed by nanosleep. Use sleep_for if
  576. dnl a working version is available, else fall back to sleep. sleep was removed
  577. dnl after 1.56.
  578. dnl If neither is available, abort.
  579. TEMP_LIBS="$LIBS"
  580. LIBS="$BOOST_LIBS $LIBS"
  581. TEMP_CPPFLAGS="$CPPFLAGS"
  582. CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
  583. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  584. #include <boost/thread/thread.hpp>
  585. #include <boost/version.hpp>
  586. ]],[[
  587. #if BOOST_VERSION >= 105000 && (!defined(BOOST_HAS_NANOSLEEP) || BOOST_VERSION >= 105200)
  588. boost::this_thread::sleep_for(boost::chrono::milliseconds(0));
  589. #else
  590. choke me
  591. #endif
  592. ]])],
  593. [boost_sleep=yes;
  594. AC_DEFINE(HAVE_WORKING_BOOST_SLEEP_FOR, 1, [Define this symbol if boost sleep_for works])],
  595. [boost_sleep=no])
  596. LIBS="$TEMP_LIBS"
  597. CPPFLAGS="$TEMP_CPPFLAGS"
  598. if test x$boost_sleep != xyes; then
  599. TEMP_LIBS="$LIBS"
  600. LIBS="$BOOST_LIBS $LIBS"
  601. TEMP_CPPFLAGS="$CPPFLAGS"
  602. CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
  603. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  604. #include <boost/version.hpp>
  605. #include <boost/thread.hpp>
  606. #include <boost/date_time/posix_time/posix_time_types.hpp>
  607. ]],[[
  608. #if BOOST_VERSION <= 105600
  609. boost::this_thread::sleep(boost::posix_time::milliseconds(0));
  610. #else
  611. choke me
  612. #endif
  613. ]])],
  614. [boost_sleep=yes; AC_DEFINE(HAVE_WORKING_BOOST_SLEEP, 1, [Define this symbol if boost sleep works])],
  615. [boost_sleep=no])
  616. LIBS="$TEMP_LIBS"
  617. CPPFLAGS="$TEMP_CPPFLAGS"
  618. fi
  619. if test x$boost_sleep != xyes; then
  620. AC_MSG_ERROR(No working boost sleep implementation found.)
  621. fi
  622. fi
  623. if test x$use_pkgconfig = xyes; then
  624. if test x"$PKG_CONFIG" = "x"; then
  625. AC_MSG_ERROR(pkg-config not found.)
  626. fi
  627. : #NOP
  628. m4_ifdef(
  629. [PKG_CHECK_MODULES],
  630. [
  631. PKG_CHECK_MODULES([SSL], [libssl],, [AC_MSG_ERROR(openssl not found.)])
  632. PKG_CHECK_MODULES([CRYPTO], [libcrypto],,[AC_MSG_ERROR(libcrypto not found.)])
  633. BITCOIN_QT_CHECK([PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [BITCOIN_QT_FAIL(libprotobuf not found)])])
  634. if test x$use_qr != xno; then
  635. BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])])
  636. fi
  637. if test x$build_bitcoin_utils$build_bitcoind$bitcoin_enable_qt$use_tests != xnononono; then
  638. PKG_CHECK_MODULES([EVENT], [libevent],, [AC_MSG_ERROR(libevent not found.)])
  639. if test x$TARGET_OS != xwindows; then
  640. PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads],, [AC_MSG_ERROR(libevent_pthreads not found.)])
  641. fi
  642. fi
  643. if test "x$use_zmq" = "xyes"; then
  644. PKG_CHECK_MODULES([ZMQ],[libzmq >= 4],
  645. [AC_DEFINE([ENABLE_ZMQ],[1],[Define to 1 to enable ZMQ functions])],
  646. [AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
  647. AC_MSG_WARN([libzmq version 4.x or greater not found, disabling])
  648. use_zmq=no])
  649. else
  650. AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
  651. fi
  652. ]
  653. )
  654. else
  655. AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing))
  656. AC_CHECK_LIB([crypto], [main],CRYPTO_LIBS=-lcrypto, AC_MSG_ERROR(libcrypto missing))
  657. AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),)
  658. AC_CHECK_LIB([ssl], [main],SSL_LIBS=-lssl, AC_MSG_ERROR(libssl missing))
  659. if test x$build_bitcoin_utils$build_bitcoind$bitcoin_enable_qt$use_tests != xnononono; then
  660. AC_CHECK_HEADER([event2/event.h],, AC_MSG_ERROR(libevent headers missing),)
  661. AC_CHECK_LIB([event],[main],EVENT_LIBS=-levent,AC_MSG_ERROR(libevent missing))
  662. if test x$TARGET_OS != xwindows; then
  663. AC_CHECK_LIB([event_pthreads],[main],EVENT_PTHREADS_LIBS=-levent_pthreads,AC_MSG_ERROR(libevent_pthreads missing))
  664. fi
  665. fi
  666. if test "x$use_zmq" = "xyes"; then
  667. AC_CHECK_HEADER([zmq.h],
  668. [AC_DEFINE([ENABLE_ZMQ],[1],[Define to 1 to enable ZMQ functions])],
  669. [AC_MSG_WARN([zmq.h not found, disabling zmq support])
  670. use_zmq=no
  671. AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])])
  672. AC_CHECK_LIB([zmq],[zmq_ctx_shutdown],ZMQ_LIBS=-lzmq,
  673. [AC_MSG_WARN([libzmq >= 4.0 not found, disabling zmq support])
  674. use_zmq=no
  675. AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])])
  676. else
  677. AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
  678. fi
  679. BITCOIN_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],[PROTOBUF_LIBS=-lprotobuf], BITCOIN_QT_FAIL(libprotobuf not found)))
  680. if test x$use_qr != xno; then
  681. BITCOIN_QT_CHECK([AC_CHECK_LIB([qrencode], [main],[QR_LIBS=-lqrencode], [have_qrencode=no])])
  682. BITCOIN_QT_CHECK([AC_CHECK_HEADER([qrencode.h],, have_qrencode=no)])
  683. fi
  684. fi
  685. dnl univalue check
  686. if test x$system_univalue != xno ; then
  687. found_univalue=no
  688. if test x$use_pkgconfig = xyes; then
  689. : #NOP
  690. m4_ifdef(
  691. [PKG_CHECK_MODULES],
  692. [
  693. PKG_CHECK_MODULES([UNIVALUE],[libunivalue],[found_univalue=yes],[true])
  694. ]
  695. )
  696. else
  697. AC_CHECK_HEADER([univalue.h],[
  698. AC_CHECK_LIB([univalue], [main],[
  699. UNIVALUE_LIBS=-lunivalue
  700. found_univalue=yes
  701. ],[true])
  702. ],[true])
  703. fi
  704. if test x$found_univalue = xyes ; then
  705. system_univalue=yes
  706. elif test x$system_univalue = xyes ; then
  707. AC_MSG_ERROR([univalue not found])
  708. else
  709. system_univalue=no
  710. fi
  711. fi
  712. if test x$system_univalue = xno ; then
  713. UNIVALUE_CFLAGS='-I$(srcdir)/univalue/include'
  714. UNIVALUE_LIBS='univalue/libunivalue.la'
  715. fi
  716. AM_CONDITIONAL([EMBEDDED_UNIVALUE],[test x$system_univalue = xno])
  717. AC_SUBST(UNIVALUE_CFLAGS)
  718. AC_SUBST(UNIVALUE_LIBS)
  719. CXXFLAGS_TEMP="$CXXFLAGS"
  720. LIBS_TEMP="$LIBS"
  721. CXXFLAGS="$CXXFLAGS $SSL_CFLAGS $CRYPTO_CFLAGS"
  722. LIBS="$LIBS $SSL_LIBS $CRYPTO_LIBS"
  723. AC_CHECK_HEADER([openssl/ec.h],, AC_MSG_ERROR(OpenSSL ec header missing),)
  724. CXXFLAGS="$CXXFLAGS_TEMP"
  725. LIBS="$LIBS_TEMP"
  726. BITCOIN_QT_PATH_PROGS([PROTOC], [protoc],$protoc_bin_path)
  727. AC_MSG_CHECKING([whether to build bitcoind])
  728. AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes])
  729. AC_MSG_RESULT($build_bitcoind)
  730. AC_MSG_CHECKING([whether to build utils (bitcoin-cli bitcoin-tx)])
  731. AM_CONDITIONAL([BUILD_BITCOIN_UTILS], [test x$build_bitcoin_utils = xyes])
  732. AC_MSG_RESULT($build_bitcoin_utils)
  733. AC_MSG_CHECKING([whether to build libraries])
  734. AM_CONDITIONAL([BUILD_BITCOIN_LIBS], [test x$build_bitcoin_libs = xyes])
  735. if test x$build_bitcoin_libs = xyes; then
  736. AC_DEFINE(HAVE_CONSENSUS_LIB, 1, [Define this symbol if the consensus lib has been built])
  737. AC_CONFIG_FILES([libbitcoinconsensus.pc:libbitcoinconsensus.pc.in])
  738. fi
  739. AC_MSG_RESULT($build_bitcoin_libs)
  740. AC_LANG_POP
  741. if test "x$use_ccache" != "xno"; then
  742. AC_MSG_CHECKING(if ccache should be used)
  743. if test x$CCACHE = x; then
  744. if test "x$use_ccache" = "xyes"; then
  745. AC_MSG_ERROR([ccache not found.]);
  746. else
  747. use_ccache=no
  748. fi
  749. else
  750. use_ccache=yes
  751. CC="$ac_cv_path_CCACHE $CC"
  752. CXX="$ac_cv_path_CCACHE $CXX"
  753. fi
  754. AC_MSG_RESULT($use_ccache)
  755. fi
  756. if test "x$use_ccache" = "xyes"; then
  757. AX_CHECK_PREPROC_FLAG([-Qunused-arguments],[CPPFLAGS="-Qunused-arguments $CPPFLAGS"])
  758. fi
  759. dnl enable wallet
  760. AC_MSG_CHECKING([if wallet should be enabled])
  761. if test x$enable_wallet != xno; then
  762. AC_MSG_RESULT(yes)
  763. AC_DEFINE_UNQUOTED([ENABLE_WALLET],[1],[Define to 1 to enable wallet functions])
  764. else
  765. AC_MSG_RESULT(no)
  766. fi
  767. dnl enable upnp support
  768. AC_MSG_CHECKING([whether to build with support for UPnP])
  769. if test x$have_miniupnpc = xno; then
  770. if test x$use_upnp = xyes; then
  771. AC_MSG_ERROR("UPnP requested but cannot be built. use --without-miniupnpc")
  772. fi
  773. AC_MSG_RESULT(no)
  774. else
  775. if test x$use_upnp != xno; then
  776. AC_MSG_RESULT(yes)
  777. AC_MSG_CHECKING([whether to build with UPnP enabled by default])
  778. use_upnp=yes
  779. upnp_setting=0
  780. if test x$use_upnp_default != xno; then
  781. use_upnp_default=yes
  782. upnp_setting=1
  783. fi
  784. AC_MSG_RESULT($use_upnp_default)
  785. AC_DEFINE_UNQUOTED([USE_UPNP],[$upnp_setting],[UPnP support not compiled if undefined, otherwise value (0 or 1) determines default state])
  786. if test x$TARGET_OS = xwindows; then
  787. MINIUPNPC_CPPFLAGS="-DSTATICLIB -DMINIUPNP_STATICLIB"
  788. fi
  789. else
  790. AC_MSG_RESULT(no)
  791. fi
  792. fi
  793. dnl these are only used when qt is enabled
  794. if test x$bitcoin_enable_qt != xno; then
  795. BUILD_QT=qt
  796. dnl enable dbus support
  797. AC_MSG_CHECKING([whether to build GUI with support for D-Bus])
  798. if test x$bitcoin_enable_qt_dbus != xno; then
  799. AC_DEFINE([USE_DBUS],[1],[Define if dbus support should be compiled in])
  800. fi
  801. AC_MSG_RESULT($bitcoin_enable_qt_dbus)
  802. dnl enable qr support
  803. AC_MSG_CHECKING([whether to build GUI with support for QR codes])
  804. if test x$have_qrencode = xno; then
  805. if test x$use_qr = xyes; then
  806. AC_MSG_ERROR("QR support requested but cannot be built. use --without-qrencode")
  807. fi
  808. AC_MSG_RESULT(no)
  809. else
  810. if test x$use_qr != xno; then
  811. AC_MSG_RESULT(yes)
  812. AC_DEFINE([USE_QRCODE],[1],[Define if QR support should be compiled in])
  813. use_qr=yes
  814. else
  815. AC_MSG_RESULT(no)
  816. fi
  817. fi
  818. if test x$XGETTEXT = x; then
  819. AC_MSG_WARN("xgettext is required to update qt translations")
  820. fi
  821. AC_MSG_CHECKING([whether to build test_bitcoin-qt])
  822. if test x$use_tests$bitcoin_enable_qt_test = xyesyes; then
  823. AC_MSG_RESULT([yes])
  824. BUILD_TEST_QT="test"
  825. else
  826. AC_MSG_RESULT([no])
  827. fi
  828. fi
  829. AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"])
  830. AC_MSG_CHECKING([whether to build test_bitcoin])
  831. if test x$use_tests = xyes; then
  832. AC_MSG_RESULT([yes])
  833. BUILD_TEST="test"
  834. else
  835. AC_MSG_RESULT([no])
  836. fi
  837. AC_MSG_CHECKING([whether to reduce exports])
  838. if test x$use_reduce_exports = xyes; then
  839. AC_MSG_RESULT([yes])
  840. else
  841. AC_MSG_RESULT([no])
  842. fi
  843. if test x$build_bitcoin_utils$build_bitcoin_libs$build_bitcoind$bitcoin_enable_qt$use_tests = xnonononono; then
  844. AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon --with-gui or --enable-tests])
  845. fi
  846. AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin])
  847. AM_CONDITIONAL([BUILD_DARWIN], [test x$BUILD_OS = xdarwin])
  848. AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
  849. AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes])
  850. AM_CONDITIONAL([ENABLE_TESTS],[test x$use_tests = xyes])
  851. AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes])
  852. AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$use_tests$bitcoin_enable_qt_test = xyesyes])
  853. AM_CONDITIONAL([ENABLE_BENCH],[test x$use_bench = xyes])
  854. AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes])
  855. AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes])
  856. AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno])
  857. AM_CONDITIONAL([USE_COMPARISON_TOOL_REORG_TESTS],[test x$use_comparison_tool_reorg_test != xno])
  858. AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes])
  859. AM_CONDITIONAL([HARDEN],[test x$use_hardening = xyes])
  860. AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
  861. AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version])
  862. AC_DEFINE(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION, [Build revision])
  863. AC_DEFINE(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD, [Version Build])
  864. AC_DEFINE(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE, [Version is release])
  865. AC_DEFINE(COPYRIGHT_YEAR, _COPYRIGHT_YEAR, [Version is release])
  866. AC_DEFINE(COPYRIGHT_HOLDERS, "_COPYRIGHT_HOLDERS", [Copyright holder(s) before %s replacement])
  867. AC_DEFINE(COPYRIGHT_HOLDERS_SUBSTITUTION, "_COPYRIGHT_HOLDERS_SUBSTITUTION", [Replacement for %s in copyright holders string])
  868. define(_COPYRIGHT_HOLDERS_FINAL, patsubst(_COPYRIGHT_HOLDERS, [%s], [_COPYRIGHT_HOLDERS_SUBSTITUTION]))
  869. AC_DEFINE(COPYRIGHT_HOLDERS_FINAL, "_COPYRIGHT_HOLDERS_FINAL", [Copyright holder(s)])
  870. AC_SUBST(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR)
  871. AC_SUBST(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR)
  872. AC_SUBST(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION)
  873. AC_SUBST(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD)
  874. AC_SUBST(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE)
  875. AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR)
  876. AC_SUBST(COPYRIGHT_HOLDERS, "_COPYRIGHT_HOLDERS")
  877. AC_SUBST(COPYRIGHT_HOLDERS_SUBSTITUTION, "_COPYRIGHT_HOLDERS_SUBSTITUTION")
  878. AC_SUBST(COPYRIGHT_HOLDERS_FINAL, "_COPYRIGHT_HOLDERS_FINAL")
  879. AC_SUBST(RELDFLAGS)
  880. AC_SUBST(HARDENED_CXXFLAGS)
  881. AC_SUBST(HARDENED_CPPFLAGS)
  882. AC_SUBST(HARDENED_LDFLAGS)
  883. AC_SUBST(PIC_FLAGS)
  884. AC_SUBST(PIE_FLAGS)
  885. AC_SUBST(LIBTOOL_APP_LDFLAGS)
  886. AC_SUBST(USE_UPNP)
  887. AC_SUBST(USE_QRCODE)
  888. AC_SUBST(BOOST_LIBS)
  889. AC_SUBST(TESTDEFS)
  890. AC_SUBST(LEVELDB_TARGET_FLAGS)
  891. AC_SUBST(BUILD_TEST)
  892. AC_SUBST(BUILD_QT)
  893. AC_SUBST(BUILD_TEST_QT)
  894. AC_SUBST(MINIUPNPC_CPPFLAGS)
  895. AC_SUBST(MINIUPNPC_LIBS)
  896. AC_CONFIG_FILES([Makefile src/Makefile share/setup.nsi share/qt/Info.plist src/test/buildenv.py])
  897. AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh])
  898. AC_CONFIG_FILES([qa/pull-tester/tests_config.py],[chmod +x qa/pull-tester/tests_config.py])
  899. dnl boost's m4 checks do something really nasty: they export these vars. As a
  900. dnl result, they leak into secp256k1's configure and crazy things happen.
  901. dnl Until this is fixed upstream and we've synced, we'll just un-export them.
  902. CPPFLAGS_TEMP="$CPPFLAGS"
  903. unset CPPFLAGS
  904. CPPFLAGS="$CPPFLAGS_TEMP"
  905. LDFLAGS_TEMP="$LDFLAGS"
  906. unset LDFLAGS
  907. LDFLAGS="$LDFLAGS_TEMP"
  908. LIBS_TEMP="$LIBS"
  909. unset LIBS
  910. LIBS="$LIBS_TEMP"
  911. PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH"
  912. unset PKG_CONFIG_PATH
  913. PKG_CONFIG_PATH="$PKGCONFIG_PATH_TEMP"
  914. PKGCONFIG_LIBDIR_TEMP="$PKG_CONFIG_LIBDIR"
  915. unset PKG_CONFIG_LIBDIR
  916. PKG_CONFIG_LIBDIR="$PKGCONFIG_LIBDIR_TEMP"
  917. if test x$system_univalue = xno; then
  918. AC_CONFIG_SUBDIRS([src/univalue])
  919. fi
  920. ac_configure_args="${ac_configure_args} --disable-shared --with-pic --with-bignum=no --enable-module-recovery"
  921. AC_CONFIG_SUBDIRS([src/secp256k1])
  922. AC_OUTPUT
  923. dnl Taken from https://wiki.debian.org/RpathIssue
  924. case $host in
  925. *-*-linux-gnu)
  926. AC_MSG_RESULT([Fixing libtool for -rpath problems.])
  927. sed < libtool > libtool-2 \
  928. 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/'
  929. mv libtool-2 libtool
  930. chmod 755 libtool
  931. ;;
  932. esac
  933. dnl Replace the BUILDDIR path with the correct Windows path if compiling on Native Windows
  934. case ${OS} in
  935. *Windows*)
  936. sed 's/BUILDDIR="\/\([[a-z]]\)/BUILDDIR="\1:/' qa/pull-tester/tests_config.py > qa/pull-tester/tests_config-2.py
  937. mv qa/pull-tester/tests_config-2.py qa/pull-tester/tests_config.py
  938. ;;
  939. esac