diff options
author | Jason Parker <jparker@digium.com> | 2013-03-11 15:51:17 -0500 |
---|---|---|
committer | Jason Parker <jparker@digium.com> | 2013-03-11 15:51:17 -0500 |
commit | af93a26aa321d3620925e5df68574226ba6cec3c (patch) | |
tree | c73301bfef50ae9ba250285bbcc7879f5c837e04 | |
parent | 09114052f74fe74bbf652189cedefe41b7141b86 (diff) | |
parent | 9550ec7a68b8d072f99872d44def5004dbcc2562 (diff) |
Merge branch 'patch/external-srtp' of github.com:asterisk/pjproject
Conflicts:
build.mak.in
-rwxr-xr-x | aconfigure | 44 | ||||
-rw-r--r-- | aconfigure.ac | 20 | ||||
-rw-r--r-- | build.mak.in | 22 | ||||
-rw-r--r-- | pjmedia/build/Makefile | 7 | ||||
-rw-r--r-- | pjmedia/build/os-auto.mak.in | 14 | ||||
-rw-r--r-- | pjmedia/build/os-darwinos.mak | 15 | ||||
-rw-r--r-- | pjmedia/build/os-linux.mak | 15 | ||||
-rw-r--r-- | pjmedia/build/os-win32.mak | 15 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/transport_srtp.c | 8 | ||||
-rw-r--r-- | third_party/build/Makefile | 2 | ||||
-rw-r--r-- | third_party/build/os-auto.mak.in | 5 |
11 files changed, 155 insertions, 12 deletions
@@ -641,6 +641,7 @@ ac_pa_use_alsa ac_pa_cflags ac_external_pa ac_pjmedia_snd +ac_external_srtp ac_external_gsm ac_external_speex ac_shared_libraries @@ -733,6 +734,7 @@ enable_epoll enable_shared with_external_speex with_external_gsm +with_external_srtp enable_sound with_external_pa enable_oss @@ -1446,6 +1448,11 @@ Optional Packages: make sure that the GSM include/lib files are accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths) + --with-external-srtp Use external SRTP development files, not the one in + "third_party" directory. When this option is set, + make sure that SRTP is accessible to use (hint: use + CFLAGS and LDFLAGS env var to set the include/lib + paths) --with-external-pa Use external PortAudio development files, not the one in "third_party" directory. When this option is set, make sure that PortAudio is accessible to use @@ -5820,6 +5827,43 @@ fi +ac_external_srtp=0 + + +# Check whether --with-external-srtp was given. +if test "${with_external_srtp+set}" = set; then : + withval=$with_external_srtp; + if test "x$with_external_srtp" != "xno"; then + # Test SRTP installation + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if external SRTP devkit is installed" >&5 +$as_echo_n "checking if external SRTP devkit is installed... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <srtp/srtp.h> + +int +main () +{ +srtp_init(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes!!" >&5 +$as_echo "yes!!" >&6; } + ac_external_srtp="1" + +else + as_fn_error $? "Unable to use SRTP. If SRTP development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + +fi + + # Check whether --enable-sound was given. diff --git a/aconfigure.ac b/aconfigure.ac index 8d184a2..f9152d3 100644 --- a/aconfigure.ac +++ b/aconfigure.ac @@ -525,6 +525,26 @@ AC_ARG_WITH(external-gsm, ) +dnl # Use external SRTP installation +AC_SUBST(ac_external_srtp,0) +AC_ARG_WITH(external-srtp, + AC_HELP_STRING([--with-external-srtp], + [Use external SRTP development files, not the one in "third_party" directory. When this option is set, make sure that SRTP is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]), + [ + if test "x$with_external_srtp" != "xno"; then + # Test SRTP installation + AC_MSG_CHECKING([if external SRTP devkit is installed]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <srtp/srtp.h> + ]], + [srtp_init();])], + [AC_MSG_RESULT(yes!!) + ac_external_srtp="1" + ], + [AC_MSG_ERROR([Unable to use SRTP. If SRTP development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])]) + fi + ] + ) + dnl # Sound device backend selection AC_SUBST(ac_pjmedia_snd) diff --git a/build.mak.in b/build.mak.in index fa8a4bf..e436667 100644 --- a/build.mak.in +++ b/build.mak.in @@ -23,13 +23,25 @@ endif # Determine which party libraries to use export APP_THIRD_PARTY_EXT := export APP_THIRD_PARTY_LIBS := -export APP_THIRD_PARTY_LIB_FILES := $(PJ_DIR)/third_party/lib/libmilenage-$(LIB_SUFFIX) $(PJ_DIR)/third_party/lib/libsrtp-$(LIB_SUFFIX) +export APP_THIRD_PARTY_LIB_FILES := $(PJ_DIR)/third_party/lib/libmilenage-$(LIB_SUFFIX) ifeq ($(PJ_SHARED_LIBRARIES),) -APP_THIRD_PARTY_LIBS += -lmilenage-$(TARGET_NAME) -lsrtp-$(TARGET_NAME) +APP_THIRD_PARTY_LIBS += -lmilenage-$(TARGET_NAME) else -APP_THIRD_PARTY_LIBS += -lmilenage -lsrtp -APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libmilenage.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libmilenage.$(SHLIB_SUFFIX) \ - $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX) +APP_THIRD_PARTY_LIBS += -lmilenage +APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libmilenage.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libmilenage.$(SHLIB_SUFFIX) +endif + +ifeq (@ac_external_srtp@,1) +# External SRTP library +APP_THIRD_PARTY_EXT += -lsrtp +else +APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libsrtp-$(LIB_SUFFIX) +ifeq ($(PJ_SHARED_LIBRARIES),) +APP_THIRD_PARTY_LIBS += -lsrtp-$(TARGET_NAME) +else +APP_THIRD_PARTY_LIBS += -lsrtp +APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX) +endif endif APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample-$(LIB_SUFFIX) diff --git a/pjmedia/build/Makefile b/pjmedia/build/Makefile index 7df9ede..ca8e588 100644 --- a/pjmedia/build/Makefile +++ b/pjmedia/build/Makefile @@ -3,10 +3,6 @@ include ../../version.mak THIRD_PARTY:=$(PJDIR)/third_party -SRTP_INC=$(CC_INC)$(THIRD_PARTY)/build/srtp \ - $(CC_INC)$(THIRD_PARTY)/srtp/crypto/include \ - $(CC_INC)$(THIRD_PARTY)/srtp/include - include $(PJDIR)/build/common.mak export LIBDIR := ../lib @@ -48,8 +44,7 @@ export _CFLAGS := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \ $(CC_INC)../../pjlib-util/include \ $(CC_INC)../../pjmedia/include \ $(CC_INC)../../pjnath/include \ - $(CC_INC)../.. \ - $(SRTP_INC) + $(CC_INC)../.. export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \ $(HOST_CXXFLAGS) $(CXXFLAGS) diff --git a/pjmedia/build/os-auto.mak.in b/pjmedia/build/os-auto.mak.in index 04224e8..e71cde1 100644 --- a/pjmedia/build/os-auto.mak.in +++ b/pjmedia/build/os-auto.mak.in @@ -127,6 +127,20 @@ endif # +# SRTP +# +ifeq (@ac_external_srtp@,1) +# External SRTP +export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1 +else +# Our SRTP in third_party +export CFLAGS += -I$(THIRD_PARTY)/build/srtp \ + -I$(THIRD_PARTY)/srtp/crypto/include \ + -I$(THIRD_PARTY)/srtp/include + +endif + +# # PortAudio # ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),) diff --git a/pjmedia/build/os-darwinos.mak b/pjmedia/build/os-darwinos.mak index 7904594..82fdfbf 100644 --- a/pjmedia/build/os-darwinos.mak +++ b/pjmedia/build/os-darwinos.mak @@ -80,6 +80,21 @@ endif # +# SRTP +# +#ifeq (@ac_external_srtp@,1) +ifeq (0,1) +# External SRTP +export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1 +else +# Our SRTP in third_party +export CFLAGS += -I$(THIRD_PARTY)/build/srtp \ + -I$(THIRD_PARTY)/srtp/crypto/include \ + -I$(THIRD_PARTY)/srtp/include + +endif + +# # PortAudio # ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),) diff --git a/pjmedia/build/os-linux.mak b/pjmedia/build/os-linux.mak index 63910c4..a6d2dd3 100644 --- a/pjmedia/build/os-linux.mak +++ b/pjmedia/build/os-linux.mak @@ -74,6 +74,21 @@ endif # +# SRTP +# +#ifeq (@ac_external_srtp@,1) +ifeq (0,1) +# External SRTP +export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1 +else +# Our SRTP in third_party +export CFLAGS += -I$(THIRD_PARTY)/build/srtp \ + -I$(THIRD_PARTY)/srtp/crypto/include \ + -I$(THIRD_PARTY)/srtp/include + +endif + +# # PortAudio # ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),) diff --git a/pjmedia/build/os-win32.mak b/pjmedia/build/os-win32.mak index 498a9e1..0df71a5 100644 --- a/pjmedia/build/os-win32.mak +++ b/pjmedia/build/os-win32.mak @@ -76,6 +76,21 @@ endif # +# SRTP +# +#ifeq (@ac_external_srtp@,1) +ifeq (0,1) +# External SRTP +export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1 +else +# Our SRTP in third_party +export CFLAGS += -I$(THIRD_PARTY)/build/srtp \ + -I$(THIRD_PARTY)/srtp/crypto/include \ + -I$(THIRD_PARTY)/srtp/include + +endif + +# # PortAudio # ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),) diff --git a/pjmedia/src/pjmedia/transport_srtp.c b/pjmedia/src/pjmedia/transport_srtp.c index a661c37..bd0e9b6 100644 --- a/pjmedia/src/pjmedia/transport_srtp.c +++ b/pjmedia/src/pjmedia/transport_srtp.c @@ -30,7 +30,11 @@ #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) +#if defined(PJMEDIA_EXTERNAL_SRTP) && (PJMEDIA_EXTERNAL_SRTP != 0) +#include <srtp/srtp.h> +#else #include <srtp.h> +#endif #define THIS_FILE "transport_srtp.c" @@ -315,11 +319,15 @@ static void pjmedia_srtp_deinit_lib(pjmedia_endpt *endpt) PJ_UNUSED_ARG(endpt); +#if defined(PJMEDIA_EXTERNAL_SRTP) && (PJMEDIA_EXTERNAL_SRTP != 0) + PJ_UNUSED_ARG(err); +#else err = srtp_deinit(); if (err != err_status_ok) { PJ_LOG(4, (THIS_FILE, "Failed to deinitialize libsrtp: %s", get_libsrtp_errstr(err))); } +#endif libsrtp_initialized = PJ_FALSE; } diff --git a/third_party/build/Makefile b/third_party/build/Makefile index 36d8061..8cfe9cf 100644 --- a/third_party/build/Makefile +++ b/third_party/build/Makefile @@ -1,4 +1,4 @@ -DIRS = resample milenage srtp +DIRS = resample milenage include ../../build.mak include $(PJDIR)/build/common.mak diff --git a/third_party/build/os-auto.mak.in b/third_party/build/os-auto.mak.in index f1de03f..dfc32a9 100644 --- a/third_party/build/os-auto.mak.in +++ b/third_party/build/os-auto.mak.in @@ -31,3 +31,8 @@ DIRS += portaudio endif endif +ifeq (@ac_external_srtp@,1) +# External SRTP +else +DIRS += srtp +endif |