Fix compiler autodetection errors caused by wrong compiler flag ordering.