shishi-commit
[Top][All Lists]
Advanced

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

[SCM] GNU shishi branch, master, updated. shishi-1-0-1-4-g577f769


From: Simon Josefsson
Subject: [SCM] GNU shishi branch, master, updated. shishi-1-0-1-4-g577f769
Date: Mon, 11 Jun 2012 10:41:55 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU shishi".

http://git.savannah.gnu.org/cgit/shishi.git/commit/?id=577f7696bfe86997ad5b4413b5929ff42fd7a2b5

The branch, master has been updated
       via  577f7696bfe86997ad5b4413b5929ff42fd7a2b5 (commit)
       via  135fffcc61fc641269de934a23c6023cb438a7d1 (commit)
       via  bdfd904d372e5101f6525a5a385c126b70f70304 (commit)
       via  5b9179edf243173f76d0b59498d42d1e14a19aa3 (commit)
      from  2e3f3f5db73de731ccff6e680b42124297f17ab4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 577f7696bfe86997ad5b4413b5929ff42fd7a2b5
Author: Simon Josefsson <address@hidden>
Date:   Mon Jun 11 12:41:41 2012 +0200

    Add.

commit 135fffcc61fc641269de934a23c6023cb438a7d1
Author: Simon Josefsson <address@hidden>
Date:   Mon Jun 11 12:38:17 2012 +0200

    Silence compiler warnings.

commit bdfd904d372e5101f6525a5a385c126b70f70304
Author: Simon Josefsson <address@hidden>
Date:   Mon Jun 11 12:32:51 2012 +0200

    Update gnulib files.

commit 5b9179edf243173f76d0b59498d42d1e14a19aa3
Author: Simon Josefsson <address@hidden>
Date:   Mon Jun 11 12:30:41 2012 +0200

    Bump versions.  Libtasn1 2.13.

-----------------------------------------------------------------------

Summary of changes:
 GNUmakefile                   |   14 +--
 NEWS                          |    6 +
 asn1/coding.c                 |    7 +-
 asn1/decoding.c               |  386 ++++++++++++++++++++++++----------------
 asn1/element.c                |    3 +-
 asn1/element.h                |    3 +-
 asn1/errors.c                 |    5 +-
 asn1/gstr.c                   |    5 +-
 asn1/gstr.h                   |    3 +-
 asn1/int.h                    |    7 +-
 asn1/libtasn1.h               |    9 +-
 asn1/parser_aux.c             |    6 +-
 asn1/parser_aux.h             |    3 +-
 asn1/structure.c              |    3 +-
 asn1/structure.h              |    3 +-
 asn1/version.c                |    5 +-
 build-aux/gnupload            |   30 +++-
 build-aux/snippet/_Noreturn.h |    2 +-
 configure.ac                  |    9 +-
 db/gl/m4/gnulib-common.m4     |    3 +-
 db/gl/m4/readlink.m4          |   30 +++-
 gl/Makefile.am                |    5 +-
 gl/alloca.in.h                |    6 +-
 gl/arcfour.c                  |    4 +-
 gl/arcfour.h                  |    4 +-
 gl/arpa_inet.in.h             |    3 +-
 gl/asnprintf.c                |    3 +-
 gl/asprintf.c                 |    3 +-
 gl/base64.c                   |    3 +-
 gl/base64.h                   |    3 +-
 gl/c-ctype.c                  |    3 +-
 gl/c-ctype.h                  |    3 +-
 gl/des.c                      |    4 +-
 gl/des.h                      |    4 +-
 gl/errno.in.h                 |   51 +++++-
 gl/fcntl.in.h                 |    4 +
 gl/float+.h                   |    3 +-
 gl/fseeko.c                   |   11 +-
 gl/fstat.c                    |    4 +
 gl/ftello.c                   |    8 +
 gl/gai_strerror.c             |    3 +-
 gl/gc-gnulib.c                |    4 +-
 gl/gc-libgcrypt.c             |    4 +-
 gl/gc-pbkdf2-sha1.c           |    3 +-
 gl/gc.h                       |    4 +-
 gl/getaddrinfo.c              |    3 +-
 gl/getdelim.c                 |    4 +-
 gl/getline.c                  |    4 +-
 gl/getpass.c                  |    3 +-
 gl/getpass.h                  |    3 +-
 gl/gettext.h                  |    3 +-
 gl/gettimeofday.c             |    3 +-
 gl/hmac-md5.c                 |    3 +-
 gl/hmac-sha1.c                |    3 +-
 gl/hmac.h                     |    3 +-
 gl/inet_ntop.c                |    3 +-
 gl/lseek.c                    |    7 +-
 gl/m4/dup2.m4                 |   23 ++-
 gl/m4/errno_h.m4              |   11 +-
 gl/m4/fseeko.m4               |   14 ++-
 gl/m4/fstat.m4                |   19 ++-
 gl/m4/ftello.m4               |   17 ++-
 gl/m4/gc.m4                   |   14 ++-
 gl/m4/getdelim.m4             |   14 +-
 gl/m4/getline.m4              |   20 ++-
 gl/m4/gettimeofday.m4         |   45 +++--
 gl/m4/gnulib-common.m4        |    3 +-
 gl/m4/gnulib-comp.m4          |    5 +-
 gl/m4/largefile.m4            |   45 +++++
 gl/m4/lseek.m4                |   59 +++++--
 gl/m4/malloc.m4               |   40 ++++-
 gl/m4/manywarnings.m4         |    3 +-
 gl/m4/math_h.m4               |  247 +++++++++++++++++++-------
 gl/m4/mmap-anon.m4            |    8 +-
 gl/m4/off_t.m4                |   18 ++
 gl/m4/realloc.m4              |   40 ++++-
 gl/m4/setenv.m4               |   38 +++-
 gl/m4/stat.m4                 |   15 ++-
 gl/m4/stdio_h.m4              |   10 +-
 gl/m4/strerror.m4             |   48 ++++--
 gl/m4/sys_stat_h.m4           |   15 ++-
 gl/m4/sys_types_h.m4          |    5 +-
 gl/m4/unistd_h.m4             |    6 +-
 gl/m4/warn-on-use.m4          |    6 +-
 gl/m4/warnings.m4             |   58 +++++--
 gl/malloc.c                   |    3 +-
 gl/malloca.c                  |    3 +-
 gl/malloca.h                  |    3 +-
 gl/md4.c                      |    9 +-
 gl/md4.h                      |    3 +-
 gl/md5.c                      |    9 +-
 gl/md5.h                      |    3 +-
 gl/memxor.c                   |    3 +-
 gl/memxor.h                   |    3 +-
 gl/minmax.h                   |    3 +-
 gl/mktime.c                   |  392 +++++++++++++++++++++--------------------
 gl/msvc-inval.c               |    3 +-
 gl/msvc-inval.h               |    3 +-
 gl/msvc-nothrow.c             |    3 +-
 gl/msvc-nothrow.h             |    3 +-
 gl/netdb.in.h                 |    3 +-
 gl/netinet_in.in.h            |    3 +-
 gl/pathmax.h                  |    3 +-
 gl/printf-args.c              |    3 +-
 gl/printf-args.h              |    3 +-
 gl/printf-parse.c             |    3 +-
 gl/printf-parse.h             |    3 +-
 gl/read-file.c                |    3 +-
 gl/read-file.h                |    3 +-
 gl/select.c                   |   64 +++++--
 gl/sha1.c                     |    9 +-
 gl/sha1.h                     |    3 +-
 gl/size_max.h                 |    3 +-
 gl/snprintf.c                 |    3 +-
 gl/stat.c                     |   14 ++
 gl/stdalign.in.h              |    3 +-
 gl/stdarg.in.h                |    3 +-
 gl/stdbool.in.h               |    3 +-
 gl/stddef.in.h                |    3 +-
 gl/stdint.in.h                |   52 ++++--
 gl/stdio.in.h                 |   31 +---
 gl/stdlib.in.h                |   12 ++-
 gl/strcasecmp.c               |    3 +-
 gl/strdup.c                   |    3 +-
 gl/strerror-override.c        |   16 ++-
 gl/strerror-override.h        |    5 +-
 gl/string.in.h                |   26 +++-
 gl/strings.in.h               |    3 +-
 gl/strncasecmp.c              |    3 +-
 gl/strndup.c                  |    3 +-
 gl/strnlen.c                  |    3 +-
 gl/strverscmp.c               |    3 +-
 gl/sys_select.in.h            |    3 +-
 gl/sys_socket.in.h            |    3 +-
 gl/sys_stat.in.h              |   36 ++++-
 gl/sys_time.in.h              |    3 +-
 gl/sys_types.in.h             |   15 ++-
 gl/sys_uio.in.h               |    3 +-
 gl/time.in.h                  |    3 +-
 gl/time_r.c                   |    3 +-
 gl/timegm.c                   |    3 +-
 gl/unistd.in.h                |   21 ++-
 gl/vasnprintf.c               |    3 +-
 gl/vasnprintf.h               |    3 +-
 gl/vasprintf.c                |    3 +-
 gl/wchar.in.h                 |   70 +++++---
 gl/xsize.h                    |    3 +-
 lib/crypto-ctx.c              |    3 +-
 lib/diskio.c                  |    2 -
 lib/shishi.h                  |    2 +-
 maint.mk                      |   83 +++++++---
 src/gl/errno.in.h             |   51 +++++-
 src/gl/gnulib.mk              |    3 +
 src/gl/locale.in.h            |  105 +++++++++++
 src/gl/m4/errno_h.m4          |   11 +-
 src/gl/m4/gnulib-common.m4    |    3 +-
 src/gl/m4/locale_h.m4         |   46 ++++-
 src/gl/m4/strerror.m4         |   48 ++++--
 src/gl/m4/warn-on-use.m4      |    6 +-
 src/gl/msvc-inval.c           |    3 +-
 src/gl/msvc-inval.h           |    3 +-
 src/gl/msvc-nothrow.c         |    3 +-
 src/gl/msvc-nothrow.h         |    3 +-
 src/gl/stddef.in.h            |    3 +-
 src/gl/strerror-override.c    |   16 ++-
 src/gl/strerror-override.h    |    5 +-
 166 files changed, 1909 insertions(+), 986 deletions(-)
 create mode 100644 gl/m4/off_t.m4

diff --git a/GNUmakefile b/GNUmakefile
index d0fd3e8..58f2ead 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -20,20 +20,10 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Systems where /bin/sh is not the default shell need this.  The $(shell)
-# command below won't work with e.g. stock DOS/Windows shells.
-ifeq ($(wildcard /bin/s[h]),/bin/sh)
-SHELL = /bin/sh
-else
-# will be used only with the next shell-test line, then overwritten
-# by a configured-in value
-SHELL = sh
-endif
-
 # If the user runs GNU make but has not yet run ./configure,
 # give them a diagnostic.
-_have-Makefile := $(shell test -f Makefile && echo yes)
-ifeq ($(_have-Makefile),yes)
+_gl-Makefile := $(wildcard [M]akefile)
+ifneq ($(_gl-Makefile),)
 
 # Make tar archive easier to reproduce.
 export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
diff --git a/NEWS b/NEWS
index 67a2779..d87a76c 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,12 @@ Shishi NEWS -- History of user-visible changes.                
 -*- outline -*-
 Copyright (C) 2002-2012 Simon Josefsson
 See the end for copying conditions.
 
+* Version 1.0.2 (unreleased)
+
+** minitasn1: Internal copy upgraded to GNU Libtasn1 v2.13.
+
+** Update gnulib files.
+
 * Version 1.0.1 (released 2012-03-12)
 
 ** Builds with GnuTLS 3.x.
diff --git a/asn1/coding.c b/asn1/coding.c
index af69b14..307dd40 100644
--- a/asn1/coding.c
+++ b/asn1/coding.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2006, 2008, 2009, 2010, 2011 Free Software
- * Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -257,7 +256,7 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, 
int *der_len)
   char *temp, *n_end, *n_start;
   unsigned char bit7;
   unsigned long val, val1 = 0;
-  int str_len = _asn1_strlen(str);
+  int str_len = _asn1_strlen (str);
 
   max_len = *der_len;
 
@@ -267,7 +266,7 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, 
int *der_len)
 
   memcpy (temp, str, str_len);
   temp[str_len] = '.';
-  temp[str_len+1] = 0;
+  temp[str_len + 1] = 0;
 
   counter = 0;
   n_start = temp;
diff --git a/asn1/decoding.c b/asn1/decoding.c
index 3814140..e6cdb98 100644
--- a/asn1/decoding.c
+++ b/asn1/decoding.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2006, 2008, 2009, 2010, 2011 Free Software
- * Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -31,6 +30,7 @@
 #include <gstr.h>
 #include "structure.h"
 #include "element.h"
+#include <limits.h>
 
 static asn1_retCode
 _asn1_get_indefinite_length_string (const unsigned char *der, int *len);
@@ -55,12 +55,13 @@ _asn1_error_description_tag_error (ASN1_TYPE node, char 
*ErrorDescription)
  * Extract a length field from DER data.
  *
  * Returns: Return the decoded length value, or -1 on indefinite
- *   length, or -2 when the value was too big.
+ *   length, or -2 when the value was too big to fit in a int, or -4
+ *   when the decoded length value plus @len would exceed @der_len.
  **/
-signed long
+long
 asn1_get_length_der (const unsigned char *der, int der_len, int *len)
 {
-  unsigned long ans;
+  unsigned int ans, sum, last;
   int k, punt;
 
   *len = 0;
@@ -71,7 +72,7 @@ asn1_get_length_der (const unsigned char *der, int der_len, 
int *len)
     {
       /* short form */
       *len = 1;
-      return der[0];
+      ans = der[0];
     }
   else
     {
@@ -83,9 +84,9 @@ asn1_get_length_der (const unsigned char *der, int der_len, 
int *len)
          ans = 0;
          while (punt <= k && punt < der_len)
            {
-             unsigned long last = ans;
+             last = ans;
 
-             ans = ans * 256 + der[punt++];
+             ans = (ans*256) + der[punt++];
              if (ans < last)
                /* we wrapped around, no bignum support... */
                return -2;
@@ -93,12 +94,24 @@ asn1_get_length_der (const unsigned char *der, int der_len, 
int *len)
        }
       else
        {                       /* indefinite length method */
-         ans = -1;
+         *len = punt;
+         return -1;
        }
 
       *len = punt;
-      return ans;
     }
+
+  sum = ans + *len;
+
+  /* check for overflow as well INT_MAX as a maximum upper
+   * limit for length */
+  if (sum >= INT_MAX || sum < ans)
+    return -2;
+
+  if (((int) sum) > der_len)
+    return -4;
+
+  return ans;
 }
 
 /**
@@ -117,7 +130,9 @@ int
 asn1_get_tag_der (const unsigned char *der, int der_len,
                  unsigned char *cls, int *len, unsigned long *tag)
 {
-  int punt, ris;
+  unsigned int ris;
+  int punt;
+  unsigned int last;
 
   if (der == NULL || der_len < 2 || len == NULL)
     return ASN1_DER_ERROR;
@@ -136,21 +151,23 @@ asn1_get_tag_der (const unsigned char *der, int der_len,
       ris = 0;
       while (punt <= der_len && der[punt] & 128)
        {
-         int last = ris;
-         ris = ris * 128 + (der[punt++] & 0x7F);
+         last = ris;
+
+         ris = (ris * 128) + (der[punt++] & 0x7F);
          if (ris < last)
-           /* wrapper around, and no bignums... */
+           /* wrapped around, and no bignums... */
            return ASN1_DER_ERROR;
        }
+
       if (punt >= der_len)
        return ASN1_DER_ERROR;
-      {
-       int last = ris;
-       ris = ris * 128 + (der[punt++] & 0x7F);
-       if (ris < last)
-         /* wrapper around, and no bignums... */
-         return ASN1_DER_ERROR;
-      }
+
+      last = ris;
+
+      ris = (ris * 128) + (der[punt++] & 0x7F);
+      if (ris < last)
+       return ASN1_DER_ERROR;
+
       *len = punt;
     }
   if (tag)
@@ -173,7 +190,7 @@ asn1_get_tag_der (const unsigned char *der, int der_len,
  *
  * Since: 2.0
  **/
-signed long
+long
 asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len)
 {
   int ret;
@@ -724,8 +741,6 @@ _asn1_get_octet_string (const unsigned char *der, ASN1_TYPE 
node, int *len)
       len2 = asn1_get_length_der (der, *len, &len3);
       if (len2 < 0)
        return ASN1_DER_ERROR;
-      if (len3 + len2 > *len)
-       return ASN1_DER_ERROR;
       if (node)
        _asn1_set_value (node, der, len3 + len2);
       counter = len3 + len2;
@@ -824,8 +839,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
 
   if (node->type & CONST_OPTION)
     {
-      asn1_delete_structure (element);
-      return ASN1_GENERIC_ERROR;
+      result = ASN1_GENERIC_ERROR;
+      goto cleanup;
     }
 
   counter = 0;
@@ -858,8 +873,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                }
              else if (counter > len2)
                {
-                 asn1_delete_structure (element);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
              p2 = p2->down;
              while (p2)
@@ -894,8 +909,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                }
              if (p2 == NULL)
                {
-                 asn1_delete_structure (element);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
            }
 
@@ -942,8 +957,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                    }
                  else if (ris == ASN1_ERROR_TYPE_ANY)
                    {
-                     asn1_delete_structure (element);
-                     return ASN1_ERROR_TYPE_ANY;
+                     result = ASN1_ERROR_TYPE_ANY;
+                     goto cleanup;
                    }
                  else
                    {
@@ -956,8 +971,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                {
                  if (!(p->type & CONST_OPTION))
                    {
-                     asn1_delete_structure (element);
-                     return ASN1_DER_ERROR;
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
                    }
                }
              else
@@ -992,8 +1007,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                  if (errorDescription != NULL)
                    _asn1_error_description_tag_error (p, errorDescription);
 
-                 asn1_delete_structure (element);
-                 return ASN1_TAG_ERROR;
+                 result = ASN1_TAG_ERROR;
+                 goto cleanup;
                }
            }
          else
@@ -1007,8 +1022,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
            case TYPE_NULL:
              if (der[counter])
                {
-                 asn1_delete_structure (element);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
              counter++;
              move = RIGHT;
@@ -1016,8 +1031,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
            case TYPE_BOOLEAN:
              if (der[counter++] != 1)
                {
-                 asn1_delete_structure (element);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
              if (der[counter++] == 0)
                _asn1_set_value (p, "F", 1);
@@ -1030,9 +1045,11 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
              len2 =
                asn1_get_length_der (der + counter, len - counter, &len3);
              if (len2 < 0)
-               return ASN1_DER_ERROR;
-             if (len2 + len3 > len - counter)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+               }
+
              _asn1_set_value (p, der + counter, len3 + len2);
              counter += len3 + len2;
              move = RIGHT;
@@ -1042,10 +1059,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                _asn1_get_objectid_der (der + counter, len - counter, &len2,
                                        temp, sizeof (temp));
              if (result != ASN1_SUCCESS)
-               {
-                 asn1_delete_structure (element);
-                 return result;
-               }
+               goto cleanup;
 
              tlen = strlen (temp);
              if (tlen > 0)
@@ -1058,10 +1072,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                _asn1_get_time_der (der + counter, len - counter, &len2, temp,
                                    sizeof (temp) - 1);
              if (result != ASN1_SUCCESS)
-               {
-                 asn1_delete_structure (element);
-                 return result;
-               }
+               goto cleanup;
+
              tlen = strlen (temp);
              if (tlen > 0)
                _asn1_set_value (p, temp, tlen + 1);
@@ -1070,9 +1082,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
              break;
            case TYPE_OCTET_STRING:
              len3 = len - counter;
-             ris = _asn1_get_octet_string (der + counter, p, &len3);
-             if (ris != ASN1_SUCCESS)
-               return ris;
+             result = _asn1_get_octet_string (der + counter, p, &len3);
+             if (result != ASN1_SUCCESS)
+               goto cleanup;
+
              counter += len3;
              move = RIGHT;
              break;
@@ -1080,9 +1093,11 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
              len2 =
                asn1_get_length_der (der + counter, len - counter, &len3);
              if (len2 < 0)
-               return ASN1_DER_ERROR;
-             if (len3 + len2 > len - counter)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+               }
+
              _asn1_set_value (p, der + counter, len3 + len2);
              counter += len3 + len2;
              move = RIGHT;
@@ -1091,9 +1106,11 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
              len2 =
                asn1_get_length_der (der + counter, len - counter, &len3);
              if (len2 < 0)
-               return ASN1_DER_ERROR;
-             if (len3 + len2 > len - counter)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+               }
+
              _asn1_set_value (p, der + counter, len3 + len2);
              counter += len3 + len2;
              move = RIGHT;
@@ -1110,20 +1127,23 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                        {
                          if ((der[counter]) || der[counter + 1])
                            {
-                             asn1_delete_structure (element);
-                             return ASN1_DER_ERROR;
+                             result = ASN1_DER_ERROR;
+                             goto cleanup;
                            }
                        }
                      else
-                       return ASN1_DER_ERROR;
+                       {
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                       }
                      counter += 2;
                    }
                  else
                    {           /* definite length method */
                      if (len2 != counter)
                        {
-                         asn1_delete_structure (element);
-                         return ASN1_DER_ERROR;
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
                        }
                    }
                  move = RIGHT;
@@ -1133,7 +1153,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                  len3 =
                    asn1_get_length_der (der + counter, len - counter, &len2);
                  if (len3 < -1)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                   }
                  counter += len2;
                  if (len3 > 0)
                    {
@@ -1174,7 +1197,11 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                  if (len2 == -1)
                    {           /* indefinite length method */
                      if ((counter + 2) > len)
-                       return ASN1_DER_ERROR;
+                       {
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                       }
+
                      if ((der[counter]) || der[counter + 1])
                        {
                          _asn1_append_sequence_set (p);
@@ -1201,8 +1228,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                      _asn1_set_value (p, NULL, 0);
                      if (len2 != counter)
                        {
-                         asn1_delete_structure (element);
-                         return ASN1_DER_ERROR;
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
                        }
                    }
                }
@@ -1211,7 +1238,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                  len3 =
                    asn1_get_length_der (der + counter, len - counter, &len2);
                  if (len3 < -1)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                   }
                  counter += len2;
                  if (len3)
                    {
@@ -1242,16 +1272,24 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
              if (asn1_get_tag_der
                  (der + counter, len - counter, &class, &len2,
                   &tag) != ASN1_SUCCESS)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+               }
+
              if (counter + len2 > len)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+               }
              len4 =
                asn1_get_length_der (der + counter + len2,
                                     len - counter - len2, &len3);
              if (len4 < -1)
-               return ASN1_DER_ERROR;
-             if (len4 > len - counter + len2 + len3)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+               }
              if (len4 != -1)
                {
                  len2 += len4;
@@ -1267,13 +1305,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                    indefinite = 0;
 
                  len2 = len - counter;
-                 ris =
+                 result =
                    _asn1_get_indefinite_length_string (der + counter, &len2);
-                 if (ris != ASN1_SUCCESS)
-                   {
-                     asn1_delete_structure (element);
-                     return ris;
-                   }
+                 if (result != ASN1_SUCCESS)
+                   goto cleanup;
 
                  _asn1_set_value_octet (p, der + counter, len2);
                  counter += len2;
@@ -1288,8 +1323,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                        }
                      else
                        {
-                         asn1_delete_structure (element);
-                         return ASN1_DER_ERROR;
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
                        }
                    }
                }
@@ -1326,11 +1361,15 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
 
   if (counter != len)
     {
-      asn1_delete_structure (element);
-      return ASN1_DER_ERROR;
+      result = ASN1_DER_ERROR;
+      goto cleanup;
     }
 
   return ASN1_SUCCESS;
+
+cleanup:
+  asn1_delete_structure (element);
+  return result;
 }
 
 #define FOUND        1
@@ -1379,14 +1418,14 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
 
   if (elementName == NULL)
     {
-      asn1_delete_structure (structure);
-      return ASN1_ELEMENT_NOT_FOUND;
+      result = ASN1_ELEMENT_NOT_FOUND;
+      goto cleanup;
     }
 
   if (node->type & CONST_OPTION)
     {
-      asn1_delete_structure (structure);
-      return ASN1_GENERIC_ERROR;
+      result = ASN1_GENERIC_ERROR;
+      goto cleanup;
     }
 
   if ((*structure)->name)
@@ -1396,8 +1435,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
        strcpy (currentName, (*structure)->name);
       else
        {
-         asn1_delete_structure (structure);
-         return ASN1_MEM_ERROR;
+         result = ASN1_MEM_ERROR;
+         goto cleanup;
        }
       if (!(strcmp (currentName, elementName)))
        {
@@ -1445,8 +1484,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                }
              else if (counter > len2)
                {
-                 asn1_delete_structure (structure);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
              p2 = p2->down;
              while (p2)
@@ -1481,8 +1520,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                }
              if (p2 == NULL)
                {
-                 asn1_delete_structure (structure);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
            }
 
@@ -1529,8 +1568,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    }
                  else if (ris == ASN1_ERROR_TYPE_ANY)
                    {
-                     asn1_delete_structure (structure);
-                     return ASN1_ERROR_TYPE_ANY;
+                     result = ASN1_ERROR_TYPE_ANY;
+                     goto cleanup;
                    }
                  else
                    {
@@ -1543,8 +1582,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                {
                  if (!(p->type & CONST_OPTION))
                    {
-                     asn1_delete_structure (structure);
-                     return ASN1_DER_ERROR;
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
                    }
                }
              else
@@ -1579,8 +1618,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                  if (errorDescription != NULL)
                    _asn1_error_description_tag_error (p, errorDescription);
 
-                 asn1_delete_structure (structure);
-                 return ASN1_TAG_ERROR;
+                 result = ASN1_TAG_ERROR;
+                 goto cleanup;
                }
            }
          else
@@ -1594,8 +1633,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
            case TYPE_NULL:
              if (der[counter])
                {
-                 asn1_delete_structure (structure);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
 
              if (p == nodeFound)
@@ -1607,8 +1646,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
            case TYPE_BOOLEAN:
              if (der[counter++] != 1)
                {
-                 asn1_delete_structure (structure);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
 
              if (state == FOUND)
@@ -1632,11 +1671,18 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
              len2 =
                asn1_get_length_der (der + counter, len - counter, &len3);
              if (len2 < 0)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+               }
+
              if (state == FOUND)
                {
                  if (len3 + len2 > len - counter)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                   }
                  _asn1_set_value (p, der + counter, len3 + len2);
 
                  if (p == nodeFound)
@@ -1652,9 +1698,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    _asn1_get_objectid_der (der + counter, len - counter,
                                            &len2, temp, sizeof (temp));
                  if (result != ASN1_SUCCESS)
-                   {
-                     return result;
-                   }
+                   goto cleanup;
 
                  tlen = strlen (temp);
 
@@ -1669,7 +1713,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                  len2 =
                    asn1_get_length_der (der + counter, len - counter, &len3);
                  if (len2 < 0)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                   }
                  len2 += len3;
                }
 
@@ -1683,10 +1730,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    _asn1_get_time_der (der + counter, len - counter, &len2,
                                        temp, sizeof (temp) - 1);
                  if (result != ASN1_SUCCESS)
-                   {
-                     asn1_delete_structure (structure);
-                     return result;
-                   }
+                   goto cleanup;
 
                  tlen = strlen (temp);
                  if (tlen > 0)
@@ -1700,7 +1744,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                  len2 =
                    asn1_get_length_der (der + counter, len - counter, &len3);
                  if (len2 < 0)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                   }
                  len2 += len3;
                }
 
@@ -1711,15 +1758,16 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
              len3 = len - counter;
              if (state == FOUND)
                {
-                 ris = _asn1_get_octet_string (der + counter, p, &len3);
+                 result = _asn1_get_octet_string (der + counter, p, &len3);
                  if (p == nodeFound)
                    state = EXIT;
                }
              else
-               ris = _asn1_get_octet_string (der + counter, NULL, &len3);
+               result = _asn1_get_octet_string (der + counter, NULL, &len3);
+
+             if (result != ASN1_SUCCESS)
+               goto cleanup;
 
-             if (ris != ASN1_SUCCESS)
-               return ris;
              counter += len3;
              move = RIGHT;
              break;
@@ -1727,11 +1775,18 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
              len2 =
                asn1_get_length_der (der + counter, len - counter, &len3);
              if (len2 < 0)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+               }
+
              if (state == FOUND)
                {
                  if (len3 + len2 > len - counter)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                   }
                  _asn1_set_value (p, der + counter, len3 + len2);
 
                  if (p == nodeFound)
@@ -1744,11 +1799,17 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
              len2 =
                asn1_get_length_der (der + counter, len - counter, &len3);
              if (len2 < 0)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+               }
              if (state == FOUND)
                {
                  if (len3 + len2 > len - counter)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                   }
                  _asn1_set_value (p, der + counter, len3 + len2);
 
                  if (p == nodeFound)
@@ -1767,8 +1828,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    {           /* indefinite length method */
                      if ((der[counter]) || der[counter + 1])
                        {
-                         asn1_delete_structure (structure);
-                         return ASN1_DER_ERROR;
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
                        }
                      counter += 2;
                    }
@@ -1776,8 +1837,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    {           /* definite length method */
                      if (len2 != counter)
                        {
-                         asn1_delete_structure (structure);
-                         return ASN1_DER_ERROR;
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
                        }
                    }
                  if (p == nodeFound)
@@ -1792,7 +1853,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                        asn1_get_length_der (der + counter, len - counter,
                                             &len2);
                      if (len3 < 0)
-                       return ASN1_DER_ERROR;
+                       {
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                       }
                      counter += len2 + len3;
                      move = RIGHT;
                    }
@@ -1802,7 +1866,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                        asn1_get_length_der (der + counter, len - counter,
                                             &len2);
                      if (len3 < 0)
-                       return ASN1_DER_ERROR;
+                       {
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                       }
                      counter += len2;
                      if (len3 > 0)
                        {
@@ -1854,8 +1921,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                  _asn1_set_value (p, NULL, 0);
                  if (len2 != counter)
                    {
-                     asn1_delete_structure (structure);
-                     return ASN1_DER_ERROR;
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
                    }
 
                  if (p == nodeFound)
@@ -1869,7 +1936,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                        asn1_get_length_der (der + counter, len - counter,
                                             &len2);
                      if (len3 < 0)
-                       return ASN1_DER_ERROR;
+                       {
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                       }
                      counter += len2 + len3;
                      move = RIGHT;
                    }
@@ -1879,7 +1949,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                        asn1_get_length_der (der + counter, len - counter,
                                             &len2);
                      if (len3 < 0)
-                       return ASN1_DER_ERROR;
+                       {
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                       }
                      counter += len2;
                      if (len3)
                        {
@@ -1905,15 +1978,25 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
              if (asn1_get_tag_der
                  (der + counter, len - counter, &class, &len2,
                   &tag) != ASN1_SUCCESS)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+               }
+
              if (counter + len2 > len)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+               }
 
              len4 =
                asn1_get_length_der (der + counter + len2,
                                     len - counter - len2, &len3);
              if (len4 < -1)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+               }
 
              if (len4 != -1)
                {
@@ -1936,13 +2019,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    indefinite = 0;
 
                  len2 = len - counter;
-                 ris =
+                 result =
                    _asn1_get_indefinite_length_string (der + counter, &len2);
-                 if (ris != ASN1_SUCCESS)
-                   {
-                     asn1_delete_structure (structure);
-                     return ris;
-                   }
+                 if (result != ASN1_SUCCESS)
+                   goto cleanup;
 
                  if (state == FOUND)
                    {
@@ -1964,8 +2044,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                        }
                      else
                        {
-                         asn1_delete_structure (structure);
-                         return ASN1_DER_ERROR;
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
                        }
                    }
                }
@@ -1998,8 +2078,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    }
                  else
                    {
-                     asn1_delete_structure (structure);
-                     return ASN1_MEM_ERROR;
+                     result = ASN1_MEM_ERROR;
+                     goto cleanup;
                    }
                  if (!(strcmp (currentName, elementName)))
                    {
@@ -2041,8 +2121,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    strcat (currentName, p->name);
                  else
                    {
-                     asn1_delete_structure (structure);
-                     return ASN1_MEM_ERROR;
+                     result = ASN1_MEM_ERROR;
+                     goto cleanup;
                    }
 
                  if (!(strcmp (currentName, elementName)))
@@ -2096,11 +2176,15 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
 
   if (counter > len)
     {
-      asn1_delete_structure (structure);
-      return ASN1_DER_ERROR;
+      result = ASN1_DER_ERROR;
+      goto cleanup;
     }
 
   return ASN1_SUCCESS;
+
+cleanup:
+  asn1_delete_structure (structure);
+  return result;
 }
 
 /**
diff --git a/asn1/element.c b/asn1/element.c
index 92a350d..ead899c 100644
--- a/asn1/element.c
+++ b/asn1/element.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2008, 2009, 2010,
- * 2011 Free Software Foundation, Inc.
+ * Copyright (C) 2000-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
diff --git a/asn1/element.h b/asn1/element.h
index 3bb3451..9cad46e 100644
--- a/asn1/element.h
+++ b/asn1/element.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2008, 2009, 2010,
- * 2011 Free Software Foundation, Inc.
+ * Copyright (C) 2000-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
diff --git a/asn1/errors.c b/asn1/errors.c
index c5508da..76611d8 100644
--- a/asn1/errors.c
+++ b/asn1/errors.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2011 Free Software
- * Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -22,7 +21,7 @@
 
 #include <int.h>
 #ifdef STDC_HEADERS
-# include <stdarg.h>
+#include <stdarg.h>
 #endif
 
 #define LIBTASN1_ERROR_ENTRY(name) { #name, name }
diff --git a/asn1/gstr.c b/asn1/gstr.c
index 32ab904..4785073 100644
--- a/asn1/gstr.c
+++ b/asn1/gstr.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
- * Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -62,7 +61,7 @@ _asn1_str_cpy (char *dest, size_t dest_tot_size, const char 
*src)
     {
       if (dest_tot_size > 0)
        {
-         strncpy (dest, src, (dest_tot_size) - 1);
+         memcpy (dest, src, dest_tot_size - 1);
          dest[dest_tot_size - 1] = 0;
        }
     }
diff --git a/asn1/gstr.h b/asn1/gstr.h
index 33bdec9..baaa6a0 100644
--- a/asn1/gstr.h
+++ b/asn1/gstr.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
- * Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
diff --git a/asn1/int.h b/asn1/int.h
index f1f2b0e..82de579 100644
--- a/asn1/int.h
+++ b/asn1/int.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -24,7 +23,7 @@
 #define INT_H
 
 #ifdef HAVE_CONFIG_H
-# include <config.h>
+#include <config.h>
 #endif
 
 #include <string.h>
@@ -34,7 +33,7 @@
 #include <stdint.h>
 
 #ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
+#include <sys/types.h>
 #endif
 
 #include <libtasn1.h>
diff --git a/asn1/libtasn1.h b/asn1/libtasn1.h
index 5367713..063b1d6 100644
--- a/asn1/libtasn1.h
+++ b/asn1/libtasn1.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -45,7 +44,7 @@ extern "C"
 {
 #endif
 
-#define ASN1_VERSION "2.11"
+#define ASN1_VERSION "2.13"
 
   typedef int asn1_retCode;    /* type returned by libtasn1 functions */
 
@@ -262,10 +261,10 @@ extern "C"
                      int *ret_len, unsigned char *str,
                      int str_size, int *bit_len);
 
-  extern ASN1_API signed long
+  extern ASN1_API long
     asn1_get_length_der (const unsigned char *der, int der_len, int *len);
 
-  extern ASN1_API signed long
+  extern ASN1_API long
     asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len);
 
   extern ASN1_API void
diff --git a/asn1/parser_aux.c b/asn1/parser_aux.c
index 5b549d7..2e1f7ee 100644
--- a/asn1/parser_aux.c
+++ b/asn1/parser_aux.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2000-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -719,7 +718,8 @@ _asn1_expand_object_id (ASN1_TYPE node)
                    {
                      _asn1_str_cpy (name2, sizeof (name2), name_root);
                      _asn1_str_cat (name2, sizeof (name2), ".");
-                     _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
+                     _asn1_str_cat (name2, sizeof (name2),
+                                    (char *) p2->value);
                      p3 = asn1_find_node (node, name2);
                      if (!p3 || (type_field (p3->type) != TYPE_OBJECT_ID) ||
                          !(p3->type & CONST_ASSIGN))
diff --git a/asn1/parser_aux.h b/asn1/parser_aux.h
index ca9e66c..374f599 100644
--- a/asn1/parser_aux.h
+++ b/asn1/parser_aux.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2000-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
diff --git a/asn1/structure.c b/asn1/structure.c
index 25e960f..41cebe4 100644
--- a/asn1/structure.c
+++ b/asn1/structure.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Free
- * Software Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
diff --git a/asn1/structure.h b/asn1/structure.h
index 98d32ab..0a84e26 100644
--- a/asn1/structure.h
+++ b/asn1/structure.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Free
- * Software Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
diff --git a/asn1/version.c b/asn1/version.c
index c0cf1f2..83d70c9 100644
--- a/asn1/version.c
+++ b/asn1/version.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2000-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -21,7 +20,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-# include <config.h>
+#include <config.h>
 #endif
 
 #include <string.h>            /* for strverscmp */
diff --git a/build-aux/gnupload b/build-aux/gnupload
index eb450a0..a0e5c7b 100755
--- a/build-aux/gnupload
+++ b/build-aux/gnupload
@@ -1,9 +1,9 @@
 #!/bin/sh
 # Sign files and upload them.
 
-scriptversion=2012-01-15.15; # UTC
+scriptversion=2012-06-11.00; # UTC
 
-# Copyright (C) 2004-2010, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2004-2012 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
@@ -28,6 +28,7 @@ GPG='gpg --batch --no-tty'
 conffile=.gnuploadrc
 to=
 dry_run=false
+replace=
 symlink_files=
 delete_files=
 delete_symlinks=
@@ -53,8 +54,10 @@ Options:
   --to DEST                specify one destination for FILES
                            (multiple --to options are allowed)
   --user NAME              sign with key NAME
+  --replace                allow replacements of existing files
   --symlink-regex[=EXPR]   use sed script EXPR to compute symbolic link names
   --dry-run                do nothing, show what would have been done
+                           (including the constructed directive file)
   --version                output version information and exit
 
 If --symlink-regex is given without EXPR, then the link target name
@@ -146,6 +149,9 @@ while test -n "$1"; do
     --delete)
       collect_var=delete_files
       ;;
+    --replace)
+      replace="replace: true"
+      ;;
     --rmsymlink)
       collect_var=delete_symlinks
       ;;
@@ -243,11 +249,13 @@ unset passphrase
 # listings with their arguments...).
 # Remember this script runs with 'set -e', so if echo is not built-in
 # it will exit now.
-PATH=/empty echo -n "Enter GPG passphrase: "
-stty -echo
-read -r passphrase
-stty echo
-echo
+if $dry_run; then :; else
+  PATH=/empty echo -n "Enter GPG passphrase: "
+  stty -echo
+  read -r passphrase
+  stty echo
+  echo
+fi
 
 if test $# -ne 0; then
   for file
@@ -270,7 +278,7 @@ filename: $3$stmt"
   fi
 
   cat >${2}.directive<<EOF
-version: 1.1
+version: 1.2
 directory: $1
 comment: gnupload v. $scriptversion$stmt
 EOF
@@ -393,6 +401,12 @@ do
   do
     echo "Uploading $file to $dest ..."
     stmt=
+    #
+    # allowing file replacement is all or nothing.
+    if test -n "$replace"; then stmt="$stmt
+$replace"
+    fi
+    #
     files="$file $file.sig"
     destdir=`echo $dest | sed 's/[^:]*://'`
     if test -n "$symlink_expr"; then
diff --git a/build-aux/snippet/_Noreturn.h b/build-aux/snippet/_Noreturn.h
index 1a7b4da..c44ad89 100644
--- a/build-aux/snippet/_Noreturn.h
+++ b/build-aux/snippet/_Noreturn.h
@@ -1,4 +1,4 @@
-#ifndef _Noreturn
+#if !defined _Noreturn && __STDC_VERSION__ < 201112
 # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
diff --git a/configure.ac b/configure.ac
index 72b580f..06b70d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,8 +19,8 @@
 # Floor, Boston, MA 02110-1301, USA.
 
 AC_PREREQ(2.61)
-AC_INIT([GNU Shishi], [1.0.1], address@hidden)
-AC_COPYRIGHT([Copyright (c) 2002-2011 Simon Josefsson <address@hidden>.])
+AC_INIT([GNU Shishi], [1.0.2], address@hidden)
+AC_COPYRIGHT([Copyright (c) 2002-2012 Simon Josefsson <address@hidden>.])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS(config.h)
@@ -32,7 +32,7 @@ AM_SILENT_RULES([yes])
 # Interfaces added:                             AGE++
 # Interfaces removed:                           AGE=0
 AC_SUBST(LT_CURRENT, 1)
-AC_SUBST(LT_REVISION, 1)
+AC_SUBST(LT_REVISION, 2)
 AC_SUBST(LT_AGE, 1)
 
 # Checks for header files.
@@ -340,6 +340,8 @@ if test "$gl_gcc_warnings" = yes; then
   nw="$nw -Wundef"                     # Problems in gnulib files
   nw="$nw -Wstrict-overflow"           # Don't know how to avoid
   nw="$nw -Waggregate-return"          # For src/resume.c:resume_db_fetch...
+  nw="$nw -Wsuggest-attribute=pure" # Is it worth using attributes?
+  nw="$nw -Wsuggest-attribute=const" # Is it worth using attributes?
 
   gl_MANYWARN_ALL_GCC([ws])
   gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
@@ -350,6 +352,7 @@ if test "$gl_gcc_warnings" = yes; then
   gl_WARN_ADD([-Wno-format])           # Too many warnings for now
   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
   gl_WARN_ADD([-Wno-stack-protector])  # Some functions cannot be protected
+  gl_WARN_ADD([-Wno-unused-result])
   gl_WARN_ADD([-fdiagnostics-show-option])
 fi
 
diff --git a/db/gl/m4/gnulib-common.m4 b/db/gl/m4/gnulib-common.m4
index ae4d254..d62b767 100644
--- a/db/gl/m4/gnulib-common.m4
+++ b/db/gl/m4/gnulib-common.m4
@@ -14,7 +14,8 @@ AC_DEFUN([gl_COMMON], [
 AC_DEFUN([gl_COMMON_BODY], [
   AH_VERBATIM([_Noreturn],
 [/* The _Noreturn keyword of C11.  */
-#ifndef _Noreturn
+#if ! (defined _Noreturn \
+       || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
 # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
diff --git a/db/gl/m4/readlink.m4 b/db/gl/m4/readlink.m4
index 107083f..ccf5141 100644
--- a/db/gl/m4/readlink.m4
+++ b/db/gl/m4/readlink.m4
@@ -1,4 +1,4 @@
-# readlink.m4 serial 11
+# readlink.m4 serial 12
 dnl Copyright (C) 2003, 2007, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN([gl_FUNC_READLINK],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CHECK_FUNCS_ONCE([readlink])
   if test $ac_cv_func_readlink = no; then
     HAVE_READLINK=0
@@ -32,15 +33,26 @@ AC_DEFUN([gl_FUNC_READLINK],
 ]], [[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_works="guessing no"])
+         [case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_readlink_works="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_readlink_works="guessing no" ;;
+          esac
+         ])
       rm -f conftest.link conftest.lnk2])
-    if test "$gl_cv_func_readlink_works" != yes; then
-      AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink
-        fails to recognize a trailing slash.])
-      REPLACE_READLINK=1
-    elif test "$gl_cv_decl_readlink_works" != yes; then
-      REPLACE_READLINK=1
-    fi
+    case "$gl_cv_func_readlink_works" in
+      *yes)
+        if test "$gl_cv_decl_readlink_works" != yes; then
+          REPLACE_READLINK=1
+        fi
+        ;;
+      *)
+        AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink
+          fails to recognize a trailing slash.])
+        REPLACE_READLINK=1
+        ;;
+    esac
   fi
 ])
 
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 2101b60..0969758 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -1204,7 +1204,6 @@ stdio.h: stdio.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H)
              -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \
              -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \
              -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \
-             -e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \
              -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
              -e 
's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
              -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \
@@ -1707,6 +1706,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNU
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
+             -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \
              -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
              -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
              -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
@@ -1802,6 +1802,7 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
+             -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
              < $(srcdir)/sys_types.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -1919,6 +1920,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
+             -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
              -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \
              -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
              -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
@@ -2017,6 +2019,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
              -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
              -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
+             -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
              -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
              -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
diff --git a/gl/alloca.in.h b/gl/alloca.in.h
index ca9e7fe..e94eb68 100644
--- a/gl/alloca.in.h
+++ b/gl/alloca.in.h
@@ -14,9 +14,9 @@
    General Public License for more details.
 
    You should have received a copy of the GNU General Public
-   License along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-   USA.  */
+   License along with this program; if not, see
+   <http://www.gnu.org/licenses/>.
+  */
 
 /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
    means there is a real alloca function.  */
diff --git a/gl/arcfour.c b/gl/arcfour.c
index d4f1b11..1c18783 100644
--- a/gl/arcfour.c
+++ b/gl/arcfour.c
@@ -12,9 +12,7 @@
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this file; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
+ * along with this file; if not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/gl/arcfour.h b/gl/arcfour.h
index 3735b11..89cd1eb 100644
--- a/gl/arcfour.h
+++ b/gl/arcfour.h
@@ -12,9 +12,7 @@
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this file; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
+ * along with this file; if not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h
index 91b1008..0b8f1f1 100644
--- a/gl/arpa_inet.in.h
+++ b/gl/arpa_inet.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef address@hidden@_ARPA_INET_H
 
diff --git a/gl/asnprintf.c b/gl/asnprintf.c
index 416a586..f6f70c9 100644
--- a/gl/asnprintf.c
+++ b/gl/asnprintf.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/asprintf.c b/gl/asprintf.c
index b8b405f..1722436 100644
--- a/gl/asprintf.c
+++ b/gl/asprintf.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/base64.c b/gl/base64.c
index acf49c8..351c5fd 100644
--- a/gl/base64.c
+++ b/gl/base64.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Simon Josefsson.  Partially adapted from GNU MailUtils
  * (mailbox/filter_trans.c, as of 2004-11-28).  Improved by review
diff --git a/gl/base64.h b/gl/base64.h
index 537a3b8..dc6f2a4 100644
--- a/gl/base64.h
+++ b/gl/base64.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef BASE64_H
 # define BASE64_H
diff --git a/gl/c-ctype.c b/gl/c-ctype.c
index 6ca7992..952d7a8 100644
--- a/gl/c-ctype.c
+++ b/gl/c-ctype.c
@@ -13,8 +13,7 @@ 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, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/c-ctype.h b/gl/c-ctype.h
index a857748..0b31309 100644
--- a/gl/c-ctype.h
+++ b/gl/c-ctype.h
@@ -18,8 +18,7 @@ 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, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef C_CTYPE_H
 #define C_CTYPE_H
diff --git a/gl/des.c b/gl/des.c
index bc36577..8c96fef 100644
--- a/gl/des.c
+++ b/gl/des.c
@@ -12,9 +12,7 @@
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this file; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
+ * along with this file; if not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/gl/des.h b/gl/des.h
index e995a7a..bf09ad8 100644
--- a/gl/des.h
+++ b/gl/des.h
@@ -12,9 +12,7 @@
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this file; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
+ * along with this file; if not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/gl/errno.in.h b/gl/errno.in.h
index 5271bcd..5e5af92 100644
--- a/gl/errno.in.h
+++ b/gl/errno.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef address@hidden@_ERRNO_H
 
@@ -85,6 +84,16 @@
 #   define GNULIB_defined_ECANCELED 1
 #  endif
 
+#  ifndef EOWNERDEAD
+#   define EOWNERDEAD 133
+#   define GNULIB_defined_EOWNERDEAD 1
+#  endif
+
+#  ifndef ENOTRECOVERABLE
+#   define ENOTRECOVERABLE 127
+#   define GNULIB_defined_ENOTRECOVERABLE 1
+#  endif
+
 #  ifndef EINPROGRESS
 #   define EINPROGRESS     112
 #   define EALREADY        103
@@ -109,15 +118,17 @@
 #   define ELOOP           114
 #   define EHOSTUNREACH    110
 #   define EWOULDBLOCK     140
+#   define GNULIB_defined_ESOCK 1
+#  endif
+
+#  ifndef ETXTBSY
 #   define ETXTBSY         139
 #   define ENODATA         120  /* not required by POSIX */
 #   define ENOSR           124  /* not required by POSIX */
 #   define ENOSTR          125  /* not required by POSIX */
-#   define ENOTRECOVERABLE 127  /* not required by POSIX */
-#   define EOWNERDEAD      133  /* not required by POSIX */
 #   define ETIME           137  /* not required by POSIX */
 #   define EOTHER          131  /* not required by POSIX */
-#   define GNULIB_defined_ESOCK 1
+#   define GNULIB_defined_ESTREAMS 1
 #  endif
 
 /* These are intentionally the same values as the WSA* error numbers, defined
@@ -228,6 +239,36 @@
 #  define GNULIB_defined_ECANCELED 1
 # endif
 
+/* On many platforms, the macros EOWNERDEAD and ENOTRECOVERABLE are not
+   defined.  */
+
+# ifndef EOWNERDEAD
+#  if defined __sun
+    /* Use the same values as defined for Solaris >= 8, for
+       interoperability.  */
+#   define EOWNERDEAD      58
+#   define ENOTRECOVERABLE 59
+#  elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+    /* We have a conflict here: pthreads-win32 defines these values
+       differently than MSVC 10.  It's hairy to decide which one to use.  */
+#   if defined __MINGW32__ && !defined USE_WINDOWS_THREADS
+     /* Use the same values as defined by pthreads-win32, for
+        interoperability.  */
+#    define EOWNERDEAD      43
+#    define ENOTRECOVERABLE 44
+#   else
+     /* Use the same values as defined by MSVC 10, for
+        interoperability.  */
+#    define EOWNERDEAD      133
+#    define ENOTRECOVERABLE 127
+#   endif
+#  else
+#   define EOWNERDEAD      2013
+#   define ENOTRECOVERABLE 2014
+#  endif
+#  define GNULIB_defined_EOWNERDEAD 1
+#  define GNULIB_defined_ENOTRECOVERABLE 1
+# endif
 
 #endif /* address@hidden@_ERRNO_H */
 #endif /* address@hidden@_ERRNO_H */
diff --git a/gl/fcntl.in.h b/gl/fcntl.in.h
index 344bbe4..76e12f7 100644
--- a/gl/fcntl.in.h
+++ b/gl/fcntl.in.h
@@ -25,6 +25,8 @@
 #if defined __need_system_fcntl_h
 /* Special invocation convention.  */
 
+/* Needed before <sys/stat.h>.
+   May also define off_t to a 64-bit type on native Windows.  */
 #include <sys/types.h>
 /* On some systems other than glibc, <sys/stat.h> is a prerequisite of
    <fcntl.h>.  On glibc systems, we would like to avoid namespace pollution.
@@ -42,6 +44,8 @@
 
 #ifndef address@hidden@_FCNTL_H
 
+/* Needed before <sys/stat.h>.
+   May also define off_t to a 64-bit type on native Windows.  */
 #include <sys/types.h>
 /* On some systems other than glibc, <sys/stat.h> is a prerequisite of
    <fcntl.h>.  On glibc systems, we would like to avoid namespace pollution.
diff --git a/gl/float+.h b/gl/float+.h
index c294350..75e56a1 100644
--- a/gl/float+.h
+++ b/gl/float+.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _FLOATPLUS_H
 #define _FLOATPLUS_H
diff --git a/gl/fseeko.c b/gl/fseeko.c
index 08e1f71..c372a5c 100644
--- a/gl/fseeko.c
+++ b/gl/fseeko.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
@@ -32,6 +31,14 @@ fseeko (FILE *fp, off_t offset, int whence)
 # undef fseek
 # define fseeko fseek
 #endif
+#if _GL_WINDOWS_64_BIT_OFF_T
+# undef fseeko
+# if HAVE__FSEEKI64 /* msvc, mingw64 */
+#  define fseeko _fseeki64
+# else /* mingw */
+#  define fseeko fseeko64
+# endif
+#endif
 {
 #if LSEEK_PIPE_BROKEN
   /* mingw gives bogus answers rather than failure on non-seekable files.  */
diff --git a/gl/fstat.c b/gl/fstat.c
index 4918495..ac2b1ef 100644
--- a/gl/fstat.c
+++ b/gl/fstat.c
@@ -23,6 +23,10 @@
 /* Get the original definition of fstat.  It might be defined as a macro.  */
 #include <sys/types.h>
 #include <sys/stat.h>
+#if _GL_WINDOWS_64_BIT_ST_SIZE
+# define stat _stati64
+# define fstat _fstati64
+#endif
 #undef __need_system_sys_stat_h
 
 static inline int
diff --git a/gl/ftello.c b/gl/ftello.c
index 1beb202..1f581c5 100644
--- a/gl/ftello.c
+++ b/gl/ftello.c
@@ -31,6 +31,14 @@ ftello (FILE *fp)
 # undef ftell
 # define ftello ftell
 #endif
+#if _GL_WINDOWS_64_BIT_OFF_T
+# undef ftello
+# if HAVE__FTELLI64 /* msvc, mingw64 */
+#  define ftello _ftelli64
+# else /* mingw */
+#  define ftello ftello64
+# endif
+#endif
 {
 #if LSEEK_PIPE_BROKEN
   /* mingw gives bogus answers rather than failure on non-seekable files.  */
diff --git a/gl/gai_strerror.c b/gl/gai_strerror.c
index b846e48..5bb1c04 100644
--- a/gl/gai_strerror.c
+++ b/gl/gai_strerror.c
@@ -14,8 +14,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _LIBC
 # include <config.h>
diff --git a/gl/gc-gnulib.c b/gl/gc-gnulib.c
index 2ae4bf8..71b7e2b 100644
--- a/gl/gc-gnulib.c
+++ b/gl/gc-gnulib.c
@@ -12,9 +12,7 @@
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this file; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
+ * along with this file; if not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/gl/gc-libgcrypt.c b/gl/gc-libgcrypt.c
index fa7ca65..4abf0c1 100644
--- a/gl/gc-libgcrypt.c
+++ b/gl/gc-libgcrypt.c
@@ -12,9 +12,7 @@
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this file; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
+ * along with this file; if not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/gl/gc-pbkdf2-sha1.c b/gl/gc-pbkdf2-sha1.c
index 1f47631..7e32fd9 100644
--- a/gl/gc-pbkdf2-sha1.c
+++ b/gl/gc-pbkdf2-sha1.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Simon Josefsson. */
 
diff --git a/gl/gc.h b/gl/gc.h
index 40d51fa..130cd1c 100644
--- a/gl/gc.h
+++ b/gl/gc.h
@@ -12,9 +12,7 @@
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this file; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
+ * along with this file; if not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c
index c538967..069f2a9 100644
--- a/gl/getaddrinfo.c
+++ b/gl/getaddrinfo.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/getdelim.c b/gl/getdelim.c
index d80c583..b7af0a2 100644
--- a/gl/getdelim.c
+++ b/gl/getdelim.c
@@ -13,9 +13,7 @@
    General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Ported from glibc by Simon Josefsson. */
 
diff --git a/gl/getline.c b/gl/getline.c
index ab64d80..f422747 100644
--- a/gl/getline.c
+++ b/gl/getline.c
@@ -12,9 +12,7 @@
    General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Simon Josefsson. */
 
diff --git a/gl/getpass.c b/gl/getpass.c
index 25f1e18..41f3669 100644
--- a/gl/getpass.c
+++ b/gl/getpass.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _LIBC
 # include <config.h>
diff --git a/gl/getpass.h b/gl/getpass.h
index 0d923c6..4eabf9d 100644
--- a/gl/getpass.h
+++ b/gl/getpass.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef GETPASS_H
 # define GETPASS_H
diff --git a/gl/gettext.h b/gl/gettext.h
index 4fb025b..3108e4a 100644
--- a/gl/gettext.h
+++ b/gl/gettext.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _LIBGETTEXT_H
 #define _LIBGETTEXT_H 1
diff --git a/gl/gettimeofday.c b/gl/gettimeofday.c
index d18606a..5d35060 100644
--- a/gl/gettimeofday.c
+++ b/gl/gettimeofday.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* written by Jim Meyering */
 
diff --git a/gl/hmac-md5.c b/gl/hmac-md5.c
index 185e0c8..eb05b19 100644
--- a/gl/hmac-md5.c
+++ b/gl/hmac-md5.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Simon Josefsson.  */
 
diff --git a/gl/hmac-sha1.c b/gl/hmac-sha1.c
index 00c5c94..82cdd09 100644
--- a/gl/hmac-sha1.c
+++ b/gl/hmac-sha1.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Simon Josefsson.  */
 
diff --git a/gl/hmac.h b/gl/hmac.h
index f4fc543..4bb0a74 100644
--- a/gl/hmac.h
+++ b/gl/hmac.h
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Simon Josefsson.  */
 
diff --git a/gl/inet_ntop.c b/gl/inet_ntop.c
index ab3c1ff..b437e97 100644
--- a/gl/inet_ntop.c
+++ b/gl/inet_ntop.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /*
  * Copyright (c) 1996-1999 by Internet Software Consortium.
diff --git a/gl/lseek.c b/gl/lseek.c
index 5433678..794c230 100644
--- a/gl/lseek.c
+++ b/gl/lseek.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
@@ -60,5 +59,9 @@ rpl_lseek (int fd, off_t offset, int whence)
       return -1;
     }
 #endif
+#if _GL_WINDOWS_64_BIT_OFF_T
+  return _lseeki64 (fd, offset, whence);
+#else
   return lseek (fd, offset, whence);
+#endif
 }
diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4
index dec27fa..fc86e80 100644
--- a/gl/m4/dup2.m4
+++ b/gl/m4/dup2.m4
@@ -1,4 +1,4 @@
-#serial 17
+#serial 18
 dnl Copyright (C) 2002, 2005, 2007, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -45,22 +45,25 @@ AC_DEFUN([gl_FUNC_DUP2],
         [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no],
         [case "$host_os" in
            mingw*) # on this platform, dup2 always returns 0 for success
-             gl_cv_func_dup2_works=no;;
+             gl_cv_func_dup2_works="guessing no" ;;
            cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0
-             gl_cv_func_dup2_works=no;;
+             gl_cv_func_dup2_works="guessing no" ;;
            linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a
                    # closed fd may yield -EBADF instead of -1 / errno=EBADF.
-             gl_cv_func_dup2_works=no;;
+             gl_cv_func_dup2_works="guessing no" ;;
            freebsd*) # on FreeBSD 6.1, dup2(1,1000000) gives EMFILE, not EBADF.
-             gl_cv_func_dup2_works=no;;
+             gl_cv_func_dup2_works="guessing no" ;;
            haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC.
-             gl_cv_func_dup2_works=no;;
-           *) gl_cv_func_dup2_works=yes;;
+             gl_cv_func_dup2_works="guessing no" ;;
+           *) gl_cv_func_dup2_works="guessing yes" ;;
          esac])
       ])
-    if test "$gl_cv_func_dup2_works" = no; then
-      REPLACE_DUP2=1
-    fi
+    case "$gl_cv_func_dup2_works" in
+      *yes) ;;
+      *)
+        REPLACE_DUP2=1
+        ;;
+    esac
   fi
   dnl Replace dup2() for supporting the gnulib-defined fchdir() function,
   dnl to keep fchdir's bookkeeping up-to-date.
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4
index 4f0bb83..1e76ba2 100644
--- a/gl/m4/errno_h.m4
+++ b/gl/m4/errno_h.m4
@@ -1,4 +1,4 @@
-# errno_h.m4 serial 10
+# errno_h.m4 serial 11
 dnl Copyright (C) 2004, 2006, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,6 +10,9 @@ AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
   AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
     AC_EGREP_CPP([booboo],[
 #include <errno.h>
+#if !defined ETXTBSY
+booboo
+#endif
 #if !defined ENOMSG
 booboo
 #endif
@@ -49,6 +52,12 @@ booboo
 #if !defined ECANCELED
 booboo
 #endif
+#if !defined EOWNERDEAD
+booboo
+#endif
+#if !defined ENOTRECOVERABLE
+booboo
+#endif
       ],
       [gl_cv_header_errno_h_complete=no],
       [gl_cv_header_errno_h_complete=yes])
diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4
index be5bb35..1bb88c7 100644
--- a/gl/m4/fseeko.m4
+++ b/gl/m4/fseeko.m4
@@ -1,4 +1,4 @@
-# fseeko.m4 serial 15
+# fseeko.m4 serial 16
 dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,6 +8,7 @@ AC_DEFUN([gl_FUNC_FSEEKO],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
+  AC_REQUIRE([gl_SYS_TYPES_H])
   AC_REQUIRE([AC_PROG_CC])
 
   dnl Persuade glibc <stdio.h> to declare fseeko().
@@ -28,6 +29,9 @@ AC_DEFUN([gl_FUNC_FSEEKO],
   if test $gl_cv_func_fseeko = no; then
     HAVE_FSEEKO=0
   else
+    if test $WINDOWS_64_BIT_OFF_T = 1; then
+      REPLACE_FSEEKO=1
+    fi
     if test $gl_cv_var_stdin_large_offset = no; then
       REPLACE_FSEEKO=1
     fi
@@ -59,3 +63,11 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET],
         [gl_cv_var_stdin_large_offset=yes],
         [gl_cv_var_stdin_large_offset=no])])
 ])
+
+# Prerequisites of lib/fseeko.c.
+AC_DEFUN([gl_PREREQ_FSEEKO],
+[
+  dnl Native Windows has the function _fseeki64. mingw hides it, but mingw64
+  dnl makes it usable again.
+  AC_CHECK_FUNCS([_fseeki64])
+])
diff --git a/gl/m4/fstat.m4 b/gl/m4/fstat.m4
index e3f8f3e..3ab3297 100644
--- a/gl/m4/fstat.m4
+++ b/gl/m4/fstat.m4
@@ -1,4 +1,4 @@
-# fstat.m4 serial 1
+# fstat.m4 serial 3
 dnl Copyright (C) 2011-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,16 +7,27 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN([gl_FUNC_FSTAT],
 [
   AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+
   AC_REQUIRE([gl_MSVC_INVAL])
   if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
     REPLACE_FSTAT=1
   fi
+
+  AC_REQUIRE([gl_HEADER_SYS_STAT_H])
+  if test $WINDOWS_64_BIT_ST_SIZE = 1; then
+    REPLACE_FSTAT=1
+  fi
+
   dnl Replace fstat() for supporting the gnulib-defined open() on directories.
   m4_ifdef([gl_FUNC_FCHDIR], [
     gl_TEST_FCHDIR
-    if test $HAVE_FCHDIR = 0 \
-       && test "$gl_cv_func_open_directory_works" != yes; then
-      REPLACE_FSTAT=1
+    if test $HAVE_FCHDIR = 0; then
+      case "$gl_cv_func_open_directory_works" in
+        *yes) ;;
+        *)
+          REPLACE_FSTAT=1
+          ;;
+      esac
     fi
   ])
 ])
diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4
index 42be83e..ab7b548 100644
--- a/gl/m4/ftello.m4
+++ b/gl/m4/ftello.m4
@@ -1,4 +1,4 @@
-# ftello.m4 serial 10
+# ftello.m4 serial 11
 dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,6 +9,7 @@ AC_DEFUN([gl_FUNC_FTELLO],
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   AC_REQUIRE([AC_PROG_CC])
   AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
+  AC_REQUIRE([gl_SYS_TYPES_H])
 
   dnl Persuade glibc <stdio.h> to declare ftello().
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
@@ -30,9 +31,13 @@ AC_DEFUN([gl_FUNC_FTELLO],
   if test $gl_cv_func_ftello = no; then
     HAVE_FTELLO=0
   else
+    if test $WINDOWS_64_BIT_OFF_T = 1; then
+      REPLACE_FTELLO=1
+    fi
     if test $gl_cv_var_stdin_large_offset = no; then
       REPLACE_FTELLO=1
-    else
+    fi
+    if test $REPLACE_FTELLO = 0; then
       dnl Detect bug on Solaris.
       dnl ftell and ftello produce incorrect results after putc that followed a
       dnl getc call that reached EOF on Solaris. This is because the _IOREAD
@@ -125,3 +130,11 @@ main (void)
     fi
   fi
 ])
+
+# Prerequisites of lib/ftello.c.
+AC_DEFUN([gl_PREREQ_FTELLO],
+[
+  dnl Native Windows has the function _ftelli64. mingw hides it, but mingw64
+  dnl makes it usable again.
+  AC_CHECK_FUNCS([_ftelli64])
+])
diff --git a/gl/m4/gc.m4 b/gl/m4/gc.m4
index 8287d52..1dfeb29 100644
--- a/gl/m4/gc.m4
+++ b/gl/m4/gc.m4
@@ -1,5 +1,5 @@
-# gc.m4 serial 8
-dnl Copyright (C) 2005-2006, 2009-2012 Free Software Foundation, Inc.
+# gc.m4 serial 9
+dnl Copyright (C) 2005-2012 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.
@@ -10,6 +10,14 @@ AC_DEFUN([gl_GC],
     AS_HELP_STRING([--with-libgcrypt], [use libgcrypt for low-level crypto]),
     libgcrypt=$withval, libgcrypt=no)
   if test "$libgcrypt" != no; then
-    AC_LIB_HAVE_LINKFLAGS([gcrypt], [gpg-error], [#include <gcrypt.h>])
+    AC_LIB_HAVE_LINKFLAGS([gcrypt], [gpg-error], [
+#include <gcrypt.h>
+/* GCRY_MODULE_ID_USER was added in 1.4.4 and gc-libgcrypt.c
+   will fail on startup if we don't have 1.4.4 or later, so
+   test for it early. */
+#if !defined GCRY_MODULE_ID_USER
+error too old libgcrypt
+#endif
+])
   fi
 ])
diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4
index 8bd3d3f..a6f4872 100644
--- a/gl/m4/getdelim.m4
+++ b/gl/m4/getdelim.m4
@@ -1,4 +1,4 @@
-# getdelim.m4 serial 9
+# getdelim.m4 serial 10
 
 dnl Copyright (C) 2005-2007, 2009-2012 Free Software Foundation, Inc.
 dnl
@@ -63,12 +63,14 @@ AC_DEFUN([gl_FUNC_GETDELIM],
  #endif
 #endif
          ],
-         [gl_cv_func_working_getdelim=yes],
-         [gl_cv_func_working_getdelim=no])]
+         [gl_cv_func_working_getdelim="guessing yes"],
+         [gl_cv_func_working_getdelim="guessing no"])]
     )])
-    if test $gl_cv_func_working_getdelim = no; then
-      REPLACE_GETDELIM=1
-    fi
+    case "$gl_cv_func_working_getdelim" in
+      *no)
+        REPLACE_GETDELIM=1
+        ;;
+    esac
   else
     HAVE_GETDELIM=0
   fi
diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4
index 01f38cf..72fbc9d 100644
--- a/gl/m4/getline.m4
+++ b/gl/m4/getline.m4
@@ -1,4 +1,4 @@
-# getline.m4 serial 25
+# getline.m4 serial 26
 
 dnl Copyright (C) 1998-2003, 2005-2007, 2009-2012 Free Software Foundation,
 dnl Inc.
@@ -70,8 +70,8 @@ AC_DEFUN([gl_FUNC_GETLINE],
  #endif
 #endif
          ],
-         [am_cv_func_working_getline=yes],
-         [am_cv_func_working_getline=no])]
+         [am_cv_func_working_getline="guessing yes"],
+         [am_cv_func_working_getline="guessing no"])]
     )])
   fi
 
@@ -79,12 +79,14 @@ AC_DEFUN([gl_FUNC_GETLINE],
     HAVE_DECL_GETLINE=0
   fi
 
-  if test $am_cv_func_working_getline = no; then
-    dnl Set REPLACE_GETLINE always: Even if we have not found the broken
-    dnl getline function among $LIBS, it may exist in libinet and the
-    dnl executable may be linked with -linet.
-    REPLACE_GETLINE=1
-  fi
+  case "$am_cv_func_working_getline" in
+    *no)
+      dnl Set REPLACE_GETLINE always: Even if we have not found the broken
+      dnl getline function among $LIBS, it may exist in libinet and the
+      dnl executable may be linked with -linet.
+      REPLACE_GETLINE=1
+      ;;
+  esac
 ])
 
 # Prerequisites of lib/getline.c.
diff --git a/gl/m4/gettimeofday.m4 b/gl/m4/gettimeofday.m4
index dc68c43..eda9702 100644
--- a/gl/m4/gettimeofday.m4
+++ b/gl/m4/gettimeofday.m4
@@ -1,4 +1,4 @@
-# serial 18
+# serial 20
 
 # Copyright (C) 2001-2003, 2005, 2007, 2009-2012 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -56,14 +56,16 @@ int gettimeofday (struct timeval *restrict, struct timezone 
*restrict);
     fi
     m4_ifdef([gl_FUNC_TZSET_CLOBBER], [
       gl_FUNC_TZSET_CLOBBER
-      if test $gl_cv_func_tzset_clobber = yes; then
-        REPLACE_GETTIMEOFDAY=1
-        gl_GETTIMEOFDAY_REPLACE_LOCALTIME
-        AC_DEFINE([tzset], [rpl_tzset],
-          [Define to rpl_tzset if the wrapper function should be used.])
-        AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1],
-          [Define if tzset clobbers localtime's static buffer.])
-      fi
+      case "$gl_cv_func_tzset_clobber" in
+        *yes)
+          REPLACE_GETTIMEOFDAY=1
+          gl_GETTIMEOFDAY_REPLACE_LOCALTIME
+          AC_DEFINE([tzset], [rpl_tzset],
+            [Define to rpl_tzset if the wrapper function should be used.])
+          AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1],
+            [Define if tzset clobbers localtime's static buffer.])
+          ;;
+      esac
     ])
   fi
   AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone],
@@ -82,6 +84,7 @@ dnl the wrapper functions that work around the problem.
 AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
 [
  AC_REQUIRE([gl_HEADER_SYS_TIME_H])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
 
  AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer],
   [gl_cv_func_gettimeofday_clobber],
@@ -104,15 +107,23 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
         ]])],
      [gl_cv_func_gettimeofday_clobber=no],
      [gl_cv_func_gettimeofday_clobber=yes],
-     dnl When crosscompiling, assume it is broken.
-     [gl_cv_func_gettimeofday_clobber=yes])])
+     [# When cross-compiling:
+      case "$host_os" in
+                # Guess all is fine on glibc systems.
+        *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
+                # If we don't know, assume the worst.
+        *)      gl_cv_func_gettimeofday_clobber="guessing yes" ;;
+      esac
+     ])])
 
- if test $gl_cv_func_gettimeofday_clobber = yes; then
-   REPLACE_GETTIMEOFDAY=1
-   gl_GETTIMEOFDAY_REPLACE_LOCALTIME
-   AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], [1],
-     [Define if gettimeofday clobbers the localtime buffer.])
- fi
+ case "$gl_cv_func_gettimeofday_clobber" in
+   *yes)
+     REPLACE_GETTIMEOFDAY=1
+     gl_GETTIMEOFDAY_REPLACE_LOCALTIME
+     AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], [1],
+       [Define if gettimeofday clobbers the localtime buffer.])
+     ;;
+ esac
 ])
 
 AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index ae4d254..d62b767 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -14,7 +14,8 @@ AC_DEFUN([gl_COMMON], [
 AC_DEFUN([gl_COMMON_BODY], [
   AH_VERBATIM([_Noreturn],
 [/* The _Noreturn keyword of C11.  */
-#ifndef _Noreturn
+#if ! (defined _Noreturn \
+       || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
 # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index af28d20..deb3890 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -295,6 +295,7 @@ gl_STDIO_MODULE_INDICATOR([fseek])
 gl_FUNC_FSEEKO
 if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
   AC_LIBOBJ([fseeko])
+  gl_PREREQ_FSEEKO
 fi
 gl_STDIO_MODULE_INDICATOR([fseeko])
 gl_FUNC_FSTAT
@@ -311,6 +312,7 @@ gl_STDIO_MODULE_INDICATOR([ftell])
 gl_FUNC_FTELLO
 if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
   AC_LIBOBJ([ftello])
+  gl_PREREQ_FTELLO
 fi
 gl_STDIO_MODULE_INDICATOR([ftello])
 gl_GETADDRINFO
@@ -394,6 +396,7 @@ if test $HAVE_INET_NTOP = 0 || test $REPLACE_INET_NTOP = 1; 
then
 fi
 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
 gl_INLINE
+AC_REQUIRE([gl_LARGEFILE])
 gl_LD_OUTPUT_DEF
 gl_LD_VERSION_SCRIPT
 gl_FUNC_LSEEK
@@ -615,7 +618,6 @@ gl_STDIO_MODULE_INDICATOR([vasprintf])
 m4_ifdef([AM_XGETTEXT_OPTION],
   [AM_][XGETTEXT_OPTION([--flag=asprintf:2:c-format])
    AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])])
-AC_SUBST([WARN_CFLAGS])
 gl_WCHAR_H
 gl_XALLOC
 gl_XSIZE
@@ -1004,6 +1006,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/multiarch.m4
   m4/netdb_h.m4
   m4/netinet_in_h.m4
+  m4/off_t.m4
   m4/parse-datetime.m4
   m4/pathmax.m4
   m4/printf.m4
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4
index 1369bbe..a159f4a 100644
--- a/gl/m4/largefile.m4
+++ b/gl/m4/largefile.m4
@@ -102,3 +102,48 @@ fi
 ])# AC_SYS_LARGEFILE
 
 ])# m4_version_prereq 2.69
+
+# Enable large files on systems where this is implemented by Gnulib, not by the
+# system headers.
+# Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib
+# overrides ensure that off_t or 'struct size.st_size' are 64-bit, 
respectively.
+AC_DEFUN([gl_LARGEFILE],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw*)
+      dnl Native Windows.
+      dnl mingw64 defines off_t to a 64-bit type already, if
+      dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE.
+      AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64],
+        [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <sys/types.h>
+                int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1];
+              ]],
+              [[]])],
+           [gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no])
+        ])
+      if test $gl_cv_type_off_t_64 = no; then
+        WINDOWS_64_BIT_OFF_T=1
+      else
+        WINDOWS_64_BIT_OFF_T=0
+      fi
+      dnl But all native Windows platforms (including mingw64) have a 32-bit
+      dnl st_size member in 'struct stat'.
+      WINDOWS_64_BIT_ST_SIZE=1
+      ;;
+    *)
+      dnl Nothing to do on gnulib's side.
+      dnl A 64-bit off_t is
+      dnl   - already the default on MacOS X, FreeBSD, NetBSD, OpenBSD, IRIX,
+      dnl     OSF/1, Cygwin,
+      dnl   - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on
+      dnl     glibc, HP-UX, Solaris,
+      dnl   - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX,
+      dnl   - impossible to achieve on Minix 3.1.8.
+      WINDOWS_64_BIT_OFF_T=0
+      WINDOWS_64_BIT_ST_SIZE=0
+      ;;
+  esac
+])
diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4
index 86db59e..bdda7f6 100644
--- a/gl/m4/lseek.m4
+++ b/gl/m4/lseek.m4
@@ -1,4 +1,4 @@
-# lseek.m4 serial 8
+# lseek.m4 serial 10
 dnl Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,11 +7,24 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN([gl_FUNC_LSEEK],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+
+  AC_REQUIRE([AC_CANONICAL_HOST])
   AC_REQUIRE([AC_PROG_CC])
   AC_CHECK_HEADERS_ONCE([unistd.h])
   AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe],
-    [if test $cross_compiling = no; then
-       AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+    [case "$host_os" in
+       mingw*)
+         dnl Native Windows.
+         dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or
+         dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT)
+         dnl for a pipe depends on the environment: In a Cygwin 1.5
+         dnl environment it succeeds (wrong); in a Cygwin 1.7 environment
+         dnl it fails with a wrong errno value.
+         gl_cv_func_lseek_pipe=no
+         ;;
+       *)
+         if test $cross_compiling = no; then
+           AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h> /* for off_t */
 #include <stdio.h> /* for SEEK_CUR */
 #if HAVE_UNISTD_H
@@ -23,26 +36,36 @@ AC_DEFUN([gl_FUNC_LSEEK],
   /* Exit with success only if stdin is seekable.  */
   return lseek (0, (off_t)0, SEEK_CUR) < 0;
 ]])],
-         [if test -s conftest$ac_exeext \
-             && ./conftest$ac_exeext < conftest.$ac_ext \
-             && test 1 = "`echo hi \
-               | { ./conftest$ac_exeext; echo $?; cat >/dev/null; }`"; then
-            gl_cv_func_lseek_pipe=yes
-          else
-            gl_cv_func_lseek_pipe=no
-          fi],
-         [gl_cv_func_lseek_pipe=no])
-     else
-       AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
-#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined 
__BEOS__
-/* mingw and BeOS mistakenly return 0 when trying to seek on pipes.  */
+             [if test -s conftest$ac_exeext \
+                 && ./conftest$ac_exeext < conftest.$ac_ext \
+                 && test 1 = "`echo hi \
+                   | { ./conftest$ac_exeext; echo $?; cat >/dev/null; }`"; then
+                gl_cv_func_lseek_pipe=yes
+              else
+                gl_cv_func_lseek_pipe=no
+              fi
+             ],
+             [gl_cv_func_lseek_pipe=no])
+         else
+           AC_COMPILE_IFELSE(
+             [AC_LANG_SOURCE([[
+#if defined __BEOS__
+/* BeOS mistakenly return 0 when trying to seek on pipes.  */
   Choke me.
 #endif]])],
-         [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
-     fi])
+             [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
+         fi
+         ;;
+     esac
+    ])
   if test $gl_cv_func_lseek_pipe = no; then
     REPLACE_LSEEK=1
     AC_DEFINE([LSEEK_PIPE_BROKEN], [1],
       [Define to 1 if lseek does not detect pipes.])
   fi
+
+  AC_REQUIRE([gl_SYS_TYPES_H])
+  if test $WINDOWS_64_BIT_OFF_T = 1; then
+    REPLACE_LSEEK=1
+  fi
 ])
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4
index d3c39f5..8fa48e9 100644
--- a/gl/m4/malloc.m4
+++ b/gl/m4/malloc.m4
@@ -1,9 +1,47 @@
-# malloc.m4 serial 13
+# malloc.m4 serial 14
 dnl Copyright (C) 2007, 2009-2012 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.
 
+m4_version_prereq([2.70], [] ,[
+
+# This is taken from the following Autoconf patch:
+# 
http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
+AC_DEFUN([_AC_FUNC_MALLOC_IF],
+[
+  AC_REQUIRE([AC_HEADER_STDC])dnl
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
+  AC_CHECK_HEADERS([stdlib.h])
+  AC_CACHE_CHECK([for GNU libc compatible malloc],
+    [ac_cv_func_malloc_0_nonnull],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+            # include <stdlib.h>
+            #else
+            char *malloc ();
+            #endif
+          ]],
+          [[return ! malloc (0);]])
+       ],
+       [ac_cv_func_malloc_0_nonnull=yes],
+       [ac_cv_func_malloc_0_nonnull=no],
+       [case "$host_os" in
+          # Guess yes on platforms where we know the result.
+          *-gnu* | freebsd* | netbsd* | openbsd* \
+          | hpux* | solaris* | cygwin* | mingw*)
+            ac_cv_func_malloc_0_nonnull=yes ;;
+          # If we don't know, assume the worst.
+          *) ac_cv_func_malloc_0_nonnull=no ;;
+        esac
+       ])
+    ])
+  AS_IF([test $ac_cv_func_malloc_0_nonnull = yes], [$1], [$2])
+])# _AC_FUNC_MALLOC_IF
+
+])
+
 # gl_FUNC_MALLOC_GNU
 # ------------------
 # Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if
diff --git a/gl/m4/manywarnings.m4 b/gl/m4/manywarnings.m4
index fd0e372..864fc85 100644
--- a/gl/m4/manywarnings.m4
+++ b/gl/m4/manywarnings.m4
@@ -1,4 +1,4 @@
-# manywarnings.m4 serial 3
+# manywarnings.m4 serial 4
 dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -143,7 +143,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
   for gl_manywarn_item in \
     -Wattributes \
     -Wcoverage-mismatch \
-    -Wmultichar \
     -Wunused-macros \
     ; do
     gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
diff --git a/gl/m4/math_h.m4 b/gl/m4/math_h.m4
index 5d7d52b..90d248a 100644
--- a/gl/m4/math_h.m4
+++ b/gl/m4/math_h.m4
@@ -1,4 +1,4 @@
-# math_h.m4 serial 56
+# math_h.m4 serial 113
 dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -40,9 +40,16 @@ AC_DEFUN([gl_MATH_H],
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[#include <math.h>]],
     [acosf acosl asinf asinl atanf atanl
-     ceilf ceill copysign copysignf copysignl cosf cosl coshf
-     expf expl fabsf floorf floorl fma fmaf fmal fmodf frexpf frexpl
-     ldexpf ldexpl logb logf logl log10f modff powf
+     cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf
+     expf expl exp2 exp2f exp2l expm1 expm1f expm1l
+     fabsf fabsl floorf floorl fma fmaf fmal
+     fmod fmodf fmodl frexpf frexpl hypotf hypotl
+     ilogb ilogbf ilogbl
+     ldexpf ldexpl
+     log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l
+     logb logbf logbl
+     modf modff modfl powf
+     remainder remainderf remainderl
      rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl
      tanf tanl tanhf trunc truncf truncl])
 ])
@@ -58,67 +65,101 @@ AC_DEFUN([gl_MATH_MODULE_INDICATOR],
 
 AC_DEFUN([gl_MATH_H_DEFAULTS],
 [
-  GNULIB_ACOSF=0;     AC_SUBST([GNULIB_ACOSF])
-  GNULIB_ACOSL=0;     AC_SUBST([GNULIB_ACOSL])
-  GNULIB_ASINF=0;     AC_SUBST([GNULIB_ASINF])
-  GNULIB_ASINL=0;     AC_SUBST([GNULIB_ASINL])
-  GNULIB_ATANF=0;     AC_SUBST([GNULIB_ATANF])
-  GNULIB_ATANL=0;     AC_SUBST([GNULIB_ATANL])
-  GNULIB_ATAN2F=0;    AC_SUBST([GNULIB_ATAN2F])
-  GNULIB_CEIL=0;      AC_SUBST([GNULIB_CEIL])
-  GNULIB_CEILF=0;     AC_SUBST([GNULIB_CEILF])
-  GNULIB_CEILL=0;     AC_SUBST([GNULIB_CEILL])
-  GNULIB_COPYSIGN=0;  AC_SUBST([GNULIB_COPYSIGN])
-  GNULIB_COPYSIGNF=0; AC_SUBST([GNULIB_COPYSIGNF])
-  GNULIB_COPYSIGNL=0; AC_SUBST([GNULIB_COPYSIGNL])
-  GNULIB_COSF=0;      AC_SUBST([GNULIB_COSF])
-  GNULIB_COSL=0;      AC_SUBST([GNULIB_COSL])
-  GNULIB_COSHF=0;     AC_SUBST([GNULIB_COSHF])
-  GNULIB_EXPF=0;      AC_SUBST([GNULIB_EXPF])
-  GNULIB_EXPL=0;      AC_SUBST([GNULIB_EXPL])
-  GNULIB_FABSF=0;     AC_SUBST([GNULIB_FABSF])
-  GNULIB_FLOOR=0;     AC_SUBST([GNULIB_FLOOR])
-  GNULIB_FLOORF=0;    AC_SUBST([GNULIB_FLOORF])
-  GNULIB_FLOORL=0;    AC_SUBST([GNULIB_FLOORL])
-  GNULIB_FMA=0;       AC_SUBST([GNULIB_FMA])
-  GNULIB_FMAF=0;      AC_SUBST([GNULIB_FMAF])
-  GNULIB_FMAL=0;      AC_SUBST([GNULIB_FMAL])
-  GNULIB_FMODF=0;     AC_SUBST([GNULIB_FMODF])
-  GNULIB_FREXPF=0;    AC_SUBST([GNULIB_FREXPF])
-  GNULIB_FREXP=0;     AC_SUBST([GNULIB_FREXP])
-  GNULIB_FREXPL=0;    AC_SUBST([GNULIB_FREXPL])
-  GNULIB_ISFINITE=0;  AC_SUBST([GNULIB_ISFINITE])
-  GNULIB_ISINF=0;     AC_SUBST([GNULIB_ISINF])
-  GNULIB_ISNAN=0;     AC_SUBST([GNULIB_ISNAN])
-  GNULIB_ISNANF=0;    AC_SUBST([GNULIB_ISNANF])
-  GNULIB_ISNAND=0;    AC_SUBST([GNULIB_ISNAND])
-  GNULIB_ISNANL=0;    AC_SUBST([GNULIB_ISNANL])
-  GNULIB_LDEXPF=0;    AC_SUBST([GNULIB_LDEXPF])
-  GNULIB_LDEXPL=0;    AC_SUBST([GNULIB_LDEXPL])
-  GNULIB_LOGB=0;      AC_SUBST([GNULIB_LOGB])
-  GNULIB_LOGF=0;      AC_SUBST([GNULIB_LOGF])
-  GNULIB_LOGL=0;      AC_SUBST([GNULIB_LOGL])
-  GNULIB_LOG10F=0;    AC_SUBST([GNULIB_LOG10F])
-  GNULIB_MODFF=0;     AC_SUBST([GNULIB_MODFF])
-  GNULIB_POWF=0;      AC_SUBST([GNULIB_POWF])
-  GNULIB_RINT=0;      AC_SUBST([GNULIB_RINT])
-  GNULIB_RINTF=0;     AC_SUBST([GNULIB_RINTF])
-  GNULIB_RINTL=0;     AC_SUBST([GNULIB_RINTL])
-  GNULIB_ROUND=0;     AC_SUBST([GNULIB_ROUND])
-  GNULIB_ROUNDF=0;    AC_SUBST([GNULIB_ROUNDF])
-  GNULIB_ROUNDL=0;    AC_SUBST([GNULIB_ROUNDL])
-  GNULIB_SIGNBIT=0;   AC_SUBST([GNULIB_SIGNBIT])
-  GNULIB_SINF=0;      AC_SUBST([GNULIB_SINF])
-  GNULIB_SINL=0;      AC_SUBST([GNULIB_SINL])
-  GNULIB_SINHF=0;     AC_SUBST([GNULIB_SINHF])
-  GNULIB_SQRTF=0;     AC_SUBST([GNULIB_SQRTF])
-  GNULIB_SQRTL=0;     AC_SUBST([GNULIB_SQRTL])
-  GNULIB_TANF=0;      AC_SUBST([GNULIB_TANF])
-  GNULIB_TANL=0;      AC_SUBST([GNULIB_TANL])
-  GNULIB_TANHF=0;     AC_SUBST([GNULIB_TANHF])
-  GNULIB_TRUNC=0;     AC_SUBST([GNULIB_TRUNC])
-  GNULIB_TRUNCF=0;    AC_SUBST([GNULIB_TRUNCF])
-  GNULIB_TRUNCL=0;    AC_SUBST([GNULIB_TRUNCL])
+  GNULIB_ACOSF=0;      AC_SUBST([GNULIB_ACOSF])
+  GNULIB_ACOSL=0;      AC_SUBST([GNULIB_ACOSL])
+  GNULIB_ASINF=0;      AC_SUBST([GNULIB_ASINF])
+  GNULIB_ASINL=0;      AC_SUBST([GNULIB_ASINL])
+  GNULIB_ATANF=0;      AC_SUBST([GNULIB_ATANF])
+  GNULIB_ATANL=0;      AC_SUBST([GNULIB_ATANL])
+  GNULIB_ATAN2F=0;     AC_SUBST([GNULIB_ATAN2F])
+  GNULIB_CBRT=0;       AC_SUBST([GNULIB_CBRT])
+  GNULIB_CBRTF=0;      AC_SUBST([GNULIB_CBRTF])
+  GNULIB_CBRTL=0;      AC_SUBST([GNULIB_CBRTL])
+  GNULIB_CEIL=0;       AC_SUBST([GNULIB_CEIL])
+  GNULIB_CEILF=0;      AC_SUBST([GNULIB_CEILF])
+  GNULIB_CEILL=0;      AC_SUBST([GNULIB_CEILL])
+  GNULIB_COPYSIGN=0;   AC_SUBST([GNULIB_COPYSIGN])
+  GNULIB_COPYSIGNF=0;  AC_SUBST([GNULIB_COPYSIGNF])
+  GNULIB_COPYSIGNL=0;  AC_SUBST([GNULIB_COPYSIGNL])
+  GNULIB_COSF=0;       AC_SUBST([GNULIB_COSF])
+  GNULIB_COSL=0;       AC_SUBST([GNULIB_COSL])
+  GNULIB_COSHF=0;      AC_SUBST([GNULIB_COSHF])
+  GNULIB_EXPF=0;       AC_SUBST([GNULIB_EXPF])
+  GNULIB_EXPL=0;       AC_SUBST([GNULIB_EXPL])
+  GNULIB_EXP2=0;       AC_SUBST([GNULIB_EXP2])
+  GNULIB_EXP2F=0;      AC_SUBST([GNULIB_EXP2F])
+  GNULIB_EXP2L=0;      AC_SUBST([GNULIB_EXP2L])
+  GNULIB_EXPM1=0;      AC_SUBST([GNULIB_EXPM1])
+  GNULIB_EXPM1F=0;     AC_SUBST([GNULIB_EXPM1F])
+  GNULIB_EXPM1L=0;     AC_SUBST([GNULIB_EXPM1L])
+  GNULIB_FABSF=0;      AC_SUBST([GNULIB_FABSF])
+  GNULIB_FABSL=0;      AC_SUBST([GNULIB_FABSL])
+  GNULIB_FLOOR=0;      AC_SUBST([GNULIB_FLOOR])
+  GNULIB_FLOORF=0;     AC_SUBST([GNULIB_FLOORF])
+  GNULIB_FLOORL=0;     AC_SUBST([GNULIB_FLOORL])
+  GNULIB_FMA=0;        AC_SUBST([GNULIB_FMA])
+  GNULIB_FMAF=0;       AC_SUBST([GNULIB_FMAF])
+  GNULIB_FMAL=0;       AC_SUBST([GNULIB_FMAL])
+  GNULIB_FMOD=0;       AC_SUBST([GNULIB_FMOD])
+  GNULIB_FMODF=0;      AC_SUBST([GNULIB_FMODF])
+  GNULIB_FMODL=0;      AC_SUBST([GNULIB_FMODL])
+  GNULIB_FREXPF=0;     AC_SUBST([GNULIB_FREXPF])
+  GNULIB_FREXP=0;      AC_SUBST([GNULIB_FREXP])
+  GNULIB_FREXPL=0;     AC_SUBST([GNULIB_FREXPL])
+  GNULIB_HYPOT=0;      AC_SUBST([GNULIB_HYPOT])
+  GNULIB_HYPOTF=0;     AC_SUBST([GNULIB_HYPOTF])
+  GNULIB_HYPOTL=0;     AC_SUBST([GNULIB_HYPOTL])
+  GNULIB_ILOGB=0;      AC_SUBST([GNULIB_ILOGB])
+  GNULIB_ILOGBF=0;     AC_SUBST([GNULIB_ILOGBF])
+  GNULIB_ILOGBL=0;     AC_SUBST([GNULIB_ILOGBL])
+  GNULIB_ISFINITE=0;   AC_SUBST([GNULIB_ISFINITE])
+  GNULIB_ISINF=0;      AC_SUBST([GNULIB_ISINF])
+  GNULIB_ISNAN=0;      AC_SUBST([GNULIB_ISNAN])
+  GNULIB_ISNANF=0;     AC_SUBST([GNULIB_ISNANF])
+  GNULIB_ISNAND=0;     AC_SUBST([GNULIB_ISNAND])
+  GNULIB_ISNANL=0;     AC_SUBST([GNULIB_ISNANL])
+  GNULIB_LDEXPF=0;     AC_SUBST([GNULIB_LDEXPF])
+  GNULIB_LDEXPL=0;     AC_SUBST([GNULIB_LDEXPL])
+  GNULIB_LOG=0;        AC_SUBST([GNULIB_LOG])
+  GNULIB_LOGF=0;       AC_SUBST([GNULIB_LOGF])
+  GNULIB_LOGL=0;       AC_SUBST([GNULIB_LOGL])
+  GNULIB_LOG10=0;      AC_SUBST([GNULIB_LOG10])
+  GNULIB_LOG10F=0;     AC_SUBST([GNULIB_LOG10F])
+  GNULIB_LOG10L=0;     AC_SUBST([GNULIB_LOG10L])
+  GNULIB_LOG1P=0;      AC_SUBST([GNULIB_LOG1P])
+  GNULIB_LOG1PF=0;     AC_SUBST([GNULIB_LOG1PF])
+  GNULIB_LOG1PL=0;     AC_SUBST([GNULIB_LOG1PL])
+  GNULIB_LOG2=0;       AC_SUBST([GNULIB_LOG2])
+  GNULIB_LOG2F=0;      AC_SUBST([GNULIB_LOG2F])
+  GNULIB_LOG2L=0;      AC_SUBST([GNULIB_LOG2L])
+  GNULIB_LOGB=0;       AC_SUBST([GNULIB_LOGB])
+  GNULIB_LOGBF=0;      AC_SUBST([GNULIB_LOGBF])
+  GNULIB_LOGBL=0;      AC_SUBST([GNULIB_LOGBL])
+  GNULIB_MODF=0;       AC_SUBST([GNULIB_MODF])
+  GNULIB_MODFF=0;      AC_SUBST([GNULIB_MODFF])
+  GNULIB_MODFL=0;      AC_SUBST([GNULIB_MODFL])
+  GNULIB_POWF=0;       AC_SUBST([GNULIB_POWF])
+  GNULIB_REMAINDER=0;  AC_SUBST([GNULIB_REMAINDER])
+  GNULIB_REMAINDERF=0; AC_SUBST([GNULIB_REMAINDERF])
+  GNULIB_REMAINDERL=0; AC_SUBST([GNULIB_REMAINDERL])
+  GNULIB_RINT=0;       AC_SUBST([GNULIB_RINT])
+  GNULIB_RINTF=0;      AC_SUBST([GNULIB_RINTF])
+  GNULIB_RINTL=0;      AC_SUBST([GNULIB_RINTL])
+  GNULIB_ROUND=0;      AC_SUBST([GNULIB_ROUND])
+  GNULIB_ROUNDF=0;     AC_SUBST([GNULIB_ROUNDF])
+  GNULIB_ROUNDL=0;     AC_SUBST([GNULIB_ROUNDL])
+  GNULIB_SIGNBIT=0;    AC_SUBST([GNULIB_SIGNBIT])
+  GNULIB_SINF=0;       AC_SUBST([GNULIB_SINF])
+  GNULIB_SINL=0;       AC_SUBST([GNULIB_SINL])
+  GNULIB_SINHF=0;      AC_SUBST([GNULIB_SINHF])
+  GNULIB_SQRTF=0;      AC_SUBST([GNULIB_SQRTF])
+  GNULIB_SQRTL=0;      AC_SUBST([GNULIB_SQRTL])
+  GNULIB_TANF=0;       AC_SUBST([GNULIB_TANF])
+  GNULIB_TANL=0;       AC_SUBST([GNULIB_TANL])
+  GNULIB_TANHF=0;      AC_SUBST([GNULIB_TANHF])
+  GNULIB_TRUNC=0;      AC_SUBST([GNULIB_TRUNC])
+  GNULIB_TRUNCF=0;     AC_SUBST([GNULIB_TRUNCF])
+  GNULIB_TRUNCL=0;     AC_SUBST([GNULIB_TRUNCL])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_ACOSF=1;                AC_SUBST([HAVE_ACOSF])
   HAVE_ACOSL=1;                AC_SUBST([HAVE_ACOSL])
@@ -127,20 +168,31 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   HAVE_ATANF=1;                AC_SUBST([HAVE_ATANF])
   HAVE_ATANL=1;                AC_SUBST([HAVE_ATANL])
   HAVE_ATAN2F=1;               AC_SUBST([HAVE_ATAN2F])
+  HAVE_CBRT=1;                 AC_SUBST([HAVE_CBRT])
+  HAVE_CBRTF=1;                AC_SUBST([HAVE_CBRTF])
+  HAVE_CBRTL=1;                AC_SUBST([HAVE_CBRTL])
   HAVE_COPYSIGN=1;             AC_SUBST([HAVE_COPYSIGN])
-  HAVE_COPYSIGNF=1;            AC_SUBST([HAVE_COPYSIGNF])
   HAVE_COPYSIGNL=1;            AC_SUBST([HAVE_COPYSIGNL])
   HAVE_COSF=1;                 AC_SUBST([HAVE_COSF])
   HAVE_COSL=1;                 AC_SUBST([HAVE_COSL])
   HAVE_COSHF=1;                AC_SUBST([HAVE_COSHF])
   HAVE_EXPF=1;                 AC_SUBST([HAVE_EXPF])
   HAVE_EXPL=1;                 AC_SUBST([HAVE_EXPL])
+  HAVE_EXPM1=1;                AC_SUBST([HAVE_EXPM1])
+  HAVE_EXPM1F=1;               AC_SUBST([HAVE_EXPM1F])
   HAVE_FABSF=1;                AC_SUBST([HAVE_FABSF])
+  HAVE_FABSL=1;                AC_SUBST([HAVE_FABSL])
   HAVE_FMA=1;                  AC_SUBST([HAVE_FMA])
   HAVE_FMAF=1;                 AC_SUBST([HAVE_FMAF])
   HAVE_FMAL=1;                 AC_SUBST([HAVE_FMAL])
   HAVE_FMODF=1;                AC_SUBST([HAVE_FMODF])
+  HAVE_FMODL=1;                AC_SUBST([HAVE_FMODL])
   HAVE_FREXPF=1;               AC_SUBST([HAVE_FREXPF])
+  HAVE_HYPOTF=1;               AC_SUBST([HAVE_HYPOTF])
+  HAVE_HYPOTL=1;               AC_SUBST([HAVE_HYPOTL])
+  HAVE_ILOGB=1;                AC_SUBST([HAVE_ILOGB])
+  HAVE_ILOGBF=1;               AC_SUBST([HAVE_ILOGBF])
+  HAVE_ILOGBL=1;               AC_SUBST([HAVE_ILOGBL])
   HAVE_ISNANF=1;               AC_SUBST([HAVE_ISNANF])
   HAVE_ISNAND=1;               AC_SUBST([HAVE_ISNAND])
   HAVE_ISNANL=1;               AC_SUBST([HAVE_ISNANL])
@@ -148,10 +200,18 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   HAVE_LOGF=1;                 AC_SUBST([HAVE_LOGF])
   HAVE_LOGL=1;                 AC_SUBST([HAVE_LOGL])
   HAVE_LOG10F=1;               AC_SUBST([HAVE_LOG10F])
+  HAVE_LOG10L=1;               AC_SUBST([HAVE_LOG10L])
+  HAVE_LOG1P=1;                AC_SUBST([HAVE_LOG1P])
+  HAVE_LOG1PF=1;               AC_SUBST([HAVE_LOG1PF])
+  HAVE_LOG1PL=1;               AC_SUBST([HAVE_LOG1PL])
+  HAVE_LOGBF=1;                AC_SUBST([HAVE_LOGBF])
+  HAVE_LOGBL=1;                AC_SUBST([HAVE_LOGBL])
   HAVE_MODFF=1;                AC_SUBST([HAVE_MODFF])
+  HAVE_MODFL=1;                AC_SUBST([HAVE_MODFL])
   HAVE_POWF=1;                 AC_SUBST([HAVE_POWF])
+  HAVE_REMAINDER=1;            AC_SUBST([HAVE_REMAINDER])
+  HAVE_REMAINDERF=1;           AC_SUBST([HAVE_REMAINDERF])
   HAVE_RINT=1;                 AC_SUBST([HAVE_RINT])
-  HAVE_RINTF=1;                AC_SUBST([HAVE_RINTF])
   HAVE_RINTL=1;                AC_SUBST([HAVE_RINTL])
   HAVE_SINF=1;                 AC_SUBST([HAVE_SINF])
   HAVE_SINL=1;                 AC_SUBST([HAVE_SINL])
@@ -164,16 +224,30 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   HAVE_DECL_ACOSL=1;           AC_SUBST([HAVE_DECL_ACOSL])
   HAVE_DECL_ASINL=1;           AC_SUBST([HAVE_DECL_ASINL])
   HAVE_DECL_ATANL=1;           AC_SUBST([HAVE_DECL_ATANL])
+  HAVE_DECL_CBRTF=1;           AC_SUBST([HAVE_DECL_CBRTF])
+  HAVE_DECL_CBRTL=1;           AC_SUBST([HAVE_DECL_CBRTL])
   HAVE_DECL_CEILF=1;           AC_SUBST([HAVE_DECL_CEILF])
   HAVE_DECL_CEILL=1;           AC_SUBST([HAVE_DECL_CEILL])
+  HAVE_DECL_COPYSIGNF=1;       AC_SUBST([HAVE_DECL_COPYSIGNF])
   HAVE_DECL_COSL=1;            AC_SUBST([HAVE_DECL_COSL])
   HAVE_DECL_EXPL=1;            AC_SUBST([HAVE_DECL_EXPL])
+  HAVE_DECL_EXP2=1;            AC_SUBST([HAVE_DECL_EXP2])
+  HAVE_DECL_EXP2F=1;           AC_SUBST([HAVE_DECL_EXP2F])
+  HAVE_DECL_EXP2L=1;           AC_SUBST([HAVE_DECL_EXP2L])
+  HAVE_DECL_EXPM1L=1;          AC_SUBST([HAVE_DECL_EXPM1L])
   HAVE_DECL_FLOORF=1;          AC_SUBST([HAVE_DECL_FLOORF])
   HAVE_DECL_FLOORL=1;          AC_SUBST([HAVE_DECL_FLOORL])
   HAVE_DECL_FREXPL=1;          AC_SUBST([HAVE_DECL_FREXPL])
   HAVE_DECL_LDEXPL=1;          AC_SUBST([HAVE_DECL_LDEXPL])
-  HAVE_DECL_LOGB=1;            AC_SUBST([HAVE_DECL_LOGB])
   HAVE_DECL_LOGL=1;            AC_SUBST([HAVE_DECL_LOGL])
+  HAVE_DECL_LOG10L=1;          AC_SUBST([HAVE_DECL_LOG10L])
+  HAVE_DECL_LOG2=1;            AC_SUBST([HAVE_DECL_LOG2])
+  HAVE_DECL_LOG2F=1;           AC_SUBST([HAVE_DECL_LOG2F])
+  HAVE_DECL_LOG2L=1;           AC_SUBST([HAVE_DECL_LOG2L])
+  HAVE_DECL_LOGB=1;            AC_SUBST([HAVE_DECL_LOGB])
+  HAVE_DECL_REMAINDER=1;       AC_SUBST([HAVE_DECL_REMAINDER])
+  HAVE_DECL_REMAINDERL=1;      AC_SUBST([HAVE_DECL_REMAINDERL])
+  HAVE_DECL_RINTF=1;           AC_SUBST([HAVE_DECL_RINTF])
   HAVE_DECL_ROUND=1;           AC_SUBST([HAVE_DECL_ROUND])
   HAVE_DECL_ROUNDF=1;          AC_SUBST([HAVE_DECL_ROUNDF])
   HAVE_DECL_ROUNDL=1;          AC_SUBST([HAVE_DECL_ROUNDL])
@@ -183,29 +257,66 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   HAVE_DECL_TRUNC=1;           AC_SUBST([HAVE_DECL_TRUNC])
   HAVE_DECL_TRUNCF=1;          AC_SUBST([HAVE_DECL_TRUNCF])
   HAVE_DECL_TRUNCL=1;          AC_SUBST([HAVE_DECL_TRUNCL])
+  REPLACE_CBRTF=0;             AC_SUBST([REPLACE_CBRTF])
+  REPLACE_CBRTL=0;             AC_SUBST([REPLACE_CBRTL])
   REPLACE_CEIL=0;              AC_SUBST([REPLACE_CEIL])
   REPLACE_CEILF=0;             AC_SUBST([REPLACE_CEILF])
   REPLACE_CEILL=0;             AC_SUBST([REPLACE_CEILL])
+  REPLACE_EXPM1=0;             AC_SUBST([REPLACE_EXPM1])
+  REPLACE_EXPM1F=0;            AC_SUBST([REPLACE_EXPM1F])
+  REPLACE_EXP2=0;              AC_SUBST([REPLACE_EXP2])
+  REPLACE_EXP2L=0;             AC_SUBST([REPLACE_EXP2L])
+  REPLACE_FABSL=0;             AC_SUBST([REPLACE_FABSL])
   REPLACE_FLOOR=0;             AC_SUBST([REPLACE_FLOOR])
   REPLACE_FLOORF=0;            AC_SUBST([REPLACE_FLOORF])
   REPLACE_FLOORL=0;            AC_SUBST([REPLACE_FLOORL])
   REPLACE_FMA=0;               AC_SUBST([REPLACE_FMA])
   REPLACE_FMAF=0;              AC_SUBST([REPLACE_FMAF])
   REPLACE_FMAL=0;              AC_SUBST([REPLACE_FMAL])
+  REPLACE_FMOD=0;              AC_SUBST([REPLACE_FMOD])
+  REPLACE_FMODF=0;             AC_SUBST([REPLACE_FMODF])
+  REPLACE_FMODL=0;             AC_SUBST([REPLACE_FMODL])
   REPLACE_FREXPF=0;            AC_SUBST([REPLACE_FREXPF])
   REPLACE_FREXP=0;             AC_SUBST([REPLACE_FREXP])
   REPLACE_FREXPL=0;            AC_SUBST([REPLACE_FREXPL])
   REPLACE_HUGE_VAL=0;          AC_SUBST([REPLACE_HUGE_VAL])
+  REPLACE_HYPOT=0;             AC_SUBST([REPLACE_HYPOT])
+  REPLACE_HYPOTF=0;            AC_SUBST([REPLACE_HYPOTF])
+  REPLACE_HYPOTL=0;            AC_SUBST([REPLACE_HYPOTL])
+  REPLACE_ILOGB=0;             AC_SUBST([REPLACE_ILOGB])
+  REPLACE_ILOGBF=0;            AC_SUBST([REPLACE_ILOGBF])
   REPLACE_ISFINITE=0;          AC_SUBST([REPLACE_ISFINITE])
   REPLACE_ISINF=0;             AC_SUBST([REPLACE_ISINF])
   REPLACE_ISNAN=0;             AC_SUBST([REPLACE_ISNAN])
   REPLACE_LDEXPL=0;            AC_SUBST([REPLACE_LDEXPL])
+  REPLACE_LOG=0;               AC_SUBST([REPLACE_LOG])
+  REPLACE_LOGF=0;              AC_SUBST([REPLACE_LOGF])
+  REPLACE_LOGL=0;              AC_SUBST([REPLACE_LOGL])
+  REPLACE_LOG10=0;             AC_SUBST([REPLACE_LOG10])
+  REPLACE_LOG10F=0;            AC_SUBST([REPLACE_LOG10F])
+  REPLACE_LOG10L=0;            AC_SUBST([REPLACE_LOG10L])
+  REPLACE_LOG1P=0;             AC_SUBST([REPLACE_LOG1P])
+  REPLACE_LOG1PF=0;            AC_SUBST([REPLACE_LOG1PF])
+  REPLACE_LOG1PL=0;            AC_SUBST([REPLACE_LOG1PL])
+  REPLACE_LOG2=0;              AC_SUBST([REPLACE_LOG2])
+  REPLACE_LOG2F=0;             AC_SUBST([REPLACE_LOG2F])
+  REPLACE_LOG2L=0;             AC_SUBST([REPLACE_LOG2L])
+  REPLACE_LOGB=0;              AC_SUBST([REPLACE_LOGB])
+  REPLACE_LOGBF=0;             AC_SUBST([REPLACE_LOGBF])
+  REPLACE_LOGBL=0;             AC_SUBST([REPLACE_LOGBL])
+  REPLACE_MODF=0;              AC_SUBST([REPLACE_MODF])
+  REPLACE_MODFF=0;             AC_SUBST([REPLACE_MODFF])
+  REPLACE_MODFL=0;             AC_SUBST([REPLACE_MODFL])
   REPLACE_NAN=0;               AC_SUBST([REPLACE_NAN])
+  REPLACE_REMAINDER=0;         AC_SUBST([REPLACE_REMAINDER])
+  REPLACE_REMAINDERF=0;        AC_SUBST([REPLACE_REMAINDERF])
+  REPLACE_REMAINDERL=0;        AC_SUBST([REPLACE_REMAINDERL])
   REPLACE_ROUND=0;             AC_SUBST([REPLACE_ROUND])
   REPLACE_ROUNDF=0;            AC_SUBST([REPLACE_ROUNDF])
   REPLACE_ROUNDL=0;            AC_SUBST([REPLACE_ROUNDL])
   REPLACE_SIGNBIT=0;           AC_SUBST([REPLACE_SIGNBIT])
   REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC])
+  REPLACE_SQRTL=0;             AC_SUBST([REPLACE_SQRTL])
   REPLACE_TRUNC=0;             AC_SUBST([REPLACE_TRUNC])
   REPLACE_TRUNCF=0;            AC_SUBST([REPLACE_TRUNCF])
   REPLACE_TRUNCL=0;            AC_SUBST([REPLACE_TRUNCL])
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4
index 4613cbe..579323f 100644
--- a/gl/m4/mmap-anon.m4
+++ b/gl/m4/mmap-anon.m4
@@ -27,18 +27,18 @@ AC_DEFUN([gl_FUNC_MMAP_ANON],
   gl_have_mmap_anonymous=no
   if test $gl_have_mmap = yes; then
     AC_MSG_CHECKING([for MAP_ANONYMOUS])
-    AC_EGREP_CPP([I cant identify this map], [
+    AC_EGREP_CPP([I cannot identify this map], [
 #include <sys/mman.h>
 #ifdef MAP_ANONYMOUS
-    I cant identify this map
+    I cannot identify this map
 #endif
 ],
       [gl_have_mmap_anonymous=yes])
     if test $gl_have_mmap_anonymous != yes; then
-      AC_EGREP_CPP([I cant identify this map], [
+      AC_EGREP_CPP([I cannot identify this map], [
 #include <sys/mman.h>
 #ifdef MAP_ANON
-    I cant identify this map
+    I cannot identify this map
 #endif
 ],
         [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON],
diff --git a/gl/m4/off_t.m4 b/gl/m4/off_t.m4
new file mode 100644
index 0000000..dfca2df
--- /dev/null
+++ b/gl/m4/off_t.m4
@@ -0,0 +1,18 @@
+# off_t.m4 serial 1
+dnl Copyright (C) 2012 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.
+
+dnl Check whether to override the 'off_t' type.
+dnl Set WINDOWS_64_BIT_OFF_T.
+
+AC_DEFUN([gl_TYPE_OFF_T],
+[
+  m4_ifdef([gl_LARGEFILE], [
+    AC_REQUIRE([gl_LARGEFILE])
+  ], [
+    WINDOWS_64_BIT_OFF_T=0
+  ])
+  AC_SUBST([WINDOWS_64_BIT_OFF_T])
+])
diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4
index 039ed19..954c2f0 100644
--- a/gl/m4/realloc.m4
+++ b/gl/m4/realloc.m4
@@ -1,9 +1,47 @@
-# realloc.m4 serial 12
+# realloc.m4 serial 13
 dnl Copyright (C) 2007, 2009-2012 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.
 
+m4_version_prereq([2.70], [] ,[
+
+# This is taken from the following Autoconf patch:
+# 
http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
+AC_DEFUN([_AC_FUNC_REALLOC_IF],
+[
+  AC_REQUIRE([AC_HEADER_STDC])dnl
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
+  AC_CHECK_HEADERS([stdlib.h])
+  AC_CACHE_CHECK([for GNU libc compatible realloc],
+    [ac_cv_func_realloc_0_nonnull],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+            # include <stdlib.h>
+            #else
+            char *realloc ();
+            #endif
+          ]],
+          [[return ! realloc (0, 0);]])
+       ],
+       [ac_cv_func_realloc_0_nonnull=yes],
+       [ac_cv_func_realloc_0_nonnull=no],
+       [case "$host_os" in
+          # Guess yes on platforms where we know the result.
+          *-gnu* | freebsd* | netbsd* | openbsd* \
+          | hpux* | solaris* | cygwin* | mingw*)
+            ac_cv_func_realloc_0_nonnull=yes ;;
+          # If we don't know, assume the worst.
+          *) ac_cv_func_realloc_0_nonnull=no ;;
+        esac
+       ])
+    ])
+  AS_IF([test $ac_cv_func_realloc_0_nonnull = yes], [$1], [$2])
+])# AC_FUNC_REALLOC
+
+])
+
 # gl_FUNC_REALLOC_GNU
 # -------------------
 # Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace
diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4
index a1f30bc..e1931e7 100644
--- a/gl/m4/setenv.m4
+++ b/gl/m4/setenv.m4
@@ -1,4 +1,4 @@
-# setenv.m4 serial 25
+# setenv.m4 serial 26
 dnl Copyright (C) 2001-2004, 2006-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN([gl_FUNC_SETENV],
 [
   AC_REQUIRE([gl_FUNC_SETENV_SEPARATE])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   if test $ac_cv_func_setenv = no; then
     HAVE_SETENV=0
   else
@@ -33,10 +34,19 @@ AC_DEFUN([gl_FUNC_SETENV],
        return result;
       ]])],
       [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no],
-      [gl_cv_func_setenv_works="guessing no"])])
-    if test "$gl_cv_func_setenv_works" != yes; then
-      REPLACE_SETENV=1
-    fi
+      [case "$host_os" in
+                 # Guess yes on glibc systems.
+         *-gnu*) gl_cv_func_setenv_works="guessing yes" ;;
+                 # If we don't know, assume the worst.
+         *)      gl_cv_func_setenv_works="guessing no" ;;
+       esac
+      ])])
+    case "$gl_cv_func_setenv_works" in
+      *yes) ;;
+      *)
+        REPLACE_SETENV=1
+        ;;
+    esac
   fi
 ])
 
@@ -56,6 +66,7 @@ AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
 AC_DEFUN([gl_FUNC_UNSETENV],
 [
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CHECK_DECLS_ONCE([unsetenv])
   if test $ac_cv_have_decl_unsetenv = no; then
     HAVE_DECL_UNSETENV=0
@@ -115,10 +126,19 @@ int unsetenv (const char *name);
        if (getenv ("a")) return 6;
       ]])],
       [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no],
-      [gl_cv_func_unsetenv_works="guessing no"])])
-    if test "$gl_cv_func_unsetenv_works" != yes; then
-      REPLACE_UNSETENV=1
-    fi
+      [case "$host_os" in
+                 # Guess yes on glibc systems.
+         *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;;
+                 # If we don't know, assume the worst.
+         *)      gl_cv_func_unsetenv_works="guessing no" ;;
+       esac
+      ])])
+    case "$gl_cv_func_unsetenv_works" in
+      *yes) ;;
+      *)
+        REPLACE_UNSETENV=1
+        ;;
+    esac
   fi
 ])
 
diff --git a/gl/m4/stat.m4 b/gl/m4/stat.m4
index d67dbcd..a8b79f5 100644
--- a/gl/m4/stat.m4
+++ b/gl/m4/stat.m4
@@ -1,4 +1,4 @@
-# serial 8
+# serial 10
 
 # Copyright (C) 2009-2012 Free Software Foundation, Inc.
 #
@@ -23,8 +23,9 @@ AC_DEFUN([gl_FUNC_STAT],
             mingw*) gl_cv_func_stat_dir_slash="guessing no";;
             *) gl_cv_func_stat_dir_slash="guessing yes";;
           esac])])
-  dnl AIX 7.1, Solaris 9 mistakenly succeed on stat("file/")
-  dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/")
+  dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/").
+  dnl (For mingw, this is due to a broken stat() override in libmingwex.a.)
+  dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/").
   AC_CACHE_CHECK([whether stat handles trailing slashes on files],
       [gl_cv_func_stat_file_slash],
       [touch conftest.tmp
@@ -46,7 +47,13 @@ AC_DEFUN([gl_FUNC_STAT],
       return result;
            ]])],
          [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
-         [gl_cv_func_stat_file_slash="guessing no"])
+         [case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_stat_file_slash="guessing no" ;;
+          esac
+         ])
        rm -f conftest.tmp conftest.lnk])
   case $gl_cv_func_stat_dir_slash in
     *no) REPLACE_STAT=1
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4
index 1973e8d..b03393b 100644
--- a/gl/m4/stdio_h.m4
+++ b/gl/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 40
+# stdio_h.m4 serial 41
 dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -18,7 +18,6 @@ AC_DEFUN([gl_STDIO_H],
   GNULIB_GETC=1
   GNULIB_GETCHAR=1
   GNULIB_FGETS=1
-  GNULIB_GETS=1
   GNULIB_FREAD=1
   dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c"
   dnl "expected source file, required through AC_LIBSOURCES, not found". It is
@@ -72,10 +71,10 @@ AC_DEFUN([gl_STDIO_H],
 
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use, and which is not
-  dnl guaranteed by C89.
+  dnl guaranteed by both C89 and C11.
   gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
-    ]], [dprintf fpurge fseeko ftello getdelim getline pclose popen renameat
-    snprintf tmpfile vdprintf vsnprintf])
+    ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen
+    renameat snprintf tmpfile vdprintf vsnprintf])
 ])
 
 AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
@@ -113,7 +112,6 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   GNULIB_GETCHAR=0;              AC_SUBST([GNULIB_GETCHAR])
   GNULIB_GETDELIM=0;             AC_SUBST([GNULIB_GETDELIM])
   GNULIB_GETLINE=0;              AC_SUBST([GNULIB_GETLINE])
-  GNULIB_GETS=0;                 AC_SUBST([GNULIB_GETS])
   GNULIB_OBSTACK_PRINTF=0;       AC_SUBST([GNULIB_OBSTACK_PRINTF])
   GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
   GNULIB_PCLOSE=0;               AC_SUBST([GNULIB_PCLOSE])
diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4
index 6bf14ef..1c96e52 100644
--- a/gl/m4/strerror.m4
+++ b/gl/m4/strerror.m4
@@ -1,4 +1,4 @@
-# strerror.m4 serial 16
+# strerror.m4 serial 17
 dnl Copyright (C) 2002, 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,6 +9,7 @@ AC_DEFUN([gl_FUNC_STRERROR],
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   AC_REQUIRE([gl_HEADER_ERRNO_H])
   AC_REQUIRE([gl_FUNC_STRERROR_0])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
     AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
   ])
@@ -22,14 +23,22 @@ AC_DEFUN([gl_FUNC_STRERROR],
            [[if (!*strerror (-2)) return 1;]])],
         [gl_cv_func_working_strerror=yes],
         [gl_cv_func_working_strerror=no],
-        [dnl Be pessimistic on cross-compiles for now.
-         gl_cv_func_working_strerror="guessing no"])
+        [case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_working_strerror="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_working_strerror="guessing no" ;;
+         esac
+        ])
     ])
-    if test "$gl_cv_func_working_strerror" != yes; then
-      dnl The system's strerror() fails to return a string for out-of-range
-      dnl integers. Replace it.
-      REPLACE_STRERROR=1
-    fi
+    case "$gl_cv_func_working_strerror" in
+      *yes) ;;
+      *)
+        dnl The system's strerror() fails to return a string for out-of-range
+        dnl integers. Replace it.
+        REPLACE_STRERROR=1
+        ;;
+    esac
     m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
       dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's
       dnl buffer, we must replace strerror.
@@ -48,6 +57,7 @@ dnl Detect if strerror(0) passes (that is, does not set 
errno, and does not
 dnl return a string that matches strerror(-1)).
 AC_DEFUN([gl_FUNC_STRERROR_0],
 [
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   REPLACE_STRERROR_0=0
   AC_CACHE_CHECK([whether strerror(0) succeeds],
    [gl_cv_func_strerror_0_works],
@@ -67,12 +77,20 @@ AC_DEFUN([gl_FUNC_STRERROR_0],
            return result;]])],
       [gl_cv_func_strerror_0_works=yes],
       [gl_cv_func_strerror_0_works=no],
-      [dnl Be pessimistic on cross-compiles for now.
-       gl_cv_func_strerror_0_works="guessing no"])
+      [case "$host_os" in
+                 # Guess yes on glibc systems.
+         *-gnu*) gl_cv_func_strerror_0_works="guessing yes" ;;
+                 # If we don't know, assume the worst.
+         *)      gl_cv_func_strerror_0_works="guessing no" ;;
+       esac
+      ])
   ])
-  if test "$gl_cv_func_strerror_0_works" != yes; then
-    REPLACE_STRERROR_0=1
-    AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0)
-      does not return a message implying success.])
-  fi
+  case "$gl_cv_func_strerror_0_works" in
+    *yes) ;;
+    *)
+      REPLACE_STRERROR_0=1
+      AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0)
+        does not return a message implying success.])
+      ;;
+  esac
 ])
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4
index a0b96bc..f45dee1 100644
--- a/gl/m4/sys_stat_h.m4
+++ b/gl/m4/sys_stat_h.m4
@@ -1,4 +1,4 @@
-# sys_stat_h.m4 serial 26   -*- Autoconf -*-
+# sys_stat_h.m4 serial 27   -*- Autoconf -*-
 dnl Copyright (C) 2006-2012 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,6 +22,19 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
   dnl Ensure the type mode_t gets defined.
   AC_REQUIRE([AC_TYPE_MODE_T])
 
+  dnl Whether to override 'struct stat'.
+  m4_ifdef([gl_LARGEFILE], [
+    AC_REQUIRE([gl_LARGEFILE])
+  ], [
+    WINDOWS_64_BIT_ST_SIZE=0
+  ])
+  AC_SUBST([WINDOWS_64_BIT_ST_SIZE])
+  if test $WINDOWS_64_BIT_ST_SIZE = 1; then
+    AC_DEFINE([_GL_WINDOWS_64_BIT_ST_SIZE], [1],
+      [Define to 1 if Gnulib overrides 'struct stat' on Windows so that
+       struct stat.st_size becomes 64-bit.])
+  fi
+
   dnl Define types that are supposed to be defined in <sys/types.h> or
   dnl <sys/stat.h>.
   AC_CHECK_TYPE([nlink_t], [],
diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4
index 8d18ddb..f11eef2 100644
--- a/gl/m4/sys_types_h.m4
+++ b/gl/m4/sys_types_h.m4
@@ -1,4 +1,4 @@
-# sys_types_h.m4 serial 2
+# sys_types_h.m4 serial 4
 dnl Copyright (C) 2011-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,6 +14,9 @@ AC_DEFUN([gl_SYS_TYPES_H],
 
   dnl Ensure the type mode_t gets defined.
   AC_REQUIRE([AC_TYPE_MODE_T])
+
+  dnl Whether to override the 'off_t' type.
+  AC_REQUIRE([gl_TYPE_OFF_T])
 ])
 
 AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS],
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index 7595534..7e7651b 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 63
+# unistd_h.m4 serial 65
 dnl Copyright (C) 2006-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -24,6 +24,9 @@ AC_DEFUN([gl_UNISTD_H],
   dnl Ensure the type pid_t gets defined.
   AC_REQUIRE([AC_TYPE_PID_T])
 
+  dnl Determine WINDOWS_64_BIT_OFF_T.
+  AC_REQUIRE([gl_TYPE_OFF_T])
+
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[
@@ -155,6 +158,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_DUP=0;          AC_SUBST([REPLACE_DUP])
   REPLACE_DUP2=0;         AC_SUBST([REPLACE_DUP2])
   REPLACE_FCHOWNAT=0;     AC_SUBST([REPLACE_FCHOWNAT])
+  REPLACE_FTRUNCATE=0;    AC_SUBST([REPLACE_FTRUNCATE])
   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
   REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
   REPLACE_GETLOGIN_R=0;   AC_SUBST([REPLACE_GETLOGIN_R])
diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4
index 03b113c..a77802e 100644
--- a/gl/m4/warn-on-use.m4
+++ b/gl/m4/warn-on-use.m4
@@ -1,4 +1,4 @@
-# warn-on-use.m4 serial 4
+# warn-on-use.m4 serial 5
 dnl Copyright (C) 2010-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -18,8 +18,8 @@ dnl with or without modifications, as long as this notice is 
preserved.
 # some systems declare functions in the wrong header, then INCLUDES
 # should do likewise.
 #
-# If you assume C89, then it is generally safe to assume declarations
-# for functions declared in that standard (such as gets) without
+# It is generally safe to assume declarations for functions declared
+# in the intersection of C89 and C11 (such as printf) without
 # needing gl_WARN_ON_USE_PREPARE.
 AC_DEFUN([gl_WARN_ON_USE_PREPARE],
 [
diff --git a/gl/m4/warnings.m4 b/gl/m4/warnings.m4
index 69d05a6..28b8294 100644
--- a/gl/m4/warnings.m4
+++ b/gl/m4/warnings.m4
@@ -1,4 +1,4 @@
-# warnings.m4 serial 5
+# warnings.m4 serial 7
 dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,24 +14,48 @@ m4_ifdef([AS_VAR_APPEND],
 [m4_define([gl_AS_VAR_APPEND],
 [AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
 
-# gl_WARN_ADD(PARAMETER, [VARIABLE = WARN_CFLAGS])
-# ------------------------------------------------
-# Adds parameter to WARN_CFLAGS if the compiler supports it.  For example,
-# gl_WARN_ADD([-Wparentheses]).
-AC_DEFUN([gl_WARN_ADD],
-dnl FIXME: gl_Warn must be used unquoted until we can assume
-dnl autoconf 2.64 or newer.
-[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl
-AC_CACHE_CHECK([whether compiler handles $1], m4_defn([gl_Warn]), [
-  gl_save_CPPFLAGS="$CPPFLAGS"
-  CPPFLAGS="${CPPFLAGS} $1"
-  AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
+
+# gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED],
+#                       [PROGRAM = AC_LANG_PROGRAM()])
+# -----------------------------------------------------------------
+# Check if the compiler supports OPTION when compiling PROGRAM.
+#
+# FIXME: gl_Warn must be used unquoted until we can assume Autoconf
+# 2.64 or newer.
+AC_DEFUN([gl_COMPILER_OPTION_IF],
+[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
+AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [
+  gl_save_compiler_FLAGS="$gl_Flags"
+  gl_AS_VAR_APPEND(m4_defn([gl_Flags]), [" $1"])
+  AC_COMPILE_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])],
                     [AS_VAR_SET(gl_Warn, [yes])],
                     [AS_VAR_SET(gl_Warn, [no])])
-  CPPFLAGS="$gl_save_CPPFLAGS"
+  gl_Flags="$gl_save_compiler_FLAGS"
 ])
-AS_VAR_IF(gl_Warn, [yes],
-  [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])])
+AS_VAR_IF(gl_Warn, [yes], [$2], [$3])
+AS_VAR_POPDEF([gl_Flags])dnl
 AS_VAR_POPDEF([gl_Warn])dnl
-m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
 ])
+
+
+# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS],
+#             [PROGRAM = AC_LANG_PROGRAM()])
+# ---------------------------------------------
+# Adds parameter to WARN_CFLAGS if the compiler supports it when
+# compiling PROGRAM.  For example, gl_WARN_ADD([-Wparentheses]).
+#
+# If VARIABLE is a variable name, AC_SUBST it.
+AC_DEFUN([gl_WARN_ADD],
+[gl_COMPILER_OPTION_IF([$1],
+  [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])],
+  [],
+  [$3])
+m4_ifval([$2],
+         [AS_LITERAL_IF([$2], [AC_SUBST([$2])])],
+         [AC_SUBST([WARN_CFLAGS])])dnl
+])
+
+# Local Variables:
+# mode: autoconf
+# End:
diff --git a/gl/malloc.c b/gl/malloc.c
index ffe042b..e0d5c89 100644
--- a/gl/malloc.c
+++ b/gl/malloc.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* written by Jim Meyering and Bruno Haible */
 
diff --git a/gl/malloca.c b/gl/malloca.c
index 009ca0c..1f7533a 100644
--- a/gl/malloca.c
+++ b/gl/malloca.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #define _GL_USE_STDLIB_ALLOC 1
 #include <config.h>
diff --git a/gl/malloca.h b/gl/malloca.h
index 725cc22..0cedf5f 100644
--- a/gl/malloca.h
+++ b/gl/malloca.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _MALLOCA_H
 #define _MALLOCA_H
diff --git a/gl/md4.c b/gl/md4.c
index f0d7737..2340048 100644
--- a/gl/md4.c
+++ b/gl/md4.c
@@ -14,8 +14,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Adapted by Simon Josefsson from gnulib md5.? and Libgcrypt
    cipher/md4.c . */
@@ -302,13 +301,13 @@ md4_process_block (const void *buffer, size_t len, struct 
md4_ctx *ctx)
   uint32_t B = ctx->B;
   uint32_t C = ctx->C;
   uint32_t D = ctx->D;
+  uint32_t lolen = len;
 
   /* First increment the byte count.  RFC 1320 specifies the possible
      length of the file up to 2^64 bits.  Here we only compute the
      number of bytes.  Do a double word increment.  */
-  ctx->total[0] += len;
-  if (ctx->total[0] < len)
-    ++ctx->total[1];
+  ctx->total[0] += lolen;
+  ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
 
   /* Process all bytes in the buffer with 64 bytes in each round of
      the loop.  */
diff --git a/gl/md4.h b/gl/md4.h
index ebda5a7..b53c237 100644
--- a/gl/md4.h
+++ b/gl/md4.h
@@ -14,8 +14,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef MD4_H
 # define MD4_H 1
diff --git a/gl/md5.c b/gl/md5.c
index 815bed3..30b7e50 100644
--- a/gl/md5.c
+++ b/gl/md5.c
@@ -15,8 +15,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Ulrich Drepper <address@hidden>, 1995.  */
 
@@ -313,13 +312,13 @@ md5_process_block (const void *buffer, size_t len, struct 
md5_ctx *ctx)
   uint32_t B = ctx->B;
   uint32_t C = ctx->C;
   uint32_t D = ctx->D;
+  uint32_t lolen = len;
 
   /* First increment the byte count.  RFC 1321 specifies the possible
      length of the file up to 2^64 bits.  Here we only compute the
      number of bytes.  Do a double word increment.  */
-  ctx->total[0] += len;
-  if (ctx->total[0] < len)
-    ++ctx->total[1];
+  ctx->total[0] += lolen;
+  ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
 
   /* Process all bytes in the buffer with 64 bytes in each round of
      the loop.  */
diff --git a/gl/md5.h b/gl/md5.h
index 3e9a626..75d6bce 100644
--- a/gl/md5.h
+++ b/gl/md5.h
@@ -15,8 +15,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _MD5_H
 #define _MD5_H 1
diff --git a/gl/memxor.c b/gl/memxor.c
index c467c3e..8e1ab36 100644
--- a/gl/memxor.c
+++ b/gl/memxor.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Simon Josefsson.  The interface was inspired by memxor
    in Niels Möller's Nettle. */
diff --git a/gl/memxor.h b/gl/memxor.h
index 3bc0c6c..731ac36 100644
--- a/gl/memxor.h
+++ b/gl/memxor.h
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Simon Josefsson.  The interface was inspired by memxor
    in Niels Möller's Nettle. */
diff --git a/gl/minmax.h b/gl/minmax.h
index 7f581c7..75a9b3c 100644
--- a/gl/minmax.h
+++ b/gl/minmax.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _MINMAX_H
 #define _MINMAX_H
diff --git a/gl/mktime.c b/gl/mktime.c
index a61b2f6..952c829 100644
--- a/gl/mktime.c
+++ b/gl/mktime.c
@@ -1,21 +1,21 @@
 /* Convert a 'struct tm' to a time_t value.
-   Copyright (C) 1993-1999, 2002-2007, 2009-2012 Free Software Foundation, Inc.
+   Copyright (C) 1993-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Paul Eggert <address@hidden>.
 
-   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.
+   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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+   You should have received a copy of the GNU General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 /* Define this to have a standalone program to test this implementation of
    mktime.  */
@@ -36,7 +36,7 @@
 
 #include <limits.h>
 
-#include <string.h>             /* For the real memcpy prototype.  */
+#include <string.h>            /* For the real memcpy prototype.  */
 
 #if DEBUG
 # include <stdio.h>
@@ -53,12 +53,14 @@
 
    Define WRAPV to 1 if the assumption is valid and if
      #pragma GCC optimize ("wrapv")
-   does not trigger GCC bug 
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51793>.
+   does not trigger GCC bug 51793
+   <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51793>.
    Otherwise, define it to 0; this forces the use of slower code that,
    while not guaranteed by the C Standard, works on all production
    platforms that we know about.  */
 #ifndef WRAPV
-# if ((__GNUC__ == 4 && 4 <= __GNUC_MINOR__) || 4 < __GNUC__) && defined 
__GLIBC__
+# if (((__GNUC__ == 4 && 4 <= __GNUC_MINOR__) || 4 < __GNUC__) \
+      && defined __GLIBC__)
 #  pragma GCC optimize ("wrapv")
 #  define WRAPV 1
 # else
@@ -114,12 +116,12 @@ verify (long_int_is_wide_enough, INT_MAX == INT_MAX * 
(long_int) 2 / 2);
    your host.  */
 #define TYPE_MINIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-        ? (t) 0 \
-        : ~ TYPE_MAXIMUM (t)))
+       ? (t) 0 \
+       : ~ TYPE_MAXIMUM (t)))
 #define TYPE_MAXIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-        ? (t) -1 \
-        : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
+       ? (t) -1 \
+       : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
 
 #ifndef TIME_T_MIN
 # define TIME_T_MIN TYPE_MINIMUM (time_t)
@@ -131,9 +133,9 @@ verify (long_int_is_wide_enough, INT_MAX == INT_MAX * 
(long_int) 2 / 2);
 
 verify (time_t_is_integer, TYPE_IS_INTEGER (time_t));
 verify (twos_complement_arithmetic,
-        (TYPE_TWOS_COMPLEMENT (int)
-         && TYPE_TWOS_COMPLEMENT (long_int)
-         && TYPE_TWOS_COMPLEMENT (time_t)));
+       (TYPE_TWOS_COMPLEMENT (int)
+        && TYPE_TWOS_COMPLEMENT (long_int)
+        && TYPE_TWOS_COMPLEMENT (time_t)));
 
 #define EPOCH_YEAR 1970
 #define TM_YEAR_BASE 1900
@@ -148,7 +150,7 @@ leapyear (long_int year)
   return
     ((year & 3) == 0
      && (year % 100 != 0
-         || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
+        || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
 }
 
 /* How many days come before each month (0-12).  */
@@ -180,7 +182,7 @@ const unsigned short int __mon_yday[2][13] =
 static int
 isdst_differ (int a, int b)
 {
-  return (!a != !b) & (0 <= a) & (0 <= b);
+  return (!a != !b) && (0 <= a) && (0 <= b);
 }
 
 /* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) -
@@ -196,7 +198,7 @@ isdst_differ (int a, int b)
 
 static inline time_t
 ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1,
-            int year0, int yday0, int hour0, int min0, int sec0)
+           int year0, int yday0, int hour0, int min0, int sec0)
 {
   verify (C99_integer_division, -1 / 2 == 0);
 
@@ -277,15 +279,15 @@ time_t_int_add_ok (time_t a, int b)
    yield a value equal to *T.  */
 static time_t
 guess_time_tm (long_int year, long_int yday, int hour, int min, int sec,
-               const time_t *t, const struct tm *tp)
+              const time_t *t, const struct tm *tp)
 {
   if (tp)
     {
       time_t d = ydhms_diff (year, yday, hour, min, sec,
-                             tp->tm_year, tp->tm_yday,
-                             tp->tm_hour, tp->tm_min, tp->tm_sec);
+                            tp->tm_year, tp->tm_yday,
+                            tp->tm_hour, tp->tm_min, tp->tm_sec);
       if (time_t_add_ok (*t, d))
-        return *t + d;
+       return *t + d;
     }
 
   /* Overflow occurred one way or another.  Return the nearest result
@@ -294,8 +296,8 @@ guess_time_tm (long_int year, long_int yday, int hour, int 
min, int sec,
      match; and don't oscillate between two values, as that would
      confuse the spring-forward gap detector.  */
   return (*t < TIME_T_MIDPOINT
-          ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN)
-          : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX));
+         ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN)
+         : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX));
 }
 
 /* Use CONVERT to convert *T to a broken down time in *TP.
@@ -303,7 +305,7 @@ guess_time_tm (long_int year, long_int yday, int hour, int 
min, int sec,
    it is the nearest in-range value and then convert that.  */
 static struct tm *
 ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
-                time_t *t, struct tm *tp)
+               time_t *t, struct tm *tp)
 {
   struct tm *r = convert (t, tp);
 
@@ -313,25 +315,25 @@ ranged_convert (struct tm *(*convert) (const time_t *, 
struct tm *),
       time_t ok = 0;
 
       /* BAD is a known unconvertible time_t, and OK is a known good one.
-         Use binary search to narrow the range between BAD and OK until
-         they differ by 1.  */
+        Use binary search to narrow the range between BAD and OK until
+        they differ by 1.  */
       while (bad != ok + (bad < 0 ? -1 : 1))
-        {
-          time_t mid = *t = time_t_avg (ok, bad);
-          r = convert (t, tp);
-          if (r)
-            ok = mid;
-          else
-            bad = mid;
-        }
+       {
+         time_t mid = *t = time_t_avg (ok, bad);
+         r = convert (t, tp);
+         if (r)
+           ok = mid;
+         else
+           bad = mid;
+       }
 
       if (!r && ok)
-        {
-          /* The last conversion attempt failed;
-             revert to the most recent successful attempt.  */
-          *t = ok;
-          r = convert (t, tp);
-        }
+       {
+         /* The last conversion attempt failed;
+            revert to the most recent successful attempt.  */
+         *t = ok;
+         r = convert (t, tp);
+       }
     }
 
   return r;
@@ -346,8 +348,8 @@ ranged_convert (struct tm *(*convert) (const time_t *, 
struct tm *),
    This function is external because it is used also by timegm.c.  */
 time_t
 __mktime_internal (struct tm *tp,
-                   struct tm *(*convert) (const time_t *, struct tm *),
-                   time_t *offset)
+                  struct tm *(*convert) (const time_t *, struct tm *),
+                  time_t *offset)
 {
   time_t t, gt, t0, t1, t2;
   struct tm tm;
@@ -386,8 +388,8 @@ __mktime_internal (struct tm *tp,
   /* Calculate day of year from year, month, and day of month.
      The result need not be in range.  */
   int mon_yday = ((__mon_yday[leapyear (year)]
-                   [mon_remainder + 12 * negative_mon_remainder])
-                  - 1);
+                  [mon_remainder + 12 * negative_mon_remainder])
+                 - 1);
   long_int lmday = mday;
   long_int yday = mon_yday + lmday;
 
@@ -398,33 +400,33 @@ __mktime_internal (struct tm *tp,
   if (LEAP_SECONDS_POSSIBLE)
     {
       /* Handle out-of-range seconds specially,
-         since ydhms_tm_diff assumes every minute has 60 seconds.  */
+        since ydhms_tm_diff assumes every minute has 60 seconds.  */
       if (sec < 0)
-        sec = 0;
+       sec = 0;
       if (59 < sec)
-        sec = 59;
+       sec = 59;
     }
 
   /* Invert CONVERT by probing.  First assume the same offset as last
      time.  */
 
   t0 = ydhms_diff (year, yday, hour, min, sec,
-                   EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, - guessed_offset);
+                  EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, - guessed_offset);
 
   if (TIME_T_MAX / INT_MAX / 366 / 24 / 60 / 60 < 3)
     {
       /* time_t isn't large enough to rule out overflows, so check
-         for major overflows.  A gross check suffices, since if t0
-         has overflowed, it is off by a multiple of TIME_T_MAX -
-         TIME_T_MIN + 1.  So ignore any component of the difference
-         that is bounded by a small value.  */
+        for major overflows.  A gross check suffices, since if t0
+        has overflowed, it is off by a multiple of TIME_T_MAX -
+        TIME_T_MIN + 1.  So ignore any component of the difference
+        that is bounded by a small value.  */
 
       /* Approximate log base 2 of the number of time units per
-         biennium.  A biennium is 2 years; use this unit instead of
-         years to avoid integer overflow.  For example, 2 average
-         Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds,
-         which is 63113904 seconds, and rint (log2 (63113904)) is
-         26.  */
+        biennium.  A biennium is 2 years; use this unit instead of
+        years to avoid integer overflow.  For example, 2 average
+        Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds,
+        which is 63113904 seconds, and rint (log2 (63113904)) is
+        26.  */
       int ALOG2_SECONDS_PER_BIENNIUM = 26;
       int ALOG2_MINUTES_PER_BIENNIUM = 20;
       int ALOG2_HOURS_PER_BIENNIUM = 14;
@@ -432,64 +434,64 @@ __mktime_internal (struct tm *tp,
       int LOG2_YEARS_PER_BIENNIUM = 1;
 
       int approx_requested_biennia =
-        (SHR (year_requested, LOG2_YEARS_PER_BIENNIUM)
-         - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM)
-         + SHR (mday, ALOG2_DAYS_PER_BIENNIUM)
-         + SHR (hour, ALOG2_HOURS_PER_BIENNIUM)
-         + SHR (min, ALOG2_MINUTES_PER_BIENNIUM)
-         + (LEAP_SECONDS_POSSIBLE
-            ? 0
-            : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM)));
+       (SHR (year_requested, LOG2_YEARS_PER_BIENNIUM)
+        - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM)
+        + SHR (mday, ALOG2_DAYS_PER_BIENNIUM)
+        + SHR (hour, ALOG2_HOURS_PER_BIENNIUM)
+        + SHR (min, ALOG2_MINUTES_PER_BIENNIUM)
+        + (LEAP_SECONDS_POSSIBLE
+           ? 0
+           : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM)));
 
       int approx_biennia = SHR (t0, ALOG2_SECONDS_PER_BIENNIUM);
       int diff = approx_biennia - approx_requested_biennia;
-      int abs_diff = diff < 0 ? -1 - diff : diff;
+      int approx_abs_diff = diff < 0 ? -1 - diff : diff;
 
       /* IRIX 4.0.5 cc miscalculates TIME_T_MIN / 3: it erroneously
-         gives a positive value of 715827882.  Setting a variable
-         first then doing math on it seems to work.
-         (address@hidden) */
+        gives a positive value of 715827882.  Setting a variable
+        first then doing math on it seems to work.
+        (address@hidden) */
       time_t time_t_max = TIME_T_MAX;
       time_t time_t_min = TIME_T_MIN;
       time_t overflow_threshold =
-        (time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM;
-
-      if (overflow_threshold < abs_diff)
-        {
-          /* Overflow occurred.  Try repairing it; this might work if
-             the time zone offset is enough to undo the overflow.  */
-          time_t repaired_t0 = -1 - t0;
-          approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM);
-          diff = approx_biennia - approx_requested_biennia;
-          abs_diff = diff < 0 ? -1 - diff : diff;
-          if (overflow_threshold < abs_diff)
-            return -1;
-          guessed_offset += repaired_t0 - t0;
-          t0 = repaired_t0;
-        }
+       (time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM;
+
+      if (overflow_threshold < approx_abs_diff)
+       {
+         /* Overflow occurred.  Try repairing it; this might work if
+            the time zone offset is enough to undo the overflow.  */
+         time_t repaired_t0 = -1 - t0;
+         approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM);
+         diff = approx_biennia - approx_requested_biennia;
+         approx_abs_diff = diff < 0 ? -1 - diff : diff;
+         if (overflow_threshold < approx_abs_diff)
+           return -1;
+         guessed_offset += repaired_t0 - t0;
+         t0 = repaired_t0;
+       }
     }
 
   /* Repeatedly use the error to improve the guess.  */
 
   for (t = t1 = t2 = t0, dst2 = 0;
        (gt = guess_time_tm (year, yday, hour, min, sec, &t,
-                            ranged_convert (convert, &t, &tm)),
-        t != gt);
+                           ranged_convert (convert, &t, &tm)),
+       t != gt);
        t1 = t2, t2 = t, t = gt, dst2 = tm.tm_isdst != 0)
     if (t == t1 && t != t2
-        && (tm.tm_isdst < 0
-            || (isdst < 0
-                ? dst2 <= (tm.tm_isdst != 0)
-                : (isdst != 0) != (tm.tm_isdst != 0))))
+       && (tm.tm_isdst < 0
+           || (isdst < 0
+               ? dst2 <= (tm.tm_isdst != 0)
+               : (isdst != 0) != (tm.tm_isdst != 0))))
       /* We can't possibly find a match, as we are oscillating
-         between two values.  The requested time probably falls
-         within a spring-forward gap of size GT - T.  Follow the common
-         practice in this case, which is to return a time that is GT - T
-         away from the requested time, preferring a time whose
-         tm_isdst differs from the requested value.  (If no tm_isdst
-         was requested and only one of the two values has a nonzero
-         tm_isdst, prefer that value.)  In practice, this is more
-         useful than returning -1.  */
+        between two values.  The requested time probably falls
+        within a spring-forward gap of size GT - T.  Follow the common
+        practice in this case, which is to return a time that is GT - T
+        away from the requested time, preferring a time whose
+        tm_isdst differs from the requested value.  (If no tm_isdst
+        was requested and only one of the two values has a nonzero
+        tm_isdst, prefer that value.)  In practice, this is more
+        useful than returning -1.  */
       goto offset_found;
     else if (--remaining_probes == 0)
       return -1;
@@ -499,50 +501,50 @@ __mktime_internal (struct tm *tp,
   if (isdst_differ (isdst, tm.tm_isdst))
     {
       /* tm.tm_isdst has the wrong value.  Look for a neighboring
-         time with the right value, and use its UTC offset.
+        time with the right value, and use its UTC offset.
 
-         Heuristic: probe the adjacent timestamps in both directions,
-         looking for the desired isdst.  This should work for all real
-         time zone histories in the tz database.  */
+        Heuristic: probe the adjacent timestamps in both directions,
+        looking for the desired isdst.  This should work for all real
+        time zone histories in the tz database.  */
 
       /* Distance between probes when looking for a DST boundary.  In
-         tzdata2003a, the shortest period of DST is 601200 seconds
-         (e.g., America/Recife starting 2000-10-08 01:00), and the
-         shortest period of non-DST surrounded by DST is 694800
-         seconds (Africa/Tunis starting 1943-04-17 01:00).  Use the
-         minimum of these two values, so we don't miss these short
-         periods when probing.  */
+        tzdata2003a, the shortest period of DST is 601200 seconds
+        (e.g., America/Recife starting 2000-10-08 01:00), and the
+        shortest period of non-DST surrounded by DST is 694800
+        seconds (Africa/Tunis starting 1943-04-17 01:00).  Use the
+        minimum of these two values, so we don't miss these short
+        periods when probing.  */
       int stride = 601200;
 
       /* The longest period of DST in tzdata2003a is 536454000 seconds
-         (e.g., America/Jujuy starting 1946-10-01 01:00).  The longest
-         period of non-DST is much longer, but it makes no real sense
-         to search for more than a year of non-DST, so use the DST
-         max.  */
+        (e.g., America/Jujuy starting 1946-10-01 01:00).  The longest
+        period of non-DST is much longer, but it makes no real sense
+        to search for more than a year of non-DST, so use the DST
+        max.  */
       int duration_max = 536454000;
 
       /* Search in both directions, so the maximum distance is half
-         the duration; add the stride to avoid off-by-1 problems.  */
+        the duration; add the stride to avoid off-by-1 problems.  */
       int delta_bound = duration_max / 2 + stride;
 
       int delta, direction;
 
       for (delta = stride; delta < delta_bound; delta += stride)
-        for (direction = -1; direction <= 1; direction += 2)
-          if (time_t_int_add_ok (t, delta * direction))
-            {
-              time_t ot = t + delta * direction;
-              struct tm otm;
-              ranged_convert (convert, &ot, &otm);
-              if (! isdst_differ (isdst, otm.tm_isdst))
-                {
-                  /* We found the desired tm_isdst.
-                     Extrapolate back to the desired time.  */
-                  t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm);
-                  ranged_convert (convert, &t, &tm);
-                  goto offset_found;
-                }
-            }
+       for (direction = -1; direction <= 1; direction += 2)
+         if (time_t_int_add_ok (t, delta * direction))
+           {
+             time_t ot = t + delta * direction;
+             struct tm otm;
+             ranged_convert (convert, &ot, &otm);
+             if (! isdst_differ (isdst, otm.tm_isdst))
+               {
+                 /* We found the desired tm_isdst.
+                    Extrapolate back to the desired time.  */
+                 t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm);
+                 ranged_convert (convert, &t, &tm);
+                 goto offset_found;
+               }
+           }
     }
 
  offset_found:
@@ -551,16 +553,16 @@ __mktime_internal (struct tm *tp,
   if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec)
     {
       /* Adjust time to reflect the tm_sec requested, not the normalized value.
-         Also, repair any damage from a false match due to a leap second.  */
+        Also, repair any damage from a false match due to a leap second.  */
       int sec_adjustment = (sec == 0 && tm.tm_sec == 60) - sec;
       if (! time_t_int_add_ok (t, sec_requested))
-        return -1;
+       return -1;
       t1 = t + sec_requested;
       if (! time_t_int_add_ok (t1, sec_adjustment))
-        return -1;
+       return -1;
       t2 = t1 + sec_adjustment;
       if (! convert (&t2, &tm))
-        return -1;
+       return -1;
       t = t2;
     }
 
@@ -604,13 +606,13 @@ static int
 not_equal_tm (const struct tm *a, const struct tm *b)
 {
   return ((a->tm_sec ^ b->tm_sec)
-          | (a->tm_min ^ b->tm_min)
-          | (a->tm_hour ^ b->tm_hour)
-          | (a->tm_mday ^ b->tm_mday)
-          | (a->tm_mon ^ b->tm_mon)
-          | (a->tm_year ^ b->tm_year)
-          | (a->tm_yday ^ b->tm_yday)
-          | isdst_differ (a->tm_isdst, b->tm_isdst));
+         | (a->tm_min ^ b->tm_min)
+         | (a->tm_hour ^ b->tm_hour)
+         | (a->tm_mday ^ b->tm_mday)
+         | (a->tm_mon ^ b->tm_mon)
+         | (a->tm_year ^ b->tm_year)
+         | (a->tm_yday ^ b->tm_yday)
+         | isdst_differ (a->tm_isdst, b->tm_isdst));
 }
 
 static void
@@ -618,9 +620,9 @@ print_tm (const struct tm *tp)
 {
   if (tp)
     printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
-            tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
-            tp->tm_hour, tp->tm_min, tp->tm_sec,
-            tp->tm_yday, tp->tm_wday, tp->tm_isdst);
+           tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
+           tp->tm_hour, tp->tm_min, tp->tm_sec,
+           tp->tm_yday, tp->tm_wday, tp->tm_isdst);
   else
     printf ("0");
 }
@@ -652,11 +654,11 @@ main (int argc, char **argv)
 
   if ((argc == 3 || argc == 4)
       && (sscanf (argv[1], "%d-%d-%d%c",
-                  &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
-          == 3)
+                 &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
+         == 3)
       && (sscanf (argv[2], "%d:%d:%d%c",
-                  &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
-          == 3))
+                 &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
+         == 3))
     {
       tm.tm_year -= TM_YEAR_BASE;
       tm.tm_mon--;
@@ -665,10 +667,10 @@ main (int argc, char **argv)
       tl = mktime (&tmk);
       lt = localtime (&tl);
       if (lt)
-        {
-          tml = *lt;
-          lt = &tml;
-        }
+       {
+         tml = *lt;
+         lt = &tml;
+       }
       printf ("mktime returns %ld == ", (long int) tl);
       print_tm (&tmk);
       printf ("\n");
@@ -681,51 +683,51 @@ main (int argc, char **argv)
       time_t to = atol (argv[3]);
 
       if (argc == 4)
-        for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
-          {
-            lt = localtime (&tl);
-            if (lt)
-              {
-                tmk = tml = *lt;
-                tk = mktime (&tmk);
-                status |= check_result (tk, tmk, tl, &tml);
-              }
-            else
-              {
-                printf ("localtime (%ld) yields 0\n", (long int) tl);
-                status = 1;
-              }
-            tl1 = tl + by;
-            if ((tl1 < tl) != (by < 0))
-              break;
-          }
+       for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
+         {
+           lt = localtime (&tl);
+           if (lt)
+             {
+               tmk = tml = *lt;
+               tk = mktime (&tmk);
+               status |= check_result (tk, tmk, tl, &tml);
+             }
+           else
+             {
+               printf ("localtime (%ld) yields 0\n", (long int) tl);
+               status = 1;
+             }
+           tl1 = tl + by;
+           if ((tl1 < tl) != (by < 0))
+             break;
+         }
       else
-        for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
-          {
-            /* Null benchmark.  */
-            lt = localtime (&tl);
-            if (lt)
-              {
-                tmk = tml = *lt;
-                tk = tl;
-                status |= check_result (tk, tmk, tl, &tml);
-              }
-            else
-              {
-                printf ("localtime (%ld) yields 0\n", (long int) tl);
-                status = 1;
-              }
-            tl1 = tl + by;
-            if ((tl1 < tl) != (by < 0))
-              break;
-          }
+       for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
+         {
+           /* Null benchmark.  */
+           lt = localtime (&tl);
+           if (lt)
+             {
+               tmk = tml = *lt;
+               tk = tl;
+               status |= check_result (tk, tmk, tl, &tml);
+             }
+           else
+             {
+               printf ("localtime (%ld) yields 0\n", (long int) tl);
+               status = 1;
+             }
+           tl1 = tl + by;
+           if ((tl1 < tl) != (by < 0))
+             break;
+         }
     }
   else
     printf ("Usage:\
 \t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\
 \t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\
 \t%s FROM BY TO - # Do not test those values (for benchmark).\n",
-            argv[0], argv[0], argv[0]);
+           argv[0], argv[0], argv[0]);
 
   return status;
 }
diff --git a/gl/msvc-inval.c b/gl/msvc-inval.c
index b7a917d..ba76a7e 100644
--- a/gl/msvc-inval.c
+++ b/gl/msvc-inval.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/msvc-inval.h b/gl/msvc-inval.h
index 373f9bf..eb6930b 100644
--- a/gl/msvc-inval.h
+++ b/gl/msvc-inval.h
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _MSVC_INVAL_H
 #define _MSVC_INVAL_H
diff --git a/gl/msvc-nothrow.c b/gl/msvc-nothrow.c
index f0fea17..e5cf181 100644
--- a/gl/msvc-nothrow.c
+++ b/gl/msvc-nothrow.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/msvc-nothrow.h b/gl/msvc-nothrow.h
index e066b24..2b71945 100644
--- a/gl/msvc-nothrow.h
+++ b/gl/msvc-nothrow.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _MSVC_NOTHROW_H
 #define _MSVC_NOTHROW_H
diff --git a/gl/netdb.in.h b/gl/netdb.in.h
index ddc97b9..e4366f8 100644
--- a/gl/netdb.in.h
+++ b/gl/netdb.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* This file is supposed to be used on platforms that lack <netdb.h>.
    It is intended to provide definitions and prototypes needed by an
diff --git a/gl/netinet_in.in.h b/gl/netinet_in.in.h
index e06dfe0..99b4936 100644
--- a/gl/netinet_in.in.h
+++ b/gl/netinet_in.in.h
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef address@hidden@_NETINET_IN_H
 
diff --git a/gl/pathmax.h b/gl/pathmax.h
index 0fd9296..03db7cb 100644
--- a/gl/pathmax.h
+++ b/gl/pathmax.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _PATHMAX_H
 # define _PATHMAX_H
diff --git a/gl/printf-args.c b/gl/printf-args.c
index 979435f..47b20dc 100644
--- a/gl/printf-args.c
+++ b/gl/printf-args.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* This file can be parametrized with the following macros:
      ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
diff --git a/gl/printf-args.h b/gl/printf-args.h
index 39ec7f4..aa811af 100644
--- a/gl/printf-args.h
+++ b/gl/printf-args.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _PRINTF_ARGS_H
 #define _PRINTF_ARGS_H
diff --git a/gl/printf-parse.c b/gl/printf-parse.c
index d2a58a1..308a175 100644
--- a/gl/printf-parse.c
+++ b/gl/printf-parse.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* This file can be parametrized with the following macros:
      CHAR_T             The element type of the format string.
diff --git a/gl/printf-parse.h b/gl/printf-parse.h
index 3830f3c..577099a 100644
--- a/gl/printf-parse.h
+++ b/gl/printf-parse.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _PRINTF_PARSE_H
 #define _PRINTF_PARSE_H
diff --git a/gl/read-file.c b/gl/read-file.c
index 72ab4e8..0d5ab8b 100644
--- a/gl/read-file.c
+++ b/gl/read-file.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/read-file.h b/gl/read-file.h
index b45b76d..a1142b8 100644
--- a/gl/read-file.h
+++ b/gl/read-file.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef READ_FILE_H
 #define READ_FILE_H
diff --git a/gl/select.c b/gl/select.c
index 0c821dd..d6acb5c 100644
--- a/gl/select.c
+++ b/gl/select.c
@@ -16,8 +16,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <alloca.h>
@@ -386,6 +385,10 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
         }
     }
 
+  /* Place a sentinel at the end of the array.  */
+  handle_array[nhandles] = NULL;
+
+restart:
   if (wait_timeout == 0 || nsock == 0)
     rc = 0;
   else
@@ -428,13 +431,44 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
   if (rc == 0 && nsock > 0)
     rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0);
 
+  if (nhandles > 1)
+    {
+      /* Count results that are not counted in the return value of select.  */
+      nhandles = 1;
+      for (i = 0; i < nfds; i++)
+        {
+          if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
+            continue;
+
+          h = (HANDLE) _get_osfhandle (i);
+          if (h == handle_array[nhandles])
+            {
+              /* Not a socket.  */
+              nhandles++;
+              windows_poll_handle (h, i, &rbits, &wbits, &xbits);
+              if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))
+                  || wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))
+                  || xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
+                rc++;
+            }
+        }
+
+      if (rc == 0 && wait_timeout == INFINITE)
+        {
+          /* Sleep 1 millisecond to avoid busy wait and retry with the
+             original fd_sets.  */
+          memcpy (&handle_rfds, rfds, sizeof (fd_set));
+          memcpy (&handle_wfds, wfds, sizeof (fd_set));
+          memcpy (&handle_xfds, xfds, sizeof (fd_set));
+          SleepEx (1, TRUE);
+          goto restart;
+        }
+    }
+
   /* Now fill in the results.  */
   FD_ZERO (rfds);
   FD_ZERO (wfds);
   FD_ZERO (xfds);
-
-  /* Place a sentinel at the end of the array.  */
-  handle_array[nhandles] = NULL;
   nhandles = 1;
   for (i = 0; i < nfds; i++)
     {
@@ -444,8 +478,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
       h = (HANDLE) _get_osfhandle (i);
       if (h != handle_array[nhandles])
         {
-          /* Perform handle->descriptor mapping.  Don't update rc, as these
-             results are counted in the return value of Winsock's select.  */
+          /* Perform handle->descriptor mapping.  */
           WSAEventSelect ((SOCKET) h, NULL, 0);
           if (FD_ISSET (h, &handle_rfds))
             FD_SET (i, rfds);
@@ -458,22 +491,12 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
         {
           /* Not a socket.  */
           nhandles++;
-          windows_poll_handle (h, i, &rbits, &wbits, &xbits);
           if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-            {
-              rc++;
-              FD_SET (i, rfds);
-            }
+            FD_SET (i, rfds);
           if (wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-            {
-              rc++;
-              FD_SET (i, wfds);
-            }
+            FD_SET (i, wfds);
           if (xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-            {
-              rc++;
-              FD_SET (i, xfds);
-            }
+            FD_SET (i, xfds);
         }
     }
 
@@ -483,6 +506,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
 #else /* ! Native Windows.  */
 
 #include <sys/select.h>
+#include <stddef.h> /* NULL */
 
 #undef select
 
diff --git a/gl/sha1.c b/gl/sha1.c
index 14870c4..0d82af1 100644
--- a/gl/sha1.c
+++ b/gl/sha1.c
@@ -14,8 +14,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Scott G. Miller
    Credits:
@@ -306,13 +305,13 @@ sha1_process_block (const void *buffer, size_t len, 
struct sha1_ctx *ctx)
   uint32_t c = ctx->C;
   uint32_t d = ctx->D;
   uint32_t e = ctx->E;
+  uint32_t lolen = len;
 
   /* First increment the byte count.  RFC 1321 specifies the possible
      length of the file up to 2^64 bits.  Here we only compute the
      number of bytes.  Do a double word increment.  */
-  ctx->total[0] += len;
-  if (ctx->total[0] < len)
-    ++ctx->total[1];
+  ctx->total[0] += lolen;
+  ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
 
 #define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
 
diff --git a/gl/sha1.h b/gl/sha1.h
index 74eb7e0..0d9ced0 100644
--- a/gl/sha1.h
+++ b/gl/sha1.h
@@ -14,8 +14,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef SHA1_H
 # define SHA1_H 1
diff --git a/gl/size_max.h b/gl/size_max.h
index e669bf1..9642441 100644
--- a/gl/size_max.h
+++ b/gl/size_max.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef GNULIB_SIZE_MAX_H
 #define GNULIB_SIZE_MAX_H
diff --git a/gl/snprintf.c b/gl/snprintf.c
index bb01880..3908442 100644
--- a/gl/snprintf.c
+++ b/gl/snprintf.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/stat.c b/gl/stat.c
index 9ea53c1..1fc633e 100644
--- a/gl/stat.c
+++ b/gl/stat.c
@@ -27,6 +27,20 @@
 #include <sys/stat.h>
 #undef __need_system_sys_stat_h
 
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# if _GL_WINDOWS_64_BIT_ST_SIZE
+#  define stat _stati64
+#  define REPLACE_FUNC_STAT_DIR 1
+#  undef REPLACE_FUNC_STAT_FILE
+# elif REPLACE_FUNC_STAT_FILE
+/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a.
+   Bypass it.  */
+#  define stat _stat
+#  define REPLACE_FUNC_STAT_DIR 1
+#  undef REPLACE_FUNC_STAT_FILE
+# endif
+#endif
+
 static inline int
 orig_stat (const char *filename, struct stat *buf)
 {
diff --git a/gl/stdalign.in.h b/gl/stdalign.in.h
index ae8d5b9..8fba694 100644
--- a/gl/stdalign.in.h
+++ b/gl/stdalign.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Paul Eggert and Bruno Haible.  */
 
diff --git a/gl/stdarg.in.h b/gl/stdarg.in.h
index 3e0e43f..53104a6 100644
--- a/gl/stdarg.in.h
+++ b/gl/stdarg.in.h
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef address@hidden@_STDARG_H
 
diff --git a/gl/stdbool.in.h b/gl/stdbool.in.h
index cabe4b8..ed1f9aa 100644
--- a/gl/stdbool.in.h
+++ b/gl/stdbool.in.h
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _GL_STDBOOL_H
 #define _GL_STDBOOL_H
diff --git a/gl/stddef.in.h b/gl/stddef.in.h
index 65e1775..17fcaea 100644
--- a/gl/stddef.in.h
+++ b/gl/stddef.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Eric Blake.  */
 
diff --git a/gl/stdint.in.h b/gl/stdint.in.h
index 67df6d9..59c00d5 100644
--- a/gl/stdint.in.h
+++ b/gl/stdint.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /*
  * ISO C 99 <stdint.h> for platforms that lack it.
@@ -91,7 +90,8 @@
 # include <sys/types.h>
 #endif
 
-/* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
+/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
+   LONG_MIN, LONG_MAX, ULONG_MAX.  */
 #include <limits.h>
 
 #if @HAVE_INTTYPES_H@
@@ -247,8 +247,9 @@ typedef unsigned long long int gl_uint64_t;
 
 /* Here we assume a standard architecture where the hardware integer
    types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
-   are taken from the same list of types.  Assume that 'long int'
-   is fast enough for all narrower integers.  */
+   are taken from the same list of types.  The following code normally
+   uses types consistent with glibc, as that lessens the chance of
+   incompatibility with older GNU hosts.  */
 
 #undef int_fast8_t
 #undef uint_fast8_t
@@ -258,12 +259,21 @@ typedef unsigned long long int gl_uint64_t;
 #undef uint_fast32_t
 #undef int_fast64_t
 #undef uint_fast64_t
-typedef long int gl_int_fast8_t;
-typedef unsigned long int gl_uint_fast8_t;
-typedef long int gl_int_fast16_t;
-typedef unsigned long int gl_uint_fast16_t;
+typedef signed char gl_int_fast8_t;
+typedef unsigned char gl_uint_fast8_t;
+
+#ifdef __sun
+/* Define types compatible with SunOS 5.10, so that code compiled under
+   earlier SunOS versions works with code compiled under SunOS 5.10.  */
+typedef int gl_int_fast32_t;
+typedef unsigned int gl_uint_fast32_t;
+#else
 typedef long int gl_int_fast32_t;
 typedef unsigned long int gl_uint_fast32_t;
+#endif
+typedef gl_int_fast32_t gl_int_fast16_t;
+typedef gl_uint_fast32_t gl_uint_fast16_t;
+
 #define int_fast8_t gl_int_fast8_t
 #define uint_fast8_t gl_uint_fast8_t
 #define int_fast16_t gl_int_fast16_t
@@ -419,23 +429,29 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == 
sizeof (uintmax_t)
 #undef INT_FAST8_MIN
 #undef INT_FAST8_MAX
 #undef UINT_FAST8_MAX
-#define INT_FAST8_MIN  LONG_MIN
-#define INT_FAST8_MAX  LONG_MAX
-#define UINT_FAST8_MAX  ULONG_MAX
+#define INT_FAST8_MIN  SCHAR_MIN
+#define INT_FAST8_MAX  SCHAR_MAX
+#define UINT_FAST8_MAX  UCHAR_MAX
 
 #undef INT_FAST16_MIN
 #undef INT_FAST16_MAX
 #undef UINT_FAST16_MAX
-#define INT_FAST16_MIN  LONG_MIN
-#define INT_FAST16_MAX  LONG_MAX
-#define UINT_FAST16_MAX  ULONG_MAX
+#define INT_FAST16_MIN  INT_FAST32_MIN
+#define INT_FAST16_MAX  INT_FAST32_MAX
+#define UINT_FAST16_MAX  UINT_FAST32_MAX
 
 #undef INT_FAST32_MIN
 #undef INT_FAST32_MAX
 #undef UINT_FAST32_MAX
-#define INT_FAST32_MIN  LONG_MIN
-#define INT_FAST32_MAX  LONG_MAX
-#define UINT_FAST32_MAX  ULONG_MAX
+#ifdef __sun
+# define INT_FAST32_MIN  INT_MIN
+# define INT_FAST32_MAX  INT_MAX
+# define UINT_FAST32_MAX  UINT_MAX
+#else
+# define INT_FAST32_MIN  LONG_MIN
+# define INT_FAST32_MAX  LONG_MAX
+# define UINT_FAST32_MAX  ULONG_MAX
+#endif
 
 #undef INT_FAST64_MIN
 #undef INT_FAST64_MAX
diff --git a/gl/stdio.in.h b/gl/stdio.in.h
index 06d9780..b1b543d 100644
--- a/gl/stdio.in.h
+++ b/gl/stdio.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
@@ -53,7 +52,8 @@
 #include <stddef.h>
 
 /* Get off_t and ssize_t.  Needed on many systems, including glibc 2.8
-   and eglibc 2.11.2.  */
+   and eglibc 2.11.2.
+   May also define off_t to a 64-bit type on native Windows.  */
 #include <sys/types.h>
 
 /* The __attribute__ feature is available in gcc versions 2.5 and later.
@@ -699,22 +699,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
 # endif
 #endif
 
-#if @GNULIB_GETS@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef gets
-#   define gets rpl_gets
-#  endif
-_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (gets, char *, (char *s));
-# else
-_GL_CXXALIAS_SYS (gets, char *, (char *s));
-#  undef gets
-# endif
-_GL_CXXALIASWARN (gets);
 /* It is very rare that the developer ever has full control of stdin,
-   so any use of gets warrants an unconditional warning.  Assume it is
-   always declared, since it is required by C89.  */
+   so any use of gets warrants an unconditional warning; besides, C11
+   removed it.  */
+#undef gets
+#if HAVE_RAW_DECL_GETS
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
 #endif
 
@@ -1054,9 +1043,9 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
 # endif
 #endif
 
-/* Some people would argue that sprintf should be handled like gets
-   (for example, OpenBSD issues a link warning for both functions),
-   since both can cause security holes due to buffer overruns.
+/* Some people would argue that all sprintf uses should be warned about
+   (for example, OpenBSD issues a link warning for it),
+   since it can cause security holes due to buffer overruns.
    However, we believe that sprintf can be used safely, and is more
    efficient than snprintf in those safe cases; and as proof of our
    belief, we use sprintf in several gnulib modules.  So this header
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index e92a614..b546133 100644
--- a/gl/stdlib.in.h
+++ b/gl/stdlib.in.h
@@ -94,6 +94,14 @@ struct random_data
 # include <unistd.h>
 #endif
 
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The attribute __pure__ was added in gcc 2.96.  */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define _GL_ATTRIBUTE_PURE /* empty */
+#endif
+
 /* The definition of _Noreturn is copied here.  */
 
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
@@ -138,7 +146,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
 /* Parse a signed decimal integer.
    Returns the value of the integer.  Errors are not detected.  */
 # if address@hidden@
-_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL 
((1)));
+_GL_FUNCDECL_SYS (atoll, long long, (const char *string)
+                                    _GL_ATTRIBUTE_PURE
+                                    _GL_ARG_NONNULL ((1)));
 # endif
 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
 _GL_CXXALIASWARN (atoll);
diff --git a/gl/strcasecmp.c b/gl/strcasecmp.c
index bc2bd12..77ca288 100644
--- a/gl/strcasecmp.c
+++ b/gl/strcasecmp.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/strdup.c b/gl/strdup.c
index c083551..a3f8c86 100644
--- a/gl/strdup.c
+++ b/gl/strdup.c
@@ -14,8 +14,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _LIBC
 # include <config.h>
diff --git a/gl/strerror-override.c b/gl/strerror-override.c
index 9ca6523..9f55cfa 100644
--- a/gl/strerror-override.c
+++ b/gl/strerror-override.c
@@ -89,6 +89,8 @@ strerror_override (int errnum)
       return "No route to host";
     case EWOULDBLOCK:
       return "Operation would block";
+#endif
+#if GNULIB_defined_ESTREAMS /* native Windows platforms with older <errno.h> */
     case ETXTBSY:
       return "Text file busy";
     case ENODATA:
@@ -97,10 +99,6 @@ strerror_override (int errnum)
       return "Out of streams resources";
     case ENOSTR:
       return "Device not a stream";
-    case ENOTRECOVERABLE:
-      return "State not recoverable";
-    case EOWNERDEAD:
-      return "Owner died";
     case ETIME:
       return "Timer expired";
     case EOTHER:
@@ -283,6 +281,16 @@ strerror_override (int errnum)
       return "Operation canceled";
 #endif
 
+#if GNULIB_defined_EOWNERDEAD
+    case EOWNERDEAD:
+      return "Owner died";
+#endif
+
+#if GNULIB_defined_ENOTRECOVERABLE
+    case ENOTRECOVERABLE:
+      return "State not recoverable";
+#endif
+
     default:
       return NULL;
     }
diff --git a/gl/strerror-override.h b/gl/strerror-override.h
index 09526ea..fe1fb2c 100644
--- a/gl/strerror-override.h
+++ b/gl/strerror-override.h
@@ -30,6 +30,7 @@
    describing the error.  Otherwise return NULL.  */
 # if REPLACE_STRERROR_0 \
      || GNULIB_defined_ESOCK \
+     || GNULIB_defined_ESTREAMS \
      || GNULIB_defined_EWINSOCK \
      || GNULIB_defined_ENOMSG \
      || GNULIB_defined_EIDRM \
@@ -43,7 +44,9 @@
      || GNULIB_defined_ECONNABORTED \
      || GNULIB_defined_ESTALE \
      || GNULIB_defined_EDQUOT \
-     || GNULIB_defined_ECANCELED
+     || GNULIB_defined_ECANCELED \
+     || GNULIB_defined_EOWNERDEAD \
+     || GNULIB_defined_ENOTRECOVERABLE
 extern const char *strerror_override (int errnum);
 # else
 #  define strerror_override(ignored) NULL
diff --git a/gl/string.in.h b/gl/string.in.h
index 93f70de..f8d7520 100644
--- a/gl/string.in.h
+++ b/gl/string.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef address@hidden@_STRING_H
 
@@ -725,10 +724,14 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   define mbslen rpl_mbslen
 #  endif
-_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string)
+                                  _GL_ATTRIBUTE_PURE
+                                  _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
 # else
-_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string)
+                                  _GL_ATTRIBUTE_PURE
+                                  _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
 # endif
 _GL_CXXALIASWARN (mbslen);
@@ -738,6 +741,7 @@ _GL_CXXALIASWARN (mbslen);
 /* Return the number of multibyte characters in the character string starting
    at STRING and ending at STRING + LEN.  */
 _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
+     _GL_ATTRIBUTE_PURE
      _GL_ARG_NONNULL ((1));
 #endif
 
@@ -751,10 +755,12 @@ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t 
len)
 #   define mbschr rpl_mbschr /* avoid collision with HP-UX function */
 #  endif
 _GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
+                                  _GL_ATTRIBUTE_PURE
                                   _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
 # else
 _GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
+                                  _GL_ATTRIBUTE_PURE
                                   _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
 # endif
@@ -771,10 +777,12 @@ _GL_CXXALIASWARN (mbschr);
 #   define mbsrchr rpl_mbsrchr /* avoid collision with system function */
 #  endif
 _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
+                                   _GL_ATTRIBUTE_PURE
                                    _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
 # else
 _GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
+                                   _GL_ATTRIBUTE_PURE
                                    _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
 # endif
@@ -787,6 +795,7 @@ _GL_CXXALIASWARN (mbsrchr);
    Unlike strstr(), this function works correctly in multibyte locales with
    encodings different from UTF-8.  */
 _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
+     _GL_ATTRIBUTE_PURE
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -798,6 +807,7 @@ _GL_EXTERN_C char * mbsstr (const char *haystack, const 
char *needle)
    different lengths!
    Unlike strcasecmp(), this function works correctly in multibyte locales.  */
 _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
+     _GL_ATTRIBUTE_PURE
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -812,6 +822,7 @@ _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
    Unlike strncasecmp(), this function works correctly in multibyte locales.
    But beware that N is not a byte count but a character count!  */
 _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
+     _GL_ATTRIBUTE_PURE
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -825,6 +836,7 @@ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char 
*s2, size_t n)
    Unlike strncasecmp(), this function works correctly in multibyte
    locales.  */
 _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
+     _GL_ATTRIBUTE_PURE
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -835,6 +847,7 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, const 
char *prefix)
    strlen (haystack) < strlen (needle) !
    Unlike strcasestr(), this function works correctly in multibyte locales.  */
 _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
+     _GL_ATTRIBUTE_PURE
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -845,6 +858,7 @@ _GL_EXTERN_C char * mbscasestr (const char *haystack, const 
char *needle)
    if none exists.
    Unlike strcspn(), this function works correctly in multibyte locales.  */
 _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
+     _GL_ATTRIBUTE_PURE
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -858,10 +872,12 @@ _GL_EXTERN_C size_t mbscspn (const char *string, const 
char *accept)
 #   define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
 #  endif
 _GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
+                                   _GL_ATTRIBUTE_PURE
                                    _GL_ARG_NONNULL ((1, 2)));
 _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
 # else
 _GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
+                                   _GL_ATTRIBUTE_PURE
                                    _GL_ARG_NONNULL ((1, 2)));
 _GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
 # endif
@@ -875,6 +891,7 @@ _GL_CXXALIASWARN (mbspbrk);
    if none exists.
    Unlike strspn(), this function works correctly in multibyte locales.  */
 _GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
+     _GL_ATTRIBUTE_PURE
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -994,6 +1011,7 @@ _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
 #if @GNULIB_STRVERSCMP@
 # if address@hidden@
 _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
+                                   _GL_ATTRIBUTE_PURE
                                    _GL_ARG_NONNULL ((1, 2)));
 # endif
 _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
diff --git a/gl/strings.in.h b/gl/strings.in.h
index 4724eee..7ed88e9 100644
--- a/gl/strings.in.h
+++ b/gl/strings.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef address@hidden@_STRINGS_H
 
diff --git a/gl/strncasecmp.c b/gl/strncasecmp.c
index fa65ba0..bf413b4 100644
--- a/gl/strncasecmp.c
+++ b/gl/strncasecmp.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/strndup.c b/gl/strndup.c
index 6d0eaf2..4053871 100644
--- a/gl/strndup.c
+++ b/gl/strndup.c
@@ -14,8 +14,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/strnlen.c b/gl/strnlen.c
index 7778537..d36180d 100644
--- a/gl/strnlen.c
+++ b/gl/strnlen.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/strverscmp.c b/gl/strverscmp.c
index 6a34933..490773d 100644
--- a/gl/strverscmp.c
+++ b/gl/strverscmp.c
@@ -15,8 +15,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #if !_LIBC
 # include <config.h>
diff --git a/gl/sys_select.in.h b/gl/sys_select.in.h
index 4b35d19..214d75d 100644
--- a/gl/sys_select.in.h
+++ b/gl/sys_select.in.h
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 # if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h
index 819aff1..f2eda0c 100644
--- a/gl/sys_socket.in.h
+++ b/gl/sys_socket.in.h
@@ -14,8 +14,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* This file is supposed to be used on platforms that lack <sys/socket.h>,
    on platforms where <sys/socket.h> cannot be included standalone, and on
diff --git a/gl/sys_stat.in.h b/gl/sys_stat.in.h
index 6d159f0..2efc1e9 100644
--- a/gl/sys_stat.in.h
+++ b/gl/sys_stat.in.h
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
 
@@ -36,7 +35,8 @@
 
 #ifndef address@hidden@_SYS_STAT_H
 
-/* Get nlink_t.  */
+/* Get nlink_t.
+   May also define off_t to a 64-bit type on native Windows.  */
 #include <sys/types.h>
 
 /* Get struct timespec.  */
@@ -67,6 +67,11 @@
 # include <io.h>
 #endif
 
+/* Large File Support on native Windows.  */
+#if @WINDOWS_64_BIT_ST_SIZE@
+# define stat _stati64
+#endif
+
 #ifndef S_IFIFO
 # ifdef _S_IFIFO
 #  define S_IFIFO _S_IFIFO
@@ -336,6 +341,9 @@ _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
 _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
 # endif
 _GL_CXXALIASWARN (fstat);
+#elif @WINDOWS_64_BIT_ST_SIZE@
+/* Above, we define stat to _stati64.  */
+# define fstat _fstati64
 #elif defined GNULIB_POSIXCHECK
 # undef fstat
 # if HAVE_RAW_DECL_FSTAT
@@ -621,6 +629,28 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
        so we have to replace stat64() instead of stat(). */
 #   undef stat64
 #   define stat64(name, st) rpl_stat (name, st)
+#  elif @WINDOWS_64_BIT_ST_SIZE@
+    /* Above, we define stat to _stati64.  */
+#   if defined __MINGW32__ && defined _stati64
+#    ifndef _USE_32BIT_TIME_T
+      /* The system headers define _stati64 to _stat64.  */
+#     undef _stat64
+#     define _stat64(name, st) rpl_stat (name, st)
+#    endif
+#   elif defined _MSC_VER && defined _stati64
+#    ifdef _USE_32BIT_TIME_T
+      /* The system headers define _stati64 to _stat32i64.  */
+#     undef _stat32i64
+#     define _stat32i64(name, st) rpl_stat (name, st)
+#    else
+      /* The system headers define _stati64 to _stat64.  */
+#     undef _stat64
+#     define _stat64(name, st) rpl_stat (name, st)
+#    endif
+#   else
+#    undef _stati64
+#    define _stati64(name, st) rpl_stat (name, st)
+#   endif
 #  elif defined __MINGW32__ && defined stat
 #   ifdef _USE_32BIT_TIME_T
      /* The system headers define stat to _stat32i64.  */
diff --git a/gl/sys_time.in.h b/gl/sys_time.in.h
index ee86ccc..d915cee 100644
--- a/gl/sys_time.in.h
+++ b/gl/sys_time.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Paul Eggert.  */
 
diff --git a/gl/sys_types.in.h b/gl/sys_types.in.h
index f37b999..8139d98 100644
--- a/gl/sys_types.in.h
+++ b/gl/sys_types.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
@@ -29,6 +28,18 @@
 #ifndef address@hidden@_SYS_TYPES_H
 #define address@hidden@_SYS_TYPES_H
 
+/* Override off_t if Large File Support is requested on native Windows.  */
+#if @WINDOWS_64_BIT_OFF_T@
+/* Same as int64_t in <stdint.h>.  */
+# if defined _MSC_VER
+#  define off_t __int64
+# else
+#  define off_t long long int
+# endif
+/* Indicator, for gnulib internal purposes.  */
+# define _GL_WINDOWS_64_BIT_OFF_T 1
+#endif
+
 /* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>.  */
 /* But avoid namespace pollution on glibc systems.  */
 #if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
diff --git a/gl/sys_uio.in.h b/gl/sys_uio.in.h
index 07b9629..910bb00 100644
--- a/gl/sys_uio.in.h
+++ b/gl/sys_uio.in.h
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 # if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
diff --git a/gl/time.in.h b/gl/time.in.h
index 5080d45..04cde05 100644
--- a/gl/time.in.h
+++ b/gl/time.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
diff --git a/gl/time_r.c b/gl/time_r.c
index dbde157..74366a0 100644
--- a/gl/time_r.c
+++ b/gl/time_r.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Paul Eggert.  */
 
diff --git a/gl/timegm.c b/gl/timegm.c
index cc4a41c..7c919b4 100644
--- a/gl/timegm.c
+++ b/gl/timegm.c
@@ -14,8 +14,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _LIBC
 # include <config.h>
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 660094a..9115486 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
@@ -108,8 +107,9 @@
 # include <netdb.h>
 #endif
 
-/* MSVC defines off_t in <sys/types.h>.  */
-#if address@hidden@
+/* MSVC defines off_t in <sys/types.h>.
+   May also define off_t to a 64-bit type on native Windows.  */
+#if address@hidden@ || @WINDOWS_64_BIT_OFF_T@
 /* Get off_t.  */
 # include <sys/types.h>
 #endif
@@ -563,10 +563,19 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2008 specification
    <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. 
 */
-# if address@hidden@
+# if @REPLACE_FTRUNCATE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ftruncate
+#   define ftruncate rpl_ftruncate
+#  endif
+_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
+_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
+# else
+#  if address@hidden@
 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
+# endif
 _GL_CXXALIASWARN (ftruncate);
 #elif defined GNULIB_POSIXCHECK
 # undef ftruncate
diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c
index 297eb20..0ebddf1 100644
--- a/gl/vasnprintf.c
+++ b/gl/vasnprintf.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* This file can be parametrized with the following macros:
      VASNPRINTF         The name of the function being defined.
diff --git a/gl/vasnprintf.h b/gl/vasnprintf.h
index fdd5868..dd86914 100644
--- a/gl/vasnprintf.h
+++ b/gl/vasnprintf.h
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _VASNPRINTF_H
 #define _VASNPRINTF_H
diff --git a/gl/vasprintf.c b/gl/vasprintf.c
index 6d1cd97..16fc9d5 100644
--- a/gl/vasprintf.c
+++ b/gl/vasprintf.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/wchar.in.h b/gl/wchar.in.h
index 86c97ff..f9bc30c 100644
--- a/gl/wchar.in.h
+++ b/gl/wchar.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Eric Blake.  */
 
@@ -84,6 +83,14 @@
 #ifndef address@hidden@_WCHAR_H
 #define address@hidden@_WCHAR_H
 
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The attribute __pure__ was added in gcc 2.96.  */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define _GL_ATTRIBUTE_PURE /* empty */
+#endif
+
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
@@ -136,11 +143,11 @@ typedef int rpl_mbstate_t;
 #   undef btowc
 #   define btowc rpl_btowc
 #  endif
-_GL_FUNCDECL_RPL (btowc, wint_t, (int c));
+_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
 _GL_CXXALIAS_RPL (btowc, wint_t, (int c));
 # else
 #  if address@hidden@
-_GL_FUNCDECL_SYS (btowc, wint_t, (int c));
+_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
 #  endif
 _GL_CXXALIAS_SYS (btowc, wint_t, (int c));
 # endif
@@ -161,12 +168,12 @@ _GL_WARN_ON_USE (btowc, "btowc is unportable - "
 #   undef wctob
 #   define wctob rpl_wctob
 #  endif
-_GL_FUNCDECL_RPL (wctob, int, (wint_t wc));
+_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
 _GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
 # else
 #  if !defined wctob && address@hidden@
 /* wctob is provided by gnulib, or wctob exists but is not declared.  */
-_GL_FUNCDECL_SYS (wctob, int, (wint_t wc));
+_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
 #  endif
 _GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
 # endif
@@ -427,12 +434,12 @@ _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
 #   undef wcwidth
 #   define wcwidth rpl_wcwidth
 #  endif
-_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t));
+_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
 _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
 # else
 #  if address@hidden@
 /* wcwidth exists but is not declared.  */
-_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t));
+_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
 #  endif
 _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
 # endif
@@ -449,7 +456,8 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
 /* Search N wide characters of S for C.  */
 #if @GNULIB_WMEMCHR@
 # if address@hidden@
-_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
+_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
+                                      _GL_ATTRIBUTE_PURE);
 # endif
   /* On some systems, this function is defined as an overloaded function:
        extern "C++" {
@@ -480,7 +488,8 @@ _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
 #if @GNULIB_WMEMCMP@
 # if address@hidden@
 _GL_FUNCDECL_SYS (wmemcmp, int,
-                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+                  (const wchar_t *s1, const wchar_t *s2, size_t n)
+                  _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wmemcmp, int,
                   (const wchar_t *s1, const wchar_t *s2, size_t n));
@@ -550,7 +559,7 @@ _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
 /* Return the number of wide characters in S.  */
 #if @GNULIB_WCSLEN@
 # if address@hidden@
-_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s));
+_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
 _GL_CXXALIASWARN (wcslen);
@@ -566,7 +575,8 @@ _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
 /* Return the number of wide characters in S, but at most MAXLEN.  */
 #if @GNULIB_WCSNLEN@
 # if address@hidden@
-_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
+_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
+                                   _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
 _GL_CXXALIASWARN (wcsnlen);
@@ -685,7 +695,8 @@ _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
 /* Compare S1 and S2.  */
 #if @GNULIB_WCSCMP@
 # if address@hidden@
-_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
+_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
+                               _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
 _GL_CXXALIASWARN (wcscmp);
@@ -702,7 +713,8 @@ _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
 #if @GNULIB_WCSNCMP@
 # if address@hidden@
 _GL_FUNCDECL_SYS (wcsncmp, int,
-                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+                  (const wchar_t *s1, const wchar_t *s2, size_t n)
+                  _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wcsncmp, int,
                   (const wchar_t *s1, const wchar_t *s2, size_t n));
@@ -719,7 +731,8 @@ _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
 /* Compare S1 and S2, ignoring case.  */
 #if @GNULIB_WCSCASECMP@
 # if address@hidden@
-_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
+_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)
+                                   _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
 _GL_CXXALIASWARN (wcscasecmp);
@@ -736,7 +749,8 @@ _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
 #if @GNULIB_WCSNCASECMP@
 # if address@hidden@
 _GL_FUNCDECL_SYS (wcsncasecmp, int,
-                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+                  (const wchar_t *s1, const wchar_t *s2, size_t n)
+                  _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wcsncasecmp, int,
                   (const wchar_t *s1, const wchar_t *s2, size_t n));
@@ -804,7 +818,8 @@ _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
 /* Find the first occurrence of WC in WCS.  */
 #if @GNULIB_WCSCHR@
 # if address@hidden@
-_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
+                                     _GL_ATTRIBUTE_PURE);
 # endif
   /* On some systems, this function is defined as an overloaded function:
        extern "C++" {
@@ -833,7 +848,8 @@ _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
 /* Find the last occurrence of WC in WCS.  */
 #if @GNULIB_WCSRCHR@
 # if address@hidden@
-_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
+                                      _GL_ATTRIBUTE_PURE);
 # endif
   /* On some systems, this function is defined as an overloaded function:
        extern "C++" {
@@ -863,7 +879,8 @@ _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
    of wide characters not in REJECT.  */
 #if @GNULIB_WCSCSPN@
 # if address@hidden@
-_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t 
*reject));
+_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
+                                   _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t 
*reject));
 _GL_CXXALIASWARN (wcscspn);
@@ -880,7 +897,8 @@ _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
    of wide characters in ACCEPT.  */
 #if @GNULIB_WCSSPN@
 # if address@hidden@
-_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
+_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
+                                  _GL_ATTRIBUTE_PURE);
 # endif
 _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
 _GL_CXXALIASWARN (wcsspn);
@@ -897,7 +915,8 @@ _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
 #if @GNULIB_WCSPBRK@
 # if address@hidden@
 _GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
-                  (const wchar_t *wcs, const wchar_t *accept));
+                  (const wchar_t *wcs, const wchar_t *accept)
+                  _GL_ATTRIBUTE_PURE);
 # endif
   /* On some systems, this function is defined as an overloaded function:
        extern "C++" {
@@ -929,7 +948,8 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
 #if @GNULIB_WCSSTR@
 # if address@hidden@
 _GL_FUNCDECL_SYS (wcsstr, wchar_t *,
-                  (const wchar_t *haystack, const wchar_t *needle));
+                  (const wchar_t *haystack, const wchar_t *needle)
+                  _GL_ATTRIBUTE_PURE);
 # endif
   /* On some systems, this function is defined as an overloaded function:
        extern "C++" {
@@ -983,11 +1003,13 @@ _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
 #   undef wcswidth
 #   define wcswidth rpl_wcswidth
 #  endif
-_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n));
+_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)
+                                 _GL_ATTRIBUTE_PURE);
 _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
 # else
 #  if address@hidden@
-_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n));
+_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
+                                 _GL_ATTRIBUTE_PURE);
 #  endif
 _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
 # endif
diff --git a/gl/xsize.h b/gl/xsize.h
index 4c1e615..515327e 100644
--- a/gl/xsize.h
+++ b/gl/xsize.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _XSIZE_H
 #define _XSIZE_H
diff --git a/lib/crypto-ctx.c b/lib/crypto-ctx.c
index 83ed3e0..ac2ec62 100644
--- a/lib/crypto-ctx.c
+++ b/lib/crypto-ctx.c
@@ -60,11 +60,10 @@ shishi_crypto (Shishi * handle,
               int keyusage, int32_t etype, const char *iv, size_t ivlen)
 {
   Shishi_crypto *ctx;
-  int rc;
 
   ctx = xmalloc (sizeof (*ctx));
 
-  rc = shishi_key (handle, &ctx->key);
+  shishi_key (handle, &ctx->key);
   /* XXX handle rc, or rather:
      change shishi_key() to return key instead of int. */
   shishi_key_copy (ctx->key, key);
diff --git a/lib/diskio.c b/lib/diskio.c
index d4dbc6a..2542ba3 100644
--- a/lib/diskio.c
+++ b/lib/diskio.c
@@ -892,13 +892,11 @@ shishi_key_parse (Shishi * handle, FILE * fh, Shishi_key 
** key)
   char armorend[BUFSIZE];
   int in_key = 0, in_body = 0;
   int res;
-  size_t len;
   Shishi_key *lkey = NULL;
 
   sprintf (armorbegin, HEADERBEG, "KEY");
   sprintf (armorend, HEADEREND, "KEY");
 
-  len = 0;
   while (fgets (line, sizeof (line), fh))
     {
       lno++;
diff --git a/lib/shishi.h b/lib/shishi.h
index 60ff444..3105075 100644
--- a/lib/shishi.h
+++ b/lib/shishi.h
@@ -29,7 +29,7 @@
 #include <time.h>              /* time_t */
 #include <shishi-int.h>                /* uint32_t */
 
-#define SHISHI_VERSION "1.0.1"
+#define SHISHI_VERSION "1.0.2"
 
 # ifdef __cplusplus
 extern "C"
diff --git a/maint.mk b/maint.mk
index 1dd6493..f0b889b 100644
--- a/maint.mk
+++ b/maint.mk
@@ -178,6 +178,13 @@ syntax-check: $(local-check)
 #     Regular expression (ERE) denoting either a forbidden construct
 #     or a required construct.  Those arguments are exclusive.
 #
+#  exclude
+#
+#     Regular expression (ERE) denoting lines to ignore that matched
+#     a prohibit construct.  For example, this can be used to exclude
+#     comments that mention why the nearby code uses an alternative
+#     construct instead of the simpler prohibited construct.
+#
 #  in_vc_files | in_files
 #
 #     grep-E-style regexp denoting the files to check.  If no files
@@ -212,6 +219,17 @@ syntax-check: $(local-check)
 # when filtering by name via in_files, we explicitly filter out matching
 # names here as well.
 
+# Initialize each, so that envvar settings cannot interfere.
+export require =
+export prohibit =
+export exclude =
+export in_vc_files =
+export in_files =
+export containing =
+export non_containing =
+export halt =
+export with_grep_options =
+
 # By default, _sc_search_regexp does not ignore case.
 export ignore_case =
 _ignore_case = $$(test -n "$$ignore_case" && printf %s -i || :)
@@ -231,6 +249,9 @@ define _sc_search_regexp
    test -z "$$prohibit" && test -z "$$require"                         \
      && { msg='Should specify either prohibit or require'              \
           $(_sc_say_and_exit) } || :;                                  \
+   test -z "$$prohibit" && test -n "$$exclude"                         \
+     && { msg='Use of exclude requires a prohibit pattern'             \
+          $(_sc_say_and_exit) } || :;                                  \
    test -n "$$in_vc_files" && test -n "$$in_files"                     \
      && { msg='Cannot specify both in_vc_files and in_files'           \
           $(_sc_say_and_exit) } || :;                                  \
@@ -258,6 +279,7 @@ define _sc_search_regexp
    if test -n "$$files"; then                                          \
      if test -n "$$prohibit"; then                                     \
        grep $$with_grep_options $(_ignore_case) -nE "$$prohibit" $$files \
+         | grep -vE "$${exclude:-^$$}"                                 \
          && { msg="$$halt" $(_sc_say_and_exit) } || :;                 \
      else                                                              \
        grep $$with_grep_options $(_ignore_case) -LE "$$require" $$files \
@@ -303,12 +325,20 @@ sc_prohibit_atoi_atof:
          $(_sc_search_regexp)
 
 # Use STREQ rather than comparing strcmp == 0, or != 0.
+sp_ = strcmp *\(.+\)
 sc_prohibit_strcmp:
-       @grep -nE '! *str''cmp *\(|\<str''cmp *\(.+\) *[!=]='   \
-           $$($(VC_LIST_EXCEPT))                                       \
-         | grep -vE ':# *define STRN?EQ\(' &&                          \
-         { echo '$(ME): replace str''cmp calls above with STREQ/STRNEQ' \
-               1>&2; exit 1; } || :
+       @prohibit='! *strcmp *\(|\<$(sp_) *[!=]=|[!=]= *$(sp_)'         \
+       exclude=':# *define STRN?EQ\('                                  \
+       halt='$(ME): replace strcmp calls above with STREQ/STRNEQ'      \
+         $(_sc_search_regexp)
+
+# Really.  You don't want to use this function.
+# It may fail to NUL-terminate the destination,
+# and always NUL-pads out to the specified length.
+sc_prohibit_strncpy:
+       @prohibit='\<strncpy *\('                                       \
+       halt='do not use strncpy, period'                               \
+         $(_sc_search_regexp)
 
 # Pass EXIT_*, not number, to usage, exit, and error (when exiting)
 # Convert all uses automatically, via these two commands:
@@ -433,7 +463,8 @@ sc_prohibit_quotearg_without_use:
 
 # Don't include quote.h unless you use one of its functions.
 sc_prohibit_quote_without_use:
-       @h='quote.h' re='\<quote(_n)? *\(' $(_sc_header_without_use)
+       @h='quote.h' re='\<quote((_n)? *\(|_quoting_options\>)' \
+         $(_sc_header_without_use)
 
 # Don't include this header unless you use one of its functions.
 sc_prohibit_long_options_without_use:
@@ -708,12 +739,10 @@ _gl_translatable_diag_func_re ?= error
 # Look for diagnostics that aren't marked for translation.
 # This won't find any for which error's format string is on a separate line.
 sc_unmarked_diagnostics:
-       @grep -nE                                                       \
-           '\<$(_gl_translatable_diag_func_re) *\([^"]*"[^"]*[a-z]{3}' \
-               $$($(VC_LIST_EXCEPT))                                   \
-         | grep -Ev '(_|ngettext ?)\(' &&                              \
-         { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
-           exit 1; } || :
+       @prohibit='\<$(_gl_translatable_diag_func_re) *\([^"]*"[^"]*[a-z]{3}' \
+       exclude='(_|ngettext ?)\('                                      \
+       halt='$(ME): found unmarked diagnostic(s)'                      \
+         $(_sc_search_regexp)
 
 # Avoid useless parentheses like those in this example:
 # #if defined (SYMBOL) || defined (SYM2)
@@ -911,8 +940,15 @@ sc_prohibit_doubled_word:
 # A regular expression matching undesirable combinations of words like
 # "can not"; this matches them even when the two words appear on different
 # lines, but not when there is an intervening delimiter like "#" or "*".
+# Similarly undesirable, "See @xref{...}", since an @xref should start
+# a sentence.  Explicitly prohibit any prefix of "see" or "also".
+# Also prohibit a prefix matching "\w+ +".
+# @pxref gets the same see/also treatment and should be parenthesized;
+# presume it must *not* start a sentence.
+bad_xref_re_ ?= (?:[\w,:;] +|(?:see|also)\s+)address@hidden
+bad_pxref_re_ ?= (?:[.!?]|(?:see|also))address@hidden
 prohibit_undesirable_word_seq_RE_ ?=                                   \
-  /\bcan\s+not\b/gims
+  /(?:\bcan\s+not\b|$(bad_xref_re_)|$(bad_pxref_re_))/gims
 prohibit_undesirable_word_seq_ =                                       \
     -e 'while ($(prohibit_undesirable_word_seq_RE_))'                  \
     $(perl_filename_lineno_text_)
@@ -974,10 +1010,10 @@ sc_redundant_const:
          $(_sc_search_regexp)
 
 sc_const_long_option:
-       @grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT))         \
-         | grep -Ev 'const struct option|struct option const' && {     \
-             echo 1>&2 '$(ME): add "const" to the above declarations'; \
-             exit 1; } || :
+       @prohibit='^ *static.*struct option '                           \
+       exclude='const struct option|struct option const'               \
+       halt='$(ME): add "const" to the above declarations'             \
+         $(_sc_search_regexp)
 
 NEWS_hash =                                                            \
   $$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p'             \
@@ -1023,7 +1059,7 @@ sc_makefile_at_at_check:
          && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
 
 news-check: NEWS
-       if sed -n $(news-check-lines-spec)p $(srcdir)/NEWS              \
+       if sed -n $(news-check-lines-spec)p $<                          \
            | grep -E $(news-check-regexp) >/dev/null; then             \
          :;                                                            \
        else                                                            \
@@ -1206,7 +1242,7 @@ bootstrap-tools ?= autoconf,automake,gnulib
 gpg_key_ID ?= \
   $$(git cat-file tag v$(VERSION) \
      | gpgv --status-fd 1 --keyring /dev/null - - 2>/dev/null \
-     | sed -n '/^\[GNUPG:\] ERRSIG /{s///;s/ .*//p;q}')
+     | awk '/^\[GNUPG:\] ERRSIG / {print $3; exit}')
 
 translation_project_ ?= address@hidden
 
@@ -1234,7 +1270,8 @@ announcement: NEWS ChangeLog $(rel-files)
            --gpg-key-id=$(gpg_key_ID)                                  \
            --news=$(srcdir)/NEWS                                       \
            --bootstrap-tools=$(bootstrap-tools)                        \
-           --gnulib-version=$(gnulib-version)                          \
+           $$(case ,$(bootstrap-tools), in (*,gnulib,*)                \
+              echo --gnulib-version=$(gnulib-version);; esac)          \
            --no-print-checksums                                        \
            $(addprefix --url-dir=, $(url_dir_list))
 
@@ -1311,7 +1348,7 @@ alpha beta stable: $(local-check) writable-files 
$(submodule-checks)
        $(MAKE) vc-diff-check
        $(MAKE) news-check
        $(MAKE) distcheck
-       $(MAKE) dist XZ_OPT=-9ev
+       $(MAKE) dist
        $(MAKE) $(release-prep-hook) RELEASE_TYPE=$@
        $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
 
@@ -1330,7 +1367,7 @@ release-prep:
        fi
        echo $(VERSION) > $(prev_version_file)
        $(MAKE) update-NEWS-hash
-       perl -pi -e '$$. == 3 and print "$(gl_noteworthy_news_)\n\n\n"' NEWS
+       perl -pi -e '$$. == 3 and print "$(gl_noteworthy_news_)\n\n\n"' 
$(srcdir)/NEWS
        $(emit-commit-log) > .ci-msg
        $(VC) commit -F .ci-msg -a
        rm .ci-msg
@@ -1385,7 +1422,7 @@ refresh-po:
        wget --no-verbose --directory-prefix $(PODIR) --no-directories 
--recursive --level 1 --accept .po --accept .po.1 $(POURL) && \
        echo 'address@hidden' > $(PODIR)/LINGUAS && \
        echo 'address@hidden' >> $(PODIR)/LINGUAS && \
-       ls $(PODIR)/*.po | sed 's/\.po//' | sed 's,$(PODIR)/,,' | sort >> 
$(PODIR)/LINGUAS
+       ls $(PODIR)/*.po | sed 's/\.po//;s,$(PODIR)/,,' | sort >> 
$(PODIR)/LINGUAS
 
  # Running indent once is not idempotent, but running it twice is.
 INDENT_SOURCES ?= $(C_SOURCES)
diff --git a/src/gl/errno.in.h b/src/gl/errno.in.h
index 5271bcd..5e5af92 100644
--- a/src/gl/errno.in.h
+++ b/src/gl/errno.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef address@hidden@_ERRNO_H
 
@@ -85,6 +84,16 @@
 #   define GNULIB_defined_ECANCELED 1
 #  endif
 
+#  ifndef EOWNERDEAD
+#   define EOWNERDEAD 133
+#   define GNULIB_defined_EOWNERDEAD 1
+#  endif
+
+#  ifndef ENOTRECOVERABLE
+#   define ENOTRECOVERABLE 127
+#   define GNULIB_defined_ENOTRECOVERABLE 1
+#  endif
+
 #  ifndef EINPROGRESS
 #   define EINPROGRESS     112
 #   define EALREADY        103
@@ -109,15 +118,17 @@
 #   define ELOOP           114
 #   define EHOSTUNREACH    110
 #   define EWOULDBLOCK     140
+#   define GNULIB_defined_ESOCK 1
+#  endif
+
+#  ifndef ETXTBSY
 #   define ETXTBSY         139
 #   define ENODATA         120  /* not required by POSIX */
 #   define ENOSR           124  /* not required by POSIX */
 #   define ENOSTR          125  /* not required by POSIX */
-#   define ENOTRECOVERABLE 127  /* not required by POSIX */
-#   define EOWNERDEAD      133  /* not required by POSIX */
 #   define ETIME           137  /* not required by POSIX */
 #   define EOTHER          131  /* not required by POSIX */
-#   define GNULIB_defined_ESOCK 1
+#   define GNULIB_defined_ESTREAMS 1
 #  endif
 
 /* These are intentionally the same values as the WSA* error numbers, defined
@@ -228,6 +239,36 @@
 #  define GNULIB_defined_ECANCELED 1
 # endif
 
+/* On many platforms, the macros EOWNERDEAD and ENOTRECOVERABLE are not
+   defined.  */
+
+# ifndef EOWNERDEAD
+#  if defined __sun
+    /* Use the same values as defined for Solaris >= 8, for
+       interoperability.  */
+#   define EOWNERDEAD      58
+#   define ENOTRECOVERABLE 59
+#  elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+    /* We have a conflict here: pthreads-win32 defines these values
+       differently than MSVC 10.  It's hairy to decide which one to use.  */
+#   if defined __MINGW32__ && !defined USE_WINDOWS_THREADS
+     /* Use the same values as defined by pthreads-win32, for
+        interoperability.  */
+#    define EOWNERDEAD      43
+#    define ENOTRECOVERABLE 44
+#   else
+     /* Use the same values as defined by MSVC 10, for
+        interoperability.  */
+#    define EOWNERDEAD      133
+#    define ENOTRECOVERABLE 127
+#   endif
+#  else
+#   define EOWNERDEAD      2013
+#   define ENOTRECOVERABLE 2014
+#  endif
+#  define GNULIB_defined_EOWNERDEAD 1
+#  define GNULIB_defined_ENOTRECOVERABLE 1
+# endif
 
 #endif /* address@hidden@_ERRNO_H */
 #endif /* address@hidden@_ERRNO_H */
diff --git a/src/gl/gnulib.mk b/src/gl/gnulib.mk
index 0bec466..ce26dde 100644
--- a/src/gl/gnulib.mk
+++ b/src/gl/gnulib.mk
@@ -119,12 +119,15 @@ locale.h: locale.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
+             -e 's/@''GNULIB_LOCALECONV''@/$(GNULIB_LOCALECONV)/g' \
              -e 's/@''GNULIB_SETLOCALE''@/$(GNULIB_SETLOCALE)/g' \
              -e 's/@''GNULIB_DUPLOCALE''@/$(GNULIB_DUPLOCALE)/g' \
              -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \
              -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
+             -e 's|@''REPLACE_LOCALECONV''@|$(REPLACE_LOCALECONV)|g' \
              -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \
              -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
+             -e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
diff --git a/src/gl/locale.in.h b/src/gl/locale.in.h
index a97e3e7..7747902 100644
--- a/src/gl/locale.in.h
+++ b/src/gl/locale.in.h
@@ -47,6 +47,111 @@
 # define LC_MESSAGES 1729
 #endif
 
+/* Bionic libc's 'struct lconv' is just a dummy.  */
+#if @REPLACE_STRUCT_LCONV@
+# define lconv rpl_lconv
+struct lconv
+{
+  /* All 'char *' are actually 'const char *'.  */
+
+  /* Members that depend on the LC_NUMERIC category of the locale.  See
+     
<http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04>
 */
+
+  /* Symbol used as decimal point.  */
+  char *decimal_point;
+  /* Symbol used to separate groups of digits to the left of the decimal
+     point.  */
+  char *thousands_sep;
+  /* Definition of the size of groups of digits to the left of the decimal
+     point.  */
+  char *grouping;
+
+  /* Members that depend on the LC_MONETARY category of the locale.  See
+     
<http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_03>
 */
+
+  /* Symbol used as decimal point.  */
+  char *mon_decimal_point;
+  /* Symbol used to separate groups of digits to the left of the decimal
+     point.  */
+  char *mon_thousands_sep;
+  /* Definition of the size of groups of digits to the left of the decimal
+     point.  */
+  char *mon_grouping;
+  /* Sign used to indicate a value >= 0.  */
+  char *positive_sign;
+  /* Sign used to indicate a value < 0.  */
+  char *negative_sign;
+
+  /* For formatting local currency.  */
+  /* Currency symbol (3 characters) followed by separator (1 character).  */
+  char *currency_symbol;
+  /* Number of digits after the decimal point.  */
+  char frac_digits;
+  /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
+     comes after the number.  */
+  char p_cs_precedes;
+  /* For values >= 0: Position of the sign.  */
+  char p_sign_posn;
+  /* For values >= 0: Placement of spaces between currency symbol, sign, and
+     number.  */
+  char p_sep_by_space;
+  /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
+     comes after the number.  */
+  char n_cs_precedes;
+  /* For values < 0: Position of the sign.  */
+  char n_sign_posn;
+  /* For values < 0: Placement of spaces between currency symbol, sign, and
+     number.  */
+  char n_sep_by_space;
+
+  /* For formatting international currency.  */
+  /* Currency symbol (3 characters) followed by separator (1 character).  */
+  char *int_curr_symbol;
+  /* Number of digits after the decimal point.  */
+  char int_frac_digits;
+  /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
+     comes after the number.  */
+  char int_p_cs_precedes;
+  /* For values >= 0: Position of the sign.  */
+  char int_p_sign_posn;
+  /* For values >= 0: Placement of spaces between currency symbol, sign, and
+     number.  */
+  char int_p_sep_by_space;
+  /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
+     comes after the number.  */
+  char int_n_cs_precedes;
+  /* For values < 0: Position of the sign.  */
+  char int_n_sign_posn;
+  /* For values < 0: Placement of spaces between currency symbol, sign, and
+     number.  */
+  char int_n_sep_by_space;
+};
+#endif
+
+#if @GNULIB_LOCALECONV@
+# if @REPLACE_LOCALECONV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef localeconv
+#   define localeconv rpl_localeconv
+#  endif
+_GL_FUNCDECL_RPL (localeconv, struct lconv *, (void));
+_GL_CXXALIAS_RPL (localeconv, struct lconv *, (void));
+# else
+_GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
+# endif
+_GL_CXXALIASWARN (localeconv);
+#elif @REPLACE_STRUCT_LCONV@
+# undef localeconv
+# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
+#elif defined GNULIB_POSIXCHECK
+# undef localeconv
+# if HAVE_RAW_DECL_LOCALECONV
+_GL_WARN_ON_USE (localeconv,
+                 "localeconv returns too few information on some platforms - "
+                 "use gnulib module localeconv for portability");
+# endif
+#endif
+
 #if @GNULIB_SETLOCALE@
 # if @REPLACE_SETLOCALE@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/src/gl/m4/errno_h.m4 b/src/gl/m4/errno_h.m4
index 4f0bb83..1e76ba2 100644
--- a/src/gl/m4/errno_h.m4
+++ b/src/gl/m4/errno_h.m4
@@ -1,4 +1,4 @@
-# errno_h.m4 serial 10
+# errno_h.m4 serial 11
 dnl Copyright (C) 2004, 2006, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,6 +10,9 @@ AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
   AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
     AC_EGREP_CPP([booboo],[
 #include <errno.h>
+#if !defined ETXTBSY
+booboo
+#endif
 #if !defined ENOMSG
 booboo
 #endif
@@ -49,6 +52,12 @@ booboo
 #if !defined ECANCELED
 booboo
 #endif
+#if !defined EOWNERDEAD
+booboo
+#endif
+#if !defined ENOTRECOVERABLE
+booboo
+#endif
       ],
       [gl_cv_header_errno_h_complete=no],
       [gl_cv_header_errno_h_complete=yes])
diff --git a/src/gl/m4/gnulib-common.m4 b/src/gl/m4/gnulib-common.m4
index ae4d254..d62b767 100644
--- a/src/gl/m4/gnulib-common.m4
+++ b/src/gl/m4/gnulib-common.m4
@@ -14,7 +14,8 @@ AC_DEFUN([gl_COMMON], [
 AC_DEFUN([gl_COMMON_BODY], [
   AH_VERBATIM([_Noreturn],
 [/* The _Noreturn keyword of C11.  */
-#ifndef _Noreturn
+#if ! (defined _Noreturn \
+       || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
 # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
diff --git a/src/gl/m4/locale_h.m4 b/src/gl/m4/locale_h.m4
index 4289587..fb72e4e 100644
--- a/src/gl/m4/locale_h.m4
+++ b/src/gl/m4/locale_h.m4
@@ -1,4 +1,4 @@
-# locale_h.m4 serial 14
+# locale_h.m4 serial 18
 dnl Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,18 +10,29 @@ AC_DEFUN([gl_LOCALE_H],
   dnl once only, before all statements that occur in other macros.
   AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
 
-  dnl Persuade glibc <locale.h> to define locale_t.
+  dnl Persuade glibc <locale.h> to define locale_t and the int_p_*, int_n_*
+  dnl members of 'struct lconv'.
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
 
   dnl If <stddef.h> is replaced, then <locale.h> must also be replaced.
   AC_REQUIRE([gl_STDDEF_H])
 
+  dnl Solaris 11 2011-11 defines the int_p_*, int_n_* members of 'struct lconv'
+  dnl only if _LCONV_C99 is defined.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    solaris*)
+      AC_DEFINE([_LCONV_C99], [1], [Define to 1 on Solaris.])
+      ;;
+  esac
+
   AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001],
     [gl_cv_header_locale_h_posix2001],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
           [[#include <locale.h>
-            int x = LC_MESSAGES;]],
+            int x = LC_MESSAGES;
+            int y = sizeof (((struct lconv *) 0)->decimal_point);]],
           [[]])],
        [gl_cv_header_locale_h_posix2001=yes],
        [gl_cv_header_locale_h_posix2001=no])])
@@ -54,6 +65,26 @@ AC_DEFUN([gl_LOCALE_H],
   fi
   AC_SUBST([HAVE_XLOCALE_H])
 
+  dnl Check whether 'struct lconv' is complete.
+  dnl Bionic libc's 'struct lconv' is just a dummy.
+  dnl On OpenBSD 4.9, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x,
+  dnl mingw, MSVC 9, it lacks the int_p_* and int_n_* members.
+  AC_CACHE_CHECK([whether struct lconv is properly defined],
+    [gl_cv_sys_struct_lconv_ok],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <locale.h>
+            struct lconv l;
+            int x = sizeof (l.decimal_point);
+            int y = sizeof (l.int_p_cs_precedes);]],
+          [[]])],
+       [gl_cv_sys_struct_lconv_ok=yes],
+       [gl_cv_sys_struct_lconv_ok=no])
+    ])
+  if test $gl_cv_sys_struct_lconv_ok = no; then
+    REPLACE_STRUCT_LCONV=1
+  fi
+
   dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_NEXT_HEADERS([locale.h])
 
@@ -79,10 +110,13 @@ AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
 
 AC_DEFUN([gl_LOCALE_H_DEFAULTS],
 [
+  GNULIB_LOCALECONV=0; AC_SUBST([GNULIB_LOCALECONV])
   GNULIB_SETLOCALE=0;  AC_SUBST([GNULIB_SETLOCALE])
   GNULIB_DUPLOCALE=0;  AC_SUBST([GNULIB_DUPLOCALE])
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_DUPLOCALE=1;    AC_SUBST([HAVE_DUPLOCALE])
-  REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE])
-  REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE])
+  HAVE_DUPLOCALE=1;       AC_SUBST([HAVE_DUPLOCALE])
+  REPLACE_LOCALECONV=0;   AC_SUBST([REPLACE_LOCALECONV])
+  REPLACE_SETLOCALE=0;    AC_SUBST([REPLACE_SETLOCALE])
+  REPLACE_DUPLOCALE=0;    AC_SUBST([REPLACE_DUPLOCALE])
+  REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV])
 ])
diff --git a/src/gl/m4/strerror.m4 b/src/gl/m4/strerror.m4
index 6bf14ef..1c96e52 100644
--- a/src/gl/m4/strerror.m4
+++ b/src/gl/m4/strerror.m4
@@ -1,4 +1,4 @@
-# strerror.m4 serial 16
+# strerror.m4 serial 17
 dnl Copyright (C) 2002, 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,6 +9,7 @@ AC_DEFUN([gl_FUNC_STRERROR],
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   AC_REQUIRE([gl_HEADER_ERRNO_H])
   AC_REQUIRE([gl_FUNC_STRERROR_0])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
     AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
   ])
@@ -22,14 +23,22 @@ AC_DEFUN([gl_FUNC_STRERROR],
            [[if (!*strerror (-2)) return 1;]])],
         [gl_cv_func_working_strerror=yes],
         [gl_cv_func_working_strerror=no],
-        [dnl Be pessimistic on cross-compiles for now.
-         gl_cv_func_working_strerror="guessing no"])
+        [case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_working_strerror="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_working_strerror="guessing no" ;;
+         esac
+        ])
     ])
-    if test "$gl_cv_func_working_strerror" != yes; then
-      dnl The system's strerror() fails to return a string for out-of-range
-      dnl integers. Replace it.
-      REPLACE_STRERROR=1
-    fi
+    case "$gl_cv_func_working_strerror" in
+      *yes) ;;
+      *)
+        dnl The system's strerror() fails to return a string for out-of-range
+        dnl integers. Replace it.
+        REPLACE_STRERROR=1
+        ;;
+    esac
     m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
       dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's
       dnl buffer, we must replace strerror.
@@ -48,6 +57,7 @@ dnl Detect if strerror(0) passes (that is, does not set 
errno, and does not
 dnl return a string that matches strerror(-1)).
 AC_DEFUN([gl_FUNC_STRERROR_0],
 [
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   REPLACE_STRERROR_0=0
   AC_CACHE_CHECK([whether strerror(0) succeeds],
    [gl_cv_func_strerror_0_works],
@@ -67,12 +77,20 @@ AC_DEFUN([gl_FUNC_STRERROR_0],
            return result;]])],
       [gl_cv_func_strerror_0_works=yes],
       [gl_cv_func_strerror_0_works=no],
-      [dnl Be pessimistic on cross-compiles for now.
-       gl_cv_func_strerror_0_works="guessing no"])
+      [case "$host_os" in
+                 # Guess yes on glibc systems.
+         *-gnu*) gl_cv_func_strerror_0_works="guessing yes" ;;
+                 # If we don't know, assume the worst.
+         *)      gl_cv_func_strerror_0_works="guessing no" ;;
+       esac
+      ])
   ])
-  if test "$gl_cv_func_strerror_0_works" != yes; then
-    REPLACE_STRERROR_0=1
-    AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0)
-      does not return a message implying success.])
-  fi
+  case "$gl_cv_func_strerror_0_works" in
+    *yes) ;;
+    *)
+      REPLACE_STRERROR_0=1
+      AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0)
+        does not return a message implying success.])
+      ;;
+  esac
 ])
diff --git a/src/gl/m4/warn-on-use.m4 b/src/gl/m4/warn-on-use.m4
index 03b113c..a77802e 100644
--- a/src/gl/m4/warn-on-use.m4
+++ b/src/gl/m4/warn-on-use.m4
@@ -1,4 +1,4 @@
-# warn-on-use.m4 serial 4
+# warn-on-use.m4 serial 5
 dnl Copyright (C) 2010-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -18,8 +18,8 @@ dnl with or without modifications, as long as this notice is 
preserved.
 # some systems declare functions in the wrong header, then INCLUDES
 # should do likewise.
 #
-# If you assume C89, then it is generally safe to assume declarations
-# for functions declared in that standard (such as gets) without
+# It is generally safe to assume declarations for functions declared
+# in the intersection of C89 and C11 (such as printf) without
 # needing gl_WARN_ON_USE_PREPARE.
 AC_DEFUN([gl_WARN_ON_USE_PREPARE],
 [
diff --git a/src/gl/msvc-inval.c b/src/gl/msvc-inval.c
index b7a917d..ba76a7e 100644
--- a/src/gl/msvc-inval.c
+++ b/src/gl/msvc-inval.c
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/src/gl/msvc-inval.h b/src/gl/msvc-inval.h
index 373f9bf..eb6930b 100644
--- a/src/gl/msvc-inval.h
+++ b/src/gl/msvc-inval.h
@@ -12,8 +12,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _MSVC_INVAL_H
 #define _MSVC_INVAL_H
diff --git a/src/gl/msvc-nothrow.c b/src/gl/msvc-nothrow.c
index f0fea17..e5cf181 100644
--- a/src/gl/msvc-nothrow.c
+++ b/src/gl/msvc-nothrow.c
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/src/gl/msvc-nothrow.h b/src/gl/msvc-nothrow.h
index e066b24..2b71945 100644
--- a/src/gl/msvc-nothrow.h
+++ b/src/gl/msvc-nothrow.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _MSVC_NOTHROW_H
 #define _MSVC_NOTHROW_H
diff --git a/src/gl/stddef.in.h b/src/gl/stddef.in.h
index 65e1775..17fcaea 100644
--- a/src/gl/stddef.in.h
+++ b/src/gl/stddef.in.h
@@ -13,8 +13,7 @@
    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, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Eric Blake.  */
 
diff --git a/src/gl/strerror-override.c b/src/gl/strerror-override.c
index 9ca6523..9f55cfa 100644
--- a/src/gl/strerror-override.c
+++ b/src/gl/strerror-override.c
@@ -89,6 +89,8 @@ strerror_override (int errnum)
       return "No route to host";
     case EWOULDBLOCK:
       return "Operation would block";
+#endif
+#if GNULIB_defined_ESTREAMS /* native Windows platforms with older <errno.h> */
     case ETXTBSY:
       return "Text file busy";
     case ENODATA:
@@ -97,10 +99,6 @@ strerror_override (int errnum)
       return "Out of streams resources";
     case ENOSTR:
       return "Device not a stream";
-    case ENOTRECOVERABLE:
-      return "State not recoverable";
-    case EOWNERDEAD:
-      return "Owner died";
     case ETIME:
       return "Timer expired";
     case EOTHER:
@@ -283,6 +281,16 @@ strerror_override (int errnum)
       return "Operation canceled";
 #endif
 
+#if GNULIB_defined_EOWNERDEAD
+    case EOWNERDEAD:
+      return "Owner died";
+#endif
+
+#if GNULIB_defined_ENOTRECOVERABLE
+    case ENOTRECOVERABLE:
+      return "State not recoverable";
+#endif
+
     default:
       return NULL;
     }
diff --git a/src/gl/strerror-override.h b/src/gl/strerror-override.h
index 09526ea..fe1fb2c 100644
--- a/src/gl/strerror-override.h
+++ b/src/gl/strerror-override.h
@@ -30,6 +30,7 @@
    describing the error.  Otherwise return NULL.  */
 # if REPLACE_STRERROR_0 \
      || GNULIB_defined_ESOCK \
+     || GNULIB_defined_ESTREAMS \
      || GNULIB_defined_EWINSOCK \
      || GNULIB_defined_ENOMSG \
      || GNULIB_defined_EIDRM \
@@ -43,7 +44,9 @@
      || GNULIB_defined_ECONNABORTED \
      || GNULIB_defined_ESTALE \
      || GNULIB_defined_EDQUOT \
-     || GNULIB_defined_ECANCELED
+     || GNULIB_defined_ECANCELED \
+     || GNULIB_defined_EOWNERDEAD \
+     || GNULIB_defined_ENOTRECOVERABLE
 extern const char *strerror_override (int errnum);
 # else
 #  define strerror_override(ignored) NULL


hooks/post-receive
-- 
GNU shishi



reply via email to

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