build: crop excessive net-snmp library list

This fixes the longstanding GPL vs. OpenSSL licensing issue in our SNMP
code (and cuts down on its other dependencies a wee bit.)

In a way, net-snmp is really buggy here in what it says that we should
link against, but I don't know their application scenarios well enough
to say it should be changed at their end.

Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
David Lamparter 2018-10-27 19:06:22 +02:00
parent 75082dafb5
commit e5563f8778

View file

@ -1535,6 +1535,11 @@ if test "${enable_snmp}" != "" -a "${enable_snmp}" != "no"; then
fi fi
SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`" SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`"
SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`" SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`"
# net-snmp lists all of its own dependencies. we absolutely do not want that
# among other things we avoid a GPL vs. OpenSSL license conflict here
for removelib in crypto ssl sensors pci wrap; do
SNMP_LIBS="`echo $SNMP_LIBS | sed -e 's/\(^\|\s\)-l'$removelib'\b/ /g' -e 's/\(^\|\s\)\([^\s]*\/\)\?lib'$removelib'\.[^\s]\+\b/ /g'`"
done
AC_MSG_CHECKING([whether we can link to Net-SNMP]) AC_MSG_CHECKING([whether we can link to Net-SNMP])
AC_LINK_IFELSE_FLAGS([$SNMP_CFLAGS], [$SNMP_LIBS], [AC_LANG_PROGRAM([ AC_LINK_IFELSE_FLAGS([$SNMP_CFLAGS], [$SNMP_LIBS], [AC_LANG_PROGRAM([
int main(void); int main(void);