Code

configure, ipvs plugin: Check for ip_vs.h.
authorSebastian Harl <sh@tokkee.org>
Wed, 10 Oct 2007 18:36:17 +0000 (20:36 +0200)
committerFlorian Forster <octo@huhu.verplant.org>
Fri, 12 Oct 2007 16:42:30 +0000 (18:42 +0200)
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@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
configure.in
src/ipvs.c

index 75e9131af65705b0b2d26a17bd1b109986e80289..d128d5e201c48236fe545eeac11b11c573defadb 100644 (file)
@@ -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".])],
 [
index 5755e06bd1a0a7635a20fcb73338b86ec888cce8..3c6aa5c12ff1666f66aff4640f1aacb13ff53b8f 100644 (file)
 #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__)