1 From ace4c5eb69ee7dace955acdb23e30e8229b18619 Mon Sep 17 00:00:00 2001
2 From: Steven Barth <cyrus@openwrt.org>
3 Date: Wed, 1 Oct 2014 22:40:31 +0200
4 Subject: [PATCH 1/2] build: allow disabling libreadline-support
6 This makes nftables a bit more embedded-friendly.
8 Signed-off-by: Steven Barth <cyrus@openwrt.org>
10 configure.ac | 11 +++++++++--
11 src/Makefile.in | 2 ++
13 3 files changed, 17 insertions(+), 2 deletions(-)
17 @@ -71,8 +71,15 @@ AC_CHECK_LIB([nftnl], [nft_rule_alloc],
18 AC_CHECK_LIB([gmp], [__gmpz_init], ,
19 AC_MSG_ERROR([No suitable version of libgmp found]))
21 -AC_CHECK_LIB([readline], [readline], ,
22 - AC_MSG_ERROR([No suitable version of libreadline found]))
24 +AC_ARG_WITH([libreadline], [AS_HELP_STRING([--without-libreadline],
25 + [Disable libreadline support (no interactive CLI)])], [],
26 + [with_libreadline=yes])
27 +AS_IF([test "x$with_libreadline" != xno], [
28 +AC_CHECK_LIB([readline],[readline], , AC_MSG_ERROR([No suitable version of libreadline found]))
30 +AC_SUBST(with_libreadline)
33 # Checks for header files.
37 @@ -3,7 +3,9 @@ PROGRAMS += nft
38 nft-destdir := @sbindir@
41 +ifeq (@with_libreadline@,yes)
45 nft-obj += statement.o
49 @@ -335,8 +335,14 @@ int main(int argc, char * const *argv)
50 if (scanner_read_file(scanner, filename, &internal_location) < 0)
52 } else if (interactive) {
53 +#ifdef HAVE_LIBREADLINE
57 + fprintf(stderr, "%s: interactive CLI not supported in this build\n",
59 + exit(NFT_EXIT_FAILURE);
62 fprintf(stderr, "%s: no command specified\n", argv[0]);
63 exit(NFT_EXIT_FAILURE);