Fix OS X detection.

Switch to checking for the __APPLE__ and __MACH__ macros.
Merge pull request #354 from xbe/osx-fix

Fix OS X detection.