first 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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. echo "PATH is ok"
  15. else
  16. exit 1
  17. fi
  18. echo check write-ability of /tmp and /usr/tmp ...
  19. if ( >/usr/tmp/aaax.$$ )
  20. then
  21. rm /usr/tmp/aaax.$$
  22. else
  23. echo /usr/tmp must exist and be writable.
  24. exit 2
  25. fi
  26. if ( >/tmp/aaax.$$ )
  27. then
  28. rm /tmp/aaax.$$
  29. else
  30. echo /tmp must exist and be writable.
  31. exit 2
  32. fi
  33. echo "/tmp and /usr/tmp ok"
  34. echo setting ACK HOME Directory in ../h/em_path.h ...
  35. rm -f em_path.h
  36. HM=`cd ..; pwd`
  37. sed -e "/^#define[ ]*EM_DIR/s@\".*\"@\"$HM\"@" <em_path.h.src >em_path.h
  38. if cmp ../h/em_path.h em_path.h >/dev/null 2>&1
  39. then
  40. : Don't touch ../h/em_path.h, it's already correct
  41. echo "../h/em_path.h already correct"
  42. else
  43. rm -f ../h/em_path.h
  44. if mv em_path.h ../h >/dev/null 2>&1
  45. then echo "../h/em_path.h replaced"
  46. else
  47. echo "Sorry, can't replace ../h/em_path.h"
  48. exit 7
  49. fi
  50. fi
  51. echo compile own echo program, so that we know how it works ...
  52. if cc -o echo myecho.c > /dev/null 2>&1
  53. then
  54. echo compilation succeeded
  55. else
  56. echo "Sorry, cc does not seem to work"
  57. exit 8
  58. fi
  59. cp echo ../bin/echo
  60. : find cc option for lex library
  61. if fixlexlib
  62. then
  63. :
  64. else
  65. exit 9
  66. fi
  67. : remove non-system as and ld from descr files
  68. if (ack_sys) >/dev/null 2>&1
  69. then
  70. : echo Your system is: `ack_sys`.
  71. else
  72. echo -n "Give me the type of your system, the current choice is:
  73. pdp_v7 PDP11 with sep I/D and version 7 (or BSD 2.8, 2.9)
  74. vax_bsd4_1a VAX11 with BSD4.1a
  75. vax_bsd4_2 VAX11 with BSD4.2
  76. vax_sysV_2 VAX11 with System V.2
  77. pc_ix IBM PC with PC/IX
  78. xenix3 IBM AT running Microsoft Xenix V3.2
  79. m68_unisoft Motorola 68000 with Unisoft UNIX
  80. sun3 Sun 3 M68020 workstation
  81. sun2 Sun 2 M68000 workstation
  82. m68_sysV_0 Motorola 68000 with Uniplus System V.0 Unix
  83. m68020 Motorola M68020 VME131 running Unix System V/68 R2V2.1
  84. SMALL Neither of the above, small address space
  85. ANY Neither of the above
  86. system type: "
  87. if read SYSNAME
  88. then
  89. echo echo "$SYSNAME" >../bin/ack_sys
  90. chmod +x ../bin/ack_sys
  91. case `ack_sys` in
  92. pdp_v7|vax_bsd4_1a|vax_bsd4_2|vax_sysV_2|pc_ix|m68_unisoft|sun3|sun2|m68_sysV_0|xenix3|m68020) ;;
  93. *) echo None of the software especially intended for the named systems will work ;;
  94. esac
  95. else
  96. echo Sorry, got EOF when reading system name.
  97. exit 10
  98. fi
  99. fi
  100. echo -n "Your system is `ack_sys`, are you satisfied with that? (y/n) "
  101. if read YESNO
  102. then
  103. case $YESNO in
  104. j*|y*) ;;
  105. n*) echo Ok, I will give you another chance....
  106. rm -f ../bin/ack_sys
  107. exec sh $0
  108. ;;
  109. *) echo "I do not understand your answer ($YESNO). Bye"
  110. exit 11
  111. ;;
  112. esac
  113. else
  114. echo Sorry, got EOF when reading your answer.
  115. exit 12
  116. fi
  117. : "Take action according to the system used"
  118. : 'Prevent the use of the system assembler on for certain systems'
  119. : 'prevent the use of ranlib on pdp 11s'
  120. cp ../lib/vax4/descr.src ../lib/vax4/descr
  121. cp ../lib/descr/fe.src ../lib/descr/fe
  122. echo "take some actions according to system used ..."
  123. case `ack_sys` in
  124. pdp_*) RMD="vax4"
  125. echo "disabling use of ranlib; cannot trust its result"
  126. echo 'echo "no ranlib on this system"; exit 93' > ../bin/ranlib
  127. chmod +x ../bin/ranlib
  128. ;;
  129. vax*) ;;
  130. *) RMD="vax4" ;;
  131. esac
  132. for i in $RMD
  133. do
  134. ( cd ../lib/$i
  135. echo "disabling use of local assembler and loader for $i"
  136. if grep '^name as$' descr >/dev/null 2>&1
  137. then
  138. ed - descr <<'ABC'
  139. /^name as$/;/^end$/d
  140. /^name ld$/;/^end$/d
  141. w
  142. q
  143. ABC
  144. fi
  145. )
  146. done
  147. case `ack_sys` in
  148. vax_bsd4_2) ( cd ../lib/vax4
  149. ed - descr <<'ABC'
  150. /CPP_F/s/$/ -D__BSD4_2/
  151. w
  152. q
  153. ABC
  154. )
  155. ;;
  156. vax_sysV_2) ( cd ../lib/vax4
  157. ed - descr <<'ABC'
  158. /CPP_F/s/$/ -D__USG/
  159. w
  160. q
  161. ABC
  162. )
  163. ;;
  164. esac
  165. echo 'Setting the default machine in ../h/local.h ...'
  166. BM=1
  167. case `ack_sys` in
  168. pdp_v7) ACM=pdp ; BM=0 ; SYS=V7 ;;
  169. vax_bsd4_1a) ACM=vax4 ; SYS=BSD4_1 ;;
  170. vax_bsd4_2) ACM=vax4 ; SYS=BSD4_2 ;;
  171. vax_sysV_2) ACM=vax4 ; SYS=SYS_5 ;;
  172. pc_ix) ACM=i86 ; BM=0 ; SYS=SYS_5 ;;
  173. xenix3) ACM=xenix3 ; BM=0; SYS=SYS_5 ;;
  174. sun3) ACM=sun3 ; SYS=BSD4_2 ;;
  175. sun2) ACM=sun2 ; SYS=BSD4_2 ;;
  176. m68_unisoft) ACM=m68k2 ; SYS=V7 ;;
  177. m68_sysV_0) ACM=mantra ; SYS=SYS_5 ;;
  178. m68020) ACM=m68020 ; SYS=SYS_5 ;;
  179. SMALL) ACM=i86 ; BM = 0 ; SYS=SYS_5 ;;
  180. *) ACM=m68k2 ; SYS=SYS_5 ;;
  181. esac
  182. rm -f local.h
  183. sed -e /ACKM/s/'".*"'/'"'$ACM'"'/ -e /BIGMACH/s/'[01]'/$BM/ -e /SYSTEM/s/'^#[ ]*define[ ]*[a-zA-Z_][a-zA-Z0-9_]*'/"# define $SYS"/ < local.h.src >local.h
  184. if cmp -s ../h/local.h local.h
  185. then
  186. echo "../h/local.h already correct"
  187. else
  188. cp local.h ../h
  189. echo "../h/local.h updated"
  190. rm -f local.h
  191. fi
  192. echo "Your default machine to compile for is $ACM"
  193. case `ack_sys` in
  194. vax_bsd4_2)
  195. ( cd ../mach/vax4
  196. echo "Copying mach/vax4/libbsd4_2 to mach/vax4/libsys"
  197. mkdir libsys > /dev/null 2>&1
  198. rm -f libsys/*
  199. cp libbsd4_2/* libsys
  200. )
  201. ;;
  202. vax_bsd4_1a)
  203. ( cd ../mach/vax4
  204. echo "Copying mach/vax4/libbsd4_1a to mach/vax4/libsys"
  205. mkdir libsys > /dev/null 2>&1
  206. rm -f libsys/*
  207. cp libbsd4_1a/* libsys
  208. )
  209. ;;
  210. vax_sysV_2)
  211. ( cd ../mach/vax4
  212. echo "Copying mach/vax4/libsysV_2 to mach/vax4/libsys"
  213. mkdir libsys > /dev/null 2>&1
  214. rm -f libsys/*
  215. cp libsysV_2/* libsys
  216. )
  217. ;;
  218. xenix3)
  219. echo "Xenix cannot handle our Makefiles; install our own make ..."
  220. if ( cd ../util/make; make install )
  221. then
  222. echo "Done"
  223. else
  224. echo "Sorry, this seems to have failed."
  225. echo "You have to install it by hand later, or use the Xenix"
  226. echo "make anyway"
  227. fi
  228. echo "The Xenix C compiler cannot compile some of our programs."
  229. echo "It complains about lack of heap space when many #defines are"
  230. echo 'used. This is prevented by installing a "cc" shell script in'
  231. echo 'the EM bin directory, which runs a .c file through a preprocessor'
  232. echo 'before running it through the C compiler proper. Unfortunately,'
  233. echo 'line number and filename information is lost. The compiler does'
  234. echo 'not recognize its own line directives.'
  235. echo 'You can remove this "cc" script from the EM bin directory'
  236. echo 'when installation is done.'
  237. cp cc.xenix.src cc.xenix
  238. ed - cc.xenix <<ABC
  239. /EMHOME/s/=.*/=$HM/
  240. w
  241. q
  242. ABC
  243. cp cc.xenix ../bin/cc
  244. chmod +x ../bin/cc
  245. echo "code-generators and peephole optimizer need more stack than the default."
  246. echo "adapting LDFLAGS in Makefiles"
  247. for i in ../mach/*/*cg
  248. do
  249. cp $i/Makefile $i/makefile
  250. ed - $i/makefile <<ABC
  251. /LDFLAGS/s/$/ -F 3000/
  252. w
  253. q
  254. ABC
  255. done
  256. cp ../util/opt/Makefile ../util/opt/makefile
  257. ed - ../util/opt/makefile <<ABC
  258. /LDFLAGS/s/$/-F 2000/
  259. w
  260. q
  261. ABC
  262. echo "target optimizers do not work on Xenix; disabling their use"
  263. for i in ../lib/*/descr
  264. do
  265. if grep -s "name asopt" $i
  266. then
  267. if [ -f $i.top ]
  268. then
  269. :
  270. else
  271. mv $i $i.top
  272. fi
  273. cp $i.top $i
  274. ed - $i <<ABC
  275. /name asopt/;/^end/d
  276. w
  277. q
  278. ABC
  279. fi
  280. done
  281. echo "the -l option in cc command puts library in wrong place."
  282. echo "this is a problem with the lex library for the occam compiler."
  283. echo "changing Makefile for Occam compiler"
  284. cp ../lang/occam/comp/Makefile ../lang/occam/comp/makefile
  285. ed - ../lang/occam/comp/makefile <<ABC
  286. /LEXLIB/s;-l.*;/lib/Slibl.a;
  287. w
  288. q
  289. ABC
  290. ;;
  291. esac
  292. case X$BM in
  293. X0)
  294. echo "set some installation pararmeters for small machines"
  295. ( cd ../lang/cem/cemcom
  296. cp SmallPars Parameters
  297. cp Makefile makefile
  298. ed - makefile <<ABC
  299. /MALLOC/s/=/=#/
  300. w
  301. q
  302. ABC
  303. cd ../../../util/cpp
  304. cp Makefile makefile
  305. ed - makefile <<ABC
  306. /MALLOC/s/=/=#/
  307. w
  308. q
  309. ABC
  310. cd ../../lib/descr
  311. ed - fe << ABC
  312. /em_cemcom/i
  313. prep always
  314. .
  315. /CPP_F/;.+2d
  316. /CPP_F/;.+2d
  317. w
  318. q
  319. ABC
  320. )
  321. for i in ../mach/vax4/cg ../mach/m68k2/cg ../mach/m68020/ncg
  322. do
  323. ( cd $i
  324. cp tables1.c tables.c
  325. cp tables1.h tables.h
  326. )
  327. done
  328. ( cd ../modules/src/malloc
  329. if [ -f param.h.orig ]
  330. then
  331. :
  332. else
  333. mv param.h param.h.orig
  334. fi
  335. cp param.h.orig param.h
  336. ed - param.h <<ABC
  337. /STORE/s/define/undef/
  338. w
  339. q
  340. ABC
  341. )
  342. ( cd ../lang/m2/comp
  343. cp SmallPars Parameters
  344. cp Makefile makefile
  345. ed - makefile <<ABC
  346. /MALLOC/s/=/=#/
  347. w
  348. q
  349. ABC
  350. )
  351. ( cd ../mach
  352. : machines with word or pointer size not 2
  353. for i in em24 em44 m68020 m68k2 m68k4 mantra ns sun2 sun3 vax4
  354. do
  355. if [ -f $i/Action.orig ]
  356. then
  357. :
  358. else
  359. mv $i/Action $i/Action.orig
  360. fi
  361. cp $i/Action.orig $i/Action
  362. ed - $i/Action <<ABC
  363. /odula-2/;/^end/s/^/!/
  364. w
  365. q
  366. ABC
  367. done
  368. )
  369. ( cd ..
  370. if [ -f Action.orig ]
  371. then
  372. :
  373. else
  374. mv Action Action.orig
  375. fi
  376. cp Action.orig Action
  377. ed - Action <<ABC
  378. /EM interpreter in C/;/^end/s/^/!/
  379. w
  380. q
  381. ABC
  382. )
  383. ;;
  384. *) ( echo "set some installation pararmeters for big machines"
  385. cd ../lang/cem/cemcom
  386. cp BigPars Parameters
  387. cd ../../m2/comp
  388. cp BigPars Parameters
  389. )
  390. ;;
  391. esac
  392. : find varargs include file
  393. : if not present use our own
  394. if [ -f /usr/include/varargs.h ]
  395. then
  396. :
  397. else
  398. cp ../include/_tail_cc/varargs.h ../modules/h
  399. fi