From 745c5c28c451e6160e905f6a3834917b9d9c5ae2 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 17 Mar 2025 18:28:19 -0700 Subject: [PATCH] build: add check for asm/perf_regs.h Related: #127 --- config.h.meson | 2 ++ meson.build | 4 ++++ src/libsysprof/sysprof-user-sampler.c | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config.h.meson b/config.h.meson index 48b3c2c2..e1c9bbf0 100644 --- a/config.h.meson +++ b/config.h.meson @@ -20,6 +20,8 @@ #mesondefine HAVE_PERF_CLOCKID +#mesondefine HAVE_PERF_REGS_H + #mesondefine HAVE_POLKIT #mesondefine HAVE_POLKIT_AGENT diff --git a/meson.build b/meson.build index a118aa2b..3907354a 100644 --- a/meson.build +++ b/meson.build @@ -109,6 +109,10 @@ config_h.set10('HAVE_POLKIT_AGENT', polkit_agent_dep.found()) polkit_dep = dependency('polkit-gobject-1', version: polkit_req_version, required: false) config_h.set10('HAVE_POLKIT', polkit_dep.found()) +if cc.has_header('asm/perf_regs.h') + config_h.set10('HAVE_PERF_REGS_H', true) +endif + if need_libsysprof libunwind_dep = dependency('libunwind-generic', required: true) config_h.set('ENABLE_LIBUNWIND', libunwind_dep.found()) diff --git a/src/libsysprof/sysprof-user-sampler.c b/src/libsysprof/sysprof-user-sampler.c index 6079708e..4bccf7f5 100644 --- a/src/libsysprof/sysprof-user-sampler.c +++ b/src/libsysprof/sysprof-user-sampler.c @@ -25,7 +25,9 @@ #include #include -#include +#ifdef HAVE_PERF_REGS_H +# include +#endif #include