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