This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Win32: try to make the new stat pre-Vista compatible
[perl5.git] / hints / os390.sh
1 # hints/os390.sh
2 #
3 # OS/390 hints by David J. Fiander <davidf@mks.com>
4 #
5 # OS/390 OpenEdition Release 3 Mon Sep 22 1997 thanks to:
6
7 #     John Goodyear <johngood@us.ibm.com>
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>
12 #     Andy Dougherty  <doughera@lafayette.edu>
13 #     Tim Bunce  <Tim.Bunce@ig.co.uk>
14 #
15 #  as well as the authors of the aix.sh file
16 #
17
18 # To get ANSI C, we need to use c89, and ld doesn't exist
19 # You can override this with Configure -Dcc=gcc -Dld=ld.
20 case "$cc" in
21 '') cc='c99' ;;
22 esac
23 case "$ld" in
24 '') ld='c99' ;;
25 esac
26
27 # -DMAXSIG=39 maximum signal number
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.
32 # YYDYNAMIC ensures that the OS/390 yacc generated parser is reentrant.
33 # -DEBCDIC should come from Configure and need not be mentioned here.
34 # Prepend your favorites with Configure -Dccflags=your_favorites
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'
38 case "$ccflags" in
39 '') ccflags="$def_os390_cflags $def_os390_defs"  ;;
40 *)  ccflags="$ccflags $def_os390_cflags $def_os390_defs" ;;
41 esac
42
43 # Turning on optimization breaks perl.
44 # You can override this with Configure -Doptimize='-O' or somesuch.
45 case "$optimize" in
46 '') optimize=' ' ;;
47 esac
48
49 # To link via definition side decks we need the dll option
50 # You can override this with Configure -Ucccdlflags or somesuch.
51 case "$cccdlflags" in
52 '') cccdlflags='-qxplink -qdll -qexportall -Wc,XPLINK,dll,EXPORTALL -Wl,XPLINK,dll' ;;
53 esac
54
55 case "$so" in
56 '') so='a' ;;
57 esac
58
59 case "$alignbytes" in
60 '') alignbytes=8 ;;
61 esac
62
63 case "$usemymalloc" in
64 '') usemymalloc='n' ;;
65 esac
66
67 # On OS/390, libc.a doesn't really hold anything at all,
68 # so running nm on it is pretty useless.
69 # You can override this with Configure -Dusenm.
70 case "$usenm" in
71 '') usenm='false' ;;
72 esac
73
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'.
77 case "$ldflags" in
78 '') ldflags='-qxplink -qdll -Wl,XPLINK,dll' ;;
79 esac
80 case "$optimize" in
81 *-g*) ;;
82 *)  ldflags="$ldflags -Wl,EDIT=NO"
83 esac
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:
89 #  Configure -Dusedl -Ddlext=so -Ddlsrc=dl_dllload.xs.
90 case "$usedl" in
91 '')
92     usedl='n' 
93     case "$dlext" in
94     '') dlext='none' ;;
95     esac
96     ;;
97 define)
98     case "$useshrplib" in
99     '') useshrplib='true' ;;
100     esac
101     case "$dlsrc" in
102     '') dlsrc='dl_dllload.xs' ;;
103     esac
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"
120     ccflags="$ccflags -D_SHR_ENVIRON -DPERL_EXTERNAL_GLOB -qexportall -qdll -qxplink"
121     cccdlflags='-c -qexportall -qxplink -qdll -Wc,XPLINK,dll,EXPORTALL -Wl,XPLINK,dll'
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.
124     ccdlflags="-qxplink -qdll -Wl,XPLINK,dll `pwd`/libperl.x"
125     lddlflags="-qxplink -qdll -Wl,XPLINK,dll `pwd`/libperl.x"
126     ;;
127 esac
128 # even on static builds using LIBPATH should be OK.
129 case "$ldlibpthname" in
130 '') ldlibpthname=LIBPATH ;;
131 esac
132
133 # The following should always be used
134 d_oldpthreads='define'
135
136 # Header files to include.
137 # You can override these with Configure -Ui_time -Ui_systime -Dd_pthread_atfork.
138 case "$i_time" in
139 '') i_time='define' ;;
140 esac
141 case "$i_systime" in
142 '') i_systime='define' ;;
143 esac
144 case "$d_pthread_atfork" in
145 '') d_pthread_atfork='undef' ;;
146 esac
147 case "$d_pthread_atfork" in                                                  
148 '') d_pthread_atfork='undef' ;;                                              
149 esac                                                                         
150
151 # (from aix.sh)
152 # uname -m output is too specific and not appropriate here
153 # osname should come from Configure
154 # You can override this with Configure -Darchname='s390' but please don't.
155 case "$archname" in
156 '') archname="$osname" ;;
157 esac
158
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.
166 case "$usedl" in
167 define)
168 echo '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
169     ;;
170 *)
171 echo '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
172     ;;
173 esac
174
175 #
176 # Note that Makefile.SH employs a bare yacc command to generate 
177 # perly.[hc], hence you may wish to:
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 #
188 if 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
194 Warning.  You do not have a copy of yyparse.c, the default 
195 yacc parser template file, in place in /etc.
196 EOWARN
197         if test -e /samples/yyparse.c ; then
198             cat <<EOWARN >&4
199
200 There does appear to be a template file in /samples though.
201 Please run:
202
203       cp /samples/yyparse.c /etc
204
205 before attempting to Configure the build of $package.
206
207 EOWARN
208         else
209             cat <<EOWARN >&4
210
211 There does not appear to be one in /samples either.  
212 If you feel you can make use of an alternate yacc-like 
213 parser generator then please read the comments in the
214 hints/os390.sh file carefully.
215
216 EOWARN
217         fi
218         exit 1
219     fi
220 fi
221
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'.
225 # The -W 0,float(ieee) seems to be the switch breaking gcvt().
226 # sprintf() seems to get things right(er).
227 gconvert_preference=sprintf
228
229 # Configure gets these wrong for some reason.
230 d_gethostbyaddr_r='undef'
231 d_gethostbyname_r='undef'
232 d_gethostent_r='undef'
233
234 # The z/OS C 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
245 d_attribute_deprecated='undef'
246 d_attribute_format='undef'
247 d_attribute_malloc='undef'
248 d_attribute_nonnull='undef'
249 d_attribute_noreturn='undef'
250 d_attribute_pure='undef'
251 d_attribute_unused='undef'
252 d_attribute_warn_unused_result='undef'
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
261 d_nan='undef'
262
263 # Configures says this exists, but it doesn't work properly.  See
264 # <54DCE073.4010100@khwilliamson.com>
265 d_dir_dd_fd='undef'