added os detection into build

Recent merge into master does not build. Know your going to change the build but here is a fix in the meantime.