Skip to content

Commit 81d6ad1

Browse files
committed
Autotools: Add --with-xtables
Turns out including a dependency depending on installedness is not standard practice. Manually includes and excludes xtables from the userspace binaries: ./configure # xtables included ./configure --with-xtables # xtables included ./configure --with-xtables=yes # xtables included ./configure --with-xtables=no # xtables excluded Took a while, but I think I finally landed optional iptables properly. Progress on #273.
1 parent a036f08 commit 81d6ad1

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

configure.ac

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,30 @@ AC_SEARCH_LIBS([pow], [m])
3333
AC_SEARCH_LIBS([pthread_create], [pthread])
3434
AC_CHECK_LIB([argp], [argp_parse])
3535

36-
# Checks for dependencies.
36+
# Dependency: libnlgenl (mandatory)
3737
PKG_CHECK_MODULES(LIBNLGENL3, libnl-genl-3.0 >= 3.2.22)
3838

39-
# xtables will only be included if available.
40-
PKG_CHECK_MODULES(XTABLES, xtables,
41-
WITH_XTABLES="yes",
42-
WITH_XTABLES="no")
43-
AM_CONDITIONAL([XTABLES_ENABLED], [test "x$WITH_XTABLES" = "xyes"])
39+
# Dependency: xtables (optional)
40+
AC_ARG_WITH(
41+
[xtables],
42+
AS_HELP_STRING(
43+
[--with-xtables@<:@=yes|no@:>@],
44+
[Include xtables dependency? @<:@default=yes@:>@]
45+
)
46+
)
47+
AS_IF([test "x$with_xtables" != "xno"], [
48+
PKG_CHECK_MODULES(XTABLES, xtables)
49+
])
50+
AM_CONDITIONAL([XTABLES_ENABLED], [test "x$with_xtables" != "xno"])
4451

4552
# Bash autocompletion option (https://www.swansontec.com/bash-completion.html):
4653
# 1. Offer the user the `--with-bash-completion-dir` configure option,
4754
# which can be set to a directory, "yes" (default; means autodetect
4855
# directory) or "no" (disable autocompletion).
4956
AC_ARG_WITH([bash-completion-dir],
50-
AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
51-
[Install the bash auto-completion script. @<:@default=yes@:>@]),
57+
AS_HELP_STRING([--with-bash-completion-dir@<:@=yes|no|PATH@:>@],
58+
[Directory where the bash auto-completion script will be installed.
59+
("yes" attempts to guess.) @<:@default=yes@:>@]),
5260
[],
5361
[with_bash_completion_dir=yes])
5462

src/usr/argp/wargp/instance.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ struct add_args {
165165
struct wargp_prefix6 pool6;
166166
};
167167

168+
#ifdef XTABLES_DISABLED
169+
#pragma message("Xtables disabled")
170+
#else
171+
#pragma message("Xtables enabled")
172+
#endif
173+
168174
static struct wargp_option add_opts[] = {
169175
WARGP_INAME(struct add_args, iname, "add"),
170176
{

0 commit comments

Comments
 (0)