Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!uw-beaver!tektronix!tekgen!tekred!games-request From: games-request@tekred.UUCP Newsgroups: comp.sources.games Subject: v01i046: warp7 - space war game, Part02/07 Message-ID: <1295@tekred.TEK.COM> Date: Wed, 10-Jun-87 16:39:49 EDT Article-I.D.: tekred.1295 Posted: Wed Jun 10 16:39:49 1987 Date-Received: Sat, 13-Jun-87 07:28:53 EDT Sender: billr@tekred.TEK.COM Lines: 2180 Approved: billr@tekred.TEK.COM Submitted by: Larry Wall Comp.sources.games: Volume 1, Issue 46 Archive-name: warp7/Part02 #! /bin/sh # Make a new directory for the warp sources, cd to it, and run kits 1 # thru 7 through sh. When all 7 kits have been run, read README. echo "This is warp 7.0 kit 2 (of 7). If kit 2 is complete, the line" echo '"'"End of kit 2 (of 7)"'" will echo at the end.' echo "" export PATH || (echo "You didn't use sh, you clunch." ; kill $$) echo Extracting Configure sed >Configure <<'!STUFFY!FUNK!' -e 's/X//' X#! /bin/sh X# X# If these # comments don't work, trim them. Don't worry about any other X# shell scripts, Configure will trim # comments from them for you. X# X# (If you are trying to port this package to a machine without sh, I would X# suggest you cut out the prototypical config.h from the end of Configure X# and edit it to reflect your system. Some packages may include samples X# of config.h for certain machines, so you might look for one of those.) X# X# $Header: Configure,v 7.0.1.2 86/12/12 16:44:05 lwall Exp $ X# X# Yes, you may rip this off to use in other distribution packages. X# (Note: this Configure script was generated automatically. Rather than X# working with this copy of Configure, you may wish to get metaconfig.) X X: sanity checks XPATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc' Xexport PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$) X Xif test ! -t 0; then X echo "Say 'sh Configure', not 'sh /dev/null 2>&1 && \ X echo "(I see you are using the Korn shell. Some ksh's blow up on Configure," && \ X echo "especially on exotic machines. If yours does, try the Bourne shell instead.)" X Xif test ! -d ../UU; then X if test ! -d UU; then X mkdir UU X fi X cd UU Xfi X Xd_eunice='' Xeunicefix='' Xdefine='' Xloclist='' Xexpr='' Xsed='' Xecho='' Xcat='' Xrm='' Xmv='' Xcp='' Xtail='' Xtr='' Xmkdir='' Xsort='' Xuniq='' Xgrep='' Xtrylist='' Xtest='' Xinews='' Xegrep='' Xmore='' Xpg='' XMcc='' Xvi='' Xmailx='' XLog='' XHeader='' Xcc='' Xcontains='' Xcpp='' Xd_charsprf='' Xd_fcntl='' Xd_ftime='' Xd_gethname='' Xd_douname='' Xd_phostname='' Xd_getpwent='' Xd_havetlib='' Xtermlib='' Xd_index='' Xd_ioctl='' Xd_normsig='' Xjobslib='' Xd_portable='' Xd_rdchk='' Xd_scorfl='' Xd_sgndchr='' Xd_termio='' Xd_usendir='' Xd_libndir='' Xndirc='' Xndiro='' Xd_whoami='' Xhostname='' Xphostname='' Xmydomain='' Xlibc='' Xlibnm='' Xmansrc='' Xmanext='' Xmodels='' Xsplit='' Xsmall='' Xmedium='' Xlarge='' Xhuge='' Xccflags='' Xldflags='' Xn='' Xc='' Xnametype='' Xd_passnames='' Xd_berknames='' Xd_usgnames='' Xpasscat='' Xpackage='' Xprefshell='' Xrandbits='' Xregisters='' Xreg1='' Xreg2='' Xreg3='' Xreg4='' Xreg5='' Xreg6='' Xreg7='' Xreg8='' Xreg9='' Xreg10='' Xreg11='' Xreg12='' Xreg13='' Xreg14='' Xreg15='' Xreg16='' Xrootid='' Xspitshell='' Xshsharp='' Xsharpbang='' Xstartsh='' Xvoidflags='' Xbin='' Xchowner='' Xprivlib='' XCONFIG='' X X: set package name Xpackage=warp X Xecho " " Xecho "Beginning of configuration questions for $package kit." X: Eunice requires " " instead of "", can you believe it Xecho " " X Xdefine='define' Xundef='/*undef' Xlibpth='/usr/lib /usr/local/lib /lib' Xsmallmach='pdp11 i8086 z8000 i80286 iAPX286' Xrmlist='kit[1-9]isdone kit[1-9][0-9]isdone' Xtrap 'echo " "; rm -f $rmlist; exit 1' 1 2 3 Xattrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr" Xattrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200" Xattrlist="$attrlist ns32000 ns16000 iAPX286" Xpth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib" Xdefvoidused=7 X X: some greps do not return status, grrr. Xecho "grimblepritz" >grimble Xif grep blurfldyick grimble >/dev/null 2>&1 ; then X contains=contains Xelif grep grimblepritz grimble >/dev/null 2>&1 ; then X contains=grep Xelse X contains=contains Xfi Xrm -f grimble X: the following should work in any shell Xcase "$contains" in Xcontains*) X echo " " X echo "AGH! Grep doesn't return a status. Attempting remedial action." X cat >contains <<'EOSS' Xgrep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp XEOSS Xchmod 755 contains Xesac X X: first determine how to suppress newline on echo command Xecho "Checking echo to see how to suppress newlines..." X(echo "hi there\c" ; echo " ") >.echotmp Xif $contains c .echotmp >/dev/null 2>&1 ; then X echo "...using -n." X n='-n' X c='' Xelse X cat <<'EOM' X...using \c XEOM X n='' X c='\c' Xfi Xecho $n "Type carriage return to continue. Your cursor should be here-->$c" Xread ans Xrm -f .echotmp X X: now set up to do reads with possible shell escape and default assignment Xcat <myread Xans='!' Xwhile expr "X\$ans" : "X!" >/dev/null; do X read ans X case "\$ans" in X !) X sh X echo " " X echo $n "\$rp $c" X ;; X !*) X set \`expr "X\$ans" : "X!\(.*\)\$"\` X sh -c "\$*" X echo " " X echo $n "\$rp $c" X ;; X esac Xdone Xrp='Your answer:' Xcase "\$ans" in X'') ans="\$dflt";; Xesac XEOSC X X: general instructions Xcat <loc X$startsh Xcase \$# in X0) exit 1;; Xesac Xthing=\$1 Xshift Xdflt=\$1 Xshift Xfor dir in \$*; do X case "\$thing" in X .) X if test -d \$dir/\$thing; then X echo \$dir X exit 0 X fi X ;; X *) X if test -f \$dir/\$thing; then X echo \$dir/\$thing X exit 0 X fi X ;; X esac Xdone Xecho \$dflt Xexit 1 XEOSC Xchmod 755 loc X$eunicefix loc Xloclist=" Xexpr Xsed Xecho Xcat Xrm Xmv Xcp Xtr Xmkdir Xsort Xuniq Xgrep X" Xtrylist=" Xtest Xegrep XMcc X" Xfor file in $loclist; do X xxx=`loc $file $file $pth` X eval $file=$xxx X eval _$file=$xxx X case "$xxx" in X /*) X echo $file is in $xxx. X ;; X *) X echo "I don't know where $file is. I hope it's in everyone's PATH." X ;; X esac Xdone Xecho " " Xecho "Don't worry if any of the following aren't found..." Xans=offhand Xfor file in $trylist; do X xxx=`loc $file $file $pth` X eval $file=$xxx X eval _$file=$xxx X case "$xxx" in X /*) X echo $file is in $xxx. X ;; X *) X echo "I don't see $file out there, $ans." X ans=either X ;; X esac Xdone Xcase "$egrep" in Xegrep) X echo "Substituting grep for egrep." X egrep=$grep X ;; Xesac Xcase "$test" in Xtest) X echo "Hopefully test is built into your sh." X ;; X/bin/test) X echo " " X dflt=n X rp="Is your "'"'"test"'"'" built into sh? [$dflt] (OK to guess)" X echo $n "$rp $c" X . myread X case "$ans" in X y*) test=test ;; X esac X ;; X*) X test=test X ;; Xesac Xcase "$echo" in Xecho) X echo "Hopefully echo is built into your sh." X ;; X/bin/echo) X echo " " X echo "Checking compatibility between /bin/echo and builtin echo (if any)..." X $echo $n "hi there$c" >foo1 X echo $n "hi there$c" >foo2 X if cmp foo1 foo2 >/dev/null 2>&1; then X echo "They are compatible. In fact, they may be identical." X else X case "$n" in X '-n') n='' c='\c' ans='\c' ;; X *) n='-n' c='' ans='-n' ;; X esac X cat < libc.list; then X echo "done" Xelse X echo " " X echo "The archiver doesn't think $libc is a reasonable library." X echo "Trying nm instead..." X if nm -g $libc > libc.list; then X echo "done" X else X echo "That didn't work either. Giving up." X exit 1 X fi Xfi Xrmlist="$rmlist libc.list" X X: make some quick guesses about what we are up against Xecho " " X$echo $n "Hmm... $c" Xif $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then X echo "Looks kind of like a BSD system, but we'll see..." X echo exit 0 >bsd X echo exit 1 >usg X echo exit 1 >v7 Xelif $contains fcntl libc.list >/dev/null 2>&1 ; then X echo "Looks kind of like a USG system, but we'll see..." X echo exit 1 >bsd X echo exit 0 >usg X echo exit 1 >v7 Xelse X echo "Looks kind of like a version 7 system, but we'll see..." X echo exit 1 >bsd X echo exit 1 >usg X echo exit 0 >v7 Xfi Xif $contains vmssystem libc.list >/dev/null 2>&1 ; then X cat <<'EOI' XThere is, however, a strange, musty smell in the air that reminds me of Xsomething...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. XEOI X echo "exit 0" >eunice X eunicefix=unixtovms X d_eunice="$define" X: it so happens the Eunice I know will not run shell scripts in Unix format Xelse X echo " " X echo "Congratulations. You aren't running Eunice." X eunicefix=':' X d_eunice="$undef" X echo "exit 1" >eunice Xfi Xif test -f /xenix; then X echo "Actually, this looks more like a XENIX system..." X echo "exit 0" >xenix Xelse X echo " " X echo "It's not Xenix..." X echo "exit 1" >xenix Xfi Xchmod 755 xenix Xif test -f /venix; then X echo "Actually, this looks more like a VENIX system..." X echo "exit 0" >venix Xelse X echo " " X if xenix; then X : null X else X echo "Nor is it Venix..." X fi X echo "exit 1" >venix Xfi Xchmod 755 bsd usg v7 eunice venix xenix X$eunicefix bsd usg v7 eunice venix xenix Xrmlist="$rmlist bsd usg v7 eunice venix xenix" X X: see if sh knows # comments Xecho " " Xecho "Checking your sh to see if it knows about # comments..." Xif sh -c '#' >/dev/null 2>&1 ; then X echo "Your sh handles # comments correctly." X shsharp=true X spitshell=cat X echo " " X echo "Okay, let's see if #! works on this system..." X echo "#!/bin/echo hi" > try X $eunicefix try X chmod 755 try X try > today X if test -s today; then X echo "It does." X sharpbang='#!' X else X echo "#! /bin/echo hi" > try X $eunicefix try X chmod 755 try X try > today X if test -s today; then X echo "It does." X sharpbang='#! ' X else X echo "It doesn't." X sharpbang=': use ' X fi X fi Xelse X echo "Your sh doesn't grok # comments--I will strip them later on." X shsharp=false X echo "exec grep -v '^#'" >spitshell X chmod 755 spitshell X $eunicefix spitshell X spitshell=`pwd`/spitshell X echo "I presume that if # doesn't work, #! won't work either!" X sharpbang=': use ' Xfi X X: figure out how to guarantee sh startup Xecho " " Xecho "Checking out how to guarantee sh startup..." Xstartsh=$sharpbang'/bin/sh' Xecho "Let's see if '$startsh' works..." Xcat >try </dev/null 2>&1 ; then X echo "Your sprintf() returns (char*)." X d_charsprf="$define" Xelse X echo "Your sprintf() returns (int)." X d_charsprf="$undef" Xfi X X: now get the host name Xecho " " Xecho "Figuring out host name..." Xecho 'Maybe "hostname" will work...' Xif ans=`sh -c hostname 2>&1` ; then X hostname=$ans X phostname=hostname Xelse X echo 'Oh, dear. Maybe "/etc/systemid" will work...' X if ans=`sh -c '/etc/systemid' 2>&1` ; then X hostname=$ans X phostname='/etc/systemid' X if xenix; then X echo "Whadyaknow. Xenix always was a bit strange..." X else X echo "What is a non-Xenix system doing with /etc/systemid?" X fi X else X echo 'No, maybe "uuname -l" will work...' X if ans=`sh -c 'uuname -l' 2>&1` ; then X hostname=$ans X phostname='uuname -l' X else X echo 'Strange. Maybe "uname -n" will work...' X if ans=`sh -c 'uname -n' 2>&1` ; then X hostname=$ans X phostname='uname -n' X else X echo 'Oh well, maybe I can mine it out of whoami.h...' X if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then X hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'` X phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' /dev/null 2>&1 ; then X echo "gethostname() found." X d_gethname="$define" X ans=gethostname Xelif $contains uname libc.list >/dev/null 2>&1 ; then X echo "uname() found." X d_douname="$define" X ans=uname Xfi X Xcase "$d_douname$d_gethname" in X*define*) X dflt=n X cat </dev/null 2>&1; then X echo 'ftime() found.' X d_ftime="$define" Xelse X echo 'ftime() not found--timing may be less accurate.' X d_ftime="$undef" Xfi X X: see if there is a getpw Xecho " " Xif $contains getpw.o libc.list >/dev/null 2>&1 ; then X echo "getpw() found." X d_getpwent="$undef" Xelse X echo "No getpw() found--will use getpwent() instead." X d_getpwent="$define" Xfi X X: set up shell script to do ~ expansion Xcat >filexp <&2 X exit 1 X fi X case "\$1" in X */*) X echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` X ;; X *) X echo \$dir X ;; X esac X fi X ;; X*) X echo \$1 X ;; Xesac XEOSS Xchmod 755 filexp X$eunicefix filexp X X: where do we get termlib routines from Xecho " " Xans=`loc libcurses.a x $libpth` Xcase "$ans" in X/*) X ar t $ans >grimble X if $contains tputs.o grimble >/dev/null 2>&1; then X termlib='-lcurses' X d_havetlib="$define" X echo "Terminfo library found." X else X ans=x X fi X ;; Xesac Xcase "$ans" in Xx) X ans=`loc libtermlib.a x $libpth` X case "$ans" in X /usr/lib*|/lib*) X termlib='-ltermlib' X d_havetlib="$define" X echo "Termlib library found." X ;; X /*) X termlib="$ans" X d_havetlib="$define" X echo "Termlib library found." X ;; X *) X ans=`loc libtermcap.a x $libpth` X case "$ans" in X /usr/lib*|/lib*) X termlib='-ltermcap' X d_havetlib="$define" X echo "Termcap library found." X ;; X /*) X termlib="$ans" X d_havetlib="$define" X echo "Termcap library found." X ;; X *) X case "$termlib" in X '') X dflt=y X rp="Your system appears to NOT have termlib-style routines. Is this true? [$dflt]" X $echo $n "$rp $c" X . myread X case "$ans" in X n*|f*) d_havetlib="$define" X echo "Then where are the termlib-style routines kept (specify either -llibname" X $echo $n " or full pathname (~name ok))? $c" X rp='Specify termlib:' X . myread X termlib=`filexp $ans` X ;; X *) d_havetlib="$undef" X termlib='' X echo "You will have to play around with term.c then." X ;; X esac X echo " " X ;; X *) echo "You said termlib was $termlib before." X ;; X esac X ;; X esac X ;; X esac X ;; Xesac X X: index or strcpy Xecho " " Xdflt=y Xif $contains index libc.list >/dev/null 2>&1 ; then X echo "Your system appears to use index() and rindex() rather than strchr()" X $echo $n "and strrchr(). Is this correct? [$dflt] $c" X rp='index() rather than strchr()? [$dflt]' X . myread X case "$ans" in X n*|f*) d_index="$define" ;; X *) d_index="$undef" ;; X esac Xelse X echo "Your system appears to use strchr() and strrchr() rather than index()" X $echo $n "and rindex(). Is this correct? [$dflt] $c" X rp='strchr() rather than index()? [$dflt]' X . myread X case "$ans" in X n*|f*) d_index="$undef" ;; X *) d_index="$define" ;; X esac Xfi X X: see if ioctl defs are in sgtty/termio or sys/ioctl Xecho " " Xif $test -r /usr/include/sys/ioctl.h ; then X d_ioctl="$define" X echo "sys/ioctl.h found." Xelse X d_ioctl="$undef" X echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h." Xfi X X: see if there are directory access routines out there Xecho " " Xif $test -r /usr/include/ndir.h && \ X ( $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a ); then X echo "Ndir library found." X if $test -r /usr/lib/libndir.a; then X ndirlib='-lndir' X else X ndirlib="/usr/local/lib/libndir.a" X fi X d_libndir="$define" X d_usendir="$undef" X ndirc='' X ndiro='' Xelse X ndirlib='' X d_libndir="$undef" X if bsd && $contains readdir libc.list >/dev/null 2>&1 ; then X echo "No ndir library found, but you have readdir() so we'll use that." X d_usendir="$undef" X ndirc='' X ndiro='' X else X echo "No ndir library found--using ./ndir.c." X d_usendir="$define" X ndirc='ndir.c' X ndiro='ndir.o' X fi Xfi X X: see if we need -ljobs and if we have sigset, etc. Xecho " " Xif $test -r /usr/lib/libjobs.a || $test -r /usr/local/lib/libjobs.a ; then X echo "Jobs library found." X d_normsig="$undef" X jobslib='-ljobs' Xelse X if bsd; then X echo "No jobs library found. (I suppose this is at least 4.2...)" X else X echo "No jobs library found. (That's okay, we all have our faults.)" X fi X d_normsig="$define" X jobslib='' Xfi X X: see if rdchk exists Xecho " " Xif $contains rdchk libc.list >/dev/null 2>&1; then X echo 'rdchk() found.' X d_rdchk="$define" Xelse X if v7; then X echo "rdchk() not found--you'd better have FIONREAD or O_NDELAY." X else X echo 'rdchk() not found.' X fi X d_rdchk="$undef" Xfi X X: see how they want the scoreboard kept Xcase "$d_scorfl" in X"$define") dflt=y ;; X*) dflt=n ;; Xesac Xcase "$nametype" in Xother) d_scorfl="$undef" ;; X*) X $cat <<'EOM' X XThe scoreboard can be kept with one score per login name, or one score Xper full name. If users can change their full name, or if there is Xmore than one person on your system with the same full name, you should Xkeep the score by login name (the full name is still printed). XEOM X rp="Do you want the scoreboard kept by full name? [$dflt]" X $echo $n "$rp $c" X . myread X case "$ans" in X y*) d_scorfl="$define" ;; X *) d_scorfl="$undef" ;; X esac X ;; Xesac X X: check for signed chars Xecho " " Xecho "Checking to see if your C compiler can do signed chars..." X$cat >try.c <<'EOCP' Xmain() X{ X char c = 0; X X c--; X exit(c >= 0); X} XEOCP Xcc -o a.out try.c Xif a.out; then X d_sgndchr="$define" X echo "It certainly can." Xelse X d_sgndchr="$undef" X echo "It can't. I'll have to make some things type short." Xfi X$rm -f try.* a.out X X: see how we invoke the C preprocessor Xecho " " Xecho "Checking to see how your C preprocessor is invoked..." Xcat <<'EOT' >testcpp.c X#define ABC abc X#define XYZ xyz XABC.XYZ XEOT Xecho 'Maybe "cc -E" will work...' Xcc -E testcpp.c >testcpp.out 2>&1 Xif $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then X echo "Yup, it does." X cpp='cc -E' Xelse X echo 'Nope...maybe "cc -P" will work...' X cc -P testcpp.c >testcpp.out 2>&1 X if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then X echo "Yup, that does." X cpp='cc -P' X else X echo 'Nixed again...maybe "/lib/cpp" will work...' X /lib/cpp testcpp.c >testcpp.out 2>&1 X if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then X echo "Hooray, it works! I was beginning to wonder." X cpp='/lib/cpp' X else X echo 'Hmm...maybe you already told me...' X case "$cpp" in X '') ;; X *) $cpp testcpp.c >testcpp.out 2>&1;; X esac X if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then X echo "Hooray, you did! I was beginning to wonder." X else X dflt=blurfl X $echo $n "Nope. I can't find a C preprocessor. Name one: $c" X rp='Name a C preprocessor:' X . myread X cpp="$ans" X $cpp testcpp.c >testcpp.out 2>&1 X if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then X echo "OK, that will do." X else X echo "Sorry, I can't get that to work. Go find one." X exit 1 X fi X fi X fi X fi Xfi Xrm -f testcpp.c testcpp.out X X: get C preprocessor symbols handy Xecho " " Xecho $attrlist | $tr '[ ]' '[\012]' >Cppsym.know X$cat <Cppsym X$startsh Xcase "\$1" in X-l) list=true X shift X ;; Xesac Xunknown='' Xcase "\$list\$#" in X1|2) X for sym do X if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then X exit 0 X elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then X : X else X unknown="\$unknown \$sym" X fi X done X set X \$unknown X shift X ;; Xesac Xcase \$# in X0) exit 1;; Xesac Xecho \$* | $tr '[ ]' '[\012]' | $sed -e 's/\(.*\)/\\ X#ifdef \1\\ Xexit 0; _ _ _ _\1\\ \1\\ X#endif\\ X/' >/tmp/Cppsym\$\$ Xecho exit 1 >>/tmp/Cppsym\$\$ X$cpp /tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$ Xcase "\$list" in Xtrue) awk '\$6 != "" {print substr(\$6,2,100)}' Cppsym.true Xcat Cppsym.true Xrmlist="$rmlist Cppsym Cppsym.know Cppsym.true" X X: see if this is a termio system Xecho " " Xif Cppsym pyr && $test -r /usr/include/sgtty.h ; then X d_termio="$undef" X echo "sgtty.h found." Xelif $test -r /usr/include/termio.h ; then X d_termio="$define" X echo "termio.h found." Xelif $test -r /usr/include/sgtty.h ; then X d_termio="$undef" X echo "sgtty.h found." Xelse X d_termio="$undef" X echo "Neither termio.h nor sgtty.h found--you could have problems." Xfi X X: find out which shell people like to use most Xcase "$prefshell" in X'') X if $test -f /bin/ksh; then X dflt='/bin/ksh' X elif $test -f /bin/csh; then X dflt='/bin/csh' X else X dflt='/bin/sh' X fi X ;; X*) dflt="$prefshell";; Xesac Xcont=true Xwhile $test "$cont" ; do X echo " " X echo "Give the full path name of the shell most people like to use on your" X $echo $n "system: [$dflt] $c" X rp="Preferred shell: [$dflt]" X . myread X prefshell=$ans X if test -f $ans; then X cont='' X else X dflt=n X rp="File $ans doesn't exist. Use that name anyway? [$dflt]" X $echo $n "$rp $c" X . myread X dflt='' X case "$ans" in X y*) cont='';; X esac X fi Xdone X X: determine where private files go Xcase "$privlib" in X'') X dflt=/usr/games/lib/$package X ;; X*) dflt="$privlib" X ;; Xesac X$cat <try.c <<'EOCP' X#include Xmain() X{ X register int i; X register unsigned long tmp; X register unsigned long max; X X for (i=1000; i; i--) { X tmp = (unsigned long)rand(); X if (tmp > max) max = tmp; X } X for (i=0; max; i++) X max /= 2; X printf("%d\n",i); X} XEOCP X if cc try.c -o try >/dev/null 2>&1 ; then X dflt=`try` X else X dflt='?' X echo "(I can't seem to compile the test program...)" X fi X ;; X*) X dflt="$randbits" X ;; Xesac Xrp="How many bits does your rand() function produce? [$dflt]" X$echo $n "$rp $c" X. myread Xrandbits="$ans" X$rm -f try.c try X X: see how many register declarations we want to use Xcase "$registers" in X'') X if Cppsym vax; then X dflt=6 X elif Cppsym sun mc68000; then X dflt=10 X elif Cppsym pyr; then X dflt=14 X elif Cppsym ns32000 ns16000; then X dflt=5 X elif Cppsym $smallmach; then X dflt=3 X else X : if you have any other numbers for me, send them in X dflt=6 X fi X ;; X*) dflt=$registers ;; Xesac Xcat <.foo X. .foo Xawk "END { for (i=1; i<=$registers; i++) printf \"reg%d=register\n\", i}" \ X .foo X. .foo Xrm -f .foo X X: determine root id Xecho " " Xrootid=`$sed -e "/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e "q" -e "}" -e "d" try.c <<'EOCP' X#if TRY & 1 Xvoid main() { X#else Xmain() { X#endif X extern void *moo(); X void (*goo)(); X#if TRY & 2 X void (*foo[10])(); X#endif X X#if TRY & 4 X if(goo == moo) { X exit(0); X } X#endif X exit(0); X} XEOCP X if cc -S -DTRY=7 try.c >.out 2>&1 ; then X voidflags=7 X echo "It appears to support void fully." X if $contains warning .out >/dev/null 2>&1; then X echo "However, you might get some warnings that look like this:" X $cat .out X fi X else X echo "Hmm, you compiler has some difficulty with void. Checking further..." X if cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then X echo "It supports 1..." X if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then X voidflags=3 X echo "And it supports 2 but not 4." X else X echo "It doesn't support 2..." X if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then X voidflags=5 X echo "But it supports 4." X else X voidflags=1 X echo "And it doesn't support 4." X fi X fi X else X echo "There is no support at all for void." X voidflags=0 X fi X fi Xesac Xdflt="$voidflags"; Xrp="Your void support flags add up to what? [$dflt]" X$echo $n "$rp $c" X. myread Xvoidflags="$ans" X$rm -f try.* .out X X: preserve RCS keywords in files with variable substitution, grrr XLog='$Log' XHeader='$Header' X X: determine where public executables go Xcase "$bin" in X'') X dflt=`loc . /bin /usr/games /usr/local/bin /usr/lbin /usr/local /usr/bin` X ;; X*) dflt="$bin" X ;; Xesac Xbin='blurfl/dyick' Xwhile $test ! -d "$bin" ; do X case "$bin" in X blurfl*) ;; X *) $echo "$bin does not appear to exist." ;; X esac X $echo " " X rp="Where do you want to put the public executables? [$dflt]" X $echo $n "$rp $c" X . myread X bin="$ans" X bin=`filexp $bin` X case "$bin" in X '') bin=$dflt ;; X esac Xdone X X: determine where manual pages go Xcase "$mansrc" in X'') X dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1` X ;; X*) dflt="$mansrc" X ;; Xesac Xcont=true Xwhile $test "$cont" ; do X echo " " X rp="Where do the manual pages (source) go? [$dflt]" X $echo $n "$rp $c" X . myread X mansrc=`filexp "$ans"` X if test -d $mansrc; then X cont='' X else X dflt=n X rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]" X $echo $n "$rp $c" X . myread X dflt='' X case "$ans" in X y*) cont='';; X esac X fi Xdone Xcase "$mansrc" in X*l) X manext=l X ;; X*n) X manext=n X ;; X*) X manext=1 X ;; Xesac X X: see what memory models we can support Xcase "$models" in X'') X if Cppsym pdp11; then X dflt='unsplit split' X else X ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` X case "$ans" in X X) dflt='none';; X *) if $test -d /lib/small || $test -d /usr/lib/small; then X dflt='small' X else X dflt='' X fi X if $test -d /lib/medium || $test -d /usr/lib/medium; then X dflt="$dflt medium" X fi X if $test -d /lib/large || $test -d /usr/lib/large; then X dflt="$dflt large" X fi X if $test -d /lib/huge || $test -d /usr/lib/huge; then X dflt="$dflt huge" X fi X esac X fi X ;; X*) dflt="$models" ;; Xesac X$cat </dev/null 2>&1 || \ X $contains '-i' $mansrc/cc.1 >/dev/null 2>&1; then X dflt='-i' X else X dflt='none' X fi X ;; X *) dflt="$split";; X esac X rp="What flag indicates separate I and D space? [$dflt]" X $echo $n "$rp $c" X . myread X case "$ans" in X none) ans='';; X esac X split="$ans" X unsplit='' X ;; X*large*|*small*|*medium*|*huge*) X case "$model" in X *large*) X case "$large" in X '') dflt='-Ml';; X *) dflt="$large";; X esac X rp="What flag indicates large model? [$dflt]" X $echo $n "$rp $c" X . myread X case "$ans" in X none) ans=''; X esac X large="$ans" X ;; X *) large='';; X esac X case "$model" in X *huge*) X case "$huge" in X '') dflt='-Mh';; X *) dflt="$huge";; X esac X rp="What flag indicates huge model? [$dflt]" X $echo $n "$rp $c" X . myread X case "$ans" in X none) ans=''; X esac X huge="$ans" X ;; X *) huge="$large";; X esac X case "$model" in X *medium*) X case "$medium" in X '') dflt='-Mm';; X *) dflt="$medium";; X esac X rp="What flag indicates medium model? [$dflt]" X $echo $n "$rp $c" X . myread X case "$ans" in X none) ans=''; X esac X medium="$ans" X ;; X *) medium="$large";; X esac X case "$model" in X *small*) X case "$small" in X '') dflt='none';; X *) dflt="$small";; X esac X rp="What flag indicates small model? [$dflt]" X $echo $n "$rp $c" X . myread X case "$ans" in X none) ans=''; X esac X small="$ans" X ;; X *) small='';; X esac X ;; X*) X echo "Unrecognized memory models--you may have to edit Makefile.SH" X ;; Xesac X Xcase "$ccflags" in X'') dflt='none';; X*) dflt="$ccflags";; Xesac Xecho " " Xrp="Any additional cc flags? [$dflt]" X$echo $n "$rp $c" X. myread Xcase "$ans" in Xnone) ans=''; Xesac Xccflags="$ans" X Xcase "$ldflags" in X'') if venix; then X dflt='-i -z' X else X dflt='none' X fi X ;; X*) dflt="$ldflags";; Xesac Xecho " " Xrp="Any additional ld flags? [$dflt]" X$echo $n "$rp $c" X. myread Xcase "$ans" in Xnone) ans=''; Xesac Xldflags="$ans" X X: see if we need a special compiler Xecho " " Xif usg; then X case "$cc" in X '') X case "$Mcc" in X /*) dflt='Mcc' X ;; X *) X case "$large" in X -M*) X dflt='cc' X ;; X *) X if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then X dflt='cc -M' X else X dflt='cc' X fi X ;; X esac X ;; X esac X ;; X *) dflt="$cc";; X esac X $cat <<'EOM' X XOn some systems the default C compiler will not resolve multiple global Xreferences that happen to have the same name. On some such systems the X"Mcc" command may be used to force these to be resolved. On other systems Xa "cc -M" command is required. (Note that the -M flag on other systems Xindicates a memory model to use!) What command will force resolution on XEOM X $echo $n "this system? [$dflt] $c" X rp="Command to resolve multiple refs? [$dflt]" X . myread X cc="$ans" Xelse X echo "Not a USG system--assuming cc can resolve multiple definitions." X cc=cc Xfi X X: get uid to chown everything to Xcase "$chowner" in X'') dflt=daemon X ;; X*) dflt="$chowner" X ;; Xesac X$cat <<'EOM' X XIf you do a make install as the superuser, I can chown all the publicly Xvisible files to be owned by some particular user id. Any setuid programs Xin this package will run under this uid, and be able to access the files Xthat belong to this uid. You should pick a uid that nobody can log into Xthat you don't trust to modify the programs or data files of this package. XYou should probably not pick root if there are any setuid programs in this Xpackage. If you want to create a uid for this, do so before the make install. X XEOM Xrp="Uid to chown public files to? [$dflt]" X$echo $n "$rp $c" X. myread Xchowner="$ans" Xcase "$chowner" in X'') chowner=$dflt ;; Xesac X X: see if we should include -lnm Xecho " " Xif $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then X echo "New math library found." X libnm='-lnm' Xelse X ans=`loc libtermlib.a x $libpth` X case "$ans" in X x) X echo "No nm library found--the normal math library will have to do." X libnm='' X ;; X *) X echo "New math library found in $ans." X libnm="$ans" X ;; X esac Xfi X X: Warnings Xif v7; then X cat <<'EOM' X XNOTE: the V7 compiler may ignore some #undefs that $package uses. If so, Xyou may get messages about redefining EXT. Some V7 compilers also have Xdifficulties with #defines near buffer boundaries, so beware. You may have Xto play with the spacing in some .h files, believe it or not. XEOM Xfi X X: Warnings Xif v7; then X cat <<'EOM' X XNOTE: many V7 systems do not have a way to do a non-blocking read. If you Xdon't have any of FIONREAD, O_NDELAY, or rdchk(), the $package package Xmay not work as well as it might. It might not work at all. XEOM Xfi X X$echo " " X$echo "End of configuration questions." X$echo " " X X: create config.sh file Xecho " " Xif test -d ../UU; then X cd .. Xfi Xecho "Creating config.sh..." X$spitshell <config.sh X$startsh X# config.sh X# This file was produced by running the Configure script. X Xd_eunice='$d_eunice' Xeunicefix='$eunicefix' Xdefine='$define' Xloclist='$loclist' Xexpr='$expr' Xsed='$sed' Xecho='$echo' Xcat='$cat' Xrm='$rm' Xmv='$mv' Xcp='$cp' Xtail='$tail' Xtr='$tr' Xmkdir='$mkdir' Xsort='$sort' Xuniq='$uniq' Xgrep='$grep' Xtrylist='$trylist' Xtest='$test' Xinews='$inews' Xegrep='$egrep' Xmore='$more' Xpg='$pg' XMcc='$Mcc' Xvi='$vi' Xmailx='$mailx' XLog='$Log' XHeader='$Header' Xcc='$cc' Xcontains='$contains' Xcpp='$cpp' Xd_charsprf='$d_charsprf' Xd_fcntl='$d_fcntl' Xd_ftime='$d_ftime' Xd_gethname='$d_gethname' Xd_douname='$d_douname' Xd_phostname='$d_phostname' Xd_getpwent='$d_getpwent' Xd_havetlib='$d_havetlib' Xtermlib='$termlib' Xd_index='$d_index' Xd_ioctl='$d_ioctl' Xd_normsig='$d_normsig' Xjobslib='$jobslib' Xd_portable='$d_portable' Xd_rdchk='$d_rdchk' Xd_scorfl='$d_scorfl' Xd_sgndchr='$d_sgndchr' Xd_termio='$d_termio' Xd_usendir='$d_usendir' Xd_libndir='$d_libndir' Xndirc='$ndirc' Xndiro='$ndiro' Xd_whoami='$d_whoami' Xhostname='$hostname' Xphostname='$phostname' Xmydomain='$mydomain' Xlibc='$libc' Xlibnm='$libnm' Xmansrc='$mansrc' Xmanext='$manext' Xmodels='$models' Xsplit='$split' Xsmall='$small' Xmedium='$medium' Xlarge='$large' Xhuge='$huge' Xccflags='$ccflags' Xldflags='$ldflags' Xn='$n' Xc='$c' Xnametype='$nametype' Xd_passnames='$d_passnames' Xd_berknames='$d_berknames' Xd_usgnames='$d_usgnames' Xpasscat='$passcat' Xpackage='$package' Xprefshell='$prefshell' Xrandbits='$randbits' Xregisters='$registers' Xreg1='$reg1' Xreg2='$reg2' Xreg3='$reg3' Xreg4='$reg4' Xreg5='$reg5' Xreg6='$reg6' Xreg7='$reg7' Xreg8='$reg8' Xreg9='$reg9' Xreg10='$reg10' Xreg11='$reg11' Xreg12='$reg12' Xreg13='$reg13' Xreg14='$reg14' Xreg15='$reg15' Xreg16='$reg16' Xrootid='$rootid' Xspitshell='$spitshell' Xshsharp='$shsharp' Xsharpbang='$sharpbang' Xstartsh='$startsh' Xvoidflags='$voidflags' Xbin='$bin' Xchowner='$chowner' Xprivlib='$privlib' XCONFIG=true XEOT X XCONFIG=true X Xecho " " Xdflt='' Xecho "If you didn't make any mistakes, then just type a carriage return here." Xrp="If you need to edit config.sh, do it as a shell escape here:" X$echo $n "$rp $c" X. myread Xcase "$ans" in X'') ;; X*) : in case they cannot read X eval $ans;; Xesac X Xecho " " Xecho "Doing variable substitutions on .SH files..." Xset `$grep '\.SH' /dev/null 2>&1; then X dflt=n X $cat < makedepend.out &" XIt can take a while, so you might not want to run it right now. X XEOM X rp="Run make depend now? [$dflt]" X $echo $n "$rp $c" X . myread X case "$ans" in X y*) make depend X echo "Now you must run a make." X ;; X *) echo "You must run 'make depend' then 'make'." X ;; X esac Xelif test -f Makefile; then X echo " " X echo "Now you must run a make." Xelse X echo "Done." Xfi X X$rm -f kit*isdone Xcd UU && $rm -f $rmlist X: end of Configure !STUFFY!FUNK! echo Extracting smp.7 sed >smp.7 <<'!STUFFY!FUNK!' -e 's/X//' X* * * * * * X* * * * * * * X * * * * * * * X * * * * * * * * * * * X * * * * * * * * * * * * * X * * * * * * * * * * X * * * * * * * * X * * * * * * * * * X * * * * * * * X * * * * * * * * X * * * * * * * * X * * * * * * X * * * * * * * * X * * * * * * * * * * X * * * * * * * * * * * X * * * * * * * * * X * * * * * * * * * * * * * X * * * X * * * X * * * X * * * * * X * * * * * * * * * X * * * !STUFFY!FUNK! echo "" echo "End of kit 2 (of 7)" cat /dev/null >kit2isdone config=true for iskit in 1 2 3 4 5 6 7; do if test -f kit${iskit}isdone; then echo "You have run kit ${iskit}." else echo "You still need to run kit ${iskit}." config=false fi done case $config in true) echo "You have run all your kits. Please read README and then type Configure." chmod 755 Configure ;; esac : Someone might mail this, so... exit