Improve feature detection in configure.