It is enabled by default.
+--enable-static
+
+ Produce additional binaries, iptables-static/ip6tables-static,
+ which have all shipped extensions compiled in.
+
+--disable-shared
+
+ Produce binaries that have dynamic loading of extensions disabled.
+ This implies --enable-static.
+ (See some details below.)
+
--enable-libipq
This option causes libipq to be installed into ${libdir} and
${includedir}.
---enable-static
-
- Enable building single standalone multipurpose binaries,
- (iptables-static and ip6tables-static), which contain every
- extension compiled-in (and does not support additional
- extensions).
-
--with-ksource=
Xtables does not depend on kernel headers anymore, but you can
These have the core (iptables), -save, -restore and -xml code
compiled into one binary, but extensions remain as modules.
-If you want to build a statically linked version of the iptables binary,
-without the need for loading the plugins at runtime (e.g. for an
-embedded device or router-on-a-disk), you can use the --enable-static
-configure flag.
+
+Static and shared
+=================
+
+Basically there are three configuration modes defined:
+
+ --disable-static --enable-shared (this is the default)
+
+ Build a binary that relies upon dynamic loading of extensions.
+
+ --enable-static --enable-shared
+
+ Build a binary that has the shipped extensions built-in, but
+ is still capable of loading additional extensions.
+
+ --enable-static --disable-shared
+
+ Shipped extensions are built-in, and dynamic loading is
+ deactivated.
lib_LTLIBRARIES += libxtables.la
libxtables_la_SOURCES = xtables.c
libxtables_la_LDFLAGS = -version-info ${libxtables_vcurrent}:0:${libxtables_vage}
+if ENABLE_SHARED
+libxtables_la_CFLAGS = ${AM_CFLAGS}
libxtables_la_LIBADD = -ldl
+else
+libxtables_la_CFLAGS = ${AM_CFLAGS} -DNO_SHARED_LIBS=1
+libxtables_la_LIBADD =
+endif
# iptables, dynamic
iptables_SOURCES = iptables-standalone.c iptables.c xshared.c
iptables-restore.c iptables-xml.c \
iptables-standalone.c iptables.c xshared.c
iptables_multi_CFLAGS = ${AM_CFLAGS} -DIPTABLES_MULTI
+if ENABLE_STATIC
+iptables_multi_CFLAGS += -DALL_INCLUSIVE
+endif
iptables_multi_LDFLAGS = ${iptables_LDFLAGS}
iptables_multi_LDADD = ${iptables_LDADD}
iptables_save_LDFLAGS = ${iptables_LDFLAGS}
iptables_save_LDADD = ${iptables_LDADD}
-# iptables-multi, semi-static
-iptables_static_SOURCES = ${iptables_multi_SOURCES} xtables.c
-iptables_static_CFLAGS = ${iptables_multi_CFLAGS} -DNO_SHARED_LIBS=1
-iptables_static_LDADD = libiptc/libip4tc.la extensions/libext4.a -lm
-
iptables_xml_SOURCES = iptables-xml.c
# ip6tables, dynamic
ip6tables-restore.c ip6tables-standalone.c \
ip6tables.c xshared.c
ip6tables_multi_CFLAGS = ${AM_CFLAGS} -DIPTABLES_MULTI
+if ENABLE_STATIC
+ip6tables_multi_CFLAGS += -DALL_INCLUSIVE
+endif
ip6tables_multi_LDFLAGS = ${ip6tables_LDFLAGS}
ip6tables_multi_LDADD = ${ip6tables_LDADD}
ip6tables_save_LDFLAGS = ${ip6tables_LDFLAGS}
ip6tables_save_LDADD = ${ip6tables_LDADD}
-# iptables-multi, semi-static
-ip6tables_static_SOURCES = ${ip6tables_multi_SOURCES} xtables.c
-ip6tables_static_CFLAGS = ${ip6tables_multi_CFLAGS} -DNO_SHARED_LIBS=1
-ip6tables_static_LDADD = libiptc/libip6tc.la extensions/libext6.a -lm
-
bin_PROGRAMS = iptables-xml
sbin_PROGRAMS =
noinst_PROGRAMS =
ip6tables-save.8
CLEANFILES = iptables.8 ip6tables.8
-if ENABLE_STATIC
-if ENABLE_IPV4
-sbin_PROGRAMS += iptables-static
-endif
-if ENABLE_IPV6
-sbin_PROGRAMS += ip6tables-static
-endif
-endif
-if ENABLE_SHARED
if ENABLE_IPV4
sbin_PROGRAMS += iptables iptables-multi iptables-restore iptables-save
endif
if ENABLE_IPV6
sbin_PROGRAMS += ip6tables ip6tables-multi ip6tables-restore ip6tables-save
endif
-endif
iptables.8: ${srcdir}/iptables.8.in extensions/matches4.man extensions/targets4.man
${AM_VERBOSE_GEN} sed -e 's/@PACKAGE_AND_VERSION@/${PACKAGE} ${PACKAGE_VERSION}/g' -e '/@MATCH@/ r extensions/matches4.man' -e '/@TARGET@/ r extensions/targets4.man' $< >$@;
targets_install :=
@ENABLE_STATIC_TRUE@ libext4_objs := ${pfx_objs} ${pf4_objs}
@ENABLE_STATIC_TRUE@ libext6_objs := ${pfx_objs} ${pf6_objs}
-@ENABLE_SHARED_TRUE@ targets += ${pfx_solibs} ${pf4_solibs} ${pf6_solibs}
-@ENABLE_SHARED_TRUE@ targets_install += ${pfx_solibs} ${pf4_solibs} ${pf6_solibs}
+@ENABLE_STATIC_FALSE@ targets += ${pfx_solibs} ${pf4_solibs} ${pf6_solibs}
+@ENABLE_STATIC_FALSE@ targets_install += ${pfx_solibs} ${pf4_solibs} ${pf6_solibs}
.SECONDARY:
*/
extern void xtables_save_string(const char *value);
-#ifdef NO_SHARED_LIBS
+#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
# ifdef _INIT
# undef _init
# define _init _INIT
ip6tables_globals.program_version);
exit(1);
}
-#ifdef NO_SHARED_LIBS
+#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
init_extensions();
#endif
ip6tables_globals.program_version);
exit(1);
}
-#ifdef NO_SHARED_LIBS
+#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
init_extensions();
#endif
exit(1);
}
-#ifdef NO_SHARED_LIBS
+#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
init_extensions();
#endif
iptables_globals.program_version);
exit(1);
}
-#ifdef NO_SHARED_LIBS
+#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
init_extensions();
#endif
iptables_globals.program_version);
exit(1);
}
-#ifdef NO_SHARED_LIBS
+#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
init_extensions();
#endif
iptables_globals.program_version);
exit(1);
}
-#ifdef NO_SHARED_LIBS
+#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
init_extensions();
#endif