Ilya Zakharevich on Sun, 23 Nov 1997 00:05:28 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Os/2 portablity patch for pari2.0-alpha |
This patch makes it possible to compile PARI on OS/2 (if one has enough tools). Everything works except 1) Dynamic loading (how AIX does it - it also needs export list, right?); 2) Extended help is (wrongly) reported missing; 3) I did not check that gphelp works without -detex if XFree86 is loaded; 4) I did not check 'make install'; The following problems not related to OS/2 are noted/corrected: a) gcc is prefered to g++, is it correct? b) I changed uname test to myuname=`(uname -a) 2>/dev/null || arch 2>&1` to make it possible to run Configure with -x option, otherwise (additional parens) it is set to "+ 2>&1 something"; c) Version check for readline was checking for older variable LibraryVersion, not present in newer readlines; d) GPHELP_DOCDIR environment variable granted; e) tutorial was rebuilt every time; f) Non-portable [BUG] in shell script quoted; g) Refcard is clipped on top and bottom on Letter paper (at least with LJ4); To apply: mv configure config # Avoid name clash with Configure mv doc/Makefile config/doc_make.SH patch -p1 < file-name-this-file diff -pru pari-2.0.alpha/config/config.h.SH pari-2.0.alpha.my/config/config.h.SH --- pari-2.0.alpha/config/config.h.SH Wed Sep 24 17:28:28 1997 +++ pari-2.0.alpha.my/config/config.h.SH Sat Nov 22 00:46:40 1997 @@ -8,6 +8,12 @@ case "$optimization" in *) debuginfo=" -- $optimization";; esac +case "$osname" in + os2) gphelp="perl -S gphelp -detex" ;; + *) gphelp="$miscdir/gphelp" ;; +esac + + cat > $file << EOT /* This file was created by Configure. Any change made to it will be lost * next time configure is run. @@ -16,8 +22,9 @@ cat > $file << EOT #define __CONFIG_H__ #define UNIX -#define GPHELP "$miscdir/gphelp" +#define GPHELP "$gphelp" #define GPDATADIR "$datadir" +#define SHELL_Q '\\$shell_q' #define PARIVERSION "GP/PARI CALCULATOR Version ${revision}" #ifdef __cplusplus diff -pru pari-2.0.alpha/config/doc_make.SH pari-2.0.alpha.my/config/doc_make.SH --- pari-2.0.alpha/config/doc_make.SH Thu Nov 6 05:07:44 1997 +++ pari-2.0.alpha.my/config/doc_make.SH Sat Nov 22 13:40:08 1997 @@ -1,3 +1,13 @@ +cat >doc/Makefile <<EOT + +# This file was created by Configure. Any change made to it will be lost +# next time configure is run. +SHELL = $make_sh + +EOT + +cat >>doc/Makefile <<'EOT' + all: doc refcard tutorial macros.tex: macros.tex.in @@ -7,7 +17,9 @@ force: macros.tex all doc manual: users.dvi -tutorial: tutorial.tex +tutorial: tutorial.dvi + +tutorial.dvi: tutorial.tex tex $< refcard.dvi: refcard.tex @@ -32,3 +44,5 @@ halfclean: clean: halfclean rm -f macros.tex users.aux users.std users.toc + +EOT diff -pru pari-2.0.alpha/config/GENMakefile.SH pari-2.0.alpha.my/config/GENMakefile.SH --- pari-2.0.alpha/config/GENMakefile.SH Sat Oct 18 04:46:38 1997 +++ pari-2.0.alpha.my/config/GENMakefile.SH Fri Nov 21 18:05:54 1997 @@ -5,7 +5,6 @@ lnfile=$dir/Makefile echo Extracting $file rm -f $file $lnfile -ln -s $name $lnfile case "$osname" in aix) dynlib=a ;; @@ -41,6 +40,7 @@ cat > $file << EOT # change this TARGET to compile your own programs TARGET = matexp +SHELL = $make_sh DBGFLAGS = $DBGFLAGS $CFLAGS CFLAGS = $OPTFLAGS $CFLAGS @@ -103,3 +103,5 @@ dynlib: \$(DYN) clean: -\$(RM) *.o \$(ALL) EOT + +$ln_s $name $lnfile diff -pru pari-2.0.alpha/config/locate pari-2.0.alpha.my/config/locate --- pari-2.0.alpha/config/locate Thu Oct 3 04:00:56 1996 +++ pari-2.0.alpha.my/config/locate Fri Nov 21 17:17:08 1997 @@ -6,5 +6,9 @@ for dir in $*; do if test -f $file; then echo $file; exit 0 fi + file=$file.exe + if test -f $file; then + echo $file; exit 0 + fi done echo $dflt; exit 1 diff -pru pari-2.0.alpha/config/locatelib pari-2.0.alpha.my/config/locatelib --- pari-2.0.alpha/config/locatelib Thu Dec 19 12:42:54 1996 +++ pari-2.0.alpha.my/config/locatelib Fri Nov 21 18:52:26 1997 @@ -1,5 +1,8 @@ for dir in $pth; do - try=`ls $dir/lib$lib.* 2> /dev/null` + case "$osname" in + os2) try=`ls $dir/$lib.a 2> /dev/null`;; + *) try=`ls $dir/lib$lib.* 2> /dev/null`;; + esac if test ! -z "$try"; then echo ..."Found lib$lib in $dir"; eval $lib=$dir; diff -pru pari-2.0.alpha/config/Makefile.SH pari-2.0.alpha.my/config/Makefile.SH --- pari-2.0.alpha/config/Makefile.SH Fri Nov 14 07:38:32 1997 +++ pari-2.0.alpha.my/config/Makefile.SH Fri Nov 21 18:40:52 1997 @@ -115,6 +115,7 @@ cat > $file << EOT # This file was created by Configure. Any change made to it will be # lost when Configure is run. # +SHELL = $make_sh AS = $AS ASFLAGS = $ASFLAGS @@ -135,7 +136,7 @@ DLCFLAGS = $DLCFLAGS LIBS = -lm $LIBS RM = rm -f -LN = ln -s +LN = $ln_s # Change these installation directories to suit your needs. @@ -162,12 +163,12 @@ $rr RLLIBS = $RLLIBS OBJS = $OBJS OBJSGP = $OBJSGP -dft gp: gp-$dft lib-$dft ../gp$suffix +dft gp: gp-$dft lib-$dft ../gp$suffix$exe_suff - -../gp$suffix: gp-$dft +../gp$suffix$exe_suff: gp-$dft -\$(RM) \$@ - -\$(LN) $objdir/gp-$dft \$@ + -\$(LN) gp-$dft$exe_suff \$@ all: gp-sta gp-dyn lib-sta lib-dyn @@ -251,14 +252,14 @@ install-bin: gp-$dft-install \$(INSTALL_PROGRAM) gp-$dft \$(BINDIR)/gp-$version strip \$(BINDIR)/gp-$version -\$(RM) \$(BINDIR)/gp - -\$(LN) gp-$version \$(BINDIR)/gp + -\$(LN) gp-$version$exe_suff \$(BINDIR)/gp$exe_suff install-bin-sta: gp-sta-install -mkdir -p \$(BINDIR) \$(INSTALL_PROGRAM) gp-sta \$(BINDIR)/gp-$version strip \$(BINDIR)/gp-$version -\$(RM) \$(BINDIR)/gp - -\$(LN) gp-$version \$(BINDIR)/gp + -\$(LN) gp-$version$exe_suff \$(BINDIR)/gp$exe_suff install-man:: -mkdir -p \$(MANDIR) diff -pru pari-2.0.alpha/config/TOPMakefile.SH pari-2.0.alpha.my/config/TOPMakefile.SH --- pari-2.0.alpha/config/TOPMakefile.SH Sun Nov 9 10:45:50 1997 +++ pari-2.0.alpha.my/config/TOPMakefile.SH Fri Nov 21 18:06:20 1997 @@ -4,7 +4,6 @@ rm -f $file tarfile=pari-$revision.tar file=Makefile.$osname-$arch$suffix -ln -s $file Makefile rm -f $file if test -n "$GP_INSTALL_PREFIX"; then @@ -17,6 +16,7 @@ cat > $file << EOT # next time Configure is run. # RM = /bin/rm -f +SHELL = $make_sh dft target:: @echo "Possible targets are :" @@ -51,7 +51,7 @@ exp:: exit 1; fi; done for dir in configure src doc perl; do \\ mv \$\$dir \$\$dir.orig; cp -pr \$\$dir.orig \$\$dir; done - ln -s src exp + $ln_s src exp sed "s,patch_level=.*,patch_level=exp," \\ < configure.orig/version > configure/version @@ -113,3 +113,5 @@ EOT EOT ;; esac + +$ln_s $file Makefile diff -pru pari-2.0.alpha/INSTALL.QUICK pari-2.0.alpha.my/INSTALL.QUICK --- pari-2.0.alpha/INSTALL.QUICK Mon Nov 10 05:12:22 1997 +++ pari-2.0.alpha.my/INSTALL.QUICK Fri Nov 21 18:25:40 1997 @@ -11,3 +11,5 @@ e) copy lib/gprc.default to $HOME/.gprc. f) copy/modify lib/gpalias somewhere and call it from your .gprc (if desired) That's it ! Read INSTALL.tex for more detailed information. + +(Same procedure should work on OS/2 with EMX, GNU tools, and pdksh.) diff -pru pari-2.0.alpha/perl/gphelp.in pari-2.0.alpha.my/perl/gphelp.in --- pari-2.0.alpha/perl/gphelp.in Mon Nov 10 20:07:58 1997 +++ pari-2.0.alpha.my/perl/gphelp.in Sat Nov 22 00:06:02 1997 @@ -6,7 +6,7 @@ # The manual file can be compressed (see the %zcat statement below). # $version= "@version@"; -$docdir = "@miscdir@"; +$docdir = $ENV{GPHELP_DOCDIR} || "@miscdir@"; %zcat = ( '.gz', '@gunzip@ -c', diff -pru pari-2.0.alpha/src/gp/gp.c pari-2.0.alpha.my/src/gp/gp.c --- pari-2.0.alpha/src/gp/gp.c Thu Nov 13 19:53:34 1997 +++ pari-2.0.alpha.my/src/gp/gp.c Sat Nov 22 00:28:26 1997 @@ -1660,7 +1660,7 @@ external_help(char *s) if (!help_prg) err(talker,"No available external help program"); - sprintf(thestring,"%s -fromgp '%s'",help_prg,s); + sprintf(thestring,"%s -fromgp %c%s%c",help_prg,SHELL_Q,s,SHELL_Q); file = (FILE *) popen(thestring,"r"); if (!file) err(talker,"%s %s failed !",GPHELP,s); diff -pru pari-2.0.alpha/src/gp/gp_rl.c pari-2.0.alpha.my/src/gp/gp_rl.c --- pari-2.0.alpha/src/gp/gp_rl.c Thu Nov 13 19:53:36 1997 +++ pari-2.0.alpha.my/src/gp/gp_rl.c Sat Nov 22 00:32:50 1997 @@ -339,8 +339,8 @@ init_readline(int i) Bind('H', (Function*) rl_long_help, vi_movement_keymap); # ifdef EMACS_DOS_KEYMAP - Bind(';', (char*) rl_short_help, emacs_dos_keymap); /* F1 */ - Bind('T', (char*) rl_long_help, emacs_dos_keymap); /* Shift-F1 */ + Bind(';', (Function*) rl_short_help, emacs_dos_keymap); /* F1 */ + Bind('T', (Function*) rl_long_help, emacs_dos_keymap); /* Shift-F1 */ # endif } #endif diff -pru pari-2.0.alpha/src/test-bench/dotest pari-2.0.alpha.my/src/test-bench/dotest --- pari-2.0.alpha/src/test-bench/dotest Mon Nov 3 11:34:50 1997 +++ pari-2.0.alpha.my/src/test-bench/dotest Sat Nov 22 11:08:44 1997 @@ -14,14 +14,15 @@ test -z "$testlist" && testlist="\ nfields_200\ " -confdir=../configure +confdir=../config testdir=../src/test-bench execdir=. +if test -f /bin/rm ; then RM=/bin/rm; else RM=rm ; fi if sh -c 'test -x /bin/sh' 2>&-; then x=-x; else x=-r; fi (echo "hi there\c" ; echo " ") > echotmp if grep c echotmp >/dev/null 2>&1 ; then n='-n'; c=''; else n=''; c='\c'; fi -/bin/rm echotmp +$RM echotmp case "$1" in 8) bitlen=64 ;; @@ -51,7 +52,7 @@ esac BUG=":" . $confdir/version file_bench=Bench-$revision -/bin/rm -f $file_bench +$RM -f $file_bench for dft in $dotestARG; do eval time$dft=0; done for testdata in $testlist; do # testname : nom du fichier @@ -80,7 +81,7 @@ for testdata in $testlist; do echo $n "TIME=$time$c">>$file_bench eval time$dft='`'expr $time '\\*' $testmul / 1000 + '$'time$dft'`' else - eval BUG$dft="[BUG]" + eval BUG$dft="'[BUG]'" echo $n "BUG [$time]$c" echo $n "BUG [$time]$c">>$file_bench fi