Integral theory for turbulent base flows at subsonic and supersonic speeds