TS-1864 Rearrange some of the autoconf code, order matters