Add NetBSD support.
It works fine under NetBSD/amd64 6.99.47.
Merge pull request #799 from ryo-on/netbsd-support

Add NetBSD support.