diff --git a/configure.ac b/configure.ac index bc3cafa0bd..6e3b1f9d16 100644 --- a/configure.ac +++ b/configure.ac @@ -1926,7 +1926,17 @@ AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin]) AM_CONDITIONAL(ISFREEBSD, [test `uname -s` = FreeBSD]) AM_CONDITIONAL(IS64BITLINUX, [test `uname -m` = x86_64]) -AM_CONDITIONAL(HAVE_AMR, [ test -d ${switch_srcdir}/libs/amr ]) +AC_ARG_ENABLE(amr, +[AC_HELP_STRING([--disable-amr],[build without opencore-amrnb])],[enable_amr="$enable_amr"],[enable_amr="yes"]) + +if test x"$enable_amr" = x"yes" ; then + PKG_CHECK_MODULES([AMR], [opencore-amrnb >= 0.1.0],[ + AM_CONDITIONAL([HAVE_AMR],[true])],[ + AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AMR],[false])]) +else + AM_CONDITIONAL([HAVE_AMR],[false]) +fi + AM_CONDITIONAL(HAVE_AMRWB, [ test -d ${switch_srcdir}/libs/amrwb ]) AM_CONDITIONAL(HAVE_G723_1, [ test -d ${switch_srcdir}/libs/libg723_1 ]) AM_CONDITIONAL(HAVE_G729, [ test -d ${switch_srcdir}/libs/libg729 ]) diff --git a/src/mod/codecs/mod_amr/Makefile.am b/src/mod/codecs/mod_amr/Makefile.am index a919e56599..ac80d8ac35 100644 --- a/src/mod/codecs/mod_amr/Makefile.am +++ b/src/mod/codecs/mod_amr/Makefile.am @@ -1,8 +1,5 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_amr -AMR_DIR=$(switch_srcdir)/libs/amr -AMR_BUILDDIR=$(switch_builddir)/libs/amr -AMR_A=$(AMR_BUILDDIR)/libamr.a mod_LTLIBRARIES = mod_amr.la if HAVE_AMR @@ -10,15 +7,15 @@ mod_amr_la_SOURCES = mod_amr.c bitshift.c amr_be.c else mod_amr_la_SOURCES = mod_amr.c endif + mod_amr_la_CFLAGS = $(AM_CFLAGS) mod_amr_la_LIBADD = $(switch_builddir)/libfreeswitch.la mod_amr_la_LDFLAGS = -avoid-version -module -no-undefined -shared if HAVE_AMR # install AMR library opencore-amrnb (check README) -mod_amr_la_CFLAGS += -I/usr/include/opencore-amrnb -mod_amr_la_LIBADD += -lopencore-amrnb -mod_amr_la_CFLAGS += +mod_amr_la_CFLAGS += $(AMR_CFLAGS) +mod_amr_la_LIBADD += $(AMR_LIBS) else mod_amr_la_CFLAGS += -DAMR_PASSTHROUGH endif diff --git a/src/mod/codecs/mod_amr/mod_amr.c b/src/mod/codecs/mod_amr/mod_amr.c index 5b723887c0..e6f574783a 100644 --- a/src/mod/codecs/mod_amr/mod_amr.c +++ b/src/mod/codecs/mod_amr/mod_amr.c @@ -27,6 +27,7 @@ * Brian K. West * Dragos Oancea * Federico Favaro + * Marco Sinibaldi * * The amr codec itself is not distributed with this module. * @@ -40,8 +41,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load); SWITCH_MODULE_DEFINITION(mod_amr, mod_amr_load, NULL, NULL); #ifndef AMR_PASSTHROUGH -#include "interf_enc.h" -#include "interf_dec.h" +#include "opencore-amrnb/interf_enc.h" +#include "opencore-amrnb/interf_dec.h" #include "bitshift.h" #include "amr_be.h"