Update from Gnulib

This incorporates:
2018-05-21 crypto: omit stream ops Emacs doesn’t need
2018-05-13 truncate: Fix compilation error on Android
2018-05-13 imaxdiv: Fix compilation error on Android
2018-05-13 Support selective inclusion of recent mingw.org headers
2018-05-13 Add cross-compilation guesses for Linux systems sans glibc
2018-05-13 stdioext: Fix compilation errors with newer Android headers
2018-05-07 af_alg: Pacify --enable-gcc-warnings
2018-05-06 af_alg: Fix bug with streams that are not at position 0
2018-05-06 Followup to 'af_alg: New module'
2018-05-05 crypto/{md5,sha1,sha256,sha512}: simplify
2018-05-05 af_alg: New module
2018-05-05 af_alg: Improve function signature
2018-04-28 md5sum: Use AF_ALG when available
2018-04-28 sha512sum: Use AF_ALG when available
2018-04-28 sha256sum: Use AF_ALG when available
2018-04-28 sha1sum: Use AF_ALG when available
2018-05-05 all: Replace more http URLs by https URLs
2018-05-03 maint: port more modules to GCC 8
2018-05-03 Simplify code; drop support for Borland C++ on Windows
* admin/merge-gnulib (GNULIB_MODULES): Use crypto/md5-buffer
rather than crypto/md5, since Emacs doesn’t use the stream
operations that in recent Gnulib pull in other stuff Emacs doesn’t
need.  Similarly for crypto/sha1-buffer, crypto/sha256-buffer,
crypto/sha512-buffer.
* build-aux/config.guess, build-aux/config.sub, lib/dosname.h:
* lib/dup2.c, lib/errno.in.h, lib/euidaccess.c, lib/fcntl.c:
* lib/fcntl.in.h, lib/fpending.c, lib/fsync.c, lib/getdtablesize.c:
* lib/getopt.c, lib/gettimeofday.c, lib/inttypes.in.h, lib/md5.c:
* lib/md5.h, lib/open.c, lib/pipe2.c, lib/putenv.c, lib/sha1.c:
* lib/sha1.h, lib/sha256.c, lib/sha256.h, lib/sha512.c:
* lib/sha512.h, lib/stat-time.h, lib/stdio-impl.h, lib/stdio.in.h:
* lib/stdlib.in.h, lib/sys_stat.in.h, lib/sys_types.in.h:
* lib/timespec.h, lib/unistd.in.h, lib/utimens.c, m4/c-strtod.m4:
* m4/gnulib-common.m4, m4/inttypes.m4, m4/lstat.m4, m4/nocrash.m4:
* m4/pselect.m4, m4/readlink.m4, m4/stdio_h.m4, m4/symlink.m4:
* m4/unistd_h.m4, m4/utimens.m4:
Copy from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
This commit is contained in:
Paul Eggert 2018-05-21 11:42:18 -07:00
parent f21db9e120
commit 79f15092b9
48 changed files with 1160 additions and 1075 deletions

View file

@ -29,7 +29,7 @@ GNULIB_MODULES='
alloca-opt binary-io byteswap c-ctype c-strcase
careadlinkat close-stream
count-leading-zeros count-one-bits count-trailing-zeros
crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512
crypto/md5-buffer crypto/sha1-buffer crypto/sha256-buffer crypto/sha512-buffer
d-type diffseq dtoastr dtotimespec dup2
environ execinfo explicit_bzero faccessat
fcntl fcntl-h fdatasync fdopendir

View file

@ -2,7 +2,7 @@
# Attempt to guess a canonical system name.
# Copyright 1992-2018 Free Software Foundation, Inc.
timestamp='2018-03-08'
timestamp='2018-05-19'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -106,7 +106,7 @@ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
,,) echo "int x;" > "$dummy.c" ;
for c in cc gcc c89 c99 ; do
if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
@ -237,7 +237,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "$machine-${os}${release}${abi}"
echo "$machine-${os}${release}${abi-}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`

1402
build-aux/config.sub vendored

File diff suppressed because it is too large Load diff

View file

@ -20,9 +20,8 @@
#ifndef _DOSNAME_H
#define _DOSNAME_H
#if (defined _WIN32 || defined __WIN32__ || \
defined __MSDOS__ || defined __CYGWIN__ || \
defined __EMX__ || defined __DJGPP__)
#if (defined _WIN32 || defined __CYGWIN__ \
|| defined __EMX__ || defined __MSDOS__ || 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' \

View file

@ -29,7 +29,7 @@
# undef dup2
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# if defined _WIN32 && ! defined __CYGWIN__
/* Get declarations of the native Windows API functions. */
# define WIN32_LEAN_AND_MEAN

View file

@ -30,7 +30,7 @@
/* On native Windows platforms, many macros are not defined. */
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# if defined _WIN32 && ! defined __CYGWIN__
/* These are the same values as defined by MSVC 10, for interoperability. */
@ -248,7 +248,7 @@
interoperability. */
# define EOWNERDEAD 58
# define ENOTRECOVERABLE 59
# elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# elif defined _WIN32 && ! defined __CYGWIN__
/* We have a conflict here: pthreads-win32 defines these values
differently than MSVC 10. It's hairy to decide which one to use. */
# if defined __MINGW32__ && !defined USE_WINDOWS_THREADS

View file

@ -29,7 +29,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if defined _WIN32 && ! defined __CYGWIN__
# include <io.h>
#else
# include "root-uid.h"
@ -87,7 +87,7 @@ euidaccess (const char *file, int mode)
return accessx (file, mode, ACC_SELF);
#elif HAVE_EACCESS /* FreeBSD */
return eaccess (file, mode);
#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* mingw */
#elif defined _WIN32 && ! defined __CYGWIN__ /* mingw */
return _access (file, mode);
#else /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, BeOS */

View file

@ -32,7 +32,7 @@
#endif
#undef fcntl
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if defined _WIN32 && ! defined __CYGWIN__
/* Get declarations of the native Windows API functions. */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
@ -376,7 +376,7 @@ rpl_fcntl (int fd, int action, /* arg */...)
#if !HAVE_FCNTL
case F_GETFD:
{
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# if defined _WIN32 && ! defined __CYGWIN__
HANDLE handle = (HANDLE) _get_osfhandle (fd);
DWORD flags;
if (handle == INVALID_HANDLE_VALUE

View file

@ -68,7 +68,7 @@
/* Native Windows platforms declare open(), creat() in <io.h>. */
#if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
&& (defined _WIN32 && ! defined __CYGWIN__)
# include <io.h>
#endif

View file

@ -24,6 +24,9 @@
#include "stdio-impl.h"
/* This file is not used on systems that already have the __fpending function,
namely glibc >= 2.2, Solaris >= 7, Android API >= 23. */
/* Return the number of pending (aka buffered, unflushed)
bytes on the stream, FP, that is open for writing. */
size_t

View file

@ -25,7 +25,7 @@
#include <config.h>
#include <unistd.h>
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if defined _WIN32 && ! defined __CYGWIN__
/* FlushFileBuffers */
# define WIN32_LEAN_AND_MEAN

View file

@ -20,7 +20,7 @@
/* Specification. */
#include <unistd.h>
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if defined _WIN32 && ! defined __CYGWIN__
# include <stdio.h>

View file

@ -46,7 +46,7 @@
/* When used standalone, flockfile and funlockfile might not be
available. */
# if (!defined _POSIX_THREAD_SAFE_FUNCTIONS \
|| ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
|| (defined _WIN32 && ! defined __CYGWIN__))
# define flockfile(fp) /* nop */
# define funlockfile(fp) /* nop */
# endif

View file

@ -24,7 +24,7 @@
#include <time.h>
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if defined _WIN32 && ! defined __CYGWIN__
# define WINDOWS_NATIVE
# include <windows.h>
#endif

View file

@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stat --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=tzset --avoid=unsetenv --avoid=utime --avoid=utime-h --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 d-type diffseq dtoastr dtotimespec dup2 environ execinfo explicit_bzero faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsusage fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr minmax mkostemp mktime nstrftime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strtoimax symlink sys_stat sys_time tempname time time_r time_rz timegm timer-time timespec-add timespec-sub unlocked-io update-copyright utimens vla warnings
# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stat --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=tzset --avoid=unsetenv --avoid=utime --avoid=utime-h --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5-buffer crypto/sha1-buffer crypto/sha256-buffer crypto/sha512-buffer d-type diffseq dtoastr dtotimespec dup2 environ execinfo explicit_bzero faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsusage fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr minmax mkostemp mktime nstrftime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strtoimax symlink sys_stat sys_time tempname time time_r time_rz timegm timer-time timespec-add timespec-sub unlocked-io update-copyright utimens vla warnings
MOSTLYCLEANFILES += core *.stackdump
@ -387,6 +387,7 @@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@
HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@
HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@
HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@
HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@
HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
@ -421,6 +422,7 @@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@
HAVE_GRANTPT = @HAVE_GRANTPT@
HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@
HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
HAVE_LCHMOD = @HAVE_LCHMOD@
HAVE_LCHOWN = @HAVE_LCHOWN@
@ -513,7 +515,6 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
HAVE_TIMEGM = @HAVE_TIMEGM@
HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@
HAVE_TRUNCATE = @HAVE_TRUNCATE@
HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
HAVE_TZSET = @HAVE_TZSET@
HAVE_UNISTD_H = @HAVE_UNISTD_H@
@ -1151,45 +1152,45 @@ EXTRA_DIST += count-trailing-zeros.h
endif
## end gnulib module count-trailing-zeros
## begin gnulib module crypto/md5
ifeq (,$(OMIT_GNULIB_MODULE_crypto/md5))
## begin gnulib module crypto/md5-buffer
ifeq (,$(OMIT_GNULIB_MODULE_crypto/md5-buffer))
libgnu_a_SOURCES += md5.c
EXTRA_DIST += gl_openssl.h md5.h
endif
## end gnulib module crypto/md5
## end gnulib module crypto/md5-buffer
## begin gnulib module crypto/sha1
ifeq (,$(OMIT_GNULIB_MODULE_crypto/sha1))
## begin gnulib module crypto/sha1-buffer
ifeq (,$(OMIT_GNULIB_MODULE_crypto/sha1-buffer))
libgnu_a_SOURCES += sha1.c
EXTRA_DIST += gl_openssl.h sha1.h
endif
## end gnulib module crypto/sha1
## end gnulib module crypto/sha1-buffer
## begin gnulib module crypto/sha256
ifeq (,$(OMIT_GNULIB_MODULE_crypto/sha256))
## begin gnulib module crypto/sha256-buffer
ifeq (,$(OMIT_GNULIB_MODULE_crypto/sha256-buffer))
libgnu_a_SOURCES += sha256.c
EXTRA_DIST += gl_openssl.h sha256.h
endif
## end gnulib module crypto/sha256
## end gnulib module crypto/sha256-buffer
## begin gnulib module crypto/sha512
ifeq (,$(OMIT_GNULIB_MODULE_crypto/sha512))
## begin gnulib module crypto/sha512-buffer
ifeq (,$(OMIT_GNULIB_MODULE_crypto/sha512-buffer))
libgnu_a_SOURCES += sha512.c
EXTRA_DIST += gl_openssl.h sha512.h
endif
## end gnulib module crypto/sha512
## end gnulib module crypto/sha512-buffer
## begin gnulib module diffseq
ifeq (,$(OMIT_GNULIB_MODULE_diffseq))
@ -1717,6 +1718,7 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_U
-e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
-e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
-e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
-e 's/@''HAVE_IMAXDIV_T''@/$(HAVE_IMAXDIV_T)/g' \
-e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \
-e 's/@''REPLACE_STRTOUMAX''@/$(REPLACE_STRTOUMAX)/g' \
-e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \
@ -2984,7 +2986,6 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
-e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
-e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
-e 's|@''HAVE_TRUNCATE''@|$(HAVE_TRUNCATE)|g' \
-e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
-e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
-e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
@ -2996,6 +2997,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
-e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \
-e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \
-e 's|@''HAVE_DECL_TRUNCATE''@|$(HAVE_DECL_TRUNCATE)|g' \
-e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \
-e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
-e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \

View file

@ -52,7 +52,7 @@
/* Get CHAR_BIT. */
#include <limits.h>
/* On mingw, __USE_MINGW_ANSI_STDIO only works if <stdio.h> is also included */
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if defined _WIN32 && ! defined __CYGWIN__
# include <stdio.h>
#endif
@ -1067,11 +1067,13 @@ _GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - "
#endif
#if @GNULIB_IMAXDIV@
# if !@HAVE_DECL_IMAXDIV@
# if !@HAVE_IMAXDIV_T@
# if !GNULIB_defined_imaxdiv_t
typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t;
# define GNULIB_defined_imaxdiv_t 1
# endif
# endif
# if !@HAVE_DECL_IMAXDIV@
extern imaxdiv_t imaxdiv (intmax_t, intmax_t);
# endif
#elif defined GNULIB_POSIXCHECK

View file

@ -134,21 +134,29 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
}
#endif
#if defined _LIBC || defined GL_COMPILE_CRYPTO_STREAM
#include "af_alg.h"
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
int
md5_stream (FILE *stream, void *resblock)
{
struct md5_ctx ctx;
size_t sum;
switch (afalg_stream (stream, "md5", resblock, MD5_DIGEST_SIZE))
{
case 0: return 0;
case -EIO: return 1;
}
char *buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
/* Initialize the computation context. */
struct md5_ctx ctx;
md5_init_ctx (&ctx);
size_t sum;
/* Iterate over full file contents. */
while (1)
@ -206,6 +214,7 @@ md5_stream (FILE *stream, void *resblock)
free (buffer);
return 0;
}
#endif
#if ! HAVE_OPENSSL_MD5
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The

View file

@ -122,8 +122,11 @@ extern void *__md5_buffer (const char *buffer, size_t len,
void *resblock) __THROW;
# endif
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
/* Compute MD5 message digest for bytes read from STREAM.
STREAM is an open file stream. Regular files are handled more efficiently.
The contents of STREAM from its current position to its end will be read.
The case that the last operation on STREAM was an 'ungetc' is not supported.
The resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
extern int __md5_stream (FILE *stream, void *resblock) __THROW;

View file

@ -86,7 +86,7 @@ open (const char *filename, int flags, ...)
flags &= ~O_NONBLOCK;
#endif
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if defined _WIN32 && ! defined __CYGWIN__
if (strcmp (filename, "/dev/null") == 0)
filename = "NUL";
#endif

View file

@ -29,7 +29,7 @@
# include "nonblocking.h"
#endif
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if defined _WIN32 && ! defined __CYGWIN__
/* Native Windows API. */
# include <io.h>
@ -73,7 +73,7 @@ pipe2 (int fd[2], int flags)
return -1;
}
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if defined _WIN32 && ! defined __CYGWIN__
/* Native Windows API. */
if (_pipe (fd, 4096, flags & ~O_NONBLOCK) < 0)
@ -152,8 +152,7 @@ pipe2 (int fd[2], int flags)
#endif
#if GNULIB_defined_O_NONBLOCK || \
!((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
#if GNULIB_defined_O_NONBLOCK || !(defined _WIN32 && ! defined __CYGWIN__)
fail:
{
int saved_errno = errno;

View file

@ -34,7 +34,7 @@
#include <string.h>
#include <unistd.h>
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if defined _WIN32 && ! defined __CYGWIN__
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
@ -153,7 +153,7 @@ putenv (char *string)
*ep = string;
break;
}
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# if defined _WIN32 && ! defined __CYGWIN__
if (putenv_result == 0)
{
/* _putenv propagated "NAME= " into the subprocess environment;

View file

@ -122,21 +122,29 @@ sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
}
#endif
#ifdef GL_COMPILE_CRYPTO_STREAM
#include "af_alg.h"
/* Compute SHA1 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
resulting message digest number will be written into the 20 bytes
beginning at RESBLOCK. */
int
sha1_stream (FILE *stream, void *resblock)
{
struct sha1_ctx ctx;
size_t sum;
switch (afalg_stream (stream, "sha1", resblock, SHA1_DIGEST_SIZE))
{
case 0: return 0;
case -EIO: return 1;
}
char *buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
/* Initialize the computation context. */
struct sha1_ctx ctx;
sha1_init_ctx (&ctx);
size_t sum;
/* Iterate over full file contents. */
while (1)
@ -194,6 +202,7 @@ sha1_stream (FILE *stream, void *resblock)
free (buffer);
return 0;
}
#endif
#if ! HAVE_OPENSSL_SHA1
/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The

View file

@ -87,8 +87,11 @@ extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
# endif
/* Compute SHA1 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 20 bytes
/* Compute SHA1 message digest for bytes read from STREAM.
STREAM is an open file stream. Regular files are handled more efficiently.
The contents of STREAM from its current position to its end will be read.
The case that the last operation on STREAM was an 'ungetc' is not supported.
The resulting message digest number will be written into the 20 bytes
beginning at RESBLOCK. */
extern int sha1_stream (FILE *stream, void *resblock);

View file

@ -91,17 +91,17 @@ sha224_init_ctx (struct sha256_ctx *ctx)
ctx->buflen = 0;
}
/* Copy the value from v into the memory location pointed to by *cp,
If your architecture allows unaligned access this is equivalent to
* (uint32_t *) cp = v */
/* Copy the value from v into the memory location pointed to by *CP,
If your architecture allows unaligned access, this is equivalent to
* (__typeof__ (v) *) cp = v */
static void
set_uint32 (char *cp, uint32_t v)
{
memcpy (cp, &v, sizeof v);
}
/* Put result from CTX in first 32 bytes following RESBUF. The result
must be in little endian byte order. */
/* Put result from CTX in first 32 bytes following RESBUF.
The result must be in little endian byte order. */
void *
sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
{
@ -169,152 +169,107 @@ sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf)
}
#endif
/* Compute SHA256 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 32 bytes
beginning at RESBLOCK. */
#ifdef GL_COMPILE_CRYPTO_STREAM
#include "af_alg.h"
/* Compute message digest for bytes read from STREAM using algorithm ALG.
Write the message digest into RESBLOCK, which contains HASHLEN bytes.
The initial and finishing operations are INIT_CTX and FINISH_CTX.
Return zero if and only if successful. */
static int
shaxxx_stream (FILE *stream, char const *alg, void *resblock,
ssize_t hashlen, void (*init_ctx) (struct sha256_ctx *),
void *(*finish_ctx) (struct sha256_ctx *, void *))
{
switch (afalg_stream (stream, alg, resblock, hashlen))
{
case 0: return 0;
case -EIO: return 1;
}
char *buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
struct sha256_ctx ctx;
init_ctx (&ctx);
size_t sum;
/* Iterate over full file contents. */
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
while (1)
{
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
if (sum == BLOCKSIZE)
break;
if (n == 0)
{
/* Check for the error flag IFF N == 0, so that we don't
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (ferror (stream))
{
free (buffer);
return 1;
}
goto process_partial_block;
}
/* We've read at least one byte, so ignore errors. But always
check for EOF, since feof may be true even though N > 0.
Otherwise, we could end up calling fread after EOF. */
if (feof (stream))
goto process_partial_block;
}
/* Process buffer with BLOCKSIZE bytes. Note that
BLOCKSIZE % 64 == 0
*/
sha256_process_block (buffer, BLOCKSIZE, &ctx);
}
process_partial_block:;
/* Process any remaining bytes. */
if (sum > 0)
sha256_process_bytes (buffer, sum, &ctx);
/* Construct result in desired memory. */
finish_ctx (&ctx, resblock);
free (buffer);
return 0;
}
int
sha256_stream (FILE *stream, void *resblock)
{
struct sha256_ctx ctx;
size_t sum;
char *buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
/* Initialize the computation context. */
sha256_init_ctx (&ctx);
/* Iterate over full file contents. */
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
while (1)
{
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
if (sum == BLOCKSIZE)
break;
if (n == 0)
{
/* Check for the error flag IFF N == 0, so that we don't
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (ferror (stream))
{
free (buffer);
return 1;
}
goto process_partial_block;
}
/* We've read at least one byte, so ignore errors. But always
check for EOF, since feof may be true even though N > 0.
Otherwise, we could end up calling fread after EOF. */
if (feof (stream))
goto process_partial_block;
}
/* Process buffer with BLOCKSIZE bytes. Note that
BLOCKSIZE % 64 == 0
*/
sha256_process_block (buffer, BLOCKSIZE, &ctx);
}
process_partial_block:;
/* Process any remaining bytes. */
if (sum > 0)
sha256_process_bytes (buffer, sum, &ctx);
/* Construct result in desired memory. */
sha256_finish_ctx (&ctx, resblock);
free (buffer);
return 0;
return shaxxx_stream (stream, "sha256", resblock, SHA256_DIGEST_SIZE,
sha256_init_ctx, sha256_finish_ctx);
}
/* FIXME: Avoid code duplication */
int
sha224_stream (FILE *stream, void *resblock)
{
struct sha256_ctx ctx;
size_t sum;
char *buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
/* Initialize the computation context. */
sha224_init_ctx (&ctx);
/* Iterate over full file contents. */
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
while (1)
{
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
if (sum == BLOCKSIZE)
break;
if (n == 0)
{
/* Check for the error flag IFF N == 0, so that we don't
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (ferror (stream))
{
free (buffer);
return 1;
}
goto process_partial_block;
}
/* We've read at least one byte, so ignore errors. But always
check for EOF, since feof may be true even though N > 0.
Otherwise, we could end up calling fread after EOF. */
if (feof (stream))
goto process_partial_block;
}
/* Process buffer with BLOCKSIZE bytes. Note that
BLOCKSIZE % 64 == 0
*/
sha256_process_block (buffer, BLOCKSIZE, &ctx);
}
process_partial_block:;
/* Process any remaining bytes. */
if (sum > 0)
sha256_process_bytes (buffer, sum, &ctx);
/* Construct result in desired memory. */
sha224_finish_ctx (&ctx, resblock);
free (buffer);
return 0;
return shaxxx_stream (stream, "sha224", resblock, SHA224_DIGEST_SIZE,
sha224_init_ctx, sha224_finish_ctx);
}
#endif
#if ! HAVE_OPENSSL_SHA256
/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The
/* Compute SHA256 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */

View file

@ -89,8 +89,11 @@ extern void *sha256_buffer (const char *buffer, size_t len, void *resblock);
extern void *sha224_buffer (const char *buffer, size_t len, void *resblock);
# endif
/* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The
resulting message digest number will be written into the 32 (28) bytes
/* Compute SHA256 (SHA224) message digest for bytes read from STREAM.
STREAM is an open file stream. Regular files are handled more efficiently.
The contents of STREAM from its current position to its end will be read.
The case that the last operation on STREAM was an 'ungetc' is not supported.
The resulting message digest number will be written into the 32 (28) bytes
beginning at RESBLOCK. */
extern int sha256_stream (FILE *stream, void *resblock);
extern int sha224_stream (FILE *stream, void *resblock);

View file

@ -177,149 +177,104 @@ sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
}
#endif
/* Compute SHA512 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 64 bytes
beginning at RESBLOCK. */
#ifdef GL_COMPILE_CRYPTO_STREAM
#include "af_alg.h"
/* Compute message digest for bytes read from STREAM using algorithm ALG.
Write the message digest into RESBLOCK, which contains HASHLEN bytes.
The initial and finishing operations are INIT_CTX and FINISH_CTX.
Return zero if and only if successful. */
static int
shaxxx_stream (FILE *stream, char const *alg, void *resblock,
ssize_t hashlen, void (*init_ctx) (struct sha512_ctx *),
void *(*finish_ctx) (struct sha512_ctx *, void *))
{
switch (afalg_stream (stream, alg, resblock, hashlen))
{
case 0: return 0;
case -EIO: return 1;
}
char *buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
struct sha512_ctx ctx;
init_ctx (&ctx);
size_t sum;
/* Iterate over full file contents. */
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
while (1)
{
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
if (sum == BLOCKSIZE)
break;
if (n == 0)
{
/* Check for the error flag IFF N == 0, so that we don't
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (ferror (stream))
{
free (buffer);
return 1;
}
goto process_partial_block;
}
/* We've read at least one byte, so ignore errors. But always
check for EOF, since feof may be true even though N > 0.
Otherwise, we could end up calling fread after EOF. */
if (feof (stream))
goto process_partial_block;
}
/* Process buffer with BLOCKSIZE bytes. Note that
BLOCKSIZE % 128 == 0
*/
sha512_process_block (buffer, BLOCKSIZE, &ctx);
}
process_partial_block:;
/* Process any remaining bytes. */
if (sum > 0)
sha512_process_bytes (buffer, sum, &ctx);
/* Construct result in desired memory. */
finish_ctx (&ctx, resblock);
free (buffer);
return 0;
}
int
sha512_stream (FILE *stream, void *resblock)
{
struct sha512_ctx ctx;
size_t sum;
char *buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
/* Initialize the computation context. */
sha512_init_ctx (&ctx);
/* Iterate over full file contents. */
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
while (1)
{
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
if (sum == BLOCKSIZE)
break;
if (n == 0)
{
/* Check for the error flag IFF N == 0, so that we don't
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (ferror (stream))
{
free (buffer);
return 1;
}
goto process_partial_block;
}
/* We've read at least one byte, so ignore errors. But always
check for EOF, since feof may be true even though N > 0.
Otherwise, we could end up calling fread after EOF. */
if (feof (stream))
goto process_partial_block;
}
/* Process buffer with BLOCKSIZE bytes. Note that
BLOCKSIZE % 128 == 0
*/
sha512_process_block (buffer, BLOCKSIZE, &ctx);
}
process_partial_block:;
/* Process any remaining bytes. */
if (sum > 0)
sha512_process_bytes (buffer, sum, &ctx);
/* Construct result in desired memory. */
sha512_finish_ctx (&ctx, resblock);
free (buffer);
return 0;
return shaxxx_stream (stream, "sha512", resblock, SHA512_DIGEST_SIZE,
sha512_init_ctx, sha512_finish_ctx);
}
/* FIXME: Avoid code duplication */
int
sha384_stream (FILE *stream, void *resblock)
{
struct sha512_ctx ctx;
size_t sum;
char *buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
/* Initialize the computation context. */
sha384_init_ctx (&ctx);
/* Iterate over full file contents. */
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
while (1)
{
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
if (sum == BLOCKSIZE)
break;
if (n == 0)
{
/* Check for the error flag IFF N == 0, so that we don't
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (ferror (stream))
{
free (buffer);
return 1;
}
goto process_partial_block;
}
/* We've read at least one byte, so ignore errors. But always
check for EOF, since feof may be true even though N > 0.
Otherwise, we could end up calling fread after EOF. */
if (feof (stream))
goto process_partial_block;
}
/* Process buffer with BLOCKSIZE bytes. Note that
BLOCKSIZE % 128 == 0
*/
sha512_process_block (buffer, BLOCKSIZE, &ctx);
}
process_partial_block:;
/* Process any remaining bytes. */
if (sum > 0)
sha512_process_bytes (buffer, sum, &ctx);
/* Construct result in desired memory. */
sha384_finish_ctx (&ctx, resblock);
free (buffer);
return 0;
return shaxxx_stream (stream, "sha384", resblock, SHA384_DIGEST_SIZE,
sha384_init_ctx, sha384_finish_ctx);
}
#endif
#if ! HAVE_OPENSSL_SHA512
/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The

View file

@ -92,8 +92,11 @@ extern void *sha512_buffer (const char *buffer, size_t len, void *resblock);
extern void *sha384_buffer (const char *buffer, size_t len, void *resblock);
# endif
/* Compute SHA512 (SHA384) message digest for bytes read from STREAM. The
resulting message digest number will be written into the 64 (48) bytes
/* Compute SHA512 (SHA384) message digest for bytes read from STREAM.
STREAM is an open file stream. Regular files are handled more efficiently.
The contents of STREAM from its current position to its end will be read.
The case that the last operation on STREAM was an 'ungetc' is not supported.
The resulting message digest number will be written into the 64 (48) bytes
beginning at RESBLOCK. */
extern int sha512_stream (FILE *stream, void *resblock);
extern int sha384_stream (FILE *stream, void *resblock);

View file

@ -168,7 +168,7 @@ get_stat_birthtime (struct stat const *st _GL_UNUSED)
#elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
t.tv_sec = st->st_birthtime;
t.tv_nsec = st->st_birthtimensec;
#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#elif defined _WIN32 && ! defined __CYGWIN__
/* Native Windows platforms (but not Cygwin) put the "file creation
time" in st_ctime (!). See
<https://msdn.microsoft.com/en-us/library/14h5k7ff(VS.80).aspx>. */

View file

@ -60,25 +60,79 @@
# define _flags pub._flags
# define _r pub._r
# define _w pub._w
# elif defined __ANDROID__ /* Android */
/* Up to this commit from 2015-10-12
<https://android.googlesource.com/platform/bionic.git/+/f0141dfab10a4b332769d52fa76631a64741297a>
the innards of FILE were public, and fp_ub could be defined like for OpenBSD,
see <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/fileext.h>
and <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/local.h>.
After this commit, the innards of FILE are hidden. */
# define fp_ ((struct { unsigned char *_p; \
int _r; \
int _w; \
int _flags; \
int _file; \
struct { unsigned char *_base; size_t _size; } _bf; \
int _lbfsize; \
void *_cookie; \
void *_close; \
void *_read; \
void *_seek; \
void *_write; \
struct { unsigned char *_base; size_t _size; } _ext; \
unsigned char *_up; \
int _ur; \
unsigned char _ubuf[3]; \
unsigned char _nbuf[1]; \
struct { unsigned char *_base; size_t _size; } _lb; \
int _blksize; \
fpos_t _offset; \
/* More fields, not relevant here. */ \
} *) fp)
# else
# define fp_ fp
# endif
# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Minix 3, Android */
# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix /* NetBSD >= 1.5ZA, OpenBSD, Minix 3 */
/* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
and <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
and <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
and <https://github.com/Stichting-MINIX-Research-Foundation/minix/blob/master/lib/libc/stdio/fileext.h> */
struct __sfileext
{
struct __sbuf _ub; /* ungetc buffer */
/* More fields, not relevant here. */
};
# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin, Android */
# elif defined __ANDROID__ /* Android */
struct __sfileext
{
struct { unsigned char *_base; size_t _size; } _ub; /* ungetc buffer */
/* More fields, not relevant here. */
};
# define fp_ub ((struct __sfileext *) fp_->_ext._base)->_ub
# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin */
# define fp_ub fp_->_ub
# endif
# define HASUB(fp) (fp_ub._base != NULL)
# if defined __ANDROID__ /* Android */
/* Needed after this commit from 2016-01-25
<https://android.googlesource.com/platform/bionic.git/+/e70e0e9267d069bf56a5078c99307e08a7280de7> */
# ifndef __SEOF
# define __SLBF 1
# define __SNBF 2
# define __SRD 4
# define __SWR 8
# define __SRW 0x10
# define __SEOF 0x20
# define __SERR 0x40
# endif
# ifndef __SOFF
# define __SOFF 0x1000
# endif
# endif
#endif
@ -118,7 +172,7 @@
# define _flag __flag
# endif
#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* newer Windows with MSVC */
#elif defined _WIN32 && ! defined __CYGWIN__ /* newer Windows with MSVC */
/* <stdio.h> does not define the innards of FILE any more. */
# define WINDOWS_OPAQUE_FILE

View file

@ -122,7 +122,7 @@
it before we #define perror rpl_perror. */
/* But in any case avoid namespace pollution on glibc systems. */
#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
&& (defined _WIN32 && ! defined __CYGWIN__) \
&& ! defined __GLIBC__
# include <stdlib.h>
#endif
@ -133,7 +133,7 @@
it before we #define rename rpl_rename. */
/* But in any case avoid namespace pollution on glibc systems. */
#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
&& (defined _WIN32 && ! defined __CYGWIN__) \
&& ! defined __GLIBC__
# include <io.h>
#endif

View file

@ -54,7 +54,7 @@
#endif
/* Native Windows platforms declare mktemp() in <io.h>. */
#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
#if 0 && (defined _WIN32 && ! defined __CYGWIN__)
# include <io.h>
#endif
@ -90,7 +90,7 @@ struct random_data
# endif
#endif
#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
/* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
/* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */

View file

@ -57,13 +57,13 @@
/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
headers that may declare mkdir(). Native Windows platforms declare mkdir
in <io.h> and/or <direct.h>, not in <unistd.h>. */
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if defined _WIN32 && ! defined __CYGWIN__
# include <io.h> /* mingw32, mingw64 */
# include <direct.h> /* mingw64, MSVC 9 */
#endif
/* Native Windows platforms declare umask() in <io.h>. */
#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
#if 0 && (defined _WIN32 && ! defined __CYGWIN__)
# include <io.h>
#endif
@ -576,7 +576,7 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
Additionally, it declares _mkdir (and depending on compile flags, an
alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
which are included above. */
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# if defined _WIN32 && ! defined __CYGWIN__
# if !GNULIB_defined_rpl_mkdir
static int

View file

@ -20,6 +20,17 @@
#endif
@PRAGMA_COLUMNS@
#if defined _WIN32 && !defined __CYGWIN__ \
&& (defined __need_off_t || defined __need___off64_t \
|| defined __need_ssize_t || defined __need_time_t)
/* Special invocation convention inside mingw header files. */
#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
#else
/* Normal invocation convention. */
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
/* The include_next requires a split double-inclusion guard. */
@ -86,10 +97,10 @@ typedef unsigned long long int rpl_ino_t;
/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
/* But avoid namespace pollution on glibc systems. */
#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
&& ! defined __GLIBC__
#if (defined _WIN32 && ! defined __CYGWIN__) && ! defined __GLIBC__
# include <stddef.h>
#endif
#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
#endif /* __need_XXX */

View file

@ -87,7 +87,7 @@ timespec_cmp (struct timespec a, struct timespec b)
return 1;
/* Pacify gcc -Wstrict-overflow (bleeding-edge circa 2017-10-02). See:
http://lists.gnu.org/r/bug-gnulib/2017-10/msg00006.html */
https://lists.gnu.org/r/bug-gnulib/2017-10/msg00006.html */
assume (-1 <= a.tv_nsec && a.tv_nsec <= 2 * TIMESPEC_RESOLUTION);
assume (-1 <= b.tv_nsec && b.tv_nsec <= 2 * TIMESPEC_RESOLUTION);

View file

@ -61,7 +61,7 @@
/* But avoid namespace pollution on glibc systems. */
#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
|| ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) \
&& (defined _WIN32 && ! defined __CYGWIN__)) \
|| ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
&& defined __CYGWIN__)) \
&& ! defined __GLIBC__
@ -94,13 +94,13 @@
lseek(), read(), unlink(), write() in <io.h>. */
#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
|| defined GNULIB_POSIXCHECK) \
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
&& (defined _WIN32 && ! defined __CYGWIN__))
# include <io.h> /* mingw32, mingw64 */
# include <direct.h> /* mingw64, MSVC 9 */
#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
|| @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
|| defined GNULIB_POSIXCHECK) \
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
&& (defined _WIN32 && ! defined __CYGWIN__)
# include <io.h>
#endif
@ -1489,7 +1489,7 @@ _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
# else
# if !@HAVE_TRUNCATE@
# if !@HAVE_DECL_TRUNCATE@
_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length)
_GL_ARG_NONNULL ((1)));
# endif

View file

@ -39,8 +39,7 @@
GNU Emacs, which arranges for this in some other way and which
defines WIN32_LEAN_AND_MEAN itself. */
#if ((defined _WIN32 || defined __WIN32__) \
&& ! defined __CYGWIN__ && ! defined EMACS_CONFIGURATION)
#if defined _WIN32 && ! defined __CYGWIN__ && ! defined EMACS_CONFIGURATION
# define USE_SETFILETIME
# define WIN32_LEAN_AND_MEAN
# include <windows.h>

View file

@ -1,4 +1,4 @@
# c-strtod.m4 serial 15
# c-strtod.m4 serial 16
# Copyright (C) 2004-2006, 2009-2018 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@ -37,7 +37,34 @@ dnl Prerequisites of lib/c-strtod.c.
AC_DEFUN([gl_C_STRTOD],
[
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_CHECK_FUNCS([strtod_l])
AC_CHECK_HEADERS_ONCE([xlocale.h])
dnl We can't use AC_CHECK_FUNC here, because strtod_l() is defined as a
dnl static inline function when compiling for Android 7.1 or older.
AC_CACHE_CHECK([for strtod_l], [gl_cv_func_strtod_l],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdlib.h>
#include <locale.h>
#if HAVE_XLOCALE_H
# include <xlocale.h>
#endif
locale_t loc;
]],
[[char *end;
return strtod_l("0",&end,loc) < 0.0;
]])
],
[gl_cv_func_strtod_l=yes],
[gl_cv_func_strtod_l=no])
])
if test $gl_cv_func_strtod_l = yes; then
HAVE_STRTOD_L=1
else
HAVE_STRTOD_L=0
fi
AC_DEFINE_UNQUOTED([HAVE_STRTOD_L], [$HAVE_STRTOD_L],
[Define to 1 if the system has the 'strtod_l' function.])
])
dnl Prerequisites of lib/c-strtold.c.

View file

@ -1,4 +1,4 @@
# gnulib-common.m4 serial 38
# gnulib-common.m4 serial 39
dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -72,6 +72,13 @@ AC_DEFUN([gl_COMMON_BODY], [
#else
# define _GL_ATTRIBUTE_CONST /* empty */
#endif
/* The __malloc__ attribute was added in gcc 3. */
#if 3 <= __GNUC__
# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
#else
# define _GL_ATTRIBUTE_MALLOC /* empty */
#endif
])
dnl Preparation for running test programs:
dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not

View file

@ -58,10 +58,10 @@ AC_DEFUN([gl_EARLY],
# Code from module count-leading-zeros:
# Code from module count-one-bits:
# Code from module count-trailing-zeros:
# Code from module crypto/md5:
# Code from module crypto/sha1:
# Code from module crypto/sha256:
# Code from module crypto/sha512:
# Code from module crypto/md5-buffer:
# Code from module crypto/sha1-buffer:
# Code from module crypto/sha256-buffer:
# Code from module crypto/sha512-buffer:
# Code from module d-type:
# Code from module diffseq:
# Code from module dirent:

View file

@ -1,4 +1,4 @@
# inttypes.m4 serial 26
# inttypes.m4 serial 27
dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -147,6 +147,7 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV])
HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX])
HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX])
HAVE_IMAXDIV_T=1; AC_SUBST([HAVE_IMAXDIV_T])
REPLACE_STRTOIMAX=0; AC_SUBST([REPLACE_STRTOIMAX])
REPLACE_STRTOUMAX=0; AC_SUBST([REPLACE_STRTOUMAX])
INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX])

View file

@ -1,4 +1,4 @@
# serial 31
# serial 32
# Copyright (C) 1997-2001, 2003-2018 Free Software Foundation, Inc.
#
@ -53,6 +53,9 @@ AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
[gl_cv_func_lstat_dereferences_slashed_symlink=yes],
[gl_cv_func_lstat_dereferences_slashed_symlink=no],
[case "$host_os" in
linux-* | linux)
# Guess yes on Linux systems.
gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
*-gnu* | gnu*)
# Guess yes on glibc systems.
gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;

View file

@ -1,4 +1,4 @@
# nocrash.m4 serial 4
# nocrash.m4 serial 5
dnl Copyright (C) 2005, 2009-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -79,7 +79,7 @@ nocrash_init (void)
}
}
}
#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#elif defined _WIN32 && ! defined __CYGWIN__
/* Avoid a crash on native Windows. */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View file

@ -1,4 +1,4 @@
# pselect.m4 serial 6
# pselect.m4 serial 7
dnl Copyright (C) 2011-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -51,10 +51,12 @@ AC_DEFUN([gl_FUNC_PSELECT],
[gl_cv_func_pselect_detects_ebadf=no],
[
case "$host_os" in
# Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_pselect_detects_ebadf="guessing no" ;;
# Guess yes on Linux systems.
linux-* | linux) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
# Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_pselect_detects_ebadf="guessing no" ;;
esac
])
])

View file

@ -1,4 +1,4 @@
# readlink.m4 serial 13
# readlink.m4 serial 14
dnl Copyright (C) 2003, 2007, 2009-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -34,10 +34,12 @@ AC_DEFUN([gl_FUNC_READLINK],
return readlink ("conftest.lnk2/", buf, sizeof buf) != -1;]])],
[gl_cv_func_readlink_works=yes], [gl_cv_func_readlink_works=no],
[case "$host_os" in
# Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_readlink_works="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_readlink_works="guessing no" ;;
# Guess yes on Linux systems.
linux-* | linux) gl_cv_func_readlink_works="guessing yes" ;;
# Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_readlink_works="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_readlink_works="guessing no" ;;
esac
])
rm -f conftest.link conftest.lnk2])

View file

@ -1,4 +1,4 @@
# stdio_h.m4 serial 48
# stdio_h.m4 serial 49
dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -28,7 +28,7 @@ AC_DEFUN([gl_STDIO_H],
/* For non-mingw systems, compilation will trivially succeed.
For mingw, compilation will succeed for older mingw (system
printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */
#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) && \
#if (defined _WIN32 && ! defined __CYGWIN__) && \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1];
#endif

View file

@ -1,4 +1,4 @@
# serial 7
# serial 8
# See if we need to provide symlink replacement.
dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
@ -36,10 +36,12 @@ AC_DEFUN([gl_FUNC_SYMLINK],
]])],
[gl_cv_func_symlink_works=yes], [gl_cv_func_symlink_works=no],
[case "$host_os" in
# Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_symlink_works="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_symlink_works="guessing no" ;;
# Guess yes on Linux systems.
linux-* | linux) gl_cv_func_symlink_works="guessing yes" ;;
# Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_symlink_works="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_symlink_works="guessing no" ;;
esac
])
rm -f conftest.f conftest.link conftest.lnk2])

View file

@ -1,4 +1,4 @@
# unistd_h.m4 serial 71
# unistd_h.m4 serial 73
dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -37,7 +37,7 @@ AC_DEFUN([gl_UNISTD_H],
# include <fcntl.h>
# include <stdio.h>
# include <stdlib.h>
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# if defined _WIN32 && ! defined __CYGWIN__
# include <io.h>
# endif
#endif
@ -140,7 +140,6 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP])
HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK])
HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT])
HAVE_TRUNCATE=1; AC_SUBST([HAVE_TRUNCATE])
HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT])
HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP])
HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON])
@ -152,6 +151,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])
HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL])
HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME])
HAVE_DECL_TRUNCATE=1; AC_SUBST([HAVE_DECL_TRUNCATE])
HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R])
HAVE_OS_H=0; AC_SUBST([HAVE_OS_H])
HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H])

View file

@ -3,7 +3,7 @@ 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 serial 8
dnl serial 9
AC_DEFUN([gl_UTIMENS],
[
@ -31,10 +31,12 @@ AC_DEFUN([gl_UTIMENS],
[gl_cv_func_futimesat_works=yes],
[gl_cv_func_futimesat_works=no],
[case "$host_os" in
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_futimesat_works="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_futimesat_works="guessing no" ;;
# Guess yes on Linux systems.
linux-* | linux) gl_cv_func_futimesat_works="guessing yes" ;;
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_futimesat_works="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_futimesat_works="guessing no" ;;
esac
])
rm -f conftest.file])