cisco / libsrtp

Library for SRTP (Secure Realtime Transport Protocol)
Other
1.23k stars 476 forks source link

libsrtp has automatic dependency on libcap #328

Closed joakim-tjernlund closed 4 years ago

joakim-tjernlund commented 7 years ago

One should be able to control linkage with libpcap, this patch is a start:


--- a/configure.in  2015-03-25 15:37:31.953386365 +0000
+++ b/configure.in  2015-03-25 15:39:49.192183689 +0000
@@ -182,6 +182,8 @@
 AC_SUBST(HMAC_OBJS)

 dnl Checking for PCAP
+AC_ARG_ENABLE([pcap], AS_HELP_STRING([--disable-pcap], [Build without `pcap' library (-lpcap)]))
+AS_IF([test "x$enable_pcap" != "xno"], [
 AC_CHECK_LIB([pcap],[pcap_create],
     [PCAP=1
      LIBS="-lpcap $LIBS"
@@ -189,6 +191,7 @@
      AC_DEFINE(HAVE_PCAP, 1, [Define to 1 if you have the `pcap' library (-lpcap)])
      AC_SUBST(HAVE_PCAP)
 ])
+])

 AC_MSG_CHECKING(whether to use syslog for error reporting)
 AC_ARG_ENABLE(syslog,
pabuhler commented 7 years ago

Hi @joakim-tjernlund , I am not sure exactly what the issues is. I have made a small patch that will only add -lpcap to the one executable that requires it instead of to all executable, this will still be done automatically if libpcap is detected. Does this help for you? If not can you please explain why you need to explicitly not link against libpcap? I would prefer not adding a configure option for this.

joakim-tjernlund commented 7 years ago

Hi @pabuhler

Your patch is a step in the right direction, only link pcap with apps that need it. Now one can see that pcap is only needed for test app(s). But this will still build against pcap if it is installed, I should/need to be able to control explicitly whether pcap should be used or not. If --enable-pcap is active one should get a configure error that pcap is missing and with --disable-pcap libsrtp should not build against pcap even if pcap is installed.

joakim-tjernlund commented 7 years ago

If you really want to keep the current auto dependency on pcap you could have enable, disable and auto(default)

Also, can build of test progs be configurable?

pabuhler commented 7 years ago

I don't wish to be difficult but I do not see the benefit of adding more configure options, they will just require maintenance. If you have a real reason to add them then please explain and we can consider it. ( even better create a PR) .

The make target make shared_library will build just the shared library and no test apps. In general though I would recommend building the tests and running them.

The build system for this project is definitely not perfect but unless there is a good reason for change I do not plan to meddle to much.

joakim-tjernlund commented 7 years ago

Mainly this, I (or a distribution) should be able to build the same srtp pkg regardless if pcap is installed. Now a dep on pcap will sneak in just because it was installed.

In Gentoo there is a special test flag one can specify when building a pkg which then builds tests and runs them. So Gentoo wants to know the difference between a normal build and a test build.

pabuhler commented 7 years ago

So you are creating a pkg from the default make command that includes the test apps?

If we change the make target "all" to only build the static libsrtp2.a would that fix this for you?