get_makepars 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/bin/sh
  2. know_target=0
  3. case $SYSNAME in
  4. vax*|i386|sun*|sparc*|m68_sysV_0|m68020|mantra|pmds4|m68k4)
  5. WS=4 ; PS=4
  6. know_target=1
  7. ;;
  8. m68_unisoft|m68k2|minixST|pmds)
  9. WS=2 ; PS=4
  10. know_target=1
  11. ;;
  12. i86|minix|xenix3)
  13. WS=2 ; PS=2
  14. know_target=1
  15. ;;
  16. *) trap "rm -f ws.c ws.o a.out t$$" 0 1 2 3 15
  17. cat > ws.c <<'EOF'
  18. #include <stdio.h>
  19. main()
  20. {
  21. printf("WS=%d ; PS=%d\n", sizeof(int), sizeof(char *));
  22. exit(0);
  23. }
  24. EOF
  25. if [ $TARGET_HOME = $UTIL_HOME ] && cc ws.c 2>/dev/null
  26. then
  27. : We can find out ourselves what the word-size and
  28. : the pointer-size of the target machine is.
  29. cc ws.c 2>/dev/null
  30. ./a.out > t$$
  31. . t$$
  32. rm -f t$$ a.out ws.[co]
  33. else
  34. : we will have to ask installer.
  35. echo $E_FLAG "Please give the word-size of the target-machine (sizeof(int)) in bytes: [$WS] $E_SFX"
  36. . $FDIR/get_answer
  37. case $ANS in
  38. '') ANS="$WS";;
  39. esac
  40. WS="$ANS"
  41. echo $E_FLAG "Please give the pointer-size of the target-machine (sizeof(char *)) in bytes: [$PS] $E_SFX"
  42. . $FDIR/get_answer
  43. case $ANS in
  44. '') ANS="$PS";;
  45. esac
  46. PS="$ANS"
  47. fi
  48. ;;
  49. esac
  50. echo "# Paths:
  51. SRC_HOME = $SRC_HOME
  52. TARGET_HOME = $TARGET_HOME
  53. UTIL_HOME = $UTIL_HOME
  54. # Machine independent part created?
  55. DO_MACHINE_INDEP = $DO_MACHINE_INDEP
  56. # Target machine, only needed for fast compilers
  57. MACH = $MACH
  58. " > make_macros
  59. if [ $TARGET_HOME = $UTIL_HOME ]
  60. then
  61. if [ -f /bin/ranlib -o -f /usr/bin/ranlib -o -f /usr/ucb/ranlib ]
  62. then
  63. sed "s/^COPTIONS.*\$/COPTIONS=-O -D_EM_WSIZE=$WS -D_EM_PSIZE=$PS -D__${MACH}__/" < $FDIR/target_comp >> make_macros
  64. else
  65. sed -e "s/^COPTIONS.*\$/COPTIONS=-O -D_EM_WSIZE=$WS -D_EM_PSIZE=$PS -D__${MACH}__/" -e "s/^# RANLIB=:/RANLIB=:/" < $FDIR/target_comp >> make_macros
  66. fi
  67. case $ACM in
  68. sun3|sparc)
  69. ed -s make_macros <<'EOF'
  70. /cc-and-mkdep.sun/s/^..//
  71. w
  72. q
  73. EOF
  74. ;;
  75. esac
  76. cat $FDIR/util_comp >> make_macros
  77. else
  78. case $know_target in
  79. 1) sed -e "s/^COPTIONS.*\$/COPTIONS=-O -D_EM_WSIZE=$WS -D_EM_PSIZE=$PS -D__${MACH}__/" -e "/cc-and-mkdep.ack/s/^..//" -e "s/^CC=cc/CC=acc -m$ACM/" -e "s/^# AR=aal/AR=aal/" -e "s/^# RANLIB=:/RANLIB=:/" < $FDIR/target_comp >> make_macros
  80. ;;
  81. *) if [ -f /bin/ranlib -o -f /usr/bin/ranlib -o -f /usr/ucb/ranlib ]
  82. then
  83. sed "s/^COPTIONS.*\$/COPTIONS=-O -D_EM_WSIZE=$WS -D_EM_PSIZE=$PS -D__${MACH}__/" < $FDIR/target_comp >> make_macros
  84. else
  85. sed -e "s/^COPTIONS.*\$/COPTIONS=-O -D_EM_WSIZE=$WS -D_EM_PSIZE=$PS -D__${MACH}__/" -e "s/^# RANLIB=:/RANLIB=:/" < $FDIR/target_comp >> make_macros
  86. fi
  87. ;;
  88. esac
  89. sed "s/^#U/U/" < $FDIR/util_comp >> make_macros
  90. fi
  91. cat $FDIR/lint_params >> make_macros
  92. echo "A file called 'make_macros' has been created. This file defines some
  93. 'make' variables that parameterize all Makefiles in ACK. You may want
  94. to check it before attempting to actually install ACK."
  95. case $know_target in
  96. 0) echo "In fact, this installation script does not know much about
  97. your target machine, so expect some things to be wrong"
  98. ;;
  99. esac