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 33KB

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