]>
Commit | Line | Data |
---|---|---|
35b8af92 CF |
1 | dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) |
2 | AC_PREREQ([2.60]) | |
3 | define(_CLIENT_VERSION_MAJOR, 0) | |
f9a2f088 | 4 | define(_CLIENT_VERSION_MINOR, 9) |
ad6ae489 | 5 | define(_CLIENT_VERSION_REVISION, 99) |
35b8af92 | 6 | define(_CLIENT_VERSION_BUILD, 0) |
ad6ae489 | 7 | define(_CLIENT_VERSION_IS_RELEASE, false) |
5bab5589 | 8 | define(_COPYRIGHT_YEAR, 2014) |
fe14e8d7 | 9 | AC_INIT([Bitcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[[email protected]],[bitcoin]) |
35b8af92 CF |
10 | AC_CONFIG_AUX_DIR([src/build-aux]) |
11 | AC_CONFIG_MACRO_DIR([src/m4]) | |
12 | AC_CANONICAL_HOST | |
13 | AH_TOP([#ifndef BITCOIN_CONFIG_H]) | |
14 | AH_TOP([#define BITCOIN_CONFIG_H]) | |
15 | AH_BOTTOM([#endif //BITCOIN_CONFIG_H]) | |
16 | ||
17 | # This m4 will only be used if a system copy cannot be found. This is helpful | |
18 | # on systems where autotools are installed but the pkg-config macros are not in | |
19 | # a default location. It is currently used for building on OSX where autotools | |
20 | # are preinstalled but pkg-config comes from macports or homebrew. It should | |
21 | # probably be removed when building on <= 10.6 is no longer supported. | |
22 | m4_include([pkg.m4]) | |
23 | ||
35b8af92 CF |
24 | dnl faketime breaks configure and is only needed for make. Disable it here. |
25 | unset FAKETIME | |
26 | ||
123e4f87 LD |
27 | if test "x${CXXFLAGS+set}" = "xset"; then |
28 | CXXFLAGS_overridden=yes | |
29 | else | |
30 | CXXFLAGS_overridden=no | |
31 | fi | |
32 | ||
35b8af92 CF |
33 | dnl ============================================================== |
34 | dnl Setup for automake | |
35 | dnl ============================================================== | |
36 | ||
37 | AM_INIT_AUTOMAKE([no-define subdir-objects foreign]) | |
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 | ||
4f9e993b WL |
46 | # Enable wallet |
47 | AC_ARG_ENABLE([wallet], | |
48 | [AS_HELP_STRING([--enable-wallet], | |
49 | [enable wallet (default is yes)])], | |
50 | [enable_wallet=$enableval], | |
51 | [enable_wallet=yes]) | |
52 | ||
35b8af92 CF |
53 | AC_ARG_WITH([miniupnpc], |
54 | [AS_HELP_STRING([--with-miniupnpc], | |
55 | [enable UPNP (default is yes if libminiupnpc is found)])], | |
56 | [use_upnp=$withval], | |
57 | [use_upnp=auto]) | |
58 | ||
59 | AC_ARG_ENABLE([upnp-default], | |
60 | [AS_HELP_STRING([--enable-upnp-default], | |
61 | [if UPNP is enabled, turn it on at startup (default is no)])], | |
62 | [use_upnp_default=$enableval], | |
63 | [use_upnp_default=no]) | |
64 | ||
35b8af92 CF |
65 | AC_ARG_ENABLE(tests, |
66 | AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]), | |
67 | [use_tests=$enableval], | |
68 | [use_tests=yes]) | |
69 | ||
70 | AC_ARG_WITH([comparison-tool], | |
47b9374e | 71 | AS_HELP_STRING([--with-comparison-tool],[path to java comparison tool (requires --enable-tests)]), |
35b8af92 CF |
72 | [use_comparison_tool=$withval], |
73 | [use_comparison_tool=no]) | |
74 | ||
47b9374e MC |
75 | AC_ARG_ENABLE([comparison-tool-reorg-tests], |
76 | AS_HELP_STRING([--enable-comparison-tool-reorg-tests],[enable expensive reorg tests in the comparison tool (default no)]), | |
77 | [use_comparison_tool_reorg_tests=$enableval], | |
78 | [use_comparison_tool_reorg_tests=no]) | |
79 | ||
35b8af92 CF |
80 | AC_ARG_WITH([qrencode], |
81 | [AS_HELP_STRING([--with-qrencode], | |
82 | [enable QR code support (default is yes if qt is enabled and libqrencode is found)])], | |
83 | [use_qr=$withval], | |
84 | [use_qr=auto]) | |
85 | ||
35b8af92 CF |
86 | AC_ARG_ENABLE([hardening], |
87 | [AS_HELP_STRING([--enable-hardening], | |
88 | [attempt to harden the resulting executables (default is yes)])], | |
89 | [use_hardening=$enableval], | |
90 | [use_hardening=yes]) | |
91 | ||
92 | AC_ARG_ENABLE([ccache], | |
93 | [AS_HELP_STRING([--enable-ccache], | |
e18e1001 | 94 | [use ccache for building (default is yes if ccache is found)])], |
35b8af92 CF |
95 | [use_ccache=$enableval], |
96 | [use_ccache=auto]) | |
97 | ||
98 | AC_ARG_ENABLE([lcov], | |
99 | [AS_HELP_STRING([--enable-lcov], | |
100 | [enable lcov testing (default is no)])], | |
101 | [use_lcov=yes], | |
102 | [use_lcov=no]) | |
103 | ||
d5aab704 CF |
104 | AC_ARG_ENABLE([glibc-back-compat], |
105 | [AS_HELP_STRING([--enable-glibc-back-compat], | |
106 | [enable backwards compatibility with glibc and libstdc++])], | |
107 | [use_glibc_compat=$enableval], | |
108 | [use_glibc_compat=no]) | |
109 | ||
35b8af92 CF |
110 | AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], []) |
111 | ||
112 | ||
113 | AC_CONFIG_SRCDIR([src]) | |
114 | AC_CONFIG_HEADERS([src/bitcoin-config.h]) | |
115 | ||
116 | dnl Checks for programs. | |
117 | AC_PROG_CXX | |
118 | AC_PROG_CC | |
119 | AC_PROG_CPP | |
941dba17 | 120 | AC_PROG_CXXCPP |
35b8af92 CF |
121 | AC_PROG_INSTALL |
122 | AC_PROG_OBJC | |
01e5327c | 123 | AC_PROG_LN_S |
35b8af92 CF |
124 | m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX]) |
125 | AC_PROG_MKDIR_P | |
126 | AC_PROG_SED | |
127 | AC_PATH_TOOL(AR, ar) | |
128 | AC_PATH_TOOL(RANLIB, ranlib) | |
35b8af92 CF |
129 | AC_PATH_TOOL(STRIP, strip) |
130 | AC_PATH_TOOL(GCOV, gcov) | |
131 | AC_PATH_PROG(LCOV, lcov) | |
132 | AC_PATH_PROG(JAVA, java) | |
133 | AC_PATH_PROG(GENHTML, genhtml) | |
134 | AC_PATH_PROG([GIT], [git]) | |
35b8af92 | 135 | AC_PATH_PROG(CCACHE,ccache) |
035ddf6f | 136 | AC_PATH_PROG(XGETTEXT,xgettext) |
152e51c7 | 137 | AC_PATH_PROG(HEXDUMP,hexdump) |
35b8af92 CF |
138 | PKG_PROG_PKG_CONFIG |
139 | ||
f5f157b8 | 140 | # Enable debug |
141 | AC_ARG_ENABLE([debug], | |
142 | [AS_HELP_STRING([--enable-debug], | |
143 | [use debug compiler flags and macros (default is no)])], | |
144 | [enable_debug=$enableval], | |
145 | [enable_debug=no]) | |
146 | ||
147 | if test "x$enable_debug" = xyes; then | |
148 | if test "x$GCC" = xyes; then | |
149 | CFLAGS="-g3 -O0 -DDEBUG" | |
150 | fi | |
151 | ||
152 | if test "x$GXX" = xyes; then | |
153 | CXXFLAGS="-g3 -O0 -DDEBUG" | |
154 | fi | |
155 | fi | |
156 | ||
35b8af92 CF |
157 | ## TODO: Remove these hard-coded paths and flags. They are here for the sake of |
158 | ## compatibility with the legacy buildsystem. | |
159 | ## | |
123e4f87 LD |
160 | if test "x$CXXFLAGS_overridden" = "xno"; then |
161 | CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter" | |
162 | fi | |
51ed9ec9 | 163 | CPPFLAGS="$CPPFLAGS -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS" |
35b8af92 CF |
164 | |
165 | AC_LANG_PUSH([C++]) | |
166 | ||
167 | use_pkgconfig=yes | |
168 | case $host in | |
169 | *mingw*) | |
170 | ||
96b9603c | 171 | #pkgconfig does more harm than good with MinGW |
35b8af92 CF |
172 | use_pkgconfig=no |
173 | ||
174 | TARGET_OS=windows | |
175 | AC_CHECK_LIB([mingwthrd], [main],, AC_MSG_ERROR(lib missing)) | |
176 | AC_CHECK_LIB([kernel32], [main],, AC_MSG_ERROR(lib missing)) | |
177 | AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(lib missing)) | |
178 | AC_CHECK_LIB([gdi32], [main],, AC_MSG_ERROR(lib missing)) | |
179 | AC_CHECK_LIB([comdlg32], [main],, AC_MSG_ERROR(lib missing)) | |
180 | AC_CHECK_LIB([winspool], [main],, AC_MSG_ERROR(lib missing)) | |
181 | AC_CHECK_LIB([winmm], [main],, AC_MSG_ERROR(lib missing)) | |
182 | AC_CHECK_LIB([shell32], [main],, AC_MSG_ERROR(lib missing)) | |
183 | AC_CHECK_LIB([comctl32], [main],, AC_MSG_ERROR(lib missing)) | |
184 | AC_CHECK_LIB([ole32], [main],, AC_MSG_ERROR(lib missing)) | |
185 | AC_CHECK_LIB([oleaut32], [main],, AC_MSG_ERROR(lib missing)) | |
186 | AC_CHECK_LIB([uuid], [main],, AC_MSG_ERROR(lib missing)) | |
187 | AC_CHECK_LIB([rpcrt4], [main],, AC_MSG_ERROR(lib missing)) | |
188 | AC_CHECK_LIB([advapi32], [main],, AC_MSG_ERROR(lib missing)) | |
189 | AC_CHECK_LIB([ws2_32], [main],, AC_MSG_ERROR(lib missing)) | |
190 | AC_CHECK_LIB([mswsock], [main],, AC_MSG_ERROR(lib missing)) | |
191 | AC_CHECK_LIB([shlwapi], [main],, AC_MSG_ERROR(lib missing)) | |
192 | AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(lib missing)) | |
c589f5f2 CF |
193 | AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(lib missing)) |
194 | ||
6ac0b3be | 195 | AX_CHECK_LINK_FLAG([[-static]],[LDFLAGS="$LDFLAGS -static"]) |
c589f5f2 CF |
196 | AX_CHECK_LINK_FLAG([[-static-libgcc]],[LDFLAGS="$LDFLAGS -static-libgcc"]) |
197 | AX_CHECK_LINK_FLAG([[-static-libstdc++]],[LDFLAGS="$LDFLAGS -static-libstdc++"]) | |
35b8af92 CF |
198 | |
199 | AC_PATH_PROG([MAKENSIS], [makensis], none) | |
200 | if test x$MAKENSIS = xnone; then | |
201 | AC_MSG_WARN("makensis not found. Cannot create installer.") | |
202 | fi | |
203 | ||
5ceb9c96 CF |
204 | AC_PATH_TOOL(WINDRES, windres, none) |
205 | if test x$WINDRES = xnone; then | |
206 | AC_MSG_ERROR("windres not found") | |
207 | fi | |
208 | ||
b77dfdc9 | 209 | CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB" |
35b8af92 | 210 | LEVELDB_TARGET_FLAGS="TARGET_OS=OS_WINDOWS_CROSSCOMPILE" |
123e4f87 LD |
211 | if test "x$CXXFLAGS_overridden" = "xno"; then |
212 | CXXFLAGS="$CXXFLAGS -w" | |
213 | fi | |
2f87b38e WL |
214 | case $host in |
215 | i?86-*) WINDOWS_BITS=32 ;; | |
216 | x86_64-*) WINDOWS_BITS=64 ;; | |
217 | *) AC_MSG_ERROR("Could not determine win32/win64 for installer") ;; | |
218 | esac | |
219 | AC_SUBST(WINDOWS_BITS) | |
35b8af92 CF |
220 | ;; |
221 | *darwin*) | |
222 | TARGET_OS=darwin | |
223 | LEVELDB_TARGET_FLAGS="TARGET_OS=Darwin" | |
224 | if test x$cross_compiling != xyes; then | |
b62bbb1f | 225 | BUILD_OS=darwin |
35b8af92 CF |
226 | AC_CHECK_PROG([PORT],port, port) |
227 | if test x$PORT = xport; then | |
228 | dnl add default macports paths | |
2691cbc4 | 229 | CPPFLAGS="$CPPFLAGS -isystem /opt/local/include -I/opt/local/include/db48" |
35b8af92 CF |
230 | LIBS="$LIBS -L/opt/local/lib -L/opt/local/lib/db48" |
231 | fi | |
232 | ||
233 | AC_CHECK_PROG([BREW],brew, brew) | |
234 | if test x$BREW = xbrew; then | |
235 | dnl add default homebrew paths | |
236 | openssl_prefix=`$BREW --prefix openssl` | |
237 | bdb_prefix=`$BREW --prefix berkeley-db4` | |
238 | export PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" | |
239 | CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include" | |
c89d59c3 | 240 | LIBS="$LIBS -L$bdb_prefix/lib" |
35b8af92 | 241 | fi |
b62bbb1f CF |
242 | else |
243 | case $build_os in | |
244 | *darwin*) | |
245 | BUILD_OS=darwin | |
246 | ;; | |
247 | *) | |
248 | AC_PATH_TOOL([INSTALLNAMETOOL], [install_name_tool], install_name_tool) | |
249 | AC_PATH_TOOL([OTOOL], [otool], otool) | |
250 | AC_PATH_PROGS([GENISOIMAGE], [genisoimage mkisofs],genisoimage) | |
251 | ;; | |
252 | esac | |
35b8af92 CF |
253 | fi |
254 | ||
35b8af92 | 255 | CPPFLAGS="$CPPFLAGS -DMAC_OSX" |
35b8af92 CF |
256 | ;; |
257 | *) | |
35b8af92 CF |
258 | ;; |
259 | esac | |
260 | ||
35b8af92 CF |
261 | if test x$use_comparison_tool != xno; then |
262 | AC_SUBST(JAVA_COMPARISON_TOOL, $use_comparison_tool) | |
263 | fi | |
264 | ||
47b9374e MC |
265 | if test x$use_comparison_tool_reorg_tests != xno; then |
266 | if test x$use_comparison_tool == x; then | |
267 | AC_MSG_ERROR("comparison tool reorg tests but comparison tool was not specified") | |
268 | fi | |
269 | AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 1) | |
270 | else | |
271 | AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 0) | |
272 | fi | |
273 | ||
35b8af92 CF |
274 | if test x$use_lcov == xyes; then |
275 | if test x$LCOV == x; then | |
276 | AC_MSG_ERROR("lcov testing requested but lcov not found") | |
277 | fi | |
278 | if test x$GCOV == x; then | |
279 | AC_MSG_ERROR("lcov testing requested but gcov not found") | |
280 | fi | |
281 | if test x$JAVA == x; then | |
282 | AC_MSG_ERROR("lcov testing requested but java not found") | |
283 | fi | |
284 | if test x$GENHTML == x; then | |
285 | AC_MSG_ERROR("lcov testing requested but genhtml not found") | |
286 | fi | |
287 | if test x$use_comparison_tool == x; then | |
288 | AC_MSG_ERROR("lcov testing requested but comparison tool was not specified") | |
289 | fi | |
290 | LCOV="$LCOV --gcov-tool=$GCOV" | |
291 | AX_CHECK_COMPILE_FLAG([--coverage],[CXXFLAGS="$CXXFLAGS --coverage"], | |
292 | [AC_MSG_ERROR("lcov testing requested but --coverage flag does not work")]) | |
293 | fi | |
294 | ||
295 | dnl Require little endian | |
296 | AC_C_BIGENDIAN([AC_MSG_ERROR("Big Endian not supported")]) | |
297 | ||
298 | dnl Check for pthread compile/link requirements | |
299 | AX_PTHREAD | |
300 | INCLUDES="$INCLUDES $PTHREAD_CFLAGS" | |
301 | ||
302 | # The following macro will add the necessary defines to bitcoin-config.h, but | |
303 | # they also need to be passed down to any subprojects. Pull the results out of | |
304 | # the cache and add them to CPPFLAGS. | |
305 | AC_SYS_LARGEFILE | |
a60838d0 WL |
306 | # detect POSIX or GNU variant of strerror_r |
307 | AC_FUNC_STRERROR_R | |
35b8af92 CF |
308 | |
309 | if test x$ac_cv_sys_file_offset_bits != x && | |
310 | test x$ac_cv_sys_file_offset_bits != xno && | |
311 | test x$ac_cv_sys_file_offset_bits != xunknown; then | |
312 | CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" | |
313 | fi | |
314 | ||
315 | if test x$ac_cv_sys_large_files != x && | |
316 | test x$ac_cv_sys_large_files != xno && | |
317 | test x$ac_cv_sys_large_files != xunknown; then | |
318 | CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files" | |
319 | fi | |
320 | ||
321 | AX_CHECK_LINK_FLAG([[-Wl,--large-address-aware]], [LDFLAGS="$LDFLAGS -Wl,--large-address-aware"]) | |
322 | ||
d5aab704 CF |
323 | if test x$use_glibc_compat != xno; then |
324 | ||
325 | #__fdelt_chk's params and return type have changed from long unsigned int to long int. | |
326 | # See which one is present here. | |
327 | AC_MSG_CHECKING(__fdelt_chk type) | |
328 | AC_TRY_COMPILE([#define __USE_FORTIFY_LEVEL 2 | |
329 | #include <sys/select.h> | |
330 | extern "C" long unsigned int __fdelt_warn(long unsigned int);],[], | |
331 | [ fdelt_type="long unsigned int"], | |
332 | [ fdelt_type="long int"]) | |
333 | AC_MSG_RESULT($fdelt_type) | |
334 | AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk]) | |
335 | ||
336 | fi | |
337 | ||
35b8af92 CF |
338 | if test x$use_hardening != xno; then |
339 | AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"]) | |
4e57e238 | 340 | AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"]) |
35b8af92 CF |
341 | AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"]) |
342 | ||
9b4e03b2 LD |
343 | AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[ |
344 | AX_CHECK_PREPROC_FLAG([-U_FORTIFY_SOURCE],[ | |
345 | HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -U_FORTIFY_SOURCE" | |
346 | ]) | |
347 | HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -D_FORTIFY_SOURCE=2" | |
348 | ]) | |
35b8af92 CF |
349 | |
350 | AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"]) | |
351 | AX_CHECK_LINK_FLAG([[-Wl,--nxcompat]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"]) | |
505867ac MM |
352 | AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"]) |
353 | AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"]) | |
35b8af92 CF |
354 | |
355 | if test x$TARGET_OS != xwindows; then | |
96b9603c | 356 | # -pie will link successfully with MinGW, but it's unsupported and leads to undeterministic binaries |
35b8af92 CF |
357 | AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"]) |
358 | fi | |
359 | ||
360 | CXXFLAGS="$CXXFLAGS $HARDENED_CXXFLAGS" | |
361 | CPPFLAGS="$CPPFLAGS $HARDENED_CPPFLAGS" | |
362 | LDFLAGS="$LDFLAGS $HARDENED_LDFLAGS" | |
363 | OBJCXXFLAGS="$CXXFLAGS" | |
364 | fi | |
365 | ||
366 | dnl this flag screws up non-darwin gcc even when the check fails. special-case it. | |
367 | if test x$TARGET_OS = xdarwin; then | |
368 | AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"]) | |
369 | fi | |
370 | ||
371 | AC_CHECK_HEADERS([stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h]) | |
372 | ||
373 | dnl Check for MSG_NOSIGNAL | |
374 | AC_MSG_CHECKING(for MSG_NOSIGNAL) | |
375 | AC_TRY_COMPILE([#include <sys/socket.h>], | |
376 | [ int f = MSG_NOSIGNAL; ], | |
377 | [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MSG_NOSIGNAL, 1,[Define this symbol if you have MSG_NOSIGNAL]) ], | |
378 | [ AC_MSG_RESULT(no)] | |
379 | ) | |
380 | ||
4a290b52 LD |
381 | LEVELDB_CPPFLAGS= |
382 | LIBLEVELDB= | |
383 | LIBMEMENV= | |
384 | AM_CONDITIONAL([EMBEDDED_LEVELDB],[true]) | |
385 | AC_SUBST(LEVELDB_CPPFLAGS) | |
386 | AC_SUBST(LIBLEVELDB) | |
387 | AC_SUBST(LIBMEMENV) | |
388 | ||
4f9e993b WL |
389 | if test x$enable_wallet != xno; then |
390 | dnl Check for libdb_cxx only if wallet enabled | |
391 | BITCOIN_FIND_BDB48 | |
392 | fi | |
35b8af92 CF |
393 | |
394 | dnl Check for libminiupnpc (optional) | |
395 | if test x$use_upnp != xno; then | |
a26a3676 JT |
396 | AC_CHECK_HEADERS( |
397 | [miniupnpc/miniwget.h miniupnpc/miniupnpc.h miniupnpc/upnpcommands.h miniupnpc/upnperrors.h], | |
398 | [AC_CHECK_LIB([miniupnpc], [main],, [have_miniupnpc=no])], | |
399 | [have_miniupnpc=no] | |
400 | ) | |
35b8af92 CF |
401 | fi |
402 | ||
403 | dnl Check for boost libs | |
404 | AX_BOOST_BASE | |
405 | AX_BOOST_SYSTEM | |
406 | AX_BOOST_FILESYSTEM | |
407 | AX_BOOST_PROGRAM_OPTIONS | |
408 | AX_BOOST_THREAD | |
409 | AX_BOOST_CHRONO | |
410 | ||
411 | if test x$use_tests = xyes; then | |
152e51c7 CF |
412 | |
413 | if test x$HEXDUMP = x; then | |
414 | AC_MSG_ERROR(hexdump is required for tests) | |
415 | fi | |
416 | ||
417 | ||
35b8af92 | 418 | AX_BOOST_UNIT_TEST_FRAMEWORK |
e4b991e5 WL |
419 | |
420 | dnl Determine if -DBOOST_TEST_DYN_LINK is needed | |
421 | AC_MSG_CHECKING([for dynamic linked boost test]) | |
422 | TEMP_LIBS="$LIBS" | |
423 | LIBS="$LIBS $BOOST_UNIT_TEST_FRAMEWORK_LIB" | |
424 | TEMP_CPPFLAGS="$CPPFLAGS" | |
425 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" | |
426 | AC_LINK_IFELSE([AC_LANG_SOURCE([ | |
427 | #define BOOST_TEST_DYN_LINK | |
428 | #define BOOST_TEST_MAIN | |
429 | #include <boost/test/unit_test.hpp> | |
430 | ||
431 | ])], | |
432 | [AC_MSG_RESULT(yes)] | |
433 | [TESTDEFS="$TESTDEFS -DBOOST_TEST_DYN_LINK"], | |
434 | [AC_MSG_RESULT(no)]) | |
435 | LIBS="$TEMP_LIBS" | |
436 | CPPFLAGS="$TEMP_CPPFLAGS" | |
35b8af92 CF |
437 | fi |
438 | ||
439 | BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_PROGRAM_OPTIONS_LIB $BOOST_THREAD_LIB" | |
440 | BOOST_INCLUDES="$BOOST_CPPFLAGS" | |
441 | ||
442 | dnl Boost >= 1.50 uses sleep_for rather than the now-deprecated sleep, however | |
443 | dnl it was broken from 1.50 to 1.52 when backed by nanosleep. Use sleep_for if | |
444 | dnl a working version is available, else fall back to sleep. sleep was removed | |
445 | dnl after 1.56. | |
446 | dnl If neither is available, abort. | |
447 | dnl If sleep_for is used, boost_chrono becomes a requirement. | |
448 | if test x$ax_cv_boost_chrono = xyes; then | |
0d40f5a6 WL |
449 | dnl Allow passing extra needed dependency libraries for boost-chrono from static gitian build |
450 | BOOST_CHRONO_LIB="$BOOST_CHRONO_LIB $BOOST_CHRONO_EXTRALIBS" | |
451 | ||
35b8af92 CF |
452 | TEMP_LIBS="$LIBS" |
453 | LIBS="$LIBS $BOOST_LIBS $BOOST_CHRONO_LIB" | |
714cdecb WL |
454 | TEMP_CPPFLAGS="$CPPFLAGS" |
455 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" | |
35b8af92 CF |
456 | AC_TRY_LINK([ |
457 | #include <boost/thread/thread.hpp> | |
458 | #include <boost/version.hpp> | |
459 | ],[ | |
460 | #if BOOST_VERSION >= 105000 && (!defined(BOOST_HAS_NANOSLEEP) || BOOST_VERSION >= 105200) | |
461 | boost::this_thread::sleep_for(boost::chrono::milliseconds(0)); | |
462 | #else | |
463 | choke me | |
464 | #endif | |
465 | ], | |
466 | [boost_sleep=yes; BOOST_LIBS="$BOOST_LIBS $BOOST_CHRONO_LIB"; | |
467 | AC_DEFINE(HAVE_WORKING_BOOST_SLEEP_FOR, 1, [Define this symbol if boost sleep_for works])], | |
468 | [boost_sleep=no]) | |
469 | LIBS="$TEMP_LIBS" | |
714cdecb | 470 | CPPFLAGS="$TEMP_CPPFLAGS" |
35b8af92 CF |
471 | fi |
472 | ||
473 | if test x$boost_sleep != xyes; then | |
474 | TEMP_LIBS="$LIBS" | |
475 | LIBS="$LIBS $BOOST_LIBS" | |
714cdecb WL |
476 | TEMP_CPPFLAGS="$CPPFLAGS" |
477 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" | |
35b8af92 CF |
478 | AC_TRY_LINK([ |
479 | #include <boost/version.hpp> | |
480 | #include <boost/thread.hpp> | |
481 | #include <boost/date_time/posix_time/posix_time_types.hpp> | |
482 | ],[ | |
483 | #if BOOST_VERSION <= 105600 | |
484 | boost::this_thread::sleep(boost::posix_time::milliseconds(0)); | |
485 | #else | |
486 | choke me | |
487 | #endif | |
488 | ], | |
489 | [boost_sleep=yes; AC_DEFINE(HAVE_WORKING_BOOST_SLEEP, 1, [Define this symbol if boost sleep works])], | |
490 | [boost_sleep=no]) | |
491 | LIBS="$TEMP_LIBS" | |
714cdecb | 492 | CPPFLAGS="$TEMP_CPPFLAGS" |
35b8af92 CF |
493 | fi |
494 | ||
495 | if test x$boost_sleep != xyes; then | |
720731d2 | 496 | AC_MSG_ERROR(No working boost sleep implementation found. If on ubuntu 13.10 with libboost1.54-all-dev remove libboost.1.54-all-dev and use libboost1.53-all-dev) |
35b8af92 CF |
497 | fi |
498 | ||
a9dbcf03 LD |
499 | AC_ARG_WITH([cli], |
500 | [AS_HELP_STRING([--with-cli], | |
501 | [with CLI (default is yes)])], | |
502 | [build_bitcoin_cli=$withval], | |
503 | [build_bitcoin_cli=yes]) | |
504 | ||
505 | AC_ARG_WITH([daemon], | |
506 | [AS_HELP_STRING([--with-daemon], | |
507 | [with daemon (default is yes)])], | |
508 | [build_bitcoind=$withval], | |
509 | [build_bitcoind=yes]) | |
510 | ||
c8ba8ef6 CF |
511 | BITCOIN_QT_INIT |
512 | ||
35b8af92 CF |
513 | if test x$use_pkgconfig = xyes; then |
514 | ||
515 | if test x$PKG_CONFIG == x; then | |
12564aa1 | 516 | AC_MSG_ERROR(pkg-config not found.) |
35b8af92 CF |
517 | fi |
518 | ||
519 | : #NOP | |
520 | m4_ifdef( | |
521 | [PKG_CHECK_MODULES], | |
522 | [ | |
523 | PKG_CHECK_MODULES([SSL], [libssl], [INCLUDES="$INCLUDES $SSL_CFLAGS"; LIBS="$LIBS $SSL_LIBS"], [AC_MSG_ERROR(openssl not found.)]) | |
524 | PKG_CHECK_MODULES([CRYPTO], [libcrypto], [INCLUDES="$INCLUDES $CRYPTO_CFLAGS"; LIBS="$LIBS $CRYPTO_LIBS"], [AC_MSG_ERROR(libcrypto not found.)]) | |
c8ba8ef6 CF |
525 | BITCOIN_QT_CHECK([PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [BITCOIN_QT_FAIL(libprotobuf not found)])]) |
526 | if test x$use_qr != xno; then | |
527 | BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])]) | |
528 | fi | |
35b8af92 CF |
529 | ] |
530 | ) | |
531 | else | |
532 | AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing)) | |
533 | AC_CHECK_LIB([crypto], [main],, AC_MSG_ERROR(libcrypto missing)) | |
534 | ||
535 | AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),) | |
536 | AC_CHECK_LIB([ssl], [main],, AC_MSG_ERROR(libssl missing)) | |
537 | ||
c8ba8ef6 CF |
538 | BITCOIN_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],,BITCOIN_QT_FAIL(libprotobuf not found))) |
539 | if test x$use_qr != xno; then | |
540 | BITCOIN_QT_CHECK([AC_CHECK_LIB([qrencode], [main],, [have_qrencode=no])]) | |
541 | BITCOIN_QT_CHECK([AC_CHECK_HEADER([qrencode.h],, have_qrencode=no)]) | |
542 | fi | |
543 | fi | |
35b8af92 | 544 | |
c8ba8ef6 | 545 | BITCOIN_QT_PATH_PROGS([PROTOC], [protoc],$protoc_bin_path) |
fcfbf547 | 546 | |
e18e1001 | 547 | AC_MSG_CHECKING([whether to build bitcoind]) |
f930341d LD |
548 | AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes]) |
549 | AC_MSG_RESULT($build_bitcoind) | |
550 | ||
e18e1001 | 551 | AC_MSG_CHECKING([whether to build bitcoin-cli]) |
f930341d LD |
552 | AM_CONDITIONAL([BUILD_BITCOIN_CLI], [test x$build_bitcoin_cli = xyes]) |
553 | AC_MSG_RESULT($build_bitcoin_cli) | |
554 | ||
c8ba8ef6 CF |
555 | dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus |
556 | BITCOIN_QT_CONFIGURE([$use_pkgconfig], [qt4]) | |
35b8af92 | 557 | |
35b8af92 CF |
558 | AC_LANG_POP |
559 | ||
560 | if test "x$use_ccache" != "xno"; then | |
e18e1001 | 561 | AC_MSG_CHECKING(if ccache should be used) |
35b8af92 CF |
562 | if test x$CCACHE = x; then |
563 | if test "x$use_ccache" = "xyes"; then | |
564 | AC_MSG_ERROR([ccache not found.]); | |
565 | else | |
35b8af92 CF |
566 | use_ccache=no |
567 | fi | |
568 | else | |
569 | use_ccache=yes | |
570 | CC="$ac_cv_path_CCACHE $CC" | |
571 | CXX="$ac_cv_path_CCACHE $CXX" | |
572 | fi | |
573 | AC_MSG_RESULT($use_ccache) | |
574 | fi | |
575 | ||
4f9e993b WL |
576 | dnl enable wallet |
577 | AC_MSG_CHECKING([if wallet should be enabled]) | |
578 | if test x$enable_wallet != xno; then | |
579 | AC_MSG_RESULT(yes) | |
580 | AC_DEFINE_UNQUOTED([ENABLE_WALLET],[1],[Define to 1 to enable wallet functions]) | |
581 | ||
582 | else | |
583 | AC_MSG_RESULT(no) | |
4f9e993b WL |
584 | fi |
585 | ||
35b8af92 | 586 | dnl enable upnp support |
e18e1001 | 587 | AC_MSG_CHECKING([whether to build with support for UPnP]) |
35b8af92 CF |
588 | if test x$have_miniupnpc = xno; then |
589 | if test x$use_upnp = xyes; then | |
e18e1001 | 590 | AC_MSG_ERROR("UPnP requested but cannot be built. use --without-miniupnpc") |
35b8af92 CF |
591 | fi |
592 | AC_MSG_RESULT(no) | |
593 | else | |
594 | if test x$use_upnp != xno; then | |
595 | AC_MSG_RESULT(yes) | |
e18e1001 | 596 | AC_MSG_CHECKING([whether to build with UPnP enabled by default]) |
35b8af92 CF |
597 | use_upnp=yes |
598 | upnp_setting=0 | |
599 | if test x$use_upnp_default != xno; then | |
600 | use_upnp_default=yes | |
601 | upnp_setting=1 | |
602 | fi | |
603 | AC_MSG_RESULT($use_upnp_default) | |
e18e1001 | 604 | AC_DEFINE_UNQUOTED([USE_UPNP],[$upnp_setting],[UPnP support not compiled if undefined, otherwise value (0 or 1) determines default state]) |
35b8af92 CF |
605 | if test x$TARGET_OS = xwindows; then |
606 | CPPFLAGS="$CPPFLAGS -DSTATICLIB" | |
607 | fi | |
608 | else | |
609 | AC_MSG_RESULT(no) | |
610 | fi | |
611 | fi | |
612 | ||
35b8af92 | 613 | dnl these are only used when qt is enabled |
c8ba8ef6 CF |
614 | if test x$bitcoin_enable_qt != xno; then |
615 | BUILD_QT=qt | |
35b8af92 | 616 | dnl enable dbus support |
e18e1001 | 617 | AC_MSG_CHECKING([whether to build GUI with support for D-Bus]) |
c8ba8ef6 | 618 | if test x$bitcoin_enable_qt_dbus != xno; then |
35b8af92 | 619 | AC_DEFINE([USE_DBUS],[1],[Define if dbus support should be compiled in]) |
35b8af92 | 620 | fi |
c8ba8ef6 | 621 | AC_MSG_RESULT($bitcoin_enable_qt_dbus) |
35b8af92 CF |
622 | |
623 | dnl enable qr support | |
e18e1001 | 624 | AC_MSG_CHECKING([whether to build GUI with support for QR codes]) |
35b8af92 CF |
625 | if test x$have_qrencode = xno; then |
626 | if test x$use_qr == xyes; then | |
627 | AC_MSG_ERROR("QR support requested but cannot be built. use --without-qrencode") | |
628 | fi | |
629 | AC_MSG_RESULT(no) | |
630 | else | |
631 | if test x$use_qr != xno; then | |
632 | AC_MSG_RESULT(yes) | |
633 | AC_DEFINE([USE_QRCODE],[1],[Define if QR support should be compiled in]) | |
634 | use_qr=yes | |
635 | else | |
636 | AC_MSG_RESULT(no) | |
637 | fi | |
638 | fi | |
639 | ||
c8ba8ef6 CF |
640 | if test x$XGETTEXT == x; then |
641 | AC_MSG_WARN("xgettext is required to update qt translations") | |
642 | fi | |
643 | ||
e18e1001 LD |
644 | AC_MSG_CHECKING([whether to build test_bitcoin-qt]) |
645 | if test x$use_tests$bitcoin_enable_qt_test = xyesyes; then | |
646 | AC_MSG_RESULT([yes]) | |
35b8af92 | 647 | BUILD_TEST_QT="test" |
e18e1001 LD |
648 | else |
649 | AC_MSG_RESULT([no]) | |
c8ba8ef6 | 650 | fi |
35b8af92 CF |
651 | fi |
652 | ||
e18e1001 | 653 | AC_MSG_CHECKING([whether to build test_bitcoin]) |
35b8af92 | 654 | if test x$use_tests = xyes; then |
e18e1001 | 655 | AC_MSG_RESULT([yes]) |
35b8af92 | 656 | BUILD_TEST="test" |
e18e1001 LD |
657 | else |
658 | AC_MSG_RESULT([no]) | |
35b8af92 CF |
659 | fi |
660 | ||
a9dbcf03 LD |
661 | if test "x$use_tests$build_bitcoind$use_qt" = "xnonono"; then |
662 | AC_MSG_ERROR([No targets! Please specify at least one of: --enable-cli --enable-daemon --enable-gui or --enable-tests]) | |
663 | fi | |
664 | ||
35b8af92 | 665 | AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin]) |
b62bbb1f | 666 | AM_CONDITIONAL([BUILD_DARWIN], [test x$BUILD_OS = xdarwin]) |
35b8af92 | 667 | AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows]) |
4f9e993b | 668 | AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet == xyes]) |
35b8af92 CF |
669 | AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes]) |
670 | AM_CONDITIONAL([USE_LCOV],[test x$use_lcov == xyes]) | |
671 | AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno]) | |
47b9374e | 672 | AM_CONDITIONAL([USE_COMPARISON_TOOL_REORG_TESTS],[test x$use_comparison_tool_reorg_test != xno]) |
d5aab704 | 673 | AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes]) |
35b8af92 CF |
674 | |
675 | AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version]) | |
676 | AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version]) | |
677 | AC_DEFINE(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION, [Build revision]) | |
678 | AC_DEFINE(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD, [Version Build]) | |
679 | AC_DEFINE(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE, [Version is release]) | |
680 | AC_DEFINE(COPYRIGHT_YEAR, _COPYRIGHT_YEAR, [Version is release]) | |
681 | AC_SUBST(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR) | |
682 | AC_SUBST(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR) | |
683 | AC_SUBST(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION) | |
684 | AC_SUBST(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD) | |
685 | AC_SUBST(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE) | |
686 | AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR) | |
687 | ||
688 | ||
689 | AC_SUBST(USE_UPNP) | |
690 | AC_SUBST(USE_QRCODE) | |
35b8af92 CF |
691 | AC_SUBST(INCLUDES) |
692 | AC_SUBST(BOOST_LIBS) | |
35b8af92 CF |
693 | AC_SUBST(TESTDEFS) |
694 | AC_SUBST(LEVELDB_TARGET_FLAGS) | |
35b8af92 | 695 | AC_SUBST(BUILD_TEST) |
c8ba8ef6 | 696 | AC_SUBST(BUILD_QT) |
35b8af92 CF |
697 | AC_SUBST(BUILD_TEST_QT) |
698 | AC_CONFIG_FILES([Makefile src/Makefile src/test/Makefile src/qt/Makefile src/qt/test/Makefile share/setup.nsi share/qt/Info.plist]) | |
699 | AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh]) | |
700 | AC_CONFIG_FILES([qa/pull-tester/build-tests.sh],[chmod +x qa/pull-tester/build-tests.sh]) | |
701 | AC_OUTPUT |