From 606ceb243c49ce336be8d34085ee158f3723e271 Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Tue, 22 Oct 2024 18:50:46 -0700 Subject: [PATCH] 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 + + 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 -- 2.47.3