[njs] Fixed editline detection.

Igor Sysoev igor at sysoev.ru
Tue Apr 2 14:18:26 UTC 2019


details:   https://hg.nginx.org/njs/rev/61f2616e21c7
branches:  
changeset: 863:61f2616e21c7
user:      Igor Sysoev <igor at sysoev.ru>
date:      Tue Apr 02 17:17:49 2019 +0300
description:
Fixed editline detection.

This simplifies building on modern macOS.

diffstat:

 auto/editline   |  37 +++++++++++++++++++++++++------------
 njs/njs_shell.c |   8 +++++++-
 2 files changed, 32 insertions(+), 13 deletions(-)

diffs (92 lines):

diff -r b38fe378d900 -r 61f2616e21c7 auto/editline
--- a/auto/editline	Mon Apr 01 19:11:39 2019 +0300
+++ b/auto/editline	Tue Apr 02 17:17:49 2019 +0300
@@ -7,26 +7,33 @@ NXT_EDITLINE_LIB=
 
 nxt_found=no
 
-nxt_feature="editline library"
+nxt_feature="editline library in editline/readline.h"
 nxt_feature_name=NXT_HAVE_EDITLINE
 nxt_feature_run=no
-nxt_feature_incs="-I/usr/include/editline"
+nxt_feature_incs=
 nxt_feature_libs="-ledit"
 nxt_feature_test="#include <stdio.h>
-                  #include <readline.h>
+                  #include <editline/readline.h>
 
-                 int main(void) {
-                     add_history(NULL);
-                     return 0;
-                 }"
+                  int main(void) {
+                      add_history(NULL);
+                      return 0;
+                  }"
 . auto/feature
 
 if [ $nxt_found = no ]; then
 
     # FreeBSD port
 
-    nxt_feature="editline in /usr/include/edit"
-    nxt_feature_incs="-I/usr/include/edit/readline"
+    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
@@ -35,9 +42,15 @@ if [ $nxt_found = no ]; then
 
     # NetBSD
 
-    nxt_feature="editline in /usr/include"
-    nxt_feature_incs="-I/usr/include/readline"
+    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
 
@@ -47,8 +60,8 @@ 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"
 
-	NXT_DEFAULT_TARGET="$NXT_DEFAULT_TARGET njs"
 else
     NXT_HAVE_LIBEDIT=NO
     $echo " - building interactive shell is not possible"
diff -r b38fe378d900 -r 61f2616e21c7 njs/njs_shell.c
--- a/njs/njs_shell.c	Mon Apr 01 19:11:39 2019 +0300
+++ b/njs/njs_shell.c	Tue Apr 02 17:17:49 2019 +0300
@@ -17,7 +17,13 @@
 #include <locale.h>
 
 #include <stdio.h>
-#include <readline.h>
+#if (NXT_HAVE_EDITLINE)
+#include <editline/readline.h>
+#elif (NXT_HAVE_EDIT_READLINE)
+#include <edit/readline/readline.h>
+#else
+#include <readline/readline.h>
+#endif
 
 
 typedef struct {


More information about the nginx-devel mailing list