Alan Coopersmith
2007-Oct-29 17:42 UTC
[dtrace-discuss] autoconf test for building dtrace USDT probes?
X.Org has adopted GNU autoconf as its build configuration mechanism, so when I integrated the dtrace probes, I checked to see if they should be built using this test, checking for the existence of a program named "dtrace" in the path: dnl Check for dtrace program (needed to build Xserver dtrace probes) AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH], [Enable dtrace probes (default: enabled if dtrace found)]), [WDTRACE=$withval], [WDTRACE=auto]) if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin]) if test "x$DTRACE" = "xnot_found" ; then if test "x$WDTRACE" = "xyes" ; then AC_MSG_FAILURE([dtrace requested but not found]) fi WDTRACE="no" fi fi The Apple Xorg maintainer had to add this code to keep it from building on Leopard for now: dnl Darwin 9 has dtrace, but it doesn''t support compilation into ELF... if test "x$WDTRACE" = xauto; then case $host_os in darwin*) WDTRACE="no" ;; esac fi I''ve gotten a report this weekend from one of the Gentoo Linux X maintainers that one of their users has found a failure mode: "There''s another program out there called dtrace, which is an isdn tracer. If it''s installed, xorg-server compiles fail." Is there a better way to check for dtrace USDT provider build support for autoconf? I''ve been trying to avoid making it just check OS type so that we can support the probes on any OS that DTrace may be ported to. -- -Alan Coopersmith- alan.coopersmith at sun.com Sun Microsystems, Inc. - X Window System Engineering
Adam Leventhal
2007-Nov-01 08:46 UTC
[dtrace-discuss] autoconf test for building dtrace USDT probes?
> The Apple Xorg maintainer had to add this code to keep it from > building on Leopard for now: > > dnl Darwin 9 has dtrace, but it doesn''t support compilation into ELF... > if test "x$WDTRACE" = xauto; then > case $host_os in > darwin*) WDTRACE="no" ;; > esac > fiFirst, while Apple''s implementation doesn''t support the -G option, it does support USDT compilation -- the -G step is just redundant. The folks at Apple have mades some noise about implementing it for compatibility.> Is there a better way to check for dtrace USDT provider build > support for autoconf? I''ve been trying to avoid making it > just check OS type so that we can support the probes on any > OS that DTrace may be ported to.The plan was that including <sys/unistd.h> would conditionally define _DTRACE_VERSION if USDT was available, but the Apple folks don''t seem to have implemented this (though the FreeBSD folks have, I think). I suppose you could determine if DTrace exists on the system by doing something like this and checking the exit status: dtrace -n BEGIN -e You''ll need to include a special-casse for Mac OS X until their -G does something. Adam -- Adam Leventhal, FishWorks http://blogs.sun.com/ahl
Daniel A. Steffen
2007-Nov-01 13:14 UTC
[dtrace-discuss] autoconf test for building dtrace USDT probes?
On 01/11/2007, at 19:46, Adam Leventhal wrote:> The plan was that including <sys/unistd.h> would conditionally define > _DTRACE_VERSION if USDT was available, but the Apple folks don''t > seem to > have implemented this (though the FreeBSD folks have, I think). I > suppose > you could determine if DTrace exists on the system by doing > something like > this and checking the exit status: > > dtrace -n BEGIN -e > > You''ll need to include a special-casse for Mac OS X until their -G > does > something.FWIW, for the Tcl USDT provider, I test for presence of /usr/include/ sys/sdt.h and /usr/sbin/dtrace in configure to determine if DTrace is available; and I only generate a makefile dependency on the -G objectfile when not running on Darwin: http://rutherglen.ics.mq.edu.au/fisheye/changelog/Tcl/tcl? cs=MAIN:das:20070913152706 http://sourceforge.net/support/tracker.php?aid=1793984 Cheers, Daniel -- ** Daniel A. Steffen ** ** <mailto:das at users.sourceforge.net> **