[WIP] Remove a ton of duplicate and obsolete code from configure.