Conditionally enable MySQL and PostgresSQL, add support for FreeBSD and DragonFlyBSD

Upstream FreeBSD's Icinga 2 port patches.