emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 29064d0 2/2: Update Gnulib.


From: Philipp Stephani
Subject: master 29064d0 2/2: Update Gnulib.
Date: Thu, 24 Dec 2020 10:49:32 -0500 (EST)

branch: master
commit 29064d02c31b08ae41d41a93fd1439718373b196
Author: Philipp Stephani <phst@google.com>
Commit: Philipp Stephani <phst@google.com>

    Update Gnulib.
    
    All changes in this commit are autogenerated by running
    admin/merge-gnulib.
---
 build-aux/config.guess                     | 221 +++++++++--------
 build-aux/config.sub                       |  60 ++---
 build-aux/install-sh                       |  35 ++-
 doc/misc/texinfo.tex                       |  65 ++++-
 lib/attribute.h                            |  23 +-
 lib/c++defs.h                              |   8 +
 lib/canonicalize-lgpl.c                    | 381 +++++++++++++---------------
 lib/careadlinkat.c                         |  22 +-
 lib/cdefs.h                                |   4 +-
 lib/fcntl.c                                |   4 +-
 lib/fcntl.in.h                             |  37 ++-
 lib/filemode.c                             |  14 --
 lib/fpending.c                             |   7 +-
 lib/free.c                                 |  33 +++
 lib/gnulib.mk.in                           |  93 +++++--
 lib/idx.h                                  | 113 +++++++++
 lib/intprops.h                             |  50 +++-
 lib/malloc/scratch_buffer.h                | 135 ++++++++++
 lib/malloc/scratch_buffer_grow.c           |  56 +++++
 lib/malloc/scratch_buffer_grow_preserve.c  |  67 +++++
 lib/malloc/scratch_buffer_set_array_size.c |  64 +++++
 lib/rawmemchr.c                            | 136 ++++++++++
 lib/rawmemchr.valgrind                     |  28 +++
 lib/readlink.c                             |  48 +++-
 lib/readlinkat.c                           |  47 +++-
 lib/regex_internal.c                       |  19 +-
 lib/regex_internal.h                       |   8 +
 lib/scratch_buffer.h                       |  29 +++
 lib/signal.in.h                            |   6 +-
 lib/stdint.in.h                            |   5 -
 lib/stdio-impl.h                           |   2 +-
 lib/stdio.in.h                             | 183 ++++++++++----
 lib/stdlib.in.h                            | 169 ++++++++++++-
 lib/string.in.h                            |  36 ++-
 lib/sys_select.in.h                        |   9 +-
 lib/sys_stat.in.h                          |  32 ++-
 lib/tempname.c                             |  49 ++--
 lib/time.in.h                              |  23 +-
 lib/time_rz.c                              |  16 +-
 lib/unistd.in.h                            | 386 +++++++++++++++++++++++------
 lib/xalloc-oversized.h                     |   2 +-
 m4/alloca.m4                               |   4 +-
 m4/extensions.m4                           | 160 +++++++-----
 m4/fcntl.m4                                |  52 ++--
 m4/filemode.m4                             |   3 +-
 m4/free.m4                                 |  49 ++++
 m4/fsusage.m4                              |   3 +-
 m4/gnulib-common.m4                        |  63 ++---
 m4/gnulib-comp.m4                          |  92 +++++--
 m4/largefile.m4                            |   2 +-
 m4/mbstate_t.m4                            |  11 +-
 m4/pid_t.m4                                |  38 +++
 m4/rawmemchr.m4                            |  20 ++
 m4/readlink.m4                             |  61 ++++-
 m4/readlinkat.m4                           |  13 +-
 m4/std-gnu11.m4                            |   5 +
 m4/stdint.m4                               |  10 +-
 m4/stdio_h.m4                              |   8 +-
 m4/stdlib_h.m4                             |  36 ++-
 m4/sys_types_h.m4                          |  22 +-
 m4/unistd_h.m4                             |  11 +-
 m4/vararrays.m4                            |  14 +-
 62 files changed, 2547 insertions(+), 855 deletions(-)

diff --git a/build-aux/config.guess b/build-aux/config.guess
index 9aff91c..699b3a1 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -2,7 +2,7 @@
 # Attempt to guess a canonical system name.
 #   Copyright 1992-2020 Free Software Foundation, Inc.
 
-timestamp='2020-08-17'
+timestamp='2020-11-19'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -27,12 +27,12 @@ timestamp='2020-08-17'
 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
 #
 # Please send patches to <config-patches@gnu.org>.
 
 
-me=`echo "$0" | sed -e 's,.*/,,'`
+me=$(echo "$0" | sed -e 's,.*/,,')
 
 usage="\
 Usage: $0 [OPTION]
@@ -103,7 +103,7 @@ set_cc_for_build() {
     test "$tmp" && return 0
     : "${TMPDIR=/tmp}"
     # shellcheck disable=SC2039
-    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n 
"$tmp" && test -d "$tmp" ; } ||
+    { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test 
-n "$tmp" && test -d "$tmp" ; } ||
        { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir 
"$tmp" 2>/dev/null) ; } ||
        { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo 
"Warning: creating insecure temp directory" >&2 ; } ||
        { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 
1 ; }
@@ -131,16 +131,14 @@ if test -f /.attbin/uname ; then
        PATH=$PATH:/.attbin ; export PATH
 fi
 
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown
+UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown
+UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown
+UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown
 
 case "$UNAME_SYSTEM" in
 Linux|GNU|GNU/*)
-       # If the system lacks a compiler, then just pick glibc.
-       # We could probably try harder.
-       LIBC=gnu
+       LIBC=unknown
 
        set_cc_for_build
        cat <<-EOF > "$dummy.c"
@@ -149,17 +147,29 @@ Linux|GNU|GNU/*)
        LIBC=uclibc
        #elif defined(__dietlibc__)
        LIBC=dietlibc
-       #else
+       #elif defined(__GLIBC__)
        LIBC=gnu
+       #else
+       #include <stdarg.h>
+       /* First heuristic to detect musl libc.  */
+       #ifdef __DEFINED_va_list
+       LIBC=musl
+       #endif
        #endif
        EOF
-       eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, 
,,g'`"
+       eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 
's, ,,g')"
 
-       # If ldd exists, use it to detect musl libc.
-       if command -v ldd >/dev/null && \
-               ldd --version 2>&1 | grep -q ^musl
-       then
-           LIBC=musl
+       # Second heuristic to detect musl libc.
+       if [ "$LIBC" = unknown ] &&
+          command -v ldd >/dev/null &&
+          ldd --version 2>&1 | grep -q ^musl; then
+               LIBC=musl
+       fi
+
+       # If the system lacks a compiler, then just pick glibc.
+       # We could probably try harder.
+       if [ "$LIBC" = unknown ]; then
+               LIBC=gnu
        fi
        ;;
 esac
@@ -179,19 +189,20 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
        # Note: NetBSD doesn't particularly care about the vendor
        # portion of the name.  We always set it to "unknown".
        sysctl="sysctl -n hw.machine_arch"
-       UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+       UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \
            "/sbin/$sysctl" 2>/dev/null || \
            "/usr/sbin/$sysctl" 2>/dev/null || \
-           echo unknown)`
+           echo unknown))
        case "$UNAME_MACHINE_ARCH" in
+           aarch64eb) machine=aarch64_be-unknown ;;
            armeb) machine=armeb-unknown ;;
            arm*) machine=arm-unknown ;;
            sh3el) machine=shl-unknown ;;
            sh3eb) machine=sh-unknown ;;
            sh5el) machine=sh5le-unknown ;;
            earmv*)
-               arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 
's,^e\(armv[0-9]\).*$,\1,'`
-               endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 
's,^.*\(eb\)$,\1,p'`
+               arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 
's,^e\(armv[0-9]\).*$,\1,')
+               endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 
's,^.*\(eb\)$,\1,p')
                machine="${arch}${endian}"-unknown
                ;;
            *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
@@ -222,7 +233,7 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
        case "$UNAME_MACHINE_ARCH" in
            earm*)
                expr='s/^earmv[0-9]/-eabi/;s/eb$//'
-               abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
+               abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr")
                ;;
        esac
        # The OS release
@@ -235,7 +246,7 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
                release='-gnu'
                ;;
            *)
-               release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. 
-f1,2`
+               release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. 
-f1,2)
                ;;
        esac
        # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
@@ -244,15 +255,15 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
        echo "$machine-${os}${release}${abi-}"
        exit ;;
     *:Bitrig:*:*)
-       UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+       UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//')
        echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
        exit ;;
     *:OpenBSD:*:*)
-       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+       UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//')
        echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
        exit ;;
     *:LibertyBSD:*:*)
-       UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+       UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//')
        echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
        exit ;;
     *:MidnightBSD:*:*)
@@ -288,17 +299,17 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
     alpha:OSF1:*:*)
        case $UNAME_RELEASE in
        *4.0)
-               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+               UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}')
                ;;
        *5.*)
-               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}')
                ;;
        esac
        # According to Compaq, /usr/sbin/psrinfo has been available on
        # OSF/1 and Tru64 systems produced since 1995.  I hope that
        # covers most systems running today.  This code pipes the CPU
        # types through head -n 1, so we only detect the type of CPU 0.
-       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) 
processor.*$/\1/p' | head -n 1`
+       ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha 
\(.*\) processor.*$/\1/p' | head -n 1)
        case "$ALPHA_CPU_TYPE" in
            "EV4 (21064)")
                UNAME_MACHINE=alpha ;;
@@ -336,7 +347,7 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
        # A Tn.n version is a released field test version.
        # A Xn.n version is an unreleased experimental baselevel.
        # 1.2 uses "1.2" for uname -r.
-       echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 
's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
+       echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 
's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)"
        # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
        exitcode=$?
        trap '' 0
@@ -370,7 +381,7 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
        exit ;;
     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
        # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+       if test "$( (/bin/universe) 2>/dev/null)" = att ; then
                echo pyramid-pyramid-sysv3
        else
                echo pyramid-pyramid-bsd
@@ -383,17 +394,17 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
        echo sparc-icl-nx6
        exit ;;
     DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
-       case `/usr/bin/uname -p` in
+       case $(/usr/bin/uname -p) in
            sparc) echo sparc-icl-nx7; exit ;;
        esac ;;
     s390x:SunOS:*:*)
-       echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 
's/[^.]*//'`"
+       echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 
's/[^.]*//')"
        exit ;;
     sun4H:SunOS:5.*:*)
-       echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
+       echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
        exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-       echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
+       echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
        exit ;;
     i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
        echo i386-pc-auroraux"$UNAME_RELEASE"
@@ -412,30 +423,30 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
                SUN_ARCH=x86_64
            fi
        fi
-       echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
+       echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 
's/[^.]*//')"
        exit ;;
     sun4*:SunOS:6*:*)
        # According to config.sub, this is the proper way to canonicalize
        # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
        # it's likely to be more like Solaris than SunOS4.
-       echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
+       echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
        exit ;;
     sun4*:SunOS:*:*)
-       case "`/usr/bin/arch -k`" in
+       case "$(/usr/bin/arch -k)" in
            Series*|S4*)
-               UNAME_RELEASE=`uname -v`
+               UNAME_RELEASE=$(uname -v)
                ;;
        esac
        # Japanese Language versions have a version number like `4.1.3-JL'.
-       echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
+       echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')"
        exit ;;
     sun3*:SunOS:*:*)
        echo m68k-sun-sunos"$UNAME_RELEASE"
        exit ;;
     sun*:*:4.2BSD:*)
-       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 
2>/dev/null`
+       UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 
2>/dev/null)
        test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
-       case "`/bin/arch`" in
+       case "$(/bin/arch)" in
            sun3)
                echo m68k-sun-sunos"$UNAME_RELEASE"
                ;;
@@ -515,8 +526,8 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
        }
 EOF
        $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
-         dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
-         SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
+         dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') &&
+         SYSTEM_NAME=$("$dummy" "$dummyarg") &&
            { echo "$SYSTEM_NAME"; exit; }
        echo mips-mips-riscos"$UNAME_RELEASE"
        exit ;;
@@ -543,7 +554,7 @@ EOF
        exit ;;
     AViiON:dgux:*:*)
        # DG/UX returns AViiON for all architectures
-       UNAME_PROCESSOR=`/usr/bin/uname -p`
+       UNAME_PROCESSOR=$(/usr/bin/uname -p)
        if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = 
mc88110
        then
            if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
@@ -571,17 +582,17 @@ EOF
        echo m68k-tektronix-bsd
        exit ;;
     *:IRIX*:*:*)
-       echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
+       echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')"
        exit ;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
        echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
-       exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+       exit ;;               # Note that: echo "'$(uname -s)'" gives 'AIX '
     i*86:AIX:*:*)
        echo i386-ibm-aix
        exit ;;
     ia64:AIX:*:*)
        if test -x /usr/bin/oslevel ; then
-               IBM_REV=`/usr/bin/oslevel`
+               IBM_REV=$(/usr/bin/oslevel)
        else
                IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
        fi
@@ -601,7 +612,7 @@ EOF
                        exit(0);
                        }
 EOF
-               if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && 
SYSTEM_NAME=`"$dummy"`
+               if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && 
SYSTEM_NAME=$("$dummy")
                then
                        echo "$SYSTEM_NAME"
                else
@@ -614,15 +625,15 @@ EOF
        fi
        exit ;;
     *:AIX:*:[4567])
-       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk 
'{ print $1 }'`
+       IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | 
awk '{ print $1 }')
        if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; 
then
                IBM_ARCH=rs6000
        else
                IBM_ARCH=powerpc
        fi
        if test -x /usr/bin/lslpp ; then
-               IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
-                          awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
+               IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc |
+                          awk -F: '{ print $3 }' | sed s/[0-9]*$/0/)
        else
                IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
        fi
@@ -650,14 +661,14 @@ EOF
        echo m68k-hp-bsd4.4
        exit ;;
     9000/[34678]??:HP-UX:*:*)
-       HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
+       HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
        case "$UNAME_MACHINE" in
            9000/31?)            HP_ARCH=m68000 ;;
            9000/[34]??)         HP_ARCH=m68k ;;
            9000/[678][0-9][0-9])
                if test -x /usr/bin/getconf; then
-                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                   sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                   sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 
2>/dev/null)
+                   sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 
2>/dev/null)
                    case "$sc_cpu_version" in
                      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
                      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
@@ -704,7 +715,7 @@ EOF
                    exit (0);
                }
 EOF
-                   (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 
2>/dev/null) && HP_ARCH=`"$dummy"`
+                   (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 
2>/dev/null) && HP_ARCH=$("$dummy")
                    test -z "$HP_ARCH" && HP_ARCH=hppa
                fi ;;
        esac
@@ -732,7 +743,7 @@ EOF
        echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
        exit ;;
     ia64:HP-UX:*:*)
-       HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
+       HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
        echo ia64-hp-hpux"$HPUX_REV"
        exit ;;
     3050*:HI-UX:*:*)
@@ -762,7 +773,7 @@ EOF
          exit (0);
        }
 EOF
-       $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
+       $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") &&
                { echo "$SYSTEM_NAME"; exit; }
        echo unknown-hitachi-hiuxwe2
        exit ;;
@@ -831,14 +842,14 @@ EOF
        echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
        exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-       FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ 
abcdefghijklmnopqrstuvwxyz`
-       FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ 
abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
-       FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
+       FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ 
abcdefghijklmnopqrstuvwxyz)
+       FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ 
abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
+       FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/')
        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
        exit ;;
     5000:UNIX_System_V:4.*:*)
-       FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ 
abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
-       FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ 
abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+       FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ 
abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
+       FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ 
abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/')
        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
        exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -851,25 +862,25 @@ EOF
        echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
        exit ;;
     arm:FreeBSD:*:*)
-       UNAME_PROCESSOR=`uname -p`
+       UNAME_PROCESSOR=$(uname -p)
        set_cc_for_build
        if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
            | grep -q __ARM_PCS_VFP
        then
-           echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo 
${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi
+           echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo 
${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi
        else
-           echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo 
${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf
+           echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo 
${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf
        fi
        exit ;;
     *:FreeBSD:*:*)
-       UNAME_PROCESSOR=`/usr/bin/uname -p`
+       UNAME_PROCESSOR=$(/usr/bin/uname -p)
        case "$UNAME_PROCESSOR" in
            amd64)
                UNAME_PROCESSOR=x86_64 ;;
            i386)
                UNAME_PROCESSOR=i586 ;;
        esac
-       echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 
's/[-(].*//'`"
+       echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 
's/[-(].*//')"
        exit ;;
     i*:CYGWIN*:*)
        echo "$UNAME_MACHINE"-pc-cygwin
@@ -905,15 +916,15 @@ EOF
        echo x86_64-pc-cygwin
        exit ;;
     prep*:SunOS:5.*:*)
-       echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 
's/[^.]*//'`"
+       echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 
's/[^.]*//')"
        exit ;;
     *:GNU:*:*)
        # the GNU system
-       echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo 
"$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
+       echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo 
"$UNAME_RELEASE"|sed -e 's,/.*$,,')"
        exit ;;
     *:GNU/*:*:*)
        # other systems with GNU libc and userland
-       echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' 
| tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
+       echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' 
| tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC"
        exit ;;
     *:Minix:*:*)
        echo "$UNAME_MACHINE"-unknown-minix
@@ -926,7 +937,7 @@ EOF
        echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     alpha:Linux:*:*)
-       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 
2>/dev/null` in
+       case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 
2>/dev/null) in
          EV5)   UNAME_MACHINE=alphaev5 ;;
          EV56)  UNAME_MACHINE=alphaev56 ;;
          PCA56) UNAME_MACHINE=alphapca56 ;;
@@ -1035,7 +1046,7 @@ EOF
        #endif
        #endif
 EOF
-       eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep 
'^CPU\|^MIPS_ENDIAN\|^LIBCABI'`"
+       eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep 
'^CPU\|^MIPS_ENDIAN\|^LIBCABI')"
        test "x$CPU" != x && { echo 
"$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
        ;;
     mips64el:Linux:*:*)
@@ -1055,7 +1066,7 @@ EOF
        exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
        # Look for CPU level
-       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+       case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in
          PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
          PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
          *)    echo hppa-unknown-linux-"$LIBC" ;;
@@ -1145,7 +1156,7 @@ EOF
        echo "$UNAME_MACHINE"-pc-msdosdjgpp
        exit ;;
     i*86:*:4.*:*)
-       UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
+       UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//')
        if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
                echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
        else
@@ -1154,7 +1165,7 @@ EOF
        exit ;;
     i*86:*:5:[678]*)
        # UnixWare 7.x, OpenUNIX and OpenServer 6.
-       case `/bin/uname -X | grep "^Machine"` in
+       case $(/bin/uname -X | grep "^Machine") in
            *486*)           UNAME_MACHINE=i486 ;;
            *Pentium)        UNAME_MACHINE=i586 ;;
            *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
@@ -1163,10 +1174,10 @@ EOF
        exit ;;
     i*86:*:3.2:*)
        if test -f /usr/options/cb.name; then
-               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               UNAME_REL=$(sed -n 's/.*Version //p' </usr/options/cb.name)
                echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
        elif /bin/uname -X 2>/dev/null >/dev/null ; then
-               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //'))
                (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
                (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
                        && UNAME_MACHINE=i586
@@ -1216,7 +1227,7 @@ EOF
     3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 
3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | 
SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
        OS_REL=''
        test -r /etc/.relid \
-       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)
        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
          && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
        /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
@@ -1227,7 +1238,7 @@ EOF
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
        OS_REL='.3'
        test -r /etc/.relid \
-           && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < 
/etc/.relid`
+           && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < 
/etc/.relid)
        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
            && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
        /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
@@ -1260,7 +1271,7 @@ EOF
        exit ;;
     *:SINIX-*:*:*)
        if uname -p 2>/dev/null >/dev/null ; then
-               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               UNAME_MACHINE=$( (uname -p) 2>/dev/null)
                echo "$UNAME_MACHINE"-sni-sysv4
        else
                echo ns32k-sni-sysv
@@ -1346,7 +1357,7 @@ EOF
        echo aarch64-apple-darwin"$UNAME_RELEASE"
        exit ;;
     *:Darwin:*:*)
-       UNAME_PROCESSOR=`uname -p`
+       UNAME_PROCESSOR=$(uname -p)
        case $UNAME_PROCESSOR in
            unknown) UNAME_PROCESSOR=powerpc ;;
        esac
@@ -1383,7 +1394,7 @@ EOF
        echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
        exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
-       UNAME_PROCESSOR=`uname -p`
+       UNAME_PROCESSOR=$(uname -p)
        if test "$UNAME_PROCESSOR" = x86; then
                UNAME_PROCESSOR=i386
                UNAME_MACHINE=pc
@@ -1451,10 +1462,10 @@ EOF
        echo mips-sei-seiux"$UNAME_RELEASE"
        exit ;;
     *:DragonFly:*:*)
-       echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 
's/[-(].*//'`"
+       echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 
's/[-(].*//')"
        exit ;;
     *:*VMS:*:*)
-       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       UNAME_MACHINE=$( (uname -p) 2>/dev/null)
        case "$UNAME_MACHINE" in
            A*) echo alpha-dec-vms ; exit ;;
            I*) echo ia64-dec-vms ; exit ;;
@@ -1464,7 +1475,7 @@ EOF
        echo i386-pc-xenix
        exit ;;
     i*86:skyos:*:*)
-       echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ 
.*$//'`"
+       echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ 
.*$//')"
        exit ;;
     i*86:rdos:*:*)
        echo "$UNAME_MACHINE"-pc-rdos
@@ -1522,7 +1533,7 @@ main ()
 #define __ARCHITECTURE__ "m68k"
 #endif
   int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 
2>/dev/null);
   if (version < 4)
     printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
   else
@@ -1614,7 +1625,7 @@ main ()
 }
 EOF
 
-$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) &&
        { echo "$SYSTEM_NAME"; exit; }
 
 # Apollos put the system type in the environment.
@@ -1639,14 +1650,14 @@ This script (version $timestamp), has failed to 
recognize the
 operating system you are using. If your script is old, overwrite *all*
 copies of config.guess and config.sub with the latest versions from:
 
-  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
 and
-  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
 EOF
 
-year=`echo $timestamp | sed 's,-.*,,'`
+year=$(echo $timestamp | sed 's,-.*,,')
 # shellcheck disable=SC2003
-if test "`expr "\`date +%Y\`" - "$year"`" -lt 3 ; then
+if test "$(expr "$(date +%Y)" - "$year")" -lt 3 ; then
    cat >&2 <<EOF
 
 If $0 has already been updated, send the following data and any
@@ -1655,20 +1666,20 @@ provide the necessary information to handle your system.
 
 config.guess timestamp = $timestamp
 
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
+uname -m = $( (uname -m) 2>/dev/null || echo unknown)
+uname -r = $( (uname -r) 2>/dev/null || echo unknown)
+uname -s = $( (uname -s) 2>/dev/null || echo unknown)
+uname -v = $( (uname -v) 2>/dev/null || echo unknown)
 
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null)
+/bin/uname -X     = $( (/bin/uname -X) 2>/dev/null)
 
-hostinfo               = `(hostinfo) 2>/dev/null`
-/bin/universe          = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch              = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+hostinfo               = $( (hostinfo) 2>/dev/null)
+/bin/universe          = $( (/bin/universe) 2>/dev/null)
+/usr/bin/arch -k       = $( (/usr/bin/arch -k) 2>/dev/null)
+/bin/arch              = $( (/bin/arch) 2>/dev/null)
+/usr/bin/oslevel       = $( (/usr/bin/oslevel) 2>/dev/null)
+/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null)
 
 UNAME_MACHINE = "$UNAME_MACHINE"
 UNAME_RELEASE = "$UNAME_RELEASE"
diff --git a/build-aux/config.sub b/build-aux/config.sub
index 0753e30..90bb8ae 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -2,7 +2,7 @@
 # Configuration validation subroutine script.
 #   Copyright 1992-2020 Free Software Foundation, Inc.
 
-timestamp='2020-08-17'
+timestamp='2020-12-22'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ timestamp='2020-08-17'
 # Otherwise, we print the canonical config type on stdout and succeed.
 
 # You can get the latest version of this script from:
-# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
 
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
@@ -50,7 +50,7 @@ timestamp='2020-08-17'
 #      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
 # It is wrong to echo any other type of specification.
 
-me=`echo "$0" | sed -e 's,.*/,,'`
+me=$(echo "$0" | sed -e 's,.*/,,')
 
 usage="\
 Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
@@ -769,22 +769,22 @@ case $basic_machine in
                vendor=hp
                ;;
        i*86v32)
-               cpu=`echo "$1" | sed -e 's/86.*/86/'`
+               cpu=$(echo "$1" | sed -e 's/86.*/86/')
                vendor=pc
                basic_os=sysv32
                ;;
        i*86v4*)
-               cpu=`echo "$1" | sed -e 's/86.*/86/'`
+               cpu=$(echo "$1" | sed -e 's/86.*/86/')
                vendor=pc
                basic_os=sysv4
                ;;
        i*86v)
-               cpu=`echo "$1" | sed -e 's/86.*/86/'`
+               cpu=$(echo "$1" | sed -e 's/86.*/86/')
                vendor=pc
                basic_os=sysv
                ;;
        i*86sol2)
-               cpu=`echo "$1" | sed -e 's/86.*/86/'`
+               cpu=$(echo "$1" | sed -e 's/86.*/86/')
                vendor=pc
                basic_os=solaris2
                ;;
@@ -917,7 +917,7 @@ case $basic_machine in
                ;;
        leon-*|leon[3-9]-*)
                cpu=sparc
-               vendor=`echo "$basic_machine" | sed 's/-.*//'`
+               vendor=$(echo "$basic_machine" | sed 's/-.*//')
                ;;
 
        *-*)
@@ -1084,7 +1084,7 @@ case $cpu-$vendor in
                cpu=mipsisa64sb1el
                ;;
        sh5e[lb]-*)
-               cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
+               cpu=$(echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/')
                ;;
        spur-*)
                cpu=spur
@@ -1102,7 +1102,7 @@ case $cpu-$vendor in
                cpu=x86_64
                ;;
        xscale-* | xscalee[bl]-*)
-               cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
+               cpu=$(echo "$cpu" | sed 's/^xscale/arm/')
                ;;
        arm64-*)
                cpu=aarch64
@@ -1185,6 +1185,7 @@ case $cpu-$vendor in
                        | k1om \
                        | le32 | le64 \
                        | lm32 \
+                       | loongarch32 | loongarch64 | loongarchx32 \
                        | m32c | m32r | m32rle \
                        | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | 
m68k \
                        | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
@@ -1241,6 +1242,7 @@ case $cpu-$vendor in
                        | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
                        | spu \
                        | tahoe \
+                       | thumbv7* \
                        | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
                        | tron \
                        | ubicom32 \
@@ -1286,11 +1288,15 @@ then
 case $basic_os in
        gnu/linux*)
                kernel=linux
-               os=`echo $basic_os | sed -e 's|gnu/linux|gnu|'`
+               os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|')
+               ;;
+       os2-emx)
+               kernel=os2
+               os=$(echo $basic_os | sed -e 's|os2-emx|emx|')
                ;;
        nto-qnx*)
                kernel=nto
-               os=`echo $basic_os | sed -e 's|nto-qnx|qnx|'`
+               os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|')
                ;;
        *-*)
                # shellcheck disable=SC2162
@@ -1301,11 +1307,11 @@ EOF
        # Default OS when just kernel was specified
        nto*)
                kernel=nto
-               os=`echo $basic_os | sed -e 's|nto|qnx|'`
+               os=$(echo $basic_os | sed -e 's|nto|qnx|')
                ;;
        linux*)
                kernel=linux
-               os=`echo $basic_os | sed -e 's|linux|gnu|'`
+               os=$(echo $basic_os | sed -e 's|linux|gnu|')
                ;;
        *)
                kernel=
@@ -1326,7 +1332,7 @@ case $os in
                os=cnk
                ;;
        solaris1 | solaris1.*)
-               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               os=$(echo $os | sed -e 's|solaris1|sunos4|')
                ;;
        solaris)
                os=solaris2
@@ -1355,7 +1361,7 @@ case $os in
                os=sco3.2v4
                ;;
        sco3.2.[4-9]*)
-               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               os=$(echo $os | sed -e 's/sco3.2./sco3.2v/')
                ;;
        sco*v* | scout)
                # Don't match below
@@ -1367,13 +1373,7 @@ case $os in
                os=psos
                ;;
        qnx*)
-               case $cpu in
-                   x86 | i*86)
-                       ;;
-                   *)
-                       os=nto-$os
-                       ;;
-               esac
+               os=qnx
                ;;
        hiux*)
                os=hiuxwe2
@@ -1391,7 +1391,7 @@ case $os in
                os=lynxos
                ;;
        mac[0-9]*)
-               os=`echo "$os" | sed -e 's|mac|macos|'`
+               os=$(echo "$os" | sed -e 's|mac|macos|')
                ;;
        opened*)
                os=openedition
@@ -1400,10 +1400,10 @@ case $os in
                os=os400
                ;;
        sunos5*)
-               os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
+               os=$(echo "$os" | sed -e 's|sunos5|solaris2|')
                ;;
        sunos6*)
-               os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
+               os=$(echo "$os" | sed -e 's|sunos6|solaris3|')
                ;;
        wince*)
                os=wince
@@ -1437,7 +1437,7 @@ case $os in
                ;;
        # Preserve the version number of sinix5.
        sinix5.*)
-               os=`echo $os | sed -e 's|sinix|sysv|'`
+               os=$(echo $os | sed -e 's|sinix|sysv|')
                ;;
        sinix*)
                os=sysv4
@@ -1722,7 +1722,7 @@ case $os in
             | skyos* | haiku* | rdos* | toppers* | drops* | es* \
             | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
             | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
-            | nsk* | powerunix* | genode* | zvmoe* )
+            | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*)
                ;;
        # This one is extra strict with allowed versions
        sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
@@ -1741,6 +1741,8 @@ esac
 case $kernel-$os in
        linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | 
linux-musl* | linux-uclibc* )
                ;;
+       uclinux-uclibc* )
+               ;;
        -dietlibc* | -newlib* | -musl* | -uclibc* )
                # These are just libc implementations, not actual OSes, and thus
                # require a kernel.
@@ -1751,6 +1753,8 @@ case $kernel-$os in
                ;;
        nto-qnx*)
                ;;
+       os2-emx)
+               ;;
        *-eabi* | *-gnueabi*)
                ;;
        -*)
diff --git a/build-aux/install-sh b/build-aux/install-sh
index b34a8fc..ec298b5 100755
--- a/build-aux/install-sh
+++ b/build-aux/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2020-07-26.22; # UTC
+scriptversion=2020-11-14.01; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -73,6 +73,7 @@ mode=0755
 # This is like GNU 'install' as of coreutils 8.32 (2020).
 mkdir_umask=22
 
+backupsuffix=
 chgrpcmd=
 chmodcmd=$chmodprog
 chowncmd=
@@ -103,18 +104,28 @@ Options:
      --version  display version info and exit.
 
   -c            (ignored)
-  -C            install only if different (preserve the last data modification 
time)
+  -C            install only if different (preserve data modification time)
   -d            create directories instead of installing files.
   -g GROUP      $chgrpprog installed files to GROUP.
   -m MODE       $chmodprog installed files to MODE.
   -o USER       $chownprog installed files to USER.
+  -p            pass -p to $cpprog.
   -s            $stripprog installed files.
+  -S SUFFIX     attempt to back up existing files, with suffix SUFFIX.
   -t DIRECTORY  install into DIRECTORY.
   -T            report an error if DSTFILE is a directory.
 
 Environment variables override the default commands:
   CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
   RMPROG STRIPPROG
+
+By default, rm is invoked with -f; when overridden with RMPROG,
+it's up to you to specify -f if you want it.
+
+If -S is not specified, no backups are attempted.
+
+Email bug reports to bug-automake@gnu.org.
+Automake home page: https://www.gnu.org/software/automake/
 "
 
 while test $# -ne 0; do
@@ -141,8 +152,13 @@ while test $# -ne 0; do
     -o) chowncmd="$chownprog $2"
         shift;;
 
+    -p) cpprog="$cpprog -p";;
+
     -s) stripcmd=$stripprog;;
 
+    -S) backupsuffix="$2"
+        shift;;
+
     -t)
         is_target_a_directory=always
         dst_arg=$2
@@ -259,6 +275,10 @@ do
     dstdir=$dst
     test -d "$dstdir"
     dstdir_status=$?
+    # Don't chown directories that already exist.
+    if test $dstdir_status = 0; then
+      chowncmd=""
+    fi
   else
 
     # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
@@ -473,6 +493,13 @@ do
     then
       rm -f "$dsttmp"
     else
+      # If $backupsuffix is set, and the file being installed
+      # already exists, attempt a backup.  Don't worry if it fails,
+      # e.g., if mv doesn't support -f.
+      if test -n "$backupsuffix" && test -f "$dst"; then
+        $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
+      fi
+
       # Rename the file to the real destination.
       $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
 
@@ -487,9 +514,9 @@ do
         # file should still install successfully.
         {
           test ! -f "$dst" ||
-          $doit $rmcmd -f "$dst" 2>/dev/null ||
+          $doit $rmcmd "$dst" 2>/dev/null ||
           { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
-            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+            { $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
           } ||
           { echo "$0: cannot unlink or rename $dst" >&2
             (exit 1); exit 1
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 0a26e9f..3c7051d 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2020-06-25.17}
+\def\texinfoversion{2020-10-24.12}
 %
 % Copyright 1985, 1986, 1988, 1990-2020 Free Software Foundation, Inc.
 %
@@ -1088,7 +1088,7 @@ where each line of input produces a line of output.}
     }
     % The -2 in the arguments here gives all the input to TeX catcode 12
     % (other) or 10 (space), preventing undefined control sequence errors. See
-    % https://lists.gnu.org/r/bug-texinfo/2019-08/msg00031.html
+    % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
     %
   \endgroup
   \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
@@ -3038,10 +3038,18 @@ end
 % arg (if given), and not the url (which is then just the link target).
 \newif\ifurefurlonlylink
 
+% The default \pretolerance setting stops the penalty inserted in
+% \urefallowbreak being a discouragement to line breaking.  Set it to
+% a negative value for this paragraph only.  Hopefully this does not
+% conflict with redefinitions of \par done elsewhere.
+\def\nopretolerance{%
+\pretolerance=-1
+\def\par{\endgraf\pretolerance=100 \let\par\endgraf}%
+}
+
 % The main macro is \urefbreak, which allows breaking at expected
-% places within the url.  (There used to be another version, which
-% didn't support automatic breaking.)
-\def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
+% places within the url.
+\def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak}
 \let\uref=\urefbreak
 %
 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
@@ -3152,14 +3160,14 @@ end
 
 % Allow a ragged right output to aid breaking long URL's.  There can
 % be a break at the \allowbreak with no extra glue (if the existing stretch in
-% the line is sufficient), a break at the \penalty100 with extra glue added
+% the line is sufficient), a break at the \penalty with extra glue added
 % at the end of the line, or no break at all here.
 %   Changing the value of the penalty and/or the amount of stretch affects how
 % preferable one choice is over the other.
 \def\urefallowbreak{%
-  \allowbreak
+  \penalty0\relax
   \hskip 0pt plus 2 em\relax
-  \penalty300
+  \penalty1000\relax
   \hskip 0pt plus -2 em\relax
 }
 
@@ -3356,6 +3364,25 @@ end
 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
 \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
 
+% provide this command from LaTeX as it is very common
+\def\frac#1#2{{{#1}\over{#2}}}
+
+% @displaymath.
+% \globaldefs is needed to recognize the end lines in \tex and
+% \end tex.  Set \thisenv as @end displaymath is seen before @end tex.
+{\obeylines
+\globaldefs=1
+\envdef\displaymath{%
+\tex
+\def\thisenv{\displaymath}%
+$$%
+}
+
+\def\Edisplaymath{$$
+\def\thisenv{\tex}%
+\end tex
+}}
+
 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
 % except specified as a normal braced arg, so no newlines to worry about.
@@ -7639,7 +7666,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \endgroup
 %
 \envdef\verbatim{%
-    \setupverbatim\doverbatim
+    \setnormaldispenv\setupverbatim\doverbatim
 }
 \let\Everbatim = \afterenvbreak
 
@@ -11459,6 +11486,18 @@ directory should work if nowhere else does.}
   \globaldefs = 0
 }}
 
+\def\bsixpaper{{\globaldefs = 1
+  \afourpaper
+  \internalpagesizes{140mm}{100mm}%
+                    {-6.35mm}{-12.7mm}%
+                    {\bindingoffset}{14pt}%
+                    {176mm}{125mm}%
+  \let\SETdispenvsize=\smallword
+  \lispnarrowing = 0.2in
+  \globaldefs = 0
+}}
+
+
 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
 % Perhaps we should allow setting the margins, \topskip, \parskip,
 % and/or leading, also. Or perhaps we should compute them somehow.
@@ -11472,12 +11511,12 @@ directory should work if nowhere else does.}
   \setleading{\textleading}%
   %
   \dimen0 = #1\relax
-  \advance\dimen0 by \voffset
-  \advance\dimen0 by 1in % reference point for DVI is 1 inch from top of page
+  \advance\dimen0 by 2.5in % default 1in margin above heading line
+                           % and 1.5in to include heading, footing and
+                           % bottom margin
   %
   \dimen2 = \hsize
-  \advance\dimen2 by \normaloffset
-  \advance\dimen2 by 1in % reference point is 1 inch from left edge of page
+  \advance\dimen2 by 2in % default to 1 inch margin on each side
   %
   \internalpagesizes{#1}{\hsize}%
                     {\voffset}{\normaloffset}%
diff --git a/lib/attribute.h b/lib/attribute.h
index 2836b99..5afcb8e 100644
--- a/lib/attribute.h
+++ b/lib/attribute.h
@@ -80,7 +80,7 @@
 /* Attributes for variadic functions.  */
 
 /* The variadic function expects a trailing NULL argument.
-   ATTRIBUTE_SENTINEL () - The last argument is NULL.
+   ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99).
    ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL.  */
 /* Applies to: functions.  */
 #define ATTRIBUTE_SENTINEL(pos) _GL_ATTRIBUTE_SENTINEL (pos)
@@ -170,18 +170,21 @@
 /* Applies to: function.  */
 #define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE
 
-/* The function does not affect observable state, and always returns a value.
-   Compilers can omit duplicate calls with the same arguments if
-   observable state is not changed between calls.  (This attribute is
-   looser than ATTRIBUTE_CONST.)  */
+/* It is OK for a compiler to omit duplicate calls with the same arguments.
+   This attribute is safe for a function that neither depends on
+   nor affects observable state, and always returns exactly once -
+   e.g., does not loop forever, and does not call longjmp.
+   (This attribute is stricter than ATTRIBUTE_PURE.)  */
 /* Applies to: functions.  */
-#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
+#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
 
-/* The function neither depends on nor affects observable state,
-   and always returns a value.  Compilers can omit duplicate calls with
-   the same arguments.  (This attribute is stricter than ATTRIBUTE_PURE.)  */
+/* It is OK for a compiler to omit duplicate calls with the same
+   arguments if observable state is not changed between calls.
+   This attribute is safe for a function that does not affect
+   observable state, and always returns exactly once.
+   (This attribute is looser than ATTRIBUTE_CONST.)  */
 /* Applies to: functions.  */
-#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
+#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
 
 /* The function is rarely executed.  */
 /* Applies to: functions.  */
diff --git a/lib/c++defs.h b/lib/c++defs.h
index 6a9bf29..01ef814 100644
--- a/lib/c++defs.h
+++ b/lib/c++defs.h
@@ -181,6 +181,14 @@
     _GL_EXTERN_C int _gl_cxxalias_dummy
 #endif
 
+/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
+   is like  _GL_CXXALIAS_MDA (func, rettype, parameters);
+   except that the C function func may have a slightly different declaration.
+   A cast is used to silence the "invalid conversion" error that would
+   otherwise occur.  */
+#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
+  _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
+
 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
    declares a C++ alias called GNULIB_NAMESPACE::func
    that redirects to the system provided function func, if GNULIB_NAMESPACE
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index 0b89d2a..584fce1 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -2,18 +2,19 @@
    Copyright (C) 1996-2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
 
-   This program is distributed in the hope that it will be useful,
+   The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+   You should have received a copy of the GNU General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
 
 #ifndef _LIBC
 /* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
@@ -21,36 +22,36 @@
 # define _GL_ARG_NONNULL(params)
 
 # define _GL_USE_STDLIB_ALLOC 1
-# include <config.h>
+# include <libc-config.h>
 #endif
 
-#if !HAVE_CANONICALIZE_FILE_NAME || !FUNC_REALPATH_WORKS || defined _LIBC
-
 /* Specification.  */
 #include <stdlib.h>
 
-#include <alloca.h>
-#include <string.h>
-#include <unistd.h>
-#include <limits.h>
-#if HAVE_SYS_PARAM_H || defined _LIBC
-# include <sys/param.h>
-#endif
-#include <sys/stat.h>
 #include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
 #include <stddef.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <scratch_buffer.h>
 
 #ifdef _LIBC
+# include <eloop-threshold.h>
 # include <shlib-compat.h>
+typedef ptrdiff_t idx_t;
+# define IDX_MAX PTRDIFF_MAX
+# define FILE_SYSTEM_PREFIX_LEN(name) 0
+# define IS_ABSOLUTE_FILE_NAME(name) ISSLASH(*(name))
+# define ISSLASH(c) ((c) == '/')
+# define freea(p) ((void) (p))
 #else
-# define SHLIB_COMPAT(lib, introduced, obsoleted) 0
-# define versioned_symbol(lib, local, symbol, version) extern int dummy
-# define compat_symbol(lib, local, symbol, version)
-# define weak_alias(local, symbol)
 # define __canonicalize_file_name canonicalize_file_name
 # define __realpath realpath
+# include "idx.h"
 # include "pathmax.h"
-# include "malloca.h"
 # include "filename.h"
 # if defined _WIN32 && !defined __CYGWIN__
 #  define __getcwd _getcwd
@@ -72,8 +73,10 @@
 # else
 #  define __getcwd(buf, max) getwd (buf)
 # endif
+# define __mempcpy mempcpy
+# define __pathconf pathconf
+# define __rawmemchr rawmemchr
 # define __readlink readlink
-# define __set_errno(e) errno = (e)
 # ifndef MAXSYMLINKS
 #  ifdef SYMLOOP_MAX
 #   define MAXSYMLINKS SYMLOOP_MAX
@@ -81,48 +84,51 @@
 #   define MAXSYMLINKS 20
 #  endif
 # endif
+# define __eloop_threshold() MAXSYMLINKS
 #endif
 
 #ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
 # define DOUBLE_SLASH_IS_DISTINCT_ROOT 0
 #endif
 
-/* Define this independently so that stdint.h is not a prerequisite.  */
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
-
 #if !FUNC_REALPATH_WORKS || defined _LIBC
 
-static void
-alloc_failed (void)
+static idx_t
+get_path_max (void)
 {
-#if defined _WIN32 && ! defined __CYGWIN__
-  /* Avoid errno problem without using the malloc or realloc modules; see:
-     https://lists.gnu.org/r/bug-gnulib/2016-08/msg00025.html  */
-  errno = ENOMEM;
-#endif
+# ifdef PATH_MAX
+  long int path_max = PATH_MAX;
+# else
+  /* The caller invoked realpath with a null RESOLVED, even though
+     PATH_MAX is not defined as a constant.  The glibc manual says
+     programs should not do this, and POSIX says the behavior is undefined.
+     Historically, glibc here used the result of pathconf, or 1024 if that
+     failed; stay consistent with this (dubious) historical practice.  */
+  int err = errno;
+  long int path_max = __pathconf ("/", _PC_PATH_MAX);
+  __set_errno (err);
+# endif
+  return path_max < 0 ? 1024 : path_max <= IDX_MAX ? path_max : IDX_MAX;
 }
 
 /* Return the canonical absolute name of file NAME.  A canonical name
-   does not contain any ".", ".." components nor any repeated path
-   separators ('/') or symlinks.  All path components must exist.  If
+   does not contain any ".", ".." components nor any repeated file name
+   separators ('/') or symlinks.  All file name components must exist.  If
    RESOLVED is null, the result is malloc'd; otherwise, if the
    canonical name is PATH_MAX chars or more, returns null with 'errno'
    set to ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars,
    returns the name in RESOLVED.  If the name cannot be resolved and
-   RESOLVED is non-NULL, it contains the path of the first component
-   that cannot be resolved.  If the path can be resolved, RESOLVED
+   RESOLVED is non-NULL, it contains the name of the first component
+   that cannot be resolved.  If the name can be resolved, RESOLVED
    holds the same value as the value returned.  */
 
 char *
 __realpath (const char *name, char *resolved)
 {
-  char *rpath, *dest, *extra_buf = NULL;
-  const char *start, *end, *rpath_limit;
-  long int path_max;
+  char *dest;
+  char const *start;
+  char const *end;
   int num_links = 0;
-  size_t prefix_len;
 
   if (name == NULL)
     {
@@ -142,205 +148,151 @@ __realpath (const char *name, char *resolved)
       return NULL;
     }
 
-#ifdef PATH_MAX
-  path_max = PATH_MAX;
-#else
-  path_max = pathconf (name, _PC_PATH_MAX);
-  if (path_max <= 0)
-    path_max = 8192;
-#endif
-
-  if (resolved == NULL)
-    {
-      rpath = malloc (path_max);
-      if (rpath == NULL)
-        {
-          alloc_failed ();
-          return NULL;
-        }
-    }
-  else
-    rpath = resolved;
-  rpath_limit = rpath + path_max;
+  struct scratch_buffer extra_buffer, link_buffer;
+  struct scratch_buffer rname_buffer;
+  struct scratch_buffer *rname_buf = &rname_buffer;
+  scratch_buffer_init (&extra_buffer);
+  scratch_buffer_init (&link_buffer);
+  scratch_buffer_init (rname_buf);
+  char *rname_on_stack = rname_buf->data;
+  char *rname = rname_on_stack;
+  bool end_in_extra_buffer = false;
+  bool failed = true;
 
   /* This is always zero for Posix hosts, but can be 2 for MS-Windows
      and MS-DOS X:/foo/bar file names.  */
-  prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
+  idx_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
 
   if (!IS_ABSOLUTE_FILE_NAME (name))
     {
-      if (!__getcwd (rpath, path_max))
+      while (!__getcwd (rname, rname_buf->length))
         {
-          rpath[0] = '\0';
-          goto error;
+          if (errno != ERANGE)
+            {
+              dest = rname;
+              goto error;
+            }
+          if (!scratch_buffer_grow (rname_buf))
+            goto error_nomem;
+          rname = rname_buf->data;
         }
-      dest = strchr (rpath, '\0');
+      dest = __rawmemchr (rname, '\0');
       start = name;
-      prefix_len = FILE_SYSTEM_PREFIX_LEN (rpath);
+      prefix_len = FILE_SYSTEM_PREFIX_LEN (rname);
     }
   else
     {
-      dest = rpath;
-      if (prefix_len)
-        {
-          memcpy (rpath, name, prefix_len);
-          dest += prefix_len;
-        }
+      dest = __mempcpy (rname, name, prefix_len);
       *dest++ = '/';
       if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
         {
-          if (ISSLASH (name[1]) && !ISSLASH (name[2]) && !prefix_len)
+          if (prefix_len == 0 /* implies ISSLASH (name[0]) */
+              && ISSLASH (name[1]) && !ISSLASH (name[2]))
             *dest++ = '/';
           *dest = '\0';
         }
       start = name + prefix_len;
     }
 
-  for (end = start; *start; start = end)
+  for ( ; *start; start = end)
     {
-#ifdef _LIBC
-      struct stat64 st;
-#else
-      struct stat st;
-#endif
-
-      /* Skip sequence of multiple path-separators.  */
+      /* Skip sequence of multiple file name separators.  */
       while (ISSLASH (*start))
         ++start;
 
-      /* Find end of path component.  */
+      /* Find end of component.  */
       for (end = start; *end && !ISSLASH (*end); ++end)
         /* Nothing.  */;
 
-      if (end - start == 0)
-        break;
-      else if (end - start == 1 && start[0] == '.')
+      /* Length of this file name component; it can be zero if a file
+         name ends in '/'.  */
+      idx_t startlen = end - start;
+
+      if (startlen == 1 && start[0] == '.')
         /* nothing */;
-      else if (end - start == 2 && start[0] == '.' && start[1] == '.')
+      else if (startlen == 2 && start[0] == '.' && start[1] == '.')
         {
           /* Back up to previous component, ignore if at root already.  */
-          if (dest > rpath + prefix_len + 1)
-            for (--dest; dest > rpath && !ISSLASH (dest[-1]); --dest)
+          if (dest > rname + prefix_len + 1)
+            for (--dest; dest > rname && !ISSLASH (dest[-1]); --dest)
               continue;
           if (DOUBLE_SLASH_IS_DISTINCT_ROOT
-              && dest == rpath + 1 && !prefix_len
+              && dest == rname + 1 && !prefix_len
               && ISSLASH (*dest) && !ISSLASH (dest[1]))
             dest++;
         }
       else
         {
-          size_t new_size;
-
           if (!ISSLASH (dest[-1]))
             *dest++ = '/';
 
-          if (dest + (end - start) >= rpath_limit)
+          while (rname + rname_buf->length - dest <= startlen)
             {
-              ptrdiff_t dest_offset = dest - rpath;
-              char *new_rpath;
-
-              if (resolved)
-                {
-                  __set_errno (ENAMETOOLONG);
-                  if (dest > rpath + prefix_len + 1)
-                    dest--;
-                  *dest = '\0';
-                  goto error;
-                }
-              new_size = rpath_limit - rpath;
-              if (end - start + 1 > path_max)
-                new_size += end - start + 1;
-              else
-                new_size += path_max;
-              new_rpath = (char *) realloc (rpath, new_size);
-              if (new_rpath == NULL)
-                {
-                  alloc_failed ();
-                  goto error;
-                }
-              rpath = new_rpath;
-              rpath_limit = rpath + new_size;
-
-              dest = rpath + dest_offset;
+              idx_t dest_offset = dest - rname;
+              if (!scratch_buffer_grow_preserve (rname_buf))
+                goto error_nomem;
+              rname = rname_buf->data;
+              dest = rname + dest_offset;
             }
 
-#ifdef _LIBC
-          dest = __mempcpy (dest, start, end - start);
-#else
-          memcpy (dest, start, end - start);
-          dest += end - start;
-#endif
+          dest = __mempcpy (dest, start, startlen);
           *dest = '\0';
 
-          /* FIXME: if lstat fails with errno == EOVERFLOW,
-             the entry exists.  */
-#ifdef _LIBC
-          if (__lxstat64 (_STAT_VER, rpath, &st) < 0)
-#else
-          if (lstat (rpath, &st) < 0)
-#endif
-            goto error;
-
-          if (S_ISLNK (st.st_mode))
+          /* If STARTLEN == 0, RNAME ends in '/'; use stat rather than
+             readlink, because readlink might fail with EINVAL without
+             checking whether RNAME sans '/' is valid.  */
+          struct stat st;
+          char *buf = NULL;
+          ssize_t n;
+          if (startlen != 0)
             {
-              char *buf;
-              size_t len;
-              ssize_t n;
-
-              if (++num_links > MAXSYMLINKS)
-                {
-                  __set_errno (ELOOP);
-                  goto error;
-                }
-
-              buf = malloca (path_max);
-              if (!buf)
+              while (true)
                 {
-                  __set_errno (ENOMEM);
-                  goto error;
+                  buf = link_buffer.data;
+                  idx_t bufsize = link_buffer.length;
+                  n = __readlink (rname, buf, bufsize - 1);
+                  if (n < bufsize - 1)
+                    break;
+                  if (!scratch_buffer_grow (&link_buffer))
+                    goto error_nomem;
                 }
-
-              n = __readlink (rpath, buf, path_max - 1);
               if (n < 0)
+                buf = NULL;
+            }
+          if (buf)
+            {
+              if (++num_links > __eloop_threshold ())
                 {
-                  int saved_errno = errno;
-                  freea (buf);
-                  __set_errno (saved_errno);
+                  __set_errno (ELOOP);
                   goto error;
                 }
-              buf[n] = '\0';
 
-              if (!extra_buf)
-                {
-                  extra_buf = malloca (path_max);
-                  if (!extra_buf)
-                    {
-                      freea (buf);
-                      __set_errno (ENOMEM);
-                      goto error;
-                    }
-                }
+              buf[n] = '\0';
 
-              len = strlen (end);
-              /* Check that n + len + 1 doesn't overflow and is <= path_max. */
-              if (n >= SIZE_MAX - len || n + len >= path_max)
+              char *extra_buf = extra_buffer.data;
+              idx_t end_idx;
+              if (end_in_extra_buffer)
+                end_idx = end - extra_buf;
+              idx_t len = strlen (end);
+              while (extra_buffer.length <= len + n)
                 {
-                  freea (buf);
-                  __set_errno (ENAMETOOLONG);
-                  goto error;
+                  if (!scratch_buffer_grow_preserve (&extra_buffer))
+                    goto error_nomem;
+                  extra_buf = extra_buffer.data;
                 }
+              if (end_in_extra_buffer)
+                end = extra_buf + end_idx;
 
               /* Careful here, end may be a pointer into extra_buf... */
               memmove (&extra_buf[n], end, len + 1);
               name = end = memcpy (extra_buf, buf, n);
+              end_in_extra_buffer = true;
 
               if (IS_ABSOLUTE_FILE_NAME (buf))
                 {
-                  size_t pfxlen = FILE_SYSTEM_PREFIX_LEN (buf);
+                  idx_t pfxlen = FILE_SYSTEM_PREFIX_LEN (buf);
 
-                  if (pfxlen)
-                    memcpy (rpath, buf, pfxlen);
-                  dest = rpath + pfxlen;
+                  dest = __mempcpy (rname, buf, pfxlen);
                   *dest++ = '/'; /* It's an absolute symlink */
                   if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
                     {
@@ -355,44 +307,55 @@ __realpath (const char *name, char *resolved)
                 {
                   /* Back up to previous component, ignore if at root
                      already: */
-                  if (dest > rpath + prefix_len + 1)
-                    for (--dest; dest > rpath && !ISSLASH (dest[-1]); --dest)
+                  if (dest > rname + prefix_len + 1)
+                    for (--dest; dest > rname && !ISSLASH (dest[-1]); --dest)
                       continue;
-                  if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
+                  if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rname + 1
                       && ISSLASH (*dest) && !ISSLASH (dest[1]) && !prefix_len)
                     dest++;
                 }
             }
-          else if (!S_ISDIR (st.st_mode) && *end != '\0')
-            {
-              __set_errno (ENOTDIR);
-              goto error;
-            }
+          else if (! (startlen == 0
+                      ? stat (rname, &st) == 0 || errno == EOVERFLOW
+                      : errno == EINVAL))
+            goto error;
         }
     }
-  if (dest > rpath + prefix_len + 1 && ISSLASH (dest[-1]))
+  if (dest > rname + prefix_len + 1 && ISSLASH (dest[-1]))
     --dest;
-  if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1 && !prefix_len
+  if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rname + 1 && !prefix_len
       && ISSLASH (*dest) && !ISSLASH (dest[1]))
     dest++;
-  *dest = '\0';
-
-  if (extra_buf)
-    freea (extra_buf);
-
-  return rpath;
+  failed = false;
 
 error:
-  {
-    int saved_errno = errno;
-    if (extra_buf)
-      freea (extra_buf);
-    if (resolved == NULL)
-      free (rpath);
-    __set_errno (saved_errno);
-  }
-  return NULL;
+  *dest++ = '\0';
+  if (resolved != NULL && dest - rname <= get_path_max ())
+    rname = strcpy (resolved, rname);
+
+error_nomem:
+  scratch_buffer_free (&extra_buffer);
+  scratch_buffer_free (&link_buffer);
+  if (failed || rname == resolved)
+    scratch_buffer_free (rname_buf);
+
+  if (failed)
+    return NULL;
+
+  if (rname == resolved)
+    return rname;
+  idx_t rname_size = dest - rname;
+  if (rname == rname_on_stack)
+    {
+      rname = malloc (rname_size);
+      if (rname == NULL)
+        return NULL;
+      return memcpy (rname, rname_on_stack, rname_size);
+    }
+  char *result = realloc (rname, rname_size);
+  return result != NULL ? result : rname;
 }
+libc_hidden_def (__realpath)
 versioned_symbol (libc, __realpath, realpath, GLIBC_2_3);
 #endif /* !FUNC_REALPATH_WORKS || defined _LIBC */
 
@@ -420,11 +383,3 @@ __canonicalize_file_name (const char *name)
   return __realpath (name, NULL);
 }
 weak_alias (__canonicalize_file_name, canonicalize_file_name)
-
-#else
-
-/* This declaration is solely to ensure that after preprocessing
-   this file is never empty.  */
-typedef int dummy;
-
-#endif
diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c
index e43aa42..26fe84d 100644
--- a/lib/careadlinkat.c
+++ b/lib/careadlinkat.c
@@ -51,8 +51,13 @@ enum { STACK_BUF_SIZE = 1024 };
    to pacify GCC is known; even an explicit #pragma does not pacify GCC.
    When the GCC bug is fixed this workaround should be limited to the
    broken GCC versions.  */
-#if (defined GCC_LINT || defined lint) && _GL_GNUC_PREREQ (10, 1)
+#if _GL_GNUC_PREREQ (10, 1)
+# if defined GCC_LINT || defined lint
 __attribute__ ((__noinline__))
+# elif __OPTIMIZE__ && !__NO_INLINE__
+#  warning "GCC might issue a bogus -Wreturn-local-addr warning here."
+#  warning "See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644>."
+# endif
 #endif
 static char *
 readlink_stk (int fd, char const *filename,
@@ -85,18 +90,13 @@ readlink_stk (int fd, char const *filename,
       size_t link_size;
       if (link_length < 0)
         {
-          /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1
-             with errno == ERANGE if the buffer is too small.  */
-          int readlinkat_errno = errno;
-          if (readlinkat_errno != ERANGE)
+          if (buf != buffer)
             {
-              if (buf != buffer)
-                {
-                  alloc->free (buf);
-                  errno = readlinkat_errno;
-                }
-              return NULL;
+              int readlinkat_errno = errno;
+              alloc->free (buf);
+              errno = readlinkat_errno;
             }
+          return NULL;
         }
 
       link_size = link_length;
diff --git a/lib/cdefs.h b/lib/cdefs.h
index ff7c628..1a2805d 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -75,11 +75,11 @@
 
 /* GCC can always grok prototypes.  For C++ programs we add throw()
    to help it optimize the function calls.  But this works only with
-   gcc 2.8.x and egcs.  For gcc 3.2 and up we even mark C functions
+   gcc 2.8.x and egcs.  For gcc 3.4 and up we even mark C functions
    as non-throwing using a function attribute since programs can use
    the -fexceptions options for C code as well.  */
 # if !defined __cplusplus \
-     && (__GNUC_PREREQ (3, 3) || __glibc_clang_has_attribute (__nothrow__))
+     && (__GNUC_PREREQ (3, 4) || __glibc_clang_has_attribute (__nothrow__))
 #  define __THROW      __attribute__ ((__nothrow__ __LEAF))
 #  define __THROWNL    __attribute__ ((__nothrow__))
 #  define __NTH(fct)   __attribute__ ((__nothrow__ __LEAF)) fct
diff --git a/lib/fcntl.c b/lib/fcntl.c
index 8cd1531..59bb3ca 100644
--- a/lib/fcntl.c
+++ b/lib/fcntl.c
@@ -491,7 +491,9 @@ rpl_fcntl_DUPFD_CLOEXEC (int fd, int target)
 #if !HAVE_FCNTL
   result = dupfd (fd, target, O_CLOEXEC);
 #else /* HAVE_FCNTL */
-# if defined __HAIKU__
+# if defined __NetBSD__ || defined __HAIKU__
+  /* On NetBSD 9.0, the system fcntl (fd, F_DUPFD_CLOEXEC, target)
+     has only the same effect as fcntl (fd, F_DUPFD, target).  */
   /* On Haiku, the system fcntl (fd, F_DUPFD_CLOEXEC, target) sets
      the FD_CLOEXEC flag on fd, not on target.  Therefore avoid the
      system fcntl in this case.  */
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 6f16bc6..11c9aae 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -112,9 +112,21 @@ _GL_CXXALIASWARN (creat);
 /* Assume creat is always declared.  */
 _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - "
                  "use gnulib module creat for portability");
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef creat
-# define creat _creat
+#else
+/* On native Windows, map 'creat' to '_creat', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::creat always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef creat
+#   define creat _creat
+#  endif
+/* Need to cast, because in mingw the last argument is 'int mode'.  */
+_GL_CXXALIAS_MDA_CAST (creat, int, (const char *filename, mode_t mode));
+# else
+_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode));
+# endif
+_GL_CXXALIASWARN (creat);
 #endif
 
 #if @GNULIB_FCNTL@
@@ -174,9 +186,22 @@ _GL_CXXALIASWARN (open);
 /* Assume open is always declared.  */
 _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
                  "use gnulib module open for portability");
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef open
-# define open _open
+#else
+/* On native Windows, map 'open' to '_open', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::open always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef open
+#   define open _open
+#  endif
+_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
+# else
+_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
+# endif
+# if !defined __hpux
+_GL_CXXALIASWARN (open);
+# endif
 #endif
 
 #if @GNULIB_OPENAT@
diff --git a/lib/filemode.c b/lib/filemode.c
index e1b0690..15e3551 100644
--- a/lib/filemode.c
+++ b/lib/filemode.c
@@ -20,17 +20,6 @@
 
 #include "filemode.h"
 
-/* The following is for Cray DMF (Data Migration Facility), which is a
-   HSM file system.  A migrated file has a 'st_dm_mode' that is
-   different from the normal 'st_mode', so any tests for migrated
-   files should use the former.  */
-#if HAVE_ST_DM_MODE
-# define IS_MIGRATED_FILE(statp) \
-    (S_ISOFD (statp->st_dm_mode) || S_ISOFL (statp->st_dm_mode))
-#else
-# define IS_MIGRATED_FILE(statp) 0
-#endif
-
 #if ! HAVE_DECL_STRMODE
 
 /* Return a character indicating the type of file described by
@@ -126,7 +115,6 @@ strmode (mode_t mode, char *str)
         for files whose type cannot be determined solely from st_mode:
 
             'F' semaphore
-            'M' migrated file (Cray DMF)
             'Q' message queue
             'S' shared memory object
             'T' typed memory object
@@ -169,8 +157,6 @@ filemodestring (struct stat const *statp, char *str)
 
   if (S_TYPEISSEM (statp))
     str[0] = 'F';
-  else if (IS_MIGRATED_FILE (statp))
-    str[0] = 'M';
   else if (S_TYPEISMQ (statp))
     str[0] = 'Q';
   else if (S_TYPEISSHM (statp))
diff --git a/lib/fpending.c b/lib/fpending.c
index 802ebcb..836a3a9 100644
--- a/lib/fpending.c
+++ b/lib/fpending.c
@@ -25,7 +25,8 @@
 #include "stdio-impl.h"
 
 /* This file is not used on systems that already have the __fpending function,
-   namely glibc >= 2.2, Solaris >= 7, Android API >= 23.  */
+   namely glibc >= 2.2, Solaris >= 7, UnixWare >= 7.1.4.MP4, Cygwin >= 1.7.34,
+   Android API >= 23.  */
 
 /* Return the number of pending (aka buffered, unflushed)
    bytes on the stream, FP, that is open for writing.  */
@@ -39,13 +40,13 @@ __fpending (FILE *fp)
   /* GNU libc, BeOS, Haiku, Linux libc5 */
   return fp->_IO_write_ptr - fp->_IO_write_base;
 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
-  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, 
Android */
   return fp->_p - fp->_bf._base;
 #elif defined __EMX__                /* emx+gcc */
   return fp->_ptr - fp->_buffer;
 #elif defined __minix                /* Minix */
   return fp_->_ptr - fp_->_buf;
-#elif defined _IOERR                 /* AIX, HP-UX, IRIX, OSF/1, Solaris, 
OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */
+#elif defined _IOERR                 /* AIX, HP-UX, IRIX, OSF/1, Solaris, 
OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
   return (fp_->_ptr ? fp_->_ptr - fp_->_base : 0);
 #elif defined __UCLIBC__             /* uClibc */
   return (fp->__modeflags & __FLAG_WRITING ? fp->__bufpos - fp->__bufstart : 
0);
diff --git a/lib/free.c b/lib/free.c
new file mode 100644
index 0000000..2f689a7
--- /dev/null
+++ b/lib/free.c
@@ -0,0 +1,33 @@
+/* Make free() preserve errno.
+
+   Copyright (C) 2003, 2006, 2009-2020 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <errno.h>
+
+void
+rpl_free (void *p)
+#undef free
+{
+  int err = errno;
+  free (p);
+  errno = err;
+}
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 9953198..df533fa 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -257,6 +257,7 @@ GL_GENERATE_STDINT_H = @GL_GENERATE_STDINT_H@
 GMALLOC_OBJ = @GMALLOC_OBJ@
 GMP_H = @GMP_H@
 GNULIB_ACCESS = @GNULIB_ACCESS@
+GNULIB_ALIGNED_ALLOC = @GNULIB_ALIGNED_ALLOC@
 GNULIB_ALPHASORT = @GNULIB_ALPHASORT@
 GNULIB_ATOLL = @GNULIB_ATOLL@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
@@ -297,6 +298,7 @@ GNULIB_FPURGE = @GNULIB_FPURGE@
 GNULIB_FPUTC = @GNULIB_FPUTC@
 GNULIB_FPUTS = @GNULIB_FPUTS@
 GNULIB_FREAD = @GNULIB_FREAD@
+GNULIB_FREE_POSIX = @GNULIB_FREE_POSIX@
 GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSCANF = @GNULIB_FSCANF@
 GNULIB_FSEEK = @GNULIB_FSEEK@
@@ -388,6 +390,7 @@ GNULIB_PERROR = @GNULIB_PERROR@
 GNULIB_PIPE = @GNULIB_PIPE@
 GNULIB_PIPE2 = @GNULIB_PIPE2@
 GNULIB_POPEN = @GNULIB_POPEN@
+GNULIB_POSIX_MEMALIGN = @GNULIB_POSIX_MEMALIGN@
 GNULIB_POSIX_OPENPT = @GNULIB_POSIX_OPENPT@
 GNULIB_PREAD = @GNULIB_PREAD@
 GNULIB_PRINTF = @GNULIB_PRINTF@
@@ -506,6 +509,7 @@ GTK_OBJ = @GTK_OBJ@
 GZIP_PROG = @GZIP_PROG@
 HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@
 HARFBUZZ_LIBS = @HARFBUZZ_LIBS@
+HAVE_ALIGNED_ALLOC = @HAVE_ALIGNED_ALLOC@
 HAVE_ALLOCA_H = @HAVE_ALLOCA_H@
 HAVE_ALPHASORT = @HAVE_ALPHASORT@
 HAVE_ATOLL = @HAVE_ATOLL@
@@ -515,13 +519,18 @@ HAVE_CHOWN = @HAVE_CHOWN@
 HAVE_CLOSEDIR = @HAVE_CLOSEDIR@
 HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@
 HAVE_DECL_DIRFD = @HAVE_DECL_DIRFD@
+HAVE_DECL_ECVT = @HAVE_DECL_ECVT@
 HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
+HAVE_DECL_EXECVPE = @HAVE_DECL_EXECVPE@
 HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@
+HAVE_DECL_FCLOSEALL = @HAVE_DECL_FCLOSEALL@
+HAVE_DECL_FCVT = @HAVE_DECL_FCVT@
 HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@
 HAVE_DECL_FDOPENDIR = @HAVE_DECL_FDOPENDIR@
 HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@
 HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@
 HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@
+HAVE_DECL_GCVT = @HAVE_DECL_GCVT@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
@@ -621,6 +630,7 @@ HAVE_PDUMPER = @HAVE_PDUMPER@
 HAVE_PIPE = @HAVE_PIPE@
 HAVE_PIPE2 = @HAVE_PIPE2@
 HAVE_POPEN = @HAVE_POPEN@
+HAVE_POSIX_MEMALIGN = @HAVE_POSIX_MEMALIGN@
 HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@
 HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@
 HAVE_PREAD = @HAVE_PREAD@
@@ -863,6 +873,7 @@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RALLOC_OBJ = @RALLOC_OBJ@
 RANLIB = @RANLIB@
 REPLACE_ACCESS = @REPLACE_ACCESS@
+REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@
 REPLACE_CALLOC = @REPLACE_CALLOC@
 REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@
 REPLACE_CHOWN = @REPLACE_CHOWN@
@@ -885,6 +896,7 @@ REPLACE_FFLUSH = @REPLACE_FFLUSH@
 REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
 REPLACE_FPURGE = @REPLACE_FPURGE@
+REPLACE_FREE = @REPLACE_FREE@
 REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
@@ -932,6 +944,7 @@ REPLACE_OPENAT = @REPLACE_OPENAT@
 REPLACE_OPENDIR = @REPLACE_OPENDIR@
 REPLACE_PERROR = @REPLACE_PERROR@
 REPLACE_POPEN = @REPLACE_POPEN@
+REPLACE_POSIX_MEMALIGN = @REPLACE_POSIX_MEMALIGN@
 REPLACE_PREAD = @REPLACE_PREAD@
 REPLACE_PRINTF = @REPLACE_PRINTF@
 REPLACE_PSELECT = @REPLACE_PSELECT@
@@ -1101,12 +1114,15 @@ gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1 = 
@gl_GNULIB_ENABLED_a9786850
 gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36 = 
@gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36@
 gl_GNULIB_ENABLED_cloexec = @gl_GNULIB_ENABLED_cloexec@
 gl_GNULIB_ENABLED_dirfd = @gl_GNULIB_ENABLED_dirfd@
+gl_GNULIB_ENABLED_ef07dc4b3077c11ea9cef586db4e5955 = 
@gl_GNULIB_ENABLED_ef07dc4b3077c11ea9cef586db4e5955@
 gl_GNULIB_ENABLED_euidaccess = @gl_GNULIB_ENABLED_euidaccess@
 gl_GNULIB_ENABLED_getdtablesize = @gl_GNULIB_ENABLED_getdtablesize@
 gl_GNULIB_ENABLED_getgroups = @gl_GNULIB_ENABLED_getgroups@
+gl_GNULIB_ENABLED_idx = @gl_GNULIB_ENABLED_idx@
 gl_GNULIB_ENABLED_lchmod = @gl_GNULIB_ENABLED_lchmod@
-gl_GNULIB_ENABLED_malloca = @gl_GNULIB_ENABLED_malloca@
 gl_GNULIB_ENABLED_open = @gl_GNULIB_ENABLED_open@
+gl_GNULIB_ENABLED_rawmemchr = @gl_GNULIB_ENABLED_rawmemchr@
+gl_GNULIB_ENABLED_scratch_buffer = @gl_GNULIB_ENABLED_scratch_buffer@
 gl_GNULIB_ENABLED_strtoll = @gl_GNULIB_ENABLED_strtoll@
 gl_GNULIB_ENABLED_utimens = @gl_GNULIB_ENABLED_utimens@
 gl_LIBOBJS = @gl_LIBOBJS@
@@ -1731,6 +1747,19 @@ EXTRA_libgnu_a_SOURCES += fpending.c
 endif
 ## end   gnulib module fpending
 
+## begin gnulib module free-posix
+ifeq (,$(OMIT_GNULIB_MODULE_free-posix))
+
+ifneq (,$(gl_GNULIB_ENABLED_ef07dc4b3077c11ea9cef586db4e5955))
+
+endif
+EXTRA_DIST += free.c
+
+EXTRA_libgnu_a_SOURCES += free.c
+
+endif
+## end   gnulib module free-posix
+
 ## begin gnulib module fstatat
 ifeq (,$(OMIT_GNULIB_MODULE_fstatat))
 
@@ -1912,6 +1941,16 @@ EXTRA_libgnu_a_SOURCES += group-member.c
 endif
 ## end   gnulib module group-member
 
+## begin gnulib module idx
+ifeq (,$(OMIT_GNULIB_MODULE_idx))
+
+ifneq (,$(gl_GNULIB_ENABLED_idx))
+libgnu_a_SOURCES += idx.h
+
+endif
+endif
+## end   gnulib module idx
+
 ## begin gnulib module ieee754-h
 ifeq (,$(OMIT_GNULIB_MODULE_ieee754-h))
 
@@ -2094,18 +2133,6 @@ EXTRA_libgnu_a_SOURCES += lstat.c
 endif
 ## end   gnulib module lstat
 
-## begin gnulib module malloca
-ifeq (,$(OMIT_GNULIB_MODULE_malloca))
-
-ifneq (,$(gl_GNULIB_ENABLED_malloca))
-libgnu_a_SOURCES += malloca.c
-
-endif
-EXTRA_DIST += malloca.h
-
-endif
-## end   gnulib module malloca
-
 ## begin gnulib module memmem-simple
 ifeq (,$(OMIT_GNULIB_MODULE_memmem-simple))
 
@@ -2263,6 +2290,19 @@ libgnu_a_SOURCES += qcopy-acl.c
 endif
 ## end   gnulib module qcopy-acl
 
+## begin gnulib module rawmemchr
+ifeq (,$(OMIT_GNULIB_MODULE_rawmemchr))
+
+ifneq (,$(gl_GNULIB_ENABLED_rawmemchr))
+
+endif
+EXTRA_DIST += rawmemchr.c rawmemchr.valgrind
+
+EXTRA_libgnu_a_SOURCES += rawmemchr.c
+
+endif
+## end   gnulib module rawmemchr
+
 ## begin gnulib module readlink
 ifeq (,$(OMIT_GNULIB_MODULE_readlink))
 
@@ -2307,6 +2347,18 @@ EXTRA_DIST += root-uid.h
 endif
 ## end   gnulib module root-uid
 
+## begin gnulib module scratch_buffer
+ifeq (,$(OMIT_GNULIB_MODULE_scratch_buffer))
+
+ifneq (,$(gl_GNULIB_ENABLED_scratch_buffer))
+libgnu_a_SOURCES += malloc/scratch_buffer_grow.c                 
malloc/scratch_buffer_grow_preserve.c                 
malloc/scratch_buffer_set_array_size.c
+
+endif
+EXTRA_DIST += malloc/scratch_buffer.h scratch_buffer.h
+
+endif
+## end   gnulib module scratch_buffer
+
 ## begin gnulib module sig2str
 ifeq (,$(OMIT_GNULIB_MODULE_sig2str))
 
@@ -2618,7 +2670,8 @@ stdio.h: stdio.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H)
              -e 's/@''GNULIB_VSNPRINTF''@/$(GNULIB_VSNPRINTF)/g' \
              -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \
              < $(srcdir)/stdio.in.h | \
-         sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
+         sed -e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \
+             -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
              -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \
              -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \
              -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
@@ -2696,9 +2749,11 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
              -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \
+             -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GNULIB_ALIGNED_ALLOC)/g' \
              -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \
              -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \
              -e 
's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \
+             -e 's/@''GNULIB_FREE_POSIX''@/$(GNULIB_FREE_POSIX)/g' \
              -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \
              -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \
              -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \
@@ -2709,6 +2764,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \
              -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \
              -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
+             -e 's/@''GNULIB_POSIX_MEMALIGN''@/$(GNULIB_POSIX_MEMALIGN)/g' \
              -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \
              -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
              -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \
@@ -2732,8 +2788,12 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \
              < $(srcdir)/stdlib.in.h | \
          sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
+             -e 's|@''HAVE_ALIGNED_ALLOC''@|$(HAVE_ALIGNED_ALLOC)|g' \
              -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
              -e 
's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
+             -e 's|@''HAVE_DECL_ECVT''@|$(HAVE_DECL_ECVT)|g' \
+             -e 's|@''HAVE_DECL_FCVT''@|$(HAVE_DECL_FCVT)|g' \
+             -e 's|@''HAVE_DECL_GCVT''@|$(HAVE_DECL_GCVT)|g' \
              -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
              -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
              -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
@@ -2745,6 +2805,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
              -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
              -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
+             -e 's|@''HAVE_POSIX_MEMALIGN''@|$(HAVE_POSIX_MEMALIGN)|g' \
              -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
              -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
              -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
@@ -2767,12 +2828,15 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
              -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
              -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
+             -e 's|@''REPLACE_ALIGNED_ALLOC''@|$(REPLACE_ALIGNED_ALLOC)|g' \
              -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
              -e 
's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
+             -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \
              -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \
              -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
              -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+             -e 's|@''REPLACE_POSIX_MEMALIGN''@|$(REPLACE_POSIX_MEMALIGN)|g' \
              -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \
              -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
@@ -3412,6 +3476,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
              -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
              -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
+             -e 's|@''HAVE_DECL_EXECVPE''@|$(HAVE_DECL_EXECVPE)|g' \
              -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \
              -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \
              -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' 
\
diff --git a/lib/idx.h b/lib/idx.h
new file mode 100644
index 0000000..6a7739f
--- /dev/null
+++ b/lib/idx.h
@@ -0,0 +1,113 @@
+/* A type for indices and sizes.
+
+   Copyright (C) 2020 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _IDX_H
+#define _IDX_H
+
+/* Get ptrdiff_t.  */
+#include <stddef.h>
+
+/* Get PTRDIFF_MAX.  */
+#include <stdint.h>
+
+/* The type 'idx_t' holds an (array) index or an (object) size.
+   Its implementation promotes to a signed integer type,
+   which can hold the values
+     0..2^63-1 (on 64-bit platforms) or
+     0..2^31-1 (on 32-bit platforms).
+
+   Why a signed integer type?
+
+     * Security: Signed types can be checked for overflow via
+       '-fsanitize=undefined', but unsigned types cannot.
+
+     * Comparisons without surprises: ISO C99 § 6.3.1.8 specifies a few
+       surprising results for comparisons, such as
+
+           (int) -3 < (unsigned long) 7  =>  false
+           (int) -3 < (unsigned int) 7   =>  false
+       and on 32-bit machines:
+           (long) -3 < (unsigned int) 7  =>  false
+
+       This is surprising because the natural comparison order is by
+       value in the realm of infinite-precision signed integers (ℤ).
+
+       The best way to get rid of such surprises is to use signed types
+       for numerical integer values, and use unsigned types only for
+       bit masks and enums.
+
+   Why not use 'size_t' directly?
+
+     * Because 'size_t' is an unsigned type, and a signed type is better.
+       See above.
+
+   Why not use 'ptrdiff_t' directly?
+
+     * Maintainability: When reading and modifying code, it helps to know that
+       a certain variable cannot have negative values.  For example, when you
+       have a loop
+
+         int n = ...;
+         for (int i = 0; i < n; i++) ...
+
+       or
+
+         ptrdiff_t n = ...;
+         for (ptrdiff_t i = 0; i < n; i++) ...
+
+       you have to ask yourself "what if n < 0?".  Whereas in
+
+         idx_t n = ...;
+         for (idx_t i = 0; i < n; i++) ...
+
+       you know that this case cannot happen.
+
+       Similarly, when a programmer writes
+
+         idx_t = ptr2 - ptr1;
+
+       there is an implied assertion that ptr1 and ptr2 point into the same
+       object and that ptr1 <= ptr2.
+
+     * Being future-proof: In the future, range types (integers which are
+       constrained to a certain range of values) may be added to C compilers
+       or to the C standard.  Several programming languages (Ada, Haskell,
+       Common Lisp, Pascal) already have range types.  Such range types may
+       help producing good code and good warnings.  The type 'idx_t' could
+       then be typedef'ed to a range type that is signed after promotion.  */
+
+/* In the future, idx_t could be typedef'ed to a signed range type.
+   The clang "extended integer types", supported in Clang 11 or newer
+   
<https://clang.llvm.org/docs/LanguageExtensions.html#extended-integer-types>,
+   are a special case of range types.  However, these types don't support 
binary
+   operators with plain integer types (e.g. expressions such as x > 1).
+   Therefore, they don't behave like signed types (and not like unsigned types
+   either).  So, we cannot use them here.  */
+
+/* Use the signed type 'ptrdiff_t'.  */
+/* Note: ISO C does not mandate that 'size_t' and 'ptrdiff_t' have the same
+   size, but it is so on all platforms we have seen since 1990.  */
+typedef ptrdiff_t idx_t;
+
+/* IDX_MAX is the maximum value of an idx_t.  */
+#define IDX_MAX PTRDIFF_MAX
+
+/* So far no need has been found for an IDX_WIDTH macro.
+   Perhaps there should be another macro IDX_VALUE_BITS that does not
+   count the sign bit and is therefore one less than PTRDIFF_WIDTH.  */
+
+#endif /* _IDX_H */
diff --git a/lib/intprops.h b/lib/intprops.h
index b27f2ee..bc2107c 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -226,7 +226,9 @@
 
 /* True if __builtin_add_overflow (A, B, P) and __builtin_sub_overflow
    (A, B, P) work when P is non-null.  */
-#if 5 <= __GNUC__ && !defined __ICC
+/* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x,
+   see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269>.  */
+#if 7 <= __GNUC__ && !defined __ICC
 # define _GL_HAS_BUILTIN_ADD_OVERFLOW 1
 #elif defined __has_builtin
 # define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow)
@@ -244,7 +246,17 @@
 
 /* True if __builtin_add_overflow_p (A, B, C) works, and similarly for
    __builtin_sub_overflow_p and __builtin_mul_overflow_p.  */
-#define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__)
+#if defined __clang__ || defined __ICC
+/* Clang 11 lacks __builtin_mul_overflow_p, and even if it did it
+   would presumably run afoul of Clang bug 16404.  ICC 2021.1's
+   __builtin_add_overflow_p etc. are not treated as integral constant
+   expressions even when all arguments are.  */
+# define _GL_HAS_BUILTIN_OVERFLOW_P 0
+#elif defined __has_builtin
+# define _GL_HAS_BUILTIN_OVERFLOW_P __has_builtin (__builtin_mul_overflow_p)
+#else
+# define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__)
+#endif
 
 /* The _GL*_OVERFLOW macros have the same restrictions as the
    *_RANGE_OVERFLOW macros, except that they do not assume that operands
@@ -377,8 +389,9 @@
    _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW)
 #endif
 #if _GL_HAS_BUILTIN_MUL_OVERFLOW
-# if (9 < __GNUC__ + (3 <= __GNUC_MINOR__) \
-      || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__))
+# if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \
+       || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \
+      && !defined __ICC)
 #  define INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r)
 # else
    /* Work around GCC bug 91450.  */
@@ -585,4 +598,33 @@
          : (tmin) / (a) < (b)) \
       : (tmax) / (b) < (a)))
 
+/* The following macros compute A + B, A - B, and A * B, respectively.
+   If no overflow occurs, they set *R to the result and return 1;
+   otherwise, they return 0 and may modify *R.
+
+   Example usage:
+
+     long int result;
+     if (INT_ADD_OK (a, b, &result))
+       printf ("result is %ld\n", result);
+     else
+       printf ("overflow\n");
+
+   A, B, and *R should be integers; they need not be the same type,
+   and they need not be all signed or all unsigned.
+
+   These macros work correctly on all known practical hosts, and do not rely
+   on undefined behavior due to signed arithmetic overflow.
+
+   These macros are not constant expressions.
+
+   These macros may evaluate their arguments zero or multiple times, so the
+   arguments should not have side effects.
+
+   These macros are tuned for B being a constant.  */
+
+#define INT_ADD_OK(a, b, r) ! INT_ADD_WRAPV (a, b, r)
+#define INT_SUBTRACT_OK(a, b, r) ! INT_SUBTRACT_WRAPV (a, b, r)
+#define INT_MULTIPLY_OK(a, b, r) ! INT_MULTIPLY_WRAPV (a, b, r)
+
 #endif /* _GL_INTPROPS_H */
diff --git a/lib/malloc/scratch_buffer.h b/lib/malloc/scratch_buffer.h
new file mode 100644
index 0000000..b404786
--- /dev/null
+++ b/lib/malloc/scratch_buffer.h
@@ -0,0 +1,135 @@
+/* Variable-sized buffer with on-stack default allocation.
+   Copyright (C) 2015-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _SCRATCH_BUFFER_H
+#define _SCRATCH_BUFFER_H
+
+/* Scratch buffers with a default stack allocation and fallback to
+   heap allocation.  It is expected that this function is used in this
+   way:
+
+     struct scratch_buffer tmpbuf;
+     scratch_buffer_init (&tmpbuf);
+
+     while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length))
+       if (!scratch_buffer_grow (&tmpbuf))
+        return -1;
+
+     scratch_buffer_free (&tmpbuf);
+     return 0;
+
+   The allocation functions (scratch_buffer_grow,
+   scratch_buffer_grow_preserve, scratch_buffer_set_array_size) make
+   sure that the heap allocation, if any, is freed, so that the code
+   above does not have a memory leak.  The buffer still remains in a
+   state that can be deallocated using scratch_buffer_free, so a loop
+   like this is valid as well:
+
+     struct scratch_buffer tmpbuf;
+     scratch_buffer_init (&tmpbuf);
+
+     while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length))
+       if (!scratch_buffer_grow (&tmpbuf))
+        break;
+
+     scratch_buffer_free (&tmpbuf);
+
+   scratch_buffer_grow and scratch_buffer_grow_preserve are guaranteed
+   to grow the buffer by at least 512 bytes.  This means that when
+   using the scratch buffer as a backing store for a non-character
+   array whose element size, in bytes, is 512 or smaller, the scratch
+   buffer only has to grow once to make room for at least one more
+   element.
+*/
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+/* Scratch buffer.  Must be initialized with scratch_buffer_init
+   before its use.  */
+struct scratch_buffer {
+  void *data;    /* Pointer to the beginning of the scratch area.  */
+  size_t length; /* Allocated space at the data pointer, in bytes.  */
+  union { max_align_t __align; char __c[1024]; } __space;
+};
+
+/* Initializes *BUFFER so that BUFFER->data points to BUFFER->__space
+   and BUFFER->length reflects the available space.  */
+static inline void
+scratch_buffer_init (struct scratch_buffer *buffer)
+{
+  buffer->data = buffer->__space.__c;
+  buffer->length = sizeof (buffer->__space);
+}
+
+/* Deallocates *BUFFER (if it was heap-allocated).  */
+static inline void
+scratch_buffer_free (struct scratch_buffer *buffer)
+{
+  if (buffer->data != buffer->__space.__c)
+    free (buffer->data);
+}
+
+/* Grow *BUFFER by some arbitrary amount.  The buffer contents is NOT
+   preserved.  Return true on success, false on allocation failure (in
+   which case the old buffer is freed).  On success, the new buffer is
+   larger than the previous size.  On failure, *BUFFER is deallocated,
+   but remains in a free-able state, and errno is set.  */
+bool __libc_scratch_buffer_grow (struct scratch_buffer *buffer);
+libc_hidden_proto (__libc_scratch_buffer_grow)
+
+/* Alias for __libc_scratch_buffer_grow.  */
+static __always_inline bool
+scratch_buffer_grow (struct scratch_buffer *buffer)
+{
+  return __glibc_likely (__libc_scratch_buffer_grow (buffer));
+}
+
+/* Like __libc_scratch_buffer_grow, but preserve the old buffer
+   contents on success, as a prefix of the new buffer.  */
+bool __libc_scratch_buffer_grow_preserve (struct scratch_buffer *buffer);
+libc_hidden_proto (__libc_scratch_buffer_grow_preserve)
+
+/* Alias for __libc_scratch_buffer_grow_preserve.  */
+static __always_inline bool
+scratch_buffer_grow_preserve (struct scratch_buffer *buffer)
+{
+  return __glibc_likely (__libc_scratch_buffer_grow_preserve (buffer));
+}
+
+/* Grow *BUFFER so that it can store at least NELEM elements of SIZE
+   bytes.  The buffer contents are NOT preserved.  Both NELEM and SIZE
+   can be zero.  Return true on success, false on allocation failure
+   (in which case the old buffer is freed, but *BUFFER remains in a
+   free-able state, and errno is set).  It is unspecified whether this
+   function can reduce the array size.  */
+bool __libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer,
+                                          size_t nelem, size_t size);
+libc_hidden_proto (__libc_scratch_buffer_set_array_size)
+
+/* Alias for __libc_scratch_set_array_size.  */
+static __always_inline bool
+scratch_buffer_set_array_size (struct scratch_buffer *buffer,
+                              size_t nelem, size_t size)
+{
+  return __glibc_likely (__libc_scratch_buffer_set_array_size
+                        (buffer, nelem, size));
+}
+
+#endif /* _SCRATCH_BUFFER_H */
diff --git a/lib/malloc/scratch_buffer_grow.c b/lib/malloc/scratch_buffer_grow.c
new file mode 100644
index 0000000..41befe3
--- /dev/null
+++ b/lib/malloc/scratch_buffer_grow.c
@@ -0,0 +1,56 @@
+/* Variable-sized buffer with on-stack default allocation.
+   Copyright (C) 2015-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <scratch_buffer.h>
+#include <errno.h>
+
+bool
+__libc_scratch_buffer_grow (struct scratch_buffer *buffer)
+{
+  void *new_ptr;
+  size_t new_length = buffer->length * 2;
+
+  /* Discard old buffer.  */
+  scratch_buffer_free (buffer);
+
+  /* Check for overflow.  */
+  if (__glibc_likely (new_length >= buffer->length))
+    new_ptr = malloc (new_length);
+  else
+    {
+      __set_errno (ENOMEM);
+      new_ptr = NULL;
+    }
+
+  if (__glibc_unlikely (new_ptr == NULL))
+    {
+      /* Buffer must remain valid to free.  */
+      scratch_buffer_init (buffer);
+      return false;
+    }
+
+  /* Install new heap-based buffer.  */
+  buffer->data = new_ptr;
+  buffer->length = new_length;
+  return true;
+}
+libc_hidden_def (__libc_scratch_buffer_grow)
diff --git a/lib/malloc/scratch_buffer_grow_preserve.c 
b/lib/malloc/scratch_buffer_grow_preserve.c
new file mode 100644
index 0000000..aef2329
--- /dev/null
+++ b/lib/malloc/scratch_buffer_grow_preserve.c
@@ -0,0 +1,67 @@
+/* Variable-sized buffer with on-stack default allocation.
+   Copyright (C) 2015-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <scratch_buffer.h>
+#include <errno.h>
+#include <string.h>
+
+bool
+__libc_scratch_buffer_grow_preserve (struct scratch_buffer *buffer)
+{
+  size_t new_length = 2 * buffer->length;
+  void *new_ptr;
+
+  if (buffer->data == buffer->__space.__c)
+    {
+      /* Move buffer to the heap.  No overflow is possible because
+        buffer->length describes a small buffer on the stack.  */
+      new_ptr = malloc (new_length);
+      if (new_ptr == NULL)
+       return false;
+      memcpy (new_ptr, buffer->__space.__c, buffer->length);
+    }
+  else
+    {
+      /* Buffer was already on the heap.  Check for overflow.  */
+      if (__glibc_likely (new_length >= buffer->length))
+       new_ptr = realloc (buffer->data, new_length);
+      else
+       {
+         __set_errno (ENOMEM);
+         new_ptr = NULL;
+       }
+
+      if (__glibc_unlikely (new_ptr == NULL))
+       {
+         /* Deallocate, but buffer must remain valid to free.  */
+         free (buffer->data);
+         scratch_buffer_init (buffer);
+         return false;
+       }
+    }
+
+  /* Install new heap-based buffer.  */
+  buffer->data = new_ptr;
+  buffer->length = new_length;
+  return true;
+}
+libc_hidden_def (__libc_scratch_buffer_grow_preserve)
diff --git a/lib/malloc/scratch_buffer_set_array_size.c 
b/lib/malloc/scratch_buffer_set_array_size.c
new file mode 100644
index 0000000..5f5e4c2
--- /dev/null
+++ b/lib/malloc/scratch_buffer_set_array_size.c
@@ -0,0 +1,64 @@
+/* Variable-sized buffer with on-stack default allocation.
+   Copyright (C) 2015-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <scratch_buffer.h>
+#include <errno.h>
+#include <limits.h>
+
+bool
+__libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer,
+                                     size_t nelem, size_t size)
+{
+  size_t new_length = nelem * size;
+
+  /* Avoid overflow check if both values are small. */
+  if ((nelem | size) >> (sizeof (size_t) * CHAR_BIT / 2) != 0
+      && nelem != 0 && size != new_length / nelem)
+    {
+      /* Overflow.  Discard the old buffer, but it must remain valid
+        to free.  */
+      scratch_buffer_free (buffer);
+      scratch_buffer_init (buffer);
+      __set_errno (ENOMEM);
+      return false;
+    }
+
+  if (new_length <= buffer->length)
+    return true;
+
+  /* Discard old buffer.  */
+  scratch_buffer_free (buffer);
+
+  char *new_ptr = malloc (new_length);
+  if (new_ptr == NULL)
+    {
+      /* Buffer must remain valid to free.  */
+      scratch_buffer_init (buffer);
+      return false;
+    }
+
+  /* Install new heap-based buffer.  */
+  buffer->data = new_ptr;
+  buffer->length = new_length;
+  return true;
+}
+libc_hidden_def (__libc_scratch_buffer_set_array_size)
diff --git a/lib/rawmemchr.c b/lib/rawmemchr.c
new file mode 100644
index 0000000..04bf084
--- /dev/null
+++ b/lib/rawmemchr.c
@@ -0,0 +1,136 @@
+/* Searching in a string.
+   Copyright (C) 2008-2020 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <string.h>
+
+/* Find the first occurrence of C in S.  */
+void *
+rawmemchr (const void *s, int c_in)
+{
+  /* On 32-bit hardware, choosing longword to be a 32-bit unsigned
+     long instead of a 64-bit uintmax_t tends to give better
+     performance.  On 64-bit hardware, unsigned long is generally 64
+     bits already.  Change this typedef to experiment with
+     performance.  */
+  typedef unsigned long int longword;
+
+  const unsigned char *char_ptr;
+  const longword *longword_ptr;
+  longword repeated_one;
+  longword repeated_c;
+  unsigned char c;
+
+  c = (unsigned char) c_in;
+
+  /* Handle the first few bytes by reading one byte at a time.
+     Do this until CHAR_PTR is aligned on a longword boundary.  */
+  for (char_ptr = (const unsigned char *) s;
+       (size_t) char_ptr % sizeof (longword) != 0;
+       ++char_ptr)
+    if (*char_ptr == c)
+      return (void *) char_ptr;
+
+  longword_ptr = (const longword *) char_ptr;
+
+  /* All these elucidatory comments refer to 4-byte longwords,
+     but the theory applies equally well to any size longwords.  */
+
+  /* Compute auxiliary longword values:
+     repeated_one is a value which has a 1 in every byte.
+     repeated_c has c in every byte.  */
+  repeated_one = 0x01010101;
+  repeated_c = c | (c << 8);
+  repeated_c |= repeated_c << 16;
+  if (0xffffffffU < (longword) -1)
+    {
+      repeated_one |= repeated_one << 31 << 1;
+      repeated_c |= repeated_c << 31 << 1;
+      if (8 < sizeof (longword))
+        {
+          size_t i;
+
+          for (i = 64; i < sizeof (longword) * 8; i *= 2)
+            {
+              repeated_one |= repeated_one << i;
+              repeated_c |= repeated_c << i;
+            }
+        }
+    }
+
+  /* Instead of the traditional loop which tests each byte, we will
+     test a longword at a time.  The tricky part is testing if *any of
+     the four* bytes in the longword in question are equal to NUL or
+     c.  We first use an xor with repeated_c.  This reduces the task
+     to testing whether *any of the four* bytes in longword1 is zero.
+
+     We compute tmp =
+       ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
+     That is, we perform the following operations:
+       1. Subtract repeated_one.
+       2. & ~longword1.
+       3. & a mask consisting of 0x80 in every byte.
+     Consider what happens in each byte:
+       - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
+         and step 3 transforms it into 0x80.  A carry can also be propagated
+         to more significant bytes.
+       - If a byte of longword1 is nonzero, let its lowest 1 bit be at
+         position k (0 <= k <= 7); so the lowest k bits are 0.  After step 1,
+         the byte ends in a single bit of value 0 and k bits of value 1.
+         After step 2, the result is just k bits of value 1: 2^k - 1.  After
+         step 3, the result is 0.  And no carry is produced.
+     So, if longword1 has only non-zero bytes, tmp is zero.
+     Whereas if longword1 has a zero byte, call j the position of the least
+     significant zero byte.  Then the result has a zero at positions 0, ...,
+     j-1 and a 0x80 at position j.  We cannot predict the result at the more
+     significant bytes (positions j+1..3), but it does not matter since we
+     already have a non-zero bit at position 8*j+7.
+
+     The test whether any byte in longword1 is zero is equivalent
+     to testing whether tmp is nonzero.
+
+     This test can read beyond the end of a string, depending on where
+     C_IN is encountered.  However, this is considered safe since the
+     initialization phase ensured that the read will be aligned,
+     therefore, the read will not cross page boundaries and will not
+     cause a fault.  */
+
+  while (1)
+    {
+      longword longword1 = *longword_ptr ^ repeated_c;
+
+      if ((((longword1 - repeated_one) & ~longword1)
+           & (repeated_one << 7)) != 0)
+        break;
+      longword_ptr++;
+    }
+
+  char_ptr = (const unsigned char *) longword_ptr;
+
+  /* At this point, we know that one of the sizeof (longword) bytes
+     starting at char_ptr is == c.  On little-endian machines, we
+     could determine the first such byte without any further memory
+     accesses, just by looking at the tmp result from the last loop
+     iteration.  But this does not work on big-endian machines.
+     Choose code that works in both cases.  */
+
+  char_ptr = (unsigned char *) longword_ptr;
+  while (*char_ptr != c)
+    char_ptr++;
+  return (void *) char_ptr;
+}
diff --git a/lib/rawmemchr.valgrind b/lib/rawmemchr.valgrind
new file mode 100644
index 0000000..53c5b31
--- /dev/null
+++ b/lib/rawmemchr.valgrind
@@ -0,0 +1,28 @@
+# Suppress a valgrind message about use of uninitialized memory in rawmemchr().
+
+# Copyright (C) 2008-2020 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# This use is OK because it provides only a speedup.
+{
+    rawmemchr-value4
+    Memcheck:Value4
+    fun:rawmemchr
+}
+{
+    rawmemchr-value8
+    Memcheck:Value8
+    fun:rawmemchr
+}
diff --git a/lib/readlink.c b/lib/readlink.c
index 4d392ef..531913e 100644
--- a/lib/readlink.c
+++ b/lib/readlink.c
@@ -1,4 +1,4 @@
-/* Stub for readlink().
+/* Read the contents of a symbolic link.
    Copyright (C) 2003-2007, 2009-2020 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -29,7 +29,7 @@
    such as DJGPP 2.03 and mingw32.  */
 
 ssize_t
-readlink (const char *name, char *buf _GL_UNUSED,
+readlink (char const *file, char *buf _GL_UNUSED,
           size_t bufsize _GL_UNUSED)
 {
   struct stat statbuf;
@@ -37,7 +37,7 @@ readlink (const char *name, char *buf _GL_UNUSED,
   /* In general we should use lstat() here, not stat().  But on platforms
      without symbolic links, lstat() - if it exists - would be equivalent to
      stat(), therefore we can use stat().  This saves us a configure check.  */
-  if (stat (name, &statbuf) >= 0)
+  if (stat (file, &statbuf) >= 0)
     errno = EINVAL;
   return -1;
 }
@@ -51,24 +51,54 @@ readlink (const char *name, char *buf _GL_UNUSED,
    for Solaris 9.  */
 
 ssize_t
-rpl_readlink (const char *name, char *buf, size_t bufsize)
+rpl_readlink (char const *file, char *buf, size_t bufsize)
 {
 # if READLINK_TRAILING_SLASH_BUG
-  size_t len = strlen (name);
-  if (len && name[len - 1] == '/')
+  size_t file_len = strlen (file);
+  if (file_len && file[file_len - 1] == '/')
     {
-      /* Even if name without the slash is a symlink to a directory,
+      /* Even if FILE without the slash is a symlink to a directory,
          both lstat() and stat() must resolve the trailing slash to
          the directory rather than the symlink.  We can therefore
          safely use stat() to distinguish between EINVAL and
          ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat().  */
       struct stat st;
-      if (stat (name, &st) == 0)
+      if (stat (file, &st) == 0 || errno == EOVERFLOW)
         errno = EINVAL;
       return -1;
     }
 # endif /* READLINK_TRAILING_SLASH_BUG */
-  return readlink (name, buf, bufsize);
+
+  ssize_t r = readlink (file, buf, bufsize);
+
+# if READLINK_TRUNCATE_BUG
+  if (r < 0 && errno == ERANGE)
+    {
+      /* Try again with a bigger buffer.  This is just for test cases;
+         real code invariably discards short reads.  */
+      char stackbuf[4032];
+      r = readlink (file, stackbuf, sizeof stackbuf);
+      if (r < 0)
+        {
+          if (errno == ERANGE)
+            {
+              /* Clear the buffer, which is good enough for real code.
+                 Thankfully, no test cases try short reads of enormous
+                 symlinks and what would be the point anyway?  */
+              r = bufsize;
+              memset (buf, 0, r);
+            }
+        }
+      else
+        {
+          if (bufsize < r)
+            r = bufsize;
+          memcpy (buf, stackbuf, r);
+        }
+    }
+# endif
+
+  return r;
 }
 
 #endif /* HAVE_READLINK */
diff --git a/lib/readlinkat.c b/lib/readlinkat.c
index 68ec65e..7a41208 100644
--- a/lib/readlinkat.c
+++ b/lib/readlinkat.c
@@ -28,10 +28,11 @@
 
 #if HAVE_READLINKAT
 
+# undef fstatat
 # undef readlinkat
 
 ssize_t
-rpl_readlinkat (int fd, char const *file, char *buf, size_t len)
+rpl_readlinkat (int fd, char const *file, char *buf, size_t bufsize)
 {
 # if READLINK_TRAILING_SLASH_BUG
   size_t file_len = strlen (file);
@@ -40,15 +41,45 @@ rpl_readlinkat (int fd, char const *file, char *buf, size_t 
len)
       /* Even if FILE without the slash is a symlink to a directory,
          both lstat() and stat() must resolve the trailing slash to
          the directory rather than the symlink.  We can therefore
-         safely use stat() to distinguish between EINVAL and
-         ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat().  */
+         safely use fstatat(..., 0) to distinguish between EINVAL and
+         ENOTDIR/ENOENT, avoiding extra overhead of rpl_fstatat().  */
       struct stat st;
-      if (stat (file, &st) == 0)
+      if (fstatat (fd, file, &st, 0) == 0 || errno == EOVERFLOW)
         errno = EINVAL;
       return -1;
     }
 # endif /* READLINK_TRAILING_SLASH_BUG */
-  return readlinkat (fd, file, buf, len);
+
+  ssize_t r = readlinkat (fd, file, buf, bufsize);
+
+# if READLINK_TRUNCATE_BUG
+  if (r < 0 && errno == ERANGE)
+    {
+      /* Try again with a bigger buffer.  This is just for test cases;
+         real code invariably discards short reads.  */
+      char stackbuf[4032];
+      r = readlinkat (fd, file, stackbuf, sizeof stackbuf);
+      if (r < 0)
+        {
+          if (errno == ERANGE)
+            {
+              /* Clear the buffer, which is good enough for real code.
+                 Thankfully, no test cases try short reads of enormous
+                 symlinks and what would be the point anyway?  */
+              r = bufsize;
+              memset (buf, 0, r);
+            }
+        }
+      else
+        {
+          if (bufsize < r)
+            r = bufsize;
+          memcpy (buf, stackbuf, r);
+        }
+    }
+# endif
+
+  return r;
 }
 
 #else
@@ -61,7 +92,7 @@ rpl_readlinkat (int fd, char const *file, char *buf, size_t 
len)
    readlinkat worthless since readlink does not guarantee a
    NUL-terminated buffer.  Assume this was a bug in POSIX.  */
 
-/* Read the contents of symlink FILE into buffer BUF of size LEN, in the
+/* Read the contents of symlink FILE into buffer BUF of size BUFSIZE, in the
    directory open on descriptor FD.  If possible, do it without changing
    the working directory.  Otherwise, resort to using save_cwd/fchdir,
    then readlink/restore_cwd.  If either the save_cwd or the restore_cwd
@@ -69,8 +100,8 @@ rpl_readlinkat (int fd, char const *file, char *buf, size_t 
len)
 
 # define AT_FUNC_NAME readlinkat
 # define AT_FUNC_F1 readlink
-# define AT_FUNC_POST_FILE_PARAM_DECLS , char *buf, size_t len
-# define AT_FUNC_POST_FILE_ARGS        , buf, len
+# define AT_FUNC_POST_FILE_PARAM_DECLS , char *buf, size_t bufsize
+# define AT_FUNC_POST_FILE_ARGS        , buf, bufsize
 # define AT_FUNC_RESULT ssize_t
 # include "at-func.c"
 # undef AT_FUNC_NAME
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index 2e21729..bf9439e 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -300,18 +300,20 @@ build_wcs_upper_buffer (re_string_t *pstr)
       while (byte_idx < end_idx)
        {
          wchar_t wc;
+         unsigned char ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
 
-         if (isascii (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx])
-             && mbsinit (&pstr->cur_state))
+         if (isascii (ch) && mbsinit (&pstr->cur_state))
            {
-             /* In case of a singlebyte character.  */
-             pstr->mbs[byte_idx]
-               = toupper (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]);
              /* The next step uses the assumption that wchar_t is encoded
                 ASCII-safe: all ASCII values can be converted like this.  */
-             pstr->wcs[byte_idx] = (wchar_t) pstr->mbs[byte_idx];
-             ++byte_idx;
-             continue;
+             wchar_t wcu = __towupper (ch);
+             if (isascii (wcu))
+               {
+                 pstr->mbs[byte_idx] = wcu;
+                 pstr->wcs[byte_idx] = wcu;
+                 byte_idx++;
+                 continue;
+               }
            }
 
          remain_len = end_idx - byte_idx;
@@ -348,7 +350,6 @@ build_wcs_upper_buffer (re_string_t *pstr)
            {
              /* It is an invalid character, an incomplete character
                 at the end of the string, or '\0'.  Just use the byte.  */
-             int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
              pstr->mbs[byte_idx] = ch;
              /* And also cast it to wide char.  */
              pstr->wcs[byte_idx++] = (wchar_t) ch;
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 0c72e3f..7b50b47 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -77,6 +77,14 @@
 # define isblank(ch) ((ch) == ' ' || (ch) == '\t')
 #endif
 
+/* regex code assumes isascii has its usual numeric meaning,
+   even if the portable character set uses EBCDIC encoding,
+   and even if wint_t is wider than int.  */
+#ifndef _LIBC
+# undef isascii
+# define isascii(c) (((c) & ~0x7f) == 0)
+#endif
+
 #ifdef _LIBC
 # ifndef _RE_DEFINE_LOCALE_FUNCTIONS
 #  define _RE_DEFINE_LOCALE_FUNCTIONS 1
diff --git a/lib/scratch_buffer.h b/lib/scratch_buffer.h
new file mode 100644
index 0000000..0b45f92
--- /dev/null
+++ b/lib/scratch_buffer.h
@@ -0,0 +1,29 @@
+/* Variable-sized buffer with on-stack default allocation.
+   Copyright (C) 2017-2020 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, 2017.  */
+
+#ifndef _GL_SCRATCH_BUFFER_H
+#define _GL_SCRATCH_BUFFER_H
+
+#include <libc-config.h>
+
+#define __libc_scratch_buffer_grow gl_scratch_buffer_grow
+#define __libc_scratch_buffer_grow_preserve gl_scratch_buffer_grow_preserve
+#define __libc_scratch_buffer_set_array_size gl_scratch_buffer_set_array_size
+#include <malloc/scratch_buffer.h>
+
+#endif /* _GL_SCRATCH_BUFFER_H */
diff --git a/lib/signal.in.h b/lib/signal.in.h
index c94b053..70a2d4a 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -55,13 +55,13 @@
 #ifndef _@GUARD_PREFIX@_SIGNAL_H
 #define _@GUARD_PREFIX@_SIGNAL_H
 
-/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android
-   declare pthread_sigmask in <pthread.h>, not in <signal.h>.
+/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android,
+   OS/2 kLIBC declare pthread_sigmask in <pthread.h>, not in <signal.h>.
    But avoid namespace pollution on glibc systems.*/
 #if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
     && ((defined __APPLE__ && defined __MACH__) \
         || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ \
-        || defined __sun || defined __ANDROID__) \
+        || defined __sun || defined __ANDROID__ || defined __KLIBC__) \
     && ! defined __GLIBC__
 # include <pthread.h>
 #endif
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index 63fa1aa..6f2235a 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -579,11 +579,6 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == 
sizeof (uintmax_t)
    <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
    <stdint.h> and assumes its types are already defined.  */
 # if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
-  /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
-     included before <wchar.h>.  */
-#  include <stddef.h>
-#  include <stdio.h>
-#  include <time.h>
 #  define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
 #  include <wchar.h>
 #  undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index 067b95e..15066aa 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -175,7 +175,7 @@
 #  define fp_ fp
 # endif
 
-# if defined _SCO_DS                /* OpenServer */
+# if defined _SCO_DS || (defined __SCO_VERSION__ || defined __sysv5__)  /* 
OpenServer 5, OpenServer 6, UnixWare 7 */
 #  define _cnt __cnt
 #  define _ptr __ptr
 #  define _base __base
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 6d12cd8..458036b 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -70,30 +70,44 @@
 # endif
 #endif
 
-/* _GL_ATTRIBUTE_FORMAT_PRINTF
-   indicates to GCC that the function takes a format string and arguments,
-   where the format string directives are the ones standardized by ISO C99
-   and POSIX.  */
+/* An __attribute__ __format__ specifier for a function that takes a format
+   string and arguments, where the format string directives are the ones
+   standardized by ISO C99 and POSIX.
+   _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD  */
+/* __gnu_printf__ is supported in GCC >= 4.4.  */
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
-# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
-   _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, 
first_argument))
+# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__
 #else
-# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
-   _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
+# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__
 #endif
 
-/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF,
-   except that it indicates to GCC that the supported format string directives
-   are the ones of the system printf(), rather than the ones standardized by
-   ISO C99 and POSIX.  */
+/* An __attribute__ __format__ specifier for a function that takes a format
+   string and arguments, where the format string directives are the ones of the
+   system printf(), rather than the ones standardized by ISO C99 and POSIX.
+   _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM  */
+/* On mingw, Gnulib sets __USE_MINGW_ANSI_STDIO in order to get closer to
+   the standards.  The macro GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU indicates
+   whether this change is effective.  On older mingw, it is not.  */
 #if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
-# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, 
first_argument) \
-  _GL_ATTRIBUTE_FORMAT_PRINTF (formatstring_parameter, first_argument)
+# define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD
 #else
-# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, 
first_argument) \
-  _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
+# define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM __printf__
 #endif
 
+/* _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD
+   indicates to GCC that the function takes a format string and arguments,
+   where the format string directives are the ones standardized by ISO C99
+   and POSIX.  */
+#define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(formatstring_parameter, 
first_argument) \
+  _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 
formatstring_parameter, first_argument))
+
+/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like 
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD,
+   except that it indicates to GCC that the supported format string directives
+   are the ones of the system printf(), rather than the ones standardized by
+   ISO C99 and POSIX.  */
+#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, 
first_argument) \
+  _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 
formatstring_parameter, first_argument))
+
 /* _GL_ATTRIBUTE_FORMAT_SCANF
    indicates to GCC that the function takes a format string and arguments,
    where the format string directives are the ones standardized by ISO C99
@@ -174,13 +188,13 @@
 #   define dprintf rpl_dprintf
 #  endif
 _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...)
-                                _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
+                                _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
                                 _GL_ARG_NONNULL ((2)));
 _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...));
 # else
 #  if !@HAVE_DPRINTF@
 _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...)
-                                _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
+                                _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
                                 _GL_ARG_NONNULL ((2)));
 #  endif
 _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...));
@@ -215,9 +229,27 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX 
compliant - "
                  "use gnulib module fclose for portable POSIX compliance");
 #endif
 
+/* On native Windows, map 'fcloseall' to '_fcloseall', so that -loldnames is
+   not required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::fcloseall on all platforms that have
+   it.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef fcloseall
-# define fcloseall _fcloseall
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef fcloseall
+#  define fcloseall _fcloseall
+# endif
+_GL_CXXALIAS_MDA (fcloseall, int, (void));
+#else
+# if @HAVE_DECL_FCLOSEALL@
+#  if defined __FreeBSD__
+_GL_CXXALIAS_SYS (fcloseall, void, (void));
+#  else
+_GL_CXXALIAS_SYS (fcloseall, int, (void));
+#  endif
+# endif
+#endif
+#if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCLOSEALL@
+_GL_CXXALIASWARN (fcloseall);
 #endif
 
 #if @GNULIB_FDOPEN@
@@ -244,9 +276,20 @@ _GL_CXXALIASWARN (fdopen);
 /* Assume fdopen is always declared.  */
 _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX 
compliant - "
                  "use gnulib module fdopen for portability");
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef fdopen
-# define fdopen _fdopen
+#else
+/* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::fdopen always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fdopen
+#   define fdopen _fdopen
+#  endif
+_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
+# else
+_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
+# endif
+_GL_CXXALIASWARN (fdopen);
 #endif
 
 #if @GNULIB_FFLUSH@
@@ -311,10 +354,19 @@ _GL_CXXALIASWARN (fgets);
 # endif
 #endif
 
+/* On native Windows, map 'fileno' to '_fileno', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::fileno always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef fileno
-# define fileno _fileno
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef fileno
+#  define fileno _fileno
+# endif
+_GL_CXXALIAS_MDA (fileno, int, (FILE *restrict stream));
+#else
+_GL_CXXALIAS_SYS (fileno, int, (FILE *restrict stream));
 #endif
+_GL_CXXALIASWARN (fileno);
 
 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@
@@ -351,7 +403,7 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms 
is not POSIX complian
 #  if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
 _GL_FUNCDECL_RPL (fprintf, int,
                   (FILE *restrict fp, const char *restrict format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
                   _GL_ARG_NONNULL ((1, 2)));
 #  else
 _GL_FUNCDECL_RPL (fprintf, int,
@@ -843,10 +895,19 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
 #endif
 
+/* On native Windows, map 'getw' to '_getw', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::getw always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef getw
-# define getw _getw
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef getw
+#  define getw _getw
+# endif
+_GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream));
+#else
+_GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream));
 #endif
+_GL_CXXALIASWARN (getw);
 
 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
 struct obstack;
@@ -861,7 +922,7 @@ struct obstack;
 #  endif
 _GL_FUNCDECL_RPL (obstack_printf, int,
                   (struct obstack *obs, const char *format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
                   _GL_ARG_NONNULL ((1, 2)));
 _GL_CXXALIAS_RPL (obstack_printf, int,
                   (struct obstack *obs, const char *format, ...));
@@ -869,7 +930,7 @@ _GL_CXXALIAS_RPL (obstack_printf, int,
 #  if !@HAVE_DECL_OBSTACK_PRINTF@
 _GL_FUNCDECL_SYS (obstack_printf, int,
                   (struct obstack *obs, const char *format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
                   _GL_ARG_NONNULL ((1, 2)));
 #  endif
 _GL_CXXALIAS_SYS (obstack_printf, int,
@@ -882,7 +943,7 @@ _GL_CXXALIASWARN (obstack_printf);
 #  endif
 _GL_FUNCDECL_RPL (obstack_vprintf, int,
                   (struct obstack *obs, const char *format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
                   _GL_ARG_NONNULL ((1, 2)));
 _GL_CXXALIAS_RPL (obstack_vprintf, int,
                   (struct obstack *obs, const char *format, va_list args));
@@ -890,7 +951,7 @@ _GL_CXXALIAS_RPL (obstack_vprintf, int,
 #  if !@HAVE_DECL_OBSTACK_PRINTF@
 _GL_FUNCDECL_SYS (obstack_vprintf, int,
                   (struct obstack *obs, const char *format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
                   _GL_ARG_NONNULL ((1, 2)));
 #  endif
 _GL_CXXALIAS_SYS (obstack_vprintf, int,
@@ -974,7 +1035,7 @@ _GL_FUNCDECL_RPL_1 (__printf__, int,
                     (const char *restrict format, ...)
                     __asm__ (@ASM_SYMBOL_PREFIX@
                              _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
-                    _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
+                    _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
                     _GL_ARG_NONNULL ((1)));
 #   else
 _GL_FUNCDECL_RPL_1 (__printf__, int,
@@ -991,7 +1052,7 @@ _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char 
*format, ...));
 #   endif
 _GL_FUNCDECL_RPL (printf, int,
                   (const char *restrict format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
                   _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...));
 #  endif
@@ -1061,10 +1122,19 @@ _GL_CXXALIASWARN (puts);
 # endif
 #endif
 
+/* On native Windows, map 'putw' to '_putw', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::putw always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef putw
-# define putw _putw
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef putw
+#  define putw _putw
+# endif
+_GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream));
+#else
+_GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream));
 #endif
+_GL_CXXALIASWARN (putw);
 
 #if @GNULIB_REMOVE@
 # if @REPLACE_REMOVE@
@@ -1182,7 +1252,7 @@ _GL_CXXALIASWARN (scanf);
 _GL_FUNCDECL_RPL (snprintf, int,
                   (char *restrict str, size_t size,
                    const char *restrict format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
                   _GL_ARG_NONNULL ((3)));
 _GL_CXXALIAS_RPL (snprintf, int,
                   (char *restrict str, size_t size,
@@ -1192,7 +1262,7 @@ _GL_CXXALIAS_RPL (snprintf, int,
 _GL_FUNCDECL_SYS (snprintf, int,
                   (char *restrict str, size_t size,
                    const char *restrict format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
                   _GL_ARG_NONNULL ((3)));
 #  endif
 _GL_CXXALIAS_SYS (snprintf, int,
@@ -1226,7 +1296,7 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
 #  endif
 _GL_FUNCDECL_RPL (sprintf, int,
                   (char *restrict str, const char *restrict format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
                   _GL_ARG_NONNULL ((1, 2)));
 _GL_CXXALIAS_RPL (sprintf, int,
                   (char *restrict str, const char *restrict format, ...));
@@ -1245,10 +1315,19 @@ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX 
compliant - "
                  "POSIX compliance");
 #endif
 
+/* On native Windows, map 'tempnam' to '_tempnam', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::tempnam always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef tempnam
-# define tempnam _tempnam
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef tempnam
+#  define tempnam _tempnam
+# endif
+_GL_CXXALIAS_MDA (tempnam, char *, (const char *dir, const char *prefix));
+#else
+_GL_CXXALIAS_SYS (tempnam, char *, (const char *dir, const char *prefix));
 #endif
+_GL_CXXALIASWARN (tempnam);
 
 #if @GNULIB_TMPFILE@
 # if @REPLACE_TMPFILE@
@@ -1282,7 +1361,7 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw 
- "
 #  endif
 _GL_FUNCDECL_RPL (asprintf, int,
                   (char **result, const char *format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
                   _GL_ARG_NONNULL ((1, 2)));
 _GL_CXXALIAS_RPL (asprintf, int,
                   (char **result, const char *format, ...));
@@ -1290,7 +1369,7 @@ _GL_CXXALIAS_RPL (asprintf, int,
 #  if !@HAVE_VASPRINTF@
 _GL_FUNCDECL_SYS (asprintf, int,
                   (char **result, const char *format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
                   _GL_ARG_NONNULL ((1, 2)));
 #  endif
 _GL_CXXALIAS_SYS (asprintf, int,
@@ -1303,7 +1382,7 @@ _GL_CXXALIASWARN (asprintf);
 #  endif
 _GL_FUNCDECL_RPL (vasprintf, int,
                   (char **result, const char *format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
                   _GL_ARG_NONNULL ((1, 2)));
 _GL_CXXALIAS_RPL (vasprintf, int,
                   (char **result, const char *format, va_list args));
@@ -1311,7 +1390,7 @@ _GL_CXXALIAS_RPL (vasprintf, int,
 #  if !@HAVE_VASPRINTF@
 _GL_FUNCDECL_SYS (vasprintf, int,
                   (char **result, const char *format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
                   _GL_ARG_NONNULL ((1, 2)));
 #  endif
 _GL_CXXALIAS_SYS (vasprintf, int,
@@ -1327,7 +1406,7 @@ _GL_CXXALIASWARN (vasprintf);
 #  endif
 _GL_FUNCDECL_RPL (vdprintf, int,
                   (int fd, const char *restrict format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
                   _GL_ARG_NONNULL ((2)));
 _GL_CXXALIAS_RPL (vdprintf, int,
                   (int fd, const char *restrict format, va_list args));
@@ -1335,7 +1414,7 @@ _GL_CXXALIAS_RPL (vdprintf, int,
 #  if !@HAVE_VDPRINTF@
 _GL_FUNCDECL_SYS (vdprintf, int,
                   (int fd, const char *restrict format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
                   _GL_ARG_NONNULL ((2)));
 #  endif
 /* Need to cast, because on Solaris, the third parameter will likely be
@@ -1365,7 +1444,7 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
 _GL_FUNCDECL_RPL (vfprintf, int,
                   (FILE *restrict fp,
                    const char *restrict format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
                   _GL_ARG_NONNULL ((1, 2)));
 #  else
 _GL_FUNCDECL_RPL (vfprintf, int,
@@ -1432,7 +1511,7 @@ _GL_CXXALIASWARN (vfscanf);
 #  define GNULIB_overrides_vprintf 1
 #  if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
 _GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
-                                _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
+                                _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
                                 _GL_ARG_NONNULL ((1)));
 #  else
 _GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
@@ -1487,7 +1566,7 @@ _GL_CXXALIASWARN (vscanf);
 _GL_FUNCDECL_RPL (vsnprintf, int,
                   (char *restrict str, size_t size,
                    const char *restrict format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
                   _GL_ARG_NONNULL ((3)));
 _GL_CXXALIAS_RPL (vsnprintf, int,
                   (char *restrict str, size_t size,
@@ -1497,7 +1576,7 @@ _GL_CXXALIAS_RPL (vsnprintf, int,
 _GL_FUNCDECL_SYS (vsnprintf, int,
                   (char *restrict str, size_t size,
                    const char *restrict format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
                   _GL_ARG_NONNULL ((3)));
 #  endif
 _GL_CXXALIAS_SYS (vsnprintf, int,
@@ -1523,7 +1602,7 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
 _GL_FUNCDECL_RPL (vsprintf, int,
                   (char *restrict str,
                    const char *restrict format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
                   _GL_ARG_NONNULL ((1, 2)));
 _GL_CXXALIAS_RPL (vsprintf, int,
                   (char *restrict str,
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 47a1309..1964443 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -53,8 +53,8 @@
 # include <sys/loadavg.h>
 #endif
 
-/* Native Windows platforms declare mktemp() in <io.h>.  */
-#if 0 && (defined _WIN32 && ! defined __CYGWIN__)
+/* Native Windows platforms declare _mktemp() in <io.h>.  */
+#if defined _WIN32 && !defined __CYGWIN__
 # include <io.h>
 #endif
 
@@ -149,6 +149,31 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
 #endif
 
 
+/* Allocate memory with indefinite extent and specified alignment.  */
+#if @GNULIB_ALIGNED_ALLOC@
+# if @REPLACE_ALIGNED_ALLOC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef aligned_alloc
+#   define aligned_alloc rpl_aligned_alloc
+#  endif
+_GL_FUNCDECL_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
+_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
+# else
+#  if @HAVE_ALIGNED_ALLOC@
+_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
+#  endif
+# endif
+# if @HAVE_ALIGNED_ALLOC@
+_GL_CXXALIASWARN (aligned_alloc);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef aligned_alloc
+# if HAVE_RAW_DECL_ALIGNED_ALLOC
+_GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
+                 "use gnulib module aligned_alloc for portability");
+# endif
+#endif
+
 #if @GNULIB_ATOLL@
 /* Parse a signed decimal integer.
    Returns the value of the integer.  Errors are not detected.  */
@@ -217,19 +242,86 @@ _GL_WARN_ON_USE (canonicalize_file_name,
 # endif
 #endif
 
+/* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
+   it.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef ecvt
-# define ecvt _ecvt
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef ecvt
+#  define ecvt _ecvt
+# endif
+_GL_CXXALIAS_MDA (ecvt, char *,
+                  (double number, int ndigits, int *decptp, int *signp));
+#else
+# if @HAVE_DECL_ECVT@
+_GL_CXXALIAS_SYS (ecvt, char *,
+                  (double number, int ndigits, int *decptp, int *signp));
+# endif
+#endif
+#if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
+_GL_CXXALIASWARN (ecvt);
 #endif
 
+/* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
+   it.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef fcvt
-# define fcvt _fcvt
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef fcvt
+#  define fcvt _fcvt
+# endif
+_GL_CXXALIAS_MDA (fcvt, char *,
+                  (double number, int ndigits, int *decptp, int *signp));
+#else
+# if @HAVE_DECL_FCVT@
+_GL_CXXALIAS_SYS (fcvt, char *,
+                  (double number, int ndigits, int *decptp, int *signp));
+# endif
+#endif
+#if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
+_GL_CXXALIASWARN (fcvt);
+#endif
+
+#if @GNULIB_FREE_POSIX@
+# if @REPLACE_FREE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef free
+#   define free rpl_free
+#  endif
+_GL_FUNCDECL_RPL (free, void, (void *ptr));
+_GL_CXXALIAS_RPL (free, void, (void *ptr));
+# else
+_GL_CXXALIAS_SYS (free, void, (void *ptr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (free);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef free
+/* Assume free is always declared.  */
+_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
+                 "use gnulib module free for portability");
 #endif
 
+/* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
+   it.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef gcvt
-# define gcvt _gcvt
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef gcvt
+#  define gcvt _gcvt
+# endif
+_GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf));
+#else
+# if @HAVE_DECL_GCVT@
+_GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf));
+# endif
+#endif
+#if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
+_GL_CXXALIASWARN (gcvt);
 #endif
 
 #if @GNULIB_GETLOADAVG@
@@ -483,9 +575,47 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
 # endif
 #endif
 
+/* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::mktemp always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef mktemp
-# define mktemp _mktemp
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef mktemp
+#  define mktemp _mktemp
+# endif
+_GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/));
+#else
+_GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/));
+#endif
+_GL_CXXALIASWARN (mktemp);
+
+/* Allocate memory with indefinite extent and specified alignment.  */
+#if @GNULIB_POSIX_MEMALIGN@
+# if @REPLACE_POSIX_MEMALIGN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef posix_memalign
+#   define posix_memalign rpl_posix_memalign
+#  endif
+_GL_FUNCDECL_RPL (posix_memalign, int,
+                  (void **memptr, size_t alignment, size_t size)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (posix_memalign, int,
+                  (void **memptr, size_t alignment, size_t size));
+# else
+#  if @HAVE_POSIX_MEMALIGN@
+_GL_CXXALIAS_SYS (posix_memalign, int,
+                  (void **memptr, size_t alignment, size_t size));
+#  endif
+# endif
+# if @HAVE_POSIX_MEMALIGN@
+_GL_CXXALIASWARN (posix_memalign);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_memalign
+# if HAVE_RAW_DECL_POSIX_MEMALIGN
+_GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
+                 "use gnulib module posix_memalign for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_OPENPT@
@@ -576,9 +706,22 @@ _GL_CXXALIAS_MDA (putenv, int, (char *string));
 _GL_CXXALIAS_SYS (putenv, int, (char *string));
 # endif
 _GL_CXXALIASWARN (putenv);
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef putenv
-# define putenv _putenv
+#else
+/* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::putenv always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putenv
+#   define putenv _putenv
+#  endif
+/* Need to cast, because on mingw, the parameter is either
+   'const char *string' or 'char *string'.  */
+_GL_CXXALIAS_MDA_CAST (putenv, int, (char *string));
+# else
+_GL_CXXALIAS_SYS (putenv, int, (char *string));
+# endif
+_GL_CXXALIASWARN (putenv);
 #endif
 
 #if @GNULIB_QSORT_R@
diff --git a/lib/string.in.h b/lib/string.in.h
index 9724add..f34bfab 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -123,16 +123,28 @@ _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the 
ffsll module");
 #endif
 
 
+/* On native Windows, map 'memccpy' to '_memccpy', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::memccpy always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef memccpy
-# define memccpy _memccpy
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef memccpy
+#  define memccpy _memccpy
+# endif
+_GL_CXXALIAS_MDA (memccpy, void *,
+                  (void *dest, const void *src, int c, size_t n));
+#else
+_GL_CXXALIAS_SYS (memccpy, void *,
+                  (void *dest, const void *src, int c, size_t n));
 #endif
+_GL_CXXALIASWARN (memccpy);
 
 
 /* Return the first instance of C within N bytes of S, or NULL.  */
 #if @GNULIB_MEMCHR@
 # if @REPLACE_MEMCHR@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef memchr
 #   define memchr rpl_memchr
 #  endif
 _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
@@ -413,9 +425,23 @@ _GL_CXXALIASWARN (strdup);
 _GL_WARN_ON_USE (strdup, "strdup is unportable - "
                  "use gnulib module strdup for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef strdup
-# define strdup _strdup
+#else
+/* On native Windows, map 'creat' to '_creat', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::creat always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strdup
+#   define strdup _strdup
+#  endif
+_GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
+# else
+#  if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
+#   undef strdup
+#  endif
+_GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
+# endif
+_GL_CXXALIASWARN (strdup);
 #endif
 
 /* Append no more than N characters from SRC onto DEST.  */
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index 72cb9ba..ac1e939 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -103,9 +103,16 @@
 /* Get definition of 'sigset_t'.
    But avoid namespace pollution on glibc systems and "unknown type
    name" problems on Cygwin.
+   On OS/2 kLIBC, sigset_t is defined in <sys/select.h>, too. In addition,
+   if <sys/param.h> is included, <types.h> -> <sys/types.h> -> <sys/select.h>
+   are included. Then <signal.h> -> <pthread.h> are included by GNULIB. By the
+   way, <pthread.h> requires PAGE_SIZE defined in <sys/param.h>. However,
+   <sys/param.h> has not been processed, yet. As a result, 'PAGE_SIZE'
+   undeclared error occurs in <pthread.h>.
    Do this after the include_next (for the sake of OpenBSD 5.0) but before
    the split double-inclusion guard (for the sake of Solaris).  */
-#if !((defined __GLIBC__ || defined __CYGWIN__) && !defined __UCLIBC__)
+#if !((defined __GLIBC__ || defined __CYGWIN__ || defined __KLIBC__) \
+      && !defined __UCLIBC__)
 # include <signal.h>
 #endif
 
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 3e0e4b2..3ce2a0d 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -375,11 +375,11 @@ struct stat
 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
 #endif
 
-/* S_IXUGO is a common extension to POSIX.  */
+/* Although S_IXUGO and S_IRWXUGO are not specified by POSIX and are
+   not implemented in GNU/Linux, some Gnulib-using apps use the macros.  */
 #if !S_IXUGO
 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
 #endif
-
 #ifndef S_IRWXUGO
 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
 #endif
@@ -391,10 +391,20 @@ struct stat
 #endif
 
 
+/* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::chmod always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef chmod
-# define chmod _chmod
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef chmod
+#  define chmod _chmod
+# endif
+/* Need to cast, because in mingw the last argument is 'int mode'.  */
+_GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
+#else
+_GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
 #endif
+_GL_CXXALIASWARN (chmod);
 
 
 #if @GNULIB_FCHMODAT@
@@ -808,10 +818,20 @@ _GL_WARN_ON_USE (stat, "stat is unportable - "
 #endif
 
 
+/* On native Windows, map 'umask' to '_umask', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::umask always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef umask
-# define umask _umask
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef umask
+#  define umask _umask
+# endif
+/* Need to cast, because in mingw the last argument is 'int mode'.  */
+_GL_CXXALIAS_MDA_CAST (umask, mode_t, (mode_t mask));
+#else
+_GL_CXXALIAS_SYS (umask, mode_t, (mode_t mask));
 #endif
+_GL_CXXALIASWARN (umask);
 
 
 #if @GNULIB_UTIMENSAT@
diff --git a/lib/tempname.c b/lib/tempname.c
index cfb0fc4..b9f7cc8 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -47,9 +47,11 @@
 #include <string.h>
 
 #include <fcntl.h>
+#include <stdalign.h>
 #include <stdint.h>
 #include <sys/random.h>
 #include <sys/stat.h>
+#include <time.h>
 
 #if _LIBC
 # define struct_stat64 struct stat64
@@ -60,27 +62,33 @@
 # define __mkdir mkdir
 # define __open open
 # define __lxstat64(version, file, buf) lstat (file, buf)
+# define __getrandom getrandom
+# define __clock_gettime64 clock_gettime
+# define __timespec64 timespec
 #endif
 
-#ifdef _LIBC
-# include <random-bits.h>
-# define RANDOM_BITS(Var) ((Var) = random_bits ())
-typedef uint32_t random_value;
-# define RANDOM_VALUE_MAX UINT32_MAX
-# define BASE_62_DIGITS 5 /* 62**5 < UINT32_MAX */
-# define BASE_62_POWER (62 * 62 * 62 * 62 * 62) /* 2**BASE_62_DIGITS */
-#else
 /* Use getrandom if it works, falling back on a 64-bit linear
-   congruential generator that starts with whatever Var's value
-   happens to be.  */
-# define RANDOM_BITS(Var) \
-    ((void) (getrandom (&(Var), sizeof (Var), 0) == sizeof (Var) \
-             || ((Var) = 2862933555777941757 * (Var) + 3037000493)))
+   congruential generator that starts with Var's value
+   mixed in with a clock's low-order bits if available.  */
 typedef uint_fast64_t random_value;
-# define RANDOM_VALUE_MAX UINT_FAST64_MAX
-# define BASE_62_DIGITS 10 /* 62**10 < UINT_FAST64_MAX */
-# define BASE_62_POWER (62LL * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62)
+#define RANDOM_VALUE_MAX UINT_FAST64_MAX
+#define BASE_62_DIGITS 10 /* 62**10 < UINT_FAST64_MAX */
+#define BASE_62_POWER (62LL * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62)
+
+static random_value
+random_bits (random_value var)
+{
+  random_value r;
+  if (__getrandom (&r, sizeof r, 0) == sizeof r)
+    return r;
+#if _LIBC || (defined CLOCK_MONOTONIC && HAVE_CLOCK_GETTIME)
+  /* Add entropy if getrandom is not supported.  */
+  struct __timespec64 tv;
+  __clock_gettime64 (CLOCK_MONOTONIC, &tv);
+  var ^= tv.tv_nsec;
 #endif
+  return 2862933555777941757 * var + 3037000493;
+}
 
 #if _LIBC
 /* Return nonzero if DIR is an existent directory.  */
@@ -250,8 +258,11 @@ try_tempname_len (char *tmpl, int suffixlen, void *args,
   unsigned int attempts = ATTEMPTS_MIN;
 #endif
 
-  /* A random variable.  */
-  random_value v;
+  /* A random variable.  The initial value is used only the for fallback path
+     on 'random_bits' on 'getrandom' failure.  Its initial value tries to use
+     some entropy from the ASLR and ignore possible bits from the stack
+     alignment.  */
+  random_value v = ((uintptr_t) &v) / alignof (max_align_t);
 
   /* How many random base-62 digits can currently be extracted from V.  */
   int vdigits = 0;
@@ -279,7 +290,7 @@ try_tempname_len (char *tmpl, int suffixlen, void *args,
           if (vdigits == 0)
             {
               do
-                RANDOM_BITS (v);
+                v = random_bits (v);
               while (unfair_min <= v);
 
               vdigits = BASE_62_DIGITS;
diff --git a/lib/time.in.h b/lib/time.in.h
index 32e6ec0..1b17c15 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -145,9 +145,20 @@ _GL_CXXALIAS_MDA (tzset, void, (void));
 _GL_CXXALIAS_SYS (tzset, void, (void));
 #  endif
 _GL_CXXALIASWARN (tzset);
-# elif defined _WIN32 && !defined __CYGWIN__
-#  undef tzset
-#  define tzset _tzset
+# else
+/* On native Windows, map 'tzset' to '_tzset', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::tzset always.  */
+#  if defined _WIN32 && !defined __CYGWIN__
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef tzset
+#    define tzset _tzset
+#   endif
+_GL_CXXALIAS_MDA (tzset, void, (void));
+#  else
+_GL_CXXALIAS_SYS (tzset, void, (void));
+#  endif
+_GL_CXXALIASWARN (tzset);
 # endif
 
 /* Return the 'time_t' representation of TP and normalize TP.  */
@@ -356,17 +367,17 @@ _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in 
some cases - "
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef asctime_r
-_GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - "
+_GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - "
                  "better use strftime (or even sprintf) instead");
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef ctime
-_GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - "
+_GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - "
                  "better use strftime (or even sprintf) instead");
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef ctime_r
-_GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - "
+_GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - "
                  "better use strftime (or even sprintf) instead");
 # endif
 
diff --git a/lib/time_rz.c b/lib/time_rz.c
index 95438cf..8992c2e 100644
--- a/lib/time_rz.c
+++ b/lib/time_rz.c
@@ -27,19 +27,15 @@
 #include <time.h>
 
 #include <errno.h>
-#include <limits.h>
 #include <stdbool.h>
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include "flexmember.h"
+#include "idx.h"
 #include "time-internal.h"
 
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
-
 /* The approximate size to use for small allocation requests.  This is
    the largest "small" request for the GNU C library malloc.  */
 enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 };
@@ -125,14 +121,8 @@ save_abbr (timezone_t tz, struct tm *tm)
         {
           if (! (*zone_copy || (zone_copy == tz->abbrs && tz->tz_is_set)))
             {
-              size_t zone_size = strlen (zone) + 1;
-              size_t zone_used = zone_copy - tz->abbrs;
-              if (SIZE_MAX - zone_used < zone_size)
-                {
-                  errno = ENOMEM;
-                  return false;
-                }
-              if (zone_used + zone_size < ABBR_SIZE_MIN)
+              idx_t zone_size = strlen (zone) + 1;
+              if (zone_size < tz->abbrs + ABBR_SIZE_MIN - zone_copy)
                 extend_abbrs (zone_copy, zone, zone_size);
               else
                 {
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 357a35e..4033ffe 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -93,20 +93,18 @@
 # undef __need_system_stdlib_h
 #endif
 
-/* Native Windows platforms declare chdir, getcwd, rmdir in
+/* Native Windows platforms declare _chdir, _getcwd, _rmdir in
    <io.h> and/or <direct.h>, not in <unistd.h>.
-   They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
-   lseek(), read(), unlink(), write() in <io.h>.  */
-#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
-      || defined GNULIB_POSIXCHECK) \
-     && (defined _WIN32 && ! defined __CYGWIN__))
-# include <io.h>     /* mingw32, mingw64 */
-# include <direct.h> /* mingw64, MSVC 9 */
-#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
-       || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ 
\
-       || defined GNULIB_POSIXCHECK) \
-      && (defined _WIN32 && ! defined __CYGWIN__)
+   They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
+   _lseek(), _read(), _unlink(), _write() in <io.h>.  */
+#if defined _WIN32 && !defined __CYGWIN__
 # include <io.h>
+# include <direct.h>
+#endif
+
+/* Native Windows platforms declare _execl*, _execv* in <process.h>.  */
+#if defined _WIN32 && !defined __CYGWIN__
+# include <process.h>
 #endif
 
 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
@@ -138,11 +136,8 @@
 
 /* MSVC defines off_t in <sys/types.h>.
    May also define off_t to a 64-bit type on native Windows.  */
-/* But avoid namespace pollution on glibc systems.  */
-#ifndef __GLIBC__
-/* Get off_t, ssize_t.  */
-# include <sys/types.h>
-#endif
+/* Get off_t, ssize_t, mode_t.  */
+#include <sys/types.h>
 
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
@@ -292,9 +287,20 @@ _GL_WARN_ON_USE (access, "access does not always support 
X_OK - "
                  "also, this function is a security risk - "
                  "use the gnulib module faccessat instead");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef access
-# define access _access
+#else
+/* On native Windows, map 'access' to '_access', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::access always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef access
+#   define access _access
+#  endif
+_GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
+# else
+_GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
+# endif
+_GL_CXXALIASWARN (access);
 #endif
 
 
@@ -315,9 +321,20 @@ _GL_CXXALIASWARN (chdir);
 _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
                  "use gnulib module chdir for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef chdir
-# define chdir _chdir
+#else
+/* On native Windows, map 'chdir' to '_chdir', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::chdir always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chdir
+#   define chdir _chdir
+#  endif
+_GL_CXXALIAS_MDA (chdir, int, (const char *file));
+# else
+_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIASWARN (chdir);
 #endif
 
 
@@ -380,9 +397,20 @@ _GL_CXXALIASWARN (close);
 /* Assume close is always declared.  */
 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
                  "use gnulib module close for portability");
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef close
-# define close _close
+#else
+/* On native Windows, map 'close' to '_close', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::close always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close _close
+#  endif
+_GL_CXXALIAS_MDA (close, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (close, int, (int fd));
+# endif
+_GL_CXXALIASWARN (close);
 #endif
 
 
@@ -397,10 +425,11 @@ _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, 
off_t *ipos,
 # endif
 _GL_CXXALIASWARN (copy_file_range);
 #elif defined GNULIB_POSIXCHECK
-/* Assume copy_file_range is always declared.  */
+# if HAVE_RAW_DECL_COPY_FILE_RANGE
 _GL_WARN_ON_USE (copy_file_range,
                  "copy_file_range is unportable - "
                  "use gnulib module copy_file_range for portability");
+# endif
 #endif
 
 
@@ -427,9 +456,20 @@ _GL_CXXALIASWARN (dup);
 _GL_WARN_ON_USE (dup, "dup is unportable - "
                  "use gnulib module dup for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef dup
-# define dup _dup
+#else
+/* On native Windows, map 'dup' to '_dup', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::dup always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup
+#   define dup _dup
+#  endif
+_GL_CXXALIAS_MDA (dup, int, (int oldfd));
+# else
+_GL_CXXALIAS_SYS (dup, int, (int oldfd));
+# endif
+_GL_CXXALIASWARN (dup);
 #endif
 
 
@@ -461,9 +501,20 @@ _GL_CXXALIASWARN (dup2);
 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
                  "use gnulib module dup2 for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef dup2
-# define dup2 _dup2
+#else
+/* On native Windows, map 'dup2' to '_dup2', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::dup2 always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup2
+#   define dup2 _dup2
+#  endif
+_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
+# else
+_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
+# endif
+_GL_CXXALIASWARN (dup2);
 #endif
 
 
@@ -564,40 +615,116 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - 
"
 #endif
 
 
+/* On native Windows, map 'execl' to '_execl', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execl always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execl
-# define execl _execl
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execl
+#  define execl _execl
+# endif
+_GL_CXXALIAS_MDA (execl, intptr_t, (const char *program, const char *arg, 
...));
+#else
+_GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
 #endif
+_GL_CXXALIASWARN (execl);
 
+/* On native Windows, map 'execle' to '_execle', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execle always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execle
-# define execle _execle
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execle
+#  define execle _execle
+# endif
+_GL_CXXALIAS_MDA (execle, intptr_t, (const char *program, const char *arg, 
...));
+#else
+_GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
 #endif
+_GL_CXXALIASWARN (execle);
 
+/* On native Windows, map 'execlp' to '_execlp', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execlp always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execlp
-# define execlp _execlp
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execlp
+#  define execlp _execlp
+# endif
+_GL_CXXALIAS_MDA (execlp, intptr_t, (const char *program, const char *arg, 
...));
+#else
+_GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
 #endif
+_GL_CXXALIASWARN (execlp);
 
 
+/* On native Windows, map 'execv' to '_execv', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execv always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execv
-# define execv _execv
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execv
+#  define execv _execv
+# endif
+_GL_CXXALIAS_MDA (execv, intptr_t,
+                  (const char *program, const char * const *argv));
+#else
+_GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
 #endif
+_GL_CXXALIASWARN (execv);
 
+/* On native Windows, map 'execve' to '_execve', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execve always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execve
-# define execve _execve
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execve
+#  define execve _execve
+# endif
+_GL_CXXALIAS_MDA (execve, intptr_t,
+                  (const char *program, const char * const *argv,
+                   const char * const *env));
+#else
+_GL_CXXALIAS_SYS (execve, int,
+                  (const char *program, char * const *argv, char * const 
*env));
 #endif
+_GL_CXXALIASWARN (execve);
 
+/* On native Windows, map 'execvp' to '_execvp', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execvp always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execvp
-# define execvp _execvp
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execvp
+#  define execvp _execvp
+# endif
+_GL_CXXALIAS_MDA (execvp, intptr_t,
+                  (const char *program, const char * const *argv));
+#else
+_GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
 #endif
+_GL_CXXALIASWARN (execvp);
 
+/* On native Windows, map 'execvpe' to '_execvpe', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execvpe on all platforms that have
+   it.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef execvpe
-# define execvpe _execvpe
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef execvpe
+#  define execvpe _execvpe
+# endif
+_GL_CXXALIAS_MDA (execvpe, intptr_t,
+                  (const char *program, const char * const *argv,
+                   const char * const *env));
+#else
+# if @HAVE_DECL_EXECVPE@
+_GL_CXXALIAS_SYS (execvpe, int,
+                  (const char *program, char * const *argv, char * const 
*env));
+# endif
+#endif
+#if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_EXECVPE@
+_GL_CXXALIASWARN (execvpe);
 #endif
 
 
@@ -794,9 +921,22 @@ _GL_CXXALIASWARN (getcwd);
 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
                  "use gnulib module getcwd for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef getcwd
-# define getcwd _getcwd
+#else
+/* On native Windows, map 'getcwd' to '_getcwd', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::getcwd always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getcwd
+#   define getcwd _getcwd
+#  endif
+/* Need to cast, because on mingw, the second parameter is either
+   'int size' or 'size_t size'.  */
+_GL_CXXALIAS_MDA_CAST (getcwd, char *, (char *buf, size_t size));
+# else
+_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
+# endif
+_GL_CXXALIASWARN (getcwd);
 #endif
 
 
@@ -1131,10 +1271,19 @@ _GL_WARN_ON_USE (getpass, "getpass is unportable - "
 #endif
 
 
+/* On native Windows, map 'getpid' to '_getpid', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::getpid always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef getpid
-# define getpid _getpid
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef getpid
+#  define getpid _getpid
+# endif
+_GL_CXXALIAS_MDA (getpid, int, (void));
+#else
+_GL_CXXALIAS_SYS (getpid, pid_t, (void));
 #endif
+_GL_CXXALIASWARN (getpid);
 
 
 #if @GNULIB_GETUSERSHELL@
@@ -1225,9 +1374,20 @@ _GL_CXXALIASWARN (isatty);
 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
                  "use gnulib module isatty for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef isatty
-# define isatty _isatty
+#else
+/* On native Windows, map 'isatty' to '_isatty', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::isatty always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef isatty
+#   define isatty _isatty
+#  endif
+_GL_CXXALIAS_MDA (isatty, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (isatty, int, (int fd));
+# endif
+_GL_CXXALIASWARN (isatty);
 #endif
 
 
@@ -1355,9 +1515,20 @@ _GL_CXXALIASWARN (lseek);
 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
                  "systems - use gnulib module lseek for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef lseek
-# define lseek _lseek
+#else
+/* On native Windows, map 'lseek' to '_lseek', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::lseek always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef lseek
+#   define lseek _lseek
+#  endif
+_GL_CXXALIAS_MDA (lseek, long, (int fd, long offset, int whence));
+# else
+_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
+# endif
+_GL_CXXALIASWARN (lseek);
 #endif
 
 
@@ -1497,15 +1668,27 @@ _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, 
size_t count));
 #  endif
 _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
 # else
-/* Need to cast, because on mingw, the third parameter is
-                                                          unsigned int count
-   and the return type is 'int'.  */
-_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
+_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (read);
+#else
+/* On native Windows, map 'read' to '_read', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::read always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef read
+#   define read _read
+#  endif
+#  ifdef __MINGW32__
+_GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count));
+#  else
+_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count));
+#  endif
+# else
+_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
 # endif
 _GL_CXXALIASWARN (read);
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef read
-# define read _read
 #endif
 
 
@@ -1604,9 +1787,20 @@ _GL_CXXALIASWARN (rmdir);
 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
                  "use gnulib module rmdir for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef rmdir
-# define rmdir _rmdir
+#else
+/* On native Windows, map 'rmdir' to '_rmdir', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::rmdir always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef rmdir
+#   define rmdir _rmdir
+#  endif
+_GL_CXXALIAS_MDA (rmdir, int, (char const *name));
+# else
+_GL_CXXALIAS_SYS (rmdir, int, (char const *name));
+# endif
+_GL_CXXALIASWARN (rmdir);
 #endif
 
 
@@ -1665,10 +1859,19 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - "
 #endif
 
 
+/* On native Windows, map 'swab' to '_swab', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::creat always.  */
 #if defined _WIN32 && !defined __CYGWIN__
-# undef swab
-# define swab _swab
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef swab
+#  define swab _swab
+# endif
+_GL_CXXALIAS_MDA (swab, void, (char *from, char *to, int n));
+#else
+_GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
 #endif
+_GL_CXXALIASWARN (swab);
 
 
 #if @GNULIB_SYMLINK@
@@ -1811,9 +2014,20 @@ _GL_CXXALIASWARN (unlink);
 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
                  "use gnulib module unlink for portability");
 # endif
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef unlink
-# define unlink _unlink
+#else
+/* On native Windows, map 'unlink' to '_unlink', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::unlink always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unlink
+#   define unlink _unlink
+#  endif
+_GL_CXXALIAS_MDA (unlink, int, (char const *file));
+# else
+_GL_CXXALIAS_SYS (unlink, int, (char const *file));
+# endif
+_GL_CXXALIASWARN (unlink);
 #endif
 
 
@@ -1892,15 +2106,27 @@ _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void 
*buf, size_t count));
 #  endif
 _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
 # else
-/* Need to cast, because on mingw, the third parameter is
-                                                             unsigned int count
-   and the return type is 'int'.  */
-_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t 
count));
+_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (write);
+#else
+/* On native Windows, map 'write' to '_write', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::write always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef write
+#   define write _write
+#  endif
+#  ifdef __MINGW32__
+_GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count));
+#  else
+_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int 
count));
+#  endif
+# else
+_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
 # endif
 _GL_CXXALIASWARN (write);
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef write
-# define write _write
 #endif
 
 _GL_INLINE_HEADER_END
diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h
index 13ee230..7cd4a74 100644
--- a/lib/xalloc-oversized.h
+++ b/lib/xalloc-oversized.h
@@ -41,7 +41,7 @@ typedef size_t __xalloc_count_type;
    positive and N must be nonnegative.  This is a macro, not a
    function, so that it works correctly even when SIZE_MAX < N.  */
 
-#if 7 <= __GNUC__
+#if 7 <= __GNUC__ && !defined __clang__
 # define xalloc_oversized(n, s) \
    __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1)
 #elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__
diff --git a/m4/alloca.m4 b/m4/alloca.m4
index d841489..e3c377c 100644
--- a/m4/alloca.m4
+++ b/m4/alloca.m4
@@ -1,4 +1,4 @@
-# alloca.m4 serial 18
+# alloca.m4 serial 20
 dnl Copyright (C) 2002-2004, 2006-2007, 2009-2020 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -104,5 +104,5 @@ AH_VERBATIM([STACK_DIRECTION],
         STACK_DIRECTION = 0 => direction of growth unknown */
 #undef STACK_DIRECTION])dnl
 AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
-])
+])# _AC_LIBOBJ_ALLOCA
 ])
diff --git a/m4/extensions.m4 b/m4/extensions.m4
index d7c95ef..44be1d1 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -1,4 +1,4 @@
-# serial 18  -*- Autoconf -*-
+# serial 21  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
 # Copyright (C) 2003, 2006-2020 Free Software Foundation, Inc.
@@ -6,9 +6,14 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+dnl Define to empty for the benefit of Autoconf 2.69 and earlier, so that
+dnl AC_USE_SYSTEM_EXTENSIONS (below) can be used unchanged from Autoconf 2.70+.
+m4_ifndef([AC_CHECK_INCLUDES_DEFAULT],
+  [AC_DEFUN([AC_CHECK_INCLUDES_DEFAULT], [])])
+
 # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git
 # Autoconf.  Perhaps we can remove this once we can assume Autoconf
-# 2.70 or later everywhere, but since Autoconf mutates rapidly
+# is recent-enough everywhere, but since Autoconf mutates rapidly
 # enough in this area it's likely we'll need to redefine
 # AC_USE_SYSTEM_EXTENSIONS for quite some time.
 
@@ -26,36 +31,27 @@
 #      its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
 #      invocation occurs in gl_EARLY, not in gl_INIT.
 
+m4_version_prereq([2.70.1], [], [
+
 # AC_USE_SYSTEM_EXTENSIONS
 # ------------------------
 # Enable extensions on systems that normally disable them,
 # typically due to standards-conformance issues.
-#
-# Remember that #undef in AH_VERBATIM gets replaced with #define by
-# AC_DEFINE.  The goal here is to define all known feature-enabling
-# macros, then, if reports of conflicts are made, disable macros that
-# cause problems on some platforms (such as __EXTENSIONS__).
+# We unconditionally define as many of the known feature-enabling
+# as possible, reserving conditional behavior for macros that are
+# known to cause problems on some platforms (such as __EXTENSIONS__).
 AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
-[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
+[AC_BEFORE([$0], [AC_PREPROC_IFELSE])dnl
+AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
+AC_BEFORE([$0], [AC_LINK_IFELSE])dnl
 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-
-  AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
-  if test "$MINIX" = yes; then
-    AC_DEFINE([_POSIX_SOURCE], [1],
-      [Define to 1 if you need to in order for 'stat' and other
-       things to work.])
-    AC_DEFINE([_POSIX_1_SOURCE], [2],
-      [Define to 2 if the system does not provide POSIX.1 features
-       except with this defined.])
-    AC_DEFINE([_MINIX], [1],
-      [Define to 1 if on MINIX.])
-    AC_DEFINE([_NETBSD_SOURCE], [1],
-      [Define to 1 to make NetBSD features available.  MINIX 3 needs this.])
-  fi
-
+AC_BEFORE([$0], [AC_CHECK_INCLUDES_DEFAULT])dnl
+dnl #undef in AH_VERBATIM gets replaced with #define by AC_DEFINE.
 dnl Use a different key than __EXTENSIONS__, as that name broke existing
 dnl configure.ac when using autoheader 2.62.
-  AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
+dnl The macros below are in alphabetical order ignoring leading _ or __
+dnl prefixes.
+AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
 [/* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
@@ -64,19 +60,44 @@ dnl configure.ac when using autoheader 2.62.
 #ifndef _DARWIN_C_SOURCE
 # undef _DARWIN_C_SOURCE
 #endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
 /* Enable GNU extensions on systems that have them.  */
 #ifndef _GNU_SOURCE
 # undef _GNU_SOURCE
 #endif
-/* Enable NetBSD extensions on NetBSD.  */
+/* Enable X/Open compliant socket functions that do not require linking
+   with -lxnet on HP-UX 11.11.  */
+#ifndef _HPUX_ALT_XOPEN_SOCKET_API
+# undef _HPUX_ALT_XOPEN_SOCKET_API
+#endif
+/* Identify the host operating system as Minix.
+   This macro does not affect the system headers' behavior.
+   A future release of Autoconf may stop defining this macro.  */
+#ifndef _MINIX
+# undef _MINIX
+#endif
+/* Enable general extensions on NetBSD.
+   Enable NetBSD compatibility extensions on Minix.  */
 #ifndef _NETBSD_SOURCE
 # undef _NETBSD_SOURCE
 #endif
-/* Enable OpenBSD extensions on NetBSD.  */
+/* Enable OpenBSD compatibility extensions on NetBSD.
+   Oddly enough, this does nothing on OpenBSD.  */
 #ifndef _OPENBSD_SOURCE
 # undef _OPENBSD_SOURCE
 #endif
-/* Enable threading extensions on Solaris.  */
+/* Define to 1 if needed for POSIX-compatible behavior.  */
+#ifndef _POSIX_SOURCE
+# undef _POSIX_SOURCE
+#endif
+/* Define to 2 if needed for POSIX-compatible behavior.  */
+#ifndef _POSIX_1_SOURCE
+# undef _POSIX_1_SOURCE
+#endif
+/* Enable POSIX-compatible threading on Solaris.  */
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
 #endif
@@ -112,22 +133,19 @@ dnl configure.ac when using autoheader 2.62.
 #ifndef _TANDEM_SOURCE
 # undef _TANDEM_SOURCE
 #endif
-/* Enable X/Open extensions if necessary.  HP-UX 11.11 defines
-   mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
-   whether compiling with -Ae or -D_HPUX_SOURCE=1.  */
+/* Enable X/Open extensions.  Define to 500 only if necessary
+   to make mbstate_t available.  */
 #ifndef _XOPEN_SOURCE
 # undef _XOPEN_SOURCE
 #endif
-/* Enable X/Open compliant socket functions that do not require linking
-   with -lxnet on HP-UX 11.11.  */
-#ifndef _HPUX_ALT_XOPEN_SOCKET_API
-# undef _HPUX_ALT_XOPEN_SOCKET_API
-#endif
-/* Enable general extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-])
+])dnl
+
+  AC_REQUIRE([AC_CHECK_INCLUDES_DEFAULT])dnl
+  _AC_CHECK_HEADER_ONCE([wchar.h])
+  _AC_CHECK_HEADER_ONCE([minix/config.h])
+
+dnl Defining __EXTENSIONS__ may break the system headers on some systems.
+dnl (FIXME: Which ones?)
   AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
     [ac_cv_safe_to_define___extensions__],
     [AC_COMPILE_IFELSE(
@@ -136,11 +154,33 @@ dnl configure.ac when using autoheader 2.62.
           ]AC_INCLUDES_DEFAULT])],
        [ac_cv_safe_to_define___extensions__=yes],
        [ac_cv_safe_to_define___extensions__=no])])
-  test $ac_cv_safe_to_define___extensions__ = yes &&
-    AC_DEFINE([__EXTENSIONS__])
+
+dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to
+dnl 500, regardless of whether compiling with -Ae or -D_HPUX_SOURCE=1.
+dnl But defining _XOPEN_SOURCE may turn *off* extensions on platforms
+dnl not covered by turn-on-extensions macros (notably Dragonfly, Free,
+dnl and OpenBSD, which don't have any equivalent of _NETBSD_SOURCE) so
+dnl it should only be defined when necessary.
+  AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
+    [ac_cv_should_define__xopen_source],
+    [ac_cv_should_define__xopen_source=no
+    AS_IF([test $ac_cv_header_wchar_h = yes],
+      [AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[
+          #include <wchar.h>
+          mbstate_t x;]])],
+        [],
+        [AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM([[
+            #define _XOPEN_SOURCE 500
+            #include <wchar.h>
+            mbstate_t x;]])],
+          [ac_cv_should_define__xopen_source=yes])])])])
+
   AC_DEFINE([_ALL_SOURCE])
   AC_DEFINE([_DARWIN_C_SOURCE])
   AC_DEFINE([_GNU_SOURCE])
+  AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API])
   AC_DEFINE([_NETBSD_SOURCE])
   AC_DEFINE([_OPENBSD_SOURCE])
   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
@@ -152,24 +192,18 @@ dnl configure.ac when using autoheader 2.62.
   AC_DEFINE([__STDC_WANT_LIB_EXT2__])
   AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__])
   AC_DEFINE([_TANDEM_SOURCE])
-  AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
-    [ac_cv_should_define__xopen_source],
-    [ac_cv_should_define__xopen_source=no
-     AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM([[
-          #include <wchar.h>
-          mbstate_t x;]])],
-       [],
-       [AC_COMPILE_IFELSE(
-          [AC_LANG_PROGRAM([[
-             #define _XOPEN_SOURCE 500
-             #include <wchar.h>
-             mbstate_t x;]])],
-          [ac_cv_should_define__xopen_source=yes])])])
-  test $ac_cv_should_define__xopen_source = yes &&
-    AC_DEFINE([_XOPEN_SOURCE], [500])
-  AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API])
+  AS_IF([test $ac_cv_header_minix_config_h = yes],
+    [MINIX=yes
+    AC_DEFINE([_MINIX])
+    AC_DEFINE([_POSIX_SOURCE])
+    AC_DEFINE([_POSIX_1_SOURCE], [2])],
+    [MINIX=])
+  AS_IF([test $ac_cv_safe_to_define___extensions__ = yes],
+    [AC_DEFINE([__EXTENSIONS__])])
+  AS_IF([test $ac_cv_should_define__xopen_source = yes],
+    [AC_DEFINE([_XOPEN_SOURCE], [500])])
 ])# AC_USE_SYSTEM_EXTENSIONS
+])
 
 # gl_USE_SYSTEM_EXTENSIONS
 # ------------------------
@@ -177,13 +211,5 @@ dnl configure.ac when using autoheader 2.62.
 # typically due to standards-conformance issues.
 AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
 [
-  dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS.
-  dnl gnulib does not need it. But if it gets required by third-party macros
-  dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a
-  dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
-  dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE,
-  dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck.
-  AC_REQUIRE([AC_GNU_SOURCE])
-
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 ])
diff --git a/m4/fcntl.m4 b/m4/fcntl.m4
index ea24f3d..547ff40 100644
--- a/m4/fcntl.m4
+++ b/m4/fcntl.m4
@@ -1,4 +1,4 @@
-# fcntl.m4 serial 10
+# fcntl.m4 serial 11
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -81,15 +81,29 @@ AC_DEFUN([gl_FUNC_FCNTL],
           behavior does not match POSIX]) ;;
     esac
 
-    dnl Many systems lack F_DUPFD_CLOEXEC
+    dnl Many systems lack F_DUPFD_CLOEXEC.
+    dnl NetBSD 9.0 declares F_DUPFD_CLOEXEC but it works only like F_DUPFD.
     AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC],
       [gl_cv_func_fcntl_f_dupfd_cloexec],
-      [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include <fcntl.h>
-#ifndef F_DUPFD_CLOEXEC
-choke me
-#endif
-         ]])],
+      [AC_RUN_IFELSE(
+         [AC_LANG_SOURCE(
+            [[#include <fcntl.h>
+              #include <unistd.h>
+              int main (int argc, char *argv[])
+              {
+                if (argc == 1)
+                  /* parent process */
+                  {
+                    if (fcntl (1, F_DUPFD_CLOEXEC, 10) < 0)
+                      return 1;
+                    return execl ("./conftest", "./conftest", "child", NULL);
+                  }
+                else
+                  /* child process */
+                  return (fcntl (10, F_GETFL) < 0 ? 0 : 42);
+              }
+            ]])
+         ],
          [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #ifdef __linux__
 /* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace
@@ -98,12 +112,22 @@ choke me
 #endif
            ]])],
            [gl_cv_func_fcntl_f_dupfd_cloexec=yes],
-           [gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check"])],
-         [gl_cv_func_fcntl_f_dupfd_cloexec=no])])
-    if test "$gl_cv_func_fcntl_f_dupfd_cloexec" != yes; then
-      gl_REPLACE_FCNTL
-      dnl No witness macro needed for this bug.
-    fi
+           [gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check"])
+         ],
+         [gl_cv_func_fcntl_f_dupfd_cloexec=no],
+         [case "$host_os" in
+                     # Guess no on NetBSD.
+            netbsd*) gl_cv_func_fcntl_f_dupfd_cloexec="guessing no" ;;
+            *)       gl_cv_func_fcntl_f_dupfd_cloexec="$gl_cross_guess_normal" 
;;
+          esac
+         ])
+      ])
+    case "$gl_cv_func_fcntl_f_dupfd_cloexec" in
+      *yes) ;;
+      *)    gl_REPLACE_FCNTL
+            dnl No witness macro needed for this bug.
+            ;;
+    esac
   fi
   dnl Replace fcntl() for supporting the gnulib-defined fchdir() function,
   dnl to keep fchdir's bookkeeping up-to-date.
diff --git a/m4/filemode.m4 b/m4/filemode.m4
index 5aaaa1a..8bbfcdb 100644
--- a/m4/filemode.m4
+++ b/m4/filemode.m4
@@ -1,4 +1,4 @@
-# filemode.m4 serial 8
+# filemode.m4 serial 9
 dnl Copyright (C) 2002, 2005-2006, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,6 +6,5 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_FILEMODE],
 [
-  AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
   AC_CHECK_DECLS_ONCE([strmode])
 ])
diff --git a/m4/free.m4 b/m4/free.m4
new file mode 100644
index 0000000..bf9fc31
--- /dev/null
+++ b/m4/free.m4
@@ -0,0 +1,49 @@
+# free.m4 serial 5
+# Copyright (C) 2003-2005, 2009-2020 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Written by Paul Eggert and Bruno Haible.
+
+AC_DEFUN([gl_FUNC_FREE],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+  dnl In the next release of POSIX, free must preserve errno.
+  dnl https://www.austingroupbugs.net/view.php?id=385
+  dnl https://sourceware.org/bugzilla/show_bug.cgi?id=17924
+  dnl So far, we know of three platforms that do this:
+  dnl * glibc >= 2.33, thanks to the fix for this bug:
+  dnl   <https://sourceware.org/bugzilla/show_bug.cgi?id=17924>
+  dnl * OpenBSD >= 4.5, thanks to this commit:
+  dnl   
<https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c.diff?r1=1.100&r2=1.101&f=h>
+  dnl * Solaris, because its malloc() implementation is based on brk(),
+  dnl   not mmap(); hence its free() implementation makes no system calls.
+  dnl For other platforms, you can only be sure if they state it in their
+  dnl documentation, or by code inspection of the free() implementation in 
libc.
+  AC_CACHE_CHECK([whether free is known to preserve errno],
+    [gl_cv_func_free_preserves_errno],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdlib.h>
+          ]],
+          [[#if 2 < __GLIBC__ + (33 <= __GLIBC_MINOR__)
+            #elif defined __OpenBSD__
+            #elif defined __sun
+            #else
+              #error "'free' is not known to preserve errno"
+            #endif
+          ]])],
+       [gl_cv_func_free_preserves_errno=yes],
+       [gl_cv_func_free_preserves_errno=no])
+    ])
+
+  case $gl_cv_func_free_preserves_errno in
+   *yes) ;;
+   *) REPLACE_FREE=1 ;;
+  esac
+])
+
+# Prerequisites of lib/free.c.
+AC_DEFUN([gl_PREREQ_FREE], [:])
diff --git a/m4/fsusage.m4 b/m4/fsusage.m4
index 0bc6206..c15cfca 100644
--- a/m4/fsusage.m4
+++ b/m4/fsusage.m4
@@ -1,4 +1,4 @@
-# serial 34
+# serial 35
 # Obtaining file system usage information.
 
 # Copyright (C) 1997-1998, 2000-2001, 2003-2020 Free Software Foundation, Inc.
@@ -36,7 +36,6 @@ AC_DEFUN([gl_FILE_SYSTEM_USAGE],
   dnl Mac OS X >= 10.5 (32-bit mode).
   AC_REQUIRE([AC_SYS_LARGEFILE])
 
-  AC_MSG_CHECKING([how to get file system space usage])
   ac_fsusage_space=no
 
   # Perform only the link test since it seems there are no variants of the
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 33e56fa..2c0ae9b 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 57
+# gnulib-common.m4 serial 63
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -483,23 +483,17 @@ AC_DEFUN([gl_FEATURES_H],
 # gl_PROG_CC_C99
 # Modifies the value of the shell variable CC in an attempt to make $CC
 # understand ISO C99 source code.
-# This is like AC_PROG_CC_C99, except that
-# - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC
-#   <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00367.html>,
-#   but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99
-#   <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00441.html>.
-# Remaining problems:
-# - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options
-#   to CC twice
-#   <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00431.html>.
-# - AC_PROG_CC_STDC is likely to change now that C11 is an ISO standard.
 AC_DEFUN([gl_PROG_CC_C99],
 [
-  dnl Change that version number to the minimum Autoconf version that supports
-  dnl mixing AC_PROG_CC_C99 calls with AC_PROG_CC_STDC calls.
-  m4_version_prereq([9.0],
-    [AC_REQUIRE([AC_PROG_CC_C99])],
-    [AC_REQUIRE([AC_PROG_CC_STDC])])
+  dnl Just use AC_PROG_CC_C99.
+  dnl When AC_PROG_CC_C99 and AC_PROG_CC_STDC are used together, the 
substituted
+  dnl value of CC will contain the C99 enabling options twice. But this is only
+  dnl a cosmetic problem.
+  dnl With Autoconf >= 2.70, use AC_PROG_CC since it implies AC_PROG_CC_C99;
+  dnl this avoids a "warning: The macro `AC_PROG_CC_C99' is obsolete."
+  m4_version_prereq([2.70],
+    [AC_REQUIRE([AC_PROG_CC])],
+    [AC_REQUIRE([AC_PROG_CC_C99])])
 ])
 
 # gl_PROG_AR_RANLIB
@@ -573,16 +567,16 @@ Amsterdam
 ])
 
 # AC_C_RESTRICT
-# This definition is copied from post-2.69 Autoconf and overrides the
-# AC_C_RESTRICT macro from autoconf 2.60..2.69.  It can be removed
-# once autoconf >= 2.70 can be assumed.  It's painful to check version
-# numbers, and in practice this macro is more up-to-date than Autoconf
-# is, so override Autoconf unconditionally.
+# This definition is copied from post-2.70 Autoconf and overrides the
+# AC_C_RESTRICT macro from autoconf 2.60..2.70.
+m4_version_prereq([2.70.1], [], [
 AC_DEFUN([AC_C_RESTRICT],
 [AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
   [ac_cv_c_restrict=no
-   # The order here caters to the fact that C++ does not require restrict.
-   for ac_kw in __restrict __restrict__ _Restrict restrict; do
+   # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see:
+   # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html
+   # Put 'restrict' last, because C++ lacks it.
+   for ac_kw in __restrict__ __restrict _Restrict restrict; do
      AC_COMPILE_IFELSE(
       [AC_LANG_PROGRAM(
          [[typedef int *int_ptr;
@@ -602,7 +596,7 @@ AC_DEFUN([AC_C_RESTRICT],
  AH_VERBATIM([restrict],
 [/* Define to the equivalent of the C99 'restrict' keyword, or to
    nothing if this is not supported.  Do not define if restrict is
-   supported directly.  */
+   supported only directly.  */
 #undef restrict
 /* Work around a bug in older versions of Sun C++, which did not
    #define __restrict__ or support _Restrict or __restrict__
@@ -620,6 +614,7 @@ AC_DEFUN([AC_C_RESTRICT],
    *)  AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
  esac
 ])# AC_C_RESTRICT
+])
 
 # gl_BIGENDIAN
 # is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd.
@@ -630,13 +625,20 @@ AC_DEFUN([gl_BIGENDIAN],
   AC_C_BIGENDIAN
 ])
 
+# A temporary file descriptor.
+# Must be less than 10, because dash 0.5.8 does not support redirections
+# with multi-digit file descriptors.
+m4_define([GL_TMP_FD], 9)
+
 # gl_SILENT(command)
 # executes command, but without the normal configure output.
+# This is useful when you want to invoke AC_CACHE_CHECK (or AC_CHECK_FUNC etc.)
+# inside another AC_CACHE_CHECK.
 AC_DEFUN([gl_SILENT],
 [
-  {
-    $1
-  } AS_MESSAGE_FD>/dev/null
+  exec GL_TMP_FD>&AS_MESSAGE_FD AS_MESSAGE_FD>/dev/null
+  $1
+  exec AS_MESSAGE_FD>&GL_TMP_FD GL_TMP_FD>&-
 ])
 
 # gl_CACHE_VAL_SILENT(cache-id, command-to-set-it)
@@ -646,10 +648,9 @@ AC_DEFUN([gl_SILENT],
 # by an AC_MSG_CHECKING/AC_MSG_RESULT pair.
 AC_DEFUN([gl_CACHE_VAL_SILENT],
 [
-  saved_as_echo_n="$as_echo_n"
-  as_echo_n=':'
-  AC_CACHE_VAL([$1], [$2])
-  as_echo_n="$saved_as_echo_n"
+  gl_SILENT([
+    AC_CACHE_VAL([$1], [$2])
+  ])
 ])
 
 dnl Expands to some code for use in .c programs that, on native Windows, 
defines
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index d2fdbd8..beb9817 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -94,6 +94,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module fpending:
   # Code from module fpieee:
   AC_REQUIRE([gl_FP_IEEE])
+  # Code from module free-posix:
   # Code from module fstatat:
   # Code from module fsusage:
   # Code from module fsync:
@@ -109,6 +110,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module gettimeofday:
   # Code from module gitlog-to-changelog:
   # Code from module group-member:
+  # Code from module idx:
   # Code from module ieee754-h:
   # Code from module ignore-value:
   # Code from module include_next:
@@ -121,7 +123,6 @@ AC_DEFUN([gl_EARLY],
   # Code from module libgmp:
   # Code from module limits-h:
   # Code from module lstat:
-  # Code from module malloca:
   # Code from module manywarnings:
   # Code from module memmem-simple:
   # Code from module mempcpy:
@@ -140,10 +141,12 @@ AC_DEFUN([gl_EARLY],
   # Code from module pselect:
   # Code from module pthread_sigmask:
   # Code from module qcopy-acl:
+  # Code from module rawmemchr:
   # Code from module readlink:
   # Code from module readlinkat:
   # Code from module regex:
   # Code from module root-uid:
+  # Code from module scratch_buffer:
   # Code from module sig2str:
   # Code from module sigdescr_np:
   # Code from module signal-h:
@@ -508,16 +511,19 @@ AC_DEFUN([gl_INIT],
   gl_gnulib_enabled_cloexec=false
   gl_gnulib_enabled_dirfd=false
   gl_gnulib_enabled_euidaccess=false
+  gl_gnulib_enabled_ef07dc4b3077c11ea9cef586db4e5955=false
   gl_gnulib_enabled_getdtablesize=false
   gl_gnulib_enabled_getgroups=false
   gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false
   gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1=false
+  gl_gnulib_enabled_idx=false
   gl_gnulib_enabled_lchmod=false
-  gl_gnulib_enabled_malloca=false
   gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31=false
   gl_gnulib_enabled_open=false
   gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7=false
+  gl_gnulib_enabled_rawmemchr=false
   gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=false
+  gl_gnulib_enabled_scratch_buffer=false
   gl_gnulib_enabled_strtoll=false
   gl_gnulib_enabled_utimens=false
   gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=false
@@ -567,6 +573,18 @@ AC_DEFUN([gl_INIT],
       func_gl_gnulib_m4code_6099e9737f757db36c47fa9d9f02e88c
     fi
   }
+  func_gl_gnulib_m4code_ef07dc4b3077c11ea9cef586db4e5955 ()
+  {
+    if ! $gl_gnulib_enabled_ef07dc4b3077c11ea9cef586db4e5955; then
+      gl_FUNC_FREE
+      if test $REPLACE_FREE = 1; then
+        AC_LIBOBJ([free])
+        gl_PREREQ_FREE
+      fi
+      gl_STDLIB_MODULE_INDICATOR([free-posix])
+      gl_gnulib_enabled_ef07dc4b3077c11ea9cef586db4e5955=true
+    fi
+  }
   func_gl_gnulib_m4code_getdtablesize ()
   {
     if ! $gl_gnulib_enabled_getdtablesize; then
@@ -616,6 +634,12 @@ AC_DEFUN([gl_INIT],
       fi
     fi
   }
+  func_gl_gnulib_m4code_idx ()
+  {
+    if ! $gl_gnulib_enabled_idx; then
+      gl_gnulib_enabled_idx=true
+    fi
+  }
   func_gl_gnulib_m4code_lchmod ()
   {
     if ! $gl_gnulib_enabled_lchmod; then
@@ -628,14 +652,6 @@ AC_DEFUN([gl_INIT],
       gl_gnulib_enabled_lchmod=true
     fi
   }
-  func_gl_gnulib_m4code_malloca ()
-  {
-    if ! $gl_gnulib_enabled_malloca; then
-      gl_MALLOCA
-      gl_gnulib_enabled_malloca=true
-      func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec
-    fi
-  }
   func_gl_gnulib_m4code_5264294aa0a5557541b53c8c741f7f31 ()
   {
     if ! $gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31; then
@@ -668,12 +684,30 @@ AC_DEFUN([gl_INIT],
       gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7=true
     fi
   }
+  func_gl_gnulib_m4code_rawmemchr ()
+  {
+    if ! $gl_gnulib_enabled_rawmemchr; then
+      gl_FUNC_RAWMEMCHR
+      if test $HAVE_RAWMEMCHR = 0; then
+        AC_LIBOBJ([rawmemchr])
+        gl_PREREQ_RAWMEMCHR
+      fi
+      gl_STRING_MODULE_INDICATOR([rawmemchr])
+      gl_gnulib_enabled_rawmemchr=true
+    fi
+  }
   func_gl_gnulib_m4code_6099e9737f757db36c47fa9d9f02e88c ()
   {
     if ! $gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c; then
       gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=true
     fi
   }
+  func_gl_gnulib_m4code_scratch_buffer ()
+  {
+    if ! $gl_gnulib_enabled_scratch_buffer; then
+      gl_gnulib_enabled_scratch_buffer=true
+    fi
+  }
   func_gl_gnulib_m4code_strtoll ()
   {
     if ! $gl_gnulib_enabled_strtoll; then
@@ -700,7 +734,16 @@ AC_DEFUN([gl_INIT],
     fi
   }
   if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test 
$REPLACE_CANONICALIZE_FILE_NAME = 1; then
-    func_gl_gnulib_m4code_malloca
+    func_gl_gnulib_m4code_ef07dc4b3077c11ea9cef586db4e5955
+  fi
+  if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test 
$REPLACE_CANONICALIZE_FILE_NAME = 1; then
+    func_gl_gnulib_m4code_idx
+  fi
+  if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test 
$REPLACE_CANONICALIZE_FILE_NAME = 1; then
+    func_gl_gnulib_m4code_rawmemchr
+  fi
+  if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test 
$REPLACE_CANONICALIZE_FILE_NAME = 1; then
+    func_gl_gnulib_m4code_scratch_buffer
   fi
   if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
     func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b
@@ -747,15 +790,18 @@ AC_DEFUN([gl_INIT],
   if case $host_os in mingw*) false;; *) test $HAVE_GETRANDOM = 0 || test 
$REPLACE_GETRANDOM = 1;; esac; then
     func_gl_gnulib_m4code_open
   fi
-  if test $HAVE_READLINKAT = 0; then
+  if test $HAVE_READLINKAT = 0 || test $REPLACE_READLINKAT = 1; then
     func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b
   fi
-  if test $HAVE_READLINKAT = 0; then
+  if test $HAVE_READLINKAT = 0 || test $REPLACE_READLINKAT = 1; then
     func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7
   fi
   if { test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; } && test 
$ac_cv_type_long_long_int = yes; then
     func_gl_gnulib_m4code_strtoll
   fi
+  if test $HAVE_TIMEZONE_T = 0; then
+    func_gl_gnulib_m4code_idx
+  fi
   if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1; then
     func_gl_gnulib_m4code_5264294aa0a5557541b53c8c741f7f31
   fi
@@ -773,16 +819,19 @@ AC_DEFUN([gl_INIT],
   AM_CONDITIONAL([gl_GNULIB_ENABLED_cloexec], [$gl_gnulib_enabled_cloexec])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_dirfd], [$gl_gnulib_enabled_dirfd])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_euidaccess], 
[$gl_gnulib_enabled_euidaccess])
+  AM_CONDITIONAL([gl_GNULIB_ENABLED_ef07dc4b3077c11ea9cef586db4e5955], 
[$gl_gnulib_enabled_ef07dc4b3077c11ea9cef586db4e5955])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_getdtablesize], 
[$gl_gnulib_enabled_getdtablesize])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_getgroups], [$gl_gnulib_enabled_getgroups])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], 
[$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1], 
[$gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1])
+  AM_CONDITIONAL([gl_GNULIB_ENABLED_idx], [$gl_gnulib_enabled_idx])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_lchmod], [$gl_gnulib_enabled_lchmod])
-  AM_CONDITIONAL([gl_GNULIB_ENABLED_malloca], [$gl_gnulib_enabled_malloca])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31], 
[$gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_open], [$gl_gnulib_enabled_open])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7], 
[$gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7])
+  AM_CONDITIONAL([gl_GNULIB_ENABLED_rawmemchr], [$gl_gnulib_enabled_rawmemchr])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c], 
[$gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c])
+  AM_CONDITIONAL([gl_GNULIB_ENABLED_scratch_buffer], 
[$gl_gnulib_enabled_scratch_buffer])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_utimens], [$gl_gnulib_enabled_utimens])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec], 
[$gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec])
@@ -989,6 +1038,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/flexmember.h
   lib/fpending.c
   lib/fpending.h
+  lib/free.c
   lib/fstatat.c
   lib/fsusage.c
   lib/fsusage.h
@@ -1015,6 +1065,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/gettimeofday.c
   lib/gl_openssl.h
   lib/group-member.c
+  lib/idx.h
   lib/ieee754.in.h
   lib/ignore-value.h
   lib/intprops.h
@@ -1023,8 +1074,10 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/libc-config.h
   lib/limits.in.h
   lib/lstat.c
-  lib/malloca.c
-  lib/malloca.h
+  lib/malloc/scratch_buffer.h
+  lib/malloc/scratch_buffer_grow.c
+  lib/malloc/scratch_buffer_grow_preserve.c
+  lib/malloc/scratch_buffer_set_array_size.c
   lib/md5.c
   lib/md5.h
   lib/memmem.c
@@ -1047,6 +1100,8 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/pselect.c
   lib/pthread_sigmask.c
   lib/qcopy-acl.c
+  lib/rawmemchr.c
+  lib/rawmemchr.valgrind
   lib/readlink.c
   lib/readlinkat.c
   lib/regcomp.c
@@ -1056,6 +1111,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/regex_internal.h
   lib/regexec.c
   lib/root-uid.h
+  lib/scratch_buffer.h
   lib/set-permissions.c
   lib/sha1.c
   lib/sha1.h
@@ -1145,6 +1201,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/flexmember.m4
   m4/fpending.m4
   m4/fpieee.m4
+  m4/free.m4
   m4/fstatat.m4
   m4/fsusage.m4
   m4/fsync.m4
@@ -1168,7 +1225,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/libgmp.m4
   m4/limits-h.m4
   m4/lstat.m4
-  m4/malloca.m4
   m4/manywarnings-c++.m4
   m4/manywarnings.m4
   m4/mbstate_t.m4
@@ -1192,6 +1248,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/pipe2.m4
   m4/pselect.m4
   m4/pthread_sigmask.m4
+  m4/rawmemchr.m4
   m4/readlink.m4
   m4/readlinkat.m4
   m4/regex.m4
@@ -1203,7 +1260,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/signal_h.m4
   m4/socklen.m4
   m4/ssize_t.m4
-  m4/st_dm_mode.m4
   m4/stat-time.m4
   m4/std-gnu11.m4
   m4/stdalign.m4
diff --git a/m4/largefile.m4 b/m4/largefile.m4
index f4c5d3a..c4cc835 100644
--- a/m4/largefile.m4
+++ b/m4/largefile.m4
@@ -25,7 +25,7 @@ AC_DEFUN([gl_SET_LARGEFILE_SOURCE],
 # The following implementation works around a problem in autoconf <= 2.69;
 # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5,
 # or configures them incorrectly in some cases.
-m4_version_prereq([2.70], [] ,[
+m4_version_prereq([2.70], [], [
 
 # _AC_SYS_LARGEFILE_TEST_INCLUDES
 # -------------------------------
diff --git a/m4/mbstate_t.m4 b/m4/mbstate_t.m4
index 057ce12..226f122 100644
--- a/m4/mbstate_t.m4
+++ b/m4/mbstate_t.m4
@@ -1,4 +1,4 @@
-# mbstate_t.m4 serial 13
+# mbstate_t.m4 serial 14
 dnl Copyright (C) 2000-2002, 2008-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -20,14 +20,7 @@ AC_DEFUN([AC_TYPE_MBSTATE_T],
      [AC_COMPILE_IFELSE(
         [AC_LANG_PROGRAM(
            [AC_INCLUDES_DEFAULT[
-/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
-   <wchar.h>.
-   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
-   included before <wchar.h>.  */
-#include <stddef.h>
-#include <stdio.h>
-#include <time.h>
-#include <wchar.h>]],
+             #include <wchar.h>]],
            [[mbstate_t x; return sizeof x;]])],
         [ac_cv_type_mbstate_t=yes],
         [ac_cv_type_mbstate_t=no])])
diff --git a/m4/pid_t.m4 b/m4/pid_t.m4
new file mode 100644
index 0000000..c7abcee
--- /dev/null
+++ b/m4/pid_t.m4
@@ -0,0 +1,38 @@
+# pid_t.m4 serial 4
+dnl Copyright (C) 2020 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# The following implementation works around a problem in autoconf <= 2.69.
+m4_version_prereq([2.70], [], [
+
+dnl Define pid_t if the headers don't define it.
+AC_DEFUN([AC_TYPE_PID_T],
+[
+  AC_CHECK_TYPE([pid_t],
+    [],
+    [dnl On 64-bit native Windows, define it to the equivalent of 'intptr_t'
+     dnl (= 'long long' = '__int64'), because that is the return type
+     dnl of the _spawnv* functions
+     dnl 
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/spawnvp-wspawnvp>
+     dnl and the argument type of the _cwait function
+     dnl 
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/cwait>.
+     dnl Otherwise (on 32-bit Windows and on old Unix platforms), define it
+     dnl to 'int'.
+     AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+          #if defined _WIN64 && !defined __CYGWIN__
+          LLP64
+          #endif
+          ]])
+       ],
+       [gl_pid_type='int'],
+       [gl_pid_type='__int64'])
+     AC_DEFINE_UNQUOTED([pid_t], [$gl_pid_type],
+       [Define as a signed integer type capable of holding a process 
identifier.])
+    ],
+    [AC_INCLUDES_DEFAULT])
+])
+
+])# m4_version_prereq 2.70
diff --git a/m4/rawmemchr.m4 b/m4/rawmemchr.m4
new file mode 100644
index 0000000..c5bf041
--- /dev/null
+++ b/m4/rawmemchr.m4
@@ -0,0 +1,20 @@
+# rawmemchr.m4 serial 2
+dnl Copyright (C) 2003, 2007-2020 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_RAWMEMCHR],
+[
+  dnl Persuade glibc <string.h> to declare rawmemchr().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+  AC_CHECK_FUNCS([rawmemchr])
+  if test $ac_cv_func_rawmemchr = no; then
+    HAVE_RAWMEMCHR=0
+  fi
+])
+
+# Prerequisites of lib/strchrnul.c.
+AC_DEFUN([gl_PREREQ_RAWMEMCHR], [:])
diff --git a/m4/readlink.m4 b/m4/readlink.m4
index 9aa9e46..c7f436a 100644
--- a/m4/readlink.m4
+++ b/m4/readlink.m4
@@ -1,4 +1,4 @@
-# readlink.m4 serial 15
+# readlink.m4 serial 16
 dnl Copyright (C) 2003, 2007, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -23,7 +23,7 @@ AC_DEFUN([gl_FUNC_READLINK],
     dnl Solaris 9 ignores trailing slash.
     dnl FreeBSD 7.2 dereferences only one level of links with trailing slash.
     AC_CACHE_CHECK([whether readlink handles trailing slash correctly],
-      [gl_cv_func_readlink_works],
+      [gl_cv_func_readlink_trailing_slash],
       [# We have readlink, so assume ln -s works.
        ln -s conftest.no-such conftest.link
        ln -s conftest.link conftest.lnk2
@@ -32,18 +32,22 @@ AC_DEFUN([gl_FUNC_READLINK],
            [[#include <unistd.h>
 ]], [[char buf[20];
       return readlink ("conftest.lnk2/", buf, sizeof buf) != -1;]])],
-         [gl_cv_func_readlink_works=yes], [gl_cv_func_readlink_works=no],
+         [gl_cv_func_readlink_trailing_slash=yes],
+         [gl_cv_func_readlink_trailing_slash=no],
          [case "$host_os" in
-                             # Guess yes on Linux systems.
-            linux-* | linux) gl_cv_func_readlink_works="guessing yes" ;;
-                             # Guess yes on glibc systems.
-            *-gnu* | gnu*)   gl_cv_func_readlink_works="guessing yes" ;;
-                             # If we don't know, obey --enable-cross-guesses.
-            *)               
gl_cv_func_readlink_works="$gl_cross_guess_normal" ;;
+            # Guess yes on Linux or glibc systems.
+            linux-* | linux | *-gnu* | gnu*)
+              gl_cv_func_readlink_trailing_slash="guessing yes" ;;
+            # Guess no on AIX or HP-UX.
+            aix* | hpux*)
+              gl_cv_func_readlink_trailing_slash="guessing no" ;;
+            # If we don't know, obey --enable-cross-guesses.
+            *)
+              gl_cv_func_readlink_trailing_slash="$gl_cross_guess_normal" ;;
           esac
          ])
       rm -f conftest.link conftest.lnk2])
-    case "$gl_cv_func_readlink_works" in
+    case "$gl_cv_func_readlink_trailing_slash" in
       *yes)
         if test "$gl_cv_decl_readlink_works" != yes; then
           REPLACE_READLINK=1
@@ -55,6 +59,43 @@ AC_DEFUN([gl_FUNC_READLINK],
         REPLACE_READLINK=1
         ;;
     esac
+
+    AC_CACHE_CHECK([whether readlink truncates results correctly],
+      [gl_cv_func_readlink_truncate],
+      [# We have readlink, so assume ln -s works.
+       ln -s ab conftest.link
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <unistd.h>
+]], [[char c;
+      return readlink ("conftest.link", &c, 1) != 1;]])],
+         [gl_cv_func_readlink_truncate=yes],
+         [gl_cv_func_readlink_truncate=no],
+         [case "$host_os" in
+            # Guess yes on Linux or glibc systems.
+            linux-* | linux | *-gnu* | gnu*)
+              gl_cv_func_readlink_truncate="guessing yes" ;;
+            # Guess no on AIX or HP-UX.
+            aix* | hpux*)
+              gl_cv_func_readlink_truncate="guessing no" ;;
+            # If we don't know, obey --enable-cross-guesses.
+            *)
+              gl_cv_func_readlink_truncate="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      rm -f conftest.link conftest.lnk2])
+    case $gl_cv_func_readlink_truncate in
+      *yes)
+        if test "$gl_cv_decl_readlink_works" != yes; then
+          REPLACE_READLINK=1
+        fi
+        ;;
+      *)
+        AC_DEFINE([READLINK_TRUNCATE_BUG], [1], [Define to 1 if readlink
+          sets errno instead of truncating a too-long link.])
+        REPLACE_READLINK=1
+        ;;
+    esac
   fi
 ])
 
diff --git a/m4/readlinkat.m4 b/m4/readlinkat.m4
index 6ef1f59..73e343f 100644
--- a/m4/readlinkat.m4
+++ b/m4/readlinkat.m4
@@ -1,4 +1,4 @@
-# serial 5
+# serial 6
 # See if we need to provide readlinkat replacement.
 
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
@@ -26,13 +26,10 @@ AC_DEFUN([gl_FUNC_READLINKAT],
              ssize_t readlinkat (int, char const *, char *, size_t);]])],
          [gl_cv_decl_readlinkat_works=yes],
          [gl_cv_decl_readlinkat_works=no])])
-    # Assume readinkat has the same trailing slash bug as readlink,
-    # as is the case on Mac Os X 10.10
-    case "$gl_cv_func_readlink_works" in
-      *yes)
-        if test "$gl_cv_decl_readlinkat_works" != yes; then
-          REPLACE_READLINKAT=1
-        fi
+    # Assume readlinkat has the same bugs as readlink,
+    # as is the case on OS X 10.10 with trailing slashes.
+    case 
$gl_cv_decl_readlinkat_works,$gl_cv_func_readlink_trailing_slash,$gl_cv_func_readlink_truncate
 in
+      *yes,*yes,*yes)
         ;;
       *)
         REPLACE_READLINKAT=1
diff --git a/m4/std-gnu11.m4 b/m4/std-gnu11.m4
index db833d8..b5ab8ab 100644
--- a/m4/std-gnu11.m4
+++ b/m4/std-gnu11.m4
@@ -6,6 +6,8 @@
 # This implementation will be obsolete once we can assume Autoconf 2.70
 # or later is installed everywhere a Gnulib program might be developed.
 
+m4_version_prereq([2.70], [], [
+
 
 # Copyright (C) 2001-2020 Free Software Foundation, Inc.
 
@@ -822,3 +824,6 @@ dnl Tru64   N/A (no support)
 dnl with extended modes being tried first.
 [[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], 
[$1], [$2])[]dnl
 ])# _AC_PROG_CXX_CXX11
+
+
+])# m4_version_prereq
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index d5f5d61..adaea3e 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 56
+# stdint.m4 serial 58
 dnl Copyright (C) 2001-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -34,7 +34,7 @@ AC_DEFUN_ONCE([gl_STDINT_H],
   AC_SUBST([HAVE_WCHAR_H])
 
   dnl Check for <inttypes.h>.
-  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
+  AC_CHECK_HEADERS_ONCE([inttypes.h])
   if test $ac_cv_header_inttypes_h = yes; then
     HAVE_INTTYPES_H=1
   else
@@ -43,7 +43,7 @@ AC_DEFUN_ONCE([gl_STDINT_H],
   AC_SUBST([HAVE_INTTYPES_H])
 
   dnl Check for <sys/types.h>.
-  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
+  AC_CHECK_HEADERS_ONCE([sys/types.h])
   if test $ac_cv_header_sys_types_h = yes; then
     HAVE_SYS_TYPES_H=1
   else
@@ -493,13 +493,9 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
 dnl gl_STDINT_INCLUDES
 AC_DEFUN([gl_STDINT_INCLUDES],
 [[
-  /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
-     included before <wchar.h>.  */
   #include <stddef.h>
   #include <signal.h>
   #if HAVE_WCHAR_H
-  # include <stdio.h>
-  # include <time.h>
   # include <wchar.h>
   #endif
 ]])
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 5f968bc..6003a31 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 50
+# stdio_h.m4 serial 51
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -109,6 +109,11 @@ AC_DEFUN([gl_STDIO_H],
     renameat snprintf tmpfile vdprintf vsnprintf])
 
   AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_CHECK_DECLS_ONCE([fcloseall])
+  if test $ac_cv_have_decl_fcloseall = no; then
+    HAVE_DECL_FCLOSEALL=0
+  fi
 ])
 
 AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
@@ -176,6 +181,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   GNULIB_VSNPRINTF=0;            AC_SUBST([GNULIB_VSNPRINTF])
   GNULIB_VSPRINTF_POSIX=0;       AC_SUBST([GNULIB_VSPRINTF_POSIX])
   dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_DECL_FCLOSEALL=1;         AC_SUBST([HAVE_DECL_FCLOSEALL])
   HAVE_DECL_FPURGE=1;            AC_SUBST([HAVE_DECL_FPURGE])
   HAVE_DECL_FSEEKO=1;            AC_SUBST([HAVE_DECL_FSEEKO])
   HAVE_DECL_FTELLO=1;            AC_SUBST([HAVE_DECL_FTELLO])
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index 743066a..7e03b9a 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 49
+# stdlib_h.m4 serial 54
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,13 +22,28 @@ AC_DEFUN([gl_STDLIB_H],
 #if HAVE_RANDOM_H
 # include <random.h>
 #endif
-    ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
+    ]], [_Exit aligned_alloc atoll canonicalize_file_name free
+    getloadavg getsubopt grantpt
     initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps
-    posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray
-    realpath rpmatch secure_getenv setenv setstate setstate_r srandom
-    srandom_r strtod strtold strtoll strtoull unlockpt unsetenv])
+    posix_memalign posix_openpt ptsname ptsname_r qsort_r
+    random random_r reallocarray realpath rpmatch secure_getenv setenv
+    setstate setstate_r srandom srandom_r
+    strtod strtold strtoll strtoull unlockpt unsetenv])
 
   AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_CHECK_DECLS_ONCE([ecvt])
+  if test $ac_cv_have_decl_ecvt = no; then
+    HAVE_DECL_ECVT=0
+  fi
+  AC_CHECK_DECLS_ONCE([fcvt])
+  if test $ac_cv_have_decl_fcvt = no; then
+    HAVE_DECL_FCVT=0
+  fi
+  AC_CHECK_DECLS_ONCE([gcvt])
+  if test $ac_cv_have_decl_gcvt = no; then
+    HAVE_DECL_GCVT=0
+  fi
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -43,9 +58,11 @@ AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
 AC_DEFUN([gl_STDLIB_H_DEFAULTS],
 [
   GNULIB__EXIT=0;         AC_SUBST([GNULIB__EXIT])
+  GNULIB_ALIGNED_ALLOC=0; AC_SUBST([GNULIB_ALIGNED_ALLOC])
   GNULIB_ATOLL=0;         AC_SUBST([GNULIB_ATOLL])
   GNULIB_CALLOC_POSIX=0;  AC_SUBST([GNULIB_CALLOC_POSIX])
   GNULIB_CANONICALIZE_FILE_NAME=0;  AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME])
+  GNULIB_FREE_POSIX=0;    AC_SUBST([GNULIB_FREE_POSIX])
   GNULIB_GETLOADAVG=0;    AC_SUBST([GNULIB_GETLOADAVG])
   GNULIB_GETSUBOPT=0;     AC_SUBST([GNULIB_GETSUBOPT])
   GNULIB_GRANTPT=0;       AC_SUBST([GNULIB_GRANTPT])
@@ -56,6 +73,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   GNULIB_MKOSTEMPS=0;     AC_SUBST([GNULIB_MKOSTEMPS])
   GNULIB_MKSTEMP=0;       AC_SUBST([GNULIB_MKSTEMP])
   GNULIB_MKSTEMPS=0;      AC_SUBST([GNULIB_MKSTEMPS])
+  GNULIB_POSIX_MEMALIGN=0;AC_SUBST([GNULIB_POSIX_MEMALIGN])
   GNULIB_POSIX_OPENPT=0;  AC_SUBST([GNULIB_POSIX_OPENPT])
   GNULIB_PTSNAME=0;       AC_SUBST([GNULIB_PTSNAME])
   GNULIB_PTSNAME_R=0;     AC_SUBST([GNULIB_PTSNAME_R])
@@ -79,8 +97,12 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   GNULIB_WCTOMB=0;        AC_SUBST([GNULIB_WCTOMB])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE__EXIT=1;              AC_SUBST([HAVE__EXIT])
+  HAVE_ALIGNED_ALLOC=1;      AC_SUBST([HAVE_ALIGNED_ALLOC])
   HAVE_ATOLL=1;              AC_SUBST([HAVE_ATOLL])
   HAVE_CANONICALIZE_FILE_NAME=1;  AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
+  HAVE_DECL_ECVT=1;          AC_SUBST([HAVE_DECL_ECVT])
+  HAVE_DECL_FCVT=1;          AC_SUBST([HAVE_DECL_FCVT])
+  HAVE_DECL_GCVT=1;          AC_SUBST([HAVE_DECL_GCVT])
   HAVE_DECL_GETLOADAVG=1;    AC_SUBST([HAVE_DECL_GETLOADAVG])
   HAVE_GETSUBOPT=1;          AC_SUBST([HAVE_GETSUBOPT])
   HAVE_GRANTPT=1;            AC_SUBST([HAVE_GRANTPT])
@@ -92,6 +114,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_MKOSTEMPS=1;          AC_SUBST([HAVE_MKOSTEMPS])
   HAVE_MKSTEMP=1;            AC_SUBST([HAVE_MKSTEMP])
   HAVE_MKSTEMPS=1;           AC_SUBST([HAVE_MKSTEMPS])
+  HAVE_POSIX_MEMALIGN=1;     AC_SUBST([HAVE_POSIX_MEMALIGN])
   HAVE_POSIX_OPENPT=1;       AC_SUBST([HAVE_POSIX_OPENPT])
   HAVE_PTSNAME=1;            AC_SUBST([HAVE_PTSNAME])
   HAVE_PTSNAME_R=1;          AC_SUBST([HAVE_PTSNAME_R])
@@ -115,12 +138,15 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_SYS_LOADAVG_H=0;      AC_SUBST([HAVE_SYS_LOADAVG_H])
   HAVE_UNLOCKPT=1;           AC_SUBST([HAVE_UNLOCKPT])
   HAVE_DECL_UNSETENV=1;      AC_SUBST([HAVE_DECL_UNSETENV])
+  REPLACE_ALIGNED_ALLOC=0;   AC_SUBST([REPLACE_ALIGNED_ALLOC])
   REPLACE_CALLOC=0;          AC_SUBST([REPLACE_CALLOC])
   REPLACE_CANONICALIZE_FILE_NAME=0;  AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
+  REPLACE_FREE=0;            AC_SUBST([REPLACE_FREE])
   REPLACE_INITSTATE=0;       AC_SUBST([REPLACE_INITSTATE])
   REPLACE_MALLOC=0;          AC_SUBST([REPLACE_MALLOC])
   REPLACE_MBTOWC=0;          AC_SUBST([REPLACE_MBTOWC])
   REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
+  REPLACE_POSIX_MEMALIGN=0;  AC_SUBST([REPLACE_POSIX_MEMALIGN])
   REPLACE_PTSNAME=0;         AC_SUBST([REPLACE_PTSNAME])
   REPLACE_PTSNAME_R=0;       AC_SUBST([REPLACE_PTSNAME_R])
   REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
diff --git a/m4/sys_types_h.m4 b/m4/sys_types_h.m4
index be918dc..c3a691b 100644
--- a/m4/sys_types_h.m4
+++ b/m4/sys_types_h.m4
@@ -1,4 +1,4 @@
-# sys_types_h.m4 serial 9
+# sys_types_h.m4 serial 11
 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -36,25 +36,23 @@ AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS],
 
 # This works around a buggy version in autoconf <= 2.69.
 # See <https://lists.gnu.org/r/autoconf/2016-08/msg00014.html>
+# The 2.70 version isn't quoted properly, so override it too.
 
-m4_version_prereq([2.70], [], [
-
-# This is taken from the following Autoconf patch:
-# 
https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=e17a30e987d7ee695fb4294a82d987ec3dc9b974
+m4_version_prereq([2.70.1], [], [
 
 m4_undefine([AC_HEADER_MAJOR])
 AC_DEFUN([AC_HEADER_MAJOR],
 [AC_CHECK_HEADERS_ONCE([sys/types.h])
 AC_CHECK_HEADER([sys/mkdev.h],
-  [AC_DEFINE([MAJOR_IN_MKDEV], [1],
-    [Define to 1 if `major', `minor', and `makedev' are declared in
-     <mkdev.h>.])])
+                [AC_DEFINE([MAJOR_IN_MKDEV], [1],
+                           [Define to 1 if `major', `minor', and `makedev' are
+                            declared in <mkdev.h>.])])
 if test $ac_cv_header_sys_mkdev_h = no; then
   AC_CHECK_HEADER([sys/sysmacros.h],
-    [AC_DEFINE([MAJOR_IN_SYSMACROS], [1],
-      [Define to 1 if `major', `minor', and `makedev' are declared in
-       <sysmacros.h>.])])
+                  [AC_DEFINE([MAJOR_IN_SYSMACROS], [1],
+                             [Define to 1 if `major', `minor', and `makedev'
+                              are declared in <sysmacros.h>.])])
 fi
-])
+])# AC_HEADER_MAJOR
 
 ])
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index b4734da..b26d2c8 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 81
+# unistd_h.m4 serial 83
 dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -41,7 +41,8 @@ AC_DEFUN([gl_UNISTD_H],
 #  include <io.h>
 # endif
 #endif
-    ]], [access chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir
+    ]], [access chdir chown copy_file_range dup dup2 dup3 environ euidaccess
+    faccessat fchdir
     fchownat fdatasync fsync ftruncate getcwd getdomainname getdtablesize
     getentropy getgroups gethostname getlogin getlogin_r getpagesize getpass
     getusershell setusershell endusershell
@@ -50,6 +51,11 @@ AC_DEFUN([gl_UNISTD_H],
     truncate ttyname_r unlink unlinkat usleep])
 
   AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_CHECK_DECLS_ONCE([execvpe])
+  if test $ac_cv_have_decl_execvpe = no; then
+    HAVE_DECL_EXECVPE=0
+  fi
 ])
 
 AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
@@ -152,6 +158,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_UNLINKAT=1;        AC_SUBST([HAVE_UNLINKAT])
   HAVE_USLEEP=1;          AC_SUBST([HAVE_USLEEP])
   HAVE_DECL_ENVIRON=1;    AC_SUBST([HAVE_DECL_ENVIRON])
+  HAVE_DECL_EXECVPE=1;    AC_SUBST([HAVE_DECL_EXECVPE])
   HAVE_DECL_FCHDIR=1;     AC_SUBST([HAVE_DECL_FCHDIR])
   HAVE_DECL_FDATASYNC=1;  AC_SUBST([HAVE_DECL_FDATASYNC])
   HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME])
diff --git a/m4/vararrays.m4 b/m4/vararrays.m4
index 49ded2e..9524a6d 100644
--- a/m4/vararrays.m4
+++ b/m4/vararrays.m4
@@ -1,6 +1,6 @@
 # Check for variable-length arrays.
 
-# serial 5
+# serial 6
 
 # From Paul Eggert
 
@@ -9,9 +9,11 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# This is a copy of AC_C_VARARRAYS from a recent development version
-# of Autoconf.  It replaces Autoconf's version, or for pre-2.61 autoconf
-# it defines the macro that Autoconf lacks.
+m4_version_prereq([2.70], [], [
+
+# AC_C_VARARRAYS
+# --------------
+# Check whether the C compiler supports variable-length arrays.
 AC_DEFUN([AC_C_VARARRAYS],
 [
   AC_CACHE_CHECK([for variable-length arrays],
@@ -27,7 +29,7 @@ AC_DEFUN([AC_C_VARARRAYS],
              [[/* Test for VLA support.  This test is partly inspired
                   from examples in the C standard.  Use at least two VLA
                   functions to detect the GCC 3.4.3 bug described in:
-                  https://lists.gnu.org/r/bug-gnulib/2014-08/msg00014.html
+                  
https://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00014.html
                   */
                #ifdef __STDC_NO_VLA__
                 syntax error;
@@ -66,3 +68,5 @@ AC_DEFUN([AC_C_VARARRAYS],
        if the compiler does not already define this.])
   fi
 ])
+
+])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]