Code

Build system: Further improve libiptc handling.
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Thu, 17 Sep 2009 07:36:35 +0000 (09:36 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Thu, 17 Sep 2009 07:36:35 +0000 (09:36 +0200)
Only check for “iptc_handle_t” and “ip6tc_handle_t” if using a
system-wide version of libiptc. If we use the shipped version, we *know*
it provides these types.

configure.in
src/iptables.c

index 9f26be3b8d5dbcbafafc10f62296e055dabbb561..092fbd023304833da2fb485dc8d1ef7ba7b15b10 100644 (file)
@@ -1449,16 +1449,21 @@ AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to l
                with_libiptc="no (Linux only)"
        fi
 ])
-if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
+SAVE_CPPFLAGS="$CPPFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
+CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS"
+LDFLAGS="$LDFLAGS $LIBIPTC_LDFLAGS"
+if test "x$with_libiptc" = "xyes"
 then
-       AC_CHECK_LIB(iptc, iptc_init,
+       AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
        [
-               AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
+               with_libiptc="no (Linux iptables headers not found)"
+               with_own_libiptc="no"
        ],
        [
-               with_libiptc="yes"
-               with_own_libiptc="yes"
+#include "$srcdir/src/owniptc/ipt_kernel_headers.h"
        ])
+
 fi
 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
 then
@@ -1471,27 +1476,8 @@ then
                with_own_libiptc="yes"
        ])
 fi
-if test "x$with_libiptc" = "xyes"
-then
-       SAVE_CPPFLAGS="$CPPFLAGS"
-       CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS"
-
-       AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
-       [
-               with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
-               with_own_libiptc="no"
-       ],
-       [
-#include "$srcdir/src/owniptc/ipt_kernel_headers.h"
-       ])
-
-       CPPFLAGS="$SAVE_CPPFLAGS"
-fi
-if test "x$with_libiptc" = "xyes"
+if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
 then
-       SAVE_CPPFLAGS="$CPPFLAGS"
-       CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS"
-
        AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [],
        [
 #if OWN_LIBIPTC
@@ -1502,8 +1488,17 @@ then
 # include <libiptc/libip6tc.h>
 #endif
        ])
-
-       CPPFLAGS="$SAVE_CPPFLAGS"
+fi
+if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
+then
+       AC_CHECK_LIB(iptc, iptc_init,
+       [
+               AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
+       ],
+       [
+               with_libiptc="yes"
+               with_own_libiptc="yes"
+       ])
 fi
 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
@@ -1518,6 +1513,8 @@ if test "x$with_own_libiptc" = "xyes"
 then
        AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
 fi
+CPPFLAGS="$SAVE_CPPFLAGS"
+LDFLAGS="$SAVE_LDFLAGS"
 # }}}
 
 # --with-java {{{
index 69cd39c48758f352d548764cd20b76f8617153b5..aa53074a641aae4acf9b8d98e0f6907591f04904 100644 (file)
 #if OWN_LIBIPTC
 # include "owniptc/libiptc.h"
 # include "owniptc/libip6tc.h"
-#else
+
+# define HAVE_IPTC_HANDLE_T 1
+# define HAVE_IP6TC_HANDLE_T 1
+
+#else /* if !OWN_LIBIPTC */
 # include <libiptc/libiptc.h>
 # include <libiptc/libip6tc.h>
-#endif
 
 /*
  * iptc_handle_t was available before libiptc was officially available as a
  * this is somewhat hacky, I didn't find better way to solve that :-/
  * -tokkee
  */
-#ifndef HAVE_IPTC_HANDLE_T
+# ifndef HAVE_IPTC_HANDLE_T
 typedef struct iptc_handle iptc_handle_t;
-#endif
-#ifndef HAVE_IP6TC_HANDLE_T
+# endif
+# ifndef HAVE_IP6TC_HANDLE_T
 typedef struct ip6tc_handle ip6tc_handle_t;
-#endif
+# endif
+#endif /* !OWN_LIBIPTC */
 
 /*
  * (Module-)Global variables