This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Metaconfig and Porting patches from Andy; start using the new
[perl5.git] / Configure
index 52ec439..adc58e9 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Tue Jul  6 18:36:05 EET DST 1999 [metaconfig 3.0 PL70]
+# Generated on Sat Jan 15 23:59:51 EET 2000 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.com)
 
 cat >/tmp/c1$$ <<EOF
@@ -278,10 +278,14 @@ d_archlib=''
 installarchlib=''
 archname=''
 myarchname=''
+d_atolf=''
+d_atoll=''
 baserev=''
 bin=''
 binexp=''
 installbin=''
+bincompat5005=''
+d_bincompat5005=''
 byteorder=''
 cc=''
 gccversion=''
@@ -294,6 +298,7 @@ optimize=''
 cf_email=''
 cf_by=''
 cf_time=''
+charsize=''
 contains=''
 cpp_stuff=''
 cpplast=''
@@ -349,8 +354,10 @@ d_fgetpos=''
 d_flexfnam=''
 d_flock=''
 d_fork=''
+d_fs_data_s=''
 d_fseeko=''
 d_fsetpos=''
+d_fstatfs=''
 d_ftello=''
 d_ftime=''
 d_gettimeod=''
@@ -366,6 +373,7 @@ d_phostname=''
 d_uname=''
 d_gethostprotos=''
 d_getlogin=''
+d_getmnt=''
 d_getmntent=''
 d_getnbyaddr=''
 d_getnbyname=''
@@ -392,9 +400,11 @@ d_gnulibc=''
 d_hasmntopt=''
 d_htonl=''
 d_inetaton=''
+d_int64t=''
 d_isascii=''
 d_killpg=''
 d_lchown=''
+d_ldbl_dig=''
 d_link=''
 d_locconv=''
 d_lockf=''
@@ -403,7 +413,6 @@ longdblsize=''
 d_longlong=''
 longlongsize=''
 d_lstat=''
-d_madvise=''
 d_mblen=''
 d_mbstowcs=''
 d_mbtowc=''
@@ -415,16 +424,11 @@ d_memset=''
 d_mkdir=''
 d_mkfifo=''
 d_mktime=''
-d_mmap=''
-mmaptype=''
-d_mprotect=''
 d_msg=''
 d_msgctl=''
 d_msgget=''
 d_msgrcv=''
 d_msgsnd=''
-d_msync=''
-d_munmap=''
 d_nice=''
 d_open3=''
 d_fpathconf=''
@@ -438,12 +442,12 @@ old_pthread_create_joinable=''
 d_pthread_yield=''
 d_sched_yield=''
 sched_yield=''
+d_qgcvt=''
 d_readdir=''
 d_rewinddir=''
 d_seekdir=''
 d_telldir=''
 d_readlink=''
-d_readv=''
 d_rename=''
 d_rmdir=''
 d_safebcpy=''
@@ -490,25 +494,21 @@ d_shmdt=''
 d_shmget=''
 d_sigaction=''
 d_sigsetjmp=''
-d_cmsghdr_s=''
 d_msg_ctrunc=''
 d_msg_dontroute=''
 d_msg_oob=''
 d_msg_peek=''
 d_msg_proxy=''
-d_msghdr_s=''
 d_oldsock=''
-d_recvmsg=''
 d_scm_rights=''
-d_sendmsg=''
 d_socket=''
 d_sockpair=''
 sockethdr=''
 socketlib=''
+d_sqrtl=''
 d_statblks=''
-d_fstatfs=''
-d_statfs=''
-d_statfsflags=''
+d_statfs_f_flags=''
+d_statfs_s=''
 d_fstatvfs=''
 d_statvfs=''
 d_stdio_cnt_lval=''
@@ -530,7 +530,10 @@ d_sysernlst=''
 d_syserrlst=''
 d_strtod=''
 d_strtol=''
+d_strtold=''
 d_strtoul=''
+d_strtoull=''
+d_strtouq=''
 d_strxfrm=''
 d_symlink=''
 d_syscall=''
@@ -549,6 +552,7 @@ d_umask=''
 d_semctl_semid_ds=''
 d_semctl_semun=''
 d_union_semun=''
+d_ustat=''
 d_vfork=''
 usevfork=''
 d_voidsig=''
@@ -560,14 +564,6 @@ d_wait4=''
 d_waitpid=''
 d_wcstombs=''
 d_wctomb=''
-d_writev=''
-d_dbmclose64=''
-d_dbminit64=''
-d_delete64=''
-d_fetch64=''
-d_firstkey64=''
-d_nextkey64=''
-d_store64=''
 dlext=''
 cccdlflags=''
 ccdlflags=''
@@ -579,7 +575,11 @@ doublesize=''
 ebcdic=''
 fflushNULL=''
 fflushall=''
+fpossize=''
 fpostype=''
+gidformat=''
+gidsign=''
+gidsize=''
 gidtype=''
 groupstype=''
 h_fcntl=''
@@ -600,7 +600,6 @@ i_float=''
 i_gdbm=''
 d_grpasswd=''
 i_grp=''
-d_int64t=''
 i_inttypes=''
 i_limits=''
 i_locale=''
@@ -641,7 +640,6 @@ i_bsdioctl=''
 i_sysfilio=''
 i_sysioctl=''
 i_syssockio=''
-i_sysmman=''
 i_sysmount=''
 i_sysndir=''
 i_sysparam=''
@@ -649,12 +647,13 @@ i_sysresrc=''
 i_syssecrt=''
 i_sysselct=''
 i_sysstat=''
+i_sysstatfs=''
 i_sysstatvfs=''
 i_systimes=''
 i_systypes=''
-d_iovec_s=''
 i_sysuio=''
 i_sysun=''
+i_sysvfs=''
 i_syswait=''
 i_sgtty=''
 i_termio=''
@@ -664,35 +663,25 @@ i_systimek=''
 i_time=''
 timeincl=''
 i_unistd=''
+i_ustat=''
 i_utime=''
 i_values=''
 i_stdarg=''
 i_varargs=''
 i_varhdr=''
 i_vfork=''
+inc_version_list=''
+installprefix=''
+installprefixexp=''
+installstyle=''
 installusrbinperl=''
 intsize=''
 longsize=''
 shortsize=''
-d_dirent64_s=''
-d_flock64_s=''
-d_fstat64=''
-d_ftruncate64=''
-d_ino64_t=''
-d_llseek=''
-d_lockf64=''
-d_lseek64=''
-d_lstat64=''
+d_fpos64_t=''
 d_off64_t=''
-d_offset_t=''
-d_open64=''
-d_opendir64=''
-d_readdir64=''
-d_seekdir64=''
-d_stat64=''
-d_telldir64=''
-d_truncate64=''
 libc=''
+ldlibpthname=''
 libperl=''
 shrpenv=''
 useshrplib=''
@@ -704,6 +693,18 @@ xlibpth=''
 ignore_versioned_solibs=''
 libs=''
 lns=''
+d_PRIEldbl=''
+d_PRIFldbl=''
+d_PRIGldbl=''
+d_PRIeldbl=''
+d_PRIfldbl=''
+d_PRIgldbl=''
+sPRIEldbl=''
+sPRIFldbl=''
+sPRIGldbl=''
+sPRIeldbl=''
+sPRIfldbl=''
+sPRIgldbl=''
 lseeksize=''
 lseektype=''
 make_set_make=''
@@ -750,12 +751,41 @@ ranlib=''
 package=''
 spackage=''
 pager=''
-apiversion=''
+api_revision=''
+api_subversion=''
+api_version=''
+api_versionstring=''
 patchlevel=''
 subversion=''
 version=''
 perladmin=''
 perlpath=''
+i16size=''
+i16type=''
+i32size=''
+i32type=''
+i64size=''
+i64type=''
+i8size=''
+i8type=''
+ivsize=''
+ivtype=''
+nvsize=''
+nvtype=''
+u16size=''
+u16type=''
+u32size=''
+u32type=''
+u64size=''
+u64type=''
+u8size=''
+u8type=''
+uvsize=''
+uvtype=''
+ivdformat=''
+uvoformat=''
+uvuformat=''
+uvxformat=''
 pidtype=''
 prefix=''
 prefixexp=''
@@ -764,6 +794,22 @@ privlib=''
 privlibexp=''
 prototype=''
 ptrsize=''
+d_PRIX64=''
+d_PRId64=''
+d_PRIi64=''
+d_PRIo64=''
+d_PRIu64=''
+d_PRIx64=''
+sPRIX64=''
+sPRId64=''
+sPRIi64=''
+sPRIo64=''
+sPRIu64=''
+sPRIx64=''
+d_quad=''
+quadkind=''
+quadtype=''
+uquadtype=''
 drand01=''
 randbits=''
 randfunc=''
@@ -783,9 +829,14 @@ sig_num_init=''
 installsitearch=''
 sitearch=''
 sitearchexp=''
+installsitebin=''
+sitebin=''
+sitebinexp=''
 installsitelib=''
 sitelib=''
 sitelibexp=''
+siteprefix=''
+siteprefixexp=''
 sizetype=''
 so=''
 sharpbang=''
@@ -796,22 +847,20 @@ ssizetype=''
 startperl=''
 startsh=''
 stdchar=''
-d_fgetpos64=''
-d_fopen64=''
-d_freopen64=''
-d_fseek64=''
-d_fseeko64=''
-d_fsetpos64=''
-d_ftell64=''
-d_ftello64=''
-d_tmpfile64=''
 d_stdio_stream_array=''
 stdio_stream_array=''
 sysman=''
 trnl=''
+uidformat=''
+uidsign=''
+uidsize=''
 uidtype=''
 archname64=''
 use64bits=''
+uselargefiles=''
+uselongdouble=''
+uselonglong=''
+usemorebits=''
 usemultiplicity=''
 nm_opt=''
 nm_so_opt=''
@@ -820,11 +869,23 @@ usenm=''
 useperlio=''
 usesocks=''
 d_oldpthreads=''
+use5005threads=''
+useithreads=''
 usethreads=''
 incpath=''
-mips=''
 mips_type=''
 usrinc=''
+d_vendorbin=''
+installvendorbin=''
+vendorbin=''
+vendorbinexp=''
+d_vendorlib=''
+installvendorlib=''
+vendorlib=''
+vendorlibexp=''
+usevendorprefix=''
+vendorprefix=''
+vendorprefixexp=''
 defvoidused=''
 voidflags=''
 CONFIG=''
@@ -844,14 +905,6 @@ if test -f /etc/unixtovms.exe; then
 fi
 
 i_whoami=''
-: Possible local include directories to search.
-: Set locincpth to "" in a hint file to defeat local include searches.
-locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
-locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
-:
-: no include file wanted by default
-inclwanted=''
-
 : list of known cpp symbols, sorted alphabetically
 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
@@ -859,7 +912,7 @@ al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
-al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
+al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
 al="$al VMS Xenix286"
@@ -917,10 +970,22 @@ al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
 al="$al xenix z8000"
 
+: set useposix=false in your hint file to disable the POSIX extension.
+useposix=true
+: set useopcode=false in your hint file to disable the Opcode extension.
+useopcode=true
 : Trailing extension.  Override this in a hint file, if needed.
 _exe=''
 : Extra object files, if any, needed on this platform.
 archobjs=''
+: Possible local include directories to search.
+: Set locincpth to "" in a hint file to defeat local include searches.
+locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
+locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
+:
+: no include file wanted by default
+inclwanted=''
+
 groupstype=''
 : change the next line if compiling for Xenix/286 on Xenix/386
 xlibpth='/usr/lib/386 /lib/386'
@@ -944,20 +1009,16 @@ plibpth=''
 libswanted=''
 : some systems want to use only the non-versioned libso:s
 ignore_versioned_solibs=''
-: full support for void wanted by default
-defvoidused=15
-
-: set useposix=false in your hint file to disable the POSIX extension.
-useposix=true
-: set useopcode=false in your hint file to disable the Opcode extension.
-useopcode=true
 : set usemultiplicity on the Configure command line to enable multiplicity.
 : set usesocks on the Configure command line to enable socks.
 : set usethreads on the Configure command line to enable threads.
+: full support for void wanted by default
+defvoidused=15
+
 : List of libraries we want.
 : If anyone needs -lnet, put it in a hint file.
 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
-libswanted="$libswanted dld ld sun m rt c cposix posix"
+libswanted="$libswanted dld ld sun m c cposix posix"
 libswanted="$libswanted ndir dir crypt sec"
 libswanted="$libswanted ucb bsd BSD PW x"
 : We probably want to search /usr/shlib before most other libraries.
@@ -1088,7 +1149,7 @@ done
 : produce awk script to parse command line options
 cat >options.awk <<'EOF'
 BEGIN {
-       optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
+       optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
 
        len = length(optstr);
        for (i = 1; i <= len; i++) {
@@ -1148,7 +1209,7 @@ silent=''
 extractsh=''
 override=''
 knowitall=''
-rm -f optdef.sh
+rm -f optdef.sh posthint.sh
 cat >optdef.sh <<EOS
 $startsh
 EOS
@@ -1202,8 +1263,57 @@ while test $# -gt 0; do
                esac
                shift
                ;;
+       -A)
+           shift
+           xxx=''
+           yyy="$1"
+           zzz=''
+           uuu=undef
+           case "$yyy" in
+            *=*) zzz=`echo $yyy|sed 's!=.*!!'`
+                 case "$zzz" in
+                 *:*) zzz='' ;;
+                 *)   xxx=append
+                      zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
+                      yyy=`echo $yyy|sed 's!=.*!!'` ;;
+                 esac
+                 ;;
+            esac
+            case "$xxx" in
+            '')  case "$yyy" in
+                 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
+                      yyy=`echo $yyy|sed 's!^[^:]*:!!'`
+                      zzz=`echo $yyy|sed 's!^[^=]*=!!'`
+                      yyy=`echo $yyy|sed 's!=.*!!'` ;;
+                 *)   xxx=`echo $yyy|sed 's!:.*!!'`
+                      yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
+                 esac
+                 ;;       
+            esac
+           case "$xxx" in
+           append)
+               echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
+           clear)
+               echo "$yyy=''"                  >> posthint.sh ;;
+           define)
+               case "$zzz" in
+               '') zzz=define ;;
+               esac
+               echo "$yyy='$zzz'"              >> posthint.sh ;;
+           eval)
+               echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
+           prepend)
+               echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
+           undef)
+               case "$zzz" in
+               '') zzz="$uuu" ;;
+               esac
+               echo "$yyy=$zzz"                >> posthint.sh ;;
+            *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
+           esac
+           ;;
        -V) echo "$me generated by metaconfig 3.0 PL70." >&2
-               exit 0;;
+           exit 0;;
        --) break;;
        -*) echo "$me: unknown option $1" >&2; shift; error=true;;
        *) break;;
@@ -1214,7 +1324,7 @@ case "$error" in
 true)
        cat >&2 <<EOM
 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
-                 [-U symbol] [-U symbol=]
+                 [-U symbol] [-U symbol=] [-A command:symbol...]
   -d : use defaults for all answers.
   -e : go on without questioning past the production of config.sh.
   -f : specify an alternate default configuration file.
@@ -1231,6 +1341,16 @@ Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
   -U : undefine symbol:
          -U symbol    symbol gets the value 'undef'
          -U symbol=   symbol gets completely empty
+  -A : manipulate symbol after the platform specific hints have been applied:
+        -A symbol=value                append " "value to symbol
+        -A append:symbol=value         append value to symbol
+        -A define:symbol=value         define symbol to have value
+         -A clear:symbol               define symbol to be ''
+        -A define:symbol               define symbol to be 'define'
+        -A eval:symbol=value           define symbol to be eval of value
+        -A prepend:symbol=value        prepend value to symbol
+        -A undef:symbol                define symbol to be 'undef'
+        -A undef:symbol=               define symbol to be ''
   -V : print version number and exit (with a zero status).
 EOM
        exit 1
@@ -1256,6 +1376,8 @@ esac
 : run the defines and the undefines, if any, but leave the file out there...
 touch optdef.sh
 . ./optdef.sh
+: create the posthint manipulation script and leave the file out there...
+touch posthint.sh
 
 : set package name
 package=perl5
@@ -1290,7 +1412,12 @@ esac
 : Find the path to the source tree
 case "$src" in
 '') case "$0" in
-    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
+    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
+         case "$src" in
+        /*)    ;;
+         *)    src=`cd ../$src && pwd` ;;
+        esac
+         ;;
     *)   src='.';;
     esac;;
 esac
@@ -1793,6 +1920,7 @@ ln
 more
 nm
 nroff
+perl
 pg
 test
 uname
@@ -2085,12 +2213,14 @@ EOM
                        osvers="$2.$3"
                fi
        fi
-       $test -f /sys/posix.dll &&
-              $test -f /usr/bin/what &&
-              set X `/usr/bin/what /sys/posix.dll` &&
-              $test "$3" = UWIN &&
-              osname=uwin &&
-              osvers="$5"
+
+       $test -f /sys/posix.dll &&
+               $test -f /usr/bin/what &&
+               set X `/usr/bin/what /sys/posix.dll` &&
+               $test "$3" = UWIN &&
+               osname=uwin &&
+               osvers="$5"
+
        if $test -f $uname; then
                set X $myuname
                shift
@@ -2140,6 +2270,12 @@ EOM
                        *) osvers=$tmp;;
                        esac
                        ;;
+               bsd386) osname=bsd386
+                       osvers=`$uname -r`
+                       ;;
+               cygwin*) osname=cygwin
+                       osvers="$3"
+                       ;;
                *dc.osx) osname=dcosx
                        osvers="$3"
                        ;;
@@ -2184,17 +2320,17 @@ EOM
                        *) osname=newsos ;;
                        esac
                        ;;
-               bsd386) osname=bsd386
-                       osvers=`$uname -r`
+               next*) osname=next ;;
+               POSIX-BC | posix-bc ) osname=posix-bc
+                       osvers="$3"
                        ;;
-                POSIX-BC | posix-bc ) osname=posix-bc
-                        osvers="$3"
-                        ;;
                powerux | power_ux | powermax_os | powermaxos | \
                powerunix | power_unix) osname=powerux
                        osvers="$3"
                        ;;
-               next*) osname=next ;;
+               qnx) osname=qnx
+                       osvers="$4"
+                       ;;
                solaris) osname=solaris
                        case "$3" in
                        5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
@@ -2229,12 +2365,12 @@ EOM
                        mips)   osname=mips_osf1 ;;
                        esac
                        ;;
-               uts) osname=uts 
-                       osvers="$3"
-                       ;;
-               qnx) osname=qnx
+               unixware) osname=svr5
                        osvers="$4"
                        ;;
+               uts) osname=uts
+                       osvers="$3"
+                       ;;
                $2) case "$osname" in
                        *isc*) ;;
                        *freebsd*) ;;
@@ -2364,7 +2500,7 @@ EOM
 
 You may give one or more space-separated answers, or "none" if appropriate.
 A well-behaved OS will have no hints, so answering "none" or just "Policy"
-is a good thing.  DO NOT give a wrong version.
+is a good thing.  DO NOT give a wrong version or a wrong OS.
 
 EOM
 
@@ -2478,6 +2614,9 @@ none)  osvers='' ;;
 *) osvers="$ans" ;;
 esac
 
+
+. ./posthint.sh
+
 : who configured the system
 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
 cf_by=`(logname) 2>/dev/null`
@@ -2531,11 +2670,52 @@ esac
 rp='Build a threading Perl?'
 . ./myread
 case "$ans" in
-y|Y)    val="$define" ;;     
+y|Y)    val="$define" ;;
 *)      val="$undef" ;;
 esac
 set usethreads
-eval $setvar 
+eval $setvar
+
+case "$usethreads" in
+$define)
+       $cat <<EOM
+
+As of 5.5.640, Perl has two different internal threading implementations,
+the 5.005 version (5005threads) and an interpreter-based version
+(ithreads) that has one interpreter per thread.  Both are very 
+experimental.  This arrangement exists to help developers work out
+which one is better.
+EOM
+       : Default to ithreads unless overridden on command line or with
+       : old config.sh
+       dflt='y'
+       case "$use5005threads" in
+               $define|true|[yY]*) dflt='n';;
+       esac
+       case "$useithreads" in
+               $undef|false|[nN]*) dflt='n';;
+       esac
+       rp='Use interpreter-based ithreads?'
+       . ./myread
+       case "$ans" in
+       y|Y)    val="$define" ;;
+       *)      val="$undef" ;;
+       esac
+       set useithreads
+       eval $setvar
+       : Now set use5005threads to the opposite value.
+       case "$useithreads" in
+       $define) val="$undef" ;;
+       *) val="$define" ;;
+       esac
+       set use5005threads
+       eval $setvar
+       ;;
+*)
+       useithreads="$undef"
+       use5005threads="$undef"
+       ;;
+esac
 
 case "$d_oldpthreads" in
 '')    : Configure tests would be welcome here.  For now, assume undef.
@@ -2552,201 +2732,550 @@ case "$usethreads" in
 : user has specified that a threading perl is to be built,
 : we may need to set or change some other defaults.
        if $test -f usethreads.cbu; then
+               echo "Your platform has some specific hints for threaded builds, using them..."
                . ./usethreads.cbu
-       fi
-       case "$osname" in
-       aix|dec_osf|dos_djgpp|freebsd|hpux|irix|linux|next|openbsd|os2|solaris|vmesa)
-               # Known thread-capable platforms.
-               ;;
-       *)
-               cat >&4 <<EOM
-$osname is not known to support threads.
-Please let perlbug@perl.com know how to do that.
-
-Cannot continue, aborting.
+       else
+               $cat <<EOM
+(Your platform doesn't have any specific hints for threaded builds.
+ Assuming POSIX threads, then.)
 EOM
-               exit 1
+       fi
        ;;
-       esac # $osname
-    ;;
-esac # $usethreads
+esac
 
 cat <<EOM
 
 Perl can be built so that multiple Perl interpreters can coexist
-within the same Perl executable.  To do so, Configure must be run with
--Dusemultiplicity.
-
-Normally you do not need this and you should answer no.
-
+within the same Perl executable.
 EOM
-case "$usemultiplicity" in
-$define|true|[yY]*)    dflt='y';;
-*) dflt='n';;
-esac
-rp='Build Perl for multiplicity?'
-. ./myread
-case "$ans" in
-y|Y)   val="$define" ;;     
-*)      val="$undef" ;;
-esac
-set usemultiplicity
-eval $setvar 
 
-cat <<EOM
-
-Perl can be built to take advantage of explicit 64-bit interfaces,
-on some systems.  To do so, Configure must be run with -Duse64bits.
-
-If this doesn't make any sense to you, just accept the default 'n'.
+case "$useithreads" in
+$define)
+       cat <<EOM
+This multiple interpreter support is required for interpreter-based threads.
 EOM
-case "$use64bits" in
-$define|true|[yY]*)    dflt='y';;
-*) dflt='n';;
-esac
-rp='Try to use explicit 64-bit interfaces, if available?'
-. ./myread
-case "$ans" in
-y|Y) 
        val="$define"
-       ;;     
-*)      
-       val="$undef"
-       ;;
-esac
-set use64bits
-eval $setvar
-
-case "$archname64" in
-'') archname64='' ;;   # not a typo
-esac
-
-case "$use64bits" in
-"$define"|true|[yY]*)
-: Look for a hint-file generated 'call-back-unit'.  If the
-: user has specified that a threading perl is to be built,
-: we may need to set or change some other defaults.
-       if $test -f use64bits.cbu; then
-               . ./use64bits.cbu
-       fi
-       case "$osname" in
-       aix|dec_osf|hpux|irix|solaris|unicos)
-               # Known 64-bit capable platforms.
-               ;;
-       *)
-               cat >&4 <<EOM
-$osname is not known to support 64-bit interfaces.
-Please let perlbug@perl.com know how to do that.
-
-Cannot continue, aborting.
-EOM
-               exit 1
-               ;;
-       esac
        ;;
-esac
-
-: determine the architecture name
-echo " "
-if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
-       tarch=`arch`"-$osname"
-elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
-       if uname -m > tmparch 2>&1 ; then
-               tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
-                       -e 's/$/'"-$osname/" tmparch`
-       else
-               tarch="$osname"
-       fi
-       $rm -f tmparch
-else
-       tarch="$osname"
-fi
-case "$myarchname" in
-''|"$tarch") ;;
 *)
-       echo "(Your architecture name used to be $myarchname.)"
-       archname=''
-       ;;
-esac
-myarchname="$tarch"
-case "$archname" in
-'') dflt="$tarch";;
-*) dflt="$archname";;
-esac
-rp='What is your architecture name'
-. ./myread
-archname="$ans"
-case "$usethreads" in
-$define)
-       echo "Threads selected." >&4
-       case "$archname" in
-        *-thread*) echo "...and architecture name already has -thread." >&4
-                ;;
-        *)      archname="$archname-thread"
-                echo "...setting architecture name to $archname." >&4
-                ;;
-        esac
-       ;;
-esac
-case "$usemultiplicity" in
-$define)
-       echo "Multiplicity selected." >&4
-       case "$archname" in
-        *-multi*) echo "...and architecture name already has -multi." >&4
-                ;;
-        *)      archname="$archname-multi"
-                echo "...setting architecture name to $archname." >&4
-                ;;
-        esac
-       ;;
-esac
-case "$use64bits" in
-$define)
-       echo "Explicit 64-bitness selected." >&4
-       case "$archname64" in
-       '')
-               ;;
-       *)
-               case "$archname" in
-               *-$archname64*) echo "...and architecture name already has $archname64." >&4
-                       ;;
-               *)      archname="$archname-$archname64"
-                       echo "...setting architecture name to $archname." >&4
-                       ;;
-               esac
-               ;;
+       echo 'Normally you do not need this and you should answer no.'
+       case "$usemultiplicity" in
+       $define|true|[yY]*)     dflt='y';;
+       *) dflt='n';;
+       esac
+       rp='Build Perl for multiplicity?'
+       . ./myread
+       case "$ans" in
+       y|Y)    val="$define" ;;
+       *)      val="$undef" ;;
        esac
+       ;;
 esac
+set usemultiplicity
+eval $setvar
 
-: is AFS running?
+: determine where manual pages are on this system
 echo " "
-case "$afs" in
-$define|true)  afs=true ;;
-$undef|false)  afs=false ;;
-*)     if test -d /afs; then
-               afs=true
-       else
-               afs=false
-       fi
+case "$sysman" in
+'') 
+       syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
+       syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
+       syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
+       syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
+       syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
+       sysman=`./loc . /usr/man/man1 $syspath`
        ;;
 esac
-if $afs; then
-       echo "AFS may be running... I'll be extra cautious then..." >&4
+if $test -d "$sysman"; then
+       echo "System manual is in $sysman." >&4
 else
-       echo "AFS does not seem to be running..." >&4
+       echo "Could not find manual pages in source form." >&4
 fi
 
-: decide how portable to be.  Allow command line overrides.
-case "$d_portable" in
-"$undef") ;;
-*)     d_portable="$define" ;;
-esac
-
-: set up shell script to do ~ expansion
-cat >filexp <<EOSS
-$startsh
-: expand filename
-case "\$1" in
+: see what memory models we can support
+case "$models" in
+'')
+       $cat >pdp11.c <<'EOP'
+int main() {
+#ifdef pdp11
+       exit(0);
+#else
+       exit(1);
+#endif
+}
+EOP
+       ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
+       if $test -f pdp11 && ./pdp11 2>/dev/null; then
+               dflt='unsplit split'
+       else
+               tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
+               case "$tans" in
+               X) dflt='none';;
+               *) if $test -d /lib/small || $test -d /usr/lib/small; then
+                               dflt='small'
+                       else
+                               dflt=''
+                       fi
+                       if $test -d /lib/medium || $test -d /usr/lib/medium; then
+                               dflt="$dflt medium"
+                       fi
+                       if $test -d /lib/large || $test -d /usr/lib/large; then
+                               dflt="$dflt large"
+                       fi
+                       if $test -d /lib/huge || $test -d /usr/lib/huge; then
+                               dflt="$dflt huge"
+                       fi
+               esac
+       fi;;
+*) dflt="$models";;
+esac
+$cat <<EOM
+Some systems have different model sizes.  On most systems they are called
+small, medium, large, and huge.  On the PDP11 they are called unsplit and
+split.  If your system doesn't support different memory models, say "none".
+If you wish to force everything to one memory model, say "none" here and
+put the appropriate flags later when it asks you for other cc and ld flags.
+Venix systems may wish to put "none" and let the compiler figure things out.
+(In the following question multiple model names should be space separated.)
+
+The default for most systems is "none".
+
+EOM
+rp="Which memory models are supported?"
+. ./myread
+models="$ans"
+
+case "$models" in
+none)
+       small=''
+       medium=''
+       large=''
+       huge=''
+       unsplit=''
+       split=''
+       ;;
+*split)
+       case "$split" in
+       '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
+                        $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
+                       dflt='-i'
+               else
+                       dflt='none'
+               fi;;
+       *) dflt="$split";;
+       esac
+       rp="What flag indicates separate I and D space?"
+       . ./myread
+       tans="$ans"
+       case "$tans" in
+       none) tans='';;
+       esac
+       split="$tans"
+       unsplit='';;
+*large*|*small*|*medium*|*huge*)
+       case "$models" in
+       *large*)
+               case "$large" in
+               '') dflt='-Ml';;
+               *) dflt="$large";;
+               esac
+       rp="What flag indicates large model?"
+       . ./myread
+       tans="$ans"
+       case "$tans" in
+       none) tans='';
+       esac
+       large="$tans";;
+       *) large='';;
+       esac
+       case "$models" in
+       *huge*) case "$huge" in
+               '') dflt='-Mh';;
+               *) dflt="$huge";;
+               esac
+               rp="What flag indicates huge model?"
+               . ./myread
+               tans="$ans"
+               case "$tans" in
+               none) tans='';
+               esac
+               huge="$tans";;
+       *) huge="$large";;
+       esac
+       case "$models" in
+       *medium*) case "$medium" in
+               '') dflt='-Mm';;
+               *) dflt="$medium";;
+               esac
+               rp="What flag indicates medium model?"
+               . ./myread
+               tans="$ans"
+               case "$tans" in
+               none) tans='';
+               esac
+               medium="$tans";;
+       *) medium="$large";;
+       esac
+       case "$models" in
+       *small*) case "$small" in
+               '') dflt='none';;
+               *) dflt="$small";;
+               esac
+               rp="What flag indicates small model?"
+               . ./myread
+               tans="$ans"
+               case "$tans" in
+               none) tans='';
+               esac
+               small="$tans";;
+       *) small='';;
+       esac
+       ;;
+*)
+       echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
+       ;;
+esac
+$rm -f pdp11.* pdp11
+
+: make some quick guesses about what we are up against
+echo " "
+$echo $n "Hmm...  $c"
+echo exit 1 >bsd
+echo exit 1 >usg
+echo exit 1 >v7
+echo exit 1 >osf1
+echo exit 1 >eunice
+echo exit 1 >xenix
+echo exit 1 >venix
+echo exit 1 >os2
+d_bsd="$undef"
+$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
+if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
+then
+       echo "Looks kind of like an OSF/1 system, but we'll see..."
+       echo exit 0 >osf1
+elif test `echo abc | tr a-z A-Z` = Abc ; then
+       xxx=`./loc addbib blurfl $pth`
+       if $test -f $xxx; then
+       echo "Looks kind of like a USG system with BSD features, but we'll see..."
+               echo exit 0 >bsd
+               echo exit 0 >usg
+       else
+               if $contains SIGTSTP foo >/dev/null 2>&1 ; then
+                       echo "Looks kind of like an extended USG system, but we'll see..."
+               else
+                       echo "Looks kind of like a USG system, but we'll see..."
+               fi
+               echo exit 0 >usg
+       fi
+elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
+       echo "Looks kind of like a BSD system, but we'll see..."
+       d_bsd="$define"
+       echo exit 0 >bsd
+else
+       echo "Looks kind of like a Version 7 system, but we'll see..."
+       echo exit 0 >v7
+fi
+case "$eunicefix" in
+*unixtovms*)
+       $cat <<'EOI'
+There is, however, a strange, musty smell in the air that reminds me of
+something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
+EOI
+       echo exit 0 >eunice
+       d_eunice="$define"
+: it so happens the Eunice I know will not run shell scripts in Unix format
+       ;;
+*)
+       echo " "
+       echo "Congratulations.  You aren't running Eunice."
+       d_eunice="$undef"
+       ;;
+esac
+: Detect OS2.  The p_ variable is set above in the Head.U unit.
+case "$p_" in
+:) ;;
+*)
+       $cat <<'EOI'
+I have the feeling something is not exactly right, however...don't tell me...
+lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
+EOI
+       echo exit 0 >os2
+       ;;
+esac
+if test -f /xenix; then
+       echo "Actually, this looks more like a XENIX system..."
+       echo exit 0 >xenix
+       d_xenix="$define"
+else
+       echo " "
+       echo "It's not Xenix..."
+       d_xenix="$undef"
+fi
+chmod +x xenix
+$eunicefix xenix
+if test -f /venix; then
+       echo "Actually, this looks more like a VENIX system..."
+       echo exit 0 >venix
+else
+       echo " "
+       if ./xenix; then
+               : null
+       else
+               echo "Nor is it Venix..."
+       fi
+fi
+chmod +x bsd usg v7 osf1 eunice xenix venix os2
+$eunicefix bsd usg v7 osf1 eunice xenix venix os2
+$rm -f foo
+
+: see if we need a special compiler
+echo " "
+if ./usg; then
+       case "$cc" in
+       '') case "$Mcc" in
+               /*) dflt='Mcc';;
+               *) case "$large" in
+                       -M*) dflt='cc';;
+                       *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
+                                       if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
+                                               dflt='cc'
+                                       else
+                                               dflt='cc -M'
+                                       fi
+                               else
+                                       dflt='cc'
+                               fi;;
+                       esac;;
+               esac;;
+       *)  dflt="$cc";;
+       esac
+       case "$dflt" in
+       *M*)    $cat <<'EOM'
+On some older systems the default C compiler will not resolve multiple global
+references that happen to have the same name.  On some such systems the "Mcc"
+command may be used to force these to be resolved.  On other systems a "cc -M"
+command is required.  (Note that the -M flag on other systems indicates a
+memory model to use!) If you have the Gnu C compiler, you might wish to use
+that instead.
+
+EOM
+       ;;
+       esac
+       rp="Use which C compiler?"
+       . ./myread
+       cc="$ans"
+else
+       case "$cc" in
+       '') dflt=cc;;
+       *) dflt="$cc";;
+       esac
+       rp="Use which C compiler?"
+       . ./myread
+       cc="$ans"
+fi
+: Look for a hint-file generated 'call-back-unit'.  Now that the
+: user has specified the compiler, we may need to set or change some
+: other defaults.
+if $test -f cc.cbu; then
+    . ./cc.cbu
+fi
+echo " "
+echo "Checking for GNU cc in disguise and/or its version number..." >&4
+$cat >gccvers.c <<EOM
+#include <stdio.h>
+int main() {
+#ifdef __GNUC__
+#ifdef __VERSION__
+       printf("%s\n", __VERSION__);
+#else
+       printf("%s\n", "1");
+#endif
+#endif
+       exit(0);
+}
+EOM
+if $cc -o gccvers gccvers.c; then
+       gccversion=`./gccvers`
+       case "$gccversion" in
+       '') echo "You are not using GNU cc." ;;
+       *)  echo "You are using GNU cc $gccversion." ;;
+       esac
+else
+       echo " "
+       echo "*** WHOA THERE!!! ***" >&4
+       echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
+       case "$knowitall" in
+       '')
+       echo "    You'd better start hunting for one and let me know about it." >&4
+               exit 1
+               ;;
+       esac
+fi
+$rm -f gccvers*
+case "$gccversion" in
+1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
+esac
+
+: see how we invoke the C preprocessor
+echo " "
+echo "Now, how can we feed standard input to your C preprocessor..." >&4
+cat <<'EOT' >testcpp.c
+#define ABC abc
+#define XYZ xyz
+ABC.XYZ
+EOT
+cd ..
+if test ! -f cppstdin; then
+       if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
+               # AIX cc -E doesn't show the absolute headerfile
+               # locations but we'll cheat by using the -M flag.
+               echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
+       else
+               echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
+       fi
+else
+       echo "Keeping your $hint cppstdin wrapper."
+fi
+chmod 755 cppstdin
+wrapper=`pwd`/cppstdin
+ok='false'
+cd UU
+
+if $test "X$cppstdin" != "X" && \
+       $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
+then
+       echo "You used to use $cppstdin $cppminus so we'll use that again."
+       case "$cpprun" in
+       '') echo "But let's see if we can live without a wrapper..." ;;
+       *)
+               if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
+                       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
+               then
+                       echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
+                       ok='true'
+               else
+                       echo "(However, $cpprun $cpplast does not work, let's see...)"
+               fi
+               ;;
+       esac
+else
+       case "$cppstdin" in
+       '') ;;
+       *)
+               echo "Good old $cppstdin $cppminus does not seem to be of any help..."
+               ;;
+       esac
+fi
+
+if $ok; then
+       : nothing
+elif echo 'Maybe "'"$cc"' -E" will work...'; \
+       $cc -E <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       echo "Yup, it does."
+       x_cpp="$cc -E"
+       x_minus='';
+elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
+       $cc -E - <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       echo "Yup, it does."
+       x_cpp="$cc -E"
+       x_minus='-';
+elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
+       $cc -P <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       echo "Yipee, that works!"
+       x_cpp="$cc -P"
+       x_minus='';
+elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
+       $cc -P - <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       echo "At long last!"
+       x_cpp="$cc -P"
+       x_minus='-';
+elif echo 'No such luck, maybe "'$cpp'" will work...'; \
+       $cpp <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       echo "It works!"
+       x_cpp="$cpp"
+       x_minus='';
+elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
+       $cpp - <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       echo "Hooray, it works!  I was beginning to wonder."
+       x_cpp="$cpp"
+       x_minus='-';
+elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
+       $wrapper <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       x_cpp="$wrapper"
+       x_minus=''
+       echo "Eureka!"
+else
+       dflt=''
+       rp="No dice.  I can't find a C preprocessor.  Name one:"
+       . ./myread
+       x_cpp="$ans"
+       x_minus=''
+       $x_cpp <testcpp.c >testcpp.out 2>&1
+       if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+               echo "OK, that will do." >&4
+       else
+echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
+               exit 1
+       fi
+fi
+
+case "$ok" in
+false)
+       cppstdin="$x_cpp"
+       cppminus="$x_minus"
+       cpprun="$x_cpp"
+       cpplast="$x_minus"
+       set X $x_cpp
+       shift
+       case "$1" in
+       "$cpp")
+               echo "Perhaps can we force $cc -E using a wrapper..."
+               if $wrapper <testcpp.c >testcpp.out 2>&1; \
+                       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
+               then
+                       echo "Yup, we can."
+                       cppstdin="$wrapper"
+                       cppminus='';
+               else
+                       echo "Nope, we'll have to live without it..."
+               fi
+               ;;
+       esac
+       case "$cpprun" in
+       "$wrapper")
+               cpprun=''
+               cpplast=''
+               ;;
+       esac
+       ;;
+esac
+
+case "$cppstdin" in
+"$wrapper"|'cppstdin') ;;
+*) $rm -f $wrapper;;
+esac
+$rm -f testcpp.c testcpp.out
+
+: decide how portable to be.  Allow command line overrides.
+case "$d_portable" in
+"$undef") ;;
+*)     d_portable="$define" ;;
+esac
+
+: set up shell script to do ~ expansion
+cat >filexp <<EOSS
+$startsh
+: expand filename
+case "\$1" in
  ~/*|~)
        echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
        ;;
@@ -2796,6 +3325,9 @@ exp_file=''
 nopath_ok=''
 orig_rp="$rp"
 orig_dflt="$dflt"
+case "$gfpth" in
+'') gfpth='.' ;;
+esac
 
 case "$fn" in
 *\(*)
@@ -2922,18 +3454,38 @@ while test "$type"; do
                '')
                        case "$type" in
                        File)
-                               if test -f "$ansexp"; then
-                                       type=''
-                               elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
-                               then
-                                       echo "($value is not a plain file, but that's ok.)"
-                                       type=''
-                               fi
+                               for fp in $gfpth; do
+                                       if test "X$fp" = X.; then
+                                           pf="$ansexp"
+                                       else    
+                                           pf="$fp/$ansexp"
+                                       fi
+                                       if test -f "$pf"; then
+                                               type=''
+                                       elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
+                                       then
+                                               echo "($value is not a plain file, but that's ok.)"
+                                               type=''
+                                       fi
+                                       if test X"$type" = X; then
+                                           value="$pf"
+                                           break
+                                       fi
+                               done
                                ;;
                        Directory)
-                               if test -d "$ansexp"; then
-                                       type=''
-                               fi
+                               for fp in $gfpth; do
+                                       if test "X$fp" = X.; then
+                                           pf="$ansexp"
+                                       else    
+                                           pf="$fp/$ansexp"
+                                       fi
+                                       if test -d "$pf"; then
+                                               type=''
+                                               value="$pf"
+                                               break
+                                       fi
+                               done
                                ;;
                        Locate)
                                if test -d "$ansexp"; then
@@ -2987,1363 +3539,1410 @@ ans="$value"
 rp="$orig_rp"
 dflt="$orig_dflt"
 rm -f getfile.ok
+test "X$gfpthkeep" != Xy && gfpth=""
 EOSC
 
-: determine root of directory hierarchy where package will be installed.
-case "$prefix" in
-'')
-       dflt=`./loc . /usr/local /usr/local /local /opt /usr`
+: What should the include directory be ?
+echo " "
+$echo $n "Hmm...  $c"
+dflt='/usr/include'
+incpath=''
+mips_type=''
+if $test -f /bin/mips && /bin/mips; then
+       echo "Looks like a MIPS system..."
+       $cat >usr.c <<'EOCP'
+#ifdef SYSTYPE_BSD43
+/bsd43
+#endif
+EOCP
+       if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
+               dflt='/bsd43/usr/include'
+               incpath='/bsd43'
+               mips_type='BSD 4.3'
+       else
+               mips_type='System V'
+       fi
+       $rm -f usr.c usr.out
+       echo "and you're compiling with the $mips_type compiler and libraries."
+       xxx_prompt=y
+       echo "exit 0" >mips
+else
+       echo "Doesn't look like a MIPS system."
+       xxx_prompt=n
+       echo "exit 1" >mips
+fi
+chmod +x mips
+$eunicefix mips
+case "$usrinc" in
+'') ;;
+*) dflt="$usrinc";;
+esac
+case "$xxx_prompt" in
+y)     fn=d/
+       echo " "
+       rp='Where are the include files you want to use?'
+       . ./getfile
+       usrinc="$ans"
        ;;
-*)
-       dflt="$prefix"
+*)     usrinc="$dflt"
        ;;
 esac
-$cat <<EOM
 
-By default, $package will be installed in $dflt/bin, manual
-pages under $dflt/man, etc..., i.e. with $dflt as prefix for
-all installation directories. Typically set to /usr/local, but you
-may choose /usr if you wish to install $package among your system
-binaries. If you wish to have binaries under /bin but manual pages
-under /usr/local/man, that's ok: you will be prompted separately
-for each of the installation directories, the prefix being only used
-to set the defaults.
+: Set private lib path
+case "$plibpth" in
+'') if ./mips; then
+               plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
+       fi;;
+esac
+case "$libpth" in
+' ') dlist='';;
+'') dlist="$loclibpth $plibpth $glibpth";;
+*) dlist="$libpth";;
+esac
+
+: Now check and see which directories actually exist, avoiding duplicates
+libpth=''
+for xxx in $dlist
+do
+    if $test -d $xxx; then
+               case " $libpth " in
+               *" $xxx "*) ;;
+               *) libpth="$libpth $xxx";;
+               esac
+    fi
+done
+$cat <<'EOM'
+
+Some systems have incompatible or broken versions of libraries.  Among
+the directories listed in the question below, please remove any you
+know not to be holding relevant libraries, and add any that are needed.
+Say "none" for none.
 
 EOM
-fn=d~
-rp='Installation prefix to use?'
-. ./getfile
-oldprefix=''
-case "$prefix" in
-'') ;;
+case "$libpth" in
+'') dflt='none';;
 *)
-       case "$ans" in
-       "$prefix") ;;
-       *) oldprefix="$prefix";;
-       esac
+       set X $libpth
+       shift
+       dflt=${1+"$@"}
        ;;
 esac
-prefix="$ans"
-prefixexp="$ansexp"
-
-: set the prefixit variable, to compute a suitable default value
-prefixit='case "$3" in
-""|none)
-       case "$oldprefix" in
-       "") eval "$1=\"\$$2\"";;
-       *)
-               case "$3" in
-               "") eval "$1=";;
-               none)
-                       eval "tp=\"\$$2\"";
-                       case "$tp" in
-                       ""|" ") eval "$1=\"\$$2\"";;
-                       *) eval "$1=";;
-                       esac;;
-               esac;;
-       esac;;
-*)
-       eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
-       case "$tp" in
-       --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
-       /*-$oldprefix/*|\~*-$oldprefix/*)
-               eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
-       *) eval "$1=\"\$$2\"";;
-       esac;;
-esac'
-
-: set the base revision
-baserev=5.0
-
-: get the patchlevel
-echo " "
-echo "Getting the current patchlevel..." >&4
-if $test -r $rsrc/patchlevel.h;then
-       patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
-       subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
-else
-       patchlevel=0
-       subversion=0
-fi
-$echo $n "(You have $package" $c
-case "$package" in
-"*$baserev")   ;;
-*)             $echo $n " $baserev" $c ;;
+rp="Directories to use for library searches?"
+. ./myread
+case "$ans" in
+none) libpth=' ';;
+*) libpth="$ans";;
 esac
-$echo $n " patchlevel $patchlevel" $c
-test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
-echo ".)"
-
-if test 0 -eq "$subversion"; then
-       version=`LC_ALL=C; export LC_ALL; \
-                echo $baserev $patchlevel | \
-                $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
-else
-       version=`LC_ALL=C; export LC_ALL; \
-                echo $baserev $patchlevel $subversion | \
-                $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
-fi
-: Figure out perl API version.  Perhaps this should be in patchlevel.h
-if test "$subversion" -lt 50; then
-       apiversion=`LC_ALL=C; export LC_ALL; \
-                LANGUAGE=C; export LANGUAGE; \
-                echo $baserev $patchlevel | \
-                $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
-else
-       apiversion="$version"
-fi
 
-: determine where private library files go
-: Usual default is /usr/local/lib/perl5/$version.
-: Also allow things like /opt/perl/lib/$version, since 
-: /opt/perl/lib/perl5... would be redundant.
-case "$prefix" in
-*perl*) set dflt privlib lib/$version ;;
-*)      set dflt privlib lib/$package/$version ;;
+: compute shared library extension
+case "$so" in
+'')
+       if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
+               dflt='sl'
+       else
+               dflt='so'
+       fi
+       ;;
+*) dflt="$so";;
 esac
-eval $prefixit
 $cat <<EOM
 
-There are some auxiliary files for $package that need to be put into a
-private library directory that is accessible by everyone.
+On some systems, shared libraries may be available.  Answer 'none' if
+you want to suppress searching of shared libraries for the remaining
+of this configuration.
 
 EOM
-fn=d~+
-rp='Pathname where the private library files will reside?'
-. ./getfile
-if $test "X$privlibexp" != "X$ansexp"; then
-       installprivlib=''
-fi
-privlib="$ans"
-privlibexp="$ansexp"
-if $afs; then
-       $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in which
-private files reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
+rp='What is the file extension used for shared libraries?'
+. ./myread
+so="$ans"
 
-EOM
-       case "$installprivlib" in
-       '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installprivlib";;
+: Define several unixisms.
+: Hints files or command line option can be used to override them.
+: The convoluted testing is in case hints files set either the old
+: or the new name.
+case "$_exe" in
+'')    case "$exe_ext" in
+    '')        ;;
+       *)      _exe="$exe_ext" ;;
        esac
-       fn=de~
-       rp='Where will private files be installed?'
-       . ./getfile
-       installprivlib="$ans"
-else
-       installprivlib="$privlibexp"
-fi
-
-: set the prefixup variable, to restore leading tilda escape
-prefixup='case "$prefixexp" in
-"$prefix") ;;
-*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
-esac'
-
-: determine where public architecture dependent libraries go
-set archlib archlib
-eval $prefixit
-: privlib default is /usr/local/lib/$package/$version
-: archlib default is /usr/local/lib/$package/$version/$archname
-: privlib may have an optional trailing /share.
-tdflt=`echo $privlib | $sed 's,/share$,,'`
-tdflt=$tdflt/$archname
-case "$archlib" in
-'')    dflt=$tdflt
        ;;
-*)     dflt="$archlib"
-    ;;
 esac
-cat <<EOM
-
-$spackage contains architecture-dependent library files.  If you are
-sharing libraries in a heterogeneous environment, you might store
-these files in a separate location.  Otherwise, you can just include
-them with the rest of the public library files.
-
-EOM
-fn=d+~
-rp='Where do you want to put the public architecture-dependent libraries?'
-. ./getfile
-archlib="$ans"
-archlibexp="$ansexp"
-
-if $afs; then
-       $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in
-which architecture-dependent library files reside from the directory
-in which they are installed (and from which they are presumably copied
-to the former directory by occult means).
-
-EOM
-       case "$installarchlib" in
-       '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installarchlib";;
-       esac
-       fn=de~
-       rp='Where will architecture-dependent library files be installed?'
-       . ./getfile
-       installarchlib="$ans"
-else
-       installarchlib="$archlibexp"
-fi
-if $test X"$archlib" = X"$privlib"; then
-       d_archlib="$undef"
-else
-       d_archlib="$define"
-fi
-
-: make some quick guesses about what we are up against
-echo " "
-$echo $n "Hmm...  $c"
-echo exit 1 >bsd
-echo exit 1 >usg
-echo exit 1 >v7
-echo exit 1 >osf1
-echo exit 1 >eunice
-echo exit 1 >xenix
-echo exit 1 >venix
-echo exit 1 >os2
-d_bsd="$undef"
-$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
-if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
-then
-       echo "Looks kind of like an OSF/1 system, but we'll see..."
-       echo exit 0 >osf1
-elif test `echo abc | tr a-z A-Z` = Abc ; then
-       xxx=`./loc addbib blurfl $pth`
-       if $test -f $xxx; then
-       echo "Looks kind of like a USG system with BSD features, but we'll see..."
-               echo exit 0 >bsd
-               echo exit 0 >usg
-       else
-               if $contains SIGTSTP foo >/dev/null 2>&1 ; then
-                       echo "Looks kind of like an extended USG system, but we'll see..."
-               else
-                       echo "Looks kind of like a USG system, but we'll see..."
-               fi
-               echo exit 0 >usg
-       fi
-elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
-       echo "Looks kind of like a BSD system, but we'll see..."
-       d_bsd="$define"
-       echo exit 0 >bsd
-else
-       echo "Looks kind of like a Version 7 system, but we'll see..."
-       echo exit 0 >v7
-fi
-case "$eunicefix" in
-*unixtovms*)
-       $cat <<'EOI'
-There is, however, a strange, musty smell in the air that reminds me of
-something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
-EOI
-       echo exit 0 >eunice
-       d_eunice="$define"
-: it so happens the Eunice I know will not run shell scripts in Unix format
+case "$_a" in
+'')    case "$lib_ext" in
+    '')        _a='.a';;
+       *)      _a="$lib_ext" ;;
+       esac
        ;;
-*)
-       echo " "
-       echo "Congratulations.  You aren't running Eunice."
-       d_eunice="$undef"
+esac
+case "$_o" in
+'') case "$obj_ext" in
+       '')     _o='.o';;
+       *)      _o="$obj_ext";;
+       esac
        ;;
 esac
-: Detect OS2.  The p_ variable is set above in the Head.U unit.
 case "$p_" in
-:) ;;
-*)
-       $cat <<'EOI'
-I have the feeling something is not exactly right, however...don't tell me...
-lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
-EOI
-       echo exit 0 >os2
+'') case "$path_sep" in
+       '')     p_=':';;
+       *)      p_="$path_sep";;
+       esac
        ;;
 esac
-if test -f /xenix; then
-       echo "Actually, this looks more like a XENIX system..."
-       echo exit 0 >xenix
-       d_xenix="$define"
-else
-       echo " "
-       echo "It's not Xenix..."
-       d_xenix="$undef"
-fi
-chmod +x xenix
-$eunicefix xenix
-if test -f /venix; then
-       echo "Actually, this looks more like a VENIX system..."
-       echo exit 0 >venix
-else
-       echo " "
-       if ./xenix; then
-               : null
-       else
-               echo "Nor is it Venix..."
-       fi
-fi
-chmod +x bsd usg v7 osf1 eunice xenix venix os2
-$eunicefix bsd usg v7 osf1 eunice xenix venix os2
-$rm -f foo
+exe_ext=$_exe
+lib_ext=$_a
+obj_ext=$_o
+path_sep=$p_
 
-: see if setuid scripts can be secure
-$cat <<EOM
+: Which makefile gets called first.  This is used by make depend.
+case "$firstmakefile" in
+'') firstmakefile='makefile';;
+esac
 
-Some kernels have a bug that prevents setuid #! scripts from being
-secure.  Some sites have disabled setuid #! scripts because of this.
+cat <<EOM
 
-First let's decide if your kernel supports secure setuid #! scripts.
-(If setuid #! scripts would be secure but have been disabled anyway,
-don't say that they are secure if asked.)
+Perl can be built to use the SOCKS proxy protocol library.  To do so,
+Configure must be run with -Dusesocks.
+
+Normally you do not need this and you should answer no.
 
 EOM
+case "$usesocks" in
+$define|true|[yY]*)    dflt='y';;
+*) dflt='n';;
+esac
+rp='Build Perl for SOCKS?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define" ;;     
+*)      val="$undef" ;;
+esac
+set usesocks
+eval $setvar
 
-val="$undef"
-if $test -d /dev/fd; then
-       echo "#!$ls" >reflect
-       chmod +x,u+s reflect
-       ./reflect >flect 2>&1
-       if $contains "/dev/fd" flect >/dev/null; then
-               echo "Congratulations, your kernel has secure setuid scripts!" >&4
-               val="$define"
+: Looking for optional libraries
+echo " "
+echo "Checking for optional libraries..." >&4
+case "$libs" in
+' '|'') dflt='';;
+*) dflt="$libs";;
+esac
+case "$libswanted" in
+'') libswanted='c_s';;
+esac
+case "$usesocks" in
+$define)
+       libswanted="$libswanted socks5 socks5_sh"
+       ;;
+esac
+for thislib in $libswanted; do
+       
+       if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
+               $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
+               echo "Found -l$thislib (shared)."
+               case " $dflt " in
+               *"-l$thislib "*);;
+               *) dflt="$dflt -l$thislib";;
+               esac
+       elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
+               echo "Found -l$thislib (shared)."
+               case " $dflt " in
+               *"-l$thislib "*);;
+               *) dflt="$dflt -l$thislib";;
+               esac
+       elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
+               echo "Found -l$thislib."
+               case " $dflt " in
+               *"-l$thislib "*);;
+               *) dflt="$dflt -l$thislib";;
+               esac
+       elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
+               echo "Found -l$thislib."
+               case " $dflt " in
+               *"-l$thislib "*);;
+               *) dflt="$dflt -l$thislib";;
+               esac
+       elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
+               echo "Found -l${thislib}_s."
+               case " $dflt " in
+               *"-l$thislib "*);;
+               *) dflt="$dflt -l${thislib}_s";;
+               esac
+       elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
+               echo "Found -l$thislib."
+               case " $dflt " in
+               *"-l$thislib "*);;
+               *) dflt="$dflt -l$thislib";;
+               esac
        else
-               $cat <<EOM
-If you are not sure if they are secure, I can check but I'll need a
-username and password different from the one you are using right now.
-If you don't have such a username or don't want me to test, simply
-enter 'none'.
+               echo "No -l$thislib."
+       fi
+done
+set X $dflt
+shift
+dflt="$*"
+case "$libs" in
+'') dflt="$dflt";;
+*) dflt="$libs";;
+esac
+case "$dflt" in
+' '|'') dflt='none';;
+esac
 
+$cat <<EOM
+
+In order to compile $package on your machine, a number of libraries
+are usually needed.  Include any other special libraries here as well.
+Say "none" for none.  The default list is almost always right.
 EOM
-               rp='Other username to test security of setuid scripts with?'
-               dflt='none'
-               . ./myread
-               case "$ans" in
-               n|none)
-                       case "$d_suidsafe" in
-                       '')     echo "I'll assume setuid scripts are *not* secure." >&4
-                               dflt=n;;
-                       "$undef")
-                               echo "Well, the $hint value is *not* secure." >&4
-                               dflt=n;;
-                       *)      echo "Well, the $hint value *is* secure." >&4
-                               dflt=y;;
+
+echo " "
+rp="What libraries to use?"
+. ./myread
+case "$ans" in
+none) libs=' ';;
+*) libs="$ans";;
+esac
+
+: determine optimization, if desired, or use for debug flag also
+case "$optimize" in
+' '|$undef) dflt='none';;
+'') dflt='-O';;
+*) dflt="$optimize";;
+esac
+$cat <<EOH
+
+By default, $package compiles with the -O flag to use the optimizer.
+Alternately, you might want to use the symbolic debugger, which uses
+the -g flag (on traditional Unix systems).  Either flag can be
+specified here.  To use neither flag, specify the word "none".
+
+EOH
+rp="What optimizer/debugger flag should be used?"
+. ./myread
+optimize="$ans"
+case "$optimize" in
+'none') optimize=" ";;
+esac
+
+dflt=''
+: We will not override a previous value, but we might want to
+: augment a hint file
+case "$hint" in
+default|recommended)
+       case "$gccversion" in
+       1*) dflt='-fpcc-struct-return' ;;
+       esac
+       case "$optimize" in
+       *-g*) dflt="$dflt -DDEBUGGING";;
+       esac
+       case "$gccversion" in
+       2*) if test -d /etc/conf/kconfig.d &&
+                       $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
+               then
+                       dflt="$dflt -posix"
+               fi
+               ;;
+       esac
+       case "$gccversion" in
+       1*) ;;
+       2.[0-8]*) ;;
+       ?*)     echo " "
+               echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
+               echo 'int main(void) { return 0; }' > gcctest.c
+               if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
+                       echo "Yes, it does." 2>&1
+                       case "$ccflags" in
+                       *strict-aliasing*) 
+                               echo "Leaving current flags $ccflags alone." 2>&1
+                               ;;
+                       *) dflt="$dflt -fno-strict-aliasing" ;;
                        esac
-                       ;;
-               *)
-                       $rm -f reflect flect
-                       echo "#!$ls" >reflect
-                       chmod +x,u+s reflect
-                       echo >flect
-                       chmod a+w flect
-                       echo '"su" will (probably) prompt you for '"$ans's password."
-                       su $ans -c './reflect >flect'
-                       if $contains "/dev/fd" flect >/dev/null; then
-                               echo "Okay, it looks like setuid scripts are secure." >&4
-                               dflt=y
-                       else
-                               echo "I don't think setuid scripts are secure." >&4
-                               dflt=n
-                       fi
-                       ;;
-               esac
-               rp='Does your kernel have *secure* setuid scripts?'
-               . ./myread
-               case "$ans" in
-               [yY]*)  val="$define";;
-               *)      val="$undef";;
-               esac
+               else
+                       echo "Nope, it doesn't, but that's ok." 2>&1
+               fi
+               ;;
+       esac
+       ;;
+esac
+
+case "$mips_type" in
+*BSD*|'') inclwanted="$locincpth $usrinc";;
+*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
+esac
+for thisincl in $inclwanted; do
+       if $test -d $thisincl; then
+               if $test x$thisincl != x$usrinc; then
+                       case "$dflt" in
+                       *$thisincl*);;
+                       *) dflt="$dflt -I$thisincl";;
+                       esac
+               fi
        fi
-else
-       echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
-       echo "(That's for file descriptors, not floppy disks.)"
-       val="$undef"
-fi
-set d_suidsafe
-eval $setvar
+done
 
-$rm -f reflect flect
+inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
+       xxx=true;
+elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
+       xxx=true;
+else
+       xxx=false;
+fi;
+if $xxx; then
+       case "$dflt" in
+       *$2*);;
+       *) dflt="$dflt -D$2";;
+       esac;
+fi'
 
-: 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.
+set signal.h LANGUAGE_C; eval $inctest
 
-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
+case "$usesocks" in
+$define)
+       ccflags="$ccflags -DSOCKS"
        ;;
 esac
-set d_dosuid
-eval $setvar
 
-: determine where manual pages are on this system
-echo " "
-case "$sysman" in
-'') 
-       syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
-       syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
-       syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
-       syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
-       syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
-       sysman=`./loc . /usr/man/man1 $syspath`
-       ;;
+case "$hint" in
+default|recommended) dflt="$ccflags $dflt" ;;
+*) dflt="$ccflags";;
 esac
-if $test -d "$sysman"; then
-       echo "System manual is in $sysman." >&4
-else
-       echo "Could not find manual pages in source form." >&4
-fi
 
-: see what memory models we can support
-case "$models" in
-'')
-       $cat >pdp11.c <<'EOP'
-int main() {
-#ifdef pdp11
-       exit(0);
-#else
-       exit(1);
-#endif
-}
-EOP
-       ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
-       if $test -f pdp11 && ./pdp11 2>/dev/null; then
-               dflt='unsplit split'
-       else
-               tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
-               case "$tans" in
-               X) dflt='none';;
-               *) if $test -d /lib/small || $test -d /usr/lib/small; then
-                               dflt='small'
-                       else
-                               dflt=''
-                       fi
-                       if $test -d /lib/medium || $test -d /usr/lib/medium; then
-                               dflt="$dflt medium"
-                       fi
-                       if $test -d /lib/large || $test -d /usr/lib/large; then
-                               dflt="$dflt large"
-                       fi
-                       if $test -d /lib/huge || $test -d /usr/lib/huge; then
-                               dflt="$dflt huge"
-                       fi
-               esac
-       fi;;
-*) dflt="$models";;
+case "$dflt" in
+''|' ') dflt=none;;
 esac
-$cat <<EOM
-Some systems have different model sizes.  On most systems they are called
-small, medium, large, and huge.  On the PDP11 they are called unsplit and
-split.  If your system doesn't support different memory models, say "none".
-If you wish to force everything to one memory model, say "none" here and
-put the appropriate flags later when it asks you for other cc and ld flags.
-Venix systems may wish to put "none" and let the compiler figure things out.
-(In the following question multiple model names should be space separated.)
+$cat <<EOH
 
-The default for most systems is "none".
+Your C compiler may want other flags.  For this question you should include
+-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
+but you should NOT include libraries or ld flags like -lwhatever.  If you
+want $package to honor its debug switch, you should include -DDEBUGGING here.
+Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
 
-EOM
-rp="Which memory models are supported?"
+To use no flags, specify the word "none".
+
+EOH
+set X $dflt
+shift
+dflt=${1+"$@"}
+rp="Any additional cc flags?"
 . ./myread
-models="$ans"
+case "$ans" in
+none) ccflags='';;
+*) ccflags="$ans";;
+esac
 
-case "$models" in
-none)
-       small=''
-       medium=''
-       large=''
-       huge=''
-       unsplit=''
-       split=''
-       ;;
-*split)
-       case "$split" in
-       '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
-                        $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
-                       dflt='-i'
-               else
-                       dflt='none'
-               fi;;
-       *) dflt="$split";;
-       esac
-       rp="What flag indicates separate I and D space?"
-       . ./myread
-       tans="$ans"
-       case "$tans" in
-       none) tans='';;
-       esac
-       split="$tans"
-       unsplit='';;
-*large*|*small*|*medium*|*huge*)
-       case "$models" in
-       *large*)
-               case "$large" in
-               '') dflt='-Ml';;
-               *) dflt="$large";;
-               esac
-       rp="What flag indicates large model?"
-       . ./myread
-       tans="$ans"
-       case "$tans" in
-       none) tans='';
-       esac
-       large="$tans";;
-       *) large='';;
-       esac
-       case "$models" in
-       *huge*) case "$huge" in
-               '') dflt='-Mh';;
-               *) dflt="$huge";;
-               esac
-               rp="What flag indicates huge model?"
-               . ./myread
-               tans="$ans"
-               case "$tans" in
-               none) tans='';
-               esac
-               huge="$tans";;
-       *) huge="$large";;
-       esac
-       case "$models" in
-       *medium*) case "$medium" in
-               '') dflt='-Mm';;
-               *) dflt="$medium";;
-               esac
-               rp="What flag indicates medium model?"
-               . ./myread
-               tans="$ans"
-               case "$tans" in
-               none) tans='';
-               esac
-               medium="$tans";;
-       *) medium="$large";;
-       esac
-       case "$models" in
-       *small*) case "$small" in
-               '') dflt='none';;
-               *) dflt="$small";;
-               esac
-               rp="What flag indicates small model?"
-               . ./myread
-               tans="$ans"
-               case "$tans" in
-               none) tans='';
+: the following weeds options from ccflags that are of no interest to cpp
+cppflags="$ccflags"
+case "$gccversion" in
+1*) cppflags="$cppflags -D__GNUC__"
+esac
+case "$mips_type" in
+'');;
+*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
+esac
+case "$cppflags" in
+'');;
+*)
+       echo " "
+       echo "Let me guess what the preprocessor flags are..." >&4
+       set X $cppflags
+       shift
+       cppflags=''
+       $cat >cpp.c <<'EOM'
+#define BLURFL foo
+
+BLURFL xx LFRULB
+EOM
+       previous=''
+       for flag in $*
+       do
+               case "$flag" in
+               -*) ftry="$flag";;
+               *) ftry="$previous $flag";;
                esac
-               small="$tans";;
-       *) small='';;
+               if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
+                       >cpp1.out 2>/dev/null && \
+                       $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
+                       >cpp2.out 2>/dev/null && \
+                       $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
+                       $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
+               then
+                       cppflags="$cppflags $ftry"
+                       previous=''
+               else
+                       previous="$flag"
+               fi
+       done
+       set X $cppflags
+       shift
+       cppflags=${1+"$@"}
+       case "$cppflags" in
+       *-*)  echo "They appear to be: $cppflags";;
        esac
+       $rm -f cpp.c cpp?.out
        ;;
-*)
-       echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
+esac
+
+: flags used in final linking phase
+case "$ldflags" in
+'') if ./venix; then
+               dflt='-i -z'
+       else
+               dflt=''
+       fi
+       case "$ccflags" in
+       *-posix*) dflt="$dflt -posix" ;;
+       esac
        ;;
+*) dflt="$ldflags";;
 esac
-$rm -f pdp11.* pdp11
 
-: see if we need a special compiler
-echo " "
-if ./usg; then
-       case "$cc" in
-       '') case "$Mcc" in
-               /*) dflt='Mcc';;
-               *) case "$large" in
-                       -M*) dflt='cc';;
-                       *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
-                                       if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
-                                               dflt='cc'
-                                       else
-                                               dflt='cc -M'
-                                       fi
-                               else
-                                       dflt='cc'
-                               fi;;
-                       esac;;
-               esac;;
-       *)  dflt="$cc";;
+: Try to guess additional flags to pick up local libraries.
+for thislibdir in $libpth; do
+       case " $loclibpth " in
+       *" $thislibdir "*)
+               case "$dflt " in 
+               *"-L$thislibdir "*) ;;
+               *)  dflt="$dflt -L$thislibdir" ;;
+               esac
+               ;;
        esac
-       case "$dflt" in
-       *M*)    $cat <<'EOM'
-On some older systems the default C compiler will not resolve multiple global
-references that happen to have the same name.  On some such systems the "Mcc"
-command may be used to force these to be resolved.  On other systems a "cc -M"
-command is required.  (Note that the -M flag on other systems indicates a
-memory model to use!) If you have the Gnu C compiler, you might wish to use
-that instead.
+done
+
+case "$dflt" in
+'') dflt='none' ;;
+esac
+
+$cat <<EOH
+
+Your C linker may need flags.  For this question you should
+include -L/whatever and any other flags used by the C linker, but you
+should NOT include libraries like -lwhatever.
+
+Make sure you include the appropriate -L/path flags if your C linker
+does not normally search all of the directories you specified above,
+namely
+       $libpth
+To use no flags, specify the word "none".
+
+EOH
+
+rp="Any additional ld flags (NOT including libraries)?"
+. ./myread
+case "$ans" in
+none) ldflags='';;
+*) ldflags="$ans";;
+esac
+rmlist="$rmlist pdp11"
+
+: coherency check
+echo " "
+echo "Checking your choice of C compiler and flags for coherency..." >&4
+$cat > try.c <<'EOF'
+#include <stdio.h>
+int main() { printf("Ok\n"); exit(0); }
+EOF
+set X $cc $optimize $ccflags -o try $ldflags try.c $libs
+shift
+$cat >try.msg <<'EOM'
+I've tried to compile and run the following simple program:
 
 EOM
-       ;;
-       esac
-       rp="Use which C compiler?"
-       . ./myread
-       cc="$ans"
+$cat try.c >> try.msg
+
+$cat >> try.msg <<EOM
+
+I used the command:
+
+       $*
+       ./try
+
+and I got the following output:
+
+EOM
+dflt=y
+if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
+       if sh -c './try' >>try.msg 2>&1; then
+               xxx=`./try`
+               case "$xxx" in
+               "Ok") dflt=n ;;
+               *)      echo 'The program compiled OK, but produced no output.' >> try.msg
+                       case " $libs " in
+                       *" -lsfio "*)
+                               cat >> try.msg <<'EOQS'
+If $libs contains -lsfio, and sfio is mis-configured, then it
+sometimes (apparently) runs and exits with a 0 status, but with no
+output!  It may have to do with sfio's use of _exit vs. exit.
+
+EOQS
+                               rp="You have a big problem.  Shall I abort Configure"
+                               dflt=y
+                               ;;
+                       esac
+                       ;;
+               esac
+       else
+               echo "The program compiled OK, but exited with status $?." >>try.msg
+               rp="You have a problem.  Shall I abort Configure"
+               dflt=y
+       fi
 else
-       case "$cc" in
-       '') dflt=cc;;
-       *) dflt="$cc";;
+       echo "I can't compile the test program." >>try.msg
+       rp="You have a BIG problem.  Shall I abort Configure"
+       dflt=y
+fi
+case "$dflt" in
+y)
+       $cat try.msg >&4
+       case "$knowitall" in
+       '')
+               echo "(The supplied flags or libraries might be incorrect.)"
+               ;;
+       *) dflt=n;;
        esac
-       rp="Use which C compiler?"
+       echo " "
        . ./myread
-       cc="$ans"
-fi
-: Look for a hint-file generated 'call-back-unit'.  Now that the
-: user has specified the compiler, we may need to set or change some
-: other defaults.
-if $test -f cc.cbu; then
-    . ./cc.cbu
-fi
+       case "$ans" in
+       n*|N*) ;;
+       *)      echo "Ok.  Stopping Configure." >&4
+               exit 1
+               ;;
+       esac
+       ;;
+n) echo "OK, that should do.";;
+esac
+$rm -f try try.* core
+
+: define an is-a-typedef? function
+typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
+case "$inclist" in
+"") inclist="sys/types.h";;
+esac;
+eval "varval=\$$var";
+case "$varval" in
+"")
+       $rm -f temp.c;
+       for inc in $inclist; do
+               echo "#include <$inc>" >>temp.c;
+       done;
+       echo "#ifdef $type" >> temp.c;
+       echo "printf(\"We have $type\");" >> temp.c;
+       echo "#endif" >> temp.c;
+       $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
+       if $contains $type temp.E >/dev/null 2>&1; then
+               eval "$var=\$type";
+       else
+               eval "$var=\$def";
+       fi;
+       $rm -f temp.?;;
+*) eval "$var=\$varval";;
+esac'
+
+: define an is-a-typedef? function that prompts if the type is not available.
+typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
+case "$inclist" in
+"") inclist="sys/types.h";;
+esac;
+eval "varval=\$$var";
+case "$varval" in
+"")
+       $rm -f temp.c;
+       for inc in $inclist; do
+               echo "#include <$inc>" >>temp.c;
+       done;
+       echo "#ifdef $type" >> temp.c;
+       echo "printf(\"We have $type\");" >> temp.c;
+       echo "#endif" >> temp.c;
+       $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
+       echo " " ;
+       echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
+       if $contains $type temp.E >/dev/null 2>&1; then
+               echo "$type found." >&4;
+               eval "$var=\$type";
+       else
+               echo "$type NOT found." >&4;
+               dflt="$def";
+               . ./myread ;
+               eval "$var=\$ans";
+       fi;
+       $rm -f temp.?;;
+*) eval "$var=\$varval";;
+esac'
+
+: define a shorthand compile call
+compile='
+mc_file=$1;
+shift;
+$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
+: define a shorthand compile call for compilations that should be ok.
+compile_ok='
+mc_file=$1;
+shift;
+$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
+
+: check for lengths of integral types
 echo " "
-echo "Checking for GNU cc in disguise and/or its version number..." >&4
-$cat >gccvers.c <<EOM
+case "$intsize" in
+'')
+       echo "Checking to see how big your integers are..." >&4
+       $cat >intsize.c <<'EOCP'
 #include <stdio.h>
-int main() {
-#ifdef __GNUC__
-#ifdef __VERSION__
-       printf("%s\n", __VERSION__);
-#else
-       printf("%s\n", "1");
-#endif
-#endif
+int main()
+{
+       printf("intsize=%d;\n", (int)sizeof(int));
+       printf("longsize=%d;\n", (int)sizeof(long));
+       printf("shortsize=%d;\n", (int)sizeof(short));
        exit(0);
 }
-EOM
-if $cc -o gccvers gccvers.c; then
-       gccversion=`./gccvers`
-       case "$gccversion" in
-       '') echo "You are not using GNU cc." ;;
-       *)  echo "You are using GNU cc $gccversion." ;;
-       esac
-else
-       echo " "
-       echo "*** WHOA THERE!!! ***" >&4
-       echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
-       case "$knowitall" in
-       '')
-       echo "    You'd better start hunting for one and let me know about it." >&4
-               exit 1
-               ;;
-       esac
-fi
-$rm -f gccvers*
-case "$gccversion" in
-1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
-esac
-
-: What should the include directory be ?
-echo " "
-$echo $n "Hmm...  $c"
-dflt='/usr/include'
-incpath=''
-mips_type=''
-if $test -f /bin/mips && /bin/mips; then
-       echo "Looks like a MIPS system..."
-       $cat >usr.c <<'EOCP'
-#ifdef SYSTYPE_BSD43
-/bsd43
-#endif
 EOCP
-       if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
-               dflt='/bsd43/usr/include'
-               incpath='/bsd43'
-               mips_type='BSD 4.3'
+       set intsize
+       if eval $compile_ok && ./intsize > /dev/null; then
+               eval `./intsize`
+               echo "Your integers are $intsize bytes long."
+               echo "Your long integers are $longsize bytes long."
+               echo "Your short integers are $shortsize bytes long."
        else
-               mips_type='System V'
+               $cat >&4 <<EOM
+!
+Help! I can't compile and run the intsize test program: please enlighten me!
+(This is probably a misconfiguration in your system or libraries, and
+you really ought to fix it.  Still, I'll try anyway.)
+!
+EOM
+               dflt=4
+               rp="What is the size of an integer (in bytes)?"
+               . ./myread
+               intsize="$ans"
+               dflt=$intsize
+               rp="What is the size of a long integer (in bytes)?"
+               . ./myread
+               longsize="$ans"
+               dflt=2
+               rp="What is the size of a short integer (in bytes)?"
+               . ./myread
+               shortsize="$ans"
        fi
-       $rm -f usr.c usr.out
-       echo "and you're compiling with the $mips_type compiler and libraries."
-       xxx_prompt=y
-       echo "exit 0" >mips
-else
-       echo "Doesn't look like a MIPS system."
-       xxx_prompt=n
-       echo "exit 1" >mips
-fi
-chmod +x mips
-$eunicefix mips
-case "$usrinc" in
-'') ;;
-*) dflt="$usrinc";;
-esac
-case "$xxx_prompt" in
-y)     fn=d/
-       echo " "
-       rp='Where are the include files you want to use?'
-       . ./getfile
-       usrinc="$ans"
-       ;;
-*)     usrinc="$dflt"
        ;;
 esac
+$rm -f intsize intsize.*
 
-: see how we invoke the C preprocessor
-echo " "
-echo "Now, how can we feed standard input to your C preprocessor..." >&4
-cat <<'EOT' >testcpp.c
-#define ABC abc
-#define XYZ xyz
-ABC.XYZ
-EOT
-cd ..
-if test ! -f cppstdin; then
-       echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
-else
-       echo "Keeping your $hint cppstdin wrapper."
-fi
-chmod 755 cppstdin
-wrapper=`pwd`/cppstdin
-ok='false'
-cd UU
-
-if $test "X$cppstdin" != "X" && \
-       $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
-then
-       echo "You used to use $cppstdin $cppminus so we'll use that again."
-       case "$cpprun" in
-       '') echo "But let's see if we can live without a wrapper..." ;;
-       *)
-               if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
-                       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
-               then
-                       echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
-                       ok='true'
-               else
-                       echo "(However, $cpprun $cpplast does not work, let's see...)"
-               fi
-               ;;
-       esac
-else
-       case "$cppstdin" in
-       '') ;;
-       *)
-               echo "Good old $cppstdin $cppminus does not seem to be of any help..."
-               ;;
-       esac
-fi
+: see what type lseek is declared as in the kernel
+rp="What is the type used for lseek's offset on this system?"
+set off_t lseektype long stdio.h sys/types.h
+eval $typedef_ask
 
-if $ok; then
-       : nothing
-elif echo 'Maybe "'"$cc"' -E" will work...'; \
-       $cc -E <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       echo "Yup, it does."
-       x_cpp="$cc -E"
-       x_minus='';
-elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
-       $cc -E - <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       echo "Yup, it does."
-       x_cpp="$cc -E"
-       x_minus='-';
-elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
-       $cc -P <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       echo "Yipee, that works!"
-       x_cpp="$cc -P"
-       x_minus='';
-elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
-       $cc -P - <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       echo "At long last!"
-       x_cpp="$cc -P"
-       x_minus='-';
-elif echo 'No such luck, maybe "'$cpp'" will work...'; \
-       $cpp <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       echo "It works!"
-       x_cpp="$cpp"
-       x_minus='';
-elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
-       $cpp - <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       echo "Hooray, it works!  I was beginning to wonder."
-       x_cpp="$cpp"
-       x_minus='-';
-elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
-       $wrapper <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       x_cpp="$wrapper"
-       x_minus=''
-       echo "Eureka!"
+echo " "
+$echo $n "Checking to see how big your file offsets are...$c" >&4
+$cat >try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof($lseektype));
+    return(0); 
+}
+EOCP
+set try
+if eval $compile_ok; then
+       lseeksize=`./try`
+       $echo " $lseeksize bytes." >&4
 else
-       dflt=''
-       rp="No dice.  I can't find a C preprocessor.  Name one:"
+       dflt=$longsize
+       echo " "
+       echo "(I can't seem to compile the test program.  Guessing...)"
+       rp="What is the size of your file offsets (in bytes)?"
        . ./myread
-       x_cpp="$ans"
-       x_minus=''
-       $x_cpp <testcpp.c >testcpp.out 2>&1
-       if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-               echo "OK, that will do." >&4
-       else
-echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
-               exit 1
-       fi
+       lseeksize="$ans"
 fi
+$rm -f try.c try
 
-case "$ok" in
-false)
-       cppstdin="$x_cpp"
-       cppminus="$x_minus"
-       cpprun="$x_cpp"
-       cpplast="$x_minus"
-       set X $x_cpp
-       shift
-       case "$1" in
-       "$cpp")
-               echo "Perhaps can we force $cc -E using a wrapper..."
-               if $wrapper <testcpp.c >testcpp.out 2>&1; \
-                       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
-               then
-                       echo "Yup, we can."
-                       cppstdin="$wrapper"
-                       cppminus='';
-               else
-                       echo "Nope, we'll have to live without it..."
-               fi
+: see what type file positions are declared as in the library
+rp="What is the type for file position used by fsetpos()?"
+set fpos_t fpostype long stdio.h sys/types.h
+eval $typedef_ask
+
+echo " "
+case "$fpostype" in
+*_t) zzz="$fpostype"   ;;
+*)   zzz="fpos_t"      ;;
+esac
+$echo $n "Checking the size of $zzz...$c" >&4 
+cat > try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+    printf("%d\n", (int)sizeof($fpostype));
+    exit(0);
+}
+EOCP
+set try
+if eval $compile_ok; then
+       yyy=`./try`
+       case "$yyy" in
+       '')     fpossize=4
+               echo " "
+               echo "(I can't execute the test program--guessing $fpossize.)" >&4
                ;;
-       esac
-       case "$cpprun" in
-       "$wrapper")
-               cpprun=''
-               cpplast=''
+       *)      fpossize=$yyy
+               echo " $fpossize bytes."
                ;;
        esac
-       ;;
-esac
-
-case "$cppstdin" in
-"$wrapper"|'cppstdin') ;;
-*) $rm -f $wrapper;;
-esac
-$rm -f testcpp.c testcpp.out
+else
+       dflt="$longsize"
+       echo " "
+       echo "(I can't compile the test program.  Guessing...)" >&4
+       rp="What is the size of your file positions (in bytes)?"
+       . ./myread
+       fpossize="$ans"
+fi
 
-: Set private lib path
-case "$plibpth" in
-'') if ./mips; then
-               plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
-       fi;;
-esac
-case "$libpth" in
-' ') dlist='';;
-'') dlist="$loclibpth $plibpth $glibpth";;
-*) dlist="$libpth";;
-esac
 
-: Now check and see which directories actually exist, avoiding duplicates
-libpth=''
-for xxx in $dlist
-do
-    if $test -d $xxx; then
-               case " $libpth " in
-               *" $xxx "*) ;;
-               *) libpth="$libpth $xxx";;
-               esac
-    fi
-done
-$cat <<'EOM'
 
-Some systems have incompatible or broken versions of libraries.  Among
-the directories listed in the question below, please remove any you
-know not to be holding relevant libraries, and add any that are needed.
-Say "none" for none.
+case "$lseeksize:$fpossize" in
+8:8) cat <<EOM
 
+You can have files larger than 2 gigabytes.
 EOM
-case "$libpth" in
-'') dflt='none';;
-*)
-       set X $libpth
-       shift
-       dflt=${1+"$@"}
-       ;;
-esac
-rp="Directories to use for library searches?"
-. ./myread
-case "$ans" in
-none) libpth=' ';;
-*) libpth="$ans";;
-esac
+   val="$define" ;;
+*) cat <<EOM
 
-: compute shared library extension
-case "$so" in
-'')
-       if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
-               dflt='sl'
-       else
-               dflt='so'
+Perl can be built to understand large files (files larger than 2 gigabytes)
+on some systems.  To do so, Configure must be run with -Duselargefiles.
+
+If this doesn't make any sense to you, just accept the default 'y'.
+EOM
+   case "$uselargefiles" in
+   "$undef"|false|[nN]*) dflt='n' ;;
+   *)  dflt='y' ;;
+   esac
+   rp='Try to understand large files, if available?'
+   . ./myread
+   case "$ans" in
+   y|Y)        val="$define" ;;
+   *)          val="$undef"  ;;
+   esac
+   ;;
+esac
+set uselargefiles
+eval $setvar
+case "$uselargefiles" in
+"$define")
+: Look for a hint-file generated 'call-back-unit'.  If the
+: user has specified that a large files perl is to be built,
+: we may need to set or change some other defaults.
+       if $test -f uselfs.cbu; then
+               echo "Your platform has some specific hints for large file builds, using them..."
+               . ./uselfs.cbu
+               echo " "
+               $echo $n "Rechecking to see how big your file offsets are...$c" >&4
+               $cat >try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof($lseektype));
+    return(0); 
+}
+EOCP
+               set try
+               if eval $compile_ok; then
+                       lseeksize=`./try`
+                       $echo " $lseeksize bytes." >&4
+               else
+                       dflt="$lseeksize"
+                       echo " "
+                       echo "(I can't seem to compile the test program.  Guessing...)"
+                       rp="What is the size of your file offsets (in bytes)?"
+                       . ./myread
+                       lseeksize="$ans"
+               fi
+               case "$fpostype" in
+               *_t) zzz="$fpostype"    ;;
+               *)   zzz="fpos_t"       ;;
+               esac
+               $echo $n "Rechecking the size of $zzz...$c" >&4 
+               $cat > try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+    printf("%d\n", (int)sizeof($fpostype));
+    exit(0);
+}
+EOCP
+               set try
+               if eval $compile_ok; then
+                       yyy=`./try`
+                       dflt="$lseeksize"
+                       case "$yyy" in
+                       '')     echo " "
+                               echo "(I can't execute the test program--guessing $fpossize.)" >&4
+                               ;;
+                       *)      fpossize=$yyy
+                               echo " $fpossize bytes."
+                               ;;
+                       esac
+               else
+                       dflt="$fpossize"
+                       echo " "
+                       echo "(I can't compile the test program.  Guessing...)" >&4
+                       rp="What is the size of your file positions (in bytes)?"
+                       . ./myread
+                       fpossize="$ans"
+               fi
+               $rm -f try.c try
        fi
        ;;
-*) dflt="$so";;
 esac
-$cat <<EOM
-
-On some systems, shared libraries may be available.  Answer 'none' if
-you want to suppress searching of shared libraries for the remaining
-of this configuration.
 
-EOM
-rp='What is the file extension used for shared libraries?'
-. ./myread
-so="$ans"
 
-: Define several unixisms.
-: Hints files or command line option can be used to override them.
-: The convoluted testing is in case hints files set either the old
-: or the new name.
-case "$_exe" in
-'')    case "$exe_ext" in
-    '')        ;;
-       *)      _exe="$exe_ext" ;;
-       esac
-       ;;
-esac
-case "$_a" in
-'')    case "$lib_ext" in
-    '')        _a='.a';;
-       *)      _a="$lib_ext" ;;
-       esac
-       ;;
-esac
-case "$_o" in
-'') case "$obj_ext" in
-       '')     _o='.o';;
-       *)      _o="$obj_ext";;
-       esac
+case "$usemorebits" in
+"$define"|true|[yY]*)
+       use64bits="$define"
+       uselongdouble="$define"
+       usemorebits="$define"
        ;;
-esac
-case "$p_" in
-'') case "$path_sep" in
-       '')     p_=':';;
-       *)      p_="$path_sep";;
-       esac
+*)     usemorebits="$undef"
        ;;
 esac
-exe_ext=$_exe
-lib_ext=$_a
-obj_ext=$_o
-path_sep=$p_
 
-: Which makefile gets called first.  This is used by make depend.
-case "$firstmakefile" in
-'') firstmakefile='makefile';;
-esac
 
-cat <<EOM
+case "$intsize:$longsize" in
+8:*|*:8) cat <<EOM
 
-Perl can be built to use the SOCKS proxy protocol library.  To do so,
-Configure must be run with -Dusesocks.
+You have natively 64-bit integers.
+EOM
+   val="$define" ;;
+*) cat <<EOM
 
-Normally you do not need this and you should answer no.
+Perl can be built to take advantage of 64-bit integer types
+on some systems.  To do so, Configure must be run with -Duse64bits.
 
+If this doesn't make any sense to you, just accept the default.
 EOM
-case "$usesocks" in
-$define|true|[yY]*)    dflt='y';;
-*) dflt='n';;
-esac
-rp='Build Perl for SOCKS?'
-. ./myread
-case "$ans" in
-y|Y)   val="$define" ;;     
-*)      val="$undef" ;;
+  case "$use64bits" in
+  $define|true|[yY]*)  dflt='y';;
+  *) dflt='n';;
+  esac
+  rp='Try to use 64-bit integers, if available?'
+  . ./myread
+  case "$ans" in
+  y|Y) val="$define" ;;
+  *)   val="$undef"  ;;
+  esac
+  ;;
 esac
-set usesocks
+set use64bits
 eval $setvar
 
-: Looking for optional libraries
-echo " "
-echo "Checking for optional libraries..." >&4
-case "$libs" in
-' '|'') dflt='';;
-*) dflt="$libs";;
-esac
-case "$libswanted" in
-'') libswanted='c_s';;
+case "$archname64" in
+'') archname64='' ;;   # not a typo
 esac
-case "$usesocks" in
-$define)
-       libswanted="$libswanted socks5 socks5_sh"
+
+case "$use64bits" in
+"$define"|true|[yY]*)
+: Look for a hint-file generated 'call-back-unit'.  If the
+: user has specified that a 64-bit perl is to be built,
+: we may need to set or change some other defaults.
+       if $test -f use64bits.cbu; then
+               echo "Your platform has some specific hints for 64-bit builds, using them..."
+               . ./use64bits.cbu
+       else
+               $cat <<EOM
+(Your platform doesn't have any specific hints for 64-bit builds.)
+EOM
+                case "$intsize:$longsize" in
+8:*|*:8) cat <<EOM
+(This is probably okay, as your system is a natively 64-bit system.)
+EOM
+                  ;;
+                esac
+               case "$gccversion" in
+               '')     ;;
+               *)      case "$ccflags" in
+                       *-DUSE_LONG_LONG*) ;;
+                       *) $cat <<EOM
+But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
+to the compilation flags.
+EOM
+                          ccflags="$ccflags -DUSE_LONG_LONG"
+                          ;;
+                       esac
+                       ;;
+               esac
+       fi
        ;;
 esac
-for thislib in $libswanted; do
-       
-       if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
-               $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
-               echo "Found -l$thislib (shared)."
-               case " $dflt " in
-               *"-l$thislib "*);;
-               *) dflt="$dflt -l$thislib";;
-               esac
-       elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
-               echo "Found -l$thislib (shared)."
-               case " $dflt " in
-               *"-l$thislib "*);;
-               *) dflt="$dflt -l$thislib";;
-               esac
-       elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
-               echo "Found -l$thislib."
-               case " $dflt " in
-               *"-l$thislib "*);;
-               *) dflt="$dflt -l$thislib";;
-               esac
-       elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
-               echo "Found -l$thislib."
-               case " $dflt " in
-               *"-l$thislib "*);;
-               *) dflt="$dflt -l$thislib";;
-               esac
-       elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
-               echo "Found -l${thislib}_s."
-               case " $dflt " in
-               *"-l$thislib "*);;
-               *) dflt="$dflt -l${thislib}_s";;
-               esac
-       elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
-               echo "Found -l$thislib."
-               case " $dflt " in
-               *"-l$thislib "*);;
-               *) dflt="$dflt -l$thislib";;
-               esac
+
+: determine the architecture name
+echo " "
+if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
+       tarch=`arch`"-$osname"
+elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
+       if uname -m > tmparch 2>&1 ; then
+               tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
+                       -e 's/$/'"-$osname/" tmparch`
        else
-               echo "No -l$thislib."
+               tarch="$osname"
        fi
-done
-set X $dflt
-shift
-dflt="$*"
-case "$libs" in
-'') dflt="$dflt";;
-*) dflt="$libs";;
+       $rm -f tmparch
+else
+       tarch="$osname"
+fi
+case "$myarchname" in
+''|"$tarch") ;;
+*)
+       echo "(Your architecture name used to be $myarchname.)"
+       archname=''
+       ;;
 esac
-case "$dflt" in
-' '|'') dflt='none';;
+myarchname="$tarch"
+case "$archname" in
+'') dflt="$tarch";;
+*) dflt="$archname";;
 esac
-
-$cat <<EOM
-
-In order to compile $package on your machine, a number of libraries
-are usually needed.  Include any other special libraries here as well.
-Say "none" for none.  The default list is almost always right.
-EOM
-
-echo " "
-rp="What libraries to use?"
+rp='What is your architecture name'
 . ./myread
-case "$ans" in
-none) libs=' ';;
-*) libs="$ans";;
+archname="$ans"
+case "$usethreads" in
+$define)
+       echo "Threads selected." >&4
+       case "$archname" in
+        *-thread*) echo "...and architecture name already has -thread." >&4
+                ;;
+        *)      archname="$archname-thread"
+                echo "...setting architecture name to $archname." >&4
+                ;;
+        esac
+       ;;
 esac
-
-: determine optimize, if desired, or use for debug flag also
-case "$optimize" in
-' '|$undef) dflt='none';;
-'') dflt='-O';;
-*) dflt="$optimize";;
+case "$usemultiplicity" in
+$define)
+       echo "Multiplicity selected." >&4
+       case "$archname" in
+        *-multi*) echo "...and architecture name already has -multi." >&4
+                ;;
+        *)      archname="$archname-multi"
+                echo "...setting architecture name to $archname." >&4
+                ;;
+        esac
+       ;;
+esac
+case "$use64bits" in
+$define)
+       case "$archname64" in
+       '')
+               ;;
+       *)
+               case "$archname" in
+               *-$archname64*) echo "...and architecture name already has $archname64." >&4
+                       ;;
+               *)      archname="$archname-$archname64"
+                       echo "...setting architecture name to $archname." >&4
+                       ;;
+               esac
+               ;;
+       esac
 esac
-$cat <<EOH
-
-Some C compilers have problems with their optimizers.  By default, $package
-compiles with the -O flag to use the optimizer.  Alternately, you might want
-to use the symbolic debugger, which uses the -g flag (on traditional Unix
-systems).  Either flag can be specified here.  To use neither flag, specify
-the word "none".
 
-EOH
-rp="What optimizer/debugger flag should be used?"
-. ./myread
-optimize="$ans"
-case "$optimize" in
-'none') optimize=" ";;
+: determine root of directory hierarchy where package will be installed.
+case "$prefix" in
+'')
+       dflt=`./loc . /usr/local /usr/local /local /opt /usr`
+       ;;
+*)
+       dflt="$prefix"
+       ;;
 esac
+$cat <<EOM
 
-dflt=''
-: We will not override a previous value, but we might want to
-: augment a hint file
-case "$hint" in
-none|recommended)
-       case "$gccversion" in
-       1*) dflt='-fpcc-struct-return' ;;
-       esac
-       case "$optimize" in
-       *-g*) dflt="$dflt -DDEBUGGING";;
-       esac
-       case "$gccversion" in
-       2*) if test -d /etc/conf/kconfig.d &&
-                       $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
-               then
-                       dflt="$dflt -posix"
-               fi
-               ;;
+By default, $package will be installed in $dflt/bin, manual pages
+under $dflt/man, etc..., i.e. with $dflt as prefix for all
+installation directories. Typically this is something like /usr/local.
+If you wish to have binaries under /usr/bin but other parts of the
+installation under /usr/local, that's ok: you will be prompted
+separately for each of the installation directories, the prefix being
+only used to set the defaults.
+
+EOM
+fn=d~
+rp='Installation prefix to use?'
+. ./getfile
+oldprefix=''
+case "$prefix" in
+'') ;;
+*)
+       case "$ans" in
+       "$prefix") ;;
+       *) oldprefix="$prefix";;
        esac
        ;;
 esac
+prefix="$ans"
+prefixexp="$ansexp"
 
-case "$mips_type" in
-*BSD*|'') inclwanted="$locincpth $usrinc";;
-*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
-esac
-for thisincl in $inclwanted; do
-       if $test -d $thisincl; then
-               if $test x$thisincl != x$usrinc; then
-                       case "$dflt" in
-                       *$thisincl*);;
-                       *) dflt="$dflt -I$thisincl";;
-                       esac
-               fi
+: is AFS running?
+echo " "
+case "$afs" in
+$define|true)  afs=true ;;
+$undef|false)  afs=false ;;
+*)     if test -d /afs; then
+               afs=true
+       else
+               afs=false
        fi
-done
-
-inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
-       xxx=true;
-elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
-       xxx=true;
+       ;;
+esac
+if $afs; then
+       echo "AFS may be running... I'll be extra cautious then..." >&4
 else
-       xxx=false;
-fi;
-if $xxx; then
-       case "$dflt" in
-       *$2*);;
-       *) dflt="$dflt -D$2";;
-       esac;
-fi'
+       echo "AFS does not seem to be running..." >&4
+fi
 
-set signal.h LANGUAGE_C; eval $inctest
+: determine installation prefix for where package is to be installed.
+if $afs; then 
+$cat <<EOM
 
-case "$usesocks" in
-$define)
-       ccflags="$ccflags -DSOCKS"
-       ;;
-esac
+Since you are running AFS, I need to distinguish the directory in which
+files will reside from the directory in which they are installed (and from
+which they are presumably copied to the former directory by occult means).
 
-case "$hint" in
-none|recommended) dflt="$ccflags $dflt" ;;
-*) dflt="$ccflags";;
-esac
+EOM
+       case "$installprefix" in
+       '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
+       *) dflt="$installprefix";;
+       esac
+else
+$cat <<EOM
 
-case "$dflt" in
-''|' ') dflt=none;;
-esac
-$cat <<EOH
+In some special cases, particularly when building $package for distribution,
+it is convenient to distinguish between the directory in which files should 
+be installed from the directory ($prefix) in which they 
+will eventually reside.  For most users, these two directories are the same.
 
-Your C compiler may want other flags.  For this question you should include
--I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
-but you should NOT include libraries or ld flags like -lwhatever.  If you
-want $package to honor its debug switch, you should include -DDEBUGGING here.
-Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
+EOM
+       case "$installprefix" in
+       '') dflt=$prefix ;;
+       *) dflt=$installprefix;;
+       esac
+fi
+fn=d~
+rp='What installation prefix should I use for installing files?'
+. ./getfile
+installprefix="$ans"
+installprefixexp="$ansexp"
 
-To use no flags, specify the word "none".
+: set the prefixit variable, to compute a suitable default value
+prefixit='case "$3" in
+""|none)
+       case "$oldprefix" in
+       "") eval "$1=\"\$$2\"";;
+       *)
+               case "$3" in
+               "") eval "$1=";;
+               none)
+                       eval "tp=\"\$$2\"";
+                       case "$tp" in
+                       ""|" ") eval "$1=\"\$$2\"";;
+                       *) eval "$1=";;
+                       esac;;
+               esac;;
+       esac;;
+*)
+       eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
+       case "$tp" in
+       --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
+       /*-$oldprefix/*|\~*-$oldprefix/*)
+               eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
+       *) eval "$1=\"\$$2\"";;
+       esac;;
+esac'
 
-EOH
-set X $dflt
-shift
-dflt=${1+"$@"}
-rp="Any additional cc flags?"
-. ./myread
-case "$ans" in
-none) ccflags='';;
-*) ccflags="$ans";;
-esac
+: set the base revision
+baserev=5.0
 
-: the following weeds options from ccflags that are of no interest to cpp
-cppflags="$ccflags"
-case "$gccversion" in
-1*) cppflags="$cppflags -D__GNUC__"
-esac
-case "$mips_type" in
-'');;
-*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
+
+: get the patchlevel
+echo " "
+echo "Getting the current patchlevel..." >&4
+if $test -r $rsrc/patchlevel.h;then
+       patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
+       subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
+       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`
+else
+       patchlevel=0
+       subversion=0
+       api_revision=0
+       api_version=0
+       api_subversion=0
+fi
+$echo $n "(You have $package" $c
+case "$package" in
+"*$baserev")   ;;
+*)             $echo $n " $baserev" $c ;;
 esac
-case "$cppflags" in
-'');;
+$echo $n " patchlevel $patchlevel" $c
+test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
+echo ".)"
+case "$osname" in
+dos|cygwin|vms|win32)
+       : XXX Should be a Configure test for double-dots in filenames.
+       version=`echo $baserev $patchlevel $subversion | \
+                $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
+       api_versionstring=`echo $api_revision $api_version $api_subversion | \
+                $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
+       ;;
 *)
-       echo " "
-       echo "Let me guess what the preprocessor flags are..." >&4
-       set X $cppflags
-       shift
-       cppflags=''
-       $cat >cpp.c <<'EOM'
-#define BLURFL foo
-
-BLURFL xx LFRULB
-EOM
-       previous=''
-       for flag in $*
-       do
-               case "$flag" in
-               -*) ftry="$flag";;
-               *) ftry="$previous $flag";;
-               esac
-               if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
-                       >cpp1.out 2>/dev/null && \
-                       $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
-                       >cpp2.out 2>/dev/null && \
-                       $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
-                       $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
-               then
-                       cppflags="$cppflags $ftry"
-                       previous=''
-               else
-                       previous="$flag"
-               fi
-       done
-       set X $cppflags
-       shift
-       cppflags=${1+"$@"}
-       case "$cppflags" in
-       *-*)  echo "They appear to be: $cppflags";;
-       esac
-       $rm -f cpp.c cpp?.out
+       version=`echo $baserev $patchlevel $subversion | \
+                $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
+       api_versionstring=`echo $api_revision $api_version $api_subversion | \
+                $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
        ;;
 esac
+: Special case the 5.005_xx maintenance series, which used 5.005
+: without any subversion label as a subdirectory in $sitelib
+if test "${api_revision}${api_version}${api_subversion}" = "550"; then
+       api_versionstring='5.005'
+fi
 
-: flags used in final linking phase
-case "$ldflags" in
-'') if ./venix; then
-               dflt='-i -z'
-       else
-               dflt=''
-       fi
-       case "$ccflags" in
-       *-posix*) dflt="$dflt -posix" ;;
+: determine installation style
+: For now, try to deduce it from prefix unless it is already set.
+: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
+case "$installstyle" in
+'')    case "$prefix" in
+               *perl*) dflt='lib';;
+               *) dflt='lib/perl5' ;;
        esac
        ;;
-*) dflt="$ldflags";;
+*)     dflt='lib/perl5' ;;
 esac
+: Probably not worth prompting for this since we prompt for all
+: the directories individually, and the prompt would be too long and
+: confusing anyway.
+installstyle=$dflt
 
-: Try to guess additional flags to pick up local libraries.
-for thislibdir in $libpth; do
-       case " $loclibpth " in
-       *" $thislibdir "*)
-               case "$dflt " in 
-               *"-L$thislibdir "*) ;;
-               *)  dflt="$dflt -L$thislibdir" ;;
-               esac
-               ;;
-       esac
-done
-
-case "$dflt" in
-'') dflt='none' ;;
+: determine where private library files go
+: Usual default is /usr/local/lib/perl5/$version.
+: Also allow things like /opt/perl/lib/$version, since 
+: /opt/perl/lib/perl5... would be redundant.
+: The default "style" setting is made in installstyle.U
+case "$installstyle" in
+*lib/perl5*) set dflt privlib lib/$package/$version ;;
+*)      set dflt privlib lib/$version ;;
 esac
+eval $prefixit
+$cat <<EOM
 
-$cat <<EOH
-
-Your C linker may need flags.  For this question you should
-include -L/whatever and any other flags used by the C linker, but you
-should NOT include libraries like -lwhatever.
+There are some auxiliary files for $package that need to be put into a
+private library directory that is accessible by everyone.
 
-Make sure you include the appropriate -L/path flags if your C linker
-does not normally search all of the directories you specified above,
-namely
-       $libpth
-To use no flags, specify the word "none".
+EOM
+fn=d~+
+rp='Pathname where the private library files will reside?'
+. ./getfile
+privlib="$ans"
+privlibexp="$ansexp"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
+else
+       installprivlib="$privlibexp"
+fi
 
-EOH
+: set the prefixup variable, to restore leading tilda escape
+prefixup='case "$prefixexp" in
+"$prefix") ;;
+*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
+esac'
 
-rp="Any additional ld flags (NOT including libraries)?"
-. ./myread
-case "$ans" in
-none) ldflags='';;
-*) ldflags="$ans";;
+: determine where public architecture dependent libraries go
+set archlib archlib
+eval $prefixit
+: privlib default is /usr/local/lib/$package/$version
+: archlib default is /usr/local/lib/$package/$version/$archname
+: privlib may have an optional trailing /share.
+tdflt=`echo $privlib | $sed 's,/share$,,'`
+tdflt=$tdflt/$archname
+case "$archlib" in
+'')    dflt=$tdflt
+       ;;
+*)     dflt="$archlib"
+    ;;
 esac
-rmlist="$rmlist pdp11"
+$cat <<EOM
 
-: coherency check
-echo " "
-echo "Checking your choice of C compiler and flags for coherency..." >&4
-$cat > try.c <<'EOF'
-#include <stdio.h>
-int main() { printf("Ok\n"); exit(0); }
-EOF
-set X $cc $optimize $ccflags -o try $ldflags try.c $libs
-shift
-$cat >try.msg <<'EOM'
-I've tried to compile and run the following simple program:
+$spackage contains architecture-dependent library files.  If you are
+sharing libraries in a heterogeneous environment, you might store
+these files in a separate location.  Otherwise, you can just include
+them with the rest of the public library files.
 
 EOM
-$cat try.c >> try.msg
+fn=d+~
+rp='Where do you want to put the public architecture-dependent libraries?'
+. ./getfile
+archlib="$ans"
+archlibexp="$ansexp"
+if $test X"$archlib" = X"$privlib"; then
+       d_archlib="$undef"
+else
+       d_archlib="$define"
+fi
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
+else
+       installarchlib="$archlibexp"
+fi
 
-$cat >> try.msg <<EOM
 
-I used the command:
+: Binary compatibility with 5.005 is not possible for builds
+: with advanced features
+case "$usethreads$usemultiplicity" in
+*define*)
+       bincompat5005="$undef"
+       d_bincompat5005="$undef"
+       ;;
+*)     $cat <<EOM
 
-       $*
-       ./try
+Perl 5.006 can be compiled for binary compatibility with 5.005.
+If you decide to do so, you will be able to continue using most
+of the extensions that were compiled for Perl 5.005.
 
-and I got the following output:
+EOM
+       case "$bincompat5005$d_bincompat5005" in
+       *"$undef"*) dflt=n ;;
+       *) dflt=y ;;
+       esac
+       rp='Binary compatibility with Perl 5.005?'
+       . ./myread
+       case "$ans" in
+       y*) val="$define" ;;
+       *)  val="$undef" ;;
+       esac
+       set d_bincompat5005
+       eval $setvar
+       case "$d_bincompat5005" in
+       "$define")
+               bincompat5005="$define"
+               ;;
+       *)      bincompat5005="$undef"
+               d_bincompat5005="$undef"
+               ;;
+       esac
+       ;;
+esac
+
+
+: see if setuid scripts can be secure
+$cat <<EOM
+
+Some kernels have a bug that prevents setuid #! scripts from being
+secure.  Some sites have disabled setuid #! scripts because of this.
+
+First let's decide if your kernel supports secure setuid #! scripts.
+(If setuid #! scripts would be secure but have been disabled anyway,
+don't say that they are secure if asked.)
 
 EOM
-dflt=y
-if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
-       if sh -c './try' >>try.msg 2>&1; then
-               xxx=`./try`
-               case "$xxx" in
-               "Ok") dflt=n ;;
-               *)      echo 'The program compiled OK, but produced no output.' >> try.msg
-                       case " $libs " in
-                       *" -lsfio "*)
-                               cat >> try.msg <<'EOQS'
-If $libs contains -lsfio, and sfio is mis-configured, then it
-sometimes (apparently) runs and exits with a 0 status, but with no
-output!  It may have to do with sfio's use of _exit vs. exit.
 
-EOQS
-                               rp="You have a big problem.  Shall I abort Configure"
-                               dflt=y
-                               ;;
+val="$undef"
+if $test -d /dev/fd; then
+       echo "#!$ls" >reflect
+       chmod +x,u+s reflect
+       ./reflect >flect 2>&1
+       if $contains "/dev/fd" flect >/dev/null; then
+               echo "Congratulations, your kernel has secure setuid scripts!" >&4
+               val="$define"
+       else
+               $cat <<EOM
+If you are not sure if they are secure, I can check but I'll need a
+username and password different from the one you are using right now.
+If you don't have such a username or don't want me to test, simply
+enter 'none'.
+
+EOM
+               rp='Other username to test security of setuid scripts with?'
+               dflt='none'
+               . ./myread
+               case "$ans" in
+               n|none)
+                       case "$d_suidsafe" in
+                       '')     echo "I'll assume setuid scripts are *not* secure." >&4
+                               dflt=n;;
+                       "$undef")
+                               echo "Well, the $hint value is *not* secure." >&4
+                               dflt=n;;
+                       *)      echo "Well, the $hint value *is* secure." >&4
+                               dflt=y;;
                        esac
                        ;;
+               *)
+                       $rm -f reflect flect
+                       echo "#!$ls" >reflect
+                       chmod +x,u+s reflect
+                       echo >flect
+                       chmod a+w flect
+                       echo '"su" will (probably) prompt you for '"$ans's password."
+                       su $ans -c './reflect >flect'
+                       if $contains "/dev/fd" flect >/dev/null; then
+                               echo "Okay, it looks like setuid scripts are secure." >&4
+                               dflt=y
+                       else
+                               echo "I don't think setuid scripts are secure." >&4
+                               dflt=n
+                       fi
+                       ;;
+               esac
+               rp='Does your kernel have *secure* setuid scripts?'
+               . ./myread
+               case "$ans" in
+               [yY]*)  val="$define";;
+               *)      val="$undef";;
                esac
-       else
-               echo "The program compiled OK, but exited with status $?." >>try.msg
-               rp="You have a problem.  Shall I abort Configure"
-               dflt=y
        fi
 else
-       echo "I can't compile the test program." >>try.msg
-       rp="You have a BIG problem.  Shall I abort Configure"
-       dflt=y
+       echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
+       echo "(That's for file descriptors, not floppy disks.)"
+       val="$undef"
 fi
-case "$dflt" in
-y)
-       $cat try.msg >&4
-       case "$knowitall" in
-       '')
-               echo "(The supplied flags or libraries might be incorrect.)"
-               ;;
-       *) dflt=n;;
+set d_suidsafe
+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
-       echo " "
+       rp="Do you want to do setuid/setgid emulation?"
        . ./myread
        case "$ans" in
-       n*|N*) ;;
-       *)      echo "Ok.  Stopping Configure." >&4
-               exit 1
-               ;;
+       [yY]*)  val="$define";;
+       *)      val="$undef";;
        esac
        ;;
-n) echo "OK, that should do.";;
 esac
-$rm -f try try.* core
+set d_dosuid
+eval $setvar
 
 : determine filename position in cpp output
 echo " "
@@ -4416,7 +5015,6 @@ 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";
@@ -4531,6 +5129,83 @@ case "$freetype" in
 esac
 echo "Your system uses $freetype free(), it would seem." >&4
 $rm -f malloc.[co]
+$cat <<EOM
+
+The installation process will also create a directory for
+vendor-supplied add-ons.  Vendors who supply perl with their system
+may find it convenient to place all vendor-supplied files in this
+directory rather than in the main distribution directory.  This will
+ease upgrades between binary-compatible maintenance versions of perl.
+
+Of course you may also use these directories in whatever way you see
+fit.  For example, you might use them to access modules shared over a
+company-wide network.
+
+The default answer should be fine for most people.
+This causes further questions about vendor add-ons to be skipped
+and no vendor-specific directories will be configured for perl.
+
+EOM
+rp='Do you want to configure vendor-specific add-on directories?'
+case "$usevendorprefix" in
+define|true|[yY]*) dflt=y ;;
+*) dflt=n ;;
+esac
+. ./myread
+case "$ans" in
+[yY]*) fn=d~+
+       rp='Installation prefix to use for vendor-supplied add-ons?'
+       case "$vendorprefix" in
+       '') dflt='' ;;
+       *)  dflt=$vendorprefix ;;
+       esac
+       . ./getfile
+       oldvendorprefix=''
+       case "$vendorprefix" in
+       '') ;;
+       *)      case "$ans" in
+               "$prefix") ;;
+               *) oldvendorprefix="$prefix";;
+               esac
+               ;;
+       esac
+       usevendorprefix="$define"
+       vendorprefix="$ans"
+       vendorprefixexp="$ansexp"
+       ;;
+*)     usevendorprefix="$undef"
+       vendorprefix=''
+       vendorprefixexp=''
+       ;;
+esac
+
+case "$vendorprefix" in
+'')    d_vendorlib="$undef"
+       vendorlib=''
+       vendorlibexp=''
+       ;;
+*)     d_vendorlib="$define"
+       : determine where vendor-supplied modules go.
+       : Usual default is /usr/local/lib/perl5/vendor_perl/$version
+       prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+       case "$installstyle" in
+       *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
+       *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
+       esac
+       fn=d~+
+       rp='Pathname for the vendor-supplied library files?'
+       . ./getfile
+       vendorlib="$ans"
+       vendorlibexp="$ansexp"
+       : Change installation prefix, if necessary.
+       if $test X"$prefix" != X"$installprefix"; then
+               installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
+       else
+               installvendorlib="$vendorlibexp"
+       fi
+       ;;
+esac
+
 : Cruising for prototypes
 echo " "
 echo "Checking out function prototypes..." >&4
@@ -4584,30 +5259,158 @@ if $test "X$ansexp" != "X$binexp"; then
 fi
 bin="$ans"
 binexp="$ansexp"
-if $afs; then
-       $cat <<EOM
+: Change installation prefix, if necessary.
+: XXX Bug? -- ignores Configure -Dinstallprefix setting.
+if $test X"$prefix" != X"$installprefix"; then
+       installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
+else
+       installbin="$binexp"
+fi
 
-Since you are running AFS, I need to distinguish the directory in which
-executables reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
+$cat <<EOM
+
+After $package is installed, you may wish to install various
+add-on modules and utilities.  Typically, these add-ons will
+be installed under $prefix with the rest
+of this package.  However, you may wish to install such add-ons
+elsewhere under a different prefix.
+
+If you do not wish to put everything under a single prefix, that's
+ok.  You will be prompted for the individual locations; this siteprefix
+is only used to suggest the defaults.
+
+The default should be fine for most people.
 
 EOM
-       case "$installbin" in
-       '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installbin";;
+fn=d~+
+rp='Installation prefix to use for add-on modules and utilities?'
+: XXX Here might be another good place for an installstyle setting.
+case "$siteprefix" in
+'') dflt=$prefix ;;
+*)  dflt=$siteprefix ;;
+esac
+. ./getfile
+oldsiteprefix=''
+case "$siteprefix" in
+'') ;;
+*)
+       case "$ans" in
+       "$prefix") ;;
+       *) oldsiteprefix="$prefix";;
        esac
-       fn=de~
-       rp='Where will public executables be installed?'
-       . ./getfile
-       installbin="$ans"
+       ;;
+esac
+siteprefix="$ans"
+siteprefixexp="$ansexp"
+
+: determine where site specific libraries go.
+: Usual default is /usr/local/lib/perl5/site_perl/$version
+: The default "style" setting is made in installstyle.U
+: XXX No longer works with Prefixit stuff.
+prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+case "$installstyle" in
+*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
+*)      dflt=$siteprefix/lib/site_$prog/$version ;;
+esac
+$cat <<EOM
+
+The installation process will create a directory for
+site-specific extensions and modules.  Most users find it convenient
+to place all site-specific files in this directory rather than in the
+main distribution directory.
+
+EOM
+fn=d~+
+rp='Pathname for the site-specific library files?'
+. ./getfile
+sitelib="$ans"
+sitelibexp="$ansexp"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
 else
-       installbin="$binexp"
+       installsitelib="$sitelibexp"
 fi
 
+: Determine list of previous versions to include in @INC
+$cat > getverlist <<EOPL
+#!$perl -w
+use File::Basename;
+\$api_versionstring = "$api_versionstring";
+\$version = "$version";
+\$sitelib = "$sitelib";
+\$archname = "$archname";
+EOPL
+       $cat >> getverlist <<'EOPL'
+# Can't have leading @ because metaconfig interprets it as a command!
+;@inc_version_list=();
+$stem=dirname($sitelib);
+# Redo to do opendir/readdir? 
+if (-d $stem) {
+    chdir($stem);
+    ;@candidates = glob("5.*");
+}
+else {
+    ;@candidates = ();
+}
+
+foreach $d (@candidates) {
+    if ($d lt $version) {
+       if ($d ge $api_versionstring) {
+           unshift(@inc_version_list, "$d/$archname", $d);
+       }
+       elsif ($d ge "5.005") {
+           unshift(@inc_version_list, $d);
+       }
+    }
+    else {
+       # Skip newer version.  I.e. don't look in
+       # 5.7.0 if we're installing 5.6.1.
+    }
+}
+
+if (@inc_version_list) {
+    print '"';
+    print join('", "', @inc_version_list);
+    print '"';
+}
+else {
+    # Blank space to preserve value for next Configure run.
+    print " ";
+}
+EOPL
+chmod +x getverlist
+case "$inc_version_list" in
+'')    if test -x $perl; then
+               dflt=`$perl getverlist`
+       else
+               dflt=''
+       fi
+       ;;
+*)  dflt="$inc_version_list" ;;
+esac
+$cat <<'EOM'
+
+In order to ease the process of upgrading, this version of perl 
+can be configured to use modules built and installed with earlier 
+versions of perl that were installed under $prefix.  Specify here
+the list of earlier versions that this version of perl should check.
+If Configure detected no earlier versions of perl installed under
+$prefix, then the list will be empty.
+
+The default should almost always be sensible, so if you're not sure,
+just accept the default.
+EOM
+
+rp='list of earlier versions to include in @INC?'
+. ./myread
+inc_version_list="$ans"
+$rm -f getverlist
+
 : determine whether to install perl also as /usr/bin/perl
 
 echo " "
-if test -d /usr/bin -a "X$installbin" != X/usr/bin; then
+if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
        $cat <<EOM
 Many scripts expect to perl to be installed as /usr/bin/perl.
 I can install the perl you are about to compile also as /usr/bin/perl
@@ -4629,17 +5432,6 @@ fi
 set installusrbinperl
 eval $setvar
 
-: define a shorthand compile call
-compile='
-mc_file=$1;
-shift;
-$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
-: define a shorthand compile call for compilations that should be ok.
-compile_ok='
-mc_file=$1;
-shift;
-$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
-
 echo " "
 echo "Checking for GNU C Library..." >&4
 cat >gnulibc.c <<EOM
@@ -5158,8 +5950,7 @@ y*) usedl="$define"
        tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
        rp="Source file to use for dynamic loading"
        fn="fne"
-       # XXX This getfile call will fail the existence check if you try 
-       # building away from $src (this is not supported yet).
+       gfpth="$src"
        . ./getfile
        usedl="$define"
        : emulate basename
@@ -5331,7 +6122,7 @@ $undef)
        ;;
 *)     case "$useshrplib" in
        '')     case "$osname" in
-               svr4*|dgux|dynixptx|esix|powerux|beos)
+               svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
                        dflt=y
                        also='Building a shared libperl is required for dynamic loading to work on your system.'
                        ;;
@@ -5371,16 +6162,7 @@ EOM
        . ./myread
        case "$ans" in
        true|$define|[Yy]*)
-               useshrplib='true'
-               # Why does next4 have to be so different?
-               case "${osname}${osvers}" in
-               next4*|rhapsody*)
-                       xxx='DYLD_LIBRARY_PATH' ;;
-               os2*)   xxx='' ;; # Nothing special needed.
-               beos*)  xxx='' ;;
-               *)              xxx='LD_LIBRARY_PATH' ;;
-               esac
-               ;;
+               useshrplib='true'  ;;
        *)      useshrplib='false' ;;
        esac
        ;;
@@ -5410,6 +6192,9 @@ true)
                linux*)  # ld won't link with a bare -lperl otherwise.
                        dflt=libperl.$so
                        ;;
+               cygwin*) # include version
+                       dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
+                       ;;
                *)      # Try to guess based on whether libc has major.minor.
                        case "$libc" in
                        *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
@@ -5527,10 +6312,20 @@ EOM
                ;;
        esac
 fi
+# Fix ccdlflags in AIX for building external extensions.
+# (For building Perl itself bare -bE:perl.exp is needed,
+#  Makefile.SH takes care of this.)
+case "$osname" in
+aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
+esac
 # Respect a hint or command-line value.
 case "$shrpenv" in
 '') shrpenv="$tmp_shrpenv" ;;
 esac
+case "$ldlibpthname" in
+'')    ldlibpthname=LD_LIBRARY_PATH ;;
+none)  ldlibpthname='' ;;
+esac
 
 : determine where manual pages go
 set man1dir man1dir none
@@ -5575,25 +6370,13 @@ fi
 man1dir="$ans"
 man1direxp="$ansexp"
 case "$man1dir" in
-'') man1dir=' '
+'')    man1dir=' '
        installman1dir='';;
 esac
-if $afs; then
-       $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in which
-manual pages reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
 
-EOM
-       case "$installman1dir" in
-       '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installman1dir";;
-       esac
-       fn=de~
-       rp='Where will man pages be installed?'
-       . ./getfile
-       installman1dir="$ans"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
 else
        installman1dir="$man1direxp"
 fi
@@ -5702,52 +6485,46 @@ esac
 echo "If you don't want the manual sources installed, answer 'none'."
 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
 case "$man3dir" in
-'')    case "$prefix" in 
-       *$prog*) dflt=`echo $man1dir | 
-                       $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
-       *)      dflt="$privlib/man/man3" ;;
-       esac
+'')    dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
+       if $test -d "$privlib/man/man3"; then
+               cat <<EOM >&4
+
+WARNING:  Previous versions of perl installed man3 pages into
+$privlib/man/man3.  This version will suggest a 
+new default of $dflt.  
+EOM
+               tdflt=$dflt
+               dflt='n'
+               rp='Do you wish to preserve the old behavior?(y/n)'
+               . ./myread
+               case "$ans" in
+               y*) dflt="$privlib/man/man3" ;;
+               *)  dflt=$tdflt ;;
+               esac
+    fi
        ;;
 ' ') dflt=none;;
 *)     dflt="$man3dir" ;;
 esac
 echo " "
-
 fn=dn+~
 rp="Where do the $package library man pages (source) go?"
 . ./getfile
-if test "X$man3direxp" != "X$ansexp"; then
-       installman3dir=''
-fi
-
 man3dir="$ans"
 man3direxp="$ansexp"
-case "$man3dir" in
-'') man3dir=' '
+case "$man1dir" in
+'')    man3dir=' '
        installman3dir='';;
 esac
-if $afs; then
-       $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in which
-manual pages reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
 
-EOM
-       case "$installman3dir" in
-       '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installman3dir";;
-       esac
-       fn=de~
-       rp='Where will man pages be installed?'
-       . ./getfile
-       installman3dir="$ans"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
 else
        installman3dir="$man3direxp"
 fi
 
 : What suffix to use on installed man pages
-
 case "$man3dir" in
 ' ')
        man3ext='0'
@@ -5821,13 +6598,13 @@ if $test -d /usr/etc/yp || $test -d /etc/yp; then
        esac
 fi
 case "$hostcat" in
-'') hostcat='cat /etc/hosts';;
+'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
 esac
 case "$groupcat" in
-'') groupcat='cat /etc/group';;
+'') test -f /etc/group && groupcat='cat /etc/group';;
 esac
 case "$passcat" in
-'') passcat='cat /etc/passwd';;
+'') test -f /etc/passwd && passcat='cat /etc/passwd';;
 esac
 
 : now get the host name
@@ -5929,6 +6706,7 @@ case "$myhostname" in
                                $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
                        $test -s hosts
                } || {
+                       test "X$hostcat" != "X" &&
                        $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
                                        /[       ]$myhostname[  . ]/p" > hosts
                }
@@ -6146,9 +6924,10 @@ case "$scriptdir" in
        dflt="$bin"
        : guess some guesses
        $test -d /usr/share/scripts && dflt=/usr/share/scripts
-       $test -d /usr/share/bin && dflt=/usr/share/bin
-       $test -d /usr/local/script && dflt=/usr/local/script
-       $test -d $prefixexp/script && dflt=$prefixexp/script
+       $test -d /usr/share/bin     && dflt=/usr/share/bin
+       $test -d /usr/local/script  && dflt=/usr/local/script
+       $test -d /usr/local/scripts && dflt=/usr/local/scripts
+       $test -d $prefixexp/script  && dflt=$prefixexp/script
        set dflt
        eval $prefixup
        ;;
@@ -6171,117 +6950,149 @@ if $test "X$ansexp" != "X$scriptdirexp"; then
 fi
 scriptdir="$ans"
 scriptdirexp="$ansexp"
-if $afs; then
-       $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in which
-scripts reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
-
-EOM
-       case "$installscript" in
-       '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installscript";;
-       esac
-       fn=de~
-       rp='Where will public scripts be installed?'
-       . ./getfile
-       installscript="$ans"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
 else
        installscript="$scriptdirexp"
 fi
 
-: determine where site specific libraries go.
-: Usual default is /usr/local/lib/perl5/site_perl/$apiversion
-prog=`echo $package | $sed 's/-*[0-9.]*$//'`
-case "$prefix" in
-*perl*) set dflt sitelib lib/site_$prog/$apiversion ;;
-*)      set dflt sitelib lib/$package/site_$prog/$apiversion ;;
-esac
+: determine where site specific architecture-dependent libraries go.
+: sitelib  default is /usr/local/lib/perl5/site_perl/$version
+: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
+: sitelib may have an optional trailing /share.
+tdflt=`echo $sitelib | $sed 's,/share$,,'`
+tdflt="$tdflt/$archname"
+set sitearch sitearch none
 eval $prefixit
+case "$sitearch" in
+'')    dflt="$tdflt" ;;
+*)     dflt="$sitearch" ;;
+esac
 $cat <<EOM
 
 The installation process will also create a directory for
-site-specific extensions and modules.  Some users find it convenient
-to place all site-specific files in this directory rather than in the
-main distribution directory.
+architecture-dependent site-specific extensions and modules.
 
 EOM
-fn=d~+
-rp='Pathname for the site-specific library files?'
+fn=nd~+
+rp='Pathname for the site-specific architecture-dependent library files?'
 . ./getfile
-if $test "X$sitelibexp" != "X$ansexp"; then
-       installsitelib=''
+sitearch="$ans"
+sitearchexp="$ansexp"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
+else
+       installsitearch="$sitearchexp"
 fi
-sitelib="$ans"
-sitelibexp="$ansexp"
-if $afs; then
-       $cat <<EOM
 
-Since you are running AFS, I need to distinguish the directory in
-which site-specific files reside from the directory in which they are
-installed (and from which they are presumably copied to the former
-directory by occult means).
+: determine where add-on public executables go
+case "$sitebin" in
+'')    dflt=$siteprefix/bin ;;
+*)     dflt=$sitebin ;;
+esac
+fn=d~
+rp='Pathname where the add-on public executables should be installed?'
+. ./getfile
+sitebin="$ans"
+sitebinexp="$ansexp"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
+else
+       installsitebin="$sitebinexp"
+fi
+
+cat <<EOM
+
+Perl can be built to take advantage of long doubles which
+(if available) may give more accuracy and range for floating point numbers.
+
+If this doesn't make any sense to you, just accept the default 'n'.
+EOM
+
+case "$ccflags" in
+*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
+esac
+
+case "$uselongdouble" in
+$define|true|[yY]*)    dflt='y';;
+*) dflt='n';;
+esac
+rp='Try to use long doubles if available?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define"   ;;
+*)      val="$undef"   ;;
+esac
+set uselongdouble
+eval $setvar
+
+case "$uselongdouble" in
+true|[yY]*) uselongdouble="$define" ;;
+esac
 
+case "$uselongdouble" in
+$define)
+: Look for a hint-file generated 'call-back-unit'.  If the
+: user has specified that long doubles should be used,
+: we may need to set or change some other defaults.
+       if $test -f uselongdouble.cbu; then
+               echo "Your platform has some specific hints for long doubles, using them..."
+               . ./uselongdouble.cbu
+       else
+               $cat <<EOM
+(Your platform doesn't have any specific hints for long doubles.)
 EOM
-       case "$installsitelib" in
-       '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installsitelib";;
-       esac
-       fn=de~
-       rp='Where will site-specific files be installed?'
-       . ./getfile
-       installsitelib="$ans"
-else
-       installsitelib="$sitelibexp"
-fi
-
-: determine where site specific architecture-dependent libraries go.
-: sitelib  default is /usr/local/lib/perl5/site_perl/$apiversion
-: sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
-: sitelib may have an optional trailing /share.
-tdflt=`echo $sitelib | $sed 's,/share$,,'`
-tdflt="$tdflt/$archname"
-set sitearch sitearch none
-eval $prefixit
-case "$sitearch" in
-'')    dflt="$tdflt" ;;
-*)     dflt="$sitearch" ;;
+       fi
+       ;;
 esac
-$cat <<EOM
 
-The installation process will also create a directory for
-architecture-dependent site-specific extensions and modules.
+cat <<EOM
+
+Perl can be built to take advantage of long longs which
+(if available) may give more range for integer numbers.
 
+If this doesn't make any sense to you, just accept the default 'n'.
 EOM
-fn=nd~+
-rp='Pathname for the site-specific architecture-dependent library files?'
-. ./getfile
-if $test "X$sitearchexp" != "X$ansexp"; then
-       installsitearch=''
-fi
-sitearch="$ans"
-sitearchexp="$ansexp"
-if $afs; then
-       $cat <<EOM
 
-Since you are running AFS, I need to distinguish the directory in
-which site-specific architecture-dependent library files reside from
-the directory in which they are installed (and from which they are
-presumably copied to the former directory by occult means).
+case "$ccflags" in
+*-DUSE_LONG_LONG*) uselonglong="$define" ;;
+esac
+
+case "$uselonglong" in
+$define|true|[yY]*)    dflt='y';;
+*) dflt='n';;
+esac
+rp='Try to use long longs if available?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define"   ;;
+*)      val="$undef"   ;;
+esac
+set uselonglong
+eval $setvar
+
+case "$uselonglong" in
+true|[yY]*) uselonglong="$define" ;;
+esac
 
+case "$uselonglong" in
+$define)
+: Look for a hint-file generated 'call-back-unit'.  If the
+: user has specified that long longs should be used,
+: we may need to set or change some other defaults.
+       if $test -f uselonglong.cbu; then
+               echo "Your platform has some specific hints for long longs, using them..."
+               . ./uselonglong.cbu
+       else
+               $cat <<EOM
+(Your platform doesn't have any specific hints for long longs.)
 EOM
-       case "$installsitearch" in
-       '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installsitearch";;
-       esac
-       fn=de~
-       rp='Where will site-specific architecture-dependent files be installed?'
-       . ./getfile
-       installsitearch="$ans"
-else
-       installsitearch="$sitearchexp"
-fi
+       fi
+       ;;
+esac
 
 cat <<EOM
 
@@ -6313,6 +7124,32 @@ esac
 set useperlio
 eval $setvar 
 
+case "$vendorprefix" in
+'')    d_vendorbin="$undef"
+       vendorbin=''
+       vendorbinexp=''
+       ;;
+*)     d_vendorbin="$define"
+       : determine where vendor-supplied executables go.
+       dflt=$vendorprefix/bin
+       fn=d~+
+       rp='Pathname for the vendor-supplied executables directory?'
+       . ./getfile
+       vendorbin="$ans"
+       vendorbinexp="$ansexp"
+       : Change installation prefix, if necessary.
+       if $test X"$prefix" != X"$installprefix"; then
+               installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
+       else
+               installvendorbin="$vendorbinexp"
+       fi
+       ;;
+esac
+
+: see if qgcvt exists
+set qgcvt d_qgcvt
+eval $inlibc
+
 : Check how to convert floats to strings.
 if test "X$d_Gconvert" = X; then
        echo " "
@@ -6326,85 +7163,281 @@ char *myname = "gconvert";
 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
 char *myname = "gcvt";
 #endif
+#ifdef TRY_qgcvt
+#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
+char *myname = "qgcvt";
+#endif
 #ifdef TRY_sprintf
 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
 char *myname = "sprintf";
 #endif
 
 #include <stdio.h>
-
-int
-checkit(expect, got)
-char *expect;
-char *got;
-{
-    if (strcmp(expect, got)) {
-               printf("%s oddity:  Expected %s, got %s\n",
-                       myname, expect, got);
-               exit(1);
-       }
+
+int
+checkit(expect, got)
+char *expect;
+char *got;
+{
+    if (strcmp(expect, got)) {
+               printf("%s oddity:  Expected %s, got %s\n",
+                       myname, expect, got);
+               exit(1);
+       }
+}
+
+int main()
+{ 
+       char buf[64]; 
+       buf[63] = '\0';
+
+       /* This must be 1st test on (which?) platform */
+       /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
+       Gconvert(0.1, 8, 0, buf);
+       checkit("0.1", buf);
+
+       Gconvert(1.0, 8, 0, buf); 
+       checkit("1", buf);
+
+       Gconvert(0.0, 8, 0, buf); 
+       checkit("0", buf);
+
+       Gconvert(-1.0, 8, 0, buf); 
+       checkit("-1", buf);
+
+       /* Some Linux gcvt's give 1.e+5 here. */
+       Gconvert(100000.0, 8, 0, buf); 
+       checkit("100000", buf);
+       
+       /* Some Linux gcvt's give -1.e+5 here. */
+       Gconvert(-100000.0, 8, 0, buf); 
+       checkit("-100000", buf);
+
+       exit(0);
+}
+EOP
+       case "$d_Gconvert" in
+       gconvert*) xxx_list='gconvert gcvt sprintf' ;;
+       gcvt*) xxx_list='gcvt gconvert sprintf' ;;
+       sprintf*) xxx_list='sprintf gconvert gcvt' ;;
+       *) xxx_list='gconvert gcvt sprintf' ;;
+       esac
+
+        case "$uselongdouble$d_qgcvt" in
+        definedefine) xxx_list="`echo $xxx_list|sed s/gcvt/qgcvt/`" ;;
+       esac
+
+       for xxx_convert in $xxx_list; do
+               echo "Trying $xxx_convert..."
+               $rm -f try try$_o
+               set try -DTRY_$xxx_convert
+               if eval $compile; then
+                       echo "$xxx_convert" found. >&4
+                       if ./try; then
+                               echo "I'll use $xxx_convert to convert floats into a string." >&4
+                               break;
+                       else
+                               echo "...But $xxx_convert didn't work as I expected."
+                       fi
+               else
+                       echo "$xxx_convert NOT found." >&4
+               fi
+       done
+               
+       case "$xxx_convert" in
+       gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
+       gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
+       qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
+       *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
+       esac
+fi
+
+: check for length of double
+echo " "
+case "$doublesize" in
+'')
+       $echo $n "Checking to see how big your double precision numbers are...$c" >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof(double));
+    exit(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               doublesize=`./try`
+               $echo " $doublesize bytes." >&4
+       else
+               dflt='8'
+               echo "(I can't seem to compile the test program.  Guessing...)"
+               rp="What is the size of a double precision number (in bytes)?"
+               . ./myread
+               doublesize="$ans"
+       fi
+       ;;
+esac
+$rm -f try.c try
+
+: check for long doubles
+echo " "
+$echo $n "Checking to see if your system supports long double..." $c >&4
+echo 'int main() { long double x = 7.0; }' > try.c
+set try
+if eval $compile; then
+       val="$define"
+       echo " Yes, it does." >&4
+else
+       val="$undef"
+       echo " No, it doesn't." >&4
+fi
+$rm try.*
+set d_longdbl
+eval $setvar
+
+: check for length of long double
+case "${d_longdbl}${longdblsize}" in
+$define)
+       echo " "
+       $echo $n "Checking to see how big your long doubles are..." $c >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+       printf("%d\n", sizeof(long double));
+}
+EOCP
+       set try
+       set try
+       if eval $compile; then
+               longdblsize=`./try$exe_ext`
+               $echo " $longdblsize bytes." >&4
+       else
+               dflt='8'
+               echo " "
+               echo "(I can't seem to compile the test program.  Guessing...)" >&4
+               rp="What is the size of a long double (in bytes)?"
+               . ./myread
+               longdblsize="$ans"
+       fi
+       if $test "X$doublesize" = "X$longdblsize"; then
+               echo "(That isn't any different from an ordinary double.)"
+       fi      
+       ;;
+esac
+$rm -f try.* try
+
+echo " "
+
+if $test X"$d_longdbl" = X"$define"; then
+
+echo "Checking how to print long doubles..." >&4
+
+if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  double d = 123.456;
+  printf("%.3f\n", d);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               123.456)
+                       sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
+                       sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
+                       echo "We will use %f."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  long double d = 123.456;
+  printf("%.3llf\n", d);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               123.456)
+                       sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
+                       sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
+                       echo "We will use %llf."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  long double d = 123.456;
+  printf("%.3Lf\n", d);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               123.456)
+                       sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
+                       sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
+                       echo "We will use %Lf."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  long double d = 123.456;
+  printf("%.3lf\n", d);
 }
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               123.456)
+                       sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
+                       sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
+                       echo "We will use %lf."
+                       ;;
+               esac
+       fi
+fi
 
-int main()
-{ 
-       char buf[64]; 
-       buf[63] = '\0';
-
-       /* This must be 1st test on (which?) platform */
-       /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
-       Gconvert(0.1, 8, 0, buf);
-       checkit("0.1", buf);
-
-       Gconvert(1.0, 8, 0, buf); 
-       checkit("1", buf);
-
-       Gconvert(0.0, 8, 0, buf); 
-       checkit("0", buf);
-
-       Gconvert(-1.0, 8, 0, buf); 
-       checkit("-1", buf);
+if $test X"$sPRIfldbl" = X; then
+       echo "Cannot figure out how to print long doubles." >&4
+fi
 
-       /* Some Linux gcvt's give 1.e+5 here. */
-       Gconvert(100000.0, 8, 0, buf); 
-       checkit("100000", buf);
-       
-       /* Some Linux gcvt's give -1.e+5 here. */
-       Gconvert(-100000.0, 8, 0, buf); 
-       checkit("-100000", buf);
+$rm -f try try.*
 
-       exit(0);
-}
-EOP
-       case "$d_Gconvert" in
-       gconvert*) xxx_list='gconvert gcvt sprintf' ;;
-       gcvt*) xxx_list='gcvt gconvert sprintf' ;;
-       sprintf*) xxx_list='sprintf gconvert gcvt' ;;
-       *) xxx_list='gconvert gcvt sprintf' ;;
-       esac
+fi # d_longdbl
 
-       for xxx_convert in $xxx_list; do
-               echo "Trying $xxx_convert"
-               $rm -f try try$_o
-               set try -DTRY_$xxx_convert
-               if eval $compile; then
-                       echo "$xxx_convert" found. >&4
-                       if ./try; then
-                               echo "I'll use $xxx_convert to convert floats into a string." >&4
-                               break;
-                       else
-                               echo "...But $xxx_convert didn't work as I expected."
-                       fi
-               else
-                       echo "$xxx_convert NOT found." >&4
-               fi
-       done
-               
-       case "$xxx_convert" in
-       gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
-       gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
-       *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
-       esac
-fi
+case "$sPRIfldbl" in
+'')    d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
+       d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
+       ;;
+*)     d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
+       d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
+       ;;
+esac
 
 : Initialize h_fcntl
 h_fcntl=false
@@ -6462,6 +7495,14 @@ eval $inlibc
 set alarm d_alarm
 eval $inlibc
 
+: see if atolf exists
+set atolf d_atolf
+eval $inlibc
+
+: see if atoll exists
+set atoll d_atoll
+eval $inlibc
+
 : Look for GNU-cc style attribute checking
 echo " "
 echo "Checking whether your compiler can handle __attribute__ ..." >&4
@@ -6624,52 +7665,6 @@ $rm -f set set.c
 set bzero d_bzero
 eval $inlibc
 
-: check for lengths of integral types
-echo " "
-case "$intsize" in
-'')
-       echo "Checking to see how big your integers are..." >&4
-       $cat >intsize.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-       printf("intsize=%d;\n", sizeof(int));
-       printf("longsize=%d;\n", sizeof(long));
-       printf("shortsize=%d;\n", sizeof(short));
-       exit(0);
-}
-EOCP
-       set intsize
-       if eval $compile_ok && ./intsize > /dev/null; then
-               eval `./intsize`
-               echo "Your integers are $intsize bytes long."
-               echo "Your long integers are $longsize bytes long."
-               echo "Your short integers are $shortsize bytes long."
-       else
-               $cat >&4 <<EOM
-!
-Help! I can't compile and run the intsize test program: please enlighten me!
-(This is probably a misconfiguration in your system or libraries, and
-you really ought to fix it.  Still, I'll try anyway.)
-!
-EOM
-               dflt=4
-               rp="What is the size of an integer (in bytes)?"
-               . ./myread
-               intsize="$ans"
-               dflt=$intsize
-               rp="What is the size of a long integer (in bytes)?"
-               . ./myread
-               longsize="$ans"
-               dflt=2
-               rp="What is the size of a short integer (in bytes)?"
-               . ./myread
-               shortsize="$ans"
-       fi
-       ;;
-esac
-$rm -f intsize intsize.*
-
 : see if signal is declared as pointer to function returning int or void
 echo " "
 xxx=`./findhdr signal.h`
@@ -6883,183 +7878,42 @@ xxx(va_alist)
 va_dcl
 {
        va_list args;
-       char buf[10];
-
-       va_start(args);
-       exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
-}
-EOF
-       set vprintf
-       if eval $compile && ./vprintf; then
-               echo "Your vsprintf() returns (int)." >&4
-               val2="$undef"
-       else
-               echo "Your vsprintf() returns (char*)." >&4
-               val2="$define"
-       fi
-else
-       echo 'vprintf() NOT found.' >&4
-               val="$undef"
-               val2="$undef"
-fi
-set d_vprintf
-eval $setvar
-val=$val2
-set d_charvspr
-eval $setvar
-
-: see if chown exists
-set chown d_chown
-eval $inlibc
-
-: see if chroot exists
-set chroot d_chroot
-eval $inlibc
-
-: see if chsize exists
-set chsize d_chsize
-eval $inlibc
-
-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; foo.$field = 0; }" >> try.c;
-if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
-       val="$define";
-else
-       val="$undef";
-fi;
-set $varname;
-eval $setvar;
-$rm -f try.c try.o'
-
-: see if this is a sys/uio.h system
-set sys/uio.h i_sysuio
-eval $inhdr
-
-echo "Checking to see if your system supports struct iovec..." >&4
-set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
-eval $hasfield
-case "$d_iovec_s" in
-"$define")      echo "Yup, it does." >&4
-                ;;
-*)              echo "Nope, it doesn't." >&4
-                ;;
-esac
-
-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
-
+       char buf[10];
 
-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;
+       va_start(args);
+       exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
 }
 EOF
-       val="$undef"
-       set try; if eval $compile; then
-               val="$define"
+       set vprintf
+       if eval $compile && ./vprintf; then
+               echo "Your vsprintf() returns (int)." >&4
+               val2="$undef"
+       else
+               echo "Your vsprintf() returns (char*)." >&4
+               val2="$define"
        fi
-       set d_${enum}; eval $setvar
-       $rm -f try.c try
-done
+else
+       echo 'vprintf() NOT found.' >&4
+               val="$undef"
+               val2="$undef"
+fi
+set d_vprintf
+eval $setvar
+val=$val2
+set d_charvspr
+eval $setvar
 
-set sendmsg d_sendmsg
+: see if chown exists
+set chown d_chown
 eval $inlibc
 
-set recvmsg d_recvmsg
+: see if chroot exists
+set chroot d_chroot
 eval $inlibc
 
-echo " "
-$echo $n "Checking to see if your system supports struct msghdr...$c" >&4
-set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
-eval $hasfield
-case "$d_msghdr_s" in
-"$define")      echo "Yup, it does." >&4
-                ;;
-*)              echo "Nope, it doesn't." >&4
-                ;;
-esac
-
-$echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
-set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
-eval $hasfield
-case "$d_cmsghdr_s" in
-"$define")      echo "Yup, it does." >&4
-                ;;
-*)              echo "Nope, it doesn't." >&4
-                ;;
-esac
+: see if chsize exists
+set chsize d_chsize
+eval $inlibc
 
 : check for const keyword
 echo " "
@@ -7166,52 +8020,10 @@ $rm -f dbl_dig.?
 set d_dbl_dig
 eval $setvar
 
-
-if $test X"$use64bits" = X"$define"; then
-       : see if dbminit64 exists
-       set dbminit64 d_dbminit64
-       eval $inlibc
-
-       : see if dbmclose64 exists
-       set dbmclose64 d_dbmclose64
-       eval $inlibc
-
-       : see if fetch64 exists
-       set fetch64 d_fetch64
-       eval $inlibc
-
-       : see if store64 exists
-       set store64 d_store64
-       eval $inlibc
-
-       : see if delete64 exists
-       set delete64 d_delete64
-       eval $inlibc
-
-       : see if firstkey64 exists
-       set firstkey64 d_firstkey64
-       eval $inlibc
-
-       : see if nextkey64 exists
-       set nextkey64 d_nextkey64
-       eval $inlibc
-else
-       val="$undef"
-       for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
-       do
-               set $xxx
-               eval $setvar
-       done
-fi
-
 : see if difftime exists
 set difftime d_difftime
 eval $inlibc
 
-: see if sys/stat.h is available
-set sys/stat.h i_sysstat
-eval $inhdr
-
 : see if this is a dirent system
 echo " "
 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
@@ -7280,162 +8092,6 @@ set d_dirnamlen
 eval $setvar
 $rm -f try.c
 
-
-if $test X"$use64bits" = X"$define"; then
-       : see if fstat64 exists
-       set fstat64 d_fstat64
-       eval $inlibc
-
-       : see if ftruncate64 exists
-       set ftruncate64 d_ftruncate64
-       eval $inlibc
-
-       : see if lockf64 exists
-       set lockf64 d_lockf64
-       eval $inlibc
-
-       : see if llseek exists
-       set llseek d_llseek
-       eval $inlibc
-
-       : see if lseek64 exists
-       set lseek64 d_lseek64
-       eval $inlibc
-
-       : see if lstat64 exists
-       set lstat64 d_lstat64
-       eval $inlibc
-
-       : see if open64 exists
-       set open64 d_open64
-       eval $inlibc
-
-       : see if opendir64 exists
-       set opendir64 d_opendir64
-       eval $inlibc
-
-       : see if readdir64 exists
-       set readdir64 d_readdir64
-       eval $inlibc
-
-       : see if seekdir64 exists
-       set seekdir64 d_seekdir64
-       eval $inlibc
-
-       : see if stat64 exists
-       set stat64 d_stat64
-       eval $inlibc
-
-       : see if telldir64 exists
-       set telldir64 d_telldir64
-       eval $inlibc
-
-       : see if truncate64 exists
-       set truncate64 d_truncate64
-       eval $inlibc
-
-       : check for off64_t
-       echo " "
-       echo $n "Checking to see if your system supports off64_t...$c" >&4
-       $cat >try.c <<EOCP
-#include <sys/types.h>
-#include <unistd.h>
-off64_t foo() { off64_t x; x = 7; return x; }'
-EOCP
-       if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
-               val="$define"
-               echo " Yup, it does." >&4
-       else
-               val="$undef"
-               echo " Nope, it doesn't." >&4
-       fi
-       $rm -f try.*
-       set d_off64_t
-       eval $setvar
-
-       : check for offset_t
-       echo " "
-       echo $n "Checking to see if your system supports offset_t...$c" >&4
-       $cat >try.c <<EOCP
-#include <sys/types.h>
-#include <unistd.h>
-offset_t foo() { offset_t x; x = 7; return x; }'
-EOCP
-       if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
-               val="$define"
-               echo " Yup, it does." >&4
-       else
-               val="$undef"
-               echo " Nope, it doesn't." >&4
-       fi
-       $rm -f try.*
-       set d_offset_t
-       eval $setvar
-
-       : check for ino64_t
-       echo " "
-       echo $n "Checking to see if your system supports ino64_t...$c" >&4
-       val="$undef"
-       case "$i_sysstat" in
-       "$define" )
-               $cat >try.c <<EOCP
-#include <sys/types.h>
-#include <sys/stat.h>
-ino64_t foo() { ino64_t x; x = 7; return x; }'
-EOCP
-               if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
-                       val="$define"
-               fi
-               $rm -f try.*
-               ;;
-       esac
-       if $test "X$val" = X"$define"; then
-               echo " Yup, it does." >&4
-       else
-               echo " Nope, it doesn't." >&4
-       fi
-       set d_ino64_t
-       eval $setvar
-
-       : check for struct flock64
-       echo " "
-       echo "Checking to see if your system supports struct flock64..." >&4
-       if $h_fcntl; then
-               set d_flock64_s flock64 l_len define fcntl.h
-               eval $hasfield
-       else
-               val="$undef"
-               set d_flock64_s
-               eval $setvar
-       fi
-       case "$d_flock64_s" in
-       "$define")      echo "Yup, it does." >&4
-                       ;;
-       *)              echo "Nope, it doesn't." >&4
-                       ;;
-       esac
-
-       : check for struct dirent64
-       echo " "
-       echo "Checking to see if your system supports struct dirent64..." >&4
-       set d_dirent64_s dirent64 d_off $i_dirent dirent.h
-       eval $hasfield
-       case "$d_dirent64_s" in
-       "$define")      echo "Yup, it does." >&4
-                       ;;
-       *)              echo "Nope, it doesn't." >&4
-                       ;;
-       esac
-
-else
-       val="$undef"
-       for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64_t d_offset_t d_ino64_t d_flock64_s d_dirent64_s
-       do
-               set $xxx
-               eval $setvar
-       done
-fi
-
 : see if dlerror exists
 xxx_runnm="$runnm"
 runnm=false
@@ -7543,6 +8199,7 @@ EOM
                esac
        else
                echo "I can't compile and run the test program." >&4
+                echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
        fi
        ;;
 esac
@@ -7662,6 +8319,28 @@ set d_open3
 eval $setvar
 $rm -f open3*
 
+: see which of string.h or strings.h is needed
+echo " "
+strings=`./findhdr string.h`
+if $test "$strings" && $test -r "$strings"; then
+       echo "Using <string.h> instead of <strings.h>." >&4
+       val="$define"
+else
+       val="$undef"
+       strings=`./findhdr strings.h`
+       if $test "$strings" && $test -r "$strings"; then
+               echo "Using <strings.h> instead of <string.h>." >&4
+       else
+               echo "No string header found -- You'll surely have problems." >&4
+       fi
+fi
+set i_string
+eval $setvar
+case "$i_string" in
+"$undef") strings=`./findhdr strings.h`;;
+*)       strings=`./findhdr string.h`;;
+esac
+
 : check for non-blocking I/O stuff
 case "$h_sysfile" in
 true) echo "#include <sys/file.h>" > head.c;;
@@ -7678,6 +8357,7 @@ case "$o_nonblock" in
 '')
        $cat head.c > try.c
        $cat >>try.c <<'EOCP'
+#include <stdio.h>
 int main() {
 #ifdef O_NONBLOCK
        printf("O_NONBLOCK\n");
@@ -7718,10 +8398,20 @@ case "$eagain" in
 #include <errno.h>
 #include <sys/types.h>
 #include <signal.h>
+#include <stdio.h> 
 #define MY_O_NONBLOCK $o_nonblock
 #ifndef errno  /* XXX need better Configure test */
 extern int errno;
 #endif
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+#ifdef $i_string
+#include <string.h>
+#else
+#include <strings.h>
+#endif
 $signal_t blech(x) int x; { exit(3); }
 EOCP
        $cat >> try.c <<'EOCP'
@@ -7818,38 +8508,139 @@ EOCP
                        val="$undef"
                fi
        else
-               echo "I can't compile the test program--assuming errno EAGAIN will do."
-               eagain=EAGAIN
+               echo "I can't compile the test program--assuming errno EAGAIN will do."
+               eagain=EAGAIN
+       fi
+       set d_eofnblk
+       eval $setvar
+       ;;
+*)
+       echo "Using $hint value $eagain."
+       echo "Your read() returns $rd_nodata when no data is present."
+       case "$d_eofnblk" in
+       "$define") echo "And you can see EOF because read() returns 0.";;
+       "$undef") echo "But you can't see EOF status from read() returned value.";;
+       *)
+               echo "(Assuming you can't see EOF status from read anyway.)"
+               d_eofnblk=$undef
+               ;;
+       esac
+       ;;
+esac
+$rm -f try try.* .out core head.c mtry
+
+: see if fchmod exists
+set fchmod d_fchmod
+eval $inlibc
+
+: see if fchown exists
+set fchown d_fchown
+eval $inlibc
+
+: see if this is an fcntl system
+set fcntl d_fcntl
+eval $inlibc
+
+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
-       set d_eofnblk
-       eval $setvar
-       ;;
-*)
-       echo "Using $hint value $eagain."
-       echo "Your read() returns $rd_nodata when no data is present."
-       case "$d_eofnblk" in
-       "$define") echo "And you can see EOF because read() returns 0.";;
-       "$undef") echo "But you can't see EOF status from read() returned value.";;
-       *)
-               echo "(Assuming you can't see EOF status from read anyway.)"
-               d_eofnblk=$undef
-               ;;
-       esac
-       ;;
-esac
-$rm -f try try.* .out core head.c mtry
+fi
 
-: see if fchmod exists
-set fchmod d_fchmod
+: see if socketpair exists
+set socketpair d_sockpair
 eval $inlibc
 
-: see if fchown exists
-set fchown d_fchown
-eval $inlibc
 
-: see if this is an fcntl system
-set fcntl d_fcntl
-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
@@ -8017,52 +8808,6 @@ $rm -f fd_set*
 set fgetpos d_fgetpos
 eval $inlibc
 
-
-if $test X"$use64bits" = X"$define"; then
-       : see if fgetpos64 exists
-       set fgetpos64 d_fgetpos64
-       eval $inlibc
-
-       : see if fopen64 exists
-       set freopen64 d_fopen64
-       eval $inlibc
-
-       : see if freopen64 exists
-       set freopen64 d_freopen64
-       eval $inlibc
-
-       : see if fseek64 exists
-       set fseek64 d_fseek64
-       eval $inlibc
-
-       : see if fseeko64 exists
-       set fseeko64 d_fseeko64
-       eval $inlibc
-
-       : see if fsetpos64 exists
-       set fsetpos64 d_fsetpos64
-       eval $inlibc
-
-       : see if ftell64 exists
-       set ftell64 d_ftell64
-       eval $inlibc
-
-       : see if ftello64 exists
-       set ftello64 d_ftello64
-       eval $inlibc
-
-       : see if tmpfile64 exists
-       set tmpfile64 d_tmpfile64
-       eval $inlibc
-else
-       val="$undef"
-       for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
-       do
-               set $xxx
-               eval $setvar
-       done
-fi
-
 : see if flock exists
 set flock d_flock
 eval $inlibc
@@ -8079,13 +8824,69 @@ eval $inlibc
 set fpathconf d_fpathconf
 eval $inlibc
 
-: see if fseeko exists
-set fseeko d_fseeko
-eval $inlibc
 
-: see if fsetpos exists
-set fsetpos d_fsetpos
-eval $inlibc
+: check for off64_t
+echo " "
+echo "Checking to see if your system supports off64_t..." >&4
+$cat >try.c <<EOCP
+#include <sys/types.h>
+#include <unistd.h>
+int main() { off64_t x = 7; }'
+EOCP
+set try
+if eval $compile; then
+       val="$define"
+       echo "Yes, it does."
+else
+       val="$undef"
+       echo "No, it doesn't."
+       case "$lseeksize" in
+       8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
+       esac
+fi
+$rm -f try.* try
+set d_off64_t
+eval $setvar
+
+: check for fpos64_t
+echo " "
+echo "Checking to see if your system supports fpos64_t..." >&4
+$cat >try.c <<EOCP
+#include <sys/stdio.h>
+int main() { fpos64_t x x = 7; }'
+EOCP
+set try
+if eval $compile; then
+       val="$define"
+       echo "Yes, it does."
+else
+       val="$undef"
+       echo "No, it doesn't."
+       case "$fpossize" in
+       8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
+       esac
+fi
+$rm -f try.* try
+set d_fpos64_t
+eval $setvar
+
+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
@@ -8095,19 +8896,36 @@ 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
+set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
+eval $hasstruct
+case "$d_fs_data_s" in
+"$define")      echo "Yes, it does."   ;;
+*)              echo "No, it doesn't." ;;
+esac
+
+: see if fseeko exists
+set fseeko d_fseeko
+eval $inlibc
+case "$longsize" in
+8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
+esac
 
-: see if statfs exists
-set statfs d_statfs
+: see if fsetpos exists
+set fsetpos d_fsetpos
 eval $inlibc
 
+
 : see if fstatfs exists
 set fstatfs d_fstatfs
 eval $inlibc
 
-: see if statfs knows about mount flags
-set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
-eval $hasfield
-
 
 : see if statvfs exists
 set statvfs d_statvfs
@@ -8121,6 +8939,9 @@ eval $inlibc
 : see if ftello exists
 set ftello d_ftello
 eval $inlibc
+case "$longsize" in
+8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
+esac
 
 : see if getgrent exists
 set getgrent d_getgrent
@@ -8236,6 +9057,10 @@ eval $hasproto
 set getlogin d_getlogin
 eval $inlibc
 
+: see if getmnt exists
+set getmnt d_getmnt
+eval $inlibc
+
 : see if getmntent exists
 set getmntent d_getmntent
 eval $inlibc
@@ -8415,28 +9240,6 @@ esac
 set d_htonl
 eval $setvar
 
-: see which of string.h or strings.h is needed
-echo " "
-strings=`./findhdr string.h`
-if $test "$strings" && $test -r "$strings"; then
-       echo "Using <string.h> instead of <strings.h>." >&4
-       val="$define"
-else
-       val="$undef"
-       strings=`./findhdr strings.h`
-       if $test "$strings" && $test -r "$strings"; then
-               echo "Using <strings.h> instead of <string.h>." >&4
-       else
-               echo "No string header found -- You'll surely have problems." >&4
-       fi
-fi
-set i_string
-eval $setvar
-case "$i_string" in
-"$undef") strings=`./findhdr strings.h`;;
-*)       strings=`./findhdr string.h`;;
-esac
-
 : index or strchr
 echo " "
 if set index val -f; eval $csym; $val; then
@@ -8465,65 +9268,14 @@ else
                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
-case "$use64bits" in
-"$define" )
-       echo " "
-       echo $n "Checking to see if your system supports int64_t...$c" >&4
-       $cat >try.c <<EOCP
-#include <sys/types.h>
-#$i_inttypes I_INTTYPES
-#ifdef I_INTTYPES
-#include <inttypes.h>
-#endif
-int64_t foo() { int64_t x; x = 7; return x; }
-EOCP
-       if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
-               val="$define"
-               echo " Yup, it does." >&4
-       else
-               val="$undef"
-               echo " Nope, it doesn't." >&4
-       fi
-       $rm -f try.*
-       ;;
-*)     val="$undef"
-       ;;
-esac
-set d_int64t
-eval $setvar
+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
 
 : Look for isascii
 echo " "
@@ -8586,6 +9338,33 @@ fi
 set d_lchown
 eval $setvar
 
+: See if number of significant digits in a double precision number is known
+echo " "
+$cat >ldbl_dig.c <<EOM
+#$i_limits I_LIMITS
+#$i_float I_FLOAT
+#ifdef I_LIMITS
+#include <limits.h>
+#endif
+#ifdef I_FLOAT
+#include <float.h>
+#endif
+#ifdef LDBL_DIG
+printf("Contains LDBL_DIG");
+#endif
+EOM
+$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
+if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
+       echo "LDBL_DIG found." >&4
+       val="$define"
+else
+       echo "LDBL_DIG NOT found." >&4
+       val="$undef"
+fi
+$rm -f ldbl_dig.?
+set d_ldbl_dig
+eval $setvar
+
 : see if link exists
 set link d_link
 eval $inlibc
@@ -8598,89 +9377,17 @@ eval $inlibc
 set lockf d_lockf
 eval $inlibc
 
-: check for length of double
-echo " "
-case "$doublesize" in
-'')
-       $echo $n "Checking to see how big your double precision numbers are...$c" >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-       printf("%d\n", sizeof(double));
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               doublesize=`./try`
-               $echo " $doublesize bytes." >&4
-       else
-               dflt='8'
-               echo "(I can't seem to compile the test program.  Guessing...)"
-               rp="What is the size of a double precision number (in bytes)?"
-               . ./myread
-               doublesize="$ans"
-       fi
-       ;;
-esac
-$rm -f try.c try
-
-: check for long doubles
-echo " "
-echo $n "Checking to see if your system supports long doubles...$c" >&4
-echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
-if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
-       val="$define"
-       echo " Yup, it does." >&4
-else
-       val="$undef"
-       echo " Nope, it doesn't." >&4
-fi
-$rm try.*
-set d_longdbl
-eval $setvar
-
-: check for length of long double
-case "${d_longdbl}${longdblsize}" in
-$define)
-       echo " "
-       $echo $n "Checking to see how big your long doubles are...$c" >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-       printf("%d\n", sizeof(long double));
-}
-EOCP
-       set try
-       if eval $compile; then
-               longdblsize=`./try`
-               $echo " $longdblsize bytes." >&4
-       else
-               dflt='8'
-               echo " "
-               echo "(I can't seem to compile the test program.  Guessing...)" >&4
-               rp="What is the size of a long double (in bytes)?"
-               . ./myread
-               longdblsize="$ans"
-       fi
-       if $test "X$doublesize" = "X$longdblsize"; then
-               echo "(That isn't any different from an ordinary double.)"
-       fi      
-       ;;
-esac
-$rm -f try.c try
-
 : check for long long
 echo " "
-echo $n "Checking to see if your system supports long long...$c" >&4
-echo 'long long foo() { long long x; x = 7; return x; }' > try.c
-if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
+$echo $n "Checking to see if your system supports long long..." $c >&4
+echo 'int main() { long long x = 7; return 0; }' > try.c
+set try
+if eval $compile; then
        val="$define"
-       echo " Yup, it does." >&4
+       echo " Yes, it does." >&4
 else
        val="$undef"
-       echo " Nope, it doesn't." >&4
+       echo " No, it doesn't." >&4
 fi
 $rm try.*
 set d_longlong
@@ -8690,17 +9397,18 @@ eval $setvar
 case "${d_longlong}${longlongsize}" in
 $define)
        echo " "
-       $echo $n "Checking to see how big your long longs are...$c" >&4
+       $echo $n "Checking to see how big your long longs are..." $c >&4
        $cat >try.c <<'EOCP'
 #include <stdio.h>
 int main()
 {
-       printf("%d\n", sizeof(long long));
+    printf("%d\n", (int)sizeof(long long));
+    return(0);
 }
 EOCP
        set try
        if eval $compile_ok; then
-               longlongsize=`./try`
+               longlongsize=`./try$exe_ext`
                $echo " $longlongsize bytes." >&4
        else
                dflt='8'
@@ -8715,16 +9423,12 @@ EOCP
        fi      
        ;;
 esac
-$rm -f try.c try
+$rm -f try.* try
 
 : see if lstat exists
 set lstat d_lstat
 eval $inlibc
 
-: see if madvise exists
-set madvise d_madvise
-eval $inlibc
-
 : see if mblen exists
 set mblen d_mblen
 eval $inlibc
@@ -8769,37 +9473,6 @@ eval $inlibc
 set mktime d_mktime
 eval $inlibc
 
-: see if this is a sys/mman.h system
-set sys/mman.h i_sysmman
-eval $inhdr
-
-: see if mmap exists
-set mmap d_mmap
-eval $inlibc
-: see what shmat returns
-: default to something harmless
-mmaptype='void *'
-case "$i_sysmman$d_mmap" in
-"$define$define")
-       $cat >mmap.c <<'END'
-#include <sys/mman.h>
-void *mmap();
-END
-       if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
-               mmaptype='void *'
-       else
-               mmaptype='caddr_t'
-       fi
-       echo "and it returns ($mmaptype)." >&4
-       ;;
-esac
-
-
-
-: see if mprotect exists
-set mprotect d_mprotect
-eval $inlibc
-
 : see if msgctl exists
 set msgctl d_msgctl
 eval $inlibc
@@ -8852,25 +9525,14 @@ fi
 set d_msg
 eval $setvar
 
-: see if msync exists
-set msync d_msync
-eval $inlibc
-
-: see if munmap exists
-set munmap d_munmap
-eval $inlibc
-
 : see if nice exists
 set nice d_nice
 eval $inlibc
 
 : see if POSIX threads are available
-if test "X$usethreads" = "X$define"; then
-       set pthread.h i_pthread
-       eval $inhdr
-else
-       i_pthread="$undef"
-fi
+set pthread.h i_pthread
+eval $inhdr
+
 
 
 
@@ -9102,6 +9764,119 @@ $define)
        ;;
 esac
 
+: 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 $n "Checking to see if your system supports int64_t...$c" >&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 " Yes, it does." >&4
+else
+       val="$undef"
+       echo " No, it doesn't." >&4
+fi
+$rm -f try try.*
+set d_int64t
+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 "$uselonglong:$d_longlong:$longlongsize" in
+      define:define:8)
+        val='"long long"'
+        set quadtype
+        eval $setvar
+        val='"unsigned long long"'
+        set uquadtype
+        eval $setvar
+        quadkind=3
+        ;;
+      *) case "$d_int64t" 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
+'')    case "$uselonglong:$d_longlong:$longlongsize" in
+       undef:define:8)
+          echo "(You would have 'long long', but you are not using it.)" >&4 ;;
+       *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
+       esac
+       d_quad="$undef"
+       ;;
+*)     if test X"$use64bits" = 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
+
 : see if readdir and friends exist
 set readdir d_readdir
 eval $inlibc
@@ -9116,10 +9891,6 @@ eval $inlibc
 set readlink d_readlink
 eval $inlibc
 
-: see if readv exists
-set readv d_readv
-eval $inlibc
-
 : see if rename exists
 set rename d_rename
 eval $inlibc
@@ -9826,6 +10597,10 @@ if set sigaction val -f d_sigaction; eval $csym; $val; then
 int main()
 {
     struct sigaction act, oact;
+    act.sa_flags = 0;
+    oact.sa_handler = 0;
+    /* so that act and oact are used */
+    exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
 }
 EOP
        set try
@@ -9887,11 +10662,61 @@ set d_sigsetjmp
 eval $setvar
 $rm -f try.c try
 
+: see if sqrtl exists
+set sqrtl d_sqrtl
+eval $inlibc
+
+: see if sys/stat.h is available
+set sys/stat.h i_sysstat
+eval $inhdr
+
+
 : see if stat knows about block sizes
 echo " "
+echo "Checking to see if your struct stat has st_blocks field..." >&4
 set d_statblks stat st_blocks $i_sysstat sys/stat.h
 eval $hasfield
 
+
+: see if this is a sys/vfs.h system
+set sys/vfs.h i_sysvfs
+eval $inhdr
+
+
+: see if this is a sys/statfs.h system
+set sys/statfs.h i_sysstatfs
+eval $inhdr
+
+
+echo " "
+echo "Checking to see if your system supports struct statfs..." >&4
+set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
+eval $hasstruct
+case "$d_statfs_s" in
+"$define")      echo "Yes, it does."   ;;
+*)              echo "No, it doesn't." ;;
+esac
+
+
+
+: see if struct statfs knows about f_flags
+case "$d_statfs_s" in
+define)        
+       echo " "
+       echo "Checking to see if your struct statfs has f_flags field..." >&4
+       set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
+       eval $hasfield
+       ;;
+*)     val="$undef"
+       set d_statfs_f_flags
+       eval $setvar
+       ;;
+esac
+case "$d_statfs_f_flags" in
+"$define")      echo "Yes, it does."   ;;
+*)              echo "No, it doesn't." ;;
+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
@@ -10129,10 +10954,22 @@ eval $inlibc
 set strtol d_strtol
 eval $inlibc
 
+: see if strtold exists
+set strtold d_strtold
+eval $inlibc
+
 : see if strtoul exists
 set strtoul d_strtoul
 eval $inlibc
 
+: see if strtoull exists
+set strtoull d_strtoull
+eval $inlibc
+
+: see if strtouq exists
+set strtouq d_strtouq
+eval $inlibc
+
 : see if strxfrm exists
 set strxfrm d_strxfrm
 eval $inlibc
@@ -10149,82 +10986,22 @@ eval $inlibc
 set sysconf d_sysconf
 eval $inlibc
 
-: see if system exists
-set system d_system
-eval $inlibc
-
-: see if tcgetpgrp exists
-set tcgetpgrp d_tcgetpgrp
-eval $inlibc
-
-: see if tcsetpgrp exists
-set tcsetpgrp d_tcsetpgrp
-eval $inlibc
-
-: see if sys/types.h has to be included
-set sys/types.h i_systypes
-eval $inhdr
-
-: see if prototype for telldir is available
-echo " "
-set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
-eval $hasproto
-
-: define an is-a-typedef? function
-typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
-case "$inclist" in
-"") inclist="sys/types.h";;
-esac;
-eval "varval=\$$var";
-case "$varval" in
-"")
-       $rm -f temp.c;
-       for inc in $inclist; do
-               echo "#include <$inc>" >>temp.c;
-       done;
-       echo "#ifdef $type" >> temp.c;
-       echo "printf(\"We have $type\");" >> temp.c;
-       echo "#endif" >> temp.c;
-       $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
-       if $contains $type temp.E >/dev/null 2>&1; then
-               eval "$var=\$type";
-       else
-               eval "$var=\$def";
-       fi;
-       $rm -f temp.?;;
-*) eval "$var=\$varval";;
-esac'
+: see if system exists
+set system d_system
+eval $inlibc
 
-: define an is-a-typedef? function that prompts if the type is not available.
-typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
-case "$inclist" in
-"") inclist="sys/types.h";;
-esac;
-eval "varval=\$$var";
-case "$varval" in
-"")
-       $rm -f temp.c;
-       for inc in $inclist; do
-               echo "#include <$inc>" >>temp.c;
-       done;
-       echo "#ifdef $type" >> temp.c;
-       echo "printf(\"We have $type\");" >> temp.c;
-       echo "#endif" >> temp.c;
-       $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
-       echo " " ;
-       echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
-       if $contains $type temp.E >/dev/null 2>&1; then
-               echo "$type found." >&4;
-               eval "$var=\$type";
-       else
-               echo "$type NOT found." >&4;
-               dflt="$def";
-               . ./myread ;
-               eval "$var=\$ans";
-       fi;
-       $rm -f temp.?;;
-*) eval "$var=\$varval";;
-esac'
+: see if tcgetpgrp exists
+set tcgetpgrp d_tcgetpgrp
+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
@@ -10268,6 +11045,10 @@ eval $setvar
 set umask d_umask
 eval $inlibc
 
+: see if ustat exists
+set ustat d_ustat
+eval $inlibc
+
 : backward compatibility for d_hvfork
 if test X$d_hvfork != X; then
        d_vfork="$d_hvfork"
@@ -10427,10 +11208,6 @@ 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'
@@ -10466,13 +11243,15 @@ EOM
        case "$alignbytes" in
        '') echo "Checking alignment constraints..." >&4
                $cat >try.c <<'EOCP'
+#include <stdio.h>
 struct foobar {
        char foo;
        double bar;
 } try_algn;
 int main()
 {
-       printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
+    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
+    return(0);
 }
 EOCP
                set try
@@ -10503,7 +11282,7 @@ You seem to be either cross-compiling or doing a multiarchitecture build,
 skipping the byteorder check.
 
 EOM
-       byteorder=''
+       byteorder='0xffff'
        ;;
 *)
        case "$byteorder" in
@@ -10512,8 +11291,9 @@ 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. If
-the test program works the default is probably right.
+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'
@@ -10659,7 +11439,7 @@ int main()
 }
 EOCP
        set try
-       if eval $compile && ./try; then
+       if eval $compile_ok && ./try; then
                echo 'Looks OK.' >&4
        else
                echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
@@ -11010,7 +11790,7 @@ if eval $compile_ok; then
                echo "You have EBCDIC." >&4
                val="$define"
        else
-               echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin." >&4
+               echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
        fi
 else
        echo "I'm unable to compile the test program." >&4
@@ -11181,74 +11961,581 @@ Whew. Flushing explicitly all the stdio streams works.
 EOM
                        fflushall="$define"
                        ;;
-               '')     $cat >&4 <<EOM
-Sigh. Flushing explicitly all the stdio streams doesn't work.
-EOM
-                       fflushall="$undef"
+               '')     $cat >&4 <<EOM
+Sigh. Flushing explicitly all the stdio streams doesn't work.
+EOM
+                       fflushall="$undef"
+                       ;;
+               *)      $cat >&4 <<EOM
+Cannot figure out whether flushing stdio streams explicitly works or not.
+I'm assuming it doesn't.
+EOM
+                       fflushall="$undef"
+                       ;;
+               esac
+               ;;
+       "$define"|true|[yY]*)
+               fflushall="$define"
+               ;;
+       *)
+               fflushall="$undef"
+               ;;
+       esac
+       ;;
+*)     fflushall="$undef"      
+       ;;
+esac
+case "$fflushNULL$fflushall" in
+undefundef)
+       $cat <<EOM
+I cannot figure out how to flush pending stdio output.
+EOM
+       ;;
+esac
+$rm -f try.* try$exe_ext
+
+: Store the full pathname to the ar program for use in the C program
+: Respect a hint or command line value for full_ar.
+case "$full_ar" in
+'') full_ar=$ar ;;
+esac
+
+: Store the full pathname to the sed program for use in the C program
+full_sed=$sed
+
+: see what type gids are declared as in the kernel
+echo " "
+echo "Looking for the type for group ids returned by getgid()."
+set gid_t gidtype xxx stdio.h sys/types.h
+eval $typedef
+case "$gidtype" in
+xxx)
+       xxx=`./findhdr sys/user.h`
+       set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
+       case $1 in
+       unsigned) dflt="$1 $2" ;;
+       *) dflt="$1" ;;
+       esac
+       ;;
+*) dflt="$gidtype";;
+esac
+case "$gidtype" in
+gid_t) echo "gid_t found." ;;
+*)     rp="What is the type for group ids returned by getgid()?"
+       . ./myread
+       gidtype="$ans"
+       ;;
+esac
+
+echo " "
+case "$gidtype" in
+*_t) zzz="$gidtype"    ;;
+*)   zzz="gid"         ;;
+esac
+echo "Checking the size of $zzz..." >&4 
+cat > try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+    printf("%d\n", (int)sizeof($gidtype));
+    exit(0);
+}
+EOCP
+set try
+if eval $compile_ok; then
+       yyy=`./try`
+       case "$yyy" in
+       '')     gidsize=4
+               echo "(I can't execute the test program--guessing $gidsize.)" >&4
+               ;;
+       *)      gidsize=$yyy
+               echo "Your $zzz size is $gidsize bytes."
+               ;;
+       esac
+else
+       gidsize=4
+       echo "(I can't compile the test program--guessing $gidsize.)" >&4
+fi
+
+
+echo " "
+case "$gidtype" in
+*_t) zzz="$gidtype"    ;;
+*)   zzz="gid"         ;;
+esac
+echo "Checking the sign of $zzz..." >&4 
+cat > try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+       $gidtype foo = -1;
+       if (foo < 0)
+               printf("-1\n");
+       else
+               printf("1\n");
+}
+EOCP
+set try
+if eval $compile; then
+       yyy=`./try`
+       case "$yyy" in
+       '')     gidsign=1
+               echo "(I can't execute the test program--guessing unsigned.)" >&4
+               ;;
+       *)      gidsign=$yyy
+               case "$gidsign" in
+                1) echo "Your $zzz is unsigned." ;;
+               -1) echo "Your $zzz is signed."   ;;
+               esac
+               ;;
+       esac
+else
+       gidsign=1
+       echo "(I can't compile the test program--guessing unsigned.)" >&4
+fi
+
+
+: check for length of character
+echo " "
+case "$charsize" in
+'')
+       echo "Checking to see how big your characters are (hey, you never know)..." >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof(char));
+    exit(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               dflt=`./try`
+       else
+               dflt='1'
+               echo "(I can't seem to compile the test program.  Guessing...)"
+       fi
+       ;;
+*)
+       dflt="$charsize"
+       ;;
+esac
+rp="What is the size of a character (in bytes)?"
+. ./myread
+charsize="$ans"
+$rm -f try.c try
+
+
+echo " "
+$echo "Choosing the C types to be used for Perl's internal types..." >&4
+
+case "$use64bits:$d_quad:$quadtype" in
+define:define:?*)
+       ivtype="$quadtype"
+       uvtype="$uquadtype"
+       ivsize=8
+       uvsize=8
+       ;;
+*)     ivtype="long"
+       uvtype="unsigned long"
+       ivsize=$longsize
+       uvsize=$longsize
+       ;;
+esac
+
+case "$uselongdouble:$d_longdbl" in
+define:define)
+       nvtype="long double"
+       nvsize=$longdblsize
+       ;;
+*)     nvtype=double
+       nvsize=$doublesize
+       ;;
+esac
+
+echo "(IV will be "$ivtype", $ivsize bytes)"
+echo "(UV will be "$uvtype", $uvsize bytes)"
+echo "(NV will be "$nvtype", $nvsize bytes)"
+
+$cat >try.c <<EOCP
+#$i_inttypes I_INTTYPES
+#ifdef I_INTTYPES
+#include <inttypes.h>
+#endif
+#include <stdio.h>
+int main() {
+#ifdef INT8
+   int8_t i =  INT8_MAX;
+  uint8_t u = UINT8_MAX;
+  printf("int8_t\n");
+#endif
+#ifdef INT16
+   int16_t i =  INT16_MAX;
+  uint16_t i = UINT16_MAX;
+  printf("int16_t\n");
+#endif
+#ifdef INT32
+   int32_t i =  INT32_MAX;
+  uint32_t u = UINT32_MAX;
+  printf("int32_t\n");
+#endif
+}
+EOCP
+
+case "$i8type" in
+'')    case "$charsize" in
+       1)      i8type=char
+               u8type="unsigned char"
+               i8size=$charsize
+               u8size=$charsize
+               ;;
+       esac
+       ;;
+esac
+case "$i8type" in
+'')    set try -DINT8
+       if eval $compile; then
+               case "`./try$exe_ext`" in
+               int8_t) i8type=int8_t
+                       u8type=uint8_t
+                       i8size=1
+                       u8size=1
+                       ;;
+               esac
+       fi
+       ;;
+esac
+case "$i8type" in
+'')    if $test $charsize -ge 1; then
+               i8type=char
+               u8type="unsigned char"
+               i8size=$charsize
+               u8size=$charsize
+       fi
+       ;;
+esac
+
+case "$i16type" in
+'')    case "$shortsize" in
+       2)      i16type=short
+               u16type="unsigned short"
+               i16size=$shortsize
+               u16size=$shortsize
+               ;;
+       esac
+       ;;
+esac
+case "$i16type" in
+'')    set try -DINT16
+       if eval $compile; then
+               case "`./try$exe_ext`" in
+               int16_t)
+                       i16type=int16_t
+                       u16type=uint16_t
+                       i16size=2
+                       u16size=2
+                       ;;
+               esac
+       fi
+       ;;
+esac
+case "$i16type" in
+'')    if $test $shortsize -ge 2; then
+               i16type=short
+               u16type="unsigned short"
+               i16size=$shortsize
+               u16size=$shortsize
+       fi
+       ;;
+esac
+
+case "$i32type" in
+'')    case "$longsize" in
+       4)      i32type=long
+               u32type="unsigned long"
+               i32size=$longsize
+               u32size=$longsize
+               ;;
+       *)      case "$intsize" in
+               4)      i32type=int
+                       u32type="unsigned int"
+                       i32size=$intsize
+                       u32size=$intsize
+                       ;;
+               esac
+               ;;
+       esac
+       ;;
+esac
+case "$i32type" in
+'')    set try -DINT32
+       if eval $compile; then
+               case "`./try$exe_ext`" in
+               int32_t)
+                       i32type=int32_t
+                       u32type=uint32_t
+                       i32size=4
+                       u32size=4
+                       ;;
+               esac
+       fi
+       ;;
+esac
+case "$i32type" in
+'')    if $test $intsize -ge 4; then
+               i32type=int
+               u32type="unsigned int"
+               i32size=$intsize
+               u32size=$intsize
+       fi
+       ;;
+esac
+
+case "$i64type" in
+'')    case "$d_quad:$quadtype" in
+       define:?*)
+               i64type="$quadtype"
+               u64type="$uquadtype"
+               i64size=8
+               u64size=8
+               ;;
+       esac
+       ;;
+esac
+
+$rm -f try.* try
+
+echo " "
+
+if $test X"$quadtype" != X; then
+
+echo "Checking how to print 64-bit integers..." >&4
+
+if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  int q = 12345678901;
+  printf("%ld\n", q);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               12345678901)
+                       sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
+                       sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
+                       echo "We will use %d."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  long q = 12345678901;
+  printf("%ld\n", q);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               12345678901)
+                       sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
+                       sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
+                       echo "We will use %ld."
                        ;;
-               *)      $cat >&4 <<EOM
-Cannot figure out whether flushing stdio streams explicitly works or not.
-I'm assuming it doesn't.
-EOM
-                       fflushall="$undef"
+               esac
+       fi
+fi
+
+if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <inttypes.h>
+#include <stdio.h>
+int main() {
+  int64_t q = 12345678901;
+  printf("%" PRId64 "\n", q);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               12345678901)
+                       sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
+                       sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
+                       echo "We will use the C9X style."
                        ;;
                esac
-               ;;
-       "$define"|true|[yY]*)
-               fflushall="$define"
-               ;;
-       *)
-               fflushall="$undef"
-               ;;
-       esac
-       ;;
-*)     fflushall="$undef"      
+       fi
+fi
+
+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() {
+  long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
+  printf("%lld\n", q);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               12345678901)
+                       sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
+                       sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
+                       echo "We will use the %lld style."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRId64" = X -a X"$quadtype" != X; then
+       $cat >try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  $quadtype q = 12345678901;
+  printf("%Ld\n", q);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               12345678901)
+                       sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
+                       sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
+                       echo "We will use %Ld."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRId64" = X -a X"$quadtype" != X; then
+       $cat >try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  $quadtype q = 12345678901;
+  printf("%qd\n", q);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               12345678901)
+                       sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
+                       sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
+                       echo "We will use %qd."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRId64" = X; then
+       echo "Cannot figure out how to print 64-bit integers." >&4
+fi
+
+$rm -f try try.*
+
+fi
+
+case "$sPRId64" in
+'')    d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
+       d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
        ;;
-esac
-case "$fflushNULL$fflushall" in
-undefundef)
-       $cat <<EOM
-I cannot figure out how to flush pending stdio output.
-EOM
+*)     d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
+       d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
        ;;
 esac
-$rm -f try.* try$exe_ext
 
-: see what type file positions are declared as in the library
-rp="What is the type for file position used by fsetpos()?"
-set fpos_t fpostype long stdio.h sys/types.h
-eval $typedef_ask
 
-: Store the full pathname to the ar program for use in the C program
-: Respect a hint or command line value for full_ar.
-case "$full_ar" in
-'') full_ar=$ar ;;
+echo " "
+$echo "Checking the format strings to be used for Perl's internal types..." >&4
+
+if $test X"$ivsize" = X8; then
+       ivdformat="$sPRId64"
+       uvuformat="$sPRIu64"
+       uvoformat="$sPRIo64"
+       uvxformat="$sPRIx64"
+else
+       if $test X"$ivsize" = X"$longsize"; then
+               ivdformat='"ld"'
+               uvuformat='"lu"'
+               uvoformat='"lo"'
+               uvxformat='"lx"'
+       else
+               if $test X"$ivsize" = X"$intsize"; then
+                       ivdformat='"d"'
+                       uvuformat='"u"'
+                       uvoformat='"o"'
+                       uvxformat='"x"'
+               else
+                       : far out
+                       if $test X"$ivsize" = X"$shortsize"; then
+                               ivdformat='"hd"'
+                               uvuformat='"hu"'
+                               uvoformat='"ho"'
+                               uvxformat='"hx"'
+                       fi
+               fi
+       fi
+fi
+
+case "$ivdformat" in
+'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
+    exit 1
+    ;;
 esac
 
-: Store the full pathname to the sed program for use in the C program
-full_sed=$sed
 
-: see what type gids are declared as in the kernel
 echo " "
-echo "Looking for the type for group ids returned by getgid()."
-set gid_t gidtype xxx stdio.h sys/types.h
-eval $typedef
-case "$gidtype" in
-xxx)
-       xxx=`./findhdr sys/user.h`
-       set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
-       case $1 in
-       unsigned) dflt="$1 $2" ;;
-       *) dflt="$1" ;;
-       esac
+$echo "Checking the format string to be used for gids..." >&4
+
+case "$gidsign" in
+-1)    if $test X"$gidsize" = X"$ivsize"; then
+               gidformat="$ivdformat"
+       else
+               if $test X"$gidsize" = X"$longsize"; then
+                       gidformat='"ld"'
+               else
+                       if $test X"$gidsize" = X"$intsize"; then
+                               gidformat='"d"'
+                       else
+                               if $test X"$gidsize" = X"$shortsize"; then
+                                       gidformat='"hd"'
+                               fi
+                       fi
+               fi
+       fi
        ;;
-*) dflt="$gidtype";;
-esac
-case "$gidtype" in
-gid_t) echo "gid_t found." ;;
-*)     rp="What is the type for group ids returned by getgid()?"
-       . ./myread
-       gidtype="$ans"
+*)     if $test X"$gidsize" = X"$uvsize"; then
+               gidformat="$uvuformat"
+       else
+               if $test X"$gidsize" = X"$longsize"; then
+                       gidformat='"lu"'
+               else
+                       if $test X"$gidsize" = X"$intsize"; then
+                               gidformat='"u"'
+                       else
+                               if $test X"$gidsize" = X"$shortsize"; then
+                                       gidformat='"hu"'
+                               fi
+                       fi
+               fi
+       fi
        ;;
 esac
 
@@ -11281,35 +12568,6 @@ EOM
 *)  groupstype="$gidtype";;
 esac
 
-: see what type lseek is declared as in the kernel
-rp="What is the type used for lseek's offset on this system?"
-set off_t lseektype long stdio.h sys/types.h
-eval $typedef_ask
-
-echo " "
-$echo $n "Checking to see how big your file offsets are...$c" >&4
-$cat >try.c <<EOCP
-#include <sys/types.h>
-#include <stdio.h>
-int main()
-{
-       printf("%d\n", sizeof($lseektype));
-}
-EOCP
-set try
-if eval $compile_ok; then
-       lseeksize=`./try`
-       $echo " $lseeksize bytes." >&4
-else
-       dflt='4'
-       echo " "
-       echo "(I can't seem to compile the test program.  Guessing...)"
-       rp="What is the size of your file offsets (in bytes)?"
-       . ./myread
-       lseeksize="$ans"
-fi
-$rm -f try.c try
-
 echo " "
 echo "Checking if your $make program sets \$(MAKE)..." >&4
 case "$make_set_make" in
@@ -11552,8 +12810,8 @@ case "$ptrsize" in
 #include <stdio.h>
 int main()
 {
-       printf("%d\n", sizeof(VOID_PTR));
-       exit(0);
+    printf("%d\n", (int)sizeof(VOID_PTR));
+    exit(0);
 }
 EOCP
        set try
@@ -11766,10 +13024,16 @@ esac
 : Remove SIGSTKSIZE used by Linux.
 : Remove SIGSTKSZ used by Posix.
 : Remove SIGTYP void lines used by OS2.
-xxx=`echo '#include <signal.h>' |
+: Some cpps, like os390, dont give the file name anywhere
+if [ "X$fieldn" = X ]; then
+       : Just make some guesses.  We check them later.
+       xxx='/usr/include/signal.h /usr/include/sys/signal.h'
+else
+       xxx=`echo '#include <signal.h>' |
        $cppstdin $cppminus $cppflags 2>/dev/null |
        $grep '^[       ]*#.*include' | 
        $awk "{print \\$$fieldn}" | $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 
 : as ../foo/bar.h
@@ -11789,10 +13053,12 @@ $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ &&
        print substr($3, 4, 20)
 }' $xxxfiles`
 : Append some common names just in case the awk scan failed.
-xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
-xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
-xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
-xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
+xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
+xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
+xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
+xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
+xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
+
 : generate a few handy files for later
 $cat > signal.c <<'EOCP'
 #include <sys/types.h>
@@ -11865,7 +13131,7 @@ echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
 }
 END {
        printf "#endif /* JUST_NSIG */\n";
-       printf "}\n";
+       printf "exit(0);\n}\n";
 }
 ' >>signal.c
 $cat >signal.awk <<'EOP'
@@ -12107,6 +13373,112 @@ uid_t)        echo "uid_t found." ;;
        ;;
 esac
 
+echo " "
+case "$uidtype" in
+*_t) zzz="$uidtype"    ;;
+*)   zzz="uid"         ;;
+esac
+echo "Checking the size of $zzz..." >&4 
+cat > try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+    printf("%d\n", (int)sizeof($uidtype));
+    exit(0);
+}
+EOCP
+set try
+if eval $compile_ok; then
+       yyy=`./try`
+       case "$yyy" in
+       '')     uidsize=4
+               echo "(I can't execute the test program--guessing $uidsize.)" >&4
+               ;;
+       *)      uidsize=$yyy
+               echo "Your $zzz size is $uidsize bytes."
+               ;;
+       esac
+else
+       uidsize=4
+       echo "(I can't compile the test program--guessing $uidsize.)" >&4
+fi
+
+echo " "
+case "$uidtype" in
+*_t) zzz="$uidtype"    ;;
+*)   zzz="uid"         ;;
+esac
+echo "Checking the sign of $zzz..." >&4
+cat > try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+       $uidtype foo = -1;
+       if (foo < 0)
+               printf("-1\n");
+       else
+               printf("1\n");
+}
+EOCP
+set try
+if eval $compile; then
+       yyy=`./try`
+       case "$yyy" in
+       '')     uidsign=1
+               echo "(I can't execute the test program--guessing unsigned.)" >&4
+               ;;
+       *)      uidsign=$yyy
+               case "$uidsign" in
+                1) echo "Your $zzz is unsigned." ;;
+               -1) echo "Your $zzz is signed."   ;;
+               esac
+               ;;
+       esac
+else
+       uidsign=1
+       echo "(I can't compile the test program--guessing unsigned.)" >&4
+fi
+
+
+
+echo " "
+$echo "Checking the format string to be used for uids..." >&4
+
+case "$uidsign" in
+-1)    if $test X"$uidsize" = X"$ivsize"; then
+               uidformat="$ivdformat"
+       else
+               if $test X"$uidsize" = X"$longsize"; then
+                       uidformat='"ld"'
+               else
+                       if $test X"$uidsize" = X"$intsize"; then
+                               uidformat='"d"'
+                       else
+                               if $test X"$uidsize" = X"$shortsize"; then
+                                       uidformat='"hd"'
+                               fi
+                       fi
+               fi
+       fi
+       ;;
+*)     if $test X"$uidsize" = X"$uvsize"; then
+               uidformat="$uvuformat"
+       else
+               if $test X"$uidsize" = X"$longsize"; then
+                       uidformat='"lu"'
+               else
+                       if $test X"$uidsize" = X"$intsize"; then
+                               uidformat='"u"'
+                       else
+                               if $test X"$uidsize" = X"$shortsize"; then
+                                       uidformat='"hu"'
+                               fi
+                       fi
+               fi
+       fi
+       ;;
+esac
+
 : see if dbm.h is available
 : see if dbmclose exists
 set dbmclose d_dbmclose
@@ -12598,6 +13970,10 @@ 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
@@ -12606,6 +13982,10 @@ eval $inhdr
 set sys/wait.h i_syswait
 eval $inhdr
 
+: see if this is a ustat.h system
+set ustat.h i_ustat
+eval $inhdr
+
 : see if this is an utime system
 set utime.h i_utime
 eval $inhdr
@@ -12674,14 +14054,14 @@ find_extensions='
                    eval $find_extensions;
                    cd ..;
                    shift;
-               fi
+               fi;
            fi
            ;;
-       esac
+       esac;
     done'
 tdir=`pwd`
 cd $rsrc/ext
-set
+set X
 shift
 eval $find_extensions
 set X $nonxs_extensions
@@ -12920,9 +14300,8 @@ case "$d_portable" in
        echo " "
        echo "Stripping down executable paths..." >&4
        for file in $loclist $trylist; do
-               if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
-                       eval $file="\$file"
-               fi
+               eval temp=\$$file
+               eval $file=`basename $temp`
        done
        ;;
 esac
@@ -12963,7 +14342,10 @@ afs='$afs'
 alignbytes='$alignbytes'
 ansi2knr='$ansi2knr'
 aphostname='$aphostname'
-apiversion='$apiversion'
+api_revision='$api_revision'
+api_subversion='$api_subversion'
+api_version='$api_version'
+api_versionstring='$api_versionstring'
 ar='$ar'
 archlib='$archlib'
 archlibexp='$archlibexp'
@@ -12974,6 +14356,7 @@ awk='$awk'
 baserev='$baserev'
 bash='$bash'
 bin='$bin'
+bincompat5005='$bincompat5005'
 binexp='$binexp'
 bison='$bison'
 byacc='$byacc'
@@ -12989,6 +14372,7 @@ ccsymbols='$ccsymbols'
 cf_by='$cf_by'
 cf_email='$cf_email'
 cf_time='$cf_time'
+charsize='$charsize'
 chgrp='$chgrp'
 chmod='$chmod'
 chown='$chown'
@@ -13011,13 +14395,28 @@ crosscompile='$crosscompile'
 cryptlib='$cryptlib'
 csh='$csh'
 d_Gconvert='$d_Gconvert'
+d_PRIEldbl='$d_PRIEldbl'
+d_PRIFldbl='$d_PRIFldbl'
+d_PRIGldbl='$d_PRIGldbl'
+d_PRIX64='$d_PRIX64'
+d_PRId64='$d_PRId64'
+d_PRIeldbl='$d_PRIeldbl'
+d_PRIfldbl='$d_PRIfldbl'
+d_PRIgldbl='$d_PRIgldbl'
+d_PRIi64='$d_PRIi64'
+d_PRIo64='$d_PRIo64'
+d_PRIu64='$d_PRIu64'
+d_PRIx64='$d_PRIx64'
 d_access='$d_access'
 d_accessx='$d_accessx'
 d_alarm='$d_alarm'
 d_archlib='$d_archlib'
+d_atolf='$d_atolf'
+d_atoll='$d_atoll'
 d_attribut='$d_attribut'
 d_bcmp='$d_bcmp'
 d_bcopy='$d_bcopy'
+d_bincompat5005='$d_bincompat5005'
 d_bsd='$d_bsd'
 d_bsdgetpgrp='$d_bsdgetpgrp'
 d_bsdsetpgrp='$d_bsdsetpgrp'
@@ -13029,17 +14428,12 @@ 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_dbmclose64='$d_dbmclose64'
-d_dbminit64='$d_dbminit64'
-d_delete64='$d_delete64'
 d_difftime='$d_difftime'
-d_dirent64_s='$d_dirent64_s'
 d_dirnamlen='$d_dirnamlen'
 d_dlerror='$d_dlerror'
 d_dlopen='$d_dlopen'
@@ -13063,30 +14457,19 @@ d_fcntl='$d_fcntl'
 d_fd_macros='$d_fd_macros'
 d_fd_set='$d_fd_set'
 d_fds_bits='$d_fds_bits'
-d_fetch64='$d_fetch64'
-d_fgetpos64='$d_fgetpos64'
 d_fgetpos='$d_fgetpos'
-d_firstkey64='$d_firstkey64'
 d_flexfnam='$d_flexfnam'
-d_flock64_s='$d_flock64_s'
 d_flock='$d_flock'
-d_fopen64='$d_fopen64'
 d_fork='$d_fork'
 d_fpathconf='$d_fpathconf'
-d_freopen64='$d_freopen64'
-d_fseek64='$d_fseek64'
-d_fseeko64='$d_fseeko64'
+d_fpos64_t='$d_fpos64_t'
+d_fs_data_s='$d_fs_data_s'
 d_fseeko='$d_fseeko'
-d_fsetpos64='$d_fsetpos64'
 d_fsetpos='$d_fsetpos'
-d_fstat64='$d_fstat64'
 d_fstatfs='$d_fstatfs'
 d_fstatvfs='$d_fstatvfs'
-d_ftell64='$d_ftell64'
-d_ftello64='$d_ftello64'
 d_ftello='$d_ftello'
 d_ftime='$d_ftime'
-d_ftruncate64='$d_ftruncate64'
 d_getgrent='$d_getgrent'
 d_getgrps='$d_getgrps'
 d_gethbyaddr='$d_gethbyaddr'
@@ -13095,6 +14478,7 @@ d_gethent='$d_gethent'
 d_gethname='$d_gethname'
 d_gethostprotos='$d_gethostprotos'
 d_getlogin='$d_getlogin'
+d_getmnt='$d_getmnt'
 d_getmntent='$d_getmntent'
 d_getnbyaddr='$d_getnbyaddr'
 d_getnbyname='$d_getnbyname'
@@ -13123,23 +14507,17 @@ d_hasmntopt='$d_hasmntopt'
 d_htonl='$d_htonl'
 d_index='$d_index'
 d_inetaton='$d_inetaton'
-d_ino64_t='$d_ino64_t'
 d_int64t='$d_int64t'
-d_iovec_s='$d_iovec_s'
 d_isascii='$d_isascii'
 d_killpg='$d_killpg'
 d_lchown='$d_lchown'
+d_ldbl_dig='$d_ldbl_dig'
 d_link='$d_link'
-d_llseek='$d_llseek'
 d_locconv='$d_locconv'
-d_lockf64='$d_lockf64'
 d_lockf='$d_lockf'
 d_longdbl='$d_longdbl'
 d_longlong='$d_longlong'
-d_lseek64='$d_lseek64'
-d_lstat64='$d_lstat64'
 d_lstat='$d_lstat'
-d_madvise='$d_madvise'
 d_mblen='$d_mblen'
 d_mbstowcs='$d_mbstowcs'
 d_mbtowc='$d_mbtowc'
@@ -13151,8 +14529,6 @@ d_memset='$d_memset'
 d_mkdir='$d_mkdir'
 d_mkfifo='$d_mkfifo'
 d_mktime='$d_mktime'
-d_mmap='$d_mmap'
-d_mprotect='$d_mprotect'
 d_msg='$d_msg'
 d_msg_ctrunc='$d_msg_ctrunc'
 d_msg_dontroute='$d_msg_dontroute'
@@ -13161,22 +14537,15 @@ 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'
-d_munmap='$d_munmap'
 d_mymalloc='$d_mymalloc'
-d_nextkey64='$d_nextkey64'
 d_nice='$d_nice'
 d_off64_t='$d_off64_t'
-d_offset_t='$d_offset_t'
 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
 d_oldpthreads='$d_oldpthreads'
 d_oldsock='$d_oldsock'
 d_open3='$d_open3'
-d_open64='$d_open64'
-d_opendir64='$d_opendir64'
 d_pathconf='$d_pathconf'
 d_pause='$d_pause'
 d_phostname='$d_phostname'
@@ -13192,11 +14561,10 @@ d_pwexpire='$d_pwexpire'
 d_pwgecos='$d_pwgecos'
 d_pwpasswd='$d_pwpasswd'
 d_pwquota='$d_pwquota'
-d_readdir64='$d_readdir64'
+d_qgcvt='$d_qgcvt'
+d_quad='$d_quad'
 d_readdir='$d_readdir'
 d_readlink='$d_readlink'
-d_readv='$d_readv'
-d_recvmsg='$d_recvmsg'
 d_rename='$d_rename'
 d_rewinddir='$d_rewinddir'
 d_rmdir='$d_rmdir'
@@ -13205,7 +14573,6 @@ d_safemcpy='$d_safemcpy'
 d_sanemcmp='$d_sanemcmp'
 d_sched_yield='$d_sched_yield'
 d_scm_rights='$d_scm_rights'
-d_seekdir64='$d_seekdir64'
 d_seekdir='$d_seekdir'
 d_select='$d_select'
 d_sem='$d_sem'
@@ -13214,7 +14581,6 @@ 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'
@@ -13250,17 +14616,16 @@ d_sigaction='$d_sigaction'
 d_sigsetjmp='$d_sigsetjmp'
 d_socket='$d_socket'
 d_sockpair='$d_sockpair'
-d_stat64='$d_stat64'
+d_sqrtl='$d_sqrtl'
 d_statblks='$d_statblks'
-d_statfs='$d_statfs'
-d_statfsflags='$d_statfsflags'
+d_statfs_f_flags='$d_statfs_f_flags'
+d_statfs_s='$d_statfs_s'
 d_statvfs='$d_statvfs'
 d_stdio_cnt_lval='$d_stdio_cnt_lval'
 d_stdio_ptr_lval='$d_stdio_ptr_lval'
 d_stdio_stream_array='$d_stdio_stream_array'
 d_stdiobase='$d_stdiobase'
 d_stdstdio='$d_stdstdio'
-d_store64='$d_store64'
 d_strchr='$d_strchr'
 d_strcoll='$d_strcoll'
 d_strctcpy='$d_strctcpy'
@@ -13268,7 +14633,10 @@ d_strerrm='$d_strerrm'
 d_strerror='$d_strerror'
 d_strtod='$d_strtod'
 d_strtol='$d_strtol'
+d_strtold='$d_strtold'
 d_strtoul='$d_strtoul'
+d_strtoull='$d_strtoull'
+d_strtouq='$d_strtouq'
 d_strxfrm='$d_strxfrm'
 d_suidsafe='$d_suidsafe'
 d_symlink='$d_symlink'
@@ -13279,18 +14647,18 @@ d_syserrlst='$d_syserrlst'
 d_system='$d_system'
 d_tcgetpgrp='$d_tcgetpgrp'
 d_tcsetpgrp='$d_tcsetpgrp'
-d_telldir64='$d_telldir64'
 d_telldir='$d_telldir'
 d_telldirproto='$d_telldirproto'
 d_time='$d_time'
 d_times='$d_times'
-d_tmpfile64='$d_tmpfile64'
-d_truncate64='$d_truncate64'
 d_truncate='$d_truncate'
 d_tzname='$d_tzname'
 d_umask='$d_umask'
 d_uname='$d_uname'
 d_union_semun='$d_union_semun'
+d_ustat='$d_ustat'
+d_vendorbin='$d_vendorbin'
+d_vendorlib='$d_vendorlib'
 d_vfork='$d_vfork'
 d_void_closedir='$d_void_closedir'
 d_voidsig='$d_voidsig'
@@ -13301,7 +14669,6 @@ 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'
@@ -13327,12 +14694,16 @@ fflushall='$fflushall'
 find='$find'
 firstmakefile='$firstmakefile'
 flex='$flex'
+fpossize='$fpossize'
 fpostype='$fpostype'
 freetype='$freetype'
 full_ar='$full_ar'
 full_csh='$full_csh'
 full_sed='$full_sed'
 gccversion='$gccversion'
+gidformat='$gidformat'
+gidsign='$gidsign'
+gidsize='$gidsize'
 gidtype='$gidtype'
 glibpth='$glibpth'
 grep='$grep'
@@ -13344,6 +14715,14 @@ h_sysfile='$h_sysfile'
 hint='$hint'
 hostcat='$hostcat'
 huge='$huge'
+i16size='$i16size'
+i16type='$i16type'
+i32size='$i32size'
+i32type='$i32type'
+i64size='$i64size'
+i64type='$i64type'
+i8size='$i8size'
+i8type='$i8type'
 i_arpainet='$i_arpainet'
 i_bsdioctl='$i_bsdioctl'
 i_db='$i_db'
@@ -13386,7 +14765,6 @@ i_sysfile='$i_sysfile'
 i_sysfilio='$i_sysfilio'
 i_sysin='$i_sysin'
 i_sysioctl='$i_sysioctl'
-i_sysmman='$i_sysmman'
 i_sysmount='$i_sysmount'
 i_sysndir='$i_sysndir'
 i_sysparam='$i_sysparam'
@@ -13395,6 +14773,7 @@ i_syssecrt='$i_syssecrt'
 i_sysselct='$i_sysselct'
 i_syssockio='$i_syssockio'
 i_sysstat='$i_sysstat'
+i_sysstatfs='$i_sysstatfs'
 i_sysstatvfs='$i_sysstatvfs'
 i_systime='$i_systime'
 i_systimek='$i_systimek'
@@ -13402,35 +14781,48 @@ i_systimes='$i_systimes'
 i_systypes='$i_systypes'
 i_sysuio='$i_sysuio'
 i_sysun='$i_sysun'
+i_sysvfs='$i_sysvfs'
 i_syswait='$i_syswait'
 i_termio='$i_termio'
 i_termios='$i_termios'
 i_time='$i_time'
 i_unistd='$i_unistd'
+i_ustat='$i_ustat'
 i_utime='$i_utime'
 i_values='$i_values'
 i_varargs='$i_varargs'
 i_varhdr='$i_varhdr'
 i_vfork='$i_vfork'
 ignore_versioned_solibs='$ignore_versioned_solibs'
+inc_version_list='$inc_version_list'
 incpath='$incpath'
 inews='$inews'
 installarchlib='$installarchlib'
 installbin='$installbin'
 installman1dir='$installman1dir'
 installman3dir='$installman3dir'
+installprefix='$installprefix'
+installprefixexp='$installprefixexp'
 installprivlib='$installprivlib'
 installscript='$installscript'
 installsitearch='$installsitearch'
+installsitebin='$installsitebin'
 installsitelib='$installsitelib'
+installstyle='$installstyle'
 installusrbinperl='$installusrbinperl'
+installvendorbin='$installvendorbin'
+installvendorlib='$installvendorlib'
 intsize='$intsize'
+ivdformat='$ivdformat'
+ivsize='$ivsize'
+ivtype='$ivtype'
 known_extensions='$known_extensions'
 ksh='$ksh'
 large='$large'
 ld='$ld'
 lddlflags='$lddlflags'
 ldflags='$ldflags'
+ldlibpthname='$ldlibpthname'
 less='$less'
 lib_ext='$lib_ext'
 libc='$libc'
@@ -13467,10 +14859,8 @@ man3dir='$man3dir'
 man3direxp='$man3direxp'
 man3ext='$man3ext'
 medium='$medium'
-mips='$mips'
 mips_type='$mips_type'
 mkdir='$mkdir'
-mmaptype='$mmaptype'
 models='$models'
 modetype='$modetype'
 more='$more'
@@ -13490,6 +14880,8 @@ nm_opt='$nm_opt'
 nm_so_opt='$nm_so_opt'
 nonxs_ext='$nonxs_ext'
 nroff='$nroff'
+nvsize='$nvsize'
+nvtype='$nvtype'
 o_nonblock='$o_nonblock'
 obj_ext='$obj_ext'
 old_pthread_create_joinable='$old_pthread_create_joinable'
@@ -13517,6 +14909,8 @@ privlib='$privlib'
 privlibexp='$privlibexp'
 prototype='$prototype'
 ptrsize='$ptrsize'
+quadkind='$quadkind'
+quadtype='$quadtype'
 randbits='$randbits'
 randfunc='$randfunc'
 randseedtype='$randseedtype'
@@ -13525,6 +14919,18 @@ rd_nodata='$rd_nodata'
 rm='$rm'
 rmail='$rmail'
 runnm='$runnm'
+sPRIEldbl='$sPRIEldbl'
+sPRIFldbl='$sPRIFldbl'
+sPRIGldbl='$sPRIGldbl'
+sPRIX64='$sPRIX64'
+sPRId64='$sPRId64'
+sPRIeldbl='$sPRIeldbl'
+sPRIfldbl='$sPRIfldbl'
+sPRIgldbl='$sPRIgldbl'
+sPRIi64='$sPRIi64'
+sPRIo64='$sPRIo64'
+sPRIu64='$sPRIu64'
+sPRIx64='$sPRIx64'
 sched_yield='$sched_yield'
 scriptdir='$scriptdir'
 scriptdirexp='$scriptdirexp'
@@ -13548,8 +14954,12 @@ sig_num_init='$sig_num_init'
 signal_t='$signal_t'
 sitearch='$sitearch'
 sitearchexp='$sitearchexp'
+sitebin='$sitebin'
+sitebinexp='$sitebinexp'
 sitelib='$sitelib'
 sitelibexp='$sitelibexp'
+siteprefix='$siteprefix'
+siteprefixexp='$siteprefixexp'
 sizetype='$sizetype'
 sleep='$sleep'
 smail='$smail'
@@ -13588,11 +14998,29 @@ touch='$touch'
 tr='$tr'
 trnl='$trnl'
 troff='$troff'
+u16size='$u16size'
+u16type='$u16type'
+u32size='$u32size'
+u32type='$u32type'
+u64size='$u64size'
+u64type='$u64type'
+u8size='$u8size'
+u8type='$u8type'
+uidformat='$uidformat'
+uidsign='$uidsign'
+uidsize='$uidsize'
 uidtype='$uidtype'
 uname='$uname'
 uniq='$uniq'
+uquadtype='$uquadtype'
+use5005threads='$use5005threads'
 use64bits='$use64bits'
 usedl='$usedl'
+useithreads='$useithreads'
+uselargefiles='$uselargefiles'
+uselongdouble='$uselongdouble'
+uselonglong='$uselonglong'
+usemorebits='$usemorebits'
 usemultiplicity='$usemultiplicity'
 usemymalloc='$usemymalloc'
 usenm='$usenm'
@@ -13603,9 +15031,21 @@ usesfio='$usesfio'
 useshrplib='$useshrplib'
 usesocks='$usesocks'
 usethreads='$usethreads'
+usevendorprefix='$usevendorprefix'
 usevfork='$usevfork'
 usrinc='$usrinc'
 uuname='$uuname'
+uvoformat='$uvoformat'
+uvsize='$uvsize'
+uvtype='$uvtype'
+uvuformat='$uvuformat'
+uvxformat='$uvxformat'
+vendorbin='$vendorbin'
+vendorbinexp='$vendorbinexp'
+vendorlib='$vendorlib'
+vendorlibexp='$vendorlibexp'
+vendorprefix='$vendorprefix'
+vendorprefixexp='$vendorprefixexp'
 version='$version'
 vi='$vi'
 voidflags='$voidflags'