[njs] QuickJS: improved library discovery.

noreply at nginx.com noreply at nginx.com
Wed Oct 23 05:19:02 UTC 2024


details:   https://github.com/nginx/njs/commit/606ceb243c49ce336be8d34085ee158f3723e271
branches:  master
commit:    606ceb243c49ce336be8d34085ee158f3723e271
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Tue, 22 Oct 2024 18:50:46 -0700
description:
QuickJS: improved library discovery.

Add explicit testing for JS_GetClassID() function since it is not available
in older QuickJS versions.

This closes #801 issue on Github.

---
 auto/quickjs | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/auto/quickjs b/auto/quickjs
index 8451d44d..9aeb485a 100644
--- a/auto/quickjs
+++ b/auto/quickjs
@@ -25,7 +25,6 @@ if [ $NJS_TRY_QUICKJS = YES ]; then
                           JSRuntime *rt;
 
                           rt = JS_NewRuntime();
-                          (void) JS_GetClassID;
                           JS_FreeRuntime(rt);
                           return 0;
                      }"
@@ -56,6 +55,28 @@ if [ $NJS_TRY_QUICKJS = YES ]; then
 
     if [ $njs_found = yes ]; then
 
+        njs_feature="QuickJS JS_GetClassID()"
+        njs_feature_test="#if defined(__GNUC__) && (__GNUC__ >= 8)
+                          #pragma GCC diagnostic push
+                          #pragma GCC diagnostic ignored \"-Wcast-function-type\"
+                          #endif
+
+                          #include <quickjs.h>
+
+                          int main() {
+                              (void) JS_GetClassID;
+                              return 0;
+                         }"
+
+        . auto/feature
+
+        if [ $njs_found = no ]; then
+            echo
+            echo $0: error: QuickJS library found, but JS_GetClassID\(\) is missing.
+            echo
+            exit 1;
+        fi
+
         njs_feature="QuickJS JS_NewTypedArray()"
         njs_feature_test="#if defined(__GNUC__) && (__GNUC__ >= 8)
                           #pragma GCC diagnostic push


More information about the nginx-devel mailing list