Make library set system dependent

For instance, FreeBSD doesn't need -lresolv, -ldl
Merge pull request #295 from AMDmi3/system-dependent-libs

Make library set system dependent