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