General Approach to the Line-Shape Problem in Nuclear-Magnetic-Resonance Spectra