home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / kit / part04 / Configure
Encoding:
Text File  |  1991-12-18  |  52.4 KB  |  2,367 lines

  1. #! /bin/sh
  2. #
  3. # If these # comments don't work, trim them. Don't worry about any
  4. # other shell scripts, Configure will trim # comments from them for you.
  5. #
  6. # (If you are trying to port this package to a machine without sh,
  7. # I would suggest you have a look at the prototypical config.h.SH file
  8. # and edit it to reflect your system. Some packages may include samples
  9. # of config.h for certain machines, so you might look for one of those.)
  10. #
  11. # Yes, you may rip this off to use in other distribution packages. This
  12. # script belongs to the public domain and cannot be copyrighted.
  13. #
  14. # (Note: this Configure script was generated automatically. Rather than
  15. # working with this copy of Configure, you may wish to get metaconfig.
  16. # Write to ram@eiffel.com (Raphael Manfredi) and I will send you the
  17. # latest revision of the dist package, which includes metaconfig.)
  18.  
  19. # $Id: Configure,v 2.0.1.4 91/11/25 15:48:25 ram Exp $
  20. #
  21. # Generated on Mon Nov 25 15:43:33 PST 1991 [metaconfig 2.8 PL11]
  22.  
  23. cat >/tmp/c1$$ <<EOF
  24.  
  25. ARGGGHHHH!!!!!
  26.  
  27. SCO csh still thinks true is false.  Write to SCO today and tell them that next
  28. year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
  29.  
  30. (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
  31. we'd have to do is go in and swap the && and || tokens, wherever they are.)
  32.  
  33. [End of diatribe.  We now return you to your regularly scheduled programming...]
  34. EOF
  35. cat >/tmp/c2$$ <<EOF
  36.  
  37. OOPS!  You naughty creature!  You didn't run Configure with sh!
  38. I will attempt to remedy the situation by running sh for you...
  39. EOF
  40.  
  41. true || cat /tmp/c1$$ /tmp/c2$$
  42. true || exec sh $0
  43.  
  44. export PATH || cat /tmp/c2$$
  45. export PATH || exec sh $0
  46. rm -f /tmp/c1$$ /tmp/c2$$
  47.  
  48. : sanity checks
  49. PATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin"
  50. PATH=$PATH:'/usr/5bin:/etc:/usr/gnu/bin:/usr/new:/usr/new/bin:/usr/nbin'
  51. PATH=$PATH:'/sys5.3/bin:/sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb'
  52. PATH=$PATH:'/bsd4.3/usr/bin:/usr/bsd:/bsd43/bin'
  53. export PATH
  54.  
  55. if test ! -t 0; then
  56.     echo "Say 'sh Configure', not 'sh <Configure'"
  57.     exit 1
  58. fi
  59.  
  60. (alias) >/dev/null 2>&1 && \
  61.     echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
  62.     echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
  63.  
  64. test -d UU || mkdir UU
  65. cd UU && rm -f *
  66.  
  67. case "$1" in
  68. -d) shift; fastread='yes';;
  69. esac
  70.  
  71. d_eunice=''
  72. d_xenix=''
  73. d_bsd=''
  74. define=''
  75. eunicefix=''
  76. Mcc=''
  77. awk=''
  78. bison=''
  79. cat=''
  80. chgrp=''
  81. chmod=''
  82. chown=''
  83. compress=''
  84. cp=''
  85. cpio=''
  86. cpp=''
  87. csh=''
  88. date=''
  89. echo=''
  90. egrep=''
  91. emacs=''
  92. expr=''
  93. grep=''
  94. inews=''
  95. less=''
  96. line=''
  97. lint=''
  98. ln=''
  99. lp=''
  100. lpr=''
  101. ls=''
  102. mail=''
  103. mailx=''
  104. make=''
  105. mkdir=''
  106. more=''
  107. mv=''
  108. nroff=''
  109. perl=''
  110. pg=''
  111. pmake=''
  112. pr=''
  113. rm=''
  114. rmail=''
  115. sed=''
  116. sendmail=''
  117. sleep=''
  118. smail=''
  119. sort=''
  120. submit=''
  121. tail=''
  122. tar=''
  123. tbl=''
  124. test=''
  125. touch=''
  126. tr=''
  127. troff=''
  128. uname=''
  129. uniq=''
  130. uuname=''
  131. vi=''
  132. zcat=''
  133. Author=''
  134. Date=''
  135. Header=''
  136. Id=''
  137. Locker=''
  138. Log=''
  139. RCSfile=''
  140. Revision=''
  141. Source=''
  142. State=''
  143. bin=''
  144. byteorder=''
  145. cc=''
  146. ccflags=''
  147. ldflags=''
  148. cppflags=''
  149. optimize=''
  150. contains=''
  151. cppstdin=''
  152. cppminus=''
  153. d_getopt=''
  154. d_index=''
  155. d_memcpy=''
  156. d_memset=''
  157. d_portable=''
  158. d_voidsig=''
  159. signal_t=''
  160. defeditor=''
  161. i_string=''
  162. strings=''
  163. i_sysioctl=''
  164. i_bsdioctl=''
  165. i_syssockio=''
  166. d_voidtty=''
  167. i_termio=''
  168. i_sgtty=''
  169. i_termios=''
  170. libc=''
  171. nm_opt=''
  172. libpth=''
  173. plibpth=''
  174. libs=''
  175. mailer=''
  176. mansrc=''
  177. manext=''
  178. n=''
  179. c=''
  180. package=''
  181. privlib=''
  182. scriptdir=''
  183. spitshell=''
  184. shsharp=''
  185. sharpbang=''
  186. startsh=''
  187. sysman=''
  188. usrinc=''
  189. mips=''
  190. incpath=''
  191. mips_type=''
  192. voidflags=''
  193. defvoidused=''
  194. d_taropt_o=''
  195. large=''
  196. d_whoami=''
  197. i_sysselct=''
  198. CONFIG=''
  199. : set package name
  200. package=kit
  201.  
  202. : Eunice requires " " instead of "", can you believe it
  203. echo " "
  204. : Here we go...
  205. echo "Beginning of configuration questions for $package kit."
  206.  
  207. define='define'
  208. undef='undef'
  209. smallmach='pdp11 i8086 z8000 i80286 iAPX286'
  210. rmlist='ark[1-9]isdone ark[1-9][0-9]isdone'
  211. trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3 15
  212.  
  213. : We must find out about Eunice early
  214. eunicefix=':'
  215. if test -f /etc/unixtovms; then
  216.     eunicefix=/etc/unixtovms
  217. fi
  218. if test -f /etc/unixtovms.exe; then
  219.     eunicefix=/etc/unixtovms.exe
  220. fi
  221.  
  222. : Find out which program gives a meaningful exit status
  223. if ls blurfl >/dev/null 2>&1; then
  224.     if awk '' blurfl >/dev/null 2>&1; then
  225.         check='cat'
  226.     else
  227.         check='awk ""'
  228.     fi
  229. else
  230.     check='ls'
  231. fi
  232.  
  233. : Now test for existence of everything in MANIFEST
  234. echo " "
  235. if test -f ../MANIFEST; then
  236.     echo "First let's make sure your kit is complete.  Checking..."
  237.     : some grep do not return a proper exit status
  238.     grep '^---' ../MANIFEST > .grepmani 2>/dev/null
  239.     if test -s .grepmani; then
  240. (cd ..; eval $check `awk '!/^.*\/$/{if (b) print $1}
  241. /^---/{b=1}' MANIFEST` || kill $$) >/dev/null
  242.     else
  243. (cd ..; eval $check `awk '!/^.*\/$/{print $1}' MANIFEST` || kill $$) >/dev/null
  244.     fi
  245.     echo "Looks good..."
  246. else
  247.     echo "No MANIFEST found. Hope your kit is complete !"
  248. fi
  249. rm -f .grepmani
  250.  
  251. : list of known cpp symbols
  252. attrlist="DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__"
  253. attrlist="$attrlist _AIX __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
  254. attrlist="$attrlist hp9000s300 hp9000s500 hp9000s800 hpux"
  255. attrlist="$attrlist i186 i386 i486 i8086 iAPX286 ibm interdata"
  256. attrlist="$attrlist m88k mc300 mc500 mc68000 mc68k mc700 mert"
  257. attrlist="$attrlist mips ns16000 ns32000 nsc32000 os pdp11 posix pyr"
  258. attrlist="$attrlist sinix sony sparc sun tower tower32 tower32_600"
  259. attrlist="$attrlist tower32_800 tss u3b2 u3b20 u3b200 u3b5 ultrix unix"
  260. attrlist="$attrlist vax venix xenix z8000"
  261.  
  262. : no include file wanted by default
  263. inclwanted=''
  264.  
  265. : change the next line if compiling for Xenix/286 on Xenix/386
  266. xlibpath='/usr/lib/386 /lib/386'
  267. libpth='/usr/lib/large /lib '$xlibpth' /lib/large'
  268. libpth=$libpth' /usr/lib/small /lib/small'
  269.  
  270. : full support for void wanted by default
  271. defvoidused=15
  272.  
  273.  
  274. : some greps do not return status, grrr.
  275. echo "grimblepritz" >grimble
  276. if grep blurfldyick grimble >/dev/null 2>&1 ; then
  277.     contains=contains
  278. elif grep grimblepritz grimble >/dev/null 2>&1 ; then
  279.     contains=grep
  280. else
  281.     contains=contains
  282. fi
  283. rm -f grimble
  284. : the following should work in any shell
  285. case "$contains" in
  286. contains*)
  287.     echo " "
  288.     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  289.     cat >contains <<'EOSS'
  290. grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  291. EOSS
  292. chmod +x contains
  293. esac
  294.  
  295. : first determine how to suppress newline on echo command
  296. echo " "
  297. echo "Checking echo to see how to suppress newlines..."
  298. (echo "hi there\c" ; echo " ") >.echotmp
  299. if $contains c .echotmp >/dev/null 2>&1 ; then
  300.     echo "...using -n."
  301.     n='-n'
  302.     c=''
  303. else
  304.     cat <<'EOM'
  305. ...using \c
  306. EOM
  307.     n=''
  308.     c='\c'
  309. fi
  310. echo $n "The star should be here-->$c"
  311. echo '*'
  312. rm -f .echotmp
  313.  
  314. : set up the echo used in my read
  315. myecho="case \"\$xxxm\" in
  316. '') echo $n \"\$rp $c\";;
  317. *) case \"\$rp\" in
  318.     '') echo $n \"[\$xxxm] $c\";;
  319.     *) echo $n \"\$rp [\$xxxm] $c\";;
  320.     esac;;
  321. esac"
  322.  
  323. : now set up to do reads with possible shell escape and default assignment
  324. cat <<EOSC >myread
  325. xxxm=\$dflt
  326. $myecho
  327. case "\$fastread" in
  328. yes) case "\$dflt" in
  329.     '') ans='!';;
  330.     *) ans=''; echo " " ;;
  331.     esac;;
  332. *) ans='!';;
  333. esac
  334. while expr "X\$ans" : "X!" >/dev/null; do
  335.     read answ
  336.     set x \$xxxm
  337.     shift
  338.     aok=''; eval "ans=\"\$answ\"" && aok=y
  339.     case  "\$answ" in
  340.     "\$ans")
  341.         case "\$ans" in
  342.         !)
  343.             sh
  344.             echo " "
  345.             $myecho
  346.             ;;
  347.         !*)
  348.             set x \`expr "X\$ans" : "X!\(.*\)\$"\`
  349.             shift
  350.             sh -c "\$*"
  351.             echo " "
  352.             $myecho
  353.             ;;
  354.         esac;;
  355.     *)
  356.         case "\$aok" in
  357.         y)
  358.             echo "*** Substitution done -- please confirm."
  359.             xxxm="\$ans"
  360.             ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
  361.             xxxm="\$ans"
  362.             ans=!
  363.             ;;
  364.         *)
  365.             echo "*** Error -- try again."
  366.             ans=!
  367.             ;;
  368.         esac
  369.         $myecho
  370.         ;;
  371.     esac
  372. done
  373. case "\$ans" in
  374. '') ans="\$xxxm";;
  375. esac
  376. EOSC
  377.  
  378. : general instructions
  379. cat <<EOH
  380.  
  381. This installation shell script will examine your system and ask you questions
  382. to determine how the kit package should be installed.  If you get stuck
  383. on a question, you may use a ! shell escape to start a subshell or execute a
  384. command.  Many of the questions will have default answers in square brackets;
  385. typing carriage return will give you the default.
  386.  
  387. On some of the questions which ask for file or directory names you are allowed
  388. to use the ~name construct to specify the login directory belonging to "name",
  389. even if you don't have a shell which knows about that.  Questions where this is
  390. allowed will be marked "(~name ok)".
  391.  
  392. EOH
  393. rp=''
  394. dflt="Type carriage return to continue"
  395. . myread
  396. cat <<'EOH'
  397.  
  398. The prompter used in this script allows you to use shell variables and
  399. backticks in your answers.  You may use $1, $2, etc...  to refer to the words
  400. in the default answer, as if the default line was a set of arguments given to a
  401. script shell.  This means you may also use $* to repeat the whole default line,
  402. so you do not have to re-type everything to add something to the default.
  403.  
  404. Everytime there is a substitution, you will have to confirm.  If there is an
  405. error (e.g. an unmatched backtick), the default answer will remain unchanged
  406. and you will be prompted again.
  407.  
  408. If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
  409. the questions and use the computed defaults (or the previous answers if there
  410. was already a config.sh file).
  411.  
  412. EOH
  413. . myread
  414. cat <<EOH
  415.  
  416. Much effort has been expended to ensure that this shell script will run on any
  417. Unix system.  If despite that it blows up on yours, your best bet is to edit
  418. Configure and run it again.  Also, let me (ram@eiffel.com)
  419. know how I blew it.  If you can't run Configure for some reason, you'll have to
  420. generate a config.sh file by hand.
  421.  
  422. This installation script affects things in two ways:
  423.  
  424. 1) it may do direct variable substitutions on some of the files included
  425.    in this kit.
  426. 2) it builds a config.h file for inclusion in C programs.  You may edit
  427.    any of these files as the need arises after running this script.
  428.  
  429. If you make a mistake on a question, there is no easy way to back up to it
  430. currently.  The easiest thing to do is to edit config.sh and rerun all the SH
  431. files.  Configure will offer to let you do this before it runs the SH files.
  432.  
  433. EOH
  434. dflt="Type carriage return to continue"
  435. . myread
  436.  
  437. : see if sh knows # comments
  438. echo " "
  439. echo "Checking your sh to see if it knows about # comments..."
  440. if sh -c '#' >/dev/null 2>&1 ; then
  441.     echo "Your sh handles # comments correctly."
  442.     shsharp=true
  443.     spitshell=cat
  444.     echo " "
  445.     echo "Okay, let's see if #! works on this system..."
  446.     echo "#!/bin/cat" >try
  447.     $eunicefix try
  448.     chmod +x try
  449.     try > today
  450.     if test -s today; then
  451.         echo "It does."
  452.         sharpbang='#!'
  453.     else
  454.         echo "#! /bin/cat" > try
  455.         $eunicefix try
  456.         chmod +x try
  457.         try > today
  458.         if test -s today; then
  459.             echo "It does."
  460.             sharpbang='#! '
  461.         else
  462.             echo "It doesn't."
  463.             sharpbang=': use '
  464.         fi
  465.     fi
  466. else
  467.     echo "Your sh doesn't grok # comments--I will strip them later on."
  468.     shsharp=false
  469.     echo "exec grep -v '^[     ]*#'" >spitshell
  470.     chmod +x spitshell
  471.     $eunicefix spitshell
  472.     spitshell=`pwd`/spitshell
  473.     echo "I presume that if # doesn't work, #! won't work either!"
  474.     sharpbang=': use '
  475. fi
  476. rm -f try today
  477.  
  478. : figure out how to guarantee sh startup
  479. echo " "
  480. echo "Checking out how to guarantee sh startup..."
  481. startsh=$sharpbang'/bin/sh'
  482. echo "Let's see if '$startsh' works..."
  483. cat >try <<EOSS
  484. $startsh
  485. set abc
  486. test "$?abc" != 1
  487. EOSS
  488.  
  489. chmod +x try
  490. $eunicefix try
  491. if try; then
  492.     echo "Yup, it does."
  493. else
  494.     echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  495. fi
  496. rm -f try
  497.  
  498. : find out where common programs are
  499. echo " "
  500. echo "Locating common programs..."
  501. cat <<EOSC >loc
  502. $startsh
  503. case \$# in
  504. 0) exit 1;;
  505. esac
  506. thing=\$1
  507. shift
  508. dflt=\$1
  509. shift
  510. for dir in \$*; do
  511.     case "\$thing" in
  512.     .)
  513.     if test -d \$dir/\$thing; then
  514.         echo \$dir
  515.         exit 0
  516.     fi
  517.     ;;
  518.     *)
  519.     if test -f \$dir/\$thing; then
  520.         echo \$dir/\$thing
  521.         exit 0
  522.     elif test -f \$dir/\$thing.exe; then
  523.         : on Eunice apparently
  524.         echo \$dir/\$thing
  525.         exit 0
  526.     fi
  527.     ;;
  528.     esac
  529. done
  530. echo \$dflt
  531. exit 1
  532. EOSC
  533. chmod +x loc
  534. $eunicefix loc
  535. loclist="
  536. awk
  537. cat
  538. chgrp
  539. chmod
  540. chown
  541. echo
  542. expr
  543. grep
  544. mv
  545. rm
  546. sed
  547. tr
  548. "
  549. trylist="
  550. Mcc
  551. cpp
  552. mail
  553. nroff
  554. rmail
  555. sendmail
  556. tar
  557. test
  558. uname
  559. vi
  560. "
  561. pth=`echo $PATH | sed -e 's/:/ /g'`
  562. pth="$pth /lib /usr/lib"
  563. for file in $loclist; do
  564.     xxx=`loc $file $file $pth`
  565.     eval $file=$xxx
  566.     eval _$file=$xxx
  567.     case "$xxx" in
  568.     /*)
  569.     echo $file is in $xxx.
  570.     ;;
  571.     *)
  572.     echo "I don't know where $file is.  I hope it's in everyone's PATH."
  573.     ;;
  574.     esac
  575. done
  576. echo " "
  577. echo "Don't worry if any of the following aren't found..."
  578. ans=offhand
  579. for file in $trylist; do
  580.     xxx=`loc $file $file $pth`
  581.     eval $file=$xxx
  582.     eval _$file=$xxx
  583.     case "$xxx" in
  584.     /*)
  585.     echo $file is in $xxx.
  586.     ;;
  587.     *)
  588.     echo "I don't see $file out there, $ans."
  589.     ans=either
  590.     ;;
  591.     esac
  592. done
  593. case "$egrep" in
  594. egrep)
  595.     echo "Substituting grep for egrep."
  596.     egrep=$grep
  597.     ;;
  598. esac
  599. case "$test" in
  600. test)
  601.     echo "Hopefully test is built into your sh."
  602.     ;;
  603. /bin/test)
  604.     if sh -c "PATH= test true" >/dev/null 2>&1; then
  605.     echo "Using the test built into your sh."
  606.     test=test
  607.     fi
  608.     ;;
  609. *)
  610.     test=test
  611.     ;;
  612. esac
  613. case "$echo" in
  614. echo)
  615.     echo "Hopefully echo is built into your sh."
  616.     ;;
  617. /bin/echo)
  618.     echo " "
  619.     echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
  620.     $echo $n "hi there$c" >foo1
  621.     echo $n "hi there$c" >foo2
  622.     if cmp foo1 foo2 >/dev/null 2>&1; then
  623.     echo "They are compatible.  In fact, they may be identical."
  624.     else
  625.     case "$n" in
  626.     '-n') n='' c='\c';;
  627.     *) n='-n' c='';;
  628.     esac
  629.     cat <<FOO
  630. They are not compatible!  You are probably running ksh on a non-USG system.
  631. I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
  632. have echo built in and we may have to run some Bourne shell scripts.  That
  633. means I'll have to use $ans to suppress newlines now.  Life is ridiculous.
  634.  
  635. FOO
  636.     $echo $n "The star should be here-->$c"
  637.     $echo "*"
  638.     fi
  639.     $rm -f foo1 foo2
  640.     ;;
  641. *)
  642.     : cross your fingers
  643.     echo=echo
  644.     ;;
  645. esac
  646. rmlist="$rmlist loc"
  647.  
  648. : get old answers, if there is a config file out there
  649. hint=default
  650. if test -f ../config.sh; then
  651.     echo " "
  652.     dflt=y
  653.     rp="I see a config.sh file.  Did Configure make it on THIS system?"
  654.     . myread
  655.     case "$ans" in
  656.     n*|N*) echo "OK, I'll ignore it.";;
  657.     *)  echo "Fetching default answers from your old config.sh file..."
  658.         tmp="$n"
  659.         ans="$c"
  660.         . ../config.sh
  661.         cp ../config.sh .
  662.         n="$tmp"
  663.         c="$ans"
  664.         ;;
  665.     esac
  666. fi
  667.  
  668. : Restore computed paths
  669. for file in $loclist $trylist; do
  670.     eval $file="\$_$file"
  671. done
  672.  
  673. : set up shell script to do ~ expansion
  674. cat >filexp <<EOSS
  675. $startsh
  676. : expand filename
  677. case "\$1" in
  678.  ~/*|~)
  679.     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  680.     ;;
  681.  ~*)
  682.     if $test -f /bin/csh; then
  683.     /bin/csh -f -c "glob \$1"
  684.     echo ""
  685.     else
  686.     name=\`$expr x\$1 : '..\([^/]*\)'\`
  687.     dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
  688.     if $test ! -d "\$dir"; then
  689.         me=\`basename \$0\`
  690.         echo "\$me: can't locate home directory for: \$name" >&2
  691.         exit 1
  692.     fi
  693.     case "\$1" in
  694.     */*)
  695.         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  696.         ;;
  697.     *)
  698.         echo \$dir
  699.         ;;
  700.     esac
  701.     fi
  702.     ;;
  703. *)
  704.     echo \$1
  705.     ;;
  706. esac
  707. EOSS
  708. chmod +x filexp
  709. $eunicefix filexp
  710.  
  711. : determine where manual pages are on this system
  712. echo " "
  713. case "$sysman" in
  714. '') sysman=`loc . /usr/man/man1 /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/share/man/man1 /usr/catman/u_man/man1 /usr/man/l_man/man1 /usr/local/man/u_man/man1 /usr/local/man/l_man/man1 /usr/man/man.L`
  715.     ;;
  716. esac
  717. if test -d "$sysman"; then
  718.     echo "System manual is in $sysman."
  719. else
  720.     echo "Could not find manual pages in source form."
  721. fi
  722.  
  723. : make some quick guesses about what we are up against
  724. echo " "
  725. $echo $n "Hmm...  $c"
  726. $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
  727. if test `echo abc | tr a-z A-Z` = Abc ; then
  728.     xxx=`./loc addbib blurfl $pth`
  729.     if $test -f $xxx; then
  730.         echo "Looks kind of like a USG system with BSD features, but we'll see..."
  731.         echo exit 0 >bsd
  732.         echo exit 0 >usg
  733.         echo exit 1 >v7
  734.     else
  735.         if $contains SIGTSTP foo >/dev/null 2>&1 ; then
  736.             echo "Looks kind of like an extended USG system, but we'll see..."
  737.         else
  738.             echo "Looks kind of like a USG system, but we'll see..."
  739.         fi
  740.         echo exit 1 >bsd
  741.         echo exit 0 >usg
  742.         echo exit 1 >v7
  743.     fi
  744.     d_bsd="$undef"
  745. elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
  746.     echo "Looks kind of like a BSD system, but we'll see..."
  747.     d_bsd="$define"
  748.     echo exit 0 >bsd
  749.     echo exit 1 >usg
  750.     echo exit 1 >v7
  751. else
  752.     echo "Looks kind of like a Version 7 system, but we'll see..."
  753.     d_bsd="$undef"
  754.     echo exit 1 >bsd
  755.     echo exit 1 >usg
  756.     echo exit 0 >v7
  757. fi
  758. case "$eunicefix" in
  759. *unixtovms*)
  760.     cat <<'EOI'
  761. There is, however, a strange, musty smell in the air that reminds me of
  762. something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  763. EOI
  764.     echo "exit 0" >eunice
  765.     eunicefix=unixtovms
  766.     d_eunice="$define"
  767. : it so happens the Eunice I know will not run shell scripts in Unix format
  768.     ;;
  769. *)
  770.     echo " "
  771.     echo "Congratulations.  You aren't running Eunice."
  772.     eunicefix=':'
  773.     d_eunice="$undef"
  774.     echo "exit 1" >eunice
  775.     ;;
  776. esac
  777. if test -f /xenix; then
  778.     echo "Actually, this looks more like a XENIX system..."
  779.     echo "exit 0" >xenix
  780.     d_xenix="$define"
  781. else
  782.     echo " "
  783.     echo "It's not Xenix..."
  784.     echo "exit 1" >xenix
  785.     d_xenix="$undef"
  786. fi
  787. chmod +x xenix
  788. $eunicefix xenix
  789. if test -f /venix; then
  790.     echo "Actually, this looks more like a VENIX system..."
  791.     echo "exit 0" >venix
  792. else
  793.     echo " "
  794.     if xenix; then
  795.     : null
  796.     else
  797.     echo "Nor is it Venix..."
  798.     fi
  799.     echo "exit 1" >venix
  800. fi
  801. chmod +x bsd usg v7 eunice venix
  802. $eunicefix bsd usg v7 eunice venix
  803. $rm -f foo
  804. rmlist="$rmlist bsd usg v7 eunice venix xenix"
  805.  
  806. : see if we need a special compiler
  807. echo " "
  808. if usg; then
  809.     case "$cc" in
  810.     '') case "$Mcc" in
  811.         /*) dflt='Mcc';;
  812.         *) case "$large" in
  813.             -M*) dflt='cc';;
  814.             *)    if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
  815.                     if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
  816.                         dflt='cc'
  817.                     else
  818.                         dflt='cc -M'
  819.                     fi
  820.                 else
  821.                     dflt='cc'
  822.                 fi;;
  823.             esac;;
  824.         esac;;
  825.     *)  dflt="$cc";;
  826.     esac
  827.     $cat <<'EOM'
  828. On some systems the default C compiler will not resolve multiple global
  829. references that happen to have the same name.  On some such systems the "Mcc"
  830. command may be used to force these to be resolved.  On other systems a "cc -M"
  831. command is required.  (Note that the -M flag on other systems indicates a
  832. memory model to use!) If you have the Gnu C compiler, you might wish to use
  833. that instead.
  834.  
  835. EOM
  836.     rp="What command will force resolution on this system?"
  837.     . myread
  838.     cc="$ans"
  839. else
  840.     case "$cc" in
  841.     '') dflt=cc;;
  842.     *) dflt="$cc";;
  843.     esac
  844.     rp="Use which C compiler?"
  845.     . myread
  846.     cc="$ans"
  847. fi
  848. case "$cc" in
  849. gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
  850. esac
  851.  
  852. : What should the include directory be ?
  853. echo " "
  854. $echo $n "Hmm...  $c"
  855. case "$usrinc" in
  856. '') dflt='/usr/include';;
  857. *) dflt=$usrinc;;
  858. esac
  859. incpath=''
  860. mips_type=''
  861. if $test -f /bin/mips && /bin/mips; then
  862.     echo "Looks like a MIPS system..."
  863.     $cat >usr.c <<'EOCP'
  864. #ifdef SYSTYPE_BSD43
  865. /bsd43
  866. #endif
  867. EOCP
  868.     if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
  869.         dflt='/bsd43/usr/include'
  870.         incpath='/bsd43'
  871.         mips_type='BSD 4.3'
  872.     else
  873.         mips_type='System V'
  874.     fi
  875.     echo "and you're compiling with the $mips_type compiler and libraries."
  876. else
  877.     echo "Doesn't look like a MIPS system."
  878.     echo "exit 1" >mips
  879.     chmod +x mips
  880.     $eunicefix mips
  881. fi
  882. cont=true
  883. while $test "$cont"; do
  884.     echo " "
  885.     rp="Where are the include files you want to use?"
  886.     . myread
  887.     usrinc="$ans"
  888.     if $test -d "$ans"; then
  889.         cont=''
  890.     else
  891.         if $test "$fastread" = yes; then
  892.             dflt=y
  893.         else
  894.             dflt=n
  895.         fi
  896.         rp="Directory $ans doesn't exist.  Use that name anyway?"
  897.         . myread
  898.         dflt=''
  899.         case "$ans" in
  900.         y*) cont='';;
  901.         esac
  902.     fi
  903. done
  904. $rm -f usr.c usr.out
  905.  
  906. : determine optimize, if desired, or use for debug flag also
  907. case "$optimize" in
  908. ' ') dflt="none";;
  909. '') dflt="-O";;
  910. *) dflt="$optimize";;
  911. esac
  912. $cat <<EOH
  913.  
  914. Some C compilers have problems with their optimizers, by default, $package
  915. compiles with the -O flag to use the optimizer.  Alternately, you might want to
  916. use the symbolic debugger, which uses the -g flag (on traditional Unix systems).
  917. Either flag can be specified here. To use neither flag, specify the word "none".
  918.  
  919. EOH
  920. rp="What optimizer/debugger flag should be used?"
  921. . myread
  922. optimize="$ans"
  923. case "$optimize" in
  924. 'none') optimize=" ";;
  925. esac
  926.  
  927. case "$ccflags" in
  928. '') case "$cc" in
  929.     *gcc*) dflt='-fpcc-struct-return';;
  930.     *) dflt='';;
  931.     esac
  932.     ;;
  933. *) dflt="$ccflags"
  934.     case "$cc" in
  935.     *gcc*) case "$dflt" in
  936.         *-fpcc-struct-return*) ;;
  937.         *) dflt="$dflt -fpcc-struct-return";;
  938.         esac;;
  939.     esac;;
  940. esac
  941.  
  942. case "$mips_type" in
  943. *BSD*) ;;
  944. '') ;;
  945. *) inclwanted="$inclwanted $usrinc/bsd";;
  946. esac
  947. for thisincl in $inclwanted; do
  948.     if $test -d $thisincl; then
  949.         if $test x$thisincl != x$usrinc; then
  950.             case "$dflt" in
  951.             *$thisincl*);;
  952.             *) dflt="$dflt -I$thisincl";;
  953.             esac
  954.         fi
  955.     fi
  956. done
  957.  
  958. case "$optimize" in
  959. -g*)
  960.     case "$dflt" in
  961.     *DEBUG*);;
  962.     *) dflt="$dflt -DDEBUG";;
  963.     esac
  964.     ;;
  965. esac
  966. if $contains 'LANGUAGE_C' $usrinc/signal.h >/dev/null 2>&1; then
  967.     case "$dflt" in
  968.     *LANGUAGE_C*);;
  969.     *) dflt="$dflt -DLANGUAGE_C";;
  970.     esac
  971. elif $contains 'LANGUAGE_C' $usrinc/sys/signal.h >/dev/null 2>&1; then
  972.     case "$dflt" in
  973.     *LANGUAGE_C*);;
  974.     *) dflt="$dflt -DLANGUAGE_C";;
  975.     esac
  976. fi
  977. if $contains '_NO_PROTO' $usrinc/signal.h >/dev/null 2>&1; then
  978.     case "$dflt" in
  979.     *_NO_PROTO*);;
  980.     *) dflt="$dflt -D_NO_PROTO";;
  981.     esac
  982. elif $contains '_NO_PROTO' $usrinc/sys/signal.h >/dev/null 2>&1; then
  983.     case "$dflt" in
  984.     *_NO_PROTO*);;
  985.     *) dflt="$dflt -D_NO_PROTO";;
  986.     esac
  987. fi
  988. case "$dflt" in
  989. '') dflt=none;;
  990. esac
  991. $cat <<EOH
  992.  
  993. Your C compiler may want other flags.  For this question you should include
  994. -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
  995. but you should NOT include libraries or ld flags like -lwhatever.  To use no
  996. flags, specify the word "none".
  997.  
  998. EOH
  999. set X $dflt
  1000. shift
  1001. dflt=${1+"$@"}
  1002. rp="Any additional cc flags?"
  1003. . myread
  1004. case "$ans" in
  1005. none) ans='';
  1006. esac
  1007. ccflags="$ans"
  1008.  
  1009. : the following weeds options from ccflags that are of no interest to cpp
  1010. cppflags="$ccflags"
  1011. case "$cc" in
  1012. *gcc*) cppflags="$cppflags -D__GNUC__";;
  1013. esac
  1014. case "$mips_type" in
  1015. '');;
  1016. *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
  1017. esac
  1018. case "$cppflags" in
  1019. '');;
  1020. *)  set X $cppflags
  1021.     cppflags=''
  1022.     for flag do
  1023.         case $flag in
  1024.         -D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
  1025.         esac
  1026.     done
  1027.     case "$cppflags" in
  1028.     *-*)  echo "(C preprocessor flags: $cppflags)";;
  1029.     esac
  1030.     ;;
  1031. esac
  1032.  
  1033. case "$ldflags" in
  1034. '') if venix; then
  1035.         dflt='-i -z'
  1036.     else
  1037.         dflt='none'
  1038.     fi
  1039.     ;;
  1040. *) dflt="$ldflags";;
  1041. esac
  1042. echo " "
  1043. rp="Any additional ld flags (NOT including libraries)?"
  1044. . myread
  1045. case "$ans" in
  1046. none) ans='';
  1047. esac
  1048. ldflags="$ans"
  1049. rmlist="$rmlist pdp11"
  1050.  
  1051. : check for ordering of bytes in a long
  1052. case "$byteorder" in
  1053. '')
  1054. $cat <<'EOM'
  1055.   
  1056. In the following, larger digits indicate more significance.  A big-endian
  1057. machine like a Pyramid or a Motorola 680?0 chip will come out to 4321.  A
  1058. little-endian machine like a Vax or an Intel 80?86 chip would be 1234.  Other
  1059. machines may have weird orders like 3412.  A Cray will report 87654321.  If
  1060. the test program works the default is probably right.
  1061. I'm now running the test program...
  1062. EOM
  1063.     $cat >try.c <<'EOCP'
  1064. #include <stdio.h>
  1065. main()
  1066. {
  1067.     int i;
  1068.     union {
  1069.     unsigned long l;
  1070.     char c[sizeof(long)];
  1071.     } u;
  1072.  
  1073.     if (sizeof(long) > 4)
  1074.     u.l = (0x08070605<<32) | 0x04030201;
  1075.     else
  1076.     u.l = 0x04030201;
  1077.     for (i=0; i < sizeof(long); i++)
  1078.     printf("%c",u.c[i]+'0');
  1079.     printf("\n");
  1080. }
  1081. EOCP
  1082.     if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
  1083.     dflt=`./try`
  1084.     case "$dflt" in
  1085.     ????|????????) echo "(The test program ran ok.)";;
  1086.     *) echo "(The test program didn't run right for some reason.)";;
  1087.     esac
  1088.     else
  1089.     dflt='4321'
  1090.     echo "(I can't seem to compile the test program.  Guessing big-endian...)"
  1091.     fi
  1092.     ;;
  1093. *)
  1094.     echo " "
  1095.     dflt="$byteorder"
  1096.     ;;
  1097. esac
  1098. rp="What is the order of bytes in a long?"
  1099. . myread
  1100. byteorder="$ans"
  1101. $rm -f try.c try
  1102.  
  1103. : Set private lib path
  1104. case "$plibpth" in
  1105. '') if mips; then
  1106.         plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
  1107.     else
  1108.         plibpth="/usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib"
  1109.     fi;;
  1110. esac
  1111. libpth="$plibpth $libpth"
  1112.  
  1113. : Looking for optional libraries
  1114. echo " "
  1115. echo "Checking for optional libraries..."
  1116. case "$libs" in
  1117. '') dflt='';;
  1118. *) dflt="$libs";;
  1119. esac
  1120. case "$libswanted" in
  1121. '') libswanted='c_s';;
  1122. esac
  1123. for thislib in $libswanted; do
  1124.     case "$thislib" in
  1125.     dbm) thatlib=ndbm;;
  1126.     *_s) thatlib=NONE;;
  1127.     *) thatlib="${thislib}_s";;
  1128.     *) thatlib=NONE;;
  1129.     esac
  1130.     yyy="$incpath/usr/ccs/lib $incpath/usr/lib $incpath/usr/ucblib"
  1131.     yyy="$yyy $incpath/usr/local/lib $incpath/lib"
  1132.     xxx=`loc lib$thislib.a X $yyy`
  1133.     if $test -f $xxx; then
  1134.         echo "Found -l$thislib."
  1135.         case "$dflt" in
  1136.         *-l$thislib*|*-l$thatlib*);;
  1137.         *) dflt="$dflt -l$thislib";;
  1138.         esac
  1139.     else
  1140.         xxx=`loc lib$thislib.a X $libpth`
  1141.         if $test -f $xxx; then
  1142.             echo "Found $xxx."
  1143.             case "$dflt" in
  1144.             *$xxx*);;
  1145.             *) dflt="$dflt $xxx";;
  1146.             esac
  1147.         else
  1148.             xxx=`loc Slib$thislib.a X $xlibpth`
  1149.             if $test -f $xxx; then
  1150.                 echo "Found -l$thislib."
  1151.                 case "$dflt" in
  1152.                 *-l$thislib*|*-l$thatlib*);;
  1153.                 *) dflt="$dflt -l$thislib";;
  1154.                 esac
  1155.             else
  1156.                 echo "No -l$thislib."
  1157.             fi
  1158.         fi
  1159.     fi
  1160. done
  1161. set X $dflt
  1162. shift
  1163. dflt="$*"
  1164. case "$libs" in
  1165. '') dflt="$dflt";;
  1166. *) dflt="$libs";;
  1167. esac
  1168. case "$dflt" in
  1169. '') dflt='none';;
  1170. esac
  1171.  
  1172. $cat <<EOM
  1173.  
  1174. Some versions of Unix support shared libraries, which make executables smaller
  1175. but make load time slightly longer.
  1176.  
  1177. On some systems, mostly newer Unix System V's, the shared library is included
  1178. by putting the option "-lc_s" as the last thing on the cc command line when
  1179. linking.  Other systems use shared libraries by default.  There may be other
  1180. libraries needed to compile $package on your machine as well.  If your system
  1181. needs the "-lc_s" option, include it here.  Include any other special libraries
  1182. here as well.  Say "none" for none.
  1183. EOM
  1184.  
  1185. echo " "
  1186. rp="Any additional libraries?"
  1187. . myread
  1188. case "$ans" in
  1189. none) ans='';
  1190. esac
  1191. libs="$ans"
  1192.  
  1193. : get list of predefined functions in a handy place
  1194. echo " "
  1195. case "$libc" in
  1196. '') libc=unknown;;
  1197. esac
  1198. case "$nm_opt" in
  1199. '') if $test -f /mach_boot; then
  1200.         nm_opt=''
  1201.     elif $test -d /usr/ccs/lib; then
  1202.         nm_opt='-p'
  1203.     else
  1204.         nm_opt=''
  1205.     fi;;
  1206. esac
  1207. libpth="$plibpth $libpth"
  1208. case "$libs" in
  1209. *-lc_s*) libc=`loc libc_s.a $libc $libpth`
  1210. esac
  1211. libnames='';
  1212. case "$libs" in
  1213. '') ;;
  1214. *)  for thislib in $libs; do
  1215.     case "$thislib" in
  1216.     -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
  1217.         try=`loc lib$thislib.a blurfl/dyick $libpth`
  1218.         if test ! -f $try; then
  1219.         try=`loc lib$thislib blurfl/dyick $libpth`
  1220.         if test ! -f $try; then
  1221.             try=`loc $thislib blurfl/dyick $libpth`
  1222.             if test ! -f $try; then
  1223.             try=`loc Slib$thislib.a blurfl/dyick $xlibpth`
  1224.             if test ! -f $try; then
  1225.                 try=''
  1226.             fi
  1227.             fi
  1228.         fi
  1229.         fi
  1230.         libnames="$libnames $try"
  1231.         ;;
  1232.     *) libnames="$libnames $thislib" ;;
  1233.     esac
  1234.     done
  1235.     ;;
  1236. esac
  1237. set /usr/ccs/lib/libc.so
  1238. $test -f $1 || set /usr/lib/libc.so
  1239. $test -f $1 || set /usr/lib/libc.so.[0-9]*
  1240. $test -f $1 || set /lib/libsys_s.a
  1241. eval set \$$#
  1242. if test -f "$1"; then
  1243.     echo "Your (shared) C library seems to be in $1."
  1244.     libc="$1"
  1245. elif test -f /lib/libc && test -f /lib/clib; then
  1246.     echo "Your C library seems to be in both /lib/clib and /lib/libc."
  1247.     libc='/lib/clib /lib/libc'
  1248.     if test -f /lib/syslib; then
  1249.         echo "(Your math library is in /lib/syslib.)"
  1250.         libc="$libc /lib/syslib"
  1251.     fi
  1252. elif test -f "$libc"; then
  1253.     echo "Your C library seems to be in $libc, as you said before."
  1254. elif test -f $incpath/usr/lib/libc.a; then
  1255.     libc=$incpath/usr/lib/libc.a;
  1256.     echo "Your C library seems to be in $libc.  That's fine."
  1257. elif test -f /lib/libc.a; then
  1258.     libc=/lib/libc.a;
  1259.     echo "Your C library seems to be in $libc.  You're normal."
  1260. else
  1261.     if ans=`./loc libc.a blurfl/dyick $libpth`; test -f "$ans"; then
  1262.         :
  1263.     elif ans=`./loc libc blurfl/dyick $libpth`; test -f "$ans"; then
  1264.         libnames="$libnames "`./loc clib blurfl/dyick $libpth`
  1265.     elif ans=`./loc clib blurfl/dyick $libpth`; test -f "$ans"; then
  1266.         :
  1267.     elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
  1268.         :
  1269.     elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
  1270.         :
  1271.     else
  1272.         ans=`./loc Llibc.a blurfl/dyick $xlibpth`
  1273.     fi
  1274.     if test -f "$ans"; then
  1275.         echo "Your C library seems to be in $ans, of all places."
  1276.         libc=$ans
  1277.     else
  1278.         libc='blurfl'
  1279.     fi
  1280. fi
  1281. if $test -f "$libc"; then
  1282.     dflt="$libc"
  1283.     cat <<EOM
  1284.  
  1285. If the guess above is wrong (which it might be if you're using a strange
  1286. compiler, or your machine supports multiple models), you can override it here.
  1287.  
  1288. EOM
  1289. else
  1290.     dflt=''
  1291.     echo $libpth | tr ' ' '\012' | sort | uniq > libpath
  1292.     cat <<EOM
  1293. I can't seem to find your C library.  I've looked in the following places:
  1294.  
  1295. EOM
  1296.     $sed 's/^/    /' libpath
  1297.     cat <<EOM
  1298.  
  1299. None of these seems to contain your C library. I need to get its name...
  1300.  
  1301. EOM
  1302. fi
  1303. cont=true
  1304. while $test "$cont"; do
  1305.     rp="Where is your C library?"
  1306.     . myread
  1307.     libc="$ans"
  1308.     if $test -f "$libc"; then
  1309.         cont=''
  1310.     else
  1311.         case "$fastread" in
  1312.         yes) dflt=y;;
  1313.         *) dflt=n;;
  1314.         esac
  1315.         rp="File $libc does not exist. Use that name anyway?"
  1316.         . myread
  1317.         case "$ans" in
  1318.         y*) cont='';;
  1319.         esac
  1320.         dflt=''
  1321.     fi
  1322. done
  1323. echo " "
  1324. echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
  1325. set X `cat libnames`
  1326. shift
  1327. xxx=files
  1328. case $# in 1) xxx=file; esac
  1329. echo "Extracting names from the following $xxx for later perusal:"
  1330. echo " "
  1331. $sed 's/^/    /' libnames
  1332. echo " "
  1333. $echo $n "This may take a while...$c"
  1334. nm $nm_opt $* 2>/dev/null >libc.tmp
  1335. $echo $n ".$c"
  1336. $grep fprintf libc.tmp > libc.ptf
  1337. xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c"'
  1338. xrun='eval "<libc.tmp $com >libc.list"; echo "done"'
  1339. if com="$sed -n -e 's/^.* [ADTS]  *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
  1340.     eval $xscan;\
  1341.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1342.         eval $xrun
  1343. elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
  1344.     eval $xscan;\
  1345.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1346.         eval $xrun
  1347. elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
  1348.     eval $xscan;\
  1349.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1350.         eval $xrun
  1351. elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
  1352.     eval $xscan;\
  1353.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1354.         eval $xrun
  1355. elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
  1356.     eval $xscan;\
  1357.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1358.         eval $xrun
  1359. elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
  1360.     eval $xscan;\
  1361.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1362.         eval $xrun
  1363. elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
  1364.                 -e '/ file/d' -e 's/^\([^     ]*\).*/\1/p'";\
  1365.     eval $xscan;\
  1366.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1367.         eval $xrun
  1368. elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
  1369.     eval $xscan;\
  1370.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1371.         eval $xrun
  1372. elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
  1373.     eval $xscan;\
  1374.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1375.         eval $xrun
  1376. else
  1377.     nm -p $* 2>/dev/null >libc.tmp
  1378.     com="$sed -n -e 's/^.* [ADTS]  *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
  1379.     eval "<libc.tmp $com >libc.list"
  1380.     if $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1381.         nm_opt='-p'
  1382.         echo "done"
  1383.     else
  1384.         echo " "
  1385.         echo "nm didn't seem to work right. Trying ar instead..."
  1386.         com=''
  1387.         if ar t $libc > libc.tmp; then
  1388.             for thisname in $libnames; do
  1389.                 ar t $thisname >>libc.tmp
  1390.             done
  1391.             $sed -e 's/\.o$//' < libc.tmp > libc.list
  1392.             echo "Ok."
  1393.         else
  1394.             echo "ar didn't seem to work right."
  1395.             echo "Maybe this is a Cray...trying bld instead..."
  1396.             if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
  1397.                 for thisname in $libnames; do
  1398.                     bld t $libnames | \
  1399.                     $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
  1400.                     ar t $thisname >>libc.tmp
  1401.                 done
  1402.                 echo "Ok."
  1403.             else
  1404.                 echo "That didn't work either.  Giving up."
  1405.                 exit 1
  1406.             fi
  1407.         fi
  1408.     fi
  1409. fi
  1410. nm_extract="$com"
  1411. if test -f /lib/syscalls.exp; then
  1412.     echo " "
  1413.     echo "Also extracting names from /lib/syscalls.exp for good ole AIX..."
  1414.     $sed -n 's/^\([^     ]*\)[     ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
  1415. fi
  1416. $rm -f libnames libpath
  1417.  
  1418. : set up the script used to warn in case of inconsistency
  1419. cat <<'EOSC' >whoa
  1420. dflt=y
  1421. echo ' '
  1422. echo "*** WHOA THERE!!! ***"
  1423. echo "    The $hint value for \$$var on this machine was \"$was\"!"
  1424. rp="    Keep the $hint value?"
  1425. . myread
  1426. case "$ans" in
  1427. y) td=$was; tu=$was;;
  1428. esac
  1429. EOSC
  1430.  
  1431. : define an is-in-libc? function
  1432. inlibc='echo " "; td=$define; tu=$undef;
  1433. var=$2; eval "was=\$$2";
  1434. if $contains "^$1\$" libc.list >/dev/null 2>&1;
  1435. then echo "$1() found.";
  1436.     eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
  1437. else echo "$1() not found.";
  1438.     eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi'
  1439.  
  1440. : see if getopt exists
  1441. set getopt d_getopt
  1442. eval $inlibc
  1443.  
  1444. : function used to set $1 to $val
  1445. setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
  1446. case "$val$was" in
  1447. $define$undef) . whoa; eval "$var=\$td";;
  1448. $undef$define) . whoa; eval "$var=\$tu";;
  1449. *) eval "$var=$val";;
  1450. esac'
  1451.  
  1452. : see which of string.h or strings.h is needed
  1453. echo " "
  1454. strings=`loc string.h "" $usrinc $inclwanted`
  1455. val="$undef"
  1456. if $test -r "$strings"; then
  1457.     echo "Using <string.h> instead of <strings.h>."
  1458.     if bsd; then
  1459.         echo "(Actually, this looks more like it were an USG system)"
  1460.     fi
  1461.     val="$define"
  1462. else
  1463.     strings=`loc strings.h "" $usrinc $inclwanted`
  1464.     if $test -r "$strings"; then
  1465.         echo "Using <strings.h> instead of <string.h>."
  1466.         if usg; then
  1467.             echo "(Actually, this looks more like it were a BSD system)"
  1468.         fi
  1469.     else
  1470.         echo "No string header found--You'll surely have problems."
  1471.     fi
  1472. fi
  1473. set i_string
  1474. eval $setvar
  1475.  
  1476. : index or strchr
  1477. echo " "
  1478. case "$d_index" in
  1479. n) dflt=n;;
  1480. *) dflt=y;;
  1481. esac
  1482. if $contains '^index$' libc.list >/dev/null 2>&1 ; then
  1483.     if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
  1484.         if $contains strchr "$strings" >/dev/null 2>&1 ; then
  1485.             if $contains index "$strings" >/dev/null 2>&1 ; then
  1486.                 echo "Your system has both index() and strchr()."
  1487.                 rp="Shall I use index() rather than strchr()?"
  1488.                 . myread
  1489.                 case "$ans" in
  1490.                     n*) val="$define" ;;
  1491.                     *)  val="$undef" ;;
  1492.                 esac
  1493.             else
  1494.                 val="$define"
  1495.                 echo "strchr() found."
  1496.             fi
  1497.         else
  1498.             val="$undef"
  1499.             echo "index() found."
  1500.         fi
  1501.     else
  1502.         val="$undef"
  1503.         echo "index() found."
  1504.     fi
  1505. else
  1506.     if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
  1507.         val="$define"
  1508.         echo "strchr() found."
  1509.     else
  1510.         echo "No index() or strchr() found!"
  1511.         val="$undef"
  1512.     fi
  1513. fi
  1514. set d_index
  1515. eval $setvar
  1516.  
  1517. : see if memcpy exists
  1518. set memcpy d_memcpy
  1519. eval $inlibc
  1520.  
  1521. : see if memset exists
  1522. set memset d_memset
  1523. eval $inlibc
  1524.  
  1525. : see how we invoke the C preprocessor
  1526. echo " "
  1527. echo "Now, how can we feed standard input to your C preprocessor..."
  1528. cat <<'EOT' >testcpp.c
  1529. #define ABC abc
  1530. #define XYZ xyz
  1531. ABC.XYZ
  1532. EOT
  1533. cd ..
  1534. echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
  1535. chmod 755 cppstdin
  1536. wrapper=`pwd`/cppstdin
  1537. cd UU
  1538. if test "X$cppstdin" != "X" && \
  1539.     $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
  1540.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1541.     echo "You used to use $cppstdin $cppminus so we'll use that again."
  1542. elif test "$cc" = gcc && \
  1543.     (echo "Using gcc, eh?  We'll try to force gcc -E using a wrapper..."; \
  1544.     $wrapper <testcpp.c >testcpp.out 2>&1; \
  1545.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
  1546.     echo "Yup, we can."
  1547.     cppstdin="$wrapper"
  1548.     cppminus='';
  1549. elif echo 'Maybe "'"$cc"' -E" will work...'; \
  1550.     $cc -E <testcpp.c >testcpp.out 2>&1; \
  1551.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1552.     echo "Yup, it does."
  1553.     cppstdin="$cc -E"
  1554.     cppminus='';
  1555. elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
  1556.     $cc -E - <testcpp.c >testcpp.out 2>&1; \
  1557.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1558.     echo "Yup, it does."
  1559.     cppstdin="$cc -E"
  1560.     cppminus='-';
  1561. elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
  1562.     $wrapper <testcpp.c >testcpp.out 2>&1; \
  1563.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1564.     cppstdin="$wrapper"
  1565.     cppminus=''
  1566.     echo "Eureka!"
  1567. elif echo 'No such luck, maybe "'$cpp'" will work...'; \
  1568.     $cpp <testcpp.c >testcpp.out 2>&1; \
  1569.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1570.     echo "It works!"
  1571.     cppstdin="$cpp"
  1572.     cppminus='';
  1573. elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
  1574.     $cpp - <testcpp.c >testcpp.out 2>&1; \
  1575.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1576.     echo "Hooray, it works!  I was beginning to wonder."
  1577.     cppstdin="$cpp"
  1578.     cppminus='-';
  1579. elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
  1580.     $cc -P <testcpp.c >testcpp.out 2>&1; \
  1581.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1582.     echo "Yipee, that works!"
  1583.     cppstdin="$cc -P"
  1584.     cppminus='';
  1585. elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
  1586.     $cc -P - <testcpp.c >testcpp.out 2>&1; \
  1587.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1588.     echo "At long last!"
  1589.     cppstdin="$cc -P"
  1590.     cppminus='-';
  1591. else
  1592.     dflt=''
  1593.     rp="No dice.  I can't find a C preprocessor.  Name one:"
  1594.     . myread
  1595.     cppstdin="$ans"
  1596.     $cppstdin <testcpp.c >testcpp.out 2>&1
  1597.     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1598.         echo "OK, that will do."
  1599.     else
  1600.         echo "Sorry, I can't get that to work.  Go find one and rerun Configure."
  1601.         exit 1
  1602.     fi
  1603. fi
  1604. $rm -f testcpp.c testcpp.out
  1605.  
  1606. : get C preprocessor symbols handy
  1607. echo " "
  1608. echo $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know
  1609. $cat <<EOSS >Cppsym
  1610. $startsh
  1611. case "\$1" in
  1612. -l) list=true
  1613.     shift
  1614.     ;;
  1615. esac
  1616. unknown=''
  1617. case "\$list\$#" in
  1618. 1|2)
  1619.     for sym do
  1620.     if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  1621.         exit 0
  1622.     elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  1623.         :
  1624.     else
  1625.         unknown="\$unknown \$sym"
  1626.     fi
  1627.     done
  1628.     set X \$unknown
  1629.     shift
  1630.     ;;
  1631. esac
  1632. case \$# in
  1633. 0) exit 1;;
  1634. esac
  1635. echo \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\
  1636. #ifdef \1\\
  1637. exit 0; _ _ _ _\1\\     \1\\
  1638. #endif\\
  1639. /' >Cppsym\$\$
  1640. echo exit 1 >>Cppsym\$\$
  1641. $cppstdin $cppminus <Cppsym\$\$ >Cppsym2\$\$
  1642. case "\$list" in
  1643. true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
  1644. *)
  1645.     sh Cppsym2\$\$
  1646.     status=\$?
  1647.     ;;
  1648. esac
  1649. $rm -f Cppsym\$\$ Cppsym2\$\$
  1650. exit \$status
  1651. EOSS
  1652. chmod +x Cppsym
  1653. $eunicefix Cppsym
  1654. echo "Your C preprocessor defines the following symbols:"
  1655. Cppsym -l $attrlist >Cppsym.true
  1656. $cat Cppsym.true
  1657. rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
  1658.  
  1659. : see if this is a termio system
  1660. val="$undef"
  1661. val2="$undef"
  1662. val3="$undef"
  1663. if $test -r $usrinc/termios.h ; then
  1664.     set tcsetattr i_termios
  1665.     eval $inlibc
  1666.     val3="$i_termios"
  1667. fi
  1668. echo " "
  1669. case "$val3" in
  1670. "$define") echo "You have POSIX termios.h... good!";;
  1671. *) if Cppsym pyr; then
  1672.         case "`bin/universe`" in
  1673.         ucb) if $test -r $usrinc/sgtty.h; then
  1674.                 val2="$define"
  1675.                 echo "<sgtty.h> found."
  1676.             else
  1677.                 echo "System is pyramid with BSD universe."
  1678.                 echo "<sgtty.h> not found--you could have problems."
  1679.             fi;;
  1680.         *) if $test -r $usrinc/termio.h; then
  1681.                 val="$define"
  1682.                 echo "<termio.h> found."
  1683.             else
  1684.                 echo "System is pyramid with USG universe."
  1685.                 echo "<termio.h> not found--you could have problems."
  1686.             fi;;
  1687.         esac
  1688.     elif usg; then
  1689.         if $test -r $usrinc/termio.h ; then
  1690.             echo "<termio.h> found."
  1691.             val="$define"
  1692.         elif $test -r $usrinc/sgtty.h ; then
  1693.             echo "<sgtty.h> found."
  1694.             val2="$define"
  1695.         else
  1696.             echo "Neither <termio.h> nor <sgtty.h> found--you could have problems."
  1697.         fi
  1698.     else
  1699.         if $test -r $usrinc/sgtty.h ; then
  1700.             echo "<sgtty.h> found."
  1701.             val2="$define"
  1702.         elif $test -r $usrinc/termio.h ; then
  1703.             echo "<termio.h> found."
  1704.             val="$define"
  1705.         else
  1706.             echo "Neither <sgtty.h> nor <termio.h> found--you could have problems."
  1707.         fi
  1708.     fi;;
  1709. esac
  1710. set i_termio; eval $setvar
  1711. val=$val2; set i_sgtty; eval $setvar
  1712. val=$val3; set i_termios; eval $setvar
  1713.  
  1714. : see if ioctl defs are in sgtty/termio or sys/ioctl
  1715. echo " "
  1716. if $test -r $usrinc/sys/ioctl.h ; then
  1717.     val="$define"
  1718.     echo "<sys/ioctl.h> found."
  1719. else
  1720.     val="$undef"
  1721.     $test $i_termio = "$define" && xxx="termio.h"
  1722.     $test $i_termios = "$define" && xxx="termios.h"
  1723.     $test $i_sgtty = "$define" && xxx="sgtty.h"
  1724.     echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>."
  1725. fi
  1726. set i_sysioctl
  1727. eval $setvar
  1728.  
  1729. : see if signal is declared as pointer to function returning int or void
  1730. echo " "
  1731. $cppstdin $cppminus $cppflags < $usrinc/signal.h >$$.tmp
  1732. if $contains 'int.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  1733.     echo "You have int (*signal())() instead of void."
  1734.     val="$undef"
  1735.     signal_t="int"
  1736. elif $contains 'void.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  1737.     echo "You have void (*signal())() instead of int."
  1738.     val="$define"
  1739.     signal_t="void"
  1740. elif $contains 'extern[     ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
  1741.     echo "You have int (*signal())() instead of void."
  1742.     val="$undef"
  1743.     signal_t="int"
  1744. else
  1745.     case "$d_voidsig" in
  1746.     '') echo "I can't determine whether signal handler returns void or int..."
  1747.         dflt=void
  1748.         rp="What type does your signal handler returns?"
  1749.         . myread
  1750.         case "$ans" in
  1751.         void) val="$define"; signal_t="void";;
  1752.         *) val="$undef"; signal_t="int";;
  1753.         esac;;
  1754.     *) echo "As you already told me, signal handler returns $signal_t.";;
  1755.     esac
  1756. fi
  1757. set d_voidsig
  1758. eval $setvar
  1759. $rm -f $$.tmp
  1760.  
  1761. : check for void type
  1762. echo " "
  1763. $cat <<EOM
  1764. Checking to see how well your C compiler groks the void type...
  1765.  
  1766.   Support flag bits are:
  1767.     1: basic void declarations.
  1768.     2: arrays of pointers to functions returning void.
  1769.     4: operations between pointers to and addresses of void functions.
  1770.     8: generic void pointers.
  1771.  
  1772. EOM
  1773. case "$voidflags" in
  1774. '')
  1775.     $cat >try.c <<'EOCP'
  1776. #if TRY & 1
  1777. void main() {
  1778. #else
  1779. main() {
  1780. #endif
  1781.     extern void moo();    /* function returning void */
  1782.     void (*goo)();        /* ptr to func returning void */
  1783. #if TRY & 8
  1784.     void *hue;        /* generic ptr */
  1785. #endif
  1786. #if TRY & 2
  1787.     void (*foo[10])();
  1788. #endif
  1789.  
  1790. #if TRY & 4
  1791.     if(goo == moo) {
  1792.         exit(0);
  1793.     }
  1794. #endif
  1795.     exit(0);
  1796. }
  1797. EOCP
  1798.     if $cc -S -DTRY=$defvoidused try.c >.out 2>&1 ; then
  1799.         voidflags=$defvoidused
  1800.     echo "It appears to support void to the level $package wants ($defvoidused)."
  1801.         if $contains warning .out >/dev/null 2>&1; then
  1802.             echo "However, you might get some warnings that look like this:"
  1803.             $cat .out
  1804.         fi
  1805.     else
  1806.         echo "Hmm, your compiler has some difficulty with void.  Checking further..."
  1807.         if $cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
  1808.             echo "It supports 1..."
  1809.             if $cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
  1810.                 echo "It also supports 2..."
  1811.                 if $cc -S -DTRY=7 try.c >/dev/null 2>&1 ; then
  1812.                     voidflags=7
  1813.                     echo "And it supports 4 but not 8 definitely."
  1814.                 else
  1815.                     echo "It doesn't support 4..."
  1816.                     if $cc -S -DTRY=11 try.c >/dev/null 2>&1 ; then
  1817.                         voidflags=11
  1818.                         echo "But it supports 8."
  1819.                     else
  1820.                         voidflags=3
  1821.                         echo "Neither does it support 8."
  1822.                     fi
  1823.                 fi
  1824.             else
  1825.                 echo "It does not support 2..."
  1826.                 if $cc -S -DTRY=13 try.c >/dev/null 2>&1 ; then
  1827.                     voidflags=13
  1828.                     echo "But it supports 4 and 8."
  1829.                 else
  1830.                     if $cc -S -DTRY=5 try.c >/dev/null 2>&1 ; then
  1831.                         voidflags=5
  1832.                         echo "And it supports 4 but has not heard about 8."
  1833.                     else
  1834.                         echo "However it supports 8 but not 4."
  1835.                     fi
  1836.                 fi
  1837.             fi
  1838.         else
  1839.             echo "There is no support at all for void."
  1840.             voidflags=0
  1841.         fi
  1842.     fi
  1843. esac
  1844. dflt="$voidflags";
  1845. rp="Your void support flags add up to what?"
  1846. . myread
  1847. voidflags="$ans"
  1848. $rm -f try.* .out
  1849.  
  1850. : preserve RCS keywords in files with variable substitution, grrr
  1851. Id='$Id'
  1852. Log='$Log'
  1853.  
  1854. : determine where public executables go
  1855. case "$bin" in
  1856. '')
  1857.     dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
  1858.     ;;
  1859. *)  dflt="$bin"
  1860.     ;;
  1861. esac
  1862. cont=true
  1863. while $test "$cont" ; do
  1864.     echo " "
  1865.     rp="Where do you want to put the public executables? (~name ok)"
  1866.     . myread
  1867.     bin="$ans"
  1868.     bin=`filexp $bin`
  1869.     if test -d $bin; then
  1870.     cont=''
  1871.     else
  1872.     dflt=n
  1873.     rp="Directory $bin doesn't exist.  Use that name anyway?"
  1874.     . myread
  1875.     dflt=''
  1876.     case "$ans" in
  1877.     y*) cont='';;
  1878.     esac
  1879.     fi
  1880. done
  1881.  
  1882. : see if we need -o option for tar
  1883. echo " "
  1884. case "$d_taropt_o" in
  1885. '') if $test -f "$tar"; then
  1886.         if $tar -cf - /dev/null 2>/dev/null | $tar -xof - >/dev/null 2>&1; then
  1887.             val="$define"
  1888.         else
  1889.             val="$undef"
  1890.         fi
  1891.     else
  1892.         val="$undef"
  1893.     fi;;
  1894. *) val="$d_taropt_o";;
  1895. esac
  1896. case "$val" in
  1897. "$define") echo "I'll use the -o option with tar upon archive extraction.";;
  1898. *) echo "Your tar does not seem to support the -o option. I'll ignore it then.";;
  1899. esac
  1900. set d_taropt_o
  1901. eval $setvar
  1902.  
  1903. : determine default editor
  1904. case "$defeditor" in
  1905. '')
  1906.     case "$_vi" in
  1907.     */*) dflt="$_vi";;
  1908.     *) dflt=/usr/ucb/vi;;
  1909.     esac
  1910.     ;;
  1911. *)  dflt="$defeditor"
  1912.     ;;
  1913. esac
  1914. cont=true
  1915. while $test "$cont" ; do
  1916.     echo " "
  1917.     rp="What is the default editor on your system?"
  1918.     . myread
  1919.     defeditor="$ans"
  1920.     if test -f $ans; then
  1921.         cont=''
  1922.     else
  1923.         dflt=n
  1924.         rp="File $ans doesn't exist.  Use that name anyway?"
  1925.         . myread
  1926.         dflt=''
  1927.         case "$ans" in
  1928.         y*) cont='';;
  1929.         esac
  1930.     fi
  1931. done
  1932.  
  1933. : determine the name of a reasonable mailer
  1934. case "$mailer" in
  1935. '')
  1936.     if $test -f "$sendmail"; then
  1937.         dflt="$sendmail"
  1938.     elif $test -f "$rmail"; then
  1939.         dflt="$rmail"
  1940.     elif $test -f /bin/mail; then
  1941.         dflt=/bin/mail
  1942.     else
  1943.         dflt=$mail
  1944.     fi
  1945.     ;;
  1946. *)  dflt="$mailer";;
  1947. esac
  1948. cont=true
  1949. while $test "$cont" ; do
  1950.     cat <<EOM
  1951.  
  1952. I need the full pathname of the program used to deliver mail on your system.
  1953. A typical answer would be /usr/lib/sendmail or /bin/rmail, but you may choose
  1954. any other program, as long as $package can feed its standard input.
  1955.  
  1956. EOM
  1957.     rp="Mail transport agent to be used?"
  1958.     . myread
  1959.     mailer="$ans"
  1960.     if test -f $ans; then
  1961.         cont=''
  1962.     else
  1963.         dflt=n
  1964.         rp="File $ans doesn't exist.  Use that name anyway?"
  1965.         . myread
  1966.         dflt=''
  1967.         case "$ans" in
  1968.         y*) cont='';;
  1969.         esac
  1970.     fi
  1971. done
  1972.  
  1973. : determine where manual pages go
  1974. $cat <<EOM
  1975.  
  1976. $package has manual pages available in source form.
  1977. EOM
  1978. case "$nroff" in
  1979. nroff)
  1980.     echo "However, you don't have nroff, so they're probably useless to you."
  1981.     case "$mansrc" in
  1982.     '') mansrc="none";;
  1983.     esac;;
  1984. esac
  1985. echo "If you don't want the manual sources installed, answer 'none'."
  1986. case "$mansrc" in
  1987. '')
  1988.     dflt="$sysman"
  1989.     ;;
  1990. *)  dflt="$mansrc"
  1991.     ;;
  1992. esac
  1993. cont=true
  1994. while $test "$cont" ; do
  1995.     echo " "
  1996.     rp="Where do the manual pages (source) go? (~name ok)"
  1997.     . myread
  1998.     case "$ans" in
  1999.     'none') mansrc=''
  2000.         cont='';;
  2001.     *)
  2002.         mansrc=`filexp "$ans"`
  2003.         if test -d "$mansrc"; then
  2004.             cont=''
  2005.         else
  2006.             dflt=n
  2007.             rp="Directory $mansrc doesn't exist.  Use that name anyway?"
  2008.             . myread
  2009.             dflt=''
  2010.             case "$ans" in
  2011.             y*) cont='';;
  2012.             esac
  2013.         fi;;
  2014.     esac
  2015. done
  2016. case "$mansrc" in
  2017. '') manext='0';;
  2018. *l) manext=l;;
  2019. *n) manext=n;;
  2020. *o) manext=l;;
  2021. *p) manext=n;;
  2022. *C) manext=C;;
  2023. *L) manext=L;;
  2024. *) manext=1;;
  2025. esac
  2026.  
  2027. : decide how portable to be
  2028. case "$d_portable" in
  2029. "$define") dflt=y;;
  2030. *)    dflt=n;;
  2031. esac
  2032. $cat <<'EOH'
  2033.  
  2034. I can set things up so that your shell scripts and binaries are more portable,
  2035. at what may be a noticable cost in performance.  In particular, if you
  2036. ask to be portable, the following happens:
  2037.  
  2038.      1) Shell scripts will rely on the PATH variable rather than using
  2039.     the paths derived above.
  2040.      2) ~username interpretations will be done at run time rather than
  2041.     by Configure.
  2042.  
  2043. EOH
  2044. rp="Do you expect to run these scripts and binaries on multiple machines?"
  2045. . myread
  2046. case "$ans" in
  2047.     y*) d_portable="$define"
  2048.     for file in $loclist; do
  2049.         eval $file=$file
  2050.     done
  2051.     ;;
  2052.     *)  d_portable="$undef" ;;
  2053. esac
  2054.  
  2055. : determine where private executables go
  2056. case "$privlib" in
  2057. '')
  2058.     dflt=/usr/lib/$package
  2059.     test -d /usr/local/lib && dflt=/usr/local/lib/$package
  2060.     ;;
  2061. *)  dflt="$privlib"
  2062.     ;;
  2063. esac
  2064. $cat <<EOM
  2065.  
  2066. The $package package has some auxiliary files that should be put in a library
  2067. that is accessible by everyone.  Where do you want to put these "private" but
  2068. accessible files?
  2069.  
  2070. EOM
  2071. rp="Private library path? (~name ok)"
  2072. . myread
  2073. privlib="$ans"
  2074. case "$d_portable" in
  2075. "$undef")
  2076.     privlib=`filexp $privlib`
  2077.     ;;
  2078. esac
  2079.  
  2080. : determine where public executables go
  2081. case "$scriptdir" in
  2082. '')
  2083.     dflt="$bin"
  2084.     : guess some guesses
  2085.     $test -d /usr/share/scripts && dflt=/usr/share/scripts
  2086.     $test -d /usr/share/bin && dflt=/usr/share/bin
  2087.     ;;
  2088. *)  dflt="$scriptdir"
  2089.     ;;
  2090. esac
  2091. cont=true
  2092. $cat <<EOM
  2093.  
  2094. Some installations have a separate directory just for executable scripts so
  2095. that they can mount it across multiple architectures but keep the scripts in
  2096. one spot.  You might, for example, have a subdirectory of /usr/share for this.
  2097. Or you might just lump your scripts in with all your other executables.
  2098.  
  2099. EOM
  2100. while $test "$cont" ; do
  2101.     rp="Where do you keep publicly executable scripts? (~name ok)"
  2102.     . myread
  2103.     scriptdir="$ans"
  2104.     scriptdir=`./filexp "$scriptdir"`
  2105.     if $test -d $scriptdir; then
  2106.     cont=''
  2107.     else
  2108.     case "$fastread" in
  2109.     yes) dflt=y;;
  2110.     *) dflt=n;;
  2111.     esac
  2112.     rp="Directory $scriptdir doesn't exist.  Use that name anyway?"
  2113.     . myread
  2114.     dflt=''
  2115.     case "$ans" in
  2116.     y*) cont='';;
  2117.     esac
  2118.     fi
  2119. done
  2120.  
  2121. echo " "
  2122. echo "End of configuration questions."
  2123. echo " "
  2124.  
  2125. : create config.sh file
  2126. echo " "
  2127. if test -d ../UU; then
  2128.     cd ..
  2129. fi
  2130. echo "Creating config.sh..."
  2131. $spitshell <<EOT >config.sh
  2132. $startsh
  2133. #
  2134. # This file was produced by running the Configure script. It holds all the
  2135. # definitions figured out by Configure. Should you modify one of these values,
  2136. # do not forget to propagate your changes by running "Configure -d". You may
  2137. # instead choose to run each of the .SH files by yourself.
  2138. #
  2139.  
  2140. d_eunice='$d_eunice'
  2141. d_xenix='$d_xenix'
  2142. d_bsd='$d_bsd'
  2143. define='$define'
  2144. eunicefix='$eunicefix'
  2145. Mcc='$Mcc'
  2146. awk='$awk'
  2147. bison='$bison'
  2148. cat='$cat'
  2149. chgrp='$chgrp'
  2150. chmod='$chmod'
  2151. chown='$chown'
  2152. compress='$compress'
  2153. cp='$cp'
  2154. cpio='$cpio'
  2155. cpp='$cpp'
  2156. csh='$csh'
  2157. date='$date'
  2158. echo='$echo'
  2159. egrep='$egrep'
  2160. emacs='$emacs'
  2161. expr='$expr'
  2162. grep='$grep'
  2163. inews='$inews'
  2164. less='$less'
  2165. line='$line'
  2166. lint='$lint'
  2167. ln='$ln'
  2168. lp='$lp'
  2169. lpr='$lpr'
  2170. ls='$ls'
  2171. mail='$mail'
  2172. mailx='$mailx'
  2173. make='$make'
  2174. mkdir='$mkdir'
  2175. more='$more'
  2176. mv='$mv'
  2177. nroff='$nroff'
  2178. perl='$perl'
  2179. pg='$pg'
  2180. pmake='$pmake'
  2181. pr='$pr'
  2182. rm='$rm'
  2183. rmail='$rmail'
  2184. sed='$sed'
  2185. sendmail='$sendmail'
  2186. sleep='$sleep'
  2187. smail='$smail'
  2188. sort='$sort'
  2189. submit='$submit'
  2190. tail='$tail'
  2191. tar='$tar'
  2192. tbl='$tbl'
  2193. test='$test'
  2194. touch='$touch'
  2195. tr='$tr'
  2196. troff='$troff'
  2197. uname='$uname'
  2198. uniq='$uniq'
  2199. uuname='$uuname'
  2200. vi='$vi'
  2201. zcat='$zcat'
  2202. Author='$Author'
  2203. Date='$Date'
  2204. Header='$Header'
  2205. Id='$Id'
  2206. Locker='$Locker'
  2207. Log='$Log'
  2208. RCSfile='$RCSfile'
  2209. Revision='$Revision'
  2210. Source='$Source'
  2211. State='$State'
  2212. bin='$bin'
  2213. byteorder='$byteorder'
  2214. cc='$cc'
  2215. ccflags='$ccflags'
  2216. ldflags='$ldflags'
  2217. cppflags='$cppflags'
  2218. optimize='$optimize'
  2219. contains='$contains'
  2220. cppstdin='$cppstdin'
  2221. cppminus='$cppminus'
  2222. d_getopt='$d_getopt'
  2223. d_index='$d_index'
  2224. d_memcpy='$d_memcpy'
  2225. d_memset='$d_memset'
  2226. d_portable='$d_portable'
  2227. d_voidsig='$d_voidsig'
  2228. signal_t='$signal_t'
  2229. defeditor='$defeditor'
  2230. i_string='$i_string'
  2231. strings='$strings'
  2232. i_sysioctl='$i_sysioctl'
  2233. i_bsdioctl='$i_bsdioctl'
  2234. i_syssockio='$i_syssockio'
  2235. d_voidtty='$d_voidtty'
  2236. i_termio='$i_termio'
  2237. i_sgtty='$i_sgtty'
  2238. i_termios='$i_termios'
  2239. libc='$libc'
  2240. nm_opt='$nm_opt'
  2241. libpth='$libpth'
  2242. plibpth='$plibpth'
  2243. libs='$libs'
  2244. mailer='$mailer'
  2245. mansrc='$mansrc'
  2246. manext='$manext'
  2247. n='$n'
  2248. c='$c'
  2249. package='$package'
  2250. privlib='$privlib'
  2251. scriptdir='$scriptdir'
  2252. spitshell='$spitshell'
  2253. shsharp='$shsharp'
  2254. sharpbang='$sharpbang'
  2255. startsh='$startsh'
  2256. sysman='$sysman'
  2257. usrinc='$usrinc'
  2258. mips='$mips'
  2259. incpath='$incpath'
  2260. mips_type='$mips_type'
  2261. voidflags='$voidflags'
  2262. defvoidused='$defvoidused'
  2263. d_taropt_o='$d_taropt_o'
  2264. EOT
  2265.  
  2266. : add special variables
  2267. test -f patchlevel.h && \
  2268. awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
  2269. echo "CONFIG=true" >>config.sh
  2270.  
  2271. : propagate old symbols
  2272. if test -f UU/config.sh; then
  2273.     <UU/config.sh sort | uniq >UU/oldconfig.sh
  2274.     sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
  2275.     sort | uniq -u >UU/oldsyms
  2276.     set X `cat UU/oldsyms`
  2277.     shift
  2278.     case $# in
  2279.     0) ;;
  2280.     *)    echo "Hmm...You had some extra variables I don't know about...I'll try to keep 'em..."
  2281.     for sym in `cat UU/oldsyms`; do
  2282.         echo "    Propagating $hint variable "'$'"$sym..."
  2283.         eval 'tmp="$'"${sym}"'"'
  2284.         echo "$tmp" | \
  2285.         sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
  2286.     done
  2287.     ;;
  2288.     esac
  2289. fi
  2290.  
  2291. : Finish up
  2292. CONFIG=true
  2293.  
  2294. echo " "
  2295. dflt=''
  2296. echo "If you didn't make any mistakes, then just type a carriage return here."
  2297. rp="If you need to edit config.sh, do it as a shell escape here:"
  2298. . UU/myread
  2299. case "$ans" in
  2300. '') ;;
  2301. *) : in case they cannot read
  2302.     eval $ans;;
  2303. esac
  2304. . ./config.sh
  2305.  
  2306. echo " "
  2307. echo "Doing variable substitutions on .SH files..."
  2308. if test -f MANIFEST; then
  2309.     set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
  2310. else
  2311.     set x `find . -name "*.SH" -print`
  2312. fi
  2313. shift
  2314. case $# in
  2315. 0) set x *.SH; shift;;
  2316. esac
  2317. if test ! -f $1; then
  2318.     shift
  2319. fi
  2320. for file in $*; do
  2321.     case "$file" in
  2322.     */*)
  2323.     dir=`$expr X$file : 'X\(.*\)/'`
  2324.     file=`$expr X$file : 'X.*/\(.*\)'`
  2325.     (cd $dir && . $file)
  2326.     ;;
  2327.     *)
  2328.     . $file
  2329.     ;;
  2330.     esac
  2331. done
  2332. if test -f config.h.SH; then
  2333.     if test ! -f config.h; then
  2334.     : oops, they left it out of MANIFEST, probably, so do it anyway.
  2335.     . config.h.SH
  2336.     fi
  2337. fi
  2338.  
  2339. if $contains '^depend:' Makefile >/dev/null 2>&1; then
  2340.     dflt=n
  2341.     $cat <<EOM
  2342.  
  2343. Now you need to generate make dependencies by running "make depend".
  2344. You might prefer to run it in background: "make depend > makedepend.out &"
  2345. It can take a while, so you might not want to run it right now.
  2346.  
  2347. EOM
  2348.     rp="Run make depend now?"
  2349.     . UU/myread
  2350.     case "$ans" in
  2351.     y*) make depend
  2352.     echo "Now you must run a make."
  2353.     ;;
  2354.     *)  echo "You must run 'make depend' then 'make'."
  2355.     ;;
  2356.     esac
  2357. elif test -f [Mm]akefile; then
  2358.     echo " "
  2359.     echo "Now you must run a make."
  2360. else
  2361.     echo "Done."
  2362. fi
  2363.  
  2364. $rm -f kit*isdone
  2365. $rm -rf UU
  2366. : end of Configure
  2367.