Autodetect libsodium constants with library-provided functions

libsodium now provides functions to access the value of most constants
that we previously needed to hardcode. They are now determined at
runtime.

This also improves the build system such that it can test against git
master or against versioned and checksummed mirrors. It also ensures
that local tests are run against a fresh copy of the upstream source
rather than a local version of the library.