]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9670: add autodetection of opencore-amrnb lib and "--disable-amr" option to confi...
authorDragos Oancea <droancea@yahoo.com>
Wed, 26 Oct 2016 12:53:54 +0000 (08:53 -0400)
committerDragos Oancea <droancea@yahoo.com>
Thu, 27 Oct 2016 15:43:58 +0000 (11:43 -0400)
configure.ac
src/mod/codecs/mod_amr/Makefile.am
src/mod/codecs/mod_amr/mod_amr.c

index bc3cafa0bd0bb41f7617878da7211571608e3efc..6e3b1f9d16ba2757c9b018ce11a0d28a7861bbc2 100644 (file)
@@ -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 ])
index a919e5659978888421a319cf0944ddc7018f20f9..ac80d8ac35ca64c83cc3b139fd0b3b81c1942051 100644 (file)
@@ -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
index 5b723887c0259cc5df15596a5af9e7891acb27aa..e6f574783a18202830a6c8d0c4c89968ae16ff5b 100644 (file)
@@ -27,6 +27,7 @@
  * Brian K. West <brian@freeswitch.org>
  * Dragos Oancea <dragos.oancea@athonet.com>
  * Federico Favaro <federico.favaro@athonet.com>
+ * Marco Sinibaldi <marco.sinibaldi@athonet.com>
  *
  * 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"