Make some dependancies conditional on BUILD_* macros so the code can be built without them