Added use of preprocessor to drop in os-dependent code.
Merge branch 'master' into osx-compat
Merge branch 'osx-compat'