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