From: Florian Forster Date: Thu, 17 Sep 2009 06:44:07 +0000 (+0200) Subject: Build system: Improve detection of the iptc library. X-Git-Tag: collectd-4.7.4~13 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a690e4ac74e05f7294c22df8e0574e5e6f52f510;p=collectd.git Build system: Improve detection of the iptc library. When checking for the iptc headers and data types, the configure script added the kernel directory to the CFLAGS. Later, when actually building the iptables plugin, the CFLAGS were left untouched. At least on Debian, the “real” kernel headers are not required – the libc versions in /usr/include/linux are sufficient. The usage of KERNEL_DIR has therefore been removed from the iptc checks. In addition, an directory specified by “--with-libiptc=/path” is no longer added to the global CFLAGS but rather to the iptables specific CPPFLAGS. Hopefully this resolved build problems on various platforms. --- diff --git a/configure.in b/configure.in index 2471a2f1..9f26be3b 100644 --- a/configure.in +++ b/configure.in @@ -1434,8 +1434,8 @@ AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to l with_libiptc="yes" else if test "x$withval" != "xno" && test "x$withval" != "xyes" then - LDFLAGS="$LDFLAGS -L$withval/lib" - CPPFLAGS="$CPPFLAGS -I$withval/include" + LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS -I$withval/include" + LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS -L$withval/lib" with_libiptc="yes" else with_libiptc="$withval" @@ -1473,8 +1473,8 @@ then fi if test "x$with_libiptc" = "xyes" then - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $KERNEL_CFLAGS" + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS" AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [], [ @@ -1485,18 +1485,12 @@ then #include "$srcdir/src/owniptc/ipt_kernel_headers.h" ]) - CFLAGS="$SAVE_CFLAGS" -fi -AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes") -AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes") -if test "x$with_own_libiptc" = "xyes" -then - AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.]) + CPPFLAGS="$SAVE_CPPFLAGS" fi if test "x$with_libiptc" = "xyes" then - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $KERNEL_CFLAGS" + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS" AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [], [ @@ -1509,7 +1503,20 @@ then #endif ]) - CFLAGS="$SAVE_CFLAGS" + CPPFLAGS="$SAVE_CPPFLAGS" +fi +AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes") +AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes") +if test "x$with_libiptc" = "xyes" +then + BUILD_WITH_LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS" + BUILD_WITH_LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS" + AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS) +fi +if test "x$with_own_libiptc" = "xyes" +then + AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.]) fi # }}} diff --git a/src/Makefile.am b/src/Makefile.am index 42b97f8d..7b13029d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -356,7 +356,8 @@ endif # BUILD_PLUGIN_INTERFACE if BUILD_PLUGIN_IPTABLES pkglib_LTLIBRARIES += iptables.la iptables_la_SOURCES = iptables.c -iptables_la_LDFLAGS = -module -avoid-version +iptables_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBIPTC_CPPFLAGS) +iptables_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_LIBIPTC_LDFLAGS) if BUILD_WITH_OWN_LIBIPTC iptables_la_LIBADD = owniptc/libiptc.la iptables_la_DEPENDENCIES = owniptc/libiptc.la