From: Dmitry Volyntsev Date: Thu, 22 Oct 2026 00:36:28 +0000 (-0700) Subject: Configure: allow explicit QuickJS library selection X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=5bab73d23fed6a58a5a5ba83b79bceb665288422;p=njs.git Configure: allow explicit QuickJS library selection Independent configure runs can select different QuickJS libraries. Allow callers to pass the selected headers and linker options without falling back to another library. --- diff --git a/auto/help b/auto/help index 7f647054..6c51582f 100644 --- a/auto/help +++ b/auto/help @@ -51,5 +51,8 @@ default: "$NJS_LD_OPT" --no-zlib disables zlib discovery. When this option is enabled zlib dependant code is not built as a part of libnjs.a. + --quickjs-inc=DIRS sets QuickJS include directories; + requires --quickjs-lib. + --quickjs-lib=OPTIONS sets QuickJS linker options. --with-quickjs requires QuickJS engine. END diff --git a/auto/options b/auto/options index 6e58be1e..a98983bb 100644 --- a/auto/options +++ b/auto/options @@ -18,6 +18,8 @@ NJS_ADDR2LINE=NO NJS_QUICKJS=NO NJS_TRY_QUICKJS=YES +NJS_QUICKJS_LIB= +NJS_QUICKJS_INCS= NJS_OPENSSL=YES NJS_LIBXML2=YES NJS_ZLIB=YES @@ -56,6 +58,8 @@ do --debug-generator=*) NJS_DEBUG_GENERATOR="$value" ;; --no-quickjs) NJS_TRY_QUICKJS=NO ;; + --quickjs-lib=*) NJS_QUICKJS_LIB="$value" ;; + --quickjs-inc=*) NJS_QUICKJS_INCS="$value" ;; --no-openssl) NJS_OPENSSL=NO ;; --no-libxml2) NJS_LIBXML2=NO ;; --no-zlib) NJS_ZLIB=NO ;; @@ -86,6 +90,13 @@ do done +if [ -n "$NJS_QUICKJS_INCS" ] && [ -z "$NJS_QUICKJS_LIB" ]; then + echo + echo "$0: error: --quickjs-inc requires --quickjs-lib." + echo + exit 1 +fi + if [ "$NJS_DEBUG_MEMORY" = "YES" ]; then NJS_DEBUG=YES fi diff --git a/auto/quickjs b/auto/quickjs index 80e79b2c..5a118de0 100644 --- a/auto/quickjs +++ b/auto/quickjs @@ -3,7 +3,6 @@ # Copyright (C) NGINX, Inc. -NJS_QUICKJS_LIB= NJS_HAVE_QUICKJS=NO NJS_QUICKJS_DEFAULT_INCS="src $NJS_BUILD_DIR" @@ -13,7 +12,7 @@ if [ $NJS_TRY_QUICKJS = YES ]; then njs_feature="QuickJS library -lquickjs.lto" njs_feature_name=NJS_HAVE_QUICKJS njs_feature_run=yes - njs_feature_incs="$NJS_QUICKJS_DEFAULT_INCS" + njs_feature_incs="$NJS_QUICKJS_DEFAULT_INCS $NJS_QUICKJS_INCS" njs_feature_libs="-lquickjs.lto -lm -ldl -lpthread" njs_feature_test="#include @@ -24,8 +23,20 @@ if [ $NJS_TRY_QUICKJS = YES ]; then JS_FreeRuntime(rt); return 0; }" + if [ -n "$NJS_QUICKJS_LIB" ]; then + njs_feature="QuickJS library $NJS_QUICKJS_LIB" + njs_feature_libs="$NJS_QUICKJS_LIB" + fi + . auto/feature + if [ -n "$NJS_QUICKJS_LIB" -a $njs_found = no ]; then + echo + echo $0: error: the specified QuickJS library is not working. + echo + exit 1 + fi + if [ $njs_found = no ]; then njs_feature="QuickJS library -lquickjs" njs_feature_libs="-lquickjs -lm -ldl -lpthread"