Initialize database before checking changed txindex

In case no database exists yet, and -txindex(=1) is passed, we currently first
check whether fTxIndex differs from -txindex (and ask the user to reindex in
that case), and only afterwards initialize the database. By swapping these
around (the initialization is a no-op in case the database already exists),
we allow it to be born in txindex mode, without warning.

That also means we don't need to check -reindex anymore, as the wiping/reinit
of the databases happens before checking.
Add ExtractAffectedKeys to script

This function finds all keys affected by a particular output script,
supporting everything ExtractDestinations supports (pay-to-pubkey,
pay-to-pubkeyhash, multisig) and recurses into subscripts (P2SH).
Add GetKeyBirthTimes to wallet

Compute safe lower bounds on the birth times of all wallet keys. For
pool keys or keys with metadata, the actually stored birth time is
used. For all others, the birth times are inferred from the wallet
transactions.
Add dumpwallet and importwallet RPCs

dumpwallet: produce a dump of all keys in a wallet, in a format
compatible with Bitcoin Wallet for Android and Multibit.

importwallet: import such a dump
init.cpp: fix chainparams.h double include.

Noticed by Diapolo.
Merge pull request #2786 from jgarzik/double-inc

init.cpp: fix chainparams.h double include.
fix makefiles and init.cpp after chainparams merge

- add missing chainparams.o to some makefiles
- remove a double-include of chainparams.h in init.cpp
Merge pull request #2787 from Diapolo/makefiles

fix makefiles and init.cpp after chainparams merge
Merge pull request #2592 from sipa/dumpwallet

Add dumpwallet and importwallet RPC commands
Merge pull request #2783 from sipa/newtxindex

Initialize database before checking changed txindex