380 lines
8.2 KiB
Plaintext
Executable file
380 lines
8.2 KiB
Plaintext
Executable file
: check that the script is started from the "first" directory
|
|
p=`pwd`
|
|
case `basename $p` in
|
|
first)
|
|
;;
|
|
*)
|
|
echo "this script must be started from the 'first' directory"
|
|
exit 3
|
|
;;
|
|
esac
|
|
: check $PATH first
|
|
if sh ckpath
|
|
then
|
|
echo "PATH is ok"
|
|
else
|
|
exit 1
|
|
fi
|
|
echo check write-ability of /tmp and /usr/tmp ...
|
|
if ( >/usr/tmp/aaax.$$ )
|
|
then
|
|
rm /usr/tmp/aaax.$$
|
|
else
|
|
echo /usr/tmp must exist and be writable.
|
|
exit 2
|
|
fi
|
|
if ( >/tmp/aaax.$$ )
|
|
then
|
|
rm /tmp/aaax.$$
|
|
else
|
|
echo /tmp must exist and be writable.
|
|
exit 2
|
|
fi
|
|
echo "/tmp and /usr/tmp ok"
|
|
echo setting ACK HOME Directory in ../h/em_path.h ...
|
|
rm -f em_path.h
|
|
HM=`cd ..; pwd`
|
|
sed -e "/^#define[ ]*EM_DIR/s@\".*\"@\"$HM\"@" <../h/em_path.h >em_path.h
|
|
if cmp ../h/em_path.h em_path.h >/dev/null 2>&1
|
|
then
|
|
: Don't touch ../h/em_path.h, it's already correct
|
|
echo "../h/em_path.h already correct"
|
|
else
|
|
rm -f ../h/em_path.h
|
|
if mv em_path.h ../h >/dev/null 2>&1
|
|
then echo "../h/em_path.h replaced"
|
|
else
|
|
echo "Sorry, can't replace ../h/em_path.h"
|
|
exit 7
|
|
fi
|
|
fi
|
|
echo compile own echo program, so that we know how it works ...
|
|
if cc -o echo myecho.c > /dev/null 2>&1
|
|
then
|
|
echo compilation succeeded
|
|
else
|
|
echo "Sorry, cc does not seem to work"
|
|
exit 8
|
|
fi
|
|
cp echo ../bin/echo
|
|
: find cc option for lex library
|
|
if fixlexlib
|
|
then
|
|
:
|
|
else
|
|
exit 9
|
|
fi
|
|
: remove non-system as and ld from descr files
|
|
if (ack_sys) >/dev/null 2>&1
|
|
then
|
|
: echo Your system is: `ack_sys`.
|
|
else
|
|
echo -n "Give me the type of your system, the current choice is:
|
|
pdp_v7 PDP11 with sep I/D and version 7 (or BSD 2.8, 2.9)
|
|
vax_bsd4_1a VAX11 with BSD4.1a
|
|
vax_bsd4_2 VAX11 with BSD4.2
|
|
vax_sysV_2 VAX11 with System V.2
|
|
pc_ix IBM PC with PC/IX
|
|
xenix3 IBM AT running Microsoft Xenix V3.2
|
|
m68_unisoft Motorola 68000 with Unisoft UNIX
|
|
sun3 Sun 3 M68020 workstation
|
|
sun2 Sun 2 M68000 workstation
|
|
m68_sysV_0 Motorola 68000 with Uniplus System V.0 Unix
|
|
m68020 Motorola M68020 VME131 running Unix System V/68 R2V2.1
|
|
SMALL Neither of the above, small address space
|
|
ANY Neither of the above
|
|
|
|
system type: "
|
|
if read SYSNAME
|
|
then
|
|
echo echo "$SYSNAME" >../bin/ack_sys
|
|
chmod +x ../bin/ack_sys
|
|
case `ack_sys` in
|
|
pdp_v7|vax_bsd4_1a|vax_bsd4_2|vax_sysV_2|pc_ix|m68_unisoft|sun3|sun2|m68_sysV_0|xenix3|m68020) ;;
|
|
*) echo None of the software especially intended for the named systems will work ;;
|
|
esac
|
|
else
|
|
echo Sorry, got EOF when reading system name.
|
|
exit 10
|
|
fi
|
|
fi
|
|
echo -n "Your system is `ack_sys`, are you satisfied with that? (y/n) "
|
|
if read YESNO
|
|
then
|
|
case $YESNO in
|
|
j*|y*) ;;
|
|
n*) echo Ok, I will give you another chance....
|
|
rm -f ../bin/ack_sys
|
|
exec sh $0
|
|
;;
|
|
*) echo "I do not understand your answer ($YESNO). Bye"
|
|
exit 11
|
|
;;
|
|
esac
|
|
else
|
|
echo Sorry, got EOF when reading your answer.
|
|
exit 12
|
|
fi
|
|
: "Take action according to the system used"
|
|
: 'Prevent the use of the system assembler on for certain systems'
|
|
: 'prevent the use of ranlib on pdp 11s'
|
|
echo "take some actions according to system used ..."
|
|
case `ack_sys` in
|
|
pdp_*) RMD="vax4"
|
|
echo "disabling use of ranlib; cannot trust its result"
|
|
echo 'echo "no ranlib on this system"; exit 93' > ../bin/ranlib
|
|
chmod +x ../bin/ranlib
|
|
;;
|
|
vax*) ;;
|
|
*) RMD="vax4" ;;
|
|
esac
|
|
for i in $RMD
|
|
do
|
|
( cd ../lib/$i
|
|
echo "disabling use of local assembler and loader for $i"
|
|
if grep '^name as$' descr >/dev/null 2>&1
|
|
then
|
|
cp descr descr.orig
|
|
ed - descr <<'ABC'
|
|
/^name as$/;/^end$/d
|
|
/^name ld$/;/^end$/d
|
|
w
|
|
q
|
|
ABC
|
|
fi
|
|
)
|
|
done
|
|
case `ack_sys` in
|
|
vax_bsd4_2) ( cd ../lib/vax4
|
|
cp descr descr.orig
|
|
ed - descr <<'ABC'
|
|
/CPP_F/s/$/ -D__BSD4_2/
|
|
w
|
|
q
|
|
ABC
|
|
)
|
|
;;
|
|
vax_sysV_2) ( cd ../lib/vax4
|
|
cp descr descr.orig
|
|
ed - descr <<'ABC'
|
|
/CPP_F/s/$/ -D__USG/
|
|
w
|
|
q
|
|
ABC
|
|
)
|
|
;;
|
|
esac
|
|
echo 'Setting the default machine in ../h/local.h ...'
|
|
BM=1
|
|
case `ack_sys` in
|
|
pdp_v7) ACM=pdp ; BM=0 ; SYS=V7 ;;
|
|
vax_bsd4_1a) ACM=vax4 ; SYS=BSD4_1 ;;
|
|
vax_bsd4_2) ACM=vax4 ; SYS=BSD4_2 ;;
|
|
vax_sysV_2) ACM=vax4 ; SYS=SYS_5 ;;
|
|
pc_ix) ACM=i86 ; BM=0 ; SYS=SYS_5 ;;
|
|
xenix3) ACM=xenix3 ; BM=0; SYS=SYS_5 ;;
|
|
sun3) ACM=sun3 ; SYS=BSD4_2 ;;
|
|
sun2) ACM=sun2 ; SYS=BSD4_2 ;;
|
|
m68_unisoft) ACM=m68k2 ; SYS=V7 ;;
|
|
m68_sysV_0) ACM=mantra ; SYS=SYS_5 ;;
|
|
m68020) ACM=m68020 ; SYS=SYS_5 ;;
|
|
SMALL) ACM=i86 ; BM = 0 ; SYS=SYS_5 ;;
|
|
*) ACM=m68k2 ; SYS=SYS_5 ;;
|
|
esac
|
|
rm -f local.h
|
|
sed -e /ACKM/s/'".*"'/'"'$ACM'"'/ -e /BIGMACH/s/'[01]'/$BM/ -e /SYSTEM/s/'^#[ ]*define[ ]*[a-zA-Z_][a-zA-Z0-9_]*'/"# define $SYS"/ < ../h/local.h >local.h
|
|
if cmp -s ../h/local.h local.h
|
|
then
|
|
echo "../h/local.h already correct"
|
|
else
|
|
cp local.h ../h
|
|
echo "../h/local.h updated"
|
|
rm -f local.h
|
|
fi
|
|
echo "Your default machine to compile for is $ACM"
|
|
case `ack_sys` in
|
|
vax_bsd4_2)
|
|
( cd ../mach/vax4
|
|
echo "Copying mach/vax4/libbsd4_2 to mach/vax4/libsys"
|
|
mkdir libsys > /dev/null 2>&1
|
|
rm -f libsys/*
|
|
cp libbsd4_2/* libsys
|
|
)
|
|
;;
|
|
vax_bsd4_1a)
|
|
( cd ../mach/vax4
|
|
echo "Copying mach/vax4/libbsd4_1a to mach/vax4/libsys"
|
|
mkdir libsys > /dev/null 2>&1
|
|
rm -f libsys/*
|
|
cp libbsd4_1a/* libsys
|
|
)
|
|
;;
|
|
vax_sysV_2)
|
|
( cd ../mach/vax4
|
|
echo "Copying mach/vax4/libsysV_2 to mach/vax4/libsys"
|
|
mkdir libsys > /dev/null 2>&1
|
|
rm -f libsys/*
|
|
cp libsysV_2/* libsys
|
|
)
|
|
;;
|
|
xenix3)
|
|
echo "Xenix cannot handle our Makefiles; install our own make ..."
|
|
if ( cd ../util/make; make install )
|
|
then
|
|
echo "Done"
|
|
else
|
|
echo "Sorry, this seems to have failed."
|
|
echo "You have to install it by hand later, or use the Xenix"
|
|
echo "make anyway"
|
|
fi
|
|
echo "The Xenix C compiler cannot compile some of our programs."
|
|
echo "It complains about lack of heap space when many #defines are"
|
|
echo 'used. This is prevented by installing a "cc" shell script in'
|
|
echo 'the EM bin directory, which runs a .c file through a preprocessor'
|
|
echo 'before running it through the C compiler proper. Unfortunately,'
|
|
echo 'line number and filename information is lost. The compiler does'
|
|
echo 'not recognize its own line directives.'
|
|
echo 'You can remove this "cc" script from the EM bin directory'
|
|
echo 'when installation is done.'
|
|
cp cc.xenix cc.xenix.orig
|
|
ed - cc.xenix <<ABC
|
|
/EMHOME/s/=.*/=$HM/
|
|
w
|
|
q
|
|
ABC
|
|
cp cc.xenix ../bin/cc
|
|
chmod +x ../bin/cc
|
|
echo "code-generators and peephole optimizer need more stack than the default."
|
|
echo "adapting LDFLAGS in Makefiles"
|
|
for i in ../mach/*/*cg/Makefile
|
|
do
|
|
cp $i $i.orig
|
|
ed - $i <<ABC
|
|
/LDFLAGS/s/$/ -F 3000/
|
|
w
|
|
q
|
|
ABC
|
|
done
|
|
cp ../util/opt/Makefile ../util/opt/Makefile.orig
|
|
ed - ../util/opt/Makefile <<ABC
|
|
/LDFLAGS/s/$/-F 2000/
|
|
w
|
|
q
|
|
ABC
|
|
echo "target optimizers do not work on Xenix; disabling their use"
|
|
for i in ../lib/*/descr
|
|
do
|
|
if grep -s "name asopt" $i
|
|
then
|
|
cp $i $i.top
|
|
ed - $i <<ABC
|
|
/name asopt/;/^end/d
|
|
w
|
|
q
|
|
ABC
|
|
fi
|
|
done
|
|
echo "the -l option in cc command puts library in wrong place."
|
|
echo "this is a problem with the lex library for the occam compiler."
|
|
echo "changing Makefile for Occam compiler"
|
|
cp ../lang/occam/comp/Makefile ../lang/occam/comp/Makefile.orig
|
|
ed - ../lang/occam/comp/Makefile <<ABC
|
|
/LEXLIB/s.-l[a-z]*./lib/Slibl.a.
|
|
w
|
|
q
|
|
ABC
|
|
;;
|
|
esac
|
|
case X$BM in
|
|
X0)
|
|
echo "set some installation pararmeters for small machines"
|
|
( cd ../lang/cem/cemcom
|
|
cp SmallPars Parameters
|
|
cp makefile makefile.orig
|
|
ed - makefile <<ABC
|
|
/MALLOC/s/=/=#/
|
|
w
|
|
q
|
|
ABC
|
|
cd ../../../util/cpp
|
|
ed - Makefile <<ABC
|
|
/MALLOC/s/=/=#/
|
|
w
|
|
q
|
|
ABC
|
|
cd ../../lib/descr
|
|
cp fe fe.orig
|
|
ed - fe << ABC
|
|
/em_cemcom/i
|
|
prep always
|
|
.
|
|
/CPP_F/;.+2d
|
|
/CPP_F/;.+2d
|
|
w
|
|
q
|
|
ABC
|
|
)
|
|
for i in ../mach/vax4/cg ../mach/m68k2/cg ../mach/m68020/ncg
|
|
do
|
|
( cd $i
|
|
cp tables1.c tables.c
|
|
cp tables1.h tables.h
|
|
)
|
|
done
|
|
( cd ../modules/src/malloc
|
|
cp param.h param.h.orig
|
|
ed - param.h <<ABC
|
|
/STORE/s/define/undef/
|
|
w
|
|
q
|
|
ABC
|
|
)
|
|
( cd ../lang/m2/comp
|
|
cp SmallPars Parameters
|
|
cp Makefile Makefile.orig
|
|
ed - Makefile <<ABC
|
|
/MALLOC/s/=/=#/
|
|
w
|
|
q
|
|
ABC
|
|
)
|
|
( cd ../mach
|
|
: machines with word or pointer size not 2
|
|
for i in em24 em44 m68020 m68k2 m68k4 mantra ns sun2 sun3 vax4
|
|
do
|
|
cp $i/Action $i/Action.orig
|
|
ed - $i/Action <<ABC
|
|
/odula-2/;/^end/s/^/!/
|
|
w
|
|
q
|
|
ABC
|
|
done
|
|
)
|
|
( cd ..
|
|
cp Action Action.orig
|
|
ed - Action <<ABC
|
|
/EM interpreter in C/;/^end/s/^/!/
|
|
w
|
|
q
|
|
ABC
|
|
)
|
|
;;
|
|
*) ( echo "set some installation pararmeters for big machines"
|
|
cd ../lang/cem/cemcom
|
|
cp BigPars Parameters
|
|
cd ../../m2/comp
|
|
cp BigPars Parameters
|
|
)
|
|
;;
|
|
esac
|
|
|
|
: find varargs include file
|
|
: if not present use our own
|
|
|
|
if [ -f /usr/include/varargs.h ]
|
|
then
|
|
:
|
|
else
|
|
cp ../include/_tail_cc/varargs.h ../modules/h
|
|
fi
|