[njs] Support for building with GNU Readline library.
Valentin Bartenev
vbart at nginx.com
Fri Apr 26 14:59:59 UTC 2019
details: https://hg.nginx.org/njs/rev/760d38110fd9
branches:
changeset: 931:760d38110fd9
user: Valentin Bartenev <vbart at nginx.com>
date: Fri Apr 26 17:59:42 2019 +0300
description:
Support for building with GNU Readline library.
diffstat:
auto/editline | 68 ---------------------------------------------
auto/expect | 2 +-
auto/make | 4 +-
auto/readline | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
configure | 2 +-
njs/njs_shell.c | 3 ++
6 files changed, 92 insertions(+), 72 deletions(-)
diffs (214 lines):
diff -r 43dc900bc914 -r 760d38110fd9 auto/editline
--- a/auto/editline Thu Apr 25 19:50:20 2019 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-# Copyright (C) Dmitry Volyntsev
-# Copyright (C) NGINX, Inc.
-
-
-NXT_EDITLINE_CFLAGS=
-NXT_EDITLINE_LIB=
-
-nxt_found=no
-
-nxt_feature="editline library in editline/readline.h"
-nxt_feature_name=NXT_HAVE_EDITLINE
-nxt_feature_run=no
-nxt_feature_incs=
-nxt_feature_libs="-ledit"
-nxt_feature_test="#include <stdio.h>
- #include <editline/readline.h>
-
- int main(void) {
- add_history(NULL);
- return 0;
- }"
-. auto/feature
-
-if [ $nxt_found = no ]; then
-
- # FreeBSD port
-
- nxt_feature_name=NXT_HAVE_EDIT_READLINE
- nxt_feature="editline in edit/readline/readline.h"
- nxt_feature_test="#include <stdio.h>
- #include <edit/readline/readline.h>
-
- int main(void) {
- add_history(NULL);
- return 0;
- }"
-
- . auto/feature
-fi
-
-if [ $nxt_found = no ]; then
-
- # NetBSD
-
- nxt_feature_name=NXT_HAVE_READLINE
- nxt_feature="editline in readline/readline.h"
- nxt_feature_test="#include <stdio.h>
- #include <readline/readline.h>
-
- int main(void) {
- add_history(NULL);
- return 0;
- }"
- . auto/feature
-fi
-
-NXT_DEFAULT_TARGET=libnjs
-
-if [ $nxt_found = yes ]; then
- NXT_HAVE_LIBEDIT=YES
- NXT_EDITLINE_CFLAGS=$nxt_feature_incs
- NXT_EDITLINE_LIB=$nxt_feature_libs
- NXT_DEFAULT_TARGET="$NXT_DEFAULT_TARGET njs"
-
-else
- NXT_HAVE_LIBEDIT=NO
- $echo " - building interactive shell is not possible"
-fi
diff -r 43dc900bc914 -r 760d38110fd9 auto/expect
--- a/auto/expect Thu Apr 25 19:50:20 2019 +0300
+++ b/auto/expect Fri Apr 26 17:59:42 2019 +0300
@@ -17,7 +17,7 @@ else
$echo " not found"
fi
-if [ $nxt_found = yes -a $NXT_HAVE_LIBEDIT = YES ]; then
+if [ $nxt_found = yes -a $NXT_HAVE_READLINE = YES ]; then
cat << END >> $NXT_MAKEFILE
njs_expect_test: njs njs/test/njs_expect_test.exp
diff -r 43dc900bc914 -r 760d38110fd9 auto/make
--- a/auto/make Thu Apr 25 19:50:20 2019 +0300
+++ b/auto/make Fri Apr 26 17:59:42 2019 +0300
@@ -178,10 +178,10 @@ cat << END >> $NXT_MAKEFILE
njs/njs_shell.c
\$(NXT_CC) -o $NXT_BUILD_DIR/njs \$(NXT_CFLAGS) \\
$NXT_LIB_AUX_CFLAGS \$(NXT_LIB_INCS) \\
- $NXT_EDITLINE_CFLAGS -Injs \\
+ $NXT_READLINE_CFLAGS -Injs \\
njs/njs_shell.c \\
$NXT_BUILD_DIR/libnjs.a \\
- -lm $NXT_LIBS $NXT_LIB_AUX_LIBS $NXT_EDITLINE_LIB
+ -lm $NXT_LIBS $NXT_LIB_AUX_LIBS $NXT_READLINE_LIB
END
diff -r 43dc900bc914 -r 760d38110fd9 auto/readline
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/auto/readline Fri Apr 26 17:59:42 2019 +0300
@@ -0,0 +1,85 @@
+# Copyright (C) Dmitry Volyntsev
+# Copyright (C) NGINX, Inc.
+
+
+NXT_READLINE_CFLAGS=
+NXT_READLINE_LIB=
+
+nxt_found=no
+
+nxt_feature="GNU readline library"
+nxt_feature_name=NXT_HAVE_GNU_READLINE
+nxt_feature_run=no
+nxt_feature_incs=
+nxt_feature_libs="-lreadline"
+nxt_feature_test="#include <stdio.h>
+ #include <readline/readline.h>
+ #include <readline/history.h>
+
+ int main(void) {
+ add_history(NULL);
+ return 0;
+ }"
+. auto/feature
+
+if [ $nxt_found = no ]; then
+ nxt_feature="editline library in editline/readline.h"
+ nxt_feature_name=NXT_HAVE_EDITLINE
+ nxt_feature_libs="-ledit"
+ nxt_feature_test="#include <stdio.h>
+ #include <editline/readline.h>
+
+ int main(void) {
+ add_history(NULL);
+ return 0;
+ }"
+ . auto/feature
+fi
+
+if [ $nxt_found = no ]; then
+
+ # FreeBSD port
+
+ nxt_feature_name=NXT_HAVE_EDIT_READLINE
+ nxt_feature="editline in edit/readline/readline.h"
+ nxt_feature_test="#include <stdio.h>
+ #include <edit/readline/readline.h>
+
+ int main(void) {
+ add_history(NULL);
+ return 0;
+ }"
+
+ . auto/feature
+fi
+
+if [ $nxt_found = no ]; then
+
+ # NetBSD
+
+ nxt_feature_name=NXT_HAVE_NETBSD_READLINE
+ nxt_feature="editline in readline/readline.h"
+ nxt_feature_test="#include <stdio.h>
+ #include <readline/readline.h>
+
+ int main(void) {
+ add_history(NULL);
+ return 0;
+ }"
+ . auto/feature
+fi
+
+
+
+NXT_DEFAULT_TARGET=libnjs
+
+if [ $nxt_found = yes ]; then
+ NXT_HAVE_READLINE=YES
+ NXT_READLINE_CFLAGS=$nxt_feature_incs
+ NXT_READLINE_LIB=$nxt_feature_libs
+ NXT_DEFAULT_TARGET="$NXT_DEFAULT_TARGET njs"
+
+else
+ NXT_HAVE_READLINE=NO
+ $echo " - building interactive shell is not possible"
+fi
diff -r 43dc900bc914 -r 760d38110fd9 configure
--- a/configure Thu Apr 25 19:50:20 2019 +0300
+++ b/configure Fri Apr 26 17:59:42 2019 +0300
@@ -52,7 +52,7 @@ NXT_LIBRT=
. auto/getrandom
. auto/explicit_bzero
. auto/pcre
-. auto/editline
+. auto/readline
. auto/sources
NXT_LIB_AUX_CFLAGS="$NXT_PCRE_CFLAGS"
diff -r 43dc900bc914 -r 760d38110fd9 njs/njs_shell.c
--- a/njs/njs_shell.c Thu Apr 25 19:50:20 2019 +0300
+++ b/njs/njs_shell.c Fri Apr 26 17:59:42 2019 +0300
@@ -23,6 +23,9 @@
#include <edit/readline/readline.h>
#else
#include <readline/readline.h>
+#if (NXT_HAVE_GNU_READLINE)
+#include <readline/history.h>
+#endif
#endif
More information about the nginx-devel
mailing list