first 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. : check that the script is started from the "first" directory
  2. p=`pwd`
  3. case `basename $p` in
  4. first)
  5. ;;
  6. *)
  7. echo "this script must be started from the 'first' directory"
  8. exit 3
  9. ;;
  10. esac
  11. : check $PATH first
  12. if sh ckpath
  13. then :
  14. else
  15. exit 1
  16. fi
  17. : check write-ability of /tmp and /usr/tmp
  18. if ( >/usr/tmp/aaax.$$ )
  19. then
  20. rm /usr/tmp/aaax.$$
  21. else
  22. echo /usr/tmp must exist and be writable.
  23. exit 2
  24. fi
  25. if ( >/tmp/aaax.$$ )
  26. then
  27. rm /tmp/aaax.$$
  28. else
  29. echo /tmp must exist and be writable.
  30. exit 2
  31. fi
  32. : set ACK HOME Directory in ../h/em_path.h
  33. rm -f em_path.h
  34. sed -e "/^#define[ ]*EM_DIR/s@\".*\"@\"`cd .. ; pwd`\"@" <../h/em_path.h >em_path.h
  35. if cmp ../h/em_path.h em_path.h >/dev/null 2>&1
  36. then
  37. : Don't touch ../h/em_path.h, it's already correct
  38. else
  39. rm -f ../h/em_path.h
  40. if mv em_path.h ../h >/dev/null 2>&1
  41. then : success
  42. else
  43. echo "Sorry, can't replace ../h/em_path.h"
  44. exit 7
  45. fi
  46. fi
  47. : translate myecho
  48. if cc -o myecho myecho.c > /dev/null 2>&1
  49. then
  50. :
  51. else
  52. echo "Sorry, cc does not seem to work"
  53. exit 8
  54. fi
  55. : find cc option for lex library
  56. if fixlexlib
  57. then
  58. :
  59. else
  60. exit 9
  61. fi
  62. : remove non-system as and ld from descr files
  63. if (ack_sys) >/dev/null 2>&1
  64. then
  65. : echo Your system is: `ack_sys`.
  66. else
  67. myecho -n "Give me the type of your system, the current choice is:
  68. pdp_v7 PDP11 with sep I/D and version 7 (or BSD 2.8, 2.9)
  69. vax_bsd4_1a VAX11 with BSD4.1a
  70. vax_bsd4_2 VAX11 with BSD4.2
  71. vax_sysV_2 VAX11 with System V.2
  72. pc_ix IBM PC with PC/IX
  73. xenix3 IBM AT running Microsoft Xenix V3.2
  74. m68_unisoft Motorola 68000 with Unisoft UNIX
  75. sun3 Sun 3 M68020 workstation
  76. sun2 Sun 2 M68000 workstation
  77. m68_sysV_0 Motorola 68000 with Uniplus System V.0 Unix
  78. m68020 Motorola M68020 VME131 running Unix System V/68 R2V2.1
  79. ANY Neither of the above
  80. system type: "
  81. if read SYSNAME
  82. then
  83. echo echo "$SYSNAME" >../bin/ack_sys
  84. chmod +x ../bin/ack_sys
  85. case `ack_sys` in
  86. pdp_v7|vax_bsd4_1a|vax_bsd4_2|vax_sysV_2|pc_ix|m68_unisoft|sun3|sun2|m68_sysV_0|xenix3|m68020) ;;
  87. *) echo None of the software especially intended for the named systems will work ;;
  88. esac
  89. else
  90. echo Sorry, got EOF when reading system name.
  91. exit 10
  92. fi
  93. fi
  94. myecho -n "Your system is `ack_sys`, are you satisfied with that? (y/n) "
  95. if read YESNO
  96. then
  97. case $YESNO in
  98. j*|y*) ;;
  99. n*) echo Ok, I will give you another chance....
  100. rm -f ../bin/ack_sys
  101. exec sh $0
  102. ;;
  103. *) echo "I do not understand your answer ($YESNO). Bye"
  104. exit 11
  105. ;;
  106. esac
  107. else
  108. echo Sorry, got EOF when reading your answer.
  109. exit 12
  110. fi
  111. : "Take action according to the system used"
  112. : 'Prevent the use of the system assembler on for certain systems'
  113. : 'prevent the use of ranlib on pdp 11s'
  114. case `ack_sys` in
  115. pdp_*) RMD="vax4"
  116. echo 'echo "no ranlib on this system"; exit 93' > ../bin/ranlib
  117. chmod +x ../bin/ranlib
  118. ranlib > /dev/null 2>&1
  119. case X$? in
  120. X93) ;;
  121. *) echo "Sorry, there still is an error in your PATH."
  122. echo "It finds the system ranlib before ours, which is in the ACK bin directory."
  123. exit 13
  124. esac
  125. ;;
  126. *) RMD="vax4" ;;
  127. esac
  128. for i in $RMD
  129. do
  130. ( cd ../lib/$i
  131. if grep '^name as$' descr >/dev/null 2>&1
  132. then
  133. cp descr descr.orig
  134. ed - descr <<'ABC'
  135. /^name as$/;/^end$/d
  136. /^name ld$/;/^end$/d
  137. w
  138. q
  139. ABC
  140. fi
  141. )
  142. done
  143. case `ack_sys` in
  144. vax_bsd4_2) ( cd ../lib/vax4
  145. cp descr descr.orig
  146. ed - descr <<'ABC'
  147. /CPP_F/s/$/ -D__BSD4_2/
  148. w
  149. q
  150. ABC
  151. )
  152. ;;
  153. vax_sysV_2) ( cd ../lib/vax4
  154. cp descr descr.orig
  155. ed - descr <<'ABC'
  156. /CPP_F/s/$/ -D__USG/
  157. w
  158. q
  159. ABC
  160. )
  161. ;;
  162. esac
  163. : 'Set the default machine in ../h/local.h'
  164. BM=1
  165. case `ack_sys` in
  166. pdp_v7) ACM=pdp ; BM=0 ;;
  167. vax_bsd4_1a) ACM=vax4 ;;
  168. vax_bsd4_2) ACM=vax4 ;;
  169. vax_sysV_2) ACM=vax4 ;;
  170. pc_ix) ACM=i86 ; BM=0;;
  171. xenix3) ACM=xenix3 ; BM=0;;
  172. sun3) ACM=sun3 ;;
  173. sun2) ACM=sun2 ;;
  174. m68_unisoft) ACM=m68k2 ;;
  175. m68_sysV_0) ACM=mantra ;;
  176. m68020) ACM=m68020 ;;
  177. *) ACM=m68k2 ;;
  178. esac
  179. rm -f local.h
  180. sed -e /ACKM/s/'".*"'/'"'$ACM'"'/ -e /BIGMACH/s/'[01]'/$BM/ < ../h/local.h >local.h
  181. if cmp -s ../h/local.h local.h
  182. then :
  183. else
  184. cp local.h ../h
  185. rm -f local.h
  186. fi
  187. echo "Your default machine to compile for is $ACM"
  188. case `ack_sys` in
  189. vax_bsd4_2)
  190. ( cd ../mach/vax4
  191. echo "Copying mach/vax4/libbsd4_2 to mach/vax4/libsys"
  192. mkdir libsys > /dev/null 2>&1
  193. rm -f libsys/*
  194. cp libbsd4_2/* libsys
  195. )
  196. ;;
  197. vax_bsd4_1a)
  198. ( cd ../mach/vax4
  199. echo "Copying mach/vax4/libbsd4_1a to mach/vax4/libsys"
  200. mkdir libsys > /dev/null 2>&1
  201. rm -f libsys/*
  202. cp libbsd4_1a/* libsys
  203. )
  204. ;;
  205. vax_sysV_2)
  206. ( cd ../mach/vax4
  207. echo "Copying mach/vax4/libsysV_2 to mach/vax4/libsys"
  208. mkdir libsys > /dev/null 2>&1
  209. rm -f libsys/*
  210. cp libsysV_2/* libsys
  211. )
  212. ;;
  213. esac
  214. case X$BM in
  215. X0)
  216. ( cd ../lang/cem/cemcom
  217. cp SmallPars Parameters
  218. cd ../../../lib/descr
  219. cp fe fe.orig
  220. ed - fe << ABC
  221. /em_cemcom/i
  222. prep always
  223. .
  224. /CPP_F/;.+2d
  225. /CPP_F/;.+2d
  226. w
  227. q
  228. ABC
  229. )
  230. for i in ../mach/vax4/cg ../mach/m68k2/cg ../mach/m68020/ncg
  231. do
  232. ( cd $i
  233. cp tables1.c tables.c
  234. cp tables1.h tables.h
  235. )
  236. done
  237. ( cd ../modules/src/malloc
  238. cp param.h param.h.orig
  239. ed - param.h <<ABC
  240. /STORE/s/define/undef/
  241. w
  242. q
  243. ABC
  244. )
  245. ( cd ../lang/m2/comp
  246. cp SmallPars Parameters
  247. cp Makefile Makefile.orig
  248. ed - Makefile <<ABC
  249. /MALLOC/s/=/=#/
  250. w
  251. q
  252. ABC
  253. )
  254. ( cd ../mach
  255. : machines with word or pointer size not 2
  256. for i in em24 em44 m68020 m68k2 m68k4 mantra ns sun2 sun3 vax4
  257. do
  258. cp $i/Action $i/Action.orig
  259. ed - $i/Action <<ABC
  260. /odula-2/,/^end/s/^/!/
  261. w
  262. q
  263. ABC
  264. done
  265. )
  266. ;;
  267. *) ( cd ../lang/cem/cemcom
  268. cp BigPars Parameters
  269. cd ../../m2/comp
  270. cp BigPars Parameters
  271. )
  272. ;;
  273. esac
  274. : find varargs include file
  275. : if not present use our own
  276. if [ -f /usr/include/varargs.h ]
  277. then
  278. :
  279. else
  280. cp ../include/_tail_cc/varargs.h ../modules/h
  281. fi