diff --git a/0001-Fix-no-return-in-nonvoid-function-errors-reported-by.patch b/0001-Fix-no-return-in-nonvoid-function-errors-reported-by.patch deleted file mode 100644 index e9c3177..0000000 --- a/0001-Fix-no-return-in-nonvoid-function-errors-reported-by.patch +++ /dev/null @@ -1,39 +0,0 @@ -From ff24ad44384433611fabaa9ae9ba8ac1418fb2df Mon Sep 17 00:00:00 2001 -From: Martin Hauke -Date: Mon, 29 Aug 2016 22:26:43 +0200 -Subject: [PATCH] Fix no-return-in-nonvoid-function errors reported by RPM - postbuild check - -I: Program returns random data in a function -E: oath-toolkit no-return-in-nonvoid-function pskcverify.c:43 -E: oath-toolkit no-return-in-nonvoid-function serialno.c:45 ---- - libpskc/examples/pskcverify.c | 2 ++ - libpskc/examples/serialno.c | 2 ++ - 2 files changed, 4 insertions(+) - -diff --git a/libpskc/examples/pskcverify.c b/libpskc/examples/pskcverify.c -index 76e1b4d..4e6a2cc 100644 ---- a/libpskc/examples/pskcverify.c -+++ b/libpskc/examples/pskcverify.c -@@ -40,4 +40,6 @@ main (int argc, const char *argv[]) - - pskc_done (container); - pskc_global_done (); -+ -+ return 0; - } -diff --git a/libpskc/examples/serialno.c b/libpskc/examples/serialno.c -index 7682adb..420cab5 100644 ---- a/libpskc/examples/serialno.c -+++ b/libpskc/examples/serialno.c -@@ -42,4 +42,6 @@ main (int argc, const char *argv[]) - - pskc_done (container); - pskc_global_done (); -+ -+ return 0; - } --- -2.6.6 - diff --git a/0002-update_gnulibs_files.patch b/0002-update_gnulibs_files.patch deleted file mode 100644 index 7cf246f..0000000 --- a/0002-update_gnulibs_files.patch +++ /dev/null @@ -1,9053 +0,0 @@ -From: Simon Josefsson -Date: 2016-09-24 20:48 -Subject: Update gnulibs files -Upstream: committed 2fffce2a - -diff --git a/liboath/gl/Makefile.am b/liboath/gl/Makefile.am -index 3780889..38e256a 100644 ---- a/liboath/gl/Makefile.am -+++ b/liboath/gl/Makefile.am -@@ -396,6 +396,34 @@ AM_CFLAGS += $(CFLAG_VISIBILITY) - - ## end gnulib module lib-symbol-visibility - -+## begin gnulib module limits-h -+ -+BUILT_SOURCES += $(LIMITS_H) -+ -+# We need the following in order to create when the system -+# doesn't have one that is compatible with GNU. -+if GL_GENERATE_LIMITS_H -+limits.h: limits.in.h $(top_builddir)/config.status -+ $(AM_V_GEN)rm -f $@-t $@ && \ -+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ -+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -+ -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \ -+ < $(srcdir)/limits.in.h; \ -+ } > $@-t && \ -+ mv $@-t $@ -+else -+limits.h: $(top_builddir)/config.status -+ rm -f $@ -+endif -+MOSTLYCLEANFILES += limits.h limits.h-t -+ -+EXTRA_DIST += limits.in.h -+ -+## end gnulib module limits-h -+ - ## begin gnulib module lseek - - -@@ -730,6 +758,7 @@ stdint.h: stdint.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_STDINT_H''@|$(NEXT_STDINT_H)|g' \ -+ -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \ - -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ - -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ - -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ -diff --git a/liboath/gl/limits.in.h b/liboath/gl/limits.in.h -new file mode 100644 -index 0000000..353084a ---- /dev/null -+++ b/liboath/gl/limits.in.h -@@ -0,0 +1,63 @@ -+/* A GNU-like . -+ -+ Copyright 2016 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public License -+ as published by the Free Software Foundation; either version 2.1, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program; if not, see . */ -+ -+#ifndef _@GUARD_PREFIX@_LIMITS_H -+ -+#if __GNUC__ >= 3 -+@PRAGMA_SYSTEM_HEADER@ -+#endif -+@PRAGMA_COLUMNS@ -+ -+/* The include_next requires a split double-inclusion guard. */ -+#@INCLUDE_NEXT@ @NEXT_LIMITS_H@ -+ -+#ifndef _@GUARD_PREFIX@_LIMITS_H -+#define _@GUARD_PREFIX@_LIMITS_H -+ -+/* The number of usable bits in an unsigned or signed integer type -+ with minimum value MIN and maximum value MAX, as an int expression -+ suitable in #if. Cover all known practical hosts. This -+ implementation exploits the fact that MAX is 1 less than a power of -+ 2, and merely counts the number of 1 bits in MAX; "COBn" means -+ "count the number of 1 bits in the low-order n bits"). */ -+#define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max)) -+#define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n)) -+#define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n)) -+#define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n)) -+#define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n)) -+#define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n)) -+#define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1)) -+ -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#if (! defined ULLONG_WIDTH \ -+ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) -+# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX) -+# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX) -+# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX) -+# define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX) -+# define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX) -+# define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX) -+# define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX) -+# define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX) -+# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX) -+# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX) -+# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX) -+#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ -+ -+#endif /* _@GUARD_PREFIX@_LIMITS_H */ -+#endif /* _@GUARD_PREFIX@_LIMITS_H */ -diff --git a/liboath/gl/m4/extensions.m4 b/liboath/gl/m4/extensions.m4 -index 6d378ec..e114a6f 100644 ---- a/liboath/gl/m4/extensions.m4 -+++ b/liboath/gl/m4/extensions.m4 -@@ -1,4 +1,4 @@ --# serial 13 -*- Autoconf -*- -+# serial 15 -*- Autoconf -*- - # Enable extensions on systems that normally disable them. - - # Copyright (C) 2003, 2006-2016 Free Software Foundation, Inc. -@@ -60,7 +60,7 @@ dnl configure.ac when using autoheader 2.62. - #ifndef _ALL_SOURCE - # undef _ALL_SOURCE - #endif --/* Enable general extensions on OS X. */ -+/* Enable general extensions on macOS. */ - #ifndef _DARWIN_C_SOURCE - # undef _DARWIN_C_SOURCE - #endif -@@ -68,14 +68,38 @@ dnl configure.ac when using autoheader 2.62. - #ifndef _GNU_SOURCE - # undef _GNU_SOURCE - #endif --/* Use GNU style printf and scanf. */ --#ifndef __USE_MINGW_ANSI_STDIO --# undef __USE_MINGW_ANSI_STDIO --#endif - /* Enable threading extensions on Solaris. */ - #ifndef _POSIX_PTHREAD_SEMANTICS - # undef _POSIX_PTHREAD_SEMANTICS - #endif -+/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ -+#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ -+# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ -+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -+# undef __STDC_WANT_IEC_60559_BFP_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ -+#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ -+# undef __STDC_WANT_IEC_60559_DFP_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ -+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ -+# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ -+#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ -+# undef __STDC_WANT_IEC_60559_TYPES_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ -+#ifndef __STDC_WANT_LIB_EXT2__ -+# undef __STDC_WANT_LIB_EXT2__ -+#endif -+/* Enable extensions specified by ISO/IEC 24747:2009. */ -+#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ -+# undef __STDC_WANT_MATH_SPEC_FUNCS__ -+#endif - /* Enable extensions on HP NonStop. */ - #ifndef _TANDEM_SOURCE - # undef _TANDEM_SOURCE -@@ -104,8 +128,14 @@ dnl configure.ac when using autoheader 2.62. - AC_DEFINE([_ALL_SOURCE]) - AC_DEFINE([_DARWIN_C_SOURCE]) - AC_DEFINE([_GNU_SOURCE]) -- AC_DEFINE([__USE_MINGW_ANSI_STDIO]) - AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__]) -+ AC_DEFINE([__STDC_WANT_LIB_EXT2__]) -+ AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__]) - AC_DEFINE([_TANDEM_SOURCE]) - AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], - [ac_cv_should_define__xopen_source], -diff --git a/liboath/gl/m4/gnulib-comp.m4 b/liboath/gl/m4/gnulib-comp.m4 -index 85e38e7..3071c49 100644 ---- a/liboath/gl/m4/gnulib-comp.m4 -+++ b/liboath/gl/m4/gnulib-comp.m4 -@@ -150,6 +150,8 @@ AC_DEFUN([gl_EARLY], - AC_REQUIRE([AC_SYS_LARGEFILE]) - # Code from module lib-symbol-versions: - # Code from module lib-symbol-visibility: -+ # Code from module limits-h: -+ # Code from module limits-h-tests: - # Code from module link: - # Code from module link-tests: - # Code from module lseek: -@@ -375,6 +377,7 @@ AC_DEFUN([gl_INIT], - AC_REQUIRE([gl_LARGEFILE]) - gl_LD_VERSION_SCRIPT - gl_VISIBILITY -+ gl_LIMITS_H - gl_FUNC_LSEEK - if test $REPLACE_LSEEK = 1; then - AC_LIBOBJ([lseek]) -@@ -743,6 +746,7 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/hmac-sha512.c - lib/hmac.h - lib/itold.c -+ lib/limits.in.h - lib/lseek.c - lib/lstat.c - lib/malloc.c -@@ -856,6 +860,7 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/lib-ld.m4 - m4/lib-link.m4 - m4/lib-prefix.m4 -+ m4/limits-h.m4 - m4/link.m4 - m4/longlong.m4 - m4/lseek.m4 -@@ -986,6 +991,7 @@ AC_DEFUN([gl_FILE_LIST], [ - tests/test-init.sh - tests/test-intprops.c - tests/test-inttypes.c -+ tests/test-limits-h.c - tests/test-link.c - tests/test-link.h - tests/test-lseek.c -diff --git a/liboath/gl/m4/limits-h.m4 b/liboath/gl/m4/limits-h.m4 -new file mode 100644 -index 0000000..31fdf0a ---- /dev/null -+++ b/liboath/gl/m4/limits-h.m4 -@@ -0,0 +1,31 @@ -+dnl Check whether limits.h has needed features. -+ -+dnl Copyright 2016 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 From Paul Eggert. -+ -+AC_DEFUN_ONCE([gl_LIMITS_H], -+[ -+ gl_CHECK_NEXT_HEADERS([limits.h]) -+ -+ AC_CACHE_CHECK([whether limits.h has ULLONG_WIDTH etc.], -+ [gl_cv_header_limits_width], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM([[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -+ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 -+ #endif -+ #include -+ int ullw = ULLONG_WIDTH;]])], -+ [gl_cv_header_limits_width=yes], -+ [gl_cv_header_limits_width=no])]) -+ if test "$gl_cv_header_limits_width" = yes; then -+ LIMITS_H= -+ else -+ LIMITS_H=limits.h -+ fi -+ AC_SUBST([LIMITS_H]) -+ AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) -+]) -diff --git a/liboath/gl/m4/manywarnings.m4 b/liboath/gl/m4/manywarnings.m4 -index 90823b0..89fd0ae 100644 ---- a/liboath/gl/m4/manywarnings.m4 -+++ b/liboath/gl/m4/manywarnings.m4 -@@ -103,6 +103,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], - - gl_manywarn_set= - for gl_manywarn_item in \ -+ -fno-common \ - -W \ - -Wabi \ - -Waddress \ -diff --git a/liboath/gl/m4/stdint.m4 b/liboath/gl/m4/stdint.m4 -index 0b4b906..fa6f103 100644 ---- a/liboath/gl/m4/stdint.m4 -+++ b/liboath/gl/m4/stdint.m4 -@@ -1,4 +1,4 @@ --# stdint.m4 serial 44 -+# stdint.m4 serial 47 - dnl Copyright (C) 2001-2016 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -11,6 +11,8 @@ AC_DEFUN_ONCE([gl_STDINT_H], - [ - AC_PREREQ([2.59])dnl - -+ AC_REQUIRE([gl_LIMITS_H]) -+ - dnl Check for long long int and unsigned long long int. - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - if test $ac_cv_type_long_long_int = yes; then -@@ -282,14 +284,20 @@ static const char *macro_values[] = - ]) - ]) - fi -+ -+ HAVE_C99_STDINT_H=0 -+ HAVE_SYS_BITYPES_H=0 -+ HAVE_SYS_INTTYPES_H=0 -+ STDINT_H=stdint.h - if test "$gl_cv_header_working_stdint_h" = yes; then -+ HAVE_C99_STDINT_H=1 - dnl Now see whether the system works without - dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined. - AC_CACHE_CHECK([whether stdint.h predates C++11], - [gl_cv_header_stdint_predates_cxx11_h], - [gl_cv_header_stdint_predates_cxx11_h=yes - AC_COMPILE_IFELSE([ -- AC_LANG_PROGRAM([[ -+ AC_LANG_PROGRAM([[ - #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ - #include - ] -@@ -306,27 +314,44 @@ int32_t i32 = INT32_C (0x7fffffff); - AC_DEFINE([__STDC_LIMIT_MACROS], [1], - [Define to 1 if the system predates C++11.]) - fi -- STDINT_H= -+ AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.], -+ [gl_cv_header_stdint_width], -+ [gl_cv_header_stdint_width=no -+ AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM([[ -+ /* Work if build is not clean. */ -+ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 -+ #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -+ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 -+ #endif -+ #include -+ ]gl_STDINT_INCLUDES[ -+ int iw = UINTMAX_WIDTH; -+ ]])], -+ [gl_cv_header_stdint_width=yes])]) -+ if test "$gl_cv_header_stdint_width" = yes; then -+ STDINT_H= -+ fi - else - dnl Check for , and for - dnl (used in Linux libc4 >= 4.6.7 and libc5). - AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) - if test $ac_cv_header_sys_inttypes_h = yes; then - HAVE_SYS_INTTYPES_H=1 -- else -- HAVE_SYS_INTTYPES_H=0 - fi -- AC_SUBST([HAVE_SYS_INTTYPES_H]) - if test $ac_cv_header_sys_bitypes_h = yes; then - HAVE_SYS_BITYPES_H=1 -- else -- HAVE_SYS_BITYPES_H=0 - fi -- AC_SUBST([HAVE_SYS_BITYPES_H]) -- - gl_STDINT_TYPE_PROPERTIES -- STDINT_H=stdint.h - fi -+ -+ # The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. -+ LIMITS_H=limits.h -+ AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) -+ -+ AC_SUBST([HAVE_C99_STDINT_H]) -+ AC_SUBST([HAVE_SYS_BITYPES_H]) -+ AC_SUBST([HAVE_SYS_INTTYPES_H]) - AC_SUBST([STDINT_H]) - AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) - ]) -@@ -504,8 +529,3 @@ dnl Remove this when we can assume autoconf >= 2.61. - m4_ifdef([AC_COMPUTE_INT], [], [ - AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) - ]) -- --# Hey Emacs! --# Local Variables: --# indent-tabs-mode: nil --# End: -diff --git a/liboath/gl/m4/stdio_h.m4 b/liboath/gl/m4/stdio_h.m4 -index 0e38758..eaa25a0 100644 ---- a/liboath/gl/m4/stdio_h.m4 -+++ b/liboath/gl/m4/stdio_h.m4 -@@ -1,4 +1,4 @@ --# stdio_h.m4 serial 46 -+# stdio_h.m4 serial 48 - dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -6,9 +6,13 @@ dnl with or without modifications, as long as this notice is preserved. - - AC_DEFUN([gl_STDIO_H], - [ -- dnl For __USE_MINGW_ANSI_STDIO -- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) -- -+ AH_VERBATIM([MINGW_ANSI_STDIO], -+[/* Use GNU style printf and scanf. */ -+#ifndef __USE_MINGW_ANSI_STDIO -+# undef __USE_MINGW_ANSI_STDIO -+#endif -+]) -+ AC_DEFINE([__USE_MINGW_ANSI_STDIO]) - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - gl_NEXT_HEADERS([stdio.h]) - -diff --git a/liboath/gl/m4/sys_types_h.m4 b/liboath/gl/m4/sys_types_h.m4 -index b0aabb4..159b005 100644 ---- a/liboath/gl/m4/sys_types_h.m4 -+++ b/liboath/gl/m4/sys_types_h.m4 -@@ -1,4 +1,4 @@ --# sys_types_h.m4 serial 5 -+# sys_types_h.m4 serial 6 - dnl Copyright (C) 2011-2016 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,3 +22,28 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], - AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], - [ - ]) -+ -+# This works around a buggy version in autoconf <= 2.69. -+# See -+ -+m4_version_prereq([2.70], [], [ -+ -+# This is taken from the following Autoconf patch: -+# http://git.sv.gnu.org/cgit/autoconf.git/commit/?id=e17a30e98 -+ -+m4_undefine([AC_HEADER_MAJOR]) -+AC_DEFUN([AC_HEADER_MAJOR], -+[AC_CHECK_HEADERS_ONCE([sys/types.h]) -+AC_CHECK_HEADER([sys/mkdev.h], -+ [AC_DEFINE([MAJOR_IN_MKDEV], [1], -+ [Define to 1 if `major', `minor', and `makedev' are declared in -+ .])]) -+if test $ac_cv_header_sys_mkdev_h = no; then -+ AC_CHECK_HEADER([sys/sysmacros.h], -+ [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], -+ [Define to 1 if `major', `minor', and `makedev' are declared in -+ .])]) -+fi -+]) -+ -+]) -diff --git a/liboath/gl/stdint.in.h b/liboath/gl/stdint.in.h -index 35a41bb..2259705 100644 ---- a/liboath/gl/stdint.in.h -+++ b/liboath/gl/stdint.in.h -@@ -79,49 +79,51 @@ - #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H - #define _@GUARD_PREFIX@_STDINT_H - -+/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, -+ LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ -+#include -+ -+#if ! @HAVE_C99_STDINT_H@ -+ - /* defines some of the stdint.h types as well, on glibc, - IRIX 6.5, and OpenBSD 3.8 (via ). - AIX 5.2 isn't needed and causes troubles. - Mac OS X 10.4.6 includes (which is us), but - relies on the system definitions, so include - after @NEXT_STDINT_H@. */ --#if @HAVE_SYS_TYPES_H@ && ! defined _AIX --# include --#endif -- --/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, -- LONG_MIN, LONG_MAX, ULONG_MAX. */ --#include -+# if @HAVE_SYS_TYPES_H@ && ! defined _AIX -+# include -+# endif - --#if @HAVE_INTTYPES_H@ -+# if @HAVE_INTTYPES_H@ - /* In OpenBSD 3.8, includes , which defines - int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. - also defines intptr_t and uintptr_t. */ --# include --#elif @HAVE_SYS_INTTYPES_H@ -+# include -+# elif @HAVE_SYS_INTTYPES_H@ - /* Solaris 7 has the types except the *_fast*_t types, and - the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ --# include --#endif -+# include -+# endif - --#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ -+# if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ - /* Linux libc4 >= 4.6.7 and libc5 have a that defines - int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is - included by . */ --# include --#endif -+# include -+# endif - --#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H -+# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H - - /* Minimum and maximum values for an integer type under the usual assumption. - Return an unspecified value if BITS == 0, adding a check to pacify - picky compilers. */ - --#define _STDINT_MIN(signed, bits, zero) \ -- ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero)) -+# define _STDINT_MIN(signed, bits, zero) \ -+ ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero)) - --#define _STDINT_MAX(signed, bits, zero) \ -- (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) -+# define _STDINT_MAX(signed, bits, zero) \ -+ (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) - - #if !GNULIB_defined_stdint_types - -@@ -130,26 +132,26 @@ - /* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. */ - --#undef int8_t --#undef uint8_t -+# undef int8_t -+# undef uint8_t - typedef signed char gl_int8_t; - typedef unsigned char gl_uint8_t; --#define int8_t gl_int8_t --#define uint8_t gl_uint8_t -+# define int8_t gl_int8_t -+# define uint8_t gl_uint8_t - --#undef int16_t --#undef uint16_t -+# undef int16_t -+# undef uint16_t - typedef short int gl_int16_t; - typedef unsigned short int gl_uint16_t; --#define int16_t gl_int16_t --#define uint16_t gl_uint16_t -+# define int16_t gl_int16_t -+# define uint16_t gl_uint16_t - --#undef int32_t --#undef uint32_t -+# undef int32_t -+# undef uint32_t - typedef int gl_int32_t; - typedef unsigned int gl_uint32_t; --#define int32_t gl_int32_t --#define uint32_t gl_uint32_t -+# define int32_t gl_int32_t -+# define uint32_t gl_uint32_t - - /* If the system defines INT64_MAX, assume int64_t works. That way, - if the underlying platform defines int64_t to be a 64-bit long long -@@ -157,54 +159,54 @@ typedef unsigned int gl_uint32_t; - int, which would mess up C++ name mangling. We must use #ifdef - rather than #if, to avoid an error with HP-UX 10.20 cc. */ - --#ifdef INT64_MAX --# define GL_INT64_T --#else -+# ifdef INT64_MAX -+# define GL_INT64_T -+# else - /* Do not undefine int64_t if gnulib is not being used with 64-bit - types, since otherwise it breaks platforms like Tandem/NSK. */ --# if LONG_MAX >> 31 >> 31 == 1 --# undef int64_t -+# if LONG_MAX >> 31 >> 31 == 1 -+# undef int64_t - typedef long int gl_int64_t; --# define int64_t gl_int64_t --# define GL_INT64_T --# elif defined _MSC_VER --# undef int64_t -+# define int64_t gl_int64_t -+# define GL_INT64_T -+# elif defined _MSC_VER -+# undef int64_t - typedef __int64 gl_int64_t; --# define int64_t gl_int64_t --# define GL_INT64_T --# elif @HAVE_LONG_LONG_INT@ --# undef int64_t -+# define int64_t gl_int64_t -+# define GL_INT64_T -+# elif @HAVE_LONG_LONG_INT@ -+# undef int64_t - typedef long long int gl_int64_t; --# define int64_t gl_int64_t --# define GL_INT64_T -+# define int64_t gl_int64_t -+# define GL_INT64_T -+# endif - # endif --#endif - --#ifdef UINT64_MAX --# define GL_UINT64_T --#else --# if ULONG_MAX >> 31 >> 31 >> 1 == 1 --# undef uint64_t --typedef unsigned long int gl_uint64_t; --# define uint64_t gl_uint64_t -+# ifdef UINT64_MAX - # define GL_UINT64_T --# elif defined _MSC_VER --# undef uint64_t -+# else -+# if ULONG_MAX >> 31 >> 31 >> 1 == 1 -+# undef uint64_t -+typedef unsigned long int gl_uint64_t; -+# define uint64_t gl_uint64_t -+# define GL_UINT64_T -+# elif defined _MSC_VER -+# undef uint64_t - typedef unsigned __int64 gl_uint64_t; --# define uint64_t gl_uint64_t --# define GL_UINT64_T --# elif @HAVE_UNSIGNED_LONG_LONG_INT@ --# undef uint64_t -+# define uint64_t gl_uint64_t -+# define GL_UINT64_T -+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ -+# undef uint64_t - typedef unsigned long long int gl_uint64_t; --# define uint64_t gl_uint64_t --# define GL_UINT64_T -+# define uint64_t gl_uint64_t -+# define GL_UINT64_T -+# endif - # endif --#endif - - /* Avoid collision with Solaris 2.5.1 etc. */ --#define _UINT8_T --#define _UINT32_T --#define _UINT64_T -+# define _UINT8_T -+# define _UINT32_T -+# define _UINT64_T - - - /* 7.18.1.2. Minimum-width integer types */ -@@ -213,26 +215,26 @@ typedef unsigned long long int gl_uint64_t; - types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types - are the same as the corresponding N_t types. */ - --#undef int_least8_t --#undef uint_least8_t --#undef int_least16_t --#undef uint_least16_t --#undef int_least32_t --#undef uint_least32_t --#undef int_least64_t --#undef uint_least64_t --#define int_least8_t int8_t --#define uint_least8_t uint8_t --#define int_least16_t int16_t --#define uint_least16_t uint16_t --#define int_least32_t int32_t --#define uint_least32_t uint32_t --#ifdef GL_INT64_T --# define int_least64_t int64_t --#endif --#ifdef GL_UINT64_T --# define uint_least64_t uint64_t --#endif -+# undef int_least8_t -+# undef uint_least8_t -+# undef int_least16_t -+# undef uint_least16_t -+# undef int_least32_t -+# undef uint_least32_t -+# undef int_least64_t -+# undef uint_least64_t -+# define int_least8_t int8_t -+# define uint_least8_t uint8_t -+# define int_least16_t int16_t -+# define uint_least16_t uint16_t -+# define int_least32_t int32_t -+# define uint_least32_t uint32_t -+# ifdef GL_INT64_T -+# define int_least64_t int64_t -+# endif -+# ifdef GL_UINT64_T -+# define uint_least64_t uint64_t -+# endif - - /* 7.18.1.3. Fastest minimum-width integer types */ - -@@ -245,55 +247,55 @@ typedef unsigned long long int gl_uint64_t; - uses types consistent with glibc, as that lessens the chance of - incompatibility with older GNU hosts. */ - --#undef int_fast8_t --#undef uint_fast8_t --#undef int_fast16_t --#undef uint_fast16_t --#undef int_fast32_t --#undef uint_fast32_t --#undef int_fast64_t --#undef uint_fast64_t -+# undef int_fast8_t -+# undef uint_fast8_t -+# undef int_fast16_t -+# undef uint_fast16_t -+# undef int_fast32_t -+# undef uint_fast32_t -+# undef int_fast64_t -+# undef uint_fast64_t - typedef signed char gl_int_fast8_t; - typedef unsigned char gl_uint_fast8_t; - --#ifdef __sun -+# 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 -+# else - typedef long int gl_int_fast32_t; - typedef unsigned long int gl_uint_fast32_t; --#endif -+# 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 --#define uint_fast16_t gl_uint_fast16_t --#define int_fast32_t gl_int_fast32_t --#define uint_fast32_t gl_uint_fast32_t --#ifdef GL_INT64_T --# define int_fast64_t int64_t --#endif --#ifdef GL_UINT64_T --# define uint_fast64_t uint64_t --#endif -+# define int_fast8_t gl_int_fast8_t -+# define uint_fast8_t gl_uint_fast8_t -+# define int_fast16_t gl_int_fast16_t -+# define uint_fast16_t gl_uint_fast16_t -+# define int_fast32_t gl_int_fast32_t -+# define uint_fast32_t gl_uint_fast32_t -+# ifdef GL_INT64_T -+# define int_fast64_t int64_t -+# endif -+# ifdef GL_UINT64_T -+# define uint_fast64_t uint64_t -+# endif - - /* 7.18.1.4. Integer types capable of holding object pointers */ - - /* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own - definitions of intptr_t and uintptr_t (which use int and unsigned) - to avoid clashes with declarations of system functions like sbrk. */ --#ifndef _INTPTR_T_DECLARED --#undef intptr_t --#undef uintptr_t -+# ifndef _INTPTR_T_DECLARED -+# undef intptr_t -+# undef uintptr_t - typedef long int gl_intptr_t; - typedef unsigned long int gl_uintptr_t; --#define intptr_t gl_intptr_t --#define uintptr_t gl_uintptr_t --#endif -+# define intptr_t gl_intptr_t -+# define uintptr_t gl_uintptr_t -+# endif - - /* 7.18.1.5. Greatest-width integer types */ - -@@ -304,33 +306,33 @@ typedef unsigned long int gl_uintptr_t; - similarly for UINTMAX_MAX and uintmax_t. This avoids problems with - assuming one type where another is used by the system. */ - --#ifndef INTMAX_MAX --# undef INTMAX_C --# undef intmax_t --# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -+# ifndef INTMAX_MAX -+# undef INTMAX_C -+# undef intmax_t -+# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 - typedef long long int gl_intmax_t; --# define intmax_t gl_intmax_t --# elif defined GL_INT64_T --# define intmax_t int64_t --# else -+# define intmax_t gl_intmax_t -+# elif defined GL_INT64_T -+# define intmax_t int64_t -+# else - typedef long int gl_intmax_t; --# define intmax_t gl_intmax_t -+# define intmax_t gl_intmax_t -+# endif - # endif --#endif - --#ifndef UINTMAX_MAX --# undef UINTMAX_C --# undef uintmax_t --# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -+# ifndef UINTMAX_MAX -+# undef UINTMAX_C -+# undef uintmax_t -+# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 - typedef unsigned long long int gl_uintmax_t; --# define uintmax_t gl_uintmax_t --# elif defined GL_UINT64_T --# define uintmax_t uint64_t --# else -+# define uintmax_t gl_uintmax_t -+# elif defined GL_UINT64_T -+# define uintmax_t uint64_t -+# else - typedef unsigned long int gl_uintmax_t; --# define uintmax_t gl_uintmax_t -+# define uintmax_t gl_uintmax_t -+# endif - # endif --#endif - - /* Verify that intmax_t and uintmax_t have the same size. Too much code - breaks if this is not the case. If this check fails, the reason is likely -@@ -338,8 +340,8 @@ typedef unsigned long int gl_uintmax_t; - typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - ? 1 : -1]; - --#define GNULIB_defined_stdint_types 1 --#endif /* !GNULIB_defined_stdint_types */ -+# define GNULIB_defined_stdint_types 1 -+# endif /* !GNULIB_defined_stdint_types */ - - /* 7.18.2. Limits of specified-width integer types */ - -@@ -348,37 +350,37 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - /* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. */ - --#undef INT8_MIN --#undef INT8_MAX --#undef UINT8_MAX --#define INT8_MIN (~ INT8_MAX) --#define INT8_MAX 127 --#define UINT8_MAX 255 -- --#undef INT16_MIN --#undef INT16_MAX --#undef UINT16_MAX --#define INT16_MIN (~ INT16_MAX) --#define INT16_MAX 32767 --#define UINT16_MAX 65535 -- --#undef INT32_MIN --#undef INT32_MAX --#undef UINT32_MAX --#define INT32_MIN (~ INT32_MAX) --#define INT32_MAX 2147483647 --#define UINT32_MAX 4294967295U -- --#if defined GL_INT64_T && ! defined INT64_MAX -+# undef INT8_MIN -+# undef INT8_MAX -+# undef UINT8_MAX -+# define INT8_MIN (~ INT8_MAX) -+# define INT8_MAX 127 -+# define UINT8_MAX 255 -+ -+# undef INT16_MIN -+# undef INT16_MAX -+# undef UINT16_MAX -+# define INT16_MIN (~ INT16_MAX) -+# define INT16_MAX 32767 -+# define UINT16_MAX 65535 -+ -+# undef INT32_MIN -+# undef INT32_MAX -+# undef UINT32_MAX -+# define INT32_MIN (~ INT32_MAX) -+# define INT32_MAX 2147483647 -+# define UINT32_MAX 4294967295U -+ -+# if defined GL_INT64_T && ! defined INT64_MAX - /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 - evaluates the latter incorrectly in preprocessor expressions. */ --# define INT64_MIN (- INTMAX_C (1) << 63) --# define INT64_MAX INTMAX_C (9223372036854775807) --#endif -+# define INT64_MIN (- INTMAX_C (1) << 63) -+# define INT64_MAX INTMAX_C (9223372036854775807) -+# endif - --#if defined GL_UINT64_T && ! defined UINT64_MAX --# define UINT64_MAX UINTMAX_C (18446744073709551615) --#endif -+# if defined GL_UINT64_T && ! defined UINT64_MAX -+# define UINT64_MAX UINTMAX_C (18446744073709551615) -+# endif - - /* 7.18.2.2. Limits of minimum-width integer types */ - -@@ -386,38 +388,38 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types - are the same as the corresponding N_t types. */ - --#undef INT_LEAST8_MIN --#undef INT_LEAST8_MAX --#undef UINT_LEAST8_MAX --#define INT_LEAST8_MIN INT8_MIN --#define INT_LEAST8_MAX INT8_MAX --#define UINT_LEAST8_MAX UINT8_MAX -- --#undef INT_LEAST16_MIN --#undef INT_LEAST16_MAX --#undef UINT_LEAST16_MAX --#define INT_LEAST16_MIN INT16_MIN --#define INT_LEAST16_MAX INT16_MAX --#define UINT_LEAST16_MAX UINT16_MAX -- --#undef INT_LEAST32_MIN --#undef INT_LEAST32_MAX --#undef UINT_LEAST32_MAX --#define INT_LEAST32_MIN INT32_MIN --#define INT_LEAST32_MAX INT32_MAX --#define UINT_LEAST32_MAX UINT32_MAX -- --#undef INT_LEAST64_MIN --#undef INT_LEAST64_MAX --#ifdef GL_INT64_T --# define INT_LEAST64_MIN INT64_MIN --# define INT_LEAST64_MAX INT64_MAX --#endif -+# undef INT_LEAST8_MIN -+# undef INT_LEAST8_MAX -+# undef UINT_LEAST8_MAX -+# define INT_LEAST8_MIN INT8_MIN -+# define INT_LEAST8_MAX INT8_MAX -+# define UINT_LEAST8_MAX UINT8_MAX -+ -+# undef INT_LEAST16_MIN -+# undef INT_LEAST16_MAX -+# undef UINT_LEAST16_MAX -+# define INT_LEAST16_MIN INT16_MIN -+# define INT_LEAST16_MAX INT16_MAX -+# define UINT_LEAST16_MAX UINT16_MAX -+ -+# undef INT_LEAST32_MIN -+# undef INT_LEAST32_MAX -+# undef UINT_LEAST32_MAX -+# define INT_LEAST32_MIN INT32_MIN -+# define INT_LEAST32_MAX INT32_MAX -+# define UINT_LEAST32_MAX UINT32_MAX -+ -+# undef INT_LEAST64_MIN -+# undef INT_LEAST64_MAX -+# ifdef GL_INT64_T -+# define INT_LEAST64_MIN INT64_MIN -+# define INT_LEAST64_MAX INT64_MAX -+# endif - --#undef UINT_LEAST64_MAX --#ifdef GL_UINT64_T --# define UINT_LEAST64_MAX UINT64_MAX --#endif -+# undef UINT_LEAST64_MAX -+# ifdef GL_UINT64_T -+# define UINT_LEAST64_MAX UINT64_MAX -+# endif - - /* 7.18.2.3. Limits of fastest minimum-width integer types */ - -@@ -425,117 +427,117 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types - are taken from the same list of types. */ - --#undef INT_FAST8_MIN --#undef INT_FAST8_MAX --#undef UINT_FAST8_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 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 --#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_FAST8_MIN -+# undef INT_FAST8_MAX -+# undef UINT_FAST8_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 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 -+# 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 --#ifdef GL_INT64_T --# define INT_FAST64_MIN INT64_MIN --# define INT_FAST64_MAX INT64_MAX --#endif -+# undef INT_FAST64_MIN -+# undef INT_FAST64_MAX -+# ifdef GL_INT64_T -+# define INT_FAST64_MIN INT64_MIN -+# define INT_FAST64_MAX INT64_MAX -+# endif - --#undef UINT_FAST64_MAX --#ifdef GL_UINT64_T --# define UINT_FAST64_MAX UINT64_MAX --#endif -+# undef UINT_FAST64_MAX -+# ifdef GL_UINT64_T -+# define UINT_FAST64_MAX UINT64_MAX -+# endif - - /* 7.18.2.4. Limits of integer types capable of holding object pointers */ - --#undef INTPTR_MIN --#undef INTPTR_MAX --#undef UINTPTR_MAX --#define INTPTR_MIN LONG_MIN --#define INTPTR_MAX LONG_MAX --#define UINTPTR_MAX ULONG_MAX -+# undef INTPTR_MIN -+# undef INTPTR_MAX -+# undef UINTPTR_MAX -+# define INTPTR_MIN LONG_MIN -+# define INTPTR_MAX LONG_MAX -+# define UINTPTR_MAX ULONG_MAX - - /* 7.18.2.5. Limits of greatest-width integer types */ - --#ifndef INTMAX_MAX --# undef INTMAX_MIN --# ifdef INT64_MAX --# define INTMAX_MIN INT64_MIN --# define INTMAX_MAX INT64_MAX --# else --# define INTMAX_MIN INT32_MIN --# define INTMAX_MAX INT32_MAX -+# ifndef INTMAX_MAX -+# undef INTMAX_MIN -+# ifdef INT64_MAX -+# define INTMAX_MIN INT64_MIN -+# define INTMAX_MAX INT64_MAX -+# else -+# define INTMAX_MIN INT32_MIN -+# define INTMAX_MAX INT32_MAX -+# endif - # endif --#endif - --#ifndef UINTMAX_MAX --# ifdef UINT64_MAX --# define UINTMAX_MAX UINT64_MAX --# else --# define UINTMAX_MAX UINT32_MAX -+# ifndef UINTMAX_MAX -+# ifdef UINT64_MAX -+# define UINTMAX_MAX UINT64_MAX -+# else -+# define UINTMAX_MAX UINT32_MAX -+# endif - # endif --#endif - - /* 7.18.3. Limits of other integer types */ - - /* ptrdiff_t limits */ --#undef PTRDIFF_MIN --#undef PTRDIFF_MAX --#if @APPLE_UNIVERSAL_BUILD@ --# ifdef _LP64 --# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) --# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) -+# undef PTRDIFF_MIN -+# undef PTRDIFF_MAX -+# if @APPLE_UNIVERSAL_BUILD@ -+# ifdef _LP64 -+# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) -+# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) -+# else -+# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) -+# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) -+# endif - # else --# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) --# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) --# endif --#else --# define PTRDIFF_MIN \ -+# define PTRDIFF_MIN \ - _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) --# define PTRDIFF_MAX \ -+# define PTRDIFF_MAX \ - _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) --#endif -+# endif - - /* sig_atomic_t limits */ --#undef SIG_ATOMIC_MIN --#undef SIG_ATOMIC_MAX --#define SIG_ATOMIC_MIN \ -+# undef SIG_ATOMIC_MIN -+# undef SIG_ATOMIC_MAX -+# define SIG_ATOMIC_MIN \ - _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) --#define SIG_ATOMIC_MAX \ -+# define SIG_ATOMIC_MAX \ - _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) - - - /* size_t limit */ --#undef SIZE_MAX --#if @APPLE_UNIVERSAL_BUILD@ --# ifdef _LP64 --# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) -+# undef SIZE_MAX -+# if @APPLE_UNIVERSAL_BUILD@ -+# ifdef _LP64 -+# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) -+# else -+# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) -+# endif - # else --# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) -+# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) - # endif --#else --# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) --#endif - - /* wchar_t limits */ - /* Get WCHAR_MIN, WCHAR_MAX. -@@ -543,29 +545,29 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - sequence of nested includes - -> -> -> , and the latter includes - and assumes its types are already defined. */ --#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) -+# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ --# include --# include --# include --# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H --# include --# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H --#endif --#undef WCHAR_MIN --#undef WCHAR_MAX --#define WCHAR_MIN \ -+# include -+# include -+# include -+# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -+# include -+# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -+# endif -+# undef WCHAR_MIN -+# undef WCHAR_MAX -+# define WCHAR_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) --#define WCHAR_MAX \ -+# define WCHAR_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) - - /* wint_t limits */ --#undef WINT_MIN --#undef WINT_MAX --#define WINT_MIN \ -+# undef WINT_MIN -+# undef WINT_MAX -+# define WINT_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) --#define WINT_MAX \ -+# define WINT_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) - - /* 7.18.4. Macros for integer constants */ -@@ -576,59 +578,120 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - /* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ - --#undef INT8_C --#undef UINT8_C --#define INT8_C(x) x --#define UINT8_C(x) x -- --#undef INT16_C --#undef UINT16_C --#define INT16_C(x) x --#define UINT16_C(x) x -- --#undef INT32_C --#undef UINT32_C --#define INT32_C(x) x --#define UINT32_C(x) x ## U -- --#undef INT64_C --#undef UINT64_C --#if LONG_MAX >> 31 >> 31 == 1 --# define INT64_C(x) x##L --#elif defined _MSC_VER --# define INT64_C(x) x##i64 --#elif @HAVE_LONG_LONG_INT@ --# define INT64_C(x) x##LL --#endif --#if ULONG_MAX >> 31 >> 31 >> 1 == 1 --# define UINT64_C(x) x##UL --#elif defined _MSC_VER --# define UINT64_C(x) x##ui64 --#elif @HAVE_UNSIGNED_LONG_LONG_INT@ --# define UINT64_C(x) x##ULL --#endif -+# undef INT8_C -+# undef UINT8_C -+# define INT8_C(x) x -+# define UINT8_C(x) x -+ -+# undef INT16_C -+# undef UINT16_C -+# define INT16_C(x) x -+# define UINT16_C(x) x -+ -+# undef INT32_C -+# undef UINT32_C -+# define INT32_C(x) x -+# define UINT32_C(x) x ## U -+ -+# undef INT64_C -+# undef UINT64_C -+# if LONG_MAX >> 31 >> 31 == 1 -+# define INT64_C(x) x##L -+# elif defined _MSC_VER -+# define INT64_C(x) x##i64 -+# elif @HAVE_LONG_LONG_INT@ -+# define INT64_C(x) x##LL -+# endif -+# if ULONG_MAX >> 31 >> 31 >> 1 == 1 -+# define UINT64_C(x) x##UL -+# elif defined _MSC_VER -+# define UINT64_C(x) x##ui64 -+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ -+# define UINT64_C(x) x##ULL -+# endif - - /* 7.18.4.2. Macros for greatest-width integer constants */ - --#ifndef INTMAX_C --# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 --# define INTMAX_C(x) x##LL --# elif defined GL_INT64_T --# define INTMAX_C(x) INT64_C(x) --# else --# define INTMAX_C(x) x##L -+# ifndef INTMAX_C -+# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -+# define INTMAX_C(x) x##LL -+# elif defined GL_INT64_T -+# define INTMAX_C(x) INT64_C(x) -+# else -+# define INTMAX_C(x) x##L -+# endif - # endif --#endif - --#ifndef UINTMAX_C --# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 --# define UINTMAX_C(x) x##ULL --# elif defined GL_UINT64_T --# define UINTMAX_C(x) UINT64_C(x) --# else --# define UINTMAX_C(x) x##UL -+# ifndef UINTMAX_C -+# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -+# define UINTMAX_C(x) x##ULL -+# elif defined GL_UINT64_T -+# define UINTMAX_C(x) UINT64_C(x) -+# else -+# define UINTMAX_C(x) x##UL -+# endif - # endif --#endif -+ -+#endif /* !@HAVE_C99_STDINT_H@ */ -+ -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#if (!defined UINTMAX_WIDTH \ -+ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) -+# ifdef INT8_MAX -+# define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX) -+# endif -+# ifdef UINT8_MAX -+# define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX) -+# endif -+# ifdef INT16_MAX -+# define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX) -+# endif -+# ifdef UINT16_MAX -+# define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX) -+# endif -+# ifdef INT32_MAX -+# define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX) -+# endif -+# ifdef UINT32_MAX -+# define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX) -+# endif -+# ifdef INT64_MAX -+# define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX) -+# endif -+# ifdef UINT64_MAX -+# define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX) -+# endif -+# define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX) -+# define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX) -+# define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX) -+# define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX) -+# define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX) -+# define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX) -+# define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX) -+# define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX) -+# define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX) -+# define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX) -+# define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX) -+# define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX) -+# define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX) -+# define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX) -+# define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX) -+# define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX) -+# define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX) -+# define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX) -+# define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX) -+# define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX) -+# define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX) -+# define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX) -+# define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX) -+# ifdef WINT_MAX -+# define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX) -+# endif -+# ifdef SIG_ATOMIC_MAX -+# define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX) -+# endif -+#endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ - - #endif /* _@GUARD_PREFIX@_STDINT_H */ - #endif /* !(defined __ANDROID__ && ...) */ -diff --git a/liboath/gl/strverscmp.c b/liboath/gl/strverscmp.c -index f1e3594..d0f9644 100644 ---- a/liboath/gl/strverscmp.c -+++ b/liboath/gl/strverscmp.c -@@ -1,21 +1,21 @@ --/* Compare strings while treating digits numerically. -*- coding: utf-8 -*- -- Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2016 Free Software -- Foundation, Inc. -+/* Compare strings while treating digits characters numerically. -+ Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jean-François Bignolles , 1997. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU Lesser General Public License as published by -- the Free Software Foundation; either version 2.1, 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 Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 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 Lesser General Public License for more details. -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU Lesser General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ - - #if !_LIBC - # include -@@ -26,27 +26,14 @@ - - /* states: S_N: normal, S_I: comparing integral part, S_F: comparing - fractional parts, S_Z: idem but with leading Zeroes only */ --#define S_N 0x0 --#define S_I 0x4 --#define S_F 0x8 --#define S_Z 0xC -+#define S_N 0x0 -+#define S_I 0x3 -+#define S_F 0x6 -+#define S_Z 0x9 - - /* result_type: CMP: return diff; LEN: compare using len_diff/diff */ --#define CMP 2 --#define LEN 3 -- -- --/* ISDIGIT differs from isdigit, as follows: -- - Its arg may be any int or unsigned int; it need not be an unsigned char -- or EOF. -- - It's typically faster. -- POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to -- isdigit unless it's important to use the locale's definition -- of "digit" even when the host does not conform to POSIX. */ --#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) -- --#undef __strverscmp --#undef strverscmp -+#define CMP 2 -+#define LEN 3 - - #ifndef weak_alias - # define __strverscmp strverscmp -@@ -66,30 +53,25 @@ __strverscmp (const char *s1, const char *s2) - int state; - int diff; - -- /* Symbol(s) 0 [1-9] others (padding) -- Transition (10) 0 (01) d (00) x (11) - */ -- static const unsigned int next_state[] = -+ /* Symbol(s) 0 [1-9] others -+ Transition (10) 0 (01) d (00) x */ -+ static const unsigned char next_state[] = - { -- /* state x d 0 - */ -- /* S_N */ S_N, S_I, S_Z, S_N, -- /* S_I */ S_N, S_I, S_I, S_I, -- /* S_F */ S_N, S_F, S_F, S_F, -- /* S_Z */ S_N, S_F, S_Z, S_Z -+ /* state x d 0 */ -+ /* S_N */ S_N, S_I, S_Z, -+ /* S_I */ S_N, S_I, S_I, -+ /* S_F */ S_N, S_F, S_F, -+ /* S_Z */ S_N, S_F, S_Z - }; - -- static const int result_type[] = -+ static const signed char result_type[] = - { -- /* state x/x x/d x/0 x/- d/x d/d d/0 d/- -- 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */ -- -- /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, -- CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, -- /* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP, -- 1, LEN, LEN, CMP, CMP, CMP, CMP, CMP, -- /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, -- CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, -- /* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP, -- -1, CMP, CMP, CMP -+ /* state x/x x/d x/0 d/x d/d d/0 0/x 0/d 0/0 */ -+ -+ /* S_N */ CMP, CMP, CMP, CMP, LEN, CMP, CMP, CMP, CMP, -+ /* S_I */ CMP, -1, -1, +1, LEN, LEN, +1, LEN, LEN, -+ /* S_F */ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, -+ /* S_Z */ CMP, +1, +1, -1, CMP, CMP, -1, CMP, CMP - }; - - if (p1 == p2) -@@ -98,17 +80,20 @@ __strverscmp (const char *s1, const char *s2) - c1 = *p1++; - c2 = *p2++; - /* Hint: '0' is a digit too. */ -- state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0)); -+ state = S_N + ((c1 == '0') + (isdigit (c1) != 0)); - -- while ((diff = c1 - c2) == 0 && c1 != '\0') -+ while ((diff = c1 - c2) == 0) - { -+ if (c1 == '\0') -+ return diff; -+ - state = next_state[state]; - c1 = *p1++; - c2 = *p2++; -- state |= (c1 == '0') + (ISDIGIT (c1) != 0); -+ state += (c1 == '0') + (isdigit (c1) != 0); - } - -- state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))]; -+ state = result_type[state * 3 + (((c2 == '0') + (isdigit (c2) != 0)))]; - - switch (state) - { -@@ -116,16 +101,17 @@ __strverscmp (const char *s1, const char *s2) - return diff; - - case LEN: -- while (ISDIGIT (*p1++)) -- if (!ISDIGIT (*p2++)) -+ while (isdigit (*p1++)) -+ if (!isdigit (*p2++)) - return 1; - -- return ISDIGIT (*p2) ? -1 : diff; -+ return isdigit (*p2) ? -1 : diff; - - default: - return state; - } - } - #ifdef weak_alias -+libc_hidden_def (__strverscmp) - weak_alias (__strverscmp, strverscmp) - #endif -diff --git a/liboath/gl/tests/Makefile.am b/liboath/gl/tests/Makefile.am -index 03515e8..3f486b0 100644 ---- a/liboath/gl/tests/Makefile.am -+++ b/liboath/gl/tests/Makefile.am -@@ -658,6 +658,14 @@ EXTRA_DIST += test-inttypes.c - - ## end gnulib module inttypes-tests - -+## begin gnulib module limits-h-tests -+ -+TESTS += test-limits-h -+check_PROGRAMS += test-limits-h -+EXTRA_DIST += test-limits-h.c -+ -+## end gnulib module limits-h-tests -+ - ## begin gnulib module link - - -diff --git a/liboath/gl/tests/intprops.h b/liboath/gl/tests/intprops.h -index e1fce5c..f057105 100644 ---- a/liboath/gl/tests/intprops.h -+++ b/liboath/gl/tests/intprops.h -@@ -23,6 +23,10 @@ - #include - #include - -+#ifndef __has_builtin -+# define __has_builtin(x) 0 -+#endif -+ - /* Return a value with the common real type of E and V and the value of V. */ - #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) - -@@ -47,12 +51,16 @@ - - /* Minimum and maximum values for integer types and expressions. */ - -+/* The width in bits of the integer type or expression T. -+ Padding bits are not supported; this is checked at compile-time below. */ -+#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) -+ - /* The maximum and minimum values for the integer type T. */ - #define TYPE_MINIMUM(t) ((t) ~ 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 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1))) - - /* The maximum and minimum values for the type of the expression E, - after integer promotion. E should not have side effects. */ -@@ -65,7 +73,13 @@ - ? _GL_SIGNED_INT_MAXIMUM (e) \ - : _GL_INT_NEGATE_CONVERT (e, 1)) - #define _GL_SIGNED_INT_MAXIMUM(e) \ -- (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1) -+ (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1) -+ -+/* Work around OpenVMS incompatibility with C99. */ -+#if !defined LLONG_MAX && defined __INT64_MAX -+# define LLONG_MAX __INT64_MAX -+# define LLONG_MIN __INT64_MIN -+#endif - - /* This include file assumes that signed types are two's complement without - padding bits; the above macros have undefined behavior otherwise. -@@ -84,6 +98,10 @@ verify (TYPE_MAXIMUM (long int) == LONG_MAX); - verify (TYPE_MINIMUM (long long int) == LLONG_MIN); - verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - #endif -+/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */ -+#ifdef UINT_WIDTH -+verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); -+#endif - - /* Does the __typeof__ keyword work? This could be done by - 'configure', but for now it's easier to do it by hand. */ -@@ -116,8 +134,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - signed, this macro may overestimate the true bound by one byte when - applied to unsigned types of size 2, 4, 16, ... bytes. */ - #define INT_STRLEN_BOUND(t) \ -- (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \ -- - _GL_SIGNED_TYPE_OR_EXPR (t)) \ -+ (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \ - + _GL_SIGNED_TYPE_OR_EXPR (t)) - - /* Bound on buffer size needed to represent an integer type or expression T, -@@ -222,20 +239,25 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - ? (a) < (min) >> (b) \ - : (max) >> (b) < (a)) - --/* True if __builtin_add_overflow (A, B, P) works when P is null. */ --#define _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL (7 <= __GNUC__) -+/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ -+#define _GL_HAS_BUILTIN_OVERFLOW \ -+ (5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)) -+ -+/* True if __builtin_add_overflow_p (A, B, C) works. */ -+#define _GL_HAS_BUILTIN_OVERFLOW_P \ -+ (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) - - /* The _GL*_OVERFLOW macros have the same restrictions as the - *_RANGE_OVERFLOW macros, except that they do not assume that operands - (e.g., A and B) have the same type as MIN and MAX. Instead, they assume - that the result (e.g., A + B) has that type. */ --#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL --# define _GL_ADD_OVERFLOW(a, b, min, max) -- __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0) --# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) -- __builtin_sub_overflow (a, b, (__typeof__ ((a) - (b)) *) 0) --# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) -- __builtin_mul_overflow (a, b, (__typeof__ ((a) * (b)) *) 0) -+#if _GL_HAS_BUILTIN_OVERFLOW_P -+# define _GL_ADD_OVERFLOW(a, b, min, max) \ -+ __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0) -+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ -+ __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0) -+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ -+ __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0) - #else - # define _GL_ADD_OVERFLOW(a, b, min, max) \ - ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ -@@ -315,7 +337,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) - #define INT_SUBTRACT_OVERFLOW(a, b) \ - _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) --#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL -+#if _GL_HAS_BUILTIN_OVERFLOW_P - # define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a) - #else - # define INT_NEGATE_OVERFLOW(a) \ -@@ -349,10 +371,6 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - #define INT_MULTIPLY_WRAPV(a, b, r) \ - _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW) - --#ifndef __has_builtin --# define __has_builtin(x) 0 --#endif -- - /* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 - https://llvm.org/bugs/show_bug.cgi?id=25390 -@@ -369,7 +387,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - the operation. BUILTIN is the builtin operation, and OVERFLOW the - overflow predicate. Return 1 if the result overflows. See above - for restrictions. */ --#if 5 <= __GNUC__ || __has_builtin (__builtin_add_overflow) -+#if _GL_HAS_BUILTIN_OVERFLOW - # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r) - #elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS - # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ -@@ -412,7 +430,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - # else - # define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ -- long int, LONG_MIN, LONG_MAX)) -+ long int, LONG_MIN, LONG_MAX) - # endif - #endif - -diff --git a/liboath/gl/tests/test-limits-h.c b/liboath/gl/tests/test-limits-h.c -new file mode 100644 -index 0000000..597dabf ---- /dev/null -+++ b/liboath/gl/tests/test-limits-h.c -@@ -0,0 +1,46 @@ -+/* Test of substitute. -+ Copyright 2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* Written by Paul Eggert. */ -+ -+#include -+ -+#include -+ -+#include "verify.h" -+ -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#define verify_width(width, min, max) \ -+ verify ((max) >> ((width) - 1 - ((min) < 0)) == 1) -+ -+verify_width (CHAR_WIDTH, CHAR_MIN, CHAR_MAX); -+verify_width (SCHAR_WIDTH, SCHAR_MIN, SCHAR_MAX); -+verify_width (UCHAR_WIDTH, 0, UCHAR_MAX); -+verify_width (SHRT_WIDTH, SHRT_MIN, SHRT_MAX); -+verify_width (USHRT_WIDTH, 0, USHRT_MAX); -+verify_width (INT_WIDTH, INT_MIN, INT_MAX); -+verify_width (UINT_WIDTH, 0, UINT_MAX); -+verify_width (LONG_WIDTH, LONG_MIN, LONG_MAX); -+verify_width (ULONG_WIDTH, 0, ULONG_MAX); -+verify_width (LLONG_WIDTH, LLONG_MIN, LLONG_MAX); -+verify_width (ULLONG_WIDTH, 0, ULLONG_MAX); -+ -+int -+main (void) -+{ -+ return 0; -+} -diff --git a/liboath/gl/tests/test-stdint.c b/liboath/gl/tests/test-stdint.c -index 7705fc7..c0e2f08 100644 ---- a/liboath/gl/tests/test-stdint.c -+++ b/liboath/gl/tests/test-stdint.c -@@ -351,6 +351,64 @@ verify_same_types (INTMAX_C (17), (intmax_t)0 + 0); - verify (UINTMAX_C (17) == 17); - verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0); - -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#define verify_width(width, min, max) \ -+ verify ((max) >> ((width) - 1 - ((min) < 0)) == 1) -+ -+#ifdef INT8_MAX -+verify_width (INT8_WIDTH, INT8_MIN, INT8_MAX); -+#endif -+#ifdef UINT8_MAX -+verify_width (UINT8_WIDTH, 0, UINT8_MAX); -+#endif -+#ifdef INT16_MAX -+verify_width (INT16_WIDTH, INT16_MIN, INT16_MAX); -+#endif -+#ifdef UINT16_MAX -+verify_width (UINT16_WIDTH, 0, UINT16_MAX); -+#endif -+#ifdef INT32_MAX -+verify_width (INT32_WIDTH, INT32_MIN, INT32_MAX); -+#endif -+#ifdef UINT32_MAX -+verify_width (UINT32_WIDTH, 0, UINT32_MAX); -+#endif -+#ifdef INT64_MAX -+verify_width (INT64_WIDTH, INT64_MIN, INT64_MAX); -+#endif -+#ifdef UINT64_MAX -+verify_width (UINT64_WIDTH, 0, UINT64_MAX); -+#endif -+verify_width (INT_LEAST8_WIDTH, INT_LEAST8_MIN, INT_LEAST8_MAX); -+verify_width (UINT_LEAST8_WIDTH, 0, UINT_LEAST8_MAX); -+verify_width (INT_LEAST16_WIDTH, INT_LEAST16_MIN, INT_LEAST16_MAX); -+verify_width (UINT_LEAST16_WIDTH, 0, UINT_LEAST16_MAX); -+verify_width (INT_LEAST32_WIDTH, INT_LEAST32_MIN, INT_LEAST32_MAX); -+verify_width (UINT_LEAST32_WIDTH, 0, UINT_LEAST32_MAX); -+verify_width (INT_LEAST64_WIDTH, INT_LEAST64_MIN, INT_LEAST64_MAX); -+verify_width (UINT_LEAST64_WIDTH, 0, UINT_LEAST64_MAX); -+verify_width (INT_FAST8_WIDTH, INT_FAST8_MIN, INT_FAST8_MAX); -+verify_width (UINT_FAST8_WIDTH, 0, UINT_FAST8_MAX); -+verify_width (INT_FAST16_WIDTH, INT_FAST16_MIN, INT_FAST16_MAX); -+verify_width (UINT_FAST16_WIDTH, 0, UINT_FAST16_MAX); -+verify_width (INT_FAST32_WIDTH, INT_FAST32_MIN, INT_FAST32_MAX); -+verify_width (UINT_FAST32_WIDTH, 0, UINT_FAST32_MAX); -+verify_width (INT_FAST64_WIDTH, INT_FAST64_MIN, INT_FAST64_MAX); -+verify_width (UINT_FAST64_WIDTH, 0, UINT_FAST64_MAX); -+verify_width (INTPTR_WIDTH, INTPTR_MIN, INTPTR_MAX); -+verify_width (UINTPTR_WIDTH, 0, UINTPTR_MAX); -+verify_width (INTMAX_WIDTH, INTMAX_MIN, INTMAX_MAX); -+verify_width (UINTMAX_WIDTH, 0, UINTMAX_MAX); -+verify_width (PTRDIFF_WIDTH, PTRDIFF_MIN, PTRDIFF_MAX); -+verify_width (SIZE_WIDTH, 0, SIZE_MAX); -+verify_width (WCHAR_WIDTH, WCHAR_MIN, WCHAR_MAX); -+#ifdef WINT_MAX -+verify_width (WINT_WIDTH, WINT_MIN, WINT_MAX); -+#endif -+#ifdef SIG_ATOMIC_MAX -+verify_width (SIG_ATOMIC_WIDTH, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX); -+#endif - - int - main (void) -diff --git a/liboath/gl/tests/test-strverscmp.c b/liboath/gl/tests/test-strverscmp.c -index e5a6bb1..0cafe08 100644 ---- a/liboath/gl/tests/test-strverscmp.c -+++ b/liboath/gl/tests/test-strverscmp.c -@@ -41,5 +41,19 @@ main (void) - ASSERT (strverscmp ("09", "0") < 0); - ASSERT (strverscmp ("9", "10") < 0); - ASSERT (strverscmp ("0a", "0") > 0); -+ -+ /* From glibc bug 9913. */ -+ { -+ static char const a[] = "B0075022800016.gbp.corp.com"; -+ static char const b[] = "B007502280067.gbp.corp.com"; -+ static char const c[] = "B007502357019.GBP.CORP.COM"; -+ ASSERT (strverscmp (a, b) < 0); -+ ASSERT (strverscmp (b, c) < 0); -+ ASSERT (strverscmp (a, c) < 0); -+ ASSERT (strverscmp (b, a) > 0); -+ ASSERT (strverscmp (c, b) > 0); -+ ASSERT (strverscmp (c, a) > 0); -+ } -+ - return 0; - } -diff --git a/libpskc/gl/Makefile.am b/libpskc/gl/Makefile.am -index 9c16575..4279e64 100644 ---- a/libpskc/gl/Makefile.am -+++ b/libpskc/gl/Makefile.am -@@ -94,6 +94,34 @@ AM_CFLAGS += $(CFLAG_VISIBILITY) - - ## end gnulib module lib-symbol-visibility - -+## begin gnulib module limits-h -+ -+BUILT_SOURCES += $(LIMITS_H) -+ -+# We need the following in order to create when the system -+# doesn't have one that is compatible with GNU. -+if GL_GENERATE_LIMITS_H -+limits.h: limits.in.h $(top_builddir)/config.status -+ $(AM_V_GEN)rm -f $@-t $@ && \ -+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ -+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -+ -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \ -+ < $(srcdir)/limits.in.h; \ -+ } > $@-t && \ -+ mv $@-t $@ -+else -+limits.h: $(top_builddir)/config.status -+ rm -f $@ -+endif -+MOSTLYCLEANFILES += limits.h limits.h-t -+ -+EXTRA_DIST += limits.in.h -+ -+## end gnulib module limits-h -+ - ## begin gnulib module memchr - - -@@ -248,6 +276,7 @@ stdint.h: stdint.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_STDINT_H''@|$(NEXT_STDINT_H)|g' \ -+ -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \ - -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ - -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ - -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ -diff --git a/libpskc/gl/intprops.h b/libpskc/gl/intprops.h -index feb02c3..9734d07 100644 ---- a/libpskc/gl/intprops.h -+++ b/libpskc/gl/intprops.h -@@ -23,6 +23,10 @@ - #include - #include - -+#ifndef __has_builtin -+# define __has_builtin(x) 0 -+#endif -+ - /* Return a value with the common real type of E and V and the value of V. */ - #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) - -@@ -47,12 +51,16 @@ - - /* Minimum and maximum values for integer types and expressions. */ - -+/* The width in bits of the integer type or expression T. -+ Padding bits are not supported; this is checked at compile-time below. */ -+#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) -+ - /* The maximum and minimum values for the integer type T. */ - #define TYPE_MINIMUM(t) ((t) ~ 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 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1))) - - /* The maximum and minimum values for the type of the expression E, - after integer promotion. E should not have side effects. */ -@@ -65,7 +73,13 @@ - ? _GL_SIGNED_INT_MAXIMUM (e) \ - : _GL_INT_NEGATE_CONVERT (e, 1)) - #define _GL_SIGNED_INT_MAXIMUM(e) \ -- (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1) -+ (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1) -+ -+/* Work around OpenVMS incompatibility with C99. */ -+#if !defined LLONG_MAX && defined __INT64_MAX -+# define LLONG_MAX __INT64_MAX -+# define LLONG_MIN __INT64_MIN -+#endif - - /* This include file assumes that signed types are two's complement without - padding bits; the above macros have undefined behavior otherwise. -@@ -84,6 +98,10 @@ verify (TYPE_MAXIMUM (long int) == LONG_MAX); - verify (TYPE_MINIMUM (long long int) == LLONG_MIN); - verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - #endif -+/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */ -+#ifdef UINT_WIDTH -+verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); -+#endif - - /* Does the __typeof__ keyword work? This could be done by - 'configure', but for now it's easier to do it by hand. */ -@@ -116,8 +134,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - signed, this macro may overestimate the true bound by one byte when - applied to unsigned types of size 2, 4, 16, ... bytes. */ - #define INT_STRLEN_BOUND(t) \ -- (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \ -- - _GL_SIGNED_TYPE_OR_EXPR (t)) \ -+ (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \ - + _GL_SIGNED_TYPE_OR_EXPR (t)) - - /* Bound on buffer size needed to represent an integer type or expression T, -@@ -222,20 +239,25 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - ? (a) < (min) >> (b) \ - : (max) >> (b) < (a)) - --/* True if __builtin_add_overflow (A, B, P) works when P is null. */ --#define _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL (7 <= __GNUC__) -+/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ -+#define _GL_HAS_BUILTIN_OVERFLOW \ -+ (5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)) -+ -+/* True if __builtin_add_overflow_p (A, B, C) works. */ -+#define _GL_HAS_BUILTIN_OVERFLOW_P \ -+ (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) - - /* The _GL*_OVERFLOW macros have the same restrictions as the - *_RANGE_OVERFLOW macros, except that they do not assume that operands - (e.g., A and B) have the same type as MIN and MAX. Instead, they assume - that the result (e.g., A + B) has that type. */ --#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL --# define _GL_ADD_OVERFLOW(a, b, min, max) -- __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0) --# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) -- __builtin_sub_overflow (a, b, (__typeof__ ((a) - (b)) *) 0) --# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) -- __builtin_mul_overflow (a, b, (__typeof__ ((a) * (b)) *) 0) -+#if _GL_HAS_BUILTIN_OVERFLOW_P -+# define _GL_ADD_OVERFLOW(a, b, min, max) \ -+ __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0) -+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ -+ __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0) -+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ -+ __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0) - #else - # define _GL_ADD_OVERFLOW(a, b, min, max) \ - ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ -@@ -315,7 +337,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) - #define INT_SUBTRACT_OVERFLOW(a, b) \ - _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) --#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL -+#if _GL_HAS_BUILTIN_OVERFLOW_P - # define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a) - #else - # define INT_NEGATE_OVERFLOW(a) \ -@@ -349,10 +371,6 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - #define INT_MULTIPLY_WRAPV(a, b, r) \ - _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW) - --#ifndef __has_builtin --# define __has_builtin(x) 0 --#endif -- - /* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 - https://llvm.org/bugs/show_bug.cgi?id=25390 -@@ -369,7 +387,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - the operation. BUILTIN is the builtin operation, and OVERFLOW the - overflow predicate. Return 1 if the result overflows. See above - for restrictions. */ --#if 5 <= __GNUC__ || __has_builtin (__builtin_add_overflow) -+#if _GL_HAS_BUILTIN_OVERFLOW - # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r) - #elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS - # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ -@@ -412,7 +430,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - # else - # define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ -- long int, LONG_MIN, LONG_MAX)) -+ long int, LONG_MIN, LONG_MAX) - # endif - #endif - -diff --git a/libpskc/gl/limits.in.h b/libpskc/gl/limits.in.h -new file mode 100644 -index 0000000..353084a ---- /dev/null -+++ b/libpskc/gl/limits.in.h -@@ -0,0 +1,63 @@ -+/* A GNU-like . -+ -+ Copyright 2016 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public License -+ as published by the Free Software Foundation; either version 2.1, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program; if not, see . */ -+ -+#ifndef _@GUARD_PREFIX@_LIMITS_H -+ -+#if __GNUC__ >= 3 -+@PRAGMA_SYSTEM_HEADER@ -+#endif -+@PRAGMA_COLUMNS@ -+ -+/* The include_next requires a split double-inclusion guard. */ -+#@INCLUDE_NEXT@ @NEXT_LIMITS_H@ -+ -+#ifndef _@GUARD_PREFIX@_LIMITS_H -+#define _@GUARD_PREFIX@_LIMITS_H -+ -+/* The number of usable bits in an unsigned or signed integer type -+ with minimum value MIN and maximum value MAX, as an int expression -+ suitable in #if. Cover all known practical hosts. This -+ implementation exploits the fact that MAX is 1 less than a power of -+ 2, and merely counts the number of 1 bits in MAX; "COBn" means -+ "count the number of 1 bits in the low-order n bits"). */ -+#define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max)) -+#define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n)) -+#define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n)) -+#define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n)) -+#define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n)) -+#define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n)) -+#define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1)) -+ -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#if (! defined ULLONG_WIDTH \ -+ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) -+# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX) -+# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX) -+# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX) -+# define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX) -+# define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX) -+# define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX) -+# define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX) -+# define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX) -+# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX) -+# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX) -+# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX) -+#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ -+ -+#endif /* _@GUARD_PREFIX@_LIMITS_H */ -+#endif /* _@GUARD_PREFIX@_LIMITS_H */ -diff --git a/libpskc/gl/m4/extensions.m4 b/libpskc/gl/m4/extensions.m4 -index 6d378ec..e114a6f 100644 ---- a/libpskc/gl/m4/extensions.m4 -+++ b/libpskc/gl/m4/extensions.m4 -@@ -1,4 +1,4 @@ --# serial 13 -*- Autoconf -*- -+# serial 15 -*- Autoconf -*- - # Enable extensions on systems that normally disable them. - - # Copyright (C) 2003, 2006-2016 Free Software Foundation, Inc. -@@ -60,7 +60,7 @@ dnl configure.ac when using autoheader 2.62. - #ifndef _ALL_SOURCE - # undef _ALL_SOURCE - #endif --/* Enable general extensions on OS X. */ -+/* Enable general extensions on macOS. */ - #ifndef _DARWIN_C_SOURCE - # undef _DARWIN_C_SOURCE - #endif -@@ -68,14 +68,38 @@ dnl configure.ac when using autoheader 2.62. - #ifndef _GNU_SOURCE - # undef _GNU_SOURCE - #endif --/* Use GNU style printf and scanf. */ --#ifndef __USE_MINGW_ANSI_STDIO --# undef __USE_MINGW_ANSI_STDIO --#endif - /* Enable threading extensions on Solaris. */ - #ifndef _POSIX_PTHREAD_SEMANTICS - # undef _POSIX_PTHREAD_SEMANTICS - #endif -+/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ -+#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ -+# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ -+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -+# undef __STDC_WANT_IEC_60559_BFP_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ -+#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ -+# undef __STDC_WANT_IEC_60559_DFP_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ -+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ -+# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ -+#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ -+# undef __STDC_WANT_IEC_60559_TYPES_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ -+#ifndef __STDC_WANT_LIB_EXT2__ -+# undef __STDC_WANT_LIB_EXT2__ -+#endif -+/* Enable extensions specified by ISO/IEC 24747:2009. */ -+#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ -+# undef __STDC_WANT_MATH_SPEC_FUNCS__ -+#endif - /* Enable extensions on HP NonStop. */ - #ifndef _TANDEM_SOURCE - # undef _TANDEM_SOURCE -@@ -104,8 +128,14 @@ dnl configure.ac when using autoheader 2.62. - AC_DEFINE([_ALL_SOURCE]) - AC_DEFINE([_DARWIN_C_SOURCE]) - AC_DEFINE([_GNU_SOURCE]) -- AC_DEFINE([__USE_MINGW_ANSI_STDIO]) - AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__]) -+ AC_DEFINE([__STDC_WANT_LIB_EXT2__]) -+ AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__]) - AC_DEFINE([_TANDEM_SOURCE]) - AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], - [ac_cv_should_define__xopen_source], -diff --git a/libpskc/gl/m4/gnulib-comp.m4 b/libpskc/gl/m4/gnulib-comp.m4 -index ec12d7c..79e3892 100644 ---- a/libpskc/gl/m4/gnulib-comp.m4 -+++ b/libpskc/gl/m4/gnulib-comp.m4 -@@ -73,6 +73,8 @@ AC_DEFUN([gl_EARLY], - # Code from module inttypes-tests: - # Code from module lib-symbol-versions: - # Code from module lib-symbol-visibility: -+ # Code from module limits-h: -+ # Code from module limits-h-tests: - # Code from module manywarnings: - # Code from module memchr: - # Code from module memchr-tests: -@@ -136,6 +138,7 @@ AC_DEFUN([gl_INIT], - gl_INTTOSTR - gl_LD_VERSION_SCRIPT - gl_VISIBILITY -+ gl_LIMITS_H - gl_FUNC_MEMCHR - if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then - AC_LIBOBJ([memchr]) -@@ -349,6 +352,7 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/intprops.h - lib/inttostr.c - lib/inttostr.h -+ lib/limits.in.h - lib/memchr.c - lib/memchr.valgrind - lib/minmax.h -@@ -382,6 +386,7 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/inttypes.m4 - m4/inttypes_h.m4 - m4/ld-version-script.m4 -+ m4/limits-h.m4 - m4/longlong.m4 - m4/manywarnings.m4 - m4/math_h.m4 -@@ -431,6 +436,7 @@ AC_DEFUN([gl_FILE_LIST], [ - tests/test-intprops.c - tests/test-inttostr.c - tests/test-inttypes.c -+ tests/test-limits-h.c - tests/test-memchr.c - tests/test-snprintf.c - tests/test-stdalign.c -diff --git a/libpskc/gl/m4/limits-h.m4 b/libpskc/gl/m4/limits-h.m4 -new file mode 100644 -index 0000000..31fdf0a ---- /dev/null -+++ b/libpskc/gl/m4/limits-h.m4 -@@ -0,0 +1,31 @@ -+dnl Check whether limits.h has needed features. -+ -+dnl Copyright 2016 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 From Paul Eggert. -+ -+AC_DEFUN_ONCE([gl_LIMITS_H], -+[ -+ gl_CHECK_NEXT_HEADERS([limits.h]) -+ -+ AC_CACHE_CHECK([whether limits.h has ULLONG_WIDTH etc.], -+ [gl_cv_header_limits_width], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM([[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -+ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 -+ #endif -+ #include -+ int ullw = ULLONG_WIDTH;]])], -+ [gl_cv_header_limits_width=yes], -+ [gl_cv_header_limits_width=no])]) -+ if test "$gl_cv_header_limits_width" = yes; then -+ LIMITS_H= -+ else -+ LIMITS_H=limits.h -+ fi -+ AC_SUBST([LIMITS_H]) -+ AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) -+]) -diff --git a/libpskc/gl/m4/manywarnings.m4 b/libpskc/gl/m4/manywarnings.m4 -index 90823b0..89fd0ae 100644 ---- a/libpskc/gl/m4/manywarnings.m4 -+++ b/libpskc/gl/m4/manywarnings.m4 -@@ -103,6 +103,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], - - gl_manywarn_set= - for gl_manywarn_item in \ -+ -fno-common \ - -W \ - -Wabi \ - -Waddress \ -diff --git a/libpskc/gl/m4/stdint.m4 b/libpskc/gl/m4/stdint.m4 -index 0b4b906..fa6f103 100644 ---- a/libpskc/gl/m4/stdint.m4 -+++ b/libpskc/gl/m4/stdint.m4 -@@ -1,4 +1,4 @@ --# stdint.m4 serial 44 -+# stdint.m4 serial 47 - dnl Copyright (C) 2001-2016 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -11,6 +11,8 @@ AC_DEFUN_ONCE([gl_STDINT_H], - [ - AC_PREREQ([2.59])dnl - -+ AC_REQUIRE([gl_LIMITS_H]) -+ - dnl Check for long long int and unsigned long long int. - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - if test $ac_cv_type_long_long_int = yes; then -@@ -282,14 +284,20 @@ static const char *macro_values[] = - ]) - ]) - fi -+ -+ HAVE_C99_STDINT_H=0 -+ HAVE_SYS_BITYPES_H=0 -+ HAVE_SYS_INTTYPES_H=0 -+ STDINT_H=stdint.h - if test "$gl_cv_header_working_stdint_h" = yes; then -+ HAVE_C99_STDINT_H=1 - dnl Now see whether the system works without - dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined. - AC_CACHE_CHECK([whether stdint.h predates C++11], - [gl_cv_header_stdint_predates_cxx11_h], - [gl_cv_header_stdint_predates_cxx11_h=yes - AC_COMPILE_IFELSE([ -- AC_LANG_PROGRAM([[ -+ AC_LANG_PROGRAM([[ - #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ - #include - ] -@@ -306,27 +314,44 @@ int32_t i32 = INT32_C (0x7fffffff); - AC_DEFINE([__STDC_LIMIT_MACROS], [1], - [Define to 1 if the system predates C++11.]) - fi -- STDINT_H= -+ AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.], -+ [gl_cv_header_stdint_width], -+ [gl_cv_header_stdint_width=no -+ AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM([[ -+ /* Work if build is not clean. */ -+ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 -+ #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -+ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 -+ #endif -+ #include -+ ]gl_STDINT_INCLUDES[ -+ int iw = UINTMAX_WIDTH; -+ ]])], -+ [gl_cv_header_stdint_width=yes])]) -+ if test "$gl_cv_header_stdint_width" = yes; then -+ STDINT_H= -+ fi - else - dnl Check for , and for - dnl (used in Linux libc4 >= 4.6.7 and libc5). - AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) - if test $ac_cv_header_sys_inttypes_h = yes; then - HAVE_SYS_INTTYPES_H=1 -- else -- HAVE_SYS_INTTYPES_H=0 - fi -- AC_SUBST([HAVE_SYS_INTTYPES_H]) - if test $ac_cv_header_sys_bitypes_h = yes; then - HAVE_SYS_BITYPES_H=1 -- else -- HAVE_SYS_BITYPES_H=0 - fi -- AC_SUBST([HAVE_SYS_BITYPES_H]) -- - gl_STDINT_TYPE_PROPERTIES -- STDINT_H=stdint.h - fi -+ -+ # The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. -+ LIMITS_H=limits.h -+ AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) -+ -+ AC_SUBST([HAVE_C99_STDINT_H]) -+ AC_SUBST([HAVE_SYS_BITYPES_H]) -+ AC_SUBST([HAVE_SYS_INTTYPES_H]) - AC_SUBST([STDINT_H]) - AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) - ]) -@@ -504,8 +529,3 @@ dnl Remove this when we can assume autoconf >= 2.61. - m4_ifdef([AC_COMPUTE_INT], [], [ - AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) - ]) -- --# Hey Emacs! --# Local Variables: --# indent-tabs-mode: nil --# End: -diff --git a/libpskc/gl/m4/stdio_h.m4 b/libpskc/gl/m4/stdio_h.m4 -index 0e38758..eaa25a0 100644 ---- a/libpskc/gl/m4/stdio_h.m4 -+++ b/libpskc/gl/m4/stdio_h.m4 -@@ -1,4 +1,4 @@ --# stdio_h.m4 serial 46 -+# stdio_h.m4 serial 48 - dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -6,9 +6,13 @@ dnl with or without modifications, as long as this notice is preserved. - - AC_DEFUN([gl_STDIO_H], - [ -- dnl For __USE_MINGW_ANSI_STDIO -- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) -- -+ AH_VERBATIM([MINGW_ANSI_STDIO], -+[/* Use GNU style printf and scanf. */ -+#ifndef __USE_MINGW_ANSI_STDIO -+# undef __USE_MINGW_ANSI_STDIO -+#endif -+]) -+ AC_DEFINE([__USE_MINGW_ANSI_STDIO]) - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - gl_NEXT_HEADERS([stdio.h]) - -diff --git a/libpskc/gl/m4/sys_types_h.m4 b/libpskc/gl/m4/sys_types_h.m4 -index b0aabb4..159b005 100644 ---- a/libpskc/gl/m4/sys_types_h.m4 -+++ b/libpskc/gl/m4/sys_types_h.m4 -@@ -1,4 +1,4 @@ --# sys_types_h.m4 serial 5 -+# sys_types_h.m4 serial 6 - dnl Copyright (C) 2011-2016 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,3 +22,28 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], - AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], - [ - ]) -+ -+# This works around a buggy version in autoconf <= 2.69. -+# See -+ -+m4_version_prereq([2.70], [], [ -+ -+# This is taken from the following Autoconf patch: -+# http://git.sv.gnu.org/cgit/autoconf.git/commit/?id=e17a30e98 -+ -+m4_undefine([AC_HEADER_MAJOR]) -+AC_DEFUN([AC_HEADER_MAJOR], -+[AC_CHECK_HEADERS_ONCE([sys/types.h]) -+AC_CHECK_HEADER([sys/mkdev.h], -+ [AC_DEFINE([MAJOR_IN_MKDEV], [1], -+ [Define to 1 if `major', `minor', and `makedev' are declared in -+ .])]) -+if test $ac_cv_header_sys_mkdev_h = no; then -+ AC_CHECK_HEADER([sys/sysmacros.h], -+ [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], -+ [Define to 1 if `major', `minor', and `makedev' are declared in -+ .])]) -+fi -+]) -+ -+]) -diff --git a/libpskc/gl/stdint.in.h b/libpskc/gl/stdint.in.h -index 35a41bb..2259705 100644 ---- a/libpskc/gl/stdint.in.h -+++ b/libpskc/gl/stdint.in.h -@@ -79,49 +79,51 @@ - #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H - #define _@GUARD_PREFIX@_STDINT_H - -+/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, -+ LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ -+#include -+ -+#if ! @HAVE_C99_STDINT_H@ -+ - /* defines some of the stdint.h types as well, on glibc, - IRIX 6.5, and OpenBSD 3.8 (via ). - AIX 5.2 isn't needed and causes troubles. - Mac OS X 10.4.6 includes (which is us), but - relies on the system definitions, so include - after @NEXT_STDINT_H@. */ --#if @HAVE_SYS_TYPES_H@ && ! defined _AIX --# include --#endif -- --/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, -- LONG_MIN, LONG_MAX, ULONG_MAX. */ --#include -+# if @HAVE_SYS_TYPES_H@ && ! defined _AIX -+# include -+# endif - --#if @HAVE_INTTYPES_H@ -+# if @HAVE_INTTYPES_H@ - /* In OpenBSD 3.8, includes , which defines - int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. - also defines intptr_t and uintptr_t. */ --# include --#elif @HAVE_SYS_INTTYPES_H@ -+# include -+# elif @HAVE_SYS_INTTYPES_H@ - /* Solaris 7 has the types except the *_fast*_t types, and - the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ --# include --#endif -+# include -+# endif - --#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ -+# if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ - /* Linux libc4 >= 4.6.7 and libc5 have a that defines - int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is - included by . */ --# include --#endif -+# include -+# endif - --#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H -+# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H - - /* Minimum and maximum values for an integer type under the usual assumption. - Return an unspecified value if BITS == 0, adding a check to pacify - picky compilers. */ - --#define _STDINT_MIN(signed, bits, zero) \ -- ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero)) -+# define _STDINT_MIN(signed, bits, zero) \ -+ ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero)) - --#define _STDINT_MAX(signed, bits, zero) \ -- (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) -+# define _STDINT_MAX(signed, bits, zero) \ -+ (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) - - #if !GNULIB_defined_stdint_types - -@@ -130,26 +132,26 @@ - /* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. */ - --#undef int8_t --#undef uint8_t -+# undef int8_t -+# undef uint8_t - typedef signed char gl_int8_t; - typedef unsigned char gl_uint8_t; --#define int8_t gl_int8_t --#define uint8_t gl_uint8_t -+# define int8_t gl_int8_t -+# define uint8_t gl_uint8_t - --#undef int16_t --#undef uint16_t -+# undef int16_t -+# undef uint16_t - typedef short int gl_int16_t; - typedef unsigned short int gl_uint16_t; --#define int16_t gl_int16_t --#define uint16_t gl_uint16_t -+# define int16_t gl_int16_t -+# define uint16_t gl_uint16_t - --#undef int32_t --#undef uint32_t -+# undef int32_t -+# undef uint32_t - typedef int gl_int32_t; - typedef unsigned int gl_uint32_t; --#define int32_t gl_int32_t --#define uint32_t gl_uint32_t -+# define int32_t gl_int32_t -+# define uint32_t gl_uint32_t - - /* If the system defines INT64_MAX, assume int64_t works. That way, - if the underlying platform defines int64_t to be a 64-bit long long -@@ -157,54 +159,54 @@ typedef unsigned int gl_uint32_t; - int, which would mess up C++ name mangling. We must use #ifdef - rather than #if, to avoid an error with HP-UX 10.20 cc. */ - --#ifdef INT64_MAX --# define GL_INT64_T --#else -+# ifdef INT64_MAX -+# define GL_INT64_T -+# else - /* Do not undefine int64_t if gnulib is not being used with 64-bit - types, since otherwise it breaks platforms like Tandem/NSK. */ --# if LONG_MAX >> 31 >> 31 == 1 --# undef int64_t -+# if LONG_MAX >> 31 >> 31 == 1 -+# undef int64_t - typedef long int gl_int64_t; --# define int64_t gl_int64_t --# define GL_INT64_T --# elif defined _MSC_VER --# undef int64_t -+# define int64_t gl_int64_t -+# define GL_INT64_T -+# elif defined _MSC_VER -+# undef int64_t - typedef __int64 gl_int64_t; --# define int64_t gl_int64_t --# define GL_INT64_T --# elif @HAVE_LONG_LONG_INT@ --# undef int64_t -+# define int64_t gl_int64_t -+# define GL_INT64_T -+# elif @HAVE_LONG_LONG_INT@ -+# undef int64_t - typedef long long int gl_int64_t; --# define int64_t gl_int64_t --# define GL_INT64_T -+# define int64_t gl_int64_t -+# define GL_INT64_T -+# endif - # endif --#endif - --#ifdef UINT64_MAX --# define GL_UINT64_T --#else --# if ULONG_MAX >> 31 >> 31 >> 1 == 1 --# undef uint64_t --typedef unsigned long int gl_uint64_t; --# define uint64_t gl_uint64_t -+# ifdef UINT64_MAX - # define GL_UINT64_T --# elif defined _MSC_VER --# undef uint64_t -+# else -+# if ULONG_MAX >> 31 >> 31 >> 1 == 1 -+# undef uint64_t -+typedef unsigned long int gl_uint64_t; -+# define uint64_t gl_uint64_t -+# define GL_UINT64_T -+# elif defined _MSC_VER -+# undef uint64_t - typedef unsigned __int64 gl_uint64_t; --# define uint64_t gl_uint64_t --# define GL_UINT64_T --# elif @HAVE_UNSIGNED_LONG_LONG_INT@ --# undef uint64_t -+# define uint64_t gl_uint64_t -+# define GL_UINT64_T -+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ -+# undef uint64_t - typedef unsigned long long int gl_uint64_t; --# define uint64_t gl_uint64_t --# define GL_UINT64_T -+# define uint64_t gl_uint64_t -+# define GL_UINT64_T -+# endif - # endif --#endif - - /* Avoid collision with Solaris 2.5.1 etc. */ --#define _UINT8_T --#define _UINT32_T --#define _UINT64_T -+# define _UINT8_T -+# define _UINT32_T -+# define _UINT64_T - - - /* 7.18.1.2. Minimum-width integer types */ -@@ -213,26 +215,26 @@ typedef unsigned long long int gl_uint64_t; - types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types - are the same as the corresponding N_t types. */ - --#undef int_least8_t --#undef uint_least8_t --#undef int_least16_t --#undef uint_least16_t --#undef int_least32_t --#undef uint_least32_t --#undef int_least64_t --#undef uint_least64_t --#define int_least8_t int8_t --#define uint_least8_t uint8_t --#define int_least16_t int16_t --#define uint_least16_t uint16_t --#define int_least32_t int32_t --#define uint_least32_t uint32_t --#ifdef GL_INT64_T --# define int_least64_t int64_t --#endif --#ifdef GL_UINT64_T --# define uint_least64_t uint64_t --#endif -+# undef int_least8_t -+# undef uint_least8_t -+# undef int_least16_t -+# undef uint_least16_t -+# undef int_least32_t -+# undef uint_least32_t -+# undef int_least64_t -+# undef uint_least64_t -+# define int_least8_t int8_t -+# define uint_least8_t uint8_t -+# define int_least16_t int16_t -+# define uint_least16_t uint16_t -+# define int_least32_t int32_t -+# define uint_least32_t uint32_t -+# ifdef GL_INT64_T -+# define int_least64_t int64_t -+# endif -+# ifdef GL_UINT64_T -+# define uint_least64_t uint64_t -+# endif - - /* 7.18.1.3. Fastest minimum-width integer types */ - -@@ -245,55 +247,55 @@ typedef unsigned long long int gl_uint64_t; - uses types consistent with glibc, as that lessens the chance of - incompatibility with older GNU hosts. */ - --#undef int_fast8_t --#undef uint_fast8_t --#undef int_fast16_t --#undef uint_fast16_t --#undef int_fast32_t --#undef uint_fast32_t --#undef int_fast64_t --#undef uint_fast64_t -+# undef int_fast8_t -+# undef uint_fast8_t -+# undef int_fast16_t -+# undef uint_fast16_t -+# undef int_fast32_t -+# undef uint_fast32_t -+# undef int_fast64_t -+# undef uint_fast64_t - typedef signed char gl_int_fast8_t; - typedef unsigned char gl_uint_fast8_t; - --#ifdef __sun -+# 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 -+# else - typedef long int gl_int_fast32_t; - typedef unsigned long int gl_uint_fast32_t; --#endif -+# 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 --#define uint_fast16_t gl_uint_fast16_t --#define int_fast32_t gl_int_fast32_t --#define uint_fast32_t gl_uint_fast32_t --#ifdef GL_INT64_T --# define int_fast64_t int64_t --#endif --#ifdef GL_UINT64_T --# define uint_fast64_t uint64_t --#endif -+# define int_fast8_t gl_int_fast8_t -+# define uint_fast8_t gl_uint_fast8_t -+# define int_fast16_t gl_int_fast16_t -+# define uint_fast16_t gl_uint_fast16_t -+# define int_fast32_t gl_int_fast32_t -+# define uint_fast32_t gl_uint_fast32_t -+# ifdef GL_INT64_T -+# define int_fast64_t int64_t -+# endif -+# ifdef GL_UINT64_T -+# define uint_fast64_t uint64_t -+# endif - - /* 7.18.1.4. Integer types capable of holding object pointers */ - - /* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own - definitions of intptr_t and uintptr_t (which use int and unsigned) - to avoid clashes with declarations of system functions like sbrk. */ --#ifndef _INTPTR_T_DECLARED --#undef intptr_t --#undef uintptr_t -+# ifndef _INTPTR_T_DECLARED -+# undef intptr_t -+# undef uintptr_t - typedef long int gl_intptr_t; - typedef unsigned long int gl_uintptr_t; --#define intptr_t gl_intptr_t --#define uintptr_t gl_uintptr_t --#endif -+# define intptr_t gl_intptr_t -+# define uintptr_t gl_uintptr_t -+# endif - - /* 7.18.1.5. Greatest-width integer types */ - -@@ -304,33 +306,33 @@ typedef unsigned long int gl_uintptr_t; - similarly for UINTMAX_MAX and uintmax_t. This avoids problems with - assuming one type where another is used by the system. */ - --#ifndef INTMAX_MAX --# undef INTMAX_C --# undef intmax_t --# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -+# ifndef INTMAX_MAX -+# undef INTMAX_C -+# undef intmax_t -+# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 - typedef long long int gl_intmax_t; --# define intmax_t gl_intmax_t --# elif defined GL_INT64_T --# define intmax_t int64_t --# else -+# define intmax_t gl_intmax_t -+# elif defined GL_INT64_T -+# define intmax_t int64_t -+# else - typedef long int gl_intmax_t; --# define intmax_t gl_intmax_t -+# define intmax_t gl_intmax_t -+# endif - # endif --#endif - --#ifndef UINTMAX_MAX --# undef UINTMAX_C --# undef uintmax_t --# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -+# ifndef UINTMAX_MAX -+# undef UINTMAX_C -+# undef uintmax_t -+# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 - typedef unsigned long long int gl_uintmax_t; --# define uintmax_t gl_uintmax_t --# elif defined GL_UINT64_T --# define uintmax_t uint64_t --# else -+# define uintmax_t gl_uintmax_t -+# elif defined GL_UINT64_T -+# define uintmax_t uint64_t -+# else - typedef unsigned long int gl_uintmax_t; --# define uintmax_t gl_uintmax_t -+# define uintmax_t gl_uintmax_t -+# endif - # endif --#endif - - /* Verify that intmax_t and uintmax_t have the same size. Too much code - breaks if this is not the case. If this check fails, the reason is likely -@@ -338,8 +340,8 @@ typedef unsigned long int gl_uintmax_t; - typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - ? 1 : -1]; - --#define GNULIB_defined_stdint_types 1 --#endif /* !GNULIB_defined_stdint_types */ -+# define GNULIB_defined_stdint_types 1 -+# endif /* !GNULIB_defined_stdint_types */ - - /* 7.18.2. Limits of specified-width integer types */ - -@@ -348,37 +350,37 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - /* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. */ - --#undef INT8_MIN --#undef INT8_MAX --#undef UINT8_MAX --#define INT8_MIN (~ INT8_MAX) --#define INT8_MAX 127 --#define UINT8_MAX 255 -- --#undef INT16_MIN --#undef INT16_MAX --#undef UINT16_MAX --#define INT16_MIN (~ INT16_MAX) --#define INT16_MAX 32767 --#define UINT16_MAX 65535 -- --#undef INT32_MIN --#undef INT32_MAX --#undef UINT32_MAX --#define INT32_MIN (~ INT32_MAX) --#define INT32_MAX 2147483647 --#define UINT32_MAX 4294967295U -- --#if defined GL_INT64_T && ! defined INT64_MAX -+# undef INT8_MIN -+# undef INT8_MAX -+# undef UINT8_MAX -+# define INT8_MIN (~ INT8_MAX) -+# define INT8_MAX 127 -+# define UINT8_MAX 255 -+ -+# undef INT16_MIN -+# undef INT16_MAX -+# undef UINT16_MAX -+# define INT16_MIN (~ INT16_MAX) -+# define INT16_MAX 32767 -+# define UINT16_MAX 65535 -+ -+# undef INT32_MIN -+# undef INT32_MAX -+# undef UINT32_MAX -+# define INT32_MIN (~ INT32_MAX) -+# define INT32_MAX 2147483647 -+# define UINT32_MAX 4294967295U -+ -+# if defined GL_INT64_T && ! defined INT64_MAX - /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 - evaluates the latter incorrectly in preprocessor expressions. */ --# define INT64_MIN (- INTMAX_C (1) << 63) --# define INT64_MAX INTMAX_C (9223372036854775807) --#endif -+# define INT64_MIN (- INTMAX_C (1) << 63) -+# define INT64_MAX INTMAX_C (9223372036854775807) -+# endif - --#if defined GL_UINT64_T && ! defined UINT64_MAX --# define UINT64_MAX UINTMAX_C (18446744073709551615) --#endif -+# if defined GL_UINT64_T && ! defined UINT64_MAX -+# define UINT64_MAX UINTMAX_C (18446744073709551615) -+# endif - - /* 7.18.2.2. Limits of minimum-width integer types */ - -@@ -386,38 +388,38 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types - are the same as the corresponding N_t types. */ - --#undef INT_LEAST8_MIN --#undef INT_LEAST8_MAX --#undef UINT_LEAST8_MAX --#define INT_LEAST8_MIN INT8_MIN --#define INT_LEAST8_MAX INT8_MAX --#define UINT_LEAST8_MAX UINT8_MAX -- --#undef INT_LEAST16_MIN --#undef INT_LEAST16_MAX --#undef UINT_LEAST16_MAX --#define INT_LEAST16_MIN INT16_MIN --#define INT_LEAST16_MAX INT16_MAX --#define UINT_LEAST16_MAX UINT16_MAX -- --#undef INT_LEAST32_MIN --#undef INT_LEAST32_MAX --#undef UINT_LEAST32_MAX --#define INT_LEAST32_MIN INT32_MIN --#define INT_LEAST32_MAX INT32_MAX --#define UINT_LEAST32_MAX UINT32_MAX -- --#undef INT_LEAST64_MIN --#undef INT_LEAST64_MAX --#ifdef GL_INT64_T --# define INT_LEAST64_MIN INT64_MIN --# define INT_LEAST64_MAX INT64_MAX --#endif -+# undef INT_LEAST8_MIN -+# undef INT_LEAST8_MAX -+# undef UINT_LEAST8_MAX -+# define INT_LEAST8_MIN INT8_MIN -+# define INT_LEAST8_MAX INT8_MAX -+# define UINT_LEAST8_MAX UINT8_MAX -+ -+# undef INT_LEAST16_MIN -+# undef INT_LEAST16_MAX -+# undef UINT_LEAST16_MAX -+# define INT_LEAST16_MIN INT16_MIN -+# define INT_LEAST16_MAX INT16_MAX -+# define UINT_LEAST16_MAX UINT16_MAX -+ -+# undef INT_LEAST32_MIN -+# undef INT_LEAST32_MAX -+# undef UINT_LEAST32_MAX -+# define INT_LEAST32_MIN INT32_MIN -+# define INT_LEAST32_MAX INT32_MAX -+# define UINT_LEAST32_MAX UINT32_MAX -+ -+# undef INT_LEAST64_MIN -+# undef INT_LEAST64_MAX -+# ifdef GL_INT64_T -+# define INT_LEAST64_MIN INT64_MIN -+# define INT_LEAST64_MAX INT64_MAX -+# endif - --#undef UINT_LEAST64_MAX --#ifdef GL_UINT64_T --# define UINT_LEAST64_MAX UINT64_MAX --#endif -+# undef UINT_LEAST64_MAX -+# ifdef GL_UINT64_T -+# define UINT_LEAST64_MAX UINT64_MAX -+# endif - - /* 7.18.2.3. Limits of fastest minimum-width integer types */ - -@@ -425,117 +427,117 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types - are taken from the same list of types. */ - --#undef INT_FAST8_MIN --#undef INT_FAST8_MAX --#undef UINT_FAST8_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 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 --#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_FAST8_MIN -+# undef INT_FAST8_MAX -+# undef UINT_FAST8_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 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 -+# 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 --#ifdef GL_INT64_T --# define INT_FAST64_MIN INT64_MIN --# define INT_FAST64_MAX INT64_MAX --#endif -+# undef INT_FAST64_MIN -+# undef INT_FAST64_MAX -+# ifdef GL_INT64_T -+# define INT_FAST64_MIN INT64_MIN -+# define INT_FAST64_MAX INT64_MAX -+# endif - --#undef UINT_FAST64_MAX --#ifdef GL_UINT64_T --# define UINT_FAST64_MAX UINT64_MAX --#endif -+# undef UINT_FAST64_MAX -+# ifdef GL_UINT64_T -+# define UINT_FAST64_MAX UINT64_MAX -+# endif - - /* 7.18.2.4. Limits of integer types capable of holding object pointers */ - --#undef INTPTR_MIN --#undef INTPTR_MAX --#undef UINTPTR_MAX --#define INTPTR_MIN LONG_MIN --#define INTPTR_MAX LONG_MAX --#define UINTPTR_MAX ULONG_MAX -+# undef INTPTR_MIN -+# undef INTPTR_MAX -+# undef UINTPTR_MAX -+# define INTPTR_MIN LONG_MIN -+# define INTPTR_MAX LONG_MAX -+# define UINTPTR_MAX ULONG_MAX - - /* 7.18.2.5. Limits of greatest-width integer types */ - --#ifndef INTMAX_MAX --# undef INTMAX_MIN --# ifdef INT64_MAX --# define INTMAX_MIN INT64_MIN --# define INTMAX_MAX INT64_MAX --# else --# define INTMAX_MIN INT32_MIN --# define INTMAX_MAX INT32_MAX -+# ifndef INTMAX_MAX -+# undef INTMAX_MIN -+# ifdef INT64_MAX -+# define INTMAX_MIN INT64_MIN -+# define INTMAX_MAX INT64_MAX -+# else -+# define INTMAX_MIN INT32_MIN -+# define INTMAX_MAX INT32_MAX -+# endif - # endif --#endif - --#ifndef UINTMAX_MAX --# ifdef UINT64_MAX --# define UINTMAX_MAX UINT64_MAX --# else --# define UINTMAX_MAX UINT32_MAX -+# ifndef UINTMAX_MAX -+# ifdef UINT64_MAX -+# define UINTMAX_MAX UINT64_MAX -+# else -+# define UINTMAX_MAX UINT32_MAX -+# endif - # endif --#endif - - /* 7.18.3. Limits of other integer types */ - - /* ptrdiff_t limits */ --#undef PTRDIFF_MIN --#undef PTRDIFF_MAX --#if @APPLE_UNIVERSAL_BUILD@ --# ifdef _LP64 --# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) --# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) -+# undef PTRDIFF_MIN -+# undef PTRDIFF_MAX -+# if @APPLE_UNIVERSAL_BUILD@ -+# ifdef _LP64 -+# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) -+# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) -+# else -+# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) -+# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) -+# endif - # else --# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) --# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) --# endif --#else --# define PTRDIFF_MIN \ -+# define PTRDIFF_MIN \ - _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) --# define PTRDIFF_MAX \ -+# define PTRDIFF_MAX \ - _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) --#endif -+# endif - - /* sig_atomic_t limits */ --#undef SIG_ATOMIC_MIN --#undef SIG_ATOMIC_MAX --#define SIG_ATOMIC_MIN \ -+# undef SIG_ATOMIC_MIN -+# undef SIG_ATOMIC_MAX -+# define SIG_ATOMIC_MIN \ - _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) --#define SIG_ATOMIC_MAX \ -+# define SIG_ATOMIC_MAX \ - _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) - - - /* size_t limit */ --#undef SIZE_MAX --#if @APPLE_UNIVERSAL_BUILD@ --# ifdef _LP64 --# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) -+# undef SIZE_MAX -+# if @APPLE_UNIVERSAL_BUILD@ -+# ifdef _LP64 -+# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) -+# else -+# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) -+# endif - # else --# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) -+# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) - # endif --#else --# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) --#endif - - /* wchar_t limits */ - /* Get WCHAR_MIN, WCHAR_MAX. -@@ -543,29 +545,29 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - sequence of nested includes - -> -> -> , and the latter includes - and assumes its types are already defined. */ --#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) -+# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ --# include --# include --# include --# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H --# include --# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H --#endif --#undef WCHAR_MIN --#undef WCHAR_MAX --#define WCHAR_MIN \ -+# include -+# include -+# include -+# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -+# include -+# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -+# endif -+# undef WCHAR_MIN -+# undef WCHAR_MAX -+# define WCHAR_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) --#define WCHAR_MAX \ -+# define WCHAR_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) - - /* wint_t limits */ --#undef WINT_MIN --#undef WINT_MAX --#define WINT_MIN \ -+# undef WINT_MIN -+# undef WINT_MAX -+# define WINT_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) --#define WINT_MAX \ -+# define WINT_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) - - /* 7.18.4. Macros for integer constants */ -@@ -576,59 +578,120 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - /* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ - --#undef INT8_C --#undef UINT8_C --#define INT8_C(x) x --#define UINT8_C(x) x -- --#undef INT16_C --#undef UINT16_C --#define INT16_C(x) x --#define UINT16_C(x) x -- --#undef INT32_C --#undef UINT32_C --#define INT32_C(x) x --#define UINT32_C(x) x ## U -- --#undef INT64_C --#undef UINT64_C --#if LONG_MAX >> 31 >> 31 == 1 --# define INT64_C(x) x##L --#elif defined _MSC_VER --# define INT64_C(x) x##i64 --#elif @HAVE_LONG_LONG_INT@ --# define INT64_C(x) x##LL --#endif --#if ULONG_MAX >> 31 >> 31 >> 1 == 1 --# define UINT64_C(x) x##UL --#elif defined _MSC_VER --# define UINT64_C(x) x##ui64 --#elif @HAVE_UNSIGNED_LONG_LONG_INT@ --# define UINT64_C(x) x##ULL --#endif -+# undef INT8_C -+# undef UINT8_C -+# define INT8_C(x) x -+# define UINT8_C(x) x -+ -+# undef INT16_C -+# undef UINT16_C -+# define INT16_C(x) x -+# define UINT16_C(x) x -+ -+# undef INT32_C -+# undef UINT32_C -+# define INT32_C(x) x -+# define UINT32_C(x) x ## U -+ -+# undef INT64_C -+# undef UINT64_C -+# if LONG_MAX >> 31 >> 31 == 1 -+# define INT64_C(x) x##L -+# elif defined _MSC_VER -+# define INT64_C(x) x##i64 -+# elif @HAVE_LONG_LONG_INT@ -+# define INT64_C(x) x##LL -+# endif -+# if ULONG_MAX >> 31 >> 31 >> 1 == 1 -+# define UINT64_C(x) x##UL -+# elif defined _MSC_VER -+# define UINT64_C(x) x##ui64 -+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ -+# define UINT64_C(x) x##ULL -+# endif - - /* 7.18.4.2. Macros for greatest-width integer constants */ - --#ifndef INTMAX_C --# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 --# define INTMAX_C(x) x##LL --# elif defined GL_INT64_T --# define INTMAX_C(x) INT64_C(x) --# else --# define INTMAX_C(x) x##L -+# ifndef INTMAX_C -+# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -+# define INTMAX_C(x) x##LL -+# elif defined GL_INT64_T -+# define INTMAX_C(x) INT64_C(x) -+# else -+# define INTMAX_C(x) x##L -+# endif - # endif --#endif - --#ifndef UINTMAX_C --# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 --# define UINTMAX_C(x) x##ULL --# elif defined GL_UINT64_T --# define UINTMAX_C(x) UINT64_C(x) --# else --# define UINTMAX_C(x) x##UL -+# ifndef UINTMAX_C -+# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -+# define UINTMAX_C(x) x##ULL -+# elif defined GL_UINT64_T -+# define UINTMAX_C(x) UINT64_C(x) -+# else -+# define UINTMAX_C(x) x##UL -+# endif - # endif --#endif -+ -+#endif /* !@HAVE_C99_STDINT_H@ */ -+ -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#if (!defined UINTMAX_WIDTH \ -+ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) -+# ifdef INT8_MAX -+# define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX) -+# endif -+# ifdef UINT8_MAX -+# define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX) -+# endif -+# ifdef INT16_MAX -+# define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX) -+# endif -+# ifdef UINT16_MAX -+# define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX) -+# endif -+# ifdef INT32_MAX -+# define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX) -+# endif -+# ifdef UINT32_MAX -+# define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX) -+# endif -+# ifdef INT64_MAX -+# define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX) -+# endif -+# ifdef UINT64_MAX -+# define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX) -+# endif -+# define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX) -+# define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX) -+# define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX) -+# define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX) -+# define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX) -+# define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX) -+# define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX) -+# define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX) -+# define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX) -+# define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX) -+# define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX) -+# define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX) -+# define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX) -+# define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX) -+# define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX) -+# define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX) -+# define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX) -+# define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX) -+# define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX) -+# define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX) -+# define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX) -+# define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX) -+# define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX) -+# ifdef WINT_MAX -+# define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX) -+# endif -+# ifdef SIG_ATOMIC_MAX -+# define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX) -+# endif -+#endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ - - #endif /* _@GUARD_PREFIX@_STDINT_H */ - #endif /* !(defined __ANDROID__ && ...) */ -diff --git a/libpskc/gl/strverscmp.c b/libpskc/gl/strverscmp.c -index f1e3594..d0f9644 100644 ---- a/libpskc/gl/strverscmp.c -+++ b/libpskc/gl/strverscmp.c -@@ -1,21 +1,21 @@ --/* Compare strings while treating digits numerically. -*- coding: utf-8 -*- -- Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2016 Free Software -- Foundation, Inc. -+/* Compare strings while treating digits characters numerically. -+ Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jean-François Bignolles , 1997. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU Lesser General Public License as published by -- the Free Software Foundation; either version 2.1, 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 Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 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 Lesser General Public License for more details. -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU Lesser General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ - - #if !_LIBC - # include -@@ -26,27 +26,14 @@ - - /* states: S_N: normal, S_I: comparing integral part, S_F: comparing - fractional parts, S_Z: idem but with leading Zeroes only */ --#define S_N 0x0 --#define S_I 0x4 --#define S_F 0x8 --#define S_Z 0xC -+#define S_N 0x0 -+#define S_I 0x3 -+#define S_F 0x6 -+#define S_Z 0x9 - - /* result_type: CMP: return diff; LEN: compare using len_diff/diff */ --#define CMP 2 --#define LEN 3 -- -- --/* ISDIGIT differs from isdigit, as follows: -- - Its arg may be any int or unsigned int; it need not be an unsigned char -- or EOF. -- - It's typically faster. -- POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to -- isdigit unless it's important to use the locale's definition -- of "digit" even when the host does not conform to POSIX. */ --#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) -- --#undef __strverscmp --#undef strverscmp -+#define CMP 2 -+#define LEN 3 - - #ifndef weak_alias - # define __strverscmp strverscmp -@@ -66,30 +53,25 @@ __strverscmp (const char *s1, const char *s2) - int state; - int diff; - -- /* Symbol(s) 0 [1-9] others (padding) -- Transition (10) 0 (01) d (00) x (11) - */ -- static const unsigned int next_state[] = -+ /* Symbol(s) 0 [1-9] others -+ Transition (10) 0 (01) d (00) x */ -+ static const unsigned char next_state[] = - { -- /* state x d 0 - */ -- /* S_N */ S_N, S_I, S_Z, S_N, -- /* S_I */ S_N, S_I, S_I, S_I, -- /* S_F */ S_N, S_F, S_F, S_F, -- /* S_Z */ S_N, S_F, S_Z, S_Z -+ /* state x d 0 */ -+ /* S_N */ S_N, S_I, S_Z, -+ /* S_I */ S_N, S_I, S_I, -+ /* S_F */ S_N, S_F, S_F, -+ /* S_Z */ S_N, S_F, S_Z - }; - -- static const int result_type[] = -+ static const signed char result_type[] = - { -- /* state x/x x/d x/0 x/- d/x d/d d/0 d/- -- 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */ -- -- /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, -- CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, -- /* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP, -- 1, LEN, LEN, CMP, CMP, CMP, CMP, CMP, -- /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, -- CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, -- /* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP, -- -1, CMP, CMP, CMP -+ /* state x/x x/d x/0 d/x d/d d/0 0/x 0/d 0/0 */ -+ -+ /* S_N */ CMP, CMP, CMP, CMP, LEN, CMP, CMP, CMP, CMP, -+ /* S_I */ CMP, -1, -1, +1, LEN, LEN, +1, LEN, LEN, -+ /* S_F */ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, -+ /* S_Z */ CMP, +1, +1, -1, CMP, CMP, -1, CMP, CMP - }; - - if (p1 == p2) -@@ -98,17 +80,20 @@ __strverscmp (const char *s1, const char *s2) - c1 = *p1++; - c2 = *p2++; - /* Hint: '0' is a digit too. */ -- state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0)); -+ state = S_N + ((c1 == '0') + (isdigit (c1) != 0)); - -- while ((diff = c1 - c2) == 0 && c1 != '\0') -+ while ((diff = c1 - c2) == 0) - { -+ if (c1 == '\0') -+ return diff; -+ - state = next_state[state]; - c1 = *p1++; - c2 = *p2++; -- state |= (c1 == '0') + (ISDIGIT (c1) != 0); -+ state += (c1 == '0') + (isdigit (c1) != 0); - } - -- state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))]; -+ state = result_type[state * 3 + (((c2 == '0') + (isdigit (c2) != 0)))]; - - switch (state) - { -@@ -116,16 +101,17 @@ __strverscmp (const char *s1, const char *s2) - return diff; - - case LEN: -- while (ISDIGIT (*p1++)) -- if (!ISDIGIT (*p2++)) -+ while (isdigit (*p1++)) -+ if (!isdigit (*p2++)) - return 1; - -- return ISDIGIT (*p2) ? -1 : diff; -+ return isdigit (*p2) ? -1 : diff; - - default: - return state; - } - } - #ifdef weak_alias -+libc_hidden_def (__strverscmp) - weak_alias (__strverscmp, strverscmp) - #endif -diff --git a/libpskc/gl/tests/Makefile.am b/libpskc/gl/tests/Makefile.am -index 41840ca..921a8ad 100644 ---- a/libpskc/gl/tests/Makefile.am -+++ b/libpskc/gl/tests/Makefile.am -@@ -314,6 +314,14 @@ EXTRA_DIST += test-inttypes.c - - ## end gnulib module inttypes-tests - -+## begin gnulib module limits-h-tests -+ -+TESTS += test-limits-h -+check_PROGRAMS += test-limits-h -+EXTRA_DIST += test-limits-h.c -+ -+## end gnulib module limits-h-tests -+ - ## begin gnulib module memchr-tests - - TESTS += test-memchr -diff --git a/libpskc/gl/tests/test-limits-h.c b/libpskc/gl/tests/test-limits-h.c -new file mode 100644 -index 0000000..597dabf ---- /dev/null -+++ b/libpskc/gl/tests/test-limits-h.c -@@ -0,0 +1,46 @@ -+/* Test of substitute. -+ Copyright 2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* Written by Paul Eggert. */ -+ -+#include -+ -+#include -+ -+#include "verify.h" -+ -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#define verify_width(width, min, max) \ -+ verify ((max) >> ((width) - 1 - ((min) < 0)) == 1) -+ -+verify_width (CHAR_WIDTH, CHAR_MIN, CHAR_MAX); -+verify_width (SCHAR_WIDTH, SCHAR_MIN, SCHAR_MAX); -+verify_width (UCHAR_WIDTH, 0, UCHAR_MAX); -+verify_width (SHRT_WIDTH, SHRT_MIN, SHRT_MAX); -+verify_width (USHRT_WIDTH, 0, USHRT_MAX); -+verify_width (INT_WIDTH, INT_MIN, INT_MAX); -+verify_width (UINT_WIDTH, 0, UINT_MAX); -+verify_width (LONG_WIDTH, LONG_MIN, LONG_MAX); -+verify_width (ULONG_WIDTH, 0, ULONG_MAX); -+verify_width (LLONG_WIDTH, LLONG_MIN, LLONG_MAX); -+verify_width (ULLONG_WIDTH, 0, ULLONG_MAX); -+ -+int -+main (void) -+{ -+ return 0; -+} -diff --git a/libpskc/gl/tests/test-stdint.c b/libpskc/gl/tests/test-stdint.c -index 7705fc7..c0e2f08 100644 ---- a/libpskc/gl/tests/test-stdint.c -+++ b/libpskc/gl/tests/test-stdint.c -@@ -351,6 +351,64 @@ verify_same_types (INTMAX_C (17), (intmax_t)0 + 0); - verify (UINTMAX_C (17) == 17); - verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0); - -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#define verify_width(width, min, max) \ -+ verify ((max) >> ((width) - 1 - ((min) < 0)) == 1) -+ -+#ifdef INT8_MAX -+verify_width (INT8_WIDTH, INT8_MIN, INT8_MAX); -+#endif -+#ifdef UINT8_MAX -+verify_width (UINT8_WIDTH, 0, UINT8_MAX); -+#endif -+#ifdef INT16_MAX -+verify_width (INT16_WIDTH, INT16_MIN, INT16_MAX); -+#endif -+#ifdef UINT16_MAX -+verify_width (UINT16_WIDTH, 0, UINT16_MAX); -+#endif -+#ifdef INT32_MAX -+verify_width (INT32_WIDTH, INT32_MIN, INT32_MAX); -+#endif -+#ifdef UINT32_MAX -+verify_width (UINT32_WIDTH, 0, UINT32_MAX); -+#endif -+#ifdef INT64_MAX -+verify_width (INT64_WIDTH, INT64_MIN, INT64_MAX); -+#endif -+#ifdef UINT64_MAX -+verify_width (UINT64_WIDTH, 0, UINT64_MAX); -+#endif -+verify_width (INT_LEAST8_WIDTH, INT_LEAST8_MIN, INT_LEAST8_MAX); -+verify_width (UINT_LEAST8_WIDTH, 0, UINT_LEAST8_MAX); -+verify_width (INT_LEAST16_WIDTH, INT_LEAST16_MIN, INT_LEAST16_MAX); -+verify_width (UINT_LEAST16_WIDTH, 0, UINT_LEAST16_MAX); -+verify_width (INT_LEAST32_WIDTH, INT_LEAST32_MIN, INT_LEAST32_MAX); -+verify_width (UINT_LEAST32_WIDTH, 0, UINT_LEAST32_MAX); -+verify_width (INT_LEAST64_WIDTH, INT_LEAST64_MIN, INT_LEAST64_MAX); -+verify_width (UINT_LEAST64_WIDTH, 0, UINT_LEAST64_MAX); -+verify_width (INT_FAST8_WIDTH, INT_FAST8_MIN, INT_FAST8_MAX); -+verify_width (UINT_FAST8_WIDTH, 0, UINT_FAST8_MAX); -+verify_width (INT_FAST16_WIDTH, INT_FAST16_MIN, INT_FAST16_MAX); -+verify_width (UINT_FAST16_WIDTH, 0, UINT_FAST16_MAX); -+verify_width (INT_FAST32_WIDTH, INT_FAST32_MIN, INT_FAST32_MAX); -+verify_width (UINT_FAST32_WIDTH, 0, UINT_FAST32_MAX); -+verify_width (INT_FAST64_WIDTH, INT_FAST64_MIN, INT_FAST64_MAX); -+verify_width (UINT_FAST64_WIDTH, 0, UINT_FAST64_MAX); -+verify_width (INTPTR_WIDTH, INTPTR_MIN, INTPTR_MAX); -+verify_width (UINTPTR_WIDTH, 0, UINTPTR_MAX); -+verify_width (INTMAX_WIDTH, INTMAX_MIN, INTMAX_MAX); -+verify_width (UINTMAX_WIDTH, 0, UINTMAX_MAX); -+verify_width (PTRDIFF_WIDTH, PTRDIFF_MIN, PTRDIFF_MAX); -+verify_width (SIZE_WIDTH, 0, SIZE_MAX); -+verify_width (WCHAR_WIDTH, WCHAR_MIN, WCHAR_MAX); -+#ifdef WINT_MAX -+verify_width (WINT_WIDTH, WINT_MIN, WINT_MAX); -+#endif -+#ifdef SIG_ATOMIC_MAX -+verify_width (SIG_ATOMIC_WIDTH, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX); -+#endif - - int - main (void) -diff --git a/libpskc/gl/tests/test-strverscmp.c b/libpskc/gl/tests/test-strverscmp.c -index e5a6bb1..0cafe08 100644 ---- a/libpskc/gl/tests/test-strverscmp.c -+++ b/libpskc/gl/tests/test-strverscmp.c -@@ -41,5 +41,19 @@ main (void) - ASSERT (strverscmp ("09", "0") < 0); - ASSERT (strverscmp ("9", "10") < 0); - ASSERT (strverscmp ("0a", "0") > 0); -+ -+ /* From glibc bug 9913. */ -+ { -+ static char const a[] = "B0075022800016.gbp.corp.com"; -+ static char const b[] = "B007502280067.gbp.corp.com"; -+ static char const c[] = "B007502357019.GBP.CORP.COM"; -+ ASSERT (strverscmp (a, b) < 0); -+ ASSERT (strverscmp (b, c) < 0); -+ ASSERT (strverscmp (a, c) < 0); -+ ASSERT (strverscmp (b, a) > 0); -+ ASSERT (strverscmp (c, b) > 0); -+ ASSERT (strverscmp (c, a) > 0); -+ } -+ - return 0; - } -diff --git a/maint.mk b/maint.mk -index 868e10f..c32f8b6 100644 ---- a/maint.mk -+++ b/maint.mk -@@ -717,15 +717,6 @@ sc_changelog: - $(_sc_search_regexp) - - # Ensure that each .c file containing a "main" function also --# calls set_program_name. --sc_program_name: -- @require='set_program_name *\(.*\);' \ -- in_vc_files='\.c$$' \ -- containing='\
when the system -+# doesn't have one that is compatible with GNU. -+if GL_GENERATE_LIMITS_H -+limits.h: limits.in.h $(top_builddir)/config.status -+ $(AM_V_GEN)rm -f $@-t $@ && \ -+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ -+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -+ -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \ -+ < $(srcdir)/limits.in.h; \ -+ } > $@-t && \ -+ mv $@-t $@ -+else -+limits.h: $(top_builddir)/config.status -+ rm -f $@ -+endif -+MOSTLYCLEANFILES += limits.h limits.h-t -+ -+EXTRA_DIST += limits.in.h -+ -+## end gnulib module limits-h -+ -+## begin gnulib module malloc-posix -+ -+ -+EXTRA_DIST += malloc.c -+ -+EXTRA_libgnu_la_SOURCES += malloc.c -+ -+## end gnulib module malloc-posix -+ - ## begin gnulib module malloca - - libgnu_la_SOURCES += malloca.c -@@ -531,6 +596,7 @@ stdint.h: stdint.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_STDINT_H''@|$(NEXT_STDINT_H)|g' \ -+ -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \ - -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ - -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ - -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ -diff --git a/oathtool/gl/basename-lgpl.c b/oathtool/gl/basename-lgpl.c -new file mode 100644 -index 0000000..1182109 ---- /dev/null -+++ b/oathtool/gl/basename-lgpl.c -@@ -0,0 +1,75 @@ -+/* basename.c -- return the last element in a file name -+ -+ Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software -+ Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+#include "dirname.h" -+ -+#include -+ -+/* Return the address of the last file name component of NAME. If -+ NAME has no relative file name components because it is a file -+ system root, return the empty string. */ -+ -+char * -+last_component (char const *name) -+{ -+ char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); -+ char const *p; -+ bool saw_slash = false; -+ -+ while (ISSLASH (*base)) -+ base++; -+ -+ for (p = base; *p; p++) -+ { -+ if (ISSLASH (*p)) -+ saw_slash = true; -+ else if (saw_slash) -+ { -+ base = p; -+ saw_slash = false; -+ } -+ } -+ -+ return (char *) base; -+} -+ -+/* Return the length of the basename NAME. Typically NAME is the -+ value returned by base_name or last_component. Act like strlen -+ (NAME), except omit all trailing slashes. */ -+ -+size_t -+base_len (char const *name) -+{ -+ size_t len; -+ size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name); -+ -+ for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) -+ continue; -+ -+ if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1 -+ && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2]) -+ return 2; -+ -+ if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len -+ && len == prefix_len && ISSLASH (name[prefix_len])) -+ return prefix_len + 1; -+ -+ return len; -+} -diff --git a/oathtool/gl/dirname-lgpl.c b/oathtool/gl/dirname-lgpl.c -new file mode 100644 -index 0000000..a7aabf9 ---- /dev/null -+++ b/oathtool/gl/dirname-lgpl.c -@@ -0,0 +1,86 @@ -+/* dirname.c -- return all but the last element in a file name -+ -+ Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software -+ Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+#include "dirname.h" -+ -+#include -+#include -+ -+/* Return the length of the prefix of FILE that will be used by -+ dir_name. If FILE is in the working directory, this returns zero -+ even though 'dir_name (FILE)' will return ".". Works properly even -+ if there are trailing slashes (by effectively ignoring them). */ -+ -+size_t -+dir_len (char const *file) -+{ -+ size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file); -+ size_t length; -+ -+ /* Advance prefix_length beyond important leading slashes. */ -+ prefix_length += (prefix_length != 0 -+ ? (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -+ && ISSLASH (file[prefix_length])) -+ : (ISSLASH (file[0]) -+ ? ((DOUBLE_SLASH_IS_DISTINCT_ROOT -+ && ISSLASH (file[1]) && ! ISSLASH (file[2]) -+ ? 2 : 1)) -+ : 0)); -+ -+ /* Strip the basename and any redundant slashes before it. */ -+ for (length = last_component (file) - file; -+ prefix_length < length; length--) -+ if (! ISSLASH (file[length - 1])) -+ break; -+ return length; -+} -+ -+ -+/* In general, we can't use the builtin 'dirname' function if available, -+ since it has different meanings in different environments. -+ In some environments the builtin 'dirname' modifies its argument. -+ -+ Return the leading directories part of FILE, allocated with malloc. -+ Works properly even if there are trailing slashes (by effectively -+ ignoring them). Return NULL on failure. -+ -+ If lstat (FILE) would succeed, then { chdir (dir_name (FILE)); -+ lstat (base_name (FILE)); } will access the same file. Likewise, -+ if the sequence { chdir (dir_name (FILE)); -+ rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE -+ to "foo" in the same directory FILE was in. */ -+ -+char * -+mdir_name (char const *file) -+{ -+ size_t length = dir_len (file); -+ bool append_dot = (length == 0 -+ || (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -+ && length == FILE_SYSTEM_PREFIX_LEN (file) -+ && file[2] != '\0' && ! ISSLASH (file[2]))); -+ char *dir = malloc (length + append_dot + 1); -+ if (!dir) -+ return NULL; -+ memcpy (dir, file, length); -+ if (append_dot) -+ dir[length++] = '.'; -+ dir[length] = '\0'; -+ return dir; -+} -diff --git a/oathtool/gl/dirname.h b/oathtool/gl/dirname.h -new file mode 100644 -index 0000000..875b31b ---- /dev/null -+++ b/oathtool/gl/dirname.h -@@ -0,0 +1,54 @@ -+/* Take file names apart into directory and base names. -+ -+ Copyright (C) 1998, 2001, 2003-2006, 2009-2016 Free Software Foundation, -+ Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#ifndef DIRNAME_H_ -+# define DIRNAME_H_ 1 -+ -+# include -+# include -+# include "dosname.h" -+ -+# ifndef DIRECTORY_SEPARATOR -+# define DIRECTORY_SEPARATOR '/' -+# endif -+ -+# ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT -+# define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 -+# endif -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+# if GNULIB_DIRNAME -+char *base_name (char const *file); -+char *dir_name (char const *file); -+# endif -+ -+char *mdir_name (char const *file); -+size_t base_len (char const *file) _GL_ATTRIBUTE_PURE; -+size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE; -+char *last_component (char const *file) _GL_ATTRIBUTE_PURE; -+ -+bool strip_trailing_slashes (char *file); -+ -+#ifdef __cplusplus -+} /* extern "C" */ -+#endif -+ -+#endif /* not DIRNAME_H_ */ -diff --git a/oathtool/gl/dosname.h b/oathtool/gl/dosname.h -new file mode 100644 -index 0000000..83a953f ---- /dev/null -+++ b/oathtool/gl/dosname.h -@@ -0,0 +1,53 @@ -+/* File names on MS-DOS/Windows systems. -+ -+ Copyright (C) 2000-2001, 2004-2006, 2009-2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . -+ -+ From Paul Eggert and Jim Meyering. */ -+ -+#ifndef _DOSNAME_H -+#define _DOSNAME_H -+ -+#if (defined _WIN32 || defined __WIN32__ || \ -+ defined __MSDOS__ || defined __CYGWIN__ || \ -+ defined __EMX__ || defined __DJGPP__) -+ /* This internal macro assumes ASCII, but all hosts that support drive -+ letters use ASCII. */ -+# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \ -+ <= 'z' - 'a') -+# define FILE_SYSTEM_PREFIX_LEN(Filename) \ -+ (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) -+# ifndef __CYGWIN__ -+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1 -+# endif -+# define ISSLASH(C) ((C) == '/' || (C) == '\\') -+#else -+# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 -+# define ISSLASH(C) ((C) == '/') -+#endif -+ -+#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 -+#endif -+ -+#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -+# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) -+# else -+# define IS_ABSOLUTE_FILE_NAME(F) \ -+ (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0) -+#endif -+#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) -+ -+#endif /* DOSNAME_H_ */ -diff --git a/oathtool/gl/error.c b/oathtool/gl/error.c -index 56ac889..b3b1286 100644 ---- a/oathtool/gl/error.c -+++ b/oathtool/gl/error.c -@@ -42,6 +42,8 @@ - # define USE_UNLOCKED_IO 0 - # define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b) - # define _GL_ARG_NONNULL(a) -+#else -+# include "getprogname.h" - #endif - - #if USE_UNLOCKED_IO -@@ -113,9 +115,7 @@ int strerror_r (); - # endif - # endif - --/* The calling program should define program_name and set it to the -- name of the executing program. */ --extern char *program_name; -+#define program_name getprogname () - - # if HAVE_STRERROR_R || defined strerror_r - # define __strerror_r strerror_r -diff --git a/oathtool/gl/flexmember.h b/oathtool/gl/flexmember.h -new file mode 100644 -index 0000000..62c556b ---- /dev/null -+++ b/oathtool/gl/flexmember.h -@@ -0,0 +1,42 @@ -+/* Sizes of structs with flexible array members. -+ -+ Copyright 2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . -+ -+ Written by Paul Eggert. */ -+ -+#include -+ -+/* Nonzero multiple of alignment of TYPE, suitable for FLEXSIZEOF below. -+ On older platforms without _Alignof, use a pessimistic bound that is -+ safe in practice even if FLEXIBLE_ARRAY_MEMBER is 1. -+ On newer platforms, use _Alignof to get a tighter bound. */ -+ -+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 -+# define FLEXALIGNOF(type) (sizeof (type) & ~ (sizeof (type) - 1)) -+#else -+# define FLEXALIGNOF(type) _Alignof (type) -+#endif -+ -+/* Upper bound on the size of a struct of type TYPE with a flexible -+ array member named MEMBER that is followed by N bytes of other data. -+ This is not simply sizeof (TYPE) + N, since it may require -+ alignment on unusually picky C11 platforms, and -+ FLEXIBLE_ARRAY_MEMBER may be 1 on pre-C11 platforms. -+ Yield a value less than N if and only if arithmetic overflow occurs. */ -+ -+#define FLEXSIZEOF(type, member, n) \ -+ ((offsetof (type, member) + FLEXALIGNOF (type) - 1 + (n)) \ -+ & ~ (FLEXALIGNOF (type) - 1)) -diff --git a/oathtool/gl/getprogname.c b/oathtool/gl/getprogname.c -new file mode 100644 -index 0000000..7475c80 ---- /dev/null -+++ b/oathtool/gl/getprogname.c -@@ -0,0 +1,75 @@ -+/* Program name management. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+/* Specification. */ -+#include "getprogname.h" -+ -+#include /* get program_invocation_name declaration */ -+#include /* get __argv declaration */ -+ -+#ifdef _AIX -+# include -+# include -+# include -+#endif -+ -+#include "dirname.h" -+ -+#ifndef HAVE_GETPROGNAME -+ -+char const * -+getprogname (void) -+{ -+# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME -+ return program_invocation_short_name; -+# elif HAVE_DECL_PROGRAM_INVOCATION_NAME -+ return last_component (program_invocation_name); -+# elif HAVE_GETEXECNAME -+ const char *p = getexecname (); -+ if (!p) -+ p = "?"; -+ return last_component (p); -+# elif HAVE_DECL___ARGV -+ const char *p = __argv && __argv[0] ? __argv[0] : "?"; -+ return last_component (p); -+# elif _AIX -+ /* Idea by Bastien ROUCARIÈS , -+ http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00095.html -+ Reference: http:// -+ ibm.biz/knowctr#ssw_aix_53/com.ibm.aix.basetechref/doc/basetrf1/getprocs.htm -+ */ -+ static char *p; -+ static int first = 1; -+ if (first) -+ { -+ first = 0; -+ pid_t pid = getpid (); -+ struct procentry64 procs; -+ p = (0 < getprocs64 (&procs, sizeof procs, NULL, 0, &pid, 1) -+ ? strdup (procs.pi_comm) -+ : NULL); -+ if (!p) -+ p = "?"; -+ } -+ return p; -+# else -+# error "getprogname module not ported to this OS" -+# endif -+} -+ -+#endif -diff --git a/oathtool/gl/getprogname.h b/oathtool/gl/getprogname.h -new file mode 100644 -index 0000000..2a1b4cc ---- /dev/null -+++ b/oathtool/gl/getprogname.h -@@ -0,0 +1,38 @@ -+/* Program name management. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#ifndef _GL_GETPROGNAME_H -+#define _GL_GETPROGNAME_H -+ -+#include -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#ifndef HAVE_GETPROGNAME -+extern char const *getprogname (void) -+# ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME -+ _GL_ATTRIBUTE_PURE -+# endif -+ ; -+#endif -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif -diff --git a/oathtool/gl/intprops.h b/oathtool/gl/intprops.h -index e1fce5c..f057105 100644 ---- a/oathtool/gl/intprops.h -+++ b/oathtool/gl/intprops.h -@@ -23,6 +23,10 @@ - #include - #include - -+#ifndef __has_builtin -+# define __has_builtin(x) 0 -+#endif -+ - /* Return a value with the common real type of E and V and the value of V. */ - #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) - -@@ -47,12 +51,16 @@ - - /* Minimum and maximum values for integer types and expressions. */ - -+/* The width in bits of the integer type or expression T. -+ Padding bits are not supported; this is checked at compile-time below. */ -+#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) -+ - /* The maximum and minimum values for the integer type T. */ - #define TYPE_MINIMUM(t) ((t) ~ 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 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1))) - - /* The maximum and minimum values for the type of the expression E, - after integer promotion. E should not have side effects. */ -@@ -65,7 +73,13 @@ - ? _GL_SIGNED_INT_MAXIMUM (e) \ - : _GL_INT_NEGATE_CONVERT (e, 1)) - #define _GL_SIGNED_INT_MAXIMUM(e) \ -- (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1) -+ (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1) -+ -+/* Work around OpenVMS incompatibility with C99. */ -+#if !defined LLONG_MAX && defined __INT64_MAX -+# define LLONG_MAX __INT64_MAX -+# define LLONG_MIN __INT64_MIN -+#endif - - /* This include file assumes that signed types are two's complement without - padding bits; the above macros have undefined behavior otherwise. -@@ -84,6 +98,10 @@ verify (TYPE_MAXIMUM (long int) == LONG_MAX); - verify (TYPE_MINIMUM (long long int) == LLONG_MIN); - verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - #endif -+/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */ -+#ifdef UINT_WIDTH -+verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); -+#endif - - /* Does the __typeof__ keyword work? This could be done by - 'configure', but for now it's easier to do it by hand. */ -@@ -116,8 +134,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - signed, this macro may overestimate the true bound by one byte when - applied to unsigned types of size 2, 4, 16, ... bytes. */ - #define INT_STRLEN_BOUND(t) \ -- (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \ -- - _GL_SIGNED_TYPE_OR_EXPR (t)) \ -+ (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \ - + _GL_SIGNED_TYPE_OR_EXPR (t)) - - /* Bound on buffer size needed to represent an integer type or expression T, -@@ -222,20 +239,25 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - ? (a) < (min) >> (b) \ - : (max) >> (b) < (a)) - --/* True if __builtin_add_overflow (A, B, P) works when P is null. */ --#define _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL (7 <= __GNUC__) -+/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ -+#define _GL_HAS_BUILTIN_OVERFLOW \ -+ (5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)) -+ -+/* True if __builtin_add_overflow_p (A, B, C) works. */ -+#define _GL_HAS_BUILTIN_OVERFLOW_P \ -+ (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) - - /* The _GL*_OVERFLOW macros have the same restrictions as the - *_RANGE_OVERFLOW macros, except that they do not assume that operands - (e.g., A and B) have the same type as MIN and MAX. Instead, they assume - that the result (e.g., A + B) has that type. */ --#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL --# define _GL_ADD_OVERFLOW(a, b, min, max) -- __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0) --# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) -- __builtin_sub_overflow (a, b, (__typeof__ ((a) - (b)) *) 0) --# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) -- __builtin_mul_overflow (a, b, (__typeof__ ((a) * (b)) *) 0) -+#if _GL_HAS_BUILTIN_OVERFLOW_P -+# define _GL_ADD_OVERFLOW(a, b, min, max) \ -+ __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0) -+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ -+ __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0) -+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ -+ __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0) - #else - # define _GL_ADD_OVERFLOW(a, b, min, max) \ - ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ -@@ -315,7 +337,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) - #define INT_SUBTRACT_OVERFLOW(a, b) \ - _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) --#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL -+#if _GL_HAS_BUILTIN_OVERFLOW_P - # define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a) - #else - # define INT_NEGATE_OVERFLOW(a) \ -@@ -349,10 +371,6 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - #define INT_MULTIPLY_WRAPV(a, b, r) \ - _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW) - --#ifndef __has_builtin --# define __has_builtin(x) 0 --#endif -- - /* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 - https://llvm.org/bugs/show_bug.cgi?id=25390 -@@ -369,7 +387,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - the operation. BUILTIN is the builtin operation, and OVERFLOW the - overflow predicate. Return 1 if the result overflows. See above - for restrictions. */ --#if 5 <= __GNUC__ || __has_builtin (__builtin_add_overflow) -+#if _GL_HAS_BUILTIN_OVERFLOW - # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r) - #elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS - # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ -@@ -412,7 +430,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - # else - # define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ -- long int, LONG_MIN, LONG_MAX)) -+ long int, LONG_MIN, LONG_MAX) - # endif - #endif - -diff --git a/oathtool/gl/limits.in.h b/oathtool/gl/limits.in.h -new file mode 100644 -index 0000000..a1eae02 ---- /dev/null -+++ b/oathtool/gl/limits.in.h -@@ -0,0 +1,63 @@ -+/* A GNU-like . -+ -+ Copyright 2016 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or -+ modify it under the terms of the GNU General Public License -+ as published by the Free Software Foundation; either version 3, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, see . */ -+ -+#ifndef _@GUARD_PREFIX@_LIMITS_H -+ -+#if __GNUC__ >= 3 -+@PRAGMA_SYSTEM_HEADER@ -+#endif -+@PRAGMA_COLUMNS@ -+ -+/* The include_next requires a split double-inclusion guard. */ -+#@INCLUDE_NEXT@ @NEXT_LIMITS_H@ -+ -+#ifndef _@GUARD_PREFIX@_LIMITS_H -+#define _@GUARD_PREFIX@_LIMITS_H -+ -+/* The number of usable bits in an unsigned or signed integer type -+ with minimum value MIN and maximum value MAX, as an int expression -+ suitable in #if. Cover all known practical hosts. This -+ implementation exploits the fact that MAX is 1 less than a power of -+ 2, and merely counts the number of 1 bits in MAX; "COBn" means -+ "count the number of 1 bits in the low-order n bits"). */ -+#define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max)) -+#define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n)) -+#define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n)) -+#define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n)) -+#define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n)) -+#define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n)) -+#define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1)) -+ -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#if (! defined ULLONG_WIDTH \ -+ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) -+# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX) -+# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX) -+# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX) -+# define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX) -+# define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX) -+# define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX) -+# define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX) -+# define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX) -+# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX) -+# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX) -+# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX) -+#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ -+ -+#endif /* _@GUARD_PREFIX@_LIMITS_H */ -+#endif /* _@GUARD_PREFIX@_LIMITS_H */ -diff --git a/oathtool/gl/m4/dirname.m4 b/oathtool/gl/m4/dirname.m4 -new file mode 100644 -index 0000000..6f8bec3 ---- /dev/null -+++ b/oathtool/gl/m4/dirname.m4 -@@ -0,0 +1,19 @@ -+#serial 10 -*- autoconf -*- -+dnl Copyright (C) 2002-2006, 2009-2016 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+AC_DEFUN([gl_DIRNAME], -+[ -+ AC_REQUIRE([gl_DIRNAME_LGPL]) -+]) -+ -+AC_DEFUN([gl_DIRNAME_LGPL], -+[ -+ dnl Prerequisites of lib/dirname.h. -+ AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) -+ -+ dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c, -+ dnl lib/stripslash.c. -+]) -diff --git a/oathtool/gl/m4/double-slash-root.m4 b/oathtool/gl/m4/double-slash-root.m4 -new file mode 100644 -index 0000000..dfd3921 ---- /dev/null -+++ b/oathtool/gl/m4/double-slash-root.m4 -@@ -0,0 +1,38 @@ -+# double-slash-root.m4 serial 4 -*- Autoconf -*- -+dnl Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+AC_DEFUN([gl_DOUBLE_SLASH_ROOT], -+[ -+ AC_REQUIRE([AC_CANONICAL_HOST]) -+ AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root], -+ [ if test x"$cross_compiling" = xyes ; then -+ # When cross-compiling, there is no way to tell whether // is special -+ # short of a list of hosts. However, the only known hosts to date -+ # that have a distinct // are Apollo DomainOS (too old to port to), -+ # Cygwin, and z/OS. If anyone knows of another system for which // has -+ # special semantics and is distinct from /, please report it to -+ # . -+ case $host in -+ *-cygwin | i370-ibm-openedition) -+ gl_cv_double_slash_root=yes ;; -+ *) -+ # Be optimistic and assume that / and // are the same when we -+ # don't know. -+ gl_cv_double_slash_root='unknown, assuming no' ;; -+ esac -+ else -+ set x `ls -di / // 2>/dev/null` -+ if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then -+ gl_cv_double_slash_root=no -+ else -+ gl_cv_double_slash_root=yes -+ fi -+ fi]) -+ if test "$gl_cv_double_slash_root" = yes; then -+ AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1], -+ [Define to 1 if // is a file system root distinct from /.]) -+ fi -+]) -diff --git a/oathtool/gl/m4/extensions.m4 b/oathtool/gl/m4/extensions.m4 -index 6d378ec..e114a6f 100644 ---- a/oathtool/gl/m4/extensions.m4 -+++ b/oathtool/gl/m4/extensions.m4 -@@ -1,4 +1,4 @@ --# serial 13 -*- Autoconf -*- -+# serial 15 -*- Autoconf -*- - # Enable extensions on systems that normally disable them. - - # Copyright (C) 2003, 2006-2016 Free Software Foundation, Inc. -@@ -60,7 +60,7 @@ dnl configure.ac when using autoheader 2.62. - #ifndef _ALL_SOURCE - # undef _ALL_SOURCE - #endif --/* Enable general extensions on OS X. */ -+/* Enable general extensions on macOS. */ - #ifndef _DARWIN_C_SOURCE - # undef _DARWIN_C_SOURCE - #endif -@@ -68,14 +68,38 @@ dnl configure.ac when using autoheader 2.62. - #ifndef _GNU_SOURCE - # undef _GNU_SOURCE - #endif --/* Use GNU style printf and scanf. */ --#ifndef __USE_MINGW_ANSI_STDIO --# undef __USE_MINGW_ANSI_STDIO --#endif - /* Enable threading extensions on Solaris. */ - #ifndef _POSIX_PTHREAD_SEMANTICS - # undef _POSIX_PTHREAD_SEMANTICS - #endif -+/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ -+#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ -+# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ -+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -+# undef __STDC_WANT_IEC_60559_BFP_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ -+#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ -+# undef __STDC_WANT_IEC_60559_DFP_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ -+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ -+# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ -+#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ -+# undef __STDC_WANT_IEC_60559_TYPES_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ -+#ifndef __STDC_WANT_LIB_EXT2__ -+# undef __STDC_WANT_LIB_EXT2__ -+#endif -+/* Enable extensions specified by ISO/IEC 24747:2009. */ -+#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ -+# undef __STDC_WANT_MATH_SPEC_FUNCS__ -+#endif - /* Enable extensions on HP NonStop. */ - #ifndef _TANDEM_SOURCE - # undef _TANDEM_SOURCE -@@ -104,8 +128,14 @@ dnl configure.ac when using autoheader 2.62. - AC_DEFINE([_ALL_SOURCE]) - AC_DEFINE([_DARWIN_C_SOURCE]) - AC_DEFINE([_GNU_SOURCE]) -- AC_DEFINE([__USE_MINGW_ANSI_STDIO]) - AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__]) -+ AC_DEFINE([__STDC_WANT_LIB_EXT2__]) -+ AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__]) - AC_DEFINE([_TANDEM_SOURCE]) - AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], - [ac_cv_should_define__xopen_source], -diff --git a/oathtool/gl/m4/flexmember.m4 b/oathtool/gl/m4/flexmember.m4 -index baa9ff8..155ae9b 100644 ---- a/oathtool/gl/m4/flexmember.m4 -+++ b/oathtool/gl/m4/flexmember.m4 -@@ -1,4 +1,4 @@ --# serial 3 -+# serial 4 - # Check for flexible array member support. - - # Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. -@@ -19,8 +19,10 @@ AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER], - #include - struct s { int n; double d[]; };]], - [[int m = getchar (); -- struct s *p = malloc (offsetof (struct s, d) -- + m * sizeof (double)); -+ size_t nbytes = offsetof (struct s, d) + m * sizeof (double); -+ nbytes += sizeof (struct s) - 1; -+ nbytes -= nbytes % sizeof (struct s); -+ struct s *p = malloc (nbytes); - p->d[0] = 0.0; - return p->d != (double *) NULL;]])], - [ac_cv_c_flexmember=yes], -diff --git a/oathtool/gl/m4/getprogname.m4 b/oathtool/gl/m4/getprogname.m4 -new file mode 100644 -index 0000000..52f0224 ---- /dev/null -+++ b/oathtool/gl/m4/getprogname.m4 -@@ -0,0 +1,13 @@ -+# getprogname.m4 - check for getprogname or replacements for it -+ -+# Copyright (C) 2016 Free Software Foundation, Inc. -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# serial 2 -+ -+AC_DEFUN([gl_FUNC_GETPROGNAME], -+[ -+ AC_CHECK_FUNCS_ONCE([getprogname getexecname]) -+]) -diff --git a/oathtool/gl/m4/gnulib-comp.m4 b/oathtool/gl/m4/gnulib-comp.m4 -index f4134a9..440d5fe 100644 ---- a/oathtool/gl/m4/gnulib-comp.m4 -+++ b/oathtool/gl/m4/gnulib-comp.m4 -@@ -50,6 +50,9 @@ AC_DEFUN([gl_EARLY], - # Code from module clock-time: - # Code from module ctype: - # Code from module ctype-tests: -+ # Code from module dirname-lgpl: -+ # Code from module dosname: -+ # Code from module double-slash-root: - # Code from module dtotimespec: - # Code from module environ: - # Code from module environ-tests: -@@ -72,6 +75,8 @@ AC_DEFUN([gl_EARLY], - # Code from module fread-tests: - # Code from module fwrite-tests: - # Code from module getpagesize: -+ # Code from module getprogname: -+ # Code from module getprogname-tests: - # Code from module gettext-h: - # Code from module gettime: - # Code from module gettimeofday: -@@ -82,6 +87,8 @@ AC_DEFUN([gl_EARLY], - # Code from module inttypes: - # Code from module inttypes-incomplete: - # Code from module inttypes-tests: -+ # Code from module limits-h: -+ # Code from module limits-h-tests: - # Code from module malloc-posix: - # Code from module malloca: - # Code from module malloca-tests: -@@ -184,6 +191,8 @@ AC_DEFUN([gl_INIT], - gl_source_base='gl' - gl_FUNC_ALLOCA - gl_CLOCK_TIME -+ gl_DIRNAME_LGPL -+ gl_DOUBLE_SLASH_ROOT - gl_ENVIRON - gl_UNISTD_MODULE_INDICATOR([environ]) - gl_HEADER_ERRNO_H -@@ -204,6 +213,11 @@ AC_DEFUN([gl_INIT], - if test $REPLACE_ITOLD = 1; then - AC_LIBOBJ([itold]) - fi -+ gl_FUNC_GETPROGNAME -+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) -+ AC_CHECK_DECLS([program_invocation_name], [], [], [#include ]) -+ AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include ]) -+ AC_CHECK_DECLS([__argv], [], [], [#include ]) - AC_SUBST([LIBINTL]) - AC_SUBST([LTLIBINTL]) - gl_GETTIME -@@ -215,6 +229,12 @@ AC_DEFUN([gl_INIT], - gl_SYS_TIME_MODULE_INDICATOR([gettimeofday]) - gl_INTTYPES_H - gl_INTTYPES_INCOMPLETE -+ gl_LIMITS_H -+ gl_FUNC_MALLOC_POSIX -+ if test $REPLACE_MALLOC = 1; then -+ AC_LIBOBJ([malloc]) -+ fi -+ gl_STDLIB_MODULE_INDICATOR([malloc-posix]) - gl_MALLOCA - gl_FUNC_MEMCHR - if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then -@@ -370,11 +390,6 @@ changequote([, ])dnl - AC_LIBOBJ([getpagesize]) - fi - gl_UNISTD_MODULE_INDICATOR([getpagesize]) -- gl_FUNC_MALLOC_POSIX -- if test $REPLACE_MALLOC = 1; then -- AC_LIBOBJ([malloc]) -- fi -- gl_STDLIB_MODULE_INDICATOR([malloc-posix]) - dnl Check for prerequisites for memory fence checks. - gl_FUNC_MMAP_ANON - AC_CHECK_HEADERS_ONCE([sys/mman.h]) -@@ -488,22 +503,31 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/alloca.in.h - lib/asnprintf.c - lib/asprintf.c -+ lib/basename-lgpl.c - lib/c-ctype.c - lib/c-ctype.h -+ lib/dirname-lgpl.c -+ lib/dirname.h -+ lib/dosname.h - lib/errno.in.h - lib/error.c - lib/error.h - lib/exitfail.c - lib/exitfail.h -+ lib/flexmember.h - lib/float+.h - lib/float.c - lib/float.in.h -+ lib/getprogname.c -+ lib/getprogname.h - lib/gettext.h - lib/gettime.c - lib/gettimeofday.c - lib/intprops.h - lib/inttypes.in.h - lib/itold.c -+ lib/limits.in.h -+ lib/malloc.c - lib/malloca.c - lib/malloca.h - lib/malloca.valgrind -@@ -539,6 +563,7 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/strftime.c - lib/strftime.h - lib/string.in.h -+ lib/stripslash.c - lib/sys_time.in.h - lib/sys_types.in.h - lib/time-internal.h -@@ -570,6 +595,8 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/bison.m4 - m4/clock_time.m4 - m4/ctype.m4 -+ m4/dirname.m4 -+ m4/double-slash-root.m4 - m4/eealloc.m4 - m4/environ.m4 - m4/errno_h.m4 -@@ -582,6 +609,7 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/float_h.m4 - m4/fpieee.m4 - m4/getpagesize.m4 -+ m4/getprogname.m4 - m4/gettime.m4 - m4/gettimeofday.m4 - m4/gnulib-common.m4 -@@ -590,6 +618,7 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/inttypes-pri.m4 - m4/inttypes.m4 - m4/inttypes_h.m4 -+ m4/limits-h.m4 - m4/longlong.m4 - m4/malloc.m4 - m4/malloca.m4 -@@ -652,10 +681,12 @@ AC_DEFUN([gl_FILE_LIST], [ - tests/test-fputc.c - tests/test-fread.c - tests/test-fwrite.c -+ tests/test-getprogname.c - tests/test-gettimeofday.c - tests/test-init.sh - tests/test-intprops.c - tests/test-inttypes.c -+ tests/test-limits-h.c - tests/test-malloca.c - tests/test-memchr.c - tests/test-parse-datetime.c -@@ -693,7 +724,6 @@ AC_DEFUN([gl_FILE_LIST], [ - tests=lib/fdopen.c - tests=lib/fpucw.h - tests=lib/getpagesize.c -- tests=lib/malloc.c - tests=lib/putenv.c - tests=lib/stdalign.in.h - tests=lib/timespec-add.c -diff --git a/oathtool/gl/m4/limits-h.m4 b/oathtool/gl/m4/limits-h.m4 -new file mode 100644 -index 0000000..31fdf0a ---- /dev/null -+++ b/oathtool/gl/m4/limits-h.m4 -@@ -0,0 +1,31 @@ -+dnl Check whether limits.h has needed features. -+ -+dnl Copyright 2016 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 From Paul Eggert. -+ -+AC_DEFUN_ONCE([gl_LIMITS_H], -+[ -+ gl_CHECK_NEXT_HEADERS([limits.h]) -+ -+ AC_CACHE_CHECK([whether limits.h has ULLONG_WIDTH etc.], -+ [gl_cv_header_limits_width], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM([[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -+ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 -+ #endif -+ #include -+ int ullw = ULLONG_WIDTH;]])], -+ [gl_cv_header_limits_width=yes], -+ [gl_cv_header_limits_width=no])]) -+ if test "$gl_cv_header_limits_width" = yes; then -+ LIMITS_H= -+ else -+ LIMITS_H=limits.h -+ fi -+ AC_SUBST([LIMITS_H]) -+ AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) -+]) -diff --git a/oathtool/gl/m4/stdint.m4 b/oathtool/gl/m4/stdint.m4 -index 0b4b906..fa6f103 100644 ---- a/oathtool/gl/m4/stdint.m4 -+++ b/oathtool/gl/m4/stdint.m4 -@@ -1,4 +1,4 @@ --# stdint.m4 serial 44 -+# stdint.m4 serial 47 - dnl Copyright (C) 2001-2016 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -11,6 +11,8 @@ AC_DEFUN_ONCE([gl_STDINT_H], - [ - AC_PREREQ([2.59])dnl - -+ AC_REQUIRE([gl_LIMITS_H]) -+ - dnl Check for long long int and unsigned long long int. - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - if test $ac_cv_type_long_long_int = yes; then -@@ -282,14 +284,20 @@ static const char *macro_values[] = - ]) - ]) - fi -+ -+ HAVE_C99_STDINT_H=0 -+ HAVE_SYS_BITYPES_H=0 -+ HAVE_SYS_INTTYPES_H=0 -+ STDINT_H=stdint.h - if test "$gl_cv_header_working_stdint_h" = yes; then -+ HAVE_C99_STDINT_H=1 - dnl Now see whether the system works without - dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined. - AC_CACHE_CHECK([whether stdint.h predates C++11], - [gl_cv_header_stdint_predates_cxx11_h], - [gl_cv_header_stdint_predates_cxx11_h=yes - AC_COMPILE_IFELSE([ -- AC_LANG_PROGRAM([[ -+ AC_LANG_PROGRAM([[ - #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ - #include - ] -@@ -306,27 +314,44 @@ int32_t i32 = INT32_C (0x7fffffff); - AC_DEFINE([__STDC_LIMIT_MACROS], [1], - [Define to 1 if the system predates C++11.]) - fi -- STDINT_H= -+ AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.], -+ [gl_cv_header_stdint_width], -+ [gl_cv_header_stdint_width=no -+ AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM([[ -+ /* Work if build is not clean. */ -+ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 -+ #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -+ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 -+ #endif -+ #include -+ ]gl_STDINT_INCLUDES[ -+ int iw = UINTMAX_WIDTH; -+ ]])], -+ [gl_cv_header_stdint_width=yes])]) -+ if test "$gl_cv_header_stdint_width" = yes; then -+ STDINT_H= -+ fi - else - dnl Check for , and for - dnl (used in Linux libc4 >= 4.6.7 and libc5). - AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) - if test $ac_cv_header_sys_inttypes_h = yes; then - HAVE_SYS_INTTYPES_H=1 -- else -- HAVE_SYS_INTTYPES_H=0 - fi -- AC_SUBST([HAVE_SYS_INTTYPES_H]) - if test $ac_cv_header_sys_bitypes_h = yes; then - HAVE_SYS_BITYPES_H=1 -- else -- HAVE_SYS_BITYPES_H=0 - fi -- AC_SUBST([HAVE_SYS_BITYPES_H]) -- - gl_STDINT_TYPE_PROPERTIES -- STDINT_H=stdint.h - fi -+ -+ # The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. -+ LIMITS_H=limits.h -+ AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) -+ -+ AC_SUBST([HAVE_C99_STDINT_H]) -+ AC_SUBST([HAVE_SYS_BITYPES_H]) -+ AC_SUBST([HAVE_SYS_INTTYPES_H]) - AC_SUBST([STDINT_H]) - AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) - ]) -@@ -504,8 +529,3 @@ dnl Remove this when we can assume autoconf >= 2.61. - m4_ifdef([AC_COMPUTE_INT], [], [ - AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) - ]) -- --# Hey Emacs! --# Local Variables: --# indent-tabs-mode: nil --# End: -diff --git a/oathtool/gl/m4/stdio_h.m4 b/oathtool/gl/m4/stdio_h.m4 -index 0e38758..eaa25a0 100644 ---- a/oathtool/gl/m4/stdio_h.m4 -+++ b/oathtool/gl/m4/stdio_h.m4 -@@ -1,4 +1,4 @@ --# stdio_h.m4 serial 46 -+# stdio_h.m4 serial 48 - dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -6,9 +6,13 @@ dnl with or without modifications, as long as this notice is preserved. - - AC_DEFUN([gl_STDIO_H], - [ -- dnl For __USE_MINGW_ANSI_STDIO -- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) -- -+ AH_VERBATIM([MINGW_ANSI_STDIO], -+[/* Use GNU style printf and scanf. */ -+#ifndef __USE_MINGW_ANSI_STDIO -+# undef __USE_MINGW_ANSI_STDIO -+#endif -+]) -+ AC_DEFINE([__USE_MINGW_ANSI_STDIO]) - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - gl_NEXT_HEADERS([stdio.h]) - -diff --git a/oathtool/gl/m4/sys_types_h.m4 b/oathtool/gl/m4/sys_types_h.m4 -index b0aabb4..159b005 100644 ---- a/oathtool/gl/m4/sys_types_h.m4 -+++ b/oathtool/gl/m4/sys_types_h.m4 -@@ -1,4 +1,4 @@ --# sys_types_h.m4 serial 5 -+# sys_types_h.m4 serial 6 - dnl Copyright (C) 2011-2016 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,3 +22,28 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], - AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], - [ - ]) -+ -+# This works around a buggy version in autoconf <= 2.69. -+# See -+ -+m4_version_prereq([2.70], [], [ -+ -+# This is taken from the following Autoconf patch: -+# http://git.sv.gnu.org/cgit/autoconf.git/commit/?id=e17a30e98 -+ -+m4_undefine([AC_HEADER_MAJOR]) -+AC_DEFUN([AC_HEADER_MAJOR], -+[AC_CHECK_HEADERS_ONCE([sys/types.h]) -+AC_CHECK_HEADER([sys/mkdev.h], -+ [AC_DEFINE([MAJOR_IN_MKDEV], [1], -+ [Define to 1 if `major', `minor', and `makedev' are declared in -+ .])]) -+if test $ac_cv_header_sys_mkdev_h = no; then -+ AC_CHECK_HEADER([sys/sysmacros.h], -+ [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], -+ [Define to 1 if `major', `minor', and `makedev' are declared in -+ .])]) -+fi -+]) -+ -+]) -diff --git a/oathtool/gl/tests/malloc.c b/oathtool/gl/malloc.c -similarity index 100% -rename from oathtool/gl/tests/malloc.c -rename to oathtool/gl/malloc.c -diff --git a/oathtool/gl/parse-datetime.y b/oathtool/gl/parse-datetime.y -index 875048b..51ba4cc 100644 ---- a/oathtool/gl/parse-datetime.y -+++ b/oathtool/gl/parse-datetime.y -@@ -1704,6 +1704,7 @@ parse_datetime2 (struct timespec *result, char const *p, - bool ok = true; - char dbg_ord[DBGBUFSIZE]; - char dbg_tm[DBGBUFSIZE]; -+ char const *input_sentinel = p + strlen (p); - - if (! now) - { -@@ -1862,7 +1863,15 @@ parse_datetime2 (struct timespec *result, char const *p, - if (yyparse (&pc) != 0) - { - if (pc.parse_datetime_debug) -- dbg_printf (_("error: parsing failed, stopped at '%s'\n"), pc.input); -+ { -+ if (input_sentinel <= pc.input) -+ dbg_printf (_("error: parsing failed\n"), pc.input); -+ else -+ { -+ dbg_printf (_("error: parsing failed, stopped at '%s'\n"), -+ pc.input); -+ } -+ } - goto fail; - } - -@@ -2004,8 +2013,7 @@ parse_datetime2 (struct timespec *result, char const *p, - long int abs_time_zone = time_zone < 0 ? - time_zone : time_zone; - long int abs_time_zone_hour = abs_time_zone / 60; - int abs_time_zone_min = abs_time_zone % 60; -- char tz1buf[sizeof "XXX+0:00" -- + sizeof pc.time_zone * CHAR_BIT / 3]; -+ char tz1buf[sizeof "XXX+0:00" + TYPE_WIDTH (pc.time_zone) / 3]; - if (!tz_was_altered) - tz0 = get_tz (tz0buf); - sprintf (tz1buf, "XXX%s%ld:%02d", &"-"[time_zone < 0], -@@ -2242,7 +2250,7 @@ parse_datetime2 (struct timespec *result, char const *p, - /* Special case: using 'date -u' simply set TZ=UTC0 */ - if (STREQ(tz_env,"UTC0")) - { -- tz_src = _("TZ=UTC0 envionment value or -u"); -+ tz_src = _("TZ=UTC0 environment value or -u"); - } - else - { -diff --git a/oathtool/gl/stdint.in.h b/oathtool/gl/stdint.in.h -index cf65ec6..c86ab09 100644 ---- a/oathtool/gl/stdint.in.h -+++ b/oathtool/gl/stdint.in.h -@@ -79,49 +79,51 @@ - #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H - #define _@GUARD_PREFIX@_STDINT_H - -+/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, -+ LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ -+#include -+ -+#if ! @HAVE_C99_STDINT_H@ -+ - /* defines some of the stdint.h types as well, on glibc, - IRIX 6.5, and OpenBSD 3.8 (via ). - AIX 5.2 isn't needed and causes troubles. - Mac OS X 10.4.6 includes (which is us), but - relies on the system definitions, so include - after @NEXT_STDINT_H@. */ --#if @HAVE_SYS_TYPES_H@ && ! defined _AIX --# include --#endif -- --/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, -- LONG_MIN, LONG_MAX, ULONG_MAX. */ --#include -+# if @HAVE_SYS_TYPES_H@ && ! defined _AIX -+# include -+# endif - --#if @HAVE_INTTYPES_H@ -+# if @HAVE_INTTYPES_H@ - /* In OpenBSD 3.8, includes , which defines - int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. - also defines intptr_t and uintptr_t. */ --# include --#elif @HAVE_SYS_INTTYPES_H@ -+# include -+# elif @HAVE_SYS_INTTYPES_H@ - /* Solaris 7 has the types except the *_fast*_t types, and - the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ --# include --#endif -+# include -+# endif - --#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ -+# if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ - /* Linux libc4 >= 4.6.7 and libc5 have a that defines - int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is - included by . */ --# include --#endif -+# include -+# endif - --#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H -+# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H - - /* Minimum and maximum values for an integer type under the usual assumption. - Return an unspecified value if BITS == 0, adding a check to pacify - picky compilers. */ - --#define _STDINT_MIN(signed, bits, zero) \ -- ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero)) -+# define _STDINT_MIN(signed, bits, zero) \ -+ ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero)) - --#define _STDINT_MAX(signed, bits, zero) \ -- (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) -+# define _STDINT_MAX(signed, bits, zero) \ -+ (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) - - #if !GNULIB_defined_stdint_types - -@@ -130,26 +132,26 @@ - /* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. */ - --#undef int8_t --#undef uint8_t -+# undef int8_t -+# undef uint8_t - typedef signed char gl_int8_t; - typedef unsigned char gl_uint8_t; --#define int8_t gl_int8_t --#define uint8_t gl_uint8_t -+# define int8_t gl_int8_t -+# define uint8_t gl_uint8_t - --#undef int16_t --#undef uint16_t -+# undef int16_t -+# undef uint16_t - typedef short int gl_int16_t; - typedef unsigned short int gl_uint16_t; --#define int16_t gl_int16_t --#define uint16_t gl_uint16_t -+# define int16_t gl_int16_t -+# define uint16_t gl_uint16_t - --#undef int32_t --#undef uint32_t -+# undef int32_t -+# undef uint32_t - typedef int gl_int32_t; - typedef unsigned int gl_uint32_t; --#define int32_t gl_int32_t --#define uint32_t gl_uint32_t -+# define int32_t gl_int32_t -+# define uint32_t gl_uint32_t - - /* If the system defines INT64_MAX, assume int64_t works. That way, - if the underlying platform defines int64_t to be a 64-bit long long -@@ -157,54 +159,54 @@ typedef unsigned int gl_uint32_t; - int, which would mess up C++ name mangling. We must use #ifdef - rather than #if, to avoid an error with HP-UX 10.20 cc. */ - --#ifdef INT64_MAX --# define GL_INT64_T --#else -+# ifdef INT64_MAX -+# define GL_INT64_T -+# else - /* Do not undefine int64_t if gnulib is not being used with 64-bit - types, since otherwise it breaks platforms like Tandem/NSK. */ --# if LONG_MAX >> 31 >> 31 == 1 --# undef int64_t -+# if LONG_MAX >> 31 >> 31 == 1 -+# undef int64_t - typedef long int gl_int64_t; --# define int64_t gl_int64_t --# define GL_INT64_T --# elif defined _MSC_VER --# undef int64_t -+# define int64_t gl_int64_t -+# define GL_INT64_T -+# elif defined _MSC_VER -+# undef int64_t - typedef __int64 gl_int64_t; --# define int64_t gl_int64_t --# define GL_INT64_T --# elif @HAVE_LONG_LONG_INT@ --# undef int64_t -+# define int64_t gl_int64_t -+# define GL_INT64_T -+# elif @HAVE_LONG_LONG_INT@ -+# undef int64_t - typedef long long int gl_int64_t; --# define int64_t gl_int64_t --# define GL_INT64_T -+# define int64_t gl_int64_t -+# define GL_INT64_T -+# endif - # endif --#endif - --#ifdef UINT64_MAX --# define GL_UINT64_T --#else --# if ULONG_MAX >> 31 >> 31 >> 1 == 1 --# undef uint64_t --typedef unsigned long int gl_uint64_t; --# define uint64_t gl_uint64_t -+# ifdef UINT64_MAX - # define GL_UINT64_T --# elif defined _MSC_VER --# undef uint64_t -+# else -+# if ULONG_MAX >> 31 >> 31 >> 1 == 1 -+# undef uint64_t -+typedef unsigned long int gl_uint64_t; -+# define uint64_t gl_uint64_t -+# define GL_UINT64_T -+# elif defined _MSC_VER -+# undef uint64_t - typedef unsigned __int64 gl_uint64_t; --# define uint64_t gl_uint64_t --# define GL_UINT64_T --# elif @HAVE_UNSIGNED_LONG_LONG_INT@ --# undef uint64_t -+# define uint64_t gl_uint64_t -+# define GL_UINT64_T -+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ -+# undef uint64_t - typedef unsigned long long int gl_uint64_t; --# define uint64_t gl_uint64_t --# define GL_UINT64_T -+# define uint64_t gl_uint64_t -+# define GL_UINT64_T -+# endif - # endif --#endif - - /* Avoid collision with Solaris 2.5.1 etc. */ --#define _UINT8_T --#define _UINT32_T --#define _UINT64_T -+# define _UINT8_T -+# define _UINT32_T -+# define _UINT64_T - - - /* 7.18.1.2. Minimum-width integer types */ -@@ -213,26 +215,26 @@ typedef unsigned long long int gl_uint64_t; - types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types - are the same as the corresponding N_t types. */ - --#undef int_least8_t --#undef uint_least8_t --#undef int_least16_t --#undef uint_least16_t --#undef int_least32_t --#undef uint_least32_t --#undef int_least64_t --#undef uint_least64_t --#define int_least8_t int8_t --#define uint_least8_t uint8_t --#define int_least16_t int16_t --#define uint_least16_t uint16_t --#define int_least32_t int32_t --#define uint_least32_t uint32_t --#ifdef GL_INT64_T --# define int_least64_t int64_t --#endif --#ifdef GL_UINT64_T --# define uint_least64_t uint64_t --#endif -+# undef int_least8_t -+# undef uint_least8_t -+# undef int_least16_t -+# undef uint_least16_t -+# undef int_least32_t -+# undef uint_least32_t -+# undef int_least64_t -+# undef uint_least64_t -+# define int_least8_t int8_t -+# define uint_least8_t uint8_t -+# define int_least16_t int16_t -+# define uint_least16_t uint16_t -+# define int_least32_t int32_t -+# define uint_least32_t uint32_t -+# ifdef GL_INT64_T -+# define int_least64_t int64_t -+# endif -+# ifdef GL_UINT64_T -+# define uint_least64_t uint64_t -+# endif - - /* 7.18.1.3. Fastest minimum-width integer types */ - -@@ -245,55 +247,55 @@ typedef unsigned long long int gl_uint64_t; - uses types consistent with glibc, as that lessens the chance of - incompatibility with older GNU hosts. */ - --#undef int_fast8_t --#undef uint_fast8_t --#undef int_fast16_t --#undef uint_fast16_t --#undef int_fast32_t --#undef uint_fast32_t --#undef int_fast64_t --#undef uint_fast64_t -+# undef int_fast8_t -+# undef uint_fast8_t -+# undef int_fast16_t -+# undef uint_fast16_t -+# undef int_fast32_t -+# undef uint_fast32_t -+# undef int_fast64_t -+# undef uint_fast64_t - typedef signed char gl_int_fast8_t; - typedef unsigned char gl_uint_fast8_t; - --#ifdef __sun -+# 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 -+# else - typedef long int gl_int_fast32_t; - typedef unsigned long int gl_uint_fast32_t; --#endif -+# 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 --#define uint_fast16_t gl_uint_fast16_t --#define int_fast32_t gl_int_fast32_t --#define uint_fast32_t gl_uint_fast32_t --#ifdef GL_INT64_T --# define int_fast64_t int64_t --#endif --#ifdef GL_UINT64_T --# define uint_fast64_t uint64_t --#endif -+# define int_fast8_t gl_int_fast8_t -+# define uint_fast8_t gl_uint_fast8_t -+# define int_fast16_t gl_int_fast16_t -+# define uint_fast16_t gl_uint_fast16_t -+# define int_fast32_t gl_int_fast32_t -+# define uint_fast32_t gl_uint_fast32_t -+# ifdef GL_INT64_T -+# define int_fast64_t int64_t -+# endif -+# ifdef GL_UINT64_T -+# define uint_fast64_t uint64_t -+# endif - - /* 7.18.1.4. Integer types capable of holding object pointers */ - - /* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own - definitions of intptr_t and uintptr_t (which use int and unsigned) - to avoid clashes with declarations of system functions like sbrk. */ --#ifndef _INTPTR_T_DECLARED --#undef intptr_t --#undef uintptr_t -+# ifndef _INTPTR_T_DECLARED -+# undef intptr_t -+# undef uintptr_t - typedef long int gl_intptr_t; - typedef unsigned long int gl_uintptr_t; --#define intptr_t gl_intptr_t --#define uintptr_t gl_uintptr_t --#endif -+# define intptr_t gl_intptr_t -+# define uintptr_t gl_uintptr_t -+# endif - - /* 7.18.1.5. Greatest-width integer types */ - -@@ -304,33 +306,33 @@ typedef unsigned long int gl_uintptr_t; - similarly for UINTMAX_MAX and uintmax_t. This avoids problems with - assuming one type where another is used by the system. */ - --#ifndef INTMAX_MAX --# undef INTMAX_C --# undef intmax_t --# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -+# ifndef INTMAX_MAX -+# undef INTMAX_C -+# undef intmax_t -+# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 - typedef long long int gl_intmax_t; --# define intmax_t gl_intmax_t --# elif defined GL_INT64_T --# define intmax_t int64_t --# else -+# define intmax_t gl_intmax_t -+# elif defined GL_INT64_T -+# define intmax_t int64_t -+# else - typedef long int gl_intmax_t; --# define intmax_t gl_intmax_t -+# define intmax_t gl_intmax_t -+# endif - # endif --#endif - --#ifndef UINTMAX_MAX --# undef UINTMAX_C --# undef uintmax_t --# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -+# ifndef UINTMAX_MAX -+# undef UINTMAX_C -+# undef uintmax_t -+# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 - typedef unsigned long long int gl_uintmax_t; --# define uintmax_t gl_uintmax_t --# elif defined GL_UINT64_T --# define uintmax_t uint64_t --# else -+# define uintmax_t gl_uintmax_t -+# elif defined GL_UINT64_T -+# define uintmax_t uint64_t -+# else - typedef unsigned long int gl_uintmax_t; --# define uintmax_t gl_uintmax_t -+# define uintmax_t gl_uintmax_t -+# endif - # endif --#endif - - /* Verify that intmax_t and uintmax_t have the same size. Too much code - breaks if this is not the case. If this check fails, the reason is likely -@@ -338,8 +340,8 @@ typedef unsigned long int gl_uintmax_t; - typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - ? 1 : -1]; - --#define GNULIB_defined_stdint_types 1 --#endif /* !GNULIB_defined_stdint_types */ -+# define GNULIB_defined_stdint_types 1 -+# endif /* !GNULIB_defined_stdint_types */ - - /* 7.18.2. Limits of specified-width integer types */ - -@@ -348,37 +350,37 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - /* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. */ - --#undef INT8_MIN --#undef INT8_MAX --#undef UINT8_MAX --#define INT8_MIN (~ INT8_MAX) --#define INT8_MAX 127 --#define UINT8_MAX 255 -- --#undef INT16_MIN --#undef INT16_MAX --#undef UINT16_MAX --#define INT16_MIN (~ INT16_MAX) --#define INT16_MAX 32767 --#define UINT16_MAX 65535 -- --#undef INT32_MIN --#undef INT32_MAX --#undef UINT32_MAX --#define INT32_MIN (~ INT32_MAX) --#define INT32_MAX 2147483647 --#define UINT32_MAX 4294967295U -- --#if defined GL_INT64_T && ! defined INT64_MAX -+# undef INT8_MIN -+# undef INT8_MAX -+# undef UINT8_MAX -+# define INT8_MIN (~ INT8_MAX) -+# define INT8_MAX 127 -+# define UINT8_MAX 255 -+ -+# undef INT16_MIN -+# undef INT16_MAX -+# undef UINT16_MAX -+# define INT16_MIN (~ INT16_MAX) -+# define INT16_MAX 32767 -+# define UINT16_MAX 65535 -+ -+# undef INT32_MIN -+# undef INT32_MAX -+# undef UINT32_MAX -+# define INT32_MIN (~ INT32_MAX) -+# define INT32_MAX 2147483647 -+# define UINT32_MAX 4294967295U -+ -+# if defined GL_INT64_T && ! defined INT64_MAX - /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 - evaluates the latter incorrectly in preprocessor expressions. */ --# define INT64_MIN (- INTMAX_C (1) << 63) --# define INT64_MAX INTMAX_C (9223372036854775807) --#endif -+# define INT64_MIN (- INTMAX_C (1) << 63) -+# define INT64_MAX INTMAX_C (9223372036854775807) -+# endif - --#if defined GL_UINT64_T && ! defined UINT64_MAX --# define UINT64_MAX UINTMAX_C (18446744073709551615) --#endif -+# if defined GL_UINT64_T && ! defined UINT64_MAX -+# define UINT64_MAX UINTMAX_C (18446744073709551615) -+# endif - - /* 7.18.2.2. Limits of minimum-width integer types */ - -@@ -386,38 +388,38 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types - are the same as the corresponding N_t types. */ - --#undef INT_LEAST8_MIN --#undef INT_LEAST8_MAX --#undef UINT_LEAST8_MAX --#define INT_LEAST8_MIN INT8_MIN --#define INT_LEAST8_MAX INT8_MAX --#define UINT_LEAST8_MAX UINT8_MAX -- --#undef INT_LEAST16_MIN --#undef INT_LEAST16_MAX --#undef UINT_LEAST16_MAX --#define INT_LEAST16_MIN INT16_MIN --#define INT_LEAST16_MAX INT16_MAX --#define UINT_LEAST16_MAX UINT16_MAX -- --#undef INT_LEAST32_MIN --#undef INT_LEAST32_MAX --#undef UINT_LEAST32_MAX --#define INT_LEAST32_MIN INT32_MIN --#define INT_LEAST32_MAX INT32_MAX --#define UINT_LEAST32_MAX UINT32_MAX -- --#undef INT_LEAST64_MIN --#undef INT_LEAST64_MAX --#ifdef GL_INT64_T --# define INT_LEAST64_MIN INT64_MIN --# define INT_LEAST64_MAX INT64_MAX --#endif -+# undef INT_LEAST8_MIN -+# undef INT_LEAST8_MAX -+# undef UINT_LEAST8_MAX -+# define INT_LEAST8_MIN INT8_MIN -+# define INT_LEAST8_MAX INT8_MAX -+# define UINT_LEAST8_MAX UINT8_MAX -+ -+# undef INT_LEAST16_MIN -+# undef INT_LEAST16_MAX -+# undef UINT_LEAST16_MAX -+# define INT_LEAST16_MIN INT16_MIN -+# define INT_LEAST16_MAX INT16_MAX -+# define UINT_LEAST16_MAX UINT16_MAX -+ -+# undef INT_LEAST32_MIN -+# undef INT_LEAST32_MAX -+# undef UINT_LEAST32_MAX -+# define INT_LEAST32_MIN INT32_MIN -+# define INT_LEAST32_MAX INT32_MAX -+# define UINT_LEAST32_MAX UINT32_MAX -+ -+# undef INT_LEAST64_MIN -+# undef INT_LEAST64_MAX -+# ifdef GL_INT64_T -+# define INT_LEAST64_MIN INT64_MIN -+# define INT_LEAST64_MAX INT64_MAX -+# endif - --#undef UINT_LEAST64_MAX --#ifdef GL_UINT64_T --# define UINT_LEAST64_MAX UINT64_MAX --#endif -+# undef UINT_LEAST64_MAX -+# ifdef GL_UINT64_T -+# define UINT_LEAST64_MAX UINT64_MAX -+# endif - - /* 7.18.2.3. Limits of fastest minimum-width integer types */ - -@@ -425,117 +427,117 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types - are taken from the same list of types. */ - --#undef INT_FAST8_MIN --#undef INT_FAST8_MAX --#undef UINT_FAST8_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 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 --#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_FAST8_MIN -+# undef INT_FAST8_MAX -+# undef UINT_FAST8_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 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 -+# 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 --#ifdef GL_INT64_T --# define INT_FAST64_MIN INT64_MIN --# define INT_FAST64_MAX INT64_MAX --#endif -+# undef INT_FAST64_MIN -+# undef INT_FAST64_MAX -+# ifdef GL_INT64_T -+# define INT_FAST64_MIN INT64_MIN -+# define INT_FAST64_MAX INT64_MAX -+# endif - --#undef UINT_FAST64_MAX --#ifdef GL_UINT64_T --# define UINT_FAST64_MAX UINT64_MAX --#endif -+# undef UINT_FAST64_MAX -+# ifdef GL_UINT64_T -+# define UINT_FAST64_MAX UINT64_MAX -+# endif - - /* 7.18.2.4. Limits of integer types capable of holding object pointers */ - --#undef INTPTR_MIN --#undef INTPTR_MAX --#undef UINTPTR_MAX --#define INTPTR_MIN LONG_MIN --#define INTPTR_MAX LONG_MAX --#define UINTPTR_MAX ULONG_MAX -+# undef INTPTR_MIN -+# undef INTPTR_MAX -+# undef UINTPTR_MAX -+# define INTPTR_MIN LONG_MIN -+# define INTPTR_MAX LONG_MAX -+# define UINTPTR_MAX ULONG_MAX - - /* 7.18.2.5. Limits of greatest-width integer types */ - --#ifndef INTMAX_MAX --# undef INTMAX_MIN --# ifdef INT64_MAX --# define INTMAX_MIN INT64_MIN --# define INTMAX_MAX INT64_MAX --# else --# define INTMAX_MIN INT32_MIN --# define INTMAX_MAX INT32_MAX -+# ifndef INTMAX_MAX -+# undef INTMAX_MIN -+# ifdef INT64_MAX -+# define INTMAX_MIN INT64_MIN -+# define INTMAX_MAX INT64_MAX -+# else -+# define INTMAX_MIN INT32_MIN -+# define INTMAX_MAX INT32_MAX -+# endif - # endif --#endif - --#ifndef UINTMAX_MAX --# ifdef UINT64_MAX --# define UINTMAX_MAX UINT64_MAX --# else --# define UINTMAX_MAX UINT32_MAX -+# ifndef UINTMAX_MAX -+# ifdef UINT64_MAX -+# define UINTMAX_MAX UINT64_MAX -+# else -+# define UINTMAX_MAX UINT32_MAX -+# endif - # endif --#endif - - /* 7.18.3. Limits of other integer types */ - - /* ptrdiff_t limits */ --#undef PTRDIFF_MIN --#undef PTRDIFF_MAX --#if @APPLE_UNIVERSAL_BUILD@ --# ifdef _LP64 --# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) --# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) -+# undef PTRDIFF_MIN -+# undef PTRDIFF_MAX -+# if @APPLE_UNIVERSAL_BUILD@ -+# ifdef _LP64 -+# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) -+# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) -+# else -+# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) -+# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) -+# endif - # else --# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) --# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) --# endif --#else --# define PTRDIFF_MIN \ -+# define PTRDIFF_MIN \ - _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) --# define PTRDIFF_MAX \ -+# define PTRDIFF_MAX \ - _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) --#endif -+# endif - - /* sig_atomic_t limits */ --#undef SIG_ATOMIC_MIN --#undef SIG_ATOMIC_MAX --#define SIG_ATOMIC_MIN \ -+# undef SIG_ATOMIC_MIN -+# undef SIG_ATOMIC_MAX -+# define SIG_ATOMIC_MIN \ - _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) --#define SIG_ATOMIC_MAX \ -+# define SIG_ATOMIC_MAX \ - _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) - - - /* size_t limit */ --#undef SIZE_MAX --#if @APPLE_UNIVERSAL_BUILD@ --# ifdef _LP64 --# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) -+# undef SIZE_MAX -+# if @APPLE_UNIVERSAL_BUILD@ -+# ifdef _LP64 -+# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) -+# else -+# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) -+# endif - # else --# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) -+# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) - # endif --#else --# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) --#endif - - /* wchar_t limits */ - /* Get WCHAR_MIN, WCHAR_MAX. -@@ -543,29 +545,29 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - sequence of nested includes - -> -> -> , and the latter includes - and assumes its types are already defined. */ --#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) -+# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ --# include --# include --# include --# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H --# include --# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H --#endif --#undef WCHAR_MIN --#undef WCHAR_MAX --#define WCHAR_MIN \ -+# include -+# include -+# include -+# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -+# include -+# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -+# endif -+# undef WCHAR_MIN -+# undef WCHAR_MAX -+# define WCHAR_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) --#define WCHAR_MAX \ -+# define WCHAR_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) - - /* wint_t limits */ --#undef WINT_MIN --#undef WINT_MAX --#define WINT_MIN \ -+# undef WINT_MIN -+# undef WINT_MAX -+# define WINT_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) --#define WINT_MAX \ -+# define WINT_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) - - /* 7.18.4. Macros for integer constants */ -@@ -576,59 +578,120 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - /* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ - --#undef INT8_C --#undef UINT8_C --#define INT8_C(x) x --#define UINT8_C(x) x -- --#undef INT16_C --#undef UINT16_C --#define INT16_C(x) x --#define UINT16_C(x) x -- --#undef INT32_C --#undef UINT32_C --#define INT32_C(x) x --#define UINT32_C(x) x ## U -- --#undef INT64_C --#undef UINT64_C --#if LONG_MAX >> 31 >> 31 == 1 --# define INT64_C(x) x##L --#elif defined _MSC_VER --# define INT64_C(x) x##i64 --#elif @HAVE_LONG_LONG_INT@ --# define INT64_C(x) x##LL --#endif --#if ULONG_MAX >> 31 >> 31 >> 1 == 1 --# define UINT64_C(x) x##UL --#elif defined _MSC_VER --# define UINT64_C(x) x##ui64 --#elif @HAVE_UNSIGNED_LONG_LONG_INT@ --# define UINT64_C(x) x##ULL --#endif -+# undef INT8_C -+# undef UINT8_C -+# define INT8_C(x) x -+# define UINT8_C(x) x -+ -+# undef INT16_C -+# undef UINT16_C -+# define INT16_C(x) x -+# define UINT16_C(x) x -+ -+# undef INT32_C -+# undef UINT32_C -+# define INT32_C(x) x -+# define UINT32_C(x) x ## U -+ -+# undef INT64_C -+# undef UINT64_C -+# if LONG_MAX >> 31 >> 31 == 1 -+# define INT64_C(x) x##L -+# elif defined _MSC_VER -+# define INT64_C(x) x##i64 -+# elif @HAVE_LONG_LONG_INT@ -+# define INT64_C(x) x##LL -+# endif -+# if ULONG_MAX >> 31 >> 31 >> 1 == 1 -+# define UINT64_C(x) x##UL -+# elif defined _MSC_VER -+# define UINT64_C(x) x##ui64 -+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ -+# define UINT64_C(x) x##ULL -+# endif - - /* 7.18.4.2. Macros for greatest-width integer constants */ - --#ifndef INTMAX_C --# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 --# define INTMAX_C(x) x##LL --# elif defined GL_INT64_T --# define INTMAX_C(x) INT64_C(x) --# else --# define INTMAX_C(x) x##L -+# ifndef INTMAX_C -+# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -+# define INTMAX_C(x) x##LL -+# elif defined GL_INT64_T -+# define INTMAX_C(x) INT64_C(x) -+# else -+# define INTMAX_C(x) x##L -+# endif - # endif --#endif - --#ifndef UINTMAX_C --# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 --# define UINTMAX_C(x) x##ULL --# elif defined GL_UINT64_T --# define UINTMAX_C(x) UINT64_C(x) --# else --# define UINTMAX_C(x) x##UL -+# ifndef UINTMAX_C -+# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -+# define UINTMAX_C(x) x##ULL -+# elif defined GL_UINT64_T -+# define UINTMAX_C(x) UINT64_C(x) -+# else -+# define UINTMAX_C(x) x##UL -+# endif - # endif --#endif -+ -+#endif /* !@HAVE_C99_STDINT_H@ */ -+ -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#if (!defined UINTMAX_WIDTH \ -+ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) -+# ifdef INT8_MAX -+# define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX) -+# endif -+# ifdef UINT8_MAX -+# define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX) -+# endif -+# ifdef INT16_MAX -+# define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX) -+# endif -+# ifdef UINT16_MAX -+# define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX) -+# endif -+# ifdef INT32_MAX -+# define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX) -+# endif -+# ifdef UINT32_MAX -+# define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX) -+# endif -+# ifdef INT64_MAX -+# define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX) -+# endif -+# ifdef UINT64_MAX -+# define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX) -+# endif -+# define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX) -+# define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX) -+# define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX) -+# define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX) -+# define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX) -+# define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX) -+# define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX) -+# define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX) -+# define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX) -+# define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX) -+# define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX) -+# define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX) -+# define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX) -+# define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX) -+# define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX) -+# define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX) -+# define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX) -+# define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX) -+# define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX) -+# define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX) -+# define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX) -+# define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX) -+# define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX) -+# ifdef WINT_MAX -+# define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX) -+# endif -+# ifdef SIG_ATOMIC_MAX -+# define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX) -+# endif -+#endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ - - #endif /* _@GUARD_PREFIX@_STDINT_H */ - #endif /* !(defined __ANDROID__ && ...) */ -diff --git a/oathtool/gl/stripslash.c b/oathtool/gl/stripslash.c -new file mode 100644 -index 0000000..0453e36 ---- /dev/null -+++ b/oathtool/gl/stripslash.c -@@ -0,0 +1,45 @@ -+/* stripslash.c -- remove redundant trailing slashes from a file name -+ -+ Copyright (C) 1990, 2001, 2003-2006, 2009-2016 Free Software Foundation, -+ Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+#include "dirname.h" -+ -+/* Remove trailing slashes from FILE. Return true if a trailing slash -+ was removed. This is useful when using file name completion from a -+ shell that adds a "/" after directory names (such as tcsh and -+ bash), because on symlinks to directories, several system calls -+ have different semantics according to whether a trailing slash is -+ present. */ -+ -+bool -+strip_trailing_slashes (char *file) -+{ -+ char *base = last_component (file); -+ char *base_lim; -+ bool had_slash; -+ -+ /* last_component returns "" for file system roots, but we need to turn -+ "///" into "/". */ -+ if (! *base) -+ base = file; -+ base_lim = base + base_len (base); -+ had_slash = (*base_lim != '\0'); -+ *base_lim = '\0'; -+ return had_slash; -+} -diff --git a/oathtool/gl/tests/Makefile.am b/oathtool/gl/tests/Makefile.am -index 08f7318..79c707c 100644 ---- a/oathtool/gl/tests/Makefile.am -+++ b/oathtool/gl/tests/Makefile.am -@@ -207,6 +207,16 @@ EXTRA_libtests_a_SOURCES += getpagesize.c - - ## end gnulib module getpagesize - -+## begin gnulib module getprogname-tests -+ -+DEFS += -DEXEEXT=\"@EXEEXT@\" -+TESTS += test-getprogname -+check_PROGRAMS += test-getprogname -+test_getprogname_LDADD = $(LDADD) -+EXTRA_DIST += test-getprogname.c -+ -+## end gnulib module getprogname-tests -+ - ## begin gnulib module gettimeofday-tests - - TESTS += test-gettimeofday -@@ -232,14 +242,13 @@ EXTRA_DIST += test-inttypes.c - - ## end gnulib module inttypes-tests - --## begin gnulib module malloc-posix -- -- --EXTRA_DIST += malloc.c -+## begin gnulib module limits-h-tests - --EXTRA_libtests_a_SOURCES += malloc.c -+TESTS += test-limits-h -+check_PROGRAMS += test-limits-h -+EXTRA_DIST += test-limits-h.c - --## end gnulib module malloc-posix -+## end gnulib module limits-h-tests - - ## begin gnulib module malloca-tests - -diff --git a/oathtool/gl/tests/test-getprogname.c b/oathtool/gl/tests/test-getprogname.c -new file mode 100644 -index 0000000..6e3f694 ---- /dev/null -+++ b/oathtool/gl/tests/test-getprogname.c -@@ -0,0 +1,31 @@ -+/* Test the gnulib getprogname module. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+#include "getprogname.h" -+#include -+#include -+ -+#define STREQ(a, b) (strcmp (a, b) == 0) -+ -+int -+main (void) -+{ -+ char const *p = getprogname (); -+ assert (STREQ (p, "test-getprogname" EXEEXT)); -+ return 0; -+} -diff --git a/oathtool/gl/tests/test-limits-h.c b/oathtool/gl/tests/test-limits-h.c -new file mode 100644 -index 0000000..597dabf ---- /dev/null -+++ b/oathtool/gl/tests/test-limits-h.c -@@ -0,0 +1,46 @@ -+/* Test of substitute. -+ Copyright 2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* Written by Paul Eggert. */ -+ -+#include -+ -+#include -+ -+#include "verify.h" -+ -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#define verify_width(width, min, max) \ -+ verify ((max) >> ((width) - 1 - ((min) < 0)) == 1) -+ -+verify_width (CHAR_WIDTH, CHAR_MIN, CHAR_MAX); -+verify_width (SCHAR_WIDTH, SCHAR_MIN, SCHAR_MAX); -+verify_width (UCHAR_WIDTH, 0, UCHAR_MAX); -+verify_width (SHRT_WIDTH, SHRT_MIN, SHRT_MAX); -+verify_width (USHRT_WIDTH, 0, USHRT_MAX); -+verify_width (INT_WIDTH, INT_MIN, INT_MAX); -+verify_width (UINT_WIDTH, 0, UINT_MAX); -+verify_width (LONG_WIDTH, LONG_MIN, LONG_MAX); -+verify_width (ULONG_WIDTH, 0, ULONG_MAX); -+verify_width (LLONG_WIDTH, LLONG_MIN, LLONG_MAX); -+verify_width (ULLONG_WIDTH, 0, ULLONG_MAX); -+ -+int -+main (void) -+{ -+ return 0; -+} -diff --git a/oathtool/gl/tests/test-parse-datetime.c b/oathtool/gl/tests/test-parse-datetime.c -index 16a2136..c94fdf3 100644 ---- a/oathtool/gl/tests/test-parse-datetime.c -+++ b/oathtool/gl/tests/test-parse-datetime.c -@@ -24,7 +24,6 @@ - #include - #include - --#include "progname.h" - #include "macros.h" - - #ifdef DEBUG -@@ -121,8 +120,6 @@ main (int argc _GL_UNUSED, char **argv) - long gmtoff; - time_t ref_time = 1304250918; - -- set_program_name (argv[0]); -- - /* Set the time zone to US Eastern time with the 2012 rules. This - should disable any leap second support. Otherwise, there will be - a problem with glibc on sites that default to leap seconds; see -diff --git a/oathtool/gl/tests/test-stdint.c b/oathtool/gl/tests/test-stdint.c -index 7705fc7..c0e2f08 100644 ---- a/oathtool/gl/tests/test-stdint.c -+++ b/oathtool/gl/tests/test-stdint.c -@@ -351,6 +351,64 @@ verify_same_types (INTMAX_C (17), (intmax_t)0 + 0); - verify (UINTMAX_C (17) == 17); - verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0); - -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#define verify_width(width, min, max) \ -+ verify ((max) >> ((width) - 1 - ((min) < 0)) == 1) -+ -+#ifdef INT8_MAX -+verify_width (INT8_WIDTH, INT8_MIN, INT8_MAX); -+#endif -+#ifdef UINT8_MAX -+verify_width (UINT8_WIDTH, 0, UINT8_MAX); -+#endif -+#ifdef INT16_MAX -+verify_width (INT16_WIDTH, INT16_MIN, INT16_MAX); -+#endif -+#ifdef UINT16_MAX -+verify_width (UINT16_WIDTH, 0, UINT16_MAX); -+#endif -+#ifdef INT32_MAX -+verify_width (INT32_WIDTH, INT32_MIN, INT32_MAX); -+#endif -+#ifdef UINT32_MAX -+verify_width (UINT32_WIDTH, 0, UINT32_MAX); -+#endif -+#ifdef INT64_MAX -+verify_width (INT64_WIDTH, INT64_MIN, INT64_MAX); -+#endif -+#ifdef UINT64_MAX -+verify_width (UINT64_WIDTH, 0, UINT64_MAX); -+#endif -+verify_width (INT_LEAST8_WIDTH, INT_LEAST8_MIN, INT_LEAST8_MAX); -+verify_width (UINT_LEAST8_WIDTH, 0, UINT_LEAST8_MAX); -+verify_width (INT_LEAST16_WIDTH, INT_LEAST16_MIN, INT_LEAST16_MAX); -+verify_width (UINT_LEAST16_WIDTH, 0, UINT_LEAST16_MAX); -+verify_width (INT_LEAST32_WIDTH, INT_LEAST32_MIN, INT_LEAST32_MAX); -+verify_width (UINT_LEAST32_WIDTH, 0, UINT_LEAST32_MAX); -+verify_width (INT_LEAST64_WIDTH, INT_LEAST64_MIN, INT_LEAST64_MAX); -+verify_width (UINT_LEAST64_WIDTH, 0, UINT_LEAST64_MAX); -+verify_width (INT_FAST8_WIDTH, INT_FAST8_MIN, INT_FAST8_MAX); -+verify_width (UINT_FAST8_WIDTH, 0, UINT_FAST8_MAX); -+verify_width (INT_FAST16_WIDTH, INT_FAST16_MIN, INT_FAST16_MAX); -+verify_width (UINT_FAST16_WIDTH, 0, UINT_FAST16_MAX); -+verify_width (INT_FAST32_WIDTH, INT_FAST32_MIN, INT_FAST32_MAX); -+verify_width (UINT_FAST32_WIDTH, 0, UINT_FAST32_MAX); -+verify_width (INT_FAST64_WIDTH, INT_FAST64_MIN, INT_FAST64_MAX); -+verify_width (UINT_FAST64_WIDTH, 0, UINT_FAST64_MAX); -+verify_width (INTPTR_WIDTH, INTPTR_MIN, INTPTR_MAX); -+verify_width (UINTPTR_WIDTH, 0, UINTPTR_MAX); -+verify_width (INTMAX_WIDTH, INTMAX_MIN, INTMAX_MAX); -+verify_width (UINTMAX_WIDTH, 0, UINTMAX_MAX); -+verify_width (PTRDIFF_WIDTH, PTRDIFF_MIN, PTRDIFF_MAX); -+verify_width (SIZE_WIDTH, 0, SIZE_MAX); -+verify_width (WCHAR_WIDTH, WCHAR_MIN, WCHAR_MAX); -+#ifdef WINT_MAX -+verify_width (WINT_WIDTH, WINT_MIN, WINT_MAX); -+#endif -+#ifdef SIG_ATOMIC_MAX -+verify_width (SIG_ATOMIC_WIDTH, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX); -+#endif - - int - main (void) -diff --git a/oathtool/gl/tests/test-version-etc.c b/oathtool/gl/tests/test-version-etc.c -index 4382c76..66404a3 100644 ---- a/oathtool/gl/tests/test-version-etc.c -+++ b/oathtool/gl/tests/test-version-etc.c -@@ -19,14 +19,12 @@ - - #include "version-etc.h" - --#include "progname.h" - - #define AUTHORS "Sergey Poznyakoff", "Eric Blake" - - int - main (int argc _GL_UNUSED, char **argv) - { -- set_program_name (argv[0]); - version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS, - (const char *) NULL); - return 0; -diff --git a/oathtool/gl/tests/test-xalloc-die.c b/oathtool/gl/tests/test-xalloc-die.c -index 9329750..f681ca5 100644 ---- a/oathtool/gl/tests/test-xalloc-die.c -+++ b/oathtool/gl/tests/test-xalloc-die.c -@@ -19,12 +19,10 @@ - #include - - #include "xalloc.h" --#include "progname.h" - - int - main (int argc _GL_UNUSED, char **argv) - { -- set_program_name (argv[0]); - xalloc_die (); - return 0; - } -diff --git a/oathtool/gl/time_rz.c b/oathtool/gl/time_rz.c -index 55b764e..38afb5f 100644 ---- a/oathtool/gl/time_rz.c -+++ b/oathtool/gl/time_rz.c -@@ -32,6 +32,7 @@ - #include - #include - -+#include "flexmember.h" - #include "time-internal.h" - - #if !HAVE_TZSET -@@ -94,7 +95,7 @@ tzalloc (char const *name) - { - size_t name_size = name ? strlen (name) + 1 : 0; - size_t abbr_size = name_size < ABBR_SIZE_MIN ? ABBR_SIZE_MIN : name_size + 1; -- timezone_t tz = malloc (offsetof (struct tm_zone, abbrs) + abbr_size); -+ timezone_t tz = malloc (FLEXSIZEOF (struct tm_zone, abbrs, abbr_size)); - if (tz) - { - tz->next = NULL; -diff --git a/oathtool/gl/xalloc-oversized.h b/oathtool/gl/xalloc-oversized.h -index 44f1644..53e6556 100644 ---- a/oathtool/gl/xalloc-oversized.h -+++ b/oathtool/gl/xalloc-oversized.h -@@ -43,16 +43,8 @@ - nonnegative. This is a macro, not a function, so that it - works correctly even when SIZE_MAX < N. */ - --/* GCC 7 __builtin_mul_overflow should easily compute this. See: -- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68120 */ --#if 7 <= __GNUC__ --# define xalloc_oversized(n, s) __builtin_mul_overflow (n, s, (size_t *) NULL) -- --/* GCC 5 and Clang __builtin_mul_overflow needs a temporary, and -- should be used only for non-constant operands, so that -- xalloc_oversized is a constant expression if both arguments are. -- Do not use this if pedantic, since pedantic GCC issues a diagnostic -- for ({ ... }). */ -+#if 7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p) -+# define xalloc_oversized(n, s) __builtin_mul_overflow_p (n, s, (size_t) 1) - #elif ((5 <= __GNUC__ \ - || (__has_builtin (__builtin_mul_overflow) \ - && __has_builtin (__builtin_constant_p))) \ -diff --git a/pskctool/gl/Makefile.am b/pskctool/gl/Makefile.am -index eb39de1..7e2e737 100644 ---- a/pskctool/gl/Makefile.am -+++ b/pskctool/gl/Makefile.am -@@ -62,6 +62,21 @@ HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER) - - ## end gnulib module absolute-header - -+## begin gnulib module dirname-lgpl -+ -+libgnu_la_SOURCES += dirname-lgpl.c basename-lgpl.c stripslash.c -+ -+EXTRA_DIST += dirname.h -+ -+## end gnulib module dirname-lgpl -+ -+## begin gnulib module dosname -+ -+ -+EXTRA_DIST += dosname.h -+ -+## end gnulib module dosname -+ - ## begin gnulib module errno - - BUILT_SOURCES += $(ERRNO_H) -@@ -132,6 +147,12 @@ EXTRA_libgnu_la_SOURCES += ftello.c - - ## end gnulib module ftello - -+## begin gnulib module getprogname -+ -+libgnu_la_SOURCES += getprogname.h getprogname.c -+ -+## end gnulib module getprogname -+ - ## begin gnulib module gettext-h - - libgnu_la_SOURCES += gettext.h -@@ -154,6 +175,34 @@ EXTRA_DIST += intprops.h - - ## end gnulib module intprops - -+## begin gnulib module limits-h -+ -+BUILT_SOURCES += $(LIMITS_H) -+ -+# We need the following in order to create when the system -+# doesn't have one that is compatible with GNU. -+if GL_GENERATE_LIMITS_H -+limits.h: limits.in.h $(top_builddir)/config.status -+ $(AM_V_GEN)rm -f $@-t $@ && \ -+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ -+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -+ -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \ -+ < $(srcdir)/limits.in.h; \ -+ } > $@-t && \ -+ mv $@-t $@ -+else -+limits.h: $(top_builddir)/config.status -+ rm -f $@ -+endif -+MOSTLYCLEANFILES += limits.h limits.h-t -+ -+EXTRA_DIST += limits.in.h -+ -+## end gnulib module limits-h -+ - ## begin gnulib module lseek - - -@@ -322,6 +371,29 @@ EXTRA_DIST += stdarg.in.h - - ## end gnulib module stdarg - -+## begin gnulib module stdbool -+ -+BUILT_SOURCES += $(STDBOOL_H) -+ -+# We need the following in order to create when the system -+# doesn't have one that works. -+if GL_GENERATE_STDBOOL_H -+stdbool.h: stdbool.in.h $(top_builddir)/config.status -+ $(AM_V_GEN)rm -f $@-t $@ && \ -+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ -+ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ -+ } > $@-t && \ -+ mv $@-t $@ -+else -+stdbool.h: $(top_builddir)/config.status -+ rm -f $@ -+endif -+MOSTLYCLEANFILES += stdbool.h stdbool.h-t -+ -+EXTRA_DIST += stdbool.in.h -+ -+## end gnulib module stdbool -+ - ## begin gnulib module stddef - - BUILT_SOURCES += $(STDDEF_H) -@@ -369,6 +441,7 @@ stdint.h: stdint.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_STDINT_H''@|$(NEXT_STDINT_H)|g' \ -+ -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \ - -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ - -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ - -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ -diff --git a/pskctool/gl/basename-lgpl.c b/pskctool/gl/basename-lgpl.c -new file mode 100644 -index 0000000..1182109 ---- /dev/null -+++ b/pskctool/gl/basename-lgpl.c -@@ -0,0 +1,75 @@ -+/* basename.c -- return the last element in a file name -+ -+ Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software -+ Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+#include "dirname.h" -+ -+#include -+ -+/* Return the address of the last file name component of NAME. If -+ NAME has no relative file name components because it is a file -+ system root, return the empty string. */ -+ -+char * -+last_component (char const *name) -+{ -+ char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); -+ char const *p; -+ bool saw_slash = false; -+ -+ while (ISSLASH (*base)) -+ base++; -+ -+ for (p = base; *p; p++) -+ { -+ if (ISSLASH (*p)) -+ saw_slash = true; -+ else if (saw_slash) -+ { -+ base = p; -+ saw_slash = false; -+ } -+ } -+ -+ return (char *) base; -+} -+ -+/* Return the length of the basename NAME. Typically NAME is the -+ value returned by base_name or last_component. Act like strlen -+ (NAME), except omit all trailing slashes. */ -+ -+size_t -+base_len (char const *name) -+{ -+ size_t len; -+ size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name); -+ -+ for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) -+ continue; -+ -+ if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1 -+ && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2]) -+ return 2; -+ -+ if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len -+ && len == prefix_len && ISSLASH (name[prefix_len])) -+ return prefix_len + 1; -+ -+ return len; -+} -diff --git a/pskctool/gl/dirname-lgpl.c b/pskctool/gl/dirname-lgpl.c -new file mode 100644 -index 0000000..a7aabf9 ---- /dev/null -+++ b/pskctool/gl/dirname-lgpl.c -@@ -0,0 +1,86 @@ -+/* dirname.c -- return all but the last element in a file name -+ -+ Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software -+ Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+#include "dirname.h" -+ -+#include -+#include -+ -+/* Return the length of the prefix of FILE that will be used by -+ dir_name. If FILE is in the working directory, this returns zero -+ even though 'dir_name (FILE)' will return ".". Works properly even -+ if there are trailing slashes (by effectively ignoring them). */ -+ -+size_t -+dir_len (char const *file) -+{ -+ size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file); -+ size_t length; -+ -+ /* Advance prefix_length beyond important leading slashes. */ -+ prefix_length += (prefix_length != 0 -+ ? (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -+ && ISSLASH (file[prefix_length])) -+ : (ISSLASH (file[0]) -+ ? ((DOUBLE_SLASH_IS_DISTINCT_ROOT -+ && ISSLASH (file[1]) && ! ISSLASH (file[2]) -+ ? 2 : 1)) -+ : 0)); -+ -+ /* Strip the basename and any redundant slashes before it. */ -+ for (length = last_component (file) - file; -+ prefix_length < length; length--) -+ if (! ISSLASH (file[length - 1])) -+ break; -+ return length; -+} -+ -+ -+/* In general, we can't use the builtin 'dirname' function if available, -+ since it has different meanings in different environments. -+ In some environments the builtin 'dirname' modifies its argument. -+ -+ Return the leading directories part of FILE, allocated with malloc. -+ Works properly even if there are trailing slashes (by effectively -+ ignoring them). Return NULL on failure. -+ -+ If lstat (FILE) would succeed, then { chdir (dir_name (FILE)); -+ lstat (base_name (FILE)); } will access the same file. Likewise, -+ if the sequence { chdir (dir_name (FILE)); -+ rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE -+ to "foo" in the same directory FILE was in. */ -+ -+char * -+mdir_name (char const *file) -+{ -+ size_t length = dir_len (file); -+ bool append_dot = (length == 0 -+ || (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -+ && length == FILE_SYSTEM_PREFIX_LEN (file) -+ && file[2] != '\0' && ! ISSLASH (file[2]))); -+ char *dir = malloc (length + append_dot + 1); -+ if (!dir) -+ return NULL; -+ memcpy (dir, file, length); -+ if (append_dot) -+ dir[length++] = '.'; -+ dir[length] = '\0'; -+ return dir; -+} -diff --git a/pskctool/gl/dirname.h b/pskctool/gl/dirname.h -new file mode 100644 -index 0000000..875b31b ---- /dev/null -+++ b/pskctool/gl/dirname.h -@@ -0,0 +1,54 @@ -+/* Take file names apart into directory and base names. -+ -+ Copyright (C) 1998, 2001, 2003-2006, 2009-2016 Free Software Foundation, -+ Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#ifndef DIRNAME_H_ -+# define DIRNAME_H_ 1 -+ -+# include -+# include -+# include "dosname.h" -+ -+# ifndef DIRECTORY_SEPARATOR -+# define DIRECTORY_SEPARATOR '/' -+# endif -+ -+# ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT -+# define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 -+# endif -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+# if GNULIB_DIRNAME -+char *base_name (char const *file); -+char *dir_name (char const *file); -+# endif -+ -+char *mdir_name (char const *file); -+size_t base_len (char const *file) _GL_ATTRIBUTE_PURE; -+size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE; -+char *last_component (char const *file) _GL_ATTRIBUTE_PURE; -+ -+bool strip_trailing_slashes (char *file); -+ -+#ifdef __cplusplus -+} /* extern "C" */ -+#endif -+ -+#endif /* not DIRNAME_H_ */ -diff --git a/pskctool/gl/dosname.h b/pskctool/gl/dosname.h -new file mode 100644 -index 0000000..83a953f ---- /dev/null -+++ b/pskctool/gl/dosname.h -@@ -0,0 +1,53 @@ -+/* File names on MS-DOS/Windows systems. -+ -+ Copyright (C) 2000-2001, 2004-2006, 2009-2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . -+ -+ From Paul Eggert and Jim Meyering. */ -+ -+#ifndef _DOSNAME_H -+#define _DOSNAME_H -+ -+#if (defined _WIN32 || defined __WIN32__ || \ -+ defined __MSDOS__ || defined __CYGWIN__ || \ -+ defined __EMX__ || defined __DJGPP__) -+ /* This internal macro assumes ASCII, but all hosts that support drive -+ letters use ASCII. */ -+# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \ -+ <= 'z' - 'a') -+# define FILE_SYSTEM_PREFIX_LEN(Filename) \ -+ (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) -+# ifndef __CYGWIN__ -+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1 -+# endif -+# define ISSLASH(C) ((C) == '/' || (C) == '\\') -+#else -+# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 -+# define ISSLASH(C) ((C) == '/') -+#endif -+ -+#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 -+#endif -+ -+#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -+# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) -+# else -+# define IS_ABSOLUTE_FILE_NAME(F) \ -+ (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0) -+#endif -+#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) -+ -+#endif /* DOSNAME_H_ */ -diff --git a/pskctool/gl/error.c b/pskctool/gl/error.c -index 56ac889..b3b1286 100644 ---- a/pskctool/gl/error.c -+++ b/pskctool/gl/error.c -@@ -42,6 +42,8 @@ - # define USE_UNLOCKED_IO 0 - # define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b) - # define _GL_ARG_NONNULL(a) -+#else -+# include "getprogname.h" - #endif - - #if USE_UNLOCKED_IO -@@ -113,9 +115,7 @@ int strerror_r (); - # endif - # endif - --/* The calling program should define program_name and set it to the -- name of the executing program. */ --extern char *program_name; -+#define program_name getprogname () - - # if HAVE_STRERROR_R || defined strerror_r - # define __strerror_r strerror_r -diff --git a/pskctool/gl/getprogname.c b/pskctool/gl/getprogname.c -new file mode 100644 -index 0000000..7475c80 ---- /dev/null -+++ b/pskctool/gl/getprogname.c -@@ -0,0 +1,75 @@ -+/* Program name management. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+/* Specification. */ -+#include "getprogname.h" -+ -+#include /* get program_invocation_name declaration */ -+#include /* get __argv declaration */ -+ -+#ifdef _AIX -+# include -+# include -+# include -+#endif -+ -+#include "dirname.h" -+ -+#ifndef HAVE_GETPROGNAME -+ -+char const * -+getprogname (void) -+{ -+# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME -+ return program_invocation_short_name; -+# elif HAVE_DECL_PROGRAM_INVOCATION_NAME -+ return last_component (program_invocation_name); -+# elif HAVE_GETEXECNAME -+ const char *p = getexecname (); -+ if (!p) -+ p = "?"; -+ return last_component (p); -+# elif HAVE_DECL___ARGV -+ const char *p = __argv && __argv[0] ? __argv[0] : "?"; -+ return last_component (p); -+# elif _AIX -+ /* Idea by Bastien ROUCARIÈS , -+ http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00095.html -+ Reference: http:// -+ ibm.biz/knowctr#ssw_aix_53/com.ibm.aix.basetechref/doc/basetrf1/getprocs.htm -+ */ -+ static char *p; -+ static int first = 1; -+ if (first) -+ { -+ first = 0; -+ pid_t pid = getpid (); -+ struct procentry64 procs; -+ p = (0 < getprocs64 (&procs, sizeof procs, NULL, 0, &pid, 1) -+ ? strdup (procs.pi_comm) -+ : NULL); -+ if (!p) -+ p = "?"; -+ } -+ return p; -+# else -+# error "getprogname module not ported to this OS" -+# endif -+} -+ -+#endif -diff --git a/pskctool/gl/getprogname.h b/pskctool/gl/getprogname.h -new file mode 100644 -index 0000000..2a1b4cc ---- /dev/null -+++ b/pskctool/gl/getprogname.h -@@ -0,0 +1,38 @@ -+/* Program name management. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#ifndef _GL_GETPROGNAME_H -+#define _GL_GETPROGNAME_H -+ -+#include -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#ifndef HAVE_GETPROGNAME -+extern char const *getprogname (void) -+# ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME -+ _GL_ATTRIBUTE_PURE -+# endif -+ ; -+#endif -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif -diff --git a/pskctool/gl/intprops.h b/pskctool/gl/intprops.h -index e1fce5c..f057105 100644 ---- a/pskctool/gl/intprops.h -+++ b/pskctool/gl/intprops.h -@@ -23,6 +23,10 @@ - #include - #include - -+#ifndef __has_builtin -+# define __has_builtin(x) 0 -+#endif -+ - /* Return a value with the common real type of E and V and the value of V. */ - #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) - -@@ -47,12 +51,16 @@ - - /* Minimum and maximum values for integer types and expressions. */ - -+/* The width in bits of the integer type or expression T. -+ Padding bits are not supported; this is checked at compile-time below. */ -+#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) -+ - /* The maximum and minimum values for the integer type T. */ - #define TYPE_MINIMUM(t) ((t) ~ 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 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1))) - - /* The maximum and minimum values for the type of the expression E, - after integer promotion. E should not have side effects. */ -@@ -65,7 +73,13 @@ - ? _GL_SIGNED_INT_MAXIMUM (e) \ - : _GL_INT_NEGATE_CONVERT (e, 1)) - #define _GL_SIGNED_INT_MAXIMUM(e) \ -- (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1) -+ (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1) -+ -+/* Work around OpenVMS incompatibility with C99. */ -+#if !defined LLONG_MAX && defined __INT64_MAX -+# define LLONG_MAX __INT64_MAX -+# define LLONG_MIN __INT64_MIN -+#endif - - /* This include file assumes that signed types are two's complement without - padding bits; the above macros have undefined behavior otherwise. -@@ -84,6 +98,10 @@ verify (TYPE_MAXIMUM (long int) == LONG_MAX); - verify (TYPE_MINIMUM (long long int) == LLONG_MIN); - verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - #endif -+/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */ -+#ifdef UINT_WIDTH -+verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); -+#endif - - /* Does the __typeof__ keyword work? This could be done by - 'configure', but for now it's easier to do it by hand. */ -@@ -116,8 +134,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - signed, this macro may overestimate the true bound by one byte when - applied to unsigned types of size 2, 4, 16, ... bytes. */ - #define INT_STRLEN_BOUND(t) \ -- (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \ -- - _GL_SIGNED_TYPE_OR_EXPR (t)) \ -+ (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \ - + _GL_SIGNED_TYPE_OR_EXPR (t)) - - /* Bound on buffer size needed to represent an integer type or expression T, -@@ -222,20 +239,25 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - ? (a) < (min) >> (b) \ - : (max) >> (b) < (a)) - --/* True if __builtin_add_overflow (A, B, P) works when P is null. */ --#define _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL (7 <= __GNUC__) -+/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ -+#define _GL_HAS_BUILTIN_OVERFLOW \ -+ (5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)) -+ -+/* True if __builtin_add_overflow_p (A, B, C) works. */ -+#define _GL_HAS_BUILTIN_OVERFLOW_P \ -+ (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) - - /* The _GL*_OVERFLOW macros have the same restrictions as the - *_RANGE_OVERFLOW macros, except that they do not assume that operands - (e.g., A and B) have the same type as MIN and MAX. Instead, they assume - that the result (e.g., A + B) has that type. */ --#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL --# define _GL_ADD_OVERFLOW(a, b, min, max) -- __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0) --# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) -- __builtin_sub_overflow (a, b, (__typeof__ ((a) - (b)) *) 0) --# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) -- __builtin_mul_overflow (a, b, (__typeof__ ((a) * (b)) *) 0) -+#if _GL_HAS_BUILTIN_OVERFLOW_P -+# define _GL_ADD_OVERFLOW(a, b, min, max) \ -+ __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0) -+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ -+ __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0) -+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ -+ __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0) - #else - # define _GL_ADD_OVERFLOW(a, b, min, max) \ - ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ -@@ -315,7 +337,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) - #define INT_SUBTRACT_OVERFLOW(a, b) \ - _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) --#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL -+#if _GL_HAS_BUILTIN_OVERFLOW_P - # define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a) - #else - # define INT_NEGATE_OVERFLOW(a) \ -@@ -349,10 +371,6 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - #define INT_MULTIPLY_WRAPV(a, b, r) \ - _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW) - --#ifndef __has_builtin --# define __has_builtin(x) 0 --#endif -- - /* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 - https://llvm.org/bugs/show_bug.cgi?id=25390 -@@ -369,7 +387,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - the operation. BUILTIN is the builtin operation, and OVERFLOW the - overflow predicate. Return 1 if the result overflows. See above - for restrictions. */ --#if 5 <= __GNUC__ || __has_builtin (__builtin_add_overflow) -+#if _GL_HAS_BUILTIN_OVERFLOW - # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r) - #elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS - # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ -@@ -412,7 +430,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); - # else - # define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ -- long int, LONG_MIN, LONG_MAX)) -+ long int, LONG_MIN, LONG_MAX) - # endif - #endif - -diff --git a/pskctool/gl/limits.in.h b/pskctool/gl/limits.in.h -new file mode 100644 -index 0000000..a1eae02 ---- /dev/null -+++ b/pskctool/gl/limits.in.h -@@ -0,0 +1,63 @@ -+/* A GNU-like . -+ -+ Copyright 2016 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or -+ modify it under the terms of the GNU General Public License -+ as published by the Free Software Foundation; either version 3, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, see . */ -+ -+#ifndef _@GUARD_PREFIX@_LIMITS_H -+ -+#if __GNUC__ >= 3 -+@PRAGMA_SYSTEM_HEADER@ -+#endif -+@PRAGMA_COLUMNS@ -+ -+/* The include_next requires a split double-inclusion guard. */ -+#@INCLUDE_NEXT@ @NEXT_LIMITS_H@ -+ -+#ifndef _@GUARD_PREFIX@_LIMITS_H -+#define _@GUARD_PREFIX@_LIMITS_H -+ -+/* The number of usable bits in an unsigned or signed integer type -+ with minimum value MIN and maximum value MAX, as an int expression -+ suitable in #if. Cover all known practical hosts. This -+ implementation exploits the fact that MAX is 1 less than a power of -+ 2, and merely counts the number of 1 bits in MAX; "COBn" means -+ "count the number of 1 bits in the low-order n bits"). */ -+#define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max)) -+#define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n)) -+#define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n)) -+#define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n)) -+#define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n)) -+#define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n)) -+#define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1)) -+ -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#if (! defined ULLONG_WIDTH \ -+ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) -+# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX) -+# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX) -+# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX) -+# define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX) -+# define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX) -+# define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX) -+# define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX) -+# define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX) -+# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX) -+# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX) -+# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX) -+#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ -+ -+#endif /* _@GUARD_PREFIX@_LIMITS_H */ -+#endif /* _@GUARD_PREFIX@_LIMITS_H */ -diff --git a/pskctool/gl/m4/dirname.m4 b/pskctool/gl/m4/dirname.m4 -new file mode 100644 -index 0000000..6f8bec3 ---- /dev/null -+++ b/pskctool/gl/m4/dirname.m4 -@@ -0,0 +1,19 @@ -+#serial 10 -*- autoconf -*- -+dnl Copyright (C) 2002-2006, 2009-2016 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+AC_DEFUN([gl_DIRNAME], -+[ -+ AC_REQUIRE([gl_DIRNAME_LGPL]) -+]) -+ -+AC_DEFUN([gl_DIRNAME_LGPL], -+[ -+ dnl Prerequisites of lib/dirname.h. -+ AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) -+ -+ dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c, -+ dnl lib/stripslash.c. -+]) -diff --git a/pskctool/gl/m4/double-slash-root.m4 b/pskctool/gl/m4/double-slash-root.m4 -new file mode 100644 -index 0000000..dfd3921 ---- /dev/null -+++ b/pskctool/gl/m4/double-slash-root.m4 -@@ -0,0 +1,38 @@ -+# double-slash-root.m4 serial 4 -*- Autoconf -*- -+dnl Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+AC_DEFUN([gl_DOUBLE_SLASH_ROOT], -+[ -+ AC_REQUIRE([AC_CANONICAL_HOST]) -+ AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root], -+ [ if test x"$cross_compiling" = xyes ; then -+ # When cross-compiling, there is no way to tell whether // is special -+ # short of a list of hosts. However, the only known hosts to date -+ # that have a distinct // are Apollo DomainOS (too old to port to), -+ # Cygwin, and z/OS. If anyone knows of another system for which // has -+ # special semantics and is distinct from /, please report it to -+ # . -+ case $host in -+ *-cygwin | i370-ibm-openedition) -+ gl_cv_double_slash_root=yes ;; -+ *) -+ # Be optimistic and assume that / and // are the same when we -+ # don't know. -+ gl_cv_double_slash_root='unknown, assuming no' ;; -+ esac -+ else -+ set x `ls -di / // 2>/dev/null` -+ if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then -+ gl_cv_double_slash_root=no -+ else -+ gl_cv_double_slash_root=yes -+ fi -+ fi]) -+ if test "$gl_cv_double_slash_root" = yes; then -+ AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1], -+ [Define to 1 if // is a file system root distinct from /.]) -+ fi -+]) -diff --git a/pskctool/gl/m4/extensions.m4 b/pskctool/gl/m4/extensions.m4 -index 6d378ec..e114a6f 100644 ---- a/pskctool/gl/m4/extensions.m4 -+++ b/pskctool/gl/m4/extensions.m4 -@@ -1,4 +1,4 @@ --# serial 13 -*- Autoconf -*- -+# serial 15 -*- Autoconf -*- - # Enable extensions on systems that normally disable them. - - # Copyright (C) 2003, 2006-2016 Free Software Foundation, Inc. -@@ -60,7 +60,7 @@ dnl configure.ac when using autoheader 2.62. - #ifndef _ALL_SOURCE - # undef _ALL_SOURCE - #endif --/* Enable general extensions on OS X. */ -+/* Enable general extensions on macOS. */ - #ifndef _DARWIN_C_SOURCE - # undef _DARWIN_C_SOURCE - #endif -@@ -68,14 +68,38 @@ dnl configure.ac when using autoheader 2.62. - #ifndef _GNU_SOURCE - # undef _GNU_SOURCE - #endif --/* Use GNU style printf and scanf. */ --#ifndef __USE_MINGW_ANSI_STDIO --# undef __USE_MINGW_ANSI_STDIO --#endif - /* Enable threading extensions on Solaris. */ - #ifndef _POSIX_PTHREAD_SEMANTICS - # undef _POSIX_PTHREAD_SEMANTICS - #endif -+/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ -+#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ -+# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ -+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -+# undef __STDC_WANT_IEC_60559_BFP_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ -+#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ -+# undef __STDC_WANT_IEC_60559_DFP_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ -+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ -+# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ -+#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ -+# undef __STDC_WANT_IEC_60559_TYPES_EXT__ -+#endif -+/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ -+#ifndef __STDC_WANT_LIB_EXT2__ -+# undef __STDC_WANT_LIB_EXT2__ -+#endif -+/* Enable extensions specified by ISO/IEC 24747:2009. */ -+#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ -+# undef __STDC_WANT_MATH_SPEC_FUNCS__ -+#endif - /* Enable extensions on HP NonStop. */ - #ifndef _TANDEM_SOURCE - # undef _TANDEM_SOURCE -@@ -104,8 +128,14 @@ dnl configure.ac when using autoheader 2.62. - AC_DEFINE([_ALL_SOURCE]) - AC_DEFINE([_DARWIN_C_SOURCE]) - AC_DEFINE([_GNU_SOURCE]) -- AC_DEFINE([__USE_MINGW_ANSI_STDIO]) - AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__]) -+ AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__]) -+ AC_DEFINE([__STDC_WANT_LIB_EXT2__]) -+ AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__]) - AC_DEFINE([_TANDEM_SOURCE]) - AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], - [ac_cv_should_define__xopen_source], -diff --git a/pskctool/gl/m4/getprogname.m4 b/pskctool/gl/m4/getprogname.m4 -new file mode 100644 -index 0000000..52f0224 ---- /dev/null -+++ b/pskctool/gl/m4/getprogname.m4 -@@ -0,0 +1,13 @@ -+# getprogname.m4 - check for getprogname or replacements for it -+ -+# Copyright (C) 2016 Free Software Foundation, Inc. -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# serial 2 -+ -+AC_DEFUN([gl_FUNC_GETPROGNAME], -+[ -+ AC_CHECK_FUNCS_ONCE([getprogname getexecname]) -+]) -diff --git a/pskctool/gl/m4/gnulib-comp.m4 b/pskctool/gl/m4/gnulib-comp.m4 -index 25006a9..144f787 100644 ---- a/pskctool/gl/m4/gnulib-comp.m4 -+++ b/pskctool/gl/m4/gnulib-comp.m4 -@@ -45,6 +45,9 @@ AC_DEFUN([gl_EARLY], - # Code from module absolute-header: - # Code from module binary-io: - # Code from module binary-io-tests: -+ # Code from module dirname-lgpl: -+ # Code from module dosname: -+ # Code from module double-slash-root: - # Code from module errno: - # Code from module errno-tests: - # Code from module error: -@@ -65,6 +68,8 @@ AC_DEFUN([gl_EARLY], - AC_REQUIRE([AC_FUNC_FSEEKO]) - # Code from module ftello-tests: - # Code from module fwrite-tests: -+ # Code from module getprogname: -+ # Code from module getprogname-tests: - # Code from module gettext-h: - # Code from module gettimeofday: - # Code from module gettimeofday-tests: -@@ -76,6 +81,8 @@ AC_DEFUN([gl_EARLY], - # Code from module inttypes-tests: - # Code from module largefile: - AC_REQUIRE([AC_SYS_LARGEFILE]) -+ # Code from module limits-h: -+ # Code from module limits-h-tests: - # Code from module lseek: - # Code from module lseek-tests: - # Code from module malloc-posix: -@@ -149,6 +156,8 @@ AC_DEFUN([gl_INIT], - m4_pushdef([gl_LIBSOURCES_DIR], []) - gl_COMMON - gl_source_base='gl' -+ gl_DIRNAME_LGPL -+ gl_DOUBLE_SLASH_ROOT - gl_HEADER_ERRNO_H - gl_ERROR - if test $ac_cv_lib_error_at_line = no; then -@@ -176,6 +185,11 @@ AC_DEFUN([gl_INIT], - gl_PREREQ_FTELLO - fi - gl_STDIO_MODULE_INDICATOR([ftello]) -+ gl_FUNC_GETPROGNAME -+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) -+ AC_CHECK_DECLS([program_invocation_name], [], [], [#include ]) -+ AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include ]) -+ AC_CHECK_DECLS([__argv], [], [], [#include ]) - AC_SUBST([LIBINTL]) - AC_SUBST([LTLIBINTL]) - gl_FUNC_GETTIMEOFDAY -@@ -185,6 +199,7 @@ AC_DEFUN([gl_INIT], - fi - gl_SYS_TIME_MODULE_INDICATOR([gettimeofday]) - AC_REQUIRE([gl_LARGEFILE]) -+ gl_LIMITS_H - gl_FUNC_LSEEK - if test $REPLACE_LSEEK = 1; then - AC_LIBOBJ([lseek]) -@@ -214,6 +229,7 @@ AC_DEFUN([gl_INIT], - gl_STDLIB_MODULE_INDICATOR([realloc-posix]) - gt_TYPE_SSIZE_T - gl_STDARG_H -+ AM_STDBOOL_H - gl_STDDEF_H - gl_STDINT_H - gl_STDIO_H -@@ -298,7 +314,6 @@ changequote([, ])dnl - gl_INTTYPES_H - gl_INTTYPES_INCOMPLETE - gl_STDALIGN_H -- AM_STDBOOL_H - AC_REQUIRE([gt_TYPE_WCHAR_T]) - AC_REQUIRE([gt_TYPE_WINT_T]) - gl_WCHAR_H -@@ -398,15 +413,22 @@ AC_DEFUN([gl_FILE_LIST], [ - build-aux/snippet/arg-nonnull.h - build-aux/snippet/c++defs.h - build-aux/snippet/warn-on-use.h -+ lib/basename-lgpl.c -+ lib/dirname-lgpl.c -+ lib/dirname.h -+ lib/dosname.h - lib/errno.in.h - lib/error.c - lib/error.h - lib/fstat.c - lib/ftell.c - lib/ftello.c -+ lib/getprogname.c -+ lib/getprogname.h - lib/gettext.h - lib/gettimeofday.c - lib/intprops.h -+ lib/limits.in.h - lib/lseek.c - lib/malloc.c - lib/msvc-inval.c -@@ -419,6 +441,7 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/read-file.h - lib/realloc.c - lib/stdarg.in.h -+ lib/stdbool.in.h - lib/stddef.in.h - lib/stdint.in.h - lib/stdio-impl.h -@@ -428,6 +451,7 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/strerror-override.h - lib/strerror.c - lib/string.in.h -+ lib/stripslash.c - lib/sys_stat.in.h - lib/sys_time.in.h - lib/sys_types.in.h -@@ -439,6 +463,8 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/version-etc.h - m4/00gnulib.m4 - m4/absolute-header.m4 -+ m4/dirname.m4 -+ m4/double-slash-root.m4 - m4/errno_h.m4 - m4/error.m4 - m4/extensions.m4 -@@ -450,12 +476,14 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/fstat.m4 - m4/ftell.m4 - m4/ftello.m4 -+ m4/getprogname.m4 - m4/gettimeofday.m4 - m4/gnulib-common.m4 - m4/include_next.m4 - m4/inttypes-pri.m4 - m4/inttypes.m4 - m4/largefile.m4 -+ m4/limits-h.m4 - m4/longlong.m4 - m4/lseek.m4 - m4/malloc.m4 -@@ -511,10 +539,12 @@ AC_DEFUN([gl_FILE_LIST], [ - tests/test-ftello4.c - tests/test-ftello4.sh - tests/test-fwrite.c -+ tests/test-getprogname.c - tests/test-gettimeofday.c - tests/test-init.sh - tests/test-intprops.c - tests/test-inttypes.c -+ tests/test-limits-h.c - tests/test-lseek.c - tests/test-lseek.sh - tests/test-read-file.c -@@ -543,7 +573,6 @@ AC_DEFUN([gl_FILE_LIST], [ - tests=lib/fdopen.c - tests=lib/inttypes.in.h - tests=lib/stdalign.in.h -- tests=lib/stdbool.in.h - tests=lib/version-etc-fsf.c - tests=lib/wchar.in.h - ]) -diff --git a/pskctool/gl/m4/limits-h.m4 b/pskctool/gl/m4/limits-h.m4 -new file mode 100644 -index 0000000..31fdf0a ---- /dev/null -+++ b/pskctool/gl/m4/limits-h.m4 -@@ -0,0 +1,31 @@ -+dnl Check whether limits.h has needed features. -+ -+dnl Copyright 2016 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 From Paul Eggert. -+ -+AC_DEFUN_ONCE([gl_LIMITS_H], -+[ -+ gl_CHECK_NEXT_HEADERS([limits.h]) -+ -+ AC_CACHE_CHECK([whether limits.h has ULLONG_WIDTH etc.], -+ [gl_cv_header_limits_width], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM([[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -+ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 -+ #endif -+ #include -+ int ullw = ULLONG_WIDTH;]])], -+ [gl_cv_header_limits_width=yes], -+ [gl_cv_header_limits_width=no])]) -+ if test "$gl_cv_header_limits_width" = yes; then -+ LIMITS_H= -+ else -+ LIMITS_H=limits.h -+ fi -+ AC_SUBST([LIMITS_H]) -+ AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) -+]) -diff --git a/pskctool/gl/m4/stdint.m4 b/pskctool/gl/m4/stdint.m4 -index 0b4b906..fa6f103 100644 ---- a/pskctool/gl/m4/stdint.m4 -+++ b/pskctool/gl/m4/stdint.m4 -@@ -1,4 +1,4 @@ --# stdint.m4 serial 44 -+# stdint.m4 serial 47 - dnl Copyright (C) 2001-2016 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -11,6 +11,8 @@ AC_DEFUN_ONCE([gl_STDINT_H], - [ - AC_PREREQ([2.59])dnl - -+ AC_REQUIRE([gl_LIMITS_H]) -+ - dnl Check for long long int and unsigned long long int. - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - if test $ac_cv_type_long_long_int = yes; then -@@ -282,14 +284,20 @@ static const char *macro_values[] = - ]) - ]) - fi -+ -+ HAVE_C99_STDINT_H=0 -+ HAVE_SYS_BITYPES_H=0 -+ HAVE_SYS_INTTYPES_H=0 -+ STDINT_H=stdint.h - if test "$gl_cv_header_working_stdint_h" = yes; then -+ HAVE_C99_STDINT_H=1 - dnl Now see whether the system works without - dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined. - AC_CACHE_CHECK([whether stdint.h predates C++11], - [gl_cv_header_stdint_predates_cxx11_h], - [gl_cv_header_stdint_predates_cxx11_h=yes - AC_COMPILE_IFELSE([ -- AC_LANG_PROGRAM([[ -+ AC_LANG_PROGRAM([[ - #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ - #include - ] -@@ -306,27 +314,44 @@ int32_t i32 = INT32_C (0x7fffffff); - AC_DEFINE([__STDC_LIMIT_MACROS], [1], - [Define to 1 if the system predates C++11.]) - fi -- STDINT_H= -+ AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.], -+ [gl_cv_header_stdint_width], -+ [gl_cv_header_stdint_width=no -+ AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM([[ -+ /* Work if build is not clean. */ -+ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 -+ #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -+ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 -+ #endif -+ #include -+ ]gl_STDINT_INCLUDES[ -+ int iw = UINTMAX_WIDTH; -+ ]])], -+ [gl_cv_header_stdint_width=yes])]) -+ if test "$gl_cv_header_stdint_width" = yes; then -+ STDINT_H= -+ fi - else - dnl Check for , and for - dnl (used in Linux libc4 >= 4.6.7 and libc5). - AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) - if test $ac_cv_header_sys_inttypes_h = yes; then - HAVE_SYS_INTTYPES_H=1 -- else -- HAVE_SYS_INTTYPES_H=0 - fi -- AC_SUBST([HAVE_SYS_INTTYPES_H]) - if test $ac_cv_header_sys_bitypes_h = yes; then - HAVE_SYS_BITYPES_H=1 -- else -- HAVE_SYS_BITYPES_H=0 - fi -- AC_SUBST([HAVE_SYS_BITYPES_H]) -- - gl_STDINT_TYPE_PROPERTIES -- STDINT_H=stdint.h - fi -+ -+ # The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. -+ LIMITS_H=limits.h -+ AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) -+ -+ AC_SUBST([HAVE_C99_STDINT_H]) -+ AC_SUBST([HAVE_SYS_BITYPES_H]) -+ AC_SUBST([HAVE_SYS_INTTYPES_H]) - AC_SUBST([STDINT_H]) - AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) - ]) -@@ -504,8 +529,3 @@ dnl Remove this when we can assume autoconf >= 2.61. - m4_ifdef([AC_COMPUTE_INT], [], [ - AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) - ]) -- --# Hey Emacs! --# Local Variables: --# indent-tabs-mode: nil --# End: -diff --git a/pskctool/gl/m4/stdio_h.m4 b/pskctool/gl/m4/stdio_h.m4 -index 0e38758..eaa25a0 100644 ---- a/pskctool/gl/m4/stdio_h.m4 -+++ b/pskctool/gl/m4/stdio_h.m4 -@@ -1,4 +1,4 @@ --# stdio_h.m4 serial 46 -+# stdio_h.m4 serial 48 - dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -6,9 +6,13 @@ dnl with or without modifications, as long as this notice is preserved. - - AC_DEFUN([gl_STDIO_H], - [ -- dnl For __USE_MINGW_ANSI_STDIO -- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) -- -+ AH_VERBATIM([MINGW_ANSI_STDIO], -+[/* Use GNU style printf and scanf. */ -+#ifndef __USE_MINGW_ANSI_STDIO -+# undef __USE_MINGW_ANSI_STDIO -+#endif -+]) -+ AC_DEFINE([__USE_MINGW_ANSI_STDIO]) - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - gl_NEXT_HEADERS([stdio.h]) - -diff --git a/pskctool/gl/m4/sys_types_h.m4 b/pskctool/gl/m4/sys_types_h.m4 -index b0aabb4..159b005 100644 ---- a/pskctool/gl/m4/sys_types_h.m4 -+++ b/pskctool/gl/m4/sys_types_h.m4 -@@ -1,4 +1,4 @@ --# sys_types_h.m4 serial 5 -+# sys_types_h.m4 serial 6 - dnl Copyright (C) 2011-2016 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,3 +22,28 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], - AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], - [ - ]) -+ -+# This works around a buggy version in autoconf <= 2.69. -+# See -+ -+m4_version_prereq([2.70], [], [ -+ -+# This is taken from the following Autoconf patch: -+# http://git.sv.gnu.org/cgit/autoconf.git/commit/?id=e17a30e98 -+ -+m4_undefine([AC_HEADER_MAJOR]) -+AC_DEFUN([AC_HEADER_MAJOR], -+[AC_CHECK_HEADERS_ONCE([sys/types.h]) -+AC_CHECK_HEADER([sys/mkdev.h], -+ [AC_DEFINE([MAJOR_IN_MKDEV], [1], -+ [Define to 1 if `major', `minor', and `makedev' are declared in -+ .])]) -+if test $ac_cv_header_sys_mkdev_h = no; then -+ AC_CHECK_HEADER([sys/sysmacros.h], -+ [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], -+ [Define to 1 if `major', `minor', and `makedev' are declared in -+ .])]) -+fi -+]) -+ -+]) -diff --git a/pskctool/gl/tests/stdbool.in.h b/pskctool/gl/stdbool.in.h -similarity index 100% -rename from pskctool/gl/tests/stdbool.in.h -rename to pskctool/gl/stdbool.in.h -diff --git a/pskctool/gl/stdint.in.h b/pskctool/gl/stdint.in.h -index cf65ec6..c86ab09 100644 ---- a/pskctool/gl/stdint.in.h -+++ b/pskctool/gl/stdint.in.h -@@ -79,49 +79,51 @@ - #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H - #define _@GUARD_PREFIX@_STDINT_H - -+/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, -+ LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ -+#include -+ -+#if ! @HAVE_C99_STDINT_H@ -+ - /* defines some of the stdint.h types as well, on glibc, - IRIX 6.5, and OpenBSD 3.8 (via ). - AIX 5.2 isn't needed and causes troubles. - Mac OS X 10.4.6 includes (which is us), but - relies on the system definitions, so include - after @NEXT_STDINT_H@. */ --#if @HAVE_SYS_TYPES_H@ && ! defined _AIX --# include --#endif -- --/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, -- LONG_MIN, LONG_MAX, ULONG_MAX. */ --#include -+# if @HAVE_SYS_TYPES_H@ && ! defined _AIX -+# include -+# endif - --#if @HAVE_INTTYPES_H@ -+# if @HAVE_INTTYPES_H@ - /* In OpenBSD 3.8, includes , which defines - int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. - also defines intptr_t and uintptr_t. */ --# include --#elif @HAVE_SYS_INTTYPES_H@ -+# include -+# elif @HAVE_SYS_INTTYPES_H@ - /* Solaris 7 has the types except the *_fast*_t types, and - the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ --# include --#endif -+# include -+# endif - --#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ -+# if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ - /* Linux libc4 >= 4.6.7 and libc5 have a that defines - int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is - included by . */ --# include --#endif -+# include -+# endif - --#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H -+# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H - - /* Minimum and maximum values for an integer type under the usual assumption. - Return an unspecified value if BITS == 0, adding a check to pacify - picky compilers. */ - --#define _STDINT_MIN(signed, bits, zero) \ -- ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero)) -+# define _STDINT_MIN(signed, bits, zero) \ -+ ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero)) - --#define _STDINT_MAX(signed, bits, zero) \ -- (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) -+# define _STDINT_MAX(signed, bits, zero) \ -+ (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) - - #if !GNULIB_defined_stdint_types - -@@ -130,26 +132,26 @@ - /* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. */ - --#undef int8_t --#undef uint8_t -+# undef int8_t -+# undef uint8_t - typedef signed char gl_int8_t; - typedef unsigned char gl_uint8_t; --#define int8_t gl_int8_t --#define uint8_t gl_uint8_t -+# define int8_t gl_int8_t -+# define uint8_t gl_uint8_t - --#undef int16_t --#undef uint16_t -+# undef int16_t -+# undef uint16_t - typedef short int gl_int16_t; - typedef unsigned short int gl_uint16_t; --#define int16_t gl_int16_t --#define uint16_t gl_uint16_t -+# define int16_t gl_int16_t -+# define uint16_t gl_uint16_t - --#undef int32_t --#undef uint32_t -+# undef int32_t -+# undef uint32_t - typedef int gl_int32_t; - typedef unsigned int gl_uint32_t; --#define int32_t gl_int32_t --#define uint32_t gl_uint32_t -+# define int32_t gl_int32_t -+# define uint32_t gl_uint32_t - - /* If the system defines INT64_MAX, assume int64_t works. That way, - if the underlying platform defines int64_t to be a 64-bit long long -@@ -157,54 +159,54 @@ typedef unsigned int gl_uint32_t; - int, which would mess up C++ name mangling. We must use #ifdef - rather than #if, to avoid an error with HP-UX 10.20 cc. */ - --#ifdef INT64_MAX --# define GL_INT64_T --#else -+# ifdef INT64_MAX -+# define GL_INT64_T -+# else - /* Do not undefine int64_t if gnulib is not being used with 64-bit - types, since otherwise it breaks platforms like Tandem/NSK. */ --# if LONG_MAX >> 31 >> 31 == 1 --# undef int64_t -+# if LONG_MAX >> 31 >> 31 == 1 -+# undef int64_t - typedef long int gl_int64_t; --# define int64_t gl_int64_t --# define GL_INT64_T --# elif defined _MSC_VER --# undef int64_t -+# define int64_t gl_int64_t -+# define GL_INT64_T -+# elif defined _MSC_VER -+# undef int64_t - typedef __int64 gl_int64_t; --# define int64_t gl_int64_t --# define GL_INT64_T --# elif @HAVE_LONG_LONG_INT@ --# undef int64_t -+# define int64_t gl_int64_t -+# define GL_INT64_T -+# elif @HAVE_LONG_LONG_INT@ -+# undef int64_t - typedef long long int gl_int64_t; --# define int64_t gl_int64_t --# define GL_INT64_T -+# define int64_t gl_int64_t -+# define GL_INT64_T -+# endif - # endif --#endif - --#ifdef UINT64_MAX --# define GL_UINT64_T --#else --# if ULONG_MAX >> 31 >> 31 >> 1 == 1 --# undef uint64_t --typedef unsigned long int gl_uint64_t; --# define uint64_t gl_uint64_t -+# ifdef UINT64_MAX - # define GL_UINT64_T --# elif defined _MSC_VER --# undef uint64_t -+# else -+# if ULONG_MAX >> 31 >> 31 >> 1 == 1 -+# undef uint64_t -+typedef unsigned long int gl_uint64_t; -+# define uint64_t gl_uint64_t -+# define GL_UINT64_T -+# elif defined _MSC_VER -+# undef uint64_t - typedef unsigned __int64 gl_uint64_t; --# define uint64_t gl_uint64_t --# define GL_UINT64_T --# elif @HAVE_UNSIGNED_LONG_LONG_INT@ --# undef uint64_t -+# define uint64_t gl_uint64_t -+# define GL_UINT64_T -+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ -+# undef uint64_t - typedef unsigned long long int gl_uint64_t; --# define uint64_t gl_uint64_t --# define GL_UINT64_T -+# define uint64_t gl_uint64_t -+# define GL_UINT64_T -+# endif - # endif --#endif - - /* Avoid collision with Solaris 2.5.1 etc. */ --#define _UINT8_T --#define _UINT32_T --#define _UINT64_T -+# define _UINT8_T -+# define _UINT32_T -+# define _UINT64_T - - - /* 7.18.1.2. Minimum-width integer types */ -@@ -213,26 +215,26 @@ typedef unsigned long long int gl_uint64_t; - types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types - are the same as the corresponding N_t types. */ - --#undef int_least8_t --#undef uint_least8_t --#undef int_least16_t --#undef uint_least16_t --#undef int_least32_t --#undef uint_least32_t --#undef int_least64_t --#undef uint_least64_t --#define int_least8_t int8_t --#define uint_least8_t uint8_t --#define int_least16_t int16_t --#define uint_least16_t uint16_t --#define int_least32_t int32_t --#define uint_least32_t uint32_t --#ifdef GL_INT64_T --# define int_least64_t int64_t --#endif --#ifdef GL_UINT64_T --# define uint_least64_t uint64_t --#endif -+# undef int_least8_t -+# undef uint_least8_t -+# undef int_least16_t -+# undef uint_least16_t -+# undef int_least32_t -+# undef uint_least32_t -+# undef int_least64_t -+# undef uint_least64_t -+# define int_least8_t int8_t -+# define uint_least8_t uint8_t -+# define int_least16_t int16_t -+# define uint_least16_t uint16_t -+# define int_least32_t int32_t -+# define uint_least32_t uint32_t -+# ifdef GL_INT64_T -+# define int_least64_t int64_t -+# endif -+# ifdef GL_UINT64_T -+# define uint_least64_t uint64_t -+# endif - - /* 7.18.1.3. Fastest minimum-width integer types */ - -@@ -245,55 +247,55 @@ typedef unsigned long long int gl_uint64_t; - uses types consistent with glibc, as that lessens the chance of - incompatibility with older GNU hosts. */ - --#undef int_fast8_t --#undef uint_fast8_t --#undef int_fast16_t --#undef uint_fast16_t --#undef int_fast32_t --#undef uint_fast32_t --#undef int_fast64_t --#undef uint_fast64_t -+# undef int_fast8_t -+# undef uint_fast8_t -+# undef int_fast16_t -+# undef uint_fast16_t -+# undef int_fast32_t -+# undef uint_fast32_t -+# undef int_fast64_t -+# undef uint_fast64_t - typedef signed char gl_int_fast8_t; - typedef unsigned char gl_uint_fast8_t; - --#ifdef __sun -+# 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 -+# else - typedef long int gl_int_fast32_t; - typedef unsigned long int gl_uint_fast32_t; --#endif -+# 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 --#define uint_fast16_t gl_uint_fast16_t --#define int_fast32_t gl_int_fast32_t --#define uint_fast32_t gl_uint_fast32_t --#ifdef GL_INT64_T --# define int_fast64_t int64_t --#endif --#ifdef GL_UINT64_T --# define uint_fast64_t uint64_t --#endif -+# define int_fast8_t gl_int_fast8_t -+# define uint_fast8_t gl_uint_fast8_t -+# define int_fast16_t gl_int_fast16_t -+# define uint_fast16_t gl_uint_fast16_t -+# define int_fast32_t gl_int_fast32_t -+# define uint_fast32_t gl_uint_fast32_t -+# ifdef GL_INT64_T -+# define int_fast64_t int64_t -+# endif -+# ifdef GL_UINT64_T -+# define uint_fast64_t uint64_t -+# endif - - /* 7.18.1.4. Integer types capable of holding object pointers */ - - /* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own - definitions of intptr_t and uintptr_t (which use int and unsigned) - to avoid clashes with declarations of system functions like sbrk. */ --#ifndef _INTPTR_T_DECLARED --#undef intptr_t --#undef uintptr_t -+# ifndef _INTPTR_T_DECLARED -+# undef intptr_t -+# undef uintptr_t - typedef long int gl_intptr_t; - typedef unsigned long int gl_uintptr_t; --#define intptr_t gl_intptr_t --#define uintptr_t gl_uintptr_t --#endif -+# define intptr_t gl_intptr_t -+# define uintptr_t gl_uintptr_t -+# endif - - /* 7.18.1.5. Greatest-width integer types */ - -@@ -304,33 +306,33 @@ typedef unsigned long int gl_uintptr_t; - similarly for UINTMAX_MAX and uintmax_t. This avoids problems with - assuming one type where another is used by the system. */ - --#ifndef INTMAX_MAX --# undef INTMAX_C --# undef intmax_t --# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -+# ifndef INTMAX_MAX -+# undef INTMAX_C -+# undef intmax_t -+# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 - typedef long long int gl_intmax_t; --# define intmax_t gl_intmax_t --# elif defined GL_INT64_T --# define intmax_t int64_t --# else -+# define intmax_t gl_intmax_t -+# elif defined GL_INT64_T -+# define intmax_t int64_t -+# else - typedef long int gl_intmax_t; --# define intmax_t gl_intmax_t -+# define intmax_t gl_intmax_t -+# endif - # endif --#endif - --#ifndef UINTMAX_MAX --# undef UINTMAX_C --# undef uintmax_t --# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -+# ifndef UINTMAX_MAX -+# undef UINTMAX_C -+# undef uintmax_t -+# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 - typedef unsigned long long int gl_uintmax_t; --# define uintmax_t gl_uintmax_t --# elif defined GL_UINT64_T --# define uintmax_t uint64_t --# else -+# define uintmax_t gl_uintmax_t -+# elif defined GL_UINT64_T -+# define uintmax_t uint64_t -+# else - typedef unsigned long int gl_uintmax_t; --# define uintmax_t gl_uintmax_t -+# define uintmax_t gl_uintmax_t -+# endif - # endif --#endif - - /* Verify that intmax_t and uintmax_t have the same size. Too much code - breaks if this is not the case. If this check fails, the reason is likely -@@ -338,8 +340,8 @@ typedef unsigned long int gl_uintmax_t; - typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - ? 1 : -1]; - --#define GNULIB_defined_stdint_types 1 --#endif /* !GNULIB_defined_stdint_types */ -+# define GNULIB_defined_stdint_types 1 -+# endif /* !GNULIB_defined_stdint_types */ - - /* 7.18.2. Limits of specified-width integer types */ - -@@ -348,37 +350,37 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - /* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. */ - --#undef INT8_MIN --#undef INT8_MAX --#undef UINT8_MAX --#define INT8_MIN (~ INT8_MAX) --#define INT8_MAX 127 --#define UINT8_MAX 255 -- --#undef INT16_MIN --#undef INT16_MAX --#undef UINT16_MAX --#define INT16_MIN (~ INT16_MAX) --#define INT16_MAX 32767 --#define UINT16_MAX 65535 -- --#undef INT32_MIN --#undef INT32_MAX --#undef UINT32_MAX --#define INT32_MIN (~ INT32_MAX) --#define INT32_MAX 2147483647 --#define UINT32_MAX 4294967295U -- --#if defined GL_INT64_T && ! defined INT64_MAX -+# undef INT8_MIN -+# undef INT8_MAX -+# undef UINT8_MAX -+# define INT8_MIN (~ INT8_MAX) -+# define INT8_MAX 127 -+# define UINT8_MAX 255 -+ -+# undef INT16_MIN -+# undef INT16_MAX -+# undef UINT16_MAX -+# define INT16_MIN (~ INT16_MAX) -+# define INT16_MAX 32767 -+# define UINT16_MAX 65535 -+ -+# undef INT32_MIN -+# undef INT32_MAX -+# undef UINT32_MAX -+# define INT32_MIN (~ INT32_MAX) -+# define INT32_MAX 2147483647 -+# define UINT32_MAX 4294967295U -+ -+# if defined GL_INT64_T && ! defined INT64_MAX - /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 - evaluates the latter incorrectly in preprocessor expressions. */ --# define INT64_MIN (- INTMAX_C (1) << 63) --# define INT64_MAX INTMAX_C (9223372036854775807) --#endif -+# define INT64_MIN (- INTMAX_C (1) << 63) -+# define INT64_MAX INTMAX_C (9223372036854775807) -+# endif - --#if defined GL_UINT64_T && ! defined UINT64_MAX --# define UINT64_MAX UINTMAX_C (18446744073709551615) --#endif -+# if defined GL_UINT64_T && ! defined UINT64_MAX -+# define UINT64_MAX UINTMAX_C (18446744073709551615) -+# endif - - /* 7.18.2.2. Limits of minimum-width integer types */ - -@@ -386,38 +388,38 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types - are the same as the corresponding N_t types. */ - --#undef INT_LEAST8_MIN --#undef INT_LEAST8_MAX --#undef UINT_LEAST8_MAX --#define INT_LEAST8_MIN INT8_MIN --#define INT_LEAST8_MAX INT8_MAX --#define UINT_LEAST8_MAX UINT8_MAX -- --#undef INT_LEAST16_MIN --#undef INT_LEAST16_MAX --#undef UINT_LEAST16_MAX --#define INT_LEAST16_MIN INT16_MIN --#define INT_LEAST16_MAX INT16_MAX --#define UINT_LEAST16_MAX UINT16_MAX -- --#undef INT_LEAST32_MIN --#undef INT_LEAST32_MAX --#undef UINT_LEAST32_MAX --#define INT_LEAST32_MIN INT32_MIN --#define INT_LEAST32_MAX INT32_MAX --#define UINT_LEAST32_MAX UINT32_MAX -- --#undef INT_LEAST64_MIN --#undef INT_LEAST64_MAX --#ifdef GL_INT64_T --# define INT_LEAST64_MIN INT64_MIN --# define INT_LEAST64_MAX INT64_MAX --#endif -+# undef INT_LEAST8_MIN -+# undef INT_LEAST8_MAX -+# undef UINT_LEAST8_MAX -+# define INT_LEAST8_MIN INT8_MIN -+# define INT_LEAST8_MAX INT8_MAX -+# define UINT_LEAST8_MAX UINT8_MAX -+ -+# undef INT_LEAST16_MIN -+# undef INT_LEAST16_MAX -+# undef UINT_LEAST16_MAX -+# define INT_LEAST16_MIN INT16_MIN -+# define INT_LEAST16_MAX INT16_MAX -+# define UINT_LEAST16_MAX UINT16_MAX -+ -+# undef INT_LEAST32_MIN -+# undef INT_LEAST32_MAX -+# undef UINT_LEAST32_MAX -+# define INT_LEAST32_MIN INT32_MIN -+# define INT_LEAST32_MAX INT32_MAX -+# define UINT_LEAST32_MAX UINT32_MAX -+ -+# undef INT_LEAST64_MIN -+# undef INT_LEAST64_MAX -+# ifdef GL_INT64_T -+# define INT_LEAST64_MIN INT64_MIN -+# define INT_LEAST64_MAX INT64_MAX -+# endif - --#undef UINT_LEAST64_MAX --#ifdef GL_UINT64_T --# define UINT_LEAST64_MAX UINT64_MAX --#endif -+# undef UINT_LEAST64_MAX -+# ifdef GL_UINT64_T -+# define UINT_LEAST64_MAX UINT64_MAX -+# endif - - /* 7.18.2.3. Limits of fastest minimum-width integer types */ - -@@ -425,117 +427,117 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types - are taken from the same list of types. */ - --#undef INT_FAST8_MIN --#undef INT_FAST8_MAX --#undef UINT_FAST8_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 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 --#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_FAST8_MIN -+# undef INT_FAST8_MAX -+# undef UINT_FAST8_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 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 -+# 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 --#ifdef GL_INT64_T --# define INT_FAST64_MIN INT64_MIN --# define INT_FAST64_MAX INT64_MAX --#endif -+# undef INT_FAST64_MIN -+# undef INT_FAST64_MAX -+# ifdef GL_INT64_T -+# define INT_FAST64_MIN INT64_MIN -+# define INT_FAST64_MAX INT64_MAX -+# endif - --#undef UINT_FAST64_MAX --#ifdef GL_UINT64_T --# define UINT_FAST64_MAX UINT64_MAX --#endif -+# undef UINT_FAST64_MAX -+# ifdef GL_UINT64_T -+# define UINT_FAST64_MAX UINT64_MAX -+# endif - - /* 7.18.2.4. Limits of integer types capable of holding object pointers */ - --#undef INTPTR_MIN --#undef INTPTR_MAX --#undef UINTPTR_MAX --#define INTPTR_MIN LONG_MIN --#define INTPTR_MAX LONG_MAX --#define UINTPTR_MAX ULONG_MAX -+# undef INTPTR_MIN -+# undef INTPTR_MAX -+# undef UINTPTR_MAX -+# define INTPTR_MIN LONG_MIN -+# define INTPTR_MAX LONG_MAX -+# define UINTPTR_MAX ULONG_MAX - - /* 7.18.2.5. Limits of greatest-width integer types */ - --#ifndef INTMAX_MAX --# undef INTMAX_MIN --# ifdef INT64_MAX --# define INTMAX_MIN INT64_MIN --# define INTMAX_MAX INT64_MAX --# else --# define INTMAX_MIN INT32_MIN --# define INTMAX_MAX INT32_MAX -+# ifndef INTMAX_MAX -+# undef INTMAX_MIN -+# ifdef INT64_MAX -+# define INTMAX_MIN INT64_MIN -+# define INTMAX_MAX INT64_MAX -+# else -+# define INTMAX_MIN INT32_MIN -+# define INTMAX_MAX INT32_MAX -+# endif - # endif --#endif - --#ifndef UINTMAX_MAX --# ifdef UINT64_MAX --# define UINTMAX_MAX UINT64_MAX --# else --# define UINTMAX_MAX UINT32_MAX -+# ifndef UINTMAX_MAX -+# ifdef UINT64_MAX -+# define UINTMAX_MAX UINT64_MAX -+# else -+# define UINTMAX_MAX UINT32_MAX -+# endif - # endif --#endif - - /* 7.18.3. Limits of other integer types */ - - /* ptrdiff_t limits */ --#undef PTRDIFF_MIN --#undef PTRDIFF_MAX --#if @APPLE_UNIVERSAL_BUILD@ --# ifdef _LP64 --# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) --# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) -+# undef PTRDIFF_MIN -+# undef PTRDIFF_MAX -+# if @APPLE_UNIVERSAL_BUILD@ -+# ifdef _LP64 -+# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) -+# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) -+# else -+# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) -+# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) -+# endif - # else --# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) --# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) --# endif --#else --# define PTRDIFF_MIN \ -+# define PTRDIFF_MIN \ - _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) --# define PTRDIFF_MAX \ -+# define PTRDIFF_MAX \ - _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) --#endif -+# endif - - /* sig_atomic_t limits */ --#undef SIG_ATOMIC_MIN --#undef SIG_ATOMIC_MAX --#define SIG_ATOMIC_MIN \ -+# undef SIG_ATOMIC_MIN -+# undef SIG_ATOMIC_MAX -+# define SIG_ATOMIC_MIN \ - _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) --#define SIG_ATOMIC_MAX \ -+# define SIG_ATOMIC_MAX \ - _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) - - - /* size_t limit */ --#undef SIZE_MAX --#if @APPLE_UNIVERSAL_BUILD@ --# ifdef _LP64 --# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) -+# undef SIZE_MAX -+# if @APPLE_UNIVERSAL_BUILD@ -+# ifdef _LP64 -+# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) -+# else -+# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) -+# endif - # else --# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) -+# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) - # endif --#else --# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) --#endif - - /* wchar_t limits */ - /* Get WCHAR_MIN, WCHAR_MAX. -@@ -543,29 +545,29 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - sequence of nested includes - -> -> -> , and the latter includes - and assumes its types are already defined. */ --#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) -+# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ --# include --# include --# include --# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H --# include --# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H --#endif --#undef WCHAR_MIN --#undef WCHAR_MAX --#define WCHAR_MIN \ -+# include -+# include -+# include -+# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -+# include -+# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -+# endif -+# undef WCHAR_MIN -+# undef WCHAR_MAX -+# define WCHAR_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) --#define WCHAR_MAX \ -+# define WCHAR_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) - - /* wint_t limits */ --#undef WINT_MIN --#undef WINT_MAX --#define WINT_MIN \ -+# undef WINT_MIN -+# undef WINT_MAX -+# define WINT_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) --#define WINT_MAX \ -+# define WINT_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) - - /* 7.18.4. Macros for integer constants */ -@@ -576,59 +578,120 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) - /* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ - --#undef INT8_C --#undef UINT8_C --#define INT8_C(x) x --#define UINT8_C(x) x -- --#undef INT16_C --#undef UINT16_C --#define INT16_C(x) x --#define UINT16_C(x) x -- --#undef INT32_C --#undef UINT32_C --#define INT32_C(x) x --#define UINT32_C(x) x ## U -- --#undef INT64_C --#undef UINT64_C --#if LONG_MAX >> 31 >> 31 == 1 --# define INT64_C(x) x##L --#elif defined _MSC_VER --# define INT64_C(x) x##i64 --#elif @HAVE_LONG_LONG_INT@ --# define INT64_C(x) x##LL --#endif --#if ULONG_MAX >> 31 >> 31 >> 1 == 1 --# define UINT64_C(x) x##UL --#elif defined _MSC_VER --# define UINT64_C(x) x##ui64 --#elif @HAVE_UNSIGNED_LONG_LONG_INT@ --# define UINT64_C(x) x##ULL --#endif -+# undef INT8_C -+# undef UINT8_C -+# define INT8_C(x) x -+# define UINT8_C(x) x -+ -+# undef INT16_C -+# undef UINT16_C -+# define INT16_C(x) x -+# define UINT16_C(x) x -+ -+# undef INT32_C -+# undef UINT32_C -+# define INT32_C(x) x -+# define UINT32_C(x) x ## U -+ -+# undef INT64_C -+# undef UINT64_C -+# if LONG_MAX >> 31 >> 31 == 1 -+# define INT64_C(x) x##L -+# elif defined _MSC_VER -+# define INT64_C(x) x##i64 -+# elif @HAVE_LONG_LONG_INT@ -+# define INT64_C(x) x##LL -+# endif -+# if ULONG_MAX >> 31 >> 31 >> 1 == 1 -+# define UINT64_C(x) x##UL -+# elif defined _MSC_VER -+# define UINT64_C(x) x##ui64 -+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ -+# define UINT64_C(x) x##ULL -+# endif - - /* 7.18.4.2. Macros for greatest-width integer constants */ - --#ifndef INTMAX_C --# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 --# define INTMAX_C(x) x##LL --# elif defined GL_INT64_T --# define INTMAX_C(x) INT64_C(x) --# else --# define INTMAX_C(x) x##L -+# ifndef INTMAX_C -+# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -+# define INTMAX_C(x) x##LL -+# elif defined GL_INT64_T -+# define INTMAX_C(x) INT64_C(x) -+# else -+# define INTMAX_C(x) x##L -+# endif - # endif --#endif - --#ifndef UINTMAX_C --# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 --# define UINTMAX_C(x) x##ULL --# elif defined GL_UINT64_T --# define UINTMAX_C(x) UINT64_C(x) --# else --# define UINTMAX_C(x) x##UL -+# ifndef UINTMAX_C -+# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -+# define UINTMAX_C(x) x##ULL -+# elif defined GL_UINT64_T -+# define UINTMAX_C(x) UINT64_C(x) -+# else -+# define UINTMAX_C(x) x##UL -+# endif - # endif --#endif -+ -+#endif /* !@HAVE_C99_STDINT_H@ */ -+ -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#if (!defined UINTMAX_WIDTH \ -+ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) -+# ifdef INT8_MAX -+# define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX) -+# endif -+# ifdef UINT8_MAX -+# define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX) -+# endif -+# ifdef INT16_MAX -+# define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX) -+# endif -+# ifdef UINT16_MAX -+# define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX) -+# endif -+# ifdef INT32_MAX -+# define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX) -+# endif -+# ifdef UINT32_MAX -+# define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX) -+# endif -+# ifdef INT64_MAX -+# define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX) -+# endif -+# ifdef UINT64_MAX -+# define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX) -+# endif -+# define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX) -+# define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX) -+# define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX) -+# define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX) -+# define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX) -+# define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX) -+# define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX) -+# define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX) -+# define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX) -+# define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX) -+# define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX) -+# define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX) -+# define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX) -+# define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX) -+# define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX) -+# define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX) -+# define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX) -+# define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX) -+# define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX) -+# define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX) -+# define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX) -+# define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX) -+# define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX) -+# ifdef WINT_MAX -+# define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX) -+# endif -+# ifdef SIG_ATOMIC_MAX -+# define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX) -+# endif -+#endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ - - #endif /* _@GUARD_PREFIX@_STDINT_H */ - #endif /* !(defined __ANDROID__ && ...) */ -diff --git a/pskctool/gl/stripslash.c b/pskctool/gl/stripslash.c -new file mode 100644 -index 0000000..0453e36 ---- /dev/null -+++ b/pskctool/gl/stripslash.c -@@ -0,0 +1,45 @@ -+/* stripslash.c -- remove redundant trailing slashes from a file name -+ -+ Copyright (C) 1990, 2001, 2003-2006, 2009-2016 Free Software Foundation, -+ Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+#include "dirname.h" -+ -+/* Remove trailing slashes from FILE. Return true if a trailing slash -+ was removed. This is useful when using file name completion from a -+ shell that adds a "/" after directory names (such as tcsh and -+ bash), because on symlinks to directories, several system calls -+ have different semantics according to whether a trailing slash is -+ present. */ -+ -+bool -+strip_trailing_slashes (char *file) -+{ -+ char *base = last_component (file); -+ char *base_lim; -+ bool had_slash; -+ -+ /* last_component returns "" for file system roots, but we need to turn -+ "///" into "/". */ -+ if (! *base) -+ base = file; -+ base_lim = base + base_len (base); -+ had_slash = (*base_lim != '\0'); -+ *base_lim = '\0'; -+ return had_slash; -+} -diff --git a/pskctool/gl/tests/Makefile.am b/pskctool/gl/tests/Makefile.am -index 9973163..6738d6a 100644 ---- a/pskctool/gl/tests/Makefile.am -+++ b/pskctool/gl/tests/Makefile.am -@@ -200,6 +200,16 @@ EXTRA_DIST += test-fwrite.c signature.h macros.h - - ## end gnulib module fwrite-tests - -+## begin gnulib module getprogname-tests -+ -+DEFS += -DEXEEXT=\"@EXEEXT@\" -+TESTS += test-getprogname -+check_PROGRAMS += test-getprogname -+test_getprogname_LDADD = $(LDADD) -+EXTRA_DIST += test-getprogname.c -+ -+## end gnulib module getprogname-tests -+ - ## begin gnulib module gettimeofday-tests - - TESTS += test-gettimeofday -@@ -270,6 +280,14 @@ EXTRA_DIST += test-inttypes.c - - ## end gnulib module inttypes-tests - -+## begin gnulib module limits-h-tests -+ -+TESTS += test-limits-h -+check_PROGRAMS += test-limits-h -+EXTRA_DIST += test-limits-h.c -+ -+## end gnulib module limits-h-tests -+ - ## begin gnulib module lseek-tests - - TESTS += test-lseek.sh -@@ -398,29 +416,6 @@ EXTRA_DIST += test-stdalign.c macros.h - - ## end gnulib module stdalign-tests - --## begin gnulib module stdbool -- --BUILT_SOURCES += $(STDBOOL_H) -- --# We need the following in order to create when the system --# doesn't have one that works. --if GL_GENERATE_STDBOOL_H --stdbool.h: stdbool.in.h $(top_builddir)/config.status -- $(AM_V_GEN)rm -f $@-t $@ && \ -- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ -- sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ -- } > $@-t && \ -- mv $@-t $@ --else --stdbool.h: $(top_builddir)/config.status -- rm -f $@ --endif --MOSTLYCLEANFILES += stdbool.h stdbool.h-t -- --EXTRA_DIST += stdbool.in.h -- --## end gnulib module stdbool -- - ## begin gnulib module stdbool-tests - - TESTS += test-stdbool -diff --git a/pskctool/gl/tests/test-getprogname.c b/pskctool/gl/tests/test-getprogname.c -new file mode 100644 -index 0000000..6e3f694 ---- /dev/null -+++ b/pskctool/gl/tests/test-getprogname.c -@@ -0,0 +1,31 @@ -+/* Test the gnulib getprogname module. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+#include "getprogname.h" -+#include -+#include -+ -+#define STREQ(a, b) (strcmp (a, b) == 0) -+ -+int -+main (void) -+{ -+ char const *p = getprogname (); -+ assert (STREQ (p, "test-getprogname" EXEEXT)); -+ return 0; -+} -diff --git a/pskctool/gl/tests/test-limits-h.c b/pskctool/gl/tests/test-limits-h.c -new file mode 100644 -index 0000000..597dabf ---- /dev/null -+++ b/pskctool/gl/tests/test-limits-h.c -@@ -0,0 +1,46 @@ -+/* Test of substitute. -+ Copyright 2016 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* Written by Paul Eggert. */ -+ -+#include -+ -+#include -+ -+#include "verify.h" -+ -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#define verify_width(width, min, max) \ -+ verify ((max) >> ((width) - 1 - ((min) < 0)) == 1) -+ -+verify_width (CHAR_WIDTH, CHAR_MIN, CHAR_MAX); -+verify_width (SCHAR_WIDTH, SCHAR_MIN, SCHAR_MAX); -+verify_width (UCHAR_WIDTH, 0, UCHAR_MAX); -+verify_width (SHRT_WIDTH, SHRT_MIN, SHRT_MAX); -+verify_width (USHRT_WIDTH, 0, USHRT_MAX); -+verify_width (INT_WIDTH, INT_MIN, INT_MAX); -+verify_width (UINT_WIDTH, 0, UINT_MAX); -+verify_width (LONG_WIDTH, LONG_MIN, LONG_MAX); -+verify_width (ULONG_WIDTH, 0, ULONG_MAX); -+verify_width (LLONG_WIDTH, LLONG_MIN, LLONG_MAX); -+verify_width (ULLONG_WIDTH, 0, ULLONG_MAX); -+ -+int -+main (void) -+{ -+ return 0; -+} -diff --git a/pskctool/gl/tests/test-stdint.c b/pskctool/gl/tests/test-stdint.c -index 7705fc7..c0e2f08 100644 ---- a/pskctool/gl/tests/test-stdint.c -+++ b/pskctool/gl/tests/test-stdint.c -@@ -351,6 +351,64 @@ verify_same_types (INTMAX_C (17), (intmax_t)0 + 0); - verify (UINTMAX_C (17) == 17); - verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0); - -+/* Macros specified by ISO/IEC TS 18661-1:2014. */ -+ -+#define verify_width(width, min, max) \ -+ verify ((max) >> ((width) - 1 - ((min) < 0)) == 1) -+ -+#ifdef INT8_MAX -+verify_width (INT8_WIDTH, INT8_MIN, INT8_MAX); -+#endif -+#ifdef UINT8_MAX -+verify_width (UINT8_WIDTH, 0, UINT8_MAX); -+#endif -+#ifdef INT16_MAX -+verify_width (INT16_WIDTH, INT16_MIN, INT16_MAX); -+#endif -+#ifdef UINT16_MAX -+verify_width (UINT16_WIDTH, 0, UINT16_MAX); -+#endif -+#ifdef INT32_MAX -+verify_width (INT32_WIDTH, INT32_MIN, INT32_MAX); -+#endif -+#ifdef UINT32_MAX -+verify_width (UINT32_WIDTH, 0, UINT32_MAX); -+#endif -+#ifdef INT64_MAX -+verify_width (INT64_WIDTH, INT64_MIN, INT64_MAX); -+#endif -+#ifdef UINT64_MAX -+verify_width (UINT64_WIDTH, 0, UINT64_MAX); -+#endif -+verify_width (INT_LEAST8_WIDTH, INT_LEAST8_MIN, INT_LEAST8_MAX); -+verify_width (UINT_LEAST8_WIDTH, 0, UINT_LEAST8_MAX); -+verify_width (INT_LEAST16_WIDTH, INT_LEAST16_MIN, INT_LEAST16_MAX); -+verify_width (UINT_LEAST16_WIDTH, 0, UINT_LEAST16_MAX); -+verify_width (INT_LEAST32_WIDTH, INT_LEAST32_MIN, INT_LEAST32_MAX); -+verify_width (UINT_LEAST32_WIDTH, 0, UINT_LEAST32_MAX); -+verify_width (INT_LEAST64_WIDTH, INT_LEAST64_MIN, INT_LEAST64_MAX); -+verify_width (UINT_LEAST64_WIDTH, 0, UINT_LEAST64_MAX); -+verify_width (INT_FAST8_WIDTH, INT_FAST8_MIN, INT_FAST8_MAX); -+verify_width (UINT_FAST8_WIDTH, 0, UINT_FAST8_MAX); -+verify_width (INT_FAST16_WIDTH, INT_FAST16_MIN, INT_FAST16_MAX); -+verify_width (UINT_FAST16_WIDTH, 0, UINT_FAST16_MAX); -+verify_width (INT_FAST32_WIDTH, INT_FAST32_MIN, INT_FAST32_MAX); -+verify_width (UINT_FAST32_WIDTH, 0, UINT_FAST32_MAX); -+verify_width (INT_FAST64_WIDTH, INT_FAST64_MIN, INT_FAST64_MAX); -+verify_width (UINT_FAST64_WIDTH, 0, UINT_FAST64_MAX); -+verify_width (INTPTR_WIDTH, INTPTR_MIN, INTPTR_MAX); -+verify_width (UINTPTR_WIDTH, 0, UINTPTR_MAX); -+verify_width (INTMAX_WIDTH, INTMAX_MIN, INTMAX_MAX); -+verify_width (UINTMAX_WIDTH, 0, UINTMAX_MAX); -+verify_width (PTRDIFF_WIDTH, PTRDIFF_MIN, PTRDIFF_MAX); -+verify_width (SIZE_WIDTH, 0, SIZE_MAX); -+verify_width (WCHAR_WIDTH, WCHAR_MIN, WCHAR_MAX); -+#ifdef WINT_MAX -+verify_width (WINT_WIDTH, WINT_MIN, WINT_MAX); -+#endif -+#ifdef SIG_ATOMIC_MAX -+verify_width (SIG_ATOMIC_WIDTH, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX); -+#endif - - int - main (void) -diff --git a/pskctool/gl/tests/test-version-etc.c b/pskctool/gl/tests/test-version-etc.c -index 4382c76..66404a3 100644 ---- a/pskctool/gl/tests/test-version-etc.c -+++ b/pskctool/gl/tests/test-version-etc.c -@@ -19,14 +19,12 @@ - - #include "version-etc.h" - --#include "progname.h" - - #define AUTHORS "Sergey Poznyakoff", "Eric Blake" - - int - main (int argc _GL_UNUSED, char **argv) - { -- set_program_name (argv[0]); - version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS, - (const char *) NULL); - return 0; diff --git a/0003-pam_oath-assign-safe-default-to-alwaysok-config-memb.patch b/0003-pam_oath-assign-safe-default-to-alwaysok-config-memb.patch deleted file mode 100644 index fb955f1..0000000 --- a/0003-pam_oath-assign-safe-default-to-alwaysok-config-memb.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 70722be5a76d28df8ebbf8a706c6346c57cebb62 Mon Sep 17 00:00:00 2001 -From: Matthias Gerstner -Date: Thu, 5 Jul 2018 18:39:48 +0200 -Subject: [PATCH] pam_oath: assign safe default to alwaysok config member - -The way this was before allowed for the PAM authentication to -potentially succeed when the first `goto done` line is hit. If the -undefined data behind alwaysok is non-zero (which is quite probable) -this would happen. - -In theory a local attacker could try to exhaust memory just enough to -hit this spot and get e.g. root access. ---- - pam_oath/pam_oath.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/pam_oath/pam_oath.c b/pam_oath/pam_oath.c -index 57fd33c..cfc3331 100644 ---- a/pam_oath/pam_oath.c -+++ b/pam_oath/pam_oath.c -@@ -146,6 +146,8 @@ pam_sm_authenticate (pam_handle_t * pamh, - char *query_prompt = NULL; - char *onlypasswd = strdup (""); /* empty passwords never match */ - -+ cfg.alwaysok = false; /* make sure this gets a safe default */ -+ - if (!onlypasswd) - { - retval = PAM_BUF_ERR; --- -2.16.4 - diff --git a/gnulib-libio.patch b/gnulib-libio.patch deleted file mode 100644 index cc77176..0000000 --- a/gnulib-libio.patch +++ /dev/null @@ -1,119 +0,0 @@ -2018-03-05 Paul Eggert - - fflush: adjust to glibc 2.28 libio.h removal - Problem reported by Daniel P. Berrangé in: - https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html - * lib/fbufmode.c (fbufmode): - * lib/fflush.c (clear_ungetc_buffer_preserving_position) - (disable_seek_optimization, rpl_fflush): - * lib/fpending.c (__fpending): - * lib/fpurge.c (fpurge): - * lib/freadable.c (freadable): - * lib/freadahead.c (freadahead): - * lib/freading.c (freading): - * lib/freadptr.c (freadptr): - * lib/freadseek.c (freadptrinc): - * lib/fseeko.c (fseeko): - * lib/fseterr.c (fseterr): - * lib/fwritable.c (fwritable): - * lib/fwriting.c (fwriting): - Check _IO_EOF_SEEN instead of _IO_ftrylockfile. - * lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]: - Define if not already defined. - -Index: oath-toolkit-2.6.2/liboath/gl/fflush.c -=================================================================== ---- oath-toolkit-2.6.2.orig/liboath/gl/fflush.c -+++ oath-toolkit-2.6.2/liboath/gl/fflush.c -@@ -33,7 +33,7 @@ - #undef fflush - - --#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ -+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ - - /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ - static void -@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp) - - #endif - --#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) -+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) - - # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ -@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream) - if (stream == NULL || ! freading (stream)) - return fflush (stream); - --#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ -+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ - - clear_ungetc_buffer_preserving_position (stream); - -Index: oath-toolkit-2.6.2/liboath/gl/fpurge.c -=================================================================== ---- oath-toolkit-2.6.2.orig/liboath/gl/fpurge.c -+++ oath-toolkit-2.6.2/liboath/gl/fpurge.c -@@ -62,7 +62,7 @@ fpurge (FILE *fp) - /* Most systems provide FILE as a struct and the necessary bitmask in - , because they need it for implementing getc() and putc() as - fast macros. */ --# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ -+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ - fp->_IO_read_end = fp->_IO_read_ptr; - fp->_IO_write_ptr = fp->_IO_write_base; - /* Avoid memory leak when there is an active ungetc buffer. */ -Index: oath-toolkit-2.6.2/liboath/gl/freading.c -=================================================================== ---- oath-toolkit-2.6.2.orig/liboath/gl/freading.c -+++ oath-toolkit-2.6.2/liboath/gl/freading.c -@@ -31,7 +31,7 @@ freading (FILE *fp) - /* Most systems provide FILE as a struct and the necessary bitmask in - , because they need it for implementing getc() and putc() as - fast macros. */ --# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ -+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ - return ((fp->_flags & _IO_NO_WRITES) != 0 - || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 - && fp->_IO_read_base != NULL)); -Index: oath-toolkit-2.6.2/liboath/gl/fseeko.c -=================================================================== ---- oath-toolkit-2.6.2.orig/liboath/gl/fseeko.c -+++ oath-toolkit-2.6.2/liboath/gl/fseeko.c -@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int when - #endif - - /* These tests are based on fpurge.c. */ --#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ -+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ - if (fp->_IO_read_end == fp->_IO_read_ptr - && fp->_IO_write_ptr == fp->_IO_write_base - && fp->_IO_save_base == NULL) -@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int when - return -1; - } - --#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ -+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ - fp->_flags &= ~_IO_EOF_SEEN; - fp->_offset = pos; - #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ -Index: oath-toolkit-2.6.2/liboath/gl/stdio-impl.h -=================================================================== ---- oath-toolkit-2.6.2.orig/liboath/gl/stdio-impl.h -+++ oath-toolkit-2.6.2/liboath/gl/stdio-impl.h -@@ -18,6 +18,12 @@ - the same implementation of stdio extension API, except that some fields - have different naming conventions, or their access requires some casts. */ - -+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this -+ problem by defining it ourselves. FIXME: Do not rely on glibc -+ internals. */ -+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN -+# define _IO_IN_BACKUP 0x100 -+#endif - - /* BSD stdio derived implementations. */ - diff --git a/oath-toolkit-2.6.2.tar.gz b/oath-toolkit-2.6.2.tar.gz deleted file mode 100644 index 5f5aa4f..0000000 --- a/oath-toolkit-2.6.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b03446fa4b549af5ebe4d35d7aba51163442d255660558cd861ebce536824aa0 -size 4295786 diff --git a/oath-toolkit-2.6.5.tar.gz b/oath-toolkit-2.6.5.tar.gz new file mode 100644 index 0000000..a749bf1 --- /dev/null +++ b/oath-toolkit-2.6.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d207120c7e7fdd540142d04ca06d83fb3277c8f2fb794a74535d04b2aa0ec219 +size 5477292 diff --git a/oath-toolkit-2.6.5.tar.gz.sig b/oath-toolkit-2.6.5.tar.gz.sig new file mode 100644 index 0000000..1c481dc Binary files /dev/null and b/oath-toolkit-2.6.5.tar.gz.sig differ diff --git a/oath-toolkit.changes b/oath-toolkit.changes index da213b4..207d97e 100644 --- a/oath-toolkit.changes +++ b/oath-toolkit.changes @@ -1,3 +1,39 @@ +------------------------------------------------------------------- +Tue Dec 29 11:58:14 UTC 2020 - Martin Hauke + +- Update to version 2.6.5 + * oathtool: Support for reading KEY and OTP from standard input + or filename. + KEY and OTP may now be given as '-' to mean stdin, or @FILE to + read from a particular file. This is recommended on multi-user + systems, since secrets as command line parameters leak. + * pam_oath: Fix unlikely logic fail on out of memory conditions. + * Doc fixes. +- Update to version 2.6.4 + * libpskc: New --with-xmlsec-crypto-engine to hard-code crypto + engine. Use it like --with-xmlsec-crypto-engine=gnutls or + --with-xmlsec-crypto-engine=openssl if the default dynamic + loading fails because of runtime linker search path issues. + * oathtool --totp --verbose now prints TOTP hash mode. + * oathtool: Hash names (e.g., SHA256) for --totp are now upper + case. Lower/mixed case hash names are supported for + compatibility. + * pam_oath: Fail gracefully for missing users. + This allows you to incrementally add support for OATH + authentication instead of forcing it on all users. + * Fix libpskc memory corruption bug. + * Fix man pages. + * Build fixes. +- Update to version 2.6.3 + * pam_oath: Fix self-tests. +- Drop not longer needed patches: + * 0001-Fix-no-return-in-nonvoid-function-errors-reported-by.patch + * 0003-pam_oath-assign-safe-default-to-alwaysok-config-memb.patch + * 0002-update_gnulibs_files.patch + * gnulib-libio.patch +- Use source verification +- Use proper source URLs + ------------------------------------------------------------------- Mon Aug 6 07:59:16 UTC 2018 - schwab@suse.de diff --git a/oath-toolkit.keyring b/oath-toolkit.keyring new file mode 100644 index 0000000..a724c87 --- /dev/null +++ b/oath-toolkit.keyring @@ -0,0 +1,23 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mDMEXJLOtBYJKwYBBAHaRw8BAQdACIcrZIvhrxDBkK9fV+QlTmXxo2naObDuGtw5 +8YaxlOu0JVNpbW9uIEpvc2Vmc3NvbiA8c2ltb25Aam9zZWZzc29uLm9yZz6IlgQT +FggAPgIbAwULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgBYhBLHSvRN1vst4TPT4xNc8 +9jjFPAa+BQJezg00BQkDekmAAAoJENc89jjFPAa+7QMBAKyq5ZypvFOXgcwlNtQd +f6F+SP9LnCNSreQRYo4RxSwAAQD7A+O56xFPB1DIM74lpvaExNJFHbJXCIfFGifJ +ycR0A7gzBFySz3UWCSsGAQQB2kcPAQEHQLzCFcHHrKzVSPDDarZPYqn89H5TPaxw +cORgRg+4DagEiH4EGBYIACYCGyAWIQSx0r0Tdb7LeEz0+MTXPPY4xTwGvgUCXs4N +RwUJA3pI0gAKCRDXPPY4xTwGvgxBAQCyHr8nGeaoOAmhPPOGDObOoa6/Dps+WBpm +vFw8J/Z5AAEAtE/pypHisMHmF4cy5S/kHVzLZvfxaTAlGqtoZGHShAa4MwRcks+B +FgkrBgEEAdpHDwEBB0DsUwiDmnlwMSNoSF+ByvW0E6TVXou9PKDa9SpZvKghioj1 +BBgWCAAmAhsCFiEEsdK9E3W+y3hM9PjE1zz2OMU8Br4FAl7ODUwFCQN6SMsAgXYg +BBkWCAAdFiEEo8ychwudMQq61M8vUXIrCP5HRaIFAlySz4EACgkQUXIrCP5HRaKn +TAEAoB+OWrHmYCK8Cjr1DgPUH7JnhPBmR2DbhR5jPRREEugA+gOMeWmL6GOpaPfK +YLcNhzw4ZnAlxSLY1wq1eANBpiQOCRDXPPY4xTwGvuQiAPwKnKAbzegaSATxN1cd +Fia4m80uJNFHMQL679WSBG3FIAEA8uLgxGud6SqFgIaFR4wrzrIgzVWqHxDuu56f +JSf/iAe4OARcks9qEgorBgEEAZdVAQUBAQdAMZUbpg1up2WOwPlQn3pPVaRMejyZ +nScmD7d5TRzHehwDAQgHiH4EGBYIACYCGwwWIQSx0r0Tdb7LeEz0+MTXPPY4xTwG +vgUCXs4NQAUJA3pI1gAKCRDXPPY4xTwGvu8QAP9Ln136hLt/yLfx4KYjBxPAdfd9 +oRYd3xqWFBxNZmn+BgD/XZrhNaY3MEBV4yIx4ts6JT7dJfXGcbNjxK1T2BlXdQE= +=moUA +-----END PGP PUBLIC KEY BLOCK----- diff --git a/oath-toolkit.spec b/oath-toolkit.spec index dbbe29d..fa25e52 100644 --- a/oath-toolkit.spec +++ b/oath-toolkit.spec @@ -1,7 +1,7 @@ # # spec file for package oath-toolkit # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,22 +12,20 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: oath-toolkit -Version: 2.6.2 +Version: 2.6.5 Release: 0 Summary: Toolkit for one-time password authentication systems License: GPL-3.0-or-later AND LGPL-2.1-or-later Group: Productivity/Networking/Security URL: http://www.nongnu.org/oath-toolkit/ -Source: http://download.savannah.nongnu.org/releases/%{name}/%{name}-%{version}.tar.gz -Patch1: 0001-Fix-no-return-in-nonvoid-function-errors-reported-by.patch -Patch2: 0002-update_gnulibs_files.patch -Patch3: 0003-pam_oath-assign-safe-default-to-alwaysok-config-memb.patch -Patch4: gnulib-libio.patch +Source: https://download-mirror.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.gz +Source1: https://download-mirror.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.gz.sig +Source99: %{name}.keyring BuildRequires: bison BuildRequires: gengetopt BuildRequires: libgcrypt-devel @@ -130,10 +128,6 @@ This subpackage contains the headers for this library. %prep %setup -q -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 %build autoreconf -fiv