integrate Pod-Perldoc-3.07. This replaces the original inline perldoc
[p5sagit/p5-mst-13.2.git] / Configure
index 76a058b..97ea4b3 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 Thu Apr  4 20:10:51 EET DST 2002 [metaconfig 3.0 PL70]
+# Generated on Tue Nov 26 10:51:37 MET 2002 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >c1$$ <<EOF
@@ -301,8 +301,6 @@ baserev=''
 bin=''
 binexp=''
 installbin=''
-bincompat5005=''
-d_bincompat5005=''
 byteorder=''
 cc=''
 ccflags=''
@@ -497,6 +495,7 @@ d_getsbyport=''
 d_gmtime_r=''
 gmtime_r_proto=''
 d_gnulibc=''
+gnulibc_version=''
 d_hasmntopt=''
 d_htonl=''
 d_inetaton=''
@@ -539,6 +538,7 @@ d_mmap=''
 mmaptype=''
 d_modfl=''
 d_modfl_pow32_bug=''
+d_modflproto=''
 d_mprotect=''
 d_msg=''
 d_msgctl=''
@@ -548,6 +548,7 @@ d_msgrcv=''
 d_msgsnd=''
 d_msync=''
 d_munmap=''
+d_nanosleep=''
 d_nice=''
 d_nl_langinfo=''
 d_off64_t=''
@@ -755,6 +756,7 @@ fflushNULL=''
 fflushall=''
 fpossize=''
 fpostype=''
+gccansipedantic=''
 gccosandvers=''
 gccversion=''
 gidformat=''
@@ -764,6 +766,12 @@ gidtype=''
 groupstype=''
 h_fcntl=''
 h_sysfile=''
+html1dir=''
+html1direxp=''
+installhtml1dir=''
+html3dir=''
+html3direxp=''
+installhtml3dir=''
 i_arpainet=''
 i_crypt=''
 db_hashtype=''
@@ -1046,12 +1054,27 @@ sitearchexp=''
 installsitebin=''
 sitebin=''
 sitebinexp=''
+installsitehtml1=''
+sitehtml1=''
+sitehtml1exp=''
+installsitehtml3=''
+sitehtml3=''
+sitehtml3exp=''
 installsitelib=''
 sitelib=''
 sitelib_stem=''
 sitelibexp=''
+installsiteman1=''
+siteman1=''
+siteman1exp=''
+installsiteman3=''
+siteman3=''
+siteman3exp=''
 siteprefix=''
 siteprefixexp=''
+installsitescript=''
+sitescript=''
+sitescriptexp=''
 sizesize=''
 sizetype=''
 so=''
@@ -1104,14 +1127,30 @@ d_vendorbin=''
 installvendorbin=''
 vendorbin=''
 vendorbinexp=''
+installvendorhtml1=''
+vendorhtml1=''
+vendorhtml1exp=''
+installvendorhtml3=''
+vendorhtml3=''
+vendorhtml3exp=''
 d_vendorlib=''
 installvendorlib=''
 vendorlib=''
 vendorlib_stem=''
 vendorlibexp=''
+installvendorman1=''
+vendorman1=''
+vendorman1exp=''
+installvendorman3=''
+vendorman3=''
+vendorman3exp=''
 usevendorprefix=''
 vendorprefix=''
 vendorprefixexp=''
+d_vendorscript=''
+installvendorscript=''
+vendorscript=''
+vendorscriptexp=''
 versiononly=''
 defvoidused=''
 voidflags=''
@@ -1193,6 +1232,9 @@ plibpth=''
 libswanted=''
 : some systems want to use only the non-versioned libso:s
 ignore_versioned_solibs=''
+siteman1=''
+siteman3=''
+sitescript=''
 archname64=''
 ccflags_uselargefiles=''
 ldflags_uselargefiles=''
@@ -1209,7 +1251,7 @@ defvoidused=15
 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"
+libswanted="$libswanted ucb bsd BSD PW x util rt posix4"
 : 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 ! !'`
@@ -1486,23 +1528,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
@@ -1860,6 +1902,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'.
@@ -2148,9 +2195,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
@@ -3075,6 +3123,9 @@ EOM
                        ;;
                next*) osname=next ;;
                nonstop-ux) osname=nonstopux ;;
+               openbsd) osname=openbsd
+                       osvers="$3"
+                       ;;
                POSIX-BC | posix-bc ) osname=posix-bc
                        osvers="$3"
                        ;;
@@ -3113,7 +3164,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]//'` ;;
@@ -3419,13 +3470,88 @@ $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';;
 *)     # Catch case where user specified ithreads or 5005threads but
        # forgot -Dusethreads (A.D. 4/2002)
        case "$useithreads$use5005threads" in
-       *$define*)      dflt='y' ;;
-       *)      dflt='n';;
+       *$define*)      
+               case "$useperlio" in
+               "$define")      dflt='y' ;;
+               *)              dflt='n' ;;
+               esac
+               ;;
+       *)      dflt='n';;
        esac
        ;;
 esac
@@ -3434,11 +3560,10 @@ 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
@@ -3455,11 +3580,13 @@ case "$usethreads" in
 $define)
        $cat <<EOM
 
-As of release 5.6, Perl has two different threading implementations,
-an interpreter-based version (ithreads) with one interpreter per
-thread, and the 5.005 version (5005threads).  Both implementations
-are considered experimental, but since 5.8 ithreads somewhat less so.
-The 5005threads is effectively unmaintained.
+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.
 
 EOM
        : Default to ithreads unless overridden on command line or with
@@ -3471,7 +3598,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" ;;
@@ -3506,6 +3633,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" ;;
@@ -3706,7 +3843,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
@@ -3759,6 +3896,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
@@ -3826,7 +3977,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
@@ -4344,31 +4497,6 @@ case "$firstmakefile" in
 '') firstmakefile='makefile';;
 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
-
 : Looking for optional libraries
 echo " "
 echo "Checking for optional libraries..." >&4
@@ -4846,131 +4974,6 @@ EOM
 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
@@ -5366,49 +5369,24 @@ Since you have chosen a maximally 64-bit build, I'm also turning on
 the use of 64-bit integers.
 EOM
                use64bitint="$define" ;;
-       esac
-       ;;
-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
-: user has specified that a 64-bit perl is to be built,
-: we may need to set or change some other defaults.
-       if $test -f use64bitint.cbu; then
-               echo "Your platform has some specific hints for 64-bit integers, using them..."
-               . ./use64bitint.cbu
-       fi
-       case "$longsize" in
-       4) case "$archname64" in
-          '') archname64=64int ;;
-          esac
-          ;;
+       esac
+       ;;
+esac
+
+case "$use64bitint" in
+"$define"|true|[yY]*)
+: Look for a hint-file generated 'call-back-unit'.  If the
+: user has specified that a 64-bit perl is to be built,
+: we may need to set or change some other defaults.
+       if $test -f use64bitint.cbu; then
+               echo "Your platform has some specific hints for 64-bit integers, using them..."
+               . ./use64bitint.cbu
+       fi
+       case "$longsize" in
+       4) case "$archname64" in
+          '') archname64=64int ;;
+          esac
+          ;;
        esac
        ;;
 esac
@@ -5433,26 +5411,43 @@ esac
 
 echo " "
 echo "Checking for GNU C Library..." >&4
-cat >try.c <<EOM
+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()
+int main(void)
 {
 #ifdef __GLIBC__
-    exit(0);
+#   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
-    exit(1);
+    return 1;
 #endif
 }
-EOM
+EOCP
 set try
-if eval $compile_ok && $run ./try; then
+if eval $compile_ok && $run ./try > glibc.ver; then
        val="$define"
-       echo "You are using the GNU C Library"
+       gnulibc_version=`$cat glibc.ver`
+       echo "You are using the GNU C Library version $gnulibc_version"
 else
        val="$undef"
+       gnulibc_version=''
        echo "You are not using the GNU C Library"
 fi
-$rm -f try try.*
+$rm -f try try.* glibc.ver
 set d_gnulibc
 eval $setvar
 
@@ -5469,7 +5464,7 @@ case "$usenm" in
        esac
        case "$dflt" in
        '') 
-               if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
+               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
@@ -5816,11 +5811,19 @@ else
        fi
 fi
 nm_extract="$com"
-if $test -f /lib/syscalls.exp; then
+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
+    fi
+    ;;
+esac
 ;;
 esac
 $rm -f libnames libpath
@@ -5892,6 +5895,25 @@ esac'
 set sqrtl d_sqrtl
 eval $inlibc
 
+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'
+
 : check for length of double
 echo " "
 case "$doublesize" in
@@ -6087,6 +6109,11 @@ esac
 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
@@ -6097,6 +6124,14 @@ 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;
@@ -6215,51 +6250,6 @@ 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'.
-EOM
-rp='Use the PerlIO abstraction layer?'
-. ./myread
-case "$ans" in
-y|Y) 
-       val="$define"
-       ;;
-*)      
-       echo "Ok, doing things the stdio way."
-       val="$undef"
-       ;;
-esac
-set useperlio
-eval $setvar 
-
-case "$usesocks" in
-$define|true|[yY]*)
-       case "$useperlio" in
-       $define|true|[yY]*) ;;
-       *)      cat >&4 <<EOM
-
-You are using the SOCKS proxy protocol library which means that you
-should also use the PerlIO layer.  You may be headed for trouble.
-
-EOM
-               ;;
-       esac
-       ;;
-esac
-
-       
 : determine the architecture name
 echo " "
 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
@@ -6381,6 +6371,9 @@ case "$prefix" in
 '')
        dflt=`./loc . /usr/local /usr/local /local /opt /usr`
        ;;
+*?/)
+       dflt=`echo "$prefix" | sed 's/.$//'`
+       ;;
 *)
        dflt="$prefix"
        ;;
@@ -6639,45 +6632,6 @@ else
        installarchlib="$archlibexp"
 fi
 
-
-: Binary compatibility with 5.005 is not possible for builds
-: with advanced features
-case "$usethreads$usemultiplicity" in
-*define*)
-       bincompat5005="$undef"
-       d_bincompat5005="$undef"
-       ;;
-*)     $cat <<EOM
-
-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.
-
-EOM
-       case "$bincompat5005$d_bincompat5005" in
-       *"$undef"*) dflt=n ;;
-       *) dflt=y ;;
-       esac
-       rp='Binary compatibility with Perl 5.005?'
-       . ./myread
-       case "$ans" in
-       y*) val="$define" ;;
-       *)  val="$undef" ;;
-       esac
-       set d_bincompat5005
-       eval $setvar
-       case "$d_bincompat5005" in
-       "$define")
-               bincompat5005="$define"
-               ;;
-       *)      bincompat5005="$undef"
-               d_bincompat5005="$undef"
-               ;;
-       esac
-       ;;
-esac
-
-
 : see if setuid scripts can be secure
 $cat <<EOM
 
@@ -6796,6 +6750,156 @@ eval $inhdr
 set stdlib.h i_stdlib
 eval $inhdr
 
+: 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
+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
+
+
 : determine which malloc to compile in
 echo " "
 case "$usemymalloc" in
@@ -7247,6 +7351,62 @@ set extras
 eval $setvar
 echo " "
 
+: determine where html pages for programs go
+set html1dir html1dir none
+eval $prefixit
+$cat <<EOM
+
+If you wish to install html files for programs in $spackage, indicate 
+the appropriate directory here.  To skip installing html files,
+answer "none".
+EOM
+case "$html1dir" in
+''|none|$undef|' ') dflt=none ;;
+*) dflt=$html1dir ;;
+esac
+fn=dn+~
+rp="Directory for the main $spackage html pages?"
+. ./getfile
+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
+       installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
+else
+       installhtml1dir="$html1direxp"
+fi
+
+: determine where html pages for libraries and modules go
+set html3dir html3dir none
+eval $prefixit
+$cat <<EOM
+
+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
+: 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
+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
+       installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
+else
+       installhtml3dir="$html3direxp"
+fi
+
 : Find perl5.005 or later.
 echo "Looking for a previously installed perl5.005 or later... "
 case "$perl5" in
@@ -7334,13 +7494,9 @@ case "$dflt" in
 ''|' ') dflt=none ;;
 esac
 case "$dflt" in
-5.005) case "$bincompat5005" in
-       $define|true|[yY]*) ;;
-       *) dflt=none ;;
-       esac
-       ;;
+5.005) dflt=none ;;
 esac
-$cat <<'EOM'
+$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 
@@ -7375,13 +7531,33 @@ 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).
+
+If you want to, I can install the perl you are about to compile
+as /usr/bin/perl (in addition to $bin/perl).
 EOM
-       case "$installusrbinperl" in
-       "$undef"|[nN]*) dflt='n';;
-       *)              dflt='y';;
-       esac
+       if test -f /usr/bin/perl; then
+           $cat <<EOM
+
+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
+           case "$installusrbinperl" in
+           "$define"|[yY]*)    dflt='y';;
+           *)                  dflt='n';;
+           esac
+       else
+           $cat <<EOM
+
+Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
+
+EOM
+           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
@@ -7782,7 +7958,7 @@ if "$useshrplib"; then
        solaris)
                xxx="-R $shrpdir"
                ;;
-       freebsd|netbsd)
+       freebsd|netbsd|openbsd)
                xxx="-Wl,-R$shrpdir"
                ;;
        bsdos|linux|irix*|dec_osf)
@@ -8507,26 +8683,136 @@ scriptdir="$ans"
 scriptdirexp="$ansexp"
 : Change installation prefix, if necessary.
 if $test X"$prefix" != X"$installprefix"; then
-       installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
+       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
+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 "$sitehtml1" in
+'')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
+*)     dflt=$sitehtml1 ;;
+esac
+case "$dflt" in
+''|' ') dflt=none ;;
+esac
+fn=dn+~
+rp='Pathname where the site-specific html pages should be installed?'
+. ./getfile
+sitehtml1="$ans"
+sitehtml1exp="$ansexp"
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$sitehtml1" = "X" && sitehtml1=' '
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsitehtml1=`echo "$sitehtml1exp" | $sed "s#^$prefix#$installprefix#"`
+else
+       installsitehtml1="$sitehtml1exp"
+fi
+
+: 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 "$sitehtml3" in
+'')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
+*)     dflt=$sitehtml3 ;;
+esac
+case "$dflt" in
+''|' ') dflt=none ;;
+esac
+fn=dn+~
+rp='Pathname where the site-specific library html pages should be installed?'
+. ./getfile
+sitehtml3="$ans"
+sitehtml3exp="$ansexp"
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$sitehtml3" = "X" && sitehtml3=' '
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsitehtml3=`echo "$sitehtml3exp" | $sed "s#^$prefix#$installprefix#"`
+else
+       installsitehtml3="$sitehtml3exp"
+fi
+
+: determine where add-on manual pages go
+case "$siteman1" in
+'')    dflt=`echo "$man1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
+*)     dflt=$siteman1 ;;
+esac
+case "$dflt" in
+''|' ') dflt=none ;;
+esac
+fn=dn+~
+rp='Pathname where the site-specific manual pages should be installed?'
+. ./getfile
+siteman1="$ans"
+siteman1exp="$ansexp"
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$siteman1" = "X" && siteman1=' '
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsiteman1=`echo "$siteman1exp" | $sed "s#^$prefix#$installprefix#"`
+else
+       installsiteman1="$siteman1exp"
+fi
+
+: determine where add-on library man pages go
+case "$siteman3" in
+'')    dflt=`echo "$man3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
+*)     dflt=$siteman3 ;;
+esac
+case "$dflt" in
+''|' ') dflt=none ;;
+esac
+fn=dn+~
+rp='Pathname where the site-specific library manual pages should be installed?'
+. ./getfile
+siteman3="$ans"
+siteman3exp="$ansexp"
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$siteman3" = "X" && siteman3=' '
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsiteman3=`echo "$siteman3exp" | $sed "s#^$prefix#$installprefix#"`
 else
-       installscript="$scriptdirexp"
+       installsiteman3="$siteman3exp"
 fi
 
-: determine where add-on public executables go
-case "$sitebin" in
-'')    dflt=$siteprefix/bin ;;
-*)     dflt=$sitebin ;;
+: 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 the add-on public executables should be installed?'
+fn=d~+
+rp='Pathname where add-on public executable scripts should be installed?'
 . ./getfile
-sitebin="$ans"
-sitebinexp="$ansexp"
+sitescript="$ans"
+sitescriptexp="$ansexp"
 : Change installation prefix, if necessary.
 if $test X"$prefix" != X"$installprefix"; then
-       installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
+       installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
 else
-       installsitebin="$sitebinexp"
+       installsitescript="$sitescriptexp"
 fi
 
 : define an is-a-typedef? function
@@ -8788,6 +9074,156 @@ else
        installvendorbin="$vendorbinexp"
 fi
 
+case "$vendorprefix" in
+'')    vendorhtml1=''
+       vendorhtml1exp=''
+       ;;
+*)     : 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 "$vendorhtml1" in
+       '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
+       *)      dflt=$vendorhtml1 ;;
+       esac
+       case "$dflt" in
+       ''|' ') dflt=none ;;
+       esac
+       fn=dn+~
+       rp='Pathname for the vendor-supplied html pages?'
+       . ./getfile
+       vendorhtml1="$ans"
+       vendorhtml1exp="$ansexp"
+       ;;
+esac
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$vendorhtml1" = "X" && vendorhtml1=' '
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installvendorhtml1=`echo $vendorhtml1exp | $sed "s#^$prefix#$installprefix#"`
+else
+       installvendorhtml1="$vendorhtml1exp"
+fi
+
+case "$vendorprefix" in
+'')    vendorhtml3=''
+       vendorhtml3exp=''
+       ;;
+*)     : 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 "$vendorhtml3" in
+       '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
+       *)      dflt=$vendorhtml3 ;;
+       esac
+       case "$dflt" in
+       ''|' ') dflt=none ;;
+       esac
+       fn=dn+~
+       rp='Pathname for the vendor-supplied html pages?'
+       . ./getfile
+       vendorhtml3="$ans"
+       vendorhtml3exp="$ansexp"
+       ;;
+esac
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$vendorhtml3" = "X" && vendorhtml3=' '
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installvendorhtml3=`echo $vendorhtml3exp | $sed "s#^$prefix#$installprefix#"`
+else
+       installvendorhtml3="$vendorhtml3exp"
+fi
+
+case "$vendorprefix" in
+'')    vendorman1=''
+       vendorman1exp=''
+       ;;
+*)     : determine where vendor-supplied manual pages go.
+       case "$vendorman1" in
+       '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
+       *)      dflt=$vendorman1 ;;
+       esac
+       case "$dflt" in
+       ''|' ') dflt=none ;;
+       esac
+       fn=nd~+
+       rp='Pathname for the vendor-supplied manual section 1 pages?'
+       . ./getfile
+       vendorman1="$ans"
+       vendorman1exp="$ansexp"
+       ;;
+esac
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$vendorman1" = "X" && vendorman1=' '
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installvendorman1=`echo "$vendorman1exp" | $sed "s#^$prefix#$installprefix#"`
+else
+       installvendorman1="$vendorman1exp"
+fi
+
+case "$vendorprefix" in
+'')    vendorman3=''
+       vendorman3exp=''
+       ;;
+*)     : determine where vendor-supplied module manual pages go.
+       case "$vendorman3" in
+       '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
+       *)      dflt=$vendorman3 ;;
+       esac
+       case "$dflt" in
+       ''|' ') dflt=none ;;
+       esac
+       fn=nd~+
+       rp='Pathname for the vendor-supplied manual section 3 pages?'
+       . ./getfile
+       vendorman3="$ans"
+       vendorman3exp="$ansexp"
+       ;;
+esac
+: Use ' ' for none so value is preserved next time through Configure
+$test X"$vendorman3" = "X" && vendorman3=' '
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installvendorman3=`echo "$vendorman3exp" | $sed "s#^$prefix#$installprefix#"`
+else
+       installvendorman3="$vendorman3exp"
+fi
+
+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
+       $cat <<EOM
+
+The installation process will create a directory for 
+vendor-supplied scripts.
+
+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
+
 : see if qgcvt exists
 set qgcvt d_qgcvt
 eval $inlibc
@@ -9087,6 +9523,10 @@ eval $inlibc
 set alarm d_alarm
 eval $inlibc
 
+: see if POSIX threads are available
+set pthread.h i_pthread
+eval $inhdr
+
 : define a fucntion to check prototypes
 $cat > protochk <<EOSH
 $startsh
@@ -9096,6 +9536,9 @@ ccflags="$ccflags"
 prototype="$prototype"
 define="$define"
 rm=$rm
+usethreads=$usethreads
+i_pthread=$i_pthread
+pthread_h_first=$pthread_h_first
 EOSH
 
 $cat >> protochk <<'EOSH'
@@ -9108,6 +9551,14 @@ while test $# -ge 2; do
                $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
@@ -9128,25 +9579,6 @@ 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
-       echo "$func() prototype NOT found.";
-       val="$undef";
-fi;
-set $varname;
-eval $setvar;
-$rm -f try.c tryout.c'
-
 : see if sys/types.h has to be included
 set sys/types.h i_systypes
 eval $inhdr
@@ -9296,12 +9728,7 @@ 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"
-       case "time" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
+       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
@@ -9895,7 +10322,7 @@ 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()
+main()
 {
        const char *foo;
        const spug y;
@@ -9960,11 +10387,6 @@ eval $inlibc
 case "$d_crypt_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
-       case "crypt" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_crypt_r_proto:$usethreads" in
        ":define")      d_crypt_r_proto=define
                set d_crypt_r_proto crypt_r $hdrs
@@ -10022,11 +10444,6 @@ eval $inlibc
 case "$d_ctermid_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h "
-       case "stdio" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_ctermid_r_proto:$usethreads" in
        ":define")      d_ctermid_r_proto=define
                set d_ctermid_r_proto ctermid_r $hdrs
@@ -10067,12 +10484,7 @@ set ctime_r d_ctime_r
 eval $inlibc
 case "$d_ctime_r" in
 "$define")
-       hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
-       case "time" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
+       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
@@ -10446,11 +10858,6 @@ eval $inlibc
 case "$d_drand48_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
-       case "stdlib" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_drand48_r_proto:$usethreads" in
        ":define")      d_drand48_r_proto=define
                set d_drand48_r_proto drand48_r $hdrs
@@ -10534,11 +10941,6 @@ eval $inlibc
 case "$d_endgrent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
-       case "grp" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_endgrent_r_proto:$usethreads" in
        ":define")      d_endgrent_r_proto=define
                set d_endgrent_r_proto endgrent_r $hdrs
@@ -10592,11 +10994,6 @@ eval $inlibc
 case "$d_endhostent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_endhostent_r_proto:$usethreads" in
        ":define")      d_endhostent_r_proto=define
                set d_endhostent_r_proto endhostent_r $hdrs
@@ -10646,11 +11043,6 @@ eval $inlibc
 case "$d_endnetent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_endnetent_r_proto:$usethreads" in
        ":define")      d_endnetent_r_proto=define
                set d_endnetent_r_proto endnetent_r $hdrs
@@ -10700,11 +11092,6 @@ eval $inlibc
 case "$d_endprotoent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_endprotoent_r_proto:$usethreads" in
        ":define")      d_endprotoent_r_proto=define
                set d_endprotoent_r_proto endprotoent_r $hdrs
@@ -10842,11 +11229,6 @@ eval $inlibc
 case "$d_endpwent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
-       case "pwd" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_endpwent_r_proto:$usethreads" in
        ":define")      d_endpwent_r_proto=define
                set d_endpwent_r_proto endpwent_r $hdrs
@@ -10896,11 +11278,6 @@ eval $inlibc
 case "$d_endservent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_endservent_r_proto:$usethreads" in
        ":define")      d_endservent_r_proto=define
                set d_endservent_r_proto endservent_r $hdrs
@@ -11577,11 +11954,6 @@ eval $inlibc
 case "$d_getgrent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
-       case "grp" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getgrent_r_proto:$usethreads" in
        ":define")      d_getgrent_r_proto=define
                set d_getgrent_r_proto getgrent_r $hdrs
@@ -11643,11 +12015,6 @@ eval $inlibc
 case "$d_getgrgid_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
-       case "grp" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getgrgid_r_proto:$usethreads" in
        ":define")      d_getgrgid_r_proto=define
                set d_getgrgid_r_proto getgrgid_r $hdrs
@@ -11701,11 +12068,6 @@ eval $inlibc
 case "$d_getgrnam_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
-       case "grp" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getgrnam_r_proto:$usethreads" in
        ":define")      d_getgrnam_r_proto=define
                set d_getgrnam_r_proto getgrnam_r $hdrs
@@ -11860,11 +12222,6 @@ eval $inlibc
 case "$d_gethostbyaddr_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_gethostbyaddr_r_proto:$usethreads" in
        ":define")      d_gethostbyaddr_r_proto=define
                set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
@@ -11942,11 +12299,6 @@ eval $inlibc
 case "$d_gethostbyname_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_gethostbyname_r_proto:$usethreads" in
        ":define")      d_gethostbyname_r_proto=define
                set d_gethostbyname_r_proto gethostbyname_r $hdrs
@@ -11996,11 +12348,6 @@ eval $inlibc
 case "$d_gethostent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_gethostent_r_proto:$usethreads" in
        ":define")      d_gethostent_r_proto=define
                set d_gethostent_r_proto gethostent_r $hdrs
@@ -12075,11 +12422,6 @@ eval $inlibc
 case "$d_getlogin_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
-       case "unistd" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getlogin_r_proto:$usethreads" in
        ":define")      d_getlogin_r_proto=define
                set d_getlogin_r_proto getlogin_r $hdrs
@@ -12153,11 +12495,6 @@ eval $inlibc
 case "$d_getnetbyaddr_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getnetbyaddr_r_proto:$usethreads" in
        ":define")      d_getnetbyaddr_r_proto=define
                set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
@@ -12223,11 +12560,6 @@ eval $inlibc
 case "$d_getnetbyname_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getnetbyname_r_proto:$usethreads" in
        ":define")      d_getnetbyname_r_proto=define
                set d_getnetbyname_r_proto getnetbyname_r $hdrs
@@ -12281,11 +12613,6 @@ eval $inlibc
 case "$d_getnetent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getnetent_r_proto:$usethreads" in
        ":define")      d_getnetent_r_proto=define
                set d_getnetent_r_proto getnetent_r $hdrs
@@ -12385,11 +12712,6 @@ eval $inlibc
 case "$d_getprotobyname_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getprotobyname_r_proto:$usethreads" in
        ":define")      d_getprotobyname_r_proto=define
                set d_getprotobyname_r_proto getprotobyname_r $hdrs
@@ -12439,11 +12761,6 @@ eval $inlibc
 case "$d_getprotobynumber_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getprotobynumber_r_proto:$usethreads" in
        ":define")      d_getprotobynumber_r_proto=define
                set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
@@ -12493,11 +12810,6 @@ eval $inlibc
 case "$d_getprotoent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getprotoent_r_proto:$usethreads" in
        ":define")      d_getprotoent_r_proto=define
                set d_getprotoent_r_proto getprotoent_r $hdrs
@@ -12564,11 +12876,6 @@ eval $inlibc
 case "$d_getpwent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
-       case "pwd" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getpwent_r_proto:$usethreads" in
        ":define")      d_getpwent_r_proto=define
                set d_getpwent_r_proto getpwent_r $hdrs
@@ -12630,11 +12937,6 @@ eval $inlibc
 case "$d_getpwnam_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
-       case "pwd" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getpwnam_r_proto:$usethreads" in
        ":define")      d_getpwnam_r_proto=define
                set d_getpwnam_r_proto getpwnam_r $hdrs
@@ -12688,11 +12990,6 @@ eval $inlibc
 case "$d_getpwuid_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
-       case "pwd" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getpwuid_r_proto:$usethreads" in
        ":define")      d_getpwuid_r_proto=define
                set d_getpwuid_r_proto getpwuid_r $hdrs
@@ -12759,11 +13056,6 @@ eval $inlibc
 case "$d_getservbyname_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getservbyname_r_proto:$usethreads" in
        ":define")      d_getservbyname_r_proto=define
                set d_getservbyname_r_proto getservbyname_r $hdrs
@@ -12813,11 +13105,6 @@ eval $inlibc
 case "$d_getservbyport_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getservbyport_r_proto:$usethreads" in
        ":define")      d_getservbyport_r_proto=define
                set d_getservbyport_r_proto getservbyport_r $hdrs
@@ -12867,11 +13154,6 @@ eval $inlibc
 case "$d_getservent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getservent_r_proto:$usethreads" in
        ":define")      d_getservent_r_proto=define
                set d_getservent_r_proto getservent_r $hdrs
@@ -12938,11 +13220,6 @@ eval $inlibc
 case "$d_getspnam_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
-       case "shadow" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_getspnam_r_proto:$usethreads" in
        ":define")      d_getspnam_r_proto=define
                set d_getspnam_r_proto getspnam_r $hdrs
@@ -13006,12 +13283,7 @@ 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"
-       case "time" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
+       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
@@ -13251,12 +13523,7 @@ 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"
-       case "time" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
+       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
@@ -13475,6 +13742,10 @@ eval $inlibc
 set munmap d_munmap
 eval $inlibc
 
+: see if nanosleep exists
+set nanosleep d_nanosleep
+eval $inlibc
+
 : see if nice exists
 set nice d_nice
 eval $inlibc
@@ -13521,7 +13792,7 @@ $rm -f try.c try
 echo " "
 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
 $cat >try.c <<'EOCP'
-int main()
+main()
 {
        typedef struct _goo_struct goo_struct;
        goo_struct * volatile goo = ((goo_struct *)0);
@@ -13812,13 +14083,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 " "
@@ -14024,11 +14288,6 @@ eval $inlibc
 case "$d_random_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
-       case "stdlib" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_random_r_proto:$usethreads" in
        ":define")      d_random_r_proto=define
                set d_random_r_proto random_r $hdrs
@@ -14080,11 +14339,6 @@ eval $inlibc
 case "$d_readdir64_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
-       case "dirent" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_readdir64_r_proto:$usethreads" in
        ":define")      d_readdir64_r_proto=define
                set d_readdir64_r_proto readdir64_r $hdrs
@@ -14130,11 +14384,6 @@ eval $inlibc
 case "$d_readdir_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
-       case "dirent" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_readdir_r_proto:$usethreads" in
        ":define")      d_readdir_r_proto=define
                set d_readdir_r_proto readdir_r $hdrs
@@ -14684,11 +14933,6 @@ eval $inlibc
 case "$d_setgrent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
-       case "grp" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_setgrent_r_proto:$usethreads" in
        ":define")      d_setgrent_r_proto=define
                set d_setgrent_r_proto setgrent_r $hdrs
@@ -14738,11 +14982,6 @@ eval $inlibc
 case "$d_sethostent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_sethostent_r_proto:$usethreads" in
        ":define")      d_sethostent_r_proto=define
                set d_sethostent_r_proto sethostent_r $hdrs
@@ -14804,11 +15043,6 @@ eval $inlibc
 case "$d_setlocale_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
-       case "locale" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_setlocale_r_proto:$usethreads" in
        ":define")      d_setlocale_r_proto=define
                set d_setlocale_r_proto setlocale_r $hdrs
@@ -14854,11 +15088,6 @@ eval $inlibc
 case "$d_setnetent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_setnetent_r_proto:$usethreads" in
        ":define")      d_setnetent_r_proto=define
                set d_setnetent_r_proto setnetent_r $hdrs
@@ -14924,11 +15153,6 @@ eval $inlibc
 case "$d_setprotoent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_setprotoent_r_proto:$usethreads" in
        ":define")      d_setprotoent_r_proto=define
                set d_setprotoent_r_proto setprotoent_r $hdrs
@@ -14978,11 +15202,6 @@ eval $inlibc
 case "$d_setpwent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
-       case "pwd" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_setpwent_r_proto:$usethreads" in
        ":define")      d_setpwent_r_proto=define
                set d_setpwent_r_proto setpwent_r $hdrs
@@ -15052,11 +15271,6 @@ eval $inlibc
 case "$d_setservent_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
-       case "netdb" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_setservent_r_proto:$usethreads" in
        ":define")      d_setservent_r_proto=define
                set d_setservent_r_proto setservent_r $hdrs
@@ -15357,11 +15571,6 @@ eval $inlibc
 case "$d_srand48_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
-       case "stdlib" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_srand48_r_proto:$usethreads" in
        ":define")      d_srand48_r_proto=define
                set d_srand48_r_proto srand48_r $hdrs
@@ -15403,11 +15612,6 @@ eval $inlibc
 case "$d_srandom_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
-       case "stdlib" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_srandom_r_proto:$usethreads" in
        ":define")      d_srandom_r_proto=define
                set d_srandom_r_proto srandom_r $hdrs
@@ -15598,6 +15802,26 @@ else
        echo "Your stdio doesn't appear very std."
 fi
 $rm -f try.c try
+
+# 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"
+               ;;
+       esac
+       ;;
+esac
 set d_stdstdio
 eval $setvar
 
@@ -15783,7 +16007,7 @@ eval $inlibc
 echo " "
 echo "Checking to see if your C compiler can copy structs..." >&4
 $cat >try.c <<'EOCP'
-int main()
+main()
 {
        struct blurfl {
                int dyick;
@@ -15848,11 +16072,6 @@ eval $inlibc
 case "$d_strerror_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
-       case "string" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_strerror_r_proto:$usethreads" in
        ":define")      d_strerror_r_proto=define
                set d_strerror_r_proto strerror_r $hdrs
@@ -16242,11 +16461,6 @@ eval $inlibc
 case "$d_tmpnam_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h "
-       case "stdio" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_tmpnam_r_proto:$usethreads" in
        ":define")      d_tmpnam_r_proto=define
                set d_tmpnam_r_proto tmpnam_r $hdrs
@@ -16292,11 +16506,6 @@ eval $inlibc
 case "$d_ttyname_r" in
 "$define")
        hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
-       case "unistd" in
-       time)
-               hdrs="$hdrs $i_systime sys/time.h"
-               ;;
-       esac
        case "$d_ttyname_r_proto:$usethreads" in
        ":define")      d_ttyname_r_proto=define
                set d_ttyname_r_proto ttyname_r $hdrs
@@ -16359,7 +16568,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*)
@@ -16382,21 +16591,23 @@ 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>
+#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);
@@ -16423,7 +16634,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"
                        ;;
@@ -18111,6 +18322,7 @@ EOM
        esac
 fi
 : locate the preferred pager for this system
+fn=f/
 case "$pager" in
 '')
        dflt=''
@@ -18130,10 +18342,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"
@@ -18144,10 +18360,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'
@@ -19175,7 +19388,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
@@ -19497,7 +19710,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
@@ -19511,7 +19724,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
@@ -19555,14 +19768,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 
@@ -19603,7 +19835,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
@@ -19690,16 +19934,6 @@ EOM
        : Exclude those that are not xs extensions
        case "$dflt" in
        '')     dflt=none;;
-        *)  case " $dflt " in
-            *" Encode "*) # Add the subextensions of Encode
-                cd "$rsrc/ext"
-                for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
-                        dflt="$dflt Encode/$xxx"
-                done
-                cd "$tdir"
-                ;;
-            esac
-            ;;
        esac
        rp="What extensions do you wish to include?"
        . ./myread
@@ -19709,6 +19943,20 @@ 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
@@ -19840,7 +20088,6 @@ awk='$awk'
 baserev='$baserev'
 bash='$bash'
 bin='$bin'
-bincompat5005='$bincompat5005'
 binexp='$binexp'
 bison='$bison'
 byacc='$byacc'
@@ -19908,7 +20155,6 @@ 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'
@@ -20084,6 +20330,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'
@@ -20099,6 +20346,7 @@ d_msgsnd='$d_msgsnd'
 d_msync='$d_msync'
 d_munmap='$d_munmap'
 d_mymalloc='$d_mymalloc'
+d_nanosleep='$d_nanosleep'
 d_nice='$d_nice'
 d_nl_langinfo='$d_nl_langinfo'
 d_nv_preserves_uv='$d_nv_preserves_uv'
@@ -20264,6 +20512,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'
@@ -20318,6 +20567,7 @@ 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'
@@ -20347,6 +20597,7 @@ gidtype='$gidtype'
 glibpth='$glibpth'
 gmake='$gmake'
 gmtime_r_proto='$gmtime_r_proto'
+gnulibc_version='$gnulibc_version'
 grep='$grep'
 groupcat='$groupcat'
 groupstype='$groupstype'
@@ -20355,6 +20606,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'
@@ -20452,6 +20707,8 @@ incpath='$incpath'
 inews='$inews'
 installarchlib='$installarchlib'
 installbin='$installbin'
+installhtml1dir='$installhtml1dir'
+installhtml3dir='$installhtml3dir'
 installman1dir='$installman1dir'
 installman3dir='$installman3dir'
 installprefix='$installprefix'
@@ -20460,12 +20717,22 @@ installprivlib='$installprivlib'
 installscript='$installscript'
 installsitearch='$installsitearch'
 installsitebin='$installsitebin'
+installsitehtml1='$installsitehtml1'
+installsitehtml3='$installsitehtml3'
 installsitelib='$installsitelib'
+installsiteman1='$installsiteman1'
+installsiteman3='$installsiteman3'
+installsitescript='$installsitescript'
 installstyle='$installstyle'
 installusrbinperl='$installusrbinperl'
 installvendorarch='$installvendorarch'
 installvendorbin='$installvendorbin'
+installvendorhtml1='$installvendorhtml1'
+installvendorhtml3='$installvendorhtml3'
 installvendorlib='$installvendorlib'
+installvendorman1='$installvendorman1'
+installvendorman3='$installvendorman3'
+installvendorscript='$installvendorscript'
 intsize='$intsize'
 issymlink='$issymlink'
 ivdformat='$ivdformat'
@@ -20644,11 +20911,21 @@ sitearch='$sitearch'
 sitearchexp='$sitearchexp'
 sitebin='$sitebin'
 sitebinexp='$sitebinexp'
+sitehtml1='$sitehtml1'
+sitehtml1exp='$sitehtml1exp'
+sitehtml3='$sitehtml3'
+sitehtml3exp='$sitehtml3exp'
 sitelib='$sitelib'
 sitelib_stem='$sitelib_stem'
 sitelibexp='$sitelibexp'
+siteman1='$siteman1'
+siteman1exp='$siteman1exp'
+siteman3='$siteman3'
+siteman3exp='$siteman3exp'
 siteprefix='$siteprefix'
 siteprefixexp='$siteprefixexp'
+sitescript='$sitescript'
+sitescriptexp='$sitescriptexp'
 sizesize='$sizesize'
 sizetype='$sizetype'
 sleep='$sleep'
@@ -20743,11 +21020,21 @@ vendorarch='$vendorarch'
 vendorarchexp='$vendorarchexp'
 vendorbin='$vendorbin'
 vendorbinexp='$vendorbinexp'
+vendorhtml1='$vendorhtml1'
+vendorhtml1exp='$vendorhtml1exp'
+vendorhtml3='$vendorhtml3'
+vendorhtml3exp='$vendorhtml3exp'
 vendorlib='$vendorlib'
 vendorlib_stem='$vendorlib_stem'
 vendorlibexp='$vendorlibexp'
+vendorman1='$vendorman1'
+vendorman1exp='$vendorman1exp'
+vendorman3='$vendorman3'
+vendorman3exp='$vendorman3exp'
 vendorprefix='$vendorprefix'
 vendorprefixexp='$vendorprefixexp'
+vendorscript='$vendorscript'
+vendorscriptexp='$vendorscriptexp'
 version='$version'
 version_patchlevel_string='$version_patchlevel_string'
 versiononly='$versiononly'