[collectd] [PATCH] configure, ipvs plugin: Check for ip_vs.h.

Sebastian Harl sh at tokkee.org
Wed Oct 10 20:36:17 CEST 2007


Disable the ipvs module, if neither net/ip_vs.h nor ip_vs.h could be
found. Added HAVE_*_H checks for each included system header in ipvs.c.

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 configure.in |   21 ++++++++++++++++++++-
 src/ipvs.c   |   18 ++++++++++++++----
 2 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/configure.in b/configure.in
index 75e9131..d128d5e 100644
--- a/configure.in
+++ b/configure.in
@@ -271,6 +271,15 @@ AC_CHECK_HEADERS(linux/netdevice.h, [], [],
 #endif
 ])
 
+# For ipvs module
+have_net_ip_vs_h="no"
+have_ip_vs_h="no"
+if test "x$ac_system" = "xLinux"
+then
+	AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
+	AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
+fi
+
 # For quota module
 AC_CHECK_HEADERS(sys/ucred.h, [], [],
 [
@@ -1698,7 +1707,6 @@ then
 	plugin_disk="yes"
 	plugin_entropy="yes"
 	plugin_interface="yes"
-	plugin_ipvs="yes"
 	plugin_irq="yes"
 	plugin_load="yes"
 	plugin_memory="yes"
@@ -1709,6 +1717,11 @@ then
 	plugin_tcpconns="yes"
 	plugin_vserver="yes"
 	plugin_wireless="yes"
+
+	if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
+	then
+		plugin_ipvs="yes"
+	fi
 fi
 
 # Mac OS X devices
@@ -1848,6 +1861,12 @@ AC_PLUGIN([vserver],     [$plugin_vserver],    [Linux VServer statistics])
 AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
 AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
 
+dnl ip_vs.h
+if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
+then
+	enable_ipvs="$enable_ipvs (ip_vs.h not found)"
+fi
+
 dnl Perl bindings
 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
 [
diff --git a/src/ipvs.c b/src/ipvs.c
index 5755e06..3c6aa5c 100644
--- a/src/ipvs.c
+++ b/src/ipvs.c
@@ -34,12 +34,22 @@
 #include "plugin.h"
 #include "common.h"
 
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
+#if HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif /* HAVE_ARPA_INET_H */
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif /* HAVE_SYS_SOCKET_H */
+#if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif /* HAVE_NETINET_IN_H */
 
 /* this can probably only be found in the kernel sources */
-#include <net/ip_vs.h>
+#if HAVE_NET_IP_VS_H
+# include <net/ip_vs.h>
+#elif HAVE_IP_VS_H
+# include <ip_vs.h>
+#endif /* HAVE_IP_VS_H */
 
 #define log_err(...) ERROR ("ipvs: " __VA_ARGS__)
 
-- 
1.5.3.3.131.g34c6d-dirty

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20071010/39b5f16a/attachment.pgp 


More information about the collectd mailing list