home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2913 / Configure
Encoding:
Text File  |  1991-03-03  |  26.6 KB  |  1,290 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, I'd
  7. # suggest you cut out the prototypical config.h from the end of this
  8. # file and edit it to reflect your system.  Some packages may include
  9. # samples of config.h for certain machines, so you might look for one
  10. # of those.)
  11. #
  12. # Yes, you may rip this off to use in other distribution packages.
  13. # (Note: this Configure script was generated automatically.  Rather than
  14. # working with this copy of Configure, you may wish to get metaconfig.
  15. # Write to ram@educ.emse.fr (Raphael Manfredi) and I will send you
  16. # my version which slightly differs from the original written by
  17. # Larry Wall.)
  18.  
  19. # $Id: Configure,v 2.0 91/02/19 15:48:32 ram Exp $
  20.  
  21. : save PATH defined by user
  22. user_path=$PATH
  23.  
  24. : sanity checks
  25. PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin'
  26. PATH=$PATH:'/usr/5bin:/etc:/usr/gnu/bin:/usr/new:/usr/new/bin:/usr/nbin'
  27. PATH=$PATH:'/sys5.3/bin:/sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb'
  28. PATH=$PATH:'/bsd4.3/usr/bin:/usr/bsd'
  29. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
  30.  
  31. if test ! -t 0; then
  32.     echo "Say 'sh Configure', not 'sh <Configure'"
  33.     exit 1
  34. fi
  35.  
  36. (alias) >/dev/null 2>&1 && \
  37.     echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
  38.     echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
  39.  
  40. if test ! -d ../UU; then
  41.     if test ! -d UU; then
  42.     mkdir UU
  43.     fi
  44.     cd UU
  45. fi
  46.  
  47. case "$1" in
  48. -d) shift; fastread='yes';;
  49. esac
  50.  
  51. d_eunice=''
  52. d_xenix=''
  53. d_bsd=''
  54. define=''
  55. eunicefix=''
  56. loclist=''
  57. expr=''
  58. awk=''
  59. sed=''
  60. echo=''
  61. cat=''
  62. chgrp=''
  63. chmod=''
  64. chown=''
  65. rm=''
  66. mv=''
  67. cp=''
  68. tail=''
  69. tr=''
  70. mkdir=''
  71. sort=''
  72. uniq=''
  73. grep=''
  74. trylist=''
  75. test=''
  76. inews=''
  77. egrep=''
  78. more=''
  79. pg=''
  80. Mcc=''
  81. vi=''
  82. mail=''
  83. bison=''
  84. cpp=''
  85. perl=''
  86. Log=''
  87. Header=''
  88. Id=''
  89. bin=''
  90. contains=''
  91. defeditor=''
  92. mansrc=''
  93. manext=''
  94. models=''
  95. split=''
  96. small=''
  97. medium=''
  98. large=''
  99. huge=''
  100. ccflags=''
  101. ldflags=''
  102. cc=''
  103. cppflags=''
  104. optimize=''
  105. n=''
  106. c=''
  107. package=''
  108. scriptdir=''
  109. spitshell=''
  110. shsharp=''
  111. sharpbang=''
  112. startsh=''
  113. sysman=''
  114. mailer=''
  115. CONFIG=''
  116. : set package name
  117. package=kit
  118.  
  119. echo " "
  120. echo "Beginning of configuration questions for $package kit."
  121. : Eunice requires " " instead of "", can you believe it
  122. echo " "
  123.  
  124. define='define'
  125. undef='undef'
  126. : change the next line if compiling for Xenix/286 on Xenix/386
  127. xlibpath='/usr/lib/386 /lib/386'
  128. libpth='/usr/lib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large'
  129. libpth=$libpth' /usr/lib/small /lib/small'
  130. smallmach='pdp11 i8086 z8000 i80286 iAPX286'
  131. rmlist='ark[1-9]isdone ark[1-9][0-9]isdone'
  132. trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3 15
  133.  
  134. : We must find out about Eunice early
  135. eunicefix=':'
  136. if test -f /etc/unixtovms; then
  137.     eunicefix=/etc/unixtovms
  138. fi
  139. if test -f /etc/unixtovms.exe; then
  140.     eunicefix=/etc/unixtovms.exe
  141. fi
  142.  
  143. if ls blurfl >/dev/null 2>&1; then
  144.     if awk '' blurfl >/dev/null 2>&1; then
  145.         check='cat'
  146.     else
  147.         check='awk ""'
  148.     fi
  149. else
  150.     check='ls'
  151. fi
  152.  
  153. : Now test for existence of everything in MANIFEST
  154. if test -f ../MANIFEST; then
  155.     echo "First let's make sure your kit is complete.  Checking..."
  156.     : some grep do not return a proper exit status
  157.     grep '^---' ../MANIFEST > .grepmani 2>/dev/null
  158.     if test -s .grepmani; then
  159. (cd ..; eval $check `awk '!/^.*\/$/{if (b) print $1}
  160. /^---/{b=1}' MANIFEST` || kill $$) >/dev/null
  161.     else
  162. (cd ..; eval $check `awk '!/^.*\/$/{print $1}' MANIFEST` || kill $$) >/dev/null
  163.     fi
  164.     echo "Looks good..."
  165. else
  166.     echo "No MANIFEST found. Hope your kit is complete !"
  167. fi
  168. rm -f .grepmani
  169.  
  170. pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/5bin"
  171. pth=$pth" /usr/lbin /etc /usr/new /usr/new/bin /usr/nbin /usr/gnu/bin"
  172. pth=$pth" /usr/plx /vol/local/bin /usr/lib /lib /usr/local/lib"
  173. pth=$pth" /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin"
  174. pth=$pth" /bsd4.3/usr/ucb /usr/bsd"
  175. : add PATH from user
  176. pth=$pth" "`echo $user_path | sed -e 's/:/ /g'`
  177. inclwanted=''
  178.  
  179. : some greps do not return status, grrr.
  180. echo "grimblepritz" >grimble
  181. if grep blurfldyick grimble >/dev/null 2>&1 ; then
  182.     contains=contains
  183. elif grep grimblepritz grimble >/dev/null 2>&1 ; then
  184.     contains=grep
  185. else
  186.     contains=contains
  187. fi
  188. rm -f grimble
  189. : the following should work in any shell
  190. case "$contains" in
  191. contains*)
  192.     echo " "
  193.     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  194.     cat >contains <<'EOSS'
  195. grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  196. EOSS
  197. chmod +x contains
  198. esac
  199.  
  200. : see if sh knows # comments
  201. echo " "
  202. echo "Checking your sh to see if it knows about # comments..."
  203. if sh -c '#' >/dev/null 2>&1 ; then
  204.     echo "Your sh handles # comments correctly."
  205.     shsharp=true
  206.     spitshell=cat
  207.     echo " "
  208.     echo "Okay, let's see if #! works on this system..."
  209.     echo "#!/bin/echo hi" > try
  210.     $eunicefix try
  211.     chmod +x try
  212.     try > today
  213.     if $contains hi today >/dev/null 2>&1; then
  214.     echo "It does."
  215.     sharpbang='#!'
  216.     else
  217.     echo "#! /bin/echo hi" > try
  218.     $eunicefix try
  219.     chmod +x try
  220.     try > today
  221.     if test -s today; then
  222.         echo "It does."
  223.         sharpbang='#! '
  224.     else
  225.         echo "It doesn't."
  226.         sharpbang=': use '
  227.     fi
  228.     fi
  229. else
  230.     echo "Your sh doesn't grok # comments--I will strip them later on."
  231.     shsharp=false
  232.     echo "exec grep -v '^[     ]*#'" >spitshell
  233.     chmod +x spitshell
  234.     $eunicefix spitshell
  235.     spitshell=`pwd`/spitshell
  236.     echo "I presume that if # doesn't work, #! won't work either!"
  237.     sharpbang=': use '
  238. fi
  239. rm -f try today
  240.  
  241. : figure out how to guarantee sh startup
  242. echo " "
  243. echo "Checking out how to guarantee sh startup..."
  244. startsh=$sharpbang'/bin/sh'
  245. echo "Let's see if '$startsh' works..."
  246. cat >try <<EOSS
  247. $startsh
  248. set abc
  249. test "$?abc" != 1
  250. EOSS
  251.  
  252. chmod +x try
  253. $eunicefix try
  254. if try; then
  255.     echo "Yup, it does."
  256. else
  257.     echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  258. fi
  259. rm -f try
  260.  
  261. : first determine how to suppress newline on echo command
  262. echo " "
  263. echo "Checking echo to see how to suppress newlines..."
  264. (echo "hi there\c" ; echo " ") >.echotmp
  265. if $contains c .echotmp >/dev/null 2>&1 ; then
  266.     echo "...using -n."
  267.     n='-n'
  268.     c=''
  269. else
  270.     cat <<'EOM'
  271. ...using \c
  272. EOM
  273.     n=''
  274.     c='\c'
  275. fi
  276. echo $n "The star should be here-->$c"
  277. echo '*'
  278. rm -f .echotmp
  279.  
  280. : now set up to do reads with possible shell escape and default assignment
  281. cat <<EOSC >myread
  282. case "\$fastread" in
  283. yes) ans=''; echo " " ;;
  284. *) ans='!';;
  285. esac
  286. while expr "X\$ans" : "X!" >/dev/null; do
  287.     read ans
  288.     case "\$ans" in
  289.     !)
  290.     sh
  291.     echo " "
  292.     echo $n "\$rp $c"
  293.     ;;
  294.     !*)
  295.     set \`expr "X\$ans" : "X!\(.*\)\$"\`
  296.     sh -c "\$*"
  297.     echo " "
  298.     echo $n "\$rp $c"
  299.     ;;
  300.     esac
  301. done
  302. rp='Your answer:'
  303. case "\$ans" in
  304. '') ans="\$dflt";;
  305. esac
  306. EOSC
  307.  
  308. : general instructions
  309. cat <<EOH
  310.  
  311. This installation shell script will examine your system and ask you questions
  312. to determine how the $package package should be installed.  If you get stuck
  313. on a question, you may use a ! shell escape to start a subshell or execute
  314. a command.  Many of the questions will have default answers in square
  315. brackets--typing carriage return will give you the default.
  316.  
  317. On some of the questions which ask for file or directory names you are
  318. allowed to use the ~name construct to specify the login directory belonging
  319. to "name", even if you don't have a shell which knows about that.  Questions
  320. where this is allowed will be marked "(~name ok)".
  321.  
  322. EOH
  323. rp="[Type carriage return to continue]"
  324. echo $n "$rp $c"
  325. . myread
  326. cat <<EOH
  327.  
  328. Much effort has been expended to ensure that this shell script will run on
  329. any Unix system. If despite that it blows up on you, your best bet is to edit
  330. Configure and run it again. Also, let me (ram@educ.emse.fr)
  331. know how I blew it. If you can't run Configure for some reason, you'll have
  332. to generate a config.sh file by hand.
  333.  
  334. This installation script affects things in two ways:
  335. 1) it may do direct variable substitutions on some of the files included
  336.    in this kit.
  337. 2) it builds a config.h file for inclusion in C programs.  You may edit
  338.    any of these files as the need arises after running this script.
  339.  
  340. If you make a mistake on a question, there is no easy way to back up to it
  341. currently.  The easiest thing to do is to edit config.sh and rerun all the
  342. SH files.  Configure will offer to let you do this before it runs the SH files.
  343.  
  344. EOH
  345. rp="[Type carriage return to continue]"
  346. echo $n "$rp $c"
  347. . myread
  348.  
  349. : get old answers, if there is a config file out there
  350. if test -f ../config.sh; then
  351.     echo " "
  352.     dflt=y
  353.     rp="I see a config.sh file.  Did Configure make it on THIS system? [$dflt]"
  354.     echo $n "$rp $c"
  355.     . myread
  356.     case "$ans" in
  357.     n*|N*) echo "OK, I'll ignore it.";;
  358.     *)  echo "Fetching default answers from your old config.sh file..."
  359.     tmp="$n"
  360.     ans="$c"
  361.         . ../config.sh
  362.     n="$tmp"
  363.     c="$ans"
  364.     ;;
  365.     esac
  366. fi
  367.  
  368. : find out where common programs are
  369. echo " "
  370. echo "Locating common programs..."
  371. cat <<EOSC >loc
  372. $startsh
  373. case \$# in
  374. 0) exit 1;;
  375. esac
  376. thing=\$1
  377. shift
  378. dflt=\$1
  379. shift
  380. for dir in \$*; do
  381.     case "\$thing" in
  382.     .)
  383.     if test -d \$dir/\$thing; then
  384.         echo \$dir
  385.         exit 0
  386.     fi
  387.     ;;
  388.     *)
  389.     if test -f \$dir/\$thing; then
  390.         echo \$dir/\$thing
  391.         exit 0
  392.     elif test -f \$dir/\$thing.exe; then
  393.         : on Eunice apparently
  394.         echo \$dir/\$thing
  395.         exit 0
  396.     fi
  397.     ;;
  398.     esac
  399. done
  400. echo \$dflt
  401. exit 1
  402. EOSC
  403. chmod +x loc
  404. $eunicefix loc
  405. loclist="
  406. cat
  407. chgrp
  408. chmod
  409. chown
  410. echo
  411. expr
  412. grep
  413. rm
  414. sed
  415. "
  416. trylist="
  417. test
  418. vi
  419. "
  420. for file in $loclist; do
  421.     xxx=`loc $file $file $pth`
  422.     eval $file=$xxx
  423.     eval _$file=$xxx
  424.     case "$xxx" in
  425.     /*)
  426.     echo $file is in $xxx.
  427.     ;;
  428.     *)
  429.     echo "I don't know where $file is.  I hope it's in everyone's PATH."
  430.     ;;
  431.     esac
  432. done
  433. echo " "
  434. echo "Don't worry if any of the following aren't found..."
  435. ans=offhand
  436. for file in $trylist; do
  437.     xxx=`loc $file $file $pth`
  438.     eval $file=$xxx
  439.     eval _$file=$xxx
  440.     case "$xxx" in
  441.     /*)
  442.     echo $file is in $xxx.
  443.     ;;
  444.     *)
  445.     echo "I don't see $file out there, $ans."
  446.     ans=either
  447.     ;;
  448.     esac
  449. done
  450. case "$egrep" in
  451. egrep)
  452.     echo "Substituting grep for egrep."
  453.     egrep=$grep
  454.     ;;
  455. esac
  456. case "$test" in
  457. test)
  458.     echo "Hopefully test is built into your sh."
  459.     ;;
  460. /bin/test)
  461.     if sh -c "PATH= test true" >/dev/null 2>&1; then
  462.     echo "Using the test built into your sh."
  463.     test=test
  464.     fi
  465.     ;;
  466. *)
  467.     test=test
  468.     ;;
  469. esac
  470. case "$echo" in
  471. echo)
  472.     echo "Hopefully echo is built into your sh."
  473.     ;;
  474. /bin/echo)
  475.     echo " "
  476.     echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
  477.     $echo $n "hi there$c" >foo1
  478.     echo $n "hi there$c" >foo2
  479.     if cmp foo1 foo2 >/dev/null 2>&1; then
  480.     echo "They are compatible.  In fact, they may be identical."
  481.     else
  482.     case "$n" in
  483.     '-n') n='' c='\c' ans='\c' ;;
  484.     *) n='-n' c='' ans='-n' ;;
  485.     esac
  486.     cat <<FOO
  487. They are not compatible!  You are probably running ksh on a non-USG system.
  488. I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
  489. have echo built in and we may have to run some Bourne shell scripts.  That
  490. means I'll have to use $ans to suppress newlines now.  Life is ridiculous.
  491.  
  492. FOO
  493.     rp="The star should be here-->"
  494.     $echo $n "$rp$c"
  495.     $echo "*"
  496.     fi
  497.     $rm -f foo1 foo2
  498.     ;;
  499. *)
  500.     : cross your fingers
  501.     echo=echo
  502.     ;;
  503. esac
  504. rmlist="$rmlist loc"
  505.  
  506. : preserve RCS keywords in files with variable substitution, grrr
  507. Log='$Log'
  508. Header='$Header'
  509. Id='$Id'
  510.  
  511. : set up shell script to do ~ expansion
  512. cat >filexp <<EOSS
  513. $startsh
  514. : expand filename
  515. case "\$1" in
  516.  ~/*|~)
  517.     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  518.     ;;
  519.  ~*)
  520.     if $test -f /bin/csh; then
  521.     /bin/csh -f -c "glob \$1"
  522.     echo ""
  523.     else
  524.     name=\`$expr x\$1 : '..\([^/]*\)'\`
  525.     dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
  526.     if $test ! -d "\$dir"; then
  527.         me=\`basename \$0\`
  528.         echo "\$me: can't locate home directory for: \$name" >&2
  529.         exit 1
  530.     fi
  531.     case "\$1" in
  532.     */*)
  533.         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  534.         ;;
  535.     *)
  536.         echo \$dir
  537.         ;;
  538.     esac
  539.     fi
  540.     ;;
  541. *)
  542.     echo \$1
  543.     ;;
  544. esac
  545. EOSS
  546. chmod +x filexp
  547. $eunicefix filexp
  548.  
  549. : determine where public executables go
  550. case "$bin" in
  551. '')
  552.     dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
  553.     ;;
  554. *)  dflt="$bin"
  555.     ;;
  556. esac
  557. cont=true
  558. while $test "$cont" ; do
  559.     echo " "
  560.     rp="Where do you want to put the public executables? (~name ok) [$dflt]"
  561.     $echo $n "$rp $c"
  562.     . myread
  563.     bin="$ans"
  564.     bin=`filexp $bin`
  565.     if test -d $bin; then
  566.     cont=''
  567.     else
  568.     dflt=n
  569.     rp="Directory $bin doesn't exist.  Use that name anyway? [$dflt]"
  570.     $echo $n "$rp $c"
  571.     . myread
  572.     dflt=''
  573.     case "$ans" in
  574.     y*) cont='';;
  575.     esac
  576.     fi
  577. done
  578.  
  579. : determine where manual pages are on this system
  580. echo " "
  581. case "$sysman" in
  582.     '') 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`
  583.     ;;
  584. esac
  585. if test -d "$sysman"; then
  586.     echo "System manual is in $sysman."
  587. fi
  588.  
  589. : make some quick guesses about what we are up against
  590. echo " "
  591. $echo $n "Hmm...  $c"
  592. cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
  593. if test `echo abc | tr a-z A-Z` = Abc ; then
  594.     if $contains SIGTSTP foo >/dev/null 2>&1 ; then
  595.     echo "Looks kind of like an USG system with BSD features, but we'll see..."
  596.     else
  597.     echo "Looks kind of like an USG system, but we'll see..."
  598.     fi
  599.     d_bsd="$undef"
  600.     echo exit 1 >bsd
  601.     echo exit 0 >usg
  602.     echo exit 1 >v7
  603. elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
  604.     echo "Looks kind of like a BSD system, but we'll see..."
  605.     d_bsd="$define"
  606.     echo exit 0 >bsd
  607.     echo exit 1 >usg
  608.     echo exit 1 >v7
  609. else
  610.     echo "Looks kind of like a Version 7 system, but we'll see..."
  611.     d_bsd="$undef"
  612.     echo exit 1 >bsd
  613.     echo exit 1 >usg
  614.     echo exit 0 >v7
  615. fi
  616. case "$eunicefix" in
  617. *unixtovms*)
  618.     cat <<'EOI'
  619. There is, however, a strange, musty smell in the air that reminds me of
  620. something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  621. EOI
  622.     echo "exit 0" >eunice
  623.     eunicefix=unixtovms
  624.     d_eunice="$define"
  625. : it so happens the Eunice I know will not run shell scripts in Unix format
  626.     ;;
  627. *)
  628.     echo " "
  629.     echo "Congratulations.  You aren't running Eunice."
  630.     eunicefix=':'
  631.     d_eunice="$undef"
  632.     echo "exit 1" >eunice
  633.     ;;
  634. esac
  635. if test -f /xenix; then
  636.     echo "Actually, this looks more like a XENIX system..."
  637.     echo "exit 0" >xenix
  638.     d_xenix="$define"
  639. else
  640.     echo " "
  641.     echo "It's not Xenix..."
  642.     echo "exit 1" >xenix
  643.     d_xenix="$undef"
  644. fi
  645. chmod +x xenix
  646. $eunicefix xenix
  647. if test -f /venix; then
  648.     echo "Actually, this looks more like a VENIX system..."
  649.     echo "exit 0" >venix
  650. else
  651.     echo " "
  652.     if xenix; then
  653.     : null
  654.     else
  655.     echo "Nor is it Venix..."
  656.     fi
  657.     echo "exit 1" >venix
  658. fi
  659. chmod +x bsd usg v7 eunice venix
  660. $eunicefix bsd usg v7 eunice venix
  661. rm -f foo
  662. rmlist="$rmlist bsd usg v7 eunice venix xenix"
  663.  
  664. : see what memory models we can support
  665. case "$models" in
  666. '')
  667.     cat >pdp11.c <<'EOP'
  668. main() {
  669. #ifdef pdp11
  670.     exit(0);
  671. #else
  672.     exit(1);
  673. #endif
  674. }
  675. EOP
  676.     cc -o pdp11 pdp11.c >/dev/null 2>&1
  677.     if pdp11 2>/dev/null; then
  678.         dflt='unsplit split'
  679.     else
  680.         ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
  681.         case "$ans" in
  682.         X) dflt='none';;
  683.         *) if $test -d /lib/small || $test -d /usr/lib/small; then
  684.                 dflt='small'
  685.             else
  686.                 dflt=''
  687.             fi
  688.             if $test -d /lib/medium || $test -d /usr/lib/medium; then
  689.                 dflt="$dflt medium"
  690.             fi
  691.             if $test -d /lib/large || $test -d /usr/lib/large; then
  692.                 dflt="$dflt large"
  693.             fi
  694.             if $test -d /lib/huge || $test -d /usr/lib/huge; then
  695.                 dflt="$dflt huge"
  696.             fi
  697.         esac
  698.     fi;;
  699. *) dflt="$models";;
  700. esac
  701. $cat <<EOM
  702.  
  703. Some systems have different model sizes.  On most systems they are called
  704. small, medium, large, and huge.  On the PDP11 they are called unsplit and
  705. split.  If your system doesn't support different memory models, say "none".
  706. If you wish to force everything to one memory model, say "none" here and
  707. put the appropriate flags later when it asks you for other cc and ld flags.
  708. Venix systems may wish to put "none" and let the compiler figure things out.
  709. (In the following question multiple model names should be space separated.)
  710.  
  711. EOM
  712. rp="Which models are supported? [$dflt]"
  713. $echo $n "$rp $c"
  714. . myread
  715. models="$ans"
  716.  
  717. case "$models" in
  718. none)
  719.     small=''
  720.     medium=''
  721.     large=''
  722.     huge=''
  723.     unsplit=''
  724.     split=''
  725.     ;;
  726. *split)
  727.     case "$split" in
  728.     '') if $contains '\-i' $mansrc/ld.1 >/dev/null 2>&1 || \
  729.              $contains '\-i' $mansrc/cc.1 >/dev/null 2>&1; then
  730.             dflt='-i'
  731.         else
  732.             dflt='none'
  733.         fi;;
  734.     *) dflt="$split";;
  735.     esac
  736.     rp="What flag indicates separate I and D space? [$dflt]"
  737.     $echo $n "$rp $c"
  738.     . myread
  739.     case "$ans" in
  740.     none) ans='';;
  741.     esac
  742.     split="$ans"
  743.     unsplit='';;
  744. *large*|*small*|*medium*|*huge*)
  745.     case "$model" in
  746.     *large*)
  747.         case "$large" in
  748.         '') dflt='-Ml';;
  749.         *) dflt="$large";;
  750.         esac
  751.     rp="What flag indicates large model? [$dflt]"
  752.     $echo $n "$rp $c"
  753.     . myread
  754.     case "$ans" in
  755.     none) ans='';
  756.     esac
  757.     large="$ans";;
  758.     *) large='';;
  759.     esac
  760.     case "$model" in
  761.     *huge*) case "$huge" in
  762.         '') dflt='-Mh';;
  763.         *) dflt="$huge";;
  764.         esac
  765.         rp="What flag indicates huge model? [$dflt]"
  766.         $echo $n "$rp $c"
  767.         . myread
  768.         case "$ans" in
  769.         none) ans='';
  770.         esac
  771.         huge="$ans";;
  772.     *) huge="$large";;
  773.     esac
  774.     case "$model" in
  775.     *medium*) case "$medium" in
  776.         '') dflt='-Mm';;
  777.         *) dflt="$medium";;
  778.         esac
  779.         rp="What flag indicates medium model? [$dflt]"
  780.         $echo $n "$rp $c"
  781.         . myread
  782.         case "$ans" in
  783.         none) ans='';
  784.         esac
  785.         medium="$ans";;
  786.     *) medium="$large";;
  787.     esac
  788.     case "$model" in
  789.     *small*) case "$small" in
  790.         '') dflt='none';;
  791.         *) dflt="$small";;
  792.         esac
  793.         rp="What flag indicates small model? [$dflt]"
  794.         $echo $n "$rp $c"
  795.         . myread
  796.         case "$ans" in
  797.         none) ans='';
  798.         esac
  799.         small="$ans";;
  800.     *) small='';;
  801.     esac
  802.     ;;
  803. *)
  804.     echo "Unrecognized memory models--you may have to edit Makefile.SH"
  805.     ;;
  806. esac
  807.  
  808. : see if we need a special compiler
  809. echo " "
  810. if usg; then
  811.     case "$cc" in
  812.     '')
  813.     case "$Mcc" in
  814.     /*) dflt='Mcc'
  815.         ;;
  816.     *)
  817.         case "$large" in
  818.         -M*)
  819.         dflt='cc'
  820.         ;;
  821.         *)
  822.         if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
  823.             dflt='cc -M'
  824.         else
  825.             dflt='cc'
  826.         fi
  827.         ;;
  828.         esac
  829.         ;;
  830.     esac
  831.     ;;
  832.     *)  dflt="$cc";;
  833.     esac
  834.     $cat <<'EOM'
  835.  
  836. On some systems the default C compiler will not resolve multiple global
  837. references that happen to have the same name.  On some such systems the
  838. "Mcc" command may be used to force these to be resolved.  On other systems
  839. a "cc -M" command is required.  (Note that the -M flag on other systems
  840. indicates a memory model to use!)  If you have the Gnu C compiler, you
  841. might wish to use that instead.  What command will force resolution on
  842. EOM
  843.     $echo $n "this system? [$dflt] $c"
  844.     rp="Command to resolve multiple refs? [$dflt]"
  845.     . myread
  846.     cc="$ans"
  847. else
  848.     case "$cc" in
  849.     '') dflt=cc;;
  850.     *) dflt="$cc";;
  851.     esac
  852.     rp="Use which C compiler? [$dflt]"
  853.     $echo $n "$rp $c"
  854.     . myread
  855.     cc="$ans"
  856. fi
  857. case "$cc" in
  858. gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
  859. esac
  860.  
  861. : determine optimize, if desired, or use for debug flag also
  862. case "$optimize" in
  863. ' ') dflt="none";;
  864. '') dflt="-O";;
  865. *) dflt="$optimize";;
  866. esac
  867. cat <<EOH
  868.  
  869. Some C compilers have problems with their optimizers, by default, $package
  870. compiles with the -O flag to use the optimizer.  Alternately, you might
  871. want to use the symbolic debugger, which uses the -g flag (on traditional
  872. Unix systems).  Either flag can be specified here.  To use neither flag,
  873. specify the word "none".
  874.   
  875. EOH
  876. rp="What optimizer/debugger flag should be used? [$dflt]"
  877. $echo $n "$rp $c"
  878. . myread
  879. optimize="$ans"
  880. case "$optimize" in
  881. 'none') optimize=" ";;
  882. esac
  883.  
  884. case "$ccflags" in
  885. '') case "$cc" in
  886.     *gcc*) dflt='-fpcc-struct-return';;
  887.     *) dflt='';;
  888.     esac
  889.     ;;
  890. *) dflt="$ccflags";;
  891. esac
  892. for thisincl in $inclwanted; do
  893.     if $test -d $thisincl; then
  894.         case "$dflt" in
  895.         *$thisincl*);;
  896.         *) dflt="$dflt -I$thisincl";;
  897.         esac
  898.     fi
  899. done
  900. case "$optimize" in
  901. -g*)
  902.     case "$dflt" in
  903.     *DEBUG*);;
  904.     *) dflt="$dflt -DDEBUG";;
  905.     esac
  906.     ;;
  907. esac
  908. if $contains 'LANGUAGE_C' /usr/include/signal.h >/dev/null 2>&1; then
  909.     case "$dflt" in
  910.     *LANGUAGE_C*);;
  911.     *) dflt="$dflt -DLANGUAGE_C";;
  912.     esac
  913. fi
  914. case "$dflt" in
  915. '') dflt=none;;
  916. esac
  917. cat <<EOH
  918.  
  919. Your C compiler may want other flags.  For this question you should
  920. include -I/whatever and -DWHATEVER flags and any other flags used by
  921. the C compiler, but you should NOT include libraries or ld flags like
  922. -lwhatever.  To use no flags, specify the word "none".
  923.   
  924. EOH
  925. rp="Any additional cc flags? [$dflt]"
  926. $echo $n "$rp $c"
  927. . myread
  928. case "$ans" in
  929. none) ans='';
  930. esac
  931. ccflags="$ans"
  932.  
  933. : the following weeds options from ccflags that are of no interest to cpp
  934. cppflags="$ccflags"
  935. case "$cc" in
  936. *gcc*) cppflags="$cppflags -D__GNUC__";;
  937. esac
  938. case "$cppflags" in
  939. '');;
  940. *)  set X $cppflags
  941.     cppflags=''
  942.     for flag do
  943.         case $flag in
  944.         -D*|-I*) cppflags="$cppflags $flag";;
  945.         esac
  946.     done
  947.     case "$cppflags" in
  948.     *-*)  echo "(C preprocessor flags: $cppflags)";;
  949.     esac
  950.     ;;
  951. esac
  952.  
  953. case "$ldflags" in
  954. '') if venix; then
  955.         dflt='-i -z'
  956.     else
  957.         dflt='none'
  958.     fi
  959.     ;;
  960. *) dflt="$ldflags";;
  961. esac
  962. echo " "
  963. rp="Any additional ld flags (NOT including libraries)? [$dflt]"
  964. $echo $n "$rp $c"
  965. . myread
  966. case "$ans" in
  967. none) ans='';
  968. esac
  969. ldflags="$ans"
  970. rmlist="$rmlist pdp11"
  971.  
  972. : determine default editor
  973. case "$defeditor" in
  974. '')
  975.     case "$_vi" in
  976.     */*) dflt="$_vi";;
  977.     *) dflt=/usr/ucb/vi;;
  978.     esac
  979.     ;;
  980. *)  dflt="$defeditor"
  981.     ;;
  982. esac
  983. cont=true
  984. while $test "$cont" ; do
  985.     echo " "
  986.     rp="What is the default editor on your system? [$dflt]"
  987.     $echo $n "$rp $c"
  988.     . myread
  989.     defeditor="$ans"
  990.     if test -f $ans; then
  991.     cont=''
  992.     else
  993.     dflt=n
  994.     rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
  995.     $echo $n "$rp $c"
  996.     . myread
  997.     dflt=''
  998.     case "$ans" in
  999.     y*) cont='';;
  1000.     esac
  1001.     fi
  1002. done
  1003.  
  1004. : determine the name of a reasonable mailer
  1005. case "$mailer" in
  1006. '')
  1007.     if $test -f /usr/lib/sendmail; then
  1008.     dflt="/usr/lib/sendmail -odi"
  1009.     elif $test -f /bin/mail; then
  1010.     dflt=/bin/mail
  1011.     else
  1012.     dflt=$mail
  1013.     fi
  1014.     ;;
  1015. *)  dflt="$mailer";;
  1016. esac
  1017. cont=true
  1018. while $test "$cont" ; do
  1019.     echo " "
  1020.     echo "Give the full path name of the program used to deliver mail on your"
  1021.     $echo $n "system: [$dflt] $c"
  1022.     rp="Preferred mailer: [$dflt]"
  1023.     . myread
  1024.     mailer="$ans"
  1025.     set x $ans
  1026.     shift
  1027.     if test -f "$1"; then
  1028.     cont=''
  1029.     else
  1030.     dflt=n
  1031.     rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
  1032.     $echo $n "$rp $c"
  1033.     . myread
  1034.     dflt=''
  1035.     case "$ans" in
  1036.     y*) cont='';;
  1037.     esac
  1038.     fi
  1039. done
  1040.  
  1041. : determine where manual pages go
  1042. case "$mansrc" in
  1043. '')
  1044.     dflt="$sysman"
  1045.     ;;
  1046. *)  dflt="$mansrc"
  1047.     ;;
  1048. esac
  1049. cont=true
  1050. while $test "$cont" ; do
  1051.     echo " "
  1052.     rp="Where do the manual pages (source) go? (~name ok) [$dflt]"
  1053.     $echo $n "$rp $c"
  1054.     . myread
  1055.     mansrc=`filexp "$ans"`
  1056.     if test -d "$mansrc"; then
  1057.     cont=''
  1058.     else
  1059.     dflt=n
  1060.     rp="Directory $mansrc doesn't exist.  Use that name anyway? [$dflt]"
  1061.     $echo $n "$rp $c"
  1062.     . myread
  1063.     dflt=''
  1064.     case "$ans" in
  1065.     y*) cont='';;
  1066.     esac
  1067.     fi
  1068. done
  1069. case "$mansrc" in
  1070. *l)
  1071.     manext=l
  1072.     ;;
  1073. *n)
  1074.     manext=n
  1075.     ;;
  1076. *C)
  1077.     manext=C
  1078.     ;;
  1079. *)
  1080.     manext=1
  1081.     ;;
  1082. esac
  1083.  
  1084. : determine where public executables go
  1085. case "$scriptdir" in
  1086. '')
  1087.     dflt="$bin"
  1088.     : guess some guesses
  1089.     $test -d /usr/share/scripts && dflt=/usr/share/scripts
  1090.     $test -d /usr/share/bin && dflt=/usr/share/bin
  1091.     ;;
  1092. *)  dflt="$scriptdir"
  1093.     ;;
  1094. esac
  1095. cont=true
  1096. $cat <<EOM
  1097.  
  1098. Some installations have a separate directory just for executable scripts so
  1099. that they can mount it across multiple architectures but keep the scripts in
  1100. one spot.  You might, for example, have a subdirectory of /usr/share for this.
  1101. Or you might just lump your scripts in with all your other executables.
  1102.  
  1103. EOM
  1104. while $test "$cont" ; do
  1105.     rp="Where do you keep publicly executable scripts? (~name ok) [$dflt]"
  1106.     $echo $n "$rp $c"
  1107.     . myread
  1108.     scriptdir="$ans"
  1109.     scriptdir=`./filexp "$scriptdir"`
  1110.     if $test -d $scriptdir; then
  1111.     cont=''
  1112.     else
  1113.     case "$fastread" in
  1114.     yes) dflt=y;;
  1115.     *) dflt=n;;
  1116.     esac
  1117.     rp="Directory $scriptdir doesn't exist.  Use that name anyway? [$dflt]"
  1118.     $echo $n "$rp $c"
  1119.     . myread
  1120.     dflt=''
  1121.     case "$ans" in
  1122.     y*) cont='';;
  1123.     esac
  1124.     fi
  1125. done
  1126.  
  1127. echo " "
  1128. echo "End of configuration questions."
  1129. echo " "
  1130.  
  1131. : create config.sh file
  1132. echo " "
  1133. if test -d ../UU; then
  1134.     cd ..
  1135. fi
  1136. echo "Creating config.sh..."
  1137. $spitshell <<EOT >config.sh
  1138. $startsh
  1139. # config.sh
  1140. # This file was produced by running the Configure script.
  1141.  
  1142. d_eunice='$d_eunice'
  1143. d_xenix='$d_xenix'
  1144. d_bsd='$d_bsd'
  1145. define='$define'
  1146. eunicefix='$eunicefix'
  1147. loclist='$loclist'
  1148. expr='$expr'
  1149. awk='$awk'
  1150. sed='$sed'
  1151. echo='$echo'
  1152. cat='$cat'
  1153. chgrp='$chgrp'
  1154. chmod='$chmod'
  1155. chown='$chown'
  1156. rm='$rm'
  1157. mv='$mv'
  1158. cp='$cp'
  1159. tail='$tail'
  1160. tr='$tr'
  1161. mkdir='$mkdir'
  1162. sort='$sort'
  1163. uniq='$uniq'
  1164. grep='$grep'
  1165. trylist='$trylist'
  1166. test='$test'
  1167. inews='$inews'
  1168. egrep='$egrep'
  1169. more='$more'
  1170. pg='$pg'
  1171. Mcc='$Mcc'
  1172. vi='$vi'
  1173. mail='$mail'
  1174. bison='$bison'
  1175. cpp='$cpp'
  1176. perl='$perl'
  1177. Log='$Log'
  1178. Header='$Header'
  1179. Id='$Id'
  1180. bin='$bin'
  1181. contains='$contains'
  1182. defeditor='$defeditor'
  1183. mansrc='$mansrc'
  1184. manext='$manext'
  1185. models='$models'
  1186. split='$split'
  1187. small='$small'
  1188. medium='$medium'
  1189. large='$large'
  1190. huge='$huge'
  1191. ccflags='$ccflags'
  1192. ldflags='$ldflags'
  1193. cc='$cc'
  1194. cppflags='$cppflags'
  1195. optimize='$optimize'
  1196. n='$n'
  1197. c='$c'
  1198. package='$package'
  1199. scriptdir='$scriptdir'
  1200. spitshell='$spitshell'
  1201. shsharp='$shsharp'
  1202. sharpbang='$sharpbang'
  1203. startsh='$startsh'
  1204. sysman='$sysman'
  1205. mailer='$mailer'
  1206. CONFIG=true
  1207. EOT
  1208.  
  1209. CONFIG=true
  1210.  
  1211. echo " "
  1212. dflt=''
  1213. fastread=''
  1214. echo "If you didn't make any mistakes, then just type a carriage return here."
  1215. rp="If you need to edit config.sh, do it as a shell escape here:"
  1216. $echo $n "$rp $c"
  1217. . UU/myread
  1218. case "$ans" in
  1219. '') ;;
  1220. *) : in case they cannot read
  1221.     eval $ans;;
  1222. esac
  1223. . ./config.sh
  1224.  
  1225. echo " "
  1226. echo "Doing variable substitutions on .SH files..."
  1227. if test -f MANIFEST; then
  1228.     set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
  1229. else
  1230.     set x `find . -name "*.SH" -print`
  1231. fi
  1232. shift
  1233. case $# in
  1234. 0) set x *.SH; shift;;
  1235. esac
  1236. if test ! -f $1; then
  1237.     shift
  1238. fi
  1239. for file in $*; do
  1240.     case "$file" in
  1241.     */*)
  1242.     dir=`$expr X$file : 'X\(.*\)/'`
  1243.     file=`$expr X$file : 'X.*/\(.*\)'`
  1244.     (cd $dir && . $file)
  1245.     ;;
  1246.     *)
  1247.     . $file
  1248.     ;;
  1249.     esac
  1250. done
  1251. if test -f config.h.SH; then
  1252.     if test ! -f config.h; then
  1253.     : oops, they left it out of MANIFEST, probably, so do it anyway.
  1254.     . config.h.SH
  1255.     fi
  1256. fi
  1257.  
  1258. if $contains '^depend:' Makefile >/dev/null 2>&1; then
  1259.     dflt=n
  1260.     $cat <<EOM
  1261.  
  1262. Now you need to generate make dependencies by running "make depend".
  1263. You might prefer to run it in background: "make depend > makedepend.out &"
  1264. It can take a while, so you might not want to run it right now.
  1265.  
  1266. EOM
  1267.     rp="Run make depend now? [$dflt]"
  1268.     $echo $n "$rp $c"
  1269.     . UU/myread
  1270.     case "$ans" in
  1271.     y*) make depend
  1272.     echo "Now you must run a make."
  1273.     ;;
  1274.     *)  echo "You must run 'make depend' then 'make'."
  1275.     ;;
  1276.     esac
  1277. elif test -f Makefile; then
  1278.     echo " "
  1279.     echo "Now you must run a make."
  1280. else
  1281.     echo "Done."
  1282. fi
  1283.  
  1284. $rm -f kit*isdone
  1285. : the following is currently useless
  1286. cd UU && $rm -f $rmlist
  1287. : since this removes it all anyway
  1288. cd .. && $rm -rf UU
  1289. : end of Configure
  1290.