A distribution framework for the generalized Fourier transform associated with a Sturm--Liouville operator