aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-06-14 13:35:05 +0800
committerfanquake <fanquake@gmail.com>2021-06-16 10:16:03 +0800
commit8f7704d0321a71c1691837a6bd3b4e05f84d3031 (patch)
tree2b1669671a260c1e4a38ddc69ea8d9c296fc2012 /configure.ac
parentde5512e28df220990ad123b914167aadd6f50979 (diff)
downloadbitcoin-8f7704d0321a71c1691837a6bd3b4e05f84d3031.tar.xz
build: improve detection of eBPF support
Just checking for the `sys/sdt.h` header isn't enough, as systems like macOS have the header, but it doesn't actually have the dtrace probes, which leads to compile failures.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac16
1 files changed, 9 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index aaa932b093..77cb5dd326 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1357,13 +1357,15 @@ if test x$enable_wallet != xno; then
fi
if test x$use_ebpf != xno; then
- AC_CHECK_HEADER([sys/sdt.h], [have_sdt=yes], [have_sdt=no])
-else
- have_sdt=no
-fi
-
-if test x$have_sdt = xyes; then
- AC_DEFINE([ENABLE_TRACING], [1], [Define to 1 to enable eBPF user static defined tracepoints])
+ AC_MSG_CHECKING([whether eBPF tracepoints are supported])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM(
+ [#include <sys/sdt.h>],
+ [DTRACE_PROBE("context", "event");]
+ )],
+ [AC_MSG_RESULT(yes); have_sdt=yes; AC_DEFINE([ENABLE_TRACING], [1], [Define to 1 to enable eBPF user static defined tracepoints])],
+ [AC_MSG_RESULT(no); have_sdt=no;]
+ )
fi
dnl Check for libminiupnpc (optional)