This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
BYTEORDER fix.
[metaconfig.git] / dist-3.0at70 / Configure
CommitLineData
959f3c4c
JH
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,
7# I would suggest you have a look at the prototypical config_h.SH file
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# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
19#
20
21# $Id: Configure,v 3.0.1.11 1997/02/28 14:52:55 ram Exp $
22#
23# Generated on Fri Feb 28 15:36:04 MET 1997 [metaconfig 3.0 PL60]
24
25cat >/tmp/c1$$ <<EOF
26ARGGGHHHH!!!!!
27
28SCO csh still thinks true is false. Write to SCO today and tell them that next
29year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
30
31(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
32we'd have to do is go in and swap the && and || tokens, wherever they are.)
33
34[End of diatribe. We now return you to your regularly scheduled programming...]
35EOF
36cat >/tmp/c2$$ <<EOF
37
38OOPS! You naughty creature! You didn't run Configure with sh!
39I will attempt to remedy the situation by running sh for you...
40EOF
41
42true || cat /tmp/c1$$ /tmp/c2$$
43true || exec sh $0 $argv:q
44
45(exit $?0) || cat /tmp/c2$$
46(exit $?0) || exec sh $0 $argv:q
47rm -f /tmp/c1$$ /tmp/c2$$
48
49: compute my invocation name
50me=$0
51case "$0" in
52*/*)
53 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
54 test "$me" || me=$0
55 ;;
56esac
57
58: Proper PATH separator
59p_=:
60: On OS/2 this directory should exist if this is not floppy only system :-]
61if test -d c:/.; then
62 p_=\;
63 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
64 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
65fi
66
67: Proper PATH setting
68paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
69paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
70paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
71paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
72paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
73paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
74paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
75paths="$paths /sbin /usr/sbin /usr/libexec"
76
77for p in $paths
78do
79 case "$p_$PATH$p_" in
80 *$p_$p$p_*) ;;
81 *) test -d $p && PATH=$PATH$p_$p ;;
82 esac
83done
84
85PATH=.$p_$PATH
86export PATH
87
88: shall we be using ksh?
89inksh=''
90needksh=''
91avoidksh=''
92newsh=/bin/ksh
93changesh=''
94if (PATH=.; alias -x) >/dev/null 2>&1; then
95 inksh=true
96fi
97if test -f /hp-ux -a -f /bin/ksh; then
98 needksh='to avoid sh bug in "here document" expansion'
99fi
100if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
101 if test X`/usr/bin/uname -v` = X4; then
102 avoidksh="to avoid AIX 4's /bin/sh"
103 newsh=/usr/bin/bsh
104 fi
105fi
106case "$inksh/$needksh" in
107/[a-z]*)
108 unset ENV
109 changesh=true
110 reason="$needksh"
111 ;;
112esac
113case "$inksh/$avoidksh" in
114true/[a-z]*)
115 changesh=true
116 reason="$avoidksh"
117 ;;
118esac
119case "$inksh/$needksh-$avoidksh-" in
120true/--)
121 cat <<EOM
122(I see you are using the Korn shell. Some ksh's blow up on $me,
123mainly on older exotic systems. If yours does, try the Bourne shell instead.)
124EOM
125 ;;
126esac
127case "$changesh" in
128true)
129 echo "(Feeding myself to $newsh $reason.)"
130 case "$0" in
131 Configure|*/Configure) exec $newsh $0 "$@";;
132 *) exec $newsh Configure "$@";;
133 esac
134 ;;
135esac
136
137: Configure runs within the UU subdirectory
138test -d UU || mkdir UU
139unset CDPATH
140cd UU && rm -f ./*
141
142d_bsd=''
143d_eunice=''
144d_xenix=''
145eunicefix=''
146Mcc=''
147ar=''
148awk=''
149bash=''
150bison=''
151byacc=''
152cat=''
153chgrp=''
154chmod=''
155chown=''
156comm=''
157compress=''
158cp=''
159cpio=''
160cpp=''
161csh=''
162date=''
163echo=''
164egrep=''
165emacs=''
166expr=''
167find=''
168flex=''
169gcc=''
170grep=''
171gzip=''
172inews=''
173ksh=''
174less=''
175line=''
176lint=''
177ln=''
178lp=''
179lpr=''
180ls=''
181mail=''
182mailx=''
183make=''
184mkdir=''
185more=''
186mv=''
187nroff=''
188perl=''
189pg=''
190pmake=''
191pr=''
192rm=''
193rmail=''
194sed=''
195sendmail=''
196shar=''
197sleep=''
198smail=''
199sort=''
200submit=''
201tail=''
202tar=''
203tbl=''
204test=''
205touch=''
206tr=''
207troff=''
208uname=''
209uniq=''
210uuname=''
211vi=''
212zcat=''
213zip=''
214mailpatches=''
215notifypatches=''
216usermail=''
217hint=''
218myuname=''
219osname=''
220osvers=''
221Author=''
222Date=''
223Header=''
224Id=''
225Locker=''
226Log=''
227RCSfile=''
228Revision=''
229Source=''
230State=''
231archobjs=''
232firstmakefile=''
233afs=''
234baserev=''
235cf_email=''
236cf_by=''
237cf_time=''
238contains=''
239cpplast=''
240cppminus=''
241cpprun=''
242cppstdin=''
243d_portable=''
244defeditor=''
245install=''
246installdir=''
247lns=''
248mailer=''
249make_set_make=''
250installmansrc=''
251manext=''
252mansrc=''
253mansrcexp=''
254mkdep=''
255mydomain=''
256myhostname=''
257phostname=''
258c=''
259n=''
260d_berknames=''
261d_passnames=''
262d_usgnames=''
263nametype=''
264groupcat=''
265hostcat=''
266passcat=''
267orgname=''
268package=''
269spackage=''
270pager=''
271patchlevel=''
272perlpath=''
273prefix=''
274prefixexp=''
275installprivlib=''
276privlib=''
277privlibexp=''
278installscript=''
279scriptdir=''
280scriptdirexp=''
281sh=''
282sharpbang=''
283shsharp=''
284spitshell=''
285src=''
286startperl=''
287startsh=''
288sysman=''
289CONFIG=''
290
291define='define'
292undef='undef'
293smallmach='pdp11 i8086 z8000 i80286 iAPX286'
294rmlist=''
295
296: We must find out about Eunice early
297eunicefix=':'
298if test -f /etc/unixtovms; then
299 eunicefix=/etc/unixtovms
300fi
301if test -f /etc/unixtovms.exe; then
302 eunicefix=/etc/unixtovms.exe
303fi
304
305: No trailing extension on UNIX executables
306_exe=''
307: Extra object files, if any, needed on this platform.
308archobjs=''
309bin='/usr/local/bin'
310cc='cc'
311cppflags=''
312usrinc='/usr/include'
313
314: Find the basic shell for Bourne shell scripts
315case "$sh" in
316'')
317 case "$SYSTYPE" in
318 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
319 *) xxx='/bin/sh';;
320 esac
321 if test -f "$xxx"; then
322 sh="$xxx"
323 else
324 : Build up a list and do a single loop so we can 'break' out.
325 pth=`echo $PATH | sed -e "s/$p_/ /g"`
326 for xxx in sh bash ksh pdksh ash; do
327 for p in $pth; do
328 try="$try ${p}/${xxx}"
329 done
330 done
331 for xxx in $try; do
332 if test -f "$xxx"; then
333 sh="$xxx";
334 break
335 elif test -f "$xxx.exe"; then
336 sh="$xxx";
337 break
338 fi
339 done
340 fi
341 ;;
342esac
343
344case "$sh" in
345'') cat <<EOM >&2
346$me: Fatal Error: I can't find a Bourne Shell anywhere.
347
348Usually it's in /bin/sh. How did you even get this far?
349Please contact me (Raphael Manfredi) at Raphael_Manfredi@grenoble.hp.com and
350we'll try to straighten this all out.
351EOM
352 exit 1
353 ;;
354esac
355
356: see if sh knows # comments
357if `$sh -c '#' >/dev/null 2>&1`; then
358 shsharp=true
359 spitshell=cat
360 xcat=/bin/cat
361 test -f $xcat || xcat=/usr/bin/cat
362 echo "#!$xcat" >try
363 $eunicefix try
364 chmod +x try
365 ./try > today
366 if test -s today; then
367 sharpbang='#!'
368 else
369 echo "#! $xcat" > try
370 $eunicefix try
371 chmod +x try
372 ./try > today
373 if test -s today; then
374 sharpbang='#! '
375 else
376 sharpbang=': use '
377 fi
378 fi
379else
380 echo " "
381 echo "Your $sh doesn't grok # comments--I will strip them later on."
382 shsharp=false
383 cd ..
384 echo "exec grep -v '^[ ]*#'" >spitshell
385 chmod +x spitshell
386 $eunicefix spitshell
387 spitshell=`pwd`/spitshell
388 cd UU
389 echo "I presume that if # doesn't work, #! won't work either!"
390 sharpbang=': use '
391fi
392rm -f try today
393
394: figure out how to guarantee sh startup
395case "$startsh" in
396'') startsh=${sharpbang}${sh} ;;
397*)
398esac
399cat >try <<EOSS
400$startsh
401set abc
402test "$?abc" != 1
403EOSS
404
405chmod +x try
406$eunicefix try
407if ./try; then
408 : echo "Yup, it does."
409else
410 echo "Hmm... '$startsh' does not guarantee sh startup..."
411 echo "You may have to fix up the shell scripts to make sure $sh runs them."
412fi
413rm -f try
414
415: produce awk script to parse command line options
416cat >options.awk <<'EOF'
417BEGIN {
418 optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification
419
420 len = length(optstr);
421 for (i = 1; i <= len; i++) {
422 c = substr(optstr, i, 1);
423 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
424 if (a == ":") {
425 arg[c] = 1;
426 i++;
427 }
428 opt[c] = 1;
429 }
430}
431{
432 expect = 0;
433 str = $0;
434 if (substr(str, 1, 1) != "-") {
435 printf("'%s'\n", str);
436 next;
437 }
438 len = length($0);
439 for (i = 2; i <= len; i++) {
440 c = substr(str, i, 1);
441 if (!opt[c]) {
442 printf("-%s\n", substr(str, i));
443 next;
444 }
445 printf("-%s\n", c);
446 if (arg[c]) {
447 if (i < len)
448 printf("'%s'\n", substr(str, i + 1));
449 else
450 expect = 1;
451 next;
452 }
453 }
454}
455END {
456 if (expect)
457 print "?";
458}
459EOF
460
461: process the command line options
462set X `for arg in "$@"; do echo "X$arg"; done |
463 sed -e s/X// | awk -f options.awk`
464eval "set $*"
465shift
466rm -f options.awk
467
468: set up default values
469fastread=''
470reuseval=false
471config_sh=''
472alldone=''
473error=''
474silent=''
475extractsh=''
476override=''
477knowitall=''
478rm -f optdef.sh
479cat >optdef.sh <<EOS
480$startsh
481EOS
482
483
484: option parsing
485while test $# -gt 0; do
486 case "$1" in
487 -d) shift; fastread=yes;;
488 -e) shift; alldone=cont;;
489 -f)
490 shift
491 cd ..
492 if test -r "$1"; then
493 config_sh="$1"
494 else
495 echo "$me: cannot read config file $1." >&2
496 error=true
497 fi
498 cd UU
499 shift;;
500 -h) shift; error=true;;
501 -r) shift; reuseval=true;;
502 -s) shift; silent=true; realsilent=true;;
503 -E) shift; alldone=exit;;
504 -K) shift; knowitall=true;;
505 -O) shift; override=true;;
506 -S) shift; silent=true; extractsh=true;;
507 -D)
508 shift
509 case "$1" in
510 *=)
511 echo "$me: use '-U symbol=', not '-D symbol='." >&2
512 echo "$me: ignoring -D $1" >&2
513 ;;
514 *=*) echo "$1" | \
515 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
516 *) echo "$1='define'" >> optdef.sh;;
517 esac
518 shift
519 ;;
520 -U)
521 shift
522 case "$1" in
523 *=) echo "$1" >> optdef.sh;;
524 *=*)
525 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
526 echo "$me: ignoring -U $1" >&2
527 ;;
528 *) echo "$1='undef'" >> optdef.sh;;
529 esac
530 shift
531 ;;
532 -V) echo "$me generated by metaconfig 3.0 PL60." >&2
533 exit 0;;
534 --) break;;
535 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
536 *) break;;
537 esac
538done
539
540case "$error" in
541true)
542 cat >&2 <<EOM
543Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
544 [-U symbol] [-U symbol=]
545 -d : use defaults for all answers.
546 -e : go on without questioning past the production of config.sh.
547 -f : specify an alternate default configuration file.
548 -h : print this help message and exit (with an error status).
549 -r : reuse C symbols value if possible (skips costly nm extraction).
550 -s : silent mode, only echoes questions and essential information.
551 -D : define symbol to have some value:
552 -D symbol symbol gets the value 'define'
553 -D symbol=value symbol gets the value 'value'
554 -E : stop at the end of questions, after having produced config.sh.
555 -K : do not use unless you know what you are doing.
556 -O : let -D and -U override definitions from loaded configuration file.
557 -S : perform variable substitutions on all .SH files (can mix with -f)
558 -U : undefine symbol:
559 -U symbol symbol gets the value 'undef'
560 -U symbol= symbol gets completely empty
561 -V : print version number and exit (with a zero status).
562EOM
563 exit 1
564 ;;
565esac
566
567: Sanity checks
568case "$fastread$alldone" in
569yescont|yesexit) ;;
570*)
571 if test ! -t 0; then
572 echo "Say 'sh Configure', not 'sh <Configure'"
573 exit 1
574 fi
575 ;;
576esac
577
578exec 4>&1
579case "$silent" in
580true) exec 1>/dev/null;;
581esac
582
583: run the defines and the undefines, if any, but leave the file out there...
584touch optdef.sh
585. ./optdef.sh
586
587: set package name
588package=dist
589first=`echo $package | sed -e 's/^\(.\).*/\1/'`
590last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
591case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
592ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
593*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
594esac
595
596: Some greps do not return status, grrr.
597echo "grimblepritz" >grimble
598if grep blurfldyick grimble >/dev/null 2>&1 ; then
599 contains=contains
600elif grep grimblepritz grimble >/dev/null 2>&1 ; then
601 contains=grep
602else
603 contains=contains
604fi
605rm -f grimble
606: the following should work in any shell
607case "$contains" in
608contains*)
609 echo " "
610 echo "AGH! Grep doesn't return a status. Attempting remedial action."
611 cat >contains <<'EOSS'
612grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
613EOSS
614chmod +x contains
615esac
616
617: first determine how to suppress newline on echo command
618echo " "
619echo "Checking echo to see how to suppress newlines..."
620(echo "hi there\c" ; echo " ") >.echotmp
621if $contains c .echotmp >/dev/null 2>&1 ; then
622 echo "...using -n."
623 n='-n'
624 c=''
625else
626 cat <<'EOM'
627...using \c
628EOM
629 n=''
630 c='\c'
631fi
632echo $n "The star should be here-->$c"
633echo '*'
634rm -f .echotmp
635
636: compute the number of columns on the terminal for proper question formatting
637case "$COLUMNS" in
638'') COLUMNS='80';;
639esac
640
641: set up the echo used in my read
642myecho="case \"\$xxxm\" in
643'') echo $n \"\$rp $c\" >&4;;
644*) case \"\$rp\" in
645 '') echo $n \"[\$xxxm] $c\";;
646 *)
647 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
648 echo \"\$rp\" >&4
649 echo $n \"[\$xxxm] $c\" >&4
650 else
651 echo $n \"\$rp [\$xxxm] $c\" >&4
652 fi
653 ;;
654 esac;;
655esac"
656
657: now set up to do reads with possible shell escape and default assignment
658cat <<EOSC >myread
659$startsh
660xxxm=\$dflt
661$myecho
662ans='!'
663case "\$fastread" in
664yes) case "\$dflt" in
665 '') ;;
666 *) ans='';
667 case "\$silent-\$rp" in
668 true-) ;;
669 *) echo " " >&4;;
670 esac;;
671 esac;;
672*) case "\$silent" in
673 true) case "\$rp" in
674 '') ans='';;
675 esac;;
676 esac;;
677esac
678while expr "X\$ans" : "X!" >/dev/null; do
679 read answ
680 set x \$xxxm
681 shift
682 aok=''; eval "ans=\\"\$answ\\"" && aok=y
683 case "\$answ" in
684 "!")
685 sh 1>&4
686 echo " "
687 $myecho
688 ;;
689 !*)
690 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
691 shift
692 sh 1>&4 -c "\$*"
693 echo " "
694 $myecho
695 ;;
696 "\$ans")
697 case "\$ans" in
698 \\&*)
699 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
700 shift
701 case "\$1" in
702 -d)
703 fastread=yes
704 echo "(OK, I'll run with -d after this question.)" >&4
705 ;;
706 -*)
707 echo "*** Sorry, \$1 not supported yet." >&4
708 ;;
709 esac
710 $myecho
711 ans=!
712 ;;
713 esac;;
714 *)
715 case "\$aok" in
716 y)
717 echo "*** Substitution done -- please confirm."
718 xxxm="\$ans"
719 ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
720 xxxm="\$ans"
721 ans=!
722 ;;
723 *)
724 echo "*** Error -- try again."
725 ans=!
726 ;;
727 esac
728 $myecho
729 ;;
730 esac
731 case "\$ans\$xxxm\$nostick" in
732 '')
733 ans=!
734 $myecho
735 ;;
736 esac
737done
738case "\$ans" in
739'') ans="\$xxxm";;
740esac
741EOSC
742
743: Find the path to the source tree
744case "$src" in
745'') src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
746esac
747case "$src" in
748'')
749 src=.
750 rsrc=..
751 ;;
752/*) rsrc="$src/..";;
753*) rsrc="../$src";;
754esac
755if test -f $rsrc/Configure && \
756 $contains "^package=$package" $rsrc/Configure >/dev/null 2>&1
757then
758 : found it, so we are ok.
759else
760 rsrc=''
761 for src in . .. ../.. ../../.. ../../../..; do
762 if test -f ../$src/Configure && \
763 $contains "^package=$package" ../$src/Configure >/dev/null 2>&1
764 then
765 rsrc=../$src
766 break
767 fi
768 done
769fi
770case "$rsrc" in
771'')
772 echo " "
773 dflt=
774 rp="Directory where sources for $package are located?"
775 . ./myread
776 src="$ans"
777 rsrc="$src"
778 if test -f $rsrc/Configure && \
779 $contains "^package=$package" $rsrc/Configure >/dev/null 2>&1
780 then
781 echo "Ok, I've found them under $src"
782 else
783 echo "Sorry, I can't seem to be able to locate $package sources." >&4
784 exit 1
785 fi
786 ;;
787../.) ;;
788*)
789 echo " "
790 echo "Sources for $package found in $src" >&4
791 ;;
792esac
793
794: script used to extract .SH files with variable substitutions
795cat >extract <<'EOS'
796CONFIG=true
797echo "Doing variable substitutions on .SH files..."
798if test -f $src/MANIFEST; then
799 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'`
800else
801 echo "(Looking for .SH files under the source directory.)"
802 set x `(cd $src; find . -name "*.SH" -print)`
803fi
804shift
805case $# in
8060) set x `(cd $src; echo *.SH)`; shift;;
807esac
808if test ! -f $src/$1; then
809 shift
810fi
811mkdir_p='
812name=$1;
813create="";
814while test $name; do
815 if test ! -d "$name"; then
816 create="$name $create";
817 name=`echo $name | sed -e "s|^[^/]*$||"`;
818 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
819 else
820 name="";
821 fi;
822done;
823for file in $create; do
824 mkdir $file;
825done
826'
827for file in $*; do
828 case "$src" in
829 ".")
830 case "$file" in
831 */*)
832 dir=`expr X$file : 'X\(.*\)/'`
833 file=`expr X$file : 'X.*/\(.*\)'`
834 (cd $dir && . ./$file)
835 ;;
836 *)
837 . ./$file
838 ;;
839 esac
840 ;;
841 *)
842 case "$file" in
843 */*)
844 dir=`expr X$file : 'X\(.*\)/'`
845 file=`expr X$file : 'X.*/\(.*\)'`
846 (set x $dir; shift; eval $mkdir_p)
847 sh <$src/$dir/$file
848 ;;
849 *)
850 sh <$src/$file
851 ;;
852 esac
853 ;;
854 esac
855done
856if test -f $src/config_h.SH; then
857 if test ! -f config.h; then
858 : oops, they left it out of MANIFEST, probably, so do it anyway.
859 . $src/config_h.SH
860 fi
861fi
862EOS
863
864: extract files and exit if asked to do so
865case "$extractsh" in
866true)
867 case "$realsilent" in
868 true) ;;
869 *) exec 1>&4;;
870 esac
871 case "$config_sh" in
872 '') config_sh='config.sh'; config="$rsrc/config.sh";;
873 /*) config="$config_sh";;
874 *) config="$rsrc/$config_sh";;
875 esac
876 echo " "
877 echo "Fetching answers from $config_sh..."
878 . $config
879 test "$override" && . ./optdef.sh
880 echo " "
881 cd ..
882 . UU/extract
883 rm -rf UU
884 echo "Done."
885 exit 0
886 ;;
887esac
888
889: Eunice requires " " instead of "", can you believe it
890echo " "
891: Here we go...
892echo "Beginning of configuration questions for $package."
893
894trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
895
896: Now test for existence of everything in MANIFEST
897echo " "
898if test -f $rsrc/MANIFEST; then
899 echo "First let's make sure your kit is complete. Checking..." >&4
900 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
901 rm -f missing
902 tmppwd=`pwd`
903 for filelist in x??; do
904 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
905 done
906 if test -s missing; then
907 cat missing >&4
908 cat >&4 <<'EOM'
909
910THIS PACKAGE SEEMS TO BE INCOMPLETE.
911
912You have the option of continuing the configuration process, despite the
913distinct possibility that your kit is damaged, by typing 'y'es. If you
914do, don't blame me if something goes wrong. I advise you to type 'n'o
915and contact the author (Raphael_Manfredi@grenoble.hp.com).
916
917EOM
918 echo $n "Continue? [n] $c" >&4
919 read ans
920 case "$ans" in
921 y*)
922 echo "Continuing..." >&4
923 rm -f missing
924 ;;
925 *)
926 echo "ABORTING..." >&4
927 kill $$
928 ;;
929 esac
930 else
931 echo "Looks good..."
932 fi
933else
934 echo "There is no MANIFEST file. I hope your kit is complete !"
935fi
936rm -f missing x??
937
938: create .config dir to save info across Configure sessions
939test -d ../.config || mkdir ../.config
940cat >../.config/README <<EOF
941This directory created by Configure to save information that should
942persist across sessions for $package.
943
944You may safely delete it if you wish.
945EOF
946
947: general instructions
948needman=true
949firsttime=true
950user=`(logname) 2>/dev/null`
951case "$user" in
952'') user=`whoami 2>&1`;;
953esac
954if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
955 firsttime=false
956 echo " "
957 rp='Would you like to see the instructions?'
958 dflt=n
959 . ./myread
960 case "$ans" in
961 [yY]*) ;;
962 *) needman=false;;
963 esac
964fi
965if $needman; then
966 cat <<EOH
967
968This installation shell script will examine your system and ask you questions
969to determine how the dist package should be installed. If you get
970stuck on a question, you may use a ! shell escape to start a subshell or
971execute a command. Many of the questions will have default answers in square
972brackets; typing carriage return will give you the default.
973
974On some of the questions which ask for file or directory names you are allowed
975to use the ~name construct to specify the login directory belonging to "name",
976even if you don't have a shell which knows about that. Questions where this is
977allowed will be marked "(~name ok)".
978
979EOH
980 rp=''
981 dflt='Type carriage return to continue'
982 . ./myread
983 cat <<'EOH'
984
985The prompter used in this script allows you to use shell variables and
986backticks in your answers. You may use $1, $2, etc... to refer to the words
987in the default answer, as if the default line was a set of arguments given to a
988script shell. This means you may also use $* to repeat the whole default line,
989so you do not have to re-type everything to add something to the default.
990
991Everytime there is a substitution, you will have to confirm. If there is an
992error (e.g. an unmatched backtick), the default answer will remain unchanged
993and you will be prompted again.
994
995If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
996the questions and use the computed defaults (or the previous answers if there
997was already a config.sh file). Type 'Configure -h' for a list of options.
998You may also start interactively and then answer '& -d' at any prompt to turn
999on the non-interactive behaviour for the remaining of the execution.
1000
1001EOH
1002 . ./myread
1003 cat <<EOH
1004
1005Much effort has been expended to ensure that this shell script will run on any
1006Unix system. If despite that it blows up on yours, your best bet is to edit
1007Configure and run it again. If you can't run Configure for some reason,
1008you'll have to generate a config.sh file by hand. Whatever problems you
1009have, let me (Raphael_Manfredi@grenoble.hp.com) know how I blew it.
1010
1011This installation script affects things in two ways:
1012
10131) it may do direct variable substitutions on some of the files included
1014 in this kit.
10152) it builds a config.h file for inclusion in C programs. You may edit
1016 any of these files as the need arises after running this script.
1017
1018If you make a mistake on a question, there is no easy way to back up to it
1019currently. The easiest thing to do is to edit config.sh and rerun all the SH
1020files. Configure will offer to let you do this before it runs the SH files.
1021
1022EOH
1023 dflt='Type carriage return to continue'
1024 . ./myread
1025 case "$firsttime" in
1026 true) echo $user >>../.config/instruct;;
1027 esac
1028fi
1029
1030: find out where common programs are
1031echo " "
1032echo "Locating common programs..." >&4
1033cat <<EOSC >loc
1034$startsh
1035case \$# in
10360) exit 1;;
1037esac
1038thing=\$1
1039shift
1040dflt=\$1
1041shift
1042for dir in \$*; do
1043 case "\$thing" in
1044 .)
1045 if test -d \$dir/\$thing; then
1046 echo \$dir
1047 exit 0
1048 fi
1049 ;;
1050 *)
1051 for thisthing in \$dir/\$thing; do
1052 : just loop through to pick last item
1053 done
1054 if test -f \$thisthing; then
1055 echo \$thisthing
1056 exit 0
1057 elif test -f \$dir/\$thing.exe; then
1058 : on Eunice apparently
1059 echo \$dir/\$thing
1060 exit 0
1061 fi
1062 ;;
1063 esac
1064done
1065echo \$dflt
1066exit 1
1067EOSC
1068chmod +x loc
1069$eunicefix loc
1070loclist="
1071awk
1072cat
1073chgrp
1074chmod
1075chown
1076echo
1077expr
1078grep
1079make
1080mkdir
1081mv
1082rm
1083sed
1084sort
1085touch
1086tr
1087uniq
1088"
1089trylist="
1090cpp
1091date
1092inews
1093less
1094line
1095ln
1096mail
1097more
1098nroff
1099perl
1100pg
1101rmail
1102sendmail
1103smail
1104test
1105uname
1106vi
1107zcat
1108"
1109pth=`echo $PATH | sed -e "s/$p_/ /g"`
1110pth="$pth /lib /usr/lib"
1111for file in $loclist; do
1112 eval xxx=\$$file
1113 case "$xxx" in
1114 /*|?:[\\/]*)
1115 if test -f "$xxx"; then
1116 : ok
1117 else
1118 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1119 xxx=`./loc $file $file $pth`
1120 fi
1121 ;;
1122 '') xxx=`./loc $file $file $pth`;;
1123 *) xxx=`./loc $xxx $xxx $pth`;;
1124 esac
1125 eval $file=$xxx
1126 eval _$file=$xxx
1127 case "$xxx" in
1128 /*)
1129 echo $file is in $xxx.
1130 ;;
1131 ?:[\\/]*)
1132 echo $file is in $xxx.
1133 ;;
1134 *)
1135 echo "I don't know where '$file' is, and my life depends on it." >&4
1136 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1137 exit 1
1138 ;;
1139 esac
1140done
1141echo " "
1142echo "Don't worry if any of the following aren't found..."
1143say=offhand
1144for file in $trylist; do
1145 eval xxx=\$$file
1146 case "$xxx" in
1147 /*|?:[\\/]*)
1148 if test -f "$xxx"; then
1149 : ok
1150 else
1151 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1152 xxx=`./loc $file $file $pth`
1153 fi
1154 ;;
1155 '') xxx=`./loc $file $file $pth`;;
1156 *) xxx=`./loc $xxx $xxx $pth`;;
1157 esac
1158 eval $file=$xxx
1159 eval _$file=$xxx
1160 case "$xxx" in
1161 /*)
1162 echo $file is in $xxx.
1163 ;;
1164 ?:[\\/]*)
1165 echo $file is in $xxx.
1166 ;;
1167 *)
1168 echo "I don't see $file out there, $say."
1169 say=either
1170 ;;
1171 esac
1172done
1173case "$egrep" in
1174egrep)
1175 echo "Substituting grep for egrep."
1176 egrep=$grep
1177 ;;
1178esac
1179case "$ln" in
1180ln)
1181 echo "Substituting cp for ln."
1182 ln=$cp
1183 ;;
1184esac
1185case "$test" in
1186test)
1187 echo "Hopefully test is built into your sh."
1188 ;;
1189*)
1190 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1191 echo "Using the test built into your sh."
1192 test=test
1193 _test=test
1194 fi
1195 ;;
1196esac
1197case "$echo" in
1198echo)
1199 echo "Hopefully echo is built into your sh."
1200 ;;
1201'') ;;
1202*)
1203 echo " "
1204echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1205 $echo $n "hi there$c" >foo1
1206 echo $n "hi there$c" >foo2
1207 if cmp foo1 foo2 >/dev/null 2>&1; then
1208 echo "They are compatible. In fact, they may be identical."
1209 else
1210 case "$n" in
1211 '-n') n='' c='\c';;
1212 *) n='-n' c='';;
1213 esac
1214 cat <<FOO
1215They are not compatible! You are probably running ksh on a non-USG system.
1216I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1217have echo built in and we may have to run some Bourne shell scripts. That
1218means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1219
1220FOO
1221 $echo $n "The star should be here-->$c"
1222 $echo "*"
1223 fi
1224 $rm -f foo1 foo2
1225 ;;
1226esac
1227
1228: determine whether symbolic links are supported
1229echo " "
1230$touch blurfl
1231if $ln -s blurfl sym > /dev/null 2>&1 ; then
1232 echo "Symbolic links are supported." >&4
1233 lns="$ln -s"
1234else
1235 echo "Symbolic links are NOT supported." >&4
1236 lns="$ln"
1237fi
1238$rm -f blurfl sym
1239
1240: see whether [:lower:] and [:upper:] are supported character classes
1241echo " "
1242up='[A-Z]'
1243low='[a-z]'
1244case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1245ABYZ)
1246 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1247 up='[:upper:]'
1248 low='[:lower:]'
1249 ;;
1250*)
1251 echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
1252 ;;
1253esac
1254: set up the translation script tr, must be called with ./tr of course
1255cat >tr <<EOSC
1256$startsh
1257case "\$1\$2" in
1258'[A-Z][a-z]') exec $tr '$up' '$low';;
1259'[a-z][A-Z]') exec $tr '$low' '$up';;
1260esac
1261exec $tr "\$@"
1262EOSC
1263chmod +x tr
1264$eunicefix tr
1265
1266: Try to determine whether config.sh was made on this system
1267case "$config_sh" in
1268'')
1269myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1270myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1271 ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1272newmyuname="$myuname"
1273dflt=n
1274case "$knowitall" in
1275'')
1276 if test -f ../config.sh; then
1277 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1278 eval "`grep myuname= ../config.sh`"
1279 fi
1280 if test "X$myuname" = "X$newmyuname"; then
1281 dflt=y
1282 fi
1283 fi
1284 ;;
1285*) dflt=y;;
1286esac
1287
1288: Get old answers, if there is a config file out there
1289hint=default
1290hintfile=''
1291if test -f ../config.sh; then
1292 echo " "
1293 rp="I see a config.sh file. Shall I use it to set the defaults?"
1294 . ./myread
1295 case "$ans" in
1296 n*|N*) echo "OK, I'll ignore it.";;
1297 *) echo "Fetching default answers from your old config.sh file..." >&4
1298 tmp_n="$n"
1299 tmp_c="$c"
1300 . ../config.sh
1301 cp ../config.sh .
1302 n="$tmp_n"
1303 c="$tmp_c"
1304 hint=previous
1305 ;;
1306 esac
1307fi
1308;;
1309*)
1310 echo " "
1311 echo "Fetching default answers from $config_sh..." >&4
1312 tmp_n="$n"
1313 tmp_c="$c"
1314 cd ..
1315 cp $config_sh config.sh 2>/dev/null
1316 chmod +w config.sh
1317 . ./config.sh
1318 cd UU
1319 cp ../config.sh .
1320 n="$tmp_n"
1321 c="$tmp_c"
1322 hint=previous
1323 ;;
1324esac
1325test "$override" && . ./optdef.sh
1326myuname="$newmyuname"
1327
1328: Restore computed paths
1329for file in $loclist $trylist; do
1330 eval $file="\$_$file"
1331done
1332
1333: who configured the system
1334cf_time=`$date 2>&1`
1335cf_by=`(logname) 2>/dev/null`
1336case "$cf_by" in
1337"")
1338 cf_by=`(whoami) 2>/dev/null`
1339 case "$cf_by" in
1340 "") cf_by=unknown ;;
1341 esac ;;
1342esac
1343
1344: is AFS running?
1345echo " "
1346case "$afs" in
1347$define|true) afs=true ;;
1348$undef|false) afs=false ;;
1349*) if test -d /afs; then
1350 afs=true
1351 else
1352 afs=false
1353 fi
1354 ;;
1355esac
1356if $afs; then
1357 echo "AFS may be running... I'll be extra cautious then..." >&4
1358else
1359 echo "AFS does not seem to be running..." >&4
1360fi
1361
1362: determine where manual pages are on this system
1363echo " "
1364case "$sysman" in
1365'')
1366 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
1367 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
1368 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
1369 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
1370 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
1371 sysman=`./loc . /usr/man/man1 $syspath`
1372 ;;
1373esac
1374if $test -d "$sysman"; then
1375 echo "System manual is in $sysman." >&4
1376else
1377 echo "Could not find manual pages in source form." >&4
1378fi
1379
1380: decide how portable to be
1381case "$d_portable" in
1382"$define") dflt=y;;
1383*) dflt=n;;
1384esac
1385$cat <<'EOH'
1386
1387I can set things up so that your shell scripts and binaries are more portable,
1388at what may be a noticable cost in performance. In particular, if you
1389ask to be portable, the following happens:
1390
1391 1) Shell scripts will rely on the PATH variable rather than using
1392 the paths derived above.
1393 2) ~username interpretations will be done at run time rather than
1394 by Configure.
1395
1396EOH
1397rp="Do you expect to run these scripts and binaries on multiple machines?"
1398. ./myread
1399case "$ans" in
1400 y*) d_portable="$define"
1401 ;;
1402 *) d_portable="$undef" ;;
1403esac
1404
1405: set up shell script to do ~ expansion
1406cat >filexp <<EOSS
1407$startsh
1408: expand filename
1409case "\$1" in
1410 ~/*|~)
1411 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
1412 ;;
1413 ~*)
1414 if $test -f /bin/csh; then
1415 /bin/csh -f -c "glob \$1"
1416 failed=\$?
1417 echo ""
1418 exit \$failed
1419 else
1420 name=\`$expr x\$1 : '..\([^/]*\)'\`
1421 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
1422 if $test ! -d "\$dir"; then
1423 me=\`basename \$0\`
1424 echo "\$me: can't locate home directory for: \$name" >&2
1425 exit 1
1426 fi
1427 case "\$1" in
1428 */*)
1429 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
1430 ;;
1431 *)
1432 echo \$dir
1433 ;;
1434 esac
1435 fi
1436 ;;
1437*)
1438 echo \$1
1439 ;;
1440esac
1441EOSS
1442chmod +x filexp
1443$eunicefix filexp
1444
1445: now set up to get a file name
1446cat <<EOS >getfile
1447$startsh
1448EOS
1449cat <<'EOSC' >>getfile
1450tilde=''
1451fullpath=''
1452already=''
1453skip=''
1454none_ok=''
1455exp_file=''
1456nopath_ok=''
1457orig_rp="$rp"
1458orig_dflt="$dflt"
1459
1460case "$fn" in
1461*\(*)
1462 expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
1463 fn=`echo $fn | sed 's/(.*)//'`
1464 ;;
1465esac
1466
1467case "$fn" in
1468*:*)
1469 loc_file=`expr $fn : '.*:\(.*\)'`
1470 fn=`expr $fn : '\(.*\):.*'`
1471 ;;
1472esac
1473
1474case "$fn" in
1475*~*) tilde=true;;
1476esac
1477case "$fn" in
1478*/*) fullpath=true;;
1479esac
1480case "$fn" in
1481*+*) skip=true;;
1482esac
1483case "$fn" in
1484*n*) none_ok=true;;
1485esac
1486case "$fn" in
1487*e*) exp_file=true;;
1488esac
1489case "$fn" in
1490*p*) nopath_ok=true;;
1491esac
1492
1493case "$fn" in
1494*f*) type='File';;
1495*d*) type='Directory';;
1496*l*) type='Locate';;
1497esac
1498
1499what="$type"
1500case "$what" in
1501Locate) what='File';;
1502esac
1503
1504case "$exp_file" in
1505'')
1506 case "$d_portable" in
1507 "$define") ;;
1508 *) exp_file=true;;
1509 esac
1510 ;;
1511esac
1512
1513cd ..
1514while test "$type"; do
1515 redo=''
1516 rp="$orig_rp"
1517 dflt="$orig_dflt"
1518 case "$tilde" in
1519 true) rp="$rp (~name ok)";;
1520 esac
1521 . UU/myread
1522 if test -f UU/getfile.ok && \
1523 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
1524 then
1525 value="$ans"
1526 ansexp="$ans"
1527 break
1528 fi
1529 case "$ans" in
1530 none)
1531 value=''
1532 ansexp=''
1533 case "$none_ok" in
1534 true) type='';;
1535 esac
1536 ;;
1537 *)
1538 case "$tilde" in
1539 '') value="$ans"
1540 ansexp="$ans";;
1541 *)
1542 value=`UU/filexp $ans`
1543 case $? in
1544 0)
1545 if test "$ans" != "$value"; then
1546 echo "(That expands to $value on this system.)"
1547 fi
1548 ;;
1549 *) value="$ans";;
1550 esac
1551 ansexp="$value"
1552 case "$exp_file" in
1553 '') value="$ans";;
1554 esac
1555 ;;
1556 esac
1557 case "$fullpath" in
1558 true)
1559 case "$ansexp" in
1560 /*) value="$ansexp" ;;
1561 *)
1562 redo=true
1563 case "$already" in
1564 true)
1565 echo "I shall only accept a full path name, as in /bin/ls." >&4
1566 echo "Use a ! shell escape if you wish to check pathnames." >&4
1567 ;;
1568 *)
1569 echo "Please give a full path name, starting with slash." >&4
1570 case "$tilde" in
1571 true)
1572 echo "Note that using ~name is ok provided it expands well." >&4
1573 already=true
1574 ;;
1575 esac
1576 esac
1577 ;;
1578 esac
1579 ;;
1580 esac
1581 case "$redo" in
1582 '')
1583 case "$type" in
1584 File)
1585 if test -f "$ansexp"; then
1586 type=''
1587 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
1588 then
1589 echo "($value is not a plain file, but that's ok.)"
1590 type=''
1591 fi
1592 ;;
1593 Directory)
1594 if test -d "$ansexp"; then
1595 type=''
1596 fi
1597 ;;
1598 Locate)
1599 if test -d "$ansexp"; then
1600 echo "(Looking for $loc_file in directory $value.)"
1601 value="$value/$loc_file"
1602 ansexp="$ansexp/$loc_file"
1603 fi
1604 if test -f "$ansexp"; then
1605 type=''
1606 fi
1607 case "$nopath_ok" in
1608 true) case "$value" in
1609 */*) ;;
1610 *) echo "Assuming $value will be in people's path."
1611 type=''
1612 ;;
1613 esac
1614 ;;
1615 esac
1616 ;;
1617 esac
1618
1619 case "$skip" in
1620 true) type='';
1621 esac
1622
1623 case "$type" in
1624 '') ;;
1625 *)
1626 if test "$fastread" = yes; then
1627 dflt=y
1628 else
1629 dflt=n
1630 fi
1631 rp="$what $value doesn't exist. Use that name anyway?"
1632 . UU/myread
1633 dflt=''
1634 case "$ans" in
1635 y*) type='';;
1636 *) echo " ";;
1637 esac
1638 ;;
1639 esac
1640 ;;
1641 esac
1642 ;;
1643 esac
1644done
1645cd UU
1646ans="$value"
1647rp="$orig_rp"
1648dflt="$orig_dflt"
1649rm -f getfile.ok
1650EOSC
1651
1652: determine root of directory hierarchy where package will be installed.
1653case "$prefix" in
1654'')
1655 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
1656 ;;
1657*)
1658 dflt="$prefix"
1659 ;;
1660esac
1661$cat <<EOM
1662
1663By default, $package will be installed in $dflt/bin, manual
1664pages under $dflt/man, etc..., i.e. with $dflt as prefix for
1665all installation directories. Typically set to /usr/local, but you
1666may choose /usr if you wish to install $package among your system
1667binaries. If you wish to have binaries under /bin but manual pages
1668under /usr/local/man, that's ok: you will be prompted separately
1669for each of the installation directories, the prefix being only used
1670to set the defaults.
1671
1672EOM
1673fn=d~
1674rp='Installation prefix to use?'
1675. ./getfile
1676oldprefix=''
1677case "$prefix" in
1678'') ;;
1679*)
1680 case "$ans" in
1681 "$prefix") ;;
1682 *) oldprefix="$prefix";;
1683 esac
1684 ;;
1685esac
1686prefix="$ans"
1687prefixexp="$ansexp"
1688
1689: set the prefixit variable, to compute a suitable default value
1690prefixit='case "$3" in
1691""|none)
1692 case "$oldprefix" in
1693 "") eval "$1=\"\$$2\"";;
1694 *)
1695 case "$3" in
1696 "") eval "$1=";;
1697 none)
1698 eval "tp=\"\$$2\"";
1699 case "$tp" in
1700 ""|" ") eval "$1=\"\$$2\"";;
1701 *) eval "$1=";;
1702 esac;;
1703 esac;;
1704 esac;;
1705*)
1706 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
1707 case "$tp" in
1708 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
1709 /*-$oldprefix/*|\~*-$oldprefix/*)
1710 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
1711 *) eval "$1=\"\$$2\"";;
1712 esac;;
1713esac'
1714
1715: set the prefixup variable, to restore leading tilda escape
1716prefixup='case "$prefixexp" in
1717"$prefix") ;;
1718*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
1719esac'
1720
1721: determine where manual pages go
1722set mansrc mansrc none
1723eval $prefixit
1724$cat <<EOM
1725
1726$spackage has manual pages available in source form.
1727EOM
1728case "$nroff" in
1729nroff)
1730 echo "However, you don't have nroff, so they're probably useless to you."
1731 case "$mansrc" in
1732 '') mansrc="none";;
1733 esac;;
1734esac
1735echo "If you don't want the manual sources installed, answer 'none'."
1736case "$mansrc" in
1737'')
1738 lookpath="$prefixexp/man/man1 $prefixexp/man/u_man/man1"
1739 lookpath="$lookpath $prefixexp/man/l_man/man1"
1740 lookpath="$lookpath /usr/local/man/man1 /opt/man/man1 /usr/man/manl"
1741 lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1"
1742 lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
1743 lookpath="$lookpath /usr/man/man.L"
1744 mansrc=`./loc . $prefixexp/man/man1 $lookpath`
1745 if $test -d "$mansrc"; then
1746 dflt="$mansrc"
1747 else
1748 dflt="$sysman"
1749 fi
1750 set dflt
1751 eval $prefixup
1752 ;;
1753' ') dflt=none;;
1754*) dflt="$mansrc"
1755 ;;
1756esac
1757echo " "
1758fn=dn~
1759rp='Where do the manual pages (source) go?'
1760. ./getfile
1761if test "X$mansrcexp" != "X$ansexp"; then
1762 installmansrc=''
1763fi
1764mansrc="$ans"
1765mansrcexp="$ansexp"
1766case "$mansrc" in
1767'') mansrc=' '
1768 installmansrc='';;
1769esac
1770if $afs && $test "$mansrc"; then
1771 $cat <<EOM
1772
1773Since you are running AFS, I need to distinguish the directory in which
1774manual pages reside from the directory in which they are installed (and from
1775which they are presumably copied to the former directory by occult means).
1776
1777EOM
1778 case "$installmansrc" in
1779 '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;;
1780 *) dflt="$installmansrc";;
1781 esac
1782 fn=de~
1783 rp='Where will man pages be installed?'
1784 . ./getfile
1785 installmansrc="$ans"
1786else
1787 installmansrc="$mansrcexp"
1788fi
1789
1790case "$mansrc" in
1791' ') manext='0';;
1792*l) manext=l;;
1793*n) manext=n;;
1794*o) manext=l;;
1795*p) manext=n;;
1796*C) manext=C;;
1797*L) manext=L;;
1798*L1) manext=L1;;
1799*) manext=1;;
1800esac
1801
1802: determine where private executables go
1803set dflt privlib lib/$package
1804eval $prefixit
1805$cat <<EOM
1806
1807There are some auxiliary files for $package that need to be put into a
1808private library directory that is accessible by everyone.
1809
1810EOM
1811fn=d~+
1812rp='Pathname where the private library files will reside?'
1813. ./getfile
1814if $test "X$privlibexp" != "X$ansexp"; then
1815 installprivlib=''
1816fi
1817privlib="$ans"
1818privlibexp="$ansexp"
1819if $afs; then
1820 $cat <<EOM
1821
1822Since you are running AFS, I need to distinguish the directory in which
1823private files reside from the directory in which they are installed (and from
1824which they are presumably copied to the former directory by occult means).
1825
1826EOM
1827 case "$installprivlib" in
1828 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
1829 *) dflt="$installprivlib";;
1830 esac
1831 fn=de~
1832 rp='Where will private files be installed?'
1833 . ./getfile
1834 installprivlib="$ans"
1835else
1836 installprivlib="$privlibexp"
1837fi
1838
1839: determine where public executable scripts go
1840set scriptdir scriptdir
1841eval $prefixit
1842case "$scriptdir" in
1843'')
1844 dflt="$bin"
1845 : guess some guesses
1846 $test -d /usr/share/scripts && dflt=/usr/share/scripts
1847 $test -d /usr/share/bin && dflt=/usr/share/bin
1848 $test -d /usr/local/script && dflt=/usr/local/script
1849 $test -d $prefixexp/script && dflt=$prefixexp/script
1850 set dflt
1851 eval $prefixup
1852 ;;
1853*) dflt="$scriptdir"
1854 ;;
1855esac
1856$cat <<EOM
1857
1858Some installations have a separate directory just for executable scripts so
1859that they can mount it across multiple architectures but keep the scripts in
1860one spot. You might, for example, have a subdirectory of /usr/share for this.
1861Or you might just lump your scripts in with all your other executables.
1862
1863EOM
1864fn=d~
1865rp='Where do you keep publicly executable scripts?'
1866. ./getfile
1867if $test "X$ansexp" != "X$scriptdirexp"; then
1868 installscript=''
1869fi
1870scriptdir="$ans"
1871scriptdirexp="$ansexp"
1872if $afs; then
1873 $cat <<EOM
1874
1875Since you are running AFS, I need to distinguish the directory in which
1876scripts reside from the directory in which they are installed (and from
1877which they are presumably copied to the former directory by occult means).
1878
1879EOM
1880 case "$installscript" in
1881 '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
1882 *) dflt="$installscript";;
1883 esac
1884 fn=de~
1885 rp='Where will public scripts be installed?'
1886 . ./getfile
1887 installscript="$ans"
1888else
1889 installscript="$scriptdirexp"
1890fi
1891
1892: preserve RCS keywords in files with variable substitution, grrr
1893Header='$Header'
1894Id='$Id'
1895Locker='$Locker'
1896Log='$Log'
1897
1898: set the base revision
1899baserev=3.0
1900
1901: make some quick guesses about what we are up against
1902echo " "
1903$echo $n "Hmm... $c"
1904echo exit 1 >bsd
1905echo exit 1 >usg
1906echo exit 1 >v7
1907echo exit 1 >osf1
1908echo exit 1 >eunice
1909echo exit 1 >xenix
1910echo exit 1 >venix
1911echo exit 1 >os2
1912d_bsd="$undef"
1913$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
1914if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
1915then
1916 echo "Looks kind of like an OSF/1 system, but we'll see..."
1917 echo exit 0 >osf1
1918elif test `echo abc | tr a-z A-Z` = Abc ; then
1919 xxx=`./loc addbib blurfl $pth`
1920 if $test -f $xxx; then
1921 echo "Looks kind of like a USG system with BSD features, but we'll see..."
1922 echo exit 0 >bsd
1923 echo exit 0 >usg
1924 else
1925 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
1926 echo "Looks kind of like an extended USG system, but we'll see..."
1927 else
1928 echo "Looks kind of like a USG system, but we'll see..."
1929 fi
1930 echo exit 0 >usg
1931 fi
1932elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
1933 echo "Looks kind of like a BSD system, but we'll see..."
1934 d_bsd="$define"
1935 echo exit 0 >bsd
1936else
1937 echo "Looks kind of like a Version 7 system, but we'll see..."
1938 echo exit 0 >v7
1939fi
1940case "$eunicefix" in
1941*unixtovms*)
1942 $cat <<'EOI'
1943There is, however, a strange, musty smell in the air that reminds me of
1944something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
1945EOI
1946 echo exit 0 >eunice
1947 d_eunice="$define"
1948: it so happens the Eunice I know will not run shell scripts in Unix format
1949 ;;
1950*)
1951 echo " "
1952 echo "Congratulations. You aren't running Eunice."
1953 d_eunice="$undef"
1954 ;;
1955esac
1956case "$p_" in
1957:) ;;
1958*)
1959 $cat <<'EOI'
1960I have the feeling something is not exactly right, however...don't tell me...
1961lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
1962EOI
1963 echo exit 0 >os2
1964 ;;
1965esac
1966if test -f /xenix; then
1967 echo "Actually, this looks more like a XENIX system..."
1968 echo exit 0 >xenix
1969 d_xenix="$define"
1970else
1971 echo " "
1972 echo "It's not Xenix..."
1973 d_xenix="$undef"
1974fi
1975chmod +x xenix
1976$eunicefix xenix
1977if test -f /venix; then
1978 echo "Actually, this looks more like a VENIX system..."
1979 echo exit 0 >venix
1980else
1981 echo " "
1982 if ./xenix; then
1983 : null
1984 else
1985 echo "Nor is it Venix..."
1986 fi
1987fi
1988chmod +x bsd usg v7 osf1 eunice xenix venix os2
1989$eunicefix bsd usg v7 osf1 eunice xenix venix os2
1990$rm -f foo
1991
1992: see if we have to deal with yellow pages, now NIS.
1993if $test -d /usr/etc/yp || $test -d /etc/yp; then
1994 if $test -f /usr/etc/nibindd; then
1995 echo " "
1996 echo "I'm fairly confident you're on a NeXT."
1997 echo " "
1998 rp='Do you get the passwd file via NetInfo?'
1999 dflt=y
2000 case "$passcat" in
2001 nidump*) ;;
2002 '') ;;
2003 *) dflt=n;;
2004 esac
2005 . ./myread
2006 case "$ans" in
2007 y*) passcat='nidump passwd .'
2008 ;;
2009 *) echo "You told me, so don't blame me."
2010 case "$passcat" in
2011 nidump*) passcat=''
2012 esac
2013 ;;
2014 esac
2015 echo " "
2016 rp='Do you get the hosts file via NetInfo?'
2017 dflt=y
2018 case "$hostcat" in
2019 nidump*) ;;
2020 '') ;;
2021 *) dflt=n;;
2022 esac
2023 . ./myread
2024 case "$ans" in
2025 y*) hostcat='nidump hosts .';;
2026 *) case "$hostcat" in
2027 nidump*) hostcat='';;
2028 esac
2029 ;;
2030 esac
2031 fi
2032 case "$passcat" in
2033 nidump*) ;;
2034 *)
2035 case "$passcat" in
2036 *ypcat*) dflt=y;;
2037 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
2038 dflt=y
2039 else
2040 dflt=n
2041 fi;;
2042 *) dflt=n;;
2043 esac
2044 echo " "
2045 rp='Are you getting the passwd file via yellow pages?'
2046 . ./myread
2047 case "$ans" in
2048 y*) passcat='ypcat passwd'
2049 ;;
2050 *) passcat='cat /etc/passwd'
2051 ;;
2052 esac
2053 ;;
2054 esac
2055 case "$hostcat" in
2056 nidump*) ;;
2057 *)
2058 case "$hostcat" in
2059 *ypcat*) dflt=y;;
2060 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
2061 dflt=y
2062 else
2063 dflt=n
2064 fi;;
2065 *) dflt=n;;
2066 esac
2067 echo " "
2068 rp='Are you getting the hosts file via yellow pages?'
2069 . ./myread
2070 case "$ans" in
2071 y*) hostcat='ypcat hosts';;
2072 *) hostcat='cat /etc/hosts';;
2073 esac
2074 ;;
2075 esac
2076fi
2077case "$hostcat" in
2078'') hostcat='cat /etc/hosts';;
2079esac
2080case "$groupcat" in
2081'') groupcat='cat /etc/group';;
2082esac
2083case "$passcat" in
2084'') passcat='cat /etc/passwd';;
2085esac
2086
2087: now get the host name
2088echo " "
2089echo "Figuring out host name..." >&4
2090case "$myhostname" in
2091'') cont=true
2092 echo 'Maybe "hostname" will work...'
2093 if tans=`sh -c hostname 2>&1` ; then
2094 myhostname=$tans
2095 phostname=hostname
2096 cont=''
2097 fi
2098 ;;
2099*) cont='';;
2100esac
2101if $test "$cont"; then
2102 if ./xenix; then
2103 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
2104 if tans=`cat /etc/systemid 2>&1` ; then
2105 myhostname=$tans
2106 phostname='cat /etc/systemid'
2107 echo "Whadyaknow. Xenix always was a bit strange..."
2108 cont=''
2109 fi
2110 elif $test -r /etc/systemid; then
2111 echo "(What is a non-Xenix system doing with /etc/systemid?)"
2112 fi
2113fi
2114if $test "$cont"; then
2115 echo 'No, maybe "uuname -l" will work...'
2116 if tans=`sh -c 'uuname -l' 2>&1` ; then
2117 myhostname=$tans
2118 phostname='uuname -l'
2119 else
2120 echo 'Strange. Maybe "uname -n" will work...'
2121 if tans=`sh -c 'uname -n' 2>&1` ; then
2122 myhostname=$tans
2123 phostname='uname -n'
2124 else
2125 echo 'Oh well, maybe I can mine it out of whoami.h...'
2126 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
2127 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
2128 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
2129 else
2130 case "$myhostname" in
2131 '') echo "Does this machine have an identity crisis or something?"
2132 phostname='';;
2133 *)
2134 echo "Well, you said $myhostname before..."
2135 phostname='echo $myhostname';;
2136 esac
2137 fi
2138 fi
2139 fi
2140fi
2141: you do not want to know about this
2142set $myhostname
2143myhostname=$1
2144
2145: verify guess
2146if $test "$myhostname" ; then
2147 dflt=y
2148 rp='Your host name appears to be "'$myhostname'".'" Right?"
2149 . ./myread
2150 case "$ans" in
2151 y*) ;;
2152 *) myhostname='';;
2153 esac
2154fi
2155
2156: bad guess or no guess
2157while $test "X$myhostname" = X ; do
2158 dflt=''
2159 rp="Please type the (one word) name of your host:"
2160 . ./myread
2161 myhostname="$ans"
2162done
2163
2164: translate upper to lower if necessary
2165case "$myhostname" in
2166*[A-Z]*)
2167 echo "(Normalizing case in your host name)"
2168 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
2169 ;;
2170esac
2171
2172case "$myhostname" in
2173*.*)
2174 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
2175 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
2176 echo "(Trimming domain name from host name--host name is now $myhostname)"
2177 ;;
2178*) case "$mydomain" in
2179 '')
2180 {
2181 : If we use NIS, try ypmatch.
2182 : Is there some reason why this was not done before?
2183 test "X$hostcat" = "Xypcat hosts" &&
2184 ypmatch "$myhostname" hosts 2>/dev/null |\
2185 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
2186 $test -s hosts
2187 } || {
2188 : Extract only the relevant hosts, reducing file size,
2189 : remove comments, insert trailing space for later use.
2190 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
2191 /[ ]$myhostname[ . ]/p" > hosts
2192 }
2193 tmp_re="[ . ]"
2194 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
2195 END { print sum }" hosts` = x1 || tmp_re="[ ]"
2196 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
2197 hosts | $sort | $uniq | \
2198 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
2199 case `$echo X$dflt` in
2200 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
2201 dflt=.
2202 ;;
2203 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
2204 ;;
2205 esac
2206 case "$dflt" in
2207 .)
2208 tans=`./loc resolv.conf X /etc /usr/etc`
2209 if $test -f "$tans"; then
2210 echo "(Attempting domain name extraction from $tans)"
2211 dflt=.`$sed -n -e 's/ / /g' \
2212 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
2213 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
2214 case "$dflt" in
2215 .) dflt=.`$sed -n -e 's/ / /g' \
2216 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
2217 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
2218 ;;
2219 esac
2220 fi
2221 ;;
2222 esac
2223 case "$dflt" in
2224 .) echo "(No help from resolv.conf either -- attempting clever guess)"
2225 dflt=.`sh -c domainname 2>/dev/null`
2226 case "$dflt" in
2227 '') dflt='.';;
2228 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
2229 esac
2230 ;;
2231 esac
2232 case "$dflt" in
2233 .) echo "(Lost all hope -- silly guess then)"
2234 dflt='.uucp'
2235 ;;
2236 esac
2237 $rm -f hosts
2238 ;;
2239 *) dflt="$mydomain";;
2240 esac;;
2241esac
2242echo " "
2243rp="What is your domain name?"
2244. ./myread
2245tans="$ans"
2246case "$ans" in
2247'') ;;
2248.*) ;;
2249*) tans=".$tans";;
2250esac
2251mydomain="$tans"
2252
2253: translate upper to lower if necessary
2254case "$mydomain" in
2255*[A-Z]*)
2256 echo "(Normalizing case in your domain name)"
2257 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
2258 ;;
2259esac
2260
2261: a little sanity check here
2262case "$phostname" in
2263'') ;;
2264*)
2265 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
2266 $myhostname$mydomain|$myhostname) ;;
2267 *)
2268 case "$phostname" in
2269 sed*)
2270 echo "(That doesn't agree with your whoami.h file, by the way.)"
2271 ;;
2272 *)
2273 echo "(That doesn't agree with your $phostname command, by the way.)"
2274 ;;
2275 esac
2276 ;;
2277 esac
2278 ;;
2279esac
2280
2281$cat <<EOM
2282
2283I need to get your e-mail address in Internet format if possible, i.e.
2284something like user@host.domain. Please answer accurately since I have
2285no easy means to double check it. The default value provided below
2286is most probably close to the reality but may not be valid from outside
2287your organization...
2288
2289EOM
2290cont=x
2291while test "$cont"; do
2292 case "$cf_email" in
2293 '') dflt="$cf_by@$myhostname$mydomain";;
2294 *) dflt="$cf_email";;
2295 esac
2296 rp='What is your e-mail address?'
2297 . ./myread
2298 cf_email="$ans"
2299 case "$cf_email" in
2300 *@*.*) cont='' ;;
2301 *)
2302 rp='Address does not look like an Internet one. Use it anyway?'
2303 case "$fastread" in
2304 yes) dflt=y ;;
2305 *) dflt=n ;;
2306 esac
2307 . ./myread
2308 case "$ans" in
2309 y*) cont='' ;;
2310 *) echo " " ;;
2311 esac
2312 ;;
2313 esac
2314done
2315
2316: determine default editor
2317echo " "
2318case "$defeditor" in
2319'')
2320 case "$vi" in
2321 */*) dflt="$vi";;
2322 *) dflt=/usr/ucb/vi;;
2323 esac
2324 ;;
2325*) dflt="$defeditor"
2326 ;;
2327esac
2328fn=f/
2329rp="What is the default editor on your system?"
2330. ./getfile
2331defeditor="$ans"
2332
2333: locate a BSD compatible install program
2334echo " "
2335echo "Looking for a BSD-compatible install program..." >&4
2336creatdir=''
2337case "$install" in
2338'')
2339 tryit=''
2340 for dir in $pth; do
2341 for file in ginstall installbsd scoinst install; do
2342 if $test -f $dir/$file; then
2343 tryit="$tryit $dir/$file"
2344 fi
2345 done
2346 done
2347 $cat >try.c <<EOC
2348main()
2349{
2350 printf("OK\n");
2351 exit(0);
2352}
2353EOC
2354 if $cc try.c -o try >/dev/null 2>&1; then
2355 cp try try.ns
2356 strip try >/dev/null 2>&1
2357 else
2358 echo "(I can't seem to compile a trivial C program -- bypassing.)"
2359 echo "try" >try
2360 cp try try.ns
2361 fi
2362 $cat >tryinst <<EOS
2363$startsh
2364$rm -rf foo d
2365\$1 -d foo/bar
2366$mkdir d
2367\$1 -c -m 764 try.ns d
2368\$1 -c -s -m 642 try.ns d/try
2369EOS
2370 chmod +x tryinst
2371 $eunicefix tryinst
2372 dflt=''
2373 either=''
2374 for prog in $tryit; do
2375 $echo $n "Checking $prog... $c"
2376 ./tryinst $prog >/dev/null 2>&1
2377 if $test -d foo/bar; then
2378 creatdir="$prog -d"
2379 fi
2380 (ls -l d/try >try.ls; ls -l d/try.ns >tryno.ls) 2>/dev/null
2381 if (cmp -s d/try try && cmp -s d/try.ns try.ns && \
2382 $contains 'rwxrw-r--' tryno.ls && \
2383 $contains 'rw-r---w-' try.ls) >/dev/null 2>&1
2384 then
2385 dflt="$prog"
2386 echo "ok, that will do."
2387 break
2388 fi
2389 echo "not good$either."
2390 either=' either'
2391 $rm -f try*.ls
2392 done
2393 $rm -rf foo d tryinst try try*.ls try.*
2394 case "$dflt" in
2395 '')
2396 echo "Hopefully, $package comes with its own install script!"
2397 dflt='./install'
2398 ;;
2399 esac
2400 ;;
2401*) dflt="$install";;
2402esac
2403$cat <<EOM
2404
2405I will be requiring a BSD-compatible install program (one that allows
2406options like -s to strip executables or -m to specify a file mode) to
2407install $package.
2408
2409If the question below contains a fully qualified default path, then it
2410is probably ok. If it is an unqualified name such as 'install', then it
2411means I was unable to find out a good install program I could use. If
2412you know of one, please tell me about it. If the default is './install',
2413then I shall be using the install script supplied with $package.
2414
2415EOM
2416fn='/fe~(install,./install)'
2417rp='Which install program shall I use?'
2418. ./getfile
2419install="$ans"
2420
2421: how can we create nested directories?
2422echo " "
2423echo "Ok, let's see how we can create nested directories..." >&4
2424case "$installdir" in
2425'')
2426 case "$creatdir" in
2427 '')
2428 $mkdir -p foo/bar >/dev/null 2>&1
2429 if $test -d foo/bar; then
2430 echo "Great, we can build them using 'mkdir -p'."
2431 creatdir='mkdir -p'
2432 elif eval "$install -d foo/bar"; $test -d foo/bar; then
2433 creatdir="install -d"
2434 echo "It looks like '$creatdir' will do it for us."
2435 fi
2436 ;;
2437 *)
2438 eval "$creatdir foo/bar" >/dev/null 2>&1
2439 if $test -d foo/bar; then
2440 echo "Ah! We can use '$creatdir' to do just that."
2441 fi
2442 ;;
2443 esac
2444 $rm -rf foo
2445 case "$creatdir" in
2446 '')
2447 echo "Heck! Another ancient system lacking the comfort of modern ones!"
2448 echo "You can thank $package for bringing you its own install script!"
2449 installdir='./install -d'
2450 ;;
2451 *) installdir="$creatdir";;
2452 esac
2453 ;;
2454*) echo "As you already told me, '$installdir' should work.";;
2455esac
2456
2457: determine the name of a reasonable mailer
2458case "$mailer" in
2459'')
2460 if $test -f "$sendmail"; then
2461 dflt="$sendmail"
2462 elif $test -f "$smail"; then
2463 dflt="$smail"
2464 elif $test -f "$rmail"; then
2465 dflt="$rmail"
2466 elif $test -f /bin/mail; then
2467 dflt=/bin/mail
2468 else
2469 dflt=$mail
2470 fi
2471 ;;
2472*) dflt="$mailer";;
2473esac
2474$cat <<EOM
2475
2476I need the full pathname of the program used to deliver mail on your system.
2477A typical answer would be /usr/lib/sendmail or /bin/rmail, but you may choose
2478any other program, as long as it can be fed from standard input and will
2479honour any user-supplied headers.
2480
2481EOM
2482fn=f
2483rp='Mail transport agent to be used?'
2484. ./getfile
2485mailer="$ans"
2486
2487: see how we invoke the C preprocessor
2488echo " "
2489echo "Now, how can we feed standard input to your C preprocessor..." >&4
2490cat <<'EOT' >testcpp.c
2491#define ABC abc
2492#define XYZ xyz
2493ABC.XYZ
2494EOT
2495cd ..
2496echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
2497chmod 755 cppstdin
2498wrapper=`pwd`/cppstdin
2499ok='false'
2500cd UU
2501
2502if $test "X$cppstdin" != "X" && \
2503 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
2504 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2505then
2506 echo "You used to use $cppstdin $cppminus so we'll use that again."
2507 case "$cpprun" in
2508 '') echo "But let's see if we can live without a wrapper..." ;;
2509 *)
2510 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
2511 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2512 then
2513 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
2514 ok='true'
2515 else
2516 echo "(However, $cpprun $cpplast does not work, let's see...)"
2517 fi
2518 ;;
2519 esac
2520else
2521 case "$cppstdin" in
2522 '') ;;
2523 *)
2524 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
2525 ;;
2526 esac
2527fi
2528
2529if $ok; then
2530 : nothing
2531elif echo 'Maybe "'"$cc"' -E" will work...'; \
2532 $cc -E <testcpp.c >testcpp.out 2>&1; \
2533 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2534 echo "Yup, it does."
2535 x_cpp="$cc -E"
2536 x_minus='';
2537elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
2538 $cc -E - <testcpp.c >testcpp.out 2>&1; \
2539 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2540 echo "Yup, it does."
2541 x_cpp="$cc -E"
2542 x_minus='-';
2543elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
2544 $cc -P <testcpp.c >testcpp.out 2>&1; \
2545 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2546 echo "Yipee, that works!"
2547 x_cpp="$cc -P"
2548 x_minus='';
2549elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
2550 $cc -P - <testcpp.c >testcpp.out 2>&1; \
2551 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2552 echo "At long last!"
2553 x_cpp="$cc -P"
2554 x_minus='-';
2555elif echo 'No such luck, maybe "'$cpp'" will work...'; \
2556 $cpp <testcpp.c >testcpp.out 2>&1; \
2557 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2558 echo "It works!"
2559 x_cpp="$cpp"
2560 x_minus='';
2561elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
2562 $cpp - <testcpp.c >testcpp.out 2>&1; \
2563 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2564 echo "Hooray, it works! I was beginning to wonder."
2565 x_cpp="$cpp"
2566 x_minus='-';
2567elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
2568 $wrapper <testcpp.c >testcpp.out 2>&1; \
2569 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2570 x_cpp="$wrapper"
2571 x_minus=''
2572 echo "Eureka!"
2573else
2574 dflt=''
2575 rp="No dice. I can't find a C preprocessor. Name one:"
2576 . ./myread
2577 x_cpp="$ans"
2578 x_minus=''
2579 $x_cpp <testcpp.c >testcpp.out 2>&1
2580 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2581 echo "OK, that will do." >&4
2582 else
2583echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
2584 exit 1
2585 fi
2586fi
2587
2588case "$ok" in
2589false)
2590 cppstdin="$x_cpp"
2591 cppminus="$x_minus"
2592 cpprun="$x_cpp"
2593 cpplast="$x_minus"
2594 set X $x_cpp
2595 shift
2596 case "$1" in
2597 "$cpp")
2598 echo "Perhaps can we force $cc -E using a wrapper..."
2599 if $wrapper <testcpp.c >testcpp.out 2>&1; \
2600 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2601 then
2602 echo "Yup, we can."
2603 cppstdin="$wrapper"
2604 cppminus='';
2605 else
2606 echo "Nope, we'll have to live without it..."
2607 fi
2608 ;;
2609 esac
2610 case "$cpprun" in
2611 "$wrapper")
2612 cpprun=''
2613 cpplast=''
2614 ;;
2615 esac
2616 ;;
2617esac
2618
2619case "$cppstdin" in
2620"$wrapper") ;;
2621*) $rm -f $wrapper;;
2622esac
2623$rm -f testcpp.c testcpp.out
2624
2625: Define several unixisms.
2626: Hints files or command line option can be used to override them.
2627case "$_a" in
2628'') _a='.a';;
2629esac
2630case "$_o" in
2631'') _o='.o';;
2632esac
2633
2634: find out how to generate dependencies
2635echo " "
2636echo "Checking how to generate makefile dependencies on your machine..." >&4
2637toplev=`cd ..;pwd`
2638$cat >dep.c <<'EOCP'
2639#include "dep.h"
2640EOCP
2641$cat >dep.h <<'EOCP'
2642
2643EOCP
2644takeflags='flags=""
2645case "$@" in
2646*--*)
2647 for arg
2648 do
2649 shift
2650 case "$arg" in
2651 --) break;;
2652 *) flags="$flags $arg";;
2653 esac
2654 done;;
2655esac'
2656case "$mkdep" in
2657'')
2658 ;;
2659*)
2660 if test -x "$mkdep" &&
2661 $mkdep dep.c >dep.out 2>/dev/null &&
2662 $contains "dep\$_o:.*dep\.h" dep.out >/dev/null 2>&1
2663 then
2664 echo "$mkdep works."
2665 else
2666 mkdep=
2667 fi
2668esac
2669
2670case "$mkdep" in
2671'')
2672 $spitshell > ../mkdep <<EOM
2673$startsh
2674$takeflags
2675for srcfile
2676do
2677 $cpp -M -I. $cppflags \$flags \$srcfile 2>/dev/null
2678done
2679exit 0
2680EOM
2681 mkdep=$toplev/mkdep
2682 chmod +x $mkdep
2683 $eunicefix $mkdep
2684 if $mkdep dep.c >dep.out 2>/dev/null &&
2685 $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1
2686 then
2687 echo "Looks like we can use $cpp -M."
2688 else
2689 mkdep=
2690 fi
2691 ;;
2692esac
2693
2694case "$mkdep" in
2695'')
2696 $spitshell > ../mkdep <<EOM
2697$startsh
2698$takeflags
2699for srcfile
2700do
2701 $cc -MM -I. $cppflags \$flags \$srcfile 2>/dev/null
2702done
2703exit 0
2704EOM
2705 mkdep=$toplev/mkdep
2706 chmod +x $mkdep
2707 $eunicefix $mkdep
2708 if $mkdep dep.c >dep.out 2>/dev/null &&
2709 $contains "dep$_o: dep.h" dep.out >/dev/null 2>&1
2710 then
2711 echo "Looks like we can use $cc -MM."
2712 else
2713 mkdep=
2714 fi
2715 ;;
2716esac
2717
2718case "$mkdep" in
2719'')
2720 $spitshell >../mkdep <<EOS
2721$startsh
2722$takeflags
2723for srcfile
2724do
2725 case "\$srcfile" in
2726 *.c) c='.c';;
2727 *.y) c='.y';;
2728 *.l) c='.l';;
2729 esac
2730 filebase=\`basename \$srcfile \$c\`
2731 <\$srcfile $cpp $cppminus $cppflags -I. \$flags 2>/dev/null | \\
2732 $sed -e '/^# *[0-9]/!d' \\
2733 -e 's/^.*"\(.*\)".*\$/'\$filebase'$_o: \1/' \\
2734 -e 's|: \./|: |' \\
2735 -e 's|: *$|: '\$srcfile'|' | \\
2736 $grep -v '^#' | $sort | $uniq
2737done
2738exit 0
2739EOS
2740 mkdep=$toplev/mkdep
2741 chmod +x $mkdep
2742 $eunicefix $mkdep
2743 if $mkdep dep.c >dep.out 2>/dev/null &&
2744 $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1
2745 then
2746 echo "A shell script using $cpp does the trick."
2747 else
2748 echo "$cpp doesn't seem to be any use at all."
2749 $spitshell >../mkdep <<EOS
2750$startsh
2751$takeflags
2752files="\$@"
2753set X \$flags
2754shift
2755inc='.'
2756while test \$# -gt 0
2757do
2758 case "\$1" in
2759 -I)
2760 shift
2761 inc="\$inc:\$1"
2762 ;;
2763 -I*)
2764 dir=\`echo \$1 | sed -e 's/^-I//'\`
2765 inc="\$inc:\$dir"
2766 ;;
2767 esac
2768 shift
2769done
2770set X \$files
2771shift
2772trap "$rm -f /tmp/mkdep\$\$; exit 1" 1 2 3 15
2773for srcfile
2774do
2775 case "\$srcfile" in
2776 *.c) c='.c';;
2777 *.y) c='.y';;
2778 *.l) c='.l';;
2779 esac
2780 filebase=\`basename \$srcfile \$c\`
2781 echo \$filebase$_o: \$srcfile
2782 $grep '^#[ ]*include' \$srcfile /dev/null | \
2783 $sed -n -e 's/#[ ]*include[ ]*//' \\
2784 -e '/<\(.*\)>/ d' \\
2785 -e 's/:[^"]*"\([^"]*\)".*/: \1/' \\
2786 -e "s/\\.c:/$_o:/p" > /tmp/mkdep\$\$
2787 IFS=': '
2788 while read file dep; do
2789 for dir in \$inc; do
2790 if $test -f "\$dir/\$dep"; then
2791 dep="\$dir/\$dep"
2792 break
2793 fi
2794 done
2795 echo "\$file: \$dep" | $sed -e 's,: \./,: ,'
2796 done </tmp/mkdep\$\$
2797 IFS=' '
2798 $rm -f /tmp/mkdep\$\$
2799done
2800exit 0
2801EOS
2802 mkdep=$toplev/mkdep
2803 chmod +x $mkdep
2804 $eunicefix $mkdep
2805 if $mkdep dep.c >dep.out 2>/dev/null &&
2806 $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1
2807 then
2808 cat << EOM
2809
2810I can use a script with grep instead, but it will make some incorrect
2811dependencies, since it doesn't understand about conditional compilation.
2812Moreover, some dependencies may be missing, because scanning won't be
2813a recursive process.
2814If you have a program which generates makefile dependencies, you may want
2815to use it. If not, you can use the script and edit the Makefile by hand
2816if you need to.
2817EOM
2818 else
2819 mkdep=
2820 cat << EOM
2821
2822I can't seem to generate makefile dependencies at all! Perhaps you have a
2823program that does? If you don't, you might look at the mkdep script to
2824see if you can create one which works.
2825EOM
2826 fi
2827 fi
2828esac
2829dflt="$mkdep"
2830fn=f~/
2831rp="Name of program to make makefile dependencies?"
2832. ./getfile
2833mkdep="$ans"
2834$rm -f dep.c dep.h dep$_o dep.out
2835
2836: find out how to find out full name
2837case "$d_berknames" in
2838"$define")
2839 dflt=y;;
2840"$undef")
2841 dflt=n;;
2842*)
2843 if ./bsd; then
2844 dflt=y
2845 elif ./xenix; then
2846 dflt=y
2847 else
2848 dflt=n
2849 fi
2850 ;;
2851esac
2852$cat <<'EOM'
2853
2854Does your /etc/passwd file keep full names in Berkeley/V7 format (name first
2855thing after ':' in GCOS field)? In that case, a typical entry in the password
2856file looks like this:
2857
2858 guest:**paswword**:10:100:Mister Guest User:/usr/users:/bin/sh
2859 ^^^^^^^^^^^^^^^^^
2860EOM
2861rp="Berkeley/V7 format for full name in /etc/passwd?"
2862. ./myread
2863case "$ans" in
2864y*) d_passnames="$define"
2865 d_berknames="$define"
2866 d_usgnames="$undef"
2867 nametype=bsd
2868 ;;
2869*)
2870 case "$d_usgnames" in
2871 "$define") dflt=y;;
2872 "$undef") dflt=n;;
2873 *)
2874 if ./usg; then
2875 dflt=y
2876 else
2877 dflt=n
2878 fi
2879 ;;
2880 esac
2881$cat <<'EOM'
2882
2883Does your passwd file keep full names in USG format (name sandwiched between a
2884'-' and a '(')? In that case, a typical entry in the password file looks like
2885this:
2886
2887 guest:**paswword**:10:100:000-Mister Guest User(000):/usr/users:/bin/sh
2888 ^^^^^^^^^^^^^^^^^
2889EOM
2890 rp="USG format for full name in /etc/passwd?"
2891 . ./myread
2892 case "$ans" in
2893 n*) echo "Full name will be taken from ~/.fullname"
2894 d_passnames="$undef"
2895 d_berknames="$undef"
2896 d_usgnames="$undef"
2897 nametype=other
2898 ;;
2899 *)
2900 d_passnames="$define"
2901 d_berknames="$undef"
2902 d_usgnames="$define"
2903 nametype=usg
2904 ;;
2905 esac;;
2906esac
2907
2908: get organization name
2909longshots='/local/src /usr/src/new /usr/src/local /usr/local/src'
2910case "$orgname" in
2911'') if xxx=`./loc news/src/defs.h x $longshots`; then
2912 dflt=`$sed -n 's/^.*MYORG[ ]*"\(.*\)".*$/\1/p' $xxx`
2913 else
2914 dflt=''
2915 fi
2916 ;;
2917*) dflt="$orgname";;
2918esac
2919$cat << 'EOH'
2920
2921Please type the name of your organization as you want it to appear on the
2922Organization line of outgoing articles. (It's nice if this also specifies
2923your location. Your city name is probably sufficient if well known.)
2924For example:
2925
2926 University of Southern North Dakota, Hoople
2927
2928You may also put the name of a file, as long as it begins with a slash.
2929For example:
2930
2931 /etc/organization
2932
2933EOH
2934orgname=""
2935while test "X$orgname" = "X"; do
2936 rp='Organization:'
2937 . ./myread
2938 orgname="$ans"
2939done
2940
2941: locate the preferred pager for this system
2942case "$pager" in
2943'')
2944 dflt=''
2945 case "$pg" in
2946 /*) dflt=$pg;;
2947 esac
2948 case "$more" in
2949 /*) dflt=$more;;
2950 esac
2951 case "$less" in
2952 /*) dflt=$less;;
2953 esac
2954 case "$dflt" in
2955 '') dflt=/usr/ucb/more;;
2956 esac
2957 ;;
2958*) dflt="$pager";;
2959esac
2960echo " "
2961fn=f/
2962rp='What pager is used on your system?'
2963. ./getfile
2964pager="$ans"
2965
2966: get the patchlevel
2967echo " "
2968echo "Getting the current patchlevel..." >&4
2969if $test -r $rsrc/patchlevel.h;then
2970 patchlevel=`awk '/PATCHLEVEL/ {print $3}' < $rsrc/patchlevel.h`
2971else
2972 patchlevel=0
2973fi
2974echo "(You have $package $baserev PL$patchlevel.)"
2975
2976: determine perl absolute location
2977case "$perlpath" in
2978'')
2979 if test -f /usr/bin/perl; then
2980 dflt=/usr/bin/perl
2981 else
2982 case "$perl" in
2983 */*) dflt="$perl";;
2984 *) dflt=/usr/bin/perl;;
2985 esac
2986 fi
2987 ;;
2988*) dflt="$perlpath"
2989 ;;
2990esac
2991echo " "
2992fn=f~/
2993rp="Where is perl located on your system?"
2994. ./getfile
2995perlpath="$ans"
2996
2997: figure out how to guarantee perl startup
2998case "$sharpbang" in
2999*!)
3000 $cat >xtry <<EOP
3001#!$perlpath
3002system("exit 0");
3003EOP
3004 chmod a+x xtry
3005 if ./xtry >/dev/null 2>&1; then
3006 $cat <<EOH
3007
3008I can use the #! construct to start perl on your system. This will make
3009startup of perl scripts faster, but may cause problems if you want to share
3010those scripts and perl is not in a standard place (/usr/bin/perl) on all your
3011platforms. The alternative is to force a shell by starting the script with a
3012single ':' character.
3013
3014EOH
3015 pdflt=y
3016 else
3017 $cat <<EOH
3018
3019I could use the #! construct to start perl on your system, but using
3020 #!$perlpath
3021would be too long for your kernel to grok. Indeed, most systems do
3022limit the size of the leading #! string to 32 characters.
3023
3024EOH
3025 pdflt=n
3026 fi
3027 $rm -f xtry
3028 case "$startperl" in
3029 *!*) dflt=y;;
3030 '') case "$d_portable" in
3031 "$define") dflt=n;;
3032 *) dflt=$pdflt;;
3033 esac;;
3034 esac
3035 rp='Shall I use #! to start up perl?'
3036 . ./myread
3037 case "$ans" in
3038 y*|Y*) startperl="#!$perlpath";;
3039 *) startperl=": # use perl";;
3040 esac;;
3041*) startperl=": # use perl";;
3042esac
3043
3044: notify author that his package is used
3045if $test -f ../.config/mailauthor &&
3046 cmp $rsrc/patchlevel.h ../.config/mailauthor >/dev/null 2>&1
3047then
3048 status="say that you're using $package";
3049 case "$mailpatches" in
3050 true) status='have patches mailed to you as they are issued';;
3051 esac
3052 case "$notifypatches" in
3053 true) status='be notified when new patches are issued';;
3054 esac
3055 $cat <<EOM
3056
3057You have already sent the author of $package (Raphael_Manfredi@grenoble.hp.com) mail to
3058$status. If you wish, you may modify
3059your previous request by sending a new mail with different options.
3060
3061EOM
3062 rp='Should I send a status update to Raphael_Manfredi@grenoble.hp.com?'
3063 dflt=n
3064else
3065 $cat <<EOM
3066
3067If you are able to send mail to the Internet, the author of $package would
3068really appreciate you letting me send off a quick note, just to say that you've
3069tried it. The author is more likely to spend time maintaining $package if it's
3070known that many people are using it, and you can even ask to get sent new
3071patches automagically this way if you wish. To protect your privacy, all I'll
3072say in the mail is the version of $package that you're using.
3073
3074EOM
3075 rp='Should I send mail to Raphael_Manfredi@grenoble.hp.com?'
3076 dflt=y
3077 $test -f ../.config/nomail && dflt=n
3078fi
3079. ./myread
3080case "$ans" in
3081[yY]*)
3082 echo " "
3083 echo "Great! Your cooperation is really appreciated."
3084 $cat <<EOM
3085
3086Some braindead sites do not set a proper return address in the From: header of
3087their outgoing mail, making it impossible to reply to mail they generate.
3088If your site is broken in this way, write to your system administrator and get
3089it fixed!!! In the mean time, you can manually specify the Internet e-mail
3090address by which the author can get back to you, should there be a need to do
3091so. If manually specified, it should be something like "user@domain.top".
3092If your mail system generates addresses correctly, specify "none".
3093
3094EOM
3095 case "$usermail" in
3096 '-'|'') dflt=none;;
3097 *) dflt="$usermail";;
3098 esac
3099 rp='Manually specify a return address to use:'
3100 . ./myread
3101 case "$ans" in
3102 none|*@*.*)
3103 case "$ans" in
3104 none) usermail='-';;
3105 *) usermail="$ans";;
3106 esac
3107 ;;
3108 *)
3109 echo "(Address does not look like an Internet one -- ignoring it.)"
3110 usermail='-'
3111 mailpatches=false
3112 notifypatches=false
3113 ;;
3114 esac
3115 echo " "
3116 opt=''
3117 rp='Would you like to have new patches automatically mailed to you?'
3118 case "$mailpatches" in
3119 true) dflt=y;;
3120 *) dflt=n;;
3121 esac
3122 . ./myread
3123 case "$ans" in
3124 [yY]*) opt=' mailpatches'; mailpatches=true;;
3125 *)
3126 mailpatches=false
3127 echo " "
3128 rp='Ok, would you like to simply be notified of new patches?'
3129 case "$notifypatches" in
3130 false) dflt=n;;
3131 *) dflt=y;;
3132 esac
3133 . ./myread
3134 echo " "
3135 case "$ans" in
3136 [yY]*) opt=' notifypatches'; notifypatches=true;;
3137 *)
3138 echo "Fine, I'll simply say that you've tried it then."
3139 notifypatches=false
3140 ;;
3141 esac
3142 ;;
3143 esac
3144 echo "Sending mail to Raphael_Manfredi@grenoble.hp.com..." >&4
3145 atsh='@SH'
3146 $mailer Raphael_Manfredi@grenoble.hp.com <<EOM >/dev/null 2>&1
3147Subject: Command
3148Precedence: junk
3149To: Raphael_Manfredi@grenoble.hp.com
3150
3151$atsh package $usermail $package $baserev $patchlevel$opt
3152EOM
3153 $rm -f ../.config/mailauthor ../.config/nomail
3154 cp $rsrc/patchlevel.h ../.config/mailauthor
3155 ;;
3156*)
3157 case "$dflt" in
3158 "y")
3159 echo "Oh well, maybe next time."
3160 cp /dev/null ../.config/nomail
3161 ;;
3162 esac
3163 ;;
3164esac
3165
3166: figure out their full name
3167case "$NAME" in
3168'') case "$nametype" in
3169 other)
3170 fn=`./filexp ~/.fullname`
3171 xxx=usg
3172 $test -f $fn && xxx=other
3173 ;;
3174 *)
3175 xxx="$nametype"
3176 ;;
3177 esac
3178
3179 case "$xxx" in
3180 bsd)
3181 cf_name=`$passcat | grep "^$cf_by:" | \
3182 sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \
3183 -e 's/,.*//'`
3184 ;;
3185 usg)
3186 cf_name=`$passcat | grep "^$cf_by:" | \
3187 sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \
3188 -e 's/[^-]*-\(.*\)(.*)/\1/'`
3189 ;;
3190 *)
3191 cf_name=`$cat $fn`
3192 ;;
3193 esac
3194 ;;
3195*)
3196 cf_name="$NAME"
3197 ;;
3198esac
3199echo " "
3200echo "Pleased to meet you, $cf_name."
3201
3202: offer to join the mailing list
3203list_request='majordomo@foretune.co.jp'
3204list_sub="subscribe dist-users $cf_email"
3205list_unsub="unsubscribe dist-users $cf_email"
3206list_name="dist-users"
3207$cat <<EOM
3208
3209There is a mailing list for discussion about $package and related issues.
3210This is the preferred place to ask questions about the program and discuss
3211modifications and additions with the author and other users. If you are able
3212to send mail to the Internet, you are encouraged to subscribe. You need only
3213ever subscribe once, and you can unsubscribe automatically at any time in the
3214future. If you have already subscribed and you wish to unsubscribe now, you
3215may do so by answering "unsubscribe". Answer "subscribe" to subscribe to the
3216list.
3217
3218EOM
3219rp="Subscribe to or unsubscribe from the $list_name mailing list?"
3220dflt=neither
3221. ./myread
3222case "$ans" in
3223[sS]*) $cat <<EOM
3224
3225You will be sent a message from the list server to let you know when your
3226subscription has been successful and telling you how to submit articles and
3227how to unsubscribe again when necessary. You may also unsubscribe by running
3228this script again and asking it to do so for you.
3229
3230EOM
3231 echo "Sending mail to subscribe you to the $list_name list..." >&4
3232 $mailer $list_request <<EOM >/dev/null 2>&1
3233Precedence: junk
3234To: $list_request
3235
3236$list_sub
3237EOM
3238 ;;
3239[uU]*) echo "Sending mail to unsubscribe you from the $list_name list..." >&4
3240 $mailer $list_request <<EOM >/dev/null 2>&1
3241Precedence: junk
3242To: $list_request
3243
3244$list_unsub
3245EOM
3246 ;;
3247esac
3248
3249: end of configuration questions
3250echo " "
3251echo "End of configuration questions."
3252echo " "
3253
3254: back to where it started
3255if test -d ../UU; then
3256 cd ..
3257fi
3258
3259: configuration may be patched via a 'config.over' file
3260if $test -f config.over; then
3261 echo " "
3262 dflt=y
3263 rp='I see a config.over file. Do you wish to load it?'
3264 . UU/myread
3265 case "$ans" in
3266 n*) echo "OK, I'll ignore it.";;
3267 *) . ./config.over
3268 echo "Configuration override changes have been loaded."
3269 ;;
3270 esac
3271fi
3272
3273: in case they want portability, strip down executable paths
3274case "$d_portable" in
3275"$define")
3276 echo " "
3277 echo "Stripping down executable paths..." >&4
3278 for file in $loclist $trylist; do
3279 eval $file="\$file"
3280 done
3281 ;;
3282esac
3283
3284: create config.sh file
3285echo " "
3286echo "Creating config.sh..." >&4
3287$spitshell <<EOT >config.sh
3288$startsh
3289#
3290# This file was produced by running the Configure script. It holds all the
3291# definitions figured out by Configure. Should you modify one of these values,
3292# do not forget to propagate your changes by running "Configure -der". You may
3293# instead choose to run each of the .SH files by yourself, or "Configure -S".
3294#
3295
3296# Package name : $package
3297# Source directory : $src
3298# Configuration time: $cf_time
3299# Configured by : $cf_by
3300# Target system : $myuname
3301
3302Author='$Author'
3303Date='$Date'
3304Header='$Header'
3305Id='$Id'
3306Locker='$Locker'
3307Log='$Log'
3308Mcc='$Mcc'
3309RCSfile='$RCSfile'
3310Revision='$Revision'
3311Source='$Source'
3312State='$State'
3313afs='$afs'
3314ar='$ar'
3315archobjs='$archobjs'
3316awk='$awk'
3317baserev='$baserev'
3318bash='$bash'
3319bison='$bison'
3320byacc='$byacc'
3321c='$c'
3322cat='$cat'
3323cf_by='$cf_by'
3324cf_email='$cf_email'
3325cf_time='$cf_time'
3326chgrp='$chgrp'
3327chmod='$chmod'
3328chown='$chown'
3329comm='$comm'
3330compress='$compress'
3331contains='$contains'
3332cp='$cp'
3333cpio='$cpio'
3334cpp='$cpp'
3335cpplast='$cpplast'
3336cppminus='$cppminus'
3337cpprun='$cpprun'
3338cppstdin='$cppstdin'
3339csh='$csh'
3340d_berknames='$d_berknames'
3341d_bsd='$d_bsd'
3342d_eunice='$d_eunice'
3343d_passnames='$d_passnames'
3344d_portable='$d_portable'
3345d_usgnames='$d_usgnames'
3346d_xenix='$d_xenix'
3347date='$date'
3348defeditor='$defeditor'
3349echo='$echo'
3350egrep='$egrep'
3351emacs='$emacs'
3352eunicefix='$eunicefix'
3353expr='$expr'
3354find='$find'
3355firstmakefile='$firstmakefile'
3356flex='$flex'
3357gcc='$gcc'
3358grep='$grep'
3359groupcat='$groupcat'
3360gzip='$gzip'
3361hint='$hint'
3362hostcat='$hostcat'
3363inews='$inews'
3364install='$install'
3365installdir='$installdir'
3366installmansrc='$installmansrc'
3367installprivlib='$installprivlib'
3368installscript='$installscript'
3369ksh='$ksh'
3370less='$less'
3371line='$line'
3372lint='$lint'
3373ln='$ln'
3374lns='$lns'
3375lp='$lp'
3376lpr='$lpr'
3377ls='$ls'
3378mail='$mail'
3379mailer='$mailer'
3380mailpatches='$mailpatches'
3381mailx='$mailx'
3382make='$make'
3383make_set_make='$make_set_make'
3384manext='$manext'
3385mansrc='$mansrc'
3386mansrcexp='$mansrcexp'
3387mkdep='$mkdep'
3388mkdir='$mkdir'
3389more='$more'
3390mv='$mv'
3391mydomain='$mydomain'
3392myhostname='$myhostname'
3393myuname='$myuname'
3394n='$n'
3395nametype='$nametype'
3396notifypatches='$notifypatches'
3397nroff='$nroff'
3398orgname='$orgname'
3399osname='$osname'
3400osvers='$osvers'
3401package='$package'
3402pager='$pager'
3403passcat='$passcat'
3404patchlevel='$patchlevel'
3405perl='$perl'
3406perlpath='$perlpath'
3407pg='$pg'
3408phostname='$phostname'
3409pmake='$pmake'
3410pr='$pr'
3411prefix='$prefix'
3412prefixexp='$prefixexp'
3413privlib='$privlib'
3414privlibexp='$privlibexp'
3415rm='$rm'
3416rmail='$rmail'
3417scriptdir='$scriptdir'
3418scriptdirexp='$scriptdirexp'
3419sed='$sed'
3420sendmail='$sendmail'
3421sh='$sh'
3422shar='$shar'
3423sharpbang='$sharpbang'
3424shsharp='$shsharp'
3425sleep='$sleep'
3426smail='$smail'
3427sort='$sort'
3428spackage='$spackage'
3429spitshell='$spitshell'
3430src='$src'
3431startperl='$startperl'
3432startsh='$startsh'
3433submit='$submit'
3434sysman='$sysman'
3435tail='$tail'
3436tar='$tar'
3437tbl='$tbl'
3438test='$test'
3439touch='$touch'
3440tr='$tr'
3441troff='$troff'
3442uname='$uname'
3443uniq='$uniq'
3444usermail='$usermail'
3445uuname='$uuname'
3446vi='$vi'
3447zcat='$zcat'
3448zip='$zip'
3449EOT
3450
3451: add special variables
3452$test -f $src/patchlevel.h && \
3453awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
3454echo "CONFIG=true" >>config.sh
3455
3456: propagate old symbols
3457if $test -f UU/config.sh; then
3458 <UU/config.sh sort | uniq >UU/oldconfig.sh
3459 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
3460 sort | uniq -u >UU/oldsyms
3461 set X `cat UU/oldsyms`
3462 shift
3463 case $# in
3464 0) ;;
3465 *)
3466 cat <<EOM
3467Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
3468EOM
3469 echo "# Variables propagated from previous config.sh file." >>config.sh
3470 for sym in `cat UU/oldsyms`; do
3471 echo " Propagating $hint variable "'$'"$sym..."
3472 eval 'tmp="$'"${sym}"'"'
3473 echo "$tmp" | \
3474 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
3475 done
3476 ;;
3477 esac
3478fi
3479
3480: Finish up by extracting the .SH files
3481case "$alldone" in
3482exit)
3483 $rm -rf UU
3484 echo "Done."
3485 exit 0
3486 ;;
3487cont)
3488 ;;
3489'')
3490 dflt=''
3491 nostick=true
3492 $cat <<EOM
3493
3494If you'd like to make any changes to the config.sh file before I begin
3495to configure things, do it as a shell escape now (e.g. !vi config.sh).
3496
3497EOM
3498 rp="Press return or use a shell escape to edit config.sh:"
3499 . UU/myread
3500 nostick=''
3501 case "$ans" in
3502 '') ;;
3503 *) : in case they cannot read
3504 sh 1>&4 -c "$ans";;
3505 esac
3506 ;;
3507esac
3508
3509: if this fails, just run all the .SH files by hand
3510. ./config.sh
3511
3512echo " "
3513exec 1>&4
3514. ./UU/extract
3515
3516if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
3517 dflt=y
3518 case "$silent" in
3519 true) ;;
3520 *)
3521 $cat <<EOM
3522
3523Now you need to generate make dependencies by running "make depend".
3524You might prefer to run it in background: "make depend > makedepend.out &"
3525It can take a while, so you might not want to run it right now.
3526
3527EOM
3528 ;;
3529 esac
3530 rp="Run make depend now?"
3531 . UU/myread
3532 case "$ans" in
3533 y*)
3534 make depend && echo "Now you must run a make."
3535 ;;
3536 *)
3537 echo "You must run 'make depend' then 'make'."
3538 ;;
3539 esac
3540elif test -f [Mm]akefile; then
3541 echo " "
3542 echo "Now you must run a make."
3543else
3544 echo "Done."
3545fi
3546
3547$rm -f kit*isdone ark*isdone
3548$rm -rf UU
3549
3550: End of Configure
3551