This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Adapt Configure to GCC version 10
[perl5.git] / Configure
index a067a89..706c0b6 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)
@@ -232,6 +229,7 @@ extensions=''
 known_extensions=''
 nonxs_ext=''
 static_ext=''
+uselanginfo=''
 useopcode=''
 useposix=''
 extras=''
@@ -339,7 +337,6 @@ rm_try=''
 afs=''
 afsroot=''
 alignbytes=''
-ansi2knr=''
 archlib=''
 archlibexp=''
 d_archlib=''
@@ -375,6 +372,7 @@ cppminus=''
 cpprun=''
 cppstdin=''
 d__fwalk=''
+d_accept4=''
 d_access=''
 d_accessx=''
 d_acosh=''
@@ -394,11 +392,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=''
@@ -412,7 +410,6 @@ d_clearenv=''
 d_closedir=''
 d_void_closedir=''
 d_cmsghdr_s=''
-d_const=''
 d_copysign=''
 d_copysignl=''
 d_cplusplus=''
@@ -428,7 +425,6 @@ d_ctermid_r=''
 ctime_r_proto=''
 d_ctime_r=''
 d_cuserid=''
-d_dbl_dig=''
 d_dbminitproto=''
 d_difftime=''
 d_dir_dd_fd=''
@@ -443,6 +439,7 @@ d_drand48_r=''
 drand48_r_proto=''
 d_drand48proto=''
 d_dup2=''
+d_dup3=''
 d_eaccess=''
 d_endgrent=''
 d_endgrent_r=''
@@ -498,6 +495,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=''
@@ -506,6 +508,7 @@ d_ftello=''
 d_ftime=''
 d_gettimeod=''
 d_futimes=''
+d_gai_strerror=''
 d_Gconvert=''
 d_getaddrinfo=''
 d_getcwd=''
@@ -625,6 +628,7 @@ d_llrint=''
 d_llrintl=''
 d_llround=''
 d_llroundl=''
+d_localeconv_l=''
 d_localtime_r=''
 d_localtime_r_needs_tzset=''
 localtime_r_proto=''
@@ -634,6 +638,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,18 +657,18 @@ d_lstat=''
 d_madvise=''
 d_malloc_good_size=''
 d_malloc_size=''
+d_malloc_usable_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=''
+d_mkostemp=''
 d_mkstemp=''
 d_mkstemps=''
 d_mktime=''
@@ -677,6 +686,7 @@ d_msgsnd=''
 d_msync=''
 d_munmap=''
 d_nan=''
+d_nanosleep=''
 d_nearbyint=''
 d_duplocale=''
 d_freelocale=''
@@ -688,11 +698,13 @@ d_nextafter=''
 d_nexttoward=''
 d_nice=''
 d_nl_langinfo=''
+d_thread_safe_nl_langinfo_l=''
 d_off64_t=''
 d_open3=''
 d_fpathconf=''
 d_pathconf=''
 d_pause=''
+d_pipe2=''
 d_pipe=''
 d_poll=''
 d_portable=''
@@ -731,9 +743,6 @@ d_rename=''
 d_rint=''
 d_rmdir=''
 d_round=''
-d_safebcpy=''
-d_safemcpy=''
-d_sanemcmp=''
 d_sbrkproto=''
 d_scalbn=''
 d_scalbnl=''
@@ -754,7 +763,9 @@ d_sethostent_r=''
 sethostent_r_proto=''
 d_setitimer=''
 d_setlinebuf=''
+d_has_C_UTF8=''
 d_setlocale=''
+d_setlocale_accepts_any_locale_name=''
 d_setlocale_r=''
 setlocale_r_proto=''
 d_setnent=''
@@ -827,7 +838,6 @@ sockethdr=''
 socketlib=''
 d_socklen_t=''
 d_socks5_init=''
-d_sprintf_returns_strlen=''
 d_sqrtl=''
 d_srand48_r=''
 srand48_r_proto=''
@@ -854,22 +864,21 @@ 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_strtod_l=''
 d_strtol=''
 d_strtold=''
+d_strtold_l=''
 d_strtoll=''
 d_strtoq=''
 d_strtoul=''
@@ -898,6 +907,8 @@ clocktype=''
 d_times=''
 d_tmpnam_r=''
 tmpnam_r_proto=''
+d_towlower=''
+d_towupper=''
 d_trunc=''
 d_truncate=''
 d_truncl=''
@@ -920,9 +931,6 @@ d_vfork=''
 usevfork=''
 d_voidsig=''
 signal_t=''
-d_volatile=''
-d_charvspr=''
-d_vprintf=''
 d_wait4=''
 d_waitpid=''
 d_wcscmp=''
@@ -930,6 +938,7 @@ d_wcstombs=''
 d_wcsxfrm=''
 d_wctomb=''
 d_writev=''
+default_inc_excludes_dot=''
 dlext=''
 bin_ELF=''
 cccdlflags=''
@@ -941,6 +950,7 @@ lddlflags=''
 usedl=''
 doublesize=''
 dtraceobject=''
+dtracexnolibs=''
 ebcdic=''
 fflushNULL=''
 fflushall=''
@@ -963,7 +973,6 @@ html3dir=''
 html3direxp=''
 installhtml3dir=''
 i_arpainet=''
-i_assert=''
 i_bfd=''
 i_crypt=''
 db_hashtype=''
@@ -981,7 +990,6 @@ i_dlfcn=''
 i_execinfo=''
 i_fcntl=''
 i_fenv=''
-i_float=''
 i_fp=''
 i_fp_class=''
 i_gdbm=''
@@ -991,13 +999,10 @@ i_ieeefp=''
 i_inttypes=''
 i_langinfo=''
 i_libutil=''
-i_limits=''
 i_locale=''
 i_machcthr=''
 i_malloc=''
 i_mallocmalloc=''
-i_math=''
-i_memory=''
 i_mntent=''
 d_gdbm_ndbm_h_uses_prototypes=''
 d_gdbmndbm_h_uses_prototypes=''
@@ -1027,11 +1032,8 @@ i_quadmath=''
 i_shadow=''
 i_socks=''
 i_stdbool=''
-i_stddef=''
 i_stdint=''
 i_stdlib=''
-i_string=''
-strings=''
 i_sunmath=''
 i_sysaccess=''
 i_sysdir=''
@@ -1073,11 +1075,9 @@ timeincl=''
 i_unistd=''
 i_ustat=''
 i_utime=''
-i_values=''
-i_stdarg=''
-i_varargs=''
-i_varhdr=''
 i_vfork=''
+i_wchar=''
+i_wctype=''
 d_inc_version_list=''
 inc_version_list=''
 inc_version_list_init=''
@@ -1118,6 +1118,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=''
@@ -1229,7 +1237,6 @@ prefixexp=''
 installprivlib=''
 privlib=''
 privlibexp=''
-prototype=''
 ptrsize=''
 d_PRIXU64=''
 d_PRId64=''
@@ -1351,7 +1358,6 @@ usethreads=''
 incpath=''
 mips_type=''
 usrinc=''
-vaproto=''
 d_vendorarch=''
 installvendorarch=''
 vendorarch=''
@@ -1469,6 +1475,8 @@ perllibs=''
 useposix=true
 : set useopcode=false in your hint file to disable the Opcode extension.
 useopcode=true
+: set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
+uselanginfo=true
 archname64=''
 ccflags_uselargefiles=''
 ldflags_uselargefiles=''
@@ -2879,7 +2887,6 @@ case "$lns" in
 *)     echo "No symbolic links, so not testing for their testing..." >&4
        ;;
 esac
-echo " "
 
 : Make symlinks util
 case "$mksymlinks" in
@@ -3497,6 +3504,9 @@ EOM
                        ;;
                MiNT)   osname=mint
                        ;;
+               minix)  osname=minix
+                       osvers=`$uname -r`
+                       ;;
                netbsd*) osname=netbsd
                        osvers="$3"
                        ;;
@@ -3508,8 +3518,8 @@ EOM
                        ;;
                nonstop-ux) osname=nonstopux ;;
                openbsd) osname=openbsd
-                       osvers="$3"
-                       ;;
+                       osvers="$3"
+                       ;;
                os2)    osname=os2
                        osvers="$4"
                        ;;
@@ -4160,14 +4170,9 @@ EOSC
 
 : determine root of directory hierarchy where package will be installed.
 case "$prefix" in
-'')
-       dflt=`./loc . /usr/local /usr/local /local /opt /usr`
+'')    dflt=`./loc . /usr/local /usr/local /local /opt /usr`
        ;;
-*?/)
-       dflt=`echo "$prefix" | sed 's/.$//'`
-       ;;
-*)
-       dflt="$prefix"
+*)     dflt="$prefix"
        ;;
 esac
 $cat <<EOM
@@ -4186,16 +4191,25 @@ rp='Installation prefix to use?'
 . ./getfile
 oldprefix=''
 case "$prefix" in
-'') ;;
-*)
-       case "$ans" in
+'')    ;;
+*)     case "$ans" in
        "$prefix") ;;
        *) oldprefix="$prefix";;
        esac
        ;;
 esac
-prefix="$ans"
-prefixexp="$ansexp"
+
+case "$ans" in
+*?/)   prefix=`echo "$ans" | sed 's/.$//'`
+       ;;
+*)     prefix="$ans"
+esac
+
+case "$ansexp" in
+*?/)   prefixexp=`echo "$ansexp" | sed 's/.$//'`
+       ;;
+*)     prefixexp="$ansexp"
+esac
 
 : allow them to override the AFS root
 case "$afsroot" in
@@ -4687,7 +4701,7 @@ else
 fi
 $rm -f try try.*
 case "$gccversion" in
-1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
+1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
 esac
 case "$gccversion" in
 '') gccosandvers='' ;;
@@ -4727,7 +4741,7 @@ esac
 # gcc 3.* complain about adding -Idirectories that they already know about,
 # so we will take those off from locincpth.
 case "$gccversion" in
-3*)
+3.*)
     echo "main(){}">try.c
     for incdir in $locincpth; do
        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
@@ -5208,7 +5222,7 @@ EOM
 rp='Try to use long doubles if available?'
 . ./myread
 case "$ans" in
-y|Y)   val="$define"   ;;
+y|Y)   val="$define"   ;;
 *)      val="$undef"   ;;
 esac
 set uselongdouble
@@ -5240,6 +5254,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
@@ -5439,13 +5467,13 @@ fi
 case "$hint" in
 default|recommended)
        case "$gccversion" in
-       1*) dflt="$dflt -fpcc-struct-return" ;;
+       1.*) dflt="$dflt -fpcc-struct-return" ;;
        esac
        case "$optimize:$DEBUGGING" in
        *-g*:old) dflt="$dflt -DDEBUGGING";;
        esac
        case "$gccversion" in
-       2*) if $test -d /etc/conf/kconfig.d &&
+       2.*) if $test -d /etc/conf/kconfig.d &&
                        $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
                then
                        # Interactive Systems (ISC) POSIX mode.
@@ -5454,7 +5482,7 @@ default|recommended)
                ;;
        esac
        case "$gccversion" in
-       1*) ;;
+       1.*) ;;
        2.[0-8]*) ;;
        ?*)     set strict-aliasing -fno-strict-aliasing
                eval $checkccflag
@@ -5572,7 +5600,7 @@ case "$cppflags" in
     ;;
 esac
 case "$gccversion" in
-1*) cppflags="$cppflags -D__GNUC__"
+1.*) cppflags="$cppflags -D__GNUC__"
 esac
 case "$mips_type" in
 '');;
@@ -5767,7 +5795,108 @@ $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null
 compile_ok='
 mc_file=$1;
 shift;
-$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
+$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
+
+: 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 " "
@@ -5881,108 +6010,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
@@ -6878,10 +6905,6 @@ EOCP
 esac
 $rm_try
 
-: see if this is a float.h system
-set float.h i_float
-eval $inhdr
-
 : check for long doubles
 echo " "
 echo "Checking to see if you have long double..." >&4
@@ -6940,13 +6963,10 @@ $echo "Checking the kind of long doubles you have..." >&4
 case "$d_longdbl" in
 define)
 $cat <<EOP >try.c
-#$i_float I_FLOAT
 #$i_stdlib I_STDLIB
 #define LONGDBLSIZE $longdblsize
 #define DOUBLESIZE $doublesize
-#ifdef I_FLOAT
 #include <float.h>
-#endif
 #ifdef I_STDLIB
 #include <stdlib.h>
 #endif
@@ -7029,6 +7049,16 @@ int main() {
     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);
 }
@@ -7050,10 +7080,31 @@ case "$longdblkind" in
 4) echo "You have x86 80-bit big endian 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 double-double long doubles (64-bit LEs in BE)." >& 4 ;;
-8) echo "You have 128-bit mixed double-double long doubles (64-bit BEs in LE)." >& 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
+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
@@ -7186,7 +7237,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
@@ -7210,7 +7261,7 @@ prefixit='case "$3" in
                none)
                        eval "tp=\"\$$2\"";
                        case "$tp" in
-                       ""|" ") eval "$1=\"\$$2\"";;
+                       ""|" "|none) eval "$1=\"\$$2\"";;
                        *) eval "$1=";;
                        esac;;
                esac;;
@@ -7759,7 +7810,6 @@ EOM
        ;;
 esac
 
-
 : determine whether to use malloc wrapping
 echo " "
 case "$usemallocwrap" in
@@ -8048,52 +8098,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'
@@ -8111,6 +8115,10 @@ while $test 1 ; do
        $define|true|[yY]*)
                dflt='y'
                ;;
+       $undef|false|[nN]*)
+               dflt='n'
+               dflt_dtrace=""
+               ;;
        ?*)
                dflt='y'
                dflt_dtrace=$usedtrace
@@ -8547,7 +8555,7 @@ EOM
        if $test "X$sysroot" != X; then
            case "$gccversion" in
                '') ;;
-               *)  dflt="$dflt --sysroot $sysroot" ;;
+               *)  dflt="$dflt --sysroot=$sysroot" ;;
            esac
        fi
 
@@ -8811,7 +8819,7 @@ if "$useshrplib"; then
        solaris)
                xxx="-R $shrpdir"
                ;;
-       freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
+       freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
                xxx="-Wl,-R$shrpdir"
                ;;
        bsdos|linux|irix*|dec_osf|gnu*|haiku)
@@ -8969,8 +8977,8 @@ if (echo hi >$first) 2>/dev/null; then
                echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
                val="$undef"
        else
-               echo 'You can have filenames longer than 14 characters.'>&4
-               val="$define"
+               echo 'You can have filenames longer than 14 characters.'>&4
+               val="$define"
        fi
 else
        $cat <<'EOM'
@@ -9215,7 +9223,7 @@ case "$myhostname" in
                        $test -s hosts
                } || {
                        test "X$hostcat" != "X" &&
-                       $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
+                       $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
                                        /[       ]$myhostname[  . ]/p" > hosts
                }
                tmp_re="[       . ]"
@@ -9248,7 +9256,7 @@ case "$myhostname" in
                                .) dflt=.`$sed -n -e 's/        / /g' \
                                     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
                                     -e 1q 2>/dev/null`
-                                       ;;
+                                       ;;
                                esac
                        fi
                        ;;
@@ -9380,17 +9388,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";;
@@ -9654,7 +9665,6 @@ esac
 set usefaststdio
 eval $setvar
 
-
 : define an is-a-typedef? function
 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
 case "$inclist" in
@@ -9817,8 +9827,8 @@ EOM
    rp='Try to understand large files, if available?'
    . ./myread
    case "$ans" in
-   y|Y)        val="$define" ;;
-   *)          val="$undef"  ;;
+   y|Y)        val="$define" ;;
+   *)  val="$undef"  ;;
    esac
    ;;
 esac
@@ -10059,46 +10069,6 @@ esac
 prefixvar=vendorscript
 . ./installprefix
 
-: script used to emit important warnings
-cat >warn <<EOS
-$startsh
-if test \$# -gt 0; then
-       echo "\$@" >msg
-else
-       cat >msg
-fi
-echo "*** WARNING:" >&4
-sed -e 's/^/*** /' <msg >&4
-echo "*** " >&4
-cat msg >>config.msg
-echo " " >>config.msg
-rm -f msg
-EOS
-chmod +x warn
-$eunicefix warn
-
-: see which of string.h or strings.h is needed
-echo " "
-strings=`./findhdr string.h`
-if $test "$strings" && $test -r "$strings"; then
-       echo "Using <string.h> instead of <strings.h>." >&4
-       val="$define"
-else
-       val="$undef"
-       strings=`./findhdr strings.h`
-       if $test "$strings" && $test -r "$strings"; then
-               echo "Using <strings.h> instead of <string.h>." >&4
-       else
-               ./warn "No string header found -- You'll surely have problems."
-       fi
-fi
-set i_string
-eval $setvar
-case "$i_string" in
-"$undef") strings=`./findhdr strings.h`;;
-*)       strings=`./findhdr string.h`;;
-esac
-
 : see if qgcvt exists
 set qgcvt d_qgcvt
 eval $inlibc
@@ -10126,6 +10096,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) {
@@ -10152,6 +10132,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) {
@@ -10165,7 +10165,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);
@@ -10186,7 +10186,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
 
@@ -10357,15 +10387,15 @@ esac
 $cat >>try.c <<EOP
 #ifdef TRY_gconvert
 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
-char *myname = "gconvert";
+const char *myname = "gconvert";
 #endif
 #ifdef TRY_gcvt
 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
-char *myname = "gcvt";
+const char *myname = "gcvt";
 #endif
 #ifdef TRY_qgcvt
 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
-char *myname = "qgcvt";
+const char *myname = "qgcvt";
 #define DOUBLETYPE long double
 #endif
 #ifdef TRY_sprintf
@@ -10378,7 +10408,7 @@ char *myname = "qgcvt";
 #else
 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
 #endif
-char *myname = "sprintf";
+const char *myname = "sprintf";
 #endif
 
 #ifndef DOUBLETYPE
@@ -10395,14 +10425,9 @@ char *myname = "sprintf";
 #ifdef I_STDLIB
 #include <stdlib.h>
 #endif
-#$i_string I_STRING
-#ifdef I_STRING
-#  include <string.h>
-#else
-#  include <strings.h>
-#endif
+#include <string.h>
 
-int checkit(char *expect, char *got)
+void checkit(const char *expect, char *got)
 {
     if (strcmp(expect, got)) {
                printf("%s oddity:  Expected %s, got %s\n",
@@ -10551,6 +10576,7 @@ for xxx_convert in $xxx_list; do
                fi
        else
                echo "$xxx_convert NOT found." >&4
+               xxx_convert=''
        fi
 done
 
@@ -10581,6 +10607,10 @@ $rm_try
 set fwalk d__fwalk
 eval $inlibc
 
+: see if accept4 exists
+set accept4 d_accept4
+eval $inlibc
+
 : Initialize h_fcntl
 h_fcntl=false
 
@@ -10679,7 +10709,6 @@ $startsh
 cc="$cc"
 optimize="$optimize"
 ccflags="$ccflags"
-prototype="$prototype"
 define="$define"
 rm_try="$rm_try"
 usethreads=$usethreads
@@ -10707,13 +10736,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
@@ -10730,6 +10754,7 @@ hasproto='varname=$1; func=$2; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
        $define) echo "#include <$2>";;
+       literal) echo "$2" ;;
        esac ;
     shift 2;
 done > try.c;
@@ -10772,16 +10797,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
@@ -10818,13 +10842,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 " "
@@ -10836,7 +10859,6 @@ EOCP
        done
        done
        done
-       done
        timeincl=''
        echo " "
        case "$flags" in
@@ -10846,12 +10868,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;;
@@ -10926,7 +10942,7 @@ case "$d_asctime_r" in
        esac
        case "$asctime_r_proto" in
        ''|0)   d_asctime_r=undef
-               asctime_r_proto=0
+               asctime_r_proto=0
                echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
        * )     case "$asctime_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -11003,8 +11019,15 @@ $cat >attrib.c <<EOCP
 #ifdef I_STDLIB
 #include <stdlib.h>
 #endif
+#$i_inttypes I_INTTYPES
+#ifdef I_INTTYPES
+#include <inttypes.h>
+#endif
+#ifndef INTPTR_MAX
+#define intptr_t int
+#endif
 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
-int null_printf (char* pat,...) { return (int)pat; }
+int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
 int main () { exit(null_printf(NULL)); }
 EOCP
        if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
@@ -11231,14 +11254,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
@@ -11371,6 +11386,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
 '')
@@ -11438,124 +11564,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>
 
@@ -11568,29 +11579,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 " "
@@ -11803,102 +11808,21 @@ $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
+: see if chown exists
+set chown d_chown
+eval $inlibc
 
-#ifdef I_STDARG
-#  include <stdarg.h>
-#else /* I_VARARGS */
-#  include <varargs.h>
-#endif
+: see if chroot exists
+set chroot d_chroot
+eval $inlibc
 
-#ifdef I_UNISTD
-#  include <unistd.h>
-#endif
+: see if chsize exists
+set chsize d_chsize
+eval $inlibc
 
-#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
-
-: see if chroot exists
-set chroot d_chroot
-eval $inlibc
-
-: see if chsize exists
-set chsize d_chsize
-eval $inlibc
-
-: see if class exists
-set class d_class
-eval $inlibc
+: see if class exists
+set class d_class
+eval $inlibc
 
 : see if clearenv exists
 set clearenv d_clearenv
@@ -12145,28 +12069,6 @@ case "$d_cmsghdr_s" in
 *)              echo "No, it doesn't." ;;
 esac
 
-
-: check for const keyword
-echo " "
-echo 'Checking to see if your C compiler knows about "const"...' >&4
-$cat >const.c <<'EOCP'
-typedef struct spug { int drokk; } spug;
-int main()
-{
-       const char *foo;
-       const spug y = { 0 };
-}
-EOCP
-if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
-       val="$define"
-       echo "Yup, it does."
-else
-       val="$undef"
-       echo "Nope, it doesn't."
-fi
-set d_const
-eval $setvar
-
 : see if copysign exists
 set copysign d_copysign
 eval $inlibc
@@ -12242,7 +12144,7 @@ case "$d_crypt_r" in
        esac
        case "$crypt_r_proto" in
        ''|0)   d_crypt_r=undef
-               crypt_r_proto=0
+               crypt_r_proto=0
                echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
        * )     case "$crypt_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -12299,7 +12201,7 @@ case "$d_ctermid_r" in
        esac
        case "$ctermid_r_proto" in
        ''|0)   d_ctermid_r=undef
-               ctermid_r_proto=0
+               ctermid_r_proto=0
                echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
        * )     case "$ctermid_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -12352,7 +12254,7 @@ case "$d_ctime_r" in
        esac
        case "$ctime_r_proto" in
        ''|0)   d_ctime_r=undef
-               ctime_r_proto=0
+               ctime_r_proto=0
                echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
        * )     case "$ctime_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -12377,37 +12279,6 @@ esac
 set cuserid d_cuserid
 eval $inlibc
 
-: see if this is a limits.h system
-set limits.h i_limits
-eval $inhdr
-
-: See if number of significant digits in a double precision number is known
-echo " "
-$cat >dbl_dig.c <<EOM
-#$i_limits I_LIMITS
-#$i_float I_FLOAT
-#ifdef I_LIMITS
-#include <limits.h>
-#endif
-#ifdef I_FLOAT
-#include <float.h>
-#endif
-#ifdef DBL_DIG
-printf("Contains DBL_DIG");
-#endif
-EOM
-$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
-if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
-       echo "DBL_DIG found." >&4
-       val="$define"
-else
-       echo "DBL_DIG NOT found." >&4
-       val="$undef"
-fi
-$rm -f dbl_dig.?
-set d_dbl_dig
-eval $setvar
-
 : see if dbm.h is available
 : see if dbmclose exists
 set dbmclose d_dbmclose
@@ -12580,14 +12451,10 @@ $cat >dirfd.c <<EOM
 #include <sys/ndir.h>
 #else
 #ifdef I_SYS_DIR
-#ifdef hp9000s500
-#include <ndir.h>      /* may be wrong in the future */
-#else
 #include <sys/dir.h>
 #endif
 #endif
 #endif
-#endif
 int main() {
        DIR *dirp = opendir(".");
        if (dirfd(dirp) >= 0)
@@ -12755,7 +12622,7 @@ case "$d_drand48_r" in
        esac
        case "$drand48_r_proto" in
        ''|0)   d_drand48_r=undef
-               drand48_r_proto=0
+               drand48_r_proto=0
                echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
        * )     case "$drand48_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -12785,6 +12652,34 @@ eval $hasproto
 set dup2 d_dup2
 eval $inlibc
 
+: see if dup3 exists
+set dup3 d_dup3
+eval $inlibc
+
+: 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 eaccess exists
 set eaccess d_eaccess
 eval $inlibc
@@ -12842,7 +12737,7 @@ case "$d_endgrent_r" in
        esac
        case "$endgrent_r_proto" in
        ''|0)   d_endgrent_r=undef
-               endgrent_r_proto=0
+               endgrent_r_proto=0
                echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
        * )     case "$endgrent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -12895,7 +12790,7 @@ case "$d_endhostent_r" in
        esac
        case "$endhostent_r_proto" in
        ''|0)   d_endhostent_r=undef
-               endhostent_r_proto=0
+               endhostent_r_proto=0
                echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
        * )     case "$endhostent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -12944,7 +12839,7 @@ case "$d_endnetent_r" in
        esac
        case "$endnetent_r_proto" in
        ''|0)   d_endnetent_r=undef
-               endnetent_r_proto=0
+               endnetent_r_proto=0
                echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
        * )     case "$endnetent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -12993,7 +12888,7 @@ case "$d_endprotoent_r" in
        esac
        case "$endprotoent_r_proto" in
        ''|0)   d_endprotoent_r=undef
-               endprotoent_r_proto=0
+               endprotoent_r_proto=0
                echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
        * )     case "$endprotoent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -13130,7 +13025,7 @@ case "$d_endpwent_r" in
        esac
        case "$endpwent_r_proto" in
        ''|0)   d_endpwent_r=undef
-               endpwent_r_proto=0
+               endpwent_r_proto=0
                echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
        * )     case "$endpwent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -13179,7 +13074,7 @@ case "$d_endservent_r" in
        esac
        case "$endservent_r_proto" in
        ''|0)   d_endservent_r=undef
-               endservent_r_proto=0
+               endservent_r_proto=0
                echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
        * )     case "$endservent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -13399,12 +13294,7 @@ extern int errno;
 #ifdef I_UNISTD
 #include <unistd.h>
 #endif
-#$i_string I_STRING
-#ifdef I_STRING
 #include <string.h>
-#else
-#include <strings.h>
-#endif
 $signal_t blech(int x) { exit(3); }
 EOCP
        $cat >> try.c <<'EOCP'
@@ -13770,7 +13660,7 @@ int main() {
 EOP
        set try
        if eval $compile && $to try.c; then
-               case `$run ./try` in
+               case `$run ./try` in
                Pass_changed)
                        echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
                        d_stdio_ptr_lval_sets_cnt="$define" ;;
@@ -13844,8 +13734,6 @@ esac
 set d_faststdio
 eval $setvar
 
-
-
 : see if fchdir exists
 set fchdir d_fchdir
 eval $inlibc
@@ -13854,6 +13742,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
@@ -14055,17 +13959,10 @@ eval $inlibc
 set fp_class d_fp_class
 eval $inlibc
 
-: see if this is a math.h system
-set math.h i_math
-eval $inhdr
-
 : check for fpclassify
 echo "Checking to see if you have fpclassify..." >&4
 $cat >try.c <<EOCP
-#$i_math I_MATH
-#ifdef I_MATH
 #include <math.h>
-#endif
 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
 EOCP
 set try
@@ -14130,30 +14027,6 @@ $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
@@ -14199,7 +14072,6 @@ eval $inlibc
 set fstatvfs d_fstatvfs
 eval $inlibc
 
-
 : see if fsync exists
 set fsync d_fsync
 eval $inlibc
@@ -14220,6 +14092,7 @@ $cat >try.c <<EOCP
 #include <sys/time.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <stdlib.h>
 
 int main ()
 {
@@ -14246,6 +14119,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
@@ -14360,7 +14261,7 @@ case "$d_getgrent_r" in
        esac
        case "$getgrent_r_proto" in
        ''|0)   d_getgrent_r=undef
-               getgrent_r_proto=0
+               getgrent_r_proto=0
                echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
        * )     case "$getgrent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -14413,7 +14314,7 @@ case "$d_getgrgid_r" in
        esac
        case "$getgrgid_r_proto" in
        ''|0)   d_getgrgid_r=undef
-               getgrgid_r_proto=0
+               getgrgid_r_proto=0
                echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
        * )     case "$getgrgid_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -14470,7 +14371,7 @@ case "$d_getgrnam_r" in
        esac
        case "$getgrnam_r_proto" in
        ''|0)   d_getgrnam_r=undef
-               getgrnam_r_proto=0
+               getgrnam_r_proto=0
                echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
        * )     case "$getgrnam_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -14648,7 +14549,7 @@ case "$d_gethostbyaddr_r" in
        esac
        case "$gethostbyaddr_r_proto" in
        ''|0)   d_gethostbyaddr_r=undef
-               gethostbyaddr_r_proto=0
+               gethostbyaddr_r_proto=0
                echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
        * )     case "$gethostbyaddr_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -14697,7 +14598,7 @@ case "$d_gethostbyname_r" in
        esac
        case "$gethostbyname_r_proto" in
        ''|0)   d_gethostbyname_r=undef
-               gethostbyname_r_proto=0
+               gethostbyname_r_proto=0
                echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
        * )     case "$gethostbyname_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -14758,7 +14659,7 @@ case "$d_gethostent_r" in
        esac
        case "$gethostent_r_proto" in
        ''|0)   d_gethostent_r=undef
-               gethostent_r_proto=0
+               gethostent_r_proto=0
                echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
        * )     case "$gethostent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -14824,7 +14725,7 @@ case "$d_getlogin_r" in
        esac
        case "$getlogin_r_proto" in
        ''|0)   d_getlogin_r=undef
-               getlogin_r_proto=0
+               getlogin_r_proto=0
                echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
        * )     case "$getlogin_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -14917,7 +14818,7 @@ case "$d_getnetbyaddr_r" in
        esac
        case "$getnetbyaddr_r_proto" in
        ''|0)   d_getnetbyaddr_r=undef
-               getnetbyaddr_r_proto=0
+               getnetbyaddr_r_proto=0
                echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
        * )     case "$getnetbyaddr_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -14970,7 +14871,7 @@ case "$d_getnetbyname_r" in
        esac
        case "$getnetbyname_r_proto" in
        ''|0)   d_getnetbyname_r=undef
-               getnetbyname_r_proto=0
+               getnetbyname_r_proto=0
                echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
        * )     case "$getnetbyname_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15031,7 +14932,7 @@ case "$d_getnetent_r" in
        esac
        case "$getnetent_r_proto" in
        ''|0)   d_getnetent_r=undef
-               getnetent_r_proto=0
+               getnetent_r_proto=0
                echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
        * )     case "$getnetent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15119,7 +15020,7 @@ case "$d_getprotobyname_r" in
        esac
        case "$getprotobyname_r_proto" in
        ''|0)   d_getprotobyname_r=undef
-               getprotobyname_r_proto=0
+               getprotobyname_r_proto=0
                echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
        * )     case "$getprotobyname_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15168,7 +15069,7 @@ case "$d_getprotobynumber_r" in
        esac
        case "$getprotobynumber_r_proto" in
        ''|0)   d_getprotobynumber_r=undef
-               getprotobynumber_r_proto=0
+               getprotobynumber_r_proto=0
                echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
        * )     case "$getprotobynumber_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15221,7 +15122,7 @@ case "$d_getprotoent_r" in
        esac
        case "$getprotoent_r_proto" in
        ''|0)   d_getprotoent_r=undef
-               getprotoent_r_proto=0
+               getprotoent_r_proto=0
                echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
        * )     case "$getprotoent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15295,7 +15196,7 @@ case "$d_getpwent_r" in
        esac
        case "$getpwent_r_proto" in
        ''|0)   d_getpwent_r=undef
-               getpwent_r_proto=0
+               getpwent_r_proto=0
                echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
        * )     case "$getpwent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15348,7 +15249,7 @@ case "$d_getpwnam_r" in
        esac
        case "$getpwnam_r_proto" in
        ''|0)   d_getpwnam_r=undef
-               getpwnam_r_proto=0
+               getpwnam_r_proto=0
                echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
        * )     case "$getpwnam_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15401,7 +15302,7 @@ case "$d_getpwuid_r" in
        esac
        case "$getpwuid_r_proto" in
        ''|0)   d_getpwuid_r=undef
-               getpwuid_r_proto=0
+               getpwuid_r_proto=0
                echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
        * )     case "$getpwuid_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15464,7 +15365,7 @@ case "$d_getservbyname_r" in
        esac
        case "$getservbyname_r_proto" in
        ''|0)   d_getservbyname_r=undef
-               getservbyname_r_proto=0
+               getservbyname_r_proto=0
                echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
        * )     case "$getservbyname_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15513,7 +15414,7 @@ case "$d_getservbyport_r" in
        esac
        case "$getservbyport_r_proto" in
        ''|0)   d_getservbyport_r=undef
-               getservbyport_r_proto=0
+               getservbyport_r_proto=0
                echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
        * )     case "$getservbyport_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15566,7 +15467,7 @@ case "$d_getservent_r" in
        esac
        case "$getservent_r_proto" in
        ''|0)   d_getservent_r=undef
-               getservent_r_proto=0
+               getservent_r_proto=0
                echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
        * )     case "$getservent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15624,7 +15525,7 @@ case "$d_getspnam_r" in
        esac
        case "$getspnam_r_proto" in
        ''|0)   d_getspnam_r=undef
-               getspnam_r_proto=0
+               getspnam_r_proto=0
                echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
        * )     case "$getspnam_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15688,7 +15589,7 @@ case "$d_gmtime_r" in
        esac
        case "$gmtime_r_proto" in
        ''|0)   d_gmtime_r=undef
-               gmtime_r_proto=0
+               gmtime_r_proto=0
                echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
        * )     case "$gmtime_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -15771,39 +15672,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
@@ -15872,10 +15740,7 @@ $rm -f isblank*
 : check for isfinite
 echo "Checking to see if you have isfinite..." >&4
 $cat >try.c <<EOCP
-#$i_math I_MATH
-#ifdef I_MATH
 #include <math.h>
-#endif
 int main() { return isfinite(0.0); }
 EOCP
 set try
@@ -15897,10 +15762,7 @@ eval $inlibc
 : check for isinf
 echo "Checking to see if you have isinf..." >&4
 $cat >try.c <<EOCP
-#$i_math I_MATH
-#ifdef I_MATH
 #include <math.h>
-#endif
 int main() { return isinf(0.0); }
 EOCP
 set try
@@ -15922,10 +15784,7 @@ eval $inlibc
 : check for isless
 echo "Checking to see if you have isless..." >&4
 $cat >try.c <<EOCP
-#$i_math I_MATH
-#ifdef I_MATH
 #include <math.h>
-#endif
 int main() { return isless(0.0); }
 EOCP
 set try
@@ -15943,10 +15802,7 @@ eval $setvar
 : check for isnan
 echo "Checking to see if you have isnan..." >&4
 $cat >try.c <<EOCP
-#$i_math I_MATH
-#ifdef I_MATH
 #include <math.h>
-#endif
 int main() { return isnan(0.0); }
 EOCP
 set try
@@ -15968,10 +15824,7 @@ eval $inlibc
 : check for isnormal
 echo "Checking to see if you have isnormal..." >&4
 $cat >try.c <<EOCP
-#$i_math I_MATH
-#ifdef I_MATH
 #include <math.h>
-#endif
 int main() { return isnormal(0.0); }
 EOCP
 set try
@@ -16058,14 +15911,8 @@ eval $setvar
 : See if number of significant digits in a double precision number is known
 echo " "
 $cat >ldbl_dig.c <<EOM
-#$i_limits I_LIMITS
-#$i_float I_FLOAT
-#ifdef I_LIMITS
 #include <limits.h>
-#endif
-#ifdef I_FLOAT
 #include <float.h>
-#endif
 #ifdef LDBL_DIG
 printf("Contains LDBL_DIG");
 #endif
@@ -16092,11 +15939,9 @@ eval $inlibc
 
 : check to see if math.h defines _LIB_VERSION
 d_libm_lib_version="$undef"
-case $i_math in
-    $define)
-       echo " "
-       echo "Checking to see if your libm supports _LIB_VERSION..." >&4
-       $cat >try.c <<EOCP
+echo " "
+echo "Checking to see if your libm supports _LIB_VERSION..." >&4
+$cat >try.c <<EOCP
 #include <unistd.h>
 #include <math.h>
 int main (int argc, char *argv[])
@@ -16105,18 +15950,15 @@ int main (int argc, char *argv[])
     return (0);
     } /* main */
 EOCP
-       set try
-       if eval $compile; then
-           foo=`$run ./try`
-           echo "Yes, it does ($foo)" >&4
-           d_libm_lib_version="$define"
-       else
-           echo "No, it does not (probably harmless)" >&4
-           fi
-       $rm_try
-       ;;
-
-    esac
+set try
+if eval $compile; then
+    foo=`$run ./try`
+    echo "Yes, it does ($foo)" >&4
+    d_libm_lib_version="$define"
+else
+    echo "No, it does not (probably harmless)" >&4
+    fi
+$rm_try
 
 : see if link exists
 set link d_link
@@ -16138,6 +15980,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
@@ -16162,7 +16008,7 @@ case "$d_localtime_r" in
        esac
        case "$localtime_r_proto" in
        ''|0)   d_localtime_r=undef
-               localtime_r_proto=0
+               localtime_r_proto=0
                echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
        * )     case "$localtime_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -16194,7 +16040,6 @@ REENTRANT_PROTO*)
 #$i_unistd     I_UNISTD
 #$i_time       I_TIME
 #$i_stdlib     I_STDLIB
-#$i_string     I_STRING
 #$i_malloc     I_MALLOC
 #ifdef I_SYS_TYPES
 #  include <sys/types.h>
@@ -16208,11 +16053,7 @@ REENTRANT_PROTO*)
 #ifdef I_STDLIB
 #include <stdlib.h>
 #endif
-#ifdef I_STRING
-#  include <string.h>
-#else
-#  include <strings.h>
-#endif
+#include <string.h>
 #ifdef I_MALLOC
 #  include <malloc.h>
 #endif
@@ -16310,41 +16151,71 @@ eval $inlibc
 set malloc_good_size d_malloc_good_size
 eval $inlibc
 
-: see if mblen exists
-set mblen d_mblen
+: see if malloc_usable_size exists
+set malloc_usable_size d_malloc_usable_size
 eval $inlibc
 
-: see if mbstowcs exists
-set mbstowcs d_mbstowcs
+: see if mblen exists
+set mblen d_mblen
 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
+: We need both a prototype in string.h and the symbol in libc.
+echo " "
+d_memmem_proto=''
+xx1="#$d_gnulibc HAS_GNULIBC"
+xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
+xx3='#   define _GNU_SOURCE'
+xx4='#endif'
+set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
+eval $hasproto
+case "$d_memmem_proto" in
+    define) # see if memmem exists
+       set memmem d_memmem
+       eval $inlibc
+       ;;
+    *)  val=$undef
+       set d_memmem
+       eval $setvar
+       ;;
+esac
 
-: see if memset exists
-set memset d_memset
-eval $inlibc
+: see if memrchr exists
+: We need both a prototype in string.h and the symbol in libc.
+echo " "
+d_memrchr_proto=''
+xx1="#$d_gnulibc HAS_GNULIBC"
+xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
+xx3='#   define _GNU_SOURCE'
+xx4='#endif'
+set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
+eval $hasproto
+case "$d_memrchr_proto" in
+    define) # see if memrchr exists
+       set memrchr d_memrchr
+       eval $inlibc
+       ;;
+    *)  val=$undef
+       set d_memrchr
+       eval $setvar
+       ;;
+esac
 
 : see if mkdir exists
 set mkdir d_mkdir
@@ -16358,6 +16229,10 @@ eval $inlibc
 set mkfifo d_mkfifo
 eval $inlibc
 
+: see if mkostemp exists
+set mkostemp d_mkostemp
+eval $inlibc
+
 : see if mkstemp exists
 set mkstemp d_mkstemp
 eval $inlibc
@@ -16370,7 +16245,7 @@ eval $inlibc
 set mktime d_mktime
 eval $inlibc
 
-: see if this is a sys/mman.h system
+: see if sys/mman.h has to be included
 set sys/mman.h i_sysmman
 eval $inhdr
 
@@ -16395,8 +16270,6 @@ END
        ;;
 esac
 
-
-
 : see if sqrtl exists
 set sqrtl d_sqrtl
 eval $inlibc
@@ -16415,7 +16288,7 @@ eval $inlibc
 
 : see if prototype for modfl is available
 echo " "
-set d_modflproto modfl $i_math math.h
+set d_modflproto modfl define math.h
 eval $hasproto
 
 if $test "$uselongdouble" = "$define"; then
@@ -16526,7 +16399,6 @@ case "$d_msghdr_s" in
 *)              echo "No, it doesn't." ;;
 esac
 
-
 : see if msync exists
 set msync d_msync
 eval $inlibc
@@ -16539,6 +16411,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
@@ -16567,37 +16443,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
@@ -16791,10 +16636,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
@@ -16804,7 +16645,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() {
@@ -16855,10 +16697,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>
 
@@ -16870,10 +16708,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
 #ifdef I_STDLIB
 #include <stdlib.h>
 #endif
-#$i_string I_STRING
-#ifdef I_STRING
-#  include <string.h>
-#else
-#  include <strings.h>
-#endif
+#include <string.h>
 #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;
 
@@ -16972,7 +16804,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++);
 set pause d_pause
 eval $inlibc
 
+: see if pipe2 exists
+set pipe2 d_pipe2
+eval $inlibc
+
 : see if poll exists
 set poll d_poll
 eval $inlibc
@@ -17408,7 +17244,7 @@ case "$d_random_r" in
        esac
        case "$random_r_proto" in
        ''|0)   d_random_r=undef
-               random_r_proto=0
+               random_r_proto=0
                echo "Disabling random_r, cannot determine prototype." >&4 ;;
        * )     case "$random_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -17463,7 +17299,7 @@ case "$d_readdir64_r" in
        esac
        case "$readdir64_r_proto" in
        ''|0)   d_readdir64_r=undef
-               readdir64_r_proto=0
+               readdir64_r_proto=0
                echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
        * )     case "$readdir64_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -17508,7 +17344,7 @@ case "$d_readdir_r" in
        esac
        case "$readdir_r_proto" in
        ''|0)   d_readdir_r=undef
-               readdir_r_proto=0
+               readdir_r_proto=0
                echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
        * )     case "$readdir_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -17587,236 +17423,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
@@ -18012,21 +17618,31 @@ END
 extern int errno;
 #endif
 int main() {
-    struct semid_ds arg;
+    union semun
+#ifndef HAS_UNION_SEMUN
+    {
+       int val;
+       struct semid_ds *buf;
+       unsigned short *array;
+    }
+#endif
+    arg;
+    struct semid_ds argbuf;
     int sem, st;
 
 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
     if (sem > -1) {
+       arg.buf = &argbuf;
 #      ifdef IPC_STAT
-       st = semctl(sem, 0, IPC_STAT, &arg);
+       st = semctl(sem, 0, IPC_STAT, arg);
        if (st == 0)
            printf("semid_ds\n");
        else
 #      endif /* IPC_STAT */
            printf("semctl IPC_STAT failed: errno = %d\n", errno);
 #      ifdef IPC_RMID
-       if (semctl(sem, 0, IPC_RMID, &arg) != 0)
+       if (semctl(sem, 0, IPC_RMID, arg) != 0)
 #      endif /* IPC_RMID */
            printf("semctl IPC_RMID failed: errno = %d\n", errno);
     } else
@@ -18110,7 +17726,7 @@ case "$d_setgrent_r" in
        esac
        case "$setgrent_r_proto" in
        ''|0)   d_setgrent_r=undef
-               setgrent_r_proto=0
+               setgrent_r_proto=0
                echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
        * )     case "$setgrent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -18159,7 +17775,7 @@ case "$d_sethostent_r" in
        esac
        case "$sethostent_r_proto" in
        ''|0)   d_sethostent_r=undef
-               sethostent_r_proto=0
+               sethostent_r_proto=0
                echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
        * )     case "$sethostent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -18188,14 +17804,188 @@ eval $inlibc
 set setlinebuf d_setlinebuf
 eval $inlibc
 
-: see if setlocale exists
-set setlocale d_setlocale
-eval $inlibc
-
 : see if locale.h is available
 set locale.h i_locale
 eval $inhdr
 
+: see if this system has wctype.h
+set wctype.h i_wctype
+eval $inhdr
+
+: see if towupper exists
+set towupper d_towupper
+eval $inlibc
+
+: check for setlocale function and behavior
+$cat <<EOM
+
+Checking to see if you have setlocale() and its behavior
+EOM
+$cat >try.c <<EOCP
+#include <stdlib.h>
+#include <string.h>
+#$i_locale I_LOCALE
+#ifdef I_LOCALE
+#  include <locale.h>
+#endif
+#$i_wctype I_WCTYPE
+#ifdef I_WCTYPE
+#  include <wctype.h>
+#endif
+
+int main() {
+    const char * invalid_name = "\a";   /* This is really invalid! */
+    int accepts_any_locale_name = 0;
+    int has_C_UTF8 = 0;
+    unsigned char bad_setlocale = 255;
+
+    /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
+     * disabled.  It's hard to imagine an instance where meaningful locale
+     * handling could be done without LC_CTYPE */
+    const char *  name = setlocale(LC_CTYPE, "C");
+
+    if (name == NULL || strcmp(name, "C") != 0) {
+        exit(bad_setlocale);
+    }
+
+    name = setlocale(LC_CTYPE, invalid_name);
+    if (name != NULL) {
+
+        /* Let it pass if it accepts the name but gives back one of the C
+         * locales */
+        if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
+            accepts_any_locale_name = 1;
+        }
+    }
+
+    name = setlocale(LC_CTYPE, "C.UTF-8");
+    if (name != NULL) {
+        unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
+
+#$d_towupper HAS_TOWUPPER
+#ifdef HAS_TOWUPPER
+
+        /* We assume that if the machine doesn't have the C99 towupper, it
+         * doesn't have C.UTF-8, even if we successfully changed locales to
+         * include it.  This seems safer even on platforms that didn't accept
+         * the really invalid name */
+
+        if (towupper(y_with_diaeresis) == 0x178) {
+            has_C_UTF8 = 1;
+        }
+
+#endif
+
+    }
+
+#if 0
+
+    /* Currently unused code to determine if LC_ALL with disparate values uses
+     * category = value pairs or positional, and to determine the separator
+     * between the categories.  We could add code so that if the separator were
+     * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
+     * every possible ASCII separator would fit in the 5 bits available in the
+     * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
+     * positional, we probably would want to know the order of the categories.
+     * Using a file between the C program and the shell script would really be
+     * require to do that */
+#ifdef LC_ALL
+
+    unsigned char min_separator = ' ' - 1;
+    unsigned char separator = min_separator;
+    int uses_name_value_pair_names = 0;
+
+    name = setlocale(LC_ALL, "C");
+    if (name == NULL || strcmp(name, "C") != 0) {
+        exit(bad_setlocale);
+    }
+
+    if (has_C_UTF8) {
+        char * pos;
+
+        name = setlocale(LC_CTYPE, "C.UTF-8");
+        if (name == NULL) {
+            exit(bad_setlocale);
+        }
+        name = setlocale(LC_ALL, NULL);
+        if (name == NULL) {
+            exit(bad_setlocale);
+        }
+
+        pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
+        if (pos != NULL) {
+            uses_name_value_pair_names = 1;
+            if (pos == name) {
+                separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
+            }
+            else {
+                separator = *(pos - 1);
+            }
+        }
+        else {
+            pos = strstr(name, "C.UTF-8");
+            if (pos == NULL) {
+                /* bad */
+            }
+            else if (pos == name) {
+                separator = name[sizeof("C.UTF-8") - 1];
+            }
+            else {
+                separator = *(pos - 1);
+            }
+        }
+    }
+
+#endif
+#endif
+
+    exit( 0 /* (separator - min_separator) << 3
+        | uses_name_value_pair_names      << 2
+          */
+        | has_C_UTF8                      << 1
+        | accepts_any_locale_name);
+
+}
+EOCP
+set try
+if eval $compile; then
+    echo "Your system has setlocale()..." >&4
+    $run ./try
+    case $? in
+        0) echo "and it seems sane" >&4
+           d_setlocale="$define"
+           d_setlocale_accepts_any_locale_name="$undef"
+           d_has_C_UTF8="false"
+           ;;
+        1) echo "and it seems sane, but accepts any locale name as valid" >&4
+           d_setlocale="$define"
+           d_setlocale_accepts_any_locale_name="$define"
+           d_has_C_UTF8="false"
+           ;;
+        2) echo "and it seems sane" >&4
+           d_setlocale="$define"
+           d_setlocale_accepts_any_locale_name="$undef"
+           d_has_C_UTF8="true"
+           ;;
+        3) echo "and it seems sane, but accepts any locale name as valid" >&4
+           d_setlocale="$define"
+           d_setlocale_accepts_any_locale_name="$define"
+           d_has_C_UTF8="true"
+           ;;
+        *) echo "but it doesn't seem to work, so we won't use it." >&4
+           d_setlocale="$undef"
+           d_setlocale_accepts_any_locale_name="$undef"
+           d_has_C_UTF8="false"
+           ;;
+    esac
+else
+    echo "your system does not have setlocale()" >&4
+    d_setlocale="$undef"
+    d_setlocale_accepts_any_locale_name="$undef"
+    d_has_C_UTF8="false"
+fi
+$rm_try
+
 : see if setlocale_r exists
 set setlocale_r d_setlocale_r
 eval $inlibc
@@ -18216,7 +18006,7 @@ case "$d_setlocale_r" in
        esac
        case "$setlocale_r_proto" in
        ''|0)   d_setlocale_r=undef
-               setlocale_r_proto=0
+               setlocale_r_proto=0
                echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
        * )     case "$setlocale_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -18265,7 +18055,7 @@ case "$d_setnetent_r" in
        esac
        case "$setnetent_r_proto" in
        ''|0)   d_setnetent_r=undef
-               setnetent_r_proto=0
+               setnetent_r_proto=0
                echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
        * )     case "$setnetent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -18330,7 +18120,7 @@ case "$d_setprotoent_r" in
        esac
        case "$setprotoent_r_proto" in
        ''|0)   d_setprotoent_r=undef
-               setprotoent_r_proto=0
+               setprotoent_r_proto=0
                echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
        * )     case "$setprotoent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -18379,7 +18169,7 @@ case "$d_setpwent_r" in
        esac
        case "$setpwent_r_proto" in
        ''|0)   d_setpwent_r=undef
-               setpwent_r_proto=0
+               setpwent_r_proto=0
                echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
        * )     case "$setpwent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -18448,7 +18238,7 @@ case "$d_setservent_r" in
        esac
        case "$setservent_r_proto" in
        ''|0)   d_setservent_r=undef
-               setservent_r_proto=0
+               setservent_r_proto=0
                echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
        * )     case "$setservent_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -18696,11 +18486,8 @@ eval $inhdr
 : see if signbit exists
 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
 $cat >try.c <<EOCP
-#$i_math I_MATH
 #$i_sunmath I_SUNMATH
-#ifdef I_MATH
-#  include <math.h>
-#endif
+#include <math.h>
 #ifdef I_SUNMATH  /* Solaris special math library */
 #  include <sunmath.h>
 #endif
@@ -18708,7 +18495,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
@@ -18865,69 +18652,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
@@ -18948,7 +18672,7 @@ case "$d_srand48_r" in
        esac
        case "$srand48_r_proto" in
        ''|0)   d_srand48_r=undef
-               srand48_r_proto=0
+               srand48_r_proto=0
                echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
        * )     case "$srand48_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -18989,7 +18713,7 @@ case "$d_srandom_r" in
        esac
        case "$srandom_r_proto" in
        ''|0)   d_srandom_r=undef
-               srandom_r_proto=0
+               srandom_r_proto=0
                echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
        * )     case "$srandom_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -19052,7 +18776,6 @@ case "$d_statfs_s" in
 *)              echo "No, it doesn't." ;;
 esac
 
-
 : see if struct statfs knows about f_flags
 case "$d_statfs_s" in
 define)
@@ -19182,7 +18905,7 @@ $cat >&4 <<EOM
 Checking how to access stdio streams by file descriptor number...
 EOM
 case "$stdio_stream_array" in
-'')    $cat >try.c <<EOCP
+'')    $cat >try.c <<EOCP
 #include <stdio.h>
 int main() {
   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
@@ -19193,7 +18916,7 @@ EOCP
        do
                set try -DSTDIO_STREAM_ARRAY=$s
                if eval $compile; then
-                       case "`$run ./try`" in
+                       case "`$run ./try`" in
                        yes)    stdio_stream_array=$s; break ;;
                        esac
                fi
@@ -19213,79 +18936,20 @@ EOM
        ;;
 esac
 
-: see if strcoll exists
-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
-    if set strerror val -f d_strerror; eval $csym; $val; then
-               echo 'strerror() found.' >&4
-               d_strerror="$define"
-               d_strerrm='strerror(e)'
-               if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
-                       echo "(You also have sys_errlist[], so we could roll our own strerror.)"
-                       d_syserrlst="$define"
-               else
-                       echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
-                       d_syserrlst="$undef"
-               fi
-    elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
-                       $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
-               echo 'strerror() found in string header.' >&4
-               d_strerror="$define"
-               d_strerrm='strerror(e)'
-               if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
-                       echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
-                               d_syserrlst="$define"
-               else
-                       echo "(You don't appear to have any sys_errlist[], how can this be?)"
-                       d_syserrlst="$undef"
-               fi
-    elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
-               echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
-               d_strerror="$undef"
-               d_syserrlst="$define"
-               d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
-    else
-               echo 'strerror() and sys_errlist[] NOT found.' >&4
-               d_strerror="$undef"
-               d_syserrlst="$undef"
-               d_strerrm='"unknown"'
-    fi
-fi
+: see if strcoll exists
+set strcoll d_strcoll
+eval $inlibc
+
+: 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
 case "$d_strerror_r" in
 "$define")
-       hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
+       hdrs="$i_systypes sys/types.h define stdio.h define string.h"
        case "$d_strerror_r_proto:$usethreads" in
        ":define")      d_strerror_r_proto=define
                set d_strerror_r_proto strerror_r $hdrs
@@ -19308,7 +18972,7 @@ case "$d_strerror_r" in
        esac
        case "$strerror_r_proto" in
        ''|0)   d_strerror_r=undef
-               strerror_r_proto=0
+               strerror_r_proto=0
                echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
        * )     case "$strerror_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -19334,17 +18998,59 @@ set strftime d_strftime
 eval $inlibc
 
 : see if strlcat exists
-set strlcat d_strlcat
-eval $inlibc
+: We need both a prototype in string.h and the symbol in libc.
+echo " "
+d_strlcat_proto=''
+xx1="#$d_gnulibc HAS_GNULIBC"
+xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
+xx3='#   define _GNU_SOURCE'
+xx4='#endif'
+set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
+eval $hasproto
+case "$d_strlcat_proto" in
+    define) # see if strlcat exists
+       set strlcat d_strlcat
+       eval $inlibc
+       ;;
+    *)  val=$undef
+       set d_strlcat
+       eval $setvar
+       ;;
+esac
 
 : see if strlcpy exists
-set strlcpy d_strlcpy
+: We need both a prototype in string.h and the symbol in libc.
+echo " "
+d_strlcpy_proto=''
+xx1="#$d_gnulibc HAS_GNULIBC"
+xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
+xx3='#   define _GNU_SOURCE'
+xx4='#endif'
+set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
+eval $hasproto
+case "$d_strlcpy_proto" in
+    define) # see if strlcpy exists
+       set strlcpy d_strlcpy
+       eval $inlibc
+       ;;
+    *)  val=$undef
+       set d_strlcpy
+       eval $setvar
+       ;;
+esac
+
+: see if strnlen exists
+set strnlen d_strnlen
 eval $inlibc
 
 : see if strtod exists
 set strtod d_strtod
 eval $inlibc
 
+: see if strtod_l exists
+set strtod_l d_strtod_l
+eval $inlibc
+
 : see if strtol exists
 set strtol d_strtol
 eval $inlibc
@@ -19353,6 +19059,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
@@ -19450,7 +19160,7 @@ EOCP
        check("-1", 18446744073709551615UL, 0);
        check("-18446744073709551614", 2, 0);
        check("-18446744073709551615", 1, 0);
-               check("-18446744073709551616", 18446744073709551615UL, ERANGE);
+       check("-18446744073709551616", 18446744073709551615UL, ERANGE);
        check("-18446744073709551617", 18446744073709551615UL, ERANGE);
 #endif
 EOCP
@@ -19463,7 +19173,7 @@ EOCP
        check("-1", 4294967295UL, 0);
        check("-4294967294", 2, 0);
        check("-4294967295", 1, 0);
-               check("-4294967296", 4294967295UL, ERANGE);
+       check("-4294967296", 4294967295UL, ERANGE);
        check("-4294967297", 4294967295UL, ERANGE);
 #endif
 EOCP
@@ -19529,7 +19239,7 @@ int main() {
        check("-1",                    18446744073709551615ULL, 0);
        check("-18446744073709551614",                     2LL, 0);
        check("-18446744073709551615",                     1LL, 0);
-               check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
+       check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
        check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
 #endif
        if (!bad)
@@ -19583,7 +19293,7 @@ int main() {
        check("-1",                    18446744073709551615ULL, 0);
        check("-18446744073709551614",                     2LL, 0);
        check("-18446744073709551615",                     1LL, 0);
-               check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
+       check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
        check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
 #endif
        if (!bad)
@@ -19629,6 +19339,18 @@ eval $hasproto
 set sysconf d_sysconf
 eval $inlibc
 
+: see if sys_errlist[] exists
+echo " "
+if test "X$d_syserrlst" = X; then
+       if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
+               echo "You have sys_errlist[], so we could roll our own strerror."
+               d_syserrlst="$define"
+       else
+               echo "You don't have sys_errlist[], so strerror() is welcome."
+               d_syserrlst="$undef"
+       fi
+fi
+
 : see if system exists
 set system d_system
 eval $inlibc
@@ -19650,6 +19372,90 @@ 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
+#include <string.h>
+#$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
@@ -19714,7 +19520,7 @@ case "$d_tmpnam_r" in
        esac
        case "$tmpnam_r_proto" in
        ''|0)   d_tmpnam_r=undef
-               tmpnam_r_proto=0
+               tmpnam_r_proto=0
                echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
        * )     case "$tmpnam_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -19735,6 +19541,10 @@ case "$d_tmpnam_r" in
        ;;
 esac
 
+: see if towlower exists
+set towlower d_towlower
+eval $inlibc
+
 : see if trunc exists
 set trunc d_trunc
 eval $inlibc
@@ -19771,7 +19581,7 @@ case "$d_ttyname_r" in
        esac
        case "$ttyname_r_proto" in
        ''|0)   d_ttyname_r=undef
-               ttyname_r_proto=0
+               ttyname_r_proto=0
                echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
        * )     case "$ttyname_r_proto" in
                REENTRANT_PROTO*) ;;
        ;;
 esac
 
-: Checking 32bit alignedness
 $cat <<EOM
 
 Checking to see whether you can access character data unalignedly...
-EOM
-case "$d_u32align" in
-'')   $cat >try.c <<EOCP
-#include <stdio.h>
-#$i_stdlib I_STDLIB
-#ifdef I_STDLIB
-#include <stdlib.h>
-#endif
-#define U32 $u32type
-#define BYTEORDER 0x$byteorder
-#define U8 $u8type
-#include <signal.h>
-#ifdef SIGBUS
-$signal_t bletch(int s) { exit(4); }
-#endif
-int main() {
-#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
-    volatile U8 buf[8];
-    volatile U32 *up;
-    int i;
-
-    if (sizeof(U32) != 4) {
-       printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
-       exit(1);
-    }
-
-    fflush(stdout);
-
-#ifdef SIGBUS
-    signal(SIGBUS, bletch);
-#endif
-
-    buf[0] = 0;
-    buf[1] = 0;
-    buf[2] = 0;
-    buf[3] = 1;
-    buf[4] = 0;
-    buf[5] = 0;
-    buf[6] = 0;
-    buf[7] = 1;
-
-    for (i = 0; i < 4; i++) {
-       up = (U32*)(buf + i);
-       if (! ((*up == 1 << (8*i)) ||   /* big-endian */
-              (*up == 1 << (8*(3-i)))  /* little-endian */
-             )
-          )
-       {
-           printf("read failed (%x)\n", *up);
-           exit(2);
-       }
-    }
-
-    /* write test */
-    for (i = 0; i < 4; i++) {
-       up = (U32*)(buf + i);
-       *up = 0xBeef;
-       if (*up != 0xBeef) {
-           printf("write failed (%x)\n", *up);
-           exit(3);
-       }
-    }
 
-    exit(0);
-#else
-    printf("1\n");
-    exit(1);
-#endif
-    return 0;
-}
-EOCP
-set try
-if eval $compile_ok; then
-       echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
-       $run ./try 2>&1 >/dev/null
-       case "$?" in
-       0)      cat >&4 <<EOM
-You can access character data pretty unalignedly.
-EOM
-               d_u32align="$undef"
-               ;;
-       *)      cat >&4 <<EOM
-It seems that you must access character data in an aligned manner.
+We assume only aligned access is permitted.
 EOM
-               d_u32align="$define"
-               ;;
-       esac
-else
-       rp='Can you access character data at unaligned addresses?'
-       dflt='n'
-       . ./myread
-       case "$ans" in
-       [yY]*)  d_u32align="$undef"  ;;
-       *)      d_u32align="$define" ;;
-       esac
-fi
-$rm_try
-;;
+: Checking 32bit alignedness
+: We no longer check and assume it is required.
+case "$d_u32align" in
+'') d_u32align="$define" ;;
 esac
 
 : see if ualarm exists
@@ -20052,14 +19770,10 @@ case "$d_closedir" in
 #include <sys/ndir.h>
 #else
 #ifdef I_SYS_DIR
-#ifdef hp9000s500
-#include <ndir.h>      /* may be wrong in the future */
-#else
 #include <sys/dir.h>
 #endif
 #endif
 #endif
-#endif
 int main() { return closedir(opendir(".")); }
 EOM
        set try
@@ -20295,10 +20009,6 @@ $define)
        echo " "
        echo "Checking Berkeley DB version ..." >&4
        $cat >try.c <<EOCP
-#$d_const HASCONST
-#ifndef HASCONST
-#define const
-#endif
 #include <sys/types.h>
 #include <stdio.h>
 #$i_stdlib I_STDLIB
@@ -20389,16 +20099,13 @@ define)
        echo " "
        echo "Checking return type needed for hash for Berkeley DB ..." >&4
        $cat >try.c <<EOCP
-#$d_const HASCONST
-#ifndef HASCONST
-#define const
-#endif
 #include <sys/types.h>
 #include <db.h>
 
 #ifndef DB_VERSION_MAJOR
 u_int32_t hash_cb (const void* ptr, size_t size)
 {
+       return 0;
 }
 HASHINFO info;
 int main()
@@ -20432,16 +20139,13 @@ define)
        echo " "
        echo "Checking return type needed for prefix for Berkeley DB ..." >&4
        cat >try.c <<EOCP
-#$d_const HASCONST
-#ifndef HASCONST
-#define const
-#endif
 #include <sys/types.h>
 #include <db.h>
 
 #ifndef DB_VERSION_MAJOR
 size_t prefix_cb (const DBT *key1, const DBT *key2)
 {
+       return 0;
 }
 BTREEINFO info;
 int main()
@@ -20470,19 +20174,46 @@ 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
-#ifdef I_MATH
 #include <math.h>
-#endif
+#include <string.h>
 #include <stdio.h>
 /* Note that whether the sign bit is on or off
  * for NaN depends on the CPU/FPU, and possibly
@@ -20493,8 +20224,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");
@@ -20509,16 +20246,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
@@ -20572,6 +20308,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
@@ -20634,22 +20374,36 @@ else
        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
 $echo "Checking how many mantissa bits your doubles have..." >&4
 $cat >try.c <<EOP
-#$i_float I_FLOAT
 #$i_sunmath I_SUNMATH
-#ifdef I_FLOAT
-# include <float.h>
-#endif
+#include <float.h>
 #ifdef I_SUNMATH
 # include <sunmath.h>
 #endif
@@ -20675,11 +20429,8 @@ $rm_try
 : Check the length of the longdouble mantissa
 $echo "Checking how many mantissa bits your long doubles have..." >&4
 $cat >try.c <<EOP
-#$i_float I_FLOAT
 #$i_sunmath I_SUNMATH
-#ifdef I_FLOAT
-# include <float.h>
-#endif
+#include <float.h>
 #ifdef I_SUNMATH
 # include <sunmath.h>
 #endif
@@ -20756,12 +20507,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) {
@@ -20771,14 +20548,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
@@ -20914,7 +20691,7 @@ if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
 fi
 : check for fflush NULL behavior
 case "$fflushNULL" in
-'')    set try -DTRY_FFLUSH_NULL $output
+'')    set try -DTRY_FFLUSH_NULL $output
        if eval $compile; then
                $run ./try 2>/dev/null
                code="$?"
@@ -21048,7 +20825,7 @@ Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
 EOM
                : now check for fflushall behaviour
                case "$fflushall" in
-               '')     set try -DTRY_FFLUSH_ALL $output
+               '')     set try -DTRY_FFLUSH_ALL $output
                        if eval $compile; then
                                $cat >&4 <<EOM
 (Now testing the other method--but note that this also may fail.)
@@ -21180,7 +20957,6 @@ else
        echo "(I can't compile the test program--guessing $gidsize.)" >&4
 fi
 
-
 : Check if GID is signed
 echo " "
 case "$gidtype" in
@@ -21218,7 +20994,6 @@ else
        echo "(I can't compile the test program--guessing unsigned.)" >&4
 fi
 
-
 : Check 64bit sizes
 echo " "
 
@@ -21241,7 +21016,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
-                       sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
+                       sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
                        echo "We will use %d."
                        ;;
                esac
@@ -21263,7 +21038,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
-                       sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
+                       sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
                        echo "We will use %ld."
                        ;;
                esac
@@ -21286,7 +21061,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
-                       sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
+                       sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
                        echo "We will use the C9X style."
                        ;;
                esac
@@ -21308,7 +21083,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
-                       sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
+                       sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
                        echo "We will use %Ld."
                        ;;
                esac
@@ -21330,7 +21105,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
-                       sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
+                       sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
                        echo "We will use the %lld style."
                        ;;
                esac
@@ -21352,7 +21127,7 @@ EOCP
                case "$yyy" in
                12345678901)
                        sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
-                       sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
+                       sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
                        echo "We will use %qd."
                        ;;
                esac
@@ -21539,15 +21314,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
@@ -21579,28 +21349,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?"
@@ -21819,25 +21584,15 @@ else
 fi
 $rm -f foo* bar*
 
-: see if this is a values.h system
-set values.h i_values
-eval $inhdr
-
 : Check the max offset that gmtime and localtime accept
 echo "Checking max offsets that gmtime () accepts"
 
-case $i_values in
-    define) yyy="#include <values.h>" ;;
-    *)      yyy="" ;;
-    esac
-
 case "$sGMTIME_min/$sGMTIME_max" in
     0/0|/)
        $cat >try.c <<EOCP
 #include <sys/types.h>
 #include <stdio.h>
 #include <time.h>
-$yyy
 
 int i;
 struct tm *tmp;
@@ -21916,7 +21671,6 @@ case "$sLOCALTIME_min/$sLOCALTIME_max" in
 #include <sys/types.h>
 #include <stdio.h>
 #include <time.h>
-$yyy
 
 int i;
 struct tm *tmp;
@@ -22385,17 +22139,17 @@ case "$doinit" in
 yes)
        echo "Generating a list of signal names and numbers..." >&4
        . ./signal_cmd
-       sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
-       sig_name=`$awk 'BEGIN { printf "ZERO " }
-                       !/^NSIG/ { printf "%s ", $1 }' signal.lst`
-       sig_num=`$awk  'BEGIN { printf "0 " }
-                       !/^NSIG/ { printf "%d ", $2 }' signal.lst`
-       sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
-                            !/^NSIG/   { printf "\"%s\", ", $1 }
-                            END        { printf "0\n" }' signal.lst`
-       sig_num_init=`$awk  'BEGIN      { printf "0, " }
-                            !/^NSIG/   { printf "%d, ", $2}
-                            END        { printf "0\n"}' signal.lst`
+       sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
+       sig_name=`$awk 'BEGIN { printf "ZERO " }
+                       !/^NSIG/ { printf "%s ", $1 }' signal.lst`
+       sig_num=`$awk  'BEGIN { printf "0 " }
+                       !/^NSIG/ { printf "%d ", $2 }' signal.lst`
+       sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
+                            !/^NSIG/   { printf "\"%s\", ", $1 }
+                            END        { printf "0\n" }' signal.lst`
+       sig_num_init=`$awk  'BEGIN      { printf "0, " }
+                            !/^NSIG/   { printf "%d, ", $2}
+                            END        { printf "0\n"}' signal.lst`
        ;;
 esac
 echo "The following $sig_count signals are available:"
@@ -22454,7 +22208,6 @@ else
        echo "(I can't compile the test program--guessing $sizesize.)" >&4
 fi
 
-
 : check for socklen_t
 echo " "
 echo "Checking to see if you have socklen_t..." >&4
@@ -22727,7 +22480,6 @@ else
        echo "(I can't compile the test program--guessing unsigned.)" >&4
 fi
 
-
 : Check format string for UID
 echo " "
 $echo "Checking the format string to be used for uids..." >&4
@@ -22818,7 +22570,7 @@ main(int argc, char **argv) {
        return 4;
     }
 
-    buffer = malloc(size);
+    buffer = (char *)malloc(size);
     if (!buffer) {
        perror("malloc");
        return 5;
@@ -22917,7 +22669,7 @@ main(int argc, char **argv) {
        return 2;
     }
 
-    buffer = malloc(size);
+    buffer = (char *)malloc(size);
     if (!buffer) {
        perror("malloc");
        return 3;
@@ -22992,21 +22744,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
 '')
@@ -23038,10 +22775,6 @@ case "$yacc" in
        ;;
 esac
 
-: see if this is a assert.h system
-set assert.h i_assert
-eval $inhdr
-
 : see if this is a bfd.h system
 set bfd.h i_bfd
 eval $inhdr
@@ -23165,7 +22898,7 @@ FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
-hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
+hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
@@ -23179,7 +22912,7 @@ M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
-MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
+MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
@@ -23264,7 +22997,7 @@ cat <<'EOSH' >> Cppsym.try
     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
-}'      >> try.c
+}' >> try.c
 echo 'return 0;}' >> try.c
 EOSH
 cat <<EOSH >> Cppsym.try
@@ -23370,7 +23103,7 @@ fi
 
 : add -D_FORTIFY_SOURCE if feasible and not already there
 case "$gccversion" in
-[45].*)        case "$optimize$ccflags" in
+[456789].*|[1-9][0-9]*)        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
@@ -23388,6 +23121,24 @@ case "$gccversion" in
        ;;
 esac
 
+: script used to emit important warnings
+cat >warn <<EOS
+$startsh
+if test \$# -gt 0; then
+       echo "\$@" >msg
+else
+       cat >msg
+fi
+echo "*** WARNING:" >&4
+sed -e 's/^/*** /' <msg >&4
+echo "*** " >&4
+cat msg >>config.msg
+echo " " >>config.msg
+rm -f msg
+EOS
+chmod +x warn
+$eunicefix warn
+
 : see if this is a termio system
 val="$undef"
 val2="$undef"
@@ -23472,10 +23223,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
@@ -23580,6 +23327,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
@@ -23678,11 +23429,6 @@ for xxx in $xs_extensions ; do
                $define) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
-       I18N/Langinfo|i18n_lan)
-               case "$i_langinfo$d_nl_langinfo" in
-               $define$define) avail_ext="$avail_ext $xxx" ;;
-               esac
-               ;;
        IPC/SysV|ipc/sysv)
                : XXX Do we need a useipcsysv variable here
                case "${d_msg}${d_sem}${d_shm}" in
@@ -23736,6 +23482,11 @@ for xxx in $xs_extensions ; do
                true|$define|y) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
+       I18N/Langinfo|langinfo)
+               case "$uselanginfo" in
+               true|define|y) avail_ext="$avail_ext $xxx" ;;
+               esac
+               ;;
        Sys/Syslog|sys/syslog)
                case $osname in
                        amigaos) ;; # not really very useful on AmigaOS
@@ -24117,7 +23868,6 @@ _o='$_o'
 afs='$afs'
 afsroot='$afsroot'
 alignbytes='$alignbytes'
-ansi2knr='$ansi2knr'
 aphostname='$aphostname'
 api_revision='$api_revision'
 api_subversion='$api_subversion'
@@ -24193,6 +23943,7 @@ d_PRIu64='$d_PRIu64'
 d_PRIx64='$d_PRIx64'
 d_SCNfldbl='$d_SCNfldbl'
 d__fwalk='$d__fwalk'
+d_accept4='$d_accept4'
 d_access='$d_access'
 d_accessx='$d_accessx'
 d_acosh='$d_acosh'
@@ -24214,19 +23965,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'
@@ -24234,7 +23984,6 @@ d_class='$d_class'
 d_clearenv='$d_clearenv'
 d_closedir='$d_closedir'
 d_cmsghdr_s='$d_cmsghdr_s'
-d_const='$d_const'
 d_copysign='$d_copysign'
 d_copysignl='$d_copysignl'
 d_cplusplus='$d_cplusplus'
@@ -24246,7 +23995,6 @@ d_ctermid_r='$d_ctermid_r'
 d_ctime64='$d_ctime64'
 d_ctime_r='$d_ctime_r'
 d_cuserid='$d_cuserid'
-d_dbl_dig='$d_dbl_dig'
 d_dbminitproto='$d_dbminitproto'
 d_difftime64='$d_difftime64'
 d_difftime='$d_difftime'
@@ -24258,9 +24006,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_dup3='$d_dup3'
 d_duplocale='$d_duplocale'
 d_eaccess='$d_eaccess'
 d_endgrent='$d_endgrent'
@@ -24284,6 +24041,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'
@@ -24323,6 +24081,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'
@@ -24387,13 +24146,13 @@ d_gmtime64='$d_gmtime64'
 d_gmtime_r='$d_gmtime_r'
 d_gnulibc='$d_gnulibc'
 d_grpasswd='$d_grpasswd'
+d_has_C_UTF8='$d_has_C_UTF8'
 d_hasmntopt='$d_hasmntopt'
 d_htonl='$d_htonl'
 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'
@@ -24424,10 +24183,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'
@@ -24436,6 +24197,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'
@@ -24447,18 +24213,18 @@ d_lstat='$d_lstat'
 d_madvise='$d_madvise'
 d_malloc_good_size='$d_malloc_good_size'
 d_malloc_size='$d_malloc_size'
+d_malloc_usable_size='$d_malloc_usable_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'
+d_mkostemp='$d_mkostemp'
 d_mkstemp='$d_mkstemp'
 d_mkstemps='$d_mkstemps'
 d_mktime64='$d_mktime64'
@@ -24482,6 +24248,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'
@@ -24497,10 +24264,12 @@ 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'
 d_phostname='$d_phostname'
+d_pipe2='$d_pipe2'
 d_pipe='$d_pipe'
 d_poll='$d_poll'
 d_portable='$d_portable'
@@ -24537,13 +24306,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'
@@ -24568,6 +24335,7 @@ d_sethostent_r='$d_sethostent_r'
 d_setitimer='$d_setitimer'
 d_setlinebuf='$d_setlinebuf'
 d_setlocale='$d_setlocale'
+d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
 d_setlocale_r='$d_setlocale_r'
 d_setnent='$d_setnent'
 d_setnetent_r='$d_setnetent_r'
@@ -24619,7 +24387,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'
@@ -24638,18 +24405,18 @@ 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_strtod_l='$d_strtod_l'
 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'
@@ -24669,12 +24436,15 @@ 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'
 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
 d_tm_tm_zone='$d_tm_tm_zone'
 d_tmpnam_r='$d_tmpnam_r'
+d_towlower='$d_towlower'
+d_towupper='$d_towupper'
 d_trunc='$d_trunc'
 d_truncate='$d_truncate'
 d_truncl='$d_truncl'
@@ -24685,6 +24455,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'
@@ -24699,8 +24470,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'
@@ -24716,6 +24485,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'
@@ -24728,6 +24498,7 @@ drand01='$drand01'
 drand48_r_proto='$drand48_r_proto'
 dtrace='$dtrace'
 dtraceobject='$dtraceobject'
+dtracexnolibs='$dtracexnolibs'
 dynamic_ext='$dynamic_ext'
 eagain='$eagain'
 ebcdic='$ebcdic'
@@ -24813,7 +24584,6 @@ i64type='$i64type'
 i8size='$i8size'
 i8type='$i8type'
 i_arpainet='$i_arpainet'
-i_assert='$i_assert'
 i_bfd='$i_bfd'
 i_bsdioctl='$i_bsdioctl'
 i_crypt='$i_crypt'
@@ -24824,7 +24594,6 @@ i_dlfcn='$i_dlfcn'
 i_execinfo='$i_execinfo'
 i_fcntl='$i_fcntl'
 i_fenv='$i_fenv'
-i_float='$i_float'
 i_fp='$i_fp'
 i_fp_class='$i_fp_class'
 i_gdbm='$i_gdbm'
@@ -24835,13 +24604,10 @@ i_ieeefp='$i_ieeefp'
 i_inttypes='$i_inttypes'
 i_langinfo='$i_langinfo'
 i_libutil='$i_libutil'
-i_limits='$i_limits'
 i_locale='$i_locale'
 i_machcthr='$i_machcthr'
 i_malloc='$i_malloc'
 i_mallocmalloc='$i_mallocmalloc'
-i_math='$i_math'
-i_memory='$i_memory'
 i_mntent='$i_mntent'
 i_ndbm='$i_ndbm'
 i_netdb='$i_netdb'
@@ -24857,12 +24623,9 @@ 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'
 i_sunmath='$i_sunmath'
 i_sysaccess='$i_sysaccess'
 i_sysdir='$i_sysdir'
@@ -24899,10 +24662,9 @@ i_time='$i_time'
 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_wctype='$i_wctype'
 i_xlocale='$i_xlocale'
 ignore_versioned_solibs='$ignore_versioned_solibs'
 inc_version_list='$inc_version_list'
@@ -25062,7 +24824,6 @@ prefixexp='$prefixexp'
 privlib='$privlib'
 privlibexp='$privlibexp'
 procselfexe='$procselfexe'
-prototype='$prototype'
 ptrsize='$ptrsize'
 quadkind='$quadkind'
 quadtype='$quadtype'
@@ -25173,7 +24934,6 @@ stdio_filbuf='$stdio_filbuf'
 stdio_ptr='$stdio_ptr'
 stdio_stream_array='$stdio_stream_array'
 strerror_r_proto='$strerror_r_proto'
-strings='$strings'
 submit='$submit'
 subversion='$subversion'
 sysman='$sysman'
@@ -25225,6 +24985,7 @@ usedtrace='$usedtrace'
 usefaststdio='$usefaststdio'
 useithreads='$useithreads'
 usekernprocpathname='$usekernprocpathname'
+uselanginfo='$uselanginfo'
 uselargefiles='$uselargefiles'
 uselongdouble='$uselongdouble'
 usemallocwrap='$usemallocwrap'
@@ -25254,7 +25015,6 @@ uvsize='$uvsize'
 uvtype='$uvtype'
 uvuformat='$uvuformat'
 uvxformat='$uvxformat'
-vaproto='$vaproto'
 vendorarch='$vendorarch'
 vendorarchexp='$vendorarchexp'
 vendorbin='$vendorbin'