Support for Mac OS X, some muted warnings

These are my changes for the Darwin platform. I have only been able to test it on two machines, which unfortunately have the same architecture and OS version.

Further detailed comments are available in each commit.