build system improvements
cover build system improvements
Hello,
Here's a small patchset containing some build system improvements. The first three patches add a flag to disable the build of some input plugins that depends on library. The last patch adds a message at the end of configure run to indicate what will be build.
Patchset statistic:
configure.ac | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- input/flow/Makefile.am | 2 ++ input/packet/Makefile.am | 4 ++++ input/sum/Makefile.am | 4 ++-- output/ulogd_output_XML.c | 7 ++++++- 5 files changed, 75 insertions(+), 8 deletions(-)
BR,
--
Eric
PATCH 1/4 Add configure flag to disable NFACCT build
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 | 8 +++++++- input/sum/Makefile.am | 4 ++-- output/ulogd_output_XML.c | 7 ++++++- 3 files changed, 15 insertions(+), 4 deletions(-)
configure.ac +7 -1
@@ -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")
input/sum/Makefile.am +2 -2
@@ -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
output/ulogd_output_XML.c +6 -1
@@ -20,7 +20,10 @@#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,11 @@ xml_output_sum(struct ulogd_key *inp, char *buf, ssize_t size) NFACCT_SNPRINTF_F_TIME);if (tmp <0 || tmp >= size)return -1 ; - +#endif return 0 ; } +static int xml_output (struct ulogd_pluginstance *upi) {struct ulogd_key *inp = upi->input.keys;
Signature · 1 line
1.7.10.4
Re: [PATCH 1/4] Add configure flag to disable NFACCT build
Quoted 30 lines · Eric Leblond
configure.ac +0
-0@@ -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])configure.ac +7
-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")input/sum/Makefile.am +1
-1@@ -1,8 +1,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/include $(LIBNETFILTER_ACCT_CFLAGS) $(LIBMNL_CFLAGS) AM_CFLAGS = ${regular_CFLAGS} - +if BUILD_NFACCT
Quoted 6 lines
pkglib_LTLIBRARIES= ulogd_inpflow_NFACCT.la
-ulogd_inpflow_NFACCT_la_SOURCES=ulogd_inpflow_NFACCT.culogd_inpflow_NFACCT_la_LDFLAGS= -avoid-version -moduleulogd_inpflow_NFACCT_la_LIBADD= $(LIBMNL_LIBS) $(LIBNETFILTER_ACCT_LIBS) +endif
As far as I remember, AM conditionals do not automatically become C macros. Can you check config.h?
So you will likely have to add the following line into the if..endif block:
AM_CPPFLAGS += -DBUILD_NFACCT
Re: [PATCH 1/4] Add configure flag to disable NFACCT build
Hi,
Quoted 34 lines · Jan Engelhardt
Quoted 31 lines · Eric Leblond
configure.ac +0
-0@@ -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])configure.ac +7
-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")input/sum/Makefile.am +1
-1@@ -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
Quoted 8 lines
Quoted 5 lines
-
ulogd_inpflow_NFACCT_la_SOURCES=ulogd_inpflow_NFACCT.culogd_inpflow_NFACCT_la_LDFLAGS= -avoid-version -moduleulogd_inpflow_NFACCT_la_LIBADD= $(LIBMNL_LIBS) $(LIBNETFILTER_ACCT_LIBS) +endifAs far as I remember, AM conditionals do not automatically become C macros. Can you check
config.h?
Yeah, that's why I've added AC_DEFINE when the module is built.
BR,
Quoted 4 lines
So you will likely have to add the following line into the if..endif block:
AM_CPPFLAGS+= -DBUILD_NFACCT
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] Add configure flag to disable NFACCT build
Quoted 10 lines · Eric Leblond
Quoted 8 lines
configure.ac AC_SUBST([regular_CFLAGS]) · line 55
Quoted 5 lines
configure.ac +5
-0+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"])As far as I remember, AM conditionals do not automatically become C macros. Can you check
config.h?Yeah, that's why I've added
AC_DEFINEwhen the module is built.
I completely missed that. Sorry for the noise.
PATCH 2/4 Add configure flag to disable NFCT build
In reply to Eric Leblond--- configure.ac | 8 +++++++- input/flow/Makefile.am | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-)
configure.ac +7 -1
@@ -44,8 +44,14 @@ 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_CONNTRACK], [libnetfilter_conntrack >= 1.0.2]) PKG_CHECK_MODULES([LIBNETFILTER_LOG], [libnetfilter_log >= 1.0.0]) +AC_ARG_ENABLE(nfct, + AS_HELP_STRING([--enable-nfct], [Enable nfct module [default=yes]]),,[enable_nfct=yes]) +AS_IF([test "x$enable_nfct" = "xyes"], [ + PKG_CHECK_MODULES([LIBNETFILTER_CONNTRACK], [libnetfilter_conntrack >= 1.0.2]) + AC_DEFINE([BUILD_NFCT], [1], [Building nfct module]) +]) +AM_CONDITIONAL([BUILD_NFCT], [test "x$enable_nfct" = "xyes"]) AC_ARG_ENABLE(nfacct, AS_HELP_STRING([--enable-nfacct], [Enable nfacct module [default=yes]]),,[enable_nfacct=yes]) AS_IF([test "x$enable_nfacct" = "xyes"], [
input/flow/Makefile.am +2 -0
@@ -2,11 +2,13 @@ AM_CPPFLAGS = -I$(top_srcdir)/include AM_CFLAGS = ${regular_CFLAGS} +if BUILD_NFCT pkglib_LTLIBRARIES = ulogd_inpflow_NFCT.la # ulogd_inpflow_IPFIX.la ulogd_inpflow_NFCT_la_SOURCES = ulogd_inpflow_NFCT.c ulogd_inpflow_NFCT_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_CONNTRACK_LIBS) ulogd_inpflow_NFCT_la_CFLAGS = $(AM_CFLAGS) $(LIBNETFILTER_CONNTRACK_CFLAGS) +endif #ulogd_inpflow_IPFIX_la_SOURCES = ulogd_inpflow_IPFIX.c #ulogd_inpflow_IPFIX_la_LDFLAGS = -avoid-version -module
Signature · 1 line
1.7.10.4
PATCH 3/4 Add configure flag to disable NFLOG build
In reply to Eric Leblond--- configure.ac | 8 +++++++- input/packet/Makefile.am | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-)
configure.ac +7 -1
@@ -44,7 +44,13 @@ 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_LOG], [libnetfilter_log >= 1.0.0]) +AC_ARG_ENABLE(nflog, + AS_HELP_STRING([--enable-nflog], [Enable nflog module [default=yes]]),,[enable_nflog=yes]) +AS_IF([test "x$enable_nflog" = "xyes"], [ + PKG_CHECK_MODULES([LIBNETFILTER_LOG], [libnetfilter_log >= 1.0.0]) + AC_DEFINE([BUILD_NFLOG], [1], [Building nflog module]) +]) +AM_CONDITIONAL([BUILD_NFLOG], [test "x$enable_nflog" = "xyes"]) AC_ARG_ENABLE(nfct, AS_HELP_STRING([--enable-nfct], [Enable nfct module [default=yes]]),,[enable_nfct=yes]) AS_IF([test "x$enable_nfct" = "xyes"], [
input/packet/Makefile.am +4 -0
@@ -2,12 +2,16 @@ AM_CPPFLAGS = -I$(top_srcdir)/include AM_CFLAGS = ${regular_CFLAGS} +if BUILD_NFLOG pkglib_LTLIBRARIES = ulogd_inppkt_NFLOG.la ulogd_inppkt_ULOG.la \ ulogd_inppkt_UNIXSOCK.la ulogd_inppkt_NFLOG_la_SOURCES = ulogd_inppkt_NFLOG.c ulogd_inppkt_NFLOG_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_LOG_LIBS) ulogd_inppkt_NFLOG_la_CFLAGS = $(AM_CFLAGS) $(LIBNETFILTER_LOG_CFLAGS) +else +pkglib_LTLIBRARIES = ulogd_inppkt_ULOG.la ulogd_inppkt_UNIXSOCK.la +endif ulogd_inppkt_ULOG_la_SOURCES = ulogd_inppkt_ULOG.c ulogd_inppkt_ULOG_la_LDFLAGS = -avoid-version -module
Signature · 1 line
1.7.10.4
Re: [PATCH 3/4] Add configure flag to disable NFLOG build
input/packet/Makefile.am line 14
Quoted 11 lines · Eric Leblond
+if
BUILD_NFLOGpkglib_LTLIBRARIES= ulogd_inppkt_NFLOG.la ulogd_inppkt_ULOG.la \
ulogd_inppkt_UNIXSOCK.la
ulogd_inppkt_NFLOG_la_SOURCES=ulogd_inppkt_NFLOG.culogd_inppkt_NFLOG_la_LDFLAGS= -avoid-version -module $(LIBNETFILTER_LOG_LIBS)ulogd_inppkt_NFLOG_la_CFLAGS= $(AM_CFLAGS) $(LIBNETFILTER_LOG_CFLAGS)input/packet/Makefile.am +3
-0+else +pkglib_LTLIBRARIES = ulogd_inppkt_ULOG.la ulogd_inppkt_UNIXSOCK.la +endif
You can use
pkglib_LTLIBRARIES = ulogd_inppkt_ULOG.la ulogd_inppkt_UNIXSOCK.la if BUILD_NFLOG
pkglib_LTLIBRARIES += ulogd_inppkt_NFLOG.la
...
endif
So that ulogd_inppkt_ULOG.la ulogd_inppkt_UNIXSOCK.la does not have to be listed twice.
Re: [PATCH 3/4] Add configure flag to disable NFLOG build
Hi,
Quoted 16 lines · Jan Engelhardt
input/packet/Makefile.am line 14
Quoted 11 lines · Eric Leblond
+if
BUILD_NFLOGpkglib_LTLIBRARIES= ulogd_inppkt_NFLOG.la ulogd_inppkt_ULOG.la \
ulogd_inppkt_UNIXSOCK.la
ulogd_inppkt_NFLOG_la_SOURCES=ulogd_inppkt_NFLOG.culogd_inppkt_NFLOG_la_LDFLAGS= -avoid-version -module $(LIBNETFILTER_LOG_LIBS)ulogd_inppkt_NFLOG_la_CFLAGS= $(AM_CFLAGS) $(LIBNETFILTER_LOG_CFLAGS)input/packet/Makefile.am +3
-0+else +pkglib_LTLIBRARIES = ulogd_inppkt_ULOG.la ulogd_inppkt_UNIXSOCK.la +endifYou can use
Quoted 8 lines
pkglib_LTLIBRARIES= ulogd_inppkt_ULOG.la ulogd_inppkt_UNIXSOCK.la ifBUILD_NFLOG
pkglib_LTLIBRARIES+= ulogd_inppkt_NFLOG.la
...
endifSo that ulogd_inppkt_ULOG.la ulogd_inppkt_UNIXSOCK.la does not have to be listed twice.
You're right that's a better construction.
BR,
--
Eric
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/4 configure: display info about build plugins
In reply to Eric LeblondThis patch modifies configure to display the list of plugins that will be built.
--- configure.ac | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-)
configure.ac +40 -2
@@ -22,6 +22,11 @@ AC_SUBST([libdl_LIBS]) AC_SEARCH_LIBS([pcap_close], [pcap], [libpcap_LIBS="-lpcap"; LIBS=""]) AC_SUBST([libpcap_LIBS]) AM_CONDITIONAL([HAVE_PCAP], [test -n "$libpcap_LIBS"]) +if test "x$libpcap_LIBS" != "x"; then + enable_pcap="yes" +else + enable_pcap="no" +fi dnl Checks for header files. AC_HEADER_DIRENT
@@ -68,17 +73,35 @@ AM_CONDITIONAL([BUILD_NFACCT], [test "x$enable_nfacct" = "xyes"]) CT_CHECK_POSTGRES_DB() AM_CONDITIONAL(HAVE_PGSQL, test "x$PQLIBPATH" != "x") +if test "x$PQLIBPATH" != "x"; then + enable_pgsql="yes" +else + enable_pgsql="no" +fi CT_CHECK_MYSQL_DB() AM_CONDITIONAL(HAVE_MYSQL, test "x$MYSQL_LIB" != "x") +if test "x$MYSQL_LIB" != "x"; then + enable_mysql="yes" +else + enable_mysql="no" +fi PKG_CHECK_MODULES([libsqlite3], [sqlite3], [], [:]) AM_CONDITIONAL([HAVE_SQLITE3], [test -n "$libsqlite3_LIBS"]) +if test "x$libsqlite3_LIBS" != "x"; then + enable_sqlite3="yes" +else + enable_sqlite3="no" +fi CT_CHECK_DBI() AM_CONDITIONAL(HAVE_DBI, test "x$DBI_LIB" != "x") - - +if test "x$DBI_LIB" != "x"; then + enable_dbi="yes" +else + enable_dbi="no" +fi dnl AC_SUBST(DATABASE_DIR) dnl AC_SUBST(DATABASE_LIB)
@@ -102,3 +125,18 @@ AC_CONFIG_FILES(include/Makefile include/ulogd/Makefile include/libipulog/Makefi output/dbi/Makefile \ src/Makefile Makefile Rules.make) AC_OUTPUT + +echo " +Ulogd configuration: + Input plugins: + NFLOG plugin: ${enable_nflog} + NFCT plugin: ${enable_nfct} + NFACCT plugin: ${enable_nfacct} + Output plugins: + PCAP plugin: ${enable_pcap} + PGSQL plugin: ${enable_pgsql} + MySQL plugin: ${enable_mysql} + SQLITE3 plugin: ${enable_sqlite3} + DBI plugin: ${enable_dbi} +" +echo "You can now run 'make' and 'make install'"
Signature · 1 line
1.7.10.4