improve autoconf-like logic