README.Snd has a list of the packages you need when you use the --with-motif switch. I haven't checked it since about version 22.04 of Ubuntu. You'll need xpm and maybe xt, and probably one header file, shape.h from libext. Also the x11-fonts-misc package.