meson: Check for unwind.h header from macOS SDK

This makes the check more robust similarly to
libbacktrace header (execinfo.h) check.
This commit is contained in:
Bruno Lopes 2026-01-02 08:49:00 -03:00
parent fd59099b92
commit d0ca8bb9bc

View file

@ -687,11 +687,14 @@ endif
conf.set('HAVE_LIBBACKTRACE', libbacktrace.found())
## Check for libunwind
# In most platforms, unw_*() functions are in the libunwind library.
# In macOS, it is on libSystem (there we only need the SDK header).
libunwind = ( get_option('libunwind')
? dependency('libunwind', version: '>=1.1.0', required: false)
: no_dep
)
conf.set('HAVE_LIBUNWIND', libunwind.found())
have_unwind = libunwind.found() or cc.has_header('unwind.h')
conf.set('HAVE_LIBUNWIND', have_unwind ? 1 : false)
## Check for backtrace() API
# In musl, backtrace() is in the libexecinfo library.