All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft] configure: fall back to readline if libedit is not available
@ 2021-11-18 17:33 Pablo Neira Ayuso
  0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2021-11-18 17:33 UTC (permalink / raw)
  To: netfilter-devel

By default, check for editline, if not present, fall back to readline.

Extend test coverage for readline.

Fixes: b4dded0ca78d ("configure: default to libedit for cli")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 configure.ac             | 20 +++++++++++++-------
 tests/build/run-tests.sh |  2 +-
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index bb65f749691c..3c93fb2bf3cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,26 +71,32 @@ AC_ARG_WITH([cli], [AS_HELP_STRING([--without-cli],
             [disable interactive CLI (libreadline, editline or linenoise support)])],
             [], [with_cli=editline])
 
+AS_IF([test "x$with_cli" = xeditline], [
+AC_CHECK_LIB([edit], [readline], ,
+	     [AC_MSG_WARN([No suitable version of libedit found, falling back to libreadline])
+	      with_cli=readline])
+])
 AS_IF([test "x$with_cli" = xreadline], [
 AC_CHECK_LIB([readline], [readline], ,
 	     AC_MSG_ERROR([No suitable version of libreadline found]))
-AC_DEFINE([HAVE_LIBREADLINE], [1], [])
 ],
       [test "x$with_cli" = xlinenoise], [
 AC_CHECK_LIB([linenoise], [linenoise], ,
 	     AC_MSG_ERROR([No suitable version of linenoise found]))
 AC_DEFINE([HAVE_LIBLINENOISE], [1], [])
 ],
-      [test "x$with_cli" = xeditline], [
-AC_CHECK_LIB([edit], [readline], ,
-	     AC_MSG_ERROR([No suitable version of libedit found]))
-AC_DEFINE([HAVE_LIBEDIT], [1], [])
-],
-      [test "x$with_cli" != xno], [
+      [test "x$with_cli" != xno && test "x$with_cli" != xeditline], [
 AC_MSG_ERROR([unexpected CLI value: $with_cli])
 ])
 AM_CONDITIONAL([BUILD_CLI], [test "x$with_cli" != xno])
 
+AS_IF([test "x$with_cli" = xeditline], [
+AC_DEFINE([HAVE_LIBEDIT], [1], [])
+],
+      [test "x$with_cli" = xreadline], [
+AC_DEFINE([HAVE_LIBREADLINE], [1], [])
+])
+
 AC_ARG_WITH([xtables], [AS_HELP_STRING([--with-xtables],
             [Use libxtables for iptables interaction])],
 	    [], [with_xtables=no])
diff --git a/tests/build/run-tests.sh b/tests/build/run-tests.sh
index f78cc9019a30..c257eb008140 100755
--- a/tests/build/run-tests.sh
+++ b/tests/build/run-tests.sh
@@ -2,7 +2,7 @@
 
 log_file="`pwd`/tests.log"
 dir=../..
-argument=( --without-cli --with-cli=linenoise --with-cli=editline --enable-debug --with-mini-gmp
+argument=( --without-cli --with-cli=linenoise --with-cli=editline --with-cli=readline --enable-debug --with-mini-gmp
 	   --enable-man-doc --with-xtables --with-json)
 ok=0
 failed=0
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-18 17:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 17:33 [PATCH nft] configure: fall back to readline if libedit is not available Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.