Structural and optical characterization of Mg-doped GaAs nanowires grown on GaAs and Si substrates