[comp.sources.unix] v18i081: Elm mail system, release 2.2, Part02/24

rsalz@uunet.uu.net (Rich Salz) (04/11/89)

Submitted-by: dsinc!syd@uunet.UU.NET (Syd Weinstein)
Posting-number: Volume 18, Issue 81
Archive-name: elm2.2/part02


#!/bin/sh
# this is part 2 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file Configure continued
#
CurArch=2
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file Configure"
sed 's/^X//' << 'SHAR_EOF' >> Configure
X	    echo "(That doesn't agree with your whoami.h file, by the way.)"
X	    ;;
X	*)
X	    echo "(That doesn't agree with your $phostname command, by the way.)"
X	    ;;
X	esac
X	phostname=''
X	;;
X    esac
X    ;;
Xesac
X
X: decide how portable to be
Xcase "$d_portable" in
X"$define") 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
Xrp="Do you expect to run these scripts and binaries on multiple machines? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
X    y*) d_portable="$define"
X	for file in $loclist; do
X	    eval $file=$file
X	done
X	;;
X    *)  d_portable="$undef" ;;
Xesac
X
X: see if there is a whoami file
Xecho " "
Xif $test -r /usr/include/whoami.h ; then
X    d_whoami="$define"
X    echo "whoami.h found."
Xelse
X    d_whoami="$undef"
Xfi
X
X: see how we will look up host name
Xecho " "
Xd_douname="$undef"
Xd_gethname="$undef"
Xif $test -z "$d_phostname"; then
X    d_phostname="$undef"
Xfi
X
Xif xenix; then
X    if $test -n "$uname"; then
X	u_name=`$uname -n`
X    else
X	u_name=
X    fi
X    if $test -n "$line"; then
X	if $test -r /etc/systemid; then
X	    s_name=`$line < /etc/systemid`
X	else
X	    s_name=
X	fi
X    else
X	s_name=
X    fi
X    if $test -n "$u_name"; then
X	if $test "$u_name" = "$s_name"; then
X	    cat <<EOM
XOn Xenix, UUCP uses the name found in /etc/systemid, while uname()
Xreturns the name compiled into the operating system via configure.
XElm needs the UUCP name, and currently these two match.  However, they
Xneed not match.  Be sure to always keep these two names in sync.
XSince they match, Elm will not consider that the Xenix uname function
Xis broken.  However, if you are not always able to make them
Xmatch, answer the compile in hostname question Yes.
XEOM
X	    if $contains '^uname$' libc.list >/dev/null 2>&1 ; then
X		echo "uname() found."
X		d_douname="$define"
X		ans=uname
X	    fi
X	else
X	    cat <<EOM
XOn Xenix, UUCP uses the name found in /etc/systemid, while uname()
Xreturns the name compiled into the operating system via configure.
XYour /etc/systemid file contains $s_name.
XBut uname returns $u_name.
XSince Elm needs the UUCP name, and currently these two do not match,
XElm will assume Xenix uname() is broken.
XEOM
X	fi
X    else
X	cat <<EOM
XOn Xenix, UUCP uses the name found in /etc/systemid, while uname()
Xreturns the name compiled into the operating system via configure.
XElm needs the UUCP name, and currently the compiled in name is undefined.
XSince mail needs the UUCP name, and these two need not match, Elm will
Xassume Xenix uname() is broken.
XEOM
X    fi
Xelif $contains '^gethostname$' libc.list >/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    case "$d_host_comp" in
X    "$define") dflt=y;;
X    *)  dflt=n;;
X    esac
X    cat <<EOM
X 
XEvery now and then someone has a $ans() that lies about the hostname
Xbut can't be fixed for political or economic reasons.  Would you like to
XEOM
X    rp="pretend $ans() isn't there and maybe compile in the hostname? [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    case "$ans" in
X    y*) d_douname="$undef" d_gethname="$undef"
X	d_host_comp="$define"
X	$echo $n "Okay... $c"
X	;;
X    *)
X	d_host_comp="$undef"
X	;;
X    esac
X    ;;
Xesac
X
Xcase "$d_douname$d_gethname" in
X*define*) ;;
X*)
X    case "$phostname" in
X      '') ;;
X      *)
X	$cat <<EOT
X 
XThere is no gethostname() or uname() on this system.  You have two
Xpossibilities at this point:
X
X1)  You can have your host name ($hostname) compiled into $package, which
X    lets $package start up faster, but makes your binaries non-portable, or
X2)  you can have $package use a
X	
X	popen("$phostname","r")
X
X    which will start slower but be more portable.
X
XOption 1 will give you the option of using whoami.h if you have one.  If you
Xwant option 2 but with a different command, you can edit config.sh at the
Xend of this shell script.
X
XEOT
X	case "$d_phostname" in
X	"$define") dflt=n;;
X	"$undef")  dflt=y;;
X	'')
X	    case "$d_portable" in
X	    "$define") dflt=n ;;
X	    *)      dflt=y ;;
X	    esac
X	    ;;
X	esac
X	rp="Do you want your host name compiled in? [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	case "$ans" in
X	  n*) d_phostname="$define"
X	      d_host_comp="$undef"
X	      ;;
X	  *)  phostname=''
X	      d_host_comp="$define"
X	      d_phostname="$undef"
X	      ;;
X	esac
X	;;
X    esac
X    case "$phostname" in
X      '')
X	case "$d_whoami" in
X	  "$define")
X	    dflt=y
X	    $cat <<EOM
X 
XNo hostname function--you can either use the whoami.h file, which has this line:
X
X	`grep sysname /usr/include/whoami.h`
X
Xor you can have the name we came up with earlier ($hostname) hardwired in.
XEOM
X	    rp="Use whoami.h to get hostname? [$dflt]"
X	    $echo $n "$rp $c"
X	    . myread
X	    case "$ans" in
X	    n*) d_whoami="$undef";;
X	    esac
X	    ;;
X	  "$undef")
X	    echo 'No hostname function and no whoami.h--hardwiring "'$hostname'".'
X	    ;;
X	esac
X	;;
X    esac
X    ;;
Xesac
X
X: see if flock exists
Xecho " "
Xif $contains flock libc.list >/dev/null 2>&1; then
X    echo 'flock() found.'
X    if $contains EWOULDBLOCK /usr/include/errno.h > /dev/null 2>&1; then
X	echo 'EWOULDBLOCK found, will use .lock and flock type mailbox locking'
X        d_flock="$define"
X    elif $contains EWOULDBLOCK /usr/include/sys/errno.h > /dev/null 2>&1; then
X	echo 'EWOULDBLOCK found, will use .lock and flock type mailbox locking'
X        d_flock="$define"
X    else
X	echo 'flock() not found--will use .lock type mailbox locking'
X	d_flock="$undef"
X    fi
Xelse
X    echo 'flock() not found--will use .lock type mailbox locking'
X    d_flock="$undef"
Xfi
X
X: see if getopt exists
Xecho " "
Xif $contains getopt libc.list >/dev/null 2>&1; then
X    echo 'getopt() found.'
X    d_getopt="$define"
Xelse
X    echo 'getopt() not found--will use our getopt instead.'
X    d_getopt="$undef"
Xfi
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	dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
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: determine pathnames of the domains, pathalias, L.sys or Systems
Xcase "$pathalias" in
X'') dflt=`loc paths blurfl/dyick $pth /usr/lib/uucp`
X    if $test "$dflt" = blurfl/dyick; then
X	dflt=`loc nmail.paths /usr/lib/nmail.paths $pth /usr/lib/uucp`
X    fi
X    ;;
X*)  dflt="$pathalias";;
Xesac
Xcont=true
Xwhile $test "$cont" ; do
X    echo " "
X    echo "Give the full path name of the pathalias"
X    rp="data file? [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    pathalias="$ans"
X    if $test -f "$ans"; then
X	cont=''
X    else
X	if $test "$fastread" = yes; then
X	    dflt=y
X	else
X	    dflt=n
X	fi
X	echo "Pathalias data file $ans doesn't exist."
X	rp="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
Xcase "$domains" in
X'') dflt=`loc domains /usr/lib/domains $pth /usr/lib/uucp`;;
X*)  dflt="$domains";;
Xesac
Xcont=true
Xwhile $test "$cont" ; do
X    echo " "
X    echo "Where does the uumail-style 'domains'"
X    rp="file live? [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    domains="$ans"
X    if $test -f "$ans"; then
X	cont=''
X    else
X	if $test "$fastread" = yes; then
X	    dflt=y
X	else
X	    dflt=n
X	fi
X	echo "Domains data file $ans doesn't exist."
X	rp="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
Xcase "$lsysfile" in
X'') dflt=`loc Systems blurfl/dyick /usr/lib/uucp`
X    lsysvssys="Systems"
X    if $test "$dflt" = blurfl/dyick; then
X	dflt="/usr/lib/uucp/L.sys"
X	lsysvssys="L.sys"
X    fi
X    ;;
X*)  dflt="$lsysfile";;
Xesac
X
X: is pathalias available as a dbm file
Xd_havedbm="$undef"
Xdbm=''
X
Xif $test -f "$pathalias.pag" -a -f "$pathalias.dir"; then
X    ans=`loc libdbm.a x $libpth`
X    if $test "$ans" = x; then
X	dflt=y
X	echo " "
X	rp="You have pathalias as a DBM file, but I cannot find the
XDBM library.  Do you have dbm? [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	case "$ans" in
X	    y*|t*) d_havedbm="$define"
X		echo " "
X		echo "Then where are the dbm routines kept (specify either -llibname"
X		$echo $n " or full pathname (~name ok))? $c"
X		rp='Specify dbm library:'
X		. myread
X		dbm=`filexp $ans`
X		;;
X	    *)	d_havedbm="$undef"
X		dbm=''
X		echo "I will use the non dbm access methods then."
X		;;
X	esac
X    else
X	echo " "
X	echo "You have pathalias as a DBM file...I'll use that instead."
X	dbm=$ans
X	d_havedbm="$define"
X    fi
Xfi
X
X: index or strcpy
Xecho " "
Xcase "$d_index" in
Xn) dflt=n;;
X*) dflt=y;;
Xesac
Xif $contains '^index$' libc.list >/dev/null 2>&1 ; then
X    if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
X	echo "Your system has both index() and strchr().  Shall I use"
X	rp="index() rather than strchr()? [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	case "$ans" in
X	    n*) d_index="$define" ;;
X	    *)  d_index="$undef" ;;
X	esac
X    else
X	d_index="$undef"
X	echo "index() found."
X    fi
Xelse
X    if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
X	d_index="$define"
X	echo "strchr() found."
X    else
X	echo "No index() or strchr() found!"
X	d_index="$undef"
X    fi
Xfi
X
X: check for internet mailer
Xcase "$d_internet" in
X"$define")	dflt=y;;
X"$undef")	dflt=n;;
X*)	if $test -f "$sendmail"; then
X	    dflt=y
X	elif $test -f "$smail"; then
X	    dflt=y
X	else
X	    dflt=n
X	fi
X	;;
Xesac
X$cat <<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"
Xrp="Does your mailer understand INTERNET addresses? [$dflt]"
X. myread
Xcase "$ans" in
Xy*) d_internet="$define";;
X*)  d_internet="$undef";;
Xesac
X
Xcase "$d_mboxedit" in
X"$define") dflt=y;;
X"$undef")  dflt=n;;
X*)	dflt=n;;
Xesac
X$cat <<EOM
X 
XA lot of sites that install the Elm Mail System find that the function
XE)dit mailbox from within Elm is dangerous and confusing.  If you choose,
Xyou can instead disable that function, with the program being slightly
Xsmaller and presenting an appropriate error message to the user if they
Xtry to E)dit their mailbox.
X
XEOM
Xrp="Would you like to enable the E)dit Mailbox function? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
Xy*) d_mboxedit="$define";;
X*)  d_mboxedit="$undef";;
Xesac
X
X: see if mkdir exists
Xecho " "
Xif $contains '^mkdir$' libc.list >/dev/null 2>&1; then
X    echo 'mkdir() found.'
X    d_mkdir="$define"
Xelse
X    echo 'mkdir() not found.'
X    d_mkdir="$undef"
Xfi
X
X: ask about newmail running in the background automatically
Xcase "$d_newauto" in
X"$define")	dflt=y;;
X"$undef")	dflt=n;;
X*)		dflt=y;;
Xesac
Xecho " "
Xrp="Should newmail automatically run in the background? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
Xy*) d_newauto="$define";;
X*)  d_newauto="$undef";;
Xesac
X
X: define d_useuuname, 
Xif $test -f "$uuname"; then
X	case "$d_useuuname" in
X	"$define") dflt=y;;
X	"$undef")  dflt=n;;
X	*)	   dflt=y;;
X	esac
X	$cat <<EOM
X
XShould the program use "uuname" rather than trying to read the
X$lsysvssys file?
XEOM
X	echo " "
X	rp="Should 'uuname' be used first? [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	case "$ans" in
X	y*) d_useuuname="$define";;
X	*)  d_useuuname="$undef";;
X	esac
Xelse
X	d_useuuname="$undef"
Xfi
X
Xcase "$d_notouchadd" in
X"$define") dflt=n;;
X"$undef")  dflt=y;;
X*)	   dflt=y;;
Xesac
X$cat <<EOM
X
XSome sites are configured so that the low level transport mechanism
Xis supposed to resolve and rewrite uucp paths, unreachable
Xdomains/networks, and so on.  If your site running either "smail",
Xa "gateway" configuration of sendmail, or some similar software
Xthen the low level transport mechanism will resolve the uucp
Xpaths.  In this case it is not necessary to have Elm resolve
Xthe paths on outbound mail addresses.
X
XEOM
Xecho " "
Xrp="Should Elm resolve outbound addresses? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
Xy*) d_notouchadd="$undef";;
X*)  d_notouchadd="$define";;
Xesac
X
Xcase "$d_pafirst" in
X"$define") dflt=y;;
X"$undef")  dflt=n;;
X*)	   dflt=n;;
Xesac
Xif $test "$d_notouchadd" = "$undef"; then
X	$cat <<EOM
X
XWhen given a machine that you talk to directly, should the 'pathalias'
Xroute to the machine be used instead?"
XEOM
X	echo " "
X	rp="Would you like to use pathalias route instead? [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	case "$ans" in
X	y*) d_pafirst="$define";;
X	*)  d_pafirst="$undef";;
X	esac
Xelse
X	d_pafirst="$undef"
Xfi
X
Xif $test -f "$sendmail"; then
X	echo "You're running sendmail.  Setting noaddfrom, nocheckvalid, usedomain"
X	d_noaddfrom="$define"
X	d_nocheckvalid="$define"
X	d_usedomain="$undef"
Xelse
X	case "$d_nocheckvalid" in
X	"$define") dflt=n;;
X	"$undef")  dflt=y;;
X	*)	   dflt=y;;
X	esac
X
X	$cat << EOM
X
XSince you're not running sendmail, should I check local user entered
Xaddresses against the valid mailboxes on this system?
XEOM
X
X	echo " "
X	rp="Would you like to check local addresses? [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	case "$ans" in
X	y*) d_nocheckvalid="$undef";;
X	*)  d_nocheckvalid="$define";;
X	esac
X
X	case "$d_usedomain" in
X	"$define") dflt=y;;
X	"$undef")  dflt=n;;
X	*)	   dflt=y;;
X	esac
X
X	$cat <<EOM
X
XAre you running a machine where you want to have a domain name appended
Xto the hostname on outbound mail?
XEOM
X	echo " "
X	rp="Would you like the domain name appended? [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	case "$ans" in
X	y*) d_usedomain="$define";;
X	*)  d_usedomain="$undef";;
X	esac
X
X	case "$d_noaddfrom" in
X	"$define") dflt=y;;
X	"$undef")  dflt=n;;
X	*)	   dflt=n;;
X	esac
X	echo " "
X	rp="Does your mailer add the From: header for you? [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	case "$ans" in
X	y*) d_noaddfrom="$define";;
X	*)  d_noaddfrom="$undef";;
X	esac
Xfi
X
X: ask about optimizing return addresses
Xcase "$d_optreturn" in
X"$define")	dflt=y;;
X"$undef")	dflt=n;;
X*)		dflt=n;;
Xesac
Xecho " "
Xecho "Should I optimize the return address when you"
Xrp="'alias current message'? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
Xy*) d_optreturn="$define";;
X*)  d_optreturn="$undef";;
Xesac
X
X: see if strings.h is in /usr/include or /usr/include/sys
Xecho " "
Xstrings=`loc strings.h "" /usr/include $includepath`
Xif $test -z "$strings"; then
X	strings=`loc string.h "" /usr/include $includepath`
Xfi
Xwhile $test -z "$strings"; do
X	echo " "
X	dflt=''
X	rp="What is the full path name of the include file directory? []"
X	$echo $n "$rp $c"
X	. myread
X	includepath=`filexp $ans`
X	if $test -d "$includepath"; then
X		strings=`loc strings.h "" /usr/include $includepath`
X		if $test -z "$strings"; then
X			strings=`loc string.h "" /usr/include $includepath`
X		fi
X		if $test -z "$strings"; then
X			$cat <<EOM
X
XInclude file string.h or strings.h not found in $includepath.
XElm requires string.h on USG type systems or strings.h on BSD type
Xsystems.  Please specify the directory where one of these files can
Xbe found.
XEOM
X		fi
X	else
X		echo "Directory $includepath not found"
X	fi
Xdone
X
Xstrings=`$expr "$strings" : ".*/\(.*\)"`
Xif $test "$strings" = "string.h"; then
X	d_strings="$undef"
Xelse
X	d_strings="$define"
Xfi
Xpwdinsys=`loc pwd.h "" /usr/include $includepath`
Xif $test -z "$pwdinsys"; then
X	d_pwdinsys="$define"
Xelse
X	d_pwdinsys="$undef"
Xfi
X
X: get remove at last flag and number of lock attempts
X$cat <<EOM
X
XThe next pair of questions have to do with what to do when another
Xprogram has locked a mailbox...
X
XFirst, how many times should the Elm check for the removal of the lock
Xfile before giving up?
XEOM
X
Xcase "$maxattempts" in
X    '') dflt=6;;
X    *)  dflt=$maxattempts;;
Xesac
Xcont=true
Xwhile $test "$cont" ; do
X    echo " "
X    rp="Number of lock attempts: [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    maxattempts="$ans"
X    if $test "$maxattempts" -lt 3 -o "$maxattempts" -gt 10 ; then
X	echo "The recommended range is 3-10"
X	odflt=$dflt
X	dflt=n
X	rp="Should I use your answer of $maxattempts lock attempts anyway? [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	dflt=$odflt
X	case "$ans" in
X	y*) cont='';;
X	esac
X    else
X	cont=''
X    fi
Xdone
X
Xcase "$d_remlock" in
X"$define") dflt=y;;
X"$undef")  dflt=n;;
X*)	   dflt=n;;
Xesac
Xecho " "
Xrp="Should it REMOVE the lockfile after $maxattempts checks? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
Xy*) d_remlock="$define";;
X*)  d_remlock="$undef";;
Xesac
X
X: see if rename exists
Xecho " "
Xif $contains rename libc.list >/dev/null 2>&1; then
X    echo 'rename() found.'
X    d_rename="$define"
Xelse
X    echo 'rename() not found--will use our rename instead.'
X    d_rename="$undef"
Xfi
X
X: see if tempnam exists
Xecho " "
Xif $contains tempnam libc.list >/dev/null 2>&1; then
X    echo 'tempnam() found.'
X    d_tempnam="$define"
Xelse
X    echo 'tempnam() not found--will use our tempnam instead.'
X    d_tempnam="$undef"
Xfi
X
X: determine where manual pages go
X$cat <<EOM
X 
XElm has manual pages that need to be installed in source form.
X
XEOM
Xcase "$mansrc" in
X'')
X    dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1 /usr/man/man.L`
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	if $test "$fastread" = yes; then
X	    dflt=y
X	else
X	    dflt=n
X	fi
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*C)
X    manext=C
X    ;;
X*L)
X    manext=L
X    ;;
X*)
X    manext=1
X    ;;
Xesac
X
X: see what memory models we can support
Xcase "$models" in
X'')
X    : We may not use Cppsym or we get a circular dependency through cc.
X    : But this should work regardless of which cc we eventually use.
X    cat >pdp11.c <<'EOP'
Xmain() {
X#ifdef pdp11
X    exit(0);
X#else
X    exit(1);
X#endif
X}
XEOP
X    cc -o pdp11 pdp11.c >/dev/null 2>&1
X    if pdp11 2>/dev/null; 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 <<EOM
X 
XSome systems have different model sizes.  On most systems they are called
Xsmall, medium, large, and huge.  On the PDP11 they are called unsplit and
Xsplit.  If your system doesn't support different memory models, say "none".
XIf you wish to force everything to one memory model, say "none" here and
Xput the appropriate flags later when it asks you for other cc and ld flags.
XVenix systems may wish to put "none" and let the compiler figure things out.
X(In the following question multiple model names should be space separated.)
X
XEOM
Xrp="Which models are supported? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xmodels="$ans"
X
Xcase "$models" in
Xnone)
X    small=''
X    medium=''
X    large=''
X    huge=''
X    unsplit=''
X    split=''
X    ;;
X*split)
X    case "$split" in
X    '') 
X	if $contains '\-i' $mansrc/ld.1 >/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 "$models" 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 "$models" 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 "$models" 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 "$models" 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
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!)  If you have the Gnu C compiler, you
Xmight wish to use that instead.  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    case "$cc" in
X    '') dflt=cc;;
X    *) dflt="$cc";;
X    esac
X    rp="Use which C compiler? [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    cc="$ans"
Xfi
Xcase "$cc" in
Xgcc*) cpp=`loc gcc-cpp $cpp $pth`;;
Xesac
X
X: determine optimize, if desired, or use for debug flag also
Xcase "$optimize" in
X' ') dflt="none"
X     ;;
X'') dflt="-O";
X    ;;
X*)  dflt="$optimize"
X    ;;
Xesac
Xcat <<EOH
XSome C compilers have problems with their optimizers, by default, Elm compiles
Xwith the -O flag to use the optimizer.  Alternately, you might want to use the
Xsymbolic debugger, which uses the -g flag.  Either flag can be specified here.
XTo use neither flag, specify the word "none".
X
XEOH
Xrp="What optimizer/debugger flag should be used? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xoptimize="$ans"
Xcase "$optimize" in
X'none') optimize=" "
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"
Xrmlist="$rmlist pdp11"
X
Xcase "$libs" in
X'') dflt='none';;
X*) dflt="$libs";;
Xesac
X
X$cat <<'EOM'
X 
XSome versions of Unix support shared libraries, which make
Xexecutables smaller but make load time slightly longer.
X
XOn some systems, mostly newer Unix System V's, the shared library
Xis included by putting the option "-lc_s" as the last thing on the
Xcc command line when linking.  Other systems use shared libraries
Xby default.  There may be other libraries needed to compile Elm
Xon your machine as well.  If your system needs the "-lc_s" option,
Xinclude it here.  Include any other special libraries here as also.
XEOM
X
Xecho " "
Xrp="Any additional libraries? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
Xnone) ans='';
Xesac
Xlibs="$ans"
X
X: see how we invoke the C preprocessor
Xecho " "
Xecho "Now, how can we feed standard input to your C preprocessor..."
Xcat <<'EOT' >testcpp.c
X#define ABC abc
X#define XYZ xyz
XABC.XYZ
XEOT
Xecho 'Maybe "'"$cc"' -E" will work...'
X$cc -E <testcpp.c >testcpp.out 2>&1
Xif $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X    echo "Yup, it does."
X    cppstdin="$cc -E"
X    cppminus='';
Xelse
X    echo 'Nope, maybe "'$cpp'" will work...'
X    $cpp <testcpp.c >testcpp.out 2>&1
X    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X	echo "Yup, it does."
X	cppstdin="$cpp"
X	cppminus='';
X    else
X	echo 'No such luck...maybe "'$cpp' -" will work...'
X	$cpp - <testcpp.c >testcpp.out 2>&1
X	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X	    echo "It works!"
X	    cppstdin="$cpp"
X	    cppminus='-';
X	else
X	    echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
X	    $cc -E - <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		cppstdin="$cc -E"
X		cppminus='-';
X	    else
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		    cppstdin="$cc -P"
X		    cppminus='';
X		else
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			cppstdin="$cc -P"
X			cppminus='-';
X		    else
X			echo 'Hmm...perhaps you already told me...'
X			case "$cppstdin" in
X			'') ;;
X			*) $cppstdin $cppminus <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 'Uh-uh.  Time to get fancy...'
X			    cd ..
X			    echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
X			    echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
X			    chmod 755 cppstdin
X			    cppstdin=`pwd`/cppstdin
X			    cppminus='';
X			    cd UU
X			    $cppstdin <testcpp.c >testcpp.out 2>&1
X			    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X				echo "Eureka!."
X			    else
X				dflt=blurfl
X				$echo $n "No dice.  I can't find a C preprocessor.  Name one: $c"
X				rp='Name a C preprocessor:'
X				. myread
X				cppstdin="$ans"
X				$cppstdin <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
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-\012]' >Cppsym.know
X$cat <<EOSS >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-\012]' | $sed -e 's/\(.*\)/\\
X#ifdef \1\\
Xexit 0; _ _ _ _\1\\	 \1\\
X#endif\\
X/' >/tmp/Cppsym\$\$
Xecho exit 1 >>/tmp/Cppsym\$\$
X$cppstdin $cppminus </tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$
Xcase "\$list" in
Xtrue) awk 'NF > 5 {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;
X*)
X    sh /tmp/Cppsym2\$\$
X    status=\$?
X    ;;
Xesac
X$rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
Xexit \$status
XEOSS
Xchmod +x Cppsym
X$eunicefix Cppsym
Xecho "Your C preprocessor defines the following symbols:"
XCppsym -l $attrlist >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 ; then
X    if $test "`/bin/universe`" = "ucb" ; then
X	if $test -r /usr/include/sgtty.h ; then
X	    d_termio="$undef"
X	    echo "sgtty.h found."
X	else
X	    echo "System is a pyramid, and universe is bsd,"
X	    echo "sgtty.h not found--you could have problems."
X	fi
X    else
X	if $test -r /usr/include/termio.h ; then
X	    d_termio="$define"
X	    echo "termio.h found."
X	else
X	    echo "System is a pyramid, and universe is att,"
X	    echo "termio.h not found--you could have problems."
X	fi
X    fi
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: see if struct tm is defined in sys/time.h
Xecho " "
Xif $contains 'struct tm' /usr/include/time.h >/dev/null 2>&1 ; then
X    if $contains 'struct tm' /usr/include/sys/time.h >/dev/null 2>&1 ; then
X	echo "You have struct tm defined in both <time.h> and <sys/time.h>."
X        d_tminsys="$define"
X        timeincl=/usr/include/sys/time.h
X    else
X	echo "You have struct tm defined in <time.h> rather than <sys/time.h>."
X	if $contains 'include <time.h>' /usr/include/sys/time.h >/dev/null 2>&1; then
X	    echo "but <sys/time.h> includes <time.h> so I'll include <sys/time.h>"
X	    d_tminsys="$define"
X	    timeincl='/usr/include/sys/time.h /usr/include/time.h'
X	else
X	    d_tminsys="$undef"
X	    timeincl=/usr/include/time.h
X	fi
X    fi
Xelse
X    echo "You have struct tm defined in <sys/time.h> rather than <time.h>."
X    d_tminsys="$define"
X    timeincl=/usr/include/sys/time.h
Xfi
X$cat $timeincl | $cppstdin $cppminus > try.c 2>&1
Xif $contains 'tz_minuteswest' try.c > /dev/null 2>&1 ; then
X    echo "You have tz_minuteswest defined in $timeincl rather than timezone."
X    d_tz_min="$define"
Xelse
X    echo "You have timezone defined in $timeincl rather than tz_minuteswest."
X    d_tz_min="$undef"
Xfi
X$rm -f try.c
X: check for valid reply/to fields
Xcase "$d_useembed" in
X"$define")	dflt=y;;
X"$undef")	dflt=n;;
X*)		dflt=n;;
Xesac
X$cat <<EOM
X 
XOne of the more annoying quirks of the UUCP network and various other
Xsystems that interact with it are that everyone seems to have different
Xideas about how to do routing, etc.  Therefore, a lot of times email
Xwill arrive from offsite with corrupt, unreply-able "Reply-To:" and
X"From:" fields.  This next question relates to whether your site is
Xliable to get mangled fields or not...
X
XDoes your site receive email with valid "Reply-To:" and "From:" fields?
X
XEOM
X$echo $n "Use Reply-To: and From: addresses? [$dflt] $c"
Xrp="Are Reply-to: and From: addresses reliable? [$dflt]"
X. myread
Xcase "$ans" in
Xy*) d_useembed="$define";;
X*)  d_useembed="$undef";;
Xesac
X
X: check for utimbuf structure
Xecho " "
Xcase "$d_utimbuf" in
X"$define")	;;
X"$undef")	;;
X*)
X: Pyramid passes the att compile test but still needs the definition
X	if Cppsym pyr ; then
X	    if $test "`/bin/universe`" = "att" ; then
X		d_utimbuf="$define"
X		echo "I will use my 'utimbuf' structure..."
X            fi
X        fi
X	if $test "$d_utimbuf" != "$define"; then
X	    echo "Checking to see if struct utimbuf exists."
X	    $cat >try.c <<'EOCP'
X#include <stdio.h>
X#include <fcntl.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X#define far /* to keep XENIX from complaining */
X#include <sys/file.h>
X#include <time.h>
Xmain()
X{
Xstruct utimbuf test;
Xexit(1);
X}
XEOCP
X	    if $cc try.c -o try >/dev/null 2>&1 ; then
X		d_utimbuf="$undef"
X		echo "You have the 'utimbuf' structure..."
X	    else
X		echo "I will use my 'utimbuf' structure..."
X		d_utimbuf="$define"
X	    fi
X	    $rm -f try.c try.o try
X	fi
X	;;
Xesac
X
X: see if there is a vfork
Xecho " "
Xif $contains '^vfork$' libc.list >/dev/null 2>&1 ; then
X    echo "vfork() found."
X    d_vfork="$undef"
Xelse
X    echo "No vfork() found--will use fork() instead."
X    d_vfork="$define"
Xfi
X
X: see if signal is declared as pointer to function returning int or void
Xecho " "
Xif $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 ; then
X    echo "You have void (*signal())() instead of int."
X    d_voidsig="$define"
Xelse
X    echo "You have int (*signal())() instead of void."
X    d_voidsig="$undef"
Xfi
X
X: get user and system aliases sizes
X$cat <<EOM
X 
XThe number of aliases allowed for users of the Elm system can vary
Xbased on system speed and memory available.  If you have a fast system
Xand/or a lot of memory you can enter a fairly large number of aliases
Xfor the next two questions...if not, you'll probably want to enter the
Xsuggested small-system values.  (This applies to the speed of the
Xswapping on your system too - if you're on a FAST system, use the big
Xvalues!)
X
XFirst, how many aliases should be allowed for an individual user?
XThe suggested values are 503 for blindly fast systems,
X251 for average systems and 127 for slow systems.
XEOM
X
Xcase "$maxuseralias" in
X    '') dflt=251;;
X    *)  dflt=$maxuseralias;;
Xesac
Xcont=true
Xwhile $test "$cont" ; do
X    echo " "
X    rp="Number of user aliases: [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    maxuseralias="$ans"
X    if $test "$maxuseralias" -lt 50 -o "$maxuseralias" -gt 1000 ; then
X	$cat <<EOM
XPretty strange answer!  I think you should reconsider and try a number
Xfrom the range 50-1000.
XEOM
X	odflt=$dflt
X	dflt=n
X	rp="Should I use your answer of $maxuseralias user aliases anyway? [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	dflt=$odflt
X	case "$ans" in
X	y*) cont='';;
X	esac
X    else
X	cont=''
X    fi
Xdone
X
Xcase "$maxsysalias" in
X    '') case "$maxuseralias" in
X	127) dflt=223;;
X	503) dflt=739;;
X	*  ) dflt=503;;
X	esac
X	;;
X    *)  dflt=$maxsysalias;;
Xesac
Xcont=true
Xwhile $test "$cont" ; do
X    echo " "
X    rp="Maximum number of system aliases: [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    maxsysalias="$ans"
X    if $test "$maxsysalias" -lt 50 -o "$maxsysalias" -gt 1000 ; then
X	$cat <<EOM
XPretty strange answer!  I think you should reconsider and try a number
Xfrom the range 50-1000.
XEOM
X	odflt=$dflt
X	dflt=n
X	rp="Should I use your answer of $maxsysalias system aliases anyway? [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	dflt=$odflt
X	case "$ans" in
X	y*) cont='';;
X	esac
X    else
X	cont=''
X    fi
Xdone
Xelmalias="$maxsysalias"
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/local/bin /usr/lbin /usr/local /usr/bin`
X    ;;
X*)  dflt="$bin"
X    ;;
Xesac
Xcont=true
Xwhile $test "$cont" ; do
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    if test -d $bin; then
X	cont=''
X    else
X	if $test "$fastread" = yes; then
X	    dflt=y
X	else
X	    dflt=n
X	fi
X	rp="Directory $bin 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: see if symlink exists
Xecho " "
Xif $contains '^symlink$' libc.list >/dev/null 2>&1; then
X    echo 'symlink() found.'
X    d_symlink="$define"
Xelse
X    echo 'symlink() not found.'
X    d_symlink="$undef"
Xfi
X
X: get default batch subject
X$cat <<EOM
X 
XElm will provide a default subject for mail messages that are sent
Xin batch mode (redirected from a file.)
XEOM
X
Xcase "$defbatsub" in
X    '') dflt='no subject (file transmission)';;
X    *)  dflt=$defbatsub;;
Xesac
Xecho " "
Xrp="Default batch subject: [$dflt]"
X$echo $n "$rp $c"
X. myread
Xdefbatsub="$ans"
X
X: determine default editor
Xcase "$defeditor" in
X'')
X    case "$_vi" in
X    */*) dflt="$_vi";;
X    *) dflt=/usr/ucb/vi;;
X    esac
X    ;;
X*)  dflt="$defeditor"
X    ;;
Xesac
Xcont=true
Xwhile $test "$cont" ; do
X    echo " "
X    rp="What is the default editor on your system? [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    defeditor="$ans"
X    if $test -f $ans; then
X	cont=''
X    else
X	if $test "$fastread" = yes; then
X	    dflt=y
X	else
X	    dflt=n
X	fi
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 public libraries go
Xcase "$lib" in
X'')
X    dflt=`loc . "." /usr/local/lib /usr/lib /lib`
X    ;;
X*)  dflt="$lib"
X    ;;
Xesac
Xcont=true
Xwhile $test "$cont" ; do
X    echo " "
X    rp="Where do you want to put the public libraries? [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    lib="$ans"
X    lib=`filexp $lib`
X    if $test -d "$lib"; then
X	cont=''
X    else
X	dflt=n
X	rp="Directory $lib 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: ask the preferred line printer and options for this system.
Xcase "$linepr" in
X'')
X    if $test -f "$lp"; then
X	dflt="$lp"
X    elif $test -f "$lpr"; then
X	dflt="$lpr"
X    else
X	dflt=
X    fi
X    ;;
X*)  dflt="$linepr";;
Xesac
X
Xlinepr='blurfl/dyick'
X$cat <<EOM
X
XElm has an option to send messages to the printer.  This question
Xasks for the default spooler name.  You can also specify options
Xto the command by separating them from the command by at least one space. 
X
XEOM
Xcont=true
Xwhile $test "$cont" ; do
X    rp="What print spooler do you prefer to use with Elm? [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    linepr="$ans"
X    ans=`$expr "$linepr" : "\([^ ]*\).*"`
X    case "$ans" in
X    /*)
X	if $test -f "$ans"; then
X	    cont=''
X	else
X	    if $test "$fastread" = yes; then
X		dflt=y
X	    else
X		dflt=n
X	    fi
X	    rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
X	    $echo $n "$rp $c"
X	    . myread
X	    case "$ans" in
X	    y*) cont='';;
X	    esac
X	fi
X	;;
X    *)
X	echo "Please give the full path name."
X	;;
X    esac
Xdone
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
Xcont=true
Xwhile $test "$cont" ; do
X    echo " "
X    rp="Where is yet-to-be-read mail spooled? [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    maildir=`filexp "$ans"`
X    if test -d $maildir; then
X	cont=''
X    else
X	if $test "$fastread" = yes; then
X	    dflt=y
X	else
X	    dflt=n
X	fi
X	rp="Directory $maildir 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 mail delivery agent for Elm to use
Xcase "$mailer" in
X'')
X    if $test -f "$sendmail"; then
X	dflt="$sendmail"
X    elif $test -f "$rmail"; then
X	dflt="$rmail"
X    elif $test -f /bin/mail; then
X	dflt=/bin/mail
X    else
X	dflt=$mail
X    fi
X    ;;
X*)  dflt="$mailer";;
Xesac
Xcont=true
Xwhile $test "$cont" ; do
X    echo " "
X    echo "Give the full path name of the program used to deliver mail on your"
X    $echo $n "system: [$dflt] $c"
X    rp="Preferred mail delivery agent: [$dflt]"
X    . myread
X    mailer="$ans"
X    if $test -f "$ans"; then
X	cont=''
X    else
X	if $test "$fastread" = yes; then
X	    dflt=y
X	else
X	    dflt=n
X	fi
X	echo "Mail delivery agent $ans doesn't exist."
X	rp="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: ask about setgid running of Elm
Xcase "$d_setgid" in
X"$define")	dflt=y;;
X"$undef")	dflt=n;;
X*)		dflt=y;;
Xesac
Xecho " "
Xrp="Am I going to be running as a setgid program? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
Xy*) d_setgid="$define";;
X*)  d_setgid="$undef";;
Xesac
Xcase "$d_setgid" in
X"$define")	mailermode=2755;;
X*)		mailermode=755;;
Xesac
X
X: determine the group of the mail directory- what group elm should use
Xmailgrp=`$ls -lgd $maildir`
Xmailgrp=`$expr "$mailgrp" : "d[rwxstS-]*[ 0123456789]*\(.*\)"`
X: now mailgrp is either    user group size mon day time/year name
X: or                       group size mon day time/year name
Xtry1=`$expr "$mailgrp" : "[A-z0-9]* *\([A-z0-9]*\).*"`
Xtry1a=`$expr "$try1" : "\([0-9]*\).*"`
Xif $test "$try1" = "$try1a"; then
X    mailgrp=`$expr "$mailgrp" : "\([A-z0-9]*\).*"`
Xelse
X    mailgrp="$try1"
Xfi
Xcase "$mailgrp" in
X'')
X    mailgrp=mail
X    ;;
Xesac
Xecho " "
Xecho "Mail group is $mailgrp"
X
X: ask the preferred pager for this system.
Xcase "$pager" in
X'') dflt="builtin+";;
X*)  dflt="$pager";;
Xesac
X
Xpager='blurfl/dyick'
Xecho " "
Xcont=true
Xwhile $test "$cont" ; do
X    rp="What pager do you prefer to use with Elm? [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    pager="$ans"
X    case "$ans" in
X    builtin)
X        cont=''
X	;;
X    builtin+)
X        cont=''
X	;;
X    /*)
X	if $test -f "$ans"; then
X	    cont=''
X	else
X	    if $test "$fastread" = yes; then
X		dflt=y
X	    else
X		dflt=n
X	    fi
X	    rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
X	    $echo $n "$rp $c"
X	    . myread
X	    case "$ans" in
X	    y*) cont='';;
X	    esac
X	fi
X	;;
X    *)
X	echo "Please give the full path name."
X	;;
X    esac
Xdone
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	if $test "$fastread" = yes; then
X	    dflt=y
X	else
X	    dflt=n
X	fi
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 the name of the tape device
Xrmttape=`loc libcrypt.a "unknown-remote-tape-unit" /dev/rct /dev/rmt /dev/rtp`
Xecho "remote tape drive is $rmttape"
Xecho " "
X: determine text processor to use, default to troff if found.
Xcase "$roff" in
X'')
X    if $test -n "$troff"; then
X	dflt="$troff"
X    else
X	dflt=$nroff
X    fi
X    ;;
X*)  dflt="$roff";;
Xesac
X$cat <<EOM
X
XThe Elm manuals are set up for troff.  If you only have nroff, it can
Xbe used, but the manuals will not be as readable.  If you use an alternate
Xprocessor for troff/nroff documents it can be specified here.
X
XEOM
Xcont=true
Xwhile $test "$cont" ; do
X    echo " "
X    echo "Give the name of the program used to process manual pages on your"
X    $echo $n "system: [$dflt] $c"
X    rp="Preferred troff/nroff program: [$dflt]"
X    . myread
X    if $test -f "$ans"; then
X	cont=''
X	roff=$ans;
X    else
X	roff=`loc "$ans" "" . $pth`
X	if $test -f "$roff"; then
X	    cont=''
X	else
X	    if $test "$fastread" = yes; then
X		dflt=y
X	    else
X		dflt=n
X	    fi
X	    echo "Text processor $ans doesn't exist."
X	    rp="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
X    fi
Xdone
X
X: where do we get termlib routines from
Xecho " "
Xans=`loc libcurses.a x $libpth`
Xif $test "$ans" = x; then
X	ans=`loc Slibcurses.a x $libpth`
Xfi
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    rm -f grimble
X    ;;
Xesac
Xcase "$ans" in
Xx)
X    ans=`loc libtermlib.a x $libpth`
X    if $test "$ans" = x; then
X	ans=`loc Slibtermlib.a x $libpth`
X    fi
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	if $test "$ans" = x; then
X	    ans=`loc Slibtermcap.a x $libpth`
X	fi
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: determine where temporary files should go
Xcase "$tmpdir" in
X'')
X    dflt=`loc . "." "/tmp /usr/tmp"`
X    ;;
X*)  dflt="$tmpdir"
X    ;;
Xesac
Xif $test -d "$tmpdir" -a "$tmpdir" != ""; then
X	$echo " "
X	$echo "Temporary files will be put in the $tmpdir directory"
Xelse
X	cont=true
X	while $test "$cont" ; do
X	    $echo " "
X	    rp="Where do you want to put the temporary files? [$dflt]"
X	    $echo $n "$rp $c"
X	    . myread
X	    tmpdir="$ans"
X	    tmpdir=`filexp $tmpdir`
X	    if $test -d "$tmpdir" -a "$tmpdir" != ""; then
X		cont=''
X	    else
X		if $test "$fastread" = yes; then
X		    dflt=y
X		else
X		    dflt=n
X		fi
X		rp="Directory $tmpdir 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
X	done
Xfi
X
Xecho " "
Xecho "End of configuration questions."
Xecho " "
X
X: create config.sh file
Xecho " "
Xif test -d ../UU; then
X    cd ..
Xfi
Xecho "Creating config.sh..."
X$spitshell <<EOT >config.sh
X$startsh
X# config.sh
X# This file was produced by running the Configure script.
X
Xd_eunice='$d_eunice'
Xeunicefix='$eunicefix'
XLog='$Log'
XHeader='$Header'
Xcontains='$contains'
Xcppstdin='$cppstdin'
Xcppminus='$cppminus'
Xd_index='$d_index'
SHAR_EOF
echo "End of part 2"
echo "File Configure is continued in part 3"
echo "3" > s2_seq_.tmp
exit 0

-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.