Make configure script a bit smarter