Manually integrated some FreeBSD changes from @lye #132 pull request.
Merge branch 'master' of github.com:bkaradzic/bgfx