home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sources / misc / 4102 / Configure.b
Encoding:
Text File  |  1992-11-19  |  33.5 KB  |  1,581 lines

  1.     rp="Shall I ignore $ans() from now on?"
  2.     . myread
  3.     case "$ans" in
  4.     y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
  5.     esac;;
  6. esac
  7. case "$phostname" in
  8. '') aphostname='';;
  9. *) case "$aphostname" in
  10.     /*) ;;
  11.     *) set X $phostname
  12.         shift
  13.         file=$1
  14.         shift
  15.         file=`loc $file $file $pth`
  16.         aphostname=`echo $file $*`
  17.         ;;
  18.     esac
  19.     ;;
  20. esac
  21. case "$d_uname$d_gethname" in
  22. *define*) ;;
  23. *)
  24.     case "$phostname" in
  25.     '') ;;
  26.     *)
  27.         $cat <<EOT
  28.  
  29. There is no gethostname() or uname() on this system.  You have two
  30. possibilities at this point:
  31.  
  32. 1)  You can have your host name ($hostname) compiled into $package, which
  33.     lets $package start up faster, but makes your binaries non-portable, or
  34. 2)  you can have $package use a
  35.     
  36.     popen("$aphostname","r")
  37.  
  38.     which will start slower but be more portable.
  39.  
  40. If you want option 2 but with a different command, you can edit config.sh at
  41. the end of this shell script.
  42.  
  43. EOT
  44.         case "$d_phostname" in
  45.         "$define") dflt=n;;
  46.         "$undef")  dflt=y;;
  47.         '')
  48.             case "$d_portable" in
  49.             "$define") dflt=n ;;
  50.             *) dflt=y ;;
  51.             esac;;
  52.         esac
  53.         rp="Do you want your host name compiled in?"
  54.         . myread
  55.         case "$ans" in
  56.         n*)d_phostname="$define" ;;
  57.         *) phostname=''; d_phostname="$undef";;
  58.         esac;;
  59.     esac
  60.     case "$phostname" in
  61.     '')
  62.         echo 'No hostname function--hardwiring "'$hostname'".';;
  63.     esac;;
  64. esac
  65.  
  66. : determine where public executables go
  67. case "$bin" in
  68. '')
  69.     dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
  70.     ;;
  71. *)  dflt="$bin"
  72.     ;;
  73. esac
  74. cont=true
  75. while $test "$cont" ; do
  76.     echo " "
  77.     rp="Where do you want to put the public executables? (~name ok)"
  78.     . myread
  79.     bin="$ans"
  80.     bin=`filexp $bin`
  81.     if test -d $bin; then
  82.     cont=''
  83.     else
  84.     dflt=n
  85.     rp="Directory $bin doesn't exist.  Use that name anyway?"
  86.     . myread
  87.     dflt=''
  88.     case "$ans" in
  89.     y*) cont='';;
  90.     esac
  91.     fi
  92. done
  93.  
  94. : determine optimize, if desired, or use for debug flag also
  95. case "$optimize" in
  96. ' ') dflt="none";;
  97. '') dflt="-O";;
  98. *) dflt="$optimize";;
  99. esac
  100. $cat <<EOH
  101.  
  102. Some C compilers have problems with their optimizers, by default, $package
  103. compiles with the -O flag to use the optimizer.  Alternately, you might want to
  104. use the symbolic debugger, which uses the -g flag (on traditional Unix systems).
  105. Either flag can be specified here. To use neither flag, specify the word "none".
  106.  
  107. EOH
  108. rp="What optimizer/debugger flag should be used?"
  109. . myread
  110. optimize="$ans"
  111. case "$optimize" in
  112. 'none') optimize=" ";;
  113. esac
  114.  
  115. case "$ccflags" in
  116. '') case "$cc" in
  117.     *gcc*) dflt='-fpcc-struct-return';;
  118.     *) dflt='';;
  119.     esac
  120.     ;;
  121. *) dflt="$ccflags"
  122.     case "$cc" in
  123.     *gcc*) case "$dflt" in
  124.         *-fpcc-struct-return*) ;;
  125.         *) dflt="$dflt -fpcc-struct-return";;
  126.         esac;;
  127.     esac;;
  128. esac
  129.  
  130. case "$mips_type" in
  131. *BSD*) ;;
  132. '') ;;
  133. *) inclwanted="$inclwanted $usrinc/bsd";;
  134. esac
  135. for thisincl in $inclwanted; do
  136.     if $test -d $thisincl; then
  137.         if $test x$thisincl != x$usrinc; then
  138.             case "$dflt" in
  139.             *$thisincl*);;
  140.             *) dflt="$dflt -I$thisincl";;
  141.             esac
  142.         fi
  143.     fi
  144. done
  145.  
  146. case "$optimize" in
  147. -g*)
  148.     case "$dflt" in
  149.     *DEBUG*);;
  150.     *) dflt="$dflt -DDEBUG";;
  151.     esac
  152.     ;;
  153. esac
  154. if $contains 'LANGUAGE_C' $usrinc/signal.h >/dev/null 2>&1; then
  155.     case "$dflt" in
  156.     *LANGUAGE_C*);;
  157.     *) dflt="$dflt -DLANGUAGE_C";;
  158.     esac
  159. elif $contains 'LANGUAGE_C' $usrinc/sys/signal.h >/dev/null 2>&1; then
  160.     case "$dflt" in
  161.     *LANGUAGE_C*);;
  162.     *) dflt="$dflt -DLANGUAGE_C";;
  163.     esac
  164. fi
  165. if $contains 'NO_PROTOTYPE' $usrinc/signal.h >/dev/null 2>&1; then
  166.     case "$dflt" in
  167.     *NO_PROTOTYPE*);;
  168.     *) dflt="$dflt -DNO_PROTOTYPE";;
  169.     esac
  170. elif $contains 'NO_PROTOTYPE' $usrinc/sys/signal.h >/dev/null 2>&1; then
  171.     case "$dflt" in
  172.     *NO_PROTOTYPE*);;
  173.     *) dflt="$dflt -DNO_PROTOTYPE";;
  174.     esac
  175. fi
  176. if $contains '_NO_PROTO' $usrinc/signal.h >/dev/null 2>&1; then
  177.     case "$dflt" in
  178.     *_NO_PROTO*);;
  179.     *) dflt="$dflt -D_NO_PROTO";;
  180.     esac
  181. elif $contains '_NO_PROTO' $usrinc/sys/signal.h >/dev/null 2>&1; then
  182.     case "$dflt" in
  183.     *_NO_PROTO*);;
  184.     *) dflt="$dflt -D_NO_PROTO";;
  185.     esac
  186. fi
  187. case "$dflt" in
  188. '') dflt=none;;
  189. esac
  190. $cat <<EOH
  191.  
  192. Your C compiler may want other flags.  For this question you should include
  193. -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
  194. but you should NOT include libraries or ld flags like -lwhatever.  To use no
  195. flags, specify the word "none".
  196.  
  197. EOH
  198. set X $dflt
  199. shift
  200. dflt=${1+"$@"}
  201. rp="Any additional cc flags?"
  202. . myread
  203. case "$ans" in
  204. none) ans='';
  205. esac
  206. ccflags="$ans"
  207.  
  208. : the following weeds options from ccflags that are of no interest to cpp
  209. cppflags="$ccflags"
  210. case "$cc" in
  211. *gcc*) cppflags="$cppflags -D__GNUC__";;
  212. esac
  213. case "$mips_type" in
  214. '');;
  215. *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
  216. esac
  217. case "$cppflags" in
  218. '');;
  219. *)  set X $cppflags
  220.     cppflags=''
  221.     for flag
  222.     do
  223.         case $flag in
  224.         -D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
  225.         esac
  226.     done
  227.     case "$cppflags" in
  228.     *-*)  echo "(C preprocessor flags: $cppflags)";;
  229.     esac
  230.     ;;
  231. esac
  232.  
  233. : flags used in final linking phase
  234. case "$ldflags" in
  235. '') if venix; then
  236.         dflt='-i -z'
  237.     else
  238.         dflt='none'
  239.     fi
  240.     ;;
  241. *) dflt="$ldflags";;
  242. esac
  243. echo " "
  244. rp="Any additional ld flags (NOT including libraries)?"
  245. . myread
  246. case "$ans" in
  247. none) ans='';
  248. esac
  249. ldflags="$ans"
  250. rmlist="$rmlist pdp11"
  251.  
  252. : set up the script used to warn in case of inconsistency
  253. cat <<'EOSC' >whoa
  254. dflt=y
  255. echo ' '
  256. echo "*** WHOA THERE!!! ***"
  257. echo "    The $hint value for \$$var on this machine was \"$was\"!"
  258. rp="    Keep the $hint value?"
  259. . myread
  260. case "$ans" in
  261. y) td=$was; tu=$was;;
  262. esac
  263. EOSC
  264.  
  265. : define an is-in-libc? function
  266. inlibc='echo " "; td=$define; tu=$undef;
  267. var=$2; eval "was=\$$2";
  268. if $contains "^$1\$" libc.list >/dev/null 2>&1;
  269. then echo "$1() found.";
  270.     eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
  271. else echo "$1() not found.";
  272.     eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi'
  273.  
  274. : see if bcopy exists
  275. case "$d_bcopy" in
  276. $define) d_bcopy="$undef";;
  277. $undef) d_bcopy="$define";;
  278. esac
  279. set bcopy d_bcopy
  280. eval $inlibc
  281. case "$d_bcopy" in
  282. $define) d_bcopy="$undef";;
  283. *) d_bcopy="$define";;
  284. esac
  285.  
  286. : function used to set $1 to $val
  287. setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
  288. case "$val$was" in
  289. $define$undef) . whoa; eval "$var=\$td";;
  290. $undef$define) . whoa; eval "$var=\$tu";;
  291. *) eval "$var=$val";;
  292. esac'
  293.  
  294. : see which of string.h or strings.h is needed
  295. echo " "
  296. strings=`loc string.h "" $usrinc $inclwanted`
  297. val="$undef"
  298. if $test -r "$strings"; then
  299.     echo "Using <string.h> instead of <strings.h>."
  300.     if bsd; then
  301.         echo "(Actually, this looks more like it were an USG system)"
  302.     fi
  303.     val="$define"
  304. else
  305.     strings=`loc strings.h "" $usrinc $inclwanted`
  306.     if $test -r "$strings"; then
  307.         echo "Using <strings.h> instead of <string.h>."
  308.         if usg; then
  309.             echo "(Actually, this looks more like it were a BSD system)"
  310.         fi
  311.     else
  312.         echo "No string header found--You'll surely have problems."
  313.     fi
  314. fi
  315. set i_string
  316. eval $setvar
  317.  
  318. : index or strchr
  319. echo " "
  320. case "$d_index" in
  321. n) dflt=n;;
  322. *) dflt=y;;
  323. esac
  324. if $contains '^index$' libc.list >/dev/null 2>&1 ; then
  325.     if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
  326.         if $contains strchr "$strings" >/dev/null 2>&1 ; then
  327.             if $contains index "$strings" >/dev/null 2>&1 ; then
  328.                 echo "Your system has both index() and strchr()."
  329.                 rp="Shall I use index() rather than strchr()?"
  330.                 . myread
  331.                 case "$ans" in
  332.                     n*) val="$define" ;;
  333.                     *)  val="$undef" ;;
  334.                 esac
  335.             else
  336.                 val="$define"
  337.                 echo "strchr() found."
  338.             fi
  339.         else
  340.             val="$undef"
  341.             echo "index() found."
  342.         fi
  343.     else
  344.         val="$undef"
  345.         echo "index() found."
  346.     fi
  347. else
  348.     if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
  349.         val="$define"
  350.         echo "strchr() found."
  351.     else
  352.         echo "No index() or strchr() found!"
  353.         val="$undef"
  354.     fi
  355. fi
  356. set d_index
  357. eval $setvar
  358.  
  359. : see if rename exists
  360. set rename d_rename
  361. eval $inlibc
  362.  
  363. : see if strerror and/or sys_errlist[] exist
  364. echo " "
  365. if $contains '^strerror$' libc.list >/dev/null 2>&1; then
  366.     echo 'strerror() found.'
  367.     d_strerror="$define"
  368.     d_strerrm="$undef"
  369.     if $contains 'sys_errlist' libc.tmp >/dev/null 2>&1; then    
  370.         echo "You also have sys_errlist[]."
  371.         d_syserrlst="$define"
  372.     else
  373.         echo "But you don't have sys_errlist[]."
  374.         d_syserrlst="$undef"
  375.     fi
  376. elif $contains '#[     ]*define.*strerror' $usrinc/string*.h >/dev/null 2>&1; then
  377.     echo 'strerror() found in string header.'
  378.     d_strerror="$define"
  379.     d_strerrm="$undef"
  380.     if $contains 'sys_errlist' libc.tmp >/dev/null 2>&1; then    
  381.         echo "You also have sys_errlist[]."
  382.         d_syserrlst="$define"
  383.     else
  384.         echo "But you don't have sys_errlist[]."
  385.         d_syserrlst="$undef"
  386.     fi
  387. elif $contains 'sys_errlist' libc.tmp >/dev/null 2>&1; then
  388.     echo "strerror() not found, but you have sys_errlist[] so we'll use that."
  389.     d_strerror="$undef"
  390.     d_syserrlst="$define"
  391.     d_strerrm="$define"
  392. else
  393.     echo 'strerror() and sys_errlist[] not found.'
  394.     d_strerror="$undef"
  395.     d_syserrlst="$undef"
  396.     d_strerrm="$undef"
  397. fi
  398. if $contains 'sys_errnolist' libc.tmp >/dev/null 2>&1; then
  399.     echo " "
  400.     echo "Symbolic error codes for errno are kept in sys_errnolist[]."
  401.     d_sysernlst="$define"
  402. else
  403.     d_sysernlst="$undef"
  404. fi
  405.  
  406. : see if union wait is available
  407. echo " "
  408. if $contains 'int.*w_status;' $usrinc/sys/wait.h >/dev/null 2>&1 ; then
  409.     echo "Looks like we have to use 'union wait' pointer for wait()."
  410.     val="$define"
  411. else
  412.     echo "Your wait() should be happy with a plain 'int' pointer."
  413.     val="$undef"
  414. fi
  415. set d_uwait
  416. eval $setvar
  417.  
  418. : see if there is a vfork
  419. echo " "
  420. if $contains '^vfork$' libc.list >/dev/null 2>&1 ; then
  421.     echo "vfork() found."
  422.     val="$undef"
  423. else
  424.     echo "No vfork() found--will use fork() instead."
  425.     val="$define"
  426. fi
  427. set d_vfork
  428. eval $setvar
  429.  
  430. : now get the host name to advertise as our mailing address
  431. case "$hiddennet" in
  432. '') dflt=n;;
  433. *) dflt=y;;
  434. esac
  435. $cat <<EOM
  436.  
  437. Some sites are on "hidden" networks, in the sense that the network appears
  438. to the outside world as a single machine.  The advertised name of any host
  439. on this hidden network is the name of one machine on the local network which
  440. knows how to forward mail to any other host on the hidden network.
  441.  
  442. Do you wish to advertise a different hostname to the world than the one your
  443. own host ($hostname$mydomain) has?
  444.  
  445. EOM
  446. rp='Use "hidden" network?'
  447. . myread
  448. case "$ans" in
  449. n*) d_hidnet="$undef" hiddennet='';;
  450. *)
  451.     d_hidnet="$define"
  452.     echo " "
  453.     case "$hiddennet" in
  454.     '') dflt=`echo $mydomain | $sed -e 's/^\.//'`;;
  455.     *) dflt="$hiddennet";;
  456.     esac
  457.     rp="What hostname do you wish to advertise?"
  458.     . myread
  459.     hiddennet="$ans"
  460.     ;;
  461. esac
  462.  
  463. : see if this is an fcntl system
  464. echo " "
  465. if $test -r $usrinc/fcntl.h ; then
  466.     val="$define"
  467.     echo "<fcntl.h> found."
  468. else
  469.     val="$undef"
  470.     echo "No <fcntl.h> found, but that's ok."
  471. fi
  472. set i_fcntl
  473. eval $setvar
  474.  
  475. : define an alternate in-header-list? function
  476. inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
  477. cont=true; xxf="echo \"<\$1> found.\"";
  478. case $# in 2) xxnf="echo \"No <\$1> found.\"";;
  479. *) xxnf="echo \"No <\$1> found, ...\"";;
  480. esac;
  481. case $# in 4) instead=instead;; *) instead="at last";; esac;
  482. while $test "$cont";
  483. do xxx=`loc $1 x $usrinc /usr/local/include $inclwanted`;
  484.     var=$2; eval "was=\$$2";
  485.     if $test -f $xxx;
  486.     then eval $xxf;
  487.         eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
  488.         cont="";
  489.     else eval $xxnf;
  490.         eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
  491.     set $yyy; shift; shift; yyy=$@;
  492.     case $# in 0) cont="";;
  493.     2) xxf="echo \"but I found <\$1> $instead.\"";
  494.         xxnf="echo \"and I did not find <\$1> either.\"";;
  495.     *) xxf="echo \"but I found <\$1\> instead.\"";
  496.         xxnf="echo \"there is no <\$1>, ...\"";;
  497.     esac;
  498. done;
  499. while $test "$yyy";
  500. do set $yyy; var=$2; eval "was=\$$2";
  501.     eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
  502.     set $yyy; shift; shift; yyy=$@;
  503. done'
  504.  
  505. : see if this is a sys/file.h system
  506. set sys/file.h i_sysfile
  507. eval $inhdr
  508.  
  509. : see if we should include time.h, sys/time.h, or both
  510. echo " "
  511. echo "Testing to see if we should include <time.h>, <sys/time.h> or both."
  512. $echo $n "I'm now running the test program...$c"
  513. $cat >try.c <<'EOCP'
  514. #include <sys/types.h>
  515. #ifdef I_TIME
  516. #include <time.h>
  517. #endif
  518. #ifdef I_SYSTIME
  519. #ifdef SYSTIMEKERNEL
  520. #define KERNEL
  521. #endif
  522. #include <sys/time.h>
  523. #endif
  524. #ifdef I_SYSSELECT
  525. #include <sys/select.h>
  526. #endif
  527. main()
  528. {
  529.     struct tm foo;
  530. #ifdef S_TIMEVAL
  531.     struct timeval bar;
  532. #endif
  533. #ifdef S_TIMEZONE
  534.     struct timezone tzp;
  535. #endif
  536.     if (foo.tm_sec == foo.tm_sec)
  537.     exit(0);
  538. #ifdef S_TIMEVAL
  539.     if (bar.tv_sec == bar.tv_sec)
  540.     exit(0);
  541. #endif
  542.     exit(1);
  543. }
  544. EOCP
  545. flags=''
  546. for s_timezone in '-DS_TIMEZONE' ''; do
  547. sysselect=''
  548. for s_timeval in '-DS_TIMEVAL' ''; do
  549. for i_systimek in '' '-DSYSTIMEKERNEL'; do
  550. for i_time in '' '-DI_TIME'; do
  551. for i_systime in '-DI_SYSTIME' ''; do
  552.     case "$flags" in
  553.     '') $echo $n ".$c"
  554.         if $cc $ccflags \
  555.         $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \
  556.         try.c -o try >/dev/null 2>&1 ; then
  557.             set X $i_time $i_systime $i_systimek $sysselect $s_timeval
  558.             shift
  559.             flags="$*"
  560.             echo " "
  561.             $echo $n "Succeeded with $flags$c"
  562.         fi
  563.         ;;
  564.     esac
  565. done
  566. done
  567. done
  568. done
  569. done
  570. timeincl=''
  571. echo " "
  572. case "$flags" in
  573. *SYSTIMEKERNEL*) i_systimek="$define"
  574.     timeincl="$usrinc/sys/time.h"
  575.     echo "We'll include <sys/time.h> with KERNEL defined.";;
  576. *) i_systimek="$undef";;
  577. esac
  578. case "$flags" in
  579. *I_TIME*) i_time="$define"
  580.     timeincl="$usrinc/time.h $timeincl"
  581.     echo "We'll include <time.h>.";;
  582. *) i_time="$undef";;
  583. esac
  584. case "$flags" in
  585. *I_SYSTIME*) i_systime="$define"
  586.     timeincl="$usrinc/sys/time.h $timeincl"
  587.     echo "We'll include <sys/time.h>.";;
  588. *) i_systime="$undef";;
  589. esac
  590. $rm -f try.c try
  591.  
  592. : see if this is a syswait system
  593. set sys/wait.h i_syswait
  594. eval $inhdr
  595.  
  596. : check for length of integer
  597. echo " "
  598. case "$intsize" in
  599. '')
  600.     echo "Checking to see how big your integers are..."
  601.     $cat >try.c <<'EOCP'
  602. #include <stdio.h>
  603. main()
  604. {
  605.     printf("%d\n", sizeof(int));
  606. }
  607. EOCP
  608.     if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
  609.         dflt=`./try`
  610.     else
  611.         dflt='4'
  612.         echo "(I can't seem to compile the test program.  Guessing...)"
  613.     fi
  614.     ;;
  615. *)
  616.     dflt="$intsize"
  617.     ;;
  618. esac
  619. rp="What is the size of an integer (in bytes)?"
  620. . myread
  621. intsize="$ans"
  622. $rm -f try.c try
  623.  
  624. : determine where mail is spooled
  625. case "$maildir" in
  626. '') dflt=`loc . /usr/spool/mail /usr/spool/mail /usr/mail`;;
  627. *) dflt="$maildir";;
  628. esac
  629. cont=true
  630. while $test "$cont" ; do
  631.     echo " "
  632.     rp="Where is yet-to-be-read mail spooled?"
  633.     . myread
  634.     maildir=`filexp "$ans"`
  635.     if $test -d "$maildir"; then
  636.         cont=''
  637.     else
  638.         dflt=n
  639.         rp="Directory $maildir doesn't exist.  Use that name anyway?"
  640.         . myread
  641.         dflt=''
  642.         case "$ans" in
  643.         y*) cont='';;
  644.         esac
  645.     fi
  646. done
  647.  
  648. : determine where mail is spooled
  649. case "$mailfile" in
  650. '')
  651.     dflt="$maildir"
  652.     case "$dflt" in
  653.     '') dflt='%~/mailbox';;
  654.     *) dflt="$dflt/%L";;
  655.     esac
  656.     ;;
  657. *)  dflt="$mailfile"
  658.     ;;
  659. esac
  660. cat <<'EOM'
  661.  
  662. In the following question, you may use %~ to represent the user's home
  663. directory, and %L to represent a users name.
  664.  
  665. EOM
  666. rp="In which file is yet-to-be-read mail spooled?"
  667. . myread
  668. mailfile=`filexp "$ans"`
  669.  
  670. : determine where manual pages go
  671. $cat <<EOM
  672.  
  673. $package has manual pages available in source form.
  674. EOM
  675. case "$nroff" in
  676. nroff)
  677.     echo "However, you don't have nroff, so they're probably useless to you."
  678.     case "$mansrc" in
  679.     '') mansrc="none";;
  680.     esac;;
  681. esac
  682. echo "If you don't want the manual sources installed, answer 'none'."
  683. case "$mansrc" in
  684. '')
  685.     dflt="$sysman"
  686.     ;;
  687. *)  dflt="$mansrc"
  688.     ;;
  689. esac
  690. cont=true
  691. while $test "$cont" ; do
  692.     echo " "
  693.     rp="Where do the manual pages (source) go? (~name ok)"
  694.     . myread
  695.     case "$ans" in
  696.     'none') mansrc=''
  697.         cont='';;
  698.     *)
  699.         mansrc=`filexp "$ans"`
  700.         if test -d "$mansrc"; then
  701.             cont=''
  702.         else
  703.             dflt=n
  704.             rp="Directory $mansrc doesn't exist.  Use that name anyway?"
  705.             . myread
  706.             dflt=''
  707.             case "$ans" in
  708.             y*) cont='';;
  709.             esac
  710.         fi;;
  711.     esac
  712. done
  713. case "$mansrc" in
  714. '') manext='0';;
  715. *l) manext=l;;
  716. *n) manext=n;;
  717. *o) manext=l;;
  718. *p) manext=n;;
  719. *C) manext=C;;
  720. *L) manext=L;;
  721. *) manext=1;;
  722. esac
  723.  
  724. : find out how to generate dependencies
  725. echo " "
  726. echo "Checking how to generate makefile dependencies on your machine..."
  727. toplev=`cd ..;pwd`
  728. $cat >dep.c <<'EOCP'
  729. #include "dep.h"
  730. EOCP
  731. $cat >dep.h <<'EOCP'
  732.  
  733. EOCP
  734. takeflags='flags=""
  735. case "$@" in
  736. *--*)
  737.     for arg
  738.     do
  739.         shift
  740.         case "$arg" in
  741.         --) break;;
  742.         *) flags="$flags $arg";;
  743.         esac
  744.     done;;
  745. esac'
  746. case "$mkdep" in
  747. '')
  748.     ;;
  749. *)
  750.     if test -x "$mkdep" &&
  751.         $mkdep dep.c >dep.out 2>/dev/null &&
  752.         $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
  753.     then
  754.         echo "$mkdep works."
  755.     else
  756.         mkdep=
  757.     fi
  758. esac
  759.  
  760. case "$mkdep" in
  761. '')
  762.     $spitshell > ../mkdep <<EOM
  763. $startsh
  764. $takeflags
  765. for srcfile
  766. do
  767.     $cpp -M -I. $cppflags \$flags \$srcfile 2>/dev/null
  768. done
  769. EOM
  770.     mkdep=$toplev/mkdep
  771.     chmod +x $mkdep
  772.     $eunicefix $mkdep
  773.     if $mkdep dep.c >dep.out 2>/dev/null &&
  774.         $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
  775.     then
  776.         echo "Looks like we can use $cpp -M."
  777.     else
  778.         mkdep=
  779.     fi
  780.     ;;
  781. esac
  782.  
  783. case "$mkdep" in
  784. '')
  785.     $spitshell >../mkdep <<EOS
  786. $startsh
  787. $takeflags
  788. for srcfile
  789. do
  790.     case "\$srcfile" in
  791.     *.c) c='.c';;
  792.     *.y) c='.y';;
  793.     *.l) c='.l';;
  794.     esac
  795.     filebase=\`basename \$srcfile \$c\`
  796.     <\$srcfile $cpp $cppminus $cppflags -I. \$flags 2>/dev/null | \\
  797.     $sed -e '/^# *[0-9]/!d' \\
  798.         -e 's/^.*"\(.*\)".*\$/'\$filebase'.o: \1/' \\
  799.         -e 's|: \./|: |' \\
  800.         -e 's|: *$|: '\$srcfile'|' | \\
  801.     $grep -v '^#' | $sort | $uniq
  802. done
  803. EOS
  804.     mkdep=$toplev/mkdep
  805.     chmod +x $mkdep
  806.     $eunicefix $mkdep
  807.     if $mkdep dep.c >dep.out 2>/dev/null &&
  808.         $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
  809.     then
  810.         echo "A shell script using $cpp does the trick."
  811.     else
  812.         echo "$cpp doesn't seem to be any use at all."
  813.         $spitshell >../mkdep <<EOS
  814. $startsh
  815. $takeflags
  816. for srcfile
  817. do
  818.     case "\$srcfile" in
  819.     *.c) c='.c';;
  820.     *.y) c='.y';;
  821.     *.l) c='.l';;
  822.     esac
  823.     filebase=\`basename \$srcfile \$c\`
  824.     echo \$filebase.o: \$srcfile
  825.     $grep '^#[  ]*include' \$srcfile /dev/null |
  826.     $sed -e 's/#[   ]*include[  ]*//' \\
  827.         -e 's,<\(.*\)>,"$usrinc/\1",' \\
  828.         -e 's/:[^"]*"\([^"]*\)".*/: \1/' \\
  829.         -e 's/\.c:/\.o:/'
  830. done
  831. EOS
  832.         mkdep=$toplev/mkdep
  833.         chmod +x $mkdep
  834.         $eunicefix $mkdep
  835.         if $mkdep dep.c >dep.out 2>/dev/null &&
  836.             $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
  837.         then
  838.             cat << EOM
  839.  
  840. I can use a script with grep instead, but it will make some incorrect
  841. dependencies, since it doesn't understand about conditional compilation.
  842. Moreover, some dependencies may be missing, because scanning won't be
  843. a recursive process.
  844. If you have a program which generates makefile dependencies, you may want
  845. to use it.  If not, you can use the script and edit the Makefile by hand
  846. if you need to.
  847. EOM
  848.         else
  849.             mkdep=
  850.             cat << EOM
  851.  
  852. I can't seem to generate makefile dependencies at all!  Perhaps you have a
  853. program that does?  If you don't, you might look at the mkdep script to
  854. see if you can create one which works.
  855. EOM
  856.         fi
  857.     fi
  858. esac
  859. cont=true
  860. dflt="$mkdep"
  861. while $test "$cont" ; do
  862.     echo " "
  863. rp="Name of program to make makefile dependencies?"
  864. . myread
  865. mkdep="$ans"
  866. mkdep=`filexp $mkdep`
  867. if test -f "$mkdep"; then
  868.     cont=''
  869. else
  870.     dflt=n
  871.     rp="$mkdep doesn't exist.  Use that name anyway?"
  872.     . myread
  873.     dflt=''
  874.     case "$ans" in
  875.     y*) cont='';;
  876.     esac
  877. fi
  878. done
  879. $rm -f dep.c dep.h dep.o dep.out
  880.  
  881. : get organization name
  882. longshots='/usr/src/new /usr/src/local /usr/local/src'
  883. case "$orgname" in
  884. '') if xxx=`loc news/src/defs.h x $longshots`; then
  885.         dflt=`$sed -n 's/^.*MYORG[     ]*"\(.*\)".*$/\1/p' $xxx`
  886.     else
  887.         dflt=''
  888.     fi
  889.     ;;
  890. *)  dflt="$orgname";;
  891. esac
  892. $cat << 'EOH'
  893.  
  894. Please type the name of your organization as you want it to appear on the
  895. Organization line of outgoing articles.  (It's nice if this also specifies
  896. your location.  Your city name is probably sufficient if well known.)
  897. For example:
  898.  
  899.     University of Southern North Dakota, Hoople
  900.  
  901. You may also put the name of a file, as long as it begins with a slash.
  902. For example:
  903.  
  904.     /etc/organization
  905.  
  906. EOH
  907. orgname=""
  908. while test "X$orgname" = "X"; do
  909.     rp="Organization:"
  910.     . myread
  911.     orgname="$ans"
  912. done
  913.  
  914. : determine perl absolute location
  915. case "$perlpath" in
  916. '')
  917.     if test -f /usr/bin/perl; then
  918.         dflt=/usr/bin/perl
  919.     else
  920.         case "$_perl" in
  921.         */*) dflt="$_perl";;
  922.         *) dflt=/usr/bin/perl;;
  923.         esac
  924.     fi
  925.     ;;
  926. *)  dflt="$perlpath"
  927.     ;;
  928. esac
  929. cont=true
  930. while $test "$cont" ; do
  931.     echo " "
  932.     rp="Where is perl located on your system?"
  933.     . myread
  934.     perlpath="$ans"
  935.     case "$ans" in
  936.     /*) if test -f $ans; then
  937.         cont=''
  938.     else
  939.         dflt=n
  940.         rp="File $ans doesn't exist.  Use that name anyway?"
  941.         . myread
  942.         dflt=''
  943.         case "$ans" in
  944.         y*) cont='';;
  945.         esac
  946.     fi
  947.     ;;
  948.     *) echo "Please use an absolute path name.";;
  949.     esac
  950. done
  951.  
  952. : see what type pids are declared as in the kernel
  953. case "$pidtype" in
  954. '')
  955.     if $contains 'pid_t;' $usrinc/sys/types.h >/dev/null 2>&1 ; then
  956.         dflt='pid_t';
  957.     else
  958.         dflt="int"
  959.     fi
  960.     ;;
  961. *)  dflt="$pidtype";;
  962. esac
  963. echo " "
  964. rp="What type are process ids on this system declared as?"
  965. . myread
  966. pidtype="$ans"
  967.  
  968. : determine where private executables go
  969. case "$privlib" in
  970. '')
  971.     dflt=/usr/lib/$package
  972.     test -d /usr/local/lib && dflt=/usr/local/lib/$package
  973.     ;;
  974. *)  dflt="$privlib"
  975.     ;;
  976. esac
  977. $cat <<EOM
  978.  
  979. The $package package has some auxiliary files that should be put in a library
  980. that is accessible by everyone.  Where do you want to put these "private" but
  981. accessible files?
  982.  
  983. EOM
  984. rp="Private library path? (~name ok)"
  985. . myread
  986. privlib="$ans"
  987. case "$d_portable" in
  988. "$undef")
  989.     privlib=`filexp $privlib`
  990.     ;;
  991. esac
  992.  
  993. : see how we invoke the C preprocessor
  994. echo " "
  995. echo "Now, how can we feed standard input to your C preprocessor..."
  996. cat <<'EOT' >testcpp.c
  997. #define ABC abc
  998. #define XYZ xyz
  999. ABC.XYZ
  1000. EOT
  1001. cd ..
  1002. echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
  1003. chmod 755 cppstdin
  1004. wrapper=`pwd`/cppstdin
  1005. cd UU
  1006. if test "X$cppstdin" != "X" && \
  1007.     $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
  1008.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1009.     echo "You used to use $cppstdin $cppminus so we'll use that again."
  1010. elif test "$cc" = gcc && \
  1011.     (echo "Using gcc, eh?  We'll try to force gcc -E using a wrapper..."; \
  1012.     $wrapper <testcpp.c >testcpp.out 2>&1; \
  1013.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
  1014.     echo "Yup, we can."
  1015.     cppstdin="$wrapper"
  1016.     cppminus='';
  1017. elif echo 'Maybe "'"$cc"' -E" will work...'; \
  1018.     $cc -E <testcpp.c >testcpp.out 2>&1; \
  1019.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1020.     echo "Yup, it does."
  1021.     cppstdin="$cc -E"
  1022.     cppminus='';
  1023. elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
  1024.     $cc -E - <testcpp.c >testcpp.out 2>&1; \
  1025.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1026.     echo "Yup, it does."
  1027.     cppstdin="$cc -E"
  1028.     cppminus='-';
  1029. elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
  1030.     $wrapper <testcpp.c >testcpp.out 2>&1; \
  1031.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1032.     cppstdin="$wrapper"
  1033.     cppminus=''
  1034.     echo "Eureka!"
  1035. elif echo 'No such luck, maybe "'$cpp'" will work...'; \
  1036.     $cpp <testcpp.c >testcpp.out 2>&1; \
  1037.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1038.     echo "It works!"
  1039.     cppstdin="$cpp"
  1040.     cppminus='';
  1041. elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
  1042.     $cpp - <testcpp.c >testcpp.out 2>&1; \
  1043.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1044.     echo "Hooray, it works!  I was beginning to wonder."
  1045.     cppstdin="$cpp"
  1046.     cppminus='-';
  1047. elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
  1048.     $cc -P <testcpp.c >testcpp.out 2>&1; \
  1049.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1050.     echo "Yipee, that works!"
  1051.     cppstdin="$cc -P"
  1052.     cppminus='';
  1053. elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
  1054.     $cc -P - <testcpp.c >testcpp.out 2>&1; \
  1055.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1056.     echo "At long last!"
  1057.     cppstdin="$cc -P"
  1058.     cppminus='-';
  1059. else
  1060.     dflt=''
  1061.     rp="No dice.  I can't find a C preprocessor.  Name one:"
  1062.     . myread
  1063.     cppstdin="$ans"
  1064.     $cppstdin <testcpp.c >testcpp.out 2>&1
  1065.     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1066.         echo "OK, that will do."
  1067.     else
  1068.         echo "Sorry, I can't get that to work.  Go find one and rerun Configure."
  1069.         exit 1
  1070.     fi
  1071. fi
  1072. $rm -f testcpp.c testcpp.out
  1073.  
  1074. : get C preprocessor symbols handy
  1075. echo " "
  1076. echo $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know
  1077. $cat <<EOSS >Cppsym
  1078. $startsh
  1079. case "\$1" in
  1080. -l) list=true
  1081.     shift
  1082.     ;;
  1083. esac
  1084. unknown=''
  1085. case "\$list\$#" in
  1086. 1|2)
  1087.     for sym do
  1088.     if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  1089.         exit 0
  1090.     elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  1091.         :
  1092.     else
  1093.         unknown="\$unknown \$sym"
  1094.     fi
  1095.     done
  1096.     set X \$unknown
  1097.     shift
  1098.     ;;
  1099. esac
  1100. case \$# in
  1101. 0) exit 1;;
  1102. esac
  1103. echo \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\
  1104. #ifdef \1\\
  1105. exit 0; _ _ _ _\1\\     \1\\
  1106. #endif\\
  1107. /' >Cppsym\$\$
  1108. echo exit 1 >>Cppsym\$\$
  1109. $cppstdin $cppminus <Cppsym\$\$ >Cppsym2\$\$
  1110. case "\$list" in
  1111. true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
  1112. *)
  1113.     sh Cppsym2\$\$
  1114.     status=\$?
  1115.     ;;
  1116. esac
  1117. $rm -f Cppsym\$\$ Cppsym2\$\$
  1118. exit \$status
  1119. EOSS
  1120. chmod +x Cppsym
  1121. $eunicefix Cppsym
  1122. echo "Your C preprocessor defines the following symbols:"
  1123. Cppsym -l $attrlist >Cppsym.true
  1124. $cat Cppsym.true
  1125. rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
  1126.  
  1127. : see how many register declarations we want to use
  1128. case "$registers" in
  1129. '')
  1130.     if Cppsym vax; then
  1131.         dflt=6
  1132.     elif Cppsym sun mc68000 mips; then
  1133.         dflt=10
  1134.     elif Cppsym pyr; then
  1135.         dflt=14
  1136.     elif Cppsym ns32000 ns16000; then
  1137.         dflt=5
  1138.     elif Cppsym $smallmach; then
  1139.         dflt=3
  1140.     else
  1141.         : if you have any other numbers for me, please send them in
  1142.         dflt=6
  1143.     fi;;
  1144. *) dflt=$registers ;;
  1145. esac
  1146. cat <<EOM
  1147.  
  1148. Different C compilers on different machines pay attention to different numbers
  1149. of register declarations.  About how many register declarations in each routine
  1150. does your C compiler pay attention to?  (OK to guess)
  1151.  
  1152. EOM
  1153. rp="Maximum register declarations?"
  1154. . myread
  1155. registers=$ans
  1156. reg1=''
  1157. $awk "BEGIN { for (i=1; i<=16; i++) printf \"reg%d=''\n\", i}" </dev/null >.foo
  1158. . .foo
  1159. $awk "BEGIN { for (i=1; i<=$registers; i++) printf \"reg%d=register\n\", i}" \
  1160.     </dev/null >.foo
  1161. . .foo
  1162. $rm -f .foo
  1163.  
  1164. : determine where public executables go
  1165. case "$scriptdir" in
  1166. '')
  1167.     dflt="$bin"
  1168.     : guess some guesses
  1169.     $test -d /usr/share/scripts && dflt=/usr/share/scripts
  1170.     $test -d /usr/share/bin && dflt=/usr/share/bin
  1171.     ;;
  1172. *)  dflt="$scriptdir"
  1173.     ;;
  1174. esac
  1175. cont=true
  1176. $cat <<EOM
  1177.  
  1178. Some installations have a separate directory just for executable scripts so
  1179. that they can mount it across multiple architectures but keep the scripts in
  1180. one spot.  You might, for example, have a subdirectory of /usr/share for this.
  1181. Or you might just lump your scripts in with all your other executables.
  1182.  
  1183. EOM
  1184. while $test "$cont" ; do
  1185.     rp="Where do you keep publicly executable scripts? (~name ok)"
  1186.     . myread
  1187.     scriptdir="$ans"
  1188.     scriptdir=`./filexp "$scriptdir"`
  1189.     if $test -d $scriptdir; then
  1190.     cont=''
  1191.     else
  1192.     case "$fastread" in
  1193.     yes) dflt=y;;
  1194.     *) dflt=n;;
  1195.     esac
  1196.     rp="Directory $scriptdir doesn't exist.  Use that name anyway?"
  1197.     . myread
  1198.     dflt=''
  1199.     case "$ans" in
  1200.     y*) cont='';;
  1201.     esac
  1202.     fi
  1203. done
  1204.  
  1205. : see if signal is declared as pointer to function returning int or void
  1206. echo " "
  1207. $cppstdin $cppminus $cppflags < $usrinc/signal.h >$$.tmp
  1208. if $contains 'int.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  1209.     echo "You have int (*signal())() instead of void."
  1210.     val="$undef"
  1211.     signal_t="int"
  1212. elif $contains 'void.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  1213.     echo "You have void (*signal())() instead of int."
  1214.     val="$define"
  1215.     signal_t="void"
  1216. elif $contains 'extern[     ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
  1217.     echo "You have int (*signal())() instead of void."
  1218.     val="$undef"
  1219.     signal_t="int"
  1220. else
  1221.     case "$d_voidsig" in
  1222.     '') echo "I can't determine whether signal handler returns void or int..."
  1223.         dflt=void
  1224.         rp="What type does your signal handler returns?"
  1225.         . myread
  1226.         case "$ans" in
  1227.         void) val="$define"; signal_t="void";;
  1228.         *) val="$undef"; signal_t="int";;
  1229.         esac;;
  1230.     *) echo "As you already told me, signal handler returns $signal_t.";;
  1231.     esac
  1232. fi
  1233. set d_voidsig
  1234. eval $setvar
  1235. $rm -f $$.tmp
  1236.  
  1237. : see if time exists
  1238. echo " "
  1239. if $contains '^time$' libc.list >/dev/null 2>&1; then
  1240.     echo 'time() found.'
  1241.     val="$define"
  1242.     case "$timetype" in
  1243.     '')
  1244.         if $contains 'time_t;' $usrinc/sys/types.h >/dev/null 2>&1 ; then
  1245.             dflt='time_t';
  1246.         else
  1247.             dflt='long';
  1248.         fi
  1249.         ;;
  1250.     *)  dflt="$timetype"
  1251.         ;;
  1252.     esac
  1253.     cont=true
  1254.     echo " "
  1255.     rp="What type is returned by time() on this sytem?"
  1256.     . myread
  1257.     timetype="$ans"
  1258. else
  1259.     echo 'time() not found, hope that will do.'
  1260.     val="$undef"
  1261.     timetype='int';
  1262. fi
  1263. set d_time
  1264. eval $setvar
  1265.  
  1266. : see what type uids are declared as in the kernel
  1267. case "$uidtype" in
  1268. '')
  1269.     if $contains 'uid_t;' $usrinc/sys/types.h >/dev/null 2>&1 ; then
  1270.         dflt='uid_t';
  1271.     else
  1272.         set `grep '_ruid;' $usrinc/sys/user.h 2>/dev/null` unsigned short
  1273.         case $1 in
  1274.         unsigned) dflt="$1 $2" ;;
  1275.         *) dflt="$1" ;;
  1276.         esac
  1277.     fi
  1278.     ;;
  1279. *)  dflt="$uidtype";;
  1280. esac
  1281. echo " "
  1282. rp="What type are user ids on this system declared as?"
  1283. . myread
  1284. uidtype="$ans"
  1285.  
  1286. echo " "
  1287. echo "End of configuration questions."
  1288. echo " "
  1289.  
  1290. : create config.sh file
  1291. echo " "
  1292. if test -d ../UU; then
  1293.     cd ..
  1294. fi
  1295. echo "Creating config.sh..."
  1296. xxx=`$date 2>&1`
  1297. yyy=`( (logname) 2>/dev/null || whoami) 2>&1`
  1298. $spitshell <<EOT >config.sh
  1299. $startsh
  1300. #
  1301. # This file was produced by running the Configure script. It holds all the
  1302. # definitions figured out by Configure. Should you modify one of these values,
  1303. # do not forget to propagate your changes by running "Configure -d". You may
  1304. # instead choose to run each of the .SH files by yourself.
  1305. #
  1306.  
  1307. # Configuration time: $xxx 
  1308. # Configured by: $yyy
  1309. # Target system: $myuname
  1310.  
  1311. d_bsd='$d_bsd'
  1312. d_eunice='$d_eunice'
  1313. d_xenix='$d_xenix'
  1314. eunicefix='$eunicefix'
  1315. Mcc='$Mcc'
  1316. awk='$awk'
  1317. bison='$bison'
  1318. cat='$cat'
  1319. chgrp='$chgrp'
  1320. chmod='$chmod'
  1321. chown='$chown'
  1322. compress='$compress'
  1323. cp='$cp'
  1324. cpio='$cpio'
  1325. cpp='$cpp'
  1326. csh='$csh'
  1327. date='$date'
  1328. echo='$echo'
  1329. egrep='$egrep'
  1330. emacs='$emacs'
  1331. expr='$expr'
  1332. grep='$grep'
  1333. inews='$inews'
  1334. less='$less'
  1335. line='$line'
  1336. lint='$lint'
  1337. ln='$ln'
  1338. lp='$lp'
  1339. lpr='$lpr'
  1340. ls='$ls'
  1341. mail='$mail'
  1342. mailx='$mailx'
  1343. make='$make'
  1344. mkdir='$mkdir'
  1345. more='$more'
  1346. mv='$mv'
  1347. nroff='$nroff'
  1348. perl='$perl'
  1349. pg='$pg'
  1350. pmake='$pmake'
  1351. pr='$pr'
  1352. rm='$rm'
  1353. rmail='$rmail'
  1354. sed='$sed'
  1355. sendmail='$sendmail'
  1356. sleep='$sleep'
  1357. smail='$smail'
  1358. sort='$sort'
  1359. submit='$submit'
  1360. tail='$tail'
  1361. tar='$tar'
  1362. tbl='$tbl'
  1363. test='$test'
  1364. touch='$touch'
  1365. tr='$tr'
  1366. troff='$troff'
  1367. uname='$uname'
  1368. uniq='$uniq'
  1369. uuname='$uuname'
  1370. vi='$vi'
  1371. zcat='$zcat'
  1372. myuname='$myuname'
  1373. Author='$Author'
  1374. Date='$Date'
  1375. Header='$Header'
  1376. Id='$Id'
  1377. Locker='$Locker'
  1378. Log='$Log'
  1379. RCSfile='$RCSfile'
  1380. Revision='$Revision'
  1381. Source='$Source'
  1382. State='$State'
  1383. bin='$bin'
  1384. cc='$cc'
  1385. ccflags='$ccflags'
  1386. cppflags='$cppflags'
  1387. ldflags='$ldflags'
  1388. lkflags='$lkflags'
  1389. optimize='$optimize'
  1390. contains='$contains'
  1391. cppminus='$cppminus'
  1392. cppstdin='$cppstdin'
  1393. d_bcopy='$d_bcopy'
  1394. aphostname='$aphostname'
  1395. d_gethname='$d_gethname'
  1396. d_phostname='$d_phostname'
  1397. d_uname='$d_uname'
  1398. d_hidnet='$d_hidnet'
  1399. hiddennet='$hiddennet'
  1400. d_index='$d_index'
  1401. d_portable='$d_portable'
  1402. d_rename='$d_rename'
  1403. d_strerrm='$d_strerrm'
  1404. d_strerror='$d_strerror'
  1405. d_sysernlst='$d_sysernlst'
  1406. d_syserrlst='$d_syserrlst'
  1407. d_time='$d_time'
  1408. timetype='$timetype'
  1409. d_uwait='$d_uwait'
  1410. d_vfork='$d_vfork'
  1411. d_voidsig='$d_voidsig'
  1412. signal_t='$signal_t'
  1413. hostname='$hostname'
  1414. mydomain='$mydomain'
  1415. phostname='$phostname'
  1416. i_fcntl='$i_fcntl'
  1417. i_string='$i_string'
  1418. strings='$strings'
  1419. i_sysfile='$i_sysfile'
  1420. i_syswait='$i_syswait'
  1421. i_systime='$i_systime'
  1422. i_systimek='$i_systimek'
  1423. i_time='$i_time'
  1424. timeincl='$timeincl'
  1425. timezone='$timezone'
  1426. intsize='$intsize'
  1427. libc='$libc'
  1428. nm_opt='$nm_opt'
  1429. libpth='$libpth'
  1430. plibpth='$plibpth'
  1431. libs='$libs'
  1432. maildir='$maildir'
  1433. mailfile='$mailfile'
  1434. manext='$manext'
  1435. mansrc='$mansrc'
  1436. mkdep='$mkdep'
  1437. huge='$huge'
  1438. large='$large'
  1439. medium='$medium'
  1440. models='$models'
  1441. small='$small'
  1442. split='$split'
  1443. c='$c'
  1444. n='$n'
  1445. orgname='$orgname'
  1446. package='$package'
  1447. perlpath='$perlpath'
  1448. pidtype='$pidtype'
  1449. privlib='$privlib'
  1450. reg10='$reg10'
  1451. reg11='$reg11'
  1452. reg12='$reg12'
  1453. reg13='$reg13'
  1454. reg14='$reg14'
  1455. reg15='$reg15'
  1456. reg16='$reg16'
  1457. reg1='$reg1'
  1458. reg2='$reg2'
  1459. reg3='$reg3'
  1460. reg4='$reg4'
  1461. reg5='$reg5'
  1462. reg6='$reg6'
  1463. reg7='$reg7'
  1464. reg8='$reg8'
  1465. reg9='$reg9'
  1466. registers='$registers'
  1467. scriptdir='$scriptdir'
  1468. sharpbang='$sharpbang'
  1469. shsharp='$shsharp'
  1470. spitshell='$spitshell'
  1471. startsh='$startsh'
  1472. sysman='$sysman'
  1473. uidtype='$uidtype'
  1474. incpath='$incpath'
  1475. mips='$mips'
  1476. mips_type='$mips_type'
  1477. usrinc='$usrinc'
  1478. EOT
  1479.  
  1480. : add special variables
  1481. test -f patchlevel.h && \
  1482. awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
  1483. echo "CONFIG=true" >>config.sh
  1484.  
  1485. : propagate old symbols
  1486. if test -f UU/config.sh; then
  1487.     <UU/config.sh sort | uniq >UU/oldconfig.sh
  1488.     sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
  1489.     sort | uniq -u >UU/oldsyms
  1490.     set X `cat UU/oldsyms`
  1491.     shift
  1492.     case $# in
  1493.     0) ;;
  1494.     *)    echo "Hmm...You had some extra variables I don't know about...I'll try to keep 'em..."
  1495.     for sym in `cat UU/oldsyms`; do
  1496.         echo "    Propagating $hint variable "'$'"$sym..."
  1497.         eval 'tmp="$'"${sym}"'"'
  1498.         echo "$tmp" | \
  1499.         sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
  1500.     done
  1501.     ;;
  1502.     esac
  1503. fi
  1504.  
  1505. : Finish up
  1506. CONFIG=true
  1507.  
  1508. echo " "
  1509. dflt=''
  1510. echo "If you didn't make any mistakes, then just type a carriage return here."
  1511. rp="If you need to edit config.sh, do it as a shell escape here:"
  1512. . UU/myread
  1513. case "$ans" in
  1514. '') ;;
  1515. *) : in case they cannot read
  1516.     eval $ans;;
  1517. esac
  1518. . ./config.sh
  1519.  
  1520. echo " "
  1521. echo "Doing variable substitutions on .SH files..."
  1522. if test -f MANIFEST; then
  1523.     set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
  1524. else
  1525.     set x `find . -name "*.SH" -print`
  1526. fi
  1527. shift
  1528. case $# in
  1529. 0) set x *.SH; shift;;
  1530. esac
  1531. if test ! -f $1; then
  1532.     shift
  1533. fi
  1534. for file in $*; do
  1535.     case "$file" in
  1536.     */*)
  1537.     dir=`$expr X$file : 'X\(.*\)/'`
  1538.     file=`$expr X$file : 'X.*/\(.*\)'`
  1539.     (cd $dir && . $file)
  1540.     ;;
  1541.     *)
  1542.     . $file
  1543.     ;;
  1544.     esac
  1545. done
  1546. if test -f config.h.SH; then
  1547.     if test ! -f config.h; then
  1548.     : oops, they left it out of MANIFEST, probably, so do it anyway.
  1549.     . config.h.SH
  1550.     fi
  1551. fi
  1552.  
  1553. if $contains '^depend:' Makefile >/dev/null 2>&1; then
  1554.     dflt=n
  1555.     $cat <<EOM
  1556.  
  1557. Now you need to generate make dependencies by running "make depend".
  1558. You might prefer to run it in background: "make depend > makedepend.out &"
  1559. It can take a while, so you might not want to run it right now.
  1560.  
  1561. EOM
  1562.     rp="Run make depend now?"
  1563.     . UU/myread
  1564.     case "$ans" in
  1565.     y*) make depend
  1566.     echo "Now you must run a make."
  1567.     ;;
  1568.     *)  echo "You must run 'make depend' then 'make'."
  1569.     ;;
  1570.     esac
  1571. elif test -f [Mm]akefile; then
  1572.     echo " "
  1573.     echo "Now you must run a make."
  1574. else
  1575.     echo "Done."
  1576. fi
  1577.  
  1578. $rm -f kit*isdone
  1579. $rm -rf UU
  1580. : end of Configure
  1581.