From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Steven Barth <cyrus@openwrt.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH] build: allow disabling libreadline-support
Date: Thu, 9 Oct 2014 14:26:48 +0200 [thread overview]
Message-ID: <20141009122648.GA17919@salvia> (raw)
In-Reply-To: <1412200742-5898-1-git-send-email-cyrus@openwrt.org>
Hi Steven,
Thanks for your patch. No major objections to this. Some comments
below:
On Wed, Oct 01, 2014 at 11:59:02PM +0200, Steven Barth wrote:
> This makes nftables a bit more embedded-friendly.
>
> Signed-off-by: Steven Barth <cyrus@openwrt.org>
> ---
> configure.ac | 11 +++++++++--
> src/Makefile.in | 2 ++
> src/main.c | 6 ++++++
> 3 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 3a7647f..a19da5d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -71,8 +71,15 @@ AC_CHECK_LIB([nftnl], [nft_rule_alloc], ,
> AC_CHECK_LIB([gmp], [__gmpz_init], ,
> AC_MSG_ERROR([No suitable version of libgmp found]))
>
> -AC_CHECK_LIB([readline], [readline], ,
> - AC_MSG_ERROR([No suitable version of libreadline found]))
> +
> +AC_ARG_WITH([libreadline], [AS_HELP_STRING([--without-libreadline],
> + [Disable libreadline support (no interactive CLI)])], [],
> + [with_libreadline=yes])
I think, better call this option "without-cli" ?
> +AS_IF([test "x$with_libreadline" != xno], [
> +AC_CHECK_LIB([readline],[readline], , AC_MSG_ERROR([No suitable version of libreadline found]))
> +])
> +AC_SUBST(with_libreadline)
> +
>
> # Checks for header files.
> AC_HEADER_STDC
> diff --git a/src/Makefile.in b/src/Makefile.in
> index 8ac2b46..04107a8 100644
> --- a/src/Makefile.in
> +++ b/src/Makefile.in
> @@ -3,7 +3,9 @@ PROGRAMS += nft
> nft-destdir := @sbindir@
>
> nft-obj += main.o
> +ifeq (@with_libreadline@,yes)
> nft-obj += cli.o
> +endif
> nft-obj += rule.o
> nft-obj += statement.o
> nft-obj += datatype.o
> diff --git a/src/main.c b/src/main.c
> index 2685b0d..de2efe6 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -335,8 +335,14 @@ int main(int argc, char * const *argv)
> if (scanner_read_file(scanner, filename, &internal_location) < 0)
> goto out;
> } else if (interactive) {
> +#ifdef HAVE_LIBREADLINE
Please, add the:
#ifdef HAVE_LIBREADLINE
in cli_init() and cli_exit() in cli.c. It would be good if the cli_init()
returns a negative value, so you spot the error message below.
> cli_init(&state);
> return 0;
> +#else
> + fprintf(stderr, "%s: interactive CLI not supported in this build\n",
> + argv[0]);
> + exit(NFT_EXIT_FAILURE);
> +#endif
> } else {
> fprintf(stderr, "%s: no command specified\n", argv[0]);
> exit(NFT_EXIT_FAILURE);
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-10-09 12:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 21:59 [nft PATCH] build: allow disabling libreadline-support Steven Barth
2014-10-09 12:26 ` Pablo Neira Ayuso [this message]
2014-10-09 15:02 ` Steven Barth
2014-10-09 16:33 ` Pablo Neira Ayuso
2014-10-09 20:48 ` [nft PATCHv2] " Steven Barth
2014-10-10 10:23 ` Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141009122648.GA17919@salvia \
--to=pablo@netfilter.org \
--cc=cyrus@openwrt.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).