X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=hints%2Fos2.sh;h=0e9f786d25ac0adf4de998394a689cf46b155b5e;hb=3e2c37ef5374d29d2f1325d2606bdabc38b196dc;hp=78d370a1e9399044744c7456e60c449def5d67cc;hpb=2c2e0e8c03d67909bd8b889b6cdbb201bea519fc;p=p5sagit%2Fp5-mst-13.2.git diff --git a/hints/os2.sh b/hints/os2.sh index 78d370a..0e9f786 100644 --- a/hints/os2.sh +++ b/hints/os2.sh @@ -93,8 +93,10 @@ if test "$libemx" = "X"; then echo "Cannot find C library!" >&2; fi libpth="`echo \"$LIBRARY_PATH\" | tr ';\\\' ' /'`" libpth="$libpth $libemx/mt $libemx" -set `emxrev -f emxlibcm` +set `cmd /c emxrev -f emxlibcm` emxcrtrev=$5 +# indented to not put it into config.sh + _defemxcrtrev=-D_EMX_CRT_REV_=$emxcrtrev so='dll' @@ -113,18 +115,19 @@ aout_lib_ext='.a' aout_ar='ar' aout_plibext='.a' aout_lddlflags="-Zdll $ld_dll_optimize" +# Cannot have 32000K stack: get SYS0170 ?! if [ $emxcrtrev -ge 50 ]; then - aout_ldflags='-Zexe -Zsmall-conv -Zstack 32000' + aout_ldflags='-Zexe -Zsmall-conv -Zstack 16000' else - aout_ldflags='-Zexe -Zstack 32000' + aout_ldflags='-Zexe -Zstack 16000' fi # To get into config.sh: aout_ldflags="$aout_ldflags" aout_d_fork='define' -aout_ccflags='-DPERL_CORE -DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I.' -aout_cppflags='-DPERL_CORE -DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I.' +aout_ccflags="-DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I. $_defemxcrtrev" +aout_cppflags="-DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I. $_defemxcrtrev" aout_use_clib='c' aout_usedl='undef' aout_archobjs="os2.o dl_os2.o" @@ -164,9 +167,9 @@ else # Recursive regmatch may eat 2.5M of stack alone. ldflags='-Zexe -Zomf -Zmt -Zcrtdll -Zstack 32000' if [ $emxcrtrev -ge 50 ]; then - ccflags='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I.' + ccflags="-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. $_defemxcrtrev" else - ccflags='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. -DEMX_BAD_SBRK' + ccflags="-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. -DEMX_BAD_SBRK $_defemxcrtrev" fi use_clib='c_import' usedl='define' @@ -249,15 +252,6 @@ nm_opt='-p' d_getprior='define' d_setprior='define' -if [ "X$usethreads" = "X$define" ]; then - ccflags="-Zmt $ccflags" - cppflags="-Zmt $cppflags" # Do we really need to set this? - aout_ccflags="-DUSE_THREADS $aout_ccflags" - aout_cppflags="-DUSE_THREADS $aout_cppflags" - aout_lddlflags="-Zmt $aout_lddlflags" - aout_ldflags="-Zmt $aout_ldflags" -fi - # The next two are commented. pdksh handles #!, extproc gives no path part. # sharpbang='extproc ' # shsharp='false' @@ -265,9 +259,71 @@ fi # Commented: #startsh='extproc ksh\\n#! sh' +# Find patch: +gnupatch='patch' +if (gnupatch -v || gnupatch --version) 2>&1 >/dev/null; then + gnupatch=gnupatch +else + if (gpatch -v || gpatch --version) 2>&1 >/dev/null; then + gnupatch=gpatch + else + # They may have a special PATH during configuring + if (patch -v || patch --version) 2>&1 >/dev/null; then + gnupatch="`./UU/loc patch.exe undef $pth`" + fi + fi +fi + +# Apply patches if needed +case "$0$running_c_cmd" in + *[/\\]Configure|*[/\\]Configure.|Configure|Configure.) # Skip Configure.cmd + if grep "^libnames" ./Configure > /dev/null; then + # Not patched! + if test -f ./Configure.cmd ; then + echo "!!!" >&2 + echo "!!! ./Configure not patched, but ./Configure.cmd exits" >&2 + echo "!!! Do not know what to do!" >&2 + echo "!!!" >&2 + exit 2 + fi + echo "!!!" >&2 + echo "!!! You did not patch ./Configure!" >&2 + echo "!!! I create Configure.cmd and patch it from ./os2/diff.configure." >&2 + echo "!!!" >&2 + echo "$gnupatch -b -p1 --output=Configure.cmd <./os2/diff.configure 2>&1 | tee 00_auto_patch" >&2 + ($gnupatch -b -p1 --output=Configure.cmd <./os2/diff.configure 2>&1 | tee 00_auto_patch) >&2 + echo "!!!" >&2 + echo "!!! The report of patching is copied to 00_auto_patch." >&2 + echo "!!! Now you need to restart Configure.cmd with all the options" >&2 + echo "!!!" >&2 + echo "extproc sh" > Configure.ctm + cat Configure.cmd >> Configure.ctm && mv -f Configure.ctm Configure.cmd + exit 0 + else + echo "!!! Apparently we are running a patched Configure." >&2 + fi + ;; + *) echo "!!! Apparently we are running a renamed Configure: '$0'." >&2 +esac + # Copy pod: -cp ./README.os2 ./pod/perlos2.pod +cp -uf ./README.os2 ./pod/perlos2.pod + +# This script UU/usethreads.cbu will get 'called-back' by Configure +# after it has prompted the user for whether to use threads. +cat > UU/usethreads.cbu <<'EOCBU' +case "$usethreads" in +$define|true|[yY]*) + ccflags="-Zmt $ccflags" + cppflags="-Zmt $cppflags" # Do we really need to set this? + aout_ccflags="-DUSE_THREADS $aout_ccflags" + aout_cppflags="-DUSE_THREADS $aout_cppflags" + aout_lddlflags="-Zmt $aout_lddlflags" + aout_ldflags="-Zmt $aout_ldflags" + ;; +esac +EOCBU # Now install the external modules. We are in the ./hints directory. @@ -297,6 +353,9 @@ for xxx in * ; do fi done +case "$ldlibpthname" in +'') ldlibpthname=none ;; +esac # Now go back cd ../..