This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge pull request #76 from jkeenan/readme-typo-20210610
[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'
8900ddd2
MB
31$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
32
d9c563cf
MB
33cat <<EOM
34
35Perl can be built to support DTrace on platforms that support it.
36DTrace is a diagnosis and performance analysis tool from Sun.
37
b05b2a64 38If this doesn't make any sense to you, just accept the default.
d9c563cf
MB
39EOM
40
41while $test 1 ; do
42 case "$usedtrace" in
43 $define|true|[yY]*)
44 dflt='y'
45 ;;
085a7243
MBT
46 $undef|false|[nN]*)
47 dflt='n'
48 dflt_dtrace=""
49 ;;
d9c563cf
MB
50 ?*)
51 dflt='y'
52 dflt_dtrace=$usedtrace
53 ;;
54 *)
55 dflt='n'
56 ;;
57 esac
58
59 rp='Support DTrace if available?'
60 . ./myread
61 case "$ans" in
62 y|Y) val="$define" ;;
63 *) val="$undef" ;;
64 esac
65 set usedtrace
66 eval $setvar
67
68 test "X$usedtrace" != "X$define" && break
69
70 echo " "
71 rp='Where is the dtrace executable?'
72 dflt=$dflt_dtrace
73 . ./getfile
74 val="$ans"
75 set dtrace
76 eval $setvar
77
78 if $test -f $dtrace
79 then
80 if $dtrace -h -s ../perldtrace.d \
81 -o perldtrace.tmp >/dev/null 2>&1 \
82 && rm -f perldtrace.tmp
83 then
84 echo " "
85 echo "Good: your $dtrace knows about the -h flag."
86 else
87 cat >&2 <<EOM
88
89*** $me: Fatal Error: $dtrace doesn't support -h flag
90***
91*** Your installed dtrace doesn't support the -h switch to compile a D
92*** program into a C header. Can't continue.
93
94EOM
95 exit 1
96 fi
97 break;
98 fi
99
100 case "$fastread" in
101 yes)
102 cat >&2 <<EOM
103
104*** $me: Fatal Error: $dtrace not found.
105*** Can't continue.
106
107EOM
108 exit 1
109 ;;
110 *)
111 echo "*** $dtrace was not found."
112 echo " "
113 ;;
114 esac
115done
116