configure.ac revision 51340f7b6a1103b12d86ef488f7140406d80401e
1
2AC_INIT([iptables], [1.4.19.1])
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
106PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0],
107	[nfnetlink=1], [nfnetlink=0])
108AM_CONDITIONAL([HAVE_LIBNFNETLINK], [test "$nfnetlink" = 1])
109
110regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
111	-Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes \
112	-Winline -pipe";
113regular_CPPFLAGS="${largefile_cppflags} -D_REENTRANT \
114	-DXTABLES_LIBDIR=\\\"\${xtlibdir}\\\" -DXTABLES_INTERNAL";
115kinclude_CPPFLAGS="";
116if [[ -n "$kbuilddir" ]]; then
117	kinclude_CPPFLAGS="$kinclude_CPPFLAGS -I$kbuilddir/include";
118fi;
119if [[ -n "$ksourcedir" ]]; then
120	kinclude_CPPFLAGS="$kinclude_CPPFLAGS -I$ksourcedir/include";
121fi;
122pkgdatadir='${datadir}/xtables';
123
124define([EXPAND_VARIABLE],
125[$2=[$]$1
126if test $prefix = 'NONE'; then
127	prefix="/usr/local"
128fi
129while true; do
130  case "[$]$2" in
131    *\[$]* ) eval "$2=[$]$2" ;;
132    *) break ;;
133  esac
134done
135eval "$2=[$]$2"
136])dnl EXPAND_VARIABLE
137
138AC_SUBST([regular_CFLAGS])
139AC_SUBST([regular_CPPFLAGS])
140AC_SUBST([noundef_LDFLAGS])
141AC_SUBST([kinclude_CPPFLAGS])
142AC_SUBST([kbuilddir])
143AC_SUBST([ksourcedir])
144AC_SUBST([xtlibdir])
145AC_SUBST([pkgconfigdir])
146AC_SUBST([pkgdatadir])
147AC_SUBST([libxtables_vcurrent])
148AC_SUBST([libxtables_vage])
149libxtables_vmajor=$(($libxtables_vcurrent - $libxtables_vage));
150AC_SUBST([libxtables_vmajor])
151
152AC_CONFIG_FILES([Makefile extensions/GNUmakefile include/Makefile
153	iptables/Makefile iptables/xtables.pc
154	iptables/iptables.8 iptables/ip6tables.8
155	iptables/iptables-extensions.8.tmpl
156	libipq/Makefile libipq/libipq.pc
157	libiptc/Makefile libiptc/libiptc.pc
158	libiptc/libip4tc.pc libiptc/libip6tc.pc
159	libxtables/Makefile utils/Makefile
160	include/xtables-version.h include/iptables/internal.h])
161AC_OUTPUT
162
163
164EXPAND_VARIABLE(xtlibdir, e_xtlibdir)
165EXPAND_VARIABLE(pkgconfigdir, e_pkgconfigdir)
166
167echo "
168Iptables Configuration:
169  IPv4 support:				${enable_ipv4}
170  IPv6 support:				${enable_ipv6}
171  Devel support:			${enable_devel}
172  IPQ support:				${enable_libipq}
173  Large file support:			${enable_largefile}
174  BPF utils support:			${enable_bpfc}
175
176Build parameters:
177  Put plugins into executable (static):	${enable_static}
178  Support plugins via dlopen (shared):	${enable_shared}
179  Installation prefix (--prefix):	${prefix}
180  Xtables extension directory:		${e_xtlibdir}
181  Pkg-config directory:			${e_pkgconfigdir}"
182
183if [[ -n "$ksourcedir" ]]; then
184	echo "  Kernel source directory:		${ksourcedir}"
185fi;
186if [[ -n "$kbuilddir" ]]; then
187	echo "  Kernel build directory:		${kbuilddir}"
188fi;
189
190echo "  Host:					${host}
191  GCC binary:				${CC}"
192
193test x"$blacklist_modules" = "x" || echo "
194Iptables modules that will not be built: $blacklist_modules"
195