3 # OS/390 hints by David J. Fiander <davidf@mks.com>
5 # OS/390 OpenEdition Release 3 Mon Sep 22 1997 thanks to:
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>
15 # as well as the authors of the aix.sh file
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
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.
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.
36 # -DEBCDIC should come from Configure and need not be mentioned here.
37 # Prepend your favorites with Configure -Dccflags=your_favorites
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';
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
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"
54 # Without this, you get "IEW2689W 4C40 DEFINITION SIDE FILE IS NOT DEFINED."
55 os390_Wl="$os390_Wl,dll"
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"
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"
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";
74 def_os390_cccdlflags="$def_os390_cccdlflags $os390_Wc";
75 def_os390_cccdlflags="$def_os390_cccdlflags $os390_Wl";
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__
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";
84 # defines a BSD-like socket interface for the function prototypes and structures involved
85 def_os390_defs="$def_os390_defs -D_OE_SOCKETS";
87 # ensure that the OS/390 yacc generated parser is reentrant.
88 def_os390_defs="$def_os390_defs -DYYDYNAMIC";
90 # LC_MESSAGES only affects the yes/no strings in langinfo; not the things we
92 def_os390_defs="$def_os390_defs -DNO_LOCALE_MESSAGES"
94 # Combine -D with cflags
96 '') ccflags="$def_os390_cflags $def_os390_defs" ;;
97 *) ccflags="$ccflags $def_os390_cflags $def_os390_defs" ;;
100 # Turning on optimization causes perl to not even compile from miniperl. You
101 # can override this with Configure -Doptimize='-O2' or somesuch.
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;;
116 case "$alignbytes" in
120 case "$usemymalloc" in
121 '') usemymalloc='n' ;;
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.
132 '') ldflags="$def_os390_ldflags $os390_Wl";;
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'.
140 *) ldflags="$ldflags -Wl,EDIT=NO"
143 # In order to build with dynamic be sure to specify:
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.
156 case "$useshrplib" in
157 '') useshrplib='true' ;;
160 '') dlsrc='dl_dllload.xs' ;;
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*)
177 libperl="libperl.$so"
179 # Allows char **environ to be accessed from a dynamically loaded
180 # module such as a DLL
181 ccflags="$ccflags -D_SHR_ENVIRON"
183 cccdlflags="-c $def_os390_cccdlflags"
184 lddlflags="$def_os390_cccdlflags"
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'
197 '') ccdlflags="`pwd`/libperl.x" ;;
198 *) ccdlflags="$ccdlflags `pwd`/libperl.x" ;;
200 lddlflags="$lddlflags `pwd`/libperl.x"
205 # even on static builds using LIBPATH should be OK.
206 case "$ldlibpthname" in
207 '') ldlibpthname=LIBPATH ;;
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,
213 d_oldpthreads='define'
215 # Header files to include.
216 # You can override these with Configure -Ui_time -Ui_systime -Dd_pthread_atfork.
218 '') i_time='define' ;;
221 '') i_systime='define' ;;
223 case "$d_pthread_atfork" in
224 '') d_pthread_atfork='undef' ;;
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.
232 '') archname="$osname" ;;
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
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
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
250 echo 'cat >.$$.c; '"$cc"' -D_OE_SOCKETS -D_ALL_SOURCE -E -Wc,"LANGLVL(DOLLARINNAMES)",NOLOC ${1+"$@"} .$$.c | fgrep -v "??="; rm .$$.c' > cppstdin
255 # Note that Makefile.SH employs a bare yacc command to generate
256 # perly.[hc], hence you may wish to:
258 # alias yacc='myyacc'
260 # Then if you would like to use myyacc and skip past the
261 # following warnings try invoking Configure like so:
263 # sh Configure -Dbyacc=yacc
265 # This trick ought to work even if your yacc is byacc.
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?
273 Warning. You do not have a copy of yyparse.c, the default
274 yacc parser template file, in place in /etc.
276 if test -e /samples/yyparse.c ; then
279 There does appear to be a template file in /samples though.
282 cp /samples/yyparse.c /etc
284 before attempting to Configure the build of $package.
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.
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'
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
313 # Configure says this exists, but it doesn't work properly. See
314 # <54DCE073.4010100@khwilliamson.com>
317 ############################################################################
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
330 echo "Your system's setlocale() is broken under threads; marking it as unavailable" >&4
332 d_setlocale_accepts_any_locale_name="undef"