merge platform_helper into configure script

With this code all in one place, it's easier to spot unused code and
simplification opportunities.