build: improve autoconf macros