xref: /openbsd-src/gnu/usr.bin/perl/hints/posix-bc.sh (revision 898184e3e61f9129feb5978fad5a8c6865f00b92)
155745691Smillert:
2c8ca9003Smillert# hints/posix-bc.sh
3c8ca9003Smillert#
4c8ca9003Smillert# BS2000 (Posix Subsystem) hints by Thomas Dorner <Thomas.Dorner@start.de>
5c8ca9003Smillert#
655745691Smillert# Thanks to the authors of the os390.sh for the very first draft.
7c8ca9003Smillert#
855745691Smillert# You can modify almost any parameter set here using Configure with
955745691Smillert# the appropriate -D option.
10c8ca9003Smillert
1155745691Smillert# remove this line if dynamic libraries are working for you:
1255745691Smillert bs2000_ignoredl='y'
1355745691Smillert
1455745691Smillert# To get ANSI C, we need to use c89
1555745691Smillert# You can override this with Configure -Dcc=gcc
1655745691Smillert# (if you ever get a gcc ported to BS2000 ;-).
17c48bdce4Smillertcase "$cc" in
18c48bdce4Smillert'') cc='c89' ;;
19c48bdce4Smillertesac
20c8ca9003Smillert
21c8ca9003Smillert# C-Flags:
22c48bdce4Smillert# -DPOSIX_BC
23c48bdce4Smillert# -DUSE_PURE_BISON
24c48bdce4Smillert# -D_XOPEN_SOURCE_EXTENDED alters system headers.
25c48bdce4Smillert# Prepend your favorites with Configure -Dccflags=your_favorites
261b0c1ed8Smillertccflags="$ccflags -Kc_names_unlimited,enum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSIX_BC -DUSE_PURE_BISON -DYYMAXDEPTH=65000 -DYYINITDEPTH=1000 -D_XOPEN_SOURCE_EXTENDED"
2755745691Smillert
2855745691Smillert# Now, what kind of BS2000 system are we running on?
2955745691Smillertecho
3055745691Smillertif [ -n "`bs2cmd SHOW-SYSTEM-INFO | egrep 'HSI-ATT.*TYPE.*SR'`" ]; then
3155745691Smillert    echo "You are running a BS2000 machine with Sunrise CPUs."
3255745691Smillert    echo "Let's hope you have the matching RISC compiler as well."
3355745691Smillert    ccflags="-K risc_4000 $ccflags"
3455745691Smillert    bs2000_ldflags='-K risc_4000'
3555745691Smillertelse
3655745691Smillert    echo "Seems like a standard 390 BS2000 machine to me."
3755745691Smillert    bs2000_ldflags=''
3855745691Smillertfi
3955745691Smillertecho
4055745691Smillertif [ -z "$bs2000_ignoredl" -a -e /usr/lib/libdl.a ]; then
4155745691Smillert    echo "Wow, your BS2000 is State Of The Art and seems to support dynamic libraries."
4255745691Smillert    echo "I just can't resist giving them a try."
4355745691Smillert    bs2000_lddlflags='-Bsymbolic -Bdynamic'
4455745691Smillert    # dynamic linkage of system libraries gave us runtime linker
4555745691Smillert    # errors, so we use static linkage while generating our DLLs :-(
4655745691Smillert#    bs2000_lddlflags='-Bstatic'
4755745691Smillert    bs2000_so='none'
4855745691Smillert    bs2000_usedl='define'
4955745691Smillert    bs2000_dlext='so'
5055745691Smillert    case $bs2000_ldflags in
5155745691Smillert	*risc_4000*)
5255745691Smillert	    bs2000_ld="perl_genso"
5355745691Smillert	    echo "
54*898184e3SsthenNow you must buy everything they sell you, mustn't you?
5555745691SmillertDidn't somebody tell you that RISC machines and dynamic library support gives
5655745691Smillertyou helluva lot of configuration problems at the moment?
5755745691SmillertSigh.  Now you'll expect me to fix it for you, eh?
5855745691SmillertOK, OK, I'll give you a wrapper.
5955745691SmillertJust copy $bs2000_ld anywhere into your path before you try to install
6055745691Smillertadditional modules!"
6155745691Smillert
6255745691Smillertcat > $bs2000_ld <<EOF
6355745691Smillert#! /bin/sh
6455745691Smillert#
6555745691Smillert# Perl's wrapper for genso by Thomas.Dorner@start.de
6655745691Smillert
6755745691Smillert GENSO=/usr/bin/genso
6855745691Smillert options=""
6955745691Smillert params=""
7055745691Smillertwhile [[ \$# -gt 0 ]]; do
7155745691Smillert    case \$1 in
7255745691Smillert	-K)
7355745691Smillert	    shift
7455745691Smillert	    ;;
7555745691Smillert	-K*)
7655745691Smillert	    ;;
7755745691Smillert	*.a)
7855745691Smillert	    lib=\${1##*/lib}
7955745691Smillert	    options="\$options -L\${1%/lib*.a} -l\${lib%.a}"
8055745691Smillert	    ;;
8155745691Smillert	*.o)
8255745691Smillert	    params="\$params \$1"
8355745691Smillert	    ;;
8455745691Smillert	*)
8555745691Smillert	    options="\$options \$1"
8655745691Smillert    esac
8755745691Smillert    shift
8855745691Smillertdone
8955745691Smillertecho \$GENSO \$options \$params
9055745691Smillertexec \$GENSO \$options \$params
9155745691SmillertEOF
9255745691Smillert
9355745691Smillert	    chmod +x $bs2000_ld
9455745691Smillert	    if [[ -w /usr/local/bin && ! -f /usr/local/bin/$bs2000_ld ]]; then
9555745691Smillert		cp -p $bs2000_ld /usr/local/bin/$bs2000_ld
9655745691Smillert		echo "(Actually I just did that as well, have a look into /usr/local/bin.)"
9755745691Smillert	    fi
9855745691Smillert	    ;;
9955745691Smillert	*)
10055745691Smillert	    bs2000_ld='genso'
10155745691Smillert    esac
10255745691Smillertelse
10355745691Smillert    if [ -e /usr/lib/libdl.a ]; then
10455745691Smillert	echo "Your BS2000 supports dynamic libraries, but you (or we ;-) decided to leave them alone."
10555745691Smillert    else
10655745691Smillert	echo "Your BS2000 does'n support dynamic libraries so we're just staying static."
10755745691Smillert    fi
10855745691Smillert    bs2000_ld='c89'
10955745691Smillert    bs2000_lddlflags=''
11055745691Smillert    bs2000_so='none'
11155745691Smillert    bs2000_usedl='n'
11255745691Smillert    bs2000_dlext='none'
11355745691Smillertfi
11455745691Smillert
11555745691Smillertcase "$ld" in
11655745691Smillert'') ld=$bs2000_ld ;;
117c48bdce4Smillertesac
118c48bdce4Smillert
119c48bdce4Smillert# ccdlflags have yet to be determined.
120c48bdce4Smillert#case "$ccdlflags" in
121c48bdce4Smillert#'') ccdlflags='-c' ;;
122c48bdce4Smillert#esac
123c48bdce4Smillert
124c48bdce4Smillert# cccdlflags have yet to be determined.
125c48bdce4Smillert#case "$cccdlflags" in
126c48bdce4Smillert#'') cccdlflags='' ;;
127c48bdce4Smillert#esac
128c48bdce4Smillert
12955745691Smillertcase "$ldflags" in
13055745691Smillert'') ldflags=$bs2000_ldflags ;;
13155745691Smillertesac
132c48bdce4Smillert
13355745691Smillertcase "$lddlflags" in
13455745691Smillert'') lddlflags=$bs2000_lddlflags ;;
13555745691Smillertesac
136c8ca9003Smillert
137c8ca9003Smillert# Turning on optimization breaks perl (CORE-DUMP):
138c48bdce4Smillert# You can override this with Configure -Doptimize='-O' or somesuch.
139c48bdce4Smillertcase "$optimize" in
140c48bdce4Smillert'') optimize='none' ;;
141c48bdce4Smillertesac
142c8ca9003Smillert
14355745691Smillert# BS2000 doesn't use dynamic memory on its own (yet):
144c48bdce4Smillertcase "$so" in
14555745691Smillert'') so=$bs2000_so ;;
146c48bdce4Smillertesac
147c8ca9003Smillert
148c48bdce4Smillertcase "$usemymalloc" in
149c48bdce4Smillert'') usemymalloc='n' ;;
150c48bdce4Smillertesac
151c48bdce4Smillert
152c48bdce4Smillert# On BS2000/Posix, libc.a does not really hold anything at all,
153c8ca9003Smillert# so running nm on it is pretty useless.
154c48bdce4Smillert# You can override this with Configure -Dusenm.
155c48bdce4Smillertcase "$usenm" in
156c48bdce4Smillert'') usenm='false' ;;
157c48bdce4Smillertesac
158c8ca9003Smillert
159c48bdce4Smillert#  Configure -Dusedl -Ddlext=.so -Ddlsrc=dl_dllload.xs.
160c48bdce4Smillertcase "$usedl" in
16155745691Smillert'') usedl=$bs2000_usedl ;;
162c48bdce4Smillertesac
163c48bdce4Smillertcase "$dlext" in
16455745691Smillert'') dlext=$bs2000_dlext ;;
165c48bdce4Smillertesac
166c48bdce4Smillert#case "$dlsrc" in
167c48bdce4Smillert#'') dlsrc='none' ;;
168c48bdce4Smillert#esac
169c48bdce4Smillert#case "$ldlibpthname" in
170c48bdce4Smillert#'') ldlibpthname=LIBPATH ;;
171c48bdce4Smillert#esac
172