This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Rely on C89 <time.h>
[perl5.git] / Configure
index bb3fdf4..e7bf160 100755 (executable)
--- a/Configure
+++ b/Configure
 #
 # Note: this Configure script was generated automatically by the tool
 # called "metaconfig". Rather than working with this copy of Configure,
-# you may wish to get metaconfig. Perl uses a modified version of this
-# tool, available in the "dist" folder in the checkout of the git repo
-#    $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
-# The original dist package (including metaconfig) is available via SVN:
-#    $ svn co https://svn.code.sf.net/p/dist/code/trunk/dist
+# you should use metaconfig. Perl uses a modified version of this
+# tool, and this, together with the metaconfig units, are available
+# in the git repository:
+#    $ git clone https://github.com/perl5-metaconfig/metaconfig metaconfig
+# The original dist package (including metaconfig) is available on github:
+#    $ git clone https://github.com/rmanfredi/dist.git dist-git
 #
 # 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.
-# For more information on patching Configure, see pod/perlhack.pod
-#
-# 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
-#
-# See Porting/pumpkin.pod for more information on metaconfig.
+# OK to send patches against Configure itself (but not to commit them
+# to blead). It's up to
+# the Configure maintainers to backport the patch to the metaunits if it
+# is accepted. Exceptions to this rule, and more information, is in
+# Porting/pumpkin.pod.
 
 # Generated using [metaconfig 3.5 PL0]
 # (with additional metaconfig patches by perlbug@perl.org)
@@ -339,7 +336,6 @@ rm_try=''
 afs=''
 afsroot=''
 alignbytes=''
-ansi2knr=''
 archlib=''
 archlibexp=''
 d_archlib=''
@@ -394,11 +390,11 @@ d_attribute_unused=''
 d_attribute_warn_unused_result=''
 d_printf_format_null=''
 d_backtrace=''
-d_bcmp=''
-d_bcopy=''
 d_builtin_choose_expr=''
 d_builtin_expect=''
-d_bzero=''
+d_builtin_add_overflow=''
+d_builtin_mul_overflow=''
+d_builtin_sub_overflow=''
 d_c99_variadic_macros=''
 d_casti32=''
 castflags=''
@@ -475,6 +471,7 @@ d_fcntl_can_lock=''
 d_fd_macros=''
 d_fd_set=''
 d_fds_bits=''
+d_fdclose=''
 d_fdim=''
 d_fegetround=''
 d_fgetpos=''
@@ -497,6 +494,11 @@ d_fpgetround=''
 d_fpos64_t=''
 d_frexpl=''
 d_fs_data_s=''
+d_fchmodat=''
+d_linkat=''
+d_openat=''
+d_renameat=''
+d_unlinkat=''
 d_fseeko=''
 d_fsetpos=''
 d_fstatfs=''
@@ -505,6 +507,7 @@ d_ftello=''
 d_ftime=''
 d_gettimeod=''
 d_futimes=''
+d_gai_strerror=''
 d_Gconvert=''
 d_getaddrinfo=''
 d_getcwd=''
@@ -624,6 +627,7 @@ d_llrint=''
 d_llrintl=''
 d_llround=''
 d_llroundl=''
+d_localeconv_l=''
 d_localtime_r=''
 d_localtime_r_needs_tzset=''
 localtime_r_proto=''
@@ -633,6 +637,11 @@ d_log1p=''
 d_log2=''
 d_logb=''
 d_ldexpl=''
+d_long_double_style_ieee=''
+d_long_double_style_ieee_doubledouble=''
+d_long_double_style_ieee_extended=''
+d_long_double_style_ieee_std=''
+d_long_double_style_vax=''
 d_longdbl=''
 longdblkind=''
 longdblsize=''
@@ -648,13 +657,12 @@ d_madvise=''
 d_malloc_good_size=''
 d_malloc_size=''
 d_mblen=''
+d_mbrlen=''
+d_mbrtowc=''
 d_mbstowcs=''
 d_mbtowc=''
-d_memchr=''
-d_memcmp=''
-d_memcpy=''
-d_memmove=''
-d_memset=''
+d_memmem=''
+d_memrchr=''
 d_mkdir=''
 d_mkdtemp=''
 d_mkfifo=''
@@ -664,7 +672,6 @@ d_mktime=''
 d_mmap=''
 mmaptype=''
 d_modfl=''
-d_modfl_pow32_bug=''
 d_modflproto=''
 d_mprotect=''
 d_msg=''
@@ -676,11 +683,19 @@ d_msgsnd=''
 d_msync=''
 d_munmap=''
 d_nan=''
+d_nanosleep=''
 d_nearbyint=''
+d_duplocale=''
+d_freelocale=''
+d_newlocale=''
+d_querylocale=''
+d_uselocale=''
+i_xlocale=''
 d_nextafter=''
 d_nexttoward=''
 d_nice=''
 d_nl_langinfo=''
+d_thread_safe_nl_langinfo_l=''
 d_off64_t=''
 d_open3=''
 d_fpathconf=''
@@ -724,9 +739,6 @@ d_rename=''
 d_rint=''
 d_rmdir=''
 d_round=''
-d_safebcpy=''
-d_safemcpy=''
-d_sanemcmp=''
 d_sbrkproto=''
 d_scalbn=''
 d_scalbnl=''
@@ -784,12 +796,18 @@ d_shmctl=''
 d_shmdt=''
 d_shmget=''
 d_sigaction=''
+d_siginfo_si_addr=''
+d_siginfo_si_band=''
+d_siginfo_si_errno=''
+d_siginfo_si_fd=''
+d_siginfo_si_pid=''
+d_siginfo_si_status=''
+d_siginfo_si_uid=''
+d_siginfo_si_value=''
 d_signbit=''
 d_sigprocmask=''
 d_sigsetjmp=''
 usesitecustomize=''
-d_snprintf=''
-d_vsnprintf=''
 d_sockatmark=''
 d_sockatmarkproto=''
 d_ip_mreq=''
@@ -812,7 +830,6 @@ sockethdr=''
 socketlib=''
 d_socklen_t=''
 d_socks5_init=''
-d_sprintf_returns_strlen=''
 d_sqrtl=''
 d_srand48_r=''
 srand48_r_proto=''
@@ -839,22 +856,22 @@ stdio_bufsiz=''
 stdio_cnt=''
 stdio_filbuf=''
 stdio_ptr=''
-d_index=''
-d_strchr=''
 d_strcoll=''
-d_strctcpy=''
 d_strerrm=''
 d_strerror=''
 d_sysernlst=''
 d_syserrlst=''
+d_strerror_l=''
 d_strerror_r=''
 strerror_r_proto=''
 d_strftime=''
 d_strlcat=''
 d_strlcpy=''
+d_strnlen=''
 d_strtod=''
 d_strtol=''
 d_strtold=''
+d_strtold_l=''
 d_strtoll=''
 d_strtoq=''
 d_strtoul=''
@@ -905,9 +922,6 @@ d_vfork=''
 usevfork=''
 d_voidsig=''
 signal_t=''
-d_volatile=''
-d_charvspr=''
-d_vprintf=''
 d_wait4=''
 d_waitpid=''
 d_wcscmp=''
@@ -915,6 +929,7 @@ d_wcstombs=''
 d_wcsxfrm=''
 d_wctomb=''
 d_writev=''
+default_inc_excludes_dot=''
 dlext=''
 bin_ELF=''
 cccdlflags=''
@@ -925,6 +940,8 @@ ld_can_script=''
 lddlflags=''
 usedl=''
 doublesize=''
+dtraceobject=''
+dtracexnolibs=''
 ebcdic=''
 fflushNULL=''
 fflushall=''
@@ -1011,7 +1028,6 @@ i_quadmath=''
 i_shadow=''
 i_socks=''
 i_stdbool=''
-i_stddef=''
 i_stdint=''
 i_stdlib=''
 i_string=''
@@ -1058,10 +1074,8 @@ i_unistd=''
 i_ustat=''
 i_utime=''
 i_values=''
-i_stdarg=''
-i_varargs=''
-i_varhdr=''
 i_vfork=''
+i_wchar=''
 d_inc_version_list=''
 inc_version_list=''
 inc_version_list_init=''
@@ -1102,6 +1116,14 @@ d_PRIeldbl=''
 d_PRIfldbl=''
 d_PRIgldbl=''
 d_SCNfldbl=''
+d_double_has_inf=''
+d_double_has_nan=''
+d_double_has_negative_zero=''
+d_double_has_subnormals=''
+d_double_style_cray=''
+d_double_style_ibm=''
+d_double_style_ieee=''
+d_double_style_vax=''
 doublekind=''
 sPRIEUldbl=''
 sPRIFUldbl=''
@@ -1213,7 +1235,6 @@ prefixexp=''
 installprivlib=''
 privlib=''
 privlibexp=''
-prototype=''
 ptrsize=''
 d_PRIXU64=''
 d_PRId64=''
@@ -1335,7 +1356,6 @@ usethreads=''
 incpath=''
 mips_type=''
 usrinc=''
-vaproto=''
 d_vendorarch=''
 installvendorarch=''
 vendorarch=''
@@ -1408,10 +1428,6 @@ 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=''
 : Possible local include directories to search.
 : Set locincpth to "" in a hint file to defeat local include searches.
 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
@@ -1424,6 +1440,9 @@ inclwanted=''
 EBUGGING=''
 DEBUGGING=''
 
+: Trailing extension.  Override this in a hint file, if needed.
+: Extra object files, if any, needed on this platform.
+archobjs=''
 libnames=''
 : change the next line if compiling for Xenix/286 on Xenix/386
 xlibpth='/usr/lib/386 /lib/386'
@@ -1447,8 +1466,6 @@ plibpth=''
 libswanted=''
 : some systems want to use only the non-versioned libso:s
 ignore_versioned_solibs=''
-: set usethreads on the Configure command line to enable threads.
-usereentrant='undef'
 ccname=''
 ccversion=''
 perllibs=''
@@ -1462,9 +1479,12 @@ ldflags_uselargefiles=''
 libswanted_uselargefiles=''
 : set usemultiplicity on the Configure command line to enable multiplicity.
 : set usesocks on the Configure command line to enable socks.
+archname=''
+: set usethreads on the Configure command line to enable threads.
+usereentrant='undef'
 : List of libraries we want.
 : If anyone needs extra -lxxx, put those in a hint file.
-libswanted="cl pthread socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld"
+libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
 : We probably want to search /usr/shlib before most other libraries.
 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
@@ -1679,7 +1699,6 @@ alldone=''
 error=''
 silent=''
 extractsh=''
-override=''
 knowitall=''
 rm -f optdef.sh posthint.sh
 cat >optdef.sh <<EOS
@@ -1709,7 +1728,7 @@ while test $# -gt 0; do
        -s) shift; silent=true; realsilent=true;;
        -E) shift; alldone=exit;;
        -K) shift; knowitall=true;;
-       -O) shift; override=true;;
+       -O) shift;;
        -S) shift; silent=true; extractsh=true;;
        -D)
                shift
@@ -1818,7 +1837,7 @@ Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
          -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.
+  -O : ignored for backward compatibility
   -S : perform variable substitutions on all .SH files (can mix with -f)
   -U : undefine symbol:
          -U symbol    symbol gets the value 'undef'
@@ -1865,7 +1884,7 @@ esac
 
 : run the defines and the undefines, if any, but leave the file out there...
 touch optdef.sh
-grep -q '\\' optdef.sh
+grep '\\' optdef.sh >/dev/null 2>&1
 if test $? = 0; then
     echo "Configure does not support \\ in -D arguments"
     exit 1
@@ -2040,7 +2059,7 @@ true)
        echo "Fetching answers from $config_sh..."
        cd ..
        . $config_sh
-       test "$override" && . ./optdef.sh
+       . UU/optdef.sh
        echo " "
        . UU/extract
        rm -rf UU
@@ -2120,22 +2139,21 @@ fi
 rm -f missing x??
 
 : Find the appropriate value for a newline for tr
-echo " "
 if test -n "$DJGPP"; then
        trnl='\012'
 fi
 if test X"$trnl" = X; then
-       case "`echo foo|tr '\n' x 2>/dev/null`" in
+       case "`echo foo | tr '\n' x 2>/dev/null`" in
        foox) trnl='\n' ;;
        esac
 fi
 if test X"$trnl" = X; then
-       case "`echo foo|tr '\012' x 2>/dev/null`" in
+       case "`echo foo | tr '\012' x 2>/dev/null`" in
        foox) trnl='\012' ;;
        esac
 fi
 if test X"$trnl" = X; then
-       case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
+       case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
        fooxy) trnl='\n\r' ;;
        esac
 fi
@@ -2865,7 +2883,6 @@ case "$lns" in
 *)     echo "No symbolic links, so not testing for their testing..." >&4
        ;;
 esac
-echo " "
 
 : Make symlinks util
 case "$mksymlinks" in
@@ -2960,7 +2977,7 @@ $define|true|[yY]*)
        *)  echo "Using targetarch $targetarch." >&4 ;;
        esac
        case "$targethost" in
-       '') echo "Targethost not defined." >&4; croak=y ;;
+       '') echo "Targethost not defined." >&4; croak=n ;;
        *)  echo "Using targethost $targethost." >&4
        esac
        locincpth=' '
@@ -3362,6 +3379,7 @@ EOM
        $test -f /etc/saf/_sactab && osname=svr4
        $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
        $test -f /system/gnu_library/bin/ar.pm && osname=vos
+       $test -f /sys/utilities/MultiView && osname=amigaos
        if $test -d /MachTen -o -d /MachTen_Folder; then
                osname=machten
                if $test -x /sbin/version; then
@@ -3792,7 +3810,7 @@ cd UU
        hint=previous
        ;;
 esac
-test "$override" && . ./optdef.sh
+. ./optdef.sh
 
 : Restore computed paths
 for file in $loclist $trylist; do
@@ -4339,15 +4357,15 @@ case "$osname" in
 dos|vms)
        : XXX Should be a Configure test for double-dots in filenames.
        version=`echo $revision $patchlevel $subversion | \
-                $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
+                $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
        api_versionstring=`echo $api_revision $api_version $api_subversion | \
-                $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
+                $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
        ;;
 *)
        version=`echo $revision $patchlevel $subversion | \
-                $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
+                $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
        api_versionstring=`echo $api_revision $api_version $api_subversion | \
-                $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
+                $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
        ;;
 esac
 : Special case the 5.005_xx maintenance series, which used 5.005
@@ -5225,6 +5243,20 @@ case "$usequadmath" in
 *)                    usequadmath="$undef"  ;;
 esac
 
+: Fail if both uselongdouble and usequadmath are requested
+case "$usequadmath:$uselongdouble" in
+define:define)
+       $cat <<EOM >&4
+
+*** You requested the use of the quadmath library and use
+*** of long doubles.
+***
+*** Please select one or the other.
+EOM
+       exit 1
+       ;;
+esac
+
 : Looking for optional libraries
 echo " "
 echo "Checking for optional libraries..." >&4
@@ -5460,15 +5492,19 @@ default|recommended)
        # 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-strong -fstack-protector-strong
-               eval $checkccflag
-               case "$dflt" in
-               *-fstack-protector-strong*) ;; # It got added.
-               *) # Try the plain/older -fstack-protector.
-                  set stack-protector -fstack-protector
-                  eval $checkccflag
-                  ;;
+       case "$osname" in
+       amigaos) ;; # -fstack-protector builds but doesn't work
+       *)      case "$gccversion" in
+               ?*)     set stack-protector-strong -fstack-protector-strong
+                       eval $checkccflag
+                       case "$dflt" in
+                       *-fstack-protector-strong*) ;; # It got added.
+                       *) # Try the plain/older -fstack-protector.
+                          set stack-protector -fstack-protector
+                          eval $checkccflag
+                          ;;
+                       esac
+                       ;;
                esac
                ;;
        esac
@@ -5545,7 +5581,12 @@ esac
 : the following weeds options from ccflags that are of no interest to cpp
 case "$cppflags" in
 '') cppflags="$ccflags" ;;
-*)  cppflags="$cppflags $ccflags" ;;
+*)  set X $ccflags; shift
+    case " $cppflags " in
+    *" $1 "*) ;;  # Try to avoid doubling the cppflags.
+    *) cppflags="$cppflags $ccflags" ;;
+    esac
+    ;;
 esac
 case "$gccversion" in
 1*) cppflags="$cppflags -D__GNUC__"
@@ -5745,10 +5786,116 @@ mc_file=$1;
 shift;
 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
 
+: stub, used only to satisfy other units
+i_stdlib='define'
+
+: check for lengths of integral types
+echo " "
+case "$intsize" in
+'')
+       echo "Checking to see how big your integers are..." >&4
+       $cat >try.c <<EOCP
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+int main()
+{
+       printf("intsize=%d;\n", (int)sizeof(int));
+       printf("longsize=%d;\n", (int)sizeof(long));
+       printf("shortsize=%d;\n", (int)sizeof(short));
+       exit(0);
+}
+EOCP
+       set try
+       if eval $compile_ok && $run ./try > /dev/null; then
+               eval `$run ./try`
+               echo "Your integers are $intsize bytes long."
+               echo "Your long integers are $longsize bytes long."
+               echo "Your short integers are $shortsize bytes long."
+       else
+               $cat >&4 <<EOM
+!
+Help! I can't compile and run the intsize test program: please enlighten me!
+(This is probably a misconfiguration in your system or libraries, and
+you really ought to fix it.  Still, I'll try anyway.)
+!
+EOM
+               dflt=4
+               rp="What is the size of an integer (in bytes)?"
+               . ./myread
+               intsize="$ans"
+               dflt=$intsize
+               rp="What is the size of a long integer (in bytes)?"
+               . ./myread
+               longsize="$ans"
+               dflt=2
+               rp="What is the size of a short integer (in bytes)?"
+               . ./myread
+               shortsize="$ans"
+       fi
+       ;;
+esac
+$rm_try
+
+: check for long long
+echo " "
+echo "Checking to see if you have long long..." >&4
+echo 'int main() { long long x = 7; return 0; }' > try.c
+set try
+if eval $compile; then
+       val="$define"
+       echo "You have long long."
+else
+       val="$undef"
+       echo "You do not have long long."
+fi
+$rm_try
+set d_longlong
+eval $setvar
+
+: check for length of long long
+case "${d_longlong}${longlongsize}" in
+$define)
+       echo " "
+       echo "Checking to see how big your long longs are..." >&4
+       $cat >try.c <<'EOCP'
+#include <stdio.h>
+int main()
+{
+    printf("%d\n", (int)sizeof(long long));
+    return(0);
+}
+EOCP
+       set try
+       if eval $compile_ok; then
+               longlongsize=`$run ./try`
+               echo "Your long longs are $longlongsize bytes long."
+       else
+               dflt='8'
+               echo " "
+               echo "(I can't seem to compile the test program.  Guessing...)"
+               rp="What is the size of a long long (in bytes)?"
+               . ./myread
+               longlongsize="$ans"
+       fi
+       if $test "X$longsize" = "X$longlongsize"; then
+               echo "(That isn't any different from an ordinary long.)"
+       fi
+       ;;
+esac
+$rm_try
+
 : determine filename position in cpp output
 echo " "
 echo "Computing filename position in cpp output for #include directives..." >&4
 case "$osname" in
+amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
+esac
+case "$fieldn" in
+'')
+case "$osname" in
 vos) testaccess=-e ;;
 *)   testaccess=-r ;;
 esac
@@ -5773,6 +5920,8 @@ EOF
 chmod +x fieldn
 fieldn=`./fieldn`
 $rm -f foo.c fieldn
+;;
+esac
 case $fieldn in
 '') pos='???';;
 1) pos=first;;
@@ -5850,108 +5999,6 @@ do set $yyy; var=$2; eval "was=\$$2";
        set $yyy; shift; shift; yyy=$@;
 done'
 
-: see if stdlib is available
-set stdlib.h i_stdlib
-eval $inhdr
-
-: check for lengths of integral types
-echo " "
-case "$intsize" in
-'')
-       echo "Checking to see how big your integers are..." >&4
-       $cat >try.c <<EOCP
-#include <stdio.h>
-#$i_stdlib I_STDLIB
-#ifdef I_STDLIB
-#include <stdlib.h>
-#endif
-int main()
-{
-       printf("intsize=%d;\n", (int)sizeof(int));
-       printf("longsize=%d;\n", (int)sizeof(long));
-       printf("shortsize=%d;\n", (int)sizeof(short));
-       exit(0);
-}
-EOCP
-       set try
-       if eval $compile_ok && $run ./try > /dev/null; then
-               eval `$run ./try`
-               echo "Your integers are $intsize bytes long."
-               echo "Your long integers are $longsize bytes long."
-               echo "Your short integers are $shortsize bytes long."
-       else
-               $cat >&4 <<EOM
-!
-Help! I can't compile and run the intsize test program: please enlighten me!
-(This is probably a misconfiguration in your system or libraries, and
-you really ought to fix it.  Still, I'll try anyway.)
-!
-EOM
-               dflt=4
-               rp="What is the size of an integer (in bytes)?"
-               . ./myread
-               intsize="$ans"
-               dflt=$intsize
-               rp="What is the size of a long integer (in bytes)?"
-               . ./myread
-               longsize="$ans"
-               dflt=2
-               rp="What is the size of a short integer (in bytes)?"
-               . ./myread
-               shortsize="$ans"
-       fi
-       ;;
-esac
-$rm_try
-
-: check for long long
-echo " "
-echo "Checking to see if you have long long..." >&4
-echo 'int main() { long long x = 7; return 0; }' > try.c
-set try
-if eval $compile; then
-       val="$define"
-       echo "You have long long."
-else
-       val="$undef"
-       echo "You do not have long long."
-fi
-$rm_try
-set d_longlong
-eval $setvar
-
-: check for length of long long
-case "${d_longlong}${longlongsize}" in
-$define)
-       echo " "
-       echo "Checking to see how big your long longs are..." >&4
-       $cat >try.c <<'EOCP'
-#include <stdio.h>
-int main()
-{
-    printf("%d\n", (int)sizeof(long long));
-    return(0);
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               longlongsize=`$run ./try`
-               echo "Your long longs are $longlongsize bytes long."
-       else
-               dflt='8'
-               echo " "
-               echo "(I can't seem to compile the test program.  Guessing...)"
-               rp="What is the size of a long long (in bytes)?"
-               . ./myread
-               longlongsize="$ans"
-       fi
-       if $test "X$longsize" = "X$longlongsize"; then
-               echo "(That isn't any different from an ordinary long.)"
-       fi
-       ;;
-esac
-$rm_try
-
 : see if inttypes.h is available
 : we want a real compile instead of Inhdr because some systems
 : have an inttypes.h which includes non-existent headers
@@ -6768,13 +6815,13 @@ yes)
                if $contains $tlook $tf >/dev/null 2>&1; then
                        tval=true;
                elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
-                       echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
+                       echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) 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; };
                        $rm_try;
                fi;
        else
-               echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
+               echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
                $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
                $rm_try;
        fi;
@@ -6940,17 +6987,26 @@ int main() {
   }
 #endif
 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
- * while 64-bits platforms have it in 16 bytes. */
+ * while 64-bits platforms have it in 16 bytes.  The trailing bytes
+ * cannot be trusted. */
 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
-  if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
+  if (b[0] == 0xCD && b[9] == 0xBF) {
     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
      * Also known as "extended precision". */
     printf("3\n");
     exit(0);
   }
-  if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
-    /* is there ever big-endian 80-bit, really? */
+  if (b[0] == 0xBF && b[9] == 0xCD) {
+    /* Is there ever big-endian 80-bit, really?
+     *
+     * The Motorola 68881 had another "extended precision" format:
+     * sign:1 exp:15 zero:16 integer:1 mantissa:63
+     * for total of 96 bits of bytes.  The zero bits were unused.
+     * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
+     * If it ever becomes relevant, this format should be allocated
+     * a new doublekind code since it's quite different from the Intel x87.
+     */
     printf("4\n");
     exit(0);
   }
@@ -6959,17 +7015,45 @@ int main() {
   /* software "double double", the 106 is 53+53.
    * but irix thinks it is 107. */
   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
-    /* double double 128-bit little-endian,
+    /* double double 128-bit fully little-endian,
+     * little-endian doubles in little-endian order,
      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
     printf("5\n");
     exit(0);
   }
   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
-    /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
+    /* double double 128-bit fully big-endian,
+     * big-endian doubles in big-endian order,
+     * e.g. PPC/Power and MIPS:
      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
     printf("6\n");
     exit(0);
   }
+  if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
+    /* double double 128-bit mixed endian.
+     * little-endian doubles in big-endian order,
+     * e.g. ppc64el,
+     * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
+    printf("7\n");
+    exit(0);
+  }
+  if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
+    /* double double 128-bit mixed endian,
+     * big-endian doubles in little-endian order,
+     * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
+    printf("8\n");
+    exit(0);
+  }
+#endif
+/* We are largely making this up because it may well be
+ * that the VAX format H was never made available to C,
+ * only to Fortran. */
+#if LONGDBLSIZE == 16 && defined(__vax__)
+  if (b[0] == 0xFD && b[15] == 0x99) {
+    /* VAX format H, PDP-11 mixed endian. */
+    printf("9\n");
+    exit(0);
+  }
 #endif
   printf("-1\n"); /* unknown */
   exit(0);
@@ -6990,18 +7074,41 @@ case "$longdblkind" in
 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
-5) echo "You have 128-bit little-endian double-double long doubles." >& 4 ;;
-6) echo "You have 128-bit big-endian double-double long doubles." >& 4 ;;
+5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
+6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
+7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
+8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
+9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
 *) echo "Cannot figure out your long double." >&4 ;;
 esac
-$rm_try
-
-: determine the architecture name
-echo " "
-if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
-       tarch=`arch`"-$osname"
-elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
-       if uname -m > tmparch 2>&1 ; then
+d_long_double_style_ieee=$undef
+d_long_double_style_ieee_std=$undef
+d_long_double_style_ieee_extended=$undef
+d_long_double_style_ieee_doubledouble=$undef
+d_long_double_style_vax=$undef
+case "$longdblkind" in
+1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
+esac
+case "$longdblkind" in
+1|2) d_long_double_style_ieee_std=$define ;;
+esac
+case "$longdblkind" in
+3|4) d_long_double_style_ieee_extended=$define ;;
+esac
+case "$longdblkind" in
+5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
+esac
+case "$longdblkind" in
+9) d_long_double_style_vax=$define ;;
+esac
+$rm_try
+
+: determine the architecture name
+echo " "
+if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
+       tarch=`arch`"-$osname"
+elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
+       if uname -m > tmparch 2>&1 ; then
                tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
                        -e 's/$/'"-$osname/" tmparch`
        else
@@ -7126,7 +7233,7 @@ case "$usequadmath" in
 $define)
        echo "quadmath selected." >&4
        case "$archname" in
-       *-ld*) echo "...and architecture name already has -quadmath." >&4
+       *-quadmath*) echo "...and architecture name already has -quadmath." >&4
                ;;
        *)      archname="$archname-quadmath"
                echo "...setting architecture name to $archname." >&4
@@ -7988,52 +8095,6 @@ esac
 set d_perl_otherlibdirs
 eval $setvar
 
-: Cruising for prototypes
-echo " "
-echo "Checking out function prototypes..." >&4
-$cat >prototype.c <<EOCP
-#$i_stdlib I_STDLIB
-#ifdef I_STDLIB
-#include <stdlib.h>
-#endif
-int main(int argc, char *argv[]) {
-       exit(0);}
-EOCP
-if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
-       echo "Your C compiler appears to support function prototypes."
-       val="$define"
-else
-       echo "Your C compiler doesn't seem to understand function prototypes."
-       val="$undef"
-fi
-set prototype
-eval $setvar
-$rm -f prototype*
-
-: Check if ansi2knr is required
-case "$prototype" in
-"$define") ;;
-*)     ansi2knr='ansi2knr'
-       echo " "
-       cat <<EOM >&4
-
-$me:  FATAL ERROR:
-This version of $package can only be compiled by a compiler that
-understands function prototypes.  Unfortunately, your C compiler
-       $cc $ccflags
-doesn't seem to understand them.  Sorry about that.
-
-If GNU cc is available for your system, perhaps you could try that instead.
-
-Eventually, we hope to support building Perl with pre-ANSI compilers.
-If you would like to help in that effort, please contact <perlbug@perl.org>.
-
-Aborting Configure now.
-EOM
-       exit 2
-       ;;
-esac
-
 : DTrace support
 dflt_dtrace='/usr/sbin/dtrace'
 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
@@ -8267,6 +8328,7 @@ runnm=false
 : with g++ one needs -shared to get is-in-libc to work for dlopen
 case "$gccversion" in
 '')    ;;
+*Clang*)       ;;
 *)     case "$d_cplusplus" in
        "$define") ccflags="$ccflags -shared" ;;
        esac
@@ -9319,17 +9381,20 @@ rp='Perl administrator e-mail address'
 . ./myread
 perladmin="$ans"
 
-: determine whether to only install version-specific parts.
+: determine whether to use a version number suffix for installed binaries
 echo " "
 $cat <<EOM
-Do you want to install only the version-specific parts of the perl
-distribution?  Usually you do *not* want to do this.
+Do you want to use a version number suffix for installed binaries? This
+will install 'perl$version' instead of 'perl', and likewise for other
+binaries like 'perldoc' and 'cpan'. This allows many versions of perl
+to be installed side-by-side. Unless you are a developer, you probably
+do *not* want to do this.
 EOM
 case "$versiononly" in
 "$define"|[Yy]*|true) dflt='y' ;;
 *) dflt='n';
 esac
-rp="Do you want to install only the version-specific parts of perl?"
+rp="Do you want to use a version number suffix for installed binaries?"
 . ./myread
 case "$ans" in
 [yY]*) val="$define";;
@@ -10065,6 +10130,16 @@ int main() {
     printf("2\n");
     exit(0);
   }
+  if (b[0] == 0xCC && b[3] == 0xCC) {
+    /* VAX format F, 32-bit PDP-style mixed endian. */
+    printf("9\n");
+    exit(0);
+  }
+  if (b[0] == 0xC0 && b[3] == 0x9A) {
+    /* IBM single 32-bit */
+    printf("12\n");
+    exit(0);
+  }
 #endif
 #if DOUBLESIZE == 8
   if (b[0] == 0x9A && b[7] == 0xBF) {
@@ -10091,6 +10166,26 @@ int main() {
     printf("8\n");
     exit(0);
   }
+  if (b[0] == 0xCC && b[7] == 0xCC) {
+   /* VAX format D, 64-bit PDP-style mixed endian. */
+    printf("10\n");
+    exit(0);
+  }
+  if (b[0] == 0xD9 && b[7] == 0x99) {
+   /* VAX format G, 64-bit PDP-style mixed endian. */
+    printf("11\n");
+    exit(0);
+  }
+  if (b[0] == 0xC0 && b[7] == 0x9A) {
+    /* IBM double 64-bit */
+    printf("13\n");
+    exit(0);
+  }
+  if (b[0] == 0xBF && b[7] == 0xCD) {
+    /* CRAY single 64-bit */
+    printf("14\n");
+    exit(0);
+  }
 #endif
 #if DOUBLESIZE == 16
   if (b[0] == 0x9A && b[15] == 0xBF) {
@@ -10104,7 +10199,7 @@ int main() {
     exit(0);
   }
 #endif
-  /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
+  /* Then there are old mainframe/miniframe formats like IBM and CRAY.
    * Whether those environments can still build Perl is debatable. */
   printf("-1\n"); /* unknown */
   exit(0);
@@ -10125,7 +10220,37 @@ case "$doublekind" in
 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
-*) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
+9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
+10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
+11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
+12) echo "You have IBM short 32-bit doubles." >&4 ;;
+13) echo "You have IBM long 64-bit doubles." >&4 ;;
+14) echo "You have Cray single 64-bit doubles." >&4 ;;
+*) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
+esac
+d_double_style_ieee=$undef
+d_double_style_vax=$undef
+d_double_style_ibm=$undef
+d_double_style_cray=$undef
+case "$doublekind" in
+1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
+9|10|11) d_double_style_vax=$define ;;
+12|13) d_double_style_ibm=$define ;;
+14) d_double_style_cray=$define ;;
+esac
+case "$d_double_style_ieee" in
+$define)
+    d_double_has_inf=$define
+    d_double_has_nan=$define
+    d_double_has_negative_zero=$define
+    d_double_has_subnormals=$define
+    ;;
+*)
+    d_double_has_inf=$undef
+    d_double_has_nan=$undef
+    d_double_has_negative_zero=$undef
+    d_double_has_subnormals=$undef
+    ;;
 esac
 $rm_try
 
@@ -10618,7 +10743,6 @@ $startsh
 cc="$cc"
 optimize="$optimize"
 ccflags="$ccflags"
-prototype="$prototype"
 define="$define"
 rm_try="$rm_try"
 usethreads=$usethreads
@@ -10646,13 +10770,8 @@ while test $# -ge 2; do
     fi
     shift 2
 done
-test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
 cat >> try.c <<'EOCP'
-#ifdef CAN_PROTOTYPE
 #define        _(args) args
-#else
-#define        _(args) ()
-#endif
 EOCP
 echo "$foo" >> try.c
 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
@@ -10711,16 +10830,15 @@ set $varname;
 eval $setvar;
 $rm_try'
 
-: see if we should include time.h, sys/time.h, or both
+: see if we should include sys/time.h
 echo " "
+i_time='define'
 if test "X$timeincl" = X; then
-       echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
+       echo "Testing to see if we should include <sys/time.h>." >&4
        $echo $n "I'm now running the test program...$c"
        $cat >try.c <<EOCP
 #include <sys/types.h>
-#ifdef I_TIME
 #include <time.h>
-#endif
 #ifdef I_SYSTIME
 #ifdef SYSTIMEKERNEL
 #define KERNEL
@@ -10757,13 +10875,12 @@ EOCP
        sysselect=''
        for s_timeval in '-DS_TIMEVAL' ''; do
        for i_systimek in '' '-DSYSTIMEKERNEL'; do
-       for i_time in '' '-DI_TIME'; do
        for i_systime in '-DI_SYSTIME' ''; do
                case "$flags" in
                '') $echo $n ".$c"
-                       set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
+                       set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
                        if eval $compile; then
-                               set X $i_time $i_systime $i_systimek $sysselect $s_timeval
+                               set X $i_systime $i_systimek $sysselect $s_timeval
                                shift
                                flags="$*"
                                echo " "
@@ -10775,7 +10892,6 @@ EOCP
        done
        done
        done
-       done
        timeincl=''
        echo " "
        case "$flags" in
@@ -10785,12 +10901,6 @@ EOCP
        *) i_systimek="$undef";;
        esac
        case "$flags" in
-       *I_TIME*) i_time="$define"
-               timeincl=`./findhdr time.h`" $timeincl"
-               echo "We'll include <time.h>." >&4;;
-       *) i_time="$undef";;
-       esac
-       case "$flags" in
        *I_SYSTIME*) i_systime="$define"
                timeincl=`./findhdr sys/time.h`" $timeincl"
                echo "We'll include <sys/time.h>." >&4;;
@@ -11170,14 +11280,6 @@ set d_attribute_warn_unused_result
 eval $setvar
 $rm -f attrib*
 
-: see if bcmp exists
-set bcmp d_bcmp
-eval $inlibc
-
-: see if bcopy exists
-set bcopy d_bcopy
-eval $inlibc
-
 : see if getpgrp exists
 set getpgrp d_getpgrp
 eval $inlibc
@@ -11310,6 +11412,117 @@ set d_bsdsetpgrp
 eval $setvar
 $rm_try
 
+: Look for GCC-style __builtin_add_overflow
+case "$d_builtin_add_overflow" in
+'')
+    echo " "
+    echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
+    $cat >try.c <<'EOCP'
+int main(void) {
+    const unsigned int uint_max = ~0u;
+    int target_int = 0;
+    if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
+        return 1;
+    }
+    if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
+        return 1;
+    }
+    if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
+        return 1;
+    }
+    return 0;
+}
+EOCP
+    set try
+    if eval $compile && $run ./try; then
+        echo "Your C compiler supports __builtin_add_overflow."
+        val="$define"
+    else
+        echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
+        val="$undef"
+    fi
+    ;;
+*) val="$d_builtin_add_overflow" ;;
+esac
+
+set d_builtin_add_overflow
+eval $setvar
+$rm_try
+
+: Look for GCC-style __builtin_sub_overflow
+case "$d_builtin_sub_overflow" in
+'')
+    echo " "
+    echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
+    $cat >try.c <<'EOCP'
+int main(void) {
+    const unsigned int uint_max = ~0u;
+    int target_int = 0;
+    if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
+        return 1;
+    }
+    if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
+        return 1;
+    }
+    if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
+        return 1;
+    }
+    return 0;
+}
+EOCP
+    set try
+    if eval $compile && $run ./try; then
+        echo "Your C compiler supports __builtin_sub_overflow."
+        val="$define"
+    else
+        echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
+        val="$undef"
+    fi
+    ;;
+*) val="$d_builtin_sub_overflow" ;;
+esac
+
+set d_builtin_sub_overflow
+eval $setvar
+$rm_try
+
+: Look for GCC-style __builtin_mul_overflow
+case "$d_builtin_mul_overflow" in
+'')
+    echo " "
+    echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
+    $cat >try.c <<'EOCP'
+int main(void) {
+    const unsigned int uint_max = ~0u;
+    int target_int = 0;
+    if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
+        return 1;
+    }
+    if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
+        return 1;
+    }
+    if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
+        return 1;
+    }
+    return 0;
+}
+EOCP
+    set try
+    if eval $compile && $run ./try; then
+        echo "Your C compiler supports __builtin_mul_overflow."
+        val="$define"
+    else
+        echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
+        val="$undef"
+    fi
+    ;;
+*) val="$d_builtin_mul_overflow" ;;
+esac
+
+set d_builtin_mul_overflow
+eval $setvar
+$rm_try
+
 : Look for GCC-style __builtin_choose_expr
 case "$d_builtin_choose_expr" in
 '')
@@ -11377,124 +11590,9 @@ set d_builtin_expect
 eval $setvar
 $rm_try
 
-: see if bzero exists
-set bzero d_bzero
-eval $inlibc
-
-: see if stdarg is available
-echo " "
-if $test `./findhdr stdarg.h`; then
-       echo "<stdarg.h> found." >&4
-       valstd="$define"
-else
-       echo "<stdarg.h> NOT found." >&4
-       valstd="$undef"
-fi
-
-: see if varargs is available
-echo " "
-if $test `./findhdr varargs.h`; then
-       echo "<varargs.h> found." >&4
-else
-       echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
-fi
-
-: set up the varargs testing programs
-$cat > varargs.c <<EOP
-#ifdef I_STDARG
-#include <stdarg.h>
-#endif
-#ifdef I_VARARGS
-#include <varargs.h>
-#endif
-
-#ifdef I_STDARG
-int f(char *p, ...)
-#else
-int f(va_alist)
-va_dcl
-#endif
-{
-       va_list ap;
-#ifndef I_STDARG
-       char *p;
-#endif
-#ifdef I_STDARG
-       va_start(ap,p);
-#else
-       va_start(ap);
-       p = va_arg(ap, char *);
-#endif
-       va_end(ap);
-       return 0;
-}
-EOP
-$cat > varargs <<EOP
-$startsh
-if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
-       echo "true"
-else
-       echo "false"
-fi
-$rm -f varargs$_o
-EOP
-chmod +x varargs
-
-: now check which varargs header should be included
-echo " "
-i_varhdr=''
-val=''
-case "$valstd" in
-"$define")
-       if `./varargs I_STDARG`; then
-               val='stdarg.h'
-       elif `./varargs I_VARARGS`; then
-               val='varargs.h'
-       fi
-       ;;
-*)
-       if `./varargs I_VARARGS`; then
-               val='varargs.h'
-       fi
-       ;;
-esac
-case "$val" in
-'')
-       echo " "
-       echo "*** WHOA THERE!!! ***" >&4
-       echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
-       case "$knowitall" in
-       '')
-       echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
-               exit 1
-               ;;
-       esac
-echo "I could not find the definition for va_dcl... You have problems..." >&4
-       val="$undef"; set i_stdarg; eval $setvar
-       val="$undef"; set i_varargs; eval $setvar
-       ;;
-*)
-       set i_varhdr
-       eval $setvar
-       case "$i_varhdr" in
-       stdarg.h)
-               val="$define"; set i_stdarg; eval $setvar
-               val="$undef"; set i_varargs; eval $setvar
-               ;;
-       varargs.h)
-               val="$undef"; set i_stdarg; eval $setvar
-               val="$define"; set i_varargs; eval $setvar
-               ;;
-       esac
-       echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
-esac
-$rm -f varargs*
-
 : see if the Compiler supports C99 variadic macros
-case "$i_stdarg$i_stdlib" in
-    "$define$define")
-    echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
-    $cat >try.c <<EOCP
+echo "Checking for C99 variadic macros." >&4
+$cat >try.c <<EOCP
 #include <stdio.h>
 #include <stdarg.h>
 
@@ -11507,29 +11605,23 @@ int main() {
   return 0;
 }
 EOCP
-    set try
-    if eval $compile && $run ./try 2>&1 >/dev/null; then
-       case "`$run ./try`" in
-           "123 456 789")
-           echo "You have C99 variadic macros." >&4
-           d_c99_variadic_macros="$define"
-           ;;
-           *)
-           echo "You don't have functional C99 variadic macros." >&4
-           d_c99_variadic_macros="$undef"
-           ;;
-       esac
-    else
-       echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
+set try
+if eval $compile && $run ./try 2>&1 >/dev/null; then
+    case "`$run ./try`" in
+       "123 456 789")
+       echo "You have C99 variadic macros." >&4
+       d_c99_variadic_macros="$define"
+       ;;
+       *)
+       echo "You don't have functional C99 variadic macros." >&4
        d_c99_variadic_macros="$undef"
-    fi
-    $rm_try
-    ;;
-    *)
-    echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
+       ;;
+    esac
+else
+    echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
     d_c99_variadic_macros="$undef"
-    ;;
-esac
+fi
+$rm_try
 
 : see if signal is declared as pointer to function returning int or void
 echo " "
@@ -11742,87 +11834,6 @@ $rm_try
 set cbrt d_cbrt
 eval $inlibc
 
-: see if vprintf exists
-echo " "
-if set vprintf val -f d_vprintf; eval $csym; $val; then
-       echo 'vprintf() found.' >&4
-       val="$define"
-       $cat >try.c <<EOF
-#$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
-#$i_varargs I_VARARGS
-
-#$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
-#  include <stdlib.h>
-#endif
-
-#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
-{
-    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
-       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
-               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
-       val="$undef"
-       val2="$undef"
-fi
-$rm_try
-set d_vprintf
-eval $setvar
-val=$val2
-set d_charvspr
-eval $setvar
-
 : see if chown exists
 set chown d_chown
 eval $inlibc
@@ -13314,8 +13325,8 @@ 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)
+       case "$d_fork:$d_pipe:$d_alarm" in
+       define:define:define)
        $cat head.c > try.c
        $cat >>try.c <<EOCP
 #include <errno.h>
@@ -13793,6 +13804,22 @@ eval $inlibc
 set fchmod d_fchmod
 eval $inlibc
 
+: check for openat, unlinkat, renameat, linkat, fchmodat
+set openat d_openat
+eval $inlibc
+
+set unlinkat d_unlinkat
+eval $inlibc
+
+set renameat d_renameat
+eval $inlibc
+
+set linkat d_linkat
+eval $inlibc
+
+set fchmodat d_fchmodat
+eval $inlibc
+
 : see if fchown exists
 set fchown d_fchown
 eval $inlibc
@@ -13945,6 +13972,10 @@ EOM
 fi
 $rm_try
 
+: see if fdclose exists
+set fdclose d_fdclose
+eval $inlibc
+
 : see if fdim exists
 set fdim d_fdim
 eval $inlibc
@@ -14065,6 +14096,30 @@ $rm_try
 set d_fpos64_t
 eval $setvar
 
+: see if this is an xlocale.h system
+set xlocale.h i_xlocale
+eval $inhdr
+
+: see if newlocale exists
+set newlocale d_newlocale
+eval $inlibc
+
+: see if freelocale exists
+set freelocale d_freelocale
+eval $inlibc
+
+: see if uselocale exists
+set uselocale d_uselocale
+eval $inlibc
+
+: see if duplocale exists
+set duplocale d_duplocale
+eval $inlibc
+
+: see if querylocale exists
+set querylocale d_querylocale
+eval $inlibc
+
 : see if frexpl exists
 set frexpl d_frexpl
 eval $inlibc
@@ -14157,6 +14212,34 @@ else
 fi
 $rm_try
 
+: look for gai_strerror
+echo " "
+$cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+int main ()
+{
+    return (gai_strerror (0) ? 0 : 1);
+    }
+EOCP
+set try
+val="$undef"
+if eval $compile; then
+    `$run ./try`
+    case "$?" in
+       0)  echo "A working gai_strerror() found." >&4
+           val="$define" ;;
+       *)  echo "gai_strerror() found, but it doesn't work" >&4
+           ;;
+       esac
+else
+    echo "gai_strerror() NOT found." >&4
+    fi
+set d_gai_strerror
+eval $setvar
+$rm_try
+
 : see if ndbm.h is available
 set ndbm.h i_ndbm
 eval $inhdr
@@ -15682,39 +15765,6 @@ eval $inlibc
 set ilogbl d_ilogbl
 eval $inlibc
 
-: index or strchr
-echo " "
-if set index val -f; eval $csym; $val; then
-       if set strchr val -f d_strchr; eval $csym; $val; then
-               if $contains strchr "$strings" >/dev/null 2>&1 ; then
-                       val="$define"
-                       vali="$undef"
-                       echo "strchr() found." >&4
-               else
-                       val="$undef"
-                       vali="$define"
-                       echo "index() found." >&4
-               fi
-       else
-               val="$undef"
-               vali="$define"
-               echo "index() found." >&4
-       fi
-else
-       if set strchr val -f d_strchr; eval $csym; $val; then
-               val="$define"
-               vali="$undef"
-               echo "strchr() found." >&4
-       else
-               echo "No index() or strchr() found!" >&4
-               val="$undef"
-               vali="$undef"
-       fi
-fi
-set d_strchr; eval $setvar
-val="$vali"
-set d_index; eval $setvar
-
 : check whether inet_aton exists
 set inet_aton d_inetaton
 eval $inlibc
@@ -16049,6 +16099,10 @@ eval $inlibc
 set llroundl d_llroundl
 eval $inlibc
 
+: see if localeconv_l exists
+set localeconv_l d_localeconv_l
+eval $inlibc
+
 : see if localtime_r exists
 set localtime_r d_localtime_r
 eval $inlibc
@@ -16225,32 +16279,28 @@ eval $inlibc
 set mblen d_mblen
 eval $inlibc
 
-: see if mbstowcs exists
-set mbstowcs d_mbstowcs
-eval $inlibc
-
-: see if mbtowc exists
-set mbtowc d_mbtowc
+: see if mbrlen exists
+set mbrlen d_mbrlen
 eval $inlibc
 
-: see if memchr exists
-set memchr d_memchr
+: see if mbrtowc exists
+set mbrtowc d_mbrtowc
 eval $inlibc
 
-: see if memcmp exists
-set memcmp d_memcmp
+: see if mbstowcs exists
+set mbstowcs d_mbstowcs
 eval $inlibc
 
-: see if memcpy exists
-set memcpy d_memcpy
+: see if mbtowc exists
+set mbtowc d_mbtowc
 eval $inlibc
 
-: see if memmove exists
-set memmove d_memmove
+: see if memmem exists
+set memmem d_memmem
 eval $inlibc
 
-: see if memset exists
-set memset d_memset
+: see if memrchr exists
+set memrchr d_memrchr
 eval $inlibc
 
 : see if mkdir exists
@@ -16325,69 +16375,6 @@ echo " "
 set d_modflproto modfl $i_math math.h
 eval $hasproto
 
-d_modfl_pow32_bug="$undef"
-
-case "$d_longdbl$d_modfl" in
-$define$define)
-       $cat <<EOM
-Checking to see whether your modfl() is okay for large values...
-EOM
-$cat >try.c <<EOCP
-#include <math.h>
-#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. */
-long double modfl (long double, long double *);
-EOCP
-fi
-$cat >>try.c <<EOCP
-int main() {
-    long double nv = 4294967303.15;
-    long double v, w;
-    v = modfl(nv, &w);
-#ifdef __GLIBC__
-    printf("glibc");
-#endif
-    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
-    return 0;
-}
-EOCP
-       case "$osname:$gccversion" in
-       aix:)   saveccflags="$ccflags"
-               ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
-       esac
-       set try
-       if eval $compile; then
-               foo=`$run ./try`
-               case "$foo" in
-               *" 4294967303.150000 1.150000 4294967302.000000")
-                       echo >&4 "Your modfl() is broken for large values."
-                       d_modfl_pow32_bug="$define"
-                       case "$foo" in
-                       glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
-                       ;;
-                       esac
-                       ;;
-               *" 4294967303.150000 0.150000 4294967303.000000")
-                       echo >&4 "Your modfl() seems okay for large values."
-                       ;;
-               *)      echo >&4 "I don't understand your modfl() at all."
-                       d_modfl="$undef"
-                       ;;
-               esac
-               $rm_try
-       else
-               echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
-               d_modfl="$undef"
-       fi
-       case "$osname:$gccversion" in
-       aix:)   ccflags="$saveccflags" ;; # restore
-       esac
-       ;;
-esac
-
 if $test "$uselongdouble" = "$define"; then
     message=""
     if $test "$d_sqrtl" != "$define"; then
@@ -16509,6 +16496,10 @@ eval $inlibc
 set nan d_nan
 eval $inlibc
 
+: see if nanosleep exists
+set nanosleep d_nanosleep
+eval $inlibc
+
 : see if nearbyint exists
 set nearbyint d_nearbyint
 eval $inlibc
@@ -16537,37 +16528,6 @@ eval $inlibc
 set quadmath.h i_quadmath
 eval $inhdr
 
-: check for volatile keyword
-echo " "
-echo 'Checking to see if your C compiler knows about "volatile"...' >&4
-$cat >try.c <<'EOCP'
-int main()
-{
-       typedef struct _goo_struct goo_struct;
-       goo_struct * volatile goo = ((goo_struct *)0);
-       struct _goo_struct {
-               long long_int;
-               int reg_int;
-               char char_var;
-       };
-       typedef unsigned short foo_t;
-       char *volatile foo;
-       volatile int bar;
-       volatile foo_t blech;
-       foo = foo;
-}
-EOCP
-if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
-       val="$define"
-       echo "Yup, it does."
-else
-       val="$undef"
-       echo "Nope, it doesn't."
-fi
-set d_volatile
-eval $setvar
-$rm_try
-
 : Check basic sizes
 echo " "
 $echo "Choosing the C types to be used for Perl's internal types..." >&4
@@ -16761,10 +16721,6 @@ case "$i64type" in
 esac
 
 $echo "Checking how many bits of your UVs your NVs can preserve..." >&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>
 #$i_stdlib I_STDLIB
@@ -16774,7 +16730,8 @@ $cat <<EOP >try.c
 #include <sys/types.h>
 #include <signal.h>
 #ifdef SIGFPE
-$volatile int bletched = 0;
+/* volatile so that the compiler has to store it out to memory */
+volatile int bletched = 0;
 $signal_t blech(int s) { bletched = 1; }
 #endif
 int main() {
@@ -16825,10 +16782,6 @@ 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>
 
@@ -16840,10 +16793,11 @@ main() {
   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;
+    /* volatile so that the compiler has to store it out to memory */
+    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;
 $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.
-if test X"$d_volatile" = X"$define"; then
-       volatile=volatile
-fi
 $cat <<EOP >try.c
 #include <stdio.h>
 #$i_stdlib I_STDLIB
@@ -16927,12 +16877,14 @@ $cat <<EOP >try.c
 #include <sys/types.h>
 #include <signal.h>
 #ifdef SIGFPE
-$volatile int bletched = 0;
+/* volatile so that the compiler has to store it out to memory */
+volatile int bletched = 0;
 $signal_t blech(int s) { bletched = 1; }
 #endif
 
-int checkit($nvtype d, char *where) {
-    unsigned char *p = (char *)&d;
+int checkit($nvtype d, const char *where) {
+    void *v = &d;
+    unsigned char *p = (unsigned char *)v;
     unsigned char *end = p + sizeof(d);
     int fail = 0;
 
@@ -16942,7 +16894,7 @@ int checkit($nvtype d, char *where) {
     if (!fail)
        return 0;
 
-    p = (char *)&d;
+    p = (unsigned char *)v;
     printf("No - %s: 0x", where);
     while (p < end)
        printf ("%02X", *p++);
@@ -17147,14 +17099,21 @@ EOM
 set readlink d_readlink
 eval $inlibc
 
-: Check if exe is symlink to abs path of executing program
+: Check if there is a /proc symlink to the abs path of
+: the executing program.  We will honor hints of d_procselfexe=$undef
+: or procselfexe being non-empty, otherwise will try to determine both
+: if we have readlink.
+: AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
+: referenced, and AmigaOS does not have a proc filesystem anyway.
 echo " "
-procselfexe=''
 val="$undef"
-case "$d_readlink" in
-    "$define")
-       : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
-       : more tidy to avoid an extra level of symlink
+if $test "X$d_procselfexe" = Xundef; then
+       procselfexe=''
+elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
+       val="$define"
+elif $test "X$d_readlink" = Xdefine; then
+        : NetBSD first as /proc/self is a symlink to /proc/curproc,
+        : and it feels more tidy to avoid an extra level of symlink
        set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
        while test $# -gt 0; do
            type=$1; try=$2
@@ -17170,8 +17129,7 @@ case "$d_readlink" in
                fi
            fi
        done
-       ;;
-esac
+fi
 $rm -f reflect
 set d_procselfexe
 eval $setvar
@@ -17551,236 +17509,6 @@ eval $inlibc
 set round d_round
 eval $inlibc
 
-: see if memory.h is available.
-val=''
-set memory.h val
-eval $inhdr
-
-: See if it conflicts with string.h
-case "$val" in
-$define)
-       case "$strings" in
-       '') ;;
-       *)
-               $cppstdin $cppflags $cppminus < $strings > mem.h
-               if $contains 'memcpy' mem.h >/dev/null 2>&1; then
-                       echo " "
-                       echo "We won't be including <memory.h>."
-                       val="$undef"
-               fi
-               $rm -f mem.h
-               ;;
-       esac
-esac
-set i_memory
-eval $setvar
-
-: can bcopy handle overlapping blocks?
-echo " "
-val="$undef"
-case "$d_memmove" in
-"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
-*)     case "$d_bcopy" in
-       "$define")
-               echo "Checking to see if bcopy() can do overlapping copies..." >&4
-               $cat >try.c <<EOCP
-#$i_memory I_MEMORY
-#$i_stdlib I_STDLIB
-#$i_string I_STRING
-#$i_unistd I_UNISTD
-EOCP
-       $cat >>try.c <<'EOCP'
-#include <stdio.h>
-#ifdef I_MEMORY
-#  include <memory.h>
-#endif
-#ifdef I_STDLIB
-#  include <stdlib.h>
-#endif
-#ifdef I_STRING
-#  include <string.h>
-#else
-#  include <strings.h>
-#endif
-#ifdef I_UNISTD
-#  include <unistd.h>  /* Needed for NetBSD */
-#endif
-int main()
-{
-char buf[128], abc[128];
-char *b;
-int len;
-int off;
-int align;
-
-/* Copy "abcde..." string to char abc[] so that gcc doesn't
-   try to store the string in read-only memory. */
-bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
-
-for (align = 7; align >= 0; align--) {
-       for (len = 36; len; len--) {
-               b = buf+align;
-               bcopy(abc, b, len);
-               for (off = 1; off <= len; off++) {
-                       bcopy(b, b+off, len);
-                       bcopy(b+off, b, len);
-                       if (bcmp(b, abc, len))
-                               exit(1);
-               }
-       }
-}
-exit(0);
-}
-EOCP
-               set try
-               if eval $compile_ok; then
-                       if $run ./try 2>/dev/null; then
-                               echo "Yes, it can."
-                               val="$define"
-                       else
-                               echo "It can't, sorry."
-                       fi
-               else
-                       echo "(I can't compile the test program, so we'll assume not...)"
-               fi
-               ;;
-       esac
-       $rm_try
-       ;;
-esac
-set d_safebcpy
-eval $setvar
-
-: can memcpy handle overlapping blocks?
-echo " "
-val="$undef"
-case "$d_memmove" in
-"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
-*)     case "$d_memcpy" in
-       "$define")
-               echo "Checking to see if memcpy() can do overlapping copies..." >&4
-               $cat >try.c <<EOCP
-#$i_memory I_MEMORY
-#$i_stdlib I_STDLIB
-#$i_string I_STRING
-#$i_unistd I_UNISTD
-EOCP
-       $cat >>try.c <<'EOCP'
-#include <stdio.h>
-#ifdef I_MEMORY
-#  include <memory.h>
-#endif
-#ifdef I_STDLIB
-#  include <stdlib.h>
-#endif
-#ifdef I_STRING
-#  include <string.h>
-#else
-#  include <strings.h>
-#endif
-#ifdef I_UNISTD
-#  include <unistd.h>  /* Needed for NetBSD */
-#endif
-int main()
-{
-char buf[128], abc[128];
-char *b;
-int len;
-int off;
-int align;
-
-/* Copy "abcde..." string to char abc[] so that gcc doesn't
-   try to store the string in read-only memory. */
-memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
-
-for (align = 7; align >= 0; align--) {
-       for (len = 36; len; len--) {
-               b = buf+align;
-               memcpy(b, abc, len);
-               for (off = 1; off <= len; off++) {
-                       memcpy(b+off, b, len);
-                       memcpy(b, b+off, len);
-                       if (memcmp(b, abc, len))
-                               exit(1);
-               }
-       }
-}
-exit(0);
-}
-EOCP
-               set try
-               if eval $compile_ok; then
-                       if $run ./try 2>/dev/null; then
-                               echo "Yes, it can."
-                               val="$define"
-                       else
-                               echo "It can't, sorry."
-                       fi
-               else
-                       echo "(I can't compile the test program, so we'll assume not...)"
-               fi
-               ;;
-       esac
-       $rm_try
-       ;;
-esac
-set d_safemcpy
-eval $setvar
-
-: can memcmp be trusted to compare relative magnitude?
-val="$undef"
-case "$d_memcmp" in
-"$define")
-       echo " "
-       echo "Checking if your memcmp() can compare relative magnitude..." >&4
-       $cat >try.c <<EOCP
-#$i_memory I_MEMORY
-#$i_stdlib I_STDLIB
-#$i_string I_STRING
-#$i_unistd I_UNISTD
-EOCP
-       $cat >>try.c <<'EOCP'
-#include <stdio.h>
-#ifdef I_MEMORY
-#  include <memory.h>
-#endif
-#ifdef I_STDLIB
-#  include <stdlib.h>
-#endif
-#ifdef I_STRING
-#  include <string.h>
-#else
-#  include <strings.h>
-#endif
-#ifdef I_UNISTD
-#  include <unistd.h>  /* Needed for NetBSD */
-#endif
-int main()
-{
-char a = -1;
-char b = 0;
-if ((a < b) && memcmp(&a, &b, 1) < 0)
-       exit(1);
-exit(0);
-}
-EOCP
-       set try
-       if eval $compile_ok; then
-               if $run ./try 2>/dev/null; then
-                       echo "Yes, it can."
-                       val="$define"
-               else
-                       echo "No, it can't (it uses signed chars)."
-               fi
-       else
-               echo "(I can't compile the test program, so we'll assume not...)"
-       fi
-       ;;
-esac
-$rm_try
-set d_sanemcmp
-eval $setvar
-
 : see if prototype for sbrk is available
 echo " "
 set d_sbrkproto sbrk $i_unistd unistd.h
 set d_sigaction; eval $setvar
 $rm_try
 
+: see what type pids are declared as in the kernel
+rp="What is the type of process ids on this system?"
+set pid_t pidtype int stdio.h sys/types.h
+eval $typedef_ask
+
+: see what type uids are declared as in the kernel
+echo " "
+echo "Looking for the type for user ids returned by getuid()."
+set uid_t uidtype xxx stdio.h sys/types.h
+eval $typedef
+case "$uidtype" in
+xxx)
+       xxx=`./findhdr sys/user.h`
+       set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
+       case $1 in
+       unsigned) dflt="$1 $2" ;;
+       *) dflt="$1" ;;
+       esac
+       ;;
+*) dflt="$uidtype";;
+esac
+case "$uidtype" in
+uid_t) echo "uid_t found." ;;
+*)     rp="What is the type for user ids returned by getuid()?"
+       . ./myread
+       uidtype="$ans"
+       ;;
+esac
+
+: Define hasfield_t macro for Configure internal use
+hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
+while $test $# -ge 2; do
+    case "$1" in
+       $define) echo "#include <$2>";;
+    esac ;
+    shift 2;
+done > try.c;
+echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
+set try;
+if eval $compile; then
+       val="$define";
+else
+       val="$undef";
+fi;
+set $varname;
+eval $setvar;
+$rm_try'
+
+: see what siginfo fields we have
+case "$d_sigaction" in
+"$define")
+       echo "Checking if your siginfo_t has si_errno field...">&4
+       set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
+       eval $hasfield_t;
+
+       echo "Checking if your siginfo_t has si_pid field...">&4
+       set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
+       eval $hasfield_t;
+
+       echo "Checking if your siginfo_t has si_uid field...">&4
+       set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
+       eval $hasfield_t;
+
+       echo "Checking if your siginfo_t has si_addr field...">&4
+       set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
+       eval $hasfield_t;
+
+       echo "Checking if your siginfo_t has si_status field...">&4
+       set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
+       eval $hasfield_t;
+
+       echo "Checking if your siginfo_t has si_band field...">&4
+       set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
+       eval $hasfield_t;
+
+       echo "Checking if your siginfo_t has si_value field...">&4
+       set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
+       eval $hasfield_t;
+
+       echo "Checking if your siginfo_t has si_fd field...">&4
+       set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
+       eval $hasfield_t;
+
+       ;;
+*)
+       d_siginfo_si_errno="$undef"
+       d_siginfo_si_pid="$undef"
+       d_siginfo_si_uid="$undef"
+       d_siginfo_si_addr="$undef"
+       d_siginfo_si_status="$undef"
+       d_siginfo_si_band="$undef"
+       d_siginfo_si_value="$undef"
+       d_siginfo_si_fd="$undef"
+       ;;
+esac
+
 : see if this is a sunmath.h system
 set sunmath.h i_sunmath
 eval $inhdr
@@ -18576,7 +18400,7 @@ $cat >try.c <<EOCP
 int main(int argc, char **argv)
 {
     NV x = 0.0;
-    NV y = -0.0;
+    NV y = -1.0;
     if ((signbit(x) == 0) && (signbit(y) != 0))
        return 0;
     else
 *) val="$d_sigsetjmp"
        case "$d_sigsetjmp" in
        $define) echo "POSIX sigsetjmp found." >&4;;
-       $undef) echo "sigsetjmp not found." >&4;;
-       esac
-       ;;
-esac
-set d_sigsetjmp
-eval $setvar
-$rm_try
-
-: see if snprintf exists
-set snprintf d_snprintf
-eval $inlibc
-
-: see if vsnprintf exists
-set vsnprintf d_vsnprintf
-eval $inlibc
-
-case "$d_snprintf-$d_vsnprintf" in
-"$define-$define")
-    $cat <<EOM
-Checking whether your snprintf() and vsnprintf() work okay...
-EOM
-    $cat >try.c <<'EOCP'
-/* v?snprintf testing logic courtesy of Russ Allbery.
- * According to C99:
- * - if the buffer is too short it still must be \0-terminated
- * - if the buffer is too short the potentially required length
- *   must be returned and not -1
- * - if the buffer is NULL the potentially required length
- *   must be returned and not -1 or core dump
- */
-#include <stdio.h>
-#include <stdarg.h>
-
-char buf[2];
-
-int test (char *format, ...)
-{
-    va_list args;
-    int count;
-
-    va_start (args, format);
-    count = vsnprintf (buf, sizeof buf, format, args);
-    va_end (args);
-    return count;
-}
-
-int main ()
-{
-    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
-             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
-}
-EOCP
-    set try
-    if eval $compile; then
-       `$run ./try`
-       case "$?" in
-       0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
-       *) cat <<EOM >&4
-Your snprintf() and snprintf() don't seem to be working okay.
-EOM
-          d_snprintf="$undef"
-          d_vsnprintf="$undef"
-          ;;
-       esac
-    else
-       echo "(I can't seem to compile the test program--assuming they don't)"
-       d_snprintf="$undef"
-       d_vsnprintf="$undef"
-    fi
-    $rm_try
-    ;;
-esac
-
-: see if sockatmark exists
-set sockatmark d_sockatmark
-eval $inlibc
-
-: see if prototype for sockatmark is available
-echo " "
-set d_sockatmarkproto sockatmark $d_socket sys/socket.h
-eval $hasproto
-
-: see if socks5_init exists
-set socks5_init d_socks5_init
-eval $inlibc
-
-: see if sprintf returns the length of the string in the buffer as per ANSI
-$echo "Checking whether sprintf returns the length of the string..." >&4
-$cat <<EOP >try.c
-#include <stdio.h>
-#$i_stdlib I_STDLIB
-#ifdef I_STDLIB
-#include <stdlib.h>
-#endif
-#$i_string I_STRING
-#ifdef I_STRING
-#  include <string.h>
-#else
-#  include <strings.h>
-#endif
-#$i_math I_MATH
-#ifdef I_MATH
-#include <math.h>
-#endif
-
-char buffer[256];
-
-int check (size_t expect, int test) {
-  size_t got = strlen(buffer);
-  if (expect == got)
-    return 0;
-
-  printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
-       test, buffer);
-  exit (test);
-}
-
-int main(int argc, char **argv) {
-  int test = 0;
-
-  check(sprintf(buffer, ""), ++test);
-  check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
-  check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
-
-  return 0;
-}
-EOP
-set try
-
-if eval $compile; then
-    xxx="`$run ./try`"
-    case "$?" in
-       0) cat >&4 <<EOM
-sprintf returns the length of the string (as ANSI says it should)
-EOM
-       d_sprintf_returns_strlen="$define"
-       ;;
-       *) cat >&4 <<EOM
-sprintf does not return the length of the string (how old is this system?)
-EOM
-       d_sprintf_returns_strlen="$undef"
-        ;;
-    esac
-else
-    echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
-    d_sprintf_returns_strlen="$undef"
-fi
+       $undef) echo "sigsetjmp not found." >&4;;
+       esac
+       ;;
+esac
+set d_sigsetjmp
+eval $setvar
 $rm_try
 
+: see if sockatmark exists
+set sockatmark d_sockatmark
+eval $inlibc
+
+: see if prototype for sockatmark is available
+echo " "
+set d_sockatmarkproto sockatmark $d_socket sys/socket.h
+eval $hasproto
+
+: see if socks5_init exists
+set socks5_init d_socks5_init
+eval $inlibc
+
 : see if srand48_r exists
 set srand48_r d_srand48_r
 eval $inlibc
@@ -19085,30 +18781,6 @@ esac
 set strcoll d_strcoll
 eval $inlibc
 
-: check for structure copying
-echo " "
-echo "Checking to see if your C compiler can copy structs..." >&4
-$cat >try.c <<'EOCP'
-int main()
-{
-       struct blurfl {
-               int dyick;
-       } foo, bar;
-
-       foo = bar;
-}
-EOCP
-if $cc -c try.c >/dev/null 2>&1 ; then
-       val="$define"
-       echo "Yup, it can."
-else
-       val="$undef"
-       echo "Nope, it can't."
-fi
-set d_strctcpy
-eval $setvar
-$rm_try
-
 : see if strerror and/or sys_errlist[] exist
 echo " "
 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
@@ -19148,6 +18820,10 @@ if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
     fi
 fi
 
+: see if strerror_l exists
+set strerror_l d_strerror_l
+eval $inlibc
+
 : see if strerror_r exists
 set strerror_r d_strerror_r
 eval $inlibc
@@ -19209,6 +18885,10 @@ eval $inlibc
 set strlcpy d_strlcpy
 eval $inlibc
 
+: see if strnlen exists
+set strnlen d_strnlen
+eval $inlibc
+
 : see if strtod exists
 set strtod d_strtod
 eval $inlibc
@@ -19221,6 +18901,10 @@ eval $inlibc
 set strtold d_strtold
 eval $inlibc
 
+: see if strtold_l exists
+set strtold_l d_strtold_l
+eval $inlibc
+
 : see if strtoll exists
 set strtoll d_strtoll
 eval $inlibc
@@ -19518,6 +19202,93 @@ eval $hasproto
 set tgamma d_tgamma
 eval $inlibc
 
+: check for thread_safe_nl_langinfo_l item
+$cat <<EOM
+
+Checking to see if you have nl_langinfo_l() and that it is thread-safe
+EOM
+$cat >try.c <<EOCP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#  include <stdlib.h>
+#endif
+#$i_string I_STRING
+#ifdef I_STRING
+#  include <string.h>
+#endif
+#$i_langinfo I_LANGINFO
+#ifdef I_LANGINFO
+#  include <langinfo.h>
+#endif
+#$i_pthread I_PTHREAD
+#ifdef I_PTHREAD
+#  include <pthread.h>
+#endif
+#$i_locale I_LOCALE
+#ifdef I_LOCALE
+#  include <locale.h>
+#endif
+
+void *
+thread_start(void * arg)
+{
+    nl_langinfo(RADIXCHAR);
+}
+
+int main() {
+       char * main_buffer;
+       char save_main_buffer[1000];
+        pthread_t subthread;
+        pthread_attr_t attr;
+       
+       main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
+
+       /* If too large for our generous allowance, just assume we don't have
+        * it. */
+       if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
+           exit(1);
+       }
+
+       strcpy(save_main_buffer, main_buffer);
+
+       if (pthread_attr_init(&attr) != 0) {
+           exit(1);
+       }
+
+       if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
+           exit(1);
+       }
+
+       if (pthread_join(subthread, NULL) != 0) {
+           exit(1);
+       }
+
+        exit(! (strcmp(main_buffer, save_main_buffer) == 0));
+}
+EOCP
+case "$usethreads" in
+    define)
+       set try
+       if eval $compile; then
+               echo "Your system has nl_langinfo_l()..." >&4
+               if $run ./try; then
+                   echo "and it is thread-safe (just as I'd hoped)." >&4
+                   d_thread_safe_nl_langinfo_l="$define"
+                   echo "$d_thread_safe_nl_langinfo_l" >&4
+               else
+                   echo "but it isn't thread-safe, so we won't use it." >&4
+               fi
+       else
+               echo "your system does not have nl_langinfo_l()" >&4
+       fi
+       ;;
+    *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
+esac
+if test X"$d_thread_safe_nl_langinfo_l" = X; then
+       d_thread_safe_nl_langinfo_l="$undef"
+fi
+$rm_try
+
 : see if time exists
 echo " "
 if test "X$d_time" = X -o X"$timetype" = X; then
@@ -20033,20 +19804,11 @@ eval $inlibc
 echo " "
 case "$alignbytes" in
     '') echo "Checking alignment constraints..." >&4
-       if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
-           $cat >try.c <<'EOCP'
-typedef long double NV;
-EOCP
-       else
-           $cat >try.c <<'EOCP'
-typedef double NV;
-EOCP
-       fi
-       $cat >>try.c <<'EOCP'
+       $cat >try.c <<EOCP
 #include <stdio.h>
 struct foobar {
     char foo;
-    NV bar;
+    $nvtype bar;
 } try_algn;
 int main()
 {
@@ -20347,19 +20109,52 @@ EOCP
        ;;
 esac
 
+: Include . in @INC
+$cat <<EOM
+
+Historically Perl has provided a final fallback of the current working
+directory '.' when searching for a library. This, however, can lead to
+problems when a Perl program which loads optional modules is called from
+a shared directory. This can lead to executing unexpected code.
+
+EOM
+
+# When changing to exclude by default:
+case "$default_inc_excludes_dot" in
+    $undef|false|[nN]*) dflt="n" ;;
+    *)                  dflt="y" ;;
+esac
+# To turn exclude off by default:
+#case "$default_inc_excludes_dot" in
+#    $define|true|[yY]*) dflt="y" ;;
+#    *)                  dflt="n" ;;
+#esac
+
+rp='Exclude '.' from @INC by default? '
+. ./myread
+case "$ans" in
+    [nN]|undef) default_inc_excludes_dot="$undef"  ;;
+    *)          default_inc_excludes_dot="$define" ;;
+esac
+
 : Check what kind of inf/nan your system has
 $echo "Checking the kind of infinities and nans you have..." >&4
+$echo "(The following tests may crash.  That's okay.)" >&4
 $cat >try.c <<EOP
 #define DOUBLESIZE $doublesize
 #$d_longdbl HAS_LONG_DOUBLE
 #ifdef HAS_LONG_DOUBLE
-#define LONGDBLSIZE $longdblsize
-#define LONGDBLKIND $longdblkind
+#define LONG_DOUBLESIZE $longdblsize
+#define LONG_DOUBLEKIND $longdblkind
 #endif
 #$i_math I_MATH
+#$i_string I_STRING
 #ifdef I_MATH
 #include <math.h>
 #endif
+#ifdef I_STRING
+#  include <string.h>
+#endif
 #include <stdio.h>
 /* Note that whether the sign bit is on or off
  * for NaN depends on the CPU/FPU, and possibly
@@ -20370,8 +20165,14 @@ $cat >try.c <<EOP
  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  * (respectively) as opposed to the more usual
  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ *
+ * Pre-IEEE-754 floating point format do not even have inf/nan support
+ * at all.  They might have a "max" value (DBL_MAX), which may be deadly
+ * to even mention, causing immediate SIGFPE or equivalent: this is
+ * the case with VAX floating point, for example.
  */
-static void bytes(unsigned char *p, unsigned int n) {
+static void bytes(void *v, unsigned int n) {
+  unsigned char *p = (unsigned char *)v;
   int i;
   for (i = 0; i < n; i++) {
     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
@@ -20386,16 +20187,15 @@ int main(int argc, char *argv[]) {
 #ifdef HAS_LONG_DOUBLE
    long double ldinf = (long double)exp(1e9);
    long double ldnan = (long double)sqrt(-1.0);
-#endif
-  if (argc == 2) {
-    switch (argv[1][0]) {
-    case '1': bytes(&dinf, sizeof(dinf)); break;
-    case '2': bytes(&dnan, sizeof(dnan)); break;
-#ifdef HAS_LONG_DOUBLE
 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
 /* the 80-bit long doubles might have garbage in their excess bytes */
     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
+    memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
 # endif
+  if (argc == 2) {
+    switch (argv[1][0]) {
+    case '1': bytes(&dinf, sizeof(dinf)); break;
+    case '2': bytes(&dnan, sizeof(dnan)); break;
     case '3': bytes(&ldinf, sizeof(ldinf)); break;
     case '4': bytes(&ldnan, sizeof(ldnan)); break;
 #endif
@@ -20449,6 +20249,10 @@ else
        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
        ;;
+    9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
+       doubleinfbytes=$undef
+       doublenanbytes=$undef
+       ;;
     *) # No idea.
        doubleinfbytes=$undef
        doublenanbytes=$undef
@@ -20495,20 +20299,45 @@ else
        ;;
        esac
        ;;
-    5) # 128-bit LE "double double"
+    5) # 128-bit LE-LE "double double"
        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
        ;;
-    6) # 128-bit BE "double double"
+    6) # 128-bit BE-BE "double double"
        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
        ;;
+    7) # 128-bit LE-BE "double double"
+       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
+       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
+       ;;
+    8) # 128-bit BE-LE "double double"
+       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
+       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
+       ;;
+    9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
+       longdblinfbytes=$undef
+       longdblnanbytes=$undef
+       ;;
     *) # No idea.
        longdblinfbytes=$undef
        longdblnanbytes=$undef
        ;;
     esac
 fi
+# In case the program crashed the values are empty, turn them undef.
+case "$doubleinfbytes" in
+'') doubleinfbytes=$undef ;;
+esac
+case "$doublenanbytes" in
+'') doublenanbytes=$undef ;;
+esac
+case "$longdblinfbytes" in
+'') longdblinfbytes=$undef ;;
+esac
+case "$longdblnanbytes" in
+'') longdblnanbytes=$undef ;;
+esac
 $rm_try
 
 : Check the length of the double mantissa
@@ -20561,7 +20390,7 @@ $cat >try.c <<EOP
  * and the top bit must have been one since 387, zero is plain invalid.
  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
 #  define BITS LDBL_MANT_DIG
-# elif ($longdblkind == 5 || $longdblkind == 6) /* double double */
+# elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
  * reason e.g. Irix thinks 107.  But in any case, we want only
  * the number of real bits, the implicit bits are of no interest.  */
@@ -20621,6 +20450,61 @@ seedfunc="Perl_drand48_init"
 randbits=48
 randseedtype=U32
 
+: Probe whether dtrace builds an object, as newer Illumos requires an input
+: object file that uses at least one of the probes defined in the .d file
+case "$usedtrace" in
+$define)
+    case "$dtracexnolibs" in
+    $define|true|[yY]*)
+        dtracexnolibs=$define
+       $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
+       ;;
+    ' '|'')
+        if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
+            dtracexnolibs=$define
+            echo "Your dtrace accepts -xnolibs"
+       elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
+            dtracexnolibs=$undef
+            echo "Your dtrace doesn't accept -xnolibs"
+       else
+             echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
+            exit 1
+       fi
+       ;;
+    *)
+        dtracexnolibs=$undef
+       $dtrace -h -s ../perldtrace.d -o perldtrace.h
+       ;;
+    esac
+    case $dtracexnolibs in
+    $define) xnolibs=-xnolibs ;;
+    *) xnolibs= ;;
+    esac
+
+    case "$dtraceobject" in
+    $define|true|[yY]*)
+        dtraceobject=$define
+        ;;
+    ' '|'')
+        $cat >try.c <<EOM
+#include "perldtrace.h"
+int main(void) {
+    PERL_LOADED_FILE("dummy");
+    return 0;
+}
+EOM
+        dtraceobject=$undef
+        if $cc -c -o try.o $optimize $ccflags try.c \
+                    && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
+                dtraceobject=$define
+            echo "Your dtrace builds an object file"
+        fi
+        ;;
+    *) dtraceobject=$undef ;;
+    esac
+    $rm_try perldtrace.o perldtrace.h
+esac
+
 : Determine if this is an EBCDIC system
 echo " "
 echo "Determining whether or not we are on an EBCDIC system..." >&4
@@ -21379,15 +21263,10 @@ eval $typedef_ask
 
 : see if we need va_copy
 echo " "
-case "$i_stdarg" in
-"$define")
-       $cat >try.c <<EOCP
+$cat >try.c <<EOCP
 #include <stdarg.h>
 #include <stdio.h>
-#$i_stdlib I_STDLIB
-#ifdef I_STDLIB
 #include <stdlib.h>
-#endif
 #include <signal.h>
 
 int
@@ -21419,28 +21298,23 @@ main(int ac, char **av)
   exit(0);
 }
 EOCP
-       set try
-       if eval $compile && $run ./try 2>&1 >/dev/null; then
-               case "`$run ./try`" in
-               "that's all right, then")
-                       okay=yes
-                       ;;
-               esac
-       fi
-       case "$okay" in
-       yes)    echo "It seems that you don't need va_copy()." >&4
-               need_va_copy="$undef"
-               ;;
-       *)      echo "It seems that va_copy() or similar will be needed." >&4
-               need_va_copy="$define"
+set try
+if eval $compile && $run ./try 2>&1 >/dev/null; then
+       case "`$run ./try`" in
+       "that's all right, then")
+               okay=yes
                ;;
        esac
-       $rm_try
-       ;;
-*)     echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
+fi
+case "$okay" in
+yes)   echo "It seems that you don't need va_copy()." >&4
        need_va_copy="$undef"
        ;;
+*)     echo "It seems that va_copy() or similar will be needed." >&4
+       need_va_copy="$define"
+       ;;
 esac
+$rm_try
 
 : see what type is used for size_t
 rp="What is the type used for the length parameter for string functions?"
@@ -21604,11 +21478,6 @@ rp='What pager is used on your system?'
 . ./getfile
 pager="$ans"
 
-: see what type pids are declared as in the kernel
-rp="What is the type of process ids on this system?"
-set pid_t pidtype int stdio.h sys/types.h
-eval $typedef_ask
-
 : see if ar generates random libraries by itself
 echo " "
 echo "Checking how to generate random libraries on your machine..." >&4
@@ -21992,6 +21861,8 @@ EOM
 esac
 
 : Trace out the files included by signal.h, then look for SIGxxx names.
+case "$sig_num_init" in
+'')
 if [ "X$fieldn" = X ]; then
        : Just make some guesses.  We check them later.
        xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
@@ -22211,8 +22082,12 @@ $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
 EOS
 chmod a+x signal_cmd
 $eunicefix signal_cmd
+;;
+esac
 
 : generate list of signal names
+case "$sig_num_init" in
+'')
 echo " "
 case "$sig_name_init" in
 '') doinit=yes ;;
@@ -22255,6 +22130,8 @@ echo $sig_name | $awk \
 }'
 sig_size=`echo $sig_name | awk '{print NF}'`
 $rm -f signal signal.c signal.awk signal.lst signal_cmd
+;;
+esac
 
 : Check size of size
 echo " "
@@ -22492,30 +22369,6 @@ else
 fi
 $rm -f stdioh
 
-: see what type uids are declared as in the kernel
-echo " "
-echo "Looking for the type for user ids returned by getuid()."
-set uid_t uidtype xxx stdio.h sys/types.h
-eval $typedef
-case "$uidtype" in
-xxx)
-       xxx=`./findhdr sys/user.h`
-       set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
-       case $1 in
-       unsigned) dflt="$1 $2" ;;
-       *) dflt="$1" ;;
-       esac
-       ;;
-*) dflt="$uidtype";;
-esac
-case "$uidtype" in
-uid_t) echo "uid_t found." ;;
-*)     rp="What is the type for user ids returned by getuid()?"
-       . ./myread
-       uidtype="$ans"
-       ;;
-esac
-
 : Check size of UID
 echo " "
 case "$uidtype" in
@@ -22679,7 +22532,7 @@ main(int argc, char **argv) {
        return 4;
     }
 
-    buffer = malloc(size);
+    buffer = (char *)malloc(size);
     if (!buffer) {
        perror("malloc");
        return 5;
@@ -22778,7 +22631,7 @@ main(int argc, char **argv) {
        return 2;
     }
 
-    buffer = malloc(size);
+    buffer = (char *)malloc(size);
     if (!buffer) {
        perror("malloc");
        return 3;
@@ -22853,21 +22706,6 @@ case "$usesitecustomize" in
        ;;
     esac
 
-: see if prototypes support variable argument declarations
-echo " "
-case "$prototype$i_stdarg" in
-$define$define)
-       echo "It appears we'll be able to prototype varargs functions." >&4
-       val="$define"
-       ;;
-*)
-       echo "Too bad... We won't be using prototyped varargs functions..." >&4
-       val="$undef"
-       ;;
-esac
-set vaproto
-eval $setvar
-
 : determine compiler compiler
 case "$yacc" in
 '')
@@ -22962,6 +22800,30 @@ else
        i_machcthr="$undef"
 fi
 
+: see if memory.h is available.
+val=''
+set memory.h val
+eval $inhdr
+
+: See if it conflicts with string.h
+case "$val" in
+$define)
+       case "$strings" in
+       '') ;;
+       *)
+               $cppstdin $cppflags $cppminus < $strings > mem.h
+               if $contains 'memcpy' mem.h >/dev/null 2>&1; then
+                       echo " "
+                       echo "We won't be including <memory.h>."
+                       val="$undef"
+               fi
+               $rm -f mem.h
+               ;;
+       esac
+esac
+set i_memory
+eval $setvar
+
 : see if this is a mntent.h system
 set mntent.h i_mntent
 eval $inhdr
@@ -23134,7 +22996,7 @@ case "$osname-$gccversion" in
 irix-) ccflags="\$ccflags -woff 1178" ;;
 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
 esac
-$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
+$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
 EOSH
 chmod +x Cppsym.try
 $eunicefix Cppsym.try
@@ -23231,7 +23093,7 @@ fi
 
 : add -D_FORTIFY_SOURCE if feasible and not already there
 case "$gccversion" in
-4.*)   case "$optimize$ccflags" in
+[4567].*)      case "$optimize$ccflags" in
        *-O*)   case "$ccflags$cppsymbols" in
                *_FORTIFY_SOURCE=*) # Don't add it again.
                        echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
@@ -23241,11 +23103,11 @@ case "$gccversion" in
                        ;;
                esac
                ;;
-       *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
+       *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
                ;;
        esac
        ;;
-*)     echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
+*)     echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
        ;;
 esac
 
@@ -23333,10 +23195,6 @@ $rm_try
 set i_stdbool
 eval $setvar
 
-: see if stddef is available
-set stddef.h i_stddef
-eval $inhdr
-
 : see if stdint is available
 set stdint.h i_stdint
 eval $inhdr
@@ -23441,6 +23299,10 @@ case "$d_vfork" in
        ;;
 esac
 
+: see if wchar.h is present
+set wchar.h i_wchar
+eval $inhdr
+
 : Check extensions
 echo " "
 echo "Looking for extensions..." >&4
@@ -23524,6 +23386,11 @@ known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort
 avail_ext=''
 for xxx in $xs_extensions ; do
        case "$xxx" in
+       Amiga*)
+               case "$osname" in
+               amigaos) avail_ext="$avail_ext $xxx" ;;
+               esac
+               ;;
        DB_File|db_file)
                case "$i_db" in
                $define) avail_ext="$avail_ext $xxx" ;;
@@ -23593,9 +23460,14 @@ for xxx in $xs_extensions ; do
                esac
                ;;
        Sys/Syslog|sys/syslog)
-               : XXX syslog requires socket
-               case "$d_socket" in
-               true|$define|y) avail_ext="$avail_ext $xxx" ;;
+               case $osname in
+                       amigaos) ;; # not really very useful on AmigaOS
+                       *)
+                       : XXX syslog requires socket
+                       case "$d_socket" in
+                       true|$define|y) avail_ext="$avail_ext $xxx" ;;
+                       esac
+                       ;;
                esac
                ;;
        Thread|thread)
@@ -23968,7 +23840,6 @@ _o='$_o'
 afs='$afs'
 afsroot='$afsroot'
 alignbytes='$alignbytes'
-ansi2knr='$ansi2knr'
 aphostname='$aphostname'
 api_revision='$api_revision'
 api_subversion='$api_subversion'
@@ -24065,19 +23936,18 @@ d_attribute_pure='$d_attribute_pure'
 d_attribute_unused='$d_attribute_unused'
 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
 d_backtrace='$d_backtrace'
-d_bcmp='$d_bcmp'
-d_bcopy='$d_bcopy'
 d_bsd='$d_bsd'
 d_bsdgetpgrp='$d_bsdgetpgrp'
 d_bsdsetpgrp='$d_bsdsetpgrp'
+d_builtin_add_overflow='$d_builtin_add_overflow'
 d_builtin_choose_expr='$d_builtin_choose_expr'
 d_builtin_expect='$d_builtin_expect'
-d_bzero='$d_bzero'
+d_builtin_mul_overflow='$d_builtin_mul_overflow'
+d_builtin_sub_overflow='$d_builtin_sub_overflow'
 d_c99_variadic_macros='$d_c99_variadic_macros'
 d_casti32='$d_casti32'
 d_castneg='$d_castneg'
 d_cbrt='$d_cbrt'
-d_charvspr='$d_charvspr'
 d_chown='$d_chown'
 d_chroot='$d_chroot'
 d_chsize='$d_chsize'
@@ -24109,9 +23979,18 @@ d_dlerror='$d_dlerror'
 d_dlopen='$d_dlopen'
 d_dlsymun='$d_dlsymun'
 d_dosuid='$d_dosuid'
+d_double_has_inf='$d_double_has_inf'
+d_double_has_nan='$d_double_has_nan'
+d_double_has_negative_zero='$d_double_has_negative_zero'
+d_double_has_subnormals='$d_double_has_subnormals'
+d_double_style_cray='$d_double_style_cray'
+d_double_style_ibm='$d_double_style_ibm'
+d_double_style_ieee='$d_double_style_ieee'
+d_double_style_vax='$d_double_style_vax'
 d_drand48_r='$d_drand48_r'
 d_drand48proto='$d_drand48proto'
 d_dup2='$d_dup2'
+d_duplocale='$d_duplocale'
 d_eaccess='$d_eaccess'
 d_endgrent='$d_endgrent'
 d_endgrent_r='$d_endgrent_r'
@@ -24134,11 +24013,13 @@ d_expm1='$d_expm1'
 d_faststdio='$d_faststdio'
 d_fchdir='$d_fchdir'
 d_fchmod='$d_fchmod'
+d_fchmodat='$d_fchmodat'
 d_fchown='$d_fchown'
 d_fcntl='$d_fcntl'
 d_fcntl_can_lock='$d_fcntl_can_lock'
 d_fd_macros='$d_fd_macros'
 d_fd_set='$d_fd_set'
+d_fdclose='$d_fdclose'
 d_fdim='$d_fdim'
 d_fds_bits='$d_fds_bits'
 d_fegetround='$d_fegetround'
@@ -24161,6 +24042,7 @@ d_fpclassify='$d_fpclassify'
 d_fpclassl='$d_fpclassl'
 d_fpgetround='$d_fpgetround'
 d_fpos64_t='$d_fpos64_t'
+d_freelocale='$d_freelocale'
 d_frexpl='$d_frexpl'
 d_fs_data_s='$d_fs_data_s'
 d_fseeko='$d_fseeko'
@@ -24171,6 +24053,7 @@ d_fsync='$d_fsync'
 d_ftello='$d_ftello'
 d_ftime='$d_ftime'
 d_futimes='$d_futimes'
+d_gai_strerror='$d_gai_strerror'
 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'
@@ -24241,7 +24124,6 @@ d_hypot='$d_hypot'
 d_ilogb='$d_ilogb'
 d_ilogbl='$d_ilogbl'
 d_inc_version_list='$d_inc_version_list'
-d_index='$d_index'
 d_inetaton='$d_inetaton'
 d_inetntop='$d_inetntop'
 d_inetpton='$d_inetpton'
@@ -24272,10 +24154,12 @@ d_lgamma_r='$d_lgamma_r'
 d_libm_lib_version='$d_libm_lib_version'
 d_libname_unique='$d_libname_unique'
 d_link='$d_link'
+d_linkat='$d_linkat'
 d_llrint='$d_llrint'
 d_llrintl='$d_llrintl'
 d_llround='$d_llround'
 d_llroundl='$d_llroundl'
+d_localeconv_l='$d_localeconv_l'
 d_localtime64='$d_localtime64'
 d_localtime_r='$d_localtime_r'
 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
@@ -24284,6 +24168,11 @@ d_lockf='$d_lockf'
 d_log1p='$d_log1p'
 d_log2='$d_log2'
 d_logb='$d_logb'
+d_long_double_style_ieee='$d_long_double_style_ieee'
+d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
+d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
+d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
+d_long_double_style_vax='$d_long_double_style_vax'
 d_longdbl='$d_longdbl'
 d_longlong='$d_longlong'
 d_lrint='$d_lrint'
@@ -24296,13 +24185,12 @@ d_madvise='$d_madvise'
 d_malloc_good_size='$d_malloc_good_size'
 d_malloc_size='$d_malloc_size'
 d_mblen='$d_mblen'
+d_mbrlen='$d_mbrlen'
+d_mbrtowc='$d_mbrtowc'
 d_mbstowcs='$d_mbstowcs'
 d_mbtowc='$d_mbtowc'
-d_memchr='$d_memchr'
-d_memcmp='$d_memcmp'
-d_memcpy='$d_memcpy'
-d_memmove='$d_memmove'
-d_memset='$d_memset'
+d_memmem='$d_memmem'
+d_memrchr='$d_memrchr'
 d_mkdir='$d_mkdir'
 d_mkdtemp='$d_mkdtemp'
 d_mkfifo='$d_mkfifo'
@@ -24312,7 +24200,6 @@ d_mktime64='$d_mktime64'
 d_mktime='$d_mktime'
 d_mmap='$d_mmap'
 d_modfl='$d_modfl'
-d_modfl_pow32_bug='$d_modfl_pow32_bug'
 d_modflproto='$d_modflproto'
 d_mprotect='$d_mprotect'
 d_msg='$d_msg'
@@ -24330,9 +24217,11 @@ d_msync='$d_msync'
 d_munmap='$d_munmap'
 d_mymalloc='$d_mymalloc'
 d_nan='$d_nan'
+d_nanosleep='$d_nanosleep'
 d_ndbm='$d_ndbm'
 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
 d_nearbyint='$d_nearbyint'
+d_newlocale='$d_newlocale'
 d_nextafter='$d_nextafter'
 d_nexttoward='$d_nexttoward'
 d_nice='$d_nice'
@@ -24344,6 +24233,7 @@ d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
 d_oldpthreads='$d_oldpthreads'
 d_oldsock='$d_oldsock'
 d_open3='$d_open3'
+d_openat='$d_openat'
 d_pathconf='$d_pathconf'
 d_pause='$d_pause'
 d_perl_otherlibdirs='$d_perl_otherlibdirs'
@@ -24370,6 +24260,7 @@ d_pwpasswd='$d_pwpasswd'
 d_pwquota='$d_pwquota'
 d_qgcvt='$d_qgcvt'
 d_quad='$d_quad'
+d_querylocale='$d_querylocale'
 d_random_r='$d_random_r'
 d_re_comp='$d_re_comp'
 d_readdir64_r='$d_readdir64_r'
@@ -24383,13 +24274,11 @@ d_regcomp='$d_regcomp'
 d_remainder='$d_remainder'
 d_remquo='$d_remquo'
 d_rename='$d_rename'
+d_renameat='$d_renameat'
 d_rewinddir='$d_rewinddir'
 d_rint='$d_rint'
 d_rmdir='$d_rmdir'
 d_round='$d_round'
-d_safebcpy='$d_safebcpy'
-d_safemcpy='$d_safemcpy'
-d_sanemcmp='$d_sanemcmp'
 d_sbrkproto='$d_sbrkproto'
 d_scalbn='$d_scalbn'
 d_scalbnl='$d_scalbnl'
@@ -24443,12 +24332,19 @@ d_shmctl='$d_shmctl'
 d_shmdt='$d_shmdt'
 d_shmget='$d_shmget'
 d_sigaction='$d_sigaction'
+d_siginfo_si_addr='$d_siginfo_si_addr'
+d_siginfo_si_band='$d_siginfo_si_band'
+d_siginfo_si_errno='$d_siginfo_si_errno'
+d_siginfo_si_fd='$d_siginfo_si_fd'
+d_siginfo_si_pid='$d_siginfo_si_pid'
+d_siginfo_si_status='$d_siginfo_si_status'
+d_siginfo_si_uid='$d_siginfo_si_uid'
+d_siginfo_si_value='$d_siginfo_si_value'
 d_signbit='$d_signbit'
 d_sigprocmask='$d_sigprocmask'
 d_sigsetjmp='$d_sigsetjmp'
 d_sin6_scope_id='$d_sin6_scope_id'
 d_sitearch='$d_sitearch'
-d_snprintf='$d_snprintf'
 d_sockaddr_in6='$d_sockaddr_in6'
 d_sockaddr_sa_len='$d_sockaddr_sa_len'
 d_sockatmark='$d_sockatmark'
@@ -24457,7 +24353,6 @@ d_socket='$d_socket'
 d_socklen_t='$d_socklen_t'
 d_sockpair='$d_sockpair'
 d_socks5_init='$d_socks5_init'
-d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
 d_sqrtl='$d_sqrtl'
 d_srand48_r='$d_srand48_r'
 d_srandom_r='$d_srandom_r'
@@ -24476,18 +24371,19 @@ d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
 d_stdio_stream_array='$d_stdio_stream_array'
 d_stdiobase='$d_stdiobase'
 d_stdstdio='$d_stdstdio'
-d_strchr='$d_strchr'
 d_strcoll='$d_strcoll'
-d_strctcpy='$d_strctcpy'
 d_strerrm='$d_strerrm'
 d_strerror='$d_strerror'
+d_strerror_l='$d_strerror_l'
 d_strerror_r='$d_strerror_r'
 d_strftime='$d_strftime'
 d_strlcat='$d_strlcat'
 d_strlcpy='$d_strlcpy'
+d_strnlen='$d_strnlen'
 d_strtod='$d_strtod'
 d_strtol='$d_strtol'
 d_strtold='$d_strtold'
+d_strtold_l='$d_strtold_l'
 d_strtoll='$d_strtoll'
 d_strtoq='$d_strtoq'
 d_strtoul='$d_strtoul'
@@ -24507,6 +24403,7 @@ d_tcsetpgrp='$d_tcsetpgrp'
 d_telldir='$d_telldir'
 d_telldirproto='$d_telldirproto'
 d_tgamma='$d_tgamma'
+d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
 d_time='$d_time'
 d_timegm='$d_timegm'
 d_times='$d_times'
@@ -24523,8 +24420,10 @@ d_ualarm='$d_ualarm'
 d_umask='$d_umask'
 d_uname='$d_uname'
 d_union_semun='$d_union_semun'
+d_unlinkat='$d_unlinkat'
 d_unordered='$d_unordered'
 d_unsetenv='$d_unsetenv'
+d_uselocale='$d_uselocale'
 d_usleep='$d_usleep'
 d_usleepproto='$d_usleepproto'
 d_ustat='$d_ustat'
@@ -24536,9 +24435,6 @@ d_vfork='$d_vfork'
 d_void_closedir='$d_void_closedir'
 d_voidsig='$d_voidsig'
 d_voidtty='$d_voidtty'
-d_volatile='$d_volatile'
-d_vprintf='$d_vprintf'
-d_vsnprintf='$d_vsnprintf'
 d_wait4='$d_wait4'
 d_waitpid='$d_waitpid'
 d_wcscmp='$d_wcscmp'
@@ -24553,6 +24449,7 @@ db_prefixtype='$db_prefixtype'
 db_version_major='$db_version_major'
 db_version_minor='$db_version_minor'
 db_version_patch='$db_version_patch'
+default_inc_excludes_dot='$default_inc_excludes_dot'
 direntrytype='$direntrytype'
 dlext='$dlext'
 dlsrc='$dlsrc'
@@ -24564,6 +24461,8 @@ doublesize='$doublesize'
 drand01='$drand01'
 drand48_r_proto='$drand48_r_proto'
 dtrace='$dtrace'
+dtraceobject='$dtraceobject'
+dtracexnolibs='$dtracexnolibs'
 dynamic_ext='$dynamic_ext'
 eagain='$eagain'
 ebcdic='$ebcdic'
@@ -24693,9 +24592,7 @@ i_rpcsvcdbm='$i_rpcsvcdbm'
 i_sgtty='$i_sgtty'
 i_shadow='$i_shadow'
 i_socks='$i_socks'
-i_stdarg='$i_stdarg'
 i_stdbool='$i_stdbool'
-i_stddef='$i_stddef'
 i_stdint='$i_stdint'
 i_stdlib='$i_stdlib'
 i_string='$i_string'
@@ -24736,9 +24633,9 @@ i_unistd='$i_unistd'
 i_ustat='$i_ustat'
 i_utime='$i_utime'
 i_values='$i_values'
-i_varargs='$i_varargs'
-i_varhdr='$i_varhdr'
 i_vfork='$i_vfork'
+i_wchar='$i_wchar'
+i_xlocale='$i_xlocale'
 ignore_versioned_solibs='$ignore_versioned_solibs'
 inc_version_list='$inc_version_list'
 inc_version_list_init='$inc_version_list_init'
@@ -24897,7 +24794,6 @@ prefixexp='$prefixexp'
 privlib='$privlib'
 privlibexp='$privlibexp'
 procselfexe='$procselfexe'
-prototype='$prototype'
 ptrsize='$ptrsize'
 quadkind='$quadkind'
 quadtype='$quadtype'
@@ -25089,7 +24985,6 @@ uvsize='$uvsize'
 uvtype='$uvtype'
 uvuformat='$uvuformat'
 uvxformat='$uvxformat'
-vaproto='$vaproto'
 vendorarch='$vendorarch'
 vendorarchexp='$vendorarchexp'
 vendorbin='$vendorbin'
@@ -25157,8 +25052,7 @@ Id='$Id'
 : Finish up by extracting the .SH files
 case "$alldone" in
 exit)
-       $rm -rf UU
-       echo "Extraction done."
+       echo "Stopping at your request, leaving temporary files around."
        exit 0
        ;;
 cont)
@@ -25233,11 +25127,10 @@ the policy defaults.
 
 EOM
 fi
-if $test -f config.msg; then
+if $test -f UU/config.msg; then
     echo "Hmm.  I also noted the following information while running:"
     echo " "
-    $cat config.msg >&4
-    $rm -f config.msg
+    $cat UU/config.msg >&4
 fi
 $rm -f kit*isdone ark*isdone
 $rm -rf UU