[collectd] [PATCH] [PATCH] allow compilation if snmp headers not present

epeisach at bu.edu epeisach at bu.edu
Wed Jun 20 03:34:31 CEST 2007


From: Ezra Peisach <epeisach at gambit.bumc.bu.edu>

---
 src/snmp.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/snmp.c b/src/snmp.c
index ec4a696..6d5f876 100644
--- a/src/snmp.c
+++ b/src/snmp.c
@@ -23,9 +23,22 @@
 #include "common.h"
 #include "plugin.h"
 
+#if defined(HAVE_NET_SNMP_NET_SNMP_CONFIG_H)
 #include <net-snmp/net-snmp-config.h>
 #include <net-snmp/net-snmp-includes.h>
+#else
+# undef HAVE_LIBSNMP
+#endif
+
+
+#if defined(HAVE_LIBSNMP)
+# define SNMP_HAVE_READ 1
+#else
+# define SNMP_HAVE_READ 0
+#endif
+
 
+#if SNMP_HAVE_READ
 /*
  * Private data structes
  */
@@ -1111,12 +1124,15 @@ static int csnmp_read (void)
 
   return (0);
 } /* int csnmp_read */
+#endif /* SNMP_HAVE_READ */
 
 void module_register (void)
 {
+#if SNMP_HAVE_READ
   plugin_register_complex_config ("snmp", csnmp_config);
   plugin_register_init ("snmp", csnmp_init);
   plugin_register_read ("snmp", csnmp_read);
+#endif
 } /* void module_register */
 
 /*
-- 
1.5.2.2




More information about the collectd mailing list