Fix OS X detection.

Switch to checking for the __APPLE__ and __MACH__ macros.