Fix build on OSX 10.8.2 (Mountain Lion).

Verified to build on CentOS 5.5/6.3, Ubuntu 12.10, Bitrig 0.1 and
OpenBSD 5.3