#include <assert.h>
#if (defined __i386__ || defined __x86_64__) && defined(__linux__)
# include <linux/perf_event.h>
-# include <asm/perf_regs.h>
+# ifdef HAVE_PERF_REGS_H
+# include <asm/perf_regs.h>
+# endif
#endif
#define BACKEND i386_
#if defined(__linux__)
/* XXX Need to exclude __linux__ arches without perf_regs.h. */
-#if defined(__x86_64__) || defined(__i386__)
-/* || defined(other_architecture)... */
+#if defined HAVE_PERF_REGS_H
# include <asm/perf_regs.h>
#endif
#endif
#include <assert.h>
#if defined(__x86_64__) && defined(__linux__)
# include <linux/perf_event.h>
-# include <asm/perf_regs.h>
+# ifdef HAVE_PERF_REGS_H
+# include <asm/perf_regs.h>
+# endif
#endif
#define BACKEND x86_64_
AC_SUBST(DEBUGINFOD_IMA_CERT_PATH, $default_debuginfod_ima_cert_path)
AC_CONFIG_FILES([config/profile.sh config/profile.csh config/profile.fish])
+# check for asm/perf_regs.h, as it's completely absent on some architectures
+AH_TEMPLATE([HAVE_PERF_REGS_H], [Define to 1 if `asm/perf-regs.h` is provided by the system, 0 otherwise.])
+AC_CHECK_HEADER(asm/perf_regs.h,
+ [AC_DEFINE(HAVE_PERF_REGS_H)],[])
+
# XXX Currently, eu-stacktrace can only work with sysprof/x86, hence:
AC_ARG_ENABLE([stacktrace],AS_HELP_STRING([--enable-stacktrace], [Enable eu-stacktrace]))
# check for x86, or more precisely _ASM_X86_PERF_REGS_H
#include <linux/perf_event.h>
-/* TODO: Need to generalize the code beyond x86 architectures. */
+/* TODO: Need to generalize the code beyond x86 architectures.
+ eu-stacktrace currently disabled by configury
+ unless _ASM_X86_PERF_REGS_H is detected. */
#include <asm/perf_regs.h>
#ifndef _ASM_X86_PERF_REGS_H
#error "eu-stacktrace is currently limited to x86 architectures"