Fix building for freebsd in 64 bit mode
Fix building threading for freebsd

FreeBSD (and at least NetBSD as well) still use hw.ncpu without
deprecating it, contrary to apple.
Merge pull request #221 from mstorsjo/freebsd

Update building on FreeBSD