diff --git a/configure.ac b/configure.ac index 8d80667fb125b4d4d2c0b4979cd85a426e03dc30..248a2752ca9f39cea8fbb2d535f561d3ba6a5bf4 100644 --- a/configure.ac +++ b/configure.ac @@ -223,7 +223,6 @@ AC_ARG_WITH([speex], [], [with_speex=yes]) -LIBSPEEX= AS_IF([test "x$with_speex" != xno], [AC_CHECK_HEADER([speex/speex.h], , AC_MSG_FAILURE([Unable to find the libspeex headers (you may need to install the dev package). You may use --without-speex to compile without speex codec support.]))] [AC_CHECK_HEADER([speex/speex_preprocess.h], , AC_MSG_FAILURE([Unable to find the libspeexdsp headers (you may need to install the libspeexdsp-dev package). You may use --without-speex to compile without speex codec support.]))] @@ -234,12 +233,17 @@ AS_IF([test "x$with_speex" != xno], ) ] dnl More advanced check in case the libspeexdsp is not installed -AC_CHECK_LIB(speex, speex_preprocess_run, [AC_DEFINE(HAVE_SPEEX_DSP)]) +AC_CHECK_LIB(speex, speex_preprocess_run, HAVE_SPEEXDSP=true, HAVE_SPEEXDSP=false) + +if test $HAVE_SPEEXDSP = false; then + AC_MSG_WARN([The silence detection in speex could not have been enabled]) +fi + ) - + AC_DEFINE([HAVE_SPEEX], test "x$with_speex" = "xyes", [Define if you have libspeex]) AM_CONDITIONAL(BUILD_SPEEX, test "x$with_speex" = "xyes" ) -AM_CONDITIONAL(HAVE_SPEEX_DSP, $(HAVE_SPEEX_DSP)) +AM_CONDITIONAL(ENABLE_SPEEXDSP, $HAVE_SPEEXDSP) dnl Check for ilbc support AC_ARG_WITH([ilbc], diff --git a/src/audio/codecs/Makefile.am b/src/audio/codecs/Makefile.am index 236f2d71a115b12b8aaf1e8e6cf95a55055f88ab..6b8097c6ba29b9313607d8bcefd6d7fe9312fa53 100644 --- a/src/audio/codecs/Makefile.am +++ b/src/audio/codecs/Makefile.am @@ -9,16 +9,16 @@ libcodec_gsm_so_LDFLAGS = --shared -lc -lgsm INSTALL_GSM_RULE = install-libcodec_gsm_so endif +if ENABLE_SPEEXDSP +SPEEXDSP_LIB = -lspeexdsp +endif + if BUILD_SPEEX SPEEX_LIB = libcodec_speex.so -SPEEX_DSP_LIB= -if HAVE_SPEEX_DSP -SPEEX_DSP_LIB = -lspeexdsp -endif libcodec_speex_so_SOURCES = speexcodec.cpp libcodec_speex_so_CFLAGS = -fPIC -g -Wall libcodec_speex_so_CXXFLAGS = -fPIC -g -Wall -libcodec_speex_so_LDFLAGS = --shared -lc -lspeex $(SPEEX_DSP_LIB) -lm +libcodec_speex_so_LDFLAGS = --shared -lc -lspeex $(SPEEXDSP_LIB) -lm INSTALL_SPEEX_RULE = install-libcodec_speex_so endif diff --git a/src/audio/codecs/speexcodec.cpp b/src/audio/codecs/speexcodec.cpp index b141dd5f39721c1d885ff1f03b4f8e57d80952cc..f325015b1fe46794132bc65edeb3b4713be3c9b1 100644 --- a/src/audio/codecs/speexcodec.cpp +++ b/src/audio/codecs/speexcodec.cpp @@ -59,7 +59,7 @@ class Speex : public AudioCodec{ speex_bits_init(&_speex_enc_bits); _speex_enc_state = speex_encoder_init(_speexModePtr); -#ifdef HAVE_SPEEX_DSP +#if ENABLE_SPEEXDSP int enable = 1; int quality = 10; @@ -114,7 +114,7 @@ class Speex : public AudioCodec{ { speex_bits_reset(&_speex_enc_bits); -#ifdef HAVE_SPEEX_DSP +#if ENABLE_SPEEXDSP speex_encoder_ctl(_speex_enc_state,SPEEX_SET_SAMPLING_RATE,&_clockRate); speex_preprocess_run(_preprocess_state, src); #endif