From c30d28887af880b31a87661f19205451682768cb Mon Sep 17 00:00:00 2001
From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Date: Thu, 13 Mar 2008 14:26:56 -0400
Subject: [PATCH] configure --without-gsm done

If you disable gsm support, you dont need libgsm1-dev anymore
---
 configure.ac                  |  2 +-
 src/audio/Makefile.am         |  8 +++++++-
 src/audio/codecDescriptor.cpp | 10 ++++++++--
 src/global.h                  |  3 +++
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index a1d9a7b869..59bfb6308b 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 ffb3c4c859..8006b8d2bf 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 8fd7695b1f..820c47669e 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 b5e130dd1e..de9c78b195 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__
-- 
GitLab