1
2AC_INIT([iptables], [1.4.20])
3
4# See libtool.info "Libtool's versioning system"
5libxtables_vcurrent=10
6libxtables_vage=0
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";
46	largefile_cppflags='-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64'])
47AC_ARG_ENABLE([devel],
48	AS_HELP_STRING([--enable-devel],
49	[Install Xtables development headers]),
50	[enable_devel="$enableval"], [enable_devel="yes"])
51AC_ARG_ENABLE([libipq],
52	AS_HELP_STRING([--enable-libipq], [Build and install libipq]),
53	[enable_libipq="$enableval"], [enable_libipq="no"])
54AC_ARG_ENABLE([bpf-compiler],
55	AS_HELP_STRING([--enable-bpf-compiler], [Build bpf compiler]),
56	[enable_bpfc="yes"], [enable_bpfc="no"])
57AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
58	[Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]),
59	[pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
60
61libiptc_LDFLAGS2="";
62AX_CHECK_LINKER_FLAGS([-Wl,--no-as-needed],
63	[libiptc_LDFLAGS2="-Wl,--no-as-needed"])
64AC_SUBST([libiptc_LDFLAGS2])
65
66AC_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
75blacklist_modules="";
76
77AC_CHECK_HEADERS([linux/dccp.h linux/ip_vs.h linux/magic.h linux/proc_fs.h])
78if test "$ac_cv_header_linux_dccp_h" != "yes"; then
79	blacklist_modules="$blacklist_modules dccp";
80fi;
81if test "$ac_cv_header_linux_ip_vs_h" != "yes"; then
82	blacklist_modules="$blacklist_modules ipvs";
83fi;
84
85PKG_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
94AC_SUBST([blacklist_modules])
95AC_CHECK_SIZEOF([struct ip6_hdr], [], [#include <netinet/ip6.h>])
96
97AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = "yes"])
98AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = "yes"])
99AM_CONDITIONAL([ENABLE_IPV4], [test "$enable_ipv4" = "yes"])
100AM_CONDITIONAL([ENABLE_IPV6], [test "$enable_ipv6" = "yes"])
101AM_CONDITIONAL([ENABLE_LARGEFILE], [test "$enable_largefile" = "yes"])
102AM_CONDITIONAL([ENABLE_DEVEL], [test "$enable_devel" = "yes"])
103AM_CONDITIONAL([ENABLE_LIBIPQ], [test "$enable_libipq" = "yes"])
104AM_CONDITIONAL([ENABLE_BPFC], [test "$enable_bpfc" = "yes"])
105
106if 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
110PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0],
111	[nfnetlink=1], [nfnetlink=0])
112AM_CONDITIONAL([HAVE_LIBNFNETLINK], [test "$nfnetlink" = 1])
113
114regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
115	-Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes \
116	-Winline -pipe";
117regular_CPPFLAGS="${largefile_cppflags} -D_REENTRANT \
118	-DXTABLES_LIBDIR=\\\"\${xtlibdir}\\\" -DXTABLES_INTERNAL";
119kinclude_CPPFLAGS="";
120if [[ -n "$kbuilddir" ]]; then
121	kinclude_CPPFLAGS="$kinclude_CPPFLAGS -I$kbuilddir/include/uapi -I$kbuilddir/include";
122fi;
123if [[ -n "$ksourcedir" ]]; then
124	kinclude_CPPFLAGS="$kinclude_CPPFLAGS -I$ksourcedir/include/uapi -I$ksourcedir/include";
125fi;
126pkgdatadir='${datadir}/xtables';
127
128define([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
142AC_SUBST([regular_CFLAGS])
143AC_SUBST([regular_CPPFLAGS])
144AC_SUBST([noundef_LDFLAGS])
145AC_SUBST([kinclude_CPPFLAGS])
146AC_SUBST([kbuilddir])
147AC_SUBST([ksourcedir])
148AC_SUBST([xtlibdir])
149AC_SUBST([pkgconfigdir])
150AC_SUBST([pkgdatadir])
151AC_SUBST([libxtables_vcurrent])
152AC_SUBST([libxtables_vage])
153libxtables_vmajor=$(($libxtables_vcurrent - $libxtables_vage));
154AC_SUBST([libxtables_vmajor])
155
156AC_CONFIG_FILES([Makefile extensions/GNUmakefile include/Makefile
157	iptables/Makefile iptables/xtables.pc
158	iptables/iptables.8 iptables/ip6tables.8
159	iptables/iptables-extensions.8.tmpl
160	libipq/Makefile libipq/libipq.pc
161	libiptc/Makefile libiptc/libiptc.pc
162	libiptc/libip4tc.pc libiptc/libip6tc.pc
163	libxtables/Makefile utils/Makefile
164	include/xtables-version.h include/iptables/internal.h])
165AC_OUTPUT
166
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}"
196
197test x"$blacklist_modules" = "x" || echo "
198Iptables modules that will not be built: $blacklist_modules"
199