A spin glass-like transition was studied with the use of optical spectroscopy in Cd1-xMnxTe epilayers and bulk samples with 0.24 less than or equal to x less than or equal to 0.41 and in Cd1-xMnxTe-based quantum well structures. Transition temperatures deduced from the temperature dependence of magnetic field-induced polarization of excitonic luminescence are in good agreement with the spin-glass transition temperatures obtained previously by direct measurements of the magnetization. The transition temperatures were found to be insensitive to the method of crystal growth by which the samples had been obtained, although, in principle, conditions for clustering of Mn ions may be different in Bridgman- and MBE-grown samples. Reduction of the dimensionality realized in Cd1-xMnxTe/Cd1-yMgyTe heterostructures hinders the spin-glass formation, in agreement with theoretical predictions. The transition is also modified in the vicinity of interfaces between diluted magnetic (semimagnetic) and nonmagnetic layers in CdTe/Cd1-xMnxTe quantum wells. (C) 1999 Elsevier Science B.V. All rights reserved.