]> granicus.if.org Git - ipset/commitdiff
Optionally disable building the kernel module.
authorMathieu Bridon <bochecha@fedoraproject.org>
Mon, 12 Sep 2011 08:03:23 +0000 (16:03 +0800)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 15 Sep 2011 07:02:33 +0000 (09:02 +0200)
Distributors (like Fedora) might be interested in including the ipset
tools and libs, but they often don't want to build and ship external
kernel modules, especially if those modules are already included in
their kernel packages.

This patch introduces a new --with-kmod configure option that can be
used to conditionally build the kernel module. The module is still built
by default, to preserve compatibility.

A user who wants to build only the user-space part of ipset can do so by
running the following:

    $ ./autogen.sh
    $ configure --with-kmod=no
    $ make
    # make install

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Makefile.am
configure.ac

index 3d462136510ac1d26040e06ece5274ae6bf59f37..09ba4d94fd6ce9b9f60711e6d77968ce70b53786 100644 (file)
@@ -23,21 +23,37 @@ endif
 SUBDIRS                = lib src
 
 modules_sparse:
+if WITH_KMOD
        ${MAKE} -C $(KBUILD_OUTPUT) M=$$PWD/kernel/net/netfilter \
                        V=$V C=2 CF=-D__CHECK_ENDIAN__ \
                        IP_SET_MAX=$(IP_SET_MAX) KDIR=$$PWD/kernel modules
+else
+       @echo Skipping kernel modules due to --with-kmod=no
+endif
 
 modules:
+if WITH_KMOD
        ${MAKE} -C $(KBUILD_OUTPUT) M=$$PWD/kernel/net/netfilter V=$V \
                        IP_SET_MAX=$(IP_SET_MAX) KDIR=$$PWD/kernel modules
+else
+       @echo Skipping kernel modules due to --with-kmod=no
+endif
 
 modules_install:
+if WITH_KMOD
        ${MAKE} -C $(KBUILD_OUTPUT) M=$$PWD/kernel/net/netfilter \
                        KDIR=$$PWD/kernel modules_install
+else
+       @echo Skipping kernel modules due to --with-kmod=no
+endif
 
 modules_clean:
+if WITH_KMOD
        ${MAKE} -C $(KBUILD_OUTPUT) M=$$PWD/kernel/net/netfilter \
                        KDIR=$$PWD/kernel clean
+else
+       @echo Skipping kernel modules due to --with-kmod=no
+endif
 
 update_includes:
        ./update ip_set.h
index 1481d18a005f0452616abe2e4cef20d522f1d9db..9ad8bedd5626055efad55f70c42b61e3055e8287 100644 (file)
@@ -11,6 +11,14 @@ case "$host" in
 *) AC_MSG_ERROR([Linux systems supported exclusively!]);;
 esac
 
+dnl Optionnally disable building the kernel module
+AC_ARG_WITH([kmod],
+            AS_HELP_STRING([--with-kmod=yes/no],
+                           [Build the kernel module (default: yes)]),
+            [BUILDKMOD="$withval";],
+            [BUILDKMOD="yes";])
+AM_CONDITIONAL(WITH_KMOD, test "$BUILDKMOD" == "yes")
+
 dnl Additional arguments
 dnl Kernel build directory or source tree
 AC_ARG_WITH([kbuild],
@@ -24,6 +32,8 @@ AC_ARG_WITH([ksource],
 AM_CONDITIONAL(WITH_KBUILDDIR, test "$KBUILDDIR" != "")
 AC_SUBST(KBUILDDIR)
 
+if test "$BUILDKMOD" == "yes"
+then
 dnl Sigh: check kernel version dependencies
 if test "$KBUILDDIR" != ""
 then
@@ -55,6 +65,7 @@ if test "X`$GREP 'NFNL_SUBSYS_IPSET' $ksourcedir/include/linux/netfilter/nfnetli
 then
        AC_MSG_ERROR([The kernel source directory $ksourcedir is not patched with netlink.patch to support ipset])
 fi
+fi
 
 dnl Maximal number of sets supported by the kernel, default 256
 AC_ARG_WITH([maxsets],