b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | commit aa43d358634ab9bf66250babab743a846e2bd689 |
| 2 | Author: Sebastian Kemper <sebastian_ml@gmx.net> |
| 3 | Date: Thu Oct 3 19:58:08 2019 +0200 |
| 4 | |
| 5 | Fix RTP crypto setup |
| 6 | |
| 7 | RTPProxy's configure script checks for both libsrtp and libsrtp2. When |
| 8 | both are available the configure script ends up setting |
| 9 | |
| 10 | LIBS_SRTP="-lsrtp2" |
| 11 | |
| 12 | and defining both ENABLE_SRTP and ENABLE_SRTP2. But the below |
| 13 | preprocessor macro in extractaudio/eaud_crypto.c can only deal with one |
| 14 | or the other, not both: |
| 15 | |
| 16 | #if ENABLE_SRTP |
| 17 | # include <srtp/srtp.h> |
| 18 | # define srtp_crypto_policy_set_rtp_default crypto_policy_set_rtp_default |
| 19 | # define srtp_crypto_policy_set_rtcp_default crypto_policy_set_rtcp_default |
| 20 | # define srtp_sec_serv_t sec_serv_t |
| 21 | # define srtp_err_status_ok err_status_ok |
| 22 | #elif ENABLE_SRTP2 |
| 23 | # include <srtp2/srtp.h> |
| 24 | #else |
| 25 | # error "One of srtp or srtp2 must be configured." |
| 26 | #endif |
| 27 | |
| 28 | So it chooses a setup which would be valid for libsrtp and not libsrtp2. |
| 29 | But afterward the build system tries to link against libsrtp2 (because |
| 30 | of LIBS_SRTP="-lsrtp2") and the compile fails: |
| 31 | |
| 32 | /home/sk/tmp/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/lib/gcc/mips-openwrt-linux-musl/7.4.0/../../../../mips-openwrt-linux-musl/bin/ld: extractaudio-eaud_crypto.o: in function `eaud_crypto_getopt_parse': |
| 33 | eaud_crypto.c:(.text+0xc8): undefined reference to `crypto_policy_set_rtp_default' |
| 34 | /home/sk/tmp/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/lib/gcc/mips-openwrt-linux-musl/7.4.0/../../../../mips-openwrt-linux-musl/bin/ld: eaud_crypto.c:(.text+0xd0): undefined reference to `crypto_policy_set_rtcp_default' |
| 35 | collect2: error: ld returned 1 exit status |
| 36 | make[4]: *** [Makefile:567: extractaudio] Error 1 |
| 37 | |
| 38 | Fix this by checking for libsrtp only if libsrtp2 is not found. |
| 39 | |
| 40 | Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net> |
| 41 | |
| 42 | diff --git a/configure.ac b/configure.ac |
| 43 | index 6e680c63..fe3216b6 100644 |
| 44 | --- a/configure.ac |
| 45 | +++ b/configure.ac |
| 46 | @@ -140,22 +140,22 @@ then |
| 47 | AC_DEFINE([ENABLE_SNDFILE], 1, [Define if you have libsndfile library installed])) |
| 48 | fi |
| 49 | |
| 50 | -# libsrtp |
| 51 | -AC_CHECK_HEADER(srtp/srtp.h, found_libsrtp=yes) |
| 52 | -if test "$found_libsrtp" = yes |
| 53 | -then |
| 54 | - AC_CHECK_LIB(srtp, srtp_init, |
| 55 | - LIBS_SRTP="-lsrtp" |
| 56 | - AC_DEFINE([ENABLE_SRTP], 1, [Define if you have libsrtp library installed])) |
| 57 | -fi |
| 58 | - |
| 59 | -# libsrtp2 |
| 60 | +# libsrtp2 (preferred) |
| 61 | AC_CHECK_HEADER(srtp2/srtp.h, found_libsrtp2=yes) |
| 62 | if test "$found_libsrtp2" = yes |
| 63 | then |
| 64 | AC_CHECK_LIB(srtp2, srtp_init, |
| 65 | LIBS_SRTP="-lsrtp2" |
| 66 | AC_DEFINE([ENABLE_SRTP2], 1, [Define if you have libsrtp2 library installed])) |
| 67 | +else |
| 68 | + # libsrtp |
| 69 | + AC_CHECK_HEADER(srtp/srtp.h, found_libsrtp=yes) |
| 70 | + if test "$found_libsrtp" = yes |
| 71 | + then |
| 72 | + AC_CHECK_LIB(srtp, srtp_init, |
| 73 | + LIBS_SRTP="-lsrtp" |
| 74 | + AC_DEFINE([ENABLE_SRTP], 1, [Define if you have libsrtp library installed])) |
| 75 | + fi |
| 76 | fi |
| 77 | |
| 78 | # libelperiodic |