Infrared spectroscopy of starburst and Seyfert galaxies