rework autoconf macros - borrow some bits from powerdns