Phase transitions in alkaline earth metals under pressure