]> git.kaiwu.me - njs.git/commitdiff
Support for building with GNU Readline library.
authorValentin Bartenev <vbart@nginx.com>
Fri, 26 Apr 2019 14:59:42 +0000 (17:59 +0300)
committerValentin Bartenev <vbart@nginx.com>
Fri, 26 Apr 2019 14:59:42 +0000 (17:59 +0300)
auto/expect
auto/make
auto/readline [moved from auto/editline with 59% similarity]
configure
njs/njs_shell.c

index befb7fa8bb67d08417af887c1c24901bce10beed..5b4dc7b4ea6038269a083754ecbc8bd972ad0073 100644 (file)
@@ -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
index 7c43d690e0056356673d4646288919408f3b5a8e..16c80e1aabdc2e24349898100e99b1e47756c6ed 100644 (file)
--- a/auto/make
+++ b/auto/make
@@ -178,10 +178,10 @@ $NXT_BUILD_DIR/njs: \\
        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
 
similarity index 59%
rename from auto/editline
rename to auto/readline
index 9d49ca3d5b34cad6b31e191b581fb539cede9572..2ab530b840a0c1a48858cf8396f388ea4869265b 100644 (file)
@@ -2,18 +2,19 @@
 # Copyright (C) NGINX, Inc.
 
 
-NXT_EDITLINE_CFLAGS=
-NXT_EDITLINE_LIB=
+NXT_READLINE_CFLAGS=
+NXT_READLINE_LIB=
 
 nxt_found=no
 
-nxt_feature="editline library in editline/readline.h"
-nxt_feature_name=NXT_HAVE_EDITLINE
+nxt_feature="GNU readline library"
+nxt_feature_name=NXT_HAVE_GNU_READLINE
 nxt_feature_run=no
 nxt_feature_incs=
-nxt_feature_libs="-ledit"
+nxt_feature_libs="-lreadline"
 nxt_feature_test="#include <stdio.h>
-                  #include <editline/readline.h>
+                  #include <readline/readline.h>
+                  #include <readline/history.h>
 
                   int main(void) {
                       add_history(NULL);
@@ -21,6 +22,20 @@ nxt_feature_test="#include <stdio.h>
                   }"
 . 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
@@ -42,7 +57,7 @@ if [ $nxt_found = no ]; then
 
     # NetBSD
 
-    nxt_feature_name=NXT_HAVE_READLINE
+    nxt_feature_name=NXT_HAVE_NETBSD_READLINE
     nxt_feature="editline in readline/readline.h"
     nxt_feature_test="#include <stdio.h>
                       #include <readline/readline.h>
@@ -54,15 +69,17 @@ if [ $nxt_found = no ]; then
     . 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_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_LIBEDIT=NO
+    NXT_HAVE_READLINE=NO
     $echo " - building interactive shell is not possible"
 fi
index aa604dc01316bbab5b1e545ea90f7f1032dc3e83..ddf19a0a406ccbf156fdeae6e8f272fdfa4d1744 100755 (executable)
--- a/configure
+++ b/configure
@@ -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"
index d92d8b0c91d4ff3bacf1eaf793dfcb2b368d9f6b..d5560f0ace29601558a1c7f6e9f547d667a65959 100644 (file)
@@ -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