home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / trn / part12 / Configure
Encoding:
Text File  |  1991-12-02  |  68.3 KB  |  3,155 lines

  1. #!/bin/sh
  2. #
  3. # This software is Copyright 1991 by Stan Barber. 
  4. #
  5. # Permission is hereby granted to copy, reproduce, redistribute or otherwise
  6. # use this software as long as: there is no monetary profit gained
  7. # specifically from the use or reproduction of this software, it is not
  8. # sold, rented, traded or otherwise marketed, and this copyright notice is
  9. # included prominently in any copy made. 
  10. #
  11. # The author make no claims as to the fitness or correctness of this software
  12. # for any use whatsoever, and it is provided as is. Any use of this software
  13. # is at the user's own risk. 
  14. #
  15. # If these # comments don't work, trim them.  Don't worry about the other
  16. # shell scripts, Configure will trim # comments from them for you.
  17. #
  18. # $Id: Configure,v 4.4.3.1 1991/11/22 04:11:10 davison Trn $
  19. #
  20. # $Log: Configure,v $
  21. # Revision 4.4.3.1  1991/11/22  04:11:10  davison
  22. # Trn Release 2.0
  23. # Revision 4.4.2.1  1991/12/01  18:05:42  sob
  24. # Patchlevel 2 changes
  25. #
  26. # Revision 4.4.1.1  1991/09/25  19:38:08  sob
  27. # various fixed
  28. #
  29. # Revision 4.4  1991/09/09  20:18:23  sob
  30. # release 4.4
  31. #
  32. #
  33.  
  34. # Yes, you may rip this off to use in other distribution packages.
  35.  
  36. CTRLA=`echo a | tr a '\001'`
  37.  
  38. bopt=''
  39. n=''
  40. c=''
  41. libc=''
  42. sharedclib=''
  43. eunicefix=''
  44. eunice=''
  45. cpp=''
  46. shsharp=''
  47. spitshell=''
  48. startsh=''
  49. test=''
  50. expr=''
  51. sed=''
  52. echo=''
  53. cat=''
  54. rm=''
  55. mv=''
  56. cp=''
  57. tail=''
  58. tr=''
  59. mkdir=''
  60. sort=''
  61. uniq=''
  62. inews=''
  63. grep=''
  64. egrep=''
  65. nidump=''
  66. ypmatch=''
  67. contains=''
  68. lib=''
  69. nametype=''
  70. cc=''
  71. cflags=''
  72. iandd=''
  73. rrninclude=''
  74. termlib=''
  75. jobslib=''
  76. ndirlib=''
  77. socketlib=''
  78. dirtype=''
  79. dirinc=''
  80. libndir=''
  81. usendir=''
  82. ndirc=''
  83. ndiro=''
  84. posix=''
  85. pager=''
  86. mailer=''
  87. internet=''
  88. rnbin=''
  89. filexp=''
  90. distlist=''
  91. Log=''
  92. Id=''
  93. sitename=''
  94. hostfile=''
  95. domain=''
  96. orgname=''
  97. isadmin=''
  98. newsadmin=''
  99. rnlib=''
  100. mtlib=''
  101. mansrc=''
  102. manext=''
  103. maildir=''
  104. spool=''
  105. serverspool=''
  106. active=''
  107. myactive=''
  108. activetimes=''
  109. mininact=''
  110. pref=''
  111. defeditor=''
  112. rootid=''
  113. mboxchar=''
  114. locpref=''
  115. orgpref=''
  116. citypref=''
  117. statepref=''
  118. cntrypref=''
  119. contpref=''
  120. strchr=''
  121. memcpy=''
  122. rename=''
  123. ftruncate=''
  124. usleep=''
  125. uselect=''
  126. strftime=''
  127. xnxlib=''
  128. chsize=''
  129. tzset=''
  130. threaddef=''
  131. selectdef=''
  132. threaddir=''
  133. syslog=''
  134. novoid=''
  135. novfork=''
  136. sunos4=''
  137. portable=''
  138. passnam=''
  139. berknam=''
  140. usgnam=''
  141. whoami=''
  142. termio=''
  143. termios=''
  144. fcntl=''
  145. ioctl=''
  146. ptem=''
  147. normsig=''
  148. sigblock=''
  149. sigret=''
  150. sighold=''
  151. getuidgid=''
  152. setvbuf=''
  153. setbuffer=''
  154. getcwd=''
  155. getwd=''
  156. havetlib=''
  157. getpwent=''
  158. gethostname=''
  159. douname=''
  160. phostname=''
  161. hostcmd=''
  162. norelay=''
  163. isrrn=''
  164. xthread=''
  165. rdchk=''
  166. serverfile=''
  167. ignoreorg=''
  168. NNTPSRC=''
  169. CONFIG=''
  170.  
  171. echo "Beginning of configuration questions for trn."
  172. : Eunice requires " " instead of "", can you believe it
  173. echo " "
  174.  
  175. : sanity checks
  176. PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/bsd'
  177. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
  178.  
  179. if test ! -t 0; then
  180.     echo "Type 'sh Configure', not 'sh <Configure'"
  181.     exit 1
  182. fi
  183.  
  184. (alias) >/dev/null 2>&1 && \
  185.     echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
  186.     echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
  187.  
  188.  
  189. : some greps do not return status, grrr.
  190. echo "grimblepritz" >grimble
  191. if grep blurfldyick grimble >/dev/null 2>&1 ; then
  192.     contains=contains
  193. else
  194.     if grep grimblepritz grimble >/dev/null 2>&1 ; then
  195.     contains=grep
  196.     else
  197.     contains=contains
  198.     fi
  199. fi
  200.  
  201. : the following should work in any shell
  202. case $contains in
  203. contains*)
  204.     echo " "
  205.     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  206.     cat >contains <<'EOSS'
  207. grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  208. EOSS
  209. chmod +x contains
  210. esac
  211.  
  212. : first determine how to suppress newline on echo command
  213. echo "Checking echo to see how to suppress newlines..."
  214. (echo "hi there\c" ; echo " ") >.echotmp
  215. if $contains c .echotmp >/dev/null 2>&1 ; then
  216.     echo "...using -n."
  217.     n='-n'
  218.     c=''
  219. else
  220.     cat <<'EOM'
  221. ...using \c
  222. EOM
  223.     n=''
  224.     c='\c'
  225. fi
  226. echo $n "Type carriage return to continue.  Your cursor should be here-->$c"
  227. read ans
  228. rm .echotmp
  229.  
  230. : now set up to do reads with possible shell escape
  231. : if this does not work on your machine, 1,$s/. myread/read ans/
  232. cat <<EOSC >myread
  233. ans='!'
  234. while expr "X\$ans" : "X!" >/dev/null; do
  235.     read ans
  236.     case "\$ans" in
  237.     !)
  238.     sh
  239.     echo " "
  240.     echo $n "Your answer: $c"
  241.     ;;
  242.     !*)
  243.     set \`expr "X\$ans" : "X!\(.*\)\$"\`
  244.     sh -c "\$*"
  245.     echo " "
  246.     echo $n "Your answer: $c"
  247.     ;;
  248.     esac
  249. done
  250. EOSC
  251.  
  252. : general instructions
  253. cat <<'EOH'
  254.  
  255. This installation shell script will examine your system and ask you questions
  256. to determine how trn and its auxiliary files should be installed.  If you
  257. get stuck on a question, you may use a ! shell escape to start a subshell or
  258. execute a command.  Many of the questions will have default answers in
  259. square brackets--typing carriage return will give you the default.
  260.  
  261. On some of the questions which ask for file or directory names you are
  262. allowed to use the ~name construct to specify the login directory belonging
  263. to "name", even if you don't have a shell which knows about that.  Questions
  264. where this is allowed will be marked "(~name ok)".
  265.  
  266. Much effort has been expended to ensure that this shell script will run
  267. on any Unix system.  If despite that it blows up on you, your best bet is to
  268. edit Configure and run it again.  (Trying to install trn without having run
  269. Configure is well nigh impossible.)  Also, tell Wayne Davison how he blew it
  270. (davison@borland.com).
  271.  
  272. This installation script affects things by doing direct variable substitutions
  273. on some of the files included in this kit. You may edit any of these files as
  274. the need arises after running this script.
  275.  
  276. EOH
  277. echo $n "[Type carriage return to continue] $c"
  278. . myread
  279. Xn=$n
  280. Xc=$c
  281. : get old answers, if there is a config file out there
  282. if test -f ./config.sh; then
  283.     echo " "
  284.     dflt=y
  285.     rp="I see a config.sh file.  Do you want to use it to set the defaults? [$dflt]"
  286.     echo $n "$rp $c"
  287.     . myread
  288.     case "$ans" in
  289.     n*) echo "OK, I'll ignore it.";;
  290.     *)  echo "Fetching default answers from your old config.sh file..."
  291.     tmp="$n"
  292.     ans="$c"
  293.         . ./config.sh
  294.     n="$tmp"
  295.     c="$ans"
  296.     ;;
  297.     esac
  298. fi
  299.  
  300. n=$Xn
  301. c=$Xc
  302.  
  303. : get list of predefined functions in a handy place
  304. echo " "
  305. if test -f /lib/libc.a; then
  306.     if test -f /usr/lib/libc.a ; then
  307.     echo "Found two C libraries:  /lib/libc.a and /usr/lib/libc.a"
  308.     if test -d /usr/convex ; then
  309.         echo "Ah!  This is ConvexOS!  We'll use the one in /usr/lib."
  310.         libc=/usr/lib/libc.a
  311.     else
  312.         echo "Hmmm...we'll use the more normal of the two:  /lib/libc.a"
  313.         libc=/lib/libc.a
  314.     fi
  315.     else
  316.     echo "Your C library is in /lib/libc.a.  You're normal."
  317.     if test -f /lib/libc_s.a; then
  318.         echo "You also have AT&T shared libraries, we'll use those."
  319.         sharedclib=-lc_s
  320.     fi
  321.     libc=/lib/libc.a
  322.     fi
  323. else
  324.   if test -f /lib/libc; then
  325.     echo "Your C library is in /lib/libc.  This might be Domain/OS."
  326.     libc=/lib/libc
  327.   else
  328.     if test -f /lib/Llibc.a; then
  329.     echo "Your C library is in /lib/Llibc.a.  I smell Xenix!"
  330.     libc=/lib/Llibc.a
  331.     else
  332.     if test -f /usr/lib/libc.a; then
  333.         echo "Your C library is in /usr/lib/libc.a, of all places."
  334.         libc=/usr/lib/libc.a
  335.         if test -f /usr/lib/libc_s.a; then
  336.         echo "You also have AT&T shared libraries, we'll use those."
  337.         sharedclib=-lc_s
  338.         fi
  339.     else
  340.         if test -f /lib/clib; then
  341.         echo "Your C library is in /lib/clib.  How nonstandard, must be Apollo."
  342.         libc=/lib/clib
  343.         else
  344.         if test -f "$libc"; then
  345.             echo "Your C library is in $libc, like you said before."
  346.         else
  347.             cat <<'EOM'
  348.  
  349. I can't seem to find your C library.  I've looked for /lib/libc.a and
  350. /usr/lib/libc.a, but neither of those are there. Perhaps you can find
  351. out by reading `man 3 intro' if you have the 'man' facility installed.
  352.  
  353. EOM
  354.             echo $n "What is the full name of your C library? $c"
  355.             . myread
  356.             libc="$ans"
  357.         fi
  358.         fi
  359.     fi
  360.     fi
  361.   fi
  362. fi
  363.  
  364. if test -d /usr/bsd43 -o -d /usr/bsd ; then
  365.     echo " "
  366.     echo "It appears that you might be running on a RISC/os box."
  367.     echo $n "Should I pass the -B option to nm [y]? $c"
  368.     . myread
  369.     case $ans in
  370.     n*|f*) bopt=''   ;;
  371.     *)     bopt='-B' ;;
  372.     esac
  373. fi
  374. if test -f /bin/smit ; then
  375.     echo " "
  376.     echo "It appears that you might be running on an IBM RS/6000 box."
  377.     echo "We'll be using 'nm -B' to get the symbol lists."
  378.     bopt='-B'
  379. fi
  380.  
  381. echo " "
  382. echo $n "Extracting names from $libc for later perusal...$c"
  383. nm $bopt $libc > nm.list 2>/dev/null
  384. sed -n -e 's/^.* T _//p' -e 's/^.* T //p' < nm.list > libc.list
  385. if $contains '^printf$' libc.list >/dev/null 2>&1; then
  386.     echo "done"
  387. else
  388.     sed -n -e 's/^.* D _//p' -e 's/^.* D //p' < nm.list > libc.list
  389.     if $contains '^printf$' libc.list >/dev/null 2>&1; then
  390.     echo "done"
  391.     else
  392.      $contains .text nm.list | grep -v static | awk '{ print $1 }' > libc.list
  393.         if $contains '^printf$' libc.list >/dev/null 2>&1; then
  394.         echo "done"
  395.         else
  396.          echo " "
  397.          echo "nm didn't seem to work right."
  398.          echo "Trying ar instead..."
  399.          if ar t $libc | sed -e 's/\.o$//' > libc.list; then
  400.         echo "Ok."
  401.          else
  402.         echo "That didn't work either.  Giving up."
  403.         exit 1
  404.          fi
  405.      fi
  406.     fi
  407. fi
  408. rm nm.list
  409. : make some quick guesses about what we are up against
  410. echo " "
  411. echo $n "Hmm...  $c"
  412. if $contains '^sigvec$' libc.list >/dev/null 2>&1 ; then
  413.     echo "Looks kind of like a BSD system, but we'll see..."
  414.     echo exit 0 >bsd
  415.     echo exit 1 >usg
  416.     echo exit 1 >v7
  417. else
  418.     if $contains '^dup2$' libc.list >/dev/null 2>&1 ; then
  419.     echo "Looks sort of like a V7 system, but we'll see..."
  420.     echo exit 1 >bsd
  421.     echo exit 1 >usg
  422.     echo exit 0 >v7
  423.     else
  424.         echo "Looks kind of like a USG system, but we'll see..."
  425.         echo exit 1 >bsd
  426.         echo exit 0 >usg
  427.         echo exit 1 >v7
  428.     fi
  429. fi
  430. :
  431. if test -f /etc/inittab; then
  432.     echo "You have an inittab file. You must be a USG system!"
  433.     echo exit 1 >bsd
  434.     echo exit 0 >usg
  435.     echo exit 1 >v7
  436. fi
  437. if $contains '^vmssystem$' libc.list >/dev/null 2>&1 ; then
  438.     cat <<'EOI'
  439. There is, however, a strange, musty smell in the air that reminds me of
  440. something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  441. EOI
  442.     echo "exit 0" >eunice
  443.     eunicefix=unixtovms
  444.     eunice=define
  445. : it so happens the Eunice I know will not run shell scripts in Unix format
  446. else
  447.     echo " "
  448.     echo "Congratulations.  You aren't running Eunice."
  449.     eunicefix=':'
  450.     eunice=undef
  451.     echo "exit 1" >eunice
  452. fi
  453. chmod +x bsd usg v7 eunice
  454. $eunicefix bsd usg v7 eunice
  455. : see how we invoke the C preprocessor
  456. echo " "
  457. echo "Checking to see how your C preprocessor is invoked..."
  458. cat <<'EOT' >testcpp.c
  459. #define ABC abc
  460. #define XYZ xyz
  461. ABC+XYZ
  462. EOT
  463. echo 'Maybe "cc -E" will work...'
  464. cc -E testcpp.c >testcpp.out 2>&1
  465. if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  466.     echo "Yup, it does."
  467.     cpp='cc -E'
  468. else
  469.     echo 'Nope...maybe "cc -P" will work...'
  470.     cc -P testcpp.c >testcpp.out 2>&1
  471.     if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  472.     echo "Yup, that does."
  473.     cpp='cc -P'
  474.     else
  475.     echo 'Nixed again...maybe "/lib/cpp" will work...'
  476.     /lib/cpp testcpp.c >testcpp.out 2>&1
  477.     if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  478.         echo "Hooray, it works!  I was beginning to wonder."
  479.         cpp='/lib/cpp'
  480.     else
  481.         if $contains 'abc +xyz' testcpp.out >/dev/null 2>&1 ; then
  482.         echo "Found it!  You're on a NeXT, aren't you?"
  483.         cpp='/lib/cpp'
  484.         else
  485.         echo 'Hmm...maybe you already told me...'
  486.         case "$cpp" in
  487.         '') ;;
  488.         *) $cpp testcpp.c >testcpp.out 2>&1;;
  489.         esac
  490.         if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  491.             echo "Hooray, you did!  I was beginning to wonder."
  492.         else
  493.             echo "Nope. I can't find a C preprocessor.  Name one: $c"
  494.             . myread
  495.             cpp="$ans"
  496.             $cpp testcpp.c >testcpp.out 2>&1
  497.             if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  498.             echo "OK, that will do."
  499.             else
  500.             echo "Sorry, I can't get that to work.  Go find one."
  501.             exit 1
  502.             fi
  503.         fi
  504.         fi
  505.     fi
  506.     fi
  507. fi
  508. rm -f testcpp.c testcpp.out
  509. : check for pdp11
  510. echo " "
  511. cat <<'EOT' >pdp11.c
  512. #ifdef pdp11
  513. exit 0
  514. #else
  515. exit 1
  516. #endif
  517. EOT
  518. $cpp pdp11.c | grep exit >pdp11
  519. chmod +x pdp11
  520. $eunicefix pdp11
  521. rm pdp11.c
  522. if pdp11; then
  523.     echo "This looks like a pdp11 to me."
  524. fi
  525. : check for ultrix
  526. cat <<'EOT' >ultrix.c
  527. #ifdef ultrix
  528. exit 0
  529. #else
  530. exit 1
  531. #endif
  532. EOT
  533. $cpp ultrix.c | grep exit >ultrix
  534. chmod +x ultrix
  535. $eunicefix ultrix
  536. rm ultrix.c
  537. if ultrix; then
  538.     echo "Running ultrix, eh?"
  539. fi
  540.  
  541. : check for uts
  542. cat <<'EOT' >uts.c
  543. #ifdef uts
  544. exit 0
  545. #else
  546. exit 1
  547. #endif
  548. EOT
  549. $cpp uts.c | grep exit >uts
  550. chmod +x uts
  551. $eunicefix uts
  552. rm uts.c
  553. if uts; then
  554.     echo "This appears to be some kind of System370-type system running UTS."
  555.     socketlib=-lsocket
  556. fi
  557.  
  558. : check for sun 4.0
  559. sunos4=undef
  560. cat <<'EOT' >sun.c
  561. #ifdef sun
  562. exit 0
  563. #else
  564. exit 1
  565. #endif
  566. EOT
  567. $cpp sun.c | grep exit >sun
  568. chmod +x sun
  569. $eunicefix sun
  570. rm sun.c
  571. if sun; then
  572.     echo "This looks like a sun to me."
  573.     if test -f /etc/ld.so.cache ; then
  574.     echo "And it appears you are running SunOS 4.0 or greater."
  575.         sunos4=define
  576.     socketlib=
  577.     rrninclude=
  578.      fi
  579. fi
  580. : check for hp-ux
  581. cat <<'EOT' >hp-ux.c
  582. #ifdef hpux
  583. exit 0
  584. #else
  585. exit 1
  586. #endif
  587. EOT
  588. $cpp hp-ux.c | grep exit >hp-ux
  589. chmod +x hp-ux
  590. $eunicefix hp-ux
  591. rm hp-ux.c
  592. if hp-ux; then
  593.     echo "Hewlett-Packard must have built this..."
  594.     socketlib=-lbsdipc
  595. fi
  596.  
  597. : check for mips
  598. cat <<'EOT' >mips.c
  599. #if defined(mips) && !defined(ultrix)
  600. exit 0
  601. #else
  602. exit 1
  603. #endif
  604. EOT
  605. $cpp mips.c | grep exit >mips
  606. chmod +x mips
  607. $eunicefix mips
  608. rm mips.c
  609. if mips; then
  610.     echo "Looks like mips RISC/os..."
  611.     rrninclude="-DUSG -I/usr/include/bsd"
  612.     socketlib=-lbsd
  613. fi
  614. : check for stardent
  615. cat <<'EOT' >stardent.c
  616. #if defined(stardent) || defined(ardent) || defined (steller)
  617. exit 0
  618. #else
  619. exit 1
  620. #endif
  621. EOT
  622. $cpp stardent.c | grep exit >stardent
  623. chmod +x stardent
  624. $eunicefix stardent
  625. rm stardent.c
  626. if stardent; then
  627.     echo "This appears to be a Stardent/Steller/Ardent..."
  628.     rrninclude="-DUSG"
  629.     socketlib=
  630. fi
  631. : check for sgi
  632. cat <<'EOT' >sgi.c
  633. #ifdef sgi
  634. exit 0
  635. #else
  636. exit 1
  637. #endif
  638. EOT
  639. $cpp sgi.c | grep exit >sgi
  640. chmod +x sgi
  641. $eunicefix sgi
  642. rm sgi.c
  643. if sgi; then
  644.     echo "Silicon Graphics must have built this..."
  645.     if test -f /usr/lib/libsun.a ; then
  646.         socketlib=-lsun
  647.     fi
  648. fi
  649.  
  650. : check for XENIX
  651. cat <<'EOT' >xenix
  652. test -f /xenix; exit $?
  653. EOT
  654. chmod +x xenix
  655. $eunicefix xenix
  656. if xenix; then
  657.     echo "Kinda looks like XENIX....hmmm"
  658.     rrninclude="-DUSG -DLAI_TCP"
  659.     socketlib=-lsocket
  660.     rdchk=define
  661.     dirtype=dirent
  662.     dirinc="<dirent.h>"
  663. else
  664.     rdchk=undef
  665. fi
  666.  
  667. : check for Pyramid OSx
  668. cat <<'EOT' >pyr.c
  669. #ifdef pyr
  670. exit 0
  671. #else
  672. exit 1
  673. #endif
  674. EOT
  675. $cpp pyr.c | grep exit >pyr
  676. chmod +x pyr
  677. $eunicefix pyr
  678. rm pyr.c
  679. if pyr; then
  680.     echo "This looks like a Pyramid to me."
  681. fi
  682.  
  683. : check for NeXT
  684. cat <<'EOT' >next.c
  685. #ifdef NeXT
  686. exit 0
  687. #else
  688. exit 1
  689. #endif
  690. EOT
  691. $cpp next.c | grep exit >next
  692. chmod +x next
  693. $eunicefix next
  694. rm next.c
  695. if next; then
  696.     echo "My, you really ARE on a NeXT."
  697.     addcflags=' -bsd'
  698.     test=test
  699. else
  700.     addcflags=''
  701. fi
  702.  
  703. if bsd; then
  704.     getuidgid=define
  705. else
  706.     getuidgid=undef
  707. fi
  708.  
  709. cat <<'EOT' > s5uniq
  710. if test -f /bin/uname
  711. then
  712.     case `uname -r -m` in
  713.     "5.3 vax-"*)
  714.         if [ -f /usr/lib/libnet.a \
  715.           -a -f /usr/lib/libhdb.a \
  716.           -a -f /usr/lib/libbbn.a \
  717.           -a -f /usr/lib/libstr.a ]
  718.         then
  719.             exit 0
  720.         fi;;
  721.     esac
  722. fi
  723. exit 1
  724. EOT
  725. chmod +x s5uniq
  726. if s5uniq; then
  727.     echo "This looks like Uniq.  What a pity."
  728.     socketlib="-lnet -lhdb -lbbn -lstr"
  729.     rrninclude="-DR_UNIQ -DUSG"
  730.     # -DR_UNIQ and -DUSG are needed for ~nntp/common/clientlib.c
  731. fi
  732. : check for posix
  733. posix=''
  734. if usg; then
  735.     if test -f /lib/libcposix.a; then
  736.     echo "Your version of System V supports POSIX compatibility."
  737.     echo "We'll make use of it!"
  738.     posix=' -Xp'
  739.     fi
  740. fi
  741.  
  742.  
  743. : see if sh knows # comments
  744. echo " "
  745. echo "Checking your sh to see if it knows about # comments..."
  746. if sh -c '#' >/dev/null 2>&1 ; then
  747.     echo "Your sh handles # comments correctly."
  748.     shsharp=true
  749.     spitshell=cat
  750.     echo " "
  751.     echo "Okay, let's see if #! works on this system..."
  752.     echo "#!/bin/echo hi" > try
  753.     $eunicefix try
  754.     chmod +x try
  755.     try > today
  756.     if test -s today; then
  757.     echo "It does."
  758.     sharpbang='#!'
  759.     else
  760.     echo "#! /bin/echo hi" > try
  761.     $eunicefix try
  762.     chmod +x try
  763.     try > today
  764.     if test -s today; then
  765.         echo "It does."
  766.         sharpbang='#! '
  767.     else
  768.         echo "It doesn't."
  769.         sharpbang=': use '
  770.     fi
  771.     fi
  772. else
  773.     echo "Your sh doesn't grok # comments--I will strip them later on."
  774.     shsharp=false
  775.     echo "exec grep -v '^#'" >spitshell
  776.     chmod +x spitshell
  777.     $eunicefix spitshell
  778.     spitshell=`pwd`/spitshell
  779.     echo "I presume that if # doesn't work, #! won't work either!"
  780.     sharpbang=': use '
  781. fi
  782.  
  783. : figure out how to guarantee sh startup
  784. echo " "
  785. echo "Checking out how to guarantee sh startup..."
  786. startsh=$sharpbang'/bin/sh'
  787. echo "Let's see if '$startsh' works..."
  788. cat >try <<EOSS
  789. $startsh
  790. set abc
  791. test "$?abc" != 1
  792. EOSS
  793.  
  794. chmod +x try
  795. $eunicefix try
  796. if try; then
  797.     echo "Yup, it does."
  798. else
  799.     echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  800. fi
  801. rm -f try today
  802.  
  803. : find out where common programs are
  804. echo " "
  805. echo "Locating common programs..."
  806. pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib /usr/etc /usr/5bin /usr/bsd /usr/bsd43"
  807. cat <<EOSC >loc
  808. $startsh
  809. thing=\$1
  810. shift
  811. dflt=\$1
  812. shift
  813. for dir in \$*; do
  814.     case "\$thing" in
  815.     .)
  816.     if test -d \$dir/\$thing; then
  817.         echo \$dir
  818.         exit 0
  819.     fi
  820.     ;;
  821.     *)
  822.     if test -f \$dir/\$thing; then
  823.         echo \$dir/\$thing
  824.         exit 0
  825.     fi
  826.     ;;
  827.     esac
  828. done
  829. echo \$dflt
  830. exit 1
  831. EOSC
  832. chmod +x loc
  833. $eunicefix loc
  834. loclist="expr sed echo cat rm mv cp tail tr mkdir sort uniq grep"
  835. trylist="test inews egrep more pg Mcc nidump ypmatch"
  836. for file in $loclist; do
  837.     xxx=`loc $file $file $pth`
  838.     eval $file=$xxx
  839.     case "$xxx" in
  840.     /*)
  841.     echo $file is in $xxx.
  842.     ;;
  843.     *)
  844.     echo "I don't know where $file is.  I hope it's in everyone's PATH."
  845.     ;;
  846.     esac
  847. done
  848. echo " "
  849. echo "Don't worry if any of the following aren't found..."
  850. for file in $trylist; do
  851.     xxx=`loc $file $file $pth`
  852.     eval $file=$xxx
  853.     case "$xxx" in
  854.     /*)
  855.     echo $file is in $xxx.
  856.     ;;
  857.     *)
  858.     echo "I don't see $file out there, offhand."
  859.     ;;
  860.     esac
  861. done
  862. case $egrep in
  863. egrep)
  864.     echo "Substituting grep for egrep."
  865.     egrep=$grep
  866.     ;;
  867. esac
  868. case $test in
  869. test)
  870.     echo "Hopefully test is built into your sh."
  871.     ;;
  872. /bin/test)
  873.     echo " "
  874.     echo $n 'Is your "test" built into sh? [n] (OK to guess) '"$c"
  875.     . myread
  876.     case $ans in
  877.     y*) test=test ;;
  878.     esac
  879.     ;;
  880. *)
  881.     test=test
  882.     ;;
  883. esac
  884. case $echo in
  885. echo)
  886.     echo "Hopefully echo is built into your sh."
  887.     ;;
  888. /bin/echo)
  889.     echo " "
  890.     echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
  891.     $echo $n "hi there$c" >foo1
  892.     echo $n "hi there$c" >foo2
  893.     if cmp foo1 foo2 >/dev/null 2>&1; then
  894.     echo "They are compatible.  In fact, they may be identical."
  895.     else
  896.     echo "They are not compatible--the echo builtin will be used."
  897.     echo=echo
  898.     fi
  899.     $rm -f foo1 foo2
  900.     ;;
  901. *)
  902.     echo=echo
  903.     ;;
  904. esac
  905. $echo " "
  906. : test yp
  907. case $ypmatch in
  908. ypmatch)
  909.     $echo "I don't see ypmatch out there, so YP is not available. We'll search the"
  910.     $echo "passwd file the old fashioned way!"
  911.     ;;
  912. *)
  913.     $ypmatch 513/tcp services > /dev/null 2>/dev/null
  914.     status=$?
  915.     if $test $status  -ne 0 ; then
  916.     $echo "YP installed, but not operational. We won't use it."
  917.     ypmatch=""
  918.     else
  919.         $echo "YP installed and operational."
  920.     fi
  921.     
  922.     ;;
  923. esac
  924. if $test "$nidump" = "nidump"; then
  925.     nidump=""
  926. fi
  927. if $test "$ypmatch" = "ypmatch"; then
  928.     ypmatch=""
  929. fi
  930.  
  931. : decide how portable to be
  932. case "$portable" in
  933. define) dflt=y;;
  934. *)    dflt=n;;
  935. esac
  936. $cat <<'EOH'
  937.  
  938. I can set things up so that your shell scripts and binaries are more portable,
  939. at what may be a noticeable cost in performance.  In particular, if you
  940. ask to be portable, the following happens:
  941.  
  942.      1) shell scripts will rely on the PATH variable rather than using
  943.     the paths derived above.
  944.      2) ~username interpretations will be done at run time rather than
  945.     by Configure.
  946.      3) the system name will be determined at run time, if at all possible.
  947.  
  948. EOH
  949. $echo $n "Do you expect to run these scripts and binaries on multiple machines? [$dflt] $c"
  950. . myread
  951. case $ans in
  952. '') ans=$dflt;;
  953. esac
  954. case $ans in
  955.     y*) portable=define
  956.     for file in $loclist; do
  957.         eval $file=$file
  958.     done
  959.     ;;
  960.     *)  portable=undef ;;
  961. esac
  962.  
  963. : set up shell script to do ~ expansion
  964. cat >filexp <<EOSS
  965. $startsh
  966. : expand filename
  967. case \$1 in
  968. ~/*|~)
  969.     $echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  970.     ;;
  971. ~*)
  972.     if $test -f /bin/csh; then
  973.     /bin/csh -f -c "glob \$1"
  974.     $echo ""
  975.     else
  976.     name=\`$expr x\$1 : '..\([^/]*\)'\`
  977.     if $test "$ypmatch" != ""; then
  978.          dir=\`$ypmatch \$name passwd 2>/dev/null | $sed "s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/"'\`
  979.     elif $test "$nidump" != ""; then
  980.         dir=\`$nidump passwd / | $sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}'\`
  981.     fi
  982.     if $test "\$dir" = ""; then
  983.         dir=\`$sed </etc/passwd -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}'\`
  984.     fi
  985.     if $test ! -d "\$dir"; then
  986.         me=\`basename \$0\`
  987.         $echo "\$me: can't locate home directory for: \$name" >&2
  988.         exit 1
  989.     fi
  990.     case \$1 in
  991.     */*)
  992.         $echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  993.         ;;
  994.     *)
  995.         $echo \$dir
  996.         ;;
  997.     esac
  998.     fi
  999.     ;;
  1000. *)
  1001.     $echo \$1
  1002.     ;;
  1003. esac
  1004. EOSS
  1005. chmod +x filexp
  1006. $eunicefix filexp
  1007.  
  1008. : try to deal with domains
  1009. $cat << 'EOH'
  1010.  
  1011. Please enter your domain name.  This will be used in conjunction with the
  1012. site name for return addresses on news articles and mail.  If you use the
  1013. 4.3ism of having your domain in your hostname, all the posting programs
  1014. will figure this out on the fly, so don't worry.
  1015.  
  1016. Examples of some valid domains:
  1017.     berkeley.edu
  1018.     nasa.gov
  1019. Example of an invalid domain in common use:
  1020.     uucp
  1021. EOH
  1022.  
  1023. case "$domain" in
  1024. '') dflt="uucp";;
  1025. *)  dflt="$domain" ;;
  1026. esac
  1027. $echo $n "Your domain: [$dflt] $c"
  1028. . myread
  1029. case "$ans" in
  1030. '') domain="$dflt";;
  1031. *)  domain="$ans" ;;
  1032. esac
  1033.  
  1034. : now get the site name
  1035. $echo " "
  1036. $echo "Figuring out site name..."
  1037. $echo 'Maybe "hostname" will work...'
  1038. if ans=`sh -c hostname 2>&1` ; then
  1039.     thissite=$ans
  1040.     hostcmd=hostname
  1041. else
  1042.     $echo 'No, maybe "uuname -l" will work...'
  1043.     if ans=`sh -c 'uuname -l' 2>&1` ; then
  1044.     thissite=$ans
  1045.     hostcmd='uuname -l'
  1046.     else
  1047.     $echo 'Strange.  Maybe "uname -n" will work...'
  1048.     if ans=`sh -c 'uname -n' 2>&1` ; then
  1049.         thissite=$ans
  1050.         hostcmd='uname -n'
  1051.     else
  1052.         $echo 'Oh well, maybe I can mine it out of whoami.h...'
  1053.         if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
  1054.         thissite=`$echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
  1055.         hostcmd="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
  1056.         else
  1057.         case "$sitename" in
  1058.         '') $echo "Does this machine have an identity crisis or something?"
  1059.             hostcmd=''
  1060.             ;;
  1061.         *)  $echo "Well, you said $sitename before..."
  1062.             thissite="$sitename"
  1063.             ;;
  1064.         esac
  1065.         fi
  1066.     fi
  1067.     fi
  1068. fi
  1069. : you do not want to know about this
  1070. set $thissite
  1071. thissite=$1
  1072.  
  1073. : translate upper to lower case. This is mostly to help UUCP work right.
  1074. case $thissite in
  1075.     *[A-Z]*)
  1076.     thissite=`$echo $thissite | tr '[A-Z]' '[a-z]'`
  1077.     $echo "(Normalizing case in your site name)"
  1078.     ;;
  1079. esac
  1080.  
  1081. : verify site name and allow them to override it
  1082. if $test "$thissite" ; then
  1083.     $echo 'Your site name appears to be "'$thissite'".'
  1084. else
  1085.     thissite='unknown'
  1086. fi
  1087. case "$hostfile" in
  1088. /*) dflt="$hostfile" ;;
  1089. *)  case "$sitename" in
  1090.     '') dflt="$thissite" ;;
  1091.     *)  dflt="$sitename" ;;
  1092.     esac
  1093. esac
  1094. $cat <<'EOM'
  1095.  
  1096. In some cases it is not desirable to use the actual site name in your return
  1097. addresses (if, for example, all mail gets routed first to one site).  In this
  1098. case trn allows you to either hard-wire a site name or read the site name from
  1099. a file.  To indicate a file, start the name with a slash (e.g. /etc/sitename).
  1100. To use just your domain name, re-enter it here.  A period-less site name will
  1101. automatically get your domain name added to it.
  1102.  
  1103. EOM
  1104. while $test $dflt ; do
  1105.     $echo $n "What site name goes in return addresses? [$dflt] $c"
  1106.     . myread 
  1107.     case $ans in
  1108.     '') ans=$dflt;;
  1109.     esac
  1110.     case $ans in
  1111.     /*)
  1112.     if $test -f $ans ; then
  1113.         hostfile="$ans"
  1114.         hostcmd="$cat $ans"
  1115.         sitename=`$hostcmd`
  1116.         $echo "Trn will read the site name from $ans:  $sitename."
  1117.         dflt=''
  1118.     else
  1119.         $echo "Unable to locate $ans."
  1120.     fi
  1121.     ;;
  1122.     *)  hostfile=''
  1123.     if $test "X$thissite" = "X$ans" ; then
  1124.         sitename="$thissite"
  1125.         $echo "Using the site name derived by $hostcmd:  $sitename."
  1126.     else
  1127.         hostcmd=''
  1128.         sitename="$ans"
  1129.         $echo "Using a hard-wired site name:  $sitename."
  1130.     fi
  1131.     dflt=''
  1132.     ;;
  1133.     esac
  1134. done
  1135.  
  1136. if $test $portable = "undef" ; then
  1137.     case $sitename in
  1138.     *.*)    ;;
  1139.     *)    sitename=$sitename.$domain
  1140.         ;;
  1141.     esac
  1142. fi
  1143.  
  1144. : get organization name
  1145. longshots='/usr/src/new /usr/src/local /usr/local/src'
  1146. case "$orgname" in
  1147. '') if xxx=`loc news/src/defs.h x $longshots`; then
  1148.     dflt=`$sed -n 's/^.*MYORG[     ]*"\(.*\)".*$/\1/p' $xxx`
  1149.     else
  1150.     dflt='no default'
  1151.     fi
  1152.     ;;
  1153. *)  dflt="$orgname";;
  1154. esac
  1155. $cat << 'EOH'
  1156.  
  1157. Please type the name of your organization as you want it to appear on the
  1158. Organization line of outgoing articles.  (It's nice if this also specifies
  1159. your location.  Your city name is probably sufficient if well known.)
  1160. For example:
  1161.  
  1162.     University of Southern North Dakota, Hoople
  1163.  
  1164. You may also put the name of a file, as long as it begins with a slash.
  1165. For example:
  1166.  
  1167.     /etc/organization
  1168.  
  1169. EOH
  1170. orgname="no default"
  1171. while test "X$orgname" = "Xno default"; do
  1172.     $echo $n "Organization: [$dflt] $c"
  1173.     . myread
  1174.     case "$ans" in
  1175.     '') orgname="$dflt";;
  1176.     *)  orgname="$ans" ;;
  1177.     esac
  1178. done
  1179.  
  1180. : Decide whether to ignore the ORGANIZATION environment variable
  1181. cat <<'EOM'
  1182.  
  1183. Trn normally looks in the environment variables NEWSORG and ORGANIZATION
  1184. for an overriding organization name.  However, if your operating system
  1185. reserves the environment variable ORGANIZATION for non-News purposes,
  1186. you will want to ignore it and only have trn check for NEWSORG.
  1187.  
  1188. EOM
  1189.  
  1190. case "$ignoreorg" in
  1191. define) dflt=y ;;
  1192. *)      dflt=n ;;
  1193. esac
  1194. $echo $n "Should we ignore ORGANIZATION? [$dflt] $c"
  1195. . myread
  1196. case "$ans" in
  1197. '') ans="$dflt";;
  1198. esac
  1199. case "$ans" in
  1200. y*) ignoreorg=define ;;
  1201. *)  ignoreorg=undef ;;
  1202. esac
  1203.  
  1204. : get news administrator name
  1205. case "$newsadmin" in
  1206. '')
  1207.     if $contains "^news:" /etc/passwd >/dev/null 2>&1 ; then
  1208.     dflt=news
  1209.     else
  1210.     if $contains "^usenet:" /etc/passwd >/dev/null 2>&1 ; then
  1211.         dflt=usenet
  1212.     else
  1213.         if eunice; then
  1214.         dflt=system
  1215.         else
  1216.         dflt=root
  1217.         fi
  1218.     fi
  1219.     fi
  1220.     ;;
  1221. *)  dflt="$newsadmin"
  1222.     ;;
  1223. esac
  1224. cat <<'EOM'
  1225.  
  1226. Many systems keep their news in a private directory, or have a non-superuser
  1227. in charge of administering news.  (If you don't have such a user, take the
  1228. default answer.)  What is the login name (not directory) that is used for news
  1229. EOM
  1230. $echo $n "administration? [$dflt] $c"
  1231. . myread
  1232. newsadmin="$ans"
  1233. case $newsadmin in
  1234. '') newsadmin=$dflt ;;
  1235. esac
  1236. case $newsadmin in
  1237. root) isadmin=undef ;;
  1238. *)    isadmin=define ;;
  1239. esac
  1240.  
  1241. : figure out news library
  1242. case "$lib" in
  1243. '')
  1244.     dflt=/usr/lib/news
  1245.     ;;
  1246. *)  dflt=$lib ;;
  1247. esac
  1248. libexp=$lib
  1249. libexp='blurfl/dyick'
  1250. while $test ! -d "$libexp"; do
  1251.     $echo " "
  1252.     case "$libexp" in
  1253.     blurfl*) ;;
  1254.     *) $echo "Directory $libexp not found";;
  1255.     esac
  1256.     $echo $n "Where is your news library (~name okay)? [$dflt] $c"
  1257.     . myread
  1258.     case "$ans" in
  1259.     '') ans="$dflt";;
  1260.     esac
  1261.     lib="$ans"
  1262.     case $lib in
  1263.     ~*)
  1264.     libexp=`filexp $lib`
  1265.     $echo "(That is $libexp on this particular system.)"
  1266.     case $portable in
  1267.       undef) lib=$libexp ;;
  1268.     esac
  1269.     ;;
  1270.     *)
  1271.     libexp=$lib
  1272.     ;;
  1273.     esac
  1274. done
  1275.  
  1276. : locate the inews program
  1277. ans='no default'
  1278. while $test ! -f "$ans" ; do
  1279.     case $ans in
  1280.       'no default') ;;
  1281.       *) $echo "$ans does not appear to exist." ;;
  1282.     esac
  1283.     case "$inews" in
  1284.       ''|inews) 
  1285.         if $test -f $libexp/inews; then
  1286.           dflt=$libexp/inews
  1287.         else
  1288.             dflt='no default'
  1289.         fi
  1290.       ;;
  1291.       *)  dflt="$inews" ;;
  1292.     esac
  1293.     $echo " "
  1294.     $echo $n "Where is the inews program located on your system? [$dflt] $c"
  1295.     . myread
  1296.     case $ans in
  1297.       '') ans=$dflt ;;
  1298.     esac
  1299. done
  1300. inews=$ans
  1301.  
  1302. : determine where manual pages go
  1303. case "$mansrc" in
  1304. '')
  1305.     dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1`
  1306.     ;;
  1307. *)  dflt="$mansrc"
  1308.     ;;
  1309. esac
  1310. mansrc='blurfl/dyick'
  1311. while $test ! -d "$mansrc" ; do
  1312.     case $mansrc in
  1313.       blurfl*) ;;
  1314.       *) $echo "$mansrc does not appear to exist." ;;
  1315.     esac
  1316.     $echo " "
  1317.     $echo $n "Where do the manual pages (source) go? [$dflt] $c"
  1318.     . myread
  1319.     mansrc=`filexp "$ans"`
  1320.     case $mansrc in
  1321.       '') mansrc=$dflt ;;
  1322.     esac
  1323. done
  1324. case "$mansrc" in
  1325. *l)
  1326.     manext=l
  1327.     ;;
  1328. *n)
  1329.     manext=n
  1330.     ;;
  1331. *)
  1332.     manext=1
  1333.     ;;
  1334. esac
  1335.  
  1336. : determine where mail is spooled
  1337. case "$maildir" in
  1338. '')
  1339.     dflt=`loc . /usr/spool/mail /usr/spool/mail /usr/mail`
  1340.     ;;
  1341. *)  dflt="$maildir"
  1342.     ;;
  1343. esac
  1344. case "$dflt" in
  1345. *%L*|*%~*) ;;
  1346.  
  1347. *)    dflt="$dflt/%L"
  1348. esac
  1349. $cat <<'EOM'
  1350.  
  1351. Trn needs to know where to find yet-to-be-read mail.  Sendmail sites
  1352. use /usr/spool/mail/%L (where '%L' is the user's login name).  Some
  1353. MMDF sites use /usr/%L/.mail instead.
  1354.  
  1355. EOM
  1356. $echo $n "Where is yet-to-be-read mail spooled? [$dflt] $c"
  1357. . myread
  1358. maildir="$ans"
  1359. case $maildir in
  1360. '') maildir=$dflt ;;
  1361. esac
  1362.  
  1363. : find out how to find out full name
  1364. $echo " "
  1365. case "$berknam" in
  1366. define)
  1367.     dflt=y;;
  1368. undef)
  1369.     dflt=n;;
  1370. *)
  1371.     if bsd || xenix; then
  1372.     dflt=y
  1373.     else
  1374.     dflt=n
  1375.     fi
  1376.     ;;
  1377. esac
  1378. $echo "Does your /etc/passwd file keep full names in Berkeley/V7 format (name first"
  1379. $echo $n "thing after ':' in GCOS field)? [$dflt] $c"
  1380. . myread
  1381. case $ans in
  1382.   '') ans=$dflt ;;
  1383. esac
  1384. case $ans in
  1385.   y*)
  1386.     passnam=define
  1387.     berknam=define
  1388.     usgnam=undef
  1389.     nametype=bsd
  1390.     ;;
  1391.   *)
  1392.     $echo " "
  1393.     case "$usgnam" in
  1394.     define)
  1395.     dflt=y;;
  1396.     undef)
  1397.     dflt=n;;
  1398.     *)
  1399.     if usg; then
  1400.         dflt=y
  1401.     else
  1402.         dflt=n
  1403.     fi
  1404.     ;;
  1405.     esac
  1406.     $echo "Does your passwd file keep full names in USG format (name sandwiched"
  1407.     $echo $n "between a '-' and a '(')? [$dflt] $c"
  1408.     . myread
  1409.     case $ans in
  1410.       '') ans=$dflt ;;
  1411.     esac
  1412.     case $ans in
  1413.       n*)
  1414.     $echo "Full name will be taken from ~/.fullname"
  1415.     passnam=undef
  1416.     berknam=undef
  1417.     usgnam=undef
  1418.     nametype=other
  1419.     ;;
  1420.       *)
  1421.     passnam=define
  1422.     berknam=undef
  1423.     usgnam=define
  1424.     nametype=usg
  1425.     ;;
  1426.     esac
  1427.     ;;
  1428. esac
  1429.  
  1430. : see if we should throw a -i into the Makefile
  1431. $echo " "
  1432. if pdp11; then
  1433.     if $contains '\-i' $mansrc/cc.1 >/dev/null 2>&1 ; then
  1434.     $echo $n "Your system appears to have separate I and D space.  Is this true? [y] $c"
  1435.     . myread
  1436.     case $ans in
  1437.         n*|f*) iandd='' ;;
  1438.         *)     iandd=' -i' ;;
  1439.     esac
  1440.     else
  1441.     $echo "Your system appears to NOT have separate I and D space."
  1442.     $echo $n "Is this correct? [y] $c"
  1443.     . myread
  1444.     case $ans in
  1445.         n*|f*) iandd=' -i' ;;
  1446.         *)     iandd='' ;;
  1447.     esac
  1448.     fi
  1449. else
  1450.     $echo "Not a pdp11--assuming no separate I and D."
  1451.     iandd=''
  1452. fi
  1453.  
  1454. : set the right options for cc and include the x library for XENIX
  1455. if xenix; then
  1456.     if $test -d /lib/386 ; then
  1457.     iandd=" -M3e"
  1458.     else
  1459. :    iandd=" -M2let8 -LARGE -F 3000"
  1460.     iandd=" -Ml2et32 -LARGE -F B000"
  1461.     fi
  1462.     xnxlib=-lx
  1463.     chsize=define
  1464. else
  1465. if $test -r /lib/libx.a -a -f /xenix ; then
  1466.     $echo "Found Xenix library; using chsize()"
  1467.     xnxlib=-lx
  1468.     chsize=define
  1469. else
  1470.     xnxlib=''
  1471.     chsize=undef
  1472. fi
  1473. fi
  1474.  
  1475. : see if we need a special compiler
  1476. if usg; then
  1477.     case "$cc" in
  1478.     '')
  1479.     case "$Mcc" in
  1480.     /*) dflt='Mcc'
  1481.         ;;
  1482.     *)
  1483.         if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
  1484.         dflt='cc -M'
  1485.         else
  1486.         dflt='cc'
  1487.         fi
  1488.         ;;
  1489.     esac
  1490.     ;;
  1491.     *)  dflt="$cc";;
  1492.     esac
  1493.     $cat <<'EOM'
  1494.  
  1495. On some systems the default C compiler will not resolve multiple global
  1496. references that happen to have the same name.  On some such systems the
  1497. "Mcc" command may be used to force these to be resolved.  On other systems
  1498. a "cc -M" command is required.  If gcc is available you might want to use
  1499. EOM
  1500.     $echo $n "that.  What command will force resolution on this system? [$dflt] $c"
  1501.     . myread
  1502.     cc="$ans"
  1503.     case "$cc" in
  1504.     '') cc="$dflt";;
  1505.     *)  cflags='';;
  1506.     esac
  1507. else
  1508.     case "$cc" in
  1509.     '') dflt="cc";;
  1510.     *)  dflt="$cc";;
  1511.     esac
  1512.     cat <<'EOM'
  1513.  
  1514. We need a C compiler that can resolve multiple global references, and since
  1515. this isn't a USG system, cc should work just fine.  However, you may want to
  1516. EOM
  1517.     $echo $n "use gcc or something else.  What C compiler should we use? [$dflt] $c"
  1518.     . myread
  1519.     case "$ans" in
  1520.     '') ans="$dflt";;
  1521.     *)  cflags='';;
  1522.     esac
  1523.     cc="$ans"
  1524. fi
  1525.  
  1526. : see about the C options
  1527. case "$cflags" in
  1528. '') dflt="-O$posix$iandd$addcflags";;
  1529. *)  dflt="$cflags";;
  1530. esac
  1531. cat <<EOM
  1532.  
  1533. The following C flags should do the job on your system.  However, if you need
  1534. to omit a -O, add a -traditional or whatever, here's your chance.  What flags
  1535. EOM
  1536. $echo $n "does $cc need? [$dflt] $c"
  1537. . myread
  1538. case "$ans" in
  1539. '') ans="$dflt";;
  1540. esac
  1541. cflags="$ans"
  1542.  
  1543. : index or strcpy
  1544. $echo " "
  1545. if $contains '^index$' libc.list >/dev/null 2>&1 ; then
  1546.     $echo "Your system appears to use index() and rindex() rather than strchr()"
  1547.     $echo $n "and strrchr().  Is this correct? [y] $c"
  1548.     . myread
  1549.     case $ans in
  1550.     n*|f*) strchr='define' ;;
  1551.     *)     strchr='undef' ;;
  1552.     esac
  1553. else
  1554.     $echo "Your system appears to use strchr() and strrchr() rather than index()"
  1555.     $echo $n "and rindex().  Is this correct? [y] $c"
  1556.     . myread
  1557.     case $ans in
  1558.     n*|f*) strchr=undef ;;
  1559.     *)     strchr=define ;;
  1560.     esac
  1561. fi
  1562.  
  1563. : bcopy/bzero or memcpy/memset
  1564. $echo " "
  1565. if $contains '^bcopy$' libc.list >/dev/null 2>&1 ; then
  1566.     $echo "Your system appears to use bcopy() and bzero() rather than memcpy()"
  1567.     $echo $n "and memset().  Is this correct? [y] $c"
  1568.     . myread
  1569.     case $ans in
  1570.     n*|f*) memcpy='define' ;;
  1571.     *)     memcpy='undef' ;;
  1572.     esac
  1573. else
  1574.     $echo "Your system appears to use memcpy() and memset() rather than bcopy()"
  1575.     $echo $n "and bzero().  Is this correct? [y] $c"
  1576.     . myread
  1577.     case $ans in
  1578.     n*|f*) memcpy='undef' ;;
  1579.     *)     memcpy='define' ;;
  1580.     esac
  1581. fi
  1582.  
  1583. : check for S5-style timezone handling - current offset from GMT in
  1584. : external variable "timezone" rather than gotten with "ftime".
  1585. $echo " "
  1586. if $contains tzname /usr/include/time.h >/dev/null 2>&1 ; then
  1587.     $echo "Your system appears to get the current timezone's offset from GMT by using the"
  1588.     $echo "external variable timezone rather than by calling ftime() or gettimeofday()."
  1589.     $echo $n "Is this correct? [y] $c"
  1590.     . myread
  1591.     case $ans in
  1592.     n*|f*) tzset='undef' ;;
  1593.     *)     tzset='define' ;;
  1594.     esac
  1595. else
  1596.     $echo "Your system appears to get the current timezone's offset from GMT by calling"
  1597.     $echo "ftime() or gettimeofday() rather than from the external variable timezone."
  1598.     $echo $n "Is this correct? [y] $c"
  1599.     . myread
  1600.     case $ans in
  1601.     n*|f*) tzset='define' ;;
  1602.     *)     tzset='undef' ;;
  1603.     esac
  1604. fi
  1605.  
  1606. : determine how to determine when a file is a mailbox
  1607. case "$mboxchar" in
  1608. '') dflt=F;;
  1609. *)  dflt="$mboxchar";;
  1610. esac
  1611. $cat <<'EOM'
  1612.  
  1613. In saving articles, trn wants to differentiate between saving to mailbox
  1614. format files and normal files.  It does this by examining the first character
  1615. of the file in question.  On most systems the first line starts "From...",
  1616. so the first character is F.  On other systems there are magic cookies like
  1617. control codes between articles, so one of those would be first.  For example,
  1618. MMDF messages are separated with lines of 4 control-A's.  On your system, if a
  1619. EOM
  1620. $echo $n "file is in mailbox format, what is the first character of that file? [$dflt] $c"
  1621. . myread
  1622. mboxchar="$ans"
  1623. case $mboxchar in
  1624. '') mboxchar="$dflt" ;;
  1625. esac
  1626. case $mboxchar in
  1627. 'F') ;;
  1628. "$CTRLA") ;;
  1629. *)  cat <<'EOM'
  1630. You will need to edit the shell script mbox.saver to properly append an
  1631. article to a mailbox.  The arguments to the script are documented in
  1632. EOM
  1633.     case $shsharp in
  1634.     false)
  1635.     $echo "comments in mbox.saver.std."
  1636.     ;;
  1637.     true)
  1638.     $echo "comments in the shell script itself."
  1639.     ;;
  1640.     esac
  1641. esac
  1642. $rm -f grimble
  1643. : where do we get termlib routines from
  1644. $echo " "
  1645. ans=`loc libcurses.a x /usr/lib /usr/local/lib /lib`
  1646. case "$ans" in
  1647. /*)
  1648.     if test -f /bin/smit; then
  1649.     termlib='-lcurses'
  1650.     havetlib=define
  1651.     $echo "Using -lcurses and assuming terminfo, since this looks like AIX."
  1652.     else
  1653.     ar t $ans >grimble
  1654.     if $contains tputs grimble >/dev/null 2>&1; then
  1655.         termlib='-lcurses'
  1656.         havetlib=define
  1657.         $echo "Terminfo library found."
  1658.     else
  1659.         ans=x
  1660.     fi
  1661.     fi
  1662.     ;;
  1663. esac
  1664. case "$ans" in
  1665. x)
  1666.     ans=`loc libtermlib.a x /usr/lib /usr/local/lib /lib`
  1667.     case "$ans" in
  1668.     /usr/lib*|/lib*)
  1669.     termlib='-ltermlib'
  1670.     havetlib=define
  1671.     $echo "Termlib library found."
  1672.     ;;
  1673.     /*)
  1674.     termlib="$ans"
  1675.     havetlib=define
  1676.     $echo "Termlib library found."
  1677.     ;;
  1678.     *)
  1679.     if xenix; then
  1680.         ans=/lib/Llibtermcap.a
  1681.     else
  1682.         ans=`loc libtermcap.a x /usr/lib /usr/local/lib /lib`
  1683.     fi
  1684.     case "$ans" in
  1685.     /usr/lib*|/lib*)
  1686.         termlib='-ltermcap'
  1687.         havetlib=define
  1688.         $echo "Termcap library found."
  1689.         ;;
  1690.     /*)
  1691.         termlib="$ans"
  1692.         havetlib=define
  1693.         $echo "Termcap library found."
  1694.         ;;
  1695.     *)
  1696.         case "$termlib" in
  1697.         '')
  1698.         $echo $n "Your system appears to NOT have termlib-style routines.  Is this true? [y] $c"
  1699.         . myread
  1700.         case $ans in
  1701.             n*|f*) havetlib=define
  1702.               $echo "Then where are the termlib-style routines kept (specify either -llibname"
  1703.               $echo $n " or full pathname (~name ok))? $c"
  1704.               . myread
  1705.               termlib=`filexp $ans`
  1706.               ;;
  1707.             *)    havetlib=undef
  1708.               termlib=''
  1709.               $echo "You will have to play around with term.c then."
  1710.               ;;
  1711.         esac
  1712.         $echo " "
  1713.         ;;
  1714.         *)  $echo "You said termlib was $termlib before."
  1715.         ;;
  1716.         esac
  1717.         ;;
  1718.     esac
  1719.     ;;
  1720.     esac
  1721.     ;;
  1722. esac
  1723. : see if there is a whoami file
  1724. if $test -r /usr/include/whoami.h ; then
  1725.     whoami=define
  1726.     $echo "whoami.h found."
  1727. else
  1728.     whoami=undef
  1729. fi
  1730.  
  1731. : see if this is a termio/termios/sgtty system
  1732. if ultrix || sun || pyr ; then
  1733.     termio=undef
  1734.     termios=undef
  1735.     $echo "Using sgtty.h"
  1736. else
  1737. if $test -r /usr/include/termio.h ; then
  1738.     termio=define
  1739.     termios=undef
  1740.     $echo "termio.h found."
  1741. else
  1742. if test -d /usr/convex ; then
  1743.     termio=undef
  1744.     termios=define
  1745.     $echo "termios.h found."
  1746. else
  1747. if $test -r /usr/include/sgtty.h ; then
  1748.     termio=undef
  1749.     termios=undef
  1750.     $echo "sgtty.h found."
  1751. else
  1752.     termio=undef
  1753.     termios=undef
  1754.     $echo "Neither termio.h nor sgtty.h found--you could have problems."
  1755. fi
  1756. fi
  1757. fi
  1758. fi
  1759.  
  1760. : see if this system has fcntl
  1761. if $test -r /usr/include/fcntl.h ; then
  1762.     fcntl=define
  1763.     $echo "fcntl.h found."
  1764. else
  1765.     fcntl=undef
  1766.     $echo "No fcntl.h found, but that's ok."
  1767. fi
  1768.  
  1769. : see if ioctl defs are in sgtty/termio or sys/ioctl
  1770. if $test -r /usr/include/sys/ioctl.h ; then
  1771.     ioctl=define
  1772.     $echo "sys/ioctl.h found."
  1773. else
  1774.     ioctl=undef
  1775.     $echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
  1776. fi
  1777.  
  1778. : see if ptem.h exists
  1779. if $test -r /usr/include/sys/ptem.h ; then
  1780.     ptem=define
  1781.     $echo "sys/ptem.h found."
  1782. else
  1783.     ptem=undef
  1784. fi
  1785.  
  1786. : see if the system has sigblock
  1787. if $contains '^sigblock$' libc.list >/dev/null 2>&1 ; then
  1788.     if sgi; then
  1789.     $echo "sigblock() found and ignored on this Silicon Graphics box"
  1790.     sigblock=undef
  1791.     else
  1792.     $echo "sigblock() found."
  1793.     sigblock=define
  1794.     fi
  1795. else
  1796.     sigblock=undef
  1797. fi
  1798.  
  1799. : see if the system has setbuffer
  1800. if $contains '^setbuffer$' libc.list >/dev/null 2>&1 ; then
  1801.     $echo "setbuffer() found."
  1802.     setvbuf=undef
  1803.     setbuffer=define
  1804. else
  1805. : see if the system has setvbuf
  1806. if $contains '^setvbuf$' libc.list >/dev/null 2>&1 ; then
  1807.     $echo "setvbuf() found."
  1808.     setvbuf=define
  1809.     setbuffer=undef
  1810. else
  1811.     $echo "neither setbuffer() or setvbuf() found, punting to standard buffers."
  1812.     setvbuf=undef
  1813.     setbuffer=undef
  1814. fi
  1815. fi
  1816.  
  1817. : see if the system has getwd
  1818. if $contains '^getwd$' libc.list >/dev/null 2>&1 ; then
  1819.     $echo "getwd() found."
  1820.     getcwd=undef
  1821.     getwd=define
  1822. else
  1823. : see if the system has getcwd
  1824. if $contains '^getcwd$' libc.list >/dev/null 2>&1 ; then
  1825.     $echo "getcwd() found."
  1826.     getcwd=define
  1827.     getwd=undef
  1828. else
  1829.     getcwd=undef
  1830.     getwd=undef
  1831. fi
  1832. fi
  1833.  
  1834. : see if there is a vfork
  1835. if $contains '^vfork$' libc.list >/dev/null 2>&1 ; then
  1836.     $echo "vfork() found."
  1837.     novfork='undef'
  1838.     if sgi; then
  1839.         $echo "However, IRIX vfork() is buggy. We'll use fork() instead."
  1840.         novfork='define'
  1841.     fi
  1842. else
  1843.     if next; then
  1844.     $echo "I know NeXTs have vfork()!"
  1845.     novfork='undef'
  1846.     else
  1847.     $echo "No vfork() found--will use fork() instead."
  1848.     novfork='define'
  1849.     fi
  1850. fi
  1851.  
  1852. : check for rename
  1853. if $contains '^rename$' libc.list >/dev/null 2>&1 ; then
  1854.     $echo "rename() found."
  1855.     rename='define'
  1856. else
  1857.     $echo "No rename() found -- we'll emulate it."
  1858.     rename='undef'
  1859. fi
  1860.  
  1861. : check for ftruncate
  1862. if $contains '^ftruncate$' libc.list >/dev/null 2>&1 ; then
  1863.     $echo "ftruncate() found."
  1864.     ftruncate='define'
  1865. else
  1866.     $echo "No ftruncate() found -- we'll try to fake it."
  1867.     ftruncate='undef'
  1868. fi
  1869.  
  1870. : check for usleep or select
  1871. if $contains '^usleep$' libc.list >/dev/null 2>&1 ; then
  1872.     $echo "usleep() found."
  1873.     usleep='define'
  1874.     uselect='undef'
  1875. else
  1876.     usleep='undef'
  1877.     if $contains '^select$' libc.list >/dev/null 2>&1 ; then
  1878.     $echo "No usleep() found -- we'll use select to emulate it."
  1879.     uselect='define'
  1880.     else
  1881.     $echo "No usleep() found -- we'll use sleep() instead."
  1882.     uselect='undef'
  1883.     fi
  1884. fi
  1885.  
  1886. : check for strftime
  1887. if $contains '^strftime$' libc.list >/dev/null 2>&1 ; then
  1888.     $echo "strftime() found."
  1889.     strftime='define'
  1890. else
  1891.     $echo "No strftime() found -- we'll emulate it."
  1892.     strftime='undef'
  1893. fi
  1894.  
  1895. : see if YP could be running here
  1896. if $contains 'yp_master$' libc.list >/dev/null 2>&1 ; then
  1897.     $echo "YP may be running -- will use getpwent(), just in case."
  1898.     getpwent='define'
  1899. else
  1900. : see if there is a getpwent
  1901. if $contains '^getpwent$' libc.list >/dev/null 2>&1 ; then
  1902.     $echo "getpwent() found."
  1903.     getpwent='define'
  1904. else
  1905.     $echo "No getpwent() found--will use getpw() instead."
  1906.     getpwent='undef'
  1907. fi
  1908. fi
  1909.  
  1910. : default
  1911. sigret=void
  1912. : determine type of signal function
  1913. if next; then
  1914.     sigret=int
  1915. else
  1916. if stardent || sgi ; then
  1917.     sigret=void
  1918. else
  1919. if test -f /usr/include/signal.h ; then
  1920.     $cpp /usr/include/signal.h >sigtest
  1921. else
  1922. if test -f /usr/include/sys/signal.h ; then
  1923.     $cpp /usr/include/sys/signal.h >sigtest
  1924. fi
  1925. fi
  1926. if $contains 'int[^A-Za-z]*signal' sigtest >/dev/null 2>&1 ; then
  1927.     sigret=int
  1928. fi
  1929. fi
  1930. fi
  1931. $echo "signal() returns $sigret on this system."
  1932. : see how we will look up site name
  1933. douname=undef
  1934. gethostname=undef
  1935. phostname=undef
  1936. if $test ! "X$hostfile" = X ; then
  1937.     gethostname=define
  1938. else
  1939. if $test "X$hostcmd" = X ; then
  1940.     : it is already compiled in
  1941. else
  1942. if $contains '^gethostnam' libc.list >/dev/null 2>&1 ; then
  1943.     $echo "gethostname() found."
  1944.     gethostname=define
  1945. else
  1946.     if $contains '^uname$' libc.list >/dev/null 2>&1 ; then
  1947.     $echo "uname() found."
  1948.     douname=define
  1949.     else
  1950.     case $hostcmd in
  1951.       '') ;;
  1952.       *)
  1953.         $cat <<EOT
  1954.  
  1955. There is no gethostname() or uname() on this system.  You have two
  1956. possibilites at this point:
  1957.  
  1958. 1)  You can have your site name ($sitename) compiled into trn, which lets
  1959.     trn start up faster, but makes your binaries non-portable, or
  1960. 2)  you can have trn use a
  1961.     
  1962.     popen("$hostcmd","r")
  1963.  
  1964.     which will start slower but be more portable.
  1965.  
  1966. Option 1 will use whoami.h if you have one.  If you want option 2 but with
  1967. a different command, you can edit config.h after this shell script is done.
  1968.  
  1969. EOT
  1970.         case "$phostname" in
  1971.         define) dflt=n;;
  1972.         undef)  dflt=y;;
  1973.         '')
  1974.         case $portable in
  1975.         define) dflt=n ;;
  1976.         *)      dflt=y ;;
  1977.         esac
  1978.         ;;
  1979.         esac
  1980.         $echo $n "Do you want your site name compiled in? [$dflt] $c"
  1981.         . myread
  1982.         case $ans in
  1983.         '') ans=$dflt;;
  1984.         esac
  1985.         case $ans in
  1986.           n*) phostname=define ;;
  1987.           *)  hostcmd='' phostname=undef;;
  1988.         esac
  1989.         ;;
  1990.     esac
  1991.     case $hostcmd in
  1992.       '')
  1993.         case $whoami in
  1994.           define)
  1995.         $echo 'No hostname function--using whoami.h.'
  1996.         ;;
  1997.           undef)
  1998.         $echo 'No hostname function--hardwiring "'$sitename'".'
  1999.         ;;
  2000.         esac
  2001.         ;;
  2002.     esac
  2003.     fi
  2004. fi
  2005. fi
  2006. fi
  2007.  
  2008. : see if we need -ljobs and if we have sigset, etc.
  2009. if $test -r /usr/lib/libjobs.a -o -r /usr/local/lib/libjobs.a ; then
  2010.     $echo "Jobs library found."
  2011.     normsig=undef
  2012.     jobslib='-ljobs'
  2013. else
  2014.     if bsd; then
  2015.     $echo "No jobs library found.  (I suppose this is at least 4.2...)"
  2016.     else
  2017.     $echo "No jobs library found.  (That's okay, we all have our faults.)"
  2018.     fi
  2019.     if $contains '^sigset$' libc.list >/dev/null 2>&1 ; then
  2020.     $echo "However, sigset() does exist, so we'll make use of it."
  2021.     normsig=undef
  2022.     else
  2023.         normsig=define
  2024.     fi
  2025.     jobslib=''
  2026. fi
  2027. : use sighold and sigrelse?
  2028. if $contains '^sighold$' libc.list >/dev/null 2>&1 ; then
  2029.     $echo "sighold() found"
  2030.     sighold=define
  2031.     else
  2032.         sighold=undef
  2033. fi
  2034. : No Steve jokes...
  2035. if next; then
  2036.     jobslib='-lsys_s'
  2037. fi
  2038. : see if there are directory access routines out there
  2039.     ndirlib=''
  2040.     libndir=undef
  2041.     if $contains '^readdir$' libc.list >/dev/null 2>&1 ; then
  2042.     $echo "readdir() found."
  2043.     usendir=undef
  2044.     ndirc=''
  2045.     ndiro=''
  2046.     if sgi ; then
  2047.         dirtype=direct
  2048.         dirinc="<sys/dir.h>"
  2049.         $echo "Using direct directory structure."
  2050.     else 
  2051.         if $test -r /usr/include/dirent.h ; then
  2052.             $echo "Using dirent directory structure."
  2053.                 dirtype=dirent
  2054.             dirinc="<dirent.h>"
  2055.         else
  2056.             $echo "Using direct directory structure."
  2057.                 dirtype=direct
  2058.             dirinc="<sys/dir.h>"
  2059.         fi
  2060.     fi
  2061.      else
  2062.     if xenix; then
  2063.         $echo "Using Xenix readdir() from -lx."
  2064.         usendir=undef
  2065.         ndirc=''
  2066.         ndiro=''
  2067.         dirtype=direct
  2068.         dirinc="<sys/ndir.h>"
  2069.         $echo "Using direct directory structure."
  2070.     else
  2071.         if $test -r /usr/lib/libndir.a -o -r /usr/local/lib/libndir.a ; then
  2072.             $echo "ndir library found."
  2073.                 if $test -r /usr/lib/libndir.a; then
  2074.                 ndirlib='-lndir'
  2075.                 else
  2076.                 ndirlib="/usr/local/lib/libndir.a"
  2077.                 fi
  2078.             libndir=define
  2079.             usendir=undef
  2080.             ndirc=''
  2081.             ndiro=''
  2082.             dirtype=direct
  2083.             dirinc="<ndir.h>"
  2084.         else
  2085.                 $echo "No ndir library and no readdir()--using ./ndir.c."
  2086.                 usendir=define
  2087.                 ndirc='ndir.c'
  2088.                 ndiro='ndir.o'
  2089.                 dirtype=direct
  2090.     fi
  2091.     fi
  2092. fi
  2093.  
  2094. : check if they want threads by default
  2095. case "$threaddef" in
  2096.     F*) dflt="n";;
  2097.     *)  dflt="y";;
  2098. esac
  2099. $cat <<'EOM'
  2100.  
  2101. Trn has two distinct operating modes (selected by the -x option):
  2102. traditional rn and threaded rn.  If you like, trn will check the first
  2103. letter of the command name and default to threaded mode (-x) if it is
  2104. a 't', or run as traditional rn (+x) if it isn't (this lets you install
  2105. as both trn and rn, linked together).  Otherwise, you can install trn
  2106. to default to threaded rn (-x) no matter what its name is.  Would you
  2107. EOM
  2108. $echo $n "prefer the latter? (defaults to -x, regardless of name)? [$dflt] $c"
  2109. . myread
  2110. case "$ans" in
  2111. '') ans="$dflt";;
  2112. esac
  2113. case "$ans" in
  2114.     n*|f*) threaddef='FALSE'
  2115.        ans=' when -x is specified';;
  2116.     *)     threaddef='TRUE'
  2117.        ans='';;
  2118. esac
  2119. : check if they want the thread selector used by default
  2120. case "$selectdef" in
  2121.     F*) dflt="n";;
  2122.     *)  dflt="y";;
  2123. esac
  2124. $cat <<'EOM'
  2125.  
  2126. When the -X option is specified, trn will set the default command
  2127. for starting a newsgroup to be the thread selector.  Should the -X
  2128. EOM
  2129. $echo $n "option be on by default$ans? [$dflt] $c"
  2130. . myread
  2131. case "$ans" in
  2132. '') ans="$dflt";;
  2133. esac
  2134. case "$ans" in
  2135.     n*|f*) selectdef='FALSE';;
  2136.     *)     selectdef='TRUE';;
  2137. esac
  2138. : check if they have and want to use syslog for the log file in mthreads
  2139. if $contains '^syslog$' libc.list >/dev/null 2>&1 ; then
  2140.     case $syslog in
  2141.     '') dflt=n ;;
  2142.     *)  dflt=y ;;
  2143.     esac
  2144.     $echo " "
  2145.     $echo "Mthreads can either use a custom log file or the syslog functions for"
  2146.     $echo $n "maintaining its log messages.  Would you prefer to use syslog? [$dflt] $c"
  2147.     . myread
  2148.     case "$ans" in
  2149.     '') ans="$dflt";;
  2150.     esac
  2151.     case $ans in
  2152.     n*) syslog='' ;;
  2153.     *)  case $syslog in
  2154.         LOG_*) dflt="$dflt" ;;
  2155.         *)     dflt=LOG_NEWS ;;
  2156.         esac
  2157.         $cat <<'EOM'
  2158.  
  2159. If your syslog has LOG_NEWS or LOG_DAEMON, you'll probably want to use
  2160. one of these for your logging.  If it doesn't, accept the default and
  2161. EOM
  2162.         $echo $n "we'll figure that out later.  Your choice? [$dflt] $c"
  2163.         . myread
  2164.         case "$ans" in
  2165.         '') ans="$dflt";;
  2166.         esac
  2167.         syslog="$ans"
  2168.         ;;
  2169.     esac
  2170. else
  2171.         syslog=''
  2172. fi
  2173.  
  2174. : locate spool directory and check if rrn
  2175. case "$isrrn" in
  2176. define)
  2177.     dflt="y";;
  2178. *)
  2179.     dflt="n";;
  2180. esac
  2181. isrrn=''
  2182. while $test -z "$isrrn" ; do
  2183.     $echo " "
  2184.     $echo $n "Do you want to build the NNTP version of trn? [$dflt] $c"
  2185.     . myread
  2186.     case "$ans" in
  2187.     '') ans="$dflt";;
  2188.     esac
  2189.     case "$ans" in
  2190.     n*)
  2191.     isrrn=undef
  2192.     xthread=undef
  2193.     serverspool=''
  2194.     ;;
  2195.     y*)
  2196.     isrrn=define
  2197.     case "$xthread" in
  2198.     define)
  2199.         dflt="y";;
  2200.     *)
  2201.         dflt="n";;
  2202.     esac
  2203.     $echo " "
  2204.     $echo "Do you want to use the (unofficial) XTHREAD command to grab the thread files"
  2205.     $echo $n "via NNTP instead of using a local database?  (Requires a modified NNTP!) [$dflt] $c"
  2206.     . myread
  2207.     case "$ans" in
  2208.     '') ans="$dflt";;
  2209.     esac
  2210.     case "$ans" in
  2211.     y*) xthread=define
  2212.         case "$serverspool" in
  2213.         '') dflt="n";;
  2214.         *)  dflt="y";;
  2215.         esac
  2216.         $cat <<'EOM'
  2217.  
  2218. The client machines won't need to run mthreads at all then.  As such, you
  2219. have the option of creating the server version of mthreads, or nothing at
  2220. EOM
  2221.         $echo $n "all.  Do you want to create mthreads for the server? [$dflt] $c"
  2222.         . myread
  2223.         case "$ans" in
  2224.         '') ans="$dflt";;
  2225.         esac
  2226.         case "$ans" in
  2227.         y*) case "$serverspool" in
  2228.         '') dflt="/usr/spool/news";;
  2229.         *)  dflt="$serverspool";;
  2230.         esac
  2231.         $echo " "
  2232.         $echo $n "What directory does the SERVER spool news into? [$dflt] $c"
  2233.         . myread
  2234.         case "$ans" in
  2235.         '') ans="$dflt";;
  2236.         esac
  2237.         serverspool="$ans"
  2238.         ;;
  2239.         *)  serverspool=''
  2240.         ;;
  2241.         esac
  2242.         ;;
  2243.     *)  xthread=undef
  2244.         serverspool=''
  2245.         $echo "Ok, mthreads will also be an NNTP client."
  2246.         ;;
  2247.     esac
  2248.     spool=/tmp
  2249.     $echo "net.foobar 00001 00001 y" > .falseactive
  2250.  
  2251.     case "$serverfile" in
  2252.     '')  dflt="no default" ;;
  2253.     *)   dflt="$serverfile";;
  2254.     esac
  2255.  
  2256.     $cat <<'EOM'
  2257.  
  2258. Trrn determines the machine to use as a news server by two means:
  2259.  
  2260. First:    It examines the environment variable NNTPSERVER for a machine name.
  2261.     If present, this name is used in preference to the default.
  2262.  
  2263. Else:    It uses the default machine name, which is either read from a file
  2264.     or compiled into trn.
  2265.  
  2266. It is your choice whether you wish the default machine name to be read
  2267. from a file or specified directly.  To distinguish the two, a filename
  2268. must start with a slash or a tilde, and it must already exist with the
  2269. server name in it (it can contains comments (#) and blank lines also).
  2270. Any other answer is assumed to be a machine name.  If you use an alias
  2271. (such as "news-server") you can use your nameserver to map the name to
  2272. the actual machine.
  2273.  
  2274. EOM
  2275.  
  2276.     while : ; do
  2277.         $echo $n "Enter the file name (~name ok) or machine name: [$dflt] $c"
  2278.         . myread
  2279.         case "$ans" in
  2280.         '') ans="$dflt";;
  2281.         esac
  2282.         ans=`filexp "$ans"`
  2283.         case "$ans" in
  2284.         /*)    $test -r $ans && break
  2285.         $echo "File $ans does not exist."
  2286.         ;;
  2287.         *)    break
  2288.         ;;
  2289.         esac
  2290.     done
  2291.     serverfile="$ans"
  2292.  
  2293.     case "$NNTPSRC" in
  2294.     '') dflt="no default";;
  2295.     *)  dflt="$NNTPSRC";;
  2296.     esac
  2297.  
  2298.     ans='blurfl/dyick'
  2299.     while $test ! -d "$ans"; do
  2300.         $echo " "
  2301.         $echo $n "Enter the pathname of the NNTP source directory: [$dflt] $c"
  2302.         . myread
  2303.         case "$ans" in
  2304.         '') ans="$dflt";;
  2305.         esac
  2306.         ans=`filexp "$ans"`
  2307.         if $test ! -r $ans/common/nntp.h ; then
  2308.         $echo "Can't find $ans/common/nntp.h!"
  2309.         ans='blurfl/dyick'
  2310.         fi
  2311.     done
  2312.     NNTPSRC="$ans"
  2313.     esac
  2314.  
  2315. done
  2316. : hack for Unisys NET-5000 and Interactive V/386
  2317. case "$isrrn" in
  2318. define) 
  2319. : NET-5000
  2320.     if $test -d /usr/include/NET-5000 ; then
  2321.     $echo "I sense you are on a Unisys 5000 computer...poor soul."
  2322.     rrninclude="-I/usr/include/NET-5000 -DEXCELAN -DUSG"
  2323.     socketlib=-lsocket
  2324.     fi
  2325. : Interactive Unix
  2326.     if $test -f /usr/lib/libinet.a ; then
  2327.     rrninclude="-DUSG"
  2328.     socketlib=-linet
  2329.     fi
  2330.     ;;
  2331. *) ;;
  2332. esac
  2333.  
  2334.  
  2335. case "$spool" in
  2336. '')
  2337.     dflt=/usr/spool/news
  2338.     ;;
  2339. *)  dflt="$spool";;
  2340. esac
  2341. case "$isrrn" in
  2342. define)  ans=/tmp;;
  2343. *) ans='blurfl/dyick';;
  2344. esac
  2345. while $test ! -d $ans; do
  2346.     $echo " "
  2347.     case "$ans" in
  2348.     blurfl*);;
  2349.     *) $echo "Directory $ans not found.";;
  2350.     esac
  2351.     $echo $n "Where is news spooled (~name ok)? [$dflt] $c"
  2352.     . myread
  2353.     case "$ans" in
  2354.     '') ans="$dflt";;
  2355.     esac
  2356.     spool="$ans"
  2357.     case $spool in
  2358.     ~*)
  2359.     ans=`filexp $spool`
  2360.     $echo "(That is $ans on this particular system.)"
  2361.     case $portable in
  2362.       undef) spool=$ans ;;
  2363.     esac
  2364.     ;;
  2365.     *)
  2366.     ans=$spool
  2367.     ;;
  2368.     esac
  2369. done
  2370.  
  2371. : check on .thread file placement
  2372. if $test "$isrrn " = "define " -a "$serverspool " = " " ; then
  2373.   case "$xthread" in
  2374.   define)
  2375.     ans="/tmp";;
  2376.   *)
  2377.     case "$threaddir" in
  2378.     ''|'.')    dflt="/usr/spool/threads";;
  2379.     *)        dflt="$threaddir";;
  2380.     esac
  2381.     $echo " "
  2382.     $echo "Pick a directory where you would like the thread files to"
  2383.     $echo $n "be placed: [$dflt] $c"
  2384.     . myread
  2385.     case "$ans" in
  2386.     ''|'.') ans="$dflt";;
  2387.     esac
  2388.     ;;
  2389.   esac
  2390. else
  2391.     case "$threaddir" in
  2392.     ''|'.')    dflt=".";;
  2393.     *)        dflt="$threaddir";;
  2394.     esac
  2395.     $cat <<'EOM'
  2396.  
  2397. By default we place each group's .thread file in the same spool
  2398. directory as the article files.  Alternately, you can place the
  2399. data files in a separate directory if space is tight on the news
  2400. EOM
  2401.     case "$serverspool" in
  2402.     '') $echo "drive.  Where would you like them put?  (use '.' to specify the"
  2403.     $echo $n "spool dir): [$dflt] $c"
  2404.     ;;
  2405.     *)  $echo "drive.  Where would you like them put on the SERVER?  (use '.'"
  2406.     $echo $n "to specify the spool dir): [$dflt] $c"
  2407.     ;;
  2408.     esac
  2409.     . myread
  2410.     case "$ans" in
  2411.     '') ans="$dflt";;
  2412.     esac
  2413. fi
  2414. threaddir="$ans"
  2415.  
  2416. : locate active file
  2417. case "$active" in
  2418. '')
  2419.     dflt=$lib/active
  2420.     ;;
  2421. *)  dflt="$active";;
  2422. esac
  2423. case "$isrrn" in
  2424. define) myactive=.falseactive
  2425.     case "$serverspool" in
  2426.     '') ;;
  2427.     *)  $echo " "
  2428.     $echo "What is the name of your SERVER's active file (~name ok)?"
  2429.     $echo $n "[$dflt] $c"
  2430.     . myread
  2431.     case "$ans" in
  2432.     '') ans="$dflt";;
  2433.     esac
  2434.     active="$ans"
  2435.     ;;
  2436.     esac
  2437.     : check for active.times
  2438.     case "$activetimes" in
  2439.     ''|none|nntp) dflt="n";;
  2440.     *)          dflt="y";;
  2441.     esac
  2442.     cat <<'EOM'
  2443.  
  2444. If your server maintains an accurate "active.times" file (as C news does), trn
  2445. can make use of the much better NEWGROUPS call in NNTP to find new groups.  If
  2446. they are running B news, talk them into running acttimes (included) or mthreads
  2447. with the -t option to maintain a fake active.times file.  Otherwise, the old
  2448. report-everything-that's-not-in-the-.newsrc method will suffice.
  2449.  
  2450. EOM
  2451.     $echo $n "Will your server support a reliable NEWGROUPS call? [$dflt] $c"
  2452.     . myread
  2453.     case "$ans" in
  2454.     '') ans="$dflt";;
  2455.     esac
  2456.     case "$ans" in
  2457.     y*) case "$serverspool" in
  2458.     '') activetimes="nntp";;
  2459.     *)  case "$activetimes" in
  2460.         '') dflt="${active}.times";;
  2461.         *)  dflt="$activetimes";;
  2462.         esac
  2463.         $echo " "
  2464.         $echo "What is the name of your SERVER's active.times file?"
  2465.         $echo $n "[$dflt] $c"
  2466.         . myread
  2467.         case "$ans" in
  2468.         '') ans="$dflt";;
  2469.         esac
  2470.         activetimes="$ans"
  2471.     esac
  2472.     ;;
  2473.     *)  activetimes='none';;
  2474.     esac
  2475.     ;;
  2476. *) myactive='blurfl/dyick'
  2477. esac
  2478. while $test ! -f "$myactive"; do
  2479.     $echo " "
  2480.     case "$myactive" in
  2481.     blurfl*);;
  2482.     *) "File $myactive not found.";;
  2483.     esac
  2484.     $echo $n "Where is the active file (~name ok)? [$dflt] $c"
  2485.     . myread
  2486.     case "$ans" in
  2487.     '') ans="$dflt";;
  2488.     esac
  2489.     active="$ans"
  2490.     case $active in
  2491.     ~*)
  2492.     myactive=`filexp $active`
  2493.     $echo "(That is $myactive on this particular system.)"
  2494.     case $portable in
  2495.       undef) active=$myactive ;;
  2496.     esac
  2497.     ;;
  2498.     *)
  2499.     myactive=$active
  2500.     ;;
  2501.     esac
  2502.     if $test -d $myactive ; then
  2503.     myactive=$myactive/active
  2504.     active=$active/active
  2505.     fi
  2506.  
  2507.     : check for active.times
  2508.     case "$activetimes" in
  2509.     ''|none|nntp) dflt="${active}.times";;
  2510.     *)          dflt="$activetimes";;
  2511.     esac
  2512.     if $test "$dflt " = "none " -o ! -f $dflt ; then
  2513.     $cat <<'EOM'
  2514.  
  2515. If trn can use a file called active.times it can greatly speed up the
  2516. newgroup-checking code.  If you have access to a file maintained by C news,
  2517. use that.  Or, if you want to have mthreads maintain it, pick a spot for
  2518. the file and execute mthreads with the -t option.  Otherwise, specify "none"
  2519. for the good ol' slow approach.
  2520.  
  2521. EOM
  2522.     else
  2523.     $cat <<EOM
  2524.  
  2525. -- Found $dflt --
  2526. If this file is being maintained by C news, mthreads -t, or some other means,
  2527. you'll probably want to use it to greatly speed up the newgroup code.  If not
  2528. use "none" to indicate the good ol' slow approach.
  2529.  
  2530. EOM
  2531.     fi
  2532.     $echo $n "Active.times file to use or 'none'? [$dflt] $c"
  2533.     . myread
  2534.     case "$ans" in
  2535.     '') ans="$dflt";;
  2536.     esac
  2537.     activetimes="$ans"
  2538. done
  2539.  
  2540. : check for 2.10.2 and above
  2541. $echo " "
  2542. if $contains ' [0-9][0-9]* [0-9]' "$myactive" >/dev/null 2>&1; then
  2543.     case "$norelay" in
  2544.     undef) dflt="y";;
  2545.     *)     dflt="n";;
  2546.     esac
  2547.     case "$isrrn" in
  2548.     define) 
  2549.        $echo "Is your NNTP server running an old version of news software," ;;
  2550.     *) $echo "Is your system running an old version of news software," ;;
  2551.     esac
  2552.     $echo $n "predating B News 2.10.3? [${dflt}] $c" 
  2553.     . myread
  2554.     case "$ans" in
  2555.     '') ans=$dflt;;
  2556.     esac
  2557.     case "$ans" in
  2558.     y*)
  2559.       norelay='undef'
  2560.     $echo "Looks like you are running at least 2.10.2 news."
  2561.       ;;
  2562.     *)  norelay='define' ;;
  2563.     esac
  2564.     mininact=define
  2565. else
  2566.     $echo "It doesn't look like you are running 2.10.2 news yet.  Are you planning"
  2567.     $echo $n "to install it in the near future? [y] $c"
  2568.     . myread
  2569.     case $ans in
  2570.     n*) mininact=undef ;;
  2571.     *)  mininact=define ;;
  2572.     esac
  2573.     norelay='undef'
  2574. fi
  2575.  
  2576.  
  2577. : check for void type
  2578. $echo " "
  2579. $echo "Checking to see if your C compiler groks the void type..."
  2580. $cat >try.c <<'EOCP'
  2581. void main();
  2582. EOCP
  2583. if cc -c try.c >/dev/null 2>&1 ; then
  2584.     novoid='undef'
  2585.     $echo "Yup, it does."
  2586. else
  2587.     novoid='define'
  2588.     $echo "Nope, it doesn't (boo hiss).  I will substitute int."
  2589. fi
  2590. $rm try.*
  2591.  
  2592. : find out which shell people like to use most
  2593. ans='blurfl/dyick'
  2594. while $test ! -f "$ans" ; do
  2595.     case $ans in
  2596.       blurfl*) ;;
  2597.       *) $echo "$ans does not appear to exist." ;;
  2598.     esac
  2599.     case "$pref" in
  2600.     '')
  2601.     if $test -f /bin/ksh; then
  2602.         dflt='/bin/ksh'
  2603.     else
  2604.         if $test -f /bin/csh; then
  2605.         dflt='/bin/csh'
  2606.         else
  2607.         dflt='/bin/sh'
  2608.         fi
  2609.     fi
  2610.     ;;
  2611.     *)  dflt="$pref";;
  2612.     esac
  2613.     $echo " "
  2614.     $echo "Give the full path name of the shell most people like to use on your"
  2615.     $echo $n "system: [$dflt] $c"
  2616.     . myread
  2617.     case $ans in
  2618.       '') ans=$dflt ;;
  2619.     esac
  2620. done
  2621. pref=$ans
  2622.  
  2623. : locate the preferred pager for this system
  2624. case "$pager" in
  2625. '')
  2626.     case $pg in
  2627.     /*) dflt=$pg
  2628.     ;;
  2629.     esac
  2630.     case $more in
  2631.     /*) dflt=$more
  2632.     ;;
  2633.     esac
  2634.     case $dflt in
  2635.     '') dflt=/usr/ucb/more
  2636.     ;;
  2637.     esac
  2638.     ;;
  2639. *)  dflt="$pager";;
  2640. esac
  2641. pager='blurfl/dyick'
  2642. while $test ! -f "$pager" ; do
  2643.     case $pager in
  2644.       blurfl*)
  2645.     $echo " "
  2646.     $echo "(If your kernel does terminal paging then you may answer this with '/bin/cat'.)"
  2647.     ;;
  2648.       /*) $echo "$pager does not appear to exist."
  2649.     $echo " "
  2650.         ;;
  2651.       *) $echo "Please give the full path name."
  2652.     $echo " "
  2653.         ;;
  2654.     esac
  2655.     $echo $n "What pager is used on your system? [$dflt] $c"
  2656.     . myread
  2657.     pager="$ans"
  2658.     case $pager in
  2659.       '') pager="$dflt" ;;
  2660.     esac
  2661. done
  2662.  
  2663. : determine default editor
  2664. case "$defeditor" in
  2665. '')
  2666.     dflt=`loc vi /usr/ucb $pth`
  2667.     ;;
  2668. *)  dflt="$defeditor"
  2669.     ;;
  2670. esac
  2671. defeditor='blurfl/dyick'
  2672. while $test ! -f "$defeditor" ; do
  2673.     case $defeditor in
  2674.       blurfl*) ;;
  2675.       *) $echo "$defeditor does not appear to exist." ;;
  2676.     esac
  2677.     $echo " "
  2678.     $echo $n "What is the default editor on your system? [$dflt] $c"
  2679.     . myread
  2680.     defeditor="$ans"
  2681.     case $defeditor in
  2682.       '') defeditor=$dflt ;;
  2683.     esac
  2684. done
  2685.  
  2686. : determine default mailer for Rnmail to use
  2687. $echo " "
  2688. if $test -f /usr/lib/sendmail; then
  2689.     dflt=/usr/lib/sendmail
  2690. else
  2691.     if usg && $test -f $libexp/recmail; then
  2692.         dflt=$libexp/recmail
  2693.     else
  2694.         dflt=/bin/mail
  2695.     fi
  2696. fi
  2697. $echo " "
  2698. if $test "$dflt" = "$libexp/recmail"; then
  2699.     $echo "($libexp/recmail is a part of the news package,and can"
  2700.     $echo "be safely used as the default mailer for the rrn package."
  2701.     $echo "You can also use the standard /bin/mail program if you choose.)"
  2702.     $echo " "
  2703. fi
  2704. $echo $n "What is the default mailer on your system? [$dflt] $c"
  2705. . ./myread                      
  2706. mailer="$ans"
  2707. case $mailer in
  2708.     '') mailer=$dflt ;;
  2709. esac
  2710. $echo "Mail sender is $mailer"
  2711.  
  2712. : check for internet mailer
  2713. case "$internet" in
  2714. define) dflt=y;;
  2715. undef)    dflt=n;;
  2716. *)
  2717.     case "$isrrn" in
  2718.     define) dflt=y ;;
  2719.     *) dflt=n ;;
  2720.     esac
  2721.     ;;
  2722. esac
  2723. cat <<EOM
  2724.  
  2725. Some newer mailers can deliver mail to addresses of the INTERNET persuasion,
  2726. such as user@host.UUCP.  Other older mailers require the complete path to
  2727. the destination to be specified in the address.  Does your mailer understand
  2728. EOM
  2729. $echo $n "INTERNET addresses? [$dflt] $c"
  2730. . myread
  2731. case "$ans" in
  2732. '') ans=$dflt;;
  2733. esac
  2734. case "$ans" in
  2735. y*) internet=define;;
  2736. *)  internet=undef;;
  2737. esac
  2738.  
  2739. : determine where public executables go
  2740. case "$rnbin" in
  2741. '')
  2742.     dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
  2743.     ;;
  2744. *)  dflt="$rnbin"
  2745.     ;;
  2746. esac
  2747. rnbin='blurfl/dyick'
  2748. while $test ! -d "$rnbin" ; do
  2749.     case $rnbin in
  2750.       blurfl*) ;;
  2751.       *) $echo "$rnbin does not appear to exist." ;;
  2752.     esac
  2753.     $echo " "
  2754.     $echo $n "Where do you want to put the public executables? [$dflt] $c"
  2755.     . myread
  2756.     rnbin="$ans"
  2757.     rnbin=`filexp $rnbin`
  2758.     case $rnbin in
  2759.       '') rnbin=$dflt ;;
  2760.     esac
  2761. done
  2762.  
  2763. : determine where private executables go
  2764. case "$rnlib" in
  2765. '')
  2766.     case "$isrrn" in
  2767.     define) dflt=/usr/local/lib/trn ;;
  2768.     *) dflt=$lib/trn ;;
  2769.     esac
  2770.     ;;
  2771. *)  dflt="$rnlib"
  2772.     ;;
  2773. esac
  2774. $echo " "
  2775. $echo "Trn has a number of auxiliary programs that need not be visible to the"
  2776. $echo "whole world.  Where do you want to put these private executables?"
  2777. $echo $n "[$dflt] $c"
  2778. . myread
  2779. rnlib="$ans"
  2780. case $rnlib in
  2781.   '') rnlib=$dflt ;;
  2782. esac
  2783. case $portable in
  2784. undef)
  2785.     rnlib=`filexp $rnlib`
  2786.     ;;
  2787. esac
  2788. : must not allow self reference
  2789. case $rnlib in
  2790.   /*)
  2791.     filexp=$rnlib/filexp
  2792.     ;;
  2793.   *)
  2794.     filexp=`pwd`/filexp
  2795.     ;;
  2796. esac
  2797.  
  2798. : find where to put private files for mthreads
  2799. case "$mtlib" in
  2800. '') dflt="$rnlib" ;;
  2801. *)  dflt="$mtlib" ;;
  2802. esac
  2803. cat <<'EOM'
  2804.  
  2805. Mthreads needs to create some private files (like active2, and maybe active1
  2806. and mt.log, depending on your setup).  These can go in the same directory as
  2807. the private executables, as long as it is writable by whoever runs mthreads.
  2808. Otherwise, a good place to put them is in your thread file directory.  Where
  2809. EOM
  2810. $echo $n "should these files be kept? [$dflt] $c"
  2811. . myread
  2812. mtlib="$ans"
  2813. case "$mtlib" in
  2814. '') mtlib=$dflt ;;
  2815. esac
  2816.  
  2817. : get the local distribution prefixes
  2818. if $test -f $libexp/sys ; then
  2819.     $sed <$libexp/sys -n -e "s/^$sitename://p" | \
  2820.     $sed -e "s/:.*//" -e "s/,/ /g" | tr ' ' '\012' | \
  2821.     $sed -e "/^to./d" -e "/^net$/d" -e "/^fa$/d" -e "/^mod$/d" > .distlist
  2822. fi
  2823.  
  2824. $cat <<'EOH'
  2825.  
  2826. Distribution groups are the things you use on the Distribution line to limit
  2827. where an article will go to.  You are likely to be a member of several
  2828. distribution groups, such as organization, city, state, province, country,
  2829. continent, etc.  For example, Los Angeles has the distribution prefix "la",
  2830. New Jersey has the prefix "nj", and Europe has the prefix "eunet".
  2831.  
  2832. The categories you will be asked are: 
  2833.  
  2834. local organization    (Could be just one machine or a cluster or an office)
  2835. organization        att, dec, kgb, ...
  2836. city            la, ny, mosc, ...
  2837. state/province        ca, nj, bc, ...
  2838. country            usa, can, rok, whatever
  2839. continent        na (North America, not "Not Applicable"), asia, etc.
  2840.  
  2841. (If you don't have a distribution prefix in any of these categories then
  2842. just hit return.)
  2843.  
  2844. EOH
  2845. if $test -f .distlist; then
  2846.     distlist=`tr '\012' ' ' <.distlist`
  2847.     if $test "$distlist" ; then
  2848.     $echo "(These are the distributions in your sys file: $distlist)"
  2849.     $echo " "
  2850.     fi
  2851. fi
  2852. case "$locpref" in
  2853. '') dflt="";;
  2854. *)  dflt="[$locpref] ";;
  2855. esac
  2856. $echo $n "What is the distribution prefix for your local organization? $dflt$c"
  2857. . myread
  2858. case "$ans" in
  2859. '') ;;
  2860. *)  locpref="$ans";;
  2861. esac
  2862. case $locpref in
  2863.   '') locpref=none ;;
  2864. esac
  2865. case "$orgpref" in
  2866. '') dflt="";;
  2867. *)  dflt="[$orgpref] ";;
  2868. esac
  2869. $echo $n "What is the distribution prefix for your organization? $dflt$c"
  2870. . myread
  2871. case "$ans" in
  2872. '') ;;
  2873. *)  orgpref="$ans";;
  2874. esac
  2875. case $orgpref in
  2876.   '') orgpref=none ;;
  2877. esac
  2878. case "$citypref" in
  2879. '') dflt="";;
  2880. *)  dflt="[$citypref] ";;
  2881. esac
  2882. $echo $n "What is the distribution prefix for your city? $dflt$c"
  2883. . myread
  2884. case "$ans" in
  2885. '') ;;
  2886. *)  citypref="$ans";;
  2887. esac
  2888. case $citypref in
  2889.   '') citypref=none ;;
  2890. esac
  2891. case "$statepref" in
  2892. '') dflt="";;
  2893. *)  dflt="[$statepref] ";;
  2894. esac
  2895. $echo $n "What is the distribution prefix for your state/province? $dflt$c"
  2896. . myread
  2897. case "$ans" in
  2898. '') ;;
  2899. *)  statepref="$ans";;
  2900. esac
  2901. case $statepref in
  2902.   '') statepref=none ;;
  2903. esac
  2904. case "$cntrypref" in
  2905. '') dflt="";;
  2906. *)  dflt="[$cntrypref] ";;
  2907. esac
  2908. $echo $n "What is the distribution prefix for your country? $dflt$c"
  2909. . myread
  2910. case "$ans" in
  2911. '') ;;
  2912. *)  cntrypref="$ans";;
  2913. esac
  2914. case $cntrypref in
  2915.   '') cntrypref=none ;;
  2916. esac
  2917. case "$contpref" in
  2918. '') dflt="";;
  2919. *)  dflt="[$contpref] ";;
  2920. esac
  2921. $echo $n "What is the distribution prefix for your continent? $dflt$c"
  2922. . myread
  2923. case "$ans" in
  2924. '') ;;
  2925. *)  contpref="$ans";;
  2926. esac
  2927. case $contpref in
  2928.   '') contpref=none ;;
  2929. esac
  2930.  
  2931. $echo " "
  2932. $echo "If you have any other distribution groups you will need to edit Pnews"
  2933. $echo "and newsetup to add them."
  2934. $echo " "
  2935.  
  2936. : determine root id
  2937. rootid=`$sed </etc/passwd -e "/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"`
  2938. case $rootid in
  2939.   '') rootid=0 ;;
  2940.   *)  $echo "Root uid = $rootid" ;;
  2941. esac
  2942.  
  2943. : weed out incompatibilities
  2944. case $douname in
  2945.   define) whoami=undef ;;
  2946. esac
  2947.  
  2948. : preserve RCS keywords in files with variable substitution, grrr
  2949. Log='$Log'
  2950. Id='$Id'
  2951.  
  2952. : Warnings
  2953. if v7; then
  2954.     cat <<'EOM'
  2955.  
  2956. NOTE: the V7 compiler may ignore some #undefs that trn uses.  If so, you will
  2957. get messages about redefining EXT.  Some V7 compilers also have difficulties
  2958. with #defines near buffer boundaries, so beware.  You may have to play with
  2959. the spacing in common.h.
  2960. EOM
  2961. fi
  2962.  
  2963. if pdp11; then
  2964.     cat <<'EOM'
  2965.  
  2966. NOTE: the PDP-11 does not have enough data space to do subject caching
  2967. reliably.  That feature will be disabled automatically.  Subject searching
  2968. will tend to be slow.
  2969. EOM
  2970. fi
  2971. case "$isrrn" in
  2972.     define) ;;
  2973.     *) socketlib=""
  2974.        rrninclude=""
  2975.      ;;
  2976. esac
  2977.  
  2978. $echo " "
  2979. $echo "End of configuration questions."
  2980. $echo " "
  2981.  
  2982. : create config.sh file
  2983. $echo " "
  2984. $echo "Creating config.sh..."
  2985. $spitshell <<EOT >config.sh
  2986. $startsh
  2987. # config.sh
  2988. # This file was produced by running the Configure script.
  2989.  
  2990. n='$n'
  2991. c='$c'
  2992. libc='$libc'
  2993. sharedclib='$sharedclib'
  2994. eunicefix='$eunicefix'
  2995. eunice='$eunice'
  2996. cpp='$cpp'
  2997. shsharp='$shsharp'
  2998. startsh='$startsh'
  2999. spitshell='$spitshell'
  3000. test='$test'
  3001. expr='$expr'
  3002. sed='$sed'
  3003. echo='$echo'
  3004. cat='$cat'
  3005. rm='$rm'
  3006. mv='$mv'
  3007. cp='$cp'
  3008. tail='$tail'
  3009. tr='$tr'
  3010. mkdir='$mkdir'
  3011. sort='$sort'
  3012. uniq='$uniq'
  3013. inews='$inews'
  3014. grep='$grep'
  3015. egrep='$egrep'
  3016. nidump='$nidump'
  3017. ypmatch='$ypmatch'
  3018. contains='$contains'
  3019. lib='$lib'
  3020. libexp='$libexp'
  3021. nametype='$nametype'
  3022. cc='$cc'
  3023. cflags='$cflags'
  3024. iandd='$iandd'
  3025. rrninclude='$rrninclude'
  3026. termlib='$termlib'
  3027. jobslib='$jobslib'
  3028. socketlib='$socketlib'
  3029. getcwd='$getcwd'
  3030. getwd='$getwd'
  3031. setbuffer='$setbuffer'
  3032. setvbuf='$setvbuf'
  3033. dirtype='$dirtype'
  3034. dirinc='$dirinc'
  3035. ndirlib='$ndirlib'
  3036. libndir='$libndir'
  3037. usendir='$usendir'
  3038. ndirc='$ndirc'
  3039. ndiro='$ndiro'
  3040. posix='$posix'
  3041. pager='$pager'
  3042. mailer='$mailer'
  3043. internet='$internet'
  3044. rnbin='$rnbin'
  3045. filexp='$filexp'
  3046. distlist='$distlist'
  3047. Log='$Log'
  3048. Id='$Id'
  3049. sitename='$sitename'
  3050. hostfile='$hostfile'
  3051. domain='$domain'
  3052. orgname="$orgname"
  3053. isadmin='$isadmin'
  3054. newsadmin='$newsadmin'
  3055. rnlib='$rnlib'
  3056. mtlib='$mtlib'
  3057. mansrc='$mansrc'
  3058. manext='$manext'
  3059. maildir='$maildir'
  3060. spool='$spool'
  3061. serverspool='$serverspool'
  3062. active='$active'
  3063. myactive='$myactive'
  3064. activetimes='$activetimes'
  3065. mininact='$mininact'
  3066. pref='$pref'
  3067. defeditor='$defeditor'
  3068. rootid='$rootid'
  3069. mboxchar='$mboxchar'
  3070. locpref='$locpref'
  3071. orgpref='$orgpref'
  3072. citypref='$citypref'
  3073. statepref='$statepref'
  3074. cntrypref='$cntrypref'
  3075. contpref='$contpref'
  3076. strchr='$strchr'
  3077. memcpy='$memcpy'
  3078. rename='$rename'
  3079. ftruncate='$ftruncate'
  3080. usleep='$usleep'
  3081. uselect='$uselect'
  3082. strftime='$strftime'
  3083. xnxlib='$xnxlib'
  3084. chsize='$chsize'
  3085. tzset='$tzset'
  3086. threaddef='$threaddef'
  3087. selectdef='$selectdef'
  3088. threaddir='$threaddir'
  3089. syslog='$syslog'
  3090. novoid='$novoid'
  3091. novfork='$novfork'
  3092. sunos4='$sunos4'
  3093. portable='$portable'
  3094. passnam='$passnam'
  3095. berknam='$berknam'
  3096. usgnam='$usgnam'
  3097. whoami='$whoami'
  3098. termio='$termio'
  3099. termios='$termios'
  3100. fcntl='$fcntl'
  3101. ioctl='$ioctl'
  3102. ptem='$ptem'
  3103. normsig='$normsig'
  3104. sigblock='$sigblock'
  3105. sigret='$sigret'
  3106. sighold='$sighold'
  3107. getuidgid='$getuidgid'
  3108. havetlib='$havetlib'
  3109. getpwent='$getpwent'
  3110. gethostname='$gethostname'
  3111. douname='$douname'
  3112. phostname='$phostname'
  3113. hostcmd='$hostcmd'
  3114. norelay='$norelay'
  3115. rdchk='$rdchk'
  3116. isrrn='$isrrn'
  3117. xthread='$xthread'
  3118. serverfile='$serverfile'
  3119. ignoreorg='$ignoreorg'
  3120. NNTPSRC='$NNTPSRC'
  3121. CONFIG=true
  3122. EOT
  3123. CONFIG=true
  3124. $rm -f libc.list .distlist kit*isdone 
  3125.  
  3126. $echo "If you didn't make any mistakes, then just type a carriage return here."
  3127. $echo $n "If you need to edit config.sh, do it as a shell escape here: $c"
  3128. . myread
  3129. case "$ans" in
  3130. '') ;;
  3131. *) : in case they cannot read
  3132.     eval $ans;;
  3133. esac
  3134. . ./config.sh
  3135.  
  3136. $echo " "
  3137. $echo "Doing variable substitutions on various files..."
  3138. $echo " "
  3139. set `$grep <MANIFEST '\.SH' | awk '{print $1}'`
  3140. for file in $*; do
  3141.     . $file
  3142. done
  3143.  
  3144. $echo " "
  3145. $echo 'Now you need to generate make dependencies by running "makedepend".'
  3146. $echo 'You might prefer to run it in background: "makedepend > makedepend.out &"'
  3147. $echo $n "Would you like me to run it for you (it takes quite a while)? [n] $c" 
  3148. . myread
  3149. case "$ans" in
  3150. y*) ./makedepend;;
  3151. esac
  3152. $rm -f myread
  3153. : end of Configure
  3154.