Add workaround for CI builds

CI builds (Travis) always run under a ‘build’ directory. An environment
variable can be consulted to determine when to allow this:
http://docs.travis-ci.com/user/ci-environment/#Environment-variables