24854608a89218f0c76e7ada4dd9a14ebc35afa3
[p5sagit/p5-mst-13.2.git] / hints / machten.sh
1 # machten.sh
2 # This is for MachTen 4.0.3.  It might work on other versions and variants too.
3 #
4 # Users of earlier MachTen versions might need a fixed tr from ftp.tenon.com.
5 # This should be described in the MachTen release notes.
6 #
7 # MachTen 2.x has its own hint file.
8 #
9 # This file has been put together by Andy Dougherty
10 # <doughera@lafcol.lafayette.edu> based on comments from lots of
11 # folks, especially 
12 #       Mark Pease <peasem@primenet.com>
13 #       Martijn Koster <m.koster@webcrawler.com>
14 #       Richard Yeh <rcyeh@cco.caltech.edu>
15 #
16 # Raise perl's stack size again; cut down reg_infty; document
17 #                      -- Dominic Dunlop <domo@computer.org> 980619
18 # Use of semctl() can crash system: disable -- Dominic Dunlop 980506
19 # Raise stack size further; slight tweaks to accomodate MT 4.1
20 #                      -- Dominic Dunlop <domo@computer.org> 980211
21 # Raise perl's stack size -- Dominic Dunlop <domo@tcp.ip.lu> 970922
22 # Reinstate sigsetjmp iff version is 4.0.3 or greater; use nm
23 # (assumes Configure change); prune libswanted -- Dominic Dunlop 970113
24 # Warn about test failure due to old Berkeley db -- Dominic Dunlop 970105
25 # Do not use perl's malloc; SysV IPC OK -- Neil Cutcliffe, Tenon 961030
26 # File::Find's use of link count disabled by Dominic Dunlop 960528
27 # Perl's use of sigsetjmp etc. disabled by Dominic Dunlop 960521
28 #
29 # Comments, questions, and improvements welcome!
30 #
31 # MachTen 4.X does support dynamic loading, but perl doesn't
32 # know how to use it yet.
33
34 # Power MachTen is a real memory system and its standard malloc
35 # has been optimized for this. Using this malloc instead of Perl's
36 # malloc may result in significant memory savings.
37 usemymalloc='false'
38
39 # Make symbol table listings les voluminous
40 nmopts=-gp
41
42 # Set reg_infty -- the maximum allowable number of repeats in regular
43 # expressions such as  /a{1,$max_repeats}/, and the maximum number of
44 # times /a*/ will match.  Setting this too high without having a stack
45 # large enough to accommodate deep recursion in the regular expression
46 # engine allows perl to crash your Mac due to stack overrun if it
47 # encounters a pathological regular expression.  The default is a
48 # compromise between capability and required stack size (see below).
49 # You may override the default value from the Configure command-line
50 # like this:
51 #
52 #   Configure -Dreg_infty=16368 ...
53
54 reg_infty=${reg_infty:-2047}
55
56 # If you want to have many perl processes active simultaneously --
57 # processing CGI forms -- for example, you should opt for a small stack.
58 # For safety, you should set reg_infty no larger than the corresponding
59 # value given in this table:
60 #
61 # Stack size  reg_infty value supported
62 # ----------  -------------------------
63 # 128k        2**8-1    (256)
64 # 256k        2**9-1    (511)
65 # 512k        2**10-1  (1023)
66 #   1M        2**11-1  (2047)
67 # ...
68 #  16M        2**15-1 (32767) (perl's default value)
69
70 # This script selects a safe stack size based on the value of reg_infty
71 # specified above.  However, you may choose to take a risk and set
72 # stack size lower: pathological regular expressions are rare in real-world
73 # programs.  But be aware that, if perl does encounter one, it WILL
74 # crash your system.  Do not set stack size lower than 96k unless
75 # you want perl's installation tests ( make test ) to crash your system.
76 #
77 # You may override the default value from the Configure command-line
78 # by specifying the required size in kilobytes like this:
79 #
80 #   Configure -Dstack_size=96
81
82 if [ "X$stack_size" = 'X' ]
83 then
84     stack_size=128
85     X=`expr $reg_infty / 256`
86
87     while [ $X -gt 0 ]
88     do
89         X=`expr $X / 2`
90         stack_size=`expr $stack_size \* 2`
91     done
92 fi
93
94 X=`expr $stack_size \* 1024`
95 ldflags="$ldflags -Xlstack=$X"
96 ccflags="$ccflags -DREG_INFTY=$reg_infty"
97
98 # Install in /usr/local by default
99 prefix='/usr/local'
100
101 # At least on PowerMac, doubles must be aligned on 8 byte boundaries.
102 # I don't know if this is true for all MachTen systems, or how to
103 # determine this automatically.
104 alignbytes=8
105
106 # 4.0.2 and earlier had a problem with perl's use of sigsetjmp and
107 # friends.  Use setjmp and friends instead.
108 expr "$osvers" \< "4.0.3" > /dev/null && d_sigsetjmp='undef'
109
110 # semctl(.., ..,  IPC_STATUS, ..) hangs system: say we don't have semctl()
111 d_semctl='undef'
112
113 # Get rid of some extra libs which it takes Configure a tediously
114 # long time never to find on MachTen
115 set `echo X "$libswanted "|sed -e 's/ net / /' -e 's/ socket / /' \
116     -e 's/ inet / /' -e 's/ nsl / /' -e 's/ nm / /' -e 's/ malloc / /' \
117     -e 's/ ld / /' -e 's/ sun / /' -e 's/ posix / /' \
118     -e 's/ cposix / /' -e 's/ crypt / /' \
119     -e 's/ ucb / /' -e 's/ bsd / /' -e 's/ BSD / /' -e 's/ PW / /'`
120 shift
121 libswanted="$*"
122
123 # While link counts on MachTen 4.1's fast file systems work correctly,
124 # on Macintosh Heirarchical File Systems, (and on HFS+)
125 # MachTen always reports ony two links to directories, even if they
126 # contain subdirectories.  Consequently, we use this variable to stop
127 # File::Find using the link count to determine whether there are
128 # subdirectories to be searched.  This will generate a harmless message:
129 # Hmm...You had some extra variables I don't know about...I'll try to keep 'em.
130 #       Propagating recommended variable dont_use_nlink
131 dont_use_nlink=define
132
133 cat <<EOM >&4
134
135 During Configure, you may see the message
136
137 *** WHOA THERE!!! ***
138     The recommended value for \$d_semctl on this machine was "undef"!
139     Keep the recommended value? [y]
140
141 Select the default answer: semctl() is buggy, and perl should be built
142 without it.
143
144 At the end of Configure, you will see a harmless message
145
146 Hmm...You had some extra variables I don't know about...I'll try to keep 'em.
147         Propagating recommended variable dont_use_nlink
148         Propagating recommended variable nmopts
149         Propagating recommended variable reg_infty
150 Read the File::Find documentation for more information about dont_use_nlink
151
152 Your perl will be built with a stack size of ${stack_size}k and a regular
153 expression repeat count limit of $reg_infty.  If you want alternative
154 values, see the file hints/machten.sh for advice on how to change them.
155
156 Tests
157         io/fs test 4  and
158         op/stat test 3
159 may fail since MachTen may not return a useful nlinks field to stat
160 on directories.
161
162 EOM
163 expr "$osvers" \< "4.1" >/dev/null && test -r ./broken-db.msg && \
164     . ./broken-db.msg
165
166 unset stack_size X