Share more code between configure.ac and distrib/configure.ac.in