• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2AC_INIT([iptables], [1.8.7])
3
4# See libtool.info "Libtool's versioning system"
5libxtables_vcurrent=16
6libxtables_vage=4
7
8AC_CONFIG_AUX_DIR([build-aux])
9AC_CONFIG_HEADERS([config.h])
10AC_CONFIG_MACRO_DIR([m4])
11AC_PROG_INSTALL
12AM_INIT_AUTOMAKE([-Wall])
13AC_PROG_CC
14AM_PROG_CC_C_O
15AC_DISABLE_STATIC
16m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
17AM_PROG_LIBTOOL
18
19AC_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"])
31AC_ARG_WITH([xtlibdir],
32	AS_HELP_STRING([--with-xtlibdir=PATH],
33	[Path where to install Xtables extensions [[LIBEXECDIR/xtables]]]),
34	[xtlibdir="$withval"],
35	[xtlibdir="${libdir}/xtables"])
36AC_ARG_ENABLE([ipv4],
37	AS_HELP_STRING([--disable-ipv4], [Do not build iptables]),
38	[enable_ipv4="$enableval"], [enable_ipv4="yes"])
39AC_ARG_ENABLE([ipv6],
40	AS_HELP_STRING([--disable-ipv6], [Do not build ip6tables]),
41	[enable_ipv6="$enableval"], [enable_ipv6="yes"])
42AC_ARG_ENABLE([largefile],
43	AS_HELP_STRING([--disable-largefile], [Do not build largefile support]),
44	[enable_largefile="$enableval"],
45	[enable_largefile="yes"])
46AS_IF([test "$enable_largefile" = "yes"], [largefile_cppflags='-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64'])
47
48AC_ARG_ENABLE([devel],
49	AS_HELP_STRING([--enable-devel],
50	[Install Xtables development headers]),
51	[enable_devel="$enableval"], [enable_devel="yes"])
52AC_ARG_ENABLE([libipq],
53	AS_HELP_STRING([--enable-libipq], [Build and install libipq]),
54	[enable_libipq="$enableval"], [enable_libipq="no"])
55AC_ARG_ENABLE([bpf-compiler],
56	AS_HELP_STRING([--enable-bpf-compiler], [Build bpf compiler]),
57	[enable_bpfc="$enableval"], [enable_bpfc="no"])
58AC_ARG_ENABLE([nfsynproxy],
59	AS_HELP_STRING([--enable-nfsynproxy], [Build SYNPROXY configuration tool]),
60	[enable_nfsynproxy="$enableval"], [enable_nfsynproxy="no"])
61AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
62	[Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]),
63	[pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
64AC_ARG_ENABLE([nftables],
65	AS_HELP_STRING([--disable-nftables], [Do not build nftables compat]),
66	[enable_nftables="$enableval"], [enable_nftables="yes"])
67AC_ARG_ENABLE([connlabel],
68	AS_HELP_STRING([--disable-connlabel],
69	[Do not build libnetfilter_conntrack]),
70	[enable_connlabel="$enableval"], [enable_connlabel="yes"])
71AC_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"])
75
76AC_MSG_CHECKING([whether $LD knows -Wl,--no-undefined])
77saved_LDFLAGS="$LDFLAGS";
78LDFLAGS="-Wl,--no-undefined";
79AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {}])],
80	[noundef_LDFLAGS="$LDFLAGS"; AC_MSG_RESULT([yes])],
81	[AC_MSG_RESULT([no])]
82)
83LDFLAGS="$saved_LDFLAGS";
84
85blacklist_modules=""
86blacklist_x_modules=""
87blacklist_b_modules=""
88blacklist_a_modules=""
89blacklist_4_modules=""
90blacklist_6_modules=""
91
92AC_CHECK_HEADERS([linux/dccp.h linux/ip_vs.h linux/magic.h linux/proc_fs.h linux/bpf.h])
93if test "$ac_cv_header_linux_dccp_h" != "yes"; then
94	blacklist_modules="$blacklist_modules dccp";
95fi;
96if test "$ac_cv_header_linux_ip_vs_h" != "yes"; then
97	blacklist_modules="$blacklist_modules ipvs";
98fi;
99
100AC_CHECK_SIZEOF([struct ip6_hdr], [], [#include <netinet/ip6.h>])
101
102AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = "yes"])
103AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = "yes"])
104AM_CONDITIONAL([ENABLE_IPV4], [test "$enable_ipv4" = "yes"])
105AM_CONDITIONAL([ENABLE_IPV6], [test "$enable_ipv6" = "yes"])
106AM_CONDITIONAL([ENABLE_LARGEFILE], [test "$enable_largefile" = "yes"])
107AM_CONDITIONAL([ENABLE_DEVEL], [test "$enable_devel" = "yes"])
108AM_CONDITIONAL([ENABLE_LIBIPQ], [test "$enable_libipq" = "yes"])
109AM_CONDITIONAL([ENABLE_BPFC], [test "$enable_bpfc" = "yes"])
110AM_CONDITIONAL([ENABLE_SYNCONF], [test "$enable_nfsynproxy" = "yes"])
111AM_CONDITIONAL([ENABLE_NFTABLES], [test "$enable_nftables" = "yes"])
112AM_CONDITIONAL([ENABLE_CONNLABEL], [test "$enable_connlabel" = "yes"])
113
114if test "x$enable_bpfc" = "xyes" || test "x$enable_nfsynproxy" = "xyes"; then
115	AC_CHECK_LIB(pcap, pcap_compile,, AC_MSG_ERROR(missing libpcap library required by bpf compiler or nfsynproxy tool))
116fi
117
118PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0],
119	[nfnetlink=1], [nfnetlink=0])
120AM_CONDITIONAL([HAVE_LIBNFNETLINK], [test "$nfnetlink" = 1])
121
122if test "x$enable_nftables" = "xyes"; then
123	PKG_CHECK_MODULES([libmnl], [libmnl >= 1.0], [mnl=1], [mnl=0])
124
125	if test "$mnl" = 0;
126	then
127		echo "*** Error: No suitable libmnl found. ***"
128		echo "    Please install the 'libmnl' package"
129		echo "    Or consider --disable-nftables to skip"
130		echo "    iptables-compat over nftables support."
131		exit 1
132	fi
133
134	PKG_CHECK_MODULES([libnftnl], [libnftnl >= 1.1.6], [nftables=1], [nftables=0])
135
136	if test "$nftables" = 0;
137	then
138		echo "*** Error: no suitable libnftnl found. ***"
139		echo "    Please install the 'libnftnl' package"
140		echo "    Or consider --disable-nftables to skip"
141		echo "    iptables-compat over nftables support."
142		exit 1
143	fi
144fi
145
146AM_CONDITIONAL([HAVE_LIBMNL], [test "$mnl" = 1])
147AM_CONDITIONAL([HAVE_LIBNFTNL], [test "$nftables" = 1])
148
149if test "$nftables" != 1; then
150	blacklist_b_modules="$blacklist_b_modules limit mark nflog mangle"
151	blacklist_a_modules="$blacklist_a_modules mangle"
152fi
153
154if test "x$enable_connlabel" = "xyes"; then
155	PKG_CHECK_MODULES([libnetfilter_conntrack],
156		[libnetfilter_conntrack >= 1.0.6],
157		[nfconntrack=1], [nfconntrack=0])
158
159	if test "$nfconntrack" -ne 1; then
160		blacklist_modules="$blacklist_modules connlabel";
161		echo "WARNING: libnetfilter_conntrack not found, connlabel match will not be built";
162		enable_connlabel="no";
163	fi;
164else
165	blacklist_modules="$blacklist_modules connlabel";
166fi;
167
168AM_CONDITIONAL([HAVE_LIBNETFILTER_CONNTRACK], [test "$nfconntrack" = 1])
169
170AC_SUBST([blacklist_modules])
171AC_SUBST([blacklist_x_modules])
172AC_SUBST([blacklist_b_modules])
173AC_SUBST([blacklist_a_modules])
174AC_SUBST([blacklist_4_modules])
175AC_SUBST([blacklist_6_modules])
176
177regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
178	-Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes \
179	-Wlogical-op \
180	-Winline -pipe";
181regular_CPPFLAGS="${largefile_cppflags} -D_REENTRANT \
182	-DXTABLES_LIBDIR=\\\"\${xtlibdir}\\\" -DXTABLES_INTERNAL";
183kinclude_CPPFLAGS="";
184if [[ -n "$kbuilddir" ]]; then
185	kinclude_CPPFLAGS="$kinclude_CPPFLAGS -I$kbuilddir/include/uapi -I$kbuilddir/include";
186fi;
187if [[ -n "$ksourcedir" ]]; then
188	kinclude_CPPFLAGS="$kinclude_CPPFLAGS -I$ksourcedir/include/uapi -I$ksourcedir/include";
189fi;
190pkgdatadir='${datadir}/xtables';
191
192define([EXPAND_VARIABLE],
193[$2=[$]$1
194if test $prefix = 'NONE'; then
195	prefix="/usr/local"
196fi
197while true; do
198  case "[$]$2" in
199    *\[$]* ) eval "$2=[$]$2" ;;
200    *) break ;;
201  esac
202done
203eval "$2=[$]$2"
204])dnl EXPAND_VARIABLE
205
206AC_SUBST([regular_CFLAGS])
207AC_SUBST([regular_CPPFLAGS])
208AC_SUBST([noundef_LDFLAGS])
209AC_SUBST([kinclude_CPPFLAGS])
210AC_SUBST([kbuilddir])
211AC_SUBST([ksourcedir])
212AC_SUBST([xtlibdir])
213AC_SUBST([pkgconfigdir])
214AC_SUBST([pkgdatadir])
215AC_SUBST([libxtables_vcurrent])
216AC_SUBST([libxtables_vage])
217libxtables_vmajor=$(($libxtables_vcurrent - $libxtables_vage));
218AC_SUBST([libxtables_vmajor])
219
220AC_DEFINE_UNQUOTED([XT_LOCK_NAME], "${xt_lock_name}",
221	[Location of the iptables lock file])
222AC_SUBST([XT_LOCK_NAME], "${xt_lock_name}")
223
224AC_CONFIG_FILES([Makefile extensions/GNUmakefile include/Makefile
225	iptables/Makefile iptables/xtables.pc
226	iptables/iptables.8 iptables/iptables-extensions.8.tmpl
227	iptables/iptables-save.8 iptables/iptables-restore.8
228	iptables/iptables-apply.8 iptables/iptables-xml.1
229	libipq/Makefile libipq/libipq.pc
230	libiptc/Makefile libiptc/libiptc.pc
231	libiptc/libip4tc.pc libiptc/libip6tc.pc
232	libxtables/Makefile utils/Makefile
233	include/xtables-version.h
234	iptables/xtables-monitor.8
235	utils/nfnl_osf.8
236	utils/nfbpf_compile.8])
237AC_OUTPUT
238
239
240EXPAND_VARIABLE(xtlibdir, e_xtlibdir)
241EXPAND_VARIABLE(pkgconfigdir, e_pkgconfigdir)
242
243echo "
244Iptables Configuration:
245  IPv4 support:				${enable_ipv4}
246  IPv6 support:				${enable_ipv6}
247  Devel support:			${enable_devel}
248  IPQ support:				${enable_libipq}
249  Large file support:			${enable_largefile}
250  BPF utils support:			${enable_bpfc}
251  nfsynproxy util support:		${enable_nfsynproxy}
252  nftables support:			${enable_nftables}
253  connlabel support:			${enable_connlabel}
254
255Build parameters:
256  Put plugins into executable (static):	${enable_static}
257  Support plugins via dlopen (shared):	${enable_shared}
258  Installation prefix (--prefix):	${prefix}
259  Xtables extension directory:		${e_xtlibdir}
260  Pkg-config directory:			${e_pkgconfigdir}
261  Xtables lock file:			${xt_lock_name}"
262
263if [[ -n "$ksourcedir" ]]; then
264	echo "  Kernel source directory:		${ksourcedir}"
265fi;
266if [[ -n "$kbuilddir" ]]; then
267	echo "  Kernel build directory:		${kbuilddir}"
268fi;
269
270echo "  Host:					${host}
271  GCC binary:				${CC}"
272
273test x"$blacklist_modules" = "x" || echo "
274Iptables modules that will not be built: $blacklist_modules"
275