imake: Refactor and fix get_sun_compiler_versions()