Newsgroups: comp.sources.unix
From: davison@borland.com (Wayne Davison)
Subject: v27i104: trn-3.3 - threaded newsreader based on RN, V3.3, Part11/12
References: <1.754431075.7231@gw.home.vix.com>
Sender: unix-sources-moderator@gw.home.vix.com
Approved: vixie@gw.home.vix.com

Submitted-By: davison@borland.com (Wayne Davison)
Posting-Number: Volume 27, Issue 104
Archive-Name: trn-3.3/part11

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 11 (of 12)."
# Contents:  Configure
# Wrapped by vixie@gw.home.vix.com on Sun Nov 21 01:14:10 1993
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Configure' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Configure'\"
else
echo shar: Extracting \"'Configure'\" \(94195 characters\)
sed "s/^X//" >'Configure' <<'END_OF_FILE'
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,
X# I would suggest you have a look at the prototypical config.h.SH file
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# Yes, you may rip this off to use in other distribution packages. This
X# script belongs to the public domain and cannot be copyrighted.
X#
X# (Note: this Configure script was generated automatically. Rather than
X# working with this copy of Configure, you may wish to get metaconfig.
X# Write to either:
X#
X#     harlan@mumps.pfcs.com (Harlan Stenn)
X#     ram@acri.fr (Raphael Manfredi)
X#
X# and we will send you -or point you to- the latest revision of the dist
X# package, which includes metaconfig.)
X#
X
X# $Id: Head.U,v 2.8 91/07/08 13:30:13 ram Exp Locker: ram $
X#
X# Generated on Sun Aug 15 13:19:02 PDT 1993 [metaconfig 2.9dev PL20]
X
Xcat >/tmp/c1$$ <<EOF
XARGGGHHHH!!!!!
X
XSCO csh still thinks true is false.  Write to SCO today and tell them that next
Xyear Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
X
X(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
Xwe'd have to do is go in and swap the && and || tokens, wherever they are.)
X
X[End of diatribe. We now return you to your regularly scheduled programming...]
XEOF
Xcat >/tmp/c2$$ <<EOF
X
XOOPS!  You naughty creature!  You didn't run Configure with sh!
XI will attempt to remedy the situation by running sh for you...
XEOF
X
Xtrue || cat /tmp/c1$$ /tmp/c2$$
Xtrue || exec sh $0 $argv:q
X
X(exit $?0) || cat /tmp/c2$$
X(exit $?0) || exec sh $0 $argv:q
Xrm -f /tmp/c1$$ /tmp/c2$$
X
X: Sanity checks
XPATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin"
XPATH=$PATH:'/usr/5bin:/etc:/usr/gnu/bin:/usr/new:/usr/new/bin:/usr/nbin'
XPATH=$PATH:'/sys5.3/bin:/sys5.3/usr/bin:/bsd4.3/bin:/bsd4.3/usr/ucb'
XPATH=$PATH:'/bsd4.3/usr/bin:/usr/bsd:/bsd43/bin:/usr/ccs/bin'
XPATH=$PATH:'/etc:/usr/lib:/usr/ucblib:/lib:/usr/ccs/lib'
Xexport PATH
X
Xif test ! -t 0; then
X	echo "Say 'sh Configure', not 'sh <Configure'"
X	exit 1
Xfi
X
X: On HP-UX, large Configure scripts may exercise a bug in /bin/sh
Xif test -f /hp-ux -a -x /bin/ksh >/dev/null 2>&1; then
X	if (alias -x) >/dev/null 2>&1; then
X		: already under /bin/ksh
X	else
X		cat <<'EOM'
X(Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
XEOM
X		exec /bin/ksh $0 "$@"
X	fi
Xelse
X	: Warn them if they use ksh on other systems
X	(alias -x) >/dev/null 2>&1 && \
X		cat <<'EOM'
X(I see you are using the Korn shell.  Some ksh's blow up on Configure,
Xespecially on exotic machines.  If yours does, try the Bourne shell instead.)
XEOM
Xfi
X
X: Configure runs within the UU subdirectory
Xtest -d UU || mkdir UU
Xcd UU && rm -f *
X
Xcf_by=''
Xcf_time=''
Xd_bsd=''
Xd_eunice=''
Xd_xenix=''
Xeunicefix=''
XMcc=''
Xawk=''
Xbash=''
Xbison=''
Xcat=''
Xchgrp=''
Xchmod=''
Xchown=''
Xcompress=''
Xcpp=''
Xcsh=''
Xdate=''
Xecho=''
Xegrep=''
Xemacs=''
Xexpr=''
Xflex=''
Xgcc=''
Xgrep=''
Xinews=''
Xispell=''
Xksh=''
Xless=''
Xline=''
Xlint=''
Xln=''
Xlp=''
Xlpr=''
Xls=''
Xmail=''
Xmailx=''
Xmake=''
Xmetamail=''
Xmhn=''
Xmkdir=''
Xmore=''
Xmv=''
Xnroff=''
Xperl=''
Xpg=''
Xpmake=''
Xpr=''
Xrm=''
Xrmail=''
Xsed=''
Xsendmail=''
Xsh=''
Xshar=''
Xsleep=''
Xsmail=''
Xsort=''
Xsubmit=''
Xtail=''
Xtar=''
Xtbl=''
Xtest=''
Xtouch=''
Xtr=''
Xtroff=''
Xuname=''
Xuniq=''
Xuuname=''
Xvi=''
Xzcat=''
Xhint=''
Xmyuname=''
XAuthor=''
XDate=''
XHeader=''
XId=''
XLocker=''
XLog=''
XRCSfile=''
XRevision=''
XSource=''
XState=''
Xactive=''
Xacttimes=''
Xd_acttimes=''
Xmyactive=''
Xbin=''
Xinstallbin=''
Xcc=''
Xccflags=''
Xcppflags=''
Xldflags=''
Xlkflags=''
Xoptimize=''
Xcontains=''
Xcppminus=''
Xcppstdin=''
Xd_ftime=''
Xaphostcmd=''
Xd_gethname=''
Xd_phostcmd=''
Xd_uname=''
Xd_getpwent=''
Xd_getcwd=''
Xd_getwd=''
Xd_havetlib=''
Xtermlib=''
Xd_ignoreorg=''
Xd_internet=''
Xd_memcmp=''
Xd_memcpy=''
Xd_memset=''
Xd_mime=''
Xmimeshow=''
Xmimestore=''
Xd_newsadm=''
Xnewsadmin=''
Xd_nntp=''
Xd_xdata=''
Xservername=''
Xd_nolnbuf=''
Xd_normsig=''
Xjobslib=''
Xd_hvfork=''
Xd_novfork=''
Xd_novoid=''
Xvoid=''
Xd_portable=''
Xd_rdchk=''
Xd_rename=''
Xd_sigblock=''
Xd_sighold=''
Xd_sizet=''
Xd_strcasecmp=''
Xd_strchr=''
Xd_strftime=''
Xstrftimec=''
Xstrftimeo=''
Xd_libndir=''
Xd_usendir=''
Xlibndir=''
Xndirc=''
Xndiro=''
Xd_voidsig=''
Xsignal_t=''
Xdefeditor=''
Xfilexp=''
Xd_dirnamlen=''
Xi_dirent=''
Xi_ptem=''
Xi_stdlib=''
Xi_string=''
Xstrings=''
Xi_sysdir=''
Xd_voidtty=''
Xi_bsdioctl=''
Xi_sysioctl=''
Xi_syssockio=''
Xi_sysndir=''
Xi_sgtty=''
Xi_termio=''
Xi_termios=''
Xi_systime=''
Xi_time=''
Xi_unistd=''
Xi_vfork=''
Xispell_options=''
Xispell_prg=''
Xlibc=''
Xplibpth=''
Xxlibpth=''
Xlibs=''
Xcitydist=''
Xcntrydist=''
Xcontdist=''
Xlocdist=''
Xorgdist=''
Xstatedist=''
Xmailer=''
Xmailfile=''
Xmanext=''
Xmansrc=''
Xmboxchar=''
Xc=''
Xn=''
Xd_berknames=''
Xd_passnames=''
Xd_usgnames=''
Xnametype=''
Xinewsloc=''
Xnewslib=''
Xnewslibexp=''
Xnewsspool=''
Xorgname=''
Xpackage=''
Xpager=''
Xphost=''
Xphostcmd=''
Xprefshell=''
Xinstallprivlib=''
Xprivlib=''
Xrootid=''
Xsharpbang=''
Xshsharp=''
Xspitshell=''
Xstartsh=''
Xsysman=''
Xd_usemt=''
Xd_useov=''
Xoverviewdir=''
Xthreaddir=''
Xtrn_init=''
Xtrn_select=''
Xnm_opt=''
Xrunnm=''
Xusenm=''
Xincpath=''
Xmips=''
Xmips_type=''
Xusrinc=''
Xd_whoami=''
Xi_sysfile=''
Xi_sysselct=''
Xlarge=''
XCONFIG=''
X
X: script used to extract .SH files with variable substitutions
Xcat >extract <<'EOS'
XCONFIG=true
Xecho "Doing variable substitutions on .SH files..."
Xif test -f MANIFEST; then
X	set x `awk '{print $1}' <MANIFEST | grep '\.SH'`
Xelse
X	echo "(Looking for .SH files under the current directory.)"
X	set x `find . -name "*.SH" -print`
Xfi
Xshift
Xcase $# in
X0) set x *.SH; shift;;
Xesac
Xif test ! -f $1; then
X	shift
Xfi
Xfor file in $*; do
X	case "$file" in
X	*/*)
X		dir=`expr X$file : 'X\(.*\)/'`
X		file=`expr X$file : 'X.*/\(.*\)'`
X		(cd $dir && . ./$file)
X		;;
X	*)
X		. ./$file
X		;;
X	esac
Xdone
XEOS
X
X: process the command line options
Xset X `for arg in "$@"; do echo $arg; done | awk '
XBEGIN {
X	optstr = "deEf:hrsSV";	# getopt-style specification
X
X	len = length(optstr);
X	for (i = 1; i <= len; i++) {
X		c = substr(optstr, i, 1);
X		if (i < len) a = substr(optstr, i + 1, 1); else a = "";
X		if (a == ":") {
X			arg[c] = 1;
X			i++;
X		}
X		opt[c] = 1;
X	}
X}
X{
X	expect = 0;
X	str = $0;
X	if (substr(str, 1, 1) != "-") {
X		printf("'"'%s'"'\n", str);
X		next;
X	}
X	len = length($0);
X	for (i = 2; i <= len; i++) {
X		c = substr(str, i, 1);
X		if (!opt[c]) {
X			printf("-%s\n", substr(str, i));
X			next;
X		}
X		printf("-%s\n", c);
X		if (arg[c]) {
X			if (i < len)
X				printf("'"'%s'"'\n", substr(str, i + 1));
X			else
X				expect = 1;
X			next;
X		}
X	}
X}
XEND {
X	if (expect)
X		print "?";
X}
X'`
Xeval "set $*"
Xshift
X		
X: set up default values
Xfastread=''
Xreuseval=false
Xconfig_sh=''
Xalldone=''
Xerror=''
Xsilent=''
Xextractsh=''
X
X: option parsing
Xwhile test $# -gt 0; do
X	case "$1" in
X	-d) shift; fastread=yes;;
X	-e) shift; alldone=cont;;
X	-f)
X		shift
X		cd ..
X		if test -r "$1"; then
X			config_sh="$1"
X		else
X			echo "Configure: cannot read config file $1." >&2
X			error=true
X		fi
X		cd UU
X		shift;;
X	-h) shift; error=true;;
X	-r) shift; reuseval=true;;
X	-s) shift; silent=true;;
X	-E) shift; alldone=exit;;
X	-S) shift; extractsh=true;;
X	-V) echo "Configure generated by metaconfig 2.9dev PL20." >&2
X		exit 0;;
X	--) break;;
X	-*) echo "Configure: unknown option $1" >&2; shift; error=true;;
X	*) break;;
X	esac
Xdone
X
Xcase "$error" in
Xtrue)
X	cat >&2 <<EOM
XUsage: Configure [-dehrESV] [-f config.sh]
X  -d : use defaults for all answers.
X  -e : go on without questioning past the production of config.sh.
X  -f : specify an alternate default configuration file.
X  -h : print this help message and exit (with an error status).
X  -r : reuse C symbols value if possible (skips costly nm extraction).
X  -s : silent mode, only echoes questions and essential information.
X  -E : stop at the end of questions, after having produced config.sh.
X  -S : perform variable substitutions on all .SH files (can mix with -f)
X  -V : print version number and exit (with a zero status).
XEOM
X	exit 1
X	;;
Xesac
X
Xexec 4>&1
Xcase "$silent" in
Xtrue) exec 1>/dev/null;;
Xesac
X
Xcase "$extractsh" in
Xtrue)
X	case "$config_sh" in
X	'') config_sh='config.sh'; config='./config.sh';;
X	/*) config="$config_sh";;
X	*) config="./$config_sh";;
X	esac
X	echo " "
X	echo "Fetching answers from $config_sh..."
X	cd ..
X	. $config
X	echo " "
X	. ./UU/extract
X	rm -rf UU
X	echo "Done."
X	exit 0
X	;;
Xesac
X
X: set package name
Xpackage=trn
XPackage=Trn
X
X: Eunice requires " " instead of "", can you believe it
Xecho " "
X: Here we go...
Xecho "Beginning of configuration questions for $package."
X
Xdefine='define'
Xundef='undef'
Xsmallmach='pdp11 i8086 z8000 i80286 iAPX286'
Xrmlist=''
X
Xtrap 'echo " "; rm -rf $rmlist; exit 1' 1 2 3 15
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: list of known cpp symbols
Xattrlist="__alpha DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__"
Xattrlist="$attrlist _AIX __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
Xattrlist="$attrlist hp9000s300 hp9000s400 hp9000s500 hp9000s700"
Xattrlist="$attrlist hp9000s800 hpux"
Xattrlist="$attrlist i186 i386 i486 i8086 iAPX286 ibm interdata"
Xattrlist="$attrlist m88k mc300 mc500 mc68000 mc68k mc700 mert"
Xattrlist="$attrlist mips NeXT ns16000 ns32000 nsc32000 os"
Xattrlist="$attrlist __osf__ pdp11 posix"
Xattrlist="$attrlist pyr sinix sony sparc sun tower tower32 tower32_600"
Xattrlist="$attrlist tower32_800 tss u3b2 u3b20 u3b200 u3b5 ultrix unix"
Xattrlist="$attrlist __unix__ vax venix xenix z8000"
X
X: change the next line if compiling for Xenix/286 on Xenix/386
Xxlibpth='/usr/lib/386 /lib/386'
X
X: general looking path for locating libraries
Xlibpth='/usr/lib/large /lib /lib/large /usr/lib/small /lib/small'
X
X: no include file wanted by default
Xinclwanted='/usr/include/NET-5000'
X
Xlibswanted='malloc bsd socket bsdipc sun net hdb bbn str nls nsl c_s intl x ucb'
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: first determine how to suppress newline on echo command
Xecho " "
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 "The star should be here-->$c"
Xecho '*'
Xrm -f .echotmp
X
X: Now test for existence of everything in MANIFEST
Xecho " "
Xif test -f ../MANIFEST; then
X	echo "First let's make sure your kit is complete.  Checking..." >&4
X	awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
X	rm -f missing
X	for filelist in x??; do
X		(cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
X	done
X	if test -s missing; then
X		cat missing >&4
X		cat >&4 <<'EOM'
X
XTHIS PACKAGE SEEMS TO BE INCOMPLETE.
X
XYou have the option of continuing the configuration process, despite the
Xdistinct possibility that your kit is damaged, by typing 'y'es.  If you
Xdo, don't blame me if something goes wrong.  I advise you to type 'n'o
Xand contact the author (davison@borland.com).
X
XEOM
X		echo $n "Continue? [n] $c" >&4
X		read ans
X		case "$ans" in
X		y*)
X			echo "Continuing..." >&4
X			rm -f missing
X			;;
X		*)
X			echo "ABORTING..." >&4
X			kill $$
X			;;
X		esac
X	else
X		echo "Looks good..." >&4
X	fi
Xelse
X	echo "There is no MANIFEST file.  I hope your kit is complete !"
Xfi
Xrm -f missing x??
X
X: compute the number of columns on the terminal for proper question formatting
Xcase "$COLUMNS" in
X'') COLUMNS='80';;
Xesac
X
X: set up the echo used in my read
Xmyecho="case \"\$xxxm\" in
X'') echo $n \"\$rp $c\" >&4;;
X*) case \"\$rp\" in
X	'') echo $n \"[\$xxxm] $c\";;
X	*)
X		if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
X			echo \"\$rp\" >&4
X			echo $n \"[\$xxxm] $c\" >&4
X		else
X			echo $n \"\$rp [\$xxxm] $c\" >&4
X		fi
X		;;
X	esac;;
Xesac"
X
X: now set up to do reads with possible shell escape and default assignment
Xcat <<EOSC >myread
Xxxxm=\$dflt
X$myecho
Xans='!'
Xcase "\$fastread" in
Xyes) case "\$dflt" in
X	'') ;;
X	*) ans='';
X		case "\$silent-\$rp" in
X		true-) ;;
X		*) echo " " >&4;;
X		esac;;
X	esac;;
X*) case "\$silent" in
X	true) case "\$rp" in
X		'') ans='';;
X		esac;;
X	esac;;
Xesac
Xwhile expr "X\$ans" : "X!" >/dev/null; do
X	read answ
X	set x \$xxxm
X	shift
X	aok=''; eval "ans=\"\$answ\"" && aok=y
X	case  "\$answ" in
X	"\$ans")
X		case "\$ans" in
X		"!")
X			sh 1>&4
X			echo " "
X			$myecho
X			;;
X		!*)
X			set x \`expr "X\$ans" : "X!\(.*\)\$"\`
X			shift
X			sh 1>&4 -c "\$*"
X			echo " "
X			$myecho
X			;;
X		esac;;
X	*)
X		case "\$aok" in
X		y)
X			echo "*** Substitution done -- please confirm."
X			xxxm="\$ans"
X			ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
X			xxxm="\$ans"
X			ans=!
X			;;
X		*)
X			echo "*** Error -- try again."
X			ans=!
X			;;
X		esac
X		$myecho
X		;;
X	esac
Xdone
Xcase "\$ans" in
X'') ans="\$xxxm";;
Xesac
XEOSC
X
X: see if sh knows # comments
Xecho " "
Xecho "Checking your sh to see if it knows about # comments..." >&4
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/cat" >try
X	$eunicefix try
X	chmod +x try
X	./try > today
X	if test -s today; then
X		echo "It does."
X		sharpbang='#!'
X	else
X		echo "#! /bin/cat" > 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's just a comment."
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
Xrm -f try today
X
X: figure out how to guarantee sh startup
Xecho " "
Xecho "Checking out how to guarantee sh startup..." >&4
Xcase "$SYSTYPE" in
X*bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
X*) startsh=$sharpbang'/bin/sh';;
Xesac
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
Xecho "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
Xfi
Xrm -f try
X
X: general instructions
Xcat <<EOH
X 
XThis installation shell script will examine your system and ask you questions
Xto determine how the trn package should be installed.  If you get stuck
Xon a question, you may use a ! shell escape to start a subshell or execute a
Xcommand.  Many of the questions will have default answers in square brackets;
Xtyping carriage return will give you the default.
X
XOn some of the questions which ask for file or directory names you are allowed
Xto use the ~name construct to specify the login directory belonging to "name",
Xeven if you don't have a shell which knows about that.  Questions where this is
Xallowed will be marked "(~name ok)".
X
XEOH
Xrp=''
Xdflt='Type carriage return to continue'
X. ./myread
Xcat <<'EOH'
X
XThe prompter used in this script allows you to use shell variables and
Xbackticks in your answers.  You may use $1, $2, etc...  to refer to the words
Xin the default answer, as if the default line was a set of arguments given to a
Xscript shell.  This means you may also use $* to repeat the whole default line,
Xso you do not have to re-type everything to add something to the default.
X
XEverytime there is a substitution, you will have to confirm.  If there is an
Xerror (e.g. an unmatched backtick), the default answer will remain unchanged
Xand you will be prompted again.
X
XIf you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
Xthe questions and use the computed defaults (or the previous answers if there
Xwas already a config.sh file).
X
XEOH
X. ./myread
Xcat <<EOH
X
XMuch effort has been expended to ensure that this shell script will run on any
XUnix system.  If despite that it blows up on yours, your best bet is to edit
XConfigure and run it again.  Also, let me (davison@borland.com)
Xknow how I blew it.  If you can't run Configure for some reason, you'll have to
Xgenerate a config.sh file by hand.
X
XThis installation script affects things in two ways:
X
X1) it may do direct variable substitutions on some of the files included
X   in this kit.
X2) it builds a config.h file for inclusion in C programs.  You may edit
X   any 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 SH
Xfiles.  Configure will offer to let you do this before it runs the SH files.
X
XEOH
Xdflt='Type carriage return to continue'
X. ./myread
X
X: find out where common programs are
Xecho " "
Xecho "Locating common programs..." >&4
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="
Xawk
Xcat
Xecho
Xexpr
Xgrep
Xmkdir
Xmv
Xrm
Xsed
Xsort
Xtail
Xtr
Xuniq
X"
Xtrylist="
XMcc
Xbash
Xcpp
Xcsh
Xdate
Xegrep
Xinews
Xispell
Xksh
Xless
Xmail
Xmetamail
Xmhn
Xmore
Xnroff
Xpg
Xrmail
Xsendmail
Xsmail
Xtest
Xuname
Xuuname
Xvi
X"
Xpth=`echo $PATH | sed -e 's/:/ /g'`
Xpth="$pth /lib /usr/lib"
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*)
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	;;
Xesac
Xcase "$echo" in
Xecho)
X	echo "Hopefully echo is built into your sh."
X	;;
X/bin/echo)
X	echo " "
Xecho "Checking compatibility between /bin/echo and builtin echo (if any)..." >&4
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';;
X		*) n='-n' c='';;
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		$echo $n "The star should be here-->$c"
X		$echo "*"
X	fi
X	$rm -f foo1 foo2
X	;;
X*)
X	: cross your fingers
X	echo=echo
X	;;
Xesac
X
X: Try to determine whether config.sh was made on this system
Xcase "$config_sh" in
X'')
Xmyuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
Xdflt=n
Xif test "$fastread" = yes; then
X	dflt=y
Xelif test -f ../config.sh; then
X	eval "old`grep myuname= ../config.sh`"
X	if test "X$myuname" = "X$oldmyuname"; then
X		dflt=y
X	fi
Xfi
X
X: Get old answers from old config file if Configure was run on the
X: same system, otherwise use the hints.
Xhint=default
Xcd ..
Xif test -f config.sh; then
X	echo " "
X	rp="I see a config.sh file.  Do you want to use it to set the defaults?"
X	. ./UU/myread
X	case "$ans" in
X	n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
X	*)  echo "Fetching default answers from your old config.sh file..." >&4
X		tmp="$n"
X		ans="$c"
X		. ./config.sh
X		cp config.sh UU
X		n="$tmp"
X		c="$ans"
X		hint=previous
X		;;
X	esac
Xfi
Xif test ! -f config.sh; then
X	$cat <<EOM
X
XFirst time through, eh?  I have some defaults handy for the following systems:
X
XEOM
X	cd hints; ls -C *.sh | $sed 's/\.sh/   /g' >&4
X	dflt=''
X	: Half the following guesses are probably wrong... If you have better
X	: tests or hints, please send them to davison@borland.com
X	: The metaconfig authors would also appreciate a copy...
X	$test -f /vmunix && $test -f /usr/convex/spucmd && dflt="$dflt convexos"
X	$test -f /irix && dflt="$dflt sgi"
X	$test -f /xenix && dflt="$dflt sco_xenix"
X	$test -f /dynix && dflt="$dflt dynix"
X	$test -f /bin/mips && /bin/mips && dflt="$dflt mips"
X	$test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next"
X	if $test -f $uname; then
X		set `$uname -a | tr '[A-Z]' '[a-z]'`
X
X		$test -f $5.sh && dflt="$dflt $5"
X
X		case "$5" in
X		mips*) dflt="$dflt mips";;
X		[23]100) dflt="$dflt mips";;
X		next*) dflt="$dflt next" ;;
X		esac
X
X		case "$1" in
X		aix) dflt="$dflt aix_rs" ;;
X		sunos)	case "$3" in
X			4.1*) dflt="$dflt sunos_4_1" ;;
X			esac
X			;;
X		dgux) dflt="$dflt dgux" ;;
X		hp*ux) dflt="$dflt hpux" ;;
X		next) dflt="$dflt next" ;;
X		irix) dflt="$dflt sgi" ;;
X		convexos) dflt="$dflt convexos";;
X		$2) if $test -f /usr/lib/sysadm/sysadm.menu; then
X			if $test ! -f /etc/copyrights/01.sco; then
X			    set 3 2 0
X			else
X			    set `uname -X 2>&1 | grep Release`
X			    if test "x$1" != "xRelease"; then
X				set 3 2 1
X			    else
X				set `echo $3 | sed 's/[^0-9]/ /g'`
X			    fi
X			fi
X			if $test -f sco_$1_$2_$3.sh; then
X			    dflt="$dflt sco_$1_$2_$3"
X			elif $test -f sco_$1_$2.sh; then
X			    dflt="$dflt sco_$1_$2"
X			elif $test -f sco_$1.sh; then
X			    dflt="$dflt sco_$1"
X			fi
X		    fi ;;
X		esac
X	fi
X	set X `echo $dflt | tr ' ' '\012' | sort | uniq`
X	shift
X	dflt=''
X	for file in $*; do
X		if $test -f "$file.sh"; then
X			dflt="$dflt $file"
X		fi
X	done
X	set X $dflt
X	shift
X	dflt=${1+"$@"}
X	case "$dflt" in
X	'') dflt=none;;
X	esac
X	$cat <<EOM
X
XYou may give one or more space-separated answers, or "none" if appropriate.
XIf your OS version has no hints, DO NOT give a wrong version -- say "none".
X
XEOM
X	rp="Which of these apply, if any?"
X	. ../UU/myread
X	for file in $ans; do
X		if $test -f $file.sh; then
X			. ./$file.sh
X			$cat $file.sh >> ../UU/config.sh
X		elif $test X$ans = X -o X$ans = Xnone ; then
X			:
X		else
X			echo "$file.sh does not exist -- ignored"
X		fi
X	done
X	hint=recommended
X	cd ..
Xfi
Xcd UU
X;;
X*)
X	echo " "
X	echo "Fetching default answers from $config_sh..." >&4
X	tmp="$n"
X	ans="$c"
X	cd ..
X	cp $config_sh config.sh 2>/dev/null
X	. ./config.sh
X	cd UU
X	cp ../config.sh .
X	n="$tmp"
X	c="$ans"
X	hint=previous
X	;;
Xesac
X
X: Restore computed paths
Xfor file in $loclist $trylist; do
X	eval $file="\$_$file"
Xdone
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		failed=$?
X		echo ""
X		exit \$failed
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: check if NNTP is to be used
Xcase "$d_nntp" in
X"$define") dflt="y";;
X*)	   dflt="n";;
Xesac
X$echo " "
Xrp="Do you want to access news via NNTP?"
X. ./myread
Xcase "$ans" in
Xn*)	d_nntp="$undef" d_xdata="$undef";;
Xy*)	d_nntp="$define"
X	case "$d_xdata" in
X	define) dflt="y";;
X	*)	dflt="n";;
X	esac
X	$cat <<EOM
X
X$Package allows you to use an after-market data-sending extension to NNTP
Xinstead of a locally-maintained database (XTHREAD and XOVER are both
Xcurrently supported).
XEOM
X	rp="Do you want to access a remote database via NNTP?"
X	. ./myread
X	case "$ans" in
X	y*) d_xdata="$define" ;;
X	*)  d_xdata="$undef" ;;
X	esac
X	newsspool=/tmp
X	$echo "net.foobar 00001 00001 y" > .falseactive
X
X	case "$servername" in
X	'')  dflt="no default" ;;
X	*)   dflt="$servername";;
X	esac
X
X	$cat <<EOM
X
X$Package needs to know what machine you wish to use as a news server.  You
Xcan specify a machine name directly, or a filename from which to read
Xthe name (start the name with a slash or a tilde to distinguish it).
XNote also that the environment variable NNTPSERVER can be used for
Xindividuals to override this default setting.
X
XEOM
X
X	rp="Enter a file name (~name ok) or machine name:"
X	. ./myread
X	ans=`./filexp "$ans"`
X	case "$ans" in
X	/*) if $test ! -f $ans; then
X		$echo "(You'll need to create $ans before $package will work.)"
X	    fi;;
X	esac
X	servername="$ans"
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 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?"
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: now set up to get a file name with possible "~name" substitutions
Xcat <<'EOSC' >getfile
Xtilde=''
Xfullpath=''
Xalready=''
Xskip=''
Xnone_ok=''
Xorig_rp="$rp"
Xorig_dflt="$dflt"
X
Xcase "$fn" in
X*~*) tilde=true;;
Xesac
Xcase "$fn" in
X*/*) fullpath=true;;
Xesac
Xcase "$fn" in
X*+*) skip=true;;
Xesac
Xcase "$fn" in
X*n*) none_ok=true;;
Xesac
X
Xcase "$fn" in
X*f*) type='File';;
X*d*) type='Directory';;
X*l*) type='Locate'; fn=`expr $fn : '.*:\(.*\)'`;;
Xesac
X
Xwhat="$type"
Xcase "$what" in
XLocate) what='File';;
Xesac
Xcd ..
X
Xwhile test "$type"; do
X	redo=''
X	rp="$orig_rp"
X	dflt="$orig_dflt"
X	case "$tilde" in
X	true) rp="$rp (~name ok)";;
X	esac
X	. ./UU/myread
X	case "$ans" in
X	none)
X		value=''
X		case "$none_ok" in
X		true) type='';;
X		esac
X		;;
X	*)
X		case "$tilde" in
X		'') value="$ans"
X		    testvalue="$ans";;
X		*)
X			value=`./UU/filexp $ans`
X			case $? in
X			0)
X				if test "X$ans" != "X$value"; then
X					echo "(That is $value on this particular system.)"
X				fi
X				;;
X			*) value="$ans";;
X			esac
X			testvalue="$value"
X			case "$d_portable" in
X			"$define") value="$ans";;
X			esac
X			;;
X		esac
X		case "$fullpath" in
X		true)
X			case "$testvalue" in
X			/*) ;;
X			*)
X				redo=true
X				case "$already" in
X				true)
X				echo "I shall only accept a full path name, as in /bin/ls." >&4
X				echo "Use a ! shell escape if you wish to check pathnames." >&4
X					;;
X				*)
X				echo "Please give a full path name, starting with slash." >&4
X					case "$tilde" in
X					true)
X				echo "Note that using ~name is ok provided it expands well." >&4
X						already=true
X						;;
X					esac
X				esac
X				;;
X			esac
X			;;
X		esac
X		case "$redo" in
X		'')
X			case "$type" in
X			File)
X				if test -f "$testvalue"; then
X					type=''
X				elif test -r "$testvalue" || (test -h "$testvalue") >/dev/null 2>&1
X				then
X					echo "($value is not a plain file, but that's ok.)"
X					type=''
X				fi
X				;;
X			Directory)
X				if test -d "$testvalue"; then
X					type=''
X				fi
X				;;
X			Locate)
X				if test -d "$value"; then
X					echo "(Looking for $fn in directory $value.)"
X					value="$value/$fn"
X				fi
X				if test -f "$value"; then
X					type=''
X				fi
X				;;
X			esac
X
X			case "$skip" in
X			true) type='';
X			esac
X
X			case "$type" in
X			'') ;;
X			*)
X				if test "$fastread" = yes; then
X					dflt=y
X				else
X					dflt=n
X				fi
X				rp="$what $value doesn't exist.  Use that name anyway?"
X				. ./UU/myread
X				dflt=''
X				case "$ans" in
X				y*) type='';;
X				*) echo " ";;
X				esac
X				;;
X			esac
X			;;
X		esac
X		;;
X	esac
Xdone
Xcd UU
Xans="$value"
Xrp="$orig_rp"
Xdflt="$orig_dflt"
XEOSC
X
X: figure out news library
Xcase "$d_nntp" in
Xdefine) newslib=/tmp
X	newslibexp=/tmp
X	;;
X*)	case "$newslib" in
X	'') dflt=/usr/lib/news;;
X	*)  dflt=$newslib;;
X	esac
X	$echo " "
X	fn=d~
X	rp='Where is the news library directory?'
X	. ./getfile
X	newslib="$ans"
X	newslibexp=`./filexp $newslib`
X	if $test -f $newslibexp/inews; then
X		$echo "Aha!  Inews is really in $newslibexp!" >&4
X		case "$inews" in
X		inews) : null;;
X		*) $echo "(Make sure $inews isn't an old version.)";;
X		esac
X		inews=$newslibexp/inews
X	fi
Xesac
Xcase "$inewsloc" in
X'') dflt="$inews";;
X*)  dflt="$inewsloc";;
Xesac
X$echo " "
Xfn=l:inews
Xrp='Which inews should be used for posting articles?'
X. ./getfile
Xinewsloc="$ans"
X
X: locate active file and active.times file
X$echo " "
Xcase "$d_nntp" in
Xdefine) active=none
X	myactive=.falseactive
X	: check for active.times
X	case "$acttimes" in
X	''|none) dflt="n";;
X	*)       dflt="y";;
X	esac
X	cat <<'EOM'
X
XIf your server maintains an accurate "active.times" file, trn can make use
Xof the NEWGROUPS call in NNTP to find new groups instead of using the old
Xmethod of adding all groups not listed in your .newsrc.  If you aren't sure,
Xguess and see if you get notified of the new groups as they are created.
X
XEOM
X	rp="Does your server support a reliable NEWGROUPS call?"
X	. ./myread
X	case "$ans" in
X	y*) acttimes="nntp" d_acttimes="$define";;
X	*)  acttimes='none' d_acttimes="$undef";;
X	esac
X	;;
X*)	case "$active" in
X	'') dflt=$newslib/active ;;
X	*)  dflt="$active";;
X	esac
X	fn=l~:active
X	rp='Where is the active file?'
X	. ./getfile
X	active="$ans"
X	myactive=`./filexp $active`
X	: check for active.times
X	case "$acttimes" in
X	''|nntp) dflt="${active}.times";;
X	*)       dflt="$acttimes";;
X	esac
X	$cat <<'EOM'
X
XIf your news system maintains an "active.times" file, trn can use it for a
Xfast new-group check.  If it's not around, answer "none" and the active
Xfile will be scanned for new groups when it changes size.
X
XEOM
X	fn=ln~:active.times
X	rp='The full pathname of active.times or "none"?'
X	. ./getfile
X	acttimes="$ans"
X	case "$acttimes" in
X	'') acttimes=none d_acttimes="$undef";;
X	*) d_acttimes="$define";;
X	esac
Xesac
X
X: make some quick guesses about what we are up against
Xecho " "
X$echo $n "Hmm...  $c"
X$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
Xif test `echo abc | tr a-z A-Z` = Abc ; then
X	xxx=`./loc addbib blurfl $pth`
X	if $test -f $xxx; then
X	echo "Looks kind of like a USG system with BSD features, but we'll see..."
X		echo exit 0 >bsd
X		echo exit 0 >usg
X		echo exit 1 >v7
X	else
X		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
X			echo "Looks kind of like an extended USG system, but we'll see..."
X		else
X			echo "Looks kind of like a USG system, but we'll see..."
X		fi
X		echo exit 1 >bsd
X		echo exit 0 >usg
X		echo exit 1 >v7
X	fi
X	d_bsd="$undef"
Xelif $contains SIGTSTP foo >/dev/null 2>&1 ; then
X	echo "Looks kind of like a BSD system, but we'll see..."
X	d_bsd="$define"
X	echo exit 0 >bsd
X	echo exit 1 >usg
X	echo exit 1 >v7
Xelse
X	echo "Looks kind of like a Version 7 system, but we'll see..."
X	d_bsd="$undef"
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: it so happens the Eunice I know will not run shell scripts in Unix format
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
X	d_xenix="$define"
Xelse
X	echo " "
X	echo "It's not Xenix..."
X	echo "exit 1" >xenix
X	d_xenix="$undef"
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
X$rm -f foo
X
X: find out how to find out full name
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
X$cat <<'EOM'
X
XDoes your /etc/passwd file keep full names in Berkeley/V7 format (name first
Xthing after ':' in GCOS field)?  In that case, a typical entry in the password
Xfile looks like this:
X
X    guest:**paswword**:10:100:Mister Guest User:/usr/users:/bin/sh
X                              ^^^^^^^^^^^^^^^^^
XEOM
Xrp="Berkeley/V7 format for full name in /etc/password?"
X. ./myread
Xcase "$ans" in
Xy*) d_passnames="$define"
X	d_berknames="$define"
X	d_usgnames="$undef"
X	nametype=bsd
X	;;
X*)
X	case "$d_usgnames" in
X	"$define") dflt=y;;
X	"$undef") dflt=n;;
X	*)
X		if usg; then
X			dflt=y
X		else
X			dflt=n
X		fi
X		;;
X	esac
X$cat <<'EOM'
X
XDoes your passwd file keep full names in USG format (name sandwiched between a
X'-' and a '(')?  In that case, a typical entry in the password file looks like
Xthis:
X
X    guest:**paswword**:10:100:000-Mister Guest User(000):/usr/users:/bin/sh
X                                  ^^^^^^^^^^^^^^^^^
XEOM
X	rp="USG format for full name in /etc/passwd?"
X	. ./myread
X	case "$ans" in
X	n*) 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;;
Xesac
X
X: determine where manual pages are on this system
Xecho " "
Xcase "$sysman" in
X'') sysman=`./loc . /local/man/man1 /usr/man/man1 /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/share/man/man1 /usr/catman/u_man/man1 /usr/man/l_man/man1 /usr/local/man/u_man/man1 /usr/local/man/l_man/man1 /usr/man/man.L1 /usr/man/man.L`
X	;;
Xesac
Xif $test -d "$sysman"; then
X	echo "System manual is in $sysman." >&4
Xelse
X	echo "Could not find manual pages in source form." >&4
Xfi
X
X: see if we need a special compiler
Xecho " "
Xif usg; then
X	case "$cc" in
X	'') case "$Mcc" in
X		/*) dflt='Mcc';;
X		*) case "$large" in
X			-M*) dflt='cc';;
X			*)	if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
X					if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
X						dflt='cc'
X					else
X						dflt='cc -M'
X					fi
X				else
X					dflt='cc'
X				fi;;
X			esac;;
X		esac;;
X	*)  dflt="$cc";;
X	esac
X	$cat <<'EOM'
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 "Mcc"
Xcommand may be used to force these to be resolved.  On other systems a "cc -M"
Xcommand is required.  (Note that the -M flag on other systems indicates a
Xmemory model to use!) If you have the Gnu C compiler, you might wish to use
Xthat instead.
X
XEOM
X	rp="What command will force resolution on this system?"
X	. ./myread
X	cc="$ans"
Xelse
X	case "$cc" in
X	'') dflt=cc;;
X	*) dflt="$cc";;
X	esac
X	rp="Use which C compiler?"
X	. ./myread
X	cc="$ans"
Xfi
Xcase "$cc" in
Xgcc*) cpp=`./loc gcc-cpp $cpp $pth`;;
Xesac
X
X: What should the include directory be ?
Xecho " "
X$echo $n "Hmm...  $c"
Xcase "$usrinc" in
X'') dflt='/usr/include';;
X*) dflt=$usrinc;;
Xesac
Xincpath=''
Xmips_type=''
Xif $test -f /bin/mips && /bin/mips; then
X	echo "Looks like a MIPS system..."
X	$cat >usr.c <<'EOCP'
X#ifdef SYSTYPE_BSD43
X/bsd43
X#endif
XEOCP
X	if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
X		dflt='/bsd43/usr/include'
X		incpath='/bsd43'
X		mips_type='BSD 4.3'
X	else
X		mips_type='System V'
X	fi
X	$rm -f usr.c usr.out
X	echo "and you're compiling with the $mips_type compiler and libraries."
Xelse
X	echo "Doesn't look like a MIPS system."
X	echo "exit 1" >mips
X	chmod +x mips
X	$eunicefix mips
Xfi
Xecho " "
Xfn=d/
Xrp='Where are the include files you want to use?'
X. ./getfile
Xusrinc="$ans"
X
X: Set private lib path
Xcase "$plibpth" in
X'') if mips; then
X		plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
X	else
X		plibpth="/usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib"
X	fi;;
Xesac
Xlibpth="$plibpth $libpth"
X
X: Looking for optional libraries
Xecho " "
Xecho "Checking for optional libraries..." >&4
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	yyy="$incpath/usr/ccs/lib $incpath/usr/lib $incpath/usr/ucblib"
X	yyy="$yyy $incpath/usr/local/lib $incpath/lib"
X	xxx=`./loc lib$thislib.a X $yyy`
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 "$libs" in
X'') dflt="$dflt";;
X*) dflt="$libs";;
Xesac
Xcase "$dflt" in
X' '|'') dflt='none';;
Xesac
X
X$cat <<EOM
X 
XSome versions of Unix support shared libraries, which make executables smaller
Xbut make load time slightly longer.
X
XOn some systems, mostly newer Unix System V's, the shared library is included
Xby putting the option "-lc_s" as the last thing on the cc command line when
Xlinking.  Other systems use shared libraries by default.  There may be other
Xlibraries needed to compile $package on your machine as well.  If your system
Xneeds the "-lc_s" option, include it here.  Include any other special libraries
Xhere as well.  Say "none" for none.
XEOM
X
Xecho " "
Xrp="Any additional libraries?"
X. ./myread
Xcase "$ans" in
Xnone) ans=' ';
Xesac
Xlibs="$ans"
X
Xusenm=true
Xrunnm=$usenm
Xcase "$reuseval" in
Xtrue) runnm=false;;
Xesac
X
X: nm options which may be necessary
Xcase "$nm_opt" in
X'') if $test -f /mach_boot; then
X		nm_opt=''
X	elif $test -d /usr/ccs/lib; then
X		nm_opt='-p'
X	elif $test -f /dgux; then
X		nm_opt='-p'
X	else
X		nm_opt=''
X	fi;;
Xesac
X
Xcase "$runnm" in
Xtrue)
X: get list of predefined functions in a handy place
Xecho " "
Xcase "$libc" in
X'') libc=unknown
X	case "$libs" in
X	*-lc_s*) libc=`./loc libc_s.a $libc $libpth`
X	esac
X	;;
Xesac
Xlibpth="$plibpth $libpth"
Xlibnames='';
Xcase "$libs" in
X'') ;;
X*)  for thislib in $libs; do
X	case "$thislib" in
X	-l*)
X		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
Xcase "$libc" in
Xunknown)
X	set /usr/ccs/lib/libc.so
X	$test -r $1 || set /usr/lib/libc.so
X	$test -r $1 || set /usr/lib/libc.so.[0-9]*
X	$test -r $1 || set /lib/libsys_s.a
X	eval set \$$#
X	;;
X*)
X	set blurfl
X	;;
Xesac
Xapollo='false'
Xif $test -r "$1"; then
X	echo "Your (shared) C library seems to be in $1."
X	libc="$1"
Xelif $test -r /lib/libc && $test -r /lib/clib; then
X	echo "Your C library seems to be in both /lib/clib and /lib/libc."
X	libc='/lib/clib /lib/libc'
X	if $test -r /lib/syslib; then
X		echo "(Your math library is in /lib/syslib.)"
X		libc="$libc /lib/syslib"
X	fi
X	apollo='true'
Xelif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
X	echo "Your C library seems to be in $libc, as you said before."
Xelif $test -r $incpath/usr/lib/libc.a; then
X	libc=$incpath/usr/lib/libc.a;
X	echo "Your C library seems to be in $libc.  That's fine."
Xelif $test -r /lib/libc.a; then
X	libc=/lib/libc.a;
X	echo "Your C library seems to be in $libc.  You're normal."
Xelse
X	if ans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$ans"; then
X		:
X	elif ans=`./loc libc blurfl/dyick $libpth`; $test -r "$ans"; then
X		libnames="$libnames "`./loc clib blurfl/dyick $libpth`
X	elif ans=`./loc clib blurfl/dyick $libpth`; $test -r "$ans"; then
X		:
X	elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$ans"; then
X		:
X	elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$ans"; then
X		:
X	else
X		ans=`./loc Llibc.a blurfl/dyick $xlibpth`
X	fi
X	if $test -r "$ans"; then
X		echo "Your C library seems to be in $ans, of all places."
X		libc=$ans
X	else
X		libc='blurfl'
X	fi
Xfi
Xif $test "$apollo" = 'false'; then
X	if $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
X		dflt="$libc"
X		cat <<EOM
X
XIf the guess above is wrong (which it might be if you're using a strange
Xcompiler, or your machine supports multiple models), you can override it here.
X
XEOM
X	else
X		dflt=''
X		echo $libpth | tr ' ' '\012' | sort | uniq > libpath
X		cat >&4 <<EOM
XI can't seem to find your C library.  I've looked in the following places:
X
XEOM
X		$sed 's/^/	/' libpath
X		cat <<EOM
X
XNone of these seems to contain your C library. I need to get its name...
X
XEOM
X	fi
X	fn=f
X	rp='Where is your C library?'
X	. ./getfile
X	libc="$ans"
Xfi
X
Xecho " "
Xecho $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
Xset X `cat libnames`
Xshift
Xxxx=files
Xcase $# in 1) xxx=file; esac
Xecho "Extracting names from the following $xxx for later perusal:" >&4
Xecho " "
X$sed 's/^/	/' libnames >&4
Xecho " "
X$echo $n "This may take a while...$c" >&4
X
Xnm $nm_opt $* 2>/dev/null >libc.tmp
X$echo $n ".$c"
X$grep fprintf libc.tmp > libc.ptf
Xxscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
Xxrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
Xif com="$sed -n -e 's/^.* [ADTS]  *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
X	eval $xscan;\
X	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
X		eval $xrun
Xelif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
X	eval $xscan;\
X	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
X		eval $xrun
Xelif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
X	eval $xscan;\
X	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
X		eval $xrun
Xelif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
X	eval $xscan;\
X	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
X		eval $xrun
Xelif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
X	eval $xscan;\
X	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
X		eval $xrun
Xelif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
X	eval $xscan;\
X	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
X		eval $xrun
Xelif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
X				-e '/ file/d' -e 's/^\([^ 	]*\).*/\1/p'";\
X	eval $xscan;\
X	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
X		eval $xrun
Xelif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
X	eval $xscan;\
X	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
X		eval $xrun
Xelif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
X	eval $xscan;\
X	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
X		eval $xrun
Xelse
X	nm -p $* 2>/dev/null >libc.tmp
X	com="$sed -n -e 's/^.* [ADTS]  *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
X	eval "<libc.tmp $com >libc.list"
X	if $contains '^fprintf$' libc.list >/dev/null 2>&1; then
X		nm_opt='-p'
X		echo "done" >&4
X	else
X		echo " "
X		echo "nm didn't seem to work right. Trying ar instead..." >&4
X		com=''
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." >&4
X		else
X			echo "ar didn't seem to work right." >&4
X			echo "Maybe this is a Cray...trying bld instead..." >&4
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." >&4
X			else
X				echo "That didn't work either.  Giving up." >&4
X				exit 1
X			fi
X		fi
X	fi
Xfi
Xnm_extract="$com"
Xif $test -f /lib/syscalls.exp; then
X	echo " "
X	echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
X	$sed -n 's/^\([^ 	]*\)[ 	]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
Xfi
X;;
Xesac
X$rm -f libnames libpath
X
X: determine optimize, if desired, or use for debug flag also
Xcase "$optimize" in
X' ') dflt="none";;
X'') dflt="-O";;
X*) dflt="$optimize";;
Xesac
X$cat <<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 want
Xto use the symbolic debugger, which uses the -g flag (on traditional Unix
Xsystems).  Either flag can be specified here.  To use neither flag, specify
Xthe word "none".
X
XEOH
Xrp="What optimizer/debugger flag should be used?"
X. ./myread
Xoptimize="$ans"
Xcase "$optimize" in
X'none') optimize=" ";;
Xesac
X
Xcase "$ccflags" in
X'')	case "$optimize" in
X	*-g*) dflt="-DDEBUG";;
X	*)    dflt='';;
X	esac
X	case "$cc" in
X	*gcc*)	if test -d /etc/conf/kconfig.d &&
X		  $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
X		then
X			dflt="$dflt -posix"
X		fi
X		;;
X	esac
X	;;
X*) dflt="$ccflags" ;;
Xesac
X
Xcase "$mips_type" in
X*BSD*) ;;
X'') ;;
X*) inclwanted="$inclwanted $usrinc/bsd";;
Xesac
Xfor thisincl in $inclwanted; do
X	if $test -d $thisincl; then
X		if $test x$thisincl != x$usrinc; then
X			case "$dflt" in
X			*$thisincl*);;
X			*) dflt="$dflt -I$thisincl";;
X			esac
X		fi
X	fi
Xdone
X
Xinctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
X	xxx=true;
Xelif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
X	xxx=true;
Xelse
X	xxx=false;
Xfi;
Xif $xxx; then
X	case "$dflt" in
X	*$2*);;
X	*) dflt="$dflt -D$2";;
X	esac;
Xfi'
X
Xset signal.h LANGUAGE_C; eval $inctest
Xset signal.h NO_PROTOTYPE; eval $inctest
Xset signal.h _NO_PROTO; eval $inctest
X
Xcase "$dflt" in
X'') dflt=none;;
Xesac
X$cat <<EOH
X
XYour C compiler may want other flags.  For this question you should include
X-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
Xbut you should NOT include libraries or ld flags like -lwhatever.  If you
Xwant $package to honor its debug switch, you should include -DDEBUG here.
XTo use no flags, specify the word "none".
X
XEOH
Xset X $dflt
Xshift
Xdflt=${1+"$@"}
Xrp="Any additional cc flags?"
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 "$mips_type" in
X'');;
X*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
Xesac
Xcase "$cppflags" in
X'');;
X*)  set X $cppflags
X	cppflags=''
X	for flag
X	do
X		case $flag in
X		-D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
X		esac
X	done
X	;;
Xesac
X
X: flags used in final linking phase
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)?"
X. ./myread
Xcase "$ans" in
Xnone) ans='';
Xesac
Xldflags="$ans"
Xrmlist="$rmlist pdp11"
X
X: is a C symbol defined?
Xcsym='tlook=$1;
Xcase "$3" in
X-v) tf=libc.tmp; tc=""; tdc="";;
X-a) tf=libc.tmp; tc="[0]"; tdc=[];;
X*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
Xesac;
Xtx=yes;
Xcase "$reuseval-$4" in
Xtrue-) ;;
Xtrue-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
Xesac;
Xcase "$tx" in
Xyes)
X	case "$runnm" in
X	true)
X		if $contains $tlook $tf >/dev/null 2>&1;
X		then tval=true;
X		else tval=false;
X		fi;;
X	*)
X		echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c;
X		if $cc $ccflags -o t t.c $libs >/dev/null 2>&1;
X		then tval=true;
X		else tval=false;
X		fi;
X		$rm -f t t.c;;
X	esac;;
X*)
X	case "$tval" in
X	$define) tval=true;;
X	*) tval=false;;
X	esac;;
Xesac;
Xeval "$2=$tval"'
X
X: set up the script used to warn in case of inconsistency
Xcat <<'EOSC' >whoa
Xdflt=y
Xecho " "
Xecho "*** WHOA THERE!!! ***" >&4
Xecho "    The $hint value for \$$var on this machine was \"$was\"!" >&4
Xrp="    Keep the $hint value?"
X. ./myread
Xcase "$ans" in
Xy) td=$was; tu=$was;;
Xesac
XEOSC
X
X: define an is-in-libc? function
Xinlibc='echo " "; td=$define; tu=$undef;
Xsym=$1; var=$2; eval "was=\$$2";
Xtx=yes;
Xcase "$reuseval$was" in
Xtrue) ;;
Xtrue*) tx=no;;
Xesac;
Xcase "$tx" in
Xyes)
X	set $sym tres -f;
X	eval $csym;
X	case "$tres" in
X	true)
X		echo "$sym() found." >&4;
X		case "$was" in $undef) . whoa; esac; eval "$var=\$td";;
X	*)
X		echo "$sym() NOT found." >&4;
X		case "$was" in $define) . whoa; esac; eval "$var=\$tu";;
X	esac;;
X*)
X	case "$was" in
X	$define) echo "$sym() found." >&4;;
X	*) echo "$sym() NOT found." >&4;;
X	esac;;
Xesac'
X
X: function used to set $1 to $val
Xsetvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
Xcase "$val$was" in
X$define$undef) . whoa; eval "$var=\$td";;
X$undef$define) . whoa; eval "$var=\$tu";;
X*) eval "$var=$val";;
Xesac'
X
X: see if ftime exists
Xset ftime d_ftime 
Xeval $inlibc
X
X: see if getwd or getcwd exists
Xset getwd d_getwd; eval $inlibc
Xcase "$d_getwd" in
X$define) val=$undef; set d_getcwd; eval $setvar ;;
X*) set getcwd d_getcwd; eval $inlibc ;;
Xesac
X
X: now get the host name that appears in news articles
X$echo " "
X$echo "Figuring out local host name..."
Xcont=true
X$echo 'Maybe "hostname" will work...'
Xif ans=`sh -c hostname 2>&1` ; then
X	thishost=$ans
X	phostcmd=hostname
X	cont=''
Xfi
Xif $test "$cont"; then
X	if xenix; then
X		$echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
X		if ans=`cat /etc/systemid 2>&1` ; then
X			thishost=$ans
X			phostcmd='cat /etc/systemid'
X			$echo "Whadyaknow.  Xenix always was a bit strange..."
X			cont=''
X		fi
X	elif $test -r /etc/systemid; then
X		$echo "(What is a non-Xenix system doing with /etc/systemid?)"
X	fi
Xfi
Xif $test "$cont"; then
X	$echo 'No, maybe "uuname -l" will work...'
X	if ans=`sh -c 'uuname -l' 2>&1` ; then
X		thishost=$ans
X		phostcmd='uuname -l'
X	else
X		$echo 'Strange.  Maybe "uname -n" will work...'
X		if ans=`sh -c 'uname -n' 2>&1` ; then
X			thishost=$ans
X			phostcmd='uname -n'
X		else
X			$echo 'Oh well, maybe I can mine it out of whoami.h...'
X			if ans=`sh -c $contains' sysname $usrinclude/whoami.h' 2>&1` ; then
X				thishost=`$echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
X				phostcmd="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinclude/whoami.h"
X			else
X				phostcmd=''
X				case "$phost" in
X				'') $echo "Does this machine have an identity crisis or something?" ;;
X				*)  $echo "Well, you said $phost before..."
X				    thishost=$phost
X				    ;;
X				esac
X			fi
X		fi
X	fi
Xfi
X: you do not want to know about this
Xset $thishost
Xthishost=$1
X
X: translate upper to lower if necessary
Xcase "$thishost" in
X*[A-Z]*) thishost=`$echo $thishost | tr '[A-Z]' '[a-z]'`
X	 ;;
Xesac
Xcase "$phost" in
X'')	dflt="$thishost"
X	case "$dflt" in
X	*.*) ;;
X	*) dflt="$dflt.UUCP";;
X	esac
X	;;
X*) dflt="$phost";;
Xesac
Xcase "$thishost" in
X*.*)	thishost=`$expr "X$thishost" : "X\([^.]*\)\."`;;
Xesac
X$cat <<EOM
X
XTrn wants to know what hostname your news software (usually inews) puts
Xinto the "From" line of news articles posted from this machine.  If you
Xget this wrong the ownership checks done for Cancel, Supersede and
Xauto-post-selection (the -p option) will fail to recognize articles as
Xbelonging to the poster.
X
X(NOTE: trn does NOT create "From" lines when posting news or sending mail
Xas this is the job of your news/mail software, not trn.)
X
XIf you enter a filename here (by starting the name with '/' or '~') trn
Xwill read the hostname from a file, otherwise specify as much of the
Xhostname as you want to be matched in the aforementioned comparisons.
XIf your response contains the current machine's name ($thishost) trn
Xwill determine that portion at run-time.
X
XEOM
Xrp="What hostname appears in the From line of this machine's postings?"
X. ./myread
Xans=`./filexp "$ans"`
Xcase $ans in
X/*)
X    $echo "Trn will read the host name from $ans."
X    if $test ! -f $ans ; then
X	$echo "(You'll need to create $ans before trn will work.)"
X    fi
X    phost="$ans"
X    phostcmd=''
X    ;;
X$thishost.*)
X    phost="$ans"
X    $echo "Using a dynamic host name."
X    ;;
X*)
X    phost="$ans"
X    phostcmd=''
X    $echo "Using a static host name."
X    ;;
Xesac
X
X: see how we will look up host name
Xecho " "
Xif $test "X$phostcmd" = "X"; then
X	: host name is static or a file
X	d_gethname=''
X	d_uname=''
Xelif set gethostname val -f d_gethname; eval $csym; $val; then
X	echo 'gethostname() found.' >&4
X	d_gethname="$define"
X	ans=gethostname
Xelif set uname val -f d_uname; eval $csym; $val; then
X	if xenix; then
X		$cat <<'EOM'
Xuname() was found, but you're running xenix, and older versions of xenix
Xhave a broken uname(). If you don't really know whether your xenix is old
Xenough to have a broken system call, use the default answer.
X
XEOM
X		dflt=y
X		case "$d_uname" in
X		"$define") dflt=n;;
X		esac
X		rp='Is your uname() broken?'
X		. ./myread
X		case "$ans" in
X		n*) d_uname="$define"; ans=uname;;
X		esac
X	else
X		echo 'uname() found.' >&4
X		d_uname="$define"
X		ans=uname
X	fi
Xfi
Xcase "$d_gethname" in
X'') d_gethname="$undef";;
Xesac
Xcase "$d_uname" in
X'') d_uname="$undef";;
Xesac
Xcase "$phostcmd" in
X'') aphostcmd='';;
X*) case "$aphostcmd" in
X	/*) ;;
X	*) set X $phostcmd
X		shift
X		file=$1
X		shift
X		file=`loc $file $file $pth`
X		aphostcmd=`echo $file $*`
X		;;
X	esac
X	;;
Xesac
Xcase "$d_uname$d_gethname" in
X*define*) ;;
X*)
X	case "$phostcmd" 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 the hostname in postings ($phost) compiled into trn, which
X    lets trn start up faster, but makes your binaries non-portable, or
X2)  you can have trn use a
X	
X	popen("$aphostcmd","r")
X
X    which will start slower but be more portable.
X
XIf you want option 2 but with a different command, you can edit config.sh at
Xthe end of this shell script.
X
XEOT
X		case "$d_phostcmd" 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		esac
X		rp="Do you want your host name compiled in?"
X		. ./myread
X		case "$ans" in
X		n*) ;;
X		*) aphostcmd='';;
X		esac;;
X	esac;;
Xesac
Xcase "$aphostcmd" in
X'') d_phostcmd="$undef";;
X*) d_phostcmd="$define";;
Xesac
X
X: see if there is a getpwent
Xecho " "
Xif set getpwent val -f d_getpwent; eval $csym; $val; then
X	echo "getpwent() found." >&4
X	val="$define"
Xelse
X	echo "No getpwent() found -- will use getpw() instead." >&4
X	val="$undef"
Xfi
Xset d_getpwent
Xeval $setvar
X
X: where do we get termlib routines from
Xecho " "
Xans=`./loc libcurses.a x $libpth`
Xcase "$ans" in
X/*)
X	ar t $ans >grimble
X	if $contains tputs.o grimble >/dev/null 2>&1; then
X		termlib='-lcurses'
X		d_havetlib="$define"
X		echo "Terminfo library found." >&4
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	case "$ans" in
X	/usr/lib*|/lib*)
X		termlib='-ltermlib'
X		d_havetlib="$define"
X		echo "Termlib library found." >&4
X		;;
X	/*)
X		termlib="$ans"
X		d_havetlib="$define"
X		echo "Termlib library found." >&4
X		;;
X	*)
X		ans=`./loc libtermcap.a x $libpth`
X		case "$ans" in
X		/usr/lib*|/lib*)
X			termlib='-ltermcap'
X			d_havetlib="$define"
X			echo "Termcap library found." >&4
X			;;
X		/*)
X			termlib="$ans"
X			d_havetlib="$define"
X			echo "Termcap library found." >&4
X			;;
X		*)
X			case "$termlib" in
X			'')
X				dflt=y
Xrp="Your system appears to NOT have termlib-style routines. Is this true?"
X				. ./myread
X				case "$ans" in
X				n*|f*) d_havetlib="$define"
X					$cat <<'EOM'
XThen where are the termlib-style routines kept? Specify either -llibname
Xor a full pathname (~name ok).
X
XEOM
X					dflt=''
X					rp='Specify termlib path:'
X					. ./myread
X					termlib=`./filexp $ans`
X					;;
X				*)
X					d_havetlib="$undef"
X					termlib=''
X					echo "You will have to play around with term.c then." >&4
X					;;
X				esac
X			echo " ";;
X			*)  echo "You said termlib was $termlib before." >&4;;
X			esac;;
X		esac;;
X	esac;;
Xesac
X
X: Decide whether to ignore the ORGANIZATION environment variable
Xcase "$d_ignoreorg" in
X"$define") dflt=y ;;
X*)         dflt=n ;;
Xesac
Xcat <<EOM
X
X$Package normally looks in the environment variables NEWSORG and ORGANIZATION
Xfor an overriding organization name.  However, if your operating system
Xreserves the environment variable ORGANIZATION for other purposes, you
Xwill want to ignore it and only have $package check for NEWSORG.
X
XEOM
Xrp='Should ORGANIZATION be ignored?'
X. ./myread
Xcase "$ans" in
Xy*) d_ignoreorg="$define" ;;
X*)  d_ignoreorg="$undef" ;;
Xesac
X
X: determine the name of a reasonable mailer
Xcase "$mailer" in
X'')
X	if $test -f "$sendmail"; then
X		dflt="$sendmail"
X	elif $test -f "$smail"; then
X		dflt="$smail"
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
X$cat <<EOM
X
XI need the full pathname of the program used to deliver mail on your system.
XA typical answer would be /usr/lib/sendmail or /bin/rmail, but you may choose
Xany other program, as long as $package can feed its standard input and it
Xwill honour any user-supplied headers.
X
XEOM
Xfn=f
Xrp='Mail transport agent to be used?'
X. ./getfile
Xmailer="$ans"
X
X: check for internet mailer
Xcase "$d_internet" in
X"$undef") dflt=n;;
X*)	  dflt=y;;
Xesac
Xcat <<EOM
X 
XMost mailers can deliver mail to addresses of the INTERNET persuasion,
Xsuch as user@host.edu.  Some older mailers, however, require the complete
Xpath to the destination to be specified in the address.
X
XEOM
Xrp="Does your mailer understand INTERNET addresses?"
X. ./myread
Xcase "$ans" in
Xy*) val="$define";;
X*)  val="$undef";;
Xesac
Xset d_internet
Xeval $setvar
X
X: see how we invoke the C preprocessor
Xecho " "
Xecho "Now, how can we feed standard input to your C preprocessor..." >&4
Xcat <<'EOT' >testcpp.c
X#define ABC abc
X#define XYZ xyz
XABC.XYZ
XEOT
Xcd ..
Xecho 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
Xchmod 755 cppstdin
Xwrapper=`pwd`/cppstdin
Xcd UU
Xif $test "X$cppstdin" != "X" && \
X	$cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
X	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X	echo "You used to use $cppstdin $cppminus so we'll use that again."
Xelif $test "$cc" = gcc && \
X	(echo "Using gcc, eh?  We'll try to force gcc -E using a wrapper..."; \
X	$wrapper <testcpp.c >testcpp.out 2>&1; \
X	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
X	echo "Yup, we can."
X	cppstdin="$wrapper"
X	cppminus='';
Xelif echo 'Maybe "'"$cc"' -E" will work...'; \
X	$cc -E <testcpp.c >testcpp.out 2>&1; \
X	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X	echo "Yup, it does."
X	cppstdin="$cc -E"
X	cppminus='';
Xelif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
X	$cc -E - <testcpp.c >testcpp.out 2>&1; \
X	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X	echo "Yup, it does."
X	cppstdin="$cc -E"
X	cppminus='-';
Xelif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
X	$wrapper <testcpp.c >testcpp.out 2>&1; \
X	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X	cppstdin="$wrapper"
X	cppminus=''
X	echo "Eureka!"
Xelif echo 'No such luck, maybe "'$cpp'" will work...'; \
X	$cpp <testcpp.c >testcpp.out 2>&1; \
X	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X	echo "It works!"
X	cppstdin="$cpp"
X	cppminus='';
Xelif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
X	$cpp - <testcpp.c >testcpp.out 2>&1; \
X	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X	echo "Hooray, it works!  I was beginning to wonder."
X	cppstdin="$cpp"
X	cppminus='-';
Xelif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
X	$cc -P <testcpp.c >testcpp.out 2>&1; \
X	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X	echo "Yipee, that works!"
X	cppstdin="$cc -P"
X	cppminus='';
Xelif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
X	$cc -P - <testcpp.c >testcpp.out 2>&1; \
X	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X	echo "At long last!"
X	cppstdin="$cc -P"
X	cppminus='-';
Xelse
X	dflt=''
X	rp="No dice.  I can't find a C preprocessor.  Name one:"
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." >&4
X	else
Xecho "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
X		exit 1
X	fi
Xfi
X$rm -f testcpp.c testcpp.out
X
X: determine filename position in cpp output
Xecho " "
Xecho "Computing filename position in cpp output for #include directives..." >&4
Xecho '#include <stdio.h>' > foo.c
X$cat >fieldn <<EOF
X$startsh
X$cppstdin $cppminus $cppflags <foo.c 2>/dev/null | \
X$grep '^[ 	]*#.*stdio\.h' | \
Xwhile read cline; do
X	pos=1
X	set \$cline
X	while $test \$# -gt 0; do
X		if $test -r \`echo \$1 | $tr -d '"'\`; then
X			echo "\$pos"
X			exit 0
X		fi
X		shift
X		pos=\`expr \$pos + 1\`
X	done
Xdone
XEOF
Xchmod +x fieldn
Xfieldn=`./fieldn`
X$rm -f foo.c fieldn
Xcase $fieldn in
X'') pos='???';;
X1) pos=first;;
X2) pos=second;;
X3) pos=third;;
X*) pos="${fieldn}th";;
Xesac
Xecho "Your cpp writes the filename in the $pos field of the line."
X
X: locate header file
X$cat >findhdr <<EOF
X$startsh
Xwanted=\$1
Xname=''
Xif test -f $usrinc/\$wanted; then
X	echo "$usrinc/\$wanted"
X	exit 0
Xfi
Xawkprg='{ print \$$fieldn }'
Xecho "#include <\$wanted>" > foo\$\$.c
X$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
X$grep "^[ 	]*#.*\$wanted" | \
Xwhile read cline; do
X	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
X	case "\$name" in
X	*/\$wanted) echo "\$name"; exit 0;;
X	*) name='';;
X	esac;
Xdone;
X$rm -f foo\$\$.c;
Xcase "\$name" in
X'') exit 1;;
Xesac
XEOF
Xchmod +x findhdr
X
X: see if there are directory access routines out there
Xecho " "
Xif $test `./findhdr ndir.h` && \
X	  ( $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a ); then
X	echo "Ndir library found." >&4
X	if $test -r /usr/lib/libndir.a; then
X		libndir='-lndir'
X	else
X		libndir="/usr/local/lib/libndir.a"
X	fi
X	d_libndir="$define"
X	d_usendir="$undef"
X	ndirc=''
X	ndiro=''
Xelse
X	libndir=''
X	d_libndir="$undef"
X	if set readdir val -f; eval $csym; $val; then
X	echo "No ndir library found, but you have readdir() so we'll use that." >&4
X		d_usendir="$undef"
X		ndirc=''
X		ndiro=''
X	else
X		echo "No ndir library found--using ./ndir.c." >&4
X		d_usendir="$define"
X		ndirc='ndir.c'
X		ndiro='ndir.o'
X	fi
Xfi
X
X: see if memcmp exists
Xset memcmp d_memcmp
Xeval $inlibc
X
X: see if memcpy exists
Xset memcpy d_memcpy
Xeval $inlibc
X
X: see if memset exists
Xset memset d_memset
Xeval $inlibc
X
X: see if they want mime support
Xcase "$d_mime" in
X'')	if $test "$metamail$mhn" != metamailmhn; then
X	    dflt=y
X	else
X	    dflt=n
X	fi
X	;;
X"$define") dflt=y;;
X*)	dflt=n;;
Xesac
X$cat <<EOM
X
X$Package is able to use an external mime-processing program such as metamail
Xor mhn to display and store non-text mime articles.  If you don't have any
Xmime-processing programs installed at the moment answer no (you can come
Xback and Configure it in later).
X
XEOM
Xrp="Do you want to include mime support?"
X. ./myread
Xcase "$ans" in
Xy*)	case "$mimeshow" in
X	'')	if $test "$metamail" != metamail; then
X		    dflt="$metamail -e -p -m 'trn %s' %A"
X		else
X		    dflt="$mhn -show -serialonly %A"
X		fi
X		;;
X	*)	dflt="$mimeshow";;
X	esac
X	rp="What command should be used for showing an article?"
X	. ./myread
X	mimeshow="$ans"
X	case "$mimestore" in
X	'')	dflt="$mhn -store -auto -file";;
X	*)	dflt="$mimestore";;
X	esac
X	rp="What command should be used for storing an article?"
X	. ./myread
X	mimestore="$ans"
X	d_mime="$define"
X	;;
X*)	d_mime="$undef";;
Xesac
X
X: get news administrator name
Xcase "$newsadmin" in
X'')
X	if $contains "^news:" /etc/passwd >/dev/null 2>&1 ; then
X		dflt=news
X	elif $contains "^usenet:" /etc/passwd >/dev/null 2>&1 ; then
X		dflt=usenet
X	elif eunice; then
X		dflt=system
X	else
X		dflt=root
X	fi
X	;;
X*)
X	dflt="$newsadmin"
X	;;
Xesac
X$cat <<'EOM'
X 
XMany systems keep their news in a private directory, or have a non-superuser
Xin charge of administering news.  (If you don't have such a user, take the
Xdefault answer.)  I need the login name (not directory) which is used for
Xnews administration.
X
XEOM
Xrp="News admin login?"
X. ./myread
Xnewsadmin="$ans"
Xcase "$newsadmin" in
Xroot) val="$undef" ;;
X*) val="$define" ;;
Xesac
Xset d_newsadm
Xeval $setvar
X
X: check for buffering of stdout
Xecho " "
Xcase "$d_nolnbuf" in
X'')
X	$cat <<'EOT' >blurfl.c
X#include <stdio.h>
Xmain()
X{
X	int i;
X
X	for (i = 0; i < 5; i++) {
X		putchar(i+'a');
X		sleep(1);
X	}
X	putchar('\n');
X}
XEOT
X	$cc blurfl.c -o blurfl >/dev/null 2>&1;
X	$rm -f blurfl.c
X	$cat >&4 <<'EOM'
XChecking for buffering of stdout to terminal.
X
XObserve the following characters as they are printed out, to see whether they
Xprint out all at once, or with a 1 second pause between each of them.  If they
Xprint out one by one, you don't have buffering.  If they print together (after
Xabout a 5 second pause), you do have buffering.
X
XEOM
X	dflt=''
X	rp="Type return to start printing the test characters:"
X	. ./myread
X	ans=y
X	while $test "$ans" = 'y'; do
X		blurfl 1>&4
X		dflt=n
X		rp='Would you like to see that again?'
X		. ./myread
X	done
X		dflt=y
X		rp="Do you have buffering (printed all at once)?"
X		. ./myread
X		case "$ans" in
X		n*) val="$define";;
X		*)  val="$undef";;
X		esac
X		;;
X*)
X	case "$d_nolnbuf" in
X	"$define") dflt=n;;
X	*) dflt=y;;
X	esac
X	rp="Do you have buffering on stdout to terminals?"
X	. ./myread
X	case "$ans" in
X	n*) val="$define";;
X	*)  val="$undef";;
X	esac
X	;;
Xesac
Xset d_nolnbuf
Xeval $setvar
X
X: see if we need -ljobs and if we have sigset, etc.
Xecho " "
Xif $test -r /usr/lib/libjobs.a || $test -r /usr/local/lib/libjobs.a ; then
X	echo "Jobs library found." >&4
X	val="$undef"
X	jobslib='-ljobs'
Xelse
X	if bsd; then
X		echo "No jobs library found. (I suppose this is at least 4.2...)" >&4
X	else
X		echo "No jobs library found. (That's okay, we all have our faults.)" >&4
X	fi
X	val="$define"
X	jobslib=''
Xfi
Xset d_normsig
Xeval $setvar
X
X: see if there is a vfork
Xecho " "
Xif set vfork val -f d_hvfork; eval $csym; $val; then
X	echo "vfork() found." >&4
X	val="$undef"
Xelse
X	echo "No vfork() found--will use fork() instead." >&4
X	val="$define"
Xfi
Xset d_novfork
Xeval $setvar
Xcase "$d_novfork" in
X"$define") d_hvfork="$undef";;
X*)	   d_hvfork="$define";;
Xesac
X
X: check for void type
Xecho " "
X$echo "Checking to see how well your C compiler groks the void type..."
X$cat >void.c <<'EOCP'
Xvoid main(){;}
XEOCP
Xif $cc -c void.c >/dev/null 2>&1 ; then
X    d_novoid="$undef"
X    $echo "Yup, it does."
Xelse
X    d_novoid="$define"
X    $echo "Nope, it doesn't (boo hiss).  I will substitute int."
Xfi
X$rm void.*
X
X: see if rdchk exists
Xset rdchk d_rdchk
Xeval $inlibc
X
X: see if rename exists
Xset rename d_rename
Xeval $inlibc
X
X: see if sigblock exists
Xset sigblock d_sigblock
Xeval $inlibc
X
X: see if sighold exists
Xset sighold d_sighold
Xeval $inlibc
X
X: see if we need to define size_t
Xif $contains 'size_t' /usr/include/string*.h >/dev/null 2>&1 ; then
X    d_sizet="$undef"
Xelse
X    d_sizet="$define"
Xfi
X
X: see if strcasecmp exists
Xset strcasecmp d_strcasecmp
Xeval $inlibc
X
X: see which of string.h or strings.h is needed
Xecho " "
Xstrings=`./findhdr string.h`
Xif $test "$strings" && $test -r "$strings"; then
X    echo "Using <string.h> instead of <strings.h>." >&4
X    val="$define"
Xelse
X    val="$undef"
X    strings=`./findhdr strings.h`
X    if $test "$strings" && $test -r "$strings"; then
X	echo "Using <strings.h> instead of <string.h>." >&4
X    else
X	echo "No string header found -- You'll surely have problems." >&4
X    fi
Xfi
Xset i_string
Xeval $setvar
Xcase "$i_string" in
X"$undef") strings=`./findhdr strings.h`;;
X*)	  strings=`./findhdr string.h`;;
Xesac
X
X: index or strchr
Xecho " "
Xif set index val -f; eval $csym; $val; then
X    if set strchr val -f d_strchr; eval $csym; $val; then
X	if $contains strchr "$strings" >/dev/null 2>&1 ; then
X	    val="$define"
X	    echo "strchr() found." >&4
X	else
X	    val="$undef"
X	    echo "index() found." >&4
X	fi
X    else
X	val="$undef"
X	echo "index() found." >&4
X    fi
Xelse
X    if set strchr val -f d_strchr; eval $csym; $val; then
X	val="$define"
X	echo "strchr() found." >&4
X    else
X	echo "No index() or strchr() found!" >&4
X	val="$undef"
X    fi
Xfi
Xset d_strchr
Xeval $setvar
X
X: see if strftime exists
Xcase "$strftimec" in
X'') ;;
X*) d_strftime="$undef";;
Xesac
Xset strftime d_strftime
Xeval $inlibc
Xcase "$d_strftime" in
X"$undef")
X	case "$strftimec" in
X	' ') dflt='none';;
X	'') dflt="./strftime.c";;
X	*)  dflt="$strftimec";;
X	esac
X	$cat <<EOM
X$Package would like to use a strftime(3) routine.  If you have source for a
Xfully POSIX.1 compliant version, you may use it, otherwise you can try
Xusing the one supplied with $package (strftime.c) or answering "none".
X
XEOM
X	fn=fn
X	rp="Where does the source for strftime(3) reside?"
X	. ./getfile
X	case "$ans" in
X	'')	strftimec=' '
X		strftimeo=''
X		;;
X	*)	strftimec="$ans"
X		strftimeo="`basename $ans .c`.o"
X		d_strftime="$define"
X		;;
X	esac
X	;;
X*)	strftimec=''
X	strftimeo=''
X	;;
Xesac
X
X: locate news spool directory
Xif $test "X$d_nntp" = "X$define" ; then
X	newsspool="/tmp"
Xelse
X	case "$newsspool" in
X	'') dflt=/usr/spool/news;;
X	*) dflt="$newsspool";;
X	esac
X	$echo " "
X	fn=d~
X	rp='Where is news spooled?'
X	. ./getfile
X	newsspool="$ans"
Xfi
X
X: find out what database support they want and any file placement details
Xcase "$d_useov$d_usemt" in
X"$undef$undef")  dflt=none;;
X"$undef$define") dflt=threads;;
X"$define$undef") dflt=overviews;;
X*) dflt=both;;
Xesac
X$cat <<EOM
X
X$Package can take advantage of an mthreads or news overview database if
Xone or both of these are available on your system.  Usually $package will
Xfigure out what's available for itself, but you can have support for
Xone or both of these databases disabled by default, if desired.
X
XEOM
Xrp="Default database support for 't'hreads, 'o'verviews, 'b'oth, or 'n'one?"
X. ./myread
Xcase "$ans" in
Xt*)	databases=threads
X	d_useov="$undef"
X	d_usemt="$define"
X	xxx=thread
X	;;
Xo*)	databases=overviews
X	d_useov="$define"
X	d_usemt="$undef"
X	xxx=overview
X	;;
Xn*)	databases=none
X	d_useov="$undef"
X	d_usemt="$undef"
X	;;
X*)	databases=both
X	d_useov="$define"
X	d_usemt="$define"
X	xxx="thread or overview"
X	;;
Xesac
Xcase "$threaddir" in
X'')	if $test "X$d_nntp" = "X$define" -a "$d_xdata" = "$undef"; then
X		dflt="/usr/spool/threads"
X	else
X		dflt="$newsspool"
X	fi
X	;;
X*)	dflt="$threaddir";;
Xesac
Xif $test "$d_xdata" = "$define" -o "$databases" = "none"; then
X	ans="$dflt"
Xelse
X	$echo " "
X	$echo "$Package needs to know the base directory for the $xxx files"
X	$echo "on your system."
X	rp="Where do $xxx files reside?"
X	. ./myread
Xfi
Xthreaddir="$ans"
Xoverviewdir="$ans"
X
X: preserve RCS keywords in files with variable substitution, grrr
XId='$Id'
XLog='$Log'
X
X: determine where public executables go
X$echo " "
Xcase "$bin" in
X'') dflt=`./loc . /local/bin /usr/local/bin /usr/local/bin /usr/lbin /usr/local /usr/bin /bin` ;;
X*)  dflt="$bin" ;;
Xesac
Xfn=d~
Xrp='Pathname where the public executables will reside?'
X. ./getfile
Xif $test "X$bin" != "X$ans"; then
X	installbin=''
Xfi
Xbin="$ans"
X
Xcase "$installbin" in
X'') dflt=`echo $bin | sed 's#^/afs/#/afs/.#'` ;;
X*)  dflt="$installbin" ;;
Xesac
X$cat <<EOM
X
XTo install the files in this directory, a few strange systems need
Xto use a different directory name to get the files there.
X
XEOM
Xrp='What directory name should be used for the install?'
X. ./getfile
Xinstallbin="$ans"
X
X: get the local distributions
X$cat <<'EOH'
X 
XDistribution groups are the things you use on the Distribution line to limit
Xwhere an article will go to.  You are likely to be a member of several
Xdistribution groups, such as organization, city, state, province, country,
Xcontinent, etc.  For example, Los Angeles has the distribution code "la",
XNew Jersey has the code "nj", and Europe has the code "eunet".
X
XThe categories you will be asked are: 
X
Xlocal organization	(Could be just one machine or a cluster or an office)
Xorganization		att, dec, kgb, ...
Xcity			la, ny, mosc, ...
Xstate/province		ca, nj, bc, ...
Xcountry			usa, can, rok, whatever
Xcontinent		na (North America), asia, etc.
X
XEOH
Xif $test -f $newslibexp/distributions; then
X	case "$silent" in
X	true) ;;
X	*)	dflt='Hit return to continue'
X		rp=''
X		. ./myread
X		;;
X	esac
X	$echo "Here is your distributions file:" >&4
X	$echo " " >&4
X	$cat >&4 $newslibexp/distributions
X	$echo " " >&4
Xfi
X$echo "Use 'none' for any distributions you don't have."
X$echo " "
Xcase "$locdist" in
X'') dflt="none";;
X*)  dflt="$locdist";;
Xesac
Xrp="What is the distribution code for your local organization?"
X. ./myread
Xlocdist="$ans"
Xcase "$orgdist" in
X'') dflt="none";;
X*)  dflt="$orgdist";;
Xesac
Xrp="What is the distribution code for your organization?"
X. ./myread
Xorgdist="$ans"
Xcase "$citydist" in
X'') dflt="none";;
X*)  dflt="$citydist";;
Xesac
Xrp="What is the distribution code for your city?"
X. ./myread
Xcitydist="$ans"
Xcase "$statedist" in
X'') dflt="none";;
X*)  dflt="$statedist";;
Xesac
Xrp="What is the distribution code for your state/province?"
X. ./myread
Xstatedist="$ans"
Xcase "$cntrydist" in
X'') dflt="none";;
X*)  dflt="$cntrydist";;
Xesac
Xrp="What is the distribution code for your country?"
X. ./myread
Xcntrydist="$ans"
Xcase "$contdist" in
X'') dflt="none";;
X*)  dflt="$contdist";;
Xesac
Xrp="What is the distribution code for your continent?"
X. ./myread
Xcontdist="$ans"
X$cat <<'EOM'
X  
XIf you have any other distribution groups you will need to edit Pnews
Xand newsetup to add them.
XEOM
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
X$echo " "
Xfn=f/
Xrp="What is the default editor on your system?"
X. ./getfile
Xdefeditor="$ans"
X
X: determine where private executables go
Xcase "$privlib" in
X'')	dflt=/usr/lib/$package
X	$test -d /usr/local/lib && dflt=/usr/local/lib/$package
X	$test -d /local/lib && dflt=/local/lib/$package ;;
X*)	dflt="$privlib" ;;
Xesac
X$cat <<EOM
X
XThere are some auxiliary files for $package that need to be put into a
Xprivate library directory that is accessible by everyone.
X
XEOM
Xfn=d~+
Xrp='Pathname where the private library files will reside?'
X. ./getfile
Xif $test "X$privlib" != "X$ans"; then
X	installprivlib=''
Xfi
Xprivlib="$ans"
X
Xcase "$installprivlib" in
X'') dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'` ;;
X*)  dflt="$installprivlib" ;;
Xesac
X$cat <<EOM
X
XTo install the files in this directory, a few strange systems need
Xto use a different directory name to get the files there.
X
XEOM
Xrp='What directory name should be used for the install?'
X. ./getfile
Xinstallprivlib="$ans"
X
X: must not allow self reference
Xcase "$privlib" in
X/*)	filexp=$privlib/filexp ;;
X*)	filexp=Rnfilexp ;;
Xesac
X
X: check for ispell spelling checker
Xcase "$ispell_prg" in
Xnone)	dflt=n
X	dflt_prg=
X	dflt_options=
X	;;
X'')	if $test -n "$ispell" -a "$ispell" != "ispell"; then
X	    dflt=y
X	    dflt_prg=$ispell
X	    dflt_options='-x'
X	else
X	    dflt=n
X	    dflt_prg=
X	    dflt_options=
X	fi
X	;;
X*)	dflt=y
X	dflt_prg=$ispell_prg
X	dflt_options=$ispell_options
X	;;
Xesac
X$cat <<EOM
X
XPnews has a "Check spelling" option that will allow you to correct spelling
Xerrors if you have ispell, or will simply list possible spelling errors via
Xspell if you don't.
X
XEOM
Xif $test -n "$dflt_prg"; then
X	$echo "Configure has found ispell as $dflt_prg"
Xelse
X	$echo "Configure was unable to find ispell"
Xfi
Xrp="Do you want to use ispell?"
X. ./myread
Xcase "$ans" in
Xy*)	dflt=$dflt_prg
X	fn=f/
X	rp='What is the full pathname of the executable?'
X	. ./getfile
X	ispell_prg=$ans
X	case "$dflt_options" in
X	'') dflt=none;;
X	*) dflt=$dflt_options;;
X	esac
X	rp="What options should be used?"
X	. ./myread
X	case "$ans" in
X	none)	ispell_options='';;
X	*)	ispell_options=$ans;;
X	esac
X	;;
X*)	ispell_prg='none'
X	;;
Xesac
X
X: determine where mail is spooled
Xcase "$mailfile" in
X'')
X	dflt=`./loc . XXX /usr/spool/mail /usr/mail`
X	case "$dflt" in
X	XXX) dflt='%~/mailbox';;
X	*) dflt="$dflt/%L";;
X	esac
X	;;
X*)  dflt="$mailfile"
X	;;
Xesac
Xcat <<'EOM'
X
XIn the following question, you may use %~ to represent the user's home
Xdirectory, and %L to represent a users name.
X
XEOM
Xrp='In which file is yet-to-be-read mail spooled? (~name ok)'
X. ./myread
Xmailfile=`./filexp "$ans"`
X
X: determine where manual pages go
X$cat <<EOM
X
X$package has manual pages available in source form.
XEOM
Xcase "$nroff" in
Xnroff)
X	echo "However, you don't have nroff, so they're probably useless to you."
X	case "$mansrc" in
X	'') mansrc="none";;
X	esac;;
Xesac
Xecho "If you don't want the manual sources installed, answer 'none'."
Xcase "$mansrc" in
X'')
X	mansrc=`./loc . /usr/local/man/man1 /usr/local/man/man1 /usr/man/manl /usr/man/local/man1 /usr/man/l_man/man1 /usr/local/man/u_man/man1 /usr/local/man/l_man/man1 /usr/man/man.L`
X	if $test -d "$mansrc"; then
X		dflt="$mansrc"
X	else
X		dflt="$sysman"
X	fi
X	;;
X*)  dflt="$mansrc"
X	;;
Xesac
Xecho " "
Xfn=dn~
Xrp='Where do the manual pages (source) go?'
X. ./getfile
Xmansrc="$ans"
Xcase "$mansrc" in
X'') manext='0';;
X*l) manext=l;;
X*n) manext=n;;
X*o) manext=l;;
X*p) manext=n;;
X*C) manext=C;;
X*L) manext=L;;
X*L1) manext=L1;;
X*) manext=1;;
Xesac
X
X: determine how to determine when a file is a mailbox
Xcase "$mboxchar" in
X'') dflt=F;;
X*)  dflt="$mboxchar";;
Xesac
X$cat <<EOM
X 
XIn saving articles, $package wants to differentiate between saving to
Xmailbox format files and normal files.  It does this by examining the
Xfirst character of the file in question.  On most systems the first line
Xstarts with "From ...", so the first character is an F.  Other systems
Xuse magic cookies like control codes between articles, so one of those
Xwould be first.
X
XEOM
Xrp="What's the first character of a mailbox file?"
X. ./myread
Xmboxchar="$ans"
Xcase "$mboxchar" in
X'F') ;;
X*)  cat <<'EOM'
X
XYou will need to edit the shell script mbox.saver to properly append an
Xarticle to a mailbox.  The arguments to the script are documented in
XEOM
X	case "$shsharp" in
X	false) echo "comments in mbox.saver.std.";;
X	true) echo "comments in the shell script itself.";;
X	esac
Xesac
X
X: get organization name
Xlongshots='/local/src /usr/src/new /usr/src/local /usr/local/src'
Xcase "$orgname" in
X'')	xxx=`./loc news/src/defs.h x $longshots`
X	if $test $xxx != x; then
X		dflt=`$sed -n 's/^.*MYORG[ 	]*"\(.*\)".*$/\1/p' $xxx`
X	else
X		if $test -f /usr/lib/news/organi[sz]ation; then
X			dflt=/usr/lib/news/organi[sz]ation
X		else
X			dflt=''
X		fi
X	fi
X	;;
X*)	dflt="$orgname";;
Xesac
X$cat << 'EOH'
X 
XPlease type the name of your organization as you want it to appear on the
XOrganization line of outgoing articles.  (It's nice if this also specifies
Xyour location.  Your city name is probably sufficient if well known.)
XFor example:
X
X    University of Southern North Dakota, Hoople
X
XYou may also put the name of a file, as long as it begins with a slash.
XFor example:
X
X    /etc/organization
X
XEOH
Xorgname=""
Xwhile test "X$orgname" = "X"; do
X	rp='Organization:'
X	. ./myread
X	orgname="$ans"
Xdone
X
X: locate the preferred pager for this system
Xcase "$pager" in
X'')
X	case "$pg" in
X	/*) dflt=$pg;;
X	esac
X	case "$less" in
X	/*) dflt=$less;;
X	esac
X	case "$more" in
X	/*) dflt=$more;;
X	esac
X	case "$dflt" in
X	'') dflt=/usr/ucb/more;;
X	esac
X	;;
X*) dflt="$pager";;
Xesac
X$cat <<EOM
X
XSome of the support scripts want to use a paging program such as "more"
Xto help the user page through the generated output.  You'll probably
Xwant the most innocuous pager you have, since some lists consist of only
Xone line (if your kernel does terminal paging then you may answer this
Xwith "$cat").  Also note that this does not affect the paging of
Xarticles, as trn uses an internal pager for that.
X
XEOM
Xfn=f/
Xrp='What pager should we use?'
X. ./getfile
Xpager="$ans"
X
X: find out which shell people like to use most
Xcase "$prefshell" in
X'')
X	case "$ksh $bash $csh" in
X	*/ksh*) dflt="$ksh" ;;
X	*/bash*) dflt="$bash" ;;
X	*/csh*) dflt="$csh" ;;
X	*) dflt='/bin/sh' ;;
X	esac
X	;;
X*)  dflt="$prefshell";;
Xesac
X$cat <<EOM
X
XGive the full path name of the shell most people like to use on your system.
XThis will be used by $package whenever the user wants to get a shell
Xescape (for instance) and is not necessarily the same as the shell you are
Xcurrently using (${SHELL-/bin/sh}).
X
XEOM
Xfn=f/~
Xrp='Preferred shell to be used?'
X. ./getfile
Xprefshell=$ans
X
X: determine root id
Xecho " "
Xrootid=`$sed -e "/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e "q" -e "}" -e "d" </etc/passwd`
Xcase "$rootid" in
X'') rootid=0 ;;
X*) echo "Root uid = $rootid" >&4 ;;
Xesac
X
X: see if signal is declared as pointer to function returning int or void
Xecho " "
Xxxx=`./findhdr signal.h`
X$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
Xif $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
X	echo "You have int (*signal())() instead of void." >&4
X	val="$undef"
X	signal_t="int"
Xelif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
X	echo "You have void (*signal())() instead of int." >&4
X	val="$define"
X	signal_t="void"
Xelif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
X	echo "You have int (*signal())() instead of void." >&4
X	val="$undef"
X	signal_t="int"
Xelse
X	case "$d_voidsig" in
X	'')
X	echo "I can't determine whether signal handler returns void or int..." >&4
X		dflt=void
X		rp="What type does your signal handler returns?"
X		. ./myread
X		case "$ans" in
X		void) val="$define"; signal_t="void";;
X		*) val="$undef"; signal_t="int";;
X		esac;;
X	*) echo "As you already told me, signal handler returns $signal_t." >&4;;
X	esac
Xfi
Xset d_voidsig
Xeval $setvar
X$rm -f $$.tmp
X
X: check if they want threads by default
Xcase "$trn_init" in
XF*) dflt="n";;
X*)  dflt="y";;
Xesac
X$cat <<'EOM'
X
XTrn has two distinct operating modes (selected by the -x option):
Xtraditional rn and threaded rn.  If you like, trn will check the first
Xletter of the command name and default to threaded mode (-x) if it is
Xa 't', or run as traditional rn (+x) if it isn't (this lets you install
Xas both trn and rn, linked together).  Otherwise, you can install trn
Xto default to threaded rn (-x) no matter what its name is.
X
XEOM
Xrp='Do you want trn to default to -x, regardless of name?'
X. ./myread
Xcase "$ans" in
Xn*|f*)	trn_init='FALSE'
X	ans=' for trn (not rn)';;
X*)	trn_init='TRUE'
X	ans='';;
Xesac
X: check if they want the selector used by default
Xcase "$trn_select" in
XF*) dflt="n";;
X*)  dflt="y";;
Xesac
X$cat <<'EOM'
X
XWhen the -X option is specified, trn will set the default command
Xfor starting a newsgroup to be the selector.
X
XEOM
Xrp="Should the -X option be on by default$ans?"
X. ./myread
Xcase "$ans" in
Xn*|f*) trn_select=FALSE;;
X*)     trn_select=TRUE;;
Xesac
X
X: see if this is a dirent system
Xecho " "
Xif xinc=`./findhdr dirent.h`; $test "$xinc"; then
X	val="$define"
X	echo "<dirent.h> found." >&4
Xelse
X	val="$undef"
X	if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
X		echo "<sys/dir.h> found." >&4
X		echo " "
X	else
X		xinc=`./findhdr sys/ndir.h`
X	fi
X	echo "<dirent.h> NOT found." >&4
Xfi
Xset i_dirent
Xeval $setvar
X
X: see if ptem.h exists
Xif $test -r /usr/include/sys/ptem.h ; then
X    $echo "sys/ptem.h found."
X    i_ptem="$define"
Xelse
X    i_ptem="$undef"
Xfi
X
X: get C preprocessor symbols handy
Xecho " "
Xecho $attrlist | $tr ' ' '\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' | $sed -e 's/\(.*\)/\\
X#ifdef \1\\
Xexit 0; _ _ _ _\1\\	 \1\\
X#endif\\
X/' >Cppsym\$\$
Xecho "exit 1; _ _ _" >>Cppsym\$\$
X$cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
Xcase "\$list" in
Xtrue) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
X*)
X	sh Cppsym2\$\$
X	status=\$?
X	;;
Xesac
X$rm -f Cppsym\$\$ Cppsym2\$\$
Xexit \$status
XEOSS
Xchmod +x Cppsym
X$eunicefix Cppsym
Xecho "Your C preprocessor defines the following symbols:"
XCppsym -l $attrlist >Cppsym.true
X$cat Cppsym.true
X
X: see if this is a termio system
Xval="$undef"
Xval2="$undef"
Xval3="$undef"
Xif $test `./findhdr termios.h`; then
X	set tcsetattr i_termios
X	eval $inlibc
X	val3="$i_termios"
Xfi
Xecho " "
Xcase "$val3" in
X"$define") echo "You have POSIX termios.h... good!" >&4;;
X*) if Cppsym pyr; then
X		case "`/bin/universe`" in
X		ucb) if $test `./findhdr sgtty.h`; then
X				val2="$define"
X				echo "<sgtty.h> found." >&4
X			else
X				echo "System is pyramid with BSD universe."
X				echo "<sgtty.h> not found--you could have problems." >&4
X			fi;;
X		*) if $test `./findhdr termio.h`; then
X				val="$define"
X				echo "<termio.h> found." >&4
X			else
X				echo "System is pyramid with USG universe."
X				echo "<termio.h> not found--you could have problems." >&4
X			fi;;
X		esac
X	elif usg; then
X		if $test `./findhdr termio.h`; then
X			echo "<termio.h> found." >&4
X			val="$define"
X		elif $test `./findhdr sgtty.h`; then
X			echo "<sgtty.h> found." >&4
X			val2="$define"
X		else
Xecho "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
X		fi
X	else
X		if $test `./findhdr sgtty.h`; then
X			echo "<sgtty.h> found." >&4
X			val2="$define"
X		elif $test `./findhdr termio.h`; then
X			echo "<termio.h> found." >&4
X			val="$define"
X		else
Xecho "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
X		fi
X	fi;;
Xesac
Xset i_termio; eval $setvar
Xval=$val2; set i_sgtty; eval $setvar
Xval=$val3; set i_termios; eval $setvar
X
X: define an alternate in-header-list? function
Xinhdr='echo " "; td=$define; tu=$undef; yyy=$@;
Xcont=true; xxf="echo \"<\$1> found.\" >&4";
Xcase $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
X*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
Xesac;
Xcase $# in 4) instead=instead;; *) instead="at last";; esac;
Xwhile $test "$cont"; do
X	xxx=`./findhdr $1`
X	var=$2; eval "was=\$$2";
X	if $test "$xxx" && $test -r "$xxx";
X	then eval $xxf;
X		eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
X		cont="";
X	else eval $xxnf;
X		eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
X	set $yyy; shift; shift; yyy=$@;
X	case $# in 0) cont="";;
X	2) xxf="echo \"but I found <\$1> $instead.\" >&4";
X		xxnf="echo \"and I did not find <\$1> either.\" >&4";;
X	*) xxf="echo \"but I found <\$1\> instead.\" >&4";
X		xxnf="echo \"there is no <\$1>, ...\" >&4";;
X	esac;
Xdone;
Xwhile $test "$yyy";
Xdo set $yyy; var=$2; eval "was=\$$2";
X	eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
X	set $yyy; shift; shift; yyy=$@;
Xdone'
X
X: see if stdlib is available
Xset stdlib.h i_stdlib
Xeval $inhdr
X
X: see if this is an sysdir system
Xset sys/dir.h i_sysdir
Xeval $inhdr
X
X: see if ioctl defs are in sgtty/termio or sys/ioctl
Xecho " "
Xif $test `./findhdr sys/ioctl.h`; then
X	val="$define"
X	echo "<sys/ioctl.h> found." >&4
Xelse
X	val="$undef"
X	$test $i_termio = "$define" && xxx="termio.h"
X	$test $i_termios = "$define" && xxx="termios.h"
X	$test $i_sgtty = "$define" && xxx="sgtty.h"
Xecho "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
Xfi
Xset i_sysioctl
Xeval $setvar
X
X: see if this is an sysndir system
Xset sys/ndir.h i_sysndir
Xeval $inhdr
X
X: see if we should include time.h, sys/time.h, or both
Xecho " "
Xecho "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
X$echo $n "I'm now running the test program...$c"
X$cat >try.c <<'EOCP'
X#include <sys/types.h>
X#ifdef I_TIME
X#include <time.h>
X#endif
X#ifdef I_SYSTIME
X#include <sys/time.h>
X#endif
X#ifdef I_SYSSELECT
X#include <sys/select.h>
X#endif
Xmain()
X{
X	struct tm foo;
X#ifdef S_TIMEVAL
X	struct timeval bar;
X#endif
X#ifdef S_TIMEZONE
X	struct timezone tzp;
X#endif
X	if (foo.tm_sec == foo.tm_sec)
X		exit(0);
X#ifdef S_TIMEVAL
X	if (bar.tv_sec == bar.tv_sec)
X		exit(0);
X#endif
X	exit(1);
X}
XEOCP
Xflags=''
Xfor s_timezone in '-DS_TIMEZONE' ''; do
Xsysselect=''
Xfor s_timeval in '-DS_TIMEVAL' ''; do
Xfor i_time in '' '-DI_TIME'; do
Xfor i_systime in '-DI_SYSTIME' ''; do
X	case "$flags" in
X	'') $echo $n ".$c"
X		if $cc $ccflags \
X		$i_time $i_systime $sysselect $s_timeval $s_timezone \
X		try.c -o try >/dev/null 2>&1 ; then
X			set X $i_time $i_systime $sysselect $s_timeval
X			shift
X			flags="$*"
X			echo " "
X			$echo $n "Succeeded with $flags$c"
X		fi
X		;;
X	esac
Xdone
Xdone
Xdone
Xdone
Xecho " "
Xcase "$flags" in
X*I_TIME*) i_time="$define"
X	echo "We'll include <time.h>." >&4;;
X*) i_time="$undef";;
Xesac
Xcase "$flags" in
X*I_SYSTIME*) i_systime="$define"
X	echo "We'll include <sys/time.h>." >&4;;
X*) i_systime="$undef";;
Xesac
X$rm -f try.c try
X
X: see if this is a unistd.h system
Xset unistd.h i_unistd
Xeval $inhdr
X
X: see if this is a vfork system
Xset vfork.h i_vfork
Xeval $inhdr
X
X: end of configuration questions
Xecho " "
Xecho "End of configuration questions."
Xecho " "
X
X: back to where it started
Xif test -d ../UU; then
X	mv filexp ..
X	cd ..
Xfi
X
X: configuration may be patched via a 'config.over' file
Xif $test -f config.over; then
X	echo " "
X	dflt=y
X	rp='I see a config.over file.  Do you wish to load it?'
X	. ./UU/myread
X	case "$ans" in
X	n*) echo "OK, I'll ignore it.";;
X	*)	. ./config.over
X		echo "Configuration override changes have been loaded."
X		;;
X	esac
Xfi
X
X: create config.sh file
Xecho " "
Xecho "Creating config.sh..." >&4
Xcf_time=`$date 2>&1`
Xcf_by=`( (logname) 2>/dev/null || whoami) 2>&1`
X$spitshell <<EOT >config.sh
X$startsh
X#
X# This file was produced by running the Configure script. It holds all the
X# definitions figured out by Configure. Should you modify one of these values,
X# do not forget to propagate your changes by running "Configure -der". You may
X# instead choose to run each of the .SH files by yourself, or "Configure -S".
X#
X
X# Configuration time: $cf_time
X# Configured by: $cf_by
X# Target system: $myuname
X
Xcf_by='$cf_by'
Xcf_time='$cf_time'
Xd_bsd='$d_bsd'
Xd_eunice='$d_eunice'
Xd_xenix='$d_xenix'
Xeunicefix='$eunicefix'
XMcc='$Mcc'
Xawk='$awk'
Xbash='$bash'
Xbison='$bison'
Xcat='$cat'
Xchgrp='$chgrp'
Xchmod='$chmod'
Xchown='$chown'
Xcompress='$compress'
Xcpp='$cpp'
Xcsh='$csh'
Xdate='$date'
Xecho='$echo'
Xegrep='$egrep'
Xemacs='$emacs'
Xexpr='$expr'
Xflex='$flex'
Xgcc='$gcc'
Xgrep='$grep'
Xinews='$inews'
Xispell='$ispell'
Xksh='$ksh'
Xless='$less'
Xline='$line'
Xlint='$lint'
Xln='$ln'
Xlp='$lp'
Xlpr='$lpr'
Xls='$ls'
Xmail='$mail'
Xmailx='$mailx'
Xmake='$make'
Xmetamail='$metamail'
Xmhn='$mhn'
Xmkdir='$mkdir'
Xmore='$more'
Xmv='$mv'
Xnroff='$nroff'
Xperl='$perl'
Xpg='$pg'
Xpmake='$pmake'
Xpr='$pr'
Xrm='$rm'
Xrmail='$rmail'
Xsed='$sed'
Xsendmail='$sendmail'
Xsh='$sh'
Xshar='$shar'
Xsleep='$sleep'
Xsmail='$smail'
Xsort='$sort'
Xsubmit='$submit'
Xtail='$tail'
Xtar='$tar'
Xtbl='$tbl'
Xtest='$test'
Xtouch='$touch'
Xtr='$tr'
Xtroff='$troff'
Xuname='$uname'
Xuniq='$uniq'
Xuuname='$uuname'
Xvi='$vi'
Xzcat='$zcat'
Xhint='$hint'
Xmyuname='$myuname'
XAuthor='$Author'
XDate='$Date'
XHeader='$Header'
XId='$Id'
XLocker='$Locker'
XLog='$Log'
XRCSfile='$RCSfile'
XRevision='$Revision'
XSource='$Source'
XState='$State'
Xactive='$active'
Xacttimes='$acttimes'
Xd_acttimes='$d_acttimes'
Xmyactive='$myactive'
Xbin='$bin'
Xinstallbin='$installbin'
Xcc='$cc'
Xccflags='$ccflags'
Xcppflags='$cppflags'
Xldflags='$ldflags'
Xlkflags='$lkflags'
Xoptimize='$optimize'
Xcontains='$contains'
Xcppminus='$cppminus'
Xcppstdin='$cppstdin'
Xd_ftime='$d_ftime'
Xaphostcmd='$aphostcmd'
Xd_gethname='$d_gethname'
Xd_phostcmd='$d_phostcmd'
Xd_uname='$d_uname'
Xd_getpwent='$d_getpwent'
Xd_getcwd='$d_getcwd'
Xd_getwd='$d_getwd'
Xd_havetlib='$d_havetlib'
Xtermlib='$termlib'
Xd_ignoreorg='$d_ignoreorg'
Xd_internet='$d_internet'
Xd_memcmp='$d_memcmp'
Xd_memcpy='$d_memcpy'
Xd_memset='$d_memset'
Xd_mime='$d_mime'
Xmimeshow="$mimeshow"
Xmimestore="$mimestore"
Xd_newsadm='$d_newsadm'
Xnewsadmin='$newsadmin'
Xd_nntp='$d_nntp'
Xd_xdata='$d_xdata'
Xservername='$servername'
Xd_nolnbuf='$d_nolnbuf'
Xd_normsig='$d_normsig'
Xjobslib='$jobslib'
Xd_hvfork='$d_hvfork'
Xd_novfork='$d_novfork'
Xd_novoid='$d_novoid'
Xvoid='$void'
Xd_portable='$d_portable'
Xd_rdchk='$d_rdchk'
Xd_rename='$d_rename'
Xd_sigblock='$d_sigblock'
Xd_sighold='$d_sighold'
Xd_sizet='$d_sizet'
Xd_strcasecmp='$d_strcasecmp'
Xd_strchr='$d_strchr'
Xd_strftime='$d_strftime'
Xstrftimec='$strftimec'
Xstrftimeo='$strftimeo'
Xd_libndir='$d_libndir'
Xd_usendir='$d_usendir'
Xlibndir='$libndir'
Xndirc='$ndirc'
Xndiro='$ndiro'
Xd_voidsig='$d_voidsig'
Xsignal_t='$signal_t'
Xdefeditor='$defeditor'
Xfilexp='$filexp'
Xd_dirnamlen='$d_dirnamlen'
Xi_dirent='$i_dirent'
Xi_ptem='$i_ptem'
Xi_stdlib='$i_stdlib'
Xi_string='$i_string'
Xstrings='$strings'
Xi_sysdir='$i_sysdir'
Xd_voidtty='$d_voidtty'
Xi_bsdioctl='$i_bsdioctl'
Xi_sysioctl='$i_sysioctl'
Xi_syssockio='$i_syssockio'
Xi_sysndir='$i_sysndir'
Xi_sgtty='$i_sgtty'
Xi_termio='$i_termio'
Xi_termios='$i_termios'
Xi_systime='$i_systime'
Xi_time='$i_time'
Xi_unistd='$i_unistd'
Xi_vfork='$i_vfork'
Xispell_options='$ispell_options'
Xispell_prg='$ispell_prg'
Xlibc='$libc'
Xplibpth='$plibpth'
Xxlibpth='$xlibpth'
Xlibs='$libs'
Xcitydist='$citydist'
Xcntrydist='$cntrydist'
Xcontdist='$contdist'
Xlocdist='$locdist'
Xorgdist='$orgdist'
Xstatedist='$statedist'
Xmailer='$mailer'
Xmailfile='$mailfile'
Xmanext='$manext'
Xmansrc='$mansrc'
Xmboxchar='$mboxchar'
Xc='$c'
Xn='$n'
Xd_berknames='$d_berknames'
Xd_passnames='$d_passnames'
Xd_usgnames='$d_usgnames'
Xnametype='$nametype'
Xinewsloc='$inewsloc'
Xnewslib='$newslib'
Xnewslibexp='$newslibexp'
Xnewsspool='$newsspool'
Xorgname='$orgname'
Xpackage='$package'
Xpager='$pager'
Xphost='$phost'
Xphostcmd='$phostcmd'
Xprefshell='$prefshell'
Xinstallprivlib='$installprivlib'
Xprivlib='$privlib'
Xrootid='$rootid'
Xsharpbang='$sharpbang'
Xshsharp='$shsharp'
Xspitshell='$spitshell'
Xstartsh='$startsh'
Xsysman='$sysman'
Xd_usemt='$d_usemt'
Xd_useov='$d_useov'
Xoverviewdir='$overviewdir'
Xthreaddir='$threaddir'
Xtrn_init='$trn_init'
Xtrn_select='$trn_select'
Xnm_opt='$nm_opt'
Xrunnm='$runnm'
Xusenm='$usenm'
Xincpath='$incpath'
Xmips='$mips'
Xmips_type='$mips_type'
Xusrinc='$usrinc'
XEOT
X
X: add special variables
X$test -f patchlevel.h && \
Xawk '/^#define/ {printf "%s=%s %s%s\n",$2,$3,$4,$5}' patchlevel.h >>config.sh
Xecho "CONFIG=true" >>config.sh
X
X: Finish up by extracting the .SH files
Xcase "$alldone" in
Xexit)
X	$rm -rf UU
X	echo "Done."
X	exit 0
X	;;
Xcont)
X	;;
X'')
X	echo " "
X	dflt=''
Xecho "If you didn't make any mistakes, then just type a carriage return here."
X	rp="If you need to edit config.sh, do it as a shell escape here:"
X	. UU/myread
X	case "$ans" in
X	'') ;;
X	*) : in case they cannot read
X	    sh 1>&4 -c "$ans";;
X	esac
X	;;
Xesac
X
X: if this fails, just run all the .SH files by hand
X. ./config.sh
X
Xecho " "
Xexec 1>&4
X. ./UU/extract
X
Xecho " "
Xecho 'Now type "make".'
X
X$rm -f kit*isdone ark*isdone
X$rm -rf UU
X: End of Configure
END_OF_FILE
if test 94195 -ne `wc -c <'Configure'`; then
    echo shar: \"'Configure'\" unpacked with wrong size!
fi
chmod +x 'Configure'
# end of 'Configure'
fi
echo shar: End of archive 11 \(of 12\).
cp /dev/null ark11isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 12 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
