]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
configure: add flag to disable NFACCT build
authorEric Leblond <eric@regit.org>
Fri, 2 Nov 2012 17:46:22 +0000 (18:46 +0100)
committerEric Leblond <eric@regit.org>
Sun, 4 Nov 2012 07:56:55 +0000 (08:56 +0100)
It is now possible to pass the --disable-nfacct flag to disable
compilation of NFACCT input plugin. Doing this the build of ulogd
is possible on system where nfacct is not available.

configure.ac
input/sum/Makefile.am
output/ulogd_output_XML.c

index 0f21cf1d38509a2217dc10ae08d3d174e7c07e9a..159cb0b7238fc3417b0556d2f02226f388957dc6 100644 (file)
@@ -44,9 +44,15 @@ AC_SUBST([regular_CFLAGS])
 dnl Check for the right nfnetlink version
 PKG_CHECK_MODULES([LIBNFNETLINK], [libnfnetlink >= 1.0.1])
 PKG_CHECK_MODULES([LIBMNL], [libmnl >= 1.0.3])
-PKG_CHECK_MODULES([LIBNETFILTER_ACCT], [libnetfilter_acct >= 1.0.1])
 PKG_CHECK_MODULES([LIBNETFILTER_CONNTRACK], [libnetfilter_conntrack >= 1.0.2])
 PKG_CHECK_MODULES([LIBNETFILTER_LOG], [libnetfilter_log >= 1.0.0])
+AC_ARG_ENABLE(nfacct,
+       AS_HELP_STRING([--enable-nfacct], [Enable nfacct module [default=yes]]),,[enable_nfacct=yes])
+AS_IF([test "x$enable_nfacct" = "xyes"], [
+    PKG_CHECK_MODULES([LIBNETFILTER_ACCT], [libnetfilter_acct >= 1.0.1])
+    AC_DEFINE([BUILD_NFACCT], [1], [Building nfacct module])
+])
+AM_CONDITIONAL([BUILD_NFACCT], [test "x$enable_nfacct" = "xyes"])
 
 CT_CHECK_POSTGRES_DB()
 AM_CONDITIONAL(HAVE_PGSQL, test "x$PQLIBPATH" != "x")
index 33fa849f2b91e6b16bb2a7109b8afad3392bdba6..b6ddb4d29b93db102dd89565bda5feb53540b177 100644 (file)
@@ -1,8 +1,8 @@
 AM_CPPFLAGS = -I$(top_srcdir)/include $(LIBNETFILTER_ACCT_CFLAGS) $(LIBMNL_CFLAGS)
 AM_CFLAGS = ${regular_CFLAGS}
-
+if BUILD_NFACCT
 pkglib_LTLIBRARIES = ulogd_inpflow_NFACCT.la
-
 ulogd_inpflow_NFACCT_la_SOURCES = ulogd_inpflow_NFACCT.c
 ulogd_inpflow_NFACCT_la_LDFLAGS = -avoid-version -module
 ulogd_inpflow_NFACCT_la_LIBADD  = $(LIBMNL_LIBS) $(LIBNETFILTER_ACCT_LIBS)
+endif
index e9c39748168bac762b62f1e277b7889a26a4387c..5892a5d030fb44c076d099c1d6794b1d901c8d69 100644 (file)
 
 #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
 #include <libnetfilter_log/libnetfilter_log.h>
+#include "../config.h"
+#ifdef BUILD_NFACCT
 #include <libnetfilter_acct/libnetfilter_acct.h>
+#endif
 #include <ulogd/ulogd.h>
 #include <sys/param.h>
 #include <time.h>
@@ -118,6 +121,7 @@ xml_output_packet(struct ulogd_key *inp, char *buf, ssize_t size)
 static int
 xml_output_sum(struct ulogd_key *inp, char *buf, ssize_t size)
 {
+#ifdef BUILD_NFACCT
        struct nfacct *nfacct = ikey_get_ptr(&inp[KEY_SUM]);
        int tmp;
 
@@ -125,10 +129,13 @@ xml_output_sum(struct ulogd_key *inp, char *buf, ssize_t size)
                                                 NFACCT_SNPRINTF_F_TIME);
        if (tmp < 0 || tmp >= size)
                return -1;
-
        return 0;
+#else
+       return -1;
+#endif
 }
 
+
 static int xml_output(struct ulogd_pluginstance *upi)
 {
        struct ulogd_key *inp = upi->input.keys;