diff --git a/src/xpdev/Common.gmake b/src/xpdev/Common.gmake
index f7e9b825e0eb03e363fb21652579bb9ef3e80558..1bf8c62a71b3968bfb4c61cb2536feb8bcbac526 100644
--- a/src/xpdev/Common.gmake
+++ b/src/xpdev/Common.gmake
@@ -214,9 +214,11 @@ ifndef WITHOUT_PORTAUDIO
   endif
  endif
 endif
-ifeq ($(shell if [ -f /usr/include/alsa/asoundlib.h ] ; then echo YES ; fi),YES)
- XPDEV-MT_LIBS += -ldl
- XPDEV_LIBS += -ldl
+ifndef WITHOUT_ALSA_SOUND
+	ifeq ($(shell if [ -f /usr/include/alsa/asoundlib.h ] ; then echo YES ; fi),YES)
+		XPDEV-MT_CFLAGS	+= -DUSE_ALSA_SOUND
+		XPDEV-MT_LIBS += -ldl
+	endif
 endif
 
 ifndef NO_PULSEAUDIO
diff --git a/src/xpdev/GNUmakefile b/src/xpdev/GNUmakefile
index 16d7a036a007a375481ebf7093eb300a9daa5e24..4d9b9e3a5149271d18d9d339fbe30cac97b9edf3 100644
--- a/src/xpdev/GNUmakefile
+++ b/src/xpdev/GNUmakefile
@@ -9,11 +9,6 @@ ifndef win
 endif
 
 CFLAGS +=  -I. $(XPDEV_CFLAGS)
-ifndef WITHOUT_ALSA_SOUND
-	ifeq ($(shell if [ -f /usr/include/alsa/asoundlib.h ] ; then echo YES ; fi),YES)
-		CFLAGS	+=	-DUSE_ALSA_SOUND
-	endif
-endif
 MT_CFLAGS	+=	$(XPDEV-MT_CFLAGS)
 
 ifdef WITH_SDL_AUDIO