[njs] Improved editline detection on various platforms.

Dmitry Volyntsev xeioex at nginx.com
Mon Aug 21 10:45:42 UTC 2017


details:   http://hg.nginx.org/njs/rev/4b11d945ce7d
branches:  
changeset: 398:4b11d945ce7d
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri Aug 18 18:40:39 2017 +0300
description:
Improved editline detection on various platforms.

diffstat:

 Makefile          |   2 +-
 njs/njs.c         |   2 +-
 nxt/auto/editline |  23 +++++++++++++++++++----
 3 files changed, 21 insertions(+), 6 deletions(-)

diffs (69 lines):

diff -r c0e8bd4964be -r 4b11d945ce7d Makefile
--- a/Makefile	Tue Aug 15 21:19:13 2017 +0300
+++ b/Makefile	Fri Aug 18 18:40:39 2017 +0300
@@ -396,7 +396,7 @@ dist:
 	njs/njs.c \
 
 	$(NXT_CC) -o $(NXT_BUILDDIR)/njs $(NXT_CFLAGS) \
-		-I$(NXT_LIB) -Injs \
+		-I$(NXT_LIB) $(NXT_EDITLINE_CFLAGS) -Injs \
 		njs/njs.c \
 		$(NXT_BUILDDIR)/libnjs.a \
 		-lm $(NXT_PCRE_LIB) $(NXT_EDITLINE_LIB)
diff -r c0e8bd4964be -r 4b11d945ce7d njs/njs.c
--- a/njs/njs.c	Tue Aug 15 21:19:13 2017 +0300
+++ b/njs/njs.c	Fri Aug 18 18:40:39 2017 +0300
@@ -27,7 +27,7 @@
 #include <njs_variable.h>
 #include <njs_parser.h>
 
-#include <editline/readline.h>
+#include <readline.h>
 
 
 typedef enum {
diff -r c0e8bd4964be -r 4b11d945ce7d nxt/auto/editline
--- a/nxt/auto/editline	Tue Aug 15 21:19:13 2017 +0300
+++ b/nxt/auto/editline	Fri Aug 18 18:40:39 2017 +0300
@@ -1,12 +1,15 @@
 # Copyright (C) Dmitry Volyntsev
 # Copyright (C) NGINX, Inc.
 
+nxt_found=no
+
 nxt_feature="editline library"
 nxt_feature_name=NXT_HAVE_EDITLINE
 nxt_feature_run=no
-nxt_feature_incs=
-nxt_feature_libs=-ledit
-nxt_feature_test="#include <editline/readline.h>
+nxt_feature_incs="-I/usr/include/editline"
+nxt_feature_libs="-ledit"
+nxt_feature_test="#include <stdio.h>
+                  #include <readline.h>
 
                  int main(void) {
                      add_history(NULL);
@@ -14,9 +17,21 @@ nxt_feature_test="#include <editline/rea
                  }"
 . ${NXT_AUTO}feature
 
+if [ $nxt_found = no ]; then
+
+    # FreeBSD port
+
+    nxt_feature="editline in /usr/include/edit"
+    nxt_feature_incs="-I/usr/include/edit/readline"
+
+    . auto/feature
+fi
+
 if [ $nxt_found = yes ]; then
     cat << END >> $NXT_MAKEFILE_CONF
-NXT_EDITLINE_LIB = -ledit
+
+NXT_EDITLINE_CFLAGS = $nxt_feature_incs
+NXT_EDITLINE_LIB = $nxt_feature_libs
 END
 
 else


More information about the nginx-devel mailing list