summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9756728)
raw | patch | inline | side by side (parent: 9756728)
author | Sebastian Harl <sh@tokkee.org> | |
Mon, 9 Jan 2012 10:16:19 +0000 (11:16 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Mon, 9 Jan 2012 17:27:36 +0000 (18:27 +0100) |
Also, try to find ip_vs.h without using KERNEL_CFLAGS at first. The Linux
kernel headers should not be used directly -- in current kernel versions this
generates warnings leading to build failures because of -Werror.
kernel headers should not be used directly -- in current kernel versions this
generates warnings leading to build failures because of -Werror.
configure.in | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/ipvs.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index 254e7fdfaa936a8a128ef11fc0c24ebae142269a..5618ef84d67f07a744b8b80ef23b87805a10c012 100644 (file)
--- a/configure.in
+++ b/configure.in
])
# For ipvs module
+have_linux_ip_vs_h="no"
have_net_ip_vs_h="no"
have_ip_vs_h="no"
+ip_vs_h_needs_kernel_cflags="no"
if test "x$ac_system" = "xLinux"
then
- SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $KERNEL_CFLAGS"
-
+ AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
- CFLAGS="$SAVE_CFLAGS"
+ if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
+ then
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $KERNEL_CFLAGS"
+
+ AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
+
+ AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
+ AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
+ AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
+
+ if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
+ then
+ ip_vs_h_needs_kernel_cflags="yes"
+ fi
+
+ CFLAGS="$SAVE_CFLAGS"
+ fi
fi
+AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
# For quota module
AC_CHECK_HEADERS(sys/ucred.h, [], [],
plugin_vserver="yes"
plugin_wireless="yes"
- if test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
+ if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
then
plugin_ipvs="yes"
fi
dnl ip_vs.h
if test "x$ac_system" = "xLinux" \
- && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
+ && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
then
enable_ipvs="$enable_ipvs (ip_vs.h not found)"
fi
+if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
+then
+ enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
+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/Makefile.am b/src/Makefile.am
index c6b0538d305a572b67a5ec06ff63c3506279793b..0c427dc86686ddcb32c8816a27f3d6861ce20fcc 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
if BUILD_PLUGIN_IPVS
pkglib_LTLIBRARIES += ipvs.la
ipvs_la_SOURCES = ipvs.c
+if IP_VS_H_NEEDS_KERNEL_CFLAGS
ipvs_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS)
+endif
ipvs_la_LDFLAGS = -module -avoid-version
collectd_LDADD += "-dlopen" ipvs.la
collectd_DEPENDENCIES += ipvs.la
diff --git a/src/ipvs.c b/src/ipvs.c
index 87eee108a79410853b6f02e107697b7a358f465a..7bd8c6985b1019e7085ca4bcd900e1e36fa9ac46 100644 (file)
--- a/src/ipvs.c
+++ b/src/ipvs.c
#endif /* HAVE_NETINET_IN_H */
/* this can probably only be found in the kernel sources */
-#if HAVE_NET_IP_VS_H
+#if HAVE_LINUX_IP_VS_H
+# include <linux/ip_vs.h>
+#elif HAVE_NET_IP_VS_H
# include <net/ip_vs.h>
#elif HAVE_IP_VS_H
# include <ip_vs.h>