This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Introduction of d_pseudofork
[perl5.git] / Configure
index e445bdb..cc86d68 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -26,7 +26,7 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Mon Oct 10 16:08:59 CEST 2005 [metaconfig 3.0 PL70]
+# Generated on Tue Dec  5 15:35:51 CET 2006 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >c1$$ <<EOF
@@ -65,6 +65,18 @@ EOF
        exit 1
 fi
 
+if test ! -c /dev/null ; then
+       cat >&4 <<EOF
+***
+*** I'm sorry, but /dev/null appears to be a file rather than a device.
+*** Please consult your operating sytem's notes for making a device
+*** in /dev.
+*** Cannot continue, aborting.
+***
+EOF
+       exit 1
+fi
+
 : compute my invocation name
 me=$0
 case "$0" in
@@ -319,7 +331,9 @@ d_atoll=''
 baserev=''
 bin=''
 binexp=''
+initialinstalllocation=''
 installbin=''
+userelocatableinc=''
 byteorder=''
 cc=''
 ccflags=''
@@ -352,9 +366,13 @@ d_attribute_noreturn=''
 d_attribute_pure=''
 d_attribute_unused=''
 d_attribute_warn_unused_result=''
+d_printf_format_null=''
 d_bcmp=''
 d_bcopy=''
+d_builtin_choose_expr=''
+d_builtin_expect=''
 d_bzero=''
+d_c99_variadic_macros=''
 d_casti32=''
 castflags=''
 d_castneg=''
@@ -362,17 +380,20 @@ d_chown=''
 d_chroot=''
 d_chsize=''
 d_class=''
+d_clearenv=''
 d_closedir=''
 d_void_closedir=''
 d_cmsghdr_s=''
 d_const=''
 d_copysignl=''
+d_cplusplus=''
 cryptlib=''
 d_crypt=''
 crypt_r_proto=''
 d_crypt_r=''
 d_csh=''
 full_csh=''
+d_ctermid=''
 ctermid_r_proto=''
 d_ctermid_r=''
 ctime_r_proto=''
@@ -381,6 +402,7 @@ d_cuserid=''
 d_dbl_dig=''
 d_dbminitproto=''
 d_difftime=''
+d_dir_dd_fd=''
 d_dirfd=''
 d_dlerror=''
 d_dlopen=''
@@ -440,6 +462,7 @@ d_fsync=''
 d_ftello=''
 d_ftime=''
 d_gettimeod=''
+d_futimes=''
 d_Gconvert=''
 d_getcwd=''
 d_getespwnam=''
@@ -540,6 +563,7 @@ d_ldbl_dig=''
 d_libm_lib_version=''
 d_link=''
 d_localtime_r=''
+d_localtime_r_needs_tzset=''
 localtime_r_proto=''
 d_locconv=''
 d_lockf=''
@@ -679,6 +703,8 @@ d_sigaction=''
 d_sigprocmask=''
 d_sigsetjmp=''
 usesitecustomize=''
+d_snprintf=''
+d_vsnprintf=''
 d_sockatmark=''
 d_sockatmarkproto=''
 d_msg_ctrunc=''
@@ -694,6 +720,7 @@ sockethdr=''
 socketlib=''
 d_socklen_t=''
 d_socks5_init=''
+d_sprintf_returns_strlen=''
 d_sqrtl=''
 d_srand48_r=''
 srand48_r_proto=''
@@ -768,6 +795,7 @@ d_unsetenv=''
 d_usleep=''
 d_usleepproto=''
 d_ustat=''
+d_pseudofork=''
 d_vfork=''
 usevfork=''
 d_voidsig=''
@@ -912,6 +940,7 @@ i_stdarg=''
 i_varargs=''
 i_varhdr=''
 i_vfork=''
+d_inc_version_list=''
 inc_version_list=''
 inc_version_list_init=''
 installprefix=''
@@ -955,6 +984,10 @@ sPRIgldbl=''
 sSCNfldbl=''
 lseeksize=''
 lseektype=''
+mad=''
+madlyh=''
+madlyobj=''
+madlysrc=''
 make_set_make=''
 d_mymalloc=''
 freetype=''
@@ -1087,6 +1120,7 @@ sig_name_init=''
 sig_num=''
 sig_num_init=''
 sig_size=''
+d_sitearch=''
 installsitearch=''
 sitearch=''
 sitearchexp=''
@@ -1150,7 +1184,6 @@ nm_so_opt=''
 runnm=''
 usenm=''
 useperlio=''
-userelocatableinc=''
 usesocks=''
 d_oldpthreads=''
 use5005threads=''
@@ -1248,6 +1281,10 @@ locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
 : no include file wanted by default
 inclwanted=''
 
+: Enable -DEBUGGING and -DDEBUGGING from the command line
+EBUGGING=''
+DEBUGGING=old
+
 groupstype=''
 libnames=''
 : change the next line if compiling for Xenix/286 on Xenix/386
@@ -3125,18 +3162,21 @@ EOM
                domainos) osname=apollo
                        osvers="$3"
                        ;;
-               dgux)   osname=dgux 
+               dgux)   osname=dgux
+                       osvers="$3"
+                       ;;
+               dragonfly) osname=dragonfly
                        osvers="$3"
                        ;;
                dynixptx*) osname=dynixptx
                        osvers=`echo "$4"|sed 's/^v//'`
                        ;;
-               freebsd) osname=freebsd 
+               freebsd) osname=freebsd
                        osvers="$3" ;;
                genix)  osname=genix ;;
                gnu)    osname=gnu
                        osvers="$3" ;;
-               hp*)    osname=hpux 
+               hp*)    osname=hpux
                        osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
                        ;;
                irix*)  osname=irix
@@ -3232,7 +3272,7 @@ EOM
                        *freebsd*) ;;
                        svr*)
                                : svr4.x or possibly later
-                               case "svr$3" in 
+                               case "svr$3" in
                                ${osname}*)
                                        osname=svr$3
                                        osvers=$4
@@ -3295,7 +3335,7 @@ EOM
                        osvers="$5"
                fi
        fi
-       
+
         case "$targetarch" in
         '') ;;
         *)  hostarch=$osname
@@ -3363,8 +3403,13 @@ EOM
        $cat <<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 or a wrong OS.
+If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
+previous run of Configure, you may specify it as well as or instead of
+OS-specific hints.  If hints are provided for your OS, you should use them:
+although Perl can probably be built without hints on many platforms, using
+hints often improve performance and may enable features that Configure can't
+set up on its own. If there are no hints that match your OS, specify "none";
+DO NOT give a wrong version or a wrong OS.
 
 EOM
 
@@ -3494,752 +3539,972 @@ case "$cf_by" in
        esac ;;
 esac
 
-: set up the script used to warn in case of inconsistency
-cat <<EOS >whoa
-$startsh
-EOS
-cat <<'EOSC' >>whoa
-dflt=y
-echo " "
-echo "*** WHOA THERE!!! ***" >&4
-echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
-rp="    Keep the $hint value?"
-. ./myread
-case "$ans" in
-y) td=$was; tu=$was;;
+: decide how portable to be.  Allow command line overrides.
+case "$d_portable" in
+"$undef") ;;
+*)     d_portable="$define" ;;
 esac
-EOSC
-
-: function used to set $1 to $val
-setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
-case "$val$was" in
-$define$undef) . ./whoa; eval "$var=\$td";;
-$undef$define) . ./whoa; eval "$var=\$tu";;
-*) eval "$var=$val";;
-esac'
 
-case "$usesocks" in
-$define|true|[yY]*)    dflt='y';;
-*) dflt='n';;
+: set up shell script to do ~ expansion
+cat >filexp <<EOSS
+$startsh
+: expand filename
+case "\$1" in
+ ~/*|~)
+       echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
+       ;;
+ ~*)
+       if $test -f /bin/csh; then
+               /bin/csh -f -c "glob \$1"
+               failed=\$?
+               echo ""
+               exit \$failed
+       else
+               name=\`$expr x\$1 : '..\([^/]*\)'\`
+               dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
+               if $test ! -d "\$dir"; then
+                       me=\`basename \$0\`
+                       echo "\$me: can't locate home directory for: \$name" >&2
+                       exit 1
+               fi
+               case "\$1" in
+               */*)
+                       echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
+                       ;;
+               *)
+                       echo \$dir
+                       ;;
+               esac
+       fi
+       ;;
+*)
+       echo \$1
+       ;;
 esac
-cat <<EOM
-
-Perl can be built to use the SOCKS proxy protocol library.  To do so,
-Configure must be run with -Dusesocks.  If you use SOCKS you also need
-to use the PerlIO abstraction layer, this will be implicitly selected.
+EOSS
+chmod +x filexp
+$eunicefix filexp
 
-If this doesn't make any sense to you, just accept the default '$dflt'.
-EOM
-rp='Build Perl for SOCKS?'
-. ./myread
-case "$ans" in
-y|Y)   val="$define" ;;     
-*)      val="$undef" ;;
+: now set up to get a file name
+cat <<EOS >getfile
+$startsh
+EOS
+cat <<'EOSC' >>getfile
+tilde=''
+fullpath=''
+already=''
+skip=''
+none_ok=''
+exp_file=''
+nopath_ok=''
+orig_rp="$rp"
+orig_dflt="$dflt"
+case "$gfpth" in
+'') gfpth='.' ;;
 esac
-set usesocks
-eval $setvar
 
-case "$usesocks" in
-$define|true|[yY]*) useperlio="$define";;
+case "$fn" in
+*\(*)
+       : getfile will accept an answer from the comma-separated list
+       : enclosed in parentheses even if it does not meet other criteria.
+       expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
+       fn=`echo $fn | sed 's/(.*)//'`
+       ;;
 esac
 
-case "$useperlio" in
-$define|true|[yY]*|'') dflt='y';;
-*) dflt='n';;
+case "$fn" in
+*:*)
+       loc_file=`expr $fn : '.*:\(.*\)'`
+       fn=`expr $fn : '\(.*\):.*'`
+       ;;
 esac
-cat <<EOM
 
-Previous version of $package used the standard IO mechanisms as
-defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
-alternate IO mechanisms via the PerlIO abstraction layer, but the
-stdio mechanism is still available if needed.  The abstraction layer
-can use AT&T's sfio (if you already have sfio installed) or regular stdio.
-Using PerlIO with sfio may cause problems with some extension modules.
-
-If this doesn't make any sense to you, just accept the default '$dflt'.
-EOM
-rp='Use the PerlIO abstraction layer?'
-. ./myread
-case "$ans" in
-y|Y) 
-       val="$define"
-       ;;
-*)      
-       echo "Ok, doing things the stdio way."
-       val="$undef"
-       ;;
+case "$fn" in
+*~*) tilde=true;;
+esac
+case "$fn" in
+*/*) fullpath=true;;
+esac
+case "$fn" in
+*+*) skip=true;;
+esac
+case "$fn" in
+*n*) none_ok=true;;
+esac
+case "$fn" in
+*e*) exp_file=true;;
+esac
+case "$fn" in
+*p*) nopath_ok=true;;
 esac
-set useperlio
-eval $setvar 
 
-case "$usesocks" in
-$define|true|[yY]*)
-       case "$useperlio" in
-       $define|true|[yY]*) ;;
-       *)      cat >&4 <<EOM
+case "$fn" in
+*f*) type='File';;
+*d*) type='Directory';;
+*l*) type='Locate';;
+esac
 
-You are using the SOCKS proxy protocol library which means that you
-should also use the PerlIO layer.  You may be headed for trouble.
+what="$type"
+case "$what" in
+Locate) what='File';;
+esac
 
-EOM
-               ;;
+case "$exp_file" in
+'')
+       case "$d_portable" in
+       "$define") ;;
+       *) exp_file=true;;
        esac
        ;;
 esac
 
-       
-case "$usethreads" in
-$define|true|[yY]*)     dflt='y';;
-*)     # Catch case where user specified ithreads or 5005threads but
-       # forgot -Dusethreads (A.D. 4/2002)
-       case "$useithreads$use5005threads" in
-       *$define*)      
-               case "$useperlio" in
-               "$define")      dflt='y' ;;
-               *)              dflt='n' ;;
+cd ..
+while test "$type"; do
+       redo=''
+       rp="$orig_rp"
+       dflt="$orig_dflt"
+       case "$tilde" in
+       true) rp="$rp (~name ok)";;
+       esac
+       . UU/myread
+       if test -f UU/getfile.ok && \
+               $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
+       then
+               value="$ans"
+               ansexp="$ans"
+               break
+       fi
+       case "$ans" in
+       none)
+               value=''
+               ansexp=''
+               case "$none_ok" in
+               true) type='';;
                esac
                ;;
-       *)      dflt='n';;
-       esac
-       ;;
-esac
-cat <<EOM
-
-Perl can be built to take advantage of threads on some systems.
-To do so, Configure can be run with -Dusethreads.
-
-Note that Perl built with threading support runs slightly slower
-and uses more memory than plain Perl. The current implementation
-is believed to be stable, but it is fairly new, and so should be
-treated with caution.
-
-If this doesn't make any sense to you, just accept the default '$dflt'.
-EOM
-rp='Build a threading Perl?'
-. ./myread
-case "$ans" in
-y|Y)    val="$define" ;;
-*)      val="$undef" ;;
-esac
-set usethreads
-eval $setvar
-
-case "$usethreads" in
-$define)
-       $cat <<EOM
-
-Since release 5.6, Perl has had two different threading implementations,
-the newer interpreter-based version (ithreads) with one interpreter per
-thread, and the older 5.005 version (5005threads).
-The 5005threads version is effectively unmaintained and will probably be
-removed in Perl 5.10, so there should be no need to build a Perl using it
-unless needed for backwards compatibility with some existing 5.005threads
-code.
+       *)
+               case "$tilde" in
+               '') value="$ans"
+                       ansexp="$ans";;
+               *)
+                       value=`UU/filexp $ans`
+                       case $? in
+                       0)
+                               if test "$ans" != "$value"; then
+                                       echo "(That expands to $value on this system.)"
+                               fi
+                               ;;
+                       *) value="$ans";;
+                       esac
+                       ansexp="$value"
+                       case "$exp_file" in
+                       '') value="$ans";;
+                       esac
+                       ;;
+               esac
+               case "$fullpath" in
+               true)
+                       case "$ansexp" in
+                       /*) value="$ansexp" ;;
+                       [a-zA-Z]:/*) value="$ansexp" ;;
+                       *)
+                               redo=true
+                               case "$already" in
+                               true)
+                               echo "I shall only accept a full path name, as in /bin/ls." >&4
+                               echo "Use a ! shell escape if you wish to check pathnames." >&4
+                                       ;;
+                               *)
+                               echo "Please give a full path name, starting with slash." >&4
+                                       case "$tilde" in
+                                       true)
+                               echo "Note that using ~name is ok provided it expands well." >&4
+                                               already=true
+                                               ;;
+                                       esac
+                               esac
+                               ;;
+                       esac
+                       ;;
+               esac
+               case "$redo" in
+               '')
+                       case "$type" in
+                       File)
+                               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)
+                               for fp in $gfpth; do
+                                       if test "X$fp" = X.; then
+                                           dir="$ans"
+                                           direxp="$ansexp"
+                                       else    
+                                           dir="$fp/$ansexp"
+                                           direxp="$fp/$ansexp"
+                                       fi
+                                       if test -d "$direxp"; then
+                                               type=''
+                                               value="$dir"
+                                               break
+                                       fi
+                               done
+                               ;;
+                       Locate)
+                               if test -d "$ansexp"; then
+                                       echo "(Looking for $loc_file in directory $value.)"
+                                       value="$value/$loc_file"
+                                       ansexp="$ansexp/$loc_file"
+                               fi
+                               if test -f "$ansexp"; then
+                                       type=''
+                               fi
+                               case "$nopath_ok" in
+                               true)   case "$value" in
+                                       */*) ;;
+                                       *)      echo "Assuming $value will be in people's path."
+                                               type=''
+                                               ;;
+                                       esac
+                                       ;;
+                               esac
+                               ;;
+                       esac
 
-EOM
-       : Default to ithreads unless overridden on command line or with
-       : old config.sh
-       dflt='y'
-       case "$use5005threads" in
-               $define|true|[yY]*) dflt='n';;
-       esac
-       case "$useithreads" in
-               $undef|false|[nN]*) dflt='n';;
-       esac
-       rp='Use the newer interpreter-based ithreads?'
-       . ./myread
-       case "$ans" in
-       y|Y)    val="$define" ;;
-       *)      val="$undef" ;;
-       esac
-       set useithreads
-       eval $setvar
-       : Now set use5005threads to the opposite value.
-       case "$useithreads" in
-       $define) val="$undef" ;;
-       *) val="$define" ;;
+                       case "$skip" in
+                       true) type='';
+                       esac
+
+                       case "$type" in
+                       '') ;;
+                       *)
+                               if test "$fastread" = yes; then
+                                       dflt=y
+                               else
+                                       dflt=n
+                               fi
+                               rp="$what $value doesn't exist.  Use that name anyway?"
+                               . UU/myread
+                               dflt=''
+                               case "$ans" in
+                               y*) type='';;
+                               *) echo " ";;
+                               esac
+                               ;;
+                       esac
+                       ;;
+               esac
+               ;;
        esac
-       set use5005threads
-       eval $setvar
+done
+cd UU
+ans="$value"
+rp="$orig_rp"
+dflt="$orig_dflt"
+rm -f getfile.ok
+test "X$gfpthkeep" != Xy && gfpth=""
+EOSC
+
+: determine root of directory hierarchy where package will be installed.
+case "$prefix" in
+'')
+       dflt=`./loc . /usr/local /usr/local /local /opt /usr`
+       ;;
+*?/)
+       dflt=`echo "$prefix" | sed 's/.$//'`
        ;;
 *)
-       useithreads="$undef"
-       use5005threads="$undef"
+       dflt="$prefix"
        ;;
 esac
+$cat <<EOM
 
-case "$useithreads$use5005threads" in
-"$define$define")
-       $cat >&4 <<EOM
-
-You cannot have both the ithreads and the 5.005 threads enabled
-at the same time.  Disabling the 5.005 threads since they are
-much less stable than the ithreads.
+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
-       use5005threads="$undef"
+fn=d~
+rp='Installation prefix to use?'
+. ./getfile
+oldprefix=''
+case "$prefix" in
+'') ;;
+*)
+       case "$ans" in
+       "$prefix") ;;
+       *) oldprefix="$prefix";;
+       esac
        ;;
 esac
+prefix="$ans"
+prefixexp="$ansexp"
 
-if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
-       cat >&4 <<EOF
-***
-*** To build with ithreads you must also use the PerlIO layer.
-*** Cannot continue, aborting.
-***
-EOF
-       exit 1
-fi
-
-case "$d_oldpthreads" in
-'')    : Configure tests would be welcome here.  For now, assume undef.
-       val="$undef" ;;
-*)     val="$d_oldpthreads" ;;
+case "$afsroot" in
+'')    afsroot=/afs ;;
+*)     afsroot=$afsroot ;;
 esac
-set d_oldpthreads
-eval $setvar
-
 
-: Look for a hint-file generated 'call-back-unit'.  If the
-: user has specified that a threading perl is to be built,
-: we may need to set or change some other defaults.
-if $test -f usethreads.cbu; then
-    echo "Your platform has some specific hints regarding threaded builds, using them..."
-    . ./usethreads.cbu
-else
-    case "$usethreads" in
-       "$define"|true|[yY]*)
-               $cat <<EOM
-(Your platform does not have any specific hints for threaded builds.
- Assuming POSIX threads, then.)
-EOM
+: is AFS running?
+echo " "
+case "$afs" in
+$define|true)  afs=true ;;
+$undef|false)  afs=false ;;
+*)     if test -d $afsroot; then
+               afs=true
+       else
+               afs=false
+       fi
        ;;
-    esac
+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
 
-cat <<EOM
+: determine installation prefix for where package is to be installed.
+if $afs; then 
+$cat <<EOM
 
-Perl can be built so that multiple Perl interpreters can coexist
-within the same Perl executable.
-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).
 
-case "$useithreads" in
-$define)
-       cat <<EOM
-This multiple interpreter support is required for interpreter-based threads.
 EOM
-       val="$define"
-       ;;
-*)     case "$usemultiplicity" in
-       $define|true|[yY]*)     dflt='y';;
-       *) dflt='n';;
-       esac
-       echo " "
-       echo "If this doesn't make any sense to you, just accept the default '$dflt'."
-       rp='Build Perl for multiplicity?'
-       . ./myread
-       case "$ans" in
-       y|Y)    val="$define" ;;
-       *)      val="$undef" ;;
+       case "$installprefix" in
+       '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
+       *) dflt="$installprefix";;
        esac
-       ;;
-esac
-set usemultiplicity
-eval $setvar
+else
+$cat <<EOM
 
+In some special cases, particularly when building $package for distribution,
+it is convenient to distinguish the directory in which files should be
+installed from the directory ($prefix) in which they will
+eventually reside.  For most users, these two directories are the same.
 
-case "$usemorebits" in
-"$define"|true|[yY]*)
-       use64bitint="$define"
-       uselongdouble="$define"
-       usemorebits="$define"
-       ;;
-*)     usemorebits="$undef"
-       ;;
-esac
+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"
 
-: make some quick guesses about what we are up against
-echo " "
-$echo $n "Hmm...  $c"
-echo exit 1 >bsd
-echo exit 1 >usg
-echo exit 1 >v7
-echo exit 1 >osf1
-echo exit 1 >eunice
-echo exit 1 >xenix
-echo exit 1 >venix
-echo exit 1 >os2
-d_bsd="$undef"
-$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
-if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
-then
-       echo "Looks kind of like an OSF/1 system, but we'll see..."
-       echo exit 0 >osf1
-elif test `echo abc | $tr a-z A-Z` = Abc ; then
-       xxx=`./loc addbib blurfl $pth`
-       if $test -f $xxx; then
-       echo "Looks kind of like a USG system with BSD features, but we'll see..."
-               echo exit 0 >bsd
-               echo exit 0 >usg
-       else
-               if $contains SIGTSTP foo >/dev/null 2>&1 ; then
-                       echo "Looks kind of like an extended USG system, but we'll see..."
-               else
-                       echo "Looks kind of like a USG system, but we'll see..."
-               fi
-               echo exit 0 >usg
-       fi
-elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
-       echo "Looks kind of like a BSD system, but we'll see..."
-       d_bsd="$define"
-       echo exit 0 >bsd
+: Perform the prefixexp/installprefixexp correction if necessary
+cat <<EOS >installprefix
+$startsh
+EOS
+cat <<'EOSC' >>installprefix
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+    eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
 else
-       echo "Looks kind of like a Version 7 system, but we'll see..."
-       echo exit 0 >v7
+    eval "install${prefixvar}=\"\$${prefixvar}exp\""
 fi
-case "$eunicefix" in
-*unixtovms*)
-       $cat <<'EOI'
-There is, however, a strange, musty smell in the air that reminds me of
-something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
-EOI
-       echo exit 0 >eunice
-       d_eunice="$define"
-: it so happens the Eunice I know will not run shell scripts in Unix format
+EOSC
+chmod +x installprefix
+$eunicefix installprefix
+
+: Set variables such as privlib and privlibexp from the output of ./getfile
+: performing the prefixexp/installprefixexp correction if necessary.
+cat <<EOS >setprefixvar
+$startsh
+EOS
+cat <<'EOSC' >>setprefixvar
+eval "${prefixvar}=\"\$ans\""
+eval "${prefixvar}exp=\"\$ansexp\""
+. ./installprefix
+EOSC
+chmod +x setprefixvar
+$eunicefix setprefixvar
+
+: set up the script used to warn in case of inconsistency
+cat <<EOS >whoa
+$startsh
+EOS
+cat <<'EOSC' >>whoa
+dflt=y
+case "$hint" in
+    recommended)
+       case "$hintfile" in
+       '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
+               ;;
+       *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
+               echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
+               ;;
+       esac
        ;;
-*)
-       echo " "
-       echo "Congratulations.  You aren't running Eunice."
-       d_eunice="$undef"
+    *) echo " "
+       echo "*** WHOA THERE!!! ***" >&4
+       echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
        ;;
 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
-       ;;
+rp="    Keep the $hint value?"
+. ./myread
+case "$ans" in
+y) td=$was; tu=$was;;
 esac
-if test -f /xenix; then
-       echo "Actually, this looks more like a XENIX system..."
-       echo exit 0 >xenix
-       d_xenix="$define"
-else
-       echo " "
-       echo "It's not Xenix..."
-       d_xenix="$undef"
-fi
-chmod +x xenix
-$eunicefix xenix
-if test -f /venix; then
-       echo "Actually, this looks more like a VENIX system..."
-       echo exit 0 >venix
-else
-       echo " "
-       if ./xenix; then
-               : null
-       else
-               echo "Nor is it Venix..."
-       fi
-fi
-chmod +x bsd usg v7 osf1 eunice xenix venix os2
-$eunicefix bsd usg v7 osf1 eunice xenix venix os2
-$rm -f foo
+EOSC
 
-case "$cc" in
-'') dflt=cc;;
-*) dflt="$cc";;
+: function used to set $1 to $val
+setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
+case "$val$was" in
+$define$undef) . ./whoa; eval "$var=\$td";;
+$undef$define) . ./whoa; eval "$var=\$tu";;
+*) eval "$var=$val";;
+esac'
+
+case "$usesocks" in
+$define|true|[yY]*)    dflt='y';;
+*) dflt='n';;
 esac
-rp="Use which C compiler?"
-. ./myread
-cc="$ans"
+cat <<EOM
 
-: See if they have not cc but they do have gcc
-. ./trygcc
-: Look for a hint-file generated 'call-back-unit'.  Now that the
-: user has specified the compiler, we may need to set or change some
-: other defaults.
-if $test -f cc.cbu; then
-    . ./cc.cbu
-fi
-. ./checkcc
+Perl can be built to use the SOCKS proxy protocol library.  To do so,
+Configure must be run with -Dusesocks.  If you use SOCKS you also need
+to use the PerlIO abstraction layer, this will be implicitly selected.
 
-echo " "
-echo "Checking for GNU cc in disguise and/or its version number..." >&4
-$cat >try.c <<EOM
-#include <stdio.h>
-int main() {
-#ifdef __GNUC__
-#ifdef __VERSION__
-       printf("%s\n", __VERSION__);
-#else
-       printf("%s\n", "1");
-#endif
-#endif
-       return(0);
-}
+If this doesn't make any sense to you, just accept the default '$dflt'.
 EOM
-if $cc -o try $ccflags $ldflags try.c; then
-       gccversion=`$run ./try`
-       case "$gccversion" in
-       '') echo "You are not using GNU cc." ;;
-       *)  echo "You are using GNU cc $gccversion."
-           ccname=gcc
-           ;;
-       esac
-else
-       echo " "
-       echo "*** WHOA THERE!!! ***" >&4
-       echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
-       case "$knowitall" in
-       '')
-       echo "    You'd better start hunting for one and let me know about it." >&4
-               exit 1
-               ;;
-       esac
-fi
-$rm -f try try.*
-case "$gccversion" in
-1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
+rp='Build Perl for SOCKS?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define" ;;     
+*)      val="$undef" ;;
 esac
-case "$gccversion" in
-'') gccosandvers='' ;;
-*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
-   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
-   gccshortvers=''
-   case "$gccosandvers" in
-   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
-   $osname$osvers) ;; # looking good
-   $osname*) cat <<EOM >&4
+set usesocks
+eval $setvar
 
-*** WHOA THERE!!! ***
+case "$usesocks" in
+$define|true|[yY]*) useperlio="$define";;
+esac
 
-    Your gcc has not been compiled for the exact release of
-    your operating system ($gccosandvers versus $osname$osvers).
-
-    In general it is a good idea to keep gcc synchronized with
-    the operating system because otherwise serious problems
-    may ensue when trying to compile software, like Perl.
+case "$useperlio" in
+$define|true|[yY]*|'') dflt='y';;
+*) dflt='n';;
+esac
+cat <<EOM
 
-    I'm trying to be optimistic here, though, and will continue.
-    If later during the configuration and build icky compilation
-    problems appear (headerfile conflicts being the most common
-    manifestation), I suggest reinstalling the gcc to match
-    your operating system release.
+Previous version of $package used the standard IO mechanisms as
+defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
+alternate IO mechanisms via the PerlIO abstraction layer, but the
+stdio mechanism is still available if needed.  The abstraction layer
+can use AT&T's sfio (if you already have sfio installed) or regular stdio.
+Using PerlIO with sfio may cause problems with some extension modules.
 
+If this doesn't make any sense to you, just accept the default '$dflt'.
 EOM
-      ;;
-   *) gccosandvers='' ;; # failed to parse, better be silent
-   esac
-   ;;
-esac
-case "$ccname" in
-'') ccname="$cc" ;;
+rp='Use the PerlIO abstraction layer?'
+. ./myread
+case "$ans" in
+y|Y) 
+       val="$define"
+       ;;
+*)      
+       echo "Ok, doing things the stdio way."
+       val="$undef"
+       ;;
 esac
+set useperlio
+eval $setvar 
 
-# gcc 3.* complain about adding -Idirectories that they already know about,
-# so we will take those off from locincpth.
-case "$gccversion" in
-3*)
-    echo "main(){}">try.c
-    for incdir in $locincpth; do
-       warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
-            grep '^c[cp]p*[01]: warning: changing search order '`
-       if test "X$warn" != X; then
-          locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
-       fi
-    done
-    $rm -f try try.*
-esac
+case "$usesocks" in
+$define|true|[yY]*)
+       case "$useperlio" in
+       $define|true|[yY]*) ;;
+       *)      cat >&4 <<EOM
 
-: decide how portable to be.  Allow command line overrides.
-case "$d_portable" in
-"$undef") ;;
-*)     d_portable="$define" ;;
-esac
+You are using the SOCKS proxy protocol library which means that you
+should also use the PerlIO layer.  You may be headed for trouble.
 
-: set up shell script to do ~ expansion
-cat >filexp <<EOSS
-$startsh
-: expand filename
-case "\$1" in
- ~/*|~)
-       echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
-       ;;
- ~*)
-       if $test -f /bin/csh; then
-               /bin/csh -f -c "glob \$1"
-               failed=\$?
-               echo ""
-               exit \$failed
-       else
-               name=\`$expr x\$1 : '..\([^/]*\)'\`
-               dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
-               if $test ! -d "\$dir"; then
-                       me=\`basename \$0\`
-                       echo "\$me: can't locate home directory for: \$name" >&2
-                       exit 1
-               fi
-               case "\$1" in
-               */*)
-                       echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
-                       ;;
-               *)
-                       echo \$dir
-                       ;;
-               esac
-       fi
-       ;;
-*)
-       echo \$1
+EOM
+               ;;
+       esac
        ;;
 esac
-EOSS
-chmod +x filexp
-$eunicefix filexp
 
-: now set up to get a file name
-cat <<EOS >getfile
-$startsh
-EOS
-cat <<'EOSC' >>getfile
-tilde=''
-fullpath=''
-already=''
-skip=''
-none_ok=''
-exp_file=''
-nopath_ok=''
-orig_rp="$rp"
-orig_dflt="$dflt"
-case "$gfpth" in
-'') gfpth='.' ;;
+       
+: 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`
+       perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
+else
+       revision=0
+       patchlevel=0
+       subversion=0
+       api_revision=0
+       api_version=0
+       api_subversion=0
+       perl_patchlevel=0
+       $echo "(You do not have patchlevel.h.  Eek.)"
+fi
+if $test -r $rsrc/.patch ; then
+       if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
+               perl_patchlevel=`cat $rsrc/.patch`
+       fi
+fi
+: Define a handy string here to avoid duplication in myconfig.SH and configpm.
+version_patchlevel_string="version $patchlevel subversion $subversion"
+case "$perl_patchlevel" in
+0|'') ;;
+*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
 esac
 
-case "$fn" in
-*\(*)
-       : getfile will accept an answer from the comma-separated list
-       : enclosed in parentheses even if it does not meet other criteria.
-       expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
-       fn=`echo $fn | sed 's/(.*)//'`
-       ;;
-esac
+$echo "(You have $package $version_patchlevel_string.)"
 
-case "$fn" in
-*:*)
-       loc_file=`expr $fn : '.*:\(.*\)'`
-       fn=`expr $fn : '\(.*\):.*'`
+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'
+fi
 
-case "$fn" in
-*~*) tilde=true;;
-esac
-case "$fn" in
-*/*) fullpath=true;;
-esac
-case "$fn" in
-*+*) skip=true;;
-esac
-case "$fn" in
-*n*) none_ok=true;;
-esac
-case "$fn" in
-*e*) exp_file=true;;
-esac
-case "$fn" in
-*p*) nopath_ok=true;;
+case "$usethreads" in
+$define|true|[yY]*)     dflt='y';;
+*)     # Catch case where user specified ithreads or 5005threads but
+       # forgot -Dusethreads (A.D. 4/2002)
+       case "$useithreads$use5005threads" in
+       *$define*)      
+               case "$useperlio" in
+               "$define")      dflt='y' ;;
+               *)              dflt='n' ;;
+               esac
+               ;;
+       *)      dflt='n';;
+       esac
+       ;;
 esac
+cat <<EOM
 
-case "$fn" in
-*f*) type='File';;
-*d*) type='Directory';;
-*l*) type='Locate';;
-esac
+Perl can be built to take advantage of threads on some systems.
+To do so, Configure can be run with -Dusethreads.
 
-what="$type"
-case "$what" in
-Locate) what='File';;
-esac
+Note that Perl built with threading support runs slightly slower
+and uses more memory than plain Perl. The current implementation
+is believed to be stable, but it is fairly new, and so should be
+treated with caution.
 
-case "$exp_file" in
-'')
-       case "$d_portable" in
-       "$define") ;;
-       *) exp_file=true;;
-       esac
-       ;;
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+rp='Build a threading Perl?'
+. ./myread
+case "$ans" in
+y|Y)    val="$define" ;;
+*)      val="$undef" ;;
 esac
+set usethreads
+eval $setvar
 
-cd ..
-while test "$type"; do
-       redo=''
-       rp="$orig_rp"
-       dflt="$orig_dflt"
-       case "$tilde" in
-       true) rp="$rp (~name ok)";;
-       esac
-       . UU/myread
-       if test -f UU/getfile.ok && \
-               $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
-       then
-               value="$ans"
-               ansexp="$ans"
-               break
-       fi
+if $test $patchlevel -lt 9; then
+    case "$usethreads" in
+    $define)
+       $cat <<EOM
+
+Since release 5.6, Perl has had two different threading implementations,
+the newer interpreter-based version (ithreads) with one interpreter per
+thread, and the older 5.005 version (5005threads).
+The 5005threads version is effectively unmaintained and will probably be
+removed in Perl 5.10, so there should be no need to build a Perl using it
+unless needed for backwards compatibility with some existing 5.005threads
+code.
+
+EOM
+       : Default to ithreads unless overridden on command line or with
+       : old config.sh
+       dflt='y'
+       case "$use5005threads" in
+               $define|true|[yY]*) dflt='n';;
+       esac
+       case "$useithreads" in
+               $undef|false|[nN]*) dflt='n';;
+       esac
+       rp='Use the newer interpreter-based ithreads?'
+       . ./myread
        case "$ans" in
-       none)
-               value=''
-               ansexp=''
-               case "$none_ok" in
-               true) type='';;
-               esac
-               ;;
-       *)
-               case "$tilde" in
-               '') value="$ans"
-                       ansexp="$ans";;
-               *)
-                       value=`UU/filexp $ans`
-                       case $? in
-                       0)
-                               if test "$ans" != "$value"; then
-                                       echo "(That expands to $value on this system.)"
-                               fi
-                               ;;
-                       *) value="$ans";;
-                       esac
-                       ansexp="$value"
-                       case "$exp_file" in
-                       '') value="$ans";;
-                       esac
-                       ;;
-               esac
-               case "$fullpath" in
-               true)
-                       case "$ansexp" in
-                       /*) value="$ansexp" ;;
-                       [a-zA-Z]:/*) value="$ansexp" ;;
-                       *)
-                               redo=true
-                               case "$already" in
-                               true)
-                               echo "I shall only accept a full path name, as in /bin/ls." >&4
-                               echo "Use a ! shell escape if you wish to check pathnames." >&4
-                                       ;;
-                               *)
-                               echo "Please give a full path name, starting with slash." >&4
-                                       case "$tilde" in
-                                       true)
-                               echo "Note that using ~name is ok provided it expands well." >&4
-                                               already=true
-                                               ;;
-                                       esac
-                               esac
-                               ;;
-                       esac
-                       ;;
-               esac
-               case "$redo" in
-               '')
-                       case "$type" in
-                       File)
-                               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)
-                               for fp in $gfpth; do
-                                       if test "X$fp" = X.; then
-                                           dir="$ans"
-                                           direxp="$ansexp"
-                                       else    
-                                           dir="$fp/$ansexp"
-                                           direxp="$fp/$ansexp"
-                                       fi
-                                       if test -d "$direxp"; then
-                                               type=''
-                                               value="$dir"
-                                               break
-                                       fi
-                               done
-                               ;;
-                       Locate)
-                               if test -d "$ansexp"; then
-                                       echo "(Looking for $loc_file in directory $value.)"
-                                       value="$value/$loc_file"
-                                       ansexp="$ansexp/$loc_file"
-                               fi
-                               if test -f "$ansexp"; then
-                                       type=''
-                               fi
-                               case "$nopath_ok" in
-                               true)   case "$value" in
-                                       */*) ;;
-                                       *)      echo "Assuming $value will be in people's path."
-                                               type=''
-                                               ;;
-                                       esac
-                                       ;;
-                               esac
-                               ;;
-                       esac
+       y|Y)    val="$define" ;;
+       *)      val="$undef" ;;
+       esac
+       set useithreads
+       eval $setvar
+       : Now set use5005threads to the opposite value.
+       case "$useithreads" in
+       $define) val="$undef" ;;
+       *) val="$define" ;;
+       esac
+       set use5005threads
+       eval $setvar
+       ;;
+    *)
+       useithreads="$undef"
+       use5005threads="$undef"
+       ;;
+    esac
 
-                       case "$skip" in
-                       true) type='';
-                       esac
+    case "$useithreads$use5005threads" in
+    "$define$define")
+       $cat >&4 <<EOM
 
-                       case "$type" in
-                       '') ;;
-                       *)
-                               if test "$fastread" = yes; then
-                                       dflt=y
-                               else
-                                       dflt=n
-                               fi
-                               rp="$what $value doesn't exist.  Use that name anyway?"
-                               . UU/myread
-                               dflt=''
-                               case "$ans" in
-                               y*) type='';;
-                               *) echo " ";;
-                               esac
-                               ;;
-                       esac
-                       ;;
-               esac
+You cannot have both the ithreads and the 5.005 threads enabled
+at the same time.  Disabling the 5.005 threads since they are
+much less stable than the ithreads.
+
+EOM
+       use5005threads="$undef"
+       ;;
+    esac
+
+else
+: perl-5.9.x and later
+
+    use5005threads="$undef"
+    case "$usethreads" in
+    $define)
+       : Default to ithreads unless overridden on command line or with
+       : old config.sh
+       dflt='y'
+       case "$useithreads" in
+               $undef|false|[nN]*) dflt='n';;
+       esac
+       rp='Use the newer interpreter-based ithreads?'
+       . ./myread
+       case "$ans" in
+       y|Y)    val="$define" ;;
+       *)      val="$undef" ;;
+       esac
+       set useithreads
+       eval $setvar
+       ;;
+    *)
+       useithreads="$undef"
+       ;;
+    esac
+
+fi
+
+if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
+       cat >&4 <<EOF
+***
+*** To build with ithreads you must also use the PerlIO layer.
+*** Cannot continue, aborting.
+***
+EOF
+       exit 1
+fi
+
+case "$d_oldpthreads" in
+'')    : Configure tests would be welcome here.  For now, assume undef.
+       val="$undef" ;;
+*)     val="$d_oldpthreads" ;;
+esac
+set d_oldpthreads
+eval $setvar
+
+
+: Look for a hint-file generated 'call-back-unit'.  If the
+: user has specified that a threading perl is to be built,
+: we may need to set or change some other defaults.
+if $test -f usethreads.cbu; then
+    echo "Your platform has some specific hints regarding threaded builds, using them..."
+    . ./usethreads.cbu
+else
+    case "$usethreads" in
+       "$define"|true|[yY]*)
+               $cat <<EOM
+(Your platform does not have any specific hints for threaded builds.
+ Assuming POSIX threads, then.)
+EOM
+       ;;
+    esac
+fi
+
+cat <<EOM
+
+Perl can be built so that multiple Perl interpreters can coexist
+within the same Perl executable.
+EOM
+
+case "$useithreads" in
+$define)
+       cat <<EOM
+This multiple interpreter support is required for interpreter-based threads.
+EOM
+       val="$define"
+       ;;
+*)     case "$usemultiplicity" in
+       $define|true|[yY]*)     dflt='y';;
+       *) dflt='n';;
+       esac
+       echo " "
+       echo "If this doesn't make any sense to you, just accept the default '$dflt'."
+       rp='Build Perl for multiplicity?'
+       . ./myread
+       case "$ans" in
+       y|Y)    val="$define" ;;
+       *)      val="$undef" ;;
+       esac
+       ;;
+esac
+set usemultiplicity
+eval $setvar
+
+
+case "$usemorebits" in
+"$define"|true|[yY]*)
+       use64bitint="$define"
+       uselongdouble="$define"
+       usemorebits="$define"
+       ;;
+*)     usemorebits="$undef"
+       ;;
+esac
+
+: make some quick guesses about what we are up against
+echo " "
+$echo $n "Hmm...  $c"
+echo exit 1 >bsd
+echo exit 1 >usg
+echo exit 1 >v7
+echo exit 1 >osf1
+echo exit 1 >eunice
+echo exit 1 >xenix
+echo exit 1 >venix
+echo exit 1 >os2
+d_bsd="$undef"
+$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
+if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
+then
+       echo "Looks kind of like an OSF/1 system, but we'll see..."
+       echo exit 0 >osf1
+elif test `echo abc | $tr a-z A-Z` = Abc ; then
+       xxx=`./loc addbib blurfl $pth`
+       if $test -f $xxx; then
+       echo "Looks kind of like a USG system with BSD features, but we'll see..."
+               echo exit 0 >bsd
+               echo exit 0 >usg
+       else
+               if $contains SIGTSTP foo >/dev/null 2>&1 ; then
+                       echo "Looks kind of like an extended USG system, but we'll see..."
+               else
+                       echo "Looks kind of like a USG system, but we'll see..."
+               fi
+               echo exit 0 >usg
+       fi
+elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
+       echo "Looks kind of like a BSD system, but we'll see..."
+       d_bsd="$define"
+       echo exit 0 >bsd
+else
+       echo "Looks kind of like a Version 7 system, but we'll see..."
+       echo exit 0 >v7
+fi
+case "$eunicefix" in
+*unixtovms*)
+       $cat <<'EOI'
+There is, however, a strange, musty smell in the air that reminds me of
+something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
+EOI
+       echo exit 0 >eunice
+       d_eunice="$define"
+: it so happens the Eunice I know will not run shell scripts in Unix format
+       ;;
+*)
+       echo " "
+       echo "Congratulations.  You aren't running Eunice."
+       d_eunice="$undef"
+       ;;
+esac
+: Detect OS2.  The p_ variable is set above in the Head.U unit.
+: 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
+       ;;
+esac
+if test -f /xenix; then
+       echo "Actually, this looks more like a XENIX system..."
+       echo exit 0 >xenix
+       d_xenix="$define"
+else
+       echo " "
+       echo "It's not Xenix..."
+       d_xenix="$undef"
+fi
+chmod +x xenix
+$eunicefix xenix
+if test -f /venix; then
+       echo "Actually, this looks more like a VENIX system..."
+       echo exit 0 >venix
+else
+       echo " "
+       if ./xenix; then
+               : null
+       else
+               echo "Nor is it Venix..."
+       fi
+fi
+chmod +x bsd usg v7 osf1 eunice xenix venix os2
+$eunicefix bsd usg v7 osf1 eunice xenix venix os2
+$rm -f foo
+
+case "$cc" in
+'') dflt=cc;;
+*) dflt="$cc";;
+esac
+rp="Use which C compiler?"
+. ./myread
+cc="$ans"
+
+: See if they have not cc but they do have gcc
+. ./trygcc
+: Look for a hint-file generated 'call-back-unit'.  Now that the
+: user has specified the compiler, we may need to set or change some
+: other defaults.
+if $test -f cc.cbu; then
+    . ./cc.cbu
+fi
+. ./checkcc
+
+echo " "
+echo "Checking for GNU cc in disguise and/or its version number..." >&4
+$cat >try.c <<EOM
+#include <stdio.h>
+int main() {
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+#ifdef __VERSION__
+       printf("%s\n", __VERSION__);
+#else
+       printf("%s\n", "1");
+#endif
+#endif
+       return(0);
+}
+EOM
+if $cc -o try $ccflags $ldflags try.c; then
+       gccversion=`$run ./try`
+       case "$gccversion" in
+       '') echo "You are not using GNU cc." ;;
+       *)  echo "You are using GNU cc $gccversion."
+           ccname=gcc
+           ;;
+       esac
+else
+       echo " "
+       echo "*** WHOA THERE!!! ***" >&4
+       echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
+       case "$knowitall" in
+       '')
+       echo "    You'd better start hunting for one and let me know about it." >&4
+               exit 1
                ;;
        esac
-done
-cd UU
-ans="$value"
-rp="$orig_rp"
-dflt="$orig_dflt"
-rm -f getfile.ok
-test "X$gfpthkeep" != Xy && gfpth=""
-EOSC
+fi
+$rm -f try try.*
+case "$gccversion" in
+1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
+esac
+case "$gccversion" in
+'') gccosandvers='' ;;
+*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
+   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
+   gccshortvers=''
+   case "$gccosandvers" in
+   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
+   $osname$osvers) ;; # looking good
+   $osname*) cat <<EOM >&4
+
+*** WHOA THERE!!! ***
+
+    Your gcc has not been compiled for the exact release of
+    your operating system ($gccosandvers versus $osname$osvers).
+
+    In general it is a good idea to keep gcc synchronized with
+    the operating system because otherwise serious problems
+    may ensue when trying to compile software, like Perl.
+
+    I'm trying to be optimistic here, though, and will continue.
+    If later during the configuration and build icky compilation
+    problems appear (headerfile conflicts being the most common
+    manifestation), I suggest reinstalling the gcc to match
+    your operating system release.
+
+EOM
+      ;;
+   *) gccosandvers='' ;; # failed to parse, better be silent
+   esac
+   ;;
+esac
+case "$ccname" in
+'') ccname="$cc" ;;
+esac
+
+# gcc 3.* complain about adding -Idirectories that they already know about,
+# so we will take those off from locincpth.
+case "$gccversion" in
+3*)
+    echo "main(){}">try.c
+    for incdir in $locincpth; do
+       warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
+            grep '^c[cp]p*[01]: warning: changing search order '`
+       if test "X$warn" != X; then
+          locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
+       fi
+    done
+    $rm -f try try.*
+esac
 
 : What should the include directory be ?
 echo " "
@@ -4716,16 +4981,46 @@ case "$optimize" in
 'none') optimize=" ";;
 esac
 
+: Check what DEBUGGING is required from the command line
+: -DEBUGGING      or -DDEBUGGING or
+: -DEBUGGING=both                      = -g + -DDEBUGGING
+: -DEBUGGING=-g   or -Doptimize=-g     = -g
+: -DEBUGGING=none or -UDEBUGGING       =
+: -DEBUGGING=old  or -DEBUGGING=default        = ? $optimize
+case "$EBUGGING" in
+'')    ;;
+*)     DEBUGGING=$EBUGGING ;;
+esac
+
+case "$DEBUGGING" in
+-g|both|$define)
+    case "$optimize" in
+       *-g*) ;;
+       *)    optimize="$optimize -g" ;;
+    esac ;;
+none|$undef)
+    case "$optimize" in
+       *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
+               shift
+               optimize="$*"
+               ;;
+    esac ;;
+esac
+
 dflt=''
+case "$DEBUGGING" in
+both|$define) dflt='-DDEBUGGING'
+esac
+
 : We will not override a previous value, but we might want to
 : augment a hint file
 case "$hint" in
 default|recommended)
        case "$gccversion" in
-       1*) dflt='-fpcc-struct-return' ;;
+       1*) dflt="$dflt -fpcc-struct-return" ;;
        esac
-       case "$optimize" in
-       *-g*) dflt="$dflt -DDEBUGGING";;
+       case "$optimize:$DEBUGGING" in
+       *-g*:old) dflt="$dflt -DDEBUGGING";;
        esac
        case "$gccversion" in
        2*) if test -d /etc/conf/kconfig.d &&
@@ -4773,20 +5068,6 @@ default|recommended)
                else
                        echo "Nope, it doesn't, but that's ok." 2>&1
                fi
-
-               echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
-               echo 'int main(void) { return 0; }' > gcctest.c
-               if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
-                       echo "Yes, it does." 2>&1
-                       case "$ccflags" in
-                       *-Wdeclaration-after-statement*)
-                               echo "Leaving current flags $ccflags alone." 2>&1
-                               ;;
-                       *) dflt="$dflt -Wdeclaration-after-statement" ;;
-                       esac
-               else
-                       echo "Nope, it doesn't, but that's ok." 2>&1
-               fi
                ;;
        esac
        ;;
@@ -5761,101 +6042,6 @@ if $test -f archname.cbu; then
        . ./archname.cbu
 fi
 
-: determine root of directory hierarchy where package will be installed.
-case "$prefix" in
-'')
-       dflt=`./loc . /usr/local /usr/local /local /opt /usr`
-       ;;
-*?/)
-       dflt=`echo "$prefix" | sed 's/.$//'`
-       ;;
-*)
-       dflt="$prefix"
-       ;;
-esac
-$cat <<EOM
-
-By default, $package will be installed in $dflt/bin, manual pages
-under $dflt/man, etc..., i.e. with $dflt as prefix for all
-installation directories. Typically this is something like /usr/local.
-If you wish to have binaries under /usr/bin but other parts of the
-installation under /usr/local, that's ok: you will be prompted
-separately for each of the installation directories, the prefix being
-only used to set the defaults.
-
-EOM
-fn=d~
-rp='Installation prefix to use?'
-. ./getfile
-oldprefix=''
-case "$prefix" in
-'') ;;
-*)
-       case "$ans" in
-       "$prefix") ;;
-       *) oldprefix="$prefix";;
-       esac
-       ;;
-esac
-prefix="$ans"
-prefixexp="$ansexp"
-
-case "$afsroot" in
-'')    afsroot=/afs ;;
-*)     afsroot=$afsroot ;;
-esac
-
-: is AFS running?
-echo " "
-case "$afs" in
-$define|true)  afs=true ;;
-$undef|false)  afs=false ;;
-*)     if test -d $afsroot; then
-               afs=true
-       else
-               afs=false
-       fi
-       ;;
-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 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)
@@ -5879,64 +6065,8 @@ prefixit='case "$3" in
        /*-$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`
-       perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
-else
-       revision=0
-       patchlevel=0
-       subversion=0
-       api_revision=0
-       api_version=0
-       api_subversion=0
-       perl_patchlevel=0
-       $echo "(You do not have patchlevel.h.  Eek.)"
-fi
-if $test -r $rsrc/.patch ; then  
-       if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
-               perl_patchlevel=`cat $rsrc/.patch`
-       fi
-fi
-: Define a handy string here to avoid duplication in myconfig.SH and configpm.
-version_patchlevel_string="version $patchlevel subversion $subversion"
-case "$perl_patchlevel" in
-0|'') ;;
-*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
-esac
-
-$echo "(You have $package $version_patchlevel_string.)"
-
-case "$osname" in
-dos|vms)
-       : XXX Should be a Configure test for double-dots in filenames.
-       version=`echo $revision $patchlevel $subversion | \
-                $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
-       api_versionstring=`echo $api_revision $api_version $api_subversion | \
-                $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
-       ;;
-*)
-       version=`echo $revision $patchlevel $subversion | \
-                $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
-       api_versionstring=`echo $api_revision $api_version $api_subversion | \
-                $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
-       ;;
-esac
-: 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
+       esac;;
+esac'
 
 : determine installation style
 : For now, try to deduce it from prefix unless it is already set.
@@ -5954,9 +6084,59 @@ esac
 : confusing anyway.
 installstyle=$dflt
 
+: determine where public executables go
+echo " "
+set dflt bin bin
+eval $prefixit
+fn=d~
+rp='Pathname where the public executables will reside?'
+. ./getfile
+if $test "X$ansexp" != "X$binexp"; then
+       installbin=''
+fi
+prefixvar=bin
+: XXX Bug? -- ignores Configure -Dinstallprefix setting.
+: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
+:     this via initialinstalllocation
+. ./setprefixvar
+
+case "$userelocatableinc" in
+$define|true|[yY]*)    dflt='y' ;;
+*)                     dflt='n' ;;
+esac
+cat <<EOM
+
+Would you like to build Perl so that the installation is relocatable, so that
+library paths in @INC are determined relative to the path of the perl binary?
+This is not advised for system Perl installs, or if you need to run setid
+scripts or scripts under taint mode.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+rp='Use relocatable @INC?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define" ;;
+*)     val="$undef"  ;;
+esac
+set userelocatableinc
+eval $setvar
+
+initialinstalllocation="$binexp"
+: Default prefix is now "up one level from where the binaries are"
+case "$userelocatableinc" in
+$define|true|[yY]*)
+    bin=".../"
+    binexp=".../"
+    prefix=".../.."
+    prefixexp=".../.."
+    installprefixexp=".../.."
+    ;;
+esac
+
 : determine where private library files go
 : Usual default is /usr/local/lib/perl5/$version.
-: Also allow things like /opt/perl/lib/$version, since 
+: 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
@@ -5970,17 +6150,12 @@ There are some auxiliary files for $package that need to be put into a
 private library directory that is accessible by everyone.
 
 EOM
+fn=$binexp
 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
+prefixvar=privlib
+. ./setprefixvar
 
 : set the prefixup variable, to restore leading tilda escape
 prefixup='case "$prefixexp" in
@@ -6010,22 +6185,17 @@ these files in a separate location.  Otherwise, you can just include
 them with the rest of the public library files.
 
 EOM
+fn=$binexp
 fn=d+~
 rp='Where do you want to put the public architecture-dependent libraries?'
 . ./getfile
-archlib="$ans"
-archlibexp="$ansexp"
+prefixvar=archlib
+. ./setprefixvar
 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
 
 : see if setuid scripts can be secure
 $cat <<EOM
@@ -6137,6 +6307,196 @@ esac
 set d_dosuid
 eval $setvar
 
+: Find perl5.005 or later.
+echo "Looking for a previously installed perl5.005 or later... "
+case "$perl5" in
+'')    for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
+               : Check if this perl is recent and can load a simple module
+               if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
+                       perl5=$tdir/perl
+                       break;
+               elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
+                       perl5=$tdir/perl5
+                       break;
+               fi
+       done
+       ;;
+*)     perl5="$perl5"
+       ;;
+esac
+case "$perl5" in
+'')    echo "None found.  That's ok.";;
+*)     echo "Using $perl5." ;;
+esac
+
+$cat <<EOM
+
+After $package is installed, you may wish to install various
+add-on modules and utilities.  Typically, these add-ons will
+be installed under $prefix with the rest
+of this package.  However, you may wish to install such add-ons
+elsewhere under a different prefix.
+
+If you do not wish to put everything under a single prefix, that's
+ok.  You will be prompted for the individual locations; this siteprefix
+is only used to suggest the defaults.
+
+The default should be fine for most people.
+
+EOM
+fn=d~+
+rp='Installation prefix to use for add-on modules and utilities?'
+: XXX Here might be another good place for an installstyle setting.
+case "$siteprefix" in
+'') dflt=$prefix ;;
+*)  dflt=$siteprefix ;;
+esac
+. ./getfile
+: XXX Prefixit unit does not yet support siteprefix and vendorprefix
+oldsiteprefix=''
+case "$siteprefix" in
+'') ;;
+*)     case "$ans" in
+       "$prefix") ;;
+       *) oldsiteprefix="$prefix";;
+       esac
+       ;;
+esac
+siteprefix="$ans"
+siteprefixexp="$ansexp"
+
+: determine where site specific libraries go.
+: Usual default is /usr/local/lib/perl5/site_perl/$version
+: The default "style" setting is made in installstyle.U
+: XXX No longer works with Prefixit stuff.
+prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+case "$sitelib" in
+'') case "$installstyle" in
+       *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
+       *)       dflt=$siteprefix/lib/site_$prog/$version ;;
+       esac
+       ;;
+*)     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.
+
+EOM
+fn=d~+
+rp='Pathname for the site-specific library files?'
+. ./getfile
+prefixvar=sitelib
+. ./setprefixvar
+sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
+
+: 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'
+# The list found is store twice for each entry: the original name, and
+# the binary broken down version as pack "sss", so sorting is easy and
+# unambiguous. This will work for all versions that have a maximum of
+# three digit groups, separate by '.'s or '_'s. Names are extended with
+# ".0.0" to ensure at least three elements for the pack.
+#                                      -- H.Merijn Brand (m)'06 23-10-2006
+
+# 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 = map {
+       [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
+}
+else {
+    ;@candidates = ();
+}
+
+($pversion, $aversion, $vsn5005) = map {
+    pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
+foreach $d (@candidates) {
+    if ($d->[1] lt $pversion) {
+       if ($d->[1] ge $aversion) {
+           unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
+       }
+       elsif ($d->[1] ge $vsn5005) {
+           unshift(@inc_version_list, grep { -d } $d->[0]);
+       }
+    }
+    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$exe_ext"; then
+               dflt=`$perl5 getverlist`
+       else
+               dflt='none'
+       fi
+       ;;
+$undef) dflt='none' ;;
+*)  eval dflt=\"$inc_version_list\" ;;
+esac
+case "$dflt" in
+''|' ') dflt=none ;;
+esac
+case "$dflt" in
+5.005) dflt=none ;;
+esac
+$cat <<EOM
+
+In order to ease the process of upgrading, this version of perl
+can be configured to use modules built and installed with earlier
+versions of perl that were installed under $prefix.  Specify here
+the list of earlier versions that this version of perl should check.
+If Configure detected no earlier versions of perl installed under
+$prefix, then the list will be empty.  Answer 'none' to tell perl
+to not search earlier versions.
+
+The default should almost always be sensible, so if you're not sure,
+just accept the default.
+EOM
+
+rp='List of earlier versions to include in @INC?'
+. ./myread
+case "$ans" in
+[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
+*) inc_version_list="$ans" ;;
+esac
+case "$inc_version_list" in
+''|' ')
+       inc_version_list_init='0'
+       d_inc_version_list="$undef"
+       ;;
+*)     inc_version_list_init=`echo $inc_version_list |
+               $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
+       d_inc_version_list="$define"
+       ;;
+esac
+$rm -f getverlist
+
 : see if this is a malloc.h system
 : we want a real compile instead of Inhdr because some systems have a
 : malloc.h that just gives a compile error saying to use stdlib.h instead
@@ -6399,98 +6759,27 @@ void free();
 #endif
 END
 case "$malloctype" in
-'')
-       if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
-               malloctype='void *'
-       else
-               malloctype='char *'
-       fi
-       ;;
-esac
-echo "Your system wants malloc to return '$malloctype', it would seem." >&4
-
-case "$freetype" in
-'')
-       if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
-               freetype='void'
-       else
-               freetype='int'
-       fi
-       ;;
-esac
-echo "Your system uses $freetype free(), it would seem." >&4
-$rm -f malloc.[co]
-$cat <<EOM
-
-After $package is installed, you may wish to install various
-add-on modules and utilities.  Typically, these add-ons will
-be installed under $prefix with the rest
-of this package.  However, you may wish to install such add-ons
-elsewhere under a different prefix.
-
-If you do not wish to put everything under a single prefix, that's
-ok.  You will be prompted for the individual locations; this siteprefix
-is only used to suggest the defaults.
-
-The default should be fine for most people.
-
-EOM
-fn=d~+
-rp='Installation prefix to use for add-on modules and utilities?'
-: XXX Here might be another good place for an installstyle setting.
-case "$siteprefix" in
-'') dflt=$prefix ;;
-*)  dflt=$siteprefix ;;
-esac
-. ./getfile
-: XXX Prefixit unit does not yet support siteprefix and vendorprefix
-oldsiteprefix=''
-case "$siteprefix" in
-'') ;;
-*)     case "$ans" in
-       "$prefix") ;;
-       *) oldsiteprefix="$prefix";;
-       esac
+'')
+       if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
+               malloctype='void *'
+       else
+               malloctype='char *'
+       fi
        ;;
 esac
-siteprefix="$ans"
-siteprefixexp="$ansexp"
+echo "Your system wants malloc to return '$malloctype', it would seem." >&4
 
-: 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"
+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
-
-The installation process will create a directory for
-site-specific extensions and modules.  Most users find it convenient
-to place all site-specific files in this directory rather than in the
-main distribution directory.
-
-EOM
-fn=d~+
-rp='Pathname for the site-specific library files?'
-. ./getfile
-sitelib="$ans"
-sitelibexp="$ansexp"
-sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
-else
-       installsitelib="$sitelibexp"
-fi
-
+echo "Your system uses $freetype free(), it would seem." >&4
+$rm -f malloc.[co]
 : 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
@@ -6513,13 +6802,12 @@ EOM
 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#"`
+prefixvar=sitearch
+. ./setprefixvar
+if $test X"$sitearch" = X"$sitelib"; then
+       d_sitearch="$undef"
 else
-       installsitearch="$sitearchexp"
+       d_sitearch="$define"
 fi
 
 $cat <<EOM
@@ -6605,12 +6893,8 @@ case "$vendorprefix" in
        ;;
 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
+prefixvar=vendorlib
+. ./installprefix
 
 case "$vendorprefix" in
 '')    d_vendorarch="$undef"
@@ -6635,12 +6919,8 @@ case "$vendorprefix" in
        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
+prefixvar=vendorarch
+. ./installprefix
 
 : Final catch-all directories to search
 $cat <<EOM
@@ -6722,26 +7002,6 @@ EOM
        ;;
 esac
 
-: determine where public executables go
-echo " "
-set dflt bin bin
-eval $prefixit
-fn=d~
-rp='Pathname where the public executables will reside?'
-. ./getfile
-if $test "X$ansexp" != "X$binexp"; then
-       installbin=''
-fi
-bin="$ans"
-binexp="$ansexp"
-: Change installation prefix, if necessary.
-: XXX Bug? -- ignores Configure -Dinstallprefix setting.
-if $test X"$prefix" != X"$installprefix"; then
-       installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
-else
-       installbin="$binexp"
-fi
-
 echo " "
 case "$extras" in
 '') dflt='n';;
@@ -6799,7 +7059,7 @@ set html1dir html1dir none
 eval $prefixit
 $cat <<EOM
 
-If you wish to install html files for programs in $spackage, indicate 
+If you wish to install html files for programs in $spackage, indicate
 the appropriate directory here.  To skip installing html files,
 answer "none".
 EOM
@@ -6810,16 +7070,10 @@ esac
 fn=dn+~
 rp="Directory for the main $spackage html pages?"
 . ./getfile
-html1dir="$ans"
-html1direxp="$ansexp"
+prefixvar=html1dir
+. ./setprefixvar
 : Use ' ' for none so value is preserved next time through Configure
 $test X"$html1dir" = "X" && html1dir=' '
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
-else
-       installhtml1dir="$html1direxp"
-fi
 
 : determine where html pages for libraries and modules go
 set html3dir html3dir none
@@ -6839,134 +7093,10 @@ esac
 fn=dn+~
 rp="Directory for the $spackage module html pages?"
 . ./getfile
-html3dir="$ans"
-html3direxp="$ansexp"
+prefixvar=html3dir
+. ./setprefixvar
 : Use ' ' for none so value is preserved next time through Configure
 $test X"$html3dir" = "X" && html3dir=' '
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
-else
-       installhtml3dir="$html3direxp"
-fi
-
-: Find perl5.005 or later.
-echo "Looking for a previously installed perl5.005 or later... "
-case "$perl5" in
-'')    for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
-               : Check if this perl is recent and can load a simple module
-               if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
-                       perl5=$tdir/perl
-                       break;
-               elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
-                       perl5=$tdir/perl5
-                       break;
-               fi
-       done
-       ;;
-*)     perl5="$perl5"
-       ;;
-esac
-case "$perl5" in
-'')    echo "None found.  That's ok.";;
-*)     echo "Using $perl5." ;;
-esac
-
-: Determine list of previous versions to include in @INC
-$cat > getverlist <<EOPL
-#!$perl5 -w
-use File::Basename;
-\$api_versionstring = "$api_versionstring";
-\$version = "$version";
-\$stem = "$sitelib_stem";
-\$archname = "$archname";
-EOPL
-       $cat >> getverlist <<'EOPL'
-# Can't have leading @ because metaconfig interprets it as a command!
-;@inc_version_list=();
-# XXX Redo to do opendir/readdir? 
-if (-d $stem) {
-    chdir($stem);
-    ;@candidates = glob("5.*");
-}
-else {
-    ;@candidates = ();
-}
-
-# XXX ToDo:  These comparisons must be reworked when two-digit
-# subversions come along, so that 5.7.10 compares as greater than
-# 5.7.3!  By that time, hope that 5.6.x is sufficiently
-# widespread that we can use the built-in version vectors rather
-# than reinventing them here.  For 5.6.0, however, we must
-# assume this script will likely be run by 5.005_0x.  --AD 1/2000.
-foreach $d (@candidates) {
-    if ($d lt $version) {
-       if ($d ge $api_versionstring) {
-           unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
-       }
-       elsif ($d ge "5.005") {
-           unshift(@inc_version_list, grep { -d } $d);
-       }
-    }
-    else {
-       # Skip newer version.  I.e. don't look in
-       # 5.7.0 if we're installing 5.6.1.
-    }
-}
-
-if (@inc_version_list) {
-    print join(' ', @inc_version_list);
-}
-else {
-    # Blank space to preserve value for next Configure run.
-    print " ";
-}
-EOPL
-chmod +x getverlist
-case "$inc_version_list" in
-'')    if test -x "$perl5$exe_ext"; then
-               dflt=`$perl5 getverlist`
-       else
-               dflt='none'
-       fi
-       ;;
-$undef) dflt='none' ;;
-*)  eval dflt=\"$inc_version_list\" ;;
-esac
-case "$dflt" in
-''|' ') dflt=none ;;
-esac
-case "$dflt" in
-5.005) dflt=none ;;
-esac
-$cat <<EOM
-
-In order to ease the process of upgrading, this version of perl 
-can be configured to use modules built and installed with earlier 
-versions of perl that were installed under $prefix.  Specify here
-the list of earlier versions that this version of perl should check.
-If Configure detected no earlier versions of perl installed under
-$prefix, then the list will be empty.  Answer 'none' to tell perl
-to not search earlier versions.
-
-The default should almost always be sensible, so if you're not sure,
-just accept the default.
-EOM
-
-rp='List of earlier versions to include in @INC?'
-. ./myread
-case "$ans" in
-[Nn]one|''|' '|$undef) 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
 
@@ -7026,7 +7156,7 @@ int main(void)
 {
 #ifdef __GLIBC__
 #   ifdef __GLIBC_MINOR__
-#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
+#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
 #           include <gnu/libc-version.h>
            printf("%s\n",  gnu_get_libc_version());
 #       else
@@ -7502,12 +7632,53 @@ yes)
        esac;;
 esac'
 
+
+echo " "
+echo "Checking for C++..." >&4
+cat >try.c <<'EOCP'
+#include <stdio.h>
+int main(void)
+{
+#ifdef __cplusplus
+    printf("define\n");
+#else
+    printf("undef\n");
+#endif
+    return 0;
+}
+EOCP
+set try
+if eval $compile_ok && $run ./try >cplusplus$$; then
+       val=`$cat cplusplus$$`
+       echo "You are using a C++ compiler."
+else
+       val="$undef"
+       echo "You are not using a C++ compiler."
+fi
+$rm -f try try.* cplusplus$$
+set d_cplusplus
+eval $setvar
+
 : see if dlopen exists
 xxx_runnm="$runnm"
+xxx_ccflags="$ccflags"
 runnm=false
+: with g++ one needs -shared to get is-in-libc to work for dlopen
+case "$gccversion" in
+'')    ;;
+*)     case "$d_cplusplus" in
+       "$define") ccflags="$ccflags -shared" ;;
+       esac
+       ;;
+esac
 set dlopen d_dlopen
 eval $inlibc
 runnm="$xxx_runnm"
+ccflags="$xxx_ccflags"
+
+: see if this is a unistd.h system
+set unistd.h i_unistd
+eval $inhdr
 
 : determine which dynamic loading, if any, to compile in
 echo " "
@@ -7612,6 +7783,10 @@ EOM
 #ifdef I_STDLIB
 #include <stdlib.h>
 #endif
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
 int main() {
        char b[4];
        int i = open("a.out",O_RDONLY);
@@ -7887,7 +8062,7 @@ if "$useshrplib"; then
        solaris)
                xxx="-R $shrpdir"
                ;;
-       freebsd|netbsd|openbsd|interix)
+       freebsd|netbsd|openbsd|interix|dragonfly)
                xxx="-Wl,-R$shrpdir"
                ;;
        bsdos|linux|irix*|dec_osf|gnu*)
@@ -8001,20 +8176,14 @@ rp="Where do the main $spackage manual pages (source) go?"
 if $test "X$man1direxp" != "X$ansexp"; then
        installman1dir=''
 fi
-man1dir="$ans"
-man1direxp="$ansexp"
+prefixvar=man1dir
+. ./setprefixvar
+
 case "$man1dir" in
 '')    man1dir=' '
        installman1dir='';;
 esac
 
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installman1dir="$man1direxp"
-fi
-
 : What suffix to use on installed man pages
 
 case "$man1dir" in
@@ -8089,7 +8258,7 @@ esac
 case "$d_flexfnam" in
 undef)
        $cat <<'EOM'
-However, your system can't handle the long file names like File::Basename.3. 
+However, your system can't handle the long file names like File::Basename.3.
 EOM
        case "$man3dir" in
        '') man3dir="none";;
@@ -8104,8 +8273,8 @@ case "$man3dir" in
                cat <<EOM >&4
 
 WARNING:  Previous versions of perl installed man3 pages into
-$privlib/man/man3.  This version will suggest a 
-new default of $dflt.  
+$privlib/man/man3.  This version will suggest a
+new default of $dflt.
 EOM
                tdflt=$dflt
                dflt='n'
@@ -8126,20 +8295,14 @@ echo " "
 fn=dn+~
 rp="Where do the $package library man pages (source) go?"
 . ./getfile
-man3dir="$ans"
-man3direxp="$ansexp"
+prefixvar=man3dir
+. ./setprefixvar
+
 case "$man3dir" in
 '')    man3dir=' '
        installman3dir='';;
 esac
 
-: 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
 ' ')
@@ -8505,6 +8668,9 @@ case "$versiononly" in
 esac
 
 : figure out how to guarantee perl startup
+: XXX Note that this currently takes advantage of the bug that binexp ignores
+:     the Configure -Dinstallprefix setting, which in turn means that under
+:     relocatable @INC, initialinstalllocation is what binexp started as.
 case "$startperl" in
 '')
        case "$sharpbang" in
@@ -8514,13 +8680,13 @@ case "$startperl" in
 I can use the #! construct to start perl on your system. This will
 make startup of perl scripts faster, but may cause problems if you
 want to share those scripts and perl is not in a standard place
-($binexp/perl) on all your platforms. The alternative is to force
-a shell by starting the script with a single ':' character.
+($initialinstalllocation/perl) on all your platforms. The alternative
+is to force a shell by starting the script with a single ':' character.
 
 EOH
                case "$versiononly" in
-               "$define")      dflt="$binexp/perl$version";;  
-               *)              dflt="$binexp/perl";;
+               "$define")      dflt="$initialinstalllocation/perl$version";;
+               *)              dflt="$initialinstalllocation/perl";;
                esac
                rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
                . ./myread
@@ -8549,8 +8715,8 @@ echo "I'll use $startperl to start perl scripts."
 case "$perlpath" in
 '')
        case "$versiononly" in
-       "$define")      perlpath="$binexp/perl$version";;
-       *)              perlpath="$binexp/perl";;
+       "$define")      perlpath="$initialinstalllocation/perl$version";;
+       *)              perlpath="$initialinstalllocation/perl";;
        esac
        case "$startperl" in
        *!*) ;;
@@ -8560,10 +8726,10 @@ case "$perlpath" in
 I will use the "eval 'exec'" idiom to start Perl on your system.
 I can use the full path of your Perl binary for this purpose, but
 doing so may cause problems if you want to share those scripts and
-Perl is not always in a standard place ($binexp/perl).
+Perl is not always in a standard place ($initialinstalllocation/perl).
 
 EOH
-               dflt="$binexp/perl"
+               dflt="$initialinstalllocation/perl"
                rp="What path shall I use in \"eval 'exec'\"?"
                . ./myread
                perlpath="$ans"
@@ -8595,12 +8761,12 @@ case "$scriptdir" in
        ;;
 esac
 $cat <<EOM
+
 Some installations have a separate directory just for executable scripts so
 that they can mount it across multiple architectures but keep the scripts in
 one spot.  You might, for example, have a subdirectory of /usr/share for this.
 Or you might just lump your scripts in with all your other executables.
+
 EOM
 fn=d~
 rp='Where do you keep publicly executable scripts?'
@@ -8608,14 +8774,11 @@ rp='Where do you keep publicly executable scripts?'
 if $test "X$ansexp" != "X$scriptdirexp"; then
        installscript=''
 fi
-scriptdir="$ans"
-scriptdirexp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
-else
-       installscript="$scriptdirexp"
-fi
+installscriptdir=''
+prefixvar=scriptdir
+. ./setprefixvar
+: A little fix up for an irregularly named variable.
+installscript="$installscriptdir"
 
 : determine where add-on public executables go
 case "$sitebin" in
@@ -8625,14 +8788,8 @@ esac
 fn=d~
 rp='Pathname where the add-on public executables should be installed?'
 . ./getfile
-sitebin="$ans"
-sitebinexp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
-else
-       installsitebin="$sitebinexp"
-fi
+prefixvar=sitebin
+. ./setprefixvar
 
 : determine where add-on html pages go
 : There is no standard location, so try to copy the previously-selected
@@ -8647,14 +8804,8 @@ esac
 fn=dn+~
 rp='Pathname where the site-specific html pages should be installed?'
 . ./getfile
-sitehtml1dir="$ans"
-sitehtml1direxp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installsitehtml1dir="$sitehtml1direxp"
-fi
+prefixvar=sitehtml1dir
+. ./setprefixvar
 
 : determine where add-on library html pages go
 : There is no standard location, so try to copy the previously-selected
@@ -8669,19 +8820,13 @@ esac
 fn=dn+~
 rp='Pathname where the site-specific library html pages should be installed?'
 . ./getfile
-sitehtml3dir="$ans"
-sitehtml3direxp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installsitehtml3dir="$sitehtml3direxp"
-fi
+prefixvar=sitehtml3dir
+. ./setprefixvar
 
 : determine where add-on manual pages go
 case "$siteman1dir" in
 '')    dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
-*)     dflt=$siteman1dir ;;
+*)     dflt=$siteman1dir ;;
 esac
 case "$dflt" in
 ''|' ') dflt=none ;;
@@ -8689,19 +8834,13 @@ esac
 fn=dn+~
 rp='Pathname where the site-specific manual pages should be installed?'
 . ./getfile
-siteman1dir="$ans"
-siteman1direxp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installsiteman1dir="$siteman1direxp"
-fi
+prefixvar=siteman1dir
+. ./setprefixvar
 
 : determine where add-on library man pages go
 case "$siteman3dir" in
 '')    dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
-*)     dflt=$siteman3dir ;;
+*)     dflt=$siteman3dir ;;
 esac
 case "$dflt" in
 ''|' ') dflt=none ;;
@@ -8709,14 +8848,8 @@ esac
 fn=dn+~
 rp='Pathname where the site-specific library manual pages should be installed?'
 . ./getfile
-siteman3dir="$ans"
-siteman3direxp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installsiteman3dir="$siteman3direxp"
-fi
+prefixvar=siteman3dir
+. ./setprefixvar
 
 : determine where add-on public executable scripts go
 case "$sitescript" in
@@ -8727,14 +8860,8 @@ esac
 fn=d~+
 rp='Pathname where add-on public executable scripts should be installed?'
 . ./getfile
-sitescript="$ans"
-sitescriptexp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
-else
-       installsitescript="$sitescriptexp"
-fi
+prefixvar=sitescript
+. ./setprefixvar
 
 case "$usefaststdio" in
 $define|true|[yY]*|'')
@@ -9008,11 +9135,6 @@ EOCP
        ;;
 esac
 
-# probably will refer to
-#   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
-need_relocation=0
-userelocatableinc=undef
-
 case "$vendorprefix" in
 '')    d_vendorbin="$undef"
        vendorbin=''
@@ -9031,12 +9153,8 @@ case "$vendorprefix" in
        vendorbinexp="$ansexp"
        ;;
 esac
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorbin="$vendorbinexp"
-fi
+prefixvar=vendorbin
+. ./installprefix
 
 case "$vendorprefix" in
 '')    vendorhtml1dir=''
@@ -9062,12 +9180,8 @@ case "$vendorprefix" in
 esac
 : Use ' ' for none so value is preserved next time through Configure
 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorhtml1dir="$vendorhtml1direxp"
-fi
+prefixvar=vendorhtml1dir
+. ./installprefix
 
 case "$vendorprefix" in
 '')    vendorhtml3dir=''
@@ -9093,12 +9207,8 @@ case "$vendorprefix" in
 esac
 : Use ' ' for none so value is preserved next time through Configure
 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorhtml3dir="$vendorhtml3direxp"
-fi
+prefixvar=vendorhtml3dir
+. ./installprefix
 
 case "$vendorprefix" in
 '')    vendorman1dir=''
@@ -9121,12 +9231,8 @@ case "$vendorprefix" in
 esac
 : Use ' ' for none so value is preserved next time through Configure
 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorman1dir="$vendorman1direxp"
-fi
+prefixvar=vendorman1dir
+. ./installprefix
 
 case "$vendorprefix" in
 '')    vendorman3dir=''
@@ -9149,12 +9255,8 @@ case "$vendorprefix" in
 esac
 : Use ' ' for none so value is preserved next time through Configure
 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorman3dir="$vendorman3direxp"
-fi
+prefixvar=vendorman3dir
+. ./installprefix
 
 case "$vendorprefix" in
 '')    d_vendorscript="$undef"
@@ -9170,7 +9272,7 @@ case "$vendorprefix" in
        esac
        $cat <<EOM
 
-The installation process will create a directory for 
+The installation process will create a directory for
 vendor-supplied scripts.
 
 EOM
@@ -9181,12 +9283,8 @@ EOM
        vendorscriptexp="$ansexp"
        ;;
 esac
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorscript="$vendorscriptexp"
-fi
+prefixvar=vendorscript
+. ./installprefix
 
 : see if qgcvt exists
 set qgcvt d_qgcvt
@@ -9922,6 +10020,50 @@ set d_attribute_format
 eval $setvar
 $rm -f attrib*
 
+: Look for GCC-style attribute format with null format allowed
+case "$d_printf_format_null" in
+'') case "$d_attribute_format" in
+    $define)
+       echo " "
+       echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
+$cat >attrib.c <<EOCP
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
+int null_printf (char* pat,...) { return (int)pat; }
+int main () { exit(null_printf(NULL)); }
+EOCP
+       if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
+           : run the executable in case it produces a run-time warning
+           if $run ./attrib >>attrib.out 2>&1; then
+               if $contains 'warning' attrib.out >/dev/null 2>&1; then
+                   echo "Your C compiler doesn't allow __printf__ format to be null."
+                   val="$undef"
+               else
+                   echo "Your C compiler allows __printf__ format to be null."
+                   val="$define"
+               fi
+           else
+           echo "Your C compiler executable failed with __printf__ format null."
+           val="$undef"
+       fi
+    else
+       echo "Your C compiler fails with __printf__ format null."
+       val="$undef"
+    fi
+    ;;
+    *)  val="$undef" ;;
+    esac
+;;
+*)  val="$d_printf_format_null" ;;
+esac
+set d_printf_format_null
+eval $setvar
+$rm -f attrib*
+
 : Look for GCC-style attribute malloc
 case "$d_attribute_malloc" in
 '')
@@ -10098,10 +10240,6 @@ eval $inlibc
 set bcopy d_bcopy
 eval $inlibc
 
-: see if this is a unistd.h system
-set unistd.h i_unistd
-eval $inhdr
-
 : see if getpgrp exists
 set getpgrp d_getpgrp
 eval $inlibc
        ;;
 *) val="$undef";;
 esac
-set d_bsdgetpgrp
-eval $setvar
-$rm -f try try.*
+set d_bsdgetpgrp
+eval $setvar
+$rm -f try try.*
+
+: see if setpgrp exists
+set setpgrp d_setpgrp
+eval $inlibc
+
+case "$d_setpgrp" in
+"$define")
+       echo " "
+       echo "Checking to see which flavor of setpgrp is in use..."
+       $cat >try.c <<EOP
+#$i_unistd I_UNISTD
+#include <sys/types.h>
+#ifdef I_UNISTD
+#  include <unistd.h>
+#endif
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+int main()
+{
+       if (getuid() == 0) {
+               printf("(I see you are running Configure as super-user...)\n");
+               setuid(1);
+       }
+#ifdef TRY_BSD_PGRP
+       if (-1 == setpgrp(1, 1))
+               exit(0);
+#else
+       if (setpgrp() != -1)
+               exit(0);
+#endif
+       exit(1);
+}
+EOP
+       if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
+               echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
+               val="$define"
+       elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
+               echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
+               val="$undef"
+       else
+               echo "(I can't seem to compile and run the test program.)"
+               if ./usg; then
+                       xxx="a USG one, i.e. you use setpgrp()."
+               else
+                       # SVR4 systems can appear rather BSD-ish.
+                       case "$i_unistd" in
+                       $undef)
+                               xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
+                               val="$define"
+                               ;;
+                       $define)
+                               xxx="probably a USG one, i.e. you use setpgrp()."
+                               val="$undef"
+                               ;;
+                       esac
+               fi
+               echo "Assuming your setpgrp is $xxx" >&4
+       fi
+       ;;
+*) val="$undef";;
+esac
+set d_bsdsetpgrp
+eval $setvar
+$rm -f try try.*
+: Look for GCC-style __builtin_choose_expr
+case "$d_builtin_choose_expr" in
+'')
+    echo " "
+    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
+    $cat >try.c <<'EOCP'
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
+
+int main(void) {
+    assert( SYRINX(1) == 2112 );
+    assert( SYRINX(1) != 5150 );
+    assert( SYRINX(0) == 5150 );
+    assert( SYRINX(0) != 2112 );
+    puts( "All good!" );
+    exit(0);
+}
+
+EOCP
+    set try
+    if eval $compile; then
+       echo "Your C compiler supports __builtin_choose_expr."
+       val="$define"
+    else
+       echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
+       val="$undef"
+    fi
+;;
+*) val="$d_builtin_choose_expr" ;;
+esac
+
+set d_builtin_choose_expr
+eval $setvar
+$rm -f try.* try core core.try.*
+
+: Look for GCC-style __builtin_expect
+case "$d_builtin_expect" in
+'')
+    echo " "
+    echo "Checking whether your compiler can handle __builtin_expect ..." >&4
+    $cat >builtin.c <<'EOCP'
+int main(void) {
+    int n = 50;
+    if ( __builtin_expect(n, 0) ) n = 1;
+}
+EOCP
+    set try
+    if eval $compile; then
+       echo "Your C compiler supports __builtin_choose_expr."
+       val="$define"
+    else
+       echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
+       val="$undef"
+    fi
+    ;;
+*) val="$d_builtin_expect" ;;
+esac
+
+set d_builtin_expect
+eval $setvar
+$rm -f try.* try core core.try.*
+
+: see if bzero exists
+set bzero d_bzero
+eval $inlibc
+
+: see if stdarg is available
+echo " "
+if $test `./findhdr stdarg.h`; then
+       echo "<stdarg.h> found." >&4
+       valstd="$define"
+else
+       echo "<stdarg.h> NOT found." >&4
+       valstd="$undef"
+fi
+
+: see if varags is available
+echo " "
+if $test `./findhdr varargs.h`; then
+       echo "<varargs.h> found." >&4
+else
+       echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
+fi
+
+: set up the varargs testing programs
+$cat > varargs.c <<EOP
+#ifdef I_STDARG
+#include <stdarg.h>
+#endif
+#ifdef I_VARARGS
+#include <varargs.h>
+#endif
+
+#ifdef I_STDARG
+int f(char *p, ...)
+#else
+int f(va_alist)
+va_dcl
+#endif
+{
+       va_list ap;
+#ifndef I_STDARG
+       char *p;
+#endif
+#ifdef I_STDARG
+       va_start(ap,p);
+#else
+       va_start(ap);
+       p = va_arg(ap, char *);
+#endif
+       va_end(ap);
+       return 0;
+}
+EOP
+$cat > varargs <<EOP
+$startsh
+if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
+       echo "true"
+else
+       echo "false"
+fi
+$rm -f varargs$_o
+EOP
+chmod +x varargs
+
+: now check which varargs header should be included
+echo " "
+i_varhdr=''
+case "$valstd" in
+"$define")
+       if `./varargs I_STDARG`; then
+               val='stdarg.h'
+       elif `./varargs I_VARARGS`; then
+               val='varargs.h'
+       fi
+       ;;
+*)
+       if `./varargs I_VARARGS`; then
+               val='varargs.h'
+       fi
+       ;;
+esac
+case "$val" in
+'')
+echo "I could not find the definition for va_dcl... You have problems..." >&4
+       val="$undef"; set i_stdarg; eval $setvar
+       val="$undef"; set i_varargs; eval $setvar
+       ;;
+*) 
+       set i_varhdr
+       eval $setvar
+       case "$i_varhdr" in
+       stdarg.h)
+               val="$define"; set i_stdarg; eval $setvar
+               val="$undef"; set i_varargs; eval $setvar
+               ;;
+       varargs.h)
+               val="$undef"; set i_stdarg; eval $setvar
+               val="$define"; set i_varargs; eval $setvar
+               ;;
+       esac
+       echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
+esac
+$rm -f varargs*
 
-: see if setpgrp exists
-set setpgrp d_setpgrp
-eval $inlibc
+: see if the Compiler supports C99 variadic macros
+case "$i_stdarg$i_stdlib" in
+    "$define$define")
+    echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
+    $cat >try.c <<EOCP
+#include <stdio.h>
+#include <stdarg.h>
 
-case "$d_setpgrp" in
-"$define")
-       echo " "
-       echo "Checking to see which flavor of setpgrp is in use..."
-       $cat >try.c <<EOP
-#$i_unistd I_UNISTD
-#include <sys/types.h>
-#ifdef I_UNISTD
-#  include <unistd.h>
-#endif
-#$i_stdlib I_STDLIB
-#ifdef I_STDLIB
-#include <stdlib.h>
-#endif
-int main()
-{
-       if (getuid() == 0) {
-               printf("(I see you are running Configure as super-user...)\n");
-               setuid(1);
-       }
-#ifdef TRY_BSD_PGRP
-       if (-1 == setpgrp(1, 1))
-               exit(0);
-#else
-       if (setpgrp() != -1)
-               exit(0);
-#endif
-       exit(1);
+#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
+
+int main() {
+  char buf[20];
+  foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
+  puts(buf);
+  return 0;
 }
-EOP
-       if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
-               echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
-               val="$define"
-       elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
-               echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
-               val="$undef"
-       else
-               echo "(I can't seem to compile and run the test program.)"
-               if ./usg; then
-                       xxx="a USG one, i.e. you use setpgrp()."
-               else
-                       # SVR4 systems can appear rather BSD-ish.
-                       case "$i_unistd" in
-                       $undef)
-                               xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
-                               val="$define"
-                               ;;
-                       $define)
-                               xxx="probably a USG one, i.e. you use setpgrp()."
-                               val="$undef"
-                               ;;
-                       esac
-               fi
-               echo "Assuming your setpgrp is $xxx" >&4
-       fi
-       ;;
-*) val="$undef";;
+EOCP
+    set try
+    if eval $compile && $run ./try 2>&1 >/dev/null; then
+       case "`$run ./try`" in
+           "123 456 789")
+           echo "You have C99 variadic macros." >&4
+           d_c99_variadic_macros="$define"
+           ;;
+           *)
+           echo "You don't have functional C99 variadic macros." >&4
+           d_c99_variadic_macros="$undef"
+           ;;
+       esac
+    else
+       echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
+       d_c99_variadic_macros="$undef"
+    fi
+    $rm -f try.* try core core.try.*
+    ;;
+    *)
+    echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
+    d_c99_variadic_macros="$undef"
+    ;;
 esac
-set d_bsdsetpgrp
-eval $setvar
-$rm -f try try.*
-: see if bzero exists
-set bzero d_bzero
-eval $inlibc
 
 : see if signal is declared as pointer to function returning int or void
 echo " "
@@ -10297,7 +10640,7 @@ $cat >try.c <<EOCP
 #endif
 #include <sys/types.h>
 #include <signal.h>
-$signal_t blech(s) int s; { exit(3); }
+$signal_t blech(int s) { exit(3); }
 int main()
 {
        $xxx i32;
@@ -10355,11 +10698,11 @@ $cat >try.c <<EOCP
 #endif
 #include <sys/types.h>
 #include <signal.h>
-$signal_t blech(s) int s; { exit(7); }
-$signal_t blech_in_list(s) int s; { exit(4); }
-unsigned long dummy_long(p) unsigned long p; { return p; }
-unsigned int dummy_int(p) unsigned int p; { return p; }
-unsigned short dummy_short(p) unsigned short p; { return p; }
+$signal_t blech(int s) { exit(7); }
+$signal_t blech_in_list(int s) { exit(4); }
+unsigned long dummy_long(unsigned long p) { return p; }
+unsigned int dummy_int(unsigned int p) { return p; }
+unsigned short dummy_short(unsigned short p) { return p; }
 int main()
 {
        double f;
@@ -10504,6 +10847,10 @@ eval $inlibc
 set class d_class
 eval $inlibc
 
+: see if clearenv exists
+set clearenv d_clearenv
+eval $inlibc
+
 hasstruct='varname=$1; struct=$2; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
@@ -10628,7 +10975,7 @@ typedef struct spug { int drokk; } spug;
 int main()
 {
        const char *foo;
-       const spug y;
+       const spug y = { 0 };
 }
 EOCP
 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
@@ -10745,6 +11092,10 @@ case "$full_csh" in
 '') full_csh=$csh ;;
 esac
 
+: see if ctermid exists
+set ctermid d_ctermid
+eval $inlibc
+
 : see if ctermid_r exists
 set ctermid_r d_ctermid_r
 eval $inlibc
@@ -10985,6 +11336,42 @@ set d_dirnamlen
 eval $setvar
 $rm -f try.c
 
+: Look for DIR.dd_fd
+case "$i_dirent" in
+"$define")
+    echo "Checking to see if DIR has a dd_fd member variable" >&4
+    $cat >try.c <<EOCP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#include <dirent.h>
+
+int main() {
+    DIR dir;
+    dir.dd_fd = 1;
+    return 0;
+}
+EOCP
+    val=$undef
+    set try
+    if eval $compile; then
+        echo "Yes, it does."
+        val="$define"
+    else
+        echo "No, it does not."
+        val="$undef"
+    fi
+    ;;
+*)
+    echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
+    val="$undef"
+    ;;
+esac
+set d_dir_dd_fd
+eval $setvar
+$rm -f try try.*
+
 : see if this is an sysdir system
 set sys/dir.h i_sysdir
 eval $inhdr
@@ -11850,7 +12237,7 @@ extern int errno;
 #else
 #include <strings.h>
 #endif
-$signal_t blech(x) int x; { exit(3); }
+$signal_t blech(int x) { exit(3); }
 EOCP
        $cat >> try.c <<'EOCP'
 int main()
@@ -12283,7 +12670,7 @@ $cat >try.c <<EOCP
 #include <unistd.h>
 #include <fcntl.h>
 #include <signal.h>
-$signal_t blech(x) int x; { exit(3); }
+$signal_t blech(int x) { exit(3); }
 int main() {
 #if defined(F_SETLK) && defined(F_SETLKW)
      struct flock flock;
@@ -12549,6 +12936,41 @@ case "$longsize" in
 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
 esac
 
+d_futimes="$undef"
+: check for a working futimes
+echo " "
+echo "Checking for a working futimes()" >&4
+$cat >try.c <<EOCP
+#include <stdio.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <fcntl.h>
+
+int main ()
+{
+    int fd, rv;
+    fd = open ("try.c", O_RDWR);
+    if (-1 == fd) exit (1);
+    rv = futimes (fd, NULL);
+    exit (rv == -1 ? errno : 0);
+}
+EOCP
+set try
+if eval $compile; then
+    `$run ./try`
+    rc=$?
+    case "$rc" in
+       0)  echo "Yes, it does" >&4
+           d_futimes="$define"
+           ;;
+       *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
+           ;;
+    esac
+else
+    echo "No, it does not (probably harmless)\n" >&4
+fi
+$rm -f try.* try core core.try.*
+
 : see if getcwd exists
 set getcwd d_getcwd
 eval $inlibc
@@ -14229,6 +14651,59 @@ case "$d_localtime_r" in
        ;;
 esac
 
+: see if localtime_r calls tzset
+case "$localtime_r_proto" in
+REENTRANT_PROTO*)
+       $cat >try.c <<EOCP
+/*  Does our libc's localtime_r call tzset ?
+ *  return 0 if so, 1 otherwise.
+ */
+#include <sys/types.h>
+#include <unistd.h>
+#include <time.h>
+#include <string.h>
+#include <malloc.h>
+int main()
+{
+    time_t t = time(0L);
+    char w_tz[]="TZ" "=GMT+5",
+        e_tz[]="TZ" "=GMT-5",
+       *tz_e = (char*)malloc(16),
+       *tz_w = (char*)malloc(16);
+    struct tm tm_e, tm_w;
+    memset(&tm_e,'\0',sizeof(struct tm));
+    memset(&tm_w,'\0',sizeof(struct tm));
+    strcpy(tz_e,e_tz);
+    strcpy(tz_w,w_tz);
+
+    putenv(tz_e);
+    localtime_r(&t, &tm_e);
+
+    putenv(tz_w);
+    localtime_r(&t, &tm_w);
+
+    if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
+       return 1;
+    return 0;
+}
+EOCP
+       set try
+       if eval $compile; then
+           if ./try; then
+               d_localtime_r_needs_tzset=undef;
+           else
+               d_localtime_r_needs_tzset=define;
+           fi;
+       else
+           d_localtime_r_needs_tzset=undef;
+       fi;
+     ;;
+  *)
+     d_localtime_r_needs_tzset=undef;
+     ;;
+esac
+$rm -f try try.* core
+
 : see if localeconv exists
 set localeconv d_locconv
 eval $inlibc
@@ -14801,7 +15276,7 @@ $cat <<EOP >try.c
 #include <signal.h>
 #ifdef SIGFPE
 $volatile int bletched = 0;
-$signal_t blech(s) int s; { bletched = 1; }
+$signal_t blech(int s) { bletched = 1; }
 #endif
 int main() {
     $uvtype u = 0;
@@ -14873,7 +15348,7 @@ $cat <<EOP >try.c
 #include <signal.h>
 #ifdef SIGFPE
 $volatile int bletched = 0;
-$signal_t blech(s) int s; { bletched = 1; }
+$signal_t blech(int s) { bletched = 1; }
 #endif
 
 int checkit($nvtype d, char *where) {
@@ -15097,6 +15572,54 @@ $rm -f reflect
 set d_procselfexe
 eval $setvar
 
+: backward compatibility for d_hvfork
+if test X$d_hvfork != X; then
+       d_vfork="$d_hvfork"
+       d_hvfork=''
+fi
+: see if there is a vfork
+val=''
+set vfork val
+eval $inlibc
+
+d_pseudofork=$undef
+
+: Ok, but do we want to use it. vfork is reportedly unreliable in
+: perl on Solaris 2.x, and probably elsewhere.
+case "$val" in
+$define)
+       echo " "
+       case "$usevfork" in
+       false) dflt='n';;
+       *) dflt='y';;
+       esac
+       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) ;;
+       *)
+               echo "Ok, we won't use vfork()."
+               val="$undef"
+               ;;
+       esac
+       ;;
+esac
+set d_vfork
+eval $setvar
+case "$d_vfork" in
+$define) usevfork='true';;
+*) usevfork='false';;
+esac
+
 : see whether the pthread_atfork exists
 $cat >try.c <<EOP
 #include <pthread.h>
@@ -15700,9 +16223,9 @@ $define)
 #endif
 END
     : see whether semctl IPC_STAT can use union semun
-    val="$undef"
     case "$d_semctl_semun" in
     '')
+      val="$undef"
       $cat > try.c <<END
 #include <sys/types.h>
 #include <sys/ipc.h>
@@ -15741,7 +16264,7 @@ int main() {
            printf("semctl IPC_STAT failed: errno = %d\n", errno);
 #      ifdef IPC_RMID
        if (semctl(sem, 0, IPC_RMID, arg) != 0)
-#      endif /* IPC_RMID */
+#      endif /* IPC_RMID */
            printf("semctl IPC_RMID failed: errno = %d\n", errno);
     } else
 #endif /* IPC_PRIVATE && ... */
@@ -15757,10 +16280,10 @@ END
           esac
       fi
       $rm -f try try.c
+      set d_semctl_semun
+      eval $setvar
       ;;
     esac
-    set d_semctl_semun
-    eval $setvar
     case "$d_semctl_semun" in
     $define)
         echo "You can use union semun for semctl IPC_STAT." >&4
@@ -15772,9 +16295,9 @@ END
     esac
 
     : see whether semctl IPC_STAT can use struct semid_ds pointer
-    val="$undef"
     case "$d_semctl_semid_ds" in
     '')
+      val="$undef"
       $cat > try.c <<'END'
 #include <sys/types.h>
 #include <sys/ipc.h>
@@ -15819,10 +16342,10 @@ END
           esac
       fi
       $rm -f try try.c
+      set d_semctl_semid_ds
+      eval $setvar
       ;;
     esac
-    set d_semctl_semid_ds
-    eval $setvar
     case "$d_semctl_semid_ds" in
     $define)
         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
@@ -16494,18 +17017,145 @@ set d_sigsetjmp
 eval $setvar
 $rm -f try.c try
 
-: see if sockatmark exists
-set sockatmark d_sockatmark
-eval $inlibc
+: see if snprintf exists
+set snprintf d_snprintf
+eval $inlibc
+
+: see if vsnprintf exists
+set vsnprintf d_vsnprintf
+eval $inlibc
+
+case "$d_snprintf-$d_vsnprintf" in
+"$define-$define")
+    $cat <<EOM
+Checking whether your snprintf() and vsnprintf() work okay...
+EOM
+    $cat >try.c <<'EOCP'
+/* v?snprintf testing logic courtesy of Russ Allbery.
+ * According to C99:
+ * - if the buffer is too short it still must be \0-terminated
+ * - if the buffer is too short the potentially required length
+ *   must be returned and not -1
+ * - if the buffer is NULL the potentially required length
+ *   must be returned and not -1 or core dump
+ */
+#include <stdio.h>
+#include <stdarg.h>
+
+char buf[2];
+
+int test (char *format, ...)
+{
+    va_list args;
+    int count;
+
+    va_start (args, format);
+    count = vsnprintf (buf, sizeof buf, format, args);
+    va_end (args);
+    return count;
+}
+
+int main ()
+{
+    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
+             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
+}
+EOCP
+    set try
+    if eval $compile; then
+       `$run ./try`
+       case "$?" in
+       0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
+       *) cat <<EOM >&4
+Your snprintf() and snprintf() don't seem to be working okay.
+EOM
+          d_snprintf="$undef"
+          d_vsnprintf="$undef"
+          ;;
+       esac
+    else
+       echo "(I can't seem to compile the test program--assuming they don't)"
+       d_snprintf="$undef"
+       d_vsnprintf="$undef"
+    fi
+    $rm -f try.* try core core.try.*
+    ;;
+esac
+
+: see if sockatmark exists
+set sockatmark d_sockatmark
+eval $inlibc
+
+: see if prototype for sockatmark is available
+echo " "
+set d_sockatmarkproto sockatmark $d_socket sys/socket.h
+eval $hasproto
+
+: see if socks5_init exists
+set socks5_init d_socks5_init
+eval $inlibc
+
+: see if sprintf returns the length of the string in the buffer as per ANSI
+$echo "Checking whether sprintf returns the length of the string..." >&4
+$cat <<EOP >try.c
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#$i_string I_STRING
+#ifdef I_STRING
+#  include <string.h>
+#else
+#  include <strings.h>
+#endif
+#$i_math I_MATH
+#ifdef I_MATH
+#include <math.h>
+#endif
+
+char buffer[256];
 
-: see if prototype for sockatmark is available
-echo " "
-set d_sockatmarkproto sockatmark $d_socket sys/socket.h
-eval $hasproto
+int check (size_t expect, int test) {
+  size_t got = strlen(buffer);
+  if (expect == got)
+    return 0;
 
-: see if socks5_init exists
-set socks5_init d_socks5_init
-eval $inlibc
+  printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
+       test, buffer);
+  exit (test);
+}
+
+int main(int argc, char **argv) {
+  int test = 0;
+
+  check(sprintf(buffer, ""), ++test);
+  check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
+  check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
+
+  return 0;
+}
+EOP
+set try
+
+d_sprintf_returns_strlen="$undef"
+if eval $compile; then
+    xxx="`$run ./try`"
+    case "$?" in
+       0) cat >&4 <<EOM
+sprintf returns the length of the string (as ANSI says it should)
+EOM
+       d_sprintf_returns_strlen="$define"
+       ;;
+       *) cat >&4 <<EOM
+sprintf does not return the length of the string (how old is this system?)
+EOM
+       d_sprintf_returns_strlen="$undef"
+        ;;
+    esac
+fi
+
+$rm -f try.* try
 
 : see if srand48_r exists
 set srand48_r d_srand48_r
@@ -17362,7 +18012,7 @@ case "$d_u32align" in
 #define U8 $u8type
 #include <signal.h>
 #ifdef SIGBUS
-$signal_t bletch(s) int s; { exit(4); }
+$signal_t bletch(int s) { exit(4); }
 #endif
 int main() {
 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
@@ -17478,52 +18128,6 @@ eval $hasproto
 set ustat d_ustat
 eval $inlibc
 
-: backward compatibility for d_hvfork
-if test X$d_hvfork != X; then
-       d_vfork="$d_hvfork"
-       d_hvfork=''
-fi
-: see if there is a vfork
-val=''
-set vfork val
-eval $inlibc
-
-: Ok, but do we want to use it. vfork is reportedly unreliable in 
-: perl on Solaris 2.x, and probably elsewhere.
-case "$val" in
-$define)
-       echo " "
-       case "$usevfork" in
-       false) dflt='n';;
-       *) dflt='y';;
-       esac
-       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) ;;
-       *)
-               echo "Ok, we won't use vfork()."
-               val="$undef"
-               ;;
-       esac
-       ;;
-esac
-set d_vfork
-eval $setvar
-case "$d_vfork" in
-$define) usevfork='true';;
-*) usevfork='false';;
-esac
-
 : see if closedir exists
 set closedir d_closedir
 eval $inlibc
@@ -18720,6 +19324,39 @@ EOM
 *)  groupstype="$gidtype";;
 esac
 
+
+if $test $patchlevel -lt 9; then
+: MAD is not available in 5.8.x or earlier.
+    ans=n;
+else
+    case "$mad" in
+    $define|true|[yY]*)        dflt='y' ;;
+    *)                 dflt='n' ;;
+    esac
+    cat <<EOM
+
+Would you like to build with Misc Attribute Decoration? This is development
+work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
+overhead on the interpreter.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+    rp='Build Perl with MAD?'
+    . ./myread
+fi
+case "$ans" in
+y|Y)   val="$define"
+       madlyh='madly.h madly.act madly.tab'
+       madlysrc='madly.c'
+       madlyobj="madly$_o" ;;
+*)     val="$undef"
+       madlyh=''
+       madlysrc=''
+       madlyobj='' ;;
+esac
+set mad
+eval $setvar
+
 echo " "
 echo "Checking if your $make program sets \$(MAKE)..." >&4
 case "$make_set_make" in
@@ -18745,104 +19382,6 @@ rp="What is the type used for file modes for system calls (e.g. fchmod())?"
 set mode_t modetype int stdio.h sys/types.h
 eval $typedef_ask
 
-: see if stdarg is available
-echo " "
-if $test `./findhdr stdarg.h`; then
-       echo "<stdarg.h> found." >&4
-       valstd="$define"
-else
-       echo "<stdarg.h> NOT found." >&4
-       valstd="$undef"
-fi
-
-: see if varags is available
-echo " "
-if $test `./findhdr varargs.h`; then
-       echo "<varargs.h> found." >&4
-else
-       echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
-fi
-
-: set up the varargs testing programs
-$cat > varargs.c <<EOP
-#ifdef I_STDARG
-#include <stdarg.h>
-#endif
-#ifdef I_VARARGS
-#include <varargs.h>
-#endif
-
-#ifdef I_STDARG
-int f(char *p, ...)
-#else
-int f(va_alist)
-va_dcl
-#endif
-{
-       va_list ap;
-#ifndef I_STDARG
-       char *p;
-#endif
-#ifdef I_STDARG
-       va_start(ap,p);
-#else
-       va_start(ap);
-       p = va_arg(ap, char *);
-#endif
-       va_end(ap);
-}
-EOP
-$cat > varargs <<EOP
-$startsh
-if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
-       echo "true"
-else
-       echo "false"
-fi
-$rm -f varargs$_o
-EOP
-chmod +x varargs
-
-: now check which varargs header should be included
-echo " "
-i_varhdr=''
-case "$valstd" in
-"$define")
-       if `./varargs I_STDARG`; then
-               val='stdarg.h'
-       elif `./varargs I_VARARGS`; then
-               val='varargs.h'
-       fi
-       ;;
-*)
-       if `./varargs I_VARARGS`; then
-               val='varargs.h'
-       fi
-       ;;
-esac
-case "$val" in
-'')
-echo "I could not find the definition for va_dcl... You have problems..." >&4
-       val="$undef"; set i_stdarg; eval $setvar
-       val="$undef"; set i_varargs; eval $setvar
-       ;;
-*) 
-       set i_varhdr
-       eval $setvar
-       case "$i_varhdr" in
-       stdarg.h)
-               val="$define"; set i_stdarg; eval $setvar
-               val="$undef"; set i_varargs; eval $setvar
-               ;;
-       varargs.h)
-               val="$undef"; set i_stdarg; eval $setvar
-               val="$define"; set i_varargs; eval $setvar
-               ;;
-       esac
-       echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
-esac
-$rm -f varargs*
-
 : see if we need va_copy
 echo " "
 case "$i_stdarg" in
@@ -19100,6 +19639,12 @@ if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        if [ "X$ranlib" = "X" ]; then
            ranlib=":"
        fi
+elif $ar s bar$_a >/dev/null 2>&1 &&
+       $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
+       $run ./foobar >/dev/null 2>&1; then
+               echo "a table of contents needs to be added with '$ar s'."
+               orderlib=false
+               ranlib="$ar s"
 elif $ar ts bar$_a >/dev/null 2>&1 &&
        $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        $run ./foobar >/dev/null 2>&1; then
@@ -19124,7 +19669,7 @@ else
                ranlib=":"
        fi
 fi
-$rm -f foo* bar* 
+$rm -f foo* bar*
 
 : check for type of arguments to select. 
 case "$selecttype" in
@@ -19221,7 +19766,7 @@ $selecttype b;
 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
 #define NBITS  (NBYTES * 8)
 int main() {
-    char *s = malloc(NBYTES);
+    char *s = (char *)malloc(NBYTES);
     struct timeval t;
     int i;
     FILE* fp;
@@ -19712,7 +20257,8 @@ $rm -f try try.*
 
 : see what type of char stdio uses.
 echo " "
-echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
+echo '#include <stdio.h>' > stdio.c
+$cppstdin $cppminus < stdio.c > stdioh
 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
        echo "Your stdio uses unsigned chars." >&4
        stdchar="unsigned char"
@@ -19720,9 +20266,7 @@ else
        echo "Your stdio uses signed chars." >&4
        stdchar="char"
 fi
-$rm -f stdioh
-
-
+$rm -f stdio.* stdioh
 
 : see what type uids are declared as in the kernel
 echo " "
@@ -19907,6 +20451,26 @@ eval $inhdr
 set fp_class.h i_fp_class
 eval $inhdr
 
+: see if gdbm.h is available
+set gdbm.h t_gdbm
+eval $inhdr
+case "$t_gdbm" in
+$define)
+       : see if gdbm_open exists
+       set gdbm_open d_gdbm_open
+       eval $inlibc
+       case "$d_gdbm_open" in
+       $undef)
+               t_gdbm="$undef"
+               echo "We won't be including <gdbm.h>"
+               ;;
+       esac
+       ;;
+esac
+val="$t_gdbm"
+set i_gdbm
+eval $setvar
+
 : see if this is a ieeefp.h system
 case "$i_ieeefp" in
 '' ) set ieeefp.h i_ieeefp
@@ -20008,7 +20572,7 @@ set prot.h i_prot
 eval $inhdr
 
 echo " "
-$echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
+$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
 $cat <<'EOSH' > Cppsym.know
 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
@@ -20105,16 +20669,26 @@ cat <<EOSH > Cppsym.try
 $startsh
 cat <<'EOCP' > try.c
 #include <stdio.h>
+#if cpp_stuff == 1
+#define STRINGIFY(a)    "a"
+#endif
+#if cpp_stuff == 42
+#define StGiFy(a)  #a
+#define STRINGIFY(a)    StGiFy(a)
+#endif
+#if $cpp_stuff != 1 && $cpp_stuff != 42
+#   include "Bletch: How does this C preprocessor stringify macros?"
+#endif
 int main() {
 EOCP
 $awk \\
 EOSH
 cat <<'EOSH' >> Cppsym.try
 'length($1) > 0 {
-    printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
-    printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
-    printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
-    printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
+    printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
+    printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
+    printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
+    printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
 }'      >> try.c
 echo 'return 0;}' >> try.c
 EOSH
@@ -20124,11 +20698,26 @@ case "$osname-$gccversion" in
 irix-) ccflags="\$ccflags -woff 1178" ;;
 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
 esac
-$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
+$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
 EOSH
 chmod +x Cppsym.try
 $eunicefix Cppsym.try
 ./Cppsym < Cppsym.know > Cppsym.true
+: Add in any linux cpp "predefined macros":
+case "$osname::$gccversion" in
+  *linux*::*.*)
+    tHdrH=_tmpHdr
+    rm -f $tHdrH'.h' $tHdrH
+    touch $tHdrH'.h'
+    if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
+       sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
+       if [ -s $tHdrH'_cppsym.real' ]; then
+         cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
+       fi
+    fi
+    rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
+  ;;
+esac
 : now check the C compiler for additional symbols
 postprocess_cc_v=''
 case "$osname" in
 
 $awk '/\=/ { print $0; next }
        { print $0"=1" }' ccsym.raw >ccsym.list
-$awk '/\=/ { print $0; next }
-       { print $0"=1" }' Cppsym.true >ccsym.true
-$comm -13 ccsym.true ccsym.list >ccsym.own
-$comm -12 ccsym.true ccsym.list >ccsym.com
-$comm -23 ccsym.true ccsym.list >ccsym.cpp
+$comm -13 Cppsym.true ccsym.list >ccsym.own
+$comm -12 Cppsym.true ccsym.list >ccsym.com
+$comm -23 Cppsym.true ccsym.list >ccsym.cpp
 also=''
 if $test -z ccsym.raw; then
        echo "Your C compiler doesn't seem to define any symbols!" >&4
@@ -20371,26 +20958,6 @@ case "$d_vfork" in
        ;;
 esac
 
-: see if gdbm.h is available
-set gdbm.h t_gdbm
-eval $inhdr
-case "$t_gdbm" in
-$define)
-       : see if gdbm_open exists
-       set gdbm_open d_gdbm_open
-       eval $inlibc
-       case "$d_gdbm_open" in
-       $undef)
-               t_gdbm="$undef"
-               echo "We won't be including <gdbm.h>"
-               ;;
-       esac
-       ;;
-esac
-val="$t_gdbm"
-set i_gdbm
-eval $setvar
-
 echo " "
 echo "Looking for extensions..." >&4
 : If we are using the old config.sh, known_extensions may contain
@@ -20406,24 +20973,24 @@ nonxs_extensions=''
 : 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;
+       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"
@@ -20452,12 +21019,12 @@ for xxx in $known_extensions ; do
                esac
                ;;
        GDBM_File|gdbm_fil)
-               case "$i_gdbm" in 
+               case "$i_gdbm" in
                $define) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
        I18N/Langinfo|i18n_lan)
-               case "$i_langinfo$d_nl_langinfo" in 
+               case "$i_langinfo$d_nl_langinfo" in
                $define$define) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
@@ -20475,7 +21042,7 @@ for xxx in $known_extensions ; do
                    ;;
                esac
                ;;
-       ODBM_File|odbm_fil) 
+       ODBM_File|odbm_fil)
                case "${i_dbm}${i_rpcsvcdbm}" in
                *"${define}"*)
                    case "$osname-$use64bitint" in
@@ -20500,7 +21067,7 @@ for xxx in $known_extensions ; do
                esac
                ;;
        Socket|socket)
-               case "$d_socket" in 
+               case "$d_socket" in
                true|$define|y)
                    case "$osname" in
                    beos) ;; # not unless BONE
@@ -20511,7 +21078,7 @@ for xxx in $known_extensions ; do
                ;;
        Sys/Syslog|sys/syslog)
                : XXX syslog requires socket
-               case "$d_socket" in 
+               case "$d_socket" in
                true|$define|y) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
@@ -20552,7 +21119,7 @@ for xxx in $known_extensions ; do
                ;;
        IPC/SysV|ipc/sysv)
                : XXX Do we need a useipcsysv variable here
-               case "${d_msg}${d_sem}${d_shm}" in 
+               case "${d_msg}${d_sem}${d_shm}" in
                *"${define}"*) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
@@ -20642,11 +21209,11 @@ EOM
                previous)
                        if test X"$dynamic_ext" != X"$avail_ext"; then
                                $cat <<EOM
-NOTICE:  Your previous config.sh list may be incorrect. 
-The extensions now available to you are 
+NOTICE:  Your previous config.sh list may be incorrect.
+The extensions now available to you are
        ${avail_ext}
 but the default list from your previous config.sh is
-       ${dynamic_ext} 
+       ${dynamic_ext}
 
 EOM
                        fi
@@ -20678,7 +21245,7 @@ EOM
                shift
                dflt="$*"
                ;;
-       *)  dflt="$static_ext" 
+       *)  dflt="$static_ext"
                ;;
        esac
 
@@ -20694,8 +21261,8 @@ EOM
        ;;
 *)
        $cat <<EOM
-A number of extensions are supplied with $package.  Answer "none" 
-to include no extensions. 
+A number of extensions are supplied with $package.  Answer "none"
+to include no extensions.
 Note that DynaLoader is always built and need not be mentioned here.
 
 EOM
@@ -20707,11 +21274,11 @@ EOM
                previous)
                        if test X"$static_ext" != X"$avail_ext"; then
                                $cat <<EOM
-NOTICE:  Your previous config.sh list may be incorrect. 
-The extensions now available to you are 
+NOTICE:  Your previous config.sh list may be incorrect.
+The extensions now available to you are
        ${avail_ext}
 but the default list from your previous config.sh is
-       ${static_ext} 
+       ${static_ext}
 
 EOM
                        fi
@@ -20731,7 +21298,7 @@ EOM
        esac
        ;;
 esac
-#        
+#
 # Encode is a special case.  If we are building Encode as a static
 # extension, we need to explicitly list its subextensions as well.
 # For other nested extensions, this is handled automatically by
@@ -20970,7 +21537,10 @@ d_bcopy='$d_bcopy'
 d_bsd='$d_bsd'
 d_bsdgetpgrp='$d_bsdgetpgrp'
 d_bsdsetpgrp='$d_bsdsetpgrp'
+d_builtin_choose_expr='$d_builtin_choose_expr'
+d_builtin_expect='$d_builtin_expect'
 d_bzero='$d_bzero'
+d_c99_variadic_macros='$d_c99_variadic_macros'
 d_casti32='$d_casti32'
 d_castneg='$d_castneg'
 d_charvspr='$d_charvspr'
@@ -20978,19 +21548,23 @@ d_chown='$d_chown'
 d_chroot='$d_chroot'
 d_chsize='$d_chsize'
 d_class='$d_class'
+d_clearenv='$d_clearenv'
 d_closedir='$d_closedir'
 d_cmsghdr_s='$d_cmsghdr_s'
 d_const='$d_const'
 d_copysignl='$d_copysignl'
+d_cplusplus='$d_cplusplus'
 d_crypt='$d_crypt'
 d_crypt_r='$d_crypt_r'
 d_csh='$d_csh'
+d_ctermid='$d_ctermid'
 d_ctermid_r='$d_ctermid_r'
 d_ctime_r='$d_ctime_r'
 d_cuserid='$d_cuserid'
 d_dbl_dig='$d_dbl_dig'
 d_dbminitproto='$d_dbminitproto'
 d_difftime='$d_difftime'
+d_dir_dd_fd='$d_dir_dd_fd'
 d_dirfd='$d_dirfd'
 d_dirnamlen='$d_dirnamlen'
 d_dlerror='$d_dlerror'
@@ -21046,6 +21620,7 @@ d_fstatvfs='$d_fstatvfs'
 d_fsync='$d_fsync'
 d_ftello='$d_ftello'
 d_ftime='$d_ftime'
+d_futimes='$d_futimes'
 d_getcwd='$d_getcwd'
 d_getespwnam='$d_getespwnam'
 d_getfsstat='$d_getfsstat'
@@ -21108,6 +21683,7 @@ d_grpasswd='$d_grpasswd'
 d_hasmntopt='$d_hasmntopt'
 d_htonl='$d_htonl'
 d_ilogbl='$d_ilogbl'
+d_inc_version_list='$d_inc_version_list'
 d_index='$d_index'
 d_inetaton='$d_inetaton'
 d_int64_t='$d_int64_t'
@@ -21122,6 +21698,7 @@ d_ldbl_dig='$d_ldbl_dig'
 d_libm_lib_version='$d_libm_lib_version'
 d_link='$d_link'
 d_localtime_r='$d_localtime_r'
+d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
 d_locconv='$d_locconv'
 d_lockf='$d_lockf'
 d_longdbl='$d_longdbl'
@@ -21180,7 +21757,9 @@ d_phostname='$d_phostname'
 d_pipe='$d_pipe'
 d_poll='$d_poll'
 d_portable='$d_portable'
+d_printf_format_null='$d_printf_format_null'
 d_procselfexe='$d_procselfexe'
+d_pseudofork='$d_pseudofork'
 d_pthread_atfork='$d_pthread_atfork'
 d_pthread_attr_setscope='$d_pthread_attr_setscope'
 d_pthread_yield='$d_pthread_yield'
@@ -21262,12 +21841,15 @@ d_shmget='$d_shmget'
 d_sigaction='$d_sigaction'
 d_sigprocmask='$d_sigprocmask'
 d_sigsetjmp='$d_sigsetjmp'
+d_sitearch='$d_sitearch'
+d_snprintf='$d_snprintf'
 d_sockatmark='$d_sockatmark'
 d_sockatmarkproto='$d_sockatmarkproto'
 d_socket='$d_socket'
 d_socklen_t='$d_socklen_t'
 d_sockpair='$d_sockpair'
 d_socks5_init='$d_socks5_init'
+d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
 d_sqrtl='$d_sqrtl'
 d_srand48_r='$d_srand48_r'
 d_srandom_r='$d_srandom_r'
@@ -21342,6 +21924,7 @@ d_voidsig='$d_voidsig'
 d_voidtty='$d_voidtty'
 d_volatile='$d_volatile'
 d_vprintf='$d_vprintf'
+d_vsnprintf='$d_vsnprintf'
 d_wait4='$d_wait4'
 d_waitpid='$d_waitpid'
 d_wcstombs='$d_wcstombs'
@@ -21528,6 +22111,7 @@ inc_version_list='$inc_version_list'
 inc_version_list_init='$inc_version_list_init'
 incpath='$incpath'
 inews='$inews'
+initialinstalllocation='$initialinstalllocation'
 installarchlib='$installarchlib'
 installbin='$installbin'
 installhtml1dir='$installhtml1dir'
@@ -21596,6 +22180,10 @@ lpr='$lpr'
 ls='$ls'
 lseeksize='$lseeksize'
 lseektype='$lseektype'
+mad='$mad'
+madlyh='$madlyh'
+madlyobj='$madlyobj'
+madlysrc='$madlysrc'
 mail='$mail'
 mailx='$mailx'
 make='$make'