On particle acceleration around shocks. IV. Particle spectrum as a function of the equation of state of the shocked plasma