diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d4d0691d6..ea5453445 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -186,7 +186,7 @@ fedora-x86_64: --localstatedir=/var --libdir=lib -Dsystemtap=true - -Ddtrace=true + -Ddtrace=enabled -Dinstalled_tests=true -Ddocumentation=true -Dintrospection=enabled @@ -241,7 +241,7 @@ debian-stable-x86_64: --localstatedir=/var --libdir=lib -Dsystemtap=true - -Ddtrace=true + -Ddtrace=enabled _build - meson compile -C _build - .gitlab-ci/run-tests.sh @@ -343,7 +343,7 @@ installed-tests: --prefix=/usr --libdir=/usr/lib64 -Dinstalled_tests=true -Ddefault_library=both - -Ddtrace=false + -Ddtrace=disabled _build - meson compile -C _build - sudo meson install -C _build @@ -384,7 +384,7 @@ G_DISABLE_ASSERT: - meson setup ${MESON_COMMON_OPTIONS} --werror -Dsystemtap=true - -Ddtrace=true + -Ddtrace=enabled -Dinstalled_tests=true -Dglib_assert=false -Dintrospection=enabled @@ -422,7 +422,7 @@ valgrind: - meson setup ${MESON_COMMON_OPTIONS} --werror -Dsystemtap=true - -Ddtrace=true + -Ddtrace=enabled -Dinstalled_tests=true -Dintrospection=enabled _build @@ -767,7 +767,7 @@ scan-build: --libdir=lib -Dglib_debug=enabled -Dsystemtap=true - -Ddtrace=true + -Ddtrace=enabled -Dinstalled_tests=true -Dintrospection=enabled _scan_build @@ -797,7 +797,7 @@ scan-build: --localstatedir=/var --libdir=lib -Dsystemtap=true - -Ddtrace=true + -Ddtrace=enabled -Dinstalled_tests=true -Dintrospection=enabled _coverity_build diff --git a/meson.build b/meson.build index aad78f574..b650fe717 100644 --- a/meson.build +++ b/meson.build @@ -2519,19 +2519,35 @@ elif host_system == 'cygwin' endif # Tracing: dtrace -want_dtrace = get_option('dtrace') -enable_dtrace = false +dtrace_option = get_option('dtrace') +enable_dtrace = dtrace_option.allowed() -# Since dtrace support is opt-in we just error out if it was requested but -# is not available. We don't bother with autodetection yet. -if want_dtrace - if glib_have_carbon +if glib_have_carbon + if dtrace_option.enabled() error('GLib dtrace support not yet compatible with macOS dtrace') + else + enable_dtrace = false endif - dtrace = find_program('dtrace', required : true) # error out if not found +endif + +if enable_dtrace + dtrace = find_program('dtrace', required : dtrace_option) + if not dtrace.found() + enable_dtrace = false + endif +endif + +if enable_dtrace if not cc.has_header('sys/sdt.h') - error('dtrace support needs sys/sdt.h header') + if dtrace_option.enabled() + error('dtrace support needs sys/sdt.h header') + else + enable_dtrace = false + endif endif +endif + +if enable_dtrace # FIXME: autotools build also passes -fPIC -DPIC but is it needed in this case? dtrace_obj_gen = generator(dtrace, output : '@BASENAME@.o', @@ -2552,7 +2568,6 @@ with open(output, "w") as f: f.write(contents) ''', dtrace.full_path(), '-h', '-s', '@INPUT@', '-o', '@OUTPUT@']) glib_conf.set('HAVE_DTRACE', 1) - enable_dtrace = true endif if cc.has_header_symbol('sys/ptrace.h', 'PTRACE_O_EXITKILL') @@ -2696,7 +2711,7 @@ endif summary({ 'xattr' : xattr_dep.length() > 0, 'man-pages' : get_option('man-pages'), - 'dtrace' : get_option('dtrace'), + 'dtrace' : enable_dtrace, 'systemtap' : enable_systemtap, 'sysprof' : libsysprof_capture_dep.found(), 'documentation' : get_option('documentation'), diff --git a/meson_options.txt b/meson_options.txt index 69a2135bc..bf641b0ce 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -50,8 +50,9 @@ option('man-pages', deprecated : { 'true': 'enabled', 'false': 'disabled' }) option('dtrace', - type : 'boolean', - value : false, + type : 'feature', + value : 'auto', + deprecated : { 'true': 'enabled', 'false': 'disabled' }, description : 'include tracing support for dtrace') option('systemtap',