Add compatibility shims and basic Mac OS X build fixes.
Initial adoption of OS X compatibility shims.