Porting to FreeBSD

Cleaned up configure.ac to rely on pkg-config more heavily and less on hard-coded library paths. Also removed libresolv check for freebsd.

tested on FreeBSD 8.4 and debian wheezy.
Please, move PKG_PROG_PKG_CONFIG after AM_PROG_CC_C_0. Just to make this script more readable.