Fixed making leveldb with custom CFLAGS/CXXFLAGS in the same way as makefile.unix
remove printf redefinition from bitcoinrpc.cpp

- as the redefiniton of printf happens in util.h, which is included in
  bitcoinrpc.cpp, we don't need another redefinition
Remove -detachdb and stop's detach argument.

As the only BDB database left is the wallet, and it is always
detached.

Also remove IsChainFile() predicate and related chainfile-specific
logic.
Cache size optimizations
RPC, cosmetic: push down ReadHTTPStatus() calls into ReadHTTP() callers

ReadHTTPStatus() is currently overloaded:  In client mode, it properly parses
and receives an HTTP status line.  In server mode, it incorrectly parses the
HTTP request line as an HTTP status line.

This server mode bug has never mattered, because the RPC server never
cared about the URI (path) provided in the HTTP request.  That will change in
the future, so go ahead and begin fixing the problem.

This patch is cosmetic, and should result in NO behavior changes.

Further renames:
ReadHTTPHeader -> ReadHTTPHeaders
ReadHTTP -> ReadHTTPMessage
RPC: HTTP server uses its own ReadHTTPRequestLine()
rather than reusing ReadHTTPStatus() from the client mode.

The following additional HTTP request validations are added, both in line with
existing HTTP client practice:

1) HTTP method must be GET or POST.  Most clients use POST, some
   use GET.  Either way, this continues to work.
2) HTTP URI must start with "/" character.
   Normal URI is "/" (a 1-char string), so this is fine.
Qt: small header changes / fixes

- ensure header inclusion guard is named after the header file
- add missing comments at the end of some inclusion guards
- add a small Qt5 compatibility fix in macdockiconhandler.h
Merge pull request #1981 from sipa/caches

Cache size optimizations
Add CBufferedFile
LoadExternalBlockFile switched to CBufferedFile
Move ThreadImport to init.cpp
Add -reindex, to perform in-place reindexing of block chain files

Flushes the blktree/ and coins/ databases, and reindexes the
block chain files, as if their contents was loaded via -loadblock.

Based on earlier work by Jeff Garzik.
don't use memset() in privacy/security relevant code parts

As memset() can be optimized out by a compiler it should not be used in
privacy/security relevant code parts. OpenSSL provides the safe
OPENSSL_cleanse() function in crypto.h, which perfectly does the job of
clean and overwrite data.

For details see: http://www.viva64.com/en/b/0178/

- change memset() to OPENSSL_cleanse() where appropriate
- change a hard-coded number from netbase.cpp into a sizeof()
make CBase58Data class use zero_after_free_allocator

- this way there is no need for an explicit destructor, who does the same
  thing anyway
Merge pull request #1978 from sipa/nodetach

Remove -detachdb and stop's detach argument.
Merge branch 'http-improvements'

The base bits of pull req #1982.
Merge pull request #1943 from sipa/reindex2

Add -reindex, to perform in-place reindexing of block chain files
Fix tests after cache tweaks
allow listening on -bind=address for blocked networks

- this allows the client to listen on via -bind specified addresses
  (e.g. 127.0.0.1), even when a network (IPv4 in that case) was blocked
  via e.g -onlynet="Tor"
- introduce enum BindFlags to avoid passing multiple bools to Bind()
- make -bind help text clear we ALWAYS listen on the specified address
- remove an unused variable
- remove 2 unneeded IsLimited() checks before calling Bind(), which does
  these checks anyway

- usage case: specify -bind=127.0.0.1 -onlynet="Tor" to allow incoming
  connections to a Tor hidden service, but still don't allow other IPv4
  nodes to connect / get connected
Merge pull request #1778 from Diapolo/allow_explicit_bind

allow listening on -bind=address for blocked networks