More configury / build system updates

A series of patches that continue to improve the configure/build system.

Each one is a small enough patch that should be easily understandable by itself.