Add option to link Boost dynamically (#1025)

Distributions can guarantee the existence of a specific version of
the Boost libraries, so it makes less sense to link them statically.