]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
meson: make backtrace dependency on execinfo
authorRosen Penev <rosenp@gmail.com>
Wed, 28 Sep 2022 23:17:53 +0000 (16:17 -0700)
committerNick Terrell <nickrterrell@gmail.com>
Wed, 14 Dec 2022 23:39:51 +0000 (15:39 -0800)
musl libc for example has no such header.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
build/meson/meson_options.txt
build/meson/programs/meson.build

index accf3fa10359a4bd07aed75cde641835e30e97c2..f35cd5fc8b11263957b19ecd909813bd5416014a 100644 (file)
@@ -14,7 +14,7 @@ option('legacy_level', type: 'integer', min: 0, max: 7, value: 5,
   description: 'Support any legacy format: 7 to 1 for v0.7+ to v0.1+')
 option('debug_level', type: 'integer', min: 0, max: 9, value: 1,
   description: 'Enable run-time debug. See lib/common/debug.h')
-option('backtrace', type: 'boolean', value: false,
+option('backtrace', type: 'feature', value: 'disabled',
   description: 'Display a stack backtrace when execution generates a runtime exception')
 option('static_runtime', type: 'boolean', value: false,
   description: 'Link to static run-time libraries on MSVC')
index 8df3a5dcbdd7941a2fae3108e7e7ac0a46088842..8cee115da751c108bd131557098fc49aa8950989 100644 (file)
@@ -51,7 +51,8 @@ endif
 
 export_dynamic_on_windows = false
 # explicit backtrace enable/disable for Linux & Darwin
-if not use_backtrace
+execinfo = cc.has_header('execinfo.h', required: use_backtrace)
+if not execinfo.found()
   zstd_c_args += '-DBACKTRACE_ENABLE=0'
 elif use_debug and host_machine_os == os_windows  # MinGW target
   zstd_c_args += '-DBACKTRACE_ENABLE=1'