configure.ac 33 KB

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