Adjustments to make configure.ac less messy. Flags are now handled
systematically and deduplicated.