1#! /bin/sh
2#
3# If these # comments don't work, trim them.  Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh, I would
7# suggest you cut out the prototypical config.h from the end of Configure
8# and edit it to reflect your system.  Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# $Header: Head.U,v 2.0 88/06/28 23:13:13 lwall Locked $
12#
13# Yes, you may rip this off to use in other distribution packages.
14# (Note: this Configure script was generated automatically.  Rather than
15# working with this copy of Configure, you may wish to get metaconfig.)
16
17: sanity checks
18PATH=".:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:$PATH"
19export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
20
21(alias) >/dev/null 2>&1 && \
22    echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
23    echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
24
25if test ! -d ../UU; then
26    if test ! -d UU; then
27	mkdir UU
28    fi
29    cd UU
30fi
31
32case "$1" in
33-d) shift; fastread='yes';;
34esac
35
36Log=''
37Header=''
38contains=''
39cppstdin=''
40cppminus=''
41d_getopt=''
42d_memcpy=''
43d_mkdir=''
44d_rename=''
45d_symlink=''
46d_whoami=''
47n=''
48c=''
49orderlib=''
50ranlib=''
51package=''
52pager=''
53prefshell=''
54startsh=''
55d_eunice=''
56define=''
57eunicefix=''
58build_dir=''
59source_dir=''
60loclist=''
61expr=''
62sed=''
63echo=''
64cat=''
65rm=''
66mv=''
67cp=''
68tail=''
69tr=''
70mkdir=''
71sort=''
72uniq=''
73grep=''
74trylist=''
75test=''
76inews=''
77ispell=''
78egrep=''
79more=''
80pg=''
81Mcc=''
82vi=''
83mailx=''
84mail=''
85cpp=''
86perl=''
87emacs=''
88ls=''
89rmail=''
90sendmail=''
91shar=''
92smail=''
93submit=''
94tbl=''
95troff=''
96nroff=''
97uname=''
98uuname=''
99line=''
100chgrp=''
101chmod=''
102lint=''
103sleep=''
104pr=''
105tar=''
106ln=''
107lpr=''
108lp=''
109touch=''
110make=''
111date=''
112csh=''
113pmake=''
114mips=''
115col=''
116pack=''
117bld=''
118compress=''
119execmail=''
120libswanted=''
121bin=''
122installbin=''
123c_date=''
124d_ascii=''
125d_broke_ctype=''
126d_broke_fflush=''
127d_calendar=''
128calendar=''
129d_chown_neg1=''
130d_content=''
131d_crypt=''
132cryptlib=''
133d_cuserid=''
134d_disphost=''
135d_domname=''
136d_usegetdom=''
137d_errlst=''
138d_flock=''
139d_dotlock=''
140d_fcntlock=''
141lock_dir=''
142has_flock=''
143has_fcntl=''
144d_fsync=''
145d_ftruncate=''
146d_gethname=''
147d_douname=''
148d_host_comp=''
149ign_hname=''
150d_index=''
151d_internet=''
152d_ispell=''
153ispell_path=''
154ispell_options=''
155d_locale=''
156d_nl_types=''
157d_msgcat=''
158d_usenls=''
159d_mboxedit=''
160d_mime=''
161defcharset=''
162defdispcharset=''
163d_mmdf=''
164d_newauto=''
165d_noaddfrom=''
166d_usedomain=''
167d_noxheader=''
168d_pidcheck=''
169d_ptem=''
170d_putenv=''
171d_remlock=''
172maxattempts=''
173d_setegid=''
174d_setgid=''
175d_savegrpmboxid=''
176mailermode=''
177d_sigvec=''
178d_sigvectr=''
179d_sigset=''
180d_sighold=''
181d_sigprocmask=''
182d_sigblock=''
183d_sigaction=''
184d_statuschg=''
185d_strcspn=''
186d_strspn=''
187d_strpbrk=''
188d_strerror=''
189d_strftime=''
190d_strings=''
191d_pwdinsys=''
192strings=''
193includepath=''
194d_strstr=''
195d_strtok=''
196d_subshell=''
197d_tempnam=''
198tempnamo=''
199tempnamc=''
200d_termio=''
201d_termios=''
202d_useembed=''
203d_utimbuf=''
204d_vfork=''
205defbatsub=''
206defeditor=''
207editoropts=''
208hostname=''
209phostname=''
210mydomain=''
211autohostname=''
212i_memory=''
213i_stdarg=''
214i_stdlib=''
215i_time=''
216i_systime=''
217d_systimekernel=''
218i_unistd=''
219i_utime=''
220i_sysutime=''
221lib=''
222installlib=''
223libc=''
224linepr=''
225maildir=''
226mailer=''
227mailgrp=''
228mansrc=''
229catmansrc=''
230manext=''
231manext_choice=''
232catmanext=''
233catmanext_choice=''
234packed=''
235manroff=''
236manroffopts=''
237suffix=''
238packer=''
239models=''
240split=''
241small=''
242medium=''
243large=''
244huge=''
245optimize=''
246ccflags=''
247cppflags=''
248ldflags=''
249cc=''
250libs=''
251nametype=''
252d_passnames=''
253d_berknames=''
254d_usgnames=''
255passcat=''
256rmttape=''
257roff=''
258roffopts=''
259sigtype=''
260spitshell=''
261shsharp=''
262sharpbang=''
263termlib=''
264tmpdir=''
265tzname_handling=''
266xencf=''
267xenlf=''
268d_xenix=''
269d_bsd=''
270CONFIG=''
271: set package name
272package=elm2.5
273
274# Revision 1.2  1995/06/30  14:56:06  wfp5p
275# Alpha 5
276#
277# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
278# Initial import of elm 2.4 PL0 as base for elm 2.5.
279#
280# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
281# Elm 2
282#
283echo " "
284echo "Beginning of configuration questions for $package kit."
285: Eunice requires " " instead of "", can you believe it
286echo " "
287
288define='define'
289undef='undef'
290: change the next line if compiling for Xenix/286 on Xenix/386
291xlibpth='/usr/lib/386 /lib/386 /lib'
292libpth='/usr/lib /usr/ccs/lib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
293smallmach='pdp11 i8086 z8000 i80286 iAPX286'
294rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
295trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
296
297: We must find out about Eunice early
298eunicefix=':'
299if test -f /etc/unixtovms; then
300    eunicefix=/etc/unixtovms
301fi
302if test -f /etc/unixtovms.exe; then
303    eunicefix=/etc/unixtovms.exe
304fi
305
306: See if the sources are somewhere other than where we are doing the build.
307
308build_dir=`cd .. ; pwd`
309source_dir="$build_dir"
310if test ! -f $source_dir/MANIFEST ; then
311		# Most shells leave the full pathname to the script in $0
312		# so we should be able to use that to locate the sources.
313	echo "I do not see the source files here."
314	source_dir=`dirname $0`
315	case "$source_dir" in
316	/*)	;;
317	*)	source_dir=`cd $source_dir ; pwd` ;;
318	esac
319	if test ! -f $source_dir/MANIFEST ; then
320		echo "You are missing some or all of the source distribution."
321		echo "Please reload the software and try again."
322		exit 1
323	fi
324	echo "Aha!  I found them."
325	echo "  build directory  = $build_dir"
326	echo "  source directory = $source_dir"
327fi
328
329: Now test for existence of everything in MANIFEST
330
331echo "First let's make sure your kit is complete.  Checking..."
332awk '$1 !~ /PACKINGLIST/ {print $1}' $source_dir/MANIFEST | split -100
333rm -f missing
334for filelist in x??; do
335    (cd $source_dir; ls `cat $build_dir/UU/$filelist` >/dev/null 2>>$build_dir/UU/missing)
336done
337if test -s missing; then
338    cat missing
339    kill $$
340fi
341echo "Looks good..."
342
343: Do one time items.....
344
345cd $source_dir
346for file in OneTime.PL* ; do
347	if test -f "$file" ; then
348		echo "Executing patch cleanup script $file . . ."
349		. ./$file
350	fi
351done
352cd $build_dir/UU
353
354d_newshome="/usr/NeWS"
355defvoidused=7
356attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
357attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
358attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
359attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
360attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
361attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
362attrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__ NeXT _AIX ultrix"
363pth="/bin /usr/bin /usr/ucb /sbin /usr/sbin /usr/local /usr/local/bin /usr/lbin"
364pth="$pth /usr/5bin /vol/local/bin /etc /usr/bsd /usr/lib /usr/ccs/lib /usr/ccs/bin /lib"
365pth="$pth /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb"
366pth="$pth /usr/convex /usr/mmdf/bin /usr/mmdf/lib /usr/lib/mail"
367pth="$pth ${BSDBASE-/bsd}/usr/ucb ${BSDBASE-/bsd}/bin ${BSDBASE-/bsd}/usr/bin"
368# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
369# Initial import of elm 2.4 PL0 as base for elm 2.5.
370#
371# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
372# Elm 2
373#
374
375: check for out bin directory
376if test ! -d ../bin; then
377    echo "Making bin directory"
378    mkdir ../bin
379else
380    echo "Found bin directory"
381fi
382
383libswanted="intl nls"
384attrlist="$attrlist sgi"
385
386: some greps do not return status, grrr.
387echo "grimblepritz" >grimble
388if grep blurfldyick grimble >/dev/null 2>&1 ; then
389    contains=contains
390elif grep grimblepritz grimble >/dev/null 2>&1 ; then
391    contains=grep
392else
393    contains=contains
394fi
395rm -f grimble
396: the following should work in any shell
397case "$contains" in
398contains*)
399    echo " "
400    echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
401    cat >contains <<'EOSS'
402grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
403EOSS
404chmod +x contains
405esac
406
407# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
408# Initial import of elm 2.4 PL0 as base for elm 2.5.
409#
410# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
411# Elm 2
412#
413: see if sh knows # comments
414echo " "
415echo "Checking your sh to see if it knows about # comments..."
416if sh -c '#' >/dev/null 2>&1 ; then
417    echo "Your sh handles # comments correctly."
418    shsharp=true
419    spitshell=cat
420    echo " "
421    echo "Okay, let's see if #! works on this system..."
422    e=/bin/echo; test -f $e || e=/usr/bin/echo
423    echo "#!$e hi" > try
424    $eunicefix try
425    chmod +x try
426    ./try > today
427    if $contains hi today >/dev/null 2>&1; then
428	echo "It does."
429	sharpbang='#!'
430    else
431	echo "#! $e hi" > try
432	$eunicefix try
433	chmod +x try
434	./try > today
435	if test -s today; then
436	    echo "It does."
437	    sharpbang='#! '
438	else
439	    echo "It doesn't."
440	    sharpbang=': use '
441	fi
442    fi
443else
444    echo "Your sh doesn't grok # comments--I will strip them later on."
445    shsharp=false
446    echo "exec grep -v '^#'" >spitshell
447    chmod +x spitshell
448    $eunicefix spitshell
449    spitshell=`pwd`/spitshell
450    echo "I presume that if # doesn't work, #! won't work either!"
451    sharpbang=': use '
452fi
453
454: figure out how to guarantee sh startup
455echo " "
456echo "Checking out how to guarantee sh startup..."
457startsh=$sharpbang'/bin/sh'
458echo "Let's see if '$startsh' works..."
459cat >try <<EOSS
460$startsh
461set abc
462test "$?abc" != 1
463EOSS
464
465chmod +x try
466$eunicefix try
467if ./try; then
468    echo "Yup, it does."
469else
470    echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
471fi
472rm -f try today
473
474: first determine how to suppress newline on echo command
475echo "Checking echo to see how to suppress newlines..."
476(echo "hi there\c" ; echo " ") >.echotmp
477if $contains c .echotmp >/dev/null 2>&1 ; then
478    echo "...using -n."
479    n='-n'
480    c=''
481else
482    cat <<'EOM'
483...using \c
484EOM
485    n=''
486    c='\c'
487fi
488echo $n "Type carriage return to continue.  Your cursor should be here-->$c"
489rm -f .echotmp
490
491: now set up to do reads with possible shell escape and default assignment
492cat <<EOSC >myread
493case "\$fastread" in
494yes) ans=''; echo " " ;;
495*) ans='!';;
496esac
497while expr "X\$ans" : "X!" >/dev/null; do
498    read ans
499    case "\$ans" in
500    !)
501	sh
502	echo " "
503	echo $n "\$rp $c"
504	;;
505    !*)
506	set \`expr "X\$ans" : "X!\(.*\)\$"\`
507	sh -c "\$*"
508	echo " "
509	echo $n "\$rp $c"
510	;;
511    esac
512done
513rp='Your answer:'
514case "\$ans" in
515'') ans="\$dflt";;
516esac
517EOSC
518
519# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
520# Initial import of elm 2.4 PL0 as base for elm 2.5.
521#
522# Revision 1.1.1.1  1995/04/13  19:38:53  wfp5p
523# Elm 2
524#
525: general instructions
526cat <<EOH
527 
528This installation shell script will examine your system and ask you questions
529to determine how the $package package should be installed.  If you get stuck
530on a question, you may use a ! shell escape to start a subshell or execute
531a command.  Many of the questions will have default answers in square
532brackets--typing carriage return will give you the default.
533
534On some of the questions which ask for file or directory names you are
535allowed to use the ~name construct to specify the login directory belonging
536to "name", even if you don't have a shell which knows about that.  Questions
537where this is allowed will be marked "(~name ok)".
538
539EOH
540rp="[Type carriage return to continue]"
541echo $n "$rp $c"
542. myread
543cat <<EOH
544
545Much effort has been expended to ensure that this shell script will run
546on any Unix system.  If despite that it blows up on you, your best bet is
547to edit Configure and run it again. Also, let the Elm Development Group
548(elm@dsi.com) know how they blew it.  If you can't run Configure for
549some reason, you'll have to generate a config.sh file by hand.
550
551This installation script affects things in two ways: 1) it may do direct
552variable substitutions on some of the files included in this kit, and
5532) it builds a config.h file for inclusion in C programs.  You may edit
554any of these files as the need arises after running this script.
555
556If you make a mistake on a question, there is no easy way to back up to it
557currently.  The easiest thing to do is to edit config.sh and rerun all the
558SH files.  Configure will offer to let you do this before it runs the SH files.
559
560EOH
561rp="[Type carriage return to continue]"
562echo $n "$rp $c"
563. myread
564
565# Revision 1.1  1995/06/30  14:56:07  wfp5p
566# Alpha 5
567#
568: get old answers, if there is a config file out there
569if test -f ../config.sh; then
570    echo " "
571    dflt=y
572    rp="I see a config.sh file.  Did Configure make it on THIS system? [$dflt]"
573    echo $n "$rp $c"
574    . myread
575    case "$ans" in
576    n*) echo "OK, I'll ignore it.";;
577    *)  echo "Fetching default answers from your old config.sh file..."
578	tmp="$n"
579	ans="$c"
580	save_source_dir="$source_dir" save_build_dir="$build_dir"
581        . ../config.sh
582	source_dir="$save_source_dir" build_dir="$save_build_dir"
583	n="$tmp"
584	c="$ans"
585	;;
586    esac
587fi
588
589# Revision 1.2  1999/03/24  14:03:31  wfp5p
590# elm 2.5PL0
591#
592# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
593# Initial import of elm 2.4 PL0 as base for elm 2.5.
594#
595# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
596# Elm 2
597#
598: find out where common programs are
599echo " "
600echo "Locating common programs..."
601cat <<EOSC >loc
602$startsh
603case \$# in
6040) exit 1;;
605esac
606thing=\$1
607shift
608dflt=\$1
609shift
610for dir in \$*; do
611    case "\$thing" in
612    .)
613	if test -d \$dir/\$thing; then
614	    echo \$dir
615	    exit 0
616	fi
617	;;
618    *)
619	if test -f \$dir/\$thing; then
620	    echo \$dir/\$thing
621	    exit 0
622	elif test -f \$dir/\$thing.exe; then
623	    : on Eunice apparently
624	    echo \$dir/\$thing
625	    exit 0
626	fi
627	;;
628    esac
629done
630echo \$dflt
631exit 1
632EOSC
633chmod +x loc
634$eunicefix loc
635loclist="
636cat
637chgrp
638chmod
639cp
640echo
641expr
642grep
643ln
644ls
645mv
646rm
647sed
648sleep
649touch
650tr
651"
652trylist="
653Mcc
654compress
655cpp
656date
657emacs
658execmail
659ispell
660line
661lint
662lp
663lpr
664mips
665more
666nroff
667pack
668pg
669pr
670rmail
671sendmail
672shar
673smail
674submit
675tar
676tbl
677test
678troff
679uname
680uuname
681vi
682"
683for file in $loclist; do
684    xxx=`loc $file $file $pth`
685    eval $file=$xxx
686    eval _$file=$xxx
687    case "$xxx" in
688    /*)
689	echo $file is in $xxx.
690	;;
691    *)
692	echo "I don't know where $file is.  I hope it's in everyone's PATH."
693	;;
694    esac
695done
696echo " "
697echo "Don't worry if any of the following aren't found..."
698ans=offhand
699for file in $trylist; do
700    xxx=`loc $file $file $pth`
701    eval $file=$xxx
702    eval _$file=$xxx
703    case "$xxx" in
704    /*)
705	echo $file is in $xxx.
706	;;
707    *)
708	echo "I don't see $file out there, $ans."
709	ans=either
710	;;
711    esac
712done
713case "$egrep" in
714egrep)
715    echo "Substituting grep for egrep."
716    egrep=$grep
717    ;;
718esac
719case "$test" in
720test)
721    echo "Hopefully test is built into your sh."
722    ;;
723/bin/test)
724    if sh -c "PATH= test true" >/dev/null 2>&1; then
725	echo "Using the test built into your sh."
726	test=test
727    fi
728    ;;
729*)
730    test=test
731    ;;
732esac
733case "$echo" in
734echo)
735    echo "Hopefully echo is built into your sh."
736    ;;
737/bin/echo)
738    echo " "
739    echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
740    $echo $n "hi there$c" >foo1
741    echo $n "hi there$c" >foo2
742    if cmp foo1 foo2 >/dev/null 2>&1; then
743	echo "They are compatible.  In fact, they may be identical."
744    else
745	case "$n" in
746	'-n') n='' c='\c' ans='\c' ;;
747	*) n='-n' c='' ans='-n' ;;
748	esac
749	cat <<FOO
750They are not compatible!  You are probably running ksh on a non-USG system.
751I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
752have echo built in and we may have to run some Bourne shell scripts.  That
753means I'll have to use $ans to suppress newlines now.  Life is ridiculous.
754
755FOO
756	rp="Your cursor should be here-->"
757	$echo $n "$rp$c"
758	. myread
759    fi
760    $rm -f foo1 foo2
761    ;;
762*)
763    : cross your fingers
764    echo=echo
765    ;;
766esac
767rmlist="$rmlist loc"
768
769: see if date exists, if so, init c_date
770if $test ! "x$date" = "x" ; then
771    c_date=`LANGUAGE= $date`
772else
773    c_date='date was unavailable at configuration'
774fi
775
776# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
777# Initial import of elm 2.4 PL0 as base for elm 2.5.
778#
779# Revision 1.1.1.1  1995/04/13  19:38:53  wfp5p
780# Elm 2
781#
782: get calendar mode and default calendar file name
783$cat <<EOM
784
785There is a neat feature that enables scanning of the message body for
786entries to add to the users ".calendar" (or whatever) file.  These
787entries are then processed by the system program calendar.  To use
788this feature it needs to be enabled.  The name of the per user calendar
789file used by your system's calendar program is also required.
790EOM
791
792case "$d_calendar" in
793"$define") dflt=y;;
794"$undef")  dflt=n;;
795*)	   dflt=y;;
796esac
797
798rp="Enable calendar feature [$dflt]"
799$echo $n "$rp $c"
800. myread
801case "$ans" in
802y*) d_calendar="$define";;
803*)  d_calendar="$undef";;
804esac
805
806case "$calendar" in
807    '') dflt='calendar';;
808    *)  dflt=$calendar;;
809esac
810
811if $test "$d_calendar" = "$define"; then
812	echo " "
813	rp="Default calendar file: [$dflt]"
814	$echo $n "$rp $c"
815	. myread
816	calendar="$ans"
817fi
818
819# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
820# Initial import of elm 2.4 PL0 as base for elm 2.5.
821#
822# Revision 1.1.1.1  1995/04/13  19:38:53  wfp5p
823# Elm 2
824#
825: check to see if the macros are 8-bit clean, ask the user
826:
827$cat <<EOM
828
829
830Not all environments are restricted to the ASCII 7-bit character set.
831For example, the ISO 8859/1 (Latin alphabet no. 1) character set,
832consisting of 8 bits and 191 printable characters, is becoming
833more and more common, especially in non-English speaking countries.
834
835Unfortunately, not all isprint() functions or macros, which ELM
836uses to determine whether a character is printable or not, will
837handle non-ASCII (8-bit) characters properly.  It is suggested that you
838start with this value configured to handle 8-bit characters correctly
839and if there are problems with Elm aborting while displaying messages
840that use extended character sets to reconfigure Elm to only display
8417-bit characters.
842
843EOM
844
845case "$d_ascii" in
846    "$define")   dflt='n';;
847    *)  dflt='y';;
848esac
849
850echo "  "
851rp="Should Elm assume that isprint() won't break on non-ASCII characters? [$dflt]"
852$echo $n "$rp $c"
853. myread
854case "$ans" in
855    y*) d_ascii="$undef";;
856    *) d_ascii="$define";;
857esac
858
859# Revision 1.2  1995/06/08  15:44:41  wfp5p
860# Changes to configure for AIX
861#
862# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
863# Initial import of elm 2.4 PL0 as base for elm 2.5.
864#
865# Revision 1.1.1.1  1995/04/13  19:38:53  wfp5p
866# Elm 2
867#
868: make some quick guesses about what we are up against
869echo " "
870$echo $n "Hmm...  $c"
871if $test -f "$uname"; then
872    uname_os=`$uname -s`
873    uname_rel=`$uname -r`
874    uname_rel=`expr "$uname_rel" : "\(...\).*"`
875else
876    uname_os=unknown
877    uname_rel=unknown
878fi
879cat /usr/include/signal.h /usr/include/sys/signal.h >foo
880if test `echo abc | tr a-z A-Z` = Abc ; then
881
882    if $test "$uname_os" = "AIX" ; then
883        echo "Looks like an AIX system, but we'll see.."
884	echo exit 0 >bsd
885	echo exit 1 >usg
886	echo exit 1 >v7
887    else
888       echo "Looks kind of like a USG system, but we'll see..."
889       echo exit 1 >bsd
890       echo exit 0 >usg
891       echo exit 1 >v7
892    fi
893elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
894    if $test "(" "$uname_os" = "SunOS" -a "$uname_rel" = "4.1" ")" ; then
895	echo "Looks like SunOs 4.1, a USG system, but we'll see..."
896	echo exit 1 >bsd
897	echo exit 0 >usg
898	echo exit 1 >v7
899    elif $test "$uname_os" = "OSF1" ; then
900	echo "Looks like an OSF/1 system, but we'll see.."
901	echo exit 1 >bsd
902	echo exit 1 >usg
903	echo exit 1 >v7
904    elif $test "$uname_os" = "HP-UX" ; then
905	echo "Looks like an HP-UX system, but we'll see.."
906	echo exit 1 >bsd
907	echo exit 0 >usg
908	echo exit 1 >v7
909    else
910	echo "Looks kind of like a BSD system, but we'll see..."
911	echo exit 0 >bsd
912	echo exit 0 >usg
913	echo exit 1 >v7
914    fi
915else
916    echo "Looks kind of like a version 7 system, but we'll see..."
917    echo exit 1 >bsd
918    echo exit 1 >usg
919    echo exit 0 >v7
920fi
921case "$eunicefix" in
922*unixtovms*)
923    cat <<'EOI'
924There is, however, a strange, musty smell in the air that reminds me of
925something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
926EOI
927    echo "exit 0" >eunice
928    d_eunice="$define"
929    ;;
930*)
931    echo " "
932    echo "Congratulations.  You aren't running Eunice."
933    d_eunice="$undef"
934    echo "exit 1" >eunice
935    ;;
936esac
937if test -f /xenix; then
938    echo "Actually, this looks more like a XENIX system..."
939    echo "exit 0" >xenix
940else
941    echo " "
942    echo "It's not Xenix..."
943    echo "exit 1" >xenix
944fi
945chmod +x xenix
946$eunicefix xenix
947if test -f /venix; then
948    echo "Actually, this looks more like a VENIX system..."
949    echo "exit 0" >venix
950else
951    echo " "
952    if xenix; then
953	: null
954    else
955	echo "Nor is it Venix..."
956    fi
957    echo "exit 1" >venix
958fi
959chmod +x bsd usg v7 eunice venix
960$eunicefix bsd usg v7 eunice venix
961rm -rf foo
962rmlist="$rmlist bsd usg v7 eunice venix xenix"
963
964# Revision 1.2  1995/06/12  20:30:51  wfp5p
965# Made the Ultrix fflush check automatic
966# Changed gcc options
967#
968# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
969# Initial import of elm 2.4 PL0 as base for elm 2.5.
970#
971# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
972# Elm 2
973#
974: find out how to find out full name
975echo " "
976case "$d_berknames" in
977"$define")
978    dflt=y;;
979"$undef")
980    dflt=n;;
981*)
982	dflt=y
983    ;;
984esac
985echo "Does your /etc/passwd file keep full names in Berkeley/V7 format (name first"
986$echo $n "thing after ':' in GCOS field)? [$dflt] $c"
987rp="Berkeley/V7 format full name? [$dflt]"
988. myread
989case "$ans" in
990  y*)
991    d_passnames="$define"
992    d_berknames="$define"
993    d_usgnames="$undef"
994    nametype=bsd
995    ;;
996  *)
997    echo " "
998    case "$d_usgnames" in
999    "$define")
1000	dflt=y;;
1001    "$undef")
1002	dflt=n;;
1003    *)
1004	if usg; then
1005	    dflt=y
1006	else
1007	    dflt=n
1008	fi
1009	;;
1010    esac
1011    echo "Does your passwd file keep full names in USG format (name sandwiched"
1012    $echo $n "between a '-' and a '(')? [$dflt] $c"
1013    rp="USG format full name? [$dflt]"
1014    . myread
1015    case "$ans" in
1016      n*)
1017	echo "Full name will be taken from ~/.fullname"
1018	d_passnames="$undef"
1019	d_berknames="$undef"
1020	d_usgnames="$undef"
1021	nametype=other
1022	;;
1023      *)
1024	d_passnames="$define"
1025	d_berknames="$undef"
1026	d_usgnames="$define"
1027	nametype=usg
1028	;;
1029    esac
1030    ;;
1031esac
1032
1033: see if we have to deal with yellow pages, if so, put sun
1034: library first, as the yp password routines must override
1035: the c library ones
1036if $test -d /usr/etc/yp || $test -d /etc/yp; then
1037    if $test "$passcat" = "ypcat passwd"; then
1038	dflt=y
1039    elif $contains '^\+:' /etc/passwd >/dev/null; then
1040	dflt=y
1041    else
1042	dflt=n
1043    fi
1044    rp="Are you getting the passwd file via yellow pages? [$dflt]"
1045    $echo $n "$rp $c"
1046    . myread
1047    case "$ans" in
1048    y*) passcat='ypcat passwd'
1049	case "$libswanted" in
1050	'') libswanted='sun c_s';;
1051	*)  libswanted=`$echo "$libswanted" | $sed -e 's/sun //g'`
1052	    libswanted="sun $libswanted";;
1053	esac
1054	;;
1055    *) passcat='cat /etc/passwd';;
1056    esac
1057else
1058    passcat='cat /etc/passwd'
1059fi
1060
1061: set up shell script to do ~ expansion
1062cat >filexp <<EOSS
1063$startsh
1064: expand filename
1065case "\$1" in
1066 ~/*|~)
1067    echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
1068    ;;
1069 ~*)
1070    if $test -f /bin/csh; then
1071	/bin/csh -f -c "glob \$1"
1072	echo ""
1073    else
1074	name=\`$expr x\$1 : '..\([^/]*\)'\`
1075	dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
1076	if $test ! -d "\$dir"; then
1077	    me=\`basename \$0\`
1078	    echo "\$me: can't locate home directory for: \$name" >&2
1079	    exit 1
1080	fi
1081	case "\$1" in
1082	*/*)
1083	    echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
1084	    ;;
1085	*)
1086	    echo \$dir
1087	    ;;
1088	esac
1089    fi
1090    ;;
1091*)
1092    echo \$1
1093    ;;
1094esac
1095EOSS
1096chmod +x filexp
1097$eunicefix filexp
1098
1099# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
1100# Initial import of elm 2.4 PL0 as base for elm 2.5.
1101#
1102# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
1103# Elm 2
1104#
1105# determine text processor to use, default to troff if found.
1106case "$roff" in
1107'')
1108    if $test -n "$troff"; then
1109	dflt="$troff"
1110    else
1111	dflt=$nroff
1112    fi
1113    ;;
1114*)  dflt="$roff";;
1115esac
1116$cat <<EOM
1117
1118The Elm documentation (Reference Guide, Configuration Guide, etc.) is set up
1119for troff.  If you only have nroff, it can be used, but the documentation will
1120not be as readable.  If you use an alternate processor for troff/nroff
1121documents it can be specified here.  Elm expects the text processor to write
1122to standard out.  You will be given a chance to provide command line options
1123to this command in the next question.
1124
1125EOM
1126cont=true
1127while $test "$cont" ; do
1128    echo " "
1129    echo "Give the name of the program used to format the Elm documentation on"
1130    $echo $n "your system: [$dflt] $c"
1131    rp="Preferred Elm documentation formatter program: [$dflt]"
1132    . myread
1133    roff=$ans;
1134    if $test -f "$ans"; then
1135	cont=''
1136    else
1137	lookup=`loc "$ans" "" . $pth`
1138	if $test -f "$lookup"; then
1139	    cont=''
1140	    roff=$lookup
1141	else
1142	    if $test "$fastread" = yes; then
1143		dflt=y
1144	    else
1145		dflt=n
1146	    fi
1147	    echo "Text processor $ans doesn't exist."
1148	    rp="Use that name anyway? [$dflt]"
1149	    $echo $n "$rp $c"
1150	    . myread
1151	    dflt=''
1152	    case "$ans" in
1153	    y*) cont='';;
1154	    esac
1155	fi
1156    fi
1157done
1158
1159# determine text processor flags to use.
1160$cat <<EOM
1161
1162If this text processor requires any options for proper formatting, specify
1163them here.  To specify no options, enter the word "none".  Some versions
1164of troff require the -t option to write to standard out.  This is the
1165proper place to specify that option.
1166
1167EOM
1168dflt="$roffopts"
1169rp="What options should Elm use with $roff: [$dflt]"
1170$echo $n "$rp $c"
1171. myread
1172roffopts=$ans
1173case "$roffopts" in
1174'none') roffopts=''
1175     ;;
1176esac
1177
1178# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
1179# Initial import of elm 2.4 PL0 as base for elm 2.5.
1180#
1181# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
1182# Elm 2
1183#
1184: determine where manual pages go
1185$cat <<EOM
1186
1187$package has manual pages that can be installed in unformatted or formatted form.
1188Either or both (or neither) of these may be installed.
1189
1190Please give the location in which to store each type of man page.
1191To specify that a particular type is not to be installed, answer "none"
1192to the question.
1193
1194EOM
1195case "$mansrc" in
1196'')
1197    dflt="/usr/man/mann /usr/man/manl /usr/man/man.L /usr/man/local/man1"
1198    dflt="$dflt /usr/man/l_man/man1 /usr/local/man/u_man/man1"
1199    dflt="$dflt /usr/local/man/l_man/man1 /usr/man/man1 /usr/man/u_man/man1"
1200    dflt="$dflt /usr/share/man/man1 /usr/share/man/manl"
1201    dflt=`loc . none $dflt`
1202    ;;
1203*)  dflt="$mansrc"
1204    ;;
1205esac
1206cont=true
1207while $test "$cont" ; do
1208    echo " "
1209    rp="Where do the unformatted manual pages go? [$dflt]"
1210    $echo $n "$rp $c"
1211    . myread
1212    mansrc=`filexp "$ans"`
1213    if $test "$mansrc" = none -o -d "$mansrc"; then
1214	cont=''
1215    else
1216	if $test "$fastread" = yes; then
1217	    dflt=y
1218	else
1219	    dflt=n
1220	fi
1221	rp="Directory $mansrc doesn't exist.  Use that name anyway? [$dflt]"
1222	$echo $n "$rp $c"
1223	. myread
1224	dflt=''
1225	case "$ans" in
1226	y*) cont='';;
1227	esac
1228    fi
1229done
1230
1231# determine the extension for man pages
1232if $test "$mansrc" != none ; then
1233    case "$manext" in
1234    '')
1235	if $test "$manext_choice" = none; then
1236	    dflt=none
1237	else
1238	    case "$mansrc" in
1239	    *l) dflt=.l ;;
1240	    *n) dflt=.n ;;
1241	    *L) dflt=.L ;;
1242	    *)  dflt=.1 ;;
1243	    esac
1244	fi
1245	;;
1246    .*)	dflt="$manext";;
1247    *)  dflt=".$manext";;
1248    esac
1249
1250    $cat <<EOM
1251
1252The installed unformatted manual pages can have various extensions to suit the
1253conventions of the host operating system, for example "page.1".
1254
1255Note that the period '.' must be included as part of the extension.
1256
1257To specify no extension, enter the word "none".
1258
1259EOM
1260    rp="What extension should be used on installed unformatted man pages: [$dflt]"
1261    $echo $n "$rp $c"
1262    . myread
1263    manext=$ans
1264    manext_choice=$ans
1265    case "$manext" in
1266    'none')
1267	manext=''
1268	;;
1269    esac
1270    fi
1271
1272# Now the formatted man pages ala System V
1273case "$catmansrc" in
1274'')
1275    dflt="/usr/man/catn /usr/man/catl /usr/catman/man.L /usr/catman/local/man1"
1276    dflt="$dflt /usr/local/catman/u_man/man1 /usr/local/catman/l_man/man1"
1277    dflt="$dflt /usr/catman/l_man/man1 /usr/man/cat1 /usr/catman/man1"
1278    dflt="$dflt /usr/catman/u_man/man1 /usr/catman/URM/g1"
1279    dflt="$dflt /usr/share/man/cat1 /usr/share/man/catl"
1280    dflt=`loc . none $dflt`
1281    ;;
1282*)  dflt="$catmansrc"
1283    ;;
1284esac
1285cont=true
1286while $test "$cont" ; do
1287    echo " "
1288    rp="Where do the formatted manual pages go? [$dflt]"
1289    $echo $n "$rp $c"
1290    . myread
1291    catmansrc=`filexp "$ans"`
1292    if $test "$catmansrc" = none -o -d "$catmansrc"; then
1293	cont=''
1294    else
1295	if $test "$fastread" = yes; then
1296	    dflt=y
1297	else
1298	    dflt=n
1299	fi
1300	rp="Directory $catmansrc doesn't exist.  Use that name anyway? [$dflt]"
1301	$echo $n "$rp $c"
1302	. myread
1303	dflt=''
1304	case "$ans" in
1305	y*) cont='';;
1306	esac
1307    fi
1308done
1309
1310# if installing formatted manual pages, determine a number of other things.
1311if $test "$catmansrc" != none ; then
1312#       determine text processor to use, default to nroff if found.
1313    case "$manroff" in
1314    '')
1315	if $test -n "$nroff"; then
1316	    dflt="$nroff"
1317	else
1318	    dflt=$troff
1319	fi
1320	;;
1321    *)  dflt="$manroff";;
1322    esac
1323    $cat <<EOM
1324
1325Online manual pages are generally formatted with nroff.  If you use an
1326alternate text processor for on-line manual pages it can be specified here.
1327Elm expects the text processor to write to standard out.
1328
1329Note: This does not effect the formatter previously chosen for the Elm
1330      Elm documentation (Reference Guide, Configuration Guide, etc.).
1331
1332EOM
1333    cont=true
1334    while $test "$cont" ; do
1335	echo " "
1336	echo "Give the name of the program used to format on-line manual pages"
1337	$echo $n "on your system: [$dflt] $c"
1338	rp="Preferred manual page formatter: [$dflt]"
1339	. myread
1340	manroff=$ans;
1341	if $test -f "$ans"; then
1342	    cont=''
1343	else
1344	    lookup=`loc "$ans" "" . $pth`
1345	    if $test -f "$lookup"; then
1346		cont=''
1347		manroff=$lookup
1348	    else
1349		if $test "$fastread" = yes; then
1350		    dflt=y
1351  		else
1352  		    dflt=n
1353  		fi
1354		echo "Text processor $ans doesn't exist."
1355		rp="Use that name anyway? [$dflt]"
1356		$echo $n "$rp $c"
1357		. myread
1358		dflt=''
1359		case "$ans" in
1360		y*) cont='';;
1361		esac
1362	    fi
1363	fi
1364    done
1365
1366    # determine text processor flags to use.
1367    $cat <<EOM
1368
1369If this text processor requires any options for proper formatting, specify
1370then here.  To specify no options, enter the word "none".
1371
1372EOM
1373    dflt="$manroffopts"
1374    rp="What options should Elm use with $manroff: [$dflt]"
1375    $echo $n "$rp $c"
1376    . myread
1377    manroffopts=$ans
1378    case "$manroffopts" in
1379    'none') manroffopts=''
1380	;;
1381    esac
1382
1383    # determine the extension for catman pages
1384    case "$catmanext" in
1385    '')
1386	if $test "$catmanext_choice" = none; then
1387	    dflt=none
1388	else
1389	    case "$manext" in
1390	    .*) dflt=$manext ;;
1391	    *)
1392		if $test "$manext_choice" = none; then
1393		    dflt=none
1394		else
1395	            case "$catmansrc" in
1396	            *l) dflt=.l ;;
1397	            *n) dflt=.n ;;
1398	            *L) dflt=.L ;;
1399	            *g1) dflt=none ;;
1400	            *)  dflt=.1 ;;
1401	            esac
1402		fi
1403	    esac
1404	fi
1405	;;
1406    .*)	dflt="$catmanext";;
1407    *)  dflt=".$catmanext";;
1408    esac
1409
1410    $cat <<EOM
1411
1412The installed formatted manual pages can have various extensions to suit the
1413conventions of the host operating system, for example "page.1".
1414
1415Note that the period '.' must be included as part of the extension.
1416
1417To specify no extension, enter the word "none".
1418
1419EOM
1420    rp="What extension should be used on installed formatted man pages: [$dflt]"
1421    $echo $n "$rp $c"
1422    . myread
1423    catmanext=$ans
1424    catmanext_choice=$ans
1425    case "$catmanext" in
1426    'none')
1427	catmanext=''
1428	;;
1429    esac
1430
1431    if $test -f $pack -o -f $compress ; then
1432#	See if the formatted manual pages are to be packed or compressed
1433	if $test -f $pack; then
1434	    $cat <<EOM
1435
1436The formatted manual pages may be packed (.z suffix) or compressed (.Z
1437suffix) or left unpacked on your system.  The next two questions will deal
1438with how you want the formatted manual pages installed.  Answering no to
1439both packed and compressed will leave them unpacked.  Only one of packed
1440or compressed can be chosen.
1441
1442EOM
1443	    case "$suffix" in
1444	    .Z) dflt=n;;
1445	    .z) dflt=y;;
1446	    *)  if [ "$catmansrc/*.z" != "`$echo $catmansrc/*.z`" ]; then
1447		    dflt=y
1448		else
1449		    dflt=n
1450		fi ;;
1451	    esac
1452	    rp="Should the formatted manual pages be packed? [$dflt]"
1453	    $echo $n "$rp $c"
1454	    . myread
1455	    case "$ans" in
1456	    y*) packed=y
1457		suffix=.z
1458		packer="$pack -f" ;;
1459	    *)  packed=n ;;
1460	    esac
1461	fi
1462
1463	if $test -f $compress -a "$suffix" != ".z" ; then
1464	    case "$suffix" in
1465	    .z) dflt=n;;
1466	    .Z) dflt=y;;
1467	    *)  if [ "$catmansrc/*.Z" != "`$echo $catmansrc/*.Z`" ]; then
1468		    dflt=y
1469		else
1470		    dflt=n
1471		fi ;;
1472	    esac
1473	    rp="Should the formatted manual pages be compressed? [$dflt]"
1474	    $echo $n "$rp $c"
1475	    . myread
1476	    case "$ans" in
1477	    y*) packed=y
1478		suffix=.Z
1479		packer="$compress" ;;
1480	    *)  packed=n ;;
1481	    esac
1482	fi
1483
1484	if $test "$packed" = 'n' ; then
1485	    suffix=''
1486	    packer=''
1487	fi
1488    else
1489	packed=''
1490	suffix=''
1491	packer=''
1492    fi
1493
1494fi
1495
1496# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
1497# Initial import of elm 2.4 PL0 as base for elm 2.5.
1498#
1499# Revision 1.1.1.1  1995/04/13  19:38:56  wfp5p
1500# Elm 2
1501#
1502: default clear to no extra flags
1503xencf=
1504xenlf=
1505d_xenix="$undef"
1506d_bsd="$undef"
1507: see if we are xenix
1508if xenix; then
1509    d_xenix="$define"
1510:	now are we a 286
1511    case "`$uname -p`" in
1512	i80286)
1513		xencf="-LARGE -Ml2et32"
1514		xenlf="-Ml2t32 -F 5600 -SEG 512"
1515      esac
1516fi
1517if bsd; then
1518    d_bsd="$define"
1519fi
1520
1521# Revision 1.4  1995/06/12  20:30:50  wfp5p
1522# Made the Ultrix fflush check automatic
1523# Changed gcc options
1524#
1525# Revision 1.3  1995/04/26  18:49:47  wfp5p
1526# Changed Configure to allow a different install path
1527#
1528# Revision 1.2  1995/04/21  13:30:07  wfp5p
1529# Added a note about -DULTRIX_FFLUSH_BUG
1530#
1531# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
1532# Initial import of elm 2.4 PL0 as base for elm 2.5.
1533#
1534# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
1535# Elm 2
1536#
1537: see what memory models we can support
1538case "$models" in
1539'')
1540    : We may not use Cppsym or we get a circular dependency through cc.
1541    : But this should work regardless of which cc we eventually use.
1542    cat >pdp11.c <<'EOP'
1543main() {
1544#ifdef pdp11
1545    exit(0);
1546#else
1547    exit(1);
1548#endif
1549}
1550EOP
1551    cc -o pdp11 pdp11.c >/dev/null 2>&1
1552    if pdp11 2>/dev/null; then
1553	dflt='unsplit split'
1554    else
1555	ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1556	case "$ans" in
1557	X) dflt='none';;
1558	*)  if $test -d /lib/small || $test -d /usr/lib/small; then
1559		dflt='small'
1560	    else
1561		dflt=''
1562	    fi
1563	    if $test -d /lib/medium || $test -d /usr/lib/medium; then
1564		dflt="$dflt medium"
1565	    fi
1566	    if $test -d /lib/large || $test -d /usr/lib/large; then
1567		dflt="$dflt large"
1568	    fi
1569	    if $test -d /lib/huge || $test -d /usr/lib/huge; then
1570		dflt="$dflt huge"
1571	    fi
1572	esac
1573    fi
1574    ;;
1575*)  dflt="$models" ;;
1576esac
1577if $test -z "$xencf" ; then
1578$cat <<EOM
1579
1580Some systems have different model sizes.  On most systems they are called
1581small, medium, large, and huge.  On the PDP11 they are called unsplit and
1582split.  If your system doesn't support different memory models, say "none".
1583If you wish to force everything to one memory model, say "none" here and
1584put the appropriate flags later when it asks you for other cc and ld flags.
1585Xenix and Venix systems may wish to put "none" and let the compiler figure
1586things out.
1587(In the following question multiple model names should be space separated.)
1588
1589EOM
1590rp="Which models are supported? [$dflt]"
1591$echo $n "$rp $c"
1592. myread
1593models="$ans"
1594
1595case "$models" in
1596none)
1597    small=''
1598    medium=''
1599    large=''
1600    huge=''
1601    unsplit=''
1602    split=''
1603    ;;
1604*split)
1605    case "$split" in
1606    '')
1607	if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
1608	   $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
1609	    dflt='-i'
1610	else
1611	    dflt='none'
1612	fi
1613	;;
1614    *) dflt="$split";;
1615    esac
1616    rp="What flag indicates separate I and D space? [$dflt]"
1617    $echo $n "$rp $c"
1618    . myread
1619    case "$ans" in
1620    none) ans='';;
1621    esac
1622    split="$ans"
1623    unsplit=''
1624    ;;
1625*large*|*small*|*medium*|*huge*)
1626    case "$models" in
1627    *large*)
1628	case "$large" in
1629	'') dflt='-Ml';;
1630	*) dflt="$large";;
1631	esac
1632	rp="What flag indicates large model? [$dflt]"
1633	$echo $n "$rp $c"
1634	. myread
1635	case "$ans" in
1636	none) ans='';
1637	esac
1638	large="$ans"
1639	;;
1640    *) large='';;
1641    esac
1642    case "$models" in
1643    *huge*)
1644	case "$huge" in
1645	'') dflt='-Mh';;
1646	*) dflt="$huge";;
1647	esac
1648	rp="What flag indicates huge model? [$dflt]"
1649	$echo $n "$rp $c"
1650	. myread
1651	case "$ans" in
1652	none) ans='';
1653	esac
1654	huge="$ans"
1655	;;
1656    *) huge="$large";;
1657    esac
1658    case "$models" in
1659    *medium*)
1660	case "$medium" in
1661	'') dflt='-Mm';;
1662	*) dflt="$medium";;
1663	esac
1664	rp="What flag indicates medium model? [$dflt]"
1665	$echo $n "$rp $c"
1666	. myread
1667	case "$ans" in
1668	none) ans='';
1669	esac
1670	medium="$ans"
1671	;;
1672    *) medium="$large";;
1673    esac
1674    case "$models" in
1675    *small*)
1676	case "$small" in
1677	'') dflt='none';;
1678	*) dflt="$small";;
1679	esac
1680	rp="What flag indicates small model? [$dflt]"
1681	$echo $n "$rp $c"
1682	. myread
1683	case "$ans" in
1684	none) ans='';
1685	esac
1686	small="$ans"
1687	;;
1688    *) small='';;
1689    esac
1690    ;;
1691*)
1692    echo "Unrecognized memory models--you may have to edit Makefile.SH"
1693    ;;
1694esac
1695fi
1696
1697: see if we need a special compiler
1698echo " "
1699if usg; then
1700    case "$cc" in
1701    '')
1702	case "$Mcc" in
1703	/*) dflt='Mcc'
1704	    ;;
1705	*)
1706	    case "$large" in
1707	    -M*)
1708		dflt='cc'
1709		;;
1710	    *)
1711		if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1712		    dflt='cc -M'
1713		else
1714		    dflt='cc'
1715		fi
1716		;;
1717	    esac
1718	    ;;
1719	esac
1720	;;
1721    *)  dflt="$cc";;
1722    esac
1723    $cat <<'EOM'
1724
1725On some systems the default C compiler will not resolve multiple global
1726references that happen to have the same name.  On some such systems the
1727"Mcc" command may be used to force these to be resolved.  On other systems
1728a "cc -M" command is required.  (Note that the -M flag on other systems
1729indicates a memory model to use!)  If you have the Gnu C compiler, you
1730might wish to use that instead.
1731EOM
1732    $echo $n "What command will force resolution on this system? [$dflt] $c"
1733    rp="Command to resolve multiple refs? [$dflt]"
1734    . myread
1735    cc="$ans"
1736else
1737    case "$cc" in
1738    '') dflt=cc;;
1739    *) dflt="$cc";;
1740    esac
1741    rp="Use which C compiler? [$dflt]"
1742    $echo $n "$rp $c"
1743    . myread
1744    cc="$ans"
1745fi
1746case "$cc" in
1747gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
1748esac
1749
1750: determine optimize, if desired, or use for debug flag also
1751case "$optimize" in
1752' ') dflt="none"
1753     ;;
1754'') dflt="-O";
1755    ;;
1756*)  dflt="$optimize"
1757    ;;
1758esac
1759cat <<EOH
1760
1761Some C compilers have problems with their optimizers, by default, $package
1762compiles with the -O flag to use the optimizer.  Alternately, you might
1763want to use the symbolic debugger, which uses the -g flag (on traditional
1764UNIX systems).  Either flag can be specified here.  To use neither flag,
1765specify the word "none".
1766
1767EOH
1768rp="What optimizer/debugger flag should be used? [$dflt]"
1769$echo $n "$rp $c"
1770. myread
1771optimize="$ans"
1772case "$optimize" in
1773'none') optimize=" "
1774     ;;
1775esac
1776
1777case "$ccflags" in
1778'') case "$cc" in
1779    *gcc*) dflt='-fpcc-struct-return';;
1780    *) dflt='';;
1781    esac
1782    ;;
1783*) dflt="$ccflags";;
1784esac
1785for thisincl in $inclwanted; do
1786    if test -d $thisincl; then
1787	case "$dflt" in
1788	*$thisincl*);;
1789	*) dflt="$dflt -I$thisincl";;
1790	esac
1791    fi
1792done
1793case "$optimize" in
1794-g*)
1795    case "$dflt" in
1796    *DEBUG*);;
1797    *) dflt="$dflt -DDEBUG";;
1798    esac
1799    ;;
1800esac
1801case "$dflt" in
1802'') dflt=none;;
1803esac
1804if $test -n "$xencf" ; then
1805    $echo "Xenix 286 system, using compiler flags $xencf"
1806    $echo "do not respecify these flags below."
1807    $echo ""
1808fi
1809cat <<EOH
1810
1811Your C compiler may want other flags.  For this question you should
1812include -I/whatever and -DWHATEVER flags and any other flags used by
1813the C compiler, but you should NOT include libraries or ld flags like
1814-lwhatever.  If you want elm to honor its debug flag, add -DDEBUG.
1815
1816To use no flags, specify the word "none".
1817
1818EOH
1819rp="Any additional cc flags? [$dflt]"
1820$echo $n "$rp $c"
1821. myread
1822case "$ans" in
1823none) ans='';
1824esac
1825ccflags="$ans"
1826
1827: the following weeds options from ccflags that are of no interest to cpp
1828cppflags="$ccflags"
1829case "$cppflags" in
1830'');;
1831*)  set X $cppflags
1832    cppflags=''
1833    for flag
1834    do
1835	case $flag in
1836	-D*|-I*|-U*) cppflags="$cppflags $flag";;
1837	esac
1838    done
1839    case "$cppflags" in
1840    *-*)  echo "(C preprocessor flags: $cppflags)";;
1841    esac
1842    ;;
1843esac
1844
1845if $test -n "$xenlf" ; then
1846    $echo "Xenix 286 system, using linker flags $xenlf"
1847    $echo "do not respecify these flags below"
1848    $echo ""
1849fi
1850case "$ldflags" in
1851'') if venix; then
1852	dflt='-i -z'
1853    else
1854	dflt='none'
1855    fi
1856    ;;
1857*) dflt="$ldflags";;
1858esac
1859cat <<EOH
1860
1861Your linker/loader may want other flags.  For example, you might
1862want to enable support for the symbolic debugger (-g on traditional
1863UNIX systems).  For this question you should specify those flags.
1864Do NOT specify libraries (-lwhatever) here.  Most systems will not
1865need any special flags, in which case specify "none".
1866
1867EOH
1868rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1869$echo $n "$rp $c"
1870. myread
1871case "$ans" in
1872none) ans='';
1873esac
1874ldflags="$ans"
1875rmlist="$rmlist pdp11"
1876
1877echo " "
1878echo "Checking for optional libraries..."
1879case "$libs" in
1880'') dflt='';;
1881*) dflt="$libs";;
1882esac
1883case "$libswanted" in
1884'') libswanted='c_s';;
1885esac
1886for thislib in $libswanted; do
1887    case "$thislib" in
1888    dbm) thatlib=ndbm;;
1889    *_s) thatlib=NONE;;
1890    *) thatlib="${thislib}_s";;
1891    *) thatlib=NONE;;
1892    esac
1893    xxx=`loc lib$thislib.a X /usr/lib /usr/ccs/lib /usr/local/lib /lib`
1894    if test -f $xxx; then
1895	echo "Found -l$thislib."
1896	case "$dflt" in
1897	*-l$thislib*|*-l$thatlib*);;
1898	*) dflt="$dflt -l$thislib";;
1899	esac
1900    else
1901	xxx=`loc lib$thislib.a X $libpth`
1902	if test -f $xxx; then
1903	    echo "Found $xxx."
1904	    case "$dflt" in
1905	    *$xxx*);;
1906	    *) dflt="$dflt $xxx";;
1907	    esac
1908	else
1909	    xxx=`loc Slib$thislib.a X $xlibpth`
1910	    if test -f $xxx; then
1911		echo "Found -l$thislib."
1912		case "$dflt" in
1913		*-l$thislib*|*-l$thatlib*);;
1914		*) dflt="$dflt -l$thislib";;
1915		esac
1916	    else
1917		echo "No -l$thislib."
1918	    fi
1919	fi
1920    fi
1921done
1922set X $dflt
1923shift
1924dflt="$*"
1925if $test "$uname_os" = "QNX" ; then
1926  dflt="$dflt -lunix"
1927fi
1928case "$dflt" in
1929'') dflt='none';;
1930esac
1931
1932$cat <<EOM
1933
1934Some versions of UNIX support shared libraries, which make
1935executables smaller but make load time slightly longer.
1936
1937On some systems, mostly newer UNIX System V's, the shared library
1938is included by putting the option "-lc_s" as the last thing on the
1939cc command line when linking.  Other systems use shared libraries
1940by default.  There may be other libraries needed to compile $package
1941on your machine as well.  If your system needs the "-lc_s" option,
1942include it here.  Include any other special libraries here as well.
1943Say "none" for none.
1944EOM
1945
1946echo " "
1947rp="Any additional libraries? [$dflt]"
1948$echo $n "$rp $c"
1949. myread
1950case "$ans" in
1951none) ans='';
1952esac
1953libs="$ans"
1954
1955# Revision 1.4  1999/03/24  14:03:33  wfp5p
1956# elm 2.5PL0
1957#
1958# Revision 1.3  1997/10/20  20:23:50  wfp5p
1959# Better Linux support
1960#
1961# Revision 1.2  1996/03/14  17:27:15  wfp5p
1962# Alpha 9
1963#
1964# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
1965# Initial import of elm 2.4 PL0 as base for elm 2.5.
1966#
1967# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
1968# Elm 2
1969#
1970: get list of predefined functions in a handy place
1971echo " "
1972case "$libc" in
1973'') if test -d /usr/apollo; then
1974	libc=/lib/libc
1975    else
1976	libc=unknown
1977    fi
1978    ;;
1979'/lib/libc /lib/clib')
1980    libc=/lib/libc
1981    ;;
1982esac
1983case "$mips" in
1984'') mips=false;;
1985'mips') mips=false;;
1986esac
1987uname_os=`$uname -s`
1988case "$nm_opts" in
1989'') if test -f /mach_boot; then
1990	nm_opts=''
1991
1992    elif $test "$uname_os" = "Linux" ; then
1993           nm_opts='-p'
1994    elif $test "$uname_os" = "AIX" ; then
1995       uname_ver=`$uname -v`
1996       if $test "$uname_ver" = "4" ; then
1997         nm_opts='-pB'
1998       else
1999         nm_opts='-p'
2000       fi
2001    elif test -d /usr/ccs/lib; then
2002	nm_opts='-p'
2003    elif "$mips"; then
2004	nm_opts='-B'
2005    else
2006	nm_opts=''
2007    fi
2008    ;;
2009esac
2010: on mips, we DO NOT want /lib, and we want inclPath/usr/lib
2011case "$libpth" in
2012'') if "$mips"; then
2013	libpth='$inclPath/usr/lib /usr/local/lib'
2014	nm_opts='-B'
2015    else
2016	libpth='/usr/ccs/lib /lib /usr/lib /usr/ucblib /usr/local/lib'
2017    fi
2018    ;;
2019esac
2020case "$libs" in
2021*-lc_s*) libc=`./loc libc_s.a $libc $libpth`
2022esac
2023libnames='';
2024case "$libs" in
2025'') ;;
2026*)  for thislib in $libs; do
2027	case "$thislib" in
2028	-l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
2029	    try=`./loc lib$thislib.a blurfl/dyick $libpth`
2030	    if test ! -f $try; then
2031		try=`./loc lib$thislib blurfl/dyick $libpth`
2032		if test ! -f $try; then
2033		    try=`./loc $thislib blurfl/dyick $libpth`
2034		    if test ! -f $try; then
2035			try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
2036			if test ! -f $try; then
2037			    try=''
2038			fi
2039		    fi
2040		fi
2041	    fi
2042	    libnames="$libnames $try"
2043	    ;;
2044	*) libnames="$libnames $thislib" ;;
2045	esac
2046    done
2047    ;;
2048esac
2049
2050if $test "$uname_os" = "Linux" ; then
2051    echo "You've got Linux, using /usr/lib/libc.a"
2052    libc=/usr/lib/libc.a
2053else
2054set /usr/ccs/lib/libc.so
2055test -f $1 || set /usr/lib/libc.a
2056test -f $1 || set /usr/lib/libc.so
2057test -f $1 || set /usr/lib/libc.so.[0-9]*
2058test -f $1 || set /lib/libsys_s.a
2059eval set \$$#
2060if test -f "$1"; then
2061    echo "Your shared C library is in $1."
2062    libc="$1"
2063elif test -f "$libc"; then
2064    echo "Your C library is in $libc."
2065elif test -f /lib/libc.a; then
2066    echo "Your C library is in /lib/libc.a.  You're normal."
2067    libc=/lib/libc.a
2068else
2069    if   ans=`./loc libc.a  blurfl/dyick $libpth`; test -f "$ans"; then
2070	:
2071    elif ans=`./loc libc    blurfl/dyick $libpth`; test -f "$ans"; then
2072	    libnames="$libnames "`./loc clib blurfl/dyick $libpth`
2073    elif ans=`./loc clib    blurfl/dyick $libpth`; test -f "$ans"; then
2074	:
2075    elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
2076	:
2077    elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
2078	:
2079    elif ans=`./loc Llibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
2080	:
2081    fi
2082    if test -f "$ans"; then
2083	echo "Your C library is in $ans, of all places."
2084	libc=$ans
2085    else
2086	cat <<EOM
2087
2088I can't seem to find your C library.  I've looked in the following places:
2089
2090	$libpth
2091
2092None of these seems to contain your C library.  What is the full name
2093EOM
2094	dflt=None
2095	$echo $n "of your C library? $c"
2096	rp='C library full name?'
2097	. myread
2098	libc="$ans"
2099    fi
2100fi
2101fi
2102echo " "
2103if test $libc = "/lib/libc"; then
2104    libc="$libc /lib/clib"
2105fi
2106set `echo $libc $libnames | tr ' ' '\012' | sort | uniq`
2107$echo $n "Extracting names from $* for later perusal...$c"
2108nm $nm_opts $* 2>/dev/null >libc.tmp
2109$sed -n -e 's/^.* [ATDSUW]  *[_.]*//p' -e 's/^.* [ATDSUW] //p' <libc.tmp >libc.list
2110if $contains '^printf$' libc.list >/dev/null 2>&1; then
2111    echo done
2112elif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \
2113	<libc.tmp >libc.list; \
2114  $contains '^printf$' libc.list >/dev/null 2>&1; then
2115    echo done
2116elif $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list; \
2117  $contains '^printf$' libc.list >/dev/null 2>&1; then
2118    echo done
2119elif $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list; \
2120  $contains '^printf$' libc.list >/dev/null 2>&1; then
2121    echo done
2122elif $sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' \
2123		<libc.tmp >libc.list; \
2124  $contains '^printf$' libc.list >/dev/null 2>&1; then
2125    echo done
2126elif $grep '|' <libc.tmp | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
2127                                   -e 's/^\([^     ]*\).*/\1/p' >libc.list
2128  $contains '^printf$' libc.list >/dev/null 2>&1; then
2129    echo done
2130elif $sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p' \
2131	   <libc.tmp >libc.list; \
2132  $contains '^printf$' libc.list >/dev/null 2>&1; then
2133    echo done
2134else
2135    nm -p $* 2>/dev/null >libc.tmp
2136    $sed -n -e 's/^.* [ATW]  *_[_.]*//p' -e 's/^.* [ATW] //p' <libc.tmp >libc.list
2137    if $contains '^printf$' libc.list >/dev/null 2>&1; then
2138	nm_opts='-p'
2139	echo "done"
2140    else
2141	echo " "
2142	echo "nm didn't seem to work right."
2143	echo "Trying ar instead..."
2144	if ar t $libc > libc.tmp; then
2145	    for thisname in $libnames; do
2146		ar t $thisname >>libc.tmp
2147	    done
2148	    $sed -e 's/\.o$//' < libc.tmp > libc.list
2149	    echo "Ok."
2150	else
2151	    echo "ar didn't seem to work right."
2152	    echo "Maybe this is a Cray...trying bld instead..."
2153    	    if $bld t $libc > /dev/null && bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
2154		for thisname in $libnames; do
2155		    bld t $libnames | \
2156			$sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
2157		    ar t $thisname >>libc.tmp
2158		done
2159		echo "Ok."
2160	    else
2161		echo "bld didn't seem to work right either.  Desperation time."
2162		echo "We'll use strings and hope this returns something useful."
2163		if strings $libc > libc.list; then
2164		    echo "Yes; that seems to have worked."
2165		else
2166		    echo "That didn't work either.  Giving up."
2167		    exit 1
2168		fi
2169	    fi
2170	fi
2171    fi
2172fi
2173
2174: old version
2175
2176inlibc='echo " ";
2177if $contains "^$1\$" libc.list >/dev/null 2>&1;
2178then echo "$1() found"; eval "$2=$define";
2179else echo "$1() not found"; eval "$2=$undef"; fi'
2180
2181: : new version
2182:
2183: inlibc='echo " "; td=$define; tu=$undef;
2184: if $contains "^$1\$" libc.list >/dev/null 2>&1;
2185: then echo "$1() found";
2186:   eval "case \"\$$2\" in undef) . whoa; esac"; eval "$2=\$td";
2187: else echo "$1() not found";
2188:   eval "case \"\$$2\" in define) . whoa; esac"; eval "$2=\$tu"; fi'
2189:
2190: rmlist="$rmlist libc.tmp libc.list"
2191:
2192: see how we invoke the C preprocessor
2193echo " "
2194echo "Now, how can we feed standard input to your C preprocessor..."
2195cat <<'EOT' >testcpp.c
2196#define ABC abc
2197#define XYZ xyz
2198ABC.XYZ
2199EOT
2200echo 'Maybe "'"$cc"' -E" will work...'
2201$cc -E <testcpp.c >testcpp.out 2>&1
2202: try to force gcc preprocessor if that is the compiler they are using
2203case $? in
22040) cppstdin="$cc -E";;
2205*) case "$cc" in
2206    *gcc*)
2207	cd ..
2208	echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
2209	echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
2210	chmod 755 cppstdin
2211	cppstdin=`pwd`/cppstdin
2212	cppminus='';
2213	cd UU
2214	$cppstdin <testcpp.c >testcpp.out 2>&1
2215	;;
2216    esac
2217    ;;
2218esac
2219if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2220    echo "Yup, it does."
2221    cppstdin="$cc -E"
2222    cppminus='';
2223else
2224    echo 'Nope, maybe "'$cpp'" will work...'
2225    $cpp <testcpp.c >testcpp.out 2>&1
2226    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2227	echo "Yup, it does."
2228	cppstdin="$cpp"
2229	cppminus='';
2230    else
2231	echo 'No such luck...maybe "'$cpp' -" will work...'
2232	$cpp - <testcpp.c >testcpp.out 2>&1
2233	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2234	    echo "It works!"
2235	    cppstdin="$cpp"
2236	    cppminus='-';
2237	else
2238	    echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
2239	    $cc -E - <testcpp.c >testcpp.out 2>&1
2240	    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2241		echo "Hooray, it works!  I was beginning to wonder."
2242		cppstdin="$cc -E"
2243		cppminus='-';
2244	    else
2245		echo 'Nope...maybe "'"$cc"' -P" will work...'
2246		$cc -P <testcpp.c >testcpp.out 2>&1
2247		if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2248		    echo "Yup, that does."
2249		    cppstdin="$cc -P"
2250		    cppminus='';
2251		else
2252		    echo 'Nope...maybe "'"$cc"' -P -" will work...'
2253		    $cc -P - <testcpp.c >testcpp.out 2>&1
2254		    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2255			echo "Yup, that does."
2256			cppstdin="$cc -P"
2257			cppminus='-';
2258		    else
2259			echo 'Hmm...perhaps you already told me...'
2260			case "$cppstdin" in
2261			'') ;;
2262			*) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
2263			esac
2264			if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2265			    echo "Hooray, you did!  I was beginning to wonder."
2266			else
2267			    echo 'Uh-uh.  Time to get fancy...'
2268			    cd ..
2269			    echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
2270			    echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
2271			    chmod 755 cppstdin
2272			    cppstdin=`pwd`/cppstdin
2273			    cppminus='';
2274			    cd UU
2275			    $cppstdin <testcpp.c >testcpp.out 2>&1
2276			    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2277				echo "Eureka!."
2278			    else
2279				dflt=blurfl
2280				$echo $n "No dice.  I can't find a C preprocessor.  Name one: $c"
2281				rp='Name a C preprocessor:'
2282				. myread
2283				cppstdin="$ans"
2284				$cppstdin <testcpp.c >testcpp.out 2>&1
2285				if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2286				    echo "OK, that will do."
2287				else
2288				    echo "Sorry, I can't get that to work.  Go find one."
2289				    exit 1
2290				fi
2291			    fi
2292			fi
2293		    fi
2294		fi
2295	    fi
2296	fi
2297    fi
2298fi
2299rm -f testcpp.c testcpp.out
2300
2301# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
2302# Initial import of elm 2.4 PL0 as base for elm 2.5.
2303#
2304# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
2305# Elm 2
2306#
2307: get C preprocessor symbols handy
2308echo " "
2309echo $attrlist | $tr ' ' '\012' >Cppsym.know
2310$cat <<EOSS >Cppsym
2311$startsh
2312case "\$1" in
2313-l) list=true
2314    shift
2315    ;;
2316esac
2317unknown=''
2318case "\$list\$#" in
23191|2)
2320    for sym
2321    do
2322	if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
2323	    exit 0
2324	elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
2325		:
2326	else
2327	    unknown="\$unknown \$sym"
2328	fi
2329    done
2330    set X \$unknown
2331    shift
2332    ;;
2333esac
2334case \$# in
23350) exit 1;;
2336esac
2337echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
2338#ifdef \1\\
2339exit 0; _ _ _ _\1\\	 \1\\
2340#endif\\
2341/' >/tmp/Cppsym\$\$
2342echo exit 1 >>/tmp/Cppsym\$\$
2343$cppstdin $cppminus </tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$
2344case "\$list" in
2345true) awk 'NF > 5 {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;
2346*)
2347    sh /tmp/Cppsym2\$\$
2348    status=\$?
2349    ;;
2350esac
2351$rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
2352exit \$status
2353EOSS
2354chmod +x Cppsym
2355$eunicefix Cppsym
2356echo "Your C preprocessor defines the following symbols:"
2357Cppsym -l $attrlist >Cppsym.true
2358cat Cppsym.true
2359rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
2360
2361# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
2362# Initial import of elm 2.4 PL0 as base for elm 2.5.
2363#
2364# Revision 1.1.1.1  1995/04/13  19:38:56  wfp5p
2365# Elm 2
2366#
2367: check for broken toupper/tolower
2368$echo ' '
2369case "$d_broke_ctype" in
2370"$define") ;;
2371"$undef") ;;
2372*)
2373    $echo "Testing your \"ctype\" conversion routines..."
2374    d_broke_ctype="$define"
2375    $cat >try.c <<'EOF'
2376#include <stdio.h>
2377#include <ctype.h>
2378#define my_tolower(c)	(isupper(c) ? (c) - 'A' + 'a' : (c))
2379#define my_toupper(c)	(islower(c) ? (c) - 'a' + 'A' : (c))
2380main()
2381{
2382    int i;
2383    for (i = 1 ; i <= 0x7F ; ++i) {
2384	if (my_tolower(i) != tolower(i) || my_toupper(i) != toupper(i))
2385		exit(1);
2386    }
2387    exit(0);
2388}
2389EOF
2390    $cc $ccflags -o try try.c >/dev/null 2>&1 \
2391	&& ./try >/dev/null 2>&1 && d_broke_ctype="$undef"
2392    rm -f try.c try.o try core
2393    ;;
2394esac
2395case "$d_broke_ctype" in
2396"$define")	$echo "Using our own \"ctype\" conversions." ;;
2397"$undef")	$echo "Using standard system \"ctype\" conversions." ;;
2398esac
2399
2400
2401: check for broken fflush
2402$echo ' '
2403case "$d_broke_fflush" in
2404"$define") ;;
2405"$undef") ;;
2406*)
2407    $echo "Testing your \"fflush\" routine..."
2408    d_broke_fflush="$define"
2409    $cat >try.c <<'EOF'
2410#include <stdio.h>
2411main()
2412{
2413    FILE *fp;
2414    fp=fopen("/dev/null","r");
2415    fflush(fp);
2416    return ferror(fp);
2417}
2418EOF
2419    $cc $ccflags -o try try.c >/dev/null 2>&1 \
2420	&& ./try >/dev/null 2>&1 && d_broke_fflush="$undef"
2421    rm -f try.c try.o try core
2422    ;;
2423esac
2424case "$d_broke_fflush" in
2425"$define")	$echo "Your fflush is broken.  Adding -DULTRIX_FFLUSH_BUG."
2426		cflags="$cflags -DULTRIX_FFLUSH_BUG" ;;
2427"$undef")	$echo "Looks good." ;;
2428esac
2429
2430# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
2431# Initial import of elm 2.4 PL0 as base for elm 2.5.
2432#
2433# Revision 1.1.1.1  1995/04/13  19:38:53  wfp5p
2434# Elm 2
2435#
2436: see if chown can take -1 for mantaining the user/group unchanged
2437echo " "
2438
2439case "$d_chown_neg1" in
2440undef)  dflt=n;;
2441*)  dflt=y;;
2442esac
2443
2444$cat <<EOM
2445
2446Does your system allow chown(-1, group) and chown(user, -1) to
2447not change the user or group respectively.  This is usually documented
2448in the chown manual page (man 2 chown). (Most POSIX and BSD systems can,
2449Xenix cannot)
2450
2451EOM
2452rp="Does this system allow -1 as chown argument? [$dflt]"
2453$echo $n "$rp $c"
2454. myread
2455case "$ans" in
2456y*) d_chown_neg1="$define";;
2457*)  d_chown_neg1="$undef";;
2458esac
2459# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
2460# Initial import of elm 2.4 PL0 as base for elm 2.5.
2461#
2462# Revision 1.1.1.1  1995/04/13  19:38:53  wfp5p
2463# Elm 2
2464#
2465
2466case "$d_content" in
2467"$define") dflt=y;;
2468"$undef")  dflt=n;;
2469*)	   dflt=n;;
2470esac
2471
2472$cat << EOM
2473
2474Some modern Mail Transport Agents (mailers) support the Content-Length: header.
2475In doing so, they do not wish to have messages escaped to protect 'From ' lines
2476in the body of the message, among other strings.  Does the Mail Transport Agent
2477in use on this system honor the Content-Length: header?
2478EOM
2479
2480echo " "
2481rp="Honors Content-Length: header? [$dflt]"
2482$echo $n "$rp $c"
2483. myread
2484case "$ans" in
2485y*) d_content="$define";;
2486*)  d_content="$undef";;
2487esac
2488
2489# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
2490# Initial import of elm 2.4 PL0 as base for elm 2.5.
2491#
2492# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
2493# Elm 2
2494#
2495: see if crypt exists
2496echo " "
2497if $test "$cryptlib" = -lcrypt; then
2498    echo 'crypt() found.'
2499    d_crypt="$define"
2500elif $contains '^crypt$' libc.list >/dev/null 2>&1; then
2501    echo 'crypt() found.'
2502    d_crypt="$define"
2503    cryptlib=''
2504else
2505    cryptlib=`loc Slibcrypt.a "" $xlibpth`
2506    if $test -z "$cryptlib"; then
2507	cryptlib=`loc Mlibcrypt.a "" $xlibpth`
2508    else
2509	cryptlib=-lcrypt
2510    fi
2511    if $test -z "$cryptlib"; then
2512	cryptlib=`loc Llibcrypt.a "" $xlibpth`
2513    else
2514	cryptlib=-lcrypt
2515    fi
2516    if $test -z "$cryptlib"; then
2517	cryptlib=`loc libcrypt.a "" $libpth`
2518    else
2519	cryptlib=-lcrypt
2520    fi
2521#
2522#	now try for international versions?
2523#
2524    if $test -z "$cryptlib"; then
2525	cryptlib=`loc Slibcrypt_i.a "" $libpth`
2526	if $test -z "$cryptlib"; then
2527	    cryptlib=`loc Mlibcrypt_i.a "" $libpth`
2528	else
2529	    cryptlib=-lcrypt_i
2530	fi
2531	if $test -z "$cryptlib"; then
2532	    cryptlib=`loc Llibcrypt_i.a "" $libpth`
2533	else
2534	    cryptlib=-lcrypt_i
2535	fi
2536	if $test -z "$cryptlib"; then
2537	    cryptlib=`loc libcrypt_i.a "" $libpth`
2538	else
2539	    cryptlib=-lcrypt_i
2540	fi
2541    fi
2542    if $test -z "$cryptlib"; then
2543	echo 'crypt() not found.'
2544	d_crypt="$undef"
2545    else
2546	d_crypt="$define"
2547    fi
2548fi
2549
2550# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
2551# Initial import of elm 2.4 PL0 as base for elm 2.5.
2552#
2553# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
2554# Elm 2
2555#
2556: check for cuserid function
2557set cuserid d_cuserid
2558eval $inlibc
2559# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
2560# Initial import of elm 2.4 PL0 as base for elm 2.5.
2561#
2562# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
2563# Elm 2
2564#
2565
2566: determine if the host name should be displayed on the index page
2567
2568case "$d_disphost" in
2569"$define") dflt=y;;
2570"$undef")  dflt=n;;
2571*)	dflt=n;;
2572esac
2573$cat <<EOM
2574
2575Elm can either display the hostname on the index page, or just
2576the folder name.  If the hostname is displayed, the folder name
2577will read hostname:folder.  If not it will just read folder.
2578
2579EOM
2580rp="Should Elm display the hostname as part of the folder name? [$dflt]"
2581$echo $n "$rp $c"
2582. myread
2583case "$ans" in
2584y*) d_disphost="$define";;
2585*)  d_disphost="$undef";;
2586esac
2587
2588
2589echo " "
2590if $contains flock libc.list >/dev/null 2>&1; then
2591    echo 'flock() found.'
2592    if $contains EWOULDBLOCK /usr/include/errno.h > /dev/null 2>&1; then
2593        has_flock="$define"
2594        echo 'flock locking available.'
2595    elif $contains EWOULDBLOCK /usr/include/sys/errno.h > /dev/null 2>&1; then
2596        has_flock="$define"
2597        echo 'flock locking available.'
2598    else
2599	has_flock="$undef"
2600        echo 'flock locking not available.'
2601	d_flock="$undef"
2602    fi
2603else
2604    has_flock="$undef"
2605    d_flock="$undef"
2606fi
2607
2608if $contains F_SETLK /usr/include/sys/fcntl.h >/dev/null 2>&1; then
2609    echo 'F_SETLK found, fcntl locking available'
2610    has_fcntl="$define"
2611elif $contains F_SETLK /usr/include/sys/fcntlcom.h >/dev/null 2>&1; then
2612    echo 'F_SETLK found, fcntl locking available'
2613    has_fcntl="$define"
2614elif $contains F_SETLK /usr/include/sys/file.h >/dev/null 2>&1; then
2615    echo 'F_SETLK found, fcntl locking available'
2616    has_fcntl="$define"
2617elif $contains F_SETLK /usr/include/fcntl.h >/dev/null 2>&1; then
2618    echo 'F_SETLK found, fcntl locking available'
2619    has_fcntl="$define"
2620elif $contains F_SETLK /usr/include/fcntlbits.h >/dev/null 2>&1; then
2621    echo 'F_SETLK found, fcntl locking available'
2622    has_fcntl="$define"
2623elif $contains F_SETLK /usr/include/bits/fcntl.h >/dev/null 2>&1; then
2624    echo 'F_SETLK found, fcntl locking available'
2625    has_fcntl="$define"
2626else
2627    echo 'F_SETLK not found, fcntl locking not available'
2628    has_fcntl="$undef"
2629    d_fcntlock="$undef"
2630fi
2631
2632if $test "$has_flock" = "$define" -o "$has_fcntl" = "$define"; then
2633    $cat <<EOM
2634Mail Transport Agents (sendmail, etc.) and Mail User Agents (Elm) can
2635use a variety of file locking protocols.  Based on your system type,
2636usage of a network, and MTA/MUAs in use, you may want to configure more
2637than one of the following Mail Locking Protocols.  It is recommended
2638that you use as many as are possible on your system to avoid problems.
2639All systems can support the dot locking method (.lock files).
2640
2641Available locking protocols:
2642	dot locking (.lock)
2643EOM
2644    if $test "$has_flock" = "$define"; then
2645	echo '	flock style locking'
2646    fi
2647
2648    if $test "$has_fcntl" = "$define"; then
2649	echo '	fcntl style locking'
2650    fi
2651
2652    if $test "$has_flock" = "$define" -a "$has_fcntl" = "$define"; then
2653	$cat <<EOM
2654On some systems, flock style locking and fcntl style locking use the
2655same underlying calls so both are not only not necessary, but may
2656interfere with each other.  On other systems they are distinct and both
2657should be used.  You will have to consult the documentation for your
2658operating system to determine in which class your system resides.
2659
2660EOM
2661    fi
2662
2663    case "$d_dotlock" in
2664    "$define")	dflt=y;;
2665    "$undef")	dflt=n;;
2666    *)		dflt=y;;
2667    esac
2668
2669    rp="Would you like to use dot lock style mail spool locking? [$dflt]"
2670    $echo $n "$rp $c"
2671    . myread
2672    case "$ans" in
2673    y*) d_dotlock="$define";;
2674    *)  d_dotlock="$undef";;
2675    esac
2676
2677    if $test "$has_flock" = "$define"; then
2678	case "$d_flock" in
2679	"$define")	dflt=y;;
2680	"$undef")	dflt=n;;
2681	*)		dflt=y;;
2682	esac
2683
2684    if $test "$uname_os" = "AIX" ; then
2685        dflt=n
2686    fi
2687
2688	rp="Would you like to use flock style mail spool locking? [$dflt]"
2689	$echo $n "$rp $c"
2690	. myread
2691	case "$ans" in
2692	y*) d_flock="$define";;
2693	*)  d_flock="$undef";;
2694	esac
2695    fi
2696
2697    if $test "$has_fcntl" = "$define"; then
2698	case "$d_fcntlock" in
2699	"$define")	dflt=y;;
2700	"$undef")	dflt=n;;
2701	*)		dflt=y;;
2702	esac
2703
2704	rp="Would you like to use fcntl style mail spool locking? [$dflt]"
2705	$echo $n "$rp $c"
2706	. myread
2707	case "$ans" in
2708	y*) d_fcntlock="$define";;
2709	*)  d_fcntlock="$undef";;
2710	esac
2711    fi
2712else
2713    d_dotlock="$define"
2714    echo 'Dot lock style locking will be used'
2715fi
2716
2717if $test -d /usr/spool/locks ; then
2718    lock_dir=/usr/spool/locks
2719elif $test -d /usr/spool/uucp ; then
2720    lock_dir=/usr/spool/uucp
2721elif $test -d /var/spool/locks ; then
2722    lock_dir=/var/spool/locks
2723elif $test -d /var/spool/lock ; then
2724    lock_dir=/var/spool/lock
2725elif $test -d /var/spool/uucp ; then
2726    lock_dir=/var/spool/uucp
2727else
2728    lock_dir=/tmp
2729fi
2730echo " "
2731echo "Non-mailbox locks will use the $lock_dir directory"
2732echo " "
2733
2734# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
2735# Initial import of elm 2.4 PL0 as base for elm 2.5.
2736#
2737# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
2738# Elm 2
2739#
2740: now get the host name
2741if $test "$autohostname" != "$undef" -o "$hostname" = "" ; then
2742    autohostname="$define"
2743    echo " "
2744    echo "Figuring out host name..."
2745    echo 'Maybe "hostname" will work...'
2746    if ans=`sh -c hostname 2>&1` ; then
2747	hostname=$ans
2748	phostname=hostname
2749    else
2750	if xenix; then
2751	    echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
2752	    if ans=`cat /etc/systemid 2>&1` ; then
2753		hostname=$ans
2754		phostname='cat /etc/systemid'
2755		echo "Whadyaknow.  Xenix always was a bit strange..."
2756	    else
2757		echo 'No, maybe "uuname -l" will work...'
2758		if ans=`sh -c '$uuname -l' 2>&1` ; then
2759		    hostname=$ans
2760		    phostname='$uuname -l'
2761		else
2762		    echo 'Strange.  Maybe "uname -n" will work...'
2763		    if ans=`sh -c '$uname -n' 2>&1` ; then
2764			hostname=$ans
2765			phostname='$uname -n'
2766		    else
2767			echo 'Oh well, maybe I can mine it out of whoami.h...'
2768			if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
2769			    hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
2770			    phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
2771			else
2772			    case "$hostname" in
2773			    '') echo "Does this machine have an identity crisis or something?"
2774				phostname=''
2775				;;
2776			    *)  echo "Well, you said $hostname before...";;
2777			    esac
2778			fi
2779		    fi
2780		fi
2781	    fi
2782	else
2783	    if $test -r /etc/systemid ; then
2784		echo "What is a non-Xenix system doing with /etc/systemid?"
2785	    fi
2786	    echo 'No, maybe "uuname -l" will work...'
2787	    if $test -n "$uuname" && ans=`sh -c "$uuname -l" 2>&1` ; then
2788		hostname=$ans
2789		phostname="$uuname -l"
2790	    else
2791		echo 'Strange.  Maybe "uname -n" will work...'
2792		if $test -n "$uname" && ans=`sh -c "$uname -n" 2>&1` ; then
2793		    hostname=$ans
2794		    phostname="$uname -n"
2795		else
2796		    if ans=`cat /etc/systemid 2>&1` ; then
2797			hostname=$ans
2798			phostname='cat /etc/systemid'
2799			echo "Well, I'll use the systemid file anyway..."
2800		    else
2801			echo 'Oh well, maybe I can mine it out of whoami.h...'
2802			if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
2803			    hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
2804			    phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
2805			else
2806			    case "$hostname" in
2807			    '') echo "Does this machine have an identity crisis or something?"
2808				phostname=''
2809				;;
2810			    *)  echo "Well, you said $hostname before...";;
2811			    esac
2812			fi
2813		    fi
2814		fi
2815	    fi
2816	fi
2817    fi
2818else
2819    echo "Last time you said the hostname was $hostname"
2820fi
2821: you do not want to know about this
2822set $hostname
2823hostname=$1
2824
2825: translate upper to lower if necessary
2826case "$hostname" in
2827    *[A-Z]*)
2828	hostname=`echo $hostname | tr '[A-Z]' '[a-z]'`
2829	echo "(Normalizing case in your host name)"
2830	;;
2831esac
2832
2833: verify guess
2834if $test "$hostname" ; then
2835    dflt=y
2836    echo 'Your host name appears to be "'$hostname'".'
2837    $echo $n "Is this correct? [$dflt] $c"
2838    rp="Sitename is $hostname? [$dflt]"
2839    . myread
2840    case "$ans" in
2841      y*)  ;;
2842      *)      hostname='' ;;
2843    esac
2844fi
2845
2846: bad guess or no guess
2847while $test "X$hostname" = X ; do
2848    dflt=''
2849    rp="Please type the (one word) name of your host:"
2850    $echo $n "$rp $c"
2851    . myread
2852    hostname="$ans"
2853    autohostname="$undef"
2854done
2855
2856echo " "
2857case "$hostname" in
2858*.*)
2859    dflt=`$expr "X$hostname" : "X[^.]*\(\..*\)"`
2860    hostname=`$expr "X$hostname" : "X\([^.]*\)\."`
2861    echo "(Trimming domain name from host name--host name is now $hostname)"
2862    ;;
2863*)  case "$mydomain" in
2864	'') dflt='.UUCP';;
2865	*) dflt="$mydomain";;
2866    esac
2867    ;;
2868esac
2869rp="What is your domain name? [$dflt]"
2870$echo $n "$rp $c"
2871. myread
2872case "$ans" in
2873'') ;;
2874.*) ;;
2875*) ans=".$ans";;
2876esac
2877mydomain="$ans"
2878
2879: a little sanity check here
2880case "$phostname" in
2881'') ;;
2882*)  case `$phostname` in
2883    $hostname$mydomain|$hostname) ;;
2884    *)
2885	case "$phostname" in
2886	sed*)
2887	    echo "(That doesn't agree with your whoami.h file, by the way.)"
2888	    ;;
2889	*)
2890	    echo "(That doesn't agree with your $phostname command, by the way.)"
2891	    ;;
2892	esac
2893	phostname=''
2894	;;
2895    esac
2896    ;;
2897esac
2898
2899: see if there is a whoami file
2900echo " "
2901if $test -r /usr/include/whoami.h ; then
2902    d_whoami="$define"
2903    echo "whoami.h found."
2904else
2905    d_whoami="$undef"
2906fi
2907
2908# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
2909# Initial import of elm 2.4 PL0 as base for elm 2.5.
2910#
2911# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
2912# Elm 2
2913#
2914: see how we will look up host name
2915echo " "
2916d_douname="$undef"
2917d_gethname="$undef"
2918
2919if $contains '^gethostname$' libc.list >/dev/null 2>&1 ; then
2920    echo "gethostname() found."
2921    d_gethname="$define"
2922    ans=gethostname
2923elif xenix; then
2924    if $test -n "$uname"; then
2925	u_name=`$uname -n`
2926    else
2927	u_name=
2928    fi
2929    if $test -n "$line"; then
2930	if $test -r /etc/systemid; then
2931	    s_name=`$line < /etc/systemid`
2932	else
2933	    s_name=
2934	fi
2935    else
2936	s_name=
2937    fi
2938    if $test -n "$u_name"; then
2939	if $test "$u_name" = "$s_name"; then
2940	    cat <<EOM
2941On Xenix, UUCP uses the name found in /etc/systemid, while uname()
2942returns the name compiled into the operating system via configure.
2943Elm needs the UUCP name, and currently these two match.  However, they
2944need not match.  Be sure to always keep these two names in sync.
2945Since they match, Elm will not consider that the Xenix uname function
2946is broken.  However, if you are not always able to make them
2947match, answer the compile in hostname question Yes.
2948EOM
2949	    if $contains '^uname$' libc.list >/dev/null 2>&1 ; then
2950		echo "uname() found."
2951		d_douname="$define"
2952		ans=uname
2953	    fi
2954	else
2955	    cat <<EOM
2956On Xenix, UUCP uses the name found in /etc/systemid, while uname()
2957returns the name compiled into the operating system via configure.
2958Your /etc/systemid file contains $s_name.
2959But uname returns $u_name.
2960Since Elm needs the UUCP name, and currently these two do not match,
2961Elm will assume Xenix uname() is broken.
2962EOM
2963	fi
2964    else
2965	cat <<EOM
2966On Xenix, UUCP uses the name found in /etc/systemid, while uname()
2967returns the name compiled into the operating system via configure.
2968Elm needs the UUCP name, and currently the compiled in name is undefined.
2969Since mail needs the UUCP name, and these two need not match, Elm will
2970assume Xenix uname() is broken.
2971EOM
2972    fi
2973elif $contains '^uname$' libc.list >/dev/null 2>&1 ; then
2974    echo "uname() found."
2975    d_douname="$define"
2976    ans=uname
2977fi
2978
2979case "$d_douname$d_gethname" in
2980*define*)
2981    case "$ign_hname" in
2982    '')	case "$d_host_comp" in
2983	"$define") dflt=y;;
2984	*)  dflt=n;;
2985	esac;;
2986    y)  dflt=y;;
2987    *)  dflt=n;;
2988    esac
2989    cat <<EOM
2990
2991Every now and then someone has a $ans() that lies about the hostname
2992but can't be fixed for political or economic reasons.  Would you like to
2993EOM
2994    rp="pretend $ans() isn't there and maybe compile in the hostname? [$dflt]"
2995    $echo $n "$rp $c"
2996    . myread
2997    case "$ans" in
2998    y*) ign_hname=y
2999	d_douname="$undef"
3000	d_gethname="$undef"
3001	d_host_comp="$define"
3002	$echo $n "Okay... $c"
3003	;;
3004    *)	ign_hname=n
3005	d_host_comp="$undef"
3006	;;
3007    esac
3008    ;;
3009*)
3010    $cat <<EOT
3011
3012There is no gethostname() or uname() on this system.  The hostname will
3013have to be compiled in.  It can be overridden in the global elm.rc file
3014in the library directory to specify hostname, hostfullname and hostdomain.
3015EOT
3016    d_host_comp="$define"
3017    ;;
3018esac
3019
3020: see if errlst.o is in the lib.
3021echo " "
3022case "$d_errlst" in
3023"$define") dflt=y;;
3024"$undef")  dflt=n;;
3025*)	   if $contains '^errlst$' libc.list >/dev/null 2>&1 ; then
3026		echo "errlst object found, will attempt to use systems"
3027		echo "sys_nerr and sys_errlist"
3028		dflt=y
3029	    elif $contains '^sys_errlist$' libc.list >/dev/null 2>&1 ; then
3030		echo "sys_errlist found, will attempt to use systems"
3031		echo "sys_nerr and sys_errlist"
3032		dflt=y
3033	    else
3034		echo "neither errlst object nor sys_errlist found, $package will use its own"
3035		dflt=n
3036	    fi;;
3037esac
3038
3039cat <<EOM
3040
3041Elm would like to use the systems definitions of the error messages for system
3042errors.  These are usually contained in the global variables sys_errlist[] and
3043sys_nerr.  If these do not exist, there is a standard list built into Elm.
3044
3045EOM
3046
3047rp="Does the system support the sys_errlist[] global variable? [$dflt]"
3048$echo $n "$rp $c"
3049. myread
3050case "$ans" in
3051    y*) d_errlst="$define";;
3052    *)  d_errlst="$undef" ;;
3053esac
3054
3055: see if fsync exists
3056set fsync d_fsync
3057eval $inlibc
3058: see if fstruncate exists
3059set ftruncate d_ftruncate
3060eval $inlibc
3061: see if getopt exists
3062set getopt d_getopt
3063eval $inlibc
3064
3065: see if strings.h is in /usr/include or /usr/include/sys
3066echo " "
3067strings=`loc string.h "" /usr/include $includepath`
3068if $test -z "$strings"; then
3069	strings=`loc strings.h "" /usr/include $includepath`
3070fi
3071while $test -z "$strings"; do
3072	echo " "
3073	dflt=''
3074	rp="What is the full path name of the include file directory? []"
3075	$echo $n "$rp $c"
3076	. myread
3077	includepath=`filexp $ans`
3078	if $test -d "$includepath"; then
3079		strings=`loc string.h "" /usr/include $includepath`
3080		if $test -z "$strings"; then
3081			strings=`loc strings.h "" /usr/include $includepath`
3082		fi
3083		if $test -z "$strings"; then
3084			$cat <<EOM
3085
3086Include file string.h or strings.h not found in $includepath.
3087Elm requires string.h on USG type systems or strings.h on BSD type
3088systems.  Please specify the directory where one of these files can
3089be found.
3090EOM
3091		fi
3092	else
3093		echo "Directory $includepath not found"
3094	fi
3095done
3096
3097strings_f=`$expr "$strings" : ".*/\(.*\)"`
3098if $test "$strings_f" = "string.h"; then
3099	d_strings="$undef"
3100	echo "Using string.h instead of strings.h"
3101else
3102	d_strings="$define"
3103	echo "Using strings.h instead of string.h"
3104fi
3105pwdinsys=`loc pwd.h "" /usr/include $includepath`
3106if $test -z "$pwdinsys"; then
3107	d_pwdinsys="$define"
3108else
3109	d_pwdinsys="$undef"
3110fi
3111
3112# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
3113# Initial import of elm 2.4 PL0 as base for elm 2.5.
3114#
3115# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
3116# Elm 2
3117#
3118: index or strcpy
3119echo " "
3120case "$d_index" in
3121"$define") dflt=n;;
3122*) dflt=y;;
3123esac
3124if $contains '^index$' libc.list >/dev/null 2>&1 ; then
3125    if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
3126	if $contains strchr "$strings" >/dev/null 2>&1 ; then
3127	    if $contains index "$strings" >/dev/null 2>&1 ; then
3128#			has index, strchr, and index and strchr in strings.h
3129		echo "Your system has both index() and strchr().  Shall I use"
3130		rp="index() rather than strchr()? [$dflt]"
3131		$echo $n "$rp $c"
3132		. myread
3133		case "$ans" in
3134		    n*) d_index="$define" ;;
3135		    *)  d_index="$undef" ;;
3136		esac
3137	    else
3138#			has index, strchr, and strchr in strings.h
3139		d_index="$define"
3140	        echo "strchr() found."
3141	    fi
3142	else
3143#			has index, strchr, and no strchr in strings.h
3144	    d_index="$undef"
3145	    echo "index() found."
3146	fi
3147    else
3148#			has only index, no strchr, strings.h is a moot point
3149	d_index="$undef"
3150	echo "index() found."
3151    fi
3152else
3153    if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
3154	d_index="$define"
3155	echo "strchr() found."
3156    else
3157	echo "No index() or strchr() found!"
3158	d_index="$undef"
3159    fi
3160fi
3161
3162# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3163# Initial import of elm 2.4 PL0 as base for elm 2.5.
3164#
3165# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
3166# Elm 2
3167#
3168case "$d_mmdf" in
3169"$define") dflt=y;;
3170"$undef")  dflt=n;;
3171*)	if $test -f "$submit"; then
3172	    dflt=y
3173	else
3174	    dflt=n
3175	fi
3176	;;
3177esac
3178$cat <<EOM
3179
3180Some systems run MMDF as their Mail Transport Agent.  MMDF uses a
3181different way of delimiting messages in the mailbox files.  Other
3182systems don't run MMDF but use the MMDF separator in their mailbox
3183files.  The MMDF separator is usually a series of four Control A's.
3184$package needs to know if this system uses the MMDF style message
3185separator in its mailbox files.
3186
3187EOM
3188rp="Does this system use MMDF style message separator? [$dflt]"
3189$echo $n "$rp $c"
3190. myread
3191case "$ans" in
3192y*) d_mmdf="$define";;
3193*)  d_mmdf="$undef";;
3194esac
3195
3196# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
3197# Initial import of elm 2.4 PL0 as base for elm 2.5.
3198#
3199# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
3200# Elm 2
3201#
3202: determine mail delivery agent for Elm to use
3203case "$mailer" in
3204'')
3205    if $test "$d_mmdf" = "$define" -a -f "$execmail"; then
3206 	dflt="$execmail"
3207    elif $test "$d_mmdf" = "$define" -a -f "$submit"; then
3208	dflt="$submit"
3209    elif $test -f "$sendmail"; then
3210	dflt="$sendmail"
3211    elif $test -f "$rmail"; then
3212	dflt="$rmail"
3213    elif $test -f /bin/mail; then
3214	dflt=/bin/mail
3215    else
3216	dflt=$mail
3217    fi
3218    ;;
3219*)  dflt="$mailer";;
3220esac
3221cont=true
3222while $test "$cont" ; do
3223    echo " "
3224    echo "Give the full path name of the program used to deliver mail on your"
3225    $echo $n "system: [$dflt] $c"
3226    rp="Preferred mail delivery agent: [$dflt]"
3227    . myread
3228    mailer="$ans"
3229    if $test -f "$ans"; then
3230	cont=''
3231    else
3232	if $test "$fastread" = yes; then
3233	    dflt=y
3234	else
3235	    dflt=n
3236	fi
3237	echo "Mail delivery agent $ans doesn't exist."
3238	rp="Use that name anyway? [$dflt]"
3239	$echo $n "$rp $c"
3240	. myread
3241	dflt=''
3242	case "$ans" in
3243	y*) cont='';;
3244	esac
3245    fi
3246done
3247if $test "$mailer" != "$sendmail"; then
3248    sendmail=''
3249fi
3250if $test "$mailer" != "$submit"; then
3251    submit=''
3252fi
3253if $test "$mailer" != "$execmail"; then
3254    execmail=''
3255fi
3256
3257# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
3258# Initial import of elm 2.4 PL0 as base for elm 2.5.
3259#
3260# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
3261# Elm 2
3262#
3263: check for internet mailer
3264case "$d_internet" in
3265"$define")	dflt=y;;
3266"$undef")	dflt=n;;
3267*)	if $test -f "$sendmail"; then
3268	    dflt=y
3269	elif $test -f "$submit"; then
3270	    dflt=y
3271	elif $test -f "$smail"; then
3272	    dflt=y
3273	else
3274	    dflt=n
3275	fi
3276	;;
3277esac
3278$cat <<EOM
3279
3280Some newer mailers can deliver mail to addresses of the INTERNET
3281persuasion, such as user@host.domain.  Other older mailers require the
3282complete uucp ! path to the destination to be specified in the address.
3283EOM
3284rp="Does your mailer understand INTERNET addresses? [$dflt]"
3285$echo $n "$rp $c"
3286. myread
3287case "$ans" in
3288y*) d_internet="$define";;
3289*)  d_internet="$undef";;
3290esac
3291
3292# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
3293# Initial import of elm 2.4 PL0 as base for elm 2.5.
3294#
3295# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
3296# Elm 2
3297#
3298: check for ispell spelling checker
3299case "$d_ispell" in
3300"$define")	dflt=y
3301		dflt_path=$ispell_path
3302		dflt_options=$ispell_options
3303		;;
3304"$undef")	dflt=n
3305		dflt_path=
3306		dflt_options=
3307		;;
3308*)	if $test -n "$ispell" -a "$ispell" != "ispell"; then
3309	    dflt=y
3310	    dflt_path=$ispell
3311	    dflt_options='-x'
3312	else
3313	    dflt=n
3314	    dflt_path=
3315	    dflt_options=
3316	fi
3317	;;
3318esac
3319$cat <<EOM
3320
3321Elm has the ability to place a call to the GNU ispell spelling checker
3322on its post-message-entry/pre-message-send menu.
3323EOM
3324if $test -n "$dflt_path"; then
3325	$echo "Configure has found ispell as $dflt_path"
3326else
3327	$echo "Configure was unable to find ispell"
3328fi
3329
3330$echo $n "Should Elm add the ispell option to the pre-send menu? [$dflt] $c"
3331rp="Should Elm add the ispell option to the pre-send menu? [$dflt]"
3332. myread
3333case "$ans" in
3334y*) d_ispell="$define";;
3335*)  d_ispell="$undef";;
3336esac
3337
3338case "$d_ispell" in
3339"$undef")	ispell_path=
3340		;;
3341"$define")	cont=true
3342		dflt=$dflt_path
3343		while $test "$cont" ; do
3344		    echo " "
3345		    echo "Give the name of the ispell program on your"
3346		    $echo $n "system: [$dflt] $c"
3347		    rp="Ispell path name: [$dflt]"
3348		    . myread
3349		    ispell_path=$ans;
3350		    if $test -f "$ans"; then
3351			cont=''
3352		    else
3353			lookup=`loc "$ans" "" . $pth`
3354			if $test -f "$lookup"; then
3355			    cont=''
3356			    ispell_path=$lookup
3357			else
3358			    if $test "$fastread" = yes; then
3359				dflt=y
3360			    else
3361				dflt=n
3362			    fi
3363			    echo "spelling program $ans doesn't exist."
3364			    rp="Use that name anyway? [$dflt]"
3365			    $echo $n "$rp $c"
3366			    . myread
3367			    dflt=''
3368			    case "$ans" in
3369				y*) cont='';;
3370			    esac
3371			fi
3372		    fi
3373		done
3374
3375		dflt=$dflt_options
3376		$echo $n "What options should Elm use with $ispell_path: [$dflt] $c"
3377		rp="$ispell_path options: [$dflt]"
3378		. myread
3379		ispell_options=$ans;
3380		case "$ispell_options" in
3381		'none') ispell_options=''
3382		     ;;
3383		esac
3384		;;
3385esac
3386: see if locale.h is in /usr/include
3387echo " "
3388dflt=`loc locale.h "" /usr/include $includepath`
3389if $test -z "$dflt"; then
3390	echo "locale.h not found, $package will not call setlocale"
3391	d_locale=$undef
3392else
3393	echo "locale.h found, $package will call setlocale"
3394	d_locale=$define
3395fi
3396
3397: see if nl_types.h is in /usr/include
3398echo " "
3399dflt=`loc nl_types.h "" /usr/include $includepath`
3400if $test -z "$dflt"; then
3401	echo "nl_types.h not found, $package will use its own"
3402	d_nl_types=$undef
3403else
3404	echo "nl_types.h found, $package will include the systems version"
3405	d_nl_types=$define
3406fi
3407
3408: see if catgets is in the libraries
3409set catgets d_msgcat
3410eval $inlibc
3411
3412if $test "$d_msgcat" = "$define"; then
3413	echo "Message catalog routines found"
3414	cat <<EOM
3415
3416The system has the message catalog routines in its library.  These routines
3417are new, and on some systems do not function properly. Also, $package expects
3418that these routines are X/Open compliant.
3419
3420EOM
3421
3422	case "$d_usenls" in
3423	"$define") dflt=y;;
3424	"$undef")  dflt=n;;
3425	*)	   dflt=n;;
3426	esac
3427
3428	rp="Should $package use its own routines instead of the systems NLS routines? [$dflt]"
3429	$echo $n "$rp $c"
3430	. myread
3431	case "$ans" in
3432	    y*) d_usenls="$define"
3433		d_nl_types=$undef;;
3434	    *)  d_usenls="$undef";;
3435	esac
3436else
3437	echo "Message catalog routines not found, $package will use its own"
3438	if $test "$d_usenls" = ""; then
3439		d_usenls="$define"
3440	fi
3441fi
3442
3443# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3444# Initial import of elm 2.4 PL0 as base for elm 2.5.
3445#
3446# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
3447# Elm 2
3448#
3449case "$d_mboxedit" in
3450"$define") dflt=y;;
3451"$undef")  dflt=n;;
3452*)	dflt=n;;
3453esac
3454$cat <<EOM
3455
3456A lot of sites that install the Elm Mail System find that the function
3457E)dit mailbox from within Elm is dangerous and confusing.  If you choose,
3458you can instead disable that function, with the program being slightly
3459smaller and presenting an appropriate error message to the user if they
3460try to E)dit their mailbox.
3461
3462EOM
3463rp="Would you like to enable the E)dit Mailbox function? [$dflt]"
3464$echo $n "$rp $c"
3465. myread
3466case "$ans" in
3467y*) d_mboxedit="$define";;
3468*)  d_mboxedit="$undef";;
3469esac
3470
3471: see if memcpy exists
3472set memcpy d_memcpy
3473eval $inlibc
3474
3475# Revision 1.4  1996/05/09  15:50:34  wfp5p
3476# Alpha 10
3477#
3478# Revision 1.3  1996/03/13  14:37:52  wfp5p
3479# Alpha 9 before Chip's big changes
3480#
3481# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3482# Initial import of elm 2.4 PL0 as base for elm 2.5.
3483#
3484# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
3485# Elm 2
3486#
3487: determine whether MIME messages should be passed to metamail
3488: also select default sending and display charcter sets
3489
3490
3491$cat <<EOM
3492
3493Elm supports the RFC-1521 Multipurpose Internet Mail Extensions (MIME).
3494MIME allows you to use international character sets (not just US-ASCII)
3495in mail messages.  MIME also allows multiple objects (binaries,
3496graphics, audio, video, PostScript, spreadsheets -- whatever!) to be
3497attached to mail messages.  MIME does not require a graphic display,
3498but some of its neatest capabilities demand one.
3499
3500Elm generates MIME messages on its own.  To handle incoming MIME
3501messages, however, you need to install Nathaniel Borenstein's "metamail"
3502package on your system.  The most recent version of "metamail" is
3503distributed from thumper.bellcore.com [128.96.41.1].  Additional
3504distribution points are available; consult an "archie" server.
3505
3506You may choose to have Elm pass received MIME messages to "metamail".
3507Otherwise, if you do not have "metamail" (or you elect not to use
3508it), Elm can ignore the MIME attributes and display the message as-is.
3509
3510EOM
3511
3512case "$d_mime" in
3513"$undef")
3514	dflt=n
3515	;;
3516"$define")
3517	dflt=y
3518	;;
3519*)
3520	if $test -f "$metamail" ; then
3521		$echo "It appears that you have \"$metamail\" installed."
3522		dflt=y
3523	else
3524		$echo "I do not see \"metamail\" on this system."
3525		dflt=n
3526	fi
3527	$echo ""
3528	;;
3529esac
3530
3531rp="Should Elm pass incoming MIME messages to \"metamail\"? [$dflt]"
3532$echo $n "$rp $c"
3533. myread
3534case "$ans" in
3535y*) d_mime="$define";;
3536*)  d_mime="$undef";;
3537esac
3538
3539cat <<EOM
3540
3541When composing outbound mail messages, Elm checks whether there are
3542any 8-bit "international" characters in the message.  If not, the
3543message is labelled as "us-ascii".  If there are, Elm needs to specify
3544the character set for the message.  What international character set
3545do people on your system most commonly use?  "iso-8859-1" is a common
3546selection, and is appropriate for many European languages.  (The choice
3547you make here becomes the system default.  Users that want a different
3548choice may set an "elmrc" value.)
3549
3550EOM
3551
3552case "$defcharset" in
3553'') defcharset="iso-8859-1";;
3554esac
3555dflt="$defcharset"
3556
3557rp="Default for sending messages sent with int'l chars? [$dflt]"
3558$echo $n "$rp $c"
3559. myread
3560defcharset="$ans"
3561
3562case "$defdispcharset" in
3563'') defdispcharset="$defcharset";;
3564esac
3565
3566if $test "$d_mime" = "$define"; then
3567
3568	dflt="$defdispcharset"
3569	$cat <<EOM
3570
3571When a message is received, Elm needs to know whether the terminal
3572can display the characters in the message, or if it needs to start up
3573"metamail".  What character set does your terminals most commonly
3574handle?  "iso-8859-1" is a common selection, and is appropriate for
3575many European languages.  (Even VT-100 text terminals can do this.)
3576If your displays have no capability whatsoever, then select "us-ascii".
3577(The choice you make here becomes the system default.  Users that want
3578a different choice may set an "elmrc" value.)
3579
3580EOM
3581	rp="Default character set which could be displayed? [$dflt]"
3582	$echo $n "$rp $c"
3583	. myread
3584	defdispcharset="$ans"
3585
3586fi
3587
3588: see if mkdir exists
3589set mkdir d_mkdir
3590eval $inlibc
3591
3592# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3593# Initial import of elm 2.4 PL0 as base for elm 2.5.
3594#
3595# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
3596# Elm 2
3597#
3598: ask about newmail running in the background automatically
3599case "$d_newauto" in
3600"$define")	dflt=y;;
3601"$undef")	dflt=n;;
3602*)		dflt=y;;
3603esac
3604$cat <<EOM
3605
3606Newmail (Elm's utility to check for incoming mail) can be configured to
3607either run as a foreground process or as a process that automatically
3608forks and runs in the background.
3609
3610EOM
3611rp="Should newmail automatically run in the background? [$dflt]"
3612$echo $n "$rp $c"
3613. myread
3614case "$ans" in
3615y*) d_newauto="$define";;
3616*)  d_newauto="$undef";;
3617esac
3618
3619# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3620# Initial import of elm 2.4 PL0 as base for elm 2.5.
3621#
3622# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
3623# Elm 2
3624#
3625
3626if $test -f "$sendmail"; then
3627	echo "You're running sendmail.  Setting noaddfrom, usedomain"
3628	d_noaddfrom="$define"
3629	d_usedomain="$undef"
3630elif $test -f "$submit"; then
3631	echo "You're running submit with MMDF.  Setting noaddfrom, usedomain"
3632	d_noaddfrom="$undef"
3633	d_usedomain="$define"
3634elif $test -f "$execmail" -a "$d_mmdf" = "$define"; then
3635	echo "You're running execmail with MMDF.  Setting noaddfrom, usedomain"
3636	d_noaddfrom="$undef"
3637	d_usedomain="$undef"
3638else
3639	if $test "$d_internet" = "$define"; then
3640		case "$d_usedomain" in
3641		"$define") dflt=y;;
3642		"$undef")  dflt=n;;
3643		*)	   dflt=y;;
3644		esac
3645
3646		$cat <<EOM
3647
3648Are you running a machine where you want to have a domain name appended
3649to the hostname on outbound mail?
3650EOM
3651		echo " "
3652		rp="Would you like the domain name appended? [$dflt]"
3653		$echo $n "$rp $c"
3654		. myread
3655		case "$ans" in
3656		y*) d_usedomain="$define";;
3657		*)  d_usedomain="$undef";;
3658		esac
3659	else
3660		d_usedomain="$undef"
3661		$cat <<EOM
3662
3663Since your mailer does not understand internet addresses, I'm undefining
3664usedomain so your domain name will not be appended to the hostname on
3665outbound mail.
3666
3667EOM
3668	fi
3669
3670	case "$d_noaddfrom" in
3671	"$define") dflt=y;;
3672	"$undef")  dflt=n;;
3673	*)	   dflt=n;;
3674	esac
3675	echo " "
3676	rp="Does your mailer add the From: header for you? [$dflt]"
3677	$echo $n "$rp $c"
3678	. myread
3679	case "$ans" in
3680	y*) d_noaddfrom="$define";;
3681	*)  d_noaddfrom="$undef";;
3682	esac
3683fi
3684
3685# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3686# Initial import of elm 2.4 PL0 as base for elm 2.5.
3687#
3688# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
3689# Elm 2
3690#
3691case "$d_noxheader" in
3692"$define") dflt=y;;
3693"$undef")  dflt=n;;
3694*)	dflt=n;;
3695esac
3696$cat <<EOM
3697 
3698Some sites do not like to see the mail header "X-mailer:" in outgoing
3699messages.  If you choose, you may disable these headers.  However, it
3700is strongly urged to leave these headers in the mail to assist in
3701tracking down problems.
3702
3703EOM
3704rp="Would you like to disable the X-mailer: headers? [$dflt]"
3705$echo $n "$rp $c"
3706. myread
3707case "$ans" in
3708y*) d_noxheader="$define";;
3709*)  d_noxheader="$undef";;
3710esac
3711
3712# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3713# Initial import of elm 2.4 PL0 as base for elm 2.5.
3714#
3715# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
3716# Elm 2
3717#
3718: check for "kill(pid, 0)"
3719echo " "
3720case "$d_pidcheck" in
3721"$define")	;;
3722"$undef")	;;
3723*)
3724	    echo "Checking to see if kill(pid, 0) works..."
3725	    $cat >try.c <<'EOCP'
3726main()
3727	{
3728	int	pid, status0, status9;
3729
3730	if ((pid = fork()) == 0)
3731		{
3732		sleep(30);
3733		exit(1);
3734		}
3735	status0 = kill(pid, 0);
3736	status9 = kill(pid, 9);
3737	exit(status0 == status9);
3738	}
3739EOCP
3740	    if $cc try.c -o try >/dev/null 2>&1 ; then
3741		if try >/dev/null 2>&1 ; then
3742		    echo "Your system does not support kill(pid, 0)..."
3743		    d_pidcheck="$undef"
3744		else
3745		    d_pidcheck="$define"
3746		    echo "Your system supports kill(pid, 0)..."
3747		fi
3748	    else
3749		echo "Your system does not support kill(pid, 0)..."
3750		d_pidcheck="$undef"
3751	    fi
3752	    $rm -f try.c try.o try
3753	;;
3754esac
3755
3756: see if /usr/include/sys/ptem.h exists, making it a possible System V/386
3757d_ptem="$undef"
3758if usg ; then
3759    echo " "
3760    echo "Checking to see if your system has sys/ptem.h..."
3761    if $test -f /usr/include/sys/ptem.h ; then
3762        echo "Yep, it does..."
3763        if "$contains" "struct winsize" /usr/include/sys/ptem.h >/dev/null 2>&1 ; then
3764	    d_ptem="$define"
3765	    echo "  and it has the needed structure."
3766	fi
3767    fi
3768fi
3769
3770# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3771# Initial import of elm 2.4 PL0 as base for elm 2.5.
3772#
3773# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
3774# Elm 2
3775#
3776: see if there is a putenv
3777set putenv d_putenv
3778eval $inlibc
3779
3780# Revision 1.2  1995/05/30  18:15:57  wfp5p
3781# Change to Configure to work correctly in "fastread" mode.
3782#
3783# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3784# Initial import of elm 2.4 PL0 as base for elm 2.5.
3785#
3786# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
3787# Elm 2
3788#
3789: get remove at last flag and number of lock attempts
3790$cat <<EOM
3791
3792The next pair of questions have to do with what to do when another
3793program has locked a mailbox...
3794
3795First, how many times should the Elm check for the removal of the lock
3796file before giving up?
3797EOM
3798
3799case "$maxattempts" in
3800    '') dflt=6;;
3801    *)  dflt=$maxattempts;;
3802esac
3803cont=true
3804while $test "$cont" ; do
3805    echo " "
3806    rp="Number of lock attempts: [$dflt]"
3807    $echo $n "$rp $c"
3808    . myread
3809    maxattempts="$ans"
3810    if $test "$maxattempts" -lt 3 -o "$maxattempts" -gt 10 ; then
3811	echo "The recommended range is 3-10"
3812	odflt=$dflt
3813        if $test "$fastread" = yes; then
3814	   dflt=y
3815	else
3816	   dflt=n
3817	fi
3818	rp="Should I use your answer of $maxattempts lock attempts anyway? [$dflt]"
3819	$echo $n "$rp $c"
3820	. myread
3821	dflt=$odflt
3822	case "$ans" in
3823	y*) cont='';;
3824	esac
3825    else
3826	cont=''
3827    fi
3828done
3829
3830case "$d_remlock" in
3831"$define") dflt=y;;
3832"$undef")  dflt=n;;
3833*)	   dflt=n;;
3834esac
3835echo " "
3836rp="Should it REMOVE the lock file after $maxattempts checks? [$dflt]"
3837$echo $n "$rp $c"
3838. myread
3839case "$ans" in
3840y*) d_remlock="$define";;
3841*)  d_remlock="$undef";;
3842esac
3843
3844: see if rename exists
3845set rename d_rename
3846eval $inlibc
3847
3848: see if setegid exists
3849set setegid d_setegid
3850eval $inlibc
3851# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3852# Initial import of elm 2.4 PL0 as base for elm 2.5.
3853#
3854# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
3855# Elm 2
3856#
3857: see if BSD sigset exists
3858echo " "
3859set sigset d_sigset
3860eval $inlibc
3861: See if sigaction exists -- POSIX has highest priority in match
3862if $contains sigaction libc.list >/dev/null 2>&1; then
3863    echo "sigaction() found."
3864    d_sigaction="$define"
3865    d_sigset="$undef"
3866    d_sigvec="$undef"
3867    d_sigvectr="$undef"
3868else
3869    d_sigaction="$undef"
3870: see if sigvector exists -- since sigvec will match the substring
3871    if $contains sigvector libc.list >/dev/null 2>&1; then
3872        echo 'sigvector() found--you must be running HP-UX.'
3873        d_sigvectr="$define"
3874        d_sigvec="$define"
3875    else
3876: try the original name
3877        d_sigvectr="$undef"
3878        if $contains sigvec libc.list >/dev/null 2>&1; then
3879	    echo 'sigvec() found.'
3880	    d_sigvec="$define"
3881        else
3882	    case "$d_sigset" in
3883	    "$define")
3884               echo 'sigvec() not found';;
3885	    *)
3886               echo 'sigvec() not found--race conditions with signals may occur.';;
3887	    esac
3888            d_sigvec="$undef"
3889        fi
3890    fi
3891fi
3892
3893: see if sigprocmask exists -- POSIX has highest priority in match
3894echo " "
3895if $contains sigprocmask libc.list >/dev/null 2>&1; then
3896    echo 'sigprocmask() found.'
3897    d_sigprocmask="$define"
3898    d_sigblock="$undef"
3899    d_sighold="$undef"
3900else
3901    d_sigprocmask="$undef"
3902: see if sigblock exists
3903    if $contains sigblock libc.list >/dev/null 2>&1; then
3904	echo 'sigblock() found.'
3905	d_sigblock="$define"
3906	d_sighold="$undef"
3907    else
3908: see if sighold exists
3909	d_sigblock="$undef"
3910	if $contains sighold libc.list >/dev/null 2>&1; then
3911	    echo 'sighold() found.'
3912	    d_sighold="$define"
3913	else
3914	    echo 'No signal masking functions found.'
3915	    d_sighold="$undef"
3916	fi
3917    fi
3918fi
3919
3920case "$d_statuschg" in
3921"$define") dflt=y;;
3922"$undef")  dflt=n;;
3923*)	dflt=n;;
3924esac
3925$cat <<EOM
3926 
3927Some sites that install the Elm Mail System may not wish to enable the
3928S)tatus Change function, which permits users to change the status of
3929their messages arbitrarily from within Elm.  If you choose, you can
3930instead disable that function, with the program being slightly smaller
3931and presenting an appropriate error message to users if they try to
3932invoke S)tatus Change to alter the status of their messages.
3933
3934EOM
3935rp="Would you like to enable the S)tatus Change function? [$dflt]"
3936$echo $n "$rp $c"
3937. myread
3938case "$ans" in
3939y*) d_statuschg="$define";;
3940*)  d_statuschg="$undef";;
3941esac
3942
3943: see if strspn exists
3944set strspn d_strspn
3945eval $inlibc
3946
3947: see if strcspn exists
3948set strcspn d_strcspn
3949eval $inlibc
3950
3951: see if strpbrk exists
3952set strpbrk d_strpbrk
3953eval $inlibc
3954
3955# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3956# Initial import of elm 2.4 PL0 as base for elm 2.5.
3957#
3958# Revision 1.1.1.1  1995/04/13  19:38:56  wfp5p
3959# Elm 2
3960#
3961: see if there is a strerror
3962set strerror d_strerror
3963eval $inlibc
3964
3965# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3966# Initial import of elm 2.4 PL0 as base for elm 2.5.
3967#
3968# Revision 1.1.1.1  1995/04/13  19:38:56  wfp5p
3969# Elm 2
3970#
3971: see if there is a strftime
3972set strftime d_strftime
3973eval $inlibc
3974
3975# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3976# Initial import of elm 2.4 PL0 as base for elm 2.5.
3977#
3978# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
3979# Elm 2
3980#
3981: see if there is a strstr
3982set strstr d_strstr
3983eval $inlibc
3984
3985# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3986# Initial import of elm 2.4 PL0 as base for elm 2.5.
3987#
3988# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
3989# Elm 2
3990#
3991: see if there is a strtok
3992set strtok d_strtok
3993eval $inlibc
3994
3995# Revision 1.2  1996/05/09  15:50:35  wfp5p
3996# Alpha 10
3997#
3998# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
3999# Initial import of elm 2.4 PL0 as base for elm 2.5.
4000#
4001# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
4002# Elm 2
4003#
4004case "$d_subshell" in
4005"$define") dflt=y;;
4006"$undef")  dflt=n;;
4007*)	dflt=y;;
4008esac
4009$cat <<EOM
4010 
4011Some sites wish to disable the usage of the shell escape from Elm.
4012If you choose, you can disallow subshells from within Elm.
4013
4014WARNING: This only controls Elm's usage of the ! command.  Any pager
4015or editor could still allow subshells.  It is also trivial to get a
4016subshell through manipulation of the pipe command or various option
4017settings.  DO NOT rely on this as a security measure.
4018
4019EOM
4020rp="Would you like to allow the ! command (subshells)? [$dflt]"
4021$echo $n "$rp $c"
4022. myread
4023case "$ans" in
4024y*) d_subshell="$define";;
4025*)  d_subshell="$undef";;
4026esac
4027
4028: see if symlink exists
4029set symlink d_symlink
4030eval $inlibc
4031
4032: see if tempnam exists
4033set tempnam d_tempnam
4034eval $inlibc
4035
4036# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
4037# Initial import of elm 2.4 PL0 as base for elm 2.5.
4038#
4039# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
4040# Elm 2
4041#
4042: see if this is a termio system
4043: Prefer POSIX-approved termios.h over all else.
4044:
4045echo " "
4046d_termios="$undef"
4047d_termio="$undef"
4048if $test -r /usr/include/termios.h ; then
4049    set tcsetattr d_termios
4050    eval $inlibc
4051fi
4052if $test "$d_termios" = "$define" ; then
4053    echo "You have POSIX termios.h... good!"
4054elif Cppsym pyr ; then
4055    if $test "`/bin/universe`" = "ucb" ; then
4056	if $test -r /usr/include/sgtty.h ; then
4057	    echo "sgtty.h found."
4058	else
4059	    echo "System is a pyramid, and universe is bsd,"
4060	    echo "sgtty.h not found--you could have problems."
4061	fi
4062    else
4063	if $test -r /usr/include/termio.h ; then
4064	    d_termio="$define"
4065	    echo "termio.h found."
4066	else
4067	    echo "System is a pyramid, and universe is att,"
4068	    echo "termio.h not found--you could have problems."
4069	fi
4070    fi
4071elif bsd ; then
4072    if $test -r /usr/include/sgtty.h ; then
4073	echo "sgtty.h found."
4074    elif $test -r /usr/include/termio.h ; then
4075	d_termio="$define"
4076	echo "termio.h found."
4077    else
4078	echo "Neither termio.h nor sgtty.h found--you could have problems."
4079    fi
4080else
4081    if $test -r /usr/include/termio.h ; then
4082	d_termio="$define"
4083	echo "termio.h found."
4084    elif $test -r /usr/include/sgtty.h ; then
4085	echo "sgtty.h found."
4086    else
4087	echo "Neither termio.h nor sgtty.h found--you could have problems."
4088    fi
4089fi
4090
4091# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
4092# Initial import of elm 2.4 PL0 as base for elm 2.5.
4093#
4094# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
4095# Elm 2
4096#
4097: check for valid reply/to fields
4098case "$d_useembed" in
4099"$define")	dflt=y;;
4100"$undef")	dflt=n;;
4101*)	        if $test "$d_internet" = "$define" ; then
4102	            dflt=y
4103	        else
4104	            dflt=n
4105	        fi
4106	        ;;
4107esac
4108$cat <<EOM
4109 
4110One of the more annoying quirks of the UUCP network and various other
4111systems that interact with it are that everyone seems to have different
4112ideas about how to do routing, etc.  Therefore, a lot of times e-mail
4113will arrive from off site with corrupt, unusable "Reply-To:" and "From:"
4114fields.  This next question relates to whether your site is liable to
4115get mangled fields or not...
4116
4117Does your site receive e-mail with valid "Reply-To:" and "From:" fields?
4118
4119EOM
4120$echo $n "Use Reply-To: and From: addresses? [$dflt] $c"
4121rp="Are Reply-to: and From: addresses reliable? [$dflt]"
4122. myread
4123case "$ans" in
4124y*) d_useembed="$define";;
4125*)  d_useembed="$undef";;
4126esac
4127
4128: see if getdomainname exists
4129if $contains "^getdomainname\$" libc.list > /dev/null 2>&1; then
4130    echo "getdomainname() found"
4131    d_domname=$define;
4132elif $contains "^getdomnm\$" libc.list > /dev/null 2>&1; then
4133    echo "getdomainname() found"
4134    d_domname=$define;
4135else
4136    echo "getdomainname() not found"
4137    d_domname=$undef
4138fi
4139
4140case "$d_domname" in
4141"$define")	cat <<EOM
4142
4143The getdomainname system call was found.  When running NIS, this usually
4144returns the NIS domain and not the mail domain.  If this is the case,
4145it should not be used to obtain the domain name, and the domain name
4146should be compiled into the code, and the global elm.rc file should
4147be used to override the compiled in value.
4148
4149If the getdomainname call does return the correct mail domain, it can
4150be used.
4151
4152EOM
4153		case "$d_usegetdom" in
4154		"$define")	dflt=y;;
4155		"$undef")	dflt=n;;
4156		*)		dflt=n;;
4157		esac
4158		echo " "
4159		rp="Should getdomainname() be used to obtain the mail domain? [$dflt]"
4160		$echo $n "$rp $c"
4161		. myread
4162		case "$ans" in
4163		y*) d_usegetdom="$define";;
4164		*)  d_usegetdom="$undef";;
4165		esac
4166		;;
4167*)		d_usegetdom="$undef";;
4168esac;
4169# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
4170# Initial import of elm 2.4 PL0 as base for elm 2.5.
4171#
4172# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
4173# Elm 2
4174#
4175: see if we should include time.h, sys/time.h, or both
4176cat <<'EOM'
4177
4178Testing to see if we should include <time.h>, <sys/time.h> or both.
4179I'm now running the test program...
4180EOM
4181$cat >try.c <<'EOCP'
4182#ifdef I_TIME
4183#include <time.h>
4184#endif
4185#ifdef I_SYSTIME
4186#ifdef SYSTIMEKERNEL
4187#define KERNEL
4188#endif
4189#include <sys/time.h>
4190#endif
4191main()
4192{
4193    struct tm foo;
4194#ifdef S_TIMEVAL
4195    struct timeval bar;
4196#endif
4197    if (foo.tm_sec == foo.tm_sec)
4198	exit(0);
4199#ifdef S_TIMEVAL
4200    if (bar.tv_sec == bar.tv_sec)
4201	exit(0);
4202#endif
4203    exit(1);
4204}
4205EOCP
4206flags=''
4207for s_timeval in '-DS_TIMEVAL' ''; do
4208    for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
4209	for i_time in '-DI_TIME' ''; do
4210	    for i_systime in '-DI_SYSTIME' ''; do
4211		case "$flags" in
4212		'') echo "Trying $i_time $i_systime $d_systimekernel $s_timeval"
4213		    if $cc $ccflags $i_time $i_systime $d_systimekernel $s_timeval \
4214			    try.c -o try >/dev/null 2>&1 ; then
4215			set X $i_time $i_systime $d_systimekernel $s_timeval
4216			shift
4217			flags="$*"
4218			echo "Succeeded with $flags"
4219		    fi
4220		    ;;
4221		esac
4222	    done
4223	done
4224    done
4225done
4226case "$flags" in
4227*SYSTIMEKERNEL*) d_systimekernel="$define";;
4228*) d_systimekernel="$undef";;
4229esac
4230case "$flags" in
4231*I_TIME*) i_time="$define";;
4232*) i_time="$undef";;
4233esac
4234case "$flags" in
4235*I_SYSTIME*) i_systime="$define";;
4236*) i_systime="$undef";;
4237esac
4238$rm -f try.c try
4239
4240: see if utime.h is in includepath
4241echo " "
4242i_utime=`loc utime.h "" /usr/include $includepath`
4243if $test -n "$i_utime"; then
4244	echo "Found <utime.h>"
4245	i_utime="$define"
4246	i_sysutime="$undef"
4247else
4248	i_sysutime=`loc sys/utime.h "" /usr/include $includepath`
4249	if $test -n "$i_sysutime"; then
4250		echo "Found <sys/utime.h>"
4251		i_utime="$undef"
4252		i_sysutime="$define"
4253	else
4254		echo "Did not find <utime.h> or <sys/utime.h>"
4255		i_utime="$undef"
4256		i_sysutime="$undef"
4257	fi
4258fi
4259
4260# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
4261# Initial import of elm 2.4 PL0 as base for elm 2.5.
4262#
4263# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
4264# Elm 2
4265#
4266: check for utimbuf structure
4267echo " "
4268case "$d_utimbuf" in
4269"$define")	;;
4270"$undef")	;;
4271*)
4272: Pyramid passes the att compile test but still needs the definition
4273	if Cppsym pyr ; then
4274	    if $test "`/bin/universe`" = "att" ; then
4275		d_utimbuf="$undef"
4276		echo "I will use my 'utimbuf' structure..."
4277	    else
4278		d_utimbuf="$define"
4279		echo "You have the 'utimbuf' structure..."
4280            fi
4281	else
4282	  if $test "$d_utimbuf" != "$define"; then
4283	      echo "Checking to see if struct utimbuf exists."
4284	      $cat >try.c <<'EOCP'
4285#include <stdio.h>
4286#include <fcntl.h>
4287#include <sys/types.h>
4288#include <sys/stat.h>
4289#define far /* to keep Xenix from complaining */
4290#if (defined(BSD) || !defined(apollo))
4291#  include <sys/file.h>
4292#endif
4293#ifdef I_TIME
4294#  include <time.h>
4295#endif
4296#ifdef I_SYSTIME
4297#  include <sys/time.h>
4298#endif
4299#ifdef BSD
4300#  include <sys/timeb.h>
4301#endif
4302#ifdef I_UTIME
4303#  include <utime.h>
4304#endif
4305#ifdef I_SYSUTIME
4306#  include <sys/utime.h>
4307#endif
4308
4309main()
4310{
4311struct utimbuf test;
4312test.actime = 0;
4313exit(1);
4314}
4315EOCP
4316	      cflags=$ccflags
4317	      if $test "$i_utime" = "$define"; then
4318		  cflags="$cflags -DI_UTIME"
4319	      fi
4320	      if $test "$i_sysutime" = "$define"; then
4321		  cflags="$cflags -DI_SYSUTIME"
4322	      fi
4323	      if $test "$i_time" = "$define"; then
4324		  cflags="$cflags -DI_TIME"
4325	      fi
4326	      if $test "$i_systime" = "$define"; then
4327		  cflags="$cflags -DI_SYSTIME"
4328	      fi
4329	      if $test "$d_bsd" = "$define"; then
4330		  cflags="$cflags -DBSD"
4331	      fi
4332	      if $cc $cflags try.c -o try >/dev/null 2>&1 ; then
4333		  d_utimbuf="$define"
4334		  echo "You have the 'utimbuf' structure..."
4335	      else
4336		  echo "I will use my 'utimbuf' structure..."
4337		  d_utimbuf="$undef"
4338	      fi
4339	      $rm -f try.c try.o try
4340	    fi
4341	fi
4342	;;
4343esac
4344
4345# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
4346# Initial import of elm 2.4 PL0 as base for elm 2.5.
4347#
4348# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
4349# Elm 2
4350#
4351: see if there is a vfork
4352if Cppsym sgi ; then
4353    d_vfork="$undef"
4354else
4355    set vfork d_vfork
4356    eval $inlibc
4357fi
4358
4359: see if memory.h is in includepath
4360echo " "
4361i_memory=`loc memory.h "" /usr/include $includepath`
4362if $test -n "$i_memory"; then
4363	echo "Found <memory.h>"
4364	i_memory="$define"
4365else
4366	echo "Did not find <memory.h>"
4367	i_memory="$undef"
4368fi
4369
4370: see if stdarg.h is in includepath
4371echo " "
4372i_stdarg=`loc stdarg.h "" /usr/include $includepath`
4373if $test -n "$i_stdarg"; then
4374	echo "Found <stdarg.h>"
4375	i_stdarg="$define"
4376else
4377	echo "Did not find <stdarg.h>"
4378	i_stdarg="$undef"
4379fi
4380
4381: see if stdlib.h is in includepath
4382echo " "
4383i_stdlib=`loc stdlib.h "" /usr/include $includepath`
4384if $test -n "$i_stdlib"; then
4385	echo "Found <stdlib.h>"
4386	i_stdlib="$define"
4387else
4388	echo "Did not find <stdlib.h>"
4389	i_stdlib="$undef"
4390fi
4391
4392: see if unistd.h is in includepath
4393echo " "
4394i_unistd=`loc unistd.h "" /usr/include $includepath`
4395if $test -n "$i_unistd"; then
4396	echo "Found <unistd.h>"
4397	i_unistd="$define"
4398else
4399	echo "Did not find <unistd.h>"
4400	i_unistd="$undef"
4401fi
4402
4403# Revision 1.2  1996/10/28  16:57:58  wfp5p
4404# Beta 1
4405#
4406# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
4407# Initial import of elm 2.4 PL0 as base for elm 2.5.
4408#
4409# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
4410# Elm 2
4411#
4412: see if signal is declared as pointer to function returning int or void
4413echo " "
4414$cppstdin $cppflags < /usr/include/signal.h >$$.tmp
4415if $contains 'void.*[^s]signal' $$.tmp >/dev/null 2>&1 ; then
4416    echo "You have void (*signal())() instead of int."
4417    sigtype="void"
4418elif $contains 'int.*[^sg]signal' $$.tmp >/dev/null 2>&1 ; then
4419    echo "You have int (*signal())() instead of void."
4420    sigtype="int"
4421elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
4422    echo "You have int (*signal())() instead of void."
4423    sigtype="int"
4424elif $contains 'sigfunc_t.*[^s]signal' $$.tmp >/dev/null 2>&1 ; then
4425    echo "You have sigfunc_t (*signal())() instead of int."
4426    sigtype="sigfunc_t"
4427elif $test -n "$sigtype"; then
4428    echo $n "As you already told me, signal handlers return $sigtype"
4429else
4430    echo "I can't determine whether signal handlers return void or int..."
4431    echo "I'm assuming they return void like ANSI and POSIX want."
4432    echo "If not, you will have to change sigtype to match the typedef"
4433    echo "used by the signal handlers.  Change it config.sh at the edit "
4434    echo "question at the end of Configure."
4435    sigtype="void"
4436fi
4437rm -f $$.tmp
4438
4439: preserve RCS keywords in files with variable substitution, grrr
4440Log='$Log'
4441Header='$Header'
4442
4443# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
4444# Initial import of elm 2.4 PL0 as base for elm 2.5.
4445#
4446# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
4447# Elm 2
4448#
4449: get default batch subject
4450$cat <<EOM
4451
4452Elm will provide a default subject for mail messages that are sent
4453in batch mode (redirected from a file.)
4454EOM
4455
4456case "$defbatsub" in
4457    '') dflt='no subject (file transmission)';;
4458    *)  dflt="$defbatsub";;
4459esac
4460echo " "
4461rp="Default batch subject: [$dflt]"
4462$echo $n "$rp $c"
4463. myread
4464defbatsub="$ans"
4465
4466# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
4467# Initial import of elm 2.4 PL0 as base for elm 2.5.
4468#
4469# Revision 1.1.1.1  1995/04/13  19:38:56  wfp5p
4470# Elm 2
4471#
4472: determine default editor
4473case "$defeditor" in
4474'')
4475    case "$vi" in
4476    */*) dflt="$vi";;
4477    *) dflt=/usr/ucb/vi;;
4478    esac
4479    ;;
4480*)  dflt="$defeditor"
4481    ;;
4482esac
4483
4484$cat <<EOM
4485
4486Elm must be configured with a default editor.  On most systems this may
4487be 'vi'.  If you prefer to use some other, easier editor enter it here.
4488You will be given a change to provide command line options to this
4489command in the next question.
4490
4491EOM
4492
4493cont=true
4494while $test "$cont" ; do
4495    echo " "
4496    rp="What is the default editor on your system? [$dflt]"
4497    $echo $n "$rp $c"
4498    . myread
4499    defeditor="$ans"
4500    if $test -f "$ans"; then
4501	cont=''
4502    else
4503	lookup=`loc "$ans" "" . $pth`
4504	if $test -f "$lookup"; then
4505	    cont=''
4506	    defeditor=$lookup
4507	else
4508	    if $test "$fastread" = yes; then
4509	        dflt=y
4510	    else
4511	        dflt=n
4512	    fi
4513	    echo "Editor $ans doesn't exist."
4514	    rp="Use that name anyway? [$dflt]"
4515	    $echo $n "$rp $c"
4516	    . myread
4517	    dflt=''
4518	    case "$ans" in
4519	    y*) cont='';;
4520	    esac
4521        fi
4522    fi
4523done
4524
4525: determine the editor flags to use
4526$cat <<EOM
4527
4528If this editor requires any options for proper use, specify them
4529here.  To specify no options, enter the word "none".  For example,
4530'pico' users will want to use the -t option.  This is the proper
4531place to specify that option.
4532
4533EOM
4534dflt="$editoropts"
4535rp="What options should Elm use with $defeditor: [$dflt]"
4536$echo $n "$rp $c"
4537. myread
4538editoropts=$ans
4539case "$editoropts" in
4540'none') editoropts=''
4541     ;;
4542esac
4543
4544# Revision 1.3  1995/06/09  22:05:38  wfp5p
4545# The default is now remembered from the last time Configure was run.
4546#
4547# Revision 1.2  1995/06/09  14:21:44  wfp5p
4548# Changed so that you can specify a different install path.
4549#
4550# Revision 1.1  1995/06/08  15:45:54  wfp5p
4551# Changed bin to allow a different install dir
4552#
4553: determine where public executables go
4554case "$bin" in
4555'')
4556    dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
4557    ;;
4558*)  dflt="$bin"
4559    ;;
4560esac
4561cont=true
4562while $test "$cont" ; do
4563    echo " "
4564    rp="Where do you want to put the public executables? [$dflt]"
4565    $echo $n "$rp $c"
4566    . myread
4567    bin="$ans"
4568    bin=`filexp $bin`
4569    if test -d $bin; then
4570	cont=''
4571    else
4572	case "$fastread" in
4573	yes) dflt=y;;
4574	*) dflt=n;;
4575	esac
4576	rp="Directory $bin doesn't exist.  Use that name anyway? [$dflt]"
4577	$echo $n "$rp $c"
4578	. myread
4579	dflt=''
4580	case "$ans" in
4581	y*) cont='';;
4582	esac
4583    fi
4584done
4585
4586case "$installbin" in
4587'')
4588    dflt="$bin"
4589    ;;
4590*)  dflt="$installbin"
4591    ;;
4592esac
4593cont=true
4594
4595while $test "$cont" ; do
4596    echo " "
4597    rp="What path do you want to use to install the public executables? [$dflt]"
4598    $echo $n "$rp $c"
4599    . myread
4600    installbin="$ans"
4601    installbin=`filexp $installbin`
4602    if test -d $installbin; then
4603	cont=''
4604    else
4605	case "$fastread" in
4606	yes) dflt=y;;
4607	*) dflt=n;;
4608	esac
4609	rp="Directory $installbin doesn't exist.  Use that name anyway? [$dflt]"
4610	$echo $n "$rp $c"
4611	. myread
4612	dflt=''
4613	case "$ans" in
4614	y*) cont='';;
4615	esac
4616    fi
4617done
4618
4619# Revision 1.5  1999/03/24  14:03:33  wfp5p
4620# elm 2.5PL0
4621#
4622# Revision 1.4  1995/06/09  22:05:39  wfp5p
4623# The default is now remembered from the last time Configure was run.
4624#
4625# Revision 1.3  1995/06/08  15:44:42  wfp5p
4626# Changes to configure for AIX
4627#
4628# Revision 1.2  1995/04/26  18:49:46  wfp5p
4629# Changed Configure to allow a different install path
4630#
4631# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
4632# Initial import of elm 2.4 PL0 as base for elm 2.5.
4633#
4634# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
4635# Elm 2
4636#
4637
4638: determine where public libraries go
4639
4640$cat <<EOM
4641
4642Elm needs a place to store its support files.  This includes things
4643such as configuration and help information.  They are all readable
4644text files, that may be shared across machines.
4645EOM
4646
4647case "$lib" in
4648'')
4649    dflt=`loc . "." /usr/local/lib /usr/lib /lib`
4650    ;;
4651*)  dflt="$lib"
4652    ;;
4653esac
4654cont=true
4655while $test "$cont" ; do
4656    echo " "
4657    rp="Where do you want to put the support files? [$dflt]"
4658    $echo $n "$rp $c"
4659    . myread
4660    lib="$ans"
4661    lib=`filexp $lib`
4662    if $test -d "$lib"; then
4663	cont=''
4664    else
4665	case "$fastread" in
4666	yes)	dflt=y;;
4667	*)	dflt=n;;
4668	esac
4669	rp="Directory $lib doesn't exist.  Use that name anyway? [$dflt]"
4670	$echo $n "$rp $c"
4671	. myread
4672	dflt=''
4673	case "$ans" in
4674	y*) cont='';;
4675	esac
4676    fi
4677done
4678
4679case "$installlib" in
4680'')
4681    dflt="$lib"
4682    ;;
4683*)  dflt="$installlib"
4684    ;;
4685esac
4686cont=true
4687
4688while $test "$cont" ; do
4689    echo " "
4690    rp="What path do you want to use to install the public files? [$dflt]"
4691    $echo $n "$rp $c"
4692    . myread
4693    installlib="$ans"
4694    installlib=`filexp $installlib`
4695    if $test -d "$installlib"; then
4696	cont=''
4697    else
4698	case "$fastread" in
4699	yes)	dflt=y;;
4700	*)	dflt=n;;
4701	esac
4702	rp="Directory $installlib doesn't exist.  Use that name anyway? [$dflt]"
4703	$echo $n "$rp $c"
4704	. myread
4705	dflt=''
4706	case "$ans" in
4707	y*) cont='';;
4708	esac
4709    fi
4710done
4711
4712: ask the preferred line printer and options for this system.
4713case "$linepr" in
4714'')
4715    if $test -f "$lp"; then
4716	dflt="$lp"
4717    elif $test -f "$lpr"; then
4718	dflt="$lpr"
4719    else
4720	dflt=
4721    fi
4722    ;;
4723*)  dflt="$linepr";;
4724esac
4725
4726linepr='blurfl/dyick'
4727$cat <<EOM
4728
4729Elm has an option to send messages to the printer.  This question
4730asks for the default spooler name.  You can also specify options to
4731the command by separating them from the command by at least one space.
4732
4733EOM
4734cont=true
4735while $test "$cont" ; do
4736    rp="What print spooler do you prefer to use with Elm? [$dflt]"
4737    $echo $n "$rp $c"
4738    . myread
4739    linepr="$ans"
4740    ans=`$expr "$linepr" : "\([^ ]*\).*"`
4741    case "$ans" in
4742    /*)
4743	if $test -f "$ans"; then
4744	    cont=''
4745	else
4746	    if $test "$fastread" = yes; then
4747		dflt=y
4748	    else
4749		dflt=n
4750	    fi
4751	    rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
4752	    $echo $n "$rp $c"
4753	    . myread
4754	    case "$ans" in
4755	    y*) cont='';;
4756	    esac
4757	fi
4758	;;
4759    *)
4760        if $test "$fastread" = yes; then
4761	    echo "The print spooler needs to be a full path name."
4762	    echo "Using the current, possibly improper, value."
4763	    cont=''
4764	else
4765	    echo "Please give the full path name."
4766	fi
4767	;;
4768    esac
4769done
4770
4771# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
4772# Initial import of elm 2.4 PL0 as base for elm 2.5.
4773#
4774# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
4775# Elm 2
4776#
4777: determine where mail is spooled
4778case "$maildir" in
4779'')
4780    dflt=`loc . /usr/spool/mail /usr/spool/mail /var/mail /usr/mail`
4781    ;;
4782*)  dflt="$maildir"
4783    ;;
4784esac
4785cont=true
4786while $test "$cont" ; do
4787    echo " "
4788    rp="Where is yet-to-be-read mail spooled? [$dflt]"
4789    $echo $n "$rp $c"
4790    . myread
4791    maildir=`filexp "$ans"`
4792    if test -d $maildir; then
4793	cont=''
4794    else
4795	if $test "$fastread" = yes; then
4796	    dflt=y
4797	else
4798	    dflt=n
4799	fi
4800	rp="Directory $maildir doesn't exist.  Use that name anyway? [$dflt]"
4801	$echo $n "$rp $c"
4802	. myread
4803	dflt=''
4804	case "$ans" in
4805	y*) cont='';;
4806	esac
4807    fi
4808done
4809
4810# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
4811# Initial import of elm 2.4 PL0 as base for elm 2.5.
4812#
4813# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
4814# Elm 2
4815#
4816: determine the group of the mail directory and what group elm should use
4817mailgrp=`$ls -lgd $maildir/.`
4818mailgrp=`$expr "$mailgrp" : "[ld][rwxstS-]*[ 0123456789]*\(.*\)"`
4819: now mailgrp is either    user group size mon day time/year name
4820: or                       group size mon day time/year name
4821try1=`$expr "$mailgrp" : "[A-Za-z_0-9]* *\([A-Za-z_0-9]*\).*"`
4822try1a=`$expr "$try1" : "\([0-9]*\).*"`
4823if $test "$try1" = "$try1a"; then
4824    mailgrp=`$expr "$mailgrp" : "\([A-Za-z_0-9]*\).*"`
4825else
4826    mailgrp="$try1"
4827fi
4828case "$mailgrp" in
4829'')
4830    mailgrp=mail
4831    ;;
4832esac
4833echo " "
4834echo "Mail group is $mailgrp"
4835
4836# Revision 1.1.1.1  1995/04/19  20:38:27  wfp5p
4837# Initial import of elm 2.4 PL0 as base for elm 2.5.
4838#
4839# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
4840# Elm 2
4841#
4842: ask about setgid running of Elm
4843case "$d_setgid" in
4844"$define")	dflt=y;;
4845"$undef")	dflt=n;;
4846*)		dflt=y;;
4847esac
4848cat <<EOM
4849
4850Elm needs to be installed and run as a setgid program only if the mail
4851spool directory permissions do not allow world write access.  If your
4852mail spool directory has the permissions:
4853
4854drwxrwxr-x  3 root     mail          512 Dec 24 17:20 /usr/mail
4855
4856then Elm must be setgid to the same group as the mail spool directory
4857(in this case group mail).  However, if the spool permissions look
4858like:
4859
4860drwxrwsrwt  2 root     staff         512 Dec 21 20:14 /usr/spool/mail
4861
4862then Elm should not be installed or run as a setgid program.
4863
4864EOM
4865rp="Am I going to be running as a setgid program? [$dflt]"
4866$echo $n "$rp $c"
4867. myread
4868case "$ans" in
4869y*) d_setgid="$define";;
4870*)  d_setgid="$undef";;
4871esac
4872case "$d_setgid" in
4873"$define")
4874    mailermode=2755
4875    cat <<EOM
4876
4877Since Elm is being installed as a setgid program, it must be installed
4878by root, or a user able to set the setgid bit.
4879
4880To provide better security, Elm can be configured to switch to the
4881privileged group of $mailgrp only when necessary to access mail folders.
4882
4883Unfortunately, not all machines can switch between the real and effective
4884gid values.  If you are not sure of the capability of your machine, it
4885is suggested that you start with Elm configured to switch gid values and
4886if, when you run Elm it cannot set the lock for the mailbox, reconfigure
4887Elm to not use this feature.
4888EOM
4889    case "$d_savegrpmboxid" in
4890    "$define")	dflt=y;;
4891    "$undef")	dflt=n;;
4892    *)		dflt=y;;
4893    esac
4894    echo " "
4895    rp="Can your system use setgid() to switch between the real and
4896effective gid values? [$dflt]"
4897    $echo $n "$rp $c"
4898    . myread
4899    case "$ans" in
4900    y*) d_savegrpmboxid="$define";;
4901    *)  d_savegrpmboxid="$undef";;
4902    esac
4903    ;;
4904*)  mailermode=755
4905    d_savegrpmboxid="$undef"
4906    ;;
4907esac
4908
4909: ask the preferred pager for this system.
4910case "$pager" in
4911'') dflt="builtin+";;
4912*)  dflt="$pager";;
4913esac
4914
4915pager='blurfl/dyick'
4916echo " "
4917cont=true
4918while $test "$cont" ; do
4919    rp="What pager do you prefer to use with $package? [$dflt]"
4920    $echo $n "$rp $c"
4921    . myread
4922    pager="$ans"
4923    case "$ans" in
4924    builtin)
4925        cont=''
4926	;;
4927    builtin+)
4928        cont=''
4929	;;
4930    /*)
4931	if $test -f "$ans"; then
4932	    cont=''
4933	else
4934	    if $test "$fastread" = yes; then
4935		dflt=y
4936	    else
4937		dflt=n
4938	    fi
4939	    rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
4940	    $echo $n "$rp $c"
4941	    . myread
4942	    case "$ans" in
4943	    y*) cont='';;
4944	    esac
4945	fi
4946	;;
4947    *)
4948	echo "Please give the full path name."
4949	;;
4950    esac
4951done
4952
4953: find out which shell people like to use most
4954case "$prefshell" in
4955'')
4956    if $test -f /bin/ksh; then
4957	dflt='/bin/ksh'
4958    elif $test -f /bin/csh; then
4959	dflt='/bin/csh'
4960    else
4961	dflt='/bin/sh'
4962    fi
4963    ;;
4964*)  dflt="$prefshell";;
4965esac
4966cont=true
4967while $test "$cont" ; do
4968    echo " "
4969    echo "Give the full path name of the shell most people like to use on your"
4970    $echo $n "system: [$dflt] $c"
4971    rp="Preferred shell: [$dflt]"
4972    . myread
4973    prefshell=$ans
4974    if test -f $ans; then
4975	cont=''
4976    else
4977	if $test "$fastread" = yes; then
4978	    dflt=y
4979	else
4980	    dflt=n
4981	fi
4982	rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
4983	$echo $n "$rp $c"
4984	. myread
4985	dflt=''
4986	case "$ans" in
4987	y*) cont='';;
4988	esac
4989    fi
4990done
4991
4992: see if ar generates random libraries by itself
4993echo " "
4994echo "Checking how to generate random libraries on your machine..."
4995ar rc ran.a /dev/null
4996if ar ts ran.a >/dev/null 2>&1; then
4997	echo "ar appears to generate random libraries itself."
4998	orderlib=false
4999	ranlib=":"
5000else
5001	if test -f /usr/bin/ranlib; then
5002		ranlib=/usr/bin/ranlib
5003	elif test -f /bin/ranlib; then
5004		ranlib=/bin/ranlib
5005	fi
5006
5007	if test -n "$ranlib"; then
5008		echo "your system has $ranlib; we'll use that."
5009		orderlib=false
5010	else
5011		echo "your system doesn't seem to support random libraries"
5012		echo "so we'll use lorder and tsort to order the libraries."
5013		orderlib=true
5014		ranlib=":"
5015	fi
5016fi
5017
5018# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
5019# Initial import of elm 2.4 PL0 as base for elm 2.5.
5020#
5021# Revision 1.1.1.1  1995/04/13  19:38:55  wfp5p
5022# Elm 2
5023#
5024: determine the name of the tape device
5025rmttape=`loc rct0 "" /dev`
5026if $test -z "$rmttape"; then
5027	rmttape=`loc rmt0 "" /dev`
5028fi
5029if $test -z "$rmttape"; then
5030	rmttape=`loc rtp0 "unknown-remote-tape-unit" /dev`
5031fi
5032echo "remote tape drive is $rmttape"
5033echo " "
5034# Revision 1.1  1995/09/29  17:58:46  wfp5p
5035# These were missing from rcs...
5036#
5037
5038: locate the termlib routines
5039
5040echo " "
5041case "$termlib" in
5042'')
5043    echo "Looking for your termlib routines..."
5044    cat >try.c << 'EOF'
5045#include <stdio.h>
5046char tbuf[1024];
5047main()
5048{
5049    /* return codes:  -1 == error,  0 == unknown term,  1 == ok */
5050    exit(tgetent(tbuf, "vt100") >= 0 ? 0 : 1);
5051}
5052EOF
5053    for dflt in -lcurses -lncurses -ltermlib -ltermcap none ; do
5054	case "$dflt" in
5055	none)
5056	    $echo "I cannot seem to find your termlib routines."
5057	    break
5058	    ;;
5059	esac
5060	echo "Trying $dflt..."
5061	$cc $ccflags -o try try.c $dflt >/dev/null 2>&1
5062	if $test $? -eq 0 -a -f try ; then
5063	    if ./try >/dev/null 2>&1 ; then
5064		$echo "That seems to work."
5065		break
5066	    fi
5067	fi
5068    done
5069    rm -f try.c try.o try
5070    ;;
5071*)
5072    dflt="$termlib"
5073    ;;
5074esac
5075echo " "
5076echo "Enter the name of the library that contains your termlib routines."
5077echo "Either \"-lfoo\" or \"/lib/foo.a\" format is OK."
5078echo "Enter \"none\" if no special library needs to be loaded."
5079echo " "
5080rp="Where is the library with your termlib routines? [$dflt]"
5081echo $n "$rp $c"
5082. myread
5083case "$ans" in
5084	'')	ans="$dflt" ;;
5085esac
5086case "$ans" in
5087	none)	termlib= ;;
5088	*)	termlib="$ans" ;;
5089esac
5090
5091# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
5092# Initial import of elm 2.4 PL0 as base for elm 2.5.
5093#
5094# Revision 1.1.1.1  1995/04/13  19:38:56  wfp5p
5095# Elm 2
5096#
5097: determine where temporary files should go
5098case "$tmpdir" in
5099'')
5100    dflt=`loc . "." "/tmp /usr/tmp"`
5101    ;;
5102*)  dflt="$tmpdir"
5103    ;;
5104esac
5105if $test -d "$tmpdir" -a "$tmpdir" != ""; then
5106	$echo " "
5107	$echo "Temporary files will be put in the $tmpdir directory"
5108else
5109	cont=true
5110	while $test "$cont" ; do
5111	    $echo " "
5112	    rp="Where do you want to put the temporary files? [$dflt]"
5113	    $echo $n "$rp $c"
5114	    . myread
5115	    tmpdir="$ans"
5116	    tmpdir=`filexp $tmpdir`
5117	    if $test -d "$tmpdir" -a "$tmpdir" != ""; then
5118		cont=''
5119	    else
5120		if $test "$fastread" = yes; then
5121		    dflt=y
5122		else
5123		    dflt=n
5124		fi
5125		rp="Directory $tmpdir doesn't exist.  Use that name anyway? [$dflt]"
5126		$echo $n "$rp $c"
5127		. myread
5128		dflt=''
5129		case "$ans" in
5130		y*) cont='';;
5131		esac
5132	    fi
5133	done
5134fi
5135
5136# Revision 1.3  1995/09/29  17:40:33  wfp5p
5137# Alpha 8 (Chip's big changes)
5138#
5139# Revision 1.2  1995/06/30  14:56:07  wfp5p
5140# Alpha 5
5141#
5142# Revision 1.1.1.1  1995/04/19  20:38:28  wfp5p
5143# Initial import of elm 2.4 PL0 as base for elm 2.5.
5144#
5145# Revision 1.1.1.1  1995/04/13  19:38:53  wfp5p
5146# Elm 2
5147#
5148: figure out timezone handling
5149
5150cp $source_dir/lib/get_tz.c try.c 2>/dev/null \
5151	|| $echo "Oh no!  I cannot find the \"lib/get_tz.c\" file."
5152cat >elm_defs.h <<EOF
5153#$i_time I_TIME
5154#$i_systime I_SYSTIME
5155#include <stdio.h>
5156#include <sys/types.h>
5157EOF
5158$echo " "
5159dflt_handling=$tzname_handling
5160tzname_handling=
5161if $test -f try.c ; then
5162    $echo "Figuring out how to get timezone names."
5163    for tzname_handling in DFLT TM_NAME TM_ZONE TZNAME TIMEZONE ERROR ; do
5164	case "$tzname_handling" in
5165	DFLT)		$test "$dflt_handling" = "" && continue
5166			tzname_handling=$dflt_handling
5167			;;
5168	ERROR)		tzname_handling=
5169			break
5170			;;
5171	$dflt_handling)	: avoid doing default twice
5172			continue
5173			;;
5174	esac
5175	$echo "Trying -DTZNAME_USE_$tzname_handling"
5176	$cc -D_CONFIGURE -DTZNAME_USE_$tzname_handling $ccflags \
5177		try.c -o try >/dev/null 2>&1
5178	if $test $? -eq 0 && ./try >try.out 2>&1 ; then
5179		$echo "Alright!  That seems to have worked."
5180		break
5181	fi
5182    done
5183fi
5184if $test "$tzname_handling" = "" ; then
5185    $echo "I cannot figure out how to get timezone names."
5186    if $test "$dflt_handling" != "" ; then
5187	tzname_handling="$dflt_handling"
5188	$echo "You said \"$tzname_handling\" worked last time so I'll use that."
5189    else
5190	tzname_handling=UNKNOWN
5191	$echo "You will have to set \"tzname_handling\" manually."
5192    fi
5193fi
5194$rm -f elm_defs.h try.c try.o try try.out
5195
5196# Revision 1.3  1995/07/18  18:59:39  wfp5p
5197# Alpha 6
5198#
5199# Revision 1.2  1995/06/30  14:56:05  wfp5p
5200# Alpha 5
5201#
5202# Revision 1.1.1.1  1995/04/19  20:38:26  wfp5p
5203# Initial import of elm 2.4 PL0 as base for elm 2.5.
5204#
5205# Revision 1.1.1.1  1995/04/13  19:38:54  wfp5p
5206# Elm 2
5207#
5208
5209: the "config.over" file can be used to patch configuration changes
5210if test -f ../config.over ; then
5211	echo " "
5212	echo "I have found a \"config.over\" file."
5213	dflt=y
5214	rp="Do you want to load the \"config.over\" file? [$dflt]"
5215	$echo $n "$rp $c"
5216	. myread
5217	case "$ans" in
5218    	n*)	echo "OK, I'll ignore it."
5219		;;
5220	*)	. ../config.over
5221		echo "Configuration override changes have been loaded from config.over."
5222		;;
5223	esac
5224fi
5225
5226: clean up one time files
5227for file in OneTime.PL* ; do
5228	if test -f "$file" ; then
5229		echo "Removing patch cleanup script $file . . ."
5230		rm -f $file
5231	fi
5232done
5233
5234echo " "
5235echo "End of configuration questions."
5236echo " "
5237
5238: create config.sh file
5239echo " "
5240if test -d ../UU; then
5241    cd ..
5242fi
5243echo "Creating config.sh..."
5244$spitshell <<EOT >config.sh
5245$startsh
5246# config.sh
5247# This file was produced by running the Configure script.
5248
5249Log='$Log'
5250Header='$Header'
5251contains='$contains'
5252cppstdin='$cppstdin'
5253cppminus='$cppminus'
5254d_getopt='$d_getopt'
5255d_memcpy='$d_memcpy'
5256d_mkdir='$d_mkdir'
5257d_rename='$d_rename'
5258d_symlink='$d_symlink'
5259d_whoami='$d_whoami'
5260n='$n'
5261c='$c'
5262orderlib='$orderlib'
5263ranlib='$ranlib'
5264package='$package'
5265pager='$pager'
5266prefshell='$prefshell'
5267startsh='$startsh'
5268d_eunice='$d_eunice'
5269define='$define'
5270eunicefix='$eunicefix'
5271build_dir='$build_dir'
5272source_dir='$source_dir'
5273loclist='$loclist'
5274expr='$expr'
5275sed='$sed'
5276echo='$echo'
5277cat='$cat'
5278rm='$rm'
5279mv='$mv'
5280cp='$cp'
5281tail='$tail'
5282tr='$tr'
5283mkdir='$mkdir'
5284sort='$sort'
5285uniq='$uniq'
5286grep='$grep'
5287trylist='$trylist'
5288test='$test'
5289inews='$inews'
5290ispell='$ispell'
5291egrep='$egrep'
5292more='$more'
5293pg='$pg'
5294Mcc='$Mcc'
5295vi='$vi'
5296mailx='$mailx'
5297mail='$mail'
5298cpp='$cpp'
5299perl='$perl'
5300emacs='$emacs'
5301ls='$ls'
5302rmail='$rmail'
5303sendmail='$sendmail'
5304shar='$shar'
5305smail='$smail'
5306submit='$submit'
5307tbl='$tbl'
5308troff='$troff'
5309nroff='$nroff'
5310uname='$uname'
5311uuname='$uuname'
5312line='$line'
5313chgrp='$chgrp'
5314chmod='$chmod'
5315lint='$lint'
5316sleep='$sleep'
5317pr='$pr'
5318tar='$tar'
5319ln='$ln'
5320lpr='$lpr'
5321lp='$lp'
5322touch='$touch'
5323make='$make'
5324date='$date'
5325csh='$csh'
5326pmake='$pmake'
5327mips='$mips'
5328col='$col'
5329pack='$pack'
5330bld='$bld'
5331compress='$compress'
5332execmail='$execmail'
5333libswanted='$libswanted'
5334bin='$bin'
5335installbin='$installbin'
5336c_date='$c_date'
5337d_ascii='$d_ascii'
5338d_broke_ctype='$d_broke_ctype'
5339d_broke_fflush='$d_broke_fflush'
5340d_calendar='$d_calendar'
5341calendar='$calendar'
5342d_chown_neg1='$d_chown_neg1'
5343d_content='$d_content'
5344d_crypt='$d_crypt'
5345cryptlib='$cryptlib'
5346d_cuserid='$d_cuserid'
5347d_disphost='$d_disphost'
5348d_domname='$d_domname'
5349d_usegetdom='$d_usegetdom'
5350d_errlst='$d_errlst'
5351d_flock='$d_flock'
5352d_dotlock='$d_dotlock'
5353d_fcntlock='$d_fcntlock'
5354lock_dir='$lock_dir'
5355has_flock='$has_flock'
5356has_fcntl='$has_fcntl'
5357d_fsync='$d_fsync'
5358d_ftruncate='$d_ftruncate'
5359d_gethname='$d_gethname'
5360d_douname='$d_douname'
5361d_host_comp='$d_host_comp'
5362ign_hname='$ign_hname'
5363d_index='$d_index'
5364d_internet='$d_internet'
5365d_ispell='$d_ispell'
5366ispell_path='$ispell_path'
5367ispell_options='$ispell_options'
5368d_locale='$d_locale'
5369d_nl_types='$d_nl_types'
5370d_msgcat='$d_msgcat'
5371d_usenls='$d_usenls'
5372d_mboxedit='$d_mboxedit'
5373d_mime='$d_mime'
5374defcharset='$defcharset'
5375defdispcharset='$defdispcharset'
5376d_mmdf='$d_mmdf'
5377d_newauto='$d_newauto'
5378d_noaddfrom='$d_noaddfrom'
5379d_usedomain='$d_usedomain'
5380d_noxheader='$d_noxheader'
5381d_pidcheck='$d_pidcheck'
5382d_ptem='$d_ptem'
5383d_putenv='$d_putenv'
5384d_remlock='$d_remlock'
5385maxattempts='$maxattempts'
5386d_setegid='$d_setegid'
5387d_setgid='$d_setgid'
5388d_savegrpmboxid='$d_savegrpmboxid'
5389mailermode='$mailermode'
5390d_sigvec='$d_sigvec'
5391d_sigvectr='$d_sigvectr'
5392d_sigset='$d_sigset'
5393d_sighold='$d_sighold'
5394d_sigprocmask='$d_sigprocmask'
5395d_sigblock='$d_sigblock'
5396d_sigaction='$d_sigaction'
5397d_statuschg='$d_statuschg'
5398d_strcspn='$d_strcspn'
5399d_strspn='$d_strspn'
5400d_strpbrk='$d_strpbrk'
5401d_strerror='$d_strerror'
5402d_strftime='$d_strftime'
5403d_strings='$d_strings'
5404d_pwdinsys='$d_pwdinsys'
5405strings='$strings'
5406includepath='$includepath'
5407d_strstr='$d_strstr'
5408d_strtok='$d_strtok'
5409d_subshell='$d_subshell'
5410d_tempnam='$d_tempnam'
5411tempnamo='$tempnamo'
5412tempnamc='$tempnamc'
5413d_termio='$d_termio'
5414d_termios='$d_termios'
5415d_useembed='$d_useembed'
5416d_utimbuf='$d_utimbuf'
5417d_vfork='$d_vfork'
5418defbatsub='$defbatsub'
5419defeditor='$defeditor'
5420editoropts='$editoropts'
5421hostname='$hostname'
5422phostname='$phostname'
5423mydomain='$mydomain'
5424autohostname='$autohostname'
5425i_memory='$i_memory'
5426i_stdarg='$i_stdarg'
5427i_stdlib='$i_stdlib'
5428i_time='$i_time'
5429i_systime='$i_systime'
5430d_systimekernel='$d_systimekernel'
5431i_unistd='$i_unistd'
5432i_utime='$i_utime'
5433i_sysutime='$i_sysutime'
5434lib='$lib'
5435installlib='$installlib'
5436libc='$libc'
5437linepr='$linepr'
5438maildir='$maildir'
5439mailer='$mailer'
5440mailgrp='$mailgrp'
5441mansrc='$mansrc'
5442catmansrc='$catmansrc'
5443manext='$manext'
5444manext_choice='$manext_choice'
5445catmanext='$catmanext'
5446catmanext_choice='$catmanext_choice'
5447packed='$packed'
5448manroff='$manroff'
5449manroffopts='$manroffopts'
5450suffix='$suffix'
5451packer='$packer'
5452models='$models'
5453split='$split'
5454small='$small'
5455medium='$medium'
5456large='$large'
5457huge='$huge'
5458optimize='$optimize'
5459ccflags='$ccflags'
5460cppflags='$cppflags'
5461ldflags='$ldflags'
5462cc='$cc'
5463libs='$libs'
5464nametype='$nametype'
5465d_passnames='$d_passnames'
5466d_berknames='$d_berknames'
5467d_usgnames='$d_usgnames'
5468passcat='$passcat'
5469rmttape='$rmttape'
5470roff='$roff'
5471roffopts='$roffopts'
5472sigtype='$sigtype'
5473spitshell='$spitshell'
5474shsharp='$shsharp'
5475sharpbang='$sharpbang'
5476termlib='$termlib'
5477tmpdir='$tmpdir'
5478tzname_handling='$tzname_handling'
5479xencf='$xencf'
5480xenlf='$xenlf'
5481d_xenix='$d_xenix'
5482d_bsd='$d_bsd'
5483CONFIG=true
5484EOT
5485
5486# Revision 1.2  1995/07/18  18:59:40  wfp5p
5487# Alpha 6
5488#
5489# Revision 1.1  1995/06/30  14:56:05  wfp5p
5490# Alpha 5
5491#
5492CONFIG=true
5493
5494echo " "
5495dflt=''
5496fastread=''
5497echo "If you didn't make any mistakes, then just type a carriage return here."
5498rp="If you need to edit config.sh, do it as a shell escape here:"
5499$echo $n "$rp $c"
5500case "$ans" in
5501'') ;;
5502*) : in case they cannot read
5503    eval $ans;;
5504esac
5505: if this fails, just run all the .SH files by hand
5506. ./config.sh
5507
5508if test "$source_dir" != "$build_dir" ; then
5509	echo " "
5510	echo "Setting up directories for build..."
5511	for dir in doc hdrs lib src utils ; do
5512		if $test ! -d $dir ; then
5513			echo "Creating directory $dir"
5514			mkdir $dir
5515		fi
5516	done
5517	test -f Configure && rm -f Configure
5518	cat <<EOT >Configure
5519$startsh
5520exec $0 \${1+\$@}
5521EOT
5522fi
5523
5524echo " "
5525echo "Doing variable substitutions on .SH files..."
5526set x `awk '{print $1}' <$source_dir/MANIFEST | $grep '\.SH'`
5527shift
5528case $# in
55290) set x *.SH; shift;;
5530esac
5531for file in $*; do sh $source_dir/$file ; done
5532if test -f config.h.SH; then
5533    if test ! -f config.h; then
5534	: oops, they left it out of MANIFEST, probably, so do it anyway.
5535	. config.h.SH
5536    fi
5537fi
5538
5539if $contains '^depend:' Makefile >/dev/null 2>&1; then
5540    dflt=n
5541    $cat <<EOM
5542
5543Now you need to generate make dependencies by running "make depend".
5544You might prefer to run it in background: "make depend > makedepend.out &"
5545It can take a while, so you might not want to run it right now.
5546
5547EOM
5548    rp="Run make depend now? [$dflt]"
5549    $echo $n "$rp $c"
5550    . UU/myread
5551    case "$ans" in
5552    y*) make depend && echo "Now you must run a make."
5553	;;
5554    *)  echo "You must run 'make depend' then 'make'."
5555	;;
5556    esac
5557elif test -f Makefile; then
5558    echo " "
5559    echo "Now you must run a make."
5560else
5561    echo "Done."
5562fi
5563
5564$rm -f kit*isdone
5565: the following is currently useless
5566cd UU && $rm -f $rmlist
5567: since this removes it all anyway
5568cd .. && $rm -rf UU
5569: end of Configure
5570