Tweak build on FreeBSD

* add configuration for bsd (FreeBSD)
* libdl is not required on FreeBSD
* it's better to detect lua with pkgconfig (probably also true for linux)
* linking with threads is correctly done with -pthread
Merge pull request #105 from AMDmi3/freebsd-build

Tweak build on FreeBSD