]> Git Repo - VerusCoin.git/blob - configure.ac
Cleanup code using forward declarations.
[VerusCoin.git] / configure.ac
1 dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
2 AC_PREREQ([2.60])
3 define(_CLIENT_VERSION_MAJOR, 0)
4 define(_CLIENT_VERSION_MINOR, 8)
5 define(_CLIENT_VERSION_REVISION, 99)
6 define(_CLIENT_VERSION_BUILD, 0)
7 define(_CLIENT_VERSION_IS_RELEASE, false)
8 define(_COPYRIGHT_YEAR, 2013)
9 AC_INIT([Bitcoin],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[[email protected]],[bitcoin])
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
24 dnl faketime breaks configure and is only needed for make. Disable it here.
25 unset FAKETIME
26
27 dnl ==============================================================
28 dnl Setup for automake
29 dnl ==============================================================
30
31 AM_INIT_AUTOMAKE([no-define subdir-objects foreign])
32
33 dnl faketime messes with timestamps and causes configure to be re-run.
34 dnl --disable-maintainer-mode can be used to bypass this.
35 AM_MAINTAINER_MODE([enable])
36
37 dnl make the compilation flags quiet unless V=1 is used
38 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
39
40 AC_ARG_WITH([miniupnpc],
41   [AS_HELP_STRING([--with-miniupnpc],
42   [enable UPNP (default is yes if libminiupnpc is found)])],
43   [use_upnp=$withval],
44   [use_upnp=auto])
45
46 AC_ARG_ENABLE([upnp-default],
47   [AS_HELP_STRING([--enable-upnp-default],
48   [if UPNP is enabled, turn it on at startup (default is no)])],
49   [use_upnp_default=$enableval],
50   [use_upnp_default=no])
51
52 dnl enable ipv6 support
53 AC_ARG_ENABLE([ipv6],
54   [AS_HELP_STRING([--enable-ipv6],
55   [enable ipv6 (default is yes)])],
56   [use_ipv6=$enableval],
57   [use_ipv6=yes])
58
59 dnl enable qt support
60 AC_ARG_WITH([qt],
61   [AS_HELP_STRING([--with-qt],
62   [enable qt (default is yes)])],
63   [use_qt=$withval],
64   [use_qt=yes])
65
66 AC_ARG_ENABLE(tests,
67     AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]),
68     [use_tests=$enableval],
69     [use_tests=yes])
70
71 AC_ARG_WITH([comparison-tool],
72     AS_HELP_STRING([--with-comparison-tool],[path to java comparison tool (requires --enable-tests)]),
73     [use_comparison_tool=$withval],
74     [use_comparison_tool=no])
75
76 AC_ARG_ENABLE([comparison-tool-reorg-tests],
77     AS_HELP_STRING([--enable-comparison-tool-reorg-tests],[enable expensive reorg tests in the comparison tool (default no)]),
78     [use_comparison_tool_reorg_tests=$enableval],
79     [use_comparison_tool_reorg_tests=no])
80
81 AC_ARG_WITH([qrencode],
82   [AS_HELP_STRING([--with-qrencode],
83   [enable QR code support (default is yes if qt is enabled and libqrencode is found)])],
84   [use_qr=$withval],
85   [use_qr=auto])
86
87 AC_ARG_WITH([qtdbus],
88   [AS_HELP_STRING([--with-qtdbus],
89   [enable DBus support (default is yes if qt is enabled and QtDBus is found)])],
90   [use_dbus=$withval],
91   [use_dbus=auto])
92
93 AC_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
99 AC_ARG_ENABLE([ccache],
100   [AS_HELP_STRING([--enable-ccache],
101   [enable building with ccache (default is yes if ccache is found)])],
102   [use_ccache=$enableval],
103   [use_ccache=auto])
104
105 AC_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
111 AC_ARG_WITH([qt-incdir],[AS_HELP_STRING([--with-qt-incdir=INC_DIR],[specify qt include path (overridden by pkgconfig)])], [qt_include_path=$withval], [])
112 AC_ARG_WITH([qt-libdir],[AS_HELP_STRING([--with-qt-libdir=LIB_DIR],[specify qt lib path (overridden by pkgconfig)])], [qt_lib_path=$withval], [])
113 AC_ARG_WITH([qt-bindir],[AS_HELP_STRING([--with-qt-bindir=BIN_DIR],[specify qt bin path])], [qt_bin_path=$withval], [])
114 AC_ARG_WITH([qt-plugindir],[AS_HELP_STRING([--with-qt-plugindir=PLUGIN_DIR],[specify qt plugin path (overridden by pkgconfig)])], [qt_plugin_path=$withval], [])
115 AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], [])
116
117
118 AC_CONFIG_SRCDIR([src])
119 AC_CONFIG_HEADERS([src/bitcoin-config.h])
120
121 dnl Checks for programs.
122 AC_PROG_CXX
123 AC_PROG_CC
124 AC_PROG_CPP
125 AC_PROG_CXXCPP
126 AC_PROG_INSTALL
127 AC_PROG_OBJC
128 m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX])
129 AC_PROG_MKDIR_P
130 AC_PROG_SED
131 AC_PATH_TOOL(AR, ar)
132 AC_PATH_TOOL(RANLIB, ranlib)
133 AC_PATH_TOOL(STRIP, strip)
134 AC_PATH_TOOL(GCOV, gcov)
135 AC_PATH_PROG(LCOV, lcov)
136 AC_PATH_PROG(JAVA, java)
137 AC_PATH_PROG(GENHTML, genhtml)
138 AC_PATH_PROG([GIT], [git])
139 AC_PATH_PROGS([MOC], [moc-qt4 moc4 moc],, $qt_bin_path:$PATH)
140 AC_PATH_PROGS([UIC], [uic-qt4 uic4 uic],, $qt_bin_path:$PATH)
141 AC_PATH_PROGS([RCC], [rcc-qt4 rcc4 rcc],, $qt_bin_path:$PATH)
142 AC_PATH_PROGS([LRELEASE], [lrelease-qt4 lrelease4 lrelease],, $qt_bin_path:$PATH)
143 AC_PATH_PROGS([LUPDATE], [lupdate-qt4 lupdate4 lupdate],, $qt_bin_path:$PATH)
144 AC_PATH_PROG([PROTOC], [protoc],, $protoc_bin_path:$PATH)
145 AC_PATH_PROG(CCACHE,ccache)
146 AC_PATH_PROG(XGETTEXT,xgettext)
147 AC_PATH_PROG(HEXDUMP,hexdump)
148 PKG_PROG_PKG_CONFIG
149
150 ## TODO: Remove these hard-coded paths and flags. They are here for the sake of
151 ##       compatibility with the legacy buildsystem.
152 ##
153 CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter"
154 CPPFLAGS="$CPPFLAGS -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS"
155
156 AC_LANG_PUSH([C++])
157
158 use_pkgconfig=yes
159 case $host in
160   *mingw*)
161
162      #pkgconfig does more harm than good with MinGW
163      use_pkgconfig=no
164
165      TARGET_OS=windows
166      AC_CHECK_LIB([mingwthrd],      [main],, AC_MSG_ERROR(lib missing))
167      AC_CHECK_LIB([kernel32],      [main],, AC_MSG_ERROR(lib missing))
168      AC_CHECK_LIB([user32],      [main],, AC_MSG_ERROR(lib missing))
169      AC_CHECK_LIB([gdi32],      [main],, AC_MSG_ERROR(lib missing))
170      AC_CHECK_LIB([comdlg32],      [main],, AC_MSG_ERROR(lib missing))
171      AC_CHECK_LIB([winspool],      [main],, AC_MSG_ERROR(lib missing))
172      AC_CHECK_LIB([winmm],      [main],, AC_MSG_ERROR(lib missing))
173      AC_CHECK_LIB([shell32],      [main],, AC_MSG_ERROR(lib missing))
174      AC_CHECK_LIB([comctl32],      [main],, AC_MSG_ERROR(lib missing))
175      AC_CHECK_LIB([ole32],      [main],, AC_MSG_ERROR(lib missing))
176      AC_CHECK_LIB([oleaut32],      [main],, AC_MSG_ERROR(lib missing))
177      AC_CHECK_LIB([uuid],      [main],, AC_MSG_ERROR(lib missing))
178      AC_CHECK_LIB([rpcrt4],      [main],, AC_MSG_ERROR(lib missing))
179      AC_CHECK_LIB([advapi32],      [main],, AC_MSG_ERROR(lib missing))
180      AC_CHECK_LIB([ws2_32],      [main],, AC_MSG_ERROR(lib missing))
181      AC_CHECK_LIB([mswsock],      [main],, AC_MSG_ERROR(lib missing))
182      AC_CHECK_LIB([shlwapi],      [main],, AC_MSG_ERROR(lib missing))
183      AC_CHECK_LIB([iphlpapi],      [main],, AC_MSG_ERROR(lib missing))
184      AC_CHECK_LIB([crypt32],      [main],, AC_MSG_ERROR(lib missing))
185
186      AX_CHECK_LINK_FLAG([[-static-libgcc]],[LDFLAGS="$LDFLAGS -static-libgcc"])
187      AX_CHECK_LINK_FLAG([[-static-libstdc++]],[LDFLAGS="$LDFLAGS -static-libstdc++"])
188
189      AC_PATH_PROG([MAKENSIS], [makensis], none)
190      if test x$MAKENSIS = xnone; then
191        AC_MSG_WARN("makensis not found. Cannot create installer.")
192      fi
193
194      AC_PATH_TOOL(WINDRES, windres, none)
195      if test x$WINDRES = xnone; then
196        AC_MSG_ERROR("windres not found")
197      fi
198
199      CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB"
200      LEVELDB_TARGET_FLAGS="TARGET_OS=OS_WINDOWS_CROSSCOMPILE"
201      CXXFLAGS="$CXXFLAGS -w"
202      ;;
203   *darwin*)
204      TARGET_OS=darwin
205      LEVELDB_TARGET_FLAGS="TARGET_OS=Darwin"
206      if  test x$cross_compiling != xyes; then
207        AC_CHECK_PROG([PORT],port, port)
208        if test x$PORT = xport; then
209          dnl add default macports paths
210          CPPFLAGS="$CPPFLAGS -I/opt/local/include -I/opt/local/include/db48"
211          LIBS="$LIBS -L/opt/local/lib -L/opt/local/lib/db48"
212        fi
213
214        AC_CHECK_PROG([BREW],brew, brew)
215        if test x$BREW = xbrew; then
216          dnl add default homebrew paths
217          openssl_prefix=`$BREW --prefix openssl`
218          bdb_prefix=`$BREW --prefix berkeley-db4`
219          export PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
220          CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include"
221          LIBS="$LIBS -L/$bdb_prefix/lib"
222        fi
223      fi
224
225      if test x$use_qt = xyes; then
226        MOC_DEFS="-DQ_OS_MAC"
227        base_frameworks="-framework Foundation -framework ApplicationServices -framework AppKit"
228        AX_CHECK_LINK_FLAG([[$base_frameworks]],[LIBS="$LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)])
229      fi
230
231      CPPFLAGS="$CPPFLAGS -DMAC_OSX"
232      TESTDEFS="-DBOOST_TEST_DYN_LINK"
233      ;;
234    *)
235      TESTDEFS="-DBOOST_TEST_DYN_LINK"
236      ;;
237 esac
238
239 if test x$use_comparison_tool != xno; then
240   AC_SUBST(JAVA_COMPARISON_TOOL, $use_comparison_tool)
241 fi
242
243 if test x$use_comparison_tool_reorg_tests != xno; then
244   if test x$use_comparison_tool == x; then
245     AC_MSG_ERROR("comparison tool reorg tests but comparison tool was not specified")
246   fi
247   AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 1)
248 else
249   AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 0)
250 fi
251
252 if test x$use_lcov == xyes; then
253   if test x$LCOV == x; then
254     AC_MSG_ERROR("lcov testing requested but lcov not found")
255   fi
256   if test x$GCOV == x; then
257     AC_MSG_ERROR("lcov testing requested but gcov not found")
258   fi
259   if test x$JAVA == x; then
260     AC_MSG_ERROR("lcov testing requested but java not found")
261   fi
262   if test x$GENHTML == x; then
263     AC_MSG_ERROR("lcov testing requested but genhtml not found")
264   fi
265   if test x$use_comparison_tool == x; then
266     AC_MSG_ERROR("lcov testing requested but comparison tool was not specified")
267   fi
268   LCOV="$LCOV --gcov-tool=$GCOV"
269   AX_CHECK_COMPILE_FLAG([--coverage],[CXXFLAGS="$CXXFLAGS --coverage"],
270     [AC_MSG_ERROR("lcov testing requested but --coverage flag does not work")])
271 fi
272
273 dnl Require little endian
274 AC_C_BIGENDIAN([AC_MSG_ERROR("Big Endian not supported")])
275
276 dnl Check for pthread compile/link requirements
277 AX_PTHREAD
278 INCLUDES="$INCLUDES $PTHREAD_CFLAGS"
279
280 # The following macro will add the necessary defines to bitcoin-config.h, but
281 # they also need to be passed down to any subprojects. Pull the results out of
282 # the cache and add them to CPPFLAGS.
283 AC_SYS_LARGEFILE
284
285 if test x$ac_cv_sys_file_offset_bits != x &&
286    test x$ac_cv_sys_file_offset_bits != xno &&
287    test x$ac_cv_sys_file_offset_bits != xunknown; then
288   CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
289 fi
290
291 if test x$ac_cv_sys_large_files != x &&
292    test x$ac_cv_sys_large_files != xno &&
293    test x$ac_cv_sys_large_files != xunknown; then
294   CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files"
295 fi
296
297 AX_CHECK_LINK_FLAG([[-Wl,--large-address-aware]], [LDFLAGS="$LDFLAGS -Wl,--large-address-aware"])
298
299 if test x$use_hardening != xno; then
300   AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
301   AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"])
302
303   AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -D_FORTIFY_SOURCE=2"])
304
305   AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"])
306   AX_CHECK_LINK_FLAG([[-Wl,--nxcompat]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"])
307   AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [LDFLAGS="-Wl,-z,relro"])
308   AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [LDFLAGS="-Wl,-z,now"])
309
310   if test x$TARGET_OS != xwindows; then
311     # -fstack-protector-all can produce broken binaries with mingw
312     AX_CHECK_COMPILE_FLAG([-fno-stack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fno-stack-protector"])
313     AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"])
314
315     # -pie will link successfully with MinGW, but it's unsupported and leads to undeterministic binaries
316     AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"])
317   fi
318
319   CXXFLAGS="$CXXFLAGS $HARDENED_CXXFLAGS"
320   CPPFLAGS="$CPPFLAGS $HARDENED_CPPFLAGS"
321   LDFLAGS="$LDFLAGS $HARDENED_LDFLAGS"
322   OBJCXXFLAGS="$CXXFLAGS"
323 fi
324
325 dnl this flag screws up non-darwin gcc even when the check fails. special-case it.
326 if test x$TARGET_OS = xdarwin; then
327   AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"])
328 fi
329
330 AC_CHECK_HEADERS([stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h])
331
332 dnl Check for MSG_NOSIGNAL
333 AC_MSG_CHECKING(for MSG_NOSIGNAL)
334 AC_TRY_COMPILE([#include <sys/socket.h>],
335  [ int f = MSG_NOSIGNAL; ],
336  [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MSG_NOSIGNAL, 1,[Define this symbol if you have MSG_NOSIGNAL]) ],
337  [ AC_MSG_RESULT(no)]
338 )
339
340 dnl Check for libdb_cxx
341 BITCOIN_FIND_BDB48
342
343 dnl Check for libminiupnpc (optional)
344 if test x$use_upnp != xno; then
345   AC_CHECK_LIB([miniupnpc], [main],, [have_miniupnpc=no])
346 fi
347
348 dnl Check for boost libs
349 AX_BOOST_BASE
350 AX_BOOST_SYSTEM
351 AX_BOOST_FILESYSTEM
352 AX_BOOST_PROGRAM_OPTIONS
353 AX_BOOST_THREAD
354 AX_BOOST_CHRONO
355
356 if test x$use_tests = xyes; then
357
358   if test x$HEXDUMP = x; then
359     AC_MSG_ERROR(hexdump is required for tests)
360   fi
361
362
363   AX_BOOST_UNIT_TEST_FRAMEWORK
364 fi
365
366 BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_PROGRAM_OPTIONS_LIB $BOOST_THREAD_LIB"
367 BOOST_INCLUDES="$BOOST_CPPFLAGS"
368
369 dnl Boost >= 1.50 uses sleep_for rather than the now-deprecated sleep, however
370 dnl it was broken from 1.50 to 1.52 when backed by nanosleep. Use sleep_for if
371 dnl a working version is available, else fall back to sleep. sleep was removed
372 dnl after 1.56.
373 dnl If neither is available, abort.
374 dnl If sleep_for is used, boost_chrono becomes a requirement.
375 if test x$ax_cv_boost_chrono = xyes; then
376 TEMP_LIBS="$LIBS"
377 LIBS="$LIBS $BOOST_LIBS $BOOST_CHRONO_LIB"
378 AC_TRY_LINK([
379   #include <boost/thread/thread.hpp>
380   #include <boost/version.hpp>
381   ],[
382   #if BOOST_VERSION >= 105000 && (!defined(BOOST_HAS_NANOSLEEP) || BOOST_VERSION >= 105200)
383       boost::this_thread::sleep_for(boost::chrono::milliseconds(0));
384   #else
385    choke me
386   #endif
387   ],
388   [boost_sleep=yes; BOOST_LIBS="$BOOST_LIBS $BOOST_CHRONO_LIB";
389      AC_DEFINE(HAVE_WORKING_BOOST_SLEEP_FOR, 1, [Define this symbol if boost sleep_for works])],
390   [boost_sleep=no])
391 LIBS="$TEMP_LIBS"
392 fi
393
394 if test x$boost_sleep != xyes; then
395 TEMP_LIBS="$LIBS"
396 LIBS="$LIBS $BOOST_LIBS"
397 AC_TRY_LINK([
398   #include <boost/version.hpp>
399   #include <boost/thread.hpp>
400   #include <boost/date_time/posix_time/posix_time_types.hpp>
401   ],[
402   #if BOOST_VERSION <= 105600
403       boost::this_thread::sleep(boost::posix_time::milliseconds(0));
404   #else
405    choke me
406   #endif
407   ],
408   [boost_sleep=yes; AC_DEFINE(HAVE_WORKING_BOOST_SLEEP, 1, [Define this symbol if boost sleep works])],
409   [boost_sleep=no])
410 LIBS="$TEMP_LIBS"
411 fi
412
413 if test x$boost_sleep != xyes; then
414   AC_MSG_ERROR(No working boost sleep implementation found)
415 fi
416
417 if test x$use_pkgconfig = xyes; then
418
419   if test x$PKG_CONFIG == x; then
420     AC_MSG_ERROR(pkg-config not found.)
421   fi
422
423   : #NOP
424   m4_ifdef(
425     [PKG_CHECK_MODULES],
426     [
427       PKG_CHECK_MODULES([SSL], [libssl], [INCLUDES="$INCLUDES $SSL_CFLAGS"; LIBS="$LIBS $SSL_LIBS"], [AC_MSG_ERROR(openssl  not found.)])
428       PKG_CHECK_MODULES([CRYPTO], [libcrypto], [INCLUDES="$INCLUDES $CRYPTO_CFLAGS"; LIBS="$LIBS $CRYPTO_LIBS"], [AC_MSG_ERROR(libcrypto  not found.)])
429
430       if test x$use_qt = xyes; then
431         PKG_CHECK_MODULES([QT], [QtCore QtGui QtNetwork], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes], [have_qt=no])
432         if test x$use_tests = xyes; then
433           PKG_CHECK_MODULES([QT_TEST], [QtTest], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no])
434         fi
435         if test x$use_dbus != xno; then
436           PKG_CHECK_MODULES([QT_DBUS], [QtDBus], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no])
437         fi
438         if test x$use_qr != xno; then
439           PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])
440         fi
441         PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [AC_MSG_ERROR(libprotobuf not found.)])
442       fi
443     ]
444   )
445 else
446   AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing))
447   AC_CHECK_LIB([crypto],      [main],, AC_MSG_ERROR(libcrypto missing))
448
449   AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),)
450   AC_CHECK_LIB([ssl],         [main],, AC_MSG_ERROR(libssl missing))
451
452   if test x$use_qt = xyes; then
453     TEMP_LIBS="$LIBS"
454     LIBS=
455     if test x$qt_lib_path != x; then
456       QT_LIBS="$QT_LIBS -L$qt_lib_path"
457       LIBS="$QT_LIBS"
458     fi
459     if test x$qt_plugin_path != x; then
460       QT_LIBS="$QT_LIBS -L$qt_plugin_path/codecs"
461       LIBS="$QT_LIBS"
462     fi
463
464     if test x$TARGET_OS == xwindows; then
465       AC_CHECK_LIB([imm32],      [main],, AC_MSG_ERROR(libimm32 not found. Install it or use --without-qt.))
466     fi
467
468     #TODO: These are only needed when they're linked directly to parent libs. It really has nothing to do with windows.
469     #Instead, check for missing functions in parent libs and assume static if they're absent.
470     if test x$TARGET_OS == xwindows; then
471       AC_CHECK_LIB([qcncodecs],      [main],, AC_MSG_ERROR(libqcncodecs not found. Install it or use --without-qt.))
472       AC_CHECK_LIB([qjpcodecs],      [main],, AC_MSG_ERROR(libqjpcodecs not found. Install it or use --without-qt.))
473       AC_CHECK_LIB([qkrcodecs],      [main],, AC_MSG_ERROR(libqkrcodecs not found. Install it or use --without-qt.))
474       AC_CHECK_LIB([qtwcodecs],      [main],, AC_MSG_ERROR(libqtwcodecs not found. Install it or use --without-qt.))
475     fi
476
477     AC_CHECK_LIB([QtCore],      [main],, AC_MSG_ERROR(libQtCore not found. Install it or use --without-qt.))
478     AC_CHECK_LIB([QtGui],      [main],, AC_MSG_ERROR(libQtGui not found. Install it or use --without-qt.))
479     AC_CHECK_LIB([QtNetwork],      [main],, AC_MSG_ERROR(libQtNetwork not found. Install it or use --without-qt.))
480     AC_CHECK_LIB([protobuf],      [main],, AC_MSG_ERROR(libprotobuf not found. Install it or use --without-qt.))
481     QT_LIBS="$LIBS"
482     LIBS="$TEMP_LIBS"
483
484     TEMP_CPPFLAGS="$CPPFLAGS"
485     if test x$qt_include_path != x; then
486       QT_INCLUDES="-I$qt_include_path -I$qt_include_path/QtCore -I$qt_include_path/QtGui -I$qt_include_path/QtNetwork -I$qt_include_path/QtTest -I$qt_include_path/QtDBus"
487       CPPFLAGS="$CPPFLAGS $QT_INCLUDES"
488     fi
489     AC_CHECK_HEADER([QtPlugin],, AC_MSG_ERROR(QtCore headers missing. Install them or use --without-qt.),)
490     AC_CHECK_HEADER([QApplication],, AC_MSG_ERROR(QtGUI headers missing. Install them or use --without-qt.),)
491     AC_CHECK_HEADER([QLocalSocket],, AC_MSG_ERROR(QtNetwork headers missing. Install them or use --without-qt.),)
492
493     if test x$use_tests = xyes; then
494       TEMP_LIBS="$LIBS"
495       LIBS=
496       if test x$qt_lib_path != x; then
497         LIBS="-L$qt_lib_path"
498       fi
499       AC_CHECK_LIB([QtTest],      [main],, have_qt_test=no)
500       AC_CHECK_HEADER([QTest],, have_qt_test=no)
501       QT_TEST_LIBS="$LIBS"
502       LIBS="$TEMP_LIBS"
503     fi
504     if test x$use_dbus != xno; then
505       TEMP_LIBS="$LIBS"
506       LIBS=
507       if test x$qt_lib_path != x; then
508         LIBS="-L$qt_lib_path"
509       fi
510       AC_CHECK_LIB([QtDBus],      [main],, have_qt_dbus=no)
511       AC_CHECK_HEADER([QtDBus],, have_qt_dbus=no)
512       QT_DBUS_LIBS="$LIBS"
513       LIBS="$TEMP_LIBS"
514     fi
515     CPPFLAGS="$TEMP_CPPFLAGS"
516     if test x$use_qr != xno; then
517       AC_CHECK_LIB([qrencode], [main],, [have_qrencode=no])
518       AC_CHECK_HEADER([qrencode.h],, have_qrencode=no)
519     fi
520   fi
521 fi
522
523 if test x$use_ipv6 = xyes; then
524   dnl Check for ipv6 build requirements
525   AC_MSG_CHECKING(for IPV6 build support)
526   AC_TRY_LINK([
527   #if defined(_WINDOWS)
528   #include <winsock2.h>
529   #else
530   #include <sys/types.h>
531   #include <sys/socket.h>
532   #include <netinet/in.h>
533   #endif
534   ],[
535   #if !defined(_WINDOWS)
536   struct in6_addr ipv6Addr;
537   struct sockaddr_in6 addr;
538   #endif
539   int temp = socket(AF_INET6, SOCK_STREAM, 0);],
540   [AC_MSG_RESULT(yes); have_ipv6=yes; AC_DEFINE(HAVE_IPV6, 1, [Define this symbol if you have ipv6 build support])],
541   [AC_MSG_RESULT(no)]; have_ipv6=no)
542 fi
543 AC_LANG_POP
544
545 if test "x$use_ccache" != "xno"; then
546   AC_MSG_CHECKING(if ccache should be enabled)
547   if test x$CCACHE = x; then
548     if test "x$use_ccache" = "xyes"; then
549       AC_MSG_ERROR([ccache not found.]);
550     else
551       AC_MSG_NOTICE([ccache not found. Falling back to default CC])
552       use_ccache=no
553     fi
554   else
555     use_ccache=yes
556     CC="$ac_cv_path_CCACHE $CC"
557     CXX="$ac_cv_path_CCACHE $CXX"
558   fi
559   AC_MSG_RESULT($use_ccache)
560 fi
561
562 dnl enable ipv6 support
563 AC_MSG_CHECKING([if ipv6 should be enabled])
564 if test x$have_ipv6 = xno; then
565   if test x$use_ipv6 = xyes; then
566      AC_MSG_ERROR("ipv6 requested but cannot be built. use --disable-ipv6")
567   fi
568   AC_MSG_RESULT(no)
569 else
570   if test x$use_ipv6 = xyes; then
571       AC_MSG_RESULT(yes)
572       AC_DEFINE([USE_IPV6],[1],[Define if ipv6 support should be compiled in])
573   else
574       AC_MSG_RESULT(no)
575   fi
576 fi
577
578 dnl enable upnp support
579 AC_MSG_CHECKING([if upnp should be enabled])
580 if test x$have_miniupnpc = xno; then
581   if test x$use_upnp = xyes; then
582      AC_MSG_ERROR("upnp requested but cannot be built. use --without-miniupnpc")
583   fi
584   AC_MSG_RESULT(no)
585 else
586   if test x$use_upnp != xno; then
587     AC_MSG_RESULT(yes)
588     AC_MSG_CHECKING([if upnp should be on by default])
589     use_upnp=yes
590     upnp_setting=0
591     if test x$use_upnp_default != xno; then
592       use_upnp_default=yes
593       upnp_setting=1
594     fi
595     AC_MSG_RESULT($use_upnp_default)
596     AC_DEFINE_UNQUOTED([USE_UPNP],[$upnp_setting],[Define to 1 for upnp runtime support])
597     if test x$TARGET_OS = xwindows; then
598       CPPFLAGS="$CPPFLAGS -DSTATICLIB"
599     fi
600   else
601     AC_MSG_RESULT(no)
602   fi
603 fi
604
605 dnl enable qt support
606 AC_MSG_CHECKING([if qt should be enabled])
607 if test x$use_qt = xyes; then
608   if test x$have_qt = xno; then
609      AC_MSG_ERROR("qt support requested but qt could not be located. use --without-qt")
610   fi
611   if test x$MOC = x; then
612     AC_MSG_ERROR("qt support requested but moc was not found. use --without-qt")
613   fi
614   if test x$PROTOC = x; then
615     AC_MSG_ERROR("qt support requested but protoc was not found. use --without-qt")
616   fi
617   if test x$UIC = x; then
618     AC_MSG_ERROR("qt support requested but uic was not found. use --without-qt")
619   fi
620   if test x$RCC = x; then
621     AC_MSG_ERROR("qt support requested but rcc was not found. use --without-qt")
622   fi
623   if test x$LRELEASE = x; then
624     AC_MSG_ERROR("qt support requested but lrelease was not found. use --without-qt")
625   fi
626   if test x$use_tests = xyes; then
627     if test x$have_qt_test = xno; then
628       AC_MSG_ERROR("libQtTest not found. Use --disable-tests or --without-qt.")
629     fi
630   fi
631   if test x$have_qt_dbus = xno;  then
632     use_dbus=no
633     if test x$use_dbus = xyes; then
634       AC_MSG_ERROR("libQtDBus not found. Use --without-qtdbus.")
635     fi
636   fi
637   if test x$XGETTEXT == x; then
638     AC_MSG_WARN("xgettext is required to update qt translations")
639   fi
640   if test x$LUPDATE == x; then
641     AC_MSG_WARN("lupdate is required to update qt translations")
642   fi
643
644   BUILD_QT=qt
645 else
646   use_qt=no
647 fi
648
649 AC_MSG_RESULT($use_qt)
650
651 dnl these are only used when qt is enabled
652 if test x$use_qt = xyes; then
653
654   dnl enable dbus support
655   AC_MSG_CHECKING([if dbus should be enabled])
656   if test x$use_dbus != xno; then
657     use_dbus=yes
658     AC_DEFINE([USE_DBUS],[1],[Define if dbus support should be compiled in])
659   else
660     use_dbus=no
661   fi
662   AC_MSG_RESULT($use_dbus)
663
664   dnl enable qr support
665   AC_MSG_CHECKING([if qr should be enabled])
666   if test x$have_qrencode = xno; then
667     if test x$use_qr == xyes; then
668      AC_MSG_ERROR("QR support requested but cannot be built. use --without-qrencode")
669     fi
670     AC_MSG_RESULT(no)
671   else
672     if test x$use_qr != xno; then
673       AC_MSG_RESULT(yes)
674       AC_DEFINE([USE_QRCODE],[1],[Define if QR support should be compiled in])
675       use_qr=yes
676     else
677       AC_MSG_RESULT(no)
678     fi
679   fi
680
681   if test x$use_tests = xyes; then
682     BUILD_TEST_QT="test"
683   fi
684 fi
685
686 if test x$use_tests = xyes; then
687   BUILD_TEST="test"
688 fi
689
690 AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin])
691 AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
692 AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes])
693 AM_CONDITIONAL([USE_LCOV],[test x$use_lcov == xyes])
694 AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno])
695 AM_CONDITIONAL([USE_COMPARISON_TOOL_REORG_TESTS],[test x$use_comparison_tool_reorg_test != xno])
696
697 AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
698 AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version])
699 AC_DEFINE(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION, [Build revision])
700 AC_DEFINE(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD, [Version Build])
701 AC_DEFINE(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE, [Version is release])
702 AC_DEFINE(COPYRIGHT_YEAR, _COPYRIGHT_YEAR, [Version is release])
703 AC_SUBST(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR)
704 AC_SUBST(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR)
705 AC_SUBST(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION)
706 AC_SUBST(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD)
707 AC_SUBST(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE)
708 AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR)
709
710
711 AC_SUBST(USE_UPNP)
712 AC_SUBST(USE_QRCODE)
713 AC_SUBST(USE_IPV6)
714 AC_SUBST(INCLUDES)
715 AC_SUBST(BOOST_LIBS)
716 AC_SUBST(MOC_DEFS)
717 AC_SUBST(QT_INCLUDES)
718 AC_SUBST(QT_TEST_LIBS)
719 AC_SUBST(QT_LIBS)
720 AC_SUBST(QT_DBUS_LIBS)
721 AC_SUBST(QT_DBUS_INCLUDES)
722 AC_SUBST(QT_TEST_INCLUDES)
723 AC_SUBST(TESTDEFS)
724 AC_SUBST(LEVELDB_TARGET_FLAGS)
725 AC_SUBST(BUILD_QT)
726 AC_SUBST(BUILD_TEST)
727 AC_SUBST(BUILD_TEST_QT)
728 AC_CONFIG_FILES([Makefile src/Makefile src/test/Makefile src/qt/Makefile src/qt/test/Makefile share/setup.nsi share/qt/Info.plist])
729 AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh])
730 AC_CONFIG_FILES([qa/pull-tester/build-tests.sh],[chmod +x qa/pull-tester/build-tests.sh])
731 AC_OUTPUT
This page took 0.061245 seconds and 4 git commands to generate.