From fb3a07dc9289ecc2b2752a6b4fa50a32bda89e68 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 10 Oct 2007 20:36:17 +0200 Subject: [PATCH] configure, ipvs plugin: Check for ip_vs.h. 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 Signed-off-by: Florian Forster --- configure.in | 21 ++++++++++++++++++++- src/ipvs.c | 18 ++++++++++++++---- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/configure.in b/configure.in index 75e9131a..d128d5e2 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 5755e06b..3c6aa5c1 100644 --- a/src/ipvs.c +++ b/src/ipvs.c @@ -34,12 +34,22 @@ #include "plugin.h" #include "common.h" -#include -#include -#include +#if HAVE_ARPA_INET_H +# include +#endif /* HAVE_ARPA_INET_H */ +#if HAVE_SYS_SOCKET_H +# include +#endif /* HAVE_SYS_SOCKET_H */ +#if HAVE_NETINET_IN_H +# include +#endif /* HAVE_NETINET_IN_H */ /* this can probably only be found in the kernel sources */ -#include +#if HAVE_NET_IP_VS_H +# include +#elif HAVE_IP_VS_H +# include +#endif /* HAVE_IP_VS_H */ #define log_err(...) ERROR ("ipvs: " __VA_ARGS__) -- 2.30.2