This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[patch] rid local_patches warnings
[perl5.git] / Configure
index 89df03f..075963f 100755 (executable)
--- a/Configure
+++ b/Configure
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Sat Nov  4 01:58:40 EET 2000 [metaconfig 3.0 PL70]
+# Generated on Tue Jun 12 02:31:11 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
@@ -273,6 +273,7 @@ lib_ext=''
 obj_ext=''
 path_sep=''
 afs=''
+afsroot=''
 alignbytes=''
 ansi2knr=''
 archlib=''
@@ -308,6 +309,7 @@ cppminus=''
 cpprun=''
 cppstdin=''
 crosscompile=''
+d__fwalk=''
 d_access=''
 d_accessx=''
 d_alarm=''
@@ -323,6 +325,7 @@ d_chroot=''
 d_chsize=''
 d_closedir=''
 d_void_closedir=''
+d_cmsghdr_s=''
 d_const=''
 cryptlib=''
 d_crypt=''
@@ -330,6 +333,7 @@ d_csh=''
 full_csh=''
 d_cuserid=''
 d_dbl_dig=''
+d_dbminitproto=''
 d_difftime=''
 d_dlerror=''
 d_dlopen=''
@@ -355,6 +359,7 @@ d_fds_bits=''
 d_fgetpos=''
 d_flexfnam=''
 d_flock=''
+d_flockproto=''
 d_fork=''
 d_fpos64_t=''
 d_frexpl=''
@@ -362,6 +367,7 @@ d_fs_data_s=''
 d_fseeko=''
 d_fsetpos=''
 d_fstatfs=''
+d_fsync=''
 d_ftello=''
 d_ftime=''
 d_gettimeod=''
@@ -379,6 +385,7 @@ d_gethname=''
 d_phostname=''
 d_uname=''
 d_gethostprotos=''
+d_getitimer=''
 d_getlogin=''
 d_getmnt=''
 d_getmntent=''
@@ -386,6 +393,7 @@ d_getnbyaddr=''
 d_getnbyname=''
 d_getnent=''
 d_getnetprotos=''
+d_getpagsz=''
 d_getpent=''
 d_getpgid=''
 d_getpgrp2=''
@@ -442,10 +450,12 @@ d_mktime=''
 d_mmap=''
 mmaptype=''
 d_modfl=''
+d_modfl_pow32_bug=''
 d_mprotect=''
 d_msg=''
 d_msgctl=''
 d_msgget=''
+d_msghdr_s=''
 d_msgrcv=''
 d_msgsnd=''
 d_msync=''
@@ -470,21 +480,27 @@ d_rewinddir=''
 d_seekdir=''
 d_telldir=''
 d_readlink=''
+d_readv=''
+d_realpath=''
+d_recvmsg=''
 d_rename=''
 d_rmdir=''
 d_safebcpy=''
 d_safemcpy=''
 d_sanemcmp=''
+d_sbrkproto=''
 d_select=''
 d_sem=''
 d_semctl=''
 d_semget=''
 d_semop=''
+d_sendmsg=''
 d_setegid=''
 d_seteuid=''
 d_setgrent=''
 d_setgrps=''
 d_sethent=''
+d_setitimer=''
 d_setlinebuf=''
 d_setlocale=''
 d_setnent=''
@@ -515,7 +531,10 @@ d_shmctl=''
 d_shmdt=''
 d_shmget=''
 d_sigaction=''
+d_sigprocmask=''
 d_sigsetjmp=''
+d_sockatmark=''
+d_sockatmarkproto=''
 d_msg_ctrunc=''
 d_msg_dontroute=''
 d_msg_oob=''
@@ -530,6 +549,8 @@ socketlib=''
 d_socklen_t=''
 d_socks5_init=''
 d_sqrtl=''
+d_sresgproto=''
+d_sresuproto=''
 d_statblks=''
 d_statfs_f_flags=''
 d_statfs_s=''
@@ -554,16 +575,19 @@ d_strerrm=''
 d_strerror=''
 d_sysernlst=''
 d_syserrlst=''
+d_strftime=''
 d_strtod=''
 d_strtol=''
 d_strtold=''
 d_strtoll=''
+d_strtoq=''
 d_strtoul=''
 d_strtoull=''
 d_strtouq=''
 d_strxfrm=''
 d_symlink=''
 d_syscall=''
+d_syscallproto=''
 d_sysconf=''
 d_system=''
 d_tcgetpgrp=''
@@ -575,10 +599,14 @@ clocktype=''
 d_times=''
 d_truncate=''
 d_tzname=''
+d_u32align=''
+d_ualarm=''
 d_umask=''
 d_semctl_semid_ds=''
 d_semctl_semun=''
 d_union_semun=''
+d_usleep=''
+d_usleepproto=''
 d_ustat=''
 d_vfork=''
 usevfork=''
@@ -591,6 +619,7 @@ d_wait4=''
 d_waitpid=''
 d_wcstombs=''
 d_wctomb=''
+d_writev=''
 dlext=''
 cccdlflags=''
 ccdlflags=''
@@ -616,6 +645,9 @@ h_sysfile=''
 i_arpainet=''
 db_hashtype=''
 db_prefixtype=''
+db_version_major=''
+db_version_minor=''
+db_version_patch=''
 i_db=''
 i_dbm=''
 i_rpcsvcdbm=''
@@ -717,6 +749,7 @@ installusrbinperl=''
 intsize=''
 longsize=''
 shortsize=''
+issymlink=''
 libc=''
 ldlibpthname=''
 libperl=''
@@ -776,6 +809,7 @@ d_eofnblk=''
 eagain=''
 o_nonblock=''
 rd_nodata=''
+need_va_copy=''
 netdb_hlen_type=''
 netdb_host_type=''
 netdb_name_type=''
@@ -795,6 +829,7 @@ api_subversion=''
 api_version=''
 api_versionstring=''
 patchlevel=''
+perl_patchlevel=''
 revision=''
 subversion=''
 version=''
@@ -876,6 +911,7 @@ sig_name=''
 sig_name_init=''
 sig_num=''
 sig_num_init=''
+sig_size=''
 installsitearch=''
 sitearch=''
 sitearchexp=''
@@ -952,6 +988,8 @@ defvoidused=''
 voidflags=''
 pm_apiversion=''
 xs_apiversion=''
+yacc=''
+yaccflags=''
 CONFIG=''
 
 define='define'
@@ -1427,6 +1465,7 @@ case "$src" in
     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
          case "$src" in
         /*)    ;;
+        .)     ;;
          *)    src=`cd ../$src && pwd` ;;
         esac
          ;;
@@ -1474,10 +1513,10 @@ esac
 
 : script used to extract .SH files with variable substitutions
 cat >extract <<'EOS'
-CONFIGDOTSH=true
+PERL_CONFIG_SH=true
 echo "Doing variable substitutions on .SH files..."
-if test -f $src/MANIFEST; then
-       set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
+if test -f MANIFEST; then
+       set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
 else
        echo "(Looking for .SH files under the source directory.)"
        set x `(cd $src; find . -name "*.SH" -print)`
@@ -1560,7 +1599,7 @@ true)
        echo " "
        . UU/extract
        rm -rf UU
-       echo "Done."
+       echo "Extraction done."
        exit 0
        ;;
 esac
@@ -1792,12 +1831,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
           ;;
@@ -1806,6 +1849,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
@@ -1955,6 +2008,7 @@ uniq
 trylist="
 Mcc
 ar
+bison
 byacc
 cpp
 csh
@@ -2102,7 +2156,7 @@ int main(int argc, char *argv[]) {
   return 0;
 }
 EOM
-    if $cc -o try $ccflags try.c; then
+    if $cc -o try $ccflags $ldflags try.c; then
        :
     else
         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
@@ -2162,6 +2216,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
@@ -2264,7 +2405,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"
@@ -2675,7 +2819,6 @@ cd UU
        ;;
 esac
 test "$override" && . ./optdef.sh
-myuname="$newmyuname"
 
 : Restore computed paths
 for file in $loclist $trylist; do
@@ -2836,6 +2979,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" ;;
@@ -3017,7 +3173,7 @@ int main() {
        exit(0);
 }
 EOM
-if $cc -o gccvers $ldflags gccvers.c; then
+if $cc -o gccvers $ccflags $ldflags gccvers.c; then
        gccversion=`./gccvers`
        case "$gccversion" in
        '') echo "You are not using GNU cc." ;;
@@ -3075,6 +3231,15 @@ case "$ccname" in
 '') ccname="$cc" ;;
 esac
 
+case "$gccversion" in
+'') ;;
+*)  case "$ccflags" in
+    *-Wall*) ;;
+    *) ccflags="$ccflags -Wall" ;;
+    esac
+    ;;
+esac
+
 : see how we invoke the C preprocessor
 echo " "
 echo "Now, how can we feed standard input to your C preprocessor..." >&4
@@ -3666,7 +3831,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
@@ -3679,6 +3845,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
@@ -3915,7 +4085,10 @@ none) ccflags='';;
 esac
 
 : the following weeds options from ccflags that are of no interest to cpp
-cppflags="$ccflags"
+case "$cppflags" in
+'') cppflags="$ccflags" ;;
+*)  cppflags="$cppflags $ccflags" ;;
+esac
 case "$gccversion" in
 1*) cppflags="$cppflags -D__GNUC__"
 esac
@@ -4044,8 +4217,8 @@ and I got the following output:
 
 EOM
 dflt=y
-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
+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 ;;
@@ -4398,71 +4571,449 @@ case "$usemorebits" in
        ;;
 esac
 
+: check for void type
+echo " "
+echo "Checking to see how well your C compiler groks the void type..." >&4
+case "$voidflags" in
+'')
+       $cat >try.c <<'EOCP'
+#if TRY & 1
+void sub() {
+#else
+sub() {
+#endif
+       extern void moo();      /* function returning void */
+       void (*goo)();          /* ptr to func returning void */
+#if TRY & 8
+       void *hue;              /* generic ptr */
+#endif
+#if TRY & 2
+       void (*foo[10])();
+#endif
 
-case "$uselonglong" in
-"$define"|true|[yY]*)
-       cat <<EOM >&4
-
-*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
-EOM
-       use64bitint="$define"
-       ;;
-esac                          
-case "$use64bits" in
-"$define"|true|[yY]*)
-       cat <<EOM >&4
-
-*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
-EOM
-       use64bitint="$define"
-       ;;
-esac                          
-case "$use64bitints" in
-"$define"|true|[yY]*)
-       cat <<EOM >&4
-
-*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
-EOM
-       use64bitint="$define"
-       ;;
-esac                          
-case "$use64bitsint" in
-"$define"|true|[yY]*)
-       cat <<EOM >&4
-
-*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
-EOM
-       use64bitint="$define"
-       ;;
-esac                          
-case "$uselonglongs" in
-"$define"|true|[yY]*)
-       cat <<EOM >&4
-
-*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
+#if TRY & 4
+       if(goo == moo) {
+               exit(0);
+       }
+#endif
+       exit(0);
+}
+int main() { sub(); }
+EOCP
+       if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
+               voidflags=$defvoidused
+       echo "Good.  It appears to support void to the level $package wants.">&4
+               if $contains warning .out >/dev/null 2>&1; then
+                       echo "However, you might get some warnings that look like this:"
+                       $cat .out
+               fi
+       else
+echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
+               if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
+                       echo "It supports 1..."
+                       if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
+                               echo "It also supports 2..."
+                               if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
+                                       voidflags=7
+                                       echo "And it supports 4 but not 8 definitely."
+                               else
+                                       echo "It doesn't support 4..."
+                                       if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
+                                               voidflags=11
+                                               echo "But it supports 8."
+                                       else
+                                               voidflags=3
+                                               echo "Neither does it support 8."
+                                       fi
+                               fi
+                       else
+                               echo "It does not support 2..."
+                               if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
+                                       voidflags=13
+                                       echo "But it supports 4 and 8."
+                               else
+                                       if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
+                                               voidflags=5
+                                               echo "And it supports 4 but has not heard about 8."
+                                       else
+                                               echo "However it supports 8 but not 4."
+                                       fi
+                               fi
+                       fi
+               else
+                       echo "There is no support at all for void."
+                       voidflags=0
+               fi
+       fi
+esac
+case "$voidflags" in
+"$defvoidused") ;;
+*)     $cat >&4 <<'EOM'
+  Support flag bits are:
+    1: basic void declarations.
+    2: arrays of pointers to functions returning void.
+    4: operations between pointers to and addresses of void functions.
+    8: generic void pointers.
 EOM
-       use64bitint="$define"
+       dflt="$voidflags";
+       rp="Your void support flags add up to what?"
+       . ./myread
+       voidflags="$ans"
        ;;
-esac                          
-case "$use64bitsall" in
-"$define"|true|[yY]*)
-       cat <<EOM >&4
+esac
+$rm -f try.* .out
 
-*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
-EOM
-       use64bitall="$define"
+: check for length of pointer
+echo " "
+case "$ptrsize" in
+'')
+       echo "Checking to see how big your pointers are..." >&4
+       if test "$voidflags" -gt 7; then
+               echo '#define VOID_PTR char *' > try.c
+       else
+               echo '#define VOID_PTR void *' > try.c
+       fi
+       $cat >>try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof(VOID_PTR));
+    exit(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               ptrsize=`./try`
+               echo "Your pointers are $ptrsize bytes long."
+       else
+               dflt='4'
+               echo "(I can't seem to compile the test program.  Guessing...)" >&4
+               rp="What is the size of a pointer (in bytes)?"
+               . ./myread
+               ptrsize="$ans"
+       fi
        ;;
-esac                          
-
-case "$ccflags" in
-*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
-esac
-case "$use64bitall" in
-"$define"|true|[yY]*) use64bitint="$define" ;;
 esac
+$rm -f try.c try
 
-case "$longsize" in
-8) cat <<EOM
+: check for long long
+echo " "
+echo "Checking to see if you have long long..." >&4
+echo 'int main() { long long x = 7; return 0; }' > try.c
+set try
+if eval $compile; then
+       val="$define"
+       echo "You have long long."
+else
+       val="$undef"
+       echo "You do not have long long."
+fi
+$rm try.*
+set d_longlong
+eval $setvar
+
+: check for length of long long
+case "${d_longlong}${longlongsize}" in
+$define)
+       echo " "
+       echo "Checking to see how big your long longs are..." >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof(long long));
+    return(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               longlongsize=`./try$exe_ext`
+               echo "Your long longs are $longlongsize bytes long."
+       else
+               dflt='8'
+               echo " "
+               echo "(I can't seem to compile the test program.  Guessing...)"
+               rp="What is the size of a long long (in bytes)?"
+               . ./myread
+               longlongsize="$ans"
+       fi
+       if $test "X$longsize" = "X$longlongsize"; then
+               echo "(That isn't any different from an ordinary long.)"
+       fi      
+       ;;
+esac
+$rm -f try.* try
+
+: determine filename position in cpp output
+echo " "
+echo "Computing filename position in cpp output for #include directives..." >&4
+echo '#include <stdio.h>' > foo.c
+$cat >fieldn <<EOF
+$startsh
+$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
+$grep '^[      ]*#.*stdio\.h' | \
+while read cline; do
+       pos=1
+       set \$cline
+       while $test \$# -gt 0; do
+               if $test -r \`echo \$1 | $tr -d '"'\`; then
+                       echo "\$pos"
+                       exit 0
+               fi
+               shift
+               pos=\`expr \$pos + 1\`
+       done
+done
+EOF
+chmod +x fieldn
+fieldn=`./fieldn`
+$rm -f foo.c fieldn
+case $fieldn in
+'') pos='???';;
+1) pos=first;;
+2) pos=second;;
+3) pos=third;;
+*) pos="${fieldn}th";;
+esac
+echo "Your cpp writes the filename in the $pos field of the line."
+
+: locate header file
+$cat >findhdr <<EOF
+$startsh
+wanted=\$1
+name=''
+for usrincdir in $usrinc
+do
+       if test -f \$usrincdir/\$wanted; then
+               echo "\$usrincdir/\$wanted"
+               exit 0
+       fi
+done
+awkprg='{ print \$$fieldn }'
+echo "#include <\$wanted>" > foo\$\$.c
+$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
+$grep "^[      ]*#.*\$wanted" | \
+while read cline; do
+       name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
+       case "\$name" in
+       *[/\\\\]\$wanted) echo "\$name"; exit 1;;
+       *[\\\\/]\$wanted) echo "\$name"; exit 1;;
+       *) exit 2;;
+       esac;
+done;
+#
+# status = 0: grep returned 0 lines, case statement not executed
+# status = 1: headerfile found
+# status = 2: while loop executed, no headerfile found
+#
+status=\$?
+$rm -f foo\$\$.c;
+if test \$status -eq 1; then
+       exit 0;
+fi
+exit 1
+EOF
+chmod +x findhdr
+
+: define an alternate in-header-list? function
+inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
+cont=true; xxf="echo \"<\$1> found.\" >&4";
+case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
+*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
+esac;
+case $# in 4) instead=instead;; *) instead="at last";; esac;
+while $test "$cont"; do
+       xxx=`./findhdr $1`
+       var=$2; eval "was=\$$2";
+       if $test "$xxx" && $test -r "$xxx";
+       then eval $xxf;
+       eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
+               cont="";
+       else eval $xxnf;
+       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
+       set $yyy; shift; shift; yyy=$@;
+       case $# in 0) cont="";;
+       2) xxf="echo \"but I found <\$1> $instead.\" >&4";
+               xxnf="echo \"and I did not find <\$1> either.\" >&4";;
+       *) xxf="echo \"but I found <\$1\> instead.\" >&4";
+               xxnf="echo \"there is no <\$1>, ...\" >&4";;
+       esac;
+done;
+while $test "$yyy";
+do set $yyy; var=$2; eval "was=\$$2";
+       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
+       set $yyy; shift; shift; yyy=$@;
+done'
+
+: see if inttypes.h is available
+: we want a real compile instead of Inhdr because some systems
+: have an inttypes.h which includes non-existent headers
+echo " "
+$cat >try.c <<EOCP
+#include <inttypes.h>
+int main() {
+       static int32_t foo32 = 0x12345678;
+}
+EOCP
+set try
+if eval $compile; then
+       echo "<inttypes.h> found." >&4
+       val="$define"
+else
+       echo "<inttypes.h> NOT found." >&4
+       val="$undef"
+fi
+$rm -f try.c try
+set i_inttypes
+eval $setvar
+
+: check for int64_t
+echo " "
+echo "Checking to see if you have int64_t..." >&4
+$cat >try.c <<EOCP
+#include <sys/types.h>
+#$i_inttypes I_INTTYPES
+#ifdef I_INTTYPES
+#include <inttypes.h>
+#endif
+int main() { int64_t x = 7; }
+EOCP
+set try
+if eval $compile; then
+       val="$define"
+       echo "You have int64_t."
+else
+       val="$undef"
+       echo "You do not have int64_t."
+fi
+$rm -f try try.*
+set d_int64_t
+eval $setvar
+
+
+echo " "
+echo "Checking which 64-bit integer type we could use..." >&4
+
+case "$intsize" in
+8) val=int
+   set quadtype
+   eval $setvar
+   val='"unsigned int"'
+   set uquadtype
+   eval $setvar
+   quadkind=1
+   ;;
+*) case "$longsize" in
+   8) val=long
+      set quadtype
+      eval $setvar
+      val='"unsigned long"'
+      set uquadtype
+      eval $setvar
+      quadkind=2
+      ;;
+   *) case "$d_longlong:$longlongsize" in
+      define:8)
+        val='"long long"'
+        set quadtype
+        eval $setvar
+        val='"unsigned long long"'
+        set uquadtype
+        eval $setvar
+        quadkind=3
+        ;;
+      *) case "$d_int64_t" in
+         define)
+           val=int64_t
+           set quadtype
+           eval $setvar
+           val=uint64_t
+           set uquadtype
+           eval $setvar
+           quadkind=4
+           ;;
+         esac
+         ;;
+      esac
+      ;;
+   esac
+   ;;
+esac
+
+case "$quadtype" in
+'')    echo "Alas, no 64-bit integer types in sight." >&4
+       d_quad="$undef"
+       ;;
+*)     echo "We could use '$quadtype' for 64-bit integers." >&4
+       d_quad="$define"
+       ;;
+esac
+
+
+case "$uselonglong" in
+"$define"|true|[yY]*)
+       cat <<EOM >&4
+
+*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
+EOM
+       use64bitint="$define"
+       ;;
+esac                          
+case "$use64bits" in
+"$define"|true|[yY]*)
+       cat <<EOM >&4
+
+*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
+EOM
+       use64bitint="$define"
+       ;;
+esac                          
+case "$use64bitints" in
+"$define"|true|[yY]*)
+       cat <<EOM >&4
+
+*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
+EOM
+       use64bitint="$define"
+       ;;
+esac                          
+case "$use64bitsint" in
+"$define"|true|[yY]*)
+       cat <<EOM >&4
+
+*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
+EOM
+       use64bitint="$define"
+       ;;
+esac                          
+case "$uselonglongs" in
+"$define"|true|[yY]*)
+       cat <<EOM >&4
+
+*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
+EOM
+       use64bitint="$define"
+       ;;
+esac                          
+case "$use64bitsall" in
+"$define"|true|[yY]*)
+       cat <<EOM >&4
+
+*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
+EOM
+       use64bitall="$define"
+       ;;
+esac                          
+
+case "$ccflags" in
+*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
+esac
+case "$use64bitall" in
+"$define"|true|[yY]*) use64bitint="$define" ;;
+esac
+
+case "$longsize" in
+8) cat <<EOM
 
 You have natively 64-bit long integers.
 EOM
@@ -4472,6 +5023,10 @@ EOM
    "$define"|true|[yY]*) dflt='y';;
    *) dflt='n';;
    esac
+   case "$d_quad" in
+   "$define") ;;
+   *) dflt='n' ;;
+   esac
    cat <<EOM
 
 Perl can be built to take advantage of 64-bit integer types
@@ -4479,6 +5034,7 @@ on some systems.  To do so, Configure can be run with -Duse64bitint.
 Choosing this option will most probably introduce binary incompatibilities.
 
 If this doesn't make any sense to you, just accept the default '$dflt'.
+(The default has been chosen based on your configuration.)
 EOM
    rp='Try to use 64-bit integers, if available?'
    . ./myread
@@ -4507,6 +5063,7 @@ binary incompatibilities.  On the other hand, your platform may not
 have any more 64-bitness available than what you already have chosen.
 
 If this doesn't make any sense to you, just accept the default '$dflt'.
+(The default has been chosen based on your configuration.)
 EOM
 rp='Try to use maximal 64-bit support, if available?'
 . ./myread
@@ -4530,6 +5087,31 @@ EOM
        ;;
 esac
 
+case "$use64bitall" in
+"$define"|true|[yY]*)
+       case "$ptrsize" in
+       4)      cat <<EOM >&4
+
+*** You have chosen a maximally 64-bit build, but your pointers
+*** are only 4 bytes wide, disabling maximal 64-bitness.
+
+EOM
+               use64bitall="$undef"
+               case "$use64bitint" in
+               "$define"|true|[yY]*) ;;
+               *)      cat <<EOM >&4
+
+*** Downgrading from maximal 64-bitness to using 64-bit integers.
+
+EOM
+                       use64bitint="$define"
+                       ;;
+               esac
+               ;;
+       esac
+       ;;
+esac
+
 case "$use64bitint" in
 "$define"|true|[yY]*)
 : Look for a hint-file generated 'call-back-unit'.  If the
@@ -5161,6 +5743,51 @@ EOCP
 esac
 $rm -f try.* try
 
+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 $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
+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
@@ -5257,6 +5884,21 @@ $define)
        esac
        ;;
 esac
+case "$useperlio" in
+$define)
+       echo "Perlio selected." >&4
+       ;;
+*)
+       echo "Perlio not selected, using stdio." >&4
+       case "$archname" in
+        *-stdio*) echo "...and architecture name already has -stdio." >&4
+                ;;
+        *)      archname="$archname-stdio"
+                echo "...setting architecture name to $archname." >&4
+                ;;
+        esac
+       ;;
+esac
 
 : determine root of directory hierarchy where package will be installed.
 case "$prefix" in
@@ -5294,12 +5936,17 @@ esac
 prefix="$ans"
 prefixexp="$ansexp"
 
+case "$afsroot" in
+'')    afsroot=/afs ;;
+*)     afsroot=$afsroot ;;
+esac
+
 : is AFS running?
 echo " "
 case "$afs" in
 $define|true)  afs=true ;;
 $undef|false)  afs=false ;;
-*)     if test -d /afs; then
+*)     if test -d $afsroot; then
                afs=true
        else
                afs=false
@@ -5382,6 +6029,7 @@ if $test -r $rsrc/patchlevel.h;then
        api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
        api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
        api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
+       perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
 else
        revision=0
        patchlevel=0
@@ -5389,8 +6037,19 @@ else
        api_revision=0
        api_version=0
        api_subversion=0
+       perl_patchlevel=0
+       $echo "(You do not have patchlevel.h.  Eek.)"
+fi
+if $test -r $rsrc/.patch ; then  
+       if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
+               perl_patchlevel=`cat $rsrc/.patch`
+       fi
 fi
-$echo "(You have $package version $patchlevel subversion $subversion.)"
+case "$perl_patchlevel" in
+0)  ;;
+'') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
+*)  $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
+esac
 case "$osname" in
 dos|vms)
        : XXX Should be a Configure test for double-dots in filenames.
@@ -5618,138 +6277,37 @@ eval $setvar
 $rm -f reflect flect
 
 : now see if they want to do setuid emulation
-echo " "
-val="$undef"
-case "$d_suidsafe" in
-"$define")
-       val="$undef"
-       echo "No need to emulate SUID scripts since they are secure here." >& 4
-       ;;
-*)
-       $cat <<EOM
-Some systems have disabled setuid scripts, especially systems where
-setuid scripts cannot be secure.  On systems where setuid scripts have
-been disabled, the setuid/setgid bits on scripts are currently
-useless.  It is possible for $package to detect those bits and emulate
-setuid/setgid in a secure fashion.  This emulation will only work if
-setuid scripts have been disabled in your kernel.
-
-EOM
-       case "$d_dosuid" in
-       "$define") dflt=y ;;
-       *) dflt=n ;;
-       esac
-       rp="Do you want to do setuid/setgid emulation?"
-       . ./myread
-       case "$ans" in
-       [yY]*)  val="$define";;
-       *)      val="$undef";;
-       esac
-       ;;
-esac
-set d_dosuid
-eval $setvar
-
-: determine filename position in cpp output
-echo " "
-echo "Computing filename position in cpp output for #include directives..." >&4
-echo '#include <stdio.h>' > foo.c
-$cat >fieldn <<EOF
-$startsh
-$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
-$grep '^[      ]*#.*stdio\.h' | \
-while read cline; do
-       pos=1
-       set \$cline
-       while $test \$# -gt 0; do
-               if $test -r \`echo \$1 | $tr -d '"'\`; then
-                       echo "\$pos"
-                       exit 0
-               fi
-               shift
-               pos=\`expr \$pos + 1\`
-       done
-done
-EOF
-chmod +x fieldn
-fieldn=`./fieldn`
-$rm -f foo.c fieldn
-case $fieldn in
-'') pos='???';;
-1) pos=first;;
-2) pos=second;;
-3) pos=third;;
-*) pos="${fieldn}th";;
-esac
-echo "Your cpp writes the filename in the $pos field of the line."
-
-: locate header file
-$cat >findhdr <<EOF
-$startsh
-wanted=\$1
-name=''
-for usrincdir in $usrinc
-do
-       if test -f \$usrincdir/\$wanted; then
-               echo "\$usrincdir/\$wanted"
-               exit 0
-       fi
-done
-awkprg='{ print \$$fieldn }'
-echo "#include <\$wanted>" > foo\$\$.c
-$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
-$grep "^[      ]*#.*\$wanted" | \
-while read cline; do
-       name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
-       case "\$name" in
-       *[/\\\\]\$wanted) echo "\$name"; exit 1;;
-       *[\\\\/]\$wanted) echo "\$name"; exit 1;;
-       *) exit 2;;
-       esac;
-done;
-#
-# status = 0: grep returned 0 lines, case statement not executed
-# status = 1: headerfile found
-# status = 2: while loop executed, no headerfile found
-#
-status=\$?
-$rm -f foo\$\$.c;
-if test \$status -eq 1; then
-       exit 0;
-fi
-exit 1
-EOF
-chmod +x findhdr
-
-: define an alternate in-header-list? function
-inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
-cont=true; xxf="echo \"<\$1> found.\" >&4";
-case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
-*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
-esac;
-case $# in 4) instead=instead;; *) instead="at last";; esac;
-while $test "$cont"; do
-       xxx=`./findhdr $1`
-       var=$2; eval "was=\$$2";
-       if $test "$xxx" && $test -r "$xxx";
-       then eval $xxf;
-       eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
-               cont="";
-       else eval $xxnf;
-       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
-       set $yyy; shift; shift; yyy=$@;
-       case $# in 0) cont="";;
-       2) xxf="echo \"but I found <\$1> $instead.\" >&4";
-               xxnf="echo \"and I did not find <\$1> either.\" >&4";;
-       *) xxf="echo \"but I found <\$1\> instead.\" >&4";
-               xxnf="echo \"there is no <\$1>, ...\" >&4";;
-       esac;
-done;
-while $test "$yyy";
-do set $yyy; var=$2; eval "was=\$$2";
-       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
-       set $yyy; shift; shift; yyy=$@;
-done'
+echo " "
+val="$undef"
+case "$d_suidsafe" in
+"$define")
+       val="$undef"
+       echo "No need to emulate SUID scripts since they are secure here." >& 4
+       ;;
+*)
+       $cat <<EOM
+Some systems have disabled setuid scripts, especially systems where
+setuid scripts cannot be secure.  On systems where setuid scripts have
+been disabled, the setuid/setgid bits on scripts are currently
+useless.  It is possible for $package to detect those bits and emulate
+setuid/setgid in a secure fashion.  This emulation will only work if
+setuid scripts have been disabled in your kernel.
+
+EOM
+       case "$d_dosuid" in
+       "$define") dflt=y ;;
+       *) dflt=n ;;
+       esac
+       rp="Do you want to do setuid/setgid emulation?"
+       . ./myread
+       case "$ans" in
+       [yY]*)  val="$define";;
+       *)      val="$undef";;
+       esac
+       ;;
+esac
+set d_dosuid
+eval $setvar
 
 : see if this is a malloc.h system
 set malloc.h i_malloc
@@ -5762,8 +6320,13 @@ eval $inhdr
 : determine which malloc to compile in
 echo " "
 case "$usemymalloc" in
-''|[yY]*|true|$define) dflt='y' ;;
-*)     dflt='n' ;;
+[yY]*|true|$define)    dflt='y' ;;
+[nN]*|false|$undef)    dflt='n' ;;
+*)     case "$ptrsize" in
+       4) dflt='y' ;;
+       *) dflt='n' ;;
+       esac
+       ;;
 esac
 rp="Do you wish to attempt to use the malloc that comes with $package?"
 . ./myread
@@ -6156,13 +6719,13 @@ fi
 : Find perl5.005 or later.
 echo "Looking for a previously installed perl5.005 or later... "
 case "$perl5" in
-'')    for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
+'')    for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
                : Check if this perl is recent and can load a simple module
-               if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
+               if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
                        perl5=$tdir/perl
                        break;
-               elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
-                       perl5=$tdir/perl
+               elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
+                       perl5=$tdir/perl5
                        break;
                fi
        done
@@ -6227,14 +6790,14 @@ else {
 EOPL
 chmod +x getverlist
 case "$inc_version_list" in
-'')    if test -x "$perl5"; then
+'')    if test -x "$perl5$exe_ext"; then
                dflt=`$perl5 getverlist`
        else
                dflt='none'
        fi
        ;;
 $undef) dflt='none' ;;
-*)  dflt="$inc_version_list" ;;
+*)  eval dflt=\"$inc_version_list\" ;;
 esac
 case "$dflt" in
 ''|' ') dflt=none ;;
@@ -6421,7 +6984,7 @@ int main() {
                exit(1); /* fail */
 }
 EOM
-               if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
+               if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
                        cat <<EOM
 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
 EOM
@@ -7168,6 +7731,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'
@@ -7415,36 +7983,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=''
@@ -7508,7 +8046,7 @@ if $test X"$sPRIfldbl" = X; then
 #include <stdio.h>
 int main() {
   long double d = 123.456;
-  printf("%.3llf\n", d);
+  printf("%.3Lf\n", d);
 }
 EOCP
        set try
@@ -7516,9 +8054,9 @@ EOCP
                yyy=`./try$exe_ext`
                case "$yyy" in
                123.456)
-                       sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
-                       sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
-                       echo "We will use %llf."
+                       sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
+                       sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
+                       echo "We will use %Lf."
                        ;;
                esac
        fi
@@ -7530,7 +8068,7 @@ if $test X"$sPRIfldbl" = X; then
 #include <stdio.h>
 int main() {
   long double d = 123.456;
-  printf("%.3Lf\n", d);
+  printf("%.3llf\n", d);
 }
 EOCP
        set try
@@ -7538,9 +8076,9 @@ EOCP
                yyy=`./try$exe_ext`
                case "$yyy" in
                123.456)
-                       sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
-                       sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
-                       echo "We will use %Lf."
+                       sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
+                       sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
+                       echo "We will use %llf."
                        ;;
                esac
        fi
@@ -7750,6 +8288,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
 
@@ -8226,6 +8768,144 @@ eval $inlibc
 set chsize d_chsize
 eval $inlibc
 
+hasstruct='varname=$1; struct=$2; shift; shift;
+while $test $# -ge 2; do
+       case "$1" in
+       $define) echo "#include <$2>";;
+       esac ;
+    shift 2;
+done > try.c;
+echo "int main () { struct $struct foo; }" >> try.c;
+set try;
+if eval $compile; then
+       val="$define";
+else
+       val="$undef";
+fi;
+set $varname;
+eval $setvar;
+$rm -f try.c try.o'
+
+: see if sys/types.h has to be included
+set sys/types.h i_systypes
+eval $inhdr
+
+hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
+while $test $# -ge 2; do
+       case "$1" in
+       $define) echo "#include <$2>";;
+       esac ;
+    shift 2;
+done > try.c;
+echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
+set try;
+if eval $compile; then
+       val="$define";
+else
+       val="$undef";
+fi;
+set $varname;
+eval $setvar;
+$rm -f try.c try.o'
+
+socketlib=''
+sockethdr=''
+: see whether socket exists
+echo " "
+$echo $n "Hmm... $c" >&4
+if set socket val -f d_socket; eval $csym; $val; then
+       echo "Looks like you have Berkeley networking support." >&4
+       d_socket="$define"
+       if set setsockopt val -f; eval $csym; $val; then
+               d_oldsock="$undef"
+       else
+               echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
+               d_oldsock="$define"
+       fi
+else
+       if $contains socklib libc.list >/dev/null 2>&1; then
+               echo "Looks like you have Berkeley networking support." >&4
+               d_socket="$define"
+               : we will have to assume that it supports the 4.2 BSD interface
+               d_oldsock="$undef"
+       else
+               echo "You don't have Berkeley networking in libc$_a..." >&4
+               if test "X$d_socket" = "X$define"; then
+                  echo "...but you seem to believe that you have sockets." >&4
+               else
+                       for net in net socket
+                       do
+                               if test -f /usr/lib/lib$net$_a; then
+                                       ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
+                                       $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
+                                       if $contains socket libc.list >/dev/null 2>&1; then
+                                               d_socket="$define"
+                                               socketlib="-l$net"
+                                               case "$net" in
+                                               net)
+                                                       echo "...but the Wollongong group seems to have hacked it in." >&4
+                                                       sockethdr="-I/usr/netinclude"
+                                                       ;;
+                                               esac
+                                               echo "Found Berkeley sockets interface in lib$net." >& 4 
+                                               if $contains setsockopt libc.list >/dev/null 2>&1; then
+                                                       d_oldsock="$undef"
+                                               else
+                                                       echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
+                                                       d_oldsock="$define"
+                                               fi
+                                               break
+                                       fi
+                               fi
+                       done
+                       if test "X$d_socket" != "X$define"; then
+                          echo "or anywhere else I see." >&4
+                          d_socket="$undef"
+                          d_oldsock="$undef"
+                       fi
+               fi
+       fi
+fi
+
+: see if socketpair exists
+set socketpair d_sockpair
+eval $inlibc
+
+
+echo " "
+echo "Checking the availability of certain socket constants..." >& 4
+for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
+       enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
+       $cat >try.c <<EOF
+#include <sys/types.h>
+#include <sys/socket.h>
+int main() {
+    int i = $ENUM;
+}
+EOF
+       val="$undef"
+       set try; if eval $compile; then
+               val="$define"
+       fi
+       set d_${enum}; eval $setvar
+       $rm -f try.c try
+done
+
+: see if this is a sys/uio.h system
+set sys/uio.h i_sysuio
+eval $inhdr
+
+
+echo " "
+echo "Checking to see if your system supports struct cmsghdr..." >&4
+set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
+eval $hasstruct
+case "$d_cmsghdr_s" in
+"$define")      echo "Yes, it does."   ;;
+*)              echo "No, it doesn't." ;;
+esac
+
+
 : check for const keyword
 echo " "
 echo 'Checking to see if your C compiler knows about "const"...' >&4
@@ -8331,6 +9011,60 @@ $rm -f dbl_dig.?
 set d_dbl_dig
 eval $setvar
 
+hasproto='varname=$1; func=$2; shift; shift;
+while $test $# -ge 2; do
+       case "$1" in
+       $define) echo "#include <$2>";;
+       esac ;
+    shift 2;
+done > try.c;
+$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
+if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
+       echo "$func() prototype found.";
+       val="$define";
+else
+       echo "$func() prototype NOT found.";
+       val="$undef";
+fi;
+set $varname;
+eval $setvar;
+$rm -f try.c tryout.c'
+
+: see if dbm.h is available
+: see if dbmclose exists
+set dbmclose d_dbmclose
+eval $inlibc
+
+case "$d_dbmclose" in
+$define)
+       set dbm.h i_dbm
+       eval $inhdr
+       case "$i_dbm" in
+       $define)
+               val="$undef"
+               set i_rpcsvcdbm
+               eval $setvar
+               ;;
+       *)      set rpcsvc/dbm.h i_rpcsvcdbm
+               eval $inhdr
+               ;;
+       esac
+       ;;
+*)     echo "We won't be including <dbm.h>"
+       val="$undef"
+       set i_dbm
+       eval $setvar
+       val="$undef"
+       set i_rpcsvcdbm
+       eval $setvar
+       ;;
+esac
+
+: see if prototype for dbminit is available
+echo " "
+set d_dbminitproto dbminit $i_dbm dbm.h
+eval $hasproto
+
 : see if difftime exists
 set difftime d_difftime
 eval $inlibc
@@ -8496,7 +9230,7 @@ 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 -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
+               $ld -o dyna.$dlext $ldflags $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
@@ -8520,25 +9254,6 @@ $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
 set d_dlsymun
 eval $setvar
 
-hasproto='varname=$1; func=$2; shift; shift;
-while $test $# -ge 2; do
-       case "$1" in
-       $define) echo "#include <$2>";;
-       esac ;
-    shift 2;
-done > try.c;
-$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
-if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
-       echo "$func() prototype found.";
-       val="$define";
-else
-       echo "$func() prototype NOT found.";
-       val="$undef";
-fi;
-set $varname;
-eval $setvar;
-$rm -f try.c tryout.c'
-
 : see if prototype for drand48 is available
 echo " "
 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
@@ -8652,11 +9367,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
@@ -8736,8 +9451,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! */
@@ -8784,6 +9503,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`
@@ -8897,107 +9617,6 @@ eval $setvar
 $rm -f try*
 
 
-hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
-while $test $# -ge 2; do
-       case "$1" in
-       $define) echo "#include <$2>";;
-       esac ;
-    shift 2;
-done > try.c;
-echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
-set try;
-if eval $compile; then
-       val="$define";
-else
-       val="$undef";
-fi;
-set $varname;
-eval $setvar;
-$rm -f try.c try.o'
-
-socketlib=''
-sockethdr=''
-: see whether socket exists
-echo " "
-$echo $n "Hmm... $c" >&4
-if set socket val -f d_socket; eval $csym; $val; then
-       echo "Looks like you have Berkeley networking support." >&4
-       d_socket="$define"
-       if set setsockopt val -f; eval $csym; $val; then
-               d_oldsock="$undef"
-       else
-               echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
-               d_oldsock="$define"
-       fi
-else
-       if $contains socklib libc.list >/dev/null 2>&1; then
-               echo "Looks like you have Berkeley networking support." >&4
-               d_socket="$define"
-               : we will have to assume that it supports the 4.2 BSD interface
-               d_oldsock="$undef"
-       else
-               echo "You don't have Berkeley networking in libc$_a..." >&4
-               if test "X$d_socket" = "X$define"; then
-                  echo "...but you seem to believe that you have sockets." >&4
-               else
-                       for net in net socket
-                       do
-                               if test -f /usr/lib/lib$net$_a; then
-                                       ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
-                                       $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
-                                       if $contains socket libc.list >/dev/null 2>&1; then
-                                               d_socket="$define"
-                                               socketlib="-l$net"
-                                               case "$net" in
-                                               net)
-                                                       echo "...but the Wollongong group seems to have hacked it in." >&4
-                                                       sockethdr="-I/usr/netinclude"
-                                                       ;;
-                                               esac
-                                               echo "Found Berkeley sockets interface in lib$net." >& 4 
-                                               if $contains setsockopt libc.list >/dev/null 2>&1; then
-                                                       d_oldsock="$undef"
-                                               else
-                                                       echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
-                                                       d_oldsock="$define"
-                                               fi
-                                               break
-                                       fi
-                               fi
-                       done
-                       if test "X$d_socket" != "X$define"; then
-                          echo "or anywhere else I see." >&4
-                          d_socket="$undef"
-                          d_oldsock="$undef"
-                       fi
-               fi
-       fi
-fi
-
-: see if socketpair exists
-set socketpair d_sockpair
-eval $inlibc
-
-
-echo " "
-echo "Checking the availability of certain socket constants..." >& 4
-for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
-       enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
-       $cat >try.c <<EOF
-#include <sys/types.h>
-#include <sys/socket.h>
-int main() {
-    int i = $ENUM;
-}
-EOF
-       val="$undef"
-       set try; if eval $compile; then
-               val="$define"
-       fi
-       set d_${enum}; eval $setvar
-       $rm -f try.c try
-done
-
 : see if sys/select.h has to be included
 set sys/select.h i_sysselct
 eval $inhdr
@@ -9168,6 +9787,35 @@ eval $inlibc
 set flock d_flock
 eval $inlibc
 
+: see if this is a sys/file.h system
+val=''
+set sys/file.h val
+eval $inhdr
+
+: do we need to include sys/file.h ?
+case "$val" in
+"$define")
+       echo " "
+       if $h_sysfile; then
+               val="$define"
+               echo "We'll be including <sys/file.h>." >&4
+       else
+               val="$undef"
+               echo "We won't be including <sys/file.h>." >&4
+       fi
+       ;;
+*)
+       h_sysfile=false
+       ;;
+esac
+set i_sysfile
+eval $setvar
+
+: see if prototype for flock is available
+echo " "
+set d_flockproto flock $i_sysfile sys/file.h
+eval $hasproto
+
 : see if fork exists
 set fork d_fork
 eval $inlibc
@@ -9207,24 +9855,6 @@ eval $setvar
 set frexpl d_frexpl
 eval $inlibc
 
-hasstruct='varname=$1; struct=$2; shift; shift;
-while $test $# -ge 2; do
-       case "$1" in
-       $define) echo "#include <$2>";;
-       esac ;
-    shift 2;
-done > try.c;
-echo "int main () { struct $struct foo; }" >> try.c;
-set try;
-if eval $compile; then
-       val="$define";
-else
-       val="$undef";
-fi;
-set $varname;
-eval $setvar;
-$rm -f try.c try.o'
-
 : see if this is a sys/param system
 set sys/param.h i_sysparam
 eval $inhdr
@@ -9233,10 +9863,6 @@ eval $inhdr
 set sys/mount.h i_sysmount
 eval $inhdr
 
-: see if sys/types.h has to be included
-set sys/types.h i_systypes
-eval $inhdr
-
 
 echo " "
 echo "Checking to see if your system supports struct fs_data..." >&4
@@ -9273,6 +9899,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
@@ -9403,6 +10033,10 @@ echo " "
 set d_gethostprotos gethostent $i_netdb netdb.h
 eval $hasproto
 
+: see if getitimer exists
+set getitimer d_getitimer
+eval $inlibc
+
 : see if getlogin exists
 set getlogin d_getlogin
 eval $inlibc
@@ -9432,6 +10066,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
@@ -9598,83 +10236,38 @@ eval $inlibc
 echo " "
 if set index val -f; eval $csym; $val; then
        if set strchr val -f d_strchr; eval $csym; $val; then
-               if $contains strchr "$strings" >/dev/null 2>&1 ; then
-                       val="$define"
-                       vali="$undef"
-                       echo "strchr() found." >&4
-               else
-                       val="$undef"
-                       vali="$define"
-                       echo "index() found." >&4
-               fi
-       else
-               val="$undef"
-               vali="$define"
-               echo "index() found." >&4
-       fi
-else
-       if set strchr val -f d_strchr; eval $csym; $val; then
-               val="$define"
-               vali="$undef"
-               echo "strchr() found." >&4
-       else
-               echo "No index() or strchr() found!" >&4
-               val="$undef"
-               vali="$undef"
-       fi
-fi
-set d_strchr; eval $setvar
-val="$vali"
-set d_index; eval $setvar
-
-: check whether inet_aton exists
-set inet_aton d_inetaton
-eval $inlibc
-
-: see if inttypes.h is available
-: we want a real compile instead of Inhdr because some systems
-: have an inttypes.h which includes non-existent headers
-echo " "
-$cat >try.c <<EOCP
-#include <inttypes.h>
-int main() {
-       static int32_t foo32 = 0x12345678;
-}
-EOCP
-set try
-if eval $compile; then
-       echo "<inttypes.h> found." >&4
-       val="$define"
-else
-       echo "<inttypes.h> NOT found." >&4
-       val="$undef"
-fi
-$rm -f try.c try
-set i_inttypes
-eval $setvar
-
-: check for int64_t
-echo " "
-echo "Checking to see if you have int64_t..." >&4
-$cat >try.c <<EOCP
-#include <sys/types.h>
-#$i_inttypes I_INTTYPES
-#ifdef I_INTTYPES
-#include <inttypes.h>
-#endif
-int main() { int64_t x = 7; }
-EOCP
-set try
-if eval $compile; then
-       val="$define"
-       echo "You have int64_t."
+               if $contains strchr "$strings" >/dev/null 2>&1 ; then
+                       val="$define"
+                       vali="$undef"
+                       echo "strchr() found." >&4
+               else
+                       val="$undef"
+                       vali="$define"
+                       echo "index() found." >&4
+               fi
+       else
+               val="$undef"
+               vali="$define"
+               echo "index() found." >&4
+       fi
 else
-       val="$undef"
-       echo "You do not have int64_t."
+       if set strchr val -f d_strchr; eval $csym; $val; then
+               val="$define"
+               vali="$undef"
+               echo "strchr() found." >&4
+       else
+               echo "No index() or strchr() found!" >&4
+               val="$undef"
+               vali="$undef"
+       fi
 fi
-$rm -f try try.*
-set d_int64_t
-eval $setvar
+set d_strchr; eval $setvar
+val="$vali"
+set d_index; eval $setvar
+
+: check whether inet_aton exists
+set inet_aton d_inetaton
+eval $inlibc
 
 : Look for isascii
 echo " "
@@ -9784,54 +10377,6 @@ eval $inlibc
 set lockf d_lockf
 eval $inlibc
 
-: check for long long
-echo " "
-echo "Checking to see if you have long long..." >&4
-echo 'int main() { long long x = 7; return 0; }' > try.c
-set try
-if eval $compile; then
-       val="$define"
-       echo "You have long long."
-else
-       val="$undef"
-       echo "You do not have long long."
-fi
-$rm try.*
-set d_longlong
-eval $setvar
-
-: check for length of long long
-case "${d_longlong}${longlongsize}" in
-$define)
-       echo " "
-       echo "Checking to see how big your long longs are..." >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-    printf("%d\n", (int)sizeof(long long));
-    return(0);
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               longlongsize=`./try$exe_ext`
-               echo "Your long longs are $longlongsize bytes long."
-       else
-               dflt='8'
-               echo " "
-               echo "(I can't seem to compile the test program.  Guessing...)"
-               rp="What is the size of a long long (in bytes)?"
-               . ./myread
-               longlongsize="$ans"
-       fi
-       if $test "X$longsize" = "X$longlongsize"; then
-               echo "(That isn't any different from an ordinary long.)"
-       fi      
-       ;;
-esac
-$rm -f try.* try
-
 : see if prototype for lseek is available
 echo " "
 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
@@ -9932,6 +10477,61 @@ esac
 set modfl d_modfl
 eval $inlibc
 
+d_modfl_pow32_bug="$undef"
+
+case "$d_longdbl$d_modfl" in
+$define$define)
+       $cat <<EOM
+Checking to see whether your modfl() is okay for large values...
+EOM
+$cat >try.c <<EOCP
+#include <math.h> 
+#include <stdio.h>
+int main() {
+    long double nv = 4294967303.15;
+    long double v, w;
+    v = modfl(nv, &w);         
+#ifdef __GLIBC__
+    printf("glibc");
+#endif
+    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
+    return 0;
+}
+EOCP
+       case "$osname:$gccversion" in
+       aix:)   saveccflags="$ccflags"
+               ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
+       esac
+       set try
+       if eval $compile; then
+               foo=`./try`
+               case "$foo" in
+               *" 4294967303.150000 1.150000 4294967302.000000")
+                       echo >&4 "Your modfl() is broken for large values."
+                       d_modfl_pow32_bug="$define"
+                       case "$foo" in
+                       glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
+                       ;;
+                       esac
+                       ;;
+               *" 4294967303.150000 0.150000 4294967303.000000")
+                       echo >&4 "Your modfl() seems okay for large values."
+                       ;;
+               *)      echo >&4 "I don't understand your modfl() at all."
+                       d_modfl="$undef"
+                       ;;
+               esac
+               $rm -f try.* try core core.try.*
+       else
+               echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
+               d_modfl="$undef"
+       fi
+       case "$osname:$gccversion" in
+       aix:)   $ccflags="saveccflags" ;; # restore
+       esac
+       ;;
+esac
+
 : see if mprotect exists
 set mprotect d_mprotect
 eval $inlibc
@@ -9988,6 +10588,17 @@ fi
 set d_msg
 eval $setvar
 
+
+echo " "
+echo "Checking to see if your system supports struct msghdr..." >&4
+set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
+eval $hasstruct
+case "$d_msghdr_s" in
+"$define")      echo "Yes, it does."   ;;
+*)              echo "No, it doesn't." ;;
+esac
+
+
 : see if msync exists
 set msync d_msync
 eval $inlibc
@@ -10000,70 +10611,6 @@ eval $inlibc
 set nice d_nice
 eval $inlibc
 
-
-echo " "
-echo "Checking which 64-bit integer type we could use..." >&4
-
-case "$intsize" in
-8) val=int
-   set quadtype
-   eval $setvar
-   val='"unsigned int"'
-   set uquadtype
-   eval $setvar
-   quadkind=1
-   ;;
-*) case "$longsize" in
-   8) val=long
-      set quadtype
-      eval $setvar
-      val='"unsigned long"'
-      set uquadtype
-      eval $setvar
-      quadkind=2
-      ;;
-   *) case "$d_longlong:$longlongsize" in
-      define:8)
-        val='"long long"'
-        set quadtype
-        eval $setvar
-        val='"unsigned long long"'
-        set uquadtype
-        eval $setvar
-        quadkind=3
-        ;;
-      *) case "$d_int64_t" in
-         define)
-           val=int64_t
-           set quadtype
-           eval $setvar
-           val=uint64_t
-           set uquadtype
-           eval $setvar
-           quadkind=4
-           ;;
-         esac
-         ;;
-      esac
-      ;;
-   esac
-   ;;
-esac
-
-case "$quadtype" in
-'')    echo "Alas, no 64-bit integer types in sight." >&4
-       d_quad="$undef"
-       ;;
-*)     if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
-           verb="will"
-       else
-           verb="could"
-       fi
-       echo "We $verb use '$quadtype' for 64-bit integers." >&4
-       d_quad="$define"
-       ;;
-esac
-
 : check for length of character
 echo " "
 case "$charsize" in
@@ -10094,6 +10641,37 @@ rp="What is the size of a character (in bytes)?"
 charsize="$ans"
 $rm -f try.c try
 
+: 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.*
+
 
 echo " "
 $echo "Choosing the C types to be used for Perl's internal types..." >&4
@@ -10272,67 +10850,68 @@ 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
 echo " "
@@ -10606,6 +11185,18 @@ eval $inlibc
 set readlink d_readlink
 eval $inlibc
 
+: see if readv exists
+set readv d_readv
+eval $inlibc
+
+: see if realpath exists
+set realpath d_realpath
+eval $inlibc
+
+: see if recvmsg exists
+set recvmsg d_recvmsg
+eval $inlibc
+
 : see if rename exists
 set rename d_rename
 eval $inlibc
@@ -10846,6 +11437,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
@@ -11083,6 +11679,10 @@ END
     ;;
 esac
 
+: see if sendmsg exists
+set sendmsg d_sendmsg
+eval $inlibc
+
 : see if setegid exists
 set setegid d_setegid
 eval $inlibc
@@ -11099,6 +11699,10 @@ eval $inlibc
 set sethostent d_sethent
 eval $inlibc
 
+: see if setitimer exists
+set setitimer d_setitimer
+eval $inlibc
+
 : see if setlinebuf exists
 set setlinebuf d_setlinebuf
 eval $inlibc
@@ -11206,11 +11810,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
        ;;
@@ -11229,6 +11828,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
@@ -11387,10 +12000,29 @@ set d_sigsetjmp
 eval $setvar
 $rm -f try.c try
 
+: see if sockatmark exists
+set sockatmark d_sockatmark
+eval $inlibc
+
+: see if prototype for sockatmark is available
+echo " "
+set d_sockatmarkproto sockatmark $d_socket sys/socket.h
+eval $hasproto
+
 : see if socks5_init exists
 set socks5_init d_socks5_init
 eval $inlibc
 
+: see if prototype for setresgid is available
+echo " "
+set d_sresgproto setresgid $i_unistd unistd.h
+eval $hasproto
+
+: see if prototype for setresuid is available
+echo " "
+set d_sresuproto setresuid $i_unistd unistd.h
+eval $hasproto
+
 : see if sys/stat.h is available
 set sys/stat.h i_sysstat
 eval $inhdr
@@ -11444,7 +12076,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)'
@@ -11484,6 +12137,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
@@ -11544,13 +12198,24 @@ $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");
-       char c = getc(fp);
+       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
@@ -11558,12 +12223,12 @@ int main() {
                puts("Fail even to read");
                exit (1);
        }
-       ptr = FILE_ptr(fp);
-       cnt = FILE_cnt(fp);
+       ptr = (char*) FILE_ptr(fp);
+       cnt = (size_t)FILE_cnt(fp);
 
-       FILE_ptr(fp)+= 42;
+       FILE_ptr(fp) += 42;
 
-       if (FILE_ptr(fp) != (ptr + 42)) {
+       if ((char*)FILE_ptr(fp) != (ptr + 42)) {
                printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
                exit (1);
        }
@@ -11747,6 +12412,10 @@ if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
     fi
 fi
 
+: see if strftime exists
+set strftime d_strftime
+eval $inlibc
+
 : see if strtod exists
 set strtod d_strtod
 eval $inlibc
@@ -11818,10 +12487,87 @@ EOM
        ;;
 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 +12593,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 +12626,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
@@ -11885,6 +12686,11 @@ eval $inlibc
 set syscall d_syscall
 eval $inlibc
 
+: see if prototype for syscall is available
+echo " "
+set d_syscallproto syscall $i_unistd unistd.h
+eval $hasproto
+
 : see if sysconf exists
 set sysconf d_sysconf
 eval $inlibc
@@ -11897,57 +12703,237 @@ eval $inlibc
 set tcgetpgrp d_tcgetpgrp
 eval $inlibc
 
-: see if tcsetpgrp exists
-set tcsetpgrp d_tcsetpgrp
-eval $inlibc
+: see if tcsetpgrp exists
+set tcsetpgrp d_tcsetpgrp
+eval $inlibc
+
+: see if prototype for telldir is available
+echo " "
+set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
+eval $hasproto
+
+: see if this is a sys/times.h system
+set sys/times.h i_systimes
+eval $inhdr
+
+: see if times exists
+echo " "
+if set times val -f d_times; eval $csym; $val; then
+       echo 'times() found.' >&4
+       d_times="$define"
+       inc=''
+       case "$i_systimes" in
+       "$define") inc='sys/times.h';;
+       esac
+       rp="What is the type returned by times() on this system?"
+       set clock_t clocktype long stdio.h sys/types.h $inc
+       eval $typedef_ask
+else
+       echo 'times() NOT found, hope that will do.' >&4
+       d_times="$undef"
+       clocktype='int'
+fi
+
+: see if truncate exists
+set truncate d_truncate
+eval $inlibc
+
+: see if tzname[] exists
+echo " "
+if set tzname val -a d_tzname; eval $csym; $val; then
+       val="$define"
+       echo 'tzname[] found.' >&4
+else
+       val="$undef"
+       echo 'tzname[] NOT found.' >&4
+fi
+set d_tzname
+eval $setvar
+
+case "$crosscompile" in
+''|[nN]*) crosscompile="$undef" ;;
+esac
+
+case "$osname" in
+next|rhapsody|darwin) multiarch="$define" ;;
+esac
+case "$multiarch" in
+''|[nN]*) multiarch="$undef" ;;
+esac
+
+: check for ordering of bytes in a long
+echo " "
+case "$crosscompile$multiarch" in
+*$define*)
+       $cat <<EOM
+You seem to be either cross-compiling or doing a multiarchitecture build,
+skipping the byteorder check.
+
+EOM
+       byteorder='0xffff'
+       ;;
+*)
+       case "$byteorder" in
+       '')
+               $cat <<'EOM'
+In the following, larger digits indicate more significance.  A big-endian
+machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
+little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
+machines may have weird orders like 3412.  A Cray will report 87654321,
+an Alpha will report 12345678. If the test program works the default is
+probably right.
+I'm now running the test program...
+EOM
+               $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+       int i;
+       union {
+               unsigned long l;
+               char c[sizeof(long)];
+       } u;
+
+       if (sizeof(long) > 4)
+               u.l = (0x08070605L << 32) | 0x04030201L;
+       else
+               u.l = 0x04030201L;
+       for (i = 0; i < sizeof(long); i++)
+               printf("%c", u.c[i]+'0');
+       printf("\n");
+       exit(0);
+}
+EOCP
+               xxx_prompt=y
+               set try
+               if eval $compile && ./try > /dev/null; then
+                       dflt=`./try`
+                       case "$dflt" in
+                       [1-4][1-4][1-4][1-4]|12345678|87654321)
+                               echo "(The test program ran ok.)"
+                               echo "byteorder=$dflt"
+                               xxx_prompt=n
+                       ;;
+                       ????|????????) echo "(The test program ran ok.)" ;;
+                       *) echo "(The test program didn't run right for some reason.)" ;;
+                       esac
+               else
+                       dflt='4321'
+                       cat <<'EOM'
+(I can't seem to compile the test program.  Guessing big-endian...)
+EOM
+               fi
+               case "$xxx_prompt" in
+               y)
+                       rp="What is the order of bytes in a long?"
+                       . ./myread
+                       byteorder="$ans"
+                       ;;
+               *)      byteorder=$dflt
+                       ;;
+               esac
+               ;;
+       esac
+       $rm -f try.c try
+       ;;
+esac
+
+
+$cat <<EOM
+
+Checking to see whether you can access character data unalignedly...
+EOM
+$cat >try.c <<EOCP
+#include <stdio.h>
+#define U32 $u32type
+#define BYTEORDER $byteorder
+int main() {
+#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
+    U8 buf[] = "\0\0\0\1\0\0\0\0";
+    U32 *up;
+    int i;
+
+    if (sizeof(U32) != 4) {
+       printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
+       exit(1);
+    }
 
-: see if prototype for telldir is available
-echo " "
-set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
-eval $hasproto
+    fflush(stdout);
+
+    for (i = 0; i < 4; i++) {
+       up = (U32*)(buf + i);
+       if (! ((*up == 1 << (8*i)) ||   /* big-endian */
+              (*up == 1 << (8*(3-i)))  /* little-endian */
+             )
+          )
+       {
+           printf("read failed (%x)\n", *up);
+           exit(2);
+       }
+    }
 
-: see if this is a sys/times.h system
-set sys/times.h i_systimes
-eval $inhdr
+    /* write test */
+    for (i = 0; i < 4; i++) {
+       up = (U32*)(buf + i);
+       *up = 0xBeef;
+       if (*up != 0xBeef) {
+           printf("write failed (%x)\n", *up);
+           exit(3);
+       }
+    }
 
-: see if times exists
-echo " "
-if set times val -f d_times; eval $csym; $val; then
-       echo 'times() found.' >&4
-       d_times="$define"
-       inc=''
-       case "$i_systimes" in
-       "$define") inc='sys/times.h';;
+    exit(0);
+#else
+    printf("1\n");
+    exit(1);
+#endif
+    return 0;
+}
+EOCP
+set try
+if eval $compile_ok; then
+       echo "(Testign for character data alignment may dump core.)" >&4
+       ./try 2>&1 >/dev/null
+       case "$?" in
+       0)      cat >&4 <<EOM
+You can access character data pretty unalignedly.
+EOM
+               d_u32align="$undef"
+               ;;
+       *)      cat >&4 <<EOM
+It seems that you must access character data in an aligned manner.
+EOM
+               d_u32align="$define"
+               ;;
        esac
-       rp="What is the type returned by times() on this system?"
-       set clock_t clocktype long stdio.h sys/types.h $inc
-       eval $typedef_ask
+       $rm -f core core.try.* try.core
 else
-       echo 'times() NOT found, hope that will do.' >&4
-       d_times="$undef"
-       clocktype='int'
+       rp='Can you access character data at unaligned addresses?'
+       dflt='n'
+       . ./myread
+       case "$ans" in
+       [yY]*)  d_u32align="$undef"  ;;
+       *)      d_u32align="$define" ;;
+       esac
 fi
 
-: see if truncate exists
-set truncate d_truncate
+: see if ualarm exists
+set ualarm d_ualarm
 eval $inlibc
 
-: see if tzname[] exists
-echo " "
-if set tzname val -a d_tzname; eval $csym; $val; then
-       val="$define"
-       echo 'tzname[] found.' >&4
-else
-       val="$undef"
-       echo 'tzname[] NOT found.' >&4
-fi
-set d_tzname
-eval $setvar
-
 : see if umask exists
 set umask d_umask
 eval $inlibc
 
+: see if usleep exists
+set usleep d_usleep
+eval $inlibc
+
+: see if prototype for usleep is available
+echo " "
+set d_usleepproto usleep $i_unistd unistd.h
+eval $hasproto
+
 : see if ustat exists
 set ustat d_ustat
 eval $inlibc
@@ -12064,37 +13050,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
@@ -12111,6 +13066,10 @@ eval $inlibc
 set wctomb d_wctomb
 eval $inlibc
 
+: see if writev exists
+set writev d_writev
+eval $inlibc
+
 : preserve RCS keywords in files with variable substitution, grrr
 Date='$Date'
 Id='$Id'
@@ -12118,17 +13077,6 @@ Log='$Log'
 RCSfile='$RCSfile'
 Revision='$Revision'
 
-case "$crosscompile" in
-''|[nN]*) crosscompile="$undef" ;;
-esac
-
-case "$osname" in
-next|rhapsody|darwin) multiarch="$define" ;;
-esac
-case "$multiarch" in
-''|[nN]*) multiarch="$undef" ;;
-esac
-
 : check for alignment requirements
 echo " "
 case "$crosscompile$multiarch" in
@@ -12188,84 +13136,6 @@ esac
 : set the base revision
 baserev=5.0
 
-: check for ordering of bytes in a long
-echo " "
-case "$crosscompile$multiarch" in
-*$define*)
-       $cat <<EOM
-You seem to be either cross-compiling or doing a multiarchitecture build,
-skipping the byteorder check.
-
-EOM
-       byteorder='0xffff'
-       ;;
-*)
-       case "$byteorder" in
-       '')
-               $cat <<'EOM'
-In the following, larger digits indicate more significance.  A big-endian
-machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
-little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
-machines may have weird orders like 3412.  A Cray will report 87654321,
-an Alpha will report 12345678. If the test program works the default is
-probably right.
-I'm now running the test program...
-EOM
-               $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-       int i;
-       union {
-               unsigned long l;
-               char c[sizeof(long)];
-       } u;
-
-       if (sizeof(long) > 4)
-               u.l = (0x08070605L << 32) | 0x04030201L;
-       else
-               u.l = 0x04030201L;
-       for (i = 0; i < sizeof(long); i++)
-               printf("%c", u.c[i]+'0');
-       printf("\n");
-       exit(0);
-}
-EOCP
-               xxx_prompt=y
-               set try
-               if eval $compile && ./try > /dev/null; then
-                       dflt=`./try`
-                       case "$dflt" in
-                       [1-4][1-4][1-4][1-4]|12345678|87654321)
-                               echo "(The test program ran ok.)"
-                               echo "byteorder=$dflt"
-                               xxx_prompt=n
-                       ;;
-                       ????|????????) echo "(The test program ran ok.)" ;;
-                       *) echo "(The test program didn't run right for some reason.)" ;;
-                       esac
-               else
-                       dflt='4321'
-                       cat <<'EOM'
-(I can't seem to compile the test program.  Guessing big-endian...)
-EOM
-               fi
-               case "$xxx_prompt" in
-               y)
-                       rp="What is the order of bytes in a long?"
-                       . ./myread
-                       byteorder="$ans"
-                       ;;
-               *)      byteorder=$dflt
-                       ;;
-               esac
-               ;;
-       esac
-       $rm -f try.c try
-       ;;
-esac
-
-
 : how do we catenate cpp tokens here?
 echo " "
 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
@@ -12311,13 +13181,19 @@ $define)
 #include <sys/types.h>
 #include <stdio.h>
 #include <db.h>
-int main()
+int main(int argc, char *argv[])
 {
 #ifdef DB_VERSION_MAJOR        /* DB version >= 2 */
     int Major, Minor, Patch ;
     unsigned long Version ;
     (void)db_version(&Major, &Minor, &Patch) ;
-    printf("You have Berkeley DB Version 2 or greater\n");
+    if (argc == 2) {
+        printf("%d %d %d %d %d %d\n",
+               DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
+               Major, Minor, Patch);
+        exit(0);
+    }
+    printf("You have Berkeley DB Version 2 or greater.\n");
 
     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
@@ -12326,11 +13202,11 @@ int main()
 
     /* check that db.h & libdb are compatible */
     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
-       printf("db.h and libdb are incompatible\n") ;
+       printf("db.h and libdb are incompatible.\n") ;
         exit(3);       
     }
 
-    printf("db.h and libdb are compatible\n") ;
+    printf("db.h and libdb are compatible.\n") ;
 
     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
                + DB_VERSION_PATCH ;
@@ -12338,14 +13214,18 @@ int main()
     /* needs to be >= 2.3.4 */
     if (Version < 2003004) {
     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
-       printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
+       printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
         exit(2);       
     }
 
     exit(0);
 #else
 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
-    printf("You have Berkeley DB Version 1\n");
+    if (argc == 2) {
+        printf("1 0 0\n");
+        exit(0);
+    }
+    printf("You have Berkeley DB Version 1.\n");
     exit(0);   /* DB version < 2: the coast is clear. */
 #else
     exit(1);   /* <db.h> not Berkeley DB? */
@@ -12356,6 +13236,10 @@ EOCP
        set try
        if eval $compile_ok && ./try; then
                echo 'Looks OK.' >&4
+               set `./try 1`
+               db_version_major=$1
+               db_version_minor=$2
+               db_version_patch=$3
        else
                echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
                i_db=$undef
@@ -12429,133 +13313,41 @@ define)
 #ifndef HASCONST
 #define const
 #endif
-#include <sys/types.h>
-#include <db.h>
-
-#ifndef DB_VERSION_MAJOR
-size_t prefix_cb (key1, key2)
-const DBT *key1;
-const DBT *key2;
-{
-}
-BTREEINFO info;
-int main()
-{
-       info.prefix = prefix_cb;
-}
-#endif
-EOCP
-       if $cc $ccflags -c try.c  >try.out 2>&1 ; then
-               if $contains warning try.out >>/dev/null 2>&1 ; then
-                       db_prefixtype='int'
-               else
-                       db_prefixtype='size_t'
-               fi
-       else
-               db_prefixtype='size_t'
-               : XXX Maybe we should just give up here.
-               $cat try.out >&4
-               echo "Help:  I can't seem to compile the db test program." >&4
-               echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
-       fi
-       $rm -f try.*
-       echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
-       ;;
-*)     db_prefixtype='size_t'
-       ;;
-esac
-
-: check for void type
-echo " "
-echo "Checking to see how well your C compiler groks the void type..." >&4
-case "$voidflags" in
-'')
-       $cat >try.c <<'EOCP'
-#if TRY & 1
-void sub() {
-#else
-sub() {
-#endif
-       extern void moo();      /* function returning void */
-       void (*goo)();          /* ptr to func returning void */
-#if TRY & 8
-       void *hue;              /* generic ptr */
-#endif
-#if TRY & 2
-       void (*foo[10])();
-#endif
-
-#if TRY & 4
-       if(goo == moo) {
-               exit(0);
-       }
-#endif
-       exit(0);
+#include <sys/types.h>
+#include <db.h>
+
+#ifndef DB_VERSION_MAJOR
+size_t prefix_cb (key1, key2)
+const DBT *key1;
+const DBT *key2;
+{
 }
-int main() { sub(); }
+BTREEINFO info;
+int main()
+{
+       info.prefix = prefix_cb;
+}
+#endif
 EOCP
-       if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
-               voidflags=$defvoidused
-       echo "Good.  It appears to support void to the level $package wants.">&4
-               if $contains warning .out >/dev/null 2>&1; then
-                       echo "However, you might get some warnings that look like this:"
-                       $cat .out
-               fi
-       else
-echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
-               if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
-                       echo "It supports 1..."
-                       if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
-                               echo "It also supports 2..."
-                               if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
-                                       voidflags=7
-                                       echo "And it supports 4 but not 8 definitely."
-                               else
-                                       echo "It doesn't support 4..."
-                                       if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
-                                               voidflags=11
-                                               echo "But it supports 8."
-                                       else
-                                               voidflags=3
-                                               echo "Neither does it support 8."
-                                       fi
-                               fi
-                       else
-                               echo "It does not support 2..."
-                               if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
-                                       voidflags=13
-                                       echo "But it supports 4 and 8."
-                               else
-                                       if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
-                                               voidflags=5
-                                               echo "And it supports 4 but has not heard about 8."
-                                       else
-                                               echo "However it supports 8 but not 4."
-                                       fi
-                               fi
-                       fi
+       if $cc $ccflags -c try.c  >try.out 2>&1 ; then
+               if $contains warning try.out >>/dev/null 2>&1 ; then
+                       db_prefixtype='int'
                else
-                       echo "There is no support at all for void."
-                       voidflags=0
+                       db_prefixtype='size_t'
                fi
+       else
+               db_prefixtype='size_t'
+               : XXX Maybe we should just give up here.
+               $cat try.out >&4
+               echo "Help:  I can't seem to compile the db test program." >&4
+               echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
        fi
-esac
-case "$voidflags" in
-"$defvoidused") ;;
-*)     $cat >&4 <<'EOM'
-  Support flag bits are:
-    1: basic void declarations.
-    2: arrays of pointers to functions returning void.
-    4: operations between pointers to and addresses of void functions.
-    8: generic void pointers.
-EOM
-       dflt="$voidflags";
-       rp="Your void support flags add up to what?"
-       . ./myread
-       voidflags="$ans"
+       $rm -f try.*
+       echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
+       ;;
+*)     db_prefixtype='size_t'
        ;;
 esac
-$rm -f try.* .out
 
 
 : How can we generate normalized random numbers ?
@@ -13169,13 +13961,13 @@ EOCP
        fi
 fi
 
-if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
-       $cat >try.c <<'EOCP'
+if $test X"$sPRId64" = X -a X"$quadtype" != X; then
+       $cat >try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
 int main() {
-  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
-  printf("%lld\n", q);
+  $quadtype q = 12345678901;
+  printf("%Ld\n", q);
 }
 EOCP
        set try
@@ -13183,21 +13975,21 @@ EOCP
                yyy=`./try$exe_ext`
                case "$yyy" in
                12345678901)
-                       sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
-                       sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
-                       echo "We will use the %lld style."
+                       sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
+                       sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
+                       echo "We will use %Ld."
                        ;;
                esac
        fi
 fi
 
-if $test X"$sPRId64" = X -a X"$quadtype" != X; then
-       $cat >try.c <<EOCP
+if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
+       $cat >try.c <<'EOCP'
 #include <sys/types.h>
 #include <stdio.h>
 int main() {
-  $quadtype q = 12345678901;
-  printf("%Ld\n", q);
+  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
+  printf("%lld\n", q);
 }
 EOCP
        set try
@@ -13205,9 +13997,9 @@ EOCP
                yyy=`./try$exe_ext`
                case "$yyy" in
                12345678901)
-                       sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
-                       sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
-                       echo "We will use %Ld."
+                       sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
+                       sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
+                       echo "We will use the %lld style."
                        ;;
                esac
        fi
 *)  groupstype="$gidtype";;
 esac
 
-echo " "
-echo "Checking if your $make program sets \$(MAKE)..." >&4
-case "$make_set_make" in
-'')
-       $sed 's/^X //' > testmake.mak << 'EOF'
-Xall:
-X      @echo 'maketemp="$(MAKE)"'
-EOF
-       case "`$make -f testmake.mak 2>/dev/null`" in
-       *maketemp=*) make_set_make='#' ;;
-       *)      make_set_make="MAKE=$make" ;;
+echo " "
+echo "Checking if your $make program sets \$(MAKE)..." >&4
+case "$make_set_make" in
+'')
+       $sed 's/^X //' > testmake.mak << 'EOF'
+Xall:
+X      @echo 'maketemp="$(MAKE)"'
+EOF
+       case "`$make -f testmake.mak 2>/dev/null`" in
+       *maketemp=*) make_set_make='#' ;;
+       *)      make_set_make="MAKE=$make" ;;
+       esac
+       $rm -f testmake.mak
+       ;;
+esac
+case "$make_set_make" in
+'#') echo "Yup, it does.";;
+*) echo "Nope, it doesn't.";;
+esac
+
+: see what type is used for mode_t
+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
+
+: 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 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 testmake.mak
+       $rm -f try.* core core.* *.core *.core.*
+       ;;
+*)     echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
        ;;
 esac
-case "$make_set_make" in
-'#') echo "Yup, it does.";;
-*) echo "Nope, it doesn't.";;
-esac
-
-: see what type is used for mode_t
-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
@@ -13619,39 +14573,6 @@ esac
 : The versioned directories started at 5.005.
 pm_apiversion='5.005'
 
-: check for length of pointer
-echo " "
-case "$ptrsize" in
-'')
-       echo "Checking to see how big your pointers are..." >&4
-       if test "$voidflags" -gt 7; then
-               echo '#define VOID_PTR char *' > try.c
-       else
-               echo '#define VOID_PTR void *' > try.c
-       fi
-       $cat >>try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-    printf("%d\n", (int)sizeof(VOID_PTR));
-    exit(0);
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               ptrsize=`./try`
-               echo "Your pointers are $ptrsize bytes long."
-       else
-               dflt='4'
-               echo "(I can't seem to compile the test program.  Guessing...)" >&4
-               rp="What is the size of a pointer (in bytes)?"
-               . ./myread
-               ptrsize="$ans"
-       fi
-       ;;
-esac
-$rm -f try.c try
-
 : see if ar generates random libraries by itself
 echo " "
 echo "Checking how to generate random libraries on your machine..." >&4
@@ -13856,7 +14777,7 @@ else
        xxx=`echo '#include <signal.h>' |
        $cppstdin $cppminus $cppflags 2>/dev/null |
        $grep '^[       ]*#.*include' | 
-       $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
+       $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
 fi
 : Check this list of files to be sure we have parsed the cpp output ok.
 : This will also avoid potentially non-existent files, such 
@@ -14102,6 +15023,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 " "
@@ -14161,6 +15083,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")
@@ -14168,7 +15094,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"
@@ -14177,10 +15102,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
@@ -14241,13 +15175,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 " "
@@ -14397,59 +15335,36 @@ case "$uidsign" in
        ;;
 esac
 
-: see if dbm.h is available
-: see if dbmclose exists
-set dbmclose d_dbmclose
-eval $inlibc
-
-case "$d_dbmclose" in
-$define)
-       set dbm.h i_dbm
-       eval $inhdr
-       case "$i_dbm" in
-       $define)
-               val="$undef"
-               set i_rpcsvcdbm
-               eval $setvar
-               ;;
-       *)      set rpcsvc/dbm.h i_rpcsvcdbm
-               eval $inhdr
+: 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
        ;;
-*)     echo "We won't be including <dbm.h>"
-       val="$undef"
-       set i_dbm
-       eval $setvar
-       val="$undef"
-       set i_rpcsvcdbm
-       eval $setvar
-       ;;
-esac
-
-: see if this is a sys/file.h system
-val=''
-set sys/file.h val
-eval $inhdr
-
-: do we need to include sys/file.h ?
-case "$val" in
-"$define")
-       echo " "
-       if $h_sysfile; then
-               val="$define"
-               echo "We'll be including <sys/file.h>." >&4
-       else
-               val="$undef"
-               echo "We won't be including <sys/file.h>." >&4
-       fi
-       ;;
-*)
-       h_sysfile=false
-       ;;
 esac
-set i_sysfile
-eval $setvar
 
 : see if fcntl.h is there
 val=''
@@ -14580,9 +15495,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
@@ -14595,7 +15510,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
@@ -14619,7 +15534,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
@@ -14627,6 +15542,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
@@ -14673,12 +15589,12 @@ $awk \\
 EOSH
 cat <<'EOSH' >> Cppsym.try
 'length($1) > 0 {
-    printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
-    printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
-    printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
-    printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
+    printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
+    printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
+    printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
+    printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
 }'      >> try.c
-echo '}' >> try.c
+echo 'return 0;}' >> try.c
 EOSH
 cat <<EOSH >> Cppsym.try
 ccflags="$ccflags"
@@ -14827,108 +15743,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
@@ -14984,10 +15818,6 @@ eval $inhdr
 set sys/statvfs.h i_sysstatvfs
 eval $inhdr
 
-: see if this is a sys/uio.h system
-set sys/uio.h i_sysuio
-eval $inhdr
-
 : see if this is a sys/un.h system
 set sys/un.h i_sysun
 eval $inhdr
@@ -15155,8 +15985,11 @@ for xxx in $known_extensions ; do
                esac
                ;;
        Thread|thread)
-               case "$usethreads" in 
-               true|$define|y) avail_ext="$avail_ext $xxx" ;;
+                case "$usethreads" in
+                true|$define|y)
+                        case "$useithreads" in
+                        $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
+                        esac
                esac
                ;;
        IPC/SysV|ipc/sysv)
@@ -15401,6 +16234,7 @@ _a='$_a'
 _exe='$_exe'
 _o='$_o'
 afs='$afs'
+afsroot='$afsroot'
 alignbytes='$alignbytes'
 ansi2knr='$ansi2knr'
 aphostname='$aphostname'
@@ -15473,6 +16307,7 @@ 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,11 +16329,13 @@ d_chown='$d_chown'
 d_chroot='$d_chroot'
 d_chsize='$d_chsize'
 d_closedir='$d_closedir'
+d_cmsghdr_s='$d_cmsghdr_s'
 d_const='$d_const'
 d_crypt='$d_crypt'
 d_csh='$d_csh'
 d_cuserid='$d_cuserid'
 d_dbl_dig='$d_dbl_dig'
+d_dbminitproto='$d_dbminitproto'
 d_difftime='$d_difftime'
 d_dirnamlen='$d_dirnamlen'
 d_dlerror='$d_dlerror'
@@ -15526,6 +16363,7 @@ d_fds_bits='$d_fds_bits'
 d_fgetpos='$d_fgetpos'
 d_flexfnam='$d_flexfnam'
 d_flock='$d_flock'
+d_flockproto='$d_flockproto'
 d_fork='$d_fork'
 d_fpathconf='$d_fpathconf'
 d_fpos64_t='$d_fpos64_t'
@@ -15535,6 +16373,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'
@@ -15547,6 +16386,7 @@ d_gethbyname='$d_gethbyname'
 d_gethent='$d_gethent'
 d_gethname='$d_gethname'
 d_gethostprotos='$d_gethostprotos'
+d_getitimer='$d_getitimer'
 d_getlogin='$d_getlogin'
 d_getmnt='$d_getmnt'
 d_getmntent='$d_getmntent'
@@ -15554,6 +16394,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'
@@ -15609,6 +16450,7 @@ d_mkstemps='$d_mkstemps'
 d_mktime='$d_mktime'
 d_mmap='$d_mmap'
 d_modfl='$d_modfl'
+d_modfl_pow32_bug='$d_modfl_pow32_bug'
 d_mprotect='$d_mprotect'
 d_msg='$d_msg'
 d_msg_ctrunc='$d_msg_ctrunc'
@@ -15618,6 +16460,7 @@ d_msg_peek='$d_msg_peek'
 d_msg_proxy='$d_msg_proxy'
 d_msgctl='$d_msgctl'
 d_msgget='$d_msgget'
+d_msghdr_s='$d_msghdr_s'
 d_msgrcv='$d_msgrcv'
 d_msgsnd='$d_msgsnd'
 d_msync='$d_msync'
@@ -15651,12 +16494,16 @@ d_qgcvt='$d_qgcvt'
 d_quad='$d_quad'
 d_readdir='$d_readdir'
 d_readlink='$d_readlink'
+d_readv='$d_readv'
+d_realpath='$d_realpath'
+d_recvmsg='$d_recvmsg'
 d_rename='$d_rename'
 d_rewinddir='$d_rewinddir'
 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'
@@ -15667,11 +16514,13 @@ d_semctl_semid_ds='$d_semctl_semid_ds'
 d_semctl_semun='$d_semctl_semun'
 d_semget='$d_semget'
 d_semop='$d_semop'
+d_sendmsg='$d_sendmsg'
 d_setegid='$d_setegid'
 d_seteuid='$d_seteuid'
 d_setgrent='$d_setgrent'
 d_setgrps='$d_setgrps'
 d_sethent='$d_sethent'
+d_setitimer='$d_setitimer'
 d_setlinebuf='$d_setlinebuf'
 d_setlocale='$d_setlocale'
 d_setnent='$d_setnent'
@@ -15699,12 +16548,17 @@ 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_sockatmarkproto='$d_sockatmarkproto'
 d_socket='$d_socket'
 d_socklen_t='$d_socklen_t'
 d_sockpair='$d_sockpair'
 d_socks5_init='$d_socks5_init'
 d_sqrtl='$d_sqrtl'
+d_sresgproto='$d_sresgproto'
+d_sresuproto='$d_sresuproto'
 d_statblks='$d_statblks'
 d_statfs_f_flags='$d_statfs_f_flags'
 d_statfs_s='$d_statfs_s'
@@ -15721,10 +16575,12 @@ d_strcoll='$d_strcoll'
 d_strctcpy='$d_strctcpy'
 d_strerrm='$d_strerrm'
 d_strerror='$d_strerror'
+d_strftime='$d_strftime'
 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'
@@ -15732,6 +16588,7 @@ d_strxfrm='$d_strxfrm'
 d_suidsafe='$d_suidsafe'
 d_symlink='$d_symlink'
 d_syscall='$d_syscall'
+d_syscallproto='$d_syscallproto'
 d_sysconf='$d_sysconf'
 d_sysernlst='$d_sysernlst'
 d_syserrlst='$d_syserrlst'
@@ -15744,9 +16601,13 @@ d_time='$d_time'
 d_times='$d_times'
 d_truncate='$d_truncate'
 d_tzname='$d_tzname'
+d_u32align='$d_u32align'
+d_ualarm='$d_ualarm'
 d_umask='$d_umask'
 d_uname='$d_uname'
 d_union_semun='$d_union_semun'
+d_usleep='$d_usleep'
+d_usleepproto='$d_usleepproto'
 d_ustat='$d_ustat'
 d_vendorarch='$d_vendorarch'
 d_vendorbin='$d_vendorbin'
@@ -15761,10 +16622,14 @@ d_wait4='$d_wait4'
 d_waitpid='$d_waitpid'
 d_wcstombs='$d_wcstombs'
 d_wctomb='$d_wctomb'
+d_writev='$d_writev'
 d_xenix='$d_xenix'
 date='$date'
 db_hashtype='$db_hashtype'
 db_prefixtype='$db_prefixtype'
+db_version_major='$db_version_major'
+db_version_minor='$db_version_minor'
+db_version_patch='$db_version_patch'
 defvoidused='$defvoidused'
 direntrytype='$direntrytype'
 dlext='$dlext'
@@ -15916,6 +16781,7 @@ installvendorarch='$installvendorarch'
 installvendorbin='$installvendorbin'
 installvendorlib='$installvendorlib'
 intsize='$intsize'
+issymlink='$issymlink'
 ivdformat='$ivdformat'
 ivsize='$ivsize'
 ivtype='$ivtype'
@@ -15978,6 +16844,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'
@@ -16010,6 +16877,7 @@ patchlevel='$patchlevel'
 path_sep='$path_sep'
 perl5='$perl5'
 perl='$perl'
+perl_patchlevel='$perl_patchlevel'
 perladmin='$perladmin'
 perllibs='$perllibs'
 perlpath='$perlpath'
@@ -16070,6 +16938,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'
@@ -16176,6 +17045,8 @@ vi='$vi'
 voidflags='$voidflags'
 xlibpth='$xlibpth'
 xs_apiversion='$xs_apiversion'
+yacc='$yacc'
+yaccflags='$yaccflags'
 zcat='$zcat'
 zip='$zip'
 EOT
@@ -16186,7 +17057,8 @@ $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
 : add special variables
 $test -f $src/patchlevel.h && \
 awk '/^#define[        ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
-echo "CONFIGDOTSH=true" >>config.sh
+echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
+echo "PERL_CONFIG_SH=true" >>config.sh
 
 : propagate old symbols
 if $test -f UU/config.sh; then
@@ -16216,7 +17088,7 @@ fi
 case "$alldone" in
 exit)
        $rm -rf UU
-       echo "Done."
+       echo "Extraction done."
        exit 0
        ;;
 cont)
@@ -16276,7 +17148,7 @@ elif test -f [Mm]akefile; then
        echo " "
        echo "Now you must run a $make."
 else
-       echo "Done."
+       echo "Configure done."
 fi
 
 if $test -f Policy.sh; then