This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Mention git resources in header
[perl5.git] / Configure
index d969c3a..f1123f3 100755 (executable)
--- a/Configure
+++ b/Configure
 # Yes, you may rip this off to use in other distribution packages. This
 # script belongs to the public domain and cannot be copyrighted.
 #
 # Yes, you may rip this off to use in other distribution packages. This
 # script belongs to the public domain and cannot be copyrighted.
 #
-# (Note: this Configure script was generated automatically. Rather than
+# Note: this Configure script was generated automatically. Rather than
 # working with this copy of Configure, you may wish to get metaconfig.
 # working with this copy of Configure, you may wish to get metaconfig.
-# The dist-3.0 package (which contains metaconfig) was posted in
-# comp.sources.misc and is available on CPAN under authors/id/RAM so
-# you may fetch it yourself from your nearest archive site.)
+# The dist package (which contains metaconfig) is available via SVN:
+#     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
 #
 #
+# Though this script was generated by metaconfig from metaunits, it is
+# OK to send patches against Configure itself. It's up to the Configure
+# pumpkin to backport the patch to the metaunits if it is accepted.
+# The metaunits are also available from the public git repository:
+#     http://perl5.git.perl.org/metaconfig.git/ or
+#     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
 #
 #
-# Though this script was generated by metaconfig, it is OK to send
-# patches against it. It's up to the Configure pumpkin to backport
-# the patch to the metaunits if it is accepted.
 # See Porting/pumpkin.pod for more information on metaconfig.
 #
 
 # See Porting/pumpkin.pod for more information on metaconfig.
 #
 
-# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
+# $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
 #
 #
-# Generated on Fri Mar  9 20:00:14 CET 2007 [metaconfig 3.0 PL70]
+# Generated on Thu Nov  5 21:01:50 CET 2009 [metaconfig 3.5 PL0]
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >c1$$ <<EOF
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >c1$$ <<EOF
@@ -88,9 +90,9 @@ esac
 
 : Proper separator for the PATH environment variable
 p_=:
 
 : Proper separator for the PATH environment variable
 p_=:
-: On OS/2 this directory should exist if this is not floppy only system :-]
+: On OS/2 this directory should exist if this is not floppy only system ":-]"
 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
-    if test -n "$OS2_SHELL"; then
+       if test -n "$OS2_SHELL"; then
                p_=\;
                PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
                OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
                p_=\;
                PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
                OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
@@ -145,9 +147,9 @@ if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
 fi
 if test -f /osf_boot -a -f /usr/sbin/setld; then
        if test X`/usr/bin/uname -s` = XOSF1; then
 fi
 if test -f /osf_boot -a -f /usr/sbin/setld; then
        if test X`/usr/bin/uname -s` = XOSF1; then
-               avoidksh="to avoid Digital UNIX' ksh"
-               newsh=/bin/sh
-               unset BIN_SH # if this is 'xpg4' sh will start up ksh
+               avoidksh="to avoid Digital UNIX' ksh"
+               newsh=/bin/sh
+               unset BIN_SH
        fi
 fi
 case "$inksh/$needksh" in
        fi
 fi
 case "$inksh/$needksh" in
@@ -181,17 +183,19 @@ true)
        esac
        ;;
 esac
        esac
        ;;
 esac
+test -x "${newsh}" || unset newsh
 
 
-: if needed set CDPATH to a harmless value that is not chatty
+: if needed, set CDPATH to a harmless value that is not chatty
 : avoid bash 2.02 problems with empty CDPATH.
 case "$CDPATH" in
 '')    ;;
 *)     case "$SHELL" in
 : avoid bash 2.02 problems with empty CDPATH.
 case "$CDPATH" in
 '')    ;;
 *)     case "$SHELL" in
-       *bash*) CDPATH='.' ;;
-       *)              CDPATH='' ;;
+       *bash*) CDPATH='.' ;;
+       *) CDPATH='' ;;
        esac
        ;;
 esac
        esac
        ;;
 esac
+
 : Configure runs within the UU subdirectory
 test -d UU || mkdir UU
 cd UU && rm -f ./*
 : Configure runs within the UU subdirectory
 test -d UU || mkdir UU
 cd UU && rm -f ./*
@@ -206,7 +210,9 @@ run=''
 targetarch=''
 to=''
 usecrosscompile=''
 targetarch=''
 to=''
 usecrosscompile=''
+extern_C=''
 mistrustnm=''
 mistrustnm=''
+usedevel=''
 perllibs=''
 dynamic_ext=''
 extensions=''
 perllibs=''
 dynamic_ext=''
 extensions=''
@@ -220,7 +226,6 @@ d_bsd=''
 d_eunice=''
 d_xenix=''
 eunicefix=''
 d_eunice=''
 d_xenix=''
 eunicefix=''
-Mcc=''
 ar=''
 awk=''
 bash=''
 ar=''
 awk=''
 bash=''
@@ -316,6 +321,7 @@ firstmakefile=''
 lib_ext=''
 obj_ext=''
 path_sep=''
 lib_ext=''
 obj_ext=''
 path_sep=''
+rm_try=''
 afs=''
 afsroot=''
 alignbytes=''
 afs=''
 afsroot=''
 alignbytes=''
@@ -345,7 +351,6 @@ optimize=''
 cf_email=''
 cf_by=''
 cf_time=''
 cf_email=''
 cf_by=''
 cf_time=''
-charsize=''
 contains=''
 cpp_stuff=''
 cpplast=''
 contains=''
 cpp_stuff=''
 cpplast=''
@@ -359,6 +364,7 @@ d_aintl=''
 d_alarm=''
 asctime_r_proto=''
 d_asctime_r=''
 d_alarm=''
 asctime_r_proto=''
 d_asctime_r=''
+d_attribute_deprecated=''
 d_attribute_format=''
 d_attribute_malloc=''
 d_attribute_nonnull=''
 d_attribute_format=''
 d_attribute_malloc=''
 d_attribute_nonnull=''
@@ -464,6 +470,7 @@ d_ftime=''
 d_gettimeod=''
 d_futimes=''
 d_Gconvert=''
 d_gettimeod=''
 d_futimes=''
 d_Gconvert=''
+d_getaddrinfo=''
 d_getcwd=''
 d_getespwnam=''
 d_getfsstat=''
 d_getcwd=''
 d_getespwnam=''
 d_getfsstat=''
@@ -495,6 +502,7 @@ d_getlogin_r=''
 getlogin_r_proto=''
 d_getmnt=''
 d_getmntent=''
 getlogin_r_proto=''
 d_getmnt=''
 d_getmntent=''
+d_getnameinfo=''
 d_getnbyaddr=''
 d_getnbyname=''
 d_getnent=''
 d_getnbyaddr=''
 d_getnbyname=''
 d_getnent=''
@@ -551,6 +559,8 @@ d_hasmntopt=''
 d_htonl=''
 d_ilogbl=''
 d_inetaton=''
 d_htonl=''
 d_ilogbl=''
 d_inetaton=''
+d_inetntop=''
+d_inetpton=''
 d_int64_t=''
 d_isascii=''
 d_isfinite=''
 d_int64_t=''
 d_isascii=''
 d_isfinite=''
@@ -777,6 +787,13 @@ d_tcsetpgrp=''
 d_telldirproto=''
 d_time=''
 timetype=''
 d_telldirproto=''
 d_time=''
 timetype=''
+d_asctime64=''
+d_ctime64=''
+d_difftime64=''
+d_gmtime64=''
+d_localtime64=''
+d_mktime64=''
+d_timegm=''
 clocktype=''
 d_times=''
 d_tmpnam_r=''
 clocktype=''
 d_times=''
 d_tmpnam_r=''
@@ -810,6 +827,7 @@ d_wcstombs=''
 d_wctomb=''
 d_writev=''
 dlext=''
 d_wctomb=''
 d_writev=''
 dlext=''
+bin_ELF=''
 cccdlflags=''
 ccdlflags=''
 dlsrc=''
 cccdlflags=''
 ccdlflags=''
 dlsrc=''
@@ -839,6 +857,7 @@ html3dir=''
 html3direxp=''
 installhtml3dir=''
 i_arpainet=''
 html3direxp=''
 installhtml3dir=''
 i_arpainet=''
+i_assert=''
 i_crypt=''
 db_hashtype=''
 db_prefixtype=''
 i_crypt=''
 db_hashtype=''
 db_prefixtype=''
@@ -868,9 +887,16 @@ i_limits=''
 i_locale=''
 i_machcthr=''
 i_malloc=''
 i_locale=''
 i_machcthr=''
 i_malloc=''
+i_mallocmalloc=''
 i_math=''
 i_memory=''
 i_mntent=''
 i_math=''
 i_memory=''
 i_mntent=''
+d_gdbm_ndbm_h_uses_prototypes=''
+d_gdbmndbm_h_uses_prototypes=''
+d_ndbm=''
+d_ndbm_h_uses_prototypes=''
+i_gdbm_ndbm=''
+i_gdbmndbm=''
 i_ndbm=''
 i_netdb=''
 i_neterrno=''
 i_ndbm=''
 i_netdb=''
 i_neterrno=''
@@ -911,6 +937,7 @@ i_sysmode=''
 i_sysmount=''
 i_sysndir=''
 i_sysparam=''
 i_sysmount=''
 i_sysndir=''
 i_sysparam=''
+i_syspoll=''
 i_sysresrc=''
 i_syssecrt=''
 i_sysselct=''
 i_sysresrc=''
 i_syssecrt=''
 i_sysselct=''
@@ -1056,6 +1083,7 @@ i8size=''
 i8type=''
 ivsize=''
 ivtype=''
 i8type=''
 ivsize=''
 ivtype=''
+nv_overflows_integers_at=''
 nv_preserves_uv_bits=''
 nvsize=''
 nvtype=''
 nv_preserves_uv_bits=''
 nvsize=''
 nvtype=''
@@ -1164,6 +1192,10 @@ stdchar=''
 d_stdio_stream_array=''
 stdio_stream_array=''
 sysman=''
 d_stdio_stream_array=''
 stdio_stream_array=''
 sysman=''
+sGMTIME_max=''
+sGMTIME_min=''
+sLOCALTIME_max=''
+sLOCALTIME_min=''
 trnl=''
 uidformat=''
 uidsign=''
 trnl=''
 uidformat=''
 uidsign=''
@@ -1172,6 +1204,8 @@ uidtype=''
 archname64=''
 use64bitall=''
 use64bitint=''
 archname64=''
 use64bitall=''
 use64bitint=''
+dtrace=''
+usedtrace=''
 usefaststdio=''
 ccflags_uselargefiles=''
 ldflags_uselargefiles=''
 usefaststdio=''
 ccflags_uselargefiles=''
 ldflags_uselargefiles=''
@@ -1233,6 +1267,7 @@ yacc=''
 yaccflags=''
 CONFIG=''
 
 yaccflags=''
 CONFIG=''
 
+: Detect odd OSs
 define='define'
 undef='undef'
 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
 define='define'
 undef='undef'
 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
@@ -1262,12 +1297,12 @@ elif test -d c:/. -o -n "$is_os2" ; then
     _exe=".exe"
 fi
 
     _exe=".exe"
 fi
 
+groupstype=''
 i_whoami=''
 : Trailing extension.  Override this in a hint file, if needed.
 : Extra object files, if any, needed on this platform.
 archobjs=''
 archname=''
 i_whoami=''
 : Trailing extension.  Override this in a hint file, if needed.
 : Extra object files, if any, needed on this platform.
 archobjs=''
 archname=''
-groupstype=''
 libnames=''
 : change the next line if compiling for Xenix/286 on Xenix/386
 xlibpth='/usr/lib/386 /lib/386'
 libnames=''
 : change the next line if compiling for Xenix/286 on Xenix/386
 xlibpth='/usr/lib/386 /lib/386'
@@ -1291,9 +1326,6 @@ plibpth=''
 libswanted=''
 : some systems want to use only the non-versioned libso:s
 ignore_versioned_solibs=''
 libswanted=''
 : some systems want to use only the non-versioned libso:s
 ignore_versioned_solibs=''
-siteman1dir=''
-siteman3dir=''
-sitescript=''
 : set usethreads on the Configure command line to enable threads.
 usereentrant='undef'
 : full support for void wanted by default
 : set usethreads on the Configure command line to enable threads.
 usereentrant='undef'
 : full support for void wanted by default
@@ -1401,14 +1433,14 @@ if `$sh -c '#' >/dev/null 2>&1`; then
        echo "#!$xcat" >sharp
        $eunicefix sharp
        chmod +x sharp
        echo "#!$xcat" >sharp
        $eunicefix sharp
        chmod +x sharp
-       ./sharp > today
+       ./sharp > today 2>/dev/null
        if test -s today; then
                sharpbang='#!'
        else
                echo "#! $xcat" > sharp
                $eunicefix sharp
                chmod +x sharp
        if test -s today; then
                sharpbang='#!'
        else
                echo "#! $xcat" > sharp
                $eunicefix sharp
                chmod +x sharp
-               ./sharp > today
+               ./sharp > today 2>/dev/null
                if test -s today; then
                        sharpbang='#! '
                else
                if test -s today; then
                        sharpbang='#! '
                else
@@ -1451,11 +1483,10 @@ else
 fi
 rm -f sharp
 
 fi
 rm -f sharp
 
-
 : Save command line options in file UU/cmdline.opt for later use in
 : generating config.sh.
 cat > cmdline.opt <<EOSH
 : Save command line options in file UU/cmdline.opt for later use in
 : generating config.sh.
 cat > cmdline.opt <<EOSH
-# Configure command line arguments.
+: Configure command line arguments.
 config_arg0='$0'
 config_args='$*'
 config_argc=$#
 config_arg0='$0'
 config_args='$*'
 config_argc=$#
@@ -1467,7 +1498,6 @@ for arg in "$@"; do
        cat >>cmdline.opt <<EOSH
 config_arg$argn='$arg'
 EOSH
        cat >>cmdline.opt <<EOSH
 config_arg$argn='$arg'
 EOSH
-       # Extreme backslashitis: replace each ' by '"'"'
        cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
 $arg
 EOC
        cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
 $arg
 EOC
@@ -1476,8 +1506,6 @@ EOC
        argn=`expr $argn + 1`
        args_sep=' '
 done
        argn=`expr $argn + 1`
        args_sep=' '
 done
-# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
-# used by ./hints/os2.sh
 rm -f cmdl.opt
 
 : produce awk script to parse command line options
 rm -f cmdl.opt
 
 : produce awk script to parse command line options
@@ -1565,6 +1593,7 @@ while test $# -gt 0; do
                fi
                cd UU
                shift;;
                fi
                cd UU
                shift;;
+       --help|\
        -h) shift; error=true;;
        -r) shift; reuseval=true;;
        -s) shift; silent=true; realsilent=true;;
        -h) shift; error=true;;
        -r) shift; reuseval=true;;
        -s) shift; silent=true; realsilent=true;;
@@ -1608,7 +1637,7 @@ while test $# -gt 0; do
                  case "$zzz" in
                  *:*) zzz='' ;;
                  *)   xxx=append
                  case "$zzz" in
                  *:*) zzz='' ;;
                  *)   xxx=append
-                      zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
+                      zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
                  esac
                  ;;
                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
                  esac
                  ;;
@@ -1622,7 +1651,7 @@ while test $# -gt 0; do
                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
                  esac
                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
                  esac
-                 ;;       
+                 ;;
             esac
            case "$xxx" in
            append)
             esac
            case "$xxx" in
            append)
@@ -1647,7 +1676,7 @@ while test $# -gt 0; do
            esac
            shift
            ;;
            esac
            shift
            ;;
-       -V) echo "$me generated by metaconfig 3.0 PL70." >&2
+       -V) echo "$me generated by metaconfig 3.5 PL0." >&2
            exit 0;;
        --) break;;
        -*) echo "$me: unknown option $1" >&2; shift; error=true;;
            exit 0;;
        --) break;;
        -*) echo "$me: unknown option $1" >&2; shift; error=true;;
@@ -1669,6 +1698,14 @@ Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
   -D : define symbol to have some value:
          -D symbol         symbol gets the value 'define'
          -D symbol=value   symbol gets the value 'value'
   -D : define symbol to have some value:
          -D symbol         symbol gets the value 'define'
          -D symbol=value   symbol gets the value 'value'
+       common used examples (see INSTALL for more info):
+         -Duse64bitint            use 64bit integers
+         -Duse64bitall            use 64bit integers and pointers
+         -Dusethreads             use thread support
+         -Dinc_version_list=none  do not include older perl trees in @INC
+         -DEBUGGING=none          DEBUGGING options
+         -Dcc=gcc                 choose your compiler
+         -Dprefix=/opt/perl5      choose your destination
   -E : stop at the end of questions, after having produced config.sh.
   -K : do not use unless you know what you are doing.
   -O : let -D and -U override definitions from loaded configuration file.
   -E : stop at the end of questions, after having produced config.sh.
   -K : do not use unless you know what you are doing.
   -O : let -D and -U override definitions from loaded configuration file.
@@ -1676,16 +1713,19 @@ Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
   -U : undefine symbol:
          -U symbol    symbol gets the value 'undef'
          -U symbol=   symbol gets completely empty
   -U : undefine symbol:
          -U symbol    symbol gets the value 'undef'
          -U symbol=   symbol gets completely empty
+       e.g.:  -Uversiononly
   -A : manipulate symbol after the platform specific hints have been applied:
   -A : manipulate symbol after the platform specific hints have been applied:
-        -A symbol=value                append " "value to symbol
-        -A append:symbol=value         append value to symbol
-        -A define:symbol=value         define symbol to have value
-         -A clear:symbol               define symbol to be ''
-        -A define:symbol               define symbol to be 'define'
-        -A eval:symbol=value           define symbol to be eval of value
-        -A prepend:symbol=value        prepend value to symbol
-        -A undef:symbol                define symbol to be 'undef'
-        -A undef:symbol=               define symbol to be ''
+         -A append:symbol=value   append value to symbol
+         -A symbol=value          like append:, but with a separating space
+         -A define:symbol=value   define symbol to have value
+         -A clear:symbol          define symbol to be ''
+         -A define:symbol         define symbol to be 'define'
+         -A eval:symbol=value     define symbol to be eval of value
+         -A prepend:symbol=value  prepend value to symbol
+         -A undef:symbol          define symbol to be 'undef'
+         -A undef:symbol=         define symbol to be ''
+       e.g.:  -A prepend:libswanted='cl pthread '
+              -A ccflags=-DSOME_MACRO
   -V : print version number and exit (with a zero status).
 EOM
        exit 1
   -V : print version number and exit (with a zero status).
 EOM
        exit 1
@@ -1720,7 +1760,7 @@ touch optdef.sh
 touch posthint.sh
 
 : set package name
 touch posthint.sh
 
 : set package name
-package=perl5
+package='perl5'
 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
@@ -1766,11 +1806,11 @@ case "$src" in
 '')    src=/
        rsrc=/
        ;;
 '')    src=/
        rsrc=/
        ;;
-/*) rsrc="$src";;
-*) rsrc="../$src";;
+/*)    rsrc="$src";;
+*)     rsrc="../$src";;
 esac
 if test -f $rsrc/Configure && \
 esac
 if test -f $rsrc/Configure && \
-       $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
+       $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
 then
    : found it, so we are ok.
 else
 then
    : found it, so we are ok.
 else
@@ -1924,11 +1964,13 @@ rm -f .echotmp
 echo " "
 if test -f "$rsrc/MANIFEST"; then
        echo "First let's make sure your kit is complete.  Checking..." >&4
 echo " "
 if test -f "$rsrc/MANIFEST"; then
        echo "First let's make sure your kit is complete.  Checking..." >&4
-       awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
+       awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
+               (split -l 50 2>/dev/null || split -50)
        rm -f missing
        tmppwd=`pwd`
        for filelist in x??; do
        rm -f missing
        tmppwd=`pwd`
        for filelist in x??; do
-               (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
+               (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
+                       >/dev/null 2>>"$tmppwd/missing")
        done
        if test -s missing; then
                cat missing >&4
        done
        if test -s missing; then
                cat missing >&4
@@ -1962,8 +2004,8 @@ else
 fi
 rm -f missing x??
 
 fi
 rm -f missing x??
 
-echo " "
 : Find the appropriate value for a newline for tr
 : Find the appropriate value for a newline for tr
+echo " "
 if test -n "$DJGPP"; then
        trnl='\012'
 fi
 if test -n "$DJGPP"; then
        trnl='\012'
 fi
@@ -2107,9 +2149,11 @@ persist across sessions for $package.
 You may safely delete it if you wish.
 EOF
 
 You may safely delete it if you wish.
 EOF
 
+: See if we are using a devel version and want that
 xversion=`awk '/define[        ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
 case "$usedevel" in
 xversion=`awk '/define[        ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
 case "$usedevel" in
-$define|true|[yY]*) ;;
+$define|true|[yY]*)
+    usedevel="$define" ;;
 *) case "$xversion" in
    *[13579])
        cat >&4 <<EOH
 *) case "$xversion" in
    *[13579])
        cat >&4 <<EOH
@@ -2142,6 +2186,7 @@ EOH
        esac
        ;;
     esac
        esac
        ;;
     esac
+    usedevel="$undef"
     ;;
 esac
 case "$usedevel" in
     ;;
 esac
 case "$usedevel" in
@@ -2267,14 +2312,13 @@ for dir in \$*; do
                exit 0
        elif test "X$_exe" != X -a -f \$thisthing$_exe; then
                echo \$thisthing
                exit 0
        elif test "X$_exe" != X -a -f \$thisthing$_exe; then
                echo \$thisthing
-               exit 0
+               exit 0
        elif test -f \$dir/\$thing.exe; then
                if test -n "$DJGPP"; then
                        echo \$dir/\$thing.exe
                elif test "$eunicefix" != ":"; then
                        : on Eunice apparently
                        echo \$dir/\$thing
        elif test -f \$dir/\$thing.exe; then
                if test -n "$DJGPP"; then
                        echo \$dir/\$thing.exe
                elif test "$eunicefix" != ":"; then
                        : on Eunice apparently
                        echo \$dir/\$thing
-                       exit 0
                fi
                exit 0
        fi
                fi
                exit 0
        fi
@@ -2305,7 +2349,6 @@ tr
 uniq
 "
 trylist="
 uniq
 "
 trylist="
-Mcc
 ar
 bison
 byacc
 ar
 bison
 byacc
@@ -2405,7 +2448,7 @@ ln)
        ;;
 esac
 case "$make" in
        ;;
 esac
 case "$make" in
-make)  
+make)
        case "$gmake" in
        gmake)
        echo "I can't find make or gmake, and my life depends on it." >&4
        case "$gmake" in
        gmake)
        echo "I can't find make or gmake, and my life depends on it." >&4
@@ -2414,7 +2457,7 @@ make)
        ;;
        esac
        ;;
        ;;
        esac
        ;;
-esac   
+esac
 case "$gmake" in
 gmake) ;;
 *)     # We can't have osname yet.
 case "$gmake" in
 gmake) ;;
 *)     # We can't have osname yet.
@@ -2470,6 +2513,20 @@ FOO
        ;;
 esac
 
        ;;
 esac
 
+# This question was auctioned at YAPC::Europe-2007 in Vienna
+# I never promised you could answer it. I only auctioned the question.
+cat <<FOO
+The following message is sponsored by
+
+  Dresden.pm<--The stars should be here.
+
+Dear Perl user, system administrator or package
+maintainer, the Perl community sends greetings to
+you. Do you (emblematical) greet back [Y/n]? n
+
+FOO
+
+: Check what type of C compiler we use
 cat <<EOS >trygcc
 $startsh
 EOS
 cat <<EOS >trygcc
 $startsh
 EOS
@@ -2491,15 +2548,36 @@ EOM
         case "$cc" in
         *gcc*) trygcc=no ;;
         esac
         case "$cc" in
         *gcc*) trygcc=no ;;
         esac
-        case "`$cc -v -c try.c 2>&1`" in
-        *gcc*) trygcc=no ;;
-        esac
+       # Skip this test because it gives a false match on output like:
+       #    ./trygcc: line 23: cc: command not found
+        # case "`$cc -v -c try.c 2>&1`" in
+        # *gcc*) trygcc=no ;;
+        # esac
         if $test X"$trygcc" = Xyes; then
             if gcc -o try -c try.c; then
                 echo " "
                 echo "You seem to have a working gcc, though." >&4
         if $test X"$trygcc" = Xyes; then
             if gcc -o try -c try.c; then
                 echo " "
                 echo "You seem to have a working gcc, though." >&4
-                rp="Would you like to use it?"
-                dflt=y
+               # Switching compilers may undo the work of hints files.
+               # The most common problem is -D_REENTRANT for threads.
+               # This heuristic catches that case, but gets false positives
+               # if -Dusethreads was not actually specified.  Better to
+               # bail out here with a useful message than fail 
+               # mysteriously later. Should we perhaps just try to
+               # re-invoke Configure -Dcc=gcc config_args ?
+               if $test -f usethreads.cbu; then
+                       $cat >&4 <<EOM 
+
+*** However, any setting of the C compiler flags (e.g. for thread support)
+*** will be lost.  It may be necessary for you to restart Configure and
+*** add -Dcc=gcc to your Configure command line.
+
+EOM
+                       rp="Would you like to go ahead and try gcc anyway?"
+                       dflt=n
+               else
+                       rp="Would you like to use it?"
+                       dflt=y
+               fi
                 if $test -f myread; then
                     . ./myread
                 else
                 if $test -f myread; then
                     . ./myread
                 else
@@ -2512,15 +2590,6 @@ EOM
                 fi  
                 case "$ans" in
                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
                 fi  
                 case "$ans" in
                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
-                       if $test -f usethreads.cbu; then
-                           $cat >&4 <<EOM 
-
-*** However, any setting of the C compiler flags (e.g. for thread support)
-*** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
-*** (together with e.g. -Dusethreads).
-
-EOM
-                       fi;;
                 esac
             fi
         fi
                 esac
             fi
         fi
@@ -2631,7 +2700,7 @@ case "$lns" in
 esac
 echo " "
 
 esac
 echo " "
 
-
+: Make symlinks util
 case "$mksymlinks" in
 $define|true|[yY]*)
        case "$src" in
 case "$mksymlinks" in
 $define|true|[yY]*)
        case "$src" in
@@ -2683,7 +2752,7 @@ $define|true|[yY]*)
        ;;
 esac
 
        ;;
 esac
 
-
+: Check for Cross-Compilation
 case "$usecrosscompile" in
 $define|true|[yY]*)
        $echo "Cross-compiling..."
 case "$usecrosscompile" in
 $define|true|[yY]*)
        $echo "Cross-compiling..."
@@ -3002,7 +3071,7 @@ myuname=`$uname -a 2>/dev/null`
 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
 # because the A-Z/a-z are not consecutive.
 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
 # because the A-Z/a-z are not consecutive.
-myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
+myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
        ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
 newmyuname="$myuname"
 dflt=n
        ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
 newmyuname="$myuname"
 dflt=n
@@ -3552,10 +3621,10 @@ cat >filexp <<EOSS
 $startsh
 : expand filename
 case "\$1" in
 $startsh
 : expand filename
 case "\$1" in
~/*|~)
\~/*|\~)
        echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
        ;;
        echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
        ;;
- ~*)
\~*)
        if $test -f /bin/csh; then
                /bin/csh -f -c "glob \$1"
                failed=\$?
        if $test -f /bin/csh; then
                /bin/csh -f -c "glob \$1"
                failed=\$?
@@ -3862,6 +3931,7 @@ esac
 prefix="$ans"
 prefixexp="$ansexp"
 
 prefix="$ans"
 prefixexp="$ansexp"
 
+: allow them to override the AFS root
 case "$afsroot" in
 '')    afsroot=/afs ;;
 *)     afsroot=$afsroot ;;
 case "$afsroot" in
 '')    afsroot=/afs ;;
 *)     afsroot=$afsroot ;;
@@ -3872,7 +3942,7 @@ echo " "
 case "$afs" in
 $define|true)  afs=true ;;
 $undef|false)  afs=false ;;
 case "$afs" in
 $define|true)  afs=true ;;
 $undef|false)  afs=false ;;
-*)     if test -d $afsroot; then
+*)     if $test -d $afsroot; then
                afs=true
        else
                afs=false
                afs=true
        else
                afs=false
@@ -3974,7 +4044,7 @@ y) td=$was; tu=$was;;
 esac
 EOSC
 
 esac
 EOSC
 
-: function used to set $1 to $val
+: function used to set '$1' to '$val'
 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
 case "$val$was" in
 $define$undef) . ./whoa; eval "$var=\$td";;
 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
 case "$val$was" in
 $define$undef) . ./whoa; eval "$var=\$td";;
@@ -3982,6 +4052,7 @@ $undef$define) . ./whoa; eval "$var=\$tu";;
 *) eval "$var=$val";;
 esac'
 
 *) eval "$var=$val";;
 esac'
 
+: Check is we will use socks
 case "$usesocks" in
 $define|true|[yY]*)    dflt='y';;
 *) dflt='n';;
 case "$usesocks" in
 $define|true|[yY]*)    dflt='y';;
 *) dflt='n';;
@@ -3997,7 +4068,7 @@ EOM
 rp='Build Perl for SOCKS?'
 . ./myread
 case "$ans" in
 rp='Build Perl for SOCKS?'
 . ./myread
 case "$ans" in
-y|Y)   val="$define" ;;     
+y|Y)   val="$define" ;;
 *)      val="$undef" ;;
 esac
 set usesocks
 *)      val="$undef" ;;
 esac
 set usesocks
@@ -4007,6 +4078,7 @@ case "$usesocks" in
 $define|true|[yY]*) useperlio="$define";;
 esac
 
 $define|true|[yY]*) useperlio="$define";;
 esac
 
+: Check if we want perlio
 case "$useperlio" in
 $define|true|[yY]*|'') dflt='y';;
 *) dflt='n';;
 case "$useperlio" in
 $define|true|[yY]*|'') dflt='y';;
 *) dflt='n';;
@@ -4025,16 +4097,16 @@ EOM
 rp='Use the PerlIO abstraction layer?'
 . ./myread
 case "$ans" in
 rp='Use the PerlIO abstraction layer?'
 . ./myread
 case "$ans" in
-y|Y) 
+y|Y)
        val="$define"
        ;;
        val="$define"
        ;;
-*)      
+*)
        echo "Ok, doing things the stdio way."
        val="$undef"
        ;;
 esac
 set useperlio
        echo "Ok, doing things the stdio way."
        val="$undef"
        ;;
 esac
 set useperlio
-eval $setvar 
+eval $setvar
 
 case "$usesocks" in
 $define|true|[yY]*)
 
 case "$usesocks" in
 $define|true|[yY]*)
@@ -4051,7 +4123,6 @@ EOM
        ;;
 esac
 
        ;;
 esac
 
-       
 : get the patchlevel
 echo " "
 echo "Getting the current patchlevel..." >&4
 : get the patchlevel
 echo " "
 echo "Getting the current patchlevel..." >&4
@@ -4062,7 +4133,7 @@ if $test -r $rsrc/patchlevel.h;then
        api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
        api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
        api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
        api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
        api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
        api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
-       perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
+       perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
 else
        revision=0
        patchlevel=0
 else
        revision=0
        patchlevel=0
@@ -4082,7 +4153,9 @@ fi
 version_patchlevel_string="version $patchlevel subversion $subversion"
 case "$perl_patchlevel" in
 0|'') ;;
 version_patchlevel_string="version $patchlevel subversion $subversion"
 case "$perl_patchlevel" in
 0|'') ;;
-*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
+*)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
+    version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
+    ;;
 esac
 
 $echo "(You have $package $version_patchlevel_string.)"
 esac
 
 $echo "(You have $package $version_patchlevel_string.)"
@@ -4108,12 +4181,13 @@ if test "${api_revision}${api_version}${api_subversion}" = "550"; then
        api_versionstring='5.005'
 fi
 
        api_versionstring='5.005'
 fi
 
+: Do we want threads support and if so, what type
 case "$usethreads" in
 $define|true|[yY]*)     dflt='y';;
 *)     # Catch case where user specified ithreads or 5005threads but
        # forgot -Dusethreads (A.D. 4/2002)
        case "$useithreads$use5005threads" in
 case "$usethreads" in
 $define|true|[yY]*)     dflt='y';;
 *)     # Catch case where user specified ithreads or 5005threads but
        # forgot -Dusethreads (A.D. 4/2002)
        case "$useithreads$use5005threads" in
-       *$define*)      
+       *$define*)
                case "$useperlio" in
                "$define")      dflt='y' ;;
                *)              dflt='n' ;;
                case "$useperlio" in
                "$define")      dflt='y' ;;
                *)              dflt='n' ;;
@@ -4205,29 +4279,20 @@ EOM
 else
 : perl-5.9.x and later
 
 else
 : perl-5.9.x and later
 
-    use5005threads="$undef"
-    case "$usethreads" in
-    $define)
-       : Default to ithreads unless overridden on command line or with
-       : old config.sh
-       dflt='y'
-       case "$useithreads" in
-               $undef|false|[nN]*) dflt='n';;
-       esac
-       rp='Use the newer interpreter-based ithreads?'
-       . ./myread
-       case "$ans" in
-       y|Y)    val="$define" ;;
-       *)      val="$undef" ;;
+    if test X"$usethreads" = "X$define"; then
+       case "$use5005threads" in
+           $define|true|[yY]*)
+               $cat >&4 <<EOM
+
+5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
+
+EOM
+           ;;
        esac
        esac
-       set useithreads
-       eval $setvar
-       ;;
-    *)
-       useithreads="$undef"
-       ;;
-    esac
+    fi
 
 
+    use5005threads="$undef"
+    useithreads="$usethreads"
 fi
 
 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
 fi
 
 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
@@ -4266,6 +4331,7 @@ EOM
     esac
 fi
 
     esac
 fi
 
+: Check if multiplicity is required
 cat <<EOM
 
 Perl can be built so that multiple Perl interpreters can coexist
 cat <<EOM
 
 Perl can be built so that multiple Perl interpreters can coexist
@@ -4296,7 +4362,7 @@ esac
 set usemultiplicity
 eval $setvar
 
 set usemultiplicity
 eval $setvar
 
-
+: Check if morebits is requested
 case "$usemorebits" in
 "$define"|true|[yY]*)
        use64bitint="$define"
 case "$usemorebits" in
 "$define"|true|[yY]*)
        use64bitint="$define"
@@ -4307,6 +4373,23 @@ case "$usemorebits" in
        ;;
 esac
 
        ;;
 esac
 
+: Determine the C compiler to be used
+echo " "
+case "$cc" in
+'') dflt=cc;;
+*) dflt="$cc";;
+esac
+rp="Use which C compiler?"
+. ./myread
+cc="$ans"
+
+: See whether they have no cc but they do have gcc
+. ./trygcc
+if $test -f cc.cbu; then
+    . ./cc.cbu
+fi
+. ./checkcc
+
 : make some quick guesses about what we are up against
 echo " "
 $echo $n "Hmm...  $c"
 : make some quick guesses about what we are up against
 echo " "
 $echo $n "Hmm...  $c"
@@ -4402,24 +4485,7 @@ chmod +x bsd usg v7 osf1 eunice xenix venix os2
 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
 $rm -f foo
 
 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
 $rm -f foo
 
-case "$cc" in
-'') dflt=cc;;
-*) dflt="$cc";;
-esac
-rp="Use which C compiler?"
-. ./myread
-cc="$ans"
-
-: See if they have not cc but they do have gcc
-. ./trygcc
-: Look for a hint-file generated 'call-back-unit'.  Now that the
-: user has specified the compiler, we may need to set or change some
-: other defaults.
-if $test -f cc.cbu; then
-    . ./cc.cbu
-fi
-. ./checkcc
-
+: Check if we are using GNU gcc and what its version is
 echo " "
 echo "Checking for GNU cc in disguise and/or its version number..." >&4
 $cat >try.c <<EOM
 echo " "
 echo "Checking for GNU cc in disguise and/or its version number..." >&4
 $cat >try.c <<EOM
@@ -4807,11 +4873,14 @@ lib_ext=$_a
 obj_ext=$_o
 path_sep=$p_
 
 obj_ext=$_o
 path_sep=$p_
 
+rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
+
 : Which makefile gets called first.  This is used by make depend.
 case "$firstmakefile" in
 '') firstmakefile='makefile';;
 esac
 
 : Which makefile gets called first.  This is used by make depend.
 case "$firstmakefile" in
 '') firstmakefile='makefile';;
 esac
 
+: Check for uselongdouble support
 case "$ccflags" in
 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
 esac
 case "$ccflags" in
 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
 esac
@@ -4888,7 +4957,7 @@ for thislib in $libswanted; do
                xxx=$thisdir/lib$thislib.$so
                $test -f "$xxx" && eval $libscheck
                $test -f "$xxx" && libstyle=shared
                xxx=$thisdir/lib$thislib.$so
                $test -f "$xxx" && eval $libscheck
                $test -f "$xxx" && libstyle=shared
-           fi  
+           fi
            if test ! -f "$xxx"; then
                xxx=$thisdir/lib$thislib$_a
                $test -f "$xxx" && eval $libscheck
            if test ! -f "$xxx"; then
                xxx=$thisdir/lib$thislib$_a
                $test -f "$xxx" && eval $libscheck
@@ -4930,7 +4999,7 @@ for thislib in $libswanted; do
                   ;;
                esac
                break
                   ;;
                esac
                break
-           fi  
+           fi
        done
        if $test ! -f "$xxx"; then
            echo "No -l$thislib."
        done
        if $test ! -f "$xxx"; then
            echo "No -l$thislib."
@@ -5014,6 +5083,32 @@ case "$DEBUGGING" in
 both|$define) dflt='-DDEBUGGING'
 esac
 
 both|$define) dflt='-DDEBUGGING'
 esac
 
+: argument order is deliberate, as the flag will start with - which set could
+: think is an option
+checkccflag='check=$1; flag=$2; callback=$3;
+echo " ";
+echo "Checking if your compiler accepts $flag" 2>&1;
+echo "int main(void) { return 0; }" > gcctest.c;
+if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
+    echo "Yes, it does." 2>&1;
+    if $test -s gcctest.out ; then
+        echo "But your platform does not like it:";
+        cat gcctest.out;
+    else
+       case "$ccflags" in
+       *$check*)
+           echo "Leaving current flags $ccflags alone." 2>&1
+           ;;
+       *) dflt="$dflt $flag";
+           eval $callback
+           ;;
+       esac
+    fi
+else
+    echo "Nope, it does not, but that is ok." 2>&1;
+fi
+'
+
 : We will not override a previous value, but we might want to
 : augment a hint file
 case "$hint" in
 : We will not override a previous value, but we might want to
 : augment a hint file
 case "$hint" in
@@ -5025,7 +5120,7 @@ default|recommended)
        *-g*:old) dflt="$dflt -DDEBUGGING";;
        esac
        case "$gccversion" in
        *-g*:old) dflt="$dflt -DDEBUGGING";;
        esac
        case "$gccversion" in
-       2*) if test -d /etc/conf/kconfig.d &&
+       2*) if $test -d /etc/conf/kconfig.d &&
                        $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
                then
                        # Interactive Systems (ISC) POSIX mode.
                        $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
                then
                        # Interactive Systems (ISC) POSIX mode.
@@ -5036,40 +5131,28 @@ default|recommended)
        case "$gccversion" in
        1*) ;;
        2.[0-8]*) ;;
        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
+       ?*)     set strict-aliasing -fno-strict-aliasing
+               eval $checkccflag
                ;;
        esac
        # For gcc, adding -pipe speeds up compilations for some, but apparently
        # some assemblers can't read from stdin.  (It also slows down compilations
        # in other cases, but those are apparently rarer these days.)  AD 5/2004.
        case "$gccversion" in
                ;;
        esac
        # For gcc, adding -pipe speeds up compilations for some, but apparently
        # some assemblers can't read from stdin.  (It also slows down compilations
        # in other cases, but those are apparently rarer these days.)  AD 5/2004.
        case "$gccversion" in
-       ?*)     echo " "
-               echo "Checking if your compiler accepts -pipe" 2>&1
-               echo 'int main(void) { return 0; }' > gcctest.c
-               if $cc -pipe -o gcctest gcctest.c; then
-                       echo "Yes, it does." 2>&1
-                       case "$ccflags" in
-                       *-pipe*)
-                               echo "Leaving current flags $ccflags alone." 2>&1
-                               ;;
-                       *) dflt="$dflt -pipe" ;;
-                       esac
-               else
-                       echo "Nope, it doesn't, but that's ok." 2>&1
-               fi
+       ?*)     set pipe -pipe
+               eval $checkccflag
+               ;;
+       esac
+
+       # on x86_64 (at least) we require an extra library (libssp) in the
+       # link command line. This library is not named, so I infer that it is
+       # an implementation detail that may change. Hence the safest approach
+       # is to add the flag to the flags passed to the compiler at link time,
+       # as that way the compiler can do the right implementation dependant
+       # thing. (NWC)
+       case "$gccversion" in
+       ?*)     set stack-protector -fstack-protector
+               eval $checkccflag
                ;;
        esac
        ;;
                ;;
        esac
        ;;
@@ -5210,6 +5293,15 @@ case "$ldflags" in
        ;;
 *) dflt="$ldflags";;
 esac
        ;;
 *) dflt="$ldflags";;
 esac
+# See note above about -fstack-protector
+case "$ccflags" in
+*-fstack-protector*) 
+       case "$dflt" in
+       *-fstack-protector*) ;; # Don't add it again
+       *) dflt="$dflt -fstack-protector" ;; 
+       esac
+       ;;
+esac
 
 : Try to guess additional flags to pick up local libraries.
 for thislibdir in $libpth; do
 
 : Try to guess additional flags to pick up local libraries.
 for thislibdir in $libpth; do
@@ -5276,7 +5368,7 @@ and I got the following output:
 EOM
 dflt=y
 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
 EOM
 dflt=y
 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
-       if $sh -c "$run ./try" >>try.msg 2>&1; then
+       if $sh -c "$run ./try " >>try.msg 2>&1; then
                xxx=`$run ./try`
                case "$xxx" in
                "Ok") dflt=n ;;
                xxx=`$run ./try`
                case "$xxx" in
                "Ok") dflt=n ;;
@@ -5325,12 +5417,17 @@ y)
        ;;
 n) echo "OK, that should do.";;
 esac
        ;;
 n) echo "OK, that should do.";;
 esac
-$rm -f try try.* core
+$rm_try gcctest gcctest.out
 
 : define a shorthand compile call
 compile='
 mc_file=$1;
 shift;
 
 : define a shorthand compile call
 compile='
 mc_file=$1;
 shift;
+case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
+echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
+exit 1;
+fi;
+esac;
 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
 : define a shorthand compile call for compilations that should be ok.
 compile_ok='
 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
 : define a shorthand compile call for compilations that should be ok.
 compile_ok='
@@ -5500,7 +5597,7 @@ EOM
        fi
        ;;
 esac
        fi
        ;;
 esac
-$rm -f try try.*
+$rm_try
 
 : check for long long
 echo " "
 
 : check for long long
 echo " "
@@ -5514,7 +5611,7 @@ else
        val="$undef"
        echo "You do not have long long."
 fi
        val="$undef"
        echo "You do not have long long."
 fi
-$rm try.*
+$rm_try
 set d_longlong
 eval $setvar
 
 set d_longlong
 eval $setvar
 
@@ -5545,10 +5642,10 @@ EOCP
        fi
        if $test "X$longsize" = "X$longlongsize"; then
                echo "(That isn't any different from an ordinary long.)"
        fi
        if $test "X$longsize" = "X$longlongsize"; then
                echo "(That isn't any different from an ordinary long.)"
-       fi      
+       fi
        ;;
 esac
        ;;
 esac
-$rm -f try.* try
+$rm_try
 
 : see if inttypes.h is available
 : we want a real compile instead of Inhdr because some systems
 
 : see if inttypes.h is available
 : we want a real compile instead of Inhdr because some systems
@@ -5568,7 +5665,7 @@ else
        echo "<inttypes.h> NOT found." >&4
        val="$undef"
 fi
        echo "<inttypes.h> NOT found." >&4
        val="$undef"
 fi
-$rm -f try.c try
+$rm_try
 set i_inttypes
 eval $setvar
 
 set i_inttypes
 eval $setvar
 
@@ -5591,11 +5688,11 @@ else
        val="$undef"
        echo "You do not have int64_t."
 fi
        val="$undef"
        echo "You do not have int64_t."
 fi
-$rm -f try try.*
+$rm_try
 set d_int64_t
 eval $setvar
 
 set d_int64_t
 eval $setvar
 
-
+: Check if 64bit ints have a quad type
 echo " "
 echo "Checking which 64-bit integer type we could use..." >&4
 
 echo " "
 echo "Checking which 64-bit integer type we could use..." >&4
 
@@ -5654,7 +5751,7 @@ case "$quadtype" in
        ;;
 esac
 
        ;;
 esac
 
-
+: Do we want 64bit support
 case "$uselonglong" in
 "$define"|true|[yY]*)
        cat <<EOM >&4
 case "$uselonglong" in
 "$define"|true|[yY]*)
        cat <<EOM >&4
@@ -5663,7 +5760,7 @@ case "$uselonglong" in
 EOM
        use64bitint="$define"
        ;;
 EOM
        use64bitint="$define"
        ;;
-esac                          
+esac
 case "$use64bits" in
 "$define"|true|[yY]*)
        cat <<EOM >&4
 case "$use64bits" in
 "$define"|true|[yY]*)
        cat <<EOM >&4
@@ -5672,7 +5769,7 @@ case "$use64bits" in
 EOM
        use64bitint="$define"
        ;;
 EOM
        use64bitint="$define"
        ;;
-esac                          
+esac
 case "$use64bitints" in
 "$define"|true|[yY]*)
        cat <<EOM >&4
 case "$use64bitints" in
 "$define"|true|[yY]*)
        cat <<EOM >&4
@@ -5681,7 +5778,7 @@ case "$use64bitints" in
 EOM
        use64bitint="$define"
        ;;
 EOM
        use64bitint="$define"
        ;;
-esac                          
+esac
 case "$use64bitsint" in
 "$define"|true|[yY]*)
        cat <<EOM >&4
 case "$use64bitsint" in
 "$define"|true|[yY]*)
        cat <<EOM >&4
@@ -5690,7 +5787,7 @@ case "$use64bitsint" in
 EOM
        use64bitint="$define"
        ;;
 EOM
        use64bitint="$define"
        ;;
-esac                          
+esac
 case "$uselonglongs" in
 "$define"|true|[yY]*)
        cat <<EOM >&4
 case "$uselonglongs" in
 "$define"|true|[yY]*)
        cat <<EOM >&4
@@ -5699,7 +5796,7 @@ case "$uselonglongs" in
 EOM
        use64bitint="$define"
        ;;
 EOM
        use64bitint="$define"
        ;;
-esac                          
+esac
 case "$use64bitsall" in
 "$define"|true|[yY]*)
        cat <<EOM >&4
 case "$use64bitsall" in
 "$define"|true|[yY]*)
        cat <<EOM >&4
@@ -5708,7 +5805,7 @@ case "$use64bitsall" in
 EOM
        use64bitall="$define"
        ;;
 EOM
        use64bitall="$define"
        ;;
-esac                          
+esac
 
 case "$ccflags" in
 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
 
 case "$ccflags" in
 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
@@ -5759,7 +5856,7 @@ case "$use64bitall" in
    *) dflt='n' ;;
    esac
    ;;
    *) dflt='n' ;;
    esac
    ;;
-esac   
+esac
 cat <<EOM
 
 You may also choose to try maximal 64-bitness.  It means using as much
 cat <<EOM
 
 You may also choose to try maximal 64-bitness.  It means using as much
@@ -5872,7 +5969,7 @@ EOCP
        fi
        ;;
 esac
        fi
        ;;
 esac
-$rm -f try.c try
+$rm_try
 
 : check for long doubles
 echo " "
 
 : check for long doubles
 echo " "
@@ -5886,7 +5983,7 @@ else
        val="$undef"
        echo "You do not have long double."
 fi
        val="$undef"
        echo "You do not have long double."
 fi
-$rm try.*
+$rm_try
 set d_longdbl
 eval $setvar
 
 set d_longdbl
 eval $setvar
 
@@ -5919,10 +6016,10 @@ EOCP
                echo "That isn't any different from an ordinary double."
                echo "I'll keep your setting anyway, but you may see some"
                echo "harmless compilation warnings."
                echo "That isn't any different from an ordinary double."
                echo "I'll keep your setting anyway, but you may see some"
                echo "harmless compilation warnings."
-       fi      
+       fi
        ;;
 esac
        ;;
 esac
-$rm -f try.* try
+$rm_try
 
 : determine the architecture name
 echo " "
 
 : determine the architecture name
 echo " "
@@ -6277,6 +6374,7 @@ eval $setvar
 $rm -f reflect flect
 
 : now see if they want to do setuid emulation
 $rm -f reflect flect
 
 : now see if they want to do setuid emulation
+if $test $patchlevel -lt 11; then
 echo " "
 val="$undef"
 case "$d_suidsafe" in
 echo " "
 val="$undef"
 case "$d_suidsafe" in
@@ -6308,6 +6406,20 @@ EOM
 esac
 set d_dosuid
 eval $setvar
 esac
 set d_dosuid
 eval $setvar
+else
+    case "$d_dosuid" in
+       "$define")
+       cat >&4 <<EOH
+
+SUID emulation has been removed for 5.12
+Please re-run Configure without -Dd_dosuid
+
+EOH
+       exit 1;
+       ;;
+    esac
+    d_dosuid=undef
+fi
 
 : Find perl5.005 or later.
 echo "Looking for a previously installed perl5.005 or later... "
 
 : Find perl5.005 or later.
 echo "Looking for a previously installed perl5.005 or later... "
@@ -6331,6 +6443,7 @@ case "$perl5" in
 *)     echo "Using $perl5." ;;
 esac
 
 *)     echo "Using $perl5." ;;
 esac
 
+: Set the siteprefix variables
 $cat <<EOM
 
 After $package is installed, you may wish to install various
 $cat <<EOM
 
 After $package is installed, you may wish to install various
@@ -6420,6 +6533,7 @@ if (-d $stem) {
     chdir($stem);
     ;@candidates = map {
        [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
     chdir($stem);
     ;@candidates = map {
        [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
+    ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
 }
 else {
     ;@candidates = ();
 }
 else {
     ;@candidates = ();
@@ -6499,6 +6613,10 @@ case "$inc_version_list" in
 esac
 $rm -f getverlist
 
 esac
 $rm -f getverlist
 
+: see if malloc/malloc.h has to be included
+set malloc/malloc.h i_mallocmalloc
+eval $inhdr
+
 : see if this is a malloc.h system
 : we want a real compile instead of Inhdr because some systems have a
 : malloc.h that just gives a compile error saying to use stdlib.h instead
 : see if this is a malloc.h system
 : we want a real compile instead of Inhdr because some systems have a
 : malloc.h that just gives a compile error saying to use stdlib.h instead
@@ -6506,6 +6624,11 @@ echo " "
 $cat >try.c <<EOCP
 #include <stdlib.h>
 #include <malloc.h>
 $cat >try.c <<EOCP
 #include <stdlib.h>
 #include <malloc.h>
+#$i_mallocmalloc I_MALLOCMALLOC
+#ifdef I_MALLOCMALLOC
+# include <malloc/malloc.h>
+#endif
+
 int main () { return 0; }
 EOCP
 set try
 int main () { return 0; }
 EOCP
 set try
@@ -6516,7 +6639,7 @@ else
     echo "<malloc.h> NOT found." >&4
     val="$undef"
 fi
     echo "<malloc.h> NOT found." >&4
     val="$undef"
 fi
-$rm -f try.c try
+$rm_try
 set i_malloc
 eval $setvar
 
 set i_malloc
 eval $setvar
 
@@ -6614,7 +6737,7 @@ EOM
        voidflags="$ans"
        ;;
 esac
        voidflags="$ans"
        ;;
 esac
-$rm -f try try.* .out
+$rm_try
 
 : check for length of pointer
 echo " "
 
 : check for length of pointer
 echo " "
@@ -6651,7 +6774,7 @@ EOCP
        fi
        ;;
 esac
        fi
        ;;
 esac
-$rm -f try.c try
+$rm_try
 case "$use64bitall" in
 "$define"|true|[yY]*)
        case "$ptrsize" in
 case "$use64bitall" in
 "$define"|true|[yY]*)
        case "$ptrsize" in
@@ -6812,6 +6935,7 @@ else
        d_sitearch="$define"
 fi
 
        d_sitearch="$define"
 fi
 
+: Set the vendorprefix variables
 $cat <<EOM
 
 The installation process will also create a directory for
 $cat <<EOM
 
 The installation process will also create a directory for
@@ -6868,6 +6992,7 @@ case "$ans" in
        ;;
 esac
 
        ;;
 esac
 
+: Set the vendorlib variables
 case "$vendorprefix" in
 '')    d_vendorlib="$undef"
        vendorlib=''
 case "$vendorprefix" in
 '')    d_vendorlib="$undef"
        vendorlib=''
@@ -6898,6 +7023,7 @@ vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
 prefixvar=vendorlib
 . ./installprefix
 
 prefixvar=vendorlib
 . ./installprefix
 
+: Set the vendorarch variables
 case "$vendorprefix" in
 '')    d_vendorarch="$undef"
        vendorarch=''
 case "$vendorprefix" in
 '')    d_vendorarch="$undef"
        vendorarch=''
@@ -6923,6 +7049,11 @@ case "$vendorprefix" in
 esac
 prefixvar=vendorarch
 . ./installprefix
 esac
 prefixvar=vendorarch
 . ./installprefix
+if $test X"$vendorarch" = X"$vendorlib"; then
+       d_vendorarch="$undef"
+else
+       d_vendorarch="$define"
+fi
 
 : Final catch-all directories to search
 $cat <<EOM
 
 : Final catch-all directories to search
 $cat <<EOM
@@ -6981,6 +7112,7 @@ set prototype
 eval $setvar
 $rm -f prototype*
 
 eval $setvar
 $rm -f prototype*
 
+: Check if ansi2knr is required
 case "$prototype" in
 "$define") ;;
 *)     ansi2knr='ansi2knr'
 case "$prototype" in
 "$define") ;;
 *)     ansi2knr='ansi2knr'
@@ -7004,6 +7136,89 @@ EOM
        ;;
 esac
 
        ;;
 esac
 
+: DTrace support
+dflt_dtrace='/usr/sbin/dtrace'
+cat <<EOM
+
+Perl can be built to support DTrace on platforms that support it.
+DTrace is a diagnosis and performance analysis tool from Sun.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+
+while $test 1 ; do
+       case "$usedtrace" in
+       $define|true|[yY]*)
+               dflt='y'
+               ;;
+       ?*)
+               dflt='y'
+               dflt_dtrace=$usedtrace
+               ;;
+       *)
+               dflt='n'
+               ;;
+       esac
+
+       rp='Support DTrace if available?'
+       . ./myread
+       case "$ans" in
+       y|Y)    val="$define" ;;
+       *)      val="$undef" ;;
+       esac
+       set usedtrace
+       eval $setvar
+
+       test "X$usedtrace" != "X$define" && break
+
+       echo " "
+       rp='Where is the dtrace executable?'
+       dflt=$dflt_dtrace
+       . ./getfile
+       val="$ans"
+       set dtrace
+       eval $setvar
+
+       if $test -f $dtrace
+       then
+               if $dtrace -h -s ../perldtrace.d \
+                       -o perldtrace.tmp >/dev/null 2>&1 \
+                       && rm -f perldtrace.tmp
+               then
+                       echo " "
+                       echo "Good: your $dtrace knows about the -h flag."
+               else
+                       cat >&2 <<EOM
+
+*** $me:  Fatal Error:  $dtrace doesn't support -h flag
+***
+*** Your installed dtrace doesn't support the -h switch to compile a D
+*** program into a C header. Can't continue.
+
+EOM
+                       exit 1
+               fi
+               break;
+       fi
+
+       case "$fastread" in
+       yes)
+               cat >&2 <<EOM
+
+*** $me:  Fatal Error:  $dtrace not found.
+*** Can't continue.
+
+EOM
+               exit 1
+               ;;
+       *)
+               echo "*** $dtrace was not found."
+               echo " "
+               ;;
+       esac
+done
+
+: See if we want extra modules installed
 echo " "
 case "$extras" in
 '') dflt='n';;
 echo " "
 case "$extras" in
 '') dflt='n';;
@@ -7145,6 +7360,7 @@ fi
 set installusrbinperl
 eval $setvar
 
 set installusrbinperl
 eval $setvar
 
+: Check if we are using the GNU C library
 echo " "
 echo "Checking for GNU C Library..." >&4
 cat >try.c <<'EOCP'
 echo " "
 echo "Checking for GNU C Library..." >&4
 cat >try.c <<'EOCP'
@@ -7183,7 +7399,7 @@ else
        gnulibc_version=''
        echo "You are not using the GNU C Library"
 fi
        gnulibc_version=''
        echo "You are not using the GNU C Library"
 fi
-$rm -f try try.* glibc.ver
+$rm_try glibc.ver
 set d_gnulibc
 eval $setvar
 
 set d_gnulibc
 eval $setvar
 
@@ -7278,6 +7494,7 @@ case "$nm_so_opt" in
        ;;
 esac
 
        ;;
 esac
 
+: Figure out where the libc is located
 case "$runnm" in
 true)
 : get list of predefined functions in a handy place
 case "$runnm" in
 true)
 : get list of predefined functions in a handy place
@@ -7507,31 +7724,31 @@ else
                echo " "
                echo "$nm didn't seem to work right. Trying $ar instead..." >&4
                com=''
                echo " "
                echo "$nm didn't seem to work right. Trying $ar instead..." >&4
                com=''
-               if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
+               if $ar t $libc > libc.tmp && \
+                       $contains '^fprintf$' libc.tmp >/dev/null 2>&1
+               then
                        for thisname in $libnames $libc; do
                                $ar t $thisname >>libc.tmp
                        done
                        $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
                        echo "Ok." >&4
                elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
                        for thisname in $libnames $libc; do
                                $ar t $thisname >>libc.tmp
                        done
                        $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
                        echo "Ok." >&4
                elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
-                       # Repeat libc to extract forwarders to DLL entries too
                        for thisname in $libnames $libc; do
                                $ar tv $thisname >>libc.tmp
                        for thisname in $libnames $libc; do
                                $ar tv $thisname >>libc.tmp
-                               # Revision 50 of EMX has bug in $ar.
-                               # it will not extract forwarders to DLL entries
-                               # Use emximp which will extract exactly them.
                                emximp -o tmp.imp $thisname \
                                    2>/dev/null && \
                                    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
                                    < tmp.imp >>libc.tmp
                                emximp -o tmp.imp $thisname \
                                    2>/dev/null && \
                                    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
                                    < tmp.imp >>libc.tmp
-                               $rm tmp.imp
+                               $rm -f tmp.imp
                        done
                        $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
                        echo "Ok." >&4
                else
                        echo "$ar didn't seem to work right." >&4
                        echo "Maybe this is a Cray...trying bld instead..." >&4
                        done
                        $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
                        echo "Ok." >&4
                else
                        echo "$ar didn't seem to work right." >&4
                        echo "Maybe this is a Cray...trying bld instead..." >&4
-                       if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
+                       if  bld t $libc | \
+                               $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
+                               $test -s libc.list
                        then
                                for thisname in $libnames; do
                                        bld t $libnames | \
                        then
                                for thisname in $libnames; do
                                        bld t $libnames | \
@@ -7556,7 +7773,8 @@ define)
 *)  if $test -f /lib/syscalls.exp; then
        echo " "
        echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
 *)  if $test -f /lib/syscalls.exp; then
        echo " "
        echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
-       $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
+       $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
+               /lib/syscalls.exp >>libc.list
     fi
     ;;
 esac
     fi
     ;;
 esac
@@ -7568,6 +7786,32 @@ $rm -f libnames libpath
 set dld.h i_dld
 eval $inhdr
 
 set dld.h i_dld
 eval $inhdr
 
+: Check if we are using C++
+echo " "
+echo "Checking for C++..." >&4
+$cat >try.c <<'EOCP'
+#include <stdio.h>
+int main(void)
+{
+#ifdef __cplusplus
+    return 0;
+#else
+    return 1;
+#endif
+}
+EOCP
+set try
+if eval $compile_ok && $run ./try; then
+       val="$define"
+       echo "You are using a C++ compiler."
+else
+       val="$undef"
+       echo "You are not using a C++ compiler."
+fi
+$rm_try cplusplus$$
+set d_cplusplus
+eval $setvar
+
 : is a C symbol defined?
 csym='tlook=$1;
 case "$3" in
 : is a C symbol defined?
 csym='tlook=$1;
 case "$3" in
@@ -7575,6 +7819,10 @@ case "$3" in
 -a) tf=libc.tmp; tdc="[]";;
 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
 esac;
 -a) tf=libc.tmp; tdc="[]";;
 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
 esac;
+case "$d_cplusplus" in
+    $define)   extern_C="extern \"C\"" ;;
+    *)         extern_C="extern"       ;;
+esac;
 tx=yes;
 case "$reuseval-$4" in
 true-) ;;
 tx=yes;
 case "$reuseval-$4" in
 true-) ;;
@@ -7582,23 +7830,20 @@ true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
 esac;
 case "$tx" in
 yes)
 esac;
 case "$tx" in
 yes)
-       case "$d_cplusplus" in
-               $define) extern_C=\"C\";;
-       esac;
        tval=false;
        if $test "$runnm" = true; then
                if $contains $tlook $tf >/dev/null 2>&1; then
                        tval=true;
                elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
        tval=false;
        if $test "$runnm" = true; then
                if $contains $tlook $tf >/dev/null 2>&1; then
                        tval=true;
                elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
-                       echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
+                       echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
                        $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
                        $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
                        $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
                        $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
-                       $rm -f try$_exe try.c core core.* try.core;
+                       $rm_try;
                fi;
        else
                fi;
        else
-               echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
+               echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
                $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
                $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
-               $rm -f try$_exe try.c;
+               $rm_try;
        fi;
        ;;
 *)
        fi;
        ;;
 *)
@@ -7637,33 +7882,6 @@ yes)
        esac;;
 esac'
 
        esac;;
 esac'
 
-
-echo " "
-echo "Checking for C++..." >&4
-cat >try.c <<'EOCP'
-#include <stdio.h>
-int main(void)
-{
-#ifdef __cplusplus
-    printf("define\n");
-#else
-    printf("undef\n");
-#endif
-    return 0;
-}
-EOCP
-set try
-if eval $compile_ok && $run ./try >cplusplus$$; then
-       val=`$cat cplusplus$$`
-       echo "You are using a C++ compiler."
-else
-       val="$undef"
-       echo "You are not using a C++ compiler."
-fi
-$rm -f try try.* cplusplus$$
-set d_cplusplus
-eval $setvar
-
 : see if dlopen exists
 xxx_runnm="$runnm"
 xxx_ccflags="$ccflags"
 : see if dlopen exists
 xxx_runnm="$runnm"
 xxx_ccflags="$ccflags"
@@ -7697,7 +7915,7 @@ $undef|n|false)
        dflt='n'
        usedl="$undef"
        ;;
        dflt='n'
        usedl="$undef"
        ;;
-*) 
+*)
        dflt='n'
        case "$d_dlopen" in
            $define) dflt='y' ;;
        dflt='n'
        case "$d_dlopen" in
            $define) dflt='y' ;;
@@ -7712,6 +7930,7 @@ esac
 rp="Do you wish to use dynamic loading?"
 . ./myread
 usedl="$ans"
 rp="Do you wish to use dynamic loading?"
 . ./myread
 usedl="$ans"
+bin_ELF="$undef"
 case "$ans" in
 y*) usedl="$define"
        case "$dlsrc" in
 case "$ans" in
 y*) usedl="$define"
        case "$dlsrc" in
@@ -7795,7 +8014,7 @@ EOM
 int main() {
        char b[4];
        int i = open("a.out",O_RDONLY);
 int main() {
        char b[4];
        int i = open("a.out",O_RDONLY);
-       if(i == -1) 
+       if(i == -1)
                exit(1); /* fail */
        if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
                exit(0); /* succeed (yes, it's ELF) */
                exit(1); /* fail */
        if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
                exit(0); /* succeed (yes, it's ELF) */
@@ -7808,11 +8027,12 @@ EOM
 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
 EOM
                        dflt="$cc"
 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
 EOM
                        dflt="$cc"
+                       bin_ELF="$define"
                else
                        echo "I'll use ld to build dynamic libraries."
                        dflt='ld'
                fi
                else
                        echo "I'll use ld to build dynamic libraries."
                        dflt='ld'
                fi
-               rm -f try.c a.out
+               $rm_try
                ;;
        *)      dflt="$ld"
                ;;
                ;;
        *)      dflt="$ld"
                ;;
@@ -7834,11 +8054,12 @@ EOM
     case "$lddlflags" in
     '') case "$osname" in
                        beos) dflt='-nostart' ;;
     case "$lddlflags" in
     '') case "$osname" in
                        beos) dflt='-nostart' ;;
+                       haiku) dflt='-shared' ;;
                        hpux) dflt='-b';
                              case "$gccversion" in
                              '') dflt="$dflt +vnocompatwarnings" ;;
                              esac
                        hpux) dflt='-b';
                              case "$gccversion" in
                              '') dflt="$dflt +vnocompatwarnings" ;;
                              esac
-                             ;;        
+                             ;;
                        linux|irix*|gnu*)  dflt="-shared $optimize" ;;
                        next)  dflt='none' ;;
                        solaris) dflt='-G' ;;
                        linux|irix*|gnu*)  dflt="-shared $optimize" ;;
                        next)  dflt='none' ;;
                        solaris) dflt='-G' ;;
@@ -7870,6 +8091,16 @@ EOM
        ''|' ') dflt='none' ;;
        esac
 
        ''|' ') dflt='none' ;;
        esac
 
+       case "$ldflags" in
+       *-fstack-protector*)
+           case "$dflt" in
+                       *-fstack-protector*) ;; # Don't add it again
+                       *) dflt="$dflt -fstack-protector" ;; 
+               esac
+               ;;
+       esac
+
+
     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
     . ./myread
     case "$ans" in
     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
     . ./myread
     case "$ans" in
@@ -7908,6 +8139,7 @@ EOM
     ;;
 esac
 
     ;;
 esac
 
+: Do we want a shared libperl?
 also=''
 case "$usedl" in
 $undef)
 also=''
 case "$usedl" in
 $undef)
@@ -7916,7 +8148,7 @@ $undef)
        ;;
 *)     case "$useshrplib" in
        '')     case "$osname" in
        ;;
 *)     case "$useshrplib" in
        '')     case "$osname" in
-               svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
+               svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
                        dflt=y
                        also='Building a shared libperl is required for dynamic loading to work on your system.'
                        ;;
                        dflt=y
                        also='Building a shared libperl is required for dynamic loading to work on your system.'
                        ;;
@@ -7964,15 +8196,22 @@ esac
 
 case "$useshrplib" in
 true)
 
 case "$useshrplib" in
 true)
+       case "$userelocatableinc" in
+       true|define)
+               echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
+               echo "See INSTALL for an explanation why that won't work." >&4
+               exit 4
+               ;;
+       esac
        case "$libperl" in
        '')
                # Figure out a good name for libperl.so.  Since it gets stored in
                # a version-specific architecture-dependent library, the version
                # number isn't really that important, except for making cc/ld happy.
                #
        case "$libperl" in
        '')
                # Figure out a good name for libperl.so.  Since it gets stored in
                # a version-specific architecture-dependent library, the version
                # number isn't really that important, except for making cc/ld happy.
                #
-               # A name such as libperl.so.3.1
+               # A name such as libperl.so.10.1
                majmin="libperl.$so.$patchlevel.$subversion"
                majmin="libperl.$so.$patchlevel.$subversion"
-               # A name such as libperl.so.301
+               # A name such as libperl.so.100
                majonly=`echo $patchlevel $subversion |
                        $awk '{printf "%d%02d", $1, $2}'`
                majonly=libperl.$so.$majonly
                majonly=`echo $patchlevel $subversion |
                        $awk '{printf "%d%02d", $1, $2}'`
                majonly=libperl.$so.$majonly
@@ -7986,8 +8225,12 @@ true)
                linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
                        dflt=libperl.$so
                        ;;
                linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
                        dflt=libperl.$so
                        ;;
-               cygwin*) # ld links against an importlib
-                       dflt=libperl$lib_ext
+               cygwin*) # ld links now against the dll directly
+                       majmin="cygperl5_${patchlevel}_${subversion}.${so}"
+                       majonly=`echo $patchlevel $subversion |
+                               $awk '{printf "%03d%03d", $1, $2}'`
+                       majonly=cygperl5.$majonly.$so
+                       dflt=$majmin
                        ;;
                *)      # Try to guess based on whether libc has major.minor.
                        case "$libc" in
                        ;;
                *)      # Try to guess based on whether libc has major.minor.
                        case "$libc" in
@@ -8060,7 +8303,7 @@ shrpdir=$archlibexp/CORE
 xxx=''
 tmp_shrpenv=''
 if "$useshrplib"; then
 xxx=''
 tmp_shrpenv=''
 if "$useshrplib"; then
-    case "$osname" in 
+    case "$osname" in
        aix)
                # We'll set it in Makefile.SH...
                ;;
        aix)
                # We'll set it in Makefile.SH...
                ;;
@@ -8079,17 +8322,23 @@ if "$useshrplib"; then
        beos)
                # beos doesn't like the default, either.
                ;;
        beos)
                # beos doesn't like the default, either.
                ;;
+       haiku)
+               # Haiku doesn't like the default, either.
+               ;;
        hpux*)
                # hpux doesn't like the default, either.
                tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
                ;;
        hpux*)
                # hpux doesn't like the default, either.
                tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
                ;;
+       cygwin)
+               # cygwin needs only ldlibpth
+               ;;
        *)
                tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
                ;;
        esac
        case "$xxx" in
        '') ;;
        *)
                tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
                ;;
        esac
        case "$xxx" in
        '') ;;
-       *)      
+       *)
                # Only add $xxx if it isn't already in ccdlflags.
                case " $ccdlflags " in
                *" $xxx "*)     ;;
                # Only add $xxx if it isn't already in ccdlflags.
                case " $ccdlflags " in
                *" $xxx "*)     ;;
@@ -8097,7 +8346,7 @@ if "$useshrplib"; then
                        cat <<EOM >&4
 
 Adding $xxx to the flags
                        cat <<EOM >&4
 
 Adding $xxx to the flags
-passed to $ld so that the perl executable will find the 
+passed to $ld so that the perl executable will find the
 installed shared $libperl.
 
 EOM
 installed shared $libperl.
 
 EOM
@@ -8237,7 +8486,7 @@ You can't have filenames longer than 14 chars.
 You can't even think about them!
 EOM
        val="$undef"
 You can't even think about them!
 EOM
        val="$undef"
-fi 
+fi
 set d_flexfnam
 eval $setvar
 $rm -rf 123456789abcde*
 set d_flexfnam
 eval $setvar
 $rm -rf 123456789abcde*
@@ -8522,11 +8771,11 @@ case "$myhostname" in
                                echo "(Attempting domain name extraction from $tans)"
                                dflt=.`$sed -n -e 's/   / /g' \
                                  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
                                echo "(Attempting domain name extraction from $tans)"
                                dflt=.`$sed -n -e 's/   / /g' \
                                  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
-                                 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
+                                 -e 1q 2>/dev/null`
                                case "$dflt" in
                                .) dflt=.`$sed -n -e 's/        / /g' \
                                     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
                                case "$dflt" in
                                .) dflt=.`$sed -n -e 's/        / /g' \
                                     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
-                                    | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
+                                    -e 1q 2>/dev/null`
                                        ;;
                                esac
                        fi
                                        ;;
                                esac
                        fi
@@ -8595,6 +8844,7 @@ case "$phostname" in
        ;;
 esac
 
        ;;
 esac
 
+: determine the e-mail address of the user who is running us
 $cat <<EOM
 
 I need to get your e-mail address in Internet format if possible, i.e.
 $cat <<EOM
 
 I need to get your e-mail address in Internet format if possible, i.e.
@@ -8630,6 +8880,7 @@ while test "$cont"; do
        esac
 done
 
        esac
 done
 
+: Ask e-mail of administrator
 $cat <<EOM
 
 If you or somebody else will be maintaining perl at your site, please
 $cat <<EOM
 
 If you or somebody else will be maintaining perl at your site, please
@@ -8868,6 +9119,7 @@ rp='Pathname where add-on public executable scripts should be installed?'
 prefixvar=sitescript
 . ./setprefixvar
 
 prefixvar=sitescript
 . ./setprefixvar
 
+: Check if faststdio is requested and available
 case "$usefaststdio" in
 $define|true|[yY]*|'')
        xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
 case "$usefaststdio" in
 $define|true|[yY]*|'')
        xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
@@ -8891,7 +9143,7 @@ EOM
 rp='Use the "fast stdio" if available?'
 . ./myread
 case "$ans" in
 rp='Use the "fast stdio" if available?'
 . ./myread
 case "$ans" in
-y|Y)   val="$define" ;;     
+y|Y)   val="$define" ;;
 *)      val="$undef" ;;
 esac
 set usefaststdio
 *)      val="$undef" ;;
 esac
 set usefaststdio
@@ -8967,7 +9219,7 @@ $cat >try.c <<EOCP
 int main()
 {
     printf("%d\n", (int)sizeof($lseektype));
 int main()
 {
     printf("%d\n", (int)sizeof($lseektype));
-    return(0); 
+    return(0);
 }
 EOCP
 set try
 }
 EOCP
 set try
@@ -8982,19 +9234,20 @@ else
        . ./myread
        lseeksize="$ans"
 fi
        . ./myread
        lseeksize="$ans"
 fi
-$rm -f try.c try
+$rm_try
 
 : 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
 
 
 : 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
 
+: Check size for Fpos_t
 echo " "
 case "$fpostype" in
 *_t) zzz="$fpostype"   ;;
 *)   zzz="fpos_t"      ;;
 esac
 echo " "
 case "$fpostype" in
 *_t) zzz="$fpostype"   ;;
 *)   zzz="fpos_t"      ;;
 esac
-echo "Checking the size of $zzz..." >&4 
+echo "Checking the size of $zzz..." >&4
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
@@ -9027,6 +9280,7 @@ else
        fpossize="$ans"
 fi
 
        fpossize="$ans"
 fi
 
+: Check for large file support
 # Backward compatibility (uselfs is deprecated).
 case "$uselfs" in
 "$define"|true|[yY]*)
 # Backward compatibility (uselfs is deprecated).
 case "$uselfs" in
 "$define"|true|[yY]*)
@@ -9036,7 +9290,7 @@ case "$uselfs" in
 EOM
        uselargefiles="$define"
        ;;
 EOM
        uselargefiles="$define"
        ;;
-esac                          
+esac
 
 case "$lseeksize:$fpossize" in
 8:8) cat <<EOM
 
 case "$lseeksize:$fpossize" in
 8:8) cat <<EOM
@@ -9083,7 +9337,7 @@ case "$uselargefiles" in
 int main()
 {
     printf("%d\n", (int)sizeof($lseektype));
 int main()
 {
     printf("%d\n", (int)sizeof($lseektype));
-    return(0); 
+    return(0);
 }
 EOCP
                set try
 }
 EOCP
                set try
@@ -9102,7 +9356,7 @@ EOCP
                *_t) zzz="$fpostype"    ;;
                *)   zzz="fpos_t"       ;;
                esac
                *_t) zzz="$fpostype"    ;;
                *)   zzz="fpos_t"       ;;
                esac
-               $echo $n "Rechecking the size of $zzz...$c" >&4 
+               $echo $n "Rechecking the size of $zzz...$c" >&4
                $cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
                $cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
@@ -9135,11 +9389,12 @@ EOCP
                        . ./myread
                        fpossize="$ans"
                fi
                        . ./myread
                        fpossize="$ans"
                fi
-               $rm -f try.c try
+               $rm_try
        fi
        ;;
 esac
 
        fi
        ;;
 esac
 
+: Set the vendorbin variables
 case "$vendorprefix" in
 '')    d_vendorbin="$undef"
        vendorbin=''
 case "$vendorprefix" in
 '')    d_vendorbin="$undef"
        vendorbin=''
@@ -9161,6 +9416,7 @@ esac
 prefixvar=vendorbin
 . ./installprefix
 
 prefixvar=vendorbin
 . ./installprefix
 
+: Set the vendorhtml1dir variables
 case "$vendorprefix" in
 '')    vendorhtml1dir=''
        vendorhtml1direxp=''
 case "$vendorprefix" in
 '')    vendorhtml1dir=''
        vendorhtml1direxp=''
@@ -9188,6 +9444,7 @@ $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
 prefixvar=vendorhtml1dir
 . ./installprefix
 
 prefixvar=vendorhtml1dir
 . ./installprefix
 
+: Set the vendorhtml3dir variables
 case "$vendorprefix" in
 '')    vendorhtml3dir=''
        vendorhtml3direxp=''
 case "$vendorprefix" in
 '')    vendorhtml3dir=''
        vendorhtml3direxp=''
@@ -9215,6 +9472,7 @@ $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
 prefixvar=vendorhtml3dir
 . ./installprefix
 
 prefixvar=vendorhtml3dir
 . ./installprefix
 
+: Set the vendorman1dir variables
 case "$vendorprefix" in
 '')    vendorman1dir=''
        vendorman1direxp=''
 case "$vendorprefix" in
 '')    vendorman1dir=''
        vendorman1direxp=''
@@ -9239,6 +9497,7 @@ $test X"$vendorman1dir" = "X" && vendorman1dir=' '
 prefixvar=vendorman1dir
 . ./installprefix
 
 prefixvar=vendorman1dir
 . ./installprefix
 
+: Set the vendorman3dir variables
 case "$vendorprefix" in
 '')    vendorman3dir=''
        vendorman3direxp=''
 case "$vendorprefix" in
 '')    vendorman3dir=''
        vendorman3direxp=''
@@ -9263,6 +9522,7 @@ $test X"$vendorman3dir" = "X" && vendorman3dir=' '
 prefixvar=vendorman3dir
 . ./installprefix
 
 prefixvar=vendorman3dir
 . ./installprefix
 
+: Set the vendorscript variables
 case "$vendorprefix" in
 '')    d_vendorscript="$undef"
        vendorscript=''
 case "$vendorprefix" in
 '')    d_vendorscript="$undef"
        vendorscript=''
@@ -9291,10 +9551,51 @@ esac
 prefixvar=vendorscript
 . ./installprefix
 
 prefixvar=vendorscript
 . ./installprefix
 
+: script used to emit important warnings
+cat >warn <<EOS
+$startsh
+if test \$# -gt 0; then
+       echo "\$@" >msg
+else
+       cat >msg
+fi
+echo "*** WARNING:" >&4
+sed -e 's/^/*** /' <msg >&4
+echo "*** " >&4
+cat msg >>config.msg
+echo " " >>config.msg
+rm -f msg
+EOS
+chmod +x warn
+$eunicefix warn
+
+: 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
+               ./warn "No string header found -- You'll surely have problems."
+       fi
+fi
+set i_string
+eval $setvar
+case "$i_string" in
+"$undef") strings=`./findhdr strings.h`;;
+*)       strings=`./findhdr string.h`;;
+esac
+
 : see if qgcvt exists
 set qgcvt d_qgcvt
 eval $inlibc
 
 : see if qgcvt exists
 set qgcvt d_qgcvt
 eval $inlibc
 
+: Check print/scan long double stuff
 echo " "
 
 if $test X"$d_longdbl" = X"$define"; then
 echo " "
 
 if $test X"$d_longdbl" = X"$define"; then
@@ -9395,17 +9696,17 @@ else
        sSCNfldbl=$sPRIfldbl    # expect consistency
 fi
 
        sSCNfldbl=$sPRIfldbl    # expect consistency
 fi
 
-$rm -f try try.*
+$rm_try
 
 fi # d_longdbl
 
 case "$sPRIfldbl" in
 
 fi # d_longdbl
 
 case "$sPRIfldbl" in
-'')    d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
-       d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
+'')    d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
+       d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
        d_SCNfldbl="$undef";
        ;;
        d_SCNfldbl="$undef";
        ;;
-*)     d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
-       d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
+*)     d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
+       d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
        d_SCNfldbl="$define";
        ;;
 esac
        d_SCNfldbl="$define";
        ;;
 esac
@@ -9463,15 +9764,18 @@ char *myname = "sprintf";
 
 #include <stdio.h>
 
 
 #include <stdio.h>
 
-#define I_STDLIB $i_stdlib
+#$i_stdlib I_STDLIB
 #ifdef I_STDLIB
 #include <stdlib.h>
 #endif
 #ifdef I_STDLIB
 #include <stdlib.h>
 #endif
+#$i_string I_STRING
+#ifdef I_STRING
+#  include <string.h>
+#else
+#  include <strings.h>
+#endif
 
 
-int
-checkit(expect, got)
-char *expect;
-char *got;
+int checkit(char *expect, char *got)
 {
     if (strcmp(expect, got)) {
                printf("%s oddity:  Expected %s, got %s\n",
 {
     if (strcmp(expect, got)) {
                printf("%s oddity:  Expected %s, got %s\n",
@@ -9481,8 +9785,8 @@ char *got;
 }
 
 int main()
 }
 
 int main()
-{ 
-       char buf[64]; 
+{
+       char buf[64];
        buf[63] = '\0';
 
        /* This must be 1st test on (which?) platform */
        buf[63] = '\0';
 
        /* This must be 1st test on (which?) platform */
@@ -9490,13 +9794,13 @@ int main()
        Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
        checkit("0.1", buf);
 
        Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
        checkit("0.1", buf);
 
-       Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
        checkit("0.01", buf);
 
        checkit("0.01", buf);
 
-       Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
        checkit("0.001", buf);
 
        checkit("0.001", buf);
 
-       Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
        checkit("0.0001", buf);
 
        Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
        checkit("0.0001", buf);
 
        Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
@@ -9505,42 +9809,42 @@ int main()
        else
            checkit("9e-05", buf);
 
        else
            checkit("9e-05", buf);
 
-       Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
        checkit("1", buf);
 
        checkit("1", buf);
 
-       Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
        checkit("1.1", buf);
 
        checkit("1.1", buf);
 
-       Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
        checkit("1.01", buf);
 
        checkit("1.01", buf);
 
-       Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
        checkit("1.001", buf);
 
        checkit("1.001", buf);
 
-       Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
        checkit("1.0001", buf);
 
        checkit("1.0001", buf);
 
-       Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
        checkit("1.00001", buf);
 
        checkit("1.00001", buf);
 
-       Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
        checkit("1.000001", buf);
 
        checkit("1.000001", buf);
 
-       Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
        checkit("0", buf);
 
        checkit("0", buf);
 
-       Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
        checkit("-1", buf);
 
        /* Some Linux gcvt's give 1.e+5 here. */
        checkit("-1", buf);
 
        /* Some Linux gcvt's give 1.e+5 here. */
-       Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
        checkit("100000", buf);
        checkit("100000", buf);
-       
+
        /* Some Linux gcvt's give -1.e+5 here. */
        /* Some Linux gcvt's give -1.e+5 here. */
-       Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
        checkit("-100000", buf);
 
        checkit("-100000", buf);
 
-       Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
+       Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
        checkit("123.456", buf);
 
        /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
        checkit("123.456", buf);
 
        /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
@@ -9565,14 +9869,14 @@ for xxx_convert in $gconvert_preference; do
     case $xxx_convert in
     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
     case $xxx_convert in
     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
-    esac 
+    esac
 done
 : then add any others
 for xxx_convert in gconvert gcvt sprintf; do
     case "$xxx_list" in
     *$xxx_convert*) ;;
     *) xxx_list="$xxx_list $xxx_convert" ;;
 done
 : then add any others
 for xxx_convert in gconvert gcvt sprintf; do
     case "$xxx_list" in
     *$xxx_convert*) ;;
     *) xxx_list="$xxx_list $xxx_convert" ;;
-    esac 
+    esac
 done
 
 case "$d_longdbl$uselongdouble" in
 done
 
 case "$d_longdbl$uselongdouble" in
@@ -9607,7 +9911,7 @@ esac
 
 for xxx_convert in $xxx_list; do
        echo "Trying $xxx_convert..."
 
 for xxx_convert in $xxx_list; do
        echo "Trying $xxx_convert..."
-       $rm -f try try$_o
+       $rm -f try try$_o core
        set try -DTRY_$xxx_convert
        if eval $compile; then
                echo "$xxx_convert() found." >&4
        set try -DTRY_$xxx_convert
        if eval $compile; then
                echo "$xxx_convert() found." >&4
@@ -9640,10 +9944,11 @@ qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
    esac
       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
    esac
-   ;;  
+   ;;
 esac
 
 fi
 esac
 
 fi
+$rm_try
 
 : see if _fwalk exists
 set fwalk d__fwalk
 
 : see if _fwalk exists
 set fwalk d__fwalk
@@ -9713,6 +10018,26 @@ eval $inlibc
 set alarm d_alarm
 eval $inlibc
 
 set alarm d_alarm
 eval $inlibc
 
+: see if 64bit time functions exists
+
+set ctime64 d_ctime64
+eval $inlibc
+
+set localtime64 d_localtime64
+eval $inlibc
+
+set gmtime64 d_gmtime64
+eval $inlibc
+
+set mktime64 d_mktime64
+eval $inlibc
+
+set difftime64 d_difftime64
+eval $inlibc
+
+set asctime64 d_asctime64
+eval $inlibc
+
 : see if POSIX threads are available
 set pthread.h i_pthread
 eval $inhdr
 : see if POSIX threads are available
 set pthread.h i_pthread
 eval $inhdr
@@ -9725,7 +10050,7 @@ optimize="$optimize"
 ccflags="$ccflags"
 prototype="$prototype"
 define="$define"
 ccflags="$ccflags"
 prototype="$prototype"
 define="$define"
-rm=$rm
+rm_try="$rm_try"
 usethreads=$usethreads
 i_pthread=$i_pthread
 pthread_h_first=$pthread_h_first
 usethreads=$usethreads
 i_pthread=$i_pthread
 pthread_h_first=$pthread_h_first
@@ -9733,7 +10058,7 @@ EOSH
 
 $cat >> protochk <<'EOSH'
 
 
 $cat >> protochk <<'EOSH'
 
-$rm -f try.c
+$rm_try
 foo="$1"
 shift
 while test $# -ge 2; do
 foo="$1"
 shift
 while test $# -ge 2; do
@@ -9763,12 +10088,13 @@ echo "$foo" >> try.c
 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
 status=$?
 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
 status=$?
-$rm -f try.[co]
+$rm_try
 exit $status
 EOSH
 chmod +x protochk
 $eunicefix protochk
 
 exit $status
 EOSH
 chmod +x protochk
 $eunicefix protochk
 
+: Define hasproto macro for Configure internal use
 hasproto='varname=$1; func=$2; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
 hasproto='varname=$1; func=$2; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
@@ -9786,7 +10112,7 @@ else
 fi;
 set $varname;
 eval $setvar;
 fi;
 set $varname;
 eval $setvar;
-$rm -f try.c tryout.c'
+$rm_try tryout.c'
 
 : see if sys/types.h has to be included
 set sys/types.h i_systypes
 
 : see if sys/types.h has to be included
 set sys/types.h i_systypes
@@ -9796,6 +10122,7 @@ eval $inhdr
 set sys/select.h i_sysselct
 eval $inhdr
 
 set sys/select.h i_sysselct
 eval $inhdr
 
+: Define hasfield macro for Configure internal use
 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
@@ -9812,7 +10139,7 @@ else
 fi;
 set $varname;
 eval $setvar;
 fi;
 set $varname;
 eval $setvar;
-$rm -f try try.c try.o'
+$rm_try'
 
 : see if we should include time.h, sys/time.h, or both
 echo " "
 
 : see if we should include time.h, sys/time.h, or both
 echo " "
@@ -9899,11 +10226,11 @@ EOCP
                echo "We'll include <sys/time.h>." >&4;;
        *) i_systime="$undef";;
        esac
                echo "We'll include <sys/time.h>." >&4;;
        *) i_systime="$undef";;
        esac
-       $rm -f try.c try
+       $rm_try
 fi
 : see if struct tm knows about tm_zone
 case "$i_systime$i_time" in
 fi
 : see if struct tm knows about tm_zone
 case "$i_systime$i_time" in
-*$define*) 
+*$define*)
         echo " "
         echo "Checking to see if your struct tm has tm_zone field..." >&4
         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
         echo " "
         echo "Checking to see if your struct tm has tm_zone field..." >&4
         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
@@ -9920,7 +10247,7 @@ case "$d_tm_tm_zone" in
 esac
 : see if struct tm knows about tm_gmtoff
 case "$i_systime$i_time" in
 esac
 : see if struct tm knows about tm_gmtoff
 case "$i_systime$i_time" in
-*$define*) 
+*$define*)
         echo " "
         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
         echo " "
         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
@@ -9952,19 +10279,19 @@ case "$d_asctime_r" in
        define)
        case "$asctime_r_proto" in
        ''|0) try='char* asctime_r(const struct tm*, char*);'
        define)
        case "$asctime_r_proto" in
        ''|0) try='char* asctime_r(const struct tm*, char*);'
-       ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
+       ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
        esac
        case "$asctime_r_proto" in
        ''|0) try='char* asctime_r(const struct tm*, char*, int);'
        esac
        case "$asctime_r_proto" in
        ''|0) try='char* asctime_r(const struct tm*, char*, int);'
-       ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
        esac
        case "$asctime_r_proto" in
        ''|0) try='int asctime_r(const struct tm*, char*);'
        esac
        case "$asctime_r_proto" in
        ''|0) try='int asctime_r(const struct tm*, char*);'
-       ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
+       ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
        esac
        case "$asctime_r_proto" in
        ''|0) try='int asctime_r(const struct tm*, char*, int);'
        esac
        case "$asctime_r_proto" in
        ''|0) try='int asctime_r(const struct tm*, char*, int);'
-       ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
        esac
        case "$asctime_r_proto" in
        ''|0)   d_asctime_r=undef
        esac
        case "$asctime_r_proto" in
        ''|0)   d_asctime_r=undef
@@ -10209,6 +10536,34 @@ set d_attribute_unused
 eval $setvar
 $rm -f attrib*
 
 eval $setvar
 $rm -f attrib*
 
+: Look for GCC-style attribute deprecated
+case "$d_attribute_deprecated" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+int I_am_deprecated(void) __attribute__((deprecated));
+EOCP
+if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
+       if $contains 'warning' attrib.out >/dev/null 2>&1; then
+               echo "Your C compiler doesn't support __attribute__((deprecated))."
+               val="$undef"
+       else
+               echo "Your C compiler supports __attribute__((deprecated))."
+               val="$define"
+       fi
+else
+       echo "Your C compiler doesn't seem to understand __attribute__ at all."
+       val="$undef"
+fi
+;;
+*) val="$d_attribute_deprecated" ;;
+esac
+set d_attribute_deprecated
+eval $setvar
+$rm -f attrib*
+
 : Look for GCC-style attribute warn_unused_result
 case "$d_attribute_warn_unused_result" in
 '')
 : Look for GCC-style attribute warn_unused_result
 case "$d_attribute_warn_unused_result" in
 '')
@@ -10309,7 +10664,7 @@ EOP
 esac
 set d_bsdgetpgrp
 eval $setvar
 esac
 set d_bsdgetpgrp
 eval $setvar
-$rm -f try try.*
+$rm_try
 
 : see if setpgrp exists
 set setpgrp d_setpgrp
 
 : see if setpgrp exists
 set setpgrp d_setpgrp
@@ -10375,7 +10730,8 @@ EOP
 esac
 set d_bsdsetpgrp
 eval $setvar
 esac
 set d_bsdsetpgrp
 eval $setvar
-$rm -f try try.*
+$rm_try
+
 : Look for GCC-style __builtin_choose_expr
 case "$d_builtin_choose_expr" in
 '')
 : Look for GCC-style __builtin_choose_expr
 case "$d_builtin_choose_expr" in
 '')
@@ -10399,7 +10755,7 @@ int main(void) {
 
 EOCP
     set try
 
 EOCP
     set try
-    if eval $compile; then
+    if eval $compile && $run ./try; then
        echo "Your C compiler supports __builtin_choose_expr."
        val="$define"
     else
        echo "Your C compiler supports __builtin_choose_expr."
        val="$define"
     else
@@ -10412,25 +10768,27 @@ esac
 
 set d_builtin_choose_expr
 eval $setvar
 
 set d_builtin_choose_expr
 eval $setvar
-$rm -f try.* try core core.try.*
+$rm_try
 
 : Look for GCC-style __builtin_expect
 case "$d_builtin_expect" in
 '')
     echo " "
     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
 
 : Look for GCC-style __builtin_expect
 case "$d_builtin_expect" in
 '')
     echo " "
     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
-    $cat >builtin.c <<'EOCP'
+    $cat >try.c <<'EOCP'
 int main(void) {
     int n = 50;
     if ( __builtin_expect(n, 0) ) n = 1;
 int main(void) {
     int n = 50;
     if ( __builtin_expect(n, 0) ) n = 1;
+    /* Remember shell exit code truth is 0, C truth is non-zero */
+    return !(n == 1);
 }
 EOCP
     set try
 }
 EOCP
     set try
-    if eval $compile; then
-       echo "Your C compiler supports __builtin_choose_expr."
+    if eval $compile && $run ./try; then
+       echo "Your C compiler supports __builtin_expect."
        val="$define"
     else
        val="$define"
     else
-       echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
+       echo "Your C compiler doesn't seem to understand __builtin_expect."
        val="$undef"
     fi
     ;;
        val="$undef"
     fi
     ;;
@@ -10439,7 +10797,7 @@ esac
 
 set d_builtin_expect
 eval $setvar
 
 set d_builtin_expect
 eval $setvar
-$rm -f try.* try core core.try.*
+$rm_try
 
 : see if bzero exists
 set bzero d_bzero
 
 : see if bzero exists
 set bzero d_bzero
@@ -10527,7 +10885,7 @@ echo "I could not find the definition for va_dcl... You have problems..." >&4
        val="$undef"; set i_stdarg; eval $setvar
        val="$undef"; set i_varargs; eval $setvar
        ;;
        val="$undef"; set i_stdarg; eval $setvar
        val="$undef"; set i_varargs; eval $setvar
        ;;
-*) 
+*)
        set i_varhdr
        eval $setvar
        case "$i_varhdr" in
        set i_varhdr
        eval $setvar
        case "$i_varhdr" in
@@ -10577,7 +10935,7 @@ EOCP
        echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
        d_c99_variadic_macros="$undef"
     fi
        echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
        d_c99_variadic_macros="$undef"
     fi
-    $rm -f try.* try core core.try.*
+    $rm_try
     ;;
     *)
     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
     ;;
     *)
     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
@@ -10654,8 +11012,8 @@ int main()
        char str[16];
        signal(SIGFPE, blech);
 
        char str[16];
        signal(SIGFPE, blech);
 
-       /* Don't let compiler optimize the test away.  Store the number 
-          in a writable string for gcc to pass to sscanf under HP/UX.
+       /* Don't let compiler optimize the test away.  Store the number
+          in a writable string for gcc to pass to sscanf under HP-UX.
        */
        sprintf(str, "2147483647");
        sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
        */
        sprintf(str, "2147483647");
        sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
@@ -10690,7 +11048,7 @@ case "$yyy" in
 esac
 set d_casti32
 eval $setvar
 esac
 set d_casti32
 eval $setvar
-$rm -f try try.*
+$rm_try
 
 : check for ability to cast negative floats to unsigned
 echo " "
 
 : check for ability to cast negative floats to unsigned
 echo " "
@@ -10716,13 +11074,13 @@ int main()
        unsigned short ashort;
        int result = 0;
        char str[16];
        unsigned short ashort;
        int result = 0;
        char str[16];
-       
+
        /* Frustrate gcc-2.7.2's optimizer which failed this test with
           a direct f = -123. assignment.  gcc-2.8.0 reportedly
           optimized the whole file away
        */
        /* Frustrate gcc-2.7.2's optimizer which failed this test with
           a direct f = -123. assignment.  gcc-2.8.0 reportedly
           optimized the whole file away
        */
-       /* Store the number in a writable string for gcc to pass to 
-          sscanf under HP/UX.
+       /* Store the number in a writable string for gcc to pass to
+          sscanf under HP-UX.
        */
        sprintf(str, "-123");
        sscanf(str, "%lf", &f);  /* f = -123.; */
        */
        sprintf(str, "-123");
        sscanf(str, "%lf", &f);  /* f = -123.; */
@@ -10790,7 +11148,7 @@ case "$castflags" in
 esac
 set d_castneg
 eval $setvar
 esac
 set d_castneg
 eval $setvar
-$rm -f try try.*
+$rm_try
 
 : see if vprintf exists
 echo " "
 
 : see if vprintf exists
 echo " "
@@ -10798,38 +11156,75 @@ if set vprintf val -f d_vprintf; eval $csym; $val; then
        echo 'vprintf() found.' >&4
        val="$define"
        $cat >try.c <<EOF
        echo 'vprintf() found.' >&4
        val="$define"
        $cat >try.c <<EOF
-#include <varargs.h>
+#$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
+#$i_varargs I_VARARGS
+
 #$i_stdlib I_STDLIB
 #$i_stdlib I_STDLIB
+#$i_unistd I_UNISTD
+
+#ifdef I_STDARG
+#  include <stdarg.h>
+#else /* I_VARARGS */
+#  include <varargs.h>
+#endif
+
+#ifdef I_UNISTD
+#  include <unistd.h>
+#endif
+
 #ifdef I_STDLIB
 #ifdef I_STDLIB
-#include <stdlib.h>
+#  include <stdlib.h>
 #endif
 
 #endif
 
-int main() { xxx("foo"); }
+#include <stdio.h> /* vsprintf prototype */
+
+#ifdef I_STDARG
+void xxx(int n, ...)
+{
+    va_list args;
+    char buf[10];
+    va_start(args, n);
+    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
+}
+int main() { xxx(1, "foo"); }
+
+#else /* I_VARARGS */
 
 xxx(va_alist)
 va_dcl
 {
 
 xxx(va_alist)
 va_dcl
 {
-       va_list args;
-       char buf[10];
-
-       va_start(args);
-       exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
+    va_list args;
+    char buf[10];
+    va_start(args);
+    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
 }
 }
+int main() { xxx("foo"); }
+
+#endif
+
 EOF
        set try
 EOF
        set try
-       if eval $compile && $run ./try; then
-               echo "Your vsprintf() returns (int)." >&4
-               val2="$undef"
+       if eval $compile_ok; then
+               if $run ./try; then
+                       echo "Your vsprintf() returns (int)." >&4
+                       val2="$undef"
+               else
+                       echo "Your vsprintf() returns (char*)." >&4
+                       val2="$define"
+               fi
        else
        else
-               echo "Your vsprintf() returns (char*)." >&4
-               val2="$define"
+               echo 'I am unable to compile the vsprintf() test program.' >&4
+               # We shouldn't get here.  If we do, assume the standard signature,
+               # not the old BSD one.
+               echo 'Guessing that vsprintf() returns (int).' >&4
+               val2="$undef"
        fi
 else
        echo 'vprintf() NOT found.' >&4
        fi
 else
        echo 'vprintf() NOT found.' >&4
-               val="$undef"
-               val2="$undef"
+       val="$undef"
+       val2="$undef"
 fi
 fi
-$rm -f try try.*
+$rm_try
 set d_vprintf
 eval $setvar
 val=$val2
 set d_vprintf
 eval $setvar
 val=$val2
@@ -10856,6 +11251,7 @@ eval $inlibc
 set clearenv d_clearenv
 eval $inlibc
 
 set clearenv d_clearenv
 eval $inlibc
 
+: Define hasstruct macro for Configure internal use
 hasstruct='varname=$1; struct=$2; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
 hasstruct='varname=$1; struct=$2; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
@@ -10872,11 +11268,11 @@ else
 fi;
 set $varname;
 eval $setvar;
 fi;
 set $varname;
 eval $setvar;
-$rm -f try try.c try.o'
+$rm_try'
 
 
+: see whether socket exists
 socketlib=''
 sockethdr=''
 socketlib=''
 sockethdr=''
-: see whether socket exists
 echo " "
 $echo $n "Hmm... $c" >&4
 if set socket val -f d_socket; eval $csym; $val; then
 echo " "
 $echo $n "Hmm... $c" >&4
 if set socket val -f d_socket; eval $csym; $val; then
@@ -10913,7 +11309,7 @@ else
                                                        sockethdr="-I/usr/netinclude"
                                                        ;;
                                                esac
                                                        sockethdr="-I/usr/netinclude"
                                                        ;;
                                                esac
-                                               echo "Found Berkeley sockets interface in lib$net." >&4 
+                                               echo "Found Berkeley sockets interface in lib$net." >&4
                                                if $contains setsockopt libc.list >/dev/null 2>&1; then
                                                        d_oldsock="$undef"
                                                else
                                                if $contains setsockopt libc.list >/dev/null 2>&1; then
                                                        d_oldsock="$undef"
                                                else
@@ -10954,14 +11350,14 @@ EOF
                val="$define"
        fi
        set d_${enum}; eval $setvar
                val="$define"
        fi
        set d_${enum}; eval $setvar
-       $rm -f try.c try
+       $rm_try
 done
 
 : see if this is a sys/uio.h system
 set sys/uio.h i_sysuio
 eval $inhdr
 
 done
 
 : see if this is a sys/uio.h system
 set sys/uio.h i_sysuio
 eval $inhdr
 
-
+: Check for cmsghdr support
 echo " "
 echo "Checking to see if your system supports struct cmsghdr..." >&4
 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
 echo " "
 echo "Checking to see if your system supports struct cmsghdr..." >&4
 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
@@ -11056,11 +11452,11 @@ case "$d_crypt_r" in
        define)
        case "$crypt_r_proto" in
        ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
        define)
        case "$crypt_r_proto" in
        ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
-       ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
+       ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
        esac
        case "$crypt_r_proto" in
        ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
        esac
        case "$crypt_r_proto" in
        ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
-       ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
+       ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
        esac
        case "$crypt_r_proto" in
        ''|0)   d_crypt_r=undef
        esac
        case "$crypt_r_proto" in
        ''|0)   d_crypt_r=undef
@@ -11117,7 +11513,7 @@ case "$d_ctermid_r" in
        define)
        case "$ctermid_r_proto" in
        ''|0) try='char* ctermid_r(char*);'
        define)
        case "$ctermid_r_proto" in
        ''|0) try='char* ctermid_r(char*);'
-       ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
+       ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
        esac
        case "$ctermid_r_proto" in
        ''|0)   d_ctermid_r=undef
        esac
        case "$ctermid_r_proto" in
        ''|0)   d_ctermid_r=undef
@@ -11158,19 +11554,19 @@ case "$d_ctime_r" in
        define)
        case "$ctime_r_proto" in
        ''|0) try='char* ctime_r(const time_t*, char*);'
        define)
        case "$ctime_r_proto" in
        ''|0) try='char* ctime_r(const time_t*, char*);'
-       ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
+       ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
        esac
        case "$ctime_r_proto" in
        ''|0) try='char* ctime_r(const time_t*, char*, int);'
        esac
        case "$ctime_r_proto" in
        ''|0) try='char* ctime_r(const time_t*, char*, int);'
-       ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
        esac
        case "$ctime_r_proto" in
        ''|0) try='int ctime_r(const time_t*, char*);'
        esac
        case "$ctime_r_proto" in
        ''|0) try='int ctime_r(const time_t*, char*);'
-       ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
+       ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
        esac
        case "$ctime_r_proto" in
        ''|0) try='int ctime_r(const time_t*, char*, int);'
        esac
        case "$ctime_r_proto" in
        ''|0) try='int ctime_r(const time_t*, char*, int);'
-       ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
        esac
        case "$ctime_r_proto" in
        ''|0)   d_ctime_r=undef
        esac
        case "$ctime_r_proto" in
        ''|0)   d_ctime_r=undef
@@ -11310,7 +11706,7 @@ case "$guess1" in
 'struct dirent') guess2='struct direct' ;;
 *) guess2='struct dirent' ;;
 esac
 'struct dirent') guess2='struct direct' ;;
 *) guess2='struct dirent' ;;
 esac
-               
+
 if $contains "$guess1" try.c >/dev/null 2>&1; then
        direntrytype="$guess1"
        echo "Your directory entries are $direntrytype." >&4
 if $contains "$guess1" try.c >/dev/null 2>&1; then
        direntrytype="$guess1"
        echo "Your directory entries are $direntrytype." >&4
@@ -11324,8 +11720,7 @@ else
        . ./myread
        direntrytype="$ans"
 fi
        . ./myread
        direntrytype="$ans"
 fi
-$rm -f try try.c
-
+$rm_try
 
 : see if the directory entry stores field length
 echo " "
 
 : see if the directory entry stores field length
 echo " "
@@ -11339,7 +11734,7 @@ else
 fi
 set d_dirnamlen
 eval $setvar
 fi
 set d_dirnamlen
 eval $setvar
-$rm -f try try.c
+$rm_try
 
 : Look for DIR.dd_fd
 case "$i_dirent" in
 
 : Look for DIR.dd_fd
 case "$i_dirent" in
@@ -11375,7 +11770,7 @@ EOCP
 esac
 set d_dir_dd_fd
 eval $setvar
 esac
 set d_dir_dd_fd
 eval $setvar
-$rm -f try try.*
+$rm_try
 
 : see if this is an sysdir system
 set sys/dir.h i_sysdir
 
 : see if this is an sysdir system
 set sys/dir.h i_sysdir
@@ -11450,6 +11845,7 @@ runnm="$xxx_runnm"
 set dlfcn.h i_dlfcn
 eval $inhdr
 
 set dlfcn.h i_dlfcn
 eval $inhdr
 
+: Check what extension to use for shared libs
 case "$usedl" in
 $define|y|true)
        $cat << EOM
 case "$usedl" in
 $define|y|true)
        $cat << EOM
@@ -11534,9 +11930,9 @@ int main()
 }
 EOM
        : Call the object file tmp-dyna.o in case dlext=o.
 }
 EOM
        : Call the object file tmp-dyna.o in case dlext=o.
-       if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
-               mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
-               $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
+       if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
+               mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
+               $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
                $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
                xxx=`$run ./fred`
                case $xxx in
                $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
                xxx=`$run ./fred`
                case $xxx in
@@ -11554,7 +11950,7 @@ EOM
        fi
        ;;
 esac
        fi
        ;;
 esac
-               
+
 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
 
 set d_dlsymun
 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
 
 set d_dlsymun
@@ -11576,7 +11972,7 @@ case "$d_drand48_r" in
        define)
        case "$drand48_r_proto" in
        ''|0) try='int drand48_r(struct drand48_data*, double*);'
        define)
        case "$drand48_r_proto" in
        ''|0) try='int drand48_r(struct drand48_data*, double*);'
-       ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
+       ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
        esac
        case "$drand48_r_proto" in
        ''|0)   d_drand48_r=undef
        esac
        case "$drand48_r_proto" in
        ''|0)   d_drand48_r=undef
@@ -11659,11 +12055,11 @@ case "$d_endgrent_r" in
        define)
        case "$endgrent_r_proto" in
        ''|0) try='int endgrent_r(FILE**);'
        define)
        case "$endgrent_r_proto" in
        ''|0) try='int endgrent_r(FILE**);'
-       ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
+       ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
        esac
        case "$endgrent_r_proto" in
        ''|0) try='void endgrent_r(FILE**);'
        esac
        case "$endgrent_r_proto" in
        ''|0) try='void endgrent_r(FILE**);'
-       ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
+       ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
        esac
        case "$endgrent_r_proto" in
        ''|0)   d_endgrent_r=undef
        esac
        case "$endgrent_r_proto" in
        ''|0)   d_endgrent_r=undef
@@ -11712,11 +12108,11 @@ case "$d_endhostent_r" in
        define)
        case "$endhostent_r_proto" in
        ''|0) try='int endhostent_r(struct hostent_data*);'
        define)
        case "$endhostent_r_proto" in
        ''|0) try='int endhostent_r(struct hostent_data*);'
-       ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
+       ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
        esac
        case "$endhostent_r_proto" in
        ''|0) try='void endhostent_r(struct hostent_data*);'
        esac
        case "$endhostent_r_proto" in
        ''|0) try='void endhostent_r(struct hostent_data*);'
-       ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
+       ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
        esac
        case "$endhostent_r_proto" in
        ''|0)   d_endhostent_r=undef
        esac
        case "$endhostent_r_proto" in
        ''|0)   d_endhostent_r=undef
@@ -11761,11 +12157,11 @@ case "$d_endnetent_r" in
        define)
        case "$endnetent_r_proto" in
        ''|0) try='int endnetent_r(struct netent_data*);'
        define)
        case "$endnetent_r_proto" in
        ''|0) try='int endnetent_r(struct netent_data*);'
-       ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
+       ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
        esac
        case "$endnetent_r_proto" in
        ''|0) try='void endnetent_r(struct netent_data*);'
        esac
        case "$endnetent_r_proto" in
        ''|0) try='void endnetent_r(struct netent_data*);'
-       ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
+       ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
        esac
        case "$endnetent_r_proto" in
        ''|0)   d_endnetent_r=undef
        esac
        case "$endnetent_r_proto" in
        ''|0)   d_endnetent_r=undef
@@ -11810,11 +12206,11 @@ case "$d_endprotoent_r" in
        define)
        case "$endprotoent_r_proto" in
        ''|0) try='int endprotoent_r(struct protoent_data*);'
        define)
        case "$endprotoent_r_proto" in
        ''|0) try='int endprotoent_r(struct protoent_data*);'
-       ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
+       ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
        esac
        case "$endprotoent_r_proto" in
        ''|0) try='void endprotoent_r(struct protoent_data*);'
        esac
        case "$endprotoent_r_proto" in
        ''|0) try='void endprotoent_r(struct protoent_data*);'
-       ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
+       ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
        esac
        case "$endprotoent_r_proto" in
        ''|0)   d_endprotoent_r=undef
        esac
        case "$endprotoent_r_proto" in
        ''|0)   d_endprotoent_r=undef
@@ -11947,11 +12343,11 @@ case "$d_endpwent_r" in
        define)
        case "$endpwent_r_proto" in
        ''|0) try='int endpwent_r(FILE**);'
        define)
        case "$endpwent_r_proto" in
        ''|0) try='int endpwent_r(FILE**);'
-       ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
+       ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
        esac
        case "$endpwent_r_proto" in
        ''|0) try='void endpwent_r(FILE**);'
        esac
        case "$endpwent_r_proto" in
        ''|0) try='void endpwent_r(FILE**);'
-       ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
+       ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
        esac
        case "$endpwent_r_proto" in
        ''|0)   d_endpwent_r=undef
        esac
        case "$endpwent_r_proto" in
        ''|0)   d_endpwent_r=undef
@@ -11996,11 +12392,11 @@ case "$d_endservent_r" in
        define)
        case "$endservent_r_proto" in
        ''|0) try='int endservent_r(struct servent_data*);'
        define)
        case "$endservent_r_proto" in
        ''|0) try='int endservent_r(struct servent_data*);'
-       ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
+       ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
        esac
        case "$endservent_r_proto" in
        ''|0) try='void endservent_r(struct servent_data*);'
        esac
        case "$endservent_r_proto" in
        ''|0) try='void endservent_r(struct servent_data*);'
-       ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
+       ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
        esac
        case "$endservent_r_proto" in
        ''|0)   d_endservent_r=undef
        esac
        case "$endservent_r_proto" in
        ''|0)   d_endservent_r=undef
@@ -12077,29 +12473,7 @@ else
 fi
 set d_open3
 eval $setvar
 fi
 set d_open3
 eval $setvar
-$rm -f try try.*
-
-: 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
+$rm_try
 
 : see if this is a sys/file.h system
 val=''
 
 : see if this is a sys/file.h system
 val=''
@@ -12154,6 +12528,14 @@ esac
 set i_fcntl
 eval $setvar
 
 set i_fcntl
 eval $setvar
 
+: see if fork exists
+set fork d_fork
+eval $inlibc
+
+: see if pipe exists
+set pipe d_pipe
+eval $inlibc
+
 : check for non-blocking I/O stuff
 case "$h_sysfile" in
 true) echo "#include <sys/file.h>" > head.c;;
 : check for non-blocking I/O stuff
 case "$h_sysfile" in
 true) echo "#include <sys/file.h>" > head.c;;
@@ -12208,18 +12590,20 @@ EOCP
        ;;
 *) echo "Using $hint value $o_nonblock.";;
 esac
        ;;
 *) echo "Using $hint value $o_nonblock.";;
 esac
-$rm -f try try.* .out core
+$rm_try
 
 echo " "
 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
 case "$eagain" in
 '')
 
 echo " "
 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
 case "$eagain" in
 '')
+       case "$d_fork:$d_pipe" in
+       define:define)
        $cat head.c > try.c
        $cat >>try.c <<EOCP
 #include <errno.h>
 #include <sys/types.h>
 #include <signal.h>
        $cat head.c > try.c
        $cat >>try.c <<EOCP
 #include <errno.h>
 #include <sys/types.h>
 #include <signal.h>
-#include <stdio.h> 
+#include <stdio.h>
 #$i_stdlib I_STDLIB
 #ifdef I_STDLIB
 #include <stdlib.h>
 #$i_stdlib I_STDLIB
 #ifdef I_STDLIB
 #include <stdlib.h>
@@ -12346,6 +12730,12 @@ EOCP
                echo "I can't compile the test program--assuming errno EAGAIN will do."
                eagain=EAGAIN
        fi
                echo "I can't compile the test program--assuming errno EAGAIN will do."
                eagain=EAGAIN
        fi
+       ;;
+       *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
+               eagain=EAGAIN
+               val="$define"
+               ;;
+       esac
        set d_eofnblk
        eval $setvar
        ;;
        set d_eofnblk
        eval $setvar
        ;;
@@ -12362,7 +12752,7 @@ EOCP
        esac
        ;;
 esac
        esac
        ;;
 esac
-$rm -f try try.* .out core head.c mtry
+$rm_try head.c mtry
 
 : see if _ptr and _cnt from stdio act std
 echo " "
 
 : see if _ptr and _cnt from stdio act std
 echo " "
@@ -12461,7 +12851,7 @@ if eval $compile && $to try.c; then
 else
        echo "Your stdio doesn't appear very std."
 fi
 else
        echo "Your stdio doesn't appear very std."
 fi
-$rm -f try.c try
+$rm_try
 
 # glibc 2.2.90 and above apparently change stdio streams so Perl's
 # direct buffer manipulation no longer works.  The Configure tests
 
 # glibc 2.2.90 and above apparently change stdio streams so Perl's
 # direct buffer manipulation no longer works.  The Configure tests
@@ -12561,7 +12951,7 @@ int main() {
        if (cnt == FILE_cnt(fp)) {
                puts("Pass_unchanged");
                exit (0);
        if (cnt == FILE_cnt(fp)) {
                puts("Pass_unchanged");
                exit (0);
-       }       
+       }
        if (FILE_cnt(fp) == (cnt - 42)) {
                puts("Pass_changed");
                exit (0);
        if (FILE_cnt(fp) == (cnt - 42)) {
                puts("Pass_changed");
                exit (0);
@@ -12588,7 +12978,7 @@ EOP
        else
                echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
        fi
        else
                echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
        fi
-       $rm -f try.c try
+       $rm_try
        ;;
 esac
 
        ;;
 esac
 
@@ -12626,7 +13016,7 @@ EOP
        else
                echo "However, it seems to be lacking the _base field."
        fi
        else
                echo "However, it seems to be lacking the _base field."
        fi
-       $rm -f try.c try
+       $rm_try
        ;;
 esac
 set d_stdiobase
        ;;
 esac
 set d_stdiobase
@@ -12665,8 +13055,8 @@ eval $inlibc
 set fcntl d_fcntl
 eval $inlibc
 
 set fcntl d_fcntl
 eval $inlibc
 
-echo " "
 : See if fcntl-based locking works.
 : See if fcntl-based locking works.
+echo " "
 $cat >try.c <<EOCP
 #$i_stdlib I_STDLIB
 #ifdef I_STDLIB
 $cat >try.c <<EOCP
 #$i_stdlib I_STDLIB
 #ifdef I_STDLIB
@@ -12729,8 +13119,7 @@ EOM
 esac
 set d_fcntl_can_lock
 eval $setvar
 esac
 set d_fcntl_can_lock
 eval $setvar
-$rm -f try*
-
+$rm_try
 
 : check for fd_set items
 $cat <<EOM
 
 : check for fd_set items
 $cat <<EOM
@@ -12808,7 +13197,7 @@ EOM
                d_fd_macros="$undef"
        fi
 fi
                d_fd_macros="$undef"
        fi
 fi
-$rm -f try try.*
+$rm_try
 
 : see if fgetpos exists
 set fgetpos d_fgetpos
 
 : see if fgetpos exists
 set fgetpos d_fgetpos
@@ -12831,10 +13220,6 @@ echo " "
 set d_flockproto flock $i_sysfile sys/file.h
 eval $hasproto
 
 set d_flockproto flock $i_sysfile sys/file.h
 eval $hasproto
 
-: see if fork exists
-set fork d_fork
-eval $inlibc
-
 : see if fp_class exists
 set fp_class d_fp_class
 eval $inlibc
 : see if fp_class exists
 set fp_class d_fp_class
 eval $inlibc
@@ -12859,7 +13244,6 @@ eval $inlibc
 set fpclassl d_fpclassl
 eval $inlibc
 
 set fpclassl d_fpclassl
 eval $inlibc
 
-
 : check for fpos64_t
 echo " "
 echo "Checking to see if you have fpos64_t..." >&4
 : check for fpos64_t
 echo " "
 echo "Checking to see if you have fpos64_t..." >&4
@@ -12878,7 +13262,7 @@ else
        8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
        esac
 fi
        8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
        esac
 fi
-$rm -f try.* try
+$rm_try
 set d_fpos64_t
 eval $setvar
 
 set d_fpos64_t
 eval $setvar
 
@@ -12894,7 +13278,7 @@ eval $inhdr
 set sys/mount.h i_sysmount
 eval $inhdr
 
 set sys/mount.h i_sysmount
 eval $inhdr
 
-
+: Check for fs_data_s
 echo " "
 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
 echo " "
 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
@@ -12915,12 +13299,10 @@ esac
 set fsetpos d_fsetpos
 eval $inlibc
 
 set fsetpos d_fsetpos
 eval $inlibc
 
-
 : see if fstatfs exists
 set fstatfs d_fstatfs
 eval $inlibc
 
 : see if fstatfs exists
 set fstatfs d_fstatfs
 eval $inlibc
 
-
 : see if statvfs exists
 set statvfs d_statvfs
 eval $inlibc
 : see if statvfs exists
 set statvfs d_statvfs
 eval $inlibc
@@ -12941,10 +13323,10 @@ case "$longsize" in
 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
 esac
 
 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
 esac
 
-d_futimes="$undef"
 : check for a working futimes
 : check for a working futimes
+d_futimes="$undef"
 echo " "
 echo " "
-echo "Checking for a working futimes()" >&4
+echo "Checking if you have a working futimes()" >&4
 $cat >try.c <<EOCP
 #include <stdio.h>
 #include <sys/time.h>
 $cat >try.c <<EOCP
 #include <stdio.h>
 #include <sys/time.h>
@@ -12965,16 +13347,74 @@ if eval $compile; then
     `$run ./try`
     rc=$?
     case "$rc" in
     `$run ./try`
     rc=$?
     case "$rc" in
-       0)  echo "Yes, it does" >&4
+       0)  echo "Yes, you have" >&4
            d_futimes="$define"
            ;;
            d_futimes="$define"
            ;;
-       *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
+       *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
            ;;
     esac
 else
            ;;
     esac
 else
-    echo "No, it does not (probably harmless)\n" >&4
+    echo "No, it does not (probably harmless)" >&4
+fi
+$rm_try
+
+: see if ndbm.h is available
+set ndbm.h i_ndbm
+eval $inhdr
+: Compatibility location for RedHat 7.1
+set gdbm/ndbm.h i_gdbmndbm
+eval $inhdr
+: Compatibility location for Debian 4.0
+set gdbm-ndbm.h i_gdbm_ndbm
+eval $inhdr
+
+val="$undef"
+if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
+       : see if dbm_open exists
+       set dbm_open d_dbm_open
+       eval $inlibc
+       case "$d_dbm_open" in
+       $undef)
+               i_ndbm="$undef"
+               i_gdbmndbm="$undef"
+               i_gdbm_ndbm="$undef"
+               echo "We won't be including <ndbm.h>"
+               val="$undef"
+               ;;
+       *) val="$define"
+          ;;
+       esac
 fi
 fi
-$rm -f try.* try core core.try.*
+set d_ndbm
+eval $setvar
+
+ndbm_hdr_protochk='name=$1; hdr=$2;
+eval "ihdr=\$""i_$name";
+val="$undef";
+if $test "$ihdr" = "$define"; then
+       $echo "Checking if your <$hdr> uses prototypes..." >&4;
+       case "$d_cplusplus" in
+       $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
+       *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
+       esac;
+       case "$val" in
+       $define) $echo "Your <$hdr> seems to have prototypes";;
+       *) $echo "Your <$hdr> does not seem to have prototypes";;
+       esac;
+fi;
+set "d_${name}_h_uses_prototypes";
+eval $setvar'
+
+set ndbm ndbm.h
+eval $ndbm_hdr_protochk
+set gdbmndbm gdbm/ndbm.h
+eval $ndbm_hdr_protochk
+set gdbm_ndbm gdbm-ndbm.h
+eval $ndbm_hdr_protochk
+
+: see if getaddrinfo exists
+set getaddrinfo d_getaddrinfo
+eval $inlibc
 
 : see if getcwd exists
 set getcwd d_getcwd
 
 : see if getcwd exists
 set getcwd d_getcwd
@@ -12984,7 +13424,6 @@ eval $inlibc
 set getespwnam d_getespwnam
 eval $inlibc
 
 set getespwnam d_getespwnam
 eval $inlibc
 
-
 : see if getfsstat exists
 set getfsstat d_getfsstat
 eval $inlibc
 : see if getfsstat exists
 set getfsstat d_getfsstat
 eval $inlibc
@@ -13009,27 +13448,27 @@ case "$d_getgrent_r" in
        define)
        case "$getgrent_r_proto" in
        ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
        define)
        case "$getgrent_r_proto" in
        ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
-       ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
        esac
        case "$getgrent_r_proto" in
        ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
        esac
        case "$getgrent_r_proto" in
        ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
-       ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
+       ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
        esac
        case "$getgrent_r_proto" in
        ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
        esac
        case "$getgrent_r_proto" in
        ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
-       ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
+       ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
        esac
        case "$getgrent_r_proto" in
        ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
        esac
        case "$getgrent_r_proto" in
        ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
-       ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
        esac
        case "$getgrent_r_proto" in
        ''|0) try='int getgrent_r(struct group*, char*, int);'
        esac
        case "$getgrent_r_proto" in
        ''|0) try='int getgrent_r(struct group*, char*, int);'
-       ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
        esac
        case "$getgrent_r_proto" in
        ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
        esac
        case "$getgrent_r_proto" in
        ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
-       ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
+       ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
        esac
        case "$getgrent_r_proto" in
        ''|0)   d_getgrent_r=undef
        esac
        case "$getgrent_r_proto" in
        ''|0)   d_getgrent_r=undef
@@ -13070,19 +13509,19 @@ case "$d_getgrgid_r" in
        define)
        case "$getgrgid_r_proto" in
        ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
        define)
        case "$getgrgid_r_proto" in
        ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
-       ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
        esac
        case "$getgrgid_r_proto" in
        ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
        esac
        case "$getgrgid_r_proto" in
        ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
-       ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
+       ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
        esac
        case "$getgrgid_r_proto" in
        ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
        esac
        case "$getgrgid_r_proto" in
        ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
-       ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
        esac
        case "$getgrgid_r_proto" in
        ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
        esac
        case "$getgrgid_r_proto" in
        ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
-       ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
        esac
        case "$getgrgid_r_proto" in
        ''|0)   d_getgrgid_r=undef
        esac
        case "$getgrgid_r_proto" in
        ''|0)   d_getgrgid_r=undef
@@ -13123,23 +13562,23 @@ case "$d_getgrnam_r" in
        define)
        case "$getgrnam_r_proto" in
        ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
        define)
        case "$getgrnam_r_proto" in
        ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
-       ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
        esac
        case "$getgrnam_r_proto" in
        ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
        esac
        case "$getgrnam_r_proto" in
        ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
-       ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
+       ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
        esac
        case "$getgrnam_r_proto" in
        ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
        esac
        case "$getgrnam_r_proto" in
        ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
-       ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
+       ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
        esac
        case "$getgrnam_r_proto" in
        ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
        esac
        case "$getgrnam_r_proto" in
        ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
-       ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
        esac
        case "$getgrnam_r_proto" in
        ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
        esac
        case "$getgrnam_r_proto" in
        ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
-       ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
        esac
        case "$getgrnam_r_proto" in
        ''|0)   d_getgrnam_r=undef
        esac
        case "$getgrnam_r_proto" in
        ''|0)   d_getgrnam_r=undef
@@ -13219,7 +13658,7 @@ case "$d_uname$d_gethname" in
 *define*)
        dflt=n
        cat <<EOM
 *define*)
        dflt=n
        cat <<EOM
+
 Every now and then someone has a $call() that lies about the hostname
 but can't be fixed for political or economic reasons.  If you wish, I can
 pretend $call() isn't there and maybe compute hostname at run-time
 Every now and then someone has a $call() that lies about the hostname
 but can't be fixed for political or economic reasons.  If you wish, I can
 pretend $call() isn't there and maybe compute hostname at run-time
@@ -13277,47 +13716,47 @@ case "$d_gethostbyaddr_r" in
        define)
        case "$gethostbyaddr_r_proto" in
        ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
        define)
        case "$gethostbyaddr_r_proto" in
        ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
-       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
-       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
-       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
-       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
-       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
-       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
-       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
-       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
-       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='int gethostbyaddr_r(const char*, int, int);'
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='int gethostbyaddr_r(const char*, int, int);'
-       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
-       ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0)   d_gethostbyaddr_r=undef
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0)   d_gethostbyaddr_r=undef
@@ -13358,15 +13797,15 @@ case "$d_gethostbyname_r" in
        define)
        case "$gethostbyname_r_proto" in
        ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
        define)
        case "$gethostbyname_r_proto" in
        ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
-       ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
        esac
        case "$gethostbyname_r_proto" in
        ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
        esac
        case "$gethostbyname_r_proto" in
        ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
-       ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
        esac
        case "$gethostbyname_r_proto" in
        ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
        esac
        case "$gethostbyname_r_proto" in
        ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
-       ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
+       ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
        esac
        case "$gethostbyname_r_proto" in
        ''|0)   d_gethostbyname_r=undef
        esac
        case "$gethostbyname_r_proto" in
        ''|0)   d_gethostbyname_r=undef
@@ -13407,27 +13846,27 @@ case "$d_gethostent_r" in
        define)
        case "$gethostent_r_proto" in
        ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
        define)
        case "$gethostent_r_proto" in
        ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
-       ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
        esac
        case "$gethostent_r_proto" in
        ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
        esac
        case "$gethostent_r_proto" in
        ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
-       ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
        esac
        case "$gethostent_r_proto" in
        ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
        esac
        case "$gethostent_r_proto" in
        ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
-       ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
+       ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
        esac
        case "$gethostent_r_proto" in
        ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
        esac
        case "$gethostent_r_proto" in
        ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
-       ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
        esac
        case "$gethostent_r_proto" in
        ''|0) try='int gethostent_r(struct hostent*, char*, int);'
        esac
        case "$gethostent_r_proto" in
        ''|0) try='int gethostent_r(struct hostent*, char*, int);'
-       ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
        esac
        case "$gethostent_r_proto" in
        ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
        esac
        case "$gethostent_r_proto" in
        ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
-       ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
+       ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
        esac
        case "$gethostent_r_proto" in
        ''|0)   d_gethostent_r=undef
        esac
        case "$gethostent_r_proto" in
        ''|0)   d_gethostent_r=undef
@@ -13481,19 +13920,19 @@ case "$d_getlogin_r" in
        define)
        case "$getlogin_r_proto" in
        ''|0) try='int getlogin_r(char*, size_t);'
        define)
        case "$getlogin_r_proto" in
        ''|0) try='int getlogin_r(char*, size_t);'
-       ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
+       ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
        esac
        case "$getlogin_r_proto" in
        ''|0) try='int getlogin_r(char*, int);'
        esac
        case "$getlogin_r_proto" in
        ''|0) try='int getlogin_r(char*, int);'
-       ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
+       ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
        esac
        case "$getlogin_r_proto" in
        ''|0) try='char* getlogin_r(char*, size_t);'
        esac
        case "$getlogin_r_proto" in
        ''|0) try='char* getlogin_r(char*, size_t);'
-       ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
+       ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
        esac
        case "$getlogin_r_proto" in
        ''|0) try='char* getlogin_r(char*, int);'
        esac
        case "$getlogin_r_proto" in
        ''|0) try='char* getlogin_r(char*, int);'
-       ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
+       ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
        esac
        case "$getlogin_r_proto" in
        ''|0)   d_getlogin_r=undef
        esac
        case "$getlogin_r_proto" in
        ''|0)   d_getlogin_r=undef
@@ -13526,6 +13965,10 @@ eval $inlibc
 set getmntent d_getmntent
 eval $inlibc
 
 set getmntent d_getmntent
 eval $inlibc
 
+: see if getnameinfo exists
+set getnameinfo d_getnameinfo
+eval $inlibc
+
 : see if getnetbyaddr exists
 set getnetbyaddr d_getnbyaddr
 eval $inlibc
 : see if getnetbyaddr exists
 set getnetbyaddr d_getnbyaddr
 eval $inlibc
@@ -13554,35 +13997,35 @@ case "$d_getnetbyaddr_r" in
        define)
        case "$getnetbyaddr_r_proto" in
        ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
        define)
        case "$getnetbyaddr_r_proto" in
        ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
-       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
+       ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
+       ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
+       ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
+       ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
-       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
+       ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
-       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
+       ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
-       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
+       ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
-       ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
+       ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0)   d_getnetbyaddr_r=undef
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0)   d_getnetbyaddr_r=undef
@@ -13623,19 +14066,19 @@ case "$d_getnetbyname_r" in
        define)
        case "$getnetbyname_r_proto" in
        ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
        define)
        case "$getnetbyname_r_proto" in
        ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
-       ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
+       ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
        esac
        case "$getnetbyname_r_proto" in
        ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
        esac
        case "$getnetbyname_r_proto" in
        ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
        esac
        case "$getnetbyname_r_proto" in
        ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
        esac
        case "$getnetbyname_r_proto" in
        ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
        esac
        case "$getnetbyname_r_proto" in
        ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
        esac
        case "$getnetbyname_r_proto" in
        ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
-       ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
+       ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
        esac
        case "$getnetbyname_r_proto" in
        ''|0)   d_getnetbyname_r=undef
        esac
        case "$getnetbyname_r_proto" in
        ''|0)   d_getnetbyname_r=undef
@@ -13676,27 +14119,27 @@ case "$d_getnetent_r" in
        define)
        case "$getnetent_r_proto" in
        ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
        define)
        case "$getnetent_r_proto" in
        ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
-       ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
+       ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
        esac
        case "$getnetent_r_proto" in
        ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
        esac
        case "$getnetent_r_proto" in
        ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
-       ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
+       ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
        esac
        case "$getnetent_r_proto" in
        ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
        esac
        case "$getnetent_r_proto" in
        ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
-       ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
+       ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
        esac
        case "$getnetent_r_proto" in
        ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
        esac
        case "$getnetent_r_proto" in
        ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
        esac
        case "$getnetent_r_proto" in
        ''|0) try='int getnetent_r(struct netent*, char*, int);'
        esac
        case "$getnetent_r_proto" in
        ''|0) try='int getnetent_r(struct netent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
        esac
        case "$getnetent_r_proto" in
        ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
        esac
        case "$getnetent_r_proto" in
        ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
-       ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
+       ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
        esac
        case "$getnetent_r_proto" in
        ''|0)   d_getnetent_r=undef
        esac
        case "$getnetent_r_proto" in
        ''|0)   d_getnetent_r=undef
@@ -13730,6 +14173,7 @@ eval $hasproto
 set getpagesize d_getpagsz
 eval $inlibc
 
 set getpagesize d_getpagsz
 eval $inlibc
 
+: Optional checks for getprotobyname and getprotobynumber
 
 : see if getprotobyname exists
 set getprotobyname d_getpbyname
 
 : see if getprotobyname exists
 set getprotobyname d_getpbyname
@@ -13775,15 +14219,15 @@ case "$d_getprotobyname_r" in
        define)
        case "$getprotobyname_r_proto" in
        ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
        define)
        case "$getprotobyname_r_proto" in
        ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
-       ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
        esac
        case "$getprotobyname_r_proto" in
        ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
        esac
        case "$getprotobyname_r_proto" in
        ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
        esac
        case "$getprotobyname_r_proto" in
        ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
        esac
        case "$getprotobyname_r_proto" in
        ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
-       ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
+       ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
        esac
        case "$getprotobyname_r_proto" in
        ''|0)   d_getprotobyname_r=undef
        esac
        case "$getprotobyname_r_proto" in
        ''|0)   d_getprotobyname_r=undef
@@ -13824,15 +14268,15 @@ case "$d_getprotobynumber_r" in
        define)
        case "$getprotobynumber_r_proto" in
        ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
        define)
        case "$getprotobynumber_r_proto" in
        ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
-       ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
        esac
        case "$getprotobynumber_r_proto" in
        ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
        esac
        case "$getprotobynumber_r_proto" in
        ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
+       ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
        esac
        case "$getprotobynumber_r_proto" in
        ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
        esac
        case "$getprotobynumber_r_proto" in
        ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
-       ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
+       ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
        esac
        case "$getprotobynumber_r_proto" in
        ''|0)   d_getprotobynumber_r=undef
        esac
        case "$getprotobynumber_r_proto" in
        ''|0)   d_getprotobynumber_r=undef
@@ -13873,19 +14317,19 @@ case "$d_getprotoent_r" in
        define)
        case "$getprotoent_r_proto" in
        ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
        define)
        case "$getprotoent_r_proto" in
        ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
-       ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
        esac
        case "$getprotoent_r_proto" in
        ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
        esac
        case "$getprotoent_r_proto" in
        ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
        esac
        case "$getprotoent_r_proto" in
        ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
        esac
        case "$getprotoent_r_proto" in
        ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
        esac
        case "$getprotoent_r_proto" in
        ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
        esac
        case "$getprotoent_r_proto" in
        ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
-       ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
+       ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
        esac
        case "$getprotoent_r_proto" in
        ''|0)   d_getprotoent_r=undef
        esac
        case "$getprotoent_r_proto" in
        ''|0)   d_getprotoent_r=undef
@@ -13939,27 +14383,27 @@ case "$d_getpwent_r" in
        define)
        case "$getpwent_r_proto" in
        ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
        define)
        case "$getpwent_r_proto" in
        ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
-       ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
        esac
        case "$getpwent_r_proto" in
        ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
        esac
        case "$getpwent_r_proto" in
        ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
-       ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
+       ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
        esac
        case "$getpwent_r_proto" in
        ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
        esac
        case "$getpwent_r_proto" in
        ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
-       ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
+       ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
        esac
        case "$getpwent_r_proto" in
        ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
        esac
        case "$getpwent_r_proto" in
        ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
-       ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
        esac
        case "$getpwent_r_proto" in
        ''|0) try='int getpwent_r(struct passwd*, char*, int);'
        esac
        case "$getpwent_r_proto" in
        ''|0) try='int getpwent_r(struct passwd*, char*, int);'
-       ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
        esac
        case "$getpwent_r_proto" in
        ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
        esac
        case "$getpwent_r_proto" in
        ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
-       ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
+       ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
        esac
        case "$getpwent_r_proto" in
        ''|0)   d_getpwent_r=undef
        esac
        case "$getpwent_r_proto" in
        ''|0)   d_getpwent_r=undef
@@ -14000,19 +14444,19 @@ case "$d_getpwnam_r" in
        define)
        case "$getpwnam_r_proto" in
        ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
        define)
        case "$getpwnam_r_proto" in
        ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
-       ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
        esac
        case "$getpwnam_r_proto" in
        ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
        esac
        case "$getpwnam_r_proto" in
        ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
-       ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
+       ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
        esac
        case "$getpwnam_r_proto" in
        ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
        esac
        case "$getpwnam_r_proto" in
        ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
-       ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
        esac
        case "$getpwnam_r_proto" in
        ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
        esac
        case "$getpwnam_r_proto" in
        ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
-       ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
        esac
        case "$getpwnam_r_proto" in
        ''|0)   d_getpwnam_r=undef
        esac
        case "$getpwnam_r_proto" in
        ''|0)   d_getpwnam_r=undef
@@ -14053,19 +14497,19 @@ case "$d_getpwuid_r" in
        define)
        case "$getpwuid_r_proto" in
        ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
        define)
        case "$getpwuid_r_proto" in
        ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
-       ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
        esac
        case "$getpwuid_r_proto" in
        ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
        esac
        case "$getpwuid_r_proto" in
        ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
-       ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
+       ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
        esac
        case "$getpwuid_r_proto" in
        ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
        esac
        case "$getpwuid_r_proto" in
        ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
-       ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
        esac
        case "$getpwuid_r_proto" in
        ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
        esac
        case "$getpwuid_r_proto" in
        ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
-       ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
        esac
        case "$getpwuid_r_proto" in
        ''|0)   d_getpwuid_r=undef
        esac
        case "$getpwuid_r_proto" in
        ''|0)   d_getpwuid_r=undef
@@ -14090,6 +14534,7 @@ case "$d_getpwuid_r" in
        ;;
 esac
 
        ;;
 esac
 
+: Optional checks for getsbyname and getsbyport
 
 : see if getservbyname exists
 set getservbyname d_getsbyname
 
 : see if getservbyname exists
 set getservbyname d_getsbyname
@@ -14119,15 +14564,15 @@ case "$d_getservbyname_r" in
        define)
        case "$getservbyname_r_proto" in
        ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
        define)
        case "$getservbyname_r_proto" in
        ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
-       ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
        esac
        case "$getservbyname_r_proto" in
        ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
        esac
        case "$getservbyname_r_proto" in
        ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
        esac
        case "$getservbyname_r_proto" in
        ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
        esac
        case "$getservbyname_r_proto" in
        ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
-       ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
+       ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
        esac
        case "$getservbyname_r_proto" in
        ''|0)   d_getservbyname_r=undef
        esac
        case "$getservbyname_r_proto" in
        ''|0)   d_getservbyname_r=undef
@@ -14168,15 +14613,15 @@ case "$d_getservbyport_r" in
        define)
        case "$getservbyport_r_proto" in
        ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
        define)
        case "$getservbyport_r_proto" in
        ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
-       ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
        esac
        case "$getservbyport_r_proto" in
        ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
        esac
        case "$getservbyport_r_proto" in
        ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
        esac
        case "$getservbyport_r_proto" in
        ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
        esac
        case "$getservbyport_r_proto" in
        ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
-       ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
+       ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
        esac
        case "$getservbyport_r_proto" in
        ''|0)   d_getservbyport_r=undef
        esac
        case "$getservbyport_r_proto" in
        ''|0)   d_getservbyport_r=undef
@@ -14217,19 +14662,19 @@ case "$d_getservent_r" in
        define)
        case "$getservent_r_proto" in
        ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
        define)
        case "$getservent_r_proto" in
        ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
-       ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
        esac
        case "$getservent_r_proto" in
        ''|0) try='int getservent_r(struct servent*, char*, int);'
        esac
        case "$getservent_r_proto" in
        ''|0) try='int getservent_r(struct servent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
        esac
        case "$getservent_r_proto" in
        ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
        esac
        case "$getservent_r_proto" in
        ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
-       ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
+       ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
        esac
        case "$getservent_r_proto" in
        ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
        esac
        case "$getservent_r_proto" in
        ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
-       ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
+       ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
        esac
        case "$getservent_r_proto" in
        ''|0)   d_getservent_r=undef
        esac
        case "$getservent_r_proto" in
        ''|0)   d_getservent_r=undef
@@ -14283,11 +14728,11 @@ case "$d_getspnam_r" in
        define)
        case "$getspnam_r_proto" in
        ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
        define)
        case "$getspnam_r_proto" in
        ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
-       ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
+       ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
        esac
        case "$getspnam_r_proto" in
        ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
        esac
        case "$getspnam_r_proto" in
        ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
-       ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
+       ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
        esac
        case "$getspnam_r_proto" in
        ''|0)   d_getspnam_r=undef
        esac
        case "$getspnam_r_proto" in
        ''|0)   d_getspnam_r=undef
@@ -14347,11 +14792,11 @@ case "$d_gmtime_r" in
        define)
        case "$gmtime_r_proto" in
        ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
        define)
        case "$gmtime_r_proto" in
        ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
-       ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
+       ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
        esac
        case "$gmtime_r_proto" in
        ''|0) try='int gmtime_r(const time_t*, struct tm*);'
        esac
        case "$gmtime_r_proto" in
        ''|0) try='int gmtime_r(const time_t*, struct tm*);'
-       ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
+       ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
        esac
        case "$gmtime_r_proto" in
        ''|0)   d_gmtime_r=undef
        esac
        case "$gmtime_r_proto" in
        ''|0)   d_gmtime_r=undef
@@ -14467,6 +14912,14 @@ set d_index; eval $setvar
 set inet_aton d_inetaton
 eval $inlibc
 
 set inet_aton d_inetaton
 eval $inlibc
 
+: see if inet_ntop exists
+set inet_ntop d_inetntop
+eval $inlibc
+
+: see if inet_pton exists
+set inet_pton d_inetpton
+eval $inlibc
+
 : Look for isascii
 echo " "
 $cat >isascii.c <<EOCP
 : Look for isascii
 echo " "
 $cat >isascii.c <<EOCP
@@ -14579,10 +15032,10 @@ eval $setvar
 set math.h i_math
 eval $inhdr
 
 set math.h i_math
 eval $inhdr
 
+: check to see if math.h defines _LIB_VERSION
 d_libm_lib_version="$undef"
 case $i_math in
     $define)
 d_libm_lib_version="$undef"
 case $i_math in
     $define)
-       : check to see if math.h defines _LIB_VERSION
        echo " "
        echo "Checking to see if your libm supports _LIB_VERSION..." >&4
        $cat >try.c <<EOCP
        echo " "
        echo "Checking to see if your libm supports _LIB_VERSION..." >&4
        $cat >try.c <<EOCP
@@ -14600,9 +15053,9 @@ EOCP
            echo "Yes, it does ($foo)" >&4
            d_libm_lib_version="$define"
        else
            echo "Yes, it does ($foo)" >&4
            d_libm_lib_version="$define"
        else
-           echo "No, it does not (probably harmless)\n" >&4
+           echo "No, it does not (probably harmless)" >&4
            fi
            fi
-       $rm -f try.* try core core.try.*
+       $rm_try
        ;;
 
     esac
        ;;
 
     esac
@@ -14627,11 +15080,11 @@ case "$d_localtime_r" in
        define)
        case "$localtime_r_proto" in
        ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
        define)
        case "$localtime_r_proto" in
        ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
-       ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
+       ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
        esac
        case "$localtime_r_proto" in
        ''|0) try='int localtime_r(const time_t*, struct tm*);'
        esac
        case "$localtime_r_proto" in
        ''|0) try='int localtime_r(const time_t*, struct tm*);'
-       ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
+       ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
        esac
        case "$localtime_r_proto" in
        ''|0)   d_localtime_r=undef
        esac
        case "$localtime_r_proto" in
        ''|0)   d_localtime_r=undef
@@ -14663,11 +15116,32 @@ REENTRANT_PROTO*)
 /*  Does our libc's localtime_r call tzset ?
  *  return 0 if so, 1 otherwise.
  */
 /*  Does our libc's localtime_r call tzset ?
  *  return 0 if so, 1 otherwise.
  */
-#include <sys/types.h>
-#include <unistd.h>
-#include <time.h>
-#include <string.h>
-#include <malloc.h>
+#$i_systypes   I_SYS_TYPES
+#$i_unistd     I_UNISTD
+#$i_time       I_TIME
+#$i_stdlib     I_STDLIB
+#$i_string     I_STRING
+#$i_malloc     I_MALLOC
+#ifdef I_SYS_TYPES
+#  include <sys/types.h>
+#endif
+#ifdef I_UNISTD
+#  include <unistd.h>
+#endif
+#ifdef I_TIME
+#  include <time.h>
+#endif
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#ifdef I_STRING
+#  include <string.h>
+#else
+#  include <strings.h>
+#endif
+#ifdef I_MALLOC
+#  include <malloc.h>
+#endif
 int main()
 {
     time_t t = time(0L);
 int main()
 {
     time_t t = time(0L);
@@ -14694,7 +15168,7 @@ int main()
 EOCP
        set try
        if eval $compile; then
 EOCP
        set try
        if eval $compile; then
-           if ./try; then
+           if $run ./try; then
                d_localtime_r_needs_tzset=undef;
            else
                d_localtime_r_needs_tzset=define;
                d_localtime_r_needs_tzset=undef;
            else
                d_localtime_r_needs_tzset=define;
@@ -14707,7 +15181,7 @@ EOCP
      d_localtime_r_needs_tzset=undef;
      ;;
 esac
      d_localtime_r_needs_tzset=undef;
      ;;
 esac
-$rm -f try try.* core
+$rm_try
 
 : see if localeconv exists
 set localeconv d_locconv
 
 : see if localeconv exists
 set localeconv d_locconv
@@ -14846,12 +15320,12 @@ $define$define)
 Checking to see whether your modfl() is okay for large values...
 EOM
 $cat >try.c <<EOCP
 Checking to see whether your modfl() is okay for large values...
 EOM
 $cat >try.c <<EOCP
-#include <math.h> 
+#include <math.h>
 #include <stdio.h>
 EOCP
 if $test "X$d_modflproto" != "X$define"; then
        $cat >>try.c <<EOCP
 #include <stdio.h>
 EOCP
 if $test "X$d_modflproto" != "X$define"; then
        $cat >>try.c <<EOCP
-/* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
+/* Sigh. many current glibcs provide the function, but do not prototype it. */
 long double modfl (long double, long double *);
 EOCP
 fi
 long double modfl (long double, long double *);
 EOCP
 fi
@@ -14859,7 +15333,7 @@ $cat >>try.c <<EOCP
 int main() {
     long double nv = 4294967303.15;
     long double v, w;
 int main() {
     long double nv = 4294967303.15;
     long double v, w;
-    v = modfl(nv, &w);         
+    v = modfl(nv, &w);
 #ifdef __GLIBC__
     printf("glibc");
 #endif
 #ifdef __GLIBC__
     printf("glibc");
 #endif
@@ -14890,7 +15364,7 @@ EOCP
                        d_modfl="$undef"
                        ;;
                esac
                        d_modfl="$undef"
                        ;;
                esac
-               $rm -f try.* try core core.try.*
+               $rm_try
        else
                echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
                d_modfl="$undef"
        else
                echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
                d_modfl="$undef"
@@ -14992,7 +15466,7 @@ fi
 set d_msg
 eval $setvar
 
 set d_msg
 eval $setvar
 
-
+: Check for msghdr_s
 echo " "
 echo "Checking to see if your system supports struct msghdr..." >&4
 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
 echo " "
 echo "Checking to see if your system supports struct msghdr..." >&4
 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
@@ -15023,40 +15497,6 @@ eval $inhdr
 set nl_langinfo d_nl_langinfo
 eval $inlibc
 
 set nl_langinfo d_nl_langinfo
 eval $inlibc
 
-: 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>
-#$i_stdlib I_STDLIB
-#ifdef I_STDLIB
-#include <stdlib.h>
-#endif
-int main()
-{
-    printf("%d\n", (int)sizeof(char));
-    exit(0);
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               dflt=`$run ./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
-
 : check for volatile keyword
 echo " "
 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
 : check for volatile keyword
 echo " "
 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
@@ -15086,9 +15526,9 @@ else
 fi
 set d_volatile
 eval $setvar
 fi
 set d_volatile
 eval $setvar
-$rm -f try try.*
-
+$rm_try
 
 
+: Check basic sizes
 echo " "
 $echo "Choosing the C types to be used for Perl's internal types..." >&4
 
 echo " "
 $echo "Choosing the C types to be used for Perl's internal types..." >&4
 
@@ -15145,38 +15585,10 @@ int main() {
 }
 EOCP
 
 }
 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 "`$run ./try`" 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
+i8type="signed char"
+u8type="unsigned char"
+i8size=1
+u8size=1
 
 case "$i16type" in
 '')    case "$shortsize" in
 
 case "$i16type" in
 '')    case "$shortsize" in
@@ -15318,7 +15730,7 @@ if eval $compile; then
        nv_preserves_uv_bits="`$run ./try`"
 fi
 case "$nv_preserves_uv_bits" in
        nv_preserves_uv_bits="`$run ./try`"
 fi
 case "$nv_preserves_uv_bits" in
-\-[1-9]*)      
+\-[1-9]*)
        nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
        $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
        d_nv_preserves_uv="$define"
        nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
        $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
        d_nv_preserves_uv="$define"
@@ -15328,8 +15740,90 @@ case "$nv_preserves_uv_bits" in
 *)     $echo "Can't figure out how many bits your NVs preserve." 2>&1
        nv_preserves_uv_bits="0" ;;
 esac
 *)     $echo "Can't figure out how many bits your NVs preserve." 2>&1
        nv_preserves_uv_bits="0" ;;
 esac
+$rm_try
+
+$echo "Checking to find the largest integer value your NVs can hold..." >&4
+: volatile so that the compiler has to store it out to memory.
+if test X"$d_volatile" = X"$define"; then
+       volatile=volatile
+fi
+$cat <<EOP >try.c
+#include <stdio.h>
+
+typedef $nvtype NV;
+
+int
+main() {
+  NV value = 2;
+  int count = 1;
+
+  while(count < 256) {
+    $volatile NV up = value + 1.0;
+    $volatile NV negated = -value;
+    $volatile NV down = negated - 1.0;
+    $volatile NV got_up = up - value;
+    int up_good = got_up == 1.0;
+    int got_down = down - negated;
+    int down_good = got_down == -1.0;
+
+    if (down_good != up_good) {
+      fprintf(stderr,
+             "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
+             up_good, (double) got_up, down_good, (double) got_down,
+             count, (double) value);
+      return 1;
+    }
+    if (!up_good) {
+      while (1) {
+       if (count > 8) {
+         count -= 8;
+         fputs("256.0", stdout);
+       } else {
+         count--;
+         fputs("2.0", stdout);
+       }
+       if (!count) {
+         puts("");
+         return 0;
+       }
+       fputs("*", stdout);
+      }
+    }
+    value *= 2;
+    ++count;
+  }
+  fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
+         count, (double) value);
+  return 1;
+}
+EOP
+set try
 
 
-$rm -f try.* try
+nv_overflows_integers_at='0'
+if eval $compile; then
+    xxx="`$run ./try`"
+    case "$?" in
+       0)
+           case "$xxx" in
+               2*)  cat >&4 <<EOM
+The largest integer your NVs can preserve is equal to $xxx
+EOM
+                   nv_overflows_integers_at="$xxx"
+                   ;;
+               *)  cat >&4 <<EOM
+Cannot determine the largest integer value your NVs can hold, unexpected output
+'$xxx'
+EOM
+                   ;;
+           esac
+           ;;
+       *)  cat >&4 <<EOM
+Cannot determine the largest integer value your NVs can hold
+EOM
+           ;;
+    esac
+fi
+$rm_try
 
 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
 : volatile so that the compiler has to store it out to memory.
 
 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
 : volatile so that the compiler has to store it out to memory.
@@ -15408,7 +15902,7 @@ int main(int argc, char **argv) {
        printf("(gives %g)\n", d);
        return 1;
     }
        printf("(gives %g)\n", d);
        return 1;
     }
-    
+
 #ifdef SIGFPE
     if (bletched) {
        printf("No - something bleched\n");
 #ifdef SIGFPE
     if (bletched) {
        printf("No - something bleched\n");
@@ -15450,9 +15944,7 @@ EOM
            ;;
     esac
 fi
            ;;
     esac
 fi
-
-$rm -f try.* try
-
+$rm_try
 
 : check for off64_t
 echo " "
 
 : check for off64_t
 echo " "
@@ -15473,14 +15965,14 @@ else
        8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
        esac
 fi
        8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
        esac
 fi
-$rm -f try.* try
+$rm_try
 set d_off64_t
 eval $setvar
 
 : how to create joinable pthreads
 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
        echo " "
 set d_off64_t
 eval $setvar
 
 : how to create joinable pthreads
 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
        echo " "
-       echo "Checking what constant to use for creating joinable pthreads..." >&4 
+       echo "Checking what constant to use for creating joinable pthreads..." >&4
        $cat >try.c <<'EOCP'
 #include <pthread.h>
 int main() {
        $cat >try.c <<'EOCP'
 #include <pthread.h>
 int main() {
@@ -15506,7 +15998,7 @@ EOCP
                        val=PTHREAD_CREATE_UNDETACHED
                        set old_pthread_create_joinable
                        eval $setvar
                        val=PTHREAD_CREATE_UNDETACHED
                        set old_pthread_create_joinable
                        eval $setvar
-               else            
+               else
                        set try -DJOINABLE=__UNDETACHED
                        if eval $compile; then
                                echo "You seem to use __UNDETACHED." >&4
                        set try -DJOINABLE=__UNDETACHED
                        if eval $compile; then
                                echo "You seem to use __UNDETACHED." >&4
@@ -15527,7 +16019,7 @@ EOCP
                        fi
                fi
        fi
                        fi
                fi
        fi
-       $rm -f try try.*
+       $rm_try
 else
     d_old_pthread_create_joinable="$undef"
     old_pthread_create_joinable=""
 else
     d_old_pthread_create_joinable="$undef"
     old_pthread_create_joinable=""
 set pause d_pause
 eval $inlibc
 
 set pause d_pause
 eval $inlibc
 
-: see if pipe exists
-set pipe d_pipe
-eval $inlibc
-
 : see if poll exists
 set poll d_poll
 eval $inlibc
 : see if poll exists
 set poll d_poll
 eval $inlibc
@@ -15549,6 +16037,7 @@ eval $inlibc
 set readlink d_readlink
 eval $inlibc
 
 set readlink d_readlink
 eval $inlibc
 
+: Check if exe is symlink to abs path of executing program
 echo " "
 procselfexe=''
 val="$undef"
 echo " "
 procselfexe=''
 val="$undef"
@@ -15656,7 +16145,6 @@ eval $setvar
 set pthread_attr_setscope d_pthread_attr_setscope
 eval $inlibc
 
 set pthread_attr_setscope d_pthread_attr_setscope
 eval $inlibc
 
-
 : see whether the various POSIXish _yields exist
 $cat >try.c <<EOP
 #include <pthread.h>
 : see whether the various POSIXish _yields exist
 $cat >try.c <<EOP
 #include <pthread.h>
@@ -15721,12 +16209,10 @@ $define)
 esac
 set d_pthread_yield
 eval $setvar
 esac
 set d_pthread_yield
 eval $setvar
-
 case "$sched_yield" in
 '') sched_yield=undef ;;
 esac
 case "$sched_yield" in
 '') sched_yield=undef ;;
 esac
-
-$rm -f try try.*
+$rm_try
 
 : see if random_r exists
 set random_r d_random_r
 
 : see if random_r exists
 set random_r d_random_r
@@ -15744,15 +16230,15 @@ case "$d_random_r" in
        define)
        case "$random_r_proto" in
        ''|0) try='int random_r(int*, struct random_data*);'
        define)
        case "$random_r_proto" in
        ''|0) try='int random_r(int*, struct random_data*);'
-       ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
+       ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
        esac
        case "$random_r_proto" in
        ''|0) try='int random_r(long*, struct random_data*);'
        esac
        case "$random_r_proto" in
        ''|0) try='int random_r(long*, struct random_data*);'
-       ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
+       ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
        esac
        case "$random_r_proto" in
        ''|0) try='int random_r(struct random_data*, int32_t*);'
        esac
        case "$random_r_proto" in
        ''|0) try='int random_r(struct random_data*, int32_t*);'
-       ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
+       ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
        esac
        case "$random_r_proto" in
        ''|0)   d_random_r=undef
        esac
        case "$random_r_proto" in
        ''|0)   d_random_r=undef
@@ -15803,11 +16289,11 @@ case "$d_readdir64_r" in
        define)
        case "$readdir64_r_proto" in
        ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
        define)
        case "$readdir64_r_proto" in
        ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
-       ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
+       ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
        esac
        case "$readdir64_r_proto" in
        ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
        esac
        case "$readdir64_r_proto" in
        ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
-       ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
+       ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
        esac
        case "$readdir64_r_proto" in
        ''|0)   d_readdir64_r=undef
        esac
        case "$readdir64_r_proto" in
        ''|0)   d_readdir64_r=undef
@@ -15848,11 +16334,11 @@ case "$d_readdir_r" in
        define)
        case "$readdir_r_proto" in
        ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
        define)
        case "$readdir_r_proto" in
        ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
-       ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
+       ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
        esac
        case "$readdir_r_proto" in
        ''|0) try='int readdir_r(DIR*, struct dirent*);'
        esac
        case "$readdir_r_proto" in
        ''|0) try='int readdir_r(DIR*, struct dirent*);'
-       ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
+       ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
        esac
        case "$readdir_r_proto" in
        ''|0)   d_readdir_r=undef
        esac
        case "$readdir_r_proto" in
        ''|0)   d_readdir_r=undef
@@ -15976,7 +16462,7 @@ exit(0);
 EOCP
                set try
                if eval $compile_ok; then
 EOCP
                set try
                if eval $compile_ok; then
-                       if ./try 2>/dev/null; then
+                       if $run ./try 2>/dev/null; then
                                echo "Yes, it can."
                                val="$define"
                        else
                                echo "Yes, it can."
                                val="$define"
                        else
@@ -15987,7 +16473,7 @@ EOCP
                fi
                ;;
        esac
                fi
                ;;
        esac
-       $rm -f try.* try core
+       $rm_try
        ;;
 esac
 set d_safebcpy
        ;;
 esac
 set d_safebcpy
@@ -16052,7 +16538,7 @@ exit(0);
 EOCP
                set try
                if eval $compile_ok; then
 EOCP
                set try
                if eval $compile_ok; then
-                       if ./try 2>/dev/null; then
+                       if $run ./try 2>/dev/null; then
                                echo "Yes, it can."
                                val="$define"
                        else
                                echo "Yes, it can."
                                val="$define"
                        else
@@ -16063,7 +16549,7 @@ EOCP
                fi
                ;;
        esac
                fi
                ;;
        esac
-       $rm -f try.* try core
+       $rm_try
        ;;
 esac
 set d_safemcpy
        ;;
 esac
 set d_safemcpy
@@ -16119,7 +16605,7 @@ EOCP
        fi
        ;;
 esac
        fi
        ;;
 esac
-$rm -f try.* try core
+$rm_try
 set d_sanemcmp
 eval $setvar
 
 set d_sanemcmp
 eval $setvar
 
@@ -16194,7 +16680,7 @@ else
     echo "You do not have union semun in <sys/sem.h>." >&4
     val="$undef"
 fi
     echo "You do not have union semun in <sys/sem.h>." >&4
     val="$undef"
 fi
-$rm -f try try.c
+$rm_try
 set d_union_semun
 eval $setvar
 
 set d_union_semun
 eval $setvar
 
@@ -16202,7 +16688,7 @@ eval $setvar
 case "$d_sem" in
 $define)
     echo " "
 case "$d_sem" in
 $define)
     echo " "
-    $cat > try.h <<END
+    $cat > tryh.h <<END
 #ifndef S_IRUSR
 #   ifdef S_IREAD
 #      define S_IRUSR S_IREAD
 #ifndef S_IRUSR
 #   ifdef S_IREAD
 #      define S_IRUSR S_IREAD
@@ -16237,7 +16723,7 @@ END
 #include <sys/stat.h>
 #include <stdio.h>
 #include <errno.h>
 #include <sys/stat.h>
 #include <stdio.h>
 #include <errno.h>
-#include "try.h"
+#include "tryh.h"
 #ifndef errno
 extern int errno;
 #endif
 #ifndef errno
 extern int errno;
 #endif
@@ -16283,7 +16769,7 @@ END
           semun) val="$define" ;;
           esac
       fi
           semun) val="$define" ;;
           esac
       fi
-      $rm -f try try.c
+      $rm_try
       set d_semctl_semun
       eval $setvar
       ;;
       set d_semctl_semun
       eval $setvar
       ;;
@@ -16307,7 +16793,7 @@ END
 #include <sys/ipc.h>
 #include <sys/sem.h>
 #include <sys/stat.h>
 #include <sys/ipc.h>
 #include <sys/sem.h>
 #include <sys/stat.h>
-#include "try.h"
+#include "tryh.h"
 #include <stdio.h>
 #include <errno.h>
 #ifndef errno
 #include <stdio.h>
 #include <errno.h>
 #ifndef errno
@@ -16345,7 +16831,7 @@ END
           semid_ds) val="$define" ;;
           esac
       fi
           semid_ds) val="$define" ;;
           esac
       fi
-      $rm -f try try.c
+      $rm_try
       set d_semctl_semid_ds
       eval $setvar
       ;;
       set d_semctl_semid_ds
       eval $setvar
       ;;
@@ -16357,7 +16843,6 @@ END
     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
         ;;
     esac
     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
         ;;
     esac
-    $rm -f try.h
     ;;
 *)  val="$undef"
 
     ;;
 *)  val="$undef"
 
@@ -16371,6 +16856,7 @@ END
     eval $setvar
     ;;
 esac
     eval $setvar
     ;;
 esac
+$rm_try tryh.h
 
 : see if sendmsg exists
 set sendmsg d_sendmsg
 
 : see if sendmsg exists
 set sendmsg d_sendmsg
@@ -16404,11 +16890,11 @@ case "$d_setgrent_r" in
        define)
        case "$setgrent_r_proto" in
        ''|0) try='int setgrent_r(FILE**);'
        define)
        case "$setgrent_r_proto" in
        ''|0) try='int setgrent_r(FILE**);'
-       ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
+       ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
        esac
        case "$setgrent_r_proto" in
        ''|0) try='void setgrent_r(FILE**);'
        esac
        case "$setgrent_r_proto" in
        ''|0) try='void setgrent_r(FILE**);'
-       ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
+       ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
        esac
        case "$setgrent_r_proto" in
        ''|0)   d_setgrent_r=undef
        esac
        case "$setgrent_r_proto" in
        ''|0)   d_setgrent_r=undef
@@ -16453,11 +16939,11 @@ case "$d_sethostent_r" in
        define)
        case "$sethostent_r_proto" in
        ''|0) try='int sethostent_r(int, struct hostent_data*);'
        define)
        case "$sethostent_r_proto" in
        ''|0) try='int sethostent_r(int, struct hostent_data*);'
-       ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
+       ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
        esac
        case "$sethostent_r_proto" in
        ''|0) try='void sethostent_r(int, struct hostent_data*);'
        esac
        case "$sethostent_r_proto" in
        ''|0) try='void sethostent_r(int, struct hostent_data*);'
-       ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
+       ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
        esac
        case "$sethostent_r_proto" in
        ''|0)   d_sethostent_r=undef
        esac
        case "$sethostent_r_proto" in
        ''|0)   d_sethostent_r=undef
@@ -16514,7 +17000,7 @@ case "$d_setlocale_r" in
        define)
        case "$setlocale_r_proto" in
        ''|0) try='int setlocale_r(int, const char*, char*, int);'
        define)
        case "$setlocale_r_proto" in
        ''|0) try='int setlocale_r(int, const char*, char*, int);'
-       ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
+       ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
        esac
        case "$setlocale_r_proto" in
        ''|0)   d_setlocale_r=undef
        esac
        case "$setlocale_r_proto" in
        ''|0)   d_setlocale_r=undef
@@ -16559,11 +17045,11 @@ case "$d_setnetent_r" in
        define)
        case "$setnetent_r_proto" in
        ''|0) try='int setnetent_r(int, struct netent_data*);'
        define)
        case "$setnetent_r_proto" in
        ''|0) try='int setnetent_r(int, struct netent_data*);'
-       ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
+       ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
        esac
        case "$setnetent_r_proto" in
        ''|0) try='void setnetent_r(int, struct netent_data*);'
        esac
        case "$setnetent_r_proto" in
        ''|0) try='void setnetent_r(int, struct netent_data*);'
-       ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
+       ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
        esac
        case "$setnetent_r_proto" in
        ''|0)   d_setnetent_r=undef
        esac
        case "$setnetent_r_proto" in
        ''|0)   d_setnetent_r=undef
@@ -16624,11 +17110,11 @@ case "$d_setprotoent_r" in
        define)
        case "$setprotoent_r_proto" in
        ''|0) try='int setprotoent_r(int, struct protoent_data*);'
        define)
        case "$setprotoent_r_proto" in
        ''|0) try='int setprotoent_r(int, struct protoent_data*);'
-       ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
+       ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
        esac
        case "$setprotoent_r_proto" in
        ''|0) try='void setprotoent_r(int, struct protoent_data*);'
        esac
        case "$setprotoent_r_proto" in
        ''|0) try='void setprotoent_r(int, struct protoent_data*);'
-       ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
+       ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
        esac
        case "$setprotoent_r_proto" in
        ''|0)   d_setprotoent_r=undef
        esac
        case "$setprotoent_r_proto" in
        ''|0)   d_setprotoent_r=undef
@@ -16673,11 +17159,11 @@ case "$d_setpwent_r" in
        define)
        case "$setpwent_r_proto" in
        ''|0) try='int setpwent_r(FILE**);'
        define)
        case "$setpwent_r_proto" in
        ''|0) try='int setpwent_r(FILE**);'
-       ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
+       ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
        esac
        case "$setpwent_r_proto" in
        ''|0) try='void setpwent_r(FILE**);'
        esac
        case "$setpwent_r_proto" in
        ''|0) try='void setpwent_r(FILE**);'
-       ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
+       ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
        esac
        case "$setpwent_r_proto" in
        ''|0)   d_setpwent_r=undef
        esac
        case "$setpwent_r_proto" in
        ''|0)   d_setpwent_r=undef
@@ -16742,11 +17228,11 @@ case "$d_setservent_r" in
        define)
        case "$setservent_r_proto" in
        ''|0) try='int setservent_r(int, struct servent_data*);'
        define)
        case "$setservent_r_proto" in
        ''|0) try='int setservent_r(int, struct servent_data*);'
-       ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
+       ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
        esac
        case "$setservent_r_proto" in
        ''|0) try='void setservent_r(int, struct servent_data*);'
        esac
        case "$setservent_r_proto" in
        ''|0) try='void setservent_r(int, struct servent_data*);'
-       ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
+       ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
        esac
        case "$setservent_r_proto" in
        ''|0)   d_setservent_r=undef
        esac
        case "$setservent_r_proto" in
        ''|0)   d_setservent_r=undef
@@ -16783,7 +17269,6 @@ eval $inlibc
 set sfio.h i_sfio
 eval $inhdr
 
 set sfio.h i_sfio
 eval $inhdr
 
-
 : see if sfio library is available
 case "$i_sfio" in
 $define)
 : see if sfio library is available
 case "$i_sfio" in
 $define)
@@ -16933,8 +17418,8 @@ fi
 set d_shm
 eval $setvar
 
 set d_shm
 eval $setvar
 
-echo " "
 : see if we have sigaction
 : see if we have sigaction
+echo " "
 if set sigaction val -f d_sigaction; eval $csym; $val; then
        echo 'sigaction() found.' >&4
        $cat > try.c <<EOP
 if set sigaction val -f d_sigaction; eval $csym; $val; then
        echo 'sigaction() found.' >&4
        $cat > try.c <<EOP
@@ -16966,7 +17451,7 @@ else
        val="$undef"
 fi
 set d_sigaction; eval $setvar
        val="$undef"
 fi
 set d_sigaction; eval $setvar
-$rm -f try try$_o try.c
+$rm_try
 
 : see if this is a sunmath.h system
 set sunmath.h i_sunmath
 
 : see if this is a sunmath.h system
 set sunmath.h i_sunmath
@@ -17011,7 +17496,7 @@ else
 fi
 set d_signbit
 eval $setvar
 fi
 set d_signbit
 eval $setvar
-$rm -f try.* try
+$rm_try
 
 : see if sigprocmask exists
 set sigprocmask d_sigprocmask
 
 : see if sigprocmask exists
 set sigprocmask d_sigprocmask
@@ -17064,7 +17549,7 @@ EOM
 esac
 set d_sigsetjmp
 eval $setvar
 esac
 set d_sigsetjmp
 eval $setvar
-$rm -f try.c try
+$rm_try
 
 : see if snprintf exists
 set snprintf d_snprintf
 
 : see if snprintf exists
 set snprintf d_snprintf
@@ -17127,7 +17612,7 @@ EOM
        d_snprintf="$undef"
        d_vsnprintf="$undef"
     fi
        d_snprintf="$undef"
        d_vsnprintf="$undef"
     fi
-    $rm -f try.* try core core.try.*
+    $rm_try
     ;;
 esac
 
     ;;
 esac
 
@@ -17187,7 +17672,6 @@ int main(int argc, char **argv) {
 EOP
 set try
 
 EOP
 set try
 
-d_sprintf_returns_strlen="$undef"
 if eval $compile; then
     xxx="`$run ./try`"
     case "$?" in
 if eval $compile; then
     xxx="`$run ./try`"
     case "$?" in
@@ -17202,9 +17686,11 @@ EOM
        d_sprintf_returns_strlen="$undef"
         ;;
     esac
        d_sprintf_returns_strlen="$undef"
         ;;
     esac
+else
+    echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
+    d_sprintf_returns_strlen="$undef"
 fi
 fi
-
-$rm -f try.* try
+$rm_try
 
 : see if srand48_r exists
 set srand48_r d_srand48_r
 
 : see if srand48_r exists
 set srand48_r d_srand48_r
@@ -17222,7 +17708,7 @@ case "$d_srand48_r" in
        define)
        case "$srand48_r_proto" in
        ''|0) try='int srand48_r(long, struct drand48_data*);'
        define)
        case "$srand48_r_proto" in
        ''|0) try='int srand48_r(long, struct drand48_data*);'
-       ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
+       ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
        esac
        case "$srand48_r_proto" in
        ''|0)   d_srand48_r=undef
        esac
        case "$srand48_r_proto" in
        ''|0)   d_srand48_r=undef
@@ -17263,7 +17749,7 @@ case "$d_srandom_r" in
        define)
        case "$srandom_r_proto" in
        ''|0) try='int srandom_r(unsigned int, struct random_data*);'
        define)
        case "$srandom_r_proto" in
        ''|0) try='int srandom_r(unsigned int, struct random_data*);'
-       ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
+       ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
        esac
        case "$srandom_r_proto" in
        ''|0)   d_srandom_r=undef
        esac
        case "$srandom_r_proto" in
        ''|0)   d_srandom_r=undef
@@ -17302,24 +17788,21 @@ eval $hasproto
 set sys/stat.h i_sysstat
 eval $inhdr
 
 set sys/stat.h i_sysstat
 eval $inhdr
 
-
 : see if stat knows about block sizes
 echo " "
 echo "Checking to see if your struct stat has st_blocks field..." >&4
 set d_statblks stat st_blocks $i_sysstat sys/stat.h
 eval $hasfield
 
 : see if stat knows about block sizes
 echo " "
 echo "Checking to see if your struct stat has st_blocks field..." >&4
 set d_statblks stat st_blocks $i_sysstat sys/stat.h
 eval $hasfield
 
-
 : see if this is a sys/vfs.h system
 set sys/vfs.h i_sysvfs
 eval $inhdr
 
 : see if this is a sys/vfs.h system
 set sys/vfs.h i_sysvfs
 eval $inhdr
 
-
 : see if this is a sys/statfs.h system
 set sys/statfs.h i_sysstatfs
 eval $inhdr
 
 : see if this is a sys/statfs.h system
 set sys/statfs.h i_sysstatfs
 eval $inhdr
 
-
+: Check for statfs_s
 echo " "
 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
 echo " "
 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
@@ -17330,10 +17813,9 @@ case "$d_statfs_s" in
 esac
 
 
 esac
 
 
-
 : see if struct statfs knows about f_flags
 case "$d_statfs_s" in
 : see if struct statfs knows about f_flags
 case "$d_statfs_s" in
-define)        
+define)
        echo " "
        echo "Checking to see if your struct statfs has f_flags field..." >&4
        set d_statfs_f_flags statfs f_flags $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
        echo " "
        echo "Checking to see if your struct statfs has f_flags field..." >&4
        set d_statfs_f_flags statfs f_flags $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
@@ -17349,6 +17831,7 @@ case "$d_statfs_f_flags" in
 *)              echo "No, it doesn't." ;;
 esac
 
 *)              echo "No, it doesn't." ;;
 esac
 
+: Check stream access
 $cat >&4 <<EOM
 Checking how to access stdio streams by file descriptor number...
 EOM
 $cat >&4 <<EOM
 Checking how to access stdio streams by file descriptor number...
 EOM
@@ -17369,7 +17852,7 @@ EOCP
                        esac
                fi
        done
                        esac
                fi
        done
-       $rm -f try.* try$exe_ext
+       $rm_try
 esac
 case "$stdio_stream_array" in
 '')    $cat >&4 <<EOM
 esac
 case "$stdio_stream_array" in
 '')    $cat >&4 <<EOM
@@ -17410,7 +17893,7 @@ else
 fi
 set d_strctcpy
 eval $setvar
 fi
 set d_strctcpy
 eval $setvar
-$rm -f try try.*
+$rm_try
 
 : see if strerror and/or sys_errlist[] exist
 echo " "
 
 : see if strerror and/or sys_errlist[] exist
 echo " "
@@ -17467,15 +17950,15 @@ case "$d_strerror_r" in
        define)
        case "$strerror_r_proto" in
        ''|0) try='int strerror_r(int, char*, size_t);'
        define)
        case "$strerror_r_proto" in
        ''|0) try='int strerror_r(int, char*, size_t);'
-       ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
+       ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
        esac
        case "$strerror_r_proto" in
        ''|0) try='int strerror_r(int, char*, int);'
        esac
        case "$strerror_r_proto" in
        ''|0) try='int strerror_r(int, char*, int);'
-       ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
+       ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
        esac
        case "$strerror_r_proto" in
        ''|0) try='char* strerror_r(int, char*, size_t);'
        esac
        case "$strerror_r_proto" in
        ''|0) try='char* strerror_r(int, char*, size_t);'
-       ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
+       ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
        esac
        case "$strerror_r_proto" in
        ''|0)   d_strerror_r=undef
        esac
        case "$strerror_r_proto" in
        ''|0)   d_strerror_r=undef
@@ -17542,7 +18025,7 @@ EOM
 #define strtoll _strtoll
 #endif
 #include <stdio.h>
 #define strtoll _strtoll
 #endif
 #include <stdio.h>
-extern long long int strtoll(char *s, char **, int); 
+extern long long int strtoll(char *s, char **, int);
 static int bad = 0;
 int check(char *s, long long ell, int een) {
        long long gll;
 static int bad = 0;
 int check(char *s, long long ell, int een) {
        long long gll;
@@ -17599,7 +18082,7 @@ EOM
        $cat >try.c <<'EOCP'
 #include <errno.h>
 #include <stdio.h>
        $cat >try.c <<'EOCP'
 #include <errno.h>
 #include <stdio.h>
-extern unsigned long int strtoul(char *s, char **, int); 
+extern unsigned long int strtoul(char *s, char **, int);
 static int bad = 0;
 void check(char *s, unsigned long eul, int een) {
        unsigned long gul;
 static int bad = 0;
 void check(char *s, unsigned long eul, int een) {
        unsigned long gul;
@@ -17682,7 +18165,7 @@ EOM
 #define strtoull __strtoull
 #endif
 #include <stdio.h>
 #define strtoull __strtoull
 #endif
 #include <stdio.h>
-extern unsigned long long int strtoull(char *s, char **, int); 
+extern unsigned long long int strtoull(char *s, char **, int);
 static int bad = 0;
 int check(char *s, long long eull, int een) {
        long long gull;
 static int bad = 0;
 int check(char *s, long long eull, int een) {
        long long gull;
@@ -17736,7 +18219,7 @@ EOM
        $cat >try.c <<'EOCP'
 #include <errno.h>
 #include <stdio.h>
        $cat >try.c <<'EOCP'
 #include <errno.h>
 #include <stdio.h>
-extern unsigned long long int strtouq(char *s, char **, int); 
+extern unsigned long long int strtouq(char *s, char **, int);
 static int bad = 0;
 void check(char *s, unsigned long long eull, int een) {
        unsigned long long gull;
 static int bad = 0;
 void check(char *s, unsigned long long eull, int een) {
        unsigned long long gull;
@@ -17835,6 +18318,10 @@ if test "X$d_time" = X -o X"$timetype" = X; then
     eval $setvar
 fi
 
     eval $setvar
 fi
 
+: see if timegm exists
+set timegm d_timegm
+eval $inlibc
+
 : see if this is a sys/times.h system
 set sys/times.h i_systimes
 eval $inhdr
 : see if this is a sys/times.h system
 set sys/times.h i_systimes
 eval $inhdr
@@ -17873,7 +18360,7 @@ case "$d_tmpnam_r" in
        define)
        case "$tmpnam_r_proto" in
        ''|0) try='char* tmpnam_r(char*);'
        define)
        case "$tmpnam_r_proto" in
        ''|0) try='char* tmpnam_r(char*);'
-       ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
+       ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
        esac
        case "$tmpnam_r_proto" in
        ''|0)   d_tmpnam_r=undef
        esac
        case "$tmpnam_r_proto" in
        ''|0)   d_tmpnam_r=undef
@@ -17918,15 +18405,15 @@ case "$d_ttyname_r" in
        define)
        case "$ttyname_r_proto" in
        ''|0) try='int ttyname_r(int, char*, size_t);'
        define)
        case "$ttyname_r_proto" in
        ''|0) try='int ttyname_r(int, char*, size_t);'
-       ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
+       ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
        esac
        case "$ttyname_r_proto" in
        ''|0) try='int ttyname_r(int, char*, int);'
        esac
        case "$ttyname_r_proto" in
        ''|0) try='int ttyname_r(int, char*, int);'
-       ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
+       ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
        esac
        case "$ttyname_r_proto" in
        ''|0) try='char* ttyname_r(int, char*, int);'
        esac
        case "$ttyname_r_proto" in
        ''|0) try='char* ttyname_r(int, char*, int);'
-       ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
+       ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
        esac
        case "$ttyname_r_proto" in
        ''|0)   d_ttyname_r=undef
        esac
        case "$ttyname_r_proto" in
        ''|0)   d_ttyname_r=undef
@@ -17963,6 +18450,7 @@ fi
 set d_tzname
 eval $setvar
 
 set d_tzname
 eval $setvar
 
+: Check if is a multiplatform env
 case "$osname" in
 next|rhapsody|darwin) multiarch="$define" ;;
 esac
 case "$osname" in
 next|rhapsody|darwin) multiarch="$define" ;;
 esac
@@ -18021,7 +18509,7 @@ int main()
 EOCP
                xxx_prompt=y
                set try
 EOCP
                xxx_prompt=y
                set try
-               if eval $compile && ./try > /dev/null; then
+               if eval $compile && $run ./try > /dev/null; then
                        dflt=`$run ./try`
                        case "$dflt" in
                        [1-4][1-4][1-4][1-4]|12345678|87654321)
                        dflt=`$run ./try`
                        case "$dflt" in
                        [1-4][1-4][1-4][1-4]|12345678|87654321)
@@ -18049,11 +18537,11 @@ EOM
                esac
                ;;
        esac
                esac
                ;;
        esac
-       $rm -f try.c try
+       $rm_try
        ;;
 esac
 
        ;;
 esac
 
-
+: Checking 32bit aligndness
 $cat <<EOM
 
 Checking to see whether you can access character data unalignedly...
 $cat <<EOM
 
 Checking to see whether you can access character data unalignedly...
@@ -18153,7 +18641,7 @@ else
        *)      d_u32align="$define" ;;
        esac
 fi
        *)      d_u32align="$define" ;;
        esac
 fi
-$rm -f core core.try.* try.core
+$rm_try
 ;;
 esac
 
 ;;
 esac
 
@@ -18220,7 +18708,7 @@ case "$d_closedir" in
 #endif
 #endif
 #endif
 #endif
 #endif
 #endif
-#endif 
+#endif
 int main() { return closedir(opendir(".")); }
 EOM
        set try
 int main() { return closedir(opendir(".")); }
 EOM
        set try
@@ -18243,7 +18731,8 @@ EOM
 esac
 set d_void_closedir
 eval $setvar
 esac
 set d_void_closedir
 eval $setvar
-$rm -f try try.*
+$rm_try
+
 : see if there is a wait4
 set wait4 d_wait4
 eval $inlibc
 : see if there is a wait4
 set wait4 d_wait4
 eval $inlibc
@@ -18322,7 +18811,7 @@ EOCP
        rp="Doubles must be aligned on a how-many-byte boundary?"
        . ./myread
        alignbytes="$ans"
        rp="Doubles must be aligned on a how-many-byte boundary?"
        . ./myread
        alignbytes="$ans"
-       $rm -f try.c try
+       $rm_try
        ;;
 esac
 
        ;;
 esac
 
@@ -18401,7 +18890,7 @@ int main(int argc, char *argv[])
     /* check that db.h & libdb are compatible */
     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
        printf("db.h and libdb are incompatible.\n") ;
     /* check that db.h & libdb are compatible */
     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
        printf("db.h and libdb are incompatible.\n") ;
-        exit(3);       
+        exit(3);
     }
 
     printf("db.h and libdb are compatible.\n") ;
     }
 
     printf("db.h and libdb are compatible.\n") ;
@@ -18413,7 +18902,7 @@ int main(int argc, char *argv[])
     if (Version < 2003004) {
     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
        printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
     if (Version < 2003004) {
     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
        printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
-        exit(2);       
+        exit(2);
     }
 
     exit(0);
     }
 
     exit(0);
@@ -18452,13 +18941,13 @@ EOCP
                        ;;
                esac
        fi
                        ;;
                esac
        fi
-       $rm -f try try.*
+       $rm_try
        ;;
 esac
 
 case "$i_db" in
 define)
        ;;
 esac
 
 case "$i_db" in
 define)
-       : Check the return type needed for hash 
+       : Check the return type needed for hash
        echo " "
        echo "Checking return type needed for hash for Berkeley DB ..." >&4
        $cat >try.c <<EOCP
        echo " "
        echo "Checking return type needed for hash for Berkeley DB ..." >&4
        $cat >try.c <<EOCP
@@ -18495,7 +18984,7 @@ EOCP
                echo "Help:  I can't seem to compile the db test program." >&4
                echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
        fi
                echo "Help:  I can't seem to compile the db test program." >&4
                echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
        fi
-       $rm -f try try.*
+       $rm_try
        echo "Your version of Berkeley DB uses $db_hashtype for hash."
        ;;
 *)     db_hashtype=u_int32_t
        echo "Your version of Berkeley DB uses $db_hashtype for hash."
        ;;
 *)     db_hashtype=u_int32_t
@@ -18503,7 +18992,7 @@ EOCP
 esac
 case "$i_db" in
 define)
 esac
 case "$i_db" in
 define)
-       : Check the return type needed for prefix 
+       : Check the return type needed for prefix
        echo " "
        echo "Checking return type needed for prefix for Berkeley DB ..." >&4
        cat >try.c <<EOCP
        echo " "
        echo "Checking return type needed for prefix for Berkeley DB ..." >&4
        cat >try.c <<EOCP
@@ -18540,14 +19029,13 @@ EOCP
                echo "Help:  I can't seem to compile the db test program." >&4
                echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
        fi
                echo "Help:  I can't seem to compile the db test program." >&4
                echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
        fi
-       $rm -f try try.*
+       $rm_try
        echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
        ;;
 *)     db_prefixtype='size_t'
        ;;
 esac
 
        echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
        ;;
 *)     db_prefixtype='size_t'
        ;;
 esac
 
-
 : How can we generate normalized random numbers ?
 echo " "
 echo "Looking for a random number function..." >&4
 : How can we generate normalized random numbers ?
 echo " "
 echo "Looking for a random number function..." >&4
@@ -18653,7 +19141,7 @@ EOCP
                        rp="How many bits does your $randfunc() function produce?"
                        . ./myread
                        randbits="$ans"
                        rp="How many bits does your $randfunc() function produce?"
                        . ./myread
                        randbits="$ans"
-                       $rm -f try.c try
+                       $rm_try
                        drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
                        seedfunc="s$randfunc"
                        randseedtype=unsigned
                        drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
                        seedfunc="s$randfunc"
                        randseedtype=unsigned
@@ -18678,6 +19166,7 @@ EOCP
        esac
 done
 
        esac
 done
 
+: Determine if this is an EBCDIC system
 echo " "
 echo "Determining whether or not we are on an EBCDIC system..." >&4
 $cat >try.c <<'EOM'
 echo " "
 echo "Determining whether or not we are on an EBCDIC system..." >&4
 $cat >try.c <<'EOM'
@@ -18701,10 +19190,11 @@ else
        echo "I'm unable to compile the test program." >&4
        echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
 fi
        echo "I'm unable to compile the test program." >&4
        echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
 fi
-$rm -f try try.*
+$rm_try
 set ebcdic
 eval $setvar
 
 set ebcdic
 eval $setvar
 
+: Check how to flush
 echo " "
 $cat >&4 <<EOM
 Checking how to flush all pending stdio output...
 echo " "
 $cat >&4 <<EOM
 Checking how to flush all pending stdio output...
@@ -18764,7 +19254,7 @@ int main() {
 #    endif
 #   endif
 #  endif
 #    endif
 #   endif
 #  endif
-# endif 
+# endif
 # ifdef HAS_STDIO_STREAM_ARRAY
     if (open_max > 0) {
       long i;
 # ifdef HAS_STDIO_STREAM_ARRAY
     if (open_max > 0) {
       long i;
@@ -18773,7 +19263,7 @@ int main() {
                STDIO_STREAM_ARRAY[i]._file < open_max &&
                STDIO_STREAM_ARRAY[i]._flag)
                fflush(&STDIO_STREAM_ARRAY[i]);
                STDIO_STREAM_ARRAY[i]._file < open_max &&
                STDIO_STREAM_ARRAY[i]._flag)
                fflush(&STDIO_STREAM_ARRAY[i]);
-    }  
+    }
   }
 # endif
 #endif
   }
 # endif
 #endif
@@ -18942,7 +19432,7 @@ EOM
                                        fflushall="`$cat try.out`"
                                fi
                        fi
                                        fflushall="`$cat try.out`"
                                fi
                        fi
-                       $rm -f core try.core core.try.*
+                       $rm_try
                        case "$fflushall" in
                        x)      $cat >&4 <<EOM
 Whew. Flushing explicitly all the stdio streams works.
                        case "$fflushall" in
                        x)      $cat >&4 <<EOM
 Whew. Flushing explicitly all the stdio streams works.
@@ -18992,7 +19482,7 @@ We won't be flushing handles at all before fork/exec/popen.
 EOM
        ;;
 esac
 EOM
        ;;
 esac
-$rm -f try.* try$exe_ext
+$rm_try tryp
 
 : Store the full pathname to the ar program for use in the C program
 : Respect a hint or command line value for full_ar.
 
 : Store the full pathname to the ar program for use in the C program
 : Respect a hint or command line value for full_ar.
@@ -19027,12 +19517,13 @@ gid_t) echo "gid_t found." ;;
        ;;
 esac
 
        ;;
 esac
 
+: Check the size of GID
 echo " "
 case "$gidtype" in
 *_t) zzz="$gidtype"    ;;
 *)   zzz="gid"         ;;
 esac
 echo " "
 case "$gidtype" in
 *_t) zzz="$gidtype"    ;;
 *)   zzz="gid"         ;;
 esac
-echo "Checking the size of $zzz..." >&4 
+echo "Checking the size of $zzz..." >&4
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
@@ -19062,12 +19553,13 @@ else
 fi
 
 
 fi
 
 
+: Check if GID is signed
 echo " "
 case "$gidtype" in
 *_t) zzz="$gidtype"    ;;
 *)   zzz="gid"         ;;
 esac
 echo " "
 case "$gidtype" in
 *_t) zzz="$gidtype"    ;;
 *)   zzz="gid"         ;;
 esac
-echo "Checking the sign of $zzz..." >&4 
+echo "Checking the sign of $zzz..." >&4
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
@@ -19099,6 +19591,7 @@ else
 fi
 
 
 fi
 
 
+: Check 64bit sizes
 echo " "
 
 if $test X"$quadtype" != X; then
 echo " "
 
 if $test X"$quadtype" != X; then
 if $test X"$sPRId64" = X; then
        echo "Cannot figure out how to print 64-bit integers." >&4
 fi
 if $test X"$sPRId64" = X; then
        echo "Cannot figure out how to print 64-bit integers." >&4
 fi
-
-$rm -f try try.*
+$rm_try
 
 fi
 
 case "$sPRId64" in
 
 fi
 
 case "$sPRId64" in
-'')    d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
-       d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
+'')    d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
+       d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
        ;;
        ;;
-*)     d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
-       d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
+*)     d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
+       d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
        ;;
 esac
 
        ;;
 esac
 
-
+: Check format strings for internal types
 echo " "
 $echo "Checking the format strings to be used for Perl's internal types..." >&4
 
 echo " "
 $echo "Checking the format strings to be used for Perl's internal types..." >&4
 
@@ -19314,6 +19806,7 @@ case "$ivdformat" in
     ;;
 esac
 
     ;;
 esac
 
+: Check format string for GID
 
 echo " "
 $echo "Checking the format string to be used for gids..." >&4
 
 echo " "
 $echo "Checking the format string to be used for gids..." >&4
@@ -19361,7 +19854,6 @@ eval $inlibc
 set setgroups d_setgrps
 eval $inlibc
 
 set setgroups d_setgrps
 eval $inlibc
 
-
 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
 echo " "
 case "$d_getgrps$d_setgrps" in
 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
 echo " "
 case "$d_getgrps$d_setgrps" in
@@ -19382,6 +19874,7 @@ EOM
 *)  groupstype="$gidtype";;
 esac
 
 *)  groupstype="$gidtype";;
 esac
 
+: MAD = Misc Attribute Definition
 
 if $test $patchlevel -lt 9; then
 : MAD is not available in 5.8.x or earlier.
 
 if $test $patchlevel -lt 9; then
 : MAD is not available in 5.8.x or earlier.
@@ -19415,6 +19908,7 @@ esac
 set mad
 eval $setvar
 
 set mad
 eval $setvar
 
+: check whether make sets MAKE
 echo " "
 echo "Checking if your $make program sets \$(MAKE)..." >&4
 case "$make_set_make" in
 echo " "
 echo "Checking if your $make program sets \$(MAKE)..." >&4
 case "$make_set_make" in
@@ -19458,28 +19952,28 @@ ivfprintf(FILE *f, const char *fmt, va_list *valp)
 {
   return vfprintf(f, fmt, *valp);
 }
 {
   return vfprintf(f, fmt, *valp);
 }
-int    
+
+int
 myvfprintf(FILE *f, const  char *fmt, va_list val)
 {
   return ivfprintf(f, fmt, &val);
 }
 myvfprintf(FILE *f, const  char *fmt, va_list val)
 {
   return ivfprintf(f, fmt, &val);
 }
-      
+
 int
 int
-myprintf(char *fmt, ...) 
+myprintf(char *fmt, ...)
 {
   va_list val;
   va_start(val, fmt);
 {
   va_list val;
   va_start(val, fmt);
-  return myvfprintf(stdout, fmt, val); 
-}         
+  return myvfprintf(stdout, fmt, val);
+}
 
 int
 main(int ac, char **av)
 {
   signal(SIGSEGV, exit);
 
 
 int
 main(int ac, char **av)
 {
   signal(SIGSEGV, exit);
 
-  myprintf("%s%cs all right, then\n", "that", '\'');                            
-  exit(0);      
+  myprintf("%s%cs all right, then\n", "that", '\'');
+  exit(0);
 }
 EOCP
        set try
 }
 EOCP
        set try
@@ -19498,7 +19992,7 @@ EOCP
                need_va_copy="$define"
                ;;
        esac
                need_va_copy="$define"
                ;;
        esac
-       $rm -f try.* core core.* *.core *.core.*
+       $rm_try
        ;;
 *)     echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
        ;;
        ;;
 *)     echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
        ;;
@@ -19527,7 +20021,7 @@ EOM
                for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
                        for yyy in size_t long int; do
                                case "$netdb_host_type" in
                for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
                        for yyy in size_t long int; do
                                case "$netdb_host_type" in
-                               '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
+                               '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
                                        if ./protochk "$try" $hdrs; then
                                                echo "Your system accepts $xxx for the first arg."
                                                echo "...and $yyy for the second arg."
                                        if ./protochk "$try" $hdrs; then
                                                echo "Your system accepts $xxx for the first arg."
                                                echo "...and $yyy for the second arg."
@@ -19576,7 +20070,7 @@ EOM
                        $i_unistd unistd.h"
                for xxx in "const char *" "char *"; do
                        case "$netdb_name_type" in
                        $i_unistd unistd.h"
                for xxx in "const char *" "char *"; do
                        case "$netdb_name_type" in
-                       '')     try="extern struct hostent *gethostbyname($xxx);"
+                       '')     try="$extern_C struct hostent *gethostbyname($xxx);"
                                if ./protochk "$try" $hdrs; then
                                        echo "Your system accepts $xxx."
                                        netdb_name_type="$xxx"
                                if ./protochk "$try" $hdrs; then
                                        echo "Your system accepts $xxx."
                                        netdb_name_type="$xxx"
@@ -19614,7 +20108,7 @@ EOM
                        $i_unistd unistd.h"
                for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
                        case "$netdb_net_type" in
                        $i_unistd unistd.h"
                for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
                        case "$netdb_net_type" in
-                       '')     try="extern struct netent *getnetbyaddr($xxx, int);"
+                       '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
                                if ./protochk "$try" $hdrs; then
                                        echo "Your system accepts $xxx."
                                        netdb_net_type="$xxx"
                                if ./protochk "$try" $hdrs; then
                                        echo "Your system accepts $xxx."
                                        netdb_net_type="$xxx"
@@ -19658,9 +20152,6 @@ case "$pager" in
        esac
        ;;
 *)     dflt="$pager"
        esac
        ;;
 *)     dflt="$pager"
-       : Instruct ./getfile to trust the hinted or previous pager value,
-       : even if it does not begin with a slash.  For example, on os2,
-       : pager might be cmd /c more.  See comments in UU/getfile.
        fn="f/($pager)"
        ;;
 esac
        fn="f/($pager)"
        ;;
 esac
@@ -19729,7 +20220,177 @@ else
 fi
 $rm -f foo* bar*
 
 fi
 $rm -f foo* bar*
 
-: check for type of arguments to select. 
+: see if this is a values.h system
+set values.h i_values
+eval $inhdr
+
+: Check the max offset that gmtime and localtime accept
+echo "Checking max offsets that gmtime () accepts"
+
+case $i_values in
+    define) yyy="#include <values.h>" ;;
+    *)      yyy="" ;;
+    esac
+
+case "$sGMTIME_min/$sGMTIME_max" in
+    0/0|/)
+       $cat >try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+#include <time.h>
+$yyy
+
+int i;
+struct tm *tmp;
+time_t pt;
+
+void gm_check (time_t t, int min_year, int max_year)
+{
+    tmp = gmtime (&t);
+    if ( tmp == NULL ||
+       /* Check tm_year overflow */
+        tmp->tm_year < min_year || tmp->tm_year > max_year)
+       tmp = NULL;
+    else
+       pt = t;
+    } /* gm_check */
+
+int check_max ()
+{
+    tmp = NULL;
+    pt  = 0;
+#ifdef MAXLONG
+    gm_check (MAXLONG, 69, 0x7fffffff);
+#endif
+    if (tmp == NULL || tmp->tm_year < 0) {
+       for (i = 63; i >= 0; i--) {
+           time_t x = pt | ((time_t)1 << i);
+           if (x < 0 || x < pt) continue;
+           gm_check (x, 69, 0x7fffffff);
+           }
+       }
+    printf ("sGMTIME_max=%ld\n", pt);
+    return (0);
+    } /* check_max */
+
+int check_min ()
+{
+    tmp = NULL;
+    pt  = 0;
+#ifdef MINLONG
+    gm_check (MINLONG, -1900, 70);
+#endif
+    if (tmp == NULL) {
+       for (i = 36; i >= 0; i--) {
+           time_t x = pt - ((time_t)1 << i);
+           if (x > 0) continue;
+           gm_check (x, -1900, 70);
+           }
+       }
+    printf ("sGMTIME_min=%ld\n", pt);
+    return (0);
+    } /* check_min */
+
+int main (int argc, char *argv[])
+{
+    fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
+    check_max ();
+    check_min ();
+    return (0);
+    } /* main */
+EOCP
+       set try
+       if eval $compile; then
+           eval `$run ./try`
+       else
+           echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
+           fi
+       $rm_try
+       ;;
+    esac
+
+echo "Checking max offsets that localtime () accepts"
+
+case "$sLOCALTIME_min/$sLOCALTIME_max" in
+    0/0|/)
+       $cat >try.c <<EOCP
+#include <sys/types.h>
+#include <stdio.h>
+#include <time.h>
+$yyy
+
+int i;
+struct tm *tmp;
+time_t pt;
+
+void local_check (time_t t, int min_year, int max_year)
+{
+    if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
+       tmp = NULL;
+    else
+       tmp = localtime (&t);
+    if ( tmp == NULL ||
+       /* Check tm_year overflow */
+        tmp->tm_year < min_year || tmp->tm_year > max_year)
+       tmp = NULL;
+    else
+       pt = t;
+    } /* local_check */
+
+int check_max ()
+{
+    tmp = NULL;
+    pt  = 0;
+#ifdef MAXLONG
+    local_check (MAXLONG, 69, 0x7fffffff);
+#endif
+    if (tmp == NULL || tmp->tm_year < 0) {
+       for (i = 63; i >= 0; i--) {
+           time_t x = pt | ((time_t)1 << i);
+           if (x < 0 || x < pt) continue;
+           local_check (x, 69, 0x7fffffff);
+           }
+       }
+    printf ("sLOCALTIME_max=%ld\n", pt);
+    return (0);
+   } /* check_max */
+
+int check_min ()
+{
+    tmp = NULL;
+    pt  = 0;
+#ifdef MINLONG
+    local_check (MINLONG, -1900, 70);
+#endif
+    if (tmp == NULL) {
+       for (i = 36; i >= 0; i--) {
+           time_t x = pt - ((time_t)1 << i);
+           if (x > 0) continue;
+           local_check (x, -1900, 70);
+           }
+       }
+    printf ("sLOCALTIME_min=%ld\n", pt);
+    return (0);
+    } /* check_min */
+
+int main (int argc, char *argv[])
+{
+    check_max ();
+    check_min ();
+    return (0);
+    } /* main */
+EOCP
+       set try
+       if eval $compile; then
+           eval `$run ./try`
+       else
+           echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
+           fi
+       $rm_try
+       ;;
+    esac
+
+: check for type of arguments to select.
 case "$selecttype" in
 '') case "$d_select" in
        $define)
 case "$selecttype" in
 '') case "$d_select" in
        $define)
@@ -19738,7 +20399,7 @@ case "$selecttype" in
 Checking to see what type of arguments are accepted by select().
 EOM
                hdrs="$define sys/types.h
 Checking to see what type of arguments are accepted by select().
 EOM
                hdrs="$define sys/types.h
-                       $i_systime sys/time.h 
+                       $i_systime sys/time.h
                        $i_sysselct sys/select.h
                        $d_socket sys/socket.h"
                : The first arg can be int, unsigned, or size_t
                        $i_sysselct sys/select.h
                        $d_socket sys/socket.h"
                : The first arg can be int, unsigned, or size_t
@@ -19750,7 +20411,7 @@ EOM
                        for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
                                for tmo in 'struct timeval *' 'const struct timeval *'; do
                                        case "$val" in
                        for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
                                for tmo in 'struct timeval *' 'const struct timeval *'; do
                                        case "$val" in
-                                       '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
+                                       '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
                                                if ./protochk "$try" $hdrs; then
                                                        echo "Your system accepts $xxx."
                                                        val="$xxx"
                                                if ./protochk "$try" $hdrs; then
                                                        echo "Your system accepts $xxx."
                                                        val="$xxx"
@@ -19877,7 +20538,7 @@ EOM
                        val=$ans
                        selectminbits="$val"
                fi
                        val=$ans
                        selectminbits="$val"
                fi
-               $rm -f try.* try
+               $rm_try
                ;;
        *)      : no select, so pick a harmless default
                selectminbits=$safebits
                ;;
        *)      : no select, so pick a harmless default
                selectminbits=$safebits
@@ -19887,28 +20548,20 @@ EOM
 esac
 
 : Trace out the files included by signal.h, then look for SIGxxx names.
 esac
 
 : Trace out the files included by signal.h, then look for SIGxxx names.
-: Remove SIGARRAYSIZE used by HPUX.
-: Remove SIGSTKSIZE used by Linux.
-: Remove SIGSTKSZ used by Posix.
-: Remove SIGTYP void lines used by OS2.
-: 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 |
 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' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
+       $grep '^[       ]*#.*include' |
+       $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
+               $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
 fi
 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
 xxxfiles=''
 for xx in $xxx /dev/null ; do
        $test -f "$xx" && xxxfiles="$xxxfiles $xx"
 done
 xxxfiles=''
 for xx in $xxx /dev/null ; do
        $test -f "$xx" && xxxfiles="$xxxfiles $xx"
 done
-: If we have found no files, at least try signal.h
 case "$xxxfiles" in
 '')    xxxfiles=`./findhdr signal.h` ;;
 esac
 case "$xxxfiles" in
 '')    xxxfiles=`./findhdr signal.h` ;;
 esac
@@ -20019,14 +20672,14 @@ $1 ~ /^NSIG$/ { nsig = $2 }
     if (sig_name[$2]) {
        dup_name[ndups] = $1
        dup_num[ndups] = $2
     if (sig_name[$2]) {
        dup_name[ndups] = $1
        dup_num[ndups] = $2
-       ndups++ 
+       ndups++
     }
     else {
        sig_name[$2] = $1
        sig_num[$2] = $2
     }
 }
     }
     else {
        sig_name[$2] = $1
        sig_num[$2] = $2
     }
 }
-END { 
+END {
     if (nsig == 0) {
        nsig = maxsig + 1
     }
     if (nsig == 0) {
        nsig = maxsig + 1
     }
@@ -20036,7 +20689,7 @@ END {
            printf("%s %d\n", sig_name[n], sig_num[n])
        }
        else {
            printf("%s %d\n", sig_name[n], sig_num[n])
        }
        else {
-           printf("NUM%d %d\n", n, n) 
+           printf("NUM%d %d\n", n, n)
        }
     }
     for (n = 0; n < ndups; n++) {
        }
     }
     for (n = 0; n < ndups; n++) {
@@ -20056,7 +20709,8 @@ $cat >>signal_cmd <<'EOS'
 
 set signal
 if eval $compile_ok; then
 
 set signal
 if eval $compile_ok; then
-       $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
+       $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
+               $uniq | $awk -f signal.awk >signal.lst
 else
        echo "(I can't seem be able to compile the whole test program)" >&4
        echo "(I'll try it in little pieces.)" >&4
 else
        echo "(I can't seem be able to compile the whole test program)" >&4
        echo "(I'll try it in little pieces.)" >&4
@@ -20156,14 +20810,15 @@ echo $sig_name | $awk \
        printf "\n"
 }'
 sig_size=`echo $sig_name | awk '{print NF}'`
        printf "\n"
 }'
 sig_size=`echo $sig_name | awk '{print NF}'`
-$rm -f signal signal.c signal.awk signal.lst signal_cmd 
+$rm -f signal signal.c signal.awk signal.lst signal_cmd
 
 
+: Check size of size
 echo " "
 case "$sizetype" in
 *_t) zzz="$sizetype"   ;;
 *)   zzz="filesize"    ;;
 esac
 echo " "
 case "$sizetype" in
 *_t) zzz="$sizetype"   ;;
 *)   zzz="filesize"    ;;
 esac
-echo "Checking the size of $zzz..." >&4 
+echo "Checking the size of $zzz..." >&4
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
@@ -20215,7 +20870,7 @@ else
        size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
        esac
 fi
        size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
        esac
 fi
-$rm -f try try.*
+$rm_try
 set d_socklen_t
 eval $setvar
 
 set d_socklen_t
 eval $setvar
 
@@ -20237,7 +20892,7 @@ EOM
        yyy="$yyy $sizetype int long unsigned"
        for xxx in $yyy; do
                case "$socksizetype" in
        yyy="$yyy $sizetype int long unsigned"
        for xxx in $yyy; do
                case "$socksizetype" in
-               '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
+               '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
                        case "$usesocks" in
                        "$define")
                                if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
                        case "$usesocks" in
                        "$define")
                                if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
@@ -20287,7 +20942,7 @@ int main()
                printf("$dflt\n");
        else if (sizeof(Size_t) == sizeof(int))
                printf("int\n");
                printf("$dflt\n");
        else if (sizeof(Size_t) == sizeof(int))
                printf("int\n");
-       else 
+       else
                printf("long\n");
        exit(0);
 }
                printf("long\n");
        exit(0);
 }
@@ -20311,12 +20966,11 @@ EOM
        . ./myread
        ssizetype="$ans"
 fi
        . ./myread
        ssizetype="$ans"
 fi
-$rm -f try try.*
+$rm_try
 
 : see what type of char stdio uses.
 echo " "
 
 : see what type of char stdio uses.
 echo " "
-echo '#include <stdio.h>' > stdio.c
-$cppstdin $cppminus < stdio.c > stdioh
+echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
        echo "Your stdio uses unsigned chars." >&4
        stdchar="unsigned char"
 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
        echo "Your stdio uses unsigned chars." >&4
        stdchar="unsigned char"
@@ -20324,7 +20978,7 @@ else
        echo "Your stdio uses signed chars." >&4
        stdchar="char"
 fi
        echo "Your stdio uses signed chars." >&4
        stdchar="char"
 fi
-$rm -f stdio.* stdioh
+$rm -f stdioh
 
 : see what type uids are declared as in the kernel
 echo " "
 
 : see what type uids are declared as in the kernel
 echo " "
@@ -20350,12 +21004,13 @@ uid_t)        echo "uid_t found." ;;
        ;;
 esac
 
        ;;
 esac
 
+: Check size of UID
 echo " "
 case "$uidtype" in
 *_t) zzz="$uidtype"    ;;
 *)   zzz="uid"         ;;
 esac
 echo " "
 case "$uidtype" in
 *_t) zzz="$uidtype"    ;;
 *)   zzz="uid"         ;;
 esac
-echo "Checking the size of $zzz..." >&4 
+echo "Checking the size of $zzz..." >&4
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
 cat > try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
@@ -20384,6 +21039,7 @@ else
        echo "(I can't compile the test program--guessing $uidsize.)" >&4
 fi
 
        echo "(I can't compile the test program--guessing $uidsize.)" >&4
 fi
 
+: Check if UID is signed
 echo " "
 case "$uidtype" in
 *_t) zzz="$uidtype"    ;;
 echo " "
 case "$uidtype" in
 *_t) zzz="$uidtype"    ;;
@@ -20421,7 +21077,7 @@ else
 fi
 
 
 fi
 
 
-
+: Check format string for UID
 echo " "
 $echo "Checking the format string to be used for uids..." >&4
 
 echo " "
 $echo "Checking the format string to be used for uids..." >&4
 
@@ -20460,7 +21116,7 @@ case "$uidsign" in
        ;;
 esac
 
        ;;
 esac
 
-
+: Check if site customization support was requested
 case "$usesitecustomize" in
     $define|true|[Yy]*)
        usesitecustomize="$define"
 case "$usesitecustomize" in
     $define|true|[Yy]*)
        usesitecustomize="$define"
@@ -20501,6 +21157,10 @@ case "$yacc" in
        ;;
 esac
 
        ;;
 esac
 
+: see if this is a assert.h system
+set assert.h i_assert
+eval $inhdr
+
 : see if this is a fp.h system
 set fp.h i_fp
 eval $inhdr
 : see if this is a fp.h system
 set fp.h i_fp
 eval $inhdr
@@ -20548,46 +21208,10 @@ else
        i_machcthr="$undef"
 fi
 
        i_machcthr="$undef"
 fi
 
-
-
 : see if this is a mntent.h system
 set mntent.h i_mntent
 eval $inhdr
 
 : see if this is a mntent.h system
 set mntent.h i_mntent
 eval $inhdr
 
-: see if ndbm.h is available
-set ndbm.h t_ndbm
-eval $inhdr
-
-case "$t_ndbm" in
-$undef)
-    # Some Linux distributions such as RedHat 7.1 put the
-    # ndbm.h header in /usr/include/gdbm/ndbm.h.
-    if $test -f /usr/include/gdbm/ndbm.h; then
-       echo '<gdbm/ndbm.h> found.'
-        ccflags="$ccflags -I/usr/include/gdbm"
-        cppflags="$cppflags -I/usr/include/gdbm"
-        t_ndbm=$define
-    fi
-    ;;
-esac
-
-case "$t_ndbm" in
-$define)
-       : see if dbm_open exists
-       set dbm_open d_dbm_open
-       eval $inlibc
-       case "$d_dbm_open" in
-       $undef)
-               t_ndbm="$undef"
-               echo "We won't be including <ndbm.h>"
-               ;;
-       esac
-       ;;
-esac
-val="$t_ndbm"
-set i_ndbm
-eval $setvar
-
 : see if net/errno.h is available
 val=''
 set net/errno.h val
 : see if net/errno.h is available
 val=''
 set net/errno.h val
@@ -20611,7 +21235,7 @@ EOM
                echo "We won't be including <net/errno.h>." >&4
                val="$undef"
        fi
                echo "We won't be including <net/errno.h>." >&4
                val="$undef"
        fi
-       $rm -f try.* try
+       $rm_try
        ;;
 esac
 set i_neterrno
        ;;
 esac
 set i_neterrno
@@ -20629,6 +21253,7 @@ eval $inhdr
 set prot.h i_prot
 eval $inhdr
 
 set prot.h i_prot
 eval $inhdr
 
+: Preprocessor symbols
 echo " "
 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
 $cat <<'EOSH' > Cppsym.know
 echo " "
 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
 $cat <<'EOSH' > Cppsym.know
@@ -20654,7 +21279,7 @@ IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
-Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
+LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
@@ -20673,7 +21298,7 @@ pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
 pc532 pdp11 PGC PIC plexus PORTAR posix
 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
 POSIX_C_SOURCE POSIX_SOURCE POWER
 pc532 pdp11 PGC PIC plexus PORTAR posix
 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
 POSIX_C_SOURCE POSIX_SOURCE POWER
-PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
+PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
 sony sony_news sonyrisc sparc sparclite spectrum
 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
 sony sony_news sonyrisc sparc sparclite spectrum
@@ -20763,11 +21388,11 @@ $eunicefix Cppsym.try
 ./Cppsym < Cppsym.know > Cppsym.true
 : Add in any linux cpp "predefined macros":
 case "$osname::$gccversion" in
 ./Cppsym < Cppsym.know > Cppsym.true
 : Add in any linux cpp "predefined macros":
 case "$osname::$gccversion" in
-  *linux*::*.*)
+  *linux*::*.*|*gnukfreebsd*::*.*)
     tHdrH=_tmpHdr
     rm -f $tHdrH'.h' $tHdrH
     touch $tHdrH'.h'
     tHdrH=_tmpHdr
     rm -f $tHdrH'.h' $tHdrH
     touch $tHdrH'.h'
-    if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
+    if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
        if [ -s $tHdrH'_cppsym.real' ]; then
          cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
        if [ -s $tHdrH'_cppsym.real' ]; then
          cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
@@ -20793,7 +21418,7 @@ do
        -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
        esac
 done
        -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
        esac
 done
-$rm -f try.c
+$rm_try
 EOS
 postprocess_cc_v=''
 chmod +x ccsym
 EOS
 postprocess_cc_v=''
 chmod +x ccsym
@@ -20869,14 +21494,14 @@ case "$val3" in
                                echo "<sgtty.h> found." >&4
                        else
                                echo "System is pyramid with BSD universe."
                                echo "<sgtty.h> found." >&4
                        else
                                echo "System is pyramid with BSD universe."
-                               echo "<sgtty.h> not found--you could have problems." >&4
+                               ./warn "<sgtty.h> not found--you could have problems."
                        fi;;
                *) if $test `./findhdr termio.h`; then
                                val="$define"
                                echo "<termio.h> found." >&4
                        else
                                echo "System is pyramid with USG universe."
                        fi;;
                *) if $test `./findhdr termio.h`; then
                                val="$define"
                                echo "<termio.h> found." >&4
                        else
                                echo "System is pyramid with USG universe."
-                               echo "<termio.h> not found--you could have problems." >&4
+                               ./warn "<termio.h> not found--you could have problems."
                        fi;;
                esac
        elif ./usg; then
                        fi;;
                esac
        elif ./usg; then
@@ -20887,7 +21512,7 @@ case "$val3" in
                        echo "<sgtty.h> found." >&4
                        val2="$define"
                else
                        echo "<sgtty.h> found." >&4
                        val2="$define"
                else
-echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
+                       ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
                fi
        else
                if $test `./findhdr sgtty.h`; then
                fi
        else
                if $test `./findhdr sgtty.h`; then
@@ -20897,7 +21522,7 @@ echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
                        echo "<termio.h> found." >&4
                        val="$define"
                else
                        echo "<termio.h> found." >&4
                        val="$define"
                else
-echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
+                       ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
                fi
        fi;;
 esac
                fi
        fi;;
 esac
 set i_syssockio
 eval $setvar
 
 set i_syssockio
 eval $setvar
 
-
 : see if this is a syslog.h system
 set syslog.h i_syslog
 eval $inhdr
 
 : see if this is a syslog.h system
 set syslog.h i_syslog
 eval $inhdr
 
-
 : see if this is a sys/mode.h system
 set sys/mode.h i_sysmode
 eval $inhdr
 
 : see if this is a sys/mode.h system
 set sys/mode.h i_sysmode
 eval $inhdr
 
+: see if there is a sys/poll.h file
+set sys/poll.h i_syspoll
+eval $inhdr
+
 : see if sys/resource.h has to be included
 set sys/resource.h i_sysresrc
 eval $inhdr
 : see if sys/resource.h has to be included
 set sys/resource.h i_sysresrc
 eval $inhdr
@@ -20980,7 +21607,6 @@ eval $inhdr
 set sys/un.h i_sysun
 eval $inhdr
 
 set sys/un.h i_sysun
 eval $inhdr
 
-
 : see if this is a sys/utsname.h system
 set sys/utsname.h i_sysutsname
 eval $inhdr
 : see if this is a sys/utsname.h system
 set sys/utsname.h i_sysutsname
 eval $inhdr
@@ -20997,10 +21623,6 @@ eval $inhdr
 set utime.h i_utime
 eval $inhdr
 
 set utime.h i_utime
 eval $inhdr
 
-: see if this is a values.h system
-set values.h i_values
-eval $inhdr
-
 : see if this is a vfork system
 case "$d_vfork" in
 "$define")
 : see if this is a vfork system
 case "$d_vfork" in
 "$define")
@@ -21012,6 +21634,7 @@ case "$d_vfork" in
        ;;
 esac
 
        ;;
 esac
 
+: Check extensions
 echo " "
 echo "Looking for extensions..." >&4
 : If we are using the old config.sh, known_extensions may contain
 echo " "
 echo "Looking for extensions..." >&4
 : If we are using the old config.sh, known_extensions may contain
@@ -21025,44 +21648,76 @@ nonxs_extensions=''
 
 : Function to recursively find available extensions, ignoring DynaLoader
 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
 
 : Function to recursively find available extensions, ignoring DynaLoader
 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
+: In 5.10.1 and later, extensions are stored in directories
+: like File-Glob instead of the older File/Glob/.  In this scheme,
+: IO-Compress does not appear to be an XS extension, but we want
+: to install it as one.  A.D.  8/2009.
 find_extensions='
     for xxx in *; do
        case "$xxx" in
            DynaLoader|dynaload) ;;
            *)
 find_extensions='
     for xxx in *; do
        case "$xxx" in
            DynaLoader|dynaload) ;;
            *)
-           if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
-               known_extensions="$known_extensions $1$xxx";
-           elif $test -f $xxx/Makefile.PL; then
-               nonxs_extensions="$nonxs_extensions $1$xxx";
+           this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
+           leaf=`echo $xxx | $sed -e s/.*-//`;
+           if $test -d File; then
+               if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
+                   known_extensions="$known_extensions $1$this_ext";
+               elif $test -f $xxx/Makefile.PL; then
+                   nonxs_extensions="$nonxs_extensions $1$this_ext";
+               else
+                   if $test -d $xxx -a $# -lt 10; then
+                       set $1$xxx/ $*;
+                       cd "$xxx";
+                       eval $find_extensions;
+                       cd ..;
+                       shift;
+                   fi;
+               fi;
            else
            else
-               if $test -d $xxx -a $# -lt 10; then
-                   set $1$xxx/ $*;
-                   cd "$xxx";
-                   eval $find_extensions;
-                   cd ..;
-                   shift;
+               $ls -1 $xxx > $$.tmp;
+               if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
+                   known_extensions="$known_extensions $this_ext";
+               elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
+                   known_extensions="$known_extensions $this_ext";
+               elif $test "$this_ext" = "IO/Compress"; then
+                   known_extensions="$known_extensions $this_ext";
+               elif $test -d $xxx; then
+                   nonxs_extensions="$nonxs_extensions $this_ext";
                fi;
                fi;
+               $rm -f $$.tmp;
            fi
            ;;
        esac;
     done'
 tdir=`pwd`
            fi
            ;;
        esac;
     done'
 tdir=`pwd`
+cd "$rsrc/cpan"
+set X
+shift
+eval $find_extensions
+cd "$rsrc/dist"
+set X
+shift
+eval $find_extensions
 cd "$rsrc/ext"
 set X
 shift
 eval $find_extensions
 cd "$rsrc/ext"
 set X
 shift
 eval $find_extensions
-# Special case:  Add in threads/shared since it is not picked up by the
-# recursive find above (and adding in general recursive finding breaks
-# SDBM_File/sdbm).  A.D.  10/25/2001.
-known_extensions="$known_extensions threads/shared"
+if $test -d File-Glob; then
+    : All ext/ flattened
+else
+    # Special case:  Add in modules that nest beyond the first level.
+    # Currently threads/shared and Hash/Util/FieldHash, since they are
+    # not picked up by the recursive find above (and adding in general
+    # recursive finding breaks SDBM_File/sdbm).
+    # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
+    known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
+fi
 set X $known_extensions
 shift
 set X $known_extensions
 shift
-known_extensions="$*"
-#  Ditto for IO/Compress/Base and IO/Compress/Zlib
-nonxs_extensions="$nonxs_extensions IO/Compress/Base IO/Compress/Zlib"
+known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
 set X $nonxs_extensions
 shift
 set X $nonxs_extensions
 shift
-nonxs_extensions="$*"
+nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
 cd "$tdir"
 
 : Now see which are supported on this system.
 cd "$tdir"
 
 : Now see which are supported on this system.
@@ -21084,8 +21739,14 @@ for xxx in $known_extensions ; do
                $define$define) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
                $define$define) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
+       IPC/SysV|ipc/sysv)
+               : XXX Do we need a useipcsysv variable here
+               case "${d_msg}${d_sem}${d_shm}" in
+               *"${define}"*) avail_ext="$avail_ext $xxx" ;;
+               esac
+               ;;
        NDBM_File|ndbm_fil)
        NDBM_File|ndbm_fil)
-               case "$i_ndbm" in
+               case "$d_ndbm" in
                $define)
                    case "$osname-$use64bitint" in
                    hpux-define)
                $define)
                    case "$osname-$use64bitint" in
                    hpux-define)
@@ -21101,24 +21762,28 @@ for xxx in $known_extensions ; do
        ODBM_File|odbm_fil)
                case "${i_dbm}${i_rpcsvcdbm}" in
                *"${define}"*)
        ODBM_File|odbm_fil)
                case "${i_dbm}${i_rpcsvcdbm}" in
                *"${define}"*)
-                   case "$osname-$use64bitint" in
-                   hpux-define)
-                       case "$libs" in
-                       *-ldbm*) avail_ext="$avail_ext $xxx" ;;
+                   case "$d_cplusplus" in
+                   define) ;; # delete as a function name will not work
+                   *)  case "$osname-$use64bitint" in
+                       hpux-define)
+                           case "$libs" in
+                           *-ldbm*) avail_ext="$avail_ext $xxx" ;;
+                           esac
+                           ;;
+                       *) avail_ext="$avail_ext $xxx" ;;
                        esac
                        ;;
                        esac
                        ;;
-                   *) avail_ext="$avail_ext $xxx" ;;
                    esac
                    ;;
                esac
                ;;
                    esac
                    ;;
                esac
                ;;
-       POSIX|posix)
-               case "$useposix" in
+       Opcode|opcode)
+               case "$useopcode" in
                true|define|y) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
                true|define|y) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
-       Opcode|opcode)
-               case "$useopcode" in
+       POSIX|posix)
+               case "$useposix" in
                true|define|y) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
                true|define|y) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
@@ -21141,11 +21806,27 @@ for xxx in $known_extensions ; do
        Thread|thread)
                 case "$usethreads" in
                 true|$define|y)
        Thread|thread)
                 case "$usethreads" in
                 true|$define|y)
-                        case "$useithreads" in
-                        $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
+                        case "$use5005threads" in
+                        $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
                         esac
                esac
                ;;
                         esac
                esac
                ;;
+       threads|threads/shared)
+               # threads and threads::shared are special cases.
+               # To stop people from asking "Perl 5.8.0 was supposed
+               # to have this new fancy threads implementation but my
+               # perl doesn't have it" and from people trying to
+               # (re)install the threads module using CPAN.pm and
+               # CPAN.pm then offering to reinstall Perl 5.8.0,
+               # the threads.pm and threads/shared.pm will always be
+               # there, croaking informatively ("you need to rebuild
+               # all of Perl with threads, sorry") when threads haven't
+               # been compiled in.
+               # --jhi
+               avail_ext="$avail_ext $xxx"
+               ;;
+       VMS*)
+               ;;
        Win32*)
                case "$osname" in
                cygwin) avail_ext="$avail_ext $xxx" ;;
        Win32*)
                case "$osname" in
                cygwin) avail_ext="$avail_ext $xxx" ;;
@@ -21158,30 +21839,17 @@ for xxx in $known_extensions ; do
                $define) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
                $define) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
-       XS/Typemap|xs/typemap)
+       XS/APItest/KeywordRPN|xs/apitest/keywordrpn)
                # This is just for testing.  Skip it unless we have dynamic loading.
                # This is just for testing.  Skip it unless we have dynamic loading.
+
                case "$usedl" in
                $define) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
                case "$usedl" in
                $define) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
-       threads|threads/shared)
-               # threads and threads::shared are special cases.
-               # To stop people from asking "Perl 5.8.0 was supposed
-               # to have this new fancy threads implementation but my
-               # perl doesn't have it" and from people trying to
-               # (re)install the threads module using CPAN.pm and
-               # CPAN.pm then offering to reinstall Perl 5.8.0,
-               # the threads.pm and threads/shared.pm will always be
-               # there, croaking informatively ("you need to rebuild
-               # all of Perl with threads, sorry") when threads haven't
-               # been compiled in.
-               # --jhi
-               avail_ext="$avail_ext $xxx"
-               ;;
-       IPC/SysV|ipc/sysv)
-               : XXX Do we need a useipcsysv variable here
-               case "${d_msg}${d_sem}${d_shm}" in
-               *"${define}"*) avail_ext="$avail_ext $xxx" ;;
+       XS/Typemap|xs/typemap)
+               # This is just for testing.  Skip it unless we have dynamic loading.
+               case "$usedl" in
+               $define) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
        *)      avail_ext="$avail_ext $xxx"
                esac
                ;;
        *)      avail_ext="$avail_ext $xxx"
@@ -21404,7 +22072,7 @@ sunos*X4*)
     ;;
 *) case "$usedl" in
     $define|true|[yY]*)
     ;;
 *) case "$usedl" in
     $define|true|[yY]*)
-           set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
+           set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
            shift
            perllibs="$*"
            ;;
            shift
            perllibs="$*"
            ;;
@@ -21437,9 +22105,9 @@ if test -d ../UU; then
        cd ..
 fi
 
        cd ..
 fi
 
-: configuration may be patched via a 'config.arch' file
+: configuration may be unconditionally patched via a 'config.arch' file
 if $test -f config.arch; then
 if $test -f config.arch; then
-       echo "I see a config.arch file, loading it."
+       echo "I see a config.arch file, loading it." >&4
        . ./config.arch
 fi
 
        . ./config.arch
 fi
 
@@ -21487,13 +22155,18 @@ $startsh
 # Configured by     : $cf_by
 # Target system     : $myuname
 
 # Configured by     : $cf_by
 # Target system     : $myuname
 
+EOT
+: Add in command line options if available
+$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
+
+$spitshell <<EOT >>config.sh
+
 Author='$Author'
 Date='$Date'
 Header='$Header'
 Id='$Id'
 Locker='$Locker'
 Log='$Log'
 Author='$Author'
 Date='$Date'
 Header='$Header'
 Id='$Id'
 Locker='$Locker'
 Log='$Log'
-Mcc='$Mcc'
 RCSfile='$RCSfile'
 Revision='$Revision'
 Source='$Source'
 RCSfile='$RCSfile'
 Revision='$Revision'
 Source='$Source'
@@ -21521,6 +22194,7 @@ awk='$awk'
 baserev='$baserev'
 bash='$bash'
 bin='$bin'
 baserev='$baserev'
 bash='$bash'
 bin='$bin'
+bin_ELF='$bin_ELF'
 binexp='$binexp'
 bison='$bison'
 byacc='$byacc'
 binexp='$binexp'
 bison='$bison'
 byacc='$byacc'
@@ -21539,7 +22213,6 @@ ccversion='$ccversion'
 cf_by='$cf_by'
 cf_email='$cf_email'
 cf_time='$cf_time'
 cf_by='$cf_by'
 cf_email='$cf_email'
 cf_time='$cf_time'
-charsize='$charsize'
 chgrp='$chgrp'
 chmod='$chmod'
 chown='$chown'
 chgrp='$chgrp'
 chmod='$chmod'
 chown='$chown'
@@ -21583,9 +22256,11 @@ d_accessx='$d_accessx'
 d_aintl='$d_aintl'
 d_alarm='$d_alarm'
 d_archlib='$d_archlib'
 d_aintl='$d_aintl'
 d_alarm='$d_alarm'
 d_archlib='$d_archlib'
+d_asctime64='$d_asctime64'
 d_asctime_r='$d_asctime_r'
 d_atolf='$d_atolf'
 d_atoll='$d_atoll'
 d_asctime_r='$d_asctime_r'
 d_atolf='$d_atolf'
 d_atoll='$d_atoll'
+d_attribute_deprecated='$d_attribute_deprecated'
 d_attribute_format='$d_attribute_format'
 d_attribute_malloc='$d_attribute_malloc'
 d_attribute_nonnull='$d_attribute_nonnull'
 d_attribute_format='$d_attribute_format'
 d_attribute_malloc='$d_attribute_malloc'
 d_attribute_nonnull='$d_attribute_nonnull'
@@ -21620,10 +22295,12 @@ d_crypt_r='$d_crypt_r'
 d_csh='$d_csh'
 d_ctermid='$d_ctermid'
 d_ctermid_r='$d_ctermid_r'
 d_csh='$d_csh'
 d_ctermid='$d_ctermid'
 d_ctermid_r='$d_ctermid_r'
+d_ctime64='$d_ctime64'
 d_ctime_r='$d_ctime_r'
 d_cuserid='$d_cuserid'
 d_dbl_dig='$d_dbl_dig'
 d_dbminitproto='$d_dbminitproto'
 d_ctime_r='$d_ctime_r'
 d_cuserid='$d_cuserid'
 d_dbl_dig='$d_dbl_dig'
 d_dbminitproto='$d_dbminitproto'
+d_difftime64='$d_difftime64'
 d_difftime='$d_difftime'
 d_dir_dd_fd='$d_dir_dd_fd'
 d_dirfd='$d_dirfd'
 d_difftime='$d_difftime'
 d_dir_dd_fd='$d_dir_dd_fd'
 d_dirfd='$d_dirfd'
@@ -21682,6 +22359,9 @@ d_fsync='$d_fsync'
 d_ftello='$d_ftello'
 d_ftime='$d_ftime'
 d_futimes='$d_futimes'
 d_ftello='$d_ftello'
 d_ftime='$d_ftime'
 d_futimes='$d_futimes'
+d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
+d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
+d_getaddrinfo='$d_getaddrinfo'
 d_getcwd='$d_getcwd'
 d_getespwnam='$d_getespwnam'
 d_getfsstat='$d_getfsstat'
 d_getcwd='$d_getcwd'
 d_getespwnam='$d_getespwnam'
 d_getfsstat='$d_getfsstat'
@@ -21703,6 +22383,7 @@ d_getlogin='$d_getlogin'
 d_getlogin_r='$d_getlogin_r'
 d_getmnt='$d_getmnt'
 d_getmntent='$d_getmntent'
 d_getlogin_r='$d_getlogin_r'
 d_getmnt='$d_getmnt'
 d_getmntent='$d_getmntent'
+d_getnameinfo='$d_getnameinfo'
 d_getnbyaddr='$d_getnbyaddr'
 d_getnbyname='$d_getnbyname'
 d_getnent='$d_getnent'
 d_getnbyaddr='$d_getnbyaddr'
 d_getnbyname='$d_getnbyname'
 d_getnent='$d_getnent'
@@ -21738,6 +22419,7 @@ d_getservprotos='$d_getservprotos'
 d_getspnam='$d_getspnam'
 d_getspnam_r='$d_getspnam_r'
 d_gettimeod='$d_gettimeod'
 d_getspnam='$d_getspnam'
 d_getspnam_r='$d_getspnam_r'
 d_gettimeod='$d_gettimeod'
+d_gmtime64='$d_gmtime64'
 d_gmtime_r='$d_gmtime_r'
 d_gnulibc='$d_gnulibc'
 d_grpasswd='$d_grpasswd'
 d_gmtime_r='$d_gmtime_r'
 d_gnulibc='$d_gnulibc'
 d_grpasswd='$d_grpasswd'
@@ -21747,6 +22429,8 @@ d_ilogbl='$d_ilogbl'
 d_inc_version_list='$d_inc_version_list'
 d_index='$d_index'
 d_inetaton='$d_inetaton'
 d_inc_version_list='$d_inc_version_list'
 d_index='$d_index'
 d_inetaton='$d_inetaton'
+d_inetntop='$d_inetntop'
+d_inetpton='$d_inetpton'
 d_int64_t='$d_int64_t'
 d_isascii='$d_isascii'
 d_isfinite='$d_isfinite'
 d_int64_t='$d_int64_t'
 d_isascii='$d_isascii'
 d_isfinite='$d_isfinite'
@@ -21758,6 +22442,7 @@ d_lchown='$d_lchown'
 d_ldbl_dig='$d_ldbl_dig'
 d_libm_lib_version='$d_libm_lib_version'
 d_link='$d_link'
 d_ldbl_dig='$d_ldbl_dig'
 d_libm_lib_version='$d_libm_lib_version'
 d_link='$d_link'
+d_localtime64='$d_localtime64'
 d_localtime_r='$d_localtime_r'
 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
 d_locconv='$d_locconv'
 d_localtime_r='$d_localtime_r'
 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
 d_locconv='$d_locconv'
@@ -21782,6 +22467,7 @@ d_mkdtemp='$d_mkdtemp'
 d_mkfifo='$d_mkfifo'
 d_mkstemp='$d_mkstemp'
 d_mkstemps='$d_mkstemps'
 d_mkfifo='$d_mkfifo'
 d_mkstemp='$d_mkstemp'
 d_mkstemps='$d_mkstemps'
+d_mktime64='$d_mktime64'
 d_mktime='$d_mktime'
 d_mmap='$d_mmap'
 d_modfl='$d_modfl'
 d_mktime='$d_mktime'
 d_mmap='$d_mmap'
 d_modfl='$d_modfl'
@@ -21802,6 +22488,8 @@ d_msgsnd='$d_msgsnd'
 d_msync='$d_msync'
 d_munmap='$d_munmap'
 d_mymalloc='$d_mymalloc'
 d_msync='$d_msync'
 d_munmap='$d_munmap'
 d_mymalloc='$d_mymalloc'
+d_ndbm='$d_ndbm'
+d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
 d_nice='$d_nice'
 d_nl_langinfo='$d_nl_langinfo'
 d_nv_preserves_uv='$d_nv_preserves_uv'
 d_nice='$d_nice'
 d_nl_langinfo='$d_nl_langinfo'
 d_nv_preserves_uv='$d_nv_preserves_uv'
@@ -21959,6 +22647,7 @@ d_tcsetpgrp='$d_tcsetpgrp'
 d_telldir='$d_telldir'
 d_telldirproto='$d_telldirproto'
 d_time='$d_time'
 d_telldir='$d_telldir'
 d_telldirproto='$d_telldirproto'
 d_time='$d_time'
+d_timegm='$d_timegm'
 d_times='$d_times'
 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
 d_tm_tm_zone='$d_tm_tm_zone'
 d_times='$d_times'
 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
 d_tm_tm_zone='$d_tm_tm_zone'
@@ -22006,6 +22695,7 @@ dlsrc='$dlsrc'
 doublesize='$doublesize'
 drand01='$drand01'
 drand48_r_proto='$drand48_r_proto'
 doublesize='$doublesize'
 drand01='$drand01'
 drand48_r_proto='$drand48_r_proto'
+dtrace='$dtrace'
 dynamic_ext='$dynamic_ext'
 eagain='$eagain'
 ebcdic='$ebcdic'
 dynamic_ext='$dynamic_ext'
 eagain='$eagain'
 ebcdic='$ebcdic'
@@ -22022,6 +22712,7 @@ eunicefix='$eunicefix'
 exe_ext='$exe_ext'
 expr='$expr'
 extensions='$extensions'
 exe_ext='$exe_ext'
 expr='$expr'
 extensions='$extensions'
+extern_C='$extern_C'
 extras='$extras'
 fflushNULL='$fflushNULL'
 fflushall='$fflushall'
 extras='$extras'
 fflushNULL='$fflushNULL'
 fflushall='$fflushall'
@@ -22087,6 +22778,7 @@ i64type='$i64type'
 i8size='$i8size'
 i8type='$i8type'
 i_arpainet='$i_arpainet'
 i8size='$i8size'
 i8type='$i8type'
 i_arpainet='$i_arpainet'
+i_assert='$i_assert'
 i_bsdioctl='$i_bsdioctl'
 i_crypt='$i_crypt'
 i_db='$i_db'
 i_bsdioctl='$i_bsdioctl'
 i_crypt='$i_crypt'
 i_db='$i_db'
@@ -22099,6 +22791,8 @@ i_float='$i_float'
 i_fp='$i_fp'
 i_fp_class='$i_fp_class'
 i_gdbm='$i_gdbm'
 i_fp='$i_fp'
 i_fp_class='$i_fp_class'
 i_gdbm='$i_gdbm'
+i_gdbm_ndbm='$i_gdbm_ndbm'
+i_gdbmndbm='$i_gdbmndbm'
 i_grp='$i_grp'
 i_ieeefp='$i_ieeefp'
 i_inttypes='$i_inttypes'
 i_grp='$i_grp'
 i_ieeefp='$i_ieeefp'
 i_inttypes='$i_inttypes'
@@ -22108,6 +22802,7 @@ i_limits='$i_limits'
 i_locale='$i_locale'
 i_machcthr='$i_machcthr'
 i_malloc='$i_malloc'
 i_locale='$i_locale'
 i_machcthr='$i_machcthr'
 i_malloc='$i_malloc'
+i_mallocmalloc='$i_mallocmalloc'
 i_math='$i_math'
 i_memory='$i_memory'
 i_mntent='$i_mntent'
 i_math='$i_math'
 i_memory='$i_memory'
 i_mntent='$i_mntent'
@@ -22142,6 +22837,7 @@ i_sysmode='$i_sysmode'
 i_sysmount='$i_sysmount'
 i_sysndir='$i_sysndir'
 i_sysparam='$i_sysparam'
 i_sysmount='$i_sysmount'
 i_sysndir='$i_sysndir'
 i_sysparam='$i_sysparam'
+i_syspoll='$i_syspoll'
 i_sysresrc='$i_sysresrc'
 i_syssecrt='$i_syssecrt'
 i_sysselct='$i_sysselct'
 i_sysresrc='$i_sysresrc'
 i_syssecrt='$i_syssecrt'
 i_sysselct='$i_sysselct'
@@ -22285,6 +22981,7 @@ nroff='$nroff'
 nvEUformat='$nvEUformat'
 nvFUformat='$nvFUformat'
 nvGUformat='$nvGUformat'
 nvEUformat='$nvEUformat'
 nvFUformat='$nvFUformat'
 nvGUformat='$nvGUformat'
+nv_overflows_integers_at='$nv_overflows_integers_at'
 nv_preserves_uv_bits='$nv_preserves_uv_bits'
 nveformat='$nveformat'
 nvfformat='$nvfformat'
 nv_preserves_uv_bits='$nv_preserves_uv_bits'
 nveformat='$nveformat'
 nvfformat='$nvfformat'
@@ -22335,9 +23032,14 @@ readdir64_r_proto='$readdir64_r_proto'
 readdir_r_proto='$readdir_r_proto'
 revision='$revision'
 rm='$rm'
 readdir_r_proto='$readdir_r_proto'
 revision='$revision'
 rm='$rm'
+rm_try='$rm_try'
 rmail='$rmail'
 run='$run'
 runnm='$runnm'
 rmail='$rmail'
 run='$run'
 runnm='$runnm'
+sGMTIME_max='$sGMTIME_max'
+sGMTIME_min='$sGMTIME_min'
+sLOCALTIME_max='$sLOCALTIME_max'
+sLOCALTIME_min='$sLOCALTIME_min'
 sPRIEUldbl='$sPRIEUldbl'
 sPRIFUldbl='$sPRIFUldbl'
 sPRIGUldbl='$sPRIGUldbl'
 sPRIEUldbl='$sPRIEUldbl'
 sPRIFUldbl='$sPRIFUldbl'
 sPRIGUldbl='$sPRIGUldbl'
@@ -22463,7 +23165,9 @@ use5005threads='$use5005threads'
 use64bitall='$use64bitall'
 use64bitint='$use64bitint'
 usecrosscompile='$usecrosscompile'
 use64bitall='$use64bitall'
 use64bitint='$use64bitint'
 usecrosscompile='$usecrosscompile'
+usedevel='$usedevel'
 usedl='$usedl'
 usedl='$usedl'
+usedtrace='$usedtrace'
 usefaststdio='$usefaststdio'
 useithreads='$useithreads'
 uselargefiles='$uselargefiles'
 usefaststdio='$usefaststdio'
 useithreads='$useithreads'
 uselargefiles='$uselargefiles'
@@ -22524,20 +23228,18 @@ zcat='$zcat'
 zip='$zip'
 EOT
 
 zip='$zip'
 EOT
 
-: Add in command line options if available
-$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
-
 : add special variables
 $test -f $src/patchlevel.h && \
 awk '/^#define[        ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
 : add special variables
 $test -f $src/patchlevel.h && \
 awk '/^#define[        ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
-echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
+echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
 echo "PERL_CONFIG_SH=true" >>config.sh
 
 : propagate old symbols
 if $test -f UU/config.sh; then
        <UU/config.sh $sort | $uniq >UU/oldconfig.sh
 echo "PERL_CONFIG_SH=true" >>config.sh
 
 : propagate old symbols
 if $test -f UU/config.sh; then
        <UU/config.sh $sort | $uniq >UU/oldconfig.sh
-       sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
-       $sort | $uniq -u >UU/oldsyms
+       $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
+               config.sh config.sh UU/oldconfig.sh |\
+               $sort | $uniq -u >UU/oldsyms
        set X `cat UU/oldsyms`
        shift
        case $# in
        set X `cat UU/oldsyms`
        shift
        case $# in
@@ -22546,7 +23248,7 @@ if $test -f UU/config.sh; then
                cat <<EOM
 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
 EOM
                cat <<EOM
 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
 EOM
-               echo "# Variables propagated from previous config.sh file." >>config.sh
+               echo ": Variables propagated from previous config.sh file." >>config.sh
                for sym in `cat UU/oldsyms`; do
                        echo "    Propagating $hint variable "'$'"$sym..."
                        eval 'tmp="$'"${sym}"'"'
                for sym in `cat UU/oldsyms`; do
                        echo "    Propagating $hint variable "'$'"$sym..."
                        eval 'tmp="$'"${sym}"'"'