From: sources@anomaly.sbs.risc.net
Newsgroups: biz.sco.sources
Subject: v01i101 - ELM v2.3.11, Electronic Mail Reader - Part 01/20
Date: 13 Sep 92 17:36:56 GMT
Reply-To: sources@anomaly.sbs.risc.net
Followup-To: biz.sco.general
Organization: The Rhode Island Internet Systems Cooperative Network


#!/bin/sh
# This is a shell archive (shar 3.32)
#
# existing files WILL be overwritten
# This format requires very little intelligence at unshar time.
# "echo" and "sed" will be needed.
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   1491 -r--r--r-- Changes
#  90864 -r-xr-xr-x Configure
#    126 -rw-r--r-- Distfile
#   4366 -r--r--r-- Instruct
#   1863 -r--r--r-- MANIFEST
#   2133 -rw-r--r-- doit
#   3115 -r--r--r-- Makefile.SH
#   3263 -r--r--r-- NOTICE
#   4637 -r--r--r-- Overview
#   7877 -r--r--r-- README
#  13873 -r--r--r-- config.h.SH
#  15988 -r--r--r-- doc/Alias.guide
#  11332 -r--r--r-- doc/Config.guid
#   1145 -r--r--r-- doc/Elm.cover
#  16868 -r--r--r-- doc/Filter.guid
#  11115 -r--r--r-- doc/Form.guide
#   5723 -r--r--r-- doc/Makefile.SH
#  60409 -r--r--r-- doc/Ref.guide
#  33337 -r--r--r-- doc/Users.guide
#   2047 -r--r--r-- doc/answer.1
#   1996 -r--r--r-- doc/autoreply.1
#   1106 -r--r--r-- doc/chkalias.1
#   3280 -r--r--r-- doc/elm-help.0
#   1299 -r--r--r-- doc/elm-help.1
#    623 -r--r--r-- doc/elm-help.2
#   2370 -r--r--r-- doc/elm-help.3
#   4044 -r--r--r-- doc/elm.1
#   3807 -r--r--r-- doc/elmrc-info
#   4737 -r--r--r-- doc/elmrc.samp
#   3199 -r--r--r-- doc/fastmail.1
#   3241 -r--r--r-- doc/filter.1
#   1044 -r--r--r-- doc/frm.1
#    959 -r--r--r-- doc/listalias.1
#    684 -r--r--r-- doc/messages.1
#   2305 -r--r--r-- doc/newalias.1
#  25129 -r--r--r-- doc/tmac.n
#   4842 -r--r--r-- doc/newmail.1
#    943 -r--r--r-- doc/printmail.1
#   3746 -r--r--r-- doc/readmsg.1
#   1667 -r--r--r-- doc/wnewmail.1
#   3951 -r--r--r-- filter/Makefile.SH
#   8077 -r--r--r-- filter/actions.c
#    873 -r--r--r-- filter/buffer.c
#   8962 -r--r--r-- filter/filter.c
#   4415 -r--r--r-- filter/lock.c
#  10250 -r--r--r-- filter/parse.c
#   8857 -r--r--r-- filter/rules.c
#   5358 -r--r--r-- filter/summarize.c
#   4131 -r--r--r-- filter/utils.c
#   1278 -r--r--r-- hdrs/curses.h
#  11805 -rw-r--r-- hdrs/defs.h
#   8150 -rw-r--r-- hdrs/elm.h
#   5556 -r--r--r-- hdrs/filter.h
#   8145 -rw-r--r-- hdrs/headers.h
#     22 -rw-r--r-- hdrs/patchlevel.h
#   3808 -r--r--r-- hdrs/save_opts.h
#   4783 -r--r--r-- hdrs/sysdefs.SH
#   6883 -r--r--r-- src/Makefile.SH
#  32825 -r--r--r-- src/addr_util.c
#  18559 -r--r--r-- src/alias.c
#   9584 -r--r--r-- src/aliasdb.c
#  10106 -r--r--r-- src/aliaslib.c
#   6189 -r--r--r-- src/args.c
#   3297 -r--r--r-- src/bouncebk.c
#   9197 -r--r--r-- src/builtin.c
#   4273 -r--r--r-- src/calendar.c
#   3364 -r--r--r-- src/conn_to.c
#  19114 -r--r--r-- src/curses.c
#   8025 -r--r--r-- src/date.c
#   3528 -r--r--r-- src/delete.c
#   8946 -r--r--r-- src/domains.c
#   6214 -r--r--r-- src/edit.c
#  20140 -r--r--r-- src/editmsg.c
#  23067 -r--r--r-- src/elm.c
#   5170 -r--r--r-- src/encode.c
#   3258 -r--r--r-- src/errno.c
#   1621 -r--r--r-- src/exitprog.c
#   3959 -r--r--r-- src/expires.c
#  10799 -r--r--r-- src/file.c
#   9140 -r--r--r-- src/file_util.c
#  12330 -r--r--r-- src/fileio.c
#   9690 -r--r--r-- src/forms.c
#   9502 -r--r--r-- src/hdrconfg.c
#   8885 -r--r--r-- src/help.c
#  13107 -r--r--r-- src/in_utils.c
#  12812 -r--r--r-- src/init.c
#  30210 -r--r--r-- src/leavembox.c
#   8762 -r--r--r-- src/limit.c
#  10461 -r--r--r-- src/mailmsg1.c
#  29482 -r--r--r-- src/mailmsg2.c
#   2519 -r--r--r-- src/mailtime.c
#   3781 -r--r--r-- src/mkhdrs.c
#  25812 -r--r--r-- src/newmbox.c
#   9658 -r--r--r-- src/opt_utils.c
#  11481 -r--r--r-- src/options.c
#   2835 -r--r--r-- src/out_utils.c
#   6610 -r--r--r-- src/pattern.c
#   2043 -r--r--r-- src/pmalloc.c
#   5474 -r--r--r-- src/quit.c
#  26933 -r--r--r-- src/read_rc.c
#   4258 -r--r--r-- src/remail.c
#  15962 -r--r--r-- src/reply.c
#  12548 -r--r--r-- src/returnadd.c
#  11020 -r--r--r-- src/save_opts.c
#   7104 -r--r--r-- src/savecopy.c
#  12632 -r--r--r-- src/screen.c
#  14893 -r--r--r-- src/showmsg.c
#   9368 -r--r--r-- src/showmsg_c.c
#   3294 -r--r--r-- src/signals.c
#   3444 -r--r--r-- src/softkeys.c
#   7634 -r--r--r-- src/sort.c
#   4501 -r--r--r-- src/string2.c
#  15144 -r--r--r-- src/strings.c
#  10776 -r--r--r-- src/syscall.c
#   8539 -r--r--r-- src/utils.c
#   1531 -r--r--r-- src/validname.c
#      0 -r--r--r-- test/test.empty
#  10010 -r--r--r-- test/test.mail
#  10653 -r--r--r-- utils/Makefile.SH
#   9967 -r--r--r-- utils/answer.c
#  16839 -r--r--r-- utils/arepdaem.c
#   5830 -r--r--r-- utils/autoreply.c
#    216 -r--r--r-- utils/checkalias
#   4125 -r--r--r-- utils/expand.c
#   9156 -r--r--r-- utils/fastmail.c
#  10674 -r--r--r-- utils/from.c
#   2495 -r--r--r-- utils/listalias.c
#   1325 -r--r--r-- utils/mailrc.awk
#    525 -r--r--r-- utils/messages
#  16801 -r--r--r-- utils/newalias.c
#  20729 -r--r--r-- utils/newmail.c
#    356 -r--r--r-- utils/printmail
#  12795 -r--r--r-- utils/readmsg.c
#
if test -r shar3_seq_.tmp; then
	echo "Must unpack archives in sequence!"
	next=`cat shar3_seq_.tmp`; echo "Please unpack part $next next"
	exit 1
fi
# ============= Changes ==============
echo "x - extracting Changes (Text)"
sed 's/^X//' << 'SHAR_EOF' > Changes &&
XThis file describes major changes made to the Elm source distribution
Xbetween Releases 2.2 and 2.3.  Please remember that Elm is a volunteer
Xproject, we did what we had time for, and perhaps, what interested us.
XIf you have a suggestion, or a fix, submit it, and better yet,
Xvolunteer to impliment it.
X
X        Syd Weinstein		Sat Apr 28 22:16:46 EDT 1990
X
XComplete rewrite of date parsing to allow for RFC822 dates and time zones.
X
XDEL is no longer a syn. for x.
X
XAdd BSD style screen sizing when the IOCTL calls exist.
X
XRemove direct access to the L.sys/Systems file and only use uuname.
X
XAdd -v option for Elm version and options information.
X
XAllows specifying the temp directory to be used by Elm.
X
XAllow for restricting shell escapes from Elm.  (But of course, not
Xfrom any pager or editor Elm would invoke)
X
XAdd PID type locking to the lock file.
X
XMake Elm confirm an x command if changes pending, allow X to be the
Xold non confirming x command.
X
XAllow for disabling the X-Mailer header if desired.
X
XComplete revamp of Configure using new Metaconfig modules.
X
XAdd some checking for space problems and force an emergency exit in those
Xcases.
X
XAllow the alias file to be used across heterogenous networks by
Xkeeping it in network byte order if NFS is available.
X
XAdd support for MMDF style mailboxes.
X
XAliases are now case insensitive as per survey results
X
XRecursive aliases now work again.
X
XAnd many bug fixes.
X
X************************************************************************
SHAR_EOF
# ============= Configure ==============
echo "x - extracting Configure (Text)"
sed 's/^X//' << 'SHAR_EOF' > Configure &&
X#! /bin/sh
X#
X# If these # comments don't work, trim them.  Don't worry about any other
X# shell scripts, Configure will trim # comments from them for you.
X#
X# (If you are trying to port this package to a machine without sh, I would
X# suggest you cut out the prototypical config.h from the end of Configure
X# and edit it to reflect your system.  Some packages may include samples
X# of config.h for certain machines, so you might look for one of those.)
X#
X# $Header: /files/home/users/syd/elm.rel/RCS/Configure,v 4.1.1.11 90/10/24 16:37:01 syd Exp $
X#
X# Yes, you may rip this off to use in other distribution packages.
X# (Note: this Configure script was generated automatically.  Rather than
X# working with this copy of Configure, you may wish to get metaconfig.)
X
X: sanity checks
XPATH=".:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:$PATH"
Xexport PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
X
Xif test ! -t 0; then
X    echo "Say 'sh Configure', not 'sh <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
Xif test ! -d ../UU; then
X    if test ! -d UU; then
X	mkdir UU
X    fi
X    cd UU
Xfi
X
Xcase "$1" in
X-d) shift; fastread='yes';;
Xesac
X
Xdefine=''
Xeunicefix=''
XLog=''
XHeader=''
Xbin=''
Xbyteorder=''
Xcontains=''
Xcppstdin=''
Xcppminus=''
Xd_crypt=''
Xcryptlib=''
Xd_getopt=''
Xd_havetlib=''
Xtermlib=''
Xd_mkdir=''
Xd_rename=''
Xd_sigvec=''
Xd_sigvectr=''
Xd_symlink=''
Xd_vfork=''
Xd_whoami=''
Xdefeditor=''
Xhostname=''
Xphostname=''
Xmydomain=''
Xi_time=''
Xi_systime=''
Xd_systimekernel=''
Xmaildir=''
Xn=''
Xc=''
Xpackage=''
Xpager=''
Xprefshell=''
Xspitshell=''
Xshsharp=''
Xsharpbang=''
Xstartsh=''
Xd_eunice=''
Xloclist=''
Xexpr=''
Xsed=''
Xecho=''
Xcat=''
Xrm=''
Xmv=''
Xcp=''
Xtail=''
Xtr=''
Xmkdir=''
Xsort=''
Xuniq=''
Xgrep=''
Xtrylist=''
Xtest=''
Xinews=''
Xegrep=''
Xmore=''
Xpg=''
XMcc=''
Xvi=''
Xmailx=''
Xmail=''
Xcpp=''
Xperl=''
Xemacs=''
Xls=''
Xrmail=''
Xsendmail=''
Xshar=''
Xsmail=''
Xsubmit=''
Xtbl=''
Xtroff=''
Xnroff=''
Xuname=''
Xuuname=''
Xline=''
Xchgrp=''
Xchmod=''
Xlint=''
Xsleep=''
Xpr=''
Xtar=''
Xln=''
Xlpr=''
Xlp=''
Xtouch=''
Xmake=''
Xdate=''
Xcsh=''
Xpmake=''
Xc_date=''
Xd_ascii=''
Xd_calendar=''
Xcalendar=''
Xd_cuserid=''
Xd_flock=''
Xd_flockonly=''
Xlock_dir=''
Xd_gethname=''
Xd_douname=''
Xd_phostname=''
Xd_host_comp=''
Xign_hname=''
Xd_havedbm=''
Xdbm=''
Xd_index=''
Xd_internet=''
Xd_mboxedit=''
Xd_mmdf=''
Xd_newauto=''
Xd_nfs=''
Xd_networkorder=''
Xd_noxheader=''
Xd_optreturn=''
Xd_pafirst=''
Xd_notouchadd=''
Xd_noaddfrom=''
Xd_usedomain=''
Xd_nocheckvalid=''
Xd_pidcheck=''
Xd_portable=''
Xd_ptem=''
Xd_remlock=''
Xmaxattempts=''
Xd_setgid=''
Xmailermode=''
Xd_strcspn=''
Xd_strspn=''
Xd_strings=''
Xd_pwdinsys=''
Xstrings=''
Xincludepath=''
Xd_subshell=''
Xd_tempnam=''
Xtempnamo=''
Xtempnamc=''
Xd_termio=''
Xd_termios=''
Xd_tz_min=''
Xd_useembed=''
Xd_utimbuf=''
Xd_voidsig=''
Xdefbatsub=''
Xelmalias=''
Xmaxsysalias=''
Xmaxuseralias=''
Xlib=''
Xlibc=''
Xlinepr=''
Xmailer=''
Xmailgrp=''
Xmansrc=''
Xmanext=''
Xmodels=''
Xsplit=''
Xsmall=''
Xmedium=''
Xlarge=''
Xhuge=''
Xoptimize=''
Xccflags=''
Xcppflags=''
Xldflags=''
Xcc=''
Xlibs=''
Xnametype=''
Xd_passnames=''
Xd_berknames=''
Xd_usgnames=''
Xpasscat=''
Xpathalias=''
Xdomains=''
Xrmttape=''
Xroff=''
Xtmpdir=''
Xuse_pmake=''
Xxencf=''
Xxenlf=''
Xd_xenix=''
Xd_bsd=''
XCONFIG=''
X: set package name
Xpackage=elm2
X
Xecho " "
Xecho "Beginning of configuration questions for $package kit."
X: Eunice requires " " instead of "", can you believe it
Xecho " "
X
Xdefine='define'
Xundef='undef'
X: change the next line if compiling for Xenix/286 on Xenix/386
Xxlibpth='/usr/lib/386 /lib/386 /lib'
Xlibpth='/usr/lib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
Xsmallmach='pdp11 i8086 z8000 i80286 iAPX286'
Xrmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
Xtrap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
X
X: We must find out about Eunice early
Xeunicefix=':'
Xif test -f /etc/unixtovms; then
X    eunicefix=/etc/unixtovms
Xfi
Xif test -f /etc/unixtovms.exe; then
X    eunicefix=/etc/unixtovms.exe
Xfi
X
X: Now test for existence of everything in MANIFEST
X
Xecho "First let's make sure your kit is complete.  Checking..."
X(cd ..; awk '' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$)
Xecho "Looks good..."
X
Xattrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
Xattrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
Xattrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
Xattrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
Xattrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
Xattrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
Xattrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__"
Xd_newshome="/usr/NeWS"
Xdefvoidused=7
Xpth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/5bin /vol/local/bin /etc"
Xpth="$pth /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb"
Xpth="$pth /usr/convex /usr/mmdf/bin /usr/mmdf/lib ${BSDBASE-/bsd}/usr/ucb ${BSDBASE-/bsd}/bin ${BSDBASE-/bsd}/usr/bin"
X
X: check for out bin directory
Xif test ! -d ../bin; then
X    echo "Making bin directory"
X    mkdir ../bin
Xelse
X    echo "Found bin directory"
Xfi
X
X: some greps do not return status, grrr.
Xecho "grimblepritz" >grimble
Xif grep blurfldyick grimble >/dev/null 2>&1 ; then
X    contains=contains
Xelif grep grimblepritz grimble >/dev/null 2>&1 ; then
X    contains=grep
Xelse
X    contains=contains
Xfi
Xrm -f grimble
X: the following should work in any shell
Xcase "$contains" in
Xcontains*)
X    echo " "
X    echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
X    cat >contains <<'EOSS'
Xgrep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
XEOSS
Xchmod +x contains
Xesac
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 $contains hi today >/dev/null 2>&1; 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: first determine how to suppress newline on echo command
Xecho "Checking echo to see how to suppress newlines..."
X(echo "hi there\c" ; echo " ") >.echotmp
Xif $contains c .echotmp >/dev/null 2>&1 ; then
X    echo "...using -n."
X    n='-n'
X    c=''
Xelse
X    cat <<'EOM'
X...using \c
XEOM
X    n=''
X    c='\c'
Xfi
Xecho $n "Type carriage return to continue.  Your cursor should be here-->$c"
Xread ans
Xrm -f .echotmp
X
X: now set up to do reads with possible shell escape and default assignment
Xcat <<EOSC >myread
Xcase "\$fastread" in
Xyes) ans=''; echo " " ;;
X*) ans='!';;
Xesac
Xwhile expr "X\$ans" : "X!" >/dev/null; do
X    read ans
X    case "\$ans" in
X    !)
X	sh
X	echo " "
X	echo $n "\$rp $c"
X	;;
X    !*)
X	set \`expr "X\$ans" : "X!\(.*\)\$"\`
X	sh -c "\$*"
X	echo " "
X	echo $n "\$rp $c"
X	;;
X    esac
Xdone
Xrp='Your answer:'
Xcase "\$ans" in
X'') ans="\$dflt";;
Xesac
XEOSC
X
X: general instructions
Xcat <<EOH
X 
XThis installation shell script will examine your system and ask you questions
Xto determine how the $package package should be installed.  If you get stuck
Xon a question, you may use a ! shell escape to start a subshell or execute
Xa command.  Many of the questions will have default answers in square
Xbrackets--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
XEOH
Xrp="[Type carriage return to continue]"
Xecho $n "$rp $c"
X. myread
Xcat <<EOH
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
Xto edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
Xknow how I blew it.  If you can't run Configure for some reason, you'll have
Xto generate a config.sh file by hand.
X
XThis installation script affects things in two ways: 1) it may do direct
Xvariable substitutions on some of the files included in this kit, and
X2) it builds a config.h file for inclusion in C programs.  You may edit
Xany of these files as the need arises after running this script.
X
XIf you make a mistake on a question, there is no easy way to back up to it
Xcurrently.  The easiest thing to do is to edit config.sh and rerun all the
XSH files.  Configure will offer to let you do this before it runs the SH files.
X
XEOH
Xrp="[Type carriage return to continue]"
Xecho $n "$rp $c"
X. myread
X
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.  Did Configure make it on THIS system? [$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
X: find out where common programs are
Xecho " "
Xecho "Locating common programs..."
Xcat <<EOSC >loc
X$startsh
Xcase \$# in
X0) exit 1;;
Xesac
Xthing=\$1
Xshift
Xdflt=\$1
Xshift
Xfor dir in \$*; do
X    case "\$thing" in
X    .)
X	if test -d \$dir/\$thing; then
X	    echo \$dir
X	    exit 0
X	fi
X	;;
X    *)
X	if test -f \$dir/\$thing; then
X	    echo \$dir/\$thing
X	    exit 0
X	elif test -f \$dir/\$thing.exe; then
X	    : on Eunice apparently
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="
Xcat
Xchgrp
Xchmod
Xcp
Xecho
Xexpr
Xgrep
Xln
Xls
Xmake
Xmv
Xrm
Xsed
Xsleep
Xtouch
Xtr
X"
Xtrylist="
XMcc
Xcpp
Xdate
Xemacs
Xline
Xlint
Xlp
Xlpr
Xmailx
Xmore
Xnroff
Xpg
Xpmake
Xpr
Xrmail
Xsendmail
Xshar
Xsmail
Xsubmit
Xtar
Xtbl
Xtest
Xtroff
Xuname
Xuuname
Xvi
X"
Xfor file in $loclist; do
X    xxx=`loc $file $file $pth`
X    eval $file=$xxx
X    eval _$file=$xxx
X    case "$xxx" in
X    /*)
X	echo $file is in $xxx.
X	;;
X    *)
X	echo "I don't know where $file is.  I hope it's in everyone's PATH."
X	;;
X    esac
Xdone
Xecho " "
Xecho "Don't worry if any of the following aren't found..."
Xans=offhand
Xfor file in $trylist; do
X    xxx=`loc $file $file $pth`
X    eval $file=$xxx
X    eval _$file=$xxx
X    case "$xxx" in
X    /*)
X	echo $file is in $xxx.
X	;;
X    *)
X	echo "I don't see $file out there, $ans."
X	ans=either
X	;;
X    esac
Xdone
Xcase "$egrep" in
Xegrep)
X    echo "Substituting grep for egrep."
X    egrep=$grep
X    ;;
Xesac
Xcase "$test" in
Xtest)
X    echo "Hopefully test is built into your sh."
X    ;;
X/bin/test)
X    if sh -c "PATH= test true" >/dev/null 2>&1; then
X	echo "Using the test built into your sh."
X	test=test
X    fi
X    ;;
X*)
X    test=test
X    ;;
Xesac
Xcase "$echo" in
Xecho)
X    echo "Hopefully echo is built into your sh."
X    ;;
X/bin/echo)
X    echo " "
X    echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
X    $echo $n "hi there$c" >foo1
X    echo $n "hi there$c" >foo2
X    if cmp foo1 foo2 >/dev/null 2>&1; then
X	echo "They are compatible.  In fact, they may be identical."
X    else
X	case "$n" in
X	'-n') n='' c='\c' ans='\c' ;;
X	*) n='-n' c='' ans='-n' ;;
X	esac
X	cat <<FOO
XThey are not compatible!  You are probably running ksh on a non-USG system.
XI'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
Xhave echo built in and we may have to run some Bourne shell scripts.  That
Xmeans I'll have to use $ans to suppress newlines now.  Life is ridiculous.
X
XFOO
X	rp="Your cursor should be here-->"
X	$echo $n "$rp$c"
X	. myread
X    fi
X    $rm -f foo1 foo2
X    ;;
X*)
X    : cross your fingers
X    echo=echo
X    ;;
Xesac
Xrmlist="$rmlist loc"
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 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	case "$fastread" in
X	yes) dflt=y;;
X	*) dflt=n;;
X	esac
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 date exists, if so, init c_date
Xif $test ! "x$date" = "x" ; then
X    c_date=`LANGUAGE= $date`
Xelse
X    c_date='date was unavailable at configuration'
Xfi
X
X: make some quick guesses about what we are up against
Xecho " "
X$echo $n "Hmm...  $c"
Xif $test -f "$uname"; then
X    uname_os=`uname -s`
X    uname_rel=`uname -r`
X    uname_rel=`expr "$uname" : "\(...\).*"`
Xelse
X    uname_os=unknown
X    uname_rel=unknown
Xfi
Xcat /usr/include/signal.h /usr/include/sys/signal.h >foo
Xif test `echo abc | tr a-z A-Z` = Abc ; then
X    echo "Looks kind of like a USG system, but we'll see..."
X    echo exit 1 >bsd
X    echo exit 0 >usg
X    echo exit 1 >v7
Xelif $contains SIGTSTP foo >/dev/null 2>&1 ; then
X    if $test "$uname_os" = "SunOs" -a "$uname_rel" = "4.1" ; then
X	echo "Looks like SunOs 4.1, a USG system, but we'll see..."
X	echo exit 1 >bsd
X	echo exit 0 >usg
X	echo exit 1 >v7
X    else
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
X    fi
Xelse
X    echo "Looks kind of like a version 7 system, but we'll see..."
X    echo exit 1 >bsd
X    echo exit 1 >usg
X    echo exit 0 >v7
Xfi
Xcase "$eunicefix" in
X*unixtovms*)
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    d_eunice="$define"
X    ;;
X*)
X    echo " "
X    echo "Congratulations.  You aren't running Eunice."
X    d_eunice="$undef"
X    echo "exit 1" >eunice
X    ;;
Xesac
Xif test -f /xenix; then
X    echo "Actually, this looks more like a XENIX system..."
X    echo "exit 0" >xenix
Xelse
X    echo " "
X    echo "It's not Xenix..."
X    echo "exit 1" >xenix
Xfi
Xchmod +x xenix
X$eunicefix xenix
Xif test -f /venix; then
X    echo "Actually, this looks more like a VENIX system..."
X    echo "exit 0" >venix
Xelse
X    echo " "
X    if xenix; then
X	: null
X    else
X	echo "Nor is it Venix..."
X    fi
X    echo "exit 1" >venix
Xfi
Xchmod +x bsd usg v7 eunice venix
X$eunicefix bsd usg v7 eunice venix
Xrm -rf foo
Xrmlist="$rmlist bsd usg v7 eunice venix xenix"
X
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.  Elm expects
Xthe text processor to write to standard out.   Some old troff programs require
Xthe -t flag to send the output to standard out.  If yours does, use the -t flag
Xas part of the executable name and ignore the not found error message,
Xas in: troff -t
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    roff=$ans;
X    if $test -f "$ans"; then
X	cont=''
X    else
X	lookup=`loc "$ans" "" . $pth`
X	if $test -f "$lookup"; then
X	    cont=''
X	    roff=$lookup
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: determine where manual pages go
X$cat <<EOM
X  
X$package has manual pages that need to be installed in source form.
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/l_man/man1 /usr/local/man/u_man/man1 /usr/local/man/l_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*o)
X    manext=l
X    ;;
X*p)
X    manext=n
X    ;;
X*C)
X    manext=C
X    ;;
X*L)
X    manext=L
X    ;;
X*)
X    manext=1
X    ;;
Xesac
X
X: default clear to no extra flags
Xxencf=
Xxenlf=
Xd_xenix="$undef"
Xd_bsd="$undef"
X: see if we are xenix 
Xif xenix; then
X    d_xenix="$define"
X:	now are we a 286
X    case "`uname -p`" in
X	i80286) 
X		xencf="-LARGE -Ml2et32"
X		xenlf="-Ml2t32 -F 5600 -SEG 512"
X      esac
Xfi
Xif bsd; then
X    d_bsd="$define"
Xfi
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
Xif $test -z "$xencf" ; then
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.
XXenix and Venix systems may wish to put "none" and let the compiler figure
Xthings 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/man1/ld.1 >/dev/null 2>&1 || \
X	   $contains '\-i' $mansrc/man1/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
Xfi
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
X
XSome C compilers have problems with their optimizers, by default, $package
Xcompiles with the -O flag to use the optimizer.  Alternately, you might
Xwant to use the symbolic debugger, which uses the -g flag (on traditional
XUnix systems).  Either flag can be specified here.  To use neither flag,
Xspecify 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'') case "$cc" in
X    *gcc*) dflt='-fpcc-struct-return';;
X    *) dflt='';;
X    esac
X    ;;
X*) dflt="$ccflags";;
Xesac
Xfor thisincl in $inclwanted; do
X    if test -d $thisincl; then
X	case "$dflt" in
X	*$thisincl*);;
X	*) dflt="$dflt -I$thisincl";;
X	esac
X    fi
Xdone
Xcase "$optimize" in
X-g*)
X    case "$dflt" in
X    *DEBUG*);;
X    *) dflt="$dflt -DDEBUG";;
X    esac
X    ;;
Xesac
Xcase "$dflt" in
X'') dflt=none;;
Xesac
Xif $test -n "$xencf" ; then
X    $echo "Xenix 286 system, using compiler flags $xencf"
X    $echo "do not respecify these flags below."
X    $echo ""
Xfi
Xcat <<EOH
X
XYour C compiler may want other flags.  For this question you should
Xinclude -I/whatever and -DWHATEVER flags and any other flags used by
Xthe C compiler, but you should NOT include libraries or ld flags like
X-lwhatever.  To use no flags, specify the word "none".
X  
XEOH
Xrp="Any additional cc flags? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
Xnone) ans='';
Xesac
Xccflags="$ans"
X
X: the following weeds options from ccflags that are of no interest to cpp
Xcppflags="$ccflags"
Xcase "$cc" in
X*gcc*) cppflags="$cppflags -D__GNUC__";;
Xesac
Xcase "$cppflags" in
X'');;
X*)  set X $cppflags
X    cppflags=''
X    for flag do
X	case $flag in
X	-D*|-I*) cppflags="$cppflags $flag";;
X	esac
X    done
X    case "$cppflags" in
X    *-*)  echo "(C preprocessor flags: $cppflags)";;
X    esac
X    ;;
Xesac
X
Xif $test -n "$xenlf" ; then
X    $echo "Xenix 286 system, using linker flags $xenlf"
X    $echo "do not respecify these flags below"
X    $echo ""
Xfi
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 (NOT including libraries)? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
Xnone) ans='';
Xesac
Xldflags="$ans"
Xrmlist="$rmlist pdp11"
X
Xecho " "
Xecho "Checking for optional libraries..."
Xcase "$libs" in
X'') dflt='';;
X*) dflt="$libs";;
Xesac
Xcase "$libswanted" in
X'') libswanted='c_s';;
Xesac
Xfor thislib in $libswanted; do
X    case "$thislib" in
X    dbm) thatlib=ndbm;;
X    *_s) thatlib=NONE;;
X    *) thatlib="${thislib}_s";;
X    *) thatlib=NONE;;
X    esac
X    xxx=`loc lib$thislib.a X /usr/lib /usr/local/lib /lib`
X    if test -f $xxx; then
X	echo "Found -l$thislib."
X	case "$dflt" in
X	*-l$thislib*|*-l$thatlib*);;
X	*) dflt="$dflt -l$thislib";;
X	esac
X    else
X	xxx=`loc lib$thislib.a X $libpth`
X	if test -f $xxx; then
X	    echo "Found $xxx."
X	    case "$dflt" in
X	    *$xxx*);;
X	    *) dflt="$dflt $xxx";;
X	    esac
X	else
X	    xxx=`loc Slib$thislib.a X $xlibpth`
X	    if test -f $xxx; then
X		echo "Found -l$thislib."
X		case "$dflt" in
X		*-l$thislib*|*-l$thatlib*);;
X		*) dflt="$dflt -l$thislib";;
X		esac
X	    else
X		echo "No -l$thislib."
X	    fi
X	fi
X    fi
Xdone
Xset X $dflt
Xshift
Xdflt="$*"
Xcase "$dflt" in
X'') dflt='none';;
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 $package
Xon your machine as well.  If your system needs the "-lc_s" option,
Xinclude it here.  Include any other special libraries here as well.
XSay "none" for none.
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: check for ordering of bytes in a long
Xcase "$byteorder" in
X'')
Xcat <<'EOM'
X  
XIn the following, larger digits indicate more significance.  A big-endian
Xmachine like a Pyramid or a Motorola 680?0 chip will come out to 4321.  A
Xlittle-endian machine like a Vax or an Intel 80?86 chip would be 1234.  Other
Xmachines may have weird orders like 3412.  A Cray will report 87654321.  If
Xthe test program works the default is probably right.
XI'm now running the test program...
XEOM
X    $cat >try.c <<'EOCP'
X#include <stdio.h>
Xmain()
X{
X    int i;
X    union {
X	unsigned long l;
X	char c[sizeof(long)];
X    } u;
X
X    if (sizeof(long) > 4)
X	u.l = 0x0807060504030201;
X    else
X	u.l = 0x04030201;
X    for (i=0; i < sizeof(long); i++)
X	printf("%c",u.c[i]+'0');
X    printf("\n");
X}
XEOCP
X    if $cc try.c -o try >/dev/null 2>&1 ; then
X	dflt=`./try`
X	case "$dflt" in
X	????|????????) echo "(The test program ran ok.)";;
X	*) echo "(The test program didn't run right for some reason.)";;
X	esac
X    else
X	dflt='4321'
X	echo "(I can't seem to compile the test program.  Guessing big-endian...)"
X    fi
X    ;;
X*)
X    echo " "
X    dflt="$byteorder"
X    ;;
Xesac
Xrp="What is the order of bytes in a long? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xbyteorder="$ans"
X$rm -f try.c try
X
X: get list of predefined functions in a handy place
Xecho " "
Xcase "$libc" in
X'') libc=unknown;;
Xesac
Xcase "$libpth" in
X'') libpth='/lib /usr/lib /usr/local/lib';;
Xesac
Xcase "$libs" in
X*-lc_s*) libc=`loc libc_s.a $libc $libpth`
Xesac
Xlibnames='';
Xcase "$libs" in
X'') ;;
X*)  for thislib in $libs; do
X	case "$thislib" in
X	-l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
X	    try=`loc lib$thislib.a blurfl/dyick $libpth`
X	    if test ! -f $try; then
X		try=`loc lib$thislib blurfl/dyick $libpth`
X		if test ! -f $try; then
X		    try=`loc $thislib blurfl/dyick $libpth`
X		    if test ! -f $try; then
X			try=`loc Slib$thislib.a blurfl/dyick $xlibpth`
X			if test ! -f $try; then
X			    try=''
X			fi
X		    fi
X		fi
X	    fi
X	    libnames="$libnames $try"
X	    ;;
X	*) libnames="$libnames $thislib" ;;
X	esac
X    done
X    ;;
Xesac
Xset /usr/lib/libc.so.[0-9]*
Xeval set \$$#
Xif test -f "$1"; then
X    echo "Your shared C library is in $1."
X    libc="$1"
Xelif test -f $libc; then
X    echo "Your C library is in $libc, like you said before."
Xelif 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 "$uname_os" != DomainOS ; then
X        ans=`loc libc.a blurfl/dyick $libpth`
X    fi
X    if test ! -f "$ans"; then
X	ans=`loc libc blurfl/dyick $libpth`
X    fi
X    if test ! -f "$ans"; then
X	ans=`loc clib blurfl/dyick $libpth`
X    fi
X    if test ! -f "$ans"; then
X	ans=`loc Slibc.a blurfl/dyick $xlibpth`
X    fi
X    if test ! -f "$ans"; then
X	ans=`loc Mlibc.a blurfl/dyick $xlibpth`
X    fi
X    if test ! -f "$ans"; then
X	ans=`loc Llibc.a blurfl/dyick $xlibpth`
X    fi
X    if test -f "$ans"; then
X	echo "Your C library is in $ans, of all places."
X	libc=$ans
X    else
X	cat <<EOM
X 
XI can't seem to find your C library.  I've looked in the following places:
X
X	$libpth
X
XNone of these seems to contain your C library.  What is the full name
XEOM
X	dflt=None
X	$echo $n "of your C library? $c"
X	rp='C library full name?'
X	. myread
X	libc="$ans"
X    fi
Xfi
Xecho " "
Xset `echo $libc $libnames | tr ' ' '\012' | sort | uniq`
X$echo $n "Extracting names from $* for later perusal...$c"
Xnm $* 2>/dev/null >libc.tmp
X$sed -n -e 's/^.* [AT]  *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
Xif $contains '^printf$' libc.list >/dev/null 2>&1; then
X    echo "done"
Xelse
X    $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
X    $contains '^printf$' libc.list >/dev/null 2>&1 || \
X	$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list
X    $contains '^printf$' libc.list >/dev/null 2>&1 || \
X	$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list
X    $contains '^printf$' libc.list >/dev/null 2>&1 || \
X       $sed -n -e 's/^_//' \
X	      -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
X    $contains '^printf$' libc.list >/dev/null 2>&1 || \
X	$sed -n -e 's/^.*|FUNC |GLOB .*|//p' <libc.tmp >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 > libc.tmp; then
X	    for thisname in $libnames; do
X		ar t $thisname >>libc.tmp
X	    done
X	    $sed -e 's/\.o$//' < libc.tmp > libc.list
X	    echo "Ok."
X	else
X	    echo "ar didn't seem to work right."
X	    echo "Maybe this is a Cray...trying bld instead..."
X	    if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
X		for thisname in $libnames; do
X		    bld t $libnames | \
X			$sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
X		    ar t $thisname >>libc.tmp
X		done
X		echo "Ok."
X	    else
X	    	echo "That didn't work either.  Giving up."
X	    	exit 1
X	    fi
X	fi
X    fi
Xfi
X
Xinlibc='echo " ";
Xif $contains "^$1\$" libc.list >/dev/null 2>&1;
Xthen echo "$1() found"; eval "$2=$define";
Xelse echo "$1() not found"; eval "$2=$undef"; fi'
X
Xrmlist="$rmlist libc.tmp libc.list"
X
X: see if nfs exists
Xecho " "
Xdflt=`loc exports xyz /etc /usr/etc`
Xif $test "$dflt" = xyz; then
X    dflt=`loc nfsd xyz /etc /usr/etc $pth`
Xfi
Xif $test "$dflt" = xyz; then
X    echo "System does not support NFS, internal byte order will be used"
X    d_nfs="$undef"
Xelse
X    echo "System supports NFS, network byte order will be used"
X    d_nfs="$define"
Xfi
X
Xif $test "$d_nfs" = "$define"; then
X    case "$byteorder" in
X	4321)
X	    d_networkorder="$undef";
X	    ;;
X	*)
X	    d_networkorder="$define";
X	    if $contains ntohl libc.list >/dev/null 2>&1; then
X		echo 'ntohl found in libc, no special libraries needed for network byte ordering'
X	    else
X		echo 'ntohl not found in libc, be sure to specify the library for network support'
X		echo 'as an optional library'
X	    fi
X	    ;;
X    esac
Xelse
X    d_networkorder="$undef";
Xfi
X
X: get calendar mode and default calendar file name
X$cat <<EOM
X
XThere is a neat feature that enables scanning of the message body for
Xentries to add to the users ".calendar" (or whatever) file.  These
Xentries are then processed by the system program calendar.  To use
Xthis feature it needs to be enabled.  The name of the per user calendar
Xfile used by your systems calendar program is also required.
XEOM
X
Xcase "$d_calendar" in
X"$define") dflt=y;;
X"$undef")  dflt=n;;
X*)	   dflt=y;;
Xesac
X
Xrp="Enable calendar feature [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
Xy*) d_calendar="$define";;
X*)  d_calendar="$undef";;
Xesac
X
Xcase "$calendar" in
X    '') dflt='calendar';;
X    *)  dflt=$calendar;;
Xesac
X
Xif $test "$d_calendar" = "$define"; then
X	echo " "
X	rp="Default calendar file: [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	calendar="$ans"
Xfi
X
X: check to see if the macros are 8 bit clean, ask the user
X:
X$cat <<EOM
X
X
XNot all environments are restricted to the ASCII 7 bit character set.
XFor example, the ISO 8859/1 (Latin alphabet no. 1) character set,
Xconsisting of 8 bits and 191 printable characters, is becoming
Xmore and more common, especially in non-English speaking countries.
X
XUnfortunately, not all isprint() functions or macros, which ELM
Xuses to determine whether a character is printable or not, will
Xhandle non-ASCII (8 bit) characters properly.  It is suggested that you
Xstart with this value configured to handle 8 bit characters correctly
Xand if there are problems with Elm aborting while displaying messages
Xthat use extended character sets to reconfigure Elm to only display
X7 bit characters.
X
XEOM
X
Xcase "$d_ascii" in
X    "$define")   dflt='n';;
X    *)  dflt='y';;
Xesac
X
Xecho "  "
Xrp="Should Elm assume that isprint() won't break on non-ascii characters? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
X    y*) d_ascii="$undef";;
X    *) d_ascii="$define";;
Xesac
X
X: find out how to find out full name
Xecho " "
Xcase "$d_berknames" in
X"$define")
X    dflt=y;;
X"$undef")
X    dflt=n;;
X*)
X    if bsd; then
X	dflt=y
X    elif xenix; then
X	dflt=y
X    else
X	dflt=n
X    fi
X    ;;
Xesac
Xecho "Does your /etc/passwd file keep full names in Berkeley/V7 format (name first"
X$echo $n "thing after ':' in GCOS field)? [$dflt] $c"
Xrp="Berkeley/V7 format full name? [$dflt]"
X. myread
Xcase "$ans" in
X  y*)
X    d_passnames="$define"
X    d_berknames="$define"
X    d_usgnames="$undef"
X    nametype=bsd
X    ;;
X  *)
X    echo " "
X    case "$d_usgnames" 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    rp="USG format full name? [$dflt]"
X    . myread
X    case "$ans" in
X      n*)
X	echo "Full name will be taken from ~/.fullname"
X	d_passnames="$undef"
X	d_berknames="$undef"
X	d_usgnames="$undef"
X	nametype=other
X	;;
X      *)
X	d_passnames="$define"
X	d_berknames="$undef"
X	d_usgnames="$define"
X	nametype=usg
X	;;
X    esac
X    ;;
Xesac
X
X: see if we have to deal with yellow pages
Xif $test -d /usr/etc/yp || $test -d /etc/yp; then
X    if $test "$passcat" = "ypcat passwd"; then
X	dflt=y
X    elif $contains '^\+:' /etc/passwd; then
X	dflt=y
X    else
X	dflt=n
X    fi
X    rp="Are you getting the passwd file via yellow pages? [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    case "$ans" in
X    y*) passcat='ypcat passwd';;
X    *) passcat='cat /etc/passwd';;
X    esac
Xelse
X    passcat='cat /etc/passwd'
Xfi
X
X: see if crypt exists
Xecho " "
Xif $contains '^crypt$' libc.list >/dev/null 2>&1; then
X    echo 'crypt() found.'
X    d_crypt="$define"
X    cryptlib=''
Xelse
X    cryptlib=`loc Slibcrypt.a "" $xlibpth`
X    if $test -z "$cryptlib"; then
X	cryptlib=`loc Mlibcrypt.a "" $xlibpth`
X    else
X	cryptlib=-lcrypt
X    fi
X    if $test -z "$cryptlib"; then
X	cryptlib=`loc Llibcrypt.a "" $xlibpth`
X    else
X	cryptlib=-lcrypt
X    fi
X    if $test -z "$cryptlib"; then
X	cryptlib=`loc libcrypt.a "" $libpth`
X    else
X	cryptlib=-lcrypt
X    fi
X    if $test -z "$cryptlib"; then
X	echo 'crypt() not found.'
X	d_crypt="$undef"
X    else
X	d_crypt="$define"
X    fi
Xfi
X
X: check for cuserid function
Xecho " "
Xif $contains '^cuserid$' libc.list >/dev/null 2>&1 ; then
X    echo "cuserid() found."
X    d_cuserid="$undef"
Xelse
X    echo "No cuserid() found--will use mine."
X    d_cuserid="$define"
Xfi
X
X: now get the host name
Xecho " "
Xecho "Figuring out host name..."
Xecho 'Maybe "hostname" will work...'
Xif ans=`sh -c hostname 2>&1` ; then
X    hostname=$ans
X    phostname=hostname
Xelse
X    if xenix; then
X	echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
X	if ans=`cat /etc/systemid 2>&1` ; then
X	    hostname=$ans
X	    phostname='cat /etc/systemid'
X	    echo "Whadyaknow.  Xenix always was a bit strange..."
X	else
X	    echo 'No, maybe "uuname -l" will work...'
X	    if ans=`sh -c 'uuname -l' 2>&1` ; then
X		hostname=$ans
X		phostname='uuname -l'
X	    else
X		echo 'Strange.  Maybe "uname -n" will work...'
X		if ans=`sh -c 'uname -n' 2>&1` ; then
X		    hostname=$ans
X		    phostname='uname -n'
X		else
X		    echo 'Oh well, maybe I can mine it out of whoami.h...'
X		    if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
X			hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
X			phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
X		    else
X			case "$hostname" in
X			'') echo "Does this machine have an identity crisis or something?"
X			    phostname=''
X			    ;;
X			*)  echo "Well, you said $hostname before...";;
X			esac
X		    fi
X		fi
X	    fi
X	fi
X    else
X	if $test -r /etc/systemid ; then
X	    echo "What is a non-Xenix system doing with /etc/systemid?"
X	fi
X	echo 'No, maybe "uuname -l" will work...'
X	if $test -n "$uuname" && ans=`sh -c "$uuname -l" 2>&1` ; then
X	    hostname=$ans
X	    phostname="$uuname -l"
X	else
X	    echo 'Strange.  Maybe "uname -n" will work...'
X	    if $test -n "$uname" && ans=`sh -c "$uname -n" 2>&1` ; then
X		hostname=$ans
X		phostname="$uname -n"
X	    else
X		if ans=`cat /etc/systemid 2>&1` ; then
X		    hostname=$ans
X		    phostname='cat /etc/systemid'
X		    echo "Well, I'll use the systemid file anyway..."
X		else
X		    echo 'Oh well, maybe I can mine it out of whoami.h...'
X		    if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
X			hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
X			phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
X		    else
X			case "$hostname" in
X			'') echo "Does this machine have an identity crisis or something?"
X			    phostname=''
X			    ;;
X			*)  echo "Well, you said $hostname before...";;
X			esac
X		    fi
X		fi
X	    fi
X	fi
X    fi
Xfi
X: you do not want to know about this
Xset $hostname
Xhostname=$1
X
X: translate upper to lower if necessary
Xcase "$hostname" in
X    *[A-Z]*)
X	hostname=`echo $hostname | tr '[A-Z]' '[a-z]'`
X	echo "(Normalizing case in your host name)"
X	;;
Xesac
X
X: verify guess
Xif $test "$hostname" ; then
X    dflt=y
X    echo 'Your host name appears to be "'$hostname'".'
X    $echo $n "Is this correct? [$dflt] $c"
X    rp="Sitename is $hostname? [$dflt]"
X    . myread
X    case "$ans" in
X      y*)  ;;
X      *)      hostname='' ;;
X    esac
Xfi
X
X: bad guess or no guess
Xwhile $test "X$hostname" = X ; do
X    dflt=''
X    rp="Please type the (one word) name of your host:"
X    $echo $n "$rp $c"
X    . myread
X    hostname="$ans"
Xdone
X
Xecho " "
Xcase "$hostname" in
X*.*)
X    dflt=`$expr "X$hostname" : "X[^.]*\(\..*\)"`
X    hostname=`$expr "X$hostname" : "X\([^.]*\)\."`
X    echo "(Trimming domain name from host name--host name is now $hostname)"
X    ;;
X*)  case "$mydomain" in
X	'') dflt='.UUCP';;
X	*) dflt="$mydomain";;
X    esac
X    ;;
Xesac
Xrp="What is your domain name? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
X'') ;;
X.*) ;;
X*) ans=".$ans";;
Xesac
Xmydomain="$ans"
X
X: a little sanity check here
Xcase "$phostname" in
X'') ;;
X*)  case `$phostname` in
X    $hostname$mydomain|$hostname) ;;
X    *)
X	case "$phostname" in
X	sed*)
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"$undef")  dflt=n;;
X*)	   if $test "$d_nfs" = "$define" ; then
X	       dflt=y
X	   else
X	       dflt=n
X	   fi
X	   ;;
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 noticable 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 $contains '^gethostname$' libc.list >/dev/null 2>&1 ; then
X    echo "gethostname() found."
X    d_gethname="$define"
X    ans=gethostname
Xelif 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 '^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 "$ign_hname" in
X    '')	case "$d_host_comp" in
X	"$define") dflt=y;;
X	*)  dflt=n;;
X	esac;;
X    y)  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*) ign_hname=y
X	d_douname="$undef"
X	d_gethname="$undef"
X	d_host_comp="$define"
X	$echo $n "Okay... $c"
X	;;
X    *)	ign_hname=n
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	    d_host_comp="$define"
X	    d_phostname="$undef"
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 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 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"
X    d_flockonly="$undef"
Xfi
X
Xif $test "$d_flock" = "$define"; then
X    case "$d_flockonly" in
X    "$define")	dflt=y;;
X    "$undef")	dflt=n;;
X    *)		dflt=n;;
X    esac
X    $cat <<EOM
X 
XSome sites wish to use flock style locking only.  This allows Elm
Xto be installed without the setgid bit being set on some systems
Xthat would otherwise require it.
X
XNote: Be sure no other mail utility that needs to lock the mail spool
Xfile uses .lock type locking before using only flock style locking.
X
XEOM
X    rp="Would you like to use flock style mail spool locking only? [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    case "$ans" in
X    y*) d_flockonly="$define";;
X    *)  d_flockonly="$undef";;
X    esac
Xfi
X
Xif $test -d /usr/spool/locks ; then
X    lock_dir=/usr/spool/locks
Xelif $test -d /usr/spool/uucp ; then
X    lock_dir=/usr/spool/uucp
Xelif $test -d /var/spool/locks ; then
X    lock_dir=/var/spool/locks
Xelif $test -d /var/spool/uucp ; then
X    lock_dir=/var/spool/uucp
Xelse
X    lock_dir=/tmp
Xfi
Xecho " "
Xecho "Non mailbox locks will use the $lock_dir directory"
Xecho " "
X
X: see if getopt exists
Xset getopt d_getopt
Xeval $inlibc
X
X: determine pathnames of the domains and pathalias
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: 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	ans=`loc Slibdbm.a x $libpth`
X    fi
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=-ldbm
X	d_havedbm="$define"
X    fi
Xfi
X
X: see if strings.h is in /usr/include or /usr/include/sys
Xecho " "
Xstrings=`loc string.h "" /usr/include $includepath`
Xif $test -z "$strings"; then
X	strings=`loc strings.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 string.h "" /usr/include $includepath`
X		if $test -z "$strings"; then
X			strings=`loc strings.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_f=`$expr "$strings" : ".*/\(.*\)"`
Xif $test "$strings_f" = "string.h"; then
X	d_strings="$undef"
X	echo Using string.h instead of strings.h
Xelse
X	d_strings="$define"
X	echo Using strings.h instead of string.h
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: 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	if $contains strchr "$strings" >/dev/null 2>&1 ; then
X	    if $contains index "$strings" >/dev/null 2>&1 ; then
X#			has index, strchr, and index and strchr in strings.h
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#			has index, strchr, and strchr in strings.h
X		d_index="$define"
X	        echo "strchr() found."
SHAR_EOF
echo "End of  part 1"
echo "File Configure is continued in part 2"
echo "2" > shar3_seq_.tmp
exit 0