source: trunk/essentials/dev-lang/perl/hints/os2.sh@ 3193

Last change on this file since 3193 was 3193, checked in by bird, 19 years ago

we're *not* emx and don't want anything to do with any stray emx installations on the system.

  • Property svn:eol-style set to native
File size: 12.1 KB
Line 
1#! /bin/sh
2# hints/os2.sh
3# This file reflects the tireless work of
4# Ilya Zakharevich <[email protected]>
5#
6# Trimmed and comments added by
7# Andy Dougherty <[email protected]>
8# Exactly what is required beyond a standard OS/2 installation?
9# (see in README.os2)
10
11# Note that symbol extraction code gives wrong answers (sometimes?) on
12# gethostent and setsid.
13set -x
14
15# Optimization (GNU make 3.74 cannot be loaded :-():
16emxload -m 30 sh.exe ls.exe tr.exe id.exe sed.exe # make.exe
17emxload -m 30 grep.exe egrep.exe fgrep.exe cat.exe rm.exe mv.exe cp.exe
18emxload -m 30 uniq.exe basename.exe sort.exe awk.exe echo.exe
19
20path_sep=\;
21
22if test -f $sh.exe; then sh=$sh.exe; fi
23
24startsh="#!$sh"
25cc='gcc'
26
27# Make denser object files and DLL
28case "X$optimize" in
29 X)
30 optimize="-O2 -fomit-frame-pointer -falign-loops=2 -falign-jumps=2 -falign-functions=2 -s"
31 ld_dll_optimize="-s"
32 ;;
33esac
34
35# Get some standard things (indented to avoid putting in config.sh):
36 oifs="$IFS"
37 IFS=" ;"
38 set $MANPATH
39 tryman="$@"
40 set `gcc -print-search-dirs | grep libraries | sed -e "s/^libraries: *=//" `
41 libemx="$@"
42 set $C_INCLUDE_PATH
43 usrinc="$@"
44 IFS="$oifs"
45 tryman="`./UU/loc . /man $tryman`"
46 tryman="`echo $tryman | tr '\\\' '/'`"
47
48 # indented to avoid having it *two* times at start
49 libemx="`./UU/loc libc_alias.a $libemx`"
50
51usrinc="`./UU/loc stdlib.h $usrinc`"
52usrinc="`dirname $usrinc | tr '\\\' '/'`"
53libemx="`dirname $libemx | tr '\\\' '/'`"
54
55if test -d $tryman/man1; then
56 sysman="$tryman/man1"
57else
58 sysman="`./UU/loc . /man/man1 $UNIXROOT/usr/share/man/man1 $UNIXROOT/usr/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`"
59fi
60
61#emxpath="`dirname $libemx`"
62#if test ! -d "$emxpath"; then
63# emxpath="`./UU/loc . /emx c:/emx d:/emx e:/emx f:/emx g:/emx h:/emx /emx`"
64#fi
65emxpath="`which gcc.exe`"
66emxpath="`dirname $emxpath`"
67emxpath="`dirname $emxpath`"
68if test ! -d "$emxpath"; then
69 emxpath="$UNIXROOT/usr"
70fi
71
72if test ! -d "$libemx"; then
73 libemx="$emxpath/lib"
74fi
75if test ! -d "$libemx"; then
76 if test -d "$LIBRARY_PATH"; then
77 libemx="$LIBRARY_PATH"
78 else
79 libemx="`./UU/loc . X $UNIXROOT/usr/lib $UNIXROOT/lib $UNIXROOT/usr/local/lib`"
80 fi
81fi
82
83if test ! -d "$usrinc"; then
84 if test -d "$emxpath/include"; then
85 usrinc="$emxpath/include"
86 else
87 if test -d "$C_INCLUDE_PATH"; then
88 usrinc="$C_INCLUDE_PATH"
89 else
90 usrinc="`./UU/loc . X $UNIXROOT/usr/include $UNIXROOT/usr/local/include`"
91 fi
92 fi
93fi
94
95#rsx="`./UU/loc rsx.exe undef $pth`"
96
97if test "$libemx" = "X"; then echo "Cannot find C library!" >&2; fi
98
99# Acute backslashitis:
100libpth="`echo \"$LIBRARY_PATH\" | tr ';\\\' ' /'`"
101libpth="$libpth $libemx"
102
103#set `cmd /c emxrev -f emxlibcm`
104#emxcrtrev=$5
105# indented to not put it into config.sh
106 #_defemxcrtrev=-D_EMX_CRT_REV_=$emxcrtrev
107 _defemxcrtrev=-D_EMX_CRT_REV_=61
108
109so='dll'
110
111# Additional definitions:
112
113firstmakefile='GNUmakefile'
114exe_ext='.exe'
115
116# We provide it
117i_dlfcn='define'
118
119# The default one uses exponential notation between 0.0001 and 0.1
120d_Gconvert='gcvt_os2((x),(n),(b))'
121
122cat > UU/uselongdouble.cbu <<'EOCBU'
123# This script UU/uselongdouble.cbu will get 'called-back' by Configure
124# after it has prompted the user for whether to use long doubles.
125# If we will use them, let Configure choose us a Gconvert.
126case "$uselongdouble:$d_longdbl:$d_sqrtl:$d_modfl" in
127"$define:$define:$define:$define") d_Gconvert='' ;;
128esac
129EOCBU
130
131# -Zomf build has a problem with _exit() *flushing*, so the test
132# gets confused:
133fflushNULL="define"
134
135aout_d_shrplib='undef'
136aout_useshrplib='false'
137aout_obj_ext='.o'
138aout_lib_ext='.a'
139aout_ar='ar'
140aout_plibext='.a'
141aout_lddlflags="-Zdll $ld_dll_optimize"
142
143# Cannot have 32000K stack: get SYS0170 ?!
144aout_ldflags='-Zexe -Zstack 16000 '
145
146# To get into config.sh:
147aout_ldflags="$aout_ldflags"
148
149aout_d_fork='define'
150aout_ccflags="-DDOSISH -DOS2=2 -DEMBED -I. $_defemxcrtrev "
151aout_cppflags="-DDOSISH -DOS2=2 -DEMBED -I. $_defemxcrtrev "
152aout_use_clib='libc_dll'
153aout_usedl='undef'
154aout_archobjs="os2.o dl_os2.o"
155# Not listed in dynamic_ext, but needed for AOUT static_ext nevertheless
156aout_extra_static_ext="OS2::DLL"
157
158# variable which have different values for aout compile
159used_aout='d_shrplib useshrplib plibext lib_ext obj_ext ar plibext d_fork lddlflags ldflags ccflags use_clib usedl archobjs cppflags'
160
161if [ "$emxaout" != "" ]; then
162 d_shrplib="$aout_d_shrplib"
163 useshrplib="$aout_useshrplib"
164 obj_ext="$aout_obj_ext"
165 lib_ext="$aout_lib_ext"
166 ar="$aout_ar"
167 plibext="$aout_plibext"
168 d_fork='define'
169 lddlflags="$aout_lddlflags"
170 ldflags="$aout_ldflags"
171 ccflags="$aout_ccflags"
172 cppflags="$aout_cppflags"
173 use_clib="$aout_use_clib"
174 usedl="$aout_usedl"
175else
176 d_shrplib='define'
177 useshrplib='true'
178 obj_ext='.o'
179 lib_ext='.lib'
180 ar='emxomfar'
181 plibext='.lib'
182 d_fork='define'
183 lddlflags="-Zdll -Zomf "
184 # Recursive regmatch may eat 2.5M of stack alone.
185 ldflags='-Zexe -Zomf -Zstack 32000 '
186 ccflags="-Zomf -DDOSISH -DOS2=2 -DEMBED -I. $_defemxcrtrev"
187 use_clib='libc_dll'
188 usedl='define'
189fi
190
191# indented to miss config.sh
192 _ar="$ar"
193
194# To get into config.sh (should start at the beginning of line)
195# or you can put it into config.over.
196plibext="$plibext"
197# plibext is not needed anymore. Just directly set $libperl.
198libperl="libperl${plibext}"
199
200
201libc="$libemx/$use_clib$lib_ext"
202
203if test -r "$libemx/libc_alias$lib_ext"; then
204 libnames="$libemx/libc_alias$lib_ext"
205fi
206# otherwise puts -lc ???
207
208# [Maybe we should just remove c from $libswanted ?]
209
210# Test would pick up wrong rand, so we hardwire the value for random()
211libs='-lsocket'
212randbits=31
213archobjs="os2$obj_ext dl_os2$obj_ext"
214
215# Run files without extension with sh:
216EXECSHELL=sh
217
218cccdlflags='-Zdll'
219dlsrc='dl_dlopen.xs'
220ld='gcc'
221
222#cppflags='-DDOSISH -DOS2=2 -DEMBED -I.'
223
224# for speedup: (some patches to ungetc are also needed):
225# Note that without this guy tests 8 and 10 of io/tell.t fail, with it 11 fails
226
227stdstdunder=`echo "#include <stdio.h>" | cpp | egrep -c "char +\* +_ptr"`
228d_stdstdio='define'
229d_stdiobase='define'
230d_stdio_ptr_lval='define'
231d_stdio_cnt_lval='define'
232
233if test "$stdstdunder" = 0; then
234 stdio_ptr='((fp)->ptr)'
235 stdio_cnt='((fp)->rcount)'
236 stdio_base='((fp)->buffer)'
237 stdio_bufsiz='((fp)->rcount + (fp)->ptr - (fp)->buffer)'
238 ccflags="$ccflags -DMYTTYNAME"
239 myttyname='define'
240else
241 stdio_ptr='((fp)->_ptr)'
242 stdio_cnt='((fp)->_rcount)'
243 stdio_base='((fp)->_buffer)'
244 stdio_bufsiz='((fp)->_rcount + (fp)->_ptr - (fp)->_buffer)'
245fi
246
247# to put into config.sh
248myttyname="$myttyname"
249
250# To have manpages installed
251nroff='nroff.cmd'
252# above will be overwritten otherwise, indented to avoid config.sh
253 _nroff='nroff.cmd'
254
255# should be handled automatically by Configure now.
256ln='cp'
257# Will be rewritten otherwise, indented to not put in config.sh
258 _ln='cp'
259lns='cp'
260
261nm_opt='-p'
262
263####### We define these functions ourselves
264
265d_strtoll='define'
266d_strtoull='define'
267d_getprior='define'
268d_setprior='define'
269d_usleep='define'
270d_usleepproto='define'
271
272d_link='undef'
273dont_use_nlink='define'
274# no posix (aka hard) links for us!
275
276# The next two are commented. pdksh handles #!, extproc gives no path part.
277# sharpbang='extproc '
278# shsharp='false'
279
280# Commented:
281#startsh='extproc ksh\\n#! sh'
282
283# Find patch:
284gnupatch='patch'
285if (gnupatch -v || gnupatch --version) 2>&1 >/dev/null; then
286 gnupatch=gnupatch
287else
288 if (gpatch -v || gpatch --version) 2>&1 >/dev/null; then
289 gnupatch=gpatch
290 else
291 # They may have a special PATH during configuring
292 if (patch -v || patch --version) 2>&1 >/dev/null; then
293 gnupatch="`./UU/loc patch.exe undef $pth`"
294 fi
295 fi
296fi
297
298for f in less.exe less.sh less.ksh less.cmd more.exe more.sh more.ksh more.cmd ; do
299 if test -z "$pager"; then
300 pager="`./UU/loc $f '' $pth`"
301 fi
302done
303if test -z "$pager"; then
304 pager='cmd /c more'
305fi
306
307# Apply patches if needed
308case "$0$running_c_cmd" in
309 *[/\\]Configure|*[/\\]Configure.|Configure|Configure.) # Skip Configure.cmd
310 if test "Xyes" = "X$configure_cmd_loop"; then
311 cat <<EOC >&2
312!!!
313!!! PANIC: Loop of self-invocations detected, aborting!
314!!!
315EOC
316 exit 20
317 fi
318 configure_cmd_loop=yes
319 export configure_cmd_loop
320
321 configure_needs_patch=''
322 if test -s ./os2/diff.configure; then
323 if ! grep "^#OS2-PATCH-APPLIED" ./Configure > /dev/null; then
324 configure_needs_patch=yes
325 fi
326 fi
327 if test -n "$configure_needs_patch"; then
328 # Not patched!
329 # Restore the initial command line arguments
330 if test -f ./Configure.cmd ; then
331 cat <<EOC >&2
332!!!
333!!! I see that what is running is ./Configure.
334!!! ./Configure is not patched, but ./Configure.cmd exists.
335!!!
336!!! You are supposed to run Configure.cmd, not Configure
337!!! after an automagic patching.
338!!!
339!!! If you insist on running Configure, you may
340!!! patch it manually from ./os2/diff.configure.
341!!!
342!!! However, I went through incredible hoolahoops, and I expect I can
343!!! auto-restart Configure.cmd myself. I will start it with arguments:
344!!!
345!!! Configure.cmd $args_exp
346!!!
347EOC
348 rp='Do you want to auto-restart Configure.cmd?'
349 dflt='y'
350 . UU/myread
351 case "$ans" in
352 [yY]) echo >&4 "Okay, continuing." ;;
353 *) echo >&4 "Okay, bye."
354 exit 2
355 ;;
356 esac
357 eval "set X $args_exp";
358 shift;
359 # Restore the output
360 exec Configure.cmd "$@" 1>&2
361 exit 2
362 fi
363 cat <<EOC >&2
364!!!
365!!! You did not patch ./Configure!
366!!! I can create Configure.cmd and patch it from ./os2/diff.configure with the command
367!!!
368!!! $gnupatch -b -p1 --output=Configure.cmd <./os2/diff.configure 2>&1 | tee 00_auto_patch
369EOC
370 rp='Do you want to auto-patch Configure to Configure.cmd?'
371 dflt='y'
372 . UU/myread
373 case "$ans" in
374 [yY]) echo >&4 "Okay, continuing." ;;
375 *) echo >&4 "Okay, bye."
376 exit 2
377 ;;
378 esac
379 ($gnupatch -b -p1 --output=Configure.cmd <./os2/diff.configure 2>&1 | tee 00_auto_patch) >&2
380 cat <<EOC >&2
381!!!
382!!! The report of patching is copied to 00_auto_patch.
383!!! Now we need to restart Configure.cmd with all the options.
384!!!
385EOC
386 echo "extproc sh" > Configure.ctm
387 ( cat Configure.cmd >> Configure.ctm && mv -f Configure.ctm Configure.cmd ) || (echo "!!! Failure to add extproc-line to Configure.cmd." >&2 ; exit 21)
388 cat <<EOC >&2
389!!! I went through incredible hoolahoops, and I expect I can
390!!! auto-restart Configure.cmd myself. I will start it with arguments:
391!!!
392!!! Configure.cmd $args_exp
393!!!
394EOC
395 rp='Do you want to auto-restart Configure.cmd?'
396 dflt='y'
397 . UU/myread
398 case "$ans" in
399 [yY]) echo >&4 "Okay, continuing." ;;
400 *) echo >&4 "Okay, bye."
401 exit 2
402 ;;
403 esac
404 eval "set X $args_exp";
405 shift;
406 exec Configure.cmd "$@" 1>&2
407 exit 2
408 else
409 if test -s ./os2/diff.configure; then
410 echo "!!! Apparently we are running a patched Configure." >&2
411 else
412 echo "!!! Apparently there is no need to patch Configure." >&2
413 fi
414 fi
415 ;;
416 *) echo "!!! Apparently we are running a renamed Configure: '$0'." >&2
417esac
418
419# This script UU/usethreads.cbu will get 'called-back' by Configure
420# after it has prompted the user for whether to use threads.
421cat > UU/usethreads.cbu <<'EOCBU'
422case "$usethreads" in
423$define|true|[yY]*)
424 ccflags="$ccflags"
425 cppflags="$cppflags" # Do we really need to set this?
426 aout_ccflags="-DUSE_THREADS $aout_ccflags"
427 aout_cppflags="-DUSE_THREADS $aout_cppflags"
428 aout_lddlflags="$aout_lddlflags"
429 aout_ldflags="$aout_ldflags"
430 ;;
431esac
432EOCBU
433
434if test -z "$cryptlib"; then
435 cryptlib=`UU/loc crypt$lib_ext "" $libpth`
436 if $test -n "$cryptlib"; then
437 cryptlib=-lcrypt
438 else
439 cryptlib=`UU/loc ufc$lib_ext "" $libpth`
440 if $test -n "$cryptlib"; then
441 cryptlib=-lufc
442 fi
443 fi
444fi
445if test -n "$cryptlib"; then
446 libs="$libs $cryptlib"
447 # d_crypt=define
448fi
449
450# Now install the external modules. We are in the ./hints directory.
451
452cd ./os2/OS2
453
454if ! test -d ../../ext/OS2 ; then
455 mkdir ../../ext/OS2
456fi
457
458cp -rfu * ../../ext/OS2/
459
460# Install tests:
461
462cp -uf ../*.t ../../t/lib
463for xxx in * ; do
464 if $test -d $xxx/t; then
465 cp -uf $xxx/t/*.t ../../t/lib
466 else
467 if $test -d $xxx; then
468 cd $xxx
469 for yyy in * ; do
470 if $test -d $yyy/t; then
471 cp -uf $yyy/t/*.t ../../t/lib
472 fi
473 done
474 cd ..
475 fi
476 fi
477done
478
479case "$ldlibpthname" in
480'') ldlibpthname=none ;;
481esac
482
483# Now go back
484cd ../..
485cp os2/*.t t/lib
Note: See TracBrowser for help on using the repository browser.