Various tweaks to get the build working once again with ghc-7.4.x

Conditional dependencies (re)introduced, plus some conditional imports
and relaxing one of our test timeouts, since it seems to regularly
fail on CI.