Commit | Line | Data |
---|---|---|
84891885 | 1 | : |
a1a0e61e TD |
2 | # hints/posix-bc.sh |
3 | # | |
4 | # BS2000 (Posix Subsystem) hints by Thomas Dorner <Thomas.Dorner@start.de> | |
5 | # | |
84891885 | 6 | # Thanks to the authors of the os390.sh for the very first draft. |
a1a0e61e | 7 | # |
84891885 JH |
8 | # You can modify almost any parameter set here using Configure with |
9 | # the appropriate -D option. | |
a1a0e61e | 10 | |
84891885 JH |
11 | # remove this line if dynamic libraries are working for you: |
12 | bs2000_ignoredl='y' | |
13 | ||
14 | # To get ANSI C, we need to use c89 | |
15 | # You can override this with Configure -Dcc=gcc | |
16 | # (if you ever get a gcc ported to BS2000 ;-). | |
a7a44c04 IRC |
17 | case "$cc" in |
18 | '') cc='c89' ;; | |
19 | esac | |
a1a0e61e TD |
20 | |
21 | # C-Flags: | |
a7a44c04 IRC |
22 | # -DPOSIX_BC |
23 | # -DUSE_PURE_BISON | |
24 | # -D_XOPEN_SOURCE_EXTENDED alters system headers. | |
25 | # Prepend your favorites with Configure -Dccflags=your_favorites | |
84891885 JH |
26 | ccflags="$ccflags -Kc_names_unlimited,enum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSIX_BC -DUSE_PURE_BISON -D_XOPEN_SOURCE_EXTENDED" |
27 | ||
28 | # Now, what kind of BS2000 system are we running on? | |
29 | echo | |
30 | if [ -n "`bs2cmd SHOW-SYSTEM-INFO | egrep 'HSI-ATT.*TYPE.*SR'`" ]; then | |
31 | echo "You are running a BS2000 machine with Sunrise CPUs." | |
32 | echo "Let's hope you have the matching RISC compiler as well." | |
33 | ccflags="-K risc_4000 $ccflags" | |
34 | bs2000_ldflags='-K risc_4000' | |
35 | else | |
36 | echo "Seems like a standard 390 BS2000 machine to me." | |
37 | bs2000_ldflags='' | |
38 | fi | |
39 | echo | |
40 | if [ -z "$bs2000_ignoredl" -a -e /usr/lib/libdl.a ]; then | |
41 | echo "Wow, your BS2000 is State Of The Art and seems to support dynamic libraries." | |
42 | echo "I just can't resist giving them a try." | |
43 | bs2000_lddlflags='-Bsymbolic -Bdynamic' | |
44 | # dynamic linkage of system libraries gave us runtime linker | |
45 | # errors, so we use static linkage while generating our DLLs :-( | |
46 | # bs2000_lddlflags='-Bstatic' | |
47 | bs2000_so='none' | |
48 | bs2000_usedl='define' | |
49 | bs2000_dlext='so' | |
50 | case $bs2000_ldflags in | |
51 | *risc_4000*) | |
52 | bs2000_ld="perl_genso" | |
53 | echo " | |
54 | Now you must buy everything they sell you, musn't you? | |
55 | Didn't somebody tell you that RISC machines and dynamic library support gives | |
56 | you helluva lot of configuration problems at the moment? | |
57 | Sigh. Now you'll expect me to fix it for you, eh? | |
58 | OK, OK, I'll give you a wrapper. | |
59 | Just copy $bs2000_ld anywhere into your path before you try to install | |
60 | additional modules!" | |
61 | ||
62 | cat > $bs2000_ld <<EOF | |
63 | #! /bin/sh | |
64 | # | |
65 | # Perl's wrapper for genso by Thomas.Dorner@start.de | |
66 | ||
67 | GENSO=/usr/bin/genso | |
68 | options="" | |
69 | params="" | |
70 | while [[ \$# -gt 0 ]]; do | |
71 | case \$1 in | |
72 | -K) | |
73 | shift | |
74 | ;; | |
75 | -K*) | |
76 | ;; | |
77 | *.a) | |
78 | lib=\${1##*/lib} | |
79 | options="\$options -L\${1%/lib*.a} -l\${lib%.a}" | |
80 | ;; | |
81 | *.o) | |
82 | params="\$params \$1" | |
83 | ;; | |
84 | *) | |
85 | options="\$options \$1" | |
86 | esac | |
87 | shift | |
88 | done | |
89 | echo \$GENSO \$options \$params | |
90 | exec \$GENSO \$options \$params | |
91 | EOF | |
92 | ||
93 | chmod +x $bs2000_ld | |
94 | if [[ -w /usr/local/bin && ! -f /usr/local/bin/$bs2000_ld ]]; then | |
95 | cp -p $bs2000_ld /usr/local/bin/$bs2000_ld | |
96 | echo "(Actually I just did that as well, have a look into /usr/local/bin.)" | |
97 | fi | |
98 | ;; | |
99 | *) | |
100 | bs2000_ld='genso' | |
101 | esac | |
102 | else | |
103 | if [ -e /usr/lib/libdl.a ]; then | |
104 | echo "Your BS2000 supports dynamic libraries, but you (or we ;-) decided to leave them alone." | |
105 | else | |
106 | echo "Your BS2000 does'n support dynamic libraries so we're just staying static." | |
107 | fi | |
108 | bs2000_ld='c89' | |
109 | bs2000_lddlflags='' | |
110 | bs2000_so='none' | |
111 | bs2000_usedl='n' | |
112 | bs2000_dlext='none' | |
113 | fi | |
114 | ||
115 | case "$ld" in | |
116 | '') ld=$bs2000_ld ;; | |
117 | esac | |
a7a44c04 IRC |
118 | |
119 | # ccdlflags have yet to be determined. | |
120 | #case "$ccdlflags" in | |
121 | #'') ccdlflags='-c' ;; | |
122 | #esac | |
123 | ||
124 | # cccdlflags have yet to be determined. | |
125 | #case "$cccdlflags" in | |
126 | #'') cccdlflags='' ;; | |
127 | #esac | |
128 | ||
84891885 JH |
129 | case "$ldflags" in |
130 | '') ldflags=$bs2000_ldflags ;; | |
131 | esac | |
a1a0e61e | 132 | |
84891885 JH |
133 | case "$lddlflags" in |
134 | '') lddlflags=$bs2000_lddlflags ;; | |
135 | esac | |
4113c5bc | 136 | |
a1a0e61e | 137 | # Turning on optimization breaks perl (CORE-DUMP): |
a7a44c04 IRC |
138 | # You can override this with Configure -Doptimize='-O' or somesuch. |
139 | case "$optimize" in | |
140 | '') optimize='none' ;; | |
141 | esac | |
a1a0e61e | 142 | |
84891885 | 143 | # BS2000 doesn't use dynamic memory on its own (yet): |
a7a44c04 | 144 | case "$so" in |
84891885 | 145 | '') so=$bs2000_so ;; |
a7a44c04 IRC |
146 | esac |
147 | ||
148 | case "$usemymalloc" in | |
149 | '') usemymalloc='n' ;; | |
150 | esac | |
a1a0e61e | 151 | |
c8e8bf6a | 152 | # On BS2000/Posix, libc.a does not really hold anything at all, |
a1a0e61e | 153 | # so running nm on it is pretty useless. |
a7a44c04 IRC |
154 | # You can override this with Configure -Dusenm. |
155 | case "$usenm" in | |
156 | '') usenm='false' ;; | |
157 | esac | |
a1a0e61e | 158 | |
a7a44c04 IRC |
159 | # Configure -Dusedl -Ddlext=.so -Ddlsrc=dl_dllload.xs. |
160 | case "$usedl" in | |
84891885 | 161 | '') usedl=$bs2000_usedl ;; |
a7a44c04 IRC |
162 | esac |
163 | case "$dlext" in | |
84891885 | 164 | '') dlext=$bs2000_dlext ;; |
a7a44c04 IRC |
165 | esac |
166 | #case "$dlsrc" in | |
167 | #'') dlsrc='none' ;; | |
168 | #esac | |
169 | #case "$ldlibpthname" in | |
170 | #'') ldlibpthname=LIBPATH ;; | |
171 | #esac | |
a1a0e61e | 172 |