home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / TELECOM / rn_4_3_blars.lzh / Configure < prev    next >
Text File  |  1990-08-22  |  55KB  |  2,466 lines

  1. #!/bin/sh
  2. #
  3. # If these # comments don't work, trim them.  Don't worry about the other
  4. # shell scripts, Configure will trim # comments from them for you.
  5. #
  6. # $Header: Configure,v 4.3.2.25 90/05/12 17:34:53 sob Exp $
  7. #
  8. # $Log:    Configure,v $
  9. # Revision 4.3.2.25  90/05/12  17:34:53  sob
  10. # Still more XENIX fixes and fixes for using socketlib when rrn and not when
  11. # just rn.
  12. # Revision 4.3.2.24  90/05/12  14:07:43  sob
  13. # Fixed up LDFLAGS for xenix 286
  14. # Revision 4.3.2.23  90/05/04  00:42:31  sob
  15. # Fixes for Pyramids, more on the return value of signal() and
  16. # syncing up the use of socketlib.
  17. # Revision 4.3.2.22  90/04/17  15:44:24  sob
  18. # Added better directory structure detection.
  19. # Revision 4.3.2.21  90/04/14  19:36:38  sob
  20. # Added better support for the NeXT.
  21. # Revision 4.3.2.20  90/04/14  01:53:36  sob
  22. # Spelling Problem!
  23. # Revision 4.3.2.19  90/03/17  21:33:21  sob
  24. # Reworked VOIDSIG into SIGRET.
  25. # Revision 4.3.2.18  90/03/17  17:45:25  sob
  26. # Changes to detect when to use termio and when not to.
  27. # Revision 4.3.2.17  90/03/17  16:53:11  sob
  28. # Applied a patch to correctly determine being on a Sun running OS 4.0 or
  29. # later.
  30. # Revision 4.3.2.16  89/12/20  23:20:38  sob
  31. # Added hp-ux support suggested by tml@hemuli.atk.vtt.fi. Also,
  32. # corrected some bugs reported by tml@hemuli.atk.vtt.fi.
  33. # Revision 4.3.2.15  89/12/18  00:02:04  sob
  34. # Fixed bug reported by Jim Thompson <jthomp@sun.com> on the
  35. # use of ypmatch against the so-called services.byname YP map.
  36. # Sigh. Will YP EVER work?
  37. # Revision 4.3.2.14  89/12/17  12:55:39  sob
  38. # Minor bug fix to yp detection code.
  39. # Revision 4.3.2.13  89/12/17  01:53:21  sob
  40. # Changed from using ypcat to using ypmatch
  41. # Revision 4.3.2.12  89/12/15  19:35:20  sob
  42. # getpwent was not getting defined when YP is present.
  43. # bug reported by dglo@ads.com
  44. # Revision 4.3.2.11  89/12/13  00:42:59  sob
  45. # Included suggested patches by weening@gang-of-four.stanford.edu.
  46. # Revision 4.3.2.10  89/12/09  01:47:49  sob
  47. # Configure now removes myread when exiting.
  48. # Revision 4.3.2.9  89/12/08  22:41:14  sob
  49. # Added minor changes suggested by weening@Gang-of-Four.Stanford.EDU and
  50. # jik@pit-manager.mit.edu
  51. # Revision 4.3.2.8  89/11/28  00:30:06  sob
  52. # Attempted to make some of the references to the news software version
  53. # levels more clear for the benefit of novice news installers.
  54. # Revision 4.3.2.7  89/11/27  02:25:26  sob
  55. # Better detection of SunOS 4.0 and getpwent will be used on systems
  56. # that support YP, just in case.
  57. # Revision 4.3.2.6  89/11/27  01:32:56  sob
  58. # Added some changes suggested by various usenet postings.
  59. # Limited support for NeXT.
  60. # Revision 4.3.2.5  89/11/08  04:47:27  sob
  61. # Added VOIDSIG handling for SunOS 4.X
  62. # Revision 4.3.2.4  89/11/06  00:05:38  sob
  63. # Added RRN support originally distributed with NNTP 1.5
  64. # Revision 4.3.2.3  89/11/05  23:35:43  sob
  65. # Added checks for ultrix and sun
  66. #
  67. # Revision 4.3.1.6  86/07/24  14:41:18  lwall
  68. # Handles missing Relay-Version: from news 2.10.3 headers.
  69. #
  70. # Revision 4.3.1.5  85/05/23  11:23:22  lwall
  71. # filexp flubs sed command.
  72. # Revision 4.3.1.4  85/05/20  17:13:11  lwall
  73. # Makes sure -lcurses is really a terminfo library.
  74. # Puts single instead of double quotes around defs in config.sh.
  75. # Revision 4.3.1.3  85/05/16  16:48:48  lwall
  76. # Took space from end of filexp output.
  77. # Revision 4.3.1.2  85/05/13  15:54:35  lwall
  78. # Libraries in /usr/local/lib shouldn't use -l switch.
  79. # Revision 4.3.1.1  85/05/10  11:29:20  lwall
  80. # Branch for patches.
  81. # Revision 4.3  85/05/01  11:31:23  lwall
  82. # Baseline for release with 4.3bsd.
  83.  
  84. # Yes, you may rip this off to use in other distribution packages.
  85.  
  86. n=''
  87. c=''
  88. libc=''
  89. eunicefix=''
  90. eunice=''
  91. cpp=''
  92. shsharp=''
  93. spitshell=''
  94. startsh=''
  95. test=''
  96. expr=''
  97. sed=''
  98. echo=''
  99. cat=''
  100. rm=''
  101. mv=''
  102. cp=''
  103. tail=''
  104. tr=''
  105. mkdir=''
  106. sort=''
  107. uniq=''
  108. inews=''
  109. grep=''
  110. egrep=''
  111. ypmatch=''
  112. contains=''
  113. lib=''
  114. nametype=''
  115. cc=''
  116. iandd=''
  117. include=''
  118. rrninclude=''
  119. termlib=''
  120. jobslib=''
  121. ndirlib=''
  122. socketlib=''
  123. dirtype=''
  124. dirinc=''
  125. libndir=''
  126. usendir=''
  127. ndirc=''
  128. ndiro=''
  129. pager=''
  130. mailer=''
  131. internet=''
  132. rnbin=''
  133. filexp=''
  134. distlist=''
  135. Log=''
  136. Header=''
  137. sitename=''
  138. domain=''
  139. orgname=''
  140. isadmin=''
  141. newsadmin=''
  142. rnlib=''
  143. mansrc=''
  144. manext=''
  145. maildir=''
  146. spool=''
  147. active=''
  148. myactive=''
  149. mininact=''
  150. pref=''
  151. defeditor=''
  152. rootid=''
  153. mboxchar=''
  154. locpref=''
  155. orgpref=''
  156. citypref=''
  157. statepref=''
  158. cntrypref=''
  159. contpref=''
  160. strchr=''
  161. novoid=''
  162. novfork=''
  163. portable=''
  164. passnam=''
  165. berknam=''
  166. usgnam=''
  167. whoami=''
  168. termio=''
  169. fcntl=''
  170. ioctl=''
  171. normsig=''
  172. sigblock=''
  173. sigret=''
  174. getuidgid=''
  175. getcwd=''
  176. havetlib=''
  177. getpwent=''
  178. gethostname=''
  179. douname=''
  180. phostname=''
  181. hostcmd=''
  182. norelay=''
  183. isrrn=''
  184. rdchk=''
  185. serverfile=''
  186. NNTPSRC=''
  187. CONFIG=''
  188.  
  189. echo "Beginning of configuration questions for rn kit."
  190. : Eunice requires " " instead of "", can you believe it
  191. echo " "
  192.  
  193. : sanity checks
  194. PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc'
  195. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
  196.  
  197. if test ! -t 0; then
  198.     echo "Type 'sh Configure', not 'sh <Configure'"
  199.     exit 1
  200. fi
  201.  
  202. : some greps do not return status, grrr.
  203. echo "grimblepritz" >grimble
  204. if grep blurfldyick grimble >/dev/null 2>&1 ; then
  205.     contains=contains
  206. else
  207.     if grep grimblepritz grimble >/dev/null 2>&1 ; then
  208.     contains=grep
  209.     else
  210.     contains=contains
  211.     fi
  212. fi
  213.  
  214. : the following should work in any shell
  215. case $contains in
  216. contains*)
  217.     echo " "
  218.     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  219.     cat >contains <<'EOSS'
  220. grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  221. EOSS
  222. chmod 755 contains
  223. esac
  224.  
  225. : first determine how to suppress newline on echo command
  226. echo "Checking echo to see how to suppress newlines..."
  227. (echo "hi there\c" ; echo " ") >.echotmp
  228. if $contains c .echotmp >/dev/null 2>&1 ; then
  229.     echo "...using -n."
  230.     n='-n'
  231.     c=''
  232. else
  233.     echo "...using \\\c."
  234.     n=''
  235.     c='\c'
  236. fi
  237. echo $n "Type carriage return to continue.  Your cursor should be here-->$c"
  238. read ans
  239. rm .echotmp
  240.  
  241. : now set up to do reads with possible shell escape
  242. : if this does not work on your machine, 1,$s/. myread/read ans/
  243. cat <<EOSC >myread
  244. ans='!'
  245. while expr "X\$ans" : "X!" >/dev/null; do
  246.     read ans
  247.     case "\$ans" in
  248.     !)
  249.     sh
  250.     echo " "
  251.     echo $n "Your answer: $c"
  252.     ;;
  253.     !*)
  254.     set \`expr "X\$ans" : "X!\(.*\)\$"\`
  255.     sh -c "\$*"
  256.     echo " "
  257.     echo $n "Your answer: $c"
  258.     ;;
  259.     esac
  260. done
  261. EOSC
  262.  
  263. : general instructions
  264. cat <<'EOH'
  265.  
  266. This installation shell script will examine your system and ask you questions
  267. to determine how rn and its auxiliary files should be installed.  If you
  268. get stuck on a question, you may use a ! shell escape to start a subshell or
  269. execute a command.  Many of the questions will have default answers in
  270. square brackets--typing carriage return will give you the default.
  271.  
  272. On some of the questions which ask for file or directory names you are
  273. allowed to use the ~name construct to specify the login directory belonging
  274. to "name", even if you don't have a shell which knows about that.  Questions
  275. where this is allowed will be marked "(~name ok)".
  276.  
  277. Much effort has been expended to ensure that this shell script will run
  278. on any Unix system.  If despite that it blows up on you, your best bet is
  279. to edit Configure and run it again.  (Trying to install rn without having run
  280. Configure is well nigh impossible.)  Also, tell Stan Barber (rrn@lib.tmc.edu)
  281. how he blew it.
  282.  
  283. This installation script affects things in two ways: 1) it does direct
  284. variable substitutions on some of the files included in this kit, and
  285. 2) it builds a config.h file for inclusion in C programs.  You may edit
  286. any of these files as the need arises after running this script.
  287.  
  288. EOH
  289. echo $n "[Type carriage return to continue] $c"
  290. . myread
  291. : get old answers, if there is a config file out there
  292. if test -f config.sh; then
  293.     echo " "
  294.     echo "(Fetching default answers from your old config.sh file...)"
  295.     . config.sh
  296. fi
  297.  
  298. : get list of predefined functions in a handy place
  299. echo " "
  300. if test -f /lib/libc.a; then
  301.     echo "Your C library is in /lib/libc.a.  You're normal."
  302.     libc=/lib/libc.a
  303. else
  304.     if test -f /lib/Llibc.a; then
  305.     echo "Your C library is in /lib/Llibc.a.  I smell Xenix!"
  306.     libc=/lib/Llibc.a
  307.     else
  308.     if test -f /usr/lib/libc.a; then
  309.         echo "Your C library is in /usr/lib/libc.a, of all places."
  310.         libc=/usr/lib/libc.a
  311.     else
  312.         if test -f "$libc"; then
  313.         echo "Your C library is in $libc, like you said before."
  314.         else
  315.         cat <<'EOM'
  316.  
  317. I can't seem to find your C library.  I've looked for /lib/libc.a and
  318. /usr/lib/libc.a, but neither of those are there.  What is the full name
  319. EOM
  320.         echo $n "of your C library? $c"
  321.         . myread
  322.         libc="$ans"
  323.         fi
  324.     fi
  325.     fi
  326. fi
  327. echo " "
  328. echo $n "Extracting names from $libc for later perusal...$c"
  329. if ar t $libc > libc.list; then
  330.     echo "done"
  331. else
  332.     echo " "
  333.     echo "The archiver doesn't think $libc is a reasonable library."
  334.     exit 1
  335. fi
  336. : make some quick guesses about what we are up against
  337. echo " "
  338. echo $n "Hmm...  $c"
  339. if $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then
  340.     echo "Looks kind of like a BSD system, but we'll see..."
  341.     echo exit 0 >bsd
  342.     echo exit 1 >usg
  343.     echo exit 1 >v7
  344. else
  345.     if $contains SIGTSTP /usr/include/sys/signal.h >/dev/null 2>&1 ; then
  346.     echo "Looks sort of like a BSD system, but we'll see..."
  347.     echo exit 0 >bsd
  348.     echo exit 1 >usg
  349.     echo exit 1 >v7
  350.     else
  351.     if $contains fcntl.o libc.list >/dev/null 2>&1 ; then
  352.         echo "Looks kind of like a USG system, but we'll see..."
  353.         echo exit 1 >bsd
  354.         echo exit 0 >usg
  355.         echo exit 1 >v7
  356.     else
  357.         echo "Looks kind of like a version 7 system, but we'll see..."
  358.         echo exit 1 >bsd
  359.         echo exit 1 >usg
  360.         echo exit 0 >v7
  361.     fi
  362.     fi
  363. fi
  364. if $contains vmssystem.o libc.list >/dev/null 2>&1 ; then
  365.     cat <<'EOI'
  366. There is, however, a strange, musty smell in the air that reminds me of
  367. something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  368. EOI
  369.     echo "exit 0" >eunice
  370.     eunicefix=unixtovms
  371.     eunice=define
  372. : it so happens the Eunice I know will not run shell scripts in Unix format
  373. else
  374.     echo " "
  375.     echo "Congratulations.  You aren't running Eunice."
  376.     eunicefix=':'
  377.     eunice=undef
  378.     echo "exit 1" >eunice
  379. fi
  380. chmod 755 bsd usg v7 eunice
  381. $eunicefix bsd usg v7 eunice
  382. : see how we invoke the C preprocessor
  383. echo " "
  384. echo "Checking to see how your C preprocessor is invoked..."
  385. cat <<'EOT' >testcpp.c
  386. #define ABC abc
  387. #define XYZ xyz
  388. ABC+XYZ
  389. EOT
  390. echo 'Maybe "cc -E" will work...'
  391. cc -E testcpp.c >testcpp.out 2>&1
  392. if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  393.     echo "Yup, it does."
  394.     cpp='cc -E'
  395. else
  396.     echo 'Nope...maybe "cc -P" will work...'
  397.     cc -P testcpp.c >testcpp.out 2>&1
  398.     if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  399.     echo "Yup, that does."
  400.     cpp='cc -P'
  401.     else
  402.     echo 'Nixed again...maybe "/lib/cpp" will work...'
  403.     /lib/cpp testcpp.c >testcpp.out 2>&1
  404.     if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  405.         echo "Hooray, it works!  I was beginning to wonder."
  406.         cpp='/lib/cpp'
  407.     else
  408.         if $contains 'abc +xyz' testcpp.out >/dev/null 2>&1 ; then
  409.         echo "Found it!  You're on a NeXT, aren't you?"
  410.         cpp='/lib/cpp'
  411.         else
  412.         echo 'Hmm...maybe you already told me...'
  413.         case "$cpp" in
  414.         '') ;;
  415.         *) $cpp testcpp.c >testcpp.out 2>&1;;
  416.         esac
  417.         if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  418.             echo "Hooray, you did!  I was beginning to wonder."
  419.         else
  420.             echo "Nope. I can't find a C preprocessor.  Name one: $c"
  421.             . myread
  422.             cpp="$ans"
  423.             $cpp testcpp.c >testcpp.out 2>&1
  424.             if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  425.             echo "OK, that will do."
  426.             else
  427.             echo "Sorry, I can't get that to work.  Go find one."
  428.             exit 1
  429.             fi
  430.         fi
  431.         fi
  432.     fi
  433.     fi
  434. fi
  435. rm -f testcpp.c testcpp.out
  436. : check for pdp11
  437. echo " "
  438. cat <<'EOT' >pdp11.c
  439. #ifdef pdp11
  440. exit 0
  441. #else
  442. exit 1
  443. #endif
  444. EOT
  445. $cpp pdp11.c | grep exit >pdp11
  446. chmod 755 pdp11
  447. $eunicefix pdp11
  448. rm pdp11.c
  449. if pdp11; then
  450.     echo "This looks like a pdp11 to me."
  451. fi
  452. : check for ultrix
  453. cat <<'EOT' >ultrix.c
  454. #ifdef ultrix
  455. exit 0
  456. #else
  457. exit 1
  458. #endif
  459. EOT
  460. $cpp ultrix.c | grep exit >ultrix
  461. chmod 755 ultrix
  462. $eunicefix ultrix
  463. rm ultrix.c
  464. if ultrix; then
  465.     echo "Running ultrix, eh?"
  466. fi
  467.  
  468. : check for sun 4.0
  469. cat <<'EOT' >sun.c
  470. #ifdef sun
  471. exit 0
  472. #else
  473. exit 1
  474. #endif
  475. EOT
  476. $cpp sun.c | grep exit >sun
  477. chmod 755 sun
  478. $eunicefix sun
  479. rm sun.c
  480. if sun; then
  481.     echo "This looks like a sun to me."
  482.     if test -f /etc/ld.so.cache ; then
  483.     echo "And it appears you are running SunOS 4.0 or greater."
  484.     fi
  485. fi
  486. : check for hp-ux
  487. cat <<'EOT' >hp-ux.c
  488. #ifdef hpux
  489. exit 0
  490. #else
  491. exit 1
  492. #endif
  493. EOT
  494. $cpp hp-ux.c | grep exit >hp-ux
  495. chmod 755 hp-ux
  496. $eunicefix hp-ux
  497. rm hp-ux.c
  498. if hp-ux; then
  499.     echo "Hewlett-Packard must have built this..."
  500.     socketlib=-lbsdipc
  501. fi
  502.  
  503. : check for sgi
  504. cat <<'EOT' >sgi.c
  505. #ifdef sgi
  506. exit 0
  507. #else
  508. exit 1
  509. #endif
  510. EOT
  511. $cpp sgi.c | grep exit >sgi
  512. chmod 755 sgi
  513. $eunicefix sgi
  514. rm sgi.c
  515. if sgi; then
  516.     echo "Silicon Graphics must have built this..."
  517.     include=-I/usr/include/bsd
  518.     rrninclude="-I/usr/include/bsd -DUSG"
  519.     socketlib=-lbsd
  520. fi
  521.  
  522. : check for XENIX
  523. cat <<'EOT' >xenix.c
  524. #ifdef M_XENIX
  525. exit 0
  526. #else
  527. exit 1
  528. #endif
  529. EOT
  530. $cpp xenix.c | grep exit >xenix
  531. chmod 755 xenix
  532. $eunicefix xenix
  533. rm xenix.c
  534. if xenix; then
  535.     echo "Kinda looks like XENIX....hmmm"
  536.     rrninclude="-DUSG -DLAI_TCP"
  537.     socketlib=-lsocket
  538.     sigret=void
  539.     rdchk=define
  540.     dirtype=dirent
  541. else
  542.     rdchk=undef
  543. fi
  544.  
  545. : check for Pyramid OSx
  546. cat <<'EOT' >pyr.c
  547. #ifdef pyr
  548. exit 0
  549. #else
  550. exit 1
  551. #endif
  552. EOT
  553. $cpp pyr.c | grep exit >pyr
  554. chmod 755 pyr
  555. $eunicefix pyr
  556. rm pyr.c
  557. if pyr; then
  558.     echo "This looks like a Pyramid to me."
  559. fi
  560.  
  561. if bsd; then
  562.     getuidgid=define
  563. else
  564.     getuidgid=undef
  565. fi
  566.  
  567. : see if sh knows # comments
  568. echo " "
  569. echo "Checking your sh to see if it knows about # comments..."
  570. if sh -c '#' >/dev/null 2>&1 ; then
  571.     echo "Your sh handles # comments correctly."
  572.     shsharp=true
  573.     spitshell=cat
  574.     echo " "
  575.     echo "Okay, let's see if #! works on this system..."
  576.     echo "#!/bin/echo hi" > try
  577.     $eunicefix try
  578.     chmod 755 try
  579.     try > today
  580.     if test -s today; then
  581.     echo "It does."
  582.     sharpbang='#!'
  583.     else
  584.     echo "#! /bin/echo hi" > try
  585.     $eunicefix try
  586.     chmod 755 try
  587.     try > today
  588.     if test -s today; then
  589.         echo "It does."
  590.         sharpbang='#! '
  591.     else
  592.         echo "It doesn't."
  593.         sharpbang=': use '
  594.     fi
  595.     fi
  596. else
  597.     echo "Your sh doesn't grok # comments--I will strip them later on."
  598.     shsharp=false
  599.     echo "exec grep -v '^#'" >spitshell
  600.     chmod 755 spitshell
  601.     $eunicefix spitshell
  602.     spitshell=`pwd`/spitshell
  603.     echo "I presume that if # doesn't work, #! won't work either!"
  604.     sharpbang=': use '
  605. fi
  606.  
  607. : figure out how to guarantee sh startup
  608. echo " "
  609. echo "Checking out how to guarantee sh startup..."
  610. startsh=$sharpbang'/bin/sh'
  611. echo "Let's see if '$startsh' works..."
  612. cat >try <<EOSS
  613. $startsh
  614. set abc
  615. test "$?abc" != 1
  616. EOSS
  617.  
  618. chmod 755 try
  619. $eunicefix try
  620. if try; then
  621.     echo "Yup, it does."
  622. else
  623.     echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  624. fi
  625. rm -f try today
  626.  
  627. : find out where common programs are
  628. echo " "
  629. echo "Locating common programs..."
  630. pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib /usr/etc /usr/5bin"
  631. cat <<EOSC >loc
  632. $startsh
  633. thing=\$1
  634. shift
  635. dflt=\$1
  636. shift
  637. for dir in \$*; do
  638.     case "\$thing" in
  639.     .)
  640.     if test -d \$dir/\$thing; then
  641.         echo \$dir
  642.         exit 0
  643.     fi
  644.     ;;
  645.     *)
  646.     if test -f \$dir/\$thing; then
  647.         echo \$dir/\$thing
  648.         exit 0
  649.     fi
  650.     ;;
  651.     esac
  652. done
  653. echo \$dflt
  654. exit 1
  655. EOSC
  656. chmod 755 loc
  657. $eunicefix loc
  658. loclist="expr sed echo cat rm mv cp tail tr mkdir sort uniq grep"
  659. trylist="test inews egrep more pg Mcc ypmatch"
  660. for file in $loclist; do
  661.     xxx=`loc $file $file $pth`
  662.     eval $file=$xxx
  663.     case "$xxx" in
  664.     /*)
  665.     echo $file is in $xxx.
  666.     ;;
  667.     *)
  668.     echo "I don't know where $file is.  I hope it's in everyone's PATH."
  669.     ;;
  670.     esac
  671. done
  672. echo " "
  673. echo "Don't worry if any of the following aren't found..."
  674. for file in $trylist; do
  675.     xxx=`loc $file $file $pth`
  676.     eval $file=$xxx
  677.     case "$xxx" in
  678.     /*)
  679.     echo $file is in $xxx.
  680.     ;;
  681.     *)
  682.     echo "I don't see $file out there, offhand."
  683.     ;;
  684.     esac
  685. done
  686. case $egrep in
  687. egrep)
  688.     echo "Substituting grep for egrep."
  689.     egrep=$grep
  690.     ;;
  691. esac
  692. case $test in
  693. test)
  694.     echo "Hopefully test is built into your sh."
  695.     ;;
  696. /bin/test)
  697.     echo " "
  698.     echo $n 'Is your "test" built into sh? [n] (OK to guess) '"$c"
  699.     . myread
  700.     case $ans in
  701.     y*) test=test ;;
  702.     esac
  703.     ;;
  704. *)
  705.     test=test
  706.     ;;
  707. esac
  708. case $echo in
  709. echo)
  710.     echo "Hopefully echo is built into your sh."
  711.     ;;
  712. /bin/echo)
  713.     echo " "
  714.     echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
  715.     $echo $n "hi there$c" >foo1
  716.     echo $n "hi there$c" >foo2
  717.     if cmp foo1 foo2 >/dev/null 2>&1; then
  718.     echo "They are compatible.  In fact, they may be identical."
  719.     else
  720.     echo "They are not compatible--the echo builtin will be used."
  721.     echo=echo
  722.     fi
  723.     $rm -f foo1 foo2
  724.     ;;
  725. *)
  726.     echo=echo
  727.     ;;
  728. esac
  729. $echo " "
  730. : test yp
  731. case $ypmatch in
  732. ypmatch)
  733.     $echo "I don't see ypmatch out there, so YP is not available. We'll search the"
  734.     $echo "passwd file the old fashioned way!"
  735.     ;;
  736. *)
  737.     $ypmatch 513/tcp services > /dev/null 2>/dev/null
  738.     status=$?
  739.     if $test $status  -ne 0 ; then
  740.     $echo "YP installed, but not operational. We won't use it."
  741.     else
  742.         $echo "YP installed and operational."
  743.     fi
  744.     
  745.     ;;
  746. esac
  747. if $test "$ypmatch" = "ypmatch"; then
  748.     ypmatch=""
  749. fi
  750.  
  751. : decide how portable to be
  752. case "$portable" in
  753. define) dflt=y;;
  754. *)    dflt=n;;
  755. esac
  756. $cat <<'EOH'
  757.  
  758. I can set things up so that your shell scripts and binaries are more portable,
  759. at what may be a noticable cost in performance.  In particular, if you
  760. ask to be portable, the following happens:
  761.  
  762.      1) shell scripts will rely on the PATH variable rather than using
  763.     the paths derived above.
  764.      2) ~username interpretations will be done at run time rather than
  765.     by Configure.
  766.      3) the system name will be determined at run time, if at all possible.
  767.  
  768. EOH
  769. $echo $n "Do you expect to run these scripts and binaries on multiple machines? [$dflt] $c"
  770. . myread
  771. case $ans in
  772. '') ans=$dflt;;
  773. esac
  774. case $ans in
  775.     y*) portable=define
  776.     for file in $loclist; do
  777.         eval $file=$file
  778.     done
  779.     ;;
  780.     *)  portable=undef ;;
  781. esac
  782.  
  783. : set up shell script to do ~ expansion
  784. cat >filexp <<EOSS
  785. $startsh
  786. : expand filename
  787. case \$1 in
  788. ~/*|~)
  789.     $echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  790.     ;;
  791. ~*)
  792.     if $test -f /bin/csh; then
  793.     /bin/csh -f -c "glob \$1"
  794.     $echo ""
  795.     else
  796.     name=\`$expr x\$1 : '..\([^/]*\)'\`
  797.     if $test "$ypmatch" != ""; then
  798.          dir=\`$ypmatch \$name passwd 2>/dev/null | $sed "s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/"'\`
  799.     fi
  800.     if $test "\$dir" = ""; then
  801.         dir=\`$sed </etc/passwd -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}'\`
  802.     fi
  803.     if $test ! -d "\$dir"; then
  804.         me=\`basename \$0\`
  805.         $echo "\$me: can't locate home directory for: \$name" >&2
  806.         exit 1
  807.     fi
  808.     case \$1 in
  809.     */*)
  810.         $echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  811.         ;;
  812.     *)
  813.         $echo \$dir
  814.         ;;
  815.     esac
  816.     fi
  817.     ;;
  818. *)
  819.     $echo \$1
  820.     ;;
  821. esac
  822. EOSS
  823. chmod 755 filexp
  824. $eunicefix filexp
  825.  
  826. : now get the site name
  827. $echo " "
  828. $echo "Figuring out site name..."
  829. $echo 'Maybe "hostname" will work...'
  830. if ans=`sh -c hostname 2>&1` ; then
  831.     sitename=$ans
  832.     hostcmd=hostname
  833. else
  834.     $echo 'No, maybe "uuname -l" will work...'
  835.     if ans=`sh -c 'uuname -l' 2>&1` ; then
  836.     sitename=$ans
  837.     hostcmd='uuname -l'
  838.     else
  839.     $echo 'Strange.  Maybe "uname -n" will work...'
  840.     if ans=`sh -c 'uname -n' 2>&1` ; then
  841.         sitename=$ans
  842.         hostcmd='uname -n'
  843.     else
  844.         $echo 'Oh well, maybe I can mine it out of whoami.h...'
  845.         if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
  846.         sitename=`$echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
  847.         hostcmd="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
  848.         else
  849.         case "$sitename" in
  850.         '') $echo "Does this machine have an identity crisis or something?"
  851.             hostcmd=''
  852.             ;;
  853.         *)  $echo "Well, you said $sitename before...";;
  854.         esac
  855.         fi
  856.     fi
  857.     fi
  858. fi
  859. : you do not want to know about this
  860. set $sitename
  861. sitename=$1
  862.  
  863. : translate upper to lower case. This is mostly to help UUCP work right.
  864. case $sitename in
  865.     *[A-Z]*)
  866.     sitename=`$echo $sitename | tr '[A-Z]' '[a-z]'`
  867.     $echo "(Normalizing case in your site name)"
  868.     ;;
  869. esac
  870.  
  871. : verify guess
  872. if $test "$sitename" ; then
  873.     $echo 'Your site name appears to be "'$sitename'".'
  874.     $echo $n "Is this correct? [y] $c"
  875.     . myread
  876.     case $ans in
  877.       y*|'')  ;;
  878.       *)      sitename='' ;;
  879.     esac
  880. fi
  881.  
  882. : bad guess or no guess
  883. while $test "X$sitename" = X ; do
  884.     $echo $n "Please type the (one word) name of your site: $c"
  885.     . myread
  886.     sitename="$ans"
  887.     case $hostcmd in
  888.     sed*)
  889.     $echo "(That doesn't agree with your whoami.h file, by the way.)"
  890.     ;;
  891.     *)
  892.     $echo "(That doesn't agree with your $hostcmd command, by the way.)"
  893.     ;;
  894.     esac
  895.     hostcmd=''
  896. done
  897.  
  898. : try to deal with domains
  899. $cat << 'EOH'
  900.  
  901. Please enter your domain name.  This will be used in conjunction
  902. with the site name for return addresses on news articles and
  903. mail.  If you use the 4.3ism of having your domain in your
  904. hostname, all the posting programs will figure this out on the
  905. fly, so don't worry.
  906.  
  907. Examples of some valid domains:
  908.  
  909.     berkeley.edu
  910.     nasa.gov
  911. Example of an invalid domain in common use:
  912.     uucp
  913. EOH
  914.  
  915. case "$domain" in
  916. '') dflt="uucp";;
  917. *)  dflt="$domain" ;;
  918. esac
  919. $echo $n "Your domain: [$dflt] $c"
  920. . myread
  921. case "$ans" in
  922. '') domain="$dflt";;
  923. *)  domain="$ans" ;;
  924. esac
  925.  
  926. if $test $portable = "undef" ; then
  927.     case $sitename in
  928.     *.*)    ;;
  929.     *)    sitename=$sitename.$domain
  930.         ;;
  931.     esac
  932. fi
  933.  
  934. : get organizaton name
  935. longshots='/usr/src/new /usr/src/local /usr/local/src'
  936. case "$orgname" in
  937. '') if xxx=`loc news/src/defs.h x $longshots`; then
  938.     dflt=`$sed -n 's/^.*MYORG[     ]*"\(.*\)".*$/\1/p' $xxx`
  939.     else
  940.     dflt='no default'
  941.     fi
  942.     ;;
  943. *)  dflt="$orgname";;
  944. esac
  945. $cat << 'EOH'
  946.  
  947. Please type the name of your organization as you want it to appear on the
  948. Organization line of outgoing articles.  (It's nice if this also specifies
  949. your location.  Your city name is probably sufficient if well known.)
  950. For example:
  951.  
  952.     University of Southern North Dakota, Hoople
  953.  
  954. You may also put the name of a file, as long as it begins with a slash.
  955. For example:
  956.  
  957.     /etc/organization
  958.  
  959. EOH
  960. orgname="no default"
  961. while test "X$orgname" = "Xno default"; do
  962.     $echo $n "Organization: [$dflt] $c"
  963.     . myread
  964.     case "$ans" in
  965.     '') orgname="$dflt";;
  966.     *)  orgname="$ans" ;;
  967.     esac
  968. done
  969.  
  970. : get news administrator name
  971. case "$newsadmin" in
  972. '')
  973.     if $contains "^news:" /etc/passwd >/dev/null 2>&1 ; then
  974.     dflt=news
  975.     else
  976.     if $contains "^usenet:" /etc/passwd >/dev/null 2>&1 ; then
  977.         dflt=usenet
  978.     else
  979.         if eunice; then
  980.         dflt=system
  981.         else
  982.         dflt=root
  983.         fi
  984.     fi
  985.     fi
  986.     ;;
  987. *)  dflt="$newsadmin"
  988.     ;;
  989. esac
  990. cat <<'EOM'
  991.  
  992. Many systems keep their news in a private directory, or have a non-superuser
  993. in charge of administering news.  (If you don't have such a user, take the
  994. default answer.)  What is the login name (not directory) that is used for news
  995. EOM
  996. $echo $n "administration? [$dflt] $c"
  997. . myread
  998. newsadmin="$ans"
  999. case $newsadmin in
  1000. '') newsadmin=$dflt ;;
  1001. esac
  1002. case $newsadmin in
  1003. root) isadmin=undef ;;
  1004. *)    isadmin=define ;;
  1005. esac
  1006.  
  1007. : figure out news library
  1008. case "$lib" in
  1009. '')
  1010.     dflt=/usr/lib/news
  1011.     ;;
  1012. *)  dflt=$lib ;;
  1013. esac
  1014. libexp=$lib
  1015. libexp='blurfl/dyick'
  1016. while $test ! -d "$libexp"; do
  1017.     $echo " "
  1018.     case "$libexp" in
  1019.     blurfl*) ;;
  1020.     *) $echo "Directory $libexp not found";;
  1021.     esac
  1022.     $echo "(If you are building this as rrn, it is a good idea"
  1023.     $echo "to make your news library directory the same as where the rn"
  1024.     $echo "library directory is, usually /usr/local/lib/rn)"
  1025.     $echo " "
  1026.     $echo $n "Where is your news library (~name okay)? [$dflt] $c"
  1027.     . myread
  1028.     case "$ans" in
  1029.     '') ans="$dflt";;
  1030.     esac
  1031.     lib="$ans"
  1032.     case $lib in
  1033.     ~*)
  1034.     libexp=`filexp $lib`
  1035.     $echo "(That is $libexp on this particular system.)"
  1036.     case $portable in
  1037.       undef) lib=$libexp ;;
  1038.     esac
  1039.     ;;
  1040.     *)
  1041.     libexp=$lib
  1042.     ;;
  1043.     esac
  1044. done
  1045. if $test -f $libexp/inews; then
  1046.     $echo "Aha!  Inews is really in $libexp!"
  1047.     $echo "Maybe this is Bnews 2.10.2 or later, or rrn."
  1048.     inews=$libexp/inews
  1049. fi
  1050.  
  1051. : determine where manual pages go
  1052. case "$mansrc" in
  1053. '')
  1054.     dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1`
  1055.     ;;
  1056. *)  dflt="$mansrc"
  1057.     ;;
  1058. esac
  1059. mansrc='blurfl/dyick'
  1060. while $test ! -d "$mansrc" ; do
  1061.     case $mansrc in
  1062.       blurfl*) ;;
  1063.       *) $echo "$mansrc does not appear to exist." ;;
  1064.     esac
  1065.     $echo " "
  1066.     $echo $n "Where do the manual pages (source) go? [$dflt] $c"
  1067.     . myread
  1068.     mansrc=`filexp "$ans"`
  1069.     case $mansrc in
  1070.       '') mansrc=$dflt ;;
  1071.     esac
  1072. done
  1073. case "$mansrc" in
  1074. *l)
  1075.     manext=l
  1076.     ;;
  1077. *n)
  1078.     manext=n
  1079.     ;;
  1080. *)
  1081.     manext=1
  1082.     ;;
  1083. esac
  1084.  
  1085. : determine where mail is spooled
  1086. case "$maildir" in
  1087. '')
  1088.     dflt=`loc . /usr/spool/mail /usr/spool/mail /usr/mail`
  1089.     ;;
  1090. *)  dflt="$maildir"
  1091.     ;;
  1092. esac
  1093. maildir='blurfl/dyick'
  1094. while $test ! -d "$maildir" ; do
  1095.     case $maildir in
  1096.       blurfl*) ;;
  1097.       *) $echo "$maildir does not appear to exist." ;;
  1098.     esac
  1099.     $echo " "
  1100.     $echo $n "Where is yet-to-be-read mail spooled? [$dflt] $c"
  1101.     . myread
  1102.     maildir=`filexp "$ans"`
  1103.     case $maildir in
  1104.       '') maildir=$dflt ;;
  1105.     esac
  1106. done
  1107.  
  1108. : find out how to find out full name
  1109. $echo " "
  1110. case "$berkname" in
  1111. define)
  1112.     dflt=y;;
  1113. undef)
  1114.     dflt=n;;
  1115. *)
  1116.     if bsd; then
  1117.     dflt=y
  1118.     else
  1119.     dflt=n
  1120.     fi
  1121.     ;;
  1122. esac
  1123. $echo "Does your /etc/passwd file keep full names in Berkeley/V7 format (name first"
  1124. $echo $n "thing after ':' in GCOS field)? [$dflt] $c"
  1125. . myread
  1126. case $ans in
  1127.   '') ans=$dflt ;;
  1128. esac
  1129. case $ans in
  1130.   y*)
  1131.     passnam=define
  1132.     berknam=define
  1133.     usgnam=undef
  1134.     nametype=bsd
  1135.     ;;
  1136.   *)
  1137.     $echo " "
  1138.     case "$usgname" in
  1139.     define)
  1140.     dflt=y;;
  1141.     undef)
  1142.     dflt=n;;
  1143.     *)
  1144.     if usg; then
  1145.         dflt=y
  1146.     else
  1147.         dflt=n
  1148.     fi
  1149.     ;;
  1150.     esac
  1151.     $echo "Does your passwd file keep full names in USG format (name sandwiched"
  1152.     $echo $n "between a '-' and a '(')? [$dflt] $c"
  1153.     . myread
  1154.     case $ans in
  1155.       '') ans=$dflt ;;
  1156.     esac
  1157.     case $ans in
  1158.       n*)
  1159.     $echo "Full name will be taken from ~/.fullname"
  1160.     passnam=undef
  1161.     berknam=undef
  1162.     usgnam=undef
  1163.     nametype=other
  1164.     ;;
  1165.       *)
  1166.     passnam=define
  1167.     berknam=undef
  1168.     usgnam=define
  1169.     nametype=usg
  1170.     ;;
  1171.     esac
  1172.     ;;
  1173. esac
  1174.  
  1175. : see if we need a special compiler
  1176. $echo " "
  1177. if usg; then
  1178.     case "$cc" in
  1179.     '')
  1180.     case "$Mcc" in
  1181.     /*) dflt='Mcc'
  1182.         ;;
  1183.     *)
  1184.         if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
  1185.         dflt='cc -M'
  1186.         else
  1187.         dflt='cc'
  1188.         fi
  1189.         ;;
  1190.     esac
  1191.     ;;
  1192.     *)  dflt="$cc";;
  1193.     esac
  1194.     $cat <<'EOM'
  1195.  
  1196. On some systems the default C compiler will not resolve multiple global
  1197. references that happen to have the same name.  On some such systems the
  1198. "Mcc" command may be used to force these to be resolved.  On other systems
  1199. a "cc -M" command is required.  What command will force resolution on
  1200. EOM
  1201.     $echo $n "this system? [$dflt] $c"
  1202.     . myread
  1203.     cc="$ans"
  1204.     case "$cc" in
  1205.     '') cc="$dflt" ;;
  1206.     esac
  1207. else
  1208.     $echo "Not a USG system--assuming cc can resolve multiple definitions."
  1209.     cc=cc
  1210. fi
  1211.  
  1212. : see if we should throw a -i into the Makefile
  1213. $echo " "
  1214. if pdp11; then
  1215.     if $contains '\-i' $mansrc/cc.1 >/dev/null 2>&1 ; then
  1216.     $echo $n "Your system appears to have separate I and D space.  Is this true? [y] $c"
  1217.     . myread
  1218.     case $ans in
  1219.         n*|f*) iandd='' ;;
  1220.         *)     iandd='-i' ;;
  1221.     esac
  1222.     else
  1223.     $echo "Your system appears to NOT have separate I and D space."
  1224.     $echo $n "Is this correct? [y] $c"
  1225.     . myread
  1226.     case $ans in
  1227.         n*|f*) iandd='-i' ;;
  1228.         *)     iandd='' ;;
  1229.     esac
  1230.     fi
  1231. else
  1232.     $echo "Not a pdp11--assuming no separate I and D."
  1233. fi
  1234.  
  1235. : index or strcpy
  1236. $echo " "
  1237. if $contains index.o libc.list >/dev/null 2>&1 ; then
  1238.     $echo "Your system appears to use index() and rindex() rather than strchr()"
  1239.     $echo $n "and strrchr().  Is this correct? [y] $c"
  1240.     . myread
  1241.     case $ans in
  1242.     n*|f*) strchr='define' ;;
  1243.     *)     strchr='undef' ;;
  1244.     esac
  1245. else
  1246.     $echo "Your system appears to use strchr() and strrchr() rather than index()"
  1247.     $echo $n "and rindex().  Is this correct? [y] $c"
  1248.     . myread
  1249.     case $ans in
  1250.     n*|f*) strchr=undef ;;
  1251.     *)     strchr=define ;;
  1252.     esac
  1253. fi
  1254.  
  1255. : determine how to determine when a file is a mailbox
  1256. case "$mboxchar" in
  1257. '') dflt=F;;
  1258. *)  dflt="$mboxchar";;
  1259. esac
  1260. $cat <<'EOM'
  1261.  
  1262. In saving articles, rn wants to differentiate between saving to mailbox
  1263. format files and normal files.  It does this by examining the first character
  1264. of the file in question.  On most systems the first line starts "From...",
  1265. so the first character is F.  On other systems there are magic cookies like
  1266. control codes between articles, so one of those would be first.  On your
  1267. system, if a file is in mailbox format, what is the first character of
  1268. EOM
  1269. $echo $n "that file? [$dflt] $c"
  1270. . myread
  1271. mboxchar="$ans"
  1272. case $mboxchar in
  1273. '') mboxchar="$dflt" ;;
  1274. esac
  1275. case $mboxchar in
  1276. 'F') ;;
  1277. *)  cat <<'EOM'
  1278. You will need to edit the shell script mbox.saver to properly append an
  1279. article to a mailbox.  The arguments to the script are documented in
  1280. EOM
  1281.     case $shsharp in
  1282.     false)
  1283.     $echo "comments in mbox.saver.std."
  1284.     ;;
  1285.     true)
  1286.     $echo "comments in the shell script itself."
  1287.     ;;
  1288.     esac
  1289. esac
  1290. $rm -f grimble
  1291. : where do we get termlib routines from
  1292. $echo " "
  1293. ans=`loc libcurses.a x /usr/lib /usr/local/lib /lib`
  1294. case "$ans" in
  1295. /*)
  1296.     ar t $ans >grimble
  1297.     if $contains tputs.o grimble >/dev/null 2>&1; then
  1298.     termlib='-lcurses'
  1299.     havetlib=define
  1300.     $echo "Terminfo library found."
  1301.     else
  1302.     ans=x
  1303.     fi
  1304.     ;;
  1305. esac
  1306. case "$ans" in
  1307. x)
  1308.     ans=`loc libtermlib.a x /usr/lib /usr/local/lib /lib`
  1309.     case "$ans" in
  1310.     /usr/lib*|/lib*)
  1311.     termlib='-ltermlib'
  1312.     havetlib=define
  1313.     $echo "Termlib library found."
  1314.     ;;
  1315.     /*)
  1316.     termlib="$ans"
  1317.     havetlib=define
  1318.     $echo "Termlib library found."
  1319.     ;;
  1320.     *)
  1321.     if xenix; then
  1322.         ans=/lib/Llibtermcap.a
  1323.     else
  1324.         ans=`loc libtermcap.a x /usr/lib /usr/local/lib /lib`
  1325.     fi
  1326.     case "$ans" in
  1327.     /usr/lib*|/lib*)
  1328.         termlib='-ltermcap'
  1329.         havetlib=define
  1330.         $echo "Termcap library found."
  1331.         ;;
  1332.     /*)
  1333.         termlib="$ans"
  1334.         havetlib=define
  1335.         $echo "Termcap library found."
  1336.         ;;
  1337.     *)
  1338.         case "$termlib" in
  1339.         '')
  1340.         $echo $n "Your system appears to NOT have termlib-style routines.  Is this true? [y] $c"
  1341.         . myread
  1342.         case $ans in
  1343.             n*|f*) havetlib=define
  1344.               $echo "Then where are the termlib-style routines kept (specify either -llibname"
  1345.               $echo $n " or full pathname (~name ok))? $c"
  1346.               . myread
  1347.               termlib=`filexp $ans`
  1348.               ;;
  1349.             *)    havetlib=undef
  1350.               termlib=''
  1351.               $echo "You will have to play around with term.c then."
  1352.               ;;
  1353.         esac
  1354.         $echo " "
  1355.         ;;
  1356.         *)  $echo "You said termlib was $termlib before."
  1357.         ;;
  1358.         esac
  1359.         ;;
  1360.     esac
  1361.     ;;
  1362.     esac
  1363.     ;;
  1364. esac
  1365. : see if there is a whoami file
  1366. if $test -r /usr/include/whoami.h ; then
  1367.     whoami=define
  1368.     $echo "whoami.h found."
  1369. else
  1370.     whoami=undef
  1371. fi
  1372.  
  1373. : see if this is a termio system
  1374. ultrix ; ultrix=$?
  1375. sun ; sun=$?
  1376. pyr ; pyr=$?
  1377. if $test -r /usr/include/termio.h -a $ultrix -ne 0 -a $sun -ne 0 -a $pyr -ne 0; then
  1378.       termio=define
  1379.       $echo "termio.h found."
  1380.   else
  1381.     if $test -r /usr/include/sgtty.h ; then
  1382.     termio=undef
  1383.     $echo "sgtty.h found."
  1384.     else
  1385.     termio=undef
  1386.     $echo "Neither termio.h nor sgtty.h found--you could have problems."
  1387.     fi
  1388. fi
  1389.  
  1390. : see if this system has fcntl
  1391. if $test -r /usr/include/fcntl.h ; then
  1392.     fcntl=define
  1393.     $echo "fcntl.h found."
  1394. else
  1395.     fcntl=undef
  1396.     $echo "No fcntl.h found, but that's ok."
  1397. fi
  1398.  
  1399. : see if ioctl defs are in sgtty/termio or sys/ioctl
  1400. if $test -r /usr/include/sys/ioctl.h ; then
  1401.     ioctl=define
  1402.     $echo "sys/ioctl.h found."
  1403. else
  1404.     ioctl=undef
  1405.     $echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
  1406. fi
  1407.  
  1408. : see if the system has sigblock
  1409. if $contains sigblock.o libc.list >/dev/null 2>&1 ; then
  1410.     $echo "sigblock() found."
  1411.     sigblock=define
  1412. else
  1413.     sigblock=undef
  1414. fi
  1415.  
  1416. : see if the system has getwd
  1417. if $contains getwd.o libc.list >/dev/null 2>&1 ; then
  1418.     $echo "getwd() found."
  1419.     getcwd=undef
  1420. else
  1421. : see if the system has getcwd
  1422. if $contains getcwd.o libc.list >/dev/null 2>&1 ; then
  1423.     $echo "getcwd() found."
  1424.     getcwd=define
  1425. else
  1426.     getcwd=undef
  1427. fi
  1428. fi
  1429.  
  1430. : see if there is a vfork
  1431. if $contains vfork.o libc.list >/dev/null 2>&1 ; then
  1432.     $echo "vfork() found."
  1433.     novfork='undef'
  1434. else
  1435.     $echo "No vfork() found--will use fork() instead."
  1436.     novfork='define'
  1437. fi
  1438.  
  1439. : see if YP could be running here
  1440. if $contains yp_master.o libc.list >/dev/null 2>&1 ; then
  1441.     $echo "YP may be running -- will use getpwent(), just in case."
  1442.     getpwent='define'
  1443. else
  1444. : see if there is a getpw
  1445. if $contains getpw.o libc.list >/dev/null 2>&1 ; then
  1446.     $echo "getpw() found."
  1447.     getpwent='undef'
  1448. else
  1449.     $echo "No getpw() found--will use getpwent() instead."
  1450.     getpwent='define'
  1451. fi
  1452. fi
  1453.  
  1454. : default
  1455. sigret=int
  1456. : determine type of signal function
  1457. if [ -f /usr/include/signal.h ]
  1458. then
  1459.     WHITE='[     ]'; : between the brackets are a tab and a space.
  1460.     if grep "$WHITE*void$WHITE*(\*signal())();" \
  1461.                     /usr/include/signal.h >/dev/null
  1462.     then
  1463.         sigret=void
  1464.     fi
  1465. fi
  1466. if [ -f /usr/include/sys/signal.h ]
  1467. then
  1468.     WHITE='[     ]'; : between the brackets are a tab and a space.
  1469.     if grep "$WHITE*void$WHITE*(\*signal())();" \
  1470.                     /usr/include/sys/signal.h >/dev/null
  1471.     then
  1472.         sigret=void
  1473.     fi
  1474. fi
  1475. $echo "signal() returns $sigret on this system"
  1476. : see how we will look up site name
  1477. douname=undef
  1478. gethostname=undef
  1479. phostname=undef
  1480. if $contains gethostname.o libc.list >/dev/null 2>&1 ; then
  1481.     $echo "gethostname() found."
  1482.     gethostname=define
  1483. else
  1484.     if $contains uname.o libc.list >/dev/null 2>&1 ; then
  1485.     $echo "uname() found."
  1486.     douname=define
  1487.     else
  1488.     case $hostcmd in
  1489.       '') ;;
  1490.       *)
  1491.         $cat <<EOT
  1492.  
  1493. There is no gethostname() or uname() on this system.  You have two
  1494. possibilites at this point:
  1495.  
  1496. 1)  You can have your site name ($sitename) compiled into rn, which lets rn
  1497.     start up faster, but makes your binaries non-portable, or
  1498. 2)  you can have rn use a
  1499.     
  1500.     popen("$hostcmd","r")
  1501.  
  1502.     which will start slower but be more portable.
  1503.  
  1504. Option 1 will use whoami.h if you have one.  If you want option 2 but with
  1505. a different command, you can edit config.h after this shell script is done.
  1506.  
  1507. EOT
  1508.         case "$phostname" in
  1509.         define) dflt=n;;
  1510.         undef)  dflt=y;;
  1511.         '')
  1512.         case $portable in
  1513.         define) dflt=n ;;
  1514.         *)      dflt=y ;;
  1515.         esac
  1516.         ;;
  1517.         esac
  1518.         $echo $n "Do you want your site name compiled in? [$dflt] $c"
  1519.         . myread
  1520.         case $ans in
  1521.         '') ans=$dflt;;
  1522.         esac
  1523.         case $ans in
  1524.           n*) phostname=define ;;
  1525.           *)  hostcmd='' phostname=undef;;
  1526.         esac
  1527.         ;;
  1528.     esac
  1529.     case $hostcmd in
  1530.       '')
  1531.         case $whoami in
  1532.           define)
  1533.         $echo 'No hostname function--using whoami.h.'
  1534.         ;;
  1535.           undef)
  1536.         $echo 'No hostname function--hardwiring "'$sitename'".'
  1537.         ;;
  1538.         esac
  1539.         ;;
  1540.     esac
  1541.     fi
  1542. fi
  1543.  
  1544. : see if we need -ljobs and if we have sigset, etc.
  1545. if $test -r /usr/lib/libjobs.a || $test -r /usr/local/lib/libjobs.a ; then
  1546.     $echo "Jobs library found."
  1547.     normsig=undef
  1548.     jobslib='-ljobs'
  1549. else
  1550.     if bsd; then
  1551.     $echo "No jobs library found.  (I suppose this is at least 4.2...)"
  1552.     else
  1553.     $echo "No jobs library found.  (That's okay, we all have our faults.)"
  1554.     fi
  1555.     normsig=define
  1556.     jobslib=''
  1557. fi
  1558. : set the right options for cc and include the x library for XENIX
  1559. if xenix; then
  1560.     if $test -d /lib/386 ; then
  1561.     iandd="-M3e"
  1562.     else
  1563.     iandd="-M2let8 -LARGE -F 3000"
  1564.     fi
  1565. jobslib=-lx
  1566. fi
  1567. : see if there are directory access routines out there
  1568. if $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a ; then
  1569.     $echo "Ndir library found."
  1570.     if $test -r /usr/lib/libndir.a; then
  1571.     ndirlib='-lndir'
  1572.     else
  1573.     ndirlib="/usr/local/lib/libndir.a"
  1574.     fi
  1575.     libndir=define
  1576.     usendir=undef
  1577.     ndirc=''
  1578.     ndiro=''
  1579.     dirtype=direct
  1580. else
  1581.     ndirlib=''
  1582.     libndir=undef
  1583.     if $contains readdir.o libc.list >/dev/null 2>&1 ; then
  1584.     $echo "No ndir library found, but you have readdir() so we'll use that."
  1585.     usendir=undef
  1586.     ndirc=''
  1587.     ndiro=''
  1588.     if sgi ; then
  1589.     dirtype=direct
  1590.     dirinc="<sys/dir.h>"
  1591.     $echo "Using direct directory structure."
  1592.     else 
  1593.         if $test -r /usr/include/dirent.h ; then
  1594.             $echo "Using dirent directory structure."
  1595.                 dirtype=dirent
  1596.             dirinc="<dirent.h>"
  1597.         else
  1598.             $echo "Using direct directory structure."
  1599.                 dirtype=direct
  1600.             dirinc="<sys/dir.h>"
  1601.         fi
  1602.     fi
  1603.      else
  1604.     $echo "No ndir library found and no readdir() found--using ./ndir.c."
  1605.     usendir=define
  1606.     ndirc='ndir.c'
  1607.     ndiro='ndir.o'
  1608.     fi
  1609. fi
  1610.  
  1611. : locate spool directory and check if rrn
  1612. case "$isrrn" in
  1613. define)
  1614.     dflt="y";;
  1615. *)
  1616.     dflt="n";;
  1617. esac
  1618. isrrn=''
  1619. while $test -z "$isrrn" ; do
  1620.     $echo " "
  1621.     $echo $n "Do you want this built as remote rn (rrn)? [$dflt] $c"
  1622.     . myread
  1623.     case "$ans" in
  1624.     '') ans="$dflt";;
  1625.     esac
  1626.     case "$ans" in
  1627.     n*)
  1628.     isrrn=undef;;
  1629.     y*)
  1630.     isrrn=define
  1631.     spool=/tmp
  1632.     $echo "net.foobar 00001 00001 y" > .falseactive
  1633.  
  1634.     case "$serverfile" in
  1635.     '')  dflt="no default" ;;
  1636.     *)   dflt="$serverfile";;
  1637.     esac
  1638.  
  1639.     $cat <<'EOM'
  1640.  
  1641. rrn determines the machine to use as a news server by two means:
  1642.  
  1643.     1. It examines the environment variable NNTPSERVER for
  1644.        a machine name; this allows users to use server machines
  1645.        other than the default.
  1646.  
  1647.     2. It looks in a file which contains the name of a server
  1648.        machine.
  1649.  
  1650. You must create the file mentioned in (2), above.  Simply put the name
  1651. of the machine you wish to use as your news server in this file.
  1652. If you really want, you can use # for comments and blank lines in
  1653. this file as well.
  1654.  
  1655. EOM
  1656.  
  1657.     ans='blurfl/dyick'
  1658.     while $test ! -r "$ans" ; do
  1659.     $echo $n "Enter the name of the news server file: [$dflt] $c"
  1660.     . myread
  1661.         case "$ans" in
  1662.         '') ans="$dflt";;
  1663.         esac
  1664.         ans=`filexp "$ans"`
  1665.         if $test ! -r $ans ; then
  1666.         $echo "Can't find $ans"
  1667.         ans='blurfl/dyick'
  1668.         fi
  1669.     done
  1670.     serverfile="$ans"
  1671.  
  1672.     case "$NNTPSRC" in
  1673.     '') dflt="no default";;
  1674.     *)  dflt="$NNTPSRC";;
  1675.     esac
  1676.  
  1677.     ans='blurfl/dyick'
  1678.     while $test ! -d "$ans"; do
  1679.         $echo $n "Enter the pathname of the NNTP source directory: [$dflt] $c"
  1680.         . myread
  1681.         case "$ans" in
  1682.         '') ans="$dflt";;
  1683.         esac
  1684.         ans=`filexp "$ans"`
  1685.         if $test ! -r $ans/common/nntp.h ; then
  1686.         $echo "Can't find $ans/common/nntp.h!"
  1687.         ans='blurfl/dyick'
  1688.         fi
  1689.     done
  1690.     NNTPSRC="$ans"
  1691. cat > server.h <<EOF_SERVE
  1692. #ifdef SERVER
  1693.  
  1694. EXT    char    *getserverbyfile();
  1695. EXT    int    server_init();
  1696. EXT    void    put_server();
  1697. EXT    int    get_server();
  1698. EXT    void    close_server();
  1699.  
  1700. #include "$NNTPSRC/common/nntp.h"
  1701. #endif
  1702. EOF_SERVE
  1703.  
  1704.     esac
  1705.  
  1706. done
  1707. : hack for Unisys NET-5000
  1708. case "$isrrn" in
  1709. define) 
  1710.     if $test -d /usr/include/NET-5000 ; then
  1711.     $echo "I sense you are on a Unisys 5000 computer...poor soul."
  1712.     rrninclude="-I/usr/include/NET-5000 -DEXCELAN -DUSG"
  1713.     socketlib=-lsocket
  1714.     fi
  1715.     ;;
  1716. *) ;;
  1717. esac
  1718.  
  1719.  
  1720. case "$spool" in
  1721. '')
  1722.     dflt=/usr/spool/news
  1723.     ;;
  1724. *)  dflt="$spool";;
  1725. esac
  1726. case "$isrrn" in
  1727. define)  ans=/tmp;;
  1728. *) ans='blurfl/dyick';;
  1729. esac
  1730. while $test ! -d $ans; do
  1731.     $echo " "
  1732.     case "$ans" in
  1733.     blurfl*);;
  1734.     *) $echo "Directory $ans not found.";;
  1735.     esac
  1736.     $echo $n "Where is news spooled (~name ok)? [$dflt] $c"
  1737.     . myread
  1738.     case "$ans" in
  1739.     '') ans="$dflt";;
  1740.     esac
  1741.     spool="$ans"
  1742.     case $spool in
  1743.     ~*)
  1744.     ans=`filexp $spool`
  1745.     $echo "(That is $ans on this particular system.)"
  1746.     case $portable in
  1747.       undef) spool=$ans ;;
  1748.     esac
  1749.     ;;
  1750.     *)
  1751.     ans=$spool
  1752.     ;;
  1753.     esac
  1754. done
  1755.  
  1756. : locate active file
  1757. case "$active" in
  1758. '')
  1759.     dflt=$lib/active
  1760.     ;;
  1761. *)  dflt="$active";;
  1762. esac
  1763. case "$isrrn" in
  1764. define) myactive=.falseactive;;
  1765. *) myactive='blurfl/dyick'
  1766. esac
  1767. while $test ! -f "$myactive"; do
  1768.     $echo " "
  1769.     case "$myactive" in
  1770.     blurfl*);;
  1771.     *) "File $myactive not found.";;
  1772.     esac
  1773.     $echo $n "Where is the active file (~name ok)? [$dflt] $c"
  1774.     . myread
  1775.     case "$ans" in
  1776.     '') ans="$dflt";;
  1777.     esac
  1778.     active="$ans"
  1779.     case $active in
  1780.     ~*)
  1781.     myactive=`filexp $active`
  1782.     $echo "(That is $myactive on this particular system.)"
  1783.     case $portable in
  1784.       undef) active=$myactive ;;
  1785.     esac
  1786.     ;;
  1787.     *)
  1788.     myactive=$active
  1789.     ;;
  1790.     esac
  1791.     if $test -d $myactive ; then
  1792.     myactive=$myactive/active
  1793.     active=$active/active
  1794.     fi
  1795. done
  1796.  
  1797. : check for 2.10.2 and above
  1798. $echo " "
  1799. if $contains ' [0-9][0-9]* [0-9]' "$myactive" >/dev/null 2>&1; then
  1800.     case "$norelay" in
  1801.     undef) dflt="y";;
  1802.     *)     dflt="n";;
  1803.     esac
  1804.     case "$isrrn" in
  1805.     define) 
  1806.        $echo "Is your NNTP server running an old version of news software," ;;
  1807.     *) $echo "Is your system running an old version of news software," ;;
  1808.     esac
  1809.     $echo $n "predating B News 2.10.3? [${dflt}] $c" 
  1810.     . myread
  1811.     case "$ans" in
  1812.     '') ans=$dflt;;
  1813.     esac
  1814.     case "$ans" in
  1815.     y*)
  1816.       norelay='undef'
  1817.     $echo "Looks like you are running at least 2.10.2 news."
  1818.       ;;
  1819.     *)  norelay='define' ;;
  1820.     esac
  1821.     mininact=define
  1822. else
  1823.     $echo "It doesn't look like you are running 2.10.2 news yet.  Are you planning"
  1824.     $echo $n "to install it in the near future? [y] $c"
  1825.     . myread
  1826.     case $ans in
  1827.     n*) mininact=undef ;;
  1828.     *)  mininact=define ;;
  1829.     esac
  1830.     norelay='undef'
  1831. fi
  1832.  
  1833.  
  1834. : check for void type
  1835. $echo " "
  1836. $echo "Checking to see if your C compiler groks the void type..."
  1837. $cat >try.c <<'EOCP'
  1838. void main();
  1839. EOCP
  1840. if cc -c try.c >/dev/null 2>&1 ; then
  1841.     novoid='undef'
  1842.     $echo "Yup, it does."
  1843. else
  1844.     novoid='define'
  1845.     $echo "Nope, it doesn't (boo hiss).  I will substitute int."
  1846. fi
  1847. $rm try.*
  1848.  
  1849. : find out which shell people like to use most
  1850. ans='blurfl/dyick'
  1851. while $test ! -f "$ans" ; do
  1852.     case $ans in
  1853.       blurfl*) ;;
  1854.       *) $echo "$ans does not appear to exist." ;;
  1855.     esac
  1856.     case "$pref" in
  1857.     '')
  1858.     if $test -f /bin/ksh; then
  1859.         dflt='/bin/ksh'
  1860.     else
  1861.         if $test -f /bin/csh; then
  1862.         dflt='/bin/csh'
  1863.         else
  1864.         dflt='/bin/sh'
  1865.         fi
  1866.     fi
  1867.     ;;
  1868.     *)  dflt="$pref";;
  1869.     esac
  1870.     $echo " "
  1871.     $echo "Give the full path name of the shell most people like to use on your"
  1872.     $echo $n "system: [$dflt] $c"
  1873.     . myread
  1874.     case $ans in
  1875.       '') ans=$dflt ;;
  1876.     esac
  1877. done
  1878. pref=$ans
  1879.  
  1880. : locate the preferred pager for this system
  1881. case "$pager" in
  1882. '')
  1883.     case $pg in
  1884.     /*) dflt=$pg
  1885.     ;;
  1886.     esac
  1887.     case $more in
  1888.     /*) dflt=$more
  1889.     ;;
  1890.     esac
  1891.     case $dflt in
  1892.     '') dflt=/usr/ucb/more
  1893.     ;;
  1894.     esac
  1895.     ;;
  1896. *)  dflt="$pager";;
  1897. esac
  1898. pager='blurfl/dyick'
  1899. while $test ! -f "$pager" ; do
  1900.     case $pager in
  1901.       blurfl*)
  1902.     $echo " "
  1903.     $echo "(If your kernel does terminal paging then you may answer this with '/bin/cat'.)"
  1904.     ;;
  1905.       /*) $echo "$pager does not appear to exist."
  1906.     $echo " "
  1907.         ;;
  1908.       *) $echo "Please give the full path name."
  1909.     $echo " "
  1910.         ;;
  1911.     esac
  1912.     $echo $n "What pager is used on your system? [$dflt] $c"
  1913.     . myread
  1914.     pager="$ans"
  1915.     case $pager in
  1916.       '') pager="$dflt" ;;
  1917.     esac
  1918. done
  1919.  
  1920. : determine default editor
  1921. case "$defeditor" in
  1922. '')
  1923.     dflt=/usr/ucb/vi
  1924.     ;;
  1925. *)  dflt="$defeditor"
  1926.     ;;
  1927. esac
  1928. defeditor='blurfl/dyick'
  1929. while $test ! -f "$defeditor" ; do
  1930.     case $defeditor in
  1931.       blurfl*) ;;
  1932.       *) $echo "$defeditor does not appear to exist." ;;
  1933.     esac
  1934.     $echo " "
  1935.     $echo $n "What is the default editor on your system? [$dflt] $c"
  1936.     . myread
  1937.     defeditor="$ans"
  1938.     case $defeditor in
  1939.       '') defeditor=$dflt ;;
  1940.     esac
  1941. done
  1942.  
  1943. : determine mailer for Rnmail to use
  1944. $echo " "
  1945. if $test -f /usr/lib/sendmail; then
  1946.     mailer=/usr/lib/sendmail
  1947. else
  1948.     if usg && $test -f $libexp/recmail; then
  1949.     mailer=$libexp/recmail
  1950.     else
  1951.     mailer=/bin/mail
  1952.     fi
  1953. fi
  1954. $echo "Mail sender is $mailer"
  1955.  
  1956. : check for internet mailer
  1957. case "$internet" in
  1958. define) dflt=y;;
  1959. undef)    dflt=n;;
  1960. *)
  1961.     case "$isrrn" in
  1962.     define) dflt=y ;;
  1963.     *) dflt=n ;;
  1964.     esac
  1965.     ;;
  1966. esac
  1967. cat <<EOM
  1968.  
  1969. Some newer mailers can deliver mail to addresses of the INTERNET persuasion,
  1970. such as user@host.UUCP.  Other older mailers require the complete path to
  1971. the destination to be specified in the address.  Does your mailer understand
  1972. EOM
  1973. $echo $n "INTERNET addresses? [$dflt] $c"
  1974. . myread
  1975. case "$ans" in
  1976. '') ans=$dflt;;
  1977. esac
  1978. case "$ans" in
  1979. y*) internet=define;;
  1980. *)  internet=undef;;
  1981. esac
  1982.  
  1983. : determine where public executables go
  1984. case "$rnbin" in
  1985. '')
  1986.     dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
  1987.     ;;
  1988. *)  dflt="$rnbin"
  1989.     ;;
  1990. esac
  1991. rnbin='blurfl/dyick'
  1992. while $test ! -d "$rnbin" ; do
  1993.     case $rnbin in
  1994.       blurfl*) ;;
  1995.       *) $echo "$rnbin does not appear to exist." ;;
  1996.     esac
  1997.     $echo " "
  1998.     $echo $n "Where do you want to put the public executables? [$dflt] $c"
  1999.     . myread
  2000.     rnbin="$ans"
  2001.     rnbin=`filexp $rnbin`
  2002.     case $rnbin in
  2003.       '') rnbin=$dflt ;;
  2004.     esac
  2005. done
  2006.  
  2007. : determine where private executables go
  2008. case "$rnlib" in
  2009. '')
  2010.     case "$isrrn" in
  2011.     define) dflt=/usr/local/lib/rn ;;
  2012.     *) dflt=$lib/rn ;;
  2013.     esac
  2014.     ;;
  2015. *)  dflt="$rnlib"
  2016.     ;;
  2017. esac
  2018. $echo " "
  2019. $echo "Rn has a number of auxiliary programs that need not be visible to the"
  2020. $echo "whole world.  Where do you want to put these private executables?"
  2021. $echo $n "[$dflt] (~name ok) $c"
  2022. . myread
  2023. rnlib="$ans"
  2024. case $rnlib in
  2025.   '') rnlib=$dflt ;;
  2026. esac
  2027. case $portable in
  2028. undef)
  2029.     rnlib=`filexp $rnlib`
  2030.     ;;
  2031. esac
  2032. : must not allow self reference
  2033. case $rnlib in
  2034.   /*)
  2035.     filexp=$rnlib/filexp
  2036.     ;;
  2037.   *)
  2038.     filexp=`pwd`/filexp
  2039.     ;;
  2040. esac
  2041.  
  2042. : get the local distribution prefixes
  2043. if $test -f $libexp/sys ; then
  2044.     $sed <$libexp/sys -n -e "s/^$sitename://p" | \
  2045.     $sed -e "s/:.*//" -e "s/,/ /g" | tr ' ' '\012' | \
  2046.     $sed -e "/^to./d" -e "/^net$/d" -e "/^fa$/d" -e "/^mod$/d" > .distlist
  2047. fi
  2048.  
  2049. $cat <<'EOH'
  2050.  
  2051. Distribution groups are the things you use on the Distribution line to limit
  2052. where an article will go to.  You are likely to be a member of several
  2053. distribution groups, such as organization, city, state, province, country,
  2054. continent, etc.  For example, Los Angeles has the distribution prefix "la",
  2055. New Jersey has the prefix "nj", and Europe has the prefix "eunet".
  2056.  
  2057. The categories you will be asked are: 
  2058.  
  2059. local organization    (Could be just one machine or a cluster or an office)
  2060. organization        att, dec, kgb, ...
  2061. city            la, ny, mosc, ...
  2062. state/province        ca, nj, bc, ...
  2063. country            usa, can, rok, whatever
  2064. continent        na (North America, not "Not Applicable"), asia, etc.
  2065.  
  2066. (If you don't have a distribution prefix in any of these categories then
  2067. just hit return.)
  2068.  
  2069. EOH
  2070. if $test -f .distlist; then
  2071.     distlist=`tr '\012' ' ' <.distlist`
  2072.     if $test "$distlist" ; then
  2073.     $echo "(These are the distributions in your sys file: $distlist)"
  2074.     $echo " "
  2075.     fi
  2076. fi
  2077. case "$locpref" in
  2078. '') dflt="";;
  2079. *)  dflt="[$locpref] ";;
  2080. esac
  2081. $echo $n "What is the distribution prefix for your local organization? $dflt$c"
  2082. . myread
  2083. case "$ans" in
  2084. '') ;;
  2085. *)  locpref="$ans";;
  2086. esac
  2087. case $locpref in
  2088.   '') locpref=none ;;
  2089. esac
  2090. case "$orgpref" in
  2091. '') dflt="";;
  2092. *)  dflt="[$orgpref] ";;
  2093. esac
  2094. $echo $n "What is the distribution prefix for your organization? $dflt$c"
  2095. . myread
  2096. case "$ans" in
  2097. '') ;;
  2098. *)  orgpref="$ans";;
  2099. esac
  2100. case $orgpref in
  2101.   '') orgpref=none ;;
  2102. esac
  2103. case "$citypref" in
  2104. '') dflt="";;
  2105. *)  dflt="[$citypref] ";;
  2106. esac
  2107. $echo $n "What is the distribution prefix for your city? $dflt$c"
  2108. . myread
  2109. case "$ans" in
  2110. '') ;;
  2111. *)  citypref="$ans";;
  2112. esac
  2113. case $citypref in
  2114.   '') citypref=none ;;
  2115. esac
  2116. case "$statepref" in
  2117. '') dflt="";;
  2118. *)  dflt="[$statepref] ";;
  2119. esac
  2120. $echo $n "What is the distribution prefix for your state/province? $dflt$c"
  2121. . myread
  2122. case "$ans" in
  2123. '') ;;
  2124. *)  statepref="$ans";;
  2125. esac
  2126. case $statepref in
  2127.   '') statepref=none ;;
  2128. esac
  2129. case "$cntrypref" in
  2130. '') dflt="";;
  2131. *)  dflt="[$cntrypref] ";;
  2132. esac
  2133. $echo $n "What is the distribution prefix for your country? $dflt$c"
  2134. . myread
  2135. case "$ans" in
  2136. '') ;;
  2137. *)  cntrypref="$ans";;
  2138. esac
  2139. case $cntrypref in
  2140.   '') cntrypref=none ;;
  2141. esac
  2142. case "$contpref" in
  2143. '') dflt="";;
  2144. *)  dflt="[$contpref] ";;
  2145. esac
  2146. $echo $n "What is the distribution prefix for your continent? $dflt$c"
  2147. . myread
  2148. case "$ans" in
  2149. '') ;;
  2150. *)  contpref="$ans";;
  2151. esac
  2152. case $contpref in
  2153.   '') contpref=none ;;
  2154. esac
  2155.  
  2156. $echo " "
  2157. $echo "If you have any other distribution groups you will need to edit Pnews"
  2158. $echo "and newsetup to add them."
  2159. $echo " "
  2160.  
  2161. : determine root id
  2162. rootid=`$sed </etc/passwd -e "/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"`
  2163. case $rootid in
  2164.   '') rootid=0 ;;
  2165.   *)  $echo "Root uid = $rootid" ;;
  2166. esac
  2167.  
  2168. : weed out incompatibilities
  2169. case $douname in
  2170.   define) whoami=undef ;;
  2171. esac
  2172.  
  2173. : preserve RCS keywords in files with variable substitution, grrr
  2174. Log='$Log'
  2175. Header='$Header'
  2176.  
  2177. : Warnings
  2178. if v7; then
  2179.     cat <<'EOM'
  2180.  
  2181. NOTE: the V7 compiler may ignore some #undefs that rn uses.  If so, you will
  2182. get messages about redefining EXT.  Some V7 compilers also have difficulties
  2183. with #defines near buffer boundaries, so beware.  You may have to play with
  2184. the spacing in common.h.
  2185. EOM
  2186. fi
  2187.  
  2188. if pdp11; then
  2189.     cat <<'EOM'
  2190.  
  2191. NOTE: the PDP-11 does not have enough data space to do subject caching
  2192. reliably.  That feature will be disabled automatically.  Subject searching
  2193. will tend to be slow.
  2194. EOM
  2195. fi
  2196. case "$isrrn" in
  2197.     define) ;;
  2198.     *) socketlib=""
  2199.        rrninclude=""
  2200.      ;;
  2201. esac
  2202.  
  2203. $echo " "
  2204. $echo "End of configuration questions."
  2205. $echo " "
  2206.  
  2207. : create config.sh file
  2208. $echo " "
  2209. $echo "Creating config.sh..."
  2210. $spitshell <<EOT >config.sh
  2211. $startsh
  2212. # config.sh
  2213. # This file was produced by running the Configure script.
  2214.  
  2215. n='$n'
  2216. c='$c'
  2217. libc='$libc'
  2218. eunicefix='$eunicefix'
  2219. eunice='$eunice'
  2220. cpp='$cpp'
  2221. shsharp='$shsharp'
  2222. startsh='$startsh'
  2223. spitshell='$spitshell'
  2224. test='$test'
  2225. expr='$expr'
  2226. sed='$sed'
  2227. echo='$echo'
  2228. cat='$cat'
  2229. rm='$rm'
  2230. mv='$mv'
  2231. cp='$cp'
  2232. tail='$tail'
  2233. tr='$tr'
  2234. mkdir='$mkdir'
  2235. sort='$sort'
  2236. uniq='$uniq'
  2237. inews='$inews'
  2238. grep='$grep'
  2239. egrep='$egrep'
  2240. ypmatch='$ypmatch'
  2241. contains='$contains'
  2242. lib='$lib'
  2243. libexp='$libexp'
  2244. nametype='$nametype'
  2245. cc='$cc'
  2246. iandd='$iandd'
  2247. include='$include'
  2248. rrninclude='$rrninclude'
  2249. termlib='$termlib'
  2250. jobslib='$jobslib'
  2251. socketlib='$socketlib'
  2252. getcwd='$getcwd'
  2253. dirtype='$dirtype'
  2254. ndirlib='$ndirlib'
  2255. libndir='$libndir'
  2256. usendir='$usendir'
  2257. ndirc='$ndirc'
  2258. ndiro='$ndiro'
  2259. pager='$pager'
  2260. mailer='$mailer'
  2261. internet='$internet'
  2262. rnbin='$rnbin'
  2263. filexp='$filexp'
  2264. distlist='$distlist'
  2265. Log='$Log'
  2266. Header='$Header'
  2267. sitename='$sitename'
  2268. domain='$domain'
  2269. orgname='$orgname'
  2270. isadmin='$isadmin'
  2271. newsadmin='$newsadmin'
  2272. rnlib='$rnlib'
  2273. mansrc='$mansrc'
  2274. manext='$manext'
  2275. maildir='$maildir'
  2276. spool='$spool'
  2277. active='$active'
  2278. myactive='$myactive'
  2279. mininact='$mininact'
  2280. pref='$pref'
  2281. defeditor='$defeditor'
  2282. rootid='$rootid'
  2283. mboxchar='$mboxchar'
  2284. locpref='$locpref'
  2285. orgpref='$orgpref'
  2286. citypref='$citypref'
  2287. statepref='$statepref'
  2288. cntrypref='$cntrypref'
  2289. contpref='$contpref'
  2290. strchr='$strchr'
  2291. novoid='$novoid'
  2292. novfork='$novfork'
  2293. portable='$portable'
  2294. passnam='$passnam'
  2295. berknam='$berknam'
  2296. usgnam='$usgnam'
  2297. whoami='$whoami'
  2298. termio='$termio'
  2299. fcntl='$fcntl'
  2300. ioctl='$ioctl'
  2301. normsig='$normsig'
  2302. sigblock='$sigblock'
  2303. sigret='$sigret'
  2304. getuidgid='$getuidgid'
  2305. havetlib='$havetlib'
  2306. getpwent='$getpwent'
  2307. gethostname='$gethostname'
  2308. douname='$douname'
  2309. phostname='$phostname'
  2310. hostcmd='$hostcmd'
  2311. norelay='$norelay'
  2312. rdchk='$rdchk'
  2313. isrrn='$isrrn'
  2314. serverfile='$serverfile'
  2315. NNTPSRC='$NNTPSRC'
  2316. CONFIG=true
  2317. EOT
  2318.  
  2319. : create config.h file
  2320. $echo " "
  2321. $echo "Creating config.h..."
  2322. $cat <<EOT >config.h
  2323. /* config.h
  2324.  * This file was produced by running the Configure script.
  2325.  * Feel free to modify any of this as the need arises.
  2326.  */
  2327.  
  2328. /* name of the site.  May be overridden by gethostname, uname, etc. */
  2329. #define SITENAME "$sitename"
  2330.  
  2331. /* name of the organization, may be a file name */
  2332. #define ORGNAME "$orgname"
  2333.  
  2334. /* login name of news administrator, if any. */
  2335. #$isadmin NEWSADMIN "$newsadmin"
  2336.  
  2337. /* news library, may use only ~ and %l expansion */
  2338. #define LIB "$lib"
  2339.  
  2340. /* rn private library, may use ~ expansion, %x and %l */
  2341. #define RNLIB "$rnlib"
  2342.  
  2343. /* location of the news spool directory, may use ~ expansion, %x and %l */
  2344. #define SPOOL "$spool"
  2345.  
  2346. /* location of the active file, may use ~ expansion, %x and %l */
  2347. #define ACTIVE "$active"
  2348.  
  2349. /* location of spooled mail */
  2350. #define MAILFILE "$maildir/%L"
  2351.  
  2352. /* default shell--ok to be a slow shell like csh */
  2353. #define PREFSHELL "$pref"
  2354.  
  2355. /* default editor */
  2356. #define DEFEDITOR "$defeditor"
  2357.  
  2358. /* root uid */
  2359. #define ROOTID $rootid
  2360.  
  2361. /* what is the first character of a mailbox? */
  2362. #define MBOXCHAR '$mboxchar'
  2363.  
  2364. /* how to cancel an article */
  2365. #define CANCEL "$inews -h <%h"
  2366.  
  2367. /* distribution groups */
  2368. #define LOCDIST "$locpref"
  2369. #define ORGDIST "$orgpref"
  2370. #define CITYDIST "$citypref"
  2371. #define STATEDIST "$statepref"
  2372. #define CNTRYDIST "$cntrypref"
  2373. #define CONTDIST "$contpref"
  2374.  
  2375. #$strchr    index strchr    /* cultural */
  2376. #$strchr    rindex strrchr    /*  differences? */
  2377. #$novoid    void int    /* is void to be avoided? */
  2378. #$novfork    vfork fork    /* is vfork too virtual? */
  2379. #$eunice    EUNICE        /* no linking? */
  2380. #$eunice    VMS        /* not currently used, here just in case */
  2381. #$getcwd    GETCWD        /* do we have getcwd()? */
  2382. #$usendir    USENDIR        /* include ndir.c? */
  2383. #$libndir    LIBNDIR        /* include /usr/include/ndir.h? */
  2384. #define        DIRTYPE   $dirtype
  2385. #ifndef USENDIR
  2386. #define        DIRINC      $dirinc
  2387. #endif
  2388. #$mininact    MININACT    /* include 2.10.2 optimization? */
  2389. #$portable    PORTABLE    /* do we do extra lookups to start up? */
  2390. #$passnam    PASSNAMES    /* do names come from the passwd file? */
  2391.                 /*  (undef to take name from ~/.fullname) */
  2392. #$berknam    BERKNAMES    /* if so, are they Berkeley format? */
  2393.                 /* (that is, ":name,stuff:") */
  2394. #$usgnam    USGNAMES    /* or are they USG format? */
  2395.                 /* (that is, ":stuff-name(stuff):") */
  2396. #$whoami    WHOAMI        /* should we include whoami.h? */
  2397. #$rdchk        RDCHK        /* do we have rdchk()? */
  2398. #$termio    TERMIO        /* is this a termio system? */
  2399. #$fcntl        FCNTL        /* should we include fcntl.h? */
  2400. #$ioctl        IOCTL        /* are ioctl args all defined in one place? */
  2401. #$normsig    NORMSIG        /* use signal rather than sigset? */
  2402. #$sigblock    SIGBLOCK    /* use sigblock and sigsetmask */
  2403. #define            SIGRET    $sigret    /* what does signal() return? */
  2404. #$havetlib    HAVETERMLIB    /* do we have termlib-style routines? */
  2405. #$getuidgid    GETUIDGID    /* allow setuid (if possible) */
  2406. #$getpwent    GETPWENT    /* should we include getpwent? */
  2407. #$internet    INTERNET    /* does our mailer do INTERNET addressing? */
  2408. #$gethostname    GETHOSTNAME    /* do we have a gethostname function? */
  2409. #$douname    DOUNAME        /* do we have a uname function? */
  2410. #$phostname    PHOSTNAME "$hostcmd"    /* how to get host name with popen */
  2411. #$norelay     NORELAY         /* 2.10.3 doesn't have Relay-Version line */
  2412. #$isrrn         SERVER          /* rrn server code */
  2413. #$isrrn SERVER_FILE    "$serverfile"
  2414. EOT
  2415.  
  2416. CONFIG=true
  2417.  
  2418. $rm -f libc.list .distlist kit*isdone 
  2419.  
  2420. $echo " "
  2421. $echo "Doing variable substitutions on various files..."
  2422. $echo " "
  2423. set `$grep <MANIFEST '\.SH' | awk '{print $1}'`
  2424. for file in $*; do
  2425.     . $file
  2426. done
  2427.  
  2428. $echo " "
  2429. $echo 'Now you need to generate make dependencies by running "makedepend".'
  2430. $echo 'You might prefer to run it in background: "makedepend > makedepend.out &"'
  2431. $echo $n "Would you like me to run it for you (it takes quite a while)? [n] $c" 
  2432. . myread
  2433. case "$ans" in
  2434. y*) makedepend;;
  2435. esac
  2436. $rm -f myread
  2437. : end of Configure
  2438.