]>
Commit | Line | Data |
---|---|---|
35b8af92 CF |
1 | dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) |
2 | AC_PREREQ([2.60]) | |
f11099e2 SB |
3 | define(_CLIENT_VERSION_MAJOR, 1) |
4 | define(_CLIENT_VERSION_MINOR, 0) | |
c5b04132 | 5 | define(_CLIENT_VERSION_REVISION, 13) |
0523d21d | 6 | define(_CLIENT_VERSION_BUILD, 50) |
6fe11af7 JG |
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))) | |
998202ba | 9 | define(_CLIENT_VERSION_IS_RELEASE, true) |
e466df93 | 10 | define(_COPYRIGHT_YEAR, 2017) |
6fe11af7 | 11 | AC_INIT([Zcash],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_SUFFIX(_ZC_BUILD_VAL)],[https://github.com/zcash/zcash/issues],[zcash]) |
e5438111 | 12 | AC_CONFIG_SRCDIR([src/main.cpp]) |
13 | AC_CONFIG_HEADERS([src/config/bitcoin-config.h]) | |
52a5f903 | 14 | AC_CONFIG_AUX_DIR([build-aux]) |
15 | AC_CONFIG_MACRO_DIR([build-aux/m4]) | |
1723862e | 16 | |
c5d645e2 CF |
17 | BITCOIN_DAEMON_NAME=zcashd |
18 | BITCOIN_CLI_NAME=zcash-cli | |
19 | BITCOIN_TX_NAME=zcash-tx | |
20 | ||
35b8af92 | 21 | AC_CANONICAL_HOST |
1723862e | 22 | |
35b8af92 CF |
23 | AH_TOP([#ifndef BITCOIN_CONFIG_H]) |
24 | AH_TOP([#define BITCOIN_CONFIG_H]) | |
25 | AH_BOTTOM([#endif //BITCOIN_CONFIG_H]) | |
26 | ||
35b8af92 CF |
27 | dnl faketime breaks configure and is only needed for make. Disable it here. |
28 | unset FAKETIME | |
29 | ||
eefb766c | 30 | dnl Automake init set-up and checks |
051698a0 | 31 | AM_INIT_AUTOMAKE([no-define subdir-objects foreign tar-pax]) |
35b8af92 CF |
32 | |
33 | dnl faketime messes with timestamps and causes configure to be re-run. | |
34 | dnl --disable-maintainer-mode can be used to bypass this. | |
35 | AM_MAINTAINER_MODE([enable]) | |
36 | ||
37 | dnl make the compilation flags quiet unless V=1 is used | |
38 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) | |
39 | ||
eefb766c | 40 | dnl Compiler checks (here before libtool). |
41 | if test "x${CXXFLAGS+set}" = "xset"; then | |
42 | CXXFLAGS_overridden=yes | |
43 | else | |
44 | CXXFLAGS_overridden=no | |
45 | fi | |
c4da0970 | 46 | |
52a5f903 | 47 | AC_PROG_CXX |
52a5f903 | 48 | m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX]) |
eefb766c | 49 | |
50 | dnl By default, libtool for mingw refuses to link static libs into a dll for | |
51 | dnl fear of mixing pic/non-pic objects, and import/export complications. Since | |
52 | dnl we have those under control, re-enable that functionality. | |
53 | case $host in | |
54 | *mingw*) | |
55 | lt_cv_deplibs_check_method="pass_all" | |
56 | ;; | |
57 | esac | |
4ba17236 | 58 | dnl Require C++11 compiler (no GNU extensions) |
943f19fe | 59 | AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory], [nodefault]) |
d812d95a AT |
60 | dnl Check if -latomic is required for <std::atomic> |
61 | CHECK_ATOMIC | |
62 | ||
eefb766c | 63 | dnl Libtool init checks. |
19df238a | 64 | LT_INIT([pic-only]) |
eefb766c | 65 | |
66 | dnl Check/return PATH for base programs. | |
52a5f903 | 67 | AC_PATH_TOOL(AR, ar) |
68 | AC_PATH_TOOL(RANLIB, ranlib) | |
69 | AC_PATH_TOOL(STRIP, strip) | |
70 | AC_PATH_TOOL(GCOV, gcov) | |
71 | AC_PATH_PROG(LCOV, lcov) | |
52a5f903 | 72 | AC_PATH_PROG(GENHTML, genhtml) |
73 | AC_PATH_PROG([GIT], [git]) | |
74 | AC_PATH_PROG(CCACHE,ccache) | |
75 | AC_PATH_PROG(XGETTEXT,xgettext) | |
76 | AC_PATH_PROG(HEXDUMP,hexdump) | |
56734f4b TH |
77 | AC_PATH_TOOL(READELF,readelf) |
78 | AC_PATH_TOOL(CPPFILT,c++filt) | |
eefb766c | 79 | |
4f9e993b WL |
80 | # Enable wallet |
81 | AC_ARG_ENABLE([wallet], | |
82 | [AS_HELP_STRING([--enable-wallet], | |
83 | [enable wallet (default is yes)])], | |
84 | [enable_wallet=$enableval], | |
85 | [enable_wallet=yes]) | |
86 | ||
2cc0a252 JG |
87 | AC_ARG_ENABLE([mining], |
88 | [AS_HELP_STRING([--enable-mining], | |
89 | [enable mining (default is yes)])], | |
90 | [enable_mining=$enableval], | |
91 | [enable_mining=yes]) | |
92 | ||
802ea76b SB |
93 | AC_ARG_ENABLE([rust], |
94 | [AS_HELP_STRING([--enable-rust], | |
95 | [enable rust (default is yes)])], | |
96 | [enable_rust=$enableval], | |
97 | [enable_rust=yes]) | |
98 | ||
99eb947a S |
99 | AC_ARG_ENABLE([proton], |
100 | [AS_HELP_STRING([--disable-proton], | |
101 | [disable Proton (AMQP messaging)])], | |
102 | [use_proton=$enableval], | |
103 | [use_proton=yes]) | |
104 | ||
35b8af92 CF |
105 | AC_ARG_ENABLE(tests, |
106 | AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]), | |
107 | [use_tests=$enableval], | |
108 | [use_tests=yes]) | |
109 | ||
35b8af92 CF |
110 | AC_ARG_ENABLE([hardening], |
111 | [AS_HELP_STRING([--enable-hardening], | |
112 | [attempt to harden the resulting executables (default is yes)])], | |
113 | [use_hardening=$enableval], | |
114 | [use_hardening=yes]) | |
115 | ||
e432a5f0 CF |
116 | AC_ARG_ENABLE([reduce-exports], |
117 | [AS_HELP_STRING([--enable-reduce-exports], | |
3ee028f1 | 118 | [attempt to reduce exported symbols in the resulting executables (default is no)])], |
e432a5f0 | 119 | [use_reduce_exports=$enableval], |
3ee028f1 | 120 | [use_reduce_exports=no]) |
e432a5f0 | 121 | |
35b8af92 CF |
122 | AC_ARG_ENABLE([ccache], |
123 | [AS_HELP_STRING([--enable-ccache], | |
e18e1001 | 124 | [use ccache for building (default is yes if ccache is found)])], |
35b8af92 CF |
125 | [use_ccache=$enableval], |
126 | [use_ccache=auto]) | |
127 | ||
128 | AC_ARG_ENABLE([lcov], | |
129 | [AS_HELP_STRING([--enable-lcov], | |
130 | [enable lcov testing (default is no)])], | |
131 | [use_lcov=yes], | |
132 | [use_lcov=no]) | |
133 | ||
d5aab704 CF |
134 | AC_ARG_ENABLE([glibc-back-compat], |
135 | [AS_HELP_STRING([--enable-glibc-back-compat], | |
aa367306 | 136 | [enable backwards compatibility with glibc])], |
d5aab704 CF |
137 | [use_glibc_compat=$enableval], |
138 | [use_glibc_compat=no]) | |
139 | ||
f200002c | 140 | AC_ARG_ENABLE([zmq], |
1afb8431 | 141 | [AS_HELP_STRING([--disable-zmq], |
142 | [disable ZMQ notifications])], | |
f200002c JG |
143 | [use_zmq=$enableval], |
144 | [use_zmq=yes]) | |
145 | ||
35b8af92 CF |
146 | AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], []) |
147 | ||
abfcaefe | 148 | AC_ARG_ENABLE(man, |
1b5e712c | 149 | [AS_HELP_STRING([--disable-man], |
150 | [do not install man pages (default is to install)])],, | |
abfcaefe | 151 | enable_man=yes) |
152 | AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no) | |
153 | ||
b197605e | 154 | # Enable debug |
f5f157b8 | 155 | AC_ARG_ENABLE([debug], |
156 | [AS_HELP_STRING([--enable-debug], | |
157 | [use debug compiler flags and macros (default is no)])], | |
158 | [enable_debug=$enableval], | |
159 | [enable_debug=no]) | |
160 | ||
5dd887fd CF |
161 | # Turn warnings into errors |
162 | AC_ARG_ENABLE([werror], | |
163 | [AS_HELP_STRING([--enable-werror], | |
164 | [Treat certain compiler warnings as errors (default is no)])], | |
165 | [enable_werror=$enableval], | |
166 | [enable_werror=no]) | |
167 | ||
341ab745 CF |
168 | AC_LANG_PUSH([C++]) |
169 | AX_CHECK_COMPILE_FLAG([-Werror],[CXXFLAG_WERROR="-Werror"],[CXXFLAG_WERROR=""]) | |
170 | ||
f5f157b8 | 171 | if test "x$enable_debug" = xyes; then |
ae1565b5 | 172 | CPPFLAGS="$CPPFLAGS -DDEBUG -DDEBUG_LOCKORDER" |
f5f157b8 | 173 | if test "x$GCC" = xyes; then |
ae1565b5 | 174 | CFLAGS="$CFLAGS -g3 -O0" |
f5f157b8 | 175 | fi |
b197605e | 176 | |
f5f157b8 | 177 | if test "x$GXX" = xyes; then |
ae1565b5 | 178 | CXXFLAGS="$CXXFLAGS -g3 -O0" |
f5f157b8 | 179 | fi |
b197605e | 180 | fi |
f5f157b8 | 181 | |
5dd887fd CF |
182 | ERROR_CXXFLAGS= |
183 | if test "x$enable_werror" = "xyes"; then | |
184 | if test "x$CXXFLAG_WERROR" = "x"; then | |
185 | AC_MSG_ERROR("enable-werror set but -Werror is not usable") | |
186 | fi | |
187 | AX_CHECK_COMPILE_FLAG([-Werror=vla],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=vla"],,[[$CXXFLAG_WERROR]]) | |
188 | fi | |
189 | ||
123e4f87 | 190 | if test "x$CXXFLAGS_overridden" = "xno"; then |
341ab745 CF |
191 | AX_CHECK_COMPILE_FLAG([-Wall],[CXXFLAGS="$CXXFLAGS -Wall"],,[[$CXXFLAG_WERROR]]) |
192 | AX_CHECK_COMPILE_FLAG([-Wextra],[CXXFLAGS="$CXXFLAGS -Wextra"],,[[$CXXFLAG_WERROR]]) | |
193 | AX_CHECK_COMPILE_FLAG([-Wformat],[CXXFLAGS="$CXXFLAGS -Wformat"],,[[$CXXFLAG_WERROR]]) | |
d35ebc7b | 194 | AX_CHECK_COMPILE_FLAG([-Wvla],[CXXFLAGS="$CXXFLAGS -Wvla"],,[[$CXXFLAG_WERROR]]) |
341ab745 CF |
195 | AX_CHECK_COMPILE_FLAG([-Wformat-security],[CXXFLAGS="$CXXFLAGS -Wformat-security"],,[[$CXXFLAG_WERROR]]) |
196 | ||
197 | ## Some compilers (gcc) ignore unknown -Wno-* options, but warn about all | |
198 | ## unknown options if any other warning is produced. Test the -Wfoo case, and | |
199 | ## set the -Wno-foo case if it works. | |
200 | AX_CHECK_COMPILE_FLAG([-Wunused-parameter],[CXXFLAGS="$CXXFLAGS -Wno-unused-parameter"],,[[$CXXFLAG_WERROR]]) | |
201 | AX_CHECK_COMPILE_FLAG([-Wself-assign],[CXXFLAGS="$CXXFLAGS -Wno-self-assign"],,[[$CXXFLAG_WERROR]]) | |
202 | AX_CHECK_COMPILE_FLAG([-Wunused-local-typedef],[CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"],,[[$CXXFLAG_WERROR]]) | |
203 | AX_CHECK_COMPILE_FLAG([-Wdeprecated-register],[CXXFLAGS="$CXXFLAGS -Wno-deprecated-register"],,[[$CXXFLAG_WERROR]]) | |
123e4f87 | 204 | fi |
55fca515 | 205 | CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS" |
35b8af92 | 206 | |
b7a4ecc1 LD |
207 | AC_ARG_WITH([utils], |
208 | [AS_HELP_STRING([--with-utils], | |
66a89c08 | 209 | [build zcash-cli zcash-tx (default=yes)])], |
b7a4ecc1 LD |
210 | [build_bitcoin_utils=$withval], |
211 | [build_bitcoin_utils=yes]) | |
212 | ||
213 | AC_ARG_WITH([libs], | |
214 | [AS_HELP_STRING([--with-libs], | |
215 | [build libraries (default=yes)])], | |
216 | [build_bitcoin_libs=$withval], | |
217 | [build_bitcoin_libs=yes]) | |
218 | ||
219 | AC_ARG_WITH([daemon], | |
220 | [AS_HELP_STRING([--with-daemon], | |
221 | [build bitcoind daemon (default=yes)])], | |
222 | [build_bitcoind=$withval], | |
223 | [build_bitcoind=yes]) | |
224 | ||
35b8af92 CF |
225 | use_pkgconfig=yes |
226 | case $host in | |
227 | *mingw*) | |
228 | ||
96b9603c | 229 | #pkgconfig does more harm than good with MinGW |
35b8af92 CF |
230 | use_pkgconfig=no |
231 | ||
232 | TARGET_OS=windows | |
233 | AC_CHECK_LIB([mingwthrd], [main],, AC_MSG_ERROR(lib missing)) | |
234 | AC_CHECK_LIB([kernel32], [main],, AC_MSG_ERROR(lib missing)) | |
235 | AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(lib missing)) | |
236 | AC_CHECK_LIB([gdi32], [main],, AC_MSG_ERROR(lib missing)) | |
237 | AC_CHECK_LIB([comdlg32], [main],, AC_MSG_ERROR(lib missing)) | |
238 | AC_CHECK_LIB([winspool], [main],, AC_MSG_ERROR(lib missing)) | |
239 | AC_CHECK_LIB([winmm], [main],, AC_MSG_ERROR(lib missing)) | |
240 | AC_CHECK_LIB([shell32], [main],, AC_MSG_ERROR(lib missing)) | |
241 | AC_CHECK_LIB([comctl32], [main],, AC_MSG_ERROR(lib missing)) | |
242 | AC_CHECK_LIB([ole32], [main],, AC_MSG_ERROR(lib missing)) | |
243 | AC_CHECK_LIB([oleaut32], [main],, AC_MSG_ERROR(lib missing)) | |
244 | AC_CHECK_LIB([uuid], [main],, AC_MSG_ERROR(lib missing)) | |
245 | AC_CHECK_LIB([rpcrt4], [main],, AC_MSG_ERROR(lib missing)) | |
246 | AC_CHECK_LIB([advapi32], [main],, AC_MSG_ERROR(lib missing)) | |
247 | AC_CHECK_LIB([ws2_32], [main],, AC_MSG_ERROR(lib missing)) | |
248 | AC_CHECK_LIB([mswsock], [main],, AC_MSG_ERROR(lib missing)) | |
249 | AC_CHECK_LIB([shlwapi], [main],, AC_MSG_ERROR(lib missing)) | |
250 | AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(lib missing)) | |
c589f5f2 CF |
251 | AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(lib missing)) |
252 | ||
575e70c0 CF |
253 | # -static is interpreted by libtool, where it has a different meaning. |
254 | # In libtool-speak, it's -all-static. | |
e0077de5 | 255 | AX_CHECK_LINK_FLAG([[-static]],[LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static"]) |
575e70c0 | 256 | |
35b8af92 CF |
257 | AC_PATH_PROG([MAKENSIS], [makensis], none) |
258 | if test x$MAKENSIS = xnone; then | |
259 | AC_MSG_WARN("makensis not found. Cannot create installer.") | |
260 | fi | |
261 | ||
5ceb9c96 CF |
262 | AC_PATH_TOOL(WINDRES, windres, none) |
263 | if test x$WINDRES = xnone; then | |
264 | AC_MSG_ERROR("windres not found") | |
265 | fi | |
266 | ||
b77dfdc9 | 267 | CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB" |
35b8af92 | 268 | LEVELDB_TARGET_FLAGS="TARGET_OS=OS_WINDOWS_CROSSCOMPILE" |
123e4f87 LD |
269 | if test "x$CXXFLAGS_overridden" = "xno"; then |
270 | CXXFLAGS="$CXXFLAGS -w" | |
271 | fi | |
2f87b38e WL |
272 | case $host in |
273 | i?86-*) WINDOWS_BITS=32 ;; | |
274 | x86_64-*) WINDOWS_BITS=64 ;; | |
275 | *) AC_MSG_ERROR("Could not determine win32/win64 for installer") ;; | |
276 | esac | |
277 | AC_SUBST(WINDOWS_BITS) | |
9ed8979e CF |
278 | |
279 | dnl libtool insists upon adding -nostdlib and a list of objects/libs to link against. | |
280 | dnl That breaks our ability to build dll's with static libgcc/libstdc++/libssp. Override | |
281 | dnl its command here, with the predeps/postdeps removed, and -static inserted. Postdeps are | |
282 | dnl also overridden to prevent their insertion later. | |
283 | dnl This should only affect dll's. | |
284 | archive_cmds_CXX="\$CC -shared \$libobjs \$deplibs \$compiler_flags -static -o \$output_objdir/\$soname \${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker \$lib" | |
285 | postdeps_CXX= | |
286 | ||
35b8af92 CF |
287 | ;; |
288 | *darwin*) | |
289 | TARGET_OS=darwin | |
290 | LEVELDB_TARGET_FLAGS="TARGET_OS=Darwin" | |
291 | if test x$cross_compiling != xyes; then | |
b62bbb1f | 292 | BUILD_OS=darwin |
35b8af92 CF |
293 | AC_CHECK_PROG([PORT],port, port) |
294 | if test x$PORT = xport; then | |
295 | dnl add default macports paths | |
4c69ebed PJ |
296 | CPPFLAGS="$CPPFLAGS -isystem /opt/local/include" |
297 | LIBS="$LIBS -L/opt/local/lib" | |
9cb7abaf DH |
298 | if test -d /opt/local/include/db62; then |
299 | CPPFLAGS="$CPPFLAGS -I/opt/local/include/db62" | |
300 | LIBS="$LIBS -L/opt/local/lib/db62" | |
4c69ebed | 301 | fi |
35b8af92 CF |
302 | fi |
303 | ||
304 | AC_CHECK_PROG([BREW],brew, brew) | |
305 | if test x$BREW = xbrew; then | |
27368e76 | 306 | dnl These Homebrew packages may be keg-only, meaning that they won't be found |
9fedafba CF |
307 | dnl in expected paths because they may conflict with system files. Ask |
308 | dnl Homebrew where each one is located, then adjust paths accordingly. | |
309 | dnl It's safe to add these paths even if the functionality is disabled by | |
abecfc42 | 310 | dnl the user (--without-wallet for example). |
9fedafba CF |
311 | |
312 | openssl_prefix=`$BREW --prefix openssl 2>/dev/null` | |
313 | bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null` | |
9fedafba | 314 | if test x$openssl_prefix != x; then |
b77b4eda | 315 | PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" |
f9e40fb0 | 316 | export PKG_CONFIG_PATH |
9fedafba CF |
317 | fi |
318 | if test x$bdb_prefix != x; then | |
319 | CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include" | |
320 | LIBS="$LIBS -L$bdb_prefix/lib" | |
321 | fi | |
35b8af92 | 322 | fi |
b62bbb1f CF |
323 | else |
324 | case $build_os in | |
325 | *darwin*) | |
326 | BUILD_OS=darwin | |
327 | ;; | |
328 | *) | |
329 | AC_PATH_TOOL([INSTALLNAMETOOL], [install_name_tool], install_name_tool) | |
330 | AC_PATH_TOOL([OTOOL], [otool], otool) | |
331 | AC_PATH_PROGS([GENISOIMAGE], [genisoimage mkisofs],genisoimage) | |
b7f2cdc8 CF |
332 | |
333 | dnl libtool will try to strip the static lib, which is a problem for | |
334 | dnl cross-builds because strip attempts to call a hard-coded ld, | |
335 | dnl which may not exist in the path. Stripping the .a is not | |
336 | dnl necessary, so just disable it. | |
337 | old_striplib= | |
b62bbb1f CF |
338 | ;; |
339 | esac | |
35b8af92 CF |
340 | fi |
341 | ||
9eb5a5fb | 342 | AX_CHECK_LINK_FLAG([[-Wl,-headerpad_max_install_names]], [LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"]) |
35b8af92 | 343 | CPPFLAGS="$CPPFLAGS -DMAC_OSX" |
c459de2f | 344 | OBJCXXFLAGS="$CXXFLAGS" |
35b8af92 | 345 | ;; |
ab123ad4 CF |
346 | *linux*) |
347 | TARGET_OS=linux | |
348 | ;; | |
35b8af92 | 349 | *) |
35b8af92 CF |
350 | ;; |
351 | esac | |
352 | ||
d7002714 CF |
353 | if test x$use_pkgconfig = xyes; then |
354 | m4_ifndef([PKG_PROG_PKG_CONFIG], [AC_MSG_ERROR(PKG_PROG_PKG_CONFIG macro not found. Please install pkg-config and re-run autogen.sh.)]) | |
355 | m4_ifdef([PKG_PROG_PKG_CONFIG], [ | |
356 | PKG_PROG_PKG_CONFIG | |
357 | if test x"$PKG_CONFIG" = "x"; then | |
358 | AC_MSG_ERROR(pkg-config not found.) | |
359 | fi | |
360 | ]) | |
361 | fi | |
362 | ||
b77b4eda LD |
363 | if test x$use_lcov = xyes; then |
364 | if test x$LCOV = x; then | |
35b8af92 CF |
365 | AC_MSG_ERROR("lcov testing requested but lcov not found") |
366 | fi | |
b77b4eda | 367 | if test x$GCOV = x; then |
35b8af92 CF |
368 | AC_MSG_ERROR("lcov testing requested but gcov not found") |
369 | fi | |
b77b4eda | 370 | if test x$GENHTML = x; then |
35b8af92 CF |
371 | AC_MSG_ERROR("lcov testing requested but genhtml not found") |
372 | fi | |
6ecb05dd JG |
373 | LCOV="$LCOV --gcov-tool=$GCOV --rc lcov_branch_coverage=1" |
374 | GENHTML="$GENHTML --branch-coverage" | |
35b8af92 CF |
375 | AX_CHECK_COMPILE_FLAG([--coverage],[CXXFLAGS="$CXXFLAGS --coverage"], |
376 | [AC_MSG_ERROR("lcov testing requested but --coverage flag does not work")]) | |
377 | fi | |
378 | ||
4414f5ff WL |
379 | dnl Check for endianness |
380 | AC_C_BIGENDIAN | |
35b8af92 CF |
381 | |
382 | dnl Check for pthread compile/link requirements | |
383 | AX_PTHREAD | |
35b8af92 CF |
384 | |
385 | # The following macro will add the necessary defines to bitcoin-config.h, but | |
386 | # they also need to be passed down to any subprojects. Pull the results out of | |
387 | # the cache and add them to CPPFLAGS. | |
388 | AC_SYS_LARGEFILE | |
a60838d0 WL |
389 | # detect POSIX or GNU variant of strerror_r |
390 | AC_FUNC_STRERROR_R | |
35b8af92 CF |
391 | |
392 | if test x$ac_cv_sys_file_offset_bits != x && | |
393 | test x$ac_cv_sys_file_offset_bits != xno && | |
394 | test x$ac_cv_sys_file_offset_bits != xunknown; then | |
395 | CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" | |
396 | fi | |
397 | ||
398 | if test x$ac_cv_sys_large_files != x && | |
399 | test x$ac_cv_sys_large_files != xno && | |
400 | test x$ac_cv_sys_large_files != xunknown; then | |
401 | CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files" | |
402 | fi | |
403 | ||
404 | AX_CHECK_LINK_FLAG([[-Wl,--large-address-aware]], [LDFLAGS="$LDFLAGS -Wl,--large-address-aware"]) | |
405 | ||
f36a40f7 CF |
406 | AX_GCC_FUNC_ATTRIBUTE([visibility]) |
407 | AX_GCC_FUNC_ATTRIBUTE([dllexport]) | |
408 | AX_GCC_FUNC_ATTRIBUTE([dllimport]) | |
409 | ||
d5aab704 CF |
410 | if test x$use_glibc_compat != xno; then |
411 | ||
d68e2111 CF |
412 | #glibc absorbed clock_gettime in 2.17. librt (its previous location) is safe to link |
413 | #in anyway for back-compat. | |
414 | AC_CHECK_LIB([rt],[clock_gettime],, AC_MSG_ERROR(lib missing)) | |
415 | ||
d5aab704 CF |
416 | #__fdelt_chk's params and return type have changed from long unsigned int to long int. |
417 | # See which one is present here. | |
418 | AC_MSG_CHECKING(__fdelt_chk type) | |
e2a98d27 | 419 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef _FORTIFY_SOURCE |
8021cf8d CF |
420 | #undef _FORTIFY_SOURCE |
421 | #endif | |
422 | #define _FORTIFY_SOURCE 2 | |
d5aab704 | 423 | #include <sys/select.h> |
e2a98d27 | 424 | extern "C" long unsigned int __fdelt_warn(long unsigned int);]],[[]])], |
d5aab704 CF |
425 | [ fdelt_type="long unsigned int"], |
426 | [ fdelt_type="long int"]) | |
427 | AC_MSG_RESULT($fdelt_type) | |
428 | AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk]) | |
d68e2111 CF |
429 | else |
430 | AC_SEARCH_LIBS([clock_gettime],[rt]) | |
d5aab704 CF |
431 | fi |
432 | ||
c459de2f CF |
433 | if test x$TARGET_OS != xwindows; then |
434 | # All windows code is PIC, forcing it on just adds useless compile warnings | |
435 | AX_CHECK_COMPILE_FLAG([-fPIC],[PIC_FLAGS="-fPIC"]) | |
436 | fi | |
437 | ||
35b8af92 | 438 | if test x$use_hardening != xno; then |
5d37904b | 439 | AX_CHECK_COMPILE_FLAG([-Wformat],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wformat"],[AC_MSG_ERROR(Cannot enable -Wformat)]) |
6dcb7067 | 440 | AX_CHECK_COMPILE_FLAG([-Wformat-security],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wformat-security"],[AC_MSG_ERROR(Cannot enable -Wformat-security)],[-Wformat]) |
b00b98ae TH |
441 | AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"],[AC_MSG_ERROR(Cannot enable -Wstack-protector)]) |
442 | AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"],[AC_MSG_ERROR(Cannot enable -fstack-protector-all)]) | |
35b8af92 | 443 | |
9b4e03b2 LD |
444 | AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[ |
445 | AX_CHECK_PREPROC_FLAG([-U_FORTIFY_SOURCE],[ | |
446 | HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -U_FORTIFY_SOURCE" | |
b00b98ae | 447 | ],[AC_MSG_ERROR(Cannot enable -U_FORTIFY_SOURCE)]) |
9b4e03b2 | 448 | HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -D_FORTIFY_SOURCE=2" |
b00b98ae | 449 | ],[AC_MSG_ERROR(Cannot enable -D_FORTIFY_SOURCE=2)]) |
35b8af92 | 450 | |
b00b98ae TH |
451 | AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)]) |
452 | AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)]) | |
35b8af92 CF |
453 | |
454 | if test x$TARGET_OS != xwindows; then | |
eccd5856 | 455 | # All windows code is PIC, forcing it on just adds useless compile warnings |
c459de2f | 456 | AX_CHECK_COMPILE_FLAG([-fPIE],[PIE_FLAGS="-fPIE"],[AC_MSG_ERROR(Cannot enable -fPIE)]) |
b00b98ae TH |
457 | AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],[AC_MSG_ERROR(Cannot enable -pie)]) |
458 | else | |
459 | # These are only available on Windows. | |
460 | AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"],[AC_MSG_ERROR(Cannot enable --dynamicbase)]) | |
461 | AX_CHECK_LINK_FLAG([[-Wl,--nxcompat]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"],[AC_MSG_ERROR(Cannot enable --nxcompat)]) | |
8a932154 | 462 | AX_CHECK_LINK_FLAG([[-Wl,--high-entropy-va]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--high-entropy-va"],[AC_MSG_ERROR(Cannot enable ASLR)]) |
35b8af92 CF |
463 | fi |
464 | ||
811a765b CF |
465 | case $host in |
466 | *mingw*) | |
467 | AC_CHECK_LIB([ssp], [main],, AC_MSG_ERROR(lib missing)) | |
468 | ;; | |
469 | esac | |
35b8af92 CF |
470 | fi |
471 | ||
472 | dnl this flag screws up non-darwin gcc even when the check fails. special-case it. | |
473 | if test x$TARGET_OS = xdarwin; then | |
474 | AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"]) | |
475 | fi | |
476 | ||
8ea6d37a | 477 | 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]) |
caf6150e HL |
478 | AC_SEARCH_LIBS([getaddrinfo_a], [anl], [AC_DEFINE(HAVE_GETADDRINFO_A, 1, [Define this symbol if you have getaddrinfo_a])]) |
479 | AC_SEARCH_LIBS([inet_pton], [nsl resolv], [AC_DEFINE(HAVE_INET_PTON, 1, [Define this symbol if you have inet_pton])]) | |
f2647cc0 | 480 | |
494f6e7d PJ |
481 | AC_CHECK_DECLS([strnlen]) |
482 | ||
4414f5ff | 483 | AC_CHECK_DECLS([le16toh, le32toh, le64toh, htole16, htole32, htole64, be16toh, be32toh, be64toh, htobe16, htobe32, htobe64],,, |
f2647cc0 CF |
484 | [#if HAVE_ENDIAN_H |
485 | #include <endian.h> | |
8ea6d37a AV |
486 | #elif HAVE_SYS_ENDIAN_H |
487 | #include <sys/endian.h> | |
f2647cc0 | 488 | #endif]) |
35b8af92 | 489 | |
4414f5ff WL |
490 | AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64],,, |
491 | [#if HAVE_BYTESWAP_H | |
492 | #include <byteswap.h> | |
493 | #endif]) | |
494 | ||
35b8af92 CF |
495 | dnl Check for MSG_NOSIGNAL |
496 | AC_MSG_CHECKING(for MSG_NOSIGNAL) | |
e2a98d27 | 497 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], |
498 | [[ int f = MSG_NOSIGNAL; ]])], | |
35b8af92 CF |
499 | [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MSG_NOSIGNAL, 1,[Define this symbol if you have MSG_NOSIGNAL]) ], |
500 | [ AC_MSG_RESULT(no)] | |
501 | ) | |
502 | ||
e432a5f0 CF |
503 | AC_MSG_CHECKING([for visibility attribute]) |
504 | AC_LINK_IFELSE([AC_LANG_SOURCE([ | |
505 | int foo_def( void ) __attribute__((visibility("default"))); | |
506 | int main(){} | |
507 | ])], | |
508 | [ | |
509 | AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE,1,[Define if the visibility attribute is supported.]) | |
510 | AC_MSG_RESULT(yes) | |
511 | ], | |
512 | [ | |
513 | AC_MSG_RESULT(no) | |
514 | if test x$use_reduce_exports = xyes; then | |
3448b132 | 515 | AC_MSG_ERROR([Cannot find a working visibility attribute. Use --disable-reduce-exports.]) |
e432a5f0 | 516 | fi |
e432a5f0 CF |
517 | ] |
518 | ) | |
519 | ||
3ee028f1 | 520 | if test x$use_reduce_exports = xyes; then |
e432a5f0 | 521 | AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[RE_CXXFLAGS="-fvisibility=hidden"], |
3448b132 | 522 | [AC_MSG_ERROR([Cannot set default symbol visibility. Use --disable-reduce-exports.])]) |
e432a5f0 CF |
523 | fi |
524 | ||
4a290b52 LD |
525 | LEVELDB_CPPFLAGS= |
526 | LIBLEVELDB= | |
527 | LIBMEMENV= | |
528 | AM_CONDITIONAL([EMBEDDED_LEVELDB],[true]) | |
529 | AC_SUBST(LEVELDB_CPPFLAGS) | |
530 | AC_SUBST(LIBLEVELDB) | |
531 | AC_SUBST(LIBMEMENV) | |
532 | ||
4f9e993b WL |
533 | if test x$enable_wallet != xno; then |
534 | dnl Check for libdb_cxx only if wallet enabled | |
9cb7abaf | 535 | BITCOIN_FIND_BDB62 |
4f9e993b | 536 | fi |
35b8af92 | 537 | |
99eb947a S |
538 | dnl Check Qpid Proton headers and library exist |
539 | if test x$use_proton = xyes; then | |
540 | AC_CHECK_HEADERS([proton/connection.hpp], | |
541 | [], | |
542 | [AC_MSG_WARN([Proton headers not found, disabling Proton support]) | |
543 | use_proton=no]) | |
544 | AC_CHECK_LIB([qpid-proton-cpp], [main], | |
545 | [PROTON_LIBS="-lqpid-proton-cpp -lqpid-proton"], | |
546 | [AC_MSG_WARN([Proton libraries not found, disabling Proton support]) | |
547 | use_proton=no]) | |
548 | fi | |
549 | if test x$use_proton = xyes; then | |
550 | AC_DEFINE(ENABLE_PROTON, 1, [Define to 1 to enable Proton functions]) | |
551 | else | |
552 | AC_DEFINE(ENABLE_PROTON, 0, [Define to 1 to enable Proton functions]) | |
553 | fi | |
554 | ||
38ba3c66 | 555 | if test x$build_bitcoin_utils$build_bitcoind$use_tests = xnonono; then |
b7a4ecc1 LD |
556 | use_boost=no |
557 | else | |
558 | use_boost=yes | |
559 | fi | |
560 | ||
561 | if test x$use_boost = xyes; then | |
562 | ||
35b8af92 | 563 | dnl Check for boost libs |
6df5f51b | 564 | dnl We need Boost >= 1.62 to fix a potential security bug (https://github.com/zcash/zcash/issues/1241) |
565 | AX_BOOST_BASE([1.62]) | |
35b8af92 CF |
566 | AX_BOOST_SYSTEM |
567 | AX_BOOST_FILESYSTEM | |
568 | AX_BOOST_PROGRAM_OPTIONS | |
569 | AX_BOOST_THREAD | |
570 | AX_BOOST_CHRONO | |
571 | ||
b7a4ecc1 LD |
572 | fi |
573 | ||
3ee028f1 | 574 | if test x$use_reduce_exports = xyes; then |
e432a5f0 CF |
575 | CXXFLAGS="$CXXFLAGS $RE_CXXFLAGS" |
576 | AX_CHECK_LINK_FLAG([[-Wl,--exclude-libs,ALL]], [RELDFLAGS="-Wl,--exclude-libs,ALL"]) | |
577 | fi | |
578 | ||
35b8af92 | 579 | if test x$use_tests = xyes; then |
152e51c7 CF |
580 | |
581 | if test x$HEXDUMP = x; then | |
582 | AC_MSG_ERROR(hexdump is required for tests) | |
583 | fi | |
584 | ||
585 | ||
b7a4ecc1 LD |
586 | if test x$use_boost = xyes; then |
587 | ||
35b8af92 | 588 | AX_BOOST_UNIT_TEST_FRAMEWORK |
e4b991e5 WL |
589 | |
590 | dnl Determine if -DBOOST_TEST_DYN_LINK is needed | |
591 | AC_MSG_CHECKING([for dynamic linked boost test]) | |
592 | TEMP_LIBS="$LIBS" | |
a7d1f035 | 593 | LIBS="$LIBS $BOOST_LDFLAGS $BOOST_UNIT_TEST_FRAMEWORK_LIB" |
e4b991e5 WL |
594 | TEMP_CPPFLAGS="$CPPFLAGS" |
595 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" | |
596 | AC_LINK_IFELSE([AC_LANG_SOURCE([ | |
597 | #define BOOST_TEST_DYN_LINK | |
598 | #define BOOST_TEST_MAIN | |
599 | #include <boost/test/unit_test.hpp> | |
600 | ||
601 | ])], | |
602 | [AC_MSG_RESULT(yes)] | |
603 | [TESTDEFS="$TESTDEFS -DBOOST_TEST_DYN_LINK"], | |
604 | [AC_MSG_RESULT(no)]) | |
605 | LIBS="$TEMP_LIBS" | |
606 | CPPFLAGS="$TEMP_CPPFLAGS" | |
b7a4ecc1 LD |
607 | |
608 | fi | |
35b8af92 CF |
609 | fi |
610 | ||
b7a4ecc1 | 611 | if test x$use_boost = xyes; then |
ca66717d | 612 | BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_PROGRAM_OPTIONS_LIB $BOOST_THREAD_LIB $BOOST_CHRONO_LIB" |
b7a4ecc1 | 613 | fi |
c8ba8ef6 | 614 | |
35b8af92 | 615 | if test x$use_pkgconfig = xyes; then |
d7002714 | 616 | : dnl |
35b8af92 CF |
617 | m4_ifdef( |
618 | [PKG_CHECK_MODULES], | |
619 | [ | |
6b099402 CF |
620 | PKG_CHECK_MODULES([SSL], [libssl],, [AC_MSG_ERROR(openssl not found.)]) |
621 | PKG_CHECK_MODULES([CRYPTO], [libcrypto],,[AC_MSG_ERROR(libcrypto not found.)]) | |
df377ca8 WL |
622 | if test x$build_bitcoin_utils$build_bitcoind$bitcoin_enable_qt$use_tests != xnononono; then |
623 | PKG_CHECK_MODULES([EVENT], [libevent],, [AC_MSG_ERROR(libevent not found.)]) | |
624 | if test x$TARGET_OS != xwindows; then | |
625 | PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads],, [AC_MSG_ERROR(libevent_pthreads not found.)]) | |
626 | fi | |
627 | fi | |
effe8a5f JC |
628 | |
629 | if test "x$use_zmq" = "xyes"; then | |
630 | PKG_CHECK_MODULES([ZMQ],[libzmq >= 4], | |
631 | [AC_DEFINE([ENABLE_ZMQ],[1],[Define to 1 to enable ZMQ functions])], | |
632 | [AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions]) | |
633 | AC_MSG_WARN([libzmq version 4.x or greater not found, disabling]) | |
634 | use_zmq=no]) | |
635 | else | |
636 | AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions]) | |
637 | fi | |
35b8af92 CF |
638 | ] |
639 | ) | |
640 | else | |
c4da0970 NW |
641 | # BUG: Fix this: |
642 | echo 'BUG: configure does not yet check for the following dependencies if pkg-config is not on the system: libcrypto++, libgmp' | |
643 | ||
35b8af92 | 644 | AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing)) |
6b099402 | 645 | AC_CHECK_LIB([crypto], [main],CRYPTO_LIBS=-lcrypto, AC_MSG_ERROR(libcrypto missing)) |
35b8af92 CF |
646 | |
647 | AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),) | |
6b099402 | 648 | AC_CHECK_LIB([ssl], [main],SSL_LIBS=-lssl, AC_MSG_ERROR(libssl missing)) |
35b8af92 | 649 | |
df377ca8 WL |
650 | if test x$build_bitcoin_utils$build_bitcoind$bitcoin_enable_qt$use_tests != xnononono; then |
651 | AC_CHECK_HEADER([event2/event.h],, AC_MSG_ERROR(libevent headers missing),) | |
652 | AC_CHECK_LIB([event],[main],EVENT_LIBS=-levent,AC_MSG_ERROR(libevent missing)) | |
653 | if test x$TARGET_OS != xwindows; then | |
654 | AC_CHECK_LIB([event_pthreads],[main],EVENT_PTHREADS_LIBS=-levent_pthreads,AC_MSG_ERROR(libevent_pthreads missing)) | |
655 | fi | |
656 | fi | |
657 | ||
effe8a5f JC |
658 | if test "x$use_zmq" = "xyes"; then |
659 | AC_CHECK_HEADER([zmq.h], | |
660 | [AC_DEFINE([ENABLE_ZMQ],[1],[Define to 1 to enable ZMQ functions])], | |
661 | [AC_MSG_WARN([zmq.h not found, disabling zmq support]) | |
662 | use_zmq=no | |
663 | AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])]) | |
664 | AC_CHECK_LIB([zmq],[zmq_ctx_shutdown],ZMQ_LIBS=-lzmq, | |
665 | [AC_MSG_WARN([libzmq >= 4.0 not found, disabling zmq support]) | |
666 | use_zmq=no | |
667 | AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])]) | |
668 | else | |
669 | AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions]) | |
670 | fi | |
671 | ||
00bcf223 | 672 | if test "x$use_zmq" = "xyes"; then |
673 | dnl Assume libzmq was built for static linking | |
674 | case $host in | |
675 | *mingw*) | |
676 | ZMQ_CFLAGS="$ZMQ_CFLAGS -DZMQ_STATIC" | |
677 | ;; | |
678 | esac | |
679 | fi | |
c8ba8ef6 | 680 | fi |
35b8af92 | 681 | |
c4da0970 NW |
682 | # These packages don't provide pkgconfig config files across all |
683 | # platforms, so we use older autoconf detection mechanisms: | |
684 | AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing)) | |
685 | AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)]) | |
686 | ||
687 | AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing)) | |
688 | AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)]) | |
689 | ||
802ea76b SB |
690 | RUST_LIBS="" |
691 | if test x$enable_rust != xno; then | |
692 | RUST_LIBS="-lrustzcash" | |
693 | fi | |
694 | ||
daad2c27 JG |
695 | dnl Check for OpenMP support |
696 | AX_OPENMP( | |
697 | [AC_DEFINE(HAVE_OPENMP, 1, [Define if OpenMP is enabled]) | |
698 | AM_CONDITIONAL([HAVE_OPENMP], [true]) | |
699 | CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"], | |
700 | [AC_MSG_WARN([OpenMP not supported, disabling multithreading]) | |
701 | AC_DEFINE(HAVE_OPENMP, 0, [Define if OpenMP is enabled]) | |
702 | AM_CONDITIONAL([HAVE_OPENMP], [false])]) | |
703 | ||
8f23c734 JG |
704 | # Gitian uses a config.site that sets depends_prefix, and then sets --prefix=/ |
705 | # build.sh just uses --prefix | |
706 | if test x$depends_prefix != x; then | |
707 | LIBSNARK_DEPINST="$depends_prefix" | |
708 | else | |
709 | LIBSNARK_DEPINST="$prefix" | |
710 | fi | |
711 | ||
daad2c27 | 712 | LIBZCASH_LIBS="-lgmp -lgmpxx -lboost_system-mt -lcrypto -lsodium $RUST_LIBS" |
c4da0970 | 713 | |
e18e1001 | 714 | AC_MSG_CHECKING([whether to build bitcoind]) |
f930341d LD |
715 | AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes]) |
716 | AC_MSG_RESULT($build_bitcoind) | |
717 | ||
66a89c08 | 718 | AC_MSG_CHECKING([whether to build utils (zcash-cli zcash-tx)]) |
c101c769 | 719 | AM_CONDITIONAL([BUILD_BITCOIN_UTILS], [test x$build_bitcoin_utils = xyes]) |
720 | AC_MSG_RESULT($build_bitcoin_utils) | |
f930341d | 721 | |
cdd36c6c CF |
722 | AC_MSG_CHECKING([whether to build libraries]) |
723 | AM_CONDITIONAL([BUILD_BITCOIN_LIBS], [test x$build_bitcoin_libs = xyes]) | |
724 | if test x$build_bitcoin_libs = xyes; then | |
725 | AC_DEFINE(HAVE_CONSENSUS_LIB, 1, [Define this symbol if the consensus lib has been built]) | |
08d6b02d | 726 | AC_CONFIG_FILES([libzcashconsensus.pc:libzcashconsensus.pc.in]) |
cdd36c6c | 727 | fi |
e463edc1 | 728 | |
cdd36c6c CF |
729 | AC_MSG_RESULT($build_bitcoin_libs) |
730 | ||
35b8af92 CF |
731 | AC_LANG_POP |
732 | ||
733 | if test "x$use_ccache" != "xno"; then | |
e18e1001 | 734 | AC_MSG_CHECKING(if ccache should be used) |
35b8af92 CF |
735 | if test x$CCACHE = x; then |
736 | if test "x$use_ccache" = "xyes"; then | |
737 | AC_MSG_ERROR([ccache not found.]); | |
738 | else | |
35b8af92 CF |
739 | use_ccache=no |
740 | fi | |
741 | else | |
742 | use_ccache=yes | |
743 | CC="$ac_cv_path_CCACHE $CC" | |
744 | CXX="$ac_cv_path_CCACHE $CXX" | |
745 | fi | |
746 | AC_MSG_RESULT($use_ccache) | |
747 | fi | |
386efb76 CF |
748 | if test "x$use_ccache" = "xyes"; then |
749 | AX_CHECK_PREPROC_FLAG([-Qunused-arguments],[CPPFLAGS="-Qunused-arguments $CPPFLAGS"]) | |
750 | fi | |
35b8af92 | 751 | |
4f9e993b WL |
752 | dnl enable wallet |
753 | AC_MSG_CHECKING([if wallet should be enabled]) | |
754 | if test x$enable_wallet != xno; then | |
755 | AC_MSG_RESULT(yes) | |
756 | AC_DEFINE_UNQUOTED([ENABLE_WALLET],[1],[Define to 1 to enable wallet functions]) | |
757 | ||
758 | else | |
759 | AC_MSG_RESULT(no) | |
4f9e993b WL |
760 | fi |
761 | ||
2cc0a252 JG |
762 | dnl enable mining |
763 | AC_MSG_CHECKING([if mining should be enabled]) | |
764 | if test x$enable_mining != xno; then | |
765 | AC_MSG_RESULT(yes) | |
766 | AC_DEFINE(ENABLE_MINING, 1, [Define to 1 to enable mining functions]) | |
767 | ||
768 | else | |
769 | AC_MSG_RESULT(no) | |
770 | fi | |
771 | ||
802ea76b SB |
772 | dnl enable rust |
773 | AC_MSG_CHECKING([if rust should be enabled]) | |
774 | if test x$enable_rust != xno; then | |
775 | AC_MSG_RESULT(yes) | |
776 | AC_DEFINE(ENABLE_RUST, 1, [Define to 1 to enable Rust language dependent functions]) | |
777 | ||
778 | else | |
779 | AC_MSG_RESULT(no) | |
780 | fi | |
781 | ||
f200002c JG |
782 | AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"]) |
783 | ||
99eb947a S |
784 | AM_CONDITIONAL([ENABLE_PROTON], [test "x$use_proton" = "xyes"]) |
785 | ||
e18e1001 | 786 | AC_MSG_CHECKING([whether to build test_bitcoin]) |
35b8af92 | 787 | if test x$use_tests = xyes; then |
e18e1001 | 788 | AC_MSG_RESULT([yes]) |
2762638a | 789 | BUILD_TEST="yes" |
e18e1001 LD |
790 | else |
791 | AC_MSG_RESULT([no]) | |
2762638a | 792 | BUILD_TEST="" |
35b8af92 CF |
793 | fi |
794 | ||
e432a5f0 | 795 | AC_MSG_CHECKING([whether to reduce exports]) |
3ee028f1 | 796 | if test x$use_reduce_exports = xyes; then |
e432a5f0 CF |
797 | AC_MSG_RESULT([yes]) |
798 | else | |
799 | AC_MSG_RESULT([no]) | |
800 | fi | |
801 | ||
38ba3c66 | 802 | if test x$build_bitcoin_utils$build_bitcoin_libs$build_bitcoind$use_tests = xnononono; then |
abecfc42 | 803 | AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon or --enable-tests]) |
a9dbcf03 LD |
804 | fi |
805 | ||
35b8af92 | 806 | AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin]) |
b62bbb1f | 807 | AM_CONDITIONAL([BUILD_DARWIN], [test x$BUILD_OS = xdarwin]) |
35b8af92 | 808 | AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows]) |
b77b4eda | 809 | AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes]) |
2cc0a252 | 810 | AM_CONDITIONAL([ENABLE_MINING],[test x$enable_mining = xyes]) |
802ea76b | 811 | AM_CONDITIONAL([ENABLE_RUST],[test x$enable_rust = xyes]) |
2762638a | 812 | AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes]) |
b77b4eda | 813 | AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes]) |
d5aab704 | 814 | AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes]) |
56734f4b | 815 | AM_CONDITIONAL([HARDEN],[test x$use_hardening = xyes]) |
35b8af92 CF |
816 | |
817 | AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version]) | |
818 | AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version]) | |
819 | AC_DEFINE(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION, [Build revision]) | |
820 | AC_DEFINE(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD, [Version Build]) | |
821 | AC_DEFINE(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE, [Version is release]) | |
822 | AC_DEFINE(COPYRIGHT_YEAR, _COPYRIGHT_YEAR, [Version is release]) | |
823 | AC_SUBST(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR) | |
824 | AC_SUBST(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR) | |
825 | AC_SUBST(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION) | |
826 | AC_SUBST(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD) | |
827 | AC_SUBST(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE) | |
828 | AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR) | |
c5d645e2 CF |
829 | AC_SUBST(BITCOIN_DAEMON_NAME) |
830 | AC_SUBST(BITCOIN_CLI_NAME) | |
831 | AC_SUBST(BITCOIN_TX_NAME) | |
35b8af92 | 832 | |
e432a5f0 | 833 | AC_SUBST(RELDFLAGS) |
5dd887fd | 834 | AC_SUBST(ERROR_CXXFLAGS) |
c459de2f CF |
835 | AC_SUBST(HARDENED_CXXFLAGS) |
836 | AC_SUBST(HARDENED_CPPFLAGS) | |
837 | AC_SUBST(HARDENED_LDFLAGS) | |
838 | AC_SUBST(PIC_FLAGS) | |
839 | AC_SUBST(PIE_FLAGS) | |
e0077de5 | 840 | AC_SUBST(LIBTOOL_APP_LDFLAGS) |
35b8af92 | 841 | AC_SUBST(BOOST_LIBS) |
35b8af92 CF |
842 | AC_SUBST(TESTDEFS) |
843 | AC_SUBST(LEVELDB_TARGET_FLAGS) | |
d7002714 CF |
844 | AC_SUBST(CRYPTO_LIBS) |
845 | AC_SUBST(SSL_LIBS) | |
846 | AC_SUBST(EVENT_LIBS) | |
847 | AC_SUBST(EVENT_PTHREADS_LIBS) | |
848 | AC_SUBST(ZMQ_LIBS) | |
c4da0970 NW |
849 | AC_SUBST(GMP_LIBS) |
850 | AC_SUBST(GMPXX_LIBS) | |
8f23c734 | 851 | AC_SUBST(LIBSNARK_DEPINST) |
1785bdb9 | 852 | AC_SUBST(LIBZCASH_LIBS) |
99eb947a | 853 | AC_SUBST(PROTON_LIBS) |
38ba3c66 | 854 | AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi src/test/buildenv.py]) |
35b8af92 | 855 | AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh]) |
7667850d | 856 | AC_CONFIG_FILES([qa/pull-tester/tests-config.sh],[chmod +x qa/pull-tester/tests-config.sh]) |
07a99017 PW |
857 | |
858 | dnl boost's m4 checks do something really nasty: they export these vars. As a | |
859 | dnl result, they leak into secp256k1's configure and crazy things happen. | |
860 | dnl Until this is fixed upstream and we've synced, we'll just un-export them. | |
0dc86138 | 861 | CPPFLAGS_TEMP="$CPPFLAGS" |
cf61b544 | 862 | unset CPPFLAGS |
0dc86138 CF |
863 | CPPFLAGS="$CPPFLAGS_TEMP" |
864 | ||
865 | LDFLAGS_TEMP="$LDFLAGS" | |
cf61b544 | 866 | unset LDFLAGS |
0dc86138 CF |
867 | LDFLAGS="$LDFLAGS_TEMP" |
868 | ||
869 | LIBS_TEMP="$LIBS" | |
870 | unset LIBS | |
871 | LIBS="$LIBS_TEMP" | |
872 | ||
873 | PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH" | |
874 | unset PKG_CONFIG_PATH | |
875 | PKG_CONFIG_PATH="$PKGCONFIG_PATH_TEMP" | |
876 | ||
877 | PKGCONFIG_LIBDIR_TEMP="$PKG_CONFIG_LIBDIR" | |
878 | unset PKG_CONFIG_LIBDIR | |
879 | PKG_CONFIG_LIBDIR="$PKGCONFIG_LIBDIR_TEMP" | |
880 | ||
c1afe40a | 881 | ac_configure_args="${ac_configure_args} --disable-shared --with-pic --with-bignum=no --enable-module-recovery" |
26a8f68e | 882 | AC_CONFIG_SUBDIRS([src/secp256k1 src/snark src/univalue]) |
07a99017 | 883 | |
35b8af92 | 884 | AC_OUTPUT |
a98356fe CF |
885 | |
886 | dnl Taken from https://wiki.debian.org/RpathIssue | |
887 | case $host in | |
888 | *-*-linux-gnu) | |
889 | AC_MSG_RESULT([Fixing libtool for -rpath problems.]) | |
890 | sed < libtool > libtool-2 \ | |
891 | 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/' | |
892 | mv libtool-2 libtool | |
893 | chmod 755 libtool | |
894 | ;; | |
895 | esac | |
0bcd85be JS |
896 | |
897 | echo | |
898 | echo "Options used to compile and link:" | |
899 | echo " with wallet = $enable_wallet" | |
900 | echo " with zmq = $use_zmq" | |
901 | echo " with test = $use_tests" | |
902 | echo " debug enabled = $enable_debug" | |
5dd887fd | 903 | echo " werror = $enable_werror" |
0bcd85be JS |
904 | echo |
905 | echo " target os = $TARGET_OS" | |
906 | echo " build os = $BUILD_OS" | |
907 | echo | |
908 | echo " CC = $CC" | |
909 | echo " CFLAGS = $CFLAGS" | |
910 | echo " CPPFLAGS = $CPPFLAGS" | |
911 | echo " CXX = $CXX" | |
912 | echo " CXXFLAGS = $CXXFLAGS" | |
913 | echo " LDFLAGS = $LDFLAGS" | |
914 | echo |