Allow building on Mac OS X

Tested on:

  * Mac OS X 10.6.8
  * Ubuntu 12.10