Ab initio multimode linewidth theory for arbitrary inhomogeneous laser cavities