Thermodynamic stability of perovskites and related compounds in some alkaline earth-transition metal-oxygen systems