Changes to support compiling on OSX