cc.next.i386 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. : next.i386 cc wrapper for unix message and exit code semantics : 1995-05-09 :
  2. HOSTTYPE=next.i386
  3. case " $* " in
  4. *" -dumpmachine "*) echo $HOSTTYPE; exit ;;
  5. esac
  6. # 1995-05-09 -lposix termios.o waitpid.o setpgid.o *do* work
  7. # 1994-11-04 -posix has old redirection hole bug
  8. # -D_POSIX_SOURCE requires <sys/dirent.h> manual fixes
  9. # libexpr/exeval.c bombs -O, no -O ok
  10. command=cc
  11. cc="/bin/cc -D_POSIX_SOURCE"
  12. nooptimize="exeval"
  13. # first check $INSTALLROOT/botch
  14. case $INSTALLROOT in
  15. "") echo "$command: INSTALLROOT: must be defined and exported" >&2; exit 1 ;;
  16. esac
  17. if test ! -d $INSTALLROOT/botch -a -dryrun != "$1"
  18. then if mkdir $INSTALLROOT/botch
  19. then : ok to initialize
  20. else echo "$command: $INSTALLROOT/botch must be initialized by the owner of $INSTALLROOT" 2>&1
  21. exit 1
  22. fi
  23. (
  24. cd $INSTALLROOT/botch
  25. dir=.
  26. for i in lib . include sys
  27. do case $i in
  28. .) dir=.
  29. ;;
  30. *) case $i in
  31. /*) dir=$i ;;
  32. *) dir=$dir/$i ;;
  33. esac
  34. test -d $dir || mkdir $dir
  35. ;;
  36. esac
  37. done
  38. if test ! -f include/sys/dirent.h
  39. then echo "#include <dirent.h>" > tmp.c
  40. header=`$cc -E tmp.c | sed -e '/^#[ ]*1[ ].*\/sys\/dirent\.h"/!d' -e 's/.*"\(.*\)".*/\1/'`
  41. sed -e 's/[ ]off_t[ ][ ]*d_off[ ]*;//' $header > include/sys/dirent.h
  42. fi
  43. if test ! -f lib/libbotch.a
  44. then lipo /usr/lib/libposix.a -thin i386 -output tmp.a
  45. ar x tmp.a termios.o waitpid.o setpgid.o
  46. ar cr lib/libbotch.a *.o
  47. ranlib lib/libbotch.a
  48. fi
  49. rm -f *.[aco]
  50. )
  51. fi
  52. # now slip in our args
  53. case $nooptimize in
  54. "") nooptimize=.
  55. ;;
  56. *) optimize=
  57. for arg in $nooptimize
  58. do case $optimize in
  59. ?*) optimize="$optimize|" ;;
  60. esac
  61. optimize="$optimize$arg.[ci]|*/$arg.[ci]"
  62. done
  63. nooptimize=$optimize
  64. ;;
  65. esac
  66. set . "$@" .
  67. noexec=
  68. library=
  69. local=
  70. optimize=
  71. verbose=
  72. while :
  73. do shift
  74. arg=$1
  75. shift
  76. case $arg in
  77. .) break
  78. ;;
  79. -[cES]) library=1
  80. ;;
  81. -O) optimize=1
  82. ;;
  83. -v) verbose=1
  84. ;;
  85. -dryrun)noexec=1
  86. verbose=1
  87. ;;
  88. -I-) case $local in
  89. "") local=1
  90. set . "$@" -I$INSTALLROOT/botch/include -I- -I$INSTALLROOT/botch/include
  91. ;;
  92. *) set . "$@" -I- -I$INSTALLROOT/botch/include
  93. ;;
  94. esac
  95. continue
  96. ;;
  97. -I*|*.[cChHiI]|*.[cChHiI][pPxX][pPxX])
  98. case $optimize in
  99. 1) eval "
  100. case \$arg in
  101. $nooptimize)
  102. optimize=0
  103. ;;
  104. esac
  105. "
  106. ;;
  107. esac
  108. case $local in
  109. "") local=1
  110. set . "$@" -I$INSTALLROOT/botch/include "$arg"
  111. continue
  112. ;;
  113. esac
  114. ;;
  115. -last|*/libast.a)
  116. case $library in
  117. "") library=1
  118. set . "$@" $INSTALLROOT/botch/lib/libbotch.a "$arg" $INSTALLROOT/botch/lib/libbotch.a
  119. continue
  120. ;;
  121. esac
  122. ;;
  123. esac
  124. set . "$@" "$arg"
  125. done
  126. case $library in
  127. "") set . "$@" $INSTALLROOT/botch/lib/libbotch.a
  128. shift
  129. ;;
  130. esac
  131. case $optimize in
  132. 0) set . "$@" .
  133. while :
  134. do shift
  135. arg=$1
  136. shift
  137. case $arg in
  138. .) break ;;
  139. -O) set . "$@" ;;
  140. *) set . "$@" "$arg" ;;
  141. esac
  142. done
  143. ;;
  144. esac
  145. case $verbose in
  146. ?*) echo $cc "$@" ;;
  147. esac
  148. case $noexec in
  149. "") $cc "$@" ;;
  150. esac