This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Bump the perl version in various places for 5.35.7
[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 # It is too late in Configure by the time this is called to change the
19 # compiler.  But xlc or synonyms are the only thing that likely currently will
20 # work.
21 #
22 # But it isn't too late to change 'ld', and the z/OS 390 ld command doesn't
23 # understand some command line options like -W and -q that the loader needs to
24 # know about.  xlc also acts like a loader and does understand them.
25 case "$ld" in
26 '') ld='xlc' ;;
27 esac
28
29 # khw thinks these -W options are obsolete, at least the -Wc, where the 'c'
30 # indicates it goes to the compiler.  It appears that since these were written,
31 # IBM added the -q series of options to the compiler, which khw thinks should
32 # be sufficient.  -Wl are for the loader, and may be required.
33 os390_Wc="-Wc"
34 os390_Wl="-Wl"
35
36 # -DEBCDIC should come from Configure and need not be mentioned here.
37 # Prepend your favorites with Configure -Dccflags=your_favorites
38
39 # This overrides the name the compiler was called with.  'ext' is required for
40 # "unicode literals" to be enabled
41 def_os390_cflags='-qlanglvl=extc99';
42
43 def_os390_cflags="$def_os390_cflags -qlongname";    # khw thinks this is obsolete
44 def_os390_cflags="$def_os390_cflags -qfloat=ieee";  # khw thinks this is obsolete
45
46 # xplink = eXtended Performance linking: "Uses a z/OS linkage specifically
47 # designed to increase performance."
48 def_os390_cflags="$def_os390_cflags -qxplink";
49 def_os390_cccdlflags="-qxplink"
50 def_os390_ldflags="-qxplink"
51 os390_Wc="$os390_Wc,XPLINK"
52 os390_Wl="$os390_Wl,XPLINK"
53
54 # Without this, you get "IEW2689W 4C40 DEFINITION SIDE FILE IS NOT DEFINED."
55 os390_Wl="$os390_Wl,dll"
56
57 # Exports all externally defined functions and variables in the compilation
58 # unit so that a DLL application can use them."
59 def_os390_cflags="$def_os390_cflags -qexportall";
60 def_os390_cccdlflags="$def_os390_cccdlflags -qexportall"
61 os390_Wc="$os390_Wc,EXPORTALL"
62
63 # 3296= #include file not found;
64 # 4108= The use of keyword &1 is non-portable
65 #       We care about this because it
66 #       actually means it didn't do what we expected. e.g.,
67 #          INFORMATIONAL CCN4108 ./proto.h:4534 The use of keyword '__attribute__' is non-portable.
68 def_os390_cflags="$def_os390_cflags -qhaltonmsg=3296:4108"
69
70 # Combinte the -W flags with the rest
71 def_os390_cflags="$def_os390_cflags $os390_Wc";
72 def_os390_cflags="$def_os390_cflags $os390_Wl";
73
74 def_os390_cccdlflags="$def_os390_cccdlflags $os390_Wc";
75 def_os390_cccdlflags="$def_os390_cccdlflags $os390_Wl";
76
77 def_os390_defs='-DMAXSIG=39';               # maximum signal number; not furnished by IBM
78 def_os390_defs="$def_os390_defs -DOEMVS";   # is used in place of #ifdef __MVS__
79
80 # Turn on POSIX compatibility modes
81 #  https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxbd00/ftms.htm
82 def_os390_defs="$def_os390_defs -D_ALL_SOURCE";
83
84 # defines a BSD-like socket interface for the function prototypes and structures involved
85 def_os390_defs="$def_os390_defs -D_OE_SOCKETS";
86
87 # ensure that the OS/390 yacc generated parser is reentrant.
88 def_os390_defs="$def_os390_defs -DYYDYNAMIC";
89
90 # LC_MESSAGES only affects the yes/no strings in langinfo; not the things we
91 # expect it to
92 def_os390_defs="$def_os390_defs -DNO_LOCALE_MESSAGES"
93
94 # Combine -D with cflags
95 case "$ccflags" in
96 '') ccflags="$def_os390_cflags $def_os390_defs"  ;;
97 *)  ccflags="$ccflags $def_os390_cflags $def_os390_defs" ;;
98 esac
99
100 # Turning on optimization causes perl to not even compile from miniperl.  You
101 # can override this with Configure -Doptimize='-O2' or somesuch.
102 case "$optimize" in
103 '') optimize=' ' ;;
104 esac
105
106 # To link via definition side decks we need the dll option
107 # You can override this with Configure -Ucccdlflags or somesuch.
108 case "$cccdlflags" in
109 '') cccdlflags=$def_os390_cccdlflags;;
110 esac
111
112 case "$so" in
113 '') so='a' ;;
114 esac
115
116 case "$alignbytes" in
117 '') alignbytes=8 ;;
118 esac
119
120 case "$usemymalloc" in
121 '') usemymalloc='n' ;;
122 esac
123
124 # On OS/390, libc.a doesn't really hold anything at all,
125 # so running nm on it is pretty useless.
126 # You can override this with Configure -Dusenm.
127 case "$usenm" in
128 '') usenm='false' ;;
129 esac
130
131 case "$ldflags" in
132 '') ldflags="$def_os390_ldflags $os390_Wl";;
133 esac
134
135 # Setting ldflags='-Wl,EDIT=NO' will get rid of the symbol
136 # information at the end of the executable (=> smaller binaries).
137 # Override this option with -Dldflags='whatever else you wanted'.
138 case "$optimize" in
139 *-g*) ;;
140 *)  ldflags="$ldflags -Wl,EDIT=NO"
141 esac
142
143 # In order to build with dynamic be sure to specify:
144 #   Configure -Dusedl
145 # Do not forget to add $archlibexp/CORE to your LIBPATH.
146 # You might want to override some of this with things like:
147 #  Configure -Dusedl -Ddlext=so -Ddlsrc=dl_dllload.xs.
148 case "$usedl" in
149 '')
150    usedl='n'
151    case "$dlext" in
152    '') dlext='none' ;;
153    esac
154    ;;
155 define)
156    case "$useshrplib" in
157    '') useshrplib='true' ;;
158    esac
159    case "$dlsrc" in
160    '') dlsrc='dl_dllload.xs' ;;
161    esac
162    # For performance use 'so' at or beyond v2.8, 'dll' for 2.7 and prior versions
163    case "`uname -v`x`uname -r`" in
164    02x0[89].*|02x1[0-9].*|[0-9][3-9]x*)
165        so='so'
166        case "$dlext" in
167        '') dlext='so' ;;
168        esac
169        ;;
170    *)
171        so='dll'
172        case "$dlext" in
173        '') dlext='dll' ;;
174        esac
175        ;;
176    esac
177    libperl="libperl.$so"
178
179    # Allows char **environ to be accessed from a dynamically loaded
180    # module such as a DLL
181    ccflags="$ccflags -D_SHR_ENVIRON"
182
183    cccdlflags="-c $def_os390_cccdlflags"
184    lddlflags="$def_os390_cccdlflags"
185
186    # The following will need to be modified for the installed libperl.x.
187    # The modification to Config.pm is done by the installperl script after the
188    # build and test.  These are written to a CBU so that the libperl.x file
189    # comes after all the dash-options in the flags.  Configure takes the
190    # lddlflags we give it and looks for paths to libraries to append -L options
191    # to lddlflags.  But this causes the file libperl.x to appear in the final
192    # command line after the -L options.  And z/OS doesn't like filenames after
193    # options.  This CBU defers the adding of libperl.x until after any munging
194    # that Configure does.
195    cat >config.arch <<' EOCBU'
196         case "ccdlflags" in
197         '') ccdlflags="`pwd`/libperl.x" ;;
198          *) ccdlflags="$ccdlflags `pwd`/libperl.x" ;;
199         esac
200         lddlflags="$lddlflags `pwd`/libperl.x"
201         EOCBU
202    ;;
203 esac
204
205 # even on static builds using LIBPATH should be OK.
206 case "$ldlibpthname" in
207 '') ldlibpthname=LIBPATH ;;
208 esac
209
210 # The following should always be used.  Perhaps newer threads will work, but
211 # when khw tried, other things would have had to be changed to get it to work,
212 # so left as-is.
213 d_oldpthreads='define'
214
215 # Header files to include.
216 # You can override these with Configure -Ui_time -Ui_systime -Dd_pthread_atfork.
217 case "$i_time" in
218 '') i_time='define' ;;
219 esac
220 case "$i_systime" in
221 '') i_systime='define' ;;
222 esac
223 case "$d_pthread_atfork" in
224 '') d_pthread_atfork='undef' ;;
225 esac
226
227 # (from aix.sh)
228 # uname -m output is too specific and not appropriate here
229 # osname should come from Configure
230 # You can override this with Configure -Darchname='s390' but please don't.
231 case "$archname" in
232 '') archname="$osname" ;;
233 esac
234
235 # We have our own cppstdin script.  This is not a variable since
236 # Configure sees the presence of the script file.
237 # We put system header -D definitions in so that Configure
238 # can find the shmat() prototype in <sys/shm.h> and various
239 # other things.  Unfortunately, cppflags occurs too late to be of
240 # value external to the script.  This may need to be revisited
241 #
242 # khw believes some of this is obsolete.  DOLLARINNAMES allows '$' in variable
243 # names, for whatever reason
244 # NOLOC says to use the 1047 code page, and no locale
245 case "$usedl" in
246 define)
247 echo 'cat >.$$.c; '"$cc"' -D_OE_SOCKETS -D_ALL_SOURCE -D_SHR_ENVIRON -E -Wc,"LANGLVL(DOLLARINNAMES)",NOLOC ${1+"$@"} .$$.c | fgrep -v "??="; rm .$$.c' > cppstdin
248    ;;
249 *)
250 echo 'cat >.$$.c; '"$cc"' -D_OE_SOCKETS -D_ALL_SOURCE -E -Wc,"LANGLVL(DOLLARINNAMES)",NOLOC ${1+"$@"} .$$.c | fgrep -v "??="; rm .$$.c' > cppstdin
251    ;;
252 esac
253
254 #
255 # Note that Makefile.SH employs a bare yacc command to generate
256 # perly.[hc], hence you may wish to:
257 #
258 #    alias yacc='myyacc'
259 #
260 # Then if you would like to use myyacc and skip past the
261 # following warnings try invoking Configure like so:
262 #
263 #    sh Configure -Dbyacc=yacc
264 #
265 # This trick ought to work even if your yacc is byacc.
266 #
267 if test "X$byacc" = "Xbyacc" ; then
268    if test -e /etc/yyparse.c ; then
269        : we should be OK - perhaps do a test -r?
270    else
271        cat <<EOWARN >&4
272
273 Warning.  You do not have a copy of yyparse.c, the default
274 yacc parser template file, in place in /etc.
275 EOWARN
276        if test -e /samples/yyparse.c ; then
277            cat <<EOWARN >&4
278
279 There does appear to be a template file in /samples though.
280 Please run:
281
282      cp /samples/yyparse.c /etc
283
284 before attempting to Configure the build of $package.
285
286 EOWARN
287        else
288            cat <<EOWARN >&4
289
290 There does not appear to be one in /samples either.
291 If you feel you can make use of an alternate yacc-like
292 parser generator then please read the comments in the
293 hints/os390.sh file carefully.
294
295 EOWARN
296        fi
297        exit 1
298    fi
299 fi
300
301 # These exist, but there is something wrong with either them, or our reentr.[ch],
302 # and no one has felt it important enough to investigate/fix.  The
303 # non-reentrant versions seem to work, but will have races in threads.
304 d_gethostbyaddr_r='undef'
305 d_gethostbyname_r='undef'
306 d_gethostent_r='undef'
307
308 # nan() used to not work as expected: nan("") or nan("0") returned zero, not a
309 # nan.  This may have been a C89 issue.
310 # http://www-01.ibm.com/support/knowledgecenter/SSLTBW_1.12.0/com.ibm.zos.r12.bpxbd00/nan.htm%23nan?lang=en
311 #d_nan='undef'
312
313 # Configure says this exists, but it doesn't work properly.  See
314 # <54DCE073.4010100@khwilliamson.com>
315 d_dir_dd_fd='undef'
316
317 ############################################################################
318 # Thread support
319 # use Configure -Dusethreads to enable
320 # This script UU/usethreads.cbu will get 'called-back' by Configure
321 # after it has prompted the user for whether to use threads.
322 # setlocale() returns NULL if a thread has been created, so we can't use it
323 # generally.  (It would be possible to have it work for initialization, so that
324 # the user could specify a locale for the whole program; but deferring doing
325 # that work until someone wants it)  Maybe IBM will support POSIX 2008 at some
326 # point.  There are hooks that make it look like they were working on it.
327 cat > UU/usethreads.cbu <<'EOCBU'
328 case "$usethreads" in
329 $define|true|[yY]*)
330    echo "Your system's setlocale() is broken under threads; marking it as unavailable" >&4
331    d_setlocale="undef"
332    d_setlocale_accepts_any_locale_name="undef"
333    d_has_C_UTF8="false"
334 esac
335 EOCBU