diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c
index e39b116ff14e132de6de31960137c786b98180fd..004293206f0a96fde71316784d928cd9306dc3d6 100644
--- a/src/sdl/mixer_sound.c
+++ b/src/sdl/mixer_sound.c
@@ -633,7 +633,11 @@ boolean I_LoadSong(char *data, size_t len)
 	const size_t key3len = strlen(key3);
 	char *p = data;
 
-	if (music || gme)
+	if (music
+#ifdef HAVE_LIBGME
+		|| gme
+#endif
+	)
 		I_UnloadSong();
 
 #ifdef HAVE_LIBGME