diff --git a/sflphone-common/configure.ac b/sflphone-common/configure.ac
index aa9b8fdea1970a007bbeb18ba20a1ea909165813..2a0663abfeb3d225e1105e03df28004359297fb6 100644
--- a/sflphone-common/configure.ac
+++ b/sflphone-common/configure.ac
@@ -389,16 +389,17 @@ AC_ARG_WITH([celt],
 AS_IF([test "x$with_celt" != xno],
 	PKG_CHECK_MODULES(CELT, celt >= 0.9.1, 
 		[
-			BUILD_CELT=91 ; with_celt=yes
+			with_celt_91=yes; AC_MSG_NOTICE([Using celt 0.9.1]); AC_SUBST(BUILD_CELT_91)
     	], 
     	[
-			PKG_CHECK_MODULES(CELT, celt >= 0.7.1,,AC_MSG_FAILURE([libcelt link test failed.   You may use --without-celt to compile without celt codec support.])) 
-        	BUILD_CELT=71; with_celt=yes;
+			PKG_CHECK_MODULES(CELT, celt >= 0.7.1, [with_celt_71=yes; AC_MSG_NOTICE([Using celt 0.7.1]); AC_SUBST(BUILD_CELT_71)], AC_MSG_FAILURE([libcelt link test failed.   You may use --without-celt to compile without celt codec support.])) 
     	])
 )
 
-AC_SUBST(BUILD_CELT)
-AM_CONDITIONAL(BUILD_CELT, test "x$with_celt" = "xyes" )
+# AC_SUBST(BUILD_CELT)
+# AM_CONDITIONAL(BUILD_CELT, test "x$with_celt" = "xyes" )
+AM_CONDITIONAL(BUILD_CELT_91, test "x$with_celt_91" = "xyes" )
+AM_CONDITIONAL(BUILD_CELT_71, test "x$with_celt_71" = "xyes" )
 
 
 dnl Check for IAX
diff --git a/sflphone-common/src/audio/codecs/Makefile.am b/sflphone-common/src/audio/codecs/Makefile.am
index 4b712fc46013036b6e2228ed0b194fd293710b9e..37df13bcabb39c29d72c9aadeb1b2f3650d39d30 100644
--- a/sflphone-common/src/audio/codecs/Makefile.am
+++ b/sflphone-common/src/audio/codecs/Makefile.am
@@ -40,15 +40,23 @@ libcodec_speex_ub_so_LDFLAGS = --shared -lc -lspeex $(SPEEX_NIMP)
 INSTALL_SPEEX_UB_RULE = install-libcodec_speex_ub_so
 endif
 
-if BUILD_CELT
+if BUILD_CELT_91
 CELT_LIB = libcodec_celt.so
 libcodec_celt_so_SOURCES = celtcodec.cpp
-libcodec_celt_so_CFLAGS = -fPIC -g -Wall -D$(BUILD_CELT)
-libcodec_celt_so_CXXFLAGS = -fPIC -g -Wall
+libcodec_celt_so_CFLAGS = -fPIC -g -Wall -DBUILD_CELT_91
+libcodec_celt_so_CXXFLAGS = -fPIC -g -Wall -DBUILD_CELT_91
 libcodec_celt_so_LDFLAGS = --shared -lc -lcelt0 $(CELT_NIMP)
 INSTALL_CELT_RULE = install-libcodec_celt_so
 endif
 
+if BUILD_CELT_71
+CELT_LIB = libcodec_celt.so
+libcodec_celt_so_SOURCES = celtcodec.cpp
+libcodec_celt_so_CFLAGS = -fPIC -g -Wall -DBUILD_CELT_71
+libcodec_celt_so_CXXFLAGS = -fPIC -g -Wall -DBUILD_CELT_71
+libcodec_celt_so_LDFLAGS = --shared -lc -lcelt0 $(CELT_NIMP)
+INSTALL_CELT_RULE = install-libcodec_celt_so
+endif
 
 noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so libcodec_g722.so $(GSM_LIB) $(SPEEX_NB_LIB) $(SPEEX_WB_LIB) $(SPEEX_UB_LIB) $(CELT_LIB)
 
diff --git a/sflphone-common/src/audio/codecs/celtcodec.cpp b/sflphone-common/src/audio/codecs/celtcodec.cpp
index 9b6fe17e287c7a159097fd3f29efcb56f90afdea..92ac63c0925ef556c59002c116b6e69192f86018 100644
--- a/sflphone-common/src/audio/codecs/celtcodec.cpp
+++ b/sflphone-common/src/audio/codecs/celtcodec.cpp
@@ -126,10 +126,12 @@ class Celt : public AudioCodec
         }
 
         virtual int codecDecode (short *dst, unsigned char *src, unsigned int size) {
+#ifdef BUILD_CELT_91 // == 91
             int err = 0;
-#if BUILD_CELT == 91
             err = celt_decode (_dec, src, size, (celt_int16*) dst, size);
-#else
+#endif
+#ifdef BUILD_CELT_71
+            int err = 0;
             err = celt_decode (_dec, src, size, (celt_int16*) dst);
 #endif
             return _frameSize * sizeof (celt_int16);
@@ -137,9 +139,10 @@ class Celt : public AudioCodec
 
         virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) {
             int len = 0;
-#if BUILD_CELT == 91 
+#ifdef BUILD_CELT_91// == 91
             len = celt_encode (_enc, (celt_int16*) src, size, dst, 40);
-#else
+#endif
+#ifdef BUILD_CELT_71
             len = celt_encode (_enc, (celt_int16*) src, (celt_int16 *) src, dst, 40);
 #endif
             // returns the number of bytes writen