9bce2a594cb8c46f472bd4a95baef14e94a468ec
[p5sagit/p5-mst-13.2.git] / hints / os2.sh
1 #! /bin/sh
2 # hints/os2.sh
3 # This file reflects the tireless work of
4 # Ilya Zakharevich <ilya@math.ohio-state.edu>
5 #
6 # Trimmed and comments added by 
7 #     Andy Dougherty  <doughera@lafcol.lafayette.edu>
8 #     Exactly what is required beyond a standard OS/2 installation?
9 #     There are notes about "patched pdksh" I do not understand.
10
11 # Note that symbol extraction code gives wrong answers (sometimes?) on
12 # gethostent and setsid.
13
14 # Note that during the .obj compile you need to move the perl.dll file
15 # to LIBPATH :-(
16
17 # Optimization (GNU make 3.74 cannot be loaded :-():
18 emxload -m 30 sh.exe ls.exe tr.exe id.exe sed.exe # make.exe 
19 emxload -m 30 grep.exe egrep.exe fgrep.exe cat.exe rm.exe mv.exe cp.exe
20 emxload -m 30 uniq.exe basename.exe sort.exe awk.exe echo.exe
21
22 path_sep=\;
23
24 if test -f $sh.exe; then sh=$sh.exe; fi
25
26 startsh="#!$sh"
27
28 sysman=`../UU/loc . /man/man1 c:/man/man1 c:/usr/man/man1 d:/man/man1 d:/usr/man/man1 e:/man/man1 e:/usr/man/man1 f:/man/man1 f:/usr/man/man1 g:/man/man1 g:/usr/man/man1 /usr/man/man1`
29 cc='gcc'
30 usrinc='/emx/include'
31 libemx="`../UU/loc . X c:/emx/lib d:/emx/lib e:/emx/lib f:/emx/lib g:/emx/lib h:/emx/lib /emx/lib`"
32
33 if test "$libemx" = "X"; then echo "Cannot find C library!"; fi
34
35 libpth="$libemx/mt $libemx"
36
37 set `emxrev -f emxlibcm`
38 emxcrtrev=$5
39
40 so='dll'
41
42 # Additional definitions:
43
44 firstmakefile='GNUmakefile'
45 exe_ext='.exe'
46
47 # We provide it
48 i_dlfcn='define'
49
50 aout_d_shrplib='undef'
51 aout_useshrplib='false'
52 aout_obj_ext='.o'
53 aout_lib_ext='.a'
54 aout_ar='ar'
55 aout_plibext='.a'
56 aout_lddlflags='-Zdll'
57 if [ $emxcrtrev -ge 50 ]; then 
58     aout_ldflags='-Zexe -Zsmall-conv'
59 else
60     aout_ldflags='-Zexe'
61 fi
62
63 # To get into config.sh:
64 aout_ldflags="$aout_ldflags"
65
66 aout_d_fork='define'
67 aout_ccflags='-DPERL_CORE -DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK'
68 aout_cppflags='-DPERL_CORE -DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK'
69 aout_use_clib='c'
70 aout_usedl='undef'
71 aout_archobjs="os2.o dl_os2.o"
72
73 # variable which have different values for aout compile
74 used_aout='d_shrplib useshrplib plibext lib_ext obj_ext ar plibext d_fork lddlflags ldflags ccflags use_clib usedl archobjs cppflags'
75
76 if [ "$emxaout" != "" ]; then
77     d_shrplib="$aout_d_shrplib"
78     useshrplib="$aout_useshrplib"
79     obj_ext="$aout_obj_ext"
80     lib_ext="$aout_lib_ext"
81     ar="$aout_ar"
82     plibext="$aout_plibext"
83     if [ $emxcrtrev -lt 50 ]; then 
84         d_fork="$aout_d_fork"
85     fi
86     lddlflags="$aout_lddlflags"
87     ldflags="$aout_ldflags"
88     ccflags="$aout_ccflags"
89     cppflags="$aout_cppflags"
90     use_clib="$aout_use_clib"
91     usedl="$aout_usedl"
92 else
93     d_shrplib='define'
94     useshrplib='true'
95     obj_ext='.obj'
96     lib_ext='.lib'
97     ar='emxomfar'
98     plibext='.lib'
99     if [ $emxcrtrev -ge 50 ]; then 
100         d_fork='define'
101     else
102         d_fork='undef'
103     fi
104     lddlflags='-Zdll -Zomf -Zmt -Zcrtdll'
105     # Recursive regmatch may eat 2.5M of stack alone.
106     ldflags='-Zexe -Zomf -Zmt -Zcrtdll -Zstack 32000'
107     if [ $emxcrtrev -ge 50 ]; then 
108         ccflags='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK'
109     else
110         ccflags='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DEMX_BAD_SBRK'
111     fi
112     use_clib='c_import'
113     usedl='define'
114 fi
115
116 # To get into config.sh (should start at the beginning of line)
117 # or you can put it into config.over.
118 plibext="$plibext"
119 # plibext is not needed anymore.  Just directly set $libperl.
120 libperl="libperl${plibext}"
121
122 #libc="/emx/lib/st/c_import$lib_ext"
123 libc="$libemx/mt/$use_clib$lib_ext"
124
125 if test -r "$libemx/c_alias$lib_ext"; then 
126     libnames="$libemx/c_alias$lib_ext"
127 fi
128 # otherwise puts -lc ???
129
130 # [Maybe we should just remove c from $libswanted ?]
131
132 # Test would pick up wrong rand, so we hardwire the value for random()
133 libs='-lsocket -lm -lbsd'
134 randbits=31
135 archobjs="os2$obj_ext dl_os2$obj_ext"
136
137 # Run files without extension with sh:
138 EXECSHELL=sh
139
140 cccdlflags='-Zdll'
141 dlsrc='dl_dlopen.xs'
142 ld='gcc'
143
144 #cppflags='-DDOSISH -DOS2=2 -DEMBED -I.'
145
146 # for speedup: (some patches to ungetc are also needed):
147 # Note that without this guy tests 8 and 10 of io/tell.t fail, with it 11 fails
148
149 stdstdunder=`echo "#include <stdio.h>" | cpp | egrep -c "char +\* +_ptr"`
150 d_stdstdio='define'
151 d_stdiobase='define'
152 d_stdio_ptr_lval='define'
153 d_stdio_cnt_lval='define'
154
155 if test "$stdstdunder" = 0; then
156   stdio_ptr='((fp)->ptr)'
157   stdio_cnt='((fp)->rcount)'
158   stdio_base='((fp)->buffer)'
159   stdio_bufsiz='((fp)->rcount + (fp)->ptr - (fp)->buffer)'
160   ccflags="$ccflags -DMYTTYNAME"
161   myttyname='define'
162 else
163   stdio_ptr='((fp)->_ptr)'
164   stdio_cnt='((fp)->_rcount)'
165   stdio_base='((fp)->_buffer)'
166   stdio_bufsiz='((fp)->_rcount + (fp)->_ptr - (fp)->_buffer)'
167 fi
168
169 # to put into config.sh
170 myttyname="$myttyname"
171
172 # To have manpages installed
173 nroff='nroff.cmd'
174 # above will be overwritten otherwise, indented to avoid config.sh
175   _nroff='nroff.cmd'
176
177 # should be handled automatically by Configure now.
178 ln='cp'
179 # Will be rewritten otherwise, indented to not put in config.sh
180   _ln='cp'
181 lns='cp'
182
183 nm_opt='-p'
184
185 ####### We define these functions ourselves
186
187 d_getprior='define'
188 d_setprior='define'
189
190 ####### All the rest is commented
191
192 # The next two are commented. pdksh handles #!
193 # sharpbang='extproc '
194 # shsharp='false'
195
196 # Commented:
197 #startsh='extproc ksh\\n#! sh'
198
199 # Copy pod:
200
201 cp ../README.os2 ../pod/perlos2.pod
202
203 # Now install the external modules. We are in the ./hints directory.
204
205 cd ../os2/OS2
206
207 if ! test -d ../../ext/OS2 ; then
208    mkdir ../../ext/OS2
209 fi
210
211 cp -rfu * ../../ext/OS2/
212
213 # Install tests:
214
215 for xxx in * ; do
216         if $test -d $xxx/t; then
217                 cp -uf $xxx/t/*.t ../../t/lib
218         else
219                 if $test -d $xxx; then
220                         cd $xxx
221                         for yyy in * ; do
222                                 if $test -d $yyy/t; then
223                                     cp -uf $yyy/t/*.t ../../t/lib
224                                 fi
225                         done
226                         cd ..
227                 fi
228         fi
229 done
230
231
232 # Now go back
233 cd ../../hints