$NetBSD: patch-quickjs.c,v 1.3 2022/01/30 10:55:03 he Exp $ Portability patch for NetBSD. --- quickjs.c.orig 2021-03-27 10:00:32.000000000 +0000 +++ quickjs.c @@ -70,7 +70,15 @@ /* define to include Atomics.* operations which depend on the OS threads */ #if !defined(EMSCRIPTEN) +#ifdef __NetBSD__ +#ifdef __HAVE_ATOMICOPS64_OPS #define CONFIG_ATOMICS +#else +#undef CONFIG_ATOMICS +#endif /* __HAVE_ATOMICOPS64_OPS */ +#else /* !__NetBSD__ */ +#define CONFIG_ATOMICS +#endif /* __NetBSD__ */ #endif #if !defined(EMSCRIPTEN) @@ -1680,7 +1688,7 @@ static inline size_t js_def_malloc_usabl return malloc_size(ptr); #elif defined(_WIN32) return _msize(ptr); -#elif defined(EMSCRIPTEN) +#elif defined(EMSCRIPTEN) || defined(__NetBSD__) return 0; #elif defined(__linux__) return malloc_usable_size(ptr); @@ -1754,7 +1762,7 @@ static const JSMallocFunctions def_mallo malloc_size, #elif defined(_WIN32) (size_t (*)(const void *))_msize, -#elif defined(EMSCRIPTEN) +#elif defined(EMSCRIPTEN) || defined(__NetBSD__) NULL, #elif defined(__linux__) (size_t (*)(const void *))malloc_usable_size,