home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume27 / trn-3.3 / part11 / Configure
Text File  |  1993-11-27  |  94KB  |  4,302 lines

  1. #! /bin/sh
  2. #
  3. # If these # comments don't work, trim them.  Don't worry about any other
  4. # shell scripts, Configure will trim # comments from them for you.
  5. #
  6. # (If you are trying to port this package to a machine without sh,
  7. # I would suggest you have a look at the prototypical config.h.SH file
  8. # and edit it to reflect your system. Some packages may include samples
  9. # of config.h for certain machines, so you might look for one of those.)
  10. #
  11. # Yes, you may rip this off to use in other distribution packages. This
  12. # script belongs to the public domain and cannot be copyrighted.
  13. #
  14. # (Note: this Configure script was generated automatically. Rather than
  15. # working with this copy of Configure, you may wish to get metaconfig.
  16. # Write to either:
  17. #
  18. #     harlan@mumps.pfcs.com (Harlan Stenn)
  19. #     ram@acri.fr (Raphael Manfredi)
  20. #
  21. # and we will send you -or point you to- the latest revision of the dist
  22. # package, which includes metaconfig.)
  23. #
  24.  
  25. # $Id: Head.U,v 2.8 91/07/08 13:30:13 ram Exp Locker: ram $
  26. #
  27. # Generated on Sun Aug 15 13:19:02 PDT 1993 [metaconfig 2.9dev PL20]
  28.  
  29. cat >/tmp/c1$$ <<EOF
  30. ARGGGHHHH!!!!!
  31.  
  32. SCO csh still thinks true is false.  Write to SCO today and tell them that next
  33. year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
  34.  
  35. (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
  36. we'd have to do is go in and swap the && and || tokens, wherever they are.)
  37.  
  38. [End of diatribe. We now return you to your regularly scheduled programming...]
  39. EOF
  40. cat >/tmp/c2$$ <<EOF
  41.  
  42. OOPS!  You naughty creature!  You didn't run Configure with sh!
  43. I will attempt to remedy the situation by running sh for you...
  44. EOF
  45.  
  46. true || cat /tmp/c1$$ /tmp/c2$$
  47. true || exec sh $0 $argv:q
  48.  
  49. (exit $?0) || cat /tmp/c2$$
  50. (exit $?0) || exec sh $0 $argv:q
  51. rm -f /tmp/c1$$ /tmp/c2$$
  52.  
  53. : Sanity checks
  54. PATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin"
  55. PATH=$PATH:'/usr/5bin:/etc:/usr/gnu/bin:/usr/new:/usr/new/bin:/usr/nbin'
  56. PATH=$PATH:'/sys5.3/bin:/sys5.3/usr/bin:/bsd4.3/bin:/bsd4.3/usr/ucb'
  57. PATH=$PATH:'/bsd4.3/usr/bin:/usr/bsd:/bsd43/bin:/usr/ccs/bin'
  58. PATH=$PATH:'/etc:/usr/lib:/usr/ucblib:/lib:/usr/ccs/lib'
  59. export PATH
  60.  
  61. if test ! -t 0; then
  62.     echo "Say 'sh Configure', not 'sh <Configure'"
  63.     exit 1
  64. fi
  65.  
  66. : On HP-UX, large Configure scripts may exercise a bug in /bin/sh
  67. if test -f /hp-ux -a -x /bin/ksh >/dev/null 2>&1; then
  68.     if (alias -x) >/dev/null 2>&1; then
  69.         : already under /bin/ksh
  70.     else
  71.         cat <<'EOM'
  72. (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
  73. EOM
  74.         exec /bin/ksh $0 "$@"
  75.     fi
  76. else
  77.     : Warn them if they use ksh on other systems
  78.     (alias -x) >/dev/null 2>&1 && \
  79.         cat <<'EOM'
  80. (I see you are using the Korn shell.  Some ksh's blow up on Configure,
  81. especially on exotic machines.  If yours does, try the Bourne shell instead.)
  82. EOM
  83. fi
  84.  
  85. : Configure runs within the UU subdirectory
  86. test -d UU || mkdir UU
  87. cd UU && rm -f *
  88.  
  89. cf_by=''
  90. cf_time=''
  91. d_bsd=''
  92. d_eunice=''
  93. d_xenix=''
  94. eunicefix=''
  95. Mcc=''
  96. awk=''
  97. bash=''
  98. bison=''
  99. cat=''
  100. chgrp=''
  101. chmod=''
  102. chown=''
  103. compress=''
  104. cpp=''
  105. csh=''
  106. date=''
  107. echo=''
  108. egrep=''
  109. emacs=''
  110. expr=''
  111. flex=''
  112. gcc=''
  113. grep=''
  114. inews=''
  115. ispell=''
  116. ksh=''
  117. less=''
  118. line=''
  119. lint=''
  120. ln=''
  121. lp=''
  122. lpr=''
  123. ls=''
  124. mail=''
  125. mailx=''
  126. make=''
  127. metamail=''
  128. mhn=''
  129. mkdir=''
  130. more=''
  131. mv=''
  132. nroff=''
  133. perl=''
  134. pg=''
  135. pmake=''
  136. pr=''
  137. rm=''
  138. rmail=''
  139. sed=''
  140. sendmail=''
  141. sh=''
  142. shar=''
  143. sleep=''
  144. smail=''
  145. sort=''
  146. submit=''
  147. tail=''
  148. tar=''
  149. tbl=''
  150. test=''
  151. touch=''
  152. tr=''
  153. troff=''
  154. uname=''
  155. uniq=''
  156. uuname=''
  157. vi=''
  158. zcat=''
  159. hint=''
  160. myuname=''
  161. Author=''
  162. Date=''
  163. Header=''
  164. Id=''
  165. Locker=''
  166. Log=''
  167. RCSfile=''
  168. Revision=''
  169. Source=''
  170. State=''
  171. active=''
  172. acttimes=''
  173. d_acttimes=''
  174. myactive=''
  175. bin=''
  176. installbin=''
  177. cc=''
  178. ccflags=''
  179. cppflags=''
  180. ldflags=''
  181. lkflags=''
  182. optimize=''
  183. contains=''
  184. cppminus=''
  185. cppstdin=''
  186. d_ftime=''
  187. aphostcmd=''
  188. d_gethname=''
  189. d_phostcmd=''
  190. d_uname=''
  191. d_getpwent=''
  192. d_getcwd=''
  193. d_getwd=''
  194. d_havetlib=''
  195. termlib=''
  196. d_ignoreorg=''
  197. d_internet=''
  198. d_memcmp=''
  199. d_memcpy=''
  200. d_memset=''
  201. d_mime=''
  202. mimeshow=''
  203. mimestore=''
  204. d_newsadm=''
  205. newsadmin=''
  206. d_nntp=''
  207. d_xdata=''
  208. servername=''
  209. d_nolnbuf=''
  210. d_normsig=''
  211. jobslib=''
  212. d_hvfork=''
  213. d_novfork=''
  214. d_novoid=''
  215. void=''
  216. d_portable=''
  217. d_rdchk=''
  218. d_rename=''
  219. d_sigblock=''
  220. d_sighold=''
  221. d_sizet=''
  222. d_strcasecmp=''
  223. d_strchr=''
  224. d_strftime=''
  225. strftimec=''
  226. strftimeo=''
  227. d_libndir=''
  228. d_usendir=''
  229. libndir=''
  230. ndirc=''
  231. ndiro=''
  232. d_voidsig=''
  233. signal_t=''
  234. defeditor=''
  235. filexp=''
  236. d_dirnamlen=''
  237. i_dirent=''
  238. i_ptem=''
  239. i_stdlib=''
  240. i_string=''
  241. strings=''
  242. i_sysdir=''
  243. d_voidtty=''
  244. i_bsdioctl=''
  245. i_sysioctl=''
  246. i_syssockio=''
  247. i_sysndir=''
  248. i_sgtty=''
  249. i_termio=''
  250. i_termios=''
  251. i_systime=''
  252. i_time=''
  253. i_unistd=''
  254. i_vfork=''
  255. ispell_options=''
  256. ispell_prg=''
  257. libc=''
  258. plibpth=''
  259. xlibpth=''
  260. libs=''
  261. citydist=''
  262. cntrydist=''
  263. contdist=''
  264. locdist=''
  265. orgdist=''
  266. statedist=''
  267. mailer=''
  268. mailfile=''
  269. manext=''
  270. mansrc=''
  271. mboxchar=''
  272. c=''
  273. n=''
  274. d_berknames=''
  275. d_passnames=''
  276. d_usgnames=''
  277. nametype=''
  278. inewsloc=''
  279. newslib=''
  280. newslibexp=''
  281. newsspool=''
  282. orgname=''
  283. package=''
  284. pager=''
  285. phost=''
  286. phostcmd=''
  287. prefshell=''
  288. installprivlib=''
  289. privlib=''
  290. rootid=''
  291. sharpbang=''
  292. shsharp=''
  293. spitshell=''
  294. startsh=''
  295. sysman=''
  296. d_usemt=''
  297. d_useov=''
  298. overviewdir=''
  299. threaddir=''
  300. trn_init=''
  301. trn_select=''
  302. nm_opt=''
  303. runnm=''
  304. usenm=''
  305. incpath=''
  306. mips=''
  307. mips_type=''
  308. usrinc=''
  309. d_whoami=''
  310. i_sysfile=''
  311. i_sysselct=''
  312. large=''
  313. CONFIG=''
  314.  
  315. : script used to extract .SH files with variable substitutions
  316. cat >extract <<'EOS'
  317. CONFIG=true
  318. echo "Doing variable substitutions on .SH files..."
  319. if test -f MANIFEST; then
  320.     set x `awk '{print $1}' <MANIFEST | grep '\.SH'`
  321. else
  322.     echo "(Looking for .SH files under the current directory.)"
  323.     set x `find . -name "*.SH" -print`
  324. fi
  325. shift
  326. case $# in
  327. 0) set x *.SH; shift;;
  328. esac
  329. if test ! -f $1; then
  330.     shift
  331. fi
  332. for file in $*; do
  333.     case "$file" in
  334.     */*)
  335.         dir=`expr X$file : 'X\(.*\)/'`
  336.         file=`expr X$file : 'X.*/\(.*\)'`
  337.         (cd $dir && . ./$file)
  338.         ;;
  339.     *)
  340.         . ./$file
  341.         ;;
  342.     esac
  343. done
  344. EOS
  345.  
  346. : process the command line options
  347. set X `for arg in "$@"; do echo $arg; done | awk '
  348. BEGIN {
  349.     optstr = "deEf:hrsSV";    # getopt-style specification
  350.  
  351.     len = length(optstr);
  352.     for (i = 1; i <= len; i++) {
  353.         c = substr(optstr, i, 1);
  354.         if (i < len) a = substr(optstr, i + 1, 1); else a = "";
  355.         if (a == ":") {
  356.             arg[c] = 1;
  357.             i++;
  358.         }
  359.         opt[c] = 1;
  360.     }
  361. }
  362. {
  363.     expect = 0;
  364.     str = $0;
  365.     if (substr(str, 1, 1) != "-") {
  366.         printf("'"'%s'"'\n", str);
  367.         next;
  368.     }
  369.     len = length($0);
  370.     for (i = 2; i <= len; i++) {
  371.         c = substr(str, i, 1);
  372.         if (!opt[c]) {
  373.             printf("-%s\n", substr(str, i));
  374.             next;
  375.         }
  376.         printf("-%s\n", c);
  377.         if (arg[c]) {
  378.             if (i < len)
  379.                 printf("'"'%s'"'\n", substr(str, i + 1));
  380.             else
  381.                 expect = 1;
  382.             next;
  383.         }
  384.     }
  385. }
  386. END {
  387.     if (expect)
  388.         print "?";
  389. }
  390. '`
  391. eval "set $*"
  392. shift
  393.         
  394. : set up default values
  395. fastread=''
  396. reuseval=false
  397. config_sh=''
  398. alldone=''
  399. error=''
  400. silent=''
  401. extractsh=''
  402.  
  403. : option parsing
  404. while test $# -gt 0; do
  405.     case "$1" in
  406.     -d) shift; fastread=yes;;
  407.     -e) shift; alldone=cont;;
  408.     -f)
  409.         shift
  410.         cd ..
  411.         if test -r "$1"; then
  412.             config_sh="$1"
  413.         else
  414.             echo "Configure: cannot read config file $1." >&2
  415.             error=true
  416.         fi
  417.         cd UU
  418.         shift;;
  419.     -h) shift; error=true;;
  420.     -r) shift; reuseval=true;;
  421.     -s) shift; silent=true;;
  422.     -E) shift; alldone=exit;;
  423.     -S) shift; extractsh=true;;
  424.     -V) echo "Configure generated by metaconfig 2.9dev PL20." >&2
  425.         exit 0;;
  426.     --) break;;
  427.     -*) echo "Configure: unknown option $1" >&2; shift; error=true;;
  428.     *) break;;
  429.     esac
  430. done
  431.  
  432. case "$error" in
  433. true)
  434.     cat >&2 <<EOM
  435. Usage: Configure [-dehrESV] [-f config.sh]
  436.   -d : use defaults for all answers.
  437.   -e : go on without questioning past the production of config.sh.
  438.   -f : specify an alternate default configuration file.
  439.   -h : print this help message and exit (with an error status).
  440.   -r : reuse C symbols value if possible (skips costly nm extraction).
  441.   -s : silent mode, only echoes questions and essential information.
  442.   -E : stop at the end of questions, after having produced config.sh.
  443.   -S : perform variable substitutions on all .SH files (can mix with -f)
  444.   -V : print version number and exit (with a zero status).
  445. EOM
  446.     exit 1
  447.     ;;
  448. esac
  449.  
  450. exec 4>&1
  451. case "$silent" in
  452. true) exec 1>/dev/null;;
  453. esac
  454.  
  455. case "$extractsh" in
  456. true)
  457.     case "$config_sh" in
  458.     '') config_sh='config.sh'; config='./config.sh';;
  459.     /*) config="$config_sh";;
  460.     *) config="./$config_sh";;
  461.     esac
  462.     echo " "
  463.     echo "Fetching answers from $config_sh..."
  464.     cd ..
  465.     . $config
  466.     echo " "
  467.     . ./UU/extract
  468.     rm -rf UU
  469.     echo "Done."
  470.     exit 0
  471.     ;;
  472. esac
  473.  
  474. : set package name
  475. package=trn
  476. Package=Trn
  477.  
  478. : Eunice requires " " instead of "", can you believe it
  479. echo " "
  480. : Here we go...
  481. echo "Beginning of configuration questions for $package."
  482.  
  483. define='define'
  484. undef='undef'
  485. smallmach='pdp11 i8086 z8000 i80286 iAPX286'
  486. rmlist=''
  487.  
  488. trap 'echo " "; rm -rf $rmlist; exit 1' 1 2 3 15
  489.  
  490. : We must find out about Eunice early
  491. eunicefix=':'
  492. if test -f /etc/unixtovms; then
  493.     eunicefix=/etc/unixtovms
  494. fi
  495. if test -f /etc/unixtovms.exe; then
  496.     eunicefix=/etc/unixtovms.exe
  497. fi
  498.  
  499. : list of known cpp symbols
  500. attrlist="__alpha DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__"
  501. attrlist="$attrlist _AIX __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
  502. attrlist="$attrlist hp9000s300 hp9000s400 hp9000s500 hp9000s700"
  503. attrlist="$attrlist hp9000s800 hpux"
  504. attrlist="$attrlist i186 i386 i486 i8086 iAPX286 ibm interdata"
  505. attrlist="$attrlist m88k mc300 mc500 mc68000 mc68k mc700 mert"
  506. attrlist="$attrlist mips NeXT ns16000 ns32000 nsc32000 os"
  507. attrlist="$attrlist __osf__ pdp11 posix"
  508. attrlist="$attrlist pyr sinix sony sparc sun tower tower32 tower32_600"
  509. attrlist="$attrlist tower32_800 tss u3b2 u3b20 u3b200 u3b5 ultrix unix"
  510. attrlist="$attrlist __unix__ vax venix xenix z8000"
  511.  
  512. : change the next line if compiling for Xenix/286 on Xenix/386
  513. xlibpth='/usr/lib/386 /lib/386'
  514.  
  515. : general looking path for locating libraries
  516. libpth='/usr/lib/large /lib /lib/large /usr/lib/small /lib/small'
  517.  
  518. : no include file wanted by default
  519. inclwanted='/usr/include/NET-5000'
  520.  
  521. libswanted='malloc bsd socket bsdipc sun net hdb bbn str nls nsl c_s intl x ucb'
  522.  
  523. : Some greps do not return status, grrr.
  524. echo "grimblepritz" >grimble
  525. if grep blurfldyick grimble >/dev/null 2>&1 ; then
  526.     contains=contains
  527. elif grep grimblepritz grimble >/dev/null 2>&1 ; then
  528.     contains=grep
  529. else
  530.     contains=contains
  531. fi
  532. rm -f grimble
  533. : the following should work in any shell
  534. case "$contains" in
  535. contains*)
  536.     echo " "
  537.     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  538.     cat >contains <<'EOSS'
  539. grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  540. EOSS
  541. chmod +x contains
  542. esac
  543.  
  544. : first determine how to suppress newline on echo command
  545. echo " "
  546. echo "Checking echo to see how to suppress newlines..."
  547. (echo "hi there\c" ; echo " ") >.echotmp
  548. if $contains c .echotmp >/dev/null 2>&1 ; then
  549.     echo "...using -n."
  550.     n='-n'
  551.     c=''
  552. else
  553.     cat <<'EOM'
  554. ...using \c
  555. EOM
  556.     n=''
  557.     c='\c'
  558. fi
  559. echo $n "The star should be here-->$c"
  560. echo '*'
  561. rm -f .echotmp
  562.  
  563. : Now test for existence of everything in MANIFEST
  564. echo " "
  565. if test -f ../MANIFEST; then
  566.     echo "First let's make sure your kit is complete.  Checking..." >&4
  567.     awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
  568.     rm -f missing
  569.     for filelist in x??; do
  570.         (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
  571.     done
  572.     if test -s missing; then
  573.         cat missing >&4
  574.         cat >&4 <<'EOM'
  575.  
  576. THIS PACKAGE SEEMS TO BE INCOMPLETE.
  577.  
  578. You have the option of continuing the configuration process, despite the
  579. distinct possibility that your kit is damaged, by typing 'y'es.  If you
  580. do, don't blame me if something goes wrong.  I advise you to type 'n'o
  581. and contact the author (davison@borland.com).
  582.  
  583. EOM
  584.         echo $n "Continue? [n] $c" >&4
  585.         read ans
  586.         case "$ans" in
  587.         y*)
  588.             echo "Continuing..." >&4
  589.             rm -f missing
  590.             ;;
  591.         *)
  592.             echo "ABORTING..." >&4
  593.             kill $$
  594.             ;;
  595.         esac
  596.     else
  597.         echo "Looks good..." >&4
  598.     fi
  599. else
  600.     echo "There is no MANIFEST file.  I hope your kit is complete !"
  601. fi
  602. rm -f missing x??
  603.  
  604. : compute the number of columns on the terminal for proper question formatting
  605. case "$COLUMNS" in
  606. '') COLUMNS='80';;
  607. esac
  608.  
  609. : set up the echo used in my read
  610. myecho="case \"\$xxxm\" in
  611. '') echo $n \"\$rp $c\" >&4;;
  612. *) case \"\$rp\" in
  613.     '') echo $n \"[\$xxxm] $c\";;
  614.     *)
  615.         if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
  616.             echo \"\$rp\" >&4
  617.             echo $n \"[\$xxxm] $c\" >&4
  618.         else
  619.             echo $n \"\$rp [\$xxxm] $c\" >&4
  620.         fi
  621.         ;;
  622.     esac;;
  623. esac"
  624.  
  625. : now set up to do reads with possible shell escape and default assignment
  626. cat <<EOSC >myread
  627. xxxm=\$dflt
  628. $myecho
  629. ans='!'
  630. case "\$fastread" in
  631. yes) case "\$dflt" in
  632.     '') ;;
  633.     *) ans='';
  634.         case "\$silent-\$rp" in
  635.         true-) ;;
  636.         *) echo " " >&4;;
  637.         esac;;
  638.     esac;;
  639. *) case "\$silent" in
  640.     true) case "\$rp" in
  641.         '') ans='';;
  642.         esac;;
  643.     esac;;
  644. esac
  645. while expr "X\$ans" : "X!" >/dev/null; do
  646.     read answ
  647.     set x \$xxxm
  648.     shift
  649.     aok=''; eval "ans=\"\$answ\"" && aok=y
  650.     case  "\$answ" in
  651.     "\$ans")
  652.         case "\$ans" in
  653.         "!")
  654.             sh 1>&4
  655.             echo " "
  656.             $myecho
  657.             ;;
  658.         !*)
  659.             set x \`expr "X\$ans" : "X!\(.*\)\$"\`
  660.             shift
  661.             sh 1>&4 -c "\$*"
  662.             echo " "
  663.             $myecho
  664.             ;;
  665.         esac;;
  666.     *)
  667.         case "\$aok" in
  668.         y)
  669.             echo "*** Substitution done -- please confirm."
  670.             xxxm="\$ans"
  671.             ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
  672.             xxxm="\$ans"
  673.             ans=!
  674.             ;;
  675.         *)
  676.             echo "*** Error -- try again."
  677.             ans=!
  678.             ;;
  679.         esac
  680.         $myecho
  681.         ;;
  682.     esac
  683. done
  684. case "\$ans" in
  685. '') ans="\$xxxm";;
  686. esac
  687. EOSC
  688.  
  689. : see if sh knows # comments
  690. echo " "
  691. echo "Checking your sh to see if it knows about # comments..." >&4
  692. if sh -c '#' >/dev/null 2>&1 ; then
  693.     echo "Your sh handles # comments correctly."
  694.     shsharp=true
  695.     spitshell=cat
  696.     echo " "
  697.     echo "Okay, let's see if #! works on this system..."
  698.     echo "#!/bin/cat" >try
  699.     $eunicefix try
  700.     chmod +x try
  701.     ./try > today
  702.     if test -s today; then
  703.         echo "It does."
  704.         sharpbang='#!'
  705.     else
  706.         echo "#! /bin/cat" > try
  707.         $eunicefix try
  708.         chmod +x try
  709.         ./try > today
  710.         if test -s today; then
  711.             echo "It does."
  712.             sharpbang='#! '
  713.         else
  714.             echo "It's just a comment."
  715.             sharpbang=': use '
  716.         fi
  717.     fi
  718. else
  719.     echo "Your sh doesn't grok # comments--I will strip them later on."
  720.     shsharp=false
  721.     echo "exec grep -v '^[     ]*#'" >spitshell
  722.     chmod +x spitshell
  723.     $eunicefix spitshell
  724.     spitshell=`pwd`/spitshell
  725.     echo "I presume that if # doesn't work, #! won't work either!"
  726.     sharpbang=': use '
  727. fi
  728. rm -f try today
  729.  
  730. : figure out how to guarantee sh startup
  731. echo " "
  732. echo "Checking out how to guarantee sh startup..." >&4
  733. case "$SYSTYPE" in
  734. *bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
  735. *) startsh=$sharpbang'/bin/sh';;
  736. esac
  737. echo "Let's see if '$startsh' works..."
  738. cat >try <<EOSS
  739. $startsh
  740. set abc
  741. test "$?abc" != 1
  742. EOSS
  743.  
  744. chmod +x try
  745. $eunicefix try
  746. if ./try; then
  747.     echo "Yup, it does."
  748. else
  749. echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  750. fi
  751. rm -f try
  752.  
  753. : general instructions
  754. cat <<EOH
  755.  
  756. This installation shell script will examine your system and ask you questions
  757. to determine how the trn package should be installed.  If you get stuck
  758. on a question, you may use a ! shell escape to start a subshell or execute a
  759. command.  Many of the questions will have default answers in square brackets;
  760. typing carriage return will give you the default.
  761.  
  762. On some of the questions which ask for file or directory names you are allowed
  763. to use the ~name construct to specify the login directory belonging to "name",
  764. even if you don't have a shell which knows about that.  Questions where this is
  765. allowed will be marked "(~name ok)".
  766.  
  767. EOH
  768. rp=''
  769. dflt='Type carriage return to continue'
  770. . ./myread
  771. cat <<'EOH'
  772.  
  773. The prompter used in this script allows you to use shell variables and
  774. backticks in your answers.  You may use $1, $2, etc...  to refer to the words
  775. in the default answer, as if the default line was a set of arguments given to a
  776. script shell.  This means you may also use $* to repeat the whole default line,
  777. so you do not have to re-type everything to add something to the default.
  778.  
  779. Everytime there is a substitution, you will have to confirm.  If there is an
  780. error (e.g. an unmatched backtick), the default answer will remain unchanged
  781. and you will be prompted again.
  782.  
  783. If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
  784. the questions and use the computed defaults (or the previous answers if there
  785. was already a config.sh file).
  786.  
  787. EOH
  788. . ./myread
  789. cat <<EOH
  790.  
  791. Much effort has been expended to ensure that this shell script will run on any
  792. Unix system.  If despite that it blows up on yours, your best bet is to edit
  793. Configure and run it again.  Also, let me (davison@borland.com)
  794. know how I blew it.  If you can't run Configure for some reason, you'll have to
  795. generate a config.sh file by hand.
  796.  
  797. This installation script affects things in two ways:
  798.  
  799. 1) it may do direct variable substitutions on some of the files included
  800.    in this kit.
  801. 2) it builds a config.h file for inclusion in C programs.  You may edit
  802.    any of these files as the need arises after running this script.
  803.  
  804. If you make a mistake on a question, there is no easy way to back up to it
  805. currently.  The easiest thing to do is to edit config.sh and rerun all the SH
  806. files.  Configure will offer to let you do this before it runs the SH files.
  807.  
  808. EOH
  809. dflt='Type carriage return to continue'
  810. . ./myread
  811.  
  812. : find out where common programs are
  813. echo " "
  814. echo "Locating common programs..." >&4
  815. cat <<EOSC >loc
  816. $startsh
  817. case \$# in
  818. 0) exit 1;;
  819. esac
  820. thing=\$1
  821. shift
  822. dflt=\$1
  823. shift
  824. for dir in \$*; do
  825.     case "\$thing" in
  826.     .)
  827.     if test -d \$dir/\$thing; then
  828.         echo \$dir
  829.         exit 0
  830.     fi
  831.     ;;
  832.     *)
  833.     if test -f \$dir/\$thing; then
  834.         echo \$dir/\$thing
  835.         exit 0
  836.     elif test -f \$dir/\$thing.exe; then
  837.         : on Eunice apparently
  838.         echo \$dir/\$thing
  839.         exit 0
  840.     fi
  841.     ;;
  842.     esac
  843. done
  844. echo \$dflt
  845. exit 1
  846. EOSC
  847. chmod +x loc
  848. $eunicefix loc
  849. loclist="
  850. awk
  851. cat
  852. echo
  853. expr
  854. grep
  855. mkdir
  856. mv
  857. rm
  858. sed
  859. sort
  860. tail
  861. tr
  862. uniq
  863. "
  864. trylist="
  865. Mcc
  866. bash
  867. cpp
  868. csh
  869. date
  870. egrep
  871. inews
  872. ispell
  873. ksh
  874. less
  875. mail
  876. metamail
  877. mhn
  878. more
  879. nroff
  880. pg
  881. rmail
  882. sendmail
  883. smail
  884. test
  885. uname
  886. uuname
  887. vi
  888. "
  889. pth=`echo $PATH | sed -e 's/:/ /g'`
  890. pth="$pth /lib /usr/lib"
  891. for file in $loclist; do
  892.     xxx=`./loc $file $file $pth`
  893.     eval $file=$xxx
  894.     eval _$file=$xxx
  895.     case "$xxx" in
  896.     /*)
  897.         echo $file is in $xxx.
  898.         ;;
  899.     *)
  900.         echo "I don't know where $file is.  I hope it's in everyone's PATH."
  901.         ;;
  902.     esac
  903. done
  904. echo " "
  905. echo "Don't worry if any of the following aren't found..."
  906. ans=offhand
  907. for file in $trylist; do
  908.     xxx=`./loc $file $file $pth`
  909.     eval $file=$xxx
  910.     eval _$file=$xxx
  911.     case "$xxx" in
  912.     /*)
  913.         echo $file is in $xxx.
  914.         ;;
  915.     *)
  916.         echo "I don't see $file out there, $ans."
  917.         ans=either
  918.         ;;
  919.     esac
  920. done
  921. case "$egrep" in
  922. egrep)
  923.     echo "Substituting grep for egrep."
  924.     egrep=$grep
  925.     ;;
  926. esac
  927. case "$test" in
  928. test)
  929.     echo "Hopefully test is built into your sh."
  930.     ;;
  931. *)
  932.     if sh -c "PATH= test true" >/dev/null 2>&1; then
  933.         echo "Using the test built into your sh."
  934.         test=test
  935.     fi
  936.     ;;
  937. esac
  938. case "$echo" in
  939. echo)
  940.     echo "Hopefully echo is built into your sh."
  941.     ;;
  942. /bin/echo)
  943.     echo " "
  944. echo "Checking compatibility between /bin/echo and builtin echo (if any)..." >&4
  945.     $echo $n "hi there$c" >foo1
  946.     echo $n "hi there$c" >foo2
  947.     if cmp foo1 foo2 >/dev/null 2>&1; then
  948.         echo "They are compatible.  In fact, they may be identical."
  949.     else
  950.         case "$n" in
  951.         '-n') n='' c='\c';;
  952.         *) n='-n' c='';;
  953.         esac
  954.         cat <<FOO
  955. They are not compatible!  You are probably running ksh on a non-USG system.
  956. I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
  957. have echo built in and we may have to run some Bourne shell scripts.  That
  958. means I'll have to use $ans to suppress newlines now.  Life is ridiculous.
  959.  
  960. FOO
  961.         $echo $n "The star should be here-->$c"
  962.         $echo "*"
  963.     fi
  964.     $rm -f foo1 foo2
  965.     ;;
  966. *)
  967.     : cross your fingers
  968.     echo=echo
  969.     ;;
  970. esac
  971.  
  972. : Try to determine whether config.sh was made on this system
  973. case "$config_sh" in
  974. '')
  975. myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
  976. dflt=n
  977. if test "$fastread" = yes; then
  978.     dflt=y
  979. elif test -f ../config.sh; then
  980.     eval "old`grep myuname= ../config.sh`"
  981.     if test "X$myuname" = "X$oldmyuname"; then
  982.         dflt=y
  983.     fi
  984. fi
  985.  
  986. : Get old answers from old config file if Configure was run on the
  987. : same system, otherwise use the hints.
  988. hint=default
  989. cd ..
  990. if test -f config.sh; then
  991.     echo " "
  992.     rp="I see a config.sh file.  Do you want to use it to set the defaults?"
  993.     . ./UU/myread
  994.     case "$ans" in
  995.     n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
  996.     *)  echo "Fetching default answers from your old config.sh file..." >&4
  997.         tmp="$n"
  998.         ans="$c"
  999.         . ./config.sh
  1000.         cp config.sh UU
  1001.         n="$tmp"
  1002.         c="$ans"
  1003.         hint=previous
  1004.         ;;
  1005.     esac
  1006. fi
  1007. if test ! -f config.sh; then
  1008.     $cat <<EOM
  1009.  
  1010. First time through, eh?  I have some defaults handy for the following systems:
  1011.  
  1012. EOM
  1013.     cd hints; ls -C *.sh | $sed 's/\.sh/   /g' >&4
  1014.     dflt=''
  1015.     : Half the following guesses are probably wrong... If you have better
  1016.     : tests or hints, please send them to davison@borland.com
  1017.     : The metaconfig authors would also appreciate a copy...
  1018.     $test -f /vmunix && $test -f /usr/convex/spucmd && dflt="$dflt convexos"
  1019.     $test -f /irix && dflt="$dflt sgi"
  1020.     $test -f /xenix && dflt="$dflt sco_xenix"
  1021.     $test -f /dynix && dflt="$dflt dynix"
  1022.     $test -f /bin/mips && /bin/mips && dflt="$dflt mips"
  1023.     $test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next"
  1024.     if $test -f $uname; then
  1025.         set `$uname -a | tr '[A-Z]' '[a-z]'`
  1026.  
  1027.         $test -f $5.sh && dflt="$dflt $5"
  1028.  
  1029.         case "$5" in
  1030.         mips*) dflt="$dflt mips";;
  1031.         [23]100) dflt="$dflt mips";;
  1032.         next*) dflt="$dflt next" ;;
  1033.         esac
  1034.  
  1035.         case "$1" in
  1036.         aix) dflt="$dflt aix_rs" ;;
  1037.         sunos)    case "$3" in
  1038.             4.1*) dflt="$dflt sunos_4_1" ;;
  1039.             esac
  1040.             ;;
  1041.         dgux) dflt="$dflt dgux" ;;
  1042.         hp*ux) dflt="$dflt hpux" ;;
  1043.         next) dflt="$dflt next" ;;
  1044.         irix) dflt="$dflt sgi" ;;
  1045.         convexos) dflt="$dflt convexos";;
  1046.         $2) if $test -f /usr/lib/sysadm/sysadm.menu; then
  1047.             if $test ! -f /etc/copyrights/01.sco; then
  1048.                 set 3 2 0
  1049.             else
  1050.                 set `uname -X 2>&1 | grep Release`
  1051.                 if test "x$1" != "xRelease"; then
  1052.                 set 3 2 1
  1053.                 else
  1054.                 set `echo $3 | sed 's/[^0-9]/ /g'`
  1055.                 fi
  1056.             fi
  1057.             if $test -f sco_$1_$2_$3.sh; then
  1058.                 dflt="$dflt sco_$1_$2_$3"
  1059.             elif $test -f sco_$1_$2.sh; then
  1060.                 dflt="$dflt sco_$1_$2"
  1061.             elif $test -f sco_$1.sh; then
  1062.                 dflt="$dflt sco_$1"
  1063.             fi
  1064.             fi ;;
  1065.         esac
  1066.     fi
  1067.     set X `echo $dflt | tr ' ' '\012' | sort | uniq`
  1068.     shift
  1069.     dflt=''
  1070.     for file in $*; do
  1071.         if $test -f "$file.sh"; then
  1072.             dflt="$dflt $file"
  1073.         fi
  1074.     done
  1075.     set X $dflt
  1076.     shift
  1077.     dflt=${1+"$@"}
  1078.     case "$dflt" in
  1079.     '') dflt=none;;
  1080.     esac
  1081.     $cat <<EOM
  1082.  
  1083. You may give one or more space-separated answers, or "none" if appropriate.
  1084. If your OS version has no hints, DO NOT give a wrong version -- say "none".
  1085.  
  1086. EOM
  1087.     rp="Which of these apply, if any?"
  1088.     . ../UU/myread
  1089.     for file in $ans; do
  1090.         if $test -f $file.sh; then
  1091.             . ./$file.sh
  1092.             $cat $file.sh >> ../UU/config.sh
  1093.         elif $test X$ans = X -o X$ans = Xnone ; then
  1094.             :
  1095.         else
  1096.             echo "$file.sh does not exist -- ignored"
  1097.         fi
  1098.     done
  1099.     hint=recommended
  1100.     cd ..
  1101. fi
  1102. cd UU
  1103. ;;
  1104. *)
  1105.     echo " "
  1106.     echo "Fetching default answers from $config_sh..." >&4
  1107.     tmp="$n"
  1108.     ans="$c"
  1109.     cd ..
  1110.     cp $config_sh config.sh 2>/dev/null
  1111.     . ./config.sh
  1112.     cd UU
  1113.     cp ../config.sh .
  1114.     n="$tmp"
  1115.     c="$ans"
  1116.     hint=previous
  1117.     ;;
  1118. esac
  1119.  
  1120. : Restore computed paths
  1121. for file in $loclist $trylist; do
  1122.     eval $file="\$_$file"
  1123. done
  1124.  
  1125. : set up shell script to do ~ expansion
  1126. cat >filexp <<EOSS
  1127. $startsh
  1128. : expand filename
  1129. case "\$1" in
  1130.  ~/*|~)
  1131.     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  1132.     ;;
  1133.  ~*)
  1134.     if $test -f /bin/csh; then
  1135.         /bin/csh -f -c "glob \$1"
  1136.         failed=$?
  1137.         echo ""
  1138.         exit \$failed
  1139.     else
  1140.         name=\`$expr x\$1 : '..\([^/]*\)'\`
  1141.         dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
  1142.         if $test ! -d "\$dir"; then
  1143.             me=\`basename \$0\`
  1144.             echo "\$me: can't locate home directory for: \$name" >&2
  1145.             exit 1
  1146.         fi
  1147.         case "\$1" in
  1148.         */*)
  1149.             echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  1150.             ;;
  1151.         *)
  1152.             echo \$dir
  1153.             ;;
  1154.         esac
  1155.     fi
  1156.     ;;
  1157. *)
  1158.     echo \$1
  1159.     ;;
  1160. esac
  1161. EOSS
  1162. chmod +x filexp
  1163. $eunicefix filexp
  1164.  
  1165. : check if NNTP is to be used
  1166. case "$d_nntp" in
  1167. "$define") dflt="y";;
  1168. *)       dflt="n";;
  1169. esac
  1170. $echo " "
  1171. rp="Do you want to access news via NNTP?"
  1172. . ./myread
  1173. case "$ans" in
  1174. n*)    d_nntp="$undef" d_xdata="$undef";;
  1175. y*)    d_nntp="$define"
  1176.     case "$d_xdata" in
  1177.     define) dflt="y";;
  1178.     *)    dflt="n";;
  1179.     esac
  1180.     $cat <<EOM
  1181.  
  1182. $Package allows you to use an after-market data-sending extension to NNTP
  1183. instead of a locally-maintained database (XTHREAD and XOVER are both
  1184. currently supported).
  1185. EOM
  1186.     rp="Do you want to access a remote database via NNTP?"
  1187.     . ./myread
  1188.     case "$ans" in
  1189.     y*) d_xdata="$define" ;;
  1190.     *)  d_xdata="$undef" ;;
  1191.     esac
  1192.     newsspool=/tmp
  1193.     $echo "net.foobar 00001 00001 y" > .falseactive
  1194.  
  1195.     case "$servername" in
  1196.     '')  dflt="no default" ;;
  1197.     *)   dflt="$servername";;
  1198.     esac
  1199.  
  1200.     $cat <<EOM
  1201.  
  1202. $Package needs to know what machine you wish to use as a news server.  You
  1203. can specify a machine name directly, or a filename from which to read
  1204. the name (start the name with a slash or a tilde to distinguish it).
  1205. Note also that the environment variable NNTPSERVER can be used for
  1206. individuals to override this default setting.
  1207.  
  1208. EOM
  1209.  
  1210.     rp="Enter a file name (~name ok) or machine name:"
  1211.     . ./myread
  1212.     ans=`./filexp "$ans"`
  1213.     case "$ans" in
  1214.     /*) if $test ! -f $ans; then
  1215.         $echo "(You'll need to create $ans before $package will work.)"
  1216.         fi;;
  1217.     esac
  1218.     servername="$ans"
  1219. esac
  1220.  
  1221. : decide how portable to be
  1222. case "$d_portable" in
  1223. "$define") dflt=y;;
  1224. *)    dflt=n;;
  1225. esac
  1226. $cat <<'EOH'
  1227.  
  1228. I can set things up so that your shell scripts and binaries are more portable,
  1229. at what may be a noticable cost in performance.  In particular, if you
  1230. ask to be portable, the following happens:
  1231.  
  1232.      1) Shell scripts will rely on the PATH variable rather than using
  1233.     the paths derived above.
  1234.      2) ~username interpretations will be done at run time rather than
  1235.     by Configure.
  1236.      3) The system name will be determined at run time, if at all possible.
  1237.  
  1238. EOH
  1239. rp="Do you expect to run these scripts and binaries on multiple machines?"
  1240. . ./myread
  1241. case "$ans" in
  1242.     y*) d_portable="$define"
  1243.     for file in $loclist; do
  1244.         eval $file=$file
  1245.     done
  1246.     ;;
  1247.     *)  d_portable="$undef" ;;
  1248. esac
  1249.  
  1250. : now set up to get a file name with possible "~name" substitutions
  1251. cat <<'EOSC' >getfile
  1252. tilde=''
  1253. fullpath=''
  1254. already=''
  1255. skip=''
  1256. none_ok=''
  1257. orig_rp="$rp"
  1258. orig_dflt="$dflt"
  1259.  
  1260. case "$fn" in
  1261. *~*) tilde=true;;
  1262. esac
  1263. case "$fn" in
  1264. */*) fullpath=true;;
  1265. esac
  1266. case "$fn" in
  1267. *+*) skip=true;;
  1268. esac
  1269. case "$fn" in
  1270. *n*) none_ok=true;;
  1271. esac
  1272.  
  1273. case "$fn" in
  1274. *f*) type='File';;
  1275. *d*) type='Directory';;
  1276. *l*) type='Locate'; fn=`expr $fn : '.*:\(.*\)'`;;
  1277. esac
  1278.  
  1279. what="$type"
  1280. case "$what" in
  1281. Locate) what='File';;
  1282. esac
  1283. cd ..
  1284.  
  1285. while test "$type"; do
  1286.     redo=''
  1287.     rp="$orig_rp"
  1288.     dflt="$orig_dflt"
  1289.     case "$tilde" in
  1290.     true) rp="$rp (~name ok)";;
  1291.     esac
  1292.     . ./UU/myread
  1293.     case "$ans" in
  1294.     none)
  1295.         value=''
  1296.         case "$none_ok" in
  1297.         true) type='';;
  1298.         esac
  1299.         ;;
  1300.     *)
  1301.         case "$tilde" in
  1302.         '') value="$ans"
  1303.             testvalue="$ans";;
  1304.         *)
  1305.             value=`./UU/filexp $ans`
  1306.             case $? in
  1307.             0)
  1308.                 if test "X$ans" != "X$value"; then
  1309.                     echo "(That is $value on this particular system.)"
  1310.                 fi
  1311.                 ;;
  1312.             *) value="$ans";;
  1313.             esac
  1314.             testvalue="$value"
  1315.             case "$d_portable" in
  1316.             "$define") value="$ans";;
  1317.             esac
  1318.             ;;
  1319.         esac
  1320.         case "$fullpath" in
  1321.         true)
  1322.             case "$testvalue" in
  1323.             /*) ;;
  1324.             *)
  1325.                 redo=true
  1326.                 case "$already" in
  1327.                 true)
  1328.                 echo "I shall only accept a full path name, as in /bin/ls." >&4
  1329.                 echo "Use a ! shell escape if you wish to check pathnames." >&4
  1330.                     ;;
  1331.                 *)
  1332.                 echo "Please give a full path name, starting with slash." >&4
  1333.                     case "$tilde" in
  1334.                     true)
  1335.                 echo "Note that using ~name is ok provided it expands well." >&4
  1336.                         already=true
  1337.                         ;;
  1338.                     esac
  1339.                 esac
  1340.                 ;;
  1341.             esac
  1342.             ;;
  1343.         esac
  1344.         case "$redo" in
  1345.         '')
  1346.             case "$type" in
  1347.             File)
  1348.                 if test -f "$testvalue"; then
  1349.                     type=''
  1350.                 elif test -r "$testvalue" || (test -h "$testvalue") >/dev/null 2>&1
  1351.                 then
  1352.                     echo "($value is not a plain file, but that's ok.)"
  1353.                     type=''
  1354.                 fi
  1355.                 ;;
  1356.             Directory)
  1357.                 if test -d "$testvalue"; then
  1358.                     type=''
  1359.                 fi
  1360.                 ;;
  1361.             Locate)
  1362.                 if test -d "$value"; then
  1363.                     echo "(Looking for $fn in directory $value.)"
  1364.                     value="$value/$fn"
  1365.                 fi
  1366.                 if test -f "$value"; then
  1367.                     type=''
  1368.                 fi
  1369.                 ;;
  1370.             esac
  1371.  
  1372.             case "$skip" in
  1373.             true) type='';
  1374.             esac
  1375.  
  1376.             case "$type" in
  1377.             '') ;;
  1378.             *)
  1379.                 if test "$fastread" = yes; then
  1380.                     dflt=y
  1381.                 else
  1382.                     dflt=n
  1383.                 fi
  1384.                 rp="$what $value doesn't exist.  Use that name anyway?"
  1385.                 . ./UU/myread
  1386.                 dflt=''
  1387.                 case "$ans" in
  1388.                 y*) type='';;
  1389.                 *) echo " ";;
  1390.                 esac
  1391.                 ;;
  1392.             esac
  1393.             ;;
  1394.         esac
  1395.         ;;
  1396.     esac
  1397. done
  1398. cd UU
  1399. ans="$value"
  1400. rp="$orig_rp"
  1401. dflt="$orig_dflt"
  1402. EOSC
  1403.  
  1404. : figure out news library
  1405. case "$d_nntp" in
  1406. define) newslib=/tmp
  1407.     newslibexp=/tmp
  1408.     ;;
  1409. *)    case "$newslib" in
  1410.     '') dflt=/usr/lib/news;;
  1411.     *)  dflt=$newslib;;
  1412.     esac
  1413.     $echo " "
  1414.     fn=d~
  1415.     rp='Where is the news library directory?'
  1416.     . ./getfile
  1417.     newslib="$ans"
  1418.     newslibexp=`./filexp $newslib`
  1419.     if $test -f $newslibexp/inews; then
  1420.         $echo "Aha!  Inews is really in $newslibexp!" >&4
  1421.         case "$inews" in
  1422.         inews) : null;;
  1423.         *) $echo "(Make sure $inews isn't an old version.)";;
  1424.         esac
  1425.         inews=$newslibexp/inews
  1426.     fi
  1427. esac
  1428. case "$inewsloc" in
  1429. '') dflt="$inews";;
  1430. *)  dflt="$inewsloc";;
  1431. esac
  1432. $echo " "
  1433. fn=l:inews
  1434. rp='Which inews should be used for posting articles?'
  1435. . ./getfile
  1436. inewsloc="$ans"
  1437.  
  1438. : locate active file and active.times file
  1439. $echo " "
  1440. case "$d_nntp" in
  1441. define) active=none
  1442.     myactive=.falseactive
  1443.     : check for active.times
  1444.     case "$acttimes" in
  1445.     ''|none) dflt="n";;
  1446.     *)       dflt="y";;
  1447.     esac
  1448.     cat <<'EOM'
  1449.  
  1450. If your server maintains an accurate "active.times" file, trn can make use
  1451. of the NEWGROUPS call in NNTP to find new groups instead of using the old
  1452. method of adding all groups not listed in your .newsrc.  If you aren't sure,
  1453. guess and see if you get notified of the new groups as they are created.
  1454.  
  1455. EOM
  1456.     rp="Does your server support a reliable NEWGROUPS call?"
  1457.     . ./myread
  1458.     case "$ans" in
  1459.     y*) acttimes="nntp" d_acttimes="$define";;
  1460.     *)  acttimes='none' d_acttimes="$undef";;
  1461.     esac
  1462.     ;;
  1463. *)    case "$active" in
  1464.     '') dflt=$newslib/active ;;
  1465.     *)  dflt="$active";;
  1466.     esac
  1467.     fn=l~:active
  1468.     rp='Where is the active file?'
  1469.     . ./getfile
  1470.     active="$ans"
  1471.     myactive=`./filexp $active`
  1472.     : check for active.times
  1473.     case "$acttimes" in
  1474.     ''|nntp) dflt="${active}.times";;
  1475.     *)       dflt="$acttimes";;
  1476.     esac
  1477.     $cat <<'EOM'
  1478.  
  1479. If your news system maintains an "active.times" file, trn can use it for a
  1480. fast new-group check.  If it's not around, answer "none" and the active
  1481. file will be scanned for new groups when it changes size.
  1482.  
  1483. EOM
  1484.     fn=ln~:active.times
  1485.     rp='The full pathname of active.times or "none"?'
  1486.     . ./getfile
  1487.     acttimes="$ans"
  1488.     case "$acttimes" in
  1489.     '') acttimes=none d_acttimes="$undef";;
  1490.     *) d_acttimes="$define";;
  1491.     esac
  1492. esac
  1493.  
  1494. : make some quick guesses about what we are up against
  1495. echo " "
  1496. $echo $n "Hmm...  $c"
  1497. $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
  1498. if test `echo abc | tr a-z A-Z` = Abc ; then
  1499.     xxx=`./loc addbib blurfl $pth`
  1500.     if $test -f $xxx; then
  1501.     echo "Looks kind of like a USG system with BSD features, but we'll see..."
  1502.         echo exit 0 >bsd
  1503.         echo exit 0 >usg
  1504.         echo exit 1 >v7
  1505.     else
  1506.         if $contains SIGTSTP foo >/dev/null 2>&1 ; then
  1507.             echo "Looks kind of like an extended USG system, but we'll see..."
  1508.         else
  1509.             echo "Looks kind of like a USG system, but we'll see..."
  1510.         fi
  1511.         echo exit 1 >bsd
  1512.         echo exit 0 >usg
  1513.         echo exit 1 >v7
  1514.     fi
  1515.     d_bsd="$undef"
  1516. elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
  1517.     echo "Looks kind of like a BSD system, but we'll see..."
  1518.     d_bsd="$define"
  1519.     echo exit 0 >bsd
  1520.     echo exit 1 >usg
  1521.     echo exit 1 >v7
  1522. else
  1523.     echo "Looks kind of like a Version 7 system, but we'll see..."
  1524.     d_bsd="$undef"
  1525.     echo exit 1 >bsd
  1526.     echo exit 1 >usg
  1527.     echo exit 0 >v7
  1528. fi
  1529. case "$eunicefix" in
  1530. *unixtovms*)
  1531.     $cat <<'EOI'
  1532. There is, however, a strange, musty smell in the air that reminds me of
  1533. something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  1534. EOI
  1535.     echo "exit 0" >eunice
  1536.     d_eunice="$define"
  1537. : it so happens the Eunice I know will not run shell scripts in Unix format
  1538.     ;;
  1539. *)
  1540.     echo " "
  1541.     echo "Congratulations.  You aren't running Eunice."
  1542.     d_eunice="$undef"
  1543.     echo "exit 1" >eunice
  1544.     ;;
  1545. esac
  1546. if test -f /xenix; then
  1547.     echo "Actually, this looks more like a XENIX system..."
  1548.     echo "exit 0" >xenix
  1549.     d_xenix="$define"
  1550. else
  1551.     echo " "
  1552.     echo "It's not Xenix..."
  1553.     echo "exit 1" >xenix
  1554.     d_xenix="$undef"
  1555. fi
  1556. chmod +x xenix
  1557. $eunicefix xenix
  1558. if test -f /venix; then
  1559.     echo "Actually, this looks more like a VENIX system..."
  1560.     echo "exit 0" >venix
  1561. else
  1562.     echo " "
  1563.     if xenix; then
  1564.         : null
  1565.     else
  1566.         echo "Nor is it Venix..."
  1567.     fi
  1568.     echo "exit 1" >venix
  1569. fi
  1570. chmod +x bsd usg v7 eunice venix
  1571. $eunicefix bsd usg v7 eunice venix
  1572. $rm -f foo
  1573.  
  1574. : find out how to find out full name
  1575. case "$d_berknames" in
  1576. "$define")
  1577.     dflt=y;;
  1578. "$undef")
  1579.     dflt=n;;
  1580. *)
  1581.     if bsd; then
  1582.         dflt=y
  1583.     elif xenix; then
  1584.         dflt=y
  1585.     else
  1586.         dflt=n
  1587.     fi
  1588.     ;;
  1589. esac
  1590. $cat <<'EOM'
  1591.  
  1592. Does your /etc/passwd file keep full names in Berkeley/V7 format (name first
  1593. thing after ':' in GCOS field)?  In that case, a typical entry in the password
  1594. file looks like this:
  1595.  
  1596.     guest:**paswword**:10:100:Mister Guest User:/usr/users:/bin/sh
  1597.                               ^^^^^^^^^^^^^^^^^
  1598. EOM
  1599. rp="Berkeley/V7 format for full name in /etc/password?"
  1600. . ./myread
  1601. case "$ans" in
  1602. y*) d_passnames="$define"
  1603.     d_berknames="$define"
  1604.     d_usgnames="$undef"
  1605.     nametype=bsd
  1606.     ;;
  1607. *)
  1608.     case "$d_usgnames" in
  1609.     "$define") dflt=y;;
  1610.     "$undef") dflt=n;;
  1611.     *)
  1612.         if usg; then
  1613.             dflt=y
  1614.         else
  1615.             dflt=n
  1616.         fi
  1617.         ;;
  1618.     esac
  1619. $cat <<'EOM'
  1620.  
  1621. Does your passwd file keep full names in USG format (name sandwiched between a
  1622. '-' and a '(')?  In that case, a typical entry in the password file looks like
  1623. this:
  1624.  
  1625.     guest:**paswword**:10:100:000-Mister Guest User(000):/usr/users:/bin/sh
  1626.                                   ^^^^^^^^^^^^^^^^^
  1627. EOM
  1628.     rp="USG format for full name in /etc/passwd?"
  1629.     . ./myread
  1630.     case "$ans" in
  1631.     n*) echo "Full name will be taken from ~/.fullname"
  1632.         d_passnames="$undef"
  1633.         d_berknames="$undef"
  1634.         d_usgnames="$undef"
  1635.         nametype=other
  1636.         ;;
  1637.     *)
  1638.         d_passnames="$define"
  1639.         d_berknames="$undef"
  1640.         d_usgnames="$define"
  1641.         nametype=usg
  1642.         ;;
  1643.     esac;;
  1644. esac
  1645.  
  1646. : determine where manual pages are on this system
  1647. echo " "
  1648. case "$sysman" in
  1649. '') sysman=`./loc . /local/man/man1 /usr/man/man1 /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/share/man/man1 /usr/catman/u_man/man1 /usr/man/l_man/man1 /usr/local/man/u_man/man1 /usr/local/man/l_man/man1 /usr/man/man.L1 /usr/man/man.L`
  1650.     ;;
  1651. esac
  1652. if $test -d "$sysman"; then
  1653.     echo "System manual is in $sysman." >&4
  1654. else
  1655.     echo "Could not find manual pages in source form." >&4
  1656. fi
  1657.  
  1658. : see if we need a special compiler
  1659. echo " "
  1660. if usg; then
  1661.     case "$cc" in
  1662.     '') case "$Mcc" in
  1663.         /*) dflt='Mcc';;
  1664.         *) case "$large" in
  1665.             -M*) dflt='cc';;
  1666.             *)    if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
  1667.                     if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
  1668.                         dflt='cc'
  1669.                     else
  1670.                         dflt='cc -M'
  1671.                     fi
  1672.                 else
  1673.                     dflt='cc'
  1674.                 fi;;
  1675.             esac;;
  1676.         esac;;
  1677.     *)  dflt="$cc";;
  1678.     esac
  1679.     $cat <<'EOM'
  1680. On some systems the default C compiler will not resolve multiple global
  1681. references that happen to have the same name.  On some such systems the "Mcc"
  1682. command may be used to force these to be resolved.  On other systems a "cc -M"
  1683. command is required.  (Note that the -M flag on other systems indicates a
  1684. memory model to use!) If you have the Gnu C compiler, you might wish to use
  1685. that instead.
  1686.  
  1687. EOM
  1688.     rp="What command will force resolution on this system?"
  1689.     . ./myread
  1690.     cc="$ans"
  1691. else
  1692.     case "$cc" in
  1693.     '') dflt=cc;;
  1694.     *) dflt="$cc";;
  1695.     esac
  1696.     rp="Use which C compiler?"
  1697.     . ./myread
  1698.     cc="$ans"
  1699. fi
  1700. case "$cc" in
  1701. gcc*) cpp=`./loc gcc-cpp $cpp $pth`;;
  1702. esac
  1703.  
  1704. : What should the include directory be ?
  1705. echo " "
  1706. $echo $n "Hmm...  $c"
  1707. case "$usrinc" in
  1708. '') dflt='/usr/include';;
  1709. *) dflt=$usrinc;;
  1710. esac
  1711. incpath=''
  1712. mips_type=''
  1713. if $test -f /bin/mips && /bin/mips; then
  1714.     echo "Looks like a MIPS system..."
  1715.     $cat >usr.c <<'EOCP'
  1716. #ifdef SYSTYPE_BSD43
  1717. /bsd43
  1718. #endif
  1719. EOCP
  1720.     if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
  1721.         dflt='/bsd43/usr/include'
  1722.         incpath='/bsd43'
  1723.         mips_type='BSD 4.3'
  1724.     else
  1725.         mips_type='System V'
  1726.     fi
  1727.     $rm -f usr.c usr.out
  1728.     echo "and you're compiling with the $mips_type compiler and libraries."
  1729. else
  1730.     echo "Doesn't look like a MIPS system."
  1731.     echo "exit 1" >mips
  1732.     chmod +x mips
  1733.     $eunicefix mips
  1734. fi
  1735. echo " "
  1736. fn=d/
  1737. rp='Where are the include files you want to use?'
  1738. . ./getfile
  1739. usrinc="$ans"
  1740.  
  1741. : Set private lib path
  1742. case "$plibpth" in
  1743. '') if mips; then
  1744.         plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
  1745.     else
  1746.         plibpth="/usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib"
  1747.     fi;;
  1748. esac
  1749. libpth="$plibpth $libpth"
  1750.  
  1751. : Looking for optional libraries
  1752. echo " "
  1753. echo "Checking for optional libraries..." >&4
  1754. case "$libs" in
  1755. ' '|'') dflt='';;
  1756. *) dflt="$libs";;
  1757. esac
  1758. case "$libswanted" in
  1759. '') libswanted='c_s';;
  1760. esac
  1761. for thislib in $libswanted; do
  1762.     case "$thislib" in
  1763.     dbm) thatlib=ndbm;;
  1764.     *_s) thatlib=NONE;;
  1765.     *) thatlib="${thislib}_s";;
  1766.     *) thatlib=NONE;;
  1767.     esac
  1768.     yyy="$incpath/usr/ccs/lib $incpath/usr/lib $incpath/usr/ucblib"
  1769.     yyy="$yyy $incpath/usr/local/lib $incpath/lib"
  1770.     xxx=`./loc lib$thislib.a X $yyy`
  1771.     if $test -f $xxx; then
  1772.         echo "Found -l$thislib."
  1773.         case "$dflt" in
  1774.         *-l$thislib*|*-l$thatlib*);;
  1775.         *) dflt="$dflt -l$thislib";;
  1776.         esac
  1777.     else
  1778.         xxx=`./loc lib$thislib.a X $libpth`
  1779.         if $test -f $xxx; then
  1780.             echo "Found $xxx."
  1781.             case "$dflt" in
  1782.             *$xxx*);;
  1783.             *) dflt="$dflt $xxx";;
  1784.             esac
  1785.         else
  1786.             xxx=`./loc Slib$thislib.a X $xlibpth`
  1787.             if $test -f $xxx; then
  1788.                 echo "Found -l$thislib."
  1789.                 case "$dflt" in
  1790.                 *-l$thislib*|*-l$thatlib*);;
  1791.                 *) dflt="$dflt -l$thislib";;
  1792.                 esac
  1793.             else
  1794.                 echo "No -l$thislib."
  1795.             fi
  1796.         fi
  1797.     fi
  1798. done
  1799. set X $dflt
  1800. shift
  1801. dflt="$*"
  1802. case "$libs" in
  1803. '') dflt="$dflt";;
  1804. *) dflt="$libs";;
  1805. esac
  1806. case "$dflt" in
  1807. ' '|'') dflt='none';;
  1808. esac
  1809.  
  1810. $cat <<EOM
  1811.  
  1812. Some versions of Unix support shared libraries, which make executables smaller
  1813. but make load time slightly longer.
  1814.  
  1815. On some systems, mostly newer Unix System V's, the shared library is included
  1816. by putting the option "-lc_s" as the last thing on the cc command line when
  1817. linking.  Other systems use shared libraries by default.  There may be other
  1818. libraries needed to compile $package on your machine as well.  If your system
  1819. needs the "-lc_s" option, include it here.  Include any other special libraries
  1820. here as well.  Say "none" for none.
  1821. EOM
  1822.  
  1823. echo " "
  1824. rp="Any additional libraries?"
  1825. . ./myread
  1826. case "$ans" in
  1827. none) ans=' ';
  1828. esac
  1829. libs="$ans"
  1830.  
  1831. usenm=true
  1832. runnm=$usenm
  1833. case "$reuseval" in
  1834. true) runnm=false;;
  1835. esac
  1836.  
  1837. : nm options which may be necessary
  1838. case "$nm_opt" in
  1839. '') if $test -f /mach_boot; then
  1840.         nm_opt=''
  1841.     elif $test -d /usr/ccs/lib; then
  1842.         nm_opt='-p'
  1843.     elif $test -f /dgux; then
  1844.         nm_opt='-p'
  1845.     else
  1846.         nm_opt=''
  1847.     fi;;
  1848. esac
  1849.  
  1850. case "$runnm" in
  1851. true)
  1852. : get list of predefined functions in a handy place
  1853. echo " "
  1854. case "$libc" in
  1855. '') libc=unknown
  1856.     case "$libs" in
  1857.     *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
  1858.     esac
  1859.     ;;
  1860. esac
  1861. libpth="$plibpth $libpth"
  1862. libnames='';
  1863. case "$libs" in
  1864. '') ;;
  1865. *)  for thislib in $libs; do
  1866.     case "$thislib" in
  1867.     -l*)
  1868.         thislib=`expr X$thislib : 'X-l\(.*\)'`
  1869.         try=`./loc lib$thislib.a blurfl/dyick $libpth`
  1870.         if test ! -f $try; then
  1871.             try=`./loc lib$thislib blurfl/dyick $libpth`
  1872.             if test ! -f $try; then
  1873.                 try=`./loc $thislib blurfl/dyick $libpth`
  1874.                 if test ! -f $try; then
  1875.                     try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
  1876.                     if test ! -f $try; then
  1877.                         try=''
  1878.                     fi
  1879.                 fi
  1880.             fi
  1881.         fi
  1882.         libnames="$libnames $try"
  1883.         ;;
  1884.     *) libnames="$libnames $thislib" ;;
  1885.     esac
  1886.     done
  1887.     ;;
  1888. esac
  1889. case "$libc" in
  1890. unknown)
  1891.     set /usr/ccs/lib/libc.so
  1892.     $test -r $1 || set /usr/lib/libc.so
  1893.     $test -r $1 || set /usr/lib/libc.so.[0-9]*
  1894.     $test -r $1 || set /lib/libsys_s.a
  1895.     eval set \$$#
  1896.     ;;
  1897. *)
  1898.     set blurfl
  1899.     ;;
  1900. esac
  1901. apollo='false'
  1902. if $test -r "$1"; then
  1903.     echo "Your (shared) C library seems to be in $1."
  1904.     libc="$1"
  1905. elif $test -r /lib/libc && $test -r /lib/clib; then
  1906.     echo "Your C library seems to be in both /lib/clib and /lib/libc."
  1907.     libc='/lib/clib /lib/libc'
  1908.     if $test -r /lib/syslib; then
  1909.         echo "(Your math library is in /lib/syslib.)"
  1910.         libc="$libc /lib/syslib"
  1911.     fi
  1912.     apollo='true'
  1913. elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
  1914.     echo "Your C library seems to be in $libc, as you said before."
  1915. elif $test -r $incpath/usr/lib/libc.a; then
  1916.     libc=$incpath/usr/lib/libc.a;
  1917.     echo "Your C library seems to be in $libc.  That's fine."
  1918. elif $test -r /lib/libc.a; then
  1919.     libc=/lib/libc.a;
  1920.     echo "Your C library seems to be in $libc.  You're normal."
  1921. else
  1922.     if ans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$ans"; then
  1923.         :
  1924.     elif ans=`./loc libc blurfl/dyick $libpth`; $test -r "$ans"; then
  1925.         libnames="$libnames "`./loc clib blurfl/dyick $libpth`
  1926.     elif ans=`./loc clib blurfl/dyick $libpth`; $test -r "$ans"; then
  1927.         :
  1928.     elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$ans"; then
  1929.         :
  1930.     elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$ans"; then
  1931.         :
  1932.     else
  1933.         ans=`./loc Llibc.a blurfl/dyick $xlibpth`
  1934.     fi
  1935.     if $test -r "$ans"; then
  1936.         echo "Your C library seems to be in $ans, of all places."
  1937.         libc=$ans
  1938.     else
  1939.         libc='blurfl'
  1940.     fi
  1941. fi
  1942. if $test "$apollo" = 'false'; then
  1943.     if $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
  1944.         dflt="$libc"
  1945.         cat <<EOM
  1946.  
  1947. If the guess above is wrong (which it might be if you're using a strange
  1948. compiler, or your machine supports multiple models), you can override it here.
  1949.  
  1950. EOM
  1951.     else
  1952.         dflt=''
  1953.         echo $libpth | tr ' ' '\012' | sort | uniq > libpath
  1954.         cat >&4 <<EOM
  1955. I can't seem to find your C library.  I've looked in the following places:
  1956.  
  1957. EOM
  1958.         $sed 's/^/    /' libpath
  1959.         cat <<EOM
  1960.  
  1961. None of these seems to contain your C library. I need to get its name...
  1962.  
  1963. EOM
  1964.     fi
  1965.     fn=f
  1966.     rp='Where is your C library?'
  1967.     . ./getfile
  1968.     libc="$ans"
  1969. fi
  1970.  
  1971. echo " "
  1972. echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
  1973. set X `cat libnames`
  1974. shift
  1975. xxx=files
  1976. case $# in 1) xxx=file; esac
  1977. echo "Extracting names from the following $xxx for later perusal:" >&4
  1978. echo " "
  1979. $sed 's/^/    /' libnames >&4
  1980. echo " "
  1981. $echo $n "This may take a while...$c" >&4
  1982.  
  1983. nm $nm_opt $* 2>/dev/null >libc.tmp
  1984. $echo $n ".$c"
  1985. $grep fprintf libc.tmp > libc.ptf
  1986. xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
  1987. xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
  1988. if com="$sed -n -e 's/^.* [ADTS]  *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
  1989.     eval $xscan;\
  1990.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1991.         eval $xrun
  1992. elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
  1993.     eval $xscan;\
  1994.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1995.         eval $xrun
  1996. elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
  1997.     eval $xscan;\
  1998.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1999.         eval $xrun
  2000. elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
  2001.     eval $xscan;\
  2002.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  2003.         eval $xrun
  2004. elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
  2005.     eval $xscan;\
  2006.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  2007.         eval $xrun
  2008. elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
  2009.     eval $xscan;\
  2010.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  2011.         eval $xrun
  2012. elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
  2013.                 -e '/ file/d' -e 's/^\([^     ]*\).*/\1/p'";\
  2014.     eval $xscan;\
  2015.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  2016.         eval $xrun
  2017. elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
  2018.     eval $xscan;\
  2019.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  2020.         eval $xrun
  2021. elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
  2022.     eval $xscan;\
  2023.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  2024.         eval $xrun
  2025. else
  2026.     nm -p $* 2>/dev/null >libc.tmp
  2027.     com="$sed -n -e 's/^.* [ADTS]  *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
  2028.     eval "<libc.tmp $com >libc.list"
  2029.     if $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  2030.         nm_opt='-p'
  2031.         echo "done" >&4
  2032.     else
  2033.         echo " "
  2034.         echo "nm didn't seem to work right. Trying ar instead..." >&4
  2035.         com=''
  2036.         if ar t $libc > libc.tmp; then
  2037.             for thisname in $libnames; do
  2038.                 ar t $thisname >>libc.tmp
  2039.             done
  2040.             $sed -e 's/\.o$//' < libc.tmp > libc.list
  2041.             echo "Ok." >&4
  2042.         else
  2043.             echo "ar didn't seem to work right." >&4
  2044.             echo "Maybe this is a Cray...trying bld instead..." >&4
  2045.             if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
  2046.                 for thisname in $libnames; do
  2047.                     bld t $libnames | \
  2048.                     $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
  2049.                     ar t $thisname >>libc.tmp
  2050.                 done
  2051.                 echo "Ok." >&4
  2052.             else
  2053.                 echo "That didn't work either.  Giving up." >&4
  2054.                 exit 1
  2055.             fi
  2056.         fi
  2057.     fi
  2058. fi
  2059. nm_extract="$com"
  2060. if $test -f /lib/syscalls.exp; then
  2061.     echo " "
  2062.     echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
  2063.     $sed -n 's/^\([^     ]*\)[     ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
  2064. fi
  2065. ;;
  2066. esac
  2067. $rm -f libnames libpath
  2068.  
  2069. : determine optimize, if desired, or use for debug flag also
  2070. case "$optimize" in
  2071. ' ') dflt="none";;
  2072. '') dflt="-O";;
  2073. *) dflt="$optimize";;
  2074. esac
  2075. $cat <<EOH
  2076.  
  2077. Some C compilers have problems with their optimizers, by default, $package
  2078. compiles with the -O flag to use the optimizer.  Alternately, you might want
  2079. to use the symbolic debugger, which uses the -g flag (on traditional Unix
  2080. systems).  Either flag can be specified here.  To use neither flag, specify
  2081. the word "none".
  2082.  
  2083. EOH
  2084. rp="What optimizer/debugger flag should be used?"
  2085. . ./myread
  2086. optimize="$ans"
  2087. case "$optimize" in
  2088. 'none') optimize=" ";;
  2089. esac
  2090.  
  2091. case "$ccflags" in
  2092. '')    case "$optimize" in
  2093.     *-g*) dflt="-DDEBUG";;
  2094.     *)    dflt='';;
  2095.     esac
  2096.     case "$cc" in
  2097.     *gcc*)    if test -d /etc/conf/kconfig.d &&
  2098.           $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
  2099.         then
  2100.             dflt="$dflt -posix"
  2101.         fi
  2102.         ;;
  2103.     esac
  2104.     ;;
  2105. *) dflt="$ccflags" ;;
  2106. esac
  2107.  
  2108. case "$mips_type" in
  2109. *BSD*) ;;
  2110. '') ;;
  2111. *) inclwanted="$inclwanted $usrinc/bsd";;
  2112. esac
  2113. for thisincl in $inclwanted; do
  2114.     if $test -d $thisincl; then
  2115.         if $test x$thisincl != x$usrinc; then
  2116.             case "$dflt" in
  2117.             *$thisincl*);;
  2118.             *) dflt="$dflt -I$thisincl";;
  2119.             esac
  2120.         fi
  2121.     fi
  2122. done
  2123.  
  2124. inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
  2125.     xxx=true;
  2126. elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
  2127.     xxx=true;
  2128. else
  2129.     xxx=false;
  2130. fi;
  2131. if $xxx; then
  2132.     case "$dflt" in
  2133.     *$2*);;
  2134.     *) dflt="$dflt -D$2";;
  2135.     esac;
  2136. fi'
  2137.  
  2138. set signal.h LANGUAGE_C; eval $inctest
  2139. set signal.h NO_PROTOTYPE; eval $inctest
  2140. set signal.h _NO_PROTO; eval $inctest
  2141.  
  2142. case "$dflt" in
  2143. '') dflt=none;;
  2144. esac
  2145. $cat <<EOH
  2146.  
  2147. Your C compiler may want other flags.  For this question you should include
  2148. -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
  2149. but you should NOT include libraries or ld flags like -lwhatever.  If you
  2150. want $package to honor its debug switch, you should include -DDEBUG here.
  2151. To use no flags, specify the word "none".
  2152.  
  2153. EOH
  2154. set X $dflt
  2155. shift
  2156. dflt=${1+"$@"}
  2157. rp="Any additional cc flags?"
  2158. . ./myread
  2159. case "$ans" in
  2160. none) ans='';
  2161. esac
  2162. ccflags="$ans"
  2163.  
  2164. : the following weeds options from ccflags that are of no interest to cpp
  2165. cppflags="$ccflags"
  2166. case "$mips_type" in
  2167. '');;
  2168. *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
  2169. esac
  2170. case "$cppflags" in
  2171. '');;
  2172. *)  set X $cppflags
  2173.     cppflags=''
  2174.     for flag
  2175.     do
  2176.         case $flag in
  2177.         -D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
  2178.         esac
  2179.     done
  2180.     ;;
  2181. esac
  2182.  
  2183. : flags used in final linking phase
  2184. case "$ldflags" in
  2185. '') if venix; then
  2186.         dflt='-i -z'
  2187.     else
  2188.         dflt='none'
  2189.     fi
  2190.     ;;
  2191. *) dflt="$ldflags";;
  2192. esac
  2193. echo " "
  2194. rp="Any additional ld flags (NOT including libraries)?"
  2195. . ./myread
  2196. case "$ans" in
  2197. none) ans='';
  2198. esac
  2199. ldflags="$ans"
  2200. rmlist="$rmlist pdp11"
  2201.  
  2202. : is a C symbol defined?
  2203. csym='tlook=$1;
  2204. case "$3" in
  2205. -v) tf=libc.tmp; tc=""; tdc="";;
  2206. -a) tf=libc.tmp; tc="[0]"; tdc=[];;
  2207. *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
  2208. esac;
  2209. tx=yes;
  2210. case "$reuseval-$4" in
  2211. true-) ;;
  2212. true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
  2213. esac;
  2214. case "$tx" in
  2215. yes)
  2216.     case "$runnm" in
  2217.     true)
  2218.         if $contains $tlook $tf >/dev/null 2>&1;
  2219.         then tval=true;
  2220.         else tval=false;
  2221.         fi;;
  2222.     *)
  2223.         echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c;
  2224.         if $cc $ccflags -o t t.c $libs >/dev/null 2>&1;
  2225.         then tval=true;
  2226.         else tval=false;
  2227.         fi;
  2228.         $rm -f t t.c;;
  2229.     esac;;
  2230. *)
  2231.     case "$tval" in
  2232.     $define) tval=true;;
  2233.     *) tval=false;;
  2234.     esac;;
  2235. esac;
  2236. eval "$2=$tval"'
  2237.  
  2238. : set up the script used to warn in case of inconsistency
  2239. cat <<'EOSC' >whoa
  2240. dflt=y
  2241. echo " "
  2242. echo "*** WHOA THERE!!! ***" >&4
  2243. echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
  2244. rp="    Keep the $hint value?"
  2245. . ./myread
  2246. case "$ans" in
  2247. y) td=$was; tu=$was;;
  2248. esac
  2249. EOSC
  2250.  
  2251. : define an is-in-libc? function
  2252. inlibc='echo " "; td=$define; tu=$undef;
  2253. sym=$1; var=$2; eval "was=\$$2";
  2254. tx=yes;
  2255. case "$reuseval$was" in
  2256. true) ;;
  2257. true*) tx=no;;
  2258. esac;
  2259. case "$tx" in
  2260. yes)
  2261.     set $sym tres -f;
  2262.     eval $csym;
  2263.     case "$tres" in
  2264.     true)
  2265.         echo "$sym() found." >&4;
  2266.         case "$was" in $undef) . whoa; esac; eval "$var=\$td";;
  2267.     *)
  2268.         echo "$sym() NOT found." >&4;
  2269.         case "$was" in $define) . whoa; esac; eval "$var=\$tu";;
  2270.     esac;;
  2271. *)
  2272.     case "$was" in
  2273.     $define) echo "$sym() found." >&4;;
  2274.     *) echo "$sym() NOT found." >&4;;
  2275.     esac;;
  2276. esac'
  2277.  
  2278. : function used to set $1 to $val
  2279. setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
  2280. case "$val$was" in
  2281. $define$undef) . whoa; eval "$var=\$td";;
  2282. $undef$define) . whoa; eval "$var=\$tu";;
  2283. *) eval "$var=$val";;
  2284. esac'
  2285.  
  2286. : see if ftime exists
  2287. set ftime d_ftime 
  2288. eval $inlibc
  2289.  
  2290. : see if getwd or getcwd exists
  2291. set getwd d_getwd; eval $inlibc
  2292. case "$d_getwd" in
  2293. $define) val=$undef; set d_getcwd; eval $setvar ;;
  2294. *) set getcwd d_getcwd; eval $inlibc ;;
  2295. esac
  2296.  
  2297. : now get the host name that appears in news articles
  2298. $echo " "
  2299. $echo "Figuring out local host name..."
  2300. cont=true
  2301. $echo 'Maybe "hostname" will work...'
  2302. if ans=`sh -c hostname 2>&1` ; then
  2303.     thishost=$ans
  2304.     phostcmd=hostname
  2305.     cont=''
  2306. fi
  2307. if $test "$cont"; then
  2308.     if xenix; then
  2309.         $echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
  2310.         if ans=`cat /etc/systemid 2>&1` ; then
  2311.             thishost=$ans
  2312.             phostcmd='cat /etc/systemid'
  2313.             $echo "Whadyaknow.  Xenix always was a bit strange..."
  2314.             cont=''
  2315.         fi
  2316.     elif $test -r /etc/systemid; then
  2317.         $echo "(What is a non-Xenix system doing with /etc/systemid?)"
  2318.     fi
  2319. fi
  2320. if $test "$cont"; then
  2321.     $echo 'No, maybe "uuname -l" will work...'
  2322.     if ans=`sh -c 'uuname -l' 2>&1` ; then
  2323.         thishost=$ans
  2324.         phostcmd='uuname -l'
  2325.     else
  2326.         $echo 'Strange.  Maybe "uname -n" will work...'
  2327.         if ans=`sh -c 'uname -n' 2>&1` ; then
  2328.             thishost=$ans
  2329.             phostcmd='uname -n'
  2330.         else
  2331.             $echo 'Oh well, maybe I can mine it out of whoami.h...'
  2332.             if ans=`sh -c $contains' sysname $usrinclude/whoami.h' 2>&1` ; then
  2333.                 thishost=`$echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
  2334.                 phostcmd="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinclude/whoami.h"
  2335.             else
  2336.                 phostcmd=''
  2337.                 case "$phost" in
  2338.                 '') $echo "Does this machine have an identity crisis or something?" ;;
  2339.                 *)  $echo "Well, you said $phost before..."
  2340.                     thishost=$phost
  2341.                     ;;
  2342.                 esac
  2343.             fi
  2344.         fi
  2345.     fi
  2346. fi
  2347. : you do not want to know about this
  2348. set $thishost
  2349. thishost=$1
  2350.  
  2351. : translate upper to lower if necessary
  2352. case "$thishost" in
  2353. *[A-Z]*) thishost=`$echo $thishost | tr '[A-Z]' '[a-z]'`
  2354.      ;;
  2355. esac
  2356. case "$phost" in
  2357. '')    dflt="$thishost"
  2358.     case "$dflt" in
  2359.     *.*) ;;
  2360.     *) dflt="$dflt.UUCP";;
  2361.     esac
  2362.     ;;
  2363. *) dflt="$phost";;
  2364. esac
  2365. case "$thishost" in
  2366. *.*)    thishost=`$expr "X$thishost" : "X\([^.]*\)\."`;;
  2367. esac
  2368. $cat <<EOM
  2369.  
  2370. Trn wants to know what hostname your news software (usually inews) puts
  2371. into the "From" line of news articles posted from this machine.  If you
  2372. get this wrong the ownership checks done for Cancel, Supersede and
  2373. auto-post-selection (the -p option) will fail to recognize articles as
  2374. belonging to the poster.
  2375.  
  2376. (NOTE: trn does NOT create "From" lines when posting news or sending mail
  2377. as this is the job of your news/mail software, not trn.)
  2378.  
  2379. If you enter a filename here (by starting the name with '/' or '~') trn
  2380. will read the hostname from a file, otherwise specify as much of the
  2381. hostname as you want to be matched in the aforementioned comparisons.
  2382. If your response contains the current machine's name ($thishost) trn
  2383. will determine that portion at run-time.
  2384.  
  2385. EOM
  2386. rp="What hostname appears in the From line of this machine's postings?"
  2387. . ./myread
  2388. ans=`./filexp "$ans"`
  2389. case $ans in
  2390. /*)
  2391.     $echo "Trn will read the host name from $ans."
  2392.     if $test ! -f $ans ; then
  2393.     $echo "(You'll need to create $ans before trn will work.)"
  2394.     fi
  2395.     phost="$ans"
  2396.     phostcmd=''
  2397.     ;;
  2398. $thishost.*)
  2399.     phost="$ans"
  2400.     $echo "Using a dynamic host name."
  2401.     ;;
  2402. *)
  2403.     phost="$ans"
  2404.     phostcmd=''
  2405.     $echo "Using a static host name."
  2406.     ;;
  2407. esac
  2408.  
  2409. : see how we will look up host name
  2410. echo " "
  2411. if $test "X$phostcmd" = "X"; then
  2412.     : host name is static or a file
  2413.     d_gethname=''
  2414.     d_uname=''
  2415. elif set gethostname val -f d_gethname; eval $csym; $val; then
  2416.     echo 'gethostname() found.' >&4
  2417.     d_gethname="$define"
  2418.     ans=gethostname
  2419. elif set uname val -f d_uname; eval $csym; $val; then
  2420.     if xenix; then
  2421.         $cat <<'EOM'
  2422. uname() was found, but you're running xenix, and older versions of xenix
  2423. have a broken uname(). If you don't really know whether your xenix is old
  2424. enough to have a broken system call, use the default answer.
  2425.  
  2426. EOM
  2427.         dflt=y
  2428.         case "$d_uname" in
  2429.         "$define") dflt=n;;
  2430.         esac
  2431.         rp='Is your uname() broken?'
  2432.         . ./myread
  2433.         case "$ans" in
  2434.         n*) d_uname="$define"; ans=uname;;
  2435.         esac
  2436.     else
  2437.         echo 'uname() found.' >&4
  2438.         d_uname="$define"
  2439.         ans=uname
  2440.     fi
  2441. fi
  2442. case "$d_gethname" in
  2443. '') d_gethname="$undef";;
  2444. esac
  2445. case "$d_uname" in
  2446. '') d_uname="$undef";;
  2447. esac
  2448. case "$phostcmd" in
  2449. '') aphostcmd='';;
  2450. *) case "$aphostcmd" in
  2451.     /*) ;;
  2452.     *) set X $phostcmd
  2453.         shift
  2454.         file=$1
  2455.         shift
  2456.         file=`loc $file $file $pth`
  2457.         aphostcmd=`echo $file $*`
  2458.         ;;
  2459.     esac
  2460.     ;;
  2461. esac
  2462. case "$d_uname$d_gethname" in
  2463. *define*) ;;
  2464. *)
  2465.     case "$phostcmd" in
  2466.     '') ;;
  2467.     *)
  2468.         $cat <<EOT
  2469.  
  2470. There is no gethostname() or uname() on this system.  You have two
  2471. possibilities at this point:
  2472.  
  2473. 1)  You can have the hostname in postings ($phost) compiled into trn, which
  2474.     lets trn start up faster, but makes your binaries non-portable, or
  2475. 2)  you can have trn use a
  2476.     
  2477.     popen("$aphostcmd","r")
  2478.  
  2479.     which will start slower but be more portable.
  2480.  
  2481. If you want option 2 but with a different command, you can edit config.sh at
  2482. the end of this shell script.
  2483.  
  2484. EOT
  2485.         case "$d_phostcmd" in
  2486.         "$define") dflt=n;;
  2487.         "$undef")  dflt=y;;
  2488.         '')
  2489.             case "$d_portable" in
  2490.             "$define") dflt=n ;;
  2491.             *) dflt=y ;;
  2492.             esac;;
  2493.         esac
  2494.         rp="Do you want your host name compiled in?"
  2495.         . ./myread
  2496.         case "$ans" in
  2497.         n*) ;;
  2498.         *) aphostcmd='';;
  2499.         esac;;
  2500.     esac;;
  2501. esac
  2502. case "$aphostcmd" in
  2503. '') d_phostcmd="$undef";;
  2504. *) d_phostcmd="$define";;
  2505. esac
  2506.  
  2507. : see if there is a getpwent
  2508. echo " "
  2509. if set getpwent val -f d_getpwent; eval $csym; $val; then
  2510.     echo "getpwent() found." >&4
  2511.     val="$define"
  2512. else
  2513.     echo "No getpwent() found -- will use getpw() instead." >&4
  2514.     val="$undef"
  2515. fi
  2516. set d_getpwent
  2517. eval $setvar
  2518.  
  2519. : where do we get termlib routines from
  2520. echo " "
  2521. ans=`./loc libcurses.a x $libpth`
  2522. case "$ans" in
  2523. /*)
  2524.     ar t $ans >grimble
  2525.     if $contains tputs.o grimble >/dev/null 2>&1; then
  2526.         termlib='-lcurses'
  2527.         d_havetlib="$define"
  2528.         echo "Terminfo library found." >&4
  2529.     else
  2530.         ans=x
  2531.     fi
  2532.     rm -f grimble
  2533.     ;;
  2534. esac
  2535. case "$ans" in
  2536. x)
  2537.     ans=`./loc libtermlib.a x $libpth`
  2538.     case "$ans" in
  2539.     /usr/lib*|/lib*)
  2540.         termlib='-ltermlib'
  2541.         d_havetlib="$define"
  2542.         echo "Termlib library found." >&4
  2543.         ;;
  2544.     /*)
  2545.         termlib="$ans"
  2546.         d_havetlib="$define"
  2547.         echo "Termlib library found." >&4
  2548.         ;;
  2549.     *)
  2550.         ans=`./loc libtermcap.a x $libpth`
  2551.         case "$ans" in
  2552.         /usr/lib*|/lib*)
  2553.             termlib='-ltermcap'
  2554.             d_havetlib="$define"
  2555.             echo "Termcap library found." >&4
  2556.             ;;
  2557.         /*)
  2558.             termlib="$ans"
  2559.             d_havetlib="$define"
  2560.             echo "Termcap library found." >&4
  2561.             ;;
  2562.         *)
  2563.             case "$termlib" in
  2564.             '')
  2565.                 dflt=y
  2566. rp="Your system appears to NOT have termlib-style routines. Is this true?"
  2567.                 . ./myread
  2568.                 case "$ans" in
  2569.                 n*|f*) d_havetlib="$define"
  2570.                     $cat <<'EOM'
  2571. Then where are the termlib-style routines kept? Specify either -llibname
  2572. or a full pathname (~name ok).
  2573.  
  2574. EOM
  2575.                     dflt=''
  2576.                     rp='Specify termlib path:'
  2577.                     . ./myread
  2578.                     termlib=`./filexp $ans`
  2579.                     ;;
  2580.                 *)
  2581.                     d_havetlib="$undef"
  2582.                     termlib=''
  2583.                     echo "You will have to play around with term.c then." >&4
  2584.                     ;;
  2585.                 esac
  2586.             echo " ";;
  2587.             *)  echo "You said termlib was $termlib before." >&4;;
  2588.             esac;;
  2589.         esac;;
  2590.     esac;;
  2591. esac
  2592.  
  2593. : Decide whether to ignore the ORGANIZATION environment variable
  2594. case "$d_ignoreorg" in
  2595. "$define") dflt=y ;;
  2596. *)         dflt=n ;;
  2597. esac
  2598. cat <<EOM
  2599.  
  2600. $Package normally looks in the environment variables NEWSORG and ORGANIZATION
  2601. for an overriding organization name.  However, if your operating system
  2602. reserves the environment variable ORGANIZATION for other purposes, you
  2603. will want to ignore it and only have $package check for NEWSORG.
  2604.  
  2605. EOM
  2606. rp='Should ORGANIZATION be ignored?'
  2607. . ./myread
  2608. case "$ans" in
  2609. y*) d_ignoreorg="$define" ;;
  2610. *)  d_ignoreorg="$undef" ;;
  2611. esac
  2612.  
  2613. : determine the name of a reasonable mailer
  2614. case "$mailer" in
  2615. '')
  2616.     if $test -f "$sendmail"; then
  2617.         dflt="$sendmail"
  2618.     elif $test -f "$smail"; then
  2619.         dflt="$smail"
  2620.     elif $test -f "$rmail"; then
  2621.         dflt="$rmail"
  2622.     elif $test -f /bin/mail; then
  2623.         dflt=/bin/mail
  2624.     else
  2625.         dflt=$mail
  2626.     fi
  2627.     ;;
  2628. *)  dflt="$mailer";;
  2629. esac
  2630. $cat <<EOM
  2631.  
  2632. I need the full pathname of the program used to deliver mail on your system.
  2633. A typical answer would be /usr/lib/sendmail or /bin/rmail, but you may choose
  2634. any other program, as long as $package can feed its standard input and it
  2635. will honour any user-supplied headers.
  2636.  
  2637. EOM
  2638. fn=f
  2639. rp='Mail transport agent to be used?'
  2640. . ./getfile
  2641. mailer="$ans"
  2642.  
  2643. : check for internet mailer
  2644. case "$d_internet" in
  2645. "$undef") dflt=n;;
  2646. *)      dflt=y;;
  2647. esac
  2648. cat <<EOM
  2649.  
  2650. Most mailers can deliver mail to addresses of the INTERNET persuasion,
  2651. such as user@host.edu.  Some older mailers, however, require the complete
  2652. path to the destination to be specified in the address.
  2653.  
  2654. EOM
  2655. rp="Does your mailer understand INTERNET addresses?"
  2656. . ./myread
  2657. case "$ans" in
  2658. y*) val="$define";;
  2659. *)  val="$undef";;
  2660. esac
  2661. set d_internet
  2662. eval $setvar
  2663.  
  2664. : see how we invoke the C preprocessor
  2665. echo " "
  2666. echo "Now, how can we feed standard input to your C preprocessor..." >&4
  2667. cat <<'EOT' >testcpp.c
  2668. #define ABC abc
  2669. #define XYZ xyz
  2670. ABC.XYZ
  2671. EOT
  2672. cd ..
  2673. echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
  2674. chmod 755 cppstdin
  2675. wrapper=`pwd`/cppstdin
  2676. cd UU
  2677. if $test "X$cppstdin" != "X" && \
  2678.     $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
  2679.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2680.     echo "You used to use $cppstdin $cppminus so we'll use that again."
  2681. elif $test "$cc" = gcc && \
  2682.     (echo "Using gcc, eh?  We'll try to force gcc -E using a wrapper..."; \
  2683.     $wrapper <testcpp.c >testcpp.out 2>&1; \
  2684.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
  2685.     echo "Yup, we can."
  2686.     cppstdin="$wrapper"
  2687.     cppminus='';
  2688. elif echo 'Maybe "'"$cc"' -E" will work...'; \
  2689.     $cc -E <testcpp.c >testcpp.out 2>&1; \
  2690.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2691.     echo "Yup, it does."
  2692.     cppstdin="$cc -E"
  2693.     cppminus='';
  2694. elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
  2695.     $cc -E - <testcpp.c >testcpp.out 2>&1; \
  2696.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2697.     echo "Yup, it does."
  2698.     cppstdin="$cc -E"
  2699.     cppminus='-';
  2700. elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
  2701.     $wrapper <testcpp.c >testcpp.out 2>&1; \
  2702.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2703.     cppstdin="$wrapper"
  2704.     cppminus=''
  2705.     echo "Eureka!"
  2706. elif echo 'No such luck, maybe "'$cpp'" will work...'; \
  2707.     $cpp <testcpp.c >testcpp.out 2>&1; \
  2708.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2709.     echo "It works!"
  2710.     cppstdin="$cpp"
  2711.     cppminus='';
  2712. elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
  2713.     $cpp - <testcpp.c >testcpp.out 2>&1; \
  2714.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2715.     echo "Hooray, it works!  I was beginning to wonder."
  2716.     cppstdin="$cpp"
  2717.     cppminus='-';
  2718. elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
  2719.     $cc -P <testcpp.c >testcpp.out 2>&1; \
  2720.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2721.     echo "Yipee, that works!"
  2722.     cppstdin="$cc -P"
  2723.     cppminus='';
  2724. elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
  2725.     $cc -P - <testcpp.c >testcpp.out 2>&1; \
  2726.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2727.     echo "At long last!"
  2728.     cppstdin="$cc -P"
  2729.     cppminus='-';
  2730. else
  2731.     dflt=''
  2732.     rp="No dice.  I can't find a C preprocessor.  Name one:"
  2733.     . ./myread
  2734.     cppstdin="$ans"
  2735.     $cppstdin <testcpp.c >testcpp.out 2>&1
  2736.     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2737.         echo "OK, that will do." >&4
  2738.     else
  2739. echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
  2740.         exit 1
  2741.     fi
  2742. fi
  2743. $rm -f testcpp.c testcpp.out
  2744.  
  2745. : determine filename position in cpp output
  2746. echo " "
  2747. echo "Computing filename position in cpp output for #include directives..." >&4
  2748. echo '#include <stdio.h>' > foo.c
  2749. $cat >fieldn <<EOF
  2750. $startsh
  2751. $cppstdin $cppminus $cppflags <foo.c 2>/dev/null | \
  2752. $grep '^[     ]*#.*stdio\.h' | \
  2753. while read cline; do
  2754.     pos=1
  2755.     set \$cline
  2756.     while $test \$# -gt 0; do
  2757.         if $test -r \`echo \$1 | $tr -d '"'\`; then
  2758.             echo "\$pos"
  2759.             exit 0
  2760.         fi
  2761.         shift
  2762.         pos=\`expr \$pos + 1\`
  2763.     done
  2764. done
  2765. EOF
  2766. chmod +x fieldn
  2767. fieldn=`./fieldn`
  2768. $rm -f foo.c fieldn
  2769. case $fieldn in
  2770. '') pos='???';;
  2771. 1) pos=first;;
  2772. 2) pos=second;;
  2773. 3) pos=third;;
  2774. *) pos="${fieldn}th";;
  2775. esac
  2776. echo "Your cpp writes the filename in the $pos field of the line."
  2777.  
  2778. : locate header file
  2779. $cat >findhdr <<EOF
  2780. $startsh
  2781. wanted=\$1
  2782. name=''
  2783. if test -f $usrinc/\$wanted; then
  2784.     echo "$usrinc/\$wanted"
  2785.     exit 0
  2786. fi
  2787. awkprg='{ print \$$fieldn }'
  2788. echo "#include <\$wanted>" > foo\$\$.c
  2789. $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
  2790. $grep "^[     ]*#.*\$wanted" | \
  2791. while read cline; do
  2792.     name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
  2793.     case "\$name" in
  2794.     */\$wanted) echo "\$name"; exit 0;;
  2795.     *) name='';;
  2796.     esac;
  2797. done;
  2798. $rm -f foo\$\$.c;
  2799. case "\$name" in
  2800. '') exit 1;;
  2801. esac
  2802. EOF
  2803. chmod +x findhdr
  2804.  
  2805. : see if there are directory access routines out there
  2806. echo " "
  2807. if $test `./findhdr ndir.h` && \
  2808.       ( $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a ); then
  2809.     echo "Ndir library found." >&4
  2810.     if $test -r /usr/lib/libndir.a; then
  2811.         libndir='-lndir'
  2812.     else
  2813.         libndir="/usr/local/lib/libndir.a"
  2814.     fi
  2815.     d_libndir="$define"
  2816.     d_usendir="$undef"
  2817.     ndirc=''
  2818.     ndiro=''
  2819. else
  2820.     libndir=''
  2821.     d_libndir="$undef"
  2822.     if set readdir val -f; eval $csym; $val; then
  2823.     echo "No ndir library found, but you have readdir() so we'll use that." >&4
  2824.         d_usendir="$undef"
  2825.         ndirc=''
  2826.         ndiro=''
  2827.     else
  2828.         echo "No ndir library found--using ./ndir.c." >&4
  2829.         d_usendir="$define"
  2830.         ndirc='ndir.c'
  2831.         ndiro='ndir.o'
  2832.     fi
  2833. fi
  2834.  
  2835. : see if memcmp exists
  2836. set memcmp d_memcmp
  2837. eval $inlibc
  2838.  
  2839. : see if memcpy exists
  2840. set memcpy d_memcpy
  2841. eval $inlibc
  2842.  
  2843. : see if memset exists
  2844. set memset d_memset
  2845. eval $inlibc
  2846.  
  2847. : see if they want mime support
  2848. case "$d_mime" in
  2849. '')    if $test "$metamail$mhn" != metamailmhn; then
  2850.         dflt=y
  2851.     else
  2852.         dflt=n
  2853.     fi
  2854.     ;;
  2855. "$define") dflt=y;;
  2856. *)    dflt=n;;
  2857. esac
  2858. $cat <<EOM
  2859.  
  2860. $Package is able to use an external mime-processing program such as metamail
  2861. or mhn to display and store non-text mime articles.  If you don't have any
  2862. mime-processing programs installed at the moment answer no (you can come
  2863. back and Configure it in later).
  2864.  
  2865. EOM
  2866. rp="Do you want to include mime support?"
  2867. . ./myread
  2868. case "$ans" in
  2869. y*)    case "$mimeshow" in
  2870.     '')    if $test "$metamail" != metamail; then
  2871.             dflt="$metamail -e -p -m 'trn %s' %A"
  2872.         else
  2873.             dflt="$mhn -show -serialonly %A"
  2874.         fi
  2875.         ;;
  2876.     *)    dflt="$mimeshow";;
  2877.     esac
  2878.     rp="What command should be used for showing an article?"
  2879.     . ./myread
  2880.     mimeshow="$ans"
  2881.     case "$mimestore" in
  2882.     '')    dflt="$mhn -store -auto -file";;
  2883.     *)    dflt="$mimestore";;
  2884.     esac
  2885.     rp="What command should be used for storing an article?"
  2886.     . ./myread
  2887.     mimestore="$ans"
  2888.     d_mime="$define"
  2889.     ;;
  2890. *)    d_mime="$undef";;
  2891. esac
  2892.  
  2893. : get news administrator name
  2894. case "$newsadmin" in
  2895. '')
  2896.     if $contains "^news:" /etc/passwd >/dev/null 2>&1 ; then
  2897.         dflt=news
  2898.     elif $contains "^usenet:" /etc/passwd >/dev/null 2>&1 ; then
  2899.         dflt=usenet
  2900.     elif eunice; then
  2901.         dflt=system
  2902.     else
  2903.         dflt=root
  2904.     fi
  2905.     ;;
  2906. *)
  2907.     dflt="$newsadmin"
  2908.     ;;
  2909. esac
  2910. $cat <<'EOM'
  2911.  
  2912. Many systems keep their news in a private directory, or have a non-superuser
  2913. in charge of administering news.  (If you don't have such a user, take the
  2914. default answer.)  I need the login name (not directory) which is used for
  2915. news administration.
  2916.  
  2917. EOM
  2918. rp="News admin login?"
  2919. . ./myread
  2920. newsadmin="$ans"
  2921. case "$newsadmin" in
  2922. root) val="$undef" ;;
  2923. *) val="$define" ;;
  2924. esac
  2925. set d_newsadm
  2926. eval $setvar
  2927.  
  2928. : check for buffering of stdout
  2929. echo " "
  2930. case "$d_nolnbuf" in
  2931. '')
  2932.     $cat <<'EOT' >blurfl.c
  2933. #include <stdio.h>
  2934. main()
  2935. {
  2936.     int i;
  2937.  
  2938.     for (i = 0; i < 5; i++) {
  2939.         putchar(i+'a');
  2940.         sleep(1);
  2941.     }
  2942.     putchar('\n');
  2943. }
  2944. EOT
  2945.     $cc blurfl.c -o blurfl >/dev/null 2>&1;
  2946.     $rm -f blurfl.c
  2947.     $cat >&4 <<'EOM'
  2948. Checking for buffering of stdout to terminal.
  2949.  
  2950. Observe the following characters as they are printed out, to see whether they
  2951. print out all at once, or with a 1 second pause between each of them.  If they
  2952. print out one by one, you don't have buffering.  If they print together (after
  2953. about a 5 second pause), you do have buffering.
  2954.  
  2955. EOM
  2956.     dflt=''
  2957.     rp="Type return to start printing the test characters:"
  2958.     . ./myread
  2959.     ans=y
  2960.     while $test "$ans" = 'y'; do
  2961.         blurfl 1>&4
  2962.         dflt=n
  2963.         rp='Would you like to see that again?'
  2964.         . ./myread
  2965.     done
  2966.         dflt=y
  2967.         rp="Do you have buffering (printed all at once)?"
  2968.         . ./myread
  2969.         case "$ans" in
  2970.         n*) val="$define";;
  2971.         *)  val="$undef";;
  2972.         esac
  2973.         ;;
  2974. *)
  2975.     case "$d_nolnbuf" in
  2976.     "$define") dflt=n;;
  2977.     *) dflt=y;;
  2978.     esac
  2979.     rp="Do you have buffering on stdout to terminals?"
  2980.     . ./myread
  2981.     case "$ans" in
  2982.     n*) val="$define";;
  2983.     *)  val="$undef";;
  2984.     esac
  2985.     ;;
  2986. esac
  2987. set d_nolnbuf
  2988. eval $setvar
  2989.  
  2990. : see if we need -ljobs and if we have sigset, etc.
  2991. echo " "
  2992. if $test -r /usr/lib/libjobs.a || $test -r /usr/local/lib/libjobs.a ; then
  2993.     echo "Jobs library found." >&4
  2994.     val="$undef"
  2995.     jobslib='-ljobs'
  2996. else
  2997.     if bsd; then
  2998.         echo "No jobs library found. (I suppose this is at least 4.2...)" >&4
  2999.     else
  3000.         echo "No jobs library found. (That's okay, we all have our faults.)" >&4
  3001.     fi
  3002.     val="$define"
  3003.     jobslib=''
  3004. fi
  3005. set d_normsig
  3006. eval $setvar
  3007.  
  3008. : see if there is a vfork
  3009. echo " "
  3010. if set vfork val -f d_hvfork; eval $csym; $val; then
  3011.     echo "vfork() found." >&4
  3012.     val="$undef"
  3013. else
  3014.     echo "No vfork() found--will use fork() instead." >&4
  3015.     val="$define"
  3016. fi
  3017. set d_novfork
  3018. eval $setvar
  3019. case "$d_novfork" in
  3020. "$define") d_hvfork="$undef";;
  3021. *)       d_hvfork="$define";;
  3022. esac
  3023.  
  3024. : check for void type
  3025. echo " "
  3026. $echo "Checking to see how well your C compiler groks the void type..."
  3027. $cat >void.c <<'EOCP'
  3028. void main(){;}
  3029. EOCP
  3030. if $cc -c void.c >/dev/null 2>&1 ; then
  3031.     d_novoid="$undef"
  3032.     $echo "Yup, it does."
  3033. else
  3034.     d_novoid="$define"
  3035.     $echo "Nope, it doesn't (boo hiss).  I will substitute int."
  3036. fi
  3037. $rm void.*
  3038.  
  3039. : see if rdchk exists
  3040. set rdchk d_rdchk
  3041. eval $inlibc
  3042.  
  3043. : see if rename exists
  3044. set rename d_rename
  3045. eval $inlibc
  3046.  
  3047. : see if sigblock exists
  3048. set sigblock d_sigblock
  3049. eval $inlibc
  3050.  
  3051. : see if sighold exists
  3052. set sighold d_sighold
  3053. eval $inlibc
  3054.  
  3055. : see if we need to define size_t
  3056. if $contains 'size_t' /usr/include/string*.h >/dev/null 2>&1 ; then
  3057.     d_sizet="$undef"
  3058. else
  3059.     d_sizet="$define"
  3060. fi
  3061.  
  3062. : see if strcasecmp exists
  3063. set strcasecmp d_strcasecmp
  3064. eval $inlibc
  3065.  
  3066. : see which of string.h or strings.h is needed
  3067. echo " "
  3068. strings=`./findhdr string.h`
  3069. if $test "$strings" && $test -r "$strings"; then
  3070.     echo "Using <string.h> instead of <strings.h>." >&4
  3071.     val="$define"
  3072. else
  3073.     val="$undef"
  3074.     strings=`./findhdr strings.h`
  3075.     if $test "$strings" && $test -r "$strings"; then
  3076.     echo "Using <strings.h> instead of <string.h>." >&4
  3077.     else
  3078.     echo "No string header found -- You'll surely have problems." >&4
  3079.     fi
  3080. fi
  3081. set i_string
  3082. eval $setvar
  3083. case "$i_string" in
  3084. "$undef") strings=`./findhdr strings.h`;;
  3085. *)      strings=`./findhdr string.h`;;
  3086. esac
  3087.  
  3088. : index or strchr
  3089. echo " "
  3090. if set index val -f; eval $csym; $val; then
  3091.     if set strchr val -f d_strchr; eval $csym; $val; then
  3092.     if $contains strchr "$strings" >/dev/null 2>&1 ; then
  3093.         val="$define"
  3094.         echo "strchr() found." >&4
  3095.     else
  3096.         val="$undef"
  3097.         echo "index() found." >&4
  3098.     fi
  3099.     else
  3100.     val="$undef"
  3101.     echo "index() found." >&4
  3102.     fi
  3103. else
  3104.     if set strchr val -f d_strchr; eval $csym; $val; then
  3105.     val="$define"
  3106.     echo "strchr() found." >&4
  3107.     else
  3108.     echo "No index() or strchr() found!" >&4
  3109.     val="$undef"
  3110.     fi
  3111. fi
  3112. set d_strchr
  3113. eval $setvar
  3114.  
  3115. : see if strftime exists
  3116. case "$strftimec" in
  3117. '') ;;
  3118. *) d_strftime="$undef";;
  3119. esac
  3120. set strftime d_strftime
  3121. eval $inlibc
  3122. case "$d_strftime" in
  3123. "$undef")
  3124.     case "$strftimec" in
  3125.     ' ') dflt='none';;
  3126.     '') dflt="./strftime.c";;
  3127.     *)  dflt="$strftimec";;
  3128.     esac
  3129.     $cat <<EOM
  3130. $Package would like to use a strftime(3) routine.  If you have source for a
  3131. fully POSIX.1 compliant version, you may use it, otherwise you can try
  3132. using the one supplied with $package (strftime.c) or answering "none".
  3133.  
  3134. EOM
  3135.     fn=fn
  3136.     rp="Where does the source for strftime(3) reside?"
  3137.     . ./getfile
  3138.     case "$ans" in
  3139.     '')    strftimec=' '
  3140.         strftimeo=''
  3141.         ;;
  3142.     *)    strftimec="$ans"
  3143.         strftimeo="`basename $ans .c`.o"
  3144.         d_strftime="$define"
  3145.         ;;
  3146.     esac
  3147.     ;;
  3148. *)    strftimec=''
  3149.     strftimeo=''
  3150.     ;;
  3151. esac
  3152.  
  3153. : locate news spool directory
  3154. if $test "X$d_nntp" = "X$define" ; then
  3155.     newsspool="/tmp"
  3156. else
  3157.     case "$newsspool" in
  3158.     '') dflt=/usr/spool/news;;
  3159.     *) dflt="$newsspool";;
  3160.     esac
  3161.     $echo " "
  3162.     fn=d~
  3163.     rp='Where is news spooled?'
  3164.     . ./getfile
  3165.     newsspool="$ans"
  3166. fi
  3167.  
  3168. : find out what database support they want and any file placement details
  3169. case "$d_useov$d_usemt" in
  3170. "$undef$undef")  dflt=none;;
  3171. "$undef$define") dflt=threads;;
  3172. "$define$undef") dflt=overviews;;
  3173. *) dflt=both;;
  3174. esac
  3175. $cat <<EOM
  3176.  
  3177. $Package can take advantage of an mthreads or news overview database if
  3178. one or both of these are available on your system.  Usually $package will
  3179. figure out what's available for itself, but you can have support for
  3180. one or both of these databases disabled by default, if desired.
  3181.  
  3182. EOM
  3183. rp="Default database support for 't'hreads, 'o'verviews, 'b'oth, or 'n'one?"
  3184. . ./myread
  3185. case "$ans" in
  3186. t*)    databases=threads
  3187.     d_useov="$undef"
  3188.     d_usemt="$define"
  3189.     xxx=thread
  3190.     ;;
  3191. o*)    databases=overviews
  3192.     d_useov="$define"
  3193.     d_usemt="$undef"
  3194.     xxx=overview
  3195.     ;;
  3196. n*)    databases=none
  3197.     d_useov="$undef"
  3198.     d_usemt="$undef"
  3199.     ;;
  3200. *)    databases=both
  3201.     d_useov="$define"
  3202.     d_usemt="$define"
  3203.     xxx="thread or overview"
  3204.     ;;
  3205. esac
  3206. case "$threaddir" in
  3207. '')    if $test "X$d_nntp" = "X$define" -a "$d_xdata" = "$undef"; then
  3208.         dflt="/usr/spool/threads"
  3209.     else
  3210.         dflt="$newsspool"
  3211.     fi
  3212.     ;;
  3213. *)    dflt="$threaddir";;
  3214. esac
  3215. if $test "$d_xdata" = "$define" -o "$databases" = "none"; then
  3216.     ans="$dflt"
  3217. else
  3218.     $echo " "
  3219.     $echo "$Package needs to know the base directory for the $xxx files"
  3220.     $echo "on your system."
  3221.     rp="Where do $xxx files reside?"
  3222.     . ./myread
  3223. fi
  3224. threaddir="$ans"
  3225. overviewdir="$ans"
  3226.  
  3227. : preserve RCS keywords in files with variable substitution, grrr
  3228. Id='$Id'
  3229. Log='$Log'
  3230.  
  3231. : determine where public executables go
  3232. $echo " "
  3233. case "$bin" in
  3234. '') dflt=`./loc . /local/bin /usr/local/bin /usr/local/bin /usr/lbin /usr/local /usr/bin /bin` ;;
  3235. *)  dflt="$bin" ;;
  3236. esac
  3237. fn=d~
  3238. rp='Pathname where the public executables will reside?'
  3239. . ./getfile
  3240. if $test "X$bin" != "X$ans"; then
  3241.     installbin=''
  3242. fi
  3243. bin="$ans"
  3244.  
  3245. case "$installbin" in
  3246. '') dflt=`echo $bin | sed 's#^/afs/#/afs/.#'` ;;
  3247. *)  dflt="$installbin" ;;
  3248. esac
  3249. $cat <<EOM
  3250.  
  3251. To install the files in this directory, a few strange systems need
  3252. to use a different directory name to get the files there.
  3253.  
  3254. EOM
  3255. rp='What directory name should be used for the install?'
  3256. . ./getfile
  3257. installbin="$ans"
  3258.  
  3259. : get the local distributions
  3260. $cat <<'EOH'
  3261.  
  3262. Distribution groups are the things you use on the Distribution line to limit
  3263. where an article will go to.  You are likely to be a member of several
  3264. distribution groups, such as organization, city, state, province, country,
  3265. continent, etc.  For example, Los Angeles has the distribution code "la",
  3266. New Jersey has the code "nj", and Europe has the code "eunet".
  3267.  
  3268. The categories you will be asked are: 
  3269.  
  3270. local organization    (Could be just one machine or a cluster or an office)
  3271. organization        att, dec, kgb, ...
  3272. city            la, ny, mosc, ...
  3273. state/province        ca, nj, bc, ...
  3274. country            usa, can, rok, whatever
  3275. continent        na (North America), asia, etc.
  3276.  
  3277. EOH
  3278. if $test -f $newslibexp/distributions; then
  3279.     case "$silent" in
  3280.     true) ;;
  3281.     *)    dflt='Hit return to continue'
  3282.         rp=''
  3283.         . ./myread
  3284.         ;;
  3285.     esac
  3286.     $echo "Here is your distributions file:" >&4
  3287.     $echo " " >&4
  3288.     $cat >&4 $newslibexp/distributions
  3289.     $echo " " >&4
  3290. fi
  3291. $echo "Use 'none' for any distributions you don't have."
  3292. $echo " "
  3293. case "$locdist" in
  3294. '') dflt="none";;
  3295. *)  dflt="$locdist";;
  3296. esac
  3297. rp="What is the distribution code for your local organization?"
  3298. . ./myread
  3299. locdist="$ans"
  3300. case "$orgdist" in
  3301. '') dflt="none";;
  3302. *)  dflt="$orgdist";;
  3303. esac
  3304. rp="What is the distribution code for your organization?"
  3305. . ./myread
  3306. orgdist="$ans"
  3307. case "$citydist" in
  3308. '') dflt="none";;
  3309. *)  dflt="$citydist";;
  3310. esac
  3311. rp="What is the distribution code for your city?"
  3312. . ./myread
  3313. citydist="$ans"
  3314. case "$statedist" in
  3315. '') dflt="none";;
  3316. *)  dflt="$statedist";;
  3317. esac
  3318. rp="What is the distribution code for your state/province?"
  3319. . ./myread
  3320. statedist="$ans"
  3321. case "$cntrydist" in
  3322. '') dflt="none";;
  3323. *)  dflt="$cntrydist";;
  3324. esac
  3325. rp="What is the distribution code for your country?"
  3326. . ./myread
  3327. cntrydist="$ans"
  3328. case "$contdist" in
  3329. '') dflt="none";;
  3330. *)  dflt="$contdist";;
  3331. esac
  3332. rp="What is the distribution code for your continent?"
  3333. . ./myread
  3334. contdist="$ans"
  3335. $cat <<'EOM'
  3336.   
  3337. If you have any other distribution groups you will need to edit Pnews
  3338. and newsetup to add them.
  3339. EOM
  3340.  
  3341. : determine default editor
  3342. case "$defeditor" in
  3343. '')
  3344.     case "$_vi" in
  3345.     */*) dflt="$_vi";;
  3346.     *) dflt=/usr/ucb/vi;;
  3347.     esac
  3348.     ;;
  3349. *)  dflt="$defeditor"
  3350.     ;;
  3351. esac
  3352. $echo " "
  3353. fn=f/
  3354. rp="What is the default editor on your system?"
  3355. . ./getfile
  3356. defeditor="$ans"
  3357.  
  3358. : determine where private executables go
  3359. case "$privlib" in
  3360. '')    dflt=/usr/lib/$package
  3361.     $test -d /usr/local/lib && dflt=/usr/local/lib/$package
  3362.     $test -d /local/lib && dflt=/local/lib/$package ;;
  3363. *)    dflt="$privlib" ;;
  3364. esac
  3365. $cat <<EOM
  3366.  
  3367. There are some auxiliary files for $package that need to be put into a
  3368. private library directory that is accessible by everyone.
  3369.  
  3370. EOM
  3371. fn=d~+
  3372. rp='Pathname where the private library files will reside?'
  3373. . ./getfile
  3374. if $test "X$privlib" != "X$ans"; then
  3375.     installprivlib=''
  3376. fi
  3377. privlib="$ans"
  3378.  
  3379. case "$installprivlib" in
  3380. '') dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'` ;;
  3381. *)  dflt="$installprivlib" ;;
  3382. esac
  3383. $cat <<EOM
  3384.  
  3385. To install the files in this directory, a few strange systems need
  3386. to use a different directory name to get the files there.
  3387.  
  3388. EOM
  3389. rp='What directory name should be used for the install?'
  3390. . ./getfile
  3391. installprivlib="$ans"
  3392.  
  3393. : must not allow self reference
  3394. case "$privlib" in
  3395. /*)    filexp=$privlib/filexp ;;
  3396. *)    filexp=Rnfilexp ;;
  3397. esac
  3398.  
  3399. : check for ispell spelling checker
  3400. case "$ispell_prg" in
  3401. none)    dflt=n
  3402.     dflt_prg=
  3403.     dflt_options=
  3404.     ;;
  3405. '')    if $test -n "$ispell" -a "$ispell" != "ispell"; then
  3406.         dflt=y
  3407.         dflt_prg=$ispell
  3408.         dflt_options='-x'
  3409.     else
  3410.         dflt=n
  3411.         dflt_prg=
  3412.         dflt_options=
  3413.     fi
  3414.     ;;
  3415. *)    dflt=y
  3416.     dflt_prg=$ispell_prg
  3417.     dflt_options=$ispell_options
  3418.     ;;
  3419. esac
  3420. $cat <<EOM
  3421.  
  3422. Pnews has a "Check spelling" option that will allow you to correct spelling
  3423. errors if you have ispell, or will simply list possible spelling errors via
  3424. spell if you don't.
  3425.  
  3426. EOM
  3427. if $test -n "$dflt_prg"; then
  3428.     $echo "Configure has found ispell as $dflt_prg"
  3429. else
  3430.     $echo "Configure was unable to find ispell"
  3431. fi
  3432. rp="Do you want to use ispell?"
  3433. . ./myread
  3434. case "$ans" in
  3435. y*)    dflt=$dflt_prg
  3436.     fn=f/
  3437.     rp='What is the full pathname of the executable?'
  3438.     . ./getfile
  3439.     ispell_prg=$ans
  3440.     case "$dflt_options" in
  3441.     '') dflt=none;;
  3442.     *) dflt=$dflt_options;;
  3443.     esac
  3444.     rp="What options should be used?"
  3445.     . ./myread
  3446.     case "$ans" in
  3447.     none)    ispell_options='';;
  3448.     *)    ispell_options=$ans;;
  3449.     esac
  3450.     ;;
  3451. *)    ispell_prg='none'
  3452.     ;;
  3453. esac
  3454.  
  3455. : determine where mail is spooled
  3456. case "$mailfile" in
  3457. '')
  3458.     dflt=`./loc . XXX /usr/spool/mail /usr/mail`
  3459.     case "$dflt" in
  3460.     XXX) dflt='%~/mailbox';;
  3461.     *) dflt="$dflt/%L";;
  3462.     esac
  3463.     ;;
  3464. *)  dflt="$mailfile"
  3465.     ;;
  3466. esac
  3467. cat <<'EOM'
  3468.  
  3469. In the following question, you may use %~ to represent the user's home
  3470. directory, and %L to represent a users name.
  3471.  
  3472. EOM
  3473. rp='In which file is yet-to-be-read mail spooled? (~name ok)'
  3474. . ./myread
  3475. mailfile=`./filexp "$ans"`
  3476.  
  3477. : determine where manual pages go
  3478. $cat <<EOM
  3479.  
  3480. $package has manual pages available in source form.
  3481. EOM
  3482. case "$nroff" in
  3483. nroff)
  3484.     echo "However, you don't have nroff, so they're probably useless to you."
  3485.     case "$mansrc" in
  3486.     '') mansrc="none";;
  3487.     esac;;
  3488. esac
  3489. echo "If you don't want the manual sources installed, answer 'none'."
  3490. case "$mansrc" in
  3491. '')
  3492.     mansrc=`./loc . /usr/local/man/man1 /usr/local/man/man1 /usr/man/manl /usr/man/local/man1 /usr/man/l_man/man1 /usr/local/man/u_man/man1 /usr/local/man/l_man/man1 /usr/man/man.L`
  3493.     if $test -d "$mansrc"; then
  3494.         dflt="$mansrc"
  3495.     else
  3496.         dflt="$sysman"
  3497.     fi
  3498.     ;;
  3499. *)  dflt="$mansrc"
  3500.     ;;
  3501. esac
  3502. echo " "
  3503. fn=dn~
  3504. rp='Where do the manual pages (source) go?'
  3505. . ./getfile
  3506. mansrc="$ans"
  3507. case "$mansrc" in
  3508. '') manext='0';;
  3509. *l) manext=l;;
  3510. *n) manext=n;;
  3511. *o) manext=l;;
  3512. *p) manext=n;;
  3513. *C) manext=C;;
  3514. *L) manext=L;;
  3515. *L1) manext=L1;;
  3516. *) manext=1;;
  3517. esac
  3518.  
  3519. : determine how to determine when a file is a mailbox
  3520. case "$mboxchar" in
  3521. '') dflt=F;;
  3522. *)  dflt="$mboxchar";;
  3523. esac
  3524. $cat <<EOM
  3525.  
  3526. In saving articles, $package wants to differentiate between saving to
  3527. mailbox format files and normal files.  It does this by examining the
  3528. first character of the file in question.  On most systems the first line
  3529. starts with "From ...", so the first character is an F.  Other systems
  3530. use magic cookies like control codes between articles, so one of those
  3531. would be first.
  3532.  
  3533. EOM
  3534. rp="What's the first character of a mailbox file?"
  3535. . ./myread
  3536. mboxchar="$ans"
  3537. case "$mboxchar" in
  3538. 'F') ;;
  3539. *)  cat <<'EOM'
  3540.  
  3541. You will need to edit the shell script mbox.saver to properly append an
  3542. article to a mailbox.  The arguments to the script are documented in
  3543. EOM
  3544.     case "$shsharp" in
  3545.     false) echo "comments in mbox.saver.std.";;
  3546.     true) echo "comments in the shell script itself.";;
  3547.     esac
  3548. esac
  3549.  
  3550. : get organization name
  3551. longshots='/local/src /usr/src/new /usr/src/local /usr/local/src'
  3552. case "$orgname" in
  3553. '')    xxx=`./loc news/src/defs.h x $longshots`
  3554.     if $test $xxx != x; then
  3555.         dflt=`$sed -n 's/^.*MYORG[     ]*"\(.*\)".*$/\1/p' $xxx`
  3556.     else
  3557.         if $test -f /usr/lib/news/organi[sz]ation; then
  3558.             dflt=/usr/lib/news/organi[sz]ation
  3559.         else
  3560.             dflt=''
  3561.         fi
  3562.     fi
  3563.     ;;
  3564. *)    dflt="$orgname";;
  3565. esac
  3566. $cat << 'EOH'
  3567.  
  3568. Please type the name of your organization as you want it to appear on the
  3569. Organization line of outgoing articles.  (It's nice if this also specifies
  3570. your location.  Your city name is probably sufficient if well known.)
  3571. For example:
  3572.  
  3573.     University of Southern North Dakota, Hoople
  3574.  
  3575. You may also put the name of a file, as long as it begins with a slash.
  3576. For example:
  3577.  
  3578.     /etc/organization
  3579.  
  3580. EOH
  3581. orgname=""
  3582. while test "X$orgname" = "X"; do
  3583.     rp='Organization:'
  3584.     . ./myread
  3585.     orgname="$ans"
  3586. done
  3587.  
  3588. : locate the preferred pager for this system
  3589. case "$pager" in
  3590. '')
  3591.     case "$pg" in
  3592.     /*) dflt=$pg;;
  3593.     esac
  3594.     case "$less" in
  3595.     /*) dflt=$less;;
  3596.     esac
  3597.     case "$more" in
  3598.     /*) dflt=$more;;
  3599.     esac
  3600.     case "$dflt" in
  3601.     '') dflt=/usr/ucb/more;;
  3602.     esac
  3603.     ;;
  3604. *) dflt="$pager";;
  3605. esac
  3606. $cat <<EOM
  3607.  
  3608. Some of the support scripts want to use a paging program such as "more"
  3609. to help the user page through the generated output.  You'll probably
  3610. want the most innocuous pager you have, since some lists consist of only
  3611. one line (if your kernel does terminal paging then you may answer this
  3612. with "$cat").  Also note that this does not affect the paging of
  3613. articles, as trn uses an internal pager for that.
  3614.  
  3615. EOM
  3616. fn=f/
  3617. rp='What pager should we use?'
  3618. . ./getfile
  3619. pager="$ans"
  3620.  
  3621. : find out which shell people like to use most
  3622. case "$prefshell" in
  3623. '')
  3624.     case "$ksh $bash $csh" in
  3625.     */ksh*) dflt="$ksh" ;;
  3626.     */bash*) dflt="$bash" ;;
  3627.     */csh*) dflt="$csh" ;;
  3628.     *) dflt='/bin/sh' ;;
  3629.     esac
  3630.     ;;
  3631. *)  dflt="$prefshell";;
  3632. esac
  3633. $cat <<EOM
  3634.  
  3635. Give the full path name of the shell most people like to use on your system.
  3636. This will be used by $package whenever the user wants to get a shell
  3637. escape (for instance) and is not necessarily the same as the shell you are
  3638. currently using (${SHELL-/bin/sh}).
  3639.  
  3640. EOM
  3641. fn=f/~
  3642. rp='Preferred shell to be used?'
  3643. . ./getfile
  3644. prefshell=$ans
  3645.  
  3646. : determine root id
  3647. echo " "
  3648. rootid=`$sed -e "/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e "q" -e "}" -e "d" </etc/passwd`
  3649. case "$rootid" in
  3650. '') rootid=0 ;;
  3651. *) echo "Root uid = $rootid" >&4 ;;
  3652. esac
  3653.  
  3654. : see if signal is declared as pointer to function returning int or void
  3655. echo " "
  3656. xxx=`./findhdr signal.h`
  3657. $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
  3658. if $contains 'int.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  3659.     echo "You have int (*signal())() instead of void." >&4
  3660.     val="$undef"
  3661.     signal_t="int"
  3662. elif $contains 'void.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  3663.     echo "You have void (*signal())() instead of int." >&4
  3664.     val="$define"
  3665.     signal_t="void"
  3666. elif $contains 'extern[     ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
  3667.     echo "You have int (*signal())() instead of void." >&4
  3668.     val="$undef"
  3669.     signal_t="int"
  3670. else
  3671.     case "$d_voidsig" in
  3672.     '')
  3673.     echo "I can't determine whether signal handler returns void or int..." >&4
  3674.         dflt=void
  3675.         rp="What type does your signal handler returns?"
  3676.         . ./myread
  3677.         case "$ans" in
  3678.         void) val="$define"; signal_t="void";;
  3679.         *) val="$undef"; signal_t="int";;
  3680.         esac;;
  3681.     *) echo "As you already told me, signal handler returns $signal_t." >&4;;
  3682.     esac
  3683. fi
  3684. set d_voidsig
  3685. eval $setvar
  3686. $rm -f $$.tmp
  3687.  
  3688. : check if they want threads by default
  3689. case "$trn_init" in
  3690. F*) dflt="n";;
  3691. *)  dflt="y";;
  3692. esac
  3693. $cat <<'EOM'
  3694.  
  3695. Trn has two distinct operating modes (selected by the -x option):
  3696. traditional rn and threaded rn.  If you like, trn will check the first
  3697. letter of the command name and default to threaded mode (-x) if it is
  3698. a 't', or run as traditional rn (+x) if it isn't (this lets you install
  3699. as both trn and rn, linked together).  Otherwise, you can install trn
  3700. to default to threaded rn (-x) no matter what its name is.
  3701.  
  3702. EOM
  3703. rp='Do you want trn to default to -x, regardless of name?'
  3704. . ./myread
  3705. case "$ans" in
  3706. n*|f*)    trn_init='FALSE'
  3707.     ans=' for trn (not rn)';;
  3708. *)    trn_init='TRUE'
  3709.     ans='';;
  3710. esac
  3711. : check if they want the selector used by default
  3712. case "$trn_select" in
  3713. F*) dflt="n";;
  3714. *)  dflt="y";;
  3715. esac
  3716. $cat <<'EOM'
  3717.  
  3718. When the -X option is specified, trn will set the default command
  3719. for starting a newsgroup to be the selector.
  3720.  
  3721. EOM
  3722. rp="Should the -X option be on by default$ans?"
  3723. . ./myread
  3724. case "$ans" in
  3725. n*|f*) trn_select=FALSE;;
  3726. *)     trn_select=TRUE;;
  3727. esac
  3728.  
  3729. : see if this is a dirent system
  3730. echo " "
  3731. if xinc=`./findhdr dirent.h`; $test "$xinc"; then
  3732.     val="$define"
  3733.     echo "<dirent.h> found." >&4
  3734. else
  3735.     val="$undef"
  3736.     if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
  3737.         echo "<sys/dir.h> found." >&4
  3738.         echo " "
  3739.     else
  3740.         xinc=`./findhdr sys/ndir.h`
  3741.     fi
  3742.     echo "<dirent.h> NOT found." >&4
  3743. fi
  3744. set i_dirent
  3745. eval $setvar
  3746.  
  3747. : see if ptem.h exists
  3748. if $test -r /usr/include/sys/ptem.h ; then
  3749.     $echo "sys/ptem.h found."
  3750.     i_ptem="$define"
  3751. else
  3752.     i_ptem="$undef"
  3753. fi
  3754.  
  3755. : get C preprocessor symbols handy
  3756. echo " "
  3757. echo $attrlist | $tr ' ' '\012' >Cppsym.know
  3758. $cat <<EOSS >Cppsym
  3759. $startsh
  3760. case "\$1" in
  3761. -l) list=true
  3762.     shift
  3763.     ;;
  3764. esac
  3765. unknown=''
  3766. case "\$list\$#" in
  3767. 1|2)
  3768.     for sym do
  3769.         if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  3770.             exit 0
  3771.         elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  3772.             :
  3773.         else
  3774.             unknown="\$unknown \$sym"
  3775.         fi
  3776.     done
  3777.     set X \$unknown
  3778.     shift
  3779.     ;;
  3780. esac
  3781. case \$# in
  3782. 0) exit 1;;
  3783. esac
  3784. echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
  3785. #ifdef \1\\
  3786. exit 0; _ _ _ _\1\\     \1\\
  3787. #endif\\
  3788. /' >Cppsym\$\$
  3789. echo "exit 1; _ _ _" >>Cppsym\$\$
  3790. $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
  3791. case "\$list" in
  3792. true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
  3793. *)
  3794.     sh Cppsym2\$\$
  3795.     status=\$?
  3796.     ;;
  3797. esac
  3798. $rm -f Cppsym\$\$ Cppsym2\$\$
  3799. exit \$status
  3800. EOSS
  3801. chmod +x Cppsym
  3802. $eunicefix Cppsym
  3803. echo "Your C preprocessor defines the following symbols:"
  3804. Cppsym -l $attrlist >Cppsym.true
  3805. $cat Cppsym.true
  3806.  
  3807. : see if this is a termio system
  3808. val="$undef"
  3809. val2="$undef"
  3810. val3="$undef"
  3811. if $test `./findhdr termios.h`; then
  3812.     set tcsetattr i_termios
  3813.     eval $inlibc
  3814.     val3="$i_termios"
  3815. fi
  3816. echo " "
  3817. case "$val3" in
  3818. "$define") echo "You have POSIX termios.h... good!" >&4;;
  3819. *) if Cppsym pyr; then
  3820.         case "`/bin/universe`" in
  3821.         ucb) if $test `./findhdr sgtty.h`; then
  3822.                 val2="$define"
  3823.                 echo "<sgtty.h> found." >&4
  3824.             else
  3825.                 echo "System is pyramid with BSD universe."
  3826.                 echo "<sgtty.h> not found--you could have problems." >&4
  3827.             fi;;
  3828.         *) if $test `./findhdr termio.h`; then
  3829.                 val="$define"
  3830.                 echo "<termio.h> found." >&4
  3831.             else
  3832.                 echo "System is pyramid with USG universe."
  3833.                 echo "<termio.h> not found--you could have problems." >&4
  3834.             fi;;
  3835.         esac
  3836.     elif usg; then
  3837.         if $test `./findhdr termio.h`; then
  3838.             echo "<termio.h> found." >&4
  3839.             val="$define"
  3840.         elif $test `./findhdr sgtty.h`; then
  3841.             echo "<sgtty.h> found." >&4
  3842.             val2="$define"
  3843.         else
  3844. echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
  3845.         fi
  3846.     else
  3847.         if $test `./findhdr sgtty.h`; then
  3848.             echo "<sgtty.h> found." >&4
  3849.             val2="$define"
  3850.         elif $test `./findhdr termio.h`; then
  3851.             echo "<termio.h> found." >&4
  3852.             val="$define"
  3853.         else
  3854. echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
  3855.         fi
  3856.     fi;;
  3857. esac
  3858. set i_termio; eval $setvar
  3859. val=$val2; set i_sgtty; eval $setvar
  3860. val=$val3; set i_termios; eval $setvar
  3861.  
  3862. : define an alternate in-header-list? function
  3863. inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
  3864. cont=true; xxf="echo \"<\$1> found.\" >&4";
  3865. case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
  3866. *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
  3867. esac;
  3868. case $# in 4) instead=instead;; *) instead="at last";; esac;
  3869. while $test "$cont"; do
  3870.     xxx=`./findhdr $1`
  3871.     var=$2; eval "was=\$$2";
  3872.     if $test "$xxx" && $test -r "$xxx";
  3873.     then eval $xxf;
  3874.         eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
  3875.         cont="";
  3876.     else eval $xxnf;
  3877.         eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
  3878.     set $yyy; shift; shift; yyy=$@;
  3879.     case $# in 0) cont="";;
  3880.     2) xxf="echo \"but I found <\$1> $instead.\" >&4";
  3881.         xxnf="echo \"and I did not find <\$1> either.\" >&4";;
  3882.     *) xxf="echo \"but I found <\$1\> instead.\" >&4";
  3883.         xxnf="echo \"there is no <\$1>, ...\" >&4";;
  3884.     esac;
  3885. done;
  3886. while $test "$yyy";
  3887. do set $yyy; var=$2; eval "was=\$$2";
  3888.     eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
  3889.     set $yyy; shift; shift; yyy=$@;
  3890. done'
  3891.  
  3892. : see if stdlib is available
  3893. set stdlib.h i_stdlib
  3894. eval $inhdr
  3895.  
  3896. : see if this is an sysdir system
  3897. set sys/dir.h i_sysdir
  3898. eval $inhdr
  3899.  
  3900. : see if ioctl defs are in sgtty/termio or sys/ioctl
  3901. echo " "
  3902. if $test `./findhdr sys/ioctl.h`; then
  3903.     val="$define"
  3904.     echo "<sys/ioctl.h> found." >&4
  3905. else
  3906.     val="$undef"
  3907.     $test $i_termio = "$define" && xxx="termio.h"
  3908.     $test $i_termios = "$define" && xxx="termios.h"
  3909.     $test $i_sgtty = "$define" && xxx="sgtty.h"
  3910. echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
  3911. fi
  3912. set i_sysioctl
  3913. eval $setvar
  3914.  
  3915. : see if this is an sysndir system
  3916. set sys/ndir.h i_sysndir
  3917. eval $inhdr
  3918.  
  3919. : see if we should include time.h, sys/time.h, or both
  3920. echo " "
  3921. echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
  3922. $echo $n "I'm now running the test program...$c"
  3923. $cat >try.c <<'EOCP'
  3924. #include <sys/types.h>
  3925. #ifdef I_TIME
  3926. #include <time.h>
  3927. #endif
  3928. #ifdef I_SYSTIME
  3929. #include <sys/time.h>
  3930. #endif
  3931. #ifdef I_SYSSELECT
  3932. #include <sys/select.h>
  3933. #endif
  3934. main()
  3935. {
  3936.     struct tm foo;
  3937. #ifdef S_TIMEVAL
  3938.     struct timeval bar;
  3939. #endif
  3940. #ifdef S_TIMEZONE
  3941.     struct timezone tzp;
  3942. #endif
  3943.     if (foo.tm_sec == foo.tm_sec)
  3944.         exit(0);
  3945. #ifdef S_TIMEVAL
  3946.     if (bar.tv_sec == bar.tv_sec)
  3947.         exit(0);
  3948. #endif
  3949.     exit(1);
  3950. }
  3951. EOCP
  3952. flags=''
  3953. for s_timezone in '-DS_TIMEZONE' ''; do
  3954. sysselect=''
  3955. for s_timeval in '-DS_TIMEVAL' ''; do
  3956. for i_time in '' '-DI_TIME'; do
  3957. for i_systime in '-DI_SYSTIME' ''; do
  3958.     case "$flags" in
  3959.     '') $echo $n ".$c"
  3960.         if $cc $ccflags \
  3961.         $i_time $i_systime $sysselect $s_timeval $s_timezone \
  3962.         try.c -o try >/dev/null 2>&1 ; then
  3963.             set X $i_time $i_systime $sysselect $s_timeval
  3964.             shift
  3965.             flags="$*"
  3966.             echo " "
  3967.             $echo $n "Succeeded with $flags$c"
  3968.         fi
  3969.         ;;
  3970.     esac
  3971. done
  3972. done
  3973. done
  3974. done
  3975. echo " "
  3976. case "$flags" in
  3977. *I_TIME*) i_time="$define"
  3978.     echo "We'll include <time.h>." >&4;;
  3979. *) i_time="$undef";;
  3980. esac
  3981. case "$flags" in
  3982. *I_SYSTIME*) i_systime="$define"
  3983.     echo "We'll include <sys/time.h>." >&4;;
  3984. *) i_systime="$undef";;
  3985. esac
  3986. $rm -f try.c try
  3987.  
  3988. : see if this is a unistd.h system
  3989. set unistd.h i_unistd
  3990. eval $inhdr
  3991.  
  3992. : see if this is a vfork system
  3993. set vfork.h i_vfork
  3994. eval $inhdr
  3995.  
  3996. : end of configuration questions
  3997. echo " "
  3998. echo "End of configuration questions."
  3999. echo " "
  4000.  
  4001. : back to where it started
  4002. if test -d ../UU; then
  4003.     mv filexp ..
  4004.     cd ..
  4005. fi
  4006.  
  4007. : configuration may be patched via a 'config.over' file
  4008. if $test -f config.over; then
  4009.     echo " "
  4010.     dflt=y
  4011.     rp='I see a config.over file.  Do you wish to load it?'
  4012.     . ./UU/myread
  4013.     case "$ans" in
  4014.     n*) echo "OK, I'll ignore it.";;
  4015.     *)    . ./config.over
  4016.         echo "Configuration override changes have been loaded."
  4017.         ;;
  4018.     esac
  4019. fi
  4020.  
  4021. : create config.sh file
  4022. echo " "
  4023. echo "Creating config.sh..." >&4
  4024. cf_time=`$date 2>&1`
  4025. cf_by=`( (logname) 2>/dev/null || whoami) 2>&1`
  4026. $spitshell <<EOT >config.sh
  4027. $startsh
  4028. #
  4029. # This file was produced by running the Configure script. It holds all the
  4030. # definitions figured out by Configure. Should you modify one of these values,
  4031. # do not forget to propagate your changes by running "Configure -der". You may
  4032. # instead choose to run each of the .SH files by yourself, or "Configure -S".
  4033. #
  4034.  
  4035. # Configuration time: $cf_time
  4036. # Configured by: $cf_by
  4037. # Target system: $myuname
  4038.  
  4039. cf_by='$cf_by'
  4040. cf_time='$cf_time'
  4041. d_bsd='$d_bsd'
  4042. d_eunice='$d_eunice'
  4043. d_xenix='$d_xenix'
  4044. eunicefix='$eunicefix'
  4045. Mcc='$Mcc'
  4046. awk='$awk'
  4047. bash='$bash'
  4048. bison='$bison'
  4049. cat='$cat'
  4050. chgrp='$chgrp'
  4051. chmod='$chmod'
  4052. chown='$chown'
  4053. compress='$compress'
  4054. cpp='$cpp'
  4055. csh='$csh'
  4056. date='$date'
  4057. echo='$echo'
  4058. egrep='$egrep'
  4059. emacs='$emacs'
  4060. expr='$expr'
  4061. flex='$flex'
  4062. gcc='$gcc'
  4063. grep='$grep'
  4064. inews='$inews'
  4065. ispell='$ispell'
  4066. ksh='$ksh'
  4067. less='$less'
  4068. line='$line'
  4069. lint='$lint'
  4070. ln='$ln'
  4071. lp='$lp'
  4072. lpr='$lpr'
  4073. ls='$ls'
  4074. mail='$mail'
  4075. mailx='$mailx'
  4076. make='$make'
  4077. metamail='$metamail'
  4078. mhn='$mhn'
  4079. mkdir='$mkdir'
  4080. more='$more'
  4081. mv='$mv'
  4082. nroff='$nroff'
  4083. perl='$perl'
  4084. pg='$pg'
  4085. pmake='$pmake'
  4086. pr='$pr'
  4087. rm='$rm'
  4088. rmail='$rmail'
  4089. sed='$sed'
  4090. sendmail='$sendmail'
  4091. sh='$sh'
  4092. shar='$shar'
  4093. sleep='$sleep'
  4094. smail='$smail'
  4095. sort='$sort'
  4096. submit='$submit'
  4097. tail='$tail'
  4098. tar='$tar'
  4099. tbl='$tbl'
  4100. test='$test'
  4101. touch='$touch'
  4102. tr='$tr'
  4103. troff='$troff'
  4104. uname='$uname'
  4105. uniq='$uniq'
  4106. uuname='$uuname'
  4107. vi='$vi'
  4108. zcat='$zcat'
  4109. hint='$hint'
  4110. myuname='$myuname'
  4111. Author='$Author'
  4112. Date='$Date'
  4113. Header='$Header'
  4114. Id='$Id'
  4115. Locker='$Locker'
  4116. Log='$Log'
  4117. RCSfile='$RCSfile'
  4118. Revision='$Revision'
  4119. Source='$Source'
  4120. State='$State'
  4121. active='$active'
  4122. acttimes='$acttimes'
  4123. d_acttimes='$d_acttimes'
  4124. myactive='$myactive'
  4125. bin='$bin'
  4126. installbin='$installbin'
  4127. cc='$cc'
  4128. ccflags='$ccflags'
  4129. cppflags='$cppflags'
  4130. ldflags='$ldflags'
  4131. lkflags='$lkflags'
  4132. optimize='$optimize'
  4133. contains='$contains'
  4134. cppminus='$cppminus'
  4135. cppstdin='$cppstdin'
  4136. d_ftime='$d_ftime'
  4137. aphostcmd='$aphostcmd'
  4138. d_gethname='$d_gethname'
  4139. d_phostcmd='$d_phostcmd'
  4140. d_uname='$d_uname'
  4141. d_getpwent='$d_getpwent'
  4142. d_getcwd='$d_getcwd'
  4143. d_getwd='$d_getwd'
  4144. d_havetlib='$d_havetlib'
  4145. termlib='$termlib'
  4146. d_ignoreorg='$d_ignoreorg'
  4147. d_internet='$d_internet'
  4148. d_memcmp='$d_memcmp'
  4149. d_memcpy='$d_memcpy'
  4150. d_memset='$d_memset'
  4151. d_mime='$d_mime'
  4152. mimeshow="$mimeshow"
  4153. mimestore="$mimestore"
  4154. d_newsadm='$d_newsadm'
  4155. newsadmin='$newsadmin'
  4156. d_nntp='$d_nntp'
  4157. d_xdata='$d_xdata'
  4158. servername='$servername'
  4159. d_nolnbuf='$d_nolnbuf'
  4160. d_normsig='$d_normsig'
  4161. jobslib='$jobslib'
  4162. d_hvfork='$d_hvfork'
  4163. d_novfork='$d_novfork'
  4164. d_novoid='$d_novoid'
  4165. void='$void'
  4166. d_portable='$d_portable'
  4167. d_rdchk='$d_rdchk'
  4168. d_rename='$d_rename'
  4169. d_sigblock='$d_sigblock'
  4170. d_sighold='$d_sighold'
  4171. d_sizet='$d_sizet'
  4172. d_strcasecmp='$d_strcasecmp'
  4173. d_strchr='$d_strchr'
  4174. d_strftime='$d_strftime'
  4175. strftimec='$strftimec'
  4176. strftimeo='$strftimeo'
  4177. d_libndir='$d_libndir'
  4178. d_usendir='$d_usendir'
  4179. libndir='$libndir'
  4180. ndirc='$ndirc'
  4181. ndiro='$ndiro'
  4182. d_voidsig='$d_voidsig'
  4183. signal_t='$signal_t'
  4184. defeditor='$defeditor'
  4185. filexp='$filexp'
  4186. d_dirnamlen='$d_dirnamlen'
  4187. i_dirent='$i_dirent'
  4188. i_ptem='$i_ptem'
  4189. i_stdlib='$i_stdlib'
  4190. i_string='$i_string'
  4191. strings='$strings'
  4192. i_sysdir='$i_sysdir'
  4193. d_voidtty='$d_voidtty'
  4194. i_bsdioctl='$i_bsdioctl'
  4195. i_sysioctl='$i_sysioctl'
  4196. i_syssockio='$i_syssockio'
  4197. i_sysndir='$i_sysndir'
  4198. i_sgtty='$i_sgtty'
  4199. i_termio='$i_termio'
  4200. i_termios='$i_termios'
  4201. i_systime='$i_systime'
  4202. i_time='$i_time'
  4203. i_unistd='$i_unistd'
  4204. i_vfork='$i_vfork'
  4205. ispell_options='$ispell_options'
  4206. ispell_prg='$ispell_prg'
  4207. libc='$libc'
  4208. plibpth='$plibpth'
  4209. xlibpth='$xlibpth'
  4210. libs='$libs'
  4211. citydist='$citydist'
  4212. cntrydist='$cntrydist'
  4213. contdist='$contdist'
  4214. locdist='$locdist'
  4215. orgdist='$orgdist'
  4216. statedist='$statedist'
  4217. mailer='$mailer'
  4218. mailfile='$mailfile'
  4219. manext='$manext'
  4220. mansrc='$mansrc'
  4221. mboxchar='$mboxchar'
  4222. c='$c'
  4223. n='$n'
  4224. d_berknames='$d_berknames'
  4225. d_passnames='$d_passnames'
  4226. d_usgnames='$d_usgnames'
  4227. nametype='$nametype'
  4228. inewsloc='$inewsloc'
  4229. newslib='$newslib'
  4230. newslibexp='$newslibexp'
  4231. newsspool='$newsspool'
  4232. orgname='$orgname'
  4233. package='$package'
  4234. pager='$pager'
  4235. phost='$phost'
  4236. phostcmd='$phostcmd'
  4237. prefshell='$prefshell'
  4238. installprivlib='$installprivlib'
  4239. privlib='$privlib'
  4240. rootid='$rootid'
  4241. sharpbang='$sharpbang'
  4242. shsharp='$shsharp'
  4243. spitshell='$spitshell'
  4244. startsh='$startsh'
  4245. sysman='$sysman'
  4246. d_usemt='$d_usemt'
  4247. d_useov='$d_useov'
  4248. overviewdir='$overviewdir'
  4249. threaddir='$threaddir'
  4250. trn_init='$trn_init'
  4251. trn_select='$trn_select'
  4252. nm_opt='$nm_opt'
  4253. runnm='$runnm'
  4254. usenm='$usenm'
  4255. incpath='$incpath'
  4256. mips='$mips'
  4257. mips_type='$mips_type'
  4258. usrinc='$usrinc'
  4259. EOT
  4260.  
  4261. : add special variables
  4262. $test -f patchlevel.h && \
  4263. awk '/^#define/ {printf "%s=%s %s%s\n",$2,$3,$4,$5}' patchlevel.h >>config.sh
  4264. echo "CONFIG=true" >>config.sh
  4265.  
  4266. : Finish up by extracting the .SH files
  4267. case "$alldone" in
  4268. exit)
  4269.     $rm -rf UU
  4270.     echo "Done."
  4271.     exit 0
  4272.     ;;
  4273. cont)
  4274.     ;;
  4275. '')
  4276.     echo " "
  4277.     dflt=''
  4278. echo "If you didn't make any mistakes, then just type a carriage return here."
  4279.     rp="If you need to edit config.sh, do it as a shell escape here:"
  4280.     . UU/myread
  4281.     case "$ans" in
  4282.     '') ;;
  4283.     *) : in case they cannot read
  4284.         sh 1>&4 -c "$ans";;
  4285.     esac
  4286.     ;;
  4287. esac
  4288.  
  4289. : if this fails, just run all the .SH files by hand
  4290. . ./config.sh
  4291.  
  4292. echo " "
  4293. exec 1>&4
  4294. . ./UU/extract
  4295.  
  4296. echo " "
  4297. echo 'Now type "make".'
  4298.  
  4299. $rm -f kit*isdone ark*isdone
  4300. $rm -rf UU
  4301. : End of Configure
  4302.