better variant of change#4644 (from Andy Dougherty)
[p5sagit/p5-mst-13.2.git] / Configure
index 4a0c191..e71aefc 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Thu Oct 28 15:06:20 EET DST 1999 [metaconfig 3.0 PL70]
+# Generated on Tue Nov 16 23:04:27 EET 1999 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.com)
 
 cat >/tmp/c1$$ <<EOF
@@ -298,6 +298,7 @@ optimize=''
 cf_email=''
 cf_by=''
 cf_time=''
+charsize=''
 contains=''
 cpp_stuff=''
 cpplast=''
@@ -399,6 +400,7 @@ d_gnulibc=''
 d_hasmntopt=''
 d_htonl=''
 d_inetaton=''
+d_int64t=''
 d_isascii=''
 d_killpg=''
 d_lchown=''
@@ -569,7 +571,9 @@ doublesize=''
 ebcdic=''
 fflushNULL=''
 fflushall=''
+fpossize=''
 fpostype=''
+gidformat=''
 gidsign=''
 gidsize=''
 gidtype=''
@@ -592,7 +596,6 @@ i_float=''
 i_gdbm=''
 d_grpasswd=''
 i_grp=''
-d_int64t=''
 i_inttypes=''
 i_limits=''
 i_locale=''
@@ -644,7 +647,6 @@ i_sysstatfs=''
 i_sysstatvfs=''
 i_systimes=''
 i_systypes=''
-d_iovec_s=''
 i_sysuio=''
 i_sysun=''
 i_sysvfs=''
@@ -672,7 +674,6 @@ intsize=''
 longsize=''
 shortsize=''
 d_fpos64_t=''
-d_llseek=''
 d_off64_t=''
 libc=''
 ldlibpthname=''
@@ -751,6 +752,32 @@ subversion=''
 version=''
 perladmin=''
 perlpath=''
+i16size=''
+i16type=''
+i32size=''
+i32type=''
+i64size=''
+i64type=''
+i8size=''
+i8type=''
+ivsize=''
+ivtype=''
+nvsize=''
+nvtype=''
+u16size=''
+u16type=''
+u32size=''
+u32type=''
+u64size=''
+u64type=''
+u8size=''
+u8type=''
+uvsize=''
+uvtype=''
+ivdformat=''
+uvoformat=''
+uvuformat=''
+uvxformat=''
 pidtype=''
 prefix=''
 prefixexp=''
@@ -771,6 +798,10 @@ sPRIi64=''
 sPRIo64=''
 sPRIu64=''
 sPRIx64=''
+d_quad=''
+quadkind=''
+quadtype=''
+uquadtype=''
 drand01=''
 randbits=''
 randfunc=''
@@ -813,6 +844,7 @@ stdio_stream_array=''
 d_strtoull=''
 sysman=''
 trnl=''
+uidformat=''
 uidsign=''
 uidsize=''
 uidtype=''
@@ -820,6 +852,7 @@ archname64=''
 use64bits=''
 uselargefiles=''
 uselongdouble=''
+uselonglong=''
 usemorebits=''
 usemultiplicity=''
 nm_opt=''
@@ -3022,207 +3055,194 @@ case "$gccversion" in
 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
 esac
 
+: see how we invoke the C preprocessor
+echo " "
+echo "Now, how can we feed standard input to your C preprocessor..." >&4
+cat <<'EOT' >testcpp.c
+#define ABC abc
+#define XYZ xyz
+ABC.XYZ
+EOT
+cd ..
+if test ! -f cppstdin; then
+       if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
+               # AIX cc -E doesn't show the absolute headerfile
+               # locations but we'll cheat by using the -M flag.
+               echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
+       else
+               echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
+       fi
+else
+       echo "Keeping your $hint cppstdin wrapper."
+fi
+chmod 755 cppstdin
+wrapper=`pwd`/cppstdin
+ok='false'
+cd UU
 
-case "$usemorebits" in
-"$define"|true|[yY]*)
-       use64bits="$define"
-       uselongdouble="$define"
-       usemorebits="$define"
-       ;;
-*)     usemorebits="$undef"
-       ;;
-esac
-
-
-cat <<EOM
+if $test "X$cppstdin" != "X" && \
+       $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
+then
+       echo "You used to use $cppstdin $cppminus so we'll use that again."
+       case "$cpprun" in
+       '') echo "But let's see if we can live without a wrapper..." ;;
+       *)
+               if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
+                       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
+               then
+                       echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
+                       ok='true'
+               else
+                       echo "(However, $cpprun $cpplast does not work, let's see...)"
+               fi
+               ;;
+       esac
+else
+       case "$cppstdin" in
+       '') ;;
+       *)
+               echo "Good old $cppstdin $cppminus does not seem to be of any help..."
+               ;;
+       esac
+fi
 
-Perl can be built to understand large files (files larger than 2 gigabytes)
-on some systems.  To do so, Configure must be run with -Duselargefiles.
+if $ok; then
+       : nothing
+elif echo 'Maybe "'"$cc"' -E" will work...'; \
+       $cc -E <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       echo "Yup, it does."
+       x_cpp="$cc -E"
+       x_minus='';
+elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
+       $cc -E - <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       echo "Yup, it does."
+       x_cpp="$cc -E"
+       x_minus='-';
+elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
+       $cc -P <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       echo "Yipee, that works!"
+       x_cpp="$cc -P"
+       x_minus='';
+elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
+       $cc -P - <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       echo "At long last!"
+       x_cpp="$cc -P"
+       x_minus='-';
+elif echo 'No such luck, maybe "'$cpp'" will work...'; \
+       $cpp <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       echo "It works!"
+       x_cpp="$cpp"
+       x_minus='';
+elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
+       $cpp - <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       echo "Hooray, it works!  I was beginning to wonder."
+       x_cpp="$cpp"
+       x_minus='-';
+elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
+       $wrapper <testcpp.c >testcpp.out 2>&1; \
+       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+       x_cpp="$wrapper"
+       x_minus=''
+       echo "Eureka!"
+else
+       dflt=''
+       rp="No dice.  I can't find a C preprocessor.  Name one:"
+       . ./myread
+       x_cpp="$ans"
+       x_minus=''
+       $x_cpp <testcpp.c >testcpp.out 2>&1
+       if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+               echo "OK, that will do." >&4
+       else
+echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
+               exit 1
+       fi
+fi
 
-If this doesn't make any sense to you, just accept the default.
-EOM
-case "$uselargefiles" in
-"$define"|true|[yY]*) dflt='y' ;;
-*)     dflt='n' ;;
-esac
-rp='Try to understand large files?'
-. ./myread
-case "$ans" in
-y|Y)   val="$define" ;;
-*)     val="$undef"  ;;
-esac
-set uselargefiles
-eval $setvar
-case "$uselargefiles" in
-"$define") use64bits="$define" ;;
+case "$ok" in
+false)
+       cppstdin="$x_cpp"
+       cppminus="$x_minus"
+       cpprun="$x_cpp"
+       cpplast="$x_minus"
+       set X $x_cpp
+       shift
+       case "$1" in
+       "$cpp")
+               echo "Perhaps can we force $cc -E using a wrapper..."
+               if $wrapper <testcpp.c >testcpp.out 2>&1; \
+                       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
+               then
+                       echo "Yup, we can."
+                       cppstdin="$wrapper"
+                       cppminus='';
+               else
+                       echo "Nope, we'll have to live without it..."
+               fi
+               ;;
+       esac
+       case "$cpprun" in
+       "$wrapper")
+               cpprun=''
+               cpplast=''
+               ;;
+       esac
+       ;;
 esac
 
-cat <<EOM
-
-Perl can be built to take advantage of explicit 64-bit interfaces,
-on some systems.  To do so, Configure must be run with -Duse64bits.
-
-If this doesn't make any sense to you, just accept the default.
-EOM
-case "$use64bits" in
-$define|true|[yY]*)    dflt='y';;
-*) dflt='n';;
-esac
-rp='Try to use explicit 64-bit interfaces, if available?'
-. ./myread
-case "$ans" in
-y|Y) 
-       val="$define"
-       ;;     
-*)      
-       val="$undef"
-       ;;
+case "$cppstdin" in
+"$wrapper"|'cppstdin') ;;
+*) $rm -f $wrapper;;
 esac
-set use64bits
-eval $setvar
+$rm -f testcpp.c testcpp.out
 
-case "$archname64" in
-'') archname64='' ;;   # not a typo
+: decide how portable to be.  Allow command line overrides.
+case "$d_portable" in
+"$undef") ;;
+*)     d_portable="$define" ;;
 esac
 
-case "$use64bits" in
-"$define"|true|[yY]*)
-: Look for a hint-file generated 'call-back-unit'.  If the
-: user has specified that a 64 bit perl is to be built,
-: we may need to set or change some other defaults.
-       if $test -f use64bits.cbu; then
-               echo "Your platform has some specific hints for 64-bit builds, using them..."
-               . ./use64bits.cbu
+: 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
-               $cat <<EOM
-(Your platform doesn't have any specific hints for 64-bit builds.
- This is probably okay, especially if your system is a true 64-bit system.)
-EOM
-               case "$gccversion" in
-               '')     ;;
-               *)      $cat <<EOM
-But since you seem to be using gcc,
-I will now add -DUSE_LONG_LONG to the compilation flags.
-EOM
-                       ccflags="$ccflags -DUSE_LONG_LONG"
+               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
        ;;
-esac
-
-: determine the architecture name
-echo " "
-if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
-       tarch=`arch`"-$osname"
-elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
-       if uname -m > tmparch 2>&1 ; then
-               tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
-                       -e 's/$/'"-$osname/" tmparch`
-       else
-               tarch="$osname"
-       fi
-       $rm -f tmparch
-else
-       tarch="$osname"
-fi
-case "$myarchname" in
-''|"$tarch") ;;
 *)
-       echo "(Your architecture name used to be $myarchname.)"
-       archname=''
-       ;;
-esac
-myarchname="$tarch"
-case "$archname" in
-'') dflt="$tarch";;
-*) dflt="$archname";;
-esac
-rp='What is your architecture name'
-. ./myread
-archname="$ans"
-case "$usethreads" in
-$define)
-       echo "Threads selected." >&4
-       case "$archname" in
-        *-thread*) echo "...and architecture name already has -thread." >&4
-                ;;
-        *)      archname="$archname-thread"
-                echo "...setting architecture name to $archname." >&4
-                ;;
-        esac
-       ;;
-esac
-case "$usemultiplicity" in
-$define)
-       echo "Multiplicity selected." >&4
-       case "$archname" in
-        *-multi*) echo "...and architecture name already has -multi." >&4
-                ;;
-        *)      archname="$archname-multi"
-                echo "...setting architecture name to $archname." >&4
-                ;;
-        esac
-       ;;
-esac
-case "$use64bits" in
-$define)
-       echo "Explicit 64-bitness selected." >&4
-       case "$archname64" in
-       '')
-               ;;
-       *)
-               case "$archname" in
-               *-$archname64*) echo "...and architecture name already has $archname64." >&4
-                       ;;
-               *)      archname="$archname-$archname64"
-                       echo "...setting architecture name to $archname." >&4
-                       ;;
-               esac
-               ;;
-       esac
-esac
-
-: decide how portable to be.  Allow command line overrides.
-case "$d_portable" in
-"$undef") ;;
-*)     d_portable="$define" ;;
-esac
-
-: 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
+       echo \$1
        ;;
 esac
 EOSS
@@ -3460,1109 +3480,1392 @@ 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`
+: What should the include directory be ?
+echo " "
+$echo $n "Hmm...  $c"
+dflt='/usr/include'
+incpath=''
+mips_type=''
+if $test -f /bin/mips && /bin/mips; then
+       echo "Looks like a MIPS system..."
+       $cat >usr.c <<'EOCP'
+#ifdef SYSTYPE_BSD43
+/bsd43
+#endif
+EOCP
+       if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
+               dflt='/bsd43/usr/include'
+               incpath='/bsd43'
+               mips_type='BSD 4.3'
+       else
+               mips_type='System V'
+       fi
+       $rm -f usr.c usr.out
+       echo "and you're compiling with the $mips_type compiler and libraries."
+       xxx_prompt=y
+       echo "exit 0" >mips
+else
+       echo "Doesn't look like a MIPS system."
+       xxx_prompt=n
+       echo "exit 1" >mips
+fi
+chmod +x mips
+$eunicefix mips
+case "$usrinc" in
+'') ;;
+*) dflt="$usrinc";;
+esac
+case "$xxx_prompt" in
+y)     fn=d/
+       echo " "
+       rp='Where are the include files you want to use?'
+       . ./getfile
+       usrinc="$ans"
        ;;
-*)
-       dflt="$prefix"
+*)     usrinc="$dflt"
        ;;
 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.
+: Set private lib path
+case "$plibpth" in
+'') if ./mips; then
+               plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
+       fi;;
+esac
+case "$libpth" in
+' ') dlist='';;
+'') dlist="$loclibpth $plibpth $glibpth";;
+*) dlist="$libpth";;
+esac
+
+: Now check and see which directories actually exist, avoiding duplicates
+libpth=''
+for xxx in $dlist
+do
+    if $test -d $xxx; then
+               case " $libpth " in
+               *" $xxx "*) ;;
+               *) libpth="$libpth $xxx";;
+               esac
+    fi
+done
+$cat <<'EOM'
+
+Some systems have incompatible or broken versions of libraries.  Among
+the directories listed in the question below, please remove any you
+know not to be holding relevant libraries, and add any that are needed.
+Say "none" for none.
 
 EOM
-fn=d~
-rp='Installation prefix to use?'
-. ./getfile
-oldprefix=''
-case "$prefix" in
-'') ;;
+case "$libpth" in
+'') dflt='none';;
 *)
-       case "$ans" in
-       "$prefix") ;;
-       *) oldprefix="$prefix";;
-       esac
+       set X $libpth
+       shift
+       dflt=${1+"$@"}
        ;;
 esac
-prefix="$ans"
-prefixexp="$ansexp"
+rp="Directories to use for library searches?"
+. ./myread
+case "$ans" in
+none) libpth=' ';;
+*) libpth="$ans";;
+esac
 
-: is AFS running?
-echo " "
-case "$afs" in
-$define|true)  afs=true ;;
-$undef|false)  afs=false ;;
-*)     if test -d /afs; then
-               afs=true
+: compute shared library extension
+case "$so" in
+'')
+       if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
+               dflt='sl'
        else
-               afs=false
+               dflt='so'
        fi
        ;;
+*) dflt="$so";;
 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).
+On some systems, shared libraries may be available.  Answer 'none' if
+you want to suppress searching of shared libraries for the remaining
+of this configuration.
 
 EOM
-       case "$installprefix" in
-       '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
-       *) dflt="$installprefix";;
-       esac
-else
-$cat <<EOM
-
-In some special cases, particularly when building $package for distribution,
-it is convenient to distinguish between the directory in which files should 
-be installed from the directory ($prefix) in which they 
-will eventually reside.  For most users, these two directories are the same.
+rp='What is the file extension used for shared libraries?'
+. ./myread
+so="$ans"
 
-EOM
-       case "$installprefix" in
-       '') dflt=$prefix ;;
-       *) dflt=$installprefix;;
+: Define several unixisms.
+: Hints files or command line option can be used to override them.
+: The convoluted testing is in case hints files set either the old
+: or the new name.
+case "$_exe" in
+'')    case "$exe_ext" in
+    '')        ;;
+       *)      _exe="$exe_ext" ;;
        esac
-fi
-fn=d~
-rp='What installation prefix should I use for installing files?'
-. ./getfile
-installprefix="$ans"
-installprefixexp="$ansexp"
-
-: set the prefixit variable, to compute a suitable default value
-prefixit='case "$3" in
-""|none)
-       case "$oldprefix" in
-       "") eval "$1=\"\$$2\"";;
-       *)
-               case "$3" in
-               "") eval "$1=";;
-               none)
-                       eval "tp=\"\$$2\"";
-                       case "$tp" in
-                       ""|" ") eval "$1=\"\$$2\"";;
-                       *) eval "$1=";;
-                       esac;;
-               esac;;
-       esac;;
-*)
-       eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
-       case "$tp" in
-       --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
-       /*-$oldprefix/*|\~*-$oldprefix/*)
-               eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
-       *) eval "$1=\"\$$2\"";;
-       esac;;
-esac'
-
-: set the base revision
-baserev=5.0
-
-: get the patchlevel
-echo " "
-echo "Getting the current patchlevel..." >&4
-if $test -r $rsrc/patchlevel.h;then
-       patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
-       subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
-       apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
-else
-       patchlevel=0
-       subversion=0
-       apiversion=0
-fi
-$echo $n "(You have $package" $c
-case "$package" in
-"*$baserev")   ;;
-*)             $echo $n " $baserev" $c ;;
+       ;;
 esac
-$echo $n " patchlevel $patchlevel" $c
-test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
-echo ".)"
-
-if test 0 -eq "$subversion"; then
-       version=`LC_ALL=C; export LC_ALL; \
-                echo $baserev $patchlevel | \
-                $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
-else
-       version=`LC_ALL=C; export LC_ALL; \
-                echo $baserev $patchlevel $subversion | \
-                $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
-fi
-
-: determine installation style
-: For now, try to deduce it from prefix unless it is already set.
-: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
-case "$installstyle" in
-'')    case "$prefix" in
-               *perl*) dflt='lib';;
-               *) dflt='lib/perl5' ;;
+case "$_a" in
+'')    case "$lib_ext" in
+    '')        _a='.a';;
+       *)      _a="$lib_ext" ;;
        esac
        ;;
-*)     dflt='lib/perl5' ;;
-esac
-: Probably not worth prompting for this since we prompt for all
-: the directories individually, and the prompt would be too long and
-: confusing anyway.
-installstyle=$dflt
-
-: determine where private library files go
-: Usual default is /usr/local/lib/perl5/$version.
-: Also allow things like /opt/perl/lib/$version, since 
-: /opt/perl/lib/perl5... would be redundant.
-: The default "style" setting is made in installstyle.U
-case "$installstyle" in
-*lib/perl5*) set dflt privlib lib/$package/$version ;;
-*)      set dflt privlib lib/$version ;;
 esac
-eval $prefixit
-$cat <<EOM
-
-There are some auxiliary files for $package that need to be put into a
-private library directory that is accessible by everyone.
-
-EOM
-fn=d~+
-rp='Pathname where the private library files will reside?'
-. ./getfile
-privlib="$ans"
-privlibexp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
-else
-       installprivlib="$privlibexp"
-fi
-
-: set the prefixup variable, to restore leading tilda escape
-prefixup='case "$prefixexp" in
-"$prefix") ;;
-*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
-esac'
-
-: determine where public architecture dependent libraries go
-set archlib archlib
-eval $prefixit
-: privlib default is /usr/local/lib/$package/$version
-: archlib default is /usr/local/lib/$package/$version/$archname
-: privlib may have an optional trailing /share.
-tdflt=`echo $privlib | $sed 's,/share$,,'`
-tdflt=$tdflt/$archname
-case "$archlib" in
-'')    dflt=$tdflt
+case "$_o" in
+'') case "$obj_ext" in
+       '')     _o='.o';;
+       *)      _o="$obj_ext";;
+       esac
        ;;
-*)     dflt="$archlib"
-    ;;
 esac
-$cat <<EOM
-
-$spackage contains architecture-dependent library files.  If you are
-sharing libraries in a heterogeneous environment, you might store
-these files in a separate location.  Otherwise, you can just include
-them with the rest of the public library files.
-
-EOM
-fn=d+~
-rp='Where do you want to put the public architecture-dependent libraries?'
-. ./getfile
-archlib="$ans"
-archlibexp="$ansexp"
-if $test X"$archlib" = X"$privlib"; then
-       d_archlib="$undef"
-else
-       d_archlib="$define"
-fi
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
-else
-       installarchlib="$archlibexp"
-fi
-
-
-: Binary compatibility with 5.005 is not possible for builds
-: with advanced features
-case "$usethreads$usemultiplicity" in
-*define*)
-       bincompat5005="$undef"
-       d_bincompat5005="$undef"
-       ;;
-*)     $cat <<EOM
-
-Perl 5.006 can be compiled for binary compatibility with 5.005.
-If you decide to do so, you will be able to continue using most
-of the extensions that were compiled for Perl 5.005.
-
-EOM
-       case "$bincompat5005$d_bincompat5005" in
-       *"$undef"*) dflt=n ;;
-       *) dflt=y ;;
-       esac
-       rp='Binary compatibility with Perl 5.005?'
-       . ./myread
-       case "$ans" in
-       y*) val="$define" ;;
-       *)  val="$undef" ;;
-       esac
-       set d_bincompat5005
-       eval $setvar
-       case "$d_bincompat5005" in
-       "$define")
-               bincompat5005="$define"
-               ;;
-       *)      bincompat5005="$undef"
-               d_bincompat5005="$undef"
-               ;;
+case "$p_" in
+'') case "$path_sep" in
+       '')     p_=':';;
+       *)      p_="$path_sep";;
        esac
        ;;
 esac
+exe_ext=$_exe
+lib_ext=$_a
+obj_ext=$_o
+path_sep=$p_
 
+: Which makefile gets called first.  This is used by make depend.
+case "$firstmakefile" in
+'') firstmakefile='makefile';;
+esac
 
-: see if setuid scripts can be secure
-$cat <<EOM
+cat <<EOM
 
-Some kernels have a bug that prevents setuid #! scripts from being
-secure.  Some sites have disabled setuid #! scripts because of this.
+Perl can be built to use the SOCKS proxy protocol library.  To do so,
+Configure must be run with -Dusesocks.
 
-First let's decide if your kernel supports secure setuid #! scripts.
-(If setuid #! scripts would be secure but have been disabled anyway,
-don't say that they are secure if asked.)
+Normally you do not need this and you should answer no.
 
 EOM
+case "$usesocks" in
+$define|true|[yY]*)    dflt='y';;
+*) dflt='n';;
+esac
+rp='Build Perl for SOCKS?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define" ;;     
+*)      val="$undef" ;;
+esac
+set usesocks
+eval $setvar
 
-val="$undef"
-if $test -d /dev/fd; then
-       echo "#!$ls" >reflect
-       chmod +x,u+s reflect
-       ./reflect >flect 2>&1
-       if $contains "/dev/fd" flect >/dev/null; then
-               echo "Congratulations, your kernel has secure setuid scripts!" >&4
-               val="$define"
-       else
-               $cat <<EOM
-If you are not sure if they are secure, I can check but I'll need a
-username and password different from the one you are using right now.
-If you don't have such a username or don't want me to test, simply
-enter 'none'.
-
-EOM
-               rp='Other username to test security of setuid scripts with?'
-               dflt='none'
-               . ./myread
-               case "$ans" in
-               n|none)
-                       case "$d_suidsafe" in
-                       '')     echo "I'll assume setuid scripts are *not* secure." >&4
-                               dflt=n;;
-                       "$undef")
-                               echo "Well, the $hint value is *not* secure." >&4
-                               dflt=n;;
-                       *)      echo "Well, the $hint value *is* secure." >&4
-                               dflt=y;;
-                       esac
-                       ;;
-               *)
-                       $rm -f reflect flect
-                       echo "#!$ls" >reflect
-                       chmod +x,u+s reflect
-                       echo >flect
-                       chmod a+w flect
-                       echo '"su" will (probably) prompt you for '"$ans's password."
-                       su $ans -c './reflect >flect'
-                       if $contains "/dev/fd" flect >/dev/null; then
-                               echo "Okay, it looks like setuid scripts are secure." >&4
-                               dflt=y
-                       else
-                               echo "I don't think setuid scripts are secure." >&4
-                               dflt=n
-                       fi
-                       ;;
+: Looking for optional libraries
+echo " "
+echo "Checking for optional libraries..." >&4
+case "$libs" in
+' '|'') dflt='';;
+*) dflt="$libs";;
+esac
+case "$libswanted" in
+'') libswanted='c_s';;
+esac
+case "$usesocks" in
+$define)
+       libswanted="$libswanted socks5 socks5_sh"
+       ;;
+esac
+for thislib in $libswanted; do
+       
+       if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
+               $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
+               echo "Found -l$thislib (shared)."
+               case " $dflt " in
+               *"-l$thislib "*);;
+               *) dflt="$dflt -l$thislib";;
                esac
-               rp='Does your kernel have *secure* setuid scripts?'
-               . ./myread
-               case "$ans" in
-               [yY]*)  val="$define";;
-               *)      val="$undef";;
+       elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
+               echo "Found -l$thislib (shared)."
+               case " $dflt " in
+               *"-l$thislib "*);;
+               *) dflt="$dflt -l$thislib";;
+               esac
+       elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
+               echo "Found -l$thislib."
+               case " $dflt " in
+               *"-l$thislib "*);;
+               *) dflt="$dflt -l$thislib";;
+               esac
+       elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
+               echo "Found -l$thislib."
+               case " $dflt " in
+               *"-l$thislib "*);;
+               *) dflt="$dflt -l$thislib";;
+               esac
+       elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
+               echo "Found -l${thislib}_s."
+               case " $dflt " in
+               *"-l$thislib "*);;
+               *) dflt="$dflt -l${thislib}_s";;
+               esac
+       elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
+               echo "Found -l$thislib."
+               case " $dflt " in
+               *"-l$thislib "*);;
+               *) dflt="$dflt -l$thislib";;
                esac
+       else
+               echo "No -l$thislib."
        fi
-else
-       echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
-       echo "(That's for file descriptors, not floppy disks.)"
-       val="$undef"
-fi
-set d_suidsafe
-eval $setvar
-
-$rm -f reflect flect
+done
+set X $dflt
+shift
+dflt="$*"
+case "$libs" in
+'') dflt="$dflt";;
+*) dflt="$libs";;
+esac
+case "$dflt" in
+' '|'') dflt='none';;
+esac
 
-: now see if they want to do setuid emulation
-echo " "
-val="$undef"
-case "$d_suidsafe" in
-"$define")
-       val="$undef"
-       echo "No need to emulate SUID scripts since they are secure here." >& 4
-       ;;
-*)
-       $cat <<EOM
-Some systems have disabled setuid scripts, especially systems where
-setuid scripts cannot be secure.  On systems where setuid scripts have
-been disabled, the setuid/setgid bits on scripts are currently
-useless.  It is possible for $package to detect those bits and emulate
-setuid/setgid in a secure fashion.  This emulation will only work if
-setuid scripts have been disabled in your kernel.
+$cat <<EOM
 
+In order to compile $package on your machine, a number of libraries
+are usually needed.  Include any other special libraries here as well.
+Say "none" for none.  The default list is almost always right.
 EOM
-       case "$d_dosuid" in
-       "$define") dflt=y ;;
-       *) dflt=n ;;
-       esac
-       rp="Do you want to do setuid/setgid emulation?"
-       . ./myread
-       case "$ans" in
-       [yY]*)  val="$define";;
-       *)      val="$undef";;
-       esac
-       ;;
-esac
-set d_dosuid
-eval $setvar
 
-: What should the include directory be ?
 echo " "
-$echo $n "Hmm...  $c"
-dflt='/usr/include'
-incpath=''
-mips_type=''
-if $test -f /bin/mips && /bin/mips; then
-       echo "Looks like a MIPS system..."
-       $cat >usr.c <<'EOCP'
-#ifdef SYSTYPE_BSD43
-/bsd43
-#endif
-EOCP
-       if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
-               dflt='/bsd43/usr/include'
-               incpath='/bsd43'
-               mips_type='BSD 4.3'
-       else
-               mips_type='System V'
-       fi
-       $rm -f usr.c usr.out
-       echo "and you're compiling with the $mips_type compiler and libraries."
-       xxx_prompt=y
-       echo "exit 0" >mips
-else
-       echo "Doesn't look like a MIPS system."
-       xxx_prompt=n
-       echo "exit 1" >mips
-fi
-chmod +x mips
-$eunicefix mips
-case "$usrinc" in
-'') ;;
-*) dflt="$usrinc";;
+rp="What libraries to use?"
+. ./myread
+case "$ans" in
+none) libs=' ';;
+*) libs="$ans";;
 esac
-case "$xxx_prompt" in
-y)     fn=d/
-       echo " "
-       rp='Where are the include files you want to use?'
-       . ./getfile
-       usrinc="$ans"
-       ;;
-*)     usrinc="$dflt"
-       ;;
+
+: determine optimization, if desired, or use for debug flag also
+case "$optimize" in
+' '|$undef) dflt='none';;
+'') dflt='-O';;
+*) dflt="$optimize";;
 esac
+$cat <<EOH
 
-: see how we invoke the C preprocessor
-echo " "
-echo "Now, how can we feed standard input to your C preprocessor..." >&4
-cat <<'EOT' >testcpp.c
-#define ABC abc
-#define XYZ xyz
-ABC.XYZ
-EOT
-cd ..
-if test ! -f cppstdin; then
-       if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
-               # AIX cc -E doesn't show the absolute headerfile
-               # locations but we'll cheat by using the -M flag.
-               echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
-       else
-               echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
-       fi
-else
-       echo "Keeping your $hint cppstdin wrapper."
-fi
-chmod 755 cppstdin
-wrapper=`pwd`/cppstdin
-ok='false'
-cd UU
+By default, $package compiles with the -O flag to use the optimizer.
+Alternately, you might want to use the symbolic debugger, which uses
+the -g flag (on traditional Unix systems).  Either flag can be
+specified here.  To use neither flag, specify the word "none".
 
-if $test "X$cppstdin" != "X" && \
-       $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
-then
-       echo "You used to use $cppstdin $cppminus so we'll use that again."
-       case "$cpprun" in
-       '') echo "But let's see if we can live without a wrapper..." ;;
-       *)
-               if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
-                       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
+EOH
+rp="What optimizer/debugger flag should be used?"
+. ./myread
+optimize="$ans"
+case "$optimize" in
+'none') optimize=" ";;
+esac
+
+dflt=''
+: 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' ;;
+       esac
+       case "$optimize" in
+       *-g*) dflt="$dflt -DDEBUGGING";;
+       esac
+       case "$gccversion" in
+       2*) if test -d /etc/conf/kconfig.d &&
+                       $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
                then
-                       echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
-                       ok='true'
-               else
-                       echo "(However, $cpprun $cpplast does not work, let's see...)"
+                       dflt="$dflt -posix"
                fi
                ;;
        esac
-else
-       case "$cppstdin" in
-       '') ;;
-       *)
-               echo "Good old $cppstdin $cppminus does not seem to be of any help..."
+       case "$gccversion" in
+       1*) ;;
+       2.[0-8]*) ;;
+       ?*)     echo " "
+               echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
+               echo 'int main(void) { return 0; }' > gcctest.c
+               if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
+                       echo "Yes, it does." 2>&1
+                       case "$ccflags" in
+                       *strict-aliasing*) 
+                               echo "Leaving current flags $ccflags alone." 2>&1
+                               ;;
+                       *) dflt="$dflt -fno-strict-aliasing" ;;
+                       esac
+               else
+                       echo "Nope, it doesn't, but that's ok." 2>&1
+               fi
                ;;
        esac
-fi
+       ;;
+esac
 
-if $ok; then
-       : nothing
-elif echo 'Maybe "'"$cc"' -E" will work...'; \
-       $cc -E <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       echo "Yup, it does."
-       x_cpp="$cc -E"
-       x_minus='';
-elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
-       $cc -E - <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       echo "Yup, it does."
-       x_cpp="$cc -E"
-       x_minus='-';
-elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
-       $cc -P <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       echo "Yipee, that works!"
-       x_cpp="$cc -P"
-       x_minus='';
-elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
-       $cc -P - <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       echo "At long last!"
-       x_cpp="$cc -P"
-       x_minus='-';
-elif echo 'No such luck, maybe "'$cpp'" will work...'; \
-       $cpp <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       echo "It works!"
-       x_cpp="$cpp"
-       x_minus='';
-elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
-       $cpp - <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       echo "Hooray, it works!  I was beginning to wonder."
-       x_cpp="$cpp"
-       x_minus='-';
-elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
-       $wrapper <testcpp.c >testcpp.out 2>&1; \
-       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-       x_cpp="$wrapper"
-       x_minus=''
-       echo "Eureka!"
-else
-       dflt=''
-       rp="No dice.  I can't find a C preprocessor.  Name one:"
-       . ./myread
-       x_cpp="$ans"
-       x_minus=''
-       $x_cpp <testcpp.c >testcpp.out 2>&1
-       if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
-               echo "OK, that will do." >&4
-       else
-echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
-               exit 1
+case "$mips_type" in
+*BSD*|'') inclwanted="$locincpth $usrinc";;
+*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
+esac
+for thisincl in $inclwanted; do
+       if $test -d $thisincl; then
+               if $test x$thisincl != x$usrinc; then
+                       case "$dflt" in
+                       *$thisincl*);;
+                       *) dflt="$dflt -I$thisincl";;
+                       esac
+               fi
        fi
-fi
+done
+
+inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
+       xxx=true;
+elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
+       xxx=true;
+else
+       xxx=false;
+fi;
+if $xxx; then
+       case "$dflt" in
+       *$2*);;
+       *) dflt="$dflt -D$2";;
+       esac;
+fi'
+
+set signal.h LANGUAGE_C; eval $inctest
+
+case "$usesocks" in
+$define)
+       ccflags="$ccflags -DSOCKS"
+       ;;
+esac
+
+case "$hint" in
+default|recommended) dflt="$ccflags $dflt" ;;
+*) dflt="$ccflags";;
+esac
+
+case "$dflt" in
+''|' ') dflt=none;;
+esac
+$cat <<EOH
+
+Your C compiler may want other flags.  For this question you should include
+-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
+but you should NOT include libraries or ld flags like -lwhatever.  If you
+want $package to honor its debug switch, you should include -DDEBUGGING here.
+Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
+
+To use no flags, specify the word "none".
+
+EOH
+set X $dflt
+shift
+dflt=${1+"$@"}
+rp="Any additional cc flags?"
+. ./myread
+case "$ans" in
+none) ccflags='';;
+*) ccflags="$ans";;
+esac
 
-case "$ok" in
-false)
-       cppstdin="$x_cpp"
-       cppminus="$x_minus"
-       cpprun="$x_cpp"
-       cpplast="$x_minus"
-       set X $x_cpp
+: the following weeds options from ccflags that are of no interest to cpp
+cppflags="$ccflags"
+case "$gccversion" in
+1*) cppflags="$cppflags -D__GNUC__"
+esac
+case "$mips_type" in
+'');;
+*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
+esac
+case "$cppflags" in
+'');;
+*)
+       echo " "
+       echo "Let me guess what the preprocessor flags are..." >&4
+       set X $cppflags
        shift
-       case "$1" in
-       "$cpp")
-               echo "Perhaps can we force $cc -E using a wrapper..."
-               if $wrapper <testcpp.c >testcpp.out 2>&1; \
-                       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
+       cppflags=''
+       $cat >cpp.c <<'EOM'
+#define BLURFL foo
+
+BLURFL xx LFRULB
+EOM
+       previous=''
+       for flag in $*
+       do
+               case "$flag" in
+               -*) ftry="$flag";;
+               *) ftry="$previous $flag";;
+               esac
+               if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
+                       >cpp1.out 2>/dev/null && \
+                       $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
+                       >cpp2.out 2>/dev/null && \
+                       $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
+                       $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
                then
-                       echo "Yup, we can."
-                       cppstdin="$wrapper"
-                       cppminus='';
+                       cppflags="$cppflags $ftry"
+                       previous=''
                else
-                       echo "Nope, we'll have to live without it..."
+                       previous="$flag"
                fi
-               ;;
-       esac
-       case "$cpprun" in
-       "$wrapper")
-               cpprun=''
-               cpplast=''
-               ;;
+       done
+       set X $cppflags
+       shift
+       cppflags=${1+"$@"}
+       case "$cppflags" in
+       *-*)  echo "They appear to be: $cppflags";;
        esac
+       $rm -f cpp.c cpp?.out
        ;;
 esac
 
-case "$cppstdin" in
-"$wrapper"|'cppstdin') ;;
-*) $rm -f $wrapper;;
+: flags used in final linking phase
+case "$ldflags" in
+'') if ./venix; then
+               dflt='-i -z'
+       else
+               dflt=''
+       fi
+       case "$ccflags" in
+       *-posix*) dflt="$dflt -posix" ;;
+       esac
+       ;;
+*) dflt="$ldflags";;
 esac
-$rm -f testcpp.c testcpp.out
 
-: Set private lib path
-case "$plibpth" in
-'') if ./mips; then
-               plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
-       fi;;
+: Try to guess additional flags to pick up local libraries.
+for thislibdir in $libpth; do
+       case " $loclibpth " in
+       *" $thislibdir "*)
+               case "$dflt " in 
+               *"-L$thislibdir "*) ;;
+               *)  dflt="$dflt -L$thislibdir" ;;
+               esac
+               ;;
+       esac
+done
+
+case "$dflt" in
+'') dflt='none' ;;
 esac
-case "$libpth" in
-' ') dlist='';;
-'') dlist="$loclibpth $plibpth $glibpth";;
-*) dlist="$libpth";;
+
+$cat <<EOH
+
+Your C linker may need flags.  For this question you should
+include -L/whatever and any other flags used by the C linker, but you
+should NOT include libraries like -lwhatever.
+
+Make sure you include the appropriate -L/path flags if your C linker
+does not normally search all of the directories you specified above,
+namely
+       $libpth
+To use no flags, specify the word "none".
+
+EOH
+
+rp="Any additional ld flags (NOT including libraries)?"
+. ./myread
+case "$ans" in
+none) ldflags='';;
+*) ldflags="$ans";;
 esac
+rmlist="$rmlist pdp11"
 
-: Now check and see which directories actually exist, avoiding duplicates
-libpth=''
-for xxx in $dlist
-do
-    if $test -d $xxx; then
-               case " $libpth " in
-               *" $xxx "*) ;;
-               *) libpth="$libpth $xxx";;
+: coherency check
+echo " "
+echo "Checking your choice of C compiler and flags for coherency..." >&4
+$cat > try.c <<'EOF'
+#include <stdio.h>
+int main() { printf("Ok\n"); exit(0); }
+EOF
+set X $cc $optimize $ccflags -o try $ldflags try.c $libs
+shift
+$cat >try.msg <<'EOM'
+I've tried to compile and run the following simple program:
+
+EOM
+$cat try.c >> try.msg
+
+$cat >> try.msg <<EOM
+
+I used the command:
+
+       $*
+       ./try
+
+and I got the following output:
+
+EOM
+dflt=y
+if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
+       if sh -c './try' >>try.msg 2>&1; then
+               xxx=`./try`
+               case "$xxx" in
+               "Ok") dflt=n ;;
+               *)      echo 'The program compiled OK, but produced no output.' >> try.msg
+                       case " $libs " in
+                       *" -lsfio "*)
+                               cat >> try.msg <<'EOQS'
+If $libs contains -lsfio, and sfio is mis-configured, then it
+sometimes (apparently) runs and exits with a 0 status, but with no
+output!  It may have to do with sfio's use of _exit vs. exit.
+
+EOQS
+                               rp="You have a big problem.  Shall I abort Configure"
+                               dflt=y
+                               ;;
+                       esac
+                       ;;
                esac
-    fi
-done
-$cat <<'EOM'
+       else
+               echo "The program compiled OK, but exited with status $?." >>try.msg
+               rp="You have a problem.  Shall I abort Configure"
+               dflt=y
+       fi
+else
+       echo "I can't compile the test program." >>try.msg
+       rp="You have a BIG problem.  Shall I abort Configure"
+       dflt=y
+fi
+case "$dflt" in
+y)
+       $cat try.msg >&4
+       case "$knowitall" in
+       '')
+               echo "(The supplied flags or libraries might be incorrect.)"
+               ;;
+       *) dflt=n;;
+       esac
+       echo " "
+       . ./myread
+       case "$ans" in
+       n*|N*) ;;
+       *)      echo "Ok.  Stopping Configure." >&4
+               exit 1
+               ;;
+       esac
+       ;;
+n) echo "OK, that should do.";;
+esac
+$rm -f try try.* core
 
-Some systems have incompatible or broken versions of libraries.  Among
-the directories listed in the question below, please remove any you
-know not to be holding relevant libraries, and add any that are needed.
-Say "none" for none.
+: define an is-a-typedef? function
+typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
+case "$inclist" in
+"") inclist="sys/types.h";;
+esac;
+eval "varval=\$$var";
+case "$varval" in
+"")
+       $rm -f temp.c;
+       for inc in $inclist; do
+               echo "#include <$inc>" >>temp.c;
+       done;
+       echo "#ifdef $type" >> temp.c;
+       echo "printf(\"We have $type\");" >> temp.c;
+       echo "#endif" >> temp.c;
+       $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
+       if $contains $type temp.E >/dev/null 2>&1; then
+               eval "$var=\$type";
+       else
+               eval "$var=\$def";
+       fi;
+       $rm -f temp.?;;
+*) eval "$var=\$varval";;
+esac'
+
+: define an is-a-typedef? function that prompts if the type is not available.
+typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
+case "$inclist" in
+"") inclist="sys/types.h";;
+esac;
+eval "varval=\$$var";
+case "$varval" in
+"")
+       $rm -f temp.c;
+       for inc in $inclist; do
+               echo "#include <$inc>" >>temp.c;
+       done;
+       echo "#ifdef $type" >> temp.c;
+       echo "printf(\"We have $type\");" >> temp.c;
+       echo "#endif" >> temp.c;
+       $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
+       echo " " ;
+       echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
+       if $contains $type temp.E >/dev/null 2>&1; then
+               echo "$type found." >&4;
+               eval "$var=\$type";
+       else
+               echo "$type NOT found." >&4;
+               dflt="$def";
+               . ./myread ;
+               eval "$var=\$ans";
+       fi;
+       $rm -f temp.?;;
+*) eval "$var=\$varval";;
+esac'
 
-EOM
-case "$libpth" in
-'') dflt='none';;
-*)
-       set X $libpth
-       shift
-       dflt=${1+"$@"}
-       ;;
-esac
-rp="Directories to use for library searches?"
-. ./myread
-case "$ans" in
-none) libpth=' ';;
-*) libpth="$ans";;
-esac
+: define a shorthand compile call
+compile='
+mc_file=$1;
+shift;
+$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
+: define a shorthand compile call for compilations that should be ok.
+compile_ok='
+mc_file=$1;
+shift;
+$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
 
-: compute shared library extension
-case "$so" in
+: check for lengths of integral types
+echo " "
+case "$intsize" in
 '')
-       if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
-               dflt='sl'
+       echo "Checking to see how big your integers are..." >&4
+       $cat >intsize.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+       printf("intsize=%d;\n", (int)sizeof(int));
+       printf("longsize=%d;\n", (int)sizeof(long));
+       printf("shortsize=%d;\n", (int)sizeof(short));
+       exit(0);
+}
+EOCP
+       set intsize
+       if eval $compile_ok && ./intsize > /dev/null; then
+               eval `./intsize`
+               echo "Your integers are $intsize bytes long."
+               echo "Your long integers are $longsize bytes long."
+               echo "Your short integers are $shortsize bytes long."
        else
-               dflt='so'
+               $cat >&4 <<EOM
+!
+Help! I can't compile and run the intsize test program: please enlighten me!
+(This is probably a misconfiguration in your system or libraries, and
+you really ought to fix it.  Still, I'll try anyway.)
+!
+EOM
+               dflt=4
+               rp="What is the size of an integer (in bytes)?"
+               . ./myread
+               intsize="$ans"
+               dflt=$intsize
+               rp="What is the size of a long integer (in bytes)?"
+               . ./myread
+               longsize="$ans"
+               dflt=2
+               rp="What is the size of a short integer (in bytes)?"
+               . ./myread
+               shortsize="$ans"
        fi
        ;;
-*) dflt="$so";;
 esac
-$cat <<EOM
+$rm -f intsize intsize.*
 
-On some systems, shared libraries may be available.  Answer 'none' if
-you want to suppress searching of shared libraries for the remaining
-of this configuration.
+: see what type lseek is declared as in the kernel
+rp="What is the type used for lseek's offset on this system?"
+set off_t lseektype long stdio.h sys/types.h
+eval $typedef_ask
 
-EOM
-rp='What is the file extension used for shared libraries?'
-. ./myread
-so="$ans"
+echo " "
+$echo $n "Checking to see how big your file offsets are...$c" >&4
+$cat >try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof($lseektype));
+    return(0); 
+}
+EOCP
+set try
+if eval $compile_ok; then
+       lseeksize=`./try`
+       $echo " $lseeksize bytes." >&4
+else
+       dflt=$longsize
+       echo " "
+       echo "(I can't seem to compile the test program.  Guessing...)"
+       rp="What is the size of your file offsets (in bytes)?"
+       . ./myread
+       lseeksize="$ans"
+fi
+$rm -f try.c try
 
-: Define several unixisms.
-: Hints files or command line option can be used to override them.
-: The convoluted testing is in case hints files set either the old
-: or the new name.
-case "$_exe" in
-'')    case "$exe_ext" in
-    '')        ;;
-       *)      _exe="$exe_ext" ;;
-       esac
-       ;;
-esac
-case "$_a" in
-'')    case "$lib_ext" in
-    '')        _a='.a';;
-       *)      _a="$lib_ext" ;;
-       esac
-       ;;
-esac
-case "$_o" in
-'') case "$obj_ext" in
-       '')     _o='.o';;
-       *)      _o="$obj_ext";;
-       esac
-       ;;
-esac
-case "$p_" in
-'') case "$path_sep" in
-       '')     p_=':';;
-       *)      p_="$path_sep";;
-       esac
-       ;;
-esac
-exe_ext=$_exe
-lib_ext=$_a
-obj_ext=$_o
-path_sep=$p_
+: see what type file positions are declared as in the library
+rp="What is the type for file position used by fsetpos()?"
+set fpos_t fpostype long stdio.h sys/types.h
+eval $typedef_ask
 
-: Which makefile gets called first.  This is used by make depend.
-case "$firstmakefile" in
-'') firstmakefile='makefile';;
+echo " "
+case "$fpostype" in
+*_t) zzz="$fpostype"   ;;
+*)   zzz="fpos_t"      ;;
 esac
+$echo $n "Checking the size of $zzz...$c" >&4 
+cat > try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+    printf("%d\n", (int)sizeof($fpostype));
+    exit(0);
+}
+EOCP
+set try
+if eval $compile_ok; then
+       yyy=`./try`
+       case "$yyy" in
+       '')     fpossize=4
+               echo " "
+               echo "(I can't execute the test program--guessing $fpossize.)" >&4
+               ;;
+       *)      fpossize=$yyy
+               echo " $fpossize bytes."
+               ;;
+       esac
+else
+       dflt="$longsize"
+       echo " "
+       echo "(I can't compile the test program.  Guessing...)" >&4
+       rp="What is the size of your file positions (in bytes)?"
+       . ./myread
+       fpossize="$ans"
+fi
 
-cat <<EOM
 
-Perl can be built to use the SOCKS proxy protocol library.  To do so,
-Configure must be run with -Dusesocks.
 
-Normally you do not need this and you should answer no.
+case "$lseeksize:$fpossize" in
+8:8) cat <<EOM
 
+You can have files larger than 2 gigabytes.
 EOM
-case "$usesocks" in
-$define|true|[yY]*)    dflt='y';;
-*) dflt='n';;
-esac
-rp='Build Perl for SOCKS?'
-. ./myread
-case "$ans" in
-y|Y)   val="$define" ;;     
-*)      val="$undef" ;;
-esac
-set usesocks
-eval $setvar
+   val="$define" ;;
+*) cat <<EOM
 
-: Looking for optional libraries
-echo " "
-echo "Checking for optional libraries..." >&4
-case "$libs" in
-' '|'') dflt='';;
-*) dflt="$libs";;
-esac
-case "$libswanted" in
-'') libswanted='c_s';;
-esac
-case "$usesocks" in
-$define)
-       libswanted="$libswanted socks5 socks5_sh"
-       ;;
-esac
-for thislib in $libswanted; do
-       
-       if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
-               $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
-               echo "Found -l$thislib (shared)."
-               case " $dflt " in
-               *"-l$thislib "*);;
-               *) dflt="$dflt -l$thislib";;
-               esac
-       elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
-               echo "Found -l$thislib (shared)."
-               case " $dflt " in
-               *"-l$thislib "*);;
-               *) dflt="$dflt -l$thislib";;
-               esac
-       elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
-               echo "Found -l$thislib."
-               case " $dflt " in
-               *"-l$thislib "*);;
-               *) dflt="$dflt -l$thislib";;
-               esac
-       elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
-               echo "Found -l$thislib."
-               case " $dflt " in
-               *"-l$thislib "*);;
-               *) dflt="$dflt -l$thislib";;
-               esac
-       elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
-               echo "Found -l${thislib}_s."
-               case " $dflt " in
-               *"-l$thislib "*);;
-               *) dflt="$dflt -l${thislib}_s";;
-               esac
-       elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
-               echo "Found -l$thislib."
-               case " $dflt " in
-               *"-l$thislib "*);;
-               *) dflt="$dflt -l$thislib";;
+Perl can be built to understand large files (files larger than 2 gigabytes)
+on some systems.  To do so, Configure must be run with -Duselargefiles.
+
+If this doesn't make any sense to you, just accept the default 'y'.
+EOM
+   case "$uselargefiles" in
+   "$undef"|false|[nN]*) dflt='n' ;;
+   *)  dflt='y' ;;
+   esac
+   rp='Try to understand large files, if available?'
+   . ./myread
+   case "$ans" in
+   y|Y)        val="$define" ;;
+   *)          val="$undef"  ;;
+   esac
+   ;;
+esac
+set uselargefiles
+eval $setvar
+case "$uselargefiles" in
+"$define")
+: Look for a hint-file generated 'call-back-unit'.  If the
+: user has specified that a large files perl is to be built,
+: we may need to set or change some other defaults.
+       if $test -f uselfs.cbu; then
+               echo "Your platform has some specific hints for large file builds, using them..."
+               . ./uselfs.cbu
+               echo " "
+               $echo $n "Rechecking to see how big your file offsets are...$c" >&4
+               $cat >try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof($lseektype));
+    return(0); 
+}
+EOCP
+               set try
+               if eval $compile_ok; then
+                       lseeksize=`./try`
+                       $echo " $lseeksize bytes." >&4
+               else
+                       dflt="$lseeksize"
+                       echo " "
+                       echo "(I can't seem to compile the test program.  Guessing...)"
+                       rp="What is the size of your file offsets (in bytes)?"
+                       . ./myread
+                       lseeksize="$ans"
+               fi
+               case "$fpostype" in
+               *_t) zzz="$fpostype"    ;;
+               *)   zzz="fpos_t"       ;;
                esac
-       else
-               echo "No -l$thislib."
+               $echo $n "Rechecking the size of $zzz...$c" >&4 
+               $cat > try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+    printf("%d\n", (int)sizeof($fpostype));
+    exit(0);
+}
+EOCP
+               set try
+               if eval $compile_ok; then
+                       yyy=`./try`
+                       dflt="$lseeksize"
+                       case "$yyy" in
+                       '')     echo " "
+                               echo "(I can't execute the test program--guessing $fpossize.)" >&4
+                               ;;
+                       *)      fpossize=$yyy
+                               echo " $fpossize bytes."
+                               ;;
+                       esac
+               else
+                       dflt="$fpossize"
+                       echo " "
+                       echo "(I can't compile the test program.  Guessing...)" >&4
+                       rp="What is the size of your file positions (in bytes)?"
+                       . ./myread
+                       fpossize="$ans"
+               fi
+               $rm -f try.c try
        fi
-done
-set X $dflt
-shift
-dflt="$*"
-case "$libs" in
-'') dflt="$dflt";;
-*) dflt="$libs";;
+       ;;
 esac
-case "$dflt" in
-' '|'') dflt='none';;
+
+
+case "$usemorebits" in
+"$define"|true|[yY]*)
+       use64bits="$define"
+       uselongdouble="$define"
+       usemorebits="$define"
+       ;;
+*)     usemorebits="$undef"
+       ;;
 esac
 
-$cat <<EOM
 
-In order to compile $package on your machine, a number of libraries
-are usually needed.  Include any other special libraries here as well.
-Say "none" for none.  The default list is almost always right.
+case "$intsize:$longsize" in
+8:*|*:8) cat <<EOM
+
+You have natively 64-bit integers.
 EOM
+   val="$define" ;;
+*) cat <<EOM
 
-echo " "
-rp="What libraries to use?"
-. ./myread
-case "$ans" in
-none) libs=' ';;
-*) libs="$ans";;
+Perl can be built to take advantage of 64-bit integer types
+on some systems.  To do so, Configure must be run with -Duse64bits.
+
+If this doesn't make any sense to you, just accept the default.
+EOM
+  case "$use64bits" in
+  $define|true|[yY]*)  dflt='y';;
+  *) dflt='n';;
+  esac
+  rp='Try to use 64-bit integers, if available?'
+  . ./myread
+  case "$ans" in
+  y|Y) val="$define" ;;
+  *)   val="$undef"  ;;
+  esac
+  ;;
 esac
+set use64bits
+eval $setvar
 
-: determine optimization, if desired, or use for debug flag also
-case "$optimize" in
-' '|$undef) dflt='none';;
-'') dflt='-O';;
-*) dflt="$optimize";;
+case "$archname64" in
+'') archname64='' ;;   # not a typo
 esac
-$cat <<EOH
 
-By default, $package compiles with the -O flag to use the optimizer.
-Alternately, you might want to use the symbolic debugger, which uses
-the -g flag (on traditional Unix systems).  Either flag can be
-specified here.  To use neither flag, specify the word "none".
+case "$use64bits" in
+"$define"|true|[yY]*)
+: Look for a hint-file generated 'call-back-unit'.  If the
+: user has specified that a 64-bit perl is to be built,
+: we may need to set or change some other defaults.
+       if $test -f use64bits.cbu; then
+               echo "Your platform has some specific hints for 64-bit builds, using them..."
+               . ./use64bits.cbu
+       else
+               $cat <<EOM
+(Your platform doesn't have any specific hints for 64-bit builds.)
+EOM
+                case "$intsize:$longsize" in
+8:*|*:8) cat <<EOM
+(This is probably okay, as your system is a natively 64-bit system.)
+EOM
+                  ;;
+                esac
+               case "$gccversion" in
+               '')     ;;
+               *)      case "$ccflags" in
+                       *-DUSE_LONG_LONG*) ;;
+                       *) $cat <<EOM
+But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
+to the compilation flags.
+EOM
+                          ccflags="$ccflags -DUSE_LONG_LONG"
+                          ;;
+                       esac
+                       ;;
+               esac
+       fi
+       ;;
+esac
 
-EOH
-rp="What optimizer/debugger flag should be used?"
+: determine the architecture name
+echo " "
+if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
+       tarch=`arch`"-$osname"
+elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
+       if uname -m > tmparch 2>&1 ; then
+               tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
+                       -e 's/$/'"-$osname/" tmparch`
+       else
+               tarch="$osname"
+       fi
+       $rm -f tmparch
+else
+       tarch="$osname"
+fi
+case "$myarchname" in
+''|"$tarch") ;;
+*)
+       echo "(Your architecture name used to be $myarchname.)"
+       archname=''
+       ;;
+esac
+myarchname="$tarch"
+case "$archname" in
+'') dflt="$tarch";;
+*) dflt="$archname";;
+esac
+rp='What is your architecture name'
 . ./myread
-optimize="$ans"
-case "$optimize" in
-'none') optimize=" ";;
+archname="$ans"
+case "$usethreads" in
+$define)
+       echo "Threads selected." >&4
+       case "$archname" in
+        *-thread*) echo "...and architecture name already has -thread." >&4
+                ;;
+        *)      archname="$archname-thread"
+                echo "...setting architecture name to $archname." >&4
+                ;;
+        esac
+       ;;
 esac
-
-dflt=''
-: 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' ;;
-       esac
-       case "$optimize" in
-       *-g*) dflt="$dflt -DDEBUGGING";;
-       esac
-       case "$gccversion" in
-       2*) if test -d /etc/conf/kconfig.d &&
-                       $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
-               then
-                       dflt="$dflt -posix"
-               fi
+case "$usemultiplicity" in
+$define)
+       echo "Multiplicity selected." >&4
+       case "$archname" in
+        *-multi*) echo "...and architecture name already has -multi." >&4
+                ;;
+        *)      archname="$archname-multi"
+                echo "...setting architecture name to $archname." >&4
+                ;;
+        esac
+       ;;
+esac
+case "$use64bits" in
+$define)
+       case "$archname64" in
+       '')
                ;;
-       esac
-       case "$gccversion" in
-       1*) ;;
-       2.[0-8]*) ;;
-       ?*)     echo " "
-               echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
-               echo 'int main(void) { return 0; }' > gcctest.c
-               if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
-                       echo "Yes, it does." 2>&1
-                       case "$ccflags" in
-                       *strict-aliasing*) 
-                               echo "Leaving current flags $ccflags alone." 2>&1
-                               ;;
-                       *) dflt="$dflt -fno-strict-aliasing" ;;
-                       esac
-               else
-                       echo "Nope, it doesn't, but that's ok." 2>&1
-               fi
+       *)
+               case "$archname" in
+               *-$archname64*) echo "...and architecture name already has $archname64." >&4
+                       ;;
+               *)      archname="$archname-$archname64"
+                       echo "...setting architecture name to $archname." >&4
+                       ;;
+               esac
                ;;
        esac
-       ;;
 esac
 
-case "$mips_type" in
-*BSD*|'') inclwanted="$locincpth $usrinc";;
-*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
+: determine root of directory hierarchy where package will be installed.
+case "$prefix" in
+'')
+       dflt=`./loc . /usr/local /usr/local /local /opt /usr`
+       ;;
+*)
+       dflt="$prefix"
+       ;;
 esac
-for thisincl in $inclwanted; do
-       if $test -d $thisincl; then
-               if $test x$thisincl != x$usrinc; then
-                       case "$dflt" in
-                       *$thisincl*);;
-                       *) dflt="$dflt -I$thisincl";;
-                       esac
-               fi
-       fi
-done
-
-inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
-       xxx=true;
-elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
-       xxx=true;
-else
-       xxx=false;
-fi;
-if $xxx; then
-       case "$dflt" in
-       *$2*);;
-       *) dflt="$dflt -D$2";;
-       esac;
-fi'
+$cat <<EOM
 
-set signal.h LANGUAGE_C; eval $inctest
+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.
 
-case "$usesocks" in
-$define)
-       ccflags="$ccflags -DSOCKS"
+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 "$hint" in
-default|recommended) dflt="$ccflags $dflt" ;;
-*) dflt="$ccflags";;
-esac
-
-case "$dflt" in
-''|' ') dflt=none;;
+: is AFS running?
+echo " "
+case "$afs" in
+$define|true)  afs=true ;;
+$undef|false)  afs=false ;;
+*)     if test -d /afs; then
+               afs=true
+       else
+               afs=false
+       fi
+       ;;
 esac
-$cat <<EOH
+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
 
-Your C compiler may want other flags.  For this question you should include
--I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
-but you should NOT include libraries or ld flags like -lwhatever.  If you
-want $package to honor its debug switch, you should include -DDEBUGGING here.
-Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
+: determine installation prefix for where package is to be installed.
+if $afs; then 
+$cat <<EOM
 
-To use no flags, specify the word "none".
+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).
 
-EOH
-set X $dflt
-shift
-dflt=${1+"$@"}
-rp="Any additional cc flags?"
-. ./myread
-case "$ans" in
-none) ccflags='';;
-*) ccflags="$ans";;
-esac
+EOM
+       case "$installprefix" in
+       '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
+       *) dflt="$installprefix";;
+       esac
+else
+$cat <<EOM
 
-: the following weeds options from ccflags that are of no interest to cpp
-cppflags="$ccflags"
-case "$gccversion" in
-1*) cppflags="$cppflags -D__GNUC__"
-esac
-case "$mips_type" in
-'');;
-*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
-esac
-case "$cppflags" in
-'');;
-*)
-       echo " "
-       echo "Let me guess what the preprocessor flags are..." >&4
-       set X $cppflags
-       shift
-       cppflags=''
-       $cat >cpp.c <<'EOM'
-#define BLURFL foo
+In some special cases, particularly when building $package for distribution,
+it is convenient to distinguish between the directory in which files should 
+be installed from the directory ($prefix) in which they 
+will eventually reside.  For most users, these two directories are the same.
 
-BLURFL xx LFRULB
 EOM
-       previous=''
-       for flag in $*
-       do
-               case "$flag" in
-               -*) ftry="$flag";;
-               *) ftry="$previous $flag";;
-               esac
-               if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
-                       >cpp1.out 2>/dev/null && \
-                       $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
-                       >cpp2.out 2>/dev/null && \
-                       $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
-                       $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
-               then
-                       cppflags="$cppflags $ftry"
-                       previous=''
-               else
-                       previous="$flag"
-               fi
-       done
-       set X $cppflags
-       shift
-       cppflags=${1+"$@"}
-       case "$cppflags" in
-       *-*)  echo "They appear to be: $cppflags";;
+       case "$installprefix" in
+       '') dflt=$prefix ;;
+       *) dflt=$installprefix;;
        esac
-       $rm -f cpp.c cpp?.out
-       ;;
+fi
+fn=d~
+rp='What installation prefix should I use for installing files?'
+. ./getfile
+installprefix="$ans"
+installprefixexp="$ansexp"
+
+: set the prefixit variable, to compute a suitable default value
+prefixit='case "$3" in
+""|none)
+       case "$oldprefix" in
+       "") eval "$1=\"\$$2\"";;
+       *)
+               case "$3" in
+               "") eval "$1=";;
+               none)
+                       eval "tp=\"\$$2\"";
+                       case "$tp" in
+                       ""|" ") eval "$1=\"\$$2\"";;
+                       *) eval "$1=";;
+                       esac;;
+               esac;;
+       esac;;
+*)
+       eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
+       case "$tp" in
+       --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
+       /*-$oldprefix/*|\~*-$oldprefix/*)
+               eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
+       *) eval "$1=\"\$$2\"";;
+       esac;;
+esac'
+
+: set the base revision
+baserev=5.0
+
+: get the patchlevel
+echo " "
+echo "Getting the current patchlevel..." >&4
+if $test -r $rsrc/patchlevel.h;then
+       patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
+       subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
+       apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
+else
+       patchlevel=0
+       subversion=0
+       apiversion=0
+fi
+$echo $n "(You have $package" $c
+case "$package" in
+"*$baserev")   ;;
+*)             $echo $n " $baserev" $c ;;
 esac
+$echo $n " patchlevel $patchlevel" $c
+test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
+echo ".)"
 
-: flags used in final linking phase
-case "$ldflags" in
-'') if ./venix; then
-               dflt='-i -z'
-       else
-               dflt=''
-       fi
-       case "$ccflags" in
-       *-posix*) dflt="$dflt -posix" ;;
+if test 0 -eq "$subversion"; then
+       version=`LC_ALL=C; export LC_ALL; \
+                echo $baserev $patchlevel | \
+                $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
+else
+       version=`LC_ALL=C; export LC_ALL; \
+                echo $baserev $patchlevel $subversion | \
+                $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
+fi
+
+: determine installation style
+: For now, try to deduce it from prefix unless it is already set.
+: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
+case "$installstyle" in
+'')    case "$prefix" in
+               *perl*) dflt='lib';;
+               *) dflt='lib/perl5' ;;
        esac
        ;;
-*) dflt="$ldflags";;
+*)     dflt='lib/perl5' ;;
 esac
+: Probably not worth prompting for this since we prompt for all
+: the directories individually, and the prompt would be too long and
+: confusing anyway.
+installstyle=$dflt
 
-: Try to guess additional flags to pick up local libraries.
-for thislibdir in $libpth; do
-       case " $loclibpth " in
-       *" $thislibdir "*)
-               case "$dflt " in 
-               *"-L$thislibdir "*) ;;
-               *)  dflt="$dflt -L$thislibdir" ;;
-               esac
-               ;;
-       esac
-done
+: determine where private library files go
+: Usual default is /usr/local/lib/perl5/$version.
+: Also allow things like /opt/perl/lib/$version, since 
+: /opt/perl/lib/perl5... would be redundant.
+: The default "style" setting is made in installstyle.U
+case "$installstyle" in
+*lib/perl5*) set dflt privlib lib/$package/$version ;;
+*)      set dflt privlib lib/$version ;;
+esac
+eval $prefixit
+$cat <<EOM
+
+There are some auxiliary files for $package that need to be put into a
+private library directory that is accessible by everyone.
+
+EOM
+fn=d~+
+rp='Pathname where the private library files will reside?'
+. ./getfile
+privlib="$ans"
+privlibexp="$ansexp"
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
+else
+       installprivlib="$privlibexp"
+fi
+
+: set the prefixup variable, to restore leading tilda escape
+prefixup='case "$prefixexp" in
+"$prefix") ;;
+*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
+esac'
 
-case "$dflt" in
-'') dflt='none' ;;
+: determine where public architecture dependent libraries go
+set archlib archlib
+eval $prefixit
+: privlib default is /usr/local/lib/$package/$version
+: archlib default is /usr/local/lib/$package/$version/$archname
+: privlib may have an optional trailing /share.
+tdflt=`echo $privlib | $sed 's,/share$,,'`
+tdflt=$tdflt/$archname
+case "$archlib" in
+'')    dflt=$tdflt
+       ;;
+*)     dflt="$archlib"
+    ;;
 esac
+$cat <<EOM
 
-$cat <<EOH
-
-Your C linker may need flags.  For this question you should
-include -L/whatever and any other flags used by the C linker, but you
-should NOT include libraries like -lwhatever.
+$spackage contains architecture-dependent library files.  If you are
+sharing libraries in a heterogeneous environment, you might store
+these files in a separate location.  Otherwise, you can just include
+them with the rest of the public library files.
 
-Make sure you include the appropriate -L/path flags if your C linker
-does not normally search all of the directories you specified above,
-namely
-       $libpth
-To use no flags, specify the word "none".
+EOM
+fn=d+~
+rp='Where do you want to put the public architecture-dependent libraries?'
+. ./getfile
+archlib="$ans"
+archlibexp="$ansexp"
+if $test X"$archlib" = X"$privlib"; then
+       d_archlib="$undef"
+else
+       d_archlib="$define"
+fi
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
+else
+       installarchlib="$archlibexp"
+fi
 
-EOH
 
-rp="Any additional ld flags (NOT including libraries)?"
-. ./myread
-case "$ans" in
-none) ldflags='';;
-*) ldflags="$ans";;
-esac
-rmlist="$rmlist pdp11"
+: Binary compatibility with 5.005 is not possible for builds
+: with advanced features
+case "$usethreads$usemultiplicity" in
+*define*)
+       bincompat5005="$undef"
+       d_bincompat5005="$undef"
+       ;;
+*)     $cat <<EOM
 
-: coherency check
-echo " "
-echo "Checking your choice of C compiler and flags for coherency..." >&4
-$cat > try.c <<'EOF'
-#include <stdio.h>
-int main() { printf("Ok\n"); exit(0); }
-EOF
-set X $cc $optimize $ccflags -o try $ldflags try.c $libs
-shift
-$cat >try.msg <<'EOM'
-I've tried to compile and run the following simple program:
+Perl 5.006 can be compiled for binary compatibility with 5.005.
+If you decide to do so, you will be able to continue using most
+of the extensions that were compiled for Perl 5.005.
 
 EOM
-$cat try.c >> try.msg
+       case "$bincompat5005$d_bincompat5005" in
+       *"$undef"*) dflt=n ;;
+       *) dflt=y ;;
+       esac
+       rp='Binary compatibility with Perl 5.005?'
+       . ./myread
+       case "$ans" in
+       y*) val="$define" ;;
+       *)  val="$undef" ;;
+       esac
+       set d_bincompat5005
+       eval $setvar
+       case "$d_bincompat5005" in
+       "$define")
+               bincompat5005="$define"
+               ;;
+       *)      bincompat5005="$undef"
+               d_bincompat5005="$undef"
+               ;;
+       esac
+       ;;
+esac
 
-$cat >> try.msg <<EOM
 
-I used the command:
+: see if setuid scripts can be secure
+$cat <<EOM
 
-       $*
-       ./try
+Some kernels have a bug that prevents setuid #! scripts from being
+secure.  Some sites have disabled setuid #! scripts because of this.
 
-and I got the following output:
+First let's decide if your kernel supports secure setuid #! scripts.
+(If setuid #! scripts would be secure but have been disabled anyway,
+don't say that they are secure if asked.)
 
 EOM
-dflt=y
-if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
-       if sh -c './try' >>try.msg 2>&1; then
-               xxx=`./try`
-               case "$xxx" in
-               "Ok") dflt=n ;;
-               *)      echo 'The program compiled OK, but produced no output.' >> try.msg
-                       case " $libs " in
-                       *" -lsfio "*)
-                               cat >> try.msg <<'EOQS'
-If $libs contains -lsfio, and sfio is mis-configured, then it
-sometimes (apparently) runs and exits with a 0 status, but with no
-output!  It may have to do with sfio's use of _exit vs. exit.
 
-EOQS
-                               rp="You have a big problem.  Shall I abort Configure"
-                               dflt=y
-                               ;;
+val="$undef"
+if $test -d /dev/fd; then
+       echo "#!$ls" >reflect
+       chmod +x,u+s reflect
+       ./reflect >flect 2>&1
+       if $contains "/dev/fd" flect >/dev/null; then
+               echo "Congratulations, your kernel has secure setuid scripts!" >&4
+               val="$define"
+       else
+               $cat <<EOM
+If you are not sure if they are secure, I can check but I'll need a
+username and password different from the one you are using right now.
+If you don't have such a username or don't want me to test, simply
+enter 'none'.
+
+EOM
+               rp='Other username to test security of setuid scripts with?'
+               dflt='none'
+               . ./myread
+               case "$ans" in
+               n|none)
+                       case "$d_suidsafe" in
+                       '')     echo "I'll assume setuid scripts are *not* secure." >&4
+                               dflt=n;;
+                       "$undef")
+                               echo "Well, the $hint value is *not* secure." >&4
+                               dflt=n;;
+                       *)      echo "Well, the $hint value *is* secure." >&4
+                               dflt=y;;
                        esac
                        ;;
+               *)
+                       $rm -f reflect flect
+                       echo "#!$ls" >reflect
+                       chmod +x,u+s reflect
+                       echo >flect
+                       chmod a+w flect
+                       echo '"su" will (probably) prompt you for '"$ans's password."
+                       su $ans -c './reflect >flect'
+                       if $contains "/dev/fd" flect >/dev/null; then
+                               echo "Okay, it looks like setuid scripts are secure." >&4
+                               dflt=y
+                       else
+                               echo "I don't think setuid scripts are secure." >&4
+                               dflt=n
+                       fi
+                       ;;
+               esac
+               rp='Does your kernel have *secure* setuid scripts?'
+               . ./myread
+               case "$ans" in
+               [yY]*)  val="$define";;
+               *)      val="$undef";;
                esac
-       else
-               echo "The program compiled OK, but exited with status $?." >>try.msg
-               rp="You have a problem.  Shall I abort Configure"
-               dflt=y
        fi
 else
-       echo "I can't compile the test program." >>try.msg
-       rp="You have a BIG problem.  Shall I abort Configure"
-       dflt=y
+       echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
+       echo "(That's for file descriptors, not floppy disks.)"
+       val="$undef"
 fi
-case "$dflt" in
-y)
-       $cat try.msg >&4
-       case "$knowitall" in
-       '')
-               echo "(The supplied flags or libraries might be incorrect.)"
-               ;;
-       *) dflt=n;;
+set d_suidsafe
+eval $setvar
+
+$rm -f reflect flect
+
+: now see if they want to do setuid emulation
+echo " "
+val="$undef"
+case "$d_suidsafe" in
+"$define")
+       val="$undef"
+       echo "No need to emulate SUID scripts since they are secure here." >& 4
+       ;;
+*)
+       $cat <<EOM
+Some systems have disabled setuid scripts, especially systems where
+setuid scripts cannot be secure.  On systems where setuid scripts have
+been disabled, the setuid/setgid bits on scripts are currently
+useless.  It is possible for $package to detect those bits and emulate
+setuid/setgid in a secure fashion.  This emulation will only work if
+setuid scripts have been disabled in your kernel.
+
+EOM
+       case "$d_dosuid" in
+       "$define") dflt=y ;;
+       *) dflt=n ;;
        esac
-       echo " "
+       rp="Do you want to do setuid/setgid emulation?"
        . ./myread
        case "$ans" in
-       n*|N*) ;;
-       *)      echo "Ok.  Stopping Configure." >&4
-               exit 1
-               ;;
+       [yY]*)  val="$define";;
+       *)      val="$undef";;
        esac
        ;;
-n) echo "OK, that should do.";;
 esac
-$rm -f try try.* core
+set d_dosuid
+eval $setvar
 
 : determine filename position in cpp output
 echo " "
@@ -4903,25 +5206,14 @@ EOM
        rp="Do you want to install perl as /usr/bin/perl?"
        . ./myread
        case "$ans" in
-       [yY]*)  val="$define";;
-       *)      val="$undef" ;;
-       esac
-else
-       val="$undef"
-fi
-set installusrbinperl
-eval $setvar
-
-: define a shorthand compile call
-compile='
-mc_file=$1;
-shift;
-$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
-: define a shorthand compile call for compilations that should be ok.
-compile_ok='
-mc_file=$1;
-shift;
-$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
+       [yY]*)  val="$define";;
+       *)      val="$undef" ;;
+       esac
+else
+       val="$undef"
+fi
+set installusrbinperl
+eval $setvar
 
 echo " "
 echo "Checking for GNU C Library..." >&4
@@ -6086,13 +6378,13 @@ if $test -d /usr/etc/yp || $test -d /etc/yp; then
        esac
 fi
 case "$hostcat" in
-'') hostcat='cat /etc/hosts';;
+'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
 esac
 case "$groupcat" in
-'') groupcat='cat /etc/group';;
+'') test -f /etc/group && groupcat='cat /etc/group';;
 esac
 case "$passcat" in
-'') passcat='cat /etc/passwd';;
+'') test -f /etc/passwd && passcat='cat /etc/passwd';;
 esac
 
 : now get the host name
@@ -6194,6 +6486,7 @@ case "$myhostname" in
                                $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
                        $test -s hosts
                } || {
+                       test "X$hostcat" != "X" &&
                        $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
                                        /[       ]$myhostname[  . ]/p" > hosts
                }
@@ -6486,7 +6779,7 @@ siteprefixexp="$ansexp"
 : XXX No longer works with Prefixit stuff.
 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
 case "$installstyle" in
-*lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
+*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog ;;
 *)      dflt=$siteprefix/lib/site_$prog ;;
 esac
 $cat <<EOM
@@ -6559,11 +6852,15 @@ fi
 cat <<EOM
 
 Perl can be built to take advantage of long doubles which
-(if available) may give more accuracy and range for floating point
-numbers.  To do so, Configure must be run with -Duselongdouble.
+(if available) may give more accuracy and range for floating point numbers.
 
 If this doesn't make any sense to you, just accept the default 'n'.
 EOM
+
+case "$ccflags" in
+*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
+esac
+
 case "$uselongdouble" in
 $define|true|[yY]*)    dflt='y';;
 *) dflt='n';;
@@ -6578,7 +6875,11 @@ set uselongdouble
 eval $setvar
 
 case "$uselongdouble" in
-"$define"|true|[yY]*)
+true|[yY]*) uselongdouble="$define" ;;
+esac
+
+case "$uselongdouble" in
+$define)
 : Look for a hint-file generated 'call-back-unit'.  If the
 : user has specified that long doubles should be used,
 : we may need to set or change some other defaults.
@@ -6595,452 +6896,194 @@ esac
 
 cat <<EOM
 
-Previous version of $package used the standard IO mechanisms as defined
-in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
-mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
-the default.  This 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.  Using PerlIO with stdio is safe,
-but it is slower than plain stdio and therefore is not the default.
+Perl can be built to take advantage of long longs which
+(if available) may give more range for integer numbers.
 
 If this doesn't make any sense to you, just accept the default 'n'.
 EOM
-case "$useperlio" in
+
+case "$ccflags" in
+*-DUSE_LONG_LONG*) uselonglong="$define" ;;
+esac
+
+case "$uselonglong" in
 $define|true|[yY]*)    dflt='y';;
 *) dflt='n';;
 esac
-rp='Use the experimental PerlIO abstraction layer?'
+rp='Try to use long longs if available?'
 . ./myread
 case "$ans" in
-y|Y) 
-       val="$define"
-       ;;     
-*)      
-       echo "Ok, doing things the stdio way"
-       val="$undef"
-       ;;
-esac
-set useperlio
-eval $setvar 
-
-case "$vendorprefix" in
-'')    d_vendorbin="$undef"
-       vendorbin=''
-       vendorbinexp=''
-       ;;
-*)     d_vendorbin="$define"
-       : determine where vendor-supplied executables go.
-       dflt=$vendorprefix/bin
-       fn=d~+
-       rp='Pathname for the vendor-supplied executables directory?'
-       . ./getfile
-       vendorbin="$ans"
-       vendorbinexp="$ansexp"
-       : Change installation prefix, if necessary.
-       if $test X"$prefix" != X"$installprefix"; then
-               installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
-       else
-               installvendorbin="$vendorbinexp"
-       fi
-       ;;
+y|Y)   val="$define"   ;;
+*)      val="$undef"   ;;
 esac
-
-: Check how to convert floats to strings.
-if test "X$d_Gconvert" = X; then
-       echo " "
-       echo "Checking for an efficient way to convert floats to strings."
-       $cat >try.c <<'EOP'
-#ifdef TRY_gconvert
-#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
-char *myname = "gconvert";
-#endif
-#ifdef TRY_gcvt
-#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
-char *myname = "gcvt";
-#endif
-#ifdef TRY_sprintf
-#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
-char *myname = "sprintf";
-#endif
-
-#include <stdio.h>
-
-int
-checkit(expect, got)
-char *expect;
-char *got;
-{
-    if (strcmp(expect, got)) {
-               printf("%s oddity:  Expected %s, got %s\n",
-                       myname, expect, got);
-               exit(1);
-       }
-}
-
-int main()
-{ 
-       char buf[64]; 
-       buf[63] = '\0';
-
-       /* This must be 1st test on (which?) platform */
-       /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
-       Gconvert(0.1, 8, 0, buf);
-       checkit("0.1", buf);
-
-       Gconvert(1.0, 8, 0, buf); 
-       checkit("1", buf);
-
-       Gconvert(0.0, 8, 0, buf); 
-       checkit("0", buf);
-
-       Gconvert(-1.0, 8, 0, buf); 
-       checkit("-1", buf);
-
-       /* Some Linux gcvt's give 1.e+5 here. */
-       Gconvert(100000.0, 8, 0, buf); 
-       checkit("100000", buf);
-       
-       /* Some Linux gcvt's give -1.e+5 here. */
-       Gconvert(-100000.0, 8, 0, buf); 
-       checkit("-100000", buf);
-
-       exit(0);
-}
-EOP
-       case "$d_Gconvert" in
-       gconvert*) xxx_list='gconvert gcvt sprintf' ;;
-       gcvt*) xxx_list='gcvt gconvert sprintf' ;;
-       sprintf*) xxx_list='sprintf gconvert gcvt' ;;
-       *) xxx_list='gconvert gcvt sprintf' ;;
-       esac
-
-       for xxx_convert in $xxx_list; do
-               echo "Trying $xxx_convert"
-               $rm -f try try$_o
-               set try -DTRY_$xxx_convert
-               if eval $compile; then
-                       echo "$xxx_convert" found. >&4
-                       if ./try; then
-                               echo "I'll use $xxx_convert to convert floats into a string." >&4
-                               break;
-                       else
-                               echo "...But $xxx_convert didn't work as I expected."
-                       fi
-               else
-                       echo "$xxx_convert NOT found." >&4
-               fi
-       done
-               
-       case "$xxx_convert" in
-       gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
-       gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
-       *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
-       esac
-fi
-
-: see if inttypes.h is available
-: we want a real compile instead of Inhdr because some systems
-: have an inttypes.h which includes non-existent headers
-echo " "
-$cat >try.c <<EOCP
-#include <inttypes.h>
-int main() {
-       static int32_t foo32 = 0x12345678;
-}
-EOCP
-set try
-if eval $compile; then
-       echo "<inttypes.h> found." >&4
-       val="$define"
-else
-       echo "<inttypes.h> NOT found." >&4
-       val="$undef"
-fi
-$rm -f try.c try
-set i_inttypes
+set uselonglong
 eval $setvar
 
-: check for int64_t
-case "$use64bits" in
-"$define" )
-       echo " "
-       $echo $n "Checking to see if your system supports int64_t...$c" >&4
-       $cat >try.c <<EOCP
-#include <sys/types.h>
-#$i_inttypes I_INTTYPES
-#ifdef I_INTTYPES
-#include <inttypes.h>
-#endif
-int64_t foo() { int64_t x; x = 7; return x; }
-EOCP
-       if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
-               val="$define"
-               echo " Yup, it does." >&4
-       else
-               val="$undef"
-               echo " Nope, it doesn't." >&4
-       fi
-       $rm -f try.*
-       ;;
-*)     val="$undef"
-       ;;
+case "$uselonglong" in
+true|[yY]*) uselonglong="$define" ;;
 esac
-set d_int64t
-eval $setvar
-
 
-: check for lengths of integral types
-echo " "
-case "$intsize" in
-'')
-       echo "Checking to see how big your integers are..." >&4
-       $cat >intsize.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-       printf("intsize=%d;\n", sizeof(int));
-       printf("longsize=%d;\n", sizeof(long));
-       printf("shortsize=%d;\n", sizeof(short));
-       exit(0);
-}
-EOCP
-       set intsize
-       if eval $compile_ok && ./intsize > /dev/null; then
-               eval `./intsize`
-               echo "Your integers are $intsize bytes long."
-               echo "Your long integers are $longsize bytes long."
-               echo "Your short integers are $shortsize bytes long."
+case "$uselonglong" in
+$define)
+: Look for a hint-file generated 'call-back-unit'.  If the
+: user has specified that long longs should be used,
+: we may need to set or change some other defaults.
+       if $test -f uselonglong.cbu; then
+               echo "Your platform has some specific hints for long longs, using them..."
+               . ./uselonglong.cbu
        else
-               $cat >&4 <<EOM
-!
-Help! I can't compile and run the intsize test program: please enlighten me!
-(This is probably a misconfiguration in your system or libraries, and
-you really ought to fix it.  Still, I'll try anyway.)
-!
+               $cat <<EOM
+(Your platform doesn't have any specific hints for long longs.)
 EOM
-               dflt=4
-               rp="What is the size of an integer (in bytes)?"
-               . ./myread
-               intsize="$ans"
-               dflt=$intsize
-               rp="What is the size of a long integer (in bytes)?"
-               . ./myread
-               longsize="$ans"
-               dflt=2
-               rp="What is the size of a short integer (in bytes)?"
-               . ./myread
-               shortsize="$ans"
        fi
        ;;
 esac
-$rm -f intsize intsize.*
 
-: check for long long
-echo " "
-$echo $n "Checking to see if your system supports long long...$c" >&4
-echo 'long long foo() { long long x; x = 7; return x; }' > try.c
-if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
+cat <<EOM
+
+Previous version of $package used the standard IO mechanisms as defined
+in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
+mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
+the default.  This 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.  Using PerlIO with stdio is safe,
+but it is slower than plain stdio and therefore is not the default.
+
+If this doesn't make any sense to you, just accept the default 'n'.
+EOM
+case "$useperlio" in
+$define|true|[yY]*)    dflt='y';;
+*) dflt='n';;
+esac
+rp='Use the experimental PerlIO abstraction layer?'
+. ./myread
+case "$ans" in
+y|Y) 
        val="$define"
-       echo " Yup, it does." >&4
-else
+       ;;     
+*)      
+       echo "Ok, doing things the stdio way"
        val="$undef"
-       echo " Nope, it doesn't." >&4
-fi
-$rm try.*
-set d_longlong
-eval $setvar
+       ;;
+esac
+set useperlio
+eval $setvar 
 
-: check for length of long long
-case "${d_longlong}${longlongsize}" in
-$define)
-       echo " "
-       $echo $n "Checking to see how big your long longs are...$c" >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-       printf("%d\n", sizeof(long long));
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               longlongsize=`./try`
-               $echo " $longlongsize bytes." >&4
+case "$vendorprefix" in
+'')    d_vendorbin="$undef"
+       vendorbin=''
+       vendorbinexp=''
+       ;;
+*)     d_vendorbin="$define"
+       : determine where vendor-supplied executables go.
+       dflt=$vendorprefix/bin
+       fn=d~+
+       rp='Pathname for the vendor-supplied executables directory?'
+       . ./getfile
+       vendorbin="$ans"
+       vendorbinexp="$ansexp"
+       : Change installation prefix, if necessary.
+       if $test X"$prefix" != X"$installprefix"; then
+               installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
        else
-               dflt='8'
-               echo " "
-               echo "(I can't seem to compile the test program.  Guessing...)"
-               rp="What is the size of a long long (in bytes)?"
-               . ./myread
-               longlongsize="$ans"
+               installvendorbin="$vendorbinexp"
        fi
-       if $test "X$longsize" = "X$longlongsize"; then
-               echo "(That isn't any different from an ordinary long.)"
-       fi      
        ;;
 esac
-$rm -f try.c try
-
-echo " "
-
-if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
 
-echo "Checking how to print 64-bit integers..." >&4
+: Check how to convert floats to strings.
+if test "X$d_Gconvert" = X; then
+       echo " "
+       echo "Checking for an efficient way to convert floats to strings."
+       $cat >try.c <<'EOP'
+#ifdef TRY_gconvert
+#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
+char *myname = "gconvert";
+#endif
+#ifdef TRY_gcvt
+#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
+char *myname = "gcvt";
+#endif
+#ifdef TRY_sprintf
+#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
+char *myname = "sprintf";
+#endif
 
-if $test X"$sPRId64" = X -a X"$intsize" = X8; then
-        quad=int
-       $cat >try.c <<'EOCP'
-#include <sys/types.h>
 #include <stdio.h>
-int main() {
-  int q = 12345678901;
-  printf("%ld\n", q);
-}
-EOCP
-       set try
-       if eval $compile; then
-               yyy=`./try$exe_ext`
-               case "$yyy" in
-               12345678901)
-                       sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
-                       sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
-                       echo "We will use %d."
-                       ;;
-               esac
-       fi
-fi
 
-if $test X"$sPRId64" = X -a X"$longsize" = X8; then
-        quad=long
-       $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
-  long q = 12345678901;
-  printf("%ld\n", q);
+int
+checkit(expect, got)
+char *expect;
+char *got;
+{
+    if (strcmp(expect, got)) {
+               printf("%s oddity:  Expected %s, got %s\n",
+                       myname, expect, got);
+               exit(1);
+       }
 }
-EOCP
-       set try
-       if eval $compile; then
-               yyy=`./try$exe_ext`
-               case "$yyy" in
-               12345678901)
-                       sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
-                       sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
-                       echo "We will use %ld."
-                       ;;
-               esac
-       fi
-fi
 
-if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
-        quad=int64_t
-       $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <inttypes.h>
-#include <stdio.h>
-int main() {
-  int64_t q = 12345678901;
-  printf("%" PRId64 "\n", q);
-}
-EOCP
-       set try
-       if eval $compile; then
-               yyy=`./try$exe_ext`
-               case "$yyy" in
-               12345678901)
-                       sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
-                       sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
-                       echo "We will use the C9X style."
-                       ;;
-               esac
-       fi
-fi
+int main()
+{ 
+       char buf[64]; 
+       buf[63] = '\0';
 
-if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
-        quad="long long"
-       $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
-  long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
-  printf("%lld\n", q);
-}
-EOCP
-       set try
-       if eval $compile; then
-               yyy=`./try$exe_ext`
-               case "$yyy" in
-               12345678901)
-                       sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
-                       sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
-                       echo "We will use the %lld style."
-                       ;;
-               esac
-       fi
-fi
+       /* This must be 1st test on (which?) platform */
+       /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
+       Gconvert(0.1, 8, 0, buf);
+       checkit("0.1", buf);
 
-if $test X"$sPRId64" = X -a X"$quad" != X; then
-       $cat >try.c <<EOCP
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
-  $quad q = 12345678901;
-  printf("%Ld\n", q);
-}
-EOCP
-       set try
-       if eval $compile; then
-               yyy=`./try$exe_ext`
-               case "$yyy" in
-               12345678901)
-                       sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
-                       sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
-                       echo "We will use %lld."
-                       ;;
-               esac
-       fi
-fi
+       Gconvert(1.0, 8, 0, buf); 
+       checkit("1", buf);
 
-if $test X"$sPRId64" = X -a X"$quad" != X; then
-       $cat >try.c <<EOCP
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
-  $quad q = 12345678901;
-  printf("%qd\n", q);
+       Gconvert(0.0, 8, 0, buf); 
+       checkit("0", buf);
+
+       Gconvert(-1.0, 8, 0, buf); 
+       checkit("-1", buf);
+
+       /* Some Linux gcvt's give 1.e+5 here. */
+       Gconvert(100000.0, 8, 0, buf); 
+       checkit("100000", buf);
+       
+       /* Some Linux gcvt's give -1.e+5 here. */
+       Gconvert(-100000.0, 8, 0, buf); 
+       checkit("-100000", buf);
+
+       exit(0);
 }
-EOCP
-       set try
-       if eval $compile; then
-               yyy=`./try$exe_ext`
-               case "$yyy" in
-               12345678901)
-                       sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
-                       sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
-                       echo "We will use %qd."
-                       ;;
-               esac
-       fi
-fi
+EOP
+       case "$d_Gconvert" in
+       gconvert*) xxx_list='gconvert gcvt sprintf' ;;
+       gcvt*) xxx_list='gcvt gconvert sprintf' ;;
+       sprintf*) xxx_list='sprintf gconvert gcvt' ;;
+       *) xxx_list='gconvert gcvt sprintf' ;;
+       esac
 
-if $test X"$sPRId64" = X; then
-       echo "Cannot figure out how to print 64-bit integers." >&4
+       for xxx_convert in $xxx_list; do
+               echo "Trying $xxx_convert"
+               $rm -f try try$_o
+               set try -DTRY_$xxx_convert
+               if eval $compile; then
+                       echo "$xxx_convert" found. >&4
+                       if ./try; then
+                               echo "I'll use $xxx_convert to convert floats into a string." >&4
+                               break;
+                       else
+                               echo "...But $xxx_convert didn't work as I expected."
+                       fi
+               else
+                       echo "$xxx_convert NOT found." >&4
+               fi
+       done
+               
+       case "$xxx_convert" in
+       gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
+       gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
+       *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
+       esac
 fi
 
-$rm -f try try.*
-
-fi # intsize -o longsize -o d_int64t -o d_longlong
-
-case "$sPRId64" in
-'')    d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
-       d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
-       ;;
-*)     d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
-       d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
-       ;;
-esac
-
 : check for length of double
 echo " "
 case "$doublesize" in
@@ -7050,7 +7093,8 @@ case "$doublesize" in
 #include <stdio.h>
 int main()
 {
-       printf("%d\n", sizeof(double));
+    printf("%d\n", (int)sizeof(double));
+    exit(0);
 }
 EOCP
        set try
@@ -7070,14 +7114,15 @@ $rm -f try.c try
 
 : check for long doubles
 echo " "
-$echo $n "Checking to see if your system supports long double...$c" >&4
-echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
-if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
+$echo $n "Checking to see if your system supports long double..." $c >&4
+echo 'int main() { long double x = 7.0; }' > try.c
+set try
+if eval $compile; then
        val="$define"
-       echo " Yup, it does." >&4
+       echo " Yes, it does." >&4
 else
        val="$undef"
-       echo " Nope, it doesn't." >&4
+       echo " No, it doesn't." >&4
 fi
 $rm try.*
 set d_longdbl
@@ -7087,7 +7132,7 @@ eval $setvar
 case "${d_longdbl}${longdblsize}" in
 $define)
        echo " "
-       $echo $n "Checking to see how big your long doubles are...$c" >&4
+       $echo $n "Checking to see how big your long doubles are..." $c >&4
        $cat >try.c <<'EOCP'
 #include <stdio.h>
 int main()
@@ -7096,8 +7141,9 @@ int main()
 }
 EOCP
        set try
+       set try
        if eval $compile; then
-               longdblsize=`./try`
+               longdblsize=`./try$exe_ext`
                $echo " $longdblsize bytes." >&4
        else
                dflt='8'
@@ -7112,7 +7158,7 @@ EOCP
        fi      
        ;;
 esac
-$rm -f try.c try
+$rm -f try.* try
 
 echo " "
 
@@ -8105,6 +8151,28 @@ set d_open3
 eval $setvar
 $rm -f open3*
 
+: see which of string.h or strings.h is needed
+echo " "
+strings=`./findhdr string.h`
+if $test "$strings" && $test -r "$strings"; then
+       echo "Using <string.h> instead of <strings.h>." >&4
+       val="$define"
+else
+       val="$undef"
+       strings=`./findhdr strings.h`
+       if $test "$strings" && $test -r "$strings"; then
+               echo "Using <strings.h> instead of <string.h>." >&4
+       else
+               echo "No string header found -- You'll surely have problems." >&4
+       fi
+fi
+set i_string
+eval $setvar
+case "$i_string" in
+"$undef") strings=`./findhdr strings.h`;;
+*)       strings=`./findhdr string.h`;;
+esac
+
 : check for non-blocking I/O stuff
 case "$h_sysfile" in
 true) echo "#include <sys/file.h>" > head.c;;
@@ -8121,6 +8189,7 @@ case "$o_nonblock" in
 '')
        $cat head.c > try.c
        $cat >>try.c <<'EOCP'
+#include <stdio.h>
 int main() {
 #ifdef O_NONBLOCK
        printf("O_NONBLOCK\n");
@@ -8161,10 +8230,20 @@ case "$eagain" in
 #include <errno.h>
 #include <sys/types.h>
 #include <signal.h>
+#include <stdio.h> 
 #define MY_O_NONBLOCK $o_nonblock
 #ifndef errno  /* XXX need better Configure test */
 extern int errno;
 #endif
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+#ifdef $i_string
+#include <string.h>
+#else
+#include <strings.h>
+#endif
 $signal_t blech(x) int x; { exit(3); }
 EOCP
        $cat >> try.c <<'EOCP'
@@ -8578,44 +8657,48 @@ set fpathconf d_fpathconf
 eval $inlibc
 
 
-: see if llseek exists
-set llseek d_llseek
-eval $inlibc
-
 : check for off64_t
 echo " "
-$echo $n "Checking to see if your system supports off64_t...$c" >&4
+echo "Checking to see if your system supports off64_t..." >&4
 $cat >try.c <<EOCP
 #include <sys/types.h>
 #include <unistd.h>
-off64_t foo() { off64_t x; x = 7; return x; }'
+int main() { off64_t x = 7; }'
 EOCP
-if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
+set try
+if eval $compile; then
        val="$define"
-       echo " Yup, it does." >&4
+       echo "Yes, it does."
 else
        val="$undef"
-       echo " Nope, it doesn't." >&4
+       echo "No, it doesn't."
+       case "$lseeksize" in
+       8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
+       esac
 fi
-$rm -f try.*
+$rm -f try.* try
 set d_off64_t
 eval $setvar
 
 : check for fpos64_t
 echo " "
-$echo $n "Checking to see if your system supports fpos64_t...$c" >&4
+echo "Checking to see if your system supports fpos64_t..." >&4
 $cat >try.c <<EOCP
 #include <sys/stdio.h>
-fpos64_t foo() { fpos64_t x; x = 7; return x; }'
+int main() { fpos64_t x x = 7; }'
 EOCP
-if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
+set try
+if eval $compile; then
        val="$define"
-       echo " Yup, it does." >&4
+       echo "Yes, it does."
 else
        val="$undef"
-       echo " Nope, it doesn't." >&4
+       echo "No, it doesn't."
+       case "$fpossize" in
+       8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
+       esac
 fi
-$rm -f try.*
+$rm -f try.* try
 set d_fpos64_t
 eval $setvar
 
@@ -8655,13 +8738,16 @@ echo "Checking to see if your system supports struct fs_data..." >&4
 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
 eval $hasstruct
 case "$d_fs_data_s" in
-"$define")      echo "Yup, it does."     >&4 ;;
-*)              echo "Nope, it doesn't." >&4 ;;
+"$define")      echo "Yes, it does."   ;;
+*)              echo "No, it doesn't." ;;
 esac
 
 : see if fseeko exists
 set fseeko d_fseeko
 eval $inlibc
+case "$longsize" in
+8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
+esac
 
 : see if fsetpos exists
 set fsetpos d_fsetpos
@@ -8685,6 +8771,9 @@ eval $inlibc
 : see if ftello exists
 set ftello d_ftello
 eval $inlibc
+case "$longsize" in
+8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
+esac
 
 : see if getgrent exists
 set getgrent d_getgrent
@@ -8983,28 +9072,6 @@ esac
 set d_htonl
 eval $setvar
 
-: see which of string.h or strings.h is needed
-echo " "
-strings=`./findhdr string.h`
-if $test "$strings" && $test -r "$strings"; then
-       echo "Using <string.h> instead of <strings.h>." >&4
-       val="$define"
-else
-       val="$undef"
-       strings=`./findhdr strings.h`
-       if $test "$strings" && $test -r "$strings"; then
-               echo "Using <strings.h> instead of <string.h>." >&4
-       else
-               echo "No string header found -- You'll surely have problems." >&4
-       fi
-fi
-set i_string
-eval $setvar
-case "$i_string" in
-"$undef") strings=`./findhdr strings.h`;;
-*)       strings=`./findhdr string.h`;;
-esac
-
 : index or strchr
 echo " "
 if set index val -f; eval $csym; $val; then
@@ -9042,6 +9109,51 @@ set d_index; eval $setvar
 set inet_aton d_inetaton
 eval $inlibc
 
+: see if inttypes.h is available
+: we want a real compile instead of Inhdr because some systems
+: have an inttypes.h which includes non-existent headers
+echo " "
+$cat >try.c <<EOCP
+#include <inttypes.h>
+int main() {
+       static int32_t foo32 = 0x12345678;
+}
+EOCP
+set try
+if eval $compile; then
+       echo "<inttypes.h> found." >&4
+       val="$define"
+else
+       echo "<inttypes.h> NOT found." >&4
+       val="$undef"
+fi
+$rm -f try.c try
+set i_inttypes
+eval $setvar
+
+: check for int64_t
+echo " "
+$echo $n "Checking to see if your system supports int64_t...$c" >&4
+$cat >try.c <<EOCP
+#include <sys/types.h>
+#$i_inttypes I_INTTYPES
+#ifdef I_INTTYPES
+#include <inttypes.h>
+#endif
+int main() { int64_t x = 7; }
+EOCP
+set try
+if eval $compile; then
+       val="$define"
+       echo " Yes, it does." >&4
+else
+       val="$undef"
+       echo " No, it doesn't." >&4
+fi
+$rm -f try try.*
+set d_int64t
+eval $setvar
+
 : Look for isascii
 echo " "
 $cat >isascii.c <<'EOCP'
@@ -9142,6 +9254,54 @@ eval $inlibc
 set lockf d_lockf
 eval $inlibc
 
+: check for long long
+echo " "
+$echo $n "Checking to see if your system supports long long..." $c >&4
+echo 'int main() { long long x = 7; return 0; }' > try.c
+set try
+if eval $compile; then
+       val="$define"
+       echo " Yes, it does." >&4
+else
+       val="$undef"
+       echo " No, it doesn't." >&4
+fi
+$rm try.*
+set d_longlong
+eval $setvar
+
+: check for length of long long
+case "${d_longlong}${longlongsize}" in
+$define)
+       echo " "
+       $echo $n "Checking to see how big your long longs are..." $c >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof(long long));
+    return(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               longlongsize=`./try$exe_ext`
+               $echo " $longlongsize bytes." >&4
+       else
+               dflt='8'
+               echo " "
+               echo "(I can't seem to compile the test program.  Guessing...)"
+               rp="What is the size of a long long (in bytes)?"
+               . ./myread
+               longlongsize="$ans"
+       fi
+       if $test "X$longsize" = "X$longlongsize"; then
+               echo "(That isn't any different from an ordinary long.)"
+       fi      
+       ;;
+esac
+$rm -f try.* try
+
 : see if lstat exists
 set lstat d_lstat
 eval $inlibc
@@ -9481,6 +9641,74 @@ $define)
        ;;
 esac
 
+
+echo " "
+echo "Checking which 64-bit integer type we could use..." >&4
+
+case "$intsize" in
+8) val=int
+   set quadtype
+   eval $setvar
+   val='"unsigned int"'
+   set uquadtype
+   eval $setvar
+   quadkind=1
+   ;;
+*) case "$longsize" in
+   8) val=long
+      set quadtype
+      eval $setvar
+      val='"unsigned long"'
+      set uquadtype
+      eval $setvar
+      quadkind=2
+      ;;
+   *) case "$uselonglong:$d_longlong:$longlongsize" in
+      define:define:8)
+        val='"long long"'
+        set quadtype
+        eval $setvar
+        val='"unsigned long long"'
+        set uquadtype
+        eval $setvar
+        quadkind=3
+        ;;
+      *) case "$d_int64t" in
+         define)
+           val=int64_t
+           set quadtype
+           eval $setvar
+           val=uint64_t
+           set uquadtype
+           eval $setvar
+           quadkind=4
+           ;;
+         esac
+         ;;
+      esac
+      ;;
+   esac
+   ;;
+esac
+
+case "$quadtype" in
+'')    case "$uselonglong:$d_longlong:$longlongsize" in
+       undef:define:8)
+          echo "(You would have 'long long', but you are not using it.)" >&4 ;;
+       *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
+       esac
+       d_quad="$undef"
+       ;;
+*)     if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
+           verb="will"
+       else
+           verb="could"
+       fi
+       echo "We $verb use '$quadtype' for 64-bit integers." >&4
+       d_quad="$define"
+       ;;
+esac
+
 : see if readdir and friends exist
 set readdir d_readdir
 eval $inlibc
@@ -10203,6 +10431,8 @@ int main()
     struct sigaction act, oact;
     act.sa_flags = 0;
     oact.sa_handler = 0;
+    /* so that act and oact are used */
+    exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
 }
 EOP
        set try
@@ -10295,8 +10525,8 @@ echo "Checking to see if your system supports struct statfs..." >&4
 set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
 eval $hasstruct
 case "$d_statfs_s" in
-"$define")      echo "Yup, it does."     >&4 ;;
-*)              echo "Nope, it doesn't." >&4 ;;
+"$define")      echo "Yes, it does."   ;;
+*)              echo "No, it doesn't." ;;
 esac
 
 
@@ -10315,8 +10545,8 @@ define)
        ;;
 esac
 case "$d_statfs_f_flags" in
-"$define")      echo "Yup, it does."     >&4 ;;
-*)              echo "Nope, it doesn't." >&4 ;;
+"$define")      echo "Yes, it does."   ;;
+*)              echo "No, it doesn't." ;;
 esac
 
 : see if _ptr and _cnt from stdio act std
@@ -10576,83 +10806,27 @@ eval $inlibc
 set syscall d_syscall
 eval $inlibc
 
-: see if sysconf exists
-set sysconf d_sysconf
-eval $inlibc
-
-: see if system exists
-set system d_system
-eval $inlibc
-
-: see if tcgetpgrp exists
-set tcgetpgrp d_tcgetpgrp
-eval $inlibc
-
-: see if tcsetpgrp exists
-set tcsetpgrp d_tcsetpgrp
-eval $inlibc
-
-: see if prototype for telldir is available
-echo " "
-set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
-eval $hasproto
-
-: define an is-a-typedef? function
-typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
-case "$inclist" in
-"") inclist="sys/types.h";;
-esac;
-eval "varval=\$$var";
-case "$varval" in
-"")
-       $rm -f temp.c;
-       for inc in $inclist; do
-               echo "#include <$inc>" >>temp.c;
-       done;
-       echo "#ifdef $type" >> temp.c;
-       echo "printf(\"We have $type\");" >> temp.c;
-       echo "#endif" >> temp.c;
-       $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
-       if $contains $type temp.E >/dev/null 2>&1; then
-               eval "$var=\$type";
-       else
-               eval "$var=\$def";
-       fi;
-       $rm -f temp.?;;
-*) eval "$var=\$varval";;
-esac'
-
-: define an is-a-typedef? function that prompts if the type is not available.
-typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
-case "$inclist" in
-"") inclist="sys/types.h";;
-esac;
-eval "varval=\$$var";
-case "$varval" in
-"")
-       $rm -f temp.c;
-       for inc in $inclist; do
-               echo "#include <$inc>" >>temp.c;
-       done;
-       echo "#ifdef $type" >> temp.c;
-       echo "printf(\"We have $type\");" >> temp.c;
-       echo "#endif" >> temp.c;
-       $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
-       echo " " ;
-       echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
-       if $contains $type temp.E >/dev/null 2>&1; then
-               echo "$type found." >&4;
-               eval "$var=\$type";
-       else
-               echo "$type NOT found." >&4;
-               dflt="$def";
-               . ./myread ;
-               eval "$var=\$ans";
-       fi;
-       $rm -f temp.?;;
-*) eval "$var=\$varval";;
-esac'
-
+: see if sysconf exists
+set sysconf d_sysconf
+eval $inlibc
+
+: see if system exists
+set system d_system
+eval $inlibc
+
+: see if tcgetpgrp exists
+set tcgetpgrp d_tcgetpgrp
+eval $inlibc
+
+: see if tcsetpgrp exists
+set tcsetpgrp d_tcsetpgrp
+eval $inlibc
+
+: see if prototype for telldir is available
+echo " "
+set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
+eval $hasproto
+
 : see if this is a sys/times.h system
 set sys/times.h i_systimes
 eval $inhdr
@@ -10893,13 +11067,15 @@ EOM
        case "$alignbytes" in
        '') echo "Checking alignment constraints..." >&4
                $cat >try.c <<'EOCP'
+#include <stdio.h>
 struct foobar {
        char foo;
        double bar;
 } try_algn;
 int main()
 {
-       printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
+    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
+    return(0);
 }
 EOCP
                set try
@@ -11642,11 +11818,6 @@ EOM
 esac
 $rm -f try.* try$exe_ext
 
-: see what type file positions are declared as in the library
-rp="What is the type for file position used by fsetpos()?"
-set fpos_t fpostype long stdio.h sys/types.h
-eval $typedef_ask
-
 : Store the full pathname to the ar program for use in the C program
 : Respect a hint or command line value for full_ar.
 case "$full_ar" in
@@ -11680,72 +11851,517 @@ gid_t) echo "gid_t found." ;;
        ;;
 esac
 
-echo " "
-case "$gidtype" in
-*_t) zzz="$gidtype"    ;;
-*)   zzz="gid"         ;;
-esac
-echo "Checking the sign of $zzz..." >&4 
-cat > try.c <<EOCP
+echo " "
+case "$gidtype" in
+*_t) zzz="$gidtype"    ;;
+*)   zzz="gid"         ;;
+esac
+echo "Checking the size of $zzz..." >&4 
+cat > try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+    printf("%d\n", (int)sizeof($gidtype));
+    exit(0);
+}
+EOCP
+set try
+if eval $compile_ok; then
+       yyy=`./try`
+       case "$yyy" in
+       '')     gidsize=4
+               echo "(I can't execute the test program--guessing $gidsize.)" >&4
+               ;;
+       *)      gidsize=$yyy
+               echo "Your $zzz size is $gidsize bytes."
+               ;;
+       esac
+else
+       gidsize=4
+       echo "(I can't compile the test program--guessing $gidsize.)" >&4
+fi
+
+
+echo " "
+case "$gidtype" in
+*_t) zzz="$gidtype"    ;;
+*)   zzz="gid"         ;;
+esac
+echo "Checking the sign of $zzz..." >&4 
+cat > try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+       $gidtype foo = -1;
+       if (foo < 0)
+               printf("-1\n");
+       else
+               printf("1\n");
+}
+EOCP
+set try
+if eval $compile; then
+       yyy=`./try`
+       case "$yyy" in
+       '')     gidsign=1
+               echo "(I can't execute the test program--guessing unsigned.)" >&4
+               ;;
+       *)      gidsign=$yyy
+               case "$gidsign" in
+                1) echo "Your $zzz is unsigned." ;;
+               -1) echo "Your $zzz is signed."   ;;
+               esac
+               ;;
+       esac
+else
+       gidsign=1
+       echo "(I can't compile the test program--guessing unsigned.)" >&4
+fi
+
+
+: check for length of character
+echo " "
+case "$charsize" in
+'')
+       echo "Checking to see how big your characters are (hey, you never know)..." >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof(char));
+    exit(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               dflt=`./try`
+       else
+               dflt='1'
+               echo "(I can't seem to compile the test program.  Guessing...)"
+       fi
+       ;;
+*)
+       dflt="$charsize"
+       ;;
+esac
+rp="What is the size of a character (in bytes)?"
+. ./myread
+charsize="$ans"
+$rm -f try.c try
+
+
+echo " "
+$echo "Choosing the C types to be used for Perl's internal types..." >&4
+
+case "$use64bits:$d_quad:$quadtype" in
+define:define:?*)
+       ivtype="$quadtype"
+       uvtype="$uquadtype"
+       ivsize=8
+       uvsize=8
+       ;;
+*)     ivtype="long"
+       uvtype="unsigned long"
+       ivsize=$longsize
+       uvsize=$longsize
+       ;;
+esac
+
+case "$uselongdouble:$d_longdbl" in
+define:define)
+       nvtype="long double"
+       nvsize=$longdblsize
+       ;;
+*)     nvtype=double
+       nvsize=$doublesize
+       ;;
+esac
+
+echo "(IV will be "$ivtype", $ivsize bytes)"
+echo "(UV will be "$uvtype", $uvsize bytes)"
+echo "(NV will be "$nvtype", $nvsize bytes)"
+
+$cat >try.c <<EOCP
+#$i_inttypes I_INTTYPES
+#ifdef I_INTTYPES
+#include <inttypes.h>
+#endif
+#include <stdio.h>
+int main() {
+#ifdef INT8
+   int8_t i =  INT8_MAX;
+  uint8_t u = UINT8_MAX;
+  printf("int8_t\n");
+#endif
+#ifdef INT16
+   int16_t i =  INT16_MAX;
+  uint16_t i = UINT16_MAX;
+  printf("int16_t\n");
+#endif
+#ifdef INT32
+   int32_t i =  INT32_MAX;
+  uint32_t u = UINT32_MAX;
+  printf("int32_t\n");
+#endif
+}
+EOCP
+
+case "$i8type" in
+'')    case "$charsize" in
+       1)      i8type=char
+               u8type="unsigned char"
+               i8size=$charsize
+               u8size=$charsize
+               ;;
+       esac
+       ;;
+esac
+case "$i8type" in
+'')    set try -DINT8
+       if eval $compile; then
+               case "`./try$exe_ext`" in
+               int8_t) i8type=int8_t
+                       u8type=uint8_t
+                       i8size=1
+                       u8size=1
+                       ;;
+               esac
+       fi
+       ;;
+esac
+case "$i8type" in
+'')    if $test $charsize -ge 1; then
+               i8type=char
+               u8type="unsigned char"
+               i8size=$charsize
+               u8size=$charsize
+       fi
+       ;;
+esac
+
+case "$i16type" in
+'')    case "$shortsize" in
+       2)      i16type=short
+               u16type="unsigned short"
+               i16size=$shortsize
+               u16size=$shortsize
+               ;;
+       esac
+       ;;
+esac
+case "$i16type" in
+'')    set try -DINT16
+       if eval $compile; then
+               case "`./try$exe_ext`" in
+               int16_t)
+                       i16type=int16_t
+                       u16type=uint16_t
+                       i16size=2
+                       u16size=2
+                       ;;
+               esac
+       fi
+       ;;
+esac
+case "$i16type" in
+'')    if $test $shortsize -ge 2; then
+               i16type=short
+               u16type="unsigned short"
+               i16size=$shortsize
+               u16size=$shortsize
+       fi
+       ;;
+esac
+
+case "$i32type" in
+'')    case "$longsize" in
+       4)      i32type=long
+               u32type="unsigned long"
+               i32size=$longsize
+               u32size=$longsize
+               ;;
+       *)      case "$intsize" in
+               4)      i32type=int
+                       u32type="unsigned int"
+                       i32size=$intsize
+                       u32size=$intsize
+                       ;;
+               esac
+               ;;
+       esac
+       ;;
+esac
+case "$i32type" in
+'')    set try -DINT32
+       if eval $compile; then
+               case "`./try$exe_ext`" in
+               int32_t)
+                       i32type=int32_t
+                       u32type=uint32_t
+                       i32size=4
+                       u32size=4
+                       ;;
+               esac
+       fi
+       ;;
+esac
+case "$i32type" in
+'')    if $test $intsize -ge 4; then
+               i32type=int
+               u32type="unsigned int"
+               i32size=$intsize
+               u32size=$intsize
+       fi
+       ;;
+esac
+
+case "$i64type" in
+'')    case "$d_quad:$quadtype" in
+       define:?*)
+               i64type="$quadtype"
+               u64type="$uquadtype"
+               i64size=8
+               u64size=8
+               ;;
+       esac
+       ;;
+esac
+
+$rm -f try.* try
+
+echo " "
+
+if $test X"$quadtype" != X; then
+
+echo "Checking how to print 64-bit integers..." >&4
+
+if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  int q = 12345678901;
+  printf("%ld\n", q);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               12345678901)
+                       sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
+                       sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
+                       echo "We will use %d."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  long q = 12345678901;
+  printf("%ld\n", q);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               12345678901)
+                       sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
+                       sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
+                       echo "We will use %ld."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <inttypes.h>
+#include <stdio.h>
+int main() {
+  int64_t q = 12345678901;
+  printf("%" PRId64 "\n", q);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               12345678901)
+                       sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
+                       sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
+                       echo "We will use the C9X style."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
+       $cat >try.c <<'EOCP'
 #include <sys/types.h>
 #include <stdio.h>
 int main() {
-       $gidtype foo = -1;
-       if (foo < 0)
-               printf("-1\n");
-       else
-               printf("1\n");
+  long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
+  printf("%lld\n", q);
 }
 EOCP
-set try
-if eval $compile; then
-       yyy=`./try`
-       case "$yyy" in
-       '')     gidsign=1
-               echo "(I can't execute the test program--guessing unsigned.)" >&4
-               ;;
-       *)      gidsign=$yyy
-               case "$gidsign" in
-                1) echo "Your $zzz is unsigned." ;;
-               -1) echo "Your $zzz is signed."   ;;
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               12345678901)
+                       sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
+                       sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
+                       echo "We will use the %lld style."
+                       ;;
                esac
-               ;;
-       esac
-else
-       gidsign=1
-       echo "(I can't compile the test program--guessing unsigned.)" >&4
+       fi
 fi
 
+if $test X"$sPRId64" = X -a X"$quadtype" != X; then
+       $cat >try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  $quadtype q = 12345678901;
+  printf("%Ld\n", q);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               12345678901)
+                       sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
+                       sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
+                       echo "We will use %Ld."
+                       ;;
+               esac
+       fi
+fi
 
-echo " "
-case "$gidtype" in
-*_t) zzz="$gidtype"    ;;
-*)   zzz="gid"         ;;
-esac
-echo "Checking the size of $zzz..." >&4 
-cat > try.c <<EOCP
+if $test X"$sPRId64" = X -a X"$quadtype" != X; then
+       $cat >try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
 int main() {
-    printf("%d\n", sizeof($gidtype));
+  $quadtype q = 12345678901;
+  printf("%qd\n", q);
 }
 EOCP
-set try
-if eval $compile_ok; then
-       yyy=`./try`
-       case "$yyy" in
-       '')     gidsize=4
-               echo "(I can't execute the test program--guessing $gidsize.)" >&4
-               ;;
-       *)      gidsize=$yyy
-               echo "Your $zzz size is $gidsize bytes."
-               ;;
-       esac
+       set try
+       if eval $compile; then
+               yyy=`./try$exe_ext`
+               case "$yyy" in
+               12345678901)
+                       sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
+                       sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
+                       echo "We will use %qd."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRId64" = X; then
+       echo "Cannot figure out how to print 64-bit integers." >&4
+fi
+
+$rm -f try try.*
+
+fi
+
+case "$sPRId64" in
+'')    d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
+       d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
+       ;;
+*)     d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
+       d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
+       ;;
+esac
+
+
+echo " "
+$echo "Checking the format strings to be used for Perl's internal types..." >&4
+
+if $test X"$ivsize" = X8; then
+       ivdformat="$sPRId64"
+       uvuformat="$sPRIu64"
+       uvoformat="$sPRIo64"
+       uvxformat="$sPRIx64"
 else
-       gidsize=4
-       echo "(I can't compile the test program--guessing $gidsize.)" >&4
+       if $test X"$ivsize" = X"$longsize"; then
+               ivdformat='"ld"'
+               uvuformat='"lu"'
+               uvoformat='"lo"'
+               uvxformat='"lx"'
+       else
+               if $test X"$ivsize" = X"$intsize"; then
+                       ivdformat='"d"'
+                       uvuformat='"u"'
+                       uvoformat='"o"'
+                       uvxformat='"x"'
+               else
+                       : far out
+                       if $test X"$ivsize" = X"$shortsize"; then
+                               ivdformat='"hd"'
+                               uvuformat='"hu"'
+                               uvoformat='"ho"'
+                               uvxformat='"hx"'
+                       fi
+               fi
+       fi
 fi
 
+case "$ivdformat" in
+'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
+    exit 1
+    ;;
+esac
+
+
+echo " "
+$echo "Checking the format string to be used for gids..." >&4
+
+case "$gidsign" in
+-1)    if $test X"$gidsize" = X"$ivsize"; then
+               gidformat="$ivdformat"
+       else
+               if $test X"$gidsize" = X"$longsize"; then
+                       gidformat='"ld"'
+               else
+                       if $test X"$gidsize" = X"$intsize"; then
+                               gidformat='"d"'
+                       else
+                               if $test X"$gidsize" = X"$shortsize"; then
+                                       gidformat='"hd"'
+                               fi
+                       fi
+               fi
+       fi
+       ;;
+*)     if $test X"$gidsize" = X"$uvsize"; then
+               gidformat="$uvuformat"
+       else
+               if $test X"$gidsize" = X"$longsize"; then
+                       gidformat='"lu"'
+               else
+                       if $test X"$gidsize" = X"$intsize"; then
+                               gidformat='"u"'
+                       else
+                               if $test X"$gidsize" = X"$shortsize"; then
+                                       gidformat='"hu"'
+                               fi
+                       fi
+               fi
+       fi
+       ;;
+esac
 
 : see if getgroups exists
 set getgroups d_getgrps
@@ -11776,35 +12392,6 @@ EOM
 *)  groupstype="$gidtype";;
 esac
 
-: see what type lseek is declared as in the kernel
-rp="What is the type used for lseek's offset on this system?"
-set off_t lseektype long stdio.h sys/types.h
-eval $typedef_ask
-
-echo " "
-$echo $n "Checking to see how big your file offsets are...$c" >&4
-$cat >try.c <<EOCP
-#include <sys/types.h>
-#include <stdio.h>
-int main()
-{
-       printf("%d\n", sizeof($lseektype));
-}
-EOCP
-set try
-if eval $compile_ok; then
-       lseeksize=`./try`
-       $echo " $lseeksize bytes." >&4
-else
-       dflt='4'
-       echo " "
-       echo "(I can't seem to compile the test program.  Guessing...)"
-       rp="What is the size of your file offsets (in bytes)?"
-       . ./myread
-       lseeksize="$ans"
-fi
-$rm -f try.c try
-
 echo " "
 echo "Checking if your $make program sets \$(MAKE)..." >&4
 case "$make_set_make" in
@@ -12056,8 +12643,8 @@ case "$ptrsize" in
 #include <stdio.h>
 int main()
 {
-       printf("%d\n", sizeof(VOID_PTR));
-       exit(0);
+    printf("%d\n", (int)sizeof(VOID_PTR));
+    exit(0);
 }
 EOCP
        set try
@@ -12270,10 +12857,16 @@ esac
 : Remove SIGSTKSIZE used by Linux.
 : Remove SIGSTKSZ used by Posix.
 : Remove SIGTYP void lines used by OS2.
-xxx=`echo '#include <signal.h>' |
+: Some cpps, like os390, dont give the file name anywhere
+if [ "X$fieldn" = X ]; then
+       : Just make some guesses.  We check them later.
+       xxx='/usr/include/signal.h /usr/include/sys/signal.h'
+else
+       xxx=`echo '#include <signal.h>' |
        $cppstdin $cppminus $cppflags 2>/dev/null |
        $grep '^[       ]*#.*include' | 
        $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
+fi
 : Check this list of files to be sure we have parsed the cpp output ok.
 : This will also avoid potentially non-existent files, such 
 : as ../foo/bar.h
@@ -12293,10 +12886,12 @@ $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ &&
        print substr($3, 4, 20)
 }' $xxxfiles`
 : Append some common names just in case the awk scan failed.
-xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
-xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
-xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
-xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
+xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
+xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
+xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
+xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
+xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
+
 : generate a few handy files for later
 $cat > signal.c <<'EOCP'
 #include <sys/types.h>
@@ -12369,7 +12964,7 @@ echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
 }
 END {
        printf "#endif /* JUST_NSIG */\n";
-       printf "}\n";
+       printf "exit(0);\n}\n";
 }
 ' >>signal.c
 $cat >signal.awk <<'EOP'
@@ -12616,67 +13211,107 @@ case "$uidtype" in
 *_t) zzz="$uidtype"    ;;
 *)   zzz="uid"         ;;
 esac
-echo "Checking the sign of $zzz..." >&4
+echo "Checking the size of $zzz..." >&4 
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
 int main() {
-       $uidtype foo = -1;
-       if (foo < 0)
-               printf("-1\n");
-       else
-               printf("1\n");
+    printf("%d\n", (int)sizeof($uidtype));
+    exit(0);
 }
 EOCP
 set try
-if eval $compile; then
+if eval $compile_ok; then
        yyy=`./try`
        case "$yyy" in
-       '')     uidsign=1
-               echo "(I can't execute the test program--guessing unsigned.)" >&4
+       '')     uidsize=4
+               echo "(I can't execute the test program--guessing $uidsize.)" >&4
                ;;
-       *)      uidsign=$yyy
-               case "$uidsign" in
-                1) echo "Your $zzz is unsigned." ;;
-               -1) echo "Your $zzz is signed."   ;;
-               esac
+       *)      uidsize=$yyy
+               echo "Your $zzz size is $uidsize bytes."
                ;;
        esac
 else
-       uidsign=1
-       echo "(I can't compile the test program--guessing unsigned.)" >&4
+       uidsize=4
+       echo "(I can't compile the test program--guessing $uidsize.)" >&4
 fi
 
-
 echo " "
 case "$uidtype" in
 *_t) zzz="$uidtype"    ;;
 *)   zzz="uid"         ;;
 esac
-echo "Checking the size of $zzz..." >&4 
+echo "Checking the sign of $zzz..." >&4
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
 int main() {
-    printf("%d\n", sizeof($uidtype));
+       $uidtype foo = -1;
+       if (foo < 0)
+               printf("-1\n");
+       else
+               printf("1\n");
 }
 EOCP
 set try
-if eval $compile_ok; then
+if eval $compile; then
        yyy=`./try`
        case "$yyy" in
-       '')     uidsize=4
-               echo "(I can't execute the test program--guessing $uidsize.)" >&4
+       '')     uidsign=1
+               echo "(I can't execute the test program--guessing unsigned.)" >&4
                ;;
-       *)      uidsize=$yyy
-               echo "Your $zzz size is $uidsize bytes."
+       *)      uidsign=$yyy
+               case "$uidsign" in
+                1) echo "Your $zzz is unsigned." ;;
+               -1) echo "Your $zzz is signed."   ;;
+               esac
                ;;
        esac
 else
-       uidsize=4
-       echo "(I can't compile the test program--guessing $uidsize.)" >&4
+       uidsign=1
+       echo "(I can't compile the test program--guessing unsigned.)" >&4
 fi
 
+
+
+echo " "
+$echo "Checking the format string to be used for uids..." >&4
+
+case "$uidsign" in
+-1)    if $test X"$uidsize" = X"$ivsize"; then
+               uidformat="$ivdformat"
+       else
+               if $test X"$uidsize" = X"$longsize"; then
+                       uidformat='"ld"'
+               else
+                       if $test X"$uidsize" = X"$intsize"; then
+                               uidformat='"d"'
+                       else
+                               if $test X"$uidsize" = X"$shortsize"; then
+                                       uidformat='"hd"'
+                               fi
+                       fi
+               fi
+       fi
+       ;;
+*)     if $test X"$uidsize" = X"$uvsize"; then
+               uidformat="$uvuformat"
+       else
+               if $test X"$uidsize" = X"$longsize"; then
+                       uidformat='"lu"'
+               else
+                       if $test X"$uidsize" = X"$intsize"; then
+                               uidformat='"u"'
+                       else
+                               if $test X"$uidsize" = X"$shortsize"; then
+                                       uidformat='"hu"'
+                               fi
+                       fi
+               fi
+       fi
+       ;;
+esac
+
 : see if dbm.h is available
 : see if dbmclose exists
 set dbmclose d_dbmclose
@@ -13172,16 +13807,6 @@ eval $inhdr
 set sys/uio.h i_sysuio
 eval $inhdr
 
-echo "Checking to see if your system supports struct iovec..." >&4
-set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
-eval $hasfield
-case "$d_iovec_s" in
-"$define")      echo "Yup, it does." >&4
-                ;;
-*)              echo "Nope, it doesn't." >&4
-                ;;
-esac
-
 : see if this is a sys/un.h system
 set sys/un.h i_sysun
 eval $inhdr
@@ -13577,6 +14202,7 @@ ccsymbols='$ccsymbols'
 cf_by='$cf_by'
 cf_email='$cf_email'
 cf_time='$cf_time'
+charsize='$charsize'
 chgrp='$chgrp'
 chmod='$chmod'
 chown='$chown'
@@ -13712,13 +14338,11 @@ d_htonl='$d_htonl'
 d_index='$d_index'
 d_inetaton='$d_inetaton'
 d_int64t='$d_int64t'
-d_iovec_s='$d_iovec_s'
 d_isascii='$d_isascii'
 d_killpg='$d_killpg'
 d_lchown='$d_lchown'
 d_ldbl_dig='$d_ldbl_dig'
 d_link='$d_link'
-d_llseek='$d_llseek'
 d_locconv='$d_locconv'
 d_lockf='$d_lockf'
 d_longdbl='$d_longdbl'
@@ -13767,6 +14391,7 @@ d_pwexpire='$d_pwexpire'
 d_pwgecos='$d_pwgecos'
 d_pwpasswd='$d_pwpasswd'
 d_pwquota='$d_pwquota'
+d_quad='$d_quad'
 d_readdir='$d_readdir'
 d_readlink='$d_readlink'
 d_rename='$d_rename'
@@ -13896,12 +14521,14 @@ fflushall='$fflushall'
 find='$find'
 firstmakefile='$firstmakefile'
 flex='$flex'
+fpossize='$fpossize'
 fpostype='$fpostype'
 freetype='$freetype'
 full_ar='$full_ar'
 full_csh='$full_csh'
 full_sed='$full_sed'
 gccversion='$gccversion'
+gidformat='$gidformat'
 gidsign='$gidsign'
 gidsize='$gidsize'
 gidtype='$gidtype'
@@ -13915,6 +14542,14 @@ h_sysfile='$h_sysfile'
 hint='$hint'
 hostcat='$hostcat'
 huge='$huge'
+i16size='$i16size'
+i16type='$i16type'
+i32size='$i32size'
+i32type='$i32type'
+i64size='$i64size'
+i64type='$i64type'
+i8size='$i8size'
+i8type='$i8type'
 i_arpainet='$i_arpainet'
 i_bsdioctl='$i_bsdioctl'
 i_db='$i_db'
@@ -14004,6 +14639,9 @@ installusrbinperl='$installusrbinperl'
 installvendorbin='$installvendorbin'
 installvendorlib='$installvendorlib'
 intsize='$intsize'
+ivdformat='$ivdformat'
+ivsize='$ivsize'
+ivtype='$ivtype'
 known_extensions='$known_extensions'
 ksh='$ksh'
 large='$large'
@@ -14068,6 +14706,8 @@ nm_opt='$nm_opt'
 nm_so_opt='$nm_so_opt'
 nonxs_ext='$nonxs_ext'
 nroff='$nroff'
+nvsize='$nvsize'
+nvtype='$nvtype'
 o_nonblock='$o_nonblock'
 obj_ext='$obj_ext'
 old_pthread_create_joinable='$old_pthread_create_joinable'
@@ -14096,6 +14736,8 @@ privlib='$privlib'
 privlibexp='$privlibexp'
 prototype='$prototype'
 ptrsize='$ptrsize'
+quadkind='$quadkind'
+quadtype='$quadtype'
 randbits='$randbits'
 randfunc='$randfunc'
 randseedtype='$randseedtype'
@@ -14183,15 +14825,26 @@ touch='$touch'
 tr='$tr'
 trnl='$trnl'
 troff='$troff'
+u16size='$u16size'
+u16type='$u16type'
+u32size='$u32size'
+u32type='$u32type'
+u64size='$u64size'
+u64type='$u64type'
+u8size='$u8size'
+u8type='$u8type'
+uidformat='$uidformat'
 uidsign='$uidsign'
 uidsize='$uidsize'
 uidtype='$uidtype'
 uname='$uname'
 uniq='$uniq'
+uquadtype='$uquadtype'
 use64bits='$use64bits'
 usedl='$usedl'
 uselargefiles='$uselargefiles'
 uselongdouble='$uselongdouble'
+uselonglong='$uselonglong'
 usemorebits='$usemorebits'
 usemultiplicity='$usemultiplicity'
 usemymalloc='$usemymalloc'
@@ -14207,6 +14860,11 @@ usevendorprefix='$usevendorprefix'
 usevfork='$usevfork'
 usrinc='$usrinc'
 uuname='$uuname'
+uvoformat='$uvoformat'
+uvsize='$uvsize'
+uvtype='$uvtype'
+uvuformat='$uvuformat'
+uvxformat='$uvxformat'
 vendorbin='$vendorbin'
 vendorbinexp='$vendorbinexp'
 vendorlib='$vendorlib'