$NetBSD: patch-meson.build,v 1.2 2024/06/09 14:29:27 wiz Exp $ Support for NetBSD. --- meson.build.orig 2024-05-30 18:59:51.000000000 +0000 +++ meson.build @@ -38,6 +38,18 @@ foreach h: [ 'sys/prctl.h', 'sys/procctl config_h.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h)) endforeach +# NetBSD defines posix_fallocate(), but it always returns failure. +# Cleanly fall back to ftruncate. +if host_machine.system() == 'netbsd' +have_funcs = [ + 'accept4', + 'mkostemp', + 'prctl', + 'memfd_create', + 'mremap', + 'strndup', +] +else have_funcs = [ 'accept4', 'mkostemp', @@ -47,6 +59,7 @@ have_funcs = [ 'mremap', 'strndup', ] +endif foreach f: have_funcs config_h.set('HAVE_' + f.underscorify().to_upper(), cc.has_function(f)) endforeach @@ -69,8 +82,8 @@ endif config_h.set10('HAVE_BROKEN_MSG_CMSG_CLOEXEC', have_broken_msg_cmsg_cloexec) if get_option('libraries') - if host_machine.system() in ['freebsd', 'openbsd'] - # When building for FreeBSD, epoll(7) is provided by a userspace + if host_machine.system() in ['freebsd', 'netbsd', 'openbsd'] + # When building for *BSD, epoll(7) is provided by a userspace # wrapper around kqueue(2). epoll_dep = dependency('epoll-shim') else