Skip to content
This repository
Browse code

Merge branch 'patch/external-srtp' of github.com:asterisk/pjproject

Conflicts:
	build.mak.in
  • Loading branch information...
commit af93a26aa321d3620925e5df68574226ba6cec3c 2 parents 0911405 + 9550ec7
Jason Parker qwell authored
44 aconfigure
@@ -641,6 +641,7 @@ ac_pa_use_alsa
641 641 ac_pa_cflags
642 642 ac_external_pa
643 643 ac_pjmedia_snd
  644 +ac_external_srtp
644 645 ac_external_gsm
645 646 ac_external_speex
646 647 ac_shared_libraries
@@ -733,6 +734,7 @@ enable_epoll
733 734 enable_shared
734 735 with_external_speex
735 736 with_external_gsm
  737 +with_external_srtp
736 738 enable_sound
737 739 with_external_pa
738 740 enable_oss
@@ -1446,6 +1448,11 @@ Optional Packages:
1446 1448 make sure that the GSM include/lib files are
1447 1449 accessible to use (hint: use CFLAGS and LDFLAGS env
1448 1450 var to set the include/lib paths)
  1451 + --with-external-srtp Use external SRTP development files, not the one in
  1452 + "third_party" directory. When this option is set,
  1453 + make sure that SRTP is accessible to use (hint: use
  1454 + CFLAGS and LDFLAGS env var to set the include/lib
  1455 + paths)
1449 1456 --with-external-pa Use external PortAudio development files, not the
1450 1457 one in "third_party" directory. When this option is
1451 1458 set, make sure that PortAudio is accessible to use
@@ -5820,6 +5827,43 @@ fi
5820 5827
5821 5828
5822 5829
  5830 +ac_external_srtp=0
  5831 +
  5832 +
  5833 +# Check whether --with-external-srtp was given.
  5834 +if test "${with_external_srtp+set}" = set; then :
  5835 + withval=$with_external_srtp;
  5836 + if test "x$with_external_srtp" != "xno"; then
  5837 + # Test SRTP installation
  5838 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if external SRTP devkit is installed" >&5
  5839 +$as_echo_n "checking if external SRTP devkit is installed... " >&6; }
  5840 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  5841 +/* end confdefs.h. */
  5842 +#include <srtp/srtp.h>
  5843 +
  5844 +int
  5845 +main ()
  5846 +{
  5847 +srtp_init();
  5848 + ;
  5849 + return 0;
  5850 +}
  5851 +_ACEOF
  5852 +if ac_fn_c_try_compile "$LINENO"; then :
  5853 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes!!" >&5
  5854 +$as_echo "yes!!" >&6; }
  5855 + ac_external_srtp="1"
  5856 +
  5857 +else
  5858 + 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
  5859 +fi
  5860 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  5861 + fi
  5862 +
  5863 +
  5864 +fi
  5865 +
  5866 +
5823 5867
5824 5868
5825 5869 # Check whether --enable-sound was given.
20 aconfigure.ac
@@ -525,6 +525,26 @@ AC_ARG_WITH(external-gsm,
525 525 )
526 526
527 527
  528 +dnl # Use external SRTP installation
  529 +AC_SUBST(ac_external_srtp,0)
  530 +AC_ARG_WITH(external-srtp,
  531 + AC_HELP_STRING([--with-external-srtp],
  532 + [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)]),
  533 + [
  534 + if test "x$with_external_srtp" != "xno"; then
  535 + # Test SRTP installation
  536 + AC_MSG_CHECKING([if external SRTP devkit is installed])
  537 + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <srtp/srtp.h>
  538 + ]],
  539 + [srtp_init();])],
  540 + [AC_MSG_RESULT(yes!!)
  541 + ac_external_srtp="1"
  542 + ],
  543 + [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])])
  544 + fi
  545 + ]
  546 + )
  547 +
528 548
529 549 dnl # Sound device backend selection
530 550 AC_SUBST(ac_pjmedia_snd)
22 build.mak.in
@@ -23,13 +23,25 @@ endif
23 23 # Determine which party libraries to use
24 24 export APP_THIRD_PARTY_EXT :=
25 25 export APP_THIRD_PARTY_LIBS :=
26   -export APP_THIRD_PARTY_LIB_FILES := $(PJ_DIR)/third_party/lib/libmilenage-$(LIB_SUFFIX) $(PJ_DIR)/third_party/lib/libsrtp-$(LIB_SUFFIX)
  26 +export APP_THIRD_PARTY_LIB_FILES := $(PJ_DIR)/third_party/lib/libmilenage-$(LIB_SUFFIX)
27 27 ifeq ($(PJ_SHARED_LIBRARIES),)
28   -APP_THIRD_PARTY_LIBS += -lmilenage-$(TARGET_NAME) -lsrtp-$(TARGET_NAME)
  28 +APP_THIRD_PARTY_LIBS += -lmilenage-$(TARGET_NAME)
29 29 else
30   -APP_THIRD_PARTY_LIBS += -lmilenage -lsrtp
31   -APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libmilenage.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libmilenage.$(SHLIB_SUFFIX) \
32   - $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX)
  30 +APP_THIRD_PARTY_LIBS += -lmilenage
  31 +APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libmilenage.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libmilenage.$(SHLIB_SUFFIX)
  32 +endif
  33 +
  34 +ifeq (@ac_external_srtp@,1)
  35 +# External SRTP library
  36 +APP_THIRD_PARTY_EXT += -lsrtp
  37 +else
  38 +APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libsrtp-$(LIB_SUFFIX)
  39 +ifeq ($(PJ_SHARED_LIBRARIES),)
  40 +APP_THIRD_PARTY_LIBS += -lsrtp-$(TARGET_NAME)
  41 +else
  42 +APP_THIRD_PARTY_LIBS += -lsrtp
  43 +APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libsrtp.$(SHLIB_SUFFIX)
  44 +endif
33 45 endif
34 46
35 47 APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample-$(LIB_SUFFIX)
7 pjmedia/build/Makefile
@@ -3,10 +3,6 @@ include ../../version.mak
3 3
4 4 THIRD_PARTY:=$(PJDIR)/third_party
5 5
6   -SRTP_INC=$(CC_INC)$(THIRD_PARTY)/build/srtp \
7   - $(CC_INC)$(THIRD_PARTY)/srtp/crypto/include \
8   - $(CC_INC)$(THIRD_PARTY)/srtp/include
9   -
10 6 include $(PJDIR)/build/common.mak
11 7
12 8 export LIBDIR := ../lib
@@ -48,8 +44,7 @@ export _CFLAGS := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
48 44 $(CC_INC)../../pjlib-util/include \
49 45 $(CC_INC)../../pjmedia/include \
50 46 $(CC_INC)../../pjnath/include \
51   - $(CC_INC)../.. \
52   - $(SRTP_INC)
  47 + $(CC_INC)../..
53 48 export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
54 49 $(HOST_CXXFLAGS) $(CXXFLAGS)
55 50
14 pjmedia/build/os-auto.mak.in
@@ -127,6 +127,20 @@ endif
127 127
128 128
129 129 #
  130 +# SRTP
  131 +#
  132 +ifeq (@ac_external_srtp@,1)
  133 +# External SRTP
  134 +export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1
  135 +else
  136 +# Our SRTP in third_party
  137 +export CFLAGS += -I$(THIRD_PARTY)/build/srtp \
  138 + -I$(THIRD_PARTY)/srtp/crypto/include \
  139 + -I$(THIRD_PARTY)/srtp/include
  140 +
  141 +endif
  142 +
  143 +#
130 144 # PortAudio
131 145 #
132 146 ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),)
15 pjmedia/build/os-darwinos.mak
@@ -80,6 +80,21 @@ endif
80 80
81 81
82 82 #
  83 +# SRTP
  84 +#
  85 +#ifeq (@ac_external_srtp@,1)
  86 +ifeq (0,1)
  87 +# External SRTP
  88 +export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1
  89 +else
  90 +# Our SRTP in third_party
  91 +export CFLAGS += -I$(THIRD_PARTY)/build/srtp \
  92 + -I$(THIRD_PARTY)/srtp/crypto/include \
  93 + -I$(THIRD_PARTY)/srtp/include
  94 +
  95 +endif
  96 +
  97 +#
83 98 # PortAudio
84 99 #
85 100 ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),)
15 pjmedia/build/os-linux.mak
@@ -74,6 +74,21 @@ endif
74 74
75 75
76 76 #
  77 +# SRTP
  78 +#
  79 +#ifeq (@ac_external_srtp@,1)
  80 +ifeq (0,1)
  81 +# External SRTP
  82 +export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1
  83 +else
  84 +# Our SRTP in third_party
  85 +export CFLAGS += -I$(THIRD_PARTY)/build/srtp \
  86 + -I$(THIRD_PARTY)/srtp/crypto/include \
  87 + -I$(THIRD_PARTY)/srtp/include
  88 +
  89 +endif
  90 +
  91 +#
77 92 # PortAudio
78 93 #
79 94 ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),)
15 pjmedia/build/os-win32.mak
@@ -76,6 +76,21 @@ endif
76 76
77 77
78 78 #
  79 +# SRTP
  80 +#
  81 +#ifeq (@ac_external_srtp@,1)
  82 +ifeq (0,1)
  83 +# External SRTP
  84 +export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1
  85 +else
  86 +# Our SRTP in third_party
  87 +export CFLAGS += -I$(THIRD_PARTY)/build/srtp \
  88 + -I$(THIRD_PARTY)/srtp/crypto/include \
  89 + -I$(THIRD_PARTY)/srtp/include
  90 +
  91 +endif
  92 +
  93 +#
79 94 # PortAudio
80 95 #
81 96 ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),)
8 pjmedia/src/pjmedia/transport_srtp.c
@@ -30,7 +30,11 @@
30 30
31 31 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
32 32
  33 +#if defined(PJMEDIA_EXTERNAL_SRTP) && (PJMEDIA_EXTERNAL_SRTP != 0)
  34 +#include <srtp/srtp.h>
  35 +#else
33 36 #include <srtp.h>
  37 +#endif
34 38
35 39 #define THIS_FILE "transport_srtp.c"
36 40
@@ -315,11 +319,15 @@ static void pjmedia_srtp_deinit_lib(pjmedia_endpt *endpt)
315 319
316 320 PJ_UNUSED_ARG(endpt);
317 321
  322 +#if defined(PJMEDIA_EXTERNAL_SRTP) && (PJMEDIA_EXTERNAL_SRTP != 0)
  323 + PJ_UNUSED_ARG(err);
  324 +#else
318 325 err = srtp_deinit();
319 326 if (err != err_status_ok) {
320 327 PJ_LOG(4, (THIS_FILE, "Failed to deinitialize libsrtp: %s",
321 328 get_libsrtp_errstr(err)));
322 329 }
  330 +#endif
323 331
324 332 libsrtp_initialized = PJ_FALSE;
325 333 }
2  third_party/build/Makefile
... ... @@ -1,4 +1,4 @@
1   -DIRS = resample milenage srtp
  1 +DIRS = resample milenage
2 2
3 3 include ../../build.mak
4 4 include $(PJDIR)/build/common.mak
5 third_party/build/os-auto.mak.in
@@ -31,3 +31,8 @@ DIRS += portaudio
31 31 endif
32 32 endif
33 33
  34 +ifeq (@ac_external_srtp@,1)
  35 +# External SRTP
  36 +else
  37 +DIRS += srtp
  38 +endif

0 comments on commit af93a26

Please sign in to comment.
Something went wrong with that request. Please try again.