root/releases/1.6/0p4/Configure

Revision 44, 100.2 KB (checked in by pennmush, 3 years ago)

PennMUSH 1.6.0p0 Archival

  • Property svn:executable set to *
Line 
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 so you may fetch it yourself from your nearest
18# archive site. Check with Archie if you don't know where that can be.)
19#
20
21# $Id: Configure,v 1.32 1996/01/15 21:47:07 dunemush Exp dunemush $
22#
23# Generated on Mon Jan 15 12:29:47 PST 1996 [metaconfig 3.0 PL58]
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: Sanity checks
89if test ! -t 0; then
90    echo "Say 'sh $me', not 'sh <$me'"
91    exit 1
92fi
93
94: On HP-UX, large Configure scripts may exercise a bug in /bin/sh
95if test -f /hp-ux -a -f /bin/ksh; then
96    if (PATH=.; alias -x) >/dev/null 2>&1; then
97        : already under /bin/ksh
98    else
99        cat <<'EOM'
100(Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
101EOM
102        unset ENV
103        exec /bin/ksh $0 "$@"
104    fi
105else
106    : Warn them if they use ksh on other systems
107    (PATH=.; alias -x) >/dev/null 2>&1 && \
108        cat <<EOM
109(I see you are using the Korn shell.  Some ksh's blow up on $me,
110especially on exotic machines.  If yours does, try the Bourne shell instead.)
111EOM
112fi
113
114: Configure runs within the UU subdirectory
115test -d UU || mkdir UU
116cd UU && rm -f ./*
117
118d_bsd=''
119d_eunice=''
120d_xenix=''
121eunicefix=''
122Mcc=''
123awk=''
124bash=''
125bison=''
126byacc=''
127cat=''
128chgrp=''
129chmod=''
130chown=''
131comm=''
132compress=''
133cp=''
134cpio=''
135cpp=''
136csh=''
137date=''
138echo=''
139egrep=''
140emacs=''
141expr=''
142find=''
143flex=''
144gcc=''
145grep=''
146inews=''
147ksh=''
148less=''
149line=''
150lint=''
151ln=''
152lp=''
153lpr=''
154ls=''
155mail=''
156mailx=''
157make=''
158mkdir=''
159more=''
160mv=''
161nroff=''
162perl=''
163pg=''
164pmake=''
165pr=''
166rm=''
167rmail=''
168sed=''
169sendmail=''
170sh=''
171shar=''
172sleep=''
173smail=''
174sort=''
175submit=''
176tail=''
177tar=''
178tbl=''
179test=''
180touch=''
181tr=''
182troff=''
183uname=''
184uniq=''
185uptime=''
186uuname=''
187vi=''
188zcat=''
189hint=''
190myuname=''
191osname=''
192osvers=''
193Author=''
194Date=''
195Header=''
196Id=''
197Locker=''
198Log=''
199RCSfile=''
200Revision=''
201Source=''
202State=''
203cc=''
204gccversion=''
205ccflags=''
206cppflags=''
207ldflags=''
208lkflags=''
209optimize=''
210cf_email=''
211cf_by=''
212cf_time=''
213contains=''
214cpplast=''
215cppminus=''
216cpprun=''
217cppstdin=''
218d_gettblsz=''
219nofile=''
220tablesize=''
221d_bcopy=''
222d_bzero=''
223d_const=''
224cryptlib=''
225d_crypt=''
226d_ieee=''
227d_keepsig=''
228d_memcpy=''
229d_memset=''
230d_newstyle=''
231d_open3=''
232d_portable=''
233d_lrand48=''
234d_rand=''
235d_random=''
236d_rlimit=''
237d_rusage=''
238d_sigaction=''
239d_sigintrp=''
240d_sigvec=''
241d_sigvectr=''
242d_strccmp=''
243d_index=''
244d_strchr=''
245d_strdup=''
246d_sysconf=''
247d_timelocal=''
248d_toupper=''
249d_uptime=''
250d_uwait3=''
251d_uwait=''
252d_voidsig=''
253signal_t=''
254d_volatile=''
255d_waitpid=''
256d_intfree=''
257freetype=''
258h_fcntl=''
259h_sysfile=''
260i_limits=''
261i_memory=''
262i_stdlib=''
263i_string=''
264strings=''
265i_sysresrc=''
266i_sysselct=''
267i_systypes=''
268i_sysvlimit=''
269i_syswait=''
270i_systime=''
271i_systimek=''
272i_time=''
273timeincl=''
274i_unistd=''
275i_stdarg=''
276i_varargs=''
277i_varhdr=''
278libc=''
279glibpth=''
280libpth=''
281plibpth=''
282xlibpth=''
283libs=''
284lns=''
285mailer=''
286d_mymalloc=''
287mallocobj=''
288mallocsrc=''
289malloctype=''
290usemymalloc=''
291mydomain=''
292myhostname=''
293phostname=''
294c=''
295n=''
296d_berknames=''
297d_passnames=''
298d_usgnames=''
299nametype=''
300groupcat=''
301hostcat=''
302passcat=''
303package=''
304spackage=''
305prototype=''
306sizetype=''
307so=''
308sharpbang=''
309shsharp=''
310spitshell=''
311startsh=''
312sysman=''
313nm_opt=''
314runnm=''
315usenm=''
316incpath=''
317mips=''
318mips_type=''
319usrinc=''
320defvoidused=''
321voidflags=''
322CONFIG=''
323
324define='define'
325undef='undef'
326smallmach='pdp11 i8086 z8000 i80286 iAPX286'
327rmlist=''
328
329: We must find out about Eunice early
330eunicefix=':'
331if test -f /etc/unixtovms; then
332    eunicefix=/etc/unixtovms
333fi
334if test -f /etc/unixtovms.exe; then
335    eunicefix=/etc/unixtovms.exe
336fi
337
338gccversion=''
339: change the next line if compiling for Xenix/286 on Xenix/386
340xlibpth='/usr/lib/386 /lib/386'
341
342: general looking path for locating libraries
343glibpth="/lib/pa1.1 /usr/lib/large /lib /usr/lib $xlibpth"
344glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
345glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib /usr/shlib"
346
347: Private path used by Configure to find libraries.  Its value
348: is prepended to libpth. This variable takes care of special
349: machines, like the mips.  Usually, it should be empty.
350plibpth=''
351
352: default library list
353libswanted=''
354large=''
355: full support for void wanted by default
356defvoidused=15
357
358: no include file wanted by default
359inclwanted=''
360
361defvoidused=15
362libswanted='m c'
363: script used to extract .SH files with variable substitutions
364cat >extract <<'EOS'
365CONFIG=true
366echo "Doing variable substitutions on .SH files..."
367if test -f MANIFEST; then
368    set x `awk '{print $1}' <MANIFEST | grep '\.SH'`
369else
370    echo "(Looking for .SH files under the current directory.)"
371    set x `find . -name "*.SH" -print`
372fi
373shift
374case $# in
3750) set x *.SH; shift;;
376esac
377if test ! -f $1; then
378    shift
379fi
380for file in $*; do
381    case "$file" in
382    */*)
383        dir=`expr X$file : 'X\(.*\)/'`
384        file=`expr X$file : 'X.*/\(.*\)'`
385        (cd $dir && . ./$file)
386        ;;
387    *)
388        . ./$file
389        ;;
390    esac
391done
392if test -f config_h.SH; then
393    if test ! -f config.h; then
394    : oops, they left it out of MANIFEST, probably, so do it anyway.
395    . ./config_h.SH
396    fi
397fi
398EOS
399
400: produce awk script to parse command line options
401cat >options.awk <<'EOF'
402BEGIN {
403    optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
404
405    len = length(optstr);
406    for (i = 1; i <= len; i++) {
407        c = substr(optstr, i, 1);
408        if (i < len) a = substr(optstr, i + 1, 1); else a = "";
409        if (a == ":") {
410            arg[c] = 1;
411            i++;
412        }
413        opt[c] = 1;
414    }
415}
416{
417    expect = 0;
418    str = $0;
419    if (substr(str, 1, 1) != "-") {
420        printf("'%s'\n", str);
421        next;
422    }
423    len = length($0);
424    for (i = 2; i <= len; i++) {
425        c = substr(str, i, 1);
426        if (!opt[c]) {
427            printf("-%s\n", substr(str, i));
428            next;
429        }
430        printf("-%s\n", c);
431        if (arg[c]) {
432            if (i < len)
433                printf("'%s'\n", substr(str, i + 1));
434            else
435                expect = 1;
436            next;
437        }
438    }
439}
440END {
441    if (expect)
442        print "?";
443}
444EOF
445
446: process the command line options
447set X `for arg in "$@"; do echo $arg; done | awk -f options.awk`
448eval "set $*"
449shift
450rm -f options.awk
451
452: set up default values
453fastread=''
454reuseval=false
455config_sh=''
456alldone=''
457error=''
458silent=''
459extractsh=''
460override=''
461knowitall=''
462rm -f optdef.sh
463
464: option parsing
465while test $# -gt 0; do
466    case "$1" in
467    -d) shift; fastread=yes;;
468    -e) shift; alldone=cont;;
469    -f)
470        shift
471        cd ..
472        if test -r "$1"; then
473            config_sh="$1"
474        else
475            echo "$me: cannot read config file $1." >&2
476            error=true
477        fi
478        cd UU
479        shift;;
480    -h) shift; error=true;;
481    -r) shift; reuseval=true;;
482    -s) shift; silent=true;;
483    -E) shift; alldone=exit;;
484    -K) shift; knowitall=true;;
485    -O) shift; override=true;;
486    -S) shift; extractsh=true;;
487    -D)
488        shift
489        case "$1" in
490        *=)
491            echo "$me: use '-U symbol=', not '-D symbol='." >&2
492            echo "$me: ignoring -D $1" >&2
493            ;;
494        *=*) echo "$1" | \
495                sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
496        *) echo "$1='define'" >> optdef.sh;;
497        esac
498        shift
499        ;;
500    -U)
501        shift
502        case "$1" in
503        *=) echo "$1" >> optdef.sh;;
504        *=*)
505            echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
506            echo "$me: ignoring -U $1" >&2
507            ;;
508        *) echo "$1='undef'" >> optdef.sh;;
509        esac
510        shift
511        ;;
512    -V) echo "$me generated by metaconfig 3.0 PL58." >&2
513        exit 0;;
514    --) break;;
515    -*) echo "$me: unknown option $1" >&2; shift; error=true;;
516    *) break;;
517    esac
518done
519
520case "$error" in
521true)
522    cat >&2 <<EOM
523Usage: $me [-dehrEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
524                 [-U symbol] [-U symbol=]
525  -d : use defaults for all answers.
526  -e : go on without questioning past the production of config.sh.
527  -f : specify an alternate default configuration file.
528  -h : print this help message and exit (with an error status).
529  -r : reuse C symbols value if possible (skips costly nm extraction).
530  -s : silent mode, only echoes questions and essential information.
531  -D : define symbol to have some value:
532         -D symbol         symbol gets the value 'define'
533         -D symbol=value   symbol gets the value 'value'
534  -E : stop at the end of questions, after having produced config.sh.
535  -K : do not use unless you know what you are doing.
536  -O : let -D and -U override definitions from loaded configuration file.
537  -S : perform variable substitutions on all .SH files (can mix with -f)
538  -U : undefine symbol:
539         -U symbol    symbol gets the value 'undef'
540         -U symbol=   symbol gets completely empty
541  -V : print version number and exit (with a zero status).
542EOM
543    exit 1
544    ;;
545esac
546
547exec 4>&1
548case "$silent" in
549true) exec 1>/dev/null;;
550esac
551
552: run the defines and the undefines, if any, but leave the file out there...
553touch optdef.sh
554. ./optdef.sh
555
556case "$extractsh" in
557true)
558    case "$config_sh" in
559    '') config_sh='config.sh'; config='./config.sh';;
560    /*) config="$config_sh";;
561    *) config="./$config_sh";;
562    esac
563    echo " "
564    echo "Fetching answers from $config_sh..."
565    cd ..
566    . $config
567    test "$override" && . ./optdef.sh
568    echo " "
569    . ./UU/extract
570    rm -rf UU
571    echo "Done."
572    exit 0
573    ;;
574esac
575
576: set package name
577package=pennmush
578
579: Eunice requires " " instead of "", can you believe it
580echo " "
581: Here we go...
582echo "Beginning of configuration questions for $package."
583
584trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
585
586: Some greps do not return status, grrr.
587echo "grimblepritz" >grimble
588if grep blurfldyick grimble >/dev/null 2>&1 ; then
589    contains=contains
590elif grep grimblepritz grimble >/dev/null 2>&1 ; then
591    contains=grep
592else
593    contains=contains
594fi
595rm -f grimble
596: the following should work in any shell
597case "$contains" in
598contains*)
599    echo " "
600    echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
601    cat >contains <<'EOSS'
602grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
603EOSS
604chmod +x contains
605esac
606
607: first determine how to suppress newline on echo command
608echo " "
609echo "Checking echo to see how to suppress newlines..."
610(echo "hi there\c" ; echo " ") >.echotmp
611if $contains c .echotmp >/dev/null 2>&1 ; then
612    echo "...using -n."
613    n='-n'
614    c=''
615else
616    cat <<'EOM'
617...using \c
618EOM
619    n=''
620    c='\c'
621fi
622echo $n "The star should be here-->$c"
623echo '*'
624rm -f .echotmp
625
626: compute the number of columns on the terminal for proper question formatting
627case "$COLUMNS" in
628'') COLUMNS='80';;
629esac
630
631: set up the echo used in my read
632myecho="case \"\$xxxm\" in
633'') echo $n \"\$rp $c\" >&4;;
634*) case \"\$rp\" in
635    '') echo $n \"[\$xxxm] $c\";;
636    *)
637        if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
638            echo \"\$rp\" >&4
639            echo $n \"[\$xxxm] $c\" >&4
640        else
641            echo $n \"\$rp [\$xxxm] $c\" >&4
642        fi
643        ;;
644    esac;;
645esac"
646
647: now set up to do reads with possible shell escape and default assignment
648cat <<EOSC >myread
649xxxm=\$dflt
650$myecho
651ans='!'
652case "\$fastread" in
653yes) case "\$dflt" in
654    '') ;;
655    *) ans='';
656        case "\$silent-\$rp" in
657        true-) ;;
658        *) echo " " >&4;;
659        esac;;
660    esac;;
661*) case "\$silent" in
662    true) case "\$rp" in
663        '') ans='';;
664        esac;;
665    esac;;
666esac
667while expr "X\$ans" : "X!" >/dev/null; do
668    read answ
669    set x \$xxxm
670    shift
671    aok=''; eval "ans=\"\$answ\"" && aok=y
672    case  "\$answ" in
673    "\$ans")
674        case "\$ans" in
675        \\&*)
676            set x \`expr "X\$ans" : "X&\(.*\)\$"\`
677            shift
678            case "\$1" in
679            -d)
680                fastread=yes
681                echo "(OK, I'll run with -d after this question.)"
682                ;;
683            -*)
684                echo "*** Sorry, \$1 not supported yet."
685                ;;
686            esac
687            $myecho
688            ans=!
689            ;;
690        "!")
691            sh 1>&4
692            echo " "
693            $myecho
694            ;;
695        !*)
696            set x \`expr "X\$ans" : "X!\(.*\)\$"\`
697            shift
698            sh 1>&4 -c "\$*"
699            echo " "
700            $myecho
701            ;;
702        esac;;
703    *)
704        case "\$aok" in
705        y)
706            echo "*** Substitution done -- please confirm."
707            xxxm="\$ans"
708            ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
709            xxxm="\$ans"
710            ans=!
711            ;;
712        *)
713            echo "*** Error -- try again."
714            ans=!
715            ;;
716        esac
717        $myecho
718        ;;
719    esac
720    case "\$ans\$xxxm\$nostick" in
721    '')
722        ans=!
723        $myecho
724        ;;
725    esac
726done
727case "\$ans" in
728'') ans="\$xxxm";;
729esac
730EOSC
731
732: create .config dir to save info across Configure sessions
733test -d ../.config || mkdir ../.config
734cat >../.config/README <<EOF
735This directory created by Configure to save information that should
736persist across sessions.
737
738You may safely delete it if you wish.
739EOF
740
741: general instructions
742needman=true
743firsttime=true
744user=`( (logname) 2>/dev/null || whoami) 2>&1`
745if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
746    firsttime=false
747    echo " "
748    rp='Would you like to see the instructions?'
749    dflt=n
750    . ./myread
751    case "$ans" in
752    [yY]*) ;;
753    *) needman=false;;
754    esac
755fi
756if $needman; then
757    cat <<EOH
758 
759This installation shell script will examine your system and ask you questions
760to determine how the pennmush package should be installed. If you get
761stuck on a question, you may use a ! shell escape to start a subshell or
762execute a command.  Many of the questions will have default answers in square
763brackets; typing carriage return will give you the default.
764
765On some of the questions which ask for file or directory names you are allowed
766to use the ~name construct to specify the login directory belonging to "name",
767even if you don't have a shell which knows about that.  Questions where this is
768allowed will be marked "(~name ok)".
769
770EOH
771    rp=''
772    dflt='Type carriage return to continue'
773    . ./myread
774    cat <<'EOH'
775
776The prompter used in this script allows you to use shell variables and
777backticks in your answers.  You may use $1, $2, etc...  to refer to the words
778in the default answer, as if the default line was a set of arguments given to a
779script shell.  This means you may also use $* to repeat the whole default line,
780so you do not have to re-type everything to add something to the default.
781
782Everytime there is a substitution, you will have to confirm.  If there is an
783error (e.g. an unmatched backtick), the default answer will remain unchanged
784and you will be prompted again.
785
786If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
787the questions and use the computed defaults (or the previous answers if there
788was already a config.sh file). Type 'Configure -h' for a list of options.
789You may also start interactively and then answer '& -d' at any prompt to turn
790on the non-interactive behaviour for the remaining of the execution.
791
792EOH
793    . ./myread
794    cat <<EOH
795
796Much effort has been expended to ensure that this shell script will run on any
797Unix system.  If despite that it blows up on yours, your best bet is to edit
798Configure and run it again.  If you can't run Configure for some reason,
799you'll have to generate a config.sh file by hand.  Whatever problems you
800have, let me (dunemush@mellers1.psych.berkeley.edu) know how I blew it.
801
802This installation script affects things in two ways:
803
8041) it may do direct variable substitutions on some of the files included
805   in this kit.
8062) it builds a config.h file for inclusion in C programs.  You may edit
807   any of these files as the need arises after running this script.
808
809If you make a mistake on a question, there is no easy way to back up to it
810currently.  The easiest thing to do is to edit config.sh and rerun all the SH
811files.  Configure will offer to let you do this before it runs the SH files.
812
813EOH
814    dflt='Type carriage return to continue'
815    . ./myread
816    case "$firsttime" in
817    true) echo $user >>../.config/instruct;;
818    esac
819fi
820
821: see if sh knows # comments
822echo " "
823echo "Checking your sh to see if it knows about # comments..." >&4
824if `sh -c '#' >/dev/null 2>&1`; then
825    echo "Your sh handles # comments correctly."
826    shsharp=true
827    spitshell=cat
828    echo " "
829    echo "Okay, let's see if #! works on this system..."
830    xcat=/bin/cat
831    test -f $xcat || xcat=/usr/bin/cat
832    echo "#!$xcat" >try
833    $eunicefix try
834    chmod +x try
835    ./try > today
836    if test -s today; then
837        echo "It does."
838        sharpbang='#!'
839    else
840        echo "#! $xcat" > try
841        $eunicefix try
842        chmod +x try
843        ./try > today
844        if test -s today; then
845            echo "It does."
846            sharpbang='#! '
847        else
848            echo "It's just a comment."
849            sharpbang=': use '
850        fi
851    fi
852else
853    echo "Your sh doesn't grok # comments--I will strip them later on."
854    shsharp=false
855    cd ..
856    echo "exec grep -v '^[  ]*#'" >spitshell
857    chmod +x spitshell
858    $eunicefix spitshell
859    spitshell=`pwd`/spitshell
860    cd UU
861    echo "I presume that if # doesn't work, #! won't work either!"
862    sharpbang=': use '
863fi
864rm -f try today
865
866: figure out how to guarantee sh startup
867echo " "
868echo "Checking out how to guarantee sh startup..." >&4
869case "$SYSTYPE" in
870*bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
871*) startsh=$sharpbang'/bin/sh';;
872esac
873echo "Let's see if '$startsh' works..."
874cat >try <<EOSS
875$startsh
876set abc
877test "$?abc" != 1
878EOSS
879
880chmod +x try
881$eunicefix try
882if ./try; then
883    echo "Yup, it does."
884else
885echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
886fi
887rm -f try
888
889: find out where common programs are
890echo " "
891echo "Locating common programs..." >&4
892cat <<EOSC >loc
893$startsh
894case \$# in
8950) exit 1;;
896esac
897thing=\$1
898shift
899dflt=\$1
900shift
901for dir in \$*; do
902    case "\$thing" in
903    .)
904    if test -d \$dir/\$thing; then
905        echo \$dir
906        exit 0
907    fi
908    ;;
909    *)
910    for thisthing in \$dir/\$thing; do
911        : just loop through to pick last item
912    done
913    if test -f \$thisthing; then
914        echo \$thisthing
915        exit 0
916    elif test -f \$dir/\$thing.exe; then
917        : on Eunice apparently
918        echo \$dir/\$thing
919        exit 0
920    fi
921    ;;
922    esac
923done
924echo \$dflt
925exit 1
926EOSC
927chmod +x loc
928$eunicefix loc
929loclist="
930awk
931cat
932echo
933expr
934grep
935ln
936rm
937sed
938sort
939touch
940tr
941uniq
942"
943trylist="
944Mcc
945cpp
946date
947mail
948perl
949rmail
950sendmail
951smail
952test
953uname
954uptime
955"
956pth=`echo $PATH | sed -e "s/$p_/ /g"`
957pth="$pth /lib /usr/lib"
958for file in $loclist; do
959    xxx=`./loc $file $file $pth`
960    eval $file=$xxx
961    eval _$file=$xxx
962    case "$xxx" in
963    /*)
964        echo $file is in $xxx.
965        ;;
966    ?:[\\/]*)
967        echo $file is in $xxx.
968        ;;
969    *)
970        echo "I don't know where $file is.  I hope it's in everyone's PATH."
971        ;;
972    esac
973done
974echo " "
975echo "Don't worry if any of the following aren't found..."
976say=offhand
977for file in $trylist; do
978    xxx=`./loc $file $file $pth`
979    eval $file=$xxx
980    eval _$file=$xxx
981    case "$xxx" in
982    /*)
983        echo $file is in $xxx.
984        ;;
985    ?:[\\/]*)
986        echo $file is in $xxx.
987        ;;
988    *)
989        echo "I don't see $file out there, $say."
990        say=either
991        ;;
992    esac
993done
994case "$egrep" in
995egrep)
996    echo "Substituting grep for egrep."
997    egrep=$grep
998    ;;
999esac
1000case "$test" in
1001test)
1002    echo "Hopefully test is built into your sh."
1003    ;;
1004*)
1005    if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1006        echo "Using the test built into your sh."
1007        test=test
1008        _test=test
1009    fi
1010    ;;
1011esac
1012case "$echo" in
1013echo)
1014    echo "Hopefully echo is built into your sh."
1015    ;;
1016'') ;;
1017*)
1018    echo " "
1019echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1020    $echo $n "hi there$c" >foo1
1021    echo $n "hi there$c" >foo2
1022    if cmp foo1 foo2 >/dev/null 2>&1; then
1023        echo "They are compatible.  In fact, they may be identical."
1024    else
1025        case "$n" in
1026        '-n') n='' c='\c';;
1027        *) n='-n' c='';;
1028        esac
1029        cat <<FOO
1030They are not compatible!  You are probably running ksh on a non-USG system.
1031I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1032have echo built in and we may have to run some Bourne shell scripts.  That
1033means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1034
1035FOO
1036        $echo $n "The star should be here-->$c"
1037        $echo "*"
1038    fi
1039    $rm -f foo1 foo2
1040    ;;
1041esac
1042
1043: determine whether symbolic links are supported
1044echo " "
1045$touch blurfl
1046if $ln -s blurfl sym > /dev/null 2>&1 ; then
1047    echo "Symbolic links are supported." >&4
1048    lns="$ln -s"
1049else
1050    echo "Symbolic links are NOT supported." >&4
1051    lns="$ln"
1052fi
1053$rm -f blurfl sym
1054
1055: see whether [:lower:] and [:upper:] are supported character classes
1056echo " "
1057up='[A-Z]'
1058low='[a-z]'
1059case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1060ABYZ)
1061    echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1062    up='[:upper:]'
1063    low='[:lower:]'
1064    ;;
1065*)
1066    echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
1067    ;;
1068esac
1069: set up the translation script tr, must be called with ./tr of course
1070cat >tr <<EOSC
1071$startsh
1072case "\$1\$2" in
1073'[A-Z][a-z]') exec $tr '$up' '$low';;
1074'[a-z][A-Z]') exec $tr '$low' '$up';;
1075esac
1076exec $tr "\$@"
1077EOSC
1078chmod +x tr
1079$eunicefix tr
1080
1081: Try to determine whether config.sh was made on this system
1082case "$config_sh" in
1083'')
1084myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1085myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1086    ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1087newmyuname="$myuname"
1088dflt=n
1089case "$knowitall" in
1090'')
1091    if test -f ../config.sh; then
1092        if $contains myuname= ../config.sh >/dev/null 2>&1; then
1093            eval "`grep myuname= ../config.sh`"
1094        fi
1095        if test "X$myuname" = "X$newmyuname"; then
1096            dflt=y
1097        fi
1098    fi
1099    ;;
1100*) dflt=y;;
1101esac
1102
1103: Get old answers from old config file if Configure was run on the
1104: same system, otherwise use the hints.
1105hint=default
1106cd ..
1107if test -f config.sh; then
1108    echo " "
1109    rp="I see a config.sh file.  Shall I use it to set the defaults?"
1110    . UU/myread
1111    case "$ans" in
1112    n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1113    *)  echo "Fetching default answers from your old config.sh file..." >&4
1114        tmp_n="$n"
1115        tmp_c="$c"
1116        . ./config.sh
1117        cp config.sh UU
1118        n="$tmp_n"
1119        c="$tmp_c"
1120        hint=previous
1121        ;;
1122    esac
1123fi
1124if test ! -f config.sh; then
1125    $cat <<EOM
1126
1127First time through, eh?  I have some defaults handy for the following systems:
1128
1129EOM
1130    cd hints; ls -C *.sh | $sed 's/\.sh/   /g' >&4
1131    dflt=''
1132    : Half the following guesses are probably wrong... If you have better
1133    : tests or hints, please send them to dunemush@mellers1.psych.berkeley.edu
1134    : The metaconfig authors would also appreciate a copy...
1135    $test -f /irix && osname=irix
1136    $test -f /xenix && osname=sco_xenix
1137    $test -f /dynix && osname=dynix
1138    $test -f /dnix && osname=dnix
1139    $test -f /unicos && osname=unicos && osvers=`$uname -r`
1140    $test -f /bin/mips && /bin/mips && osname=mips
1141    $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1142        $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
1143    $test -d /usr/apollo/bin && osname=apollo
1144    $test -f /etc/saf/_sactab && osname=svr4
1145    $test -d /usr/include/minix && osname=minix
1146    $test -d /MachTen && osname=machten && \
1147        osvers=`/usr/etc/version | $awk '{print $2}' | \
1148        $sed -e 's/[A-Za-z]$//'`
1149    if $test -f $uname; then
1150        set X $myuname
1151        shift
1152
1153        case "$5" in
1154        fps*) osname=fps ;;
1155        mips*)
1156            case "$4" in
1157            umips) osname=umips ;;
1158            *) osname=mips ;;
1159            esac;;
1160        [23]100) osname=mips ;;
1161        next*) osname=next ;;
1162        news*) osname=news ;;
1163        i386*)
1164            if $test -f /etc/kconfig; then
1165                osname=isc
1166                if test "$lns" = "ln -s"; then
1167                    osvers=4
1168                elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1169                    osvers=3
1170                elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
1171                    osvers=2
1172                fi
1173            fi
1174            ;;
1175        esac
1176
1177        case "$1" in
1178        aix) osname=aix
1179            tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1180            case "$tmp" in
1181            'not found') osvers="$4"."$3" ;;
1182            '<3240'|'<>3240') osvers=3.2.0 ;;
1183            '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1184            '=3250'|'>3250') osvers=3.2.5 ;;
1185            *) osvers=$tmp;;
1186            esac
1187            ;;
1188        dnix) osname=dnix
1189            osvers="$3"
1190            ;;
1191        domainos) osname=apollo
1192            osvers="$3"
1193            ;;
1194        dgux) osname=dgux
1195            osvers="$3"
1196            ;;
1197        freebsd) osname=freebsd
1198            osvers="$3" ;;
1199        genix) osname=genix ;;
1200        hp*) osname=hpux
1201            case "$3" in
1202            *.08.*) osvers=9 ;;
1203            *.09.*) osvers=9 ;;
1204            *.10.*) osvers=10 ;;
1205            *)  osvers="$3" ;;
1206            esac
1207            ;;
1208        irix) osname=irix
1209            case "$3" in
1210            4*) osvers=4 ;;
1211            5*) osvers=5 ;;
1212            *)  osvers="$3" ;;
1213            esac
1214            ;;
1215        linux) osname=linux
1216            case "$3" in
1217            1*) osvers=1 ;;
1218            *)  osvers="$3" ;;
1219            esac
1220            ;;
1221        netbsd*) osname=netbsd
1222            osvers="$3"
1223            ;;
1224        bsd386) osname=bsd386
1225            osvers=`$uname -r`
1226            ;;
1227        next*) osname=next ;;
1228        solaris) osname=solaris
1229            case "$3" in
1230            5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1231            *)  osvers="$3" ;;
1232            esac
1233            ;;
1234        sunos) osname=sunos
1235            case "$3" in
1236            5*) osname=solaris
1237                osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1238            *)  osvers="$3" ;;
1239            esac
1240            ;;
1241        titanos) osname=titanos
1242            case "$3" in
1243            1*) osvers=1 ;;
1244            2*) osvers=2 ;;
1245            3*) osvers=3 ;;
1246            4*) osvers=4 ;;
1247            *)  osvers="$3" ;;
1248            esac
1249            ;;
1250        ultrix) osname=ultrix
1251            osvers="$3"
1252            ;;
1253        osf1)   case "$5" in
1254                alpha)
1255                    osname=dec_osf
1256                    osvers=`echo "$3" | sed 's/^[vt]//'`
1257                    ;;
1258            hp*)    osname=hp_osf1  ;;
1259            mips)   osname=mips_osf1 ;;
1260            esac
1261            ;;
1262        uts) osname=uts
1263            osvers="$3"
1264            ;;
1265        $2) case "$osname" in
1266            *isc*) ;;
1267            *freebsd*) ;;
1268            svr*)
1269                : svr4.x or possibly later
1270                case "svr$3" in
1271                ${osname}*)
1272                    osname=svr$3
1273                    osvers=$4
1274                    ;;
1275                esac
1276                case "$osname" in
1277                svr4.0)
1278                    : Check for ESIX
1279                    if test -f /stand/boot ; then
1280                        eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
1281                        if test -n "$INITPROG" -a -f "$INITPROG"; then
1282            isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1283                            if test -n "$isesix"; then
1284                                osname=esix4
1285                            fi
1286                        fi
1287                    fi
1288                    ;;
1289                esac
1290                ;;
1291            *)  if test -f /etc/systemid; then
1292                    osname=sco
1293                    set `echo $3 | $sed 's/\./ /g'` $4
1294                    if $test -f sco_$1_$2_$3.sh; then
1295                        osvers=$1.$2.$3
1296                    elif $test -f sco_$1_$2.sh; then
1297                        osvers=$1.$2
1298                    elif $test -f sco_$1.sh; then
1299                        osvers=$1
1300                    fi
1301                else
1302                    case "$osname" in
1303                    '') : Still unknown.  Probably a generic Sys V.
1304                        osname="sysv"
1305                        osvers="$3"
1306                        ;;
1307                    esac
1308                fi
1309                ;;
1310            esac
1311            ;;
1312        *)  case "$osname" in
1313            '') : Still unknown.  Probably a generic BSD.
1314                osname="$1"
1315                osvers="$3"
1316                ;;
1317            esac
1318            ;;
1319        esac
1320    else
1321        if test -f /vmunix -a -f news_os.sh; then
1322            (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
1323            if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
1324                osname=news_os
1325            fi
1326            $rm -f ../UU/kernel.what
1327        elif test -d c:/.; then
1328            set X $myuname
1329            osname=os2
1330            osvers="$5"
1331        fi
1332    fi
1333   
1334    : Now look for a hint file osname_osvers, unless one has been
1335    : specified already.
1336    case "$hintfile" in
1337    ''|' ')
1338        file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
1339        : Also try without trailing minor version numbers.
1340        xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
1341        xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
1342        xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
1343        xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
1344        case "$file" in
1345        '') dflt=none ;;
1346        *)  case "$osvers" in
1347            '') dflt=$file
1348                ;;
1349            *)  if $test -f $file.sh ; then
1350                    dflt=$file
1351                elif $test -f $xfile.sh ; then
1352                    dflt=$xfile
1353                elif $test -f $xxfile.sh ; then
1354                    dflt=$xxfile
1355                elif $test -f $xxxfile.sh ; then
1356                    dflt=$xxxfile
1357                elif $test -f $xxxxfile.sh ; then
1358                    dflt=$xxxxfile
1359                elif $test -f "${osname}.sh" ; then
1360                    dflt="${osname}"
1361                else
1362                    dflt=none
1363                fi
1364                ;;
1365            esac
1366            ;;
1367        esac
1368        ;;
1369    *)
1370        dflt=`echo $hintfile | $sed 's/\.sh$//'`
1371        ;;
1372    esac
1373
1374    $cat <<EOM
1375
1376You may give one or more space-separated answers, or "none" if appropriate.
1377If your OS version has no hints, DO NOT give a wrong version -- say "none".
1378
1379EOM
1380    rp="Which of these apply, if any?"
1381    . ../UU/myread
1382    tans=$ans
1383    for file in $tans; do
1384        if $test -f $file.sh; then
1385            . ./$file.sh
1386            $cat $file.sh >> ../UU/config.sh
1387        elif $test X$tans = X -o X$tans = Xnone ; then
1388            : nothing
1389        else
1390            : Give one chance to correct a possible typo.
1391            echo "$file.sh does not exist"
1392            dflt=$file
1393            rp="hint to use instead?"
1394            . ../UU/myread
1395            for file in $ans; do
1396                if $test -f "$file.sh"; then
1397                    . ./$file.sh
1398                    $cat $file.sh >> ../UU/config.sh
1399                elif $test X$ans = X -o X$ans = Xnone ; then
1400                    : nothing
1401                else
1402                    echo "$file.sh does not exist -- ignored."
1403                fi
1404            done
1405        fi
1406    done
1407
1408    hint=recommended
1409    : Remember our hint file for later.
1410    if $test -f "$file.sh" ; then
1411        hintfile="$file"
1412    else
1413        hintfile=''
1414    fi
1415
1416    cd ..
1417fi
1418cd UU
1419;;
1420*)
1421    echo " "
1422    echo "Fetching default answers from $config_sh..." >&4
1423    tmp_n="$n"
1424    tmp_c="$c"
1425    cd ..
1426    cp $config_sh config.sh 2>/dev/null
1427    . ./config.sh
1428    cd UU
1429    cp ../config.sh .
1430    n="$tmp_n"
1431    c="$tmp_c"
1432    hint=previous
1433    ;;
1434esac
1435test "$override" && . ./optdef.sh
1436myuname="$newmyuname"
1437
1438: Restore computed paths
1439for file in $loclist $trylist; do
1440    eval $file="\$_$file"
1441done
1442
1443: who configured the system
1444cf_time=`$date 2>&1`
1445(logname > .temp) >/dev/null 2>&1
1446$test -s .temp || (whoami > .temp) >/dev/null 2>&1
1447$test