build: Auto-detect whether -DBOOST_TEST_DYN_LINK is needed

Use AC_LINK_IFELSE to auto-detect whether boost test is linked
dynamically, instead of assuming based on target.
build: Allow providing extra libs for Boost Chrono

Pass BOOST_CHRONO_EXTRALIBS to give extra dependency
libraries for Boost Chrono which are not auto-detected.
build: Pass BOOST_CPPFLAGS to sleep implementation test

Makes sure that `-pthread` and other flags required for boost
compilation are passed.
gitian: Reduce build time for boost windows dependency

Build only the mt-s (multithreaded, static runtime link)
variant of the library.

This cuts the build time in half.

Also prevent unpacked boost from ending up in output directory,
checking and hashing all the source files as output files this
takes a lot of time and is pointless.
gitian: Build boost dependency for linux

Instead of using the boost provided by Ubuntu 12.04, build our own
dependency like we do for Windows.

This allows using a much newer version (1.55 versus 1.46) as well as
building with `-fPIC` so that `-pie` can be used in the x86-64 build.
gitian: Add openssl to linux deps

Build OpenSSL instead of using distribution-provided
library.
gitian: add optimization to win32 protobuf

When overriding CXXFLAGS, also provide optimization flags, otherwise
we're building without optimization.
Squashed 'src/leveldb/' changes from e991315..9094c7f

9094c7f Temporarily revert to writing .sst files instead of .ldb

git-subtree-dir: src/leveldb
git-subtree-split: 9094c7ffe45e0bedd84ea414828f768fd49bcdf7
Merge src/leveldb changes: temporarily revert to writing .sst files.
Merge pull request #3555

060fdb4 Squashed 'src/leveldb/' changes from e991315..9094c7f (Pieter Wuille)
Merge pull request #3554

77f1b4a gitian: add optimization to win32 protobuf (Wladimir J. van der Laan)
Merge pull request #3545

1cbbeb6 gitian: Add openssl to linux deps (Wladimir J. van der Laan)
64be7f7 gitian: Build boost dependency for linux (Wladimir J. van der Laan)
7eb99a8 gitian: Reduce build time for boost windows dependency (Wladimir J. van der Laan)
714cdec build: Pass BOOST_CPPFLAGS to sleep implementation test (Wladimir J. van der Laan)
0d40f5a build: Allow providing extra libs for Boost Chrono (Wladimir J. van der Laan)
e4b991e build: Auto-detect whether -DBOOST_TEST_DYN_LINK is needed (Wladimir J. van der Laan)