Add some nominal compile-time support for OSX.

Previously this wouldn't compile on OSX (10.8). This change
adds some clang flags and some osx ifdefs such that the code
compiles. However it will still segfault if run on osx :)

But wanted to save these bits away in case I try to make it
work on osx at a later date.