From 35b8af92265ed74de63c3818e5290c27b3f35df2 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Mon, 27 May 2013 19:55:01 -0400 Subject: [PATCH] autotools: switch to autotools buildsystem --- .gitignore | 62 +- Makefile.am | 159 ++++ README.md | 11 +- autogen.sh | 1 + bitcoin-qt.pro | 453 ----------- configure.ac | 714 ++++++++++++++++++ contrib/bitcoin-qt.pro | 17 + contrib/gitian-descriptors/boost-win32.yml | 19 +- contrib/gitian-descriptors/deps-win32.yml | 38 +- contrib/gitian-descriptors/gitian-win32.yml | 85 +-- contrib/gitian-descriptors/gitian.yml | 38 +- contrib/gitian-descriptors/protobuf-win32.yml | 20 +- contrib/gitian-descriptors/qt-win32.yml | 10 +- contrib/macdeploy/macdeployqtplus | 17 + contrib/macdeploy/notes.txt | 24 +- doc/build-unix.md | 37 +- doc/readme-qt.md | 51 +- doc/unit-tests.md | 37 +- pkg.m4 | 214 ++++++ qa/pull-tester/build-tests.sh.in | 45 ++ qa/pull-tester/pull-tester.sh | 15 + qa/pull-tester/run-bitcoind-for-test.sh.in | 27 + share/genbuild.sh | 8 +- share/qt/{Info.plist => Info.plist.in} | 6 +- share/{setup.nsi => setup.nsi.in} | 324 ++++---- src/Makefile.am | 67 ++ src/Makefile.include | 48 ++ src/clientversion.h | 5 + src/compat.h | 1 - src/init.cpp | 4 + src/m4/ax_boost_base.m4 | 258 +++++++ src/m4/ax_boost_chrono.m4 | 118 +++ src/m4/ax_boost_filesystem.m4 | 118 +++ src/m4/ax_boost_program_options.m4 | 108 +++ src/m4/ax_boost_system.m4 | 120 +++ src/m4/ax_boost_thread.m4 | 153 ++++ src/m4/ax_boost_unit_test_framework.m4 | 137 ++++ src/m4/ax_check_compile_flag.m4 | 72 ++ src/m4/ax_check_link_flag.m4 | 71 ++ src/m4/ax_check_preproc_flag.m4 | 72 ++ src/m4/ax_pthread.m4 | 317 ++++++++ src/main.h | 4 + src/makefile.linux-mingw | 135 ---- src/makefile.mingw | 143 ---- src/makefile.osx | 181 ----- src/makefile.unix | 206 ----- src/net.cpp | 7 + src/netbase.cpp | 4 + src/netbase.h | 4 + src/qt/Makefile.am | 160 ++++ src/qt/addressbookpage.cpp | 4 + src/qt/notificator.h | 4 + src/qt/optionsdialog.cpp | 4 + src/qt/optionsmodel.cpp | 4 + .../res/{bitcoin-qt.rc => bitcoin-qt-res.rc} | 0 src/qt/test/Makefile.am | 26 + src/qt/test/paymentservertests.cpp | 1 + src/test/Makefile.am | 38 + src/util.h | 9 +- 59 files changed, 3527 insertions(+), 1508 deletions(-) create mode 100644 Makefile.am create mode 100755 autogen.sh delete mode 100644 bitcoin-qt.pro create mode 100644 configure.ac create mode 100644 contrib/bitcoin-qt.pro create mode 100644 pkg.m4 create mode 100755 qa/pull-tester/build-tests.sh.in create mode 100755 qa/pull-tester/pull-tester.sh create mode 100755 qa/pull-tester/run-bitcoind-for-test.sh.in rename share/qt/{Info.plist => Info.plist.in} (88%) rename share/{setup.nsi => setup.nsi.in} (86%) create mode 100644 src/Makefile.am create mode 100644 src/Makefile.include create mode 100644 src/m4/ax_boost_base.m4 create mode 100644 src/m4/ax_boost_chrono.m4 create mode 100644 src/m4/ax_boost_filesystem.m4 create mode 100644 src/m4/ax_boost_program_options.m4 create mode 100644 src/m4/ax_boost_system.m4 create mode 100644 src/m4/ax_boost_thread.m4 create mode 100644 src/m4/ax_boost_unit_test_framework.m4 create mode 100644 src/m4/ax_check_compile_flag.m4 create mode 100644 src/m4/ax_check_link_flag.m4 create mode 100644 src/m4/ax_check_preproc_flag.m4 create mode 100644 src/m4/ax_pthread.m4 delete mode 100644 src/makefile.linux-mingw delete mode 100644 src/makefile.mingw delete mode 100644 src/makefile.osx delete mode 100644 src/makefile.unix create mode 100644 src/qt/Makefile.am rename src/qt/res/{bitcoin-qt.rc => bitcoin-qt-res.rc} (100%) create mode 100644 src/qt/test/Makefile.am create mode 100644 src/test/Makefile.am diff --git a/.gitignore b/.gitignore index bf16a5189..069125d02 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,46 @@ +*.tar.gz + +*.exe src/*.exe +src/*/*.exe src/bitcoin src/bitcoind -src/test_bitcoin +src/test/test_bitcoin +src/qt/test/test_bitcoin-qt + +Makefile.in +aclocal.m4 +autom4te.cache/ +config.log +config.status +configure +src/.deps/ +src/Makefile.in +src/bitcoin-config.h +src/bitcoin-config.h.in +src/build-aux/ +src/qt/Makefile.in +src/stamp-h1 +share/setup.nsi +share/qt/Info.plist + +src/leveldb/.deps/ + +src/test/.deps +src/test/.dirstamp + +src/qt/.deps/ +src/qt/.dirstamp +src/qt/*.moc +src/qt/moc_*.cpp +src/qt/forms/ui_*.h + +src/qt/test/.deps/ +src/qt/test/.dirstamp +src/qt/test/moc*.cpp +src/qt/res/.deps/ +src/qt/res/.dirstamp + .*.swp *.*~* *.bak @@ -10,6 +49,13 @@ src/test_bitcoin *.o *.patch .bitcoin +*.a +*.pb.cc +*.pb.h + +*.log +*.trs +*.dmg # Compilation and Qt preprocessor part *.qm @@ -31,4 +77,18 @@ qrc_*.cpp .DS_Store build +#lcov +*.gcno +/*.info +test_bitcoin.coverage/ +total.coverage/ +coverage_percent.txt + +#build tests +linux-coverage-build +linux-build +win32-build +qa/pull-tester/run-bitcoind-for-test.sh +qa/pull-tester/build-tests.sh + !src/leveldb-*/Makefile diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 000000000..b4ea94ad6 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,159 @@ +ACLOCAL_AMFLAGS = -I src/m4 +SUBDIRS = src +.PHONY: deploy + +GZIP_ENV="-9n" + +BITCOIND_BIN=$(top_builddir)/src/bitcoind$(EXEEXT) +BITCOIN_QT_BIN=$(top_builddir)/src/qt/bitcoin-qt$(EXEEXT) +BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win32-setup$(EXEEXT) + +OSX_APP=Bitcoin-Qt.app +OSX_DMG=Bitcoin-Qt.dmg +OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus +OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist +OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns +OSX_PLIST=$(top_srcdir)/share/qt/Info.plist #not installed + +WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/bitcoin.ico \ + $(top_srcdir)/share/pixmaps/nsis-header.bmp \ + $(top_srcdir)/share/pixmaps/nsis-wizard.bmp \ + $(top_srcdir)/doc/README_windows.txt + +OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) \ + $(top_srcdir)/contrib/macdeploy/background.png + +COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \ + leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \ + baseline_filtered.info block_test_filtered.info \ + leveldb_baseline_filtered.info test_bitcoin_coverage.info test_bitcoin.info + +dist-hook: + -$(MAKE) -C $(top_distdir)/src/leveldb clean + -$(GIT) archive --format=tar HEAD -- src/version.cpp | $(AMTAR) -C $(top_distdir) -xf - + +distcheck-hook: + $(MKDIR_P) $(top_distdir)/_build/src/leveldb + cp -rf $(top_srcdir)/src/leveldb/* $(top_distdir)/_build/src/leveldb/ + -$(MAKE) -C $(top_distdir)/_build/src/leveldb clean + +distcleancheck: + @: + +$(BITCOIN_WIN_INSTALLER): $(BITCOIND_BIN) $(BITCOIN_QT_BIN) + $(MAKE) distdir + $(MKDIR_P) $(top_builddir)/release + $(INSTALL_STRIP_PROGRAM) $(top_builddir)/src/bitcoind$(EXEEXT) $(top_builddir)/release + $(INSTALL_STRIP_PROGRAM) $(top_builddir)/src/qt/bitcoin-qt$(EXEEXT) $(top_builddir)/release + @test -f $(MAKENSIS) && $(MAKENSIS) $(top_builddir)/share/setup.nsi || \ + echo error: could not build $@ + +$(BITCOIND_BIN): + make -C $(top_srcdir)/src bitcoind$(EXEEXT) + +$(BITCOIN_QT_BIN): + make -C $(top_srcdir)/src/qt bitcoin-qt$(EXEEXT) + + +$(OSX_APP)/Contents/PkgInfo: + $(MKDIR_P) $(@D) + @echo "APPL????" > $@ + +$(OSX_APP)/Contents/Resources/empty.lproj: + $(MKDIR_P) $(@D) + @touch $@ + +$(OSX_APP)/Contents/Info.plist: $(OSX_PLIST) + $(MKDIR_P) $(@D) + $(INSTALL) $< $@ + +$(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS) + $(MKDIR_P) $(@D) + $(INSTALL) $< $@ + +$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN) + $(MKDIR_P) $(@D) + $(INSTALL_STRIP_PROGRAM) $< $@ + +OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \ + $(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \ + $(OSX_APP)/Contents/MacOS/Bitcoin-Qt + +$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING) + $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr da,de,es,hu,ru,uk,zh_CN,zh_TW -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2 + rm -rf $(OSX_APP) + + +if TARGET_DARWIN +deploy: $(OSX_DMG) +endif +if TARGET_WINDOWS +deploy: $(BITCOIN_WIN_INSTALLER) +endif + +if USE_LCOV + +baseline.info: + $(LCOV) -c -i -d $(abs_builddir)/src -o $@ + +baseline_filtered.info: baseline.info + $(LCOV) -r $< "/usr/include/*" -o $@ + +leveldb_baseline.info: baseline_filtered.info + $(LCOV) -c -i -d $(abs_builddir)/src/leveldb -b $(abs_builddir)/src/leveldb -o $@ + +leveldb_baseline_filtered.info: leveldb_baseline.info + $(LCOV) -r $< "/usr/include/*" -o $@ + +baseline_filtered_combined.info: leveldb_baseline_filtered.info baseline_filtered.info + $(LCOV) -a leveldb_baseline_filtered.info -a baseline_filtered.info -o $@ + +test_bitcoin.info: baseline_filtered_combined.info + $(MAKE) -C src/ check + $(LCOV) -c -d $(abs_builddir)/src -t test_bitcoin -o $@ + $(LCOV) -z -d $(abs_builddir)/src + $(LCOV) -z -d $(abs_builddir)/src/leveldb + +test_bitcoin_filtered.info: test_bitcoin.info + $(LCOV) -r $< "/usr/include/*" -o $@ + +block_test.info: test_bitcoin_filtered.info + -@TIMEOUT=15 qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -Xmx2G -jar $(JAVA_COMPARISON_TOOL) 1 18444 + $(LCOV) -c -d $(abs_builddir)/src --t BitcoinJBlockTest -o $@ + $(LCOV) -z -d $(abs_builddir)/src + $(LCOV) -z -d $(abs_builddir)/src/leveldb + +block_test_filtered.info: block_test.info + $(LCOV) -r $< "/usr/include/*" -o $@ + +test_bitcoin_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info + $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -o $@ + +total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info block_test_filtered.info + $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a block_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt + +test_bitcoin.coverage/.dirstamp: test_bitcoin_coverage.info + $(GENHTML) -s $< -o $(@D) + @touch $@ + +total.coverage/.dirstamp: total_coverage.info + $(GENHTML) -s $< -o $(@D) + @touch $@ + +cov: test_bitcoin.coverage/.dirstamp total.coverage/.dirstamp + +endif + +if USE_COMPARISON_TOOL +check-local: + @qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -Xmx2G -jar $(JAVA_COMPARISON_TOOL) 1 18444 +endif + +EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/pull-tester.sh $(WINDOWS_PACKAGING) $(OSX_PACKAGING) + +CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER) + +.INTERMEDIATE: $(OSX_APP_BUILT) $(COVERAGE_INFO) + +clean-local: + rm -rf test_bitcoin.coverage/ total.coverage/ diff --git a/README.md b/README.md index 5453f998d..0ac322232 100644 --- a/README.md +++ b/README.md @@ -58,15 +58,8 @@ lots of money. Developers are strongly encouraged to write unit tests for new code, and to submit new unit tests for old code. -Unit tests for the core code are in `src/test/`. To compile and run them: - - cd src; make -f makefile.unix test - -Unit tests for the GUI code are in `src/qt/test/`. To compile and run them: - - qmake BITCOIN_QT_TEST=1 -o Makefile.test bitcoin-qt.pro - make -f Makefile.test - ./bitcoin-qt_test +Unit tests can be compiled and run (assuming they weren't disabled in configure) with: + make check Every pull request is built for both Windows and Linux on a dedicated server, and unit and sanity tests are automatically run. The binaries produced may be diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 000000000..4e7011a59 --- /dev/null +++ b/autogen.sh @@ -0,0 +1 @@ +autoreconf -vif diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro deleted file mode 100644 index 00dd02da5..000000000 --- a/bitcoin-qt.pro +++ /dev/null @@ -1,453 +0,0 @@ -TEMPLATE = app -TARGET = bitcoin-qt -macx:TARGET = "Bitcoin-Qt" -VERSION = 0.8.2 -INCLUDEPATH += src src/json src/qt -QT += core gui network -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -DEFINES += BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE -CONFIG += no_include_pwd -CONFIG += thread - -# for boost 1.37, add -mt to the boost libraries -# use: qmake BOOST_LIB_SUFFIX=-mt -# for boost thread win32 with _win32 sufix -# use: BOOST_THREAD_LIB_SUFFIX=_win32-... -# or when linking against a specific BerkelyDB version: BDB_LIB_SUFFIX=-4.8 - -# Dependency library locations can be customized with: -# BOOST_INCLUDE_PATH BOOST_LIB_PATH, -# BDB_INCLUDE_PATH BDB_LIB_PATH, -# OPENSSL_INCLUDE_PATH OPENSSL_LIB_PATH -# PROTOBUF_INCLUDE_PATH PROTOBUF_LIB_PATH -# PROTOC : protocol buffer compiler tool - -OBJECTS_DIR = build -MOC_DIR = build -UI_DIR = build -PROTO_DIR = build -PROTO_PATH = src/qt - -contains(BITCOIN_QT_TEST, 1) { -OBJECTS_DIR = build_test -MOC_DIR = build_test -UI_DIR = build_test -PROTO_DIR = build_test - -SOURCES += src/qt/test/test_main.cpp \ - src/qt/test/uritests.cpp \ - src/qt/test/paymentservertests.cpp -HEADERS += src/qt/test/uritests.h \ - src/qt/test/paymentservertests.h -DEPENDPATH += src/qt/test -QT += testlib -TARGET = bitcoin-qt_test -DEFINES += BITCOIN_QT_TEST -macx: CONFIG -= app_bundle -} - -# use: qmake "RELEASE=1" -contains(RELEASE, 1) { - # Mac: compile for maximum compatibility (10.5, 32-bit) - macx:QMAKE_CXXFLAGS += -mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk - macx:QMAKE_CFLAGS += -mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk - macx:QMAKE_OBJECTIVE_CFLAGS += -mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk - - !win32:!macx { - # Linux: static link and extra security (see: https://wiki.debian.org/Hardening) - LIBS += -Wl,-Bstatic -Wl,-z,relro -Wl,-z,now - } -} - -!win32 { - # for extra security against potential buffer overflows: enable GCCs Stack Smashing Protection - QMAKE_CXXFLAGS *= -fstack-protector-all - QMAKE_LFLAGS *= -fstack-protector-all - # Exclude on Windows cross compile with MinGW 4.2.x, as it will result in a non-working executable! - # This can be enabled for Windows, when we switch to MinGW >= 4.4.x. -} -# for extra security (see: https://wiki.debian.org/Hardening): this flag is GCC compiler-specific -QMAKE_CXXFLAGS *= -D_FORTIFY_SOURCE=2 -# for extra security on Windows: enable ASLR and DEP via GCC linker flags -win32:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat -# on Windows: enable GCC large address aware linker flag -win32:QMAKE_LFLAGS *= -Wl,--large-address-aware - -# use: qmake "USE_QRCODE=1" -# libqrencode (http://fukuchi.org/works/qrencode/index.en.html) must be installed for support -contains(USE_QRCODE, 1) { - message(Building with QRCode support) - DEFINES += USE_QRCODE - LIBS += -lqrencode -} - -# use: qmake "USE_UPNP=1" ( enabled by default; default) -# or: qmake "USE_UPNP=0" (disabled by default) -# or: qmake "USE_UPNP=-" (not supported) -# miniupnpc (http://miniupnp.free.fr/files/) must be installed for support -contains(USE_UPNP, -) { - message(Building without UPNP support) -} else { - message(Building with UPNP support) - count(USE_UPNP, 0) { - USE_UPNP=1 - } - DEFINES += USE_UPNP=$$USE_UPNP STATICLIB - INCLUDEPATH += $$MINIUPNPC_INCLUDE_PATH - LIBS += $$join(MINIUPNPC_LIB_PATH,,-L,) -lminiupnpc - win32:LIBS += -liphlpapi -} - -# use: qmake "USE_DBUS=1" -contains(USE_DBUS, 1) { - message(Building with DBUS (Freedesktop notifications) support) - DEFINES += USE_DBUS - QT += dbus -} - -# use: qmake "USE_IPV6=1" ( enabled by default; default) -# or: qmake "USE_IPV6=0" (disabled by default) -# or: qmake "USE_IPV6=-" (not supported) -contains(USE_IPV6, -) { - message(Building without IPv6 support) -} else { - count(USE_IPV6, 0) { - USE_IPV6=1 - } - DEFINES += USE_IPV6=$$USE_IPV6 -} - -contains(BITCOIN_NEED_QT_PLUGINS, 1) { - DEFINES += BITCOIN_NEED_QT_PLUGINS - QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets -} - -INCLUDEPATH += src/leveldb/include src/leveldb/helpers -LIBS += $$PWD/src/leveldb/libleveldb.a $$PWD/src/leveldb/libmemenv.a -!win32 { - # we use QMAKE_CXXFLAGS_RELEASE even without RELEASE=1 because we use RELEASE to indicate linking preferences not -O preferences - genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a -} else { - # make an educated guess about what the ranlib command is called - isEmpty(QMAKE_RANLIB) { - QMAKE_RANLIB = $$replace(QMAKE_STRIP, strip, ranlib) - } - LIBS += -lshlwapi - genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libmemenv.a -} -genleveldb.target = $$PWD/src/leveldb/libleveldb.a -genleveldb.depends = FORCE -PRE_TARGETDEPS += $$PWD/src/leveldb/libleveldb.a -QMAKE_EXTRA_TARGETS += genleveldb -# Gross ugly hack that depends on qmake internals, unfortunately there is no other way to do it. -QMAKE_CLEAN += $$PWD/src/leveldb/libleveldb.a; cd $$PWD/src/leveldb ; $(MAKE) clean - -# regenerate build.h -!win32|contains(USE_BUILD_INFO, 1) { - genbuild.depends = FORCE - genbuild.commands = cd $$PWD; /bin/sh share/genbuild.sh $$OBJECTS_DIR/build.h - genbuild.target = $$OBJECTS_DIR/build.h - PRE_TARGETDEPS += $$OBJECTS_DIR/build.h - QMAKE_EXTRA_TARGETS += genbuild - DEFINES += HAVE_BUILD_INFO -} - -QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector - -# Input -DEPENDPATH += src src/json src/qt -HEADERS += src/qt/bitcoingui.h \ - src/qt/transactiontablemodel.h \ - src/qt/addresstablemodel.h \ - src/qt/optionsdialog.h \ - src/qt/sendcoinsdialog.h \ - src/qt/addressbookpage.h \ - src/qt/signverifymessagedialog.h \ - src/qt/aboutdialog.h \ - src/qt/editaddressdialog.h \ - src/qt/bitcoinaddressvalidator.h \ - src/alert.h \ - src/addrman.h \ - src/base58.h \ - src/bignum.h \ - src/chainparams.h \ - src/checkpoints.h \ - src/compat.h \ - src/sync.h \ - src/util.h \ - src/hash.h \ - src/uint256.h \ - src/serialize.h \ - src/core.h \ - src/main.h \ - src/miner.h \ - src/net.h \ - src/key.h \ - src/db.h \ - src/walletdb.h \ - src/script.h \ - src/init.h \ - src/bloom.h \ - src/mruset.h \ - src/checkqueue.h \ - src/json/json_spirit_writer_template.h \ - src/json/json_spirit_writer.h \ - src/json/json_spirit_value.h \ - src/json/json_spirit_utils.h \ - src/json/json_spirit_stream_reader.h \ - src/json/json_spirit_reader_template.h \ - src/json/json_spirit_reader.h \ - src/json/json_spirit_error_position.h \ - src/json/json_spirit.h \ - src/qt/clientmodel.h \ - src/qt/guiutil.h \ - src/qt/transactionrecord.h \ - src/qt/guiconstants.h \ - src/qt/optionsmodel.h \ - src/qt/monitoreddatamapper.h \ - src/qt/transactiondesc.h \ - src/qt/transactiondescdialog.h \ - src/qt/bitcoinamountfield.h \ - src/wallet.h \ - src/keystore.h \ - src/qt/transactionfilterproxy.h \ - src/qt/transactionview.h \ - src/qt/walletmodel.h \ - src/qt/walletview.h \ - src/qt/walletstack.h \ - src/qt/walletframe.h \ - src/bitcoinrpc.h \ - src/qt/overviewpage.h \ - src/qt/csvmodelwriter.h \ - src/crypter.h \ - src/qt/sendcoinsentry.h \ - src/qt/qvalidatedlineedit.h \ - src/qt/bitcoinunits.h \ - src/qt/qvaluecombobox.h \ - src/qt/askpassphrasedialog.h \ - src/protocol.h \ - src/qt/notificator.h \ - src/qt/paymentrequestplus.h \ - src/qt/paymentserver.h \ - src/allocators.h \ - src/ui_interface.h \ - src/qt/rpcconsole.h \ - src/version.h \ - src/netbase.h \ - src/clientversion.h \ - src/txdb.h \ - src/leveldb.h \ - src/threadsafety.h \ - src/limitedmap.h \ - src/qt/splashscreen.h \ - src/qt/intro.h \ - src/qt/walletmodeltransaction.h - -SOURCES += src/qt/bitcoin.cpp \ - src/qt/bitcoingui.cpp \ - src/qt/transactiontablemodel.cpp \ - src/qt/addresstablemodel.cpp \ - src/qt/optionsdialog.cpp \ - src/qt/sendcoinsdialog.cpp \ - src/qt/addressbookpage.cpp \ - src/qt/signverifymessagedialog.cpp \ - src/qt/aboutdialog.cpp \ - src/qt/editaddressdialog.cpp \ - src/qt/bitcoinaddressvalidator.cpp \ - src/alert.cpp \ - src/chainparams.cpp \ - src/version.cpp \ - src/sync.cpp \ - src/util.cpp \ - src/hash.cpp \ - src/netbase.cpp \ - src/key.cpp \ - src/script.cpp \ - src/core.cpp \ - src/main.cpp \ - src/init.cpp \ - src/miner.cpp \ - src/net.cpp \ - src/bloom.cpp \ - src/checkpoints.cpp \ - src/addrman.cpp \ - src/db.cpp \ - src/walletdb.cpp \ - src/qt/clientmodel.cpp \ - src/qt/guiutil.cpp \ - src/qt/transactionrecord.cpp \ - src/qt/optionsmodel.cpp \ - src/qt/monitoreddatamapper.cpp \ - src/qt/transactiondesc.cpp \ - src/qt/transactiondescdialog.cpp \ - src/qt/bitcoinstrings.cpp \ - src/qt/bitcoinamountfield.cpp \ - src/wallet.cpp \ - src/keystore.cpp \ - src/qt/transactionfilterproxy.cpp \ - src/qt/transactionview.cpp \ - src/qt/walletmodel.cpp \ - src/qt/walletview.cpp \ - src/qt/walletstack.cpp \ - src/qt/walletframe.cpp \ - src/bitcoinrpc.cpp \ - src/rpcdump.cpp \ - src/rpcnet.cpp \ - src/rpcmining.cpp \ - src/rpcwallet.cpp \ - src/rpcblockchain.cpp \ - src/rpcrawtransaction.cpp \ - src/qt/overviewpage.cpp \ - src/qt/csvmodelwriter.cpp \ - src/crypter.cpp \ - src/qt/sendcoinsentry.cpp \ - src/qt/qvalidatedlineedit.cpp \ - src/qt/bitcoinunits.cpp \ - src/qt/qvaluecombobox.cpp \ - src/qt/askpassphrasedialog.cpp \ - src/protocol.cpp \ - src/qt/notificator.cpp \ - src/qt/paymentrequestplus.cpp \ - src/qt/paymentserver.cpp \ - src/qt/rpcconsole.cpp \ - src/noui.cpp \ - src/leveldb.cpp \ - src/txdb.cpp \ - src/qt/splashscreen.cpp \ - src/qt/intro.cpp \ - src/qt/walletmodeltransaction.cpp - -RESOURCES += src/qt/bitcoin.qrc - -FORMS += src/qt/forms/sendcoinsdialog.ui \ - src/qt/forms/addressbookpage.ui \ - src/qt/forms/signverifymessagedialog.ui \ - src/qt/forms/aboutdialog.ui \ - src/qt/forms/editaddressdialog.ui \ - src/qt/forms/transactiondescdialog.ui \ - src/qt/forms/overviewpage.ui \ - src/qt/forms/sendcoinsentry.ui \ - src/qt/forms/askpassphrasedialog.ui \ - src/qt/forms/rpcconsole.ui \ - src/qt/forms/optionsdialog.ui \ - src/qt/forms/intro.ui - -PROTOS = src/qt/paymentrequest.proto -include(share/qt/protobuf.pri) - -contains(USE_QRCODE, 1) { -HEADERS += src/qt/qrcodedialog.h -SOURCES += src/qt/qrcodedialog.cpp -FORMS += src/qt/forms/qrcodedialog.ui -} - -# Todo: Remove this line when switching to Qt5, as that option was removed -CODECFORTR = UTF-8 - -# for lrelease/lupdate -# also add new translations to src/qt/bitcoin.qrc under translations/ -TRANSLATIONS = $$files(src/qt/locale/bitcoin_*.ts) - -isEmpty(QMAKE_LRELEASE) { - win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe - else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease -} -isEmpty(QM_DIR):QM_DIR = $$PWD/src/qt/locale -# automatically build translations, so they can be included in resource file -TSQM.name = lrelease ${QMAKE_FILE_IN} -TSQM.input = TRANSLATIONS -TSQM.output = $$QM_DIR/${QMAKE_FILE_BASE}.qm -TSQM.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT} -TSQM.CONFIG = no_link -QMAKE_EXTRA_COMPILERS += TSQM - -# "Other files" to show in Qt Creator -OTHER_FILES += README.md \ - doc/*.txt \ - doc/*.md \ - src/bitcoind.cpp \ - src/qt/res/bitcoin-qt.rc \ - src/test/*.cpp \ - src/test/*.h \ - src/qt/test/*.cpp \ - src/qt/test/*.h - -# platform specific defaults, if not overridden on command line -isEmpty(BOOST_LIB_SUFFIX) { - macx:BOOST_LIB_SUFFIX = -mt - win32:BOOST_LIB_SUFFIX = -mgw44-mt-s-1_50 -} - -isEmpty(BOOST_THREAD_LIB_SUFFIX) { - BOOST_THREAD_LIB_SUFFIX = $$BOOST_LIB_SUFFIX -} - -isEmpty(BDB_LIB_PATH) { - macx:BDB_LIB_PATH = /opt/local/lib/db48 -} - -isEmpty(BDB_LIB_SUFFIX) { - macx:BDB_LIB_SUFFIX = -4.8 -} - -isEmpty(BDB_INCLUDE_PATH) { - macx:BDB_INCLUDE_PATH = /opt/local/include/db48 -} - -isEmpty(BOOST_LIB_PATH) { - macx:BOOST_LIB_PATH = /opt/local/lib -} - -isEmpty(BOOST_INCLUDE_PATH) { - macx:BOOST_INCLUDE_PATH = /opt/local/include -} - -win32:DEFINES += WIN32 -win32:RC_FILE = src/qt/res/bitcoin-qt.rc - -win32:!contains(MINGW_THREAD_BUGFIX, 0) { - # At least qmake's win32-g++-cross profile is missing the -lmingwthrd - # thread-safety flag. GCC has -mthreads to enable this, but it doesn't - # work with static linking. -lmingwthrd must come BEFORE -lmingw, so - # it is prepended to QMAKE_LIBS_QT_ENTRY. - # It can be turned off with MINGW_THREAD_BUGFIX=0, just in case it causes - # any problems on some untested qmake profile now or in the future. - DEFINES += _MT - QMAKE_LIBS_QT_ENTRY = -lmingwthrd $$QMAKE_LIBS_QT_ENTRY -} - -!win32:!macx { - DEFINES += LINUX - LIBS += -lrt - # _FILE_OFFSET_BITS=64 lets 32-bit fopen transparently support large files. - DEFINES += _FILE_OFFSET_BITS=64 -} - -macx:HEADERS += src/qt/macdockiconhandler.h src/qt/macnotificationhandler.h -macx:OBJECTIVE_SOURCES += src/qt/macdockiconhandler.mm src/qt/macnotificationhandler.mm -macx:LIBS += -framework Foundation -framework ApplicationServices -framework AppKit -framework CoreServices -macx:DEFINES += MAC_OSX MSG_NOSIGNAL=0 -macx:ICON = src/qt/res/icons/bitcoin.icns -macx:QMAKE_CFLAGS_THREAD += -pthread -macx:QMAKE_LFLAGS_THREAD += -pthread -macx:QMAKE_CXXFLAGS_THREAD += -pthread -macx:QMAKE_INFO_PLIST = share/qt/Info.plist - -# Set libraries and includes at end, to use platform-defined defaults if not overridden -INCLUDEPATH += $$BOOST_INCLUDE_PATH $$BDB_INCLUDE_PATH $$OPENSSL_INCLUDE_PATH $$PROTOBUF_INCLUDE_PATH $$QRENCODE_INCLUDE_PATH -LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB_PATH,,-L,) $$join(PROTOBUF_LIB_PATH,,-L,) $$join(QRENCODE_LIB_PATH,,-L,) -LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX -lprotobuf -# -lgdi32 has to happen after -lcrypto (see #681) -win32:LIBS += -lws2_32 -lshlwapi -lmswsock -lole32 -loleaut32 -luuid -lgdi32 -LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX -win32:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX -macx:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX - -contains(RELEASE, 1) { - !win32:!macx { - # Linux: turn dynamic linking back on for c/c++ runtime libraries - LIBS += -Wl,-Bdynamic - } -} - -system($$QMAKE_LRELEASE -silent $$TRANSLATIONS) diff --git a/configure.ac b/configure.ac new file mode 100644 index 000000000..aa4bb8bfd --- /dev/null +++ b/configure.ac @@ -0,0 +1,714 @@ +dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) +AC_PREREQ([2.60]) +define(_CLIENT_VERSION_MAJOR, 0) +define(_CLIENT_VERSION_MINOR, 8) +define(_CLIENT_VERSION_REVISION, 99) +define(_CLIENT_VERSION_BUILD, 0) +define(_CLIENT_VERSION_IS_RELEASE, false) +define(_COPYRIGHT_YEAR, 2013) +AC_INIT([Bitcoin],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@bitcoin.org],[bitcoin]) +AC_CONFIG_AUX_DIR([src/build-aux]) +AC_CONFIG_MACRO_DIR([src/m4]) +AC_CANONICAL_HOST +AH_TOP([#ifndef BITCOIN_CONFIG_H]) +AH_TOP([#define BITCOIN_CONFIG_H]) +AH_BOTTOM([#endif //BITCOIN_CONFIG_H]) + +# This m4 will only be used if a system copy cannot be found. This is helpful +# on systems where autotools are installed but the pkg-config macros are not in +# a default location. It is currently used for building on OSX where autotools +# are preinstalled but pkg-config comes from macports or homebrew. It should +# probably be removed when building on <= 10.6 is no longer supported. +m4_include([pkg.m4]) + +dnl reset CXXFLAGS if empty (autoconf adds its own defaults otherwise) +: ${CFLAGS=""} +: ${CXXFLAGS=""} + +dnl faketime breaks configure and is only needed for make. Disable it here. +unset FAKETIME + +dnl ============================================================== +dnl Setup for automake +dnl ============================================================== + +AM_INIT_AUTOMAKE([no-define subdir-objects foreign]) + +dnl faketime messes with timestamps and causes configure to be re-run. +dnl --disable-maintainer-mode can be used to bypass this. +AM_MAINTAINER_MODE([enable]) + +dnl make the compilation flags quiet unless V=1 is used +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +AC_ARG_WITH([miniupnpc], + [AS_HELP_STRING([--with-miniupnpc], + [enable UPNP (default is yes if libminiupnpc is found)])], + [use_upnp=$withval], + [use_upnp=auto]) + +AC_ARG_ENABLE([upnp-default], + [AS_HELP_STRING([--enable-upnp-default], + [if UPNP is enabled, turn it on at startup (default is no)])], + [use_upnp_default=$enableval], + [use_upnp_default=no]) + +dnl enable ipv6 support +AC_ARG_ENABLE([ipv6], + [AS_HELP_STRING([--enable-ipv6], + [enable ipv6 (default is yes)])], + [use_ipv6=$enableval], + [use_ipv6=yes]) + +dnl enable qt support +AC_ARG_WITH([qt], + [AS_HELP_STRING([--with-qt], + [enable qt (default is yes)])], + [use_qt=$withval], + [use_qt=yes]) + +dnl compile with full warnings and debugging symbols +AC_ARG_ENABLE(debug, + AS_HELP_STRING([--enable-debug],[compile with debug symbols (default is yes)]), + [use_debug=$enableval], + [use_debug=yes]) + AC_MSG_CHECKING([if compiling with debugging symbols]) + +AC_ARG_ENABLE(tests, + AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]), + [use_tests=$enableval], + [use_tests=yes]) + +AC_ARG_WITH([comparison-tool], + AS_HELP_STRING([with-comparison-tool],[path to java comparison tool (requires --enable-tests)]), + [use_comparison_tool=$withval], + [use_comparison_tool=no]) + +AC_ARG_WITH([qrencode], + [AS_HELP_STRING([--with-qrencode], + [enable QR code support (default is yes if qt is enabled and libqrencode is found)])], + [use_qr=$withval], + [use_qr=auto]) + +AC_ARG_WITH([qtdbus], + [AS_HELP_STRING([--with-qtdbus], + [enable DBus support (default is yes if qt is enabled and QtDBus is found)])], + [use_dbus=$withval], + [use_dbus=auto]) + +AC_ARG_ENABLE([hardening], + [AS_HELP_STRING([--enable-hardening], + [attempt to harden the resulting executables (default is yes)])], + [use_hardening=$enableval], + [use_hardening=yes]) + +AC_ARG_ENABLE([ccache], + [AS_HELP_STRING([--enable-ccache], + [enable building with ccache (default is yes if ccache is found)])], + [use_ccache=$enableval], + [use_ccache=auto]) + +AC_ARG_ENABLE([lcov], + [AS_HELP_STRING([--enable-lcov], + [enable lcov testing (default is no)])], + [use_lcov=yes], + [use_lcov=no]) + +AC_ARG_WITH([qt-incdir],[AS_HELP_STRING([--with-qt-incdir=INC_DIR],[specify qt include path (overridden by pkgconfig)])], [qt_include_path=$withval], []) +AC_ARG_WITH([qt-libdir],[AS_HELP_STRING([--with-qt-libdir=LIB_DIR],[specify qt lib path (overridden by pkgconfig)])], [qt_lib_path=$withval], []) +AC_ARG_WITH([qt-bindir],[AS_HELP_STRING([--with-qt-bindir=BIN_DIR],[specify qt bin path])], [qt_bin_path=$withval], []) +AC_ARG_WITH([qt-plugindir],[AS_HELP_STRING([--with-qt-plugindir=PLUGIN_DIR],[specify qt plugin path (overridden by pkgconfig)])], [qt_plugin_path=$withval], []) +AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], []) + + +AC_CONFIG_SRCDIR([src]) +AC_CONFIG_HEADERS([src/bitcoin-config.h]) + +dnl Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_OBJC +m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX]) +AC_PROG_MKDIR_P +AC_PROG_SED +AC_PATH_TOOL(AR, ar) +AC_PATH_TOOL(RANLIB, ranlib) +AC_PATH_TOOL(WINDRES, windres) +AC_PATH_TOOL(STRIP, strip) +AC_PATH_TOOL(GCOV, gcov) +AC_PATH_PROG(LCOV, lcov) +AC_PATH_PROG(JAVA, java) +AC_PATH_PROG(GENHTML, genhtml) +AC_PATH_PROG([GIT], [git]) +AC_PATH_PROGS([MOC], [moc moc-qt4],, $qt_bin_path:$PATH) +AC_PATH_PROGS([UIC], [uic uic-qt4],, $qt_bin_path:$PATH) +AC_PATH_PROG([RCC], [rcc],, $qt_bin_path:$PATH) +AC_PATH_PROG([LRELEASE], [lrelease],, $qt_bin_path:$PATH) +AC_PATH_PROG([PROTOC], [protoc],, $protoc_bin_path:$PATH) +AC_PATH_PROG(CCACHE,ccache) +PKG_PROG_PKG_CONFIG + +## TODO: Remove these hard-coded paths and flags. They are here for the sake of +## compatibility with the legacy buildsystem. +## +CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter" +CPPFLAGS="$CPPFLAGS -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO" +DEBUG_CXXFLAGS="-g -ggdb" +RELEASE_CXXFLAGS="-O2" + +AC_LANG_PUSH([C++]) + +use_pkgconfig=yes +case $host in + *mingw*) + + #pkgconfig does more harm than good with mingw + use_pkgconfig=no + + TARGET_OS=windows + AC_CHECK_LIB([mingwthrd], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([kernel32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([gdi32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([comdlg32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([winspool], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([winmm], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([shell32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([comctl32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([ole32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([oleaut32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([uuid], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([rpcrt4], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([advapi32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([ws2_32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([mswsock], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([shlwapi], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(lib missing)) + + AC_PATH_PROG([MAKENSIS], [makensis], none) + if test x$MAKENSIS = xnone; then + AC_MSG_WARN("makensis not found. Cannot create installer.") + fi + + CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB" + LEVELDB_TARGET_FLAGS="TARGET_OS=OS_WINDOWS_CROSSCOMPILE" + CXXFLAGS="$CXXFLAGS -w" + ;; + *darwin*) + TARGET_OS=darwin + LEVELDB_TARGET_FLAGS="TARGET_OS=Darwin" + if test x$cross_compiling != xyes; then + AC_CHECK_PROG([PORT],port, port) + if test x$PORT = xport; then + dnl add default macports paths + CPPFLAGS="$CPPFLAGS -I/opt/local/include -I/opt/local/include/db48" + LIBS="$LIBS -L/opt/local/lib -L/opt/local/lib/db48" + fi + + AC_CHECK_PROG([BREW],brew, brew) + if test x$BREW = xbrew; then + dnl add default homebrew paths + openssl_prefix=`$BREW --prefix openssl` + bdb_prefix=`$BREW --prefix berkeley-db4` + export PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" + CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include" + LIBS="$LIBS -L/$bdb_prefix/lib" + fi + fi + + if test x$use_qt = xyes; then + MOC_DEFS="-DQ_OS_MAC" + base_frameworks="-framework Foundation -framework ApplicationServices -framework AppKit" + AX_CHECK_LINK_FLAG([[$base_frameworks]],[LIBS="$LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)]) + fi + + AX_CHECK_COMPILE_FLAG([-mmacosx-version-min=10.5],[RELEASE_CXXFLAGS="$RELEASE_CXXFLAGS -mmacosx-version-min=10.5"]) + AX_CHECK_COMPILE_FLAG([-arch i386],[RELEASE_CXXFLAGS="$RELEASE_CXXFLAGS -arch i386"]) + RELEASE_CXXFLAGS="$RELEASE_CXXFLAGS -O3" + CPPFLAGS="$CPPFLAGS -DMAC_OSX" + TESTDEFS="-DBOOST_TEST_DYN_LINK" + ;; + *) + TESTDEFS="-DBOOST_TEST_DYN_LINK" + ;; +esac + +if test x$use_debug == xyes; then + CXXFLAGS="$DEBUG_CXXFLAGS $CXXFLAGS" +else + CXXFLAGS="$RELEASE_CXXFLAGS $CXXFLAGS" +fi + +if test x$use_comparison_tool != xno; then + AC_SUBST(JAVA_COMPARISON_TOOL, $use_comparison_tool) +fi + +if test x$use_lcov == xyes; then + if test x$LCOV == x; then + AC_MSG_ERROR("lcov testing requested but lcov not found") + fi + if test x$GCOV == x; then + AC_MSG_ERROR("lcov testing requested but gcov not found") + fi + if test x$JAVA == x; then + AC_MSG_ERROR("lcov testing requested but java not found") + fi + if test x$GENHTML == x; then + AC_MSG_ERROR("lcov testing requested but genhtml not found") + fi + if test x$use_comparison_tool == x; then + AC_MSG_ERROR("lcov testing requested but comparison tool was not specified") + fi + LCOV="$LCOV --gcov-tool=$GCOV" + AX_CHECK_COMPILE_FLAG([--coverage],[CXXFLAGS="$CXXFLAGS --coverage"], + [AC_MSG_ERROR("lcov testing requested but --coverage flag does not work")]) +fi + +dnl Require little endian +AC_C_BIGENDIAN([AC_MSG_ERROR("Big Endian not supported")]) + +dnl Check for pthread compile/link requirements +AX_PTHREAD +INCLUDES="$INCLUDES $PTHREAD_CFLAGS" + +# The following macro will add the necessary defines to bitcoin-config.h, but +# they also need to be passed down to any subprojects. Pull the results out of +# the cache and add them to CPPFLAGS. +AC_SYS_LARGEFILE + +if test x$ac_cv_sys_file_offset_bits != x && + test x$ac_cv_sys_file_offset_bits != xno && + test x$ac_cv_sys_file_offset_bits != xunknown; then + CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" +fi + +if test x$ac_cv_sys_large_files != x && + test x$ac_cv_sys_large_files != xno && + test x$ac_cv_sys_large_files != xunknown; then + CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files" +fi + +AX_CHECK_LINK_FLAG([[-Wl,--large-address-aware]], [LDFLAGS="$LDFLAGS -Wl,--large-address-aware"]) + +if test x$use_hardening != xno; then + AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"]) + AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"]) + + AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -D_FORTIFY_SOURCE=2"]) + + AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"]) + AX_CHECK_LINK_FLAG([[-Wl,--nxcompat]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"]) + AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [LDFLAGS="-Wl,-z,relro"]) + AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [LDFLAGS="-Wl,-z,now"]) + + if test x$TARGET_OS != xwindows; then + # -fstack-protector-all can produce broken binaries with mingw + AX_CHECK_COMPILE_FLAG([-fno-stack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fno-stack-protector"]) + AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"]) + + # -pie will link successfully with mingw, but it's unsupported and leads to undeterministic binaries + AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"]) + fi + + CXXFLAGS="$CXXFLAGS $HARDENED_CXXFLAGS" + CPPFLAGS="$CPPFLAGS $HARDENED_CPPFLAGS" + LDFLAGS="$LDFLAGS $HARDENED_LDFLAGS" + OBJCXXFLAGS="$CXXFLAGS" +fi + +dnl this flag screws up non-darwin gcc even when the check fails. special-case it. +if test x$TARGET_OS = xdarwin; then + AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"]) +fi + +AC_CHECK_HEADERS([stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h]) + +dnl Check for MSG_NOSIGNAL +AC_MSG_CHECKING(for MSG_NOSIGNAL) +AC_TRY_COMPILE([#include ], + [ int f = MSG_NOSIGNAL; ], + [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MSG_NOSIGNAL, 1,[Define this symbol if you have MSG_NOSIGNAL]) ], + [ AC_MSG_RESULT(no)] +) + +dnl Check for libdb_cxx +AC_CHECK_HEADER([db_cxx.h],,AC_MSG_ERROR(libdb_cxx headers missing)) +AC_CHECK_LIB([db_cxx], [main],, AC_MSG_ERROR(libdb_cxx missing)) + +dnl Check for libminiupnpc (optional) +if test x$use_upnp != xno; then + AC_CHECK_LIB([miniupnpc], [main],, [have_miniupnpc=no]) +fi + +dnl Check for boost libs +AX_BOOST_BASE +AX_BOOST_SYSTEM +AX_BOOST_FILESYSTEM +AX_BOOST_PROGRAM_OPTIONS +AX_BOOST_THREAD +AX_BOOST_CHRONO + +if test x$use_tests = xyes; then + AX_BOOST_UNIT_TEST_FRAMEWORK +fi + +BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_PROGRAM_OPTIONS_LIB $BOOST_THREAD_LIB" +BOOST_INCLUDES="$BOOST_CPPFLAGS" + +dnl Boost >= 1.50 uses sleep_for rather than the now-deprecated sleep, however +dnl it was broken from 1.50 to 1.52 when backed by nanosleep. Use sleep_for if +dnl a working version is available, else fall back to sleep. sleep was removed +dnl after 1.56. +dnl If neither is available, abort. +dnl If sleep_for is used, boost_chrono becomes a requirement. +if test x$ax_cv_boost_chrono = xyes; then +TEMP_LIBS="$LIBS" +LIBS="$LIBS $BOOST_LIBS $BOOST_CHRONO_LIB" +AC_TRY_LINK([ + #include + #include + ],[ + #if BOOST_VERSION >= 105000 && (!defined(BOOST_HAS_NANOSLEEP) || BOOST_VERSION >= 105200) + boost::this_thread::sleep_for(boost::chrono::milliseconds(0)); + #else + choke me + #endif + ], + [boost_sleep=yes; BOOST_LIBS="$BOOST_LIBS $BOOST_CHRONO_LIB"; + AC_DEFINE(HAVE_WORKING_BOOST_SLEEP_FOR, 1, [Define this symbol if boost sleep_for works])], + [boost_sleep=no]) +LIBS="$TEMP_LIBS" +fi + +if test x$boost_sleep != xyes; then +TEMP_LIBS="$LIBS" +LIBS="$LIBS $BOOST_LIBS" +AC_TRY_LINK([ + #include + #include + #include + ],[ + #if BOOST_VERSION <= 105600 + boost::this_thread::sleep(boost::posix_time::milliseconds(0)); + #else + choke me + #endif + ], + [boost_sleep=yes; AC_DEFINE(HAVE_WORKING_BOOST_SLEEP, 1, [Define this symbol if boost sleep works])], + [boost_sleep=no]) +LIBS="$TEMP_LIBS" +fi + +if test x$boost_sleep != xyes; then + AC_MSG_ERROR(No working boost sleep implementation found) +fi + +if test x$use_pkgconfig = xyes; then + + if test x$PKG_CONFIG == x; then + AC_MSG_ERROR(pkg-config not found.)] + fi + + : #NOP + m4_ifdef( + [PKG_CHECK_MODULES], + [ + PKG_CHECK_MODULES([SSL], [libssl], [INCLUDES="$INCLUDES $SSL_CFLAGS"; LIBS="$LIBS $SSL_LIBS"], [AC_MSG_ERROR(openssl not found.)]) + PKG_CHECK_MODULES([CRYPTO], [libcrypto], [INCLUDES="$INCLUDES $CRYPTO_CFLAGS"; LIBS="$LIBS $CRYPTO_LIBS"], [AC_MSG_ERROR(libcrypto not found.)]) + + if test x$use_qt = xyes; then + PKG_CHECK_MODULES([QT], [QtCore QtGui QtNetwork], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes], [have_qt=no]) + if test x$use_tests = xyes; then + PKG_CHECK_MODULES([QT_TEST], [QtTest], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no]) + fi + if test x$use_dbus != xno; then + PKG_CHECK_MODULES([QT_DBUS], [QtDBus], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no]) + fi + if test x$use_qr != xno; then + PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no]) + fi + PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [AC_MSG_ERROR(libprotobuf not found.)]) + fi + ] + ) +else + AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing)) + AC_CHECK_LIB([crypto], [main],, AC_MSG_ERROR(libcrypto missing)) + + AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),) + AC_CHECK_LIB([ssl], [main],, AC_MSG_ERROR(libssl missing)) + + if test x$use_qt = xyes; then + TEMP_LIBS="$LIBS" + LIBS= + if test x$qt_lib_path != x; then + QT_LIBS="$QT_LIBS -L$qt_lib_path" + LIBS="$QT_LIBS" + fi + if test x$qt_plugin_path != x; then + QT_LIBS="$QT_LIBS -L$qt_plugin_path/codecs" + LIBS="$QT_LIBS" + fi + + if test x$TARGET_OS == xwindows; then + AC_CHECK_LIB([imm32], [main],, AC_MSG_ERROR(libimm32 not found. Install it or use --without-qt.)) + fi + + #TODO: These are only needed when they're linked directly to parent libs. It really has nothing to do with windows. + #Instead, check for missing functions in parent libs and assume static if they're absent. + if test x$TARGET_OS == xwindows; then + AC_CHECK_LIB([qcncodecs], [main],, AC_MSG_ERROR(libqcncodecs not found. Install it or use --without-qt.)) + AC_CHECK_LIB([qjpcodecs], [main],, AC_MSG_ERROR(libqjpcodecs not found. Install it or use --without-qt.)) + AC_CHECK_LIB([qkrcodecs], [main],, AC_MSG_ERROR(libqkrcodecs not found. Install it or use --without-qt.)) + AC_CHECK_LIB([qtwcodecs], [main],, AC_MSG_ERROR(libqtwcodecs not found. Install it or use --without-qt.)) + fi + + AC_CHECK_LIB([QtCore], [main],, AC_MSG_ERROR(libQtCore not found. Install it or use --without-qt.)) + AC_CHECK_LIB([QtGui], [main],, AC_MSG_ERROR(libQtGui not found. Install it or use --without-qt.)) + AC_CHECK_LIB([QtNetwork], [main],, AC_MSG_ERROR(libQtNetwork not found. Install it or use --without-qt.)) + AC_CHECK_LIB([protobuf], [main],, AC_MSG_ERROR(libprotobuf not found. Install it or use --without-qt.)) + QT_LIBS="$LIBS" + LIBS="$TEMP_LIBS" + + TEMP_CPPFLAGS="$CPPFLAGS" + if test x$qt_include_path != x; then + 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" + CPPFLAGS="$CPPFLAGS $QT_INCLUDES" + fi + AC_CHECK_HEADER([QtPlugin],, AC_MSG_ERROR(QtCore headers missing. Install them or use --without-qt.),) + AC_CHECK_HEADER([QApplication],, AC_MSG_ERROR(QtGUI headers missing. Install them or use --without-qt.),) + AC_CHECK_HEADER([QLocalSocket],, AC_MSG_ERROR(QtNetwork headers missing. Install them or use --without-qt.),) + + if test x$use_tests = xyes; then + TEMP_LIBS="$LIBS" + LIBS= + if test x$qt_lib_path != x; then + LIBS="-L$qt_lib_path" + fi + AC_CHECK_LIB([QtTest], [main],, have_qt_test=no) + AC_CHECK_HEADER([QTest],, have_qt_test=no) + QT_TEST_LIBS="$LIBS" + LIBS="$TEMP_LIBS" + fi + if test x$use_dbus != xno; then + TEMP_LIBS="$LIBS" + LIBS= + if test x$qt_lib_path != x; then + LIBS="-L$qt_lib_path" + fi + AC_CHECK_LIB([QtDBus], [main],, have_qt_dbus=no) + AC_CHECK_HEADER([QtDBus],, have_qt_dbus=no) + QT_DBUS_LIBS="$LIBS" + LIBS="$TEMP_LIBS" + fi + CPPFLAGS="$TEMP_CPPFLAGS" + if test x$use_qr != xno; then + AC_CHECK_LIB([qrencode], [main],, [have_qrencode=no]) + AC_CHECK_HEADER([qrencode.h],, have_qrencode=no) + fi + fi +fi + +if test x$use_ipv6 = xyes; then + dnl Check for ipv6 build requirements + AC_MSG_CHECKING(for IPV6 build support) + AC_TRY_LINK([ + #if defined(_WINDOWS) + #include + #else + #include + #include + #include + #endif + ],[ + #if !defined(_WINDOWS) + struct in6_addr ipv6Addr; + struct sockaddr_in6 addr; + #endif + int temp = socket(AF_INET6, SOCK_STREAM, 0);], + [AC_MSG_RESULT(yes); have_ipv6=yes; AC_DEFINE(HAVE_IPV6, 1, [Define this symbol if you have ipv6 build support])], + [AC_MSG_RESULT(no)]; have_ipv6=no) +fi +AC_LANG_POP + +if test "x$use_ccache" != "xno"; then + AC_MSG_CHECKING(if ccache should be enabled) + if test x$CCACHE = x; then + if test "x$use_ccache" = "xyes"; then + AC_MSG_ERROR([ccache not found.]); + else + AC_MSG_NOTICE([ccache not found. Falling back to default CC]) + use_ccache=no + fi + else + use_ccache=yes + CC="$ac_cv_path_CCACHE $CC" + CXX="$ac_cv_path_CCACHE $CXX" + fi + AC_MSG_RESULT($use_ccache) +fi + +dnl enable ipv6 support +AC_MSG_CHECKING([if ipv6 should be enabled]) +if test x$have_ipv6 = xno; then + if test x$use_ipv6 = xyes; then + AC_MSG_ERROR("ipv6 requested but cannot be built. use --disable-ipv6") + fi + AC_MSG_RESULT(no) +else + if test x$use_ipv6 = xyes; then + AC_MSG_RESULT(yes) + AC_DEFINE([USE_IPV6],[1],[Define if ipv6 support should be compiled in]) + else + AC_MSG_RESULT(no) + fi +fi + +dnl enable upnp support +AC_MSG_CHECKING([if upnp should be enabled]) +if test x$have_miniupnpc = xno; then + if test x$use_upnp = xyes; then + AC_MSG_ERROR("upnp requested but cannot be built. use --without-miniupnpc") + fi + AC_MSG_RESULT(no) +else + if test x$use_upnp != xno; then + AC_MSG_RESULT(yes) + AC_MSG_CHECKING([if upnp should be on by default]) + use_upnp=yes + upnp_setting=0 + if test x$use_upnp_default != xno; then + use_upnp_default=yes + upnp_setting=1 + fi + AC_MSG_RESULT($use_upnp_default) + AC_DEFINE_UNQUOTED([USE_UPNP],[$upnp_setting],[Define to 1 for upnp runtime support]) + if test x$TARGET_OS = xwindows; then + CPPFLAGS="$CPPFLAGS -DSTATICLIB" + fi + else + AC_MSG_RESULT(no) + fi +fi + +dnl enable qt support +AC_MSG_CHECKING([if qt should be enabled]) +if test x$use_qt = xyes; then + if test x$have_qt = xno; then + AC_MSG_ERROR("qt support requested but qt could not be located. use --without-qt") + fi + if test x$MOC = x; then + AC_MSG_ERROR("qt support requested but moc was not found. use --without-qt") + fi + if test x$PROTOC = x; then + AC_MSG_ERROR("qt support requested but protoc was not found. use --without-qt") + fi + if test x$UIC = x; then + AC_MSG_ERROR("qt support requested but uic was not found. use --without-qt") + fi + if test x$RCC = x; then + AC_MSG_ERROR("qt support requested but rcc was not found. use --without-qt") + fi + if test x$LRELEASE = x; then + AC_MSG_ERROR("qt support requested but lrelease was not found. use --without-qt") + fi + if test x$use_tests = xyes; then + if test x$have_qt_test = xno; then + AC_MSG_ERROR("libQtTest not found. Use --disable-tests or --without-qt.") + fi + fi + if test x$have_qt_dbus = xno; then + use_dbus=no + if test x$use_dbus = xyes; then + AC_MSG_ERROR("libQtDBus not found. Use --without-qtdbus.") + fi + fi + BUILD_QT=qt +else + use_qt=no +fi + +AC_MSG_RESULT($use_qt) + +dnl these are only used when qt is enabled +if test x$use_qt = xyes; then + + dnl enable dbus support + AC_MSG_CHECKING([if dbus should be enabled]) + if test x$use_dbus != xno; then + use_dbus=yes + AC_DEFINE([USE_DBUS],[1],[Define if dbus support should be compiled in]) + else + use_dbus=no + fi + AC_MSG_RESULT($use_dbus) + + dnl enable qr support + AC_MSG_CHECKING([if qr should be enabled]) + if test x$have_qrencode = xno; then + if test x$use_qr == xyes; then + AC_MSG_ERROR("QR support requested but cannot be built. use --without-qrencode") + fi + AC_MSG_RESULT(no) + else + if test x$use_qr != xno; then + AC_MSG_RESULT(yes) + AC_DEFINE([USE_QRCODE],[1],[Define if QR support should be compiled in]) + use_qr=yes + else + AC_MSG_RESULT(no) + fi + fi + + if test x$use_tests = xyes; then + BUILD_TEST_QT="test" + fi +fi + +if test x$use_tests = xyes; then + BUILD_TEST="test" +fi + +AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin]) +AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows]) +AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes]) +AM_CONDITIONAL([USE_LCOV],[test x$use_lcov == xyes]) +AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno]) + +AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version]) +AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version]) +AC_DEFINE(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION, [Build revision]) +AC_DEFINE(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD, [Version Build]) +AC_DEFINE(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE, [Version is release]) +AC_DEFINE(COPYRIGHT_YEAR, _COPYRIGHT_YEAR, [Version is release]) +AC_SUBST(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR) +AC_SUBST(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR) +AC_SUBST(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION) +AC_SUBST(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD) +AC_SUBST(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE) +AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR) + + +AC_SUBST(USE_UPNP) +AC_SUBST(USE_QRCODE) +AC_SUBST(USE_IPV6) +AC_SUBST(INCLUDES) +AC_SUBST(BOOST_LIBS) +AC_SUBST(MOC_DEFS) +AC_SUBST(QT_INCLUDES) +AC_SUBST(QT_TEST_LIBS) +AC_SUBST(QT_LIBS) +AC_SUBST(QT_DBUS_LIBS) +AC_SUBST(QT_DBUS_INCLUDES) +AC_SUBST(QT_TEST_INCLUDES) +AC_SUBST(TESTDEFS) +AC_SUBST(LEVELDB_TARGET_FLAGS) +AC_SUBST(BUILD_QT) +AC_SUBST(BUILD_TEST) +AC_SUBST(BUILD_TEST_QT) +AC_CONFIG_FILES([Makefile src/Makefile src/test/Makefile src/qt/Makefile src/qt/test/Makefile share/setup.nsi share/qt/Info.plist]) +AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh]) +AC_CONFIG_FILES([qa/pull-tester/build-tests.sh],[chmod +x qa/pull-tester/build-tests.sh]) +AC_OUTPUT diff --git a/contrib/bitcoin-qt.pro b/contrib/bitcoin-qt.pro new file mode 100644 index 000000000..0b181ef44 --- /dev/null +++ b/contrib/bitcoin-qt.pro @@ -0,0 +1,17 @@ +FORMS += \ + ../src/qt/forms/transactiondescdialog.ui \ + ../src/qt/forms/signverifymessagedialog.ui \ + ../src/qt/forms/sendcoinsentry.ui \ + ../src/qt/forms/sendcoinsdialog.ui \ + ../src/qt/forms/rpcconsole.ui \ + ../src/qt/forms/qrcodedialog.ui \ + ../src/qt/forms/overviewpage.ui \ + ../src/qt/forms/optionsdialog.ui \ + ../src/qt/forms/intro.ui \ + ../src/qt/forms/editaddressdialog.ui \ + ../src/qt/forms/askpassphrasedialog.ui \ + ../src/qt/forms/addressbookpage.ui \ + ../src/qt/forms/aboutdialog.ui + +RESOURCES += \ + ../src/qt/bitcoin.qrc diff --git a/contrib/gitian-descriptors/boost-win32.yml b/contrib/gitian-descriptors/boost-win32.yml index 1eeb9eaa2..b31a49760 100644 --- a/contrib/gitian-descriptors/boost-win32.yml +++ b/contrib/gitian-descriptors/boost-win32.yml @@ -13,8 +13,8 @@ remotes: [] files: - "boost_1_50_0.tar.bz2" script: | - TMPDIR="$HOME/tmpdir" - mkdir -p $TMPDIR/bin/$GBUILD_BITS $TMPDIR/include + INSTALLPREFIX="$OUTDIR/staging/boost" + mkdir -p "$INSTALLPREFIX" tar xjf boost_1_50_0.tar.bz2 cd boost_1_50_0 echo "using gcc : 4.4 : i586-mingw32msvc-g++ @@ -24,15 +24,10 @@ script: | -frandom-seed=boost1 ;" > user-config.jam ./bootstrap.sh --without-icu - ./bjam toolset=gcc target-os=windows threadapi=win32 threading=multi variant=release link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete $MAKEOPTS stage - for lib in chrono date_time exception filesystem graph iostreams math_c99f math_c99l math_c99 math_tr1f math_tr1l math_tr1 prg_exec_monitor program_options random regex serialization signals system test_exec_monitor thread_win32 unit_test_framework wave wserialization; do - mkdir $lib - (cd $lib ; ar xf ../stage/lib/libboost_${lib}-mt-s.a) - mv $lib $TMPDIR/bin/$GBUILD_BITS - done - cp -a boost $TMPDIR/include - cd $TMPDIR + ./bjam toolset=gcc target-os=windows threadapi=win32 threading=multi variant=release link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete --prefix="$INSTALLPREFIX" $MAKEOPTS install + + cd "$INSTALLPREFIX" export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME - zip -r boost-win32-1.50.0-gitian2.zip * - cp boost-win32-1.50.0-gitian2.zip $OUTDIR + zip -r boost-win32-1.50.0-gitian3.zip * + cp boost-win32-1.50.0-gitian3.zip $OUTDIR diff --git a/contrib/gitian-descriptors/deps-win32.yml b/contrib/gitian-descriptors/deps-win32.yml index 90f4c6c4b..98f69dddf 100644 --- a/contrib/gitian-descriptors/deps-win32.yml +++ b/contrib/gitian-descriptors/deps-win32.yml @@ -25,48 +25,58 @@ script: | export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME export TZ=UTC + export INSTALLPREFIX=$OUTDIR/staging/deps + export HOST=i586-mingw32msvc # + mkdir -p $INSTALLPREFIX + tar xzf openssl-1.0.1c.tar.gz cd openssl-1.0.1c - ./Configure --cross-compile-prefix=i586-mingw32msvc- mingw + ./Configure --cross-compile-prefix=$HOST- mingw --openssldir=$INSTALLPREFIX make + make install_sw cd .. # tar xzf db-4.8.30.NC.tar.gz cd db-4.8.30.NC/build_unix - ../dist/configure --enable-mingw --enable-cxx --host=i586-mingw32msvc CFLAGS="-I/usr/i586-mingw32msvc/include" - make $MAKEOPTS + ../dist/configure --prefix=$INSTALLPREFIX --enable-mingw --enable-cxx --host=$HOST + make $MAKEOPTS library_build + make install_lib install_include cd ../.. # tar xzf miniupnpc-1.6.tar.gz cd miniupnpc-1.6 sed 's/dllwrap -k --driver-name gcc/$(DLLWRAP) -k --driver-name $(CC)/' -i Makefile.mingw sed 's|wingenminiupnpcstrings $< $@|./wingenminiupnpcstrings $< $@|' -i Makefile.mingw - make -f Makefile.mingw DLLWRAP=i586-mingw32msvc-dllwrap CC=i586-mingw32msvc-gcc AR=i586-mingw32msvc-ar + mkdir -p dll + make -f Makefile.mingw DLLWRAP=$HOST-dllwrap CC=$HOST-gcc AR=$HOST-ar libminiupnpc.a + install -d $INSTALLPREFIX/include/miniupnpc + install *.h $INSTALLPREFIX/include/miniupnpc + install libminiupnpc.a $INSTALLPREFIX/lib cd .. - mv miniupnpc-1.6 miniupnpc # tar xzf zlib-1.2.6.tar.gz cd zlib-1.2.6 - make -f win32/Makefile.gcc PREFIX=i586-mingw32msvc- $MAKEOPTS + CROSS_PREFIX=$HOST- ./configure --prefix=$INSTALLPREFIX --static + make + make install cd .. # tar xzf libpng-1.5.9.tar.gz cd libpng-1.5.9 - ./configure -disable-shared CC=i586-mingw32msvc-cc AR=i586-mingw32msvc-ar STRIP=i586-mingw32msvc-strip RANLIB=i586-mingw32msvc-ranlib OBJDUMP=i586-mingw32msvc-objdump LD=i586-mingw32msvc-ld LDFLAGS="-L../zlib-1.2.6/" CFLAGS="-I../zlib-1.2.6/" + CFLAGS="-I$INSTALLPREFIX/include" LDFLAGS="-L$INSTALLPREFIX/lib" ./configure --disable-shared --prefix=$INSTALLPREFIX --host=$HOST make $MAKEOPTS + make install cd .. # tar xjf qrencode-3.2.0.tar.bz2 cd qrencode-3.2.0 - ./configure CC=i586-mingw32msvc-cc AR=i586-mingw32msvc-ar STRIP=i586-mingw32msvc-strip RANLIB=i586-mingw32msvc-ranlib OBJDUMP=i586-mingw32msvc-objdump LD=i586-mingw32msvc-ld png_LIBS="../libpng-1.5.9/.libs/libpng15.a ../zlib-1.2.6/libz.a" png_CFLAGS="-I../libpng-1.5.9" - make $MAKEOPTS + png_CFLAGS="-I$INSTALLPREFIX/include" png_LIBS="-L$INSTALLPREFIX/lib -lpng" ./configure --prefix=$INSTALLPREFIX --host=i586-mingw32msvc + make + make install cd .. # - zip -r $OUTDIR/bitcoin-deps-0.0.5.zip \ - $(ls qrencode-*/{qrencode.h,.libs/libqrencode.{,l}a} | sort) \ - $(ls db-*/build_unix/{libdb_cxx.a,db.h,db_cxx.h,libdb.a,.libs/libdb_cxx-?.?.a} | sort) \ - $(find openssl-* -name '*.a' -o -name '*.h' | sort) \ - $(find miniupnpc -name '*.h' -o -name 'libminiupnpc.a' | sort) + cd $INSTALLPREFIX + zip -r $OUTDIR/bitcoin-deps-0.0.6.zip include lib # Kill wine processes as gitian won't figure out we are done otherwise killall wineserver services.exe explorer.exe winedevice.exe diff --git a/contrib/gitian-descriptors/gitian-win32.yml b/contrib/gitian-descriptors/gitian-win32.yml index 5fc5a5a16..04643c152 100644 --- a/contrib/gitian-descriptors/gitian-win32.yml +++ b/contrib/gitian-descriptors/gitian-win32.yml @@ -10,69 +10,48 @@ packages: - "unzip" - "nsis" - "faketime" -reference_datetime: "2011-01-30 00:00:00" +- "autoconf2.13" +- "libtool" +- "automake" +- "pkg-config" + +reference_datetime: "2013-06-01 00:00:00" remotes: - "url": "https://github.com/bitcoin/bitcoin.git" "dir": "bitcoin" files: -- "qt-win32-4.8.3-gitian-r2.zip" -- "boost-win32-1.50.0-gitian2.zip" -- "bitcoin-deps-0.0.5.zip" -- "protobuf-win32-2.5.0-gitian-r1.zip" +- "qt-win32-4.8.3-gitian-r3.zip" +- "boost-win32-1.50.0-gitian3.zip" +- "bitcoin-deps-0.0.6.zip" +- "protobuf-win32-2.5.0-gitian-r2.zip" script: | # - export QTDIR=$HOME/qt - mkdir $QTDIR - cd $QTDIR - unzip ../build/qt-win32-4.8.3-gitian-r2.zip + STAGING=$HOME/staging + mkdir -p $STAGING + cd $STAGING + unzip ../build/qt-win32-4.8.3-gitian-r3.zip + unzip ../build/boost-win32-1.50.0-gitian3.zip + unzip ../build/bitcoin-deps-0.0.6.zip + unzip ../build/protobuf-win32-2.5.0-gitian-r2.zip cd $HOME/build/ - export PATH=$QTDIR/bin/:$PATH - # - mkdir boost_1_50_0 - cd boost_1_50_0 - mkdir -p stage/lib - unzip ../boost-win32-1.50.0-gitian2.zip - cd bin/$GBUILD_BITS - for lib in *; do - i586-mingw32msvc-ar rc ../../stage/lib/libboost_${lib}-mt-s.a $lib/*.o - i586-mingw32msvc-ranlib ../../stage/lib/libboost_${lib}-mt-s.a - done - cd ../.. - mv include/boost . - cd .. - # - unzip bitcoin-deps-0.0.5.zip - # - unzip protobuf-win32-2.5.0-gitian-r1.zip - # - find -type f | xargs touch --date="$REFERENCE_DATETIME" # cd bitcoin - mkdir -p $OUTDIR/src - git archive HEAD | tar -x -C $OUTDIR/src - cp $OUTDIR/src/doc/README_windows.txt $OUTDIR/readme.txt - cp $OUTDIR/src/COPYING $OUTDIR/COPYING.txt + export PATH=$STAGING/host/bin:$PATH + export TAR_OPTIONS=--mtime=`echo $REFERENCE_DATETIME | awk '{ print $1 }'` + ./autogen.sh + ./configure --disable-debug --bindir=$OUTDIR --prefix=$STAGING --host=i586-mingw32msvc --with-qt-plugindir=$STAGING/plugins --with-qt-incdir=$STAGING/include --with-qt-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --with-protoc-bindir=$STAGING/host/bin --disable-dependency-tracking CPPFLAGS="-I$STAGING/include" LDFLAGS="-L$STAGING/lib" CXXFLAGS="-frandom-seed=bitcoin" + make dist + mkdir -p distsrc + cd distsrc + tar --strip-components=1 -xf ../bitcoin-*.tar.* + ./configure --disable-debug --bindir=$OUTDIR --prefix=$STAGING --host=i586-mingw32msvc --with-qt-plugindir=$STAGING/plugins --with-qt-incdir=$STAGING/include --with-qt-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --with-protoc-bindir=$STAGING/host/bin --disable-dependency-tracking CPPFLAGS="-I$STAGING/include" LDFLAGS="-L$STAGING/lib" CXXFLAGS="-frandom-seed=bitcoin" export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME export TZ=UTC - $QTDIR/bin/qmake -spec unsupported/win32-g++-cross PROTOBUF_LIB_PATH=$HOME/build/protobuf-win32 PROTOBUF_INCLUDE_PATH=$HOME/build/protobuf-win32 PROTOC=$HOME/build/protobuf-win32/protoc MINIUPNPC_LIB_PATH=$HOME/build/miniupnpc MINIUPNPC_INCLUDE_PATH=$HOME/build/ BDB_LIB_PATH=$HOME/build/db-4.8.30.NC/build_unix BDB_INCLUDE_PATH=$HOME/build/db-4.8.30.NC/build_unix BOOST_LIB_PATH=$HOME/build/boost_1_50_0/stage/lib BOOST_INCLUDE_PATH=$HOME/build/boost_1_50_0 BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$HOME/build/openssl-1.0.1c OPENSSL_INCLUDE_PATH=$HOME/build/openssl-1.0.1c/include QRENCODE_LIB_PATH=$HOME/build/qrencode-3.2.0/.libs QRENCODE_INCLUDE_PATH=$HOME/build/qrencode-3.2.0 USE_QRCODE=1 INCLUDEPATH=$HOME/build DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_LRELEASE=lrelease QMAKE_CXXFLAGS=-frandom-seed=bitcoin USE_BUILD_INFO=1 make $MAKEOPTS - cp release/bitcoin-qt.exe $OUTDIR/ - # - cd src - export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - export FAKETIME=$REFERENCE_DATETIME - export TZ=UTC - make -f makefile.linux-mingw $MAKEOPTS DEPSDIR=$HOME/build bitcoind.exe USE_UPNP=0 DEBUGFLAGS="-frandom-seed=bitcoin" - i586-mingw32msvc-strip bitcoind.exe - mkdir $OUTDIR/daemon - cp bitcoind.exe $OUTDIR/daemon - cd .. - mkdir nsis - git archive HEAD | tar -x -C nsis - cd nsis/src - mkdir ../release - cp ../../release/* ../release/ - cp ../../src/*.exe . - makensis ../share/setup.nsi - cp ../share/bitcoin-*-win32-setup.exe $OUTDIR/ + make deploy + make install-strip + cp -f bitcoin-*setup*.exe $OUTDIR/ + + mkdir -p $OUTDIR/src + cp -f ../bitcoin-*.tar.* $OUTDIR/src diff --git a/contrib/gitian-descriptors/gitian.yml b/contrib/gitian-descriptors/gitian.yml index 6d47a46d5..47704bea2 100644 --- a/contrib/gitian-descriptors/gitian.yml +++ b/contrib/gitian-descriptors/gitian.yml @@ -13,11 +13,16 @@ packages: - "libboost-filesystem-dev" - "libboost-program-options-dev" - "libboost-thread-dev" +- "libboost-test-dev" - "libssl-dev" - "git-core" - "unzip" - "pkg-config" - "libpng12-dev" +- "autoconf2.13" +- "libtool" +- "automake" +- "faketime" reference_datetime: "2013-06-01 00:00:00" remotes: - "url": "https://github.com/bitcoin/bitcoin.git" @@ -27,35 +32,38 @@ files: - "qrencode-3.2.0.tar.bz2" - "protobuf-2.5.0.tar.bz2" script: | - INSTDIR="$HOME/install" - export LIBRARY_PATH="$INSTDIR/lib" + STAGING="$HOME/install" + export LIBRARY_PATH="$STAGING/lib" # tar xzfm miniupnpc-1.6.tar.gz cd miniupnpc-1.6 - INSTALLPREFIX=$INSTDIR make $MAKEOPTS install + INSTALLPREFIX=$STAGING make $MAKEOPTS install cd .. # tar xjfm qrencode-3.2.0.tar.bz2 cd qrencode-3.2.0 - ./configure --prefix=$INSTDIR --enable-static --disable-shared + sed -i 's/@LIBPTHREAD@//' libqrencode.pc.in + ./configure --prefix=$STAGING --enable-static --disable-shared make $MAKEOPTS install cd .. # tar xjfm protobuf-2.5.0.tar.bz2 cd protobuf-2.5.0 - ./configure --prefix=$INSTDIR --enable-static --disable-shared + mkdir -p $STAGING/host/bin + ./configure --prefix=$STAGING --bindir=$STAGING/host/bin --enable-static --disable-shared make $MAKEOPTS install cd .. # cd bitcoin - mkdir -p $OUTDIR/src - git archive HEAD | tar -x -C $OUTDIR/src - cp $OUTDIR/src/doc/README.md $OUTDIR - cp $OUTDIR/src/COPYING $OUTDIR - mkdir -p $OUTDIR/bin/$GBUILD_BITS - qmake INCLUDEPATH="$INSTDIR/include" LIBS="-L$INSTDIR/lib" PROTOC="$INSTDIR/bin/protoc" PROTOBUF_LIB_PATH="$INSTDIR/lib" PROTOBUF_INCLUDE_PATH="$INSTDIR/include" RELEASE=1 USE_QRCODE=1 + export TAR_OPTIONS=--mtime=`echo $REFERENCE_DATETIME | awk '{ print $1 }'` + ./autogen.sh + ./configure --disable-debug --prefix=$STAGING --bindir=$OUTDIR --with-protoc-bindir=$STAGING/host/bin --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include" LDFLAGS="-L$STAGING/lib" CXXFLAGS="-frandom-seed=bitcoin" + make dist + mkdir -p distsrc + cd distsrc + tar --strip-components=1 -xf ../bitcoin-*.tar.* + ./configure --disable-debug --prefix=$STAGING --bindir=$OUTDIR --with-protoc-bindir=$STAGING/host/bin --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include" LDFLAGS="-L$STAGING/lib" CXXFLAGS="-frandom-seed=bitcoin" make $MAKEOPTS - install bitcoin-qt $OUTDIR/bin/$GBUILD_BITS - cd src - make -f makefile.unix STATIC=1 OPENSSL_INCLUDE_PATH="$INSTDIR/include" OPENSSL_LIB_PATH="$INSTDIR/lib" $MAKEOPTS bitcoind USE_UPNP=0 DEBUGFLAGS= - install -s bitcoind $OUTDIR/bin/$GBUILD_BITS + make $MAKEOPTS install-strip + mkdir -p $OUTDIR/src + cp ../bitcoin-*.tar.* $OUTDIR/src diff --git a/contrib/gitian-descriptors/protobuf-win32.yml b/contrib/gitian-descriptors/protobuf-win32.yml index 492b21e7f..ad676e565 100644 --- a/contrib/gitian-descriptors/protobuf-win32.yml +++ b/contrib/gitian-descriptors/protobuf-win32.yml @@ -17,21 +17,23 @@ script: | export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME export TZ=UTC + export INSTALLPREFIX=$OUTDIR/staging/deps + export HOST=i586-mingw32msvc # + # + mkdir -p $INSTALLPREFIX + tar xjf protobuf-2.5.0.tar.bz2 cd protobuf-2.5.0 # First: build a native (linux) protoc ./configure --enable-shared=no --disable-dependency-tracking make - mkdir -p host - cp src/protoc host + mkdir -p $INSTALLPREFIX/host/bin + cp src/protoc $INSTALLPREFIX/host/bin # Now recompile with the mingw cross-compiler: make distclean - ./configure --enable-shared=no --disable-dependency-tracking --with-protoc=$(pwd)/host/protoc --host=i586-mingw32msvc CXXFLAGS=-frandom-seed=11 + ./configure --prefix=$INSTALLPREFIX --enable-shared=no --disable-dependency-tracking --with-protoc=$INSTALLPREFIX/host/bin/protoc --host=$HOST CXXFLAGS=-frandom-seed=11 make - cd .. - mkdir -p protobuf-win32 - cp protobuf-2.5.0/host/protoc protobuf-win32/protoc - cp protobuf-2.5.0/src/.libs/libprotobuf.a protobuf-win32/libprotobuf.a - cp -r protobuf-2.5.0/src/google protobuf-win32/ - zip -r $OUTDIR/protobuf-win32-2.5.0-gitian-r1.zip protobuf-win32 + make install + cd $INSTALLPREFIX + zip -r $OUTDIR/protobuf-win32-2.5.0-gitian-r2.zip include lib host diff --git a/contrib/gitian-descriptors/qt-win32.yml b/contrib/gitian-descriptors/qt-win32.yml index 7152875b8..6ab3bb477 100644 --- a/contrib/gitian-descriptors/qt-win32.yml +++ b/contrib/gitian-descriptors/qt-win32.yml @@ -8,17 +8,19 @@ packages: - "mingw32" - "zip" - "faketime" +- "unzip" reference_datetime: "2011-01-30 00:00:00" remotes: [] files: - "qt-everywhere-opensource-src-4.8.3.tar.gz" -- "bitcoin-deps-0.0.5.zip" +- "bitcoin-deps-0.0.6.zip" script: | INSTDIR="$HOME/qt/" mkdir $INSTDIR + mkdir -p $INSTDIR/host/bin # # Need mingw-compiled openssl from bitcoin-deps: - unzip bitcoin-deps-0.0.5.zip + unzip bitcoin-deps-0.0.6.zip DEPSDIR=`pwd` # tar xzf qt-everywhere-opensource-src-4.8.3.tar.gz @@ -44,7 +46,7 @@ script: | export FAKETIME=$REFERENCE_DATETIME export TZ=UTC # Compile static libraries, and use statically linked openssl (-openssl-linked): - OPENSSL_LIBS="-L$DEPSDIR/openssl-1.0.1c -lssl -lcrypto -lgdi32" ./configure -prefix $INSTDIR -I $DEPSDIR/openssl-1.0.1c/include -confirm-license -release -opensource -static -no-qt3support -xplatform unsupported/win32-g++-cross -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-declarative -no-script -no-scripttools -no-javascript-jit -no-webkit -no-svg -no-xmlpatterns -no-sql-sqlite -no-nis -no-cups -no-iconv -no-dbus -no-gif -no-libtiff -no-opengl -nomake examples -nomake demos -nomake docs -no-feature-style-plastique -no-feature-style-cleanlooks -no-feature-style-motif -no-feature-style-cde -no-feature-style-windowsce -no-feature-style-windowsmobile -no-feature-style-s60 -openssl-linked + OPENSSL_LIBS="-L$DEPSDIR/lib -lssl -lcrypto -lgdi32" ./configure -prefix $INSTDIR -bindir $INSTDIR/host/bin -I $DEPSDIR/include -confirm-license -release -opensource -static -no-qt3support -xplatform unsupported/win32-g++-cross -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-declarative -no-script -no-scripttools -no-javascript-jit -no-webkit -no-svg -no-xmlpatterns -no-sql-sqlite -no-nis -no-cups -no-iconv -no-dbus -no-gif -no-libtiff -no-opengl -nomake examples -nomake demos -nomake docs -no-feature-style-plastique -no-feature-style-cleanlooks -no-feature-style-motif -no-feature-style-cde -no-feature-style-windowsce -no-feature-style-windowsmobile -no-feature-style-s60 -openssl-linked find . -name *.prl | xargs -l sed 's|/\.||' -i find . -name *.prl | xargs -l sed 's|/$||' -i make $MAKEOPTS install @@ -53,4 +55,4 @@ script: | # as zip stores file timestamps, use faketime to intercept stat calls to set dates for all files to reference date export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - zip -r $OUTDIR/qt-win32-4.8.3-gitian-r2.zip * + zip -r $OUTDIR/qt-win32-4.8.3-gitian-r3.zip * diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus index 11140d3b8..533be6cff 100755 --- a/contrib/macdeploy/macdeployqtplus +++ b/contrib/macdeploy/macdeployqtplus @@ -651,6 +651,23 @@ elif config.sign: # ------------------------------------------------ if config.dmg is not None: + + #Patch in check_output for Python 2.6 + if "check_output" not in dir( subprocess ): + def f(*popenargs, **kwargs): + if 'stdout' in kwargs: + raise ValueError('stdout argument not allowed, it will be overridden.') + process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs) + output, unused_err = process.communicate() + retcode = process.poll() + if retcode: + cmd = kwargs.get("args") + if cmd is None: + cmd = popenargs[0] + raise CalledProcessError(retcode, cmd) + return output + subprocess.check_output = f + def runHDIUtil(verb, image_basename, **kwargs): hdiutil_args = ["hdiutil", verb, image_basename + ".dmg"] if kwargs.has_key("capture_stdout"): diff --git a/contrib/macdeploy/notes.txt b/contrib/macdeploy/notes.txt index 3d7490143..e7f62c4a3 100644 --- a/contrib/macdeploy/notes.txt +++ b/contrib/macdeploy/notes.txt @@ -1,26 +1,14 @@ - -macdeployqtplus works best on OS X Lion, for Snow Leopard you'd need to install -Python 2.7 and make it your default Python installation. - You will need the appscript package for the fancy disk image creation to work. Install it by invoking "sudo easy_install appscript". -This script should be invoked in the target directory like this: -$source_dir/contrib/macdeploy/macdeployqtplus Bitcoin-Qt.app -add-qt-tr da,de,es,hu,ru,uk,zh_CN,zh_TW -dmg -fancy $source_dir/contrib/macdeploy/fancy.plist -verbose 2 +For Snow Leopard (which uses Python 2.6), you will need the param_parser package. +Install it by invoking "sudo easy_install argparse" + +This script should not be run manually, instead, after building as usual: +"make deploy" During the process, the disk image window will pop up briefly where the fancy settings are applied. This is normal, please do not interfere. -You can also set up Qt Creator for invoking the script. For this, go to the -"Projects" tab on the left side, switch to "Run Settings" above and add a -deploy configuration. Next add a deploy step choosing "Custom Process Step". -Fill in the following. - -Enable custom process step: [x] -Command: %{sourceDir}/contrib/macdeploy/macdeployqtplus -Working directory: %{buildDir} -Command arguments: Bitcoin-Qt.app -add-qt-tr da,de,es,hu,ru,uk,zh_CN,zh_TW -dmg -fancy %{sourceDir}/contrib/macdeploy/fancy.plist -verbose 2 - -After that you can start the deployment process through the menu with -Build -> Deploy Project "bitcoin-qt" +When finished, it will produce Bitcoin-Qt.dmg. diff --git a/doc/build-unix.md b/doc/build-unix.md index 4653bba49..b2573e49d 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -5,10 +5,12 @@ Some notes on how to build Bitcoin in Unix. To Build --------------------- - cd src/ - make -f makefile.unix # Headless bitcoin + ./autogen.sh + ./configure + make -See [readme-qt.md](readme-qt.md) for instructions on building Bitcoin-Qt, the graphical user interface. +This will build bitcoin-qt as well if the dependencies are met. +See [readme-qt.md](readme-qt.md) for more information. Dependencies --------------------- @@ -22,15 +24,15 @@ Dependencies [miniupnpc](http://miniupnp.free.fr/) may be used for UPnP port mapping. It can be downloaded from [here]( http://miniupnp.tuxfamily.org/files/). UPnP support is compiled in and -turned off by default. Set USE_UPNP to a different value to control this: +turned off by default. See the configure options for upnp behavior desired: - USE_UPNP= No UPnP support miniupnp not required - USE_UPNP=0 (the default) UPnP support turned off by default at runtime - USE_UPNP=1 UPnP support turned on by default at runtime + --with-miniupnpc No UPnP support miniupnp not required + --disable-upnp-default (the default) UPnP support turned off by default at runtime + --enable-upnp-default UPnP support turned on by default at runtime IPv6 support may be disabled by setting: - USE_IPV6=0 Disable IPv6 support + --disable-ipv6 Disable IPv6 support Licenses of statically linked libraries: Berkeley DB New BSD license with additional requirement that linked @@ -70,7 +72,7 @@ for other Ubuntu & Debian: Optional: - sudo apt-get install libminiupnpc-dev (see USE_UPNP compile flag) + sudo apt-get install libminiupnpc-dev (see --with-miniupnpc and --enable-upnp-default) Dependency Build Instructions: Gentoo @@ -83,8 +85,9 @@ Note: If you just want to install bitcoind on Gentoo, you can add the Bitcoin ov Take the following steps to build (no UPnP support): - cd ${BITCOIN_DIR}/src - make -f makefile.unix USE_UPNP= USE_IPV6=1 BDB_INCLUDE_PATH='/usr/include/db4.8' + cd ${BITCOIN_DIR} + ./autogen.sh + ./configure --without-miniupnpc CXXFLAGS="-i/usr/include/db4.8" strip bitcoind @@ -123,7 +126,13 @@ If you need to build Boost yourself: Security -------- To help make your bitcoin installation more secure by making certain attacks impossible to -exploit even if a vulnerability is found, you can take the following measures: +exploit even if a vulnerability is found, binaries are hardened by default. +This can be disabled with: + +./configure --enable-hardening + + +Hardening enables the following features: * Position Independent Executable Build position independent code to take advantage of Address Space Layout Randomization @@ -135,10 +144,6 @@ exploit even if a vulnerability is found, you can take the following measures: On an Amd64 processor where a library was not compiled with -fPIC, this will cause an error such as: "relocation R_X86_64_32 against `......' can not be used when making a shared object;" - To build with PIE, use: - - make -f makefile.unix ... -e PIE=1 - To test that you have built PIE executable, install scanelf, part of paxutils, and use: scanelf -e ./bitcoin diff --git a/doc/readme-qt.md b/doc/readme-qt.md index cbaaf645a..5aa849af1 100644 --- a/doc/readme-qt.md +++ b/doc/readme-qt.md @@ -31,14 +31,8 @@ For Qt 5 you need the following, otherwise you get an error with lrelease when r apt-get install qt5-qmake libqt5gui5 libqt5core5 libqt5dbus5 qttools5-dev-tools -then execute the following: - - qmake - make - -Alternatively, install [Qt Creator](http://qt-project.org/downloads/) and open the `bitcoin-qt.pro` file. -An executable named `bitcoin-qt` will be built. - +Once these are installed, they will be found by configure and bitcoin-qt will be +built by default. ### Mac OS X @@ -55,52 +49,31 @@ An executable named `bitcoin-qt` will be built. brew update brew install boost miniupnpc openssl berkeley-db4 protobuf -- If using HomeBrew, edit `bitcoin-qt.pro` to account for library location differences. There's a diff in `contrib/homebrew/bitcoin-qt-pro.patch` that shows what you need to change, or you can just patch by doing - - patch -p1 < contrib/homebrew/bitcoin.qt.pro.patch - -- Open the bitcoin-qt.pro file in Qt Creator and build as normal (cmd+B) - - Build Configuration Options --------------------- ### UPnP port forwarding -To use UPnP for port forwarding behind a NAT router (recommended, as more connections overall allow for a faster and more stable bitcoin experience), pass the following argument to qmake: - +UPnP support is compiled in when possible and turned off by default. See the +configure options for upnp behavior desired: - - qmake "USE_UPNP=1" - -(in **Qt Creator**, you can find the setting for additional qmake arguments under "Projects" -> "Build Settings" -> "Build Steps", then click "Details" next to **qmake**) - -This requires miniupnpc for UPnP port mapping. It can be downloaded from [here]( -http://miniupnp.tuxfamily.org/files/). UPnP support is not compiled in by default. - -Set USE_UPNP to a different value to control this: - - - USE_UPNP=- no UPnP support, miniupnpc not required; - USE_UPNP=0 (the default) built with UPnP, support turned off by default at runtime; - USE_UPNP=1 build with UPnP support turned on by default at runtime. + --with-miniupnpc No UPnP support miniupnp not required + --disable-upnp-default (the default) UPnP support turned off by default at runtime + --enable-upnp-default UPnP support turned on by default at runtime ### Notification support for recent (k)ubuntu versions -To see desktop notifications on (k)ubuntu versions starting from 10.04, enable usage of the -FreeDesktop notification interface through DBUS using the following qmake option: - - +DBUS support is enabled by default if dependencies are met. - qmake "USE_DBUS=1" +See the --with-qtdbus configure option. ### Generation of QR codes -[libqrencode](http://fukuchi.org/works/qrencode/) may be used to generate QRCode images for payment requests. Pass the USE_QRCODE flag to qmake to control this: +[libqrencode](http://fukuchi.org/works/qrencode/) may be used to generate QRCode images for payment requests. +QR code support is enabled by default if dependencies are met. - USE_QRCODE=0 (the default) No QRCode support - libarcode not required - USE_QRCODE=1 QRCode support enabled +See the --with-qrencode configure option. Warnings --------------------- diff --git a/doc/unit-tests.md b/doc/unit-tests.md index d6fb2d8e2..2c991eb03 100644 --- a/doc/unit-tests.md +++ b/doc/unit-tests.md @@ -1,35 +1,18 @@ -Compiling/running bitcoind unit tests +Compiling/running unit tests ------------------------------------ -bitcoind unit tests are in the `src/test/` directory; they -use the Boost::Test unit-testing framework. +Unit tests will be automatically compiled if dependencies were met in configure +and tests weren't explicitly disabled. -To compile and run the tests: +After configuring, they can be run with 'make check'. - cd src - make -f makefile.unix test_bitcoin # Replace makefile.unix if you're not on unix - ./test_bitcoin # Runs the unit tests +To run the bitcoind tests manually, launch src/test/test_bitcoin . -If all tests succeed the last line of output will be: -`*** No errors detected` - -To add more tests, add `BOOST_AUTO_TEST_CASE` functions to the existing +To add more bitcoind tests, add `BOOST_AUTO_TEST_CASE` functions to the existing .cpp files in the test/ directory or add new .cpp files that -implement new BOOST_AUTO_TEST_SUITE sections (the makefiles are -set up to add test/*.cpp to test_bitcoin automatically). - - -Compiling/running Bitcoin-Qt unit tests ---------------------------------------- - -Bitcoin-Qt unit tests are in the src/qt/test/ directory; they -use the Qt unit-testing framework. - -To compile and run the tests: +implement new BOOST_AUTO_TEST_SUITE sections. - qmake bitcoin-qt.pro BITCOIN_QT_TEST=1 - make - ./bitcoin-qt_test +To run the bitcoin-qt tests manualy, launch src/qt/test/bitcoin-qt_test -To add more tests, add them to the `src/qt/test/` directory, -the `src/qt/test/test_main.cpp` file, and bitcoin-qt.pro. +To add more bitcoin-qt tests, add them to the `src/qt/test/` directory and +the `src/qt/test/test_main.cpp` file. diff --git a/pkg.m4 b/pkg.m4 new file mode 100644 index 000000000..c5b26b52e --- /dev/null +++ b/pkg.m4 @@ -0,0 +1,214 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + + +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------- +# Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])# PKG_CHECK_VAR diff --git a/qa/pull-tester/build-tests.sh.in b/qa/pull-tester/build-tests.sh.in new file mode 100755 index 000000000..b353c5790 --- /dev/null +++ b/qa/pull-tester/build-tests.sh.in @@ -0,0 +1,45 @@ +#!/bin/bash +# Param1: The prefix to mingw staging +# Param2: Path to java comparison tool +# Param3: Number of make jobs. Defaults to 1. + +set -e +set -o xtrace + +MINGWPREFIX=$1 +JAVA_COMPARISON_TOOL=$2 +JOBS=${3-1} + +if [ $# -lt 2 ]; then + echo "Usage: $0 [mingw-prefix] [java-comparison-tool] " + exit 1 +fi + +DISTDIR=@PACKAGE@-@VERSION@ + +cd @abs_top_srcdir@ +make distdir +mv $DISTDIR linux-build +cd linux-build +./configure --with-comparison-tool="$JAVA_COMPARISON_TOOL" +make -j$JOBS +make check + +#Test code coverage +cd @abs_top_srcdir@ +make distdir +mv $DISTDIR linux-coverage-build +cd linux-coverage-build +./configure --enable-lcov --with-comparison-tool="$JAVA_COMPARISON_TOOL" +make -j$JOBS +make cov + +# win32 build disabled until pull-tester has updated dependencies +##Test win32 build +#cd @abs_top_srcdir@ +#make distdir +#mv $DISTDIR win32-build +#cd win32-build +#./configure --prefix=$MINGWPREFIX --host=i586-mingw32msvc --with-qt-bindir=$MINGWPREFIX/host/bin --with-qt-plugindir=$MINGWPREFIX/plugins --with-qt-incdir=$MINGWPREFIX/include --with-boost=$MINGWPREFIX --with-protoc-bindir=$MINGWPREFIX/host/bin --with-comparison-tool="$JAVA_COMPARISON_TOOL" CPPFLAGS=-I$MINGWPREFIX/include LDFLAGS=-L$MINGWPREFIX/lib +#make -j$JOBS +#make check diff --git a/qa/pull-tester/pull-tester.sh b/qa/pull-tester/pull-tester.sh new file mode 100755 index 000000000..13c800c16 --- /dev/null +++ b/qa/pull-tester/pull-tester.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# Helper script for pull-tester. +#Param 1: path to bitcoin srcroot +#Param ...: arguments for build-test.sh + +if [ $# -lt 1 ]; then + echo "usage: $0 [bitcoin srcroot] build-test arguments..." +fi + +cd $1 +shift + +./autogen.sh +./configure +./qa/pull-tester/build-tests.sh "$@" diff --git a/qa/pull-tester/run-bitcoind-for-test.sh.in b/qa/pull-tester/run-bitcoind-for-test.sh.in new file mode 100755 index 000000000..e02fef3b5 --- /dev/null +++ b/qa/pull-tester/run-bitcoind-for-test.sh.in @@ -0,0 +1,27 @@ +#!/bin/bash +DATADIR="@abs_top_builddir@/.bitcoin" +rm -rf "$DATADIR" +mkdir -p "$DATADIR"/regtest +touch "$DATADIR/regtest/debug.log" +tail -q -n 1 -F "$DATADIR/regtest/debug.log" | grep -m 1 -q "Done loading" & +WAITER=$! +"@abs_top_builddir@/src/bitcoind@EXEEXT@" -connect=0.0.0.0 -datadir="$DATADIR" -rpcuser=user -rpcpassword=pass -listen -keypool=3 -debug -logtimestamps -port=18444 -regtest & +BITCOIND=$! + +#Install a watchdog. +(sleep 10 && kill -0 $WAITER 2>/dev/null && kill -9 $BITCOIND $$)& +wait $WAITER + +if [ -n "$TIMEOUT" ]; then + timeout "$TIMEOUT"s "$@" + RETURN=$? +else + "$@" + RETURN=$? +fi + +(sleep 15 && kill -0 $BITCOIND 2>/dev/null && kill -9 $BITCOIND $$)& +kill $BITCOIND && wait $BITCOIND + +# timeout returns 124 on timeout, otherwise the return value of the child +exit $RETURN diff --git a/share/genbuild.sh b/share/genbuild.sh index d959877dc..da50b0d10 100755 --- a/share/genbuild.sh +++ b/share/genbuild.sh @@ -1,5 +1,7 @@ #!/bin/sh - +if [ $# -gt 1 ]; then + cd "$2" +fi if [ $# -gt 0 ]; then FILE="$1" shift @@ -7,11 +9,11 @@ if [ $# -gt 0 ]; then INFO="$(head -n 1 "$FILE")" fi else - echo "Usage: $0 " + echo "Usage: $0 " exit 1 fi -if [ -e "$(which git)" ]; then +if [ -e "$(which git)" -a -d ".git" ]; then # clean 'dirty' status of touched files that haven't been modified git diff >/dev/null 2>/dev/null diff --git a/share/qt/Info.plist b/share/qt/Info.plist.in similarity index 88% rename from share/qt/Info.plist rename to share/qt/Info.plist.in index f191402e8..d0dd79656 100644 --- a/share/qt/Info.plist +++ b/share/qt/Info.plist.in @@ -7,11 +7,11 @@ CFBundlePackageType APPL CFBundleGetInfoString - $VERSION, Copyright © 2009-$YEAR The Bitcoin developers + @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@, Copyright © 2009-@COPYRIGHT_YEAR@ The Bitcoin developers CFBundleShortVersionString - $VERSION + @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@ CFBundleVersion - $VERSION + @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@ CFBundleSignature ???? CFBundleExecutable diff --git a/share/setup.nsi b/share/setup.nsi.in similarity index 86% rename from share/setup.nsi rename to share/setup.nsi.in index d5f2ffc3f..dd3786238 100644 --- a/share/setup.nsi +++ b/share/setup.nsi.in @@ -1,162 +1,162 @@ -Name Bitcoin - -RequestExecutionLevel highest -SetCompressor /SOLID lzma - -# General Symbol Definitions -!define REGKEY "SOFTWARE\$(^Name)" -!define VERSION 0.8.2 -!define COMPANY "Bitcoin project" -!define URL http://www.bitcoin.org/ - -# MUI Symbol Definitions -!define MUI_ICON "../share/pixmaps/bitcoin.ico" -!define MUI_WELCOMEFINISHPAGE_BITMAP "../share/pixmaps/nsis-wizard.bmp" -!define MUI_HEADERIMAGE -!define MUI_HEADERIMAGE_RIGHT -!define MUI_HEADERIMAGE_BITMAP "../share/pixmaps/nsis-header.bmp" -!define MUI_FINISHPAGE_NOAUTOCLOSE -!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM -!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY} -!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup -!define MUI_STARTMENUPAGE_DEFAULTFOLDER Bitcoin -!define MUI_FINISHPAGE_RUN $INSTDIR\bitcoin-qt.exe -!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" -!define MUI_UNWELCOMEFINISHPAGE_BITMAP "../share/pixmaps/nsis-wizard.bmp" -!define MUI_UNFINISHPAGE_NOAUTOCLOSE - -# Included files -!include Sections.nsh -!include MUI2.nsh - -# Variables -Var StartMenuGroup - -# Installer pages -!insertmacro MUI_PAGE_WELCOME -!insertmacro MUI_PAGE_DIRECTORY -!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup -!insertmacro MUI_PAGE_INSTFILES -!insertmacro MUI_PAGE_FINISH -!insertmacro MUI_UNPAGE_CONFIRM -!insertmacro MUI_UNPAGE_INSTFILES - -# Installer languages -!insertmacro MUI_LANGUAGE English - -# Installer attributes -OutFile bitcoin-0.8.2-win32-setup.exe -InstallDir $PROGRAMFILES\Bitcoin -CRCCheck on -XPStyle on -BrandingText " " -ShowInstDetails show -VIProductVersion 0.8.2.2 -VIAddVersionKey ProductName Bitcoin -VIAddVersionKey ProductVersion "${VERSION}" -VIAddVersionKey CompanyName "${COMPANY}" -VIAddVersionKey CompanyWebsite "${URL}" -VIAddVersionKey FileVersion "${VERSION}" -VIAddVersionKey FileDescription "" -VIAddVersionKey LegalCopyright "" -InstallDirRegKey HKCU "${REGKEY}" Path -ShowUninstDetails show - -# Installer sections -Section -Main SEC0000 - SetOutPath $INSTDIR - SetOverwrite on - File ../release/bitcoin-qt.exe - File /oname=COPYING.txt ../COPYING - File /oname=readme.txt ../doc/README_windows.txt - SetOutPath $INSTDIR\daemon - File ../src/bitcoind.exe - SetOutPath $INSTDIR\src - File /r /x *.exe /x *.o ../src\*.* - SetOutPath $INSTDIR - WriteRegStr HKCU "${REGKEY}\Components" Main 1 - - # Remove old wxwidgets-based-bitcoin executable and locales: - Delete /REBOOTOK $INSTDIR\bitcoin.exe - RMDir /r /REBOOTOK $INSTDIR\locale -SectionEnd - -Section -post SEC0001 - WriteRegStr HKCU "${REGKEY}" Path $INSTDIR - SetOutPath $INSTDIR - WriteUninstaller $INSTDIR\uninstall.exe - !insertmacro MUI_STARTMENU_WRITE_BEGIN Application - CreateDirectory $SMPROGRAMS\$StartMenuGroup - CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk" $INSTDIR\bitcoin-qt.exe - CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk" $INSTDIR\uninstall.exe - !insertmacro MUI_STARTMENU_WRITE_END - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)" - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}" - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}" - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}" - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe - WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1 - WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1 - WriteRegStr HKCR "bitcoin" "URL Protocol" "" - WriteRegStr HKCR "bitcoin" "" "URL:Bitcoin" - WriteRegStr HKCR "bitcoin\DefaultIcon" "" $INSTDIR\bitcoin-qt.exe - WriteRegStr HKCR "bitcoin\shell\open\command" "" '"$INSTDIR\bitcoin-qt.exe" "%1"' -SectionEnd - -# Macro for selecting uninstaller sections -!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID - Push $R0 - ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}" - StrCmp $R0 1 0 next${UNSECTION_ID} - !insertmacro SelectSection "${UNSECTION_ID}" - GoTo done${UNSECTION_ID} -next${UNSECTION_ID}: - !insertmacro UnselectSection "${UNSECTION_ID}" -done${UNSECTION_ID}: - Pop $R0 -!macroend - -# Uninstaller sections -Section /o -un.Main UNSEC0000 - Delete /REBOOTOK $INSTDIR\bitcoin-qt.exe - Delete /REBOOTOK $INSTDIR\COPYING.txt - Delete /REBOOTOK $INSTDIR\readme.txt - RMDir /r /REBOOTOK $INSTDIR\daemon - RMDir /r /REBOOTOK $INSTDIR\src - DeleteRegValue HKCU "${REGKEY}\Components" Main -SectionEnd - -Section -un.post UNSEC0001 - DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" - Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk" - Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk" - Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk" - Delete /REBOOTOK $INSTDIR\uninstall.exe - Delete /REBOOTOK $INSTDIR\debug.log - Delete /REBOOTOK $INSTDIR\db.log - DeleteRegValue HKCU "${REGKEY}" StartMenuGroup - DeleteRegValue HKCU "${REGKEY}" Path - DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components" - DeleteRegKey /IfEmpty HKCU "${REGKEY}" - DeleteRegKey HKCR "bitcoin" - RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup - RmDir /REBOOTOK $INSTDIR - Push $R0 - StrCpy $R0 $StartMenuGroup 1 - StrCmp $R0 ">" no_smgroup -no_smgroup: - Pop $R0 -SectionEnd - -# Installer functions -Function .onInit - InitPluginsDir -FunctionEnd - -# Uninstaller functions -Function un.onInit - ReadRegStr $INSTDIR HKCU "${REGKEY}" Path - !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup - !insertmacro SELECT_UNSECTION Main ${UNSEC0000} -FunctionEnd +Name @PACKAGE_NAME@ + +RequestExecutionLevel highest +SetCompressor /SOLID lzma + +# General Symbol Definitions +!define REGKEY "SOFTWARE\$(^Name)" +!define VERSION @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@ +!define COMPANY "Bitcoin project" +!define URL http://www.bitcoin.org/ + +# MUI Symbol Definitions +!define MUI_ICON "@abs_top_srcdir@/share/pixmaps/bitcoin.ico" +!define MUI_WELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp" +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_RIGHT +!define MUI_HEADERIMAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-header.bmp" +!define MUI_FINISHPAGE_NOAUTOCLOSE +!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM +!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY} +!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup +!define MUI_STARTMENUPAGE_DEFAULTFOLDER @PACKAGE_NAME@ +!define MUI_FINISHPAGE_RUN $INSTDIR\bitcoin-qt.exe +!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" +!define MUI_UNWELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp" +!define MUI_UNFINISHPAGE_NOAUTOCLOSE + +# Included files +!include Sections.nsh +!include MUI2.nsh + +# Variables +Var StartMenuGroup + +# Installer pages +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +# Installer languages +!insertmacro MUI_LANGUAGE English + +# Installer attributes +OutFile @abs_top_srcdir@/bitcoin-${VERSION}-win32-setup.exe +InstallDir $PROGRAMFILES\Bitcoin +CRCCheck on +XPStyle on +BrandingText " " +ShowInstDetails show +VIProductVersion ${VERSION}.@CLIENT_VERSION_BUILD@ +VIAddVersionKey ProductName Bitcoin +VIAddVersionKey ProductVersion "${VERSION}" +VIAddVersionKey CompanyName "${COMPANY}" +VIAddVersionKey CompanyWebsite "${URL}" +VIAddVersionKey FileVersion "${VERSION}" +VIAddVersionKey FileDescription "" +VIAddVersionKey LegalCopyright "" +InstallDirRegKey HKCU "${REGKEY}" Path +ShowUninstDetails show + +# Installer sections +Section -Main SEC0000 + SetOutPath $INSTDIR + SetOverwrite on + File @abs_top_srcdir@/release/bitcoin-qt.exe + File /oname=COPYING.txt @abs_top_srcdir@/COPYING + File /oname=readme.txt @abs_top_srcdir@/doc/README_windows.txt + SetOutPath $INSTDIR\daemon + File @abs_top_srcdir@/release/bitcoind.exe + SetOutPath $INSTDIR\src + File /r @abs_top_srcdir@/@PACKAGE@-@VERSION@/src\*.* + SetOutPath $INSTDIR + WriteRegStr HKCU "${REGKEY}\Components" Main 1 + + # Remove old wxwidgets-based-bitcoin executable and locales: + Delete /REBOOTOK $INSTDIR\bitcoin.exe + RMDir /r /REBOOTOK $INSTDIR\locale +SectionEnd + +Section -post SEC0001 + WriteRegStr HKCU "${REGKEY}" Path $INSTDIR + SetOutPath $INSTDIR + WriteUninstaller $INSTDIR\uninstall.exe + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + CreateDirectory $SMPROGRAMS\$StartMenuGroup + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk" $INSTDIR\bitcoin-qt.exe + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk" $INSTDIR\uninstall.exe + !insertmacro MUI_STARTMENU_WRITE_END + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe + WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1 + WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1 + WriteRegStr HKCR "bitcoin" "URL Protocol" "" + WriteRegStr HKCR "bitcoin" "" "URL:Bitcoin" + WriteRegStr HKCR "bitcoin\DefaultIcon" "" $INSTDIR\bitcoin-qt.exe + WriteRegStr HKCR "bitcoin\shell\open\command" "" '"$INSTDIR\bitcoin-qt.exe" "%1"' +SectionEnd + +# Macro for selecting uninstaller sections +!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID + Push $R0 + ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}" + StrCmp $R0 1 0 next${UNSECTION_ID} + !insertmacro SelectSection "${UNSECTION_ID}" + GoTo done${UNSECTION_ID} +next${UNSECTION_ID}: + !insertmacro UnselectSection "${UNSECTION_ID}" +done${UNSECTION_ID}: + Pop $R0 +!macroend + +# Uninstaller sections +Section /o -un.Main UNSEC0000 + Delete /REBOOTOK $INSTDIR\bitcoin-qt.exe + Delete /REBOOTOK $INSTDIR\COPYING.txt + Delete /REBOOTOK $INSTDIR\readme.txt + RMDir /r /REBOOTOK $INSTDIR\daemon + RMDir /r /REBOOTOK $INSTDIR\src + DeleteRegValue HKCU "${REGKEY}\Components" Main +SectionEnd + +Section -un.post UNSEC0001 + DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk" + Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk" + Delete /REBOOTOK $INSTDIR\uninstall.exe + Delete /REBOOTOK $INSTDIR\debug.log + Delete /REBOOTOK $INSTDIR\db.log + DeleteRegValue HKCU "${REGKEY}" StartMenuGroup + DeleteRegValue HKCU "${REGKEY}" Path + DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components" + DeleteRegKey /IfEmpty HKCU "${REGKEY}" + DeleteRegKey HKCR "bitcoin" + RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup + RmDir /REBOOTOK $INSTDIR + Push $R0 + StrCpy $R0 $StartMenuGroup 1 + StrCmp $R0 ">" no_smgroup +no_smgroup: + Pop $R0 +SectionEnd + +# Installer functions +Function .onInit + InitPluginsDir +FunctionEnd + +# Uninstaller functions +Function un.onInit + ReadRegStr $INSTDIR HKCU "${REGKEY}" Path + !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup + !insertmacro SELECT_UNSECTION Main ${UNSEC0000} +FunctionEnd diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 000000000..3697b9ff2 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,67 @@ +AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ + -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src/leveldb/helpers \ + $(BOOST_INCLUDES) +AM_LDFLAGS = $(PTHREAD_CFLAGS) + +noinst_LIBRARIES = libbitcoin.a + +bin_PROGRAMS = bitcoind + +SUBDIRS = . $(BUILD_QT) $(BUILD_TEST) +DIST_SUBDIRS = . qt test +.PHONY: FORCE +# bitcoin core # +BITCOIN_CORE_H = addrman.h alert.h allocators.h base58.h bignum.h \ + bitcoinrpc.h bloom.h chainparams.h checkpoints.h checkqueue.h \ + clientversion.h compat.h core.h crypter.h db.h hash.h init.h \ + key.h keystore.h leveldb.h limitedmap.h main.h miner.h mruset.h \ + netbase.h net.h protocol.h script.h serialize.h sync.h threadsafety.h \ + txdb.h ui_interface.h uint256.h util.h version.h walletdb.h wallet.h + +JSON_H = json/json_spirit.h json/json_spirit_error_position.h \ + json/json_spirit_reader.h json/json_spirit_reader_template.h \ + json/json_spirit_stream_reader.h json/json_spirit_utils.h \ + json/json_spirit_value.h json/json_spirit_writer.h \ + json/json_spirit_writer_template.h + +obj/build.h: FORCE + @$(MKDIR_P) $(abs_top_builddir)/src/obj + @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \ + $(abs_top_srcdir) +version.o: obj/build.h + +libbitcoin_a_SOURCES = addrman.cpp alert.cpp bitcoinrpc.cpp bloom.cpp \ + chainparams.cpp checkpoints.cpp core.cpp crypter.cpp db.cpp hash.cpp \ + init.cpp key.cpp keystore.cpp leveldb.cpp main.cpp miner.cpp \ + netbase.cpp net.cpp noui.cpp protocol.cpp rpcblockchain.cpp rpcdump.cpp \ + rpcmining.cpp rpcnet.cpp rpcrawtransaction.cpp rpcwallet.cpp script.cpp \ + sync.cpp txdb.cpp util.cpp version.cpp wallet.cpp walletdb.cpp $(JSON_H) \ + $(BITCOIN_CORE_H) + +nodist_libbitcoin_a_SOURCES = $(top_srcdir)/src/obj/build.h +# + +# bitcoind binary # +bitcoind_LDADD = libbitcoin.a leveldb/libleveldb.a leveldb/libmemenv.a \ + $(BOOST_LIBS) +bitcoind_SOURCES = bitcoind.cpp +# + +leveldb/libleveldb.a: + @echo "Building LevelDB ..." && cd leveldb && CXX="$(CXX)" CC="$(CC)" \ + PLATFORM=$(TARGET_OS) AR="$(AR)" $(MAKE) $(LEVELDB_TARGET_FLAGS) OPT="$(CXXFLAGS) $(CPPFLAGS)" libleveldb.a + +leveldb/libmemenv.a: + @echo "Building LevelDB ..." && cd leveldb && CXX="$(CXX)" CC="$(CC)" \ + PLATFORM=$(TARGET_OS) AR="$(AR)" $(MAKE) $(LEVELDB_TARGET_FLAGS) OPT="$(CXXFLAGS) $(CPPFLAGS)" libmemenv.a + +CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a *.gcda *.gcno + +DISTCLEANFILES = obj/build.h + +EXTRA_DIST = leveldb Makefile.include + +clean-local: + -$(MAKE) -C leveldb clean + rm -f leveldb/port/*.gcno leveldb/db/*.gcno leveldb/table/*.gcno leveldb/helpers/*.gcno + rm -f leveldb/util/*.gcno leveldb/helpers/memenv/*.gcno diff --git a/src/Makefile.include b/src/Makefile.include new file mode 100644 index 000000000..231888e49 --- /dev/null +++ b/src/Makefile.include @@ -0,0 +1,48 @@ +.PHONY: FORCE + +LIBBITCOIN=$(top_builddir)/src/libbitcoin.a +LIBLEVELDB=$(top_builddir)/src/leveldb/libleveldb.a +LIBMEMENV=$(top_builddir)/src/leveldb/libmemenv.a +LIBBITCOINQT=$(top_builddir)/src/qt/libbitcoinqt.a + +$(LIBBITCOIN): + $(MAKE) -C $(top_builddir)/src $(@F) + +$(LIBLEVELDB) $(LIBMEMENV): + $(MAKE) -C $(top_builddir)/src leveldb/$(@F) + +$(LIBBITCOINQT): + $(MAKE) -C $(top_builddir)/src/qt $(@F) + +.mm.o: + $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(CXXFLAGS) -c -o $@ $< + +.rc.o: + @test -f $(WINDRES) && $(WINDRES) -i $< -o $@ || \ + echo error: could not build $@ + +ui_%.h: %.ui + @test -d $(abs_builddir)/$(@D) || $(MKDIR_P) $(abs_builddir)/$(@D) + @test -f $(UIC) && $(UIC) -o $(abs_builddir)/$@ $(abs_srcdir)/$< || echo error: could not build $(abs_builddir)/$@ + $(SED) -i.bak -e '/^\*\*.*Created:/d' $(abs_builddir)/$@ && rm $(abs_builddir)/$@.bak + $(SED) -i.bak -e '/^\*\*.*by:/d' $(abs_builddir)/$@ && rm $(abs_builddir)/$@.bak + +%.moc: %.cpp + $(MOC) $(QT_INCLUDES) $(MOC_DEFS) -o $@ $< + $(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak + $(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak + +moc_%.cpp: %.h + $(MOC) $(QT_INCLUDES) $(MOC_DEFS) -o $@ $< + $(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak + $(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak + +%.qm: %.ts + @test -d $(abs_builddir)/$(@D) || $(MKDIR_P) $(abs_builddir)/$(@D) + @test -f $(LRELEASE) && $(LRELEASE) $(abs_srcdir)/$< -qm $(abs_builddir)/$@ || \ + echo error: could not build $(abs_builddir)/$@ + +%.pb.cc %.pb.h: %.proto + test -f $(PROTOC) && $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $(. +# +# This macro calls: +# +# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS) +# +# And sets: +# +# HAVE_BOOST +# +# LICENSE +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2009 Peter Adolphs +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 20 + +AC_DEFUN([AX_BOOST_BASE], +[ +AC_ARG_WITH([boost], + [AS_HELP_STRING([--with-boost@<:@=ARG@:>@], + [use Boost library from a standard location (ARG=yes), + from the specified location (ARG=), + or disable it (ARG=no) + @<:@ARG=yes@:>@ ])], + [ + if test "$withval" = "no"; then + want_boost="no" + elif test "$withval" = "yes"; then + want_boost="yes" + ac_boost_path="" + else + want_boost="yes" + ac_boost_path="$withval" + fi + ], + [want_boost="yes"]) + + +AC_ARG_WITH([boost-libdir], + AS_HELP_STRING([--with-boost-libdir=LIB_DIR], + [Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]), + [ + if test -d "$withval" + then + ac_boost_lib_path="$withval" + else + AC_MSG_ERROR(--with-boost-libdir expected directory name) + fi + ], + [ac_boost_lib_path=""] +) + +if test "x$want_boost" = "xyes"; then + boost_lib_version_req=ifelse([$1], ,1.20.0,$1) + boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` + boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'` + boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` + boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` + if test "x$boost_lib_version_req_sub_minor" = "x" ; then + boost_lib_version_req_sub_minor="0" + fi + WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` + AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req) + succeeded=no + + dnl On 64-bit systems check for system libraries in both lib64 and lib. + dnl The former is specified by FHS, but e.g. Debian does not adhere to + dnl this (as it rises problems for generic multi-arch support). + dnl The last entry in the list is chosen by default when no libraries + dnl are found, e.g. when only header-only libraries are installed! + libsubdirs="lib" + ax_arch=`uname -m` + if test $ax_arch = x86_64 -o $ax_arch = ppc64 -o $ax_arch = s390x -o $ax_arch = sparc64; then + libsubdirs="lib64 lib lib64" + fi + + dnl first we check the system location for boost libraries + dnl this location ist chosen if boost libraries are installed with the --layout=system option + dnl or if you install boost with RPM + if test "$ac_boost_path" != ""; then + BOOST_CPPFLAGS="-I$ac_boost_path/include" + for ac_boost_path_tmp in $libsubdirs; do + if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then + BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp" + break + fi + done + elif test "$cross_compiling" != yes; then + for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do + if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then + for libsubdir in $libsubdirs ; do + if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi + done + BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir" + BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" + break; + fi + done + fi + + dnl overwrite ld flags if we have required special directory with + dnl --with-boost-libdir parameter + if test "$ac_boost_lib_path" != ""; then + BOOST_LDFLAGS="-L$ac_boost_lib_path" + fi + + CPPFLAGS_SAVED="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + + LDFLAGS_SAVED="$LDFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + + AC_REQUIRE([AC_PROG_CXX]) + AC_LANG_PUSH(C++) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + @%:@include + ]], [[ + #if BOOST_VERSION >= $WANT_BOOST_VERSION + // Everything is okay + #else + # error Boost version is too old + #endif + ]])],[ + AC_MSG_RESULT(yes) + succeeded=yes + found_system=yes + ],[ + ]) + AC_LANG_POP([C++]) + + + + dnl if we found no boost with system layout we search for boost libraries + dnl built and installed without the --layout=system option or for a staged(not installed) version + if test "x$succeeded" != "xyes"; then + _version=0 + if test "$ac_boost_path" != ""; then + if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then + for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do + _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` + V_CHECK=`expr $_version_tmp \> $_version` + if test "$V_CHECK" = "1" ; then + _version=$_version_tmp + fi + VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` + BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" + done + fi + else + if test "$cross_compiling" != yes; then + for ac_boost_path in /usr /usr/local /opt /opt/local ; do + if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then + for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do + _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` + V_CHECK=`expr $_version_tmp \> $_version` + if test "$V_CHECK" = "1" ; then + _version=$_version_tmp + best_path=$ac_boost_path + fi + done + fi + done + + VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` + BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" + if test "$ac_boost_lib_path" = ""; then + for libsubdir in $libsubdirs ; do + if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi + done + BOOST_LDFLAGS="-L$best_path/$libsubdir" + fi + fi + + if test "x$BOOST_ROOT" != "x"; then + for libsubdir in $libsubdirs ; do + if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi + done + if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then + version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` + stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` + stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` + V_CHECK=`expr $stage_version_shorten \>\= $_version` + if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then + AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) + BOOST_CPPFLAGS="-I$BOOST_ROOT" + BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir" + fi + fi + fi + fi + + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + + AC_LANG_PUSH(C++) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + @%:@include + ]], [[ + #if BOOST_VERSION >= $WANT_BOOST_VERSION + // Everything is okay + #else + # error Boost version is too old + #endif + ]])],[ + AC_MSG_RESULT(yes) + succeeded=yes + found_system=yes + ],[ + ]) + AC_LANG_POP([C++]) + fi + + if test "$succeeded" != "yes" ; then + if test "$_version" = "0" ; then + AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation.]]) + else + AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).]) + fi + # execute ACTION-IF-NOT-FOUND (if present): + ifelse([$3], , :, [$3]) + else + AC_SUBST(BOOST_CPPFLAGS) + AC_SUBST(BOOST_LDFLAGS) + AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available]) + # execute ACTION-IF-FOUND (if present): + ifelse([$2], , :, [$2]) + fi + + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" +fi + +]) diff --git a/src/m4/ax_boost_chrono.m4 b/src/m4/ax_boost_chrono.m4 new file mode 100644 index 000000000..9b3958ec7 --- /dev/null +++ b/src/m4/ax_boost_chrono.m4 @@ -0,0 +1,118 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_boost_chrono.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_BOOST_CHRONO +# +# DESCRIPTION +# +# Test for System library from the Boost C++ libraries. The macro requires +# a preceding call to AX_BOOST_BASE. Further documentation is available at +# . +# +# This macro calls: +# +# AC_SUBST(BOOST_CHRONO_LIB) +# +# And sets: +# +# HAVE_BOOST_CHRONO +# +# LICENSE +# +# Copyright (c) 2012 Xiyue Deng +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 1 + +AC_DEFUN([AX_BOOST_CHRONO], +[ + AC_ARG_WITH([boost-chrono], + AS_HELP_STRING([--with-boost-chrono@<:@=special-lib@:>@], + [use the Chrono library from boost - it is possible to specify a certain library for the linker + e.g. --with-boost-chrono=boost_chrono-gcc-mt ]), + [ + if test "$withval" = "no"; then + want_boost="no" + elif test "$withval" = "yes"; then + want_boost="yes" + ax_boost_user_chrono_lib="" + else + want_boost="yes" + ax_boost_user_chrono_lib="$withval" + fi + ], + [want_boost="yes"] + ) + + if test "x$want_boost" = "xyes"; then + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_BUILD]) + CPPFLAGS_SAVED="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + + LDFLAGS_SAVED="$LDFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + + AC_CACHE_CHECK(whether the Boost::Chrono library is available, + ax_cv_boost_chrono, + [AC_LANG_PUSH([C++]) + CXXFLAGS_SAVE=$CXXFLAGS + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], + [[boost::chrono::system_clock::time_point time;]])], + ax_cv_boost_chrono=yes, ax_cv_boost_chrono=no) + CXXFLAGS=$CXXFLAGS_SAVE + AC_LANG_POP([C++]) + ]) + if test "x$ax_cv_boost_chrono" = "xyes"; then + AC_SUBST(BOOST_CPPFLAGS) + + AC_DEFINE(HAVE_BOOST_CHRONO,,[define if the Boost::Chrono library is available]) + BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` + + LDFLAGS_SAVE=$LDFLAGS + if test "x$ax_boost_user_chrono_lib" = "x"; then + for libextension in `ls $BOOSTLIBDIR/libboost_chrono*.so* $BOOSTLIBDIR/libboost_chrono*.dylib* $BOOSTLIBDIR/libboost_chrono*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_chrono.*\)\.so.*$;\1;' -e 's;^lib\(boost_chrono.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_chrono.*\)\.a.*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_CHRONO_LIB="-l$ax_lib"; AC_SUBST(BOOST_CHRONO_LIB) link_chrono="yes"; break], + [link_chrono="no"]) + done + if test "x$link_chrono" != "xyes"; then + for libextension in `ls $BOOSTLIBDIR/boost_chrono*.dll* $BOOSTLIBDIR/boost_chrono*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_chrono.*\)\.dll.*$;\1;' -e 's;^\(boost_chrono.*\)\.a.*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_CHRONO_LIB="-l$ax_lib"; AC_SUBST(BOOST_CHRONO_LIB) link_chrono="yes"; break], + [link_chrono="no"]) + done + fi + + else + for ax_lib in $ax_boost_user_chrono_lib boost_chrono-$ax_boost_user_chrono_lib; do + AC_CHECK_LIB($ax_lib, exit, + [BOOST_CHRONO_LIB="-l$ax_lib"; AC_SUBST(BOOST_CHRONO_LIB) link_chrono="yes"; break], + [link_chrono="no"]) + done + + fi + if test "x$ax_lib" = "x"; then + AC_MSG_ERROR(Could not find a version of the library!) + fi + if test "x$link_chrono" = "xno"; then + AC_MSG_ERROR(Could not link against $ax_lib !) + fi + fi + + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + fi +]) diff --git a/src/m4/ax_boost_filesystem.m4 b/src/m4/ax_boost_filesystem.m4 new file mode 100644 index 000000000..2a62da8d8 --- /dev/null +++ b/src/m4/ax_boost_filesystem.m4 @@ -0,0 +1,118 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_BOOST_FILESYSTEM +# +# DESCRIPTION +# +# Test for Filesystem library from the Boost C++ libraries. The macro +# requires a preceding call to AX_BOOST_BASE. Further documentation is +# available at . +# +# This macro calls: +# +# AC_SUBST(BOOST_FILESYSTEM_LIB) +# +# And sets: +# +# HAVE_BOOST_FILESYSTEM +# +# LICENSE +# +# Copyright (c) 2009 Thomas Porschberg +# Copyright (c) 2009 Michael Tindal +# Copyright (c) 2009 Roman Rybalko +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 21 + +AC_DEFUN([AX_BOOST_FILESYSTEM], +[ + AC_ARG_WITH([boost-filesystem], + AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@], + [use the Filesystem library from boost - it is possible to specify a certain library for the linker + e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]), + [ + if test "$withval" = "no"; then + want_boost="no" + elif test "$withval" = "yes"; then + want_boost="yes" + ax_boost_user_filesystem_lib="" + else + want_boost="yes" + ax_boost_user_filesystem_lib="$withval" + fi + ], + [want_boost="yes"] + ) + + if test "x$want_boost" = "xyes"; then + AC_REQUIRE([AC_PROG_CC]) + CPPFLAGS_SAVED="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + + LDFLAGS_SAVED="$LDFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + + LIBS_SAVED=$LIBS + LIBS="$LIBS $BOOST_SYSTEM_LIB" + export LIBS + + AC_CACHE_CHECK(whether the Boost::Filesystem library is available, + ax_cv_boost_filesystem, + [AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], + [[using namespace boost::filesystem; + path my_path( "foo/bar/data.txt" ); + return 0;]])], + ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no) + AC_LANG_POP([C++]) + ]) + if test "x$ax_cv_boost_filesystem" = "xyes"; then + AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available]) + BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` + if test "x$ax_boost_user_filesystem_lib" = "x"; then + for libextension in `ls $BOOSTLIBDIR/libboost_filesystem*.so* $BOOSTLIBDIR/libboost_filesystem*.dylib* $BOOSTLIBDIR/libboost_filesystem*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_filesystem.*\)\.so.*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.a*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.dylib$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], + [link_filesystem="no"]) + done + if test "x$link_program_options" != "xyes"; then + for libextension in `ls $BOOSTLIBDIR/boost_filesystem*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_filesystem.*\)\.dll.*$;\1;' -e 's;^\(boost_filesystem.*\)\.a*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], + [link_filesystem="no"]) + done + fi + else + for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do + AC_CHECK_LIB($ax_lib, exit, + [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], + [link_filesystem="no"]) + done + + fi + if test "x$ax_lib" = "x"; then + AC_MSG_ERROR(Could not find a version of the library!) + fi + if test "x$link_filesystem" != "xyes"; then + AC_MSG_ERROR(Could not link against $ax_lib !) + fi + fi + + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + LIBS="$LIBS_SAVED" + fi +]) diff --git a/src/m4/ax_boost_program_options.m4 b/src/m4/ax_boost_program_options.m4 new file mode 100644 index 000000000..d612f91da --- /dev/null +++ b/src/m4/ax_boost_program_options.m4 @@ -0,0 +1,108 @@ +# ============================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_boost_program_options.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_BOOST_PROGRAM_OPTIONS +# +# DESCRIPTION +# +# Test for program options library from the Boost C++ libraries. The macro +# requires a preceding call to AX_BOOST_BASE. Further documentation is +# available at . +# +# This macro calls: +# +# AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) +# +# And sets: +# +# HAVE_BOOST_PROGRAM_OPTIONS +# +# LICENSE +# +# Copyright (c) 2009 Thomas Porschberg +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 20 + +AC_DEFUN([AX_BOOST_PROGRAM_OPTIONS], +[ + AC_ARG_WITH([boost-program-options], + AS_HELP_STRING([--with-boost-program-options@<:@=special-lib@:>@], + [use the program options library from boost - it is possible to specify a certain library for the linker + e.g. --with-boost-program-options=boost_program_options-gcc-mt-1_33_1 ]), + [ + if test "$withval" = "no"; then + want_boost="no" + elif test "$withval" = "yes"; then + want_boost="yes" + ax_boost_user_program_options_lib="" + else + want_boost="yes" + ax_boost_user_program_options_lib="$withval" + fi + ], + [want_boost="yes"] + ) + + if test "x$want_boost" = "xyes"; then + AC_REQUIRE([AC_PROG_CC]) + export want_boost + CPPFLAGS_SAVED="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + LDFLAGS_SAVED="$LDFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + AC_CACHE_CHECK([whether the Boost::Program_Options library is available], + ax_cv_boost_program_options, + [AC_LANG_PUSH(C++) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include + ]], + [[boost::program_options::options_description generic("Generic options"); + return 0;]])], + ax_cv_boost_program_options=yes, ax_cv_boost_program_options=no) + AC_LANG_POP([C++]) + ]) + if test "$ax_cv_boost_program_options" = yes; then + AC_DEFINE(HAVE_BOOST_PROGRAM_OPTIONS,,[define if the Boost::PROGRAM_OPTIONS library is available]) + BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` + if test "x$ax_boost_user_program_options_lib" = "x"; then + for libextension in `ls $BOOSTLIBDIR/libboost_program_options*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.a*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], + [link_program_options="no"]) + done + if test "x$link_program_options" != "xyes"; then + for libextension in `ls $BOOSTLIBDIR/boost_program_options*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.a*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], + [link_program_options="no"]) + done + fi + else + for ax_lib in $ax_boost_user_program_options_lib boost_program_options-$ax_boost_user_program_options_lib; do + AC_CHECK_LIB($ax_lib, main, + [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], + [link_program_options="no"]) + done + fi + if test "x$ax_lib" = "x"; then + AC_MSG_ERROR(Could not find a version of the library!) + fi + if test "x$link_program_options" != "xyes"; then + AC_MSG_ERROR([Could not link against [$ax_lib] !]) + fi + fi + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + fi +]) diff --git a/src/m4/ax_boost_system.m4 b/src/m4/ax_boost_system.m4 new file mode 100644 index 000000000..7fbf6d360 --- /dev/null +++ b/src/m4/ax_boost_system.m4 @@ -0,0 +1,120 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_boost_system.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_BOOST_SYSTEM +# +# DESCRIPTION +# +# Test for System library from the Boost C++ libraries. The macro requires +# a preceding call to AX_BOOST_BASE. Further documentation is available at +# . +# +# This macro calls: +# +# AC_SUBST(BOOST_SYSTEM_LIB) +# +# And sets: +# +# HAVE_BOOST_SYSTEM +# +# LICENSE +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Michael Tindal +# Copyright (c) 2008 Daniel Casimiro +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 14 + +AC_DEFUN([AX_BOOST_SYSTEM], +[ + AC_ARG_WITH([boost-system], + AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@], + [use the System library from boost - it is possible to specify a certain library for the linker + e.g. --with-boost-system=boost_system-gcc-mt ]), + [ + if test "$withval" = "no"; then + want_boost="no" + elif test "$withval" = "yes"; then + want_boost="yes" + ax_boost_user_system_lib="" + else + want_boost="yes" + ax_boost_user_system_lib="$withval" + fi + ], + [want_boost="yes"] + ) + + if test "x$want_boost" = "xyes"; then + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_BUILD]) + CPPFLAGS_SAVED="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + + LDFLAGS_SAVED="$LDFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + + AC_CACHE_CHECK(whether the Boost::System library is available, + ax_cv_boost_system, + [AC_LANG_PUSH([C++]) + CXXFLAGS_SAVE=$CXXFLAGS + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], + [[boost::system::system_category]])], + ax_cv_boost_system=yes, ax_cv_boost_system=no) + CXXFLAGS=$CXXFLAGS_SAVE + AC_LANG_POP([C++]) + ]) + if test "x$ax_cv_boost_system" = "xyes"; then + AC_SUBST(BOOST_CPPFLAGS) + + AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available]) + BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` + + LDFLAGS_SAVE=$LDFLAGS + if test "x$ax_boost_user_system_lib" = "x"; then + for libextension in `ls $BOOSTLIBDIR/libboost_system*.so* $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;' -e 's;^lib\(boost_system.*\)\.a*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], + [link_system="no"]) + done + if test "x$link_system" != "xyes"; then + for libextension in `ls $BOOSTLIBDIR/boost_system*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;' -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], + [link_system="no"]) + done + fi + + else + for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do + AC_CHECK_LIB($ax_lib, exit, + [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], + [link_system="no"]) + done + + fi + if test "x$ax_lib" = "x"; then + AC_MSG_ERROR(Could not find a version of the library!) + fi + if test "x$link_system" = "xno"; then + AC_MSG_ERROR(Could not link against $ax_lib !) + fi + fi + + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + fi +]) diff --git a/src/m4/ax_boost_thread.m4 b/src/m4/ax_boost_thread.m4 new file mode 100644 index 000000000..d9cd8a1d1 --- /dev/null +++ b/src/m4/ax_boost_thread.m4 @@ -0,0 +1,153 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_boost_thread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_BOOST_THREAD +# +# DESCRIPTION +# +# Test for Thread library from the Boost C++ libraries. The macro requires +# a preceding call to AX_BOOST_BASE. Further documentation is available at +# . +# +# This macro calls: +# +# AC_SUBST(BOOST_THREAD_LIB) +# +# And sets: +# +# HAVE_BOOST_THREAD +# +# LICENSE +# +# Copyright (c) 2009 Thomas Porschberg +# Copyright (c) 2009 Michael Tindal +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 22 + +AC_DEFUN([AX_BOOST_THREAD], +[ + AC_ARG_WITH([boost-thread], + AS_HELP_STRING([--with-boost-thread@<:@=special-lib@:>@], + [use the Thread library from boost - it is possible to specify a certain library for the linker + e.g. --with-boost-thread=boost_thread-gcc-mt ]), + [ + if test "$withval" = "no"; then + want_boost="no" + elif test "$withval" = "yes"; then + want_boost="yes" + ax_boost_user_thread_lib="" + else + want_boost="yes" + ax_boost_user_thread_lib="$withval" + fi + ], + [want_boost="yes"] + ) + + if test "x$want_boost" = "xyes"; then + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_BUILD]) + CPPFLAGS_SAVED="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + + LDFLAGS_SAVED="$LDFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + + AC_CACHE_CHECK(whether the Boost::Thread library is available, + ax_cv_boost_thread, + [AC_LANG_PUSH([C++]) + CXXFLAGS_SAVE=$CXXFLAGS + + # let us handle platform dependent issues in + # configure.ac + + # if test "x$build_os" = "xsolaris" ; then + # CXXFLAGS="-pthreads $CXXFLAGS" + # elif test "x$build_os" = "xming32" ; then + # CXXFLAGS="-mthreads $CXXFLAGS" + # else + # CXXFLAGS="-pthread $CXXFLAGS" + # fi + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], + [[boost::thread_group thrds; + return 0;]])], + ax_cv_boost_thread=yes, ax_cv_boost_thread=no) + CXXFLAGS=$CXXFLAGS_SAVE + AC_LANG_POP([C++]) + ]) + if test "x$ax_cv_boost_thread" = "xyes"; then + # if test "x$build_os" = "xsolaris" ; then + # BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS" + # elif test "x$build_os" = "xming32" ; then + # BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS" + # else + # BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS" + # fi + + AC_SUBST(BOOST_CPPFLAGS) + + AC_DEFINE(HAVE_BOOST_THREAD,,[define if the Boost::Thread library is available]) + BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` + + LDFLAGS_SAVE=$LDFLAGS + # case "x$build_os" in + # *bsd* ) + # LDFLAGS="-pthread $LDFLAGS" + # break; + # ;; + # esac + if test "x$ax_boost_user_thread_lib" = "x"; then + for libextension in `ls $BOOSTLIBDIR/libboost_thread*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.a*$;\1;'`; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break], + [link_thread="no"]) + done + if test "x$link_thread" != "xyes"; then + for libextension in `ls $BOOSTLIBDIR/boost_thread*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.a*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break], + [link_thread="no"]) + done + fi + + else + for ax_lib in $ax_boost_user_thread_lib boost_thread-$ax_boost_user_thread_lib; do + AC_CHECK_LIB($ax_lib, exit, + [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break], + [link_thread="no"]) + done + + fi + if test "x$ax_lib" = "x"; then + AC_MSG_ERROR(Could not find a version of the library!) + fi + # if test "x$link_thread" = "xno"; then + # AC_MSG_ERROR(Could not link against $ax_lib !) + # else + # case "x$build_os" in + # *bsd* ) + # BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS" + # break; + # ;; + # esac + + # fi + fi + + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + fi +]) diff --git a/src/m4/ax_boost_unit_test_framework.m4 b/src/m4/ax_boost_unit_test_framework.m4 new file mode 100644 index 000000000..1115f5512 --- /dev/null +++ b/src/m4/ax_boost_unit_test_framework.m4 @@ -0,0 +1,137 @@ +# ================================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_boost_unit_test_framework.html +# ================================================================================ +# +# SYNOPSIS +# +# AX_BOOST_UNIT_TEST_FRAMEWORK +# +# DESCRIPTION +# +# Test for Unit_Test_Framework library from the Boost C++ libraries. The +# macro requires a preceding call to AX_BOOST_BASE. Further documentation +# is available at . +# +# This macro calls: +# +# AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) +# +# And sets: +# +# HAVE_BOOST_UNIT_TEST_FRAMEWORK +# +# LICENSE +# +# Copyright (c) 2008 Thomas Porschberg +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 19 + +AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK], +[ + AC_ARG_WITH([boost-unit-test-framework], + AS_HELP_STRING([--with-boost-unit-test-framework@<:@=special-lib@:>@], + [use the Unit_Test_Framework library from boost - it is possible to specify a certain library for the linker + e.g. --with-boost-unit-test-framework=boost_unit_test_framework-gcc ]), + [ + if test "$withval" = "no"; then + want_boost="no" + elif test "$withval" = "yes"; then + want_boost="yes" + ax_boost_user_unit_test_framework_lib="" + else + want_boost="yes" + ax_boost_user_unit_test_framework_lib="$withval" + fi + ], + [want_boost="yes"] + ) + + if test "x$want_boost" = "xyes"; then + AC_REQUIRE([AC_PROG_CC]) + CPPFLAGS_SAVED="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + + LDFLAGS_SAVED="$LDFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + + AC_CACHE_CHECK(whether the Boost::Unit_Test_Framework library is available, + ax_cv_boost_unit_test_framework, + [AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], + [[using boost::unit_test::test_suite; + test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" ); return 0;]])], + ax_cv_boost_unit_test_framework=yes, ax_cv_boost_unit_test_framework=no) + AC_LANG_POP([C++]) + ]) + if test "x$ax_cv_boost_unit_test_framework" = "xyes"; then + AC_DEFINE(HAVE_BOOST_UNIT_TEST_FRAMEWORK,,[define if the Boost::Unit_Test_Framework library is available]) + BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` + + if test "x$ax_boost_user_unit_test_framework_lib" = "x"; then + saved_ldflags="${LDFLAGS}" + for monitor_library in `ls $BOOSTLIBDIR/libboost_unit_test_framework*.so* $BOOSTLIBDIR/libboost_unit_test_framework*.dylib* $BOOSTLIBDIR/libboost_unit_test_framework*.a* 2>/dev/null` ; do + if test -r $monitor_library ; then + libextension=`echo $monitor_library | sed 's,.*/,,' | sed -e 's;^lib\(boost_unit_test_framework.*\)\.so.*$;\1;' -e 's;^lib\(boost_unit_test_framework.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_unit_test_framework.*\)\.a.*$;\1;'` + ax_lib=${libextension} + link_unit_test_framework="yes" + else + link_unit_test_framework="no" + fi + + if test "x$link_unit_test_framework" = "xyes"; then + BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib" + AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) + break + fi + done + if test "x$link_unit_test_framework" != "xyes"; then + for libextension in `ls $BOOSTLIBDIR/boost_unit_test_framework*.dll* $BOOSTLIBDIR/boost_unit_test_framework*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_unit_test_framework.*\)\.dll.*$;\1;' -e 's;^\(boost_unit_test_framework.*\)\.a.*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib"; AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) link_unit_test_framework="yes"; break], + [link_unit_test_framework="no"]) + done + fi + else + link_unit_test_framework="no" + saved_ldflags="${LDFLAGS}" + for ax_lib in boost_unit_test_framework-$ax_boost_user_unit_test_framework_lib $ax_boost_user_unit_test_framework_lib ; do + if test "x$link_unit_test_framework" = "xyes"; then + break; + fi + for unittest_library in `ls $BOOSTLIBDIR/lib${ax_lib}.so* $BOOSTLIBDIR/lib${ax_lib}.a* 2>/dev/null` ; do + if test -r $unittest_library ; then + libextension=`echo $unittest_library | sed 's,.*/,,' | sed -e 's;^lib\(boost_unit_test_framework.*\)\.so.*$;\1;' -e 's;^lib\(boost_unit_test_framework.*\)\.a*$;\1;'` + ax_lib=${libextension} + link_unit_test_framework="yes" + else + link_unit_test_framework="no" + fi + + if test "x$link_unit_test_framework" = "xyes"; then + BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib" + AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) + break + fi + done + done + fi + if test "x$ax_lib" = "x"; then + AC_MSG_ERROR(Could not find a version of the library!) + fi + if test "x$link_unit_test_framework" != "xyes"; then + AC_MSG_ERROR(Could not link against $ax_lib !) + fi + fi + + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + fi +]) diff --git a/src/m4/ax_check_compile_flag.m4 b/src/m4/ax_check_compile_flag.m4 new file mode 100644 index 000000000..c3a8d695a --- /dev/null +++ b/src/m4/ax_check_compile_flag.m4 @@ -0,0 +1,72 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 2 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/src/m4/ax_check_link_flag.m4 b/src/m4/ax_check_link_flag.m4 new file mode 100644 index 000000000..e2d0d363e --- /dev/null +++ b/src/m4/ax_check_link_flag.m4 @@ -0,0 +1,71 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the linker or gives an error. +# (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the linker's default flags +# when the check is done. The check is thus made with the flags: "LDFLAGS +# EXTRA-FLAGS FLAG". This can for example be used to force the linker to +# issue an error when a bad flag is given. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 2 + +AC_DEFUN([AX_CHECK_LINK_FLAG], +[AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl +AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ + ax_check_save_flags=$LDFLAGS + LDFLAGS="$LDFLAGS $4 $1" + AC_LINK_IFELSE([AC_LANG_PROGRAM()], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + LDFLAGS=$ax_check_save_flags]) +AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_LINK_FLAGS diff --git a/src/m4/ax_check_preproc_flag.m4 b/src/m4/ax_check_preproc_flag.m4 new file mode 100644 index 000000000..b1cfef6b8 --- /dev/null +++ b/src/m4/ax_check_preproc_flag.m4 @@ -0,0 +1,72 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_preproc_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_PREPROC_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's +# preprocessor or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the preprocessor's default +# flags when the check is done. The check is thus made with the flags: +# "CPPFLAGS EXTRA-FLAGS FLAG". This can for example be used to force the +# preprocessor to issue an error when a bad flag is given. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{COMPILE,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 2 + +AC_DEFUN([AX_CHECK_PREPROC_FLAG], +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]cppflags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG preprocessor accepts $1], CACHEVAR, [ + ax_check_save_flags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $4 $1" + AC_PREPROC_IFELSE([AC_LANG_PROGRAM()], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + CPPFLAGS=$ax_check_save_flags]) +AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_PREPROC_FLAGS diff --git a/src/m4/ax_pthread.m4 b/src/m4/ax_pthread.m4 new file mode 100644 index 000000000..6d400ed4e --- /dev/null +++ b/src/m4/ax_pthread.m4 @@ -0,0 +1,317 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also link it with them as well. e.g. you should link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threads programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name +# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2011 Daniel Richard G. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 20 + +AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) +AC_DEFUN([AX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_PUSH([C]) +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes) + AC_MSG_RESULT($ax_pthread_ok) + if test x"$ax_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case ${host_os} in + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" + ;; + + darwin*) + ax_pthread_flags="-pthread $ax_pthread_flags" + ;; +esac + +if test x"$ax_pthread_ok" = xno; then +for flag in $ax_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no) + if test x"$ax_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($ax_pthread_ok) + if test "x$ax_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_MSG_CHECKING([for joinable pthread attribute]) + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $attr; return attr /* ; */])], + [attr_name=$attr; break], + []) + done + AC_MSG_RESULT($attr_name) + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case ${host_os} in + aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; + osf* | hpux*) flag="-D_REENTRANT";; + solaris*) + if test "$GCC" = "yes"; then + flag="-D_REENTRANT" + else + flag="-mt -D_REENTRANT" + fi + ;; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + ax_cv_PTHREAD_PRIO_INHERIT, [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include ]], [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], + AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != xyes; then + case $host_os in + aix*) + AS_CASE(["x/$CC"], + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$ax_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + ax_pthread_ok=no + $2 +fi +AC_LANG_POP +])dnl AX_PTHREAD diff --git a/src/main.h b/src/main.h index a690a2bc9..38079cb6e 100644 --- a/src/main.h +++ b/src/main.h @@ -5,6 +5,10 @@ #ifndef BITCOIN_MAIN_H #define BITCOIN_MAIN_H +#if defined(HAVE_CONFIG_H) +#include "bitcoin-config.h" +#endif + #include "core.h" #include "bignum.h" #include "sync.h" diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw deleted file mode 100644 index 51830f234..000000000 --- a/src/makefile.linux-mingw +++ /dev/null @@ -1,135 +0,0 @@ -# Copyright (c) 2009-2010 Satoshi Nakamoto -# Distributed under the MIT/X11 software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -DEPSDIR:=/usr/i586-mingw32msvc - -CC := i586-mingw32msvc-gcc -CXX := i586-mingw32msvc-g++ - -USE_UPNP:=0 -USE_IPV6:=1 - -INCLUDEPATHS= \ - -I"$(CURDIR)" \ - -I"$(CURDIR)"/obj \ - -I"$(DEPSDIR)/boost_1_50_0" \ - -I"$(DEPSDIR)/db-4.8.30.NC/build_unix" \ - -I"$(DEPSDIR)/openssl-1.0.1c/include" \ - -I"$(DEPSDIR)" - -LIBPATHS= \ - -L"$(DEPSDIR)/boost_1_50_0/stage/lib" \ - -L"$(DEPSDIR)/db-4.8.30.NC/build_unix" \ - -L"$(DEPSDIR)/openssl-1.0.1c" - -LIBS= \ - $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a \ - -l boost_system-mt-s \ - -l boost_filesystem-mt-s \ - -l boost_program_options-mt-s \ - -l boost_thread_win32-mt-s \ - -l boost_chrono-mt-s \ - -l db_cxx \ - -l ssl \ - -l crypto - -DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DEBUGFLAGS=-g -xCXXFLAGS=-O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) $(CXXFLAGS) -# enable: ASLR, DEP and large address aware -xLDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware $(LDFLAGS) - -TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) - -ifndef USE_UPNP - override USE_UPNP = - -endif -ifneq (${USE_UPNP}, -) - LIBPATHS += -L"$(DEPSDIR)/miniupnpc" - LIBS += -l miniupnpc -l iphlpapi - DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP) -endif - -ifneq (${USE_IPV6}, -) - DEFS += -DUSE_IPV6=$(USE_IPV6) -endif - -LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock -l shlwapi - -# TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are -HEADERS = $(wildcard *.h) - -OBJS= \ - leveldb/libleveldb.a \ - obj/alert.o \ - obj/version.o \ - obj/checkpoints.o \ - obj/netbase.o \ - obj/addrman.o \ - obj/crypter.o \ - obj/key.o \ - obj/db.o \ - obj/init.o \ - obj/bitcoind.o \ - obj/keystore.o \ - obj/core.o \ - obj/main.o \ - obj/miner.o \ - obj/net.o \ - obj/protocol.o \ - obj/bitcoinrpc.o \ - obj/rpcdump.o \ - obj/rpcnet.o \ - obj/rpcmining.o \ - obj/rpcwallet.o \ - obj/rpcblockchain.o \ - obj/rpcrawtransaction.o \ - obj/script.o \ - obj/sync.o \ - obj/util.o \ - obj/wallet.o \ - obj/walletdb.o \ - obj/noui.o \ - obj/hash.o \ - obj/bloom.o \ - obj/leveldb.o \ - obj/txdb.o \ - obj/chainparams.o - -all: bitcoind.exe - -DEFS += -I"$(CURDIR)/leveldb/include" -DEFS += -I"$(CURDIR)/leveldb/helpers" -leveldb/libleveldb.a: - @echo "Building LevelDB ..." && cd leveldb && TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && i586-mingw32msvc-ranlib libleveldb.a && i586-mingw32msvc-ranlib libmemenv.a && cd .. - -obj/build.h: FORCE - /bin/sh ../share/genbuild.sh obj/build.h -version.cpp: obj/build.h -DEFS += -DHAVE_BUILD_INFO - -obj/%.o: %.cpp $(HEADERS) - $(CXX) -c $(xCXXFLAGS) -o $@ $< - -bitcoind.exe: $(OBJS:obj/%=obj/%) - $(CXX) $(xCXXFLAGS) $(xLDFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) - -TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) - -obj-test/%.o: test/%.cpp $(HEADERS) - $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -o $@ $< - -test_bitcoin.exe: $(TESTOBJS) $(filter-out obj/init.o obj/bitcoind.o,$(OBJS:obj/%=obj/%)) - $(CXX) $(xCXXFLAGS) $(xLDFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework-mt-s $(LIBS) - - -clean: - -rm -f obj/*.o - -rm -f bitcoind.exe - -rm -f obj-test/*.o - -rm -f test_bitcoin.exe - -rm -f obj/build.h - cd leveldb && TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) clean && cd .. - -FORCE: diff --git a/src/makefile.mingw b/src/makefile.mingw deleted file mode 100644 index cb989d8ae..000000000 --- a/src/makefile.mingw +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright (c) 2009-2010 Satoshi Nakamoto -# Distributed under the MIT/X11 software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -# Makefile for the MinGW g++ compiler/toolchain -# -# Assumes Berkeley DB, Boost, and OpenSSL have all been compiled and installed -# into /usr/local (/usr/local/include, /usr/local/lib). -# -# If dependencies are somewhere else, run 'make DEPSDIR=/path/' -# -# Boost libraries are given wacky names that include the particular version of -# boost you're using; set BOOST_SUFFIX appropriately. -# -# 'make clean' assumes it is running inside a MSYS shell, and uses 'rm' -# to remove files. - -CXX ?= g++ - -USE_UPNP:=- -USE_IPV6:=1 - -DEPSDIR?=/usr/local -BOOST_SUFFIX?=-mgw46-mt-s-1_52 - -INCLUDEPATHS= \ - -I"$(CURDIR)" \ - -I"$(DEPSDIR)/include" - -LIBPATHS= \ - -L"$(CURDIR)/leveldb" \ - -L"$(DEPSDIR)/lib" - -LIBS= \ - -l leveldb \ - -l memenv \ - -l boost_system$(BOOST_SUFFIX) \ - -l boost_filesystem$(BOOST_SUFFIX) \ - -l boost_program_options$(BOOST_SUFFIX) \ - -l boost_thread$(BOOST_SUFFIX) \ - -l boost_chrono$(BOOST_SUFFIX) \ - -l db_cxx \ - -l ssl \ - -l crypto - -DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DEBUGFLAGS=-g -CFLAGS=-mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) -# enable: ASLR, DEP and large address aware -LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware - -TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) - -ifndef USE_UPNP - override USE_UPNP = - -endif -ifneq (${USE_UPNP}, -) - LIBS += -l miniupnpc -l iphlpapi - DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP) -endif - -ifneq (${USE_IPV6}, -) - DEFS += -DUSE_IPV6=$(USE_IPV6) -endif - -LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock -l shlwapi - -# TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are -HEADERS = $(wildcard *.h) - -OBJS= \ - leveldb/libleveldb.a \ - obj/alert.o \ - obj/version.o \ - obj/checkpoints.o \ - obj/netbase.o \ - obj/addrman.o \ - obj/crypter.o \ - obj/key.o \ - obj/db.o \ - obj/init.o \ - obj/bitcoind.o \ - obj/keystore.o \ - obj/core.o \ - obj/main.o \ - obj/miner.o \ - obj/net.o \ - obj/protocol.o \ - obj/bitcoinrpc.o \ - obj/rpcdump.o \ - obj/rpcnet.o \ - obj/rpcmining.o \ - obj/rpcwallet.o \ - obj/rpcblockchain.o \ - obj/rpcrawtransaction.o \ - obj/script.o \ - obj/sync.o \ - obj/util.o \ - obj/wallet.o \ - obj/walletdb.o \ - obj/hash.o \ - obj/bloom.o \ - obj/noui.o \ - obj/leveldb.o \ - obj/txdb.o \ - obj/chainparams.o - - -all: bitcoind.exe - -test check: test_bitcoin.exe FORCE - test_bitcoin.exe - -# -# LevelDB support -# -DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) -DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) - -leveldb/libleveldb.a: - cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(CFLAGS)" TARGET_OS=NATIVE_WINDOWS libleveldb.a libmemenv.a && cd .. - -obj/%.o: %.cpp $(HEADERS) - $(CXX) -c $(CFLAGS) -o $@ $< - -bitcoind.exe: $(OBJS:obj/%=obj/%) - $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) - -TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) - -obj-test/%.o: test/%.cpp $(HEADERS) - $(CXX) -c $(TESTDEFS) $(CFLAGS) -o $@ $< - -test_bitcoin.exe: $(TESTOBJS) $(filter-out obj/init.o obj/bitcoind.o,$(OBJS:obj/%=obj/%)) - $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework$(BOOST_SUFFIX) $(LIBS) - -clean: - rm -f bitcoind.exe test_bitcoin.exe - rm -f obj/* - rm -f obj-test/* - cd leveldb && $(MAKE) TARGET_OS=NATIVE_WINDOWS clean && cd .. - -FORCE: diff --git a/src/makefile.osx b/src/makefile.osx deleted file mode 100644 index ee364f5c4..000000000 --- a/src/makefile.osx +++ /dev/null @@ -1,181 +0,0 @@ -# -*- mode: Makefile; -*- -# Copyright (c) 2011 Bitcoin Developers -# Distributed under the MIT/X11 software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -# Mac OS X makefile for bitcoin -# Originally by Laszlo Hanyecz (solar@heliacal.net) - -CXX=llvm-g++ -DEPSDIR=/opt/local - -INCLUDEPATHS= \ - -I"$(CURDIR)" \ - -I"$(CURDIR)"/obj \ - -I"$(DEPSDIR)/include" \ - -I"$(DEPSDIR)/include/db48" - -LIBPATHS= \ - -L"$(DEPSDIR)/lib" \ - -L"$(DEPSDIR)/lib/db48" - -USE_UPNP:=1 -USE_IPV6:=1 - -LIBS= -dead_strip - -TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) - -ifdef STATIC -# Build STATIC if you are redistributing the bitcoind binary -TESTLIBS += \ - $(DEPSDIR)/lib/libboost_unit_test_framework-mt.a -LIBS += \ - $(DEPSDIR)/lib/db48/libdb_cxx-4.8.a \ - $(DEPSDIR)/lib/libboost_system-mt.a \ - $(DEPSDIR)/lib/libboost_filesystem-mt.a \ - $(DEPSDIR)/lib/libboost_program_options-mt.a \ - $(DEPSDIR)/lib/libboost_thread-mt.a \ - $(DEPSDIR)/lib/libboost_chrono-mt.a \ - $(DEPSDIR)/lib/libssl.a \ - $(DEPSDIR)/lib/libcrypto.a \ - -lz -else -TESTLIBS += \ - -lboost_unit_test_framework-mt -LIBS += \ - -ldb_cxx-4.8 \ - -lboost_system-mt \ - -lboost_filesystem-mt \ - -lboost_program_options-mt \ - -lboost_thread-mt \ - -lboost_chrono-mt \ - -lssl \ - -lcrypto \ - -lz -TESTDEFS += -DBOOST_TEST_DYN_LINK -endif - -DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE - -ifdef RELEASE -# Compile for maximum compatibility and smallest size. -# This requires that dependencies are compiled -# the same way. -CFLAGS = -mmacosx-version-min=10.5 -arch i386 -O3 -else -DEBUGFLAGS = -g -endif - -# ppc doesn't work because we don't support big-endian -CFLAGS += -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \ - $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) - -OBJS= \ - leveldb/libleveldb.a \ - obj/alert.o \ - obj/version.o \ - obj/checkpoints.o \ - obj/netbase.o \ - obj/addrman.o \ - obj/crypter.o \ - obj/key.o \ - obj/db.o \ - obj/init.o \ - obj/bitcoind.o \ - obj/keystore.o \ - obj/core.o \ - obj/main.o \ - obj/miner.o \ - obj/net.o \ - obj/protocol.o \ - obj/bitcoinrpc.o \ - obj/rpcdump.o \ - obj/rpcnet.o \ - obj/rpcmining.o \ - obj/rpcwallet.o \ - obj/rpcblockchain.o \ - obj/rpcrawtransaction.o \ - obj/script.o \ - obj/sync.o \ - obj/util.o \ - obj/wallet.o \ - obj/walletdb.o \ - obj/hash.o \ - obj/bloom.o \ - obj/noui.o \ - obj/leveldb.o \ - obj/txdb.o \ - obj/chainparams.o - -ifndef USE_UPNP - override USE_UPNP = - -endif -ifneq (${USE_UPNP}, -) - DEFS += -DUSE_UPNP=$(USE_UPNP) -ifdef STATIC - LIBS += $(DEPSDIR)/lib/libminiupnpc.a -else - LIBS += -lminiupnpc -endif -endif - -ifneq (${USE_IPV6}, -) - DEFS += -DUSE_IPV6=$(USE_IPV6) -endif - -all: bitcoind - -test check: test_bitcoin FORCE - ./test_bitcoin - -# -# LevelDB support -# -LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a -DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) -DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) -leveldb/libleveldb.a: - @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(CFLAGS)" libleveldb.a libmemenv.a && cd .. - -# auto-generated dependencies: --include obj/*.P --include obj-test/*.P - -obj/build.h: FORCE - /bin/sh ../share/genbuild.sh obj/build.h -version.cpp: obj/build.h -DEFS += -DHAVE_BUILD_INFO - -obj/%.o: %.cpp - $(CXX) -c $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $< - @cp $(@:%.o=%.d) $(@:%.o=%.P); \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ - rm -f $(@:%.o=%.d) - -bitcoind: $(OBJS:obj/%=obj/%) - $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) - -TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) - -obj-test/%.o: test/%.cpp - $(CXX) -c $(TESTDEFS) $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $< - @cp $(@:%.o=%.d) $(@:%.o=%.P); \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ - rm -f $(@:%.o=%.d) - -test_bitcoin: $(TESTOBJS) $(filter-out obj/init.o obj/bitcoind.o,$(OBJS:obj/%=obj/%)) - $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) $(TESTLIBS) - -clean: - -rm -f bitcoind test_bitcoin - -rm -f obj/*.o - -rm -f obj-test/*.o - -rm -f obj/*.P - -rm -f obj-test/*.P - -rm -f obj/build.h - -cd leveldb && $(MAKE) clean || true - -FORCE: diff --git a/src/makefile.unix b/src/makefile.unix deleted file mode 100644 index 55fd594f9..000000000 --- a/src/makefile.unix +++ /dev/null @@ -1,206 +0,0 @@ -# Copyright (c) 2009-2010 Satoshi Nakamoto -# Distributed under the MIT/X11 software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -# :=0 --> UPnP support turned off by default at runtime -# :=1 --> UPnP support turned on by default at runtime -# :=- --> No UPnP support - miniupnp not required -USE_UPNP:=0 - -# :=1 --> Enable IPv6 support -# :=0 --> Disable IPv6 support -USE_IPV6:=1 - -LINK:=$(CXX) - -DEFS=-DBOOST_SPIRIT_THREADSAFE -DBOOST_NO_CXX11_VARIADIC_TEMPLATES -D_FILE_OFFSET_BITS=64 - -DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH)) -LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH)) - -TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) - -LMODE = dynamic -LMODE2 = dynamic -ifdef STATIC - LMODE = static - ifeq (${STATIC}, all) - LMODE2 = static - endif -else - TESTDEFS += -DBOOST_TEST_DYN_LINK -endif - -# for boost 1.37, add -mt to the boost libraries -LIBS += \ - -Wl,-B$(LMODE) \ - -l boost_system$(BOOST_LIB_SUFFIX) \ - -l boost_filesystem$(BOOST_LIB_SUFFIX) \ - -l boost_program_options$(BOOST_LIB_SUFFIX) \ - -l boost_thread$(BOOST_LIB_SUFFIX) \ - -l db_cxx$(BDB_LIB_SUFFIX) \ - -l ssl \ - -l crypto - -TESTLIBS += \ - -Wl,-B$(LMODE) \ - -l boost_unit_test_framework$(BOOST_LIB_SUFFIX) - -ifndef USE_UPNP - override USE_UPNP = - -endif -ifneq (${USE_UPNP}, -) - LIBS += -l miniupnpc - DEFS += -DUSE_UPNP=$(USE_UPNP) -endif - -ifneq (${USE_IPV6}, -) - DEFS += -DUSE_IPV6=$(USE_IPV6) -endif - -LIBS+= \ - -Wl,-B$(LMODE2) \ - -l z \ - -l dl \ - -l pthread - - -# Hardening -# Make some classes of vulnerabilities unexploitable in case one is discovered. -# - # This is a workaround for Ubuntu bug #691722, the default -fstack-protector causes - # -fstack-protector-all to be ignored unless -fno-stack-protector is used first. - # see: https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/691722 - HARDENING=-fno-stack-protector - - # Stack Canaries - # Put numbers at the beginning of each stack frame and check that they are the same. - # If a stack buffer if overflowed, it writes over the canary number and then on return - # when that number is checked, it won't be the same and the program will exit with - # a "Stack smashing detected" error instead of being exploited. - HARDENING+=-fstack-protector-all -Wstack-protector - - # Make some important things such as the global offset table read only as soon as - # the dynamic linker is finished building it. This will prevent overwriting of addresses - # which would later be jumped to. - LDHARDENING+=-Wl,-z,relro -Wl,-z,now - - # Build position independent code to take advantage of Address Space Layout Randomization - # offered by some kernels. - # see doc/build-unix.txt for more information. - ifdef PIE - HARDENING+=-fPIE - LDHARDENING+=-pie - endif - - # -D_FORTIFY_SOURCE=2 does some checking for potentially exploitable code patterns in - # the source such overflowing a statically defined buffer. - HARDENING+=-D_FORTIFY_SOURCE=2 -# - - -DEBUGFLAGS=-g - -# CXXFLAGS can be specified on the make command line, so we use xCXXFLAGS that only -# adds some defaults in front. Unfortunately, CXXFLAGS=... $(CXXFLAGS) does not work. -xCXXFLAGS=-O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \ - $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS) - -# LDFLAGS can be specified on the make command line, so we use xLDFLAGS that only -# adds some defaults in front. Unfortunately, LDFLAGS=... $(LDFLAGS) does not work. -xLDFLAGS=$(LDHARDENING) $(LDFLAGS) - -OBJS= \ - leveldb/libleveldb.a \ - obj/alert.o \ - obj/version.o \ - obj/checkpoints.o \ - obj/netbase.o \ - obj/addrman.o \ - obj/crypter.o \ - obj/key.o \ - obj/db.o \ - obj/init.o \ - obj/bitcoind.o \ - obj/keystore.o \ - obj/core.o \ - obj/main.o \ - obj/miner.o \ - obj/net.o \ - obj/protocol.o \ - obj/bitcoinrpc.o \ - obj/rpcdump.o \ - obj/rpcnet.o \ - obj/rpcmining.o \ - obj/rpcwallet.o \ - obj/rpcblockchain.o \ - obj/rpcrawtransaction.o \ - obj/script.o \ - obj/sync.o \ - obj/util.o \ - obj/wallet.o \ - obj/walletdb.o \ - obj/hash.o \ - obj/bloom.o \ - obj/noui.o \ - obj/leveldb.o \ - obj/txdb.o \ - obj/chainparams.o - - -all: bitcoind - -test check: test_bitcoin FORCE - ./test_bitcoin - -# -# LevelDB support -# -MAKEOVERRIDES = -LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a -DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) -DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) -leveldb/libleveldb.a: - @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && cd .. - -# auto-generated dependencies: --include obj/*.P --include obj-test/*.P - -obj/build.h: FORCE - /bin/sh ../share/genbuild.sh obj/build.h -version.cpp: obj/build.h -DEFS += -DHAVE_BUILD_INFO - -obj/%.o: %.cpp - $(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $< - @cp $(@:%.o=%.d) $(@:%.o=%.P); \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ - rm -f $(@:%.o=%.d) - -bitcoind: $(OBJS:obj/%=obj/%) - $(LINK) $(xCXXFLAGS) -o $@ $^ $(xLDFLAGS) $(LIBS) - -TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) - -obj-test/%.o: test/%.cpp - $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $< - @cp $(@:%.o=%.d) $(@:%.o=%.P); \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ - rm -f $(@:%.o=%.d) - -test_bitcoin: $(TESTOBJS) $(filter-out obj/init.o obj/bitcoind.o,$(OBJS:obj/%=obj/%)) - $(LINK) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ $(TESTLIBS) $(xLDFLAGS) $(LIBS) - -clean: - -rm -f bitcoind test_bitcoin - -rm -f obj/*.o - -rm -f obj-test/*.o - -rm -f obj/*.P - -rm -f obj-test/*.P - -rm -f obj/build.h - -cd leveldb && $(MAKE) clean || true - -FORCE: diff --git a/src/net.cpp b/src/net.cpp index 1f461e55d..02b99fd04 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -3,6 +3,10 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#if defined(HAVE_CONFIG_H) +#include "bitcoin-config.h" +#endif + #include "chainparams.h" #include "db.h" #include "net.h" @@ -28,6 +32,9 @@ // Dump addresses to peers.dat every 15 minutes (900s) #define DUMP_ADDRESSES_INTERVAL 900 +#if !defined(HAVE_MSG_NOSIGNAL) +#define MSG_NOSIGNAL 0 +#endif using namespace std; using namespace boost; diff --git a/src/netbase.cpp b/src/netbase.cpp index 348771375..d02490ad4 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -15,6 +15,10 @@ #include // for to_lower() #include // for startswith() and endswith() +#if !defined(HAVE_MSG_NOSIGNAL) +#define MSG_NOSIGNAL 0 +#endif + using namespace std; // Settings diff --git a/src/netbase.h b/src/netbase.h index e4ec4ef59..8d5135e97 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -4,6 +4,10 @@ #ifndef BITCOIN_NETBASE_H #define BITCOIN_NETBASE_H +#if defined(HAVE_CONFIG_H) +#include "bitcoin-config.h" +#endif + #include #include diff --git a/src/qt/Makefile.am b/src/qt/Makefile.am new file mode 100644 index 000000000..c6c4cb37a --- /dev/null +++ b/src/qt/Makefile.am @@ -0,0 +1,160 @@ +include $(top_srcdir)/src/Makefile.include + +AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ + -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/leveldb/helpers -I$(top_builddir)/src/qt \ + -I$(top_builddir)/src/qt/forms $(BOOST_INCLUDES) $(PROTOBUF_CFLAGS) \ + $(QR_CFLAGS) +AM_LDFLAGS = $(PTHREAD_CFLAGS) +bin_PROGRAMS = bitcoin-qt +noinst_LIBRARIES = libbitcoinqt.a +SUBDIRS = $(BUILD_TEST_QT) +DIST_SUBDIRS = test + +# bitcoin qt core # +QT_TS = locale/bitcoin_ach.ts locale/bitcoin_af_ZA.ts locale/bitcoin_ar.ts \ + locale/bitcoin_be_BY.ts locale/bitcoin_bg.ts locale/bitcoin_bs.ts \ + locale/bitcoin_ca_ES.ts locale/bitcoin_ca.ts locale/bitcoin_cs.ts \ + locale/bitcoin_cy.ts locale/bitcoin_da.ts locale/bitcoin_de.ts \ + locale/bitcoin_el_GR.ts locale/bitcoin_en.ts locale/bitcoin_eo.ts \ + locale/bitcoin_es_CL.ts locale/bitcoin_es.ts locale/bitcoin_et.ts \ + locale/bitcoin_eu_ES.ts locale/bitcoin_fa_IR.ts locale/bitcoin_fa.ts \ + locale/bitcoin_fi.ts locale/bitcoin_fr_CA.ts locale/bitcoin_fr.ts \ + locale/bitcoin_gu_IN.ts locale/bitcoin_he.ts locale/bitcoin_hi_IN.ts \ + locale/bitcoin_hr.ts locale/bitcoin_hu.ts locale/bitcoin_id_ID.ts \ + locale/bitcoin_it.ts locale/bitcoin_ja.ts locale/bitcoin_kk_KZ.ts \ + locale/bitcoin_ko_KR.ts locale/bitcoin_la.ts locale/bitcoin_lt.ts \ + locale/bitcoin_lv_LV.ts locale/bitcoin_ms_MY.ts locale/bitcoin_nb.ts \ + locale/bitcoin_nl.ts locale/bitcoin_pl.ts locale/bitcoin_pt_BR.ts \ + locale/bitcoin_pt_PT.ts locale/bitcoin_ro_RO.ts locale/bitcoin_ru.ts \ + locale/bitcoin_sk.ts locale/bitcoin_sq.ts locale/bitcoin_sr.ts \ + locale/bitcoin_sv.ts locale/bitcoin_th_TH.ts locale/bitcoin_tr.ts \ + locale/bitcoin_uk.ts locale/bitcoin_vi.ts locale/bitcoin_vi_VN.ts \ + locale/bitcoin_zh_CN.ts locale/bitcoin_zh_TW.ts + +QT_FORMS_UI = forms/aboutdialog.ui forms/addressbookpage.ui \ + forms/askpassphrasedialog.ui forms/editaddressdialog.ui forms/intro.ui \ + forms/optionsdialog.ui forms/overviewpage.ui forms/qrcodedialog.ui \ + forms/rpcconsole.ui forms/sendcoinsdialog.ui forms/sendcoinsentry.ui \ + forms/signverifymessagedialog.ui forms/transactiondescdialog.ui + +QT_MOC_CPP = moc_aboutdialog.cpp moc_addressbookpage.cpp \ + moc_addresstablemodel.cpp moc_askpassphrasedialog.cpp \ + moc_bitcoinaddressvalidator.cpp moc_bitcoinamountfield.cpp \ + moc_bitcoingui.cpp moc_bitcoinunits.cpp moc_clientmodel.cpp \ + moc_csvmodelwriter.cpp moc_editaddressdialog.cpp moc_guiutil.cpp \ + moc_intro.cpp moc_macdockiconhandler.cpp moc_macnotificationhandler.cpp \ + moc_monitoreddatamapper.cpp moc_notificator.cpp moc_optionsdialog.cpp \ + moc_optionsmodel.cpp moc_overviewpage.cpp moc_paymentserver.cpp \ + moc_qrcodedialog.cpp moc_qvalidatedlineedit.cpp moc_qvaluecombobox.cpp \ + moc_rpcconsole.cpp moc_sendcoinsdialog.cpp moc_sendcoinsentry.cpp \ + moc_signverifymessagedialog.cpp moc_splashscreen.cpp moc_transactiondesc.cpp \ + moc_transactiondescdialog.cpp moc_transactionfilterproxy.cpp \ + moc_transactiontablemodel.cpp moc_transactionview.cpp moc_walletframe.cpp \ + moc_walletmodel.cpp moc_walletstack.cpp moc_walletview.cpp + +QT_MOC = intro.moc overviewpage.moc rpcconsole.moc + +QT_QRC_CPP = qrc_bitcoin.cpp +QT_QRC = bitcoin.qrc + +PROTOBUF_CC = paymentrequest.pb.cc +PROTOBUF_H = paymentrequest.pb.h +PROTOBUF_PROTO = paymentrequest.proto + +BITCOIN_QT_H = aboutdialog.h addressbookpage.h addresstablemodel.h \ + askpassphrasedialog.h bitcoinaddressvalidator.h bitcoinamountfield.h \ + bitcoingui.h bitcoinunits.h clientmodel.h csvmodelwriter.h \ + editaddressdialog.h guiconstants.h guiutil.h intro.h macdockiconhandler.h \ + macnotificationhandler.h monitoreddatamapper.h notificator.h optionsdialog.h \ + optionsmodel.h overviewpage.h paymentrequestplus.h paymentserver.h \ + qrcodedialog.h qvalidatedlineedit.h qvaluecombobox.h rpcconsole.h \ + sendcoinsdialog.h sendcoinsentry.h signverifymessagedialog.h splashscreen.h \ + transactiondescdialog.h transactiondesc.h transactionfilterproxy.h \ + transactionrecord.h transactiontablemodel.h transactionview.h walletframe.h \ + walletmodel.h walletmodeltransaction.h walletstack.h walletview.h + +RES_ICONS = res/icons/bitcoin.png res/icons/address-book.png \ + res/icons/quit.png res/icons/send.png res/icons/toolbar.png \ + res/icons/connect0_16.png res/icons/connect1_16.png \ + res/icons/connect2_16.png res/icons/connect3_16.png \ + res/icons/connect4_16.png res/icons/transaction0.png \ + res/icons/transaction2.png res/icons/clock1.png res/icons/clock2.png \ + res/icons/clock3.png res/icons/clock4.png res/icons/clock5.png \ + res/icons/configure.png res/icons/receive.png res/icons/editpaste.png \ + res/icons/editcopy.png res/icons/add.png res/icons/bitcoin_testnet.png \ + res/icons/toolbar_testnet.png res/icons/edit.png res/icons/history.png \ + res/icons/overview.png res/icons/export.png res/icons/synced.png \ + res/icons/remove.png res/icons/tx_mined.png res/icons/tx_input.png \ + res/icons/tx_output.png res/icons/tx_inout.png res/icons/lock_closed.png \ + res/icons/lock_open.png res/icons/key.png res/icons/filesave.png \ + res/icons/qrcode.png res/icons/debugwindow.png res/icons/bitcoin.ico \ + res/icons/bitcoin_testnet.ico + +RES_IMAGES = res/images/about.png res/images/splash.png \ + res/images/splash_testnet.png + +RES_MOVIES = res/movies/update_spinner.mng + +BITCOIN_RC = res/bitcoin-qt-res.rc + +libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(QT_INCLUDES) \ + -I$(top_srcdir)/src/qt/forms $(QT_DBUS_INCLUDES) +libbitcoinqt_a_SOURCES = aboutdialog.cpp addressbookpage.cpp \ + addresstablemodel.cpp askpassphrasedialog.cpp bitcoinaddressvalidator.cpp \ + bitcoinamountfield.cpp bitcoin.cpp bitcoingui.cpp bitcoinstrings.cpp \ + bitcoinunits.cpp clientmodel.cpp csvmodelwriter.cpp editaddressdialog.cpp \ + guiutil.cpp intro.cpp monitoreddatamapper.cpp notificator.cpp \ + optionsdialog.cpp optionsmodel.cpp overviewpage.cpp paymentrequestplus.cpp \ + paymentserver.cpp qvalidatedlineedit.cpp qvaluecombobox.cpp \ + rpcconsole.cpp sendcoinsdialog.cpp sendcoinsentry.cpp \ + signverifymessagedialog.cpp splashscreen.cpp transactiondesc.cpp \ + transactiondescdialog.cpp transactionfilterproxy.cpp transactionrecord.cpp \ + transactiontablemodel.cpp transactionview.cpp walletframe.cpp \ + walletmodel.cpp walletmodeltransaction.cpp walletstack.cpp walletview.cpp \ + $(BITCOIN_QT_H) $(QT_FORMS_UI) $(QT_QRC) $(QT_TS) $(PROTOBUF_PROTO) \ + $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES) + +nodist_libbitcoinqt_a_SOURCES = $(QT_MOC_CPP) $(QT_MOC) $(PROTOBUF_CC) \ + $(PROTOBUF_H) $(QT_QRC_CPP) + +BUILT_SOURCES = $(nodist_libbitcoinqt_a_SOURCES) + +#Generating these with a half-written protobuf header leads to wacky results. +#This makes sure it's done. +$(QT_MOC): $(PROTOBUF_H) +$(QT_MOC_CPP): $(PROTOBUF_H) + +if TARGET_DARWIN + libbitcoinqt_a_SOURCES += macdockiconhandler.mm macnotificationhandler.mm +endif +if TARGET_WINDOWS + libbitcoinqt_a_SOURCES += $(BITCOIN_RC) +endif +if USE_QRCODE + libbitcoinqt_a_SOURCES += qrcodedialog.cpp +endif +# + +# bitcoin-qt binary # +bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(QT_INCLUDES) \ + -I$(top_srcdir)/src/qt/forms +bitcoin_qt_SOURCES = bitcoin.cpp +bitcoin_qt_LDADD = libbitcoinqt.a $(LIBBITCOIN) $(LIBLEVELDB) $(LIBMEMENV) \ + $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) + +# forms/foo.h -> forms/ui_foo.h +QT_FORMS_H=$(join $(dir $(QT_FORMS_UI)),$(addprefix ui_, $(notdir $(QT_FORMS_UI:.ui=.h)))) + +#locale/foo.ts -> locale/foo.qm +QT_QM=$(QT_TS:.ts=.qm) + +.SECONDARY: $(QT_QM) + +$(QT_QRC_CPP): $(QT_QRC) $(QT_QM) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES) $(PROTOBUF_H) + @cd $(abs_srcdir); test -f $(RCC) && $(RCC) -name bitcoin -o $(abs_builddir)/$@ $< || \ + echo error: could not build $@ + $(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak + $(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak + +CLEANFILES = $(BUILT_SOURCES) $(QT_QM) $(QT_FORMS_H) *.gcda *.gcno diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index 8906174d7..5b8d44481 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) +#include "bitcoin-config.h" +#endif + #include "addressbookpage.h" #include "ui_addressbookpage.h" diff --git a/src/qt/notificator.h b/src/qt/notificator.h index d1fe37fea..6c9a46bcf 100644 --- a/src/qt/notificator.h +++ b/src/qt/notificator.h @@ -1,6 +1,10 @@ #ifndef NOTIFICATOR_H #define NOTIFICATOR_H +#if defined(HAVE_CONFIG_H) +#include "bitcoin-config.h" +#endif + #include #include diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index b2451aea3..7ccda6cdd 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) +#include "bitcoin-config.h" +#endif + #include "optionsdialog.h" #include "ui_optionsdialog.h" diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index d93a60e1b..95efc5832 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) +#include "bitcoin-config.h" +#endif + #include "optionsmodel.h" #include "bitcoinunits.h" diff --git a/src/qt/res/bitcoin-qt.rc b/src/qt/res/bitcoin-qt-res.rc similarity index 100% rename from src/qt/res/bitcoin-qt.rc rename to src/qt/res/bitcoin-qt-res.rc diff --git a/src/qt/test/Makefile.am b/src/qt/test/Makefile.am new file mode 100644 index 000000000..f51ac9bd6 --- /dev/null +++ b/src/qt/test/Makefile.am @@ -0,0 +1,26 @@ +include $(top_srcdir)/src/Makefile.include + +AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ + -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/leveldb/helpers -I$(top_srcdir)/src/qt \ + -I$(top_builddir)/src/qt $(BOOST_INCLUDES) $(PROTOBUF_CFLAGS) \ + $(QR_CFLAGS) +AM_LDFLAGS = $(PTHREAD_CFLAGS) +bin_PROGRAMS = test_bitcoin-qt +TESTS = test_bitcoin-qt + +TEST_QT_MOC_CPP = moc_uritests.cpp moc_paymentservertests.cpp + +TEST_QT_H = uritests.h paymentservertests.h paymentrequestdata.h + +BUILT_SOURCES = $(TEST_QT_MOC_CPP) + +test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(QT_INCLUDES) $(QT_TEST_INCLUDES) +test_bitcoin_qt_SOURCES = test_main.cpp uritests.cpp paymentservertests.cpp $(TEST_QT_H) +nodist_test_bitcoin_qt_SOURCES = $(TEST_QT_MOC_CPP) +test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN) $(LIBLEVELDB) \ + $(LIBMEMENV) $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) \ + $(QR_LIBS) $(PROTOBUF_LIBS) + +CLEANFILES = $(BUILT_SOURCES) *.gcda *.gcno + diff --git a/src/qt/test/paymentservertests.cpp b/src/qt/test/paymentservertests.cpp index 6c8ad62b2..34079e94f 100644 --- a/src/qt/test/paymentservertests.cpp +++ b/src/qt/test/paymentservertests.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/src/test/Makefile.am b/src/test/Makefile.am new file mode 100644 index 000000000..80571aa29 --- /dev/null +++ b/src/test/Makefile.am @@ -0,0 +1,38 @@ +include $(top_srcdir)/src/Makefile.include + +AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ + -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src/leveldb/helpers \ + -I$(top_srcdir)/src $(BOOST_INCLUDES) + +AM_LDFLAGS = $(PTHREAD_CFLAGS) + +bin_PROGRAMS = test_bitcoin + +TESTS = test_bitcoin + +TEST_DATA_DIR=$(top_srcdir)/src/test/data + +TEST_DATA_FILES= $(TEST_DATA_DIR)/script_valid.json \ + $(TEST_DATA_DIR)/base58_keys_valid.json $(TEST_DATA_DIR)/sig_canonical.json \ + $(TEST_DATA_DIR)/sig_noncanonical.json \ + $(TEST_DATA_DIR)/base58_encode_decode.json $(TEST_DATA_DIR)/alertTests \ + $(TEST_DATA_DIR)/base58_keys_invalid.json \ + $(TEST_DATA_DIR)/script_invalid.json $(TEST_DATA_DIR)/tx_invalid.json \ + $(TEST_DATA_DIR)/tx_valid.json + +# test_bitcoin binary # +test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(TESTDEFS) \ + -DTEST_DATA_DIR=$(TEST_DATA_DIR) +test_bitcoin_LDADD = $(LIBBITCOIN) $(LIBLEVELDB) $(LIBMEMENV) \ + $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) +test_bitcoin_SOURCES = accounting_tests.cpp alert_tests.cpp \ + allocator_tests.cpp base32_tests.cpp base58_tests.cpp base64_tests.cpp \ + bignum_tests.cpp bloom_tests.cpp canonical_tests.cpp checkblock_tests.cpp \ + Checkpoints_tests.cpp compress_tests.cpp DoS_tests.cpp getarg_tests.cpp \ + key_tests.cpp miner_tests.cpp mruset_tests.cpp multisig_tests.cpp \ + netbase_tests.cpp pmt_tests.cpp rpc_tests.cpp script_P2SH_tests.cpp \ + script_tests.cpp serialize_tests.cpp sigopcount_tests.cpp test_bitcoin.cpp \ + transaction_tests.cpp uint160_tests.cpp uint256_tests.cpp util_tests.cpp \ + wallet_tests.cpp $(TEST_DATA_FILES) + +CLEANFILES = *.gcda *.gcno diff --git a/src/util.h b/src/util.h index f246412de..62eb7fad9 100644 --- a/src/util.h +++ b/src/util.h @@ -91,7 +91,6 @@ T* alignup(T* p) } #ifdef WIN32 -#define MSG_NOSIGNAL 0 #define MSG_DONTWAIT 0 #ifndef S_IRUSR @@ -111,11 +110,13 @@ inline void MilliSleep(int64 n) // Boost's sleep_for was uninterruptable when backed by nanosleep from 1.50 // until fixed in 1.52. Use the deprecated sleep method for the broken case. // See: https://svn.boost.org/trac/boost/ticket/7238 - -#if BOOST_VERSION >= 105000 && (!defined(BOOST_HAS_NANOSLEEP) || BOOST_VERSION >= 105200) +#if defined(HAVE_WORKING_BOOST_SLEEP_FOR) boost::this_thread::sleep_for(boost::chrono::milliseconds(n)); -#else +#elif defined(HAVE_WORKING_BOOST_SLEEP) boost::this_thread::sleep(boost::posix_time::milliseconds(n)); +#else + //should never get here +#error missing boost sleep implementation #endif }