Three-micron spectra of AGB stars and supergiants in nearby galaxies