Code

configure.in: Look for ip_vs.h in the kernel sources.
authorBoian Berberov <bberberov@gmail.com>
Mon, 11 Aug 2008 14:57:57 +0000 (16:57 +0200)
committerFlorian Forster <octo@huhu.verplant.org>
Mon, 11 Aug 2008 14:57:57 +0000 (16:57 +0200)
Developers,

I am writing an updated ebuild for gentoo and I made this patch that allows
ip_vs.h to be located and the ipvs module to build. Normally I would include
this with the ebuild, but I thought it may be beneficial to send it to you.
Please review it and let me know what you think. I am still inexperienced with
autotools so the patch may not be well put together. If you would consider
applying it or a similar patch, please let me know so I can adjust the ebuild
accordingly.

Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
configure.in
src/Makefile.am

index 41ee95555c9a5c419d44601f182cab0e8d962b61..ceb25538ebc4f4dea6ee2ebd2d22eeccfb5d8792 100644 (file)
@@ -50,6 +50,18 @@ case $host_os in
 esac
 AC_MSG_RESULT([$ac_system])
 
+if test "x$ac_system" = "xLinux"
+then
+       AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
+       if test -z "$KERNEL_DIR"
+       then
+               KERNEL_DIR="/lib/modules/`uname -r`/source"
+       fi
+
+       KERNEL_CFLAGS="-I$KERNEL_DIR/include"
+       AC_SUBST(KERNEL_CFLAGS)
+fi
+
 #
 # Checks for header files.
 #
@@ -278,8 +290,13 @@ have_net_ip_vs_h="no"
 have_ip_vs_h="no"
 if test "x$ac_system" = "xLinux"
 then
+       SAVE_CFLAGS=$CFLAGS
+       CFLAGS="$CFLAGS $KERNEL_CFLAGS"
+
        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
 fi
 
 # For quota module
@@ -1599,15 +1616,6 @@ then
        LDFLAGS=$SAVE_LDFLAGS
 fi
 
-if test "x$ac_system" = "xLinux"
-then
-       AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
-       if test -z "$KERNEL_DIR"
-       then
-               KERNEL_DIR="/lib/modules/`uname -r`/source"
-       fi
-fi
-
 with_own_libiptc="no"
 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
 [
@@ -1653,7 +1661,7 @@ fi
 if test "x$with_libiptc" = "xyes"
 then
        SAVE_CFLAGS=$CFLAGS
-       CFLAGS="$CFLAGS -I$KERNEL_DIR/include"
+       CFLAGS="$CFLAGS $KERNEL_CFLAGS"
 
        AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
        [
index 21022493ca74d5e8473f8a1cf1dbc0bd66aa4904..a4f9a79fee7a69a53475953d03c990670591e7ef 100644 (file)
@@ -311,6 +311,7 @@ endif
 if BUILD_PLUGIN_IPVS
 pkglib_LTLIBRARIES += ipvs.la
 ipvs_la_SOURCES = ipvs.c
+ipvs_la_CFLAGS = $(KERNEL_CFLAGS)
 ipvs_la_LDFLAGS = -module -avoid-version
 collectd_LDADD += "-dlopen" ipvs.la
 collectd_DEPENDENCIES += ipvs.la