perl 3.0 patch #16 (combined patch)
[p5sagit/p5-mst-13.2.git] / Configure
index c3c65ea..1fe5fe3 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -8,14 +8,23 @@
 # and edit it to reflect your system.  Some packages may include samples
 # of config.h for certain machines, so you might look for one of those.)
 #
-# $Header: Configure,v 3.0 89/10/18 15:04:55 lwall Locked $
+# $Header: Configure,v 3.0.1.7 90/03/28 09:14:53 lwall Locked $
+
+: make sure these files are renamed
+test -f config_h.SH || mv -f config.h.SH config_h.SH
+test -f perl_man.1 || mv -f perl.man.1 perl_man.1
+test -f perl_man.2 || mv -f perl.man.2 perl_man.2
+test -f perl_man.3 || mv -f perl.man.3 perl_man.3
+test -f perl_man.4 || mv -f perl.man.4 perl_man.4
+test -f t/op.s || mv -f t/op.subst t/op.s
+
 #
 # Yes, you may rip this off to use in other distribution packages.
 # (Note: this Configure script was generated automatically.  Rather than
 # working with this copy of Configure, you may wish to get metaconfig.)
 
 : sanity checks
-PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin'
+PATH=".:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:$PATH"
 export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
 
 if test ! -t 0; then
@@ -39,8 +48,8 @@ case "$1" in
 esac
 
 d_eunice=''
-eunicefix=''
 define=''
+eunicefix=''
 loclist=''
 expr=''
 sed=''
@@ -91,6 +100,7 @@ lp=''
 touch=''
 make=''
 date=''
+csh=''
 Log=''
 Header=''
 bin=''
@@ -100,9 +110,12 @@ cppstdin=''
 cppminus=''
 d_bcmp=''
 d_bcopy=''
+d_bzero=''
+d_castneg=''
 d_charsprf=''
 d_crypt=''
 cryptlib=''
+d_csh=''
 d_dosuid=''
 d_dup2=''
 d_fchmod=''
@@ -112,11 +125,13 @@ d_flock=''
 d_getgrps=''
 d_gethent=''
 d_getpgrp=''
+d_getpgrp2=''
 d_getprior=''
 d_htonl=''
 d_index=''
 d_ioctl=''
 d_killpg=''
+d_lstat=''
 d_memcmp=''
 d_memcpy=''
 d_mkdir=''
@@ -128,6 +143,7 @@ d_rmdir=''
 d_setegid=''
 d_seteuid=''
 d_setpgrp=''
+d_setpgrp2=''
 d_setprior=''
 d_setregid=''
 d_setresgid=''
@@ -139,36 +155,42 @@ d_socket=''
 d_sockpair=''
 d_oldsock=''
 socketlib=''
-sockethdr=''
 d_statblks=''
 d_stdstdio=''
 d_strctcpy=''
+d_strerror=''
 d_symlink=''
 d_syscall=''
-d_tminsys=''
-i_systime=''
 d_varargs=''
 d_vfork=''
 d_voidsig=''
+d_volatile=''
 d_vprintf=''
 d_charvspr=''
+d_wait4=''
 gidtype=''
 i_dirent=''
 d_dirnamlen=''
 i_fcntl=''
 i_grp=''
+i_niin=''
 i_pwd=''
 d_pwquota=''
 d_pwage=''
+d_pwchange=''
+d_pwclass=''
+d_pwexpire=''
 i_sysdir=''
 i_sysioctl=''
+i_sysndir=''
+i_time=''
+i_systime=''
+d_systimekernel=''
+i_utime=''
 i_varargs=''
 i_vfork=''
 intsize=''
 libc=''
-libdbm=''
-libndir=''
-libnm=''
 mallocsrc=''
 mallocobj=''
 usemymalloc=''
@@ -182,6 +204,7 @@ large=''
 huge=''
 optimize=''
 ccflags=''
+cppflags=''
 ldflags=''
 cc=''
 libs=''
@@ -198,8 +221,9 @@ stdchar=''
 uidtype=''
 voidflags=''
 defvoidused=''
-lib=''
+yacc=''
 privlib=''
+lib=''
 CONFIG=''
 : set package name
 package=perl
@@ -211,7 +235,9 @@ echo " "
 
 define='define'
 undef='undef'
-libpth='/usr/lib /usr/local/lib /usr/lib/386 /usr/lib/large /lib /lib/386 /lib/large /usr/lib/small /lib/small'
+: change the next line if compiling for Xenix/286 on Xenix/386
+xlibpth='/usr/lib/386 /lib/386'
+libpth='/usr/lib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
 rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
 trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
@@ -229,7 +255,7 @@ fi
 
 echo "First let's make sure your kit is complete.  Checking..."
 (cd ..; awk '' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$)
-echo " "
+echo "Looks good..."
 
 attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
 attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
@@ -237,11 +263,12 @@ attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
 attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
 attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
 attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
-attrlist="$attrlist i186"
+attrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__"
 pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb"
 d_newshome="/usr/NeWS"
 defvoidused=7
-
+libswanted="net_s net nsl_s nsl socket nm ndir ndbm dbm sun bsd BSD x c_s"
+inclwanted='/usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan'
 : some greps do not return status, grrr.
 echo "grimblepritz" >grimble
 if grep blurfldyick grimble >/dev/null 2>&1 ; then
@@ -263,6 +290,66 @@ EOSS
 chmod +x contains
 esac
 
+: see if sh knows # comments
+echo " "
+echo "Checking your sh to see if it knows about # comments..."
+if sh -c '#' >/dev/null 2>&1 ; then
+    echo "Your sh handles # comments correctly."
+    shsharp=true
+    spitshell=cat
+    echo " "
+    echo "Okay, let's see if #! works on this system..."
+    echo "#!/bin/echo hi" > try
+    $eunicefix try
+    chmod +x try
+    ./try > today
+    if $contains hi today >/dev/null 2>&1; then
+       echo "It does."
+       sharpbang='#!'
+    else
+       echo "#! /bin/echo hi" > try
+       $eunicefix try
+       chmod +x try
+       ./try > today
+       if test -s today; then
+           echo "It does."
+           sharpbang='#! '
+       else
+           echo "It doesn't."
+           sharpbang=': use '
+       fi
+    fi
+else
+    echo "Your sh doesn't grok # comments--I will strip them later on."
+    shsharp=false
+    echo "exec grep -v '^#'" >spitshell
+    chmod +x spitshell
+    $eunicefix spitshell
+    spitshell=`pwd`/spitshell
+    echo "I presume that if # doesn't work, #! won't work either!"
+    sharpbang=': use '
+fi
+
+: figure out how to guarantee sh startup
+echo " "
+echo "Checking out how to guarantee sh startup..."
+startsh=$sharpbang'/bin/sh'
+echo "Let's see if '$startsh' works..."
+cat >try <<EOSS
+$startsh
+set abc
+test "$?abc" != 1
+EOSS
+
+chmod +x try
+$eunicefix try
+if ./try; then
+    echo "Yup, it does."
+else
+    echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
+fi
+rm -f try today
+
 : first determine how to suppress newline on echo command
 echo "Checking echo to see how to suppress newlines..."
 (echo "hi there\c" ; echo " ") >.echotmp
@@ -422,9 +509,9 @@ uniq
 trylist="
 Mcc
 cpp
+csh
 egrep
 test
-uname
 "
 for file in $loclist; do
     xxx=`loc $file $file $pth`
@@ -512,227 +599,6 @@ FOO
 esac
 rmlist="$rmlist loc"
 
-: get list of predefined functions in a handy place
-if $test -n "$uname"; then
-       os=`$uname -s`
-else
-       os=unknown
-fi
-echo " "
-if test -f /lib/libc.a; then
-    echo "Your C library is in /lib/libc.a.  You're normal."
-    libc=/lib/libc.a
-else
-    if test "$os" = DomainOS ; then
-       ans=`loc libc blurfl/dyick $libpth`
-    else
-       ans=`loc libc.a blurfl/dyick $libpth`
-    fi
-    if test ! -f "$ans"; then
-       ans=`loc clib blurfl/dyick $libpth`
-    fi
-    if test ! -f "$ans"; then
-       ans=`loc libc blurfl/dyick $libpth`
-    fi
-    if test ! -f "$ans"; then
-       ans=`loc Slibc.a blurfl/dyick /usr/lib/386 /lib/386 $libpth`
-    fi
-    if test ! -f "$ans"; then
-       ans=`loc Mlibc.a blurfl/dyick $libpth`
-    fi
-    if test ! -f "$ans"; then
-       ans=`loc Llibc.a blurfl/dyick $libpth`
-    fi
-    if test -f "$ans"; then
-       echo "Your C library is in $ans, of all places."
-       libc=$ans
-    else
-       if test -f "$libc"; then
-           echo "Your C library is in $libc, like you said before."
-       else
-           cat <<EOM
-I can't seem to find your C library.  I've looked in the following places:
-
-       $libpth
-
-None of these seems to contain your C library.  What is the full name
-EOM
-           dflt=None
-           $echo $n "of your C library? $c"
-           rp='C library full name?'
-           . myread
-           libc="$ans"
-       fi
-    fi
-fi
-echo " "
-$echo $n "Extracting names from $libc for later perusal...$c"
-nm $libc 2>/dev/null >libc.tmp
-$sed -n -e 's/^.* [AT]  *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
-if $contains '^printf$' libc.list >/dev/null 2>&1; then
-    echo "done"
-else
-    if test "$os" = DomainOS ; then
-        $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
-    else
-       $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list
-    fi
-    $contains '^printf$' libc.list >/dev/null 2>&1 || \
-       $sed -n -e 's/^_//' \
-             -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
-    if $contains '^printf$' libc.list >/dev/null 2>&1; then
-       echo "done"
-    else
-       echo " "
-       echo "nm didn't seem to work right."
-       echo "Trying ar instead..."
-       if ar t $libc > libc.tmp; then
-           $sed -e 's/\.o$//' < libc.tmp > libc.list
-           echo "Ok."
-       else
-           echo "ar didn't seem to work right."
-           echo "Maybe this is a Cray...trying bld instead..."
-           if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
-               echo "Ok."
-           else
-               echo "That didn't work either.  Giving up."
-               exit 1
-           fi
-       fi
-    fi
-fi
-
-inlibc='echo " ";
-if $contains "^$1\$" libc.list >/dev/null 2>&1;
-then echo "$1() found"; eval "$2=$define";
-else echo "$1() not found"; eval "$2=$undef"; fi'
-
-rmlist="$rmlist libc.tmp libc.list"
-
-: make some quick guesses about what we are up against
-echo " "
-$echo $n "Hmm...  $c"
-cat /usr/include/signal.h /usr/include/sys/signal.h >foo
-if $contains SIGTSTP foo >/dev/null 2>&1 ; then
-    echo "Looks kind of like a BSD system, but we'll see..."
-    echo exit 0 >bsd
-    echo exit 1 >usg
-    echo exit 1 >v7
-elif $contains '^fcntl$' libc.list >/dev/null 2>&1 ; then
-    echo "Looks kind of like a USG system, but we'll see..."
-    echo exit 1 >bsd
-    echo exit 0 >usg
-    echo exit 1 >v7
-else
-    echo "Looks kind of like a version 7 system, but we'll see..."
-    echo exit 1 >bsd
-    echo exit 1 >usg
-    echo exit 0 >v7
-fi
-if $contains '^vmssystem$' libc.list >/dev/null 2>&1 ; then
-    cat <<'EOI'
-There is, however, a strange, musty smell in the air that reminds me of
-something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
-EOI
-    echo "exit 0" >eunice
-    eunicefix=unixtovms
-    d_eunice="$define"
-: it so happens the Eunice I know will not run shell scripts in Unix format
-else
-    echo " "
-    echo "Congratulations.  You aren't running Eunice."
-    eunicefix=':'
-    d_eunice="$undef"
-    echo "exit 1" >eunice
-fi
-if test -f /xenix; then
-    echo "Actually, this looks more like a XENIX system..."
-    echo "exit 0" >xenix
-else
-    echo " "
-    echo "It's not Xenix..."
-    echo "exit 1" >xenix
-fi
-chmod +x xenix
-$eunicefix xenix
-if test -f /venix; then
-    echo "Actually, this looks more like a VENIX system..."
-    echo "exit 0" >venix
-else
-    echo " "
-    if xenix; then
-       : null
-    else
-       echo "Nor is it Venix..."
-    fi
-    echo "exit 1" >venix
-fi
-chmod +x bsd usg v7 eunice venix
-$eunicefix bsd usg v7 eunice venix
-rm -rf foo
-rmlist="$rmlist bsd usg v7 eunice venix xenix"
-
-: see if sh knows # comments
-echo " "
-echo "Checking your sh to see if it knows about # comments..."
-if sh -c '#' >/dev/null 2>&1 ; then
-    echo "Your sh handles # comments correctly."
-    shsharp=true
-    spitshell=cat
-    echo " "
-    echo "Okay, let's see if #! works on this system..."
-    echo "#!/bin/echo hi" > try
-    $eunicefix try
-    chmod +x try
-    try > today
-    if $contains hi today >/dev/null 2>&1; then
-       echo "It does."
-       sharpbang='#!'
-    else
-       echo "#! /bin/echo hi" > try
-       $eunicefix try
-       chmod +x try
-       try > today
-       if test -s today; then
-           echo "It does."
-           sharpbang='#! '
-       else
-           echo "It doesn't."
-           sharpbang=': use '
-       fi
-    fi
-else
-    echo "Your sh doesn't grok # comments--I will strip them later on."
-    shsharp=false
-    echo "exec grep -v '^#'" >spitshell
-    chmod +x spitshell
-    $eunicefix spitshell
-    spitshell=`pwd`/spitshell
-    echo "I presume that if # doesn't work, #! won't work either!"
-    sharpbang=': use '
-fi
-
-: figure out how to guarantee sh startup
-echo " "
-echo "Checking out how to guarantee sh startup..."
-startsh=$sharpbang'/bin/sh'
-echo "Let's see if '$startsh' works..."
-cat >try <<EOSS
-$startsh
-set abc
-test "$?abc" != 1
-EOSS
-
-chmod +x try
-$eunicefix try
-if try; then
-    echo "Yup, it does."
-else
-    echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
-fi
-rm -f try today
-
 : set up shell script to do ~ expansion
 cat >filexp <<EOSS
 $startsh
@@ -782,11 +648,11 @@ esac
 cont=true
 while $test "$cont" ; do
     echo " "
-    rp="Where do you want to put the public executables? [$dflt]"
+    rp="Where do you want to put the public executables? (~name ok) [$dflt]"
     $echo $n "$rp $c"
     . myread
     bin="$ans"
-    bin=`filexp $bin`
+    bin=`./filexp "$bin"`
     if test -d $bin; then
        cont=''
     else
@@ -819,10 +685,10 @@ esac
 cont=true
 while $test "$cont" ; do
     echo " "
-    rp="Where do the manual pages (source) go? [$dflt]"
+    rp="Where do the manual pages (source) go? (~name ok) [$dflt]"
     $echo $n "$rp $c"
     . myread
-    mansrc=`filexp "$ans"`
+    mansrc=`./filexp "$ans"`
     if $test -d "$mansrc"; then
        cont=''
     else
@@ -851,7 +717,7 @@ case "$mansrc" in
     manext=l
     ;;
 *p)
-    manext=n
+    manext=p
     ;;
 *C)
     manext=C
@@ -864,6 +730,69 @@ case "$mansrc" in
     ;;
 esac
 
+: make some quick guesses about what we are up against
+echo " "
+$echo $n "Hmm...  $c"
+cat /usr/include/signal.h /usr/include/sys/signal.h >foo
+if test `echo abc | tr a-z A-Z` = Abc ; then
+    echo "Looks kind of like a USG system, but we'll see..."
+    echo exit 1 >bsd
+    echo exit 0 >usg
+    echo exit 1 >v7
+elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
+    echo "Looks kind of like a BSD system, but we'll see..."
+    echo exit 0 >bsd
+    echo exit 1 >usg
+    echo exit 1 >v7
+else
+    echo "Looks kind of like a version 7 system, but we'll see..."
+    echo exit 1 >bsd
+    echo exit 1 >usg
+    echo exit 0 >v7
+fi
+case "$eunicefix" in
+*unixtovms*)
+    cat <<'EOI'
+There is, however, a strange, musty smell in the air that reminds me of
+something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
+EOI
+    echo "exit 0" >eunice
+    d_eunice="$define"
+    ;;
+*)
+    echo " "
+    echo "Congratulations.  You aren't running Eunice."
+    d_eunice="$undef"
+    echo "exit 1" >eunice
+    ;;
+esac
+if test -f /xenix; then
+    echo "Actually, this looks more like a XENIX system..."
+    echo "exit 0" >xenix
+else
+    echo " "
+    echo "It's not Xenix..."
+    echo "exit 1" >xenix
+fi
+chmod +x xenix
+$eunicefix xenix
+if test -f /venix; then
+    echo "Actually, this looks more like a VENIX system..."
+    echo "exit 0" >venix
+else
+    echo " "
+    if xenix; then
+       : null
+    else
+       echo "Nor is it Venix..."
+    fi
+    echo "exit 1" >venix
+fi
+chmod +x bsd usg v7 eunice venix
+$eunicefix bsd usg v7 eunice venix
+rm -rf foo
+rmlist="$rmlist bsd usg v7 eunice venix xenix"
+
 : see what memory models we can support
 case "$models" in
 '')
@@ -1084,6 +1013,7 @@ case "$optimize" in
     ;;
 esac
 cat <<EOH
+
 Some C compilers have problems with their optimizers, by default, $package
 compiles with the -O flag to use the optimizer.  Alternately, you might
 want to use the symbolic debugger, which uses the -g flag (on traditional
@@ -1102,13 +1032,45 @@ esac
 
 case "$ccflags" in
 '') case "$cc" in
-    gcc) dflt='-fpcc_struct_return';;
-    *) dflt='none';;
+    *gcc*) dflt='-fpcc-struct-return';;
+    *) dflt='';;
     esac
     ;;
 *) dflt="$ccflags";;
 esac
-echo " "
+for thisincl in $inclwanted; do
+    if test -d $thisincl; then
+       case "$dflt" in
+       *$thisincl*);;
+       *) dflt="$dflt -I$thisincl";;
+       esac
+    fi
+done
+case "$optimize" in
+-g*)
+    case "$dflt" in
+    *DEBUGGING*);;
+    *) dflt="$dflt -DDEBUGGING";;
+    esac
+    ;;
+esac
+if $contains 'LANGUAGE_C' /usr/include/signal.h >/dev/null 2>&1; then
+    case "$dflt" in
+    *LANGUAGE_C*);;
+    *) dflt="$dflt -DLANGUAGE_C";;
+    esac
+fi
+case "$dflt" in
+'') dflt=none;;
+esac
+cat <<EOH
+
+Your C compiler may want other flags.  For this question you should
+include -I/whatever and -DWHATEVER flags and any other flags used by
+the C compiler, but you should NOT include libraries or ld flags like
+-lwhatever.  To use no flags, specify the word "none".
+  
+EOH
 rp="Any additional cc flags? [$dflt]"
 $echo $n "$rp $c"
 . myread
@@ -1117,6 +1079,26 @@ none) ans='';
 esac
 ccflags="$ans"
 
+: the following weeds options from ccflags that are of no interest to cpp
+cppflags="$ccflags"
+case "$cc" in
+*gcc*) cppflags="$cppflags -D__GNUC__";;
+esac
+case "$cppflags" in
+'');;
+*)  set X $cppflags
+    cppflags=''
+    for flag do
+       case $flag in
+       -D*|-I*) cppflags="$cppflags $flag";;
+       esac
+    done
+    case "$cppflags" in
+    *-*)  echo "(C preprocessor flags: $cppflags)";;
+    esac
+    ;;
+esac
+
 case "$ldflags" in
 '') if venix; then
        dflt='-i -z'
@@ -1136,10 +1118,58 @@ esac
 ldflags="$ans"
 rmlist="$rmlist pdp11"
 
+echo " "
+echo "Checking for optional libraries..."
+dflt=''
+case "$libswanted" in
+'') libswanted='c_s';;
+esac
+for thislib in $libswanted; do
+    case "$thislib" in
+    dbm) thatlib=ndbm;;
+    *_s) thatlib=NONE;;
+    *) thatlib="${thislib}_s";;
+    *) thatlib=NONE;;
+    esac
+    xxx=`loc lib$thislib.a X /usr/lib /usr/local/lib /lib`
+    if test -f $xxx; then
+       echo "Found -l$thislib."
+       case "$dflt" in
+       *-l$thislib*|*-l$thatlib*);;
+       *) dflt="$dflt -l$thislib";;
+       esac
+    else
+       xxx=`loc lib$thislib.a X $libpth`
+       if test -f $xxx; then
+           echo "Found $xxx."
+           case "$dflt" in
+           *$xxx*);;
+           *) dflt="$dflt $xxx";;
+           esac
+       else
+           xxx=`loc Slib$thislib.a X $xlibpth`
+           if test -f $xxx; then
+               echo "Found -l$thislib."
+               case "$dflt" in
+               *-l$thislib*|*-l$thatlib*);;
+               *) dflt="$dflt -l$thislib";;
+               esac
+           else
+               echo "No -l$thislib."
+           fi
+       fi
+    fi
+done
+set X $dflt
+shift
+dflt="$*"
 case "$libs" in
-'') dflt='none';;
+'') dflt="$dflt";;
 *) dflt="$libs";;
 esac
+case "$dflt" in
+'') dflt='none';;
+esac
 
 $cat <<EOM
  
@@ -1152,6 +1182,7 @@ cc command line when linking.  Other systems use shared libraries
 by default.  There may be other libraries needed to compile $package
 on your machine as well.  If your system needs the "-lc_s" option,
 include it here.  Include any other special libraries here as well.
+Say "none" for none.
 EOM
 
 echo " "
@@ -1171,8 +1202,9 @@ cat <<'EOM'
 In the following, larger digits indicate more significance.  A big-endian
 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321.  A
 little-endian machine like a Vax or an Intel 80?86 chip would be 1234.  Other
-machines may have weird orders like 3412.  If the test program works the
-default is probably right.  I'm now running the test program...
+machines may have weird orders like 3412.  A Cray will report 87654321.  If
+the test program works the default is probably right.
+I'm now running the test program...
 EOM
     $cat >try.c <<'EOCP'
 #include <stdio.h>
@@ -1181,17 +1213,22 @@ main()
     int i;
     union {
        unsigned long l;
-       char c[4];
+       char c[sizeof(long)];
     } u;
 
-    u.l = 0x04030201;
-    printf("%c%c%c%c\n", u.c[0]+'0', u.c[1]+'0', u.c[2]+'0', u.c[3]+'0');
+    if (sizeof(long) > 4)
+       u.l = (0x08070605<<32) | 0x04030201;
+    else
+       u.l = 0x04030201;
+    for (i=0; i < sizeof(long); i++)
+       printf("%c",u.c[i]+'0');
+    printf("\n");
 }
 EOCP
-    if $cc try.c -o try >/dev/null 2>&1 ; then
-       dflt=`try`
+    if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
+       dflt=`./try`
        case "$dflt" in
-       ????) echo "(The test program ran ok.)";;
+       ????|????????) echo "(The test program ran ok.)";;
        *) echo "(The test program didn't run right for some reason.)";;
        esac
     else
@@ -1220,6 +1257,23 @@ ABC.XYZ
 EOT
 echo 'Maybe "'"$cc"' -E" will work...'
 $cc -E <testcpp.c >testcpp.out 2>&1
+: try to force gcc preprocessor if that is the compiler they are using
+case $? in
+0) cppstdin="$cc -E";;
+*) case "$cc" in
+    *gcc*)
+       cd ..
+       echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
+       echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
+       chmod 755 cppstdin
+       cppstdin=`pwd`/cppstdin
+       cppminus='';
+       cd UU
+       $cppstdin <testcpp.c >testcpp.out 2>&1
+       ;;
+    esac
+    ;;
+esac
 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
     echo "Yup, it does."
     cppstdin="$cc -E"
@@ -1302,6 +1356,144 @@ else
 fi
 rm -f testcpp.c testcpp.out
 
+: get list of predefined functions in a handy place
+echo " "
+case "$libc" in
+'') libc=unknown;;
+esac
+case "$libpth" in
+'') libpth='/lib /usr/lib /usr/local/lib';;
+esac
+case "$libs" in
+*-lc_s*) libc=`loc libc_s.a $libc $libpth`
+esac
+libnames='';
+case "$libs" in
+'') ;;
+*)  for thislib in $libs; do
+       case "$thislib" in
+       -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
+           try=`loc lib$thislib.a blurfl/dyick $libpth`
+           if test ! -f $try; then
+               try=`loc lib$thislib blurfl/dyick $libpth`
+               if test ! -f $try; then
+                   try=`loc $thislib blurfl/dyick $libpth`
+                   if test ! -f $try; then
+                       try=`loc Slib$thislib.a blurfl/dyick $xlibpth`
+                       if test ! -f $try; then
+                           try=''
+                       fi
+                   fi
+               fi
+           fi
+           libnames="$libnames $try"
+           ;;
+       *) libnames="$libnames $thislib" ;;
+       esac
+    done
+    ;;
+esac
+set /usr/lib/libc.so.[0-9]*
+eval set \$$#
+if test -f "$1"; then
+    echo "Your shared C library is in $1."
+    libc="$1"
+elif test -f $libc; then
+    echo "Your C library is in $libc, like you said before."
+elif test -f /lib/libc.a; then
+    echo "Your C library is in /lib/libc.a.  You're normal."
+    libc=/lib/libc.a
+else
+    ans=`loc libc.a blurfl/dyick $libpth`
+    if test ! -f "$ans"; then
+       ans=`loc libc blurfl/dyick $libpth`
+    fi
+    if test ! -f "$ans"; then
+       ans=`loc clib blurfl/dyick $libpth`
+    fi
+    if test ! -f "$ans"; then
+       ans=`loc Slibc.a blurfl/dyick $xlibpth`
+    fi
+    if test ! -f "$ans"; then
+       ans=`loc Mlibc.a blurfl/dyick $xlibpth`
+    fi
+    if test ! -f "$ans"; then
+       ans=`loc Llibc.a blurfl/dyick $xlibpth`
+    fi
+    if test -f "$ans"; then
+       echo "Your C library is in $ans, of all places."
+       libc=$ans
+    else
+       cat <<EOM
+I can't seem to find your C library.  I've looked in the following places:
+
+       $libpth
+
+None of these seems to contain your C library.  What is the full name
+EOM
+       dflt=None
+       $echo $n "of your C library? $c"
+       rp='C library full name?'
+       . myread
+       libc="$ans"
+    fi
+fi
+echo " "
+set `echo $libc $libnames | tr ' ' '\012' | sort | uniq`
+$echo $n "Extracting names from $* for later perusal...$c"
+nm $* 2>/dev/null >libc.tmp
+$sed -n -e 's/^.* [AT]  *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
+if $contains '^printf$' libc.list >/dev/null 2>&1; then
+    echo "done"
+else
+    $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
+    $contains '^printf$' libc.list >/dev/null 2>&1 || \
+       $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list
+    $contains '^printf$' libc.list >/dev/null 2>&1 || \
+       $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list
+    $contains '^printf$' libc.list >/dev/null 2>&1 || \
+       $sed -n -e 's/^_//' \
+             -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
+    $contains '^printf$' libc.list >/dev/null 2>&1 || \
+       $sed -n -e 's/^.*|FUNC |GLOB .*|//p' <libc.tmp >libc.list
+    if $contains '^printf$' libc.list >/dev/null 2>&1; then
+       echo "done"
+    else
+       echo " "
+       echo "nm didn't seem to work right."
+       echo "Trying ar instead..."
+       if ar t $libc > libc.tmp; then
+           for thisname in $libnames; do
+               ar t $thisname >>libc.tmp
+           done
+           $sed -e 's/\.o$//' < libc.tmp > libc.list
+           echo "Ok."
+       else
+           echo "ar didn't seem to work right."
+           echo "Maybe this is a Cray...trying bld instead..."
+           if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
+               for thisname in $libnames; do
+                   bld t $libnames | \
+                       $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
+                   ar t $thisname >>libc.tmp
+               done
+               echo "Ok."
+           else
+               echo "That didn't work either.  Giving up."
+               exit 1
+           fi
+       fi
+    fi
+fi
+
+inlibc='echo " ";
+if $contains "^$1\$" libc.list >/dev/null 2>&1;
+then echo "$1() found"; eval "$2=$define";
+else echo "$1() not found"; eval "$2=$undef"; fi'
+
+rmlist="$rmlist libc.tmp libc.list"
+
 : see if bcmp exists
 set bcmp d_bcmp
 eval $inlibc
@@ -1310,6 +1502,39 @@ eval $inlibc
 set bcopy d_bcopy
 eval $inlibc
 
+: see if bzero exists
+set bzero d_bzero
+eval $inlibc
+
+: check for ability to cast negative floats to unsigned
+echo " "
+echo 'Checking to see if your C compiler can cast negative float to unsigned'
+$cat >try.c <<'EOCP'
+main()
+{
+       double f = -123;
+       unsigned long along;
+       unsigned int aint;
+       unsigned short ashort;
+
+       along = (unsigned long)f;
+       aint = (unsigned int)f;
+       ashort = (unsigned short)f;
+       if (along == 0L || aint == 0 || ashort == 0)
+           exit(1);
+       else
+           exit(0);
+}
+EOCP
+if $cc -o try $ccflags try.c >/dev/null 2>&1 && ./try; then
+    d_castneg="$define"
+    echo "Yup, it does."
+else
+    d_castneg="$undef"
+    echo "Nope, it doesn't."
+fi
+$rm -f try.*
+
 : see if sprintf is declared as int or pointer to char
 echo " "
 cat >.ucbsprf.c <<'EOF'
@@ -1330,6 +1555,7 @@ if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
     echo 'vprintf() found.'
     d_vprintf="$define"
     cat >.ucbsprf.c <<'EOF'
+#include <stdio.h>
 #include <varargs.h>
 
 main() { xxx("foo"); }
@@ -1365,14 +1591,14 @@ if $contains '^crypt$' libc.list >/dev/null 2>&1; then
     d_crypt="$define"
     cryptlib=''
 else
-    cryptlib=`loc Slibcrypt.a "" /lib/386 /lib`
+    cryptlib=`loc Slibcrypt.a "" $xlibpth`
     if $test -z "$cryptlib"; then
-       cryptlib=`loc Mlibcrypt.a "" /lib/386 /lib`
+       cryptlib=`loc Mlibcrypt.a "" $xlibpth`
     else
        cryptlib=-lcrypt
     fi
     if $test -z "$cryptlib"; then
-       cryptlib=`loc Llibcrypt.a "" /lib/386 /lib`
+       cryptlib=`loc Llibcrypt.a "" $xlibpth`
     else
        cryptlib=-lcrypt
     fi
@@ -1389,6 +1615,12 @@ else
     fi
 fi
 
+: get csh whereabouts
+case "$csh" in
+'csh') d_csh="$undef" ;;
+*)     d_csh="$define" ;;
+esac
+
 : see if this is a dirent system
 echo " "
 if $test -r /usr/include/dirent.h ; then
@@ -1401,7 +1633,11 @@ if $test -r /usr/include/dirent.h ; then
     fi
 else
     i_dirent="$undef"
-    d_dirnamlen="$define"
+    if $contains 'd_namlen' /usr/include/sys/dir.h >/dev/null 2>&1; then
+       d_dirnamlen="$define"
+    else
+       d_dirnamlen="$undef"
+    fi
     echo "No dirent.h found."
 fi
 
@@ -1421,7 +1657,7 @@ until a better solution is devised for the kernel problem.
 
 EOM
 rp="Do you want to do setuid/setgid emulation? [$dflt]"
-echo $n "$rp $c"
+$echo $n "$rp $c"
 . myread
 case "$ans" in
 '') $ans="$dflt";;
@@ -1469,6 +1705,10 @@ eval $inlibc
 set getpgrp d_getpgrp
 eval $inlibc
 
+: see if getpgrp2 exists
+set getpgrp2 d_getpgrp2
+eval $inlibc
+
 : see if getpriority exists
 set getpriority d_getprior
 eval $inlibc
@@ -1521,6 +1761,10 @@ fi
 set killpg d_killpg
 eval $inlibc
 
+: see if lstat exists
+set lstat d_lstat
+eval $inlibc
+
 : see if memcmp exists
 set memcmp d_memcmp
 eval $inlibc
@@ -1535,7 +1779,8 @@ eval $inlibc
 
 : see if ndbm is available
 echo " "
-if $test -r /usr/include/ndbm.h || $test -r /usr/local/include/ndbm.h; then
+xxx=`loc ndbm.h x /usr/include /usr/local/include $inclwanted`
+if test -f $xxx; then
     d_ndbm="$define"
     echo "ndbm.h found."
 else
@@ -1545,7 +1790,8 @@ fi
 
 : see if we have the old dbm
 echo " "
-if $test -r /usr/include/dbm.h ; then
+xxx=`loc dbm.h x /usr/include /usr/local/include $inclwanted`
+if test -f $xxx; then
     d_odbm="$define"
     echo "dbm.h found."
 else
@@ -1553,25 +1799,100 @@ else
     echo "dbm.h not found."
 fi
 
-: see if this is an pwd system
+socketlib=''
+: see whether socket exists
+echo " "
+if $contains socket libc.list >/dev/null 2>&1; then
+    echo "Looks like you have Berkeley networking support."
+    d_socket="$define"
+    : now check for advanced features
+    if $contains setsockopt libc.list >/dev/null 2>&1; then
+       d_oldsock="$undef"
+    else
+       echo "...but it uses the old 4.1c interface, rather than 4.2"
+       d_oldsock="$define"
+    fi
+else
+    : hpux, for one, puts all the socket stuff in socklib.o
+    if $contains socklib libc.list >/dev/null 2>&1; then
+       echo "Looks like you have Berkeley networking support."
+       d_socket="$define"
+       : we will have to assume that it supports the 4.2 BSD interface
+       d_oldsock="$undef"
+    else
+       echo "Hmmm...you don't have Berkeley networking in libc.a..."
+       : look for an optional networking library
+       if test -f /usr/lib/libnet.a; then
+           (ar t /usr/lib/libnet.a ||
+               nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
+           if $contains socket libc.list >/dev/null 2>&1; then
+               echo "but the Wollongong group seems to have hacked it in."
+               socketlib="-lnet"
+               d_socket="$define"
+               : now check for advanced features
+               if $contains setsockopt libc.list >/dev/null 2>&1; then
+                   d_oldsock="$undef"
+               else
+                   echo "...using the old 4.1c interface, rather than 4.2"
+                   d_oldsock="$define"
+               fi
+           else
+               echo "or even in libnet.a, which is peculiar."
+               d_socket="$undef"
+               d_oldsock="$undef"
+           fi
+       else
+           echo "or anywhere else I see."
+           d_socket="$undef"
+           d_oldsock="$undef"
+       fi
+    fi
+fi
+if $contains socketpair libc.list >/dev/null 2>&1; then
+    d_sockpair="$define"
+else
+    d_sockpair="$undef"
+fi
+
+: see if this is a pwd system
 echo " "
 if $test -r /usr/include/pwd.h ; then
     i_pwd="$define"
     echo "pwd.h found."
-    if $contains 'pw_quota' /usr/include/pwd.h >/dev/null 2>&1; then
+    $cppstdin $cppflags </usr/include/pwd.h >$$.h
+    if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
        d_pwquota="$define"
     else
        d_pwquota="$undef"
     fi
-    if $contains 'pw_age' /usr/include/pwd.h >/dev/null 2>&1; then
+    if $contains 'pw_age' $$.h >/dev/null 2>&1; then
        d_pwage="$define"
     else
        d_pwage="$undef"
     fi
+    if $contains 'pw_change' $$.h >/dev/null 2>&1; then
+       d_pwchange="$define"
+    else
+       d_pwchange="$undef"
+    fi
+    if $contains 'pw_class' $$.h >/dev/null 2>&1; then
+       d_pwclass="$define"
+    else
+       d_pwclass="$undef"
+    fi
+    if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
+       d_pwexpire="$define"
+    else
+       d_pwexpire="$undef"
+    fi
+    rm -f $$.h
 else
     i_pwd="$undef"
     d_pwquota="$undef"
     d_pwage="$undef"
+    d_pwchange="$undef"
+    d_pwclass="$undef"
+    d_pwexpire="$undef"
     echo "No pwd.h found."
 fi
 
@@ -1599,6 +1920,10 @@ eval $inlibc
 set setpgrp d_setpgrp
 eval $inlibc
 
+: see if setpgrp2 exists
+set setpgrp2 d_setpgrp2
+eval $inlibc
+
 : see if setpriority exists
 set setpriority d_setprior
 eval $inlibc
@@ -1623,63 +1948,6 @@ eval $inlibc
 set setruid d_setruid
 eval $inlibc
 
-socketlib=''
-sockethdr=''
-: see whether socket exists
-echo " "
-if $contains socket libc.list >/dev/null 2>&1; then
-    echo "Looks like you have Berkeley networking support."
-    d_socket="$define"
-    : now check for advanced features
-    if $contains setsockopt libc.list >/dev/null 2>&1; then
-       d_oldsock="$undef"
-    else
-       echo "...but it uses the old 4.1c interface, rather than 4.2"
-       d_oldsock="$define"
-    fi
-else
-    : hpux, for one, puts all the socket stuff in socklib.o
-    if $contains socklib libc.list >/dev/null 2>&1; then
-       echo "Looks like you have Berkeley networking support."
-       d_socket="$define"
-       : we will have to assume that it supports the 4.2 BSD interface
-       d_oldsock="$undef"
-    else
-       echo "Hmmm...you don't have Berkeley networking in libc.a..."
-       : look for an optional networking library
-       if test -f /usr/lib/libnet.a; then
-           (ar t /usr/lib/libnet.a ||
-               nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
-           if $contains socket libc.list >/dev/null 2>&1; then
-               echo "but the Wollongong group seems to have hacked it in."
-               socketlib="-lnet"
-               sockethdr="-I/usr/netinclude"
-               d_socket="$define"
-               : now check for advanced features
-               if $contains setsockopt libc.list >/dev/null 2>&1; then
-                   d_oldsock="$undef"
-               else
-                   echo "...using the old 4.1c interface, rather than 4.2"
-                   d_oldsock="$define"
-               fi
-           else
-               echo "or even in libnet.a, which is peculiar."
-               d_socket="$undef"
-               d_oldsock="$undef"
-           fi
-       else
-           echo "or anywhere else I see."
-           d_socket="$undef"
-           d_oldsock="$undef"
-       fi
-    fi
-fi
-if $contains socketpair libc.list >/dev/null 2>&1; then
-    d_sockpair="$define"
-else
-    d_sockpair="$undef"
-fi
-
 : see if stat knows about block sizes
 echo " "
 if $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
@@ -1697,7 +1965,7 @@ fi
 
 : see if stdio is really std
 echo " "
-if $contains 'char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
+if $contains 'char.*_ptr.*;' /usr/include/stdio.h >/dev/null 2>&1 ; then
     if $contains '_cnt;' /usr/include/stdio.h >/dev/null 2>&1 ; then
        echo "Your stdio is pretty std."
        d_stdstdio="$define"
@@ -1723,7 +1991,7 @@ main()
        foo = bar;
 }
 EOCP
-if $cc -c try.c >/dev/null 2>&1 ; then
+if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
     d_strctcpy="$define"
     echo "Yup, it can."
 else
@@ -1732,6 +2000,10 @@ else
 fi
 $rm -f try.*
 
+: see if strerror exists
+set strerror d_strerror
+eval $inlibc
+
 : see if symlink exists
 set symlink d_symlink
 eval $inlibc
@@ -1740,21 +2012,71 @@ eval $inlibc
 set syscall d_syscall
 eval $inlibc
 
-: see if struct tm is defined in sys/time.h
-echo " "
-if $contains 'struct tm' /usr/include/time.h >/dev/null 2>&1 ; then
-    echo "You have struct tm defined in <time.h> rather than <sys/time.h>."
-    d_tminsys="$undef"
-    if test -f /usr/include/sys/time.h; then
-       i_systime="$define"
-    else
-       i_systime="$undef"
-    fi
-else
-    echo "You have struct tm defined in <sys/time.h> rather than <time.h>."
-    d_tminsys="$define"
-    i_systime="$define"
-fi
+: see if we should include time.h, sys/time.h, or both
+cat <<'EOM'
+  
+Testing to see if we should include <time.h>, <sys/time.h> or both.
+I'm now running the test program...
+EOM
+$cat >try.c <<'EOCP'
+#ifdef I_TIME
+#include <time.h>
+#endif
+#ifdef I_SYSTIME
+#ifdef SYSTIMEKERNEL
+#define KERNEL
+#endif
+#include <sys/time.h>
+#endif
+main()
+{
+    struct tm foo;
+#ifdef S_TIMEVAL
+    struct timeval bar;
+#endif
+    if (foo.tm_sec == foo.tm_sec)
+       exit(0);
+#ifdef S_TIMEVAL
+    if (bar.tv_sec == bar.tv_sec)
+       exit(0);
+#endif
+    exit(1);
+}
+EOCP
+flags=''
+for s_timeval in '-DS_TIMEVAL' ''; do
+    for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
+       for i_time in '' '-DI_TIME'; do
+           for i_systime in '-DI_SYSTIME' ''; do
+               case "$flags" in
+               '') echo Trying $i_time $i_systime $d_systimekernel $s_timeval
+                   if $cc $ccflags \
+                           $i_time $i_systime $d_systimekernel $s_timeval \
+                           try.c -o try >/dev/null 2>&1 ; then
+                       set X $i_time $i_systime $d_systimekernel $s_timeval
+                       shift
+                       flags="$*"
+                       echo Succeeded with $flags
+                   fi
+                   ;;
+               esac
+           done
+       done
+    done
+done
+case "$flags" in
+*SYSTIMEKERNEL*) d_systimekernel="$define";;
+*) d_systimekernel="$undef";;
+esac
+case "$flags" in
+*I_TIME*) i_time="$define";;
+*) i_time="$undef";;
+esac
+case "$flags" in
+*I_SYSTIME*) i_systime="$define";;
+*) i_systime="$undef";;
+esac
+$rm -f try.c try
 
 : see if this is a varargs system
 echo " "
@@ -1772,13 +2094,41 @@ eval $inlibc
 
 : see if signal is declared as pointer to function returning int or void
 echo " "
-if $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 ; then
+$cppstdin $cppflags < /usr/include/signal.h >$$.tmp
+if $contains 'void.*signal' $$.tmp >/dev/null 2>&1 ; then
     echo "You have void (*signal())() instead of int."
     d_voidsig="$define"
 else
     echo "You have int (*signal())() instead of void."
     d_voidsig="$undef"
 fi
+rm -f $$.tmp
+
+: check for volatile keyword
+echo " "
+echo 'Checking to see if your C compiler knows about "volatile"...'
+$cat >try.c <<'EOCP'
+main()
+{
+       typedef unsigned short foo_t;
+       char *volatile foo;
+       volatile int bar;
+       volatile foo_t blech;
+       foo = foo;
+}
+EOCP
+if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
+    d_volatile="$define"
+    echo "Yup, it does."
+else
+    d_volatile="$undef"
+    echo "Nope, it doesn't."
+fi
+$rm -f try.*
+
+: see if there is a wait4
+set wait4 d_wait4
+eval $inlibc
 
 : check for void type
 echo " "
@@ -1813,7 +2163,7 @@ main() {
        exit(0);
 }
 EOCP
-    if $cc -S -DTRY=$defvoidused try.c >.out 2>&1 ; then
+    if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
        voidflags=$defvoidused
        echo "It appears to support void."
        if $contains warning .out >/dev/null 2>&1; then
@@ -1822,14 +2172,14 @@ EOCP
        fi
     else
        echo "Hmm, your compiler has some difficulty with void.  Checking further..."
-       if $cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
+       if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1 ; then
            echo "It supports 1..."
-           if $cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
+           if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1 ; then
                voidflags=3
                echo "And it supports 2 but not 4."
            else
                echo "It doesn't support 2..."
-               if $cc -S -DTRY=5 try.c >/dev/null 2>&1 ; then
+               if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1 ; then
                    voidflags=5
                    echo "But it supports 4."
                else
@@ -1851,10 +2201,15 @@ voidflags="$ans"
 $rm -f try.* .out
 
 : see what type gids are declared as in the kernel
+echo " "
 case "$gidtype" in
 '')
-    if $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
-       dflt='gid_t';
+    if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
+       dflt='short'
+    elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
+       dflt='int'
+    elif $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
+       dflt='gid_t'
     else
        set `grep 'groups\[NGROUPS\];' /usr/include/sys/user.h 2>/dev/null` unsigned short
        case $1 in
@@ -1867,8 +2222,8 @@ case "$gidtype" in
     ;;
 esac
 cont=true
-echo " "
-rp="What type are group ids on this system declared as? [$dflt]"
+echo "(The following only matters if you have getgroups().)"
+rp="What type are the group ids returned by getgroups()? [$dflt]"
 $echo $n "$rp $c"
 . myread
 gidtype="$ans"
@@ -1893,14 +2248,25 @@ else
     echo "No grp.h found."
 fi
 
+: see if this is a netinet/in.h system
+echo " "
+xxx=`loc netinet/in.h x /usr/include /usr/local/include $inclwanted`
+if test -f $xxx; then
+    i_niin="$define"
+    echo "netinet/in.h found."
+else
+    i_niin="$undef"
+    echo "No netinet/in.h found."
+fi
+
 : see if this is a sys/dir.h system
 echo " "
 if $test -r /usr/include/sys/dir.h ; then
     i_sysdir="$define"
-    echo "sysdir.h found."
+    echo "sys/dir.h found."
 else
     i_sysdir="$undef"
-    echo "No sysdir.h found."
+    echo "No sys/dir.h found."
 fi
 
 : see if ioctl defs are in sgtty/termio or sys/ioctl
@@ -1913,6 +2279,27 @@ else
     echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
 fi
 
+: see if this is a sys/ndir.h system
+echo " "
+xxx=`loc sys/ndir.h x /usr/include /usr/local/include $inclwanted`
+if test -f $xxx; then
+    i_sysndir="$define"
+    echo "sys/ndir.h found."
+else
+    i_sysndir="$undef"
+    echo "No sys/ndir.h found."
+fi
+
+: see if we should include utime.h
+echo " "
+if $test -r /usr/include/utime.h ; then
+    i_utime="$define"
+    echo "utime.h found."
+else
+    i_utime="$undef"
+    echo "No utime.h found, but that's ok."
+fi
+
 : see if this is a varargs system
 echo " "
 if $test -r /usr/include/varargs.h ; then
@@ -1945,8 +2332,8 @@ main()
     printf("%d\n", sizeof(int));
 }
 EOCP
-    if $cc try.c -o try >/dev/null 2>&1 ; then
-       dflt=`try`
+    if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
+       dflt=`./try`
     else
        dflt='4'
        echo "(I can't seem to compile the test program.  Guessing...)"
@@ -1976,10 +2363,10 @@ $cat <<EOM
 The $package package has some auxiliary files that should be put in a library
 that is accessible by everyone.  Where do you want to put these "private"
 EOM
-$echo $n "but accessible files? [$dflt] $c"
+$echo $n "but accessible files? (~name ok) [$dflt] $c"
 rp="Put private files where? [$dflt]"
 . myread
-privlib="$ans"
+privlib=`./filexp "$ans"`
 
 : check for size of random number generator
 echo " "
@@ -2003,8 +2390,8 @@ main()
     printf("%d\n",i);
 }
 EOCP
-    if $cc try.c -o try >/dev/null 2>&1 ; then
-       dflt=`try`
+    if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
+       dflt=`./try`
     else
        dflt='?'
        echo "(I can't seem to compile the test program...)"
@@ -2025,11 +2412,30 @@ echo " "
 case "$sig_name" in
 '')
     echo "Generating a list of signal names..."
-    set X `kill -l 2>/dev/null`
+    set X `cat /usr/include/signal.h /usr/include/sys/signal.h 2>&1 | awk '
+$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
+    sig[$3] = substr($2,4,20)
+    if (max < $3 && $3 < 60) {
+       max = $3
+    }
+}
+
+END {
+    for (i=1; i<=max; i++) {
+       if (sig[i] == "")
+           printf "%d", i
+       else
+           printf "%s", sig[i]
+       if (i < max)
+           printf " "
+    }
+    printf "\n"
+}
+'`
     shift
     case $# in
     0)  echo 'kill -l' >/tmp/foo$$
-       set X `/bin/csh -f </tmp/foo$$`
+       set X `$csh -f </tmp/foo$$`
        shift
        case $# in
        0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
@@ -2044,7 +2450,7 @@ echo "Signals are: $sig_name"
 
 : see what type of char stdio uses.
 echo " "
-if $contains 'unsigned.*char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
+if $contains 'unsigned.*char.*_ptr.*;' /usr/include/stdio.h >/dev/null 2>&1 ; then
     echo "Your stdio uses unsigned chars."
     stdchar="unsigned char"
 else
@@ -2070,7 +2476,7 @@ case "$uidtype" in
 esac
 cont=true
 echo " "
-rp="What type are user ids on this system declared as? [$dflt]"
+rp="What type are user ids returned by getuid(), etc.? [$dflt]"
 $echo $n "$rp $c"
 . myread
 uidtype="$ans"
@@ -2080,74 +2486,6 @@ Log='$Log'
 Header='$Header'
 
 
-: see if we should include -ldbm
-echo " "
-if $test -r /usr/lib/libdbm.a || $test -r /usr/local/lib/libdbm.a ; then
-    echo "-ldbm found."
-    libdbm='-ldbm'
-else
-    ans=`loc libdbm.a x $libpth`
-    case "$ans" in
-    x)
-       echo "No dbm library found."
-       libdbm=''
-       ;;
-    *)
-       echo "DBM library found in $ans."
-       libdbm="$ans"
-       ;;
-    esac
-fi
-
-: see if we should include -lndir
-echo " "
-if $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a ; then
-    echo "New directory library found."
-    libndir='-lndir'
-else
-    ans=`loc libndir.a x $libpth`
-    case "$ans" in
-    x)
-       echo "No ndir library found."
-       libndir=''
-       ;;
-    *)
-       echo "New directory library found in $ans."
-       libndir="$ans"
-       ;;
-    esac
-fi
-case "$libndir" in
-'') ;;
-*)
-    case "$d_readdir" in
-    $define)
-       echo "Since you have readdir in the C library, I'll ignore $libndir"
-       libndir=''
-       ;;
-    esac
-    ;;
-esac
-
-: see if we should include -lnm
-echo " "
-if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
-    echo "New math library found."
-    libnm='-lnm'
-else
-    ans=`loc libnm.a x $libpth`
-    case "$ans" in
-    x)
-       echo "No nm library found--the normal math library will have to do."
-       libnm=''
-       ;;
-    *)
-       echo "New math library found in $ans."
-       libnm="$ans"
-       ;;
-    esac
-fi
-
 : determine which malloc to compile in
 echo " "
 case "$usemymalloc" in
@@ -2173,6 +2511,21 @@ y*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
 *) mallocsrc=''; mallocobj='';;
 esac
 
+: determine compiler compiler
+case "$yacc" in
+'') dflt=yacc;;
+*)  dflt="$yacc";;
+esac
+cont=true
+    echo " "
+rp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]"
+$echo $n "$rp $c"
+. myread
+case "$ans" in
+'') ans="$dflt";;
+esac
+yacc="$ans"
+
 echo " "
 echo "End of configuration questions."
 echo " "
@@ -2189,8 +2542,8 @@ $startsh
 # This file was produced by running the Configure script.
 
 d_eunice='$d_eunice'
-eunicefix='$eunicefix'
 define='$define'
+eunicefix='$eunicefix'
 loclist='$loclist'
 expr='$expr'
 sed='$sed'
@@ -2241,6 +2594,7 @@ lp='$lp'
 touch='$touch'
 make='$make'
 date='$date'
+csh='$csh'
 Log='$Log'
 Header='$Header'
 bin='$bin'
@@ -2250,9 +2604,12 @@ cppstdin='$cppstdin'
 cppminus='$cppminus'
 d_bcmp='$d_bcmp'
 d_bcopy='$d_bcopy'
+d_bzero='$d_bzero'
+d_castneg='$d_castneg'
 d_charsprf='$d_charsprf'
 d_crypt='$d_crypt'
 cryptlib='$cryptlib'
+d_csh='$d_csh'
 d_dosuid='$d_dosuid'
 d_dup2='$d_dup2'
 d_fchmod='$d_fchmod'
@@ -2262,11 +2619,13 @@ d_flock='$d_flock'
 d_getgrps='$d_getgrps'
 d_gethent='$d_gethent'
 d_getpgrp='$d_getpgrp'
+d_getpgrp2='$d_getpgrp2'
 d_getprior='$d_getprior'
 d_htonl='$d_htonl'
 d_index='$d_index'
 d_ioctl='$d_ioctl'
 d_killpg='$d_killpg'
+d_lstat='$d_lstat'
 d_memcmp='$d_memcmp'
 d_memcpy='$d_memcpy'
 d_mkdir='$d_mkdir'
@@ -2278,6 +2637,7 @@ d_rmdir='$d_rmdir'
 d_setegid='$d_setegid'
 d_seteuid='$d_seteuid'
 d_setpgrp='$d_setpgrp'
+d_setpgrp2='$d_setpgrp2'
 d_setprior='$d_setprior'
 d_setregid='$d_setregid'
 d_setresgid='$d_setresgid'
@@ -2289,36 +2649,42 @@ d_socket='$d_socket'
 d_sockpair='$d_sockpair'
 d_oldsock='$d_oldsock'
 socketlib='$socketlib'
-sockethdr='$sockethdr'
 d_statblks='$d_statblks'
 d_stdstdio='$d_stdstdio'
 d_strctcpy='$d_strctcpy'
+d_strerror='$d_strerror'
 d_symlink='$d_symlink'
 d_syscall='$d_syscall'
-d_tminsys='$d_tminsys'
-i_systime='$i_systime'
 d_varargs='$d_varargs'
 d_vfork='$d_vfork'
 d_voidsig='$d_voidsig'
+d_volatile='$d_volatile'
 d_vprintf='$d_vprintf'
 d_charvspr='$d_charvspr'
+d_wait4='$d_wait4'
 gidtype='$gidtype'
 i_dirent='$i_dirent'
 d_dirnamlen='$d_dirnamlen'
 i_fcntl='$i_fcntl'
 i_grp='$i_grp'
+i_niin='$i_niin'
 i_pwd='$i_pwd'
 d_pwquota='$d_pwquota'
 d_pwage='$d_pwage'
+d_pwchange='$d_pwchange'
+d_pwclass='$d_pwclass'
+d_pwexpire='$d_pwexpire'
 i_sysdir='$i_sysdir'
 i_sysioctl='$i_sysioctl'
+i_sysndir='$i_sysndir'
+i_time='$i_time'
+i_systime='$i_systime'
+d_systimekernel='$d_systimekernel'
+i_utime='$i_utime'
 i_varargs='$i_varargs'
 i_vfork='$i_vfork'
 intsize='$intsize'
 libc='$libc'
-libdbm='$libdbm'
-libndir='$libndir'
-libnm='$libnm'
 mallocsrc='$mallocsrc'
 mallocobj='$mallocobj'
 usemymalloc='$usemymalloc'
@@ -2332,6 +2698,7 @@ large='$large'
 huge='$huge'
 optimize='$optimize'
 ccflags='$ccflags'
+cppflags='$cppflags'
 ldflags='$ldflags'
 cc='$cc'
 libs='$libs'
@@ -2348,8 +2715,9 @@ stdchar='$stdchar'
 uidtype='$uidtype'
 voidflags='$voidflags'
 defvoidused='$defvoidused'
-lib='$lib'
+yacc='$yacc'
 privlib='$privlib'
+lib='$lib'
 CONFIG=true
 EOT
 
@@ -2367,6 +2735,7 @@ case "$ans" in
 *) : in case they cannot read
     eval $ans;;
 esac
+: if this fails, just run all the .SH files by hand
 . ./config.sh
 
 echo " "