This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Recent os390 experiences reflected in docs and hints
[perl5.git] / hints / os390.sh
CommitLineData
86339dc9 1# hints/os390.sh
9d116dd7
JH
2#
3# OS/390 hints by David J. Fiander <davidf@mks.com>
4#
86339dc9 5# OS/390 OpenEdition Release 3 Mon Sep 22 1997 thanks to:
ac9901e0
PP
6#
7# John Goodyear <johngood@us.ibm.com>
86339dc9
TB
8# John Pfuntner <pfuntner@vnet.ibm.com>
9# Len Johnson <lenjay@ibm.net>
10# Bud Huff <BAHUFF@us.oracle.com>
11# Peter Prymmer <pvhp@forte.com>
1973dd96 12# Andy Dougherty <doughera@lafayette.edu>
86339dc9
TB
13# Tim Bunce <Tim.Bunce@ig.co.uk>
14#
15# as well as the authors of the aix.sh file
16#
17
9d116dd7 18# To get ANSI C, we need to use c89, and ld doesn't exist
5f912e1c
PP
19# You can override this with Configure -Dcc=gcc -Dld=ld.
20case "$cc" in
9bf21945 21'') cc='c99' ;;
5f912e1c
PP
22esac
23case "$ld" in
9bf21945 24'') ld='c99' ;;
5f912e1c
PP
25esac
26
4144573e 27# -DMAXSIG=39 maximum signal number
5f912e1c
PP
28# -DOEMVS is used in place of #ifdef __MVS__ in certain places.
29# -D_OE_SOCKETS alters system headers.
30# -D_XOPEN_SOURCE_EXTENDEDA alters system headers.
31# c89 hides most of the useful header stuff, _ALL_SOURCE turns it on again.
9d116dd7 32# YYDYNAMIC ensures that the OS/390 yacc generated parser is reentrant.
5f912e1c
PP
33# -DEBCDIC should come from Configure and need not be mentioned here.
34# Prepend your favorites with Configure -Dccflags=your_favorites
92ad49c1
MB
35 def_os390_cflags='-qlanglvl=extended:extc89:extc99 -qlongname -qxplink -qdll -qfloat=ieee -qexportall -qhaltonmsg=3296:4108'
36 def_os390_cflags="$def_os390_cflags -Wc,XPLINK,dll,EXPORTALL -Wl,XPLINK,dll"
37 def_os390_defs='-DMAXSIG=39 -DOEMVS -D_OE_SOCKETS -D_XOPEN_SOURCE_EXTENDED -D_ALL_SOURCE -DYYDYNAMIC -D_POSIX_SOURCE=1'
5f912e1c 38case "$ccflags" in
92ad49c1
MB
39'') ccflags="$def_os390_cflags $def_os390_defs" ;;
40*) ccflags="$ccflags $def_os390_cflags $def_os390_defs" ;;
5f912e1c
PP
41esac
42
43# Turning on optimization breaks perl.
44# You can override this with Configure -Doptimize='-O' or somesuch.
45case "$optimize" in
46'') optimize='none' ;;
47esac
48
5f912e1c
PP
49# To link via definition side decks we need the dll option
50# You can override this with Configure -Ucccdlflags or somesuch.
51case "$cccdlflags" in
92ad49c1 52'') cccdlflags='-qxplink -qdll -qexportall -Wc,XPLINK,dll,EXPORTALL -Wl,XPLINK,dll' ;;
5f912e1c
PP
53esac
54
5f912e1c
PP
55case "$so" in
56'') so='a' ;;
57esac
9d116dd7 58
5f912e1c
PP
59case "$alignbytes" in
60'') alignbytes=8 ;;
61esac
9d116dd7 62
5f912e1c
PP
63case "$usemymalloc" in
64'') usemymalloc='n' ;;
65esac
9d116dd7
JH
66
67# On OS/390, libc.a doesn't really hold anything at all,
68# so running nm on it is pretty useless.
5f912e1c
PP
69# You can override this with Configure -Dusenm.
70case "$usenm" in
71'') usenm='false' ;;
72esac
9d116dd7 73
59c9e5d6
PP
74# Setting ldflags='-Wl,EDIT=NO' will get rid of the symbol
75# information at the end of the executable (=> smaller binaries).
76# Override this option with -Dldflags='whatever else you wanted'.
77case "$ldflags" in
92ad49c1
MB
78'') ldflags='-qxplink -qdll -Wl,XPLINK,dll' ;;
79esac
80case "$optimize" in
81*-g*) ;;
82*) ldflags="$ldflags -Wl,EDIT=NO"
59c9e5d6
PP
83esac
84
85# In order to build with dynamic be sure to specify:
86# Configure -Dusedl
87# Do not forget to add $archlibexp/CORE to your LIBPATH.
88# You might want to override some of this with things like:
ac9901e0 89# Configure -Dusedl -Ddlext=so -Ddlsrc=dl_dllload.xs.
5f912e1c 90case "$usedl" in
ac9901e0
PP
91'')
92 usedl='n'
93 case "$dlext" in
94 '') dlext='none' ;;
95 esac
96 ;;
97define)
98 case "$useshrplib" in
99 '') useshrplib='true' ;;
100 esac
ac9901e0
PP
101 case "$dlsrc" in
102 '') dlsrc='dl_dllload.xs' ;;
103 esac
f2766b05
PP
104 # For performance use 'so' at or beyond v2.8, 'dll' for 2.7 and prior versions
105 case "`uname -v`x`uname -r`" in
106 02x0[89].*|02x1[0-9].*|[0-9][3-9]x*)
107 so='so'
108 case "$dlext" in
109 '') dlext='so' ;;
110 esac
111 ;;
112 *)
113 so='dll'
114 case "$dlext" in
115 '') dlext='dll' ;;
116 esac
117 ;;
118 esac
119 libperl="libperl.$so"
9bf21945 120 ccflags="$ccflags -D_SHR_ENVIRON -DPERL_EXTERNAL_GLOB -qexportall -qdll -qxplink"
92ad49c1 121 cccdlflags='-c -qexportall -qxplink -qdll -Wc,XPLINK,dll,EXPORTALL -Wl,XPLINK,dll'
f2766b05
PP
122 # The following will need to be modified for the installed libperl.x.
123 # The modification to Config.pm is done by the installperl script after the build and test.
92ad49c1
MB
124 ccdlflags="-qxplink -qdll -Wl,XPLINK,dll `pwd`/libperl.x"
125 lddlflags="-qxplink -qdll -Wl,XPLINK,dll `pwd`/libperl.x"
ac9901e0 126 ;;
5f912e1c 127esac
ac9901e0 128# even on static builds using LIBPATH should be OK.
5f912e1c
PP
129case "$ldlibpthname" in
130'') ldlibpthname=LIBPATH ;;
131esac
9d116dd7 132
dca46f05 133# The following should always be used
20b634c2
JH
134d_oldpthreads='define'
135
5f912e1c 136# Header files to include.
20b634c2 137# You can override these with Configure -Ui_time -Ui_systime -Dd_pthread_atfork.
5f912e1c
PP
138case "$i_time" in
139'') i_time='define' ;;
140esac
141case "$i_systime" in
142'') i_systime='define' ;;
143esac
20b634c2
JH
144case "$d_pthread_atfork" in
145'') d_pthread_atfork='undef' ;;
146esac
6cfe8af5
JH
147case "$d_pthread_atfork" in
148'') d_pthread_atfork='undef' ;;
149esac
86339dc9
TB
150
151# (from aix.sh)
152# uname -m output is too specific and not appropriate here
9d116dd7 153# osname should come from Configure
5f912e1c 154# You can override this with Configure -Darchname='s390' but please don't.
86339dc9
TB
155case "$archname" in
156'') archname="$osname" ;;
157esac
158
5f912e1c
PP
159# We have our own cppstdin script. This is not a variable since
160# Configure sees the presence of the script file.
161# We put system header -D definitions in so that Configure
162# can find the shmat() prototype in <sys/shm.h> and various
163# other things. Unfortunately, cppflags occurs too late to be of
164# value external to the script. This may need to be revisited
165# under a compiler other than c89.
f2766b05
PP
166case "$usedl" in
167define)
a4c2c75a 168echo 'cat >.$$.c; '"$cc"' -D_OE_SOCKETS -D_XOPEN_SOURCE_EXTENDED -D_ALL_SOURCE -D_SHR_ENVIRON -E -Wc,"LANGLVL(DOLLARINNAMES)",NOLOC ${1+"$@"} .$$.c | fgrep -v "??="; rm .$$.c' > cppstdin
f2766b05
PP
169 ;;
170*)
a4c2c75a 171echo 'cat >.$$.c; '"$cc"' -D_OE_SOCKETS -D_XOPEN_SOURCE_EXTENDED -D_ALL_SOURCE -E -Wc,"LANGLVL(DOLLARINNAMES)",NOLOC ${1+"$@"} .$$.c | fgrep -v "??="; rm .$$.c' > cppstdin
f2766b05
PP
172 ;;
173esac
23e2eca9
PP
174
175#
5f912e1c 176# Note that Makefile.SH employs a bare yacc command to generate
c67aee7a 177# perly.[hc], hence you may wish to:
23e2eca9
PP
178#
179# alias yacc='myyacc'
180#
181# Then if you would like to use myyacc and skip past the
182# following warnings try invoking Configure like so:
183#
184# sh Configure -Dbyacc=yacc
185#
186# This trick ought to work even if your yacc is byacc.
187#
188if test "X$byacc" = "Xbyacc" ; then
189 if test -e /etc/yyparse.c ; then
190 : we should be OK - perhaps do a test -r?
191 else
192 cat <<EOWARN >&4
193
194Warning. You do not have a copy of yyparse.c, the default
195yacc parser template file, in place in /etc.
196EOWARN
197 if test -e /samples/yyparse.c ; then
198 cat <<EOWARN >&4
199
200There does appear to be a template file in /samples though.
201Please run:
202
203 cp /samples/yyparse.c /etc
204
205before attempting to Configure the build of $package.
206
207EOWARN
208 else
209 cat <<EOWARN >&4
210
211There does not appear to be one in /samples either.
212If you feel you can make use of an alternate yacc-like
213parser generator then please read the comments in the
214hints/os390.sh file carefully.
215
216EOWARN
217 fi
218 exit 1
219 fi
220fi
221
eecdb66e
JH
222# Most of the time gcvt() seems to work fine but
223# sometimes values like 0.1, 0.2, come out as "10", "20",
224# a trivial Perl demonstration snippet is 'print 0.1'.
1f361dc9 225# The -W 0,float(ieee) seems to be the switch breaking gcvt().
eecdb66e 226# sprintf() seems to get things right(er).
aade5aff 227gconvert_preference=sprintf
eecdb66e 228
4144573e
JH
229# Configure gets these wrong for some reason.
230d_gethostbyaddr_r='undef'
231d_gethostbyname_r='undef'
232d_gethostent_r='undef'
233
636a024b
AD
234# The z/OS C compiler compiler supports the attribute keyword, but in a
235# limited manner.
236#
237# Ideally, Configure's tests should test the attributes as they are expected
238# to be used in perl, and, ideally, those tests would fail on z/OS.
239# Until then, just tell Configure to ignore the attributes. Currently,
240# Configure thinks attributes are supported because it does not recognize
241# warning messages like this:
242#
243# INFORMATIONAL CCN4108 ./proto.h:4534  The use of keyword '__attribute__' is non-portable.
244
245d_attribute_deprecated='undef'
246d_attribute_format='undef'
247d_attribute_malloc='undef'
248d_attribute_nonnull='undef'
249d_attribute_noreturn='undef'
250d_attribute_pure='undef'
251d_attribute_unused='undef'
252d_attribute_warn_unused_result='undef'
d3ac2b76
JH
253
254# nan() is in libm but doesn't work as expected: nan("") or nan("0")
255# returns zero, not a nan:
256# http://www-01.ibm.com/support/knowledgecenter/SSLTBW_1.12.0/com.ibm.zos.r12.bpxbd00/nan.htm%23nan?lang=en
257# contrast with e.g.
258# http://www.cplusplus.com/reference/cmath/nan-function/
259# (C++ but C99 math agrees)
260# XXX: Configure scan for proper behavior
261d_nan='undef'
cc404f89
KW
262
263# Configures says this exists, but it doesn't work properly. See
264# <54DCE073.4010100@khwilliamson.com>
265d_dir_dd_fd='undef'