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