fix bsd: probe for bsd via gcc -v, and omit -ldl there

make works now asis on bsd (tested on openbsd)
Merge remote-tracking branch 'origin/master' into p2