diff --git a/libgimpbase/meson.build b/libgimpbase/meson.build index b1c6d9c7eb..b5de0ac1d9 100644 --- a/libgimpbase/meson.build +++ b/libgimpbase/meson.build @@ -100,13 +100,14 @@ libgimpbase_introspectable = [ libgimpbase_headers_introspectable, ] -optional_libexecinfo = cc.find_library('execinfo', required: false) - libgimpbase = library('gimpbase-' + gimp_api_version, libgimpbase_sources, include_directories: rootInclude, dependencies: [ - gexiv2, gio, math, optional_libexecinfo + gexiv2, gio, math, + # optionally depend on libexecinfo on platforms where it is not + # internal to the libc. + opt_execinfo, ], c_args: [ '-DG_LOG_DOMAIN="LibGimpBase"', diff --git a/meson.build b/meson.build index f933f1533e..2f84503893 100644 --- a/meson.build +++ b/meson.build @@ -1214,7 +1214,6 @@ conf.set('HAVE_VPRINTF', foreach header : [ { 'm': 'HAVE_ALLOCA_H', 'v': 'alloca.h' }, { 'm': 'HAVE_DLFCN_H', 'v': 'dlfcn.h' }, - { 'm': 'HAVE_EXECINFO_H', 'v': 'execinfo.h' }, { 'm': 'HAVE_FCNTL_H', 'v': 'fcntl.h' }, { 'm': 'HAVE_IEEEFP_H', 'v': 'ieeefp.h' }, { 'm': 'HAVE_INTTYPES_H', 'v': 'inttypes.h' }, @@ -1241,6 +1240,12 @@ foreach header : [ conf.set(header['m'], cc.has_header(header['v']) ? 1 : false) endforeach +# In musl, backtrace() is in the libexecinfo library. +# In glibc, it is internal (there we only need the header). +# So we look for both cases, so that we are able to link to libexecinfo +# if it exists. Cf. !455. +opt_execinfo = cc.find_library('execinfo', has_headers: ['execinfo.h'], required: false) +conf.set('HAVE_EXECINFO_H', opt_execinfo.found() or cc.has_header('execinfo.h') ? 1 : false) ################################################################################