Infrared observations of the Magellanic Clouds. I - The Small Magellanic Cloud