blob: f8affedd51fb3327a7b505ab9a0001f9bc770660 [file] [log] [blame]
Jan Engelhardtf82070f2008-01-20 13:14:00 +00001
Pablo Neira Ayuso8643adc2013-08-06 17:48:43 +02002AC_INIT([iptables], [1.4.20])
Thomas Jaroschc634cb92008-06-03 15:02:18 +02003
Jan Engelhardtdacafa52009-01-27 20:56:23 +01004# See libtool.info "Libtool's versioning system"
Pablo Neira Ayusod1e79222013-01-04 20:27:11 +01005libxtables_vcurrent=10
Jan Engelhardt3e55c132013-02-05 14:47:02 +00006libxtables_vage=0
Jan Engelhardtdacafa52009-01-27 20:56:23 +01007
Jan Engelhardtde26cd22011-12-18 20:21:27 +01008AC_CONFIG_AUX_DIR([build-aux])
Jan Engelhardtf82070f2008-01-20 13:14:00 +00009AC_CONFIG_HEADERS([config.h])
Jan Engelhardt0086b8b2009-01-07 15:11:59 +010010AC_CONFIG_MACRO_DIR([m4])
Jan Engelhardtf82070f2008-01-20 13:14:00 +000011AC_PROG_INSTALL
Jan Engelhardt0086b8b2009-01-07 15:11:59 +010012AM_INIT_AUTOMAKE([-Wall])
Jan Engelhardtf82070f2008-01-20 13:14:00 +000013AC_PROG_CC
14AM_PROG_CC_C_O
15AC_DISABLE_STATIC
Jan Engelhardt053a4fd2012-08-31 04:06:38 +020016m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Jan Engelhardt0086b8b2009-01-07 15:11:59 +010017AM_PROG_LIBTOOL
Jan Engelhardtf82070f2008-01-20 13:14:00 +000018
Jan Engelhardtf82070f2008-01-20 13:14:00 +000019AC_ARG_WITH([kernel],
20 AS_HELP_STRING([--with-kernel=PATH],
21 [Path to kernel source/build directory]),
22 [kbuilddir="$withval"; ksourcedir="$withval";])
23AC_ARG_WITH([kbuild],
24 AS_HELP_STRING([--with-kbuild=PATH],
25 [Path to kernel build directory [[/lib/modules/CURRENT/build]]]),
26 [kbuilddir="$withval"])
27AC_ARG_WITH([ksource],
28 AS_HELP_STRING([--with-ksource=PATH],
29 [Path to kernel source directory [[/lib/modules/CURRENT/source]]]),
30 [ksourcedir="$withval"])
Jan Engelhardt21b41ee2008-02-11 01:02:00 +010031AC_ARG_WITH([xtlibdir],
32 AS_HELP_STRING([--with-xtlibdir=PATH],
Jan Engelhardtd31a6592008-02-11 14:11:14 +010033 [Path where to install Xtables extensions [[LIBEXECDIR/xtables]]]),
Jan Engelhardt21b41ee2008-02-11 01:02:00 +010034 [xtlibdir="$withval"],
Jan Engelhardt411a4e52011-07-04 12:44:43 +020035 [xtlibdir="${libdir}/xtables"])
Jan Engelhardta094eb02009-04-03 22:37:49 +020036AC_ARG_ENABLE([ipv4],
37 AS_HELP_STRING([--disable-ipv4], [Do not build iptables]),
38 [enable_ipv4="$enableval"], [enable_ipv4="yes"])
Jan Engelhardt8e586132009-04-03 22:28:34 +020039AC_ARG_ENABLE([ipv6],
40 AS_HELP_STRING([--disable-ipv6], [Do not build ip6tables]),
41 [enable_ipv6="$enableval"], [enable_ipv6="yes"])
Karl Hiramoto967cb712010-05-10 17:50:41 +020042AC_ARG_ENABLE([largefile],
43 AS_HELP_STRING([--disable-largefile], [Do not build largefile support]),
44 [enable_largefile="$enableval"],
45 [enable_largefile="yes";
Jan Engelhardt8e336252011-06-01 02:16:05 +020046 largefile_cppflags='-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64'])
Jan Engelhardtf82070f2008-01-20 13:14:00 +000047AC_ARG_ENABLE([devel],
48 AS_HELP_STRING([--enable-devel],
Jan Engelhardt77f15382008-02-11 15:01:03 +010049 [Install Xtables development headers]),
50 [enable_devel="$enableval"], [enable_devel="yes"])
51AC_ARG_ENABLE([libipq],
Eric Leblondfe42fac2013-06-05 04:16:25 +020052 AS_HELP_STRING([--enable-libipq], [Build and install libipq]),
53 [enable_libipq="$enableval"], [enable_libipq="no"])
Willem de Bruijn1ac30c92013-03-12 05:44:12 +000054AC_ARG_ENABLE([bpf-compiler],
55 AS_HELP_STRING([--enable-bpf-compiler], [Build bpf compiler]),
Eric Leblondfe42fac2013-06-05 04:16:25 +020056 [enable_bpfc="yes"], [enable_bpfc="no"])
Jan Engelhardt126c1362008-08-04 18:37:38 +020057AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
58 [Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]),
59 [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
Jan Engelhardtf82070f2008-01-20 13:14:00 +000060
Jan Engelhardt655ae6b2010-09-13 16:06:50 +020061libiptc_LDFLAGS2="";
62AX_CHECK_LINKER_FLAGS([-Wl,--no-as-needed],
63 [libiptc_LDFLAGS2="-Wl,--no-as-needed"])
64AC_SUBST([libiptc_LDFLAGS2])
65
Jan Engelhardt79cefab2011-12-30 02:14:00 +010066AC_MSG_CHECKING([whether $LD knows -Wl,--no-undefined])
67saved_LDFLAGS="$LDFLAGS";
68LDFLAGS="-Wl,--no-undefined";
69AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {}])],
70 [noundef_LDFLAGS="$LDFLAGS"; AC_MSG_RESULT([yes])],
71 [AC_MSG_RESULT([no])]
72)
73LDFLAGS="$saved_LDFLAGS";
74
Jan Engelhardt2c570e72008-06-05 19:54:48 +020075blacklist_modules="";
Hannes Ederc36d05e2010-07-23 12:51:26 +020076
Jan Engelhardt3c871012011-06-24 20:16:48 +020077AC_CHECK_HEADERS([linux/dccp.h linux/ip_vs.h linux/magic.h linux/proc_fs.h])
Jan Engelhardt2c570e72008-06-05 19:54:48 +020078if test "$ac_cv_header_linux_dccp_h" != "yes"; then
79 blacklist_modules="$blacklist_modules dccp";
80fi;
Hannes Ederc36d05e2010-07-23 12:51:26 +020081if test "$ac_cv_header_linux_ip_vs_h" != "yes"; then
82 blacklist_modules="$blacklist_modules ipvs";
83fi;
84
Florian Westphal51340f72013-07-15 16:35:08 +020085PKG_CHECK_MODULES([libnetfilter_conntrack], [libnetfilter_conntrack >= 1.0.4],
86 [nfconntrack=1], [nfconntrack=0])
87AM_CONDITIONAL([HAVE_LIBNETFILTER_CONNTRACK], [test "$nfconntrack" = 1])
88
89if test "$nfconntrack" -ne 1; then
90 blacklist_modules="$blacklist_modules connlabel";
91 echo "WARNING: libnetfilter_conntrack not found, connlabel match will not be built";
92fi;
93
Jan Engelhardt2c570e72008-06-05 19:54:48 +020094AC_SUBST([blacklist_modules])
Jan Engelhardt4d8656a2011-07-22 12:25:43 +020095AC_CHECK_SIZEOF([struct ip6_hdr], [], [#include <netinet/ip6.h>])
Jan Engelhardt2c570e72008-06-05 19:54:48 +020096
Jan Engelhardtee3228a2008-06-23 11:37:08 +020097AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = "yes"])
98AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = "yes"])
Jan Engelhardta094eb02009-04-03 22:37:49 +020099AM_CONDITIONAL([ENABLE_IPV4], [test "$enable_ipv4" = "yes"])
Jan Engelhardt8e586132009-04-03 22:28:34 +0200100AM_CONDITIONAL([ENABLE_IPV6], [test "$enable_ipv6" = "yes"])
Karl Hiramoto967cb712010-05-10 17:50:41 +0200101AM_CONDITIONAL([ENABLE_LARGEFILE], [test "$enable_largefile" = "yes"])
Jan Engelhardtee3228a2008-06-23 11:37:08 +0200102AM_CONDITIONAL([ENABLE_DEVEL], [test "$enable_devel" = "yes"])
103AM_CONDITIONAL([ENABLE_LIBIPQ], [test "$enable_libipq" = "yes"])
Willem de Bruijn1ac30c92013-03-12 05:44:12 +0000104AM_CONDITIONAL([ENABLE_BPFC], [test "$enable_bpfc" = "yes"])
Jan Engelhardtf82070f2008-01-20 13:14:00 +0000105
Willem de Bruijnc18f2ce2013-07-21 20:02:38 -0400106if test "x$enable_bpfc" = "xyes"; then
107 AC_CHECK_LIB(pcap, pcap_compile,, AC_MSG_ERROR(missing libpcap library required by bpf compiler))
108fi
109
Jan Engelhardtdb6d0272010-03-27 12:48:55 +0100110PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0],
111 [nfnetlink=1], [nfnetlink=0])
112AM_CONDITIONAL([HAVE_LIBNFNETLINK], [test "$nfnetlink" = 1])
113
Jan Engelhardt8e336252011-06-01 02:16:05 +0200114regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
Jan Engelhardtf82070f2008-01-20 13:14:00 +0000115 -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes \
Jan Engelhardt8e336252011-06-01 02:16:05 +0200116 -Winline -pipe";
117regular_CPPFLAGS="${largefile_cppflags} -D_REENTRANT \
Jan Engelhardt21b41ee2008-02-11 01:02:00 +0100118 -DXTABLES_LIBDIR=\\\"\${xtlibdir}\\\" -DXTABLES_INTERNAL";
Jan Engelhardt5085c3a2011-06-01 02:20:40 +0200119kinclude_CPPFLAGS="";
Jan Engelhardtca7cd662008-02-11 01:23:01 +0100120if [[ -n "$kbuilddir" ]]; then
Phil Oester59bbc592013-07-21 08:30:49 -0700121 kinclude_CPPFLAGS="$kinclude_CPPFLAGS -I$kbuilddir/include/uapi -I$kbuilddir/include";
Jan Engelhardtca7cd662008-02-11 01:23:01 +0100122fi;
123if [[ -n "$ksourcedir" ]]; then
Phil Oester59bbc592013-07-21 08:30:49 -0700124 kinclude_CPPFLAGS="$kinclude_CPPFLAGS -I$ksourcedir/include/uapi -I$ksourcedir/include";
Jan Engelhardtca7cd662008-02-11 01:23:01 +0100125fi;
Jan Engelhardtdb6d0272010-03-27 12:48:55 +0100126pkgdatadir='${datadir}/xtables';
Jan Engelhardtf82070f2008-01-20 13:14:00 +0000127
Eric Leblondfe42fac2013-06-05 04:16:25 +0200128define([EXPAND_VARIABLE],
129[$2=[$]$1
130if test $prefix = 'NONE'; then
131 prefix="/usr/local"
132fi
133while true; do
134 case "[$]$2" in
135 *\[$]* ) eval "$2=[$]$2" ;;
136 *) break ;;
137 esac
138done
139eval "$2=[$]$2"
140])dnl EXPAND_VARIABLE
141
Jan Engelhardtb95fc082008-04-15 09:13:17 +0200142AC_SUBST([regular_CFLAGS])
Jan Engelhardt8e336252011-06-01 02:16:05 +0200143AC_SUBST([regular_CPPFLAGS])
Jan Engelhardt79cefab2011-12-30 02:14:00 +0100144AC_SUBST([noundef_LDFLAGS])
Jan Engelhardt5085c3a2011-06-01 02:20:40 +0200145AC_SUBST([kinclude_CPPFLAGS])
Jan Engelhardtf82070f2008-01-20 13:14:00 +0000146AC_SUBST([kbuilddir])
147AC_SUBST([ksourcedir])
Jan Engelhardt21b41ee2008-02-11 01:02:00 +0100148AC_SUBST([xtlibdir])
Jan Engelhardt126c1362008-08-04 18:37:38 +0200149AC_SUBST([pkgconfigdir])
Jan Engelhardtdb6d0272010-03-27 12:48:55 +0100150AC_SUBST([pkgdatadir])
Jan Engelhardtdacafa52009-01-27 20:56:23 +0100151AC_SUBST([libxtables_vcurrent])
152AC_SUBST([libxtables_vage])
153libxtables_vmajor=$(($libxtables_vcurrent - $libxtables_vage));
154AC_SUBST([libxtables_vmajor])
Thomas Jaroschc634cb92008-06-03 15:02:18 +0200155
Jan Engelhardtf567ac92009-02-12 15:01:37 +0100156AC_CONFIG_FILES([Makefile extensions/GNUmakefile include/Makefile
Jan Engelhardt033e25a2011-06-07 14:02:37 +0200157 iptables/Makefile iptables/xtables.pc
Andy Spencer14bca552013-05-19 17:01:06 +0000158 iptables/iptables.8 iptables/ip6tables.8
159 iptables/iptables-extensions.8.tmpl
Jan Engelhardt4982fe42011-08-08 02:38:41 +0200160 libipq/Makefile libipq/libipq.pc
Jan Engelhardtb8c42ec2011-12-18 02:52:15 +0100161 libiptc/Makefile libiptc/libiptc.pc
162 libiptc/libip4tc.pc libiptc/libip6tc.pc
163 libxtables/Makefile utils/Makefile
Jan Engelhardtdf60a302012-08-31 03:59:07 +0200164 include/xtables-version.h include/iptables/internal.h])
Jan Engelhardt0086b8b2009-01-07 15:11:59 +0100165AC_OUTPUT
Eric Leblondfe42fac2013-06-05 04:16:25 +0200166
167
168EXPAND_VARIABLE(xtlibdir, e_xtlibdir)
169EXPAND_VARIABLE(pkgconfigdir, e_pkgconfigdir)
170
171echo "
172Iptables Configuration:
173 IPv4 support: ${enable_ipv4}
174 IPv6 support: ${enable_ipv6}
175 Devel support: ${enable_devel}
176 IPQ support: ${enable_libipq}
177 Large file support: ${enable_largefile}
178 BPF utils support: ${enable_bpfc}
179
180Build parameters:
181 Put plugins into executable (static): ${enable_static}
182 Support plugins via dlopen (shared): ${enable_shared}
183 Installation prefix (--prefix): ${prefix}
184 Xtables extension directory: ${e_xtlibdir}
185 Pkg-config directory: ${e_pkgconfigdir}"
186
187if [[ -n "$ksourcedir" ]]; then
188 echo " Kernel source directory: ${ksourcedir}"
189fi;
190if [[ -n "$kbuilddir" ]]; then
191 echo " Kernel build directory: ${kbuilddir}"
192fi;
193
194echo " Host: ${host}
195 GCC binary: ${CC}"
Florian Westphal51340f72013-07-15 16:35:08 +0200196
197test x"$blacklist_modules" = "x" || echo "
198Iptables modules that will not be built: $blacklist_modules"