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