#! /bin/sh
# Make a new directory for the rn sources, cd to it, and run kits 1 thru 11 
# through sh.  When all 11 kits have been run, read README.

echo "This is rn kit 2 (of 11).  If kit 2 is complete, the line"
echo '"'"End of kit 2 (of 11)"'" 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# This software is Copyright 1991 by Stan Barber. 
X#
X# Permission is hereby granted to copy, reproduce, redistribute or otherwise
X# use this software as long as: there is no monetary profit gained
X# specifically from the use or reproduction of this software, it is not
X# sold, rented, traded or otherwise marketed, and this copyright notice is
X# included prominently in any copy made. 
X#
X# The author make no claims as to the fitness or correctness of this software
X# for any use whatsoever, and it is provided as is. Any use of this software
X# is at the user's own risk. 
X#
X# If these # comments don't work, trim them.  Don't worry about the other
X# shell scripts, Configure will trim # comments from them for you.
X#
X# $Id: Configure,v 4.4.3.1 1992/02/01 03:09:32 sob PATCH_3 sob $
X#
X# $Log: Configure,v $
X# Revision 4.4.3.1  1992/02/01  03:09:32  sob
X# Release 4.4 Patchlevel 3
X#
X# Revision 4.4.2.1  1991/12/01  18:05:42  sob
X# Patchlevel 2 changes
X#
X# Revision 4.4.1.1  1991/09/25  19:38:08  sob
X# various fixed
X#
X# Revision 4.4  1991/09/09  20:18:23  sob
X# release 4.4
X#
X#
X
X# Yes, you may rip this off to use in other distribution packages.
X
XCTRLA=`echo a | tr a '\001'`
X
Xbopt=''
Xn=''
Xc=''
Xlibc=''
Xeunicefix=''
Xeunice=''
Xcpp=''
Xshsharp=''
Xspitshell=''
Xstartsh=''
Xtest=''
Xexpr=''
Xsed=''
Xecho=''
Xcat=''
Xrm=''
Xmv=''
Xcp=''
Xtail=''
Xtr=''
Xmkdir=''
Xsort=''
Xuniq=''
Xinews=''
Xgrep=''
Xegrep=''
Xnidump=''
Xypmatch=''
Xcontains=''
Xlib=''
Xnametype=''
Xcc=''
Xiandd=''
Xrrninclude=''
Xtermlib=''
Xjobslib=''
Xndirlib=''
Xsocketlib=''
Xdirtype=''
Xdirinc=''
Xlibndir=''
Xusendir=''
Xndirc=''
Xndiro=''
Xposix=''
Xpager=''
Xmailer=''
Xinternet=''
Xrnbin=''
Xfilexp=''
Xdistlist=''
XLog=''
XId=''
Xsitename=''
Xhostfile=''
Xdomain=''
Xorgname=''
Xisadmin=''
Xnewsadmin=''
Xrnlib=''
Xmansrc=''
Xmanext=''
Xmaildir=''
Xspool=''
Xactive=''
Xmyactive=''
Xactivetimes=''
Xmininact=''
Xpref=''
Xdefeditor=''
Xrootid=''
Xmboxchar=''
Xlocpref=''
Xorgpref=''
Xcitypref=''
Xstatepref=''
Xcntrypref=''
Xcontpref=''
Xstrchr=''
Xmemcpy=''
Xrename=''
Xtruncate=''
Xchsize=''
Xtzset=''
Xnovoid=''
Xnovfork=''
Xsunos4=''
Xportable=''
Xpassnam=''
Xberknam=''
Xusgnam=''
Xwhoami=''
Xtermio=''
Xtermios=''
Xfcntl=''
Xioctl=''
Xptem=''
Xnormsig=''
Xsigblock=''
Xsigret=''
Xsighold=''
Xgetuidgid=''
Xgetcwd=''
Xgetwd=''
Xhavetlib=''
Xgetpwent=''
Xgethostname=''
Xdouname=''
Xphostname=''
Xhostcmd=''
Xnorelay=''
Xisrrn=''
Xrdchk=''
Xserverfile=''
Xignoreorg=''
XNNTPSRC=''
XCONFIG=''
X
Xecho "Beginning of configuration questions for rn."
X: Eunice requires " " instead of "", can you believe it
Xecho " "
X
X: sanity checks
XPATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/bsd'
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 "Type 'sh Configure', not 'sh <Configure'"
X    exit 1
Xfi
X
X(alias) >/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
X
X: some greps do not return status, grrr.
Xecho "grimblepritz" >grimble
Xif grep blurfldyick grimble >/dev/null 2>&1 ; then
X    contains=contains
Xelse
X    if grep grimblepritz grimble >/dev/null 2>&1 ; then
X	contains=grep
X    else
X	contains=contains
X    fi
Xfi
X
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 +x 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 .echotmp
X
X: now set up to do reads with possible shell escape
X: if this does not work on your machine, 1,$s/. myread/read ans/
Xcat <<EOSC >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 "Your answer: $c"
X	;;
X    !*)
X	set \`expr "X\$ans" : "X!\(.*\)\$"\`
X	sh -c "\$*"
X	echo " "
X	echo $n "Your answer: $c"
X	;;
X    esac
Xdone
XEOSC
X
X: general instructions
Xcat <<'EOH'
X 
XThis installation shell script will examine your system and ask you questions
Xto determine how rn and its auxiliary files should be installed.  If you
Xget stuck on a question, you may use a ! shell escape to start a subshell or
Xexecute a command.  Many of the questions will have default answers in
Xsquare brackets--typing carriage return will give you the default.
X
XOn some of the questions which ask for file or directory names you are
Xallowed to use the ~name construct to specify the login directory belonging
Xto "name", even if you don't have a shell which knows about that.  Questions
Xwhere this is allowed will be marked "(~name ok)".
X
XMuch effort has been expended to ensure that this shell script will run
Xon any Unix system.  If despite that it blows up on you, your best bet is to
Xedit Configure and run it again.  (Trying to install rn without having run
XConfigure is well nigh impossible.)  Also, tell Stan Barber (rrn@lib.tmc.edu)
Xhow he blew it.
X
XThis installation script affects things by doing direct variable substitutions
Xon some of the files included in this kit. You may edit any of these files as
Xthe need arises after running this script.
X
XEOH
Xecho $n "[Type carriage return to continue] $c"
X. myread
XXn=$n
XXc=$c
X: get old answers, if there is a config file out there
Xif test -f ./config.sh; then
X    echo " "
X    dflt=y
X    rp="I see a config.sh file.  Do you want to use it to set the defaults? [$dflt]"
X    echo $n "$rp $c"
X    . myread
X    case "$ans" in
X    n*) echo "OK, I'll ignore it.";;
X    *)  echo "Fetching default answers from your old config.sh file..."
X	tmp="$n"
X	ans="$c"
X        . ./config.sh
X	n="$tmp"
X	c="$ans"
X	;;
X    esac
Xfi
X
Xn=$Xn
Xc=$Xc
X
X: get list of predefined functions in a handy place
Xecho " "
Xif test -f /lib/libc.a; then
X    echo "Your C library is in /lib/libc.a.  You're normal."
X    libc=/lib/libc.a
Xelse
X    if test -f /lib/Llibc.a; then
X	echo "Your C library is in /lib/Llibc.a.  I smell Xenix!"
X	libc=/lib/Llibc.a
X    else
X	if test -f /usr/lib/libc.a; then
X	    echo "Your C library is in /usr/lib/libc.a, of all places."
X	    libc=/usr/lib/libc.a
X	else
X	    if test -f /lib/clib; then
X		echo "Your C library is in /lib/clib.  How nonstandard, must be Apollo."
X		libc=/lib/clib
X	    else
X		if test -f "$libc"; then
X		    echo "Your C library is in $libc, like you said before."
X		else
X		    cat <<'EOM'
X 
XI can't seem to find your C library.  I've looked for /lib/libc.a and
X/usr/lib/libc.a, but neither of those are there. Perhaps you can find
Xout by reading `man 3 intro' if you have the 'man' facility installed.
X
XEOM
X		    echo $n "What is the full name of your C library? $c"
X		    . myread
X		    libc="$ans"
X		fi
X	    fi
X	fi
X    fi
Xfi
X
Xif test -d /usr/bsd43 -o -d /usr/bsd ; then
X    echo " "
X    echo "It appears that you might be running on a RISC/os box."
X    echo $n "Should I pass the -B option to nm [y]? $c"
X    . myread
X    case $ans in
X	n*|f*) bopt=''   ;;
X	*)     bopt='-B' ;;
X    esac
Xfi
Xif test -f /bin/smit ; then
X    echo " "
X    echo "It appears that you might be running on an IBM RS/6000 box."
X    echo "We'll be using 'nm -B' to get the symbol lists."
X    bopt='-B'
Xfi
X
Xecho " "
Xecho $n "Extracting names from $libc for later perusal...$c"
Xnm $bopt $libc > nm.list 2>/dev/null
Xsed -n -e 's/^.* T _//p' -e 's/^.* T //p' < nm.list > libc.list
Xif $contains '^printf$' libc.list >/dev/null 2>&1; then
X    echo "done"
Xelse
X    sed -n -e 's/^.* D _//p' -e 's/^.* D //p' < nm.list > libc.list
X    if $contains '^printf$' libc.list >/dev/null 2>&1; then
X	echo "done"
X    else
X	 $contains .text nm.list | grep -v static | awk '{ print $1 }' > libc.list
X    	if $contains '^printf$' libc.list >/dev/null 2>&1; then
X		echo "done"
X    	else
X	     echo " "
X	     echo "nm didn't seem to work right."
X	     echo "Trying ar instead..."
X	     if ar t $libc | sed -e 's/\.o$//' > libc.list; then
X		echo "Ok."
X	     else
X		echo "That didn't work either.  Giving up."
X		exit 1
X	     fi
X	 fi
X    fi
Xfi
Xrm nm.list
X: make some quick guesses about what we are up against
Xecho " "
Xecho $n "Hmm...  $c"
Xif $contains '^sigvec$' libc.list >/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
Xelse
X    if $contains '^dup2$' libc.list >/dev/null 2>&1 ; then
X	echo "Looks sort of like a V7 system, but we'll see..."
X	echo exit 1 >bsd
X	echo exit 1 >usg
X	echo exit 0 >v7
X    else
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
X    fi
Xfi
X:
Xif test -f /etc/inittab; then
X    echo "You have an inittab file. You must be a USG system!"
X    echo exit 1 >bsd
X    echo exit 0 >usg
X    echo exit 1 >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    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    eunice=undef
X    echo "exit 1" >eunice
Xfi
Xchmod +x bsd usg v7 eunice
X$eunicefix bsd usg v7 eunice
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	    if $contains 'abc +xyz' testcpp.out >/dev/null 2>&1 ; then
X		echo "Found it!  You're on a NeXT, aren't you?"
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		    echo "Nope. I can't find a C preprocessor.  Name one: $c"
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
X    fi
Xfi
Xrm -f testcpp.c testcpp.out
X: check for pdp11
Xecho " "
Xcat <<'EOT' >pdp11.c
X#ifdef pdp11
Xexit 0
X#else
Xexit 1
X#endif
XEOT
X$cpp pdp11.c | grep exit >pdp11
Xchmod +x pdp11
X$eunicefix pdp11
Xrm pdp11.c
Xif pdp11; then
X    echo "This looks like a pdp11 to me."
Xfi
X: check for ultrix
Xcat <<'EOT' >ultrix.c
X#ifdef ultrix
Xexit 0
X#else
Xexit 1
X#endif
XEOT
X$cpp ultrix.c | grep exit >ultrix
Xchmod +x ultrix
X$eunicefix ultrix
Xrm ultrix.c
Xif ultrix; then
X    echo "Running ultrix, eh?"
Xfi
X
X: check for uts
Xcat <<'EOT' >uts.c
X#ifdef uts
Xexit 0
X#else
Xexit 1
X#endif
XEOT
X$cpp uts.c | grep exit >uts
Xchmod +x uts
X$eunicefix uts
Xrm uts.c
Xif uts; then
X    echo "This appears to be some kind of System370-type system running UTS."
X    socketlib=-lsocket
Xfi
X
X: check for sun 4.0
Xsunos4=undef
Xcat <<'EOT' >sun.c
X#ifdef sun
Xexit 0
X#else
Xexit 1
X#endif
XEOT
X$cpp sun.c | grep exit >sun
Xchmod +x sun
X$eunicefix sun
Xrm sun.c
Xif sun; then
X    echo "This looks like a sun to me."
X    if test -f /etc/ld.so.cache ; then
X	echo "And it appears you are running SunOS 4.0 or greater."
X        sunos4=define
X	socketlib=
X	rrninclude=
X     fi
Xfi
X: check for hp-ux
Xcat <<'EOT' >hp-ux.c
X#ifdef hpux
Xexit 0
X#else
Xexit 1
X#endif
XEOT
X$cpp hp-ux.c | grep exit >hp-ux
Xchmod +x hp-ux
X$eunicefix hp-ux
Xrm hp-ux.c
Xif hp-ux; then
X    echo "Hewlett-Packard must have built this..."
X    socketlib=-lbsdipc
Xfi
X
X: check for mips
Xcat <<'EOT' >mips.c
X#if defined(mips) && !defined(ultrix)
Xexit 0
X#else
Xexit 1
X#endif
XEOT
X$cpp mips.c | grep exit >mips
Xchmod +x mips
X$eunicefix mips
Xrm mips.c
Xif mips; then
X    echo "Looks like mips RISC/os..."
X	rrninclude="-DUSG -I/usr/include/bsd"
X	socketlib=-lbsd
Xfi
X: check for stardent
Xcat <<'EOT' >stardent.c
X#if defined(stardent) || defined(ardent) || defined (steller)
Xexit 0
X#else
Xexit 1
X#endif
XEOT
X$cpp stardent.c | grep exit >stardent
Xchmod +x stardent
X$eunicefix stardent
Xrm stardent.c
Xif stardent; then
X    echo "This appears to be a Stardent/Steller/Ardent..."
X	rrninclude="-DUSG"
X	socketlib=
Xfi
X
X: check for DGUX
Xcat <<'EOT' >DGUX.c
X#ifdef DGUX
Xexit 0
X#else
Xexit 1
X#endif
XEOT
X$cpp DGUX.c | grep exit >DGUX
Xchmod +x DGUX
X$eunicefix DGUX
Xrm DGUX.c
Xif DGUX; then
X    echo "This appears to be a DG AViiON..."
Xfi
X
X: check for sgi
Xcat <<'EOT' >sgi.c
X#ifdef sgi
Xexit 0
X#else
Xexit 1
X#endif
XEOT
X$cpp sgi.c | grep exit >sgi
Xchmod +x sgi
X$eunicefix sgi
Xrm sgi.c
Xif sgi; then
X    echo "Silicon Graphics must have built this..."
X	if test -f /usr/lib/libsun.a ; then
X 		socketlib=-lsun
X 	fi
Xfi
X
X: check for XENIX
Xcat <<'EOT' >xenix
Xtest -f /xenix; exit $?
XEOT
Xchmod +x xenix
X$eunicefix xenix
Xif xenix; then
X    echo "Kinda looks like XENIX....hmmm"
X	rrninclude="-DUSG -DLAI_TCP"
X	socketlib=-lsocket
X	rdchk=define
X	dirtype=dirent
X	dirinc="<dirent.h>"
Xelse
X	rdchk=undef
Xfi
X
X: check for Pyramid OSx
Xcat <<'EOT' >pyr.c
X#ifdef pyr
Xexit 0
X#else
Xexit 1
X#endif
XEOT
X$cpp pyr.c | grep exit >pyr
Xchmod +x pyr
X$eunicefix pyr
Xrm pyr.c
Xif pyr; then
X    echo "This looks like a Pyramid to me."
Xfi
X
X: check for NeXT
Xcat <<'EOT' >next.c
X#ifdef NeXT
Xexit 0
X#else
Xexit 1
X#endif
XEOT
X$cpp next.c | grep exit >next
Xchmod +x next
X$eunicefix next
Xrm next.c
Xif next; then
X    echo "My, you really ARE on a NeXT."
X    addcflags='-bsd'
X    test=test
Xfi
X
Xif bsd; then
X    getuidgid=define
Xelse
X    getuidgid=undef
Xfi
X
Xcat <<'EOT' > s5uniq
Xif test -f /bin/uname
Xthen
X    case `uname -r -m` in
X	"5.3 vax-"*)
X		if [ -f /usr/lib/libnet.a \
X		  -a -f /usr/lib/libhdb.a \
X		  -a -f /usr/lib/libbbn.a \
X		  -a -f /usr/lib/libstr.a ]
X		then
X			exit 0
X		fi;;
X    esac
Xfi
Xexit 1
XEOT
Xchmod +x s5uniq
Xif s5uniq; then
X    echo "This looks like Uniq.  What a pity."
X    socketlib="-lnet -lhdb -lbbn -lstr"
X    rrninclude="-DR_UNIQ -DUSG"
X    # -DR_UNIQ and -DUSG are needed for ~nntp/common/clientlib.c
Xfi
X: check for posix
Xposix=''
Xif usg; then
X    if test -f /lib/libcposix.a; then
X    echo "Your version of System V supports POSIX compatibility."
X    echo "We'll make use of it!"
X    posix='-Xp'
X    fi
Xfi
X
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 +x 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 +x 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 +x 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 <<EOSS
X$startsh
Xset abc
Xtest "$?abc" != 1
XEOSS
X
Xchmod +x try
X$eunicefix try
Xif try; then
X    echo "Yup, it does."
Xelse
X    echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
Xfi
Xrm -f try today
X
X: find out where common programs are
Xecho " "
Xecho "Locating common programs..."
Xpth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib /usr/etc /usr/5bin /usr/bsd /usr/bsd43"
Xcat <<EOSC >loc
X$startsh
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 +x loc
X$eunicefix loc
Xloclist="expr sed echo cat rm mv cp tail tr mkdir sort uniq grep"
Xtrylist="test inews egrep more pg Mcc nidump ypmatch"
Xfor file in $loclist; do
X    xxx=`loc $file $file $pth`
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..."
Xfor file in $trylist; do
X    xxx=`loc $file $file $pth`
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, offhand."
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    echo $n 'Is your "test" built into sh? [n] (OK to guess) '"$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	echo "They are not compatible--the echo builtin will be used."
X	echo=echo
X    fi
X    $rm -f foo1 foo2
X    ;;
X*)
X    echo=echo
X    ;;
Xesac
X$echo " "
X: test yp
Xcase $ypmatch in
Xypmatch)
X    $echo "I don't see ypmatch out there, so YP is not available. We'll search the"
X    $echo "passwd file the old fashioned way!"
X    ;;
X*)
X    $ypmatch 513/tcp services > /dev/null 2>/dev/null
X    status=$?
X    if $test $status  -ne 0 ; then
X	$echo "YP installed, but not operational. We won't use it."
X	ypmatch=""
X    else
X    	$echo "YP installed and operational."
X    fi
X    
X    ;;
Xesac
Xif $test "$nidump" = "nidump"; then
X    nidump=""
Xfi
Xif $test "$ypmatch" = "ypmatch"; then
X    ypmatch=""
Xfi
X 
X: decide how portable to be
Xcase "$portable" in
Xdefine) dflt=y;;
X*)	dflt=n;;
Xesac
X$cat <<'EOH'
X 
XI can set things up so that your shell scripts and binaries are more portable,
Xat what may be a noticeable cost in performance.  In particular, if you
Xask to be portable, the following happens:
X
X     1) shell scripts will rely on the PATH variable rather than using
X	the paths derived above.
X     2) ~username interpretations will be done at run time rather than
X	by Configure.
X     3) the system name will be determined at run time, if at all possible.
X
XEOH
X$echo $n "Do you expect to run these scripts and binaries on multiple machines? [$dflt] $c"
X. myread
Xcase $ans in
X'') ans=$dflt;;
Xesac
Xcase $ans in
X    y*) portable=define
X	for file in $loclist; do
X	    eval $file=$file
X	done
X	;;
X    *)  portable=undef ;;
Xesac
X
X: set up shell script to do ~ expansion
Xcat >filexp <<EOSS
X$startsh
X: expand filename
Xcase \$1 in
X~/*|~)
X    $echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
X    ;;
X~*)
X    if $test -f /bin/csh; then
X	/bin/csh -f -c "glob \$1"
X	$echo ""
X    else
X	name=\`$expr x\$1 : '..\([^/]*\)'\`
X	if $test "$ypmatch" != ""; then
X 		dir=\`$ypmatch \$name passwd 2>/dev/null | $sed "s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/"'\`
X	elif $test "$nidump" != ""; then
X	    dir=\`$nidump passwd / | $sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}'\`
X	fi
X	if $test "\$dir" = ""; then
X	    dir=\`$sed </etc/passwd -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}'\`
X	fi
X	if $test ! -d "\$dir"; then
X	    me=\`basename \$0\`
X	    $echo "\$me: can't locate home directory for: \$name" >&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 +x filexp
X$eunicefix filexp
X
X: try to deal with domains
X$cat << 'EOH'
X
XPlease enter your domain name.  This will be used in conjunction with the
Xsite name for return addresses on news articles and mail.  If you use the
X4.3ism of having your domain in your hostname, all the posting programs
Xwill figure this out on the fly, so don't worry.
X
XExamples of some valid domains:
X	berkeley.edu
X	nasa.gov
XExample of an invalid domain in common use:
X	uucp
XEOH
X
Xcase "$domain" in
X'') dflt="uucp";;
X*)  dflt="$domain" ;;
Xesac
X$echo $n "Your domain: [$dflt] $c"
X. myread
Xcase "$ans" in
X'') domain="$dflt";;
X*)  domain="$ans" ;;
Xesac
X
X: now get the site name
X$echo " "
X$echo "Figuring out site name..."
X$echo 'Maybe "hostname" will work...'
Xif ans=`sh -c hostname 2>&1` ; then
X    thissite=$ans
X    hostcmd=hostname
Xelse
X    $echo 'No, maybe "uuname -l" will work...'
X    if ans=`sh -c 'uuname -l' 2>&1` ; then
X	thissite=$ans
X	hostcmd='uuname -l'
X    else
X	$echo 'Strange.  Maybe "uname -n" will work...'
X	if ans=`sh -c 'uname -n' 2>&1` ; then
X	    thissite=$ans
X	    hostcmd='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		thissite=`$echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
X		hostcmd="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
X	    else
X		case "$sitename" in
X		'') $echo "Does this machine have an identity crisis or something?"
X		    hostcmd=''
X		    ;;
X		*)  $echo "Well, you said $sitename before..."
X		    thissite="$sitename"
X		    ;;
X		esac
X	    fi
X	fi
X    fi
Xfi
X: you do not want to know about this
Xset $thissite
Xthissite=$1
X
X: translate upper to lower case. This is mostly to help UUCP work right.
Xcase $thissite in
X    *[A-Z]*)
X	thissite=`$echo $thissite | tr '[A-Z]' '[a-z]'`
X	$echo "(Normalizing case in your site name)"
X	;;
Xesac
X
X: verify site name and allow them to override it
Xif $test "$thissite" ; then
X    $echo 'Your site name appears to be "'$thissite'".'
Xelse
X    thissite='unknown'
Xfi
Xcase "$hostfile" in
X/*) dflt="$hostfile" ;;
X*)  case "$sitename" in
X    '') dflt="$thissite" ;;
X    *)  dflt="$sitename" ;;
X    esac
Xesac
X$cat <<'EOM'
X
XIn some cases it is not desirable to use the actual site name in your return
Xaddresses (if, for example, all mail gets routed first to one site).  In this
Xcase rn allows you to either hard-wire a site name or read the site name from
Xa file.  To indicate a file, start the name with a slash (e.g. /etc/sitename).
XTo use just your domain name, re-enter it here.  A period-less site name will
Xautomatically get your domain name added to it.
X
XEOM
Xwhile $test $dflt ; do
X    $echo $n "What site name goes in return addresses? [$dflt] $c"
X    . myread 
X    case $ans in
X    '') ans=$dflt;;
X    esac
X    case $ans in
X    /*)
X	if $test -f $ans ; then
X	    hostfile="$ans"
X	    hostcmd="$cat $ans"
X	    sitename=`$hostcmd`
X	    $echo "Rn will read the site name from $ans:  $sitename."
X	    dflt=''
X	else
X	    $echo "Unable to locate $ans."
X	fi
X	;;
X    *)  hostfile=''
X	if $test "X$thissite" = "X$ans" ; then
X	    sitename="$thissite"
X	    $echo "Using the site name derived by $hostcmd:  $sitename."
X	else
X	    hostcmd=''
X	    sitename="$ans"
X	    $echo "Using a hard-wired site name:  $sitename."
X	fi
X	dflt=''
X	;;
X    esac
Xdone
X
Xif $test $portable = "undef" ; then
X	case $sitename in
X	*.*)	;;
X	*)	sitename=$sitename.$domain
X		;;
X	esac
Xfi
X
X: get organization name
Xlongshots='/usr/src/new /usr/src/local /usr/local/src'
Xcase "$orgname" in
X'') if xxx=`loc news/src/defs.h x $longshots`; then
X	dflt=`$sed -n 's/^.*MYORG[ 	]*"\(.*\)".*$/\1/p' $xxx`
X    else
X	dflt='no default'
X    fi
X    ;;
X*)  dflt="$orgname";;
Xesac
X$cat << 'EOH'
X 
XPlease type the name of your organization as you want it to appear on the
XOrganization line of outgoing articles.  (It's nice if this also specifies
Xyour location.  Your city name is probably sufficient if well known.)
XFor example:
X
X	University of Southern North Dakota, Hoople
X
XYou may also put the name of a file, as long as it begins with a slash.
XFor example:
X
X	/etc/organization
X
XEOH
Xorgname="no default"
Xwhile test "X$orgname" = "Xno default"; do
X    $echo $n "Organization: [$dflt] $c"
X    . myread
X    case "$ans" in
X    '') orgname="$dflt";;
X    *)  orgname="$ans" ;;
X    esac
Xdone
X
X: Decide whether to ignore the ORGANIZATION environment variable
Xcat <<'EOM'
X
XRn normally looks in the environment variables NEWSORG and ORGANIZATION
Xfor an overriding organization name.  However, if your operating system
Xreserves the environment variable ORGANIZATION for non-News purposes,
Xyou will want to ignore it and only have rn check for NEWSORG.
X
XEOM
X
Xcase "$ignoreorg" in
Xdefine) dflt=y ;;
X*)      dflt=n ;;
Xesac
X$echo $n "Should we ignore ORGANIZATION? [$dflt] $c"
X. myread
Xcase "$ans" in
X'') ans="$dflt";;
Xesac
Xcase "$ans" in
Xy*) ignoreorg=define ;;
X*)  ignoreorg=undef ;;
Xesac
X
X: get news administrator name
Xcase "$newsadmin" in
X'')
X    if $contains "^news:" /etc/passwd >/dev/null 2>&1 ; then
X	dflt=news
X    else
X	if $contains "^usenet:" /etc/passwd >/dev/null 2>&1 ; then
X	    dflt=usenet
X	else
X	    if eunice; then
X		dflt=system
X	    else
X		dflt=root
X	    fi
X	fi
X    fi
X    ;;
X*)  dflt="$newsadmin"
X    ;;
Xesac
Xcat <<'EOM'
X 
XMany systems keep their news in a private directory, or have a non-superuser
Xin charge of administering news.  (If you don't have such a user, take the
Xdefault answer.)  What is the login name (not directory) that is used for news
XEOM
X$echo $n "administration? [$dflt] $c"
X. myread
Xnewsadmin="$ans"
Xcase $newsadmin in
X'') newsadmin=$dflt ;;
Xesac
Xcase $newsadmin in
Xroot) isadmin=undef ;;
X*)    isadmin=define ;;
Xesac
X
X: figure out news library
Xcase "$lib" in
X'')
X    dflt=/usr/lib/news
X    ;;
X*)  dflt=$lib ;;
Xesac
Xlibexp=$lib
Xlibexp='blurfl/dyick'
Xwhile $test ! -d "$libexp"; do
X    $echo " "
X    case "$libexp" in
X    blurfl*) ;;
X    *) $echo "Directory $libexp not found";;
X    esac
X    $echo $n "Where is your news library (~name okay)? [$dflt] $c"
X    . myread
X    case "$ans" in
X    '') ans="$dflt";;
X    esac
X    lib="$ans"
X    case $lib in
X    ~*)
X	libexp=`filexp $lib`
X	$echo "(That is $libexp on this particular system.)"
X	case $portable in
X	  undef) lib=$libexp ;;
X	esac
X	;;
X    *)
X	libexp=$lib
X	;;
X    esac
Xdone
X
X: locate the inews program
Xans='no default'
Xwhile $test ! -f "$ans" ; do
X	case $ans in
X	  'no default') ;;
X	  *) $echo "$ans does not appear to exist." ;;
X	esac
X	case "$inews" in
X	  ''|inews) 
X	    if $test -f $libexp/inews; then
X	 	 dflt=$libexp/inews
X	    else
X	    	dflt='no default'
X	    fi
X	  ;;
X	  *)  dflt="$inews" ;;
X	esac
X	$echo " "
X	$echo $n "Where is the inews program located on your system? [$dflt] $c"
X	. myread
X	case $ans in
X	  '') ans=$dflt ;;
X	esac
Xdone
Xinews=$ans
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
Xmansrc='blurfl/dyick'
Xwhile $test ! -d "$mansrc" ; do
X    case $mansrc in
X      blurfl*) ;;
X      *) $echo "$mansrc does not appear to exist." ;;
X    esac
X    $echo " "
X    $echo $n "Where do the manual pages (source) go? [$dflt] $c"
X    . myread
X    mansrc=`filexp "$ans"`
X    case $mansrc in
X      '') mansrc=$dflt ;;
X    esac
Xdone
Xcase "$mansrc" in
X*l)
X    manext=l
X    ;;
X*n)
X    manext=n
X    ;;
X*)
X    manext=1
X    ;;
Xesac
X
X: determine where mail is spooled
Xcase "$maildir" in
X'')
X    dflt=`loc . /usr/spool/mail /usr/spool/mail /usr/mail`
X    ;;
X*)  dflt="$maildir"
X    ;;
Xesac
Xcase "$dflt" in
X*%L*|*%~*) ;;
X
X*)    dflt="$dflt/%L"
Xesac
X$cat <<'EOM'
X
XRn needs to know where to find yet-to-be-read mail.  Sendmail sites
Xuse /usr/spool/mail/%L (where '%L' is the user's login name).  Some
XMMDF sites use /usr/%L/.mail instead.
X
XEOM
X$echo $n "Where is yet-to-be-read mail spooled? [$dflt] $c"
X. myread
Xmaildir="$ans"
Xcase $maildir in
X'') maildir=$dflt ;;
Xesac
X
X: find out how to find out full name
X$echo " "
Xcase "$berknam" in
Xdefine)
X    dflt=y;;
Xundef)
X    dflt=n;;
X*)
X    if bsd || xenix; then
X	dflt=y
X    else
X	dflt=n
X    fi
X    ;;
Xesac
X$echo "Does your /etc/passwd file keep full names in Berkeley/V7 format (name first"
X$echo $n "thing after ':' in GCOS field)? [$dflt] $c"
X. myread
Xcase $ans in
X  '') ans=$dflt ;;
Xesac
Xcase $ans in
X  y*)
X    passnam=define
X    berknam=define
X    usgnam=undef
X    nametype=bsd
X    ;;
X  *)
X    $echo " "
X    case "$usgnam" in
X    define)
X	dflt=y;;
X    undef)
X	dflt=n;;
X    *)
X	if usg; then
X	    dflt=y
X	else
X	    dflt=n
X	fi
X	;;
X    esac
X    $echo "Does your passwd file keep full names in USG format (name sandwiched"
X    $echo $n "between a '-' and a '(')? [$dflt] $c"
X    . myread
X    case $ans in
X      '') ans=$dflt ;;
X    esac
X    case $ans in
X      n*)
X	$echo "Full name will be taken from ~/.fullname"
X	passnam=undef
X	berknam=undef
X	usgnam=undef
X	nametype=other
X	;;
X      *)
X	passnam=define
X	berknam=undef
X	usgnam=define
X	nametype=usg
X	;;
X    esac
X    ;;
Xesac
X
X: see if we need a special compiler
X$echo " "
Xif usg; then
X    case "$cc" in
X    '')
X	case "$Mcc" in
X	/*) dflt='Mcc'
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    *)  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.  What command will force resolution on
XEOM
X    $echo $n "this system? [$dflt] $c"
X    . myread
X    cc="$ans"
X    case "$cc" in
X	'') cc="$dflt" ;;
X    esac
Xelse
X    $echo "Not a USG system--assuming cc can resolve multiple definitions."
X    cc=cc
Xfi
X
X: see if we should throw a -i into the Makefile
X$echo " "
Xif pdp11; then
X    if $contains '\-i' $mansrc/cc.1 >/dev/null 2>&1 ; then
X	$echo $n "Your system appears to have separate I and D space.  Is this true? [y] $c"
X	. myread
X	case $ans in
X	    n*|f*) iandd='' ;;
X	    *)     iandd='-i' ;;
X	esac
X    else
X	$echo "Your system appears to NOT have separate I and D space."
X	$echo $n "Is this correct? [y] $c"
X	. myread
X	case $ans in
X	    n*|f*) iandd='-i' ;;
X	    *)     iandd='' ;;
X	esac
X    fi
Xelse
X    $echo "Not a pdp11--assuming no separate I and D."
Xfi
X
X: index or strcpy
X$echo " "
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? [y] $c"
X    . myread
X    case $ans in
X	n*|f*) strchr='define' ;;
X	*)     strchr='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? [y] $c"
X    . myread
X    case $ans in
X	n*|f*) strchr=undef ;;
X	*)     strchr=define ;;
X    esac
Xfi
X
X: bcopy/bzero or memcpy/memset
X$echo " "
Xif $contains '^bcopy$' libc.list >/dev/null 2>&1 ; then
X    $echo "Your system appears to use bcopy() and bzero() rather than memcpy()"
X    $echo $n "and memset().  Is this correct? [y] $c"
X    . myread
X    case $ans in
X	n*|f*) memcpy='define' ;;
X	*)     memcpy='undef' ;;
X    esac
Xelse
X    $echo "Your system appears to use memcpy() and memset() rather than bcopy()"
X    $echo $n "and bzero().  Is this correct? [y] $c"
X    . myread
X    case $ans in
X	n*|f*) memcpy='undef' ;;
X	*)     memcpy='define' ;;
X    esac
Xfi
X
X: check for S5-style timezone handling - current offset from GMT in
X: external variable "timezone" rather than gotten with "ftime".
X$echo " "
Xif $contains tzname /usr/include/time.h >/dev/null 2>&1 ; then
X    $echo "Your system appears to get the current timezone's offset from GMT"
X    $echo "by using the external variable timezone rather than by calling"
X    $echo $n "ftime() or gettimeofday(). Is this correct? [y] $c"
X    . myread
X    case $ans in
X	n*|f*) tzset='undef' ;;
X	*)     tzset='define' ;;
X    esac
Xelse
X    $echo "Your system appears to get the current timezone's offset"
X    $echo "from GMT by calling ftime() or gettimeofday() rather than"
X    $echo $n "from the external variable timezone. Is this correct? [y] $c"
X    . myread
X    case $ans in
X	n*|f*) tzset='define' ;;
X	*)     tzset='undef' ;;
X    esac
Xfi
X
X: determine how to determine when a file is a mailbox
Xcase "$mboxchar" in
X'') dflt=F;;
X*)  dflt="$mboxchar";;
Xesac
X$cat <<'EOM'
X 
XIn saving articles, rn wants to differentiate between saving to mailbox
Xformat files and normal files.  It does this by examining the first character
Xof the file in question.  On most systems the first line starts "From...",
Xso the first character is F.  On other systems there are magic cookies like
Xcontrol codes between articles, so one of those would be first.  For example,
XMMDF messages are separated with lines of 4 control-A's.  On your system, if a
XEOM
X$echo $n "file is in mailbox format, what is the first character of that file? [$dflt] $c"
X. myread
Xmboxchar="$ans"
Xcase $mboxchar in
X'') mboxchar="$dflt" ;;
Xesac
Xcase $mboxchar in
X'F') ;;
X"$CTRLA") ;;
X*)  cat <<'EOM'
XYou will need to edit the shell script mbox.saver to properly append an
Xarticle to a mailbox.  The arguments to the script are documented in
XEOM
X    case $shsharp in
X    false)
X	$echo "comments in mbox.saver.std."
X	;;
X    true)
X	$echo "comments in the shell script itself."
X	;;
X    esac
Xesac
X$rm -f grimble
X: where do we get termlib routines from
X$echo " "
Xans=`loc libcurses.a x /usr/lib /usr/local/lib /lib`
Xcase "$ans" in
X/*)
X    if test -f /bin/smit; then
X	termlib='-lcurses'
X	havetlib=define
X	$echo "Using -lcurses and assuming terminfo, since this looks like AIX."
X    else
X	ar t $ans >grimble
X	if $contains tputs grimble >/dev/null 2>&1; then
X	    termlib='-lcurses'
X	    havetlib=define
X	    $echo "Terminfo library found."
X	else
X	    ans=x
X	fi
X    fi
X    ;;
Xesac
Xcase "$ans" in
Xx)
X    ans=`loc libtermlib.a x /usr/lib /usr/local/lib /lib`
X    case "$ans" in
X    /usr/lib*|/lib*)
X	termlib='-ltermlib'
X	havetlib=define
X	$echo "Termlib library found."
X	;;
X    /*)
X	termlib="$ans"
X	havetlib=define
X	$echo "Termlib library found."
X	;;
X    *)
X	if xenix; then
X	    ans=/lib/Llibtermcap.a
X	else
X	    ans=`loc libtermcap.a x /usr/lib /usr/local/lib /lib`
X	fi
X	case "$ans" in
X	/usr/lib*|/lib*)
X	    termlib='-ltermcap'
X	    havetlib=define
X	    $echo "Termcap library found."
X	    ;;
X	/*)
X	    termlib="$ans"
X	    havetlib=define
X	    $echo "Termcap library found."
X	    ;;
X	*)
X	    case "$termlib" in
X	    '')
X		$echo $n "Your system appears to NOT have termlib-style routines.  Is this true? [y] $c"
X		. myread
X		case $ans in
X		    n*|f*) 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			  . myread
X			  termlib=`filexp $ans`
X			  ;;
X		    *)    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: see if there is a whoami file
Xif $test -r /usr/include/whoami.h ; then
X    whoami=define
X    $echo "whoami.h found."
Xelse
X    whoami=undef
Xfi
X
X: see if this is a termio/termios/sgtty system
Xif ultrix || sun || pyr ; then
X    termio=undef
X    termios=undef
X    $echo "Using sgtty.h"
Xelse
Xif $test -r /usr/include/termio.h ; then
X    termio=define
X    termios=undef
X    $echo "termio.h found."
Xelse
Xif test -d /usr/convex ; then
X    termio=undef
X    termios=define
X    $echo "termios.h found."
Xelse
Xif $test -r /usr/include/sgtty.h ; then
X    termio=undef
X    termios=undef
X    $echo "sgtty.h found."
Xelse
X    termio=undef
X    termios=undef
X    $echo "Neither termio.h nor sgtty.h found--you could have problems."
Xfi
Xfi
Xfi
Xfi
X
X: see if this system has fcntl
Xif $test -r /usr/include/fcntl.h ; then
X    fcntl=define
X    $echo "fcntl.h found."
Xelse
X    fcntl=undef
X    $echo "No fcntl.h found, but that's ok."
Xfi
X
X: see if ioctl defs are in sgtty/termio or sys/ioctl
Xif $test -r /usr/include/sys/ioctl.h ; then
X    ioctl=define
X    $echo "sys/ioctl.h found."
Xelse
X    ioctl=undef
X    $echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
Xfi
X
X: see if ptem.h exists
Xif $test -r /usr/include/sys/ptem.h ; then
X    ptem=define
X    $echo "sys/ptem.h found."
Xelse
X    ptem=undef
Xfi
X
X: see if the system has sigblock
Xif $contains '^sigblock$' libc.list >/dev/null 2>&1 ; then
X     if sgi; then
X         $echo "sigblock() found -- but should not use it on Silicon Graphics"
X         sigblock=undef
X    else
X	$echo "sigblock() found."
X        sigblock=define
X    fi
Xelse
X    sigblock=undef
Xfi
X
X: see if the system has getwd
Xif $contains '^getwd$' libc.list >/dev/null 2>&1 ; then
X    $echo "getwd() found."
X    getcwd=undef
X    getwd=define
Xelse
Xif DGUX; then
X    $echo "I know DG/UX has getwd()."
X    getcwd=undef
X    getwd=define
Xelse
X: see if the system has getcwd
Xif $contains '^getcwd$' libc.list >/dev/null 2>&1 ; then
X    $echo "getcwd() found."
X    getcwd=define
X    getwd=undef
Xelse
X    getcwd=undef
X    getwd=undef
Xfi
Xfi
Xfi
X
X: see if there is a vfork
Xif $contains '^vfork$' libc.list >/dev/null 2>&1 ; then
X    $echo "vfork() found."
X    novfork='undef'
X    if sgi; then
X        $echo "However, IRIX vfork() is buggy. We'll use fork() instead."
X        novfork='define'
X    fi
Xelse
X    if next; then
X	$echo "I know NeXTs have vfork()!"
X	novfork='undef'
X    else
X	$echo "No vfork() found--will use fork() instead."
X	novfork='define'
X    fi
Xfi
X
X: check for rename
Xif $contains '^rename$' libc.list >/dev/null 2>&1 ; then
X    $echo "rename() found."
X    rename='define'
Xelse
X    $echo "No rename() found -- we'll emulate it."
X    rename='undef'
Xfi
X
X: check for truncate
Xif $contains '^truncate$' libc.list >/dev/null 2>&1 ; then
X    $echo "truncate() found."
X    truncate='define'
Xelse
X    $echo "No truncate() found -- we'll emulate it."
X    truncate='undef'
Xfi
X
X: see if YP could be running here
Xif $contains 'yp_master$' libc.list >/dev/null 2>&1 ; then
X    $echo "YP may be running -- will use getpwent(), just in case."
X    getpwent='define'
Xelse
X: see if there is a getpwent
Xif $contains '^getpwent$' libc.list >/dev/null 2>&1 ; then
X    $echo "getpwent() found."
X    getpwent='define'
Xelse
X    $echo "No getpwent() found--will use getpw() instead."
X    getpwent='undef'
Xfi
Xfi
X
X: default
Xsigret=int
X: determine type of signal function
Xif sgi; then
X	sigret=void
Xelse
Xif next; then
X	sigret=int
Xelse
Xif stardent; then
X	sigret=void
Xelse
Xif test -f /usr/include/signal.h ; then
X	$cpp /usr/include/signal.h >sigtest
Xelse
Xif test -f /usr/include/sys/signal.h ; then
X	$cpp /usr/include/sys/signal.h >sigtest
Xfi
Xfi
Xif $contains 'void.*signal' sigtest >/dev/null
Xthen
X	sigret=void
Xfi
Xfi
Xfi
Xfi
X$echo "signal() returns $sigret on this system."
X: see how we will look up site name
Xdouname=undef
Xgethostname=undef
Xphostname=undef
Xif $test ! "X$hostfile" = X ; then
X    gethostname=define
Xelse
Xif $test "X$hostcmd" = X ; then
X    : it is already compiled in
Xelse
Xif $contains '^gethostnam' libc.list >/dev/null 2>&1 ; then
X    $echo "gethostname() found."
X    gethostname=define
Xelse
X    if $contains '^uname$' libc.list >/dev/null 2>&1 ; then
X	$echo "uname() found."
X	douname=define
X    else
X	case $hostcmd in
X	  '') ;;
X	  *)
X	    $cat <<EOT
X 
XThere is no gethostname() or uname() on this system.  You have two
Xpossibilites at this point:
X
X1)  You can have your site name ($sitename) compiled into rn, which lets
X    rn start up faster, but makes your binaries non-portable, or
X2)  you can have rn use a
X	
X	popen("$hostcmd","r")
X
X    which will start slower but be more portable.
X
XOption 1 will use whoami.h if you have one.  If you want option 2 but with
Xa different command, you can edit config.h after this shell script is done.
X
XEOT
X	    case "$phostname" in
X	    define) dflt=n;;
X	    undef)  dflt=y;;
X	    '')
X		case $portable in
X		define) dflt=n ;;
X		*)      dflt=y ;;
X		esac
X		;;
X	    esac
X	    $echo $n "Do you want your site name compiled in? [$dflt] $c"
X	    . myread
X	    case $ans in
X	    '') ans=$dflt;;
X	    esac
X	    case $ans in
X	      n*) phostname=define ;;
X	      *)  hostcmd='' phostname=undef;;
X	    esac
X	    ;;
X	esac
X	case $hostcmd in
X	  '')
X	    case $whoami in
X	      define)
X		$echo 'No hostname function--using whoami.h.'
X		;;
X	      undef)
X		$echo 'No hostname function--hardwiring "'$sitename'".'
X		;;
X	    esac
X	    ;;
X	esac
X    fi
Xfi
Xfi
Xfi
X
X: see if we need -ljobs and if we have sigset, etc.
Xif $test -r /usr/lib/libjobs.a || $test -r /usr/local/lib/libjobs.a ; then
X    $echo "Jobs library found."
X    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    if $contains '^sigset$' libc.list >/dev/null 2>&1 ; then
X	$echo "However, sigset() does exist, so we'll make use of it."
X	normsig=undef
X    else
X    	normsig=define
X    fi
X    jobslib=''
Xfi
X: use sighold and sigrelse?
Xif $contains '^sighold$' libc.list >/dev/null 2>&1 ; then
X	$echo "sighold() found"
X	sighold=define
X    else
X    	sighold=undef
Xfi
X: set the right options for cc and include the x library for XENIX
Xif xenix; then
X    if $test -d /lib/386 ; then
X	iandd="-M3e"
X    else
X:	iandd="-M2let8 -LARGE -F 3000"
X	iandd="-Ml2et32 -LARGE -F B000"
X    fi
X    jobslib=-lx
X    chsize=define
Xelse
Xif $test -r /lib/libx.a -a -f /xenix ; then
X    $echo "Found Xenix library; using chsize()"
X    jobslib=-lx
X    chsize=define
Xelse
X    chsize=undef
Xfi
Xfi
X: No Steve jokes...
Xif next; then
X    jobslib='-lsys_s'
Xfi
X: see if there are directory access routines out there
X    ndirlib=''
X    libndir=undef
X    if $contains '^readdir$' libc.list >/dev/null 2>&1 ; then
X	$echo "readdir() found."
X	usendir=undef
X	ndirc=''
X	ndiro=''
X	if sgi ; then
X	    dirtype=direct
X	    dirinc="<sys/dir.h>"
X	    $echo "Using direct directory structure."
X	else 
X		if $test -r /usr/include/dirent.h ; then
X			$echo "Using dirent directory structure."
X	    		dirtype=dirent
X			dirinc="<dirent.h>"
X		else
X			$echo "Using direct directory structure."
X	    		dirtype=direct
X			dirinc="<sys/dir.h>"
X		fi
X	fi
X     else
X	if xenix; then
X	    $echo "Using Xenix readdir() from -lx."
X	    usendir=undef
X	    ndirc=''
X	    ndiro=''
X	    dirtype=direct
X	    dirinc="<sys/ndir.h>"
X	    $echo "Using direct directory structure."
X	else
X		if $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    		libndir=define
X    		usendir=undef
X    		ndirc=''
X    		ndiro=''
X    		dirtype=direct
X    		dirinc="<ndir.h>"
X		else
X	    		$echo "No ndir library and no readdir()--using ./ndir.c."
X	    		usendir=define
X	    		ndirc='ndir.c'
X	    		ndiro='ndir.o'
X	    		dirtype=direct
X	fi
X    fi
Xfi
X
X: locate spool directory and check if rrn
Xcase "$isrrn" in
Xdefine)
X    dflt="y";;
X*)
X    dflt="n";;
Xesac
Xisrrn=''
Xwhile $test -z "$isrrn" ; do
X    $echo " "
X    $echo $n "Do you want to build the NNTP version of rn (rrn)? [$dflt] $c"
X    . myread
X    case "$ans" in
X    '') ans="$dflt";;
X    esac
X    case "$ans" in
X    n*)
X	isrrn=undef;;
X    y*)
X	isrrn=define
X	spool=/tmp
X	$echo "net.foobar 00001 00001 y" > .falseactive
X
X	case "$serverfile" in
X	'')  dflt="no default" ;;
X	*)   dflt="$serverfile";;
X	esac
X
X	$cat <<'EOM'
X
XRrn determines the machine to use as a news server by two means:
X
X	1. It examines the environment variable NNTPSERVER for
X	   a machine name; this allows users to use server machines
X	   other than the default.
X
X	2. It looks in a file which contains the name of a server
X	   machine.
X
XYou must create the file mentioned in (2), above.  Simply put the name
Xof the machine you wish to use as your news server in this file.
XIf you really want, you can use # for comments and blank lines in
Xthis file as well.
X
XEOM
X
X	ans='blurfl/dyick'
X	while $test ! -r "$ans" ; do
X	$echo $n "Enter the name of the news server file: [$dflt] $c"
X	. myread
X	    case "$ans" in
X	    '') ans="$dflt";;
X	    esac
X	    ans=`filexp "$ans"`
X	    if $test ! -r $ans ; then
X		$echo "Can't find $ans"
X		ans='blurfl/dyick'
X	    fi
X	done
X	serverfile="$ans"
X
X	case "$NNTPSRC" in
X	'') dflt="no default";;
X	*)  dflt="$NNTPSRC";;
X	esac
X
X	ans='blurfl/dyick'
X	while $test ! -d "$ans"; do
X	    $echo $n "Enter the pathname of the NNTP source directory: [$dflt] $c"
X	    . myread
X	    case "$ans" in
X	    '') ans="$dflt";;
X	    esac
X	    ans=`filexp "$ans"`
X	    if $test ! -r $ans/common/nntp.h ; then
X		$echo "Can't find $ans/common/nntp.h!"
X		ans='blurfl/dyick'
X	    fi
X	done
X	NNTPSRC="$ans"
X    esac
X
Xdone
X: hack for Unisys NET-5000 and Interactive V/386
Xcase "$isrrn" in
Xdefine) 
X: NET-5000
X    if $test -d /usr/include/NET-5000 ; then
X	$echo "I sense you are on a Unisys 5000 computer...poor soul."
X	rrninclude="-I/usr/include/NET-5000 -DEXCELAN -DUSG"
X	socketlib=-lsocket
X    fi
X: Interactive Unix
X    if $test -f /usr/lib/libinet.a ; then
X	rrninclude="-DUSG"
X	socketlib=-linet
X    fi
X    ;;
X*) ;;
Xesac
X
X
Xcase "$spool" in
X'')
X    dflt=/usr/spool/news
X    ;;
X*)  dflt="$spool";;
Xesac
Xcase "$isrrn" in
Xdefine)  ans=/tmp;;
X*) ans='blurfl/dyick';;
Xesac
Xwhile $test ! -d $ans; do
X    $echo " "
X    case "$ans" in
X    blurfl*);;
X    *) $echo "Directory $ans not found.";;
X    esac
X    $echo $n "Where is news spooled (~name ok)? [$dflt] $c"
X    . myread
X    case "$ans" in
X    '') ans="$dflt";;
X    esac
X    spool="$ans"
X    case $spool in
X    ~*)
X	ans=`filexp $spool`
X	$echo "(That is $ans on this particular system.)"
X	case $portable in
X	  undef) spool=$ans ;;
X	esac
X	;;
X    *)
X	ans=$spool
X	;;
X    esac
Xdone
X
X: locate active file
Xcase "$active" in
X'')
X    dflt=$lib/active
X    ;;
X*)  dflt="$active";;
Xesac
Xcase "$isrrn" in
Xdefine) myactive=.falseactive
X    : check for active.times
X    case "$activetimes" in
X    ''|none|nntp) dflt="n";;
X    *)		  dflt="y";;
X    esac
X    cat <<'EOM'
X
XIf your server maintains an accurate "active.times" file (as C news does), rn
Xcan make use of the much better NEWGROUPS call in NNTP to find new groups. 
XOtherwise, the old method will suffice.
X
XEOM
X    $echo $n "Will your server support a reliable NEWGROUPS call? [$dflt] $c"
X    . myread
X    case "$ans" in
X    '') ans="$dflt";;
X    esac
X    case "$ans" in
X    y*) activetimes="nntp";;
X    *)  activetimes='none';;
X    esac
X    ;;
X*) myactive='blurfl/dyick'
Xesac
Xwhile $test ! -f "$myactive"; do
X    $echo " "
X    case "$myactive" in
X    blurfl*);;
X    *) "File $myactive not found.";;
X    esac
X    $echo $n "Where is the active file (~name ok)? [$dflt] $c"
X    . myread
X    case "$ans" in
X    '') ans="$dflt";;
X    esac
X    active="$ans"
X    case $active in
X    ~*)
X	myactive=`filexp $active`
X	$echo "(That is $myactive on this particular system.)"
X	case $portable in
X	  undef) active=$myactive ;;
X	esac
X	;;
X    *)
X	myactive=$active
X	;;
X    esac
X    if $test -d $myactive ; then
X	myactive=$myactive/active
X	active=$active/active
X    fi
X    : check for active.times
X    case "$activetimes" in
X    ''|nntp) dflt="${active}.times";;
X    *)       dflt="$activetimes";;
X    esac
X    if $test "$dflt " = "none " -o ! -f $dflt ; then
X	$cat <<'EOM'
X
XIf rn can use a file called active.times it can greatly speed up the
Xnewgroup-checking code.  If you have access to a file maintained by C news,
Xuse that.  Or you can install acttimes to maintain an active.times file
Xfor you.  Otherwise, specify "none" for the good ol' slow approach.
X
XEOM
X    else
X	$cat <<EOM
X
X-- Found $dflt --
XIf this file is being maintained by C news, mthreads -t, or some other means,
Xyou'll probably want to use it to greatly speed up the newgroup code.  If not
Xuse "none" to indicate the good ol' slow approach.
X
XEOM
X    fi
X    $echo $n "Active.times file to use or 'none'? [$dflt] $c"
X    . myread
X    case "$ans" in
X    '') ans="$dflt";;
X    esac
X    activetimes="$ans"
Xdone
X
X: check for 2.10.2 and above
X$echo " "
Xif $contains ' [0-9][0-9]* [0-9]' "$myactive" >/dev/null 2>&1; then
X    case "$norelay" in
X    undef) dflt="y";;
X    *)     dflt="n";;
X    esac
X    case "$isrrn" in
X    define) 
X       $echo "Is your NNTP server running an old version of news software," ;;
X    *) $echo "Is your system running an old version of news software," ;;
X    esac
X    $echo $n "predating B News 2.10.3? [${dflt}] $c" 
X    . myread
X    case "$ans" in
X    '') ans=$dflt;;
X    esac
X    case "$ans" in
X    y*)
X      norelay='undef'
X    $echo "Looks like you are running at least 2.10.2 news."
X      ;;
X    *)  norelay='define' ;;
X    esac
X    mininact=define
Xelse
X    $echo "It doesn't look like you are running 2.10.2 news yet.  Are you planning"
X    $echo $n "to install it in the near future? [y] $c"
X    . myread
X    case $ans in
X    n*) mininact=undef ;;
X    *)  mininact=define ;;
X    esac
X    norelay='undef'
Xfi
X
X
X: check for void type
X$echo " "
X$echo "Checking to see if your C compiler groks the void type..."
X$cat >try.c <<'EOCP'
Xvoid main();
XEOCP
Xif cc -c try.c >/dev/null 2>&1 ; then
X    novoid='undef'
X    $echo "Yup, it does."
Xelse
X    novoid='define'
X    $echo "Nope, it doesn't (boo hiss).  I will substitute int."
Xfi
X$rm try.*
X
X: find out which shell people like to use most
Xans='blurfl/dyick'
Xwhile $test ! -f "$ans" ; do
X    case $ans in
X      blurfl*) ;;
X      *) $echo "$ans does not appear to exist." ;;
X    esac
X    case "$pref" in
X    '')
X	if $test -f /bin/ksh; then
X	    dflt='/bin/ksh'
X	else
X	    if $test -f /bin/csh; then
X		dflt='/bin/csh'
X	    else
X		dflt='/bin/sh'
X	    fi
X	fi
X	;;
X    *)  dflt="$pref";;
X    esac
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    . myread
X    case $ans in
X      '') ans=$dflt ;;
X    esac
Xdone
Xpref=$ans
X
X: locate the preferred pager for this system
Xcase "$pager" in
X'')
X    case $pg in
X    /*) dflt=$pg
X	;;
X    esac
X    case $more in
X    /*) dflt=$more
X	;;
X    esac
X    case $dflt in
X    '') dflt=/usr/ucb/more
X	;;
X    esac
X    ;;
X*)  dflt="$pager";;
Xesac
Xpager='blurfl/dyick'
Xwhile $test ! -f "$pager" ; do
X    case $pager in
X      blurfl*)
X	$echo " "
X	$echo "(If your kernel does terminal paging then you may answer this with '/bin/cat'.)"
X	;;
X      /*) $echo "$pager does not appear to exist."
X	$echo " "
X        ;;
X      *) $echo "Please give the full path name."
X	$echo " "
X        ;;
X    esac
X    $echo $n "What pager is used on your system? [$dflt] $c"
X    . myread
X    pager="$ans"
X    case $pager in
X      '') pager="$dflt" ;;
X    esac
Xdone
X
X: determine default editor
Xcase "$defeditor" in
X'')
X    dflt=`loc vi /usr/ucb $pth`
X    ;;
X*)  dflt="$defeditor"
X    ;;
Xesac
Xdefeditor='blurfl/dyick'
Xwhile $test ! -f "$defeditor" ; do
X    case $defeditor in
X      blurfl*) ;;
X      *) $echo "$defeditor does not appear to exist." ;;
X    esac
X    $echo " "
X    $echo $n "What is the default editor on your system? [$dflt] $c"
X    . myread
X    defeditor="$ans"
X    case $defeditor in
X      '') defeditor=$dflt ;;
X    esac
Xdone
X
X: determine default mailer for Rnmail to use
X$echo " "
Xif $test -f /usr/lib/sendmail; then
X    dflt=/usr/lib/sendmail
Xelse
X    if usg && $test -f $libexp/recmail; then
X        dflt=$libexp/recmail
X    else
X        dflt=/bin/mail
X    fi
Xfi
X$echo " "
Xif $test "$dflt" = "$libexp/recmail"; then
X    $echo "($libexp/recmail is a part of the news package,and can"
X    $echo "be safely used as the default mailer for the rrn package."
X    $echo "You can also use the standard /bin/mail program if you choose.)"
X    $echo " "
Xfi
X$echo $n "What is the default mailer on your system? [$dflt] $c"
X. ./myread                      
Xmailer="$ans"
Xcase $mailer in
X    '') mailer=$dflt ;;
Xesac
X$echo "Mail sender is $mailer"
X
X: check for internet mailer
Xcase "$internet" in
Xdefine) dflt=y;;
Xundef)	dflt=n;;
X*)
X    case "$isrrn" in
X	define) dflt=y ;;
X	*) dflt=n ;;
X    esac
X    ;;
Xesac
Xcat <<EOM
X 
XSome newer mailers can deliver mail to addresses of the INTERNET persuasion,
Xsuch as user@host.UUCP.  Other older mailers require the complete path to
Xthe destination to be specified in the address.  Does your mailer understand
XEOM
X$echo $n "INTERNET addresses? [$dflt] $c"
X. myread
Xcase "$ans" in
X'') ans=$dflt;;
Xesac
Xcase "$ans" in
Xy*) internet=define;;
X*)  internet=undef;;
Xesac
X
X: determine where public executables go
Xcase "$rnbin" in
X'')
X    dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
X    ;;
X*)  dflt="$rnbin"
X    ;;
Xesac
Xrnbin='blurfl/dyick'
Xwhile $test ! -d "$rnbin" ; do
X    case $rnbin in
X      blurfl*) ;;
X      *) $echo "$rnbin does not appear to exist." ;;
X    esac
X    $echo " "
X    $echo $n "Where do you want to put the public executables? [$dflt] $c"
X    . myread
X    rnbin="$ans"
X    rnbin=`filexp $rnbin`
X    case $rnbin in
X      '') rnbin=$dflt ;;
X    esac
Xdone
X
X: determine where private executables go
Xcase "$rnlib" in
X'')
X    case "$isrrn" in
X	define) dflt=/usr/local/lib/rn ;;
X	*) dflt=$lib/rn ;;
X    esac
X    ;;
X*)  dflt="$rnlib"
X    ;;
Xesac
X$echo " "
X$echo "Rn has a number of auxiliary programs that need not be visible to the"
X$echo "whole world.  Where do you want to put these private executables?"
X$echo $n "[$dflt] (~name ok) $c"
X. myread
Xrnlib="$ans"
Xcase $rnlib in
X  '') rnlib=$dflt ;;
Xesac
Xcase $portable in
Xundef)
X    rnlib=`filexp $rnlib`
X    ;;
Xesac
X: must not allow self reference
Xcase $rnlib in
X  /*)
X    filexp=$rnlib/filexp
X    ;;
X  *)
X    filexp=`pwd`/filexp
X    ;;
Xesac
X
X: get the local distribution prefixes
Xif $test -f $libexp/sys ; then
X    $sed <$libexp/sys -n -e "s/^$sitename://p" | \
X    $sed -e "s/:.*//" -e "s/,/ /g" | tr ' ' '\012' | \
X    $sed -e "/^to./d" -e "/^net$/d" -e "/^fa$/d" -e "/^mod$/d" > .distlist
Xfi
X
X$cat <<'EOH'
X 
XDistribution groups are the things you use on the Distribution line to limit
Xwhere an article will go to.  You are likely to be a member of several
Xdistribution groups, such as organization, city, state, province, country,
Xcontinent, etc.  For example, Los Angeles has the distribution prefix "la",
XNew Jersey has the prefix "nj", and Europe has the prefix "eunet".
X
XThe categories you will be asked are: 
X
Xlocal organization	(Could be just one machine or a cluster or an office)
Xorganization		att, dec, kgb, ...
Xcity			la, ny, mosc, ...
Xstate/province		ca, nj, bc, ...
Xcountry			usa, can, rok, whatever
Xcontinent		na (North America, not "Not Applicable"), asia, etc.
X
X(If you don't have a distribution prefix in any of these categories then
Xjust hit return.)
X
XEOH
Xif $test -f .distlist; then
X    distlist=`tr '\012' ' ' <.distlist`
X    if $test "$distlist" ; then
X	$echo "(These are the distributions in your sys file: $distlist)"
X	$echo " "
X    fi
Xfi
Xcase "$locpref" in
X'') dflt="";;
X*)  dflt="[$locpref] ";;
Xesac
X$echo $n "What is the distribution prefix for your local organization? $dflt$c"
X. myread
Xcase "$ans" in
X'') ;;
X*)  locpref="$ans";;
Xesac
Xcase $locpref in
X  '') locpref=none ;;
Xesac
Xcase "$orgpref" in
X'') dflt="";;
X*)  dflt="[$orgpref] ";;
Xesac
X$echo $n "What is the distribution prefix for your organization? $dflt$c"
X. myread
Xcase "$ans" in
X'') ;;
X*)  orgpref="$ans";;
Xesac
Xcase $orgpref in
X  '') orgpref=none ;;
Xesac
Xcase "$citypref" in
X'') dflt="";;
X*)  dflt="[$citypref] ";;
Xesac
X$echo $n "What is the distribution prefix for your city? $dflt$c"
X. myread
Xcase "$ans" in
X'') ;;
X*)  citypref="$ans";;
Xesac
Xcase $citypref in
X  '') citypref=none ;;
Xesac
Xcase "$statepref" in
X'') dflt="";;
X*)  dflt="[$statepref] ";;
Xesac
X$echo $n "What is the distribution prefix for your state/province? $dflt$c"
X. myread
Xcase "$ans" in
X'') ;;
X*)  statepref="$ans";;
Xesac
Xcase $statepref in
X  '') statepref=none ;;
Xesac
Xcase "$cntrypref" in
X'') dflt="";;
X*)  dflt="[$cntrypref] ";;
Xesac
X$echo $n "What is the distribution prefix for your country? $dflt$c"
X. myread
Xcase "$ans" in
X'') ;;
X*)  cntrypref="$ans";;
Xesac
Xcase $cntrypref in
X  '') cntrypref=none ;;
Xesac
Xcase "$contpref" in
X'') dflt="";;
X*)  dflt="[$contpref] ";;
Xesac
X$echo $n "What is the distribution prefix for your continent? $dflt$c"
X. myread
Xcase "$ans" in
X'') ;;
X*)  contpref="$ans";;
Xesac
Xcase $contpref in
X  '') contpref=none ;;
Xesac
X
X$echo " "
X$echo "If you have any other distribution groups you will need to edit Pnews"
X$echo "and newsetup to add them."
X$echo " "
X
X: determine root id
Xrootid=`$sed </etc/passwd -e "/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"`
Xcase $rootid in
X  '') rootid=0 ;;
X  *)  $echo "Root uid = $rootid" ;;
Xesac
X
X: weed out incompatibilities
Xcase $douname in
X  define) whoami=undef ;;
Xesac
X
X: preserve RCS keywords in files with variable substitution, grrr
XLog='$Log'
XId='$Id'
X
X: Warnings
Xif v7; then
X    cat <<'EOM'
X 
XNOTE: the V7 compiler may ignore some #undefs that rn uses.  If so, you will
Xget messages about redefining EXT.  Some V7 compilers also have difficulties
Xwith #defines near buffer boundaries, so beware.  You may have to play with
Xthe spacing in common.h.
XEOM
Xfi
X
Xif pdp11; then
X    cat <<'EOM'
X 
XNOTE: the PDP-11 does not have enough data space to do subject caching
Xreliably.  That feature will be disabled automatically.  Subject searching
Xwill tend to be slow.
XEOM
Xfi
Xcase "$isrrn" in
X	define) ;;
X	*) socketlib=""
X	   rrninclude=""
X	 ;;
Xesac
X
X$echo " "
X$echo "End of configuration questions."
X$echo " "
X
X: create config.sh file
X$echo " "
X$echo "Creating config.sh..."
X$spitshell <<EOT >config.sh
X$startsh
X# config.sh
X# This file was produced by running the Configure script.
X
Xn='$n'
Xc='$c'
Xlibc='$libc'
Xeunicefix='$eunicefix'
Xeunice='$eunice'
Xcpp='$cpp'
Xshsharp='$shsharp'
Xstartsh='$startsh'
Xspitshell='$spitshell'
Xtest='$test'
Xexpr='$expr'
Xsed='$sed'
Xecho='$echo'
Xcat='$cat'
Xrm='$rm'
Xmv='$mv'
Xcp='$cp'
Xtail='$tail'
Xtr='$tr'
Xmkdir='$mkdir'
Xsort='$sort'
Xuniq='$uniq'
Xinews='$inews'
Xgrep='$grep'
Xegrep='$egrep'
Xnidump='$nidump'
Xypmatch='$ypmatch'
Xcontains='$contains'
Xlib='$lib'
Xlibexp='$libexp'
Xnametype='$nametype'
Xcc='$cc'
Xiandd='$iandd'
Xinclude='$include'
Xrrninclude='$rrninclude'
Xtermlib='$termlib'
Xjobslib='$jobslib'
Xsocketlib='$socketlib'
Xgetcwd='$getcwd'
Xgetwd='$getwd'
Xdirtype='$dirtype'
Xdirinc='$dirinc'
Xndirlib='$ndirlib'
Xlibndir='$libndir'
Xusendir='$usendir'
Xndirc='$ndirc'
Xndiro='$ndiro'
Xposix='$posix'
Xpager='$pager'
Xmailer='$mailer'
Xinternet='$internet'
Xrnbin='$rnbin'
Xfilexp='$filexp'
Xdistlist='$distlist'
XLog='$Log'
XId='$Id'
Xsitename='$sitename'
Xhostfile='$hostfile'
Xdomain='$domain'
Xorgname="$orgname"
Xisadmin='$isadmin'
Xnewsadmin='$newsadmin'
Xrnlib='$rnlib'
Xmansrc='$mansrc'
Xmanext='$manext'
Xmaildir='$maildir'
Xspool='$spool'
Xactive='$active'
Xmyactive='$myactive'
Xactivetimes='$activetimes'
Xmininact='$mininact'
Xpref='$pref'
Xdefeditor='$defeditor'
Xrootid='$rootid'
Xmboxchar='$mboxchar'
Xlocpref='$locpref'
Xorgpref='$orgpref'
Xcitypref='$citypref'
Xstatepref='$statepref'
Xcntrypref='$cntrypref'
Xcontpref='$contpref'
Xstrchr='$strchr'
Xmemcpy='$memcpy'
Xrename='$rename'
Xtruncate='$truncate'
Xchsize='$chsize'
Xtzset='$tzset'
Xnovoid='$novoid'
Xnovfork='$novfork'
Xsunos4='$sunos4'
Xportable='$portable'
Xpassnam='$passnam'
Xberknam='$berknam'
Xusgnam='$usgnam'
Xwhoami='$whoami'
Xtermio='$termio'
Xfcntl='$fcntl'
Xioctl='$ioctl'
Xptem='$ptem'
Xnormsig='$normsig'
Xsigblock='$sigblock'
Xsigret='$sigret'
Xsighold='$sighold'
Xgetuidgid='$getuidgid'
Xhavetlib='$havetlib'
Xgetpwent='$getpwent'
Xgethostname='$gethostname'
Xdouname='$douname'
Xphostname='$phostname'
Xhostcmd='$hostcmd'
Xnorelay='$norelay'
Xrdchk='$rdchk'
Xisrrn='$isrrn'
Xserverfile='$serverfile'
Xignoreorg='$ignoreorg'
XNNTPSRC='$NNTPSRC'
XCONFIG=true
XEOT
XCONFIG=true
X$rm -f libc.list .distlist kit*isdone 
X
X$echo "If you didn't make any mistakes, then just type a carriage return here."
X$echo $n "If you need to edit config.sh, do it as a shell escape here: $c"
X. myread
Xcase "$ans" in
X'') ;;
X*) : in case they cannot read
X    eval $ans;;
Xesac
X. ./config.sh
X
X$echo " "
X$echo "Doing variable substitutions on various files..."
X$echo " "
Xset `$grep <MANIFEST '\.SH' | awk '{print $1}'`
Xfor file in $*; do
X    . $file
Xdone
X
X$echo " "
X$echo 'Now you need to generate make dependencies by running "makedepend".'
X$echo 'You might prefer to run it in background: "makedepend > makedepend.out &"'
X$echo $n "Would you like me to run it for you (it takes quite a while)? [n] $c" 
X. myread
Xcase "$ans" in
Xy*) makedepend;;
Xesac
X$rm -f myread
X: end of Configure
!STUFFY!FUNK!
echo Extracting mbox.saver.SH
cat >mbox.saver.SH <<'!STUFFY!FUNK!'
case $CONFIG in
    '') . ./config.sh ;;
esac
echo "Extracting mbox.saver (with variable substitutions)"
$spitshell >mbox.saver <<!GROK!THIS!
$startsh
# $Id: mbox.saver.SH,v 4.4 1991/09/09 20:23:31 sob Exp sob $
# 
# $Log: mbox.saver.SH,v $
# Revision 4.4  1991/09/09  20:23:31  sob
# release 4.4
#
# 
# This software is Copyright 1991 by Stan Barber. 
#
# Permission is hereby granted to copy, reproduce, redistribute or otherwise
# use this software as long as: there is no monetary profit gained
# specifically from the use or reproduction of this software, it is not
# sold, rented, traded or otherwise marketed, and this copyright notice is
# included prominently in any copy made. 
#
# The author make no claims as to the fitness or correctness of this software
# for any use whatsoever, and it is provided as is. Any use of this software
# is at the user's own risk. 
# 
#	Arguments:
#	1 Full name of article (%A)
#	2 Public news spool directory (%P)
#	3 Directory of current newsgroup (%c)
#	4 Article number (%a)
#	5 Where in article to start (%B)
#	6 Newsgroup name (%C)
#	7 Save destination (%b)
#	8 First line of message, normally From...
#
export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)

!GROK!THIS!
case $mboxchar in
"$CTRLA")
    $spitshell >>mbox.saver <<!GROK!THIS!
( $echo "$CTRLA$CTRLA$CTRLA$CTRLA"
  if $test "\$5" = 0 -a ! "\$4" = 0 ; then
    $echo "Article: \$4 of \$6"
  fi
  $tail +\$5c \$1
  $echo ""
  $echo ""
  $echo "$CTRLA$CTRLA$CTRLA$CTRLA" ) >> \$7
!GROK!THIS!
    ;;
*)
    $spitshell >>mbox.saver <<!GROK!THIS!
 ( $echo "\$8"
  if $test "\$5" = 0 -a ! "\$4" = 0 ; then
    $echo "Article: \$4 of \$6"
  fi
  $tail +\$5c \$1 | $sed "s/^From />From /"
  $echo ""
  $echo "" ) >> \$7
!GROK!THIS!
    ;;
esac
$eunicefix mbox.saver
chmod 755 mbox.saver
!STUFFY!FUNK!
echo Extracting INIT
cat >INIT <<'!STUFFY!FUNK!'
+Hfrom 
!STUFFY!FUNK!
echo ""
echo "End of kit 2 (of 11)"
cat /dev/null >kit2isdone
config=true
for iskit in 1 2 3 4 5 6 7 8 9 10 11 ; 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
: I do not append .signature, but someone might mail this.
exit
