diff --git a/configure.ac b/configure.ac
index a1d9a7b8694ec05385f4d0d10f2d70ea4c91f27d..59bfb6308ba1ba2572c865c31033e5725fabbc9b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -192,7 +192,7 @@ SFLPHONE_LIBS="$SFLPHONE_LIBS $libdbuscpp_LIBS"
 AC_CHECK_HEADER(boost/tokenizer.hpp, , AC_MSG_ERROR("Unable to find the libboost tokenizer headers; you may need to install the libboost-dev package" ) )
 
 # check for libgsm1 (doesn't use pkg-config)
-dnl Check for libspeex
+dnl Check for libgsm
 AC_ARG_WITH([gsm],
   [AS_HELP_STRING([--without-gsm],
     [disable support for gsm codec])],
diff --git a/src/audio/Makefile.am b/src/audio/Makefile.am
index ffb3c4c859170787e900c24546db1974fc91883d..8006b8d2bf8438655248ba2aa85e2f9e31c1f730 100644
--- a/src/audio/Makefile.am
+++ b/src/audio/Makefile.am
@@ -8,6 +8,12 @@ else
 SPEEX_FLAG = 
 endif
 
+if BUILD_GSM
+GSM_FLAG = -DBUILD_GSM
+else
+GSM_FLAG = 
+endif
+
 SUBDIRS = codecs
 
 libaudio_la_SOURCES =    audiofile.cpp	 tonelist.cpp    \
@@ -16,7 +22,7 @@ tonegenerator.cpp   codecDescriptor.cpp \
 audioloop.cpp ringbuffer.cpp $(SPEEX_SOURCES_CPP)
 
 AM_CXXFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libdbuscpp_CFLAGS) $(libccrtp1_CFLAGS) $(USER_INCLUDES) \
- 	      -DCODECS_DIR=\""$(sflcodecdir)"\" $(SPEEX_FLAG)	
+ 	      -DCODECS_DIR=\""$(sflcodecdir)"\" $(SPEEX_FLAG) $(GSM_FLAG)	
 
 noinst_HEADERS = audioloop.h    common.h ringbuffer.h    audiofile.h  \
  tonelist.h         audiortp.h   audiolayer.h audiodevice.h \
diff --git a/src/audio/codecDescriptor.cpp b/src/audio/codecDescriptor.cpp
index 8fd7695b1fd2a7e1996a1abdfefa52051e26c209..820c47669eb9c599dca47ce581119b071a596e8d 100644
--- a/src/audio/codecDescriptor.cpp
+++ b/src/audio/codecDescriptor.cpp
@@ -286,8 +286,14 @@ CodecDescriptor::seemsValid( std::string lib)
 #ifdef BUILD_SPEEX
   // Nothing special
 #else
-  std::string speex = "speex";
-    if( lib.substr(begin.length() , lib.length() - begin.length() - end.length()) == speex)
+    if( lib.substr(begin.length() , lib.length() - begin.length() - end.length()) == SPEEX_STRING_DESCRIPTION)
+      return false;
+#endif
+
+#ifdef BUILD_GSM
+  // Nothing special
+#else
+    if( lib.substr(begin.length() , lib.length() - begin.length() - end.length()) == GSM_STRING_DESCRIPTION )  
       return false;
 #endif
 
diff --git a/src/global.h b/src/global.h
index b5e130dd1e99006930c6ad64f9ead98bee4faa61..de9c78b195abfd3d33411e239db7cc6cc6cba679 100644
--- a/src/global.h
+++ b/src/global.h
@@ -100,4 +100,7 @@ typedef short int16;
 #define	IAX2_ENABLED  false
 #endif
 
+#define GSM_STRING_DESCRIPTION	  "gsm"
+#define SPEEX_STRING_DESCRIPTION  "speex"
+
 #endif	// __GLOBAL_H__