We consider the interplay between superconducting (SC) and commensurate spin-density-wave (SDW) orders in iron pnictides by analyzing a multiple-order Ginzburg-Landau free energy. We are particularly interested in whether the doping-induced transition between the two states is first order or whether the two pure phases are separated by an intermediate phase with coexisting SC and SDW orders. For perfect nesting, the two orders do not coexist, because SDW order, which comes first, gaps the full Fermi surface leaving no space for SC to develop. When nesting is not perfect due to either ellipticity of electron bands or doping-induced difference in chemical potentials for holes and electrons, SDW order still leaves modified Fermi surfaces for not too strong SDW magnetism and the SC order may develop. We show that the two orders coexist only when certain relations between ellipticity and doping are met. In particular, in a compensated metal, ellipticity alone is not sufficient for coexistence of the two orders.