netsnmp: handle libnl dependency properly
[buildroot-gz.git] / package / netsnmp / netsnmp.mk
blob0f4b7d80bc4f14f51f7819fd7e8a8009885fc946
1 ################################################################################
3 # netsnmp
5 ################################################################################
7 NETSNMP_VERSION = 5.7.3
8 NETSNMP_SITE = http://downloads.sourceforge.net/project/net-snmp/net-snmp/$(NETSNMP_VERSION)
9 NETSNMP_SOURCE = net-snmp-$(NETSNMP_VERSION).tar.gz
10 NETSNMP_LICENSE = Various BSD-like
11 NETSNMP_LICENSE_FILES = COPYING
12 NETSNMP_INSTALL_STAGING = YES
13 NETSNMP_CONF_ENV = ac_cv_NETSNMP_CAN_USE_SYSCTL=no
14 NETSNMP_CONF_OPTS = \
15 --with-persistent-directory=/var/lib/snmp \
16 --with-defaults \
17 --enable-mini-agent \
18 --without-rpm \
19 --with-logfile=none \
20 --without-kmem-usage \
21 --enable-as-needed \
22 --without-perl-modules \
23 --disable-embedded-perl \
24 --disable-perl-cc-checks \
25 --disable-scripts \
26 --with-default-snmp-version="1" \
27 --enable-silent-libtool \
28 --enable-mfd-rewrites \
29 --with-sys-contact="root@localhost" \
30 --with-sys-location="Unknown" \
31 --with-mib-modules="$(call qstrip,$(BR2_PACKAGE_NETSNMP_WITH_MIB_MODULES))" \
32 --with-out-mib-modules="$(call qstrip,$(BR2_PACKAGE_NETSNMP_WITHOUT_MIB_MODULES))" \
33 --with-out-transports="Unix" \
34 --disable-manuals
35 NETSNMP_INSTALL_STAGING_OPTS = DESTDIR=$(STAGING_DIR) LIB_LDCONFIG_CMD=true install
36 NETSNMP_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) LIB_LDCONFIG_CMD=true install
37 NETSNMP_MAKE = $(MAKE1)
38 NETSNMP_CONFIG_SCRIPTS = net-snmp-config
39 NETSNMP_AUTORECONF = YES
41 NETSNMP_BLOAT_MIBS = BRIDGE DISMAN-EVENT DISMAN-SCHEDULE DISMAN-SCRIPT EtherLike RFC-1215 RFC1155-SMI RFC1213 SCTP SMUX
43 ifeq ($(BR2_ENDIAN),"BIG")
44 NETSNMP_CONF_OPTS += --with-endianness=big
45 else
46 NETSNMP_CONF_OPTS += --with-endianness=little
47 endif
49 ifeq ($(BR2_PACKAGE_LIBNL),y)
50 NETSNMP_DEPENDENCIES += host-pkgconf libnl
51 NETSNMP_CONF_OPTS += --with-nl
52 else
53 NETSNMP_CONF_OPTS += --without-nl
54 endif
56 # OpenSSL
57 ifeq ($(BR2_PACKAGE_OPENSSL),y)
58 NETSNMP_DEPENDENCIES += openssl
59 NETSNMP_CONF_OPTS += \
60 --with-openssl=$(STAGING_DIR)/usr/include/openssl \
61 --with-security-modules="tsm,usm" \
62 --with-transports="DTLSUDP,TLSTCP"
63 ifeq ($(BR2_STATIC_LIBS),y)
64 # openssl uses zlib, so we need to explicitly link with it when static
65 NETSNMP_CONF_ENV += LIBS=-lz
66 endif
67 else ifeq ($(BR2_PACKAGE_NETSNMP_OPENSSL_INTERNAL),y)
68 NETSNMP_CONF_OPTS += --with-openssl=internal
69 else
70 NETSNMP_CONF_OPTS += --without-openssl
71 endif
73 # There's no option to forcibly enable or disable it
74 ifeq ($(BR2_PACKAGE_PCIUTILS),y)
75 NETSNMP_DEPENDENCIES += pciutils
76 endif
78 # For ucd-snmp/lmsensorsMib
79 ifeq ($(BR2_PACKAGE_LM_SENSORS),y)
80 NETSNMP_DEPENDENCIES += lm-sensors
81 endif
83 ifneq ($(BR2_PACKAGE_NETSNMP_ENABLE_MIBS),y)
84 NETSNMP_CONF_OPTS += --disable-mib-loading
85 NETSNMP_CONF_OPTS += --disable-mibs
86 endif
88 ifneq ($(BR2_PACKAGE_NETSNMP_ENABLE_DEBUGGING),y)
89 NETSNMP_CONF_OPTS += --disable-debugging
90 endif
92 ifeq ($(BR2_PACKAGE_NETSNMP_SERVER),y)
93 NETSNMP_CONF_OPTS += --enable-agent
94 else
95 NETSNMP_CONF_OPTS += --disable-agent
96 endif
98 ifeq ($(BR2_PACKAGE_NETSNMP_CLIENTS),y)
99 NETSNMP_CONF_OPTS += --enable-applications
100 else
101 NETSNMP_CONF_OPTS += --disable-applications
102 endif
104 define NETSNMP_REMOVE_BLOAT_MIBS
105 for mib in $(NETSNMP_BLOAT_MIBS); do \
106 rm -f $(TARGET_DIR)/usr/share/snmp/mibs/$$mib-MIB.txt; \
107 done
108 endef
110 NETSNMP_POST_INSTALL_TARGET_HOOKS += NETSNMP_REMOVE_BLOAT_MIBS
112 ifeq ($(BR2_PACKAGE_NETSNMP_SERVER),y)
113 define NETSNMP_INSTALL_INIT_SYSV
114 $(INSTALL) -D -m 0755 package/netsnmp/S59snmpd \
115 $(TARGET_DIR)/etc/init.d/S59snmpd
116 endef
117 endif
119 define NETSNMP_STAGING_NETSNMP_CONFIG_FIXUP
120 $(SED) "s,^includedir=.*,includedir=\'$(STAGING_DIR)/usr/include\',g" \
121 -e "s,^libdir=.*,libdir=\'$(STAGING_DIR)/usr/lib\',g" \
122 $(STAGING_DIR)/usr/bin/net-snmp-config
123 endef
125 NETSNMP_POST_INSTALL_STAGING_HOOKS += NETSNMP_STAGING_NETSNMP_CONFIG_FIXUP
127 $(eval $(autotools-package))