This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
integrate cfgperl changes into mainline
[perl5.git] / Configure
index ceeac89..1f9e653 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Mon Feb  8 16:55:49 EET 1999 [metaconfig 3.0 PL70]
+# Generated on Wed Jul 28 20:32:22 EET DST 1999 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.com)
 
 cat >/tmp/c1$$ <<EOF
@@ -108,6 +108,13 @@ if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
                newsh=/usr/bin/bsh
        fi
 fi
+if test -f /osf_boot -a -f /usr/sbin/setld; then
+       if test X`/usr/bin/uname -s` = XOSF1; then
+               avoidksh="to avoid Digital UNIX' ksh"
+               newsh=/bin/sh
+               unset BIN_SH # if this is 'xpg4' sh will start up ksh
+       fi
+fi
 case "$inksh/$needksh" in
 /[a-z]*)
                ENV=''
@@ -236,6 +243,7 @@ uuname=''
 vi=''
 zcat=''
 zip=''
+full_ar=''
 full_sed=''
 libswanted=''
 hint=''
@@ -292,6 +300,7 @@ cpplast=''
 cppminus=''
 cpprun=''
 cppstdin=''
+crosscompile=''
 d_access=''
 d_accessx=''
 d_alarm=''
@@ -329,6 +338,7 @@ d_endnent=''
 d_endpent=''
 d_endpwent=''
 d_endsent=''
+d_endspent=''
 d_fchmod=''
 d_fchown=''
 d_fcntl=''
@@ -356,6 +366,7 @@ d_phostname=''
 d_uname=''
 d_gethostprotos=''
 d_getlogin=''
+d_getmntent=''
 d_getnbyaddr=''
 d_getnbyname=''
 d_getnent=''
@@ -373,9 +384,12 @@ d_getprotoprotos=''
 d_getpwent=''
 d_getsent=''
 d_getservprotos=''
+d_getspent=''
+d_getspnam=''
 d_getsbyname=''
 d_getsbyport=''
 d_gnulibc=''
+d_hasmntopt=''
 d_htonl=''
 d_inetaton=''
 d_isascii=''
@@ -393,6 +407,7 @@ d_madvise=''
 d_mblen=''
 d_mbstowcs=''
 d_mbtowc=''
+d_memchr=''
 d_memcmp=''
 d_memcpy=''
 d_memmove=''
@@ -462,6 +477,7 @@ d_setrgid=''
 d_setruid=''
 d_setsent=''
 d_setsid=''
+d_setspent=''
 d_setvbuf=''
 d_sfio=''
 usesfio=''
@@ -561,6 +577,8 @@ lddlflags=''
 usedl=''
 doublesize=''
 ebcdic=''
+fflushNULL=''
+fflushall=''
 fpostype=''
 gidtype=''
 groupstype=''
@@ -594,9 +612,11 @@ i_mntent=''
 i_ndbm=''
 i_netdb=''
 i_neterrno=''
+i_netinettcp=''
 i_niin=''
 i_sysin=''
 i_poll=''
+i_pthread=''
 d_pwage=''
 d_pwchange=''
 d_pwclass=''
@@ -607,6 +627,8 @@ d_pwpasswd=''
 d_pwquota=''
 i_pwd=''
 i_sfio=''
+i_shadow=''
+i_socks=''
 i_stddef=''
 i_stdlib=''
 i_string=''
@@ -648,6 +670,9 @@ i_stdarg=''
 i_varargs=''
 i_varhdr=''
 i_vfork=''
+installprefix=''
+installprefixexp=''
+installstyle=''
 installusrbinperl=''
 intsize=''
 longsize=''
@@ -656,11 +681,13 @@ d_dirent64_s=''
 d_flock64_s=''
 d_fstat64=''
 d_ftruncate64=''
-d_ino64t=''
+d_ino64_t=''
+d_llseek=''
 d_lockf64=''
 d_lseek64=''
 d_lstat64=''
-d_off64t=''
+d_off64_t=''
+d_offset_t=''
 d_open64=''
 d_opendir64=''
 d_readdir64=''
@@ -669,6 +696,7 @@ d_stat64=''
 d_telldir64=''
 d_truncate64=''
 libc=''
+ldlibpthname=''
 libperl=''
 shrpenv=''
 useshrplib=''
@@ -704,6 +732,7 @@ models=''
 small=''
 split=''
 modetype=''
+multiarch=''
 mydomain=''
 myhostname=''
 phostname=''
@@ -750,6 +779,7 @@ scriptdirexp=''
 selectminbits=''
 selecttype=''
 sh=''
+sig_count=''
 sig_name=''
 sig_name_init=''
 sig_num=''
@@ -760,6 +790,8 @@ sitearchexp=''
 installsitelib=''
 sitelib=''
 sitelibexp=''
+siteprefix=''
+siteprefixexp=''
 sizetype=''
 so=''
 sharpbang=''
@@ -779,6 +811,8 @@ d_fsetpos64=''
 d_ftell64=''
 d_ftello64=''
 d_tmpfile64=''
+d_stdio_stream_array=''
+stdio_stream_array=''
 sysman=''
 trnl=''
 uidtype=''
@@ -790,12 +824,20 @@ nm_so_opt=''
 runnm=''
 usenm=''
 useperlio=''
+usesocks=''
 d_oldpthreads=''
 usethreads=''
 incpath=''
 mips=''
 mips_type=''
 usrinc=''
+d_vendorlib=''
+installvendorlib=''
+vendorlib=''
+vendorlibexp=''
+usevendorprefix=''
+vendorprefix=''
+vendorprefixexp=''
 defvoidused=''
 voidflags=''
 CONFIG=''
@@ -815,24 +857,6 @@ if test -f /etc/unixtovms.exe; then
 fi
 
 i_whoami=''
-: change the next line if compiling for Xenix/286 on Xenix/386
-xlibpth='/usr/lib/386 /lib/386'
-
-: Possible local library directories to search.
-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="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
-glibpth="$glibpth /lib /usr/lib $xlibpth"
-glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
-
-: Private path used by Configure to find libraries.  Its value
-: is prepended to libpth. This variable takes care of special
-: machines, like the mips.  Usually, it should be empty.
-plibpth=''
-
 : 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"
@@ -911,6 +935,24 @@ _exe=''
 : Extra object files, if any, needed on this platform.
 archobjs=''
 groupstype=''
+: change the next line if compiling for Xenix/286 on Xenix/386
+xlibpth='/usr/lib/386 /lib/386'
+
+: Possible local library directories to search.
+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="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
+glibpth="$glibpth /lib /usr/lib $xlibpth"
+glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
+glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
+
+: Private path used by Configure to find libraries.  Its value
+: is prepended to libpth. This variable takes care of special
+: machines, like the mips.  Usually, it should be empty.
+plibpth=''
+
 : default library list
 libswanted=''
 : some systems want to use only the non-versioned libso:s
@@ -923,11 +965,13 @@ useposix=true
 : set useopcode=false in your hint file to disable the Opcode extension.
 useopcode=true
 : set usemultiplicity on the Configure command line to enable multiplicity.
+: set usesocks on the Configure command line to enable socks.
 : set usethreads on the Configure command line to enable threads.
 : List of libraries we want.
 : If anyone needs -lnet, put it in a hint file.
 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
-libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
+libswanted="$libswanted dld ld sun m rt c cposix posix"
+libswanted="$libswanted ndir dir crypt sec"
 libswanted="$libswanted ucb bsd BSD PW x"
 : We probably want to search /usr/shlib before most other libraries.
 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
@@ -1259,7 +1303,12 @@ esac
 : Find the path to the source tree
 case "$src" in
 '') case "$0" in
-    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
+    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
+         case "$src" in
+        /*)    ;;
+         *)    src=`cd ../$src && pwd` ;;
+        esac
+         ;;
     *)   src='.';;
     esac;;
 esac
@@ -1304,7 +1353,7 @@ esac
 
 : script used to extract .SH files with variable substitutions
 cat >extract <<'EOS'
-CONFIG=true
+CONFIGDOTSH=true
 echo "Doing variable substitutions on .SH files..."
 if test -f $src/MANIFEST; then
        set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
@@ -1763,7 +1812,6 @@ more
 nm
 nroff
 pg
-tee
 test
 uname
 zip
@@ -2075,9 +2123,13 @@ EOM
                [23]100) osname=mips ;;
                next*) osname=next ;;
                i386*)
-                       if $test -f /etc/kconfig; then
+                       tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
+                       if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
+                               osname='sco'
+                               osvers=$tmp
+                       elif $test -f /etc/kconfig; then
                                osname=isc
-                               if test "$lns" = "ln -s"; then
+                               if test "$lns" = "$ln -s"; then
                                        osvers=4
                                elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
                                        osvers=3
@@ -2085,6 +2137,7 @@ EOM
                                        osvers=2
                                fi
                        fi
+                       tmp=''
                        ;;
                pc*)
                        if test -n "$DJGPP"; then
@@ -2329,7 +2382,7 @@ EOM
 
 You may give one or more space-separated answers, or "none" if appropriate.
 A well-behaved OS will have no hints, so answering "none" or just "Policy"
-is a good thing.  DO NOT give a wrong version.
+is a good thing.  DO NOT give a wrong version or a wrong OS.
 
 EOM
 
@@ -2482,7 +2535,12 @@ cat <<EOM
 
 Perl can be built to take advantage of threads, on some systems.
 To do so, Configure must be run with -Dusethreads.
-(See README.threads for details.)
+
+Note that threading is a highly experimental feature, and
+some known race conditions still remain.  If you choose to try
+it, be very sure to not actually deploy it for production
+purposes.  README.threads has more details, and is required
+reading if you enable threads.
 EOM
 case "$usethreads" in
 $define|true|[yY]*)     dflt='y';;
@@ -2515,7 +2573,7 @@ case "$usethreads" in
                . ./usethreads.cbu
        fi
        case "$osname" in
-       aix|dec_osf|dos_djgpp|freebsd|hpux|irix|linux|os2|solaris|vmesa)
+       aix|dec_osf|dos_djgpp|freebsd|hpux|irix|linux|next|openbsd|os2|solaris|vmesa)
                # Known thread-capable platforms.
                ;;
        *)
@@ -2584,13 +2642,13 @@ esac
 case "$use64bits" in
 "$define"|true|[yY]*)
 : Look for a hint-file generated 'call-back-unit'.  If the
-: user has specified that a threading perl is to be built,
+: user has specified that a 64 bit perl is to be built,
 : we may need to set or change some other defaults.
        if $test -f use64bits.cbu; then
                . ./use64bits.cbu
        fi
        case "$osname" in
-       dec_osf|hpux|irix|solaris|unicos)
+       aix|dec_osf|hpux|irix|solaris|unicos)
                # Known 64-bit capable platforms.
                ;;
        *)
@@ -2678,24 +2736,6 @@ $define)
        esac
 esac
 
-: is AFS running?
-echo " "
-case "$afs" in
-$define|true)  afs=true ;;
-$undef|false)  afs=false ;;
-*)     if test -d /afs; then
-               afs=true
-       else
-               afs=false
-       fi
-       ;;
-esac
-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
-
 : decide how portable to be.  Allow command line overrides.
 case "$d_portable" in
 "$undef") ;;
@@ -2756,6 +2796,9 @@ exp_file=''
 nopath_ok=''
 orig_rp="$rp"
 orig_dflt="$dflt"
+case "$gfpth" in
+'') gfpth='.' ;;
+esac
 
 case "$fn" in
 *\(*)
@@ -2882,18 +2925,38 @@ while test "$type"; do
                '')
                        case "$type" in
                        File)
-                               if test -f "$ansexp"; then
-                                       type=''
-                               elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
-                               then
-                                       echo "($value is not a plain file, but that's ok.)"
-                                       type=''
-                               fi
+                               for fp in $gfpth; do
+                                       if test "X$fp" = X.; then
+                                           pf="$ansexp"
+                                       else    
+                                           pf="$fp/$ansexp"
+                                       fi
+                                       if test -f "$pf"; then
+                                               type=''
+                                       elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
+                                       then
+                                               echo "($value is not a plain file, but that's ok.)"
+                                               type=''
+                                       fi
+                                       if test X"$type" = X; then
+                                           value="$pf"
+                                           break
+                                       fi
+                               done
                                ;;
                        Directory)
-                               if test -d "$ansexp"; then
-                                       type=''
-                               fi
+                               for fp in $gfpth; do
+                                       if test "X$fp" = X.; then
+                                           pf="$ansexp"
+                                       else    
+                                           pf="$fp/$ansexp"
+                                       fi
+                                       if test -d "$pf"; then
+                                               type=''
+                                               value="$pf"
+                                               break
+                                       fi
+                               done
                                ;;
                        Locate)
                                if test -d "$ansexp"; then
@@ -2947,6 +3010,7 @@ ans="$value"
 rp="$orig_rp"
 dflt="$orig_dflt"
 rm -f getfile.ok
+test "X$gfpthkeep" != Xy && gfpth=""
 EOSC
 
 : determine root of directory hierarchy where package will be installed.
@@ -2960,14 +3024,13 @@ case "$prefix" in
 esac
 $cat <<EOM
 
-By default, $package will be installed in $dflt/bin, manual
-pages under $dflt/man, etc..., i.e. with $dflt as prefix for
-all installation directories. Typically set to /usr/local, but you
-may choose /usr if you wish to install $package among your system
-binaries. If you wish to have binaries under /bin but manual pages
-under /usr/local/man, that's ok: you will be prompted separately
-for each of the installation directories, the prefix being only used
-to set the defaults.
+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~
@@ -2986,6 +3049,57 @@ esac
 prefix="$ans"
 prefixexp="$ansexp"
 
+: is AFS running?
+echo " "
+case "$afs" in
+$define|true)  afs=true ;;
+$undef|false)  afs=false ;;
+*)     if test -d /afs; then
+               afs=true
+       else
+               afs=false
+       fi
+       ;;
+esac
+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
+
+Since you are running AFS, I need to distinguish the directory in which
+files will reside from the directory in which they are installed (and from
+which they are presumably copied to the former directory by occult means).
+
+EOM
+       case "$installprefix" in
+       '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
+       *) dflt="$installprefix";;
+       esac
+else
+$cat <<EOM
+
+In some special cases, particularly when building $package for distribution,
+it is convenient to distinguish 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
+       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)
@@ -3019,8 +3133,8 @@ baserev=5.0
 echo " "
 echo "Getting the current patchlevel..." >&4
 if $test -r $rsrc/patchlevel.h;then
-       patchlevel=`awk '/define[       ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
-       subversion=`awk '/define[       ]+SUBVERSION/ {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`
 else
        patchlevel=0
        subversion=0
@@ -3053,13 +3167,30 @@ else
        apiversion="$version"
 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='lib/perl5' ;;
+esac
+: Probably not worth prompting for this since we prompt for all
+: the directories individually, and the prompt would be too long and
+: confusing anyway.
+installstyle=$dflt
+
 : determine where private library files go
 : Usual default is /usr/local/lib/perl5/$version.
 : Also allow things like /opt/perl/lib/$version, since 
 : /opt/perl/lib/perl5... would be redundant.
-case "$prefix" in
-*perl*) set dflt privlib lib/$version ;;
-*)      set dflt privlib lib/$package/$version ;;
+: 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
@@ -3071,27 +3202,11 @@ EOM
 fn=d~+
 rp='Pathname where the private library files will reside?'
 . ./getfile
-if $test "X$privlibexp" != "X$ansexp"; then
-       installprivlib=''
-fi
 privlib="$ans"
 privlibexp="$ansexp"
-if $afs; then
-       $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in which
-private files reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
-
-EOM
-       case "$installprivlib" in
-       '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installprivlib";;
-       esac
-       fn=de~
-       rp='Where will private files be installed?'
-       . ./getfile
-       installprivlib="$ans"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installprivlib=`echo $privlibexp | sed 's#^$prefix#$installprefix#'`
 else
        installprivlib="$privlibexp"
 fi
@@ -3116,7 +3231,7 @@ case "$archlib" in
 *)     dflt="$archlib"
     ;;
 esac
-cat <<EOM
+$cat <<EOM
 
 $spackage contains architecture-dependent library files.  If you are
 sharing libraries in a heterogeneous environment, you might store
@@ -3129,32 +3244,17 @@ rp='Where do you want to put the public architecture-dependent libraries?'
 . ./getfile
 archlib="$ans"
 archlibexp="$ansexp"
-
-if $afs; then
-       $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in
-which architecture-dependent library files reside from the directory
-in which they are installed (and from which they are presumably copied
-to the former directory by occult means).
-
-EOM
-       case "$installarchlib" in
-       '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installarchlib";;
-       esac
-       fn=de~
-       rp='Where will architecture-dependent library files be installed?'
-       . ./getfile
-       installarchlib="$ans"
-else
-       installarchlib="$archlibexp"
-fi
 if $test X"$archlib" = X"$privlib"; then
        d_archlib="$undef"
 else
        d_archlib="$define"
 fi
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installarchlib=`echo $archlibexp | sed 's#^$prefix#$installprefix#'`
+else
+       installarchlib="$archlibexp"
+fi
 
 : make some quick guesses about what we are up against
 echo " "
@@ -3588,7 +3688,7 @@ int main() {
        exit(0);
 }
 EOM
-if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
+if $cc -o gccvers gccvers.c; then
        gccversion=`./gccvers`
        case "$gccversion" in
        '') echo "You are not using GNU cc." ;;
@@ -3908,6 +4008,27 @@ case "$firstmakefile" in
 '') firstmakefile='makefile';;
 esac
 
+cat <<EOM
+
+Perl can be built to use the SOCKS proxy protocol library.  To do so,
+Configure must be run with -Dusesocks.
+
+Normally you do not need this and you should answer no.
+
+EOM
+case "$usesocks" in
+$define|true|[yY]*)    dflt='y';;
+*) dflt='n';;
+esac
+rp='Build Perl for SOCKS?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define" ;;     
+*)      val="$undef" ;;
+esac
+set usesocks
+eval $setvar
+
 : Looking for optional libraries
 echo " "
 echo "Checking for optional libraries..." >&4
@@ -3918,6 +4039,11 @@ esac
 case "$libswanted" in
 '') libswanted='c_s';;
 esac
+case "$usesocks" in
+$define)
+       libswanted="$libswanted socks5 socks5_sh"
+       ;;
+esac
 for thislib in $libswanted; do
        
        if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
@@ -3973,20 +4099,14 @@ case "$dflt" in
 esac
 
 $cat <<EOM
-Some versions of Unix support shared libraries, which make executables smaller
-but make load time slightly longer.
-
-On some systems, mostly System V Release 3's, the shared library is included
-by putting the option "-lc_s" as the last thing on the cc command line when
-linking.  Other systems use shared libraries by default.  There may be other
-libraries needed to compile $package on your machine as well.  If your system
-needs the "-lc_s" option, include it here.  Include any other special libraries
-here as well.  Say "none" for none.
+
+In order to compile $package on your machine, a number of libraries
+are usually needed.  Include any other special libraries here as well.
+Say "none" for none.  The default list is almost always right.
 EOM
 
 echo " "
-rp="Any additional libraries?"
+rp="What libraries to use?"
 . ./myread
 case "$ans" in
 none) libs=' ';;
@@ -4066,11 +4186,13 @@ if $xxx; then
        esac;
 fi'
 
-if ./osf1; then
-       set signal.h __LANGUAGE_C__; eval $inctest
-else
-       set signal.h LANGUAGE_C; eval $inctest
-fi
+set signal.h LANGUAGE_C; eval $inctest
+
+case "$usesocks" in
+$define)
+       ccflags="$ccflags -DSOCKS"
+       ;;
+esac
 
 case "$hint" in
 none|recommended) dflt="$ccflags $dflt" ;;
@@ -4321,10 +4443,13 @@ $cat >findhdr <<EOF
 $startsh
 wanted=\$1
 name=''
-if test -f $usrinc/\$wanted; then
-       echo "$usrinc/\$wanted"
-       exit 0
-fi
+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 | \
@@ -4332,17 +4457,26 @@ $grep "^[       ]*#.*\$wanted" | \
 while read cline; do
        name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
        case "\$name" in
-       */\$wanted) echo "\$name"; exit 0;;
-       *) name='';;
+       *[/\\\\]\$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;
-case "\$name" in
-'') exit 1;;
-esac
+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";
@@ -4457,6 +4591,83 @@ case "$freetype" in
 esac
 echo "Your system uses $freetype free(), it would seem." >&4
 $rm -f malloc.[co]
+$cat <<EOM
+
+The installation process will also create a directory for
+vendor-supplied add-ons.  Vendors who supply perl with their system
+may find it convenient to place all vendor-supplied files in this
+directory rather than in the main distribution directory.  This will
+ease upgrades between binary-compatible maintenance versions of perl.
+
+Of course you may also use these directories in whatever way you see
+fit.  For example, you might use them to access modules shared over a
+company-wide network.
+
+The default answer should be fine for most people.
+This causes further questions about vendor add-ons to be skipped
+and no vendor-specific directories will be configured for perl.
+
+EOM
+rp='Do you want to configure vendor-specific add-on directories?'
+case "$usevendorprefix" in
+define|true|[yY]*) dflt=y ;;
+*) dflt=n ;;
+esac
+. ./myread
+case "$ans" in
+[yY]*) fn=d~+
+       rp='Installation prefix to use for vendor-supplied add-ons?'
+       case "$vendorprefix" in
+       '') dflt='' ;;
+       *)  dflt=$vendorprefix ;;
+       esac
+       . ./getfile
+       oldvendorprefix=''
+       case "$vendorprefix" in
+       '') ;;
+       *)      case "$ans" in
+               "$prefix") ;;
+               *) oldvendorprefix="$prefix";;
+               esac
+               ;;
+       esac
+       usevendorprefix="$define"
+       vendorprefix="$ans"
+       vendorprefixexp="$ansexp"
+       ;;
+*)     usevendorprefix="$undef"
+       vendorprefix=''
+       vendorprefixexp=''
+       ;;
+esac
+
+case "$vendorprefix" in
+'')    d_vendorlib="$undef"
+       vendorlib=''
+       vendorlibexp=''
+       ;;
+*)     d_vendorlib="$define"
+       : determine where vendor-supplied modules go.
+       : Usual default is /usr/local/lib/perl5/vendor_perl
+       prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+       case "$installstyle" in
+       *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
+       *)           dflt=$vendorprefix/lib/vendor_$prog ;;
+       esac
+       fn=d~+
+       rp='Pathname for the vendor-supplied library files?'
+       . ./getfile
+       vendorlib="$ans"
+       vendorlibexp="$ansexp"
+       : Change installation prefix, if necessary.
+       if $test X"$prefix" != X"$installprefix"; then
+               installvendorlib=`echo $vendorlibexp | $sed 's#^$prefix#$installprefix#'`
+       else
+               installvendorlib="$vendorlibexp"
+       fi
+       ;;
+esac
+
 : Cruising for prototypes
 echo " "
 echo "Checking out function prototypes..." >&4
@@ -4510,22 +4721,10 @@ if $test "X$ansexp" != "X$binexp"; then
 fi
 bin="$ans"
 binexp="$ansexp"
-if $afs; then
-       $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in which
-executables reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
-
-EOM
-       case "$installbin" in
-       '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installbin";;
-       esac
-       fn=de~
-       rp='Where will public executables be installed?'
-       . ./getfile
-       installbin="$ans"
+: 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
@@ -4533,7 +4732,7 @@ fi
 : determine whether to install perl also as /usr/bin/perl
 
 echo " "
-if test -d /usr/bin -a "X$installbin" != X/usr/bin; then
+if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
        $cat <<EOM
 Many scripts expect to perl to be installed as /usr/bin/perl.
 I can install the perl you are about to compile also as /usr/bin/perl
@@ -4955,7 +5154,7 @@ 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$/\1/p' /lib/syscalls.exp >>libc.list
+       $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
 fi
 ;;
 esac
@@ -5084,8 +5283,7 @@ y*) usedl="$define"
        tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
        rp="Source file to use for dynamic loading"
        fn="fne"
-       # XXX This getfile call will fail the existence check if you try 
-       # building away from $src (this is not supported yet).
+       gfpth="$src"
        . ./getfile
        usedl="$define"
        : emulate basename
@@ -5297,28 +5495,7 @@ EOM
        . ./myread
        case "$ans" in
        true|$define|[Yy]*)
-               useshrplib='true'
-               # Why does next4 have to be so different?
-               case "${osname}${osvers}" in
-               next4*) xxx='DYLD_LIBRARY_PATH' ;;
-               os2*)   xxx='' ;; # Nothing special needed.
-               beos*)  xxx='' ;;
-               *)              xxx='LD_LIBRARY_PATH' ;;
-               esac
-               if test X"$xxx" != "X"; then
-                       $cat <<EOM  | $tee -a ../config.msg >&4
-
-To build perl, you must add the current working directory to your
-$xxx environment variable before running make.  You can do
-this with
-   $xxx=\`pwd\`:\$$xxx; export $xxx
-for Bourne-style shells, or
-   setenv $xxx \`pwd\`
-for Csh-style shells.  You *MUST* do this before running make.
-
-EOM
-               fi
-               ;;
+               useshrplib='true'  ;;
        *)      useshrplib='false' ;;
        esac
        ;;
@@ -5438,6 +5615,10 @@ if "$useshrplib"; then
        beos)
                # beos doesn't like the default, either.
                ;;
+       hpux*)
+               # hpux doesn't like the default, either.
+               tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
+               ;;
        *)
                tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
                ;;
@@ -5461,10 +5642,20 @@ EOM
                ;;
        esac
 fi
+# Fix ccdlflags in AIX for building external extensions.
+# (For building Perl itself bare -bE:perl.exp is needed,
+#  Makefile.SH takes care of this.)
+case "$osname" in
+aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
+esac
 # Respect a hint or command-line value.
 case "$shrpenv" in
 '') shrpenv="$tmp_shrpenv" ;;
 esac
+case "$ldlibpthname" in
+'')    ldlibpthname=LD_LIBRARY_PATH ;;
+none)  ldlibpthname='' ;;
+esac
 
 : determine where manual pages go
 set man1dir man1dir none
@@ -5509,25 +5700,13 @@ fi
 man1dir="$ans"
 man1direxp="$ansexp"
 case "$man1dir" in
-'') man1dir=' '
+'')    man1dir=' '
        installman1dir='';;
 esac
-if $afs; then
-       $cat <<EOM
 
-Since you are running AFS, I need to distinguish the directory in which
-manual pages reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
-
-EOM
-       case "$installman1dir" in
-       '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installman1dir";;
-       esac
-       fn=de~
-       rp='Where will man pages be installed?'
-       . ./getfile
-       installman1dir="$ans"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installman1dir=`echo $man1direxp | $sed 's#^$prefix#$installprefix#'`
 else
        installman1dir="$man1direxp"
 fi
@@ -5636,52 +5815,46 @@ esac
 echo "If you don't want the manual sources installed, answer 'none'."
 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
 case "$man3dir" in
-'')    case "$prefix" in 
-       *$prog*) dflt=`echo $man1dir | 
-                       $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
-       *)      dflt="$privlib/man/man3" ;;
-       esac
+'')    dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
+       if $test -d "$privlib/man/man3"; then
+               cat <<EOM >&4
+
+WARNING:  Previous versions of perl installed man3 pages into
+$privlib/man/man3.  This version will suggest a 
+new default of $dflt.  
+EOM
+               tdflt=$dflt
+               dflt='n'
+               rp='Do you wish to preserve the old behavior?(y/n)'
+               . ./myread
+               case "$ans" in
+               y*) dflt="$privlib/man/man3" ;;
+               *)  dflt=$tdflt ;;
+               esac
+    fi
        ;;
 ' ') dflt=none;;
 *)     dflt="$man3dir" ;;
 esac
 echo " "
-
 fn=dn+~
 rp="Where do the $package library man pages (source) go?"
 . ./getfile
-if test "X$man3direxp" != "X$ansexp"; then
-       installman3dir=''
-fi
-
 man3dir="$ans"
 man3direxp="$ansexp"
-case "$man3dir" in
-'') man3dir=' '
+case "$man1dir" in
+'')    man3dir=' '
        installman3dir='';;
 esac
-if $afs; then
-       $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in which
-manual pages reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
 
-EOM
-       case "$installman3dir" in
-       '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installman3dir";;
-       esac
-       fn=de~
-       rp='Where will man pages be installed?'
-       . ./getfile
-       installman3dir="$ans"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installman3dir=`echo $man3direxp | $sed 's#^$prefix#$installprefix#'`
 else
        installman3dir="$man3direxp"
 fi
 
 : What suffix to use on installed man pages
-
 case "$man3dir" in
 ' ')
        man3ext='0'
@@ -6080,9 +6253,10 @@ case "$scriptdir" in
        dflt="$bin"
        : guess some guesses
        $test -d /usr/share/scripts && dflt=/usr/share/scripts
-       $test -d /usr/share/bin && dflt=/usr/share/bin
-       $test -d /usr/local/script && dflt=/usr/local/script
-       $test -d $prefixexp/script && dflt=$prefixexp/script
+       $test -d /usr/share/bin     && dflt=/usr/share/bin
+       $test -d /usr/local/script  && dflt=/usr/local/script
+       $test -d /usr/local/scripts && dflt=/usr/local/scripts
+       $test -d $prefixexp/script  && dflt=$prefixexp/script
        set dflt
        eval $prefixup
        ;;
@@ -6105,77 +6279,84 @@ if $test "X$ansexp" != "X$scriptdirexp"; then
 fi
 scriptdir="$ans"
 scriptdirexp="$ansexp"
-if $afs; then
-       $cat <<EOM
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installscript=`echo $scriptdirexp | sed 's#^$prefix#$installprefix#'`
+else
+       installscript="$scriptdirexp"
+fi
 
-Since you are running AFS, I need to distinguish the directory in which
-scripts reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
+$cat <<EOM
+
+After $package is installed, you may wish to install various
+add-on modules and utilities.  Typically, these add-ons will
+be installed under $prefix with the rest
+of this package.  However, you may wish to install such add-ons
+elsewhere under a different prefix.
+
+If you do not wish to put everything under a single prefix, that's
+ok.  You will be prompted for the individual locations; this siteprefix
+is only used to suggest the defaults.
+
+The default should be fine for most people.
 
 EOM
-       case "$installscript" in
-       '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installscript";;
+fn=d~+
+rp='Installation prefix to use for add-on modules and utilities?'
+: XXX Here might be another good place for an installstyle setting.
+case "$siteprefix" in
+'') dflt=$prefix ;;
+*)  dflt=$siteprefix ;;
+esac
+. ./getfile
+oldsiteprefix=''
+case "$siteprefix" in
+'') ;;
+*)
+       case "$ans" in
+       "$prefix") ;;
+       *) oldsiteprefix="$prefix";;
        esac
-       fn=de~
-       rp='Where will public scripts be installed?'
-       . ./getfile
-       installscript="$ans"
-else
-       installscript="$scriptdirexp"
-fi
+       ;;
+esac
+siteprefix="$ans"
+siteprefixexp="$ansexp"
 
 : determine where site specific libraries go.
-: Usual default is /usr/local/lib/perl5/site_perl/$apiversion
+: Usual default is /usr/local/lib/perl5/site_perl
+: The default "style" setting is made in installstyle.U
+: XXX No longer works with Prefixit stuff.
 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
-case "$prefix" in
-*perl*) set dflt sitelib lib/site_$prog/$apiversion ;;
-*)      set dflt sitelib lib/$package/site_$prog/$apiversion ;;
+case "$installstyle" in
+*lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
+*)      dflt=$siteprefix/lib/site_$prog ;;
 esac
-eval $prefixit
 $cat <<EOM
 
-The installation process will also create a directory for
-site-specific extensions and modules.  Some users find it convenient
-to place all local files in this directory rather than in the main
-distribution directory.
+The installation process will create a directory for
+site-specific extensions and modules.  Most users find it convenient
+to place all site-specific files in this directory rather than in the
+main distribution directory.
 
 EOM
 fn=d~+
 rp='Pathname for the site-specific library files?'
 . ./getfile
-if $test "X$sitelibexp" != "X$ansexp"; then
-       installsitelib=''
-fi
 sitelib="$ans"
 sitelibexp="$ansexp"
-if $afs; then
-       $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in
-which site-specific files reside from the directory in which they are
-installed (and from which they are presumably copied to the former
-directory by occult means).
-
-EOM
-       case "$installsitelib" in
-       '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installsitelib";;
-       esac
-       fn=de~
-       rp='Where will site-specific files be installed?'
-       . ./getfile
-       installsitelib="$ans"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsitelib=`echo $sitelibexp | sed 's#^$prefix#$installprefix#'`
 else
        installsitelib="$sitelibexp"
 fi
 
 : determine where site specific architecture-dependent libraries go.
-: sitelib  default is /usr/local/lib/perl5/site_perl/$apiversion
+: sitelib  default is /usr/local/lib/perl5/site_perl/
 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
 : sitelib may have an optional trailing /share.
 tdflt=`echo $sitelib | $sed 's,/share$,,'`
-tdflt="$tdflt/$archname"
+tdflt="$tdflt/$apiversion/$archname"
 set sitearch sitearch none
 eval $prefixit
 case "$sitearch" in
@@ -6191,28 +6372,11 @@ EOM
 fn=nd~+
 rp='Pathname for the site-specific architecture-dependent library files?'
 . ./getfile
-if $test "X$sitearchexp" != "X$ansexp"; then
-       installsitearch=''
-fi
 sitearch="$ans"
 sitearchexp="$ansexp"
-if $afs; then
-       $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in
-which site-specific architecture-dependent library files reside from
-the directory in which they are installed (and from which they are
-presumably copied to the former directory by occult means).
-
-EOM
-       case "$installsitearch" in
-       '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installsitearch";;
-       esac
-       fn=de~
-       rp='Where will site-specific architecture-dependent files be installed?'
-       . ./getfile
-       installsitearch="$ans"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installsitearch=`echo $sitearchexp | sed 's#^$prefix#$installprefix#'`
 else
        installsitearch="$sitearchexp"
 fi
@@ -6862,7 +7026,7 @@ while $test $# -ge 2; do
     shift 2;
 done > try.c;
 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
-if eval $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
+if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
        val="$define";
 else
        val="$undef";
@@ -7228,6 +7392,10 @@ if $test X"$use64bits" = X"$define"; then
        set lockf64 d_lockf64
        eval $inlibc
 
+       : see if llseek exists
+       set llseek d_llseek
+       eval $inlibc
+
        : see if lseek64 exists
        set lseek64 d_lseek64
        eval $inlibc
@@ -7269,6 +7437,7 @@ if $test X"$use64bits" = X"$define"; then
        echo $n "Checking to see if your system supports off64_t...$c" >&4
        $cat >try.c <<EOCP
 #include <sys/types.h>
+#include <unistd.h>
 off64_t foo() { off64_t x; x = 7; return x; }'
 EOCP
        if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
@@ -7279,7 +7448,26 @@ EOCP
                echo " Nope, it doesn't." >&4
        fi
        $rm -f try.*
-       set d_off64t
+       set d_off64_t
+       eval $setvar
+
+       : check for offset_t
+       echo " "
+       echo $n "Checking to see if your system supports offset_t...$c" >&4
+       $cat >try.c <<EOCP
+#include <sys/types.h>
+#include <unistd.h>
+offset_t foo() { offset_t x; x = 7; return x; }'
+EOCP
+       if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
+               val="$define"
+               echo " Yup, it does." >&4
+       else
+               val="$undef"
+               echo " Nope, it doesn't." >&4
+       fi
+       $rm -f try.*
+       set d_offset_t
        eval $setvar
 
        : check for ino64_t
@@ -7304,7 +7492,7 @@ EOCP
        else
                echo " Nope, it doesn't." >&4
        fi
-       set d_ino64t
+       set d_ino64_t
        eval $setvar
 
        : check for struct flock64
@@ -7339,7 +7527,7 @@ EOCP
 
 else
        val="$undef"
-       for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64t d_ino64t d_flock64_s d_dirent64_s
+       for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64_t d_offset_t d_ino64_t d_flock64_s d_dirent64_s
        do
                set $xxx
                eval $setvar
@@ -7518,6 +7706,10 @@ eval $inlibc
 set endservent d_endsent
 eval $inlibc
 
+: see if endspent exists
+set endspent d_endspent
+eval $inlibc
+
 : Locate the flags for 'open()'
 echo " "
 $cat >open3.c <<'EOCP'
@@ -8046,13 +8238,13 @@ eval $inlibc
 
 : see how we will look up host name
 echo " "
-if false; then
-       : dummy stub to allow use of elif
-elif set gethostname val -f d_gethname; eval $csym; $val; then
+call=''
+if set gethostname val -f d_gethname; eval $csym; $val; then
        echo 'gethostname() found.' >&4
        d_gethname="$define"
        call=gethostname
-elif set uname val -f d_uname; eval $csym; $val; then
+fi
+if set uname val -f d_uname; eval $csym; $val; then
        if ./xenix; then
                $cat <<'EOM'
 uname() was found, but you're running xenix, and older versions of xenix
@@ -8072,7 +8264,9 @@ EOM
        else
                echo 'uname() found.' >&4
                d_uname="$define"
-               call=uname
+               case "$call" in
+               '') call=uname ;;
+               esac
        fi
 fi
 case "$d_gethname" in
@@ -8140,6 +8334,10 @@ eval $hasproto
 set getlogin d_getlogin
 eval $inlibc
 
+: see if getmntent exists
+set getmntent d_getmntent
+eval $inlibc
+
 : see if getnetbyaddr exists
 set getnetbyaddr d_getnbyaddr
 eval $inlibc
@@ -8213,6 +8411,14 @@ echo " "
 set d_getservprotos getservent $i_netdb netdb.h
 eval $hasproto
 
+: see if getspent exists
+set getspent d_getspent
+eval $inlibc
+
+: see if getspnam exists
+set getspnam d_getspnam
+eval $inlibc
+
 : see if gettimeofday or ftime exists
 set gettimeofday d_gettimeod
 eval $inlibc
@@ -8257,6 +8463,10 @@ $define)
        ;;
 esac
 
+: see if hasmntopt exists
+set hasmntopt d_hasmntopt
+eval $inlibc
+
 : see if this is a netinet/in.h or sys/in.h system
 set netinet/in.h i_niin sys/in.h i_sysin
 eval $inhdr
@@ -8625,6 +8835,10 @@ eval $inlibc
 set mbtowc d_mbtowc
 eval $inlibc
 
+: see if memchr exists
+set memchr d_memchr
+eval $inlibc
+
 : see if memcmp exists
 set memcmp d_memcmp
 eval $inlibc
@@ -8748,8 +8962,18 @@ eval $inlibc
 set nice d_nice
 eval $inlibc
 
-: how to create joinable pthreads
+: see if POSIX threads are available
 if test "X$usethreads" = "X$define"; then
+       set pthread.h i_pthread
+       eval $inhdr
+else
+       i_pthread="$undef"
+fi
+
+
+
+: how to create joinable pthreads
+if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
        echo " "
        echo "Checking what constant to use for creating joinable pthreads..." >&4 
        $cat >try.c <<'EOCP'
@@ -8760,7 +8984,7 @@ int main() {
 EOCP
        set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
        if eval $compile; then
-               echo "You seem to use PTHREAD_CREATE_JOINABLE." >&2
+               echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
                val="$undef" # Yes, undef.
                set d_old_pthread_create_joinable
                eval $setvar
@@ -8770,7 +8994,7 @@ EOCP
        else
                set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
                if eval $compile; then
-                       echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&2
+                       echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
                        val="$define"
                        set d_old_pthread_create_joinable
                        eval $setvar
@@ -8780,7 +9004,7 @@ EOCP
                else            
                        set try -DJOINABLE=__UNDETACHED
                        if eval $compile; then
-                               echo "You seem to use __UNDETACHED." >&2
+                               echo "You seem to use __UNDETACHED." >&4
                                val="$define"
                                set d_old_pthread_create_joinable
                                eval $setvar
@@ -8788,7 +9012,7 @@ EOCP
                                set old_pthread_create_joinable
                                eval $setvar
                        else
-                               echo "Egads, nothing obvious found.  Guessing that you use 0." >&2
+                               echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
                                val="$define"
                                set d_old_pthread_create_joinable
                                eval $setvar
@@ -9547,6 +9771,10 @@ eval $inlibc
 set setsid d_setsid
 eval $inlibc
 
+: see if setspent exists
+set setspent d_setspent
+eval $inlibc
+
 : see if setvbuf exists
 set setvbuf d_setvbuf
 eval $inlibc
@@ -9764,7 +9992,7 @@ eval $hasfield
 
 : see if _ptr and _cnt from stdio act std
 echo " "
-if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
+if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
        echo "(Looks like you have stdio.h from Linux.)"
        case "$stdio_ptr" in
        '') stdio_ptr='((fp)->_IO_read_ptr)'
@@ -9889,6 +10117,41 @@ esac
 set d_stdiobase
 eval $setvar
 
+$cat >&4 <<EOM
+Checking how to access stdio streams by file descriptor number...
+EOM
+case "$stdio_stream_array" in
+'')    $cat >try.c <<EOCP
+#include <stdio.h>
+int main() {
+  if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
+    printf("yes\n");
+}
+EOCP
+       for s in _iob __iob __sF
+       do
+               set try -DSTDIO_STREAM_ARRAY=$s
+               if eval $compile; then
+                       case "`./try$exe_ext`" in
+                       yes)    stdio_stream_array=$s; break ;;
+                       esac
+               fi
+       done
+       $rm -f try.* try$exe_ext
+esac
+case "$stdio_stream_array" in
+'')    $cat >&4 <<EOM
+I can't figure out how to access stdio streams by file descriptor number.
+EOM
+       d_stdio_stream_array="$undef"
+       ;;
+*)     $cat >&4 <<EOM
+You can access stdio streams by file descriptor number by the $stdio_stream_array array.
+EOM
+       d_stdio_stream_array="$define"
+       ;;
+esac
+
 : see if strcoll exists
 set strcoll d_strcoll
 eval $inlibc
@@ -10122,7 +10385,16 @@ $define)
        false) dflt='n';;
        *) dflt='y';;
        esac
-       rp="Some systems have problems with vfork().  Do you want to use it?"
+       cat <<'EOM'
+Perl can only use a vfork() that doesn't suffer from strict
+restrictions on calling functions or modifying global data in
+the child.  For example, glibc-2.1 contains such a vfork()
+that is unsuitable.  If your system provides a proper fork()
+call, chances are that you do NOT want perl to use vfork().
+
+EOM
+       rp="Do you still want to use vfork()?"
        . ./myread
        case "$ans" in
        y|Y) ;;
@@ -10264,41 +10536,77 @@ Log='$Log'
 RCSfile='$RCSfile'
 Revision='$Revision'
 
+case "$crosscompile" in
+''|[nN]*) crosscompile="$undef" ;;
+esac
+
+case "$osname" in
+next|rhapsody) multiarch="$define" ;;
+esac
+case "$multiarch" in
+''|[nN]*) multiarch="$undef" ;;
+esac
+
 : check for alignment requirements
 echo " "
-case "$alignbytes" in
-'') echo "Checking alignment constraints..." >&4
-       $cat >try.c <<'EOCP'
+case "$crosscompile$multiarch" in
+*$define*)
+       $cat <<EOM
+You seem to be either cross-compiling or doing a multiarchitecture build,
+skipping the memory alignment check.
+
+EOM
+       case "$alignbytes" in
+       '') alignbytes=8 ;;
+       esac
+       ;;
+*)
+       case "$alignbytes" in
+       '') echo "Checking alignment constraints..." >&4
+               $cat >try.c <<'EOCP'
 struct foobar {
        char foo;
        double bar;
-} try;
+} try_algn;
 int main()
 {
-       printf("%d\n", (char *)&try.bar - (char *)&try.foo);
+       printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
 }
 EOCP
-       set try
-       if eval $compile_ok; then
-               dflt=`./try`
-       else
-               dflt='8'
-               echo "(I can't seem to compile the test program...)"
-       fi
-       ;;
-*) dflt="$alignbytes"
+               set try
+               if eval $compile_ok; then
+                       dflt=`./try`
+               else
+                       dflt='8'
+                       echo "(I can't seem to compile the test program...)"
+               fi
+               ;;
+       *) dflt="$alignbytes"
+               ;;
+       esac
+       rp="Doubles must be aligned on a how-many-byte boundary?"
+       . ./myread
+       alignbytes="$ans"
+       $rm -f try.c try
        ;;
 esac
-rp="Doubles must be aligned on a how-many-byte boundary?"
-. ./myread
-alignbytes="$ans"
-$rm -f try.c try
+
 
 : check for ordering of bytes in a long
-case "$byteorder" in
-'')
-       $cat <<'EOM'
-  
+echo " "
+case "$crosscompile$multiarch" in
+*$define*)
+       $cat <<EOM
+You seem to be either cross-compiling or doing a multiarchitecture build,
+skipping the byteorder check.
+
+EOM
+       byteorder=''
+       ;;
+*)
+       case "$byteorder" in
+       '')
+               $cat <<'EOM'
 In the following, larger digits indicate more significance.  A big-endian
 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
@@ -10306,7 +10614,7 @@ machines may have weird orders like 3412.  A Cray will report 87654321. If
 the test program works the default is probably right.
 I'm now running the test program...
 EOM
-       $cat >try.c <<'EOCP'
+               $cat >try.c <<'EOCP'
 #include <stdio.h>
 int main()
 {
@@ -10326,37 +10634,40 @@ int main()
        exit(0);
 }
 EOCP
-       xxx_prompt=y
-       set try
-       if eval $compile && ./try > /dev/null; then
-               dflt=`./try`
-               case "$dflt" in
-               [1-4][1-4][1-4][1-4]|12345678|87654321)
-                       echo "(The test program ran ok.)"
-                       echo "byteorder=$dflt"
-                       xxx_prompt=n
+               xxx_prompt=y
+               set try
+               if eval $compile && ./try > /dev/null; then
+                       dflt=`./try`
+                       case "$dflt" in
+                       [1-4][1-4][1-4][1-4]|12345678|87654321)
+                               echo "(The test program ran ok.)"
+                               echo "byteorder=$dflt"
+                               xxx_prompt=n
                        ;;
-               ????|????????) echo "(The test program ran ok.)" ;;
-               *) echo "(The test program didn't run right for some reason.)" ;;
-               esac
-       else
-               dflt='4321'
-               cat <<'EOM'
+                       ????|????????) echo "(The test program ran ok.)" ;;
+                       *) echo "(The test program didn't run right for some reason.)" ;;
+                       esac
+               else
+                       dflt='4321'
+                       cat <<'EOM'
 (I can't seem to compile the test program.  Guessing big-endian...)
 EOM
-       fi
-       case "$xxx_prompt" in
-       y)
-               rp="What is the order of bytes in a long?"
-               . ./myread
-               byteorder="$ans"
-               ;;
-       *)      byteorder=$dflt
+               fi
+               case "$xxx_prompt" in
+               y)
+                       rp="What is the order of bytes in a long?"
+                       . ./myread
+                       byteorder="$ans"
+                       ;;
+               *)      byteorder=$dflt
+                       ;;
+               esac
                ;;
        esac
+       $rm -f try.c try
        ;;
 esac
-$rm -f try.c try
+
 
 : how do we catenate cpp tokens here?
 echo " "
@@ -10797,7 +11108,7 @@ if eval $compile_ok; then
                echo "You have EBCDIC." >&4
                val="$define"
        else
-               echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin." >&4
+               echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
        fi
 else
        echo "I'm unable to compile the test program." >&4
@@ -10807,11 +11118,211 @@ $rm -f tebcdic.c tebcdic
 set ebcdic
 eval $setvar
 
+echo " "
+$cat >&4 <<EOM
+Checking how to flush all pending stdio output...
+EOM
+# I only know how to find the first 32 possibly open files on SunOS.
+# See also hints/sunos_4_1.sh and util.c  --AD
+case "$osname" in
+sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
+esac
+$cat >>try.c <<EOCP
+#include <stdio.h>
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+# include <unistd.h>
+#endif
+#$d_sysconf HAS_SYSCONF
+#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
+#ifdef HAS_STDIO_STREAM_ARRAY
+# define STDIO_STREAM_ARRAY $stdio_stream_array
+#endif
+int main() {
+  FILE* p = fopen("try.out", "w");
+#ifdef TRY_FPUTC
+  fputc('x', p);
+#else
+# ifdef TRY_FPRINTF
+  fprintf(p, "x");
+# endif
+#endif
+#ifdef TRY_FFLUSH_NULL
+  fflush(NULL);
+#endif
+#ifdef TRY_FFLUSH_ALL
+  {
+    long open_max = -1;
+# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
+    open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
+# else
+#  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
+    open_max = sysconf(_SC_OPEN_MAX);
+#  else
+#   ifdef FOPEN_MAX
+    open_max = FOPEN_MAX;
+#   else
+#    ifdef OPEN_MAX
+    open_max = OPEN_MAX;
+#    else
+#     ifdef _NFILE
+    open_max = _NFILE;
+#     endif
+#    endif
+#   endif
+#  endif
+# endif 
+# ifdef HAS_STDIO_STREAM_ARRAY
+    if (open_max > 0) {
+      long i;
+      for (i = 0; i < open_max; i++)
+           if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
+               STDIO_STREAM_ARRAY[i]._file < open_max &&
+               STDIO_STREAM_ARRAY[i]._flag)
+               fflush(&STDIO_STREAM_ARRAY[i]);
+    }  
+  }
+# endif
+#endif
+  _exit(42);
+}
+EOCP
+: first we have to find out how _not_ to flush
+if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
+    output=''
+    set try -DTRY_FPUTC
+    if eval $compile; then
+           $rm -f try.out
+           ./try$exe_ext 2>/dev/null
+           if $test ! -s try.out -a "X$?" = X42; then
+               output=-DTRY_FPUTC
+           fi
+    fi
+    case "$output" in
+    '')
+           set try -DTRY_FPRINTF
+           $rm -f try.out
+           if eval $compile; then
+                   $rm -f try.out
+                   ./try$exe_ext 2>/dev/null
+                   if $test ! -s try.out -a "X$?" = X42; then
+                       output=-DTRY_FPRINTF
+                   fi
+           fi
+       ;;
+    esac
+fi
+: check for fflush NULL behaviour
+case "$fflushNULL" in
+'')    set try -DTRY_FFLUSH_NULL $output
+       if eval $compile; then
+               $rm -f try.out
+               ./try$exe_ext 2>/dev/null
+               code="$?"
+               if $test -s try.out -a "X$code" = X42; then
+                       fflushNULL="`$cat try.out`"
+               else
+                       if $test "X$code" != X42; then
+                               $cat >&4 <<EOM
+(If this test failed, don't worry, we'll try another method shortly.)
+EOM
+                       fi
+               fi
+       fi
+       $rm -f core try.core core.try.*
+       case "$fflushNULL" in
+       x)      $cat >&4 <<EOM
+Your fflush(NULL) works okay.
+EOM
+               fflushNULL="$define"
+               ;;
+       '')     $cat >&4 <<EOM
+Your fflush(NULL) isn't working (contrary to ANSI C).
+EOM
+               fflushNULL="$undef"
+               ;;
+       *)      $cat >&4 <<EOM
+Cannot figure out whether your fflush(NULL) works or not.
+I'm assuming it doesn't (contrary to ANSI C).
+EOM
+               fflushNULL="$undef"
+               ;;
+       esac
+       ;;
+$define|true|[yY]*)
+       fflushNULL="$define"
+       ;;
+*)
+       fflushNULL="$undef"
+       ;;
+esac
+: check explicit looping only if NULL did not work
+case "$fflushNULL" in
+"$undef")
+       : check for fflush all behaviour
+       case "$fflushall" in
+       '')     set try -DTRY_FFLUSH_ALL $output
+               if eval $compile; then
+                       $cat >&4 <<EOM
+(Now testing the other method--but note that also this may fail.)
+EOM
+                       $rm -f try.out
+                       ./try$exe_ext 2>/dev/null
+                       if $test -s try.out -a "X$?" = X42; then
+                               fflushall="`$cat try.out`"
+                       fi
+               fi
+               $rm -f core try.core core.try.*
+               case "$fflushall" in
+               x)      $cat >&4 <<EOM
+Whew. Flushing explicitly all the stdio streams works.
+EOM
+                       fflushall="$define"
+                       ;;
+               '')     $cat >&4 <<EOM
+Sigh. Flushing explicitly all the stdio streams doesn't work.
+EOM
+                       fflushall="$undef"
+                       ;;
+               *)      $cat >&4 <<EOM
+Cannot figure out whether flushing stdio streams explicitly works or not.
+I'm assuming it doesn't.
+EOM
+                       fflushall="$undef"
+                       ;;
+               esac
+               ;;
+       "$define"|true|[yY]*)
+               fflushall="$define"
+               ;;
+       *)
+               fflushall="$undef"
+               ;;
+       esac
+       ;;
+*)     fflushall="$undef"      
+       ;;
+esac
+case "$fflushNULL$fflushall" in
+undefundef)
+       $cat <<EOM
+I cannot figure out how to flush pending stdio output.
+EOM
+       ;;
+esac
+$rm -f try.* try$exe_ext
+
 : see what type file positions are declared as in the library
 rp="What is the type for file position used by fsetpos()?"
 set fpos_t fpostype long stdio.h sys/types.h
 eval $typedef_ask
 
+: Store the full pathname to the ar program for use in the C program
+: Respect a hint or command line value for full_ar.
+case "$full_ar" in
+'') full_ar=$ar ;;
+esac
+
 : Store the full pathname to the sed program for use in the C program
 full_sed=$sed
 
@@ -11279,6 +11790,10 @@ EOM
 #ifdef I_SYS_SELECT
 #include <sys/select.h>
 #endif
+#$d_socket HAS_SOCKET
+#ifdef HAS_SOCKET
+#   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
+#endif
 #include <stdio.h>
 $selecttype b;
 #define S sizeof(*(b))
@@ -11346,6 +11861,8 @@ esac
 
 : Trace out the files included by signal.h, then look for SIGxxx names.
 : Remove SIGARRAYSIZE used by HPUX.
+: Remove SIGSTKSIZE used by Linux.
+: Remove SIGSTKSZ used by Posix.
 : Remove SIGTYP void lines used by OS2.
 xxx=`echo '#include <signal.h>' |
        $cppstdin $cppminus $cppflags 2>/dev/null |
@@ -11363,7 +11880,7 @@ case "$xxxfiles" in
 '')    xxxfiles=`./findhdr signal.h` ;;
 esac
 xxx=`awk '
-$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ {
+$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
        print substr($2, 4, 20)
 }
 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
@@ -11463,20 +11980,22 @@ $1 ~ /^NSIG$/ { nsig = $2 }
        sig_name[$2] = $1
        sig_num[$2] = $2
     }
-
 }
 END { 
-    if (nsig == 0) { nsig = maxsig + 1 }
-       for (n = 1; n < nsig; n++) {
-               if (sig_name[n]) {
-                       printf("%s %d\n", sig_name[n], sig_num[n])
-               }
-               else {
-                       printf("NUM%d %d\n", n, n) 
-               }
+    if (nsig == 0) {
+       nsig = maxsig + 1
+    }
+    printf("NSIG %d\n", nsig);
+    for (n = 1; n < nsig; n++) {
+       if (sig_name[n]) {
+           printf("%s %d\n", sig_name[n], sig_num[n])
        }
+       else {
+           printf("NUM%d %d\n", n, n) 
+       }
+    }
     for (n = 0; n < ndups; n++) {
-               printf("%s %d\n", dup_name[n], dup_num[n])
+       printf("%s %d\n", dup_name[n], dup_num[n])
     }
 }
 EOP
@@ -11542,7 +12061,8 @@ else
        0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
        esac
        echo $@ | $tr ' ' $trnl | \
-               $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
+           $awk '{ printf "%s %d\n", $1, ++s; }
+                 END { printf "NSIG %d\n", ++s }' >signal.lst
 fi
 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
 EOS
@@ -11561,19 +12081,20 @@ case "$doinit" in
 yes)
        echo "Generating a list of signal names and numbers..." >&4
        . ./signal_cmd
-       sig_name=`$awk '{printf "%s ", $1}' signal.lst`
-       sig_name="ZERO $sig_name"
-       sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
-                                               { printf "\"%s\", ", $1 }
-                                               END { printf "0\n" }' signal.lst`
-       sig_num=`$awk '{printf "%d ", $2}' signal.lst`
-       sig_num="0 $sig_num"
-       sig_num_init=`$awk 'BEGIN { printf "0, " }
-                                       { printf "%d, ", $2}
-                                       END { printf "0\n"}' signal.lst`
-       ;;
-esac
-echo "The following signals are available:"
+       sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
+       sig_name=`$awk 'BEGIN { printf "ZERO " }
+                       !/^NSIG/ { printf "%s ", $1 }' signal.lst`
+       sig_num=`$awk  'BEGIN { printf "0 " }
+                       !/^NSIG/ { printf "%d ", $2 }' signal.lst`
+       sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
+                            !/^NSIG/   { printf "\"%s\", ", $1 }
+                            END        { printf "0\n" }' signal.lst`
+       sig_num_init=`$awk  'BEGIN      { printf "0, " }
+                            !/^NSIG/   { printf "%d, ", $2}
+                            END        { printf "0\n"}' signal.lst`
+       ;;
+esac
+echo "The following $sig_count signals are available:"
 echo " "
 echo $sig_name | $awk \
 'BEGIN { linelen = 0 }
@@ -11838,6 +12359,10 @@ esac
 set i_neterrno
 eval $setvar
 
+: see if netinet/tcp.h is available
+set netinet/tcp.h i_netinettcp
+eval $inhdr
+
 : see if this is a poll.h system
 set poll.h i_poll
 eval $inhdr
@@ -11894,12 +12419,16 @@ $eunicefix Cppsym
 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
 
 : now check the C compiler for additional symbols
+postprocess_cc_v=''
+case "$osname" in
+aix) postprocess_cc_v="|$tr , ' '" ;;
+esac
 $cat >ccsym <<EOS
 $startsh
 $cat >tmp.c <<EOF
 extern int foo;
 EOF
-for i in \`$cc -v -c tmp.c 2>&1\`
+for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
 do
        case "\$i" in
        -D*) echo "\$i" | $sed 's/^-D//';;
@@ -11908,6 +12437,7 @@ do
 done
 $rm -f try.c
 EOS
+postprocess_cc_v=''
 chmod +x ccsym
 $eunicefix ccsym
 ./ccsym > ccsym1.raw
@@ -12019,6 +12549,14 @@ set i_termio; eval $setvar
 val=$val2; set i_sgtty; eval $setvar
 val=$val3; set i_termios; eval $setvar
 
+: see if this is a shadow.h system
+set shadow.h i_shadow
+eval $inhdr
+
+: see if this is a socks.h system
+set socks.h i_socks
+eval $inhdr
+
 : see if stdarg is available
 echo " "
 if $test `./findhdr stdarg.h`; then
@@ -12207,8 +12745,6 @@ eval $setvar
 
 echo " "
 echo "Looking for extensions..." >&4
-tdir=`pwd`
-cd $rsrc/ext
 : If we are using the old config.sh, known_extensions may contain
 : old or inaccurate or duplicate values.
 known_extensions=''
@@ -12217,30 +12753,35 @@ nonxs_extensions=''
 : We do not just use MANIFEST because the user may have dropped
 : some additional extensions into the source tree and expect them
 : to be built.
-for xxx in * ; do
-       case "$xxx" in
-       DynaLoader|dynaload) ;;
-       *)      if $test -f $xxx/$xxx.xs; then
-                       known_extensions="$known_extensions $xxx"
-               elif $test -f $xxx/Makefile.PL; then
-                       nonxs_extensions="$nonxs_extensions $xxx"
-               else
-                       if $test -d $xxx; then
-                               # Look for nested extensions, eg. Devel/Dprof.
-                               cd $xxx
-                               for yyy in * ; do
-                               if $test -f $yyy/$yyy.xs; then
-                                       known_extensions="$known_extensions $xxx/$yyy"
-                               elif $test -f $yyy/Makefile.PL; then
-                                       nonxs_extensions="$nonxs_extensions $xxx/$yyy"
-                               fi
-                               done
-                               cd ..
-                       fi
-               fi 
-               ;;
-       esac
-done
+
+: Function to recursively find available extensions, ignoring DynaLoader
+: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
+find_extensions='
+    for xxx in *; do
+       case "$xxx" in
+           DynaLoader|dynaload) ;;
+           *)
+           if $test -f $xxx/$xxx.xs; then
+               known_extensions="$known_extensions $1$xxx";
+           elif $test -f $xxx/Makefile.PL; then
+               nonxs_extensions="$nonxs_extensions $1$xxx";
+           else
+               if $test -d $xxx -a $# -lt 10; then
+                   set $1$xxx/ $*;
+                   cd $xxx;
+                   eval $find_extensions;
+                   cd ..;
+                   shift;
+               fi;
+           fi
+           ;;
+       esac;
+    done'
+tdir=`pwd`
+cd $rsrc/ext
+set X
+shift
+eval $find_extensions
 set X $nonxs_extensions
 shift
 nonxs_extensions="$*"
@@ -12564,6 +13105,7 @@ cppminus='$cppminus'
 cpprun='$cpprun'
 cppstdin='$cppstdin'
 cppsymbols='$cppsymbols'
+crosscompile='$crosscompile'
 cryptlib='$cryptlib'
 csh='$csh'
 d_Gconvert='$d_Gconvert'
@@ -12610,6 +13152,7 @@ d_endnent='$d_endnent'
 d_endpent='$d_endpent'
 d_endpwent='$d_endpwent'
 d_endsent='$d_endsent'
+d_endspent='$d_endspent'
 d_eofnblk='$d_eofnblk'
 d_eunice='$d_eunice'
 d_fchmod='$d_fchmod'
@@ -12650,6 +13193,7 @@ d_gethent='$d_gethent'
 d_gethname='$d_gethname'
 d_gethostprotos='$d_gethostprotos'
 d_getlogin='$d_getlogin'
+d_getmntent='$d_getmntent'
 d_getnbyaddr='$d_getnbyaddr'
 d_getnbyname='$d_getnbyname'
 d_getnent='$d_getnent'
@@ -12668,19 +13212,23 @@ d_getsbyname='$d_getsbyname'
 d_getsbyport='$d_getsbyport'
 d_getsent='$d_getsent'
 d_getservprotos='$d_getservprotos'
+d_getspent='$d_getspent'
+d_getspnam='$d_getspnam'
 d_gettimeod='$d_gettimeod'
 d_gnulibc='$d_gnulibc'
 d_grpasswd='$d_grpasswd'
+d_hasmntopt='$d_hasmntopt'
 d_htonl='$d_htonl'
 d_index='$d_index'
 d_inetaton='$d_inetaton'
-d_ino64t='$d_ino64t'
+d_ino64_t='$d_ino64_t'
 d_int64t='$d_int64t'
 d_iovec_s='$d_iovec_s'
 d_isascii='$d_isascii'
 d_killpg='$d_killpg'
 d_lchown='$d_lchown'
 d_link='$d_link'
+d_llseek='$d_llseek'
 d_locconv='$d_locconv'
 d_lockf64='$d_lockf64'
 d_lockf='$d_lockf'
@@ -12693,6 +13241,7 @@ d_madvise='$d_madvise'
 d_mblen='$d_mblen'
 d_mbstowcs='$d_mbstowcs'
 d_mbtowc='$d_mbtowc'
+d_memchr='$d_memchr'
 d_memcmp='$d_memcmp'
 d_memcpy='$d_memcpy'
 d_memmove='$d_memmove'
@@ -12718,7 +13267,8 @@ d_munmap='$d_munmap'
 d_mymalloc='$d_mymalloc'
 d_nextkey64='$d_nextkey64'
 d_nice='$d_nice'
-d_off64t='$d_off64t'
+d_off64_t='$d_off64_t'
+d_offset_t='$d_offset_t'
 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
 d_oldpthreads='$d_oldpthreads'
 d_oldsock='$d_oldsock'
@@ -12785,6 +13335,7 @@ d_setrgid='$d_setrgid'
 d_setruid='$d_setruid'
 d_setsent='$d_setsent'
 d_setsid='$d_setsid'
+d_setspent='$d_setspent'
 d_setvbuf='$d_setvbuf'
 d_sfio='$d_sfio'
 d_shm='$d_shm'
@@ -12804,6 +13355,7 @@ d_statfsflags='$d_statfsflags'
 d_statvfs='$d_statvfs'
 d_stdio_cnt_lval='$d_stdio_cnt_lval'
 d_stdio_ptr_lval='$d_stdio_ptr_lval'
+d_stdio_stream_array='$d_stdio_stream_array'
 d_stdiobase='$d_stdiobase'
 d_stdstdio='$d_stdstdio'
 d_store64='$d_store64'
@@ -12837,6 +13389,7 @@ d_tzname='$d_tzname'
 d_umask='$d_umask'
 d_uname='$d_uname'
 d_union_semun='$d_union_semun'
+d_vendorlib='$d_vendorlib'
 d_vfork='$d_vfork'
 d_void_closedir='$d_void_closedir'
 d_voidsig='$d_voidsig'
@@ -12868,11 +13421,14 @@ eunicefix='$eunicefix'
 exe_ext='$exe_ext'
 expr='$expr'
 extensions='$extensions'
+fflushNULL='$fflushNULL'
+fflushall='$fflushall'
 find='$find'
 firstmakefile='$firstmakefile'
 flex='$flex'
 fpostype='$fpostype'
 freetype='$freetype'
+full_ar='$full_ar'
 full_csh='$full_csh'
 full_sed='$full_sed'
 gccversion='$gccversion'
@@ -12909,12 +13465,16 @@ i_mntent='$i_mntent'
 i_ndbm='$i_ndbm'
 i_netdb='$i_netdb'
 i_neterrno='$i_neterrno'
+i_netinettcp='$i_netinettcp'
 i_niin='$i_niin'
 i_poll='$i_poll'
+i_pthread='$i_pthread'
 i_pwd='$i_pwd'
 i_rpcsvcdbm='$i_rpcsvcdbm'
 i_sfio='$i_sfio'
 i_sgtty='$i_sgtty'
+i_shadow='$i_shadow'
+i_socks='$i_socks'
 i_stdarg='$i_stdarg'
 i_stddef='$i_stddef'
 i_stdlib='$i_stdlib'
@@ -12958,11 +13518,15 @@ installarchlib='$installarchlib'
 installbin='$installbin'
 installman1dir='$installman1dir'
 installman3dir='$installman3dir'
+installprefix='$installprefix'
+installprefixexp='$installprefixexp'
 installprivlib='$installprivlib'
 installscript='$installscript'
 installsitearch='$installsitearch'
 installsitelib='$installsitelib'
+installstyle='$installstyle'
 installusrbinperl='$installusrbinperl'
+installvendorlib='$installvendorlib'
 intsize='$intsize'
 known_extensions='$known_extensions'
 ksh='$ksh'
@@ -12970,6 +13534,7 @@ large='$large'
 ld='$ld'
 lddlflags='$lddlflags'
 ldflags='$ldflags'
+ldlibpthname='$ldlibpthname'
 less='$less'
 lib_ext='$lib_ext'
 libc='$libc'
@@ -13013,6 +13578,7 @@ mmaptype='$mmaptype'
 models='$models'
 modetype='$modetype'
 more='$more'
+multiarch='$multiarch'
 mv='$mv'
 myarchname='$myarchname'
 mydomain='$mydomain'
@@ -13078,6 +13644,7 @@ shmattype='$shmattype'
 shortsize='$shortsize'
 shrpenv='$shrpenv'
 shsharp='$shsharp'
+sig_count='$sig_count'
 sig_name='$sig_name'
 sig_name_init='$sig_name_init'
 sig_num='$sig_num'
@@ -13087,6 +13654,8 @@ sitearch='$sitearch'
 sitearchexp='$sitearchexp'
 sitelib='$sitelib'
 sitelibexp='$sitelibexp'
+siteprefix='$siteprefix'
+siteprefixexp='$siteprefixexp'
 sizetype='$sizetype'
 sleep='$sleep'
 smail='$smail'
@@ -13109,6 +13678,7 @@ stdio_bufsiz='$stdio_bufsiz'
 stdio_cnt='$stdio_cnt'
 stdio_filbuf='$stdio_filbuf'
 stdio_ptr='$stdio_ptr'
+stdio_stream_array='$stdio_stream_array'
 strings='$strings'
 submit='$submit'
 subversion='$subversion'
@@ -13137,10 +13707,16 @@ useperlio='$useperlio'
 useposix='$useposix'
 usesfio='$usesfio'
 useshrplib='$useshrplib'
+usesocks='$usesocks'
 usethreads='$usethreads'
+usevendorprefix='$usevendorprefix'
 usevfork='$usevfork'
 usrinc='$usrinc'
 uuname='$uuname'
+vendorlib='$vendorlib'
+vendorlibexp='$vendorlibexp'
+vendorprefix='$vendorprefix'
+vendorprefixexp='$vendorprefixexp'
 version='$version'
 vi='$vi'
 voidflags='$voidflags'
@@ -13154,8 +13730,8 @@ $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
 
 : add special variables
 $test -f $src/patchlevel.h && \
-awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
-echo "CONFIG=true" >>config.sh
+awk '/^#define[        ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
+echo "CONFIGDOTSH=true" >>config.sh
 
 : propagate old symbols
 if $test -f UU/config.sh; then