This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make the stdio test program of 7427 less noisy while being
[perl5.git] / Configure
index cc4fa3e..c07cf35 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -20,8 +20,8 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Sat Jul 29 02:22:13 EET DST 2000 [metaconfig 3.0 PL70]
-# (with additional metaconfig patches by perlbug@perl.com)
+# Generated on Tue Nov  7 00:26:20 EET 2000 [metaconfig 3.0 PL70]
+# (with additional metaconfig patches by perlbug@perl.org)
 
 cat >/tmp/c1$$ <<EOF
 ARGGGHHHH!!!!!
@@ -160,9 +160,12 @@ esac
 test -d UU || mkdir UU
 cd UU && rm -f ./*
 
+ccname=''
+ccversion=''
 ccsymbols=''
 cppccsymbols=''
 cppsymbols=''
+perllibs=''
 dynamic_ext=''
 extensions=''
 known_extensions=''
@@ -345,6 +348,7 @@ d_endsent=''
 d_fchmod=''
 d_fchown=''
 d_fcntl=''
+d_fcntl_can_lock=''
 d_fd_macros=''
 d_fd_set=''
 d_fds_bits=''
@@ -524,6 +528,7 @@ d_sockpair=''
 sockethdr=''
 socketlib=''
 d_socklen_t=''
+d_socks5_init=''
 d_sqrtl=''
 d_statblks=''
 d_statfs_f_flags=''
@@ -532,6 +537,8 @@ d_fstatvfs=''
 d_statvfs=''
 d_stdio_cnt_lval=''
 d_stdio_ptr_lval=''
+d_stdio_ptr_lval_nochange_cnt=''
+d_stdio_ptr_lval_sets_cnt=''
 d_stdiobase=''
 d_stdstdio=''
 stdio_base=''
@@ -625,6 +632,7 @@ i_grp=''
 i_iconv=''
 i_ieeefp=''
 i_inttypes=''
+i_libutil=''
 i_limits=''
 i_locale=''
 i_machcthr=''
@@ -726,18 +734,20 @@ libsfiles=''
 libsfound=''
 libspath=''
 lns=''
-d_PRIEldbl=''
-d_PRIFldbl=''
-d_PRIGldbl=''
+d_PRIEUldbl=''
+d_PRIFUldbl=''
+d_PRIGUldbl=''
 d_PRIeldbl=''
 d_PRIfldbl=''
 d_PRIgldbl=''
-sPRIEldbl=''
-sPRIFldbl=''
-sPRIGldbl=''
+d_SCNfldbl=''
+sPRIEUldbl=''
+sPRIFUldbl=''
+sPRIGUldbl=''
 sPRIeldbl=''
 sPRIfldbl=''
 sPRIgldbl=''
+sSCNfldbl=''
 lseeksize=''
 lseektype=''
 make_set_make=''
@@ -755,12 +765,6 @@ installman3dir=''
 man3dir=''
 man3direxp=''
 man3ext=''
-huge=''
-large=''
-medium=''
-models=''
-small=''
-split=''
 modetype=''
 multiarch=''
 mydomain=''
@@ -822,6 +826,13 @@ u8type=''
 uvsize=''
 uvtype=''
 ivdformat=''
+nvEUformat=''
+nvFUformat=''
+nvGUformat=''
+nveformat=''
+nvfformat=''
+nvgformat=''
+uvXUformat=''
 uvoformat=''
 uvuformat=''
 uvxformat=''
@@ -833,13 +844,13 @@ privlib=''
 privlibexp=''
 prototype=''
 ptrsize=''
-d_PRIX64=''
+d_PRIXU64=''
 d_PRId64=''
 d_PRIi64=''
 d_PRIo64=''
 d_PRIu64=''
 d_PRIx64=''
-sPRIX64=''
+sPRIXU64=''
 sPRId64=''
 sPRIi64=''
 sPRIo64=''
@@ -900,6 +911,9 @@ uidtype=''
 archname64=''
 use64bitall=''
 use64bitint=''
+ccflags_uselargefiles=''
+ldflags_uselargefiles=''
+libswanted_uselargefiles=''
 uselargefiles=''
 uselongdouble=''
 usemorebits=''
@@ -933,6 +947,7 @@ vendorlibexp=''
 usevendorprefix=''
 vendorprefix=''
 vendorprefixexp=''
+versiononly=''
 defvoidused=''
 voidflags=''
 pm_apiversion=''
@@ -954,6 +969,9 @@ if test -f /etc/unixtovms.exe; then
 fi
 
 i_whoami=''
+ccname=''
+ccversion=''
+perllibs=''
 : set useposix=false in your hint file to disable the POSIX extension.
 useposix=true
 : set useopcode=false in your hint file to disable the Opcode extension.
@@ -962,6 +980,7 @@ useopcode=true
 _exe=''
 : Extra object files, if any, needed on this platform.
 archobjs=''
+archname=''
 : Possible local include directories to search.
 : Set locincpth to "" in a hint file to defeat local include searches.
 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
@@ -978,8 +997,7 @@ loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
 
 : general looking path for locating libraries
-glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
-glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
+glibpth="/lib /usr/lib $xlibpth"
 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
@@ -993,6 +1011,10 @@ plibpth=''
 libswanted=''
 : some systems want to use only the non-versioned libso:s
 ignore_versioned_solibs=''
+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.
 : set usethreads on the Configure command line to enable threads.
@@ -1047,7 +1069,7 @@ case "$sh" in
 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
 
 Usually it's in /bin/sh.  How did you even get this far?
-Please contact me (Perl Maintainers) at perlbug@perl.com and 
+Please contact me (Perl Maintainers) at perlbug@perl.org and 
 we'll try to straighten this all out.
 EOM
        exit 1
@@ -1588,7 +1610,7 @@ THIS PACKAGE SEEMS TO BE INCOMPLETE.
 You have the option of continuing the configuration process, despite the
 distinct possibility that your kit is damaged, by typing 'y'es.  If you
 do, don't blame me if something goes wrong.  I advise you to type 'n'o
-and contact the author (perlbug@perl.com).
+and contact the author (perlbug@perl.org).
 
 EOM
                echo $n "Continue? [n] $c" >&4
@@ -1751,6 +1773,40 @@ persist across sessions for $package.
 You may safely delete it if you wish.
 EOF
 
+xversion=`awk '/define[        ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
+case "$usedevel" in
+$define|true|[yY]*) ;;
+*) case "$xversion" in
+   *[13579])
+       cat >&4 <<EOH
+*** WHOA THERE!!! ***
+
+    This is an UNSTABLE DEVELOPMENT release.
+    The version of this $package distribution is $xversion, that is, odd,
+    (as opposed to even) and that signifies a development release.
+    If you want a maintenance release, you want an even-numbered version.
+
+    Do ***NOT*** install this into production use.
+    Data corruption and crashes are possible.
+
+    It is most seriously suggested that you do not continue any further
+    unless you want to help in developing and debugging Perl.
+
+EOH
+       rp='Do you really want to continue?'
+       dflt='n'
+       . ./myread
+       case "$ans" in
+       [yY]) echo >&4 "Okay, continuing." ;;
+       *) echo >&4 "Okay, bye."
+          exit 1
+          ;;
+       esac
+       ;;
+    esac
+    ;;
+esac
+
 : general instructions
 needman=true
 firsttime=true
@@ -1813,7 +1869,7 @@ Much effort has been expended to ensure that this shell script will run on any
 Unix system.  If despite that it blows up on yours, your best bet is to edit
 Configure and run it again.  If you can't run Configure for some reason,
 you'll have to generate a config.sh file by hand.  Whatever problems you
-have, let me (perlbug@perl.com) know how I blew it.
+have, let me (perlbug@perl.org) know how I blew it.
 
 This installation script affects things in two ways:
 
@@ -2046,7 +2102,7 @@ int main(int argc, char *argv[]) {
   return 0;
 }
 EOM
-    if $cc -o try try.c; then
+    if $cc -o try $ccflags try.c; then
        :
     else
         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
@@ -2075,13 +2131,17 @@ EOM
                     fi
                 fi  
                 case "$ans" in
-                [yY]*) cc=gcc; ccflags=''; despair=no ;;
+                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
                 esac
             fi
         fi
         if $test X"$despair" = Xyes; then
-            echo "You need to find a working C compiler." >&4
-            echo "I cannot continue any further, aborting." >&4
+           $cat >&4 <<EOM
+You need to find a working C compiler.
+Either (purchase and) install the C compiler supplied by your OS vendor,
+or for a free C compiler try http://gcc.gnu.org/
+I cannot continue any further, aborting.
+EOM
             exit 1
         fi
     fi
@@ -2204,7 +2264,10 @@ if test -f config.sh; then
        rp="I see a config.sh file.  Shall I use it to set the defaults?"
        . UU/myread
        case "$ans" in
-       n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
+       n*|N*) echo "OK, I'll ignore it."
+               mv config.sh config.sh.old
+               myuname="$newmyuname"
+               ;;
        *)  echo "Fetching default answers from your old config.sh file..." >&4
                tmp_n="$n"
                tmp_c="$c"
@@ -2233,7 +2296,7 @@ EOM
        (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
        dflt=''
        : Half the following guesses are probably wrong... If you have better
-       : tests or hints, please send them to perlbug@perl.com
+       : tests or hints, please send them to perlbug@perl.org
        : The metaconfig authors would also appreciate a copy...
        $test -f /irix && osname=irix
        $test -f /xenix && osname=sco_xenix
@@ -2369,6 +2432,7 @@ EOM
                        esac
                        ;;
                next*) osname=next ;;
+               nonstop-ux) osname=nonstopux ;;
                POSIX-BC | posix-bc ) osname=posix-bc
                        osvers="$3"
                        ;;
@@ -2614,7 +2678,6 @@ cd UU
        ;;
 esac
 test "$override" && . ./optdef.sh
-myuname="$newmyuname"
 
 : Restore computed paths
 for file in $loclist $trylist; do
@@ -2831,174 +2894,6 @@ esac
 set usemultiplicity
 eval $setvar
 
-: determine where manual pages are on this system
-echo " "
-case "$sysman" in
-'') 
-       syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
-       syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
-       syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
-       syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
-       syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
-       sysman=`./loc . /usr/man/man1 $syspath`
-       ;;
-esac
-if $test -d "$sysman"; then
-       echo "System manual is in $sysman." >&4
-else
-       echo "Could not find manual pages in source form." >&4
-fi
-
-: see what memory models we can support
-case "$models" in
-'')
-       $cat >pdp11.c <<'EOP'
-int main() {
-#ifdef pdp11
-       exit(0);
-#else
-       exit(1);
-#endif
-}
-EOP
-       case "$cc" in
-       '') modelcc="$cc" ;;
-       *) modelcc="cc" ;;
-       esac
-       ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
-       if $test -f pdp11 && ./pdp11 2>/dev/null; then
-               dflt='unsplit split'
-       else
-               tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
-               case "$tans" in
-               X) dflt='none';;
-               *) if $test -d /lib/small || $test -d /usr/lib/small; then
-                               dflt='small'
-                       else
-                               dflt=''
-                       fi
-                       if $test -d /lib/medium || $test -d /usr/lib/medium; then
-                               dflt="$dflt medium"
-                       fi
-                       if $test -d /lib/large || $test -d /usr/lib/large; then
-                               dflt="$dflt large"
-                       fi
-                       if $test -d /lib/huge || $test -d /usr/lib/huge; then
-                               dflt="$dflt huge"
-                       fi
-               esac
-       fi;;
-*) dflt="$models";;
-esac
-$cat <<EOM
-Some systems have different model sizes.  On most systems they are called
-small, medium, large, and huge.  On the PDP11 they are called unsplit and
-split.  If your system doesn't support different memory models, say "none".
-If you wish to force everything to one memory model, say "none" here and
-put the appropriate flags later when it asks you for other cc and ld flags.
-Venix systems may wish to put "none" and let the compiler figure things out.
-(In the following question multiple model names should be space separated.)
-
-The default for most systems is "none".
-
-EOM
-rp="Which memory models are supported?"
-. ./myread
-models="$ans"
-
-case "$models" in
-none)
-       small=''
-       medium=''
-       large=''
-       huge=''
-       unsplit=''
-       split=''
-       ;;
-*split)
-       case "$split" in
-       '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
-                        $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
-                       dflt='-i'
-               else
-                       dflt='none'
-               fi;;
-       *) dflt="$split";;
-       esac
-       rp="What flag indicates separate I and D space?"
-       . ./myread
-       tans="$ans"
-       case "$tans" in
-       none) tans='';;
-       esac
-       split="$tans"
-       unsplit='';;
-*large*|*small*|*medium*|*huge*)
-       case "$models" in
-       *large*)
-               case "$large" in
-               '') dflt='-Ml';;
-               *) dflt="$large";;
-               esac
-       rp="What flag indicates large model?"
-       . ./myread
-       tans="$ans"
-       case "$tans" in
-       none) tans='';
-       esac
-       large="$tans";;
-       *) large='';;
-       esac
-       case "$models" in
-       *huge*) case "$huge" in
-               '') dflt='-Mh';;
-               *) dflt="$huge";;
-               esac
-               rp="What flag indicates huge model?"
-               . ./myread
-               tans="$ans"
-               case "$tans" in
-               none) tans='';
-               esac
-               huge="$tans";;
-       *) huge="$large";;
-       esac
-       case "$models" in
-       *medium*) case "$medium" in
-               '') dflt='-Mm';;
-               *) dflt="$medium";;
-               esac
-               rp="What flag indicates medium model?"
-               . ./myread
-               tans="$ans"
-               case "$tans" in
-               none) tans='';
-               esac
-               medium="$tans";;
-       *) medium="$large";;
-       esac
-       case "$models" in
-       *small*) case "$small" in
-               '') dflt='none';;
-               *) dflt="$small";;
-               esac
-               rp="What flag indicates small model?"
-               . ./myread
-               tans="$ans"
-               case "$tans" in
-               none) tans='';
-               esac
-               small="$tans";;
-       *) small='';;
-       esac
-       ;;
-*)
-       echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
-       ;;
-esac
-$rm -f pdp11.* pdp11
-
 : make some quick guesses about what we are up against
 echo " "
 $echo $n "Hmm...  $c"
@@ -3016,7 +2911,7 @@ if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
 then
        echo "Looks kind of like an OSF/1 system, but we'll see..."
        echo exit 0 >osf1
-elif test `echo abc | tr a-z A-Z` = Abc ; then
+elif test `echo abc | $tr a-z A-Z` = Abc ; then
        xxx=`./loc addbib blurfl $pth`
        if $test -f $xxx; then
        echo "Looks kind of like a USG system with BSD features, but we'll see..."
@@ -3055,12 +2950,15 @@ EOI
        ;;
 esac
 : Detect OS2.  The p_ variable is set above in the Head.U unit.
+: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
+: semicolon as a patch separator
 case "$p_" in
 :) ;;
 *)
        $cat <<'EOI'
 I have the feeling something is not exactly right, however...don't tell me...
 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
+(Or you may be running DOS with DJGPP.)
 EOI
        echo exit 0 >os2
        ;;
@@ -3091,51 +2989,13 @@ chmod +x bsd usg v7 osf1 eunice xenix venix os2
 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
 $rm -f foo
 
-: see if we need a special compiler
-echo " "
-if ./usg; then
-       case "$cc" in
-       '') case "$Mcc" in
-               /*) dflt='Mcc';;
-               *) case "$large" in
-                       -M*) dflt='cc';;
-                       *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
-                                       if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
-                                               dflt='cc'
-                                       else
-                                               dflt='cc -M'
-                                       fi
-                               else
-                                       dflt='cc'
-                               fi;;
-                       esac;;
-               esac;;
-       *)  dflt="$cc";;
-       esac
-       case "$dflt" in
-       *M*)    $cat <<'EOM'
-On some older systems the default C compiler will not resolve multiple global
-references that happen to have the same name.  On some such systems the "Mcc"
-command may be used to force these to be resolved.  On other systems a "cc -M"
-command is required.  (Note that the -M flag on other systems indicates a
-memory model to use!) If you have the Gnu C compiler, you might wish to use
-that instead.
-
-EOM
-       ;;
-       esac
-       rp="Use which C compiler?"
-       . ./myread
-       cc="$ans"
-else
-       case "$cc" in
-       '') dflt=cc;;
-       *) dflt="$cc";;
-       esac
-       rp="Use which C compiler?"
-       . ./myread
-       cc="$ans"
-fi
+case "$cc" in
+'') dflt=cc;;
+*) dflt="$cc";;
+esac
+rp="Use which C compiler?"
+. ./myread
+cc="$ans"
 : Look for a hint-file generated 'call-back-unit'.  Now that the
 : user has specified the compiler, we may need to set or change some
 : other defaults.
@@ -3159,11 +3019,12 @@ int main() {
        exit(0);
 }
 EOM
-if $cc $ldflags -o gccvers gccvers.c; then
+if $cc -o gccvers $ldflags gccvers.c; then
        gccversion=`./gccvers`
        case "$gccversion" in
        '') echo "You are not using GNU cc." ;;
        *)  echo "You are using GNU cc $gccversion."
+           ccname=gcc  
            ;;
        esac
 else
@@ -3183,9 +3044,12 @@ case "$gccversion" in
 esac
 case "$gccversion" in
 '') gccosandvers='' ;;
-*) gccosandvers=`gcc -v 2>&1|grep '/specs$'|sed 's!.*/[^-]*-[^-]*-\([^/]*\)/'$gccversion'/specs$!\1!'`
+*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
+   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
+   gccshortvers=''
    case "$gccosandvers" in
-   $osname$osvers) ;;
+   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
+   $osname$osvers) ;; # looking good
    $osname*) cat <<EOM >&4
 
 *** WHOA THERE!!! ***
@@ -3199,18 +3063,19 @@ case "$gccversion" in
 
     I'm trying to be optimistic here, though, and will continue.
     If later during the configuration and build icky compilation
-    problems appear, I suggest reinstalling the gcc to match
+    problems appear (headerfile conflicts being the most common
+    manifestation), I suggest reinstalling the gcc to match
     your operating system release.
 
 EOM
       ;;
-   *) ;; # failed to parse, better be silent
+   *) gccosandvers='' ;; # failed to parse, better be silent
    esac
    ;;
 esac
-
-
-
+case "$ccname" in
+'') ccname="$cc" ;;
+esac
 
 : see how we invoke the C preprocessor
 echo " "
@@ -3426,7 +3291,7 @@ esac
 
 case "$fn" in
 *\(*)
-       expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
+       expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
        fn=`echo $fn | sed 's/(.*)//'`
        ;;
 esac
@@ -3992,8 +3857,8 @@ for thisincl in $inclwanted; do
        if $test -d $thisincl; then
                if $test x$thisincl != x$usrinc; then
                        case "$dflt" in
-                       *$thisincl*);;
-                       *) dflt="$dflt -I$thisincl";;
+                        *" -I$thisincl "*);;
+                        *) dflt="$dflt -I$thisincl ";;
                        esac
                fi
        fi
@@ -4029,6 +3894,7 @@ esac
 case "$dflt" in
 ''|' ') dflt=none;;
 esac
+
 $cat <<EOH
 
 Your C compiler may want other flags.  For this question you should include
@@ -4161,7 +4027,7 @@ $cat > try.c <<'EOF'
 #include <stdio.h>
 int main() { printf("Ok\n"); exit(0); }
 EOF
-set X $cc $optimize $ccflags -o try $ldflags try.c $libs
+set X $cc -o try $optimize $ccflags $ldflags try.c $libs
 shift
 $cat >try.msg <<'EOM'
 I've tried to compile and run the following simple program:
@@ -4180,7 +4046,7 @@ and I got the following output:
 
 EOM
 dflt=y
-if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
+if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
        if sh -c './try' >>try.msg 2>&1; then
                xxx=`./try`
                case "$xxx" in
@@ -4292,12 +4158,12 @@ esac'
 compile='
 mc_file=$1;
 shift;
-$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
+$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
 : define a shorthand compile call for compilations that should be ok.
 compile_ok='
 mc_file=$1;
 shift;
-$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
+$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
 
 : check for lengths of integral types
 echo " "
@@ -4702,1577 +4568,1744 @@ case "$use64bitall" in
        ;;
 esac
 
-: determine the architecture name
 echo " "
-if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
-       tarch=`arch`"-$osname"
-elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
-       if uname -m > tmparch 2>&1 ; then
-               tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
-                       -e 's/$/'"-$osname/" tmparch`
-       else
-               tarch="$osname"
-       fi
-       $rm -f tmparch
+echo "Checking for GNU C Library..." >&4
+cat >gnulibc.c <<EOM
+#include <stdio.h>
+int main()
+{
+#ifdef __GLIBC__
+    exit(0);
+#else
+    exit(1);
+#endif
+}
+EOM
+set gnulibc
+if eval $compile_ok && ./gnulibc; then
+       val="$define"
+       echo "You are using the GNU C Library"
 else
-       tarch="$osname"
+       val="$undef"
+       echo "You are not using the GNU C Library"
 fi
-case "$myarchname" in
-''|"$tarch") ;;
-*)
-       echo "(Your architecture name used to be $myarchname.)"
-       archname=''
-       ;;
-esac
-myarchname="$tarch"
-case "$archname" in
-'') dflt="$tarch";;
-*) dflt="$archname";;
-esac
-rp='What is your architecture name'
-. ./myread
-archname="$ans"
-case "$usethreads" in
-$define)
-       echo "Threads selected." >&4
-       case "$archname" in
-        *-thread*) echo "...and architecture name already has -thread." >&4
-                ;;
-        *)      archname="$archname-thread"
-                echo "...setting architecture name to $archname." >&4
-                ;;
-        esac
-       ;;
-esac
-case "$usemultiplicity" in
-$define)
-       echo "Multiplicity selected." >&4
-       case "$archname" in
-        *-multi*) echo "...and architecture name already has -multi." >&4
-                ;;
-        *)      archname="$archname-multi"
-                echo "...setting architecture name to $archname." >&4
-                ;;
-        esac
-       ;;
-esac
-case "$use64bitint" in
-$define)
-       case "$archname64" in
-       '')
+$rm -f gnulibc*
+set d_gnulibc
+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")
+               echo " "
+               echo "nm probably won't work on the GNU C Library." >&4
+               dflt=n
                ;;
-       *)
-               case "$archname" in
-               *-$archname64*) echo "...and architecture name already has $archname64." >&4
-                       ;;
-               *)      archname="$archname-$archname64"
-                       echo "...setting architecture name to $archname." >&4
-                       ;;
-               esac
+       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
-esac
-
-: determine root of directory hierarchy where package will be installed.
-case "$prefix" in
-'')
-       dflt=`./loc . /usr/local /usr/local /local /opt /usr`
        ;;
 *)
-       dflt="$prefix"
+       case "$usenm" in
+       true|$define) dflt=y;;
+       *) dflt=n;;
+       esac
        ;;
 esac
 $cat <<EOM
 
-By default, $package will be installed in $dflt/bin, manual pages
-under $dflt/man, etc..., i.e. with $dflt as prefix for all
-installation directories. Typically 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.
+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.
 
 EOM
-fn=d~
-rp='Installation prefix to use?'
-. ./getfile
-oldprefix=''
-case "$prefix" in
-'') ;;
-*)
-       case "$ans" in
-       "$prefix") ;;
-       *) oldprefix="$prefix";;
+rp="Shall I use $nm to extract C symbols from the libraries?"
+. ./myread
+case "$ans" in
+[Nn]*) usenm=false;;
+*) usenm=true;;
+esac
+
+runnm=$usenm
+case "$reuseval" in
+true) runnm=false;;
+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;;
+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
        ;;
 esac
-prefix="$ans"
-prefixexp="$ansexp"
 
-: is AFS running?
+case "$runnm" in
+true)
+: get list of predefined functions in a handy place
 echo " "
-case "$afs" in
-$define|true)  afs=true ;;
-$undef|false)  afs=false ;;
-*)     if test -d /afs; then
-               afs=true
-       else
-               afs=false
-       fi
+case "$libc" in
+'') libc=unknown
+       case "$libs" in
+       *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
+       esac
        ;;
 esac
-if $afs; then
-       echo "AFS may be running... I'll be extra cautious then..." >&4
+libnames='';
+case "$libs" in
+'') ;;
+*)  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
+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
+       ;;
+*)
+       set blurfl
+       ;;
+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
-       echo "AFS does not seem to be running..." >&4
+       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
 
-: determine installation prefix for where package is to be installed.
-if $afs; then 
-$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).
+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
-       case "$installprefix" in
-       '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installprefix";;
-       esac
 else
-$cat <<EOM
+       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:
 
-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.
+EOM
+       $sed 's/^/      /' libpath
+       cat <<EOM
+
+None of these seems to contain your C library. I need to get its name...
 
 EOM
-       case "$installprefix" in
-       '') dflt=$prefix ;;
-       *) dflt=$installprefix;;
-       esac
 fi
-fn=d~
-rp='What installation prefix should I use for installing files?'
+fn=f
+rp='Where is your C library?'
 . ./getfile
-installprefix="$ans"
-installprefixexp="$ansexp"
+libc="$ans"
 
-: 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'
+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
 
-: get the patchlevel
-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`
-else
-       revision=0
-       patchlevel=0
-       subversion=0
-       api_revision=0
-       api_version=0
-       api_subversion=0
+$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
+       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
-$echo $n "(You have $package revision $revision" $c
-$echo $n " patchlevel $patchlevel" $c
-test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
-echo ".)"
-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
-: 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'
+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
-
-: 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
+$rm -f libnames libpath
 
-: 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
+: 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"'
 
-There are some auxiliary files for $package that need to be put into a
-private library directory that is accessible by everyone.
+: 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'
 
-EOM
-fn=d~+
-rp='Pathname where the private library files will reside?'
-. ./getfile
-privlib="$ans"
-privlibexp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
-else
-       installprivlib="$privlibexp"
-fi
+: see if sqrtl exists
+set sqrtl d_sqrtl
+eval $inlibc
 
-: set the prefixup variable, to restore leading tilda escape
-prefixup='case "$prefixexp" in
-"$prefix") ;;
-*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
-esac'
+case "$ccflags" in
+*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
+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"
-    ;;
+case "$uselongdouble" in
+$define|true|[yY]*)    dflt='y';;
+*) dflt='n';;
 esac
-$cat <<EOM
+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.
+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
-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
-
-
-: 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
+rp='Try to use long doubles if available?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define"   ;;
+*)      val="$undef"   ;;
+esac
+set uselongdouble
+eval $setvar
 
-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.
+case "$uselongdouble" in
+true|[yY]*) uselongdouble="$define" ;;
+esac
 
+case "$uselongdouble" in
+$define)
+: Look for a hint-file generated 'call-back-unit'.  If the
+: user has specified that long doubles should be used,
+: we may need to set or change some other defaults.
+       if $test -f uselongdouble.cbu; then
+               echo "Your platform has some specific hints for long doubles, using them..."
+               . ./uselongdouble.cbu
+       else
+               $cat <<EOM
+(Your platform doesn't have any specific hints for long doubles.)
 EOM
-       case "$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
+       fi
        ;;
 esac
 
+case "$uselongdouble:$d_sqrtl" in
+$define:$undef)
+               $cat <<EOM >&4
 
-: see if setuid scripts can be secure
-$cat <<EOM
-
-Some kernels have a bug that prevents setuid #! scripts from being
-secure.  Some sites have disabled setuid #! scripts because of this.
-
-First let's decide if your kernel supports secure setuid #! scripts.
-(If setuid #! scripts would be secure but have been disabled anyway,
-don't say that they are secure if asked.)
+*** You requested the use of long doubles but you do not seem to have
+*** the mathematic functions for long doubles.  I'm disabling the use
+*** of long doubles.
 
 EOM
+       uselongdouble=$undef
+       ;;
+esac
 
-val="$undef"
-if $test -d /dev/fd; then
-       echo "#!$ls" >reflect
-       chmod +x,u+s reflect
-       ./reflect >flect 2>&1
-       if $contains "/dev/fd" flect >/dev/null; then
-               echo "Congratulations, your kernel has secure setuid scripts!" >&4
-               val="$define"
-       else
-               $cat <<EOM
-If you are not sure if they are secure, I can check but I'll need a
-username and password different from the one you are using right now.
-If you don't have such a username or don't want me to test, simply
-enter 'none'.
-
-EOM
-               rp='Other username to test security of setuid scripts with?'
-               dflt='none'
-               . ./myread
-               case "$ans" in
-               n|none)
-                       case "$d_suidsafe" in
-                       '')     echo "I'll assume setuid scripts are *not* secure." >&4
-                               dflt=n;;
-                       "$undef")
-                               echo "Well, the $hint value is *not* secure." >&4
-                               dflt=n;;
-                       *)      echo "Well, the $hint value *is* secure." >&4
-                               dflt=y;;
-                       esac
-                       ;;
-               *)
-                       $rm -f reflect flect
-                       echo "#!$ls" >reflect
-                       chmod +x,u+s reflect
-                       echo >flect
-                       chmod a+w flect
-                       echo '"su" will (probably) prompt you for '"$ans's password."
-                       su $ans -c './reflect >flect'
-                       if $contains "/dev/fd" flect >/dev/null; then
-                               echo "Okay, it looks like setuid scripts are secure." >&4
-                               dflt=y
-                       else
-                               echo "I don't think setuid scripts are secure." >&4
-                               dflt=n
-                       fi
-                       ;;
-               esac
-               rp='Does your kernel have *secure* setuid scripts?'
+: check for length of double
+echo " "
+case "$doublesize" in
+'')
+       echo "Checking to see how big your double precision numbers are..." >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof(double));
+    exit(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               doublesize=`./try`
+               echo "Your double is $doublesize bytes long."
+       else
+               dflt='8'
+               echo "(I can't seem to compile the test program.  Guessing...)"
+               rp="What is the size of a double precision number (in bytes)?"
                . ./myread
-               case "$ans" in
-               [yY]*)  val="$define";;
-               *)      val="$undef";;
-               esac
+               doublesize="$ans"
        fi
+       ;;
+esac
+$rm -f try.c try
+
+: check for long doubles
+echo " "
+echo "Checking to see if you have long double..." >&4
+echo 'int main() { long double x = 7.0; }' > try.c
+set try
+if eval $compile; then
+       val="$define"
+       echo "You have long double."
 else
-       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"
+       echo "You do not have long double."
 fi
-set d_suidsafe
+$rm try.*
+set d_longdbl
 eval $setvar
 
-$rm -f reflect flect
-
-: now see if they want to do setuid emulation
-echo " "
-val="$undef"
-case "$d_suidsafe" in
-"$define")
-       val="$undef"
-       echo "No need to emulate SUID scripts since they are secure here." >& 4
-       ;;
-*)
-       $cat <<EOM
-Some systems have disabled setuid scripts, especially systems where
-setuid scripts cannot be secure.  On systems where setuid scripts have
-been disabled, the setuid/setgid bits on scripts are currently
-useless.  It is possible for $package to detect those bits and emulate
-setuid/setgid in a secure fashion.  This emulation will only work if
-setuid scripts have been disabled in your kernel.
-
-EOM
-       case "$d_dosuid" in
-       "$define") dflt=y ;;
-       *) dflt=n ;;
-       esac
-       rp="Do you want to do setuid/setgid emulation?"
-       . ./myread
-       case "$ans" in
-       [yY]*)  val="$define";;
-       *)      val="$undef";;
-       esac
+: check for length of long double
+case "${d_longdbl}${longdblsize}" in
+$define)
+       echo " "
+       echo "Checking to see how big your long doubles are..." >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+       printf("%d\n", sizeof(long double));
+}
+EOCP
+       set try
+       set try
+       if eval $compile; then
+               longdblsize=`./try$exe_ext`
+               echo "Your long doubles are $longdblsize bytes long."
+       else
+               dflt='8'
+               echo " "
+               echo "(I can't seem to compile the test program.  Guessing...)" >&4
+               rp="What is the size of a long double (in bytes)?"
+               . ./myread
+               longdblsize="$ans"
+       fi
+       if $test "X$doublesize" = "X$longdblsize"; then
+               echo "(That isn't any different from an ordinary double.)"
+       fi      
        ;;
 esac
-set d_dosuid
-eval $setvar
+$rm -f try.* try
 
-: determine filename position in cpp output
+: determine the architecture name
 echo " "
-echo "Computing filename position in cpp output for #include directives..." >&4
-echo '#include <stdio.h>' > foo.c
-$cat >fieldn <<EOF
-$startsh
-$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
-$grep '^[      ]*#.*stdio\.h' | \
-while read cline; do
-       pos=1
-       set \$cline
-       while $test \$# -gt 0; do
-               if $test -r \`echo \$1 | $tr -d '"'\`; then
-                       echo "\$pos"
-                       exit 0
-               fi
-               shift
-               pos=\`expr \$pos + 1\`
-       done
-done
-EOF
-chmod +x fieldn
-fieldn=`./fieldn`
-$rm -f foo.c fieldn
-case $fieldn in
-'') pos='???';;
-1) pos=first;;
-2) pos=second;;
-3) pos=third;;
-*) pos="${fieldn}th";;
-esac
-echo "Your cpp writes the filename in the $pos field of the line."
-
-: locate header file
-$cat >findhdr <<EOF
-$startsh
-wanted=\$1
-name=''
-for usrincdir in $usrinc
-do
-       if test -f \$usrincdir/\$wanted; then
-               echo "\$usrincdir/\$wanted"
-               exit 0
+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
-done
-awkprg='{ print \$$fieldn }'
-echo "#include <\$wanted>" > foo\$\$.c
-$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
-$grep "^[      ]*#.*\$wanted" | \
-while read cline; do
-       name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
-       case "\$name" in
-       *[/\\\\]\$wanted) echo "\$name"; exit 1;;
-       *[\\\\/]\$wanted) echo "\$name"; exit 1;;
-       *) exit 2;;
-       esac;
-done;
-#
-# status = 0: grep returned 0 lines, case statement not executed
-# status = 1: headerfile found
-# status = 2: while loop executed, no headerfile found
-#
-status=\$?
-$rm -f foo\$\$.c;
-if test \$status -eq 1; then
-       exit 0;
+       $rm -f tmparch
+else
+       tarch="$osname"
 fi
-exit 1
-EOF
-chmod +x findhdr
-
-: define an alternate in-header-list? function
-inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
-cont=true; xxf="echo \"<\$1> found.\" >&4";
-case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
-*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
-esac;
-case $# in 4) instead=instead;; *) instead="at last";; esac;
-while $test "$cont"; do
-       xxx=`./findhdr $1`
-       var=$2; eval "was=\$$2";
-       if $test "$xxx" && $test -r "$xxx";
-       then eval $xxf;
-       eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
-               cont="";
-       else eval $xxnf;
-       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
-       set $yyy; shift; shift; yyy=$@;
-       case $# in 0) cont="";;
-       2) xxf="echo \"but I found <\$1> $instead.\" >&4";
-               xxnf="echo \"and I did not find <\$1> either.\" >&4";;
-       *) xxf="echo \"but I found <\$1\> instead.\" >&4";
-               xxnf="echo \"there is no <\$1>, ...\" >&4";;
-       esac;
-done;
-while $test "$yyy";
-do set $yyy; var=$2; eval "was=\$$2";
-       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
-       set $yyy; shift; shift; yyy=$@;
-done'
-
-: see if this is a malloc.h system
-set malloc.h i_malloc
-eval $inhdr
-
-: see if stdlib is available
-set stdlib.h i_stdlib
-eval $inhdr
-
-: determine which malloc to compile in
-echo " "
-case "$usemymalloc" in
-''|[yY]*|true|$define) dflt='y' ;;
-*)     dflt='n' ;;
+case "$myarchname" in
+''|"$tarch") ;;
+*)
+       echo "(Your architecture name used to be $myarchname.)"
+       archname=''
+       ;;
+esac
+myarchname="$tarch"
+case "$archname" in
+'') dflt="$tarch";;
+*) dflt="$archname";;
+esac
+rp='What is your architecture name'
+. ./myread
+archname="$ans"
+case "$usethreads" in
+$define)
+       echo "Threads selected." >&4
+       case "$archname" in
+        *-thread*) echo "...and architecture name already has -thread." >&4
+                ;;
+        *)      archname="$archname-thread"
+                echo "...setting architecture name to $archname." >&4
+                ;;
+        esac
+       ;;
+esac
+case "$usemultiplicity" in
+$define)
+       echo "Multiplicity selected." >&4
+       case "$archname" in
+        *-multi*) echo "...and architecture name already has -multi." >&4
+                ;;
+        *)      archname="$archname-multi"
+                echo "...setting architecture name to $archname." >&4
+                ;;
+        esac
+       ;;
 esac
-rp="Do you wish to attempt to use the malloc that comes with $package?"
-. ./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
+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
+esac
+case "$uselongdouble" in
+$define)
+       echo "Long doubles selected." >&4
+       case "$longdblsize" in
+       $doublesize)
+               "...but long doubles are equal to doubles, not changing architecture name." >&4
+               ;;
+       *)
+               case "$archname" in
+               *-ld*) echo "...and architecture name already has -ld." >&4
+                       ;;
+               *)      archname="$archname-ld"
+                       echo "...setting architecture name to $archname." >&4
+                       ;;
+               esac
+               ;;
+       esac
+       ;;
+esac
+
+: determine root of directory hierarchy where package will be installed.
+case "$prefix" in
+'')
+       dflt=`./loc . /usr/local /usr/local /local /opt /usr`
        ;;
 *)
-       usemymalloc='n'
-       mallocsrc=''
-       mallocobj=''
-       d_mymalloc="$undef"
+       dflt="$prefix"
        ;;
 esac
+$cat <<EOM
 
-: 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
+By default, $package will be installed in $dflt/bin, manual pages
+under $dflt/man, etc..., i.e. with $dflt as prefix for all
+installation directories. Typically this is something like /usr/local.
+If you wish to have binaries under /usr/bin but other parts of the
+installation under /usr/local, that's ok: you will be prompted
+separately for each of the installation directories, the prefix being
+only used to set the defaults.
+
+EOM
+fn=d~
+rp='Installation prefix to use?'
+. ./getfile
+oldprefix=''
+case "$prefix" in
+'') ;;
+*)
+       case "$ans" in
+       "$prefix") ;;
+       *) oldprefix="$prefix";;
+       esac
        ;;
 esac
-echo "Your system wants malloc to return '$malloctype', it would seem." >&4
+prefix="$ans"
+prefixexp="$ansexp"
 
-case "$freetype" in
-'')
-       if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
-               freetype='void'
+: is AFS running?
+echo " "
+case "$afs" in
+$define|true)  afs=true ;;
+$undef|false)  afs=false ;;
+*)     if test -d /afs; then
+               afs=true
        else
-               freetype='int'
+               afs=false
        fi
        ;;
 esac
-echo "Your system uses $freetype free(), it would seem." >&4
-$rm -f malloc.[co]
+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
+
+: determine installation prefix for where package is to be installed.
+if $afs; then 
 $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.
+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).
 
-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.
+EOM
+       case "$installprefix" in
+       '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
+       *) dflt="$installprefix";;
+       esac
+else
+$cat <<EOM
 
-The default should be fine for most people.
+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.
 
 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";;
+       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'
+
+
+: get the patchlevel
+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`
+else
+       revision=0
+       patchlevel=0
+       subversion=0
+       api_revision=0
+       api_version=0
+       api_subversion=0
+fi
+$echo "(You have $package version $patchlevel subversion $subversion.)"
+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
-siteprefix="$ans"
-siteprefixexp="$ansexp"
+: 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
 
-: 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 ;;
+: 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="$sitelib"
-       ;;
+*)     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
 
-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.
+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 for the site-specific library files?'
+rp='Pathname where the private library files will reside?'
 . ./getfile
-sitelib="$ans"
-sitelibexp="$ansexp"
-sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
+privlib="$ans"
+privlibexp="$ansexp"
 : Change installation prefix, if necessary.
 if $test X"$prefix" != X"$installprefix"; then
-       installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
+       installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
 else
-       installsitelib="$sitelibexp"
+       installprivlib="$privlibexp"
 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="$sitearch"
+: 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
-set sitearch sitearch none
-eval $prefixit
 $cat <<EOM
 
-The installation process will also create a directory for
-architecture-dependent site-specific extensions and modules.
+$spackage contains architecture-dependent library files.  If you are
+sharing libraries in a heterogeneous environment, you might store
+these files in a separate location.  Otherwise, you can just include
+them with the rest of the public library files.
 
 EOM
-fn=d~+
-rp='Pathname for the site-specific architecture-dependent library files?'
+fn=d+~
+rp='Where do you want to put the public architecture-dependent libraries?'
 . ./getfile
-sitearch="$ans"
-sitearchexp="$ansexp"
+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
-       installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
+       installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
 else
-       installsitearch="$sitearchexp"
+       installarchlib="$archlibexp"
 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.
+: 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
 
-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.
+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
-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
-. ./myread
-case "$ans" in
-[yY]*) fn=d~+
-       rp='Installation prefix to use for vendor-supplied add-ons?'
-       case "$vendorprefix" in
-       '') dflt='' ;;
-       *)  dflt=$vendorprefix ;;
+       case "$bincompat5005$d_bincompat5005" in
+       *"$undef"*) dflt=n ;;
+       *) dflt=y ;;
        esac
-       . ./getfile
-       : XXX Prefixit unit does not yet support siteprefix and vendorprefix
-       oldvendorprefix=''
-       case "$vendorprefix" in
-       '') ;;
-       *)      case "$ans" in
-               "$prefix") ;;
-               *) oldvendorprefix="$prefix";;
-               esac
-               ;;
+       rp='Binary compatibility with Perl 5.005?'
+       . ./myread
+       case "$ans" in
+       y*) val="$define" ;;
+       *)  val="$undef" ;;
        esac
-       usevendorprefix="$define"
-       vendorprefix="$ans"
-       vendorprefixexp="$ansexp"
-       ;;
-*)     usevendorprefix="$undef"
-       vendorprefix=''
-       vendorprefixexp=''
-       ;;
-esac
-
-case "$vendorprefix" in
-'')    d_vendorlib="$undef"
-       vendorlib=''
-       vendorlibexp=''
-       ;;
-*)     d_vendorlib="$define"
-       : determine where vendor-supplied modules go.
-       : Usual default is /usr/local/lib/perl5/vendor_perl/$version
-       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
+       set d_bincompat5005
+       eval $setvar
+       case "$d_bincompat5005" in
+       "$define")
+               bincompat5005="$define"
                ;;
-       *)      dflt="$vendorlib"
+       *)      bincompat5005="$undef"
+               d_bincompat5005="$undef"
                ;;
        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
 
-: Final catch-all directories to search
+: see if setuid scripts can be secure
 $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 
+Some kernels have a bug that prevents setuid #! scripts from being
+secure.  Some sites have disabled setuid #! scripts because of this.
+
+First let's decide if your kernel supports secure setuid #! scripts.
+(If setuid #! scripts would be secure but have been disabled anyway,
+don't say that they are secure if asked.)
+
 EOM
-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.
+
+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='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"
+               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
+       fi
 else
-       echo "Your C compiler doesn't seem to understand function prototypes."
+       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 prototype
+set d_suidsafe
 eval $setvar
-$rm -f prototype*
-
-case "$prototype" in
-"$define") ;;
-*)     ansi2knr='ansi2knr'
-       echo " "
-       cat <<EOM >&4
 
-$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.  
+$rm -f reflect flect
 
-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>.
+: now see if they want to do setuid emulation
+echo " "
+val="$undef"
+case "$d_suidsafe" in
+"$define")
+       val="$undef"
+       echo "No need to emulate SUID scripts since they are secure here." >& 4
+       ;;
+*)
+       $cat <<EOM
+Some systems have disabled setuid scripts, especially systems where
+setuid scripts cannot be secure.  On systems where setuid scripts have
+been disabled, the setuid/setgid bits on scripts are currently
+useless.  It is possible for $package to detect those bits and emulate
+setuid/setgid in a secure fashion.  This emulation will only work if
+setuid scripts have been disabled in your kernel.
 
-Aborting Configure now.
 EOM
-       exit 2
+       case "$d_dosuid" in
+       "$define") dflt=y ;;
+       *) dflt=n ;;
+       esac
+       rp="Do you want to do setuid/setgid emulation?"
+       . ./myread
+       case "$ans" in
+       [yY]*)  val="$define";;
+       *)      val="$undef";;
+       esac
        ;;
 esac
+set d_dosuid
+eval $setvar
 
-: determine where public executables go
+: determine filename position in cpp output
 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
-
-: Find perl5.005 or later.
-echo "Looking for a previously installed perl5.005 or later... "
-case "$perl5" in
-'')    for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
-               : Check if this perl is recent and can load a simple module
-               if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
-                       perl5=$tdir/perl
-                       break;
-               elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
-                       perl5=$tdir/perl
-                       break;
+echo "Computing filename position in cpp output for #include directives..." >&4
+echo '#include <stdio.h>' > foo.c
+$cat >fieldn <<EOF
+$startsh
+$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
+$grep '^[      ]*#.*stdio\.h' | \
+while read cline; do
+       pos=1
+       set \$cline
+       while $test \$# -gt 0; do
+               if $test -r \`echo \$1 | $tr -d '"'\`; then
+                       echo "\$pos"
+                       exit 0
                fi
+               shift
+               pos=\`expr \$pos + 1\`
        done
+done
+EOF
+chmod +x fieldn
+fieldn=`./fieldn`
+$rm -f foo.c fieldn
+case $fieldn in
+'') pos='???';;
+1) pos=first;;
+2) pos=second;;
+3) pos=third;;
+*) pos="${fieldn}th";;
+esac
+echo "Your cpp writes the filename in the $pos field of the line."
+
+: locate header file
+$cat >findhdr <<EOF
+$startsh
+wanted=\$1
+name=''
+for usrincdir in $usrinc
+do
+       if test -f \$usrincdir/\$wanted; then
+               echo "\$usrincdir/\$wanted"
+               exit 0
+       fi
+done
+awkprg='{ print \$$fieldn }'
+echo "#include <\$wanted>" > foo\$\$.c
+$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
+$grep "^[      ]*#.*\$wanted" | \
+while read cline; do
+       name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
+       case "\$name" in
+       *[/\\\\]\$wanted) echo "\$name"; exit 1;;
+       *[\\\\/]\$wanted) echo "\$name"; exit 1;;
+       *) exit 2;;
+       esac;
+done;
+#
+# status = 0: grep returned 0 lines, case statement not executed
+# status = 1: headerfile found
+# status = 2: while loop executed, no headerfile found
+#
+status=\$?
+$rm -f foo\$\$.c;
+if test \$status -eq 1; then
+       exit 0;
+fi
+exit 1
+EOF
+chmod +x findhdr
+
+: define an alternate in-header-list? function
+inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
+cont=true; xxf="echo \"<\$1> found.\" >&4";
+case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
+*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
+esac;
+case $# in 4) instead=instead;; *) instead="at last";; esac;
+while $test "$cont"; do
+       xxx=`./findhdr $1`
+       var=$2; eval "was=\$$2";
+       if $test "$xxx" && $test -r "$xxx";
+       then eval $xxf;
+       eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
+               cont="";
+       else eval $xxnf;
+       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
+       set $yyy; shift; shift; yyy=$@;
+       case $# in 0) cont="";;
+       2) xxf="echo \"but I found <\$1> $instead.\" >&4";
+               xxnf="echo \"and I did not find <\$1> either.\" >&4";;
+       *) xxf="echo \"but I found <\$1\> instead.\" >&4";
+               xxnf="echo \"there is no <\$1>, ...\" >&4";;
+       esac;
+done;
+while $test "$yyy";
+do set $yyy; var=$2; eval "was=\$$2";
+       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
+       set $yyy; shift; shift; yyy=$@;
+done'
+
+: see if this is a malloc.h system
+set malloc.h i_malloc
+eval $inhdr
+
+: see if stdlib is available
+set stdlib.h i_stdlib
+eval $inhdr
+
+: determine which malloc to compile in
+echo " "
+case "$usemymalloc" in
+''|[yY]*|true|$define) dflt='y' ;;
+*)     dflt='n' ;;
+esac
+rp="Do you wish to attempt to use the malloc that comes with $package?"
+. ./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
        ;;
-*)     perl5="$perl5"
+*)
+       usemymalloc='n'
+       mallocsrc=''
+       mallocobj=''
+       d_mymalloc="$undef"
        ;;
 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.
-    }
-}
 
-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"; then
-               dflt=`$perl5 getverlist`
+: 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
-               dflt='none'
+               malloctype='char *'
        fi
        ;;
-$undef) dflt='none' ;;
-*)  dflt="$inc_version_list" ;;
 esac
-case "$dflt" in
-''|' ') dflt=none ;;
+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
-$cat <<'EOM'
+echo "Your system uses $freetype free(), it would seem." >&4
+$rm -f malloc.[co]
+$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.
+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.
 
-The default should almost always be sensible, so if you're not sure,
-just accept the default.
-EOM
+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.
 
-rp='List of earlier versions to include in @INC?'
-. ./myread
-case "$ans" in
-[Nn]one|''|' ') inc_version_list=' ' ;;
-*) inc_version_list="$ans" ;;
+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
-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/'`
+. ./getfile
+: XXX Prefixit unit does not yet support siteprefix and vendorprefix
+oldsiteprefix=''
+case "$siteprefix" in
+'') ;;
+*)     case "$ans" in
+       "$prefix") ;;
+       *) oldsiteprefix="$prefix";;
+       esac
        ;;
 esac
-$rm -f getverlist
+siteprefix="$ans"
+siteprefixexp="$ansexp"
 
-: determine whether to install perl also as /usr/bin/perl
+: 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
+       ;;
+*)     dflt="$sitelib"
+       ;;
+esac
+$cat <<EOM
+
+The installation process will create a directory for
+site-specific extensions and modules.  Most users find it convenient
+to place all site-specific files in this directory rather than in the
+main distribution directory.
 
-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).
 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" ;;
-       esac
+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
-       val="$undef"
+       installsitelib="$sitelibexp"
 fi
-set installusrbinperl
-eval $setvar
 
-echo " "
-echo "Checking for GNU C Library..." >&4
-cat >gnulibc.c <<EOM
-#include <stdio.h>
-int main()
-{
-#ifdef __GLIBC__
-    exit(0);
-#else
-    exit(1);
-#endif
-}
+: 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
+
+The installation process will also create a directory for
+architecture-dependent site-specific extensions and modules.
+
 EOM
-set gnulibc
-if eval $compile_ok && ./gnulibc; then
-       val="$define"
-       echo "You are using the GNU C Library"
+fn=d~+
+rp='Pathname for the site-specific architecture-dependent library files?'
+. ./getfile
+sitearch="$ans"
+sitearchexp="$ansexp"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
 else
-       val="$undef"
-       echo "You are not using the GNU C Library"
+       installsitearch="$sitearchexp"
 fi
-$rm -f gnulibc*
-set d_gnulibc
-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")
-               echo " "
-               echo "nm probably won't work on the GNU C Library." >&4
-               dflt=n
-               ;;
+$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
-       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
+. ./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
-       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
+       usevendorprefix="$define"
+       vendorprefix="$ans"
+       vendorprefixexp="$ansexp"
+       ;;
+*)     usevendorprefix="$undef"
+       vendorprefix=''
+       vendorprefixexp=''
+       ;;
+esac
+
+case "$vendorprefix" in
+'')    d_vendorlib="$undef"
+       vendorlib=''
+       vendorlibexp=''
+       ;;
+*)     d_vendorlib="$define"
+       : determine where vendor-supplied modules go.
+       : Usual default is /usr/local/lib/perl5/vendor_perl/$version
+       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"
        ;;
-*)
-       case "$usenm" in
-       true|$define) dflt=y;;
-       *) dflt=n;;
+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
-$cat <<EOM
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
+else
+       installvendorarch="$vendorarchexp"
+fi
 
-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.
+: Final catch-all directories to search
+$cat <<EOM
 
-You probably shouldn't let me use 'nm' if you are using the GNU C Library.
+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.
 
 EOM
-rp="Shall I use $nm to extract C symbols from the libraries?"
+
+rp='Colon-separated list of additional directories for perl to search?'
 . ./myread
 case "$ans" in
-[Nn]*) usenm=false;;
-*) usenm=true;;
+' '|''|none)   otherlibdirs=' ' ;;     
+*)     otherlibdirs="$ans" ;;
 esac
-
-runnm=$usenm
-case "$reuseval" in
-true) runnm=false;;
+case "$otherlibdirs" in
+' ') val=$undef ;;
+*)     val=$define ;;
 esac
+set d_perl_otherlibdirs
+eval $setvar
 
-: 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;;
-esac
+: 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*
 
-: 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
+case "$prototype" in
+"$define") ;;
+*)     ansi2knr='ansi2knr'
+       echo " "
+       cat <<EOM >&4
+
+$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
 
-case "$runnm" in
-true)
-: get list of predefined functions in a handy place
+: determine where public executables go
 echo " "
-case "$libc" in
-'') libc=unknown
-       case "$libs" in
-       *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
-       esac
-       ;;
-esac
-libnames='';
-case "$libs" in
-'') ;;
-*)  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=''
+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
+
+: Find perl5.005 or later.
+echo "Looking for a previously installed perl5.005 or later... "
+case "$perl5" in
+'')    for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
+               : Check if this perl is recent and can load a simple module
+               if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
+                       perl5=$tdir/perl
+                       break;
+               elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
+                       perl5=$tdir/perl
+                       break;
                fi
-               libnames="$libnames $try"
-               ;;
-       *) 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
        ;;
-*)
-       set blurfl
+*)     perl5="$perl5"
        ;;
 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
-fi
-if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
-       dflt="$libc"
-       cat <<EOM
+case "$perl5" in
+'')    echo "None found.  That's ok.";;
+*)     echo "Using $perl5." ;;
+esac
 
-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.
+: 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 = ();
+}
 
-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:
+# 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.
+    }
+}
 
-EOM
-       $sed 's/^/      /' libpath
-       cat <<EOM
+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"; then
+               dflt=`$perl5 getverlist`
+       else
+               dflt='none'
+       fi
+       ;;
+$undef) dflt='none' ;;
+*)  dflt="$inc_version_list" ;;
+esac
+case "$dflt" in
+''|' ') dflt=none ;;
+esac
+case "$dflt" in
+5.005) case "$bincompat5005" in
+       $define|true|[yY]*) ;;
+       *) dflt=none ;;
+       esac
+       ;;
+esac
+$cat <<'EOM'
 
-None of these seems to contain your C library. I need to get its name...
+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
-fi
-fn=f
-rp='Where is your C library?'
-. ./getfile
-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
+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
 
-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;;
+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).
+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" ;;
        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' -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
-       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"
-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
+       val="$undef"
 fi
-;;
-esac
-$rm -f libnames libpath
+set installusrbinperl
+eval $setvar
 
 : see if dld is available
 set dld.h i_dld
 eval $inhdr
 
-: 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 $optimize $ccflags $ldflags -o t 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"'
-
-: 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'
-
 : see if dlopen exists
 xxx_runnm="$runnm"
 runnm=false
@@ -6348,13 +6381,13 @@ EOM
                        hpux)   dflt='+z' ;;
                        next)   dflt='none' ;;
                        irix*)  dflt='-KPIC' ;;
-                       svr4*|esix*|solaris) dflt='-KPIC' ;;
+                       svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
                        sunos)  dflt='-pic' ;;
                        *)      dflt='none' ;;
                    esac
                        ;;
                *)  case "$osname" in
-                       svr4*|esix*|solaris) dflt='-fPIC' ;;
+                       svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
                        *)      dflt='-fpic' ;;
                    esac ;;
            esac ;;
@@ -6430,7 +6463,7 @@ EOM
                        next)  dflt='none' ;;
                        solaris) dflt='-G' ;;
                        sunos) dflt='-assert nodefinitions' ;;
-                       svr4*|esix*) dflt="-G $ldflags" ;;
+                       svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
                *)     dflt='none' ;;
                        esac
                        ;;
@@ -6444,7 +6477,7 @@ EOM
        esac
        for thisflag in $ldflags; do
                case "$thisflag" in
-               -L*)
+               -L*|-R*)
                        case " $dflt " in
                        *" $thisflag "*) ;;
                        *) dflt="$dflt $thisflag" ;;
@@ -6505,7 +6538,7 @@ $undef)
        ;;
 *)     case "$useshrplib" in
        '')     case "$osname" in
-               svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
+               svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
                        dflt=y
                        also='Building a shared libperl is required for dynamic loading to work on your system.'
                        ;;
@@ -6619,7 +6652,7 @@ 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.com)
+will not work in this version.  Let me (perlbug@perl.org)
 know of any problems this may cause.
 
 EOM
@@ -6710,6 +6743,24 @@ case "$ldlibpthname" in
 none)  ldlibpthname='' ;;
 esac
 
+: determine where manual pages are on this system
+echo " "
+case "$sysman" in
+'') 
+       syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
+       syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
+       syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
+       syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
+       syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
+       sysman=`./loc . /usr/man/man1 $syspath`
+       ;;
+esac
+if $test -d "$sysman"; then
+       echo "System manual is in $sysman." >&4
+else
+       echo "Could not find manual pages in source form." >&4
+fi
+
 : determine where manual pages go
 set man1dir man1dir none
 eval $prefixit
@@ -7076,18 +7127,23 @@ case "$myhostname" in
                                        /[       ]$myhostname[  . ]/p" > hosts
                }
                tmp_re="[       . ]"
-               $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
+               if $test -f hosts; then
+                       $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
                             END { print sum }" hosts` = x1 || tmp_re="[         ]"
-               dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
-                       hosts | $sort | $uniq | \
-                       $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
-               case `$echo X$dflt` in
-               X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
+                       dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
+                               hosts | $sort | $uniq | \
+                               $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
+                       case `$echo X$dflt` in
+                       X*\ *)  echo "(Several hosts in the database matched hostname)"
+                               dflt=.
+                               ;;
+                       X.) echo "(You do not have fully-qualified names in the hosts database)"
+                               ;;
+                       esac
+               else
+                       echo "(I cannot locate a hosts database anywhere)"
                        dflt=.
-                       ;;
-               X.) echo "(You do not have fully-qualified names in /etc/hosts)"
-                       ;;
-               esac
+               fi
                case "$dflt" in
                .)
                        tans=`./loc resolv.conf X /etc /usr/etc`
@@ -7203,7 +7259,7 @@ $cat <<EOM
 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.com. You may
+will send mail to this address in addition to perlbug@perl.org. You may
 enter "none" for no administrator.
 
 EOM
@@ -7215,6 +7271,25 @@ rp='Perl administrator e-mail address'
 . ./myread
 perladmin="$ans"
 
+: determine whether to only install version-specific parts.
+echo " "
+$cat <<EOM
+Do you want to install only the version-specific parts of the perl
+distribution?  Usually you do *not* want to do this.
+EOM
+case "$versiononly" in
+"$define"|[Yy]*|true) dflt='y' ;;
+*) dflt='n';
+esac
+rp="Do you want to install only the version-specific parts of perl?"
+. ./myread
+case "$ans" in
+[yY]*) val="$define";;
+*)     val="$undef" ;;
+esac
+set versiononly
+eval $setvar
+
 : figure out how to guarantee perl startup
 case "$startperl" in
 '')
@@ -7229,7 +7304,10 @@ want to share those scripts and perl is not in a standard place
 a shell by starting the script with a single ':' character.
 
 EOH
-               dflt="$binexp/perl"
+               case "$versiononly" in
+               "$define")      dflt="$binexp/perl$version";;  
+               *)              dflt="$binexp/perl";;
+               esac
                rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
                . ./myread
                case "$ans" in
@@ -7339,67 +7417,6 @@ else
        installsitebin="$sitebinexp"
 fi
 
-: see if sqrtl exists
-set sqrtl d_sqrtl
-eval $inlibc
-
-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
-eval $setvar
-
-case "$uselongdouble" in
-true|[yY]*) uselongdouble="$define" ;;
-esac
-
-case "$uselongdouble" in
-$define)
-: Look for a hint-file generated 'call-back-unit'.  If the
-: user has specified that long doubles should be used,
-: we may need to set or change some other defaults.
-       if $test -f uselongdouble.cbu; then
-               echo "Your platform has some specific hints for long doubles, using them..."
-               . ./uselongdouble.cbu
-       else
-               $cat <<EOM
-(Your platform doesn't have any specific hints for long doubles.)
-EOM
-       fi
-       ;;
-esac
-
-case "$uselongdouble:$d_sqrtl" in
-$define:$undef)
-               $cat <<EOM >&4
-
-*** You requested the use of long doubles but you do not seem to have
-*** the mathematic functions for long doubles.  I'm disabling the use
-*** of long doubles.
-
-EOM
-       uselongdouble=$undef
-       ;;
-esac
-
 case "$useperlio" in
 $define|true|[yY]*)    dflt='y';;
 *) dflt='n';;
@@ -7459,82 +7476,6 @@ fi
 set qgcvt d_qgcvt
 eval $inlibc
 
-: check for length of double
-echo " "
-case "$doublesize" in
-'')
-       echo "Checking to see how big your double precision numbers are..." >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-    printf("%d\n", (int)sizeof(double));
-    exit(0);
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               doublesize=`./try`
-               echo "Your double is $doublesize bytes long."
-       else
-               dflt='8'
-               echo "(I can't seem to compile the test program.  Guessing...)"
-               rp="What is the size of a double precision number (in bytes)?"
-               . ./myread
-               doublesize="$ans"
-       fi
-       ;;
-esac
-$rm -f try.c try
-
-: check for long doubles
-echo " "
-echo "Checking to see if you have long double..." >&4
-echo 'int main() { long double x = 7.0; }' > try.c
-set try
-if eval $compile; then
-       val="$define"
-       echo "You have long double."
-else
-       val="$undef"
-       echo "You do not have long double."
-fi
-$rm try.*
-set d_longdbl
-eval $setvar
-
-: check for length of long double
-case "${d_longdbl}${longdblsize}" in
-$define)
-       echo " "
-       echo "Checking to see how big your long doubles are..." >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-       printf("%d\n", sizeof(long double));
-}
-EOCP
-       set try
-       set try
-       if eval $compile; then
-               longdblsize=`./try$exe_ext`
-               echo "Your long doubles are $longdblsize bytes long."
-       else
-               dflt='8'
-               echo " "
-               echo "(I can't seem to compile the test program.  Guessing...)" >&4
-               rp="What is the size of a long double (in bytes)?"
-               . ./myread
-               longdblsize="$ans"
-       fi
-       if $test "X$doublesize" = "X$longdblsize"; then
-               echo "(That isn't any different from an ordinary double.)"
-       fi      
-       ;;
-esac
-$rm -f try.* try
-
 echo " "
 
 if $test X"$d_longdbl" = X"$define"; then
@@ -7556,7 +7497,7 @@ EOCP
                case "$yyy" in
                123.456)
                        sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
-                       sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
+                       sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
                        echo "We will use %f."
                        ;;
                esac
@@ -7578,7 +7519,7 @@ EOCP
                case "$yyy" in
                123.456)
                        sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
-                       sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
+                       sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
                        echo "We will use %llf."
                        ;;
                esac
@@ -7600,7 +7541,7 @@ EOCP
                case "$yyy" in
                123.456)
                        sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
-                       sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
+                       sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
                        echo "We will use %Lf."
                        ;;
                esac
@@ -7622,7 +7563,7 @@ EOCP
                case "$yyy" in
                123.456)
                        sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
-                       sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
+                       sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
                        echo "We will use %lf."
                        ;;
                esac
@@ -7631,6 +7572,8 @@ fi
 
 if $test X"$sPRIfldbl" = X; then
        echo "Cannot figure out how to print long doubles." >&4
+else
+       sSCNfldbl=$sPRIfldbl    # expect consistency
 fi
 
 $rm -f try try.*
@@ -7639,28 +7582,29 @@ fi # d_longdbl
 
 case "$sPRIfldbl" in
 '')    d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
-       d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
+       d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
+       d_SCNfldbl="$undef";
        ;;
 *)     d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
-       d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
+       d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
+       d_SCNfldbl="$define";
        ;;
 esac
 
 : Check how to convert floats to strings.
-if test "X$d_Gconvert" = X; then
-       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
+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";
@@ -7755,49 +7699,58 @@ int main()
        Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
        checkit("-100000", buf);
 
+       Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
+       checkit("123.456", buf);
+
        exit(0);
 }
 EOP
-       case "$d_Gconvert" in
-       gconvert*) xxx_list='gconvert gcvt sprintf' ;;
-       gcvt*) xxx_list='gcvt gconvert sprintf' ;;
-       sprintf*) xxx_list='sprintf gconvert gcvt' ;;
-       *) xxx_list='gconvert gcvt sprintf' ;;
-       esac
-
-        case "$d_longdbl$uselongdouble$d_qgcvt" in
-        "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
-       esac
+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
 
-       for xxx_convert in $xxx_list; do
-               echo "Trying $xxx_convert..."
-               $rm -f try try$_o
-               set try -DTRY_$xxx_convert
-               if eval $compile; then
-                       echo "$xxx_convert() found." >&4
-                       if ./try; then
-                               echo "I'll use $xxx_convert to convert floats into a string." >&4
-                               break;
-                       else
-                               echo "...But $xxx_convert didn't work as I expected."
-                       fi
+for xxx_convert in $xxx_list; do
+       echo "Trying $xxx_convert..."
+       $rm -f try try$_o
+       set try -DTRY_$xxx_convert
+       if eval $compile; then
+               echo "$xxx_convert() found." >&4
+               if ./try; then
+                       echo "I'll use $xxx_convert to convert floats into a string." >&4
+                       break;
                else
-                       echo "$xxx_convert NOT found." >&4
+                       echo "...But $xxx_convert didn't work as I expected."
                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
-          ;;  
-       esac
-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
+   ;;  
+esac
 
 : Initialize h_fcntl
 h_fcntl=false
@@ -7830,15 +7783,15 @@ int main() {
 EOCP
        : check sys/file.h first, no particular reason here
        if $test `./findhdr sys/file.h` && \
-               $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
+               $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
                h_sysfile=true;
                echo "<sys/file.h> defines the *_OK access constants." >&4
        elif $test `./findhdr fcntl.h` && \
-               $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
+               $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
                h_fcntl=true;
                echo "<fcntl.h> defines the *_OK access constants." >&4
        elif $test `./findhdr unistd.h` && \
-               $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
+               $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
                echo "<unistd.h> defines the *_OK access constants." >&4
        else
                echo "I can't find the four *_OK access constants--I'll use mine." >&4
@@ -7928,10 +7881,10 @@ int main()
        exit(1);
 }
 EOP
-       if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
+       if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
                echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
                val="$define"
-       elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
+       elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
                echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
                val="$undef"
        else
@@ -7990,10 +7943,10 @@ int main()
        exit(1);
 }
 EOP
-       if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
+       if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
                echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
                val="$define"
-       elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
+       elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
                echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
                val="$undef"
        else
@@ -8545,8 +8498,8 @@ EOM
        : Call the object file tmp-dyna.o in case dlext=o.
        if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
                mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
-               $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
-               $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
+               $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
+               $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
                xxx=`./fred`
                case $xxx in
                1)      echo "Test program failed using dlopen." >&4
@@ -8898,6 +8851,54 @@ eval $inlibc
 set fcntl d_fcntl
 eval $inlibc
 
+echo " "
+: See if fcntl-based locking works.
+$cat >try.c <<'EOCP'
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+int main() {
+#if defined(F_SETLK) && defined(F_SETLKW)
+     struct flock flock;
+     int retval, fd;
+     fd = open("try.c", O_RDONLY);
+     flock.l_type = F_RDLCK;
+     flock.l_whence = SEEK_SET;
+     flock.l_start = flock.l_len = 0;
+     retval = fcntl(fd, F_SETLK, &flock);
+     close(fd);
+     (retval < 0 ? exit(2) : exit(0));
+#else
+     exit(2);
+#endif
+}
+EOCP
+echo "Checking if fcntl-based file locking works... "
+case "$d_fcntl" in
+"$define")
+       set try
+       if eval $compile_ok; then
+               if ./try; then
+                       echo "Yes, it seems to work."
+                       val="$define"
+               else
+                       echo "Nope, it didn't work."
+                       val="$undef"
+               fi
+       else
+               echo "I'm unable to compile the test program, so I'll assume not."
+               val="$undef"
+       fi
+       ;;
+*) val="$undef";
+       echo "Nope, since you don't even have fcntl()."
+       ;;
+esac
+set d_fcntl_can_lock
+eval $setvar
+$rm -f try*
+
+
 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
@@ -10335,7 +10336,6 @@ EOP
 esac
 
 
-
 : check for off64_t
 echo " "
 echo "Checking to see if you have off64_t..." >&4
@@ -11193,10 +11193,19 @@ $define)
        *) 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) ;;
+       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"
                : Remove sfio from list of libraries to use
@@ -11209,8 +11218,9 @@ $define)
        ;;
 *)     case "$usesfio" in
        true|$define|[yY]*)
-               echo "Sorry, cannot find sfio on this machine" >&4
-               echo "Ignoring your setting of usesfio=$usesfio" >&4
+               echo "Sorry, cannot find sfio on this machine." >&4
+               echo "Ignoring your setting of usesfio=$usesfio." >&4
+               val="$undef"
                ;;
        esac
        ;;
@@ -11379,6 +11389,10 @@ set d_sigsetjmp
 eval $setvar
 $rm -f try.c try
 
+: see if socks5_init exists
+set socks5_init d_socks5_init
+eval $inlibc
+
 : see if sys/stat.h is available
 set sys/stat.h i_sysstat
 eval $inhdr
@@ -11521,6 +11535,93 @@ esac
 set d_stdio_cnt_lval
 eval $setvar
 
+
+: test whether setting _ptr sets _cnt as a side effect
+d_stdio_ptr_lval_sets_cnt="$undef"
+d_stdio_ptr_lval_nochange_cnt="$undef"
+case "$d_stdio_ptr_lval$d_stdstdio" in
+$define$define)
+       echo "Checking to see what happens if we set the stdio ptr..." >&4
+$cat >try.c <<EOP
+#include <stdio.h>
+/* Can we scream? */
+/* Eat dust sed :-) */
+/* In the buffer space, no one can hear you scream. */
+#define FILE_ptr(fp)   ((fp)->_ptr)
+#define FILE_cnt(fp)   ((fp)->_cnt)
+#include <sys/types.h>
+int main() {
+       FILE *fp = fopen("try.c", "r");
+       int c;
+       char *ptr;
+       size_t cnt;
+       if (!fp) {
+           puts("Fail even to read");
+           exit(1);
+       }
+       c = getc(fp); /* Read away the first # */
+       if (c == EOF) {
+           puts("Fail even to read");
+           exit(1);
+       }
+       if (!(
+               18 <= FILE_cnt(fp) &&
+               strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
+       )) {
+               puts("Fail even to read");
+               exit (1);
+       }
+       ptr = (char*) FILE_ptr(fp);
+       cnt = (size_t)FILE_cnt(fp);
+
+       FILE_ptr(fp) += 42;
+
+       if ((char*)FILE_ptr(fp) != (ptr + 42)) {
+               printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
+               exit (1);
+       }
+       if (FILE_cnt(fp) <= 20) {
+               printf ("Fail (<20 chars to test)");
+               exit (1);
+       }
+       if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
+               puts("Fail compare");
+               exit (1);
+       }
+       if (cnt == FILE_cnt(fp)) {
+               puts("Pass_unchanged");
+               exit (0);
+       }       
+       if (FILE_cnt(fp) == (cnt - 42)) {
+               puts("Pass_changed");
+               exit (0);
+       }
+       printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
+       return 1;
+
+}
+EOP
+       set try
+       if eval $compile; then
+               case `./try$exe_ext` in
+               Pass_changed)
+                       echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
+                       d_stdio_ptr_lval_sets_cnt="$define" ;;
+               Pass_unchanged)
+                       echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
+                       d_stdio_ptr_lval_nochange_cnt="$define" ;;
+               Fail*)
+                       echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
+               *)
+                       echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
+       esac
+       else
+               echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
+       fi
+       $rm -f try.c try
+       ;;
+esac
+
 : see if _base is also standard
 val="$undef"
 case "$d_stdstdio" in
@@ -11685,6 +11786,9 @@ EOM
 #ifdef __hpux
 #define strtoll __strtoll
 #endif
+#ifdef __EMX__
+#define strtoll _strtoll
+#endif
 #include <stdio.h>
 extern long long int strtoll(char *s, char **, int); 
 static int bad = 0;
@@ -11711,7 +11815,8 @@ int main() {
 EOCP
        set try
        if eval $compile; then
-               case "`./try`" in
+               yyy=`./try`
+               case "$yyy" in
                ok) echo "Your strtoll() seems to be working okay." ;;
                *) cat <<EOM >&4
 Your strtoll() doesn't seem to be working okay.
@@ -11719,6 +11824,9 @@ EOM
                   d_strtoll="$undef"
                   ;;
                esac
+       else
+               echo "(I can't seem to compile the test program--assuming it doesn't)"
+               d_strtoll="$undef"
        fi
        ;;
 esac
@@ -12607,14 +12715,14 @@ val=$undef
 set tebcdic
 if eval $compile_ok; then
        if ./tebcdic; then
-               echo "You have EBCDIC." >&4
+               echo "You seem to speak EBCDIC." >&4
                val="$define"
        else
-               echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
+               echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
        fi
 else
        echo "I'm unable to compile the test program." >&4
-       echo "I'll assume ASCII or some ISO Latin." >&4
+       echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
 fi
 $rm -f tebcdic.c tebcdic
 set ebcdic
@@ -13022,7 +13130,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
-                       sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
+                       sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
                        echo "We will use %d."
                        ;;
                esac
@@ -13044,7 +13152,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
-                       sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
+                       sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
                        echo "We will use %ld."
                        ;;
                esac
@@ -13067,7 +13175,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
-                       sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
+                       sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
                        echo "We will use the C9X style."
                        ;;
                esac
@@ -13079,7 +13187,7 @@ if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
 #include <sys/types.h>
 #include <stdio.h>
 int main() {
-  long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
+  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
   printf("%lld\n", q);
 }
 EOCP
@@ -13089,7 +13197,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
-                       sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
+                       sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
                        echo "We will use the %lld style."
                        ;;
                esac
@@ -13111,7 +13219,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
-                       sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
+                       sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
                        echo "We will use %Ld."
                        ;;
                esac
@@ -13133,7 +13241,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
-                       sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
+                       sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
                        echo "We will use %qd."
                        ;;
                esac
 
 case "$sPRId64" in
 '')    d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
-       d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
+       d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
        ;;
 *)     d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
-       d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
+       d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
        ;;
 esac
 
@@ -13166,18 +13274,21 @@ if $test X"$ivsize" = X8; then
        uvuformat="$sPRIu64"
        uvoformat="$sPRIo64"
        uvxformat="$sPRIx64"
+       uvXUformat="$sPRIXU64"
 else
        if $test X"$ivsize" = X"$longsize"; then
                ivdformat='"ld"'
                uvuformat='"lu"'
                uvoformat='"lo"'
                uvxformat='"lx"'
+               uvXUformat='"lX"'
        else
                if $test X"$ivsize" = X"$intsize"; then
                        ivdformat='"d"'
                        uvuformat='"u"'
                        uvoformat='"o"'
                        uvxformat='"x"'
+                       uvXUformat='"X"'
                else
                        : far out
                        if $test X"$ivsize" = X"$shortsize"; then
@@ -13185,11 +13296,28 @@ else
                                uvuformat='"hu"'
                                uvoformat='"ho"'
                                uvxformat='"hx"'
+                               uvXUformat='"hX"'
                        fi
                fi
        fi
 fi
 
+if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
+       nveformat="$sPRIeldbl"
+       nvfformat="$sPRIfldbl"
+       nvgformat="$sPRIgldbl"
+       nvEUformat="$sPRIEUldbl"
+       nvFUformat="$sPRIFUldbl"
+       nvGUformat="$sPRIGUldbl"
+else
+       nveformat='"e"'
+       nvfformat='"f"'
+       nvgformat='"g"'
+       nvEUformat='"E"'
+       nvFUformat='"F"'
+       nvGUformat='"G"'
+fi
+
 case "$ivdformat" in
 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
     exit 1
@@ -13468,12 +13596,15 @@ case "$pager" in
        dflt=''
        case "$pg" in
        /*) dflt=$pg;;
+       [a-zA-Z]:/*) dflt=$pg;;
        esac
        case "$more" in
        /*) dflt=$more;;
+       [a-zA-Z]:/*) dflt=$more;;
        esac
        case "$less" in
        /*) dflt=$less;;
+       [a-zA-Z]:/*) dflt=$less;;
        esac
        case "$dflt" in
        '') dflt=/usr/ucb/more;;
@@ -13546,13 +13677,13 @@ $cc $ccflags -c bar1.c >/dev/null 2>&1
 $cc $ccflags -c bar2.c >/dev/null 2>&1
 $cc $ccflags -c foo.c >/dev/null 2>&1
 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
-if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
+if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        ./foobar >/dev/null 2>&1; then
        echo "$ar appears to generate random libraries itself."
        orderlib=false
        ranlib=":"
 elif $ar ts bar$_a >/dev/null 2>&1 &&
-       $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
+       $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        ./foobar >/dev/null 2>&1; then
                echo "a table of contents needs to be added with '$ar ts'."
                orderlib=false
@@ -14370,6 +14501,10 @@ eval $inhdr
 set ieeefp.h i_ieeefp
 eval $inhdr
 
+: see if this is a libutil.h system
+set libutil.h i_libutil
+eval $inhdr
+
 : see if locale.h is available
 set locale.h i_locale
 eval $inhdr
@@ -14489,7 +14624,7 @@ mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
 NetBSD news1500 news1700 news1800 news1900 news3700
-news700 news800 news900 NeXT NLS ns16000 ns32000
+news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
 ns32016 ns32332 ns32k nsc32000
 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
@@ -14521,8 +14656,9 @@ $osname
 EOSH
 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
-$cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
-$rm -f Cppsym.a Cppsym.b
+$cat Cppsym.know > Cppsym.c
+$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
+$rm -f Cppsym.a Cppsym.b Cppsym.c
 cat <<EOSH > Cppsym
 $startsh
 if $test \$# -gt 0; then
@@ -14561,8 +14697,9 @@ cat <<EOSH >> Cppsym.try
 ccflags="$ccflags"
 case "$osname-$gccversion" in
 irix-) ccflags="\$ccflags -woff 1178" ;;
+os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
 esac
-$cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
+$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
 EOSH
 chmod +x Cppsym.try
 $eunicefix Cppsym.try
@@ -14616,7 +14753,7 @@ if $test -z ccsym.raw; then
 else
        if $test -s ccsym.com; then
                echo "Your C compiler and pre-processor define these symbols:"
-               $sed -e 's/\(.*\)=.*/\1/' ccsym.com
+               $sed -e 's/\(..*\)=.*/\1/' ccsym.com
                also='also '
                symbols='ones'
                cppccsymbols=`$cat ccsym.com`
@@ -14626,7 +14763,7 @@ else
        if $test -s ccsym.cpp; then
                $test "$also" && echo " "
                echo "Your C pre-processor ${also}defines the following symbols:"
-               $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
+               $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
                also='further '
                cppsymbols=`$cat ccsym.cpp`
                cppsymbols=`echo $cppsymbols`
@@ -14635,14 +14772,14 @@ else
        if $test -s ccsym.own; then
                $test "$also" && echo " "
                echo "Your C compiler ${also}defines the following cpp symbols:"
-               $sed -e 's/\(.*\)=1/\1/' ccsym.own
-               $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
+               $sed -e 's/\(..*\)=1/\1/' ccsym.own
+               $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
                ccsymbols=`$cat ccsym.own`
                ccsymbols=`echo $ccsymbols`
                $test "$silent" || sleep 1
        fi
 fi
-$rm -f ccsym*
+$rm -f ccsym* Cppsym.*
 
 : see if this is a termio system
 val="$undef"
@@ -15176,6 +15313,25 @@ set X $dynamic_ext $static_ext $nonxs_ext
 shift
 extensions="$*"
 
+: Remove libraries needed only for extensions
+: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
+: The exception is SunOS 4.x, which needs them.
+case "${osname}X${osvers}" in
+sunos*X4*)
+    perllibs="$libs"
+    ;;
+*) case "$usedl" in
+    $define|true|[yY]*)
+           set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
+           shift
+           perllibs="$*"
+           ;;
+    *) perllibs="$libs"
+           ;;
+    esac
+    ;;
+esac
+
 : Remove build directory name from cppstdin so it can be used from
 : either the present location or the final installed location.
 echo " "
@@ -15287,7 +15443,10 @@ cc='$cc'
 cccdlflags='$cccdlflags'
 ccdlflags='$ccdlflags'
 ccflags='$ccflags'
+ccflags_uselargefiles='$ccflags_uselargefiles'
+ccname='$ccname'
 ccsymbols='$ccsymbols'
+ccversion='$ccversion'
 cf_by='$cf_by'
 cf_email='$cf_email'
 cf_time='$cf_time'
@@ -15314,10 +15473,10 @@ crosscompile='$crosscompile'
 cryptlib='$cryptlib'
 csh='$csh'
 d_Gconvert='$d_Gconvert'
-d_PRIEldbl='$d_PRIEldbl'
-d_PRIFldbl='$d_PRIFldbl'
-d_PRIGldbl='$d_PRIGldbl'
-d_PRIX64='$d_PRIX64'
+d_PRIEUldbl='$d_PRIEUldbl'
+d_PRIFUldbl='$d_PRIFUldbl'
+d_PRIGUldbl='$d_PRIGUldbl'
+d_PRIXU64='$d_PRIXU64'
 d_PRId64='$d_PRId64'
 d_PRIeldbl='$d_PRIeldbl'
 d_PRIfldbl='$d_PRIfldbl'
@@ -15326,6 +15485,7 @@ d_PRIi64='$d_PRIi64'
 d_PRIo64='$d_PRIo64'
 d_PRIu64='$d_PRIu64'
 d_PRIx64='$d_PRIx64'
+d_SCNfldbl='$d_SCNfldbl'
 d_access='$d_access'
 d_accessx='$d_accessx'
 d_alarm='$d_alarm'
@@ -15372,6 +15532,7 @@ d_eunice='$d_eunice'
 d_fchmod='$d_fchmod'
 d_fchown='$d_fchown'
 d_fcntl='$d_fcntl'
+d_fcntl_can_lock='$d_fcntl_can_lock'
 d_fd_macros='$d_fd_macros'
 d_fd_set='$d_fd_set'
 d_fds_bits='$d_fds_bits'
@@ -15555,6 +15716,7 @@ d_sigsetjmp='$d_sigsetjmp'
 d_socket='$d_socket'
 d_socklen_t='$d_socklen_t'
 d_sockpair='$d_sockpair'
+d_socks5_init='$d_socks5_init'
 d_sqrtl='$d_sqrtl'
 d_statblks='$d_statblks'
 d_statfs_f_flags='$d_statfs_f_flags'
@@ -15562,6 +15724,8 @@ d_statfs_s='$d_statfs_s'
 d_statvfs='$d_statvfs'
 d_stdio_cnt_lval='$d_stdio_cnt_lval'
 d_stdio_ptr_lval='$d_stdio_ptr_lval'
+d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
+d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
 d_stdio_stream_array='$d_stdio_stream_array'
 d_stdiobase='$d_stdiobase'
 d_stdstdio='$d_stdstdio'
@@ -15656,7 +15820,6 @@ h_fcntl='$h_fcntl'
 h_sysfile='$h_sysfile'
 hint='$hint'
 hostcat='$hostcat'
-huge='$huge'
 i16size='$i16size'
 i16type='$i16type'
 i32size='$i32size'
@@ -15679,6 +15842,7 @@ i_grp='$i_grp'
 i_iconv='$i_iconv'
 i_ieeefp='$i_ieeefp'
 i_inttypes='$i_inttypes'
+i_libutil='$i_libutil'
 i_limits='$i_limits'
 i_locale='$i_locale'
 i_machcthr='$i_machcthr'
@@ -15770,10 +15934,10 @@ ivsize='$ivsize'
 ivtype='$ivtype'
 known_extensions='$known_extensions'
 ksh='$ksh'
-large='$large'
 ld='$ld'
 lddlflags='$lddlflags'
 ldflags='$ldflags'
+ldflags_uselargefiles='$ldflags_uselargefiles'
 ldlibpthname='$ldlibpthname'
 less='$less'
 lib_ext='$lib_ext'
@@ -15786,6 +15950,7 @@ libsfiles='$libsfiles'
 libsfound='$libsfound'
 libspath='$libspath'
 libswanted='$libswanted'
+libswanted_uselargefiles='$libswanted_uselargefiles'
 line='$line'
 lint='$lint'
 lkflags='$lkflags'
@@ -15814,11 +15979,9 @@ man1ext='$man1ext'
 man3dir='$man3dir'
 man3direxp='$man3direxp'
 man3ext='$man3ext'
-medium='$medium'
 mips_type='$mips_type'
 mkdir='$mkdir'
 mmaptype='$mmaptype'
-models='$models'
 modetype='$modetype'
 more='$more'
 multiarch='$multiarch'
@@ -15837,6 +16000,12 @@ nm_opt='$nm_opt'
 nm_so_opt='$nm_so_opt'
 nonxs_ext='$nonxs_ext'
 nroff='$nroff'
+nvEUformat='$nvEUformat'
+nvFUformat='$nvFUformat'
+nvGUformat='$nvGUformat'
+nveformat='$nveformat'
+nvfformat='$nvfformat'
+nvgformat='$nvgformat'
 nvsize='$nvsize'
 nvtype='$nvtype'
 o_nonblock='$o_nonblock'
@@ -15855,6 +16024,7 @@ path_sep='$path_sep'
 perl5='$perl5'
 perl='$perl'
 perladmin='$perladmin'
+perllibs='$perllibs'
 perlpath='$perlpath'
 pg='$pg'
 phostname='$phostname'
@@ -15880,10 +16050,10 @@ revision='$revision'
 rm='$rm'
 rmail='$rmail'
 runnm='$runnm'
-sPRIEldbl='$sPRIEldbl'
-sPRIFldbl='$sPRIFldbl'
-sPRIGldbl='$sPRIGldbl'
-sPRIX64='$sPRIX64'
+sPRIEUldbl='$sPRIEUldbl'
+sPRIFUldbl='$sPRIFUldbl'
+sPRIGUldbl='$sPRIGUldbl'
+sPRIXU64='$sPRIXU64'
 sPRId64='$sPRId64'
 sPRIeldbl='$sPRIeldbl'
 sPRIfldbl='$sPRIfldbl'
@@ -15892,6 +16062,7 @@ sPRIi64='$sPRIi64'
 sPRIo64='$sPRIo64'
 sPRIu64='$sPRIu64'
 sPRIx64='$sPRIx64'
+sSCNfldbl='$sSCNfldbl'
 sched_yield='$sched_yield'
 scriptdir='$scriptdir'
 scriptdirexp='$scriptdirexp'
@@ -15926,7 +16097,6 @@ sizesize='$sizesize'
 sizetype='$sizetype'
 sleep='$sleep'
 smail='$smail'
-small='$small'
 so='$so'
 sockethdr='$sockethdr'
 socketlib='$socketlib'
@@ -15934,7 +16104,6 @@ socksizetype='$socksizetype'
 sort='$sort'
 spackage='$spackage'
 spitshell='$spitshell'
-split='$split'
 src='$src'
 ssizetype='$ssizetype'
 startperl='$startperl'
@@ -15999,6 +16168,7 @@ usevendorprefix='$usevendorprefix'
 usevfork='$usevfork'
 usrinc='$usrinc'
 uuname='$uuname'
+uvXUformat='$uvXUformat'
 uvoformat='$uvoformat'
 uvsize='$uvsize'
 uvtype='$uvtype'
@@ -16014,6 +16184,7 @@ vendorlibexp='$vendorlibexp'
 vendorprefix='$vendorprefix'
 vendorprefixexp='$vendorprefixexp'
 version='$version'
+versiononly='$versiononly'
 vi='$vi'
 voidflags='$voidflags'
 xlibpth='$xlibpth'
@@ -16032,9 +16203,9 @@ echo "CONFIGDOTSH=true" >>config.sh
 
 : propagate old symbols
 if $test -f UU/config.sh; then
-       <UU/config.sh sort | uniq >UU/oldconfig.sh
+       <UU/config.sh $sort | $uniq >UU/oldconfig.sh
        sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
-       sort | uniq -u >UU/oldsyms
+       $sort | $uniq -u >UU/oldsyms
        set X `cat UU/oldsyms`
        shift
        case $# in
@@ -16108,7 +16279,7 @@ EOM
        . UU/myread
        case "$ans" in
        y*)
-               $make depend && echo "Now you must run a $make."
+               $make depend && echo "Now you must run '$make'."
                ;;
        *)
                echo "You must run '$make depend' then '$make'."