Work inspired by matt knox
[m6w6/libmemcached] / m4 / dtrace.m4
1 dnl ---------------------------------------------------------------------------
2 dnl Macro: ENABLE_DTRACE
3 dnl ---------------------------------------------------------------------------
4 AC_DEFUN([ENABLE_DTRACE],[
5 AC_ARG_ENABLE([dtrace],
6 [AS_HELP_STRING([--enable-dtrace],
7 [Build with support for the DTRACE. @<:@default=off@:>@])],
8 [ac_cv_enable_dtrace="yes"],
9 [ac_cv_enable_dtrace="no"])
10
11 if test "$ac_cv_enable_dtrace" = "yes"
12 then
13 AC_PATH_PROG([DTRACE], [dtrace], "no", [/usr/sbin:$PATH])
14 if test "x$DTRACE" != "xno"; then
15 AC_DEFINE([HAVE_DTRACE], [1], [Enables DTRACE Support])
16 DTRACE_HEADER=dtrace_probes.h
17
18 # DTrace on MacOSX does not use -G option
19 $DTRACE -G -o conftest.$$ -s libmemcached/libmemcached_probes.d 2>/dev/zero
20 if test $? -eq 0
21 then
22 DTRACE_OBJ=libmemcached_probes.lo
23 rm conftest.$$
24 fi
25
26 ac_cv_enable_dtrace="yes"
27 AC_SUBST(HAVE_DTRACE)
28 else
29 AC_MSG_ERROR([Need dtrace binary and OS support.])
30 fi
31 fi
32
33 AC_SUBST(DTRACEFLAGS)
34 AC_SUBST(DTRACE_HEADER)
35 AC_SUBST(DTRACE_OBJ)
36 AM_CONDITIONAL([HAVE_DTRACE], [ test "$ac_cv_enable_dtrace" = "yes" ])
37 ])
38 dnl ---------------------------------------------------------------------------
39 dnl End Macro: ENABLE_DTRACE
40 dnl ---------------------------------------------------------------------------