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