diff --git a/src/conio/Common.gmake b/src/conio/Common.gmake
index 0d3badf391042f41562ba49790ff573afcd79ac8..c3d4d025c3e79f5c52fc73a244c487ea684e7d03 100644
--- a/src/conio/Common.gmake
+++ b/src/conio/Common.gmake
@@ -63,7 +63,7 @@ endif
 ifdef USE_SDL
  ifndef WITH_SDL_AUDIO
   ifdef SDL_CONFIG
-   ifeq ($(shell command -v ${SDL_CONFIG} && if [ `${SDL_CONFIG} --version | sed -E 's/\..*$$//'` -ge 2 ] ; then echo 'YES' ; fi),YES)
+   ifeq ($(shell command -v ${SDL_CONFIG} > /dev/null && if [ `${SDL_CONFIG} --version | sed -E 's/\..*$$//'` -ge 2 ] ; then echo 'YES' ; fi),YES)
     WITH_SDL	:=	1
    endif
   else
@@ -76,11 +76,11 @@ ifdef USE_SDL
      CIOLIB-MT_LDFLAGS += -Wl,-rpath,@executable_path/../Frameworks
     endif
    else
-    ifeq ($(shell command -v sdl2-config && sdl2-config --cflags > /dev/null 2>&1 && echo YES),YES)
+    ifeq ($(shell command -v sdl2-config > /dev/null && sdl2-config --cflags > /dev/null 2>&1 && echo YES),YES)
      SDL_CONFIG := sdl2-config
      WITH_SDL	:=	1
     else
-     ifeq ($(shell command -v sdl-config && if [ `sdl-config --version | sed -E 's/\..*$$//'` -ge 2 ] ; then echo 'YES' ; fi),YES)
+     ifeq ($(shell command -v sdl-config > /dev/null && if [ `sdl-config --version | sed -E 's/\..*$$//'` -ge 2 ] ; then echo 'YES' ; fi),YES)
       SDL_CONFIG := sdl-config
       WITH_SDL	:=	1
      endif
diff --git a/src/xpdev/Common.gmake b/src/xpdev/Common.gmake
index 8c0667a4f6163582891a98f85ea807b417047846..d6e13f0e00cd78ba2b6daf65c0f2e65a98357fd4 100644
--- a/src/xpdev/Common.gmake
+++ b/src/xpdev/Common.gmake
@@ -98,7 +98,7 @@ endif
 # Find SDL headers!
 ifdef USE_SDL_AUDIO
  ifdef SDL_CONFIG
-  ifeq ($(shell if [ `${SDL_CONFIG} --version | sed -E 's/\..*$$//'` -ge 2 ] ; then echo 'YES' ; fi),YES)
+  ifeq ($(shell command -v ${SDL_CONFIG} > /dev/null && if [ `${SDL_CONFIG} --version | sed -E 's/\..*$$//'` -ge 2 ] ; then echo 'YES' ; fi),YES)
    WITH_SDL_AUDIO	:=	1
   endif
  else
@@ -111,11 +111,11 @@ ifdef USE_SDL_AUDIO
     CIOLIB-MT_LDFLAGS += -Wl,-rpath,@executable_path/../Frameworks
    endif
   else
-   ifeq ($(shell sdl2-config --cflags > /dev/null 2>&1 && echo YES),YES)
+   ifeq ($(shell command -v sdl2-config > /dev/null && sdl2-config --cflags > /dev/null 2>&1 && echo YES),YES)
     SDL_CONFIG := sdl2-config
     WITH_SDL_AUDIO	:=	1
    else
-    ifeq ($(shell if [ `sdl-config --version | sed -E 's/\..*$$//'` -ge 2 ] ; then echo 'YES' ; fi),YES)
+    ifeq ($(shell command -v sdl-config > /dev/null && if [ `sdl-config --version | sed -E 's/\..*$$//'` -ge 2 ] ; then echo 'YES' ; fi),YES)
      SDL_CONFIG := sdl-config
      WITH_SDL_AUDIO	:=	1
     endif