From b533b25208f4ea32bed1808bd824e70cfe4b6629 Mon Sep 17 00:00:00 2001
From: Daniel E <daniel.engberg.lists@pyret.net>
Date: Wed, 30 Mar 2022 14:30:42 +0000
Subject: [PATCH] build: Add fallback looking for duktape's library and header

---
 meson.build | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index dd09b28..c6765fd 100644
--- a/meson.build
+++ b/meson.build
@@ -137,7 +137,11 @@ duktape_req_version = '>= 2.2.0'
 
 js_engine = get_option('js_engine')
 if js_engine == 'duktape'
-  js_dep = dependency('duktape', version: duktape_req_version)
+  js_dep = dependency('duktape', version: duktape_req_version, required: false)
+  if not js_dep.found()
+    message('Falling back to looking for library and header...')
+    js_dep = cc.find_library('duktape', has_headers: ['duktape.h'], required: true)
+  endif
   libm_dep = cc.find_library('m')
   thread_dep = dependency('threads')
   func = 'pthread_condattr_setclock'
-- 
1.8.3.1

