1ba47ec9dSmillert#! /bin/sh 24a4f25f9Sdownsj# hints/os2.sh 34a4f25f9Sdownsj# This file reflects the tireless work of 44a4f25f9Sdownsj# Ilya Zakharevich <ilya@math.ohio-state.edu> 54a4f25f9Sdownsj# 64a4f25f9Sdownsj# Trimmed and comments added by 7f64b279aSmillert# Andy Dougherty <doughera@lafayette.edu> 84a4f25f9Sdownsj# Exactly what is required beyond a standard OS/2 installation? 9ba47ec9dSmillert# (see in README.os2) 104a4f25f9Sdownsj 114a4f25f9Sdownsj# Note that symbol extraction code gives wrong answers (sometimes?) on 124a4f25f9Sdownsj# gethostent and setsid. 134a4f25f9Sdownsj 14ba47ec9dSmillert# Optimization (GNU make 3.74 cannot be loaded :-(): 15ba47ec9dSmillertemxload -m 30 sh.exe ls.exe tr.exe id.exe sed.exe # make.exe 16ba47ec9dSmillertemxload -m 30 grep.exe egrep.exe fgrep.exe cat.exe rm.exe mv.exe cp.exe 17ba47ec9dSmillertemxload -m 30 uniq.exe basename.exe sort.exe awk.exe echo.exe 184a4f25f9Sdownsj 19ba47ec9dSmillertpath_sep=\; 20ba47ec9dSmillert 21ba47ec9dSmillertif test -f $sh.exe; then sh=$sh.exe; fi 22ba47ec9dSmillert 23ba47ec9dSmillertstartsh="#!$sh" 244a4f25f9Sdownsjcc='gcc' 25ba47ec9dSmillert 266345ca90Smillert# Make denser object files and DLL 276345ca90Smillertcase "X$optimize" in 286345ca90Smillert X) 296345ca90Smillert optimize="-O2 -fomit-frame-pointer -malign-loops=2 -malign-jumps=2 -malign-functions=2 -s" 306345ca90Smillert ld_dll_optimize="-s" 316345ca90Smillert ;; 326345ca90Smillertesac 336345ca90Smillert 34ba47ec9dSmillert# Get some standard things (indented to avoid putting in config.sh): 35ba47ec9dSmillert oifs="$IFS" 36ba47ec9dSmillert IFS=" ;" 37ba47ec9dSmillert set $MANPATH 38ba47ec9dSmillert tryman="$@" 39ba47ec9dSmillert set $LIBRARY_PATH 40ba47ec9dSmillert libemx="$@" 41ba47ec9dSmillert set $C_INCLUDE_PATH 42ba47ec9dSmillert usrinc="$@" 43ba47ec9dSmillert IFS="$oifs" 446345ca90Smillert tryman="`./UU/loc . /man $tryman`" 45ba47ec9dSmillert tryman="`echo $tryman | tr '\\\' '/'`" 46ba47ec9dSmillert 47ba47ec9dSmillert # indented to avoid having it *two* times at start 486345ca90Smillert libemx="`./UU/loc os2.a /emx/lib $libemx`" 49ba47ec9dSmillert 506345ca90Smillertusrinc="`./UU/loc stdlib.h /emx/include $usrinc`" 51ba47ec9dSmillertusrinc="`dirname $usrinc | tr '\\\' '/'`" 52ba47ec9dSmillertlibemx="`dirname $libemx | tr '\\\' '/'`" 53ba47ec9dSmillert 54ba47ec9dSmillertif test -d $tryman/man1; then 55ba47ec9dSmillert sysman="$tryman/man1" 56ba47ec9dSmillertelse 576345ca90Smillert 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`" 58ba47ec9dSmillertfi 59ba47ec9dSmillert 60ba47ec9dSmillertemxpath="`dirname $libemx`" 61ba47ec9dSmillertif test ! -d "$emxpath"; then 626345ca90Smillert emxpath="`./UU/loc . /emx c:/emx d:/emx e:/emx f:/emx g:/emx h:/emx /emx`" 63ba47ec9dSmillertfi 64ba47ec9dSmillert 65ba47ec9dSmillertif test ! -d "$libemx"; then 66ba47ec9dSmillert libemx="$emxpath/lib" 67ba47ec9dSmillertfi 68ba47ec9dSmillertif test ! -d "$libemx"; then 69ba47ec9dSmillert if test -d "$LIBRARY_PATH"; then 70ba47ec9dSmillert libemx="$LIBRARY_PATH" 71ba47ec9dSmillert else 726345ca90Smillert libemx="`./UU/loc . X c:/emx/lib d:/emx/lib e:/emx/lib f:/emx/lib g:/emx/lib h:/emx/lib /emx/lib`" 73ba47ec9dSmillert fi 74ba47ec9dSmillertfi 754a4f25f9Sdownsj 76ba47ec9dSmillertif test ! -d "$usrinc"; then 77ba47ec9dSmillert if test -d "$emxpath/include"; then 78ba47ec9dSmillert usrinc="$emxpath/include" 79ba47ec9dSmillert else 80ba47ec9dSmillert if test -d "$C_INCLUDE_PATH"; then 81ba47ec9dSmillert usrinc="$C_INCLUDE_PATH" 82ba47ec9dSmillert else 836345ca90Smillert usrinc="`./UU/loc . X c:/emx/include d:/emx/include e:/emx/include f:/emx/include g:/emx/include h:/emx/include /emx/include`" 84ba47ec9dSmillert fi 85ba47ec9dSmillert fi 86ba47ec9dSmillertfi 874a4f25f9Sdownsj 886345ca90Smillertrsx="`./UU/loc rsx.exe undef $pth`" 89ba47ec9dSmillert 90ba47ec9dSmillertif test "$libemx" = "X"; then echo "Cannot find C library!" >&2; fi 91ba47ec9dSmillert 92ba47ec9dSmillert# Acute backslashitis: 93ba47ec9dSmillertlibpth="`echo \"$LIBRARY_PATH\" | tr ';\\\' ' /'`" 94ba47ec9dSmillertlibpth="$libpth $libemx/mt $libemx" 95ba47ec9dSmillert 96c5dcfd37Smillertset `cmd /c emxrev -f emxlibcm` 97ba47ec9dSmillertemxcrtrev=$5 98e2e5c5d3Smillert# indented to not put it into config.sh 99e2e5c5d3Smillert _defemxcrtrev=-D_EMX_CRT_REV_=$emxcrtrev 1004a4f25f9Sdownsj 1014a4f25f9Sdownsjso='dll' 1024a4f25f9Sdownsj 1034a4f25f9Sdownsj# Additional definitions: 1044a4f25f9Sdownsj 1054a4f25f9Sdownsjfirstmakefile='GNUmakefile' 1064a4f25f9Sdownsjexe_ext='.exe' 1074a4f25f9Sdownsj 108ba47ec9dSmillert# We provide it 109ba47ec9dSmillerti_dlfcn='define' 110ba47ec9dSmillert 11179cd0b9aSmillert# The default one uses exponential notation between 0.0001 and 0.1 11279cd0b9aSmillertd_Gconvert='gcvt_os2((x),(n),(b))' 11379cd0b9aSmillert 11479cd0b9aSmillertcat > UU/uselongdouble.cbu <<'EOCBU' 11579cd0b9aSmillert# This script UU/uselongdouble.cbu will get 'called-back' by Configure 11679cd0b9aSmillert# after it has prompted the user for whether to use long doubles. 11779cd0b9aSmillert# If we will use them, let Configure choose us a Gconvert. 11879cd0b9aSmillertcase "$uselongdouble:$d_longdbl:$d_sqrtl:$d_modfl" in 11979cd0b9aSmillert"$define:$define:$define:$define") d_Gconvert='' ;; 12079cd0b9aSmillertesac 12179cd0b9aSmillertEOCBU 12279cd0b9aSmillert 12379cd0b9aSmillert# -Zomf build has a problem with _exit() *flushing*, so the test 12479cd0b9aSmillert# gets confused: 12579cd0b9aSmillertfflushNULL="define" 12679cd0b9aSmillert 127ba47ec9dSmillertaout_d_shrplib='undef' 128ba47ec9dSmillertaout_useshrplib='false' 129ba47ec9dSmillertaout_obj_ext='.o' 130ba47ec9dSmillertaout_lib_ext='.a' 131ba47ec9dSmillertaout_ar='ar' 132ba47ec9dSmillertaout_plibext='.a' 1336345ca90Smillertaout_lddlflags="-Zdll $ld_dll_optimize" 13409e75b67Smillert 13509e75b67Smillert# -D__ST_MT_ERRNO__ allows a quick relink with -Zmtd to check problems 13609e75b67Smillert# which may be due to linking with -Zmtd DLLs 13709e75b67Smillert 1386345ca90Smillert# Cannot have 32000K stack: get SYS0170 ?! 139ba47ec9dSmillertif [ $emxcrtrev -ge 50 ]; then 14009e75b67Smillert aout_ldflags='-Zexe -Zsmall-conv -Zstack 16000 -D__ST_MT_ERRNO__' 141ba47ec9dSmillertelse 14209e75b67Smillert aout_ldflags='-Zexe -Zstack 16000 -D__ST_MT_ERRNO__' 143ba47ec9dSmillertfi 144ba47ec9dSmillert 145ba47ec9dSmillert# To get into config.sh: 146ba47ec9dSmillertaout_ldflags="$aout_ldflags" 147ba47ec9dSmillert 148ba47ec9dSmillertaout_d_fork='define' 14909e75b67Smillertaout_ccflags="-DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I. $_defemxcrtrev -D__ST_MT_ERRNO__" 15009e75b67Smillertaout_cppflags="-DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I. $_defemxcrtrev -D__ST_MT_ERRNO__" 151ba47ec9dSmillertaout_use_clib='c' 152ba47ec9dSmillertaout_usedl='undef' 153ba47ec9dSmillertaout_archobjs="os2.o dl_os2.o" 15479cd0b9aSmillert# Not listed in dynamic_ext, but needed for AOUT static_ext nevertheless 15579cd0b9aSmillertaout_extra_static_ext="OS2::DLL" 156ba47ec9dSmillert 157ba47ec9dSmillert# variable which have different values for aout compile 158ba47ec9dSmillertused_aout='d_shrplib useshrplib plibext lib_ext obj_ext ar plibext d_fork lddlflags ldflags ccflags use_clib usedl archobjs cppflags' 159ba47ec9dSmillert 1604a4f25f9Sdownsjif [ "$emxaout" != "" ]; then 161ba47ec9dSmillert d_shrplib="$aout_d_shrplib" 162ba47ec9dSmillert useshrplib="$aout_useshrplib" 163ba47ec9dSmillert obj_ext="$aout_obj_ext" 164ba47ec9dSmillert lib_ext="$aout_lib_ext" 165ba47ec9dSmillert ar="$aout_ar" 166ba47ec9dSmillert plibext="$aout_plibext" 167ba47ec9dSmillert if [ $emxcrtrev -lt 50 ]; then 168ba47ec9dSmillert d_fork="$aout_d_fork" 169ba47ec9dSmillert fi 170ba47ec9dSmillert lddlflags="$aout_lddlflags" 171ba47ec9dSmillert ldflags="$aout_ldflags" 172ba47ec9dSmillert ccflags="$aout_ccflags" 173ba47ec9dSmillert cppflags="$aout_cppflags" 174ba47ec9dSmillert use_clib="$aout_use_clib" 175ba47ec9dSmillert usedl="$aout_usedl" 1764a4f25f9Sdownsjelse 1774a4f25f9Sdownsj d_shrplib='define' 178ba47ec9dSmillert useshrplib='true' 1794a4f25f9Sdownsj obj_ext='.obj' 1804a4f25f9Sdownsj lib_ext='.lib' 1814a4f25f9Sdownsj ar='emxomfar' 1824a4f25f9Sdownsj plibext='.lib' 183ba47ec9dSmillert if [ $emxcrtrev -ge 50 ]; then 184ba47ec9dSmillert d_fork='define' 185ba47ec9dSmillert else 1864a4f25f9Sdownsj d_fork='undef' 187ba47ec9dSmillert fi 18879cd0b9aSmillert lddlflags="-Zdll -Zomf -Zmt -Zcrtdll -Zlinker /e:2" 1894a4f25f9Sdownsj # Recursive regmatch may eat 2.5M of stack alone. 19079cd0b9aSmillert ldflags='-Zexe -Zomf -Zmt -Zcrtdll -Zstack 32000 -Zlinker /e:2' 191ba47ec9dSmillert if [ $emxcrtrev -ge 50 ]; then 192e2e5c5d3Smillert ccflags="-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. $_defemxcrtrev" 193ba47ec9dSmillert else 194e2e5c5d3Smillert ccflags="-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. -DEMX_BAD_SBRK $_defemxcrtrev" 195ba47ec9dSmillert fi 1964a4f25f9Sdownsj use_clib='c_import' 197ba47ec9dSmillert usedl='define' 1984a4f25f9Sdownsjfi 1994a4f25f9Sdownsj 2006345ca90Smillert# indented to miss config.sh 2016345ca90Smillert _ar="$ar" 2026345ca90Smillert 2034a4f25f9Sdownsj# To get into config.sh (should start at the beginning of line) 2044a4f25f9Sdownsj# or you can put it into config.over. 2054a4f25f9Sdownsjplibext="$plibext" 206ba47ec9dSmillert# plibext is not needed anymore. Just directly set $libperl. 207ba47ec9dSmillertlibperl="libperl${plibext}" 2084a4f25f9Sdownsj 2094a4f25f9Sdownsj#libc="/emx/lib/st/c_import$lib_ext" 210ba47ec9dSmillertlibc="$libemx/mt/$use_clib$lib_ext" 2114a4f25f9Sdownsj 2124a4f25f9Sdownsjif test -r "$libemx/c_alias$lib_ext"; then 2134a4f25f9Sdownsj libnames="$libemx/c_alias$lib_ext" 2144a4f25f9Sdownsjfi 2154a4f25f9Sdownsj# otherwise puts -lc ??? 2164a4f25f9Sdownsj 2174a4f25f9Sdownsj# [Maybe we should just remove c from $libswanted ?] 2184a4f25f9Sdownsj 219ba47ec9dSmillert# Test would pick up wrong rand, so we hardwire the value for random() 220ba47ec9dSmillertlibs='-lsocket -lm -lbsd' 221ba47ec9dSmillertrandbits=31 222ba47ec9dSmillertarchobjs="os2$obj_ext dl_os2$obj_ext" 2234a4f25f9Sdownsj 224ba47ec9dSmillert# Run files without extension with sh: 2254a4f25f9SdownsjEXECSHELL=sh 2264a4f25f9Sdownsj 2274a4f25f9Sdownsjcccdlflags='-Zdll' 228ba47ec9dSmillertdlsrc='dl_dlopen.xs' 2294a4f25f9Sdownsjld='gcc' 2304a4f25f9Sdownsj 2314a4f25f9Sdownsj#cppflags='-DDOSISH -DOS2=2 -DEMBED -I.' 2324a4f25f9Sdownsj 2334a4f25f9Sdownsj# for speedup: (some patches to ungetc are also needed): 2344a4f25f9Sdownsj# Note that without this guy tests 8 and 10 of io/tell.t fail, with it 11 fails 2354a4f25f9Sdownsj 2364a4f25f9Sdownsjstdstdunder=`echo "#include <stdio.h>" | cpp | egrep -c "char +\* +_ptr"` 2374a4f25f9Sdownsjd_stdstdio='define' 2384a4f25f9Sdownsjd_stdiobase='define' 2394a4f25f9Sdownsjd_stdio_ptr_lval='define' 2404a4f25f9Sdownsjd_stdio_cnt_lval='define' 2414a4f25f9Sdownsj 2424a4f25f9Sdownsjif test "$stdstdunder" = 0; then 2434a4f25f9Sdownsj stdio_ptr='((fp)->ptr)' 2444a4f25f9Sdownsj stdio_cnt='((fp)->rcount)' 2454a4f25f9Sdownsj stdio_base='((fp)->buffer)' 2464a4f25f9Sdownsj stdio_bufsiz='((fp)->rcount + (fp)->ptr - (fp)->buffer)' 2474a4f25f9Sdownsj ccflags="$ccflags -DMYTTYNAME" 2484a4f25f9Sdownsj myttyname='define' 2494a4f25f9Sdownsjelse 2504a4f25f9Sdownsj stdio_ptr='((fp)->_ptr)' 2514a4f25f9Sdownsj stdio_cnt='((fp)->_rcount)' 2524a4f25f9Sdownsj stdio_base='((fp)->_buffer)' 2534a4f25f9Sdownsj stdio_bufsiz='((fp)->_rcount + (fp)->_ptr - (fp)->_buffer)' 2544a4f25f9Sdownsjfi 2554a4f25f9Sdownsj 2564a4f25f9Sdownsj# to put into config.sh 2574a4f25f9Sdownsjmyttyname="$myttyname" 2584a4f25f9Sdownsj 2594a4f25f9Sdownsj# To have manpages installed 2604a4f25f9Sdownsjnroff='nroff.cmd' 2614a4f25f9Sdownsj# above will be overwritten otherwise, indented to avoid config.sh 2624a4f25f9Sdownsj _nroff='nroff.cmd' 2634a4f25f9Sdownsj 264ba47ec9dSmillert# should be handled automatically by Configure now. 2654a4f25f9Sdownsjln='cp' 2664a4f25f9Sdownsj# Will be rewritten otherwise, indented to not put in config.sh 2674a4f25f9Sdownsj _ln='cp' 2684a4f25f9Sdownsjlns='cp' 2694a4f25f9Sdownsj 2704a4f25f9Sdownsjnm_opt='-p' 2714a4f25f9Sdownsj 272ba47ec9dSmillert####### We define these functions ourselves 2734a4f25f9Sdownsj 274c5dcfd37Smillertd_strtoll='define' 275c5dcfd37Smillertd_strtoull='define' 276ba47ec9dSmillertd_getprior='define' 277ba47ec9dSmillertd_setprior='define' 278f64b279aSmillertd_usleep='define' 279f64b279aSmillertd_usleepproto='define' 2804a4f25f9Sdownsj 281ba47ec9dSmillert# The next two are commented. pdksh handles #!, extproc gives no path part. 2824a4f25f9Sdownsj# sharpbang='extproc ' 2834a4f25f9Sdownsj# shsharp='false' 2844a4f25f9Sdownsj 2854a4f25f9Sdownsj# Commented: 2864a4f25f9Sdownsj#startsh='extproc ksh\\n#! sh' 287ba47ec9dSmillert 288e2e5c5d3Smillert# Find patch: 289e2e5c5d3Smillertgnupatch='patch' 290e2e5c5d3Smillertif (gnupatch -v || gnupatch --version) 2>&1 >/dev/null; then 291e2e5c5d3Smillert gnupatch=gnupatch 292e2e5c5d3Smillertelse 293e2e5c5d3Smillert if (gpatch -v || gpatch --version) 2>&1 >/dev/null; then 294e2e5c5d3Smillert gnupatch=gpatch 295e2e5c5d3Smillert else 296e2e5c5d3Smillert # They may have a special PATH during configuring 297e2e5c5d3Smillert if (patch -v || patch --version) 2>&1 >/dev/null; then 298e2e5c5d3Smillert gnupatch="`./UU/loc patch.exe undef $pth`" 299e2e5c5d3Smillert fi 300e2e5c5d3Smillert fi 301e2e5c5d3Smillertfi 302e2e5c5d3Smillert 30379cd0b9aSmillertfor f in less.exe less.sh less.ksh less.cmd more.exe more.sh more.ksh more.cmd ; do 30479cd0b9aSmillert if test -z "$pager"; then 30579cd0b9aSmillert pager="`./UU/loc $f '' $pth`" 30679cd0b9aSmillert fi 30779cd0b9aSmillertdone 30879cd0b9aSmillertif test -z "$pager"; then 30979cd0b9aSmillert pager='cmd /c more' 31079cd0b9aSmillertfi 31179cd0b9aSmillert 312e2e5c5d3Smillert# Apply patches if needed 313e2e5c5d3Smillertcase "$0$running_c_cmd" in 314e2e5c5d3Smillert *[/\\]Configure|*[/\\]Configure.|Configure|Configure.) # Skip Configure.cmd 31579cd0b9aSmillert if test "Xyes" = "X$configure_cmd_loop"; then 31679cd0b9aSmillert cat <<EOC >&2 31779cd0b9aSmillert!!! 31879cd0b9aSmillert!!! PANIC: Loop of self-invocations detected, aborting! 31979cd0b9aSmillert!!! 32079cd0b9aSmillertEOC 32179cd0b9aSmillert exit 20 32279cd0b9aSmillert fi 32379cd0b9aSmillert configure_cmd_loop=yes 32479cd0b9aSmillert export configure_cmd_loop 32579cd0b9aSmillert 32679cd0b9aSmillert configure_needs_patch='' 32779cd0b9aSmillert if test -s ./os2/diff.configure; then 32879cd0b9aSmillert if ! grep "^#OS2-PATCH-APPLIED" ./Configure > /dev/null; then 32979cd0b9aSmillert configure_needs_patch=yes 33079cd0b9aSmillert fi 33179cd0b9aSmillert fi 33279cd0b9aSmillert if test -n "$configure_needs_patch"; then 333e2e5c5d3Smillert # Not patched! 33479cd0b9aSmillert # Restore the initial command line arguments 335e2e5c5d3Smillert if test -f ./Configure.cmd ; then 33679cd0b9aSmillert cat <<EOC >&2 33779cd0b9aSmillert!!! 33879cd0b9aSmillert!!! I see that what is running is ./Configure. 33979cd0b9aSmillert!!! ./Configure is not patched, but ./Configure.cmd exists. 34079cd0b9aSmillert!!! 34179cd0b9aSmillert!!! You are supposed to run Configure.cmd, not Configure 34279cd0b9aSmillert!!! after an automagic patching. 34379cd0b9aSmillert!!! 34479cd0b9aSmillert!!! If you insist on running Configure, you may 34579cd0b9aSmillert!!! patch it manually from ./os2/diff.configure. 34679cd0b9aSmillert!!! 34779cd0b9aSmillert!!! However, I went through incredible hoolahoops, and I expect I can 34879cd0b9aSmillert!!! auto-restart Configure.cmd myself. I will start it with arguments: 34979cd0b9aSmillert!!! 35079cd0b9aSmillert!!! Configure.cmd $args_exp 35179cd0b9aSmillert!!! 35279cd0b9aSmillertEOC 35379cd0b9aSmillert rp='Do you want to auto-restart Configure.cmd?' 35479cd0b9aSmillert dflt='y' 35579cd0b9aSmillert . UU/myread 35679cd0b9aSmillert case "$ans" in 35779cd0b9aSmillert [yY]) echo >&4 "Okay, continuing." ;; 35879cd0b9aSmillert *) echo >&4 "Okay, bye." 35979cd0b9aSmillert exit 2 36079cd0b9aSmillert ;; 36179cd0b9aSmillert esac 36279cd0b9aSmillert eval "set X $args_exp"; 36379cd0b9aSmillert shift; 36479cd0b9aSmillert # Restore the output 36579cd0b9aSmillert exec Configure.cmd "$@" 1>&2 366e2e5c5d3Smillert exit 2 367e2e5c5d3Smillert fi 36879cd0b9aSmillert cat <<EOC >&2 36979cd0b9aSmillert!!! 37079cd0b9aSmillert!!! You did not patch ./Configure! 37179cd0b9aSmillert!!! I can create Configure.cmd and patch it from ./os2/diff.configure with the command 37279cd0b9aSmillert!!! 37379cd0b9aSmillert!!! $gnupatch -b -p1 --output=Configure.cmd <./os2/diff.configure 2>&1 | tee 00_auto_patch 37479cd0b9aSmillertEOC 37579cd0b9aSmillert rp='Do you want to auto-patch Configure to Configure.cmd?' 37679cd0b9aSmillert dflt='y' 37779cd0b9aSmillert . UU/myread 37879cd0b9aSmillert case "$ans" in 37979cd0b9aSmillert [yY]) echo >&4 "Okay, continuing." ;; 38079cd0b9aSmillert *) echo >&4 "Okay, bye." 38179cd0b9aSmillert exit 2 38279cd0b9aSmillert ;; 38379cd0b9aSmillert esac 384e2e5c5d3Smillert ($gnupatch -b -p1 --output=Configure.cmd <./os2/diff.configure 2>&1 | tee 00_auto_patch) >&2 38579cd0b9aSmillert cat <<EOC >&2 38679cd0b9aSmillert!!! 38779cd0b9aSmillert!!! The report of patching is copied to 00_auto_patch. 38879cd0b9aSmillert!!! Now we need to restart Configure.cmd with all the options. 38979cd0b9aSmillert!!! 39079cd0b9aSmillertEOC 391e2e5c5d3Smillert echo "extproc sh" > Configure.ctm 39279cd0b9aSmillert ( cat Configure.cmd >> Configure.ctm && mv -f Configure.ctm Configure.cmd ) || (echo "!!! Failure to add extproc-line to Configure.cmd." >&2 ; exit 21) 39379cd0b9aSmillert cat <<EOC >&2 39479cd0b9aSmillert!!! I went through incredible hoolahoops, and I expect I can 39579cd0b9aSmillert!!! auto-restart Configure.cmd myself. I will start it with arguments: 39679cd0b9aSmillert!!! 39779cd0b9aSmillert!!! Configure.cmd $args_exp 39879cd0b9aSmillert!!! 39979cd0b9aSmillertEOC 40079cd0b9aSmillert rp='Do you want to auto-restart Configure.cmd?' 40179cd0b9aSmillert dflt='y' 40279cd0b9aSmillert . UU/myread 40379cd0b9aSmillert case "$ans" in 40479cd0b9aSmillert [yY]) echo >&4 "Okay, continuing." ;; 40579cd0b9aSmillert *) echo >&4 "Okay, bye." 40679cd0b9aSmillert exit 2 40779cd0b9aSmillert ;; 40879cd0b9aSmillert esac 40979cd0b9aSmillert eval "set X $args_exp"; 41079cd0b9aSmillert shift; 41179cd0b9aSmillert exec Configure.cmd "$@" 1>&2 41279cd0b9aSmillert exit 2 413e2e5c5d3Smillert else 41479cd0b9aSmillert if test -s ./os2/diff.configure; then 415e2e5c5d3Smillert echo "!!! Apparently we are running a patched Configure." >&2 41679cd0b9aSmillert else 41779cd0b9aSmillert echo "!!! Apparently there is no need to patch Configure." >&2 41879cd0b9aSmillert fi 419e2e5c5d3Smillert fi 420e2e5c5d3Smillert ;; 421e2e5c5d3Smillert *) echo "!!! Apparently we are running a renamed Configure: '$0'." >&2 422e2e5c5d3Smillertesac 423e2e5c5d3Smillert 4246345ca90Smillert# This script UU/usethreads.cbu will get 'called-back' by Configure 4256345ca90Smillert# after it has prompted the user for whether to use threads. 4266345ca90Smillertcat > UU/usethreads.cbu <<'EOCBU' 4276345ca90Smillertcase "$usethreads" in 4286345ca90Smillert$define|true|[yY]*) 4296345ca90Smillert ccflags="-Zmt $ccflags" 4306345ca90Smillert cppflags="-Zmt $cppflags" # Do we really need to set this? 4316345ca90Smillert aout_ccflags="-DUSE_THREADS $aout_ccflags" 4326345ca90Smillert aout_cppflags="-DUSE_THREADS $aout_cppflags" 4336345ca90Smillert aout_lddlflags="-Zmt $aout_lddlflags" 4346345ca90Smillert aout_ldflags="-Zmt $aout_ldflags" 4356345ca90Smillert ;; 4366345ca90Smillertesac 4376345ca90SmillertEOCBU 438ba47ec9dSmillert 43979cd0b9aSmillertif test -z "$cryptlib"; then 44079cd0b9aSmillert cryptlib=`UU/loc crypt$lib_ext "" $libpth` 44179cd0b9aSmillert if $test -n "$cryptlib"; then 44279cd0b9aSmillert cryptlib=-lcrypt 44379cd0b9aSmillert else 44479cd0b9aSmillert cryptlib=`UU/loc ufc$lib_ext "" $libpth` 44579cd0b9aSmillert if $test -n "$cryptlib"; then 44679cd0b9aSmillert cryptlib=-lufc 44779cd0b9aSmillert fi 44879cd0b9aSmillert fi 44979cd0b9aSmillertfi 45079cd0b9aSmillertif test -n "$cryptlib"; then 45179cd0b9aSmillert libs="$libs $cryptlib" 45279cd0b9aSmillert # d_crypt=define 45379cd0b9aSmillertfi 45479cd0b9aSmillert 455ba47ec9dSmillert# Now install the external modules. We are in the ./hints directory. 456ba47ec9dSmillert 4576345ca90Smillertcd ./os2/OS2 458ba47ec9dSmillert 459*0dc2eaceSmillertcp -rfu * ../../ext/ 460ba47ec9dSmillert 461ba47ec9dSmillert# Install tests: 462ba47ec9dSmillert 46379cd0b9aSmillertcp -uf ../*.t ../../t/lib 464ba47ec9dSmillertfor xxx in * ; do 465ba47ec9dSmillert if $test -d $xxx/t; then 466ba47ec9dSmillert cp -uf $xxx/t/*.t ../../t/lib 467ba47ec9dSmillert else 468ba47ec9dSmillert if $test -d $xxx; then 469ba47ec9dSmillert cd $xxx 470ba47ec9dSmillert for yyy in * ; do 471ba47ec9dSmillert if $test -d $yyy/t; then 472ba47ec9dSmillert cp -uf $yyy/t/*.t ../../t/lib 473ba47ec9dSmillert fi 474ba47ec9dSmillert done 475ba47ec9dSmillert cd .. 476ba47ec9dSmillert fi 477ba47ec9dSmillert fi 478ba47ec9dSmillertdone 479ba47ec9dSmillert 480e2e5c5d3Smillertcase "$ldlibpthname" in 481e2e5c5d3Smillert'') ldlibpthname=none ;; 482e2e5c5d3Smillertesac 483ba47ec9dSmillert 484ba47ec9dSmillert# Now go back 4856345ca90Smillertcd ../.. 48679cd0b9aSmillertcp os2/*.t t/lib 487