Support building on OSX.

I am upstreaming some folly changes that were required to build hiphop on OSX.

Some changes are similar to PR #27, however these commits apply to HEAD and should be less intrusive.

Let me know if I need to make any changes.