X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/b691c02f8c79b7bac4a606da95849c0c7bcae239..6fa2dc60899234df7bde728354b58afa2779105e:/hints/os2.sh diff --git a/hints/os2.sh b/hints/os2.sh index 0560175..6309b19 100644 --- a/hints/os2.sh +++ b/hints/os2.sh @@ -4,7 +4,7 @@ # Ilya Zakharevich # # Trimmed and comments added by -# Andy Dougherty +# Andy Dougherty # Exactly what is required beyond a standard OS/2 installation? # (see in README.os2) @@ -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' @@ -106,6 +108,22 @@ exe_ext='.exe' # We provide it i_dlfcn='define' +# The default one uses exponential notation between 0.0001 and 0.1 +d_Gconvert='gcvt_os2((x),(n),(b))' + +cat > UU/uselongdouble.cbu <<'EOCBU' +# This script UU/uselongdouble.cbu will get 'called-back' by Configure +# after it has prompted the user for whether to use long doubles. +# If we will use them, let Configure choose us a Gconvert. +case "$uselongdouble:$d_longdbl:$d_sqrtl:$d_modfl" in +"$define:$define:$define:$define") d_Gconvert='' ;; +esac +EOCBU + +# -Zomf build has a problem with _exit() *flushing*, so the test +# gets confused: +fflushNULL="define" + aout_d_shrplib='undef' aout_useshrplib='false' aout_obj_ext='.o' @@ -113,22 +131,28 @@ aout_lib_ext='.a' aout_ar='ar' aout_plibext='.a' aout_lddlflags="-Zdll $ld_dll_optimize" + +# -D__ST_MT_ERRNO__ allows a quick relink with -Zmtd to check problems +# which may be due to linking with -Zmtd DLLs + # Cannot have 32000K stack: get SYS0170 ?! if [ $emxcrtrev -ge 50 ]; then - aout_ldflags='-Zexe -Zsmall-conv -Zstack 16000' + aout_ldflags='-Zexe -Zsmall-conv -Zstack 16000 -D__ST_MT_ERRNO__' else - aout_ldflags='-Zexe -Zstack 16000' + aout_ldflags='-Zexe -Zstack 16000 -D__ST_MT_ERRNO__' 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 -D__ST_MT_ERRNO__" +aout_cppflags="-DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I. $_defemxcrtrev -D__ST_MT_ERRNO__" aout_use_clib='c' aout_usedl='undef' aout_archobjs="os2.o dl_os2.o" +# Not listed in dynamic_ext, but needed for AOUT static_ext nevertheless +aout_extra_static_ext="OS2::DLL" # variable which have different values for aout compile used_aout='d_shrplib useshrplib plibext lib_ext obj_ext ar plibext d_fork lddlflags ldflags ccflags use_clib usedl archobjs cppflags' @@ -161,13 +185,13 @@ else else d_fork='undef' fi - lddlflags="-Zdll -Zomf -Zmt -Zcrtdll $ld_dll_optimize" + lddlflags="-Zdll -Zomf -Zmt -Zcrtdll -Zlinker /e:2" # Recursive regmatch may eat 2.5M of stack alone. - ldflags='-Zexe -Zomf -Zmt -Zcrtdll -Zstack 32000' + ldflags='-Zexe -Zomf -Zmt -Zcrtdll -Zstack 32000 -Zlinker /e:2' 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' @@ -247,8 +271,12 @@ nm_opt='-p' ####### We define these functions ourselves +d_strtoll='define' +d_strtoull='define' d_getprior='define' d_setprior='define' +d_usleep='define' +d_usleepproto='define' # The next two are commented. pdksh handles #!, extproc gives no path part. # sharpbang='extproc ' @@ -257,22 +285,182 @@ d_setprior='define' # Commented: #startsh='extproc ksh\\n#! sh' -# Copy pod: +# 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 -cp ./README.os2 ./pod/perlos2.pod +for f in less.exe less.sh less.ksh less.cmd more.exe more.sh more.ksh more.cmd ; do + if test -z "$pager"; then + pager="`./UU/loc $f '' $pth`" + fi +done +if test -z "$pager"; then + pager='cmd /c more' +fi -# Now install the external modules. We are in the ./hints directory. +# Apply patches if needed +case "$0$running_c_cmd" in + *[/\\]Configure|*[/\\]Configure.|Configure|Configure.) # Skip Configure.cmd + if test "Xyes" = "X$configure_cmd_loop"; then + cat <&2 +!!! +!!! PANIC: Loop of self-invocations detected, aborting! +!!! +EOC + exit 20 + fi + configure_cmd_loop=yes + export configure_cmd_loop -cd ./os2/OS2 + configure_needs_patch='' + if test -s ./os2/diff.configure; then + if ! grep "^#OS2-PATCH-APPLIED" ./Configure > /dev/null; then + configure_needs_patch=yes + fi + fi + if test -n "$configure_needs_patch"; then + # Not patched! + # Restore the initial command line arguments + if test -f ./Configure.cmd ; then + cat <&2 +!!! +!!! I see that what is running is ./Configure. +!!! ./Configure is not patched, but ./Configure.cmd exists. +!!! +!!! You are supposed to run Configure.cmd, not Configure +!!! after an automagic patching. +!!! +!!! If you insist on running Configure, you may +!!! patch it manually from ./os2/diff.configure. +!!! +!!! However, I went through incredible hoolahoops, and I expect I can +!!! auto-restart Configure.cmd myself. I will start it with arguments: +!!! +!!! Configure.cmd $args_exp +!!! +EOC + rp='Do you want to auto-restart Configure.cmd?' + dflt='y' + . UU/myread + case "$ans" in + [yY]) echo >&4 "Okay, continuing." ;; + *) echo >&4 "Okay, bye." + exit 2 + ;; + esac + eval "set X $args_exp"; + shift; + # Restore the output + exec Configure.cmd "$@" 1>&2 + exit 2 + fi + cat <&2 +!!! +!!! You did not patch ./Configure! +!!! I can create Configure.cmd and patch it from ./os2/diff.configure with the command +!!! +!!! $gnupatch -b -p1 --output=Configure.cmd <./os2/diff.configure 2>&1 | tee 00_auto_patch +EOC + rp='Do you want to auto-patch Configure to Configure.cmd?' + dflt='y' + . UU/myread + case "$ans" in + [yY]) echo >&4 "Okay, continuing." ;; + *) echo >&4 "Okay, bye." + exit 2 + ;; + esac + ($gnupatch -b -p1 --output=Configure.cmd <./os2/diff.configure 2>&1 | tee 00_auto_patch) >&2 + cat <&2 +!!! +!!! The report of patching is copied to 00_auto_patch. +!!! Now we need to restart Configure.cmd with all the options. +!!! +EOC + echo "extproc sh" > Configure.ctm + ( cat Configure.cmd >> Configure.ctm && mv -f Configure.ctm Configure.cmd ) || (echo "!!! Failure to add extproc-line to Configure.cmd." >&2 ; exit 21) + cat <&2 +!!! I went through incredible hoolahoops, and I expect I can +!!! auto-restart Configure.cmd myself. I will start it with arguments: +!!! +!!! Configure.cmd $args_exp +!!! +EOC + rp='Do you want to auto-restart Configure.cmd?' + dflt='y' + . UU/myread + case "$ans" in + [yY]) echo >&4 "Okay, continuing." ;; + *) echo >&4 "Okay, bye." + exit 2 + ;; + esac + eval "set X $args_exp"; + shift; + exec Configure.cmd "$@" 1>&2 + exit 2 + else + if test -s ./os2/diff.configure; then + echo "!!! Apparently we are running a patched Configure." >&2 + else + echo "!!! Apparently there is no need to patch Configure." >&2 + fi + fi + ;; + *) echo "!!! Apparently we are running a renamed Configure: '$0'." >&2 +esac + +# 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 -if ! test -d ../../ext/OS2 ; then - mkdir ../../ext/OS2 +if test -z "$cryptlib"; then + cryptlib=`UU/loc crypt$lib_ext "" $libpth` + if $test -n "$cryptlib"; then + cryptlib=-lcrypt + else + cryptlib=`UU/loc ufc$lib_ext "" $libpth` + if $test -n "$cryptlib"; then + cryptlib=-lufc + fi + fi +fi +if test -n "$cryptlib"; then + libs="$libs $cryptlib" + # d_crypt=define fi -cp -rfu * ../../ext/OS2/ +# Now install the external modules. We are in the ./hints directory. + +cd ./os2/OS2 + +cp -rfu * ../../ext/ # Install tests: +cp -uf ../*.t ../../t/lib for xxx in * ; do if $test -d $xxx/t; then cp -uf $xxx/t/*.t ../../t/lib @@ -289,6 +477,10 @@ for xxx in * ; do fi done +case "$ldlibpthname" in +'') ldlibpthname=none ;; +esac # Now go back cd ../.. +cp os2/*.t t/lib