We derive and test a generalization of the steady-state ab initio laser theory (SALT) to treat complex gain media. The generalized theory (C-SALT) is able to treat atomic and molecular gain media with diffusion and multiple lasing transitions, and semiconductor gain media in the free carrier approximation including fully the effect of Pauli blocking. The key assumption of the theory is stationarity of the level populations, which leads to coupled self-consistent equations for the populations and the lasing modes that fully include the effects of openness and non-linear spatial hole-burning. These equations can be solved efficiently for the steady-state lasing properties by a similar iteration procedure as in SALT, where a static gain medium with a single transition is assumed. The theory is tested by comparison to much less efficient finite difference time domain (FDTD) methods and excellent agreement is found. Using C-SALT to analyze the effects of varying gain diffusion constant we demonstrate a cross-over between the regime of strong spatial hole burning with multimode lasing to a regime of negligible spatial hole burning, leading to gain-clamping, and single mode lasing. The effect of spatially inhomogeneous pumping combined with diffusion is also studied and a relevant length scale for spatial inhomogeneity to persist under these conditions is determined. For the semiconductor gain model, we demonstrate the frequency shift due to Pauli blocking as the pumping strength changes.