This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: Decreasing VMS tests in File::Spec::VMS?
[perl5.git] / Configure
index 357dde9..b992563 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 Mon Jan 28 16:54:53 EET 2002 [metaconfig 3.0 PL70]
+# Generated on Mon Aug 25 19:47:58 EEST 2003 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >c1$$ <<EOF
@@ -47,6 +47,18 @@ true || exec sh $0 $argv:q
 (exit $?0) || exec sh $0 $argv:q
 rm -f c1$$ c2$$
 
+if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
+       cat >&4 <<EOF
+***
+*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
+*** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
+*** Please read the README.plan9 for further instructions.
+*** Cannot continue, aborting.
+***
+EOF
+       exit 1
+fi
+
 : compute my invocation name
 me=$0
 case "$0" in
@@ -59,11 +71,12 @@ esac
 : Proper separator for the PATH environment variable
 p_=:
 : On OS/2 this directory should exist if this is not floppy only system :-]
-if test -d c:/. ; then
+if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
     if test -n "$OS2_SHELL"; then
                p_=\;
                PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
                OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
+               is_os2=yes
        elif test -n "$DJGPP"; then
                case "X${MACHTYPE:-nonesuchmach}" in
                *cygwin) ;;
@@ -165,7 +178,6 @@ esac
 test -d UU || mkdir UU
 cd UU && rm -f ./*
 
-
 ccname=''
 ccversion=''
 ccsymbols=''
@@ -176,6 +188,7 @@ run=''
 targetarch=''
 to=''
 usecrosscompile=''
+mistrustnm=''
 perllibs=''
 dynamic_ext=''
 extensions=''
@@ -301,8 +314,6 @@ baserev=''
 bin=''
 binexp=''
 installbin=''
-bincompat5005=''
-d_bincompat5005=''
 byteorder=''
 cc=''
 ccflags=''
@@ -324,7 +335,10 @@ cppstdin=''
 d__fwalk=''
 d_access=''
 d_accessx=''
+d_aintl=''
 d_alarm=''
+asctime_r_proto=''
+d_asctime_r=''
 d_attribut=''
 d_bcmp=''
 d_bcopy=''
@@ -340,10 +354,17 @@ d_closedir=''
 d_void_closedir=''
 d_cmsghdr_s=''
 d_const=''
+d_copysignl=''
 cryptlib=''
 d_crypt=''
+crypt_r_proto=''
+d_crypt_r=''
 d_csh=''
 full_csh=''
+ctermid_r_proto=''
+d_ctermid_r=''
+ctime_r_proto=''
+d_ctime_r=''
 d_cuserid=''
 d_dbl_dig=''
 d_dbminitproto=''
@@ -354,15 +375,30 @@ d_dlopen=''
 d_dlsymun=''
 d_dosuid=''
 d_suidsafe=''
+d_drand48_r=''
+drand48_r_proto=''
 d_drand48proto=''
 d_dup2=''
 d_eaccess=''
 d_endgrent=''
+d_endgrent_r=''
+endgrent_r_proto=''
 d_endhent=''
+d_endhostent_r=''
+endhostent_r_proto=''
 d_endnent=''
+d_endnetent_r=''
+endnetent_r_proto=''
 d_endpent=''
+d_endprotoent_r=''
+endprotoent_r_proto=''
 d_endpwent=''
+d_endpwent_r=''
+endpwent_r_proto=''
 d_endsent=''
+d_endservent_r=''
+endservent_r_proto=''
+d_faststdio=''
 d_fchdir=''
 d_fchmod=''
 d_fchown=''
@@ -397,6 +433,12 @@ d_getcwd=''
 d_getespwnam=''
 d_getfsstat=''
 d_getgrent=''
+d_getgrent_r=''
+getgrent_r_proto=''
+d_getgrgid_r=''
+getgrgid_r_proto=''
+d_getgrnam_r=''
+getgrnam_r_proto=''
 d_getgrps=''
 d_gethbyaddr=''
 d_gethbyname=''
@@ -405,14 +447,28 @@ aphostname=''
 d_gethname=''
 d_phostname=''
 d_uname=''
+d_gethostbyaddr_r=''
+gethostbyaddr_r_proto=''
+d_gethostbyname_r=''
+gethostbyname_r_proto=''
+d_gethostent_r=''
+gethostent_r_proto=''
 d_gethostprotos=''
 d_getitimer=''
 d_getlogin=''
+d_getlogin_r=''
+getlogin_r_proto=''
 d_getmnt=''
 d_getmntent=''
 d_getnbyaddr=''
 d_getnbyname=''
 d_getnent=''
+d_getnetbyaddr_r=''
+getnetbyaddr_r_proto=''
+d_getnetbyname_r=''
+getnetbyname_r_proto=''
+d_getnetent_r=''
+getnetent_r_proto=''
 d_getnetprotos=''
 d_getpagsz=''
 d_getpent=''
@@ -424,17 +480,41 @@ d_getppid=''
 d_getprior=''
 d_getpbyname=''
 d_getpbynumber=''
+d_getprotobyname_r=''
+getprotobyname_r_proto=''
+d_getprotobynumber_r=''
+getprotobynumber_r_proto=''
+d_getprotoent_r=''
+getprotoent_r_proto=''
 d_getprotoprotos=''
 d_getprpwnam=''
 d_getpwent=''
+d_getpwent_r=''
+getpwent_r_proto=''
+d_getpwnam_r=''
+getpwnam_r_proto=''
+d_getpwuid_r=''
+getpwuid_r_proto=''
 d_getsent=''
+d_getservbyname_r=''
+getservbyname_r_proto=''
+d_getservbyport_r=''
+getservbyport_r_proto=''
+d_getservent_r=''
+getservent_r_proto=''
 d_getservprotos=''
 d_getspnam=''
+d_getspnam_r=''
+getspnam_r_proto=''
 d_getsbyname=''
 d_getsbyport=''
+d_gmtime_r=''
+gmtime_r_proto=''
 d_gnulibc=''
+gnulibc_version=''
 d_hasmntopt=''
 d_htonl=''
+d_ilogbl=''
 d_inetaton=''
 d_int64_t=''
 d_isascii=''
@@ -446,6 +526,8 @@ d_killpg=''
 d_lchown=''
 d_ldbl_dig=''
 d_link=''
+d_localtime_r=''
+localtime_r_proto=''
 d_locconv=''
 d_lockf=''
 d_longdbl=''
@@ -473,6 +555,7 @@ d_mmap=''
 mmaptype=''
 d_modfl=''
 d_modfl_pow32_bug=''
+d_modflproto=''
 d_mprotect=''
 d_msg=''
 d_msgctl=''
@@ -497,14 +580,21 @@ procselfexe=''
 d_old_pthread_create_joinable=''
 old_pthread_create_joinable=''
 d_pthread_atfork=''
+d_pthread_attr_setscope=''
 d_pthread_yield=''
 d_sched_yield=''
 sched_yield=''
 d_qgcvt=''
+d_random_r=''
+random_r_proto=''
+d_readdir64_r=''
+readdir64_r_proto=''
 d_readdir=''
 d_rewinddir=''
 d_seekdir=''
 d_telldir=''
+d_readdir_r=''
+readdir_r_proto=''
 d_readlink=''
 d_readv=''
 d_recvmsg=''
@@ -514,6 +604,7 @@ d_safebcpy=''
 d_safemcpy=''
 d_sanemcmp=''
 d_sbrkproto=''
+d_scalbnl=''
 d_select=''
 d_sem=''
 d_semctl=''
@@ -523,12 +614,20 @@ d_sendmsg=''
 d_setegid=''
 d_seteuid=''
 d_setgrent=''
+d_setgrent_r=''
+setgrent_r_proto=''
 d_setgrps=''
 d_sethent=''
+d_sethostent_r=''
+sethostent_r_proto=''
 d_setitimer=''
 d_setlinebuf=''
 d_setlocale=''
+d_setlocale_r=''
+setlocale_r_proto=''
 d_setnent=''
+d_setnetent_r=''
+setnetent_r_proto=''
 d_setpent=''
 d_setpgid=''
 d_setpgrp2=''
@@ -536,7 +635,11 @@ d_bsdsetpgrp=''
 d_setpgrp=''
 d_setprior=''
 d_setproctitle=''
+d_setprotoent_r=''
+setprotoent_r_proto=''
 d_setpwent=''
+d_setpwent_r=''
+setpwent_r_proto=''
 d_setregid=''
 d_setresgid=''
 d_setresuid=''
@@ -544,6 +647,8 @@ d_setreuid=''
 d_setrgid=''
 d_setruid=''
 d_setsent=''
+d_setservent_r=''
+setservent_r_proto=''
 d_setsid=''
 d_setvbuf=''
 d_sfio=''
@@ -574,6 +679,10 @@ socketlib=''
 d_socklen_t=''
 d_socks5_init=''
 d_sqrtl=''
+d_srand48_r=''
+srand48_r_proto=''
+d_srandom_r=''
+srandom_r_proto=''
 d_sresgproto=''
 d_sresuproto=''
 d_statblks=''
@@ -600,6 +709,8 @@ d_strerrm=''
 d_strerror=''
 d_sysernlst=''
 d_syserrlst=''
+d_strerror_r=''
+strerror_r_proto=''
 d_strftime=''
 d_strtod=''
 d_strtol=''
@@ -622,7 +733,11 @@ d_time=''
 timetype=''
 clocktype=''
 d_times=''
+d_tmpnam_r=''
+tmpnam_r_proto=''
 d_truncate=''
+d_ttyname_r=''
+ttyname_r_proto=''
 d_tzname=''
 d_u32align=''
 d_ualarm=''
@@ -659,6 +774,7 @@ fflushNULL=''
 fflushall=''
 fpossize=''
 fpostype=''
+gccansipedantic=''
 gccosandvers=''
 gccversion=''
 gidformat=''
@@ -668,7 +784,14 @@ gidtype=''
 groupstype=''
 h_fcntl=''
 h_sysfile=''
+html1dir=''
+html1direxp=''
+installhtml1dir=''
+html3dir=''
+html3direxp=''
+installhtml3dir=''
 i_arpainet=''
+i_crypt=''
 db_hashtype=''
 db_prefixtype=''
 db_version_major=''
@@ -756,6 +879,8 @@ i_syswait=''
 i_sgtty=''
 i_termio=''
 i_termios=''
+d_tm_tm_gmtoff=''
+d_tm_tm_zone=''
 i_systime=''
 i_systimek=''
 i_time=''
@@ -866,7 +991,6 @@ perl5=''
 perladmin=''
 perlpath=''
 d_nv_preserves_uv=''
-d_nv_preserves_uv_bits=''
 i16size=''
 i16type=''
 i32size=''
@@ -877,6 +1001,7 @@ i8size=''
 i8type=''
 ivsize=''
 ivtype=''
+nv_preserves_uv_bits=''
 nvsize=''
 nvtype=''
 u16size=''
@@ -947,12 +1072,27 @@ sitearchexp=''
 installsitebin=''
 sitebin=''
 sitebinexp=''
+installsitehtml1dir=''
+sitehtml1dir=''
+sitehtml1direxp=''
+installsitehtml3dir=''
+sitehtml3dir=''
+sitehtml3direxp=''
 installsitelib=''
 sitelib=''
 sitelib_stem=''
 sitelibexp=''
+installsiteman1dir=''
+siteman1dir=''
+siteman1direxp=''
+installsiteman3dir=''
+siteman3dir=''
+siteman3direxp=''
 siteprefix=''
 siteprefixexp=''
+installsitescript=''
+sitescript=''
+sitescriptexp=''
 sizesize=''
 sizetype=''
 so=''
@@ -976,6 +1116,7 @@ uidtype=''
 archname64=''
 use64bitall=''
 use64bitint=''
+usefaststdio=''
 ccflags_uselargefiles=''
 ldflags_uselargefiles=''
 libswanted_uselargefiles=''
@@ -1005,14 +1146,30 @@ d_vendorbin=''
 installvendorbin=''
 vendorbin=''
 vendorbinexp=''
+installvendorhtml1dir=''
+vendorhtml1dir=''
+vendorhtml1direxp=''
+installvendorhtml3dir=''
+vendorhtml3dir=''
+vendorhtml3direxp=''
 d_vendorlib=''
 installvendorlib=''
 vendorlib=''
 vendorlib_stem=''
 vendorlibexp=''
+installvendorman1dir=''
+vendorman1dir=''
+vendorman1direxp=''
+installvendorman3dir=''
+vendorman3dir=''
+vendorman3direxp=''
 usevendorprefix=''
 vendorprefix=''
 vendorprefixexp=''
+d_vendorscript=''
+installvendorscript=''
+vendorscript=''
+vendorscriptexp=''
 versiononly=''
 defvoidused=''
 voidflags=''
@@ -1036,22 +1193,22 @@ if test -f /etc/unixtovms.exe; then
        eunicefix=/etc/unixtovms.exe
 fi
 
-if test -f "/system/gnu_library/bin/ar.pm"; then
-     _exe=".pm"
+: Set executable suffix now -- needed before hints available
+if test -f "/libs/version.library"; then
+: Amiga OS
+    _exe=""
+elif test -f "/system/gnu_library/bin/ar.pm"; then
+: Stratus VOS
+    _exe=".pm"
+elif test -n "$DJGPP"; then
+: DOS DJGPP
+    _exe=".exe"
+elif test -d c:/. -o -n "$is_os2" ; then
+: OS/2 or cygwin
+    _exe=".exe"
 fi
 
 i_whoami=''
-ccname=''
-ccversion=''
-perllibs=''
-: set useposix=false in your hint file to disable the POSIX extension.
-useposix=true
-: set useopcode=false in your hint file to disable the Opcode extension.
-useopcode=true
-: Trailing extension.  Override this in a hint file, if needed.
-: Extra object files, if any, needed on this platform.
-archobjs=''
-archname=''
 : Possible local include directories to search.
 : Set locincpth to "" in a hint file to defeat local include searches.
 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
@@ -1060,6 +1217,12 @@ locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
 : no include file wanted by default
 inclwanted=''
 
+siteman1dir=''
+siteman3dir=''
+sitescript=''
+: Trailing extension.  Override this in a hint file, if needed.
+: Extra object files, if any, needed on this platform.
+archobjs=''
 groupstype=''
 libnames=''
 : change the next line if compiling for Xenix/286 on Xenix/386
@@ -1083,23 +1246,29 @@ 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
+
+ccname=''
+ccversion=''
+perllibs=''
+: set useposix=false in your hint file to disable the POSIX extension.
+useposix=true
+: set useopcode=false in your hint file to disable the Opcode extension.
+useopcode=true
 archname64=''
 ccflags_uselargefiles=''
 ldflags_uselargefiles=''
 libswanted_uselargefiles=''
 : set usemultiplicity on the Configure command line to enable multiplicity.
 : set usesocks on the Configure command line to enable socks.
+archname=''
 : set usethreads on the Configure command line to enable threads.
 usereentrant='undef'
-: 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 bind inet nsl nm ndbm gdbm dbm db malloc dl'
-libswanted="$libswanted dld ld sun m c cposix posix"
-libswanted="$libswanted ndir dir crypt sec"
-libswanted="$libswanted ucb bsd BSD PW x util"
+: If anyone needs extra -lxxx, put those in a hint file.
+libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
+libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
 : We probably want to search /usr/shlib before most other libraries.
 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
@@ -1376,23 +1545,23 @@ while test $# -gt 0; do
            zzz=''
            uuu=undef
            case "$yyy" in
-            *=*) zzz=`echo $yyy|sed 's!=.*!!'`
+            *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
                  case "$zzz" in
                  *:*) zzz='' ;;
                  *)   xxx=append
-                      zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
-                      yyy=`echo $yyy|sed 's!=.*!!'` ;;
+                      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!^[^:]*:!!'` ;;
+                 *:*) 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
@@ -1696,7 +1865,7 @@ rm -f .echotmp
 echo " "
 if test -f "$rsrc/MANIFEST"; then
        echo "First let's make sure your kit is complete.  Checking..." >&4
-       awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | split -50
+       awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
        rm -f missing
        tmppwd=`pwd`
        for filelist in x??; do
@@ -1750,6 +1919,11 @@ if test X"$trnl" = X; then
        esac
 fi
 if test X"$trnl" = X; then
+       case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
+       fooxy) trnl='\n\r' ;;
+       esac
+fi
+if test X"$trnl" = X; then
        cat <<EOM >&2
 
 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
@@ -2038,9 +2212,10 @@ for dir in \$*; do
        elif test -f \$dir/\$thing.exe; then
                if test -n "$DJGPP"; then
                        echo \$dir/\$thing.exe
-               else
+               elif test "$eunicefix" != ":"; then
                        : on Eunice apparently
                        echo \$dir/\$thing
+                       exit 0
                fi
                exit 0
        fi
@@ -2141,7 +2316,7 @@ for file in $trylist; do
        '') xxx=`./loc $file $file $pth`;;
        *) xxx=`./loc $xxx $xxx $pth`;;
        esac
-       eval $file=$xxx
+       eval $file=$xxx$_exe
        eval _$file=$xxx
        case "$xxx" in
        /*)
@@ -2236,10 +2411,10 @@ FOO
        ;;
 esac
 
-cat <<EOS >checkcc
+cat <<EOS >trygcc
 $startsh
 EOS
-cat <<'EOSC' >>checkcc
+cat <<'EOSC' >>trygcc
 case "$cc" in
 '') ;;
 *)  $rm -f try try.*
@@ -2277,19 +2452,50 @@ EOM
                     fi
                 fi  
                 case "$ans" in
-                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
+                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
+                       if $test -f usethreads.cbu; then
+                           $cat >&4 <<EOM 
+
+*** However, any setting of the C compiler flags (e.g. for thread support)
+*** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
+*** (together with e.g. -Dusethreads).
+
+EOM
+                       fi;;
                 esac
             fi
         fi
+    fi
+    $rm -f try try.*
+    ;;
+esac
+EOSC
+
+cat <<EOS >checkcc
+$startsh
+EOS
+cat <<'EOSC' >>checkcc
+case "$cc" in        
+'') ;;
+*)  $rm -f try try.*              
+    $cat >try.c <<EOM
+int main(int argc, char *argv[]) {
+  return 0;
+}
+EOM
+    if $cc -o try $ccflags $ldflags try.c; then
+       :
+    else
         if $test X"$despair" = Xyes; then
-           $cat >&4 <<EOM
+           echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
+        fi
+        $cat >&4 <<EOM         
 You need to find a working C compiler.
 Either (purchase and) install the C compiler supplied by your OS vendor,
 or for a free C compiler try http://gcc.gnu.org/
 I cannot continue any further, aborting.
 EOM
-            exit 1
-        fi
+        exit 1
     fi
     $rm -f try try.*
     ;;
@@ -2311,7 +2517,7 @@ $rm -f blurfl sym
 : determine whether symbolic links are supported
 echo " "
 case "$lns" in
-*"ln -s")
+*"ln"*" -s")
        echo "Checking how to test for symbolic links..." >&4
        $lns blurfl sym
        if $test "X$issymlink" = X; then
@@ -2374,7 +2580,7 @@ $define|true|[yY]*)
                exit 1
                ;;
        *)      case "$lns:$issymlink" in
-               *"ln -s:"*"test -"?)
+               *"ln"*" -s:"*"test -"?)
                        echo "Creating the symbolic links..." >&4
                        echo "(First creating the subdirectories...)" >&4
                        cd ..
@@ -2934,6 +3140,12 @@ EOM
                        ;;
                next*) osname=next ;;
                nonstop-ux) osname=nonstopux ;;
+               openbsd) osname=openbsd
+                       osvers="$3"
+                       ;;
+               os2)    osname=os2
+                       osvers="$4"
+                       ;;
                POSIX-BC | posix-bc ) osname=posix-bc
                        osvers="$3"
                        ;;
@@ -2972,7 +3184,7 @@ EOM
                osf1|mls+)      case "$5" in
                                alpha)
                                        osname=dec_osf
-                                       osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
+                                       osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
                                        case "$osvers" in
                                        [1-9].[0-9]*) ;;
                                        *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
@@ -2982,7 +3194,8 @@ EOM
                        mips)   osname=mips_osf1 ;;
                        esac
                        ;;
-               unixware) osname=svr5
+               # UnixWare 7.1.2 is known as Open UNIX 8
+               openunix|unixware) osname=svr5
                        osvers="$4"
                        ;;
                uts)    osname=uts
@@ -3052,7 +3265,7 @@ EOM
                                osname=news_os
                        fi
                        $rm -f UU/kernel.what
-               elif test -d c:/.; then
+               elif test -d c:/. -o -n "$is_os2" ; then
                        set X $myuname
                        osname=os2
                        osvers="$5"
@@ -3278,20 +3491,100 @@ $undef$define) . ./whoa; eval "$var=\$tu";;
 *) eval "$var=$val";;
 esac'
 
+case "$usesocks" in
+$define|true|[yY]*)    dflt='y';;
+*) dflt='n';;
+esac
+cat <<EOM
+
+Perl can be built to use the SOCKS proxy protocol library.  To do so,
+Configure must be run with -Dusesocks.  If you use SOCKS you also need
+to use the PerlIO abstraction layer, this will be implicitly selected.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+rp='Build Perl for SOCKS?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define" ;;     
+*)      val="$undef" ;;
+esac
+set usesocks
+eval $setvar
+
+case "$usesocks" in
+$define|true|[yY]*) useperlio="$define";;
+esac
+
+case "$useperlio" in
+$define|true|[yY]*|'') dflt='y';;
+*) dflt='n';;
+esac
+cat <<EOM
+
+Previous version of $package used the standard IO mechanisms as
+defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
+alternate IO mechanisms via the PerlIO abstraction layer, but the
+stdio mechanism is still available if needed.  The abstraction layer
+can use AT&T's sfio (if you already have sfio installed) or regular stdio.
+Using PerlIO with sfio may cause problems with some extension modules.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+rp='Use the PerlIO abstraction layer?'
+. ./myread
+case "$ans" in
+y|Y) 
+       val="$define"
+       ;;
+*)      
+       echo "Ok, doing things the stdio way."
+       val="$undef"
+       ;;
+esac
+set useperlio
+eval $setvar 
+
+case "$usesocks" in
+$define|true|[yY]*)
+       case "$useperlio" in
+       $define|true|[yY]*) ;;
+       *)      cat >&4 <<EOM
+
+You are using the SOCKS proxy protocol library which means that you
+should also use the PerlIO layer.  You may be headed for trouble.
+
+EOM
+               ;;
+       esac
+       ;;
+esac
+
+       
 case "$usethreads" in
 $define|true|[yY]*)     dflt='y';;
-*) dflt='n';;
+*)     # Catch case where user specified ithreads or 5005threads but
+       # forgot -Dusethreads (A.D. 4/2002)
+       case "$useithreads$use5005threads" in
+       *$define*)      
+               case "$useperlio" in
+               "$define")      dflt='y' ;;
+               *)              dflt='n' ;;
+               esac
+               ;;
+       *)      dflt='n';;
+       esac
+       ;;
 esac
 cat <<EOM
 
 Perl can be built to take advantage of threads on some systems.
 To do so, Configure can be run with -Dusethreads.
 
-Note that threading is a highly experimental feature, and
-some known race conditions still remain.  If you choose to try
-it, be very sure to not actually deploy it for production
-purposes.  README.threads has more details, and is required
-reading if you enable threads.
+Note that Perl built with threading support runs slightly slower
+and uses more memory than plain Perl. The current implementation
+is believed to be stable, but it is fairly new, and so should be
+treated with caution.
 
 If this doesn't make any sense to you, just accept the default '$dflt'.
 EOM
@@ -3308,16 +3601,14 @@ 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.
+Since release 5.6, Perl has had two different threading implementations,
+the newer interpreter-based version (ithreads) with one interpreter per
+thread, and the older 5.005 version (5005threads).
+The 5005threads version is effectively unmaintained and will probably be
+removed in Perl 5.10, so there should be no need to build a Perl using it
+unless needed for backwards compatibility with some existing 5.005threads
+code.
 
-If you're a casual user, you probably don't want interpreter-threads
-at this time.  But if you do, the 'threads' module allows their use,
-and the 'Thread' module offers an interface to both 5005threads and
-ithreads (whichever has been configured).
 EOM
        : Default to ithreads unless overridden on command line or with
        : old config.sh
@@ -3328,7 +3619,7 @@ EOM
        case "$useithreads" in
                $undef|false|[nN]*) dflt='n';;
        esac
-       rp='Use interpreter-based ithreads?'
+       rp='Use the newer interpreter-based ithreads?'
        . ./myread
        case "$ans" in
        y|Y)    val="$define" ;;
@@ -3363,6 +3654,16 @@ EOM
        ;;
 esac
 
+if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
+       cat >&4 <<EOF
+***
+*** To build with ithreads you must also use the PerlIO layer.
+*** Cannot continue, aborting.
+***
+EOF
+       exit 1
+fi
+
 case "$d_oldpthreads" in
 '')    : Configure tests would be welcome here.  For now, assume undef.
        val="$undef" ;;
@@ -3532,6 +3833,9 @@ esac
 rp="Use which C compiler?"
 . ./myread
 cc="$ans"
+
+: See if they have not cc but they do have gcc
+. ./trygcc
 : 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.
@@ -3552,7 +3856,7 @@ int main() {
        printf("%s\n", "1");
 #endif
 #endif
-       exit(0);
+       return(0);
 }
 EOM
 if $cc -o try $ccflags $ldflags try.c; then
@@ -3560,7 +3864,7 @@ if $cc -o try $ccflags $ldflags try.c; then
        case "$gccversion" in
        '') echo "You are not using GNU cc." ;;
        *)  echo "You are using GNU cc $gccversion."
-           ccname=gcc  
+           ccname=gcc
            ;;
        esac
 else
@@ -3613,6 +3917,20 @@ case "$ccname" in
 '') ccname="$cc" ;;
 esac
 
+# gcc 3.* complain about adding -Idirectories that they already know about,
+# so we will take those off from locincpth.
+case "$gccversion" in
+3*)
+    echo "main(){}">try.c
+    for incdir in $locincpth; do
+       warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
+            grep '^c[cp]p*[01]: warning: changing search order '`
+       if test "X$warn" != X; then
+          locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
+       fi
+    done
+    $rm -f try try.*
+esac
 
 : decide how portable to be.  Allow command line overrides.
 case "$d_portable" in
@@ -3680,7 +3998,9 @@ esac
 
 case "$fn" in
 *\(*)
-       expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
+       : getfile will accept an answer from the comma-separated list
+       : enclosed in parentheses even if it does not meet other criteria.
+       expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
        fn=`echo $fn | sed 's/(.*)//'`
        ;;
 esac
@@ -4198,29 +4518,48 @@ case "$firstmakefile" in
 '') firstmakefile='makefile';;
 esac
 
-case "$usesocks" in
+case "$ccflags" in
+*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
+esac
+
+case "$uselongdouble" in
 $define|true|[yY]*)    dflt='y';;
 *) dflt='n';;
 esac
 cat <<EOM
 
-Perl can be built to use the SOCKS proxy protocol library.  To do so,
-Configure must be run with -Dusesocks.  If you use SOCKS you also need
-to use the PerlIO abstraction layer, this will be implicitly selected.
+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 '$dflt'.
 EOM
-rp='Build Perl for SOCKS?'
+rp='Try to use long doubles if available?'
 . ./myread
 case "$ans" in
-y|Y)   val="$define" ;;     
-*)      val="$undef" ;;
+y|Y)   val="$define"   ;;
+*)      val="$undef"   ;;
 esac
-set usesocks
+set uselongdouble
 eval $setvar
 
-case "$usesocks" in
-$define|true|[yY]*) useperlio="$define";;
+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
+       fi
+       ;;
 esac
 
 : Looking for optional libraries
@@ -4247,7 +4586,7 @@ for thislib in $libswanted; do
        for thisdir in $libspath; do
            xxx=''
            if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
-               xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
+               xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
                $test -f "$xxx" && eval $libscheck
                $test -f "$xxx" && libstyle=shared
            fi
@@ -4570,7 +4909,7 @@ 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); }
+int main() { printf("Ok\n"); return(0); }
 EOF
 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
 shift
@@ -4654,231 +4993,12 @@ mc_file=$1;
 shift;
 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
 
-: check for lengths of integral types
+: determine filename position in cpp output
 echo " "
-case "$intsize" in
-'')
-       echo "Checking to see how big your integers are..." >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-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);
-}
-EOCP
-       set try
-       if eval $compile_ok && $run ./try > /dev/null; then
-               eval `$run ./try`
-               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 try try.*
-
-: check for void type
-echo " "
-echo "Checking to see how well your C compiler groks the void type..." >&4
-case "$voidflags" in
-'')
-       $cat >try.c <<'EOCP'
-#if TRY & 1
-void sub() {
-#else
-sub() {
-#endif
-       extern void moo();      /* function returning void */
-       void (*goo)();          /* ptr to func returning void */
-#if TRY & 8
-       void *hue;              /* generic ptr */
-#endif
-#if TRY & 2
-       void (*foo[10])();
-#endif
-
-#if TRY & 4
-       if(goo == moo) {
-               exit(0);
-       }
-#endif
-       exit(0);
-}
-int main() { sub(); }
-EOCP
-       if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
-               voidflags=$defvoidused
-       echo "Good.  It appears to support void to the level $package wants.">&4
-               if $contains warning .out >/dev/null 2>&1; then
-                       echo "However, you might get some warnings that look like this:"
-                       $cat .out
-               fi
-       else
-echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
-               if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
-                       echo "It supports 1..."
-                       if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
-                               echo "It also supports 2..."
-                               if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
-                                       voidflags=7
-                                       echo "And it supports 4 but not 8 definitely."
-                               else
-                                       echo "It doesn't support 4..."
-                                       if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
-                                               voidflags=11
-                                               echo "But it supports 8."
-                                       else
-                                               voidflags=3
-                                               echo "Neither does it support 8."
-                                       fi
-                               fi
-                       else
-                               echo "It does not support 2..."
-                               if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
-                                       voidflags=13
-                                       echo "But it supports 4 and 8."
-                               else
-                                       if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
-                                               voidflags=5
-                                               echo "And it supports 4 but has not heard about 8."
-                                       else
-                                               echo "However it supports 8 but not 4."
-                                       fi
-                               fi
-                       fi
-               else
-                       echo "There is no support at all for void."
-                       voidflags=0
-               fi
-       fi
-esac
-case "$voidflags" in
-"$defvoidused") ;;
-*)     $cat >&4 <<'EOM'
-  Support flag bits are:
-    1: basic void declarations.
-    2: arrays of pointers to functions returning void.
-    4: operations between pointers to and addresses of void functions.
-    8: generic void pointers.
-EOM
-       dflt="$voidflags";
-       rp="Your void support flags add up to what?"
-       . ./myread
-       voidflags="$ans"
-       ;;
-esac
-$rm -f try.* .out
-
-: check for length of pointer
-echo " "
-case "$ptrsize" in
-'')
-       echo "Checking to see how big your pointers are..." >&4
-       if test "$voidflags" -gt 7; then
-               echo '#define VOID_PTR char *' > try.c
-       else
-               echo '#define VOID_PTR void *' > try.c
-       fi
-       $cat >>try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-    printf("%d\n", (int)sizeof(VOID_PTR));
-    exit(0);
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               ptrsize=`$run ./try`
-               echo "Your pointers are $ptrsize bytes long."
-       else
-               dflt='4'
-               echo "(I can't seem to compile the test program.  Guessing...)" >&4
-               rp="What is the size of a pointer (in bytes)?"
-               . ./myread
-               ptrsize="$ans"
-       fi
-       ;;
-esac
-$rm -f try.c try
-
-: check for long long
-echo " "
-echo "Checking to see if you have long long..." >&4
-echo 'int main() { long long x = 7; return 0; }' > try.c
-set try
-if eval $compile; then
-       val="$define"
-       echo "You have long long."
-else
-       val="$undef"
-       echo "You do not have long long."
-fi
-$rm try.*
-set d_longlong
-eval $setvar
-
-: check for length of long long
-case "${d_longlong}${longlongsize}" in
-$define)
-       echo " "
-       echo "Checking to see how big your long longs are..." >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-    printf("%d\n", (int)sizeof(long long));
-    return(0);
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               longlongsize=`$run ./try`
-               echo "Your long longs are $longlongsize bytes long."
-       else
-               dflt='8'
-               echo " "
-               echo "(I can't seem to compile the test program.  Guessing...)"
-               rp="What is the size of a long long (in bytes)?"
-               . ./myread
-               longlongsize="$ans"
-       fi
-       if $test "X$longsize" = "X$longlongsize"; then
-               echo "(That isn't any different from an ordinary long.)"
-       fi      
-       ;;
-esac
-$rm -f try.* try
-
-: determine filename position in cpp output
-echo " "
-echo "Computing filename position in cpp output for #include directives..." >&4
-case "$osname" in
-vos) testaccess=-e ;;
-*)   testaccess=-r ;;
+echo "Computing filename position in cpp output for #include directives..." >&4
+case "$osname" in
+vos) testaccess=-e ;;
+*)   testaccess=-r ;;
 esac
 echo '#include <stdio.h>' > foo.c
 $cat >fieldn <<EOF
@@ -4912,6 +5032,7 @@ echo "Your cpp writes the filename in the $pos field of the line."
 
 case "$osname" in
 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
+os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
 *)   cppfilter='' ;;
 esac
 : locate header file
@@ -4982,49 +5103,151 @@ do set $yyy; var=$2; eval "was=\$$2";
        set $yyy; shift; shift; yyy=$@;
 done'
 
-: see if inttypes.h is available
-: we want a real compile instead of Inhdr because some systems
-: have an inttypes.h which includes non-existent headers
+: see if stdlib is available
+set stdlib.h i_stdlib
+eval $inhdr
+
+: check for lengths of integral types
 echo " "
-$cat >try.c <<EOCP
-#include <inttypes.h>
-int main() {
-       static int32_t foo32 = 0x12345678;
+case "$intsize" in
+'')
+       echo "Checking to see how big your integers are..." >&4
+       $cat >try.c <<EOCP
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#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);
 }
 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
+       set try
+       if eval $compile_ok && $run ./try > /dev/null; then
+               eval `$run ./try`
+               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 try try.*
 
-: check for int64_t
+: check for long long
 echo " "
-echo "Checking to see if you have int64_t..." >&4
-$cat >try.c <<EOCP
-#include <sys/types.h>
-#$i_inttypes I_INTTYPES
-#ifdef I_INTTYPES
-#include <inttypes.h>
-#endif
-int main() { int64_t x = 7; }
-EOCP
+echo "Checking to see if you have long long..." >&4
+echo 'int main() { long long x = 7; return 0; }' > try.c
 set try
 if eval $compile; then
        val="$define"
-       echo "You have int64_t."
+       echo "You have long long."
 else
        val="$undef"
-       echo "You do not have int64_t."
+       echo "You do not have long long."
 fi
-$rm -f try try.*
-set d_int64_t
+$rm try.*
+set d_longlong
+eval $setvar
+
+: check for length of long long
+case "${d_longlong}${longlongsize}" in
+$define)
+       echo " "
+       echo "Checking to see how big your long longs are..." >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof(long long));
+    return(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               longlongsize=`$run ./try`
+               echo "Your long longs are $longlongsize bytes long."
+       else
+               dflt='8'
+               echo " "
+               echo "(I can't seem to compile the test program.  Guessing...)"
+               rp="What is the size of a long long (in bytes)?"
+               . ./myread
+               longlongsize="$ans"
+       fi
+       if $test "X$longsize" = "X$longlongsize"; then
+               echo "(That isn't any different from an ordinary long.)"
+       fi      
+       ;;
+esac
+$rm -f try.* try
+
+: see if inttypes.h is available
+: we want a real compile instead of Inhdr because some systems
+: have an inttypes.h which includes non-existent headers
+echo " "
+$cat >try.c <<EOCP
+#include <inttypes.h>
+int main() {
+       static int32_t foo32 = 0x12345678;
+}
+EOCP
+set try
+if eval $compile; then
+       echo "<inttypes.h> found." >&4
+       val="$define"
+else
+       echo "<inttypes.h> NOT found." >&4
+       val="$undef"
+fi
+$rm -f try.c try
+set i_inttypes
+eval $setvar
+
+: check for int64_t
+echo " "
+echo "Checking to see if you have int64_t..." >&4
+$cat >try.c <<EOCP
+#include <sys/types.h>
+#$i_inttypes I_INTTYPES
+#ifdef I_INTTYPES
+#include <inttypes.h>
+#endif
+int main() { int64_t x = 7; }
+EOCP
+set try
+if eval $compile; then
+       val="$define"
+       echo "You have int64_t."
+else
+       val="$undef"
+       echo "You do not have int64_t."
+fi
+$rm -f try try.*
+set d_int64_t
 eval $setvar
 
 
@@ -5224,31 +5447,6 @@ EOM
        ;;
 esac
 
-case "$use64bitall" in
-"$define"|true|[yY]*)
-       case "$ptrsize" in
-       4)      cat <<EOM >&4
-
-*** You have chosen a maximally 64-bit build, but your pointers
-*** are only 4 bytes wide, disabling maximal 64-bitness.
-
-EOM
-               use64bitall="$undef"
-               case "$use64bitint" in
-               "$define"|true|[yY]*) ;;
-               *)      cat <<EOM >&4
-
-*** Downgrading from maximal 64-bitness to using 64-bit integers.
-
-EOM
-                       use64bitint="$define"
-                       ;;
-               esac
-               ;;
-       esac
-       ;;
-esac
-
 case "$use64bitint" in
 "$define"|true|[yY]*)
 : Look for a hint-file generated 'call-back-unit'.  If the
@@ -5285,4928 +5483,6516 @@ case "$use64bitall" in
        ;;
 esac
 
+case "$d_quad:$use64bitint" in
+$undef:$define)
+       cat >&4 <<EOF
+
+*** You have chosen to use 64-bit integers,
+*** but none cannot be found.
+*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
+*** Cannot continue, aborting.
+
+EOF
+       exit 1
+       ;;
+esac
+
+: check for length of double
 echo " "
-echo "Checking for GNU C Library..." >&4
-cat >try.c <<EOM
+case "$doublesize" in
+'')
+       echo "Checking to see how big your double precision numbers are..." >&4
+       $cat >try.c <<EOCP
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 int main()
 {
-#ifdef __GLIBC__
+    printf("%d\n", (int)sizeof(double));
     exit(0);
-#else
-    exit(1);
-#endif
 }
-EOM
+EOCP
+       set try
+       if eval $compile_ok; then
+               doublesize=`$run ./try`
+               echo "Your double is $doublesize bytes long."
+       else
+               dflt='8'
+               echo "(I can't seem to compile the test program.  Guessing...)"
+               rp="What is the size of a double precision number (in bytes)?"
+               . ./myread
+               doublesize="$ans"
+       fi
+       ;;
+esac
+$rm -f try.c try
+
+: check for long doubles
+echo " "
+echo "Checking to see if you have long double..." >&4
+echo 'int main() { long double x = 7.0; }' > try.c
 set try
-if eval $compile_ok && $run ./try; then
+if eval $compile; then
        val="$define"
-       echo "You are using the GNU C Library"
+       echo "You have long double."
 else
        val="$undef"
-       echo "You are not using the GNU C Library"
+       echo "You do not have long double."
 fi
-$rm -f try try.*
-set d_gnulibc
+$rm try.*
+set d_longdbl
 eval $setvar
 
-: see if nm is to be used to determine whether a symbol is defined or not
-case "$usenm" in
-'')
-       dflt=''
-       case "$d_gnulibc" in
-       "$define")
+: check for length of long double
+case "${d_longdbl}${longdblsize}" in
+$define)
+       echo " "
+       echo "Checking to see how big your long doubles are..." >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+       printf("%d\n", sizeof(long double));
+}
+EOCP
+       set try
+       set try
+       if eval $compile; then
+               longdblsize=`$run ./try`
+               echo "Your long doubles are $longdblsize bytes long."
+       else
+               dflt='8'
                echo " "
-               echo "nm probably won't work on the GNU C Library." >&4
-               dflt=n
-               ;;
-       esac
-       case "$dflt" in
-       '') 
-               if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
-                       echo " "
-                       echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
-                       echo "'nm' won't be sufficient on this sytem." >&4
-                       dflt=n
-               fi
-               ;;
-       esac
-       case "$dflt" in
-       '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
-               if $test $dflt -gt 20; then
-                       dflt=y
-               else
-                       dflt=n
-               fi
-               ;;
-       esac
-       ;;
-*)
-       case "$usenm" in
-       true|$define) dflt=y;;
-       *) dflt=n;;
-       esac
+               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
-$cat <<EOM
-
-I can use $nm to extract the symbols from your C libraries. This
-is a time consuming task which may generate huge output on the disk (up
-to 3 megabytes) but that should make the symbols extraction faster. The
-alternative is to skip the 'nm' extraction part and to compile a small
-test program instead to determine whether each symbol is present. If
-you have a fast C compiler and/or if your 'nm' output cannot be parsed,
-this may be the best solution.
-
-You probably shouldn't let me use 'nm' if you are using the GNU C Library.
+$rm -f try.* try
 
-EOM
-rp="Shall I use $nm to extract C symbols from the libraries?"
-. ./myread
-case "$ans" in
-[Nn]*) usenm=false;;
-*) usenm=true;;
+: 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
-
-runnm=$usenm
-case "$reuseval" in
-true) runnm=false;;
+case "$targetarch" in
+'') ;;
+*)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
 esac
-
-: nm options which may be necessary
-case "$nm_opt" in
-'') if $test -f /mach_boot; then
-               nm_opt=''       # Mach
-       elif $test -d /usr/ccs/lib; then
-               nm_opt='-p'     # Solaris (and SunOS?)
-       elif $test -f /dgux; then
-               nm_opt='-p'     # DG-UX
-       elif $test -f /lib64/rld; then
-               nm_opt='-p'     # 64-bit Irix
-       else
-               nm_opt=''
-       fi;;
+myarchname="$tarch"
+case "$archname" in
+'') dflt="$tarch";;
+*) dflt="$archname";;
 esac
-
-: nm options which may be necessary for shared libraries but illegal
-: for archive libraries.  Thank you, Linux.
-case "$nm_so_opt" in
-'')    case "$myuname" in
-       *linux*)
-               if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
-                       nm_so_opt='--dynamic'
-               fi
-               ;;
-       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 "$runnm" in
-true)
-: get list of predefined functions in a handy place
-echo " "
-case "$libc" in
-'') libc=unknown
-       case "$libs" in
-       *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
-       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 "$libs" in
-'') ;;
-*)  for thislib in $libs; do
-       case "$thislib" in
-       -lc|-lc_s)
-               : Handle C library specially below.
+case "$use64bitint$use64bitall" in
+*"$define"*)
+       case "$archname64" in
+       '')
+               echo "This architecture is naturally 64-bit, not changing architecture name." >&4
                ;;
-       -l*)
-               thislib=`echo $thislib | $sed -e 's/^-l//'`
-               if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
-                       :
-               elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
-                       :
-               elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
-                       :
-               elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
-                       :
-               elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
-                       :
-               elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
-                       :
-               elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
-                       :
-               else
-                       try=''
-               fi
-               libnames="$libnames $try"
+       *)
+               case "$use64bitint" in
+               "$define") echo "64 bit integers selected." >&4 ;;
+               esac
+               case "$use64bitall" in
+               "$define") echo "Maximal 64 bitness selected." >&4 ;;
+               esac
+               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
+case "$uselongdouble" in
+$define)
+       echo "Long doubles selected." >&4
+       case "$longdblsize" in
+       $doublesize)
+               echo "...but long doubles are equal to doubles, not changing architecture name." >&4
+               ;;
+       *)
+               case "$archname" in
+               *-ld*) echo "...and architecture name already has -ld." >&4
+                       ;;
+               *)      archname="$archname-ld"
+                       echo "...setting architecture name to $archname." >&4
+                       ;;
+               esac
                ;;
-       *) libnames="$libnames $thislib" ;;
        esac
-       done
        ;;
 esac
-xxx=normal
-case "$libc" in
-unknown)
-       set /lib/libc.$so
-       for xxx in $libpth; do
-               $test -r $1 || set $xxx/libc.$so
-               : The messy sed command sorts on library version numbers.
-               $test -r $1 || \
-                       set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
-                       tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
-                               h
-                               s/[0-9][0-9]*/0000&/g
-                               s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
-                               G
-                               s/\n/ /' | \
-                        $sort | $sed -e 's/^.* //'`
-               eval set \$$#
-       done
-       $test -r $1 || set /usr/ccs/lib/libc.$so
-       $test -r $1 || set /lib/libsys_s$_a
+case "$useperlio" in
+$define)
+       echo "Perlio selected." >&4
        ;;
 *)
-       set blurfl
+       echo "Perlio not selected, using stdio." >&4
+       case "$archname" in
+        *-stdio*) echo "...and architecture name already has -stdio." >&4
+                ;;
+        *)      archname="$archname-stdio"
+                echo "...setting architecture name to $archname." >&4
+                ;;
+        esac
        ;;
 esac
-if $test -r "$1"; then
-       echo "Your (shared) C library seems to be in $1."
-       libc="$1"
-elif $test -r /lib/libc && $test -r /lib/clib; then
-       echo "Your C library seems to be in both /lib/clib and /lib/libc."
-       xxx=apollo
-       libc='/lib/clib /lib/libc'
-       if $test -r /lib/syslib; then
-               echo "(Your math library is in /lib/syslib.)"
-               libc="$libc /lib/syslib"
-       fi
-elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
-       echo "Your C library seems to be in $libc, as you said before."
-elif $test -r $incpath/usr/lib/libc$_a; then
-       libc=$incpath/usr/lib/libc$_a;
-       echo "Your C library seems to be in $libc.  That's fine."
-elif $test -r /lib/libc$_a; then
-       libc=/lib/libc$_a;
-       echo "Your C library seems to be in $libc.  You're normal."
-else
-       if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
-               :
-       elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
-               libnames="$libnames "`./loc clib blurfl/dyick $libpth`
-       elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
-               :
-       elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
-               :
-       elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
-               :
-       else
-               tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
-       fi
-       if $test -r "$tans"; then
-               echo "Your C library seems to be in $tans, of all places."
-               libc=$tans
-       else
-               libc='blurfl'
-       fi
+if $test -f archname.cbu; then
+       echo "Your platform has some specific hints for architecture name, using them..."
+       . ./archname.cbu
 fi
-if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
-       dflt="$libc"
-       cat <<EOM
-
-If the guess above is wrong (which it might be if you're using a strange
-compiler, or your machine supports multiple models), you can override it here.
-
-EOM
-else
-       dflt=''
-       echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
-       cat >&4 <<EOM
-I can't seem to find your C library.  I've looked in the following places:
 
-EOM
-       $sed 's/^/      /' libpath
-       cat <<EOM
+: determine root of directory hierarchy where package will be installed.
+case "$prefix" in
+'')
+       dflt=`./loc . /usr/local /usr/local /local /opt /usr`
+       ;;
+*?/)
+       dflt=`echo "$prefix" | sed 's/.$//'`
+       ;;
+*)
+       dflt="$prefix"
+       ;;
+esac
+$cat <<EOM
 
-None of these seems to contain your C library. I need to get its name...
+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
-fi
-fn=f
-rp='Where is your C library?'
+fn=d~
+rp='Installation prefix to use?'
 . ./getfile
-libc="$ans"
+oldprefix=''
+case "$prefix" in
+'') ;;
+*)
+       case "$ans" in
+       "$prefix") ;;
+       *) oldprefix="$prefix";;
+       esac
+       ;;
+esac
+prefix="$ans"
+prefixexp="$ansexp"
 
-echo " "
-echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
-set X `cat libnames`
-shift
-xxx=files
-case $# in 1) xxx=file; esac
-echo "Extracting names from the following $xxx for later perusal:" >&4
-echo " "
-$sed 's/^/     /' libnames >&4
-echo " "
-$echo $n "This may take a while...$c" >&4
-
-for file in $*; do
-       case $file in
-       *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
-       *) $nm $nm_opt $file 2>/dev/null;;
-       esac
-done >libc.tmp
+case "$afsroot" in
+'')    afsroot=/afs ;;
+*)     afsroot=$afsroot ;;
+esac
 
-$echo $n ".$c"
-$grep fprintf libc.tmp > libc.ptf
-xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
-xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
-xxx='[ADTSIW]'
-if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
-                               -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
-       eval $xscan;\
-       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-               eval $xrun
-else
-       $nm -p $* 2>/dev/null >libc.tmp
-       $grep fprintf libc.tmp > libc.ptf
-       if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
-               eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
-       then
-               nm_opt='-p'
-               eval $xrun
+: is AFS running?
+echo " "
+case "$afs" in
+$define|true)  afs=true ;;
+$undef|false)  afs=false ;;
+*)     if test -d $afsroot; then
+               afs=true
        else
-               echo " "
-               echo "$nm didn't seem to work right. Trying $ar instead..." >&4
-               com=''
-               if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
-                       for thisname in $libnames $libc; do
-                               $ar t $thisname >>libc.tmp
-                       done
-                       $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
-                       echo "Ok." >&4
-               elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
-                       # Repeat libc to extract forwarders to DLL entries too
-                       for thisname in $libnames $libc; do
-                               $ar tv $thisname >>libc.tmp
-                               # Revision 50 of EMX has bug in $ar.
-                               # it will not extract forwarders to DLL entries
-                               # Use emximp which will extract exactly them.
-                               emximp -o tmp.imp $thisname \
-                                   2>/dev/null && \
-                                   $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
-                                   < tmp.imp >>libc.tmp
-                               $rm tmp.imp
-                       done
-                       $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
-                       echo "Ok." >&4
-               else
-                       echo "$ar didn't seem to work right." >&4
-                       echo "Maybe this is a Cray...trying bld instead..." >&4
-                       if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
-                       then
-                               for thisname in $libnames; do
-                                       bld t $libnames | \
-                                       $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
-                                       $ar t $thisname >>libc.tmp
-                               done
-                               echo "Ok." >&4
-                       else
-                               echo "That didn't work either.  Giving up." >&4
-                               exit 1
-                       fi
-               fi
+               afs=false
        fi
-fi
-nm_extract="$com"
-if $test -f /lib/syscalls.exp; then
-       echo " "
-       echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
-       $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
-fi
-;;
+       ;;
 esac
-$rm -f libnames libpath
+if $afs; then
+       echo "AFS may be running... I'll be extra cautious then..." >&4
+else
+       echo "AFS does not seem to be running..." >&4
+fi
 
-: is a C symbol defined?
-csym='tlook=$1;
-case "$3" in
--v) tf=libc.tmp; tc=""; tdc="";;
--a) tf=libc.tmp; tc="[0]"; tdc="[]";;
-*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
-esac;
-tx=yes;
-case "$reuseval-$4" in
-true-) ;;
-true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
-esac;
-case "$tx" in
-yes)
-       case "$runnm" in
-       true)
-               if $contains $tlook $tf >/dev/null 2>&1;
-               then tval=true;
-               else tval=false;
-               fi;;
-       *)
-               echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
-               if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
-               then tval=true;
-               else tval=false;
-               fi;
-               $rm -f t t.c;;
-       esac;;
-*)
-       case "$tval" in
-       $define) tval=true;;
-       *) tval=false;;
-       esac;;
-esac;
-eval "$2=$tval"'
+: determine installation prefix for where package is to be installed.
+if $afs; then 
+$cat <<EOM
 
-: define an is-in-libc? function
-inlibc='echo " "; td=$define; tu=$undef;
-sym=$1; var=$2; eval "was=\$$2";
-tx=yes;
-case "$reuseval$was" in
-true) ;;
-true*) tx=no;;
-esac;
-case "$tx" in
-yes)
-       set $sym tres -f;
-       eval $csym;
-       case "$tres" in
-       true)
-               echo "$sym() found." >&4;
-               case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
+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).
+
+EOM
+       case "$installprefix" in
+       '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
+       *) dflt="$installprefix";;
+       esac
+else
+$cat <<EOM
+
+In some special cases, particularly when building $package for distribution,
+it is convenient to distinguish 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.
+
+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"
+
+: set the prefixit variable, to compute a suitable default value
+prefixit='case "$3" in
+""|none)
+       case "$oldprefix" in
+       "") eval "$1=\"\$$2\"";;
        *)
-               echo "$sym() NOT found." >&4;
-               case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
+               case "$3" in
+               "") eval "$1=";;
+               none)
+                       eval "tp=\"\$$2\"";
+                       case "$tp" in
+                       ""|" ") eval "$1=\"\$$2\"";;
+                       *) eval "$1=";;
+                       esac;;
+               esac;;
        esac;;
 *)
-       case "$was" in
-       $define) echo "$sym() found." >&4;;
-       *) echo "$sym() NOT found." >&4;;
+       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'
 
-: see if sqrtl exists
-set sqrtl d_sqrtl
-eval $inlibc
-
-: check for length of double
+: get the patchlevel
 echo " "
-case "$doublesize" in
-'')
-       echo "Checking to see how big your double precision numbers are..." >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-    printf("%d\n", (int)sizeof(double));
-    exit(0);
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               doublesize=`$run ./try`
-               echo "Your double is $doublesize bytes long."
-       else
-               dflt='8'
-               echo "(I can't seem to compile the test program.  Guessing...)"
-               rp="What is the size of a double precision number (in bytes)?"
-               . ./myread
-               doublesize="$ans"
+echo "Getting the current patchlevel..." >&4
+if $test -r $rsrc/patchlevel.h;then
+       revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
+       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`
+       perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
+else
+       revision=0
+       patchlevel=0
+       subversion=0
+       api_revision=0
+       api_version=0
+       api_subversion=0
+       perl_patchlevel=0
+       $echo "(You do not have patchlevel.h.  Eek.)"
+fi
+if $test -r $rsrc/.patch ; then  
+       if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
+               perl_patchlevel=`cat $rsrc/.patch`
        fi
+fi
+: Define a handy string here to avoid duplication in myconfig.SH and configpm.
+version_patchlevel_string="version $patchlevel subversion $subversion"
+case "$perl_patchlevel" in
+0|'') ;;
+*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
+esac
+
+$echo "(You have $package $version_patchlevel_string.)"
+
+case "$osname" in
+dos|vms)
+       : XXX Should be a Configure test for double-dots in filenames.
+       version=`echo $revision $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 }'`
+       ;;
+*)
+       version=`echo $revision $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
-$rm -f try.c try
+: 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
 
-: check for long doubles
-echo " "
-echo "Checking to see if you have long double..." >&4
-echo 'int main() { long double x = 7.0; }' > try.c
-set try
-if eval $compile; then
-       val="$define"
-       echo "You have long double."
+: 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="$installstyle" ;;
+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
+
+: 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
+
+There are some auxiliary files for $package that need to be put into a
+private library directory that is accessible by everyone.
+
+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
-       val="$undef"
-       echo "You do not have long double."
+       installprivlib="$privlibexp"
 fi
-$rm try.*
-set d_longdbl
-eval $setvar
 
-: check for length of long double
-case "${d_longdbl}${longdblsize}" in
-$define)
-       echo " "
-       echo "Checking to see how big your long doubles are..." >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-       printf("%d\n", sizeof(long double));
-}
-EOCP
-       set try
-       set try
-       if eval $compile; then
-               longdblsize=`$run ./try`
-               echo "Your long doubles are $longdblsize bytes long."
-       else
-               dflt='8'
-               echo " "
-               echo "(I can't seem to compile the test program.  Guessing...)" >&4
-               rp="What is the size of a long double (in bytes)?"
-               . ./myread
-               longdblsize="$ans"
-       fi
-       if $test "X$doublesize" = "X$longdblsize"; then
-               echo "(That isn't any different from an ordinary double.)"
-       fi      
+: 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
-$rm -f try.* try
+$cat <<EOM
 
-echo " "
+$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.
 
-if $test X"$d_longdbl" = X"$define"; then
+EOM
+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
 
-echo "Checking how to print long doubles..." >&4
+: see if setuid scripts can be secure
+$cat <<EOM
 
-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=`$run ./try`
-               case "$yyy" in
-               123.456)
-                       sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
-                       sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
-                       echo "We will use %f."
-                       ;;
-               esac
-       fi
-fi
+Some kernels have a bug that prevents setuid #! scripts from being
+secure.  Some sites have disabled setuid #! scripts because of this.
 
-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=`$run ./try`
-               case "$yyy" in
-               123.456)
-                       sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
-                       sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
-                       echo "We will use %Lf."
-                       ;;
-               esac
-       fi
-fi
+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.)
 
-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=`$run ./try`
-               case "$yyy" in
-               123.456)
-                       sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
-                       sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
-                       echo "We will use %llf."
+EOM
+
+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
                        ;;
-               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=`$run ./try`
-               case "$yyy" in
-               123.456)
-                       sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
-                       sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
-                       echo "We will use %lf."
+               *)
+                       $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
        fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
-       echo "Cannot figure out how to print long doubles." >&4
 else
-       sSCNfldbl=$sPRIfldbl    # expect consistency
+       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
 
-$rm -f try try.*
-
-fi # d_longdbl
+$rm -f reflect flect
 
-case "$sPRIfldbl" in
-'')    d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
-       d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
-       d_SCNfldbl="$undef";
-       ;;
-*)     d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
-       d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
-       d_SCNfldbl="$define";
+: 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
        ;;
-esac
-
-: see if modfl exists
-set modfl d_modfl
-eval $inlibc
-
-d_modfl_pow32_bug="$undef"
-
-case "$d_longdbl$d_modfl" in
-$define$define)
+*)
        $cat <<EOM
-Checking to see whether your modfl() is okay for large values...
+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
-$cat >try.c <<EOCP
-#include <math.h> 
-#include <stdio.h>
-int main() {
-    long double nv = 4294967303.15;
-    long double v, w;
-    v = modfl(nv, &w);         
-#ifdef __GLIBC__
-    printf("glibc");
-#endif
-    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
-    return 0;
-}
-EOCP
-       case "$osname:$gccversion" in
-       aix:)   saveccflags="$ccflags"
-               ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
+       case "$d_dosuid" in
+       "$define") dflt=y ;;
+       *) dflt=n ;;
        esac
-       set try
-       if eval $compile; then
-               foo=`$run ./try`
-               case "$foo" in
-               *" 4294967303.150000 1.150000 4294967302.000000")
-                       echo >&4 "Your modfl() is broken for large values."
-                       d_modfl_pow32_bug="$define"
-                       case "$foo" in
-                       glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
-                       ;;
-                       esac
-                       ;;
-               *" 4294967303.150000 0.150000 4294967303.000000")
-                       echo >&4 "Your modfl() seems okay for large values."
-                       ;;
-               *)      echo >&4 "I don't understand your modfl() at all."
-                       d_modfl="$undef"
-                       ;;
-               esac
-               $rm -f try.* try core core.try.*
-       else
-               echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
-               d_modfl="$undef"
-       fi
-       case "$osname:$gccversion" in
-       aix:)   ccflags="$saveccflags" ;; # restore
+       rp="Do you want to do setuid/setgid emulation?"
+       . ./myread
+       case "$ans" in
+       [yY]*)  val="$define";;
+       *)      val="$undef";;
        esac
        ;;
 esac
+set d_dosuid
+eval $setvar
 
-case "$ccflags" in
-*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
-esac
-
-case "$uselongdouble" in
-$define|true|[yY]*)    dflt='y';;
-*) dflt='n';;
-esac
-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 '$dflt'.
-EOM
-rp='Try to use long doubles if available?'
-. ./myread
-case "$ans" in
-y|Y)   val="$define"   ;;
-*)      val="$undef"   ;;
-esac
-set uselongdouble
+: see if this is a malloc.h system
+: we want a real compile instead of Inhdr because some systems have a
+: malloc.h that just gives a compile error saying to use stdlib.h instead
+echo " "
+$cat >try.c <<EOCP
+#include <stdlib.h>
+#include <malloc.h>
+int main () { return 0; }
+EOCP
+set try
+if eval $compile; then
+    echo "<malloc.h> found." >&4
+    val="$define"
+else
+    echo "<malloc.h> NOT found." >&4
+    val="$undef"
+fi
+$rm -f try.c try
+set i_malloc
 eval $setvar
 
-case "$uselongdouble" in
-true|[yY]*) uselongdouble="$define" ;;
+: check for void type
+echo " "
+echo "Checking to see how well your C compiler groks the void type..." >&4
+case "$voidflags" in
+'')
+       $cat >try.c <<EOCP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#if TRY & 1
+void sub() {
+#else
+sub() {
+#endif
+       extern void moo();      /* function returning void */
+       void (*goo)();          /* ptr to func returning void */
+#if TRY & 8
+       void *hue;              /* generic ptr */
+#endif
+#if TRY & 2
+       void (*foo[10])();
+#endif
+
+#if TRY & 4
+       if(goo == moo) {
+               exit(0);
+       }
+#endif
+       exit(0);
+}
+int main() { sub(); }
+EOCP
+       if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
+               voidflags=$defvoidused
+       echo "Good.  It appears to support void to the level $package wants.">&4
+               if $contains warning .out >/dev/null 2>&1; then
+                       echo "However, you might get some warnings that look like this:"
+                       $cat .out
+               fi
+       else
+echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
+               if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
+                       echo "It supports 1..."
+                       if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
+                               echo "It also supports 2..."
+                               if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
+                                       voidflags=7
+                                       echo "And it supports 4 but not 8 definitely."
+                               else
+                                       echo "It doesn't support 4..."
+                                       if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
+                                               voidflags=11
+                                               echo "But it supports 8."
+                                       else
+                                               voidflags=3
+                                               echo "Neither does it support 8."
+                                       fi
+                               fi
+                       else
+                               echo "It does not support 2..."
+                               if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
+                                       voidflags=13
+                                       echo "But it supports 4 and 8."
+                               else
+                                       if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
+                                               voidflags=5
+                                               echo "And it supports 4 but has not heard about 8."
+                                       else
+                                               echo "However it supports 8 but not 4."
+                                       fi
+                               fi
+                       fi
+               else
+                       echo "There is no support at all for void."
+                       voidflags=0
+               fi
+       fi
 esac
-
-case "$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.)
+case "$voidflags" in
+"$defvoidused") ;;
+*)     $cat >&4 <<'EOM'
+  Support flag bits are:
+    1: basic void declarations.
+    2: arrays of pointers to functions returning void.
+    4: operations between pointers to and addresses of void functions.
+    8: generic void pointers.
 EOM
-       fi
+       dflt="$voidflags";
+       rp="Your void support flags add up to what?"
+       . ./myread
+       voidflags="$ans"
        ;;
 esac
+$rm -f try.* .out
 
-message=X
-case "$uselongdouble:$d_sqrtl:$d_modfl" in
-$define:$define:$define)
-       : You have both
-       ;;
-$define:$define:$undef)
-       message="I could not find modfl"
-       ;;
-$define:$undef:$define)
-       message="I could not find sqrtl"
-       ;;
-$define:$undef:$undef)
-       message="I found neither sqrtl nor modfl"
+: check for length of pointer
+echo " "
+case "$ptrsize" in
+'')
+       echo "Checking to see how big your pointers are..." >&4
+       if test "$voidflags" -gt 7; then
+               echo '#define VOID_PTR char *' > try.c
+       else
+               echo '#define VOID_PTR void *' > try.c
+       fi
+       $cat >>try.c <<EOCP
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+int main()
+{
+    printf("%d\n", (int)sizeof(VOID_PTR));
+    exit(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               ptrsize=`$run ./try`
+               echo "Your pointers are $ptrsize bytes long."
+       else
+               dflt='4'
+               echo "(I can't seem to compile the test program.  Guessing...)" >&4
+               rp="What is the size of a pointer (in bytes)?"
+               . ./myread
+               ptrsize="$ans"
+       fi
        ;;
 esac
+$rm -f try.c try
+case "$use64bitall" in
+"$define"|true|[yY]*)
+       case "$ptrsize" in
+       4)      cat <<EOM >&4
 
-if $test "$message" != X; then
-       $cat <<EOM >&4
-
-*** You requested the use of long doubles but you do not seem to have
-*** the mathematic functions for long doubles.
-*** ($message)
-*** I'm disabling the use of long doubles.
-
+*** You have chosen a maximally 64-bit build,
+*** but your pointers are only 4 bytes wide.
+*** Please rerun Configure without -Duse64bitall.
 EOM
-
-       uselongdouble=$undef
-fi
-
-case "$useperlio" in
-$define|true|[yY]*|'') dflt='y';;
-*) dflt='n';;
-esac
-cat <<EOM
-
-Previous version of $package used the standard IO mechanisms as
-defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
-alternate IO mechanisms via the PerlIO abstraction layer, but the
-stdio mechanism is still available if needed.  The abstraction layer
-can use AT&T's sfio (if you already have sfio installed) or regular stdio.
-Using PerlIO with sfio may cause problems with some extension modules.
-
-If this doesn't make any sense to you, just accept the default '$dflt'.
+               case "$d_quad" in
+               define)
+                       cat <<EOM >&4
+*** Since you have quads, you could possibly try with -Duse64bitint.
 EOM
-rp='Use the PerlIO abstraction layer?'
-. ./myread
-case "$ans" in
-y|Y) 
-       val="$define"
-       ;;
-*)      
-       echo "Ok, doing things the stdio way."
-       val="$undef"
-       ;;
-esac
-set useperlio
-eval $setvar 
-
-case "$usesocks" in
-$define|true|[yY]*)
-       case "$useperlio" in
-       $define|true|[yY]*) ;;
-       *)      cat >&4 <<EOM
-
-You are using the SOCKS proxy protocol library which means that you
-should also use the PerlIO layer.  You may be headed for trouble.
+                       ;;
+               esac
+               cat <<EOM >&4
+*** Cannot continue, aborting.
 
 EOM
+
+               exit 1
                ;;
        esac
        ;;
 esac
 
-       
-: determine the architecture name
+
+: determine which malloc to compile in
 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=''
+case "$usemymalloc" in
+[yY]*|true|$define)    dflt='y' ;;
+[nN]*|false|$undef)    dflt='n' ;;
+*)     case "$ptrsize" in
+       4) dflt='y' ;;
+       *) dflt='n' ;;
+       esac
        ;;
 esac
-case "$targetarch" in
-'') ;;
-*)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
-esac
-myarchname="$tarch"
-case "$archname" in
-'') dflt="$tarch";;
-*) dflt="$archname";;
-esac
-rp='What is your architecture name'
+rp="Do you wish to attempt to use the malloc that comes with $package?"
 . ./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
+usemymalloc="$ans"
+case "$ans" in
+y*|true)
+       usemymalloc='y'
+       mallocsrc='malloc.c'
+       mallocobj="malloc$_o"
+       d_mymalloc="$define"
+       case "$libs" in
+       *-lmalloc*)
+               : Remove malloc from list of libraries to use
+               echo "Removing unneeded -lmalloc from library list" >&4
+               set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
+               shift
+               libs="$*"
+               echo "libs = $libs" >&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
+*)
+       usemymalloc='n'
+       mallocsrc=''
+       mallocobj=''
+       d_mymalloc="$undef"
        ;;
 esac
-case "$use64bitint$use64bitall" in
-*"$define"*)
-       case "$archname64" in
-       '')
-               echo "This architecture is naturally 64-bit, not changing architecture name." >&4
-               ;;
-       *)
-               case "$use64bitint" in
-               "$define") echo "64 bit integers selected." >&4 ;;
-               esac
-               case "$use64bitall" in
-               "$define") echo "Maximal 64 bitness selected." >&4 ;;
-               esac
-               case "$archname" in
-               *-$archname64*) echo "...and architecture name already has $archname64." >&4
-                       ;;
-               *)      archname="$archname-$archname64"
-                       echo "...setting architecture name to $archname." >&4
-                       ;;
-               esac
-               ;;
-       esac
+
+: compute the return types of malloc and free
+echo " "
+$cat >malloc.c <<END
+#$i_malloc I_MALLOC
+#$i_stdlib I_STDLIB
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef I_MALLOC
+#include <malloc.h>
+#endif
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#ifdef TRY_MALLOC
+void *malloc();
+#endif
+#ifdef TRY_FREE
+void free();
+#endif
+END
+case "$malloctype" in
+'')
+       if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
+               malloctype='void *'
+       else
+               malloctype='char *'
+       fi
+       ;;
 esac
-case "$uselongdouble" in
-$define)
-       echo "Long doubles selected." >&4
-       case "$longdblsize" in
-       $doublesize)
-               echo "...but long doubles are equal to doubles, not changing architecture name." >&4
-               ;;
-       *)
-               case "$archname" in
-               *-ld*) echo "...and architecture name already has -ld." >&4
-                       ;;
-               *)      archname="$archname-ld"
-                       echo "...setting architecture name to $archname." >&4
-                       ;;
-               esac
-               ;;
+echo "Your system wants malloc to return '$malloctype', it would seem." >&4
+
+case "$freetype" in
+'')
+       if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
+               freetype='void'
+       else
+               freetype='int'
+       fi
+       ;;
+esac
+echo "Your system uses $freetype free(), it would seem." >&4
+$rm -f malloc.[co]
+$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
+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
+: XXX Prefixit unit does not yet support siteprefix and vendorprefix
+oldsiteprefix=''
+case "$siteprefix" in
+'') ;;
+*)     case "$ans" in
+       "$prefix") ;;
+       *) oldsiteprefix="$prefix";;
        esac
        ;;
 esac
-case "$useperlio" in
-$define)
-       echo "Perlio selected." >&4
+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 "$sitelib" in
+'') case "$installstyle" in
+       *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
+       *)       dflt=$siteprefix/lib/site_$prog/$version ;;
+       esac
        ;;
-*)
-       echo "Perlio not selected, using stdio." >&4
-       case "$archname" in
-        *-stdio*) echo "...and architecture name already has -stdio." >&4
-                ;;
-        *)      archname="$archname-stdio"
-                echo "...setting architecture name to $archname." >&4
-                ;;
-        esac
+*)     dflt="$sitelib"
        ;;
 esac
+$cat <<EOM
 
-: determine root of directory hierarchy where package will be installed.
-case "$prefix" in
-'')
-       dflt=`./loc . /usr/local /usr/local /local /opt /usr`
+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"
+sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
+else
+       installsitelib="$sitelibexp"
+fi
+
+: 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.
+case "$sitearch" in
+'')    dflt=`echo $sitelib | $sed 's,/share$,,'`
+       dflt="$dflt/$archname"
        ;;
-*)
-       dflt="$prefix"
+*)     dflt="$sitearch"
        ;;
 esac
+set sitearch sitearch none
+eval $prefixit
 $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 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.
+The installation process will also create a directory for
+architecture-dependent site-specific extensions and modules.
 
 EOM
-fn=d~
-rp='Installation prefix to use?'
+fn=d~+
+rp='Pathname for the site-specific architecture-dependent library files?'
 . ./getfile
-oldprefix=''
-case "$prefix" in
-'') ;;
-*)
-       case "$ans" in
-       "$prefix") ;;
-       *) oldprefix="$prefix";;
+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
+
+$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 ;;
+*)     : User may have set vendorprefix directly on Configure command line.
+       case "$vendorprefix" in
+       ''|' ') dflt=n ;;
+       *)      dflt=y ;;
        esac
        ;;
 esac
-prefix="$ans"
-prefixexp="$ansexp"
+. ./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
+       : XXX Prefixit unit does not yet support siteprefix and vendorprefix
+       oldvendorprefix=''
+       case "$vendorprefix" in
+       '') ;;
+       *)      case "$ans" in
+               "$prefix") ;;
+               *) oldvendorprefix="$prefix";;
+               esac
+               ;;
+       esac
+       usevendorprefix="$define"
+       vendorprefix="$ans"
+       vendorprefixexp="$ansexp"
+       ;;
+*)     usevendorprefix="$undef"
+       vendorprefix=''
+       vendorprefixexp=''
+       ;;
+esac
 
-case "$afsroot" in
-'')    afsroot=/afs ;;
-*)     afsroot=$afsroot ;;
+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
+       case "$vendorlib" in
+       '')
+               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
+               ;;
+       *)      dflt="$vendorlib"
+               ;;
+       esac
+       fn=d~+
+       rp='Pathname for the vendor-supplied library files?'
+       . ./getfile
+       vendorlib="$ans"
+       vendorlibexp="$ansexp"
+       ;;
 esac
+vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
+else
+       installvendorlib="$vendorlibexp"
+fi
 
-: is AFS running?
-echo " "
-case "$afs" in
-$define|true)  afs=true ;;
-$undef|false)  afs=false ;;
-*)     if test -d $afsroot; then
-               afs=true
-       else
-               afs=false
-       fi
+case "$vendorprefix" in
+'')    d_vendorarch="$undef"
+       vendorarch=''
+       vendorarchexp=''
+       ;;
+*)     d_vendorarch="$define"
+       : determine where vendor-supplied architecture-dependent libraries go.
+       : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
+       : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
+       : vendorlib may have an optional trailing /share.
+       case "$vendorarch" in
+       '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
+               dflt="$dflt/$archname"
+               ;;
+       *)      dflt="$vendorarch" ;;
+       esac
+       fn=d~+
+       rp='Pathname for vendor-supplied architecture-dependent files?'
+       . ./getfile
+       vendorarch="$ans"
+       vendorarchexp="$ansexp"
        ;;
 esac
-if $afs; then
-       echo "AFS may be running... I'll be extra cautious then..." >&4
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
 else
-       echo "AFS does not seem to be running..." >&4
+       installvendorarch="$vendorarchexp"
 fi
 
-: determine installation prefix for where package is to be installed.
-if $afs; then 
+: Final catch-all directories to search
 $cat <<EOM
 
-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).
-
+Lastly, you can have perl look in other directories for extensions and
+modules in addition to those already specified.
+These directories will be searched after 
+       $sitearch 
+       $sitelib 
 EOM
-       case "$installprefix" in
-       '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installprefix";;
-       esac
-else
+test X"$vendorlib" != "X" && echo '    ' $vendorlib
+test X"$vendorarch" != "X" && echo '   ' $vendorarch
+echo ' '
+case "$otherlibdirs" in
+''|' ') dflt='none' ;;
+*)     dflt="$otherlibdirs" ;;
+esac
 $cat <<EOM
-
-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.
+Enter a colon-separated set of extra paths to include in perl's @INC
+search path, or enter 'none' for no extra paths.
 
 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"
 
-: 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'
+rp='Colon-separated list of additional directories for perl to search?'
+. ./myread
+case "$ans" in
+' '|''|none)   otherlibdirs=' ' ;;     
+*)     otherlibdirs="$ans" ;;
+esac
+case "$otherlibdirs" in
+' ') val=$undef ;;
+*)     val=$define ;;
+esac
+set d_perl_otherlibdirs
+eval $setvar
 
-: get the patchlevel
+: Cruising for prototypes
 echo " "
-echo "Getting the current patchlevel..." >&4
-if $test -r $rsrc/patchlevel.h;then
-       revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
-       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`
-       perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
+echo "Checking out function prototypes..." >&4
+$cat >prototype.c <<EOCP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+int main(int argc, char *argv[]) {
+       exit(0);}
+EOCP
+if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
+       echo "Your C compiler appears to support function prototypes."
+       val="$define"
 else
-       revision=0
-       patchlevel=0
-       subversion=0
-       api_revision=0
-       api_version=0
-       api_subversion=0
-       perl_patchlevel=0
-       $echo "(You do not have patchlevel.h.  Eek.)"
-fi
-if $test -r $rsrc/.patch ; then  
-       if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
-               perl_patchlevel=`cat $rsrc/.patch`
-       fi
+       echo "Your C compiler doesn't seem to understand function prototypes."
+       val="$undef"
 fi
-: Define a handy string here to avoid duplication in myconfig.SH and configpm.
-version_patchlevel_string="version $patchlevel subversion $subversion"
-case "$perl_patchlevel" in
-0|'') ;;
-*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
-esac
+set prototype
+eval $setvar
+$rm -f prototype*
 
-$echo "(You have $package $version_patchlevel_string.)"
+case "$prototype" in
+"$define") ;;
+*)     ansi2knr='ansi2knr'
+       echo " "
+       cat <<EOM >&4
 
-case "$osname" in
-dos|vms)
-       : XXX Should be a Configure test for double-dots in filenames.
-       version=`echo $revision $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 }'`
-       ;;
-*)
-       version=`echo $revision $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 }'`
+$me:  FATAL ERROR:
+This version of $package can only be compiled by a compiler that 
+understands function prototypes.  Unfortunately, your C compiler 
+       $cc $ccflags
+doesn't seem to understand them.  Sorry about that.
+
+If GNU cc is available for your system, perhaps you could try that instead.  
+
+Eventually, we hope to support building Perl with pre-ANSI compilers.
+If you would like to help in that effort, please contact <perlbug@perl.org>.
+
+Aborting Configure now.
+EOM
+       exit 2
        ;;
 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'
+
+: determine where public executables go
+echo " "
+set dflt bin bin
+eval $prefixit
+fn=d~
+rp='Pathname where the public executables will reside?'
+. ./getfile
+if $test "X$ansexp" != "X$binexp"; then
+       installbin=''
+fi
+bin="$ans"
+binexp="$ansexp"
+: 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
 
-: 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="$installstyle" ;;
+echo " "
+case "$extras" in
+'') dflt='n';;
+*) dflt='y';;
 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
+cat <<EOM
+Perl can be built with extra modules or bundles of modules which
+will be fetched from the CPAN and installed alongside Perl.
 
-: 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 ;;
+Notice that you will need access to the CPAN; either via the Internet,
+or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
+be asked later to configure the CPAN.pm module which will in turn do
+the installation of the rest of the extra modules or bundles.)
+
+Notice also that if the modules require any external software such as
+libraries and headers (the libz library and the zlib.h header for the
+Compress::Zlib module, for example) you MUST have any such software
+already installed, this configuration process will NOT install such
+things for you.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+rp='Install any extra modules (y or n)?'
+. ./myread
+case "$ans" in
+y|Y)
+       cat <<EOM
+
+Please list any extra modules or bundles to be installed from CPAN,
+with spaces between the names.  The names can be in any format the
+'install' command of CPAN.pm will understand.  (Answer 'none',
+without the quotes, to install no extra modules or bundles.)
+EOM
+       rp='Extras?'
+       dflt="$extras"
+       . ./myread
+       extras="$ans"
+esac
+case "$extras" in
+''|'none')
+       val=''
+       $rm -f ../extras.lst
+       ;;
+*)     echo "(Saving the list of extras for later...)"
+       echo "$extras" > ../extras.lst
+       val="'$extras'"
+       ;;
 esac
+set extras
+eval $setvar
+echo " "
+
+: determine where html pages for programs go
+set html1dir html1dir none
 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.
-
+If you wish to install html files for programs in $spackage, indicate 
+the appropriate directory here.  To skip installing html files,
+answer "none".
 EOM
-fn=d~+
-rp='Pathname where the private library files will reside?'
+case "$html1dir" in
+''|none|$undef|' ') dflt=none ;;
+*) dflt=$html1dir ;;
+esac
+fn=dn+~
+rp="Directory for the main $spackage html pages?"
 . ./getfile
-privlib="$ans"
-privlibexp="$ansexp"
+html1dir="$ans"
+html1direxp="$ansexp"
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$html1dir" = "X" && html1dir=' '
 : Change installation prefix, if necessary.
 if $test X"$prefix" != X"$installprefix"; then
-       installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
+       installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
 else
-       installprivlib="$privlibexp"
+       installhtml1dir="$html1direxp"
 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
+: determine where html pages for libraries and modules go
+set html3dir html3dir none
 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.
-
+If you wish to install html files for modules associated with $spackage,
+indicate the appropriate directory here.  To skip installing html files,
+answer "none".
 EOM
-fn=d+~
-rp='Where do you want to put the public architecture-dependent libraries?'
+: There is no obvious default.  If they have specified html1dir, then
+: try to key off that, possibly changing .../html1 into .../html3.
+case "$html3dir" in
+'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
+*) dflt=$html3dir ;;
+esac
+fn=dn+~
+rp="Directory for the $spackage module html pages?"
 . ./getfile
-archlib="$ans"
-archlibexp="$ansexp"
-if $test X"$archlib" = X"$privlib"; then
-       d_archlib="$undef"
-else
-       d_archlib="$define"
-fi
+html3dir="$ans"
+html3direxp="$ansexp"
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$html3dir" = "X" && html3dir=' '
 : Change installation prefix, if necessary.
 if $test X"$prefix" != X"$installprefix"; then
-       installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
+       installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
 else
-       installarchlib="$archlibexp"
+       installhtml3dir="$html3direxp"
 fi
 
+: Find perl5.005 or later.
+echo "Looking for a previously installed perl5.005 or later... "
+case "$perl5" in
+'')    for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
+               : Check if this perl is recent and can load a simple module
+               if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
+                       perl5=$tdir/perl
+                       break;
+               elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
+                       perl5=$tdir/perl5
+                       break;
+               fi
+       done
+       ;;
+*)     perl5="$perl5"
+       ;;
+esac
+case "$perl5" in
+'')    echo "None found.  That's ok.";;
+*)     echo "Using $perl5." ;;
+esac
+
+: Determine list of previous versions to include in @INC
+$cat > getverlist <<EOPL
+#!$perl5 -w
+use File::Basename;
+\$api_versionstring = "$api_versionstring";
+\$version = "$version";
+\$stem = "$sitelib_stem";
+\$archname = "$archname";
+EOPL
+       $cat >> getverlist <<'EOPL'
+# Can't have leading @ because metaconfig interprets it as a command!
+;@inc_version_list=();
+# XXX Redo to do opendir/readdir? 
+if (-d $stem) {
+    chdir($stem);
+    ;@candidates = glob("5.*");
+}
+else {
+    ;@candidates = ();
+}
+
+# XXX ToDo:  These comparisons must be reworked when two-digit
+# subversions come along, so that 5.7.10 compares as greater than
+# 5.7.3!  By that time, hope that 5.6.x is sufficiently
+# widespread that we can use the built-in version vectors rather
+# than reinventing them here.  For 5.6.0, however, we must
+# assume this script will likely be run by 5.005_0x.  --AD 1/2000.
+foreach $d (@candidates) {
+    if ($d lt $version) {
+       if ($d ge $api_versionstring) {
+           unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
+       }
+       elsif ($d ge "5.005") {
+           unshift(@inc_version_list, grep { -d } $d);
+       }
+    }
+    else {
+       # Skip newer version.  I.e. don't look in
+       # 5.7.0 if we're installing 5.6.1.
+    }
+}
 
-: Binary compatibility with 5.005 is not possible for builds
-: with advanced features
-case "$usethreads$usemultiplicity" in
-*define*)
-       bincompat5005="$undef"
-       d_bincompat5005="$undef"
+if (@inc_version_list) {
+    print join(' ', @inc_version_list);
+}
+else {
+    # Blank space to preserve value for next Configure run.
+    print " ";
+}
+EOPL
+chmod +x getverlist
+case "$inc_version_list" in
+'')    if test -x "$perl5$exe_ext"; then
+               dflt=`$perl5 getverlist`
+       else
+               dflt='none'
+       fi
        ;;
-*)     $cat <<EOM
+$undef) dflt='none' ;;
+*)  eval dflt=\"$inc_version_list\" ;;
+esac
+case "$dflt" in
+''|' ') dflt=none ;;
+esac
+case "$dflt" in
+5.005) dflt=none ;;
+esac
+$cat <<EOM
 
-This version of Perl 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.
+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.  Answer 'none' to tell perl
+to not search earlier versions.
 
+The default should almost always be sensible, so if you're not sure,
+just accept the default.
 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
+
+rp='List of earlier versions to include in @INC?'
+. ./myread
+case "$ans" in
+[Nn]one|''|' ') inc_version_list=' ' ;;
+*) inc_version_list="$ans" ;;
+esac
+case "$inc_version_list" in
+''|' ') 
+       inc_version_list_init='0';;
+*)     inc_version_list_init=`echo $inc_version_list |
+               $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
        ;;
 esac
+$rm -f getverlist
 
+: determine whether to install perl also as /usr/bin/perl
 
-: see if setuid scripts can be secure
-$cat <<EOM
+echo " "
+if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
+       $cat <<EOM
+Many scripts expect perl to be installed as /usr/bin/perl.
 
-Some kernels have a bug that prevents setuid #! scripts from being
-secure.  Some sites have disabled setuid #! scripts because of this.
+If you want to, I can install the perl you are about to compile
+as /usr/bin/perl (in addition to $bin/perl).
+EOM
+       if test -f /usr/bin/perl; then
+           $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.)
+However, please note that because you already have a /usr/bin/perl,
+overwriting that with a new Perl would very probably cause problems.
+Therefore I'm assuming you don't want to do that (unless you insist).
 
 EOM
-
-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"
+           case "$installusrbinperl" in
+           "$define"|[yY]*)    dflt='y';;
+           *)                  dflt='n';;
+           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'.
+           $cat <<EOM
+
+Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
 
 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
+           case "$installusrbinperl" in
+           "$undef"|[nN]*)     dflt='n';;
+           *)                  dflt='y';;
+           esac
        fi
+       rp="Do you want to install perl as /usr/bin/perl?"
+       . ./myread
+       case "$ans" in
+       [yY]*)  val="$define";;
+       *)      val="$undef" ;;
+       esac
 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
+set installusrbinperl
 eval $setvar
 
-$rm -f reflect flect
-
-: now see if they want to do setuid emulation
 echo " "
-val="$undef"
-case "$d_suidsafe" in
-"$define")
+echo "Checking for GNU C Library..." >&4
+cat >try.c <<'EOCP'
+/* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
+   alone are insufficient to distinguish different versions, such as
+   2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
+   libc version 2.1.0.      A. Dougherty,  June 3, 2002.
+*/
+#include <stdio.h>
+int main(void)
+{
+#ifdef __GLIBC__
+#   ifdef __GLIBC_MINOR__
+#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
+#           include <gnu/libc-version.h>
+           printf("%s\n",  gnu_get_libc_version());
+#       else
+           printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
+#       endif
+#   else
+       printf("%d\n",  __GLIBC__);
+#   endif
+    return 0;
+#else
+    return 1;
+#endif
+}
+EOCP
+set try
+if eval $compile_ok && $run ./try > glibc.ver; then
+       val="$define"
+       gnulibc_version=`$cat glibc.ver`
+       echo "You are using the GNU C Library version $gnulibc_version"
+else
        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.
+       gnulibc_version=''
+       echo "You are not using the GNU C Library"
+fi
+$rm -f try try.* glibc.ver
+set d_gnulibc
+eval $setvar
 
-EOM
-       case "$d_dosuid" in
-       "$define") dflt=y ;;
-       *) dflt=n ;;
+: see if nm is to be used to determine whether a symbol is defined or not
+case "$usenm" in
+'')
+       dflt=''
+       case "$d_gnulibc" in
+       "$define")
+               echo " "
+               echo "nm probably won't work on the GNU C Library." >&4
+               dflt=n
+               ;;
        esac
-       rp="Do you want to do setuid/setgid emulation?"
-       . ./myread
-       case "$ans" in
-       [yY]*)  val="$define";;
-       *)      val="$undef";;
+       case "$dflt" in
+       '') 
+               if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
+                       echo " "
+                       echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
+                       echo "'nm' won't be sufficient on this sytem." >&4
+                       dflt=n
+               fi
+               ;;
+       esac
+       case "$dflt" in
+       '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
+               if $test $dflt -gt 20; then
+                       dflt=y
+               else
+                       dflt=n
+               fi
+               ;;
+       esac
+       ;;
+*)
+       case "$usenm" in
+       true|$define) dflt=y;;
+       *) dflt=n;;
        esac
        ;;
 esac
-set d_dosuid
-eval $setvar
+$cat <<EOM
 
-: see if this is a malloc.h system
-set malloc.h i_malloc
-eval $inhdr
+I can use $nm to extract the symbols from your C libraries. This
+is a time consuming task which may generate huge output on the disk (up
+to 3 megabytes) but that should make the symbols extraction faster. The
+alternative is to skip the 'nm' extraction part and to compile a small
+test program instead to determine whether each symbol is present. If
+you have a fast C compiler and/or if your 'nm' output cannot be parsed,
+this may be the best solution.
 
-: see if stdlib is available
-set stdlib.h i_stdlib
-eval $inhdr
+You probably shouldn't let me use 'nm' if you are using the GNU C Library.
 
-: determine which malloc to compile in
-echo " "
-case "$usemymalloc" in
-[yY]*|true|$define)    dflt='y' ;;
-[nN]*|false|$undef)    dflt='n' ;;
-*)     case "$ptrsize" in
-       4) dflt='y' ;;
-       *) dflt='n' ;;
-       esac
-       ;;
-esac
-rp="Do you wish to attempt to use the malloc that comes with $package?"
+EOM
+rp="Shall I use $nm to extract C symbols from the libraries?"
 . ./myread
-usemymalloc="$ans"
 case "$ans" in
-y*|true)
-       usemymalloc='y'
-       mallocsrc='malloc.c'
-       mallocobj="malloc$_o"
-       d_mymalloc="$define"
-       case "$libs" in
-       *-lmalloc*)
-               : Remove malloc from list of libraries to use
-               echo "Removing unneeded -lmalloc from library list" >&4
-               set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
-               shift
-               libs="$*"
-               echo "libs = $libs" >&4
-               ;;
-       esac
-       ;;
-*)
-       usemymalloc='n'
-       mallocsrc=''
-       mallocobj=''
-       d_mymalloc="$undef"
-       ;;
+[Nn]*) usenm=false;;
+*) usenm=true;;
 esac
 
-: compute the return types of malloc and free
-echo " "
-$cat >malloc.c <<END
-#$i_malloc I_MALLOC
-#$i_stdlib I_STDLIB
-#include <stdio.h>
-#include <sys/types.h>
-#ifdef I_MALLOC
-#include <malloc.h>
-#endif
-#ifdef I_STDLIB
-#include <stdlib.h>
-#endif
-#ifdef TRY_MALLOC
-void *malloc();
-#endif
-#ifdef TRY_FREE
-void free();
-#endif
-END
-case "$malloctype" in
-'')
-       if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
-               malloctype='void *'
-       else
-               malloctype='char *'
-       fi
-       ;;
+runnm=$usenm
+case "$reuseval" in
+true) runnm=false;;
 esac
-echo "Your system wants malloc to return '$malloctype', it would seem." >&4
 
-case "$freetype" in
-'')
-       if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
-               freetype='void'
+: nm options which may be necessary
+case "$nm_opt" in
+'') if $test -f /mach_boot; then
+               nm_opt=''       # Mach
+       elif $test -d /usr/ccs/lib; then
+               nm_opt='-p'     # Solaris (and SunOS?)
+       elif $test -f /dgux; then
+               nm_opt='-p'     # DG-UX
+       elif $test -f /lib64/rld; then
+               nm_opt='-p'     # 64-bit Irix
        else
-               freetype='int'
-       fi
-       ;;
+               nm_opt=''
+       fi;;
 esac
-echo "Your system uses $freetype free(), it would seem." >&4
-$rm -f malloc.[co]
-$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.
+: nm options which may be necessary for shared libraries but illegal
+: for archive libraries.  Thank you, Linux.
+case "$nm_so_opt" in
+'')    case "$myuname" in
+       *linux*)
+               if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
+                       nm_so_opt='--dynamic'
+               fi
+               ;;
+       esac
+       ;;
+esac
 
-EOM
-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 ;;
+case "$runnm" in
+true)
+: get list of predefined functions in a handy place
+echo " "
+case "$libc" in
+'') libc=unknown
+       case "$libs" in
+       *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
+       esac
+       ;;
 esac
-. ./getfile
-: XXX Prefixit unit does not yet support siteprefix and vendorprefix
-oldsiteprefix=''
-case "$siteprefix" in
+case "$libs" in
 '') ;;
-*)     case "$ans" in
-       "$prefix") ;;
-       *) oldsiteprefix="$prefix";;
+*)  for thislib in $libs; do
+       case "$thislib" in
+       -lc|-lc_s)
+               : Handle C library specially below.
+               ;;
+       -l*)
+               thislib=`echo $thislib | $sed -e 's/^-l//'`
+               if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
+                       :
+               elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
+                       :
+               elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
+                       :
+               elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
+                       :
+               elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
+                       :
+               elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
+                       :
+               elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
+                       :
+               else
+                       try=''
+               fi
+               libnames="$libnames $try"
+               ;;
+       *) libnames="$libnames $thislib" ;;
        esac
+       done
        ;;
 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 "$sitelib" in
-'') case "$installstyle" in
-       *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
-       *)       dflt=$siteprefix/lib/site_$prog/$version ;;
-       esac
+xxx=normal
+case "$libc" in
+unknown)
+       set /lib/libc.$so
+       for xxx in $libpth; do
+               $test -r $1 || set $xxx/libc.$so
+               : The messy sed command sorts on library version numbers.
+               $test -r $1 || \
+                       set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
+                       tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
+                               h
+                               s/[0-9][0-9]*/0000&/g
+                               s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
+                               G
+                               s/\n/ /' | \
+                        $sort | $sed -e 's/^.* //'`
+               eval set \$$#
+       done
+       $test -r $1 || set /usr/ccs/lib/libc.$so
+       $test -r $1 || set /lib/libsys_s$_a
        ;;
-*)     dflt="$sitelib"
+*)
+       set blurfl
        ;;
 esac
-$cat <<EOM
+if $test -r "$1"; then
+       echo "Your (shared) C library seems to be in $1."
+       libc="$1"
+elif $test -r /lib/libc && $test -r /lib/clib; then
+       echo "Your C library seems to be in both /lib/clib and /lib/libc."
+       xxx=apollo
+       libc='/lib/clib /lib/libc'
+       if $test -r /lib/syslib; then
+               echo "(Your math library is in /lib/syslib.)"
+               libc="$libc /lib/syslib"
+       fi
+elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
+       echo "Your C library seems to be in $libc, as you said before."
+elif $test -r $incpath/usr/lib/libc$_a; then
+       libc=$incpath/usr/lib/libc$_a;
+       echo "Your C library seems to be in $libc.  That's fine."
+elif $test -r /lib/libc$_a; then
+       libc=/lib/libc$_a;
+       echo "Your C library seems to be in $libc.  You're normal."
+else
+       if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
+               :
+       elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
+               libnames="$libnames "`./loc clib blurfl/dyick $libpth`
+       elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
+               :
+       elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
+               :
+       elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
+               :
+       else
+               tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
+       fi
+       if $test -r "$tans"; then
+               echo "Your C library seems to be in $tans, of all places."
+               libc=$tans
+       else
+               libc='blurfl'
+       fi
+fi
+if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
+       dflt="$libc"
+       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.
+If the guess above is wrong (which it might be if you're using a strange
+compiler, or your machine supports multiple models), you can override it here.
 
 EOM
-fn=d~+
-rp='Pathname for the site-specific library files?'
-. ./getfile
-sitelib="$ans"
-sitelibexp="$ansexp"
-sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
 else
-       installsitelib="$sitelibexp"
-fi
+       dflt=''
+       echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
+       cat >&4 <<EOM
+I can't seem to find your C library.  I've looked in the following places:
 
-: 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.
-case "$sitearch" in
-'')    dflt=`echo $sitelib | $sed 's,/share$,,'`
-       dflt="$dflt/$archname"
-       ;;
-*)     dflt="$sitearch"
-       ;;
-esac
-set sitearch sitearch none
-eval $prefixit
-$cat <<EOM
+EOM
+       $sed 's/^/      /' libpath
+       cat <<EOM
 
-The installation process will also create a directory for
-architecture-dependent site-specific extensions and modules.
+None of these seems to contain your C library. I need to get its name...
 
 EOM
-fn=d~+
-rp='Pathname for the site-specific architecture-dependent library files?'
+fi
+fn=f
+rp='Where is your C library?'
 . ./getfile
-sitearch="$ans"
-sitearchexp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
+libc="$ans"
+
+echo " "
+echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
+set X `cat libnames`
+shift
+xxx=files
+case $# in 1) xxx=file; esac
+echo "Extracting names from the following $xxx for later perusal:" >&4
+echo " "
+$sed 's/^/     /' libnames >&4
+echo " "
+$echo $n "This may take a while...$c" >&4
+
+for file in $*; do
+       case $file in
+       *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
+       *) $nm $nm_opt $file 2>/dev/null;;
+       esac
+done >libc.tmp
+
+$echo $n ".$c"
+$grep fprintf libc.tmp > libc.ptf
+xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
+xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
+xxx='[ADTSIW]'
+if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
+                               -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
+elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
 else
-       installsitearch="$sitearchexp"
+       $nm -p $* 2>/dev/null >libc.tmp
+       $grep fprintf libc.tmp > libc.ptf
+       if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
+               eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
+       then
+               nm_opt='-p'
+               eval $xrun
+       else
+               echo " "
+               echo "$nm didn't seem to work right. Trying $ar instead..." >&4
+               com=''
+               if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
+                       for thisname in $libnames $libc; do
+                               $ar t $thisname >>libc.tmp
+                       done
+                       $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
+                       echo "Ok." >&4
+               elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
+                       # Repeat libc to extract forwarders to DLL entries too
+                       for thisname in $libnames $libc; do
+                               $ar tv $thisname >>libc.tmp
+                               # Revision 50 of EMX has bug in $ar.
+                               # it will not extract forwarders to DLL entries
+                               # Use emximp which will extract exactly them.
+                               emximp -o tmp.imp $thisname \
+                                   2>/dev/null && \
+                                   $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
+                                   < tmp.imp >>libc.tmp
+                               $rm tmp.imp
+                       done
+                       $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
+                       echo "Ok." >&4
+               else
+                       echo "$ar didn't seem to work right." >&4
+                       echo "Maybe this is a Cray...trying bld instead..." >&4
+                       if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
+                       then
+                               for thisname in $libnames; do
+                                       bld t $libnames | \
+                                       $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
+                                       $ar t $thisname >>libc.tmp
+                               done
+                               echo "Ok." >&4
+                       else
+                               echo "That didn't work either.  Giving up." >&4
+                               exit 1
+                       fi
+               fi
+       fi
 fi
+nm_extract="$com"
+case "$PASE" in
+define)
+    echo " "
+    echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
+    dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
+    ;;
+*)  if $test -f /lib/syscalls.exp; then
+       echo " "
+       echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
+       $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
+    fi
+    ;;
+esac
+;;
+esac
+$rm -f libnames libpath
 
-$cat <<EOM
+: see if dld is available
+set dld.h i_dld
+eval $inhdr
 
-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.
+: is a C symbol defined?
+csym='tlook=$1;
+case "$3" in
+-v) tf=libc.tmp; tc=""; tdc="";;
+-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
+*) tlook="^$1\$"; tf=libc.list; tc=""; tdc="()";;
+esac;
+tx=yes;
+case "$reuseval-$4" in
+true-) ;;
+true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
+esac;
+case "$tx" in
+yes)
+       tval=false;
+       if $test "$runnm" = true; then
+               if $contains $tlook $tf >/dev/null 2>&1; then
+                       tval=true;
+               elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
+                       echo "int main() { extern void *$1$tdc; if (&$1$tc) return(0); else return(1); }" > try.c;
+                       $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
+                       $test "$mistrustnm" = run -a -x try && { $run ./try >/dev/null 2>&1 || tval=false; };
+                       $rm -f try try.c core;
+               fi;
+       else
+               echo "#include <stdio.h>" > try.c;
+               echo "int main() { extern void *$1$tdc; if(&$1$tc) return(0); else return(1); }" > try.c;
+               $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
+               $rm -f try try.c;
+       fi;
+       ;;
+*)
+       case "$tval" in
+       $define) tval=true;;
+       *) tval=false;;
+       esac;
+       ;;
+esac;
+eval "$2=$tval"'
 
-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.
+: define an is-in-libc? function
+inlibc='echo " "; td=$define; tu=$undef;
+sym=$1; var=$2; eval "was=\$$2";
+tx=yes;
+case "$reuseval$was" in
+true) ;;
+true*) tx=no;;
+esac;
+case "$tx" in
+yes)
+       set $sym tres -f;
+       eval $csym;
+       case "$tres" in
+       true)
+               echo "$sym() found." >&4;
+               case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
+       *)
+               echo "$sym() NOT found." >&4;
+               case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
+       esac;;
+*)
+       case "$was" in
+       $define) echo "$sym() found." >&4;;
+       *) echo "$sym() NOT found." >&4;;
+       esac;;
+esac'
 
-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.
+: see if dlopen exists
+xxx_runnm="$runnm"
+runnm=false
+set dlopen d_dlopen
+eval $inlibc
+runnm="$xxx_runnm"
 
-EOM
-rp='Do you want to configure vendor-specific add-on directories?'
-case "$usevendorprefix" in
-define|true|[yY]*) dflt=y ;;
-*)     : User may have set vendorprefix directly on Configure command line.
-       case "$vendorprefix" in
-       ''|' ') dflt=n ;;
-       *)      dflt=y ;;
+: determine which dynamic loading, if any, to compile in
+echo " "
+dldir="ext/DynaLoader"
+case "$usedl" in
+$define|y|true)
+       dflt='y'
+       usedl="$define"
+       ;;
+$undef|n|false)
+       dflt='n'
+       usedl="$undef"
+       ;;
+*) 
+       dflt='n'
+       case "$d_dlopen" in
+           $define) dflt='y' ;;
+       esac
+       case "$i_dld" in
+           $define) dflt='y' ;;
        esac
+       : Does a dl_xxx.xs file exist for this operating system
+       $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
        ;;
 esac
+rp="Do you wish to use dynamic loading?"
 . ./myread
+usedl="$ans"
 case "$ans" in
-[yY]*) fn=d~+
-       rp='Installation prefix to use for vendor-supplied add-ons?'
-       case "$vendorprefix" in
-       '') dflt='' ;;
-       *)  dflt=$vendorprefix ;;
-       esac
-       . ./getfile
-       : XXX Prefixit unit does not yet support siteprefix and vendorprefix
-       oldvendorprefix=''
-       case "$vendorprefix" in
-       '') ;;
-       *)      case "$ans" in
-               "$prefix") ;;
-               *) oldvendorprefix="$prefix";;
-               esac
+y*) usedl="$define"
+       case "$dlsrc" in
+       '')
+               if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
+                       dflt="$dldir/dl_${osname}.xs"
+               elif $test "$d_dlopen" = "$define" ; then
+                       dflt="$dldir/dl_dlopen.xs"
+               elif $test "$i_dld" = "$define" ; then
+                       dflt="$dldir/dl_dld.xs"
+               else
+                       dflt=''
+               fi
+               ;;
+       *)      dflt="$dldir/$dlsrc"
                ;;
        esac
-       usevendorprefix="$define"
-       vendorprefix="$ans"
-       vendorprefixexp="$ansexp"
-       ;;
-*)     usevendorprefix="$undef"
-       vendorprefix=''
-       vendorprefixexp=''
-       ;;
-esac
+    echo "The following dynamic loading files are available:"
+       : Can not go over to $dldir because getfile has path hard-coded in.
+       tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
+       rp="Source file to use for dynamic loading"
+       fn="fne"
+       gfpth="$src"
+       . ./getfile
+       usedl="$define"
+       : emulate basename
+       dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
 
-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
-       case "$vendorlib" in
-       '')
-               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
+       $cat << EOM
+
+Some systems may require passing special flags to $cc -c to
+compile modules that will be used to create a shared library.
+To use no flags, say "none".
+
+EOM
+    case "$cccdlflags" in
+    '')        case "$gccversion" in
+               '') case "$osname" in
+                       hpux)   dflt='+z' ;;
+                       next)   dflt='none' ;;
+                       irix*)  dflt='-KPIC' ;;
+                       svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
+                       sunos)  dflt='-pic' ;;
+                       *)      dflt='none' ;;
+                   esac
+                       ;;
+               *)  case "$osname" in
+                       darwin) dflt='none' ;;
+                       svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
+                       *)      dflt='-fpic' ;;
+                   esac ;;
+           esac ;;
+       ' ') dflt='none' ;;
+    *) dflt="$cccdlflags" ;;
+    esac
+    rp="Any special flags to pass to $cc -c to compile shared library modules?"
+    . ./myread
+    case "$ans" in
+    none) cccdlflags=' ' ;;
+    *) cccdlflags="$ans" ;;
+    esac
+
+    cat << EOM
+
+Some systems use ld to create libraries that can be dynamically loaded,
+while other systems (such as those using ELF) use $cc.
+
+EOM
+       case "$ld" in
+       '')     $cat >try.c <<EOM
+/* Test for whether ELF binaries are produced */
+#include <fcntl.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+int main() {
+       char b[4];
+       int i = open("a.out",O_RDONLY);
+       if(i == -1) 
+               exit(1); /* fail */
+       if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
+               exit(0); /* succeed (yes, it's ELF) */
+       else
+               exit(1); /* fail */
+}
+EOM
+               if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
+                       cat <<EOM
+You appear to have ELF support.  I'll use $cc to build dynamic libraries.
+EOM
+                       dflt="$cc"
+               else
+                       echo "I'll use ld to build dynamic libraries."
+                       dflt='ld'
+               fi
+               rm -f try.c a.out
                ;;
-       *)      dflt="$vendorlib"
+       *)      dflt="$ld"
                ;;
        esac
-       fn=d~+
-       rp='Pathname for the vendor-supplied library files?'
-       . ./getfile
-       vendorlib="$ans"
-       vendorlibexp="$ansexp"
-       ;;
-esac
-vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorlib="$vendorlibexp"
-fi
 
-case "$vendorprefix" in
-'')    d_vendorarch="$undef"
-       vendorarch=''
-       vendorarchexp=''
-       ;;
-*)     d_vendorarch="$define"
-       : determine where vendor-supplied architecture-dependent libraries go.
-       : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
-       : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
-       : vendorlib may have an optional trailing /share.
-       case "$vendorarch" in
-       '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
-               dflt="$dflt/$archname"
-               ;;
-       *)      dflt="$vendorarch" ;;
-       esac
-       fn=d~+
-       rp='Pathname for vendor-supplied architecture-dependent files?'
-       . ./getfile
-       vendorarch="$ans"
-       vendorarchexp="$ansexp"
-       ;;
-esac
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
-else
-       installvendorarch="$vendorarchexp"
-fi
+    rp="What command should be used to create dynamic libraries?"
+    . ./myread
+       ld="$ans"
 
-: Final catch-all directories to search
-$cat <<EOM
+    cat << EOM
 
-Lastly, you can have perl look in other directories for extensions and
-modules in addition to those already specified.
-These directories will be searched after 
-       $sitearch 
-       $sitelib 
-EOM
-test X"$vendorlib" != "X" && echo '    ' $vendorlib
-test X"$vendorarch" != "X" && echo '   ' $vendorarch
-echo ' '
-case "$otherlibdirs" in
-''|' ') dflt='none' ;;
-*)     dflt="$otherlibdirs" ;;
-esac
-$cat <<EOM
-Enter a colon-separated set of extra paths to include in perl's @INC
-search path, or enter 'none' for no extra paths.
+Some systems may require passing special flags to $ld to create a
+library that can be dynamically loaded.  If your ld flags include
+-L/other/path options to locate libraries outside your loader's normal
+search path, you may need to specify those -L options here as well.  To
+use no flags, say "none".
 
 EOM
+    case "$lddlflags" in
+    '') case "$osname" in
+                       beos) dflt='-nostart' ;;
+                       hpux) dflt='-b';
+                             case "$gccversion" in
+                             '') dflt="$dflt +vnocompatwarnings" ;;
+                             esac
+                             ;;        
+                       linux|irix*)    dflt='-shared' ;;
+                       next)  dflt='none' ;;
+                       solaris) dflt='-G' ;;
+                       sunos) dflt='-assert nodefinitions' ;;
+                       svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
+               *)     dflt='none' ;;
+                       esac
+                       ;;
+    *) dflt="$lddlflags" ;;
+    esac
 
-rp='Colon-separated list of additional directories for perl to search?'
-. ./myread
-case "$ans" in
-' '|''|none)   otherlibdirs=' ' ;;     
-*)     otherlibdirs="$ans" ;;
-esac
-case "$otherlibdirs" in
-' ') val=$undef ;;
-*)     val=$define ;;
-esac
-set d_perl_otherlibdirs
-eval $setvar
-
-: Cruising for prototypes
-echo " "
-echo "Checking out function prototypes..." >&4
-$cat >prototype.c <<'EOCP'
-int main(int argc, char *argv[]) {
-       exit(0);}
-EOCP
-if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
-       echo "Your C compiler appears to support function prototypes."
-       val="$define"
-else
-       echo "Your C compiler doesn't seem to understand function prototypes."
-       val="$undef"
-fi
-set prototype
-eval $setvar
-$rm -f prototype*
+       : Try to guess additional flags to pick up local libraries.
+       : Be careful not to append to a plain 'none'
+       case "$dflt" in
+       none) dflt='' ;;
+       esac
+       for thisflag in $ldflags; do
+               case "$thisflag" in
+               -L*|-R*|-Wl,-R*)
+                       case " $dflt " in
+                       *" $thisflag "*) ;;
+                       *) dflt="$dflt $thisflag" ;;
+                       esac
+                       ;;
+               esac
+       done
 
-case "$prototype" in
-"$define") ;;
-*)     ansi2knr='ansi2knr'
-       echo " "
-       cat <<EOM >&4
+       case "$dflt" in
+       ''|' ') dflt='none' ;;
+       esac
 
-$me:  FATAL ERROR:
-This version of $package can only be compiled by a compiler that 
-understands function prototypes.  Unfortunately, your C compiler 
-       $cc $ccflags
-doesn't seem to understand them.  Sorry about that.
+    rp="Any special flags to pass to $ld to create a dynamically loaded library?"
+    . ./myread
+    case "$ans" in
+    none) lddlflags=' ' ;;
+    *) lddlflags="$ans" ;;
+    esac
 
-If GNU cc is available for your system, perhaps you could try that instead.  
+       cat <<EOM
 
-Eventually, we hope to support building Perl with pre-ANSI compilers.
-If you would like to help in that effort, please contact <perlbug@perl.org>.
+Some systems may require passing special flags to $cc to indicate that
+the resulting executable will use dynamic linking.  To use no flags,
+say "none".
 
-Aborting Configure now.
 EOM
-       exit 2
-       ;;
+    case "$ccdlflags" in
+    '') case "$osname" in
+               hpux)   dflt='-Wl,-E' ;;
+               linux)  dflt='-rdynamic' ;;
+               next)   dflt='none' ;;
+               sunos)  dflt='none' ;;
+               *)      dflt='none' ;;
+           esac ;;
+    ' ')  dflt='none' ;;
+    *)  dflt="$ccdlflags" ;;
+    esac
+    rp="Any special flags to pass to $cc to use dynamic linking?"
+    . ./myread
+    case "$ans" in
+    none) ccdlflags=' ' ;;
+    *) ccdlflags="$ans" ;;
+    esac
+    ;;
+*)  usedl="$undef"
+       ld='ld'
+    dlsrc='dl_none.xs'
+    lddlflags=''
+    ccdlflags=''
+    ;;
 esac
 
-: determine where public executables go
-echo " "
-set dflt bin bin
-eval $prefixit
-fn=d~
-rp='Pathname where the public executables will reside?'
-. ./getfile
-if $test "X$ansexp" != "X$binexp"; then
-       installbin=''
-fi
-bin="$ans"
-binexp="$ansexp"
-: 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
+also=''
+case "$usedl" in
+$undef)
+       # No dynamic loading being used, so don't bother even to prompt.
+       useshrplib='false'
+       ;;
+*)     case "$useshrplib" in
+       '')     case "$osname" in
+               svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
+                       dflt=y
+                       also='Building a shared libperl is required for dynamic loading to work on your system.'
+                       ;;
+               next*)
+                       case "$osvers" in
+                       4*)     dflt=y
+                               also='Building a shared libperl is needed for MAB support.'
+                               ;;
+                       *)      dflt=n
+                               ;;
+                       esac
+                       ;;
+               *)      dflt=n
+                       ;;
+               esac
+               ;;
+       $define|true|[Yy]*)
+               dflt=y
+               ;;
+       *)      dflt=n
+               ;;
+       esac
+       $cat << EOM
 
-echo " "
-case "$extras" in
-'') dflt='n';;
-*) dflt='y';;
+The perl executable is normally obtained by linking perlmain.c with
+libperl${_a}, any static extensions (usually just DynaLoader), and
+any other libraries needed on this system (such as -lm, etc.).  Since
+your system supports dynamic loading, it is probably possible to build
+a shared libperl.$so.  If you will have more than one executable linked
+to libperl.$so, this will significantly reduce the size of each
+executable, but it may have a noticeable affect on performance.  The
+default is probably sensible for your system.
+$also
+
+EOM
+       rp="Build a shared libperl.$so (y/n)"
+       . ./myread
+       case "$ans" in
+       true|$define|[Yy]*)
+               useshrplib='true'  ;;
+       *)      useshrplib='false' ;;
+       esac
+       ;;
 esac
-cat <<EOM
-Perl can be built with extra modules or bundles of modules which
-will be fetched from the CPAN and installed alongside Perl.
 
-Notice that you will need access to the CPAN; either via the Internet,
-or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
-be asked later to configure the CPAN.pm module which will in turn do
-the installation of the rest of the extra modules or bundles.)
+case "$useshrplib" in
+true)
+       case "$libperl" in
+       '')
+               # Figure out a good name for libperl.so.  Since it gets stored in
+               # a version-specific architecture-dependent library, the version
+               # number isn't really that important, except for making cc/ld happy.
+               #
+               # A name such as libperl.so.3.1
+               majmin="libperl.$so.$patchlevel.$subversion"
+               # A name such as libperl.so.301
+               majonly=`echo $patchlevel $subversion |
+                       $awk '{printf "%d%02d", $1, $2}'`
+               majonly=libperl.$so.$majonly
+               # I'd prefer to keep the os-specific stuff here to a minimum, and
+               # rely on figuring it out from the naming of libc.
+               case "${osname}${osvers}" in
+               next4*)
+                       dflt=libperl.5.$so
+                       # XXX How handle the --version stuff for MAB?
+                       ;;
+               linux*)  # ld won't link with a bare -lperl otherwise.
+                       dflt=libperl.$so
+                       ;;
+               cygwin*) # ld links against an importlib
+                       dflt=libperl$lib_ext
+                       ;;
+               *)      # Try to guess based on whether libc has major.minor.
+                       case "$libc" in
+                       *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
+                       *libc.$so.[0-9]*) dflt=$majonly ;;
+                       *)      dflt=libperl.$so ;;
+                       esac
+                       ;;
+               esac
+               ;;
+       *)      dflt=$libperl
+               ;;
+       esac
+       cat << EOM
 
-Notice also that if the modules require any external software such as
-libraries and headers (the libz library and the zlib.h header for the
-Compress::Zlib module, for example) you MUST have any such software
-already installed, this configuration process will NOT install such
-things for you.
+I need to select a good name for the shared libperl.  If your system uses
+library names with major and minor numbers, then you might want something
+like $majmin.  Alternatively, if your system uses a single version
+number for shared libraries, then you might want to use $majonly.
+Or, your system might be quite happy with a simple libperl.$so.
 
-If this doesn't make any sense to you, just accept the default '$dflt'.
-EOM
-rp='Install any extra modules (y or n)?'
-. ./myread
-case "$ans" in
-y|Y)
-       cat <<EOM
+Since the shared libperl will get installed into a version-specific
+architecture-dependent directory, the version number of the shared perl
+library probably isn't important, so the default should be o.k.
 
-Please list any extra modules or bundles to be installed from CPAN,
-with spaces between the names.  The names can be in any format the
-'install' command of CPAN.pm will understand.  (Answer 'none',
-without the quotes, to install no extra modules or bundles.)
 EOM
-       rp='Extras?'
-       dflt="$extras"
+       rp='What name do you want to give to the shared libperl?'
        . ./myread
-       extras="$ans"
-esac
-case "$extras" in
-''|'none')
-       val=''
-       $rm -f ../extras.lst
+       libperl=$ans
+       echo "Ok, I'll use $libperl"
        ;;
-*)     echo "(Saving the list of extras for later...)"
-       echo "$extras" > ../extras.lst
-       val="'$extras'"
+*)
+       libperl="libperl${_a}"
        ;;
 esac
-set extras
-eval $setvar
-echo " "
 
-: Find perl5.005 or later.
-echo "Looking for a previously installed perl5.005 or later... "
-case "$perl5" in
-'')    for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
-               : Check if this perl is recent and can load a simple module
-               if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
-                       perl5=$tdir/perl
-                       break;
-               elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
-                       perl5=$tdir/perl5
-                       break;
-               fi
-       done
-       ;;
-*)     perl5="$perl5"
+# Detect old use of shrpdir via undocumented Configure -Dshrpdir
+case "$shrpdir" in
+'') ;;
+*)     $cat >&4 <<EOM
+WARNING:  Use of the shrpdir variable for the installation location of
+the shared $libperl is not supported.  It was never documented and
+will not work in this version.  Let me (perlbug@perl.org)
+know of any problems this may cause.
+
+EOM
+       case "$shrpdir" in
+       "$archlibexp/CORE")
+               $cat >&4 <<EOM
+But your current setting of $shrpdir is
+the default anyway, so it's harmless.
+EOM
+               ;;
+       *)
+               $cat >&4 <<EOM
+Further, your current attempted setting of $shrpdir
+conflicts with the value of $archlibexp/CORE
+that installperl will use.
+EOM
+               ;;
+       esac
        ;;
 esac
-case "$perl5" in
-'')    echo "None found.  That's ok.";;
-*)     echo "Using $perl5." ;;
-esac
 
-: Determine list of previous versions to include in @INC
-$cat > getverlist <<EOPL
-#!$perl5 -w
-use File::Basename;
-\$api_versionstring = "$api_versionstring";
-\$version = "$version";
-\$stem = "$sitelib_stem";
-\$archname = "$archname";
-EOPL
-       $cat >> getverlist <<'EOPL'
-# Can't have leading @ because metaconfig interprets it as a command!
-;@inc_version_list=();
-# XXX Redo to do opendir/readdir? 
-if (-d $stem) {
-    chdir($stem);
-    ;@candidates = glob("5.*");
-}
-else {
-    ;@candidates = ();
-}
+# How will the perl executable find the installed shared $libperl?
+# Add $xxx to ccdlflags.
+# If we can't figure out a command-line option, use $shrpenv to
+# set env LD_RUN_PATH.  The main perl makefile uses this.
+shrpdir=$archlibexp/CORE
+xxx=''
+tmp_shrpenv=''
+if "$useshrplib"; then
+    case "$osname" in 
+       aix)
+               # We'll set it in Makefile.SH...
+               ;;
+       solaris)
+               xxx="-R $shrpdir"
+               ;;
+       freebsd|netbsd|openbsd)
+               xxx="-Wl,-R$shrpdir"
+               ;;
+       bsdos|linux|irix*|dec_osf)
+               xxx="-Wl,-rpath,$shrpdir"
+               ;;
+       next)
+               # next doesn't like the default...
+               ;;
+       beos)
+               # beos doesn't like the default, either.
+               ;;
+       hpux*)
+               # hpux doesn't like the default, either.
+               tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
+               ;;
+       *)
+               tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
+               ;;
+       esac
+       case "$xxx" in
+       '') ;;
+       *)      
+               # Only add $xxx if it isn't already in ccdlflags.
+               case " $ccdlflags " in
+               *" $xxx "*)     ;;
+               *)      ccdlflags="$ccdlflags $xxx"
+                       cat <<EOM >&4
 
-# XXX ToDo:  These comparisons must be reworked when two-digit
-# subversions come along, so that 5.7.10 compares as greater than
-# 5.7.3!  By that time, hope that 5.6.x is sufficiently
-# widespread that we can use the built-in version vectors rather
-# than reinventing them here.  For 5.6.0, however, we must
-# assume this script will likely be run by 5.005_0x.  --AD 1/2000.
-foreach $d (@candidates) {
-    if ($d lt $version) {
-       if ($d ge $api_versionstring) {
-           unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
-       }
-       elsif ($d ge "5.005") {
-           unshift(@inc_version_list, grep { -d } $d);
-       }
-    }
-    else {
-       # Skip newer version.  I.e. don't look in
-       # 5.7.0 if we're installing 5.6.1.
-    }
-}
+Adding $xxx to the flags
+passed to $ld so that the perl executable will find the 
+installed shared $libperl.
 
-if (@inc_version_list) {
-    print join(' ', @inc_version_list);
-}
-else {
-    # Blank space to preserve value for next Configure run.
-    print " ";
-}
-EOPL
-chmod +x getverlist
-case "$inc_version_list" in
-'')    if test -x "$perl5$exe_ext"; then
-               dflt=`$perl5 getverlist`
-       else
-               dflt='none'
-       fi
-       ;;
-$undef) dflt='none' ;;
-*)  eval dflt=\"$inc_version_list\" ;;
+EOM
+                       ;;
+               esac
+               ;;
+       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
-case "$dflt" in
-''|' ') dflt=none ;;
+# Respect a hint or command-line value.
+case "$shrpenv" in
+'') shrpenv="$tmp_shrpenv" ;;
 esac
-case "$dflt" in
-5.005) case "$bincompat5005" in
-       $define|true|[yY]*) ;;
-       *) dflt=none ;;
-       esac
-       ;;
+case "$ldlibpthname" in
+'')    ldlibpthname=LD_LIBRARY_PATH ;;
+none)  ldlibpthname='' ;;
 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.  Answer 'none' to tell perl
-to not search earlier versions.
-
-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
-case "$ans" in
-[Nn]one|''|' ') inc_version_list=' ' ;;
-*) inc_version_list="$ans" ;;
-esac
-case "$inc_version_list" in
-''|' ') 
-       inc_version_list_init='0';;
-*)     inc_version_list_init=`echo $inc_version_list |
-               $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
+: determine where manual pages are on this system
+echo " "
+case "$sysman" in
+'') 
+       syspath='/usr/share/man/man1 /usr/man/man1'
+       syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
+       syspath="$syspath /usr/man/u_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
-$rm -f getverlist
+if $test -d "$sysman"; then
+       echo "System manual is in $sysman." >&4
+else
+       echo "Could not find manual pages in source form." >&4
+fi
 
-: determine whether to install perl also as /usr/bin/perl
+: determine where manual pages go
+set man1dir man1dir none
+eval $prefixit
+$cat <<EOM
 
-echo " "
-if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
-       $cat <<EOM
-Many scripts expect perl to be installed as /usr/bin/perl.
-I can install the perl you are about to compile also as /usr/bin/perl
-(in addition to $installbin/perl).
+$spackage has manual pages available in source form.
 EOM
-       case "$installusrbinperl" in
-       "$undef"|[nN]*) dflt='n';;
-       *)              dflt='y';;
-       esac
-       rp="Do you want to install perl as /usr/bin/perl?"
-       . ./myread
-       case "$ans" in
-       [yY]*)  val="$define";;
-       *)      val="$undef" ;;
+case "$nroff" in
+nroff)
+       echo "However, you don't have nroff, so they're probably useless to you."
+       case "$man1dir" in
+       '') man1dir="none";;
+       esac;;
+esac
+echo "If you don't want the manual sources installed, answer 'none'."
+case "$man1dir" in
+' ') dflt=none
+       ;;
+'')
+       lookpath="$prefixexp/share/man/man1"
+       lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
+       lookpath="$lookpath $prefixexp/man/p_man/man1"
+       lookpath="$lookpath $prefixexp/man/u_man/man1"
+       lookpath="$lookpath $prefixexp/man/man.1"
+       case "$sysman" in
+       */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
+       *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
        esac
-else
-       val="$undef"
+       set dflt
+       eval $prefixup
+       ;;
+*)  dflt="$man1dir"
+       ;;
+esac
+echo " "
+fn=dn+~
+rp="Where do the main $spackage manual pages (source) go?"
+. ./getfile
+if $test "X$man1direxp" != "X$ansexp"; then
+       installman1dir=''
 fi
-set installusrbinperl
-eval $setvar
+man1dir="$ans"
+man1direxp="$ansexp"
+case "$man1dir" in
+'')    man1dir=' '
+       installman1dir='';;
+esac
 
-: see if dld is available
-set dld.h i_dld
-eval $inhdr
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
+else
+       installman1dir="$man1direxp"
+fi
 
-: see if dlopen exists
-xxx_runnm="$runnm"
-runnm=false
-set dlopen d_dlopen
-eval $inlibc
-runnm="$xxx_runnm"
+: What suffix to use on installed man pages
 
-: determine which dynamic loading, if any, to compile in
-echo " "
-dldir="ext/DynaLoader"
-case "$usedl" in
-$define|y|true)
-       dflt='y'
-       usedl="$define"
-       ;;
-$undef|n|false)
-       dflt='n'
-       usedl="$undef"
+case "$man1dir" in
+' ')
+       man1ext='0'
        ;;
-*) 
-       dflt='n'
-       case "$d_dlopen" in
-           $define) dflt='y' ;;
-       esac
-       case "$i_dld" in
-           $define) dflt='y' ;;
+*)
+       rp="What suffix should be used for the main $spackage man pages?"
+       case "$man1ext" in
+       '')     case "$man1dir" in
+               *1)  dflt=1 ;;
+               *1p) dflt=1p ;;
+               *1pm) dflt=1pm ;;
+               *l) dflt=l;;
+               *n) dflt=n;;
+               *o) dflt=o;;
+               *p) dflt=p;;
+               *C) dflt=C;;
+               *L) dflt=L;;
+               *L1) dflt=L1;;
+               *) dflt=1;;
+               esac
+               ;;
+       *)      dflt="$man1ext";;
        esac
-       : Does a dl_xxx.xs file exist for this operating system
-       $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
+       . ./myread
+       man1ext="$ans"
        ;;
 esac
-rp="Do you wish to use dynamic loading?"
-. ./myread
-usedl="$ans"
-case "$ans" in
-y*) usedl="$define"
-       case "$dlsrc" in
-       '')
-               if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
-                       dflt="$dldir/dl_${osname}.xs"
-               elif $test "$d_dlopen" = "$define" ; then
-                       dflt="$dldir/dl_dlopen.xs"
-               elif $test "$i_dld" = "$define" ; then
-                       dflt="$dldir/dl_dld.xs"
-               else
-                       dflt=''
-               fi
-               ;;
-       *)      dflt="$dldir/$dlsrc"
-               ;;
-       esac
-    echo "The following dynamic loading files are available:"
-       : Can not go over to $dldir because getfile has path hard-coded in.
-       tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
-       rp="Source file to use for dynamic loading"
-       fn="fne"
-       gfpth="$src"
-       . ./getfile
-       usedl="$define"
-       : emulate basename
-       dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
-
-       $cat << EOM
-
-Some systems may require passing special flags to $cc -c to
-compile modules that will be used to create a shared library.
-To use no flags, say "none".
-
-EOM
-    case "$cccdlflags" in
-    '')        case "$gccversion" in
-               '') case "$osname" in
-                       hpux)   dflt='+z' ;;
-                       next)   dflt='none' ;;
-                       irix*)  dflt='-KPIC' ;;
-                       svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
-                       sunos)  dflt='-pic' ;;
-                       *)      dflt='none' ;;
-                   esac
-                       ;;
-               *)  case "$osname" in
-                       darwin) dflt='none' ;;
-                       svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
-                       *)      dflt='-fpic' ;;
-                   esac ;;
-           esac ;;
-       ' ') dflt='none' ;;
-    *) dflt="$cccdlflags" ;;
-    esac
-    rp="Any special flags to pass to $cc -c to compile shared library modules?"
-    . ./myread
-    case "$ans" in
-    none) cccdlflags=' ' ;;
-    *) cccdlflags="$ans" ;;
-    esac
-
-    cat << EOM
-
-Some systems use ld to create libraries that can be dynamically loaded,
-while other systems (such as those using ELF) use $cc.
 
-EOM
-       case "$ld" in
-       '')     $cat >try.c <<'EOM'
-/* Test for whether ELF binaries are produced */
-#include <fcntl.h>
-#include <stdlib.h>
-int main() {
-       char b[4];
-       int i = open("a.out",O_RDONLY);
-       if(i == -1) 
-               exit(1); /* fail */
-       if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
-               exit(0); /* succeed (yes, it's ELF) */
+: see if we can have long filenames
+echo " "
+first=123456789abcdef
+$rm -f $first
+if (echo hi >$first) 2>/dev/null; then
+       if $test -f 123456789abcde; then
+               echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
+               val="$undef"
        else
-               exit(1); /* fail */
-}
+               echo 'You can have filenames longer than 14 characters.'>&4
+               val="$define"
+       fi
+else
+       $cat <<'EOM'
+You can't have filenames longer than 14 chars.
+You can't even think about them!
 EOM
-               if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
-                       cat <<EOM
-You appear to have ELF support.  I'll use $cc to build dynamic libraries.
+       val="$undef"
+fi 
+set d_flexfnam
+eval $setvar
+$rm -rf 123456789abcde*
+
+: determine where library module manual pages go
+set man3dir man3dir none
+eval $prefixit
+$cat <<EOM
+
+$spackage has manual pages for many of the library modules.
 EOM
-                       dflt="$cc"
-               else
-                       echo "I'll use ld to build dynamic libraries."
-                       dflt='ld'
-               fi
-               rm -f try.c a.out
-               ;;
-       *)      dflt="$ld"
-               ;;
-       esac
 
-    rp="What command should be used to create dynamic libraries?"
-    . ./myread
-       ld="$ans"
+case "$nroff" in
+nroff)
+       $cat <<'EOM'
+However, you don't have nroff, so they're probably useless to you.
+EOM
+       case "$man3dir" in
+       '') man3dir="none";;
+       esac;;
+esac
 
-    cat << EOM
+case "$d_flexfnam" in
+undef)
+       $cat <<'EOM'
+However, your system can't handle the long file names like File::Basename.3. 
+EOM
+       case "$man3dir" in
+       '') man3dir="none";;
+       esac;;
+esac
 
-Some systems may require passing special flags to $ld to create a
-library that can be dynamically loaded.  If your ld flags include
--L/other/path options to locate libraries outside your loader's normal
-search path, you may need to specify those -L options here as well.  To
-use no flags, say "none".
+echo "If you don't want the manual sources installed, answer 'none'."
+prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+case "$man3dir" in
+'')    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
-    case "$lddlflags" in
-    '') case "$osname" in
-                       beos) dflt='-nostart' ;;
-                       hpux) dflt='-b';
-                             case "$gccversion" in
-                             '') dflt="$dflt +vnocompatwarnings" ;;
-                             esac
-                             ;;        
-                       linux|irix*)    dflt='-shared' ;;
-                       next)  dflt='none' ;;
-                       solaris) dflt='-G' ;;
-                       sunos) dflt='-assert nodefinitions' ;;
-                       svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
-               *)     dflt='none' ;;
-                       esac
-                       ;;
-    *) dflt="$lddlflags" ;;
-    esac
+               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="$man3dir" ;;
+esac
+case "$dflt" in
+' ') dflt=none ;;
+esac
+echo " "
+fn=dn+~
+rp="Where do the $package library man pages (source) go?"
+. ./getfile
+man3dir="$ans"
+man3direxp="$ansexp"
+case "$man3dir" in
+'')    man3dir=' '
+       installman3dir='';;
+esac
 
-       : Try to guess additional flags to pick up local libraries.
-       : Be careful not to append to a plain 'none'
-       case "$dflt" in
-       none) dflt='' ;;
+: 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'
+       ;;
+*)
+       rp="What suffix should be used for the $package library man pages?"
+       case "$man3ext" in
+       '')     case "$man3dir" in
+               *3)  dflt=3 ;;
+               *3p) dflt=3p ;;
+               *3pm) dflt=3pm ;;
+               *l) dflt=l;;
+               *n) dflt=n;;
+               *o) dflt=o;;
+               *p) dflt=p;;
+               *C) dflt=C;;
+               *L) dflt=L;;
+               *L3) dflt=L3;;
+               *) dflt=3;;
+               esac
+               ;;
+       *)      dflt="$man3ext";;
        esac
-       for thisflag in $ldflags; do
-               case "$thisflag" in
-               -L*|-R*|-Wl,-R*)
-                       case " $dflt " in
-                       *" $thisflag "*) ;;
-                       *) dflt="$dflt $thisflag" ;;
+       . ./myread
+       man3ext="$ans"
+       ;;
+esac
+
+: see if we have to deal with yellow pages, now NIS.
+if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
+       if $test -f /usr/etc/nibindd; then
+               echo " "
+               echo "I'm fairly confident you're on a NeXT."
+               echo " "
+               rp='Do you get the hosts file via NetInfo?'
+               dflt=y
+               case "$hostcat" in
+               nidump*) ;;
+               '') ;;
+               *) dflt=n;;
+               esac
+               . ./myread
+               case "$ans" in
+               y*) hostcat='nidump hosts .';;
+               *)      case "$hostcat" in
+                       nidump*) hostcat='';;
                        esac
                        ;;
                esac
-       done
+       fi
+       case "$hostcat" in
+       nidump*) ;;
+       *)
+               case "$hostcat" in
+               *ypcat*) dflt=y;;
+               '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
+                               dflt=y
+                       else
+                               dflt=n
+                       fi;;
+               *) dflt=n;;
+               esac
+               echo " "
+               rp='Are you getting the hosts file via yellow pages?'
+               . ./myread
+               case "$ans" in
+               y*) hostcat='ypcat hosts';;
+               *) hostcat='cat /etc/hosts';;
+               esac
+               ;;
+       esac
+fi
+case "$hostcat" in
+'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
+esac
+case "$groupcat" in
+'') test -f /etc/group && groupcat='cat /etc/group';;
+esac
+case "$passcat" in
+'') test -f /etc/passwd && passcat='cat /etc/passwd';;
+esac
+
+: now get the host name
+echo " "
+echo "Figuring out host name..." >&4
+case "$myhostname" in
+'') cont=true
+       echo 'Maybe "hostname" will work...'
+       if tans=`sh -c hostname 2>&1` ; then
+               myhostname=$tans
+               phostname=hostname
+               cont=''
+       fi
+       ;;
+*) cont='';;
+esac
+if $test "$cont"; then
+       if ./xenix; then
+               echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
+               if tans=`cat /etc/systemid 2>&1` ; then
+                       myhostname=$tans
+                       phostname='cat /etc/systemid'
+                       echo "Whadyaknow.  Xenix always was a bit strange..."
+                       cont=''
+               fi
+       elif $test -r /etc/systemid; then
+               echo "(What is a non-Xenix system doing with /etc/systemid?)"
+       fi
+fi
+if $test "$cont"; then
+       echo 'No, maybe "uuname -l" will work...'
+       if tans=`sh -c 'uuname -l' 2>&1` ; then
+               myhostname=$tans
+               phostname='uuname -l'
+       else
+               echo 'Strange.  Maybe "uname -n" will work...'
+               if tans=`sh -c 'uname -n' 2>&1` ; then
+                       myhostname=$tans
+                       phostname='uname -n'
+               else
+                       echo 'Oh well, maybe I can mine it out of whoami.h...'
+                       if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
+                               myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
+                               phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
+                       else
+                               case "$myhostname" in
+                               '') echo "Does this machine have an identity crisis or something?"
+                                       phostname='';;
+                               *)
+                                       echo "Well, you said $myhostname before..."
+                                       phostname='echo $myhostname';;
+                               esac
+                       fi
+               fi
+       fi
+fi
+case "$myhostname" in
+'') myhostname=noname ;;
+esac
+: you do not want to know about this
+set $myhostname
+myhostname=$1
 
-       case "$dflt" in
-       ''|' ') dflt='none' ;;
+: verify guess
+if $test "$myhostname" ; then
+       dflt=y
+       rp='Your host name appears to be "'$myhostname'".'" Right?"
+       . ./myread
+       case "$ans" in
+       y*) ;;
+       *) myhostname='';;
        esac
+fi
 
-    rp="Any special flags to pass to $ld to create a dynamically loaded library?"
-    . ./myread
-    case "$ans" in
-    none) lddlflags=' ' ;;
-    *) lddlflags="$ans" ;;
-    esac
-
-       cat <<EOM
-
-Some systems may require passing special flags to $cc to indicate that
-the resulting executable will use dynamic linking.  To use no flags,
-say "none".
+: bad guess or no guess
+while $test "X$myhostname" = X ; do
+       dflt=''
+       rp="Please type the (one word) name of your host:"
+       . ./myread
+       myhostname="$ans"
+done
 
-EOM
-    case "$ccdlflags" in
-    '') case "$osname" in
-               hpux)   dflt='-Wl,-E' ;;
-               linux)  dflt='-rdynamic' ;;
-               next)   dflt='none' ;;
-               sunos)  dflt='none' ;;
-               *)      dflt='none' ;;
-           esac ;;
-    ' ')  dflt='none' ;;
-    *)  dflt="$ccdlflags" ;;
-    esac
-    rp="Any special flags to pass to $cc to use dynamic linking?"
-    . ./myread
-    case "$ans" in
-    none) ccdlflags=' ' ;;
-    *) ccdlflags="$ans" ;;
-    esac
-    ;;
-*)  usedl="$undef"
-       ld='ld'
-    dlsrc='dl_none.xs'
-    lddlflags=''
-    ccdlflags=''
-    ;;
+: translate upper to lower if necessary
+case "$myhostname" in
+*[A-Z]*)
+       echo "(Normalizing case in your host name)"
+       myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
+       ;;
 esac
 
-also=''
-case "$usedl" in
-$undef)
-       # No dynamic loading being used, so don't bother even to prompt.
-       useshrplib='false'
+case "$myhostname" in
+*.*)
+       dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
+       myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
+       echo "(Trimming domain name from host name--host name is now $myhostname)"
        ;;
-*)     case "$useshrplib" in
-       '')     case "$osname" in
-               svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
-                       dflt=y
-                       also='Building a shared libperl is required for dynamic loading to work on your system.'
-                       ;;
-               next*)
-                       case "$osvers" in
-                       4*)     dflt=y
-                               also='Building a shared libperl is needed for MAB support.'
+*) case "$mydomain" in
+       '')
+               {
+                       test "X$hostcat" = "Xypcat hosts" &&
+                       ypmatch "$myhostname" hosts 2>/dev/null |\
+                               $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
+                       $test -s hosts
+               } || {
+                       test "X$hostcat" != "X" &&
+                       $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
+                                       /[       ]$myhostname[  . ]/p" > hosts
+               }
+               tmp_re="[       . ]"
+               if $test -f hosts; then
+                       $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
+                            END { print sum }" hosts` = x1 || tmp_re="[         ]"
+                       dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
+                               hosts | $sort | $uniq | \
+                               $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
+                       case `$echo X$dflt` in
+                       X*\ *)  echo "(Several hosts in the database matched hostname)"
+                               dflt=.
                                ;;
-                       *)      dflt=n
+                       X.) echo "(You do not have fully-qualified names in the hosts database)"
                                ;;
                        esac
+               else
+                       echo "(I cannot locate a hosts database anywhere)"
+                       dflt=.
+               fi
+               case "$dflt" in
+               .)
+                       tans=`./loc resolv.conf X /etc /usr/etc`
+                       if $test -f "$tans"; then
+                               echo "(Attempting domain name extraction from $tans)"
+                               dflt=.`$sed -n -e 's/   / /g' \
+                                 -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
+                                 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
+                               case "$dflt" in
+                               .) dflt=.`$sed -n -e 's/        / /g' \
+                                    -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
+                                    | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
+                                       ;;
+                               esac
+                       fi
+                       ;;
+               esac
+               case "$dflt" in
+               .) echo "(No help from resolv.conf either -- attempting clever guess)"
+                       dflt=.`sh -c domainname 2>/dev/null`
+                       case "$dflt" in
+                       '') dflt='.';;
+                       .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
+                       esac
                        ;;
-               *)      dflt=n
+               esac
+               case "$dflt$osname" in
+               .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
+                       dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
                        ;;
                esac
+               case "$dflt" in
+               .) echo "(Lost all hope -- silly guess then)"
+                       dflt='.nonet'
+                       ;;
+               esac
+               $rm -f hosts
                ;;
-       $define|true|[Yy]*)
-               dflt=y
-               ;;
-       *)      dflt=n
-               ;;
-       esac
-       $cat << EOM
-
-The perl executable is normally obtained by linking perlmain.c with
-libperl${_a}, any static extensions (usually just DynaLoader), and
-any other libraries needed on this system (such as -lm, etc.).  Since
-your system supports dynamic loading, it is probably possible to build
-a shared libperl.$so.  If you will have more than one executable linked
-to libperl.$so, this will significantly reduce the size of each
-executable, but it may have a noticeable affect on performance.  The
-default is probably sensible for your system.
-$also
+       *) dflt="$mydomain";;
+       esac;;
+esac
+echo " "
+rp="What is your domain name?"
+. ./myread
+tans="$ans"
+case "$ans" in
+'') ;;
+.*) ;;
+*) tans=".$tans";;
+esac
+mydomain="$tans"
 
-EOM
-       rp="Build a shared libperl.$so (y/n)"
-       . ./myread
-       case "$ans" in
-       true|$define|[Yy]*)
-               useshrplib='true'  ;;
-       *)      useshrplib='false' ;;
-       esac
+: translate upper to lower if necessary
+case "$mydomain" in
+*[A-Z]*)
+       echo "(Normalizing case in your domain name)"
+       mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
        ;;
 esac
 
-case "$useshrplib" in
-true)
-       case "$libperl" in
-       '')
-               # Figure out a good name for libperl.so.  Since it gets stored in
-               # a version-specific architecture-dependent library, the version
-               # number isn't really that important, except for making cc/ld happy.
-               #
-               # A name such as libperl.so.3.1
-               majmin="libperl.$so.$patchlevel.$subversion"
-               # A name such as libperl.so.301
-               majonly=`echo $patchlevel $subversion |
-                       $awk '{printf "%d%02d", $1, $2}'`
-               majonly=libperl.$so.$majonly
-               # I'd prefer to keep the os-specific stuff here to a minimum, and
-               # rely on figuring it out from the naming of libc.
-               case "${osname}${osvers}" in
-               next4*)
-                       dflt=libperl.5.$so
-                       # XXX How handle the --version stuff for MAB?
-                       ;;
-               linux*)  # ld won't link with a bare -lperl otherwise.
-                       dflt=libperl.$so
-                       ;;
-               cygwin*) # ld links against an importlib
-                       dflt=libperl$lib_ext
+: a little sanity check here
+case "$phostname" in
+'') ;;
+*)
+       case `$phostname | ./tr '[A-Z]' '[a-z]'` in
+       $myhostname$mydomain|$myhostname) ;;
+       *)
+               case "$phostname" in
+               sed*)
+                       echo "(That doesn't agree with your whoami.h file, by the way.)"
                        ;;
-               *)      # Try to guess based on whether libc has major.minor.
-                       case "$libc" in
-                       *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
-                       *libc.$so.[0-9]*) dflt=$majonly ;;
-                       *)      dflt=libperl.$so ;;
-                       esac
+               *)
+                       echo "(That doesn't agree with your $phostname command, by the way.)"
                        ;;
                esac
-               ;;
-       *)      dflt=$libperl
+       ;;
+       esac
+       ;;
+esac
+
+$cat <<EOM
+
+I need to get your e-mail address in Internet format if possible, i.e.
+something like user@host.domain. Please answer accurately since I have
+no easy means to double check it. The default value provided below
+is most probably close to reality but may not be valid from outside
+your organization...
+
+EOM
+cont=x
+while test "$cont"; do
+       case "$cf_email" in
+       '') dflt="$cf_by@$myhostname$mydomain";;
+       *) dflt="$cf_email";;
+       esac
+       rp='What is your e-mail address?'
+       . ./myread
+       cf_email="$ans"
+       case "$cf_email" in
+       *@*.*) cont='' ;;
+       *)
+               rp='Address does not look like an Internet one.  Use it anyway?'
+               case "$fastread" in
+               yes) dflt=y ;;
+               *) dflt=n ;;
+               esac
+               . ./myread
+               case "$ans" in
+               y*) cont='' ;;
+               *) echo " " ;;
+               esac
                ;;
        esac
-       cat << EOM
+done
 
-I need to select a good name for the shared libperl.  If your system uses
-library names with major and minor numbers, then you might want something
-like $majmin.  Alternatively, if your system uses a single version
-number for shared libraries, then you might want to use $majonly.
-Or, your system might be quite happy with a simple libperl.$so.
+$cat <<EOM
 
-Since the shared libperl will get installed into a version-specific
-architecture-dependent directory, the version number of the shared perl
-library probably isn't important, so the default should be o.k.
+If you or somebody else will be maintaining perl at your site, please
+fill in the correct e-mail address here so that they may be contacted
+if necessary. Currently, the "perlbug" program included with perl
+will send mail to this address in addition to perlbug@perl.org. You may
+enter "none" for no administrator.
 
 EOM
-       rp='What name do you want to give to the shared libperl?'
-       . ./myread
-       libperl=$ans
-       echo "Ok, I'll use $libperl"
-       ;;
-*)
-       libperl="libperl${_a}"
-       ;;
+case "$perladmin" in
+'') dflt="$cf_email";;
+*) dflt="$perladmin";;
 esac
+rp='Perl administrator e-mail address'
+. ./myread
+perladmin="$ans"
 
-# Detect old use of shrpdir via undocumented Configure -Dshrpdir
-case "$shrpdir" in
-'') ;;
-*)     $cat >&4 <<EOM
-WARNING:  Use of the shrpdir variable for the installation location of
-the shared $libperl is not supported.  It was never documented and
-will not work in this version.  Let me (perlbug@perl.org)
-know of any problems this may cause.
-
+: determine whether to only install version-specific parts.
+echo " "
+$cat <<EOM
+Do you want to install only the version-specific parts of the perl
+distribution?  Usually you do *not* want to do this.
 EOM
-       case "$shrpdir" in
-       "$archlibexp/CORE")
-               $cat >&4 <<EOM
-But your current setting of $shrpdir is
-the default anyway, so it's harmless.
+case "$versiononly" in
+"$define"|[Yy]*|true) dflt='y' ;;
+*) dflt='n';
+esac
+rp="Do you want to install only the version-specific parts of perl?"
+. ./myread
+case "$ans" in
+[yY]*) val="$define";;
+*)     val="$undef" ;;
+esac
+set versiononly
+eval $setvar
+
+case "$versiononly" in
+"$define") inc_version_list=''
+           inc_version_list_init=0
+           ;;
+esac
+
+: figure out how to guarantee perl startup
+case "$startperl" in
+'')
+       case "$sharpbang" in
+       *!)
+               $cat <<EOH
+
+I can use the #! construct to start perl on your system. This will
+make startup of perl scripts faster, but may cause problems if you
+want to share those scripts and perl is not in a standard place
+($binexp/perl) on all your platforms. The alternative is to force
+a shell by starting the script with a single ':' character.
+
+EOH
+               case "$versiononly" in
+               "$define")      dflt="$binexp/perl$version";;  
+               *)              dflt="$binexp/perl";;
+               esac
+               rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
+               . ./myread
+               case "$ans" in
+               none)   startperl=": # use perl";;
+               *)      startperl="#!$ans"
+                       if $test 30 -lt `echo "$ans" | wc -c`; then
+                               $cat >&4 <<EOM
+
+WARNING:  Some systems limit the #! command to 32 characters.
+If you experience difficulty running Perl scripts with #!, try
+installing Perl in a directory with a shorter pathname.
+
 EOM
+                       fi ;;
+               esac
                ;;
-       *)
-               $cat >&4 <<EOM
-Further, your current attempted setting of $shrpdir
-conflicts with the value of $archlibexp/CORE
-that installperl will use.
-EOM
+       *) startperl=": # use perl"
                ;;
        esac
        ;;
 esac
+echo "I'll use $startperl to start perl scripts."
 
-# How will the perl executable find the installed shared $libperl?
-# Add $xxx to ccdlflags.
-# If we can't figure out a command-line option, use $shrpenv to
-# set env LD_RUN_PATH.  The main perl makefile uses this.
-shrpdir=$archlibexp/CORE
-xxx=''
-tmp_shrpenv=''
-if "$useshrplib"; then
-    case "$osname" in 
-       aix)
-               # We'll set it in Makefile.SH...
-               ;;
-       solaris)
-               xxx="-R $shrpdir"
-               ;;
-       freebsd|netbsd)
-               xxx="-Wl,-R$shrpdir"
-               ;;
-       linux|irix*|dec_osf)
-               xxx="-Wl,-rpath,$shrpdir"
-               ;;
-       next)
-               # next doesn't like the default...
-               ;;
-       beos)
-               # beos doesn't like the default, either.
-               ;;
-       hpux*)
-               # hpux doesn't like the default, either.
-               tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
-               ;;
-       *)
-               tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
-               ;;
+: figure best path for perl in scripts
+case "$perlpath" in
+'')
+       case "$versiononly" in
+       "$define")      perlpath="$binexp/perl$version";;
+       *)              perlpath="$binexp/perl";;
        esac
-       case "$xxx" in
-       '') ;;
-       *)      
-               # Only add $xxx if it isn't already in ccdlflags.
-               case " $ccdlflags " in
-               *" $xxx "*)     ;;
-               *)      ccdlflags="$ccdlflags $xxx"
-                       cat <<EOM >&4
+       case "$startperl" in
+       *!*) ;;
+       *)
+               $cat <<EOH
 
-Adding $xxx to the flags
-passed to $ld so that the perl executable will find the 
-installed shared $libperl.
+I will use the "eval 'exec'" idiom to start Perl on your system.
+I can use the full path of your Perl binary for this purpose, but
+doing so may cause problems if you want to share those scripts and
+Perl is not always in a standard place ($binexp/perl).
 
-EOM
-                       ;;
-               esac
+EOH
+               dflt="$binexp/perl"
+               rp="What path shall I use in \"eval 'exec'\"?"
+               . ./myread
+               perlpath="$ans"
                ;;
        esac
+       ;;
+esac
+case "$startperl" in
+*!*)   ;;
+*)     echo "I'll use $perlpath in \"eval 'exec'\"" ;;
+esac
+
+: determine where public executable scripts go
+set scriptdir scriptdir
+eval $prefixit
+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 /usr/local/scripts && dflt=/usr/local/scripts
+       $test -d $prefixexp/script  && dflt=$prefixexp/script
+       set dflt
+       eval $prefixup
+       ;;
+*)  dflt="$scriptdir"
+       ;;
+esac
+$cat <<EOM
+Some installations have a separate directory just for executable scripts so
+that they can mount it across multiple architectures but keep the scripts in
+one spot.  You might, for example, have a subdirectory of /usr/share for this.
+Or you might just lump your scripts in with all your other executables.
+EOM
+fn=d~
+rp='Where do you keep publicly executable scripts?'
+. ./getfile
+if $test "X$ansexp" != "X$scriptdirexp"; then
+       installscript=''
 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" ;;
+scriptdir="$ans"
+scriptdirexp="$ansexp"
+: 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 add-on public executables go
+case "$sitebin" in
+'')    dflt=$siteprefix/bin ;;
+*)     dflt=$sitebin ;;
 esac
-# Respect a hint or command-line value.
-case "$shrpenv" in
-'') shrpenv="$tmp_shrpenv" ;;
+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
+
+: determine where add-on html pages go
+: There is no standard location, so try to copy the previously-selected
+: directory structure for the core html pages.
+case "$sitehtml1dir" in
+'')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
+*)     dflt=$sitehtml1dir ;;
 esac
-case "$ldlibpthname" in
-'')    ldlibpthname=LD_LIBRARY_PATH ;;
-none)  ldlibpthname='' ;;
+case "$dflt" in
+''|' ') dflt=none ;;
 esac
+fn=dn+~
+rp='Pathname where the site-specific html pages should be installed?'
+. ./getfile
+sitehtml1dir="$ans"
+sitehtml1direxp="$ansexp"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
+else
+       installsitehtml1dir="$sitehtml1direxp"
+fi
 
-: determine where manual pages are on this system
-echo " "
-case "$sysman" in
-'') 
-       syspath='/usr/share/man/man1 /usr/man/man1'
-       syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
-       syspath="$syspath /usr/man/u_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`
-       ;;
+: determine where add-on library html pages go
+: There is no standard location, so try to copy the previously-selected
+: directory structure for the core html pages.
+case "$sitehtml3dir" in
+'')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
+*)     dflt=$sitehtml3dir ;;
 esac
-if $test -d "$sysman"; then
-       echo "System manual is in $sysman." >&4
+case "$dflt" in
+''|' ') dflt=none ;;
+esac
+fn=dn+~
+rp='Pathname where the site-specific library html pages should be installed?'
+. ./getfile
+sitehtml3dir="$ans"
+sitehtml3direxp="$ansexp"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
 else
-       echo "Could not find manual pages in source form." >&4
+       installsitehtml3dir="$sitehtml3direxp"
 fi
 
-: determine where manual pages go
-set man1dir man1dir none
-eval $prefixit
-$cat <<EOM
-
-$spackage has manual pages available in source form.
-EOM
-case "$nroff" in
-nroff)
-       echo "However, you don't have nroff, so they're probably useless to you."
-       case "$man1dir" in
-       '') man1dir="none";;
-       esac;;
+: determine where add-on manual pages go
+case "$siteman1dir" in
+'')    dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
+*)     dflt=$siteman1dir ;;
 esac
-echo "If you don't want the manual sources installed, answer 'none'."
-case "$man1dir" in
-' ') dflt=none
-       ;;
-'')
-       lookpath="$prefixexp/share/man/man1"
-       lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
-       lookpath="$lookpath $prefixexp/man/p_man/man1"
-       lookpath="$lookpath $prefixexp/man/u_man/man1"
-       lookpath="$lookpath $prefixexp/man/man.1"
-       case "$sysman" in
-       */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
-       *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
-       esac
-       set dflt
-       eval $prefixup
-       ;;
-*)  dflt="$man1dir"
-       ;;
+case "$dflt" in
+''|' ') dflt=none ;;
 esac
-echo " "
 fn=dn+~
-rp="Where do the main $spackage manual pages (source) go?"
+rp='Pathname where the site-specific manual pages should be installed?'
 . ./getfile
-if $test "X$man1direxp" != "X$ansexp"; then
-       installman1dir=''
+siteman1dir="$ans"
+siteman1direxp="$ansexp"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
+else
+       installsiteman1dir="$siteman1direxp"
 fi
-man1dir="$ans"
-man1direxp="$ansexp"
-case "$man1dir" in
-'')    man1dir=' '
-       installman1dir='';;
-esac
 
+: determine where add-on library man pages go
+case "$siteman3dir" in
+'')    dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
+*)     dflt=$siteman3dir ;;
+esac
+case "$dflt" in
+''|' ') dflt=none ;;
+esac
+fn=dn+~
+rp='Pathname where the site-specific library manual pages should be installed?'
+. ./getfile
+siteman3dir="$ans"
+siteman3direxp="$ansexp"
 : Change installation prefix, if necessary.
 if $test X"$prefix" != X"$installprefix"; then
-       installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
+       installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
 else
-       installman1dir="$man1direxp"
+       installsiteman3dir="$siteman3direxp"
 fi
 
-: What suffix to use on installed man pages
+: determine where add-on public executable scripts go
+case "$sitescript" in
+'')    dflt=$siteprefix/script
+       $test -d $dflt || dflt=$sitebin ;;
+*)  dflt="$sitescript" ;;
+esac
+fn=d~+
+rp='Pathname where add-on public executable scripts should be installed?'
+. ./getfile
+sitescript="$ans"
+sitescriptexp="$ansexp"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
+else
+       installsitescript="$sitescriptexp"
+fi
 
-case "$man1dir" in
-' ')
-       man1ext='0'
+case "$usefaststdio" in
+$define|true|[yY]*|'')
+       xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
+       case "$xversion" in
+       [68])   dflt='y' ;;
+       *)      dflt='n' ;;
+       esac
        ;;
-*)
-       rp="What suffix should be used for the main $spackage man pages?"
-       case "$man1ext" in
-       '')     case "$man1dir" in
-               *1)  dflt=1 ;;
-               *1p) dflt=1p ;;
-               *1pm) dflt=1pm ;;
-               *l) dflt=l;;
-               *n) dflt=n;;
-               *o) dflt=o;;
-               *p) dflt=p;;
-               *C) dflt=C;;
-               *L) dflt=L;;
-               *L1) dflt=L1;;
-               *) dflt=1;;
-               esac
+*) dflt='n';;
+esac
+cat <<EOM
+
+Perl can be built to use 'fast stdio', which means using the stdio
+library but also directly manipulating the stdio buffers to enable
+faster I/O.  Using stdio is better for backward compatibility (especially
+for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
+interface has been preferred instead of stdio.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+rp='Use the "fast stdio" if available?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define" ;;     
+*)      val="$undef" ;;
+esac
+set usefaststdio
+eval $setvar
+
+
+: 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'
+
+: 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 "Checking to see how big your file offsets are..." >&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=`$run ./try`
+       echo "Your file offsets are $lseeksize bytes long."
+else
+       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
+       lseeksize="$ans"
+fi
+$rm -f try.c try
+
+: 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 "Checking the size of $zzz..." >&4 
+cat > try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+int main() {
+    printf("%d\n", (int)sizeof($fpostype));
+    exit(0);
+}
+EOCP
+set try
+if eval $compile_ok; then
+       yyy=`$run ./try`
+       case "$yyy" in
+       '')     fpossize=4
+               echo "(I can't execute the test program--guessing $fpossize.)" >&4
+               ;;
+       *)      fpossize=$yyy
+               echo "Your $zzz is $fpossize bytes long."
                ;;
-       *)      dflt="$man1ext";;
        esac
-       . ./myread
-       man1ext="$ans"
-       ;;
-esac
-
-: see if we can have long filenames
-echo " "
-first=123456789abcdef
-$rm -f $first
-if (echo hi >$first) 2>/dev/null; then
-       if $test -f 123456789abcde; then
-               echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
-               val="$undef"
-       else
-               echo 'You can have filenames longer than 14 characters.'>&4
-               val="$define"
-       fi
 else
-       $cat <<'EOM'
-You can't have filenames longer than 14 chars.
-You can't even think about them!
-EOM
-       val="$undef"
-fi 
-set d_flexfnam
-eval $setvar
-$rm -rf 123456789abcde*
+       dflt="$longsize"
+       echo " " >&4
+       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
 
-: determine where library module manual pages go
-set man3dir man3dir none
-eval $prefixit
-$cat <<EOM
+# Backward compatibility (uselfs is deprecated).
+case "$uselfs" in
+"$define"|true|[yY]*)
+       cat <<EOM >&4
 
-$spackage has manual pages for many of the library modules.
+*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
 EOM
+       uselargefiles="$define"
+       ;;
+esac                          
 
-case "$nroff" in
-nroff)
-       $cat <<'EOM'
-However, you don't have nroff, so they're probably useless to you.
-EOM
-       case "$man3dir" in
-       '') man3dir="none";;
-       esac;;
-esac
+case "$lseeksize:$fpossize" in
+8:8) cat <<EOM
 
-case "$d_flexfnam" in
-undef)
-       $cat <<'EOM'
-However, your system can't handle the long file names like File::Basename.3. 
+You can have files larger than 2 gigabytes.
 EOM
-       case "$man3dir" in
-       '') man3dir="none";;
-       esac;;
-esac
+   val="$define" ;;
+*)    case "$uselargefiles" in
+   "$undef"|false|[nN]*) dflt='n' ;;
+   *)  dflt='y' ;;
+   esac
+   cat <<EOM
 
-echo "If you don't want the manual sources installed, answer 'none'."
-prog=`echo $package | $sed 's/-*[0-9.]*$//'`
-case "$man3dir" in
-'')    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
+Perl can be built to understand large files (files larger than 2 gigabytes)
+on some systems.  To do so, Configure can be run with -Duselargefiles.
 
-WARNING:  Previous versions of perl installed man3 pages into
-$privlib/man/man3.  This version will suggest a 
-new default of $dflt.  
+If this doesn't make any sense to you, just accept the default '$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 ;;
+   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 uselargefiles.cbu; then
+               echo "Your platform has some specific hints for large file builds, using them..."
+               . ./uselargefiles.cbu
+               echo " "
+               echo "Rechecking to see how big your file offsets are..." >&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=`$run ./try`
+                       $echo "Your file offsets are now $lseeksize bytes long."
+               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
-    fi
+               $echo $n "Rechecking the size of $zzz...$c" >&4 
+               $cat > try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+int main() {
+    printf("%d\n", (int)sizeof($fpostype));
+    return(0);
+}
+EOCP
+               set try
+               if eval $compile_ok; then
+                       yyy=`$run ./try`
+                       dflt="$lseeksize"
+                       case "$yyy" in
+                       '')     echo " "
+                               echo "(I can't execute the test program--guessing $fpossize.)" >&4
+                               ;;
+                       *)      fpossize=$yyy
+                               echo " $fpossize bytes." >&4
+                               ;;
+                       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="$man3dir" ;;
-esac
-case "$dflt" in
-' ') dflt=none ;;
-esac
-echo " "
-fn=dn+~
-rp="Where do the $package library man pages (source) go?"
-. ./getfile
-man3dir="$ans"
-man3direxp="$ansexp"
-case "$man3dir" in
-'')    man3dir=' '
-       installman3dir='';;
 esac
 
+case "$vendorprefix" in
+'')    d_vendorbin="$undef"
+       vendorbin=''
+       vendorbinexp=''
+       ;;
+*)     d_vendorbin="$define"
+       : determine where vendor-supplied executables go.
+       case "$vendorbin" in
+       '') dflt=$vendorprefix/bin ;;
+       *)      dflt="$vendorbin" ;;
+       esac
+       fn=d~+
+       rp='Pathname for the vendor-supplied executables directory?'
+       . ./getfile
+       vendorbin="$ans"
+       vendorbinexp="$ansexp"
+       ;;
+esac
 : Change installation prefix, if necessary.
 if $test X"$prefix" != X"$installprefix"; then
-       installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
+       installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
 else
-       installman3dir="$man3direxp"
+       installvendorbin="$vendorbinexp"
 fi
 
-: What suffix to use on installed man pages
-case "$man3dir" in
-' ')
-       man3ext='0'
+case "$vendorprefix" in
+'')    vendorhtml1dir=''
+       vendorhtml1direxp=''
+       ;;
+*)     : determine where vendor-supplied html pages go.
+       : There is no standard location, so try to copy the previously-selected
+       : directory structure for the core html pages.
+       : XXX Better default suggestions would be welcome.
+       case "$vendorhtml1dir" in
+       '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
+       *)      dflt=$vendorhtml1dir ;;
+       esac
+       case "$dflt" in
+       ''|' ') dflt=none ;;
+       esac
+       fn=dn+~
+       rp='Pathname for the vendor-supplied html pages?'
+       . ./getfile
+       vendorhtml1dir="$ans"
+       vendorhtml1direxp="$ansexp"
        ;;
-*)
-       rp="What suffix should be used for the $package library man pages?"
-       case "$man3ext" in
-       '')     case "$man3dir" in
-               *3)  dflt=3 ;;
-               *3p) dflt=3p ;;
-               *3pm) dflt=3pm ;;
-               *l) dflt=l;;
-               *n) dflt=n;;
-               *o) dflt=o;;
-               *p) dflt=p;;
-               *C) dflt=C;;
-               *L) dflt=L;;
-               *L3) dflt=L3;;
-               *) dflt=3;;
-               esac
-               ;;
-       *)      dflt="$man3ext";;
+esac
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
+else
+       installvendorhtml1dir="$vendorhtml1direxp"
+fi
+
+case "$vendorprefix" in
+'')    vendorhtml3dir=''
+       vendorhtml3direxp=''
+       ;;
+*)     : determine where vendor-supplied module html pages go.
+       : There is no standard location, so try to copy the previously-selected
+       : directory structure for the core html pages.
+       : XXX Better default suggestions would be welcome.
+       case "$vendorhtml3dir" in
+       '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
+       *)      dflt=$vendorhtml3dir ;;
+       esac
+       case "$dflt" in
+       ''|' ') dflt=none ;;
        esac
-       . ./myread
-       man3ext="$ans"
+       fn=dn+~
+       rp='Pathname for the vendor-supplied html pages?'
+       . ./getfile
+       vendorhtml3dir="$ans"
+       vendorhtml3direxp="$ansexp"
        ;;
 esac
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
+else
+       installvendorhtml3dir="$vendorhtml3direxp"
+fi
 
-: see if we have to deal with yellow pages, now NIS.
-if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
-       if $test -f /usr/etc/nibindd; then
-               echo " "
-               echo "I'm fairly confident you're on a NeXT."
-               echo " "
-               rp='Do you get the hosts file via NetInfo?'
-               dflt=y
-               case "$hostcat" in
-               nidump*) ;;
-               '') ;;
-               *) dflt=n;;
-               esac
-               . ./myread
-               case "$ans" in
-               y*) hostcat='nidump hosts .';;
-               *)      case "$hostcat" in
-                       nidump*) hostcat='';;
-                       esac
-                       ;;
-               esac
-       fi
-       case "$hostcat" in
-       nidump*) ;;
-       *)
-               case "$hostcat" in
-               *ypcat*) dflt=y;;
-               '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
-                               dflt=y
-                       else
-                               dflt=n
-                       fi;;
-               *) dflt=n;;
-               esac
-               echo " "
-               rp='Are you getting the hosts file via yellow pages?'
-               . ./myread
-               case "$ans" in
-               y*) hostcat='ypcat hosts';;
-               *) hostcat='cat /etc/hosts';;
-               esac
-               ;;
+case "$vendorprefix" in
+'')    vendorman1dir=''
+       vendorman1direxp=''
+       ;;
+*)     : determine where vendor-supplied manual pages go.
+       case "$vendorman1dir" in
+       '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
+       *)      dflt=$vendorman1dir ;;
        esac
-fi
-case "$hostcat" in
-'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
-esac
-case "$groupcat" in
-'') test -f /etc/group && groupcat='cat /etc/group';;
-esac
-case "$passcat" in
-'') test -f /etc/passwd && passcat='cat /etc/passwd';;
+       case "$dflt" in
+       ''|' ') dflt=none ;;
+       esac
+       fn=nd~+
+       rp='Pathname for the vendor-supplied manual section 1 pages?'
+       . ./getfile
+       vendorman1dir="$ans"
+       vendorman1direxp="$ansexp"
+       ;;
 esac
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$vendorman1dir" = "X" && vendorman1dir=' '
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
+else
+       installvendorman1dir="$vendorman1direxp"
+fi
 
-: now get the host name
-echo " "
-echo "Figuring out host name..." >&4
-case "$myhostname" in
-'') cont=true
-       echo 'Maybe "hostname" will work...'
-       if tans=`sh -c hostname 2>&1` ; then
-               myhostname=$tans
-               phostname=hostname
-               cont=''
-       fi
+case "$vendorprefix" in
+'')    vendorman3dir=''
+       vendorman3direxp=''
+       ;;
+*)     : determine where vendor-supplied module manual pages go.
+       case "$vendorman3dir" in
+       '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
+       *)      dflt=$vendorman3dir ;;
+       esac
+       case "$dflt" in
+       ''|' ') dflt=none ;;
+       esac
+       fn=nd~+
+       rp='Pathname for the vendor-supplied manual section 3 pages?'
+       . ./getfile
+       vendorman3dir="$ans"
+       vendorman3direxp="$ansexp"
        ;;
-*) cont='';;
 esac
-if $test "$cont"; then
-       if ./xenix; then
-               echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
-               if tans=`cat /etc/systemid 2>&1` ; then
-                       myhostname=$tans
-                       phostname='cat /etc/systemid'
-                       echo "Whadyaknow.  Xenix always was a bit strange..."
-                       cont=''
-               fi
-       elif $test -r /etc/systemid; then
-               echo "(What is a non-Xenix system doing with /etc/systemid?)"
-       fi
-fi
-if $test "$cont"; then
-       echo 'No, maybe "uuname -l" will work...'
-       if tans=`sh -c 'uuname -l' 2>&1` ; then
-               myhostname=$tans
-               phostname='uuname -l'
-       else
-               echo 'Strange.  Maybe "uname -n" will work...'
-               if tans=`sh -c 'uname -n' 2>&1` ; then
-                       myhostname=$tans
-                       phostname='uname -n'
-               else
-                       echo 'Oh well, maybe I can mine it out of whoami.h...'
-                       if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
-                               myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
-                               phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
-                       else
-                               case "$myhostname" in
-                               '') echo "Does this machine have an identity crisis or something?"
-                                       phostname='';;
-                               *)
-                                       echo "Well, you said $myhostname before..."
-                                       phostname='echo $myhostname';;
-                               esac
-                       fi
-               fi
-       fi
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$vendorman3dir" = "X" && vendorman3dir=' '
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
+else
+       installvendorman3dir="$vendorman3direxp"
 fi
-case "$myhostname" in
-'') myhostname=noname ;;
-esac
-: you do not want to know about this
-set $myhostname
-myhostname=$1
 
-: verify guess
-if $test "$myhostname" ; then
-       dflt=y
-       rp='Your host name appears to be "'$myhostname'".'" Right?"
-       . ./myread
-       case "$ans" in
-       y*) ;;
-       *) myhostname='';;
+case "$vendorprefix" in
+'')    d_vendorscript="$undef"
+       vendorscript=''
+       vendorscriptexp=''
+       ;;
+*)     d_vendorscript="$define"
+       : determine where vendor-supplied scripts go.
+       case "$vendorscript" in
+       '')     dflt=$vendorprefix/script
+               $test -d $dflt || dflt=$vendorbin ;;
+       *)  dflt="$vendorscript" ;;
        esac
-fi
+       $cat <<EOM
 
-: bad guess or no guess
-while $test "X$myhostname" = X ; do
-       dflt=''
-       rp="Please type the (one word) name of your host:"
-       . ./myread
-       myhostname="$ans"
-done
+The installation process will create a directory for 
+vendor-supplied scripts.
 
-: translate upper to lower if necessary
-case "$myhostname" in
-*[A-Z]*)
-       echo "(Normalizing case in your host name)"
-       myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
+EOM
+       fn=d~+
+       rp='Pathname for the vendor-supplied scripts directory?'
+       . ./getfile
+       vendorscript="$ans"
+       vendorscriptexp="$ansexp"
        ;;
 esac
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
+else
+       installvendorscript="$vendorscriptexp"
+fi
 
-case "$myhostname" in
-*.*)
-       dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
-       myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
-       echo "(Trimming domain name from host name--host name is now $myhostname)"
-       ;;
-*) case "$mydomain" in
-       '')
-               {
-                       test "X$hostcat" = "Xypcat hosts" &&
-                       ypmatch "$myhostname" hosts 2>/dev/null |\
-                               $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
-                       $test -s hosts
-               } || {
-                       test "X$hostcat" != "X" &&
-                       $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
-                                       /[       ]$myhostname[  . ]/p" > hosts
-               }
-               tmp_re="[       . ]"
-               if $test -f hosts; then
-                       $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
-                            END { print sum }" hosts` = x1 || tmp_re="[         ]"
-                       dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
-                               hosts | $sort | $uniq | \
-                               $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
-                       case `$echo X$dflt` in
-                       X*\ *)  echo "(Several hosts in the database matched hostname)"
-                               dflt=.
-                               ;;
-                       X.) echo "(You do not have fully-qualified names in the hosts database)"
-                               ;;
-                       esac
-               else
-                       echo "(I cannot locate a hosts database anywhere)"
-                       dflt=.
-               fi
-               case "$dflt" in
-               .)
-                       tans=`./loc resolv.conf X /etc /usr/etc`
-                       if $test -f "$tans"; then
-                               echo "(Attempting domain name extraction from $tans)"
-                               dflt=.`$sed -n -e 's/   / /g' \
-                                 -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
-                                 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
-                               case "$dflt" in
-                               .) dflt=.`$sed -n -e 's/        / /g' \
-                                    -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
-                                    | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
-                                       ;;
-                               esac
-                       fi
-                       ;;
-               esac
-               case "$dflt" in
-               .) echo "(No help from resolv.conf either -- attempting clever guess)"
-                       dflt=.`sh -c domainname 2>/dev/null`
-                       case "$dflt" in
-                       '') dflt='.';;
-                       .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
-                       esac
-                       ;;
-               esac
-               case "$dflt$osname" in
-               .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
-                       dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
+: see if qgcvt exists
+set qgcvt d_qgcvt
+eval $inlibc
+
+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=`$run ./try`
+               case "$yyy" in
+               123.456)
+                       sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
+                       sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
+                       echo "We will use %f."
                        ;;
                esac
-               case "$dflt" in
-               .) echo "(Lost all hope -- silly guess then)"
-                       dflt='.nonet'
+       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=`$run ./try`
+               case "$yyy" in
+               123.456)
+                       sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
+                       sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
+                       echo "We will use %Lf."
                        ;;
                esac
-               $rm -f hosts
-               ;;
-       *) dflt="$mydomain";;
-       esac;;
-esac
-echo " "
-rp="What is your domain name?"
-. ./myread
-tans="$ans"
-case "$ans" in
-'') ;;
-.*) ;;
-*) tans=".$tans";;
-esac
-mydomain="$tans"
-
-: translate upper to lower if necessary
-case "$mydomain" in
-*[A-Z]*)
-       echo "(Normalizing case in your domain name)"
-       mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
-       ;;
-esac
+       fi
+fi
 
-: a little sanity check here
-case "$phostname" in
-'') ;;
-*)
-       case `$phostname | ./tr '[A-Z]' '[a-z]'` in
-       $myhostname$mydomain|$myhostname) ;;
-       *)
-               case "$phostname" in
-               sed*)
-                       echo "(That doesn't agree with your whoami.h file, by the way.)"
+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=`$run ./try`
+               case "$yyy" in
+               123.456)
+                       sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
+                       sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
+                       echo "We will use %llf."
                        ;;
-               *)
-                       echo "(That doesn't agree with your $phostname command, by the way.)"
+               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=`$run ./try`
+               case "$yyy" in
+               123.456)
+                       sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
+                       sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
+                       echo "We will use %lf."
                        ;;
                esac
+       fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+       echo "Cannot figure out how to print long doubles." >&4
+else
+       sSCNfldbl=$sPRIfldbl    # expect consistency
+fi
+
+$rm -f try try.*
+
+fi # d_longdbl
+
+case "$sPRIfldbl" in
+'')    d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
+       d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
+       d_SCNfldbl="$undef";
        ;;
-       esac
+*)     d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
+       d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
+       d_SCNfldbl="$define";
        ;;
 esac
 
-$cat <<EOM
+: Check how to convert floats to strings.
 
-I need to get your e-mail address in Internet format if possible, i.e.
-something like user@host.domain. Please answer accurately since I have
-no easy means to double check it. The default value provided below
-is most probably close to reality but may not be valid from outside
-your organization...
+if test "X$d_Gconvert" = X; then
 
-EOM
-cont=x
-while test "$cont"; do
-       case "$cf_email" in
-       '') dflt="$cf_by@$myhostname$mydomain";;
-       *) dflt="$cf_email";;
-       esac
-       rp='What is your e-mail address?'
-       . ./myread
-       cf_email="$ans"
-       case "$cf_email" in
-       *@*.*) cont='' ;;
-       *)
-               rp='Address does not look like an Internet one.  Use it anyway?'
-               case "$fastread" in
-               yes) dflt=y ;;
-               *) dflt=n ;;
-               esac
-               . ./myread
-               case "$ans" in
-               y*) cont='' ;;
-               *) echo " " ;;
-               esac
-               ;;
-       esac
-done
+echo " "
+echo "Checking for an efficient way to convert floats to strings."
+echo " " > try.c
+case "$uselongdouble" in
+"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
+esac
+case "$d_longdbl" in
+"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
+esac
+case "$d_PRIgldbl" in
+"$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
+esac
+$cat >>try.c <<EOP
+#ifdef TRY_gconvert
+#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
+char *myname = "gconvert";
+#endif
+#ifdef TRY_gcvt
+#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";
+#define DOUBLETYPE long double
+#endif
+#ifdef TRY_sprintf
+#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
+#ifdef HAS_PRIgldbl
+#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
+#else
+#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
+#endif
+#else
+#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
+#endif
+char *myname = "sprintf";
+#endif
+
+#ifndef DOUBLETYPE
+#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
+#define DOUBLETYPE long double
+#else
+#define DOUBLETYPE double
+#endif
+#endif
+
+#include <stdio.h>
+
+#define I_STDLIB $i_stdlib
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+
+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((DOUBLETYPE)0.1, 8, 0, buf);
+       checkit("0.1", buf);
+
+       Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
+       checkit("0.01", buf);
+
+       Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
+       checkit("0.001", buf);
+
+       Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
+       checkit("0.0001", buf);
+
+       Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
+       if (strlen(buf) > 5)
+           checkit("9e-005", buf); /* for Microsoft ?? */
+       else
+           checkit("9e-05", buf);
+
+       Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
+       checkit("1", buf);
+
+       Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
+       checkit("1.1", buf);
+
+       Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
+       checkit("1.01", buf);
+
+       Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
+       checkit("1.001", buf);
+
+       Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
+       checkit("1.0001", buf);
+
+       Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
+       checkit("1.00001", buf);
+
+       Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
+       checkit("1.000001", buf);
+
+       Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
+       checkit("0", buf);
+
+       Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
+       checkit("-1", buf);
 
-$cat <<EOM
+       /* Some Linux gcvt's give 1.e+5 here. */
+       Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
+       checkit("100000", buf);
+       
+       /* Some Linux gcvt's give -1.e+5 here. */
+       Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
+       checkit("-100000", buf);
 
-If you or somebody else will be maintaining perl at your site, please
-fill in the correct e-mail address here so that they may be contacted
-if necessary. Currently, the "perlbug" program included with perl
-will send mail to this address in addition to perlbug@perl.org. You may
-enter "none" for no administrator.
+       Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
+       checkit("123.456", buf);
 
-EOM
-case "$perladmin" in
-'') dflt="$cf_email";;
-*) dflt="$perladmin";;
-esac
-rp='Perl administrator e-mail address'
-. ./myread
-perladmin="$ans"
+       /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
+       Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
+       /* 34 should be enough to scare even long double
+        * places into using the e notation. */
+       if (strlen(buf) > 5)
+           checkit("1e+034", buf); /* for Microsoft */
+       else
+           checkit("1e+34", buf);
 
-: determine whether to only install version-specific parts.
-echo " "
-$cat <<EOM
-Do you want to install only the version-specific parts of the perl
-distribution?  Usually you do *not* want to do this.
-EOM
-case "$versiononly" in
-"$define"|[Yy]*|true) dflt='y' ;;
-*) dflt='n';
+       /* For Perl, if you add additional tests here, also add them to
+        * t/base/num.t for benefit of platforms not using Configure or
+        * overriding d_Gconvert */
+
+       exit(0);
+}
+EOP
+: first add preferred functions to our list
+xxx_list=""
+for xxx_convert in $gconvert_preference; do
+    case $xxx_convert in
+    gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
+    *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
+    esac 
+done
+: then add any others
+for xxx_convert in gconvert gcvt sprintf; do
+    case "$xxx_list" in
+    *$xxx_convert*) ;;
+    *) xxx_list="$xxx_list $xxx_convert" ;;
+    esac 
+done
+
+case "$d_longdbl$uselongdouble" in
+"$define$define")
+    : again, add prefered functions to our list first
+    xxx_ld_list=""
+    for xxx_convert in $gconvert_ld_preference; do
+        case $xxx_convert in
+        qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
+        *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
+        esac
+    done
+    : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
+    for xxx_convert in qgcvt sprintf $xxx_list; do
+        case "$xxx_ld_list" in
+        $xxx_convert*|*" $xxx_convert"*) ;;
+        *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
+        esac
+    done
+    : if sprintf cannot do long doubles, move it to the end
+    if test "$d_PRIgldbl" != "$define"; then
+        xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
+    fi
+    : if no qgcvt, remove it
+    if test "$d_qgcvt" != "$define"; then
+        xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
+    fi
+    : use the ld_list
+    xxx_list="$xxx_ld_list"
+    ;;
 esac
-rp="Do you want to install only the version-specific parts of perl?"
-. ./myread
-case "$ans" in
-[yY]*) val="$define";;
-*)     val="$undef" ;;
+
+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 $run ./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."
+                       xxx_convert=''
+               fi
+       else
+               echo "$xxx_convert NOT found." >&4
+       fi
+done
+
+if test X$xxx_convert = X; then
+    echo "*** WHOA THERE!!! ***" >&4
+    echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
+    xxx_convert=sprintf
+fi
+
+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))' ;;
+*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
+   "$define$define$define")
+      d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
+   "$define$define$undef")
+      d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
+   *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
+   esac
+   ;;  
 esac
-set versiononly
-eval $setvar
 
-: figure out how to guarantee perl startup
-case "$startperl" in
-'')
-       case "$sharpbang" in
-       *!)
-               $cat <<EOH
+fi
 
-I can use the #! construct to start perl on your system. This will
-make startup of perl scripts faster, but may cause problems if you
-want to share those scripts and perl is not in a standard place
-($binexp/perl) on all your platforms. The alternative is to force
-a shell by starting the script with a single ':' character.
+: see if _fwalk exists
+set fwalk d__fwalk
+eval $inlibc
 
-EOH
-               case "$versiononly" in
-               "$define")      dflt="$binexp/perl$version";;  
-               *)              dflt="$binexp/perl";;
-               esac
-               rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
-               . ./myread
-               case "$ans" in
-               none)   startperl=": # use perl";;
-               *)      startperl="#!$ans"
-                       if $test 30 -lt `echo "$ans" | wc -c`; then
-                               $cat >&4 <<EOM
+: Initialize h_fcntl
+h_fcntl=false
 
-WARNING:  Some systems limit the #! command to 32 characters.
-If you experience difficulty running Perl scripts with #!, try
-installing Perl in a directory with a shorter pathname.
+: Initialize h_sysfile
+h_sysfile=false
 
-EOM
-                       fi ;;
-               esac
-               ;;
-       *) startperl=": # use perl"
-               ;;
-       esac
+: access call always available on UNIX
+set access d_access
+eval $inlibc
+
+: locate the flags for 'access()'
+case "$d_access" in
+"$define")
+       echo " "
+       $cat >access.c <<EOCP
+#include <sys/types.h>
+#ifdef I_FCNTL
+#include <fcntl.h>
+#endif
+#ifdef I_SYS_FILE
+#include <sys/file.h>
+#endif
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+int main() {
+       exit(R_OK);
+}
+EOCP
+       : check sys/file.h first, no particular reason here
+       if $test `./findhdr sys/file.h` && \
+               $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
+               h_sysfile=true;
+               echo "<sys/file.h> defines the *_OK access constants." >&4
+       elif $test `./findhdr fcntl.h` && \
+               $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
+               h_fcntl=true;
+               echo "<fcntl.h> defines the *_OK access constants." >&4
+       elif $test `./findhdr unistd.h` && \
+               $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
+               echo "<unistd.h> defines the *_OK access constants." >&4
+       else
+               echo "I can't find the four *_OK access constants--I'll use mine." >&4
+       fi
        ;;
 esac
-echo "I'll use $startperl to start perl scripts."
+$rm -f access*
 
-: figure best path for perl in scripts
-case "$perlpath" in
-'')
-       case "$versiononly" in
-       "$define")      perlpath="$binexp/perl$version";;
-       *)              perlpath="$binexp/perl";;
-       esac
-       case "$startperl" in
-       *!*) ;;
-       *)
-               $cat <<EOH
+: see if accessx exists
+set accessx d_accessx
+eval $inlibc
 
-I will use the "eval 'exec'" idiom to start Perl on your system.
-I can use the full path of your Perl binary for this purpose, but
-doing so may cause problems if you want to share those scripts and
-Perl is not always in a standard place ($binexp/perl).
+: see if aintl exists
+set aintl d_aintl
+eval $inlibc
 
-EOH
-               dflt="$binexp/perl"
-               rp="What path shall I use in \"eval 'exec'\"?"
-               . ./myread
-               perlpath="$ans"
-               ;;
-       esac
-       ;;
-esac
-case "$startperl" in
-*!*)   ;;
-*)     echo "I'll use $perlpath in \"eval 'exec'\"" ;;
-esac
+: see if alarm exists
+set alarm d_alarm
+eval $inlibc
 
-: determine where public executable scripts go
-set scriptdir scriptdir
-eval $prefixit
-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 /usr/local/scripts && dflt=/usr/local/scripts
-       $test -d $prefixexp/script  && dflt=$prefixexp/script
-       set dflt
-       eval $prefixup
-       ;;
-*)  dflt="$scriptdir"
-       ;;
-esac
-$cat <<EOM
-Some installations have a separate directory just for executable scripts so
-that they can mount it across multiple architectures but keep the scripts in
-one spot.  You might, for example, have a subdirectory of /usr/share for this.
-Or you might just lump your scripts in with all your other executables.
-EOM
-fn=d~
-rp='Where do you keep publicly executable scripts?'
-. ./getfile
-if $test "X$ansexp" != "X$scriptdirexp"; then
-       installscript=''
-fi
-scriptdir="$ans"
-scriptdirexp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
-else
-       installscript="$scriptdirexp"
-fi
+: see if POSIX threads are available
+set pthread.h i_pthread
+eval $inhdr
+
+: define a fucntion to check prototypes
+$cat > protochk <<EOSH
+$startsh
+cc="$cc"
+optimize="$optimize"
+ccflags="$ccflags"
+prototype="$prototype"
+define="$define"
+rm=$rm
+usethreads=$usethreads
+i_pthread=$i_pthread
+pthread_h_first=$pthread_h_first
+EOSH
 
-: 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#"`
+$cat >> protochk <<'EOSH'
+
+$rm -f try.c
+foo="$1"
+shift
+while test $# -ge 2; do
+       case "$1" in
+               $define) echo "#include <$2>" >> try.c ;;
+               literal) echo "$2" >> try.c ;;
+       esac
+    # Extra magic for the benefit of systems that need pthread.h
+    # to be included early to correctly detect threadsafe functions.
+    # Such functions must guarantee themselves, though, that the usethreads
+    # and i_pthread have been defined, before calling protochk.
+    if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
+       echo "#include <pthread.h>" >> try.c
+       pthread_h_done=yes
+    fi
+    shift 2
+done
+test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
+cat >> try.c <<'EOCP'
+#ifdef CAN_PROTOTYPE
+#define        _(args) args
+#else
+#define        _(args) ()
+#endif
+EOCP
+echo "$foo" >> try.c
+echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
+$cc $optimize $ccflags -c try.c > /dev/null 2>&1
+status=$?
+$rm -f try.[co]
+exit $status
+EOSH
+chmod +x protochk
+$eunicefix protochk
+
+hasproto='varname=$1; func=$2; shift; shift;
+while $test $# -ge 2; do
+       case "$1" in
+       $define) echo "#include <$2>";;
+       esac ;
+    shift 2;
+done > try.c;
+$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
+if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
+       echo "$func() prototype found.";
+       val="$define";
 else
-       installsitebin="$sitebinexp"
-fi
+       echo "$func() prototype NOT found.";
+       val="$undef";
+fi;
+set $varname;
+eval $setvar;
+$rm -f try.c tryout.c'
 
-: 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 sys/types.h has to be included
+set sys/types.h i_systypes
+eval $inhdr
 
-: 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 sys/select.h has to be included
+set sys/select.h i_sysselct
+eval $inhdr
 
-: 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
+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'
 
+: see if we should include time.h, sys/time.h, or both
 echo " "
-echo "Checking to see how big your file offsets are..." >&4
-$cat >try.c <<EOCP
+if test "X$timeincl" = X; then
+       echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
+       $echo $n "I'm now running the test program...$c"
+       $cat >try.c <<EOCP
 #include <sys/types.h>
-#include <stdio.h>
+#ifdef I_TIME
+#include <time.h>
+#endif
+#ifdef I_SYSTIME
+#ifdef SYSTIMEKERNEL
+#define KERNEL
+#endif
+#include <sys/time.h>
+#endif
+#ifdef I_SYSSELECT
+#include <sys/select.h>
+#endif
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 int main()
 {
-    printf("%d\n", (int)sizeof($lseektype));
-    return(0); 
+       struct tm foo;
+#ifdef S_TIMEVAL
+       struct timeval bar;
+#endif
+#ifdef S_TIMEZONE
+       struct timezone tzp;
+#endif
+       if (foo.tm_sec == foo.tm_sec)
+               exit(0);
+#ifdef S_TIMEVAL
+       if (bar.tv_sec == bar.tv_sec)
+               exit(0);
+#endif
+       exit(1);
 }
 EOCP
-set try
-if eval $compile_ok; then
-       lseeksize=`$run ./try`
-       echo "Your file offsets are $lseeksize bytes long."
-else
-       dflt=$longsize
+       flags=''
+       for s_timezone in '-DS_TIMEZONE' ''; do
+       sysselect=''
+       for s_timeval in '-DS_TIMEVAL' ''; do
+       for i_systimek in '' '-DSYSTIMEKERNEL'; do
+       for i_time in '' '-DI_TIME'; do
+       for i_systime in '-DI_SYSTIME' ''; do
+               case "$flags" in
+               '') $echo $n ".$c"
+                       set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
+                       if eval $compile; then
+                               set X $i_time $i_systime $i_systimek $sysselect $s_timeval
+                               shift
+                               flags="$*"
+                               echo " "
+                               $echo $n "Succeeded with $flags$c"
+                       fi
+                       ;;
+               esac
+       done
+       done
+       done
+       done
+       done
+       timeincl=''
        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"
+       case "$flags" in
+       *SYSTIMEKERNEL*) i_systimek="$define"
+               timeincl=`./findhdr sys/time.h`
+               echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
+       *) i_systimek="$undef";;
+       esac
+       case "$flags" in
+       *I_TIME*) i_time="$define"
+               timeincl=`./findhdr time.h`" $timeincl"
+               echo "We'll include <time.h>." >&4;;
+       *) i_time="$undef";;
+       esac
+       case "$flags" in
+       *I_SYSTIME*) i_systime="$define"
+               timeincl=`./findhdr sys/time.h`" $timeincl"
+               echo "We'll include <sys/time.h>." >&4;;
+       *) i_systime="$undef";;
+       esac
+       $rm -f try.c try
 fi
-$rm -f try.c try
+: see if struct tm knows about tm_zone
+case "$i_systime$i_time" in
+*$define*) 
+        echo " "
+        echo "Checking to see if your struct tm has tm_zone field..." >&4
+        set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
+        eval $hasfield
+        ;;
+*)      val="$undef"
+        set d_tm_tm_zone
+        eval $setvar
+        ;;
+esac
+case "$d_tm_tm_zone" in
+"$define")      echo "Yes, it does."   ;;
+*)              echo "No, it doesn't." ;;
+esac
+: see if struct tm knows about tm_gmtoff
+case "$i_systime$i_time" in
+*$define*) 
+        echo " "
+        echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
+        set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
+        eval $hasfield
+        ;;
+*)      val="$undef"
+        set d_tm_tm_gmtoff
+        eval $setvar
+        ;;
+esac
+case "$d_tm_tm_gmtoff" in
+"$define")      echo "Yes, it does."   ;;
+*)              echo "No, it doesn't." ;;
+esac
+
+: see if asctime_r exists
+set asctime_r d_asctime_r
+eval $inlibc
+case "$d_asctime_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
+       case "$d_asctime_r_proto:$usethreads" in
+       ":define")      d_asctime_r_proto=define
+               set d_asctime_r_proto asctime_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_asctime_r_proto" in
+       define)
+       case "$asctime_r_proto" in
+       ''|0) try='char* asctime_r(const struct tm*, char*);'
+       ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
+       esac
+       case "$asctime_r_proto" in
+       ''|0) try='char* asctime_r(const struct tm*, char*, int);'
+       ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
+       esac
+       case "$asctime_r_proto" in
+       ''|0) try='int asctime_r(const struct tm*, char*);'
+       ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
+       esac
+       case "$asctime_r_proto" in
+       ''|0) try='int asctime_r(const struct tm*, char*, int);'
+       ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
+       esac
+       case "$asctime_r_proto" in
+       ''|0)   d_asctime_r=undef
+               asctime_r_proto=0
+               echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
+       * )     case "$asctime_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "asctime_r has no prototype, not using it." >&4 ;;
+               esac
+               d_asctime_r=undef
+               asctime_r_proto=0
+               ;;
+       esac
+       ;;
+*)     asctime_r_proto=0
+       ;;
+esac
 
-: 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
+: 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 " "
-case "$fpostype" in
-*_t) zzz="$fpostype"   ;;
-*)   zzz="fpos_t"      ;;
-esac
-echo "Checking the size of $zzz..." >&4 
-cat > try.c <<EOCP
-#include <sys/types.h>
+echo "Checking whether your compiler can handle __attribute__ ..." >&4
+$cat >attrib.c <<'EOCP'
 #include <stdio.h>
-int main() {
-    printf("%d\n", (int)sizeof($fpostype));
-    exit(0);
-}
+void croak (char* pat,...) __attribute__((__format__(__printf__,1,2),noreturn));
 EOCP
-set try
-if eval $compile_ok; then
-       yyy=`$run ./try`
-       case "$yyy" in
-       '')     fpossize=4
-               echo "(I can't execute the test program--guessing $fpossize.)" >&4
-               ;;
-       *)      fpossize=$yyy
-               echo "Your $zzz is $fpossize bytes long."
-               ;;
-       esac
+if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
+       if $contains 'warning' attrib.out >/dev/null 2>&1; then
+               echo "Your C compiler doesn't fully support __attribute__."
+               val="$undef"
+       else
+               echo "Your C compiler supports __attribute__."
+               val="$define"
+       fi
 else
-       dflt="$longsize"
-       echo " " >&4
-       echo "(I can't compile the test program.  Guessing...)" >&4
-       rp="What is the size of your file positions (in bytes)?"
-       . ./myread
-       fpossize="$ans"
+       echo "Your C compiler doesn't seem to understand __attribute__ at all."
+       val="$undef"
 fi
+set d_attribut
+eval $setvar
+$rm -f attrib*
 
+: see if bcmp exists
+set bcmp d_bcmp
+eval $inlibc
 
+: see if bcopy exists
+set bcopy d_bcopy
+eval $inlibc
 
-# Backward compatibility (uselfs is deprecated).
-case "$uselfs" in
-"$define"|true|[yY]*)
-       cat <<EOM >&4
-
-*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
-EOM
-       uselargefiles="$define"
-       ;;
-esac                          
-
-case "$lseeksize:$fpossize" in
-8:8) cat <<EOM
-
-You can have files larger than 2 gigabytes.
-EOM
-   val="$define" ;;
-*)    case "$uselargefiles" in
-   "$undef"|false|[nN]*) dflt='n' ;;
-   *)  dflt='y' ;;
-   esac
-   cat <<EOM
+: see if this is a unistd.h system
+set unistd.h i_unistd
+eval $inhdr
 
-Perl can be built to understand large files (files larger than 2 gigabytes)
-on some systems.  To do so, Configure can be run with -Duselargefiles.
+: see if getpgrp exists
+set getpgrp d_getpgrp
+eval $inlibc
 
-If this doesn't make any sense to you, just accept the default '$dflt'.
-EOM
-   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
+case "$d_getpgrp" 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 uselargefiles.cbu; then
-               echo "Your platform has some specific hints for large file builds, using them..."
-               . ./uselargefiles.cbu
-               echo " "
-               echo "Rechecking to see how big your file offsets are..." >&4
-               $cat >try.c <<EOCP
+       echo " "
+       echo "Checking to see which flavor of getpgrp is in use..."
+       $cat >try.c <<EOP
+#$i_unistd I_UNISTD
 #include <sys/types.h>
-#include <stdio.h>
+#ifdef I_UNISTD
+#  include <unistd.h>
+#endif
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 int main()
 {
-    printf("%d\n", (int)sizeof($lseektype));
-    return(0); 
+       if (getuid() == 0) {
+               printf("(I see you are running Configure as super-user...)\n");
+               setuid(1);
+       }
+#ifdef TRY_BSD_PGRP
+       if (getpgrp(1) == 0)
+               exit(0);
+#else
+       if (getpgrp() > 0)
+               exit(0);
+#endif
+       exit(1);
 }
-EOCP
-               set try
-               if eval $compile_ok; then
-                       lseeksize=`$run ./try`
-                       $echo "Your file offsets are now $lseeksize bytes long."
+EOP
+       if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
+               echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
+               val="$define"
+       elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
+               echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
+               val="$undef"
+       else
+               echo "I can't seem to compile and run the test program."
+               if ./usg; then
+                       xxx="a USG one, i.e. you use getpgrp()."
                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"
+                       # SVR4 systems can appear rather BSD-ish.
+                       case "$i_unistd" in
+                       $undef)
+                               xxx="a BSD one, i.e. you use getpgrp(pid)."
+                               val="$define"
+                               ;;
+                       $define)
+                               xxx="probably a USG one, i.e. you use getpgrp()."
+                               val="$undef"
+                               ;;
+                       esac
                fi
-               case "$fpostype" in
-               *_t) zzz="$fpostype"    ;;
-               *)   zzz="fpos_t"       ;;
-               esac
-               $echo $n "Rechecking the size of $zzz...$c" >&4 
-               $cat > try.c <<EOCP
+               echo "Assuming your getpgrp is $xxx" >&4
+       fi
+       ;;
+*) val="$undef";;
+esac
+set d_bsdgetpgrp
+eval $setvar
+$rm -f try try.*
+
+: see if setpgrp exists
+set setpgrp d_setpgrp
+eval $inlibc
+
+case "$d_setpgrp" in
+"$define")
+       echo " "
+       echo "Checking to see which flavor of setpgrp is in use..."
+       $cat >try.c <<EOP
+#$i_unistd I_UNISTD
 #include <sys/types.h>
-#include <stdio.h>
-int main() {
-    printf("%d\n", (int)sizeof($fpostype));
-    exit(0);
+#ifdef I_UNISTD
+#  include <unistd.h>
+#endif
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+int main()
+{
+       if (getuid() == 0) {
+               printf("(I see you are running Configure as super-user...)\n");
+               setuid(1);
+       }
+#ifdef TRY_BSD_PGRP
+       if (-1 == setpgrp(1, 1))
+               exit(0);
+#else
+       if (setpgrp() != -1)
+               exit(0);
+#endif
+       exit(1);
 }
-EOCP
-               set try
-               if eval $compile_ok; then
-                       yyy=`$run ./try`
-                       dflt="$lseeksize"
-                       case "$yyy" in
-                       '')     echo " "
-                               echo "(I can't execute the test program--guessing $fpossize.)" >&4
+EOP
+       if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
+               echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
+               val="$define"
+       elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
+               echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
+               val="$undef"
+       else
+               echo "(I can't seem to compile and run the test program.)"
+               if ./usg; then
+                       xxx="a USG one, i.e. you use setpgrp()."
+               else
+                       # SVR4 systems can appear rather BSD-ish.
+                       case "$i_unistd" in
+                       $undef)
+                               xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
+                               val="$define"
                                ;;
-                       *)      fpossize=$yyy
-                               echo " $fpossize bytes." >&4
+                       $define)
+                               xxx="probably a USG one, i.e. you use setpgrp()."
+                               val="$undef"
                                ;;
                        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
+               echo "Assuming your setpgrp is $xxx" >&4
        fi
        ;;
+*) val="$undef";;
 esac
+set d_bsdsetpgrp
+eval $setvar
+$rm -f try try.*
+: see if bzero exists
+set bzero d_bzero
+eval $inlibc
 
-case "$vendorprefix" in
-'')    d_vendorbin="$undef"
-       vendorbin=''
-       vendorbinexp=''
-       ;;
-*)     d_vendorbin="$define"
-       : determine where vendor-supplied executables go.
-       case "$vendorbin" in
-       '') dflt=$vendorprefix/bin ;;
-       *)      dflt="$vendorbin" ;;
+: see if signal is declared as pointer to function returning int or void
+echo " "
+xxx=`./findhdr signal.h`
+$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
+if $contains 'int.*\*[         ]*signal' $$.tmp >/dev/null 2>&1 ; then
+       echo "You have int (*signal())() instead of void." >&4
+       val="$undef"
+elif $contains 'void.*\*[      ]*signal' $$.tmp >/dev/null 2>&1 ; then
+       echo "You have void (*signal())()." >&4
+       val="$define"
+elif $contains 'extern[        ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
+       echo "You have int (*signal())() instead of void." >&4
+       val="$undef"
+elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
+       echo "You have void (*signal())()." >&4
+       val="$define"
+else
+       case "$d_voidsig" in
+       '')
+       echo "I can't determine whether signal handler returns void or int..." >&4
+               dflt=void
+               rp="What type does your signal handler return?"
+               . ./myread
+               case "$ans" in
+               v*) val="$define";;
+               *) val="$undef";;
+               esac;;
+       "$define")
+               echo "As you already told me, signal handler returns void." >&4
+               val="$define"
+               ;;
+       *)      echo "As you already told me, signal handler returns int." >&4
+               val="$undef"
+               ;;
        esac
-       fn=d~+
-       rp='Pathname for the vendor-supplied executables directory?'
-       . ./getfile
-       vendorbin="$ans"
-       vendorbinexp="$ansexp"
-       ;;
+fi
+set d_voidsig
+eval $setvar
+case "$d_voidsig" in
+"$define") signal_t="void";;
+*) signal_t="int";;
 esac
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
+$rm -f $$.tmp
+
+: check for ability to cast large floats to 32-bit ints.
+echo " "
+echo 'Checking whether your C compiler can cast large floats to int32.' >&4
+if $test "$intsize" -ge 4; then
+       xxx=int
 else
-       installvendorbin="$vendorbinexp"
+       xxx=long
 fi
+$cat >try.c <<EOCP
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#include <sys/types.h>
+#include <signal.h>
+$signal_t blech(s) int s; { exit(3); }
+int main()
+{
+       $xxx i32;
+       double f, g;
+       int result = 0;
+       char str[16];
+       signal(SIGFPE, blech);
 
-: see if qgcvt exists
-set qgcvt d_qgcvt
-eval $inlibc
+       /* Don't let compiler optimize the test away.  Store the number 
+          in a writable string for gcc to pass to sscanf under HP/UX.
+       */
+       sprintf(str, "2147483647");
+       sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
+       g = 10 * f;
+       i32  = ($xxx) g;
 
-: Check how to convert floats to strings.
-echo " "
-echo "Checking for an efficient way to convert floats to strings."
-echo " " > try.c
-case "$uselongdouble" in
-"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
-esac
-case "$d_longdbl" in
-"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
-esac
-case "$d_PRIgldbl" in
-"$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
+       /* x86 processors will probably give 0x8000 0000, which is a
+       sign change.  We don't want that.  We want to mimic SPARC
+          behavior here, which is to preserve the sign and give
+          back 0x7fff ffff.
+       */
+       if (i32 != ($xxx) f)
+               result |= 1;
+       exit(result);
+}
+EOCP
+set try
+if eval $compile_ok; then
+       $run ./try
+       yyy=$?
+else
+       echo "(I can't seem to compile the test program--assuming it can't)"
+       yyy=1
+fi
+case "$yyy" in
+0)     val="$define"
+       echo "Yup, it can."
+       ;;
+*)     val="$undef"
+       echo "Nope, it can't."
+       ;;
 esac
-$cat >>try.c <<EOP
-#ifdef TRY_gconvert
-#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
-char *myname = "gconvert";
-#endif
-#ifdef TRY_gcvt
-#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";
-#define DOUBLETYPE long double
-#endif
-#ifdef TRY_sprintf
-#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
-#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
-#else
-#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
-#endif
-char *myname = "sprintf";
-#endif
+set d_casti32
+eval $setvar
+$rm -f try try.*
 
-#ifndef DOUBLETYPE
-#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
-#define DOUBLETYPE long double
-#else
-#define DOUBLETYPE double
-#endif
+: check for ability to cast negative floats to unsigned
+echo " "
+echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
+$cat >try.c <<EOCP
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
 #endif
+#include <sys/types.h>
+#include <signal.h>
+$signal_t blech(s) int s; { exit(7); }
+$signal_t blech_in_list(s) int s; { exit(4); }
+unsigned long dummy_long(p) unsigned long p; { return p; }
+unsigned int dummy_int(p) unsigned int p; { return p; }
+unsigned short dummy_short(p) unsigned short p; { return p; }
+int main()
+{
+       double f;
+       unsigned long along;
+       unsigned int aint;
+       unsigned short ashort;
+       int result = 0;
+       char str[16];
+       
+       /* Frustrate gcc-2.7.2's optimizer which failed this test with
+          a direct f = -123. assignment.  gcc-2.8.0 reportedly
+          optimized the whole file away
+       */
+       /* Store the number in a writable string for gcc to pass to 
+          sscanf under HP/UX.
+       */
+       sprintf(str, "-123");
+       sscanf(str, "%lf", &f);  /* f = -123.; */
+
+       signal(SIGFPE, blech);
+       along = (unsigned long)f;
+       aint = (unsigned int)f;
+       ashort = (unsigned short)f;
+       if (along != (unsigned long)-123)
+               result |= 1;
+       if (aint != (unsigned int)-123)
+               result |= 1;
+       if (ashort != (unsigned short)-123)
+               result |= 1;
+       sprintf(str, "1073741824.");
+       sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
+       f = f + f;
+       along = 0;
+       along = (unsigned long)f;
+       if (along != 0x80000000)
+               result |= 2;
+       f -= 1.;
+       along = 0;
+       along = (unsigned long)f;
+       if (along != 0x7fffffff)
+               result |= 1;
+       f += 2.;
+       along = 0;
+       along = (unsigned long)f;
+       if (along != 0x80000001)
+               result |= 2;
+       if (result)
+               exit(result);
+       signal(SIGFPE, blech_in_list);
+       sprintf(str, "123.");
+       sscanf(str, "%lf", &f);  /* f = 123.; */
+       along = dummy_long((unsigned long)f);
+       aint = dummy_int((unsigned int)f);
+       ashort = dummy_short((unsigned short)f);
+       if (along != (unsigned long)123)
+               result |= 4;
+       if (aint != (unsigned int)123)
+               result |= 4;
+       if (ashort != (unsigned short)123)
+               result |= 4;
+       exit(result);
 
-#include <stdio.h>
+}
+EOCP
+set try
+if eval $compile_ok; then
+       $run ./try
+       castflags=$?
+else
+       echo "(I can't seem to compile the test program--assuming it can't)"
+       castflags=7
+fi
+case "$castflags" in
+0)     val="$define"
+       echo "Yup, it can."
+       ;;
+*)     val="$undef"
+       echo "Nope, it can't."
+       ;;
+esac
+set d_castneg
+eval $setvar
+$rm -f try.*
 
-#define I_STDLIB $i_stdlib
+: see if vprintf exists
+echo " "
+if set vprintf val -f d_vprintf; eval $csym; $val; then
+       echo 'vprintf() found.' >&4
+       val="$define"
+       $cat >try.c <<EOF
+#include <varargs.h>
+#$i_stdlib I_STDLIB
 #ifdef I_STDLIB
 #include <stdlib.h>
 #endif
 
-int
-checkit(expect, got)
-char *expect;
-char *got;
+int main() { xxx("foo"); }
+
+xxx(va_alist)
+va_dcl
 {
-    if (strcmp(expect, got)) {
-               printf("%s oddity:  Expected %s, got %s\n",
-                       myname, expect, got);
-               exit(1);
-       }
-}
+       va_list args;
+       char buf[10];
 
-int main()
-{ 
-       char buf[64]; 
-       buf[63] = '\0';
+       va_start(args);
+       exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
+}
+EOF
+       set try
+       if eval $compile && $run ./try; 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
+$rm -f try try.*
+set d_vprintf
+eval $setvar
+val=$val2
+set d_charvspr
+eval $setvar
 
-       /* This must be 1st test on (which?) platform */
-       /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
-       Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
-       checkit("0.1", buf);
+: see if chown exists
+set chown d_chown
+eval $inlibc
 
-       Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
-       checkit("1", buf);
+: see if chroot exists
+set chroot d_chroot
+eval $inlibc
 
-       Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
-       checkit("1.1", buf);
+: see if chsize exists
+set chsize d_chsize
+eval $inlibc
 
-       Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
-       checkit("1.01", buf);
+: see if class exists
+set class d_class
+eval $inlibc
 
-       Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
-       checkit("1.001", buf);
+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'
 
-       Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
-       checkit("1.0001", buf);
+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
 
-       Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
-       checkit("1.00001", buf);
+: see if socketpair exists
+set socketpair d_sockpair
+eval $inlibc
 
-       Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
-       checkit("1.000001", buf);
 
-       Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
-       checkit("0", buf);
+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
 
-       Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
-       checkit("-1", buf);
+: see if this is a sys/uio.h system
+set sys/uio.h i_sysuio
+eval $inhdr
 
-       /* Some Linux gcvt's give 1.e+5 here. */
-       Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
-       checkit("100000", buf);
-       
-       /* Some Linux gcvt's give -1.e+5 here. */
-       Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
-       checkit("-100000", buf);
 
-       Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
-       checkit("123.456", buf);
+echo " "
+echo "Checking to see if your system supports struct cmsghdr..." >&4
+set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
+eval $hasstruct
+case "$d_cmsghdr_s" in
+"$define")      echo "Yes, it does."   ;;
+*)              echo "No, it doesn't." ;;
+esac
 
-        /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
-        Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
-        if (strlen(buf) > 5)
-            checkit("1e+030", buf); /* for Microsoft */
-        else
-            checkit("1e+30", buf);
 
-       exit(0);
+: check for const keyword
+echo " "
+echo 'Checking to see if your C compiler knows about "const"...' >&4
+$cat >const.c <<'EOCP'
+typedef struct spug { int drokk; } spug;
+int main()
+{
+       const char *foo;
+       const spug y;
 }
-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 "$d_longdbl$uselongdouble$d_PRIgldbl" in
-"$define$define$define")
-    # for long doubles prefer first qgcvt, then sprintf
-    xxx_list="`echo $xxx_list|sed s/sprintf//`" 
-    xxx_list="sprintf $xxx_list"
-    case "$d_qgcvt" in
-    "$define") xxx_list="qgcvt $xxx_list" ;;
-    esac
-    ;;
-esac
+EOCP
+if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
+       val="$define"
+       echo "Yup, it does."
+else
+       val="$undef"
+       echo "Nope, it doesn't."
+fi
+set d_const
+eval $setvar
 
-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 $run ./try; then
-                       echo "I'll use $xxx_convert to convert floats into a string." >&4
-                       break;
+: see if copysignl exists
+set copysignl d_copysignl
+eval $inlibc
+
+: see if crypt exists
+echo " "
+set crypt d_crypt
+eval $inlibc
+case "$d_crypt" in
+$define) cryptlib='' ;;
+*)     if set crypt val -f d_crypt; eval $csym; $val; then
+               echo 'crypt() found.' >&4
+               val="$define"
+               cryptlib=''
+       else
+               cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
+               if $test -z "$cryptlib"; then
+                       cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
                else
-                       echo "...But $xxx_convert didn't work as I expected."
+                       cryptlib=-lcrypt
+               fi
+               if $test -z "$cryptlib"; then
+                       cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
+               else
+                       cryptlib=-lcrypt
+               fi
+               if $test -z "$cryptlib"; then
+                       cryptlib=`./loc libcrypt$_a "" $libpth`
+               else
+                       cryptlib=-lcrypt
+               fi
+               if $test -z "$cryptlib"; then
+                       echo 'crypt() NOT found.' >&4
+                       val="$undef"
+               else
+                       val="$define"
                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))' ;;
-*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
-   "$define$define$define")
-      d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
-   *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
-   esac
-   ;;  
+       set d_crypt
+       eval $setvar
+       ;;
 esac
 
-: see if _fwalk exists
-set fwalk d__fwalk
-eval $inlibc
+: see if this is a crypt.h system
+set crypt.h i_crypt
+eval $inhdr
 
-: Initialize h_fcntl
-h_fcntl=false
+: see if crypt_r exists
+set crypt_r d_crypt_r
+eval $inlibc
+case "$d_crypt_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
+       case "$d_crypt_r_proto:$usethreads" in
+       ":define")      d_crypt_r_proto=define
+               set d_crypt_r_proto crypt_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_crypt_r_proto" in
+       define)
+       case "$crypt_r_proto" in
+       ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
+       ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
+       esac
+       case "$crypt_r_proto" in
+       ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
+       ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
+       esac
+       case "$crypt_r_proto" in
+       ''|0)   d_crypt_r=undef
+               crypt_r_proto=0
+               echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
+       * )     case "$crypt_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "crypt_r has no prototype, not using it." >&4 ;;
+               esac
+               d_crypt_r=undef
+               crypt_r_proto=0
+               ;;
+       esac
+       ;;
+*)     crypt_r_proto=0
+       ;;
+esac
 
-: Initialize h_sysfile
-h_sysfile=false
+: get csh whereabouts
+case "$csh" in
+'csh') val="$undef" ;;
+*) val="$define" ;;
+esac
+set d_csh
+eval $setvar
+: Respect a hint or command line value for full_csh.
+case "$full_csh" in
+'') full_csh=$csh ;;
+esac
 
-: access call always available on UNIX
-set access d_access
+: see if ctermid_r exists
+set ctermid_r d_ctermid_r
 eval $inlibc
+case "$d_ctermid_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h "
+       case "$d_ctermid_r_proto:$usethreads" in
+       ":define")      d_ctermid_r_proto=define
+               set d_ctermid_r_proto ctermid_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_ctermid_r_proto" in
+       define)
+       case "$ctermid_r_proto" in
+       ''|0) try='char* ctermid_r(char*);'
+       ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
+       esac
+       case "$ctermid_r_proto" in
+       ''|0)   d_ctermid_r=undef
+               ctermid_r_proto=0
+               echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
+       * )     case "$ctermid_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "ctermid_r has no prototype, not using it." >&4 ;;
+               esac
+               d_ctermid_r=undef
+               ctermid_r_proto=0
+               ;;
+       esac
+       ;;
+*)     ctermid_r_proto=0
+       ;;
+esac
 
-: locate the flags for 'access()'
-case "$d_access" in
+: see if ctime_r exists
+set ctime_r d_ctime_r
+eval $inlibc
+case "$d_ctime_r" in
 "$define")
-       echo " "
-       $cat >access.c <<'EOCP'
-#include <sys/types.h>
-#ifdef I_FCNTL
-#include <fcntl.h>
+       hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
+       case "$d_ctime_r_proto:$usethreads" in
+       ":define")      d_ctime_r_proto=define
+               set d_ctime_r_proto ctime_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_ctime_r_proto" in
+       define)
+       case "$ctime_r_proto" in
+       ''|0) try='char* ctime_r(const time_t*, char*);'
+       ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
+       esac
+       case "$ctime_r_proto" in
+       ''|0) try='char* ctime_r(const time_t*, char*, int);'
+       ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
+       esac
+       case "$ctime_r_proto" in
+       ''|0) try='int ctime_r(const time_t*, char*);'
+       ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
+       esac
+       case "$ctime_r_proto" in
+       ''|0) try='int ctime_r(const time_t*, char*, int);'
+       ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
+       esac
+       case "$ctime_r_proto" in
+       ''|0)   d_ctime_r=undef
+               ctime_r_proto=0
+               echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
+       * )     case "$ctime_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "ctime_r has no prototype, not using it." >&4 ;;
+               esac
+               d_ctime_r=undef
+               ctime_r_proto=0
+               ;;
+       esac
+       ;;
+*)     ctime_r_proto=0
+       ;;
+esac
+
+: see if cuserid exists
+set cuserid d_cuserid
+eval $inlibc
+
+: see if this is a limits.h system
+set limits.h i_limits
+eval $inhdr
+
+: see if this is a float.h system
+set float.h i_float
+eval $inhdr
+
+: See if number of significant digits in a double precision number is known
+echo " "
+$cat >dbl_dig.c <<EOM
+#$i_limits I_LIMITS
+#$i_float I_FLOAT
+#ifdef I_LIMITS
+#include <limits.h>
 #endif
-#ifdef I_SYS_FILE
-#include <sys/file.h>
+#ifdef I_FLOAT
+#include <float.h>
 #endif
-#ifdef I_UNISTD
-#include <unistd.h>
+#ifdef DBL_DIG
+printf("Contains DBL_DIG");
 #endif
-int main() {
-       exit(R_OK);
-}
-EOCP
-       : check sys/file.h first, no particular reason here
-       if $test `./findhdr sys/file.h` && \
-               $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
-               h_sysfile=true;
-               echo "<sys/file.h> defines the *_OK access constants." >&4
-       elif $test `./findhdr fcntl.h` && \
-               $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
-               h_fcntl=true;
-               echo "<fcntl.h> defines the *_OK access constants." >&4
-       elif $test `./findhdr unistd.h` && \
-               $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
-               echo "<unistd.h> defines the *_OK access constants." >&4
-       else
-               echo "I can't find the four *_OK access constants--I'll use mine." >&4
-       fi
+EOM
+$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
+if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
+       echo "DBL_DIG found." >&4
+       val="$define"
+else
+       echo "DBL_DIG NOT found." >&4
+       val="$undef"
+fi
+$rm -f dbl_dig.?
+set d_dbl_dig
+eval $setvar
+
+: see if dbm.h is available
+: see if dbmclose exists
+set dbmclose d_dbmclose
+eval $inlibc
+
+case "$d_dbmclose" in
+$define)
+       set dbm.h i_dbm
+       eval $inhdr
+       case "$i_dbm" in
+       $define)
+               val="$undef"
+               set i_rpcsvcdbm
+               eval $setvar
+               ;;
+       *)      set rpcsvc/dbm.h i_rpcsvcdbm
+               eval $inhdr
+               ;;
+       esac
+       ;;
+*)     echo "We won't be including <dbm.h>"
+       val="$undef"
+       set i_dbm
+       eval $setvar
+       val="$undef"
+       set i_rpcsvcdbm
+       eval $setvar
        ;;
 esac
-$rm -f access*
 
-: see if accessx exists
-set accessx d_accessx
-eval $inlibc
+: see if prototype for dbminit is available
+echo " "
+set d_dbminitproto dbminit $i_dbm dbm.h
+eval $hasproto
 
-: see if alarm exists
-set alarm d_alarm
+: see if difftime exists
+set difftime d_difftime
 eval $inlibc
 
-: see if atolf exists
-set atolf d_atolf
-eval $inlibc
+: see if this is a dirent system
+echo " "
+if xinc=`./findhdr dirent.h`; $test "$xinc"; then
+       val="$define"
+       echo "<dirent.h> found." >&4
+else
+       val="$undef"
+       if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
+               echo "<sys/dir.h> found." >&4
+               echo " "
+       else
+               xinc=`./findhdr sys/ndir.h`
+       fi
+       echo "<dirent.h> NOT found." >&4
+fi
+set i_dirent
+eval $setvar
+
+: Look for type of directory structure.
+echo " "
+$cppstdin $cppflags $cppminus < "$xinc" > try.c
+
+case "$direntrytype" in
+''|' ')
+       case "$i_dirent" in
+       $define) guess1='struct dirent' ;;
+       *) guess1='struct direct'  ;;
+       esac
+       ;;
+*)     guess1="$direntrytype"
+       ;;
+esac
+
+case "$guess1" in
+'struct dirent') guess2='struct direct' ;;
+*) guess2='struct dirent' ;;
+esac
+               
+if $contains "$guess1" try.c >/dev/null 2>&1; then
+       direntrytype="$guess1"
+       echo "Your directory entries are $direntrytype." >&4
+elif $contains "$guess2" try.c >/dev/null 2>&1; then
+       direntrytype="$guess2"
+       echo "Your directory entries seem to be $direntrytype." >&4
+else
+       echo "I don't recognize your system's directory entries." >&4
+       rp="What type is used for directory entries on this system?"
+       dflt="$guess1"
+       . ./myread
+       direntrytype="$ans"
+fi
+$rm -f try.c
 
-: see if atoll exists
-set atoll d_atoll
-eval $inlibc
 
-: Look for GNU-cc style attribute checking
+: see if the directory entry stores field length
 echo " "
-echo "Checking whether your compiler can handle __attribute__ ..." >&4
-$cat >attrib.c <<'EOCP'
-#include <stdio.h>
-void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
-EOCP
-if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
-       if $contains 'warning' attrib.out >/dev/null 2>&1; then
-               echo "Your C compiler doesn't fully support __attribute__."
-               val="$undef"
-       else
-               echo "Your C compiler supports __attribute__."
-               val="$define"
-       fi
+$cppstdin $cppflags $cppminus < "$xinc" > try.c
+if $contains 'd_namlen' try.c >/dev/null 2>&1; then
+       echo "Good, your directory entry keeps length information in d_namlen." >&4
+       val="$define"
 else
-       echo "Your C compiler doesn't seem to understand __attribute__ at all."
+       echo "Your directory entry does not know about the d_namlen field." >&4
        val="$undef"
 fi
-set d_attribut
+set d_dirnamlen
 eval $setvar
-$rm -f attrib*
-
-: see if bcmp exists
-set bcmp d_bcmp
-eval $inlibc
-
-: see if bcopy exists
-set bcopy d_bcopy
-eval $inlibc
+$rm -f try.c
 
-: see if this is a unistd.h system
-set unistd.h i_unistd
+: see if this is an sysdir system
+set sys/dir.h i_sysdir
 eval $inhdr
 
-: see if getpgrp exists
-set getpgrp d_getpgrp
-eval $inlibc
+: see if this is an sysndir system
+set sys/ndir.h i_sysndir
+eval $inhdr
 
-case "$d_getpgrp" in
-"$define")
-       echo " "
-       echo "Checking to see which flavor of getpgrp is in use..."
-       $cat >try.c <<EOP
-#$i_unistd I_UNISTD
+: Look for dirfd
+echo " "
+$cat >dirfd.c <<EOM
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#$i_dirent I_DIRENT            /**/
+#$i_sysdir I_SYS_DIR           /**/
+#$i_sysndir I_SYS_NDIR         /**/
+#$i_systypes I_SYS_TYPES       /**/
+#if defined(I_SYS_TYPES)
 #include <sys/types.h>
-#ifdef I_UNISTD
-#  include <unistd.h>
 #endif
-int main()
-{
-       if (getuid() == 0) {
-               printf("(I see you are running Configure as super-user...)\n");
-               setuid(1);
-       }
-#ifdef TRY_BSD_PGRP
-       if (getpgrp(1) == 0)
-               exit(0);
+#if defined(I_DIRENT)
+#include <dirent.h>
+#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
+#include <sys/dir.h>
+#endif
 #else
-       if (getpgrp() > 0)
-               exit(0);
+#ifdef I_SYS_NDIR
+#include <sys/ndir.h>
+#else
+#ifdef I_SYS_DIR
+#ifdef hp9000s500
+#include <ndir.h>      /* may be wrong in the future */
+#else
+#include <sys/dir.h>
 #endif
-       exit(1);
-}
-EOP
-       if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
-               echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
-               val="$define"
-       elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
-               echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
-               val="$undef"
-       else
-               echo "I can't seem to compile and run the test program."
-               if ./usg; then
-                       xxx="a USG one, i.e. you use getpgrp()."
-               else
-                       # SVR4 systems can appear rather BSD-ish.
-                       case "$i_unistd" in
-                       $undef)
-                               xxx="a BSD one, i.e. you use getpgrp(pid)."
-                               val="$define"
-                               ;;
-                       $define)
-                               xxx="probably a USG one, i.e. you use getpgrp()."
-                               val="$undef"
-                               ;;
-                       esac
-               fi
-               echo "Assuming your getpgrp is $xxx" >&4
-       fi
-       ;;
-*) val="$undef";;
-esac
-set d_bsdgetpgrp
-eval $setvar
-$rm -f try try.*
-
-: see if setpgrp exists
-set setpgrp d_setpgrp
-eval $inlibc
-
-case "$d_setpgrp" in
-"$define")
-       echo " "
-       echo "Checking to see which flavor of setpgrp is in use..."
-       $cat >try.c <<EOP
-#$i_unistd I_UNISTD
-#include <sys/types.h>
-#ifdef I_UNISTD
-#  include <unistd.h>
 #endif
-int main()
-{
-       if (getuid() == 0) {
-               printf("(I see you are running Configure as super-user...)\n");
-               setuid(1);
-       }
-#ifdef TRY_BSD_PGRP
-       if (-1 == setpgrp(1, 1))
-               exit(0);
-#else
-       if (setpgrp() != -1)
-               exit(0);
 #endif
-       exit(1);
-}
-EOP
-       if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
-               echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
-               val="$define"
-       elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
-               echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
-               val="$undef"
+#endif 
+int main() {
+       DIR *dirp = opendir(".");
+       if (dirfd(dirp) >= 0)
+               exit(0);
        else
-               echo "(I can't seem to compile and run the test program.)"
-               if ./usg; then
-                       xxx="a USG one, i.e. you use setpgrp()."
-               else
-                       # SVR4 systems can appear rather BSD-ish.
-                       case "$i_unistd" in
-                       $undef)
-                               xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
-                               val="$define"
-                               ;;
-                       $define)
-                               xxx="probably a USG one, i.e. you use setpgrp()."
-                               val="$undef"
-                               ;;
-                       esac
-               fi
-               echo "Assuming your setpgrp is $xxx" >&4
-       fi
-       ;;
-*) val="$undef";;
-esac
-set d_bsdsetpgrp
-eval $setvar
-$rm -f try try.*
-: see if bzero exists
-set bzero d_bzero
-eval $inlibc
-
-: see if signal is declared as pointer to function returning int or void
-echo " "
-xxx=`./findhdr signal.h`
-$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
-if $contains 'int.*\*[         ]*signal' $$.tmp >/dev/null 2>&1 ; then
-       echo "You have int (*signal())() instead of void." >&4
-       val="$undef"
-elif $contains 'void.*\*[      ]*signal' $$.tmp >/dev/null 2>&1 ; then
-       echo "You have void (*signal())()." >&4
-       val="$define"
-elif $contains 'extern[        ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
-       echo "You have int (*signal())() instead of void." >&4
-       val="$undef"
-elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
-       echo "You have void (*signal())()." >&4
-       val="$define"
-else
-       case "$d_voidsig" in
-       '')
-       echo "I can't determine whether signal handler returns void or int..." >&4
-               dflt=void
-               rp="What type does your signal handler return?"
-               . ./myread
-               case "$ans" in
-               v*) val="$define";;
-               *) val="$undef";;
-               esac;;
-       "$define")
-               echo "As you already told me, signal handler returns void." >&4
-               val="$define"
-               ;;
-       *)      echo "As you already told me, signal handler returns int." >&4
-               val="$undef"
-               ;;
-       esac
+               exit(1);
+}
+EOM
+set dirfd
+if eval $compile; then
+       val="$define"
 fi
-set d_voidsig
-eval $setvar
-case "$d_voidsig" in
-"$define") signal_t="void";;
-*) signal_t="int";;
+case "$val" in
+$define)       echo "dirfd() found." >&4       ;;
+*)             echo "dirfd() NOT found." >&4   ;;
 esac
-$rm -f $$.tmp
+set d_dirfd
+eval $setvar
+$rm -f dirfd*
 
-: check for ability to cast large floats to 32-bit ints.
-echo " "
-echo 'Checking whether your C compiler can cast large floats to int32.' >&4
-if $test "$intsize" -ge 4; then
-       xxx=int
-else
-       xxx=long
-fi
-$cat >try.c <<EOCP
-#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
-$signal_t blech(s) int s; { exit(3); }
-int main()
-{
-       $xxx i32;
-       double f, g;
-       int result = 0;
-       char str[16];
-       signal(SIGFPE, blech);
+: see if dlerror exists
+xxx_runnm="$runnm"
+runnm=false
+set dlerror d_dlerror
+eval $inlibc
+runnm="$xxx_runnm"
 
-       /* Don't let compiler optimize the test away.  Store the number 
-          in a writable string for gcc to pass to sscanf under HP/UX.
-       */
-       sprintf(str, "2147483647");
-       sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
-       g = 10 * f;
-       i32  = ($xxx) g;
+: see if dlfcn is available
+set dlfcn.h i_dlfcn
+eval $inhdr
 
-       /* x86 processors will probably give 0x8000 0000, which is a
-       sign change.  We don't want that.  We want to mimic SPARC
-          behavior here, which is to preserve the sign and give
-          back 0x7fff ffff.
-       */
-       if (i32 != ($xxx) f)
-               result |= 1;
-       exit(result);
-}
-EOCP
-set try
-if eval $compile_ok; then
-       $run ./try
-       yyy=$?
-else
-       echo "(I can't seem to compile the test program--assuming it can't)"
-       yyy=1
-fi
-case "$yyy" in
-0)     val="$define"
-       echo "Yup, it can."
+case "$usedl" in
+$define|y|true)
+       $cat << EOM
+
+On a few systems, the dynamically loaded modules that perl generates and uses
+will need a different extension than shared libs. The default will probably
+be appropriate.
+
+EOM
+       case "$dlext" in
+       '')     dflt="$so" ;;
+       *)      dflt="$dlext" ;;
+       esac
+       rp='What is the extension of dynamically loaded modules'
+       . ./myread
+       dlext="$ans"
        ;;
-*)     val="$undef"
-       echo "Nope, it can't."
+*)
+       dlext="none"
        ;;
 esac
-set d_casti32
-eval $setvar
-$rm -f try try.*
 
-: check for ability to cast negative floats to unsigned
+: Check if dlsym need a leading underscore
 echo " "
-echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
-$cat >try.c <<EOCP
+val="$undef"
+
+case "$dlsrc" in
+dl_dlopen.xs)
+       echo "Checking whether your dlsym() needs a leading underscore ..." >&4
+       $cat >dyna.c <<'EOM'
+fred () { }
+EOM
+
+$cat >fred.c<<EOM
+
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#$i_dlfcn I_DLFCN
+#ifdef I_DLFCN
+#include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
+#else
 #include <sys/types.h>
-#include <signal.h>
-$signal_t blech(s) int s; { exit(7); }
-$signal_t blech_in_list(s) int s; { exit(4); }
-unsigned long dummy_long(p) unsigned long p; { return p; }
-unsigned int dummy_int(p) unsigned int p; { return p; }
-unsigned short dummy_short(p) unsigned short p; { return p; }
-int main()
-{
-       double f;
-       unsigned long along;
-       unsigned int aint;
-       unsigned short ashort;
-       int result = 0;
-       char str[16];
-       
-       /* Frustrate gcc-2.7.2's optimizer which failed this test with
-          a direct f = -123. assignment.  gcc-2.8.0 reportedly
-          optimized the whole file away
-       */
-       /* Store the number in a writable string for gcc to pass to 
-          sscanf under HP/UX.
-       */
-       sprintf(str, "-123");
-       sscanf(str, "%lf", &f);  /* f = -123.; */
+#include <nlist.h>
+#include <link.h>
+#endif
 
-       signal(SIGFPE, blech);
-       along = (unsigned long)f;
-       aint = (unsigned int)f;
-       ashort = (unsigned short)f;
-       if (along != (unsigned long)-123)
-               result |= 1;
-       if (aint != (unsigned int)-123)
-               result |= 1;
-       if (ashort != (unsigned short)-123)
-               result |= 1;
-       sprintf(str, "1073741824.");
-       sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
-       f = f + f;
-       along = 0;
-       along = (unsigned long)f;
-       if (along != 0x80000000)
-               result |= 2;
-       f -= 1.;
-       along = 0;
-       along = (unsigned long)f;
-       if (along != 0x7fffffff)
-               result |= 1;
-       f += 2.;
-       along = 0;
-       along = (unsigned long)f;
-       if (along != 0x80000001)
-               result |= 2;
-       if (result)
-               exit(result);
-       signal(SIGFPE, blech_in_list);
-       sprintf(str, "123.");
-       sscanf(str, "%lf", &f);  /* f = 123.; */
-       along = dummy_long((unsigned long)f);
-       aint = dummy_int((unsigned int)f);
-       ashort = dummy_short((unsigned short)f);
-       if (along != (unsigned long)123)
-               result |= 4;
-       if (aint != (unsigned int)123)
-               result |= 4;
-       if (ashort != (unsigned short)123)
-               result |= 4;
-       exit(result);
+extern int fred() ;
 
+int main()
+{
+    void * handle ;
+    void * symbol ;
+#ifndef RTLD_LAZY
+    int mode = 1 ;
+#else
+    int mode = RTLD_LAZY ;
+#endif
+    handle = dlopen("./dyna.$dlext", mode) ;
+    if (handle == NULL) {
+       printf ("1\n") ;
+       fflush (stdout) ;
+       exit(0);
+    }
+    symbol = dlsym(handle, "fred") ;
+    if (symbol == NULL) {
+       /* try putting a leading underscore */
+       symbol = dlsym(handle, "_fred") ;
+       if (symbol == NULL) {
+           printf ("2\n") ;
+           fflush (stdout) ;
+           exit(0);
+       }
+       printf ("3\n") ;
+    }
+    else
+       printf ("4\n") ;
+    fflush (stdout) ;
+    exit(0);
 }
-EOCP
-set try
-if eval $compile_ok; then
-       $run ./try
-       castflags=$?
-else
-       echo "(I can't seem to compile the test program--assuming it can't)"
-       castflags=7
-fi
-case "$castflags" in
-0)     val="$define"
-       echo "Yup, it can."
+EOM
+       : Call the object file tmp-dyna.o in case dlext=o.
+       if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
+               mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
+               $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
+               $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
+               xxx=`$run ./fred`
+               case $xxx in
+               1)      echo "Test program failed using dlopen." >&4
+                       echo "Perhaps you should not use dynamic loading." >&4;;
+               2)      echo "Test program failed using dlsym." >&4
+                       echo "Perhaps you should not use dynamic loading." >&4;;
+               3)      echo "dlsym needs a leading underscore" >&4
+                       val="$define" ;;
+               4)      echo "dlsym doesn't need a leading underscore." >&4;;
+               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
+               
+$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
+
+set d_dlsymun
+eval $setvar
+
+: see if drand48_r exists
+set drand48_r d_drand48_r
+eval $inlibc
+case "$d_drand48_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
+       case "$d_drand48_r_proto:$usethreads" in
+       ":define")      d_drand48_r_proto=define
+               set d_drand48_r_proto drand48_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_drand48_r_proto" in
+       define)
+       case "$drand48_r_proto" in
+       ''|0) try='int drand48_r(struct drand48_data*, double*);'
+       ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
+       esac
+       case "$drand48_r_proto" in
+       ''|0)   d_drand48_r=undef
+               drand48_r_proto=0
+               echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
+       * )     case "$drand48_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
        ;;
-*)     val="$undef"
-       echo "Nope, it can't."
+       *)      case "$usethreads" in
+               define) echo "drand48_r has no prototype, not using it." >&4 ;;
+               esac
+               d_drand48_r=undef
+               drand48_r_proto=0
+               ;;
+       esac
+       ;;
+*)     drand48_r_proto=0
        ;;
 esac
-set d_castneg
-eval $setvar
-$rm -f try.*
 
-: see if vprintf exists
+: see if prototype for drand48 is available
 echo " "
-if set vprintf val -f d_vprintf; eval $csym; $val; then
-       echo 'vprintf() found.' >&4
-       val="$define"
-       $cat >try.c <<'EOF'
-#include <varargs.h>
+set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
+eval $hasproto
 
-int main() { xxx("foo"); }
+: see if dup2 exists
+set dup2 d_dup2
+eval $inlibc
 
-xxx(va_alist)
-va_dcl
-{
-       va_list args;
-       char buf[10];
+: see if eaccess exists
+set eaccess d_eaccess
+eval $inlibc
 
-       va_start(args);
-       exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
-}
-EOF
-       set try
-       if eval $compile && $run ./try; then
-               echo "Your vsprintf() returns (int)." >&4
-               val2="$undef"
+: see if endgrent exists
+set endgrent d_endgrent
+eval $inlibc
+
+: see if this is an grp system
+set grp.h i_grp
+eval $inhdr
+
+case "$i_grp" in
+$define)
+       xxx=`./findhdr grp.h`
+       $cppstdin $cppflags $cppminus < $xxx >$$.h
+
+       if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
+               val="$define"
        else
-               echo "Your vsprintf() returns (char*)." >&4
-               val2="$define"
-       fi
-else
-       echo 'vprintf() NOT found.' >&4
                val="$undef"
-               val2="$undef"
-fi
-$rm -f try try.*
-set d_vprintf
-eval $setvar
-val=$val2
-set d_charvspr
-eval $setvar
+       fi
+       set d_grpasswd
+       eval $setvar
 
-: see if chown exists
-set chown d_chown
-eval $inlibc
+       $rm -f $$.h
+       ;;
+*)
+       val="$undef";
+       set d_grpasswd; eval $setvar
+       ;;
+esac
 
-: see if chroot exists
-set chroot d_chroot
+: see if endgrent_r exists
+set endgrent_r d_endgrent_r
 eval $inlibc
+case "$d_endgrent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
+       case "$d_endgrent_r_proto:$usethreads" in
+       ":define")      d_endgrent_r_proto=define
+               set d_endgrent_r_proto endgrent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_endgrent_r_proto" in
+       define)
+       case "$endgrent_r_proto" in
+       ''|0) try='int endgrent_r(FILE**);'
+       ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
+       esac
+       case "$endgrent_r_proto" in
+       ''|0) try='void endgrent_r(FILE**);'
+       ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
+       esac
+       case "$endgrent_r_proto" in
+       ''|0)   d_endgrent_r=undef
+               endgrent_r_proto=0
+               echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
+       * )     case "$endgrent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "endgrent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_endgrent_r=undef
+               endgrent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     endgrent_r_proto=0
+       ;;
+esac
 
-: see if chsize exists
-set chsize d_chsize
+: see if endhostent exists
+set endhostent d_endhent
 eval $inlibc
 
-: see if class exists
-set class d_class
+: see if this is a netdb.h system
+set netdb.h i_netdb
+eval $inhdr
+
+: see if endhostent_r exists
+set endhostent_r d_endhostent_r
 eval $inlibc
+case "$d_endhostent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_endhostent_r_proto:$usethreads" in
+       ":define")      d_endhostent_r_proto=define
+               set d_endhostent_r_proto endhostent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_endhostent_r_proto" in
+       define)
+       case "$endhostent_r_proto" in
+       ''|0) try='int endhostent_r(struct hostent_data*);'
+       ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
+       esac
+       case "$endhostent_r_proto" in
+       ''|0) try='void endhostent_r(struct hostent_data*);'
+       ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
+       esac
+       case "$endhostent_r_proto" in
+       ''|0)   d_endhostent_r=undef
+               endhostent_r_proto=0
+               echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
+       * )     case "$endhostent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "endhostent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_endhostent_r=undef
+               endhostent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     endhostent_r_proto=0
+       ;;
+esac
 
-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 endnetent exists
+set endnetent d_endnent
+eval $inlibc
 
-: see if sys/types.h has to be included
-set sys/types.h i_systypes
-eval $inhdr
+: see if endnetent_r exists
+set endnetent_r d_endnetent_r
+eval $inlibc
+case "$d_endnetent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_endnetent_r_proto:$usethreads" in
+       ":define")      d_endnetent_r_proto=define
+               set d_endnetent_r_proto endnetent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_endnetent_r_proto" in
+       define)
+       case "$endnetent_r_proto" in
+       ''|0) try='int endnetent_r(struct netent_data*);'
+       ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
+       esac
+       case "$endnetent_r_proto" in
+       ''|0) try='void endnetent_r(struct netent_data*);'
+       ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
+       esac
+       case "$endnetent_r_proto" in
+       ''|0)   d_endnetent_r=undef
+               endnetent_r_proto=0
+               echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
+       * )     case "$endnetent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "endnetent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_endnetent_r=undef
+               endnetent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     endnetent_r_proto=0
+       ;;
+esac
 
-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'
+: see if endprotoent exists
+set endprotoent d_endpent
+eval $inlibc
 
-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 endprotoent_r exists
+set endprotoent_r d_endprotoent_r
+eval $inlibc
+case "$d_endprotoent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_endprotoent_r_proto:$usethreads" in
+       ":define")      d_endprotoent_r_proto=define
+               set d_endprotoent_r_proto endprotoent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_endprotoent_r_proto" in
+       define)
+       case "$endprotoent_r_proto" in
+       ''|0) try='int endprotoent_r(struct protoent_data*);'
+       ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
+       esac
+       case "$endprotoent_r_proto" in
+       ''|0) try='void endprotoent_r(struct protoent_data*);'
+       ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
+       esac
+       case "$endprotoent_r_proto" in
+       ''|0)   d_endprotoent_r=undef
+               endprotoent_r_proto=0
+               echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
+       * )     case "$endprotoent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_endprotoent_r=undef
+               endprotoent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     endprotoent_r_proto=0
+       ;;
+esac
 
-: see if socketpair exists
-set socketpair d_sockpair
+: see if endpwent exists
+set endpwent d_endpwent
 eval $inlibc
 
+: see if this is a pwd.h system
+set pwd.h i_pwd
+eval $inhdr
 
-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
+case "$i_pwd" in
+$define)
+       xxx=`./findhdr pwd.h`
+       $cppstdin $cppflags $cppminus < $xxx >$$.h
+
+       if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
                val="$define"
+       else
+               val="$undef"
        fi
-       set d_${enum}; eval $setvar
-       $rm -f try.c try
-done
+       set d_pwquota
+       eval $setvar
 
-: see if this is a sys/uio.h system
-set sys/uio.h i_sysuio
-eval $inhdr
+       if $contains 'pw_age' $$.h >/dev/null 2>&1; then
+               val="$define"
+       else
+               val="$undef"
+       fi
+       set d_pwage
+       eval $setvar
 
+       if $contains 'pw_change' $$.h >/dev/null 2>&1; then
+               val="$define"
+       else
+               val="$undef"
+       fi
+       set d_pwchange
+       eval $setvar
 
-echo " "
-echo "Checking to see if your system supports struct cmsghdr..." >&4
-set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
-eval $hasstruct
-case "$d_cmsghdr_s" in
-"$define")      echo "Yes, it does."   ;;
-*)              echo "No, it doesn't." ;;
-esac
+       if $contains 'pw_class' $$.h >/dev/null 2>&1; then
+               val="$define"
+       else
+               val="$undef"
+       fi
+       set d_pwclass
+       eval $setvar
 
+       if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
+               val="$define"
+       else
+               val="$undef"
+       fi
+       set d_pwexpire
+       eval $setvar
 
-: check for const keyword
-echo " "
-echo 'Checking to see if your C compiler knows about "const"...' >&4
-$cat >const.c <<'EOCP'
-typedef struct spug { int drokk; } spug;
-int main()
-{
-       const char *foo;
-       const spug y;
-}
-EOCP
-if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
-       val="$define"
-       echo "Yup, it does."
-else
-       val="$undef"
-       echo "Nope, it doesn't."
-fi
-set d_const
-eval $setvar
+       if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
+               val="$define"
+       else
+               val="$undef"
+       fi
+       set d_pwcomment
+       eval $setvar
 
-: see if crypt exists
-echo " "
-set crypt d_crypt
-eval $inlibc
-case "$d_crypt" in
-$define) cryptlib='' ;;
-*)     if set crypt val -f d_crypt; eval $csym; $val; then
-               echo 'crypt() found.' >&4
+       if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
                val="$define"
-               cryptlib=''
        else
-               cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
-               if $test -z "$cryptlib"; then
-                       cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
-               else
-                       cryptlib=-lcrypt
-               fi
-               if $test -z "$cryptlib"; then
-                       cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
-               else
-                       cryptlib=-lcrypt
-               fi
-               if $test -z "$cryptlib"; then
-                       cryptlib=`./loc libcrypt$_a "" $libpth`
-               else
-                       cryptlib=-lcrypt
-               fi
-               if $test -z "$cryptlib"; then
-                       echo 'crypt() NOT found.' >&4
-                       val="$undef"
-               else
-                       val="$define"
-               fi
+               val="$undef"
        fi
-       set d_crypt
+       set d_pwgecos
+       eval $setvar
+
+       if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
+               val="$define"
+       else
+               val="$undef"
+       fi
+       set d_pwpasswd
        eval $setvar
+
+       $rm -f $$.h
+       ;;
+*)
+       val="$undef"; 
+       set d_pwquota; eval $setvar
+       set d_pwage; eval $setvar
+       set d_pwchange; eval $setvar
+       set d_pwclass; eval $setvar
+       set d_pwexpire; eval $setvar
+       set d_pwcomment; eval $setvar
+       set d_pwgecos; eval $setvar
+       set d_pwpasswd; eval $setvar
        ;;
 esac
 
-: get csh whereabouts
-case "$csh" in
-'csh') val="$undef" ;;
-*) val="$define" ;;
-esac
-set d_csh
-eval $setvar
-: Respect a hint or command line value for full_csh.
-case "$full_csh" in
-'') full_csh=$csh ;;
+: see if endpwent_r exists
+set endpwent_r d_endpwent_r
+eval $inlibc
+case "$d_endpwent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
+       case "$d_endpwent_r_proto:$usethreads" in
+       ":define")      d_endpwent_r_proto=define
+               set d_endpwent_r_proto endpwent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_endpwent_r_proto" in
+       define)
+       case "$endpwent_r_proto" in
+       ''|0) try='int endpwent_r(FILE**);'
+       ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
+       esac
+       case "$endpwent_r_proto" in
+       ''|0) try='void endpwent_r(FILE**);'
+       ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
+       esac
+       case "$endpwent_r_proto" in
+       ''|0)   d_endpwent_r=undef
+               endpwent_r_proto=0
+               echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
+       * )     case "$endpwent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "endpwent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_endpwent_r=undef
+               endpwent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     endpwent_r_proto=0
+       ;;
 esac
 
-: see if cuserid exists
-set cuserid d_cuserid
+: see if endservent exists
+set endservent d_endsent
 eval $inlibc
 
-: see if this is a limits.h system
-set limits.h i_limits
-eval $inhdr
-
-: see if this is a float.h system
-set float.h i_float
-eval $inhdr
-
-: See if number of significant digits in a double precision number is known
-echo " "
-$cat >dbl_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 DBL_DIG
-printf("Contains DBL_DIG");
-#endif
-EOM
-$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
-if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
-       echo "DBL_DIG found." >&4
-       val="$define"
-else
-       echo "DBL_DIG NOT found." >&4
-       val="$undef"
-fi
-$rm -f dbl_dig.?
-set d_dbl_dig
-eval $setvar
-
-hasproto='varname=$1; func=$2; shift; shift;
-while $test $# -ge 2; do
-       case "$1" in
-       $define) echo "#include <$2>";;
-       esac ;
-    shift 2;
-done > try.c;
-$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
-if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
-       echo "$func() prototype found.";
-       val="$define";
-else
-       echo "$func() prototype NOT found.";
-       val="$undef";
-fi;
-set $varname;
-eval $setvar;
-$rm -f try.c tryout.c'
-
-: see if dbm.h is available
-: see if dbmclose exists
-set dbmclose d_dbmclose
+: see if endservent_r exists
+set endservent_r d_endservent_r
 eval $inlibc
-
-case "$d_dbmclose" in
-$define)
-       set dbm.h i_dbm
-       eval $inhdr
-       case "$i_dbm" in
-       $define)
-               val="$undef"
-               set i_rpcsvcdbm
-               eval $setvar
-               ;;
-       *)      set rpcsvc/dbm.h i_rpcsvcdbm
-               eval $inhdr
+case "$d_endservent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_endservent_r_proto:$usethreads" in
+       ":define")      d_endservent_r_proto=define
+               set d_endservent_r_proto endservent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_endservent_r_proto" in
+       define)
+       case "$endservent_r_proto" in
+       ''|0) try='int endservent_r(struct servent_data*);'
+       ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
+       esac
+       case "$endservent_r_proto" in
+       ''|0) try='void endservent_r(struct servent_data*);'
+       ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
+       esac
+       case "$endservent_r_proto" in
+       ''|0)   d_endservent_r=undef
+               endservent_r_proto=0
+               echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
+       * )     case "$endservent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "endservent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_endservent_r=undef
+               endservent_r_proto=0
                ;;
        esac
        ;;
-*)     echo "We won't be including <dbm.h>"
-       val="$undef"
-       set i_dbm
-       eval $setvar
-       val="$undef"
-       set i_rpcsvcdbm
-       eval $setvar
+*)     endservent_r_proto=0
        ;;
 esac
 
-: see if prototype for dbminit is available
+: Locate the flags for 'open()'
 echo " "
-set d_dbminitproto dbminit $i_dbm dbm.h
-eval $hasproto
-
-: see if difftime exists
-set difftime d_difftime
-eval $inlibc
+$cat >try.c <<EOCP
+#include <sys/types.h>
+#ifdef I_FCNTL
+#include <fcntl.h>
+#endif
+#ifdef I_SYS_FILE
+#include <sys/file.h>
+#endif
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+int main() {
+       if(O_RDONLY);
+#ifdef O_TRUNC
+       exit(0);
+#else
+       exit(1);
+#endif
+}
+EOCP
+: check sys/file.h first to get FREAD on Sun
+if $test `./findhdr sys/file.h` && \
+               set try -DI_SYS_FILE && eval $compile; then
+       h_sysfile=true;
+       echo "<sys/file.h> defines the O_* constants..." >&4
+       if $run ./try; then
+               echo "and you have the 3 argument form of open()." >&4
+               val="$define"
+       else
+               echo "but not the 3 argument form of open().  Oh, well." >&4
+               val="$undef"
+       fi
+elif $test `./findhdr fcntl.h` && \
+               set try -DI_FCNTL && eval $compile; then
+       h_fcntl=true;
+       echo "<fcntl.h> defines the O_* constants..." >&4
+       if $run ./try; then
+               echo "and you have the 3 argument form of open()." >&4
+               val="$define"
+       else
+               echo "but not the 3 argument form of open().  Oh, well." >&4
+               val="$undef"
+       fi
+else
+       val="$undef"
+       echo "I can't find the O_* constant definitions!  You got problems." >&4
+fi
+set d_open3
+eval $setvar
+$rm -f try try.*
 
-: see if this is a dirent system
+: see which of string.h or strings.h is needed
 echo " "
-if xinc=`./findhdr dirent.h`; $test "$xinc"; then
+strings=`./findhdr string.h`
+if $test "$strings" && $test -r "$strings"; then
+       echo "Using <string.h> instead of <strings.h>." >&4
        val="$define"
-       echo "<dirent.h> found." >&4
 else
        val="$undef"
-       if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
-               echo "<sys/dir.h> found." >&4
-               echo " "
+       strings=`./findhdr strings.h`
+       if $test "$strings" && $test -r "$strings"; then
+               echo "Using <strings.h> instead of <string.h>." >&4
        else
-               xinc=`./findhdr sys/ndir.h`
+               echo "No string header found -- You'll surely have problems." >&4
        fi
-       echo "<dirent.h> NOT found." >&4
 fi
-set i_dirent
+set i_string
 eval $setvar
+case "$i_string" in
+"$undef") strings=`./findhdr strings.h`;;
+*)       strings=`./findhdr string.h`;;
+esac
 
-: Look for type of directory structure.
-echo " "
-$cppstdin $cppflags $cppminus < "$xinc" > try.c
+: see if this is a sys/file.h system
+val=''
+set sys/file.h val
+eval $inhdr
 
-case "$direntrytype" in
-''|' ')
-       case "$i_dirent" in
-       $define) guess1='struct dirent' ;;
-       *) guess1='struct direct'  ;;
-       esac
+: do we need to include sys/file.h ?
+case "$val" in
+"$define")
+       echo " "
+       if $h_sysfile; then
+               val="$define"
+               echo "We'll be including <sys/file.h>." >&4
+       else
+               val="$undef"
+               echo "We won't be including <sys/file.h>." >&4
+       fi
        ;;
-*)     guess1="$direntrytype"
+*)
+       h_sysfile=false
        ;;
 esac
-
-case "$guess1" in
-'struct dirent') guess2='struct direct' ;;
-*) guess2='struct dirent' ;;
-esac
-               
-if $contains "$guess1" try.c >/dev/null 2>&1; then
-       direntrytype="$guess1"
-       echo "Your directory entries are $direntrytype." >&4
-elif $contains "$guess2" try.c >/dev/null 2>&1; then
-       direntrytype="$guess2"
-       echo "Your directory entries seem to be $direntrytype." >&4
-else
-       echo "I don't recognize your system's directory entries." >&4
-       rp="What type is used for directory entries on this system?"
-       dflt="$guess1"
-       . ./myread
-       direntrytype="$ans"
-fi
-$rm -f try.c
-
-
-: see if the directory entry stores field length
-echo " "
-$cppstdin $cppflags $cppminus < "$xinc" > try.c
-if $contains 'd_namlen' try.c >/dev/null 2>&1; then
-       echo "Good, your directory entry keeps length information in d_namlen." >&4
-       val="$define"
-else
-       echo "Your directory entry does not know about the d_namlen field." >&4
-       val="$undef"
-fi
-set d_dirnamlen
+set i_sysfile
 eval $setvar
-$rm -f try.c
 
-: see if this is an sysdir system
-set sys/dir.h i_sysdir
-eval $inhdr
-
-: see if this is an sysndir system
-set sys/ndir.h i_sysndir
+: see if fcntl.h is there
+val=''
+set fcntl.h val
 eval $inhdr
 
-: Look for dirfd
-echo " "
-$cat >dirfd.c <<EOM
-#include <stdio.h>
-#$i_dirent I_DIRENT            /**/
-#$i_sysdir I_SYS_DIR           /**/
-#$i_sysndir I_SYS_NDIR         /**/
-#$i_systypes I_SYS_TYPES       /**/
-#if defined(I_SYS_TYPES)
-#include <sys/types.h>
-#endif
-#if defined(I_DIRENT)
-#include <dirent.h>
-#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
-#include <sys/dir.h>
-#endif
-#else
-#ifdef I_SYS_NDIR
-#include <sys/ndir.h>
-#else
-#ifdef I_SYS_DIR
-#ifdef hp9000s500
-#include <ndir.h>      /* may be wrong in the future */
-#else
-#include <sys/dir.h>
-#endif
-#endif
-#endif
-#endif 
-int main() {
-       DIR *dirp = opendir(".");
-       if (dirfd(dirp) >= 0)
-               exit(0);
-       else
-               exit(1);
-}
-EOM
-set dirfd
-if eval $compile; then
-       val="$define"
-fi
+: see if we can include fcntl.h
 case "$val" in
-$define)       echo "dirfd() found." >&4       ;;
-*)             echo "dirfd() NOT found." >&4   ;;
+"$define")
+       echo " "
+       if $h_fcntl; then
+               val="$define"
+               echo "We'll be including <fcntl.h>." >&4
+       else
+               val="$undef"
+               if $h_sysfile; then
+       echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
+               else
+                       echo "We won't be including <fcntl.h>." >&4
+               fi
+       fi
+       ;;
+*)
+       h_fcntl=false
+       val="$undef"
+       ;;
 esac
-set d_dirfd
+set i_fcntl
 eval $setvar
-$rm -f dirfd*
-
-: see if dlerror exists
-xxx_runnm="$runnm"
-runnm=false
-set dlerror d_dlerror
-eval $inlibc
-runnm="$xxx_runnm"
-
-: see if dlfcn is available
-set dlfcn.h i_dlfcn
-eval $inhdr
-
-case "$usedl" in
-$define|y|true)
-       $cat << EOM
-
-On a few systems, the dynamically loaded modules that perl generates and uses
-will need a different extension than shared libs. The default will probably
-be appropriate.
 
-EOM
-       case "$dlext" in
-       '')     dflt="$so" ;;
-       *)      dflt="$dlext" ;;
-       esac
-       rp='What is the extension of dynamically loaded modules'
-       . ./myread
-       dlext="$ans"
-       ;;
+: check for non-blocking I/O stuff
+case "$h_sysfile" in
+true) echo "#include <sys/file.h>" > head.c;;
 *)
-       dlext="none"
+       case "$h_fcntl" in
+       true) echo "#include <fcntl.h>" > head.c;;
+       *) echo "#include <sys/fcntl.h>" > head.c;;
+       esac
+       ;;
+esac
+echo " "
+echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
+case "$o_nonblock" in
+'')
+       $cat head.c > try.c
+       $cat >>try.c <<EOCP
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#$i_fcntl I_FCNTL
+#ifdef I_FCNTL
+#include <fcntl.h>
+#endif
+int main() {
+#ifdef O_NONBLOCK
+       printf("O_NONBLOCK\n");
+       exit(0);
+#endif
+#ifdef O_NDELAY
+       printf("O_NDELAY\n");
+       exit(0);
+#endif
+#ifdef FNDELAY
+       printf("FNDELAY\n");
+       exit(0);
+#endif
+       exit(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               o_nonblock=`$run ./try`
+               case "$o_nonblock" in
+               '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
+               *) echo "Seems like we can use $o_nonblock.";;
+               esac
+       else
+               echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
+       fi
        ;;
+*) echo "Using $hint value $o_nonblock.";;
 esac
+$rm -f try try.* .out core
 
-: Check if dlsym need a leading underscore
 echo " "
-val="$undef"
-
-case "$dlsrc" in
-dl_dlopen.xs)
-       echo "Checking whether your dlsym() needs a leading underscore ..." >&4
-       $cat >dyna.c <<'EOM'
-fred () { }
-EOM
-
-$cat >fred.c<<EOM
-
-#include <stdio.h>
-#$i_dlfcn I_DLFCN
-#ifdef I_DLFCN
-#include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
-#else
+echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
+case "$eagain" in
+'')
+       $cat head.c > try.c
+       $cat >>try.c <<EOCP
+#include <errno.h>
 #include <sys/types.h>
-#include <nlist.h>
-#include <link.h>
+#include <signal.h>
+#include <stdio.h> 
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
 #endif
-
-extern int fred() ;
-
+#$i_fcntl I_FCNTL
+#ifdef I_FCNTL
+#include <fcntl.h>
+#endif
+#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
+#$i_string I_STRING
+#ifdef I_STRING
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+$signal_t blech(x) int x; { exit(3); }
+EOCP
+       $cat >> try.c <<'EOCP'
 int main()
 {
-    void * handle ;
-    void * symbol ;
-#ifndef RTLD_LAZY
-    int mode = 1 ;
+       int pd[2];
+       int pu[2];
+       char buf[1];
+       char string[100];
+
+       pipe(pd);       /* Down: child -> parent */
+       pipe(pu);       /* Up: parent -> child */
+       if (0 != fork()) {
+               int ret;
+               close(pd[1]);   /* Parent reads from pd[0] */
+               close(pu[0]);   /* Parent writes (blocking) to pu[1] */
+#ifdef F_SETFL
+               if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
+                       exit(1);
 #else
-    int mode = RTLD_LAZY ;
+               exit(4);
 #endif
-    handle = dlopen("./dyna.$dlext", mode) ;
-    if (handle == NULL) {
-       printf ("1\n") ;
-       fflush (stdout) ;
-       exit(0);
-    }
-    symbol = dlsym(handle, "fred") ;
-    if (symbol == NULL) {
-       /* try putting a leading underscore */
-       symbol = dlsym(handle, "_fred") ;
-       if (symbol == NULL) {
-           printf ("2\n") ;
-           fflush (stdout) ;
-           exit(0);
+               signal(SIGALRM, blech);
+               alarm(5);
+               if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
+                       exit(2);
+               sprintf(string, "%d\n", ret);
+               write(2, string, strlen(string));
+               alarm(0);
+#ifdef EAGAIN
+               if (errno == EAGAIN) {
+                       printf("EAGAIN\n");
+                       goto ok;
+               }
+#endif
+#ifdef EWOULDBLOCK
+               if (errno == EWOULDBLOCK)
+                       printf("EWOULDBLOCK\n");
+#endif
+       ok:
+               write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
+               sleep(2);                               /* Give it time to close our pipe */
+               alarm(5);
+               ret = read(pd[0], buf, 1);      /* Should read EOF */
+               alarm(0);
+               sprintf(string, "%d\n", ret);
+               write(4, string, strlen(string));
+               exit(0);
        }
-       printf ("3\n") ;
-    }
-    else
-       printf ("4\n") ;
-    fflush (stdout) ;
-    exit(0);
+
+       close(pd[0]);                   /* We write to pd[1] */
+       close(pu[1]);                   /* We read from pu[0] */
+       read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
+       close(pd[1]);                   /* Pipe pd is now fully closed! */
+       exit(0);                                /* Bye bye, thank you for playing! */
 }
-EOM
-       : Call the object file tmp-dyna.o in case dlext=o.
-       if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
-               mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
-               $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
-               $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
-               xxx=`$run ./fred`
-               case $xxx in
-               1)      echo "Test program failed using dlopen." >&4
-                       echo "Perhaps you should not use dynamic loading." >&4;;
-               2)      echo "Test program failed using dlsym." >&4
-                       echo "Perhaps you should not use dynamic loading." >&4;;
-               3)      echo "dlsym needs a leading underscore" >&4
-                       val="$define" ;;
-               4)      echo "dlsym doesn't need a leading underscore." >&4;;
+EOCP
+       set try
+       if eval $compile_ok; then
+               echo "$startsh" >mtry
+               echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
+               chmod +x mtry
+               ./mtry >/dev/null 2>&1
+               case $? in
+               0) eagain=`$cat try.out`;;
+               1) echo "Could not perform non-blocking setting!";;
+               2) echo "I did a successful read() for something that was not there!";;
+               3) echo "Hmm... non-blocking I/O does not seem to be working!";;
+               4) echo "Could not find F_SETFL!";;
+               *) echo "Something terribly wrong happened during testing.";;
+               esac
+               rd_nodata=`$cat try.ret`
+               echo "A read() system call with no data present returns $rd_nodata."
+               case "$rd_nodata" in
+               0|-1) ;;
+               *)
+                       echo "(That's peculiar, fixing that to be -1.)"
+                       rd_nodata=-1
+                       ;;
+               esac
+               case "$eagain" in
+               '')
+                       echo "Forcing errno EAGAIN on read() with no data available."
+                       eagain=EAGAIN
+                       ;;
+               *)
+                       echo "Your read() sets errno to $eagain when no data is available."
+                       ;;
                esac
+               status=`$cat try.err`
+               case "$status" in
+               0) echo "And it correctly returns 0 to signal EOF.";;
+               -1) echo "But it also returns -1 to signal EOF, so be careful!";;
+               *) echo "However, your read() returns '$status' on EOF??";;
+               esac
+               val="$define"
+               if test "$status" = "$rd_nodata"; then
+                       echo "WARNING: you can't distinguish between EOF and no data!"
+                       val="$undef"
+               fi
        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
+               echo "I can't compile the test program--assuming errno EAGAIN will do."
+               eagain=EAGAIN
        fi
+       set d_eofnblk
+       eval $setvar
        ;;
-esac
-               
-$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
-
-set d_dlsymun
-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 prototype for drand48 is available
+: see if _ptr and _cnt from stdio act std
 echo " "
-set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
-eval $hasproto
-
-: see if dup2 exists
-set dup2 d_dup2
-eval $inlibc
-
-: see if eaccess exists
-set eaccess d_eaccess
-eval $inlibc
-
-: see if endgrent exists
-set endgrent d_endgrent
-eval $inlibc
-
-: see if endhostent exists
-set endhostent d_endhent
-eval $inlibc
-
-: see if endnetent exists
-set endnetent d_endnent
-eval $inlibc
-
-: see if endprotoent exists
-set endprotoent d_endpent
-eval $inlibc
-
-: see if endpwent exists
-set endpwent d_endpwent
-eval $inlibc
 
-: see if endservent exists
-set endservent d_endsent
-eval $inlibc
+if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
+       echo "(Looks like you have stdio.h from BSD.)"
+       case "$stdio_ptr" in
+       '') stdio_ptr='((fp)->_p)'
+               ptr_lval=$define
+               ;;
+       *)      ptr_lval=$d_stdio_ptr_lval;;
+       esac
+       case "$stdio_cnt" in
+       '') stdio_cnt='((fp)->_r)'
+               cnt_lval=$define
+               ;;
+       *)      cnt_lval=$d_stdio_cnt_lval;;
+       esac
+       case "$stdio_base" in
+       '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
+       esac
+       case "$stdio_bufsiz" in
+       '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
+       esac
+elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
+       echo "(Looks like you have stdio.h from Linux.)"
+       case "$stdio_ptr" in
+       '') stdio_ptr='((fp)->_IO_read_ptr)'
+               ptr_lval=$define
+               ;;
+       *)      ptr_lval=$d_stdio_ptr_lval;;
+       esac
+       case "$stdio_cnt" in
+       '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
+               cnt_lval=$undef
+               ;;
+       *)      cnt_lval=$d_stdio_cnt_lval;;
+       esac
+       case "$stdio_base" in
+       '') stdio_base='((fp)->_IO_read_base)';;
+       esac
+       case "$stdio_bufsiz" in
+       '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
+       esac
+else
+       case "$stdio_ptr" in
+       '') stdio_ptr='((fp)->_ptr)'
+               ptr_lval=$define
+               ;;
+       *)      ptr_lval=$d_stdio_ptr_lval;;
+       esac
+       case "$stdio_cnt" in
+       '') stdio_cnt='((fp)->_cnt)'
+               cnt_lval=$define
+               ;;
+       *)      cnt_lval=$d_stdio_cnt_lval;;
+       esac
+       case "$stdio_base" in
+       '') stdio_base='((fp)->_base)';;
+       esac
+       case "$stdio_bufsiz" in
+       '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
+       esac
+fi
 
-: Locate the flags for 'open()'
-echo " "
-$cat >try.c <<'EOCP'
-#include <sys/types.h>
-#ifdef I_FCNTL
-#include <fcntl.h>
-#endif
-#ifdef I_SYS_FILE
-#include <sys/file.h>
+: test whether _ptr and _cnt really work
+echo "Checking how std your stdio is..." >&4
+$cat >try.c <<EOP
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
 #endif
+#define FILE_ptr(fp)   $stdio_ptr
+#define FILE_cnt(fp)   $stdio_cnt
 int main() {
-       if(O_RDONLY);
-#ifdef O_TRUNC
-       exit(0);
-#else
+       FILE *fp = fopen("try.c", "r");
+       char c = getc(fp);
+       if (
+               18 <= FILE_cnt(fp) &&
+               strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
+       )
+               exit(0);
        exit(1);
-#endif
 }
-EOCP
-: check sys/file.h first to get FREAD on Sun
-if $test `./findhdr sys/file.h` && \
-               set try -DI_SYS_FILE && eval $compile; then
-       h_sysfile=true;
-       echo "<sys/file.h> defines the O_* constants..." >&4
-       if $run ./try; then
-               echo "and you have the 3 argument form of open()." >&4
-               val="$define"
-       else
-               echo "but not the 3 argument form of open().  Oh, well." >&4
-               val="$undef"
-       fi
-elif $test `./findhdr fcntl.h` && \
-               set try -DI_FCNTL && eval $compile; then
-       h_fcntl=true;
-       echo "<fcntl.h> defines the O_* constants..." >&4
+EOP
+val="$undef"
+set try
+if eval $compile && $to try.c; then
        if $run ./try; then
-               echo "and you have the 3 argument form of open()." >&4
+               echo "Your stdio acts pretty std."
                val="$define"
        else
-               echo "but not the 3 argument form of open().  Oh, well." >&4
-               val="$undef"
+               echo "Your stdio isn't very std."
        fi
 else
-       val="$undef"
-       echo "I can't find the O_* constant definitions!  You got problems." >&4
-fi
-set d_open3
-eval $setvar
-$rm -f try try.*
-
-: 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
+       echo "Your stdio doesn't appear very std."
 fi
-set i_string
-eval $setvar
-case "$i_string" in
-"$undef") strings=`./findhdr strings.h`;;
-*)       strings=`./findhdr string.h`;;
-esac
-
-: see if this is a sys/file.h system
-val=''
-set sys/file.h val
-eval $inhdr
+$rm -f try.c try
 
-: do we need to include sys/file.h ?
-case "$val" in
-"$define")
-       echo " "
-       if $h_sysfile; then
-               val="$define"
-               echo "We'll be including <sys/file.h>." >&4
-       else
+# glibc 2.2.90 and above apparently change stdio streams so Perl's
+# direct buffer manipulation no longer works.  The Configure tests
+# should be changed to correctly detect this, but until then,
+# the following check should at least let perl compile and run.
+# (This quick fix should be updated before 5.8.1.)
+# To be defensive, reject all unknown versions, and all versions  > 2.2.9.
+# A. Dougherty, June 3, 2002.
+case "$d_gnulibc" in
+$define)
+       case "$gnulibc_version" in
+       2.[01]*)  ;;
+       2.2) ;;
+       2.2.[0-9]) ;;
+       *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
                val="$undef"
-               echo "We won't be including <sys/file.h>." >&4
-       fi
-       ;;
-*)
-       h_sysfile=false
+               ;;
+       esac
        ;;
 esac
-set i_sysfile
+set d_stdstdio
 eval $setvar
 
-: see if fcntl.h is there
-val=''
-set fcntl.h val
-eval $inhdr
-
-: see if we can include fcntl.h
-case "$val" in
-"$define")
-       echo " "
-       if $h_fcntl; then
-               val="$define"
-               echo "We'll be including <fcntl.h>." >&4
-       else
-               val="$undef"
-               if $h_sysfile; then
-       echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
-               else
-                       echo "We won't be including <fcntl.h>." >&4
-               fi
-       fi
-       ;;
-*)
-       h_fcntl=false
-       val="$undef"
-       ;;
+: Can _ptr be used as an lvalue?
+case "$d_stdstdio$ptr_lval" in
+$define$define) val=$define ;;
+*) val=$undef ;;
 esac
-set i_fcntl
+set d_stdio_ptr_lval
 eval $setvar
 
-: check for non-blocking I/O stuff
-case "$h_sysfile" in
-true) echo "#include <sys/file.h>" > head.c;;
-*)
-       case "$h_fcntl" in
-       true) echo "#include <fcntl.h>" > head.c;;
-       *) echo "#include <sys/fcntl.h>" > head.c;;
-       esac
-       ;;
-esac
-echo " "
-echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
-case "$o_nonblock" in
-'')
-       $cat head.c > try.c
-       $cat >>try.c <<EOCP
+: Can _cnt be used as an lvalue?
+case "$d_stdstdio$cnt_lval" in
+$define$define) val=$define ;;
+*) val=$undef ;;
+esac
+set d_stdio_cnt_lval
+eval $setvar
+
+
+: test whether setting _ptr sets _cnt as a side effect
+d_stdio_ptr_lval_sets_cnt="$undef"
+d_stdio_ptr_lval_nochange_cnt="$undef"
+case "$d_stdio_ptr_lval$d_stdstdio" in
+$define$define)
+       echo "Checking to see what happens if we set the stdio ptr..." >&4
+$cat >try.c <<EOP
 #include <stdio.h>
+/* Can we scream? */
+/* Eat dust sed :-) */
+/* In the buffer space, no one can hear you scream. */
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
 #include <stdlib.h>
-#$i_fcntl I_FCNTL
-#ifdef I_FCNTL
-#include <fcntl.h>
 #endif
+#define FILE_ptr(fp)   $stdio_ptr
+#define FILE_cnt(fp)   $stdio_cnt
+#include <sys/types.h>
 int main() {
-#ifdef O_NONBLOCK
-       printf("O_NONBLOCK\n");
-       exit(0);
-#endif
-#ifdef O_NDELAY
-       printf("O_NDELAY\n");
-       exit(0);
-#endif
-#ifdef FNDELAY
-       printf("FNDELAY\n");
-       exit(0);
-#endif
-       exit(0);
+       FILE *fp = fopen("try.c", "r");
+       int c;
+       char *ptr;
+       size_t cnt;
+       if (!fp) {
+           puts("Fail even to read");
+           exit(1);
+       }
+       c = getc(fp); /* Read away the first # */
+       if (c == EOF) {
+           puts("Fail even to read");
+           exit(1);
+       }
+       if (!(
+               18 <= FILE_cnt(fp) &&
+               strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
+       )) {
+               puts("Fail even to read");
+               exit (1);
+       }
+       ptr = (char*) FILE_ptr(fp);
+       cnt = (size_t)FILE_cnt(fp);
+
+       FILE_ptr(fp) += 42;
+
+       if ((char*)FILE_ptr(fp) != (ptr + 42)) {
+               printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
+               exit (1);
+       }
+       if (FILE_cnt(fp) <= 20) {
+               printf ("Fail (<20 chars to test)");
+               exit (1);
+       }
+       if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
+               puts("Fail compare");
+               exit (1);
+       }
+       if (cnt == FILE_cnt(fp)) {
+               puts("Pass_unchanged");
+               exit (0);
+       }       
+       if (FILE_cnt(fp) == (cnt - 42)) {
+               puts("Pass_changed");
+               exit (0);
+       }
+       printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
+       return 1;
+
 }
-EOCP
+EOP
        set try
-       if eval $compile_ok; then
-               o_nonblock=`$run ./try`
-               case "$o_nonblock" in
-               '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
-               *) echo "Seems like we can use $o_nonblock.";;
-               esac
+       if eval $compile && $to try.c; then
+               case `$run ./try` in
+               Pass_changed)
+                       echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
+                       d_stdio_ptr_lval_sets_cnt="$define" ;;
+               Pass_unchanged)
+                       echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
+                       d_stdio_ptr_lval_nochange_cnt="$define" ;;
+               Fail*)
+                       echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
+               *)
+                       echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
+       esac
        else
-               echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
+               echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
        fi
+       $rm -f try.c try
        ;;
-*) echo "Using $hint value $o_nonblock.";;
 esac
-$rm -f try try.* .out core
-
-echo " "
-echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
-case "$eagain" in
-'')
-       $cat head.c > try.c
-       $cat >>try.c <<EOCP
-#include <errno.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <stdio.h> 
-#include <stdlib.h> 
-#$i_fcntl I_FCNTL
-#ifdef I_FCNTL
-#include <fcntl.h>
-#endif
-#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
-#$i_string I_STRING
-#ifdef I_STRING
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-$signal_t blech(x) int x; { exit(3); }
-EOCP
-       $cat >> try.c <<'EOCP'
-int main()
-{
-       int pd[2];
-       int pu[2];
-       char buf[1];
-       char string[100];
 
-       pipe(pd);       /* Down: child -> parent */
-       pipe(pu);       /* Up: parent -> child */
-       if (0 != fork()) {
-               int ret;
-               close(pd[1]);   /* Parent reads from pd[0] */
-               close(pu[0]);   /* Parent writes (blocking) to pu[1] */
-#ifdef F_SETFL
-               if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
-                       exit(1);
-#else
-               exit(4);
-#endif
-               signal(SIGALRM, blech);
-               alarm(5);
-               if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
-                       exit(2);
-               sprintf(string, "%d\n", ret);
-               write(2, string, strlen(string));
-               alarm(0);
-#ifdef EAGAIN
-               if (errno == EAGAIN) {
-                       printf("EAGAIN\n");
-                       goto ok;
-               }
-#endif
-#ifdef EWOULDBLOCK
-               if (errno == EWOULDBLOCK)
-                       printf("EWOULDBLOCK\n");
+: see if _base is also standard
+val="$undef"
+case "$d_stdstdio" in
+$define)
+       $cat >try.c <<EOP
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
 #endif
-       ok:
-               write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
-               sleep(2);                               /* Give it time to close our pipe */
-               alarm(5);
-               ret = read(pd[0], buf, 1);      /* Should read EOF */
-               alarm(0);
-               sprintf(string, "%d\n", ret);
-               write(4, string, strlen(string));
+#define FILE_base(fp)  $stdio_base
+#define FILE_bufsiz(fp)        $stdio_bufsiz
+int main() {
+       FILE *fp = fopen("try.c", "r");
+       char c = getc(fp);
+       if (
+               19 <= FILE_bufsiz(fp) &&
+               strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
+       )
                exit(0);
-       }
-
-       close(pd[0]);                   /* We write to pd[1] */
-       close(pu[1]);                   /* We read from pu[0] */
-       read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
-       close(pd[1]);                   /* Pipe pd is now fully closed! */
-       exit(0);                                /* Bye bye, thank you for playing! */
+       exit(1);
 }
-EOCP
-       set try
-       if eval $compile_ok; then
-               echo "$startsh" >mtry
-               echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
-               chmod +x mtry
-               ./mtry >/dev/null 2>&1
-               case $? in
-               0) eagain=`$cat try.out`;;
-               1) echo "Could not perform non-blocking setting!";;
-               2) echo "I did a successful read() for something that was not there!";;
-               3) echo "Hmm... non-blocking I/O does not seem to be working!";;
-               4) echo "Could not find F_SETFL!";;
-               *) echo "Something terribly wrong happened during testing.";;
-               esac
-               rd_nodata=`$cat try.ret`
-               echo "A read() system call with no data present returns $rd_nodata."
-               case "$rd_nodata" in
-               0|-1) ;;
-               *)
-                       echo "(That's peculiar, fixing that to be -1.)"
-                       rd_nodata=-1
-                       ;;
-               esac
-               case "$eagain" in
-               '')
-                       echo "Forcing errno EAGAIN on read() with no data available."
-                       eagain=EAGAIN
-                       ;;
-               *)
-                       echo "Your read() sets errno to $eagain when no data is available."
-                       ;;
-               esac
-               status=`$cat try.err`
-               case "$status" in
-               0) echo "And it correctly returns 0 to signal EOF.";;
-               -1) echo "But it also returns -1 to signal EOF, so be careful!";;
-               *) echo "However, your read() returns '$status' on EOF??";;
-               esac
-               val="$define"
-               if test "$status" = "$rd_nodata"; then
-                       echo "WARNING: you can't distinguish between EOF and no data!"
-                       val="$undef"
+EOP
+       set try
+       if eval $compile && $to try.c; then
+               if $run ./try; then
+                       echo "And its _base field acts std."
+                       val="$define"
+               else
+                       echo "But its _base field isn't std."
                fi
        else
-               echo "I can't compile the test program--assuming errno EAGAIN will do."
-               eagain=EAGAIN
+               echo "However, it seems to be lacking the _base field."
        fi
-       set d_eofnblk
-       eval $setvar
+       $rm -f try.c try
        ;;
-*)
-       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
+set d_stdiobase
+eval $setvar
+
+: see if fast_stdio exists
+val="$undef"
+case "$d_stdstdio:$d_stdio_ptr_lval" in
+"$define:$define")
+       case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
+       *$define*)
+               echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
+               val="$define"
                ;;
        esac
        ;;
 esac
-$rm -f try try.* .out core head.c mtry
+set d_faststdio
+eval $setvar
+
+
 
 : see if fchdir exists
 set fchdir d_fchdir
@@ -10227,7 +12013,10 @@ eval $inlibc
 echo " "
 : See if fcntl-based locking works.
 $cat >try.c <<EOCP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
 #include <stdlib.h>
+#endif
 #include <unistd.h>
 #include <fcntl.h>
 #include <signal.h>
@@ -10288,100 +12077,16 @@ eval $setvar
 $rm -f try*
 
 
-: see if sys/select.h has to be included
-set sys/select.h i_sysselct
-eval $inhdr
-
-: see if we should include time.h, sys/time.h, or both
-echo " "
-if test "X$timeincl" = X; then
-       echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
-       $echo $n "I'm now running the test program...$c"
-       $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#ifdef I_TIME
-#include <time.h>
-#endif
-#ifdef I_SYSTIME
-#ifdef SYSTIMEKERNEL
-#define KERNEL
-#endif
-#include <sys/time.h>
-#endif
-#ifdef I_SYSSELECT
-#include <sys/select.h>
-#endif
-int main()
-{
-       struct tm foo;
-#ifdef S_TIMEVAL
-       struct timeval bar;
-#endif
-#ifdef S_TIMEZONE
-       struct timezone tzp;
-#endif
-       if (foo.tm_sec == foo.tm_sec)
-               exit(0);
-#ifdef S_TIMEVAL
-       if (bar.tv_sec == bar.tv_sec)
-               exit(0);
-#endif
-       exit(1);
-}
-EOCP
-       flags=''
-       for s_timezone in '-DS_TIMEZONE' ''; do
-       sysselect=''
-       for s_timeval in '-DS_TIMEVAL' ''; do
-       for i_systimek in '' '-DSYSTIMEKERNEL'; do
-       for i_time in '' '-DI_TIME'; do
-       for i_systime in '-DI_SYSTIME' ''; do
-               case "$flags" in
-               '') $echo $n ".$c"
-                       set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
-                       if eval $compile; then
-                               set X $i_time $i_systime $i_systimek $sysselect $s_timeval
-                               shift
-                               flags="$*"
-                               echo " "
-                               $echo $n "Succeeded with $flags$c"
-                       fi
-                       ;;
-               esac
-       done
-       done
-       done
-       done
-       done
-       timeincl=''
-       echo " "
-       case "$flags" in
-       *SYSTIMEKERNEL*) i_systimek="$define"
-               timeincl=`./findhdr sys/time.h`
-               echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
-       *) i_systimek="$undef";;
-       esac
-       case "$flags" in
-       *I_TIME*) i_time="$define"
-               timeincl=`./findhdr time.h`" $timeincl"
-               echo "We'll include <time.h>." >&4;;
-       *) i_time="$undef";;
-       esac
-       case "$flags" in
-       *I_SYSTIME*) i_systime="$define"
-               timeincl=`./findhdr sys/time.h`" $timeincl"
-               echo "We'll include <sys/time.h>." >&4;;
-       *) i_systime="$undef";;
-       esac
-       $rm -f try.c try
-fi
-
 : check for fd_set items
 $cat <<EOM
 
 Checking to see how well your C compiler handles fd_set and friends ...
 EOM
 $cat >try.c <<EOCP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 #$i_systime I_SYS_TIME
 #$i_sysselct I_SYS_SELECT
 #$d_socket HAS_SOCKET
@@ -10598,6 +12303,177 @@ eval $inlibc
 set getgrent d_getgrent
 eval $inlibc
 
+: see if getgrent_r exists
+set getgrent_r d_getgrent_r
+eval $inlibc
+case "$d_getgrent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
+       case "$d_getgrent_r_proto:$usethreads" in
+       ":define")      d_getgrent_r_proto=define
+               set d_getgrent_r_proto getgrent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getgrent_r_proto" in
+       define)
+       case "$getgrent_r_proto" in
+       ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
+       ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
+       esac
+       case "$getgrent_r_proto" in
+       ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
+       ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
+       esac
+       case "$getgrent_r_proto" in
+       ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
+       ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
+       esac
+       case "$getgrent_r_proto" in
+       ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
+       ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
+       esac
+       case "$getgrent_r_proto" in
+       ''|0) try='int getgrent_r(struct group*, char*, int);'
+       ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
+       esac
+       case "$getgrent_r_proto" in
+       ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
+       ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
+       esac
+       case "$getgrent_r_proto" in
+       ''|0)   d_getgrent_r=undef
+               getgrent_r_proto=0
+               echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
+       * )     case "$getgrent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getgrent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getgrent_r=undef
+               getgrent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getgrent_r_proto=0
+       ;;
+esac
+
+: see if getgrgid_r exists
+set getgrgid_r d_getgrgid_r
+eval $inlibc
+case "$d_getgrgid_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
+       case "$d_getgrgid_r_proto:$usethreads" in
+       ":define")      d_getgrgid_r_proto=define
+               set d_getgrgid_r_proto getgrgid_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getgrgid_r_proto" in
+       define)
+       case "$getgrgid_r_proto" in
+       ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
+       ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
+       esac
+       case "$getgrgid_r_proto" in
+       ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
+       ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
+       esac
+       case "$getgrgid_r_proto" in
+       ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
+       ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
+       esac
+       case "$getgrgid_r_proto" in
+       ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
+       ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
+       esac
+       case "$getgrgid_r_proto" in
+       ''|0)   d_getgrgid_r=undef
+               getgrgid_r_proto=0
+               echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
+       * )     case "$getgrgid_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getgrgid_r=undef
+               getgrgid_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getgrgid_r_proto=0
+       ;;
+esac
+
+: see if getgrnam_r exists
+set getgrnam_r d_getgrnam_r
+eval $inlibc
+case "$d_getgrnam_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
+       case "$d_getgrnam_r_proto:$usethreads" in
+       ":define")      d_getgrnam_r_proto=define
+               set d_getgrnam_r_proto getgrnam_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getgrnam_r_proto" in
+       define)
+       case "$getgrnam_r_proto" in
+       ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
+       ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
+       esac
+       case "$getgrnam_r_proto" in
+       ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
+       ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
+       esac
+       case "$getgrnam_r_proto" in
+       ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
+       ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
+       esac
+       case "$getgrnam_r_proto" in
+       ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
+       ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
+       esac
+       case "$getgrnam_r_proto" in
+       ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
+       ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
+       esac
+       case "$getgrnam_r_proto" in
+       ''|0)   d_getgrnam_r=undef
+               getgrnam_r_proto=0
+               echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
+       * )     case "$getgrnam_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getgrnam_r=undef
+               getgrnam_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getgrnam_r_proto=0
+       ;;
+esac
+
 : see if gethostbyaddr exists
 set gethostbyaddr d_gethbyaddr
 eval $inlibc
@@ -10695,9 +12571,196 @@ case "$d_phostname" in
 '') d_phostname="$undef";;
 esac
 
-: see if this is a netdb.h system
-set netdb.h i_netdb
-eval $inhdr
+: see if gethostbyaddr_r exists
+set gethostbyaddr_r d_gethostbyaddr_r
+eval $inlibc
+case "$d_gethostbyaddr_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_gethostbyaddr_r_proto:$usethreads" in
+       ":define")      d_gethostbyaddr_r_proto=define
+               set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_gethostbyaddr_r_proto" in
+       define)
+       case "$gethostbyaddr_r_proto" in
+       ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
+       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
+       esac
+       case "$gethostbyaddr_r_proto" in
+       ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
+       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
+       esac
+       case "$gethostbyaddr_r_proto" in
+       ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
+       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
+       esac
+       case "$gethostbyaddr_r_proto" in
+       ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
+       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
+       esac
+       case "$gethostbyaddr_r_proto" in
+       ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
+       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
+       esac
+       case "$gethostbyaddr_r_proto" in
+       ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
+       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
+       esac
+       case "$gethostbyaddr_r_proto" in
+       ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
+       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
+       esac
+       case "$gethostbyaddr_r_proto" in
+       ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
+       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
+       esac
+       case "$gethostbyaddr_r_proto" in
+       ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
+       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
+       esac
+       case "$gethostbyaddr_r_proto" in
+       ''|0) try='int gethostbyaddr_r(const char*, int, int);'
+       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
+       esac
+       case "$gethostbyaddr_r_proto" in
+       ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
+       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
+       esac
+       case "$gethostbyaddr_r_proto" in
+       ''|0)   d_gethostbyaddr_r=undef
+               gethostbyaddr_r_proto=0
+               echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
+       * )     case "$gethostbyaddr_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
+               esac
+               d_gethostbyaddr_r=undef
+               gethostbyaddr_r_proto=0
+               ;;
+       esac
+       ;;
+*)     gethostbyaddr_r_proto=0
+       ;;
+esac
+
+: see if gethostbyname_r exists
+set gethostbyname_r d_gethostbyname_r
+eval $inlibc
+case "$d_gethostbyname_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_gethostbyname_r_proto:$usethreads" in
+       ":define")      d_gethostbyname_r_proto=define
+               set d_gethostbyname_r_proto gethostbyname_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_gethostbyname_r_proto" in
+       define)
+       case "$gethostbyname_r_proto" in
+       ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
+       ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
+       esac
+       case "$gethostbyname_r_proto" in
+       ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
+       ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
+       esac
+       case "$gethostbyname_r_proto" in
+       ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
+       ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
+       esac
+       case "$gethostbyname_r_proto" in
+       ''|0)   d_gethostbyname_r=undef
+               gethostbyname_r_proto=0
+               echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
+       * )     case "$gethostbyname_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
+               esac
+               d_gethostbyname_r=undef
+               gethostbyname_r_proto=0
+               ;;
+       esac
+       ;;
+*)     gethostbyname_r_proto=0
+       ;;
+esac
+
+: see if gethostent_r exists
+set gethostent_r d_gethostent_r
+eval $inlibc
+case "$d_gethostent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_gethostent_r_proto:$usethreads" in
+       ":define")      d_gethostent_r_proto=define
+               set d_gethostent_r_proto gethostent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_gethostent_r_proto" in
+       define)
+       case "$gethostent_r_proto" in
+       ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
+       ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
+       esac
+       case "$gethostent_r_proto" in
+       ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
+       ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
+       esac
+       case "$gethostent_r_proto" in
+       ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
+       ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
+       esac
+       case "$gethostent_r_proto" in
+       ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
+       ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
+       esac
+       case "$gethostent_r_proto" in
+       ''|0) try='int gethostent_r(struct hostent*, char*, int);'
+       ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
+       esac
+       case "$gethostent_r_proto" in
+       ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
+       ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
+       esac
+       case "$gethostent_r_proto" in
+       ''|0)   d_gethostent_r=undef
+               gethostent_r_proto=0
+               echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
+       * )     case "$gethostent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "gethostent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_gethostent_r=undef
+               gethostent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     gethostent_r_proto=0
+       ;;
+esac
 
 : see if prototypes for various gethostxxx netdb.h functions are available
 echo " "
@@ -10712,6 +12775,59 @@ eval $inlibc
 set getlogin d_getlogin
 eval $inlibc
 
+: see if getlogin_r exists
+set getlogin_r d_getlogin_r
+eval $inlibc
+case "$d_getlogin_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
+       case "$d_getlogin_r_proto:$usethreads" in
+       ":define")      d_getlogin_r_proto=define
+               set d_getlogin_r_proto getlogin_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getlogin_r_proto" in
+       define)
+       case "$getlogin_r_proto" in
+       ''|0) try='int getlogin_r(char*, size_t);'
+       ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
+       esac
+       case "$getlogin_r_proto" in
+       ''|0) try='int getlogin_r(char*, int);'
+       ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
+       esac
+       case "$getlogin_r_proto" in
+       ''|0) try='char* getlogin_r(char*, size_t);'
+       ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
+       esac
+       case "$getlogin_r_proto" in
+       ''|0) try='char* getlogin_r(char*, int);'
+       ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
+       esac
+       case "$getlogin_r_proto" in
+       ''|0)   d_getlogin_r=undef
+               getlogin_r_proto=0
+               echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
+       * )     case "$getlogin_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getlogin_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getlogin_r=undef
+               getlogin_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getlogin_r_proto=0
+       ;;
+esac
+
 : see if getmnt exists
 set getmnt d_getmnt
 eval $inlibc
@@ -10732,6 +12848,189 @@ eval $inlibc
 set getnetent d_getnent
 eval $inlibc
 
+: see if getnetbyaddr_r exists
+set getnetbyaddr_r d_getnetbyaddr_r
+eval $inlibc
+case "$d_getnetbyaddr_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_getnetbyaddr_r_proto:$usethreads" in
+       ":define")      d_getnetbyaddr_r_proto=define
+               set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getnetbyaddr_r_proto" in
+       define)
+       case "$getnetbyaddr_r_proto" in
+       ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
+       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
+       esac
+       case "$getnetbyaddr_r_proto" in
+       ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
+       esac
+       case "$getnetbyaddr_r_proto" in
+       ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
+       esac
+       case "$getnetbyaddr_r_proto" in
+       ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
+       esac
+       case "$getnetbyaddr_r_proto" in
+       ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
+       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
+       esac
+       case "$getnetbyaddr_r_proto" in
+       ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
+       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
+       esac
+       case "$getnetbyaddr_r_proto" in
+       ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
+       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
+       esac
+       case "$getnetbyaddr_r_proto" in
+       ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
+       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
+       esac
+       case "$getnetbyaddr_r_proto" in
+       ''|0)   d_getnetbyaddr_r=undef
+               getnetbyaddr_r_proto=0
+               echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
+       * )     case "$getnetbyaddr_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getnetbyaddr_r=undef
+               getnetbyaddr_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getnetbyaddr_r_proto=0
+       ;;
+esac
+
+: see if getnetbyname_r exists
+set getnetbyname_r d_getnetbyname_r
+eval $inlibc
+case "$d_getnetbyname_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_getnetbyname_r_proto:$usethreads" in
+       ":define")      d_getnetbyname_r_proto=define
+               set d_getnetbyname_r_proto getnetbyname_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getnetbyname_r_proto" in
+       define)
+       case "$getnetbyname_r_proto" in
+       ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
+       ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
+       esac
+       case "$getnetbyname_r_proto" in
+       ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
+       esac
+       case "$getnetbyname_r_proto" in
+       ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
+       esac
+       case "$getnetbyname_r_proto" in
+       ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
+       ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
+       esac
+       case "$getnetbyname_r_proto" in
+       ''|0)   d_getnetbyname_r=undef
+               getnetbyname_r_proto=0
+               echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
+       * )     case "$getnetbyname_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getnetbyname_r=undef
+               getnetbyname_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getnetbyname_r_proto=0
+       ;;
+esac
+
+: see if getnetent_r exists
+set getnetent_r d_getnetent_r
+eval $inlibc
+case "$d_getnetent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_getnetent_r_proto:$usethreads" in
+       ":define")      d_getnetent_r_proto=define
+               set d_getnetent_r_proto getnetent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getnetent_r_proto" in
+       define)
+       case "$getnetent_r_proto" in
+       ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
+       ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
+       esac
+       case "$getnetent_r_proto" in
+       ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
+       ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
+       esac
+       case "$getnetent_r_proto" in
+       ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
+       ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
+       esac
+       case "$getnetent_r_proto" in
+       ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
+       esac
+       case "$getnetent_r_proto" in
+       ''|0) try='int getnetent_r(struct netent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
+       esac
+       case "$getnetent_r_proto" in
+       ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
+       ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
+       esac
+       case "$getnetent_r_proto" in
+       ''|0)   d_getnetent_r=undef
+               getnetent_r_proto=0
+               echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
+       * )     case "$getnetent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getnetent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getnetent_r=undef
+               getnetent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getnetent_r_proto=0
+       ;;
+esac
+
 : see if prototypes for various getnetxxx netdb.h functions are available
 echo " "
 set d_getnetprotos getnetent $i_netdb netdb.h
@@ -10770,6 +13069,157 @@ eval $inlibc
 set getpriority d_getprior
 eval $inlibc
 
+: see if getprotobyname_r exists
+set getprotobyname_r d_getprotobyname_r
+eval $inlibc
+case "$d_getprotobyname_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_getprotobyname_r_proto:$usethreads" in
+       ":define")      d_getprotobyname_r_proto=define
+               set d_getprotobyname_r_proto getprotobyname_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getprotobyname_r_proto" in
+       define)
+       case "$getprotobyname_r_proto" in
+       ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
+       ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
+       esac
+       case "$getprotobyname_r_proto" in
+       ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
+       esac
+       case "$getprotobyname_r_proto" in
+       ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
+       ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
+       esac
+       case "$getprotobyname_r_proto" in
+       ''|0)   d_getprotobyname_r=undef
+               getprotobyname_r_proto=0
+               echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
+       * )     case "$getprotobyname_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getprotobyname_r=undef
+               getprotobyname_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getprotobyname_r_proto=0
+       ;;
+esac
+
+: see if getprotobynumber_r exists
+set getprotobynumber_r d_getprotobynumber_r
+eval $inlibc
+case "$d_getprotobynumber_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_getprotobynumber_r_proto:$usethreads" in
+       ":define")      d_getprotobynumber_r_proto=define
+               set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getprotobynumber_r_proto" in
+       define)
+       case "$getprotobynumber_r_proto" in
+       ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
+       ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
+       esac
+       case "$getprotobynumber_r_proto" in
+       ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
+       esac
+       case "$getprotobynumber_r_proto" in
+       ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
+       ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
+       esac
+       case "$getprotobynumber_r_proto" in
+       ''|0)   d_getprotobynumber_r=undef
+               getprotobynumber_r_proto=0
+               echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
+       * )     case "$getprotobynumber_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getprotobynumber_r=undef
+               getprotobynumber_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getprotobynumber_r_proto=0
+       ;;
+esac
+
+: see if getprotoent_r exists
+set getprotoent_r d_getprotoent_r
+eval $inlibc
+case "$d_getprotoent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_getprotoent_r_proto:$usethreads" in
+       ":define")      d_getprotoent_r_proto=define
+               set d_getprotoent_r_proto getprotoent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getprotoent_r_proto" in
+       define)
+       case "$getprotoent_r_proto" in
+       ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
+       ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
+       esac
+       case "$getprotoent_r_proto" in
+       ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
+       esac
+       case "$getprotoent_r_proto" in
+       ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
+       esac
+       case "$getprotoent_r_proto" in
+       ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
+       ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
+       esac
+       case "$getprotoent_r_proto" in
+       ''|0)   d_getprotoent_r=undef
+               getprotoent_r_proto=0
+               echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
+       * )     case "$getprotoent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getprotoent_r=undef
+               getprotoent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getprotoent_r_proto=0
+       ;;
+esac
+
 : see if prototypes for various getprotoxxx netdb.h functions are available
 echo " "
 set d_getprotoprotos getprotoent $i_netdb netdb.h
@@ -10783,6 +13233,173 @@ eval $inlibc
 set getpwent d_getpwent
 eval $inlibc
 
+: see if getpwent_r exists
+set getpwent_r d_getpwent_r
+eval $inlibc
+case "$d_getpwent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
+       case "$d_getpwent_r_proto:$usethreads" in
+       ":define")      d_getpwent_r_proto=define
+               set d_getpwent_r_proto getpwent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getpwent_r_proto" in
+       define)
+       case "$getpwent_r_proto" in
+       ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
+       ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
+       esac
+       case "$getpwent_r_proto" in
+       ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
+       ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
+       esac
+       case "$getpwent_r_proto" in
+       ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
+       ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
+       esac
+       case "$getpwent_r_proto" in
+       ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
+       ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
+       esac
+       case "$getpwent_r_proto" in
+       ''|0) try='int getpwent_r(struct passwd*, char*, int);'
+       ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
+       esac
+       case "$getpwent_r_proto" in
+       ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
+       ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
+       esac
+       case "$getpwent_r_proto" in
+       ''|0)   d_getpwent_r=undef
+               getpwent_r_proto=0
+               echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
+       * )     case "$getpwent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getpwent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getpwent_r=undef
+               getpwent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getpwent_r_proto=0
+       ;;
+esac
+
+: see if getpwnam_r exists
+set getpwnam_r d_getpwnam_r
+eval $inlibc
+case "$d_getpwnam_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
+       case "$d_getpwnam_r_proto:$usethreads" in
+       ":define")      d_getpwnam_r_proto=define
+               set d_getpwnam_r_proto getpwnam_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getpwnam_r_proto" in
+       define)
+       case "$getpwnam_r_proto" in
+       ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
+       ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
+       esac
+       case "$getpwnam_r_proto" in
+       ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
+       ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
+       esac
+       case "$getpwnam_r_proto" in
+       ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
+       ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
+       esac
+       case "$getpwnam_r_proto" in
+       ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
+       ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
+       esac
+       case "$getpwnam_r_proto" in
+       ''|0)   d_getpwnam_r=undef
+               getpwnam_r_proto=0
+               echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
+       * )     case "$getpwnam_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getpwnam_r=undef
+               getpwnam_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getpwnam_r_proto=0
+       ;;
+esac
+
+: see if getpwuid_r exists
+set getpwuid_r d_getpwuid_r
+eval $inlibc
+case "$d_getpwuid_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
+       case "$d_getpwuid_r_proto:$usethreads" in
+       ":define")      d_getpwuid_r_proto=define
+               set d_getpwuid_r_proto getpwuid_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getpwuid_r_proto" in
+       define)
+       case "$getpwuid_r_proto" in
+       ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
+       ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
+       esac
+       case "$getpwuid_r_proto" in
+       ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
+       ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
+       esac
+       case "$getpwuid_r_proto" in
+       ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
+       ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
+       esac
+       case "$getpwuid_r_proto" in
+       ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
+       ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
+       esac
+       case "$getpwuid_r_proto" in
+       ''|0)   d_getpwuid_r=undef
+               getpwuid_r_proto=0
+               echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
+       * )     case "$getpwuid_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getpwuid_r=undef
+               getpwuid_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getpwuid_r_proto=0
+       ;;
+esac
+
 
 : see if getservbyname exists
 set getservbyname d_getsbyname
@@ -10796,6 +13413,157 @@ eval $inlibc
 set getservent d_getsent
 eval $inlibc
 
+: see if getservbyname_r exists
+set getservbyname_r d_getservbyname_r
+eval $inlibc
+case "$d_getservbyname_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_getservbyname_r_proto:$usethreads" in
+       ":define")      d_getservbyname_r_proto=define
+               set d_getservbyname_r_proto getservbyname_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getservbyname_r_proto" in
+       define)
+       case "$getservbyname_r_proto" in
+       ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
+       ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
+       esac
+       case "$getservbyname_r_proto" in
+       ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
+       esac
+       case "$getservbyname_r_proto" in
+       ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
+       ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
+       esac
+       case "$getservbyname_r_proto" in
+       ''|0)   d_getservbyname_r=undef
+               getservbyname_r_proto=0
+               echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
+       * )     case "$getservbyname_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getservbyname_r=undef
+               getservbyname_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getservbyname_r_proto=0
+       ;;
+esac
+
+: see if getservbyport_r exists
+set getservbyport_r d_getservbyport_r
+eval $inlibc
+case "$d_getservbyport_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_getservbyport_r_proto:$usethreads" in
+       ":define")      d_getservbyport_r_proto=define
+               set d_getservbyport_r_proto getservbyport_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getservbyport_r_proto" in
+       define)
+       case "$getservbyport_r_proto" in
+       ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
+       ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
+       esac
+       case "$getservbyport_r_proto" in
+       ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
+       esac
+       case "$getservbyport_r_proto" in
+       ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
+       ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
+       esac
+       case "$getservbyport_r_proto" in
+       ''|0)   d_getservbyport_r=undef
+               getservbyport_r_proto=0
+               echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
+       * )     case "$getservbyport_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getservbyport_r=undef
+               getservbyport_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getservbyport_r_proto=0
+       ;;
+esac
+
+: see if getservent_r exists
+set getservent_r d_getservent_r
+eval $inlibc
+case "$d_getservent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_getservent_r_proto:$usethreads" in
+       ":define")      d_getservent_r_proto=define
+               set d_getservent_r_proto getservent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getservent_r_proto" in
+       define)
+       case "$getservent_r_proto" in
+       ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
+       ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
+       esac
+       case "$getservent_r_proto" in
+       ''|0) try='int getservent_r(struct servent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
+       esac
+       case "$getservent_r_proto" in
+       ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
+       ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
+       esac
+       case "$getservent_r_proto" in
+       ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
+       ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
+       esac
+       case "$getservent_r_proto" in
+       ''|0)   d_getservent_r=undef
+               getservent_r_proto=0
+               echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
+       * )     case "$getservent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getservent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getservent_r=undef
+               getservent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getservent_r_proto=0
+       ;;
+esac
+
 : see if prototypes for various getservxxx netdb.h functions are available
 echo " "
 set d_getservprotos getservent $i_netdb netdb.h
@@ -10805,6 +13573,55 @@ eval $hasproto
 set getspnam d_getspnam
 eval $inlibc
 
+: see if this is a shadow.h system
+set shadow.h i_shadow
+eval $inhdr
+
+: see if getspnam_r exists
+set getspnam_r d_getspnam_r
+eval $inlibc
+case "$d_getspnam_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
+       case "$d_getspnam_r_proto:$usethreads" in
+       ":define")      d_getspnam_r_proto=define
+               set d_getspnam_r_proto getspnam_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_getspnam_r_proto" in
+       define)
+       case "$getspnam_r_proto" in
+       ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
+       ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
+       esac
+       case "$getspnam_r_proto" in
+       ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
+       ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
+       esac
+       case "$getspnam_r_proto" in
+       ''|0)   d_getspnam_r=undef
+               getspnam_r_proto=0
+               echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
+       * )     case "$getspnam_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "getspnam_r has no prototype, not using it." >&4 ;;
+               esac
+               d_getspnam_r=undef
+               getspnam_r_proto=0
+               ;;
+       esac
+       ;;
+*)     getspnam_r_proto=0
+       ;;
+esac
+
 : see if gettimeofday or ftime exists
 set gettimeofday d_gettimeod
 eval $inlibc
@@ -10815,37 +13632,57 @@ case "$d_gettimeod" in
        ;;
 *)
        val="$undef"; set d_ftime; eval $setvar
-       ;;
-esac
-case "$d_gettimeod$d_ftime" in
-"$undef$undef")
-       echo " "
-       echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
-       ;;
-esac
-
-: see if this is an grp system
-set grp.h i_grp
-eval $inhdr
-
-case "$i_grp" in
-$define)
-       xxx=`./findhdr grp.h`
-       $cppstdin $cppflags $cppminus < $xxx >$$.h
-
-       if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
-               val="$define"
-       else
-               val="$undef"
-       fi
-       set d_grpasswd
-       eval $setvar
+       ;;
+esac
+case "$d_gettimeod$d_ftime" in
+"$undef$undef")
+       echo " "
+       echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
+       ;;
+esac
 
-       $rm -f $$.h
+: see if gmtime_r exists
+set gmtime_r d_gmtime_r
+eval $inlibc
+case "$d_gmtime_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
+       case "$d_gmtime_r_proto:$usethreads" in
+       ":define")      d_gmtime_r_proto=define
+               set d_gmtime_r_proto gmtime_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_gmtime_r_proto" in
+       define)
+       case "$gmtime_r_proto" in
+       ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
+       ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
+       esac
+       case "$gmtime_r_proto" in
+       ''|0) try='int gmtime_r(const time_t*, struct tm*);'
+       ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
+       esac
+       case "$gmtime_r_proto" in
+       ''|0)   d_gmtime_r=undef
+               gmtime_r_proto=0
+               echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
+       * )     case "$gmtime_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
        ;;
-*)
-       val="$undef";
-       set d_grpasswd; eval $setvar
+       *)      case "$usethreads" in
+               define) echo "gmtime_r has no prototype, not using it." >&4 ;;
+               esac
+               d_gmtime_r=undef
+               gmtime_r_proto=0
+               ;;
+       esac
+       ;;
+*)     gmtime_r_proto=0
        ;;
 esac
 
@@ -10899,6 +13736,10 @@ esac
 set d_htonl
 eval $setvar
 
+: see if ilogbl exists
+set ilogbl d_ilogbl
+eval $inlibc
+
 : index or strchr
 echo " "
 if set index val -f; eval $csym; $val; then
@@ -10938,9 +13779,13 @@ eval $inlibc
 
 : Look for isascii
 echo " "
-$cat >isascii.c <<'EOCP'
+$cat >isascii.c <<EOCP
 #include <stdio.h>
 #include <ctype.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 int main() {
        int c = 'A';
        if (isascii(c))
@@ -11044,6 +13889,51 @@ eval $setvar
 set link d_link
 eval $inlibc
 
+: see if localtime_r exists
+set localtime_r d_localtime_r
+eval $inlibc
+case "$d_localtime_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
+       case "$d_localtime_r_proto:$usethreads" in
+       ":define")      d_localtime_r_proto=define
+               set d_localtime_r_proto localtime_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_localtime_r_proto" in
+       define)
+       case "$localtime_r_proto" in
+       ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
+       ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
+       esac
+       case "$localtime_r_proto" in
+       ''|0) try='int localtime_r(const time_t*, struct tm*);'
+       ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
+       esac
+       case "$localtime_r_proto" in
+       ''|0)   d_localtime_r=undef
+               localtime_r_proto=0
+               echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
+       * )     case "$localtime_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "localtime_r has no prototype, not using it." >&4 ;;
+               esac
+               d_localtime_r=undef
+               localtime_r_proto=0
+               ;;
+       esac
+       ;;
+*)     localtime_r_proto=0
+       ;;
+esac
+
 : see if localeconv exists
 set localeconv d_locconv
 eval $inlibc
@@ -11148,6 +14038,121 @@ esac
 
 
 
+: see if sqrtl exists
+set sqrtl d_sqrtl
+eval $inlibc
+
+: see if scalbnl exists
+set scalbnl d_scalbnl
+eval $inlibc
+
+: see if modfl exists
+set modfl d_modfl
+eval $inlibc
+
+: see if prototype for modfl is available
+echo " "
+set d_modflproto modfl math.h
+eval $hasproto
+
+d_modfl_pow32_bug="$undef"
+
+case "$d_longdbl$d_modfl" in
+$define$define)
+       $cat <<EOM
+Checking to see whether your modfl() is okay for large values...
+EOM
+$cat >try.c <<EOCP
+#include <math.h> 
+#include <stdio.h>
+EOCP
+if $test "X$d_modflproto" != "X$define"; then
+       $cat >>try.c <<EOCP
+/* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
+long double modfl (long double, long double *);
+EOCP
+fi
+$cat >>try.c <<EOCP
+int main() {
+    long double nv = 4294967303.15;
+    long double v, w;
+    v = modfl(nv, &w);         
+#ifdef __GLIBC__
+    printf("glibc");
+#endif
+    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
+    return 0;
+}
+EOCP
+       case "$osname:$gccversion" in
+       aix:)   saveccflags="$ccflags"
+               ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
+       esac
+       set try
+       if eval $compile; then
+               foo=`$run ./try`
+               case "$foo" in
+               *" 4294967303.150000 1.150000 4294967302.000000")
+                       echo >&4 "Your modfl() is broken for large values."
+                       d_modfl_pow32_bug="$define"
+                       case "$foo" in
+                       glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
+                       ;;
+                       esac
+                       ;;
+               *" 4294967303.150000 0.150000 4294967303.000000")
+                       echo >&4 "Your modfl() seems okay for large values."
+                       ;;
+               *)      echo >&4 "I don't understand your modfl() at all."
+                       d_modfl="$undef"
+                       ;;
+               esac
+               $rm -f try.* try core core.try.*
+       else
+               echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
+               d_modfl="$undef"
+       fi
+       case "$osname:$gccversion" in
+       aix:)   ccflags="$saveccflags" ;; # restore
+       esac
+       ;;
+esac
+
+if $test "$uselongdouble" = "$define"; then
+    message=""
+    if $test "$d_sqrtl" != "$define"; then
+       message="$message sqrtl"
+    fi
+    if $test "$d_modfl" != "$define"; then
+       if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
+           echo "You have both aintl and copysignl, so I can emulate modfl."
+       else
+           message="$message modfl"
+       fi
+    fi
+    if $test "$d_frexpl" != "$define"; then
+       if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
+           echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
+       else
+           message="$message frexpl"
+       fi
+    fi
+
+    if $test "$message" != ""; then
+       $cat <<EOM >&4
+
+*** You requested the use of long doubles but you do not seem to have
+*** the following mathematical functions needed for long double support:
+***    $message
+*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
+*** Cannot continue, aborting.
+
+EOM
+
+       exit 1
+    fi
+fi
+
 : see if mprotect exists
 set mprotect d_mprotect
 eval $inlibc
@@ -11240,8 +14245,12 @@ echo " "
 case "$charsize" in
 '')
        echo "Checking to see how big your characters are (hey, you never know)..." >&4
-       $cat >try.c <<'EOCP'
+       $cat >try.c <<EOCP
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 int main()
 {
     printf("%d\n", (int)sizeof(char));
@@ -11481,6 +14490,10 @@ if test X"$d_volatile" = X"$define"; then
 fi
 $cat <<EOP >try.c
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 #include <sys/types.h>
 #include <signal.h>
 #ifdef SIGFPE
@@ -11520,18 +14533,18 @@ set try
 
 d_nv_preserves_uv="$undef"
 if eval $compile; then
-       d_nv_preserves_uv_bits="`$run ./try`"
+       nv_preserves_uv_bits="`$run ./try`"
 fi
-case "$d_nv_preserves_uv_bits" in
+case "$nv_preserves_uv_bits" in
 \-[1-9]*)      
-       d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
-       $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
+       nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
+       $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
        d_nv_preserves_uv="$define"
        ;;
-[1-9]*)        $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
+[1-9]*)        $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
        d_nv_preserves_uv="$undef" ;;
 *)     $echo "Can't figure out how many bits your NVs preserve." 2>&1
-       d_nv_preserves_uv_bits="$undef" ;;
+       nv_preserves_uv_bits="$undef" ;;
 esac
 
 $rm -f try.* try
@@ -11560,13 +14573,6 @@ $rm -f try.* try
 set d_off64_t
 eval $setvar
 
-: see if POSIX threads are available
-set pthread.h i_pthread
-eval $inhdr
-
-
-
-
 : how to create joinable pthreads
 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
        echo " "
@@ -11666,8 +14672,36 @@ $rm -f reflect
 set d_procselfexe
 eval $setvar
 
+: see whether the pthread_atfork exists
+$cat >try.c <<EOP
+#include <pthread.h>
+#include <stdio.h>
+int main() {
+#ifdef  PTHREAD_ATFORK
+        pthread_atfork(NULL,NULL,NULL);
+#endif
+}
+EOP
+
 : see if pthread_atfork exists
-set pthread_atfork d_pthread_atfork
+set try -DPTHREAD_ATFORK
+if eval $compile; then
+    val="$define"
+else
+    val="$undef"
+fi
+case "$usethreads" in
+$define)
+        case "$val" in
+        $define) echo 'pthread_atfork found.' >&4        ;;
+        *)       echo 'pthread_atfork NOT found.' >&4    ;;
+        esac
+esac
+set d_pthread_atfork
+eval $setvar
+
+: see if pthread_attr_setscope exists
+set pthread_attr_setscope d_pthread_attr_setscope
 eval $inlibc
 
 
@@ -11713,120 +14747,81 @@ if eval $compile; then
     val="$define"
     case "$sched_yield" in
     '') sched_yield='pthread_yield()' ;;
-    esac
-else
-    set try -DPTHREAD_YIELD_NULL
-    if eval $compile; then
-       val="$define"
-       case "$sched_yield" in
-       '') sched_yield='pthread_yield(NULL)' ;;
-       esac
-    else
-       val="$undef"
-    fi
-fi
-case "$usethreads" in
-$define)
-       case "$val" in
-       $define) echo 'pthread_yield() found.' >&4      ;;
-       *)       echo 'pthread_yield() NOT found.' >&4  ;;
-       esac
-       ;;
-esac
-set d_pthread_yield
-eval $setvar
-
-case "$sched_yield" in
-'') sched_yield=undef ;;
-esac
-
-$rm -f try try.*
-
-: see if this is a pwd.h system
-set pwd.h i_pwd
-eval $inhdr
-
-case "$i_pwd" in
-$define)
-       xxx=`./findhdr pwd.h`
-       $cppstdin $cppflags $cppminus < $xxx >$$.h
-
-       if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
-               val="$define"
-       else
-               val="$undef"
-       fi
-       set d_pwquota
-       eval $setvar
-
-       if $contains 'pw_age' $$.h >/dev/null 2>&1; then
-               val="$define"
-       else
-               val="$undef"
-       fi
-       set d_pwage
-       eval $setvar
-
-       if $contains 'pw_change' $$.h >/dev/null 2>&1; then
-               val="$define"
-       else
-               val="$undef"
-       fi
-       set d_pwchange
-       eval $setvar
-
-       if $contains 'pw_class' $$.h >/dev/null 2>&1; then
-               val="$define"
-       else
-               val="$undef"
-       fi
-       set d_pwclass
-       eval $setvar
-
-       if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
-               val="$define"
-       else
-               val="$undef"
-       fi
-       set d_pwexpire
-       eval $setvar
-
-       if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
-               val="$define"
-       else
-               val="$undef"
-       fi
-       set d_pwcomment
-       eval $setvar
+    esac
+else
+    set try -DPTHREAD_YIELD_NULL
+    if eval $compile; then
+       val="$define"
+       case "$sched_yield" in
+       '') sched_yield='pthread_yield(NULL)' ;;
+       esac
+    else
+       val="$undef"
+    fi
+fi
+case "$usethreads" in
+$define)
+       case "$val" in
+       $define) echo 'pthread_yield() found.' >&4      ;;
+       *)       echo 'pthread_yield() NOT found.' >&4  ;;
+       esac
+       ;;
+esac
+set d_pthread_yield
+eval $setvar
 
-       if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
-               val="$define"
-       else
-               val="$undef"
-       fi
-       set d_pwgecos
-       eval $setvar
+case "$sched_yield" in
+'') sched_yield=undef ;;
+esac
 
-       if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
-               val="$define"
-       else
-               val="$undef"
-       fi
-       set d_pwpasswd
-       eval $setvar
+$rm -f try try.*
 
-       $rm -f $$.h
+: see if random_r exists
+set random_r d_random_r
+eval $inlibc
+case "$d_random_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
+       case "$d_random_r_proto:$usethreads" in
+       ":define")      d_random_r_proto=define
+               set d_random_r_proto random_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_random_r_proto" in
+       define)
+       case "$random_r_proto" in
+       ''|0) try='int random_r(int*, struct random_data*);'
+       ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
+       esac
+       case "$random_r_proto" in
+       ''|0) try='int random_r(long*, struct random_data*);'
+       ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
+       esac
+       case "$random_r_proto" in
+       ''|0) try='int random_r(struct random_data*, int32_t*);'
+       ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
+       esac
+       case "$random_r_proto" in
+       ''|0)   d_random_r=undef
+               random_r_proto=0
+               echo "Disabling random_r, cannot determine prototype." >&4 ;;
+       * )     case "$random_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
        ;;
-*)
-       val="$undef"; 
-       set d_pwquota; eval $setvar
-       set d_pwage; eval $setvar
-       set d_pwchange; eval $setvar
-       set d_pwclass; eval $setvar
-       set d_pwexpire; eval $setvar
-       set d_pwcomment; eval $setvar
-       set d_pwgecos; eval $setvar
-       set d_pwpasswd; eval $setvar
+       *)      case "$usethreads" in
+               define) echo "random_r has no prototype, not using it." >&4 ;;
+               esac
+               d_random_r=undef
+               random_r_proto=0
+               ;;
+       esac
+       ;;
+*)     random_r_proto=0
        ;;
 esac
 
@@ -11840,6 +14835,96 @@ eval $inlibc
 set rewinddir d_rewinddir
 eval $inlibc
 
+: see if readdir64_r exists
+set readdir64_r d_readdir64_r
+eval $inlibc
+case "$d_readdir64_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
+       case "$d_readdir64_r_proto:$usethreads" in
+       ":define")      d_readdir64_r_proto=define
+               set d_readdir64_r_proto readdir64_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_readdir64_r_proto" in
+       define)
+       case "$readdir64_r_proto" in
+       ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
+       ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
+       esac
+       case "$readdir64_r_proto" in
+       ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
+       ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
+       esac
+       case "$readdir64_r_proto" in
+       ''|0)   d_readdir64_r=undef
+               readdir64_r_proto=0
+               echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
+       * )     case "$readdir64_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "readdir64_r has no prototype, not using it." >&4 ;;
+               esac
+               d_readdir64_r=undef
+               readdir64_r_proto=0
+               ;;
+       esac
+       ;;
+*)     readdir64_r_proto=0
+       ;;
+esac
+
+: see if readdir_r exists
+set readdir_r d_readdir_r
+eval $inlibc
+case "$d_readdir_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
+       case "$d_readdir_r_proto:$usethreads" in
+       ":define")      d_readdir_r_proto=define
+               set d_readdir_r_proto readdir_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_readdir_r_proto" in
+       define)
+       case "$readdir_r_proto" in
+       ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
+       ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
+       esac
+       case "$readdir_r_proto" in
+       ''|0) try='int readdir_r(DIR*, struct dirent*);'
+       ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
+       esac
+       case "$readdir_r_proto" in
+       ''|0)   d_readdir_r=undef
+               readdir_r_proto=0
+               echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
+       * )     case "$readdir_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "readdir_r has no prototype, not using it." >&4 ;;
+               esac
+               d_readdir_r=undef
+               readdir_r_proto=0
+               ;;
+       esac
+       ;;
+*)     readdir_r_proto=0
+       ;;
+esac
+
 : see if readv exists
 set readv d_readv
 eval $inlibc
@@ -12157,14 +15242,13 @@ else
     echo "You do not have union semun in <sys/sem.h>." >&4
     val="$undef"
 fi
-$rm -f try try.c try.h
+$rm -f try try.c
 set d_union_semun
 eval $setvar
 
 : see how to do semctl IPC_STAT
 case "$d_sem" in
 $define)
-    : see whether semctl IPC_STAT can use union semun
     echo " "
     $cat > try.h <<END
 #ifndef S_IRUSR
@@ -12190,8 +15274,11 @@ $define)
 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
 #endif
 END
-
-    $cat > try.c <<END
+    : see whether semctl IPC_STAT can use union semun
+    val="$undef"
+    case "$d_semctl_semun" in
+    '')
+      $cat > try.c <<END
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/sem.h>
@@ -12237,15 +15324,16 @@ int main() {
   return 0;
 }
 END
-    val="$undef"
-    set try
-    if eval $compile; then
-       xxx=`$run ./try`
-        case "$xxx" in
-        semun) val="$define" ;;
-        esac
-    fi
-    $rm -f try try.c
+      set try
+      if eval $compile; then
+         xxx=`$run ./try`
+          case "$xxx" in
+          semun) val="$define" ;;
+          esac
+      fi
+      $rm -f try try.c
+      ;;
+    esac
     set d_semctl_semun
     eval $setvar
     case "$d_semctl_semun" in
@@ -12259,7 +15347,10 @@ END
     esac
 
     : see whether semctl IPC_STAT can use struct semid_ds pointer
-    $cat > try.c <<'END'
+    val="$undef"
+    case "$d_semctl_semid_ds" in
+    '')
+      $cat > try.c <<'END'
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/sem.h>
@@ -12295,15 +15386,16 @@ int main() {
     return 0;
 }
 END
-    val="$undef"
-    set try
-    if eval $compile; then
-        xxx=`$run ./try`
-        case "$xxx" in
-        semid_ds) val="$define" ;;
-        esac
-    fi
-    $rm -f try try.c
+      set try
+      if eval $compile; then
+          xxx=`$run ./try`
+          case "$xxx" in
+          semid_ds) val="$define" ;;
+          esac
+      fi
+      $rm -f try try.c
+      ;;
+    esac
     set d_semctl_semid_ds
     eval $setvar
     case "$d_semctl_semid_ds" in
@@ -12344,10 +15436,100 @@ eval $inlibc
 set setgrent d_setgrent
 eval $inlibc
 
+: see if setgrent_r exists
+set setgrent_r d_setgrent_r
+eval $inlibc
+case "$d_setgrent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
+       case "$d_setgrent_r_proto:$usethreads" in
+       ":define")      d_setgrent_r_proto=define
+               set d_setgrent_r_proto setgrent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_setgrent_r_proto" in
+       define)
+       case "$setgrent_r_proto" in
+       ''|0) try='int setgrent_r(FILE**);'
+       ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
+       esac
+       case "$setgrent_r_proto" in
+       ''|0) try='void setgrent_r(FILE**);'
+       ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
+       esac
+       case "$setgrent_r_proto" in
+       ''|0)   d_setgrent_r=undef
+               setgrent_r_proto=0
+               echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
+       * )     case "$setgrent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "setgrent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_setgrent_r=undef
+               setgrent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     setgrent_r_proto=0
+       ;;
+esac
+
 : see if sethostent exists
 set sethostent d_sethent
 eval $inlibc
 
+: see if sethostent_r exists
+set sethostent_r d_sethostent_r
+eval $inlibc
+case "$d_sethostent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_sethostent_r_proto:$usethreads" in
+       ":define")      d_sethostent_r_proto=define
+               set d_sethostent_r_proto sethostent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_sethostent_r_proto" in
+       define)
+       case "$sethostent_r_proto" in
+       ''|0) try='int sethostent_r(int, struct hostent_data*);'
+       ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
+       esac
+       case "$sethostent_r_proto" in
+       ''|0) try='void sethostent_r(int, struct hostent_data*);'
+       ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
+       esac
+       case "$sethostent_r_proto" in
+       ''|0)   d_sethostent_r=undef
+               sethostent_r_proto=0
+               echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
+       * )     case "$sethostent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "sethostent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_sethostent_r=undef
+               sethostent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     sethostent_r_proto=0
+       ;;
+esac
+
 : see if setitimer exists
 set setitimer d_setitimer
 eval $inlibc
@@ -12360,609 +15542,688 @@ eval $inlibc
 set setlocale d_setlocale
 eval $inlibc
 
-: see if setnetent exists
-set setnetent d_setnent
-eval $inlibc
-
-: see if setprotoent exists
-set setprotoent d_setpent
-eval $inlibc
-
-: see if setpgid exists
-set setpgid d_setpgid
-eval $inlibc
-
-: see if setpgrp2 exists
-set setpgrp2 d_setpgrp2
-eval $inlibc
-
-: see if setpriority exists
-set setpriority d_setprior
-eval $inlibc
-
-: see if setproctitle exists
-set setproctitle d_setproctitle
-eval $inlibc
-
-: see if setpwent exists
-set setpwent d_setpwent
-eval $inlibc
-
-: see if setregid exists
-set setregid d_setregid
-eval $inlibc
-set setresgid d_setresgid
-eval $inlibc
-
-: see if setreuid exists
-set setreuid d_setreuid
-eval $inlibc
-set setresuid d_setresuid
-eval $inlibc
-
-: see if setrgid exists
-set setrgid d_setrgid
-eval $inlibc
-
-: see if setruid exists
-set setruid d_setruid
-eval $inlibc
+: see if locale.h is available
+set locale.h i_locale
+eval $inhdr
 
-: see if setservent exists
-set setservent d_setsent
+: see if setlocale_r exists
+set setlocale_r d_setlocale_r
 eval $inlibc
+case "$d_setlocale_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
+       case "$d_setlocale_r_proto:$usethreads" in
+       ":define")      d_setlocale_r_proto=define
+               set d_setlocale_r_proto setlocale_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_setlocale_r_proto" in
+       define)
+       case "$setlocale_r_proto" in
+       ''|0) try='int setlocale_r(int, const char*, char*, int);'
+       ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
+       esac
+       case "$setlocale_r_proto" in
+       ''|0)   d_setlocale_r=undef
+               setlocale_r_proto=0
+               echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
+       * )     case "$setlocale_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "setlocale_r has no prototype, not using it." >&4 ;;
+               esac
+               d_setlocale_r=undef
+               setlocale_r_proto=0
+               ;;
+       esac
+       ;;
+*)     setlocale_r_proto=0
+       ;;
+esac
 
-: see if setsid exists
-set setsid d_setsid
+: see if setnetent exists
+set setnetent d_setnent
 eval $inlibc
 
-: see if setvbuf exists
-set setvbuf d_setvbuf
+: see if setnetent_r exists
+set setnetent_r d_setnetent_r
 eval $inlibc
-
-: see if sfio.h is available
-set sfio.h i_sfio
-eval $inhdr
-
-
-: see if sfio library is available
-case "$i_sfio" in
-$define)
-       val=''
-       set sfreserve val
-       eval $inlibc
-       ;;
-*)
-       val="$undef"
-       ;;
-esac
-: Ok, but do we want to use it.
-case "$val" in
-$define)
-       case "$usesfio" in
-       true|$define|[yY]*) dflt='y';;
-       *) dflt='n';;
-       esac
-       echo "$package can use the sfio library, but it is experimental."
-       case "$useperlio" in
-       "$undef")
-           echo "For sfio also the PerlIO abstraction layer is needed."
-           echo "Earlier you said you wouldn't want that."
-           ;;
-       esac
-       rp="You seem to have sfio available, do you want to try using it?"
-       . ./myread
-       case "$ans" in
-       y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
-               useperlio="$define"
-               val="$define"
-               ;;
-       *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
-               val="$undef"
-               ;;
+case "$d_setnetent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_setnetent_r_proto:$usethreads" in
+       ":define")      d_setnetent_r_proto=define
+               set d_setnetent_r_proto setnetent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
        esac
-       ;;
-*)     case "$usesfio" in
-       true|$define|[yY]*)
-               echo "Sorry, cannot find sfio on this machine." >&4
-               echo "Ignoring your setting of usesfio=$usesfio." >&4
-               val="$undef"
-               ;;
+       case "$d_setnetent_r_proto" in
+       define)
+       case "$setnetent_r_proto" in
+       ''|0) try='int setnetent_r(int, struct netent_data*);'
+       ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
+       esac
+       case "$setnetent_r_proto" in
+       ''|0) try='void setnetent_r(int, struct netent_data*);'
+       ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
+       esac
+       case "$setnetent_r_proto" in
+       ''|0)   d_setnetent_r=undef
+               setnetent_r_proto=0
+               echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
+       * )     case "$setnetent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
        esac
        ;;
-esac
-set d_sfio
-eval $setvar
-case "$d_sfio" in
-$define) usesfio='true';;
-*) usesfio='false';;
-esac
-case "$d_sfio" in
-$define) ;;
-*)     : Remove sfio from list of libraries to use
-       case "$libs" in
-       *-lsfio*)
-               echo "Removing unneeded -lsfio from library list" >&4
-               set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
-               shift
-               libs="$*"
-               echo "libs = $libs" >&4
+       *)      case "$usethreads" in
+               define) echo "setnetent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_setnetent_r=undef
+               setnetent_r_proto=0
                ;;
        esac
-;;
+       ;;
+*)     setnetent_r_proto=0
+       ;;
 esac
 
+: see if setprotoent exists
+set setprotoent d_setpent
+eval $inlibc
 
-: see if shmctl exists
-set shmctl d_shmctl
+: see if setpgid exists
+set setpgid d_setpgid
 eval $inlibc
 
-: see if shmget exists
-set shmget d_shmget
+: see if setpgrp2 exists
+set setpgrp2 d_setpgrp2
 eval $inlibc
 
-: see if shmat exists
-set shmat d_shmat
+: see if setpriority exists
+set setpriority d_setprior
 eval $inlibc
-: see what shmat returns
-case "$d_shmat" in
-"$define")
-       $cat >shmat.c <<'END'
-#include <sys/shm.h>
-void *shmat();
-END
-       if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
-               shmattype='void *'
-       else
-               shmattype='char *'
-       fi
-       echo "and it returns ($shmattype)." >&4
-       : see if a prototype for shmat is available
-       xxx=`./findhdr sys/shm.h`
-       $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
-       if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
-               val="$define"
-       else
-               val="$undef"
-       fi
-       $rm -f shmat.[co]
-       ;;
-*)
-       val="$undef"
-       ;;
-esac
-set d_shmatprototype
-eval $setvar
 
-: see if shmdt exists
-set shmdt d_shmdt
+: see if setproctitle exists
+set setproctitle d_setproctitle
 eval $inlibc
 
-: see how much of the 'shm*(2)' library is present.
-h_shm=true
-echo " "
-case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
-*"$undef"*) h_shm=false;;
-esac
-case "$osname" in
-freebsd)
-    case "`ipcs 2>&1`" in
-    "SVID shared memory"*"not configured"*)
-       echo "Your $osname does not have the shm*(2) configured." >&4
-        h_shm=false
-       val="$undef"
-       set shmctl d_shmctl
-       evat $setvar
-       set shmget d_shmget
-       evat $setvar
-       set shmat d_shmat
-       evat $setvar
-       set shmdt d_shmdt
-       evat $setvar
+: see if setprotoent_r exists
+set setprotoent_r d_setprotoent_r
+eval $inlibc
+case "$d_setprotoent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_setprotoent_r_proto:$usethreads" in
+       ":define")      d_setprotoent_r_proto=define
+               set d_setprotoent_r_proto setprotoent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_setprotoent_r_proto" in
+       define)
+       case "$setprotoent_r_proto" in
+       ''|0) try='int setprotoent_r(int, struct protoent_data*);'
+       ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
+       esac
+       case "$setprotoent_r_proto" in
+       ''|0) try='void setprotoent_r(int, struct protoent_data*);'
+       ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
+       esac
+       case "$setprotoent_r_proto" in
+       ''|0)   d_setprotoent_r=undef
+               setprotoent_r_proto=0
+               echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
+       * )     case "$setprotoent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_setprotoent_r=undef
+               setprotoent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     setprotoent_r_proto=0
        ;;
-    esac
-    ;;
 esac
-: we could also check for sys/ipc.h ...
-if $h_shm && $test `./findhdr sys/shm.h`; then
-       echo "You have the full shm*(2) library." >&4
-       val="$define"
-else
-       echo "You don't have the full shm*(2) library." >&4
-       val="$undef"
-fi
-set d_shm
-eval $setvar
-
-echo " "
-: see if we have sigaction
-if set sigaction val -f d_sigaction; eval $csym; $val; then
-       echo 'sigaction() found.' >&4
-       $cat > try.c <<'EOP'
-#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
-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
-       if eval $compile_ok; then
-               val="$define"
-       else
-               echo "But you don't seem to have a useable struct sigaction." >&4
-               val="$undef"
-       fi
-else
-       echo 'sigaction NOT found.' >&4
-       val="$undef"
-fi
-set d_sigaction; eval $setvar
-$rm -f try try$_o try.c
 
-: see if sigprocmask exists
-set sigprocmask d_sigprocmask
+: see if setpwent exists
+set setpwent d_setpwent
 eval $inlibc
 
-: see if sigsetjmp exists
-echo " "
-case "$d_sigsetjmp" in
-'')
-       $cat >try.c <<'EOP'
-#include <setjmp.h>
-sigjmp_buf env;
-int set = 1;
-int main()
-{
-       if (sigsetjmp(env,1))
-               exit(set);
-       set = 0;
-       siglongjmp(env, 1);
-       exit(1);
-}
-EOP
-       set try
-       if eval $compile; then
-               if $run ./try >/dev/null 2>&1; then
-                       echo "POSIX sigsetjmp found." >&4
-                       val="$define"
-               else
-                       $cat >&4 <<EOM
-Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
-I'll ignore them.
-EOM
-                       val="$undef"
-               fi
-       else
-               echo "sigsetjmp not found." >&4
-               val="$undef"
-       fi
+: see if setpwent_r exists
+set setpwent_r d_setpwent_r
+eval $inlibc
+case "$d_setpwent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
+       case "$d_setpwent_r_proto:$usethreads" in
+       ":define")      d_setpwent_r_proto=define
+               set d_setpwent_r_proto setpwent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_setpwent_r_proto" in
+       define)
+       case "$setpwent_r_proto" in
+       ''|0) try='int setpwent_r(FILE**);'
+       ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
+       esac
+       case "$setpwent_r_proto" in
+       ''|0) try='void setpwent_r(FILE**);'
+       ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
+       esac
+       case "$setpwent_r_proto" in
+       ''|0)   d_setpwent_r=undef
+               setpwent_r_proto=0
+               echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
+       * )     case "$setpwent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
        ;;
-*) val="$d_sigsetjmp"
-       case "$d_sigsetjmp" in
-       $define) echo "POSIX sigsetjmp found." >&4;;
-       $undef) echo "sigsetjmp not found." >&4;;
+       *)      case "$usethreads" in
+               define) echo "setpwent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_setpwent_r=undef
+               setpwent_r_proto=0
+               ;;
        esac
        ;;
+*)     setpwent_r_proto=0
+       ;;
 esac
-set d_sigsetjmp
-eval $setvar
-$rm -f try.c try
 
-: see if sockatmark exists
-set sockatmark d_sockatmark
+: see if setregid exists
+set setregid d_setregid
 eval $inlibc
-
-: see if prototype for sockatmark is available
-echo " "
-set d_sockatmarkproto sockatmark $d_socket sys/socket.h
-eval $hasproto
-
-: see if socks5_init exists
-set socks5_init d_socks5_init
+set setresgid d_setresgid
 eval $inlibc
 
-: see if prototype for setresgid is available
-echo " "
-set d_sresgproto setresgid $i_unistd unistd.h
-eval $hasproto
-
-: see if prototype for setresuid is available
-echo " "
-set d_sresuproto setresuid $i_unistd unistd.h
-eval $hasproto
+: see if setreuid exists
+set setreuid d_setreuid
+eval $inlibc
+set setresuid d_setresuid
+eval $inlibc
 
-: see if sys/stat.h is available
-set sys/stat.h i_sysstat
-eval $inhdr
+: see if setrgid exists
+set setrgid d_setrgid
+eval $inlibc
 
+: see if setruid exists
+set setruid d_setruid
+eval $inlibc
 
-: 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 setservent exists
+set setservent d_setsent
+eval $inlibc
 
+: see if setservent_r exists
+set setservent_r d_setservent_r
+eval $inlibc
+case "$d_setservent_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
+       case "$d_setservent_r_proto:$usethreads" in
+       ":define")      d_setservent_r_proto=define
+               set d_setservent_r_proto setservent_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_setservent_r_proto" in
+       define)
+       case "$setservent_r_proto" in
+       ''|0) try='int setservent_r(int, struct servent_data*);'
+       ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
+       esac
+       case "$setservent_r_proto" in
+       ''|0) try='void setservent_r(int, struct servent_data*);'
+       ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
+       esac
+       case "$setservent_r_proto" in
+       ''|0)   d_setservent_r=undef
+               setservent_r_proto=0
+               echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
+       * )     case "$setservent_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "setservent_r has no prototype, not using it." >&4 ;;
+               esac
+               d_setservent_r=undef
+               setservent_r_proto=0
+               ;;
+       esac
+       ;;
+*)     setservent_r_proto=0
+       ;;
+esac
 
-: see if this is a sys/vfs.h system
-set sys/vfs.h i_sysvfs
-eval $inhdr
+: see if setsid exists
+set setsid d_setsid
+eval $inlibc
 
+: see if setvbuf exists
+set setvbuf d_setvbuf
+eval $inlibc
 
-: see if this is a sys/statfs.h system
-set sys/statfs.h i_sysstatfs
+: see if sfio.h is available
+set sfio.h i_sfio
 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
+: see if sfio library is available
+case "$i_sfio" in
+$define)
+       val=''
+       set sfreserve val
+       eval $inlibc
        ;;
-*)     val="$undef"
-       set d_statfs_f_flags
-       eval $setvar
+*)
+       val="$undef"
        ;;
 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 '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
-       echo "(Looks like you have stdio.h from BSD.)"
-       case "$stdio_ptr" in
-       '') stdio_ptr='((fp)->_p)'
-               ptr_lval=$define
-               ;;
-       *)      ptr_lval=$d_stdio_ptr_lval;;
-       esac
-       case "$stdio_cnt" in
-       '') stdio_cnt='((fp)->_r)'
-               cnt_lval=$define
-               ;;
-       *)      cnt_lval=$d_stdio_cnt_lval;;
-       esac
-       case "$stdio_base" in
-       '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
+: Ok, but do we want to use it.
+case "$val" in
+$define)
+       case "$usesfio" in
+       true|$define|[yY]*) dflt='y';;
+       *) dflt='n';;
        esac
-       case "$stdio_bufsiz" in
-       '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
+       echo "$package can use the sfio library, but it is experimental."
+       case "$useperlio" in
+       "$undef")
+           echo "For sfio also the PerlIO abstraction layer is needed."
+           echo "Earlier you said you wouldn't want that."
+           ;;
        esac
-elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
-       echo "(Looks like you have stdio.h from Linux.)"
-       case "$stdio_ptr" in
-       '') stdio_ptr='((fp)->_IO_read_ptr)'
-               ptr_lval=$define
+       rp="You seem to have sfio available, do you want to try using it?"
+       . ./myread
+       case "$ans" in
+       y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
+               useperlio="$define"
+               val="$define"
                ;;
-       *)      ptr_lval=$d_stdio_ptr_lval;;
-       esac
-       case "$stdio_cnt" in
-       '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
-               cnt_lval=$undef
+       *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
+               val="$undef"
                ;;
-       *)      cnt_lval=$d_stdio_cnt_lval;;
-       esac
-       case "$stdio_base" in
-       '') stdio_base='((fp)->_IO_read_base)';;
-       esac
-       case "$stdio_bufsiz" in
-       '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
        esac
-else
-       case "$stdio_ptr" in
-       '') stdio_ptr='((fp)->_ptr)'
-               ptr_lval=$define
+       ;;
+*)     case "$usesfio" in
+       true|$define|[yY]*)
+               echo "Sorry, cannot find sfio on this machine." >&4
+               echo "Ignoring your setting of usesfio=$usesfio." >&4
+               val="$undef"
                ;;
-       *)      ptr_lval=$d_stdio_ptr_lval;;
        esac
-       case "$stdio_cnt" in
-       '') stdio_cnt='((fp)->_cnt)'
-               cnt_lval=$define
+       ;;
+esac
+set d_sfio
+eval $setvar
+case "$d_sfio" in
+$define) usesfio='true';;
+*) usesfio='false';;
+esac
+case "$d_sfio" in
+$define) ;;
+*)     : Remove sfio from list of libraries to use
+       case "$libs" in
+       *-lsfio*)
+               echo "Removing unneeded -lsfio from library list" >&4
+               set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
+               shift
+               libs="$*"
+               echo "libs = $libs" >&4
                ;;
-       *)      cnt_lval=$d_stdio_cnt_lval;;
-       esac
-       case "$stdio_base" in
-       '') stdio_base='((fp)->_base)';;
-       esac
-       case "$stdio_bufsiz" in
-       '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
        esac
-fi
+;;
+esac
 
-: test whether _ptr and _cnt really work
-echo "Checking how std your stdio is..." >&4
-$cat >try.c <<EOP
-#include <stdio.h>
-#define FILE_ptr(fp)   $stdio_ptr
-#define FILE_cnt(fp)   $stdio_cnt
-int main() {
-       FILE *fp = fopen("try.c", "r");
-       char c = getc(fp);
-       if (
-               18 <= FILE_cnt(fp) &&
-               strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
-       )
-               exit(0);
-       exit(1);
-}
-EOP
-val="$undef"
-set try
-if eval $compile && $to try.c; then
-       if $run ./try; then
-               echo "Your stdio acts pretty std."
+
+: see if shmctl exists
+set shmctl d_shmctl
+eval $inlibc
+
+: see if shmget exists
+set shmget d_shmget
+eval $inlibc
+
+: see if shmat exists
+set shmat d_shmat
+eval $inlibc
+: see what shmat returns
+case "$d_shmat" in
+"$define")
+       $cat >shmat.c <<'END'
+#include <sys/shm.h>
+void *shmat();
+END
+       if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
+               shmattype='void *'
+       else
+               shmattype='char *'
+       fi
+       echo "and it returns ($shmattype)." >&4
+       : see if a prototype for shmat is available
+       xxx=`./findhdr sys/shm.h`
+       $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
+       if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
                val="$define"
        else
-               echo "Your stdio isn't very std."
+               val="$undef"
        fi
-else
-       echo "Your stdio doesn't appear very std."
-fi
-$rm -f try.c try
-set d_stdstdio
-eval $setvar
-
-: Can _ptr be used as an lvalue?
-case "$d_stdstdio$ptr_lval" in
-$define$define) val=$define ;;
-*) val=$undef ;;
+       $rm -f shmat.[co]
+       ;;
+*)
+       val="$undef"
+       ;;
 esac
-set d_stdio_ptr_lval
+set d_shmatprototype
 eval $setvar
 
-: Can _cnt be used as an lvalue?
-case "$d_stdstdio$cnt_lval" in
-$define$define) val=$define ;;
-*) val=$undef ;;
+: see if shmdt exists
+set shmdt d_shmdt
+eval $inlibc
+
+: see how much of the 'shm*(2)' library is present.
+h_shm=true
+echo " "
+case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
+*"$undef"*) h_shm=false;;
+esac
+case "$osname" in
+freebsd)
+    case "`ipcs 2>&1`" in
+    "SVID shared memory"*"not configured"*)
+       echo "Your $osname does not have the shm*(2) configured." >&4
+        h_shm=false
+       val="$undef"
+       set shmctl d_shmctl
+       evat $setvar
+       set shmget d_shmget
+       evat $setvar
+       set shmat d_shmat
+       evat $setvar
+       set shmdt d_shmdt
+       evat $setvar
+       ;;
+    esac
+    ;;
 esac
-set d_stdio_cnt_lval
+: we could also check for sys/ipc.h ...
+if $h_shm && $test `./findhdr sys/shm.h`; then
+       echo "You have the full shm*(2) library." >&4
+       val="$define"
+else
+       echo "You don't have the full shm*(2) library." >&4
+       val="$undef"
+fi
+set d_shm
 eval $setvar
 
-
-: test whether setting _ptr sets _cnt as a side effect
-d_stdio_ptr_lval_sets_cnt="$undef"
-d_stdio_ptr_lval_nochange_cnt="$undef"
-case "$d_stdio_ptr_lval$d_stdstdio" in
-$define$define)
-       echo "Checking to see what happens if we set the stdio ptr..." >&4
-$cat >try.c <<EOP
+echo " "
+: see if we have sigaction
+if set sigaction val -f d_sigaction; eval $csym; $val; then
+       echo 'sigaction() found.' >&4
+       $cat > try.c <<EOP
 #include <stdio.h>
-/* Can we scream? */
-/* Eat dust sed :-) */
-/* In the buffer space, no one can hear you scream. */
-#define FILE_ptr(fp)   $stdio_ptr
-#define FILE_cnt(fp)   $stdio_cnt
 #include <sys/types.h>
-int main() {
-       FILE *fp = fopen("try.c", "r");
-       int c;
-       char *ptr;
-       size_t cnt;
-       if (!fp) {
-           puts("Fail even to read");
-           exit(1);
-       }
-       c = getc(fp); /* Read away the first # */
-       if (c == EOF) {
-           puts("Fail even to read");
-           exit(1);
-       }
-       if (!(
-               18 <= FILE_cnt(fp) &&
-               strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
-       )) {
-               puts("Fail even to read");
-               exit (1);
-       }
-       ptr = (char*) FILE_ptr(fp);
-       cnt = (size_t)FILE_cnt(fp);
-
-       FILE_ptr(fp) += 42;
-
-       if ((char*)FILE_ptr(fp) != (ptr + 42)) {
-               printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
-               exit (1);
-       }
-       if (FILE_cnt(fp) <= 20) {
-               printf ("Fail (<20 chars to test)");
-               exit (1);
-       }
-       if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
-               puts("Fail compare");
-               exit (1);
-       }
-       if (cnt == FILE_cnt(fp)) {
-               puts("Pass_unchanged");
-               exit (0);
-       }       
-       if (FILE_cnt(fp) == (cnt - 42)) {
-               puts("Pass_changed");
-               exit (0);
-       }
-       printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
-       return 1;
-
+#include <signal.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+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
-       if eval $compile && $to try.c; then
-               case `$run ./try` in
-               Pass_changed)
-                       echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
-                       d_stdio_ptr_lval_sets_cnt="$define" ;;
-               Pass_unchanged)
-                       echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
-                       d_stdio_ptr_lval_nochange_cnt="$define" ;;
-               Fail*)
-                       echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
-               *)
-                       echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
-       esac
+       if eval $compile_ok; then
+               val="$define"
        else
-               echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
+               echo "But you don't seem to have a useable struct sigaction." >&4
+               val="$undef"
        fi
-       $rm -f try.c try
-       ;;
-esac
+else
+       echo 'sigaction NOT found.' >&4
+       val="$undef"
+fi
+set d_sigaction; eval $setvar
+$rm -f try try$_o try.c
 
-: see if _base is also standard
-val="$undef"
-case "$d_stdstdio" in
-$define)
+: see if sigprocmask exists
+set sigprocmask d_sigprocmask
+eval $inlibc
+
+: see if sigsetjmp exists
+echo " "
+case "$d_sigsetjmp" in
+'')
        $cat >try.c <<EOP
-#include <stdio.h>
-#define FILE_base(fp)  $stdio_base
-#define FILE_bufsiz(fp)        $stdio_bufsiz
-int main() {
-       FILE *fp = fopen("try.c", "r");
-       char c = getc(fp);
-       if (
-               19 <= FILE_bufsiz(fp) &&
-               strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
-       )
-               exit(0);
+#include <setjmp.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+sigjmp_buf env;
+int set = 1;
+int main()
+{
+       if (sigsetjmp(env,1))
+               exit(set);
+       set = 0;
+       siglongjmp(env, 1);
        exit(1);
 }
 EOP
        set try
-       if eval $compile && $to try.c; then
-               if $run ./try; then
-                       echo "And its _base field acts std."
+       if eval $compile; then
+               if $run ./try >/dev/null 2>&1; then
+                       echo "POSIX sigsetjmp found." >&4
                        val="$define"
                else
-                       echo "But its _base field isn't std."
+                       $cat >&4 <<EOM
+Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
+I'll ignore them.
+EOM
+                       val="$undef"
                fi
        else
-               echo "However, it seems to be lacking the _base field."
+               echo "sigsetjmp not found." >&4
+               val="$undef"
        fi
-       $rm -f try.c try
+       ;;
+*) val="$d_sigsetjmp"
+       case "$d_sigsetjmp" in
+       $define) echo "POSIX sigsetjmp found." >&4;;
+       $undef) echo "sigsetjmp not found." >&4;;
+       esac
+       ;;
+esac
+set d_sigsetjmp
+eval $setvar
+$rm -f try.c try
+
+: see if sockatmark exists
+set sockatmark d_sockatmark
+eval $inlibc
+
+: see if prototype for sockatmark is available
+echo " "
+set d_sockatmarkproto sockatmark $d_socket sys/socket.h
+eval $hasproto
+
+: see if socks5_init exists
+set socks5_init d_socks5_init
+eval $inlibc
+
+: see if srand48_r exists
+set srand48_r d_srand48_r
+eval $inlibc
+case "$d_srand48_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
+       case "$d_srand48_r_proto:$usethreads" in
+       ":define")      d_srand48_r_proto=define
+               set d_srand48_r_proto srand48_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_srand48_r_proto" in
+       define)
+       case "$srand48_r_proto" in
+       ''|0) try='int srand48_r(long, struct drand48_data*);'
+       ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
+       esac
+       case "$srand48_r_proto" in
+       ''|0)   d_srand48_r=undef
+               srand48_r_proto=0
+               echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
+       * )     case "$srand48_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "srand48_r has no prototype, not using it." >&4 ;;
+               esac
+               d_srand48_r=undef
+               srand48_r_proto=0
+               ;;
+       esac
+       ;;
+*)     srand48_r_proto=0
+       ;;
+esac
+
+: see if srandom_r exists
+set srandom_r d_srandom_r
+eval $inlibc
+case "$d_srandom_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
+       case "$d_srandom_r_proto:$usethreads" in
+       ":define")      d_srandom_r_proto=define
+               set d_srandom_r_proto srandom_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_srandom_r_proto" in
+       define)
+       case "$srandom_r_proto" in
+       ''|0) try='int srandom_r(unsigned int, struct random_data*);'
+       ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
+       esac
+       case "$srandom_r_proto" in
+       ''|0)   d_srandom_r=undef
+               srandom_r_proto=0
+               echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
+       * )     case "$srandom_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "srandom_r has no prototype, not using it." >&4 ;;
+               esac
+               d_srandom_r=undef
+               srandom_r_proto=0
+               ;;
+       esac
+       ;;
+*)     srandom_r_proto=0
+       ;;
+esac
+
+: see if prototype for setresgid is available
+echo " "
+set d_sresgproto setresgid $i_unistd unistd.h
+eval $hasproto
+
+: see if prototype for setresuid is available
+echo " "
+set d_sresuproto setresuid $i_unistd unistd.h
+eval $hasproto
+
+: see if sys/stat.h is available
+set sys/stat.h i_sysstat
+eval $inhdr
+
+
+: 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
-set d_stdiobase
-eval $setvar
+case "$d_statfs_f_flags" in
+"$define")      echo "Yes, it does."   ;;
+*)              echo "No, it doesn't." ;;
+esac
 
 $cat >&4 <<EOM
 Checking how to access stdio streams by file descriptor number...
@@ -13066,6 +16327,55 @@ if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
     fi
 fi
 
+: see if strerror_r exists
+set strerror_r d_strerror_r
+eval $inlibc
+case "$d_strerror_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
+       case "$d_strerror_r_proto:$usethreads" in
+       ":define")      d_strerror_r_proto=define
+               set d_strerror_r_proto strerror_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_strerror_r_proto" in
+       define)
+       case "$strerror_r_proto" in
+       ''|0) try='int strerror_r(int, char*, size_t);'
+       ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
+       esac
+       case "$strerror_r_proto" in
+       ''|0) try='int strerror_r(int, char*, int);'
+       ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
+       esac
+       case "$strerror_r_proto" in
+       ''|0) try='char* strerror_r(int, char*, size_t);'
+       ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
+       esac
+       case "$strerror_r_proto" in
+       ''|0)   d_strerror_r=undef
+               strerror_r_proto=0
+               echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
+       * )     case "$strerror_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "strerror_r has no prototype, not using it." >&4 ;;
+               esac
+               d_strerror_r=undef
+               strerror_r_proto=0
+               ;;
+       esac
+       ;;
+*)     strerror_r_proto=0
+       ;;
+esac
+
 : see if strftime exists
 set strftime d_strftime
 eval $inlibc
@@ -13366,6 +16676,24 @@ echo " "
 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
 eval $hasproto
 
+: see if time exists
+echo " "
+if test "X$d_time" = X -o X"$timetype" = X; then
+    if set time val -f d_time; eval $csym; $val; then
+               echo 'time() found.' >&4
+               val="$define"
+               rp="What is the type returned by time() on this system?"
+               set time_t timetype long stdio.h sys/types.h
+               eval $typedef_ask
+    else
+               echo 'time() not found, hope that will do.' >&4
+               val="$undef"
+               timetype='int';
+    fi
+    set d_time
+    eval $setvar
+fi
+
 : see if this is a sys/times.h system
 set sys/times.h i_systimes
 eval $inhdr
@@ -13388,10 +16716,100 @@ else
        clocktype='int'
 fi
 
+: see if tmpnam_r exists
+set tmpnam_r d_tmpnam_r
+eval $inlibc
+case "$d_tmpnam_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h "
+       case "$d_tmpnam_r_proto:$usethreads" in
+       ":define")      d_tmpnam_r_proto=define
+               set d_tmpnam_r_proto tmpnam_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_tmpnam_r_proto" in
+       define)
+       case "$tmpnam_r_proto" in
+       ''|0) try='char* tmpnam_r(char*);'
+       ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
+       esac
+       case "$tmpnam_r_proto" in
+       ''|0)   d_tmpnam_r=undef
+               tmpnam_r_proto=0
+               echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
+       * )     case "$tmpnam_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
+               esac
+               d_tmpnam_r=undef
+               tmpnam_r_proto=0
+               ;;
+       esac
+       ;;
+*)     tmpnam_r_proto=0
+       ;;
+esac
+
 : see if truncate exists
 set truncate d_truncate
 eval $inlibc
 
+: see if ttyname_r exists
+set ttyname_r d_ttyname_r
+eval $inlibc
+case "$d_ttyname_r" in
+"$define")
+       hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
+       case "$d_ttyname_r_proto:$usethreads" in
+       ":define")      d_ttyname_r_proto=define
+               set d_ttyname_r_proto ttyname_r $hdrs
+               eval $hasproto ;;
+       *)      ;;
+       esac
+       case "$d_ttyname_r_proto" in
+       define)
+       case "$ttyname_r_proto" in
+       ''|0) try='int ttyname_r(int, char*, size_t);'
+       ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
+       esac
+       case "$ttyname_r_proto" in
+       ''|0) try='int ttyname_r(int, char*, int);'
+       ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
+       esac
+       case "$ttyname_r_proto" in
+       ''|0) try='char* ttyname_r(int, char*, int);'
+       ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
+       esac
+       case "$ttyname_r_proto" in
+       ''|0)   d_ttyname_r=undef
+               ttyname_r_proto=0
+               echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
+       * )     case "$ttyname_r_proto" in
+               REENTRANT_PROTO*) ;;
+               *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
+               esac
+               echo "Prototype: $try" ;;
+       esac
+       ;;
+       *)      case "$usethreads" in
+               define) echo "ttyname_r has no prototype, not using it." >&4 ;;
+               esac
+               d_ttyname_r=undef
+               ttyname_r_proto=0
+               ;;
+       esac
+       ;;
+*)     ttyname_r_proto=0
+       ;;
+esac
+
 : see if tzname[] exists
 echo " "
 if set tzname val -a d_tzname; eval $csym; $val; then
@@ -13411,7 +16829,7 @@ case "$multiarch" in
 ''|[nN]*) multiarch="$undef" ;;
 esac
 
-: check for ordering of bytes in a long
+: check for ordering of bytes in a UV
 echo " "
 case "$usecrosscompile$multiarch" in
 *$define*)
@@ -13434,21 +16852,27 @@ 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'
+               $cat >try.c <<EOCP
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#include <sys/types.h>
+typedef $uvtype UV;
 int main()
 {
        int i;
        union {
-               unsigned long l;
-               char c[sizeof(long)];
+               UV l;
+               char c[$uvsize];
        } u;
 
-       if (sizeof(long) > 4)
-               u.l = (0x08070605L << 32) | 0x04030201L;
+       if ($uvsize > 4)
+               u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
        else
-               u.l = 0x04030201L;
-       for (i = 0; i < sizeof(long); i++)
+               u.l = (UV)0x04030201;
+       for (i = 0; i < $uvsize; i++)
                printf("%c", u.c[i]+'0');
        printf("\n");
        exit(0);
@@ -13475,7 +16899,7 @@ EOM
                fi
                case "$xxx_prompt" in
                y)
-                       rp="What is the order of bytes in a long?"
+                       rp="What is the order of bytes in $uvtype?"
                        . ./myread
                        byteorder="$ans"
                        ;;
@@ -13495,8 +16919,11 @@ Checking to see whether you can access character data unalignedly...
 EOM
 case "$d_u32align" in
 '')   $cat >try.c <<EOCP
-$cat >try.c <<EOCP
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 #define U32 $u32type
 #define BYTEORDER 0x$byteorder
 #define U8 $u8type
@@ -13506,7 +16933,7 @@ $signal_t bletch(s) int s; { exit(4); }
 #endif
 int main() {
 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
-    U8 *buf = (U8*)"\0\0\0\1\0\0\0\0";
+    U8 buf[8];
     U32 *up;
     int i;
 
@@ -13521,6 +16948,15 @@ int main() {
     signal(SIGBUS, bletch);
 #endif
 
+    buf[0] = 0;
+    buf[1] = 0;
+    buf[2] = 0;
+    buf[3] = 1;
+    buf[5] = 0;
+    buf[6] = 0;
+    buf[7] = 0;
+    buf[8] = 1;
+
     for (i = 0; i < 4; i++) {
        up = (U32*)(buf + i);
        if (! ((*up == 1 << (8*i)) ||   /* big-endian */
@@ -13795,9 +17231,9 @@ esac
 : set the base revision
 baserev=5.0
 
-: how do we catenate cpp tokens here?
+: how do we concatenate cpp tokens here?
 echo " "
-echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
+echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
 $cat >cpp_stuff.c <<'EOCP'
 #define RCAT(a,b)a/**/b
 #define ACAT(a,b)a ## b
@@ -13816,8 +17252,8 @@ elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
        cpp_stuff=1
 else
        $cat >&4 <<EOM
-Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
-to have to edit the values of CAT[2-5] in config.h...
+Hmm, I don't seem to be able to concatenate tokens with your cpp.
+You're going to have to edit the values of CAT[2-5] in config.h...
 EOM
        cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
 fi
@@ -13839,6 +17275,10 @@ $define)
 #endif
 #include <sys/types.h>
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 #include <db.h>
 int main(int argc, char *argv[])
 {
@@ -14177,6 +17617,10 @@ sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
 esac
 $cat >>try.c <<EOCP
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 #$i_unistd I_UNISTD
 #ifdef I_UNISTD
 # include <unistd.h>
@@ -14493,6 +17937,10 @@ echo "Checking the size of $zzz..." >&4
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 int main() {
     printf("%d\n", (int)sizeof($gidtype));
     exit(0);
@@ -15022,47 +18470,6 @@ EOCP
        ;;
 esac
 
-: define a fucntion to check prototypes
-$cat > protochk <<EOSH
-$startsh
-cc="$cc"
-optimize="$optimize"
-ccflags="$ccflags"
-prototype="$prototype"
-define="$define"
-rm=$rm
-EOSH
-
-$cat >> protochk <<'EOSH'
-
-$rm -f try.c
-foo="$1"
-shift
-while test $# -ge 2; do
-       case "$1" in
-               $define) echo "#include <$2>" >> try.c ;;
-               literal) echo "$2" >> try.c ;;
-       esac
-    shift 2
-done
-test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
-cat >> try.c <<'EOCP'
-#ifdef CAN_PROTOTYPE
-#define        _(args) args
-#else
-#define        _(args) ()
-#endif
-EOCP
-echo "$foo" >> try.c
-echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
-$cc $optimize $ccflags -c try.c > /dev/null 2>&1
-status=$?
-$rm -f try.[co]
-exit $status
-EOSH
-chmod +x protochk
-$eunicefix protochk
-
 : see what type is used for size_t
 rp="What is the type used for the length parameter for string functions?"
 set size_t sizetype 'unsigned int' stdio.h sys/types.h
@@ -15196,6 +18603,7 @@ EOM
        esac
 fi
 : locate the preferred pager for this system
+fn=f/
 case "$pager" in
 '')
        dflt=''
@@ -15215,10 +18623,14 @@ case "$pager" in
        '') dflt=/usr/ucb/more;;
        esac
        ;;
-*) dflt="$pager";;
+*)     dflt="$pager"
+       : Instruct ./getfile to trust the hinted or previous pager value,
+       : even if it does not begin with a slash.  For example, on os2,
+       : pager might be cmd /c more.  See comments in UU/getfile.
+       fn="f/($pager)"
+       ;;
 esac
 echo " "
-fn=f/
 rp='What pager is used on your system?'
 . ./getfile
 pager="$ans"
@@ -15229,10 +18641,7 @@ set pid_t pidtype int stdio.h sys/types.h
 eval $typedef_ask
 
 : Find earliest binary compatible site_perl subdirectory perl can use.
-case "$bincompat5005" in
-"$define") xs_apiversion='5.005' ;;
-*) xs_apiversion=$version ;;   # The current site_perl version.
-esac
+xs_apiversion=$version # The current site_perl version.
 : Find earliest pure perl site_perl subdirectory perl can use.
 : The versioned directories started at 5.005.
 pm_apiversion='5.005'
@@ -15242,7 +18651,11 @@ echo " "
 echo "Checking how to generate random libraries on your machine..." >&4
 echo 'int bar1() { return bar2(); }' > bar1.c
 echo 'int bar2() { return 2; }' > bar2.c
-$cat > foo.c <<'EOP'
+$cat > foo.c <<EOP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 int main() { printf("%d\n", bar1()); exit(0); }
 EOP
 $cc $ccflags -c bar1.c >/dev/null 2>&1
@@ -15332,7 +18745,8 @@ esac
 
 : check for the select 'width'
 case "$selectminbits" in
-'') case "$d_select" in
+'') safebits=`expr $ptrsize \* 8`
+    case "$d_select" in
        $define)
                $cat <<EOM
 
@@ -15364,25 +18778,31 @@ EOM
 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
 #endif
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 $selecttype b;
 #define S sizeof(*(b))
 #define MINBITS        64
 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
 #define NBITS  (NBYTES * 8)
 int main() {
-    char s[NBYTES];
+    char *s = malloc(NBYTES);
     struct timeval t;
     int i;
     FILE* fp;
     int fd;
 
+    if (!s)
+       exit(1);
     fclose(stdin);
     fp = fopen("try.c", "r");
     if (fp == 0)
-      exit(1);
+      exit(2);
     fd = fileno(fp);
     if (fd < 0)
-      exit(2);
+      exit(3);
     b = ($selecttype)s;
     for (i = 0; i < NBITS; i++)
        FD_SET(i, b);
@@ -15390,6 +18810,7 @@ int main() {
     t.tv_usec = 0;
     select(fd + 1, b, 0, 0, &t);
     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
+    free(s);
     printf("%d\n", i + 1);
     return 0;
 }
@@ -15400,10 +18821,10 @@ EOCP
                        case "$selectminbits" in
                        '')     cat >&4 <<EOM
 Cannot figure out on how many bits at a time your select() operates.
-I'll play safe and guess it is 32 bits.
+I'll play safe and guess it is $safebits bits.
 EOM
-                               selectminbits=32
-                               bits="32 bits"
+                               selectminbits=$safebits
+                               bits="$safebits bits"
                                ;;
                        1)      bits="1 bit" ;;
                        *)      bits="$selectminbits bits" ;;
@@ -15412,7 +18833,8 @@ EOM
                else
                        rp='What is the minimum number of bits your select() operates on?'
                        case "$byteorder" in
-                       1234|12345678)  dflt=32 ;;
+                       12345678)       dflt=64 ;;
+                       1234)           dflt=32 ;;
                        *)              dflt=1  ;;
                        esac
                        . ./myread
@@ -15422,7 +18844,7 @@ EOM
                $rm -f try.* try
                ;;
        *)      : no select, so pick a harmless default
-               selectminbits='32'
+               selectminbits=$safebits
                ;;
        esac
        ;;
@@ -15469,9 +18891,13 @@ 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'
+$cat > signal.c <<EOCP
 #include <sys/types.h>
 #include <signal.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 #include <stdio.h>
 int main() {
 
@@ -15546,7 +18972,7 @@ END {
 $cat >signal.awk <<'EOP'
 BEGIN { ndups = 0 }
 $1 ~ /^NSIG$/ { nsig = $2 }
-($1 !~ /^NSIG$/) && (NF == 2) {
+($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
     if ($2 > maxsig) { maxsig = $2 }
     if (sig_name[$2]) {
        dup_name[ndups] = $1
@@ -15588,7 +19014,7 @@ $cat >>signal_cmd <<'EOS'
 
 set signal
 if eval $compile_ok; then
-       $run ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
+       $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
 else
        echo "(I can't seem be able to compile the whole test program)" >&4
        echo "(I'll try it in little pieces.)" >&4
@@ -15622,7 +19048,7 @@ EOCP
        done
        if $test -s signal.ls1; then
                $cat signal.nsg signal.ls1 |
-                       $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
+                       $sort -n | $uniq | $awk -f signal.awk >signal.lst
        fi
 
 fi
@@ -15699,6 +19125,10 @@ echo "Checking the size of $zzz..." >&4
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 int main() {
     printf("%d\n", (int)sizeof($sizetype));
     exit(0);
@@ -15802,6 +19232,10 @@ eval $typedef
 dflt="$ssizetype"
 $cat > try.c <<EOM
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 #include <sys/types.h>
 #define Size_t $sizetype
 #define SSize_t $dflt
@@ -15851,24 +19285,6 @@ $rm -f stdioh
 
 
 
-: see if time exists
-echo " "
-if test "X$d_time" = X -o X"$timetype" = X; then
-    if set time val -f d_time; eval $csym; $val; then
-               echo 'time() found.' >&4
-               val="$define"
-               rp="What is the type returned by time() on this system?"
-               set time_t timetype long stdio.h sys/types.h
-               eval $typedef_ask
-    else
-               echo 'time() not found, hope that will do.' >&4
-               val="$undef"
-               timetype='int';
-    fi
-    set d_time
-    eval $setvar
-fi
-
 : see what type uids are declared as in the kernel
 echo " "
 echo "Looking for the type for user ids returned by getuid()."
@@ -15902,6 +19318,10 @@ echo "Checking the size of $zzz..." >&4
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
 int main() {
     printf("%d\n", (int)sizeof($uidtype));
     exit(0);
@@ -16049,10 +19469,6 @@ esac
 set libutil.h i_libutil
 eval $inhdr
 
-: see if locale.h is available
-set locale.h i_locale
-eval $inhdr
-
 : see if mach cthreads are available
 if test "X$usethreads" = "X$define"; then
        set mach/cthreads.h i_machcthr
@@ -16282,7 +19698,7 @@ for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
 do
        case "\$i" in
        -D*) echo "\$i" | $sed 's/^-D//';;
-       -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
+       -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
        esac
 done
 $rm -f try.c
@@ -16399,10 +19815,6 @@ set i_termio; eval $setvar
 val=$val2; set i_sgtty; eval $setvar
 val=$val3; set i_termios; eval $setvar
 
-: see if this is a shadow.h system
-set shadow.h i_shadow
-eval $inhdr
-
 : see if stddef is available
 set stddef.h i_stddef
 eval $inhdr
@@ -16608,7 +20020,7 @@ for xxx in $known_extensions ; do
                case "$i_ndbm" in
                $define)
                    case "$osname-$use64bitint" in
-                   cygwin-*|hpux-define)
+                   hpux-define)
                        case "$libs" in
                        *-lndbm*) avail_ext="$avail_ext $xxx" ;;
                        esac
@@ -16622,7 +20034,7 @@ for xxx in $known_extensions ; do
                case "${i_dbm}${i_rpcsvcdbm}" in
                *"${define}"*)
                    case "$osname-$use64bitint" in
-                   cygwin-*|hpux-define)
+                   hpux-define)
                        case "$libs" in
                        *-ldbm*) avail_ext="$avail_ext $xxx" ;;
                        esac
@@ -16666,14 +20078,33 @@ for xxx in $known_extensions ; do
                         esac
                esac
                ;;
-       threads|threads/shared)
-                case "$usethreads" in
-                true|$define|y)
-                        case "$useithreads" in
-                        $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
-                        esac
+       XS/APItest|xs/apitest)
+               # This is just for testing.  Skip it unless we have dynamic loading.
+
+               case "$usedl" in
+               $define) avail_ext="$avail_ext $xxx" ;;
+               esac
+               ;;
+       XS/Typemap|xs/typemap)
+               # This is just for testing.  Skip it unless we have dynamic loading.
+               case "$usedl" in
+               $define) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
+       threads|threads/shared)
+               # threads and threads::shared are special cases.
+               # To stop people from asking "Perl 5.8.0 was supposed
+               # to have this new fancy threads implementation but my
+               # perl doesn't have it" and from people trying to
+               # (re)install the threads module using CPAN.pm and
+               # CPAN.pm then offering to reinstall Perl 5.8.0,
+               # the threads.pm and threads/shared.pm will always be
+               # there, croaking informatively ("you need to rebuild
+               # all of Perl with threads, sorry") when threads haven't
+               # been compiled in.
+               # --jhi
+               avail_ext="$avail_ext $xxx"
+               ;;
        IPC/SysV|ipc/sysv)
                : XXX Do we need a useipcsysv variable here
                case "${d_msg}${d_sem}${d_shm}" in 
@@ -16689,6 +20120,39 @@ set X $avail_ext
 shift
 avail_ext="$*"
 
+case "$onlyextensions" in
+'') ;;
+*)  keepextensions=''
+    echo "You have requested that only certains extensions be included..." >&4
+    for i in $onlyextensions; do
+        case " $avail_ext " in
+        *" $i "*)
+            echo "Keeping extension $i."
+            keepextensions="$keepextensions $i"
+            ;;
+        *) echo "Ignoring extension $i." ;;
+        esac
+    done
+    avail_ext="$keepextensions"
+    ;;
+esac
+
+case "$noextensions" in
+'') ;;
+*)  keepextensions=''
+    echo "You have requested that certain extensions be ignored..." >&4
+    for i in $avail_ext; do
+        case " $noextensions " in
+        *" $i "*) echo "Ignoring extension $i." ;;
+        *) echo "Keeping extension $i.";
+           keepextensions="$keepextensions $i"
+           ;;
+        esac
+    done
+    avail_ext="$keepextensions"
+    ;;
+esac
+
 : Now see which nonxs extensions are supported on this system.
 : For now assume all are.
 nonxs_ext=''
@@ -16714,7 +20178,19 @@ Note that DynaLoader is always built and need not be mentioned here.
 
 EOM
        case "$dynamic_ext" in
-       '') dflt="$avail_ext" ;;
+       '')
+               : Exclude those listed in static_ext
+               dflt=''
+               for xxx in $avail_ext; do
+                       case " $static_ext " in
+                       *" $xxx "*) ;;
+                       *) dflt="$dflt $xxx" ;;
+                       esac
+               done
+               set X $dflt
+               shift
+               dflt="$*"
+               ;;
        *)      dflt="$dynamic_ext"
                # Perhaps we are reusing an old out-of-date config.sh.
                case "$hint" in
@@ -16810,11 +20286,42 @@ EOM
        esac
        ;;
 esac
+#        
+# Encode is a special case.  If we are building Encode as a static
+# extension, we need to explicitly list its subextensions as well.
+# For other nested extensions, this is handled automatically by
+# the appropriate Makefile.PL.
+case " $static_ext " in
+       *" Encode "*) # Add the subextensions of Encode
+       cd "$rsrc/ext"
+       for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
+               static_ext="$static_ext Encode/$xxx"
+       done
+       cd "$tdir"
+       ;;
+esac
 
 set X $dynamic_ext $static_ext $nonxs_ext
 shift
 extensions="$*"
 
+# Sanity check:  We require an extension suitable for use with
+# AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
+# should show up as failures in the test suite, but it's helpful to
+# catch them now.) The 'extensions' list is normally sorted
+# alphabetically, so we need to accept either
+#    DB_File ... Fcntl ... IO  ....
+# or something like
+#    Fcntl ... NDBM_File ... IO  ....
+case " $extensions"  in
+*"_File "*" Fcntl "*" IO "*) ;; # DB_File
+*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
+*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
+*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
+   echo "WARNING: The Perl you are building will be quite crippled." >& 4
+   ;;
+esac
+
 : Remove libraries needed only for extensions
 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
 : The exception is SunOS 4.x, which needs them.
@@ -16936,11 +20443,11 @@ archlibexp='$archlibexp'
 archname64='$archname64'
 archname='$archname'
 archobjs='$archobjs'
+asctime_r_proto='$asctime_r_proto'
 awk='$awk'
 baserev='$baserev'
 bash='$bash'
 bin='$bin'
-bincompat5005='$bincompat5005'
 binexp='$binexp'
 bison='$bison'
 byacc='$byacc'
@@ -16978,8 +20485,11 @@ cppminus='$cppminus'
 cpprun='$cpprun'
 cppstdin='$cppstdin'
 cppsymbols='$cppsymbols'
+crypt_r_proto='$crypt_r_proto'
 cryptlib='$cryptlib'
 csh='$csh'
+ctermid_r_proto='$ctermid_r_proto'
+ctime_r_proto='$ctime_r_proto'
 d_Gconvert='$d_Gconvert'
 d_PRIEUldbl='$d_PRIEUldbl'
 d_PRIFUldbl='$d_PRIFUldbl'
@@ -16997,14 +20507,15 @@ d_SCNfldbl='$d_SCNfldbl'
 d__fwalk='$d__fwalk'
 d_access='$d_access'
 d_accessx='$d_accessx'
+d_aintl='$d_aintl'
 d_alarm='$d_alarm'
 d_archlib='$d_archlib'
+d_asctime_r='$d_asctime_r'
 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'
@@ -17019,8 +20530,12 @@ d_class='$d_class'
 d_closedir='$d_closedir'
 d_cmsghdr_s='$d_cmsghdr_s'
 d_const='$d_const'
+d_copysignl='$d_copysignl'
 d_crypt='$d_crypt'
+d_crypt_r='$d_crypt_r'
 d_csh='$d_csh'
+d_ctermid_r='$d_ctermid_r'
+d_ctime_r='$d_ctime_r'
 d_cuserid='$d_cuserid'
 d_dbl_dig='$d_dbl_dig'
 d_dbminitproto='$d_dbminitproto'
@@ -17031,17 +20546,25 @@ d_dlerror='$d_dlerror'
 d_dlopen='$d_dlopen'
 d_dlsymun='$d_dlsymun'
 d_dosuid='$d_dosuid'
+d_drand48_r='$d_drand48_r'
 d_drand48proto='$d_drand48proto'
 d_dup2='$d_dup2'
 d_eaccess='$d_eaccess'
 d_endgrent='$d_endgrent'
+d_endgrent_r='$d_endgrent_r'
 d_endhent='$d_endhent'
+d_endhostent_r='$d_endhostent_r'
 d_endnent='$d_endnent'
+d_endnetent_r='$d_endnetent_r'
 d_endpent='$d_endpent'
+d_endprotoent_r='$d_endprotoent_r'
 d_endpwent='$d_endpwent'
+d_endpwent_r='$d_endpwent_r'
 d_endsent='$d_endsent'
+d_endservent_r='$d_endservent_r'
 d_eofnblk='$d_eofnblk'
 d_eunice='$d_eunice'
+d_faststdio='$d_faststdio'
 d_fchdir='$d_fchdir'
 d_fchmod='$d_fchmod'
 d_fchown='$d_fchown'
@@ -17076,19 +20599,29 @@ d_getcwd='$d_getcwd'
 d_getespwnam='$d_getespwnam'
 d_getfsstat='$d_getfsstat'
 d_getgrent='$d_getgrent'
+d_getgrent_r='$d_getgrent_r'
+d_getgrgid_r='$d_getgrgid_r'
+d_getgrnam_r='$d_getgrnam_r'
 d_getgrps='$d_getgrps'
 d_gethbyaddr='$d_gethbyaddr'
 d_gethbyname='$d_gethbyname'
 d_gethent='$d_gethent'
 d_gethname='$d_gethname'
+d_gethostbyaddr_r='$d_gethostbyaddr_r'
+d_gethostbyname_r='$d_gethostbyname_r'
+d_gethostent_r='$d_gethostent_r'
 d_gethostprotos='$d_gethostprotos'
 d_getitimer='$d_getitimer'
 d_getlogin='$d_getlogin'
+d_getlogin_r='$d_getlogin_r'
 d_getmnt='$d_getmnt'
 d_getmntent='$d_getmntent'
 d_getnbyaddr='$d_getnbyaddr'
 d_getnbyname='$d_getnbyname'
 d_getnent='$d_getnent'
+d_getnetbyaddr_r='$d_getnetbyaddr_r'
+d_getnetbyname_r='$d_getnetbyname_r'
+d_getnetent_r='$d_getnetent_r'
 d_getnetprotos='$d_getnetprotos'
 d_getpagsz='$d_getpagsz'
 d_getpbyname='$d_getpbyname'
@@ -17099,19 +20632,31 @@ d_getpgrp2='$d_getpgrp2'
 d_getpgrp='$d_getpgrp'
 d_getppid='$d_getppid'
 d_getprior='$d_getprior'
+d_getprotobyname_r='$d_getprotobyname_r'
+d_getprotobynumber_r='$d_getprotobynumber_r'
+d_getprotoent_r='$d_getprotoent_r'
 d_getprotoprotos='$d_getprotoprotos'
 d_getprpwnam='$d_getprpwnam'
 d_getpwent='$d_getpwent'
+d_getpwent_r='$d_getpwent_r'
+d_getpwnam_r='$d_getpwnam_r'
+d_getpwuid_r='$d_getpwuid_r'
 d_getsbyname='$d_getsbyname'
 d_getsbyport='$d_getsbyport'
 d_getsent='$d_getsent'
+d_getservbyname_r='$d_getservbyname_r'
+d_getservbyport_r='$d_getservbyport_r'
+d_getservent_r='$d_getservent_r'
 d_getservprotos='$d_getservprotos'
 d_getspnam='$d_getspnam'
+d_getspnam_r='$d_getspnam_r'
 d_gettimeod='$d_gettimeod'
+d_gmtime_r='$d_gmtime_r'
 d_gnulibc='$d_gnulibc'
 d_grpasswd='$d_grpasswd'
 d_hasmntopt='$d_hasmntopt'
 d_htonl='$d_htonl'
+d_ilogbl='$d_ilogbl'
 d_index='$d_index'
 d_inetaton='$d_inetaton'
 d_int64_t='$d_int64_t'
@@ -17124,6 +20669,7 @@ d_killpg='$d_killpg'
 d_lchown='$d_lchown'
 d_ldbl_dig='$d_ldbl_dig'
 d_link='$d_link'
+d_localtime_r='$d_localtime_r'
 d_locconv='$d_locconv'
 d_lockf='$d_lockf'
 d_longdbl='$d_longdbl'
@@ -17148,6 +20694,7 @@ d_mktime='$d_mktime'
 d_mmap='$d_mmap'
 d_modfl='$d_modfl'
 d_modfl_pow32_bug='$d_modfl_pow32_bug'
+d_modflproto='$d_modflproto'
 d_mprotect='$d_mprotect'
 d_msg='$d_msg'
 d_msg_ctrunc='$d_msg_ctrunc'
@@ -17166,7 +20713,6 @@ d_mymalloc='$d_mymalloc'
 d_nice='$d_nice'
 d_nl_langinfo='$d_nl_langinfo'
 d_nv_preserves_uv='$d_nv_preserves_uv'
-d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
 d_off64_t='$d_off64_t'
 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
 d_oldpthreads='$d_oldpthreads'
@@ -17181,6 +20727,7 @@ d_poll='$d_poll'
 d_portable='$d_portable'
 d_procselfexe='$d_procselfexe'
 d_pthread_atfork='$d_pthread_atfork'
+d_pthread_attr_setscope='$d_pthread_attr_setscope'
 d_pthread_yield='$d_pthread_yield'
 d_pwage='$d_pwage'
 d_pwchange='$d_pwchange'
@@ -17192,7 +20739,10 @@ d_pwpasswd='$d_pwpasswd'
 d_pwquota='$d_pwquota'
 d_qgcvt='$d_qgcvt'
 d_quad='$d_quad'
+d_random_r='$d_random_r'
+d_readdir64_r='$d_readdir64_r'
 d_readdir='$d_readdir'
+d_readdir_r='$d_readdir_r'
 d_readlink='$d_readlink'
 d_readv='$d_readv'
 d_recvmsg='$d_recvmsg'
@@ -17203,6 +20753,7 @@ d_safebcpy='$d_safebcpy'
 d_safemcpy='$d_safemcpy'
 d_sanemcmp='$d_sanemcmp'
 d_sbrkproto='$d_sbrkproto'
+d_scalbnl='$d_scalbnl'
 d_sched_yield='$d_sched_yield'
 d_scm_rights='$d_scm_rights'
 d_seekdir='$d_seekdir'
@@ -17217,19 +20768,25 @@ d_sendmsg='$d_sendmsg'
 d_setegid='$d_setegid'
 d_seteuid='$d_seteuid'
 d_setgrent='$d_setgrent'
+d_setgrent_r='$d_setgrent_r'
 d_setgrps='$d_setgrps'
 d_sethent='$d_sethent'
+d_sethostent_r='$d_sethostent_r'
 d_setitimer='$d_setitimer'
 d_setlinebuf='$d_setlinebuf'
 d_setlocale='$d_setlocale'
+d_setlocale_r='$d_setlocale_r'
 d_setnent='$d_setnent'
+d_setnetent_r='$d_setnetent_r'
 d_setpent='$d_setpent'
 d_setpgid='$d_setpgid'
 d_setpgrp2='$d_setpgrp2'
 d_setpgrp='$d_setpgrp'
 d_setprior='$d_setprior'
 d_setproctitle='$d_setproctitle'
+d_setprotoent_r='$d_setprotoent_r'
 d_setpwent='$d_setpwent'
+d_setpwent_r='$d_setpwent_r'
 d_setregid='$d_setregid'
 d_setresgid='$d_setresgid'
 d_setresuid='$d_setresuid'
@@ -17237,6 +20794,7 @@ d_setreuid='$d_setreuid'
 d_setrgid='$d_setrgid'
 d_setruid='$d_setruid'
 d_setsent='$d_setsent'
+d_setservent_r='$d_setservent_r'
 d_setsid='$d_setsid'
 d_setvbuf='$d_setvbuf'
 d_sfio='$d_sfio'
@@ -17256,6 +20814,8 @@ d_socklen_t='$d_socklen_t'
 d_sockpair='$d_sockpair'
 d_socks5_init='$d_socks5_init'
 d_sqrtl='$d_sqrtl'
+d_srand48_r='$d_srand48_r'
+d_srandom_r='$d_srandom_r'
 d_sresgproto='$d_sresgproto'
 d_sresuproto='$d_sresuproto'
 d_statblks='$d_statblks'
@@ -17274,6 +20834,7 @@ d_strcoll='$d_strcoll'
 d_strctcpy='$d_strctcpy'
 d_strerrm='$d_strerrm'
 d_strerror='$d_strerror'
+d_strerror_r='$d_strerror_r'
 d_strftime='$d_strftime'
 d_strtod='$d_strtod'
 d_strtol='$d_strtol'
@@ -17298,7 +20859,11 @@ d_telldir='$d_telldir'
 d_telldirproto='$d_telldirproto'
 d_time='$d_time'
 d_times='$d_times'
+d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
+d_tm_tm_zone='$d_tm_tm_zone'
+d_tmpnam_r='$d_tmpnam_r'
 d_truncate='$d_truncate'
+d_ttyname_r='$d_ttyname_r'
 d_tzname='$d_tzname'
 d_u32align='$d_u32align'
 d_ualarm='$d_ualarm'
@@ -17312,6 +20877,7 @@ d_ustat='$d_ustat'
 d_vendorarch='$d_vendorarch'
 d_vendorbin='$d_vendorbin'
 d_vendorlib='$d_vendorlib'
+d_vendorscript='$d_vendorscript'
 d_vfork='$d_vfork'
 d_void_closedir='$d_void_closedir'
 d_voidsig='$d_voidsig'
@@ -17336,12 +20902,19 @@ dlext='$dlext'
 dlsrc='$dlsrc'
 doublesize='$doublesize'
 drand01='$drand01'
+drand48_r_proto='$drand48_r_proto'
 dynamic_ext='$dynamic_ext'
 eagain='$eagain'
 ebcdic='$ebcdic'
 echo='$echo'
 egrep='$egrep'
 emacs='$emacs'
+endgrent_r_proto='$endgrent_r_proto'
+endhostent_r_proto='$endhostent_r_proto'
+endnetent_r_proto='$endnetent_r_proto'
+endprotoent_r_proto='$endprotoent_r_proto'
+endpwent_r_proto='$endpwent_r_proto'
+endservent_r_proto='$endservent_r_proto'
 eunicefix='$eunicefix'
 exe_ext='$exe_ext'
 expr='$expr'
@@ -17359,14 +20932,37 @@ from='$from'
 full_ar='$full_ar'
 full_csh='$full_csh'
 full_sed='$full_sed'
+gccansipedantic='$gccansipedantic'
 gccosandvers='$gccosandvers'
 gccversion='$gccversion'
+getgrent_r_proto='$getgrent_r_proto'
+getgrgid_r_proto='$getgrgid_r_proto'
+getgrnam_r_proto='$getgrnam_r_proto'
+gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
+gethostbyname_r_proto='$gethostbyname_r_proto'
+gethostent_r_proto='$gethostent_r_proto'
+getlogin_r_proto='$getlogin_r_proto'
+getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
+getnetbyname_r_proto='$getnetbyname_r_proto'
+getnetent_r_proto='$getnetent_r_proto'
+getprotobyname_r_proto='$getprotobyname_r_proto'
+getprotobynumber_r_proto='$getprotobynumber_r_proto'
+getprotoent_r_proto='$getprotoent_r_proto'
+getpwent_r_proto='$getpwent_r_proto'
+getpwnam_r_proto='$getpwnam_r_proto'
+getpwuid_r_proto='$getpwuid_r_proto'
+getservbyname_r_proto='$getservbyname_r_proto'
+getservbyport_r_proto='$getservbyport_r_proto'
+getservent_r_proto='$getservent_r_proto'
+getspnam_r_proto='$getspnam_r_proto'
 gidformat='$gidformat'
 gidsign='$gidsign'
 gidsize='$gidsize'
 gidtype='$gidtype'
 glibpth='$glibpth'
 gmake='$gmake'
+gmtime_r_proto='$gmtime_r_proto'
+gnulibc_version='$gnulibc_version'
 grep='$grep'
 groupcat='$groupcat'
 groupstype='$groupstype'
@@ -17375,6 +20971,10 @@ h_fcntl='$h_fcntl'
 h_sysfile='$h_sysfile'
 hint='$hint'
 hostcat='$hostcat'
+html1dir='$html1dir'
+html1direxp='$html1direxp'
+html3dir='$html3dir'
+html3direxp='$html3direxp'
 i16size='$i16size'
 i16type='$i16type'
 i32size='$i32size'
@@ -17385,6 +20985,7 @@ i8size='$i8size'
 i8type='$i8type'
 i_arpainet='$i_arpainet'
 i_bsdioctl='$i_bsdioctl'
+i_crypt='$i_crypt'
 i_db='$i_db'
 i_dbm='$i_dbm'
 i_dirent='$i_dirent'
@@ -17471,6 +21072,8 @@ incpath='$incpath'
 inews='$inews'
 installarchlib='$installarchlib'
 installbin='$installbin'
+installhtml1dir='$installhtml1dir'
+installhtml3dir='$installhtml3dir'
 installman1dir='$installman1dir'
 installman3dir='$installman3dir'
 installprefix='$installprefix'
@@ -17479,12 +21082,22 @@ installprivlib='$installprivlib'
 installscript='$installscript'
 installsitearch='$installsitearch'
 installsitebin='$installsitebin'
+installsitehtml1dir='$installsitehtml1dir'
+installsitehtml3dir='$installsitehtml3dir'
 installsitelib='$installsitelib'
+installsiteman1dir='$installsiteman1dir'
+installsiteman3dir='$installsiteman3dir'
+installsitescript='$installsitescript'
 installstyle='$installstyle'
 installusrbinperl='$installusrbinperl'
 installvendorarch='$installvendorarch'
 installvendorbin='$installvendorbin'
+installvendorhtml1dir='$installvendorhtml1dir'
+installvendorhtml3dir='$installvendorhtml3dir'
 installvendorlib='$installvendorlib'
+installvendorman1dir='$installvendorman1dir'
+installvendorman3dir='$installvendorman3dir'
+installvendorscript='$installvendorscript'
 intsize='$intsize'
 issymlink='$issymlink'
 ivdformat='$ivdformat'
@@ -17514,6 +21127,7 @@ lint='$lint'
 lkflags='$lkflags'
 ln='$ln'
 lns='$lns'
+localtime_r_proto='$localtime_r_proto'
 locincpth='$locincpth'
 loclibpth='$loclibpth'
 longdblsize='$longdblsize'
@@ -17538,6 +21152,7 @@ man3dir='$man3dir'
 man3direxp='$man3direxp'
 man3ext='$man3ext'
 mips_type='$mips_type'
+mistrustnm='$mistrustnm'
 mkdir='$mkdir'
 mmaptype='$mmaptype'
 modetype='$modetype'
@@ -17562,6 +21177,7 @@ nroff='$nroff'
 nvEUformat='$nvEUformat'
 nvFUformat='$nvFUformat'
 nvGUformat='$nvGUformat'
+nv_preserves_uv_bits='$nv_preserves_uv_bits'
 nveformat='$nveformat'
 nvfformat='$nvfformat'
 nvgformat='$nvgformat'
@@ -17604,9 +21220,12 @@ quadkind='$quadkind'
 quadtype='$quadtype'
 randbits='$randbits'
 randfunc='$randfunc'
+random_r_proto='$random_r_proto'
 randseedtype='$randseedtype'
 ranlib='$ranlib'
 rd_nodata='$rd_nodata'
+readdir64_r_proto='$readdir64_r_proto'
+readdir_r_proto='$readdir_r_proto'
 revision='$revision'
 rm='$rm'
 rmail='$rmail'
@@ -17633,6 +21252,13 @@ seedfunc='$seedfunc'
 selectminbits='$selectminbits'
 selecttype='$selecttype'
 sendmail='$sendmail'
+setgrent_r_proto='$setgrent_r_proto'
+sethostent_r_proto='$sethostent_r_proto'
+setlocale_r_proto='$setlocale_r_proto'
+setnetent_r_proto='$setnetent_r_proto'
+setprotoent_r_proto='$setprotoent_r_proto'
+setpwent_r_proto='$setpwent_r_proto'
+setservent_r_proto='$setservent_r_proto'
 sh='$sh'
 shar='$shar'
 sharpbang='$sharpbang'
@@ -17651,11 +21277,21 @@ sitearch='$sitearch'
 sitearchexp='$sitearchexp'
 sitebin='$sitebin'
 sitebinexp='$sitebinexp'
+sitehtml1dir='$sitehtml1dir'
+sitehtml1direxp='$sitehtml1direxp'
+sitehtml3dir='$sitehtml3dir'
+sitehtml3direxp='$sitehtml3direxp'
 sitelib='$sitelib'
 sitelib_stem='$sitelib_stem'
 sitelibexp='$sitelibexp'
+siteman1dir='$siteman1dir'
+siteman1direxp='$siteman1direxp'
+siteman3dir='$siteman3dir'
+siteman3direxp='$siteman3direxp'
 siteprefix='$siteprefix'
 siteprefixexp='$siteprefixexp'
+sitescript='$sitescript'
+sitescriptexp='$sitescriptexp'
 sizesize='$sizesize'
 sizetype='$sizetype'
 sleep='$sleep'
@@ -17667,6 +21303,8 @@ socksizetype='$socksizetype'
 sort='$sort'
 spackage='$spackage'
 spitshell='$spitshell'
+srand48_r_proto='$srand48_r_proto'
+srandom_r_proto='$srandom_r_proto'
 src='$src'
 ssizetype='$ssizetype'
 startperl='$startperl'
@@ -17679,6 +21317,7 @@ stdio_cnt='$stdio_cnt'
 stdio_filbuf='$stdio_filbuf'
 stdio_ptr='$stdio_ptr'
 stdio_stream_array='$stdio_stream_array'
+strerror_r_proto='$strerror_r_proto'
 strings='$strings'
 submit='$submit'
 subversion='$subversion'
@@ -17691,11 +21330,13 @@ tee='$tee'
 test='$test'
 timeincl='$timeincl'
 timetype='$timetype'
+tmpnam_r_proto='$tmpnam_r_proto'
 to='$to'
 touch='$touch'
 tr='$tr'
 trnl='$trnl'
 troff='$troff'
+ttyname_r_proto='$ttyname_r_proto'
 u16size='$u16size'
 u16type='$u16type'
 u32size='$u32size'
@@ -17716,6 +21357,7 @@ use64bitall='$use64bitall'
 use64bitint='$use64bitint'
 usecrosscompile='$usecrosscompile'
 usedl='$usedl'
+usefaststdio='$usefaststdio'
 useithreads='$useithreads'
 uselargefiles='$uselargefiles'
 uselongdouble='$uselongdouble'
@@ -17745,11 +21387,21 @@ vendorarch='$vendorarch'
 vendorarchexp='$vendorarchexp'
 vendorbin='$vendorbin'
 vendorbinexp='$vendorbinexp'
+vendorhtml1dir='$vendorhtml1dir'
+vendorhtml1direxp='$vendorhtml1direxp'
+vendorhtml3dir='$vendorhtml3dir'
+vendorhtml3direxp='$vendorhtml3direxp'
 vendorlib='$vendorlib'
 vendorlib_stem='$vendorlib_stem'
 vendorlibexp='$vendorlibexp'
+vendorman1dir='$vendorman1dir'
+vendorman1direxp='$vendorman1direxp'
+vendorman3dir='$vendorman3dir'
+vendorman3direxp='$vendorman3direxp'
 vendorprefix='$vendorprefix'
 vendorprefixexp='$vendorprefixexp'
+vendorscript='$vendorscript'
+vendorscriptexp='$vendorscriptexp'
 version='$version'
 version_patchlevel_string='$version_patchlevel_string'
 versiononly='$versiononly'