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 84a34bf..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=''
@@ -498,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=''
@@ -626,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=''
@@ -655,14 +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_memmem=''
-d_memmove=''
-d_memset=''
+d_memrchr=''
 d_mkdir=''
 d_mkdtemp=''
 d_mkfifo=''
@@ -683,6 +683,7 @@ d_msgsnd=''
 d_msync=''
 d_munmap=''
 d_nan=''
+d_nanosleep=''
 d_nearbyint=''
 d_duplocale=''
 d_freelocale=''
@@ -694,6 +695,7 @@ d_nextafter=''
 d_nexttoward=''
 d_nice=''
 d_nl_langinfo=''
+d_thread_safe_nl_langinfo_l=''
 d_off64_t=''
 d_open3=''
 d_fpathconf=''
@@ -737,9 +739,6 @@ d_rename=''
 d_rint=''
 d_rmdir=''
 d_round=''
-d_safebcpy=''
-d_safemcpy=''
-d_sanemcmp=''
 d_sbrkproto=''
 d_scalbn=''
 d_scalbnl=''
@@ -809,8 +808,6 @@ d_signbit=''
 d_sigprocmask=''
 d_sigsetjmp=''
 usesitecustomize=''
-d_snprintf=''
-d_vsnprintf=''
 d_sockatmark=''
 d_sockatmarkproto=''
 d_ip_mreq=''
@@ -833,7 +830,6 @@ sockethdr=''
 socketlib=''
 d_socklen_t=''
 d_socks5_init=''
-d_sprintf_returns_strlen=''
 d_sqrtl=''
 d_srand48_r=''
 srand48_r_proto=''
@@ -860,10 +856,7 @@ stdio_bufsiz=''
 stdio_cnt=''
 stdio_filbuf=''
 stdio_ptr=''
-d_index=''
-d_strchr=''
 d_strcoll=''
-d_strctcpy=''
 d_strerrm=''
 d_strerror=''
 d_sysernlst=''
@@ -874,9 +867,11 @@ 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=''
@@ -927,9 +922,6 @@ d_vfork=''
 usevfork=''
 d_voidsig=''
 signal_t=''
-d_volatile=''
-d_charvspr=''
-d_vprintf=''
 d_wait4=''
 d_waitpid=''
 d_wcscmp=''
@@ -949,6 +941,7 @@ lddlflags=''
 usedl=''
 doublesize=''
 dtraceobject=''
+dtracexnolibs=''
 ebcdic=''
 fflushNULL=''
 fflushall=''
@@ -1035,7 +1028,6 @@ i_quadmath=''
 i_shadow=''
 i_socks=''
 i_stdbool=''
-i_stddef=''
 i_stdint=''
 i_stdlib=''
 i_string=''
@@ -1082,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=''
@@ -1245,7 +1235,6 @@ prefixexp=''
 installprivlib=''
 privlib=''
 privlibexp=''
-prototype=''
 ptrsize=''
 d_PRIXU64=''
 d_PRId64=''
@@ -1367,7 +1356,6 @@ usethreads=''
 incpath=''
 mips_type=''
 usrinc=''
-vaproto=''
 d_vendorarch=''
 installvendorarch=''
 vendorarch=''
@@ -2895,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
@@ -5799,6 +5786,107 @@ 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
@@ -5911,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
@@ -8109,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'
@@ -10803,7 +10743,6 @@ $startsh
 cc="$cc"
 optimize="$optimize"
 ccflags="$ccflags"
-prototype="$prototype"
 define="$define"
 rm_try="$rm_try"
 usethreads=$usethreads
@@ -10831,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
@@ -10896,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
@@ -10942,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 " "
@@ -10960,7 +10892,6 @@ EOCP
        done
        done
        done
-       done
        timeincl=''
        echo " "
        case "$flags" in
@@ -10970,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;;
@@ -11355,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
@@ -11495,27 +11412,138 @@ set d_bsdsetpgrp
 eval $setvar
 $rm_try
 
-: Look for GCC-style __builtin_choose_expr
-case "$d_builtin_choose_expr" in
+: Look for GCC-style __builtin_add_overflow
+case "$d_builtin_add_overflow" in
 '')
     echo " "
-    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
+    echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
     $cat >try.c <<'EOCP'
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
-
 int main(void) {
-    assert( SYRINX(1) == 2112 );
-    assert( SYRINX(1) != 5150 );
-    assert( SYRINX(0) == 5150 );
-    assert( SYRINX(0) != 2112 );
-    puts( "All good!" );
-    exit(0);
+    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
+'')
+    echo " "
+    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
+    $cat >try.c <<'EOCP'
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
+
+int main(void) {
+    assert( SYRINX(1) == 2112 );
+    assert( SYRINX(1) != 5150 );
+    assert( SYRINX(0) == 5150 );
+    assert( SYRINX(0) != 2112 );
+    puts( "All good!" );
+    exit(0);
+}
+
 EOCP
     set try
     if eval $compile && $run ./try; then
@@ -11562,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>
 
@@ -11692,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 " "
@@ -11927,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
@@ -13978,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
@@ -15923,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
@@ -16290,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
@@ -16466,36 +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 memmem exists
 set memmem d_memmem
 eval $inlibc
 
-: see if memmove exists
-set memmove d_memmove
-eval $inlibc
-
-: see if memset exists
-set memset d_memset
+: see if memrchr exists
+set memrchr d_memrchr
 eval $inlibc
 
 : see if mkdir exists
@@ -16691,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
@@ -16719,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
@@ -16943,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
@@ -16956,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() {
@@ -17007,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>
 
@@ -17022,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
@@ -17109,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;
 
@@ -17124,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++);
@@ -17708,266 +17478,36 @@ elif set re_comp val -f d_re_comp; eval $csym; $val; then
        d_regcmp="$undef"
 else
        $cat >&4 <<EOM
-No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
-EOM
-       d_regcmp="$undef"
-       d_re_comp="$undef"
-       d_regcomp="$undef"
-fi
-
-: see if remainder exists
-set remainder d_remainder
-eval $inlibc
-
-: see if remquo exists
-set remquo d_remquo
-eval $inlibc
-
-: see if rename exists
-set rename d_rename
-eval $inlibc
-
-: see if rint exists
-set rint d_rint
-eval $inlibc
-
-: see if rmdir exists
-set rmdir d_rmdir
-eval $inlibc
-
-: see if round exists
-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
+No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
+EOM
+       d_regcmp="$undef"
+       d_re_comp="$undef"
+       d_regcomp="$undef"
+fi
+
+: see if remainder exists
+set remainder d_remainder
+eval $inlibc
+
+: see if remquo exists
+set remquo d_remquo
+eval $inlibc
+
+: see if rename exists
+set rename d_rename
+eval $inlibc
+
+: see if rint exists
+set rint d_rint
+eval $inlibc
+
+: see if rmdir exists
+set rmdir d_rmdir
+eval $inlibc
+
+: see if round exists
+set round d_round
+eval $inlibc
 
 : see if prototype for sbrk is available
 echo " "
@@ -18939,71 +18479,6 @@ 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
@@ -19017,69 +18492,6 @@ eval $hasproto
 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
-$rm_try
-
 : see if srand48_r exists
 set srand48_r d_srand48_r
 eval $inlibc
@@ -19369,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
@@ -19497,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
@@ -19509,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
@@ -19806,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
@@ -20636,16 +20119,22 @@ a shared directory. This can lead to executing unexpected code.
 
 EOM
 
+# When changing to exclude by default:
 case "$default_inc_excludes_dot" in
-    $define|true|[yY]*) dflt="n" ;;
-    *)                  dflt='y' ;;
+    $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='Provide '.' in @INC by default? '
+rp='Exclude '.' from @INC by default? '
 . ./myread
 case "$ans" in
-    [nN]*|define) default_inc_excludes_dot="$define" ;;
-    *)            default_inc_excludes_dot="$undef"  ;;
+    [nN]|undef) default_inc_excludes_dot="$undef"  ;;
+    *)          default_inc_excludes_dot="$define" ;;
 esac
 
 : Check what kind of inf/nan your system has
@@ -20655,13 +20144,17 @@ $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
@@ -20678,7 +20171,8 @@ $cat >try.c <<EOP
  * 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");
@@ -20693,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
@@ -20961,12 +20454,38 @@ randseedtype=U32
 : 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
         ;;
     ' '|'')
-        $dtrace -h -s ../perldtrace.d -o perldtrace.h
         $cat >try.c <<EOM
 #include "perldtrace.h"
 int main(void) {
@@ -20976,14 +20495,14 @@ int main(void) {
 EOM
         dtraceobject=$undef
         if $cc -c -o try.o $optimize $ccflags try.c \
-                    && $dtrace -G -s ../perldtrace.d try.o >/dev/null 2>&1; then
+                    && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
                 dtraceobject=$define
             echo "Your dtrace builds an object file"
         fi
-        $rm -f try.c try.o perldtrace.o
         ;;
     *) dtraceobject=$undef ;;
     esac
+    $rm_try perldtrace.o perldtrace.h
 esac
 
 : Determine if this is an EBCDIC system
@@ -21744,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
@@ -21784,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?"
@@ -23023,7 +22532,7 @@ main(int argc, char **argv) {
        return 4;
     }
 
-    buffer = malloc(size);
+    buffer = (char *)malloc(size);
     if (!buffer) {
        perror("malloc");
        return 5;
@@ -23122,7 +22631,7 @@ main(int argc, char **argv) {
        return 2;
     }
 
-    buffer = malloc(size);
+    buffer = (char *)malloc(size);
     if (!buffer) {
        perror("malloc");
        return 3;
@@ -23197,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
 '')
@@ -23306,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
@@ -23575,7 +23093,7 @@ fi
 
 : add -D_FORTIFY_SOURCE if feasible and not already there
 case "$gccversion" in
-[45].*)        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
@@ -23677,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
@@ -23785,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
@@ -24322,7 +23840,6 @@ _o='$_o'
 afs='$afs'
 afsroot='$afsroot'
 alignbytes='$alignbytes'
-ansi2knr='$ansi2knr'
 aphostname='$aphostname'
 api_revision='$api_revision'
 api_subversion='$api_subversion'
@@ -24419,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'
@@ -24497,6 +24013,7 @@ 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'
@@ -24607,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'
@@ -24638,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'
@@ -24667,14 +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_memmem='$d_memmem'
-d_memmove='$d_memmove'
-d_memset='$d_memset'
+d_memrchr='$d_memrchr'
 d_mkdir='$d_mkdir'
 d_mkdtemp='$d_mkdtemp'
 d_mkfifo='$d_mkfifo'
@@ -24701,6 +24217,7 @@ 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'
@@ -24716,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'
@@ -24756,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'
@@ -24829,7 +24345,6 @@ 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'
@@ -24838,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'
@@ -24857,9 +24371,7 @@ 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'
@@ -24867,9 +24379,11 @@ 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'
@@ -24889,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'
@@ -24905,6 +24420,7 @@ 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'
@@ -24919,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'
@@ -24949,6 +24462,7 @@ drand01='$drand01'
 drand48_r_proto='$drand48_r_proto'
 dtrace='$dtrace'
 dtraceobject='$dtraceobject'
+dtracexnolibs='$dtracexnolibs'
 dynamic_ext='$dynamic_ext'
 eagain='$eagain'
 ebcdic='$ebcdic'
@@ -25078,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'
@@ -25121,9 +24633,8 @@ 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'
@@ -25283,7 +24794,6 @@ prefixexp='$prefixexp'
 privlib='$privlib'
 privlibexp='$privlibexp'
 procselfexe='$procselfexe'
-prototype='$prototype'
 ptrsize='$ptrsize'
 quadkind='$quadkind'
 quadtype='$quadtype'
@@ -25475,7 +24985,6 @@ uvsize='$uvsize'
 uvtype='$uvtype'
 uvuformat='$uvuformat'
 uvxformat='$uvxformat'
-vaproto='$vaproto'
 vendorarch='$vendorarch'
 vendorarchexp='$vendorarchexp'
 vendorbin='$vendorbin'