diff --git a/.gitignore b/.gitignore index 6ca9d39a16b360..99e16c9237e921 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ libtool src/config/bitcoin-config.h src/config/bitcoin-config.h.in src/config/stamp-h1 +src/util/probes.h src/obj share/setup.nsi share/qt/Info.plist diff --git a/configure.ac b/configure.ac index 0e1968f5c47e11..fcfe893da98569 100644 --- a/configure.ac +++ b/configure.ac @@ -1385,14 +1385,28 @@ fi if test "$use_usdt" != "no"; then AC_MSG_CHECKING([whether Userspace, Statically Defined Tracing tracepoints are supported]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM( - [#include ], - [DTRACE_PROBE("context", "event");] - )], - [AC_MSG_RESULT([yes]); AC_DEFINE([ENABLE_TRACING], [1], [Define to 1 to enable tracepoints for Userspace, Statically Defined Tracing])], - [AC_MSG_RESULT([no]); use_usdt=no;] - ) + AC_CHECK_HEADER([sys/sdt.h], [use_usdt=yes], [use_usdt=no]) +else + use_usdt=no +fi + +dnl Check for dtrace(1) +if test x$use_usdt = xyes; then + AC_PATH_PROG([DTRACE], [dtrace]) + if test "$TARGET_OS" = "darwin"; then + dnl USDT is only supported on darwin if dtrace exists + if test -n "$DTRACE"; then + AM_CONDITIONAL([HAVE_DTRACE], [test -n "$DTRACE"]) + else + use_usdt=no + fi + else + AM_CONDITIONAL([HAVE_DTRACE], [test -n "$DTRACE"]) + fi +fi + +if test x$use_usdt = xyes; then + AC_DEFINE([ENABLE_TRACING], [1], [Define to 1 to enable tracepoints for Userspace, Statically Defined Tracing]) fi AM_CONDITIONAL([ENABLE_USDT_TRACEPOINTS], [test "$use_usdt" = "yes"]) diff --git a/src/Makefile.am b/src/Makefile.am index bc0982f74dc179..96c52998717147 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -328,6 +328,13 @@ BITCOIN_CORE_H = \ zmq/zmqrpc.h \ zmq/zmqutil.h +if HAVE_DTRACE +util/probes.h: util/probes.d + $(AM_V_GEN) $(DTRACE) -h -s $< -o $@ + +BUILT_SOURCES = util/probes.h +BITCOIN_CORE_H += util/probes.h +endif obj/build.h: FORCE @$(MKDIR_P) $(builddir)/obj @@ -979,6 +986,7 @@ CLEANFILES += wallet/*.gcda wallet/*.gcno CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno CLEANFILES += zmq/*.gcda zmq/*.gcno CLEANFILES += obj/build.h +CLEANFILES += util/probes.h EXTRA_DIST = $(CTAES_DIST)