Add FreeBSD support

This pull request adds basic FreeBSD support.