summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2013-08-02 20:49:48 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-08-03 09:32:03 +0200
commiteeb3b8dc5c771915f9c011e95ae20babdf70bd02 (patch)
treef1602f8e92a9a0f9873bf0335e03cf23433b9e34 /configure.ac
parentc2e2fbe6601ef14122371c380d91a48425a2b669 (diff)
Add SDT probes for RTL_LOG_STRING_NEW/DELETE.
Change-Id: I938259f90aee9d277c9ff5b72c9120b93311cbd3 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac48
1 files changed, 48 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 7809430f957f..c623f386d883 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5322,6 +5322,54 @@ if test "$ENABLE_VALGRIND" = FALSE; then
fi
AC_SUBST([VALGRIND_CFLAGS])
+
+dnl ===================================================================
+dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
+dnl ===================================================================
+
+# We need at least the sys/sdt.h include header.
+AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
+if test "$SDT_H_FOUND" = "TRUE"; then
+ # Found sys/sdt.h header, now make sure the c++ compiler works.
+ # Old g++ versions had problems with probes in constructors/destructors.
+ AC_MSG_CHECKING([working sys/sdt.h and c++ support])
+ AC_LANG_PUSH([C++])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/sdt.h>
+ class ProbeClass
+ {
+ private:
+ int& ref;
+ const char *name;
+
+ public:
+ ProbeClass(int& v, const char *n) : ref(v), name(n)
+ {
+ DTRACE_PROBE2(_test_, cons, name, ref);
+ }
+
+ void method(int min)
+ {
+ DTRACE_PROBE3(_test_, meth, name, ref, min);
+ ref -= min;
+ }
+
+ ~ProbeClass()
+ {
+ DTRACE_PROBE2(_test_, dest, name, ref);
+ }
+ };
+ ]],[[
+ int i = 64;
+ DTRACE_PROBE1(_test_, call, i);
+ ProbeClass inst = ProbeClass(i, "call");
+ inst.method(24);
+ ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
+ [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
+ AC_LANG_POP([C++])
+fi
+AC_CONFIG_HEADERS([config_host/config_probes.h])
+
dnl ===================================================================
dnl Compiler plugins
dnl ===================================================================