Dependency management

A bunch of foundation work to handle dependencies a little more cleanly now that Travis is a big deal.

Also added some code to `$DIR` detection to work around an issue if `CDPATH` is set on the host system.