summaryrefslogtreecommitdiff
path: root/hints/posix-bc.sh
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-11-21 15:03:53 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-11-21 15:03:53 +0000
commit8489188508bafece71d2019cb0dac6720f8529f0 (patch)
treedae8efe8725756dc3c5c1041cba667ce186cdd9e /hints/posix-bc.sh
parente826edc34da0d6aba91789176560a95b7ac6c6a9 (diff)
downloadperl-8489188508bafece71d2019cb0dac6720f8529f0.tar.gz
Dynaloading for POSIX-BC from Thomas Dorner.
p4raw-id: //depot/perl@13171
Diffstat (limited to 'hints/posix-bc.sh')
-rw-r--r--hints/posix-bc.sh143
1 files changed, 112 insertions, 31 deletions
diff --git a/hints/posix-bc.sh b/hints/posix-bc.sh
index a7d3d2c4ab..683bbccaff 100644
--- a/hints/posix-bc.sh
+++ b/hints/posix-bc.sh
@@ -1,26 +1,120 @@
-#! /usr/bin/bash -norc
+:
# hints/posix-bc.sh
#
# BS2000 (Posix Subsystem) hints by Thomas Dorner <Thomas.Dorner@start.de>
#
-# thanks to the authors of the os390.sh
+# Thanks to the authors of the os390.sh for the very first draft.
#
+# You can modify almost any parameter set here using Configure with
+# the appropriate -D option.
-# To get ANSI C, we need to use c89, and ld does not exist
-# You can override this with Configure -Dcc=gcc -Dld=ld.
+# remove this line if dynamic libraries are working for you:
+bs2000_ignoredl='y'
+
+# To get ANSI C, we need to use c89
+# You can override this with Configure -Dcc=gcc
+# (if you ever get a gcc ported to BS2000 ;-).
case "$cc" in
'') cc='c89' ;;
esac
-case "$ld" in
-'') ld='c89' ;;
-esac
# C-Flags:
# -DPOSIX_BC
# -DUSE_PURE_BISON
# -D_XOPEN_SOURCE_EXTENDED alters system headers.
# Prepend your favorites with Configure -Dccflags=your_favorites
-ccflags="$ccflags -Kenum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSIX_BC -DUSE_PURE_BISON -D_XOPEN_SOURCE_EXTENDED"
+ccflags="$ccflags -Kc_names_unlimited,enum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSIX_BC -DUSE_PURE_BISON -D_XOPEN_SOURCE_EXTENDED"
+
+# Now, what kind of BS2000 system are we running on?
+echo
+if [ -n "`bs2cmd SHOW-SYSTEM-INFO | egrep 'HSI-ATT.*TYPE.*SR'`" ]; then
+ echo "You are running a BS2000 machine with Sunrise CPUs."
+ echo "Let's hope you have the matching RISC compiler as well."
+ ccflags="-K risc_4000 $ccflags"
+ bs2000_ldflags='-K risc_4000'
+else
+ echo "Seems like a standard 390 BS2000 machine to me."
+ bs2000_ldflags=''
+fi
+echo
+if [ -z "$bs2000_ignoredl" -a -e /usr/lib/libdl.a ]; then
+ echo "Wow, your BS2000 is State Of The Art and seems to support dynamic libraries."
+ echo "I just can't resist giving them a try."
+ bs2000_lddlflags='-Bsymbolic -Bdynamic'
+ # dynamic linkage of system libraries gave us runtime linker
+ # errors, so we use static linkage while generating our DLLs :-(
+# bs2000_lddlflags='-Bstatic'
+ bs2000_so='none'
+ bs2000_usedl='define'
+ bs2000_dlext='so'
+ case $bs2000_ldflags in
+ *risc_4000*)
+ bs2000_ld="perl_genso"
+ echo "
+Now you must buy everything they sell you, musn't you?
+Didn't somebody tell you that RISC machines and dynamic library support gives
+you helluva lot of configuration problems at the moment?
+Sigh. Now you'll expect me to fix it for you, eh?
+OK, OK, I'll give you a wrapper.
+Just copy $bs2000_ld anywhere into your path before you try to install
+additional modules!"
+
+cat > $bs2000_ld <<EOF
+#! /bin/sh
+#
+# Perl's wrapper for genso by Thomas.Dorner@start.de
+
+GENSO=/usr/bin/genso
+options=""
+params=""
+while [[ \$# -gt 0 ]]; do
+ case \$1 in
+ -K)
+ shift
+ ;;
+ -K*)
+ ;;
+ *.a)
+ lib=\${1##*/lib}
+ options="\$options -L\${1%/lib*.a} -l\${lib%.a}"
+ ;;
+ *.o)
+ params="\$params \$1"
+ ;;
+ *)
+ options="\$options \$1"
+ esac
+ shift
+done
+echo \$GENSO \$options \$params
+exec \$GENSO \$options \$params
+EOF
+
+ chmod +x $bs2000_ld
+ if [[ -w /usr/local/bin && ! -f /usr/local/bin/$bs2000_ld ]]; then
+ cp -p $bs2000_ld /usr/local/bin/$bs2000_ld
+ echo "(Actually I just did that as well, have a look into /usr/local/bin.)"
+ fi
+ ;;
+ *)
+ bs2000_ld='genso'
+ esac
+else
+ if [ -e /usr/lib/libdl.a ]; then
+ echo "Your BS2000 supports dynamic libraries, but you (or we ;-) decided to leave them alone."
+ else
+ echo "Your BS2000 does'n support dynamic libraries so we're just staying static."
+ fi
+ bs2000_ld='c89'
+ bs2000_lddlflags=''
+ bs2000_so='none'
+ bs2000_usedl='n'
+ bs2000_dlext='none'
+fi
+
+case "$ld" in
+'') ld=$bs2000_ld ;;
+esac
# ccdlflags have yet to be determined.
#case "$ccdlflags" in
@@ -32,24 +126,13 @@ ccflags="$ccflags -Kenum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSI
#'') cccdlflags='' ;;
#esac
-# ldflags have yet to be determined.
-#case "$ldflags" in
-#'') ldflags='' ;;
-#esac
-
-# lddlflags have yet to be determined.
-#case "$lddlflags" in
-#'') lddlflags='' ;;
-#esac
+case "$ldflags" in
+'') ldflags=$bs2000_ldflags ;;
+esac
-# Flags on a RISC-Host (SUNRISE):
-if [ -n "`bs2cmd SHOW-SYSTEM-INFO | egrep 'HSI-ATT.*TYPE.*SR'`" ]; then
- echo
- echo "Congratulations, you are running a machine with Sunrise CPUs."
- echo "Let's hope you have the matching RISC compiler as well."
- ccflags="-K risc_4000 $ccflags"
- ldflags='-K risc_4000'
-fi
+case "$lddlflags" in
+'') lddlflags=$bs2000_lddlflags ;;
+esac
# Turning on optimization breaks perl (CORE-DUMP):
# You can override this with Configure -Doptimize='-O' or somesuch.
@@ -57,9 +140,9 @@ case "$optimize" in
'') optimize='none' ;;
esac
-# we don''t use dynamic memorys (yet):
+# BS2000 doesn't use dynamic memory on its own (yet):
case "$so" in
-'') so='none' ;;
+'') so=$bs2000_so ;;
esac
case "$usemymalloc" in
@@ -73,14 +156,12 @@ case "$usenm" in
'') usenm='false' ;;
esac
-# Dynamic loading doesn't work on OS/390 quite yet.
-# You can override this with
# Configure -Dusedl -Ddlext=.so -Ddlsrc=dl_dllload.xs.
case "$usedl" in
-'') usedl='n' ;;
+'') usedl=$bs2000_usedl ;;
esac
case "$dlext" in
-'') dlext='none' ;;
+'') dlext=$bs2000_dlext ;;
esac
#case "$dlsrc" in
#'') dlsrc='none' ;;