autotools: FreeBSD support

This patch adds FreeBSD and pkg-config support to configure.ac. The pkg-config support is somewhat dependent on https://github.com/strophe/libstrophe/pull/37, but degrades nicely to the original behavior.

Some of the code was re-used from https://github.com/strophe/libstrophe/pull/22.
`-lresolv` is provided by libstrophe.pc if required. This block should be moved under PKG_CHECK_MODULES like other dependencies.