use properly autotools to append library flags. It fixes build on
FreeBSD (fixes #5)
use getprogname(3) instead of relying on cmdline procfs
adjust shebang to be #!/bin/sh and remove bash-isms
Merge pull request #6 from sbz/freebsd-build

FreeBSD platform support (build and runtime)