CMessageHeader sanity changes

- Remove spurious `pchCommand[1] = 1` in CMessageHeader()
- Make sure that pchCommand is zero-padded if length is shorter than
  COMMAND_SIZE
- Use strnlen to determine length of pcmCommand in GetCommand
Do merkle root and txid duplicates check simultaneously

Move the txid duplicates check into BuildMerkleTree, where it can be done
much more efficiently (without needing to build a full txid set to detect
duplicates).

The previous version (using the std::set<uint256> to detect duplicates) was
also slightly too weak. A block mined with actual duplicate transactions
(which is invalid, due to the inputs of the duplicated transactions being
seen as double spends) would trigger the duplicates logic, resulting in the
block not being stored on disk, and rerequested. This change fixes that by
only triggering in the case of duplicated transactions that can actually
result in an identical merkle root.
minor variable init changes in init.cpp

- explicit init of pcoinsdbview and pwalletMain (even if not needed, as
  globals are init to NULL, it seems cleaner)
- remove check if (pwalletMain) in Shutdown() as delete is valid even if
  pwalletMain is NULL
Use a typedef for monetary values
doc: Add instructions for consistent Mac OS X build names
update license of compat and crypto

- change license to be just MIT for all files in compat and crypto
- also add missing header end comments
- ensure default header include style
cleanup license and header end comment in chain.cpp/.h
Switch testing framework from MAIN to new UNITTEST network

UNITTEST inherites from MAIN but allows synamically changing its parameters using the ModifiableParams() interface
Suggested corrections on comments, variable names.
Also new test case testing the PoW skip in UNITTEST.
Avoid introducing a virtual into CChainParams

Treat fSkipProofOfWorkCheck the same as other parameters.
Merge pull request #4990

7bec6dd cleanup license and header end comment in chain.cpp/.h (Philip Kaufmann)
0db65d8 update license of compat and crypto (Philip Kaufmann)
osx: fix signing to make Gatekeeper happy (again)

The approach from 65f3fa8d1 worked for signing on 10.9.4, but not newer
versions. 10.9.5 (and up) want each framework to stand alone.

Now in addition to copying the plist's from Qt for each framework, we put them
in per-version dirs and only symlink to the latest, rather than using symlinks
for any contents.
Fix formatting in  init.md
depends: update the comparison tool to a more recent version
Revert "travis: retry tests before giving up"

This reverts commit 7e3821c097c05a4790abac53ddd26ef28cb7cf4d.
tests: fix python test-runner for windows

Windows needed a few fixups to get the tests running:
1. bitcoin-tx needs a file extension in Windows. Take this opportunity to
   add an env file, which pulls variables out of our build config. This can
   be extended as needed, for now it's very simple.
2. After #1, split the args out of the exec key in the test data.
3. Correct the line-endings from windows stdout
tests: fix false-positive under win64

BN_ULONG isn't necessarily an unsigned long, as is the case on win64.
Merge pull request #5006 from TheBlueMatt/travis-new-comparisontool

depends: update the comparison tool to a more recent version
Update build-unix.md

Debian also need libboost-all-dev installed.
Merge pull request #5015 from theuni/win64test

tests: fix false-positive under win64