From 1540546cc1261f3dc55e0ed455d9dd924dabc105 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 29 Feb 2016 12:39:51 -0500 Subject: [PATCH] FS-8884: add --disable-libyuv and --disable-libvpx configure args to disable building these libraries --- Makefile.am | 25 +++++++++++++++++++++---- configure.ac | 10 ++++++++++ src/switch_core_video.c | 6 ++---- src/switch_loadable_module.c | 5 ++++- src/switch_vpx.c | 4 ++++ 5 files changed, 41 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index 15864ff674..60746dbf06 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,8 +26,12 @@ AM_LIBAPU_LDFLAGS := $(shell ./libs/apr-util/apu-1-config --ldflags) AM_LIBAPU_LIBS := $(subst $(switch_builddir)/,,$(shell ./libs/apr-util/apu-1-config \--libs)) endif + AM_CFLAGS = $(SWITCH_AM_CFLAGS) $(SWITCH_ANSI_CFLAGS) -AM_CPPFLAGS = -I$(switch_srcdir)/libs/libvpx $(SWITCH_AM_CXXFLAGS) -I$(switch_srcdir)/libs/sofia-sip/libsofia-sip-ua/sdp -I$(switch_srcdir)/libs/sofia-sip/libsofia-sip-ua/su -I$(switch_builddir)/libs/sofia-sip/libsofia-sip-ua/su +AM_CPPFLAGS = +AM_CPPFLAGS += -I$(switch_srcdir)/libs/libvpx +AM_CPPFLAGS += $(SWITCH_AM_CXXFLAGS) -I$(switch_srcdir)/libs/sofia-sip/libsofia-sip-ua/sdp +AM_CPPFLAGS += -I$(switch_srcdir)/libs/sofia-sip/libsofia-sip-ua/su -I$(switch_builddir)/libs/sofia-sip/libsofia-sip-ua/su AM_LDFLAGS = $(SWITCH_AM_LDFLAGS) $(AM_LIBAPR_LDFLAGS) $(AM_LIBAPU_LDFLAGS) DEFAULT_SOUNDS=en-us-callie-8000 @@ -115,15 +119,23 @@ CORE_CFLAGS = $(AM_LIBAPR_CFLAGS) $(AM_LIBAPR_CPPFLAGS) CORE_CFLAGS += $(AM_LIBAPU_CPPFLAGS) CORE_CFLAGS += -I$(switch_srcdir)/libs/libtpl-1.5/src CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/include +if ENABLE_LIBYUV CORE_CFLAGS += -I$(switch_srcdir)/libs/libyuv/include +CORE_CFLAGS += -DSWITCH_HAVE_YUV +endif CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include CORE_CFLAGS += -I$(switch_builddir)/libs/spandsp/src -I$(switch_srcdir)/libs/spandsp/src CORE_CFLAGS += -I$(switch_builddir)/libs/tiff-4.0.2/libtiff -I$(switch_srcdir)/libs/tiff-4.0.2/libtiff -CORE_CFLAGS += -DSWITCH_HAVE_YUV +if ENABLE_LIBVPX CORE_CFLAGS += -DSWITCH_HAVE_VPX +endif APR_LIBS = $(AM_LIBAPU_LIBS) $(AM_LIBAPR_LIBS) -CORE_LIBS=libs/libvpx/libvpx.a +CORE_LIBS= + +if ENABLE_LIBVPX +CORE_LIBS += libs/libvpx/libvpx.a +endif if SYSTEM_APRUTIL CORE_LIBS += $(AM_LIBAPU_LINKLIBTOOL) else @@ -159,11 +171,15 @@ endif ## ## libfreeswitch ## -noinst_LTLIBRARIES = libfreeswitch_spandsp.la libfreeswitch_libyuv.la +noinst_LTLIBRARIES = libfreeswitch_spandsp.la +if ENABLE_LIBYUV +noinst_LTLIBRARIES += libfreeswitch_libyuv.la +endif libfreeswitch_spandsp_la_SOURCES = libs/spandsp/src/plc.c libs/spandsp/src/alloc.c libs/spandsp/src/bit_operations.c libfreeswitch_spandsp_la_CFLAGS = -Ilibs/spandsp/src $(CORE_CFLAGS) $(AM_CFLAGS) CORE_LIBS+=libfreeswitch_spandsp.la +if ENABLE_LIBYUV libfreeswitch_libyuv_la_SOURCES = \ libs/libyuv/source/compare.cc \ libs/libyuv/source/compare_common.cc \ @@ -196,6 +212,7 @@ libfreeswitch_libyuv_la_SOURCES = \ libfreeswitch_libyuv_la_CPPFLAGS = -O2 -fomit-frame-pointer -Ilibs/libyuv/include CORE_LIBS+=libfreeswitch_libyuv.la +endif lib_LTLIBRARIES = libfreeswitch.la libfreeswitch_la_CFLAGS = $(CORE_CFLAGS) $(SQLITE_CFLAGS) $(FREETYPE_CFLAGS) $(CURL_CFLAGS) $(PCRE_CFLAGS) $(SPEEX_CFLAGS) $(LIBEDIT_CFLAGS) $(openssl_CFLAGS) $(AM_CFLAGS) diff --git a/configure.ac b/configure.ac index 9238dbdef3..4765fb8d67 100644 --- a/configure.ac +++ b/configure.ac @@ -543,6 +543,16 @@ if test "${enable_debug}" = "yes"; then fi +AC_ARG_ENABLE(libyuv, +[AC_HELP_STRING([--disable-libyuv],[build without libyuv])],[enable_libyuv="$enableval"],[enable_libyuv="yes"]) + +AM_CONDITIONAL([ENABLE_LIBYUV],[test "${enable_libyuv}" = "yes"]) + +AC_ARG_ENABLE(libvpx, +[AC_HELP_STRING([--disable-libvpx],[build without libvpx])],[enable_libvpx="$enableval"],[enable_libvpx="yes"]) + +AM_CONDITIONAL([ENABLE_LIBVPX],[test "${enable_libvpx}" = "yes"]) + AC_ARG_ENABLE(cpp, [AC_HELP_STRING([--disable-cpp],[build without cpp code])],[enable_cpp="$enableval"],[enable_cpp="yes"]) diff --git a/src/switch_core_video.c b/src/switch_core_video.c index 3e820391bc..4758706cac 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -1936,9 +1936,9 @@ SWITCH_DECLARE(switch_status_t) switch_img_fit(switch_image_t **srcP, int width, return SWITCH_STATUS_FALSE; } +#ifdef SWITCH_HAVE_YUV static inline uint32_t switch_img_fmt2fourcc(switch_img_fmt_t fmt) { -#ifdef SWITCH_HAVE_YUV uint32_t fourcc; switch(fmt) { @@ -1972,10 +1972,8 @@ static inline uint32_t switch_img_fmt2fourcc(switch_img_fmt_t fmt) } return fourcc; -#else - return 0xFFFFFFFF; -#endif } +#endif SWITCH_DECLARE(switch_status_t) switch_img_to_raw(switch_image_t *src, void *dest, switch_size_t size, switch_img_fmt_t fmt) { diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 9a2635fca8..bc4289ac37 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1876,8 +1876,11 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo switch_loadable_module_load_module("", "CORE_SOFTTIMER_MODULE", SWITCH_FALSE, &err); switch_loadable_module_load_module("", "CORE_PCM_MODULE", SWITCH_FALSE, &err); switch_loadable_module_load_module("", "CORE_SPEEX_MODULE", SWITCH_FALSE, &err); +#ifdef SWITCH_HAVE_YUV +#ifdef SWITCH_HAVE_VPX switch_loadable_module_load_module("", "CORE_VPX_MODULE", SWITCH_FALSE, &err); - +#endif +#endif if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) { switch_xml_t mods, ld; diff --git a/src/switch_vpx.c b/src/switch_vpx.c index c8dfd516b2..dcb3e8f185 100644 --- a/src/switch_vpx.c +++ b/src/switch_vpx.c @@ -32,6 +32,8 @@ */ #include +#ifdef SWITCH_HAVE_YUV +#ifdef SWITCH_HAVE_VPX #include #include #include @@ -1269,6 +1271,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_vpx_load) return SWITCH_STATUS_SUCCESS; } +#endif +#endif /* For Emacs: * Local Variables: * mode:c