home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / elm23-2.zip / Configure < prev    next >
Text File  |  1991-01-18  |  95KB  |  4,101 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, I would
  7. # suggest you cut out the prototypical config.h from the end of Configure
  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. # $Header: /files/home/users/syd/elm.rel/RCS/Configure,v 4.1.1.11 90/10/24 16:37:01 syd Exp $
  12. #
  13. # Yes, you may rip this off to use in other distribution packages.
  14. # (Note: this Configure script was generated automatically.  Rather than
  15. # working with this copy of Configure, you may wish to get metaconfig.)
  16.  
  17. : sanity checks
  18. PATH=".:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:$PATH"
  19. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
  20.  
  21. if test ! -t 0; then
  22.     echo "Say 'sh Configure', not 'sh <Configure'"
  23.     exit 1
  24. fi
  25.  
  26. (alias) >/dev/null 2>&1 && \
  27.     echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
  28.     echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
  29.  
  30. if test ! -d ../UU; then
  31.     if test ! -d UU; then
  32.     mkdir UU
  33.     fi
  34.     cd UU
  35. fi
  36.  
  37. case "$1" in
  38. -d) shift; fastread='yes';;
  39. esac
  40.  
  41. define=''
  42. eunicefix=''
  43. Log=''
  44. Header=''
  45. bin=''
  46. byteorder=''
  47. contains=''
  48. cppstdin=''
  49. cppminus=''
  50. d_crypt=''
  51. cryptlib=''
  52. d_getopt=''
  53. d_havetlib=''
  54. termlib=''
  55. d_mkdir=''
  56. d_rename=''
  57. d_sigvec=''
  58. d_sigvectr=''
  59. d_symlink=''
  60. d_vfork=''
  61. d_whoami=''
  62. defeditor=''
  63. hostname=''
  64. phostname=''
  65. mydomain=''
  66. i_time=''
  67. i_systime=''
  68. d_systimekernel=''
  69. maildir=''
  70. n=''
  71. c=''
  72. package=''
  73. pager=''
  74. prefshell=''
  75. spitshell=''
  76. shsharp=''
  77. sharpbang=''
  78. startsh=''
  79. d_eunice=''
  80. loclist=''
  81. expr=''
  82. sed=''
  83. echo=''
  84. cat=''
  85. rm=''
  86. mv=''
  87. cp=''
  88. tail=''
  89. tr=''
  90. mkdir=''
  91. sort=''
  92. uniq=''
  93. grep=''
  94. trylist=''
  95. test=''
  96. inews=''
  97. egrep=''
  98. more=''
  99. pg=''
  100. Mcc=''
  101. vi=''
  102. mailx=''
  103. mail=''
  104. cpp=''
  105. perl=''
  106. emacs=''
  107. ls=''
  108. rmail=''
  109. sendmail=''
  110. shar=''
  111. smail=''
  112. submit=''
  113. tbl=''
  114. troff=''
  115. nroff=''
  116. uname=''
  117. uuname=''
  118. line=''
  119. chgrp=''
  120. chmod=''
  121. lint=''
  122. sleep=''
  123. pr=''
  124. tar=''
  125. ln=''
  126. lpr=''
  127. lp=''
  128. touch=''
  129. make=''
  130. date=''
  131. csh=''
  132. pmake=''
  133. c_date=''
  134. d_ascii=''
  135. d_calendar=''
  136. calendar=''
  137. d_cuserid=''
  138. d_flock=''
  139. d_flockonly=''
  140. lock_dir=''
  141. d_gethname=''
  142. d_douname=''
  143. d_phostname=''
  144. d_host_comp=''
  145. ign_hname=''
  146. d_havedbm=''
  147. dbm=''
  148. d_index=''
  149. d_internet=''
  150. d_mboxedit=''
  151. d_mmdf=''
  152. d_newauto=''
  153. d_nfs=''
  154. d_networkorder=''
  155. d_noxheader=''
  156. d_optreturn=''
  157. d_pafirst=''
  158. d_notouchadd=''
  159. d_noaddfrom=''
  160. d_usedomain=''
  161. d_nocheckvalid=''
  162. d_pidcheck=''
  163. d_portable=''
  164. d_ptem=''
  165. d_remlock=''
  166. maxattempts=''
  167. d_setgid=''
  168. mailermode=''
  169. d_strcspn=''
  170. d_strspn=''
  171. d_strings=''
  172. d_pwdinsys=''
  173. strings=''
  174. includepath=''
  175. d_subshell=''
  176. d_tempnam=''
  177. tempnamo=''
  178. tempnamc=''
  179. d_termio=''
  180. d_termios=''
  181. d_tz_min=''
  182. d_useembed=''
  183. d_utimbuf=''
  184. d_voidsig=''
  185. defbatsub=''
  186. elmalias=''
  187. maxsysalias=''
  188. maxuseralias=''
  189. lib=''
  190. libc=''
  191. linepr=''
  192. mailer=''
  193. mailgrp=''
  194. mansrc=''
  195. manext=''
  196. models=''
  197. split=''
  198. small=''
  199. medium=''
  200. large=''
  201. huge=''
  202. optimize=''
  203. ccflags=''
  204. cppflags=''
  205. ldflags=''
  206. cc=''
  207. libs=''
  208. nametype=''
  209. d_passnames=''
  210. d_berknames=''
  211. d_usgnames=''
  212. passcat=''
  213. pathalias=''
  214. domains=''
  215. rmttape=''
  216. roff=''
  217. tmpdir=''
  218. use_pmake=''
  219. xencf=''
  220. xenlf=''
  221. d_xenix=''
  222. d_bsd=''
  223. CONFIG=''
  224. : set package name
  225. package=elm2
  226.  
  227. echo " "
  228. echo "Beginning of configuration questions for $package kit."
  229. : Eunice requires " " instead of "", can you believe it
  230. echo " "
  231.  
  232. define='define'
  233. undef='undef'
  234. : change the next line if compiling for Xenix/286 on Xenix/386
  235. xlibpth='/usr/lib/386 /lib/386 /lib'
  236. libpth='/usr/lib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
  237. smallmach='pdp11 i8086 z8000 i80286 iAPX286'
  238. rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
  239. trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
  240.  
  241. : We must find out about Eunice early
  242. eunicefix=':'
  243. if test -f /etc/unixtovms; then
  244.     eunicefix=/etc/unixtovms
  245. fi
  246. if test -f /etc/unixtovms.exe; then
  247.     eunicefix=/etc/unixtovms.exe
  248. fi
  249.  
  250. : Now test for existence of everything in MANIFEST
  251.  
  252. echo "First let's make sure your kit is complete.  Checking..."
  253. (cd ..; awk '' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$)
  254. echo "Looks good..."
  255.  
  256. attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
  257. attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
  258. attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
  259. attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
  260. attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
  261. attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
  262. attrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__"
  263. d_newshome="/usr/NeWS"
  264. defvoidused=7
  265. pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/5bin /vol/local/bin /etc"
  266. pth="$pth /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb"
  267. pth="$pth /usr/convex /usr/mmdf/bin /usr/mmdf/lib ${BSDBASE-/bsd}/usr/ucb ${BSDBASE-/bsd}/bin ${BSDBASE-/bsd}/usr/bin"
  268.  
  269. : check for out bin directory
  270. if test ! -d ../bin; then
  271.     echo "Making bin directory"
  272.     mkdir ../bin
  273. else
  274.     echo "Found bin directory"
  275. fi
  276.  
  277. : some greps do not return status, grrr.
  278. echo "grimblepritz" >grimble
  279. if grep blurfldyick grimble >/dev/null 2>&1 ; then
  280.     contains=contains
  281. elif grep grimblepritz grimble >/dev/null 2>&1 ; then
  282.     contains=grep
  283. else
  284.     contains=contains
  285. fi
  286. rm -f grimble
  287. : the following should work in any shell
  288. case "$contains" in
  289. contains*)
  290.     echo " "
  291.     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  292.     cat >contains <<'EOSS'
  293. grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  294. EOSS
  295. chmod +x contains
  296. esac
  297.  
  298. : see if sh knows # comments
  299. echo " "
  300. echo "Checking your sh to see if it knows about # comments..."
  301. if sh -c '#' >/dev/null 2>&1 ; then
  302.     echo "Your sh handles # comments correctly."
  303.     shsharp=true
  304.     spitshell=cat
  305.     echo " "
  306.     echo "Okay, let's see if #! works on this system..."
  307.     echo "#!/bin/echo hi" > try
  308.     $eunicefix try
  309.     chmod +x try
  310.     ./try > today
  311.     if $contains hi today >/dev/null 2>&1; then
  312.     echo "It does."
  313.     sharpbang='#!'
  314.     else
  315.     echo "#! /bin/echo hi" > try
  316.     $eunicefix try
  317.     chmod +x try
  318.     ./try > today
  319.     if test -s today; then
  320.         echo "It does."
  321.         sharpbang='#! '
  322.     else
  323.         echo "It doesn't."
  324.         sharpbang=': use '
  325.     fi
  326.     fi
  327. else
  328.     echo "Your sh doesn't grok # comments--I will strip them later on."
  329.     shsharp=false
  330.     echo "exec grep -v '^#'" >spitshell
  331.     chmod +x spitshell
  332.     $eunicefix spitshell
  333.     spitshell=`pwd`/spitshell
  334.     echo "I presume that if # doesn't work, #! won't work either!"
  335.     sharpbang=': use '
  336. fi
  337.  
  338. : figure out how to guarantee sh startup
  339. echo " "
  340. echo "Checking out how to guarantee sh startup..."
  341. startsh=$sharpbang'/bin/sh'
  342. echo "Let's see if '$startsh' works..."
  343. cat >try <<EOSS
  344. $startsh
  345. set abc
  346. test "$?abc" != 1
  347. EOSS
  348.  
  349. chmod +x try
  350. $eunicefix try
  351. if ./try; then
  352.     echo "Yup, it does."
  353. else
  354.     echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  355. fi
  356. rm -f try today
  357.  
  358. : first determine how to suppress newline on echo command
  359. echo "Checking echo to see how to suppress newlines..."
  360. (echo "hi there\c" ; echo " ") >.echotmp
  361. if $contains c .echotmp >/dev/null 2>&1 ; then
  362.     echo "...using -n."
  363.     n='-n'
  364.     c=''
  365. else
  366.     cat <<'EOM'
  367. ...using \c
  368. EOM
  369.     n=''
  370.     c='\c'
  371. fi
  372. echo $n "Type carriage return to continue.  Your cursor should be here-->$c"
  373. read ans
  374. rm -f .echotmp
  375.  
  376. : now set up to do reads with possible shell escape and default assignment
  377. cat <<EOSC >myread
  378. case "\$fastread" in
  379. yes) ans=''; echo " " ;;
  380. *) ans='!';;
  381. esac
  382. while expr "X\$ans" : "X!" >/dev/null; do
  383.     read ans
  384.     case "\$ans" in
  385.     !)
  386.     sh
  387.     echo " "
  388.     echo $n "\$rp $c"
  389.     ;;
  390.     !*)
  391.     set \`expr "X\$ans" : "X!\(.*\)\$"\`
  392.     sh -c "\$*"
  393.     echo " "
  394.     echo $n "\$rp $c"
  395.     ;;
  396.     esac
  397. done
  398. rp='Your answer:'
  399. case "\$ans" in
  400. '') ans="\$dflt";;
  401. esac
  402. EOSC
  403.  
  404. : general instructions
  405. cat <<EOH
  406.  
  407. This installation shell script will examine your system and ask you questions
  408. to determine how the $package package should be installed.  If you get stuck
  409. on a question, you may use a ! shell escape to start a subshell or execute
  410. a command.  Many of the questions will have default answers in square
  411. brackets--typing carriage return will give you the default.
  412.  
  413. On some of the questions which ask for file or directory names you are
  414. allowed to use the ~name construct to specify the login directory belonging
  415. to "name", even if you don't have a shell which knows about that.  Questions
  416. where this is allowed will be marked "(~name ok)".
  417.  
  418. EOH
  419. rp="[Type carriage return to continue]"
  420. echo $n "$rp $c"
  421. . myread
  422. cat <<EOH
  423.  
  424. Much effort has been expended to ensure that this shell script will run
  425. on any Unix system.  If despite that it blows up on you, your best bet is
  426. to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
  427. know how I blew it.  If you can't run Configure for some reason, you'll have
  428. to generate a config.sh file by hand.
  429.  
  430. This installation script affects things in two ways: 1) it may do direct
  431. variable substitutions on some of the files included in this kit, and
  432. 2) it builds a config.h file for inclusion in C programs.  You may edit
  433. any of these files as the need arises after running this script.
  434.  
  435. If you make a mistake on a question, there is no easy way to back up to it
  436. currently.  The easiest thing to do is to edit config.sh and rerun all the
  437. SH files.  Configure will offer to let you do this before it runs the SH files.
  438.  
  439. EOH
  440. rp="[Type carriage return to continue]"
  441. echo $n "$rp $c"
  442. . myread
  443.  
  444. : get old answers, if there is a config file out there
  445. if test -f ../config.sh; then
  446.     echo " "
  447.     dflt=y
  448.     rp="I see a config.sh file.  Did Configure make it on THIS system? [$dflt]"
  449.     echo $n "$rp $c"
  450.     . myread
  451.     case "$ans" in
  452.     n*) echo "OK, I'll ignore it.";;
  453.     *)  echo "Fetching default answers from your old config.sh file..."
  454.     tmp="$n"
  455.     ans="$c"
  456.         . ../config.sh
  457.     n="$tmp"
  458.     c="$ans"
  459.     ;;
  460.     esac
  461. fi
  462.  
  463. : find out where common programs are
  464. echo " "
  465. echo "Locating common programs..."
  466. cat <<EOSC >loc
  467. $startsh
  468. case \$# in
  469. 0) exit 1;;
  470. esac
  471. thing=\$1
  472. shift
  473. dflt=\$1
  474. shift
  475. for dir in \$*; do
  476.     case "\$thing" in
  477.     .)
  478.     if test -d \$dir/\$thing; then
  479.         echo \$dir
  480.         exit 0
  481.     fi
  482.     ;;
  483.     *)
  484.     if test -f \$dir/\$thing; then
  485.         echo \$dir/\$thing
  486.         exit 0
  487.     elif test -f \$dir/\$thing.exe; then
  488.         : on Eunice apparently
  489.         echo \$dir/\$thing
  490.         exit 0
  491.     fi
  492.     ;;
  493.     esac
  494. done
  495. echo \$dflt
  496. exit 1
  497. EOSC
  498. chmod +x loc
  499. $eunicefix loc
  500. loclist="
  501. cat
  502. chgrp
  503. chmod
  504. cp
  505. echo
  506. expr
  507. grep
  508. ln
  509. ls
  510. make
  511. mv
  512. rm
  513. sed
  514. sleep
  515. touch
  516. tr
  517. "
  518. trylist="
  519. Mcc
  520. cpp
  521. date
  522. emacs
  523. line
  524. lint
  525. lp
  526. lpr
  527. mailx
  528. more
  529. nroff
  530. pg
  531. pmake
  532. pr
  533. rmail
  534. sendmail
  535. shar
  536. smail
  537. submit
  538. tar
  539. tbl
  540. test
  541. troff
  542. uname
  543. uuname
  544. vi
  545. "
  546. for file in $loclist; do
  547.     xxx=`loc $file $file $pth`
  548.     eval $file=$xxx
  549.     eval _$file=$xxx
  550.     case "$xxx" in
  551.     /*)
  552.     echo $file is in $xxx.
  553.     ;;
  554.     *)
  555.     echo "I don't know where $file is.  I hope it's in everyone's PATH."
  556.     ;;
  557.     esac
  558. done
  559. echo " "
  560. echo "Don't worry if any of the following aren't found..."
  561. ans=offhand
  562. for file in $trylist; do
  563.     xxx=`loc $file $file $pth`
  564.     eval $file=$xxx
  565.     eval _$file=$xxx
  566.     case "$xxx" in
  567.     /*)
  568.     echo $file is in $xxx.
  569.     ;;
  570.     *)
  571.     echo "I don't see $file out there, $ans."
  572.     ans=either
  573.     ;;
  574.     esac
  575. done
  576. case "$egrep" in
  577. egrep)
  578.     echo "Substituting grep for egrep."
  579.     egrep=$grep
  580.     ;;
  581. esac
  582. case "$test" in
  583. test)
  584.     echo "Hopefully test is built into your sh."
  585.     ;;
  586. /bin/test)
  587.     if sh -c "PATH= test true" >/dev/null 2>&1; then
  588.     echo "Using the test built into your sh."
  589.     test=test
  590.     fi
  591.     ;;
  592. *)
  593.     test=test
  594.     ;;
  595. esac
  596. case "$echo" in
  597. echo)
  598.     echo "Hopefully echo is built into your sh."
  599.     ;;
  600. /bin/echo)
  601.     echo " "
  602.     echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
  603.     $echo $n "hi there$c" >foo1
  604.     echo $n "hi there$c" >foo2
  605.     if cmp foo1 foo2 >/dev/null 2>&1; then
  606.     echo "They are compatible.  In fact, they may be identical."
  607.     else
  608.     case "$n" in
  609.     '-n') n='' c='\c' ans='\c' ;;
  610.     *) n='-n' c='' ans='-n' ;;
  611.     esac
  612.     cat <<FOO
  613. They are not compatible!  You are probably running ksh on a non-USG system.
  614. I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
  615. have echo built in and we may have to run some Bourne shell scripts.  That
  616. means I'll have to use $ans to suppress newlines now.  Life is ridiculous.
  617.  
  618. FOO
  619.     rp="Your cursor should be here-->"
  620.     $echo $n "$rp$c"
  621.     . myread
  622.     fi
  623.     $rm -f foo1 foo2
  624.     ;;
  625. *)
  626.     : cross your fingers
  627.     echo=echo
  628.     ;;
  629. esac
  630. rmlist="$rmlist loc"
  631.  
  632. : set up shell script to do ~ expansion
  633. cat >filexp <<EOSS
  634. $startsh
  635. : expand filename
  636. case "\$1" in
  637.  ~/*|~)
  638.     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  639.     ;;
  640.  ~*)
  641.     if $test -f /bin/csh; then
  642.     /bin/csh -f -c "glob \$1"
  643.     echo ""
  644.     else
  645.     name=\`$expr x\$1 : '..\([^/]*\)'\`
  646.     dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
  647.     if $test ! -d "\$dir"; then
  648.         me=\`basename \$0\`
  649.         echo "\$me: can't locate home directory for: \$name" >&2
  650.         exit 1
  651.     fi
  652.     case "\$1" in
  653.     */*)
  654.         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  655.         ;;
  656.     *)
  657.         echo \$dir
  658.         ;;
  659.     esac
  660.     fi
  661.     ;;
  662. *)
  663.     echo \$1
  664.     ;;
  665. esac
  666. EOSS
  667. chmod +x filexp
  668. $eunicefix filexp
  669.  
  670. : determine where public executables go
  671. case "$bin" in
  672. '')
  673.     dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
  674.     ;;
  675. *)  dflt="$bin"
  676.     ;;
  677. esac
  678. cont=true
  679. while $test "$cont" ; do
  680.     echo " "
  681.     rp="Where do you want to put the public executables? [$dflt]"
  682.     $echo $n "$rp $c"
  683.     . myread
  684.     bin="$ans"
  685.     bin=`filexp $bin`
  686.     if test -d $bin; then
  687.     cont=''
  688.     else
  689.     case "$fastread" in
  690.     yes) dflt=y;;
  691.     *) dflt=n;;
  692.     esac
  693.     rp="Directory $bin doesn't exist.  Use that name anyway? [$dflt]"
  694.     $echo $n "$rp $c"
  695.     . myread
  696.     dflt=''
  697.     case "$ans" in
  698.     y*) cont='';;
  699.     esac
  700.     fi
  701. done
  702.  
  703. : see if date exists, if so, init c_date
  704. if $test ! "x$date" = "x" ; then
  705.     c_date=`LANGUAGE= $date`
  706. else
  707.     c_date='date was unavailable at configuration'
  708. fi
  709.  
  710. : make some quick guesses about what we are up against
  711. echo " "
  712. $echo $n "Hmm...  $c"
  713. if $test -f "$uname"; then
  714.     uname_os=`uname -s`
  715.     uname_rel=`uname -r`
  716.     uname_rel=`expr "$uname" : "\(...\).*"`
  717. else
  718.     uname_os=unknown
  719.     uname_rel=unknown
  720. fi
  721. cat /usr/include/signal.h /usr/include/sys/signal.h >foo
  722. if test `echo abc | tr a-z A-Z` = Abc ; then
  723.     echo "Looks kind of like a USG system, but we'll see..."
  724.     echo exit 1 >bsd
  725.     echo exit 0 >usg
  726.     echo exit 1 >v7
  727. elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
  728.     if $test "$uname_os" = "SunOs" -a "$uname_rel" = "4.1" ; then
  729.     echo "Looks like SunOs 4.1, a USG system, but we'll see..."
  730.     echo exit 1 >bsd
  731.     echo exit 0 >usg
  732.     echo exit 1 >v7
  733.     else
  734.     echo "Looks kind of like a BSD system, but we'll see..."
  735.     echo exit 0 >bsd
  736.     echo exit 1 >usg
  737.     echo exit 1 >v7
  738.     fi
  739. else
  740.     echo "Looks kind of like a version 7 system, but we'll see..."
  741.     echo exit 1 >bsd
  742.     echo exit 1 >usg
  743.     echo exit 0 >v7
  744. fi
  745. case "$eunicefix" in
  746. *unixtovms*)
  747.     cat <<'EOI'
  748. There is, however, a strange, musty smell in the air that reminds me of
  749. something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  750. EOI
  751.     echo "exit 0" >eunice
  752.     d_eunice="$define"
  753.     ;;
  754. *)
  755.     echo " "
  756.     echo "Congratulations.  You aren't running Eunice."
  757.     d_eunice="$undef"
  758.     echo "exit 1" >eunice
  759.     ;;
  760. esac
  761. if test -f /xenix; then
  762.     echo "Actually, this looks more like a XENIX system..."
  763.     echo "exit 0" >xenix
  764. else
  765.     echo " "
  766.     echo "It's not Xenix..."
  767.     echo "exit 1" >xenix
  768. fi
  769. chmod +x xenix
  770. $eunicefix xenix
  771. if test -f /venix; then
  772.     echo "Actually, this looks more like a VENIX system..."
  773.     echo "exit 0" >venix
  774. else
  775.     echo " "
  776.     if xenix; then
  777.     : null
  778.     else
  779.     echo "Nor is it Venix..."
  780.     fi
  781.     echo "exit 1" >venix
  782. fi
  783. chmod +x bsd usg v7 eunice venix
  784. $eunicefix bsd usg v7 eunice venix
  785. rm -rf foo
  786. rmlist="$rmlist bsd usg v7 eunice venix xenix"
  787.  
  788. : determine text processor to use, default to troff if found.
  789. case "$roff" in
  790. '')
  791.     if $test -n "$troff"; then
  792.     dflt="$troff"
  793.     else
  794.     dflt=$nroff
  795.     fi
  796.     ;;
  797. *)  dflt="$roff";;
  798. esac
  799. $cat <<EOM
  800.  
  801. The Elm manuals are set up for troff.  If you only have nroff, it can
  802. be used, but the manuals will not be as readable.  If you use an alternate
  803. processor for troff/nroff documents it can be specified here.  Elm expects
  804. the text processor to write to standard out.   Some old troff programs require
  805. the -t flag to send the output to standard out.  If yours does, use the -t flag
  806. as part of the executable name and ignore the not found error message,
  807. as in: troff -t
  808.  
  809. EOM
  810. cont=true
  811. while $test "$cont" ; do
  812.     echo " "
  813.     echo "Give the name of the program used to process manual pages on your"
  814.     $echo $n "system: [$dflt] $c"
  815.     rp="Preferred troff/nroff program: [$dflt]"
  816.     . myread
  817.     roff=$ans;
  818.     if $test -f "$ans"; then
  819.     cont=''
  820.     else
  821.     lookup=`loc "$ans" "" . $pth`
  822.     if $test -f "$lookup"; then
  823.         cont=''
  824.         roff=$lookup
  825.     else
  826.         if $test "$fastread" = yes; then
  827.         dflt=y
  828.         else
  829.         dflt=n
  830.         fi
  831.         echo "Text processor $ans doesn't exist."
  832.         rp="Use that name anyway? [$dflt]"
  833.         $echo $n "$rp $c"
  834.         . myread
  835.         dflt=''
  836.         case "$ans" in
  837.         y*) cont='';;
  838.         esac
  839.     fi
  840.     fi
  841. done
  842.  
  843. : determine where manual pages go
  844. $cat <<EOM
  845.  
  846. $package has manual pages that need to be installed in source form.
  847. EOM
  848. case "$mansrc" in
  849. '')
  850.     dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/l_man/man1 /usr/local/man/u_man/man1 /usr/local/man/l_man/man1 /usr/man/man1 /usr/man/man.L`
  851.     ;;
  852. *)  dflt="$mansrc"
  853.     ;;
  854. esac
  855. cont=true
  856. while $test "$cont" ; do
  857.     echo " "
  858.     rp="Where do the manual pages (source) go? [$dflt]"
  859.     $echo $n "$rp $c"
  860.     . myread
  861.     mansrc=`filexp "$ans"`
  862.     if $test -d "$mansrc"; then
  863.     cont=''
  864.     else
  865.     if $test "$fastread" = yes; then
  866.         dflt=y
  867.     else
  868.         dflt=n
  869.     fi
  870.     rp="Directory $mansrc doesn't exist.  Use that name anyway? [$dflt]"
  871.     $echo $n "$rp $c"
  872.     . myread
  873.     dflt=''
  874.     case "$ans" in
  875.     y*) cont='';;
  876.     esac
  877.     fi
  878. done
  879. case "$mansrc" in
  880. *l)
  881.     manext=l
  882.     ;;
  883. *n)
  884.     manext=n
  885.     ;;
  886. *o)
  887.     manext=l
  888.     ;;
  889. *p)
  890.     manext=n
  891.     ;;
  892. *C)
  893.     manext=C
  894.     ;;
  895. *L)
  896.     manext=L
  897.     ;;
  898. *)
  899.     manext=1
  900.     ;;
  901. esac
  902.  
  903. : default clear to no extra flags
  904. xencf=
  905. xenlf=
  906. d_xenix="$undef"
  907. d_bsd="$undef"
  908. : see if we are xenix
  909. if xenix; then
  910.     d_xenix="$define"
  911. :    now are we a 286
  912.     case "`uname -p`" in
  913.     i80286)
  914.         xencf="-LARGE -Ml2et32"
  915.         xenlf="-Ml2t32 -F 5600 -SEG 512"
  916.       esac
  917. fi
  918. if bsd; then
  919.     d_bsd="$define"
  920. fi
  921.  
  922. : see what memory models we can support
  923. case "$models" in
  924. '')
  925.     : We may not use Cppsym or we get a circular dependency through cc.
  926.     : But this should work regardless of which cc we eventually use.
  927.     cat >pdp11.c <<'EOP'
  928. main() {
  929. #ifdef pdp11
  930.     exit(0);
  931. #else
  932.     exit(1);
  933. #endif
  934. }
  935. EOP
  936.     cc -o pdp11 pdp11.c >/dev/null 2>&1
  937.     if pdp11 2>/dev/null; then
  938.     dflt='unsplit split'
  939.     else
  940.     ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
  941.     case "$ans" in
  942.     X) dflt='none';;
  943.     *)  if $test -d /lib/small || $test -d /usr/lib/small; then
  944.         dflt='small'
  945.         else
  946.         dflt=''
  947.         fi
  948.         if $test -d /lib/medium || $test -d /usr/lib/medium; then
  949.         dflt="$dflt medium"
  950.         fi
  951.         if $test -d /lib/large || $test -d /usr/lib/large; then
  952.         dflt="$dflt large"
  953.         fi
  954.         if $test -d /lib/huge || $test -d /usr/lib/huge; then
  955.         dflt="$dflt huge"
  956.         fi
  957.     esac
  958.     fi
  959.     ;;
  960. *)  dflt="$models" ;;
  961. esac
  962. if $test -z "$xencf" ; then
  963. $cat <<EOM
  964.  
  965. Some systems have different model sizes.  On most systems they are called
  966. small, medium, large, and huge.  On the PDP11 they are called unsplit and
  967. split.  If your system doesn't support different memory models, say "none".
  968. If you wish to force everything to one memory model, say "none" here and
  969. put the appropriate flags later when it asks you for other cc and ld flags.
  970. Xenix and Venix systems may wish to put "none" and let the compiler figure
  971. things out.
  972. (In the following question multiple model names should be space separated.)
  973.  
  974. EOM
  975. rp="Which models are supported? [$dflt]"
  976. $echo $n "$rp $c"
  977. . myread
  978. models="$ans"
  979.  
  980. case "$models" in
  981. none)
  982.     small=''
  983.     medium=''
  984.     large=''
  985.     huge=''
  986.     unsplit=''
  987.     split=''
  988.     ;;
  989. *split)
  990.     case "$split" in
  991.     '')
  992.     if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
  993.        $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
  994.         dflt='-i'
  995.     else
  996.         dflt='none'
  997.     fi
  998.     ;;
  999.     *) dflt="$split";;
  1000.     esac
  1001.     rp="What flag indicates separate I and D space? [$dflt]"
  1002.     $echo $n "$rp $c"
  1003.     . myread
  1004.     case "$ans" in
  1005.     none) ans='';;
  1006.     esac
  1007.     split="$ans"
  1008.     unsplit=''
  1009.     ;;
  1010. *large*|*small*|*medium*|*huge*)
  1011.     case "$models" in
  1012.     *large*)
  1013.     case "$large" in
  1014.     '') dflt='-Ml';;
  1015.     *) dflt="$large";;
  1016.     esac
  1017.     rp="What flag indicates large model? [$dflt]"
  1018.     $echo $n "$rp $c"
  1019.     . myread
  1020.     case "$ans" in
  1021.     none) ans='';
  1022.     esac
  1023.     large="$ans"
  1024.     ;;
  1025.     *) large='';;
  1026.     esac
  1027.     case "$models" in
  1028.     *huge*)
  1029.     case "$huge" in
  1030.     '') dflt='-Mh';;
  1031.     *) dflt="$huge";;
  1032.     esac
  1033.     rp="What flag indicates huge model? [$dflt]"
  1034.     $echo $n "$rp $c"
  1035.     . myread
  1036.     case "$ans" in
  1037.     none) ans='';
  1038.     esac
  1039.     huge="$ans"
  1040.     ;;
  1041.     *) huge="$large";;
  1042.     esac
  1043.     case "$models" in
  1044.     *medium*)
  1045.     case "$medium" in
  1046.     '') dflt='-Mm';;
  1047.     *) dflt="$medium";;
  1048.     esac
  1049.     rp="What flag indicates medium model? [$dflt]"
  1050.     $echo $n "$rp $c"
  1051.     . myread
  1052.     case "$ans" in
  1053.     none) ans='';
  1054.     esac
  1055.     medium="$ans"
  1056.     ;;
  1057.     *) medium="$large";;
  1058.     esac
  1059.     case "$models" in
  1060.     *small*)
  1061.     case "$small" in
  1062.     '') dflt='none';;
  1063.     *) dflt="$small";;
  1064.     esac
  1065.     rp="What flag indicates small model? [$dflt]"
  1066.     $echo $n "$rp $c"
  1067.     . myread
  1068.     case "$ans" in
  1069.     none) ans='';
  1070.     esac
  1071.     small="$ans"
  1072.     ;;
  1073.     *) small='';;
  1074.     esac
  1075.     ;;
  1076. *)
  1077.     echo "Unrecognized memory models--you may have to edit Makefile.SH"
  1078.     ;;
  1079. esac
  1080. fi
  1081.  
  1082. : see if we need a special compiler
  1083. echo " "
  1084. if usg; then
  1085.     case "$cc" in
  1086.     '')
  1087.     case "$Mcc" in
  1088.     /*) dflt='Mcc'
  1089.         ;;
  1090.     *)
  1091.         case "$large" in
  1092.         -M*)
  1093.         dflt='cc'
  1094.         ;;
  1095.         *)
  1096.         if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
  1097.             dflt='cc -M'
  1098.         else
  1099.             dflt='cc'
  1100.         fi
  1101.         ;;
  1102.         esac
  1103.         ;;
  1104.     esac
  1105.     ;;
  1106.     *)  dflt="$cc";;
  1107.     esac
  1108.     $cat <<'EOM'
  1109.  
  1110. On some systems the default C compiler will not resolve multiple global
  1111. references that happen to have the same name.  On some such systems the
  1112. "Mcc" command may be used to force these to be resolved.  On other systems
  1113. a "cc -M" command is required.  (Note that the -M flag on other systems
  1114. indicates a memory model to use!)  If you have the Gnu C compiler, you
  1115. might wish to use that instead.  What command will force resolution on
  1116. EOM
  1117.     $echo $n "this system? [$dflt] $c"
  1118.     rp="Command to resolve multiple refs? [$dflt]"
  1119.     . myread
  1120.     cc="$ans"
  1121. else
  1122.     case "$cc" in
  1123.     '') dflt=cc;;
  1124.     *) dflt="$cc";;
  1125.     esac
  1126.     rp="Use which C compiler? [$dflt]"
  1127.     $echo $n "$rp $c"
  1128.     . myread
  1129.     cc="$ans"
  1130. fi
  1131. case "$cc" in
  1132. gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
  1133. esac
  1134.  
  1135. : determine optimize, if desired, or use for debug flag also
  1136. case "$optimize" in
  1137. ' ') dflt="none"
  1138.      ;;
  1139. '') dflt="-O";
  1140.     ;;
  1141. *)  dflt="$optimize"
  1142.     ;;
  1143. esac
  1144. cat <<EOH
  1145.  
  1146. Some C compilers have problems with their optimizers, by default, $package
  1147. compiles with the -O flag to use the optimizer.  Alternately, you might
  1148. want to use the symbolic debugger, which uses the -g flag (on traditional
  1149. Unix systems).  Either flag can be specified here.  To use neither flag,
  1150. specify the word "none".
  1151.  
  1152. EOH
  1153. rp="What optimizer/debugger flag should be used? [$dflt]"
  1154. $echo $n "$rp $c"
  1155. . myread
  1156. optimize="$ans"
  1157. case "$optimize" in
  1158. 'none') optimize=" "
  1159.      ;;
  1160. esac
  1161.  
  1162. case "$ccflags" in
  1163. '') case "$cc" in
  1164.     *gcc*) dflt='-fpcc-struct-return';;
  1165.     *) dflt='';;
  1166.     esac
  1167.     ;;
  1168. *) dflt="$ccflags";;
  1169. esac
  1170. for thisincl in $inclwanted; do
  1171.     if test -d $thisincl; then
  1172.     case "$dflt" in
  1173.     *$thisincl*);;
  1174.     *) dflt="$dflt -I$thisincl";;
  1175.     esac
  1176.     fi
  1177. done
  1178. case "$optimize" in
  1179. -g*)
  1180.     case "$dflt" in
  1181.     *DEBUG*);;
  1182.     *) dflt="$dflt -DDEBUG";;
  1183.     esac
  1184.     ;;
  1185. esac
  1186. case "$dflt" in
  1187. '') dflt=none;;
  1188. esac
  1189. if $test -n "$xencf" ; then
  1190.     $echo "Xenix 286 system, using compiler flags $xencf"
  1191.     $echo "do not respecify these flags below."
  1192.     $echo ""
  1193. fi
  1194. cat <<EOH
  1195.  
  1196. Your C compiler may want other flags.  For this question you should
  1197. include -I/whatever and -DWHATEVER flags and any other flags used by
  1198. the C compiler, but you should NOT include libraries or ld flags like
  1199. -lwhatever.  To use no flags, specify the word "none".
  1200.  
  1201. EOH
  1202. rp="Any additional cc flags? [$dflt]"
  1203. $echo $n "$rp $c"
  1204. . myread
  1205. case "$ans" in
  1206. none) ans='';
  1207. esac
  1208. ccflags="$ans"
  1209.  
  1210. : the following weeds options from ccflags that are of no interest to cpp
  1211. cppflags="$ccflags"
  1212. case "$cc" in
  1213. *gcc*) cppflags="$cppflags -D__GNUC__";;
  1214. esac
  1215. case "$cppflags" in
  1216. '');;
  1217. *)  set X $cppflags
  1218.     cppflags=''
  1219.     for flag do
  1220.     case $flag in
  1221.     -D*|-I*) cppflags="$cppflags $flag";;
  1222.     esac
  1223.     done
  1224.     case "$cppflags" in
  1225.     *-*)  echo "(C preprocessor flags: $cppflags)";;
  1226.     esac
  1227.     ;;
  1228. esac
  1229.  
  1230. if $test -n "$xenlf" ; then
  1231.     $echo "Xenix 286 system, using linker flags $xenlf"
  1232.     $echo "do not respecify these flags below"
  1233.     $echo ""
  1234. fi
  1235. case "$ldflags" in
  1236. '') if venix; then
  1237.     dflt='-i -z'
  1238.     else
  1239.     dflt='none'
  1240.     fi
  1241.     ;;
  1242. *) dflt="$ldflags";;
  1243. esac
  1244. echo " "
  1245. rp="Any additional ld flags (NOT including libraries)? [$dflt]"
  1246. $echo $n "$rp $c"
  1247. . myread
  1248. case "$ans" in
  1249. none) ans='';
  1250. esac
  1251. ldflags="$ans"
  1252. rmlist="$rmlist pdp11"
  1253.  
  1254. echo " "
  1255. echo "Checking for optional libraries..."
  1256. case "$libs" in
  1257. '') dflt='';;
  1258. *) dflt="$libs";;
  1259. esac
  1260. case "$libswanted" in
  1261. '') libswanted='c_s';;
  1262. esac
  1263. for thislib in $libswanted; do
  1264.     case "$thislib" in
  1265.     dbm) thatlib=ndbm;;
  1266.     *_s) thatlib=NONE;;
  1267.     *) thatlib="${thislib}_s";;
  1268.     *) thatlib=NONE;;
  1269.     esac
  1270.     xxx=`loc lib$thislib.a X /usr/lib /usr/local/lib /lib`
  1271.     if test -f $xxx; then
  1272.     echo "Found -l$thislib."
  1273.     case "$dflt" in
  1274.     *-l$thislib*|*-l$thatlib*);;
  1275.     *) dflt="$dflt -l$thislib";;
  1276.     esac
  1277.     else
  1278.     xxx=`loc lib$thislib.a X $libpth`
  1279.     if test -f $xxx; then
  1280.         echo "Found $xxx."
  1281.         case "$dflt" in
  1282.         *$xxx*);;
  1283.         *) dflt="$dflt $xxx";;
  1284.         esac
  1285.     else
  1286.         xxx=`loc Slib$thislib.a X $xlibpth`
  1287.         if test -f $xxx; then
  1288.         echo "Found -l$thislib."
  1289.         case "$dflt" in
  1290.         *-l$thislib*|*-l$thatlib*);;
  1291.         *) dflt="$dflt -l$thislib";;
  1292.         esac
  1293.         else
  1294.         echo "No -l$thislib."
  1295.         fi
  1296.     fi
  1297.     fi
  1298. done
  1299. set X $dflt
  1300. shift
  1301. dflt="$*"
  1302. case "$dflt" in
  1303. '') dflt='none';;
  1304. esac
  1305.  
  1306. $cat <<EOM
  1307.  
  1308. Some versions of Unix support shared libraries, which make
  1309. executables smaller but make load time slightly longer.
  1310.  
  1311. On some systems, mostly newer Unix System V's, the shared library
  1312. is included by putting the option "-lc_s" as the last thing on the
  1313. cc command line when linking.  Other systems use shared libraries
  1314. by default.  There may be other libraries needed to compile $package
  1315. on your machine as well.  If your system needs the "-lc_s" option,
  1316. include it here.  Include any other special libraries here as well.
  1317. Say "none" for none.
  1318. EOM
  1319.  
  1320. echo " "
  1321. rp="Any additional libraries? [$dflt]"
  1322. $echo $n "$rp $c"
  1323. . myread
  1324. case "$ans" in
  1325. none) ans='';
  1326. esac
  1327. libs="$ans"
  1328.  
  1329. : check for ordering of bytes in a long
  1330. case "$byteorder" in
  1331. '')
  1332. cat <<'EOM'
  1333.  
  1334. In the following, larger digits indicate more significance.  A big-endian
  1335. machine like a Pyramid or a Motorola 680?0 chip will come out to 4321.  A
  1336. little-endian machine like a Vax or an Intel 80?86 chip would be 1234.  Other
  1337. machines may have weird orders like 3412.  A Cray will report 87654321.  If
  1338. the test program works the default is probably right.
  1339. I'm now running the test program...
  1340. EOM
  1341.     $cat >try.c <<'EOCP'
  1342. #include <stdio.h>
  1343. main()
  1344. {
  1345.     int i;
  1346.     union {
  1347.     unsigned long l;
  1348.     char c[sizeof(long)];
  1349.     } u;
  1350.  
  1351.     if (sizeof(long) > 4)
  1352.     u.l = 0x0807060504030201;
  1353.     else
  1354.     u.l = 0x04030201;
  1355.     for (i=0; i < sizeof(long); i++)
  1356.     printf("%c",u.c[i]+'0');
  1357.     printf("\n");
  1358. }
  1359. EOCP
  1360.     if $cc try.c -o try >/dev/null 2>&1 ; then
  1361.     dflt=`./try`
  1362.     case "$dflt" in
  1363.     ????|????????) echo "(The test program ran ok.)";;
  1364.     *) echo "(The test program didn't run right for some reason.)";;
  1365.     esac
  1366.     else
  1367.     dflt='4321'
  1368.     echo "(I can't seem to compile the test program.  Guessing big-endian...)"
  1369.     fi
  1370.     ;;
  1371. *)
  1372.     echo " "
  1373.     dflt="$byteorder"
  1374.     ;;
  1375. esac
  1376. rp="What is the order of bytes in a long? [$dflt]"
  1377. $echo $n "$rp $c"
  1378. . myread
  1379. byteorder="$ans"
  1380. $rm -f try.c try
  1381.  
  1382. : get list of predefined functions in a handy place
  1383. echo " "
  1384. case "$libc" in
  1385. '') libc=unknown;;
  1386. esac
  1387. case "$libpth" in
  1388. '') libpth='/lib /usr/lib /usr/local/lib';;
  1389. esac
  1390. case "$libs" in
  1391. *-lc_s*) libc=`loc libc_s.a $libc $libpth`
  1392. esac
  1393. libnames='';
  1394. case "$libs" in
  1395. '') ;;
  1396. *)  for thislib in $libs; do
  1397.     case "$thislib" in
  1398.     -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
  1399.         try=`loc lib$thislib.a blurfl/dyick $libpth`
  1400.         if test ! -f $try; then
  1401.         try=`loc lib$thislib blurfl/dyick $libpth`
  1402.         if test ! -f $try; then
  1403.             try=`loc $thislib blurfl/dyick $libpth`
  1404.             if test ! -f $try; then
  1405.             try=`loc Slib$thislib.a blurfl/dyick $xlibpth`
  1406.             if test ! -f $try; then
  1407.                 try=''
  1408.             fi
  1409.             fi
  1410.         fi
  1411.         fi
  1412.         libnames="$libnames $try"
  1413.         ;;
  1414.     *) libnames="$libnames $thislib" ;;
  1415.     esac
  1416.     done
  1417.     ;;
  1418. esac
  1419. set /usr/lib/libc.so.[0-9]*
  1420. eval set \$$#
  1421. if test -f "$1"; then
  1422.     echo "Your shared C library is in $1."
  1423.     libc="$1"
  1424. elif test -f $libc; then
  1425.     echo "Your C library is in $libc, like you said before."
  1426. elif test -f /lib/libc.a; then
  1427.     echo "Your C library is in /lib/libc.a.  You're normal."
  1428.     libc=/lib/libc.a
  1429. else
  1430.     if test "$uname_os" != DomainOS ; then
  1431.         ans=`loc libc.a blurfl/dyick $libpth`
  1432.     fi
  1433.     if test ! -f "$ans"; then
  1434.     ans=`loc libc blurfl/dyick $libpth`
  1435.     fi
  1436.     if test ! -f "$ans"; then
  1437.     ans=`loc clib blurfl/dyick $libpth`
  1438.     fi
  1439.     if test ! -f "$ans"; then
  1440.     ans=`loc Slibc.a blurfl/dyick $xlibpth`
  1441.     fi
  1442.     if test ! -f "$ans"; then
  1443.     ans=`loc Mlibc.a blurfl/dyick $xlibpth`
  1444.     fi
  1445.     if test ! -f "$ans"; then
  1446.     ans=`loc Llibc.a blurfl/dyick $xlibpth`
  1447.     fi
  1448.     if test -f "$ans"; then
  1449.     echo "Your C library is in $ans, of all places."
  1450.     libc=$ans
  1451.     else
  1452.     cat <<EOM
  1453.  
  1454. I can't seem to find your C library.  I've looked in the following places:
  1455.  
  1456.     $libpth
  1457.  
  1458. None of these seems to contain your C library.  What is the full name
  1459. EOM
  1460.     dflt=None
  1461.     $echo $n "of your C library? $c"
  1462.     rp='C library full name?'
  1463.     . myread
  1464.     libc="$ans"
  1465.     fi
  1466. fi
  1467. echo " "
  1468. set `echo $libc $libnames | tr ' ' '\012' | sort | uniq`
  1469. $echo $n "Extracting names from $* for later perusal...$c"
  1470. nm $* 2>/dev/null >libc.tmp
  1471. $sed -n -e 's/^.* [AT]  *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
  1472. if $contains '^printf$' libc.list >/dev/null 2>&1; then
  1473.     echo "done"
  1474. else
  1475.     $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
  1476.     $contains '^printf$' libc.list >/dev/null 2>&1 || \
  1477.     $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list
  1478.     $contains '^printf$' libc.list >/dev/null 2>&1 || \
  1479.     $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list
  1480.     $contains '^printf$' libc.list >/dev/null 2>&1 || \
  1481.        $sed -n -e 's/^_//' \
  1482.           -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
  1483.     $contains '^printf$' libc.list >/dev/null 2>&1 || \
  1484.     $sed -n -e 's/^.*|FUNC |GLOB .*|//p' <libc.tmp >libc.list
  1485.     if $contains '^printf$' libc.list >/dev/null 2>&1; then
  1486.     echo "done"
  1487.     else
  1488.     echo " "
  1489.     echo "nm didn't seem to work right."
  1490.     echo "Trying ar instead..."
  1491.     if ar t $libc > libc.tmp; then
  1492.         for thisname in $libnames; do
  1493.         ar t $thisname >>libc.tmp
  1494.         done
  1495.         $sed -e 's/\.o$//' < libc.tmp > libc.list
  1496.         echo "Ok."
  1497.     else
  1498.         echo "ar didn't seem to work right."
  1499.         echo "Maybe this is a Cray...trying bld instead..."
  1500.         if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
  1501.         for thisname in $libnames; do
  1502.             bld t $libnames | \
  1503.             $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
  1504.             ar t $thisname >>libc.tmp
  1505.         done
  1506.         echo "Ok."
  1507.         else
  1508.             echo "That didn't work either.  Giving up."
  1509.             exit 1
  1510.         fi
  1511.     fi
  1512.     fi
  1513. fi
  1514.  
  1515. inlibc='echo " ";
  1516. if $contains "^$1\$" libc.list >/dev/null 2>&1;
  1517. then echo "$1() found"; eval "$2=$define";
  1518. else echo "$1() not found"; eval "$2=$undef"; fi'
  1519.  
  1520. rmlist="$rmlist libc.tmp libc.list"
  1521.  
  1522. : see if nfs exists
  1523. echo " "
  1524. dflt=`loc exports xyz /etc /usr/etc`
  1525. if $test "$dflt" = xyz; then
  1526.     dflt=`loc nfsd xyz /etc /usr/etc $pth`
  1527. fi
  1528. if $test "$dflt" = xyz; then
  1529.     echo "System does not support NFS, internal byte order will be used"
  1530.     d_nfs="$undef"
  1531. else
  1532.     echo "System supports NFS, network byte order will be used"
  1533.     d_nfs="$define"
  1534. fi
  1535.  
  1536. if $test "$d_nfs" = "$define"; then
  1537.     case "$byteorder" in
  1538.     4321)
  1539.         d_networkorder="$undef";
  1540.         ;;
  1541.     *)
  1542.         d_networkorder="$define";
  1543.         if $contains ntohl libc.list >/dev/null 2>&1; then
  1544.         echo 'ntohl found in libc, no special libraries needed for network byte ordering'
  1545.         else
  1546.         echo 'ntohl not found in libc, be sure to specify the library for network support'
  1547.         echo 'as an optional library'
  1548.         fi
  1549.         ;;
  1550.     esac
  1551. else
  1552.     d_networkorder="$undef";
  1553. fi
  1554.  
  1555. : get calendar mode and default calendar file name
  1556. $cat <<EOM
  1557.  
  1558. There is a neat feature that enables scanning of the message body for
  1559. entries to add to the users ".calendar" (or whatever) file.  These
  1560. entries are then processed by the system program calendar.  To use
  1561. this feature it needs to be enabled.  The name of the per user calendar
  1562. file used by your systems calendar program is also required.
  1563. EOM
  1564.  
  1565. case "$d_calendar" in
  1566. "$define") dflt=y;;
  1567. "$undef")  dflt=n;;
  1568. *)       dflt=y;;
  1569. esac
  1570.  
  1571. rp="Enable calendar feature [$dflt]"
  1572. $echo $n "$rp $c"
  1573. . myread
  1574. case "$ans" in
  1575. y*) d_calendar="$define";;
  1576. *)  d_calendar="$undef";;
  1577. esac
  1578.  
  1579. case "$calendar" in
  1580.     '') dflt='calendar';;
  1581.     *)  dflt=$calendar;;
  1582. esac
  1583.  
  1584. if $test "$d_calendar" = "$define"; then
  1585.     echo " "
  1586.     rp="Default calendar file: [$dflt]"
  1587.     $echo $n "$rp $c"
  1588.     . myread
  1589.     calendar="$ans"
  1590. fi
  1591.  
  1592. : check to see if the macros are 8 bit clean, ask the user
  1593. :
  1594. $cat <<EOM
  1595.  
  1596.  
  1597. Not all environments are restricted to the ASCII 7 bit character set.
  1598. For example, the ISO 8859/1 (Latin alphabet no. 1) character set,
  1599. consisting of 8 bits and 191 printable characters, is becoming
  1600. more and more common, especially in non-English speaking countries.
  1601.  
  1602. Unfortunately, not all isprint() functions or macros, which ELM
  1603. uses to determine whether a character is printable or not, will
  1604. handle non-ASCII (8 bit) characters properly.  It is suggested that you
  1605. start with this value configured to handle 8 bit characters correctly
  1606. and if there are problems with Elm aborting while displaying messages
  1607. that use extended character sets to reconfigure Elm to only display
  1608. 7 bit characters.
  1609.  
  1610. EOM
  1611.  
  1612. case "$d_ascii" in
  1613.     "$define")   dflt='n';;
  1614.     *)  dflt='y';;
  1615. esac
  1616.  
  1617. echo "  "
  1618. rp="Should Elm assume that isprint() won't break on non-ascii characters? [$dflt]"
  1619. $echo $n "$rp $c"
  1620. . myread
  1621. case "$ans" in
  1622.     y*) d_ascii="$undef";;
  1623.     *) d_ascii="$define";;
  1624. esac
  1625.  
  1626. : find out how to find out full name
  1627. echo " "
  1628. case "$d_berknames" in
  1629. "$define")
  1630.     dflt=y;;
  1631. "$undef")
  1632.     dflt=n;;
  1633. *)
  1634.     if bsd; then
  1635.     dflt=y
  1636.     elif xenix; then
  1637.     dflt=y
  1638.     else
  1639.     dflt=n
  1640.     fi
  1641.     ;;
  1642. esac
  1643. echo "Does your /etc/passwd file keep full names in Berkeley/V7 format (name first"
  1644. $echo $n "thing after ':' in GCOS field)? [$dflt] $c"
  1645. rp="Berkeley/V7 format full name? [$dflt]"
  1646. . myread
  1647. case "$ans" in
  1648.   y*)
  1649.     d_passnames="$define"
  1650.     d_berknames="$define"
  1651.     d_usgnames="$undef"
  1652.     nametype=bsd
  1653.     ;;
  1654.   *)
  1655.     echo " "
  1656.     case "$d_usgnames" in
  1657.     "$define")
  1658.     dflt=y;;
  1659.     "$undef")
  1660.     dflt=n;;
  1661.     *)
  1662.     if usg; then
  1663.         dflt=y
  1664.     else
  1665.         dflt=n
  1666.     fi
  1667.     ;;
  1668.     esac
  1669.     echo "Does your passwd file keep full names in USG format (name sandwiched"
  1670.     $echo $n "between a '-' and a '(')? [$dflt] $c"
  1671.     rp="USG format full name? [$dflt]"
  1672.     . myread
  1673.     case "$ans" in
  1674.       n*)
  1675.     echo "Full name will be taken from ~/.fullname"
  1676.     d_passnames="$undef"
  1677.     d_berknames="$undef"
  1678.     d_usgnames="$undef"
  1679.     nametype=other
  1680.     ;;
  1681.       *)
  1682.     d_passnames="$define"
  1683.     d_berknames="$undef"
  1684.     d_usgnames="$define"
  1685.     nametype=usg
  1686.     ;;
  1687.     esac
  1688.     ;;
  1689. esac
  1690.  
  1691. : see if we have to deal with yellow pages
  1692. if $test -d /usr/etc/yp || $test -d /etc/yp; then
  1693.     if $test "$passcat" = "ypcat passwd"; then
  1694.     dflt=y
  1695.     elif $contains '^\+:' /etc/passwd; then
  1696.     dflt=y
  1697.     else
  1698.     dflt=n
  1699.     fi
  1700.     rp="Are you getting the passwd file via yellow pages? [$dflt]"
  1701.     $echo $n "$rp $c"
  1702.     . myread
  1703.     case "$ans" in
  1704.     y*) passcat='ypcat passwd';;
  1705.     *) passcat='cat /etc/passwd';;
  1706.     esac
  1707. else
  1708.     passcat='cat /etc/passwd'
  1709. fi
  1710.  
  1711. : see if crypt exists
  1712. echo " "
  1713. if $contains '^crypt$' libc.list >/dev/null 2>&1; then
  1714.     echo 'crypt() found.'
  1715.     d_crypt="$define"
  1716.     cryptlib=''
  1717. else
  1718.     cryptlib=`loc Slibcrypt.a "" $xlibpth`
  1719.     if $test -z "$cryptlib"; then
  1720.     cryptlib=`loc Mlibcrypt.a "" $xlibpth`
  1721.     else
  1722.     cryptlib=-lcrypt
  1723.     fi
  1724.     if $test -z "$cryptlib"; then
  1725.     cryptlib=`loc Llibcrypt.a "" $xlibpth`
  1726.     else
  1727.     cryptlib=-lcrypt
  1728.     fi
  1729.     if $test -z "$cryptlib"; then
  1730.     cryptlib=`loc libcrypt.a "" $libpth`
  1731.     else
  1732.     cryptlib=-lcrypt
  1733.     fi
  1734.     if $test -z "$cryptlib"; then
  1735.     echo 'crypt() not found.'
  1736.     d_crypt="$undef"
  1737.     else
  1738.     d_crypt="$define"
  1739.     fi
  1740. fi
  1741.  
  1742. : check for cuserid function
  1743. echo " "
  1744. if $contains '^cuserid$' libc.list >/dev/null 2>&1 ; then
  1745.     echo "cuserid() found."
  1746.     d_cuserid="$undef"
  1747. else
  1748.     echo "No cuserid() found--will use mine."
  1749.     d_cuserid="$define"
  1750. fi
  1751.  
  1752. : now get the host name
  1753. echo " "
  1754. echo "Figuring out host name..."
  1755. echo 'Maybe "hostname" will work...'
  1756. if ans=`sh -c hostname 2>&1` ; then
  1757.     hostname=$ans
  1758.     phostname=hostname
  1759. else
  1760.     if xenix; then
  1761.     echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
  1762.     if ans=`cat /etc/systemid 2>&1` ; then
  1763.         hostname=$ans
  1764.         phostname='cat /etc/systemid'
  1765.         echo "Whadyaknow.  Xenix always was a bit strange..."
  1766.     else
  1767.         echo 'No, maybe "uuname -l" will work...'
  1768.         if ans=`sh -c 'uuname -l' 2>&1` ; then
  1769.         hostname=$ans
  1770.         phostname='uuname -l'
  1771.         else
  1772.         echo 'Strange.  Maybe "uname -n" will work...'
  1773.         if ans=`sh -c 'uname -n' 2>&1` ; then
  1774.             hostname=$ans
  1775.             phostname='uname -n'
  1776.         else
  1777.             echo 'Oh well, maybe I can mine it out of whoami.h...'
  1778.             if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
  1779.             hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
  1780.             phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
  1781.             else
  1782.             case "$hostname" in
  1783.             '') echo "Does this machine have an identity crisis or something?"
  1784.                 phostname=''
  1785.                 ;;
  1786.             *)  echo "Well, you said $hostname before...";;
  1787.             esac
  1788.             fi
  1789.         fi
  1790.         fi
  1791.     fi
  1792.     else
  1793.     if $test -r /etc/systemid ; then
  1794.         echo "What is a non-Xenix system doing with /etc/systemid?"
  1795.     fi
  1796.     echo 'No, maybe "uuname -l" will work...'
  1797.     if $test -n "$uuname" && ans=`sh -c "$uuname -l" 2>&1` ; then
  1798.         hostname=$ans
  1799.         phostname="$uuname -l"
  1800.     else
  1801.         echo 'Strange.  Maybe "uname -n" will work...'
  1802.         if $test -n "$uname" && ans=`sh -c "$uname -n" 2>&1` ; then
  1803.         hostname=$ans
  1804.         phostname="$uname -n"
  1805.         else
  1806.         if ans=`cat /etc/systemid 2>&1` ; then
  1807.             hostname=$ans
  1808.             phostname='cat /etc/systemid'
  1809.             echo "Well, I'll use the systemid file anyway..."
  1810.         else
  1811.             echo 'Oh well, maybe I can mine it out of whoami.h...'
  1812.             if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
  1813.             hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
  1814.             phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
  1815.             else
  1816.             case "$hostname" in
  1817.             '') echo "Does this machine have an identity crisis or something?"
  1818.                 phostname=''
  1819.                 ;;
  1820.             *)  echo "Well, you said $hostname before...";;
  1821.             esac
  1822.             fi
  1823.         fi
  1824.         fi
  1825.     fi
  1826.     fi
  1827. fi
  1828. : you do not want to know about this
  1829. set $hostname
  1830. hostname=$1
  1831.  
  1832. : translate upper to lower if necessary
  1833. case "$hostname" in
  1834.     *[A-Z]*)
  1835.     hostname=`echo $hostname | tr '[A-Z]' '[a-z]'`
  1836.     echo "(Normalizing case in your host name)"
  1837.     ;;
  1838. esac
  1839.  
  1840. : verify guess
  1841. if $test "$hostname" ; then
  1842.     dflt=y
  1843.     echo 'Your host name appears to be "'$hostname'".'
  1844.     $echo $n "Is this correct? [$dflt] $c"
  1845.     rp="Sitename is $hostname? [$dflt]"
  1846.     . myread
  1847.     case "$ans" in
  1848.       y*)  ;;
  1849.       *)      hostname='' ;;
  1850.     esac
  1851. fi
  1852.  
  1853. : bad guess or no guess
  1854. while $test "X$hostname" = X ; do
  1855.     dflt=''
  1856.     rp="Please type the (one word) name of your host:"
  1857.     $echo $n "$rp $c"
  1858.     . myread
  1859.     hostname="$ans"
  1860. done
  1861.  
  1862. echo " "
  1863. case "$hostname" in
  1864. *.*)
  1865.     dflt=`$expr "X$hostname" : "X[^.]*\(\..*\)"`
  1866.     hostname=`$expr "X$hostname" : "X\([^.]*\)\."`
  1867.     echo "(Trimming domain name from host name--host name is now $hostname)"
  1868.     ;;
  1869. *)  case "$mydomain" in
  1870.     '') dflt='.UUCP';;
  1871.     *) dflt="$mydomain";;
  1872.     esac
  1873.     ;;
  1874. esac
  1875. rp="What is your domain name? [$dflt]"
  1876. $echo $n "$rp $c"
  1877. . myread
  1878. case "$ans" in
  1879. '') ;;
  1880. .*) ;;
  1881. *) ans=".$ans";;
  1882. esac
  1883. mydomain="$ans"
  1884.  
  1885. : a little sanity check here
  1886. case "$phostname" in
  1887. '') ;;
  1888. *)  case `$phostname` in
  1889.     $hostname$mydomain|$hostname) ;;
  1890.     *)
  1891.     case "$phostname" in
  1892.     sed*)
  1893.         echo "(That doesn't agree with your whoami.h file, by the way.)"
  1894.         ;;
  1895.     *)
  1896.         echo "(That doesn't agree with your $phostname command, by the way.)"
  1897.         ;;
  1898.     esac
  1899.     phostname=''
  1900.     ;;
  1901.     esac
  1902.     ;;
  1903. esac
  1904.  
  1905. : decide how portable to be
  1906. case "$d_portable" in
  1907. "$define") dflt=y;;
  1908. "$undef")  dflt=n;;
  1909. *)       if $test "$d_nfs" = "$define" ; then
  1910.            dflt=y
  1911.        else
  1912.            dflt=n
  1913.        fi
  1914.        ;;
  1915. esac
  1916. $cat <<'EOH'
  1917.  
  1918. I can set things up so that your shell scripts and binaries are more portable,
  1919. at what may be a noticable cost in performance.  In particular, if you
  1920. ask to be portable, the following happens:
  1921.  
  1922.      1) shell scripts will rely on the PATH variable rather than using
  1923.     the paths derived above.
  1924.      2) ~username interpretations will be done at run time rather than
  1925.     by Configure.
  1926.      3) the system name will be determined at run time, if at all possible.
  1927.  
  1928. EOH
  1929. rp="Do you expect to run these scripts and binaries on multiple machines? [$dflt]"
  1930. $echo $n "$rp $c"
  1931. . myread
  1932. case "$ans" in
  1933.     y*) d_portable="$define"
  1934.     for file in $loclist; do
  1935.         eval $file=$file
  1936.     done
  1937.     ;;
  1938.     *)  d_portable="$undef" ;;
  1939. esac
  1940.  
  1941. : see if there is a whoami file
  1942. echo " "
  1943. if $test -r /usr/include/whoami.h ; then
  1944.     d_whoami="$define"
  1945.     echo "whoami.h found."
  1946. else
  1947.     d_whoami="$undef"
  1948. fi
  1949.  
  1950. : see how we will look up host name
  1951. echo " "
  1952. d_douname="$undef"
  1953. d_gethname="$undef"
  1954. if $test -z "$d_phostname"; then
  1955.     d_phostname="$undef"
  1956. fi
  1957.  
  1958. if $contains '^gethostname$' libc.list >/dev/null 2>&1 ; then
  1959.     echo "gethostname() found."
  1960.     d_gethname="$define"
  1961.     ans=gethostname
  1962. elif xenix; then
  1963.     if $test -n "$uname"; then
  1964.     u_name=`$uname -n`
  1965.     else
  1966.     u_name=
  1967.     fi
  1968.     if $test -n "$line"; then
  1969.     if $test -r /etc/systemid; then
  1970.         s_name=`$line < /etc/systemid`
  1971.     else
  1972.         s_name=
  1973.     fi
  1974.     else
  1975.     s_name=
  1976.     fi
  1977.     if $test -n "$u_name"; then
  1978.     if $test "$u_name" = "$s_name"; then
  1979.         cat <<EOM
  1980. On Xenix, UUCP uses the name found in /etc/systemid, while uname()
  1981. returns the name compiled into the operating system via configure.
  1982. Elm needs the UUCP name, and currently these two match.  However, they
  1983. need not match.  Be sure to always keep these two names in sync.
  1984. Since they match, Elm will not consider that the Xenix uname function
  1985. is broken.  However, if you are not always able to make them
  1986. match, answer the compile in hostname question Yes.
  1987. EOM
  1988.         if $contains '^uname$' libc.list >/dev/null 2>&1 ; then
  1989.         echo "uname() found."
  1990.         d_douname="$define"
  1991.         ans=uname
  1992.         fi
  1993.     else
  1994.         cat <<EOM
  1995. On Xenix, UUCP uses the name found in /etc/systemid, while uname()
  1996. returns the name compiled into the operating system via configure.
  1997. Your /etc/systemid file contains $s_name.
  1998. But uname returns $u_name.
  1999. Since Elm needs the UUCP name, and currently these two do not match,
  2000. Elm will assume Xenix uname() is broken.
  2001. EOM
  2002.     fi
  2003.     else
  2004.     cat <<EOM
  2005. On Xenix, UUCP uses the name found in /etc/systemid, while uname()
  2006. returns the name compiled into the operating system via configure.
  2007. Elm needs the UUCP name, and currently the compiled in name is undefined.
  2008. Since mail needs the UUCP name, and these two need not match, Elm will
  2009. assume Xenix uname() is broken.
  2010. EOM
  2011.     fi
  2012. elif $contains '^uname$' libc.list >/dev/null 2>&1 ; then
  2013.     echo "uname() found."
  2014.     d_douname="$define"
  2015.     ans=uname
  2016. fi
  2017.  
  2018. case "$d_douname$d_gethname" in
  2019. *define*)
  2020.     case "$ign_hname" in
  2021.     '')    case "$d_host_comp" in
  2022.     "$define") dflt=y;;
  2023.     *)  dflt=n;;
  2024.     esac;;
  2025.     y)  dflt=y;;
  2026.     *)  dflt=n;;
  2027.     esac
  2028.     cat <<EOM
  2029.  
  2030. Every now and then someone has a $ans() that lies about the hostname
  2031. but can't be fixed for political or economic reasons.  Would you like to
  2032. EOM
  2033.     rp="pretend $ans() isn't there and maybe compile in the hostname? [$dflt]"
  2034.     $echo $n "$rp $c"
  2035.     . myread
  2036.     case "$ans" in
  2037.     y*) ign_hname=y
  2038.     d_douname="$undef"
  2039.     d_gethname="$undef"
  2040.     d_host_comp="$define"
  2041.     $echo $n "Okay... $c"
  2042.     ;;
  2043.     *)    ign_hname=n
  2044.     d_host_comp="$undef"
  2045.     ;;
  2046.     esac
  2047.     ;;
  2048. esac
  2049.  
  2050. case "$d_douname$d_gethname" in
  2051. *define*) ;;
  2052. *)
  2053.     case "$phostname" in
  2054.       '') ;;
  2055.       *)
  2056.     $cat <<EOT
  2057.  
  2058. There is no gethostname() or uname() on this system.  You have two
  2059. possibilities at this point:
  2060.  
  2061. 1)  You can have your host name ($hostname) compiled into $package, which
  2062.     lets $package start up faster, but makes your binaries non-portable, or
  2063. 2)  you can have $package use a
  2064.  
  2065.     popen("$phostname","r")
  2066.  
  2067.     which will start slower but be more portable.
  2068.  
  2069. Option 1 will give you the option of using whoami.h if you have one.  If you
  2070. want option 2 but with a different command, you can edit config.sh at the
  2071. end of this shell script.
  2072.  
  2073. EOT
  2074.     case "$d_phostname" in
  2075.     "$define") dflt=n;;
  2076.     "$undef")  dflt=y;;
  2077.     '')
  2078.         case "$d_portable" in
  2079.         "$define") dflt=n ;;
  2080.         *)      dflt=y ;;
  2081.         esac
  2082.         ;;
  2083.     esac
  2084.     rp="Do you want your host name compiled in? [$dflt]"
  2085.     $echo $n "$rp $c"
  2086.     . myread
  2087.     case "$ans" in
  2088.       n*) d_phostname="$define"
  2089.           d_host_comp="$undef"
  2090.           ;;
  2091.       *)  phostname=''
  2092.           d_host_comp="$define"
  2093.           d_phostname="$undef"
  2094.           ;;
  2095.     esac
  2096.     ;;
  2097.     esac
  2098.     case "$phostname" in
  2099.       '')
  2100.     case "$d_whoami" in
  2101.       "$define")
  2102.         dflt=y
  2103.         $cat <<EOM
  2104.  
  2105. No hostname function--you can either use the whoami.h file, which has this line:
  2106.  
  2107.     `grep sysname /usr/include/whoami.h`
  2108.  
  2109. or you can have the name we came up with earlier ($hostname) hardwired in.
  2110. EOM
  2111.         rp="Use whoami.h to get hostname? [$dflt]"
  2112.         $echo $n "$rp $c"
  2113.         . myread
  2114.         case "$ans" in
  2115.         n*) d_whoami="$undef";;
  2116.         esac
  2117.         ;;
  2118.       "$undef")
  2119.         echo 'No hostname function and no whoami.h--hardwiring "'$hostname'".'
  2120.         d_host_comp="$define"
  2121.         d_phostname="$undef"
  2122.         ;;
  2123.     esac
  2124.     ;;
  2125.     esac
  2126.     ;;
  2127. esac
  2128.  
  2129. : see if flock exists
  2130. echo " "
  2131. if $contains flock libc.list >/dev/null 2>&1; then
  2132.     echo 'flock() found.'
  2133.     if $contains EWOULDBLOCK /usr/include/errno.h > /dev/null 2>&1; then
  2134.     echo 'EWOULDBLOCK found, will use flock type mailbox locking'
  2135.         d_flock="$define"
  2136.     elif $contains EWOULDBLOCK /usr/include/sys/errno.h > /dev/null 2>&1; then
  2137.     echo 'EWOULDBLOCK found, will use flock type mailbox locking'
  2138.         d_flock="$define"
  2139.     else
  2140.     echo 'flock() not found--will use .lock type mailbox locking'
  2141.     d_flock="$undef"
  2142.     fi
  2143. else
  2144.     echo 'flock() not found--will use .lock type mailbox locking'
  2145.     d_flock="$undef"
  2146.     d_flockonly="$undef"
  2147. fi
  2148.  
  2149. if $test "$d_flock" = "$define"; then
  2150.     case "$d_flockonly" in
  2151.     "$define")    dflt=y;;
  2152.     "$undef")    dflt=n;;
  2153.     *)        dflt=n;;
  2154.     esac
  2155.     $cat <<EOM
  2156.  
  2157. Some sites wish to use flock style locking only.  This allows Elm
  2158. to be installed without the setgid bit being set on some systems
  2159. that would otherwise require it.
  2160.  
  2161. Note: Be sure no other mail utility that needs to lock the mail spool
  2162. file uses .lock type locking before using only flock style locking.
  2163.  
  2164. EOM
  2165.     rp="Would you like to use flock style mail spool locking only? [$dflt]"
  2166.     $echo $n "$rp $c"
  2167.     . myread
  2168.     case "$ans" in
  2169.     y*) d_flockonly="$define";;
  2170.     *)  d_flockonly="$undef";;
  2171.     esac
  2172. fi
  2173.  
  2174. if $test -d /usr/spool/locks ; then
  2175.     lock_dir=/usr/spool/locks
  2176. elif $test -d /usr/spool/uucp ; then
  2177.     lock_dir=/usr/spool/uucp
  2178. elif $test -d /var/spool/locks ; then
  2179.     lock_dir=/var/spool/locks
  2180. elif $test -d /var/spool/uucp ; then
  2181.     lock_dir=/var/spool/uucp
  2182. else
  2183.     lock_dir=/tmp
  2184. fi
  2185. echo " "
  2186. echo "Non mailbox locks will use the $lock_dir directory"
  2187. echo " "
  2188.  
  2189. : see if getopt exists
  2190. set getopt d_getopt
  2191. eval $inlibc
  2192.  
  2193. : determine pathnames of the domains and pathalias
  2194. case "$pathalias" in
  2195. '') dflt=`loc paths blurfl/dyick $pth /usr/lib/uucp`
  2196.     if $test "$dflt" = blurfl/dyick; then
  2197.     dflt=`loc nmail.paths /usr/lib/nmail.paths $pth /usr/lib/uucp`
  2198.     fi
  2199.     ;;
  2200. *)  dflt="$pathalias";;
  2201. esac
  2202. cont=true
  2203. while $test "$cont" ; do
  2204.     echo " "
  2205.     echo "Give the full path name of the pathalias"
  2206.     rp="data file? [$dflt]"
  2207.     $echo $n "$rp $c"
  2208.     . myread
  2209.     pathalias="$ans"
  2210.     if $test -f "$ans"; then
  2211.     cont=''
  2212.     else
  2213.     if $test "$fastread" = yes; then
  2214.         dflt=y
  2215.     else
  2216.         dflt=n
  2217.     fi
  2218.     echo "Pathalias data file $ans doesn't exist."
  2219.     rp="Use that name anyway? [$dflt]"
  2220.     $echo $n "$rp $c"
  2221.     . myread
  2222.     dflt=''
  2223.     case "$ans" in
  2224.     y*) cont='';;
  2225.     esac
  2226.     fi
  2227. done
  2228.  
  2229. case "$domains" in
  2230. '') dflt=`loc domains /usr/lib/domains $pth /usr/lib/uucp`;;
  2231. *)  dflt="$domains";;
  2232. esac
  2233. cont=true
  2234. while $test "$cont" ; do
  2235.     echo " "
  2236.     echo "Where does the uumail-style 'domains'"
  2237.     rp="file live? [$dflt]"
  2238.     $echo $n "$rp $c"
  2239.     . myread
  2240.     domains="$ans"
  2241.     if $test -f "$ans"; then
  2242.     cont=''
  2243.     else
  2244.     if $test "$fastread" = yes; then
  2245.         dflt=y
  2246.     else
  2247.         dflt=n
  2248.     fi
  2249.     echo "Domains data file $ans doesn't exist."
  2250.     rp="Use that name anyway? [$dflt]"
  2251.     $echo $n "$rp $c"
  2252.     . myread
  2253.     dflt=''
  2254.     case "$ans" in
  2255.     y*) cont='';;
  2256.     esac
  2257.     fi
  2258. done
  2259. : is pathalias available as a dbm file
  2260. d_havedbm="$undef"
  2261. dbm=''
  2262.  
  2263. if $test -f "$pathalias.pag" -a -f "$pathalias.dir"; then
  2264.     ans=`loc libdbm.a x $libpth`
  2265.     if $test "$ans" = x; then
  2266.     ans=`loc Slibdbm.a x $libpth`
  2267.     fi
  2268.     if $test "$ans" = x; then
  2269.     dflt=y
  2270.     echo " "
  2271.     rp="You have pathalias as a DBM file, but I cannot find the
  2272. DBM library.  Do you have dbm? [$dflt]"
  2273.     $echo $n "$rp $c"
  2274.     . myread
  2275.     case "$ans" in
  2276.         y*|t*) d_havedbm="$define"
  2277.         echo " "
  2278.         echo "Then where are the dbm routines kept (specify either -llibname"
  2279.         $echo $n " or full pathname (~name ok))? $c"
  2280.         rp='Specify dbm library:'
  2281.         . myread
  2282.         dbm=`filexp $ans`
  2283.         ;;
  2284.         *)    d_havedbm="$undef"
  2285.         dbm=''
  2286.         echo "I will use the non dbm access methods then."
  2287.         ;;
  2288.     esac
  2289.     else
  2290.     echo " "
  2291.     echo "You have pathalias as a DBM file...I'll use that instead."
  2292.     dbm=-ldbm
  2293.     d_havedbm="$define"
  2294.     fi
  2295. fi
  2296.  
  2297. : see if strings.h is in /usr/include or /usr/include/sys
  2298. echo " "
  2299. strings=`loc string.h "" /usr/include $includepath`
  2300. if $test -z "$strings"; then
  2301.     strings=`loc strings.h "" /usr/include $includepath`
  2302. fi
  2303. while $test -z "$strings"; do
  2304.     echo " "
  2305.     dflt=''
  2306.     rp="What is the full path name of the include file directory? []"
  2307.     $echo $n "$rp $c"
  2308.     . myread
  2309.     includepath=`filexp $ans`
  2310.     if $test -d "$includepath"; then
  2311.         strings=`loc string.h "" /usr/include $includepath`
  2312.         if $test -z "$strings"; then
  2313.             strings=`loc strings.h "" /usr/include $includepath`
  2314.         fi
  2315.         if $test -z "$strings"; then
  2316.             $cat <<EOM
  2317.  
  2318. Include file string.h or strings.h not found in $includepath.
  2319. Elm requires string.h on USG type systems or strings.h on BSD type
  2320. systems.  Please specify the directory where one of these files can
  2321. be found.
  2322. EOM
  2323.         fi
  2324.     else
  2325.         echo "Directory $includepath not found"
  2326.     fi
  2327. done
  2328.  
  2329. strings_f=`$expr "$strings" : ".*/\(.*\)"`
  2330. if $test "$strings_f" = "string.h"; then
  2331.     d_strings="$undef"
  2332.     echo Using string.h instead of strings.h
  2333. else
  2334.     d_strings="$define"
  2335.     echo Using strings.h instead of string.h
  2336. fi
  2337. pwdinsys=`loc pwd.h "" /usr/include $includepath`
  2338. if $test -z "$pwdinsys"; then
  2339.     d_pwdinsys="$define"
  2340. else
  2341.     d_pwdinsys="$undef"
  2342. fi
  2343.  
  2344. : index or strcpy
  2345. echo " "
  2346. case "$d_index" in
  2347. n) dflt=n;;
  2348. *) dflt=y;;
  2349. esac
  2350. if $contains '^index$' libc.list >/dev/null 2>&1 ; then
  2351.     if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
  2352.     if $contains strchr "$strings" >/dev/null 2>&1 ; then
  2353.         if $contains index "$strings" >/dev/null 2>&1 ; then
  2354. #            has index, strchr, and index and strchr in strings.h
  2355.         echo "Your system has both index() and strchr().  Shall I use"
  2356.         rp="index() rather than strchr()? [$dflt]"
  2357.         $echo $n "$rp $c"
  2358.         . myread
  2359.         case "$ans" in
  2360.             n*) d_index="$define" ;;
  2361.             *)  d_index="$undef" ;;
  2362.         esac
  2363.         else
  2364. #            has index, strchr, and strchr in strings.h
  2365.         d_index="$define"
  2366.             echo "strchr() found."
  2367.         fi
  2368.     else
  2369. #            has index, strchr, and no strchr in strings.h
  2370.         d_index="$undef"
  2371.         echo "index() found."
  2372.     fi
  2373.     else
  2374. #            has only index, no strchr, strings.h is a moot point
  2375.     d_index="$undef"
  2376.     echo "index() found."
  2377.     fi
  2378. else
  2379.     if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
  2380.     d_index="$define"
  2381.     echo "strchr() found."
  2382.     else
  2383.     echo "No index() or strchr() found!"
  2384.     d_index="$undef"
  2385.     fi
  2386. fi
  2387.  
  2388. case "$d_mmdf" in
  2389. "$define") dflt=y;;
  2390. "$undef")  dflt=n;;
  2391. *)    if $test -f "$submit"; then
  2392.         dflt=y
  2393.     else
  2394.         dflt=n
  2395.     fi
  2396.     ;;
  2397. esac
  2398. $cat <<EOM
  2399.  
  2400. Some systems run MMDF as their Mail Transport Agent.  MMDF uses
  2401. a different way of delimiting messages in the mailbox files.
  2402. Usually this is a series of four Control A's.  $package needs to know
  2403. if this system uses MMDF.
  2404.  
  2405. EOM
  2406. rp="Does this system use MMDF as its MTA? [$dflt]"
  2407. $echo $n "$rp $c"
  2408. . myread
  2409. case "$ans" in
  2410. y*) d_mmdf="$define";;
  2411. *)  d_mmdf="$undef";;
  2412. esac
  2413.  
  2414. : determine mail delivery agent for Elm to use
  2415. case "$mailer" in
  2416. '')
  2417.     if $test "$d_mmdf" = "$define" -a -f "$submit"; then
  2418.     dflt="$submit"
  2419.     elif $test -f "$sendmail"; then
  2420.     dflt="$sendmail"
  2421.     elif $test -f "$rmail"; then
  2422.     dflt="$rmail"
  2423.     elif $test -f /bin/mail; then
  2424.     dflt=/bin/mail
  2425.     else
  2426.     dflt=$mail
  2427.     fi
  2428.     ;;
  2429. *)  dflt="$mailer";;
  2430. esac
  2431. cont=true
  2432. while $test "$cont" ; do
  2433.     echo " "
  2434.     echo "Give the full path name of the program used to deliver mail on your"
  2435.     $echo $n "system: [$dflt] $c"
  2436.     rp="Preferred mail delivery agent: [$dflt]"
  2437.     . myread
  2438.     mailer="$ans"
  2439.     if $test -f "$ans"; then
  2440.     cont=''
  2441.     else
  2442.     if $test "$fastread" = yes; then
  2443.         dflt=y
  2444.     else
  2445.         dflt=n
  2446.     fi
  2447.     echo "Mail delivery agent $ans doesn't exist."
  2448.     rp="Use that name anyway? [$dflt]"
  2449.     $echo $n "$rp $c"
  2450.     . myread
  2451.     dflt=''
  2452.     case "$ans" in
  2453.     y*) cont='';;
  2454.     esac
  2455.     fi
  2456. done
  2457. if $test "$mailer" != "$sendmail"; then
  2458.     sendmail=''
  2459. fi
  2460. if $test "$mailer" != "$submit"; then
  2461.     submit=''
  2462. fi
  2463.  
  2464. : check for internet mailer
  2465. case "$d_internet" in
  2466. "$define")    dflt=y;;
  2467. "$undef")    dflt=n;;
  2468. *)    if $test -f "$sendmail"; then
  2469.         dflt=y
  2470.     elif $test -f "$submit"; then
  2471.         dflt=y
  2472.     elif $test -f "$smail"; then
  2473.         dflt=y
  2474.     else
  2475.         dflt=n
  2476.     fi
  2477.     ;;
  2478. esac
  2479. $cat <<EOM
  2480.  
  2481. Some newer mailers can deliver mail to addresses of the INTERNET persuasion,
  2482. such as user@host.UUCP.  Other older mailers require the complete path to
  2483. the destination to be specified in the address.  Does your mailer understand
  2484. EOM
  2485. $echo $n "INTERNET addresses? [$dflt] $c"
  2486. rp="Does your mailer understand INTERNET addresses? [$dflt]"
  2487. . myread
  2488. case "$ans" in
  2489. y*) d_internet="$define";;
  2490. *)  d_internet="$undef";;
  2491. esac
  2492.  
  2493. case "$d_mboxedit" in
  2494. "$define") dflt=y;;
  2495. "$undef")  dflt=n;;
  2496. *)    dflt=n;;
  2497. esac
  2498. $cat <<EOM
  2499.  
  2500. A lot of sites that install the Elm Mail System find that the function
  2501. E)dit mailbox from within Elm is dangerous and confusing.  If you choose,
  2502. you can instead disable that function, with the program being slightly
  2503. smaller and presenting an appropriate error message to the user if they
  2504. try to E)dit their mailbox.
  2505.  
  2506. EOM
  2507. rp="Would you like to enable the E)dit Mailbox function? [$dflt]"
  2508. $echo $n "$rp $c"
  2509. . myread
  2510. case "$ans" in
  2511. y*) d_mboxedit="$define";;
  2512. *)  d_mboxedit="$undef";;
  2513. esac
  2514.  
  2515. : see if mkdir exists
  2516. set mkdir d_mkdir
  2517. eval $inlibc
  2518.  
  2519. : ask about newmail running in the background automatically
  2520. case "$d_newauto" in
  2521. "$define")    dflt=y;;
  2522. "$undef")    dflt=n;;
  2523. *)        dflt=y;;
  2524. esac
  2525. echo " "
  2526. rp="Should newmail automatically run in the background? [$dflt]"
  2527. $echo $n "$rp $c"
  2528. . myread
  2529. case "$ans" in
  2530. y*) d_newauto="$define";;
  2531. *)  d_newauto="$undef";;
  2532. esac
  2533.  
  2534. case "$d_notouchadd" in
  2535. "$define") dflt=n;;
  2536. "$undef")  dflt=y;;
  2537. *)       if $test "$d_internet" = "$define" ; then
  2538.            dflt=n
  2539.        else
  2540.            dflt=y
  2541.        fi
  2542.        ;;
  2543. esac
  2544. $cat <<EOM
  2545.  
  2546. Some sites are configured so that the low level transport mechanism
  2547. is supposed to resolve and rewrite uucp paths, unreachable
  2548. domains/networks, and so on.  If your site running either "smail",
  2549. a "gateway" configuration of sendmail, or some similar software
  2550. then the low level transport mechanism will resolve the uucp
  2551. paths.  In this case it is not necessary to have Elm resolve
  2552. the paths on outbound mail addresses.
  2553.  
  2554. EOM
  2555. echo " "
  2556. rp="Should Elm resolve outbound addresses? [$dflt]"
  2557. $echo $n "$rp $c"
  2558. . myread
  2559. case "$ans" in
  2560. y*) d_notouchadd="$undef";;
  2561. *)  d_notouchadd="$define";;
  2562. esac
  2563.  
  2564. case "$d_pafirst" in
  2565. "$define") dflt=y;;
  2566. "$undef")  dflt=n;;
  2567. *)       dflt=n;;
  2568. esac
  2569. if $test "$d_notouchadd" = "$undef"; then
  2570.     $cat <<EOM
  2571.  
  2572. When given a machine that you talk to directly, should the 'pathalias'
  2573. route to the machine be used instead?"
  2574. EOM
  2575.     echo " "
  2576.     rp="Would you like to use pathalias route instead? [$dflt]"
  2577.     $echo $n "$rp $c"
  2578.     . myread
  2579.     case "$ans" in
  2580.     y*) d_pafirst="$define";;
  2581.     *)  d_pafirst="$undef";;
  2582.     esac
  2583. else
  2584.     d_pafirst="$undef"
  2585. fi
  2586.  
  2587. if $test -f "$sendmail"; then
  2588.     echo "You're running sendmail.  Setting noaddfrom, nocheckvalid, usedomain"
  2589.     d_noaddfrom="$define"
  2590.     d_nocheckvalid="$define"
  2591.     d_usedomain="$undef"
  2592. elif $test -f "$submit"; then
  2593.     echo "You're running submit with MMDF.  Setting noaddfrom, nocheckvalid, usedomain"
  2594.     d_noaddfrom="$undef"
  2595.     d_nocheckvalid="$define"
  2596.     d_usedomain="$define"
  2597. else
  2598.     case "$d_nocheckvalid" in
  2599.     "$define") dflt=n;;
  2600.     "$undef")  dflt=y;;
  2601.     *)       dflt=y;;
  2602.     esac
  2603.  
  2604.     $cat << EOM
  2605.  
  2606. Since you're not running sendmail or submit, should I check local user entered
  2607. addresses against the valid mailboxes on this system?
  2608. EOM
  2609.  
  2610.     echo " "
  2611.     rp="Would you like to check local addresses? [$dflt]"
  2612.     $echo $n "$rp $c"
  2613.     . myread
  2614.     case "$ans" in
  2615.     y*) d_nocheckvalid="$undef";;
  2616.     *)  d_nocheckvalid="$define";;
  2617.     esac
  2618.  
  2619.     if $test "$d_internet" = "$define"; then
  2620.         case "$d_usedomain" in
  2621.         "$define") dflt=y;;
  2622.         "$undef")  dflt=n;;
  2623.         *)       dflt=y;;
  2624.         esac
  2625.  
  2626.         $cat <<EOM
  2627.  
  2628. Are you running a machine where you want to have a domain name appended
  2629. to the hostname on outbound mail?
  2630. EOM
  2631.         echo " "
  2632.         rp="Would you like the domain name appended? [$dflt]"
  2633.         $echo $n "$rp $c"
  2634.         . myread
  2635.         case "$ans" in
  2636.         y*) d_usedomain="$define";;
  2637.         *)  d_usedomain="$undef";;
  2638.         esac
  2639.     else
  2640.         d_usedomain="$undef"
  2641.         $cat <<EOM
  2642.  
  2643. Since your mailer does not understand internet addresses, undefining
  2644. usedomain, your domain name will not be appended to the hostname on
  2645. outbound mail.
  2646.  
  2647. EOM
  2648.     fi
  2649.  
  2650.     case "$d_noaddfrom" in
  2651.     "$define") dflt=y;;
  2652.     "$undef")  dflt=n;;
  2653.     *)       dflt=n;;
  2654.     esac
  2655.     echo " "
  2656.     rp="Does your mailer add the From: header for you? [$dflt]"
  2657.     $echo $n "$rp $c"
  2658.     . myread
  2659.     case "$ans" in
  2660.     y*) d_noaddfrom="$define";;
  2661.     *)  d_noaddfrom="$undef";;
  2662.     esac
  2663. fi
  2664.  
  2665. case "$d_noxheader" in
  2666. "$define") dflt=y;;
  2667. "$undef")  dflt=n;;
  2668. *)    dflt=n;;
  2669. esac
  2670. $cat <<EOM
  2671.  
  2672. Some sites do not like to see the mail header "X-mailer:" in outgoing
  2673. messages.  If you choose, you may disable these headers.  However, it
  2674. is strongly urged to leave these headers in the mail to assist in
  2675. tracking down problems.
  2676.  
  2677. EOM
  2678. rp="Would you like to disable the X-mailer: headers? [$dflt]"
  2679. $echo $n "$rp $c"
  2680. . myread
  2681. case "$ans" in
  2682. y*) d_noxheader="$define";;
  2683. *)  d_noxheader="$undef";;
  2684. esac
  2685.  
  2686. : ask about optimizing return addresses
  2687. case "$d_optreturn" in
  2688. "$define")    dflt=y;;
  2689. "$undef")    dflt=n;;
  2690. *)        dflt=n;;
  2691. esac
  2692. echo " "
  2693. echo "Should I optimize the return address when you"
  2694. rp="'alias current message'? [$dflt]"
  2695. $echo $n "$rp $c"
  2696. . myread
  2697. case "$ans" in
  2698. y*) d_optreturn="$define";;
  2699. *)  d_optreturn="$undef";;
  2700. esac
  2701.  
  2702. : check for "kill(pid, 0)"
  2703. echo " "
  2704. case "$d_pidcheck" in
  2705. "$define")    ;;
  2706. "$undef")    ;;
  2707. *)
  2708.         echo "Checking to see if kill(pid, 0) works..."
  2709.         $cat >try.c <<'EOCP'
  2710. main()
  2711.     {
  2712.     int    pid, status0, status9;
  2713.  
  2714.     if ((pid = fork()) == 0)
  2715.         {
  2716.         sleep(30);
  2717.         exit(1);
  2718.         }
  2719.     status0 = kill(pid, 0);
  2720.     status9 = kill(pid, 9);
  2721.     exit(status0 == status9);
  2722.     }
  2723. EOCP
  2724.         if $cc try.c -o try >/dev/null 2>&1 ; then
  2725.         if try >/dev/null 2>&1 ; then
  2726.             echo "Your system does not support kill(pid, 0)..."
  2727.             d_pidcheck="$undef"
  2728.         else
  2729.             d_pidcheck="$define"
  2730.             echo "Your system supports kill(pid, 0)..."
  2731.         fi
  2732.         else
  2733.         echo "Your system does not support kill(pid, 0)..."
  2734.         d_pidcheck="$undef"
  2735.         fi
  2736.         $rm -f try.c try.o try
  2737.     ;;
  2738. esac
  2739.  
  2740. : see if /usr/include/sys/ptem.h exists, making it a possible System V/386
  2741. d_ptem="$undef"
  2742. if usg ; then
  2743.     echo " "
  2744.     echo "Checking to see if your system has sys/ptem.h..."
  2745.     if $test -f /usr/include/sys/ptem.h ; then
  2746.         echo "Yep, it does..."
  2747.         if "$contains" "struct winsize" /usr/include/sys/ptem.h >/dev/null 2>&1 ; then
  2748.         d_ptem="$define"
  2749.         echo "  and it has the needed structure."
  2750.     fi
  2751.     fi
  2752. fi
  2753.  
  2754. : get remove at last flag and number of lock attempts
  2755. $cat <<EOM
  2756.  
  2757. The next pair of questions have to do with what to do when another
  2758. program has locked a mailbox...
  2759.  
  2760. First, how many times should the Elm check for the removal of the lock
  2761. file before giving up?
  2762. EOM
  2763.  
  2764. case "$maxattempts" in
  2765.     '') dflt=6;;
  2766.     *)  dflt=$maxattempts;;
  2767. esac
  2768. cont=true
  2769. while $test "$cont" ; do
  2770.     echo " "
  2771.     rp="Number of lock attempts: [$dflt]"
  2772.     $echo $n "$rp $c"
  2773.     . myread
  2774.     maxattempts="$ans"
  2775.     if $test "$maxattempts" -lt 3 -o "$maxattempts" -gt 10 ; then
  2776.     echo "The recommended range is 3-10"
  2777.     odflt=$dflt
  2778.     dflt=n
  2779.     rp="Should I use your answer of $maxattempts lock attempts anyway? [$dflt]"
  2780.     $echo $n "$rp $c"
  2781.     . myread
  2782.     dflt=$odflt
  2783.     case "$ans" in
  2784.     y*) cont='';;
  2785.     esac
  2786.     else
  2787.     cont=''
  2788.     fi
  2789. done
  2790.  
  2791. case "$d_remlock" in
  2792. "$define") dflt=y;;
  2793. "$undef")  dflt=n;;
  2794. *)       dflt=n;;
  2795. esac
  2796. echo " "
  2797. rp="Should it REMOVE the lockfile after $maxattempts checks? [$dflt]"
  2798. $echo $n "$rp $c"
  2799. . myread
  2800. case "$ans" in
  2801. y*) d_remlock="$define";;
  2802. *)  d_remlock="$undef";;
  2803. esac
  2804.  
  2805. : see if rename exists
  2806. set rename d_rename
  2807. eval $inlibc
  2808.  
  2809. : see if sigvector exists -- since sigvec will match the substring
  2810. echo " "
  2811. if $contains sigvector libc.list >/dev/null 2>&1; then
  2812.     echo 'sigvector() found--you must be running HP-UX.'
  2813.     d_sigvectr="$define"
  2814.     d_sigvec="$define"
  2815. else
  2816. : try the original name
  2817.     d_sigvectr="$undef"
  2818.     if $contains sigvec libc.list >/dev/null 2>&1; then
  2819.     echo 'sigvec() found.'
  2820.     d_sigvec="$define"
  2821.     else
  2822.     echo 'sigvec() not found--race conditions with signals may occur.'
  2823.     d_sigvec="$undef"
  2824.     fi
  2825. fi
  2826.  
  2827. : see if strspn exists
  2828. echo " "
  2829. if $contains strspn libc.list >/dev/null 2>&1; then
  2830.     echo 'strspn() found.'
  2831.     d_strspn="$define"
  2832. else
  2833.     echo 'strspn() not found--will use our strspn instead.'
  2834.     d_strspn="$undef"
  2835. fi
  2836.  
  2837. : see if strcspn exists
  2838. echo " "
  2839. if $contains strcspn libc.list >/dev/null 2>&1; then
  2840.     echo 'strcspn() found.'
  2841.     d_strcspn="$define"
  2842. else
  2843.     echo 'strcspn() not found--will use our strcspn instead.'
  2844.     d_strcspn="$undef"
  2845. fi
  2846.  
  2847. case "$d_subshell" in
  2848. "$define") dflt=y;;
  2849. "$undef")  dflt=n;;
  2850. *)    dflt=y;;
  2851. esac
  2852. $cat <<EOM
  2853.  
  2854. Some sites wish to disable the usage of the shell escape from Elm.
  2855. If you choose, you can not allow subshells from withing Elm.
  2856.  
  2857. Note: This only controls Elms usage of the ! command.  Any pager or
  2858. editor could still allow subshells.
  2859.  
  2860. EOM
  2861. rp="Would you like to allow the ! command (subshells)? [$dflt]"
  2862. $echo $n "$rp $c"
  2863. . myread
  2864. case "$ans" in
  2865. y*) d_subshell="$define";;
  2866. *)  d_subshell="$undef";;
  2867. esac
  2868.  
  2869. : see if tempnam exists
  2870. echo " "
  2871. if $contains tempnam libc.list >/dev/null 2>&1; then
  2872.     echo 'tempnam() found.'
  2873.     d_tempnam="$define"
  2874. else
  2875.     echo 'tempnam() not found--will use our tempnam instead.'
  2876.     d_tempnam="$undef"
  2877. fi
  2878.  
  2879. : see how we invoke the C preprocessor
  2880. echo " "
  2881. echo "Now, how can we feed standard input to your C preprocessor..."
  2882. cat <<'EOT' >testcpp.c
  2883. #define ABC abc
  2884. #define XYZ xyz
  2885. ABC.XYZ
  2886. EOT
  2887. echo 'Maybe "'"$cc"' -E" will work...'
  2888. $cc -E <testcpp.c >testcpp.out 2>&1
  2889. : try to force gcc preprocessor if that is the compiler they are using
  2890. case $? in
  2891. 0) cppstdin="$cc -E";;
  2892. *) case "$cc" in
  2893.     *gcc*)
  2894.     cd ..
  2895.     echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
  2896.     echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
  2897.     chmod 755 cppstdin
  2898.     cppstdin=`pwd`/cppstdin
  2899.     cppminus='';
  2900.     cd UU
  2901.     $cppstdin <testcpp.c >testcpp.out 2>&1
  2902.     ;;
  2903.     esac
  2904.     ;;
  2905. esac
  2906. if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2907.     echo "Yup, it does."
  2908.     cppstdin="$cc -E"
  2909.     cppminus='';
  2910. else
  2911.     echo 'Nope, maybe "'$cpp'" will work...'
  2912.     $cpp <testcpp.c >testcpp.out 2>&1
  2913.     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2914.     echo "Yup, it does."
  2915.     cppstdin="$cpp"
  2916.     cppminus='';
  2917.     else
  2918.     echo 'No such luck...maybe "'$cpp' -" will work...'
  2919.     $cpp - <testcpp.c >testcpp.out 2>&1
  2920.     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2921.         echo "It works!"
  2922.         cppstdin="$cpp"
  2923.         cppminus='-';
  2924.     else
  2925.         echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
  2926.         $cc -E - <testcpp.c >testcpp.out 2>&1
  2927.         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2928.         echo "Hooray, it works!  I was beginning to wonder."
  2929.         cppstdin="$cc -E"
  2930.         cppminus='-';
  2931.         else
  2932.         echo 'Nope...maybe "'"$cc"' -P" will work...'
  2933.         $cc -P <testcpp.c >testcpp.out 2>&1
  2934.         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2935.             echo "Yup, that does."
  2936.             cppstdin="$cc -P"
  2937.             cppminus='';
  2938.         else
  2939.             echo 'Nope...maybe "'"$cc"' -P -" will work...'
  2940.             $cc -P - <testcpp.c >testcpp.out 2>&1
  2941.             if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2942.             echo "Yup, that does."
  2943.             cppstdin="$cc -P"
  2944.             cppminus='-';
  2945.             else
  2946.             echo 'Hmm...perhaps you already told me...'
  2947.             case "$cppstdin" in
  2948.             '') ;;
  2949.             *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
  2950.             esac
  2951.             if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2952.                 echo "Hooray, you did!  I was beginning to wonder."
  2953.             else
  2954.                 echo 'Uh-uh.  Time to get fancy...'
  2955.                 cd ..
  2956.                 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
  2957.                 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
  2958.                 chmod 755 cppstdin
  2959.                 cppstdin=`pwd`/cppstdin
  2960.                 cppminus='';
  2961.                 cd UU
  2962.                 $cppstdin <testcpp.c >testcpp.out 2>&1
  2963.                 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2964.                 echo "Eureka!."
  2965.                 else
  2966.                 dflt=blurfl
  2967.                 $echo $n "No dice.  I can't find a C preprocessor.  Name one: $c"
  2968.                 rp='Name a C preprocessor:'
  2969.                 . myread
  2970.                 cppstdin="$ans"
  2971.                 $cppstdin <testcpp.c >testcpp.out 2>&1
  2972.                 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2973.                     echo "OK, that will do."
  2974.                 else
  2975.                     echo "Sorry, I can't get that to work.  Go find one."
  2976.                     exit 1
  2977.                 fi
  2978.                 fi
  2979.             fi
  2980.             fi
  2981.         fi
  2982.         fi
  2983.     fi
  2984.     fi
  2985. fi
  2986. rm -f testcpp.c testcpp.out
  2987.  
  2988. : get C preprocessor symbols handy
  2989. echo " "
  2990. echo $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know
  2991. $cat <<EOSS >Cppsym
  2992. $startsh
  2993. case "\$1" in
  2994. -l) list=true
  2995.     shift
  2996.     ;;
  2997. esac
  2998. unknown=''
  2999. case "\$list\$#" in
  3000. 1|2)
  3001.     for sym do
  3002.     if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  3003.         exit 0
  3004.     elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  3005.         :
  3006.     else
  3007.         unknown="\$unknown \$sym"
  3008.     fi
  3009.     done
  3010.     set X \$unknown
  3011.     shift
  3012.     ;;
  3013. esac
  3014. case \$# in
  3015. 0) exit 1;;
  3016. esac
  3017. echo \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\
  3018. #ifdef \1\\
  3019. exit 0; _ _ _ _\1\\     \1\\
  3020. #endif\\
  3021. /' >/tmp/Cppsym\$\$
  3022. echo exit 1 >>/tmp/Cppsym\$\$
  3023. $cppstdin $cppminus </tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$
  3024. case "\$list" in
  3025. true) awk 'NF > 5 {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;
  3026. *)
  3027.     sh /tmp/Cppsym2\$\$
  3028.     status=\$?
  3029.     ;;
  3030. esac
  3031. $rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
  3032. exit \$status
  3033. EOSS
  3034. chmod +x Cppsym
  3035. $eunicefix Cppsym
  3036. echo "Your C preprocessor defines the following symbols:"
  3037. Cppsym -l $attrlist >Cppsym.true
  3038. cat Cppsym.true
  3039. rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
  3040.  
  3041. : see if this is a termio system
  3042. : Prefer POSIX-approved termios.h over all else.
  3043. :
  3044. echo " "
  3045. d_termios="$undef"
  3046. d_termio="$undef"
  3047. if $test -r /usr/include/termios.h ; then
  3048.     set tcsetattr d_termios
  3049.     eval $inlibc
  3050. fi
  3051. if $test "$d_termios" = "$define" ; then
  3052.     echo "You have POSIX termios.h... good!"
  3053. elif Cppsym pyr ; then
  3054.     if $test "`/bin/universe`" = "ucb" ; then
  3055.     if $test -r /usr/include/sgtty.h ; then
  3056.         echo "sgtty.h found."
  3057.     else
  3058.         echo "System is a pyramid, and universe is bsd,"
  3059.         echo "sgtty.h not found--you could have problems."
  3060.     fi
  3061.     else
  3062.     if $test -r /usr/include/termio.h ; then
  3063.         d_termio="$define"
  3064.         echo "termio.h found."
  3065.     else
  3066.         echo "System is a pyramid, and universe is att,"
  3067.         echo "termio.h not found--you could have problems."
  3068.     fi
  3069.     fi
  3070. elif bsd ; then
  3071.     if $test -r /usr/include/sgtty.h ; then
  3072.     echo "sgtty.h found."
  3073.     elif $test -r /usr/include/termio.h ; then
  3074.     d_termio="$define"
  3075.     echo "termio.h found."
  3076.     else
  3077.     echo "Neither termio.h nor sgtty.h found--you could have problems."
  3078.     fi
  3079. else
  3080.     if $test -r /usr/include/termio.h ; then
  3081.     d_termio="$define"
  3082.     echo "termio.h found."
  3083.     elif $test -r /usr/include/sgtty.h ; then
  3084.     echo "sgtty.h found."
  3085.     else
  3086.     echo "Neither termio.h nor sgtty.h found--you could have problems."
  3087.     fi
  3088. fi
  3089.  
  3090. : see if we should include time.h, sys/time.h, or both
  3091. cat <<'EOM'
  3092.  
  3093. Testing to see if we should include <time.h>, <sys/time.h> or both.
  3094. I'm now running the test program...
  3095. EOM
  3096. $cat >try.c <<'EOCP'
  3097. #ifdef I_TIME
  3098. #include <time.h>
  3099. #endif
  3100. #ifdef I_SYSTIME
  3101. #ifdef SYSTIMEKERNEL
  3102. #define KERNEL
  3103. #endif
  3104. #include <sys/time.h>
  3105. #endif
  3106. main()
  3107. {
  3108.     struct tm foo;
  3109. #ifdef S_TIMEVAL
  3110.     struct timeval bar;
  3111. #endif
  3112.     if (foo.tm_sec == foo.tm_sec)
  3113.     exit(0);
  3114. #ifdef S_TIMEVAL
  3115.     if (bar.tv_sec == bar.tv_sec)
  3116.     exit(0);
  3117. #endif
  3118.     exit(1);
  3119. }
  3120. EOCP
  3121. flags=''
  3122. for s_timeval in '-DS_TIMEVAL' ''; do
  3123.     for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
  3124.     for i_time in '' '-DI_TIME'; do
  3125.         for i_systime in '-DI_SYSTIME' ''; do
  3126.         case "$flags" in
  3127.         '') echo Trying $i_time $i_systime $d_systimekernel $s_timeval
  3128.             if $cc $ccflags $i_time $i_systime $d_systimekernel $s_timeval \
  3129.                 try.c -o try >/dev/null 2>&1 ; then
  3130.             set X $i_time $i_systime $d_systimekernel $s_timeval
  3131.             shift
  3132.             flags="$*"
  3133.             echo Succeeded with $flags
  3134.             fi
  3135.             ;;
  3136.         esac
  3137.         done
  3138.     done
  3139.     done
  3140. done
  3141. case "$flags" in
  3142. *SYSTIMEKERNEL*) d_systimekernel="$define";;
  3143. *) d_systimekernel="$undef";;
  3144. esac
  3145. case "$flags" in
  3146. *I_TIME*) i_time="$define";;
  3147. *) i_time="$undef";;
  3148. esac
  3149. case "$flags" in
  3150. *I_SYSTIME*) i_systime="$define";;
  3151. *) i_systime="$undef";;
  3152. esac
  3153. $rm -f try.c try
  3154.  
  3155. timeincl=""
  3156. if $test "$i_time" = define ; then
  3157.     timeincl="/usr/include/time.h"
  3158. fi
  3159. if $test "$i_systime" = define ; then
  3160.     timeincl="$timeincl /usr/include/sys/time.h"
  3161. fi
  3162. $cat $timeincl /dev/null | $cppstdin $cppminus > try.c 2>&1
  3163. if $contains 'tz_minuteswest' try.c > /dev/null 2>&1 ; then
  3164.     echo "You have tz_minuteswest defined in $timeincl rather than timezone."
  3165.     d_tz_min="$define"
  3166. else
  3167.     echo "You have timezone defined in $timeincl rather than tz_minuteswest."
  3168.     d_tz_min="$undef"
  3169. fi
  3170. $rm -f try.c
  3171. : check for valid reply/to fields
  3172. case "$d_useembed" in
  3173. "$define")    dflt=y;;
  3174. "$undef")    dflt=n;;
  3175. *)            if $test "$d_internet" = "$define" ; then
  3176.                 dflt=y
  3177.             else
  3178.                 dflt=n
  3179.             fi
  3180.             ;;
  3181. esac
  3182. $cat <<EOM
  3183.  
  3184. One of the more annoying quirks of the UUCP network and various other
  3185. systems that interact with it are that everyone seems to have different
  3186. ideas about how to do routing, etc.  Therefore, a lot of times email
  3187. will arrive from offsite with corrupt, unreply-able "Reply-To:" and
  3188. "From:" fields.  This next question relates to whether your site is
  3189. liable to get mangled fields or not...
  3190.  
  3191. Does your site receive email with valid "Reply-To:" and "From:" fields?
  3192.  
  3193. EOM
  3194. $echo $n "Use Reply-To: and From: addresses? [$dflt] $c"
  3195. rp="Are Reply-to: and From: addresses reliable? [$dflt]"
  3196. . myread
  3197. case "$ans" in
  3198. y*) d_useembed="$define";;
  3199. *)  d_useembed="$undef";;
  3200. esac
  3201.  
  3202. : check for utimbuf structure
  3203. echo " "
  3204. case "$d_utimbuf" in
  3205. "$define")    ;;
  3206. "$undef")    ;;
  3207. *)
  3208. : Pyramid passes the att compile test but still needs the definition
  3209.     if Cppsym pyr ; then
  3210.         if $test "`/bin/universe`" = "att" ; then
  3211.         d_utimbuf="$define"
  3212.         echo "I will use my 'utimbuf' structure..."
  3213.             fi
  3214.         fi
  3215.     if $test "$d_utimbuf" != "$define"; then
  3216.         echo "Checking to see if struct utimbuf exists."
  3217.         $cat >try.c <<'EOCP'
  3218. #include <stdio.h>
  3219. #include <fcntl.h>
  3220. #include <sys/types.h>
  3221. #include <sys/stat.h>
  3222. #define far /* to keep XENIX from complaining */
  3223. #include <sys/file.h>
  3224. #include <time.h>
  3225. main()
  3226. {
  3227. struct utimbuf test;
  3228. test.actime = 0;
  3229. exit(1);
  3230. }
  3231. EOCP
  3232.         if $cc try.c -o try >/dev/null 2>&1 ; then
  3233.         d_utimbuf="$undef"
  3234.         echo "You have the 'utimbuf' structure..."
  3235.         else
  3236.         echo "I will use my 'utimbuf' structure..."
  3237.         d_utimbuf="$define"
  3238.         fi
  3239.         $rm -f try.c try.o try
  3240.     fi
  3241.     ;;
  3242. esac
  3243.  
  3244. : see if there is a vfork
  3245. set vfork d_vfork
  3246. eval $inlibc
  3247.  
  3248. : see if signal is declared as pointer to function returning int or void
  3249. echo " "
  3250. $cppstdin $cppflags < /usr/include/signal.h >$$.tmp
  3251. if $contains 'int.*signal' $$.tmp >/dev/null 2>&1 ; then
  3252.     echo "You have int (*signal())() instead of void."
  3253.     d_voidsig="$undef"
  3254. elif $contains 'void.*signal' $$.tmp >/dev/null 2>&1 ; then
  3255.     echo "You have void (*signal())() instead of int."
  3256.     d_voidsig="$define"
  3257. elif $contains 'extern[     ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
  3258.     echo "You have int (*signal())() instead of void."
  3259.     d_voidsig="$undef"
  3260. elif $test -n "$d_voidsig"; then
  3261.     echo $n "As you already told me, signal handlers return "
  3262.     if $test "$d_voidsig" = "$define"; then
  3263.     echo void
  3264.     else
  3265.     echo int
  3266.     fi
  3267. else
  3268.     echo "I can't determine whether signal handlers return void or int..."
  3269.     echo "I'm assuming they return void like ANSI and POSIX want."
  3270.     echo "If not, you will have to change d_voidsig from $define to $undef"
  3271.     echo "in config.sh at the edit question at the end of Configure"
  3272.     d_voidsig="$define"
  3273. fi
  3274. rm -f $$.tmp
  3275.  
  3276. : get user and system aliases sizes
  3277. $cat <<EOM
  3278.  
  3279. The number of aliases allowed for users of the Elm system can vary
  3280. based on system speed and memory available.  If you have a fast system
  3281. and/or a lot of memory you can enter a fairly large number of aliases
  3282. for the next two questions...if not, you'll probably want to enter the
  3283. suggested small-system values.  (This applies to the speed of the
  3284. swapping on your system too - if you're on a FAST system, use the big
  3285. values!)
  3286.  
  3287. First, how many aliases should be allowed for an individual user?
  3288. The suggested values are 503 for blindly fast systems,
  3289. 251 for average systems and 127 for slow systems.
  3290. EOM
  3291.  
  3292. case "$maxuseralias" in
  3293.     '') dflt=251;;
  3294.     *)  dflt=$maxuseralias;;
  3295. esac
  3296. cont=true
  3297. while $test "$cont" ; do
  3298.     echo " "
  3299.     rp="Number of user aliases: [$dflt]"
  3300.     $echo $n "$rp $c"
  3301.     . myread
  3302.     maxuseralias="$ans"
  3303.     if $test "$maxuseralias" -lt 50 -o "$maxuseralias" -gt 1000 ; then
  3304.     $cat <<EOM
  3305. Pretty strange answer!  I think you should reconsider and try a number
  3306. from the range 50-1000.
  3307. EOM
  3308.     odflt=$dflt
  3309.     if $test "$fastread" = yes; then
  3310.         dflt=y
  3311.     else
  3312.         dflt=n
  3313.     fi
  3314.     rp="Should I use your answer of $maxuseralias user aliases anyway? [$dflt]"
  3315.     $echo $n "$rp $c"
  3316.     . myread
  3317.     dflt=$odflt
  3318.     case "$ans" in
  3319.     y*) cont='';;
  3320.     esac
  3321.     else
  3322.     cont=''
  3323.     fi
  3324. done
  3325.  
  3326. case "$maxsysalias" in
  3327.     '') case "$maxuseralias" in
  3328.     127) dflt=223;;
  3329.     503) dflt=739;;
  3330.     *  ) dflt=503;;
  3331.     esac
  3332.     ;;
  3333.     *)  dflt=$maxsysalias;;
  3334. esac
  3335. cont=true
  3336. while $test "$cont" ; do
  3337.     echo " "
  3338.     rp="Maximum number of system aliases: [$dflt]"
  3339.     $echo $n "$rp $c"
  3340.     . myread
  3341.     maxsysalias="$ans"
  3342.     if $test "$maxsysalias" -lt 50 -o "$maxsysalias" -gt 1000 ; then
  3343.     $cat <<EOM
  3344. Pretty strange answer!  I think you should reconsider and try a number
  3345. from the range 50-1000.
  3346. EOM
  3347.     odflt=$dflt
  3348.     if $test "$fastread" = yes; then
  3349.         dflt=y
  3350.     else
  3351.         dflt=n
  3352.     fi
  3353.     rp="Should I use your answer of $maxsysalias system aliases anyway? [$dflt]"
  3354.     $echo $n "$rp $c"
  3355.     . myread
  3356.     dflt=$odflt
  3357.     case "$ans" in
  3358.     y*) cont='';;
  3359.     esac
  3360.     else
  3361.     cont=''
  3362.     fi
  3363. done
  3364. elmalias="$maxsysalias"
  3365.  
  3366. : preserve RCS keywords in files with variable substitution, grrr
  3367. Log='$Log'
  3368. Header='$Header'
  3369.  
  3370. : see if symlink exists
  3371. set symlink d_symlink
  3372. eval $inlibc
  3373.  
  3374. : get default batch subject
  3375. $cat <<EOM
  3376.  
  3377. Elm will provide a default subject for mail messages that are sent
  3378. in batch mode (redirected from a file.)
  3379. EOM
  3380.  
  3381. case "$defbatsub" in
  3382.     '') dflt='no subject (file transmission)';;
  3383.     *)  dflt=$defbatsub;;
  3384. esac
  3385. echo " "
  3386. rp="Default batch subject: [$dflt]"
  3387. $echo $n "$rp $c"
  3388. . myread
  3389. defbatsub="$ans"
  3390.  
  3391. : determine default editor
  3392. case "$defeditor" in
  3393. '')
  3394.     case "$_vi" in
  3395.     */*) dflt="$_vi";;
  3396.     *) dflt=/usr/ucb/vi;;
  3397.     esac
  3398.     ;;
  3399. *)  dflt="$defeditor"
  3400.     ;;
  3401. esac
  3402. cont=true
  3403. while $test "$cont" ; do
  3404.     echo " "
  3405.     rp="What is the default editor on your system? [$dflt]"
  3406.     $echo $n "$rp $c"
  3407.     . myread
  3408.     defeditor="$ans"
  3409.     if $test -f $ans; then
  3410.     cont=''
  3411.     else
  3412.     if $test "$fastread" = yes; then
  3413.         dflt=y
  3414.     else
  3415.         dflt=n
  3416.     fi
  3417.     rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
  3418.     $echo $n "$rp $c"
  3419.     . myread
  3420.     dflt=''
  3421.     case "$ans" in
  3422.     y*) cont='';;
  3423.     esac
  3424.     fi
  3425. done
  3426.  
  3427. : determine where public libraries go
  3428. case "$lib" in
  3429. '')
  3430.     dflt=`loc . "." /usr/local/lib /usr/lib /lib`
  3431.     ;;
  3432. *)  dflt="$lib"
  3433.     ;;
  3434. esac
  3435. cont=true
  3436. while $test "$cont" ; do
  3437.     echo " "
  3438.     rp="Where do you want to put the public libraries? [$dflt]"
  3439.     $echo $n "$rp $c"
  3440.     . myread
  3441.     lib="$ans"
  3442.     lib=`filexp $lib`
  3443.     if $test -d "$lib"; then
  3444.     cont=''
  3445.     else
  3446.     dflt=n
  3447.     rp="Directory $lib doesn't exist.  Use that name anyway? [$dflt]"
  3448.     $echo $n "$rp $c"
  3449.     . myread
  3450.     dflt=''
  3451.     case "$ans" in
  3452.     y*) cont='';;
  3453.     esac
  3454.     fi
  3455. done
  3456.  
  3457. : ask the preferred line printer and options for this system.
  3458. case "$linepr" in
  3459. '')
  3460.     if $test -f "$lp"; then
  3461.     dflt="$lp"
  3462.     elif $test -f "$lpr"; then
  3463.     dflt="$lpr"
  3464.     else
  3465.     dflt=
  3466.     fi
  3467.     ;;
  3468. *)  dflt="$linepr";;
  3469. esac
  3470.  
  3471. linepr='blurfl/dyick'
  3472. $cat <<EOM
  3473.  
  3474. Elm has an option to send messages to the printer.  This question
  3475. asks for the default spooler name.  You can also specify options
  3476. to the command by separating them from the command by at least one space.
  3477.  
  3478. EOM
  3479. cont=true
  3480. while $test "$cont" ; do
  3481.     rp="What print spooler do you prefer to use with Elm? [$dflt]"
  3482.     $echo $n "$rp $c"
  3483.     . myread
  3484.     linepr="$ans"
  3485.     ans=`$expr "$linepr" : "\([^ ]*\).*"`
  3486.     case "$ans" in
  3487.     /*)
  3488.     if $test -f "$ans"; then
  3489.         cont=''
  3490.     else
  3491.         if $test "$fastread" = yes; then
  3492.         dflt=y
  3493.         else
  3494.         dflt=n
  3495.         fi
  3496.         rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
  3497.         $echo $n "$rp $c"
  3498.         . myread
  3499.         case "$ans" in
  3500.         y*) cont='';;
  3501.         esac
  3502.     fi
  3503.     ;;
  3504.     *)
  3505.     echo "Please give the full path name."
  3506.     ;;
  3507.     esac
  3508. done
  3509.  
  3510. : determine where mail is spooled
  3511. case "$maildir" in
  3512. '')
  3513.     dflt=`loc . /usr/spool/mail /usr/spool/mail /usr/mail`
  3514.     ;;
  3515. *)  dflt="$maildir"
  3516.     ;;
  3517. esac
  3518. cont=true
  3519. while $test "$cont" ; do
  3520.     echo " "
  3521.     rp="Where is yet-to-be-read mail spooled? [$dflt]"
  3522.     $echo $n "$rp $c"
  3523.     . myread
  3524.     maildir=`filexp "$ans"`
  3525.     if test -d $maildir; then
  3526.     cont=''
  3527.     else
  3528.     if $test "$fastread" = yes; then
  3529.         dflt=y
  3530.     else
  3531.         dflt=n
  3532.     fi
  3533.     rp="Directory $maildir doesn't exist.  Use that name anyway? [$dflt]"
  3534.     $echo $n "$rp $c"
  3535.     . myread
  3536.     dflt=''
  3537.     case "$ans" in
  3538.     y*) cont='';;
  3539.     esac
  3540.     fi
  3541. done
  3542.  
  3543. : ask about setgid running of Elm
  3544. case "$d_setgid" in
  3545. "$define")    dflt=y;;
  3546. "$undef")    dflt=n;;
  3547. *)        dflt=y;;
  3548. esac
  3549. echo " "
  3550. rp="Am I going to be running as a setgid program? [$dflt]"
  3551. $echo $n "$rp $c"
  3552. . myread
  3553. case "$ans" in
  3554. y*) d_setgid="$define";;
  3555. *)  d_setgid="$undef";;
  3556. esac
  3557. case "$d_setgid" in
  3558. "$define")    mailermode=2755;;
  3559. *)        mailermode=755;;
  3560. esac
  3561.  
  3562. : determine the group of the mail directory- what group elm should use
  3563. mailgrp=`$ls -lgd $maildir`
  3564. mailgrp=`$expr "$mailgrp" : "[ld][rwxstS-]*[ 0123456789]*\(.*\)"`
  3565. : now mailgrp is either    user group size mon day time/year name
  3566. : or                       group size mon day time/year name
  3567. try1=`$expr "$mailgrp" : "[A-Za-z_0-9]* *\([A-Za-z_0-9]*\).*"`
  3568. try1a=`$expr "$try1" : "\([0-9]*\).*"`
  3569. if $test "$try1" = "$try1a"; then
  3570.     mailgrp=`$expr "$mailgrp" : "\([A-Za-z_0-9]*\).*"`
  3571. else
  3572.     mailgrp="$try1"
  3573. fi
  3574. case "$mailgrp" in
  3575. '')
  3576.     mailgrp=mail
  3577.     ;;
  3578. esac
  3579. echo " "
  3580. echo "Mail group is $mailgrp"
  3581.  
  3582. : ask the preferred pager for this system.
  3583. case "$pager" in
  3584. '') dflt="builtin+";;
  3585. *)  dflt="$pager";;
  3586. esac
  3587.  
  3588. pager='blurfl/dyick'
  3589. echo " "
  3590. cont=true
  3591. while $test "$cont" ; do
  3592.     rp="What pager do you prefer to use with $package? [$dflt]"
  3593.     $echo $n "$rp $c"
  3594.     . myread
  3595.     pager="$ans"
  3596.     case "$ans" in
  3597.     builtin)
  3598.         cont=''
  3599.     ;;
  3600.     builtin+)
  3601.         cont=''
  3602.     ;;
  3603.     /*)
  3604.     if $test -f "$ans"; then
  3605.         cont=''
  3606.     else
  3607.         if $test "$fastread" = yes; then
  3608.         dflt=y
  3609.         else
  3610.         dflt=n
  3611.         fi
  3612.         rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
  3613.         $echo $n "$rp $c"
  3614.         . myread
  3615.         case "$ans" in
  3616.         y*) cont='';;
  3617.         esac
  3618.     fi
  3619.     ;;
  3620.     *)
  3621.     echo "Please give the full path name."
  3622.     ;;
  3623.     esac
  3624. done
  3625.  
  3626. : find out which shell people like to use most
  3627. case "$prefshell" in
  3628. '')
  3629.     if $test -f /bin/ksh; then
  3630.     dflt='/bin/ksh'
  3631.     elif $test -f /bin/csh; then
  3632.     dflt='/bin/csh'
  3633.     else
  3634.     dflt='/bin/sh'
  3635.     fi
  3636.     ;;
  3637. *)  dflt="$prefshell";;
  3638. esac
  3639. cont=true
  3640. while $test "$cont" ; do
  3641.     echo " "
  3642.     echo "Give the full path name of the shell most people like to use on your"
  3643.     $echo $n "system: [$dflt] $c"
  3644.     rp="Preferred shell: [$dflt]"
  3645.     . myread
  3646.     prefshell=$ans
  3647.     if test -f $ans; then
  3648.     cont=''
  3649.     else
  3650.     if $test "$fastread" = yes; then
  3651.         dflt=y
  3652.     else
  3653.         dflt=n
  3654.     fi
  3655.     rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
  3656.     $echo $n "$rp $c"
  3657.     . myread
  3658.     dflt=''
  3659.     case "$ans" in
  3660.     y*) cont='';;
  3661.     esac
  3662.     fi
  3663. done
  3664.  
  3665. : determine the name of the tape device
  3666. rmttape=`loc rct0 "" /dev`
  3667. if $test -z "$rmttape"; then
  3668.     rmttape=`loc rmt0 "" /dev`
  3669. fi
  3670. if $test -z "$rmttape"; then
  3671.     rmttape=`loc rtp0 "unknown-remote-tape-unit" /dev`
  3672. fi
  3673. echo "remote tape drive is $rmttape"
  3674. echo " "
  3675. : where do we get termlib routines from
  3676. echo " "
  3677. ans=`loc libcurses.a x $libpth`
  3678. if $test "$ans" = x; then
  3679.     ans=`loc Slibcurses.a x $libpth`
  3680. fi
  3681. case "$ans" in
  3682. /*)
  3683.     ar t $ans >grimble
  3684.     if $contains tputs.o grimble >/dev/null 2>&1; then
  3685.     termlib='-lcurses'
  3686.     d_havetlib="$define"
  3687.     echo "Terminfo library found."
  3688.     else
  3689.     ans=x
  3690.     fi
  3691.     rm -f grimble
  3692.     ;;
  3693. esac
  3694. case "$ans" in
  3695. x)
  3696.     ans=`loc libtermlib.a x $libpth`
  3697.     if $test "$ans" = x; then
  3698.     ans=`loc Slibtermlib.a x $libpth`
  3699.     fi
  3700.     case "$ans" in
  3701.     /usr/lib*|/lib*)
  3702.     termlib='-ltermlib'
  3703.     d_havetlib="$define"
  3704.     echo "Termlib library found."
  3705.     ;;
  3706.     /*)
  3707.     termlib="$ans"
  3708.     d_havetlib="$define"
  3709.     echo "Termlib library found."
  3710.     ;;
  3711.     *)
  3712.     ans=`loc libtermcap.a x $libpth`
  3713.     if $test "$ans" = x; then
  3714.         ans=`loc Slibtermcap.a x $libpth`
  3715.     fi
  3716.     case "$ans" in
  3717.     /usr/lib*|/lib*)
  3718.         termlib='-ltermcap'
  3719.         d_havetlib="$define"
  3720.         echo "Termcap library found."
  3721.         ;;
  3722.     /*)
  3723.         termlib="$ans"
  3724.         d_havetlib="$define"
  3725.         echo "Termcap library found."
  3726.         ;;
  3727.     *)
  3728.         case "$termlib" in
  3729.         '')
  3730.         dflt=y
  3731.         rp="Your system appears to NOT have termlib-style routines.  Is this true? [$dflt]"
  3732.         $echo $n "$rp $c"
  3733.         . myread
  3734.         case "$ans" in
  3735.             n*|f*) d_havetlib="$define"
  3736.               echo "Then where are the termlib-style routines kept (specify either -llibname"
  3737.               $echo $n " or full pathname (~name ok))? $c"
  3738.               rp='Specify termlib:'
  3739.               . myread
  3740.               termlib=`filexp $ans`
  3741.               ;;
  3742.             *)    d_havetlib="$undef"
  3743.               termlib=''
  3744.               echo "You will have to play around with term.c then."
  3745.               ;;
  3746.         esac
  3747.         echo " "
  3748.         ;;
  3749.         *)  echo "You said termlib was $termlib before."
  3750.         ;;
  3751.         esac
  3752.         ;;
  3753.     esac
  3754.     ;;
  3755.     esac
  3756.     ;;
  3757. esac
  3758.  
  3759. : determine where temporary files should go
  3760. case "$tmpdir" in
  3761. '')
  3762.     dflt=`loc . "." "/tmp /usr/tmp"`
  3763.     ;;
  3764. *)  dflt="$tmpdir"
  3765.     ;;
  3766. esac
  3767. if $test -d "$tmpdir" -a "$tmpdir" != ""; then
  3768.     $echo " "
  3769.     $echo "Temporary files will be put in the $tmpdir directory"
  3770. else
  3771.     cont=true
  3772.     while $test "$cont" ; do
  3773.         $echo " "
  3774.         rp="Where do you want to put the temporary files? [$dflt]"
  3775.         $echo $n "$rp $c"
  3776.         . myread
  3777.         tmpdir="$ans"
  3778.         tmpdir=`filexp $tmpdir`
  3779.         if $test -d "$tmpdir" -a "$tmpdir" != ""; then
  3780.         cont=''
  3781.         else
  3782.         if $test "$fastread" = yes; then
  3783.             dflt=y
  3784.         else
  3785.             dflt=n
  3786.         fi
  3787.         rp="Directory $tmpdir doesn't exist.  Use that name anyway? [$dflt]"
  3788.         $echo $n "$rp $c"
  3789.         . myread
  3790.         dflt=''
  3791.         case "$ans" in
  3792.         y*) cont='';;
  3793.         esac
  3794.         fi
  3795.     done
  3796. fi
  3797.  
  3798. : if pmake exists, allow its use for parallel make
  3799.  
  3800. if $test -f "$pmake" ; then
  3801.     case "$use_pmake" in
  3802.     n)  dflt=n;;
  3803.     *)  dflt=y;;
  3804.     esac
  3805.  
  3806.     $cat <<EOM
  3807.  
  3808. The executable file pmake was found on this system.  Usually this
  3809. file indicates a parallel make, which executes much faster.  Should
  3810. this system use the pmake command as its make command?
  3811.  
  3812. EOM
  3813.     rp="Does this system use pmake as its make? [$dflt]"
  3814.     $echo $n "$rp $c"
  3815.     . myread
  3816.     case "$ans" in
  3817.     y*) use_pmake=y
  3818.         make="$pmake";;
  3819.     *)  use_pmake=n;;
  3820.     esac
  3821. else
  3822.     use_pmake=n
  3823. fi
  3824. echo " "
  3825. echo "End of configuration questions."
  3826. echo " "
  3827.  
  3828. : create config.sh file
  3829. echo " "
  3830. if test -d ../UU; then
  3831.     cd ..
  3832. fi
  3833. echo "Creating config.sh..."
  3834. $spitshell <<EOT >config.sh
  3835. $startsh
  3836. # config.sh
  3837. # This file was produced by running the Configure script.
  3838.  
  3839. define='$define'
  3840. eunicefix='$eunicefix'
  3841. Log='$Log'
  3842. Header='$Header'
  3843. bin='$bin'
  3844. byteorder='$byteorder'
  3845. contains='$contains'
  3846. cppstdin='$cppstdin'
  3847. cppminus='$cppminus'
  3848. d_crypt='$d_crypt'
  3849. cryptlib='$cryptlib'
  3850. d_getopt='$d_getopt'
  3851. d_havetlib='$d_havetlib'
  3852. termlib='$termlib'
  3853. d_mkdir='$d_mkdir'
  3854. d_rename='$d_rename'
  3855. d_sigvec='$d_sigvec'
  3856. d_sigvectr='$d_sigvectr'
  3857. d_symlink='$d_symlink'
  3858. d_vfork='$d_vfork'
  3859. d_whoami='$d_whoami'
  3860. defeditor='$defeditor'
  3861. hostname='$hostname'
  3862. phostname='$phostname'
  3863. mydomain='$mydomain'
  3864. i_time='$i_time'
  3865. i_systime='$i_systime'
  3866. d_systimekernel='$d_systimekernel'
  3867. maildir='$maildir'
  3868. n='$n'
  3869. c='$c'
  3870. package='$package'
  3871. pager='$pager'
  3872. prefshell='$prefshell'
  3873. spitshell='$spitshell'
  3874. shsharp='$shsharp'
  3875. sharpbang='$sharpbang'
  3876. startsh='$startsh'
  3877. d_eunice='$d_eunice'
  3878. loclist='$loclist'
  3879. expr='$expr'
  3880. sed='$sed'
  3881. echo='$echo'
  3882. cat='$cat'
  3883. rm='$rm'
  3884. mv='$mv'
  3885. cp='$cp'
  3886. tail='$tail'
  3887. tr='$tr'
  3888. mkdir='$mkdir'
  3889. sort='$sort'
  3890. uniq='$uniq'
  3891. grep='$grep'
  3892. trylist='$trylist'
  3893. test='$test'
  3894. inews='$inews'
  3895. egrep='$egrep'
  3896. more='$more'
  3897. pg='$pg'
  3898. Mcc='$Mcc'
  3899. vi='$vi'
  3900. mailx='$mailx'
  3901. mail='$mail'
  3902. cpp='$cpp'
  3903. perl='$perl'
  3904. emacs='$emacs'
  3905. ls='$ls'
  3906. rmail='$rmail'
  3907. sendmail='$sendmail'
  3908. shar='$shar'
  3909. smail='$smail'
  3910. submit='$submit'
  3911. tbl='$tbl'
  3912. troff='$troff'
  3913. nroff='$nroff'
  3914. uname='$uname'
  3915. uuname='$uuname'
  3916. line='$line'
  3917. chgrp='$chgrp'
  3918. chmod='$chmod'
  3919. lint='$lint'
  3920. sleep='$sleep'
  3921. pr='$pr'
  3922. tar='$tar'
  3923. ln='$ln'
  3924. lpr='$lpr'
  3925. lp='$lp'
  3926. touch='$touch'
  3927. make='$make'
  3928. date='$date'
  3929. csh='$csh'
  3930. pmake='$pmake'
  3931. c_date='$c_date'
  3932. d_ascii='$d_ascii'
  3933. d_calendar='$d_calendar'
  3934. calendar='$calendar'
  3935. d_cuserid='$d_cuserid'
  3936. d_flock='$d_flock'
  3937. d_flockonly='$d_flockonly'
  3938. lock_dir='$lock_dir'
  3939. d_gethname='$d_gethname'
  3940. d_douname='$d_douname'
  3941. d_phostname='$d_phostname'
  3942. d_host_comp='$d_host_comp'
  3943. ign_hname='$ign_hname'
  3944. d_havedbm='$d_havedbm'
  3945. dbm='$dbm'
  3946. d_index='$d_index'
  3947. d_internet='$d_internet'
  3948. d_mboxedit='$d_mboxedit'
  3949. d_mmdf='$d_mmdf'
  3950. d_newauto='$d_newauto'
  3951. d_nfs='$d_nfs'
  3952. d_networkorder='$d_networkorder'
  3953. d_noxheader='$d_noxheader'
  3954. d_optreturn='$d_optreturn'
  3955. d_pafirst='$d_pafirst'
  3956. d_notouchadd='$d_notouchadd'
  3957. d_noaddfrom='$d_noaddfrom'
  3958. d_usedomain='$d_usedomain'
  3959. d_nocheckvalid='$d_nocheckvalid'
  3960. d_pidcheck='$d_pidcheck'
  3961. d_portable='$d_portable'
  3962. d_ptem='$d_ptem'
  3963. d_remlock='$d_remlock'
  3964. maxattempts='$maxattempts'
  3965. d_setgid='$d_setgid'
  3966. mailermode='$mailermode'
  3967. d_strcspn='$d_strcspn'
  3968. d_strspn='$d_strspn'
  3969. d_strings='$d_strings'
  3970. d_pwdinsys='$d_pwdinsys'
  3971. strings='$strings'
  3972. includepath='$includepath'
  3973. d_subshell='$d_subshell'
  3974. d_tempnam='$d_tempnam'
  3975. tempnamo='$tempnamo'
  3976. tempnamc='$tempnamc'
  3977. d_termio='$d_termio'
  3978. d_termios='$d_termios'
  3979. d_tz_min='$d_tz_min'
  3980. d_useembed='$d_useembed'
  3981. d_utimbuf='$d_utimbuf'
  3982. d_voidsig='$d_voidsig'
  3983. defbatsub='$defbatsub'
  3984. elmalias='$elmalias'
  3985. maxsysalias='$maxsysalias'
  3986. maxuseralias='$maxuseralias'
  3987. lib='$lib'
  3988. libc='$libc'
  3989. linepr='$linepr'
  3990. mailer='$mailer'
  3991. mailgrp='$mailgrp'
  3992. mansrc='$mansrc'
  3993. manext='$manext'
  3994. models='$models'
  3995. split='$split'
  3996. small='$small'
  3997. medium='$medium'
  3998. large='$large'
  3999. huge='$huge'
  4000. optimize='$optimize'
  4001. ccflags='$ccflags'
  4002. cppflags='$cppflags'
  4003. ldflags='$ldflags'
  4004. cc='$cc'
  4005. libs='$libs'
  4006. nametype='$nametype'
  4007. d_passnames='$d_passnames'
  4008. d_berknames='$d_berknames'
  4009. d_usgnames='$d_usgnames'
  4010. passcat='$passcat'
  4011. pathalias='$pathalias'
  4012. domains='$domains'
  4013. rmttape='$rmttape'
  4014. roff='$roff'
  4015. tmpdir='$tmpdir'
  4016. use_pmake='$use_pmake'
  4017. xencf='$xencf'
  4018. xenlf='$xenlf'
  4019. d_xenix='$d_xenix'
  4020. d_bsd='$d_bsd'
  4021. CONFIG=true
  4022. EOT
  4023.  
  4024. CONFIG=true
  4025.  
  4026. echo " "
  4027. dflt=''
  4028. fastread=''
  4029. echo "If you didn't make any mistakes, then just type a carriage return here."
  4030. rp="If you need to edit config.sh, do it as a shell escape here:"
  4031. $echo $n "$rp $c"
  4032. . UU/myread
  4033. case "$ans" in
  4034. '') ;;
  4035. *) : in case they cannot read
  4036.     eval $ans;;
  4037. esac
  4038. : if this fails, just run all the .SH files by hand
  4039. . ./config.sh
  4040.  
  4041. echo " "
  4042. echo "Doing variable substitutions on .SH files..."
  4043. set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
  4044. shift
  4045. case $# in
  4046. 0) set x *.SH; shift;;
  4047. esac
  4048. if test ! -f $1; then
  4049.     shift
  4050. fi
  4051. for file in $*; do
  4052.     case "$file" in
  4053.     */*)
  4054.     dir=`$expr X$file : 'X\(.*\)/'`
  4055.     file=`$expr X$file : 'X.*/\(.*\)'`
  4056.     (cd $dir && . $file)
  4057.     ;;
  4058.     *)
  4059.     . $file
  4060.     ;;
  4061.     esac
  4062. done
  4063. if test -f config.h.SH; then
  4064.     if test ! -f config.h; then
  4065.     : oops, they left it out of MANIFEST, probably, so do it anyway.
  4066.     . config.h.SH
  4067.     fi
  4068. fi
  4069.  
  4070. if $contains '^depend:' Makefile >/dev/null 2>&1; then
  4071.     dflt=n
  4072.     $cat <<EOM
  4073.  
  4074. Now you need to generate make dependencies by running "make depend".
  4075. You might prefer to run it in background: "make depend > makedepend.out &"
  4076. It can take a while, so you might not want to run it right now.
  4077.  
  4078. EOM
  4079.     rp="Run make depend now? [$dflt]"
  4080.     $echo $n "$rp $c"
  4081.     . UU/myread
  4082.     case "$ans" in
  4083.     y*) make depend && echo "Now you must run a make."
  4084.     ;;
  4085.     *)  echo "You must run 'make depend' then 'make'."
  4086.     ;;
  4087.     esac
  4088. elif test -f Makefile; then
  4089.     echo " "
  4090.     echo "Now you must run a make."
  4091. else
  4092.     echo "Done."
  4093. fi
  4094.  
  4095. $rm -f kit*isdone
  4096. : the following is currently useless
  4097. cd UU && $rm -f $rmlist
  4098. : since this removes it all anyway
  4099. cd .. && $rm -rf UU
  4100. : end of Configure
  4101.