support NetBSD
Merge pull request #1165 from fisted/fix_netbsd

support NetBSD