diff --git a/Makefile.am b/Makefile.am index 61292e9dc2..c86d5439bb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,13 +3,28 @@ SUBDIRS = . src build AUTOMAKE_OPTIONS = foreign subdir-objects NAME = freeswitch +if SYSTEM_APR +AM_LIBAPR_CFLAGS := $(shell apr-1-config --cflags) +AM_LIBAPR_CPPFLAGS := $(shell apr-1-config --cppflags --includes) +AM_LIBAPR_LDFLAGS := $(shell apr-1-config --ldflags) +AM_LIBAPR_LIBS := $(shell apr-1-config \--libs) +AM_LIBAPR_LINKLIBTOOL := $(shell apr-1-config \--link-libtool) +else AM_LIBAPR_CFLAGS := $(shell ./libs/apr/apr-1-config --cflags) AM_LIBAPR_CPPFLAGS := $(shell ./libs/apr/apr-1-config --cppflags --includes) AM_LIBAPR_LDFLAGS := $(shell ./libs/apr/apr-1-config --ldflags) AM_LIBAPR_LIBS := $(subst $(switch_builddir)/,,$(shell ./libs/apr/apr-1-config \--libs)) +endif +if SYSTEM_APRUTIL +AM_LIBAPU_CPPFLAGS := $(shell apu-1-config --includes) +AM_LIBAPU_LDFLAGS := $(shell apu-1-config --ldflags) +AM_LIBAPU_LIBS := $(shell apu-1-config \--libs) +AM_LIBAPU_LINKLIBTOOL := $(shell apu-1-config \--link-libtool) +else AM_LIBAPU_CPPFLAGS := $(shell ./libs/apr-util/apu-1-config --includes) 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 = $(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 @@ -89,7 +104,17 @@ CORE_CFLAGS += -I$(switch_builddir)/libs/spandsp/src -I$(switch_srcdir)/libs/spa CORE_CFLAGS += -I$(switch_builddir)/libs/tiff-4.0.2/libtiff -I$(switch_srcdir)/libs/tiff-4.0.2/libtiff APR_LIBS = $(AM_LIBAPU_LIBS) $(AM_LIBAPR_LIBS) -CORE_LIBS = libs/apr-util/libaprutil-1.la libs/apr/libapr-1.la +CORE_LIBS= +if SYSTEM_APR +CORE_LIBS += $(AM_LIBAPR_LINKLIBTOOL) +else +CORE_LIBS += libs/apr/libapr-1.la +endif +if SYSTEM_APRUTIL +CORE_LIBS += $(AM_LIBAPU_LINKLIBTOOL) +else +CORE_LIBS += libs/apr-util/libaprutil-1.la +endif if ENABLE_SRTP CORE_CFLAGS += -DENABLE_SRTP diff --git a/configure.ac b/configure.ac index 0d0e4d5c00..1f8241b3dc 100644 --- a/configure.ac +++ b/configure.ac @@ -656,6 +656,11 @@ if test "x$have_libz" = "xyes" ; then APR_ADDTO([PLATFORM_CORE_LIBS], [-lz]) fi +AC_CHECK_LIB(apr-1, apr_pool_mutex_set, use_system_apr=yes, use_system_apr=no) +AM_CONDITIONAL([SYSTEM_APR],[test "${use_system_apr}" = "yes"]) +AC_CHECK_LIB(aprutil-1, apr_queue_pop_timeout, use_system_aprutil=yes, use_system_aprutil=no) +AM_CONDITIONAL([SYSTEM_APRUTIL],[test "${use_system_aprutil}" = "yes"]) + AC_CHECK_LIB(jpeg, jpeg_std_error,, AC_MSG_ERROR([no usable libjpeg; please install libjpeg devel package or equivalent])) AC_CHECK_LIB(jbig, jbg_enc_out, have_libjbig=yes, have_libjbig=no) @@ -1525,8 +1530,12 @@ ac_configure_args="$ac_configure_args CONFIGURE_CFLAGS='$CFLAGS' CONFIGURE_CXXFL # Run configure in all the subdirs AC_CONFIG_SUBDIRS([libs/srtp]) -AC_CONFIG_SUBDIRS([libs/apr]) -AC_CONFIG_SUBDIRS([libs/apr-util]) +if test "$use_system_apr" != "yes"; then + AC_CONFIG_SUBDIRS([libs/apr]) +fi +if test "$use_system_aprutil" != "yes"; then + AC_CONFIG_SUBDIRS([libs/apr-util]) +fi AC_CONFIG_SUBDIRS([libs/ilbc]) AC_CONFIG_SUBDIRS([libs/iksemel]) AC_CONFIG_SUBDIRS([libs/js/nsprpub])