This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
The return of USE_DTRACE
[metaconfig.git] / U / perl / usedtrace.U
CommitLineData
d9c563cf
MB
1?RCS: $Id: usedtrace.U,v $
2?RCS:
3?RCS: Copyright (c) 2008 H.Merijn Brand
4?RCS:
5?RCS: You may distribute under the terms of either the GNU General Public
6?RCS: License or the Artistic License, as specified in the README file.
7?RCS:
8?RCS: $Log: usedtrace.U,v $
9?RCS:
10?MAKE:usedtrace dtrace: Myread Oldconfig Setvar Getfile test
11?MAKE: -pick add $@ %<
12?Y:TOP
13?S:usedtrace:
14?S: This variable indicates whether we are compiling with dtrace
15?S: support. See also dtrace.
16?S:.
17?S:dtrace:
18?S: This variable holds the location of the dtrace executable.
19?S:.
680e7710
MB
20?C:USE_DTRACE:
21?C: This symbol, if defined, indicates that Perl should
22?C: be built with support for DTrace.
23?C:.
24?H:#$usedtrace USE_DTRACE /**/
25?H:.
d9c563cf
MB
26?T:dflt_dtrace
27?LINT:set usedtrace
28?LINT:set dtrace
29: DTrace support
30dflt_dtrace='/usr/sbin/dtrace'
31cat <<EOM
32
33Perl can be built to support DTrace on platforms that support it.
34DTrace is a diagnosis and performance analysis tool from Sun.
35
36If this doesn't make any sense to you, just accept the default '$dflt'.
37EOM
38
39while $test 1 ; do
40 case "$usedtrace" in
41 $define|true|[yY]*)
42 dflt='y'
43 ;;
44 ?*)
45 dflt='y'
46 dflt_dtrace=$usedtrace
47 ;;
48 *)
49 dflt='n'
50 ;;
51 esac
52
53 rp='Support DTrace if available?'
54 . ./myread
55 case "$ans" in
56 y|Y) val="$define" ;;
57 *) val="$undef" ;;
58 esac
59 set usedtrace
60 eval $setvar
61
62 test "X$usedtrace" != "X$define" && break
63
64 echo " "
65 rp='Where is the dtrace executable?'
66 dflt=$dflt_dtrace
67 . ./getfile
68 val="$ans"
69 set dtrace
70 eval $setvar
71
72 if $test -f $dtrace
73 then
74 if $dtrace -h -s ../perldtrace.d \
75 -o perldtrace.tmp >/dev/null 2>&1 \
76 && rm -f perldtrace.tmp
77 then
78 echo " "
79 echo "Good: your $dtrace knows about the -h flag."
80 else
81 cat >&2 <<EOM
82
83*** $me: Fatal Error: $dtrace doesn't support -h flag
84***
85*** Your installed dtrace doesn't support the -h switch to compile a D
86*** program into a C header. Can't continue.
87
88EOM
89 exit 1
90 fi
91 break;
92 fi
93
94 case "$fastread" in
95 yes)
96 cat >&2 <<EOM
97
98*** $me: Fatal Error: $dtrace not found.
99*** Can't continue.
100
101EOM
102 exit 1
103 ;;
104 *)
105 echo "*** $dtrace was not found."
106 echo " "
107 ;;
108 esac
109done
110