home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume17 / gbp / part04 < prev    next >
Encoding:
Internet Message Format  |  1993-03-20  |  56.4 KB

  1. Path: uunet!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v17i016:  gbp - Galactic Bloodshed+, an empire-like war game, Part04/21
  5. Message-ID: <4544@master.CNA.TEK.COM>
  6. Date: 12 Feb 93 17:30:10 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 2239
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1695
  11.  
  12. Submitted-by: deragon@harpo.cs.nyu.edu (Seeker)
  13. Posting-number: Volume 17, Issue 16
  14. Archive-name: gbp/Part04
  15. Supersedes: gb3: Volume 10, Issue 1-14
  16. Environment: sockets, curses
  17.  
  18.  
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 4 (of 21)."
  27. # Contents:  Configure hdrs/file.h misc/welcome.txt
  28. # Wrapped by billr@saab on Fri Feb 12 09:14:24 1993
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'Configure' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'Configure'\"
  32. else
  33. echo shar: Extracting \"'Configure'\" \(41100 characters\)
  34. sed "s/^X//" >'Configure' <<'END_OF_FILE'
  35. X#! /bin/sh
  36. X#
  37. X# If these # comments don't work, trim them.  Don't worry about any other
  38. X# shell scripts, Configure will trim # comments from them for you.
  39. X#
  40. X# (If you are trying to port this package to a machine without sh, I would
  41. X# suggest you cut out the prototypical config.h from the end of Configure
  42. X# and edit it to reflect your system.  Some packages may include samples
  43. X# of config.h for certain machines, so you might look for one of those.)
  44. X#
  45. X# $Header: /files/home/users/syd/elm.rel/RCS/Configure,v 4.1 90/04/28 22:40:46 syd Exp $
  46. X#
  47. X# Yes, you may rip this off to use in other distribution packages.
  48. X# (Note: this Configure script was generated automatically.  Rather than
  49. X# working with this copy of Configure, you may wish to get metaconfig.)
  50. X#
  51. X# ident "%W% %G% %Q%"
  52. X#
  53. X: sanity checks
  54. XPATH=".:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:$PATH"
  55. Xexport PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
  56. X
  57. Xif test ! -t 0; then
  58. X    echo "Say 'sh Configure', not 'sh <Configure'"
  59. X    exit 1
  60. Xfi
  61. X
  62. X(alias) >/dev/null 2>&1 && \
  63. X    echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
  64. X    echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
  65. X
  66. Xif test ! -d ../UU; then
  67. X    if test ! -d UU; then
  68. X    mkdir UU
  69. X    fi
  70. X    cd UU
  71. Xfi
  72. X
  73. Xcase "$1" in
  74. X-d) shift; fastread='yes';;
  75. Xesac
  76. X
  77. XLog=''
  78. XHeader=''
  79. Xbin=''
  80. Xbyteorder=''
  81. Xcontains=''
  82. Xcppstdin=''
  83. Xcppminus=''
  84. Xd_getopt=''
  85. Xhostname=''
  86. Xserver=''  ###
  87. Xport=''    ###
  88. Xd_multiple_comm=''
  89. Xd_threshloading=''
  90. Xd_autoscrap=''
  91. Xd_superpod=''
  92. Xmaxlogsize=''
  93. Xgbpath=''
  94. Xmydomain=''
  95. Xspore_success_rate=''
  96. Xi_time=''
  97. Xi_systime=''
  98. Xd_systimekernel=''
  99. Xn=''
  100. Xc=''
  101. Xpackage=''
  102. Xshsharp=''
  103. Xexpr=''
  104. Xsed=''
  105. Xecho=''
  106. Xcat=''
  107. Xrm=''
  108. Xmv=''
  109. Xcp=''
  110. Xar=''
  111. Xranlib=''
  112. Xtail=''
  113. Xtr=''
  114. Xmkdir=''
  115. Xsort=''
  116. Xuniq=''
  117. Xgrep=''
  118. Xtrylist=''
  119. Xtest=''
  120. Xinews=''
  121. Xegrep=''
  122. Xmore=''
  123. Xpg=''
  124. XMcc=''
  125. Xvi=''
  126. Xcpp=''
  127. Xperl=''
  128. Xemacs=''
  129. Xls=''
  130. Xshar=''
  131. Xuname=''
  132. Xuuname=''
  133. Xline=''
  134. Xchgrp=''
  135. Xchmod=''
  136. Xlint=''
  137. Xsleep=''
  138. Xpr=''
  139. Xtar=''
  140. Xln=''
  141. Xlpr=''
  142. Xlp=''
  143. Xtouch=''
  144. Xmake=''
  145. Xdate=''
  146. Xcsh=''
  147. Xc_date=''
  148. Xd_gethname=''
  149. Xd_douname=''
  150. Xd_phostname=''
  151. Xd_host_comp=''
  152. Xd_index=''
  153. Xsplit=''
  154. Xoptimize=''
  155. Xccflags=''
  156. Xcppflags=''
  157. Xldflags=''
  158. Xcc=''
  159. Xlibs=''
  160. Xtmpdir=''
  161. XCONFIG=''
  162. X: set package name
  163. Xpackage=GB+
  164. X
  165. Xecho " "
  166. Xecho "Beginning of configuration questions for $package kit."
  167. X: Eunice requires " " instead of "", can you believe it
  168. Xecho " "
  169. X
  170. Xdefine='define'
  171. Xundef='undef'
  172. X: change the next line if compiling for Xenix/286 on Xenix/386
  173. Xxlibpth='/usr/lib/386 /lib/386 /lib'
  174. Xlibpth='/usr/lib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
  175. Xsmallmach='pdp11 i8086 z8000 i80286 iAPX286'
  176. Xrmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
  177. Xtrap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
  178. X
  179. X: We must find out about Eunice early
  180. Xeunicefix=':'
  181. Xif test -f /etc/unixtovms; then
  182. X    eunicefix=/etc/unixtovms
  183. Xfi
  184. Xif test -f /etc/unixtovms.exe; then
  185. X    eunicefix=/etc/unixtovms.exe
  186. Xfi
  187. X
  188. X: Now test for existence of everything in MANIFEST
  189. X
  190. X#echo "First let's make sure your kit is complete.  Checking..."
  191. X#(cd ..; awk '' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$)
  192. X#echo "Looks good..."
  193. X#
  194. Xattrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
  195. Xattrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
  196. Xattrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
  197. Xattrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
  198. Xattrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
  199. Xattrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
  200. Xattrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__"
  201. Xd_newshome="/usr/NeWS"
  202. Xdefvoidused=7
  203. Xpth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb /usr/convex"
  204. X
  205. X: check for out bin directory
  206. Xif test ! -d ../bin; then
  207. X    echo "Making bin directory"
  208. X    mkdir ../bin
  209. Xelse
  210. X    echo "Found bin directory"
  211. Xfi
  212. X
  213. X: some greps do not return status, grrr.
  214. Xecho "grimblepritz" >grimble
  215. Xif grep blurfldyick grimble >/dev/null 2>&1 ; then
  216. X    contains=contains
  217. Xelif grep grimblepritz grimble >/dev/null 2>&1 ; then
  218. X    contains=grep
  219. Xelse
  220. X    contains=contains
  221. Xfi
  222. Xrm -f grimble
  223. X: the following should work in any shell
  224. Xcase "$contains" in
  225. Xcontains*)
  226. X    echo " "
  227. X    echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  228. X    cat >contains <<'EOSS'
  229. Xgrep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  230. XEOSS
  231. Xchmod +x contains
  232. Xesac
  233. X
  234. X: see if sh knows # comments
  235. Xecho " "
  236. Xecho "Checking your sh to see if it knows about # comments..."
  237. Xif sh -c '#' >/dev/null 2>&1 ; then
  238. X    echo "Your sh handles # comments correctly."
  239. X    shsharp=true
  240. X    spitshell=cat
  241. X    echo " "
  242. X    echo "Okay, let's see if #! works on this system..."
  243. X    echo "#!/bin/echo hi" > try
  244. X    $eunicefix try
  245. X    chmod +x try
  246. X    ./try > today
  247. X    if $contains hi today >/dev/null 2>&1; then
  248. X    echo "It does."
  249. X    sharpbang='#!'
  250. X    else
  251. X    echo "#! /bin/echo hi" > try
  252. X    $eunicefix try
  253. X    chmod +x try
  254. X    ./try > today
  255. X    if test -s today; then
  256. X        echo "It does."
  257. X        sharpbang='#! '
  258. X    else
  259. X        echo "It doesn't."
  260. X        sharpbang=': use '
  261. X    fi
  262. X    fi
  263. Xelse
  264. X    echo "Your sh doesn't grok # comments--I will strip them later on."
  265. X    shsharp=false
  266. X    echo "exec grep -v '^#'" >spitshell
  267. X    chmod +x spitshell
  268. X    $eunicefix spitshell
  269. X    spitshell=`pwd`/spitshell
  270. X    echo "I presume that if # doesn't work, #! won't work either!"
  271. X    sharpbang=': use '
  272. Xfi
  273. X
  274. X: figure out how to guarantee sh startup
  275. Xecho " "
  276. Xecho "Checking out how to guarantee sh startup..."
  277. Xstartsh=$sharpbang'/bin/sh'
  278. Xecho "Let's see if '$startsh' works..."
  279. Xcat >try <<EOSS
  280. X$startsh
  281. Xset abc
  282. Xtest "$?abc" != 1
  283. XEOSS
  284. X
  285. Xchmod +x try
  286. X$eunicefix try
  287. Xif ./try; then
  288. X    echo "Yup, it does."
  289. Xelse
  290. X    echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  291. Xfi
  292. Xrm -f try today
  293. X
  294. X: first determine how to suppress newline on echo command
  295. Xecho "Checking echo to see how to suppress newlines..."
  296. X(echo "hi there\c" ; echo " ") >.echotmp
  297. Xif $contains c .echotmp >/dev/null 2>&1 ; then
  298. X    echo "...using -n."
  299. X    n='-n'
  300. X    c=''
  301. Xelse
  302. X    cat <<'EOM'
  303. X...using \c
  304. XEOM
  305. X    n=''
  306. X    c='\c'
  307. Xfi
  308. Xecho $n "Type carriage return to continue.  Your cursor should be here-->$c"
  309. Xread ans
  310. Xrm -f .echotmp
  311. X
  312. X: now set up to do reads with possible shell escape and default assignment
  313. Xcat <<EOSC >myread
  314. Xcase "\$fastread" in
  315. Xyes) ans=''; echo " " ;;
  316. X*) ans='!';;
  317. Xesac
  318. Xwhile expr "X\$ans" : "X!" >/dev/null; do
  319. X    read ans
  320. X    case "\$ans" in
  321. X    !)
  322. X    sh
  323. X    echo " "
  324. X    echo $n "\$rp $c"
  325. X    ;;
  326. X    !*)
  327. X    set \`expr "X\$ans" : "X!\(.*\)\$"\`
  328. X    sh -c "\$*"
  329. X    echo " "
  330. X    echo $n "\$rp $c"
  331. X    ;;
  332. X    esac
  333. Xdone
  334. Xrp='Your answer:'
  335. Xcase "\$ans" in
  336. X'') ans="\$dflt";;
  337. Xesac
  338. XEOSC
  339. X
  340. X: general instructions
  341. Xcat <<EOH
  342. XThis installation shell script will examine your system and ask you questions
  343. Xto determine how the $package package should be installed.  If you get stuck
  344. Xon a question, you may use a ! shell escape to start a subshell or execute
  345. Xa command.  Many of the questions will have default answers in square
  346. Xbrackets--typing carriage return will give you the default.
  347. X
  348. XOn some of the questions which ask for file or directory names you are
  349. Xallowed to use the ~name construct to specify the login directory belonging
  350. Xto "name", even if you don't have a shell which knows about that.  Questions
  351. Xwhere this is allowed will be marked "(~name ok)".
  352. X
  353. XEOH
  354. Xrp="[Type carriage return to continue]"
  355. Xecho $n "$rp $c"
  356. X. myread
  357. Xcat <<EOH
  358. X
  359. XMuch effort has been expended to ensure that this shell script will run
  360. Xon any Unix system.  If despite that it blows up on you, your best bet is
  361. Xto edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
  362. Xknow how I blew it.  If you can't run Configure for some reason, you'll have
  363. Xto generate a config.sh file by hand.
  364. X
  365. XThis installation script affects things in two ways: 1) it may do direct
  366. Xvariable substitutions on some of the files included in this kit, and
  367. X2) it builds a config.h file for inclusion in C programs.  You may edit
  368. Xany of these files as the need arises after running this script.
  369. X
  370. XIf you make a mistake on a question, there is no easy way to back up to it
  371. Xcurrently.  The easiest thing to do is to edit config.sh and rerun all the
  372. XSH files.  Configure will offer to let you do this before it runs the SH files.
  373. X
  374. XEOH
  375. Xrp="[Type carriage return to continue]"
  376. Xecho $n "$rp $c"
  377. X. myread
  378. X
  379. X: get old answers, if there is a config file out there
  380. Xif test -f ../config.sh; then
  381. X    echo " "
  382. X    dflt=y
  383. X    rp="I see a config.sh file.  Did Configure make it on THIS system? [$dflt]"
  384. X    echo $n "$rp $c"
  385. X    . myread
  386. X    case "$ans" in
  387. X    n*) echo "OK, I'll ignore it.";;
  388. X    *)  echo "Fetching default answers from your old config.sh file..."
  389. X    tmp="$n"
  390. X    ans="$c"
  391. X        . ../config.sh
  392. X    n="$tmp"
  393. X    c="$ans"
  394. X    ;;
  395. X    esac
  396. Xfi
  397. X
  398. X: find out where common programs are
  399. Xecho " "
  400. Xecho "Locating common programs..."
  401. Xcat <<EOSC >loc
  402. X$startsh
  403. Xcase \$# in
  404. X0) exit 1;;
  405. Xesac
  406. Xthing=\$1
  407. Xshift
  408. Xdflt=\$1
  409. Xshift
  410. Xfor dir in \$*; do
  411. X    case "\$thing" in
  412. X    .)
  413. X    if test -d \$dir/\$thing; then
  414. X        echo \$dir
  415. X        exit 0
  416. X    fi
  417. X    ;;
  418. X    *)
  419. X    if test -f \$dir/\$thing; then
  420. X        echo \$dir/\$thing
  421. X        exit 0
  422. X    elif test -f \$dir/\$thing.exe; then
  423. X        : on Eunice apparently
  424. X        echo \$dir/\$thing
  425. X        exit 0
  426. X    fi
  427. X    ;;
  428. X    esac
  429. Xdone
  430. Xecho \$dflt
  431. Xexit 1
  432. XEOSC
  433. Xchmod +x loc
  434. X$eunicefix loc
  435. Xloclist="
  436. Xcat
  437. Xchgrp
  438. Xchmod
  439. Xcp
  440. Xecho
  441. Xexpr
  442. Xgrep
  443. Xln
  444. Xls
  445. Xmake
  446. Xmv
  447. Xrm
  448. Xsed
  449. Xar
  450. Xranlib
  451. Xsleep
  452. Xtouch
  453. Xtr
  454. X"
  455. Xtrylist="
  456. XMcc
  457. Xcpp
  458. Xdate
  459. Xemacs
  460. Xline
  461. Xlint
  462. Xlp
  463. Xlpr
  464. Xmore
  465. Xpg
  466. Xpr
  467. Xshar
  468. Xtar
  469. Xtest
  470. Xuname
  471. Xuuname
  472. Xvi
  473. X"
  474. Xfor file in $loclist; do
  475. X    xxx=`loc $file $file $pth`
  476. X    eval $file=$xxx
  477. X    eval _$file=$xxx
  478. X    case "$xxx" in
  479. X    /*)
  480. X    echo $file is in $xxx.
  481. X    ;;
  482. X    *)
  483. X    echo "I don't know where $file is.  I hope it's in everyone's PATH."
  484. X    ;;
  485. X    esac
  486. Xdone
  487. Xecho " "
  488. Xecho "Don't worry if any of the following aren't found..."
  489. Xans=offhand
  490. Xfor file in $trylist; do
  491. X    xxx=`loc $file $file $pth`
  492. X    eval $file=$xxx
  493. X    eval _$file=$xxx
  494. X    case "$xxx" in
  495. X    /*)
  496. X    echo $file is in $xxx.
  497. X    ;;
  498. X    *)
  499. X    echo "I don't see $file out there, $ans."
  500. X    ans=either
  501. X    ;;
  502. X    esac
  503. Xdone
  504. Xcase "$egrep" in
  505. Xegrep)
  506. X    echo "Substituting grep for egrep."
  507. X    egrep=$grep
  508. X    ;;
  509. Xesac
  510. Xcase "$test" in
  511. Xtest)
  512. X    echo "Hopefully test is built into your sh."
  513. X    ;;
  514. X/bin/test)
  515. X    if sh -c "PATH= test true" >/dev/null 2>&1; then
  516. X    echo "Using the test built into your sh."
  517. X    test=test
  518. X    fi
  519. X    ;;
  520. X*)
  521. X    test=test
  522. X    ;;
  523. Xesac
  524. Xcase "$echo" in
  525. Xecho)
  526. X    echo "Hopefully echo is built into your sh."
  527. X    ;;
  528. X/bin/echo)
  529. X    echo " "
  530. X    echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
  531. X    $echo $n "hi there$c" >foo1
  532. X    echo $n "hi there$c" >foo2
  533. X    if cmp foo1 foo2 >/dev/null 2>&1; then
  534. X    echo "They are compatible.  In fact, they may be identical."
  535. X    else
  536. X    case "$n" in
  537. X    '-n') n='' c='\c' ans='\c' ;;
  538. X    *) n='-n' c='' ans='-n' ;;
  539. X    esac
  540. X    cat <<FOO
  541. XThey are not compatible!  You are probably running ksh on a non-USG system.
  542. XI'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
  543. Xhave echo built in and we may have to run some Bourne shell scripts.  That
  544. Xmeans I'll have to use $ans to suppress newlines now.  Life is ridiculous.
  545. X
  546. XFOO
  547. X    rp="Your cursor should be here-->"
  548. X    $echo $n "$rp$c"
  549. X    . myread
  550. X    fi
  551. X    $rm -f foo1 foo2
  552. X    ;;
  553. X*)
  554. X    : cross your fingers
  555. X    echo=echo
  556. X    ;;
  557. Xesac
  558. Xrmlist="$rmlist loc"
  559. X
  560. X: set up shell script to do ~ expansion
  561. Xcat >filexp <<EOSS
  562. X$startsh
  563. X: expand filename
  564. Xcase "\$1" in
  565. X ~/*|~)
  566. X    echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  567. X    ;;
  568. X ~*)
  569. X    if $test -f /bin/csh; then
  570. X    /bin/csh -f -c "glob \$1"
  571. X    echo ""
  572. X    else
  573. X    name=\`$expr x\$1 : '..\([^/]*\)'\`
  574. X    dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
  575. X    if $test ! -d "\$dir"; then
  576. X        me=\`basename \$0\`
  577. X        echo "\$me: can't locate home directory for: \$name" >&2
  578. X        exit 1
  579. X    fi
  580. X    case "\$1" in
  581. X    */*)
  582. X        echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  583. X        ;;
  584. X    *)
  585. X        echo \$dir
  586. X        ;;
  587. X    esac
  588. X    fi
  589. X    ;;
  590. X*)
  591. X    echo \$1
  592. X    ;;
  593. Xesac
  594. XEOSS
  595. Xchmod +x filexp
  596. X$eunicefix filexp
  597. X
  598. X: see if date exists, if so, init c_date
  599. Xif $test ! "x$date" = "x" ; then
  600. X    c_date=`$date +"%m/%d/%y %H:%M"`
  601. Xelse
  602. X    c_date='date was unavailable at configuration'
  603. Xfi
  604. X
  605. X: make some quick guesses about what we are up against
  606. Xecho " "
  607. X$echo $n "Hmm...  $c"
  608. Xif $test -n "$uname"; then
  609. X    uname_os=`uname -s`
  610. X    uname_rel=`uname -r`
  611. X    uname_rel=`expr "$uname" : "\(...\).*"`
  612. Xelse
  613. X    uname_os=unknown
  614. X    uname_rel=unknown
  615. Xfi
  616. Xcat /usr/include/signal.h /usr/include/sys/signal.h >foo
  617. Xif test `echo abc | tr a-z A-Z` = Abc ; then
  618. X    echo "Looks kind of like a USG system, but we'll see..."
  619. X    echo exit 1 >bsd
  620. X    echo exit 0 >usg
  621. X    echo exit 1 >v7
  622. Xelif $contains SIGTSTP foo >/dev/null 2>&1 ; then
  623. X    if $test "$uname_os" = "SunOs" -a "$uname_rel" = "4.1" ; then
  624. X    echo "Looks like SunOs 4.1, a USG system, but we'll see..."
  625. X    echo exit 1 >bsd
  626. X    echo exit 0 >usg
  627. X    echo exit 1 >v7
  628. X    else
  629. X    echo "Looks kind of like a BSD system, but we'll see..."
  630. X    echo exit 0 >bsd
  631. X    echo exit 1 >usg
  632. X    echo exit 1 >v7
  633. X    fi
  634. Xelse
  635. X    echo "Looks kind of like a version 7 system, but we'll see..."
  636. X    echo exit 1 >bsd
  637. X    echo exit 1 >usg
  638. X    echo exit 0 >v7
  639. Xfi
  640. Xcase "$eunicefix" in
  641. X*unixtovms*)
  642. X    cat <<'EOI'
  643. XThere is, however, a strange, musty smell in the air that reminds me of
  644. Xsomething...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  645. XEOI
  646. X    echo "exit 0" >eunice
  647. X    d_eunice="$define"
  648. X    ;;
  649. X*)
  650. X    echo " "
  651. X    echo "Congratulations.  You aren't running Eunice."
  652. X    d_eunice="$undef"
  653. X    echo "exit 1" >eunice
  654. X    ;;
  655. Xesac
  656. Xif test -f /xenix; then
  657. X    echo "Actually, this looks more like a XENIX system..."
  658. X    echo "exit 0" >xenix
  659. Xelse
  660. X    echo " "
  661. X    echo "It's not Xenix..."
  662. X    echo "exit 1" >xenix
  663. Xfi
  664. Xchmod +x xenix
  665. X$eunicefix xenix
  666. Xif test -f /venix; then
  667. X    echo "Actually, this looks more like a VENIX system..."
  668. X    echo "exit 0" >venix
  669. Xelse
  670. X    echo " "
  671. X    if xenix; then
  672. X    : null
  673. X    else
  674. X    echo "Nor is it Venix..."
  675. X    fi
  676. X    echo "exit 1" >venix
  677. Xfi
  678. Xchmod +x bsd usg v7 eunice venix
  679. X$eunicefix bsd usg v7 eunice venix
  680. Xrm -rf foo
  681. Xrmlist="$rmlist bsd usg v7 eunice venix xenix"
  682. X
  683. X
  684. X: default clear to no extra flags
  685. Xxencf=
  686. Xxenlf=
  687. Xd_xenix="$undef"
  688. Xd_bsd="$undef"
  689. X: see if we are xenix 
  690. Xif xenix; then
  691. X    d_xenix="$define"
  692. X:    now are we a 286
  693. X    case "`uname -p`" in
  694. X    i80286) 
  695. X        xencf="-LARGE -Ml2et32"
  696. X        xenlf="-Ml2t32 -F 5600 -SEG 512"
  697. X      esac
  698. Xfi
  699. Xif bsd; then
  700. X    d_bsd="$define"
  701. Xfi
  702. X
  703. X: see if we need a special compiler
  704. Xecho " "
  705. Xif usg; then
  706. X    case "$cc" in
  707. X    '')
  708. X    case "$Mcc" in
  709. X    /*) dflt='Mcc'
  710. X        ;;
  711. X    *)
  712. X        case "$large" in
  713. X        -M*)
  714. X        dflt='cc'
  715. X        ;;
  716. X        *)
  717. X        if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
  718. X            dflt='cc -M'
  719. X        else
  720. X            dflt='cc'
  721. X        fi
  722. X        ;;
  723. X        esac
  724. X        ;;
  725. X    esac
  726. X    ;;
  727. X    *)  dflt="$cc";;
  728. X    esac
  729. X    $cat <<'EOM'
  730. X  
  731. XOn some systems the default C compiler will not resolve multiple global
  732. Xreferences that happen to have the same name.  On some such systems the
  733. X"Mcc" command may be used to force these to be resolved.  On other systems
  734. Xa "cc -M" command is required.  (Note that the -M flag on other systems
  735. Xindicates a memory model to use!)  If you have the Gnu C compiler, you
  736. Xmight wish to use that instead.  What command will force resolution on
  737. X
  738. X    For building GB+, we recommend GCC, since it is faster.
  739. XEOM
  740. X    $echo $n "this system? [$dflt] $c"
  741. X    rp="Command to resolve multiple refs? [$dflt]"
  742. X    . myread
  743. X    cc="$ans"
  744. Xelse
  745. X    case "$cc" in
  746. X    '') dflt=gcc;;
  747. X    *) dflt="$cc";;
  748. X    esac
  749. X    rp="Use which C compiler? [$dflt]"
  750. X    $echo $n "$rp $c"
  751. X    . myread
  752. X    cc="$ans"
  753. Xfi
  754. Xcase "$cc" in
  755. Xgcc*) cpp=`loc gcc-cpp $cpp $pth`;;
  756. Xesac
  757. X
  758. X: determine optimize, if desired, or use for debug flag also
  759. Xcase "$optimize" in
  760. X' ') dflt="none"
  761. X     ;;
  762. X'') dflt="-O";
  763. X    ;;
  764. X*)  dflt="$optimize"
  765. X    ;;
  766. Xesac
  767. Xcat <<EOH
  768. X
  769. XSome C compilers have problems with their optimizers, by default, $package
  770. Xcompiles with the -O flag to use the optimizer.  Alternately, you might
  771. Xwant to use the symbolic debugger, which uses the -g flag (on traditional
  772. XUnix systems).  Either flag can be specified here.  To use neither flag,
  773. Xspecify the word "none".
  774. X  
  775. XEOH
  776. Xrp="What optimizer/debugger flag should be used? [$dflt]"
  777. X$echo $n "$rp $c"
  778. X. myread
  779. Xoptimize="$ans"
  780. Xcase "$optimize" in
  781. X'none') optimize=" "
  782. X     ;;
  783. Xesac
  784. X
  785. Xcase "$ccflags" in
  786. X'') case "$cc" in
  787. X    *gcc*) dflt='-fpcc-struct-return';;
  788. X    *) dflt='';;
  789. X    esac
  790. X    ;;
  791. X*) dflt="$ccflags";;
  792. Xesac
  793. Xfor thisincl in $inclwanted; do
  794. X    if test -d $thisincl; then
  795. X    case "$dflt" in
  796. X    *$thisincl*);;
  797. X    *) dflt="$dflt -I$thisincl";;
  798. X    esac
  799. X    fi
  800. Xdone
  801. Xcase "$optimize" in
  802. X-g*)
  803. X    case "$dflt" in
  804. X    *DEBUG*);;
  805. X    *) dflt="$dflt -DDEBUG";;
  806. X    esac
  807. X    ;;
  808. Xesac
  809. Xcase "$dflt" in
  810. X'') dflt=none;;
  811. Xesac
  812. Xif $test -n "$xencf" ; then
  813. X    $echo "Xenix 286 system, using compiler flags $xencf"
  814. X    $echo "do not respecify these flags below."
  815. X    $echo ""
  816. Xfi
  817. Xcat <<EOH
  818. X
  819. XYour C compiler may want other flags.  For this question you should
  820. Xinclude -I/whatever and -DWHATEVER flags and any other flags used by
  821. Xthe C compiler, but you should NOT include libraries or ld flags like
  822. X-lwhatever.  To use no flags, specify the word "none".
  823. X  
  824. XEOH
  825. Xrp="Any additional cc flags? [$dflt]"
  826. X$echo $n "$rp $c"
  827. X. myread
  828. Xcase "$ans" in
  829. Xnone) ans='';
  830. Xesac
  831. Xccflags="$ans"
  832. X
  833. X: the following weeds options from ccflags that are of no interest to cpp
  834. Xcppflags="$ccflags"
  835. Xcase "$cc" in
  836. X*gcc*) cppflags="$cppflags -D__GNUC__";;
  837. Xesac
  838. Xcase "$cppflags" in
  839. X'');;
  840. X*)  set X $cppflags
  841. X    cppflags=''
  842. X    for flag do
  843. X    case $flag in
  844. X    -D*|-I*) cppflags="$cppflags $flag";;
  845. X    esac
  846. X    done
  847. X    case "$cppflags" in
  848. X    *-*)  echo "(C preprocessor flags: $cppflags)";;
  849. X    esac
  850. X    ;;
  851. Xesac
  852. X
  853. Xif $test -n "$xenlf" ; then
  854. X    $echo "Xenix 286 system, using linker flags $xenlf"
  855. X    $echo "do not respecify these flags below"
  856. X    $echo ""
  857. Xfi
  858. Xcase "$ldflags" in
  859. X'') if venix; then
  860. X    dflt='-i -z'
  861. X    else
  862. X    dflt='none'
  863. X    fi
  864. X    ;;
  865. X*) dflt="$ldflags";;
  866. Xesac
  867. Xecho " "
  868. Xrp="Any additional ld flags (NOT including libraries)? [$dflt]"
  869. X$echo $n "$rp $c"
  870. X. myread
  871. Xcase "$ans" in
  872. Xnone) ans='';
  873. Xesac
  874. Xldflags="$ans"
  875. Xrmlist="$rmlist pdp11"
  876. X
  877. Xecho " "
  878. Xecho "Checking for optional libraries..."
  879. Xcase "$libs" in
  880. X'') dflt='';;
  881. X*) dflt="$libs";;
  882. Xesac
  883. Xcase "$libswanted" in
  884. X'') libswanted='c_s';;
  885. Xesac
  886. Xfor thislib in $libswanted; do
  887. X    case "$thislib" in
  888. X    dbm) thatlib=ndbm;;
  889. X    *_s) thatlib=NONE;;
  890. X    *) thatlib="${thislib}_s";;
  891. X    *) thatlib=NONE;;
  892. X    esac
  893. X    xxx=`loc lib$thislib.a X /usr/lib /usr/local/lib /lib`
  894. X    if test -f $xxx; then
  895. X    echo "Found -l$thislib."
  896. X    case "$dflt" in
  897. X    *-l$thislib*|*-l$thatlib*);;
  898. X    *) dflt="$dflt -l$thislib";;
  899. X    esac
  900. X    else
  901. X    xxx=`loc lib$thislib.a X $libpth`
  902. X    if test -f $xxx; then
  903. X        echo "Found $xxx."
  904. X        case "$dflt" in
  905. X        *$xxx*);;
  906. X        *) dflt="$dflt $xxx";;
  907. X        esac
  908. X    else
  909. X        xxx=`loc Slib$thislib.a X $xlibpth`
  910. X        if test -f $xxx; then
  911. X        echo "Found -l$thislib."
  912. X        case "$dflt" in
  913. X        *-l$thislib*|*-l$thatlib*);;
  914. X        *) dflt="$dflt -l$thislib";;
  915. X        esac
  916. X        else
  917. X        echo "No -l$thislib."
  918. X        fi
  919. X    fi
  920. X    fi
  921. Xdone
  922. Xset X $dflt
  923. Xshift
  924. Xdflt="$*"
  925. Xcase "$dflt" in
  926. X'') dflt='none';;
  927. Xesac
  928. X
  929. X$cat <<EOM
  930. XSome versions of Unix support shared libraries, which make
  931. Xexecutables smaller but make load time slightly longer.
  932. X
  933. XOn some systems, mostly newer Unix System V's, the shared library
  934. Xis included by putting the option "-lc_s" as the last thing on the
  935. Xcc command line when linking.  Other systems use shared libraries
  936. Xby default.  There may be other libraries needed to compile $package
  937. Xon your machine as well.  If your system needs the "-lc_s" option,
  938. Xinclude it here.  Include any other special libraries here as well.
  939. XSay "none" for none.
  940. XEOM
  941. X
  942. Xecho " "
  943. Xrp="Any additional libraries? [$dflt]"
  944. X$echo $n "$rp $c"
  945. X. myread
  946. Xcase "$ans" in
  947. Xnone) ans='';
  948. Xesac
  949. Xlibs="$ans"
  950. X
  951. X: check for ordering of bytes in a long
  952. Xcase "$byteorder" in
  953. X'')
  954. Xcat <<'EOM'
  955. X  
  956. XIn the following, larger digits indicate more significance.  A big-endian
  957. Xmachine like a Pyramid or a Motorola 680?0 chip will come out to 4321.  A
  958. Xlittle-endian machine like a Vax or an Intel 80?86 chip would be 1234.  Other
  959. Xmachines may have weird orders like 3412.  A Cray will report 87654321.  If
  960. Xthe test program works the default is probably right.
  961. XI'm now running the test program...
  962. XEOM
  963. X    $cat >try.c <<'EOCP'
  964. X#include <stdio.h>
  965. Xmain()
  966. X{
  967. X    int i;
  968. X    union {
  969. X    unsigned long l;
  970. X    char c[sizeof(long)];
  971. X    } u;
  972. X
  973. X    if (sizeof(long) > 4)
  974. X    u.l = 0x0807060504030201;
  975. X    else
  976. X    u.l = 0x04030201;
  977. X    for (i=0; i < sizeof(long); i++)
  978. X    printf("%c",u.c[i]+'0');
  979. X    printf("\n");
  980. X}
  981. XEOCP
  982. X    if $cc try.c -o try >/dev/null 2>&1 ; then
  983. X    dflt=`./try`
  984. X    case "$dflt" in
  985. X    ????|????????) echo "(The test program ran ok.)";;
  986. X    *) echo "(The test program didn't run right for some reason.)";;
  987. X    esac
  988. X    else
  989. X    dflt='4321'
  990. X    echo "(I can't seem to compile the test program.  Guessing big-endian...)"
  991. X    fi
  992. X    ;;
  993. X*)
  994. X    echo " "
  995. X    dflt="$byteorder"
  996. X    ;;
  997. Xesac
  998. Xrp="What is the order of bytes in a long? [$dflt]"
  999. X$echo $n "$rp $c"
  1000. X. myread
  1001. Xbyteorder="$ans"
  1002. X$rm -f try.c try
  1003. X
  1004. X: get list of predefined functions in a handy place
  1005. Xecho " "
  1006. Xcase "$libc" in
  1007. X'') libc=unknown;;
  1008. Xesac
  1009. Xcase "$libpth" in
  1010. X'') libpth='/lib /usr/lib /usr/local/lib';;
  1011. Xesac
  1012. Xcase "$libs" in
  1013. X*-lc_s*) libc=`loc libc_s.a $libc $libpth`
  1014. Xesac
  1015. Xlibnames='';
  1016. Xcase "$libs" in
  1017. X'') ;;
  1018. X*)  for thislib in $libs; do
  1019. X    case "$thislib" in
  1020. X    -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
  1021. X        try=`loc lib$thislib.a blurfl/dyick $libpth`
  1022. X        if test ! -f $try; then
  1023. X        try=`loc lib$thislib blurfl/dyick $libpth`
  1024. X        if test ! -f $try; then
  1025. X            try=`loc $thislib blurfl/dyick $libpth`
  1026. X            if test ! -f $try; then
  1027. X            try=`loc Slib$thislib.a blurfl/dyick $xlibpth`
  1028. X            if test ! -f $try; then
  1029. X                try=''
  1030. X            fi
  1031. X            fi
  1032. X        fi
  1033. X        fi
  1034. X        libnames="$libnames $try"
  1035. X        ;;
  1036. X    *) libnames="$libnames $thislib" ;;
  1037. X    esac
  1038. X    done
  1039. X    ;;
  1040. Xesac
  1041. Xset /usr/lib/libc.so.[0-9]*
  1042. Xeval set \$$#
  1043. Xif test -f "$1"; then
  1044. X    echo "Your shared C library is in $1."
  1045. X    libc="$1"
  1046. Xelif test -f $libc; then
  1047. X    echo "Your C library is in $libc, like you said before."
  1048. Xelif test -f /lib/libc.a; then
  1049. X    echo "Your C library is in /lib/libc.a.  You're normal."
  1050. X    libc=/lib/libc.a
  1051. Xelse
  1052. X    if test "$uname_os" != DomainOS ; then
  1053. X        ans=`loc libc.a blurfl/dyick $libpth`
  1054. X    fi
  1055. X    if test ! -f "$ans"; then
  1056. X    ans=`loc libc blurfl/dyick $libpth`
  1057. X    fi
  1058. X    if test ! -f "$ans"; then
  1059. X    ans=`loc clib blurfl/dyick $libpth`
  1060. X    fi
  1061. X    if test ! -f "$ans"; then
  1062. X    ans=`loc Slibc.a blurfl/dyick $xlibpth`
  1063. X    fi
  1064. X    if test ! -f "$ans"; then
  1065. X    ans=`loc Mlibc.a blurfl/dyick $xlibpth`
  1066. X    fi
  1067. X    if test ! -f "$ans"; then
  1068. X    ans=`loc Llibc.a blurfl/dyick $xlibpth`
  1069. X    fi
  1070. X    if test -f "$ans"; then
  1071. X    echo "Your C library is in $ans, of all places."
  1072. X    libc=$ans
  1073. X    else
  1074. X    cat <<EOM
  1075. XI can't seem to find your C library.  I've looked in the following places:
  1076. X
  1077. X    $libpth
  1078. X
  1079. XNone of these seems to contain your C library.  What is the full name
  1080. XEOM
  1081. X    dflt=None
  1082. X    $echo $n "of your C library? $c"
  1083. X    rp='C library full name?'
  1084. X    . myread
  1085. X    libc="$ans"
  1086. X    fi
  1087. Xfi
  1088. Xecho " "
  1089. Xset `echo $libc $libnames | tr ' ' '\012' | sort | uniq`
  1090. X$echo $n "Extracting names from $* for later perusal...$c"
  1091. Xnm $* 2>/dev/null >libc.tmp
  1092. X$sed -n -e 's/^.* [AT]  *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
  1093. Xif $contains '^printf$' libc.list >/dev/null 2>&1; then
  1094. X    echo "done"
  1095. Xelse
  1096. X    $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
  1097. X    $contains '^printf$' libc.list >/dev/null 2>&1 || \
  1098. X    $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list
  1099. X    $contains '^printf$' libc.list >/dev/null 2>&1 || \
  1100. X       $sed -n -e 's/^_//' \
  1101. X          -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
  1102. X    if $contains '^printf$' libc.list >/dev/null 2>&1; then
  1103. X    echo "done"
  1104. X    else
  1105. X    echo " "
  1106. X    echo "nm didn't seem to work right."
  1107. X    echo "Trying ar instead..."
  1108. X    if ar t $libc > libc.tmp; then
  1109. X        for thisname in $libnames; do
  1110. X        ar t $thisname >>libc.tmp
  1111. X        done
  1112. X        $sed -e 's/\.o$//' < libc.tmp > libc.list
  1113. X        echo "Ok."
  1114. X    else
  1115. X        echo "ar didn't seem to work right."
  1116. X        echo "Maybe this is a Cray...trying bld instead..."
  1117. X        if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
  1118. X        for thisname in $libnames; do
  1119. X            bld t $libnames | \
  1120. X            $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
  1121. X            ar t $thisname >>libc.tmp
  1122. X        done
  1123. X        echo "Ok."
  1124. X        else
  1125. X            echo "That didn't work either.  Giving up."
  1126. X            exit 1
  1127. X        fi
  1128. X    fi
  1129. X    fi
  1130. Xfi
  1131. X
  1132. Xinlibc='echo " ";
  1133. Xif $contains "^$1\$" libc.list >/dev/null 2>&1;
  1134. Xthen echo "$1() found"; eval "$2=$define";
  1135. Xelse echo "$1() not found"; eval "$2=$undef"; fi'
  1136. X
  1137. Xrmlist="$rmlist libc.tmp libc.list"
  1138. X
  1139. X: now get the host name
  1140. Xecho " "
  1141. Xecho "Figuring out host name..."
  1142. Xecho 'Maybe "hostname" will work...'
  1143. Xif ans=`sh -c hostname 2>&1` ; then
  1144. X    hostname=$ans
  1145. X    phostname=hostname
  1146. Xelse
  1147. X    if xenix; then
  1148. X    echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
  1149. X    if ans=`cat /etc/systemid 2>&1` ; then
  1150. X        hostname=$ans
  1151. X        phostname='cat /etc/systemid'
  1152. X        echo "Whadyaknow.  Xenix always was a bit strange..."
  1153. X    else
  1154. X        echo 'No, maybe "uuname -l" will work...'
  1155. X        if ans=`sh -c 'uuname -l' 2>&1` ; then
  1156. X        hostname=$ans
  1157. X        phostname='uuname -l'
  1158. X        else
  1159. X        echo 'Strange.  Maybe "uname -n" will work...'
  1160. X        if ans=`sh -c 'uname -n' 2>&1` ; then
  1161. X            hostname=$ans
  1162. X            phostname='uname -n'
  1163. X        else
  1164. X            echo 'Oh well, maybe I can mine it out of whoami.h...'
  1165. X            if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
  1166. X            hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
  1167. X            phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
  1168. X            else
  1169. X            case "$hostname" in
  1170. X            '') echo "Does this machine have an identity crisis or something?"
  1171. X                phostname=''
  1172. X                ;;
  1173. X            *)  echo "Well, you said $hostname before...";;
  1174. X            esac
  1175. X            fi
  1176. X        fi
  1177. X        fi
  1178. X    fi
  1179. X    else
  1180. X    if $test -r /etc/systemid ; then
  1181. X        echo "What is a non-Xenix system doing with /etc/systemid?"
  1182. X    fi
  1183. X    echo 'No, maybe "uuname -l" will work...'
  1184. X    if $test -n "$uuname" && ans=`sh -c "$uuname -l" 2>&1` ; then
  1185. X        hostname=$ans
  1186. X        phostname="$uuname -l"
  1187. X    else
  1188. X        echo 'Strange.  Maybe "uname -n" will work...'
  1189. X        if $test -n "$uname" && ans=`sh -c "$uname -n" 2>&1` ; then
  1190. X        hostname=$ans
  1191. X        phostname="$uname -n"
  1192. X        else
  1193. X        if ans=`cat /etc/systemid 2>&1` ; then
  1194. X            hostname=$ans
  1195. X            phostname='cat /etc/systemid'
  1196. X            echo "Well, I'll use the systemid file anyway..."
  1197. X        else
  1198. X            echo 'Oh well, maybe I can mine it out of whoami.h...'
  1199. X            if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
  1200. X            hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
  1201. X            phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
  1202. X            else
  1203. X            case "$hostname" in
  1204. X            '') echo "Does this machine have an identity crisis or something?"
  1205. X                phostname=''
  1206. X                ;;
  1207. X            *)  echo "Well, you said $hostname before...";;
  1208. X            esac
  1209. X            fi
  1210. X        fi
  1211. X        fi
  1212. X    fi
  1213. X    fi
  1214. Xfi
  1215. X: you do not want to know about this
  1216. Xset $hostname
  1217. Xhostname=$1
  1218. X
  1219. X: translate upper to lower if necessary
  1220. Xcase "$hostname" in
  1221. X    *[A-Z]*)
  1222. X    hostname=`echo $hostname | tr '[A-Z]' '[a-z]'`
  1223. X    echo "(Normalizing case in your host name)"
  1224. X    ;;
  1225. Xesac
  1226. X
  1227. X: verify guess
  1228. Xif $test "$hostname" ; then
  1229. X    dflt=y
  1230. X    echo 'Your host name appears to be "'$hostname'".'
  1231. X    echo $n "Is this correct? [$dflt] "
  1232. X    . myread
  1233. X    case "$ans" in
  1234. X      y*)  ;;
  1235. X      *)      hostname='' ;;
  1236. X    esac
  1237. Xfi
  1238. X
  1239. X: bad guess or no guess
  1240. Xwhile $test "X$hostname" = X ; do
  1241. X    dflt=''
  1242. X    rp="Please type the (one word) name of your host:"
  1243. X    $echo $n "$rp $c"
  1244. X    . myread
  1245. X    hostname="$ans"
  1246. Xdone
  1247. X
  1248. Xecho " "
  1249. Xcase "$hostname" in
  1250. X*.*)
  1251. X    dflt=`$expr "X$hostname" : "X[^.]*\(\..*\)"`
  1252. X    hostname=`$expr "X$hostname" : "X\([^.]*\)\."`
  1253. X    echo "(Trimming domain name from host name--host name is now $hostname)"
  1254. X    ;;
  1255. X*)  case "$mydomain" in
  1256. X    '') dflt='.UUCP';;
  1257. X    *) dflt="$mydomain";;
  1258. X    esac
  1259. X    ;;
  1260. Xesac
  1261. X
  1262. Xecho " "
  1263. X: verify guess
  1264. Xif $test "$hostname" ; then
  1265. X    dflt=y
  1266. X    echo $n 'Will the GB server be running on '$hostname?' [y] '
  1267. X    . myread
  1268. X    case "$ans" in
  1269. X      y*)  ;;
  1270. X      *)      hostname='' ;;
  1271. X    esac
  1272. Xfi
  1273. X: bad guess or no guess
  1274. Xwhile $test "X$hostname" = X ; do
  1275. X    dflt=''
  1276. X    rp="Please type the (one word) name of your host: "
  1277. X    $echo $n "$rp $c"
  1278. X    . myread
  1279. X    hostname="$ans"
  1280. Xdone
  1281. X
  1282. X
  1283. X
  1284. X: find domain name
  1285. Xecho " "
  1286. Xecho "Trying to figure out your domainname"
  1287. Xif ans=`sh -c domainname 2>&1` ; then
  1288. X    mydomain=$ans
  1289. X    phostname=hostname
  1290. Xelse
  1291. Xrp="What is your domain name? [$dflt] "
  1292. X$echo $n "$rp $c"
  1293. X. myread
  1294. Xcase "$ans" in
  1295. X'') ;;
  1296. X.*) ;;
  1297. X*) ans=".$ans";;
  1298. Xesac
  1299. Xmydomain="$ans"
  1300. Xfi
  1301. X
  1302. X: verify guess
  1303. Xif $test "$hostname" ; then
  1304. X    dflt=y
  1305. X    echo 'Your host domain name appears to be "'$mydomain'".'
  1306. X    echo $n "Is this correct? [$dflt] "
  1307. X    . myread
  1308. X    case "$ans" in
  1309. X      y*)  ;;
  1310. X      *)      mydomain='' ;;
  1311. X    esac
  1312. Xfi    
  1313. X
  1314. X: bad guess or no guess
  1315. Xwhile $test "X$mydomain" = X ; do
  1316. X    dflt=''
  1317. X    rp="Please type your domainname in: "
  1318. X    $echo $n "$rp $c"
  1319. X    . myread
  1320. X    mydomain="$ans"
  1321. Xdone
  1322. X
  1323. X
  1324. X: be very verbose...
  1325. Xecho " "
  1326. Xecho "So let me get this straight... the GB server will be running on"
  1327. Xecho "the machine $hostname.$mydomain."
  1328. X: verify guess
  1329. X    dflt=y
  1330. X    rp="Is this correct? [$dflt]"
  1331. X#    $echo $n "Is this correct? [$dflt] $c "
  1332. X     $echo $n $rp $c
  1333. X    . myread
  1334. X    case "$ans" in
  1335. X      y*)       host=$hostname.$mydomain;;
  1336. X      *)      host='' ;;
  1337. X    esac
  1338. X
  1339. X: bad guess or no guess
  1340. Xwhile $test "X$host" = X ; do
  1341. X    dflt=''
  1342. X    rp="Please type the machine name _and_ domain name of the server host: "
  1343. X    $echo $n "$rp $c"
  1344. X    . myread
  1345. X    hostserver="$ans"
  1346. X    host="$ans"
  1347. Xdone
  1348. X
  1349. X: get the port number...
  1350. X    dflt="2010"
  1351. X    rp="What port would you like the server to run on? [$dflt] "
  1352. X    $echo $n "$rp $c"
  1353. X    . myread
  1354. X    port="$ans"
  1355. X    echo " "
  1356. X
  1357. X: get the top level path.
  1358. X    echo " "
  1359. X    dflt=`(cd ..; pwd)`
  1360. X    echo "This question will determine where the data files pertaining to"
  1361. X    echo "$package will be kept.  It is usually kept in this directory."
  1362. X    echo " "
  1363. X    rp="Where would you like create the Data/News/Tele Directorys? [$dflt]"
  1364. X    $echo $n "$rp $c"
  1365. X    . myread
  1366. X    gbpath="$ans"
  1367. X    echo " "
  1368. X
  1369. X: Ask about using threshloading.
  1370. X    dflt=y
  1371. X    rp="Would you like to use threshloading in the game? [$dflt]"
  1372. X    echo $n "$rp $c"
  1373. X    . myread
  1374. X    case "$ans" in
  1375. X    n*) echo "Ok, we won't then!"
  1376. X        d_threshloading="$undef"
  1377. X        ;;
  1378. X    *)  echo "Ok, setting #define THRESHLOADING"
  1379. X        d_threshloading="$define"
  1380. X        ;;
  1381. X    esac
  1382. X
  1383. X: Ask about using autoscrap.
  1384. X    dflt=y
  1385. X    rp="Would you like to use autocsrap in the game? [$dflt]"
  1386. X    echo $n "$rp $c"
  1387. X    . myread
  1388. X    case "$ans" in
  1389. X    n*) echo "Ok, we won't then!"
  1390. X        d_autoscrap="$undef"
  1391. X        ;;
  1392. X    *)  echo "Ok, setting #define AUTOSCRAP"
  1393. X        d_autoscrap="$define"
  1394. X        ;;
  1395. X    esac
  1396. X
  1397. X: Ask about using superpods.
  1398. X    dflt=y
  1399. X    rp="Would you like to use superpods in the game (9r/75% success)? [$dflt]"
  1400. X    echo $n "$rp $c"
  1401. X    . myread
  1402. X    case "$ans" in
  1403. X    n*) echo "Ok, we won't then!"
  1404. X        spore_success_rate="25"
  1405. X        d_superpod="$undef"
  1406. X        ;;
  1407. X    *)  echo "Ok, setting #define SUPER_PODS"
  1408. X        spore_success_rate="75"
  1409. X        d_superpod="$define"
  1410. X        ;;
  1411. X    esac
  1412. X
  1413. X: Ask about using multi_comm_chan.
  1414. X    dflt=n
  1415. X    rp="Would you like to use multiple comm channels in the game? [$dflt]"
  1416. X    echo $n "$rp $c"
  1417. X    . myread
  1418. X    case "$ans" in
  1419. X    n*) echo "Ok, we won't then!"
  1420. X        d_multi_comm="$undef"
  1421. X        ;;
  1422. X    *)  echo "Ok, setting #define MULTIPLE_COMM_CHANNELS"
  1423. X        d_multi_comm="$define"
  1424. X        ;;
  1425. X    esac
  1426. X
  1427. X: see if getopt exists
  1428. Xset getopt d_getopt
  1429. Xeval $inlibc
  1430. X
  1431. X: see how we invoke the C preprocessor
  1432. Xecho " "
  1433. Xecho "Now, how can we feed standard input to your C preprocessor..."
  1434. Xcat <<'EOT' >testcpp.c
  1435. X#define ABC abc
  1436. X#define XYZ xyz
  1437. XABC.XYZ
  1438. XEOT
  1439. Xecho 'Maybe "'"$cc"' -E" will work...'
  1440. X$cc -E <testcpp.c >testcpp.out 2>&1
  1441. X: try to force gcc preprocessor if that is the compiler they are using
  1442. Xcase $? in
  1443. X0) cppstdin="$cc -E";;
  1444. X*) case "$cc" in
  1445. X    *gcc*)
  1446. X    cd ..
  1447. X    echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
  1448. X    echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
  1449. X    chmod 755 cppstdin
  1450. X    cppstdin=`pwd`/cppstdin
  1451. X    cppminus='';
  1452. X    cd UU
  1453. X    $cppstdin <testcpp.c >testcpp.out 2>&1
  1454. X    ;;
  1455. X    esac
  1456. X    ;;
  1457. Xesac
  1458. Xif $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1459. X    echo "Yup, it does."
  1460. X    cppstdin="$cc -E"
  1461. X    cppminus='';
  1462. Xelse
  1463. X    echo 'Nope, maybe "'$cpp'" will work...'
  1464. X    $cpp <testcpp.c >testcpp.out 2>&1
  1465. X    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1466. X    echo "Yup, it does."
  1467. X    cppstdin="$cpp"
  1468. X    cppminus='';
  1469. X    else
  1470. X    echo 'No such luck...maybe "'$cpp' -" will work...'
  1471. X    $cpp - <testcpp.c >testcpp.out 2>&1
  1472. X    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1473. X        echo "It works!"
  1474. X        cppstdin="$cpp"
  1475. X        cppminus='-';
  1476. X    else
  1477. X        echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
  1478. X        $cc -E - <testcpp.c >testcpp.out 2>&1
  1479. X        if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1480. X        echo "Hooray, it works!  I was beginning to wonder."
  1481. X        cppstdin="$cc -E"
  1482. X        cppminus='-';
  1483. X        else
  1484. X        echo 'Nope...maybe "'"$cc"' -P" will work...'
  1485. X        $cc -P <testcpp.c >testcpp.out 2>&1
  1486. X        if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1487. X            echo "Yup, that does."
  1488. X            cppstdin="$cc -P"
  1489. X            cppminus='';
  1490. X        else
  1491. X            echo 'Nope...maybe "'"$cc"' -P -" will work...'
  1492. X            $cc -P - <testcpp.c >testcpp.out 2>&1
  1493. X            if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1494. X            echo "Yup, that does."
  1495. X            cppstdin="$cc -P"
  1496. X            cppminus='-';
  1497. X            else
  1498. X            echo 'Hmm...perhaps you already told me...'
  1499. X            case "$cppstdin" in
  1500. X            '') ;;
  1501. X            *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
  1502. X            esac
  1503. X            if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1504. X                echo "Hooray, you did!  I was beginning to wonder."
  1505. X            else
  1506. X                echo 'Uh-uh.  Time to get fancy...'
  1507. X                cd ..
  1508. X                echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
  1509. X                echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
  1510. X                chmod 755 cppstdin
  1511. X                cppstdin=`pwd`/cppstdin
  1512. X                cppminus='';
  1513. X                cd UU
  1514. X                $cppstdin <testcpp.c >testcpp.out 2>&1
  1515. X                if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1516. X                echo "Eureka!."
  1517. X                else
  1518. X                dflt=blurfl
  1519. X                $echo $n "No dice.  I can't find a C preprocessor.  Name one: $c"
  1520. X                rp='Name a C preprocessor:'
  1521. X                . myread
  1522. X                cppstdin="$ans"
  1523. X                $cppstdin <testcpp.c >testcpp.out 2>&1
  1524. X                if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1525. X                    echo "OK, that will do."
  1526. X                else
  1527. X                    echo "Sorry, I can't get that to work.  Go find one."
  1528. X                    exit 1
  1529. X                fi
  1530. X                fi
  1531. X            fi
  1532. X            fi
  1533. X        fi
  1534. X        fi
  1535. X    fi
  1536. X    fi
  1537. Xfi
  1538. Xrm -f testcpp.c testcpp.out
  1539. X
  1540. X: get C preprocessor symbols handy
  1541. Xecho " "
  1542. Xecho $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know
  1543. X$cat <<EOSS >Cppsym
  1544. X$startsh
  1545. Xcase "\$1" in
  1546. X-l) list=true
  1547. X    shift
  1548. X    ;;
  1549. Xesac
  1550. Xunknown=''
  1551. Xcase "\$list\$#" in
  1552. X1|2)
  1553. X    for sym do
  1554. X    if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  1555. X        exit 0
  1556. X    elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  1557. X        :
  1558. X    else
  1559. X        unknown="\$unknown \$sym"
  1560. X    fi
  1561. X    done
  1562. X    set X \$unknown
  1563. X    shift
  1564. X    ;;
  1565. Xesac
  1566. Xcase \$# in
  1567. X0) exit 1;;
  1568. Xesac
  1569. Xecho \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\
  1570. X#ifdef \1\\
  1571. Xexit 0; _ _ _ _\1\\     \1\\
  1572. X#endif\\
  1573. X/' >/tmp/Cppsym\$\$
  1574. Xecho exit 1 >>/tmp/Cppsym\$\$
  1575. X$cppstdin $cppminus </tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$
  1576. Xcase "\$list" in
  1577. Xtrue) awk 'NF > 5 {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;
  1578. X*)
  1579. X    sh /tmp/Cppsym2\$\$
  1580. X    status=\$?
  1581. X    ;;
  1582. Xesac
  1583. X$rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
  1584. Xexit \$status
  1585. XEOSS
  1586. Xchmod +x Cppsym
  1587. X$eunicefix Cppsym
  1588. Xecho "Your C preprocessor defines the following symbols:"
  1589. XCppsym -l $attrlist >Cppsym.true
  1590. Xcat Cppsym.true
  1591. Xrmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
  1592. X
  1593. X
  1594. X: see if we should include time.h, sys/time.h, or both
  1595. Xcat <<'EOM'
  1596. X  
  1597. XTesting to see if we should include <time.h>, <sys/time.h> or both.
  1598. XI'm now running the test program...
  1599. XEOM
  1600. X$cat >try.c <<'EOCP'
  1601. X#ifdef I_TIME
  1602. X#include <time.h>
  1603. X#endif
  1604. X#ifdef I_SYSTIME
  1605. X#ifdef SYSTIMEKERNEL
  1606. X#define KERNEL
  1607. X#endif
  1608. X#include <sys/time.h>
  1609. X#endif
  1610. Xmain()
  1611. X{
  1612. X    struct tm foo;
  1613. X#ifdef S_TIMEVAL
  1614. X    struct timeval bar;
  1615. X#endif
  1616. X    if (foo.tm_sec == foo.tm_sec)
  1617. X    exit(0);
  1618. X#ifdef S_TIMEVAL
  1619. X    if (bar.tv_sec == bar.tv_sec)
  1620. X    exit(0);
  1621. X#endif
  1622. X    exit(1);
  1623. X}
  1624. XEOCP
  1625. Xflags=''
  1626. Xfor s_timeval in '-DS_TIMEVAL' ''; do
  1627. X    for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
  1628. X    for i_time in '' '-DI_TIME'; do
  1629. X        for i_systime in '-DI_SYSTIME' ''; do
  1630. X        case "$flags" in
  1631. X        '') echo Trying $i_time $i_systime $d_systimekernel $s_timeval
  1632. X            if $cc $ccflags $i_time $i_systime $d_systimekernel $s_timeval \
  1633. X                try.c -o try >/dev/null 2>&1 ; then
  1634. X            set X $i_time $i_systime $d_systimekernel $s_timeval
  1635. X            shift
  1636. X            flags="$*"
  1637. X            echo Succeeded with $flags
  1638. X            fi
  1639. X            ;;
  1640. X        esac
  1641. X        done
  1642. X    done
  1643. X    done
  1644. Xdone
  1645. Xcase "$flags" in
  1646. X*SYSTIMEKERNEL*) d_systimekernel="$define";;
  1647. X*) d_systimekernel="$undef";;
  1648. Xesac
  1649. Xcase "$flags" in
  1650. X*I_TIME*) i_time="$define";;
  1651. X*) i_time="$undef";;
  1652. Xesac
  1653. Xcase "$flags" in
  1654. X*I_SYSTIME*) i_systime="$define";;
  1655. X*) i_systime="$undef";;
  1656. Xesac
  1657. X$rm -f try.c try
  1658. X
  1659. Xtimeincl=""
  1660. Xif $test "$i_time" = define ; then
  1661. X    timeincl="/usr/include/time.h"
  1662. Xfi
  1663. Xif $test "$i_systime" = define ; then
  1664. X    timeincl="$timeincl /usr/include/sys/time.h"
  1665. Xfi
  1666. X$cat $timeincl /dev/null | $cppstdin $cppminus > try.c 2>&1
  1667. Xif $contains 'tz_minuteswest' try.c > /dev/null 2>&1 ; then
  1668. X    echo "You have tz_minuteswest defined in $timeincl rather than timezone."
  1669. X    d_tz_min="$define"
  1670. Xelse
  1671. X    echo "You have timezone defined in $timeincl rather than tz_minuteswest."
  1672. X    d_tz_min="$undef"
  1673. Xfi
  1674. X$rm -f try.c
  1675. X
  1676. Xecho " "
  1677. Xecho "End of configuration questions."
  1678. Xecho " "
  1679. X
  1680. X: create config.sh file
  1681. Xecho " "
  1682. Xif test -d ../UU; then
  1683. X    cd ..
  1684. Xfi
  1685. Xecho "Creating config.sh..."
  1686. X$spitshell <<EOT >config.sh
  1687. X$startsh
  1688. X# config.sh
  1689. X# This file was produced by running the Configure script.
  1690. X
  1691. Xhost='$host'
  1692. Xport='$port'
  1693. Xd_threshloading='$d_threshloading'
  1694. Xd_autoscrap='$d_autoscrap'
  1695. Xd_superpod='$d_superpod'
  1696. Xd_multi_comm='$d_multi_comm'
  1697. Xmaxlogsize='100000'
  1698. Xgbpath='$gbpath'
  1699. Xdefine='$define'
  1700. XLog='$Log'
  1701. XHeader='$Header'
  1702. Xbin='$bin'
  1703. Xbyteorder='$byteorder'
  1704. Xcppstdin='$cppstdin'
  1705. Xcppminus='$cppminus'
  1706. Xd_getopt='$d_getopt'
  1707. Xd_havetlib='$d_havetlib'
  1708. Xtermlib='$termlib'
  1709. Xhostname='$hostname'
  1710. Xphostname='$phostname'
  1711. Xmydomain='$mydomain'
  1712. Xspore_success_rate='$spore_success_rate'
  1713. Xi_time='$i_time'
  1714. Xi_systime='$i_systime'
  1715. Xd_systimekernel='$d_systimekernel'
  1716. Xn='$n'
  1717. Xc='$c'
  1718. Xpackage='$package'
  1719. Xexpr='$expr'
  1720. Xsed='$sed'
  1721. Xecho='$echo'
  1722. Xcat='$cat'
  1723. Xrm='$rm'
  1724. Xmv='$mv'
  1725. Xcp='$cp'
  1726. Xtail='$tail'
  1727. Xtr='$tr'
  1728. Xmkdir='$mkdir'
  1729. Xsort='$sort'
  1730. Xuniq='$uniq'
  1731. Xgrep='$grep'
  1732. Xtrylist='$trylist'
  1733. Xtest='$test'
  1734. Xinews='$inews'
  1735. Xegrep='$egrep'
  1736. Xmore='$more'
  1737. Xpg='$pg'
  1738. XMcc='$Mcc'
  1739. Xvi='$vi'
  1740. Xcpp='$cpp'
  1741. Xperl='$perl'
  1742. Xemacs='$emacs'
  1743. Xls='$ls'
  1744. Xshar='$shar'
  1745. Xuname='$uname'
  1746. Xuuname='$uuname'
  1747. Xline='$line'
  1748. Xchgrp='$chgrp'
  1749. Xchmod='$chmod'
  1750. Xlint='$lint'
  1751. Xsleep='$sleep'
  1752. Xpr='$pr'
  1753. Xtar='$tar'
  1754. Xranlib='$ranlib'
  1755. Xar='$ar'
  1756. Xln='$ln'
  1757. Xlpr='$lpr'
  1758. Xlp='$lp'
  1759. Xtouch='$touch'
  1760. Xmake='$make'
  1761. Xdate='$date'
  1762. Xcsh='$csh'
  1763. Xc_date='$c_date'
  1764. Xd_cuserid='$d_cuserid'
  1765. Xd_gethname='$d_gethname'
  1766. Xd_index='$d_index'
  1767. Xd_mmdf='$d_mmdf'
  1768. Xd_newauto='$d_newauto'
  1769. Xd_networkorder='$d_networkorder'
  1770. Xd_pidcheck='$d_pidcheck'
  1771. Xd_ptem='$d_ptem'
  1772. Xd_setgid='$d_setgid'
  1773. Xd_strcspn='$d_strcspn'
  1774. Xd_strspn='$d_strspn'
  1775. Xd_strings='$d_strings'
  1776. Xd_pwdinsys='$d_pwdinsys'
  1777. Xstrings='$strings'
  1778. Xincludepath='$includepath'
  1779. Xlib='$lib'
  1780. Xlibc='$libc'
  1781. Xsplit='$split'
  1782. Xoptimize='$optimize'
  1783. Xccflags='$ccflags'
  1784. Xcppflags='$cppflags'
  1785. Xldflags='$ldflags'
  1786. Xcc='$cc'
  1787. Xlibs='$libs'
  1788. Xd_xenix='$d_xenix'
  1789. Xd_bsd='$d_bsd'
  1790. XCONFIG=true
  1791. XEOT
  1792. X
  1793. XCONFIG=true
  1794. X
  1795. Xecho " "
  1796. Xdflt=''
  1797. Xfastread=''
  1798. Xecho "If you didn't make any mistakes, then just type a carriage return here."
  1799. Xrp="If you need to edit config.sh, do it as a shell escape here:"
  1800. X$echo $n "$rp $c"
  1801. X. UU/myread
  1802. Xcase "$ans" in
  1803. X'') ;;
  1804. X*) : in case they cannot read
  1805. X    eval $ans;;
  1806. Xesac
  1807. X: if this fails, just run all the .SH files by hand
  1808. X. ./config.sh
  1809. X
  1810. Xecho " "
  1811. Xecho "Doing variable substitutions on .SH files..."
  1812. Xset x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
  1813. Xshift
  1814. Xcase $# in
  1815. X0) set x *.SH; shift;;
  1816. Xesac
  1817. Xif test ! -f $1; then
  1818. X    shift
  1819. Xfi
  1820. Xfor file in $*; do
  1821. X    case "$file" in
  1822. X    */*)
  1823. X    dir=`$expr X$file : 'X\(.*\)/'`
  1824. X    file=`$expr X$file : 'X.*/\(.*\)'`
  1825. X    (cd $dir && . $file)
  1826. X    ;;
  1827. X    *)
  1828. X    . $file
  1829. X    ;;
  1830. X    esac
  1831. Xdone
  1832. Xif test -f config.h.SH; then
  1833. X    if test ! -f config.h; then
  1834. X    : oops, they left it out of MANIFEST, probably, so do it anyway.
  1835. X    . config.h.SH
  1836. X    fi
  1837. Xfi
  1838. X
  1839. Xecho " "
  1840. Xecho "Now I am going to create links for the utilites files"
  1841. Xfor i in rand.c perm.c files.c shlmisc.c files_rw.c files_shl.c max.c
  1842. Xdo
  1843. X    echo "ln -s server/$i  utils/$i"
  1844. X    ln -s ../server/$i  utils/$i
  1845. Xdone
  1846. X
  1847. Xif test -f Makefile; then
  1848. X    echo " "
  1849. X    echo "Now you must run a make."
  1850. Xelse
  1851. X    echo "Done."
  1852. Xfi
  1853. X
  1854. X$rm -f kit*isdone
  1855. X: the following is currently useless
  1856. Xcd UU && $rm -f $rmlist
  1857. X: since this removes it all anyway
  1858. Xcd .. && $rm -rf UU
  1859. X: end of Configure
  1860. END_OF_FILE
  1861. if test 41100 -ne `wc -c <'Configure'`; then
  1862.     echo shar: \"'Configure'\" unpacked with wrong size!
  1863. fi
  1864. chmod +x 'Configure'
  1865. # end of 'Configure'
  1866. fi
  1867. if test -f 'hdrs/file.h' -a "${1}" != "-c" ; then 
  1868.   echo shar: Will not clobber existing file \"'hdrs/file.h'\"
  1869. else
  1870. echo shar: Extracting \"'hdrs/file.h'\" \(11720 characters\)
  1871. sed "s/^X//" >'hdrs/file.h' <<'END_OF_FILE'
  1872. X/*
  1873. X *     @(#)file.h    3.1    (ULTRIX)    4/20/90
  1874. X */
  1875. X
  1876. X
  1877. X/************************************************************************
  1878. X *                                    *
  1879. X *            Copyright (c) 1985 - 1989 by            *
  1880. X *        Digital Equipment Corporation, Maynard, MA        *
  1881. X *            All rights reserved.                *
  1882. X *                                    *
  1883. X *   This software is furnished under a license and may be used and    *
  1884. X *   copied  only  in accordance with the terms of such license and    *
  1885. X *   with the  inclusion  of  the  above  copyright  notice.   This    *
  1886. X *   software  or  any  other copies thereof may not be provided or    *
  1887. X *   otherwise made available to any other person.  No title to and    *
  1888. X *   ownership of the software is hereby transferred.            *
  1889. X *                                    *
  1890. X *   This software is  derived  from  software  received  from  the    *
  1891. X *   University    of   California,   Berkeley,   and   from   Bell    *
  1892. X *   Laboratories.  Use, duplication, or disclosure is  subject  to    *
  1893. X *   restrictions  under  license  agreements  with  University  of    *
  1894. X *   California and with AT&T.                        *
  1895. X *                                    *
  1896. X *   The information in this software is subject to change  without    *
  1897. X *   notice  and should not be construed as a commitment by Digital    *
  1898. X *   Equipment Corporation.                        *
  1899. X *                                    *
  1900. X *   Digital assumes no responsibility for the use  or  reliability    *
  1901. X *   of its software on equipment which is not supplied by Digital.    *
  1902. X *                                    *
  1903. X ************************************************************************/
  1904. X/************************************************************************
  1905. X *            Modification History                *
  1906. X *                                    *
  1907. X *    David L Ballenger, 28-Mar-1985                    *
  1908. X * 0001    Modify so that <fcntl.h> can simply include this file.  This    *
  1909. X *    file already contains all the definitions contained in        *
  1910. X *    <fcntl.h>, plus all the definitions that would need to be added    *
  1911. X *    to <fcntl.h> from the BRL version for System V emulation.  No    *
  1912. X *    sense in defining things in multiple places.            *
  1913. X *                                    *
  1914. X *    Larry Cohen, 4-April-1985                    *
  1915. X * 0002 Changes to support open block if in use capability        *
  1916. X *    FBLKINUSE                            *
  1917. X *    O_BLKINUSE - open blocks if IINUSE bit in inode is set        *
  1918. X *                                    *
  1919. X *    FBLKANDSET                            *
  1920. X *    O_BLKANDSET - open blocks if IINUSE bit in inode is set        *
  1921. X *            and sets after open succeeds.            *
  1922. X *                                    *
  1923. X *     Greg Depp 8-April-1985                        *
  1924. X * 0003 Added DTYPE_PORT to define System V IPC Named Pipe type        *
  1925. X *                                    *
  1926. X *    Stephen Reilly, 09-Sept-85                    *
  1927. X *     Modified to handle the new lockf code.                *
  1928. X *                                    *
  1929. X *    Paul Shaughnessy, 24-December-1985                *
  1930. X * 0004 Added syncronous write capability in open and fcntl system      *
  1931. X *    calls.                                *
  1932. X *                                    *
  1933. X *    11-Mar-86    Larry Palmer                     *
  1934. X *    Added flag to mark a file as being used by n-bufferring.        *
  1935. X *                                    *
  1936. X *    Tim Burke,    10-June-1986                    *
  1937. X * 0005 Inserted FTERMIO and O_TERMIO which tells if the program is to    *
  1938. X *    run as a System V program.  If so use a "RAW" type of default   *
  1939. X *    settings rather that the normal "COOKED" style on terminal     *
  1940. X *    line defaults.                            *
  1941. X *                                    *
  1942. X *    Tim Burke,    1-Dec-1987                    *
  1943. X * 0006 Inserted O_NONBLOCK which will be used to specify        *
  1944. X *    the POSIX no delay open and I/O.                *
  1945. X *                                    *
  1946. X *    Mark Parenti,    13-Jan-1988                    *
  1947. X * 0007    Moved define of R_OK, etc to KERNEL only as they are        *
  1948. X *    defined in <unistd.h> for user level.  Add O_ACCMODE POSIX    *
  1949. X *    definition and change types of some structure entries.        *
  1950. X *                                    *
  1951. X *     Mark Parenti,     15-Jan-1988                    *
  1952. X * 0008    Change definition of R_OK, etc. conditional on the previous    *
  1953. X *    declaration of R_OK, etc.  This allows existing programs    *
  1954. X *    which use file.h for the above definitions to continue to     *
  1955. X *    compile.                            *
  1956. X *    Paul Shaughnessy,    10-Feb-1988                *
  1957. X * 0009 Added a PIPE flag, and changed definition of POSIX NONBLOCK    *
  1958. X *    flag.                                *
  1959. X *                                    *
  1960. X *    22-Aug-88    Paul Shaughnessy                *
  1961. X *    Added FCNTLONLYSET define to aid in cleaning            *
  1962. X *    up F_GETFL and F_SETFL fcntl(2) requests.            *
  1963. X *                                    *
  1964. X *    Jon Reeves    30-May-1989                    *
  1965. X *    Added parens around O_ACCMODE definition; moved unruly comments *
  1966. X *    Changed protection variable name for ANSI compliance        *
  1967. X *                                    *
  1968. X *    Jon Reeves    11-Jul-1989                    *
  1969. X *    Added function declarations for X/Open compliance        *
  1970. X *                                    *
  1971. X *    Paul Shaughnessy    17-Jan-1990                *
  1972. X *    Added _POSIX_SOURCE and _XOPEN_SOURCE test macros        *
  1973. X *                                    *
  1974. X ************************************************************************/
  1975. X
  1976. X/*
  1977. X !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  1978. X ! WARNING !!!!!!!! This header file is described in XOPEN. To add macros !
  1979. X ! or defines or structures, you must inclose them as follows:            !
  1980. X ! #if !defined(_POSIX_SOURCE)                                            !
  1981. X ! #endif                                                                 !
  1982. X ! Failure to do so, will break compatibility with the standard.          !
  1983. X !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  1984. X*/
  1985. X
  1986. X/* Don't define things twice.  This protects from a source file which
  1987. X * includes both <fcntl.h> and <sys/file.h>
  1988. X */
  1989. X#ifndef _FCNTL_H_
  1990. X#define _FCNTL_H_
  1991. X
  1992. X#if !defined(KERNEL)
  1993. X#include <sys/types.h>
  1994. X#endif
  1995. X
  1996. X#ifdef KERNEL && !defined(_POSIX_SOURCE)
  1997. X/*
  1998. X * Descriptor table entry.
  1999. X * One for each kernel object.
  2000. X */
  2001. Xstruct    file {
  2002. X    int    f_flag;        /* see below */
  2003. X    short    f_type;        /* descriptor type */
  2004. X    short    f_count;    /* reference count */
  2005. X    short    f_msgcount;    /* references from message queue */
  2006. X    struct    fileops {
  2007. X/*        return    function    arguments        */
  2008. X        int    (*fo_rw)(    /* fp,uio,rw        */ );
  2009. X        int    (*fo_ioctl)(    /* fp,com,data,cred    */ );
  2010. X        int    (*fo_select)(    /* fp,which        */ );
  2011. X        int    (*fo_close)(    /* fp            */ );
  2012. X    } *f_ops;
  2013. X    caddr_t    f_data;        /* inode */
  2014. X    off_t    f_offset;
  2015. X    struct ucred *f_cred;
  2016. X    struct lock_t f_lk;
  2017. X};
  2018. X
  2019. Xextern  struct lock_t lk_file;
  2020. Xstruct    file *file, *fileNFILE;
  2021. Xint    nfile;
  2022. Xstruct    file *getf();
  2023. Xstruct    file *falloc();
  2024. X#endif    /* KERNEL && NOT _POSIX_SOURCE */
  2025. X
  2026. X/*
  2027. X * flags - also some values are used by fcntl(2)
  2028. X */
  2029. X#define    _FOPEN             (-1)
  2030. X#define    _FREAD            00001        /* descriptor read/receive'able */
  2031. X#define    _FWRITE            00002        /* descriptor write/send'able */
  2032. X#define    _FNDELAY        00004        /* no delay */
  2033. X#define    _FAPPEND        00010        /* append on each write */
  2034. X#define    _FMARK            00020        /* mark during gc() */
  2035. X#define    _FDEFER            00040        /* defer for next gc pass */
  2036. X#define    _FASYNC            00100        /* signal pgrp when data ready */
  2037. X#define    _FSHLOCK        00200        /* shared lock present */
  2038. X#define    _FEXLOCK        00400        /* exclusive lock present */
  2039. X#define    _FCREAT            01000        /* create if nonexistant */
  2040. X#define    _FTRUNC            02000        /* truncate to zero length */
  2041. X#define    _FEXCL            04000        /* error if already created */
  2042. X#define _FBLKINUSE           010000        /* block if "in use"    *0002*/
  2043. X#define _FBLKANDSET          (020000|_FBLKINUSE)/* block, test and set "in use" */
  2044. X#define _FSYNCRON          0100000        /* Write file syncronously *0004*/
  2045. X#define _FNBUF              0200000        /* file used for n-buffering */
  2046. X#define _FNBLOCK          0400000        /* POSIX no delay */
  2047. X#define _FTERMIO         01000000        /* termio style program */
  2048. X#define _FNOCTTY         02000000        /* termio no controlling tty */
  2049. X#if    !defined(_POSIX_SOURCE)
  2050. X#define    FOPEN        _FOPEN
  2051. X#define    FREAD        _FREAD
  2052. X#define    FWRITE        _FWRITE
  2053. X#define    FNDELAY        _FNDELAY
  2054. X#define    FAPPEND        _FAPPEND
  2055. X#define    FMARK        _FMARK
  2056. X#define    FDEFER        _FDEFER
  2057. X#define    FASYNC        _FASYNC
  2058. X#define    FSHLOCK        _FSHLOCK
  2059. X#define    FEXLOCK        _FEXLOCK
  2060. X#define    FCREAT        _FCREAT
  2061. X#define    FTRUNC        _FTRUNC
  2062. X#define    FEXCL        _FEXCL
  2063. X#define FBLKINUSE    _FBLKINUSE
  2064. X#define FBLKANDSET    _FBLKANDSET
  2065. X#define FSYNCRON    _FSYNCRON
  2066. X#define FNBUF        _FNBUF
  2067. X#define FNBLOCK        _FNBLOCK
  2068. X#define FTERMIO        _FTERMIO
  2069. X#define FNOCTTY        _FNOCTTY
  2070. X
  2071. X/* bits to save after open */
  2072. X#define    FMASK        0510113     /* 0004 */
  2073. X/*
  2074. X * FCNTLCANT are flags that are used by the kernel exclusively;
  2075. X * the user can't set them via fcntl(2).
  2076. X */
  2077. X#define    FCNTLCANT    (FREAD|FWRITE|FMARK|FDEFER|FSHLOCK|FEXLOCK|FNBUF)
  2078. X/*
  2079. X * FCNLTONLYSET are a set of flags that the user may set via a F_SETFL
  2080. X * fcntl(2) request.
  2081. X */
  2082. X#define FCNTLONLYSET    (FNDELAY|FAPPEND|FASYNC|FSYNCRON|FNBLOCK)
  2083. X
  2084. X#endif    /* NOT _POSIX_SOURCE */
  2085. X
  2086. X/*
  2087. X * Base, POSIX, and XOPEN defines....
  2088. X *
  2089. X * File access modes for open() and fcntl()
  2090. X */
  2091. X#define    O_RDONLY    000        /* open for reading */
  2092. X#define    O_RDWR        002        /* open for read & write */
  2093. X#define    O_WRONLY    001        /* open for writing */
  2094. X/*
  2095. X * File status flags for open() and fcntl()
  2096. X */
  2097. X#define    O_APPEND    _FAPPEND    /* append on each write */
  2098. X#define O_NONBLOCK    _FNBLOCK    /* POSIX non-blocking I/O */
  2099. X#if    !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE)
  2100. X#define O_SYNC        _FSYNCRON    /* system V synchronous write */
  2101. X#define    O_NDELAY    _FNDELAY    /* non-blocking open */
  2102. X#endif
  2103. X/*
  2104. X * Values for oflag used by open()
  2105. X */
  2106. X#define    O_CREAT        _FCREAT        /* open with file create */
  2107. X#define    O_EXCL        _FEXCL        /* error on create if file exists */
  2108. X#define O_NOCTTY    _FNOCTTY    /* POSIX don't give controlling tty */
  2109. X#define    O_TRUNC        _FTRUNC        /* open with truncation */
  2110. X#if    !defined(_POSIX_SOURCE)
  2111. X#define O_BLKINUSE      _FBLKINUSE    /* block if "in use"    *0002*/
  2112. X#define O_BLKANDSET     _FBLKANDSET    /* block, test and set "in use"    */
  2113. X#define O_FSYNC        _FSYNCRON    /* syncronous write *0004*/
  2114. X#define O_TERMIO    _FTERMIO    /* termio style program */
  2115. X#endif    /* NOT _POSIX_SOURCE */
  2116. X/*
  2117. X * mask for use with file access modes
  2118. X */
  2119. X#define    O_ACCMODE    (O_RDONLY|O_WRONLY|O_RDWR)
  2120. X/*
  2121. X * Values for cmd used by fcntl()
  2122. X */
  2123. X#define    F_DUPFD    0    /* Duplicate fildes */
  2124. X#define    F_GETFD    1    /* Get fildes flags */
  2125. X#define    F_SETFD    2    /* Set fildes flags */
  2126. X#define    F_GETFL    3    /* Get file flags */
  2127. X#define    F_SETFL    4    /* Set file flags */
  2128. X#define    F_GETLK    7    /* Get file lock */
  2129. X#define    F_SETLK    8    /* Set file lock */
  2130. X#define    F_SETLKW 9    /* Set file lock and wait */
  2131. X#if    !defined(_POSIX_SOURCE)
  2132. X#define    F_GETOWN 5    /* Get owner */
  2133. X#define F_SETOWN 6    /* Set owner */
  2134. X#define F_SETSYN 10    /* Set syncronous write *0004*/
  2135. X#define F_CLRSYN 11    /* Clear syncronous write *0004*/
  2136. X#endif    /* NOT _POSIX_SOURCE */
  2137. X/*
  2138. X * file descriptor flags used by fcntl(2)
  2139. X */
  2140. X#define    FD_CLOEXEC 1    /* Close file descriptor on exec() */
  2141. X
  2142. X/* file segment locking set data type - information passed to system by user */
  2143. X#if !defined(F_RDLCK) || defined(POSIX)
  2144. Xstruct flock {
  2145. X    short    l_type;
  2146. X    short    l_whence;
  2147. X    off_t    l_start;
  2148. X    off_t    l_len;        /* len = 0 means until end of file */
  2149. X#ifndef    POSIX
  2150. X    int    l_pid;
  2151. X#else
  2152. X    pid_t    l_pid;
  2153. X#endif
  2154. X};
  2155. X#endif /* NOT F_RDLCK or POSIX */
  2156. X/* 
  2157. X *    file segment locking types
  2158. X */
  2159. X#define    F_RDLCK    01    /* Read lock */
  2160. X#define    F_WRLCK    02    /* Write lock */
  2161. X#define    F_UNLCK    03    /* Remove lock(s) */
  2162. X
  2163. X#if    !defined(_POSIX_SOURCE)
  2164. X/*
  2165. X * Flock call.
  2166. X */
  2167. X#define    LOCK_SH        1    /* shared lock */
  2168. X#define    LOCK_EX        2    /* exclusive lock */
  2169. X#define    LOCK_NB        4    /* don't block when locking */
  2170. X#define    LOCK_UN        8    /* unlock */
  2171. X/*
  2172. X * Lseek call.
  2173. X */
  2174. X#define    L_SET        0    /* absolute offset */
  2175. X#define    L_INCR        1    /* relative to current offset */
  2176. X#define    L_XTND        2    /* relative to end of file */
  2177. X
  2178. X/*
  2179. X * Access call.
  2180. X * These are defined here for use by access() system call.  User level
  2181. X * programs should get these definitions from <unistd.h>. Included here
  2182. X * for historical reasons.
  2183. X */
  2184. X#ifndef R_OK
  2185. X#define    F_OK        0    /* does file exist */
  2186. X#define    X_OK        1    /* is it executable by caller */
  2187. X#define    W_OK        2    /* writable by caller */
  2188. X#define    R_OK        4    /* readable by caller */
  2189. X#endif /* R_OK */
  2190. X
  2191. X#ifdef KERNEL
  2192. X#define    GETF(fp, fd) { \
  2193. X    if ((unsigned)(fd) >= NOFILE || ((fp) = u.u_ofile[fd]) == NULL) { \
  2194. X        u.u_error = EBADF; \
  2195. X        return; \
  2196. X    } \
  2197. X}
  2198. X#define    DTYPE_INODE    1    /* file */
  2199. X#define    DTYPE_SOCKET    2    /* communications endpoint */
  2200. X#define    DTYPE_PORT    3    /* port (named pipe) 0003 */
  2201. X#define DTYPE_PIPE    4    /* pipe */
  2202. X#endif    /* KERNEL */
  2203. X
  2204. X#endif    /* NOT _POSIX_SOURCE */
  2205. X
  2206. X#if !defined(KERNEL) || defined(POSIX)
  2207. X/*    Function declarations for X/Open compliance    */
  2208. Xint    creat(), fcntl(), open();
  2209. X#endif
  2210. X
  2211. X#endif /* _FCNTL_H_ */
  2212. END_OF_FILE
  2213. if test 11720 -ne `wc -c <'hdrs/file.h'`; then
  2214.     echo shar: \"'hdrs/file.h'\" unpacked with wrong size!
  2215. fi
  2216. # end of 'hdrs/file.h'
  2217. fi
  2218. if test -f 'misc/welcome.txt' -a "${1}" != "-c" ; then 
  2219.   echo shar: Will not clobber existing file \"'misc/welcome.txt'\"
  2220. else
  2221. echo shar: Extracting \"'misc/welcome.txt'\" \(0 characters\)
  2222. sed "s/^X//" >'misc/welcome.txt' <<'END_OF_FILE'
  2223. END_OF_FILE
  2224. if test 0 -ne `wc -c <'misc/welcome.txt'`; then
  2225.     echo shar: \"'misc/welcome.txt'\" unpacked with wrong size!
  2226. fi
  2227. # end of 'misc/welcome.txt'
  2228. fi
  2229. echo shar: End of archive 4 \(of 21\).
  2230. cp /dev/null ark4isdone
  2231. MISSING=""
  2232. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ; do
  2233.     if test ! -f ark${I}isdone ; then
  2234.     MISSING="${MISSING} ${I}"
  2235.     fi
  2236. done
  2237. if test "${MISSING}" = "" ; then
  2238.     echo You have unpacked all 21 archives.
  2239.     echo "Now type './buildfiles.sh'"
  2240.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2241. else
  2242.     echo You still need to unpack the following archives:
  2243.     echo "        " ${MISSING}
  2244. fi
  2245. ##  End of shell archive.
  2246. exit 0
  2247.