]> git.kaiwu.me - njs.git/commitdiff
Improved editline detection on various platforms.
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 18 Aug 2017 15:40:39 +0000 (18:40 +0300)
committerDmitry Volyntsev <xeioex@nginx.com>
Fri, 18 Aug 2017 15:40:39 +0000 (18:40 +0300)
Makefile
njs/njs.c
nxt/auto/editline

index a6a9d4e8fa4ba396b3c3f65a05c39556886627e2..01ed2c2fdf4053845acd02e9ad679eb8b55f1439 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -396,7 +396,7 @@ $(NXT_BUILDDIR)/njs: \
        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)
index 719d027e2fc2b5aad1eb100819d1b64e18f8641d..6106a52bb1b6a1093b14894d641c6052dd251beb 100644 (file)
--- a/njs/njs.c
+++ b/njs/njs.c
@@ -27,7 +27,7 @@
 #include <njs_variable.h>
 #include <njs_parser.h>
 
-#include <editline/readline.h>
+#include <readline.h>
 
 
 typedef enum {
index 45b06703d2eeb84e860b8a431c4630ef338391f1..c7c6b91b4e3b9fc7e4fa1713c9eb67d00e49b479 100644 (file)
@@ -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/readline.h>
                  }"
 . ${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