develooper Front page | perl.perl5.porters | Postings from January 2008

Re: dtrace and Perl (again)

Thread Previous | Thread Next
Andy Dougherty
January 8, 2008 06:22
Re: dtrace and Perl (again)
Message ID:
> I could use a little advice about how dtrace should be detected by Configure
> and handled at build time. I need to
> * find the dtrace executable
> * use it to filter a D script into a .h
> * (on Solaris but not MacOS) filter a D script into a .o
> * link against the generated .o
> I assume that all the above should be conditional on -Dusedtrace and that
> Apple and Sun will set that option when they build their vendor versions. Is
> that sensible?
> Is there a precedent for finding an executable? Anything else I should be
> thinking about?

To find an executable from within Configure, you can use the UU/loc 
utility shell script put there by Configure.  The syntax is

	./loc file default list-of-directories-separated-by-spaces

The typical idiom is something like this ($pth is pre-computed earlier in 
Configure, and is a space-separted list of directories in the user's 
$PATH, augmented by a set of commonly useful directories.)

    xxx=`./loc dtrace blurfl $pth`
    if $test -f $xxx; then
	echo "dtrace found in $xxx"
        echo "dtrace not found."

If dtrace isn't found anywhere in $pth, then xxx gets set to 'blurfl',
which doesn't exist.  (We test with -f instead of -x because v7 /bin/sh
didn't have a -x test.  That's probably not terribly important anymore.)

Ideally, it would be nice to have some way to verify that the executable
'dtrace' actually works and does what you think it does.  (For example,
I know on one of my systems, the first 'dtrace' command you'd find in
$PATH is actually a graphics program.)

Also, would you want just a shell variable (probably $dtrace containing
the full path to the dtrace executable) or do you also want a C-level

I can probably whip up a skeletal metaconfig unit and simple Configure
patch that won't interfere with Merijn's current metaconfig merge work,
but I don't have dtrace, so I'd need a lot of help filling in the gaps.

    Andy Dougherty

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About