Building with --disable-agent --enable-minimalist fails since
net-snmp-features.h tries to include files that make features isn't
creating. This patch ensures that net-snmp-features.h only tries to
include existing headers.

OK for 5.7?

The patch also require regeneration of configure and
net-snmp-config.h.in (and thus also something under the win32 directory
I suppose)

diff --git a/configure.d/config_project_with_enable b/configure.d/config_project_with_enable
index 732742b..99caef6 100644
--- a/configure.d/config_project_with_enable
+++ b/configure.d/config_project_with_enable
@@ -175,8 +175,14 @@ fi
 AC_SUBST(INSTALL_PREFIX)
 
 
-#   
+#
 #   Subsystems to build:
+#       Library
+#
+FEATUREHEADERS="library/features.h"
+FTMAINSUBS=""
+
+#
 #       Agent
 #
 NETSNMP_ARG_ENABLE(agent,
@@ -184,6 +190,7 @@ NETSNMP_ARG_ENABLE(agent,
 if test "x$enable_agent" != "xno"; then
    SNMPD='snmpd$(EXEEXT)'
    MAINSUBS="$MAINSUBS agent"
+   FEATUREHEADERS="$FEATUREHEADERS agent/features-mibgroups.h agent/features.h"
    FTMAINSUBS="agent $FTMAINSUBS"
    TRAPLIBS='$(TRAPDWITHAGENT)'
    USETRAPLIBS='$(USEAGENTLIBS)'
@@ -196,7 +203,9 @@ else
    #USETRAPLIBS='$(USELIBS)'
    TRAPLIBS='$(TRAPDWITHAGENT)'
    USETRAPLIBS='$(USEAGENTLIBS)'
+   AC_DEFINE([NETSNMP_DISABLE_AGENT], 1, [Define if no agent is built])
 fi
+
 AC_SUBST(SNMPD)
 AC_SUBST(TRAPLIBS)
 AC_SUBST(USETRAPLIBS)
@@ -208,6 +217,9 @@ NETSNMP_ARG_ENABLE(applications,
 if test "x$enable_applications" != "xno"; then
    MAINSUBS="$MAINSUBS apps"
    FTMAINSUBS="apps $FTMAINSUBS"
+   FEATUREHEADERS="$FEATUREHEADERS features-snmpnetstat.h features-apps.h"
+else
+   AC_DEFINE([NETSNMP_DISABLE_APPS], 1, [Define if no apps are built])
 fi
 
 #       Manual pages
@@ -767,19 +779,19 @@ AC_ARG_WITH(feature,, NETSNMP_INVALID_WITH([features]))
 AC_ARG_WITH(out-feature,, NETSNMP_INVALID_WITH([out-features]))
 
 FEATURETARGS=""
-FEATUREHEADERS=""
 NETSNMP_ARG_ENABLE(minimalist,
 [  --enable-minimalist             Remove all non-essential code features.])
 if test "x$enable_minimalist" = "xyes"; then
    # we'll assume the mini agent is desired here as well
    mini_agent="yes"
    FEATURETARGS="features"
-   FEATUREHEADERS="library/features.h agent/features.h agent/features-mibgroups.h features-snmpnetstat.h features-apps.h"
 
    # needed to bootstrap later checks
    echo "" > include/net-snmp/feature-details.h
    AC_DEFINE(NETSNMP_MINIMAL_CODE, 1,
      [Define if you want to remove all non-essential code features.])
+else
+   FEATUREHEADERS=""
 fi
 AC_ARG_WITH([minimalist],,NETSNMP_INVALID_ENABLE([minimalist]))
 AC_SUBST(FEATURETARGS)
diff --git a/include/net-snmp/net-snmp-features.h b/include/net-snmp/net-snmp-features.h
index ea93384..f37e6c5 100644
--- a/include/net-snmp/net-snmp-features.h
+++ b/include/net-snmp/net-snmp-features.h
@@ -7,10 +7,14 @@
 #include <net-snmp/feature-details.h>
 #else /* ! NETSNMP_FEATURE_CHECKING */
 #include <net-snmp/library/features.h>
+#ifndef NETSNMP_DISABLE_AGENT
 #include <net-snmp/agent/features.h>
 #include <net-snmp/agent/features-mibgroups.h>
+#endif
+#ifndef NETSNMP_DISABLE_APPS
 #include <net-snmp/features-snmpnetstat.h>
 #include <net-snmp/features-apps.h>
+#endif
 #endif /* ! NETSNMP_FEATURE_CHECKING */
 #endif /* NETSNMP_MINIMAL_CODE */
 
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to