blob: b814ef08b00c2f18ac9658d115b197c57c9af3b0 [file] [log] [blame]
Jan Engelhardtf82070f2008-01-20 13:14:00 +00001
Pablo Neira Ayusoc16bdec2018-02-02 16:37:25 +01002AC_INIT([iptables], [1.6.2])
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 Ayuso7a0992d2016-07-24 12:45:53 +02005libxtables_vcurrent=12
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"],
Juergen Borleisf4b80ce2017-09-28 10:59:44 +020045 [enable_largefile="yes"])
46AS_IF([test "$enable_largefile" = "yes"], [largefile_cppflags='-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64'])
47
Jan Engelhardtf82070f2008-01-20 13:14:00 +000048AC_ARG_ENABLE([devel],
49 AS_HELP_STRING([--enable-devel],
Jan Engelhardt77f15382008-02-11 15:01:03 +010050 [Install Xtables development headers]),
51 [enable_devel="$enableval"], [enable_devel="yes"])
52AC_ARG_ENABLE([libipq],
Eric Leblondfe42fac2013-06-05 04:16:25 +020053 AS_HELP_STRING([--enable-libipq], [Build and install libipq]),
54 [enable_libipq="$enableval"], [enable_libipq="no"])
Willem de Bruijn1ac30c92013-03-12 05:44:12 +000055AC_ARG_ENABLE([bpf-compiler],
56 AS_HELP_STRING([--enable-bpf-compiler], [Build bpf compiler]),
Mike Frysingerb8b751b2015-08-15 14:13:35 -040057 [enable_bpfc="$enableval"], [enable_bpfc="no"])
Patrick McHardy9e6928f2013-08-28 09:32:44 +020058AC_ARG_ENABLE([nfsynproxy],
59 AS_HELP_STRING([--enable-nfsynproxy], [Build SYNPROXY configuration tool]),
Mike Frysingerb8b751b2015-08-15 14:13:35 -040060 [enable_nfsynproxy="$enableval"], [enable_nfsynproxy="no"])
Jan Engelhardt126c1362008-08-04 18:37:38 +020061AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
62 [Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]),
63 [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
Pablo Neira Ayuso38495862012-09-27 19:12:53 +020064AC_ARG_ENABLE([nftables],
Pablo Neira Ayuso9e48e502014-02-04 13:20:09 +010065 AS_HELP_STRING([--disable-nftables], [Do not build nftables compat]),
Pablo Neira Ayuso38495862012-09-27 19:12:53 +020066 [enable_nftables="$enableval"], [enable_nftables="yes"])
Shivani Bhardwaj3b7a2272016-03-22 10:43:06 +053067AC_ARG_ENABLE([connlabel],
68 AS_HELP_STRING([--disable-connlabel],
69 [Do not build libnetfilter_conntrack]),
70 [enable_connlabel="$enableval"], [enable_connlabel="yes"])
Lorenzo Colittib91af532017-03-14 17:55:50 +090071AC_ARG_WITH([xt-lock-name], AS_HELP_STRING([--with-xt-lock-name=PATH],
72 [Path to the xtables lock [[/run/xtables.lock]]]),
73 [xt_lock_name="$withval"],
74 [xt_lock_name="/run/xtables.lock"])
Jan Engelhardtf82070f2008-01-20 13:14:00 +000075
Jan Engelhardt655ae6b2010-09-13 16:06:50 +020076libiptc_LDFLAGS2="";
77AX_CHECK_LINKER_FLAGS([-Wl,--no-as-needed],
78 [libiptc_LDFLAGS2="-Wl,--no-as-needed"])
79AC_SUBST([libiptc_LDFLAGS2])
80
Jan Engelhardt79cefab2011-12-30 02:14:00 +010081AC_MSG_CHECKING([whether $LD knows -Wl,--no-undefined])
82saved_LDFLAGS="$LDFLAGS";
83LDFLAGS="-Wl,--no-undefined";
84AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {}])],
85 [noundef_LDFLAGS="$LDFLAGS"; AC_MSG_RESULT([yes])],
86 [AC_MSG_RESULT([no])]
87)
88LDFLAGS="$saved_LDFLAGS";
89
Mike Frysinger4ecdf832015-08-18 18:48:54 -040090blacklist_modules=""
91blacklist_x_modules=""
92blacklist_b_modules=""
93blacklist_a_modules=""
94blacklist_4_modules=""
95blacklist_6_modules=""
Hannes Ederc36d05e2010-07-23 12:51:26 +020096
Willem de Bruijnf17f9ac2016-12-08 17:09:38 -050097AC_CHECK_HEADERS([linux/dccp.h linux/ip_vs.h linux/magic.h linux/proc_fs.h linux/bpf.h])
Jan Engelhardt2c570e72008-06-05 19:54:48 +020098if test "$ac_cv_header_linux_dccp_h" != "yes"; then
99 blacklist_modules="$blacklist_modules dccp";
100fi;
Hannes Ederc36d05e2010-07-23 12:51:26 +0200101if test "$ac_cv_header_linux_ip_vs_h" != "yes"; then
102 blacklist_modules="$blacklist_modules ipvs";
103fi;
104
Jan Engelhardt4d8656a2011-07-22 12:25:43 +0200105AC_CHECK_SIZEOF([struct ip6_hdr], [], [#include <netinet/ip6.h>])
Jan Engelhardt2c570e72008-06-05 19:54:48 +0200106
Jan Engelhardtee3228a2008-06-23 11:37:08 +0200107AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = "yes"])
108AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = "yes"])
Jan Engelhardta094eb02009-04-03 22:37:49 +0200109AM_CONDITIONAL([ENABLE_IPV4], [test "$enable_ipv4" = "yes"])
Jan Engelhardt8e586132009-04-03 22:28:34 +0200110AM_CONDITIONAL([ENABLE_IPV6], [test "$enable_ipv6" = "yes"])
Karl Hiramoto967cb712010-05-10 17:50:41 +0200111AM_CONDITIONAL([ENABLE_LARGEFILE], [test "$enable_largefile" = "yes"])
Jan Engelhardtee3228a2008-06-23 11:37:08 +0200112AM_CONDITIONAL([ENABLE_DEVEL], [test "$enable_devel" = "yes"])
113AM_CONDITIONAL([ENABLE_LIBIPQ], [test "$enable_libipq" = "yes"])
Willem de Bruijn1ac30c92013-03-12 05:44:12 +0000114AM_CONDITIONAL([ENABLE_BPFC], [test "$enable_bpfc" = "yes"])
Patrick McHardy9e6928f2013-08-28 09:32:44 +0200115AM_CONDITIONAL([ENABLE_SYNCONF], [test "$enable_nfsynproxy" = "yes"])
Pablo Neira Ayuso38495862012-09-27 19:12:53 +0200116AM_CONDITIONAL([ENABLE_NFTABLES], [test "$enable_nftables" = "yes"])
Shivani Bhardwaj3b7a2272016-03-22 10:43:06 +0530117AM_CONDITIONAL([ENABLE_CONNLABEL], [test "$enable_connlabel" = "yes"])
Jan Engelhardtf82070f2008-01-20 13:14:00 +0000118
Patrick McHardy9e6928f2013-08-28 09:32:44 +0200119if test "x$enable_bpfc" = "xyes" || test "x$enable_nfsynproxy" = "xyes"; then
120 AC_CHECK_LIB(pcap, pcap_compile,, AC_MSG_ERROR(missing libpcap library required by bpf compiler or nfsynproxy tool))
Willem de Bruijnc18f2ce2013-07-21 20:02:38 -0400121fi
122
Jan Engelhardtdb6d0272010-03-27 12:48:55 +0100123PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0],
124 [nfnetlink=1], [nfnetlink=0])
125AM_CONDITIONAL([HAVE_LIBNFNETLINK], [test "$nfnetlink" = 1])
126
Pablo Neira Ayuso38e5ce62014-02-04 13:32:58 +0100127if test "x$enable_nftables" = "xyes"; then
128 PKG_CHECK_MODULES([libmnl], [libmnl >= 1.0], [mnl=1], [mnl=0])
129
Giuseppe Longo3d202e52016-04-26 21:27:58 +0200130 if test "$mnl" = 0;
131 then
132 echo "*** Error: No suitable libmnl found. ***"
133 echo " Please install the 'libmnl' package"
134 echo " Or consider --disable-nftables to skip"
135 echo " iptables-compat over nftables support."
136 exit 1
137 fi
138
Pablo Neira Ayuso742baab2015-09-15 16:37:32 +0200139 PKG_CHECK_MODULES([libnftnl], [libnftnl >= 1.0.5], [nftables=1], [nftables=0])
Pablo Neira Ayuso38e5ce62014-02-04 13:32:58 +0100140
Giuseppe Longo3d202e52016-04-26 21:27:58 +0200141 if test "$nftables" = 0;
142 then
143 echo "*** Error: no suitable libnftnl found. ***"
144 echo " Please install the 'libnftnl' package"
145 echo " Or consider --disable-nftables to skip"
146 echo " iptables-compat over nftables support."
147 exit 1
148 fi
149
Pablo Neira Ayuso38e5ce62014-02-04 13:32:58 +0100150 AM_PROG_LEX
151 AC_PROG_YACC
152
153 if test -z "$ac_cv_prog_YACC"
154 then
155 echo "*** Error: No suitable bison/yacc found. ***"
156 echo " Please install the 'bison' package."
157 exit 1
158 fi
159 if test -z "$ac_cv_prog_LEX"
160 then
161 echo "*** Error: No suitable flex/lex found. ***"
162 echo " Please install the 'flex' package."
163 exit 1
164 fi
Pablo Neira Ayuso38e5ce62014-02-04 13:32:58 +0100165fi
166
Pablo Neira Ayuso38495862012-09-27 19:12:53 +0200167AM_CONDITIONAL([HAVE_LIBMNL], [test "$mnl" = 1])
Tomasz Bursztykaa4e10982014-01-20 17:56:41 +0200168AM_CONDITIONAL([HAVE_LIBNFTNL], [test "$nftables" = 1])
Pablo Neira Ayuso38495862012-09-27 19:12:53 +0200169
Mike Frysinger4ecdf832015-08-18 18:48:54 -0400170if test "$nftables" != 1; then
171 blacklist_b_modules="$blacklist_b_modules limit mark nflog mangle"
172 blacklist_a_modules="$blacklist_a_modules mangle"
173fi
174
Shivani Bhardwaj3b7a2272016-03-22 10:43:06 +0530175if test "x$enable_connlabel" = "xyes"; then
176 PKG_CHECK_MODULES([libnetfilter_conntrack],
Pablo Neira Ayusoc4482052016-11-10 01:47:09 +0100177 [libnetfilter_conntrack >= 1.0.6],
Shivani Bhardwaj3b7a2272016-03-22 10:43:06 +0530178 [nfconntrack=1], [nfconntrack=0])
179
180 if test "$nfconntrack" -ne 1; then
181 blacklist_modules="$blacklist_modules connlabel";
182 echo "WARNING: libnetfilter_conntrack not found, connlabel match will not be built";
Shivani Bhardwaj6490f0b2016-06-23 01:11:39 +0530183 enable_connlabel="no";
Shivani Bhardwaj3b7a2272016-03-22 10:43:06 +0530184 fi;
185else
186 blacklist_modules="$blacklist_modules connlabel";
187fi;
188
189AM_CONDITIONAL([HAVE_LIBNETFILTER_CONNTRACK], [test "$nfconntrack" = 1])
190
Mike Frysinger4ecdf832015-08-18 18:48:54 -0400191AC_SUBST([blacklist_modules])
192AC_SUBST([blacklist_x_modules])
193AC_SUBST([blacklist_b_modules])
194AC_SUBST([blacklist_a_modules])
195AC_SUBST([blacklist_4_modules])
196AC_SUBST([blacklist_6_modules])
197
Jan Engelhardt8e336252011-06-01 02:16:05 +0200198regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
Jan Engelhardtf82070f2008-01-20 13:14:00 +0000199 -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes \
Jan Engelhardt8e336252011-06-01 02:16:05 +0200200 -Winline -pipe";
Lorenzo Colitti836846f2017-03-16 12:54:20 +0900201regular_CPPFLAGS="${largefile_cppflags} -D_REENTRANT \
Jan Engelhardt21b41ee2008-02-11 01:02:00 +0100202 -DXTABLES_LIBDIR=\\\"\${xtlibdir}\\\" -DXTABLES_INTERNAL";
Jan Engelhardt5085c3a2011-06-01 02:20:40 +0200203kinclude_CPPFLAGS="";
Jan Engelhardtca7cd662008-02-11 01:23:01 +0100204if [[ -n "$kbuilddir" ]]; then
Phil Oester59bbc592013-07-21 08:30:49 -0700205 kinclude_CPPFLAGS="$kinclude_CPPFLAGS -I$kbuilddir/include/uapi -I$kbuilddir/include";
Jan Engelhardtca7cd662008-02-11 01:23:01 +0100206fi;
207if [[ -n "$ksourcedir" ]]; then
Phil Oester59bbc592013-07-21 08:30:49 -0700208 kinclude_CPPFLAGS="$kinclude_CPPFLAGS -I$ksourcedir/include/uapi -I$ksourcedir/include";
Jan Engelhardtca7cd662008-02-11 01:23:01 +0100209fi;
Jan Engelhardtdb6d0272010-03-27 12:48:55 +0100210pkgdatadir='${datadir}/xtables';
Jan Engelhardtf82070f2008-01-20 13:14:00 +0000211
Eric Leblondfe42fac2013-06-05 04:16:25 +0200212define([EXPAND_VARIABLE],
213[$2=[$]$1
214if test $prefix = 'NONE'; then
215 prefix="/usr/local"
216fi
217while true; do
218 case "[$]$2" in
219 *\[$]* ) eval "$2=[$]$2" ;;
220 *) break ;;
221 esac
222done
223eval "$2=[$]$2"
224])dnl EXPAND_VARIABLE
225
Jan Engelhardtb95fc082008-04-15 09:13:17 +0200226AC_SUBST([regular_CFLAGS])
Jan Engelhardt8e336252011-06-01 02:16:05 +0200227AC_SUBST([regular_CPPFLAGS])
Jan Engelhardt79cefab2011-12-30 02:14:00 +0100228AC_SUBST([noundef_LDFLAGS])
Jan Engelhardt5085c3a2011-06-01 02:20:40 +0200229AC_SUBST([kinclude_CPPFLAGS])
Jan Engelhardtf82070f2008-01-20 13:14:00 +0000230AC_SUBST([kbuilddir])
231AC_SUBST([ksourcedir])
Jan Engelhardt21b41ee2008-02-11 01:02:00 +0100232AC_SUBST([xtlibdir])
Jan Engelhardt126c1362008-08-04 18:37:38 +0200233AC_SUBST([pkgconfigdir])
Jan Engelhardtdb6d0272010-03-27 12:48:55 +0100234AC_SUBST([pkgdatadir])
Jan Engelhardtdacafa52009-01-27 20:56:23 +0100235AC_SUBST([libxtables_vcurrent])
236AC_SUBST([libxtables_vage])
237libxtables_vmajor=$(($libxtables_vcurrent - $libxtables_vage));
238AC_SUBST([libxtables_vmajor])
Lorenzo Colitti836846f2017-03-16 12:54:20 +0900239
240AC_DEFINE_UNQUOTED([XT_LOCK_NAME], "${xt_lock_name}",
241 [Location of the iptables lock file])
Thomas Jaroschc634cb92008-06-03 15:02:18 +0200242
Jan Engelhardtf567ac92009-02-12 15:01:37 +0100243AC_CONFIG_FILES([Makefile extensions/GNUmakefile include/Makefile
Jan Engelhardt033e25a2011-06-07 14:02:37 +0200244 iptables/Makefile iptables/xtables.pc
Florian Westphalc25defa2013-07-14 19:32:12 +0200245 iptables/iptables.8 iptables/iptables-extensions.8.tmpl
Pablo Neira Ayuso74bd60b2013-08-22 13:11:45 +0200246 iptables/iptables-save.8 iptables/iptables-restore.8
247 iptables/iptables-apply.8 iptables/iptables-xml.1
Jan Engelhardt4982fe42011-08-08 02:38:41 +0200248 libipq/Makefile libipq/libipq.pc
Jan Engelhardtb8c42ec2011-12-18 02:52:15 +0100249 libiptc/Makefile libiptc/libiptc.pc
250 libiptc/libip4tc.pc libiptc/libip6tc.pc
251 libxtables/Makefile utils/Makefile
Phil Sutteraf468b62017-09-20 18:54:09 +0200252 include/xtables-version.h include/iptables/internal.h
253 utils/nfnl_osf.8])
Jan Engelhardt0086b8b2009-01-07 15:11:59 +0100254AC_OUTPUT
Eric Leblondfe42fac2013-06-05 04:16:25 +0200255
256
257EXPAND_VARIABLE(xtlibdir, e_xtlibdir)
258EXPAND_VARIABLE(pkgconfigdir, e_pkgconfigdir)
259
260echo "
261Iptables Configuration:
262 IPv4 support: ${enable_ipv4}
263 IPv6 support: ${enable_ipv6}
264 Devel support: ${enable_devel}
265 IPQ support: ${enable_libipq}
266 Large file support: ${enable_largefile}
267 BPF utils support: ${enable_bpfc}
Patrick McHardy9e6928f2013-08-28 09:32:44 +0200268 nfsynproxy util support: ${enable_nfsynproxy}
Pablo Neira Ayuso38495862012-09-27 19:12:53 +0200269 nftables support: ${enable_nftables}
Shivani Bhardwaj3b7a2272016-03-22 10:43:06 +0530270 connlabel support: ${enable_connlabel}
Eric Leblondfe42fac2013-06-05 04:16:25 +0200271
272Build parameters:
273 Put plugins into executable (static): ${enable_static}
274 Support plugins via dlopen (shared): ${enable_shared}
275 Installation prefix (--prefix): ${prefix}
276 Xtables extension directory: ${e_xtlibdir}
Lorenzo Colittib91af532017-03-14 17:55:50 +0900277 Pkg-config directory: ${e_pkgconfigdir}
278 Xtables lock file: ${xt_lock_name}"
Eric Leblondfe42fac2013-06-05 04:16:25 +0200279
280if [[ -n "$ksourcedir" ]]; then
281 echo " Kernel source directory: ${ksourcedir}"
282fi;
283if [[ -n "$kbuilddir" ]]; then
284 echo " Kernel build directory: ${kbuilddir}"
285fi;
286
287echo " Host: ${host}
288 GCC binary: ${CC}"
Florian Westphal51340f72013-07-15 16:35:08 +0200289
290test x"$blacklist_modules" = "x" || echo "
291Iptables modules that will not be built: $blacklist_modules"