[ID 20000829.022] [PATCH 6868] Minor nit in installhtml
[p5sagit/p5-mst-13.2.git] / hints / machten.sh
1 #! /bin/bash
2 # machten.sh
3 # This is for MachTen 4.1.4.  It might work on other versions and variants
4 # too.  If it doesn't, tell me, and I'll try to fix it -- domo@computer.org
5 #
6 # Users of earlier MachTen versions might need a fixed tr from ftp.tenon.com.
7 # This should be described in the MachTen release notes.
8 #
9 # MachTen 2.x has its own hint file.
10 #
11 # The original version of this file was put together by Andy Dougherty
12 # <doughera@lafcol.lafayette.edu> based on comments from lots of
13 # folks, especially 
14 #       Mark Pease <peasem@primenet.com>
15 #       Martijn Koster <m.koster@webcrawler.com>
16 #       Richard Yeh <rcyeh@cco.caltech.edu>
17 #
18 # Remove dynamic loading libraries from search; enable SysV IPC with
19 # MachTen 4.1.4 and above; define SYSTEM_ALIGN_BYTES for old MT versions
20 #                      -- Dominic Dunlop <domo@computer.org> 000224
21 # Disable shadow password file access: MT 4.1.1 has necessary library
22 # functions, but not header file (or documentation)
23 #                      -- Dominic Dunlop <domo@computer.org> 990804
24 # For now, explicitly disable dynamic loading -- MT 4.1.1 has it,
25 # but these hints do not yet support it.
26 # Define NOTEDEF_MACHTEN to undo gratuitous Tenon hack to signal.h.
27 #                      -- Dominic Dunlop <domo@computer.org> 9800802
28 # Completely disable SysV IPC pending more complete support from Tenon
29 #                      -- Dominic Dunlop <domo@computer.org> 980712
30 # Use vfork and perl's malloc by default
31 #                      -- Dominic Dunlop <domo@computer.org> 980630
32 # Raise perl's stack size again; cut down reg_infty; document
33 #                      -- Dominic Dunlop <domo@computer.org> 980619
34 # Use of semctl() can crash system: disable -- Dominic Dunlop 980506
35 # Raise stack size further; slight tweaks to accomodate MT 4.1
36 #                      -- Dominic Dunlop <domo@computer.org> 980211
37 # Raise perl's stack size -- Dominic Dunlop <domo@tcp.ip.lu> 970922
38 # Reinstate sigsetjmp iff version is 4.0.3 or greater; use nm
39 # (assumes Configure change); prune libswanted -- Dominic Dunlop 970113
40 # Warn about test failure due to old Berkeley db -- Dominic Dunlop 970105
41 # Do not use perl's malloc; SysV IPC OK -- Neil Cutcliffe, Tenon 961030
42 # File::Find's use of link count disabled by Dominic Dunlop 960528
43 # Perl's use of sigsetjmp etc. disabled by Dominic Dunlop 960521
44 #
45 # Comments, questions, and improvements welcome!
46 #
47 # MachTen 4.1.1's support for shadow password file access is incomplete:
48 # disable its use completely.
49 d_getspnam=${d_getspnam:-undef}
50
51 # MachTen 4.1.1 does support dynamic loading, but perl doesn't
52 # know how to use it yet.
53 usedl=${usedl:-undef}
54
55 # MachTen 4.1.1 may have an unhelpful hack in /usr/include/signal.h.
56 # Undo it if so.
57 if grep NOTDEF_MACHTEN /usr/include/signal.h > /dev/null
58 then
59     ccflags="$ccflags -DNOTDEF_MACHTEN"
60 fi
61
62 # Power MachTen is a real memory system and its standard malloc
63 # has been optimized for this. Using this malloc instead of Perl's
64 # malloc may result in significant memory savings.  In particular,
65 # unlike most UNIX memory allocation subsystems, MachTen's free()
66 # really does return unneeded process data memory to the system.
67 # However, MachTen's malloc() is woefully slow -- maybe 100 times
68 # slower than perl's own, so perl's own is usually the better
69 # choice.  In order to use perl's malloc(), the sbrk() system call
70 # must be simulated using MachTen's malloc().  See malloc.c for
71 # precise details of how this is achieved.  Recent improvements
72 # to perl's malloc() currently crash MachTen, and so are disabled
73 # by -DPLAIN_MALLOC and -DNO_FANCY_MALLOC.
74 usemymalloc=${usemymalloc:-y}
75
76 # Older versions of MachTen malloc() data on a two-byte boundary, which
77 # works, but slows down operations on long, float and double data.
78 # Perl's malloc() can compensate if SYSTEM_ALLOC_ALIGNMENT is suitably
79 # defined.
80 if expr "$osvers" \< "4.1" >/dev/null
81 then
82 system_alloc_alignment=" -DSYSTEM_ALLOC_ALIGNMENT=2"
83 fi
84 # Do not wrap the following long line
85 malloc_cflags='ccflags="$ccflags -DPLAIN_MALLOC -DNO_FANCY_MALLOC -DUSE_PERL_SBRK$system_alloc_alignment"'
86
87 # When MachTen does a fork(), it immediately copies the whole of
88 # the parent process' data space for the child.  This can be
89 # expensive.  Using vfork() where appropriate avoids this cost.
90 d_vfork=${d_vfork:-define}
91
92 # Specify a high level of optimization (-O3 wouldn't do much more)
93 optimize=${optimize:--O2 -fomit-frame-pointer}
94
95 # Make symbol table listings les voluminous
96 nmopts=-gp
97
98 # Set reg_infty -- the maximum allowable number of repeats in regular
99 # expressions such as  /a{1,$max_repeats}/, and the maximum number of
100 # times /a*/ will match.  Setting this too high without having a stack
101 # large enough to accommodate deep recursion in the regular expression
102 # engine allows perl to crash your Mac due to stack overrun if it
103 # encounters a pathological regular expression.  The default is a
104 # compromise between capability and required stack size (see below).
105 # You may override the default value from the Configure command-line
106 # like this:
107 #
108 #   Configure -Dreg_infty=16368 ...
109
110 reg_infty=${reg_infty:-2047}
111
112 # If you want to have many perl processes active simultaneously --
113 # processing CGI forms -- for example, you should opt for a small stack.
114 # For safety, you should set reg_infty no larger than the corresponding
115 # value given in this table:
116 #
117 # Stack size  reg_infty value supported
118 # ----------  -------------------------
119 # 128k        2**8-1    (256)
120 # 256k        2**9-1    (511)
121 # 512k        2**10-1  (1023)
122 #   1M        2**11-1  (2047)
123 # ...
124 #  16M        2**15-1 (32767) (perl's default value)
125
126 # This script selects a safe stack size based on the value of reg_infty
127 # specified above.  However, you may choose to take a risk and set
128 # stack size lower: pathological regular expressions are rare in real-world
129 # programs.  But be aware that, if perl does encounter one, it WILL
130 # crash your system.  Do not set stack size lower than 96k unless
131 # you want perl's installation tests ( make test ) to crash your system.
132 #
133 # You may override the default value from the Configure command-line
134 # by specifying the required size in kilobytes like this:
135 #
136 #   Configure -Dstack_size=96
137
138 if [ "X$stack_size" = 'X' ]
139 then
140     stack_size=128
141     X=`expr $reg_infty / 256`
142
143     while [ $X -gt 0 ]
144     do
145         X=`expr $X / 2`
146         stack_size=`expr $stack_size \* 2`
147     done
148     X=`expr $stack_size \* 1024`
149 fi
150
151 ldflags="$ldflags -Xlstack=$X"
152 ccflags="$ccflags -DREG_INFTY=$reg_infty"
153
154 # Install in /usr/local by default
155 prefix='/usr/local'
156
157 # At least on PowerMac, doubles must be aligned on 8 byte boundaries.
158 # I don't know if this is true for all MachTen systems, or how to
159 # determine this automatically.
160 alignbytes=8
161
162 # 4.0.2 and earlier had a problem with perl's use of sigsetjmp and
163 # friends.  Use setjmp and friends instead.
164 expr "$osvers" \< "4.0.3" > /dev/null && d_sigsetjmp='undef'
165
166 # System V IPC before MachTen 4.1.4 is incomplete (missing msg function
167 # prototypes, no ftok()), buggy (semctl(.., ..,  IPC_STATUS, ..) hangs
168 # system), and undocumented.  Claim it's not there at all before 4.1.4.
169 if expr "$osvers" \< "4.1.4" >/dev/null
170 then
171 d_msg=${d_msg:-undef}
172 d_sem=${d_sem:-undef}
173 d_shm=${d_shm:-undef}
174 fi
175
176
177 # As of MachTen 4.1.4 the msg* and shm* are in libc but unimplemented
178 # (an attempt to use them causes a runtime error)
179 # XXX Configure probe for really functional msg*() is needed XXX
180 # XXX Configure probe for really functional shm*() is needed XXX
181 if test "$d_msg" = ""; then
182     d_msgget=${d_msgget:-undef}
183     d_msgctl=${d_msgctl:-undef}
184     d_msgsnd=${d_msgsnd:-undef}
185     d_msgrcv=${d_msgrcv:-undef}
186     case "$d_msgget$d_msgsnd$d_msgctl$d_msgrcv" in
187     *"undef"*) d_msg="$undef" ;;
188     esac
189 fi
190 if test "$d_shm" = ""; then
191     d_shmat=${d_shmat:-undef}
192     d_shmdt=${d_shmdt:-undef}
193     d_shmget=${d_shmget:-undef}
194     d_shmctl=${d_shmctl:-undef}
195     case "$d_shmat$d_shmctl$d_shmdt$d_shmget" in
196     *"undef"*) d_shm="$undef" ;;
197     esac
198 fi
199
200 # Get rid of some extra libs which it takes Configure a tediously
201 # long time never to find on MachTen, or which break perl
202 set `echo X "$libswanted "|sed -e 's/ net / /' -e 's/ socket / /' \
203     -e 's/ inet / /' -e 's/ nsl / /' -e 's/ nm / /' -e 's/ malloc / /' \
204     -e 's/ ld / /' -e 's/ sun / /' -e 's/ posix / /' \
205     -e 's/ cposix / /' -e 's/ crypt / /' -e 's/ dl / /' -e 's/ dld / /' \
206     -e 's/ ucb / /' -e 's/ bsd / /' -e 's/ BSD / /' -e 's/ PW / /'`
207 shift
208 libswanted="$*"
209
210 # While link counts on MachTen 4.1's fast file systems work correctly,
211 # on Macintosh Heirarchical File Systems, (and on HFS+)
212 # MachTen always reports ony two links to directories, even if they
213 # contain subdirectories.  Consequently, we use this variable to stop
214 # File::Find using the link count to determine whether there are
215 # subdirectories to be searched.  This will generate a harmless message:
216 # Hmm...You had some extra variables I don't know about...I'll try to keep 'em.
217 #       Propagating recommended variable dont_use_nlink
218 dont_use_nlink=define
219
220 cat <<EOM >&4
221
222 During Configure, you may see the message
223
224 *** WHOA THERE!!! ***
225     The recommended value for \$d_msg on this machine was "undef"!
226     Keep the recommended value? [y]
227
228 as well as similar messages concerning \$d_sem and \$d_shm.  Select the
229 default answers: MachTen 4.1 appears to provide System V IPC support,
230 but it is incomplete and buggy: perl should be built without it.
231
232 Similarly, when you see
233
234 *** WHOA THERE!!! ***
235     The recommended value for \$d_vfork on this machine was "define"!
236     Keep the recommended value? [y]
237
238 select the default answer: vfork() works, and avoids expensive data
239 copying.
240
241 You may also see "WHOA THERE!!!" messages concerning \$d_getspnam.
242 Select the default answer: MachTen's support for shadow password
243 file access is incomplete, and should not be used.
244
245 At the end of Configure, you will see a harmless message
246
247 Hmm...You had some extra variables I don't know about...I'll try to keep 'em.
248         Propagating recommended variable dont_use_nlink
249         Propagating recommended variable nmopts
250         Propagating recommended variable malloc_cflags...
251         Propagating recommended variable reg_infty
252         Propagating recommended variable system_alloc_alignment
253 Read the File::Find documentation for more information about dont_use_nlink
254
255 Your perl will be built with a stack size of ${stack_size}k and a regular
256 expression repeat count limit of $reg_infty.  If you want alternative
257 values, see the file hints/machten.sh for advice on how to change them.
258
259 Tests
260         io/fs test 4  and
261         op/stat test 3
262 may fail since MachTen may not return a useful nlinks field to stat
263 on directories.
264
265 EOM
266 expr "$osvers" \< "4.1" >/dev/null && test -r ./broken-db.msg && \
267     . ./broken-db.msg
268
269 unset stack_size X