]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9386: [mod_snmp] Use net-snmp-config for SNMP libs if available
authorSpencer Thomason <spencer@whiteskycommunications.com>
Tue, 26 Jul 2016 20:48:13 +0000 (13:48 -0700)
committerSpencer Thomason <spencer@whiteskycommunications.com>
Wed, 27 Jul 2016 04:18:10 +0000 (21:18 -0700)
FS-9386 #resolve

configure.ac
src/mod/event_handlers/mod_snmp/Makefile.am

index db91f78a16865fe0b7a55ed6682be16b8d54e2b8..cce8ab0af42fdd4c62e014840d3a01c8934145b8 100644 (file)
@@ -1705,6 +1705,22 @@ else
        AC_MSG_WARN([python support disabled, building mod_python will fail!])
 fi
 
+#
+# SNMP checks for mod_snmp
+#
+AC_PATH_PROG([NET_SNMP_CONFIG], [net-snmp-config], [no])
+if test "$NET_SNMP_CONFIG" != "no"; then
+       AC_MSG_CHECKING([for Net-SNMP libraries via net-snmp-config])
+       SNMP_LIBS="`$NET_SNMP_CONFIG --base-agent-libs`"
+else
+       # net-snmp-config not in path, fallback to sensible defaults
+       SNMP_LIBS="-lnetsnmpmibs -lnetsnmpagent -lnetsnmp"
+fi
+
+# fix linking error on Solaris patched Net-SNMP
+AS_CASE([$host], [*-solaris2*], [AC_CHECK_LIB([dladm], [dladm_open], [SNMP_LIBS="$SNMP_LIBS -ldladm"])])
+AC_SUBST(SNMP_LIBS)
+
 CHECK_ERLANG
 
 # we never use this, and hard setting it will make cross compile work better
index e949e9ad9ebfcfc4e4e44b4b4db989f22edf0cc8..a94ebe0c5162507a940ed766a7933d844eafdda8 100644 (file)
@@ -4,5 +4,5 @@ MODNAME=mod_snmp
 mod_LTLIBRARIES = mod_snmp.la
 mod_snmp_la_SOURCES  = mod_snmp.c subagent.c
 mod_snmp_la_CFLAGS   = $(AM_CFLAGS)
-mod_snmp_la_LIBADD   = $(switch_builddir)/libfreeswitch.la -lnetsnmpmibs -lnetsnmpagent -lnetsnmp
+mod_snmp_la_LIBADD   = $(switch_builddir)/libfreeswitch.la $(SNMP_LIBS)
 mod_snmp_la_LDFLAGS  = -avoid-version -module -no-undefined -shared