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