root/releases/1.8.1/2/Configure

Revision 515, 153.9 KB (checked in by pennmush, 2 years ago)

PennMUSH 1.8.1p2 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 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 1.21.1.4.1.1.1.1.1.1.1.7.1.14 Mon, 28 Jun 2004 09:33:37 -0500 dunemush $
22#
23# Generated on Mon Jun 28 09:20:55 CDT 2004 [metaconfig 3.0 PL70]
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    : Check for cygwin32 emulation
63    case "x$OSTYPE$OS" in
64    x*msys*Windows*)
65        echo 'Running on Windows? Using the MinGW MSys tools...'
66        ;;
67    x*win32*)
68        echo 'Running on Windows?  Assuming cygwin32 emulation tools...'
69        ;;
70    x*windows*)
71        echo 'Running on Windows?  Assuming cygwin32 emulation tools...'
72        ;;
73    x*cygwin*)
74        echo 'Looks like cygwin32...'
75        ;;
76    x*)
77        p_=\;
78        PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
79        OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
80        ;;
81    esac
82fi
83
84: Proper PATH setting
85paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
86paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
87paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
88paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
89paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
90paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
91paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
92paths="$paths /sbin /usr/sbin /usr/libexec /gnuwin32/b18/H-i386-cygwin32/bin"
93
94case "x$OSTYPE$OS" in
95    x*msys*Windows*)
96        PATH='/usr/local/bin:/mingw/bin:/bin:/perl/bin'
97        ;;
98    x*)
99        for p in $paths
100        do
101            case "$p_$PATH$p_" in
102                *$p_$p$p_*) ;;
103                *) test -d $p && PATH=$PATH$p_$p ;;
104            esac           
105        done
106
107        PATH=.$p_$PATH
108        export PATH
109        ;;
110esac
111
112: shall we be using ksh?
113inksh=''
114needksh=''
115avoidksh=''
116newsh=/bin/ksh
117changesh=''
118if (PATH=.; alias -x) >/dev/null 2>&1; then
119        inksh=true
120fi
121if test -f /hp-ux -a -f /bin/ksh; then
122    needksh='to avoid sh bug in "here document" expansion'
123fi
124if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
125    if test X`/usr/bin/uname -v` = X4; then
126        avoidksh="to avoid AIX 4's /bin/sh"
127        newsh=/usr/bin/bsh
128    fi
129fi
130case "$inksh/$needksh" in
131/[a-z]*)
132        unset ENV
133        changesh=true
134        reason="$needksh"
135    ;;
136esac
137case "$inksh/$avoidksh" in
138true/[a-z]*)
139    changesh=true
140    reason="$avoidksh"
141    ;;
142esac
143case "$inksh/$needksh-$avoidksh-" in
144true/--)
145        cat <<EOM
146(I see you are using the Korn shell.  Some ksh's blow up on $me,
147mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
148EOM
149    ;;
150esac
151case "$changesh" in
152true)
153    echo "(Feeding myself to $newsh $reason.)"
154    case "$0" in
155    Configure|*/Configure) exec $newsh $0 "$@";;
156    *) exec $newsh Configure "$@";;
157    esac
158    ;;
159esac
160
161: Configure runs within the UU subdirectory
162test -d UU || mkdir UU
163unset CDPATH
164cd UU && rm -f ./*
165
166d_bsd=''
167d_eunice=''
168d_xenix=''
169eunicefix=''
170Mcc=''
171ar=''
172awk=''
173bash=''
174bison=''
175byacc=''
176cat=''
177chgrp=''
178chmod=''
179chown=''
180comm=''
181compress=''
182cp=''
183cpio=''
184cpp=''
185csh=''
186date=''
187echo=''
188egrep=''
189emacs=''
190expr=''
191find=''
192flex=''
193gcc=''
194grep=''
195gzip=''
196inews=''
197ksh=''
198less=''
199line=''
200lint=''
201ln=''
202lp=''
203lpr=''
204ls=''
205mail=''
206mailx=''
207make=''
208mkdir=''
209more=''
210mv=''
211nroff=''
212perl=''
213pg=''
214pmake=''
215pr=''
216rm=''
217rmail=''
218sed=''
219sendmail=''
220shar=''
221sleep=''
222smail=''
223sort=''
224submit=''
225tail=''
226tar=''
227tbl=''
228test=''
229touch=''
230tr=''
231troff=''
232uname=''
233uniq=''
234uptime=''
235uuname=''
236vi=''
237zcat=''
238zip=''
239hint=''
240myuname=''
241osname=''
242osvers=''
243Author=''
244Date=''
245Header=''
246Id=''
247Locker=''
248Log=''
249RCSfile=''
250Revision=''
251Source=''
252State=''
253archobjs=''
254firstmakefile=''
255cc=''
256gccversion=''
257ccflags=''
258cppflags=''
259ldflags=''
260lkflags=''
261locincpth=''
262optimize=''
263warnings=''
264cdecl=''
265cf_email=''
266cf_by=''
267cf_time=''
268contains=''
269cpplast=''
270cppminus=''
271cpprun=''
272cppstdin=''
273d_gettblsz=''
274nofile=''
275tablesize=''
276d_access=''
277d_argsinfp=''
278d_assert=''
279d_attribut=''
280d_bcopy=''
281d_bindtextdomain=''
282d_bzero=''
283d_const=''
284cryptlib=''
285d_crypt=''
286i_crypt=''
287d_force_ipv4=''
288d_fpsetmask=''
289d_fpsetround=''
290i_floatingpoint=''
291d_gaistr=''
292d_getadinf=''
293d_getdate=''
294d_gethbynm2=''
295d_getnminf=''
296d_getpagsz=''
297pagesize=''
298d_getprior=''
299d_gettext=''
300d_gnulibc=''
301d_huge=''
302d_huge_val=''
303d_int_max=''
304d_maxdouble=''
305d_maxint=''
306d_ieee=''
307d_in2p=''
308d_internet=''
309d_ipv6=''
310d_itimer=''
311d_keepsig=''
312d_memcpy=''
313d_memmove=''
314d_memset=''
315d_newstyle=''
316d_open3=''
317d_portable=''
318d_lrand48=''
319d_rand=''
320d_random=''
321d_rename=''
322d_rlimit=''
323d_rusage=''
324d_select=''
325d_sendmail=''
326d_setlocale=''
327d_setpgid=''
328d_bsdsetpgrp=''
329d_setpgrp=''
330d_setprior=''
331d_sigaction=''
332d_sigchld=''
333d_sigcld=''
334d_signalproto=''
335d_sigprocmask=''
336d_snprintf=''
337d_oldsock=''
338d_socket=''
339d_sockpair=''
340sockethdr=''
341socketlib=''
342d_socklen=''
343d_strccmp=''
344d_index=''
345d_strchr=''
346d_strcoll=''
347d_strdup=''
348d_strxfrm=''
349d_sysconf=''
350d_sysctl=''
351d_sysctlbyname=''
352d_tcl=''
353i_tcl=''
354d_textdomain=''
355d_timelocal=''
356d_toupper=''
357d_uint32_t=''
358d_uptime=''
359d_urandom=''
360d_uwait3=''
361d_uwait=''
362d_voidsig=''
363signal_t=''
364d_volatile=''
365d_vsnprintf=''
366d_waitpid=''
367h_fcntl=''
368h_sysfile=''
369i_arpainet=''
370i_arpanameser=''
371i_errno=''
372i_syserrno=''
373i_fcntl=''
374i_libintl=''
375i_limits=''
376i_locale=''
377i_malloc=''
378i_memory=''
379i_netdb=''
380i_niin=''
381i_sysin=''
382i_setjmp=''
383i_stddef=''
384i_stdint=''
385i_stdlib=''
386i_string=''
387strings=''
388i_sysfile=''
389d_voidtty=''
390i_bsdioctl=''
391i_sysfilio=''
392i_sysioctl=''
393i_syssockio=''
394i_sysmman=''
395i_syspage=''
396i_sysparam=''
397i_sysresrc=''
398i_sysselct=''
399i_syssock=''
400i_sysstat=''
401i_systypes=''
402i_sysvlimit=''
403i_syswait=''
404i_sgtty=''
405i_termio=''
406i_termios=''
407i_systime=''
408i_systimek=''
409i_time=''
410timeincl=''
411i_unistd=''
412i_values=''
413i_stdarg=''
414i_varargs=''
415i_varhdr=''
416install=''
417installdir=''
418libc=''
419glibpth=''
420libpth=''
421loclibpth=''
422plibpth=''
423xlibpth=''
424libs=''
425d_openssl=''
426libssl=''
427lns=''
428mailer=''
429make_set_make=''
430d_mymalloc=''
431freetype=''
432mallocobj=''
433mallocsrc=''
434malloctype=''
435usemymalloc=''
436mydomain=''
437myhostname=''
438phostname=''
439c=''
440n=''
441d_berknames=''
442d_passnames=''
443d_usgnames=''
444nametype=''
445groupcat=''
446hostcat=''
447passcat=''
448package=''
449spackage=''
450pidtype=''
451prototype=''
452sh=''
453sizetype=''
454so=''
455d_keepalive=''
456sharpbang=''
457shsharp=''
458spitshell=''
459src=''
460startsh=''
461sysman=''
462nm_opt=''
463nm_so_opt=''
464runnm=''
465usenm=''
466incpath=''
467mips=''
468mips_type=''
469usrinc=''
470defvoidused=''
471voidflags=''
472CONFIG=''
473
474define='define'
475undef='undef'
476smallmach='pdp11 i8086 z8000 i80286 iAPX286'
477rmlist=''
478
479: We must find out about Eunice early
480eunicefix=':'
481if test -f /etc/unixtovms; then
482    eunicefix=/etc/unixtovms
483fi
484if test -f /etc/unixtovms.exe; then
485    eunicefix=/etc/unixtovms.exe
486fi
487
488: list of known cpp symbols, sorted alphabetically
489al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
490al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
491al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
492al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
493al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
494al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
495al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
496al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
497al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
498al="$al VMS Xenix286"
499al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI"
500al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
501al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
502al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
503al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
504al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
505al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
506al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
507al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
508al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
509al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
510al="$al __SVR4_2__ __UMAXV__"
511al="$al ____386BSD____ __alpha __alpha__ __amiga"
512al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
513al="$al __host_mips__"
514al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
515al="$al __hp9000s500 __hp9000s700 __hp9000s800"
516al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
517al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
518al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
519al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
520al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
521al="$al __mc88100 __mc88100__ __mips __mips__"
522al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
523al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
524al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
525al="$al _host_mips _mips _unix"
526al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
527al="$al apollo ardent att386 att3b"
528al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
529al="$al cadmus clipper concurrent convex cray ctix"
530al="$al dmert encore gcos gcx gimpel gould"
531al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
532al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
533al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
534al="$al i186 i286 i386 i486 i8086"
535al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
536al="$al ksr1 linux luna luna88k m68k m88100 m88k"
537al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
538al="$al mc68040 mc68060 mc68k mc68k32 mc700"
539al="$al mc88000 mc88100 merlin mert mips mvs n16"
540al="$al ncl_el ncl_mr"
541al="$al news1500 news1700 news1800 news1900 news3700"
542al="$al news700 news800 news900 ns16000 ns32000"
543al="$al ns32016 ns32332 ns32k nsc32000 os osf"
544al="$al parisc pc532 pdp11 plexus posix pyr"
545al="$al riscix riscos scs sequent sgi sinix sony sony_news"
546al="$al sonyrisc sparc sparclite spectrum stardent stratos"
547al="$al sun sun3 sun386 svr4 sysV68 sysV88"
548al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
549al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
550al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
551al="$al xenix z8000"
552
553: No trailing extension on UNIX executables
554_exe=''
555: Extra object files, if any, needed on this platform.
556archobjs=''
557gccversion=''
558: change the next line if compiling for Xenix/286 on Xenix/386
559xlibpth='/usr/lib/386 /lib/386'
560
561: Possible local library directories to search.
562loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
563loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
564
565: general looking path for locating libraries
566glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
567glibpth="$glibpth /lib /usr/lib $xlibpth"
568glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
569glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
570
571: Private path used by Configure to find libraries.  Its value
572: is prepended to libpth. This variable takes care of special
573: machines, like the mips.  Usually, it should be empty.
574plibpth=''
575
576large=''
577: full support for void wanted by default
578defvoidused=15
579
580: Possible local include directories to search.
581: Set locincpth to "" in a hint file to defeat local include searches.
582locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
583locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
584locincpth="$locincpth /usr/kerberos/include"
585:
586: no include file wanted by default
587inclwanted=''
588
589: default library list
590libswanted=''
591defvoidused=15
592libswanted='nsl socket m c crypt bind resolv ld dl tcl intl'
593
594: Find the basic shell for Bourne shell scripts
595case "$sh" in
596'')
597    case "$SYSTYPE" in
598    *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
599    *) xxx='/bin/sh';;
600    esac
601    if test -f "$xxx"; then
602        sh="$xxx"
603    else
604        : Build up a list and do a single loop so we can 'break' out.
605        pth=`echo $PATH | sed -e "s/$p_/ /g"`
606        for xxx in sh bash ksh pdksh ash; do
607            for p in $pth; do
608                try="$try ${p}/${xxx}"
609            done
610        done
611        for xxx in $try; do
612            if test -f "$xxx"; then
613                sh="$xxx";
614                break
615            elif test -f "$xxx.exe"; then
616                sh="$xxx";
617                break
618            fi
619        done
620    fi
621    ;;
622esac
623
624case "$sh" in
625'') cat <<EOM >&2
626$me:  Fatal Error:  I can't find a Bourne Shell anywhere. 
627
628Usually it's in /bin/sh.  How did you even get this far?
629Please contact me (Javelin) at dunemush@pennmush.org and
630we'll try to straighten this all out.
631EOM
632    exit 1
633    ;;
634esac
635
636: see if sh knows # comments
637if `$sh -c '#' >/dev/null 2>&1`; then
638    shsharp=true
639    spitshell=cat
640    xcat=/bin/cat
641    test -f $xcat || xcat=/usr/bin/cat
642    echo "#!$xcat" >try
643    $eunicefix try
644    chmod +x try
645    ./try > today
646    if test -s today; then
647        sharpbang='#!'
648    else
649        echo "#! $xcat" > try
650        $eunicefix try
651        chmod +x try
652        ./try > today
653        if test -s today; then
654            sharpbang='#! '
655        else
656            sharpbang=': use '
657        fi
658    fi
659else
660    echo " "
661    echo "Your $sh doesn't grok # comments--I will strip them later on."
662    shsharp=false
663    cd ..
664    echo "exec grep -v '^[  ]*#'" >spitshell
665    chmod +x spitshell
666    $eunicefix spitshell
667    spitshell=`pwd`/spitshell
668    cd UU
669    echo "I presume that if # doesn't work, #! won't work either!"
670    sharpbang=': use '
671fi
672rm -f try today
673
674: figure out how to guarantee sh startup
675case "$startsh" in
676'') startsh=${sharpbang}${sh} ;;
677*)
678esac
679cat >try <<EOSS
680$startsh
681set abc
682test "$?abc" != 1
683EOSS
684
685chmod +x try
686$eunicefix try
687if ./try; then
688    : echo "Yup, it does."
689else
690    echo "Hmm... '$startsh' does not guarantee sh startup..."
691    echo "You may have to fix up the shell scripts to make sure $sh runs them."
692fi
693rm -f try
694
695: produce awk script to parse command line options
696cat >options.awk <<'EOF'
697BEGIN {
698    optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
699
700    len = length(optstr);
701    for (i = 1; i <= len; i++) {
702        c = substr(optstr, i, 1);
703        if (i < len) a = substr(optstr, i + 1, 1); else a = "";
704        if (a == ":") {
705            arg[c] = 1;
706            i++;
707        }
708        opt[c] = 1;
709    }
710}
711{
712    expect = 0;
713    str = $0;
714    if (substr(str, 1, 1) != "-") {
715        printf("'%s'\n", str);
716        next;
717    }
718    len = length($0);
719    for (i = 2; i <= len; i++) {
720        c = substr(str, i, 1);
721        if (!opt[c]) {
722            printf("-%s\n", substr(str, i));
723            next;
724        }
725        printf("-%s\n", c);
726        if (arg[c]) {
727            if (i < len)
728                printf("'%s'\n", substr(str, i + 1));
729            else
730                expect = 1;
731            next;
732        }
733    }
734}
735END {
736    if (expect)
737        print "?";
738}
739EOF
740
741: process the command line options
742set X `for arg in "$@"; do echo "X$arg"; done |
743    sed -e s/X// | awk -f options.awk`
744eval "set $*"
745shift
746rm -f options.awk
747
748: set up default values
749fastread=''
750reuseval=false
751config_sh=''
752alldone=''
753error=''
754silent=''
755extractsh=''
756override=''
757knowitall=''
758rm -f optdef.sh
759cat >optdef.sh <<EOS
760$startsh
761EOS
762
763
764: option parsing
765while test $# -gt 0; do
766    case "$1" in
767    -d) shift; fastread=yes;;
768    -e) shift; alldone=cont;;
769    -f)
770        shift
771        cd ..
772        if test -r "$1"; then
773            config_sh="$1"
774        else
775            echo "$me: cannot read config file $1." >&2
776            error=true
777        fi
778        cd UU
779        shift;;
780    -h) shift; error=true;;
781    -r) shift; reuseval=true;;
782    -s) shift; silent=true; realsilent=true;;
783    -E) shift; alldone=exit;;
784    -K) shift; knowitall=true;;
785    -O) shift; override=true;;
786    -S) shift; silent=true; extractsh=true;;
787    -D)
788        shift
789        case "$1" in
790        *=)
791            echo "$me: use '-U symbol=', not '-D symbol='." >&2
792            echo "$me: ignoring -D $1" >&2
793            ;;
794        *=*) echo "$1" | \
795                sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
796        *) echo "$1='define'" >> optdef.sh;;
797        esac
798        shift
799        ;;
800    -U)
801        shift
802        case "$1" in
803        *=) echo "$1" >> optdef.sh;;
804        *=*)
805            echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
806            echo "$me: ignoring -U $1" >&2
807            ;;
808        *) echo "$1='undef'" >> optdef.sh;;
809        esac
810        shift
811        ;;
812    -V) echo "$me generated by metaconfig 3.0 PL70." >&2
813        exit 0;;
814    --) break;;
815    -*) echo "$me: unknown option $1" >&2; shift; error=true;;
816    *) break;;
817    esac
818done
819
820case "$error" in
821true)
822    cat >&2 <<EOM
823Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
824                 [-U symbol] [-U symbol=]
825  -d : use defaults for all answers.
826  -e : go on without questioning past the production of config.sh.
827  -f : specify an alternate default configuration file.
828  -h : print this help message and exit (with an error status).
829  -r : reuse C symbols value if possible (skips costly nm extraction).
830  -s : silent mode, only echoes questions and essential information.
831  -D : define symbol to have some value:
832         -D symbol         symbol gets the value 'define'
833         -D symbol=value   symbol gets the value 'value'
834  -E : stop at the end of questions, after having produced config.sh.
835  -K : do not use unless you know what you are doing.
836  -O : let -D and -U override definitions from loaded configuration file.
837  -S : perform variable substitutions on all .SH files (can mix with -f)
838  -U : undefine symbol:
839         -U symbol    symbol gets the value 'undef'
840         -U symbol=   symbol gets completely empty
841  -V : print version number and exit (with a zero status).
842EOM
843    exit 1
844    ;;
845esac
846
847: Sanity checks
848case "$fastread$alldone" in
849yescont|yesexit) ;;
850*)
851    if test ! -t 0; then
852        echo "Say 'sh Configure', not 'sh <Configure'"
853        exit 1
854    fi
855    ;;
856esac
857
858exec 4>&1
859case "$silent" in
860true) exec 1>/dev/null;;
861esac
862
863: run the defines and the undefines, if any, but leave the file out there...
864touch optdef.sh
865. ./optdef.sh
866
867: set package name
868package=pennmush
869
870: Some greps do not return status, grrr.
871echo "grimblepritz" >grimble
872if grep blurfldyick grimble >/dev/null 2>&1 ; then
873    contains=contains
874elif grep grimblepritz grimble >/dev/null 2>&1 ; then
875    contains=grep
876else
877    contains=contains
878fi
879rm -f grimble
880: the following should work in any shell
881case "$contains" in
882contains*)
883    echo " "
884    echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
885    cat >contains <<'EOSS'
886grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
887EOSS
888chmod +x contains
889esac
890
891: first determine how to suppress newline on echo command
892echo " "
893echo "Checking echo to see how to suppress newlines..."
894(echo "hi there\c" ; echo " ") >.echotmp
895if $contains c .echotmp >/dev/null 2>&1 ; then
896    echo "...using -n."
897    n='-n'
898    c=''
899else
900    cat <<'EOM'
901...using \c
902EOM
903    n=''
904    c='\c'
905fi
906echo $n "The star should be here-->$c"
907echo '*'
908rm -f .echotmp
909
910: compute the number of columns on the terminal for proper question formatting
911case "$COLUMNS" in
912'') COLUMNS='80';;
913esac
914
915: set up the echo used in my read
916myecho="case \"\$xxxm\" in
917'') echo $n \"\$rp $c\" >&4;;
918*) case \"\$rp\" in
919    '') echo $n \"[\$xxxm] $c\";;
920    *)
921        if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
922            echo \"\$rp\" >&4
923            echo $n \"[\$xxxm] $c\" >&4
924        else
925            echo $n \"\$rp [\$xxxm] $c\" >&4
926        fi
927        ;;
928    esac;;
929esac"
930
931: now set up to do reads with possible shell escape and default assignment
932cat <<EOSC >myread
933$startsh
934xxxm=\$dflt
935$myecho
936ans='!'
937case "\$fastread" in
938yes) case "\$dflt" in
939    '') ;;
940    *) ans='';
941        case "\$silent-\$rp" in
942        true-) ;;
943        *) echo " " >&4;;
944        esac;;
945    esac;;
946*) case "\$silent" in
947    true) case "\$rp" in
948        '') ans='';;
949        esac;;
950    esac;;
951esac
952while expr "X\$ans" : "X!" >/dev/null; do
953    read answ
954    set x \$xxxm
955    shift
956    aok=''; eval "ans=\\"\$answ\\"" && aok=y
957    case  "\$answ" in
958    "!")
959        sh 1>&4
960        echo " "
961        $myecho
962        ;;
963    !*)
964        set x \`expr "X\$ans" : "X!\(.*\)\$"\`
965        shift
966        sh 1>&4 -c "\$*"
967        echo " "
968        $myecho
969        ;;
970    "\$ans")
971        case "\$ans" in
972        \\&*)
973            set x \`expr "X\$ans" : "X&\(.*\)\$"\`
974            shift
975            case "\$1" in
976            -d)
977                fastread=yes
978                echo "(OK, I'll run with -d after this question.)" >&4
979                ;;
980            -*)
981                echo "*** Sorry, \$1 not supported yet." >&4
982                ;;
983            esac
984            $myecho
985            ans=!
986            ;;
987        esac;;
988    *)
989        case "\$aok" in
990        y)
991            echo "*** Substitution done -- please confirm."
992            xxxm="\$ans"
993            ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
994            xxxm="\$ans"
995            ans=!
996            ;;
997        *)
998            echo "*** Error -- try again."
999            ans=!
1000            ;;
1001        esac
1002        $myecho
1003        ;;
1004    esac
1005    case "\$ans\$xxxm\$nostick" in
1006    '')
1007        ans=!
1008        $myecho
1009        ;;
1010    esac
1011done
1012case "\$ans" in
1013'') ans="\$xxxm";;
1014esac
1015EOSC
1016
1017: Find the path to the source tree
1018case "$src" in
1019'') src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1020esac
1021case "$src" in
1022'')
1023    src=.
1024    rsrc=..
1025    ;;
1026/*) rsrc="$src/..";;
1027*) rsrc="../$src";;
1028esac
1029if test -f $rsrc/Configure && \
1030    $contains "^package=$package" $rsrc/Configure >/dev/null 2>&1
1031then
1032   : found it, so we are ok.
1033else
1034    rsrc=''
1035    for src in . .. ../.. ../../.. ../../../..; do
1036        if test -f ../$src/Configure && \
1037            $contains "^package=$package" ../$src/Configure >/dev/null 2>&1
1038        then
1039            rsrc=../$src
1040            break
1041        fi
1042    done
1043fi
1044case "$rsrc" in
1045'')
1046    echo " "
1047    dflt=
1048    rp="Directory where sources for $package are located?"
1049    . ./myread
1050    src="$ans"
1051    rsrc="$src"
1052    if test -f $rsrc/Configure && \
1053        $contains "^package=$package" $rsrc/Configure >/dev/null 2>&1
1054    then
1055        echo "Ok, I've found them under $src"
1056    else
1057        echo "Sorry, I can't seem to be able to locate $package sources." >&4
1058        exit 1
1059    fi
1060    ;;
1061../.) ;;
1062*)
1063    echo " "
1064    echo "Sources for $package found in $src" >&4
1065    ;;
1066esac
1067
1068: script used to extract .SH files with variable substitutions
1069cat >extract <<'EOS'
1070CONFIG=true
1071echo "Doing variable substitutions on .SH files..."
1072if test -f $src/MANIFEST; then
1073    set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'`
1074else
1075    echo "(Looking for .SH files under the source directory.)"
1076    set x `(cd $src; find . -name "*.SH" -print)`
1077fi
1078shift
1079case $# in
10800) set x `(cd $src; echo *.SH)`; shift;;
1081esac
1082if test ! -f $src/$1; then
1083    shift
1084fi
1085mkdir_p='
1086name=$1;
1087create="";
1088while test $name; do
1089    if test ! -d "$name"; then
1090        create="$name $create";
1091        name=`echo $name | sed -e "s|^[^/]*$||"`;
1092        name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1093    else
1094        name="";
1095    fi;
1096done;
1097for file in $create; do
1098    mkdir $file;
1099done
1100'
1101for file in $*; do
1102    case "$src" in
1103    ".")
1104        case "$file" in
1105        */*)
1106            dir=`expr X$file : 'X\(.*\)/'`
1107            file=`expr X$file : 'X.*/\(.*\)'`
1108            (cd $dir && . ./$file)
1109            ;;
1110        *)
1111            . ./$file
1112            ;;
1113        esac
1114        ;;
1115    *)
1116        case "$file" in
1117        */*)
1118            dir=`expr X$file : 'X\(.*\)/'`
1119            file=`expr X$file : 'X.*/\(.*\)'`
1120            (set x $dir; shift; eval $mkdir_p)
1121            sh <$src/$dir/$file
1122            ;;
1123        *)
1124            sh <$src/$file
1125            ;;
1126        esac
1127        ;;
1128    esac
1129done
1130if test -f $src/config_h.SH; then
1131    if test ! -f config.h; then
1132    : oops, they left it out of MANIFEST, probably, so do it anyway.
1133    . $src/config_h.SH
1134    fi
1135fi
1136EOS
1137
1138: extract files and exit if asked to do so
1139case "$extractsh" in
1140true)
1141    case "$realsilent" in
1142    true) ;;
1143    *) exec 1>&4;;
1144    esac
1145    case "$config_sh" in
1146    '') config_sh='config.sh'; config="$rsrc/config.sh";;
1147    /*) config="$config_sh";;
1148    *) config="$rsrc/$config_sh";;
1149    esac
1150    echo " "
1151    echo "Fetching answers from $config_sh..."
1152    . $config
1153    test "$override" && . ./optdef.sh
1154    echo " "
1155    cd ..
1156    . UU/extract
1157    rm -rf UU
1158    echo "Done."
1159    exit 0
1160    ;;
1161esac
1162
1163: Eunice requires " " instead of "", can you believe it
1164echo " "
1165: Here we go...
1166echo "Beginning of configuration questions for $package."
1167
1168trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1169
1170: Now test for existence of everything in MANIFEST
1171echo " "
1172if test -f $rsrc/MANIFEST; then
1173    echo "First let's make sure your kit is complete.  Checking..." >&4
1174    awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1175    rm -f missing
1176    tmppwd=`pwd`
1177    for filelist in x??; do
1178        (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1179    done
1180    if test -s missing; then
1181        cat missing >&4
1182        cat >&4 <<'EOM'
1183
1184THIS PACKAGE SEEMS TO BE INCOMPLETE.
1185
1186You have the option of continuing the configuration process, despite the
1187distinct possibility that your kit is damaged, by typing 'y'es.  If you
1188do, don't blame me if something goes wrong.  I advise you to type 'n'o
1189and contact the author (dunemush@pennmush.org).
1190
1191EOM
1192        echo $n "Continue? [n] $c" >&4
1193        read ans
1194        case "$ans" in
1195        y*)
1196            echo "Continuing..." >&4
1197            rm -f missing
1198            ;;
1199        *)
1200            echo "ABORTING..." >&4
1201            kill $$
1202            ;;
1203        esac
1204    else
1205        echo "Looks good..."
1206    fi
1207else
1208    echo "There is no MANIFEST file.  I hope your kit is complete !"
1209fi
1210rm -f missing x??
1211
1212: create .config dir to save info across Configure sessions
1213test -d ../.config || mkdir ../.config
1214cat >../.config/README <<EOF
1215This directory created by Configure to save information that should
1216persist across sessions for $package.
1217
1218You may safely delete it if you wish.
1219EOF
1220
1221: general instructions
1222needman=true
1223firsttime=true
1224user=`(logname) 2>/dev/null`
1225case "$user" in
1226'') user=`whoami 2>&1`;;
1227esac
1228if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1229    firsttime=false
1230    echo " "
1231    rp='Would you like to see the instructions?'
1232    dflt=n
1233    . ./myread
1234    case "$ans" in
1235    [yY]*) ;;
1236    *) needman=false;;
1237    esac
1238fi
1239if $needman; then
1240    cat <<EOH
1241 
1242This installation shell script will examine your system and ask you questions
1243to determine how the pennmush package should be installed. If you get
1244stuck on a question, you may use a ! shell escape to start a subshell or
1245execute a command.  Many of the questions will have default answers in square
1246brackets; typing carriage return will give you the default.
1247
1248On some of the questions which ask for file or directory names you are allowed
1249to use the ~name construct to specify the login directory belonging to "name",
1250even if you don't have a shell which knows about that.  Questions where this is
1251allowed will be marked "(~name ok)".
1252
1253EOH
1254    rp=''
1255    dflt='Type carriage return to continue'
1256    . ./myread
1257    cat <<'EOH'
1258
1259The prompter used in this script allows you to use shell variables and
1260backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1261in the default answer, as if the default line was a set of arguments given to a
1262script shell.  This means you may also use $* to repeat the whole default line,
1263so you do not have to re-type everything to add something to the default.
1264
1265Everytime there is a substitution, you will have to confirm.  If there is an
1266error (e.g. an unmatched backtick), the default answer will remain unchanged
1267and you will be prompted again.
1268
1269If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1270the questions and use the computed defaults (or the previous answers if there
1271was already a config.sh file). Type 'Configure -h' for a list of options.
1272You may also start interactively and then answer '& -d' at any prompt to turn
1273on the non-interactive behaviour for the remaining of the execution.
1274
1275EOH
1276    . ./myread
1277    cat <<EOH
1278
1279Much effort has been expended to ensure that this shell script will run on any
1280Unix system.  If despite that it blows up on yours, your best bet is to edit
1281Configure and run it again.  If you can't run Configure for some reason,
1282you'll have to generate a config.sh file by hand.  Whatever problems you
1283have, let me (dunemush@pennmush.org) know how I blew it.
1284
1285This installation script affects things in two ways:
1286
12871) it may do direct variable substitutions on some of the files included
1288   in this kit.
12892) it builds a config.h file for inclusion in C programs.  You may edit
1290   any of these files as the need arises after running this script.
1291
1292If you make a mistake on a question, there is no easy way to back up to it
1293currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1294files.  Configure will offer to let you do this before it runs the SH files.
1295
1296EOH
1297    dflt='Type carriage return to continue'
1298    . ./myread
1299    case "$firsttime" in
1300    true) echo $user >>../.config/instruct;;
1301    esac
1302fi
1303
1304: find out where common programs are
1305echo " "
1306echo "Locating common programs..." >&4
1307cat <<EOSC >loc
1308$startsh
1309case \$# in
13100) exit 1;;
1311esac
1312thing=\$1
1313shift
1314dflt=\$1
1315shift
1316for dir in \$*; do
1317    case "\$thing" in
1318    .)
1319    if test -d \$dir/\$thing; then
1320        echo \$dir
1321        exit 0
1322    fi
1323    ;;
1324    *)
1325    for thisthing in \$dir/\$thing; do
1326        : just loop through to pick last item
1327    done
1328    if test -f \$thisthing; then
1329        echo \$thisthing
1330        exit 0
1331    elif test -f \$dir/\$thing.exe; then
1332        : on Eunice apparently
1333        echo \$dir/\$thing
1334        exit 0
1335    fi
1336    ;;
1337    esac
1338done
1339echo \$dflt
1340exit 1
1341EOSC
1342chmod +x loc
1343$eunicefix loc
1344loclist="
1345awk
1346cat
1347chmod
1348comm
1349cp
1350echo
1351expr
1352grep
1353make
1354mkdir
1355rm
1356sed
1357sort
1358touch
1359tr
1360uniq
1361"
1362trylist="
1363Mcc
1364cpp
1365date
1366ln
1367mail
1368perl
1369rmail
1370sendmail
1371smail
1372test
1373uname
1374uptime
1375"
1376pth=`echo $PATH | sed -e "s/$p_/ /g"`
1377pth="$pth /lib /usr/lib"
1378for file in $loclist; do
1379    eval xxx=\$$file
1380    case "$xxx" in
1381    /*|?:[\\/]*)
1382        if test -f "$xxx"; then
1383            : ok
1384        else
1385            echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1386            xxx=`./loc $file $file $pth`
1387        fi
1388        ;;
1389    '') xxx=`./loc $file $file $pth`;;
1390    *) xxx=`./loc $xxx $xxx $pth`;;
1391    esac
1392    eval $file=$xxx
1393    eval _$file=$xxx
1394    case "$xxx" in
1395    /*)
1396        echo $file is in $xxx.
1397        ;;
1398    ?:[\\/]*)
1399        echo $file is in $xxx.
1400        ;;
1401    *)
1402        echo "I don't know where '$file' is, and my life depends on it." >&4
1403        echo "Go find a public domain implementation or fix your PATH setting!" >&4
1404        exit 1
1405        ;;
1406    esac
1407done
1408echo " "
1409echo "Don't worry if any of the following aren't found..."
1410say=offhand
1411for file in $trylist; do
1412    eval xxx=\$$file
1413    case "$xxx" in
1414    /*|?:[\\/]*)
1415        if test -f "$xxx"; then
1416            : ok
1417        else
1418            echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1419            xxx=`./loc $file $file $pth`
1420        fi
1421        ;;
1422    '') xxx=`./loc $file $file $pth`;;
1423    *) xxx=`./loc $xxx $xxx $pth`;;
1424    esac
1425    eval $file=$xxx
1426    eval _$file=$xxx
1427    case "$xxx" in
1428    /*)
1429        echo $file is in $xxx.
1430        ;;
1431    ?:[\\/]*)
1432        echo $file is in $xxx.
1433        ;;
1434    *)
1435        echo "I don't see $file out there, $say."
1436        say=either
1437        ;;
1438    esac
1439done
1440case "$egrep" in
1441egrep)
1442    echo "Substituting grep for egrep."
1443    egrep=$grep
1444    ;;
1445esac
1446case "$ln" in
1447ln)
1448    echo "Substituting cp for ln."
1449    ln=$cp
1450    ;;
1451esac
1452case "$test" in
1453test)
1454    echo "Hopefully test is built into your sh."
1455    ;;
1456*)
1457    if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1458        echo "Using the test built into your sh."
1459        test=test
1460        _test=test
1461    fi
1462    ;;
1463esac
1464case "$echo" in
1465echo)
1466    echo "Hopefully echo is built into your sh."
1467    ;;
1468'') ;;
1469*)
1470    echo " "
1471echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1472    $echo $n "hi there$c" >foo1
1473    echo $n "hi there$c" >foo2
1474    if cmp foo1 foo2 >/dev/null 2>&1; then
1475        echo "They are compatible.  In fact, they may be identical."
1476    else
1477        case "$n" in
1478        '-n') n='' c='\c';;
1479        *) n='-n' c='';;
1480        esac
1481        cat <<FOO
1482They are not compatible!  You are probably running ksh on a non-USG syst