build: quit abusing LIBS for Windows builds.

Similar to the INCLUDES changes in 6b099402b40, split out LIBS into individual
entries for more fine-grained control.

Also add MINIUPNPC_LIBS which was missing before, and hook it up to
executables.
build: fix libtool's refusal to link static libs into a dll
rpc: Fix leveldb iterator leak, and flush before `gettxoutsetinfo`

This fixes an iterator leak resulting in

    bitcoind: db/version_set.cc:789: leveldb::VersionSet::~VersionSet(): Assertion `dummy_versions_.next_ == &dummy_versions_' failed."

exception on shutdown.

Also make sure to flush pcoinsTip before calling GetStats() to make
sure we apply them to the current height.
boost: split stream classes out of serialize.h

serialization now has no dependencies.
Update license in pull-tester and rpc-tests

Add missing copyright/license header where necessary
Make CBlockIndex* returned by GetDepthInMainChain const.

Make the CBlockIndex* (optionally) returned by GetDepthInMainChain
const.  This prevents accidental modification.  The result is for
reading its properties rather than modifying it.
getblockhash: throw JSONRPCError (not runtime_error)
Start with tidier cache directories

Remove more files from the cached, 200-block-chain data directories.
Merge pull request #5134

6261e6e getblockhash: throw JSONRPCError (not runtime_error) (dexX7)
Merge pull request #5115

33dfbf5 rpc: Fix leveldb iterator leak, and flush before `gettxoutsetinfo` (Wladimir J. van der Laan)
Merge pull request #5119

fa73619 boost: split stream classes out of serialize.h (Cory Fields)
Merge pull request #5086

1723862 build: fix libtool's refusal to link static libs into a dll (Cory Fields)
28d412f build: quit abusing LIBS for Windows builds. (Cory Fields)
Build util and common before building server
Merge pull request #5112

071473c Build util and common before building server (jtimon)
Merge pull request #5121

214091d Update license in pull-tester and rpc-tests (Michael Ford)
Merge pull request #5139

9f87325 Start with tidier cache directories (Gavin Andresen)

Signed-off-by: Gavin Andresen <gavinandresen@gmail.com>
Merge pull request #5135

a31e8ba Make CBlockIndex* returned by GetDepthInMainChain const. (Daniel Kraft)

Signed-off-by: Gavin Andresen <gavinandresen@gmail.com>