Support FreeBSD

This pull request adds support for FreeBSD 10.

It contains one commit from #9, which should be merged first.