PATCH 5.6 perldebguts grammar cleanup
[p5sagit/p5-mst-13.2.git] / hints / machten.sh
CommitLineData
0f297bd8 1#! /bin/bash
fec02dd3 2# machten.sh
0f297bd8 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
db90f03e 5#
a55e790a 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.
db90f03e 8#
9# MachTen 2.x has its own hint file.
10#
0f297bd8 11# The original version of this file was put together by Andy Dougherty
db90f03e 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>
baf67fda 17#
0f297bd8 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
7ecd88f1 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
e060872b 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
911efb05 28# Completely disable SysV IPC pending more complete support from Tenon
29# -- Dominic Dunlop <domo@computer.org> 980712
38ac2dc8 30# Use vfork and perl's malloc by default
31# -- Dominic Dunlop <domo@computer.org> 980630
83e898de 32# Raise perl's stack size again; cut down reg_infty; document
33# -- Dominic Dunlop <domo@computer.org> 980619
2ff233fa 34# Use of semctl() can crash system: disable -- Dominic Dunlop 980506
da9788ee 35# Raise stack size further; slight tweaks to accomodate MT 4.1
36# -- Dominic Dunlop <domo@computer.org> 980211
a55e790a 37# Raise perl's stack size -- Dominic Dunlop <domo@tcp.ip.lu> 970922
44a8e56a 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
55497cff 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
db90f03e 44#
fec02dd3 45# Comments, questions, and improvements welcome!
46#
7ecd88f1 47# MachTen 4.1.1's support for shadow password file access is incomplete:
48# disable its use completely.
7ecd88f1 49d_getspnam=${d_getspnam:-undef}
7ecd88f1 50
e060872b 51# MachTen 4.1.1 does support dynamic loading, but perl doesn't
db90f03e 52# know how to use it yet.
e060872b 53usedl=${usedl:-undef}
54
55# MachTen 4.1.1 may have an unhelpful hack in /usr/include/signal.h.
56# Undo it if so.
57if grep NOTDEF_MACHTEN /usr/include/signal.h > /dev/null
58then
59 ccflags="$ccflags -DNOTDEF_MACHTEN"
60fi
55497cff 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
38ac2dc8 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.
74usemymalloc=${usemymalloc:-y}
75
0f297bd8 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.
80if expr "$osvers" \< "4.1" >/dev/null
81then
82system_alloc_alignment=" -DSYSTEM_ALLOC_ALIGNMENT=2"
83fi
38ac2dc8 84# Do not wrap the following long line
0f297bd8 85malloc_cflags='ccflags="$ccflags -DPLAIN_MALLOC -DNO_FANCY_MALLOC -DUSE_PERL_SBRK$system_alloc_alignment"'
38ac2dc8 86
38ac2dc8 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.
90d_vfork=${d_vfork:-define}
91
92# Specify a high level of optimization (-O3 wouldn't do much more)
93optimize=${optimize:--O2 -fomit-frame-pointer}
c07a80fd 94
44a8e56a 95# Make symbol table listings les voluminous
96nmopts=-gp
c07a80fd 97
83e898de 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
110reg_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
138if [ "X$stack_size" = 'X' ]
139then
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
38ac2dc8 148 X=`expr $stack_size \* 1024`
83e898de 149fi
150
83e898de 151ldflags="$ldflags -Xlstack=$X"
152ccflags="$ccflags -DREG_INFTY=$reg_infty"
a55e790a 153
55497cff 154# Install in /usr/local by default
155prefix='/usr/local'
156
db90f03e 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.
160alignbytes=8
baf67fda 161
44a8e56a 162# 4.0.2 and earlier had a problem with perl's use of sigsetjmp and
baf67fda 163# friends. Use setjmp and friends instead.
44a8e56a 164expr "$osvers" \< "4.0.3" > /dev/null && d_sigsetjmp='undef'
165
0f297bd8 166# System V IPC before MachTen 4.1.4 is incomplete (missing msg function
911efb05 167# prototypes, no ftok()), buggy (semctl(.., .., IPC_STATUS, ..) hangs
0f297bd8 168# system), and undocumented. Claim it's not there at all before 4.1.4.
169if expr "$osvers" \< "4.1.4" >/dev/null
170then
911efb05 171d_msg=${d_msg:-undef}
172d_sem=${d_sem:-undef}
173d_shm=${d_shm:-undef}
0f297bd8 174fi
2ff233fa 175
c6c38f61 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
181if 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
189fi
190if 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
198fi
199
44a8e56a 200# Get rid of some extra libs which it takes Configure a tediously
0f297bd8 201# long time never to find on MachTen, or which break perl
44a8e56a 202set `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 / /' \
0f297bd8 205 -e 's/ cposix / /' -e 's/ crypt / /' -e 's/ dl / /' -e 's/ dld / /' \
44a8e56a 206 -e 's/ ucb / /' -e 's/ bsd / /' -e 's/ BSD / /' -e 's/ PW / /'`
207shift
208libswanted="$*"
baf67fda 209
da9788ee 210# While link counts on MachTen 4.1's fast file systems work correctly,
211# on Macintosh Heirarchical File Systems, (and on HFS+)
baf67fda 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
218dont_use_nlink=define
219
83e898de 220cat <<EOM >&4
baf67fda 221
2ff233fa 222During Configure, you may see the message
223
224*** WHOA THERE!!! ***
911efb05 225 The recommended value for \$d_msg on this machine was "undef"!
2ff233fa 226 Keep the recommended value? [y]
227
911efb05 228as well as similar messages concerning \$d_sem and \$d_shm. Select the
229default answers: MachTen 4.1 appears to provide System V IPC support,
230but it is incomplete and buggy: perl should be built without it.
baf67fda 231
38ac2dc8 232Similarly, 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
238select the default answer: vfork() works, and avoids expensive data
239copying.
240
d722968f 241You may also see "WHOA THERE!!!" messages concerning \$d_getspnam.
242Select the default answer: MachTen's support for shadow password
243file access is incomplete, and should not be used.
7ecd88f1 244
baf67fda 245At the end of Configure, you will see a harmless message
246
247Hmm...You had some extra variables I don't know about...I'll try to keep 'em.
248 Propagating recommended variable dont_use_nlink
44a8e56a 249 Propagating recommended variable nmopts
38ac2dc8 250 Propagating recommended variable malloc_cflags...
83e898de 251 Propagating recommended variable reg_infty
0f297bd8 252 Propagating recommended variable system_alloc_alignment
44a8e56a 253Read the File::Find documentation for more information about dont_use_nlink
baf67fda 254
83e898de 255Your perl will be built with a stack size of ${stack_size}k and a regular
256expression repeat count limit of $reg_infty. If you want alternative
257values, see the file hints/machten.sh for advice on how to change them.
258
2ff233fa 259Tests
260 io/fs test 4 and
261 op/stat test 3
262may fail since MachTen may not return a useful nlinks field to stat
263on directories.
264
baf67fda 265EOM
2ff233fa 266expr "$osvers" \< "4.1" >/dev/null && test -r ./broken-db.msg && \
267 . ./broken-db.msg
83e898de 268
269unset stack_size X