Magnesium- and calcium-doping behavior in molecular-beam epitaxial III-V compounds