summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-05-11 13:47:29 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-05-14 15:45:31 +0100
commitabd8a17741f5e11b7fb3e7289cc0c071c961e81a (patch)
tree8185405edadfb1aff59df649b588f80ff1ebe0c6
parentaea6f4bb423d97d3ad47b0cde656bb90390af70e (diff)
downloadlibguestfs-abd8a17741f5e11b7fb3e7289cc0c071c961e81a.tar.gz
libguestfs-abd8a17741f5e11b7fb3e7289cc0c071c961e81a.tar.xz
libguestfs-abd8a17741f5e11b7fb3e7289cc0c071c961e81a.zip
configure: Allow systemtap/DTrace userspace probes to be disabled.
'./configure --disable-probes' will disable these probes. Otherwise they are autodetected as before. The <sys/sdt.h> produces lots of errors when you try to compile with these probes enabled under clang, so it is necessary to provide a way to disable them for clang users. (cherry picked from commit a1680f03b7d38bf007d29ac23035e5af33736b0e)
-rw-r--r--configure.ac16
-rw-r--r--src/guestfs-internal.h4
2 files changed, 15 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index ccedc793..542182d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -395,9 +395,19 @@ fi
AC_SUBST([SELINUX_LIB])
dnl Check for systemtap/DTrace userspace probes (optional).
-dnl http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
-AC_CHECK_HEADERS([sys/sdt.h])
-dnl AC_CHECK_PROG([DTRACE],[dtrace],[dtrace],[no])
+dnl Since the probe points break under clang, allow this to be disabled.
+AC_ARG_ENABLE([probes],
+ AS_HELP_STRING([--disable-probes], [Disable systemtap/DTrace userspace probes]),
+ [],
+ [enable_probes=yes])
+AS_IF([test "x$enable_probes" != "xno"],[
+ dnl http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
+ AC_CHECK_HEADERS([sys/sdt.h])
+ dnl AC_CHECK_PROG([DTRACE],[dtrace],[dtrace],[no])
+ AS_IF([test "x$ac_cv_header_sys_sdt_h" = "xyes"],[
+ AC_DEFINE([ENABLE_PROBES],[1],[enable systemtap/DTrace userspace probes])
+ ])
+])
dnl Check for cpio which isn't in the default Pardus install amazingly.
AC_CHECK_PROG([CPIO],[cpio],[cpio],[no])
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index c7fe9920..444b475a 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -43,7 +43,7 @@
#define N_(str) str
#endif
-#ifdef HAVE_SYS_SDT_H
+#if ENABLE_PROBES
#include <sys/sdt.h>
/* NB: The 'name' parameter is a literal identifier, NOT a string! */
#define TRACE0(name) DTRACE_PROBE(guestfs, name)
@@ -55,7 +55,7 @@
DTRACE_PROBE(guestfs, name, (arg1), (arg2), (arg3))
#define TRACE4(name, arg1, arg2, arg3, arg4) \
DTRACE_PROBE(guestfs, name, (arg1), (arg2), (arg3), (arg4))
-#else
+#else /* !ENABLE_PROBES */
#define TRACE0(name)
#define TRACE1(name, arg1)
#define TRACE2(name, arg1, arg2)