configure.ac cleanup and refactoring