Hi once more, In our config_site.h we define PJMEDIA_HAS_SRTP to 0. While this does omit the SRTP code in the source files, the build system still links to libsrtp (or builds it's own copy). There is currently no off-switch for libsrtp. I think the optics are a bit off when the code doesn't use libsrtp but still links to it (or even builds an internal copy). The attached patch adds an off switch and compounds the statements that set the current behavior. I don't like this patch too much because it adds another configure switch. I'm wondering if maybe it would be better to have one switch "--with-srtp" that can be on/off/external/internal(default) and leave "--with-external-srtp" for the time being, but print a warning when used (and use the facilities from "--with-srtp"). The latter is a bit more involved than just compounding what is currently there. But if there's interest I sure would try to come up with a patch. If there's no interest in this I'd rather save me the effort, hence this mail. Please let me know what you think. Thanks! Kind regards, Seb
--- a/build.mak.in +++ b/build.mak.in @@ -37,6 +37,7 @@ export APP_THIRD_PARTY_EXT := export APP_THIRD_PARTY_LIBS := export APP_THIRD_PARTY_LIB_FILES := +ifneq (@ac_srtp_off@,1) ifneq (@ac_external_srtp@,0) # External SRTP library APP_THIRD_PARTY_EXT += -l@ac_external_srtp_lib@ @@ -49,6 +50,7 @@ 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 +endif ifeq (@ac_pjmedia_resample@,libresample) APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample-$(LIB_SUFFIX) --- a/third_party/build/os-auto.mak.in +++ b/third_party/build/os-auto.mak.in @@ -39,6 +39,7 @@ else endif endif +ifneq (@ac_srtp_off@,1) # SRTP turned off ifneq (@ac_external_srtp@,0) # External SRTP else @@ -58,8 +59,8 @@ RNG_SRC = # crypto/rng/rand_source_o SRTP_OTHER_CFLAGS = -DOPENSSL endif - endif +endif # SRTP turned off ifeq (@ac_pjmedia_resample@,libresample) DIRS += resample --- a/pjmedia/build/os-auto.mak.in +++ b/pjmedia/build/os-auto.mak.in @@ -139,6 +139,7 @@ endif # # SRTP # +ifneq (@ac_srtp_off@,1) # SRTP turned off ifneq (@ac_external_srtp@,0) # External SRTP export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=@ac_external_srtp@ @@ -152,6 +153,7 @@ export CFLAGS += -I$(THIRD_PARTY)/build/ -I$(THIRD_PARTY)/srtp/include endif +endif # SRTP turned off # # Resample --- a/aconfigure.ac +++ b/aconfigure.ac @@ -565,6 +565,18 @@ AC_ARG_WITH(external-gsm, ] ) +dnl # Force SRTP off +AC_SUBST(ac_srtp_off,0) +AC_ARG_WITH(srtp, + AS_HELP_STRING([--without-srtp], + [Disable SRTP support. Warning: If you use this you need to define PJMEDIA_HAS_SRTP to 0.]), + [ + if test "x$with_srtp" = "xno"; then + AC_MSG_WARN(SRTP support disabled... Hopefully you defined PJMEDIA_HAS_SRTP to be exactly 0!) + ac_srtp_off="1" + fi + ] + ) dnl # Use external SRTP installation AC_SUBST(ac_external_srtp,0) @@ -573,7 +585,7 @@ AC_ARG_WITH(external-srtp, AS_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 + if test ac_srtp_off != "1" && 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 <srtp2/srtp.h> @@ -1861,7 +1873,7 @@ AC_ARG_ENABLE(opus, [ if test "$enable_opus" = "no"; then [ac_no_opus=1] - AC_DEFINE(PJMEDIA_HAS_OPUS_CODEC,0) + AC_DEFINE(PJMEDIA_HAS_OPUS_CODEC, [0], [Define to 1 if you have opus codec]) AC_MSG_RESULT([Checking if OPUS support is disabled... yes]) fi ], @@ -1879,7 +1891,7 @@ AC_ARG_ENABLE(opus, AC_CHECK_LIB(opus,opus_repacketizer_get_size,[opus_present=1 && LIBS="-lopus $LIBS"]) if test "x$opus_h_present" = "x1" -a "x$opus_present" = "x1"; then AC_MSG_RESULT([OPUS library found, OPUS support enabled]) - AC_DEFINE(PJMEDIA_HAS_OPUS_CODEC,1) + AC_DEFINE(PJMEDIA_HAS_OPUS_CODEC, [1], [Define to 1 if you have opus codec]) else [ac_no_opus=1] AC_MSG_RESULT([OPUS library not found, OPUS support disabled])
_______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@xxxxxxxxxxxxxxx http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org