Integrate mainline.
[p5sagit/p5-mst-13.2.git] / Configure
index 4b5ffc8..74f835a 100755 (executable)
--- a/Configure
+++ b/Configure
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Mon Aug 28 23:52:13 EET DST 2000 [metaconfig 3.0 PL70]
+# Generated on Tue Mar 27 07:51:37 EET DST 2001 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.org)
 
-cat >/tmp/c1$$ <<EOF
+cat >c1$$ <<EOF
 ARGGGHHHH!!!!!
 
 SCO csh still thinks true is false.  Write to SCO today and tell them that next
@@ -34,18 +34,18 @@ we'd have to do is go in and swap the && and || tokens, wherever they are.)
 
 [End of diatribe. We now return you to your regularly scheduled programming...]
 EOF
-cat >/tmp/c2$$ <<EOF
+cat >c2$$ <<EOF
 
 OOPS!  You naughty creature!  You didn't run Configure with sh!
 I will attempt to remedy the situation by running sh for you...
 EOF
 
-true || cat /tmp/c1$$ /tmp/c2$$
+true || cat c1$$ c2$$
 true || exec sh $0 $argv:q
 
-(exit $?0) || cat /tmp/c2$$
+(exit $?0) || cat c2$$
 (exit $?0) || exec sh $0 $argv:q
-rm -f /tmp/c1$$ /tmp/c2$$
+rm -f c1$$ c2$$
 
 : compute my invocation name
 me=$0
@@ -160,9 +160,12 @@ esac
 test -d UU || mkdir UU
 cd UU && rm -f ./*
 
+ccname=''
+ccversion=''
 ccsymbols=''
 cppccsymbols=''
 cppsymbols=''
+perllibs=''
 dynamic_ext=''
 extensions=''
 known_extensions=''
@@ -305,6 +308,7 @@ cppminus=''
 cpprun=''
 cppstdin=''
 crosscompile=''
+d__fwalk=''
 d_access=''
 d_accessx=''
 d_alarm=''
@@ -345,6 +349,7 @@ d_endsent=''
 d_fchmod=''
 d_fchown=''
 d_fcntl=''
+d_fcntl_can_lock=''
 d_fd_macros=''
 d_fd_set=''
 d_fds_bits=''
@@ -358,6 +363,7 @@ d_fs_data_s=''
 d_fseeko=''
 d_fsetpos=''
 d_fstatfs=''
+d_fsync=''
 d_ftello=''
 d_ftime=''
 d_gettimeod=''
@@ -382,6 +388,7 @@ d_getnbyaddr=''
 d_getnbyname=''
 d_getnent=''
 d_getnetprotos=''
+d_getpagsz=''
 d_getpent=''
 d_getpgid=''
 d_getpgrp2=''
@@ -471,6 +478,7 @@ d_rmdir=''
 d_safebcpy=''
 d_safemcpy=''
 d_sanemcmp=''
+d_sbrkproto=''
 d_select=''
 d_sem=''
 d_semctl=''
@@ -511,7 +519,9 @@ d_shmctl=''
 d_shmdt=''
 d_shmget=''
 d_sigaction=''
+d_sigprocmask=''
 d_sigsetjmp=''
+d_sockatmark=''
 d_msg_ctrunc=''
 d_msg_dontroute=''
 d_msg_oob=''
@@ -533,6 +543,8 @@ d_fstatvfs=''
 d_statvfs=''
 d_stdio_cnt_lval=''
 d_stdio_ptr_lval=''
+d_stdio_ptr_lval_nochange_cnt=''
+d_stdio_ptr_lval_sets_cnt=''
 d_stdiobase=''
 d_stdstdio=''
 stdio_base=''
@@ -552,6 +564,7 @@ d_strtod=''
 d_strtol=''
 d_strtold=''
 d_strtoll=''
+d_strtoq=''
 d_strtoul=''
 d_strtoull=''
 d_strtouq=''
@@ -711,6 +724,7 @@ installusrbinperl=''
 intsize=''
 longsize=''
 shortsize=''
+issymlink=''
 libc=''
 ldlibpthname=''
 libperl=''
@@ -728,18 +742,20 @@ libsfiles=''
 libsfound=''
 libspath=''
 lns=''
-d_PRIEldbl=''
-d_PRIFldbl=''
-d_PRIGldbl=''
+d_PRIEUldbl=''
+d_PRIFUldbl=''
+d_PRIGUldbl=''
 d_PRIeldbl=''
 d_PRIfldbl=''
 d_PRIgldbl=''
-sPRIEldbl=''
-sPRIFldbl=''
-sPRIGldbl=''
+d_SCNfldbl=''
+sPRIEUldbl=''
+sPRIFUldbl=''
+sPRIGUldbl=''
 sPRIeldbl=''
 sPRIfldbl=''
 sPRIgldbl=''
+sSCNfldbl=''
 lseeksize=''
 lseektype=''
 make_set_make=''
@@ -757,12 +773,6 @@ installman3dir=''
 man3dir=''
 man3direxp=''
 man3ext=''
-huge=''
-large=''
-medium=''
-models=''
-small=''
-split=''
 modetype=''
 multiarch=''
 mydomain=''
@@ -774,6 +784,7 @@ d_eofnblk=''
 eagain=''
 o_nonblock=''
 rd_nodata=''
+need_va_copy=''
 netdb_hlen_type=''
 netdb_host_type=''
 netdb_name_type=''
@@ -824,13 +835,13 @@ u8type=''
 uvsize=''
 uvtype=''
 ivdformat=''
-nvEformat=''
-nvFformat=''
-nvGformat=''
+nvEUformat=''
+nvFUformat=''
+nvGUformat=''
 nveformat=''
 nvfformat=''
 nvgformat=''
-uvXformat=''
+uvXUformat=''
 uvoformat=''
 uvuformat=''
 uvxformat=''
@@ -842,13 +853,13 @@ privlib=''
 privlibexp=''
 prototype=''
 ptrsize=''
-d_PRIX64=''
+d_PRIXU64=''
 d_PRId64=''
 d_PRIi64=''
 d_PRIo64=''
 d_PRIu64=''
 d_PRIx64=''
-sPRIX64=''
+sPRIXU64=''
 sPRId64=''
 sPRIi64=''
 sPRIo64=''
@@ -874,6 +885,7 @@ sig_name=''
 sig_name_init=''
 sig_num=''
 sig_num_init=''
+sig_size=''
 installsitearch=''
 sitearch=''
 sitearchexp=''
@@ -945,10 +957,13 @@ vendorlibexp=''
 usevendorprefix=''
 vendorprefix=''
 vendorprefixexp=''
+versiononly=''
 defvoidused=''
 voidflags=''
 pm_apiversion=''
 xs_apiversion=''
+yacc=''
+yaccflags=''
 CONFIG=''
 
 define='define'
@@ -966,6 +981,9 @@ if test -f /etc/unixtovms.exe; then
 fi
 
 i_whoami=''
+ccname=''
+ccversion=''
+perllibs=''
 : set useposix=false in your hint file to disable the POSIX extension.
 useposix=true
 : set useopcode=false in your hint file to disable the Opcode extension.
@@ -974,6 +992,7 @@ useopcode=true
 _exe=''
 : Extra object files, if any, needed on this platform.
 archobjs=''
+archname=''
 : Possible local include directories to search.
 : Set locincpth to "" in a hint file to defeat local include searches.
 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
@@ -990,8 +1009,7 @@ loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
 
 : general looking path for locating libraries
-glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
-glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
+glibpth="/lib /usr/lib $xlibpth"
 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
@@ -1005,6 +1023,7 @@ plibpth=''
 libswanted=''
 : some systems want to use only the non-versioned libso:s
 ignore_versioned_solibs=''
+archname64=''
 ccflags_uselargefiles=''
 ldflags_uselargefiles=''
 libswanted_uselargefiles=''
@@ -1420,6 +1439,7 @@ case "$src" in
     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
          case "$src" in
         /*)    ;;
+        .)     ;;
          *)    src=`cd ../$src && pwd` ;;
         esac
          ;;
@@ -1766,18 +1786,18 @@ persist across sessions for $package.
 You may safely delete it if you wish.
 EOF
 
-xpatchlevel=`awk '/define[     ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
+xversion=`awk '/define[        ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
 case "$usedevel" in
 $define|true|[yY]*) ;;
-*) case "$xpatchlevel" in
+*) case "$xversion" in
    *[13579])
        cat >&4 <<EOH
 *** WHOA THERE!!! ***
 
     This is an UNSTABLE DEVELOPMENT release.
-    (The patchlevel, $xpatchlevel, is odd--as opposed to even,
-     and that signifies a development release.  If you want a
-     maintenance release, you want an even-numbered release.)
+    The version of this $package distribution is $xversion, that is, odd,
+    (as opposed to even) and that signifies a development release.
+    If you want a maintenance release, you want an even-numbered version.
 
     Do ***NOT*** install this into production use.
     Data corruption and crashes are possible.
@@ -1785,12 +1805,16 @@ $define|true|[yY]*) ;;
     It is most seriously suggested that you do not continue any further
     unless you want to help in developing and debugging Perl.
 
+    If you *still* want to build perl, you can answer 'y' now,
+    or pass -Dusedevel to Configure.
+
 EOH
        rp='Do you really want to continue?'
        dflt='n'
        . ./myread
        case "$ans" in
-       [yY]) echo >&4 "Okay, continuing." ;;
+       [yY]) echo >&4 "Okay, continuing."
+             usedevel="$define" ;;
        *) echo >&4 "Okay, bye."
           exit 1
           ;;
@@ -1799,6 +1823,16 @@ EOH
     esac
     ;;
 esac
+case "$usedevel" in
+$define|true|[yY]*)
+       case "$versiononly" in
+       '') versiononly="$define" ;;
+       esac
+       case "$installusrbinperl" in
+       '') installusrbinperl="$undef" ;;
+       esac
+       ;;
+esac
 
 : general instructions
 needman=true
@@ -1948,6 +1982,7 @@ uniq
 trylist="
 Mcc
 ar
+bison
 byacc
 cpp
 csh
@@ -2095,7 +2130,7 @@ int main(int argc, char *argv[]) {
   return 0;
 }
 EOM
-    if $cc -o try try.c; then
+    if $cc -o try $ccflags try.c; then
        :
     else
         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
@@ -2124,13 +2159,17 @@ EOM
                     fi
                 fi  
                 case "$ans" in
-                [yY]*) cc=gcc; ccflags=''; despair=no ;;
+                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
                 esac
             fi
         fi
         if $test X"$despair" = Xyes; then
-            echo "You need to find a working C compiler." >&4
-            echo "I cannot continue any further, aborting." >&4
+           $cat >&4 <<EOM
+You need to find a working C compiler.
+Either (purchase and) install the C compiler supplied by your OS vendor,
+or for a free C compiler try http://gcc.gnu.org/
+I cannot continue any further, aborting.
+EOM
             exit 1
         fi
     fi
@@ -2151,6 +2190,93 @@ else
 fi
 $rm -f blurfl sym
 
+: determine whether symbolic links are supported
+echo " "
+case "$lns" in
+*"ln -s")
+       echo "Checking how to test for symbolic links..." >&4
+       $lns blurfl sym
+       if $test "X$issymlink" = X; then
+               sh -c "PATH= test -h sym" >/dev/null 2>&1
+               if test $? = 0; then
+                       issymlink="test -h"
+               fi              
+       fi
+       if $test "X$issymlink" = X; then
+               if  $test -h >/dev/null 2>&1; then
+                       issymlink="$test -h"
+                       echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
+               fi              
+       fi
+       if $test "X$issymlink" = X; then
+               if $test -L sym 2>/dev/null; then
+                       issymlink="$test -L"
+               fi
+       fi
+       if $test "X$issymlink" != X; then
+               echo "You can test for symbolic links with '$issymlink'." >&4
+       else
+               echo "I do not know how you can test for symbolic links." >&4
+       fi
+       $rm -f blurfl sym
+       ;;
+*)     echo "No symbolic links, so not testing for their testing..." >&4
+       ;;
+esac
+echo " "
+
+
+case "$mksymlinks" in
+$define|true|[yY]*)
+       case "$src" in
+       ''|'.') echo "Cannot create symlinks in the original directory." >&4
+               exit 1
+               ;;
+       *)      case "$lns:$issymlink" in
+               *"ln -s:"*"test -"?)
+                       echo "Creating the symbolic links..." >&4
+                       echo "(First creating the subdirectories...)" >&4
+                       cd ..
+                       awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
+                               read directory
+                               test -z "$directory" && break
+                               mkdir -p $directory
+                       done
+                       # Sanity check 1.
+                       if test ! -d t/base; then
+                               echo "Failed to create the subdirectories.  Aborting." >&4
+                               exit 1
+                       fi
+                       echo "(Then creating the symlinks...)" >&4
+                       awk '{print $1}' $src/MANIFEST | while true; do
+                               read filename
+                               test -z "$filename" && break
+                               if test -f $filename; then
+                                       if $issymlink $filename; then
+                                               rm -f $filename
+                                       fi
+                               fi
+                               if test -f $filename; then
+                                       echo "$filename already exists, not symlinking."
+                               else
+                                       ln -s $src/$filename $filename
+                               fi
+                       done
+                       # Sanity check 2.
+                       if test ! -f t/base/commonsense.t; then
+                               echo "Failed to create the symlinks.  Aborting." >&4
+                               exit 1
+                       fi
+                       cd UU
+                       ;;
+               *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
+                       ;;
+               esac
+               ;;
+       esac
+       ;;
+esac
+
 : see whether [:lower:] and [:upper:] are supported character classes
 echo " "
 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
@@ -2253,7 +2379,10 @@ if test -f config.sh; then
        rp="I see a config.sh file.  Shall I use it to set the defaults?"
        . UU/myread
        case "$ans" in
-       n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
+       n*|N*) echo "OK, I'll ignore it."
+               mv config.sh config.sh.old
+               myuname="$newmyuname"
+               ;;
        *)  echo "Fetching default answers from your old config.sh file..." >&4
                tmp_n="$n"
                tmp_c="$c"
@@ -2418,6 +2547,7 @@ EOM
                        esac
                        ;;
                next*) osname=next ;;
+               nonstop-ux) osname=nonstopux ;;
                POSIX-BC | posix-bc ) osname=posix-bc
                        osvers="$3"
                        ;;
@@ -2663,7 +2793,6 @@ cd UU
        ;;
 esac
 test "$override" && . ./optdef.sh
-myuname="$newmyuname"
 
 : Restore computed paths
 for file in $loclist $trylist; do
@@ -2824,6 +2953,19 @@ EOM
        ;;
 esac
 
+case "$useithreads$use5005threads" in
+"$define$define")
+       $cat >&4 <<EOM
+
+You cannot have both the ithreads and the 5.005 threads enabled
+at the same time.  Disabling the 5.005 threads since they are
+much less stable than the ithreads.
+
+EOM
+       use5005threads="$undef"
+       ;;
+esac
+
 case "$d_oldpthreads" in
 '')    : Configure tests would be welcome here.  For now, assume undef.
        val="$undef" ;;
@@ -2880,174 +3022,6 @@ esac
 set usemultiplicity
 eval $setvar
 
-: determine where manual pages are on this system
-echo " "
-case "$sysman" in
-'') 
-       syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
-       syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
-       syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
-       syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
-       syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
-       sysman=`./loc . /usr/man/man1 $syspath`
-       ;;
-esac
-if $test -d "$sysman"; then
-       echo "System manual is in $sysman." >&4
-else
-       echo "Could not find manual pages in source form." >&4
-fi
-
-: see what memory models we can support
-case "$models" in
-'')
-       $cat >pdp11.c <<'EOP'
-int main() {
-#ifdef pdp11
-       exit(0);
-#else
-       exit(1);
-#endif
-}
-EOP
-       case "$cc" in
-       '') modelcc="$cc" ;;
-       *) modelcc="cc" ;;
-       esac
-       ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
-       if $test -f pdp11 && ./pdp11 2>/dev/null; then
-               dflt='unsplit split'
-       else
-               tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
-               case "$tans" in
-               X) dflt='none';;
-               *) if $test -d /lib/small || $test -d /usr/lib/small; then
-                               dflt='small'
-                       else
-                               dflt=''
-                       fi
-                       if $test -d /lib/medium || $test -d /usr/lib/medium; then
-                               dflt="$dflt medium"
-                       fi
-                       if $test -d /lib/large || $test -d /usr/lib/large; then
-                               dflt="$dflt large"
-                       fi
-                       if $test -d /lib/huge || $test -d /usr/lib/huge; then
-                               dflt="$dflt huge"
-                       fi
-               esac
-       fi;;
-*) dflt="$models";;
-esac
-$cat <<EOM
-Some systems have different model sizes.  On most systems they are called
-small, medium, large, and huge.  On the PDP11 they are called unsplit and
-split.  If your system doesn't support different memory models, say "none".
-If you wish to force everything to one memory model, say "none" here and
-put the appropriate flags later when it asks you for other cc and ld flags.
-Venix systems may wish to put "none" and let the compiler figure things out.
-(In the following question multiple model names should be space separated.)
-
-The default for most systems is "none".
-
-EOM
-rp="Which memory models are supported?"
-. ./myread
-models="$ans"
-
-case "$models" in
-none)
-       small=''
-       medium=''
-       large=''
-       huge=''
-       unsplit=''
-       split=''
-       ;;
-*split)
-       case "$split" in
-       '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
-                        $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
-                       dflt='-i'
-               else
-                       dflt='none'
-               fi;;
-       *) dflt="$split";;
-       esac
-       rp="What flag indicates separate I and D space?"
-       . ./myread
-       tans="$ans"
-       case "$tans" in
-       none) tans='';;
-       esac
-       split="$tans"
-       unsplit='';;
-*large*|*small*|*medium*|*huge*)
-       case "$models" in
-       *large*)
-               case "$large" in
-               '') dflt='-Ml';;
-               *) dflt="$large";;
-               esac
-       rp="What flag indicates large model?"
-       . ./myread
-       tans="$ans"
-       case "$tans" in
-       none) tans='';
-       esac
-       large="$tans";;
-       *) large='';;
-       esac
-       case "$models" in
-       *huge*) case "$huge" in
-               '') dflt='-Mh';;
-               *) dflt="$huge";;
-               esac
-               rp="What flag indicates huge model?"
-               . ./myread
-               tans="$ans"
-               case "$tans" in
-               none) tans='';
-               esac
-               huge="$tans";;
-       *) huge="$large";;
-       esac
-       case "$models" in
-       *medium*) case "$medium" in
-               '') dflt='-Mm';;
-               *) dflt="$medium";;
-               esac
-               rp="What flag indicates medium model?"
-               . ./myread
-               tans="$ans"
-               case "$tans" in
-               none) tans='';
-               esac
-               medium="$tans";;
-       *) medium="$large";;
-       esac
-       case "$models" in
-       *small*) case "$small" in
-               '') dflt='none';;
-               *) dflt="$small";;
-               esac
-               rp="What flag indicates small model?"
-               . ./myread
-               tans="$ans"
-               case "$tans" in
-               none) tans='';
-               esac
-               small="$tans";;
-       *) small='';;
-       esac
-       ;;
-*)
-       echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
-       ;;
-esac
-$rm -f pdp11.* pdp11
-
 : make some quick guesses about what we are up against
 echo " "
 $echo $n "Hmm...  $c"
@@ -3065,7 +3039,7 @@ if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
 then
        echo "Looks kind of like an OSF/1 system, but we'll see..."
        echo exit 0 >osf1
-elif test `echo abc | tr a-z A-Z` = Abc ; then
+elif test `echo abc | $tr a-z A-Z` = Abc ; then
        xxx=`./loc addbib blurfl $pth`
        if $test -f $xxx; then
        echo "Looks kind of like a USG system with BSD features, but we'll see..."
@@ -3104,12 +3078,15 @@ EOI
        ;;
 esac
 : Detect OS2.  The p_ variable is set above in the Head.U unit.
+: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
+: semicolon as a patch separator
 case "$p_" in
 :) ;;
 *)
        $cat <<'EOI'
 I have the feeling something is not exactly right, however...don't tell me...
 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
+(Or you may be running DOS with DJGPP.)
 EOI
        echo exit 0 >os2
        ;;
@@ -3140,51 +3117,13 @@ chmod +x bsd usg v7 osf1 eunice xenix venix os2
 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
 $rm -f foo
 
-: see if we need a special compiler
-echo " "
-if ./usg; then
-       case "$cc" in
-       '') case "$Mcc" in
-               /*) dflt='Mcc';;
-               *) case "$large" in
-                       -M*) dflt='cc';;
-                       *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
-                                       if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
-                                               dflt='cc'
-                                       else
-                                               dflt='cc -M'
-                                       fi
-                               else
-                                       dflt='cc'
-                               fi;;
-                       esac;;
-               esac;;
-       *)  dflt="$cc";;
-       esac
-       case "$dflt" in
-       *M*)    $cat <<'EOM'
-On some older systems the default C compiler will not resolve multiple global
-references that happen to have the same name.  On some such systems the "Mcc"
-command may be used to force these to be resolved.  On other systems a "cc -M"
-command is required.  (Note that the -M flag on other systems indicates a
-memory model to use!) If you have the Gnu C compiler, you might wish to use
-that instead.
-
-EOM
-       ;;
-       esac
-       rp="Use which C compiler?"
-       . ./myread
-       cc="$ans"
-else
-       case "$cc" in
-       '') dflt=cc;;
-       *) dflt="$cc";;
-       esac
-       rp="Use which C compiler?"
-       . ./myread
-       cc="$ans"
-fi
+case "$cc" in
+'') dflt=cc;;
+*) dflt="$cc";;
+esac
+rp="Use which C compiler?"
+. ./myread
+cc="$ans"
 : Look for a hint-file generated 'call-back-unit'.  Now that the
 : user has specified the compiler, we may need to set or change some
 : other defaults.
@@ -3208,11 +3147,12 @@ int main() {
        exit(0);
 }
 EOM
-if $cc $ldflags -o gccvers gccvers.c; then
+if $cc -o gccvers $ccflags $ldflags gccvers.c; then
        gccversion=`./gccvers`
        case "$gccversion" in
        '') echo "You are not using GNU cc." ;;
        *)  echo "You are using GNU cc $gccversion."
+           ccname=gcc  
            ;;
        esac
 else
@@ -3261,9 +3201,9 @@ EOM
    esac
    ;;
 esac
-
-
-
+case "$ccname" in
+'') ccname="$cc" ;;
+esac
 
 : see how we invoke the C preprocessor
 echo " "
@@ -3479,7 +3419,7 @@ esac
 
 case "$fn" in
 *\(*)
-       expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
+       expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
        fn=`echo $fn | sed 's/(.*)//'`
        ;;
 esac
@@ -3856,7 +3796,8 @@ esac
 cat <<EOM
 
 Perl can be built to use the SOCKS proxy protocol library.  To do so,
-Configure must be run with -Dusesocks.
+Configure must be run with -Dusesocks.  If you use SOCKS you also need
+to use the PerlIO abstraction layer, this will be implicitly selected.
 
 If this doesn't make any sense to you, just accept the default '$dflt'.
 EOM
@@ -3869,6 +3810,10 @@ esac
 set usesocks
 eval $setvar
 
+case "$usesocks" in
+$define|true|[yY]*) useperlio="$define";;
+esac
+
 : Looking for optional libraries
 echo " "
 echo "Checking for optional libraries..." >&4
@@ -4045,8 +3990,8 @@ for thisincl in $inclwanted; do
        if $test -d $thisincl; then
                if $test x$thisincl != x$usrinc; then
                        case "$dflt" in
-                       *$thisincl*);;
-                       *) dflt="$dflt -I$thisincl";;
+                        *" -I$thisincl "*);;
+                        *) dflt="$dflt -I$thisincl ";;
                        esac
                fi
        fi
@@ -4082,6 +4027,7 @@ esac
 case "$dflt" in
 ''|' ') dflt=none;;
 esac
+
 $cat <<EOH
 
 Your C compiler may want other flags.  For this question you should include
@@ -4214,7 +4160,7 @@ $cat > try.c <<'EOF'
 #include <stdio.h>
 int main() { printf("Ok\n"); exit(0); }
 EOF
-set X $cc $optimize $ccflags -o try $ldflags try.c $libs
+set X $cc -o try $optimize $ccflags $ldflags try.c $libs
 shift
 $cat >try.msg <<'EOM'
 I've tried to compile and run the following simple program:
@@ -4233,8 +4179,8 @@ and I got the following output:
 
 EOM
 dflt=y
-if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
-       if sh -c './try' >>try.msg 2>&1; then
+if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
+       if $sh -c './try' >>try.msg 2>&1; then
                xxx=`./try`
                case "$xxx" in
                "Ok") dflt=n ;;
@@ -4345,12 +4291,12 @@ esac'
 compile='
 mc_file=$1;
 shift;
-$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
+$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
 : define a shorthand compile call for compilations that should be ok.
 compile_ok='
 mc_file=$1;
 shift;
-$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
+$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
 
 : check for lengths of integral types
 echo " "
@@ -4931,7 +4877,7 @@ unknown)
                                s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
                                G
                                s/\n/ /' | \
-                        sort | $sed -e 's/^.* //'`
+                        $sort | $sed -e 's/^.* //'`
                eval set \$$#
        done
        $test -r $1 || set /usr/ccs/lib/libc.$so
@@ -4991,7 +4937,7 @@ compiler, or your machine supports multiple models), you can override it here.
 EOM
 else
        dflt=''
-       echo $libpth | tr ' ' $trnl | sort | uniq > libpath
+       echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
        cat >&4 <<EOM
 I can't seem to find your C library.  I've looked in the following places:
 
@@ -5009,7 +4955,7 @@ rp='Where is your C library?'
 libc="$ans"
 
 echo " "
-echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
+echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
 set X `cat libnames`
 shift
 xxx=files
@@ -5172,7 +5118,7 @@ yes)
                fi;;
        *)
                echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
-               if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
+               if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
                then tval=true;
                else tval=false;
                fi;
@@ -5274,43 +5220,164 @@ EOM
        ;;
 esac
 
-: determine the architecture name
+: check for length of double
 echo " "
-if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
-       tarch=`arch`"-$osname"
-elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
-       if uname -m > tmparch 2>&1 ; then
-               tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
-                       -e 's/$/'"-$osname/" tmparch`
+case "$doublesize" in
+'')
+       echo "Checking to see how big your double precision numbers are..." >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof(double));
+    exit(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               doublesize=`./try`
+               echo "Your double is $doublesize bytes long."
        else
-               tarch="$osname"
+               dflt='8'
+               echo "(I can't seem to compile the test program.  Guessing...)"
+               rp="What is the size of a double precision number (in bytes)?"
+               . ./myread
+               doublesize="$ans"
        fi
-       $rm -f tmparch
+       ;;
+esac
+$rm -f try.c try
+
+: check for long doubles
+echo " "
+echo "Checking to see if you have long double..." >&4
+echo 'int main() { long double x = 7.0; }' > try.c
+set try
+if eval $compile; then
+       val="$define"
+       echo "You have long double."
 else
-       tarch="$osname"
+       val="$undef"
+       echo "You do not have long double."
 fi
-case "$myarchname" in
-''|"$tarch") ;;
-*)
-       echo "(Your architecture name used to be $myarchname.)"
-       archname=''
+$rm try.*
+set d_longdbl
+eval $setvar
+
+: check for length of long double
+case "${d_longdbl}${longdblsize}" in
+$define)
+       echo " "
+       echo "Checking to see how big your long doubles are..." >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+       printf("%d\n", sizeof(long double));
+}
+EOCP
+       set try
+       set try
+       if eval $compile; then
+               longdblsize=`./try$exe_ext`
+               echo "Your long doubles are $longdblsize bytes long."
+       else
+               dflt='8'
+               echo " "
+               echo "(I can't seem to compile the test program.  Guessing...)" >&4
+               rp="What is the size of a long double (in bytes)?"
+               . ./myread
+               longdblsize="$ans"
+       fi
+       if $test "X$doublesize" = "X$longdblsize"; then
+               echo "(That isn't any different from an ordinary double.)"
+       fi      
        ;;
 esac
-myarchname="$tarch"
-case "$archname" in
-'') dflt="$tarch";;
-*) dflt="$archname";;
+$rm -f try.* try
+
+case "$useperlio" in
+$define|true|[yY]*|'') dflt='y';;
+*) dflt='n';;
 esac
-rp='What is your architecture name'
+cat <<EOM
+
+Previous version of $package used the standard IO mechanisms as
+defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
+alternate IO mechanisms via the PerlIO abstraction layer, but the
+stdio mechanism is still available if needed.  The abstraction layer
+can use AT&T's sfio (if you already have sfio installed) or regular stdio.
+Using PerlIO with sfio may cause problems with some extension modules.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+rp='Use the PerlIO abstraction layer?'
 . ./myread
-archname="$ans"
-case "$usethreads" in
-$define)
-       echo "Threads selected." >&4
-       case "$archname" in
-        *-thread*) echo "...and architecture name already has -thread." >&4
-                ;;
-        *)      archname="$archname-thread"
+case "$ans" in
+y|Y) 
+       val="$define"
+       ;;
+*)      
+       echo "Ok, doing things the stdio way."
+       val="$undef"
+       ;;
+esac
+set useperlio
+eval $setvar 
+
+case "$usesocks" in
+$define|true|[yY]*)
+       case "$useperlio" in
+       $define|true|[yY]*) ;;
+       *)      cat >&4 <<EOM
+
+You are using the SOCKS proxy protocol library which means that you
+should also use the PerlIO layer.  You may be headed for trouble.
+
+EOM
+               ;;
+       esac
+       ;;
+esac
+
+       
+: determine the architecture name
+echo " "
+if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
+       tarch=`arch`"-$osname"
+elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
+       if uname -m > tmparch 2>&1 ; then
+               tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
+                       -e 's/$/'"-$osname/" tmparch`
+       else
+               tarch="$osname"
+       fi
+       $rm -f tmparch
+else
+       tarch="$osname"
+fi
+case "$myarchname" in
+''|"$tarch") ;;
+*)
+       echo "(Your architecture name used to be $myarchname.)"
+       archname=''
+       ;;
+esac
+myarchname="$tarch"
+case "$archname" in
+'') dflt="$tarch";;
+*) dflt="$archname";;
+esac
+rp='What is your architecture name'
+. ./myread
+archname="$ans"
+case "$usethreads" in
+$define)
+       echo "Threads selected." >&4
+       case "$archname" in
+        *-thread*) echo "...and architecture name already has -thread." >&4
+                ;;
+        *)      archname="$archname-thread"
                 echo "...setting architecture name to $archname." >&4
                 ;;
         esac
@@ -5332,13 +5399,14 @@ case "$use64bitint$use64bitall" in
 *"$define"*)
        case "$archname64" in
        '')
+               echo "This architecture is naturally 64-bit, not changing architecture name." >&4
                ;;
        *)
                case "$use64bitint" in
                "$define") echo "64 bit integers selected." >&4 ;;
                esac
                case "$use64bitall" in
-               "$define") echo "64 bit memory model selected." >&4 ;;
+               "$define") echo "Maximal 64 bitness selected." >&4 ;;
                esac
                case "$archname" in
                *-$archname64*) echo "...and architecture name already has $archname64." >&4
@@ -5353,10 +5421,32 @@ esac
 case "$uselongdouble" in
 $define)
        echo "Long doubles selected." >&4
+       case "$longdblsize" in
+       $doublesize)
+               "...but long doubles are equal to doubles, not changing architecture name." >&4
+               ;;
+       *)
+               case "$archname" in
+               *-ld*) echo "...and architecture name already has -ld." >&4
+                       ;;
+               *)      archname="$archname-ld"
+                       echo "...setting architecture name to $archname." >&4
+                       ;;
+               esac
+               ;;
+       esac
+       ;;
+esac
+case "$useperlio" in
+$define)
+       echo "Perlio selected." >&4
+       ;;
+*)
+       echo "Perlio not selected, using stdio." >&4
        case "$archname" in
-        *-ld*) echo "...and architecture name already has -ld." >&4
+        *-stdio*) echo "...and architecture name already has -stdio." >&4
                 ;;
-        *)      archname="$archname-ld"
+        *)      archname="$archname-stdio"
                 echo "...setting architecture name to $archname." >&4
                 ;;
         esac
@@ -5495,10 +5585,7 @@ else
        api_version=0
        api_subversion=0
 fi
-$echo $n "(You have $package revision $revision" $c
-$echo $n " patchlevel $patchlevel" $c
-test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
-echo ".)"
+$echo "(You have $package version $patchlevel subversion $subversion.)"
 case "$osname" in
 dos|vms)
        : XXX Should be a Configure test for double-dots in filenames.
@@ -6487,13 +6574,13 @@ EOM
                        hpux)   dflt='+z' ;;
                        next)   dflt='none' ;;
                        irix*)  dflt='-KPIC' ;;
-                       svr4*|esix*|solaris) dflt='-KPIC' ;;
+                       svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
                        sunos)  dflt='-pic' ;;
                        *)      dflt='none' ;;
                    esac
                        ;;
                *)  case "$osname" in
-                       svr4*|esix*|solaris) dflt='-fPIC' ;;
+                       svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
                        *)      dflt='-fpic' ;;
                    esac ;;
            esac ;;
@@ -6569,7 +6656,7 @@ EOM
                        next)  dflt='none' ;;
                        solaris) dflt='-G' ;;
                        sunos) dflt='-assert nodefinitions' ;;
-                       svr4*|esix*) dflt="-G $ldflags" ;;
+                       svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
                *)     dflt='none' ;;
                        esac
                        ;;
@@ -6644,7 +6731,7 @@ $undef)
        ;;
 *)     case "$useshrplib" in
        '')     case "$osname" in
-               svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
+               svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
                        dflt=y
                        also='Building a shared libperl is required for dynamic loading to work on your system.'
                        ;;
@@ -6849,6 +6936,24 @@ case "$ldlibpthname" in
 none)  ldlibpthname='' ;;
 esac
 
+: determine where manual pages are on this system
+echo " "
+case "$sysman" in
+'') 
+       syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
+       syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
+       syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
+       syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
+       syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
+       sysman=`./loc . /usr/man/man1 $syspath`
+       ;;
+esac
+if $test -d "$sysman"; then
+       echo "System manual is in $sysman." >&4
+else
+       echo "Could not find manual pages in source form." >&4
+fi
+
 : determine where manual pages go
 set man1dir man1dir none
 eval $prefixit
@@ -7215,18 +7320,23 @@ case "$myhostname" in
                                        /[       ]$myhostname[  . ]/p" > hosts
                }
                tmp_re="[       . ]"
-               $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
+               if $test -f hosts; then
+                       $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
                             END { print sum }" hosts` = x1 || tmp_re="[         ]"
-               dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
-                       hosts | $sort | $uniq | \
-                       $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
-               case `$echo X$dflt` in
-               X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
+                       dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
+                               hosts | $sort | $uniq | \
+                               $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
+                       case `$echo X$dflt` in
+                       X*\ *)  echo "(Several hosts in the database matched hostname)"
+                               dflt=.
+                               ;;
+                       X.) echo "(You do not have fully-qualified names in the hosts database)"
+                               ;;
+                       esac
+               else
+                       echo "(I cannot locate a hosts database anywhere)"
                        dflt=.
-                       ;;
-               X.) echo "(You do not have fully-qualified names in /etc/hosts)"
-                       ;;
-               esac
+               fi
                case "$dflt" in
                .)
                        tans=`./loc resolv.conf X /etc /usr/etc`
@@ -7253,6 +7363,11 @@ case "$myhostname" in
                        esac
                        ;;
                esac
+               case "$dflt$osname" in
+               .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
+                       dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
+                       ;;
+               esac
                case "$dflt" in
                .) echo "(Lost all hope -- silly guess then)"
                        dflt='.uucp'
@@ -7354,6 +7469,25 @@ rp='Perl administrator e-mail address'
 . ./myread
 perladmin="$ans"
 
+: determine whether to only install version-specific parts.
+echo " "
+$cat <<EOM
+Do you want to install only the version-specific parts of the perl
+distribution?  Usually you do *not* want to do this.
+EOM
+case "$versiononly" in
+"$define"|[Yy]*|true) dflt='y' ;;
+*) dflt='n';
+esac
+rp="Do you want to install only the version-specific parts of perl?"
+. ./myread
+case "$ans" in
+[yY]*) val="$define";;
+*)     val="$undef" ;;
+esac
+set versiononly
+eval $setvar
+
 : figure out how to guarantee perl startup
 case "$startperl" in
 '')
@@ -7368,7 +7502,10 @@ want to share those scripts and perl is not in a standard place
 a shell by starting the script with a single ':' character.
 
 EOH
-               dflt="$binexp/perl"
+               case "$versiononly" in
+               "$define")      dflt="$binexp/perl$version";;  
+               *)              dflt="$binexp/perl";;
+               esac
                rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
                . ./myread
                case "$ans" in
@@ -7478,36 +7615,6 @@ else
        installsitebin="$sitebinexp"
 fi
 
-case "$useperlio" in
-$define|true|[yY]*)    dflt='y';;
-*) dflt='n';;
-esac
-cat <<EOM
-
-Previous version of $package used the standard IO mechanisms as defined
-in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
-mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
-the default.  This abstraction layer can use AT&T's sfio (if you already
-have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
-problems with some extension modules.  Using PerlIO with stdio is safe,
-but it is slower than plain stdio and therefore is not the default.
-
-If this doesn't make any sense to you, just accept the default '$dflt'.
-EOM
-rp='Use the experimental PerlIO abstraction layer?'
-. ./myread
-case "$ans" in
-y|Y) 
-       val="$define"
-       ;;     
-*)      
-       echo "Ok, doing things the stdio way"
-       val="$undef"
-       ;;
-esac
-set useperlio
-eval $setvar 
-
 case "$vendorprefix" in
 '')    d_vendorbin="$undef"
        vendorbin=''
@@ -7537,82 +7644,6 @@ fi
 set qgcvt d_qgcvt
 eval $inlibc
 
-: check for length of double
-echo " "
-case "$doublesize" in
-'')
-       echo "Checking to see how big your double precision numbers are..." >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-    printf("%d\n", (int)sizeof(double));
-    exit(0);
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               doublesize=`./try`
-               echo "Your double is $doublesize bytes long."
-       else
-               dflt='8'
-               echo "(I can't seem to compile the test program.  Guessing...)"
-               rp="What is the size of a double precision number (in bytes)?"
-               . ./myread
-               doublesize="$ans"
-       fi
-       ;;
-esac
-$rm -f try.c try
-
-: check for long doubles
-echo " "
-echo "Checking to see if you have long double..." >&4
-echo 'int main() { long double x = 7.0; }' > try.c
-set try
-if eval $compile; then
-       val="$define"
-       echo "You have long double."
-else
-       val="$undef"
-       echo "You do not have long double."
-fi
-$rm try.*
-set d_longdbl
-eval $setvar
-
-: check for length of long double
-case "${d_longdbl}${longdblsize}" in
-$define)
-       echo " "
-       echo "Checking to see how big your long doubles are..." >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-       printf("%d\n", sizeof(long double));
-}
-EOCP
-       set try
-       set try
-       if eval $compile; then
-               longdblsize=`./try$exe_ext`
-               echo "Your long doubles are $longdblsize bytes long."
-       else
-               dflt='8'
-               echo " "
-               echo "(I can't seem to compile the test program.  Guessing...)" >&4
-               rp="What is the size of a long double (in bytes)?"
-               . ./myread
-               longdblsize="$ans"
-       fi
-       if $test "X$doublesize" = "X$longdblsize"; then
-               echo "(That isn't any different from an ordinary double.)"
-       fi      
-       ;;
-esac
-$rm -f try.* try
-
 echo " "
 
 if $test X"$d_longdbl" = X"$define"; then
@@ -7634,7 +7665,7 @@ EOCP
                case "$yyy" in
                123.456)
                        sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
-                       sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
+                       sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
                        echo "We will use %f."
                        ;;
                esac
@@ -7656,7 +7687,7 @@ EOCP
                case "$yyy" in
                123.456)
                        sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
-                       sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
+                       sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
                        echo "We will use %llf."
                        ;;
                esac
@@ -7678,7 +7709,7 @@ EOCP
                case "$yyy" in
                123.456)
                        sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
-                       sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
+                       sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
                        echo "We will use %Lf."
                        ;;
                esac
@@ -7700,7 +7731,7 @@ EOCP
                case "$yyy" in
                123.456)
                        sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
-                       sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
+                       sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
                        echo "We will use %lf."
                        ;;
                esac
@@ -7709,6 +7740,8 @@ fi
 
 if $test X"$sPRIfldbl" = X; then
        echo "Cannot figure out how to print long doubles." >&4
+else
+       sSCNfldbl=$sPRIfldbl    # expect consistency
 fi
 
 $rm -f try try.*
@@ -7717,10 +7750,12 @@ fi # d_longdbl
 
 case "$sPRIfldbl" in
 '')    d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
-       d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
+       d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
+       d_SCNfldbl="$undef";
        ;;
 *)     d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
-       d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
+       d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
+       d_SCNfldbl="$define";
        ;;
 esac
 
@@ -7832,17 +7867,22 @@ int main()
        Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
        checkit("-100000", buf);
 
+       Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
+       checkit("123.456", buf);
+
        exit(0);
 }
 EOP
 case "$d_Gconvert" in
 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
-*) xxx_list='sprintf gconvert gcvt' ;;
+sprintf*) xxx_list='sprintf gconvert gcvt' ;;
+*) xxx_list='gconvert gcvt sprintf' ;;
 esac
 
 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
 "$define$define$define")
+    # for long doubles prefer first qgcvt, then sprintf
     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
     xxx_list="sprintf $xxx_list"
     case "$d_qgcvt" in
@@ -7880,6 +7920,10 @@ qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
    ;;  
 esac
 
+: see if _fwalk exists
+set fwalk d__fwalk
+eval $inlibc
+
 : Initialize h_fcntl
 h_fcntl=false
 
@@ -7911,15 +7955,15 @@ int main() {
 EOCP
        : check sys/file.h first, no particular reason here
        if $test `./findhdr sys/file.h` && \
-               $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
+               $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
                h_sysfile=true;
                echo "<sys/file.h> defines the *_OK access constants." >&4
        elif $test `./findhdr fcntl.h` && \
-               $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
+               $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
                h_fcntl=true;
                echo "<fcntl.h> defines the *_OK access constants." >&4
        elif $test `./findhdr unistd.h` && \
-               $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
+               $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
                echo "<unistd.h> defines the *_OK access constants." >&4
        else
                echo "I can't find the four *_OK access constants--I'll use mine." >&4
@@ -8009,10 +8053,10 @@ int main()
        exit(1);
 }
 EOP
-       if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
+       if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
                echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
                val="$define"
-       elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
+       elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
                echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
                val="$undef"
        else
@@ -8071,10 +8115,10 @@ int main()
        exit(1);
 }
 EOP
-       if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
+       if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
                echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
                val="$define"
-       elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
+       elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
                echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
                val="$undef"
        else
@@ -8626,8 +8670,8 @@ EOM
        : Call the object file tmp-dyna.o in case dlext=o.
        if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
                mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
-               $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
-               $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
+               $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
+               $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
                xxx=`./fred`
                case $xxx in
                1)      echo "Test program failed using dlopen." >&4
@@ -8782,11 +8826,11 @@ esac
 case "$h_sysfile" in
 true) echo "#include <sys/file.h>" > head.c;;
 *)
-       case "$h_fcntl" in
-       true) echo "#include <fcntl.h>" > head.c;;
-       *) echo "#include <sys/fcntl.h>" > head.c;;
-       esac
-       ;;
+       case "$h_fcntl" in
+       true) echo "#include <fcntl.h>" > head.c;;
+       *) echo "#include <sys/fcntl.h>" > head.c;;
+       esac
+       ;;
 esac
 echo " "
 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
@@ -8866,8 +8910,12 @@ int main()
                int ret;
                close(pd[1]);   /* Parent reads from pd[0] */
                close(pu[0]);   /* Parent writes (blocking) to pu[1] */
+#ifdef F_SETFL
                if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
                        exit(1);
+#else
+               exit(4);
+#endif
                signal(SIGALRM, blech);
                alarm(5);
                if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
@@ -8914,6 +8962,7 @@ EOCP
                1) echo "Could not perform non-blocking setting!";;
                2) echo "I did a successful read() for something that was not there!";;
                3) echo "Hmm... non-blocking I/O does not seem to be working!";;
+               4) echo "Could not find F_SETFL!";;
                *) echo "Something terribly wrong happened during testing.";;
                esac
                rd_nodata=`$cat try.ret`
@@ -8979,6 +9028,54 @@ eval $inlibc
 set fcntl d_fcntl
 eval $inlibc
 
+echo " "
+: See if fcntl-based locking works.
+$cat >try.c <<'EOCP'
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+int main() {
+#if defined(F_SETLK) && defined(F_SETLKW)
+     struct flock flock;
+     int retval, fd;
+     fd = open("try.c", O_RDONLY);
+     flock.l_type = F_RDLCK;
+     flock.l_whence = SEEK_SET;
+     flock.l_start = flock.l_len = 0;
+     retval = fcntl(fd, F_SETLK, &flock);
+     close(fd);
+     (retval < 0 ? exit(2) : exit(0));
+#else
+     exit(2);
+#endif
+}
+EOCP
+echo "Checking if fcntl-based file locking works... "
+case "$d_fcntl" in
+"$define")
+       set try
+       if eval $compile_ok; then
+               if ./try; then
+                       echo "Yes, it seems to work."
+                       val="$define"
+               else
+                       echo "Nope, it didn't work."
+                       val="$undef"
+               fi
+       else
+               echo "I'm unable to compile the test program, so I'll assume not."
+               val="$undef"
+       fi
+       ;;
+*) val="$undef";
+       echo "Nope, since you don't even have fcntl()."
+       ;;
+esac
+set d_fcntl_can_lock
+eval $setvar
+$rm -f try*
+
+
 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
@@ -9355,6 +9452,10 @@ set fstatvfs d_fstatvfs
 eval $inlibc
 
 
+: see if fsync exists
+set fsync d_fsync
+eval $inlibc
+
 : see if ftello exists
 set ftello d_ftello
 eval $inlibc
@@ -9514,6 +9615,10 @@ echo " "
 set d_getnetprotos getnetent $i_netdb netdb.h
 eval $hasproto
 
+: see if getpagesize exists
+set getpagesize d_getpagsz
+eval $inlibc
+
 
 : see if getprotobyname exists
 set getprotobyname d_getpbyname
@@ -10176,12 +10281,43 @@ rp="What is the size of a character (in bytes)?"
 charsize="$ans"
 $rm -f try.c try
 
-
+: check for volatile keyword
 echo " "
-$echo "Choosing the C types to be used for Perl's internal types..." >&4
-
-case "$use64bitint:$d_quad:$quadtype" in
-define:define:?*)
+echo 'Checking to see if your C compiler knows about "volatile"...' >&4
+$cat >try.c <<'EOCP'
+int main()
+{
+       typedef struct _goo_struct goo_struct;
+       goo_struct * volatile goo = ((goo_struct *)0);
+       struct _goo_struct {
+               long long_int;
+               int reg_int;
+               char char_var;
+       };
+       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
+       val="$define"
+       echo "Yup, it does."
+else
+       val="$undef"
+       echo "Nope, it doesn't."
+fi
+set d_volatile
+eval $setvar
+$rm -f try.*
+
+
+echo " "
+$echo "Choosing the C types to be used for Perl's internal types..." >&4
+
+case "$use64bitint:$d_quad:$quadtype" in
+define:define:?*)
        ivtype="$quadtype"
        uvtype="$uquadtype"
        ivsize=8
@@ -10354,67 +10490,67 @@ case "$i64type" in
        ;;
 esac
 
-$echo "Checking whether your NVs can preserve your UVs..." >&4
+$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
+: volatile so that the compiler has to store it out to memory.
+if test X"$d_volatile" = X"$define"; then
+       volatile=volatile
+fi
 $cat <<EOP >try.c
 #include <stdio.h>
-int main() {
-    $uvtype k = ($uvtype)~0, l;
-    $nvtype d;
-    l = k;
-    d = ($nvtype)l;
-    l = ($uvtype)d;
-    if (l == k)
-       printf("preserve\n");
-    exit(0);
-}
-EOP
-set try
-if eval $compile; then
-       case "`./try$exe_ext`" in
-       preserve) d_nv_preserves_uv="$define" ;;
-       esac
-fi     
-case "$d_nv_preserves_uv" in
-$define) $echo "Yes, they can."  2>&1 ;;
-*)      $echo "No, they can't." 2>&1
-        d_nv_preserves_uv="$undef"
-        ;;
-esac
-
-$rm -f try.* try
-
-case "$d_nv_preserves_uv" in
-"$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
-*)     $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
-       $cat <<EOP >try.c
-#include <stdio.h>
+#include <sys/types.h>
+#include <signal.h>
+#ifdef SIGFPE
+$volatile int bletched = 0;
+$signal_t blech(s) int s; { bletched = 1; }
+#endif
 int main() {
     $uvtype u = 0;
+    $nvtype d;
     int     n = 8 * $uvsize;
     int     i;
+#ifdef SIGFPE
+    signal(SIGFPE, blech);
+#endif
+
     for (i = 0; i < n; i++) {
       u = u << 1 | ($uvtype)1;
-      if (($uvtype)($nvtype)u != u)
+      d = ($nvtype)u;
+      if (($uvtype)d != u)
+        break;
+      if (d <= 0)
+       break;
+      d = ($nvtype)(u - 1);
+      if (($uvtype)d != (u - 1))
         break;
+#ifdef SIGFPE
+      if (bletched) {
+       break;
+#endif
+      }        
     }
-    printf("%d\n", i);
+    printf("%d\n", ((i == n) ? -n : i));
     exit(0);
 }
 EOP
-       set try
-       if eval $compile; then
-               d_nv_preserves_uv_bits="`./try$exe_ext`"
-       fi
-       case "$d_nv_preserves_uv_bits" in
-       [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
-       *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
-               d_nv_preserves_uv_bits="$undef"
-               ;;
-       esac
-       $rm -f try.* try
+set try
+
+d_nv_preserves_uv="$undef"
+if eval $compile; then
+       d_nv_preserves_uv_bits="`./try$exe_ext`"
+fi
+case "$d_nv_preserves_uv_bits" in
+\-[1-9]*)      
+       d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
+       $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
+       d_nv_preserves_uv="$define"
        ;;
+[1-9]*)        $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
+       d_nv_preserves_uv="$undef" ;;
+*)     $echo "Can't figure out how many bits your NVs preserve." 2>&1
+       d_nv_preserves_uv_bits="$undef" ;;
 esac
 
+$rm -f try.* try
 
 
 : check for off64_t
@@ -10929,6 +11065,11 @@ $rm -f try.* try core
 set d_sanemcmp
 eval $setvar
 
+: see if prototype for sbrk is available
+echo " "
+set d_sbrkproto sbrk $i_unistd unistd.h
+eval $hasproto
+
 : see if select exists
 set select d_select
 eval $inlibc
@@ -11289,11 +11430,6 @@ $define)
                ;;
        *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
                val="$undef"
-               : Remove sfio from list of libraries to use
-               set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
-               shift
-               libs="$*"
-               echo "libs = $libs" >&4
                ;;
        esac
        ;;
@@ -11312,6 +11448,16 @@ case "$d_sfio" in
 $define) usesfio='true';;
 *) usesfio='false';;
 esac
+case "$d_sfio" in
+$define) ;;
+*)     : Remove sfio from list of libraries to use
+       set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
+       shift
+       libs="$*"
+       echo "libs = $libs" >&4
+;;
+esac
+
 
 : see if shmctl exists
 set shmctl d_shmctl
 set d_sigaction; eval $setvar
 $rm -f try try$_o try.c
 
+: see if sigprocmask exists
+set sigprocmask d_sigprocmask
+eval $inlibc
+
 : see if sigsetjmp exists
 echo " "
 case "$d_sigsetjmp" in
@@ -11470,6 +11620,10 @@ set d_sigsetjmp
 eval $setvar
 $rm -f try.c try
 
+: see if sockatmark exists
+set sockatmark d_sockatmark
+eval $inlibc
+
 : see if socks5_init exists
 set socks5_init d_socks5_init
 eval $inlibc
@@ -11527,7 +11681,28 @@ esac
 
 : see if _ptr and _cnt from stdio act std
 echo " "
-if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
+
+if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
+       echo "(Looks like you have stdio.h from BSD.)"
+       case "$stdio_ptr" in
+       '') stdio_ptr='((fp)->_p)'
+               ptr_lval=$define
+               ;;
+       *)      ptr_lval=$d_stdio_ptr_lval;;
+       esac
+       case "$stdio_cnt" in
+       '') stdio_cnt='((fp)->_r)'
+               cnt_lval=$define
+               ;;
+       *)      cnt_lval=$d_stdio_cnt_lval;;
+       esac
+       case "$stdio_base" in
+       '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
+       esac
+       case "$stdio_bufsiz" in
+       '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
+       esac
+elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
        echo "(Looks like you have stdio.h from Linux.)"
        case "$stdio_ptr" in
        '') stdio_ptr='((fp)->_IO_read_ptr)'
@@ -11567,6 +11742,7 @@ else
        '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
        esac
 fi
+
 : test whether _ptr and _cnt really work
 echo "Checking how std your stdio is..." >&4
 $cat >try.c <<EOP
@@ -11616,6 +11792,93 @@ esac
 set d_stdio_cnt_lval
 eval $setvar
 
+
+: test whether setting _ptr sets _cnt as a side effect
+d_stdio_ptr_lval_sets_cnt="$undef"
+d_stdio_ptr_lval_nochange_cnt="$undef"
+case "$d_stdio_ptr_lval$d_stdstdio" in
+$define$define)
+       echo "Checking to see what happens if we set the stdio ptr..." >&4
+$cat >try.c <<EOP
+#include <stdio.h>
+/* Can we scream? */
+/* Eat dust sed :-) */
+/* In the buffer space, no one can hear you scream. */
+#define FILE_ptr(fp)   $stdio_ptr
+#define FILE_cnt(fp)   $stdio_cnt
+#include <sys/types.h>
+int main() {
+       FILE *fp = fopen("try.c", "r");
+       int c;
+       char *ptr;
+       size_t cnt;
+       if (!fp) {
+           puts("Fail even to read");
+           exit(1);
+       }
+       c = getc(fp); /* Read away the first # */
+       if (c == EOF) {
+           puts("Fail even to read");
+           exit(1);
+       }
+       if (!(
+               18 <= FILE_cnt(fp) &&
+               strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
+       )) {
+               puts("Fail even to read");
+               exit (1);
+       }
+       ptr = (char*) FILE_ptr(fp);
+       cnt = (size_t)FILE_cnt(fp);
+
+       FILE_ptr(fp) += 42;
+
+       if ((char*)FILE_ptr(fp) != (ptr + 42)) {
+               printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
+               exit (1);
+       }
+       if (FILE_cnt(fp) <= 20) {
+               printf ("Fail (<20 chars to test)");
+               exit (1);
+       }
+       if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
+               puts("Fail compare");
+               exit (1);
+       }
+       if (cnt == FILE_cnt(fp)) {
+               puts("Pass_unchanged");
+               exit (0);
+       }       
+       if (FILE_cnt(fp) == (cnt - 42)) {
+               puts("Pass_changed");
+               exit (0);
+       }
+       printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
+       return 1;
+
+}
+EOP
+       set try
+       if eval $compile; then
+               case `./try$exe_ext` in
+               Pass_changed)
+                       echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
+                       d_stdio_ptr_lval_sets_cnt="$define" ;;
+               Pass_unchanged)
+                       echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
+                       d_stdio_ptr_lval_nochange_cnt="$define" ;;
+               Fail*)
+                       echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
+               *)
+                       echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
+       esac
+       else
+               echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
+       fi
+       $rm -f try.c try
+       ;;
+esac
+
 : see if _base is also standard
 val="$undef"
 case "$d_stdstdio" in
@@ -11780,6 +12043,9 @@ EOM
 #ifdef __hpux
 #define strtoll __strtoll
 #endif
+#ifdef __EMX__
+#define strtoll _strtoll
+#endif
 #include <stdio.h>
 extern long long int strtoll(char *s, char **, int); 
 static int bad = 0;
@@ -11806,7 +12072,8 @@ int main() {
 EOCP
        set try
        if eval $compile; then
-               case "`./try`" in
+               yyy=`./try`
+               case "$yyy" in
                ok) echo "Your strtoll() seems to be working okay." ;;
                *) cat <<EOM >&4
 Your strtoll() doesn't seem to be working okay.
@@ -11814,14 +12081,94 @@ EOM
                   d_strtoll="$undef"
                   ;;
                esac
+       else
+               echo "(I can't seem to compile the test program--assuming it doesn't)"
+               d_strtoll="$undef"
        fi
        ;;
 esac
 
+: see if strtoq exists
+set strtoq d_strtoq
+eval $inlibc
+
 : see if strtoul exists
 set strtoul d_strtoul
 eval $inlibc
 
+case "$d_strtoul" in
+"$define")
+       $cat <<EOM
+Checking whether your strtoul() works okay...
+EOM
+       $cat >try.c <<'EOCP'
+#include <errno.h>
+#include <stdio.h>
+extern unsigned long int strtoul(char *s, char **, int); 
+static int bad = 0;
+void check(char *s, unsigned long eul, int een) {
+       unsigned long gul;
+       errno = 0;
+       gul = strtoul(s, 0, 10);
+       if (!((gul == eul) && (errno == een)))
+               bad++;
+}
+int main() {
+       check(" 1", 1L, 0);
+       check(" 0", 0L, 0);
+EOCP
+       case "$longsize" in
+       8)
+           $cat >>try.c <<'EOCP'
+       check("18446744073709551615", 18446744073709551615UL, 0);
+       check("18446744073709551616", 18446744073709551615UL, ERANGE);
+#if 0 /* strtoul() for /^-/ strings is undefined. */
+       check("-1", 18446744073709551615UL, 0);
+       check("-18446744073709551614", 2, 0);
+       check("-18446744073709551615", 1, 0);
+               check("-18446744073709551616", 18446744073709551615UL, ERANGE);
+       check("-18446744073709551617", 18446744073709551615UL, ERANGE);
+#endif
+EOCP
+               ;;
+       4)
+                   $cat >>try.c <<'EOCP'
+       check("4294967295", 4294967295UL, 0);
+       check("4294967296", 4294967295UL, ERANGE);
+#if 0 /* strtoul() for /^-/ strings is undefined. */
+       check("-1", 4294967295UL, 0);
+       check("-4294967294", 2, 0);
+       check("-4294967295", 1, 0);
+               check("-4294967296", 4294967295UL, ERANGE);
+       check("-4294967297", 4294967295UL, ERANGE);
+#endif
+EOCP
+               ;;
+       *)
+: Should we write these tests to be more portable by sprintf-ing
+: ~0 and then manipulating that char string as input for strtol?
+               ;;
+       esac
+       $cat >>try.c <<'EOCP'
+       if (!bad)
+               printf("ok\n");
+       return 0;
+}
+EOCP
+       set try
+       if eval $compile; then
+               case "`./try`" in
+               ok) echo "Your strtoul() seems to be working okay." ;;
+               *) cat <<EOM >&4
+Your strtoul() doesn't seem to be working okay.
+EOM
+                  d_strtoul="$undef"
+                  ;;
+               esac
+       fi
+       ;;
+esac
+
 : see if strtoull exists
 set strtoull d_strtoull
 eval $inlibc
@@ -11847,10 +12194,17 @@ int check(char *s, long long eull, int een) {
                bad++;
 }
 int main() {
-       check(" 1",                                       1LL, 0);
-       check(" 0",                                       0LL, 0);
-       check("18446744073709551615", 18446744073709551615ULL, 0);
-       check("18446744073709551616", 18446744073709551615ULL, ERANGE);
+       check(" 1",                                        1LL, 0);
+       check(" 0",                                        0LL, 0);
+       check("18446744073709551615",  18446744073709551615ULL, 0);
+       check("18446744073709551616",  18446744073709551615ULL, ERANGE);
+#if 0 /* strtoull() for /^-/ strings is undefined. */
+       check("-1",                    18446744073709551615ULL, 0);
+       check("-18446744073709551614",                     2LL, 0);
+       check("-18446744073709551615",                     1LL, 0);
+               check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
+       check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
+#endif
        if (!bad)
                printf("ok\n");
 }
@@ -11873,6 +12227,54 @@ esac
 set strtouq d_strtouq
 eval $inlibc
 
+case "$d_strtouq" in
+"$define")
+       $cat <<EOM
+Checking whether your strtouq() works okay...
+EOM
+       $cat >try.c <<'EOCP'
+#include <errno.h>
+#include <stdio.h>
+extern unsigned long long int strtouq(char *s, char **, int); 
+static int bad = 0;
+void check(char *s, unsigned long long eull, int een) {
+       unsigned long long gull;
+       errno = 0;
+       gull = strtouq(s, 0, 10);
+       if (!((gull == eull) && (errno == een)))
+               bad++;
+}
+int main() {
+       check(" 1",                                        1LL, 0);
+       check(" 0",                                        0LL, 0);
+       check("18446744073709551615",  18446744073709551615ULL, 0);
+       check("18446744073709551616",  18446744073709551615ULL, ERANGE);
+#if 0 /* strtouq() for /^-/ strings is undefined. */
+       check("-1",                    18446744073709551615ULL, 0);
+       check("-18446744073709551614",                     2LL, 0);
+       check("-18446744073709551615",                     1LL, 0);
+               check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
+       check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
+#endif
+       if (!bad)
+               printf("ok\n");
+       return 0;
+}
+EOCP
+       set try
+       if eval $compile; then
+               case "`./try`" in
+               ok) echo "Your strtouq() seems to be working okay." ;;
+               *) cat <<EOM >&4
+Your strtouq() doesn't seem to be working okay.
+EOM
+                  d_strtouq="$undef"
+                  ;;
+               esac
+       fi
+       ;;
+esac
+
 : see if strxfrm exists
 set strxfrm d_strxfrm
 eval $inlibc
@@ -12064,37 +12466,6 @@ esac
 set d_void_closedir
 eval $setvar
 $rm -f closedir*
-: check for volatile keyword
-echo " "
-echo 'Checking to see if your C compiler knows about "volatile"...' >&4
-$cat >try.c <<'EOCP'
-int main()
-{
-       typedef struct _goo_struct goo_struct;
-       goo_struct * volatile goo = ((goo_struct *)0);
-       struct _goo_struct {
-               long long_int;
-               int reg_int;
-               char char_var;
-       };
-       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
-       val="$define"
-       echo "Yup, it does."
-else
-       val="$undef"
-       echo "Nope, it doesn't."
-fi
-set d_volatile
-eval $setvar
-$rm -f try.*
-
 : see if there is a wait4
 set wait4 d_wait4
 eval $inlibc
@@ -12702,14 +13073,14 @@ val=$undef
 set tebcdic
 if eval $compile_ok; then
        if ./tebcdic; then
-               echo "You have EBCDIC." >&4
+               echo "You seem to speak EBCDIC." >&4
                val="$define"
        else
-               echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
+               echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
        fi
 else
        echo "I'm unable to compile the test program." >&4
-       echo "I'll assume ASCII or some ISO Latin." >&4
+       echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
 fi
 $rm -f tebcdic.c tebcdic
 set ebcdic
@@ -13117,7 +13488,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
-                       sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
+                       sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
                        echo "We will use %d."
                        ;;
                esac
@@ -13139,7 +13510,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
-                       sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
+                       sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
                        echo "We will use %ld."
                        ;;
                esac
@@ -13162,7 +13533,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
-                       sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
+                       sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
                        echo "We will use the C9X style."
                        ;;
                esac
@@ -13174,7 +13545,7 @@ if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
 #include <sys/types.h>
 #include <stdio.h>
 int main() {
-  long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
+  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
   printf("%lld\n", q);
 }
 EOCP
@@ -13184,7 +13555,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
-                       sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
+                       sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
                        echo "We will use the %lld style."
                        ;;
                esac
@@ -13206,7 +13577,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
-                       sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
+                       sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
                        echo "We will use %Ld."
                        ;;
                esac
@@ -13228,7 +13599,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
-                       sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
+                       sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
                        echo "We will use %qd."
                        ;;
                esac
 
 case "$sPRId64" in
 '')    d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
-       d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
+       d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
        ;;
 *)     d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
-       d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
+       d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
        ;;
 esac
 
@@ -13261,21 +13632,21 @@ if $test X"$ivsize" = X8; then
        uvuformat="$sPRIu64"
        uvoformat="$sPRIo64"
        uvxformat="$sPRIx64"
-       uvXformat="$sPRIX64"
+       uvXUformat="$sPRIXU64"
 else
        if $test X"$ivsize" = X"$longsize"; then
                ivdformat='"ld"'
                uvuformat='"lu"'
                uvoformat='"lo"'
                uvxformat='"lx"'
-               uvXformat='"lX"'
+               uvXUformat='"lX"'
        else
                if $test X"$ivsize" = X"$intsize"; then
                        ivdformat='"d"'
                        uvuformat='"u"'
                        uvoformat='"o"'
                        uvxformat='"x"'
-                       uvXformat='"X"'
+                       uvXUformat='"X"'
                else
                        : far out
                        if $test X"$ivsize" = X"$shortsize"; then
@@ -13283,7 +13654,7 @@ else
                                uvuformat='"hu"'
                                uvoformat='"ho"'
                                uvxformat='"hx"'
-                               uvXformat='"hX"'
+                               uvXUformat='"hX"'
                        fi
                fi
        fi
@@ -13293,16 +13664,16 @@ if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PR
        nveformat="$sPRIeldbl"
        nvfformat="$sPRIfldbl"
        nvgformat="$sPRIgldbl"
-       nvEformat="$sPRIEldbl"
-       nvFformat="$sPRIFldbl"
-       nvGformat="$sPRIGldbl"
+       nvEUformat="$sPRIEUldbl"
+       nvFUformat="$sPRIFUldbl"
+       nvGUformat="$sPRIGUldbl"
 else
        nveformat='"e"'
        nvfformat='"f"'
        nvgformat='"g"'
-       nvEformat='"E"'
-       nvFformat='"F"'
-       nvGformat='"G"'
+       nvEUformat='"E"'
+       nvFUformat='"F"'
+       nvGUformat='"G"'
 fi
 
 case "$ivdformat" in
@@ -13404,18 +13775,180 @@ rp="What is the type used for file modes for system calls (e.g. fchmod())?"
 set mode_t modetype int stdio.h sys/types.h
 eval $typedef_ask
 
-: define a fucntion to check prototypes
-$cat > protochk <<EOSH
-$startsh
-cc="$cc"
-optimize="$optimize"
-ccflags="$ccflags"
-prototype="$prototype"
-define="$define"
-rm=$rm
-EOSH
+: see if stdarg is available
+echo " "
+if $test `./findhdr stdarg.h`; then
+       echo "<stdarg.h> found." >&4
+       valstd="$define"
+else
+       echo "<stdarg.h> NOT found." >&4
+       valstd="$undef"
+fi
 
-$cat >> protochk <<'EOSH'
+: see if varags is available
+echo " "
+if $test `./findhdr varargs.h`; then
+       echo "<varargs.h> found." >&4
+else
+       echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
+fi
+
+: set up the varargs testing programs
+$cat > varargs.c <<EOP
+#ifdef I_STDARG
+#include <stdarg.h>
+#endif
+#ifdef I_VARARGS
+#include <varargs.h>
+#endif
+
+#ifdef I_STDARG
+int f(char *p, ...)
+#else
+int f(va_alist)
+va_dcl
+#endif
+{
+       va_list ap;
+#ifndef I_STDARG
+       char *p;
+#endif
+#ifdef I_STDARG
+       va_start(ap,p);
+#else
+       va_start(ap);
+       p = va_arg(ap, char *);
+#endif
+       va_end(ap);
+}
+EOP
+$cat > varargs <<EOP
+$startsh
+if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
+       echo "true"
+else
+       echo "false"
+fi
+$rm -f varargs$_o
+EOP
+chmod +x varargs
+
+: now check which varargs header should be included
+echo " "
+i_varhdr=''
+case "$valstd" in
+"$define")
+       if `./varargs I_STDARG`; then
+               val='stdarg.h'
+       elif `./varargs I_VARARGS`; then
+               val='varargs.h'
+       fi
+       ;;
+*)
+       if `./varargs I_VARARGS`; then
+               val='varargs.h'
+       fi
+       ;;
+esac
+case "$val" in
+'')
+echo "I could not find the definition for va_dcl... You have problems..." >&4
+       val="$undef"; set i_stdarg; eval $setvar
+       val="$undef"; set i_varargs; eval $setvar
+       ;;
+*) 
+       set i_varhdr
+       eval $setvar
+       case "$i_varhdr" in
+       stdarg.h)
+               val="$define"; set i_stdarg; eval $setvar
+               val="$undef"; set i_varargs; eval $setvar
+               ;;
+       varargs.h)
+               val="$undef"; set i_stdarg; eval $setvar
+               val="$define"; set i_varargs; eval $setvar
+               ;;
+       esac
+       echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
+esac
+$rm -f varargs*
+
+: see if we need va_copy
+echo " "
+case "$i_stdarg" in
+"$define")
+       $cat >try.c <<EOCP
+#include <stdarg.h>
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#include <signal.h>
+
+int
+ivfprintf(FILE *f, const char *fmt, va_list *valp)
+{
+  return vfprintf(f, fmt, *valp);
+}
+int    
+myvfprintf(FILE *f, const  char *fmt, va_list val)
+{
+  return ivfprintf(f, fmt, &val);
+}
+      
+int
+myprintf(char *fmt, ...) 
+{
+  va_list val;
+  va_start(val, fmt);
+  return myvfprintf(stdout, fmt, val); 
+}         
+
+int
+main(int ac, char **av)
+{
+  signal(SIGSEGV, exit);
+
+  myprintf("%s%cs all right, then\n", "that", '\'');                            
+  exit(0);      
+}
+EOCP
+       set try
+       if eval $compile && ./try 2>&1 >/dev/null; then
+               case "`./try`" in
+               "that's all right, then")
+                       okay=yes
+                       ;;
+               esac
+       fi
+       case "$okay" in
+       yes)    echo "It seems that you don't need va_copy()." >&4
+               need_va_copy="$undef"
+               ;;
+       *)      echo "It seems that va_copy() or similar will be needed." >&4
+               need_va_copy="$define"
+               ;;
+       esac
+       $rm -f try.* core core.* *.core *.core.*
+       ;;
+*)     echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
+       ;;
+esac
+
+: define a fucntion to check prototypes
+$cat > protochk <<EOSH
+$startsh
+cc="$cc"
+optimize="$optimize"
+ccflags="$ccflags"
+prototype="$prototype"
+define="$define"
+rm=$rm
+EOSH
+
+$cat >> protochk <<'EOSH'
 
 $rm -f try.c
 foo="$1"
@@ -13583,12 +14116,15 @@ case "$pager" in
        dflt=''
        case "$pg" in
        /*) dflt=$pg;;
+       [a-zA-Z]:/*) dflt=$pg;;
        esac
        case "$more" in
        /*) dflt=$more;;
+       [a-zA-Z]:/*) dflt=$more;;
        esac
        case "$less" in
        /*) dflt=$less;;
+       [a-zA-Z]:/*) dflt=$less;;
        esac
        case "$dflt" in
        '') dflt=/usr/ucb/more;;
@@ -13661,13 +14197,13 @@ $cc $ccflags -c bar1.c >/dev/null 2>&1
 $cc $ccflags -c bar2.c >/dev/null 2>&1
 $cc $ccflags -c foo.c >/dev/null 2>&1
 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
-if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
+if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        ./foobar >/dev/null 2>&1; then
        echo "$ar appears to generate random libraries itself."
        orderlib=false
        ranlib=":"
 elif $ar ts bar$_a >/dev/null 2>&1 &&
-       $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
+       $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        ./foobar >/dev/null 2>&1; then
                echo "a table of contents needs to be added with '$ar ts'."
                orderlib=false
@@ -14099,6 +14635,7 @@ echo $sig_name | $awk \
        }
        printf "\n"
 }'
+sig_size=`echo $sig_name | awk '{print NF}'`
 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
 
 echo " "
@@ -14158,6 +14695,10 @@ $rm -f try try.*
 set d_socklen_t
 eval $setvar
 
+: see if this is a socks.h system
+set socks.h i_socks
+eval $inhdr
+
 : check for type of the size argument to socket calls
 case "$d_socket" in
 "$define")
@@ -14165,7 +14706,6 @@ case "$d_socket" in
 
 Checking to see what type is the last argument of accept().
 EOM
-       hdrs="$define sys/types.h $d_socket sys/socket.h" 
        yyy=''
        case "$d_socklen_t" in
        "$define") yyy="$yyy socklen_t"
@@ -14174,10 +14714,19 @@ EOM
        for xxx in $yyy; do
                case "$socksizetype" in
                '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
-                       if ./protochk "$try" $hdrs; then
-                               echo "Your system accepts '$xxx *' for the last argument of accept()."
-                               socksizetype="$xxx"
-                       fi
+                       case "$usesocks" in
+                       "$define")
+                               if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
+                                       echo "Your system accepts '$xxx *' for the last argument of accept()."
+                                       socksizetype="$xxx"
+                               fi
+                               ;;
+                       *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
+                                       echo "Your system accepts '$xxx *' for the last argument of accept()."
+                                       socksizetype="$xxx"
+                               fi
+                               ;;
+                       esac
                        ;;
                esac
        done
@@ -14238,13 +14787,17 @@ $rm -f ssize ssize.*
 
 : see what type of char stdio uses.
 echo " "
-if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
+echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
+if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
        echo "Your stdio uses unsigned chars." >&4
        stdchar="unsigned char"
 else
        echo "Your stdio uses signed chars." >&4
        stdchar="char"
 fi
+$rm -f stdioh
+
+
 
 : see if time exists
 echo " "
@@ -14394,6 +14947,37 @@ case "$uidsign" in
        ;;
 esac
 
+: determine compiler compiler
+case "$yacc" in
+'')
+       dflt=yacc;;
+*)
+       dflt="$yacc";;
+esac
+echo " "
+comp='yacc'
+if $test -f "$byacc"; then
+       dflt="$byacc"
+       comp="byacc or $comp"
+fi
+if $test -f "$bison"; then
+       comp="$comp or bison -y"
+fi
+rp="Which compiler compiler ($comp) shall I use?"
+. ./myread
+yacc="$ans"
+case "$yacc" in
+*bis*)
+       case "$yacc" in
+       *-y*) ;;
+       *)
+               yacc="$yacc -y"
+               echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
+               ;;
+       esac
+       ;;
+esac
+
 : see if dbm.h is available
 : see if dbmclose exists
 set dbmclose d_dbmclose
@@ -14577,9 +15161,9 @@ $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
 $cat <<'EOSH' > Cppsym.know
 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
-alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
-ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
-BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
+alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
+ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
+BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
 bull c cadmus clipper CMU COFF COMPILER_VERSION
 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
@@ -14592,7 +15176,7 @@ hp200 hp300 hp700 HP700 hp800 hp9000
 hp9000s200 hp9000s300 hp9000s400 hp9000s500
 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
-iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
+IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
@@ -14608,7 +15192,7 @@ mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
 NetBSD news1500 news1700 news1800 news1900 news3700
-news700 news800 news900 NeXT NLS ns16000 ns32000
+news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
 ns32016 ns32332 ns32k nsc32000
 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
@@ -14616,7 +15200,7 @@ pc532 pdp11 PGC PIC plexus PORTAR posix
 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
 POSIX_C_SOURCE POSIX_SOURCE POWER
 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
-riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
+riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
 sony sony_news sonyrisc sparc sparclite spectrum
 stardent stdc STDC_EXT stratos sun sun3 sun386
@@ -14624,6 +15208,7 @@ Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
 sysV68 sysV88 Tek4132 Tek4300 titan
+TM3200 TM5400 TM5600
 tower tower32 tower32_200 tower32_600 tower32_700
 tower32_800 tower32_850 tss
 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
@@ -14641,7 +15226,7 @@ EOSH
 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
 $cat Cppsym.know > Cppsym.c
-$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | sort | uniq > Cppsym.know
+$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
 $rm -f Cppsym.a Cppsym.b Cppsym.c
 cat <<EOSH > Cppsym
 $startsh
@@ -14683,7 +15268,7 @@ case "$osname-$gccversion" in
 irix-) ccflags="\$ccflags -woff 1178" ;;
 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
 esac
-$cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
+$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
 EOSH
 chmod +x Cppsym.try
 $eunicefix Cppsym.try
@@ -14824,108 +15409,6 @@ val=$val3; set i_termios; eval $setvar
 set shadow.h i_shadow
 eval $inhdr
 
-: see if this is a socks.h system
-set socks.h i_socks
-eval $inhdr
-
-: see if stdarg is available
-echo " "
-if $test `./findhdr stdarg.h`; then
-       echo "<stdarg.h> found." >&4
-       valstd="$define"
-else
-       echo "<stdarg.h> NOT found." >&4
-       valstd="$undef"
-fi
-
-: see if varags is available
-echo " "
-if $test `./findhdr varargs.h`; then
-       echo "<varargs.h> found." >&4
-else
-       echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
-fi
-
-: set up the varargs testing programs
-$cat > varargs.c <<EOP
-#ifdef I_STDARG
-#include <stdarg.h>
-#endif
-#ifdef I_VARARGS
-#include <varargs.h>
-#endif
-
-#ifdef I_STDARG
-int f(char *p, ...)
-#else
-int f(va_alist)
-va_dcl
-#endif
-{
-       va_list ap;
-#ifndef I_STDARG
-       char *p;
-#endif
-#ifdef I_STDARG
-       va_start(ap,p);
-#else
-       va_start(ap);
-       p = va_arg(ap, char *);
-#endif
-       va_end(ap);
-}
-EOP
-$cat > varargs <<EOP
-$startsh
-if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
-       echo "true"
-else
-       echo "false"
-fi
-$rm -f varargs$_o
-EOP
-chmod +x varargs
-
-: now check which varargs header should be included
-echo " "
-i_varhdr=''
-case "$valstd" in
-"$define")
-       if `./varargs I_STDARG`; then
-               val='stdarg.h'
-       elif `./varargs I_VARARGS`; then
-               val='varargs.h'
-       fi
-       ;;
-*)
-       if `./varargs I_VARARGS`; then
-               val='varargs.h'
-       fi
-       ;;
-esac
-case "$val" in
-'')
-echo "I could not find the definition for va_dcl... You have problems..." >&4
-       val="$undef"; set i_stdarg; eval $setvar
-       val="$undef"; set i_varargs; eval $setvar
-       ;;
-*) 
-       set i_varhdr
-       eval $setvar
-       case "$i_varhdr" in
-       stdarg.h)
-               val="$define"; set i_stdarg; eval $setvar
-               val="$undef"; set i_varargs; eval $setvar
-               ;;
-       varargs.h)
-               val="$undef"; set i_stdarg; eval $setvar
-               val="$define"; set i_varargs; eval $setvar
-               ;;
-       esac
-       echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
-esac
-$rm -f varargs*
-
 : see if stddef is available
 set stddef.h i_stddef
 eval $inhdr
 set i_sysioctl
 eval $setvar
 
+: see if socket ioctl defs are in sys/sockio.h
+echo " "
+xxx=`./findhdr sys/sockio.h`
+if $test "$xxx"; then
+       if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
+               val="$define"
+               echo "You have socket ioctls defined in <sys/sockio.h>." >&4
+       else
+               val="$undef"
+               echo "No socket ioctls found in <sys/sockio.h>." >&4
+       fi
+else
+       val="$undef"
+       $cat <<EOM
+<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
+EOM
+fi
+set i_syssockio
+eval $setvar
+
 
 : see if this is a syslog.h system
 set syslog.h i_syslog
@@ -15297,6 +15800,25 @@ set X $dynamic_ext $static_ext $nonxs_ext
 shift
 extensions="$*"
 
+: Remove libraries needed only for extensions
+: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
+: The exception is SunOS 4.x, which needs them.
+case "${osname}X${osvers}" in
+sunos*X4*)
+    perllibs="$libs"
+    ;;
+*) case "$usedl" in
+    $define|true|[yY]*)
+           set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
+           shift
+           perllibs="$*"
+           ;;
+    *) perllibs="$libs"
+           ;;
+    esac
+    ;;
+esac
+
 : Remove build directory name from cppstdin so it can be used from
 : either the present location or the final installed location.
 echo " "
@@ -15409,7 +15931,9 @@ cccdlflags='$cccdlflags'
 ccdlflags='$ccdlflags'
 ccflags='$ccflags'
 ccflags_uselargefiles='$ccflags_uselargefiles'
+ccname='$ccname'
 ccsymbols='$ccsymbols'
+ccversion='$ccversion'
 cf_by='$cf_by'
 cf_email='$cf_email'
 cf_time='$cf_time'
@@ -15436,10 +15960,10 @@ crosscompile='$crosscompile'
 cryptlib='$cryptlib'
 csh='$csh'
 d_Gconvert='$d_Gconvert'
-d_PRIEldbl='$d_PRIEldbl'
-d_PRIFldbl='$d_PRIFldbl'
-d_PRIGldbl='$d_PRIGldbl'
-d_PRIX64='$d_PRIX64'
+d_PRIEUldbl='$d_PRIEUldbl'
+d_PRIFUldbl='$d_PRIFUldbl'
+d_PRIGUldbl='$d_PRIGUldbl'
+d_PRIXU64='$d_PRIXU64'
 d_PRId64='$d_PRId64'
 d_PRIeldbl='$d_PRIeldbl'
 d_PRIfldbl='$d_PRIfldbl'
@@ -15448,6 +15972,8 @@ d_PRIi64='$d_PRIi64'
 d_PRIo64='$d_PRIo64'
 d_PRIu64='$d_PRIu64'
 d_PRIx64='$d_PRIx64'
+d_SCNfldbl='$d_SCNfldbl'
+d__fwalk='$d__fwalk'
 d_access='$d_access'
 d_accessx='$d_accessx'
 d_alarm='$d_alarm'
@@ -15494,6 +16020,7 @@ d_eunice='$d_eunice'
 d_fchmod='$d_fchmod'
 d_fchown='$d_fchown'
 d_fcntl='$d_fcntl'
+d_fcntl_can_lock='$d_fcntl_can_lock'
 d_fd_macros='$d_fd_macros'
 d_fd_set='$d_fd_set'
 d_fds_bits='$d_fds_bits'
@@ -15509,6 +16036,7 @@ d_fseeko='$d_fseeko'
 d_fsetpos='$d_fsetpos'
 d_fstatfs='$d_fstatfs'
 d_fstatvfs='$d_fstatvfs'
+d_fsync='$d_fsync'
 d_ftello='$d_ftello'
 d_ftime='$d_ftime'
 d_getcwd='$d_getcwd'
@@ -15528,6 +16056,7 @@ d_getnbyaddr='$d_getnbyaddr'
 d_getnbyname='$d_getnbyname'
 d_getnent='$d_getnent'
 d_getnetprotos='$d_getnetprotos'
+d_getpagsz='$d_getpagsz'
 d_getpbyname='$d_getpbyname'
 d_getpbynumber='$d_getpbynumber'
 d_getpent='$d_getpent'
@@ -15631,6 +16160,7 @@ d_rmdir='$d_rmdir'
 d_safebcpy='$d_safebcpy'
 d_safemcpy='$d_safemcpy'
 d_sanemcmp='$d_sanemcmp'
+d_sbrkproto='$d_sbrkproto'
 d_sched_yield='$d_sched_yield'
 d_scm_rights='$d_scm_rights'
 d_seekdir='$d_seekdir'
@@ -15673,7 +16203,9 @@ d_shmctl='$d_shmctl'
 d_shmdt='$d_shmdt'
 d_shmget='$d_shmget'
 d_sigaction='$d_sigaction'
+d_sigprocmask='$d_sigprocmask'
 d_sigsetjmp='$d_sigsetjmp'
+d_sockatmark='$d_sockatmark'
 d_socket='$d_socket'
 d_socklen_t='$d_socklen_t'
 d_sockpair='$d_sockpair'
@@ -15685,6 +16217,8 @@ d_statfs_s='$d_statfs_s'
 d_statvfs='$d_statvfs'
 d_stdio_cnt_lval='$d_stdio_cnt_lval'
 d_stdio_ptr_lval='$d_stdio_ptr_lval'
+d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
+d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
 d_stdio_stream_array='$d_stdio_stream_array'
 d_stdiobase='$d_stdiobase'
 d_stdstdio='$d_stdstdio'
@@ -15697,6 +16231,7 @@ d_strtod='$d_strtod'
 d_strtol='$d_strtol'
 d_strtold='$d_strtold'
 d_strtoll='$d_strtoll'
+d_strtoq='$d_strtoq'
 d_strtoul='$d_strtoul'
 d_strtoull='$d_strtoull'
 d_strtouq='$d_strtouq'
@@ -15779,7 +16314,6 @@ h_fcntl='$h_fcntl'
 h_sysfile='$h_sysfile'
 hint='$hint'
 hostcat='$hostcat'
-huge='$huge'
 i16size='$i16size'
 i16type='$i16type'
 i32size='$i32size'
@@ -15889,12 +16423,12 @@ installvendorarch='$installvendorarch'
 installvendorbin='$installvendorbin'
 installvendorlib='$installvendorlib'
 intsize='$intsize'
+issymlink='$issymlink'
 ivdformat='$ivdformat'
 ivsize='$ivsize'
 ivtype='$ivtype'
 known_extensions='$known_extensions'
 ksh='$ksh'
-large='$large'
 ld='$ld'
 lddlflags='$lddlflags'
 ldflags='$ldflags'
@@ -15940,11 +16474,9 @@ man1ext='$man1ext'
 man3dir='$man3dir'
 man3direxp='$man3direxp'
 man3ext='$man3ext'
-medium='$medium'
 mips_type='$mips_type'
 mkdir='$mkdir'
 mmaptype='$mmaptype'
-models='$models'
 modetype='$modetype'
 more='$more'
 multiarch='$multiarch'
@@ -15954,6 +16486,7 @@ mydomain='$mydomain'
 myhostname='$myhostname'
 myuname='$myuname'
 n='$n'
+need_va_copy='$need_va_copy'
 netdb_hlen_type='$netdb_hlen_type'
 netdb_host_type='$netdb_host_type'
 netdb_name_type='$netdb_name_type'
@@ -15963,9 +16496,9 @@ nm_opt='$nm_opt'
 nm_so_opt='$nm_so_opt'
 nonxs_ext='$nonxs_ext'
 nroff='$nroff'
-nvEformat='$nvEformat'
-nvFformat='$nvFformat'
-nvGformat='$nvGformat'
+nvEUformat='$nvEUformat'
+nvFUformat='$nvFUformat'
+nvGUformat='$nvGUformat'
 nveformat='$nveformat'
 nvfformat='$nvfformat'
 nvgformat='$nvgformat'
@@ -15987,6 +16520,7 @@ path_sep='$path_sep'
 perl5='$perl5'
 perl='$perl'
 perladmin='$perladmin'
+perllibs='$perllibs'
 perlpath='$perlpath'
 pg='$pg'
 phostname='$phostname'
@@ -16012,10 +16546,10 @@ revision='$revision'
 rm='$rm'
 rmail='$rmail'
 runnm='$runnm'
-sPRIEldbl='$sPRIEldbl'
-sPRIFldbl='$sPRIFldbl'
-sPRIGldbl='$sPRIGldbl'
-sPRIX64='$sPRIX64'
+sPRIEUldbl='$sPRIEUldbl'
+sPRIFUldbl='$sPRIFUldbl'
+sPRIGUldbl='$sPRIGUldbl'
+sPRIXU64='$sPRIXU64'
 sPRId64='$sPRId64'
 sPRIeldbl='$sPRIeldbl'
 sPRIfldbl='$sPRIfldbl'
@@ -16024,6 +16558,7 @@ sPRIi64='$sPRIi64'
 sPRIo64='$sPRIo64'
 sPRIu64='$sPRIu64'
 sPRIx64='$sPRIx64'
+sSCNfldbl='$sSCNfldbl'
 sched_yield='$sched_yield'
 scriptdir='$scriptdir'
 scriptdirexp='$scriptdirexp'
@@ -16044,6 +16579,7 @@ sig_name='$sig_name'
 sig_name_init='$sig_name_init'
 sig_num='$sig_num'
 sig_num_init='$sig_num_init'
+sig_size='$sig_size'
 signal_t='$signal_t'
 sitearch='$sitearch'
 sitearchexp='$sitearchexp'
@@ -16058,7 +16594,6 @@ sizesize='$sizesize'
 sizetype='$sizetype'
 sleep='$sleep'
 smail='$smail'
-small='$small'
 so='$so'
 sockethdr='$sockethdr'
 socketlib='$socketlib'
@@ -16066,7 +16601,6 @@ socksizetype='$socksizetype'
 sort='$sort'
 spackage='$spackage'
 spitshell='$spitshell'
-split='$split'
 src='$src'
 ssizetype='$ssizetype'
 startperl='$startperl'
@@ -16131,7 +16665,7 @@ usevendorprefix='$usevendorprefix'
 usevfork='$usevfork'
 usrinc='$usrinc'
 uuname='$uuname'
-uvXformat='$uvXformat'
+uvXUformat='$uvXUformat'
 uvoformat='$uvoformat'
 uvsize='$uvsize'
 uvtype='$uvtype'
@@ -16147,10 +16681,13 @@ vendorlibexp='$vendorlibexp'
 vendorprefix='$vendorprefix'
 vendorprefixexp='$vendorprefixexp'
 version='$version'
+versiononly='$versiononly'
 vi='$vi'
 voidflags='$voidflags'
 xlibpth='$xlibpth'
 xs_apiversion='$xs_apiversion'
+yacc='$yacc'
+yaccflags='$yaccflags'
 zcat='$zcat'
 zip='$zip'
 EOT
@@ -16165,9 +16702,9 @@ echo "CONFIGDOTSH=true" >>config.sh
 
 : propagate old symbols
 if $test -f UU/config.sh; then
-       <UU/config.sh sort | uniq >UU/oldconfig.sh
+       <UU/config.sh $sort | $uniq >UU/oldconfig.sh
        sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
-       sort | uniq -u >UU/oldsyms
+       $sort | $uniq -u >UU/oldsyms
        set X `cat UU/oldsyms`
        shift
        case $# in
@@ -16241,7 +16778,7 @@ EOM
        . UU/myread
        case "$ans" in
        y*)
-               $make depend && echo "Now you must run a $make."
+               $make depend && echo "Now you must run '$make'."
                ;;
        *)
                echo "You must run '$make depend' then '$make'."