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