]> git.kaiwu.me - njs.git/commitdiff
QuickJS: improved library discovery.
authorDmitry Volyntsev <xeioex@nginx.com>
Wed, 23 Oct 2024 01:50:46 +0000 (18:50 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Wed, 23 Oct 2024 05:18:47 +0000 (22:18 -0700)
Add explicit testing for JS_GetClassID() function since it is not available
in older QuickJS versions.

This closes #801 issue on Github.

auto/quickjs

index 8451d44d0ab6ee0ef15282c7d4bf98baff265a17..9aeb485aca2d6beee69666300f229a25a8b25f9f 100644 (file)
@@ -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