diff options
370 files changed, 19704 insertions, 13326 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f3b27bd..2ecc2aa 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-12-16 Christian Biesinger <cbiesinger@google.com> + + * gdbsupport/common-defs.h: Remove workaround for a gnulib bug + (we no longer need to include time.h before pathmax.h) + 2019-12-15 Christian Biesinger <cbiesinger@google.com> * ada-exp.y (write_ambiguous_var): Update. diff --git a/gdb/gdbsupport/common-defs.h b/gdb/gdbsupport/common-defs.h index 3b10468..203bd89 100644 --- a/gdb/gdbsupport/common-defs.h +++ b/gdb/gdbsupport/common-defs.h @@ -97,11 +97,6 @@ #endif #include <errno.h> #include <alloca.h> -/* Must be included before pathmax.h to avoid build errors about localtime_r - and gmtime_r in gnulib on MinGW. This is a gnulib bug: - https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00022.html */ -#include <time.h> - #include "ansidecl.h" /* This is defined by ansidecl.h, but we prefer gnulib's version. On diff --git a/gnulib/ChangeLog b/gnulib/ChangeLog index f718009..f7c648e 100644 --- a/gnulib/ChangeLog +++ b/gnulib/ChangeLog @@ -1,3 +1,775 @@ +2019-12-16 Christian Biesinger <cbiesinger@google.com> + + * Makefile.am: Set MAKEOVERRIDES. + * Makefile.in: Regenerate. + * aclocal.m4: Regenerate. + * config.in: Regenerate. + * configure: Regenerate. + * import/Makefile.am: Update. + * import/Makefile.in: Regenerate. + * import/_Noreturn.h: New file. + * import/alloca.c (i00afunc): Update. + * import/alloca.in.h (if): Update. + * import/arg-nonnull.h: Rename from import/extra/snippet/arg-nonnull.h. + * import/arpa_inet.in.h (if): Update. + * import/assure.h: Update. + * import/at-func.c: Update. + * import/basename-lgpl.c: Update. + * import/canonicalize-lgpl.c (if): Update. + * import/c++defs.h: Rename from import/extra/snippet/c++defs.h. + * import/cdefs.h: New file. + * import/chdir-long.c: Update. + * import/chdir-long.h: Update. + * import/cloexec.c: Update. + * import/cloexec.h: Update. + * import/close.c: Update. + * import/closedir.c: Update. + * import/config.charset: Remove. + * import/dirent-private.h: Update. + * import/dirent.in.h: Update. + * import/dirfd.c: Update. + * import/dirname-lgpl.c: Update. + * import/dirname.h (base_name): Update. + * import/dosname.h (if): Update. + * import/dup-safer-flag.c: New file. + * import/dup-safer.c: Update. + * import/dup.c: Update. + * import/dup2.c (if): Update. + (dup2_nothrow): Update. + (ms_windows_dup2): Update. + * import/errno.in.h (if): Update. + (elif): Update. + * import/error.c (if): Update. + (strerror_r): Update. + (program_name): Update. + (error): Update. + (error_at_line): Update. + * import/error.h: Update. + * import/exitfail.c: Update. + * import/exitfail.h: Update. + * import/extra/config.rpath: Update. + * import/extra/snippet/_Noreturn.h: Remove. + * import/extra/update-copyright: Update. + * import/fchdir.c: Update. + * import/fcntl.c (rpl_fcntl): Update. + (INCL_DOS): Update. + (if): Update. + (rpl_fcntl_DUPFD): Update. + (rpl_fcntl_DUPFD_CLOEXEC): Update. + (klibc_fcntl): Update. + (fcntl): Update. + (have_dupfd_cloexec): Update. + * import/fcntl.in.h (if): Update. + (creat): Update. + (_GL_FUNCDECL_RPL): Update. + (_GL_CXXALIAS_RPL): Update. + (_GL_CXXALIAS_SYS): Update. + (_GL_CXXALIASWARN): Update. + (_GL_WARN_ON_USE): Update. + (O_CLOEXEC): Update. + (GNULIB_defined_O_CLOEXEC): Update. + * import/fd-hook.c: Update. + * import/fd-hook.h: Update. + * import/fd-safer-flag.c: New file. + * import/fd-safer.c: Update. + * import/fdopendir.c: Update. + * import/filename.h: Update. + * import/filenamecat-lgpl.c (longest_relative_suffix): Update. + (mfile_name_concat): Update. + * import/filenamecat.h: Update. + * import/flexmember.h: Update. + * import/float+.h: Update. + * import/float.c: Update. + * import/float.in.h (LDBL_MIN): Update. + * import/fnmatch.c (__builtin_expect): Update. + (FALLTHROUGH): Update. + * import/fnmatch.in.h (_FNMATCH_H): Update. + (_): Update. + (fnmatch): Update. + (_GL_FUNCDECL_RPL): Update. + (_GL_CXXALIAS_RPL): Update. + (_GL_FUNCDECL_SYS): Update. + (_GL_CXXALIAS_SYS): Update. + (_GL_CXXALIASWARN): Update. + (_GL_WARN_ON_USE): Update. + * import/fnmatch_loop.c (FCT): Update. + (EXT): Update. + * import/fpucw.h (GET_FPUCW): Update. + (SET_FPUCW): Update. + * import/frexp.c: Update. + * import/frexpl.c: Update. + * import/fstat.c (stat): Update. + (fstat): Update. + (WINDOWS_NATIVE): Update. + (fstat_nothrow): Update. + (WIN32_LEAN_AND_MEAN): Update. + * import/fstatat.c (normal_fstatat): Update. + (rpl_fstatat): Update. + * import/getcwd-lgpl.c (rpl_getcwd): Update. + * import/getcwd.c (getcwd_nothrow): Update. + (getcwd_system): Update. + (__getcwd): Update. + * import/getdtablesize.c (if): Update. + (_setmaxstdio): Update. + (_setmaxstdio_nothrow): Update. + (getdtablesize): Update. + * import/getlogin_r.c (if): Update. + (getlogin_r): Update. + * import/getprogname.c (getprogname): Update. + * import/getprogname.h: Update. + * import/gettext.h (if): Update. + * import/gettimeofday.c (WINDOWS_NATIVE): Update. + (localtime): Update. + (GetProcAddress): Update. + (gmtime): Update. + (void): Update. + (struct tm): Update. + (rpl_localtime): Update. + (initialize): Update. + (rpl_gmtime): Update. + (tzset): Update. + (rpl_tzset): Update. + * import/glob-libc.h (_Restrict_): Update. + (__size_t): Update. + (__need_size_t): Update. + (glob): Update. + (globfree): Update. + (__REDIRECT_NTH): Update. + (glob64): Update. + (globfree64): Update. + (glob_pattern_p): Update. + * import/glob.c (POSIX): Update. + (if): Update. + (__set_errno): Update. + (getpwnam_r): Update. + (__lstat64): Update. + (FLEXIBLE_ARRAY_MEMBER): Update. + (__glob_pattern_p): Update. + (GETPW_R_SIZE_MAX): Update. + (GET_LOGIN_NAME_MAX): Update. + (DT_UNKNOWN): Update. + (DT_DIR): Update. + (DT_LNK): Update. + (D_TYPE_TO_RESULT): Update. + (readdir_result_might_be_symlink): Update. + (readdir_result_might_be_dir): Update. + (readdir_result_type): Update. + (D_INO_TO_RESULT): Update. + (READDIR_RESULT_INITIALIZER): Update. + (attribute_hidden): Update. + (__attribute_noinline__): Update. + (__builtin_expect): Update. + (__glibc_unlikely): Update. + (__has_builtin): Update. + (__glob_pattern_type): Update. + (is_dir): Update. + (glob): Update. + (globfree): Update. + (libc_hidden_def): Update. + (DIRSEP_CHAR): Update. + (prefix_array): Update. + (weak_alias): Update. + (link_exists2_p): Update. + (link_exists_p): Update. + (glob_in_dir): Update. + (GLOBNAMES_MEMBERS): Update. + * import/glob.in.h (_GL_GLOB_H): Update. + (_): Update. + (__BEGIN_DECLS): Update. + (__END_DECLS): Update. + (_Restrict_): Update. + (__THROW): Update. + (__THROWNL): Update. + (__size_t): Update. + (__USE_GNU): Update. + (glob): Update. + (globfree): Update. + (glob_pattern_p): Update. + (__glob_pattern_p): Update. + (__GLOB_GNULIB): Update. + (_GL_FUNCDECL_RPL): Update. + (_GL_CXXALIAS_RPL): Update. + (_GL_FUNCDECL_SYS): Update. + (_GL_CXXALIAS_SYS): Update. + (_GL_WARN_ON_USE): Update. + * import/glob_internal.h: New file. + * import/glob_pattern_p.c: New file. + * import/globfree.c: New file. + * import/glthread/lock.c (glthread_rwlock_init_for_glibc): Update. + (glthread_rwlock_rdlock_multithreaded): Update. + (glthread_once_call): Update. + (glthread_once_multithreaded): Update. + (glthread_once_singlethreaded): Update. + (glthread_recursive_lock_init_multithreaded): Update. + (glthread_recursive_lock_lock_multithreaded): Update. + (glthread_recursive_lock_unlock_multithreaded): Update. + (glthread_recursive_lock_destroy_multithreaded): Update. + (glthread_lock_init_func): Update. + (glthread_lock_lock_func): Update. + (glthread_lock_unlock_func): Update. + (glthread_lock_destroy_func): Update. + (gl_waitqueue_t): Update. + (gl_waitqueue_init): Update. + (gl_waitqueue_add): Update. + (gl_waitqueue_notify_first): Update. + (gl_waitqueue_notify_all): Update. + (glthread_rwlock_init_func): Update. + (glthread_rwlock_rdlock_func): Update. + (glthread_rwlock_wrlock_func): Update. + (glthread_rwlock_unlock_func): Update. + (glthread_rwlock_destroy_func): Update. + (glthread_recursive_lock_init_func): Update. + (glthread_recursive_lock_lock_func): Update. + (glthread_recursive_lock_unlock_func): Update. + (glthread_recursive_lock_destroy_func): Update. + (glthread_once_func): Update. + * import/glthread/lock.h (c11_threads_in_use): Update. + (pthread_in_use): Update. + (gl_rwlock_initializer): Update. + (glthread_rwlock_init): Update. + (glthread_rwlock_init_for_glibc): Update. + (pth_in_use): Update. + (gl_lock_define): Update. + (gl_lock_define_initialized): Update. + (gl_lock_initializer): Update. + (glthread_lock_init): Update. + (glthread_lock_lock): Update. + (glthread_lock_unlock): Update. + (glthread_lock_destroy): Update. + (gl_rwlock_define): Update. + (gl_rwlock_define_initialized): Update. + (glthread_rwlock_rdlock): Update. + (glthread_rwlock_wrlock): Update. + (glthread_rwlock_unlock): Update. + (glthread_rwlock_destroy): Update. + (gl_recursive_lock_define): Update. + (gl_recursive_lock_define_initialized): Update. + (gl_recursive_lock_initializer): Update. + (glthread_recursive_lock_init): Update. + (glthread_recursive_lock_lock): Update. + (glthread_recursive_lock_unlock): Update. + (glthread_recursive_lock_destroy): Update. + (gl_once_define): Update. + (glthread_once): Update. + (glthread_once_multithreaded): Update. + (glthread_once_singlethreaded): Update. + (thread_in_use): Update. + (glthread_recursive_lock_init_multithreaded): Update. + (glthread_recursive_lock_lock_multithreaded): Update. + (glthread_recursive_lock_unlock_multithreaded): Update. + (glthread_recursive_lock_destroy_multithreaded): Update. + (glthread_lock_init_func): Update. + (glthread_lock_lock_func): Update. + (glthread_lock_unlock_func): Update. + (glthread_lock_destroy_func): Update. + (glthread_rwlock_init_func): Update. + (glthread_rwlock_rdlock_func): Update. + (glthread_rwlock_wrlock_func): Update. + (glthread_rwlock_unlock_func): Update. + (glthread_rwlock_destroy_func): Update. + (glthread_recursive_lock_init_func): Update. + (glthread_recursive_lock_lock_func): Update. + (glthread_recursive_lock_unlock_func): Update. + (glthread_recursive_lock_destroy_func): Update. + (glthread_once_func): Update. + * import/glthread/threadlib.c: Update. + * import/hard-locale.c: Update. + * import/hard-locale.h: Update. + * import/inet_ntop.c: Update. + * import/intprops.h (__has_builtin): Update. + (_GL_INT_CONVERT): Update. + (_GL_INT_NEGATE_CONVERT): Update. + (verify): Update. + (_GL_HAS_BUILTIN_OVERFLOW): Update. + (_GL_HAS_BUILTIN_ADD_OVERFLOW): Update. + (_GL_HAS_BUILTIN_OVERFLOW_P): Update. + (_GL_HAS_BUILTIN_MUL_OVERFLOW): Update. + (_GL_BINARY_OP_OVERFLOW): Update. + (INT_ADD_WRAPV): Update. + (INT_SUBTRACT_WRAPV): Update. + (INT_MULTIPLY_WRAPV): Update. + (_GL_INT_OP_WRAPV): Update. + (_GL_INT_OP_WRAPV_SMALLISH): Update. + (_GL_INT_OP_WRAPV_LONGISH): Update. + (_GL_INT_OP_CALC): Update. + (_GL_INT_OP_CALC1): Update. + (_GL_INT_OP_WRAPV_VIA_UNSIGNED): Update. + (_GL_INT_ADD_RANGE_OVERFLOW): Update. + (_GL_INT_SUBTRACT_RANGE_OVERFLOW): Update. + (_GL_INT_MULTIPLY_RANGE_OVERFLOW): Update. + * import/inttypes.in.h (if): Update. + * import/isnan.c: Update. + * import/isnand-nolibm.h: Update. + * import/isnand.c: Update. + * import/isnanl-nolibm.h: Update. + * import/isnanl.c: Update. + * import/itold.c: Update. + * import/libc-config.h: New file. + * import/limits.in.h (LLONG_MIN): Update. + (LLONG_MAX): Update. + (ULLONG_MAX): Update. + (WORD_BIT): Update. + (LONG_BIT): Update. + * import/localcharset.c (setlocale): Update. + (relocate): Update. + (O_NOFOLLOW): Update. + (ISSLASH): Update. + (DIRECTORY_SEPARATOR): Update. + (getc): Update. + (volatile): Update. + (get_charset_aliases): Update. + (struct table_entry): Update. + (alias_table_defined): Update. + (locale_table_defined): Update. + (locale_charset): Update. + (if): Update. + * import/localcharset.h: Update. + * import/localtime-buffer.c: New file. + * import/localtime-buffer.h: New file. + * import/lstat.c (rpl_lstat): Update. + * import/m4/00gnulib.m4: Update. + * import/m4/__inline.m4: New file. + * import/m4/absolute-header.m4: Update. + * import/m4/alloca.m4: Update. + * import/m4/arpa_inet_h.m4: Update. + * import/m4/builtin-expect.m4: New file. + * import/m4/canonicalize.m4: Update. + * import/m4/chdir-long.m4: Update. + * import/m4/close.m4: Update. + * import/m4/closedir.m4: Update. + * import/m4/codeset.m4: Update. + * import/m4/configmake.m4: Remove. + * import/m4/d-ino.m4: Update. + * import/m4/d-type.m4: Update. + * import/m4/dirent_h.m4: Update. + * import/m4/dirfd.m4: Update. + * import/m4/dirname.m4: Update. + * import/m4/double-slash-root.m4: Update. + * import/m4/dup.m4: Update. + * import/m4/dup2.m4: Update. + * import/m4/eealloc.m4: Update. + * import/m4/environ.m4: Update. + * import/m4/errno_h.m4: Update. + * import/m4/error.m4: Update. + * import/m4/exponentd.m4: Update. + * import/m4/exponentl.m4: Update. + * import/m4/extensions.m4: Update. + * import/m4/extern-inline.m4: Update. + * import/m4/fchdir.m4: Update. + * import/m4/fcntl-o.m4: Update. + * import/m4/fcntl.m4: Update. + * import/m4/fcntl_h.m4: Update. + * import/m4/fdopendir.m4: Update. + * import/m4/filenamecat.m4: Update. + * import/m4/flexmember.m4: Update. + * import/m4/float_h.m4: Update. + * import/m4/fnmatch.m4: Update. + * import/m4/fnmatch_h.m4: New file. + * import/m4/fpieee.m4: Update. + * import/m4/frexp.m4: Update. + * import/m4/frexpl.m4: Update. + * import/m4/fstat.m4: Update. + * import/m4/fstatat.m4: Update. + * import/m4/getcwd-abort-bug.m4: Update. + * import/m4/getcwd-path-max.m4: Update. + * import/m4/getcwd.m4: Update. + * import/m4/getdtablesize.m4: Update. + * import/m4/getlogin.m4: New file. + * import/m4/getlogin_r.m4: Update. + * import/m4/getpagesize.m4: New file. + * import/m4/getprogname.m4: Update. + * import/m4/gettimeofday.m4: Update. + * import/m4/glibc21.m4: Remove. + * import/m4/glob.m4: Update. + * import/m4/glob_h.m4: New file. + * import/m4/gnulib-cache.m4: Update. + * import/m4/gnulib-common.m4: Update. + * import/m4/gnulib-comp.m4: Update. + * import/m4/gnulib-tool.m4: Update. + * import/m4/hard-locale.m4: Remove. + * import/m4/host-cpu-c-abi.m4: New file. + * import/m4/include_next.m4: Update. + * import/m4/inet_ntop.m4: Update. + * import/m4/inttypes-pri.m4: Update. + * import/m4/inttypes.m4: Update. + * import/m4/isnand.m4: Update. + * import/m4/isnanl.m4: Update. + * import/m4/largefile.m4: Update. + * import/m4/lib-ld.m4: Update. + * import/m4/lib-link.m4: Update. + * import/m4/lib-prefix.m4: Update. + * import/m4/limits-h.m4: Update. + * import/m4/localcharset.m4: Update. + * import/m4/locale-fr.m4: Update. + * import/m4/locale-ja.m4: Update. + * import/m4/locale-zh.m4: Update. + * import/m4/localtime-buffer.m4: New file. + * import/m4/lock.m4: Update. + * import/m4/longlong.m4: Update. + * import/m4/lstat.m4: Update. + * import/m4/malloc.m4: Update. + * import/m4/malloca.m4: Update. + * import/m4/math_h.m4: Update. + * import/m4/mbrtowc.m4: Update. + * import/m4/mbsinit.m4: Update. + * import/m4/mbsrtowcs.m4: Update. + * import/m4/mbstate_t.m4: Update. + * import/m4/memchr.m4: Update. + * import/m4/memmem.m4: Update. + * import/m4/mempcpy.m4: Update. + * import/m4/memrchr.m4: Update. + * import/m4/mkdir.m4: Update. + * import/m4/mkdtemp.m4: Update. + * import/m4/mkostemp.m4: Update. + * import/m4/mmap-anon.m4: Update. + * import/m4/mode_t.m4: Update. + * import/m4/msvc-inval.m4: Update. + * import/m4/msvc-nothrow.m4: Update. + * import/m4/multiarch.m4: Update. + * import/m4/netinet_in_h.m4: Update. + * import/m4/nocrash.m4: Update. + * import/m4/off_t.m4: Update. + * import/m4/onceonly.m4: Remove. + * import/m4/open-cloexec.m4: New file. + * import/m4/open-slash.m4: New file. + * import/m4/open.m4: Update. + * import/m4/openat.m4: Update. + * import/m4/opendir.m4: Update. + * import/m4/pathmax.m4: Update. + * import/m4/pthread_rwlock_rdlock.m4: New file. + * import/m4/rawmemchr.m4: Update. + * import/m4/readdir.m4: Update. + * import/m4/readlink.m4: Update. + * import/m4/realloc.m4: Update. + * import/m4/rename.m4: Update. + * import/m4/rewinddir.m4: Update. + * import/m4/rmdir.m4: Update. + * import/m4/save-cwd.m4: Update. + * import/m4/secure_getenv.m4: Remove. + * import/m4/setenv.m4: Update. + * import/m4/signal_h.m4: Update. + * import/m4/socklen.m4: Update. + * import/m4/sockpfaf.m4: Update. + * import/m4/ssize_t.m4: Update. + * import/m4/stat-time.m4: New file. + * import/m4/stat.m4: Update. + * import/m4/std-gnu11.m4: New file. + * import/m4/stdalign.m4: Update. + * import/m4/stdbool.m4: Update. + * import/m4/stddef_h.m4: Update. + * import/m4/stdint.m4: Update. + * import/m4/stdio_h.m4: Update. + * import/m4/stdlib_h.m4: Update. + * import/m4/strchrnul.m4: Update. + * import/m4/strdup.m4: Update. + * import/m4/strerror.m4: Update. + * import/m4/strerror_r.m4: Update. + * import/m4/string_h.m4: Update. + * import/m4/strstr.m4: Update. + * import/m4/strtok_r.m4: Update. + * import/m4/sys_socket_h.m4: Update. + * import/m4/sys_stat_h.m4: Update. + * import/m4/sys_time_h.m4: Update. + * import/m4/sys_types_h.m4: Update. + * import/m4/sys_uio_h.m4: Update. + * import/m4/tempname.m4: Update. + * import/m4/threadlib.m4: Update. + * import/m4/time_h.m4: Update. + * import/m4/time_r.m4: Update. + * import/m4/unistd-safer.m4: Update. + * import/m4/unistd_h.m4: Update. + * import/m4/warn-on-use.m4: Update. + * import/m4/wchar_h.m4: Update. + * import/m4/wchar_t.m4: Update. + * import/m4/wctype_h.m4: Update. + * import/m4/wint_t.m4: Update. + * import/malloc.c: Update. + * import/malloc/scratch_buffer.h: New file. + * import/malloc/scratch_buffer_grow.c: New file. + * import/malloc/scratch_buffer_grow_preserve.c: New file. + * import/malloc/scratch_buffer_set_array_size.c: New file. + * import/malloca.c (MAGIC_NUMBER): Update. + (MAGIC_SIZE): Update. + (struct preliminary_header): Update. + (HEADER_SIZE): Update. + (union header): Update. + (verify): Update. + (HASH_TABLE_SIZE): Update. + (freea): Update. + * import/malloca.h (malloca): Update. + (nmalloca): Update. + * import/malloca.valgrind: Remove. + * import/math.in.h (_GL_MATH_CXX_REAL_FLOATING_DECL_2): Update. + (func): Update. + (rpl_func): Update. + (f): Update. + (d): Update. + (l): Update. + (_GL_WARN_ON_USE): Update. + (_GL_WARN_ON_USE_ATTRIBUTE): Update. + (FP_ILOGB0): Update. + (FP_ILOGBNAN): Update. + (acosf): Update. + (_GL_FUNCDECL_RPL): Update. + (_GL_CXXALIAS_RPL): Update. + (asinf): Update. + (atanf): Update. + (atan2f): Update. + (cosf): Update. + (coshf): Update. + (expf): Update. + (expl): Update. + (expm1l): Update. + (ilogbl): Update. + (rintl): Update. + (sinf): Update. + (sinhf): Update. + (sqrtf): Update. + (tanf): Update. + (tanhf): Update. + (isfinite): Update. + (isinf): Update. + (isnan): Update. + (GNULIB_defined_signbit): Update. + (signbit): Update. + * import/mbrtowc.c (FALLTHROUGH): Update. + (locale_enc): Update. + (locale_enc_cached): Update. + (gl_lock_define_initialized): Update. + (mbrtowc): Update. + * import/mbsinit.c (if): Update. + (mbsinit): Update. + * import/mbsrtowcs-impl.h: Update. + * import/mbsrtowcs-state.c: Update. + * import/mbsrtowcs.c: Update. + * import/memchr.c: Update. + * import/memchr.valgrind: Update. + * import/memmem.c (__builtin_expect): Update. + * import/mempcpy.c: Update. + * import/memrchr.c (__memrchr): Update. + * import/mkdir.c (if): Update. + * import/mkdtemp.c: Update. + * import/mkostemp.c: Update. + * import/msvc-inval.c: Update. + * import/msvc-inval.h: Update. + * import/msvc-nothrow.c: Update. + * import/msvc-nothrow.h (if): Update. + * import/netinet_in.in.h: Update. + * import/open.c (open): Update. + (if): Update. + * import/openat-die.c: Update. + * import/openat-priv.h: Update. + * import/openat-proc.c: Update. + * import/openat.c (rpl_openat): Update. + * import/openat.h: Update. + * import/opendir.c: Update. + * import/pathmax.h (if): Update. + * import/pipe-safer.c: Update. + * import/rawmemchr.c: Update. + * import/rawmemchr.valgrind: Update. + * import/readdir.c (readdir): Update. + * import/readlink.c: Update. + * import/realloc.c: Update. + * import/ref-add.sin: Remove. + * import/ref-del.sin: Remove. + * import/rename.c (if): Update. + * import/rewinddir.c: Update. + * import/rmdir.c: Update. + * import/same-inode.h (SAME_INODE): Update. + * import/save-cwd.c (save_cwd): Update. + * import/save-cwd.h: Update. + * import/scratch_buffer.h: New file. + * import/secure_getenv.c: Remove. + * import/setenv.c: Update. + * import/signal.in.h: Update. + * import/stat-time.c: New file. + * import/stat-time.h: New file. + * import/stat-w32.c: New file. + * import/stat-w32.h: New file. + * import/stat.c (if): Update. + (stat): Update. + (REPLACE_FUNC_STAT_DIR): Update. + (WINDOWS_NATIVE): Update. + (WIN32_LEAN_AND_MEAN): Update. + (is_unc_root): Update. + (rpl_stat): Update. + * import/stdalign.in.h (elif): Update. + * import/stdbool.in.h: Update. + * import/stddef.in.h (_GL_STDDEF_ALIGNAS): Update. + (max_align_t): Update. + (GNULIB_defined_max_align_t): Update. + * import/stdint.in.h (WINT_MIN): Update. + (WINT_MAX): Update. + (_STDINT_MIN): Update. + (_STDINT_UNSIGNED_MIN): Update. + (_STDINT_SIGNED_MIN): Update. + (PTRDIFF_MIN): Update. + (SIG_ATOMIC_MIN): Update. + (WCHAR_MIN): Update. + * import/stdio.in.h (if): Update. + * import/stdlib.in.h (if): Update. + (_GL_WARN_ON_USE): Update. + (_GL_FUNCDECL_SYS): Update. + (random): Update. + (_GL_FUNCDECL_RPL): Update. + (_GL_CXXALIAS_RPL): Update. + (srandom): Update. + (initstate): Update. + (setstate): Update. + (_GL_CXXALIAS_SYS): Update. + (_GL_CXXALIASWARN): Update. + (GNULIB_defined_strtod_function): Update. + (strtold): Update. + (GNULIB_defined_strtold_function): Update. + * import/str-two-way.h: Update. + * import/strchrnul.c: Update. + * import/strchrnul.valgrind: Update. + * import/strdup.c: Update. + * import/streq.h: Update. + * import/strerror-override.c: Update. + * import/strerror-override.h: Update. + * import/strerror.c (strerror): Update. + * import/strerror_r.c (safe_copy): Update. + * import/string.in.h (_GL_FUNCDECL_SYS): Update. + (_GL_CXXALIAS_SYS): Update. + (_GL_CXXALIASWARN): Update. + (_GL_WARN_ON_USE): Update. + * import/stripslash.c: Update. + * import/strnlen1.c: Update. + * import/strnlen1.h: Update. + * import/strstr.c (__builtin_expect): Update. + * import/strtok_r.c: Update. + * import/sys_socket.in.h (CMSG_SPACE): Update. + (CMSG_LEN): Update. + (struct sockaddr_storage): Update. + (SO_REUSEPORT): Update. + (_GL_WARN_ON_USE): Update. + * import/sys_stat.in.h (if): Update. + (stat): Update. + (struct stat): Update. + (st_atime): Update. + (st_mtime): Update. + (st_ctime): Update. + (_GL_WINDOWS_STAT_TIMESPEC): Update. + (GNULIB_defined_struct_stat): Update. + (_S_IFBLK): Update. + (_S_IFLNK): Update. + (_S_IFSOCK): Update. + (fstat): Update. + (fstatat): Update. + (lstat): Update. + (stat64): Update. + (_stat64): Update. + (_stat32i64): Update. + (_stati64): Update. + (_stat32): Update. + (_stat64i32): Update. + * import/sys_time.in.h: Update. + * import/sys_types.in.h (dev_t): Update. + (GNULIB_defined_dev_t): Update. + (ino_t): Update. + (GNULIB_defined_ino_t): Update. + (_GL_WINDOWS_STAT_INODES): Update. + (if): Update. + * import/sys_uio.in.h: Update. + * import/tempname.c (__secure_getenv): Update. + (try_nocreate): Update. + * import/tempname.h: Update. + * import/time.in.h (tzset): Update. + (_GL_FUNCDECL_RPL): Update. + (_GL_CXXALIAS_RPL): Update. + (_GL_FUNCDECL_SYS): Update. + (_GL_CXXALIAS_SYS): Update. + (_GL_CXXALIASWARN): Update. + (ctime): Update. + (strftime): Update. + * import/time_r.c: Update. + * import/unistd--.h: Update. + * import/unistd-safer.h: Update. + * import/unistd.in.h (if): Update. + (elif): Update. + (__need_getopt): Update. + (access): Update. + (_GL_FUNCDECL_RPL): Update. + (_GL_CXXALIAS_RPL): Update. + (_GL_CXXALIAS_SYS): Update. + (_GL_CXXALIASWARN): Update. + (_GL_WARN_ON_USE): Update. + (_GL_FUNCDECL_SYS): Update. + (__declspec): Update. + (_GL_WARN_ON_USE_ATTRIBUTE): Update. + (faccessat): Update. + (getpass): Update. + (truncate): Update. + * import/unsetenv.c: Update. + * import/verify.h (if): Update. + (_GL_HAVE__STATIC_ASSERT): Update. + (_GL_HAVE_STATIC_ASSERT): Update. + (_GL_HAVE__STATIC_ASSERT1): Update. + (_GL_HAVE_STATIC_ASSERT1): Update. + (_GL_VERIFY): Update. + (_Static_assert): Update. + (_GL_HAS_BUILTIN_TRAP): Update. + (_GL_HAS_BUILTIN_UNREACHABLE): Update. + (verify_true): Update. + (verify): Update. + (__has_builtin): Update. + (elif): Update. + (assume): Update. + * import/warn-on-use.h: Rename from import/extra/snippet/warn-on-use.h. + * import/wchar.in.h (if): Update. + (wcsftime): Update. + (_GL_FUNCDECL_RPL): Update. + (_GL_CXXALIAS_RPL): Update. + (_GL_FUNCDECL_SYS): Update. + (_GL_CXXALIAS_SYS): Update. + (_GL_CXXALIASWARN): Update. + (_GL_WARN_ON_USE): Update. + * import/wctype.in.h (rpl_iswalnum): Update. + (rpl_iswalpha): Update. + (rpl_iswblank): Update. + (rpl_iswcntrl): Update. + (rpl_iswdigit): Update. + (rpl_iswgraph): Update. + (rpl_iswlower): Update. + (rpl_iswprint): Update. + (rpl_iswpunct): Update. + (rpl_iswspace): Update. + (rpl_iswupper): Update. + (rpl_iswxdigit): Update. + (rpl_towlower): Update. + (rpl_towupper): Update. + (iswalnum): Update. + (iswalpha): Update. + (iswblank): Update. + (iswcntrl): Update. + (iswdigit): Update. + (iswgraph): Update. + (iswlower): Update. + (iswprint): Update. + (iswpunct): Update. + (iswspace): Update. + (iswupper): Update. + (iswxdigit): Update. + (towlower): Update. + (towupper): Update. + * import/windows-initguard.h: New file. + * import/windows-mutex.c: New file. + * import/windows-mutex.h: New file. + * import/windows-once.c: New file. + * import/windows-once.h: New file. + * import/windows-recmutex.c: New file. + * import/windows-recmutex.h: New file. + * import/windows-rwlock.c: New file. + * import/windows-rwlock.h: New file. + * import/xalloc-oversized.h: New file. + * patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch: Remove. + * patches/0002-mkostemp-mkostemps-Fix-compilation-error-in-C-mode-o.patch: Remove. + * patches/0003-Fix-glob-c-Coverity-issues.patch: Remove. + * update-gnulib.sh: Update to latest gnulib and don't apply patches + anymore. Also updates the patch -p flag to the current directory structure in + case patches are needed again in the future. + 2019-11-15 Tom Tromey <tromey@adacore.com> * aclocal.m4, configure, Makefile.in, import/Makefile.in: diff --git a/gnulib/Makefile.am b/gnulib/Makefile.am index 8dab5ec..e0ac6d8 100644 --- a/gnulib/Makefile.am +++ b/gnulib/Makefile.am @@ -15,4 +15,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +# The toplevel makefile overrides $(CC) (in EXTRA_HOST_FLAGS) by setting +# it to whatever CC was in the toplevel configure. This breaks in Gnulib with +# older GCCs, because Gnulib's configure uses this variable to store the +# standard-setting switch (e.g. -std=gnu99/-std=gnu11). To fix this, we just +# set MAKEOVERRIDES to empty here so that import/ uses the right $(CC). +# +# This problem is visible with compilers that don't use C99 by default, such +# as GCC 4.8.5 (Centos 7). +MAKEOVERRIDES = + SUBDIRS = import diff --git a/gnulib/Makefile.in b/gnulib/Makefile.in index dbe79ed..0ca4335 100644 --- a/gnulib/Makefile.in +++ b/gnulib/Makefile.in @@ -89,6 +89,7 @@ am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c @@ -112,15 +113,16 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/plugins.m4 \ $(top_srcdir)/import/m4/00gnulib.m4 \ + $(top_srcdir)/import/m4/__inline.m4 \ $(top_srcdir)/import/m4/absolute-header.m4 \ $(top_srcdir)/import/m4/alloca.m4 \ $(top_srcdir)/import/m4/arpa_inet_h.m4 \ + $(top_srcdir)/import/m4/builtin-expect.m4 \ $(top_srcdir)/import/m4/canonicalize.m4 \ $(top_srcdir)/import/m4/chdir-long.m4 \ $(top_srcdir)/import/m4/close.m4 \ $(top_srcdir)/import/m4/closedir.m4 \ $(top_srcdir)/import/m4/codeset.m4 \ - $(top_srcdir)/import/m4/configmake.m4 \ $(top_srcdir)/import/m4/d-ino.m4 \ $(top_srcdir)/import/m4/d-type.m4 \ $(top_srcdir)/import/m4/dirent_h.m4 \ @@ -145,6 +147,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/flexmember.m4 \ $(top_srcdir)/import/m4/float_h.m4 \ $(top_srcdir)/import/m4/fnmatch.m4 \ + $(top_srcdir)/import/m4/fnmatch_h.m4 \ $(top_srcdir)/import/m4/fpieee.m4 \ $(top_srcdir)/import/m4/frexp.m4 \ $(top_srcdir)/import/m4/frexpl.m4 \ @@ -154,14 +157,15 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/getcwd-path-max.m4 \ $(top_srcdir)/import/m4/getcwd.m4 \ $(top_srcdir)/import/m4/getdtablesize.m4 \ + $(top_srcdir)/import/m4/getlogin.m4 \ $(top_srcdir)/import/m4/getlogin_r.m4 \ + $(top_srcdir)/import/m4/getpagesize.m4 \ $(top_srcdir)/import/m4/getprogname.m4 \ $(top_srcdir)/import/m4/gettimeofday.m4 \ - $(top_srcdir)/import/m4/glibc21.m4 \ $(top_srcdir)/import/m4/glob.m4 \ + $(top_srcdir)/import/m4/glob_h.m4 \ $(top_srcdir)/import/m4/gnulib-common.m4 \ $(top_srcdir)/import/m4/gnulib-comp.m4 \ - $(top_srcdir)/import/m4/hard-locale.m4 \ $(top_srcdir)/import/m4/include_next.m4 \ $(top_srcdir)/import/m4/inet_ntop.m4 \ $(top_srcdir)/import/m4/inttypes-pri.m4 \ @@ -169,14 +173,12 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/isnand.m4 \ $(top_srcdir)/import/m4/isnanl.m4 \ $(top_srcdir)/import/m4/largefile.m4 \ - $(top_srcdir)/import/m4/lib-ld.m4 \ - $(top_srcdir)/import/m4/lib-link.m4 \ - $(top_srcdir)/import/m4/lib-prefix.m4 \ $(top_srcdir)/import/m4/limits-h.m4 \ $(top_srcdir)/import/m4/localcharset.m4 \ $(top_srcdir)/import/m4/locale-fr.m4 \ $(top_srcdir)/import/m4/locale-ja.m4 \ $(top_srcdir)/import/m4/locale-zh.m4 \ + $(top_srcdir)/import/m4/localtime-buffer.m4 \ $(top_srcdir)/import/m4/lock.m4 \ $(top_srcdir)/import/m4/longlong.m4 \ $(top_srcdir)/import/m4/lstat.m4 \ @@ -202,11 +204,13 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/netinet_in_h.m4 \ $(top_srcdir)/import/m4/nocrash.m4 \ $(top_srcdir)/import/m4/off_t.m4 \ - $(top_srcdir)/import/m4/onceonly.m4 \ + $(top_srcdir)/import/m4/open-cloexec.m4 \ + $(top_srcdir)/import/m4/open-slash.m4 \ $(top_srcdir)/import/m4/open.m4 \ $(top_srcdir)/import/m4/openat.m4 \ $(top_srcdir)/import/m4/opendir.m4 \ $(top_srcdir)/import/m4/pathmax.m4 \ + $(top_srcdir)/import/m4/pthread_rwlock_rdlock.m4 \ $(top_srcdir)/import/m4/rawmemchr.m4 \ $(top_srcdir)/import/m4/readdir.m4 \ $(top_srcdir)/import/m4/readlink.m4 \ @@ -215,13 +219,14 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/rewinddir.m4 \ $(top_srcdir)/import/m4/rmdir.m4 \ $(top_srcdir)/import/m4/save-cwd.m4 \ - $(top_srcdir)/import/m4/secure_getenv.m4 \ $(top_srcdir)/import/m4/setenv.m4 \ $(top_srcdir)/import/m4/signal_h.m4 \ $(top_srcdir)/import/m4/socklen.m4 \ $(top_srcdir)/import/m4/sockpfaf.m4 \ $(top_srcdir)/import/m4/ssize_t.m4 \ + $(top_srcdir)/import/m4/stat-time.m4 \ $(top_srcdir)/import/m4/stat.m4 \ + $(top_srcdir)/import/m4/std-gnu11.m4 \ $(top_srcdir)/import/m4/stdalign.m4 \ $(top_srcdir)/import/m4/stdbool.m4 \ $(top_srcdir)/import/m4/stddef_h.m4 \ @@ -317,7 +322,6 @@ ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) -pkglibexecdir = @pkglibexecdir@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ @@ -359,10 +363,10 @@ FLOAT_H = @FLOAT_H@ FNMATCH_H = @FNMATCH_H@ FREXPL_LIBM = @FREXPL_LIBM@ FREXP_LIBM = @FREXP_LIBM@ -GLIBC21 = @GLIBC21@ GLOB_H = @GLOB_H@ GNULIB_ACCEPT = @GNULIB_ACCEPT@ GNULIB_ACCEPT4 = @GNULIB_ACCEPT4@ +GNULIB_ACCESS = @GNULIB_ACCESS@ GNULIB_ACOSF = @GNULIB_ACOSF@ GNULIB_ACOSL = @GNULIB_ACOSL@ GNULIB_ALPHASORT = @GNULIB_ALPHASORT@ @@ -390,9 +394,12 @@ GNULIB_CONNECT = @GNULIB_CONNECT@ GNULIB_COPYSIGN = @GNULIB_COPYSIGN@ GNULIB_COPYSIGNF = @GNULIB_COPYSIGNF@ GNULIB_COPYSIGNL = @GNULIB_COPYSIGNL@ +GNULIB_COPY_FILE_RANGE = @GNULIB_COPY_FILE_RANGE@ GNULIB_COSF = @GNULIB_COSF@ GNULIB_COSHF = @GNULIB_COSHF@ GNULIB_COSL = @GNULIB_COSL@ +GNULIB_CREAT = @GNULIB_CREAT@ +GNULIB_CTIME = @GNULIB_CTIME@ GNULIB_DIRFD = @GNULIB_DIRFD@ GNULIB_DPRINTF = @GNULIB_DPRINTF@ GNULIB_DUP = @GNULIB_DUP@ @@ -405,6 +412,7 @@ GNULIB_EXP2F = @GNULIB_EXP2F@ GNULIB_EXP2L = @GNULIB_EXP2L@ GNULIB_EXPF = @GNULIB_EXPF@ GNULIB_EXPL = @GNULIB_EXPL@ +GNULIB_EXPLICIT_BZERO = @GNULIB_EXPLICIT_BZERO@ GNULIB_EXPM1 = @GNULIB_EXPM1@ GNULIB_EXPM1F = @GNULIB_EXPM1F@ GNULIB_EXPM1L = @GNULIB_EXPM1L@ @@ -433,6 +441,7 @@ GNULIB_FMAL = @GNULIB_FMAL@ GNULIB_FMOD = @GNULIB_FMOD@ GNULIB_FMODF = @GNULIB_FMODF@ GNULIB_FMODL = @GNULIB_FMODL@ +GNULIB_FNMATCH = @GNULIB_FNMATCH@ GNULIB_FOPEN = @GNULIB_FOPEN@ GNULIB_FPRINTF = @GNULIB_FPRINTF@ GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ @@ -468,12 +477,14 @@ GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ +GNULIB_GETPASS = @GNULIB_GETPASS@ GNULIB_GETPEERNAME = @GNULIB_GETPEERNAME@ GNULIB_GETSOCKNAME = @GNULIB_GETSOCKNAME@ GNULIB_GETSOCKOPT = @GNULIB_GETSOCKOPT@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_GLOB = @GNULIB_GLOB@ GNULIB_GRANTPT = @GNULIB_GRANTPT@ GNULIB_GROUP_MEMBER = @GNULIB_GROUP_MEMBER@ GNULIB_HYPOT = @GNULIB_HYPOT@ @@ -502,6 +513,7 @@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LISTEN = @GNULIB_LISTEN@ +GNULIB_LOCALTIME = @GNULIB_LOCALTIME@ GNULIB_LOG = @GNULIB_LOG@ GNULIB_LOG10 = @GNULIB_LOG10@ GNULIB_LOG10F = @GNULIB_LOG10F@ @@ -565,6 +577,8 @@ GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@ GNULIB_OPEN = @GNULIB_OPEN@ GNULIB_OPENAT = @GNULIB_OPENAT@ GNULIB_OPENDIR = @GNULIB_OPENDIR@ +GNULIB_OVERRIDES_STRUCT_STAT = @GNULIB_OVERRIDES_STRUCT_STAT@ +GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ GNULIB_PCLOSE = @GNULIB_PCLOSE@ GNULIB_PERROR = @GNULIB_PERROR@ GNULIB_PIPE = @GNULIB_PIPE@ @@ -592,6 +606,7 @@ GNULIB_READ = @GNULIB_READ@ GNULIB_READDIR = @GNULIB_READDIR@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ +GNULIB_REALLOCARRAY = @GNULIB_REALLOCARRAY@ GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ GNULIB_REALPATH = @GNULIB_REALPATH@ GNULIB_RECV = @GNULIB_RECV@ @@ -643,6 +658,7 @@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ GNULIB_STRERROR_R = @GNULIB_STRERROR_R@ +GNULIB_STRFTIME = @GNULIB_STRFTIME@ GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ @@ -654,6 +670,7 @@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOD = @GNULIB_STRTOD@ GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLD = @GNULIB_STRTOLD@ GNULIB_STRTOLL = @GNULIB_STRTOLL@ GNULIB_STRTOULL = @GNULIB_STRTOULL@ GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ @@ -670,9 +687,11 @@ GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ GNULIB_TMPFILE = @GNULIB_TMPFILE@ GNULIB_TOWCTRANS = @GNULIB_TOWCTRANS@ GNULIB_TRUNC = @GNULIB_TRUNC@ +GNULIB_TRUNCATE = @GNULIB_TRUNCATE@ GNULIB_TRUNCF = @GNULIB_TRUNCF@ GNULIB_TRUNCL = @GNULIB_TRUNCL@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ +GNULIB_TZSET = @GNULIB_TZSET@ GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ GNULIB_UNLINK = @GNULIB_UNLINK@ @@ -702,6 +721,7 @@ GNULIB_WCSCOLL = @GNULIB_WCSCOLL@ GNULIB_WCSCPY = @GNULIB_WCSCPY@ GNULIB_WCSCSPN = @GNULIB_WCSCSPN@ GNULIB_WCSDUP = @GNULIB_WCSDUP@ +GNULIB_WCSFTIME = @GNULIB_WCSFTIME@ GNULIB_WCSLEN = @GNULIB_WCSLEN@ GNULIB_WCSNCASECMP = @GNULIB_WCSNCASECMP@ GNULIB_WCSNCAT = @GNULIB_WCSNCAT@ @@ -733,6 +753,7 @@ GREP = @GREP@ HAVE_ACCEPT4 = @HAVE_ACCEPT4@ HAVE_ACOSF = @HAVE_ACOSF@ HAVE_ACOSL = @HAVE_ACOSL@ +HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ARPA_INET_H = @HAVE_ARPA_INET_H@ HAVE_ASINF = @HAVE_ASINF@ @@ -751,9 +772,11 @@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ HAVE_COPYSIGN = @HAVE_COPYSIGN@ HAVE_COPYSIGNL = @HAVE_COPYSIGNL@ +HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@ HAVE_COSF = @HAVE_COSF@ HAVE_COSHF = @HAVE_COSHF@ HAVE_COSL = @HAVE_COSL@ +HAVE_CRTDEFS_H = @HAVE_CRTDEFS_H@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ @@ -783,6 +806,7 @@ HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ @@ -790,6 +814,7 @@ HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@ HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@ +HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ HAVE_DECL_LOG10L = @HAVE_DECL_LOG10L@ @@ -809,6 +834,7 @@ HAVE_DECL_ROUNDF = @HAVE_DECL_ROUNDF@ HAVE_DECL_ROUNDL = @HAVE_DECL_ROUNDL@ HAVE_DECL_SETENV = @HAVE_DECL_SETENV@ HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ +HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ @@ -822,6 +848,7 @@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ +HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@ HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@ @@ -836,6 +863,7 @@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_EXPF = @HAVE_EXPF@ HAVE_EXPL = @HAVE_EXPL@ +HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ HAVE_EXPM1 = @HAVE_EXPM1@ HAVE_EXPM1F = @HAVE_EXPM1F@ HAVE_FABSF = @HAVE_FABSF@ @@ -855,6 +883,8 @@ HAVE_FMAF = @HAVE_FMAF@ HAVE_FMAL = @HAVE_FMAL@ HAVE_FMODF = @HAVE_FMODF@ HAVE_FMODL = @HAVE_FMODL@ +HAVE_FNMATCH = @HAVE_FNMATCH@ +HAVE_FNMATCH_H = @HAVE_FNMATCH_H@ HAVE_FREXPF = @HAVE_FREXPF@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FSTATAT = @HAVE_FSTATAT@ @@ -867,8 +897,12 @@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETPASS = @HAVE_GETPASS@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@ +HAVE_GLOB = @HAVE_GLOB@ +HAVE_GLOB_H = @HAVE_GLOB_H@ +HAVE_GLOB_PATTERN_P = @HAVE_GLOB_PATTERN_P@ HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ HAVE_HYPOTF = @HAVE_HYPOTF@ @@ -876,6 +910,8 @@ HAVE_HYPOTL = @HAVE_HYPOTL@ HAVE_ILOGB = @HAVE_ILOGB@ HAVE_ILOGBF = @HAVE_ILOGBF@ HAVE_ILOGBL = @HAVE_ILOGBL@ +HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@ +HAVE_INITSTATE = @HAVE_INITSTATE@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISNAND = @HAVE_ISNAND@ HAVE_ISNANF = @HAVE_ISNANF@ @@ -905,6 +941,7 @@ HAVE_MBSINIT = @HAVE_MBSINIT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ +HAVE_MBTOWC = @HAVE_MBTOWC@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDIRAT = @HAVE_MKDIRAT@ @@ -946,6 +983,7 @@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READDIR = @HAVE_READDIR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ +HAVE_REALLOCARRAY = @HAVE_REALLOCARRAY@ HAVE_REALPATH = @HAVE_REALPATH@ HAVE_REMAINDER = @HAVE_REMAINDER@ HAVE_REMAINDERF = @HAVE_REMAINDERF@ @@ -960,6 +998,7 @@ HAVE_SCANDIR = @HAVE_SCANDIR@ HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ +HAVE_SETSTATE = @HAVE_SETSTATE@ HAVE_SIGACTION = @HAVE_SIGACTION@ HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@ HAVE_SIGINFO_T = @HAVE_SIGINFO_T@ @@ -982,6 +1021,7 @@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLD = @HAVE_STRTOLD@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ @@ -993,7 +1033,6 @@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ -HAVE_SYS_CDEFS_H = @HAVE_SYS_CDEFS_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ @@ -1007,6 +1046,7 @@ HAVE_TANL = @HAVE_TANL@ HAVE_TIMEGM = @HAVE_TIMEGM@ HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ +HAVE_TZSET = @HAVE_TZSET@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ @@ -1028,6 +1068,7 @@ HAVE_WCSCOLL = @HAVE_WCSCOLL@ HAVE_WCSCPY = @HAVE_WCSCPY@ HAVE_WCSCSPN = @HAVE_WCSCSPN@ HAVE_WCSDUP = @HAVE_WCSDUP@ +HAVE_WCSFTIME = @HAVE_WCSFTIME@ HAVE_WCSLEN = @HAVE_WCSLEN@ HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@ HAVE_WCSNCAT = @HAVE_WCSNCAT@ @@ -1072,10 +1113,11 @@ LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@ LIBINTL = @LIBINTL@ LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ -LIBPTH = @LIBPTH@ -LIBPTH_PREFIX = @LIBPTH_PREFIX@ +LIBPMULTITHREAD = @LIBPMULTITHREAD@ +LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTHREAD = @LIBTHREAD@ +LIB_GETLOGIN = @LIB_GETLOGIN@ LIMITS_H = @LIMITS_H@ LN_S = @LN_S@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ @@ -1086,7 +1128,6 @@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBINTL = @LTLIBINTL@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ -LTLIBPTH = @LTLIBPTH@ LTLIBTHREAD = @LTLIBTHREAD@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -1098,6 +1139,8 @@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ +NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H = @NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H@ +NEXT_AS_FIRST_DIRECTIVE_GLOB_H = @NEXT_AS_FIRST_DIRECTIVE_GLOB_H@ NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@ NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_MATH_H = @NEXT_AS_FIRST_DIRECTIVE_MATH_H@ @@ -1121,6 +1164,8 @@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ +NEXT_FNMATCH_H = @NEXT_FNMATCH_H@ +NEXT_GLOB_H = @NEXT_GLOB_H@ NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_MATH_H = @NEXT_MATH_H@ @@ -1156,6 +1201,11 @@ PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ +REPLACE_ACCESS = @REPLACE_ACCESS@ +REPLACE_ACOSF = @REPLACE_ACOSF@ +REPLACE_ASINF = @REPLACE_ASINF@ +REPLACE_ATAN2F = @REPLACE_ATAN2F@ +REPLACE_ATANF = @REPLACE_ATANF@ REPLACE_BTOWC = @REPLACE_BTOWC@ REPLACE_CALLOC = @REPLACE_CALLOC@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ @@ -1167,15 +1217,23 @@ REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@ +REPLACE_COSF = @REPLACE_COSF@ +REPLACE_COSHF = @REPLACE_COSHF@ +REPLACE_CREAT = @REPLACE_CREAT@ +REPLACE_CTIME = @REPLACE_CTIME@ REPLACE_DIRFD = @REPLACE_DIRFD@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_EXP2 = @REPLACE_EXP2@ REPLACE_EXP2L = @REPLACE_EXP2L@ +REPLACE_EXPF = @REPLACE_EXPF@ +REPLACE_EXPL = @REPLACE_EXPL@ REPLACE_EXPM1 = @REPLACE_EXPM1@ REPLACE_EXPM1F = @REPLACE_EXPM1F@ +REPLACE_EXPM1L = @REPLACE_EXPM1L@ REPLACE_FABSL = @REPLACE_FABSL@ +REPLACE_FACCESSAT = @REPLACE_FACCESSAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCNTL = @REPLACE_FCNTL@ @@ -1191,6 +1249,7 @@ REPLACE_FMAL = @REPLACE_FMAL@ REPLACE_FMOD = @REPLACE_FMOD@ REPLACE_FMODF = @REPLACE_FMODF@ REPLACE_FMODL = @REPLACE_FMODL@ +REPLACE_FNMATCH = @REPLACE_FNMATCH@ REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ REPLACE_FPURGE = @REPLACE_FPURGE@ @@ -1214,7 +1273,10 @@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETLINE = @REPLACE_GETLINE@ REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_GETPASS = @REPLACE_GETPASS@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_GLOB = @REPLACE_GLOB@ +REPLACE_GLOB_PATTERN_P = @REPLACE_GLOB_PATTERN_P@ REPLACE_GMTIME = @REPLACE_GMTIME@ REPLACE_HUGE_VAL = @REPLACE_HUGE_VAL@ REPLACE_HYPOT = @REPLACE_HYPOT@ @@ -1222,8 +1284,10 @@ REPLACE_HYPOTF = @REPLACE_HYPOTF@ REPLACE_HYPOTL = @REPLACE_HYPOTL@ REPLACE_ILOGB = @REPLACE_ILOGB@ REPLACE_ILOGBF = @REPLACE_ILOGBF@ +REPLACE_ILOGBL = @REPLACE_ILOGBL@ REPLACE_INET_NTOP = @REPLACE_INET_NTOP@ REPLACE_INET_PTON = @REPLACE_INET_PTON@ +REPLACE_INITSTATE = @REPLACE_INITSTATE@ REPLACE_ISATTY = @REPLACE_ISATTY@ REPLACE_ISFINITE = @REPLACE_ISFINITE@ REPLACE_ISINF = @REPLACE_ISINF@ @@ -1290,6 +1354,7 @@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RAISE = @REPLACE_RAISE@ +REPLACE_RANDOM = @REPLACE_RANDOM@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ @@ -1302,16 +1367,21 @@ REPLACE_REMAINDERL = @REPLACE_REMAINDERL@ REPLACE_REMOVE = @REPLACE_REMOVE@ REPLACE_RENAME = @REPLACE_RENAME@ REPLACE_RENAMEAT = @REPLACE_RENAMEAT@ +REPLACE_RINTL = @REPLACE_RINTL@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_ROUND = @REPLACE_ROUND@ REPLACE_ROUNDF = @REPLACE_ROUNDF@ REPLACE_ROUNDL = @REPLACE_ROUNDL@ REPLACE_SETENV = @REPLACE_SETENV@ +REPLACE_SETSTATE = @REPLACE_SETSTATE@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ +REPLACE_SINF = @REPLACE_SINF@ +REPLACE_SINHF = @REPLACE_SINHF@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_SQRTF = @REPLACE_SQRTF@ REPLACE_SQRTL = @REPLACE_SQRTL@ REPLACE_STAT = @REPLACE_STAT@ REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@ @@ -1322,6 +1392,7 @@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ +REPLACE_STRFTIME = @REPLACE_STRFTIME@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ @@ -1330,17 +1401,22 @@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ +REPLACE_STRTOLD = @REPLACE_STRTOLD@ REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ +REPLACE_TANF = @REPLACE_TANF@ +REPLACE_TANHF = @REPLACE_TANHF@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TOWLOWER = @REPLACE_TOWLOWER@ REPLACE_TRUNC = @REPLACE_TRUNC@ +REPLACE_TRUNCATE = @REPLACE_TRUNCATE@ REPLACE_TRUNCF = @REPLACE_TRUNCF@ REPLACE_TRUNCL = @REPLACE_TRUNCL@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ +REPLACE_TZSET = @REPLACE_TZSET@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_UNSETENV = @REPLACE_UNSETENV@ @@ -1353,8 +1429,10 @@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ +REPLACE_WCSFTIME = @REPLACE_WCSFTIME@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ +REPLACE_WCSTOK = @REPLACE_WCSTOK@ REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@ REPLACE_WCTOB = @REPLACE_WCTOB@ REPLACE_WCTOMB = @REPLACE_WCTOMB@ @@ -1381,12 +1459,13 @@ VERSION = @VERSION@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ +WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@ +WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ @@ -1421,7 +1500,6 @@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ -lispdir = @lispdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ @@ -1431,7 +1509,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -1444,6 +1521,16 @@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + +# The toplevel makefile overrides $(CC) (in EXTRA_HOST_FLAGS) by setting +# it to whatever CC was in the toplevel configure. This breaks in Gnulib with +# older GCCs, because Gnulib's configure uses this variable to store the +# standard-setting switch (e.g. -std=gnu99/-std=gnu11). To fix this, we just +# set MAKEOVERRIDES to empty here so that import/ uses the right $(CC). +# +# This problem is visible with compilers that don't use C99 by default, such +# as GCC 4.8.5 (Centos 7). +MAKEOVERRIDES = SUBDIRS = import all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive diff --git a/gnulib/aclocal.m4 b/gnulib/aclocal.m4 index 5234e94..ed1f4f7 100644 --- a/gnulib/aclocal.m4 +++ b/gnulib/aclocal.m4 @@ -56,66 +56,6 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) -# Copyright (C) 2011-2017 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. - -# AM_PROG_AR([ACT-IF-FAIL]) -# ------------------------- -# Try to determine the archiver interface, and trigger the ar-lib wrapper -# if it is needed. If the detection of archiver interface fails, run -# ACT-IF-FAIL (default is to abort configure with a proper error message). -AC_DEFUN([AM_PROG_AR], -[AC_BEFORE([$0], [LT_INIT])dnl -AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl -AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([ar-lib])dnl -AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) -: ${AR=ar} - -AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], - [AC_LANG_PUSH([C]) - am_cv_ar_interface=ar - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], - [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([am_ar_try]) - if test "$ac_status" -eq 0; then - am_cv_ar_interface=ar - else - am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([am_ar_try]) - if test "$ac_status" -eq 0; then - am_cv_ar_interface=lib - else - am_cv_ar_interface=unknown - fi - fi - rm -f conftest.lib libconftest.a - ]) - AC_LANG_POP([C])]) - -case $am_cv_ar_interface in -ar) - ;; -lib) - # Microsoft lib, so override with the ar-lib wrapper script. - # FIXME: It is wrong to rewrite AR. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__AR in this case, - # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something - # similar. - AR="$am_aux_dir/ar-lib $AR" - ;; -unknown) - m4_default([$1], - [AC_MSG_ERROR([could not determine $AR interface])]) - ;; -esac -AC_SUBST([AR])dnl -]) - # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2017 Free Software Foundation, Inc. @@ -918,23 +858,6 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2017 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. - -# AM_RUN_LOG(COMMAND) -# ------------------- -# Run COMMAND, save the exit status in ac_status, and log it. -# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) -AC_DEFUN([AM_RUN_LOG], -[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD - ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - (exit $ac_status); }]) - # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2017 Free Software Foundation, Inc. @@ -1262,15 +1185,16 @@ m4_include([../config/lead-dot.m4]) m4_include([../config/override.m4]) m4_include([../config/plugins.m4]) m4_include([import/m4/00gnulib.m4]) +m4_include([import/m4/__inline.m4]) m4_include([import/m4/absolute-header.m4]) m4_include([import/m4/alloca.m4]) m4_include([import/m4/arpa_inet_h.m4]) +m4_include([import/m4/builtin-expect.m4]) m4_include([import/m4/canonicalize.m4]) m4_include([import/m4/chdir-long.m4]) m4_include([import/m4/close.m4]) m4_include([import/m4/closedir.m4]) m4_include([import/m4/codeset.m4]) -m4_include([import/m4/configmake.m4]) m4_include([import/m4/d-ino.m4]) m4_include([import/m4/d-type.m4]) m4_include([import/m4/dirent_h.m4]) @@ -1296,6 +1220,7 @@ m4_include([import/m4/filenamecat.m4]) m4_include([import/m4/flexmember.m4]) m4_include([import/m4/float_h.m4]) m4_include([import/m4/fnmatch.m4]) +m4_include([import/m4/fnmatch_h.m4]) m4_include([import/m4/fpieee.m4]) m4_include([import/m4/frexp.m4]) m4_include([import/m4/frexpl.m4]) @@ -1305,14 +1230,15 @@ m4_include([import/m4/getcwd-abort-bug.m4]) m4_include([import/m4/getcwd-path-max.m4]) m4_include([import/m4/getcwd.m4]) m4_include([import/m4/getdtablesize.m4]) +m4_include([import/m4/getlogin.m4]) m4_include([import/m4/getlogin_r.m4]) +m4_include([import/m4/getpagesize.m4]) m4_include([import/m4/getprogname.m4]) m4_include([import/m4/gettimeofday.m4]) -m4_include([import/m4/glibc21.m4]) m4_include([import/m4/glob.m4]) +m4_include([import/m4/glob_h.m4]) m4_include([import/m4/gnulib-common.m4]) m4_include([import/m4/gnulib-comp.m4]) -m4_include([import/m4/hard-locale.m4]) m4_include([import/m4/include_next.m4]) m4_include([import/m4/inet_ntop.m4]) m4_include([import/m4/inttypes-pri.m4]) @@ -1320,14 +1246,12 @@ m4_include([import/m4/inttypes.m4]) m4_include([import/m4/isnand.m4]) m4_include([import/m4/isnanl.m4]) m4_include([import/m4/largefile.m4]) -m4_include([import/m4/lib-ld.m4]) -m4_include([import/m4/lib-link.m4]) -m4_include([import/m4/lib-prefix.m4]) m4_include([import/m4/limits-h.m4]) m4_include([import/m4/localcharset.m4]) m4_include([import/m4/locale-fr.m4]) m4_include([import/m4/locale-ja.m4]) m4_include([import/m4/locale-zh.m4]) +m4_include([import/m4/localtime-buffer.m4]) m4_include([import/m4/lock.m4]) m4_include([import/m4/longlong.m4]) m4_include([import/m4/lstat.m4]) @@ -1353,11 +1277,13 @@ m4_include([import/m4/multiarch.m4]) m4_include([import/m4/netinet_in_h.m4]) m4_include([import/m4/nocrash.m4]) m4_include([import/m4/off_t.m4]) -m4_include([import/m4/onceonly.m4]) +m4_include([import/m4/open-cloexec.m4]) +m4_include([import/m4/open-slash.m4]) m4_include([import/m4/open.m4]) m4_include([import/m4/openat.m4]) m4_include([import/m4/opendir.m4]) m4_include([import/m4/pathmax.m4]) +m4_include([import/m4/pthread_rwlock_rdlock.m4]) m4_include([import/m4/rawmemchr.m4]) m4_include([import/m4/readdir.m4]) m4_include([import/m4/readlink.m4]) @@ -1366,13 +1292,14 @@ m4_include([import/m4/rename.m4]) m4_include([import/m4/rewinddir.m4]) m4_include([import/m4/rmdir.m4]) m4_include([import/m4/save-cwd.m4]) -m4_include([import/m4/secure_getenv.m4]) m4_include([import/m4/setenv.m4]) m4_include([import/m4/signal_h.m4]) m4_include([import/m4/socklen.m4]) m4_include([import/m4/sockpfaf.m4]) m4_include([import/m4/ssize_t.m4]) +m4_include([import/m4/stat-time.m4]) m4_include([import/m4/stat.m4]) +m4_include([import/m4/std-gnu11.m4]) m4_include([import/m4/stdalign.m4]) m4_include([import/m4/stdbool.m4]) m4_include([import/m4/stddef_h.m4]) diff --git a/gnulib/config.in b/gnulib/config.in index 068b540..a961067 100644 --- a/gnulib/config.in +++ b/gnulib/config.in @@ -56,12 +56,10 @@ #undef FCNTL_DUPFD_BUGGY /* Define to nothing if C supports flexible array members, and to 1 if it does - not. That way, with a declaration like 'struct s { int n; double + not. That way, with a declaration like 'struct s { int n; short d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99 - compilers. When computing the size of such an object, don't use 'sizeof - (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)' - instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with - MSVC and with C++ compilers. */ + compilers. Use 'FLEXSIZEOF (struct s, d, N * sizeof (short))' to calculate + the size in bytes of such a struct containing an N-element array. */ #undef FLEXIBLE_ARRAY_MEMBER /* Define to 1 if mkdir mistakenly creates a directory given with a trailing @@ -88,6 +86,14 @@ #undef GNULIB_FDOPENDIR /* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module fd-safer-flag shall be considered present. */ +#undef GNULIB_FD_SAFER_FLAG + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module fnmatch-gnu shall be considered present. */ +#undef GNULIB_FNMATCH_GNU + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module fscanf shall be considered present. */ #undef GNULIB_FSCANF @@ -104,6 +110,10 @@ #undef GNULIB_MKOSTEMP /* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module msvc-nothrow shall be considered present. */ +#undef GNULIB_MSVC_NOTHROW + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module openat shall be considered present. */ #undef GNULIB_OPENAT @@ -119,6 +129,10 @@ whether the gnulib module strerror shall be considered present. */ #undef GNULIB_STRERROR +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module strerror_r-posix shall be considered present. */ +#undef GNULIB_STRERROR_R_POSIX + /* Define to 1 when the gnulib module canonicalize_file_name should be tested. */ #undef GNULIB_TEST_CANONICALIZE_FILE_NAME @@ -156,6 +170,9 @@ /* Define to 1 when the gnulib module fdopendir should be tested. */ #undef GNULIB_TEST_FDOPENDIR +/* Define to 1 when the gnulib module fnmatch should be tested. */ +#undef GNULIB_TEST_FNMATCH + /* Define to 1 when the gnulib module frexp should be tested. */ #undef GNULIB_TEST_FREXP @@ -180,6 +197,9 @@ /* Define to 1 when the gnulib module gettimeofday should be tested. */ #undef GNULIB_TEST_GETTIMEOFDAY +/* Define to 1 when the gnulib module glob should be tested. */ +#undef GNULIB_TEST_GLOB + /* Define to 1 when the gnulib module lstat should be tested. */ #undef GNULIB_TEST_LSTAT @@ -246,9 +266,6 @@ /* Define to 1 when the gnulib module rmdir should be tested. */ #undef GNULIB_TEST_RMDIR -/* Define to 1 when the gnulib module secure_getenv should be tested. */ -#undef GNULIB_TEST_SECURE_GETENV - /* Define to 1 when the gnulib module setenv should be tested. */ #undef GNULIB_TEST_SETENV @@ -293,18 +310,21 @@ /* Define to 1 if you have the <bp-sym.h> header file. */ #undef HAVE_BP_SYM_H -/* Define to 1 if you have the 'btowc' function. */ +/* Define to 1 if you have the `btowc' function. */ #undef HAVE_BTOWC -/* Define to 1 if you have the 'canonicalize_file_name' function. */ +/* Define to 1 if you have the `canonicalize_file_name' function. */ #undef HAVE_CANONICALIZE_FILE_NAME -/* Define to 1 if you have the 'catgets' function. */ +/* Define to 1 if you have the `catgets' function. */ #undef HAVE_CATGETS /* Define to 1 if you have the `closedir' function. */ #undef HAVE_CLOSEDIR +/* Define to 1 if you have the <crtdefs.h> header file. */ +#undef HAVE_CRTDEFS_H + /* Define to 1 if you have the declaration of `alarm', and to 0 if you don't. */ #undef HAVE_DECL_ALARM @@ -325,10 +345,6 @@ */ #undef HAVE_DECL_GETCWD -/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you - don't. */ -#undef HAVE_DECL_GETC_UNLOCKED - /* Define to 1 if you have the declaration of `getdtablesize', and to 0 if you don't. */ #undef HAVE_DECL_GETDTABLESIZE @@ -389,13 +405,10 @@ */ #undef HAVE_DECL_STRDUP -/* Define to 1, since you should have the declaration of strerror_r. */ +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ #undef HAVE_DECL_STRERROR_R -/* Define to 1 if you have the declaration of 'strerror_r' in the system - include files, or to 0 otherwise. */ -#undef HAVE_DECL_STRERROR_R_ORIG - /* Define to 1 if you have the declaration of `strtok_r', and to 0 if you don't. */ #undef HAVE_DECL_STRTOK_R @@ -427,70 +440,70 @@ /* Define if you have the declaration of environ. */ #undef HAVE_ENVIRON_DECL -/* Define to 1 if you have the 'fchdir' function. */ +/* Define to 1 if you have the `fchdir' function. */ #undef HAVE_FCHDIR -/* Define to 1 if you have the 'fcntl' function. */ +/* Define to 1 if you have the `fcntl' function. */ #undef HAVE_FCNTL -/* Define to 1 if you have the 'fdopendir' function. */ +/* Define to 1 if you have the `fdopendir' function. */ #undef HAVE_FDOPENDIR /* Define to 1 if you have the <features.h> header file. */ #undef HAVE_FEATURES_H +/* Define to 1 if you have the `fnmatch' function. */ +#undef HAVE_FNMATCH + +/* Define to 1 if you have the <fnmatch.h> header file. */ +#undef HAVE_FNMATCH_H + /* Define if the frexp() function is available and works. */ #undef HAVE_FREXP /* Define if the frexpl() function is available. */ #undef HAVE_FREXPL -/* Define to 1 if you have the 'fstatat' function. */ +/* Define to 1 if you have the `fstatat' function. */ #undef HAVE_FSTATAT -/* Define to 1 if you have the 'getcwd' function. */ +/* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* Define to 1 if getcwd works, but with shorter paths than is generally tested with the replacement. */ #undef HAVE_GETCWD_SHORTER -/* Define to 1 if you have the 'getdtablesize' function. */ +/* Define to 1 if you have the `getdtablesize' function. */ #undef HAVE_GETDTABLESIZE -/* Define to 1 if you have the 'getegid' function. */ -#undef HAVE_GETEGID - -/* Define to 1 if you have the 'geteuid' function. */ -#undef HAVE_GETEUID - -/* Define to 1 if you have the 'getexecname' function. */ +/* Define to 1 if you have the `getexecname' function. */ #undef HAVE_GETEXECNAME -/* Define to 1 if you have the 'getgid' function. */ -#undef HAVE_GETGID - -/* Define to 1 if you have the 'getlogin_r' function. */ +/* Define to 1 if you have the `getlogin_r' function. */ #undef HAVE_GETLOGIN_R -/* Define to 1 if you have the `getpagesize' function. */ +/* Define to 1 if the system has the 'getpagesize' function. */ #undef HAVE_GETPAGESIZE -/* Define to 1 if you have the 'getprogname' function. */ +/* Define to 1 if you have the `getprogname' function. */ #undef HAVE_GETPROGNAME -/* Define to 1 if you have the 'getpwnam_r' function. */ +/* Define to 1 if you have the `getpwnam_r' function. */ #undef HAVE_GETPWNAM_R -/* Define to 1 if you have the 'gettimeofday' function. */ +/* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY -/* Define to 1 if you have the 'getuid' function. */ -#undef HAVE_GETUID +/* Define to 1 if you have the `glob' function. */ +#undef HAVE_GLOB /* Define to 1 if you have the <glob.h> header file. */ #undef HAVE_GLOB_H +/* Define to 1 if you have the `glob_pattern_p' function. */ +#undef HAVE_GLOB_PATTERN_P + /* Define to 1 if you have the `inet_ntop' function. */ #undef HAVE_INET_NTOP @@ -503,7 +516,7 @@ /* Define to 1 if <sys/socket.h> defines AF_INET6. */ #undef HAVE_IPV6 -/* Define to 1 if you have the 'isblank' function. */ +/* Define to 1 if you have the `isblank' function. */ #undef HAVE_ISBLANK /* Define if the isnan(double) function is available in libc. */ @@ -512,13 +525,10 @@ /* Define if the isnan(long double) function is available in libc. */ #undef HAVE_ISNANL_IN_LIBC -/* Define to 1 if you have the `issetugid' function. */ -#undef HAVE_ISSETUGID - -/* Define to 1 if you have the 'iswcntrl' function. */ +/* Define to 1 if you have the `iswcntrl' function. */ #undef HAVE_ISWCNTRL -/* Define to 1 if you have the 'iswctype' function. */ +/* Define to 1 if you have the `iswctype' function. */ #undef HAVE_ISWCTYPE /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ @@ -527,16 +537,16 @@ /* Define to 1 if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H -/* Define to 1 if you have the 'link' function. */ +/* Define to 1 if you have the `link' function. */ #undef HAVE_LINK -/* Define to 1 if you have the 'localtime_r' function. */ +/* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R /* Define to 1 if the system has the type 'long long int'. */ #undef HAVE_LONG_LONG_INT -/* Define to 1 if you have the 'lstat' function. */ +/* Define to 1 if you have the `lstat' function. */ #undef HAVE_LSTAT /* Define if the 'malloc' function is POSIX compliant. */ @@ -549,13 +559,13 @@ /* Define to 1 if you have the <math.h> header file. */ #undef HAVE_MATH_H -/* Define to 1 if you have the 'mbrtowc' function. */ +/* Define to 1 if you have the `mbrtowc' function. */ #undef HAVE_MBRTOWC -/* Define to 1 if you have the 'mbsinit' function. */ +/* Define to 1 if you have the `mbsinit' function. */ #undef HAVE_MBSINIT -/* Define to 1 if you have the 'mbsrtowcs' function. */ +/* Define to 1 if you have the `mbsrtowcs' function. */ #undef HAVE_MBSRTOWCS /* Define to 1 if <wchar.h> declares mbstate_t. */ @@ -580,10 +590,10 @@ /* Define to 1 if you have the `mkdtemp' function. */ #undef HAVE_MKDTEMP -/* Define to 1 if you have the 'mkostemp' function. */ +/* Define to 1 if you have the `mkostemp' function. */ #undef HAVE_MKOSTEMP -/* Define to 1 if you have the 'mprotect' function. */ +/* Define to 1 if you have the `mprotect' function. */ #undef HAVE_MPROTECT /* Define to 1 on MSVC platforms that have the "invalid parameter handler" @@ -596,7 +606,7 @@ /* Define to 1 if you have the <netinet/in.h> header file. */ #undef HAVE_NETINET_IN_H -/* Define to 1 if you have the 'openat' function. */ +/* Define to 1 if you have the `openat' function. */ #undef HAVE_OPENAT /* Define to 1 if you have the `opendir' function. */ @@ -606,902 +616,35 @@ setting errno to ERANGE, ENAMETOOLONG, or ENOENT. */ #undef HAVE_PARTLY_WORKING_GETCWD -/* Define to 1 if you have the 'pipe' function. */ +/* Define to 1 if you have the `pipe' function. */ #undef HAVE_PIPE +/* Define if you have the <pthread.h> header and the POSIX threads API. */ +#undef HAVE_PTHREAD_API + /* Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE. */ #undef HAVE_PTHREAD_MUTEX_RECURSIVE /* Define if the POSIX multithreading library has read/write locks. */ #undef HAVE_PTHREAD_RWLOCK +/* Define if the 'pthread_rwlock_rdlock' function prefers a writer to a + reader. */ +#undef HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER + /* Define to 1 if you have the `rawmemchr' function. */ #undef HAVE_RAWMEMCHR -/* Define to 1 if accept is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ACCEPT - -/* Define to 1 if accept4 is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ACCEPT4 - -/* Define to 1 if acosf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ACOSF - -/* Define to 1 if acosl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ACOSL - -/* Define to 1 if alphasort is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ALPHASORT - -/* Define to 1 if asinf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ASINF - -/* Define to 1 if asinl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ASINL - -/* Define to 1 if atanf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ATANF - -/* Define to 1 if atanl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ATANL - -/* Define to 1 if atoll is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ATOLL - -/* Define to 1 if bind is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_BIND - -/* Define to 1 if btowc is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_BTOWC - -/* Define to 1 if canonicalize_file_name is declared even after undefining - macros. */ -#undef HAVE_RAW_DECL_CANONICALIZE_FILE_NAME - -/* Define to 1 if cbrt is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_CBRT - -/* Define to 1 if cbrtf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_CBRTF - -/* Define to 1 if cbrtl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_CBRTL - -/* Define to 1 if ceilf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_CEILF - -/* Define to 1 if ceill is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_CEILL - -/* Define to 1 if chdir is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_CHDIR - -/* Define to 1 if chown is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_CHOWN - -/* Define to 1 if closedir is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_CLOSEDIR - -/* Define to 1 if connect is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_CONNECT - -/* Define to 1 if copysign is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_COPYSIGN - -/* Define to 1 if copysignf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_COPYSIGNF - -/* Define to 1 if copysignl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_COPYSIGNL - -/* Define to 1 if cosf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_COSF - -/* Define to 1 if coshf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_COSHF - -/* Define to 1 if cosl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_COSL - -/* Define to 1 if dirfd is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_DIRFD - -/* Define to 1 if dprintf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_DPRINTF - -/* Define to 1 if dup is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_DUP - -/* Define to 1 if dup2 is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_DUP2 - -/* Define to 1 if dup3 is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_DUP3 - -/* Define to 1 if endusershell is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ENDUSERSHELL - -/* Define to 1 if environ is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ENVIRON - -/* Define to 1 if euidaccess is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_EUIDACCESS - -/* Define to 1 if exp2 is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_EXP2 - -/* Define to 1 if exp2f is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_EXP2F - -/* Define to 1 if exp2l is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_EXP2L - -/* Define to 1 if expf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_EXPF - -/* Define to 1 if expl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_EXPL - -/* Define to 1 if expm1 is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_EXPM1 - -/* Define to 1 if expm1f is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_EXPM1F - -/* Define to 1 if expm1l is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_EXPM1L - -/* Define to 1 if fabsf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FABSF - -/* Define to 1 if fabsl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FABSL - -/* Define to 1 if faccessat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FACCESSAT - -/* Define to 1 if fchdir is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FCHDIR - -/* Define to 1 if fchmodat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FCHMODAT - -/* Define to 1 if fchownat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FCHOWNAT - -/* Define to 1 if fcntl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FCNTL - -/* Define to 1 if fdatasync is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FDATASYNC - -/* Define to 1 if fdopendir is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FDOPENDIR - -/* Define to 1 if ffsl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FFSL - -/* Define to 1 if ffsll is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FFSLL - -/* Define to 1 if floorf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FLOORF - -/* Define to 1 if floorl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FLOORL - -/* Define to 1 if fma is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FMA - -/* Define to 1 if fmaf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FMAF - -/* Define to 1 if fmal is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FMAL - -/* Define to 1 if fmod is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FMOD - -/* Define to 1 if fmodf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FMODF - -/* Define to 1 if fmodl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FMODL - -/* Define to 1 if fpurge is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FPURGE - -/* Define to 1 if frexpf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FREXPF - -/* Define to 1 if frexpl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FREXPL - -/* Define to 1 if fseeko is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FSEEKO - -/* Define to 1 if fstat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FSTAT - -/* Define to 1 if fstatat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FSTATAT - -/* Define to 1 if fsync is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FSYNC - -/* Define to 1 if ftello is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FTELLO - -/* Define to 1 if ftruncate is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FTRUNCATE - -/* Define to 1 if futimens is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_FUTIMENS - -/* Define to 1 if getcwd is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETCWD - -/* Define to 1 if getdelim is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETDELIM - -/* Define to 1 if getdomainname is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETDOMAINNAME - -/* Define to 1 if getdtablesize is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETDTABLESIZE - -/* Define to 1 if getgroups is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETGROUPS - -/* Define to 1 if gethostname is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETHOSTNAME - -/* Define to 1 if getline is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETLINE - -/* Define to 1 if getloadavg is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETLOADAVG - -/* Define to 1 if getlogin is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETLOGIN - -/* Define to 1 if getlogin_r is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETLOGIN_R - -/* Define to 1 if getpagesize is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETPAGESIZE - -/* Define to 1 if getpeername is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETPEERNAME - -/* Define to 1 if gets is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETS - -/* Define to 1 if getsockname is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETSOCKNAME - -/* Define to 1 if getsockopt is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETSOCKOPT - -/* Define to 1 if getsubopt is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETSUBOPT - -/* Define to 1 if gettimeofday is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETTIMEOFDAY - -/* Define to 1 if getusershell is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GETUSERSHELL - -/* Define to 1 if grantpt is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GRANTPT - -/* Define to 1 if group_member is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_GROUP_MEMBER - -/* Define to 1 if hypotf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_HYPOTF - -/* Define to 1 if hypotl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_HYPOTL - -/* Define to 1 if ilogb is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ILOGB - -/* Define to 1 if ilogbf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ILOGBF - -/* Define to 1 if ilogbl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ILOGBL - -/* Define to 1 if imaxabs is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_IMAXABS - -/* Define to 1 if imaxdiv is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_IMAXDIV - -/* Define to 1 if inet_ntop is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_INET_NTOP - -/* Define to 1 if inet_pton is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_INET_PTON - -/* Define to 1 if initstate is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_INITSTATE - -/* Define to 1 if initstate_r is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_INITSTATE_R - -/* Define to 1 if isatty is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ISATTY - -/* Define to 1 if iswctype is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ISWCTYPE - -/* Define to 1 if lchmod is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LCHMOD - -/* Define to 1 if lchown is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LCHOWN - -/* Define to 1 if ldexpf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LDEXPF - -/* Define to 1 if ldexpl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LDEXPL - -/* Define to 1 if link is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LINK - -/* Define to 1 if linkat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LINKAT - -/* Define to 1 if listen is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LISTEN - -/* Define to 1 if log is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOG - -/* Define to 1 if log10 is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOG10 - -/* Define to 1 if log10f is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOG10F - -/* Define to 1 if log10l is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOG10L - -/* Define to 1 if log1p is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOG1P - -/* Define to 1 if log1pf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOG1PF - -/* Define to 1 if log1pl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOG1PL - -/* Define to 1 if log2 is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOG2 - -/* Define to 1 if log2f is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOG2F - -/* Define to 1 if log2l is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOG2L - -/* Define to 1 if logb is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOGB - -/* Define to 1 if logbf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOGBF - -/* Define to 1 if logbl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOGBL - -/* Define to 1 if logf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOGF - -/* Define to 1 if logl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LOGL - -/* Define to 1 if lseek is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LSEEK - -/* Define to 1 if lstat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_LSTAT - -/* Define to 1 if mbrlen is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MBRLEN - -/* Define to 1 if mbrtowc is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MBRTOWC - -/* Define to 1 if mbsinit is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MBSINIT - -/* Define to 1 if mbsnrtowcs is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MBSNRTOWCS - -/* Define to 1 if mbsrtowcs is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MBSRTOWCS - -/* Define to 1 if memmem is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MEMMEM - -/* Define to 1 if mempcpy is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MEMPCPY - -/* Define to 1 if memrchr is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MEMRCHR - -/* Define to 1 if mkdirat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MKDIRAT - -/* Define to 1 if mkdtemp is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MKDTEMP - -/* Define to 1 if mkfifo is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MKFIFO - -/* Define to 1 if mkfifoat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MKFIFOAT - -/* Define to 1 if mknod is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MKNOD - -/* Define to 1 if mknodat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MKNODAT - -/* Define to 1 if mkostemp is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MKOSTEMP - -/* Define to 1 if mkostemps is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MKOSTEMPS - -/* Define to 1 if mkstemp is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MKSTEMP - -/* Define to 1 if mkstemps is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MKSTEMPS - -/* Define to 1 if modf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MODF - -/* Define to 1 if modff is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MODFF - -/* Define to 1 if modfl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_MODFL - -/* Define to 1 if openat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_OPENAT - -/* Define to 1 if opendir is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_OPENDIR - -/* Define to 1 if pclose is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_PCLOSE - -/* Define to 1 if pipe is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_PIPE - -/* Define to 1 if pipe2 is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_PIPE2 - -/* Define to 1 if popen is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_POPEN - -/* Define to 1 if posix_openpt is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_POSIX_OPENPT - -/* Define to 1 if powf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_POWF - -/* Define to 1 if pread is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_PREAD - -/* Define to 1 if pthread_sigmask is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_PTHREAD_SIGMASK - -/* Define to 1 if ptsname is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_PTSNAME - -/* Define to 1 if ptsname_r is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_PTSNAME_R - -/* Define to 1 if pwrite is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_PWRITE - -/* Define to 1 if qsort_r is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_QSORT_R - -/* Define to 1 if random is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_RANDOM - -/* Define to 1 if random_r is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_RANDOM_R - -/* Define to 1 if rawmemchr is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_RAWMEMCHR - -/* Define to 1 if readdir is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_READDIR - -/* Define to 1 if readlink is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_READLINK - -/* Define to 1 if readlinkat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_READLINKAT - -/* Define to 1 if realpath is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_REALPATH - -/* Define to 1 if recv is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_RECV - -/* Define to 1 if recvfrom is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_RECVFROM - -/* Define to 1 if remainder is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_REMAINDER - -/* Define to 1 if remainderf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_REMAINDERF - -/* Define to 1 if remainderl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_REMAINDERL - -/* Define to 1 if renameat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_RENAMEAT - -/* Define to 1 if rewinddir is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_REWINDDIR - -/* Define to 1 if rint is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_RINT - -/* Define to 1 if rintf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_RINTF - -/* Define to 1 if rintl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_RINTL - -/* Define to 1 if rmdir is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_RMDIR - -/* Define to 1 if round is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ROUND - -/* Define to 1 if roundf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ROUNDF - -/* Define to 1 if roundl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_ROUNDL - -/* Define to 1 if rpmatch is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_RPMATCH - -/* Define to 1 if scandir is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SCANDIR - -/* Define to 1 if secure_getenv is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SECURE_GETENV - -/* Define to 1 if send is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SEND - -/* Define to 1 if sendto is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SENDTO - -/* Define to 1 if setenv is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SETENV - -/* Define to 1 if sethostname is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SETHOSTNAME - -/* Define to 1 if setsockopt is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SETSOCKOPT - -/* Define to 1 if setstate is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SETSTATE - -/* Define to 1 if setstate_r is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SETSTATE_R - -/* Define to 1 if setusershell is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SETUSERSHELL - -/* Define to 1 if shutdown is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SHUTDOWN - -/* Define to 1 if sigaction is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SIGACTION - -/* Define to 1 if sigaddset is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SIGADDSET - -/* Define to 1 if sigdelset is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SIGDELSET - -/* Define to 1 if sigemptyset is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SIGEMPTYSET - -/* Define to 1 if sigfillset is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SIGFILLSET - -/* Define to 1 if sigismember is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SIGISMEMBER - -/* Define to 1 if sigpending is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SIGPENDING - -/* Define to 1 if sigprocmask is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SIGPROCMASK - -/* Define to 1 if sinf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SINF - -/* Define to 1 if sinhf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SINHF - -/* Define to 1 if sinl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SINL - -/* Define to 1 if sleep is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SLEEP - -/* Define to 1 if snprintf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SNPRINTF - -/* Define to 1 if socket is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SOCKET - -/* Define to 1 if sqrtf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SQRTF - -/* Define to 1 if sqrtl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SQRTL - -/* Define to 1 if srandom is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SRANDOM - -/* Define to 1 if srandom_r is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SRANDOM_R - -/* Define to 1 if stat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STAT - -/* Define to 1 if stpcpy is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STPCPY - -/* Define to 1 if stpncpy is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STPNCPY - -/* Define to 1 if strcasestr is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRCASESTR - -/* Define to 1 if strchrnul is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRCHRNUL - -/* Define to 1 if strdup is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRDUP - -/* Define to 1 if strerror_r is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRERROR_R - -/* Define to 1 if strncat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRNCAT - -/* Define to 1 if strndup is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRNDUP - -/* Define to 1 if strnlen is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRNLEN - -/* Define to 1 if strpbrk is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRPBRK - -/* Define to 1 if strsep is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRSEP - -/* Define to 1 if strsignal is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRSIGNAL - -/* Define to 1 if strtod is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRTOD - -/* Define to 1 if strtoimax is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRTOIMAX - -/* Define to 1 if strtok_r is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRTOK_R - -/* Define to 1 if strtoll is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRTOLL - -/* Define to 1 if strtoull is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRTOULL - -/* Define to 1 if strtoumax is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRTOUMAX - -/* Define to 1 if strverscmp is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_STRVERSCMP - -/* Define to 1 if symlink is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SYMLINK - -/* Define to 1 if symlinkat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_SYMLINKAT - -/* Define to 1 if tanf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_TANF - -/* Define to 1 if tanhf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_TANHF - -/* Define to 1 if tanl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_TANL - -/* Define to 1 if tmpfile is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_TMPFILE - -/* Define to 1 if towctrans is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_TOWCTRANS - -/* Define to 1 if trunc is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_TRUNC - -/* Define to 1 if truncf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_TRUNCF - -/* Define to 1 if truncl is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_TRUNCL - -/* Define to 1 if ttyname_r is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_TTYNAME_R - -/* Define to 1 if unlink is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_UNLINK - -/* Define to 1 if unlinkat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_UNLINKAT - -/* Define to 1 if unlockpt is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_UNLOCKPT - -/* Define to 1 if unsetenv is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_UNSETENV - -/* Define to 1 if usleep is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_USLEEP - -/* Define to 1 if utimensat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_UTIMENSAT - -/* Define to 1 if vdprintf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_VDPRINTF - -/* Define to 1 if vsnprintf is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_VSNPRINTF - -/* Define to 1 if wcpcpy is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCPCPY - -/* Define to 1 if wcpncpy is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCPNCPY - -/* Define to 1 if wcrtomb is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCRTOMB - -/* Define to 1 if wcscasecmp is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSCASECMP - -/* Define to 1 if wcscat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSCAT - -/* Define to 1 if wcschr is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSCHR - -/* Define to 1 if wcscmp is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSCMP - -/* Define to 1 if wcscoll is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSCOLL - -/* Define to 1 if wcscpy is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSCPY - -/* Define to 1 if wcscspn is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSCSPN - -/* Define to 1 if wcsdup is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSDUP - -/* Define to 1 if wcslen is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSLEN - -/* Define to 1 if wcsncasecmp is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSNCASECMP - -/* Define to 1 if wcsncat is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSNCAT - -/* Define to 1 if wcsncmp is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSNCMP - -/* Define to 1 if wcsncpy is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSNCPY - -/* Define to 1 if wcsnlen is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSNLEN - -/* Define to 1 if wcsnrtombs is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSNRTOMBS - -/* Define to 1 if wcspbrk is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSPBRK - -/* Define to 1 if wcsrchr is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSRCHR - -/* Define to 1 if wcsrtombs is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSRTOMBS - -/* Define to 1 if wcsspn is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSSPN - -/* Define to 1 if wcsstr is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSSTR - -/* Define to 1 if wcstok is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSTOK - -/* Define to 1 if wcswidth is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSWIDTH - -/* Define to 1 if wcsxfrm is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCSXFRM - -/* Define to 1 if wctob is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCTOB - -/* Define to 1 if wctrans is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCTRANS - -/* Define to 1 if wctype is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCTYPE - -/* Define to 1 if wcwidth is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WCWIDTH - -/* Define to 1 if wmemchr is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WMEMCHR - -/* Define to 1 if wmemcmp is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WMEMCMP - -/* Define to 1 if wmemcpy is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WMEMCPY - -/* Define to 1 if wmemmove is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WMEMMOVE - -/* Define to 1 if wmemset is declared even after undefining macros. */ -#undef HAVE_RAW_DECL_WMEMSET - -/* Define to 1 if _Exit is declared even after undefining macros. */ -#undef HAVE_RAW_DECL__EXIT - /* Define to 1 if you have the `readdir' function. */ #undef HAVE_READDIR -/* Define to 1 if you have the 'readlink' function. */ +/* Define to 1 if you have the `readlink' function. */ #undef HAVE_READLINK /* Define if the 'realloc' function is POSIX compliant. */ #undef HAVE_REALLOC_POSIX -/* Define to 1 if you have the 'realpath' function. */ +/* Define to 1 if you have the `realpath' function. */ #undef HAVE_REALPATH /* Define to 1 if you have the `rewinddir' function. */ @@ -1516,13 +659,10 @@ /* Define to 1 if you have the <search.h> header file. */ #undef HAVE_SEARCH_H -/* Define to 1 if you have the 'secure_getenv' function. */ -#undef HAVE_SECURE_GETENV - /* Define to 1 if you have the `setdtablesize' function. */ #undef HAVE_SETDTABLESIZE -/* Define to 1 if you have the 'setenv' function. */ +/* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV /* Define to 1 if you have the `shutdown' function. */ @@ -1540,7 +680,7 @@ /* Define to 1 if the system has the type `sigset_t'. */ #undef HAVE_SIGSET_T -/* Define to 1 if you have the 'snprintf' function. */ +/* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Define to 1 if you have the <stdint.h> header file. */ @@ -1552,10 +692,10 @@ /* Define to 1 if you have the `strchrnul' function. */ #undef HAVE_STRCHRNUL -/* Define to 1 if you have the 'strdup' function. */ +/* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP -/* Define to 1, since you should have the function strerror_r. */ +/* Define to 1 if you have the `strerror_r' function. */ #undef HAVE_STRERROR_R /* Define to 1 if you have the <strings.h> header file. */ @@ -1577,15 +717,33 @@ /* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */ #undef HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY -/* Define to 1 if you have the 'symlink' function. */ +/* Define to 1 if `st_atimensec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATIMENSEC + +/* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC + +/* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC + +/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC + +/* Define to 1 if `st_birthtimensec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC + +/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC + +/* Define to 1 if `st_birthtim.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC + +/* Define to 1 if you have the `symlink' function. */ #undef HAVE_SYMLINK /* Define to 1 if you have the <sys/bitypes.h> header file. */ #undef HAVE_SYS_BITYPES_H -/* Define to 1 if you have the <sys/cdefs.h> header file. */ -#undef HAVE_SYS_CDEFS_H - /* Define to 1 if you have the <sys/inttypes.h> header file. */ #undef HAVE_SYS_INTTYPES_H @@ -1601,9 +759,6 @@ /* Define to 1 if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H -/* Define to 1 if you have the <sys/timeb.h> header file. */ -#undef HAVE_SYS_TIMEB_H - /* Define to 1 if you have the <sys/time.h> header file. */ #undef HAVE_SYS_TIME_H @@ -1613,6 +768,9 @@ /* Define to 1 if you have the <sys/uio.h> header file. */ #undef HAVE_SYS_UIO_H +/* Define to 1 if you have the <threads.h> header file. */ +#undef HAVE_THREADS_H + /* Define to 1 if you have the `towlower' function. */ #undef HAVE_TOWLOWER @@ -1640,6 +798,10 @@ /* Define to 1 if you have the <wctype.h> header file. */ #undef HAVE_WCTYPE_H +/* Define to 1 if the compiler and linker support weak declarations of + symbols. */ +#undef HAVE_WEAK_SYMBOLS + /* Define to 1 if you have the <windows.h> header file. */ #undef HAVE_WINDOWS_H @@ -1649,13 +811,13 @@ /* Define if you have the 'wint_t' type. */ #undef HAVE_WINT_T -/* Define to 1 if you have the 'wmemchr' function. */ +/* Define to 1 if you have the `wmemchr' function. */ #undef HAVE_WMEMCHR -/* Define to 1 if you have the 'wmemcpy' function. */ +/* Define to 1 if you have the `wmemcpy' function. */ #undef HAVE_WMEMCPY -/* Define to 1 if you have the 'wmempcpy' function. */ +/* Define to 1 if you have the `wmempcpy' function. */ #undef HAVE_WMEMPCPY /* Define to 1 if fstatat (..., 0) works. For example, it does not work in AIX @@ -1674,16 +836,23 @@ /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL -/* Define to 1 if you have the `_ftime' function. */ -#undef HAVE__FTIME - -/* Define to 1 if you have the '_set_invalid_parameter_handler' function. */ +/* Define to 1 if you have the `_set_invalid_parameter_handler' function. */ #undef HAVE__SET_INVALID_PARAMETER_HANDLER -/* Define to 1 if you have the `__secure_getenv' function. */ -#undef HAVE___SECURE_GETENV +/* Define to 1 if the compiler supports __builtin_expect, + and to 2 if <builtins.h> does. */ +#undef HAVE___BUILTIN_EXPECT +#ifndef HAVE___BUILTIN_EXPECT +# define __builtin_expect(e, c) (e) +#elif HAVE___BUILTIN_EXPECT == 2 +# include <builtins.h> +#endif + -/* Define to 1 if you have the '__xpg_strerror_r' function. */ +/* Define to 1 if the compiler supports the keyword '__inline'. */ +#undef HAVE___INLINE + +/* Define to 1 if you have the `__xpg_strerror_r' function. */ #undef HAVE___XPG_STRERROR_R /* Define as the bit index in the word where to find bit 0 of the exponent of @@ -1772,7 +941,7 @@ #undef RENAME_HARD_LINK_BUG /* Define if rename does not correctly handle slashes on the destination - argument, such as on Solaris 10 or NetBSD 1.6. */ + argument, such as on Solaris 11 or NetBSD 1.6. */ #undef RENAME_TRAILING_SLASH_DEST_BUG /* Define if rename does not correctly handle slashes on the source argument, @@ -1785,10 +954,6 @@ /* Define to 1 if gnulib's fchdir() replacement is used. */ #undef REPLACE_FCHDIR -/* Define to 1 if stat needs help when passed a directory name with a trailing - slash */ -#undef REPLACE_FUNC_STAT_DIR - /* Define to 1 if stat needs help when passed a file name with a trailing slash */ #undef REPLACE_FUNC_STAT_FILE @@ -1822,9 +987,20 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS -/* Define to 0, since strerror_r should not return char *. */ +/* Define to 1 if strerror_r returns char *. */ #undef STRERROR_R_CHAR_P +/* Define to 1 if the type of the st_atim member of a struct stat is struct + timespec. */ +#undef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC + +/* Define if the combination of the ISO C and POSIX multithreading APIs can be + used. */ +#undef USE_ISOC_AND_POSIX_THREADS + +/* Define if the ISO C multithreading library can be used. */ +#undef USE_ISOC_THREADS + /* Define if the POSIX multithreading library can be used. */ #undef USE_POSIX_THREADS @@ -1832,20 +1008,6 @@ weak. */ #undef USE_POSIX_THREADS_WEAK -/* Define if the GNU Pth multithreading library can be used. */ -#undef USE_PTH_THREADS - -/* Define if references to the GNU Pth multithreading library should be made - weak. */ -#undef USE_PTH_THREADS_WEAK - -/* Define if the old Solaris multithreading library can be used. */ -#undef USE_SOLARIS_THREADS - -/* Define if references to the old Solaris multithreading library should be - made weak. */ -#undef USE_SOLARIS_THREADS_WEAK - /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE @@ -1858,6 +1020,14 @@ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif +/* Enable NetBSD extensions on NetBSD. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD extensions on NetBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS @@ -1900,6 +1070,11 @@ #ifndef _XOPEN_SOURCE # undef _XOPEN_SOURCE #endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ @@ -1938,10 +1113,6 @@ /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS -/* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct - stat.st_size becomes 64-bit. */ -#undef _GL_WINDOWS_64_BIT_ST_SIZE - /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES @@ -1952,12 +1123,25 @@ #undef _NETBSD_SOURCE /* The _Noreturn keyword of C11. */ -#if ! (defined _Noreturn \ - || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) -# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ - || 0x5110 <= __SUNPRO_C) +#ifndef _Noreturn +# if (defined __cplusplus \ + && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ + || (defined _MSC_VER && 1900 <= _MSC_VER)) \ + && 0) + /* [[noreturn]] is not practically usable, because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would only be valid with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. */ +# define _Noreturn [[noreturn]] +# elif ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ + || 4 < __GNUC__ + (7 <= __GNUC_MINOR__))) + /* _Noreturn works as-is. */ +# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C # define _Noreturn __attribute__ ((__noreturn__)) -# elif defined _MSC_VER && 1200 <= _MSC_VER +# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) # else # define _Noreturn @@ -1976,16 +1160,46 @@ /* Define to 1 if you need to in order for 'stat' and other things to work. */ #undef _POSIX_SOURCE +/* For standard stat data types on VMS. */ +#undef _USE_STD_STAT + /* Define to 1 if the system <stdint.h> predates C++11. */ #undef __STDC_CONSTANT_MACROS /* Define to 1 if the system <stdint.h> predates C++11. */ #undef __STDC_LIMIT_MACROS +/* The _GL_ASYNC_SAFE marker should be attached to functions that are + signal handlers (for signals other than SIGABRT, SIGPIPE) or can be + invoked from such signal handlers. Such functions have some restrictions: + * All functions that it calls should be marked _GL_ASYNC_SAFE as well, + or should be listed as async-signal-safe in POSIX + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04> + section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in + particular, are NOT async-signal-safe. + * All memory locations (variables and struct fields) that these functions + access must be marked 'volatile'. This holds for both read and write + accesses. Otherwise the compiler might optimize away stores to and + reads from such locations that occur in the program, depending on its + data flow analysis. For example, when the program contains a loop + that is intended to inspect a variable set from within a signal handler + while (!signal_occurred) + ; + the compiler is allowed to transform this into an endless loop if the + variable 'signal_occurred' is not declared 'volatile'. + Additionally, recall that: + * A signal handler should not modify errno (except if it is a handler + for a fatal signal and ends by raising the same signal again, thus + provoking the termination of the process). If it invokes a function + that may clobber errno, it needs to save and restore the value of + errno. */ +#define _GL_ASYNC_SAFE + + /* Please see the Gnulib manual for how to use these macros. Suppress extern inline with HP-UX cc, as it appears to be broken; see - <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>. + <https://lists.gnu.org/r/bug-texinfo/2013-02/msg00030.html>. Suppress extern inline with Sun C in standards-conformance mode, as it mishandles inline functions that call each other. E.g., for 'inline void f @@ -1999,20 +1213,32 @@ if isdigit is mistakenly implemented via a static inline function, a program containing an extern inline function that calls isdigit may not work since the C standard prohibits extern inline functions - from calling static functions. This bug is known to occur on: + from calling static functions (ISO C 99 section 6.7.4.(3). + This bug is known to occur on: OS X 10.8 and earlier; see: - http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html + https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html DragonFly; see - http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log + http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log FreeBSD; see: - http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html + https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and - for clang but remains for g++; see <http://trac.macports.org/ticket/41033>. - Assume DragonFly and FreeBSD will be similar. */ + for clang but remains for g++; see <https://trac.macports.org/ticket/41033>. + Assume DragonFly and FreeBSD will be similar. + + GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 + inline semantics, unless -fgnu89-inline is used. It defines a macro + __GNUC_STDC_INLINE__ to indicate this situation or a macro + __GNUC_GNU_INLINE__ to indicate the opposite situation. + GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline + semantics but warns, unless -fgnu89-inline is used: + warning: C99 inline functions are not supported; using GNU89 + warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute + It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. + */ #if (((defined __APPLE__ && defined __MACH__) \ || defined __DragonFly__ || defined __FreeBSD__) \ && (defined __header_inline \ @@ -2074,12 +1300,15 @@ # define _GL_INLINE_HEADER_END #endif -/* Define to a replacement function name for fnmatch(). */ -#undef fnmatch - /* Define to `int' if <sys/types.h> doesn't define. */ #undef gid_t +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + /* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. @@ -2164,3 +1393,10 @@ # 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 + diff --git a/gnulib/configure b/gnulib/configure index 7c74371..a0fb5c6 100644 --- a/gnulib/configure +++ b/gnulib/configure @@ -620,8 +620,9 @@ ac_includes_default="\ #endif" gl_use_threads_default= -gl_header_list= -gl_func_list= +gl_use_winpthreads_default= +ac_header_list= +ac_func_list= gl_fnmatch_required=POSIX ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE @@ -686,6 +687,7 @@ GNULIB_WCTRANS GNULIB_ISWCTYPE GNULIB_WCTYPE GNULIB_ISWBLANK +HAVE_CRTDEFS_H HAVE_WINT_T NEXT_AS_FIRST_DIRECTIVE_WCHAR_H NEXT_WCHAR_H @@ -698,25 +700,10 @@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC TIME_H_DEFINES_STRUCT_TIMESPEC NEXT_AS_FIRST_DIRECTIVE_TIME_H NEXT_TIME_H -REPLACE_LOCALTIME -REPLACE_GMTIME -REPLACE_TIMEGM -REPLACE_NANOSLEEP -REPLACE_MKTIME -REPLACE_LOCALTIME_R -HAVE_TIMEGM -HAVE_STRPTIME -HAVE_NANOSLEEP -HAVE_DECL_LOCALTIME_R -GNULIB_TIME_RZ -GNULIB_TIME_R -GNULIB_TIMEGM -GNULIB_STRPTIME -GNULIB_NANOSLEEP -GNULIB_MKTIME HAVE_SYS_UIO_H NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H NEXT_SYS_UIO_H +WINDOWS_STAT_INODES WINDOWS_64_BIT_OFF_T NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H NEXT_SYS_TYPES_H @@ -867,17 +854,17 @@ HAVE_NETINET_IN_H NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H NEXT_NETINET_IN_H UNDEFINE_STRTOK_R -REPLACE_STRTOK_R REPLACE_STRSIGNAL -REPLACE_STRNLEN -REPLACE_STRNDUP -REPLACE_STRNCAT REPLACE_STRERROR_R REPLACE_STRERROR -REPLACE_STRCHRNUL +REPLACE_STRTOK_R REPLACE_STRCASESTR REPLACE_STRSTR +REPLACE_STRNLEN +REPLACE_STRNDUP +REPLACE_STRNCAT REPLACE_STRDUP +REPLACE_STRCHRNUL REPLACE_STPNCPY REPLACE_MEMMEM REPLACE_MEMCHR @@ -901,6 +888,7 @@ HAVE_DECL_MEMMEM HAVE_MEMCHR HAVE_FFSLL HAVE_FFSL +HAVE_EXPLICIT_BZERO HAVE_MBSLEN GNULIB_STRVERSCMP GNULIB_STRSIGNAL @@ -939,10 +927,13 @@ GNULIB_MEMMEM GNULIB_MEMCHR GNULIB_FFSLL GNULIB_FFSL +GNULIB_EXPLICIT_BZERO LOCALE_FR -LOCALE_FR_UTF8 LOCALE_ZH_CN +LOCALE_FR_UTF8 LOCALE_JA +REPLACE_WCSTOK +REPLACE_WCSFTIME REPLACE_WCSWIDTH REPLACE_WCWIDTH REPLACE_WCSNRTOMBS @@ -958,6 +949,7 @@ REPLACE_BTOWC REPLACE_MBSTATE_T HAVE_DECL_WCWIDTH HAVE_DECL_WCTOB +HAVE_WCSFTIME HAVE_WCSWIDTH HAVE_WCSTOK HAVE_WCSSTR @@ -995,6 +987,7 @@ HAVE_MBRLEN HAVE_MBRTOWC HAVE_MBSINIT HAVE_BTOWC +GNULIB_WCSFTIME GNULIB_WCSWIDTH GNULIB_WCSTOK GNULIB_WCSSTR @@ -1040,11 +1033,9 @@ LTLIBMULTITHREAD LIBMULTITHREAD LTLIBTHREAD LIBTHREAD -LIBPTH_PREFIX -LTLIBPTH -LIBPTH +LIBPMULTITHREAD +LIBPTHREAD LOCALCHARSET_TESTS_ENVIRONMENT -GLIBC21 NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H NEXT_INTTYPES_H UINT64_MAX_EQ_ULONG_MAX @@ -1055,6 +1046,7 @@ INT64_MAX_EQ_LONG_MAX INT32_MAX_LT_INTMAX_MAX REPLACE_STRTOUMAX REPLACE_STRTOIMAX +HAVE_IMAXDIV_T HAVE_DECL_STRTOUMAX HAVE_DECL_STRTOIMAX HAVE_DECL_IMAXDIV @@ -1091,12 +1083,12 @@ HAVE_INTTYPES_H HAVE_WCHAR_H HAVE_UNSIGNED_LONG_LONG_INT HAVE_LONG_LONG_INT +GNULIB_OVERRIDES_WINT_T GL_GENERATE_LIMITS_H_FALSE GL_GENERATE_LIMITS_H_TRUE LIMITS_H NEXT_AS_FIRST_DIRECTIVE_LIMITS_H NEXT_LIMITS_H -HAVE_WS2TCPIP_H HAVE_SYS_SOCKET_H NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H NEXT_SYS_SOCKET_H @@ -1120,22 +1112,55 @@ GNULIB_ACCEPT GNULIB_CONNECT GNULIB_SOCKET INET_NTOP_LIB -HAVE_SYS_CDEFS_H GL_GENERATE_GLOB_H_FALSE GL_GENERATE_GLOB_H_TRUE GLOB_H +HAVE_GLOB_H +NEXT_AS_FIRST_DIRECTIVE_GLOB_H +NEXT_GLOB_H +REPLACE_GLOB_PATTERN_P +REPLACE_GLOB +HAVE_GLOB_PATTERN_P +HAVE_GLOB +GNULIB_GLOB +REPLACE_LOCALTIME +REPLACE_GMTIME +REPLACE_TZSET +REPLACE_TIMEGM +REPLACE_STRFTIME +REPLACE_NANOSLEEP +REPLACE_MKTIME +REPLACE_LOCALTIME_R +REPLACE_CTIME +HAVE_TIMEZONE_T +HAVE_TZSET +HAVE_TIMEGM +HAVE_STRPTIME +HAVE_NANOSLEEP +HAVE_DECL_LOCALTIME_R +GNULIB_TZSET +GNULIB_TIME_RZ +GNULIB_TIME_R +GNULIB_TIMEGM +GNULIB_STRPTIME +GNULIB_STRFTIME +GNULIB_NANOSLEEP +GNULIB_LOCALTIME +GNULIB_MKTIME +GNULIB_CTIME NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H NEXT_SYS_TIME_H REPLACE_STRUCT_TIMEVAL REPLACE_GETTIMEOFDAY -HAVE_TIMEZONE_T HAVE_SYS_TIME_H HAVE_STRUCT_TIMEVAL HAVE_GETTIMEOFDAY GNULIB_GETTIMEOFDAY LTLIBINTL LIBINTL +LIB_GETLOGIN WINDOWS_64_BIT_ST_SIZE +WINDOWS_STAT_TIMESPEC NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H NEXT_SYS_STAT_H REPLACE_UTIMENSAT @@ -1158,6 +1183,7 @@ HAVE_LCHMOD HAVE_FUTIMENS HAVE_FSTATAT HAVE_FCHMODAT +GNULIB_OVERRIDES_STRUCT_STAT GNULIB_UTIMENSAT GNULIB_STAT GNULIB_MKNODAT @@ -1177,12 +1203,18 @@ FREXP_LIBM REPLACE_TRUNCL REPLACE_TRUNCF REPLACE_TRUNC +REPLACE_TANHF +REPLACE_TANF REPLACE_SQRTL +REPLACE_SQRTF +REPLACE_SINHF +REPLACE_SINF REPLACE_SIGNBIT_USING_GCC REPLACE_SIGNBIT REPLACE_ROUNDL REPLACE_ROUNDF REPLACE_ROUND +REPLACE_RINTL REPLACE_REMAINDERL REPLACE_REMAINDERF REPLACE_REMAINDER @@ -1209,6 +1241,7 @@ REPLACE_LDEXPL REPLACE_ISNAN REPLACE_ISINF REPLACE_ISFINITE +REPLACE_ILOGBL REPLACE_ILOGBF REPLACE_ILOGB REPLACE_HYPOTL @@ -1230,13 +1263,22 @@ REPLACE_FLOOR REPLACE_FABSL REPLACE_EXP2L REPLACE_EXP2 +REPLACE_EXPM1L REPLACE_EXPM1F REPLACE_EXPM1 +REPLACE_EXPL +REPLACE_EXPF +REPLACE_COSHF +REPLACE_COSF REPLACE_CEILL REPLACE_CEILF REPLACE_CEIL REPLACE_CBRTL REPLACE_CBRTF +REPLACE_ATAN2F +REPLACE_ATANF +REPLACE_ASINF +REPLACE_ACOSF HAVE_DECL_TRUNCL HAVE_DECL_TRUNCF HAVE_DECL_TRUNC @@ -1431,6 +1473,12 @@ GNULIB_ACOSF GL_GENERATE_FNMATCH_H_FALSE GL_GENERATE_FNMATCH_H_TRUE FNMATCH_H +HAVE_FNMATCH_H +NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H +NEXT_FNMATCH_H +REPLACE_FNMATCH +HAVE_FNMATCH +GNULIB_FNMATCH REPLACE_ITOLD GL_GENERATE_FLOAT_H_FALSE GL_GENERATE_FLOAT_H_TRUE @@ -1442,12 +1490,14 @@ NEXT_FCNTL_H REPLACE_OPENAT REPLACE_OPEN REPLACE_FCNTL +REPLACE_CREAT HAVE_OPENAT HAVE_FCNTL GNULIB_OPENAT GNULIB_OPEN GNULIB_NONBLOCKING GNULIB_FCNTL +GNULIB_CREAT EOVERFLOW_VALUE EOVERFLOW_HIDDEN ENOLINK_VALUE @@ -1462,9 +1512,6 @@ NEXT_ERRNO_H HAVE_DIRENT_H NEXT_AS_FIRST_DIRECTIVE_DIRENT_H NEXT_DIRENT_H -pkglibexecdir -runstatedir -lispdir REPLACE_FDOPENDIR REPLACE_DIRFD REPLACE_CLOSEDIR @@ -1495,6 +1542,7 @@ REPLACE_USLEEP REPLACE_UNLINKAT REPLACE_UNLINK REPLACE_TTYNAME_R +REPLACE_TRUNCATE REPLACE_SYMLINKAT REPLACE_SYMLINK REPLACE_SLEEP @@ -1509,6 +1557,7 @@ REPLACE_LINKAT REPLACE_LINK REPLACE_LCHOWN REPLACE_ISATTY +REPLACE_GETPASS REPLACE_GETPAGESIZE REPLACE_GETGROUPS REPLACE_GETLOGIN_R @@ -1517,17 +1566,21 @@ REPLACE_GETDOMAINNAME REPLACE_GETCWD REPLACE_FTRUNCATE REPLACE_FCHOWNAT +REPLACE_FACCESSAT REPLACE_DUP2 REPLACE_DUP REPLACE_CLOSE REPLACE_CHOWN +REPLACE_ACCESS HAVE_SYS_PARAM_H HAVE_OS_H HAVE_DECL_TTYNAME_R +HAVE_DECL_TRUNCATE HAVE_DECL_SETHOSTNAME HAVE_DECL_GETUSERSHELL HAVE_DECL_GETPAGESIZE HAVE_DECL_GETLOGIN_R +HAVE_DECL_GETLOGIN HAVE_DECL_GETDOMAINNAME HAVE_DECL_FDATASYNC HAVE_DECL_FCHDIR @@ -1548,6 +1601,7 @@ HAVE_LINKAT HAVE_LINK HAVE_LCHOWN HAVE_GROUP_MEMBER +HAVE_GETPASS HAVE_GETPAGESIZE HAVE_GETLOGIN HAVE_GETHOSTNAME @@ -1562,6 +1616,7 @@ HAVE_FACCESSAT HAVE_EUIDACCESS HAVE_DUP3 HAVE_DUP2 +HAVE_COPY_FILE_RANGE HAVE_CHOWN GNULIB_WRITE GNULIB_USLEEP @@ -1570,6 +1625,7 @@ GNULIB_UNLINK GNULIB_UNISTD_H_SIGPIPE GNULIB_UNISTD_H_NONBLOCKING GNULIB_TTYNAME_R +GNULIB_TRUNCATE GNULIB_SYMLINKAT GNULIB_SYMLINK GNULIB_SLEEP @@ -1589,6 +1645,7 @@ GNULIB_LCHOWN GNULIB_ISATTY GNULIB_GROUP_MEMBER GNULIB_GETUSERSHELL +GNULIB_GETPASS GNULIB_GETPAGESIZE GNULIB_GETLOGIN_R GNULIB_GETLOGIN @@ -1608,16 +1665,21 @@ GNULIB_ENVIRON GNULIB_DUP3 GNULIB_DUP2 GNULIB_DUP +GNULIB_COPY_FILE_RANGE GNULIB_CLOSE GNULIB_CHOWN GNULIB_CHDIR +GNULIB_ACCESS REPLACE_WCTOMB REPLACE_UNSETENV +REPLACE_STRTOLD REPLACE_STRTOD +REPLACE_SETSTATE REPLACE_SETENV REPLACE_REALPATH REPLACE_REALLOC REPLACE_RANDOM_R +REPLACE_RANDOM REPLACE_QSORT_R REPLACE_PUTENV REPLACE_PTSNAME_R @@ -1625,6 +1687,7 @@ REPLACE_PTSNAME REPLACE_MKSTEMP REPLACE_MBTOWC REPLACE_MALLOC +REPLACE_INITSTATE REPLACE_CANONICALIZE_FILE_NAME REPLACE_CALLOC HAVE_DECL_UNSETENV @@ -1633,12 +1696,16 @@ HAVE_SYS_LOADAVG_H HAVE_STRUCT_RANDOM_DATA HAVE_STRTOULL HAVE_STRTOLL +HAVE_STRTOLD HAVE_STRTOD +HAVE_DECL_SETSTATE +HAVE_SETSTATE HAVE_DECL_SETENV HAVE_SETENV HAVE_SECURE_GETENV HAVE_RPMATCH HAVE_REALPATH +HAVE_REALLOCARRAY HAVE_RANDOM_R HAVE_RANDOM_H HAVE_RANDOM @@ -1651,6 +1718,9 @@ HAVE_MKSTEMP HAVE_MKOSTEMPS HAVE_MKOSTEMP HAVE_MKDTEMP +HAVE_MBTOWC +HAVE_DECL_INITSTATE +HAVE_INITSTATE HAVE_GRANTPT HAVE_GETSUBOPT HAVE_DECL_GETLOADAVG @@ -1663,12 +1733,14 @@ GNULIB_UNLOCKPT GNULIB_SYSTEM_POSIX GNULIB_STRTOULL GNULIB_STRTOLL +GNULIB_STRTOLD GNULIB_STRTOD GNULIB_SETENV GNULIB_SECURE_GETENV GNULIB_RPMATCH GNULIB_REALPATH GNULIB_REALLOC_POSIX +GNULIB_REALLOCARRAY GNULIB_RANDOM_R GNULIB_RANDOM GNULIB_QSORT_R @@ -1691,6 +1763,7 @@ GNULIB_CALLOC_POSIX GNULIB_ATOLL GNULIB__EXIT MKDIR_P +HAVE_WS2TCPIP_H HAVE_FEATURES_H NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H NEXT_ARPA_INET_H @@ -1705,6 +1778,7 @@ HAVE_DECL_INET_PTON HAVE_DECL_INET_NTOP GNULIB_INET_PTON GNULIB_INET_NTOP +HAVE_ALLOCA_H GL_GENERATE_ALLOCA_H_FALSE GL_GENERATE_ALLOCA_H_TRUE ALLOCA_H @@ -1725,7 +1799,6 @@ build_cpu build RANLIB ARFLAGS -ac_ct_AR AR EGREP GREP @@ -1785,9 +1858,7 @@ enable_maintainer_mode enable_largefile enable_threads enable_plugins -with_gnu_ld -enable_rpath -with_libpth_prefix +enable_cross_guesses enable_dependency_tracking enable_silent_rules ' @@ -2423,11 +2494,12 @@ Optional Features: enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-largefile omit support for large files - --enable-threads={posix|solaris|pth|windows} + --enable-threads={isoc|posix|isoc+posix|windows} specify multithreading API --disable-threads build without multithread safety --enable-plugins Enable support for plugins - --disable-rpath do not hardcode runtime library paths + --enable-cross-guesses={conservative|risky} + specify policy for cross-compilation guesses --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking @@ -2435,13 +2507,6 @@ Optional Features: --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-libpth-prefix[=DIR] search for libpth in DIR/include and DIR/lib - --without-libpth-prefix don't search for libpth in includedir and libdir - Some influential environment variables: CC C compiler command CFLAGS C compiler flags @@ -3503,70 +3568,72 @@ $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -gl_header_list="$gl_header_list arpa/inet.h" -gl_header_list="$gl_header_list features.h" -gl_func_list="$gl_func_list canonicalize_file_name" -gl_func_list="$gl_func_list getcwd" -gl_func_list="$gl_func_list readlink" -gl_func_list="$gl_func_list realpath" -gl_header_list="$gl_header_list sys/param.h" -gl_header_list="$gl_header_list unistd.h" -gl_func_list="$gl_func_list _set_invalid_parameter_handler" -gl_header_list="$gl_header_list sys/socket.h" -gl_func_list="$gl_func_list fchdir" -gl_header_list="$gl_header_list dirent.h" -gl_func_list="$gl_func_list fcntl" -gl_func_list="$gl_func_list symlink" -gl_func_list="$gl_func_list fdopendir" -gl_func_list="$gl_func_list mempcpy" -gl_func_list="$gl_func_list btowc" -gl_func_list="$gl_func_list isblank" -gl_func_list="$gl_func_list iswctype" -gl_func_list="$gl_func_list mbsrtowcs" -gl_func_list="$gl_func_list wmemchr" -gl_func_list="$gl_func_list wmemcpy" -gl_func_list="$gl_func_list wmempcpy" -gl_header_list="$gl_header_list wctype.h" +as_fn_append ac_header_list " arpa/inet.h" +as_fn_append ac_header_list " features.h" +as_fn_append ac_header_list " sys/socket.h" +as_fn_append ac_func_list " canonicalize_file_name" +as_fn_append ac_func_list " getcwd" +as_fn_append ac_func_list " readlink" +as_fn_append ac_func_list " realpath" +as_fn_append ac_header_list " sys/param.h" +as_fn_append ac_header_list " unistd.h" +as_fn_append ac_func_list " _set_invalid_parameter_handler" +as_fn_append ac_func_list " fchdir" +as_fn_append ac_header_list " dirent.h" +as_fn_append ac_func_list " fcntl" +as_fn_append ac_func_list " symlink" +as_fn_append ac_func_list " fdopendir" +as_fn_append ac_func_list " mempcpy" +as_fn_append ac_header_list " fnmatch.h" +as_fn_append ac_func_list " fnmatch" +as_fn_append ac_func_list " btowc" +as_fn_append ac_func_list " isblank" +as_fn_append ac_func_list " iswctype" +as_fn_append ac_func_list " mbsrtowcs" +as_fn_append ac_func_list " wmemchr" +as_fn_append ac_func_list " wmemcpy" +as_fn_append ac_func_list " wmempcpy" +as_fn_append ac_header_list " wctype.h" gl_fnmatch_required=GNU -gl_header_list="$gl_header_list sys/stat.h" -gl_func_list="$gl_func_list fstatat" -gl_func_list="$gl_func_list getdtablesize" -gl_func_list="$gl_func_list getlogin_r" -gl_func_list="$gl_func_list getprogname" -gl_func_list="$gl_func_list getexecname" -gl_header_list="$gl_header_list sys/time.h" -gl_func_list="$gl_func_list gettimeofday" -gl_header_list="$gl_header_list sys/cdefs.h" -gl_func_list="$gl_func_list getpwnam_r" -gl_header_list="$gl_header_list netdb.h" -gl_header_list="$gl_header_list netinet/in.h" -gl_header_list="$gl_header_list limits.h" -gl_header_list="$gl_header_list wchar.h" -gl_header_list="$gl_header_list stdint.h" -gl_header_list="$gl_header_list inttypes.h" -gl_func_list="$gl_func_list lstat" -gl_header_list="$gl_header_list math.h" -gl_func_list="$gl_func_list mbsinit" -gl_func_list="$gl_func_list mbrtowc" -gl_header_list="$gl_header_list sys/mman.h" -gl_func_list="$gl_func_list mprotect" -gl_func_list="$gl_func_list mkostemp" -gl_func_list="$gl_func_list openat" -gl_func_list="$gl_func_list link" -gl_func_list="$gl_func_list secure_getenv" -gl_func_list="$gl_func_list getuid" -gl_func_list="$gl_func_list geteuid" -gl_func_list="$gl_func_list getgid" -gl_func_list="$gl_func_list getegid" -gl_func_list="$gl_func_list setenv" -gl_func_list="$gl_func_list strdup" -gl_func_list="$gl_func_list __xpg_strerror_r" -gl_func_list="$gl_func_list catgets" -gl_func_list="$gl_func_list snprintf" -gl_header_list="$gl_header_list sys/uio.h" -gl_func_list="$gl_func_list localtime_r" -gl_func_list="$gl_func_list pipe" -gl_func_list="$gl_func_list iswcntrl" +as_fn_append ac_header_list " sys/stat.h" +as_fn_append ac_func_list " fstatat" +as_fn_append ac_func_list " getdtablesize" +as_fn_append ac_func_list " getlogin_r" +as_fn_append ac_func_list " getprogname" +as_fn_append ac_func_list " getexecname" +as_fn_append ac_header_list " sys/time.h" +as_fn_append ac_func_list " gettimeofday" +as_fn_append ac_header_list " glob.h" +as_fn_append ac_func_list " glob" +as_fn_append ac_func_list " glob_pattern_p" +as_fn_append ac_func_list " getpwnam_r" +as_fn_append ac_header_list " netdb.h" +as_fn_append ac_header_list " netinet/in.h" +as_fn_append ac_header_list " limits.h" +as_fn_append ac_header_list " wchar.h" +as_fn_append ac_header_list " stdint.h" +as_fn_append ac_header_list " inttypes.h" +as_fn_append ac_header_list " threads.h" +as_fn_append ac_func_list " lstat" +as_fn_append ac_header_list " math.h" +as_fn_append ac_func_list " mbsinit" +as_fn_append ac_func_list " mbrtowc" +as_fn_append ac_header_list " sys/mman.h" +as_fn_append ac_func_list " mprotect" +as_fn_append ac_func_list " mkostemp" +as_fn_append ac_func_list " openat" +as_fn_append ac_func_list " link" +as_fn_append ac_func_list " setenv" +as_fn_append ac_func_list " strdup" +as_fn_append ac_func_list " strerror_r" +as_fn_append ac_func_list " __xpg_strerror_r" +as_fn_append ac_func_list " catgets" +as_fn_append ac_func_list " snprintf" +as_fn_append ac_header_list " sys/uio.h" +as_fn_append ac_func_list " localtime_r" +as_fn_append ac_func_list " pipe" +as_fn_append ac_header_list " crtdefs.h" +as_fn_append ac_func_list " iswcntrl" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -3963,6 +4030,100 @@ esac fi fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 @@ -3974,7 +4135,7 @@ See \`config.log' for more details" "$LINENO" 5; } $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; @@ -4360,8 +4521,420 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +$as_echo_n "checking for $CC option to enable C11 features... " >&6; } +if ${ac_cv_prog_cc_c11+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdbool.h> +#include <stddef.h> +#include <stdlib.h> +#include <wchar.h> +#include <stdio.h> + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + v1.i = 2; + v1.w.k = 5; + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +ac_prog_cc_stdc_options= +case "x$ac_cv_prog_cc_c11" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + ac_prog_cc_stdc_options=" $ac_cv_prog_cc_c11" + CC=$CC$ac_prog_cc_stdc_options + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +$as_echo "$ac_cv_prog_cc_c11" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c11" != xno; then : + ac_prog_cc_stdc=c11 + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +$as_echo_n "checking for $CC option to enable C99 features... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdbool.h> +#include <stddef.h> +#include <stdlib.h> +#include <wchar.h> +#include <stdio.h> + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +ac_prog_cc_stdc_options= +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + ac_prog_cc_stdc_options=" $ac_cv_prog_cc_c99" + CC=$CC$ac_prog_cc_stdc_options + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; then : + ac_prog_cc_stdc=c99 + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +$as_echo_n "checking for $CC option to enable C89 features... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else @@ -4434,6 +5007,7 @@ CC=$ac_save_CC fi # AC_CACHE_VAL +ac_prog_cc_stdc_options= case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 @@ -4442,104 +5016,23 @@ $as_echo "none needed" >&6; } ;; { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) - CC="$CC $ac_cv_prog_cc_c89" + ac_prog_cc_stdc_options=" $ac_cv_prog_cc_c89" + CC=$CC$ac_prog_cc_stdc_options { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : - + ac_prog_cc_stdc=c89 + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 +else + ac_prog_cc_stdc=no + ac_cv_prog_cc_stdc=no fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4547,7 +5040,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -5006,6 +5498,10 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + $as_echo "#define _NETBSD_SOURCE 1" >>confdefs.h + + $as_echo "#define _OPENBSD_SOURCE 1" >>confdefs.h + $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h @@ -5072,6 +5568,8 @@ $as_echo "$ac_cv_should_define__xopen_source" >&6; } test $ac_cv_should_define__xopen_source = yes && $as_echo "#define _XOPEN_SOURCE 500" >>confdefs.h + $as_echo "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h + @@ -5117,177 +5615,7 @@ $as_echo "$gl_cv_c_amsterdam_compiler" >&6; } ARFLAGS='-o' fi else - if test -n "$ac_tool_prefix"; then - for ac_prog in ar lib "link -lib" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar lib "link -lib" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -: ${AR=ar} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 -$as_echo_n "checking the archiver ($AR) interface... " >&6; } -if ${am_cv_ar_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - am_cv_ar_interface=ar - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int some_variable = 0; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 - (eval $am_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - am_cv_ar_interface=ar - else - am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 - (eval $am_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - am_cv_ar_interface=lib - else - am_cv_ar_interface=unknown - fi - fi - rm -f conftest.lib libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 -$as_echo "$am_cv_ar_interface" >&6; } - -case $am_cv_ar_interface in -ar) - ;; -lib) - # Microsoft lib, so override with the ar-lib wrapper script. - # FIXME: It is wrong to rewrite AR. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__AR in this case, - # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something - # similar. - AR="$am_aux_dir/ar-lib $AR" - ;; -unknown) - as_fn_error $? "could not determine $AR interface" "$LINENO" 5 - ;; -esac - + : fi if test -n "$ac_tool_prefix"; then @@ -5489,6 +5817,35 @@ fi +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 @@ -5570,7 +5927,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac alpha*) # On Alpha systems, a compiler option provides the behaviour. # See the ieee(3) manual page, also available at - # <http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/0600____.HTM> + # <https://backdrift.org/man/tru64/man3/ieee.3.html> if test -n "$GCC"; then # GCC has the option -mieee. # For full IEEE compliance (rarely needed), use option -mieee-with-inexact. @@ -5796,6 +6153,7 @@ fi + # Check whether --enable-threads was given. if test "${enable_threads+set}" = set; then : enableval=$enable_threads; gl_use_threads=$enableval @@ -5804,21 +6162,34 @@ else gl_use_threads="$gl_use_threads_default" else case "$host_os" in - osf*) gl_use_threads=no ;; - cygwin*) + osf*) gl_use_threads=no ;; + cygwin*) case `uname -r` in 1.[0-5].*) gl_use_threads=no ;; *) gl_use_threads=yes ;; esac ;; + mingw*) + case "$gl_use_winpthreads_default" in + yes) gl_use_threads=posix ;; + no) gl_use_threads=windows ;; + *) gl_use_threads=yes ;; + esac + ;; *) gl_use_threads=yes ;; esac fi fi - if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then - # For using <pthread.h>: + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = isoc \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + # For using <threads.h> or <pthread.h>: + + + if test -z "$gl_anythreadlib_early_done"; then case "$host_os" in osf*) # On OSF/1, the compiler needs the flag -D_REENTRANT so that it @@ -5837,6 +6208,9 @@ fi aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; esac + gl_anythreadlib_early_done=done + fi + fi @@ -5852,13 +6226,14 @@ fi # Code from module arpa_inet: # Code from module assure: # Code from module at-internal: + # Code from module builtin-expect: + # Code from module c99: # Code from module canonicalize-lgpl: # Code from module chdir: # Code from module chdir-long: # Code from module cloexec: # Code from module close: # Code from module closedir: - # Code from module configmake: # Code from module d-ino: # Code from module d-type: # Code from module dirent: @@ -5878,6 +6253,7 @@ fi # Code from module fcntl: # Code from module fcntl-h: # Code from module fd-hook: + # Code from module fd-safer-flag: # Code from module fdopendir: # Code from module filename: # Code from module filenamecat-lgpl: @@ -5885,6 +6261,7 @@ fi # Code from module float: # Code from module fnmatch: # Code from module fnmatch-gnu: + # Code from module fnmatch-h: # Code from module fpieee: # Code from module fpucw: @@ -5900,6 +6277,7 @@ fi # Code from module gettext-h: # Code from module gettimeofday: # Code from module glob: + # Code from module glob-h: # Code from module hard-locale: # Code from module havelib: # Code from module include_next: @@ -5911,8 +6289,10 @@ fi # Code from module isnanl-nolibm: # Code from module largefile: + # Code from module libc-config: # Code from module limits-h: # Code from module localcharset: + # Code from module localtime-buffer: # Code from module lock: # Code from module lstat: # Code from module malloc-posix: @@ -5949,7 +6329,7 @@ fi # Code from module rmdir: # Code from module same-inode: # Code from module save-cwd: - # Code from module secure_getenv: + # Code from module scratch_buffer: # Code from module setenv: # Code from module signal-h: # Code from module snippet/_Noreturn: @@ -5959,6 +6339,8 @@ fi # Code from module socklen: # Code from module ssize_t: # Code from module stat: + # Code from module stat-time: + # Code from module std-gnu11: # Code from module stdalign: # Code from module stdbool: # Code from module stddef: @@ -5995,603 +6377,11 @@ fi # Code from module verify: # Code from module wchar: # Code from module wctype-h: - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdarg.h> -#include <stdio.h> -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu + # Code from module windows-mutex: + # Code from module windows-once: + # Code from module windows-recmutex: + # Code from module windows-rwlock: + # Code from module xalloc-oversized: am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc @@ -7001,6 +6791,26 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + # Check whether --enable-cross-guesses was given. +if test "${enable_cross_guesses+set}" = set; then : + enableval=$enable_cross_guesses; if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: invalid argument supplied to --enable-cross-guesses" >&5 +$as_echo "$as_me: WARNING: invalid argument supplied to --enable-cross-guesses" >&2;} + enableval=conservative + fi + gl_cross_guesses="$enableval" +else + gl_cross_guesses=conservative +fi + + if test $gl_cross_guesses = risky; then + gl_cross_guess_normal="guessing yes" + gl_cross_guess_inverted="guessing no" + else + gl_cross_guess_normal="guessing no" + gl_cross_guess_inverted="guessing yes" + fi LIBC_FATAL_STDERR_=1 export LIBC_FATAL_STDERR_ @@ -7216,11 +7026,11 @@ fi - - for ac_header in $gl_header_list + for ac_header in $ac_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 @@ -7234,8 +7044,6 @@ done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the preprocessor supports include_next" >&5 $as_echo_n "checking whether the preprocessor supports include_next... " >&6; } if ${gl_cv_have_include_next+:} false; then : @@ -7352,21 +7160,30 @@ $as_echo "$gl_cv_pragma_columns" >&6; } + if test $ac_cv_header_features_h = yes; then + HAVE_FEATURES_H=1 + else + HAVE_FEATURES_H=0 + fi - : - + if test $ac_cv_header_sys_socket_h = no; then + for ac_header in ws2tcpip.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "ws2tcpip.h" "ac_cv_header_ws2tcpip_h" "$ac_includes_default" +if test "x$ac_cv_header_ws2tcpip_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_WS2TCPIP_H 1 +_ACEOF +fi - if test $ac_cv_header_features_h = yes; then - HAVE_FEATURES_H=1 - else - HAVE_FEATURES_H=0 - fi +done + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } @@ -7432,12 +7249,14 @@ $as_echo "$MKDIR_P" >&6; } GNULIB_QSORT_R=0; GNULIB_RANDOM=0; GNULIB_RANDOM_R=0; + GNULIB_REALLOCARRAY=0; GNULIB_REALLOC_POSIX=0; GNULIB_REALPATH=0; GNULIB_RPMATCH=0; GNULIB_SECURE_GETENV=0; GNULIB_SETENV=0; GNULIB_STRTOD=0; + GNULIB_STRTOLD=0; GNULIB_STRTOLL=0; GNULIB_STRTOULL=0; GNULIB_SYSTEM_POSIX=0; @@ -7450,6 +7269,9 @@ $as_echo "$MKDIR_P" >&6; } HAVE_DECL_GETLOADAVG=1; HAVE_GETSUBOPT=1; HAVE_GRANTPT=1; + HAVE_INITSTATE=1; + HAVE_DECL_INITSTATE=1; + HAVE_MBTOWC=1; HAVE_MKDTEMP=1; HAVE_MKOSTEMP=1; HAVE_MKOSTEMPS=1; @@ -7462,12 +7284,16 @@ $as_echo "$MKDIR_P" >&6; } HAVE_RANDOM=1; HAVE_RANDOM_H=1; HAVE_RANDOM_R=1; + HAVE_REALLOCARRAY=1; HAVE_REALPATH=1; HAVE_RPMATCH=1; HAVE_SECURE_GETENV=1; HAVE_SETENV=1; HAVE_DECL_SETENV=1; + HAVE_SETSTATE=1; + HAVE_DECL_SETSTATE=1; HAVE_STRTOD=1; + HAVE_STRTOLD=1; HAVE_STRTOLL=1; HAVE_STRTOULL=1; HAVE_STRUCT_RANDOM_DATA=1; @@ -7476,6 +7302,7 @@ $as_echo "$MKDIR_P" >&6; } HAVE_DECL_UNSETENV=1; REPLACE_CALLOC=0; REPLACE_CANONICALIZE_FILE_NAME=0; + REPLACE_INITSTATE=0; REPLACE_MALLOC=0; REPLACE_MBTOWC=0; REPLACE_MKSTEMP=0; @@ -7483,19 +7310,21 @@ $as_echo "$MKDIR_P" >&6; } REPLACE_PTSNAME_R=0; REPLACE_PUTENV=0; REPLACE_QSORT_R=0; + REPLACE_RANDOM=0; REPLACE_RANDOM_R=0; REPLACE_REALLOC=0; REPLACE_REALPATH=0; REPLACE_SETENV=0; + REPLACE_SETSTATE=0; REPLACE_STRTOD=0; + REPLACE_STRTOLD=0; REPLACE_UNSETENV=0; REPLACE_WCTOMB=0; - - for ac_func in $gl_func_list + for ac_func in $ac_func_list do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -7515,14 +7344,6 @@ done - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether // is distinct from /" >&5 $as_echo_n "checking whether // is distinct from /... " >&6; } if ${gl_cv_double_slash_root+:} false; then : @@ -7564,15 +7385,6 @@ $as_echo "#define DOUBLE_SLASH_IS_DISTINCT_ROOT 1" >>confdefs.h - - - - : - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether realpath works" >&5 $as_echo_n "checking whether realpath works... " >&6; } if ${gl_cv_func_realpath_works+:} false; then : @@ -7585,8 +7397,12 @@ else case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_realpath_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_realpath_works="guessing no" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_realpath_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_realpath_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_realpath_works="$gl_cross_guess_normal" ;; esac else @@ -7632,7 +7448,7 @@ nocrash_init (void) /* Allocate a port on which the thread shall listen for exceptions. */ if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) == KERN_SUCCESS) { - /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ if (mach_port_insert_right (self, our_exception_port, our_exception_port, MACH_MSG_TYPE_MAKE_SEND) == KERN_SUCCESS) { @@ -7651,14 +7467,14 @@ nocrash_init (void) for a particular thread. This has the effect that when our exception port gets the message, the thread specific exception port has already been asked, and we don't need to bother about it. - See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ task_set_exception_ports (self, mask, our_exception_port, EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); } } } } -#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> @@ -7779,32 +7595,13 @@ $as_echo "#define FUNC_REALPATH_WORKS 1" >>confdefs.h - : - - - - - - - - - - - - - - - : - - - - - + GNULIB_ACCESS=0; GNULIB_CHDIR=0; GNULIB_CHOWN=0; GNULIB_CLOSE=0; + GNULIB_COPY_FILE_RANGE=0; GNULIB_DUP=0; GNULIB_DUP2=0; GNULIB_DUP3=0; @@ -7824,6 +7621,7 @@ $as_echo "#define FUNC_REALPATH_WORKS 1" >>confdefs.h GNULIB_GETLOGIN=0; GNULIB_GETLOGIN_R=0; GNULIB_GETPAGESIZE=0; + GNULIB_GETPASS=0; GNULIB_GETUSERSHELL=0; GNULIB_GROUP_MEMBER=0; GNULIB_ISATTY=0; @@ -7843,6 +7641,7 @@ $as_echo "#define FUNC_REALPATH_WORKS 1" >>confdefs.h GNULIB_SLEEP=0; GNULIB_SYMLINK=0; GNULIB_SYMLINKAT=0; + GNULIB_TRUNCATE=0; GNULIB_TTYNAME_R=0; GNULIB_UNISTD_H_NONBLOCKING=0; GNULIB_UNISTD_H_SIGPIPE=0; @@ -7851,6 +7650,7 @@ $as_echo "#define FUNC_REALPATH_WORKS 1" >>confdefs.h GNULIB_USLEEP=0; GNULIB_WRITE=0; HAVE_CHOWN=1; + HAVE_COPY_FILE_RANGE=1; HAVE_DUP2=1; HAVE_DUP3=1; HAVE_EUIDACCESS=1; @@ -7865,6 +7665,7 @@ $as_echo "#define FUNC_REALPATH_WORKS 1" >>confdefs.h HAVE_GETHOSTNAME=1; HAVE_GETLOGIN=1; HAVE_GETPAGESIZE=1; + HAVE_GETPASS=1; HAVE_GROUP_MEMBER=1; HAVE_LCHOWN=1; HAVE_LINK=1; @@ -7885,17 +7686,21 @@ $as_echo "#define FUNC_REALPATH_WORKS 1" >>confdefs.h HAVE_DECL_FCHDIR=1; HAVE_DECL_FDATASYNC=1; HAVE_DECL_GETDOMAINNAME=1; + HAVE_DECL_GETLOGIN=1; HAVE_DECL_GETLOGIN_R=1; HAVE_DECL_GETPAGESIZE=1; HAVE_DECL_GETUSERSHELL=1; HAVE_DECL_SETHOSTNAME=1; + HAVE_DECL_TRUNCATE=1; HAVE_DECL_TTYNAME_R=1; HAVE_OS_H=0; HAVE_SYS_PARAM_H=0; + REPLACE_ACCESS=0; REPLACE_CHOWN=0; REPLACE_CLOSE=0; REPLACE_DUP=0; REPLACE_DUP2=0; + REPLACE_FACCESSAT=0; REPLACE_FCHOWNAT=0; REPLACE_FTRUNCATE=0; REPLACE_GETCWD=0; @@ -7904,6 +7709,7 @@ $as_echo "#define FUNC_REALPATH_WORKS 1" >>confdefs.h REPLACE_GETLOGIN_R=0; REPLACE_GETGROUPS=0; REPLACE_GETPAGESIZE=0; + REPLACE_GETPASS=0; REPLACE_ISATTY=0; REPLACE_LCHOWN=0; REPLACE_LINK=0; @@ -7918,6 +7724,7 @@ $as_echo "#define FUNC_REALPATH_WORKS 1" >>confdefs.h REPLACE_SLEEP=0; REPLACE_SYMLINK=0; REPLACE_SYMLINKAT=0; + REPLACE_TRUNCATE=0; REPLACE_TTYNAME_R=0; REPLACE_UNLINK=0; REPLACE_UNLINKAT=0; @@ -7934,27 +7741,6 @@ $as_echo "#define FUNC_REALPATH_WORKS 1" >>confdefs.h - : - - - - - - - - - - - - - - - - - : - - - if test $ac_cv_func__set_invalid_parameter_handler = yes; then @@ -7970,14 +7756,6 @@ $as_echo "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h - - - - - - - - GNULIB_OPENDIR=0; GNULIB_READDIR=0; GNULIB_REWINDDIR=0; @@ -8009,22 +7787,12 @@ $as_echo "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h - - : - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if environ is properly declared" >&5 $as_echo_n "checking if environ is properly declared... " >&6; } - if ${gt_cv_var_environ_declaration+:} false; then : +if ${gt_cv_var_environ_declaration+:} false; then : $as_echo_n "(cached) " >&6 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if HAVE_UNISTD_H #include <unistd.h> @@ -8032,7 +7800,7 @@ else /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */ #include <stdlib.h> - extern struct { int foo; } environ; + extern struct { int foo; } environ; int main () { @@ -8048,8 +7816,7 @@ else fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_var_environ_declaration" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_var_environ_declaration" >&5 $as_echo "$gt_cv_var_environ_declaration" >&6; } if test $gt_cv_var_environ_declaration = yes; then @@ -8438,22 +8205,102 @@ $as_echo "$gl_cv_header_errno_h_EOVERFLOW" >&6; } fi +ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" +if test "x$ac_cv_have_decl_strerror_r" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R $ac_have_decl +_ACEOF -$as_echo "#define HAVE_DECL_STRERROR_R 1" >>confdefs.h +for ac_func in strerror_r +do : + ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" +if test "x$ac_cv_func_strerror_r" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STRERROR_R 1 +_ACEOF +fi +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 +$as_echo_n "checking whether strerror_r returns char *... " >&6; } +if ${ac_cv_func_strerror_r_char_p+:} false; then : + $as_echo_n "(cached) " >&6 +else -$as_echo "#define HAVE_STRERROR_R 1" >>confdefs.h + ac_cv_func_strerror_r_char_p=no + if test $ac_cv_have_decl_strerror_r = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + char *p = strerror_r (0, buf, sizeof buf); + return !p || x; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_func_strerror_r_char_p=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + else + # strerror_r is not declared. Choose between + # systems that have relatively inaccessible declarations for the + # function. BeOS and DEC UNIX 4.0 fall in this category, but the + # former has a strerror_r that returns char*, while the latter + # has a strerror_r that returns `int'. + # This test should segfault on the DEC system. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + extern char *strerror_r (); +int +main () +{ +char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + return ! isalpha (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_strerror_r_char_p=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + fi -$as_echo "#define STRERROR_R_CHAR_P 0" >>confdefs.h +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 +$as_echo "$ac_cv_func_strerror_r_char_p" >&6; } +if test $ac_cv_func_strerror_r_char_p = yes; then +$as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h +fi - ac_fn_c_check_decl "$LINENO" "fchdir" "ac_cv_have_decl_fchdir" "$ac_includes_default" +ac_fn_c_check_decl "$LINENO" "fchdir" "ac_cv_have_decl_fchdir" "$ac_includes_default" if test "x$ac_cv_have_decl_fchdir" = xyes; then : ac_have_decl=1 else @@ -8465,13 +8312,14 @@ cat >>confdefs.h <<_ACEOF _ACEOF - + GNULIB_CREAT=0; GNULIB_FCNTL=0; GNULIB_NONBLOCKING=0; GNULIB_OPEN=0; GNULIB_OPENAT=0; HAVE_FCNTL=1; HAVE_OPENAT=1; + REPLACE_CREAT=0; REPLACE_FCNTL=0; REPLACE_OPEN=0; REPLACE_OPENAT=0; @@ -8485,31 +8333,18 @@ _ACEOF - - - - - - : - - - - - - - : - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fcntl.h" >&5 $as_echo_n "checking for working fcntl.h... " >&6; } if ${gl_cv_header_working_fcntl_h+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : - gl_cv_header_working_fcntl_h=cross-compiling + case "$host_os" in + # Guess 'no' on native Windows. + mingw*) gl_cv_header_working_fcntl_h='no' ;; + *) gl_cv_header_working_fcntl_h=cross-compiling ;; + esac + else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8620,6 +8455,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_fcntl_h" >&5 $as_echo "$gl_cv_header_working_fcntl_h" >&6; } @@ -8671,6 +8507,124 @@ fi + GNULIB_FNMATCH=0; + HAVE_FNMATCH=1; + REPLACE_FNMATCH=0; + + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_fnmatch_h='<'fnmatch.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <fnmatch.h>" >&5 +$as_echo_n "checking absolute name of <fnmatch.h>... " >&6; } +if ${gl_cv_next_fnmatch_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_fnmatch_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <fnmatch.h> +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'fnmatch.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_fnmatch_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_fnmatch_h + gl_cv_next_fnmatch_h='"'$gl_header'"' + else + gl_cv_next_fnmatch_h='<'fnmatch.h'>' + fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_fnmatch_h" >&5 +$as_echo "$gl_cv_next_fnmatch_h" >&6; } + fi + NEXT_FNMATCH_H=$gl_cv_next_fnmatch_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'fnmatch.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_fnmatch_h + fi + NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H=$gl_next_as_first_directive + + + + + + + + if test $ac_cv_header_fnmatch_h = yes; then + HAVE_FNMATCH_H=1 + else + HAVE_FNMATCH_H=0 + fi + + + FNMATCH_H='' + if false; then + FNMATCH_H=fnmatch.h + else + if test $ac_cv_header_fnmatch_h != yes; then + FNMATCH_H=fnmatch.h + fi + fi + + + if test -n "$FNMATCH_H"; then + GL_GENERATE_FNMATCH_H_TRUE= + GL_GENERATE_FNMATCH_H_FALSE='#' +else + GL_GENERATE_FNMATCH_H_TRUE='#' + GL_GENERATE_FNMATCH_H_FALSE= +fi + + + @@ -8738,30 +8692,6 @@ $as_echo "#define mbstate_t int" >>confdefs.h - - - - - - - - - - - - - - - - - - - - - - - - GNULIB_ACOSF=0; GNULIB_ACOSL=0; GNULIB_ASINF=0; @@ -8953,13 +8883,22 @@ $as_echo "#define mbstate_t int" >>confdefs.h HAVE_DECL_TRUNC=1; HAVE_DECL_TRUNCF=1; HAVE_DECL_TRUNCL=1; + REPLACE_ACOSF=0; + REPLACE_ASINF=0; + REPLACE_ATANF=0; + REPLACE_ATAN2F=0; REPLACE_CBRTF=0; REPLACE_CBRTL=0; REPLACE_CEIL=0; REPLACE_CEILF=0; REPLACE_CEILL=0; + REPLACE_COSF=0; + REPLACE_COSHF=0; + REPLACE_EXPF=0; + REPLACE_EXPL=0; REPLACE_EXPM1=0; REPLACE_EXPM1F=0; + REPLACE_EXPM1L=0; REPLACE_EXP2=0; REPLACE_EXP2L=0; REPLACE_FABSL=0; @@ -8981,6 +8920,7 @@ $as_echo "#define mbstate_t int" >>confdefs.h REPLACE_HYPOTL=0; REPLACE_ILOGB=0; REPLACE_ILOGBF=0; + REPLACE_ILOGBL=0; REPLACE_ISFINITE=0; REPLACE_ISINF=0; REPLACE_ISNAN=0; @@ -9007,12 +8947,18 @@ $as_echo "#define mbstate_t int" >>confdefs.h REPLACE_REMAINDER=0; REPLACE_REMAINDERF=0; REPLACE_REMAINDERL=0; + REPLACE_RINTL=0; REPLACE_ROUND=0; REPLACE_ROUNDF=0; REPLACE_ROUNDL=0; REPLACE_SIGNBIT=0; REPLACE_SIGNBIT_USING_GCC=0; + REPLACE_SINF=0; + REPLACE_SINHF=0; + REPLACE_SQRTF=0; REPLACE_SQRTL=0; + REPLACE_TANF=0; + REPLACE_TANHF=0; REPLACE_TRUNC=0; REPLACE_TRUNCF=0; REPLACE_TRUNCL=0; @@ -9048,8 +8994,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexp_no_libm" >&5 $as_echo "$gl_cv_func_frexp_no_libm" >&6; } - - ac_fn_c_check_decl "$LINENO" "alarm" "ac_cv_have_decl_alarm" "$ac_includes_default" +ac_fn_c_check_decl "$LINENO" "alarm" "ac_cv_have_decl_alarm" "$ac_includes_default" if test "x$ac_cv_have_decl_alarm" = xyes; then : ac_have_decl=1 else @@ -9062,6 +9007,180 @@ _ACEOF + + FREXP_LIBM= + if test $gl_cv_func_frexp_no_libm = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexp() can be used with libm" >&5 +$as_echo_n "checking whether frexp() can be used with libm... " >&6; } +if ${gl_cv_func_frexp_in_libm+:} false; then : + $as_echo_n "(cached) " >&6 +else + + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <math.h> + double x; +int +main () +{ +int e; return frexp (x, &e) > 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_func_frexp_in_libm=yes +else + gl_cv_func_frexp_in_libm=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexp_in_libm" >&5 +$as_echo "$gl_cv_func_frexp_in_libm" >&6; } + if test $gl_cv_func_frexp_in_libm = yes; then + FREXP_LIBM=-lm + fi + fi + if test $gl_cv_func_frexp_no_libm = yes \ + || test $gl_cv_func_frexp_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $FREXP_LIBM" + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexp works" >&5 +$as_echo_n "checking whether frexp works... " >&6; } +if ${gl_cv_func_frexp_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + case "$host_os" in + netbsd* | irix*) gl_cv_func_frexp_works="guessing no" ;; + mingw*) # Guess yes with MSVC, no with mingw. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Good +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Good" >/dev/null 2>&1; then : + gl_cv_func_frexp_works="guessing yes" +else + gl_cv_func_frexp_works="guessing no" +fi +rm -f conftest* + + ;; + *) gl_cv_func_frexp_works="guessing yes" ;; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <float.h> +#include <math.h> +#include <string.h> +#if HAVE_DECL_ALARM +# include <signal.h> +# include <unistd.h> +#endif +/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. + ICC 10.0 has a bug when optimizing the expression -zero. + The expression -DBL_MIN * DBL_MIN does not work when cross-compiling + to PowerPC on Mac OS X 10.5. */ +#if defined __hpux || defined __sgi || defined __ICC +static double +compute_minus_zero (void) +{ + return -DBL_MIN * DBL_MIN; +} +# define minus_zero compute_minus_zero () +#else +double minus_zero = -0.0; +#endif +int main() +{ + int result = 0; + int i; + volatile double x; + double zero = 0.0; +#if HAVE_DECL_ALARM + /* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite + number. Let the test fail in this case. */ + signal (SIGALRM, SIG_DFL); + alarm (5); +#endif + /* Test on denormalized numbers. */ + for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) + ; + if (x > 0.0) + { + int exp; + double y = frexp (x, &exp); + /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. + On NetBSD: y = 0.75. Correct: y = 0.5. */ + if (y != 0.5) + result |= 1; + } + /* Test on infinite numbers. */ + x = 1.0 / zero; + { + int exp; + double y = frexp (x, &exp); + if (y != x) + result |= 2; + } + /* Test on negative zero. */ + x = minus_zero; + { + int exp; + double y = frexp (x, &exp); + if (memcmp (&y, &x, sizeof x)) + result |= 4; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_frexp_works=yes +else + gl_cv_func_frexp_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexp_works" >&5 +$as_echo "$gl_cv_func_frexp_works" >&6; } + + LIBS="$save_LIBS" + case "$gl_cv_func_frexp_works" in + *yes) gl_func_frexp=yes ;; + *) gl_func_frexp=no; REPLACE_FREXP=1; FREXP_LIBM= ;; + esac + else + gl_func_frexp=no + fi + if test $gl_func_frexp = yes; then + +$as_echo "#define HAVE_FREXP 1" >>confdefs.h + + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether long double and double are the same" >&5 $as_echo_n "checking whether long double and double are the same... " >&6; } if ${gl_cv_long_double_equals_double+:} false; then : @@ -9104,6 +9223,246 @@ $as_echo "#define HAVE_SAME_LONG_DOUBLE_AS_DOUBLE 1" >>confdefs.h + + + + + + ac_fn_c_check_decl "$LINENO" "frexpl" "ac_cv_have_decl_frexpl" "#include <math.h> +" +if test "x$ac_cv_have_decl_frexpl" = xyes; then : + +else + HAVE_DECL_FREXPL=0 +fi + + + FREXPL_LIBM= + if test $HAVE_DECL_FREXPL = 1; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl() can be used without linking with libm" >&5 +$as_echo_n "checking whether frexpl() can be used without linking with libm... " >&6; } +if ${gl_cv_func_frexpl_no_libm+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <math.h> + long double x; +int +main () +{ +int e; return frexpl (x, &e) > 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_func_frexpl_no_libm=yes +else + gl_cv_func_frexpl_no_libm=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_no_libm" >&5 +$as_echo "$gl_cv_func_frexpl_no_libm" >&6; } + + if test $gl_cv_func_frexpl_no_libm = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl() can be used with libm" >&5 +$as_echo_n "checking whether frexpl() can be used with libm... " >&6; } +if ${gl_cv_func_frexpl_in_libm+:} false; then : + $as_echo_n "(cached) " >&6 +else + + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <math.h> + long double x; +int +main () +{ +int e; return frexpl (x, &e) > 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_func_frexpl_in_libm=yes +else + gl_cv_func_frexpl_in_libm=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_in_libm" >&5 +$as_echo "$gl_cv_func_frexpl_in_libm" >&6; } + if test $gl_cv_func_frexpl_in_libm = yes; then + FREXPL_LIBM=-lm + fi + fi + if test $gl_cv_func_frexpl_no_libm = yes \ + || test $gl_cv_func_frexpl_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $FREXPL_LIBM" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl works" >&5 +$as_echo_n "checking whether frexpl works... " >&6; } +if ${gl_cv_func_frexpl_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + + case "$host_os" in + aix | aix[3-6]* | beos* | darwin* | irix* | mingw* | pw*) + gl_cv_func_frexpl_works="guessing no";; + *) gl_cv_func_frexpl_works="guessing yes";; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <float.h> +#include <math.h> +/* Override the values of <float.h>, like done in float.in.h. */ +#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +#endif +#if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__) +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +#endif +#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP DBL_MIN_EXP +#endif +#if defined __sgi && (LDBL_MANT_DIG >= 106) +# if defined __GNUC__ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP DBL_MIN_EXP +# endif +#endif +extern +#ifdef __cplusplus +"C" +#endif +long double frexpl (long double, int *); +int main() +{ + int result = 0; + volatile long double x; + /* Test on finite numbers that fails on AIX 5.1. */ + x = 16.0L; + { + int exp = -9999; + frexpl (x, &exp); + if (exp != 5) + result |= 1; + } + /* Test on finite numbers that fails on Mac OS X 10.4, because its frexpl + function returns an invalid (incorrectly normalized) value: it returns + y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } + but the correct result is + 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ + x = 1.01L; + { + int exp = -9999; + long double y = frexpl (x, &exp); + if (!(exp == 1 && y == 0.505L)) + result |= 2; + } + /* Test on large finite numbers. This fails on BeOS at i = 16322, while + LDBL_MAX_EXP = 16384. + In the loop end test, we test x against Infinity, rather than comparing + i with LDBL_MAX_EXP, because BeOS <float.h> has a wrong LDBL_MAX_EXP. */ + { + int i; + for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) + { + int exp = -9999; + frexpl (x, &exp); + if (exp != i) + { + result |= 4; + break; + } + } + } + /* Test on denormalized numbers. */ + { + int i; + for (i = 1, x = 1.0L; i >= LDBL_MIN_EXP; i--, x *= 0.5L) + ; + if (x > 0.0L) + { + int exp; + long double y = frexpl (x, &exp); + /* On machines with IEEE854 arithmetic: x = 1.68105e-4932, + exp = -16382, y = 0.5. On Mac OS X 10.5: exp = -16384, y = 0.5. */ + if (exp != LDBL_MIN_EXP - 1) + result |= 8; + } + } + /* Test on infinite numbers. */ + x = 1.0L / 0.0L; + { + int exp; + long double y = frexpl (x, &exp); + if (y != x) + result |= 16; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_frexpl_works=yes +else + gl_cv_func_frexpl_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_works" >&5 +$as_echo "$gl_cv_func_frexpl_works" >&6; } + + LIBS="$save_LIBS" + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl=yes ;; + *) gl_func_frexpl=no; REPLACE_FREXPL=1 ;; + esac + else + gl_func_frexpl=no + fi + if test $gl_func_frexpl = yes; then + +$as_echo "#define HAVE_FREXPL 1" >>confdefs.h + + fi + fi + if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; then + if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then + + FREXPL_LIBM="$FREXP_LIBM" + else + FREXPL_LIBM= + fi + fi + + + GNULIB_FCHMODAT=0; GNULIB_FSTAT=0; GNULIB_FSTATAT=0; @@ -9117,6 +9476,7 @@ $as_echo "#define HAVE_SAME_LONG_DOUBLE_AS_DOUBLE 1" >>confdefs.h GNULIB_MKNODAT=0; GNULIB_STAT=0; GNULIB_UTIMENSAT=0; + GNULIB_OVERRIDES_STRUCT_STAT=0; HAVE_FCHMODAT=1; HAVE_FSTATAT=1; HAVE_FUTIMENS=1; @@ -9184,9 +9544,6 @@ fi - - - case "$host_os" in mingw*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit off_t" >&5 @@ -9222,7 +9579,40 @@ $as_echo "$gl_cv_type_off_t_64" >&6; } else WINDOWS_64_BIT_OFF_T=0 fi - WINDOWS_64_BIT_ST_SIZE=1 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit st_size" >&5 +$as_echo_n "checking for 64-bit st_size... " >&6; } +if ${gl_cv_member_st_size_64+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> + struct stat buf; + int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_member_st_size_64=yes +else + gl_cv_member_st_size_64=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_member_st_size_64" >&5 +$as_echo "$gl_cv_member_st_size_64" >&6; } + if test $gl_cv_member_st_size_64 = no; then + WINDOWS_64_BIT_ST_SIZE=1 + else + WINDOWS_64_BIT_ST_SIZE=0 + fi ;; *) WINDOWS_64_BIT_OFF_T=0 @@ -9241,12 +9631,6 @@ $as_echo "$gl_cv_type_off_t_64" >&6; } - : - - - - - @@ -9323,14 +9707,14 @@ $as_echo "$gl_cv_next_sys_stat_h" >&6; } + WINDOWS_STAT_TIMESPEC=0 + + - if test $WINDOWS_64_BIT_ST_SIZE = 1; then -$as_echo "#define _GL_WINDOWS_64_BIT_ST_SIZE 1" >>confdefs.h - fi ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include <sys/types.h> #include <sys/stat.h> @@ -9345,48 +9729,11 @@ fi - for gl_func in fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat mknod mknodat stat utimensat; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <sys/stat.h> - -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - eval ac_cv_have_decl_$gl_func=yes -fi - done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } if ${gl_cv_func_lstat_dereferences_slashed_symlink+:} false; then : $as_echo_n "(cached) " >&6 @@ -9395,12 +9742,18 @@ else echo >conftest.file if test "$cross_compiling" = yes; then : case "$host_os" in - *-gnu*) + 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" ;; - *) - # If we don't know, assume the worst. + mingw*) + # Guess no on native Windows. gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; + *) + # If we don't know, obey --enable-cross-guesses. + gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; esac else @@ -9450,15 +9803,6 @@ _ACEOF - - - - : - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getcwd (NULL, 0) allocates memory for result" >&5 $as_echo_n "checking whether getcwd (NULL, 0) allocates memory for result... " >&6; } if ${gl_cv_func_getcwd_null+:} false; then : @@ -9466,12 +9810,14 @@ if ${gl_cv_func_getcwd_null+:} false; then : else if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_getcwd_null="guessing yes";; - # Guess yes on Cygwin. - cygwin*) gl_cv_func_getcwd_null="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_getcwd_null="guessing no";; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_getcwd_null="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_getcwd_null="guessing yes";; + # Guess yes on Cygwin. + cygwin*) gl_cv_func_getcwd_null="guessing yes";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_getcwd_null="$gl_cross_guess_normal";; esac else @@ -9492,7 +9838,7 @@ int main () { -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ /* mingw cwd does not start with '/', but getcwd does allocate. However, mingw fails to honor non-zero size. */ #else @@ -9504,9 +9850,9 @@ main () if (! f) return 2; if (f[0] != '/') - return 3; + { free (f); return 3; } if (f[1] != '\0') - return 4; + { free (f); return 4; } free (f); return 0; } @@ -9563,8 +9909,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getcwd_posix_signature" >&5 $as_echo "$gl_cv_func_getcwd_posix_signature" >&6; } - - ac_fn_c_check_decl "$LINENO" "getcwd" "ac_cv_have_decl_getcwd" "$ac_includes_default" +ac_fn_c_check_decl "$LINENO" "getcwd" "ac_cv_have_decl_getcwd" "$ac_includes_default" if test "x$ac_cv_have_decl_getcwd" = xyes; then : ac_have_decl=1 else @@ -9577,12 +9922,7 @@ _ACEOF - - - - - - ac_fn_c_check_decl "$LINENO" "getdtablesize" "ac_cv_have_decl_getdtablesize" "$ac_includes_default" +ac_fn_c_check_decl "$LINENO" "getdtablesize" "ac_cv_have_decl_getdtablesize" "$ac_includes_default" if test "x$ac_cv_have_decl_getdtablesize" = xyes; then : ac_have_decl=1 else @@ -9593,9 +9933,7 @@ cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETDTABLESIZE $ac_have_decl _ACEOF - - - ac_fn_c_check_decl "$LINENO" "getlogin_r" "ac_cv_have_decl_getlogin_r" "$ac_includes_default" +ac_fn_c_check_decl "$LINENO" "getlogin_r" "ac_cv_have_decl_getlogin_r" "$ac_includes_default" if test "x$ac_cv_have_decl_getlogin_r" = xyes; then : ac_have_decl=1 else @@ -9608,12 +9946,7 @@ _ACEOF - - - - - - ac_fn_c_check_decl "$LINENO" "getlogin" "ac_cv_have_decl_getlogin" "$ac_includes_default" +ac_fn_c_check_decl "$LINENO" "getlogin" "ac_cv_have_decl_getlogin" "$ac_includes_default" if test "x$ac_cv_have_decl_getlogin" = xyes; then : ac_have_decl=1 else @@ -9626,6 +9959,12 @@ _ACEOF + case $host_os in + mingw*) + LIB_GETLOGIN='-ladvapi32' ;; + *) + LIB_GETLOGIN= ;; + esac @@ -9633,7 +9972,12 @@ _ACEOF - + GNULIB_GETTIMEOFDAY=0; + HAVE_GETTIMEOFDAY=1; + HAVE_STRUCT_TIMEVAL=1; + HAVE_SYS_TIME_H=1; + REPLACE_GETTIMEOFDAY=0; + REPLACE_STRUCT_TIMEVAL=0; { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 $as_echo_n "checking for C/C++ restrict keyword... " >&6; } @@ -9646,17 +9990,17 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ typedef int *int_ptr; - int foo (int_ptr $ac_kw ip) { return ip[0]; } - int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ - int bar (int ip[$ac_kw]) { return ip[0]; } + int foo (int_ptr $ac_kw ip) { return ip[0]; } + int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ + int bar (int ip[$ac_kw]) { return ip[0]; } int main () { int s[1]; - int *$ac_kw t = s; - t[0] = 0; - return foo (t) + bar (t); + int *$ac_kw t = s; + t[0] = 0; + return foo (t) + bar (t); ; return 0; @@ -9684,26 +10028,6 @@ _ACEOF esac - GNULIB_GETTIMEOFDAY=0; - HAVE_GETTIMEOFDAY=1; - HAVE_STRUCT_TIMEVAL=1; - HAVE_SYS_TIME_H=1; - HAVE_TIMEZONE_T=0; - REPLACE_GETTIMEOFDAY=0; - REPLACE_STRUCT_TIMEVAL=0; - - - - - - - - - - - : - - @@ -9713,10 +10037,6 @@ _ACEOF - : - - - @@ -9800,12 +10120,6 @@ $as_echo "$gl_cv_next_sys_time_h" >&6; } - : - - - - - if test $ac_cv_header_sys_socket_h != yes; then for ac_header in winsock2.h do : @@ -9908,59 +10222,163 @@ $as_echo "$gl_cv_sys_struct_timeval_tv_sec" >&6; } fi - for gl_func in gettimeofday; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : + + + + + + + + + + NEED_LOCALTIME_BUFFER=0 + + + GNULIB_CTIME=0; + GNULIB_MKTIME=0; + GNULIB_LOCALTIME=0; + GNULIB_NANOSLEEP=0; + GNULIB_STRFTIME=0; + GNULIB_STRPTIME=0; + GNULIB_TIMEGM=0; + GNULIB_TIME_R=0; + GNULIB_TIME_RZ=0; + GNULIB_TZSET=0; + HAVE_DECL_LOCALTIME_R=1; + HAVE_NANOSLEEP=1; + HAVE_STRPTIME=1; + HAVE_TIMEGM=1; + HAVE_TZSET=1; + HAVE_TIMEZONE_T=0; + REPLACE_CTIME=GNULIB_PORTCHECK; + REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; + REPLACE_MKTIME=GNULIB_PORTCHECK; + REPLACE_NANOSLEEP=GNULIB_PORTCHECK; + REPLACE_STRFTIME=GNULIB_PORTCHECK; + REPLACE_TIMEGM=GNULIB_PORTCHECK; + REPLACE_TZSET=GNULIB_PORTCHECK; + + : ${GNULIB_GETTIMEOFDAY=0}; + REPLACE_GMTIME=0; + REPLACE_LOCALTIME=0; + + + GNULIB_GLOB=0; + HAVE_GLOB=1; + HAVE_GLOB_PATTERN_P=1; + REPLACE_GLOB=0; + REPLACE_GLOB_PATTERN_P=0; + + + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_glob_h='<'glob.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <glob.h>" >&5 +$as_echo_n "checking absolute name of <glob.h>... " >&6; } +if ${gl_cv_next_glob_h+:} false; then : $as_echo_n "(cached) " >&6 else + + if test $ac_cv_header_glob_h = yes; then + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include <glob.h> +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac -#if HAVE_SYS_TIME_H -# include <sys/time.h> -#endif -#include <time.h> + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'glob.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF + gl_cv_absolute_glob_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` - eval ac_cv_have_decl_$gl_func=yes -fi - done + gl_header=$gl_cv_absolute_glob_h + gl_cv_next_glob_h='"'$gl_header'"' + else + gl_cv_next_glob_h='<'glob.h'>' + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_glob_h" >&5 +$as_echo "$gl_cv_next_glob_h" >&6; } + fi + NEXT_GLOB_H=$gl_cv_next_glob_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'glob.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_glob_h + fi + NEXT_AS_FIRST_DIRECTIVE_GLOB_H=$gl_next_as_first_directive + if test $ac_cv_header_glob_h = yes; then + HAVE_GLOB_H=1 + else + HAVE_GLOB_H=0 + fi + GLOB_H='' + if false; then + GLOB_H=glob.h + else + if test $ac_cv_header_glob_h != yes; then + GLOB_H=glob.h + fi + fi + if test -n "$GLOB_H"; then + GL_GENERATE_GLOB_H_TRUE= + GL_GENERATE_GLOB_H_FALSE='#' +else + GL_GENERATE_GLOB_H_TRUE='#' + GL_GENERATE_GLOB_H_FALSE= +fi @@ -9998,28 +10416,6 @@ fi HAVE_ACCEPT4=1; - : - - - - - - if test $ac_cv_header_sys_socket_h = no; then - for ac_header in ws2tcpip.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "ws2tcpip.h" "ac_cv_header_ws2tcpip_h" "$ac_includes_default" -if test "x$ac_cv_header_ws2tcpip_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_WS2TCPIP_H 1 -_ACEOF - -fi - -done - - fi - - @@ -10112,12 +10508,6 @@ $as_echo "$gl_cv_header_sys_socket_h_shut" >&6; } - : - - - - - @@ -10192,9 +10582,15 @@ $as_echo "$gl_cv_next_sys_socket_h" >&6; } if test $ac_cv_header_sys_socket_h = yes; then HAVE_SYS_SOCKET_H=1 - HAVE_WS2TCPIP_H=0 else HAVE_SYS_SOCKET_H=0 + fi + + + + if test $ac_cv_header_sys_socket_h = yes; then + HAVE_WS2TCPIP_H=0 + else if test $ac_cv_header_ws2tcpip_h = yes; then HAVE_WS2TCPIP_H=1 else @@ -10283,12 +10679,6 @@ fi - : - - - - - if test $ac_cv_header_sys_socket_h != yes; then for ac_header in winsock2.h do : @@ -10314,67 +10704,18 @@ done - for gl_func in socket connect accept bind getpeername getsockname getsockopt listen recv send recvfrom sendto setsockopt shutdown accept4; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Some systems require prerequisite headers. */ -#include <sys/types.h> -#include <sys/socket.h> - -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - - eval ac_cv_have_decl_$gl_func=yes -fi - done - - - - - - : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IPv4 sockets" >&5 $as_echo_n "checking for IPv4 sockets... " >&6; } - if ${gl_cv_socket_ipv4+:} false; then : +if ${gl_cv_socket_ipv4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10405,8 +10746,7 @@ else fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_socket_ipv4" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_socket_ipv4" >&5 $as_echo "$gl_cv_socket_ipv4" >&6; } if test $gl_cv_socket_ipv4 = yes; then @@ -10416,7 +10756,7 @@ $as_echo "#define HAVE_IPV4 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IPv6 sockets" >&5 $as_echo_n "checking for IPv6 sockets... " >&6; } - if ${gl_cv_socket_ipv6+:} false; then : +if ${gl_cv_socket_ipv6+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10450,8 +10790,7 @@ else fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_socket_ipv6" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_socket_ipv6" >&5 $as_echo "$gl_cv_socket_ipv6" >&6; } if test $gl_cv_socket_ipv6 = yes; then @@ -10471,15 +10810,6 @@ $as_echo "#define HAVE_IPV6 1" >>confdefs.h - : - - - - - - - - if test $gl_cv_have_include_next = yes; then gl_cv_next_limits_h='<'limits.h'>' else @@ -10550,18 +10880,21 @@ $as_echo "$gl_cv_next_limits_h" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether limits.h has ULLONG_WIDTH etc." >&5 -$as_echo_n "checking whether limits.h has ULLONG_WIDTH etc.... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc." >&5 +$as_echo_n "checking whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc.... " >&6; } if ${gl_cv_header_limits_width+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ - #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 - #endif - #include <limits.h> - int ullw = ULLONG_WIDTH; + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include <limits.h> + long long llm = LLONG_MAX; + int wb = WORD_BIT; + int ullw = ULLONG_WIDTH; + int main () { @@ -10595,6 +10928,93 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wint_t" >&5 +$as_echo_n "checking for wint_t... " >&6; } +if ${gt_cv_c_wint_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included + before <wchar.h>. */ +#include <stddef.h> +#include <stdio.h> +#include <time.h> +#include <wchar.h> + wint_t foo = (wchar_t)'\0'; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gt_cv_c_wint_t=yes +else + gt_cv_c_wint_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wint_t" >&5 +$as_echo "$gt_cv_c_wint_t" >&6; } + if test $gt_cv_c_wint_t = yes; then + +$as_echo "#define HAVE_WINT_T 1" >>confdefs.h + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wint_t is too small" >&5 +$as_echo_n "checking whether wint_t is too small... " >&6; } +if ${gl_cv_type_wint_t_too_small+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be + included before <wchar.h>. */ +#if !(defined __GLIBC__ && !defined __UCLIBC__) +# include <stddef.h> +# include <stdio.h> +# include <time.h> +#endif +#include <wchar.h> + int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1]; + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_type_wint_t_too_small=no +else + gl_cv_type_wint_t_too_small=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wint_t_too_small" >&5 +$as_echo "$gl_cv_type_wint_t_too_small" >&6; } + if test $gl_cv_type_wint_t_too_small = yes; then + GNULIB_OVERRIDES_WINT_T=1 + else + GNULIB_OVERRIDES_WINT_T=0 + fi + else + GNULIB_OVERRIDES_WINT_T=0 + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 $as_echo_n "checking for unsigned long long int... " >&6; } if ${ac_cv_type_unsigned_long_long_int+:} false; then : @@ -10716,12 +11136,6 @@ $as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h - - - - - - gl_cv_c_multiarch=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -10768,6 +11182,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_type_long_long_int = yes; then HAVE_LONG_LONG_INT=1 else @@ -10783,12 +11198,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - : - - - - - if test $ac_cv_header_wchar_h = yes; then HAVE_WCHAR_H=1 else @@ -10816,12 +11225,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - : - - - - - @@ -11084,7 +11487,12 @@ main () _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if test "$cross_compiling" = yes; then : - gl_cv_header_working_stdint_h=yes + case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; + # In general, assume it works. + *) gl_cv_header_working_stdint_h="guessing yes" ;; + esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11184,15 +11592,16 @@ $as_echo "$gl_cv_header_working_stdint_h" >&6; } 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h predates C++11" >&5 + case "$gl_cv_header_working_stdint_h" in + *yes) + HAVE_C99_STDINT_H=1 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h predates C++11" >&5 $as_echo_n "checking whether stdint.h predates C++11... " >&6; } if ${gl_cv_header_stdint_predates_cxx11_h+:} false; then : $as_echo_n "(cached) " >&6 else gl_cv_header_stdint_predates_cxx11_h=yes - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -11230,29 +11639,29 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_predates_cxx11_h" >&5 $as_echo "$gl_cv_header_stdint_predates_cxx11_h" >&6; } - if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then + if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then $as_echo "#define __STDC_CONSTANT_MACROS 1" >>confdefs.h $as_echo "#define __STDC_LIMIT_MACROS 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h has UINTMAX_WIDTH etc." >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h has UINTMAX_WIDTH etc." >&5 $as_echo_n "checking whether stdint.h has UINTMAX_WIDTH etc.... " >&6; } if ${gl_cv_header_stdint_width+:} false; then : $as_echo_n "(cached) " >&6 else gl_cv_header_stdint_width=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - /* 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 <stdint.h> + /* 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 <stdint.h> /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included before <wchar.h>. */ @@ -11264,7 +11673,7 @@ else # include <wchar.h> #endif - int iw = UINTMAX_WIDTH; + int iw = UINTMAX_WIDTH; int main () @@ -11281,11 +11690,12 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_width" >&5 $as_echo "$gl_cv_header_stdint_width" >&6; } - if test "$gl_cv_header_stdint_width" = yes; then - STDINT_H= - fi - else - for ac_header in sys/inttypes.h sys/bitypes.h + if test "$gl_cv_header_stdint_width" = yes; then + STDINT_H= + fi + ;; + *) + for ac_header in sys/inttypes.h sys/bitypes.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -11298,12 +11708,12 @@ fi done - if test $ac_cv_header_sys_inttypes_h = yes; then - HAVE_SYS_INTTYPES_H=1 - fi - if test $ac_cv_header_sys_bitypes_h = yes; then - HAVE_SYS_BITYPES_H=1 - fi + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + fi + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + fi if test $APPLE_UNIVERSAL_BUILD = 0; then @@ -11599,14 +12009,16 @@ _ACEOF - if test $BITSIZEOF_WINT_T -lt 32; then + if test $GNULIB_OVERRIDES_WINT_T = 1; then BITSIZEOF_WINT_T=32 fi - fi + ;; + esac + + - # The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. - LIMITS_H=limits.h + LIMITS_H='limits.h' if test -n "$LIMITS_H"; then GL_GENERATE_LIMITS_H_TRUE= GL_GENERATE_LIMITS_H_FALSE='#' @@ -11620,6 +12032,7 @@ fi + if test -n "$STDINT_H"; then GL_GENERATE_STDINT_H_TRUE= GL_GENERATE_STDINT_H_FALSE='#' @@ -11632,9 +12045,6 @@ fi - - - GNULIB_IMAXABS=0; GNULIB_IMAXDIV=0; GNULIB_STRTOIMAX=0; @@ -11643,6 +12053,7 @@ fi HAVE_DECL_IMAXDIV=1; HAVE_DECL_STRTOIMAX=1; HAVE_DECL_STRTOUMAX=1; + HAVE_IMAXDIV_T=1; REPLACE_STRTOIMAX=0; REPLACE_STRTOUMAX=0; INT32_MAX_LT_INTMAX_MAX=1; @@ -11655,12 +12066,6 @@ fi - : - - - - - @@ -11669,12 +12074,6 @@ fi - : - - - - - @@ -11751,44 +12150,7 @@ $as_echo "$gl_cv_next_inttypes_h" >&6; } - for gl_func in imaxabs imaxdiv strtoimax strtoumax; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <inttypes.h> -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - - eval ac_cv_have_decl_$gl_func=yes -fi - done @@ -12457,286 +12819,6 @@ $as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h fi - ac_fn_c_check_decl "$LINENO" "getc_unlocked" "ac_cv_have_decl_getc_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_getc_unlocked" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETC_UNLOCKED $ac_have_decl -_ACEOF - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C Library >= 2.1 or uClibc" >&5 -$as_echo_n "checking whether we are using the GNU C Library >= 2.1 or uClibc... " >&6; } -if ${ac_cv_gnu_library_2_1+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include <features.h> -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) - Lucky GNU user - #endif -#endif -#ifdef __UCLIBC__ - Lucky user -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Lucky" >/dev/null 2>&1; then : - ac_cv_gnu_library_2_1=yes -else - ac_cv_gnu_library_2_1=no -fi -rm -f conftest* - - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gnu_library_2_1" >&5 -$as_echo "$ac_cv_gnu_library_2_1" >&6; } - - GLIBC21="$ac_cv_gnu_library_2_1" - - - - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -# Prepare PATH_SEPARATOR. -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which - # contains only /bin. Note that ksh looks also at the FPATH variable, - # so we have to set that as well for the test. - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - || PATH_SEPARATOR=';' - } -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` - while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${acl_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$acl_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break - ;; - *) - test "$with_gnu_ld" != yes && break - ;; - esac - fi - done - IFS="$acl_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi - -LD="$acl_cv_path_LD" -if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${acl_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 </dev/null` in -*GNU* | *'with BFD'*) - acl_cv_prog_gnu_ld=yes - ;; -*) - acl_cv_prog_gnu_ld=no - ;; -esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5 -$as_echo "$acl_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$acl_cv_prog_gnu_ld - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 -$as_echo_n "checking for shared library run path origin... " >&6; } -if ${acl_cv_rpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 -$as_echo "$acl_cv_rpath" >&6; } - wl="$acl_cv_wl" - acl_libext="$acl_cv_libext" - acl_shlibext="$acl_cv_shlibext" - acl_libname_spec="$acl_cv_libname_spec" - acl_library_names_spec="$acl_cv_library_names_spec" - acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - acl_hardcode_direct="$acl_cv_hardcode_direct" - acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" - # Check whether --enable-rpath was given. -if test "${enable_rpath+set}" = set; then : - enableval=$enable_rpath; : -else - enable_rpath=yes -fi - - - - - acl_libdirstem=lib - acl_libdirstem2= - case "$host_os" in - solaris*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 -$as_echo_n "checking for 64-bit host... " >&6; } -if ${gl_cv_solaris_64bit+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef _LP64 -sixtyfour bits -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "sixtyfour bits" >/dev/null 2>&1; then : - gl_cv_solaris_64bit=yes -else - gl_cv_solaris_64bit=no -fi -rm -f conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 -$as_echo "$gl_cv_solaris_64bit" >&6; } - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 - case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; - esac - fi - ;; - *) - searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" - fi - ;; - esac - test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" @@ -12746,13 +12828,14 @@ $as_echo "$gl_cv_solaris_64bit" >&6; } LIBMULTITHREAD= LTLIBMULTITHREAD= if test "$gl_use_threads" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 $as_echo_n "checking whether imported symbols can be declared weak... " >&6; } if ${gl_cv_have_weak+:} false; then : $as_echo_n "(cached) " >&6 else gl_cv_have_weak=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern void xyzzy (); #pragma weak xyzzy @@ -12769,13 +12852,13 @@ if ac_fn_c_try_link "$LINENO"; then : fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test $gl_cv_have_weak = maybe; then - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $gl_cv_have_weak = maybe; then + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ELF__ - Extensible Linking Format - #endif + Extensible Linking Format + #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | @@ -12807,15 +12890,66 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi + fi + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 $as_echo "$gl_cv_have_weak" >&6; } - if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then - # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that - # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY. - ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" + case "$gl_cv_have_weak" in + *yes) + +$as_echo "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h + + ;; + esac + + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + + : + fi + if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then + + if test $ac_cv_header_threads_h = yes; then + gl_have_isoc_threads= + # Test whether both mtx_lock and cnd_timedwait exist in libc. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <threads.h> + #include <stddef.h> + mtx_t m; + cnd_t c; + +int +main () +{ +mtx_lock (&m); + cnd_timedwait (&c, &m, NULL); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_have_isoc_threads=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + fi + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + + + if test -z "$gl_threadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks <pthread.h>. It's added above, in gl_ANYTHREADLIB_EARLY. + ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes; then : gl_have_pthread_h=yes else @@ -12823,53 +12957,52 @@ else fi - if test "$gl_have_pthread_h" = yes; then - # Other possible tests: - # -lpthreads (FSU threads, PCthreads) - # -lgthreads - gl_have_pthread= - # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist - # in libc. IRIX 6.5 has the first one in both libc and libpthread, but - # the second one only in libpthread, and lock.c needs it. - # - # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 - # needs -pthread for some reason. See: - # http://lists.gnu.org/archive/html/bug-gnulib/2014-09/msg00023.html - save_LIBS=$LIBS - for gl_pthread in '' '-pthread'; do - LIBS="$LIBS $gl_pthread" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <pthread.h> - pthread_mutex_t m; - pthread_mutexattr_t ma; + pthread_mutex_t m; + pthread_mutexattr_t ma; int main () { pthread_mutex_lock (&m); - pthread_mutexattr_init (&ma); + pthread_mutexattr_init (&ma); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - gl_have_pthread=yes - LIBTHREAD=$gl_pthread LTLIBTHREAD=$gl_pthread - LIBMULTITHREAD=$gl_pthread LTLIBMULTITHREAD=$gl_pthread + gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LIBS=$save_LIBS - test -n "$gl_have_pthread" && break - done - - # Test for libpthread by looking for pthread_kill. (Not pthread_self, - # since it is defined as a macro on OSF/1.) - if test -n "$gl_have_pthread" && test -z "$LIBTHREAD"; then - # The program links fine without libpthread. But it may actually - # need to link with libpthread in order to create multiple threads. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done + + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 $as_echo_n "checking for pthread_kill in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_kill+:} false; then : $as_echo_n "(cached) " >&6 @@ -12906,23 +13039,25 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 $as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : - LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread - # On Solaris and HP-UX, most pthread functions exist also in libc. - # Therefore pthread_in_use() needs to actually try to create a - # thread: pthread_create from libc will fail, whereas - # pthread_create will actually create a thread. - case "$host_os" in - solaris* | hpux*) + LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) $as_echo "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h - esac + esac fi - elif test -z "$gl_have_pthread"; then - # Some library is needed. Try libpthread and libc_r. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 $as_echo_n "checking for pthread_kill in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_kill+:} false; then : $as_echo_n "(cached) " >&6 @@ -12959,14 +13094,14 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 $as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : - gl_have_pthread=yes - LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread - LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread + gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread fi - if test -z "$gl_have_pthread"; then - # For FreeBSD 4. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 $as_echo_n "checking for pthread_kill in -lc_r... " >&6; } if ${ac_cv_lib_c_r_pthread_kill+:} false; then : $as_echo_n "(cached) " >&6 @@ -13003,633 +13138,62 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 $as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; } if test "x$ac_cv_lib_c_r_pthread_kill" = xyes; then : - gl_have_pthread=yes - LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r - LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r + gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r fi - fi - fi - if test -n "$gl_have_pthread"; then - gl_threads_api=posix - -$as_echo "#define USE_POSIX_THREADS 1" >>confdefs.h - - if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - -$as_echo "#define USE_POSIX_THREADS_WEAK 1" >>confdefs.h - - LIBTHREAD= - LTLIBTHREAD= - fi - fi fi fi fi - if test -z "$gl_have_pthread"; then - if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then - gl_have_solaristhread= - gl_save_LIBS="$LIBS" - LIBS="$LIBS -lthread" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 +$as_echo_n "checking whether POSIX threads API is available... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 +$as_echo "$gl_pthread_api" >&6; } -#include <thread.h> -#include <synch.h> -int -main () -{ -thr_self(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_have_solaristhread=yes -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$gl_save_LIBS" - if test -n "$gl_have_solaristhread"; then - gl_threads_api=solaris - LIBTHREAD=-lthread - LTLIBTHREAD=-lthread - LIBMULTITHREAD="$LIBTHREAD" - LTLIBMULTITHREAD="$LTLIBTHREAD" - -$as_echo "#define USE_SOLARIS_THREADS 1" >>confdefs.h + if test $gl_pthread_api = yes; then - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then +$as_echo "#define HAVE_PTHREAD_API 1" >>confdefs.h -$as_echo "#define USE_SOLARIS_THREADS_WEAK 1" >>confdefs.h - - LIBTHREAD= - LTLIBTHREAD= - fi - fi - fi fi - if test "$gl_use_threads" = pth; then - gl_save_CPPFLAGS="$CPPFLAGS" - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libpth" >&5 -$as_echo_n "checking how to link with libpth... " >&6; } -if ${ac_cv_libpth_libs+:} false; then : - $as_echo_n "(cached) " >&6 -else - - - - - - - - - use_additional=yes - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + gl_threadlib_body_done=done + fi + LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD + LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD + if test $gl_pthread_api = yes; then + if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then + gl_threads_api='isoc+posix' -# Check whether --with-libpth-prefix was given. -if test "${with_libpth_prefix+set}" = set; then : - withval=$with_libpth_prefix; - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then +$as_echo "#define USE_ISOC_AND_POSIX_THREADS 1" >>confdefs.h - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" + LIBTHREAD= LTLIBTHREAD= + else + gl_threads_api=posix - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +$as_echo "#define USE_POSIX_THREADS 1" >>confdefs.h - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && ! test -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi - fi - fi + if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then -fi +$as_echo "#define USE_POSIX_THREADS_WEAK 1" >>confdefs.h - LIBPTH= - LTLIBPTH= - INCPTH= - LIBPTH_PREFIX= - HAVE_LIBPTH= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='pth ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBPTH="${LIBPTH}${LIBPTH:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - dir="$additional_libdir" - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBPTH; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - LIBPTH="${LIBPTH}${LIBPTH:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$acl_hardcode_direct" = yes; then - LIBPTH="${LIBPTH}${LIBPTH:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - LIBPTH="${LIBPTH}${LIBPTH:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBPTH; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBPTH="${LIBPTH}${LIBPTH:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - LIBPTH="${LIBPTH}${LIBPTH:+ }$found_so" - else - LIBPTH="${LIBPTH}${LIBPTH:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBPTH="${LIBPTH}${LIBPTH:+ }$found_a" - else - LIBPTH="${LIBPTH}${LIBPTH:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = 'pth'; then - LIBPTH_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = 'pth'; then - LIBPTH_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCPTH; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCPTH="${INCPTH}${INCPTH:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBPTH; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBPTH="${LIBPTH}${LIBPTH:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBPTH; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBPTH="${LIBPTH}${LIBPTH:+ }$dep" - LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }$dep" - ;; - esac - done + LIBTHREAD= LTLIBTHREAD= fi - else - LIBPTH="${LIBPTH}${LIBPTH:+ }-l$name" - LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }-l$name" fi fi fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBPTH="${LIBPTH}${LIBPTH:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBPTH="${LIBPTH}${LIBPTH:+ }$flag" - done fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }-R$found_dir" - done - fi - - - - - - - ac_cv_libpth_libs="$LIBPTH" - ac_cv_libpth_ltlibs="$LTLIBPTH" - ac_cv_libpth_cppflags="$INCPTH" - ac_cv_libpth_prefix="$LIBPTH_PREFIX" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libpth_libs" >&5 -$as_echo "$ac_cv_libpth_libs" >&6; } - LIBPTH="$ac_cv_libpth_libs" - LTLIBPTH="$ac_cv_libpth_ltlibs" - INCPTH="$ac_cv_libpth_cppflags" - LIBPTH_PREFIX="$ac_cv_libpth_prefix" - - for element in $INCPTH; do - haveit= - for x in $CPPFLAGS; do + if test $gl_threads_api = none; then + if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then + gl_threads_api=isoc - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +$as_echo "#define USE_ISOC_THREADS 1" >>confdefs.h - if test "X$x" = "X$element"; then - haveit=yes - break fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi - done - - - - - HAVE_LIBPTH=yes - - - - gl_have_pth= - gl_save_LIBS="$LIBS" - LIBS="$LIBS $LIBPTH" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <pth.h> -int -main () -{ -pth_self(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_have_pth=yes -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$gl_save_LIBS" - if test -n "$gl_have_pth"; then - gl_threads_api=pth - LIBTHREAD="$LIBPTH" - LTLIBTHREAD="$LTLIBPTH" - LIBMULTITHREAD="$LIBTHREAD" - LTLIBMULTITHREAD="$LTLIBTHREAD" - -$as_echo "#define USE_PTH_THREADS 1" >>confdefs.h - - if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - -$as_echo "#define USE_PTH_THREADS_WEAK 1" >>confdefs.h - - LIBTHREAD= - LTLIBTHREAD= - fi - fi - else - CPPFLAGS="$gl_save_CPPFLAGS" - fi - fi - if test -z "$gl_have_pthread"; then + if test $gl_threads_api = none; then case "$gl_use_threads" in yes | windows | win32) # The 'win32' is for backward compatibility. if { case "$host_os" in @@ -13662,9 +13226,6 @@ $as_echo "$gl_threads_api" >&6; } - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether malloc, realloc, calloc are POSIX compliant" >&5 $as_echo_n "checking whether malloc, realloc, calloc are POSIX compliant... " >&6; } if ${gl_cv_func_malloc_posix+:} false; then : @@ -13677,7 +13238,7 @@ else int main () { -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ choke me #endif @@ -13718,11 +13279,11 @@ else if test "$cross_compiling" = yes; then : case "$host_os" in # Guess yes on platforms where we know the result. - *-gnu* | freebsd* | netbsd* | openbsd* \ + *-gnu* | gnu* | *-musl* | freebsd* | netbsd* | openbsd* \ | hpux* | solaris* | cygwin* | mingw*) - ac_cv_func_malloc_0_nonnull=yes ;; - # If we don't know, assume the worst. - *) ac_cv_func_malloc_0_nonnull=no ;; + ac_cv_func_malloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; esac else @@ -13759,11 +13320,14 @@ fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } - if test $ac_cv_func_malloc_0_nonnull = yes; then : - gl_cv_func_malloc_0_nonnull=1 -else - gl_cv_func_malloc_0_nonnull=0 -fi + case "$ac_cv_func_malloc_0_nonnull" in + *yes) + gl_cv_func_malloc_0_nonnull=1 + ;; + *) + gl_cv_func_malloc_0_nonnull=0 + ;; + esac cat >>confdefs.h <<_ACEOF @@ -13774,9 +13338,6 @@ _ACEOF - - - GNULIB_BTOWC=0; GNULIB_WCTOB=0; GNULIB_MBSINIT=0; @@ -13816,6 +13377,7 @@ _ACEOF GNULIB_WCSSTR=0; GNULIB_WCSTOK=0; GNULIB_WCSWIDTH=0; + GNULIB_WCSFTIME=0; HAVE_BTOWC=1; HAVE_MBSINIT=1; HAVE_MBRTOWC=1; @@ -13853,6 +13415,7 @@ _ACEOF HAVE_WCSSTR=1; HAVE_WCSTOK=1; HAVE_WCSWIDTH=1; + HAVE_WCSFTIME=1; HAVE_DECL_WCTOB=1; HAVE_DECL_WCWIDTH=1; REPLACE_MBSTATE_T=0; @@ -13868,12 +13431,8 @@ _ACEOF REPLACE_WCSNRTOMBS=0; REPLACE_WCWIDTH=0; REPLACE_WCSWIDTH=0; - - - - - - + REPLACE_WCSFTIME=0; + REPLACE_WCSTOK=0; @@ -13902,9 +13461,14 @@ struct tm t; char buf[16]; int main () { - const char *p; + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if defined __BEOS__ || defined __HAIKU__ + return 1; +#else /* Check whether the given locale name is recognized by the system. */ -#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ +# if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE @@ -13912,9 +13476,9 @@ int main () if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; -#else +# else if (setlocale (LC_ALL, "") == NULL) return 1; -#endif +# endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. @@ -13923,32 +13487,36 @@ int main () some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ -#if HAVE_LANGINFO_CODESET +# if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } -#endif -#ifdef __CYGWIN__ +# endif +# ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; -#endif +# endif /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales on Cygwin 1.5.x. */ if (MB_CUR_MAX == 1) return 1; /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ - t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; - if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; - for (p = buf; *p != '\0'; p++) - if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) - return 1; + { + const char *p; + t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; + if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; + for (p = buf; *p != '\0'; p++) + if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) + return 1; + } return 0; +#endif } _ACEOF @@ -14020,10 +13588,9 @@ $as_echo "$gt_cv_locale_ja" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 -$as_echo_n "checking for a transitional chinese locale... " >&6; } -if ${gt_cv_locale_zh_CN+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 +$as_echo_n "checking for a french Unicode locale... " >&6; } +if ${gt_cv_locale_fr_utf8+:} false; then : $as_echo_n "(cached) " >&6 else @@ -14031,7 +13598,6 @@ else /* end confdefs.h. */ #include <locale.h> -#include <stdlib.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> @@ -14040,11 +13606,13 @@ else #include <string.h> struct tm t; char buf[16]; -int main () -{ - const char *p; +int main () { + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ -#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ +# if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE @@ -14052,42 +13620,42 @@ int main () if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; -#else +# else if (setlocale (LC_ALL, "") == NULL) return 1; -#endif +# endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. - On MirBSD 10, when an unsupported locale is specified, setlocale() - succeeds but then nl_langinfo(CODESET) is "UTF-8". */ -#if HAVE_LANGINFO_CODESET + some unit tests fail. */ +# if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 - || strcmp (cs, "UTF-8") == 0) + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) return 1; } -#endif -#ifdef __CYGWIN__ +# endif +# ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; -#endif - /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. - This excludes the UTF-8 encoding (except on MirBSD). */ +# endif + /* Check whether in the abbreviation of the second month, the second + character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is + two bytes long, with UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; - if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; - for (p = buf; *p != '\0'; p++) - if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) - return 1; - /* Check whether a typical GB18030 multibyte sequence is recognized as a - single wide character. This excludes the GB2312 and GBK encodings. */ - if (mblen ("\203\062\332\066", 5) != 4) + if (strftime (buf, sizeof (buf), "%b", &t) < 4 + || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; +#endif +#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ + /* Check whether the decimal separator is a comma. + On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point + are nl_langinfo(RADIXCHAR) are both ".". */ + if (localeconv () ->decimal_point[0] != ',') return 1; +#endif return 0; } @@ -14106,56 +13674,52 @@ _ACEOF # and similar. mingw*) # Test for the hypothetical native Windows locale name. - if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_zh_CN=Chinese_China.54936 + if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=French_France.65001 else # None found. - gt_cv_locale_zh_CN=none + gt_cv_locale_fr_utf8=none fi ;; - solaris2.8) - # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are - # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. - # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. - gt_cv_locale_zh_CN=none - ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. - # Test for the locale name without encoding suffix. - if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_zh_CN=zh_CN + # Test for the usual locale name. + if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr_FR else # Test for the locale name with explicit encoding suffix. - if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_zh_CN=zh_CN.GB18030 + if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr_FR.UTF-8 else - # None found. - gt_cv_locale_zh_CN=none + # Test for the Solaris 7 locale name. + if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr.UTF-8 + else + # None found. + gt_cv_locale_fr_utf8=none + fi fi fi ;; esac - else - # If there was a link error, due to mblen(), the system is so old that - # it certainly doesn't have a chinese locale. - gt_cv_locale_zh_CN=none fi rm -fr conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 -$as_echo "$gt_cv_locale_zh_CN" >&6; } - LOCALE_ZH_CN=$gt_cv_locale_zh_CN +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 +$as_echo "$gt_cv_locale_fr_utf8" >&6; } + LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 -$as_echo_n "checking for a french Unicode locale... " >&6; } -if ${gt_cv_locale_fr_utf8+:} false; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 +$as_echo_n "checking for a transitional chinese locale... " >&6; } +if ${gt_cv_locale_zh_CN+:} false; then : $as_echo_n "(cached) " >&6 else @@ -14163,6 +13727,7 @@ else /* end confdefs.h. */ #include <locale.h> +#include <stdlib.h> #include <time.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> @@ -14171,13 +13736,16 @@ else #include <string.h> struct tm t; char buf[16]; -int main () { +int main () +{ /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl imitates locale dependent behaviour by looking at the environment variables, and all locales use the UTF-8 encoding. */ -#if !(defined __BEOS__ || defined __HAIKU__) +#if defined __BEOS__ || defined __HAIKU__ + return 1; +#else /* Check whether the given locale name is recognized by the system. */ -# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ +# if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE @@ -14193,11 +13761,14 @@ int main () { is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. */ + some unit tests fail. + On MirBSD 10, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "UTF-8". */ # if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 + || strcmp (cs, "UTF-8") == 0) return 1; } # endif @@ -14207,21 +13778,22 @@ int main () { LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; # endif - /* Check whether in the abbreviation of the second month, the second - character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is - two bytes long, with UTF-8 encoding. */ - t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; - if (strftime (buf, sizeof (buf), "%b", &t) < 4 - || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') + /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. + This excludes the UTF-8 encoding (except on MirBSD). */ + { + const char *p; + t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; + if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; + for (p = buf; *p != '\0'; p++) + if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) + return 1; + } + /* Check whether a typical GB18030 multibyte sequence is recognized as a + single wide character. This excludes the GB2312 and GBK encodings. */ + if (mblen ("\203\062\332\066", 5) != 4) return 1; -#endif -#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ - /* Check whether the decimal separator is a comma. - On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point - are nl_langinfo(RADIXCHAR) are both ".". */ - if (localeconv () ->decimal_point[0] != ',') return 1; -#endif return 0; +#endif } _ACEOF @@ -14239,45 +13811,92 @@ _ACEOF # and similar. mingw*) # Test for the hypothetical native Windows locale name. - if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=French_France.65001 + if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_zh_CN=Chinese_China.54936 else # None found. - gt_cv_locale_fr_utf8=none + gt_cv_locale_zh_CN=none fi ;; + solaris2.8) + # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are + # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. + # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. + gt_cv_locale_zh_CN=none + ;; *) # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the # configure script would override the LC_ALL setting. Likewise for # LC_CTYPE, which is also set at the beginning of the configure script. - # Test for the usual locale name. - if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr_FR + # Test for the locale name without encoding suffix. + if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_zh_CN=zh_CN else # Test for the locale name with explicit encoding suffix. - if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr_FR.UTF-8 + if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_zh_CN=zh_CN.GB18030 else - # Test for the Solaris 7 locale name. - if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr.UTF-8 - else - # None found. - gt_cv_locale_fr_utf8=none - fi + # None found. + gt_cv_locale_zh_CN=none fi fi ;; esac + else + # If there was a link error, due to mblen(), the system is so old that + # it certainly doesn't have a chinese locale. + gt_cv_locale_zh_CN=none fi rm -fr conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 -$as_echo "$gt_cv_locale_fr_utf8" >&6; } - LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 +$as_echo "$gt_cv_locale_zh_CN" >&6; } + LOCALE_ZH_CN=$gt_cv_locale_zh_CN + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac @@ -14301,8 +13920,14 @@ else struct tm t; char buf[16]; int main () { + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if defined __BEOS__ || defined __HAIKU__ + return 1; +#else /* Check whether the given locale name is recognized by the system. */ -#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ +# if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE @@ -14310,9 +13935,9 @@ int main () { if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; -#else +# else if (setlocale (LC_ALL, "") == NULL) return 1; -#endif +# endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. @@ -14321,32 +13946,33 @@ int main () { some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ -#if HAVE_LANGINFO_CODESET +# if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } -#endif -#ifdef __CYGWIN__ +# endif +# ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; -#endif +# endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; -#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ +# if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; -#endif +# endif return 0; +#endif } _ACEOF @@ -14419,12 +14045,7 @@ $as_echo "$gt_cv_locale_fr" >&6; } - - - - - - + GNULIB_EXPLICIT_BZERO=0; GNULIB_FFSL=0; GNULIB_FFSLL=0; GNULIB_MEMCHR=0; @@ -14463,7 +14084,8 @@ $as_echo "$gt_cv_locale_fr" >&6; } GNULIB_STRSIGNAL=0; GNULIB_STRVERSCMP=0; HAVE_MBSLEN=0; - HAVE_FFSL=1; + HAVE_EXPLICIT_BZERO=1; + HAVE_FFSL=1; HAVE_FFSLL=1; HAVE_MEMCHR=1; HAVE_DECL_MEMMEM=1; @@ -14486,23 +14108,24 @@ $as_echo "$gt_cv_locale_fr" >&6; } REPLACE_MEMCHR=0; REPLACE_MEMMEM=0; REPLACE_STPNCPY=0; + REPLACE_STRCHRNUL=0; REPLACE_STRDUP=0; + REPLACE_STRNCAT=0; + REPLACE_STRNDUP=0; + REPLACE_STRNLEN=0; REPLACE_STRSTR=0; REPLACE_STRCASESTR=0; - REPLACE_STRCHRNUL=0; + REPLACE_STRTOK_R=0; REPLACE_STRERROR=0; REPLACE_STRERROR_R=0; - REPLACE_STRNCAT=0; - REPLACE_STRNDUP=0; - REPLACE_STRNLEN=0; REPLACE_STRSIGNAL=0; - REPLACE_STRTOK_R=0; UNDEFINE_STRTOK_R=0; + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is # irrelevant for anonymous mappings. @@ -14564,18 +14187,6 @@ $as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h fi - : - - - - - - - : - - - - @@ -14583,10 +14194,12 @@ $as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h if test $HAVE_MEMCHR = 1; then # Detect platform-specific bugs in some versions of glibc: # memchr should not dereference anything with length 0 - # http://bugzilla.redhat.com/499689 + # https://bugzilla.redhat.com/show_bug.cgi?id=499689 # memchr should not dereference overestimated length after a match - # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 - # http://sourceware.org/bugzilla/show_bug.cgi?id=10162 + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 + # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 + # memchr should cast the second argument to 'unsigned char'. + # This bug exists in Android 4.3. # Assume that memchr works on platforms that lack mprotect. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether memchr works" >&5 $as_echo_n "checking whether memchr works... " >&6; } @@ -14594,7 +14207,15 @@ if ${gl_cv_func_memchr_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : - gl_cv_func_memchr_works="guessing no" + case "$host_os" in + # Guess no on Android. + linux*-android*) gl_cv_func_memchr_works="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_memchr_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; + esac + else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -14645,6 +14266,15 @@ main () if (memchr (fence - 1, 0, 3) != fence - 1) result |= 4; } + /* Test against bug on Android 4.3. */ + { + char input[3]; + input[0] = 'a'; + input[1] = 'b'; + input[2] = 'c'; + if (memchr (input, 0x789abc00 | 'b', 3) != input + 1) + result |= 8; + } return result; ; @@ -14660,16 +14290,17 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_memchr_works" >&5 $as_echo "$gl_cv_func_memchr_works" >&6; } - if test "$gl_cv_func_memchr_works" != yes; then - REPLACE_MEMCHR=1 - fi + case "$gl_cv_func_memchr_works" in + *yes) ;; + *) REPLACE_MEMCHR=1 ;; + esac fi - - ac_fn_c_check_decl "$LINENO" "memmem" "ac_cv_have_decl_memmem" "$ac_includes_default" +ac_fn_c_check_decl "$LINENO" "memmem" "ac_cv_have_decl_memmem" "$ac_includes_default" if test "x$ac_cv_have_decl_memmem" = xyes; then : ac_have_decl=1 else @@ -14684,7 +14315,6 @@ _ACEOF - for ac_func in memmem do : ac_fn_c_check_func "$LINENO" "memmem" "ac_cv_func_memmem" @@ -14702,12 +14332,6 @@ done HAVE_MEMMEM=0 fi - : - - - - - if test $ac_cv_have_decl_memmem = no; then HAVE_DECL_MEMMEM=0 else @@ -14742,7 +14366,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky user" >/dev/null 2>&1; then : gl_cv_func_memmem_works_always="guessing yes" else - gl_cv_func_memmem_works_always="guessing no" + gl_cv_func_memmem_works_always="$gl_cross_guess_normal" fi rm -f conftest* @@ -14797,8 +14421,7 @@ $as_echo "$gl_cv_func_memmem_works_always" >&6; } fi : - - ac_fn_c_check_decl "$LINENO" "memrchr" "ac_cv_have_decl_memrchr" "$ac_includes_default" +ac_fn_c_check_decl "$LINENO" "memrchr" "ac_cv_have_decl_memrchr" "$ac_includes_default" if test "x$ac_cv_have_decl_memrchr" = xyes; then : ac_have_decl=1 else @@ -14815,8 +14438,35 @@ _ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for O_CLOEXEC" >&5 +$as_echo_n "checking for O_CLOEXEC... " >&6; } +if ${gl_cv_macro_O_CLOEXEC+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <fcntl.h> + #ifndef O_CLOEXEC + choke me; + #endif - +int +main () +{ +return O_CLOEXEC; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_macro_O_CLOEXEC=yes +else + gl_cv_macro_O_CLOEXEC=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_macro_O_CLOEXEC" >&5 +$as_echo "$gl_cv_macro_O_CLOEXEC" >&6; } @@ -14856,9 +14506,6 @@ _ACEOF - - - GNULIB_DPRINTF=0; GNULIB_FCLOSE=0; GNULIB_FDOPEN=0; @@ -14963,36 +14610,7 @@ _ACEOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ac_fn_c_check_decl "$LINENO" "setenv" "ac_cv_have_decl_setenv" "$ac_includes_default" +ac_fn_c_check_decl "$LINENO" "setenv" "ac_cv_have_decl_setenv" "$ac_includes_default" if test "x$ac_cv_have_decl_setenv" = xyes; then : ac_have_decl=1 else @@ -15008,32 +14626,10 @@ _ACEOF - - - - - : - - - - - if test $ac_cv_have_decl_setenv = no; then HAVE_DECL_SETENV=0 fi - : - - - - - - - - - - : - @@ -15188,8 +14784,8 @@ else char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html */ Bool q = true; Bool *pq = &q; @@ -15270,11 +14866,7 @@ $as_echo "#define HAVE_WCHAR_T 1" >>confdefs.h - - - - - ac_fn_c_check_decl "$LINENO" "strdup" "ac_cv_have_decl_strdup" "$ac_includes_default" +ac_fn_c_check_decl "$LINENO" "strdup" "ac_cv_have_decl_strdup" "$ac_includes_default" if test "x$ac_cv_have_decl_strdup" = xyes; then : ac_have_decl=1 else @@ -15286,7 +14878,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF - REPLACE_STRERROR_0=0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror(0) succeeds" >&5 $as_echo_n "checking whether strerror(0) succeeds... " >&6; } @@ -15295,10 +14886,14 @@ if ${gl_cv_func_strerror_0_works+:} false; then : else if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_strerror_0_works="guessing no" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; esac else @@ -15355,11 +14950,6 @@ $as_echo "#define REPLACE_STRERROR_0 1" >>confdefs.h - ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" -if test "x$ac_cv_func_strerror_r" = xyes; then : - -fi - if test $ac_cv_func_strerror_r = yes; then if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strerror_r with POSIX signature" >&5 @@ -15461,12 +15051,6 @@ fi $as_echo "$gl_cv_func_strerror_r_works" >&6; } else - : - - - - - if test $ac_cv_func___xpg_strerror_r = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __xpg_strerror_r works" >&5 $as_echo_n "checking whether __xpg_strerror_r works... " >&6; } @@ -15474,7 +15058,7 @@ if ${gl_cv_func_strerror_r_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : - gl_cv_func_strerror_r_works="guessing no" + gl_cv_func_strerror_r_works="$gl_cross_guess_normal" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -15526,11 +15110,16 @@ $as_echo "$gl_cv_func_strerror_r_works" >&6; } fi fi +ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" +if test "x$ac_cv_have_decl_strerror_r" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi - - - - +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R $ac_have_decl +_ACEOF @@ -15612,59 +15201,22 @@ $as_echo "$gl_cv_next_string_h" >&6; } - for gl_func in ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r strerror_r strsignal strverscmp; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <string.h> -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - - eval ac_cv_have_decl_$gl_func=yes -fi - done - if test "$gl_cv_func_memchr_works" != yes; then + if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then REPLACE_STRSTR=1 else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strstr works" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strstr works" >&5 $as_echo_n "checking whether strstr works... " >&6; } if ${gl_cv_func_strstr_works_always+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNU_LIBRARY__ @@ -15687,7 +15239,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky user" >/dev/null 2>&1; then : gl_cv_func_strstr_works_always="guessing yes" else - gl_cv_func_strstr_works_always="guessing no" + gl_cv_func_strstr_works_always="$gl_cross_guess_normal" fi rm -f conftest* @@ -15697,6 +15249,12 @@ else /* end confdefs.h. */ #include <string.h> /* for strstr */ +#ifdef __GNU_LIBRARY__ + #include <features.h> + #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28 + Unlucky user + #endif +#endif #define P "_EF_BF_BD" #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P #define NEEDLE P P P P P @@ -15731,8 +15289,7 @@ $as_echo "$gl_cv_func_strstr_works_always" >&6; } esac fi - - ac_fn_c_check_decl "$LINENO" "strtok_r" "ac_cv_have_decl_strtok_r" "$ac_includes_default" +ac_fn_c_check_decl "$LINENO" "strtok_r" "ac_cv_have_decl_strtok_r" "$ac_includes_default" if test "x$ac_cv_have_decl_strtok_r" = xyes; then : ac_have_decl=1 else @@ -15753,6 +15310,9 @@ _ACEOF +$as_echo "#define _USE_STD_STAT 1" >>confdefs.h + + @@ -15833,6 +15393,7 @@ $as_echo "$gl_cv_next_sys_types_h" >&6; } + WINDOWS_STAT_INODES=0 @@ -15840,31 +15401,6 @@ $as_echo "$gl_cv_next_sys_types_h" >&6; } - GNULIB_MKTIME=0; - GNULIB_NANOSLEEP=0; - GNULIB_STRPTIME=0; - GNULIB_TIMEGM=0; - GNULIB_TIME_R=0; - GNULIB_TIME_RZ=0; - HAVE_DECL_LOCALTIME_R=1; - HAVE_NANOSLEEP=1; - HAVE_STRPTIME=1; - HAVE_TIMEGM=1; - REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; - REPLACE_MKTIME=GNULIB_PORTCHECK; - REPLACE_NANOSLEEP=GNULIB_PORTCHECK; - REPLACE_TIMEGM=GNULIB_PORTCHECK; - - : ${GNULIB_GETTIMEOFDAY=0}; - REPLACE_GMTIME=0; - REPLACE_LOCALTIME=0; - - - - : - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timespec in <time.h>" >&5 @@ -16076,14 +15612,7 @@ $as_echo "$gl_cv_next_time_h" >&6; } - - - - - - - - ac_fn_c_check_decl "$LINENO" "unsetenv" "ac_cv_have_decl_unsetenv" "$ac_includes_default" +ac_fn_c_check_decl "$LINENO" "unsetenv" "ac_cv_have_decl_unsetenv" "$ac_includes_default" if test "x$ac_cv_have_decl_unsetenv" = xyes; then : ac_have_decl=1 else @@ -16095,7 +15624,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <wchar.h> uses 'inline' correctly" >&5 $as_echo_n "checking whether <wchar.h> uses 'inline' correctly... " >&6; } if ${gl_cv_header_wchar_h_correct_inline+:} false; then : @@ -16120,7 +15648,8 @@ int main () { return zero(); } _ACEOF save_ac_compile="$ac_compile" ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + if echo '#include "conftest.c"' >conftest1.c && + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 @@ -16141,7 +15670,8 @@ int zero (void) { return 0; } _ACEOF ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + if echo '#include "conftest.c"' >conftest2.c && + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 @@ -16154,7 +15684,7 @@ _ACEOF fi fi ac_compile="$save_ac_compile" - rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext + rm -f conftest12.c conftest12.$ac_objext conftest$ac_exeext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_wchar_h_correct_inline" >&5 @@ -16165,54 +15695,24 @@ This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in C99 mode. You have four options: - Add the flag -fgnu89-inline to CC and reconfigure, or - Fix your include files, using parts of - <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or + <https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or - Use a gcc version older than 4.3, or - Don't use the flags -std=c99 or -std=gnu99. Configuration aborted." "$LINENO" 5 fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wint_t" >&5 -$as_echo_n "checking for wint_t... " >&6; } -if ${gt_cv_c_wint_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included - before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> - wint_t foo = (wchar_t)'\0'; -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gt_cv_c_wint_t=yes -else - gt_cv_c_wint_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wint_t" >&5 -$as_echo "$gt_cv_c_wint_t" >&6; } - if test $gt_cv_c_wint_t = yes; then - -$as_echo "#define HAVE_WINT_T 1" >>confdefs.h + if test $ac_cv_header_crtdefs_h = yes; then + HAVE_CRTDEFS_H=1 + else + HAVE_CRTDEFS_H=0 fi + GNULIB_ISWBLANK=0; GNULIB_WCTYPE=0; GNULIB_ISWCTYPE=0; @@ -16226,9 +15726,6 @@ $as_echo "#define HAVE_WINT_T 1" >>confdefs.h - - - if false; then GL_COND_LIBTOOL_TRUE= GL_COND_LIBTOOL_FALSE='#' @@ -16306,14 +15803,15 @@ else fi + if test $ac_cv_working_alloca_h = yes; then + HAVE_ALLOCA_H=1 + else + HAVE_ALLOCA_H=0 + fi - : - - - if test $ac_cv_header_arpa_inet_h = yes; then @@ -16328,12 +15826,6 @@ fi - : - - - - - @@ -16410,52 +15902,21 @@ $as_echo "$gl_cv_next_arpa_inet_h" >&6; } - for gl_func in inet_ntop inet_pton; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* On some systems, this header is not self-consistent. */ -#if !(defined __GLIBC__ || defined __UCLIBC__) -# include <sys/socket.h> -#endif -#ifdef __TANDEM -# include <netdb.h> -#endif -#include <arpa/inet.h> + if test $ac_cv_header_sys_socket_h = yes; then + HAVE_WS2TCPIP_H=0 + else + if test $ac_cv_header_ws2tcpip_h = yes; then + HAVE_WS2TCPIP_H=1 + else + HAVE_WS2TCPIP_H=0 + fi + fi + + + -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - eval ac_cv_have_decl_$gl_func=yes -fi - done @@ -16470,6 +15931,58 @@ fi gl_LIBOBJS="$gl_LIBOBJS openat-proc.$ac_objext" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_expect" >&5 +$as_echo_n "checking for __builtin_expect... " >&6; } +if ${gl_cv___builtin_expect+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int + main (int argc, char **argv) + { + argc = __builtin_expect (argc, 100); + return argv[argc != 100][0]; + } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv___builtin_expect=yes +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <builtins.h> + int + main (int argc, char **argv) + { + argc = __builtin_expect (argc, 100); + return argv[argc != 100][0]; + } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv___builtin_expect="in <builtins.h>" +else + gl_cv___builtin_expect=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv___builtin_expect" >&5 +$as_echo "$gl_cv___builtin_expect" >&6; } + if test "$gl_cv___builtin_expect" = yes; then + $as_echo "#define HAVE___BUILTIN_EXPECT 1" >>confdefs.h + + elif test "$gl_cv___builtin_expect" = "in <builtins.h>"; then + $as_echo "#define HAVE___BUILTIN_EXPECT 2" >>confdefs.h + + fi + + + if test $ac_cv_func_canonicalize_file_name = no; then @@ -16478,8 +15991,8 @@ fi HAVE_REALPATH=0 else case "$gl_cv_func_realpath_works" in - *yes) ;; - *) REPLACE_REALPATH=1 ;; + *yes) ;; + *) REPLACE_REALPATH=1 ;; esac fi else @@ -16582,7 +16095,7 @@ else # undef PATH_MAX # define PATH_MAX 1024 #endif -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ # undef PATH_MAX # define PATH_MAX 260 #endif @@ -16624,15 +16137,11 @@ $as_echo "#define GNULIB_TEST_CLOEXEC 1" >>confdefs.h - if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then - REPLACE_CLOSE=1 - fi - - - + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + REPLACE_CLOSE=1 + fi - : @@ -16670,12 +16179,6 @@ done - : - - - - - if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi @@ -16734,12 +16237,6 @@ done - : - - - - - if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi @@ -16782,47 +16279,6 @@ $as_echo "#define GNULIB_TEST_CLOSEDIR 1" >>confdefs.h - - if test "x$datarootdir" = x; then - datarootdir='${datadir}' - - fi - if test "x$docdir" = x; then - docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' - - fi - if test "x$htmldir" = x; then - htmldir='${docdir}' - - fi - if test "x$dvidir" = x; then - dvidir='${docdir}' - - fi - if test "x$pdfdir" = x; then - pdfdir='${docdir}' - - fi - if test "x$psdir" = x; then - psdir='${docdir}' - - fi - if test "x$lispdir" = x; then - lispdir='${datarootdir}/emacs/site-lisp' - - fi - if test "x$localedir" = x; then - localedir='${datarootdir}/locale' - - fi - if test "x$runstatedir" = x; then - runstatedir='${localstatedir}/run' - - fi - - pkglibexecdir='${libexecdir}/${PACKAGE}' - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for d_ino member in directory struct" >&5 $as_echo_n "checking for d_ino member in directory struct... " >&6; } if ${gl_cv_struct_dirent_d_ino+:} false; then : @@ -16830,10 +16286,14 @@ if ${gl_cv_struct_dirent_d_ino+:} false; then : else if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems with Linux kernel. - linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_struct_dirent_d_ino="guessing no" ;; + # Guess yes on glibc systems with Linux kernel. + linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;; + # Guess yes on musl systems with Linux kernel. + linux*-musl*) gl_cv_struct_dirent_d_ino="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_struct_dirent_d_ino="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_struct_dirent_d_ino="$gl_cross_guess_normal" ;; esac else @@ -16853,11 +16313,11 @@ DIR *dp = opendir ("."); return 1; e = readdir (dp); if (! e) - return 2; + { closedir (dp); return 2; } if (lstat (e->d_name, &st) != 0) - return 3; + { closedir (dp); return 3; } if (e->d_ino != st.st_ino) - return 4; + { closedir (dp); return 4; } closedir (dp); return 0; @@ -16933,12 +16393,6 @@ $as_echo "#define HAVE_STRUCT_DIRENT_D_TYPE 1" >>confdefs.h - : - - - - - @@ -17019,44 +16473,7 @@ $as_echo "$gl_cv_next_dirent_h" >&6; } - for gl_func in alphasort closedir dirfd fdopendir opendir readdir rewinddir scandir; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <dirent.h> -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - - eval ac_cv_have_decl_$gl_func=yes -fi - done @@ -17252,14 +16669,10 @@ $as_echo "#define DOUBLE_SLASH_IS_DISTINCT_ROOT 1" >>confdefs.h - if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then - REPLACE_DUP=1 - fi - - - - : + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + REPLACE_DUP=1 + fi @@ -17279,7 +16692,12 @@ if ${gl_cv_func_dup_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : - gl_cv_func_dup_works='guessing yes' + case "$host_os" in + # Guess no on native Windows. + mingw*) gl_cv_func_dup_works="guessing no" ;; + *) gl_cv_func_dup_works="guessing yes" ;; + esac + else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -17478,12 +16896,6 @@ done - : - - - - - if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi @@ -17591,12 +17003,6 @@ $as_echo "$ac_cv_lib_error_at_line" >&6; } - : - - - - - if test $ac_cv_have_decl_fchdir = no; then HAVE_DECL_FCHDIR=0 fi @@ -17624,10 +17030,14 @@ if ${gl_cv_func_open_directory_works+:} false; then : else if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_open_directory_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_open_directory_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_open_directory_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_open_directory_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_open_directory_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_open_directory_works="$gl_cross_guess_normal" ;; esac else @@ -17685,22 +17095,10 @@ $as_echo "#define GNULIB_TEST_FCHDIR 1" >>confdefs.h - : - - - - - if test $ac_cv_func_fcntl = no; then - : - - - - - if test $ac_cv_func_fcntl = no; then HAVE_FCNTL=0 else @@ -17783,12 +17181,6 @@ $as_echo "$gl_cv_func_fcntl_f_dupfd_works" >&6; } *) - : - - - - - if test $ac_cv_func_fcntl = no; then HAVE_FCNTL=0 else @@ -17856,12 +17248,6 @@ $as_echo "$gl_cv_func_fcntl_f_dupfd_cloexec" >&6; } - : - - - - - if test $ac_cv_func_fcntl = no; then HAVE_FCNTL=0 else @@ -17874,12 +17260,6 @@ $as_echo "$gl_cv_func_fcntl_f_dupfd_cloexec" >&6; } - : - - - - - if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi @@ -17888,12 +17268,6 @@ $as_echo "$gl_cv_func_fcntl_f_dupfd_cloexec" >&6; } - : - - - - - if test $ac_cv_func_fcntl = no; then HAVE_FCNTL=0 else @@ -18010,44 +17384,14 @@ $as_echo "$gl_cv_next_fcntl_h" >&6; } - for gl_func in fcntl openat; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <fcntl.h> -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - eval ac_cv_have_decl_$gl_func=yes -fi - done + + + +cat >>confdefs.h <<_ACEOF +#define GNULIB_FD_SAFER_FLAG 1 +_ACEOF @@ -18075,12 +17419,6 @@ else fi - : - - - - - if test $ac_cv_func_fdopendir = no; then HAVE_FDOPENDIR=0 else @@ -18091,10 +17429,12 @@ if ${gl_cv_func_fdopendir_works+:} false; then : else if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_fdopendir_works="guessing no" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_fdopendir_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_fdopendir_works="$gl_cross_guess_normal" ;; esac else @@ -18181,12 +17521,6 @@ _ACEOF - : - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flexible array member" >&5 @@ -18199,7 +17533,8 @@ else #include <stdlib.h> #include <stdio.h> #include <stddef.h> - struct s { int n; double d[]; }; + struct m { struct m *next, **list; char name[]; }; + struct s { struct s *p; struct m *m; int n; double d[]; }; int main () { @@ -18208,6 +17543,8 @@ int m = getchar (); nbytes += sizeof (struct s) - 1; nbytes -= nbytes % sizeof (struct s); struct s *p = malloc (nbytes); + p->p = p; + p->m = NULL; p->d[0] = 0.0; return p->d != (double *) NULL; ; @@ -18241,7 +17578,7 @@ $as_echo "#define FLEXIBLE_ARRAY_MEMBER /**/" >>confdefs.h aix* | beos* | openbsd* | mirbsd* | irix*) FLOAT_H=float.h ;; - freebsd*) + freebsd* | dragonfly*) case "$host_cpu" in i[34567]86 ) FLOAT_H=float.h @@ -18252,17 +17589,18 @@ $as_echo "#define FLEXIBLE_ARRAY_MEMBER /**/" >>confdefs.h cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __LP64__ || defined __x86_64__ || defined __amd64__ - yes - #endif + int ok; + #else + error fail + #endif + _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : +if ac_fn_c_try_compile "$LINENO"; then : else FLOAT_H=float.h fi -rm -f conftest* - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; esac ;; @@ -18275,7 +17613,7 @@ rm -f conftest* ;; esac case "$host_os" in - aix* | freebsd* | linux*) + aix* | freebsd* | dragonfly* | linux*) if test -n "$FLOAT_H"; then REPLACE_FLOAT_LDBL=1 fi @@ -18295,19 +17633,22 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __LP64__ || defined __arch64__ - yes - #endif + int ok; + #else + error fail + #endif + _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : +if ac_fn_c_try_compile "$LINENO"; then : gl_cv_func_itold_works="guessing no" else gl_cv_func_itold_works="guessing yes" fi -rm -f conftest* - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; - *) gl_cv_func_itold_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_itold_works="guessing yes" ;; + *) gl_cv_func_itold_works="guessing yes" ;; esac else @@ -18456,108 +17797,116 @@ fi - - FNMATCH_H= - gl_fnmatch_required_lowercase=` + gl_fnmatch_required_lowercase=` echo $gl_fnmatch_required | LC_ALL=C tr '[A-Z]' '[a-z]' ` - gl_fnmatch_cache_var="gl_cv_func_fnmatch_${gl_fnmatch_required_lowercase}" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working $gl_fnmatch_required fnmatch" >&5 + + if test $ac_cv_func_fnmatch = no; then + HAVE_FNMATCH=0 + else + gl_fnmatch_cache_var="gl_cv_func_fnmatch_${gl_fnmatch_required_lowercase}" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working $gl_fnmatch_required fnmatch" >&5 $as_echo_n "checking for working $gl_fnmatch_required fnmatch... " >&6; } if eval \${$gl_fnmatch_cache_var+:} false; then : $as_echo_n "(cached) " >&6 else - if test $gl_fnmatch_required = GNU; then - gl_fnmatch_gnu_start= - gl_fnmatch_gnu_end= - else - gl_fnmatch_gnu_start='#if 0' - gl_fnmatch_gnu_end='#endif' - fi - if test "$cross_compiling" = yes; then : - eval "$gl_fnmatch_cache_var=\"guessing no\"" + if test $gl_fnmatch_required = GNU; then + gl_fnmatch_gnu_start= + gl_fnmatch_gnu_end= + else + gl_fnmatch_gnu_start='#if 0' + gl_fnmatch_gnu_end='#endif' + fi + if test "$cross_compiling" = yes; then : + case "$host_os" in + # Guess yes on musl systems. + *-musl*) eval "$gl_fnmatch_cache_var=\"guessing yes\"" ;; + # Guess no otherwise, even on glibc systems. + *) eval "$gl_fnmatch_cache_var=\"guessing no\"" ;; + esac + else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <fnmatch.h> - static int - y (char const *pattern, char const *string, int flags) - { - return fnmatch (pattern, string, flags) == 0; - } - static int - n (char const *pattern, char const *string, int flags) - { - return fnmatch (pattern, string, flags) == FNM_NOMATCH; - } + static int + y (char const *pattern, char const *string, int flags) + { + return fnmatch (pattern, string, flags) == 0; + } + static int + n (char const *pattern, char const *string, int flags) + { + return fnmatch (pattern, string, flags) == FNM_NOMATCH; + } int main () { char const *Apat = 'A' < '\\\\' ? "[A-\\\\\\\\]" : "[\\\\\\\\-A]"; - char const *apat = 'a' < '\\\\' ? "[a-\\\\\\\\]" : "[\\\\\\\\-a]"; - static char const A_1[] = { 'A' - 1, 0 }; - static char const A01[] = { 'A' + 1, 0 }; - static char const a_1[] = { 'a' - 1, 0 }; - static char const a01[] = { 'a' + 1, 0 }; - static char const bs_1[] = { '\\\\' - 1, 0 }; - static char const bs01[] = { '\\\\' + 1, 0 }; - int result = 0; - if (!n ("a*", "", 0)) - return 1; - if (!y ("a*", "abc", 0)) - return 1; - if (!y ("[/b", "[/b", 0)) /*"]]"*/ /* glibc Bugzilla bug 12378 */ - return 1; - if (!n ("d*/*1", "d/s/1", FNM_PATHNAME)) - return 2; - if (!y ("a\\\\bc", "abc", 0)) - return 3; - if (!n ("a\\\\bc", "abc", FNM_NOESCAPE)) - return 3; - if (!y ("*x", ".x", 0)) - return 4; - if (!n ("*x", ".x", FNM_PERIOD)) - return 4; - if (!y (Apat, "\\\\", 0)) - return 5; - if (!y (Apat, "A", 0)) - return 5; - if (!y (apat, "\\\\", 0)) - return 5; - if (!y (apat, "a", 0)) - return 5; - if (!(n (Apat, A_1, 0) == ('A' < '\\\\'))) - return 5; - if (!(n (apat, a_1, 0) == ('a' < '\\\\'))) - return 5; - if (!(y (Apat, A01, 0) == ('A' < '\\\\'))) - return 5; - if (!(y (apat, a01, 0) == ('a' < '\\\\'))) - return 5; - if (!(y (Apat, bs_1, 0) == ('A' < '\\\\'))) - return 5; - if (!(y (apat, bs_1, 0) == ('a' < '\\\\'))) - return 5; - if (!(n (Apat, bs01, 0) == ('A' < '\\\\'))) - return 5; - if (!(n (apat, bs01, 0) == ('a' < '\\\\'))) - return 5; - $gl_fnmatch_gnu_start - if (!y ("xxXX", "xXxX", FNM_CASEFOLD)) - result |= 8; - if (!y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH)) - result |= 16; - if (!n ("d*/*1", "d/s/1", FNM_FILE_NAME)) - result |= 32; - if (!y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR)) - result |= 64; - if (!y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR)) - result |= 64; - if (!y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)) - result |= 64; - $gl_fnmatch_gnu_end - return result; + char const *apat = 'a' < '\\\\' ? "[a-\\\\\\\\]" : "[\\\\\\\\-a]"; + static char const A_1[] = { 'A' - 1, 0 }; + static char const A01[] = { 'A' + 1, 0 }; + static char const a_1[] = { 'a' - 1, 0 }; + static char const a01[] = { 'a' + 1, 0 }; + static char const bs_1[] = { '\\\\' - 1, 0 }; + static char const bs01[] = { '\\\\' + 1, 0 }; + int result = 0; + if (!n ("a*", "", 0)) + return 1; + if (!y ("a*", "abc", 0)) + return 1; + if (!y ("[/b", "[/b", 0)) /*"]]"*/ /* glibc Bugzilla bug 12378 */ + return 1; + if (!n ("d*/*1", "d/s/1", FNM_PATHNAME)) + return 2; + if (!y ("a\\\\bc", "abc", 0)) + return 3; + if (!n ("a\\\\bc", "abc", FNM_NOESCAPE)) + return 3; + if (!y ("*x", ".x", 0)) + return 4; + if (!n ("*x", ".x", FNM_PERIOD)) + return 4; + if (!y (Apat, "\\\\", 0)) + return 5; + if (!y (Apat, "A", 0)) + return 5; + if (!y (apat, "\\\\", 0)) + return 5; + if (!y (apat, "a", 0)) + return 5; + if (!(n (Apat, A_1, 0) == ('A' < '\\\\'))) + return 5; + if (!(n (apat, a_1, 0) == ('a' < '\\\\'))) + return 5; + if (!(y (Apat, A01, 0) == ('A' < '\\\\'))) + return 5; + if (!(y (apat, a01, 0) == ('a' < '\\\\'))) + return 5; + if (!(y (Apat, bs_1, 0) == ('A' < '\\\\'))) + return 5; + if (!(y (apat, bs_1, 0) == ('a' < '\\\\'))) + return 5; + if (!(n (Apat, bs01, 0) == ('A' < '\\\\'))) + return 5; + if (!(n (apat, bs01, 0) == ('a' < '\\\\'))) + return 5; + $gl_fnmatch_gnu_start + if (!y ("xxXX", "xXxX", FNM_CASEFOLD)) + result |= 8; + if (!y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH)) + result |= 16; + if (!n ("d*/*1", "d/s/1", FNM_FILE_NAME)) + result |= 32; + if (!y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR)) + result |= 64; + if (!y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR)) + result |= 64; + if (!y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)) + result |= 64; + $gl_fnmatch_gnu_end + return result; ; return 0; @@ -18577,13 +17926,16 @@ fi eval ac_res=\$$gl_fnmatch_cache_var { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval "gl_fnmatch_result=\"\$$gl_fnmatch_cache_var\"" - if test "$gl_fnmatch_result" = yes; then - rm -f "$gl_source_base/fnmatch.h" - else - FNMATCH_H=fnmatch.h + eval "gl_fnmatch_result=\"\$$gl_fnmatch_cache_var\"" + case "$gl_fnmatch_result" in + *yes) ;; + *) REPLACE_FNMATCH=1 ;; + esac fi + if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then + + FNMATCH_H='fnmatch.h' if test -n "$FNMATCH_H"; then GL_GENERATE_FNMATCH_H_TRUE= GL_GENERATE_FNMATCH_H_FALSE='#' @@ -18593,22 +17945,19 @@ else fi - if test -n "$FNMATCH_H"; then - + fi + if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then - gl_LIBOBJS="$gl_LIBOBJS fnmatch.$ac_objext" + gl_LIBOBJS="$gl_LIBOBJS fnmatch.$ac_objext" -cat >>confdefs.h <<_ACEOF -#define fnmatch ${gl_fnmatch_required_lowercase}_fnmatch -_ACEOF ac_fn_c_check_decl "$LINENO" "isblank" "ac_cv_have_decl_isblank" "#include <ctype.h> @@ -18624,48 +17973,30 @@ cat >>confdefs.h <<_ACEOF _ACEOF - : - - - - - - - - - - - - - - - - - + fi + GNULIB_FNMATCH=1 - : +$as_echo "#define GNULIB_TEST_FNMATCH 1" >>confdefs.h - fi - - if test -n "$FNMATCH_H"; then + if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then @@ -18678,11 +18009,6 @@ _ACEOF -cat >>confdefs.h <<_ACEOF -#define fnmatch ${gl_fnmatch_required_lowercase}_fnmatch -_ACEOF - - ac_fn_c_check_decl "$LINENO" "isblank" "ac_cv_have_decl_isblank" "#include <ctype.h> " if test "x$ac_cv_have_decl_isblank" = xyes; then : @@ -18696,203 +18022,16 @@ cat >>confdefs.h <<_ACEOF _ACEOF - : - - - - - - - - - - - - - - - - - - - - - - - - - - - - : - - - - fi - - FREXP_LIBM= - if test $gl_cv_func_frexp_no_libm = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexp() can be used with libm" >&5 -$as_echo_n "checking whether frexp() can be used with libm... " >&6; } -if ${gl_cv_func_frexp_in_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - - save_LIBS="$LIBS" - LIBS="$LIBS -lm" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <math.h> - double x; -int -main () -{ -int e; return frexp (x, &e) > 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_frexp_in_libm=yes -else - gl_cv_func_frexp_in_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$save_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexp_in_libm" >&5 -$as_echo "$gl_cv_func_frexp_in_libm" >&6; } - if test $gl_cv_func_frexp_in_libm = yes; then - FREXP_LIBM=-lm - fi - fi - if test $gl_cv_func_frexp_no_libm = yes \ - || test $gl_cv_func_frexp_in_libm = yes; then - save_LIBS="$LIBS" - LIBS="$LIBS $FREXP_LIBM" - - - - : - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexp works" >&5 -$as_echo_n "checking whether frexp works... " >&6; } -if ${gl_cv_func_frexp_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - case "$host_os" in - netbsd* | irix* | mingw*) gl_cv_func_frexp_works="guessing no";; - *) gl_cv_func_frexp_works="guessing yes";; - esac - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include <float.h> -#include <math.h> -#include <string.h> -#if HAVE_DECL_ALARM -# include <signal.h> -# include <unistd.h> -#endif -/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. - ICC 10.0 has a bug when optimizing the expression -zero. - The expression -DBL_MIN * DBL_MIN does not work when cross-compiling - to PowerPC on Mac OS X 10.5. */ -#if defined __hpux || defined __sgi || defined __ICC -static double -compute_minus_zero (void) -{ - return -DBL_MIN * DBL_MIN; -} -# define minus_zero compute_minus_zero () -#else -double minus_zero = -0.0; -#endif -int main() -{ - int result = 0; - int i; - volatile double x; - double zero = 0.0; -#if HAVE_DECL_ALARM - /* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite - number. Let the test fail in this case. */ - signal (SIGALRM, SIG_DFL); - alarm (5); -#endif - /* Test on denormalized numbers. */ - for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) - ; - if (x > 0.0) - { - int exp; - double y = frexp (x, &exp); - /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. - On NetBSD: y = 0.75. Correct: y = 0.5. */ - if (y != 0.5) - result |= 1; - } - /* Test on infinite numbers. */ - x = 1.0 / zero; - { - int exp; - double y = frexp (x, &exp); - if (y != x) - result |= 2; - } - /* Test on negative zero. */ - x = minus_zero; - { - int exp; - double y = frexp (x, &exp); - if (memcmp (&y, &x, sizeof x)) - result |= 4; - } - return result; -} +cat >>confdefs.h <<_ACEOF +#define GNULIB_FNMATCH_GNU 1 _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_frexp_works=yes -else - gl_cv_func_frexp_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexp_works" >&5 -$as_echo "$gl_cv_func_frexp_works" >&6; } - - LIBS="$save_LIBS" - case "$gl_cv_func_frexp_works" in - *yes) gl_func_frexp=yes ;; - *) gl_func_frexp=no; REPLACE_FREXP=1; FREXP_LIBM= ;; - esac - else - gl_func_frexp=no - fi - if test $gl_func_frexp = yes; then - -$as_echo "#define HAVE_FREXP 1" >>confdefs.h - - fi if test $gl_func_frexp != yes; then @@ -18923,245 +18062,6 @@ $as_echo "#define GNULIB_TEST_FREXP 1" >>confdefs.h - - - - - - ac_fn_c_check_decl "$LINENO" "frexpl" "ac_cv_have_decl_frexpl" "#include <math.h> -" -if test "x$ac_cv_have_decl_frexpl" = xyes; then : - -else - HAVE_DECL_FREXPL=0 -fi - - - FREXPL_LIBM= - if test $HAVE_DECL_FREXPL = 1; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl() can be used without linking with libm" >&5 -$as_echo_n "checking whether frexpl() can be used without linking with libm... " >&6; } -if ${gl_cv_func_frexpl_no_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <math.h> - long double x; -int -main () -{ -int e; return frexpl (x, &e) > 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_frexpl_no_libm=yes -else - gl_cv_func_frexpl_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_no_libm" >&5 -$as_echo "$gl_cv_func_frexpl_no_libm" >&6; } - - if test $gl_cv_func_frexpl_no_libm = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl() can be used with libm" >&5 -$as_echo_n "checking whether frexpl() can be used with libm... " >&6; } -if ${gl_cv_func_frexpl_in_libm+:} false; then : - $as_echo_n "(cached) " >&6 -else - - save_LIBS="$LIBS" - LIBS="$LIBS -lm" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <math.h> - long double x; -int -main () -{ -int e; return frexpl (x, &e) > 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_func_frexpl_in_libm=yes -else - gl_cv_func_frexpl_in_libm=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$save_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_in_libm" >&5 -$as_echo "$gl_cv_func_frexpl_in_libm" >&6; } - if test $gl_cv_func_frexpl_in_libm = yes; then - FREXPL_LIBM=-lm - fi - fi - if test $gl_cv_func_frexpl_no_libm = yes \ - || test $gl_cv_func_frexpl_in_libm = yes; then - save_LIBS="$LIBS" - LIBS="$LIBS $FREXPL_LIBM" - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl works" >&5 -$as_echo_n "checking whether frexpl works... " >&6; } -if ${gl_cv_func_frexpl_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - - case "$host_os" in - aix | aix[3-6]* | beos* | darwin* | irix* | mingw* | pw*) - gl_cv_func_frexpl_works="guessing no";; - *) gl_cv_func_frexpl_works="guessing yes";; - esac - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include <float.h> -#include <math.h> -/* Override the values of <float.h>, like done in float.in.h. */ -#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP (-16381) -#endif -#if defined __i386__ && defined __FreeBSD__ -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP (-16381) -#endif -#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP DBL_MIN_EXP -#endif -#if defined __sgi && (LDBL_MANT_DIG >= 106) -# if defined __GNUC__ -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP DBL_MIN_EXP -# endif -#endif -extern -#ifdef __cplusplus -"C" -#endif -long double frexpl (long double, int *); -int main() -{ - int result = 0; - volatile long double x; - /* Test on finite numbers that fails on AIX 5.1. */ - x = 16.0L; - { - int exp = -9999; - frexpl (x, &exp); - if (exp != 5) - result |= 1; - } - /* Test on finite numbers that fails on Mac OS X 10.4, because its frexpl - function returns an invalid (incorrectly normalized) value: it returns - y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } - but the correct result is - 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ - x = 1.01L; - { - int exp = -9999; - long double y = frexpl (x, &exp); - if (!(exp == 1 && y == 0.505L)) - result |= 2; - } - /* Test on large finite numbers. This fails on BeOS at i = 16322, while - LDBL_MAX_EXP = 16384. - In the loop end test, we test x against Infinity, rather than comparing - i with LDBL_MAX_EXP, because BeOS <float.h> has a wrong LDBL_MAX_EXP. */ - { - int i; - for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) - { - int exp = -9999; - frexpl (x, &exp); - if (exp != i) - { - result |= 4; - break; - } - } - } - /* Test on denormalized numbers. */ - { - int i; - for (i = 1, x = 1.0L; i >= LDBL_MIN_EXP; i--, x *= 0.5L) - ; - if (x > 0.0L) - { - int exp; - long double y = frexpl (x, &exp); - /* On machines with IEEE854 arithmetic: x = 1.68105e-4932, - exp = -16382, y = 0.5. On Mac OS X 10.5: exp = -16384, y = 0.5. */ - if (exp != LDBL_MIN_EXP - 1) - result |= 8; - } - } - /* Test on infinite numbers. */ - x = 1.0L / 0.0L; - { - int exp; - long double y = frexpl (x, &exp); - if (y != x) - result |= 16; - } - return result; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_frexpl_works=yes -else - gl_cv_func_frexpl_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_works" >&5 -$as_echo "$gl_cv_func_frexpl_works" >&6; } - - LIBS="$save_LIBS" - case "$gl_cv_func_frexpl_works" in - *yes) gl_func_frexpl=yes ;; - *) gl_func_frexpl=no; REPLACE_FREXPL=1 ;; - esac - else - gl_func_frexpl=no - fi - if test $gl_func_frexpl = yes; then - -$as_echo "#define HAVE_FREXPL 1" >>confdefs.h - - fi - fi - if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; then - if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then - - FREXPL_LIBM="$FREXP_LIBM" - else - FREXPL_LIBM= - fi - fi - - if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; then @@ -19193,20 +18093,11 @@ $as_echo "#define GNULIB_TEST_FREXPL 1" >>confdefs.h - if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then - REPLACE_FSTAT=1 - fi - - - if test $WINDOWS_64_BIT_ST_SIZE = 1; then - REPLACE_FSTAT=1 - fi - - - - - - : + case "$host_os" in + mingw* | solaris*) + REPLACE_FSTAT=1 + ;; + esac @@ -19237,29 +18128,41 @@ $as_echo "#define GNULIB_TEST_FREXPL 1" >>confdefs.h gl_LIBOBJS="$gl_LIBOBJS fstat.$ac_objext" - : - fi + case "$host_os" in + mingw*) - GNULIB_FSTAT=1 + gl_LIBOBJS="$gl_LIBOBJS stat-w32.$ac_objext" + ;; + esac -$as_echo "#define GNULIB_TEST_FSTAT 1" >>confdefs.h + : + + fi + GNULIB_FSTAT=1 + + + + + +$as_echo "#define GNULIB_TEST_FSTAT 1" >>confdefs.h + + - : @@ -19310,15 +18213,20 @@ $as_echo "$gl_cv_func_fstatat_zero_flag" >&6; } case $gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in *yes+*yes) ;; - *) REPLACE_FSTATAT=1 - case $gl_cv_func_fstatat_zero_flag in - *yes) + *) REPLACE_FSTATAT=1 ;; + esac + + case $host_os in + solaris*) + REPLACE_FSTATAT=1 ;; + esac + + case $REPLACE_FSTATAT,$gl_cv_func_fstatat_zero_flag in + 1,*yes) $as_echo "#define HAVE_WORKING_FSTATAT_ZERO_FLAG 1" >>confdefs.h ;; - esac - ;; esac fi @@ -19362,18 +18270,6 @@ $as_echo "#define GNULIB_TEST_FSTATAT 1" >>confdefs.h *) - : - - - - - - - - : - - - @@ -19386,20 +18282,20 @@ else ac_clean_files="$ac_clean_files confdir3" if test "$cross_compiling" = yes; then : # Cross-compilation guesses: - case "$host_os" in - aix*) # On AIX, it has the AIX bug. - gl_cv_func_getcwd_path_max='no, it has the AIX bug' ;; - gnu*) # On Hurd, it is 'yes'. - gl_cv_func_getcwd_path_max=yes ;; - linux* | kfreebsd*) - # On older Linux+glibc it's 'no, but it is partly working', - # on newer Linux+glibc it's 'yes'. - # On Linux+musl libc, it's 'no, but it is partly working'. - # On kFreeBSD+glibc, it's 'no, but it is partly working'. - gl_cv_func_getcwd_path_max='no, but it is partly working' ;; - *) # If we don't know, assume the worst. - gl_cv_func_getcwd_path_max=no ;; - esac + case "$host_os" in + aix*) # On AIX, it has the AIX bug. + gl_cv_func_getcwd_path_max='guessing no, it has the AIX bug' ;; + gnu*) # On Hurd, it is 'yes'. + gl_cv_func_getcwd_path_max='guessing yes' ;; + linux* | kfreebsd*) + # On older Linux+glibc it's 'no, but it is partly working', + # on newer Linux+glibc it's 'yes'. + # On Linux+musl libc, it's 'no, but it is partly working'. + # On kFreeBSD+glibc, it's 'no, but it is partly working'. + gl_cv_func_getcwd_path_max='guessing no, but it is partly working' ;; + *) # If we don't know, obey --enable-cross-guesses. + gl_cv_func_getcwd_path_max="$gl_cross_guess_normal" ;; + esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -19434,7 +18330,7 @@ else # undef PATH_MAX # define PATH_MAX 1024 #endif -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ # undef PATH_MAX # define PATH_MAX 260 #endif @@ -19508,12 +18404,20 @@ main () /* If mkdir or chdir fails, it could be that this system cannot create any file with an absolute name longer than PATH_MAX, such as cygwin. If so, leave fail as 0, because the current working directory can't - be too long for getcwd if it can't even be created. For other - errors, be pessimistic and consider that as a failure, too. */ + be too long for getcwd if it can't even be created. On Linux with + the 9p file system, mkdir fails with error EINVAL when cwd_len gets + too long; ignore this failure because the getcwd() system call + produces good results whereas the gnulib substitute calls getdents64 + which fails with error EPROTO. + For other errors, be pessimistic and consider that as a failure, + too. */ if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0) { if (! (errno == ERANGE || is_ENAMETOOLONG (errno))) - fail = 20; + #ifdef __linux__ + if (! (errno == EINVAL)) + #endif + fail = 20; break; } @@ -19604,11 +18508,11 @@ if ac_fn_c_try_run "$LINENO"; then : gl_cv_func_getcwd_path_max=yes else case $? in - 10|11|12) gl_cv_func_getcwd_path_max='no, but it is partly working';; - 31) gl_cv_func_getcwd_path_max='no, it has the AIX bug';; - 32) gl_cv_func_getcwd_path_max='yes, but with shorter paths';; - *) gl_cv_func_getcwd_path_max=no;; - esac + 10|11|12) gl_cv_func_getcwd_path_max='no, but it is partly working';; + 31) gl_cv_func_getcwd_path_max='no, it has the AIX bug';; + 32) gl_cv_func_getcwd_path_max='yes, but with shorter paths';; + *) gl_cv_func_getcwd_path_max=no;; + esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -19623,30 +18527,46 @@ $as_echo "$gl_cv_func_getcwd_path_max" >&6; } *yes) - : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpagesize" >&5 +$as_echo_n "checking for getpagesize... " >&6; } +if ${gl_cv_func_getpagesize+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <unistd.h> +int +main () +{ +return getpagesize(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_func_getpagesize=yes +else + gl_cv_func_getpagesize=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext - : - - - - +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getpagesize" >&5 +$as_echo "$gl_cv_func_getpagesize" >&6; } + if test $gl_cv_func_getpagesize = yes; then - for ac_func in getpagesize -do : - ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" -if test "x$ac_cv_func_getpagesize" = xyes; then : - cat >>confdefs.h <<_ACEOF +cat >>confdefs.h <<_ACEOF #define HAVE_GETPAGESIZE 1 _ACEOF -fi -done + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getcwd aborts when 4k < cwd_length < 16k" >&5 $as_echo_n "checking whether getcwd aborts when 4k < cwd_length < 16k... " >&6; } @@ -19658,7 +18578,13 @@ else # Arrange for deletion of the temporary directory this test creates. ac_clean_files="$ac_clean_files confdir-14B---" if test "$cross_compiling" = yes; then : - gl_cv_func_getcwd_abort_bug=yes + case "$host_os" in + # Guess no on musl systems. + *-musl*) gl_cv_func_getcwd_abort_bug="guessing no" ;; + # Guess yes otherwise, even on glibc systems. + *) gl_cv_func_getcwd_abort_bug="guessing yes" + esac + else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19689,7 +18615,7 @@ else # undef PATH_MAX # define PATH_MAX 1024 #endif -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ # undef PATH_MAX # define PATH_MAX 260 #endif @@ -19781,12 +18707,13 @@ _ACEOF if ac_fn_c_try_run "$LINENO"; then : gl_cv_func_getcwd_abort_bug=no else - ret=$? - if test $ret -ge 128 || test $ret = 4; then - gl_cv_func_getcwd_abort_bug=yes - else - gl_cv_func_getcwd_abort_bug=no - fi + ret=$? + if test $ret -ge 128 || test $ret = 4; then + gl_cv_func_getcwd_abort_bug=yes + else + gl_cv_func_getcwd_abort_bug=no + fi + fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -19796,16 +18723,21 @@ fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getcwd_abort_bug" >&5 $as_echo "$gl_cv_func_getcwd_abort_bug" >&6; } - if test $gl_cv_func_getcwd_abort_bug = yes; then : - gl_abort_bug=yes -fi + case "$gl_cv_func_getcwd_abort_bug" in + *yes) + gl_abort_bug=yes + ;; + *) + + ;; + esac ;; esac ;; esac case "$gl_cv_func_getcwd_path_max" in - "no"|"no, it has the AIX bug") ;; + *"no" | *"no, it has the AIX bug") ;; *) $as_echo "#define HAVE_MINIMALLY_WORKING_GETCWD 1" >>confdefs.h @@ -19813,12 +18745,12 @@ $as_echo "#define HAVE_MINIMALLY_WORKING_GETCWD 1" >>confdefs.h ;; esac case "$gl_cv_func_getcwd_path_max" in - "no, but it is partly working") + *"no, but it is partly working") $as_echo "#define HAVE_PARTLY_WORKING_GETCWD 1" >>confdefs.h ;; - "yes, but with shorter paths") + *"yes, but with shorter paths") $as_echo "#define HAVE_GETCWD_SHORTER 1" >>confdefs.h @@ -19914,48 +18846,37 @@ $as_echo "#define GNULIB_TEST_GETCWD 1" >>confdefs.h - : - - - - - - - : - - - - if test $ac_cv_func_getdtablesize = yes && test $ac_cv_have_decl_getdtablesize = yes; then - # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit - # up to an unchangeable hard limit; all other platforms correctly - # require setrlimit before getdtablesize() can report a larger value. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getdtablesize works" >&5 $as_echo_n "checking whether getdtablesize works... " >&6; } if ${gl_cv_func_getdtablesize_works+:} false; then : $as_echo_n "(cached) " >&6 else - if test "$cross_compiling" = yes; then : + case "$host_os" in + vms*) gl_cv_func_getdtablesize_works="no (limitation)" ;; + *) + if test "$cross_compiling" = yes; then : case "$host_os" in - cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows - gl_cv_func_getdtablesize_works="guessing no" ;; - *) gl_cv_func_getdtablesize_works="guessing yes" ;; - esac + cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows + gl_cv_func_getdtablesize_works="guessing no" ;; + *) gl_cv_func_getdtablesize_works="guessing yes" ;; + esac + else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include <unistd.h> + #include <unistd.h> int main () { int size = getdtablesize(); - if (dup2 (0, getdtablesize()) != -1) - return 1; - if (size != getdtablesize()) - return 2; + if (dup2 (0, getdtablesize()) != -1) + return 1; + if (size != getdtablesize()) + return 2; ; return 0; @@ -19970,12 +18891,14 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + ;; + esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getdtablesize_works" >&5 $as_echo "$gl_cv_func_getdtablesize_works" >&6; } case "$gl_cv_func_getdtablesize_works" in - *yes) ;; + *yes | "no (limitation)") ;; *) REPLACE_GETDTABLESIZE=1 ;; esac else @@ -20016,23 +18939,11 @@ $as_echo "#define GNULIB_TEST_GETDTABLESIZE 1" >>confdefs.h - : - - - - - if test $ac_cv_have_decl_getlogin_r = no; then HAVE_DECL_GETLOGIN_R=0 fi - : - - - - - if test $ac_cv_func_getlogin_r = no; then HAVE_GETLOGIN_R=0 else @@ -20045,10 +18956,10 @@ if ${gl_cv_func_getlogin_r_works+:} false; then : else case "$host_os" in - # Guess no on OSF/1. - osf*) gl_cv_func_getlogin_r_works="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_getlogin_r_works="guessing yes" ;; + # Guess no on Mac OS X, OSF/1. + darwin* | osf*) gl_cv_func_getlogin_r_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_getlogin_r_works="guessing yes" ;; esac if test "$cross_compiling" = yes; then : : @@ -20057,6 +18968,7 @@ else /* end confdefs.h. */ #include <stddef.h> +#include <string.h> #include <unistd.h> #if !HAVE_DECL_GETLOGIN_R extern @@ -20072,19 +18984,22 @@ main (void) char buf[100]; if (getlogin_r (buf, 0) == 0) - result |= 16; + result |= 1; if (getlogin_r (buf, 1) == 0) - result |= 17; + result |= 2; + if (getlogin_r (buf, 100) == 0) + { + size_t n = strlen (buf); + if (getlogin_r (buf, n) == 0) + result |= 4; + } return result; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : gl_cv_func_getlogin_r_works=yes else - case $? in - 16 | 17) gl_cv_func_getlogin_r_works=no ;; - esac - + gl_cv_func_getlogin_r_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -20113,12 +19028,6 @@ $as_echo "$gl_cv_func_getlogin_r_works" >&6; } - : - - - - - fi @@ -20138,14 +19047,6 @@ $as_echo "#define GNULIB_TEST_GETLOGIN_R 1" >>confdefs.h - : - - - - - - - ac_found=0 @@ -20243,11 +19144,6 @@ $as_echo "#define HAVE_VAR___PROGNAME 1" >>confdefs.h - : - - - - gl_gettimeofday_timezone=void @@ -20257,6 +19153,7 @@ $as_echo "#define HAVE_VAR___PROGNAME 1" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday clobbers localtime buffer" >&5 $as_echo_n "checking whether gettimeofday clobbers localtime buffer... " >&6; } if ${gl_cv_func_gettimeofday_clobber+:} false; then : @@ -20265,10 +19162,14 @@ else if test "$cross_compiling" = yes; then : # When cross-compiling: case "$host_os" in - # Guess all is fine on glibc systems. - *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # If we don't know, assume the worst. - *) gl_cv_func_gettimeofday_clobber="guessing yes" ;; + # Guess all is fine on glibc systems. + *-gnu* | gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;; + # Guess all is fine on musl systems. + *-musl*) gl_cv_func_gettimeofday_clobber="guessing no" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_gettimeofday_clobber="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_gettimeofday_clobber="$gl_cross_guess_inverted" ;; esac else @@ -20313,11 +19214,14 @@ $as_echo "$gl_cv_func_gettimeofday_clobber" >&6; } *yes) REPLACE_GETTIMEOFDAY=1 - REPLACE_GMTIME=1 - REPLACE_LOCALTIME=1 +$as_echo "#define GETTIMEOFDAY_CLOBBERS_LOCALTIME 1" >>confdefs.h + -$as_echo "#define GETTIMEOFDAY_CLOBBERS_LOCALTIME 1" >>confdefs.h + + NEED_LOCALTIME_BUFFER=1 + REPLACE_GMTIME=1 + REPLACE_LOCALTIME=1 ;; esac @@ -20385,7 +19289,9 @@ $as_echo "$gl_cv_func_gettimeofday_posix_signature" >&6; } if test $REPLACE_STRUCT_TIMEVAL = 1; then REPLACE_GETTIMEOFDAY=1 fi - + case "$host_os" in + mingw*) REPLACE_GETTIMEOFDAY=1 ;; + esac fi cat >>confdefs.h <<_ACEOF @@ -20404,31 +19310,7 @@ _ACEOF gl_LIBOBJS="$gl_LIBOBJS gettimeofday.$ac_objext" - - for ac_header in sys/timeb.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/timeb.h" "ac_cv_header_sys_timeb_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_timeb_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_TIMEB_H 1 -_ACEOF - -fi - -done - - for ac_func in _ftime -do : - ac_fn_c_check_func "$LINENO" "_ftime" "ac_cv_func__ftime" -if test "x$ac_cv_func__ftime" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE__FTIME 1 -_ACEOF - -fi -done - - + : fi @@ -20445,76 +19327,67 @@ $as_echo "#define GNULIB_TEST_GETTIMEOFDAY 1" >>confdefs.h - GLOB_H= - for ac_header in glob.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "glob.h" "ac_cv_header_glob_h" "$ac_includes_default" -if test "x$ac_cv_header_glob_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GLOB_H 1 -_ACEOF -else - GLOB_H=glob.h -fi -done - if test -z "$GLOB_H"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU glob interface version 1" >&5 -$as_echo_n "checking for GNU glob interface version 1... " >&6; } -if ${gl_cv_gnu_glob_interface_version_1+:} false; then : + if test $ac_cv_func_glob = no; then + HAVE_GLOB=0 + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU glob interface version 1 or 2" >&5 +$as_echo_n "checking for GNU glob interface version 1 or 2... " >&6; } +if ${gl_cv_gnu_glob_interface_version_1_2+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <gnu-versions.h> -char a[_GNU_GLOB_INTERFACE_VERSION == 1 ? 1 : -1]; +char a[_GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2 ? 1 : -1]; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_gnu_glob_interface_version_1=yes + gl_cv_gnu_glob_interface_version_1_2=yes else - gl_cv_gnu_glob_interface_version_1=no + gl_cv_gnu_glob_interface_version_1_2=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_gnu_glob_interface_version_1" >&5 -$as_echo "$gl_cv_gnu_glob_interface_version_1" >&6; } - - if test "$gl_cv_gnu_glob_interface_version_1" = "no"; then - GLOB_H=glob.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_gnu_glob_interface_version_1_2" >&5 +$as_echo "$gl_cv_gnu_glob_interface_version_1_2" >&6; } + if test "$gl_cv_gnu_glob_interface_version_1_2" = "no"; then + REPLACE_GLOB=1 fi - fi - if test -z "$GLOB_H"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether glob lists broken symlinks" >&5 + if test $REPLACE_GLOB = 0; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether glob lists broken symlinks" >&5 $as_echo_n "checking whether glob lists broken symlinks... " >&6; } if ${gl_cv_glob_lists_symlinks+:} false; then : $as_echo_n "(cached) " >&6 else - if ln -s conf-doesntexist conf$$-globtest 2>/dev/null; then - gl_cv_glob_lists_symlinks=maybe - else - # If we can't make a symlink, then we cannot test this issue. Be - # pessimistic about this. - gl_cv_glob_lists_symlinks=no - fi + if test $cross_compiling != yes; then + if ln -s conf-doesntexist conf$$-globtest 2>/dev/null; then + gl_cv_glob_lists_symlinks=maybe + else + # If we can't make a symlink, then we cannot test this issue. Be + # pessimistic about this. + gl_cv_glob_lists_symlinks=no + fi + if test $gl_cv_glob_lists_symlinks = maybe; then + if test "$cross_compiling" = yes; then : + : - if test $gl_cv_glob_lists_symlinks = maybe; then - if test "$cross_compiling" = yes; then : - gl_cv_glob_lists_symlinks=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include <stddef.h> -#include <glob.h> + #include <glob.h> int main () { glob_t found; -if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH) return 1; + if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH) + return 1; + ; return 0; } @@ -20528,19 +19401,35 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi + fi + rm -f conf$$-globtest + else + gl_cv_glob_lists_symlinks="$gl_cross_guess_normal" + fi + fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_glob_lists_symlinks" >&5 $as_echo "$gl_cv_glob_lists_symlinks" >&6; } + case "$gl_cv_glob_lists_symlinks" in + *yes) ;; + *) REPLACE_GLOB=1 ;; + esac + fi - if test $gl_cv_glob_lists_symlinks = no; then - GLOB_H=glob.h + fi + + if test $ac_cv_func_glob_pattern_p = no; then + HAVE_GLOB_PATTERN_P=0 + else + if test $REPLACE_GLOB = 1; then + REPLACE_GLOB_PATTERN_P=1 fi fi - rm -f conf$$-globtest + if test $HAVE_GLOB = 0 || test $REPLACE_GLOB = 1; then + GLOB_H='glob.h' if test -n "$GLOB_H"; then GL_GENERATE_GLOB_H_TRUE= GL_GENERATE_GLOB_H_FALSE='#' @@ -20550,7 +19439,9 @@ else fi - if test -n "$GLOB_H"; then + fi + + if test $HAVE_GLOB = 0 || test $REPLACE_GLOB = 1; then @@ -20563,24 +19454,21 @@ fi - : + gl_LIBOBJS="$gl_LIBOBJS globfree.$ac_objext" + - if test $ac_cv_header_sys_cdefs_h = yes; then - HAVE_SYS_CDEFS_H=1 - else - HAVE_SYS_CDEFS_H=0 - fi - : + fi + if test $HAVE_GLOB_PATTERN_P = 0 || test $REPLACE_GLOB_PATTERN_P = 1; then @@ -20589,30 +19477,38 @@ fi + gl_LIBOBJS="$gl_LIBOBJS glob_pattern_p.$ac_objext" fi - : + GNULIB_GLOB=1 - HAVE_INET_NTOP=1 - INET_NTOP_LIB= + +$as_echo "#define GNULIB_TEST_GLOB 1" >>confdefs.h - : + + + HAVE_INET_NTOP=1 + INET_NTOP_LIB= + + + + if test $ac_cv_header_sys_socket_h != yes; then for ac_header in winsock2.h do : @@ -20637,6 +19533,7 @@ done if test $HAVE_WINSOCK2_H = 1; then + REPLACE_INET_NTOP=1 ac_fn_c_check_decl "$LINENO" "inet_ntop" "ac_cv_have_decl_inet_ntop" "#include <ws2tcpip.h> " if test "x$ac_cv_have_decl_inet_ntop" = xyes; then : @@ -20650,11 +19547,9 @@ cat >>confdefs.h <<_ACEOF _ACEOF if test $ac_cv_have_decl_inet_ntop = yes; then - REPLACE_INET_NTOP=1 INET_NTOP_LIB="-lws2_32" else HAVE_DECL_INET_NTOP=0 - HAVE_INET_NTOP=0 fi else gl_save_LIBS=$LIBS @@ -20682,7 +19577,7 @@ return inet_ntop (); return 0; } _ACEOF -for ac_lib in '' nsl resolv; do +for ac_lib in '' nsl resolv network; do if test -z "$ac_lib"; then ac_res="none required" else @@ -20738,12 +19633,6 @@ fi fi - : - - - - - ac_fn_c_check_decl "$LINENO" "inet_ntop" "ac_cv_have_decl_inet_ntop" "#include <arpa/inet.h> #if HAVE_NETDB_H # include <netdb.h> @@ -21157,8 +20046,29 @@ if ${gl_cv_func_isnanl_works+:} false; then : else if test "$cross_compiling" = yes; then : + case "$host_os" in + mingw*) # Guess yes on mingw, no on MSVC. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __MINGW32__ + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1; then : gl_cv_func_isnanl_works="guessing yes" else + gl_cv_func_isnanl_works="guessing no" +fi +rm -f conftest* + + ;; + *) gl_cv_func_isnanl_works="guessing yes" ;; + esac + +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21311,7 +20221,7 @@ $as_echo "#define HAVE_ISNANL_IN_LIBC 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'long double'" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'long double'" >&5 $as_echo_n "checking where to find the exponent in a 'long double'... " >&6; } if ${gl_cv_cc_long_double_expbit0+:} false; then : $as_echo_n "(cached) " >&6 @@ -21320,6 +20230,39 @@ else if test "$cross_compiling" = yes; then : gl_cv_cc_long_double_expbit0="unknown" + case "$host_os" in + mingw*) # On native Windows (little-endian), we know the result + # in two cases: mingw, MSVC. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __MINGW32__ + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1; then : + gl_cv_cc_long_double_expbit0="word 2 bit 0" +fi +rm -f conftest* + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1; then : + gl_cv_cc_long_double_expbit0="word 1 bit 20" +fi +rm -f conftest* + + ;; + esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21427,35 +20370,239 @@ _ACEOF fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the __inline keyword" >&5 +$as_echo_n "checking whether the compiler supports the __inline keyword... " >&6; } +if ${gl_cv_c___inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +typedef int foo_t; + static __inline foo_t foo (void) { return 0; } +int +main () +{ +return foo (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_c___inline=yes +else + gl_cv_c___inline=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c___inline" >&5 +$as_echo "$gl_cv_c___inline" >&6; } + if test $gl_cv_c___inline = yes; then +$as_echo "#define HAVE___INLINE 1" >>confdefs.h + fi - : + LOCALCHARSET_TESTS_ENVIRONMENT= - LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\"" + + + + + gl_LIBOBJS="$gl_LIBOBJS localtime-buffer.$ac_objext" if test "$gl_threads_api" = posix; then # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the # pthread_rwlock_* functions. + has_rwlock=false ac_fn_c_check_type "$LINENO" "pthread_rwlock_t" "ac_cv_type_pthread_rwlock_t" "#include <pthread.h> " if test "x$ac_cv_type_pthread_rwlock_t" = xyes; then : + has_rwlock=true $as_echo "#define HAVE_PTHREAD_RWLOCK 1" >>confdefs.h fi + if $has_rwlock; then + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthread_rwlock_rdlock prefers a writer to a reader" >&5 +$as_echo_n "checking whether pthread_rwlock_rdlock prefers a writer to a reader... " >&6; } +if ${gl_cv_pthread_rwlock_rdlock_prefer_writer+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LIBS="$LIBS" + LIBS="$LIBS $LIBMULTITHREAD" + if test "$cross_compiling" = yes; then : + case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on musl systems. + *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on bionic systems. + *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess yes on native Windows with the mingw-w64 winpthreads library. + # Guess no on native Windows with the gnulib windows-rwlock module. + mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" + else + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" + fi + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <errno.h> +#include <pthread.h> +#include <stdlib.h> +#include <unistd.h> + +#define SUCCEED() exit (0) +#define FAILURE() exit (1) +#define UNEXPECTED(n) (exit (10 + (n))) + +/* The main thread creates the waiting writer and the requesting reader threads + in the default way; this guarantees that they have the same priority. + We can reuse the main thread as first reader thread. */ + +static pthread_rwlock_t lock; +static pthread_t reader1; +static pthread_t writer; +static pthread_t reader2; +static pthread_t timer; +/* Used to pass control from writer to reader2 and from reader2 to timer, + as in a relay race. + Passing control from one running thread to another running thread + is most likely faster than to create the second thread. */ +static pthread_mutex_t baton; + +static void * +timer_func (void *ignored) +{ + /* Step 13 (can be before or after step 12): + The timer thread takes the baton, then waits a moment to make sure + it can tell whether the second reader thread is blocked at step 12. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (13); + usleep (100000); + /* By the time we get here, it's clear that the second reader thread is + blocked at step 12. This is the desired behaviour. */ + SUCCEED (); +} + +static void * +reader2_func (void *ignored) +{ + int err; + + /* Step 8 (can be before or after step 7): + The second reader thread takes the baton, then waits a moment to make sure + the writer thread has reached step 7. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (8); + usleep (100000); + /* Step 9: The second reader thread requests the lock. */ + err = pthread_rwlock_tryrdlock (&lock); + if (err == 0) + FAILURE (); + else if (err != EBUSY) + UNEXPECTED (9); + /* Step 10: Launch a timer, to test whether the next call blocks. */ + if (pthread_create (&timer, NULL, timer_func, NULL)) + UNEXPECTED (10); + /* Step 11: Release the baton. */ + if (pthread_mutex_unlock (&baton)) + UNEXPECTED (11); + /* Step 12: The second reader thread requests the lock. */ + err = pthread_rwlock_rdlock (&lock); + if (err == 0) + FAILURE (); + else + UNEXPECTED (12); +} + +static void * +writer_func (void *ignored) +{ + /* Step 4: Take the baton, so that the second reader thread does not go ahead + too early. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (4); + /* Step 5: Create the second reader thread. */ + if (pthread_create (&reader2, NULL, reader2_func, NULL)) + UNEXPECTED (5); + /* Step 6: Release the baton. */ + if (pthread_mutex_unlock (&baton)) + UNEXPECTED (6); + /* Step 7: The writer thread requests the lock. */ + if (pthread_rwlock_wrlock (&lock)) + UNEXPECTED (7); + return NULL; +} + +int +main () +{ + reader1 = pthread_self (); + + /* Step 1: The main thread initializes the lock and the baton. */ + if (pthread_rwlock_init (&lock, NULL)) + UNEXPECTED (1); + if (pthread_mutex_init (&baton, NULL)) + UNEXPECTED (1); + /* Step 2: The main thread acquires the lock as a reader. */ + if (pthread_rwlock_rdlock (&lock)) + UNEXPECTED (2); + /* Step 3: Create the writer thread. */ + if (pthread_create (&writer, NULL, writer_func, NULL)) + UNEXPECTED (3); + /* Job done. Go to sleep. */ + for (;;) + { + sleep (1); + } +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_pthread_rwlock_rdlock_prefer_writer=yes +else + gl_cv_pthread_rwlock_rdlock_prefer_writer=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + LIBS="$save_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_pthread_rwlock_rdlock_prefer_writer" >&5 +$as_echo "$gl_cv_pthread_rwlock_rdlock_prefer_writer" >&6; } + case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in + *yes) + +$as_echo "#define HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER 1" >>confdefs.h + + ;; + esac + + fi # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21498,16 +20645,11 @@ _ACEOF - : - - - - if test $ac_cv_func_lstat = yes; then - case "$gl_cv_func_lstat_dereferences_slashed_symlink" in - *no) + case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in + solaris* | *no) REPLACE_LSTAT=1 ;; esac @@ -21593,12 +20735,6 @@ $as_echo "#define GNULIB_TEST_MALLOC_POSIX 1" >>confdefs.h - : - - - - - @@ -21739,44 +20875,6 @@ $as_echo "$gl_cv_header_math_huge_val_works" >&6; } fi - for gl_func in acosf acosl asinf asinl atanf atanl cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf expf expl exp2 exp2f exp2l expm1 expm1f expm1l fabsf fabsl floorf floorl fma fmaf fmal fmod fmodf fmodl frexpf frexpl hypotf hypotl ilogb ilogbf ilogbl ldexpf ldexpl log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l logb logbf logbl modf modff modfl powf remainder remainderf remainderl rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl tanf tanl tanhf trunc truncf truncl; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <math.h> -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - - eval ac_cv_have_decl_$gl_func=yes -fi - done - @@ -21787,16 +20885,6 @@ fi - : - - - - - - - : - - @@ -21804,6 +20892,7 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles incomplete characters" >&5 $as_echo_n "checking whether mbrtowc handles incomplete characters... " >&6; } if ${gl_cv_func_mbrtowc_incomplete_state+:} false; then : @@ -21844,7 +20933,7 @@ int main () memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) - return 1; + return 2; } return 0; } @@ -21858,6 +20947,50 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + else + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <locale.h> +#include <string.h> +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be + included before <wchar.h>. */ +#include <stddef.h> +#include <stdio.h> +#include <time.h> +#include <wchar.h> +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + const char input[] = "B\303\274\303\237er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_mbrtowc_incomplete_state=yes +else + gl_cv_func_mbrtowc_incomplete_state=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi fi fi @@ -21911,7 +21044,7 @@ int main () memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 6, &state) != 4 && mbtowc (&wc, input + 3, 6) == 4) - return 1; + return 2; } return 0; } @@ -21946,12 +21079,6 @@ $as_echo "$gl_cv_func_mbrtowc_sanitycheck" >&6; } - : - - - - - if test $ac_cv_func_mbrtowc = no; then HAVE_MBRTOWC=0 ac_fn_c_check_decl "$LINENO" "mbrtowc" "ac_cv_have_decl_mbrtowc" " @@ -22104,7 +21231,7 @@ int main () mbrtowc (&wc, NULL, 5, &state); /* Check that wc was not modified. */ if (wc != (wchar_t) 0xBADFACE) - return 1; + return 2; } return 0; } @@ -22304,7 +21431,7 @@ int main () memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "", 1, &state) != 0) - return 1; + return 2; } return 0; } @@ -22333,10 +21460,11 @@ if ${gl_cv_func_mbrtowc_empty_input+:} false; then : else case "$host_os" in - # Guess no on AIX and glibc systems. - aix* | *-gnu*) - gl_cv_func_mbrtowc_empty_input="guessing no" ;; - *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; + # Guess no on AIX and glibc systems. + aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; + *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; esac if test "$cross_compiling" = yes; then : : @@ -22368,16 +21496,20 @@ fi $as_echo "$gl_cv_func_mbrtowc_empty_input" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C locale is free of encoding errors" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C locale is free of encoding errors" >&5 $as_echo_n "checking whether the C locale is free of encoding errors... " >&6; } if ${gl_cv_C_locale_sans_EILSEQ+:} false; then : $as_echo_n "(cached) " >&6 else - gl_cv_C_locale_sans_EILSEQ="guessing no" + gl_cv_C_locale_sans_EILSEQ="$gl_cross_guess_normal" if test "$cross_compiling" = yes; then : - : + case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_C_locale_sans_EILSEQ="guessing yes" ;; + esac + else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -22392,7 +21524,7 @@ main () int i; char *locale = setlocale (LC_ALL, "C"); if (! locale) - return 1; + return 2; for (i = CHAR_MIN; i <= CHAR_MAX; i++) { char c = i; @@ -22400,7 +21532,7 @@ main () mbstate_t mbs = { 0, }; size_t ss = mbrtowc (&wc, &c, 1, &mbs); if (1 < ss) - return 1; + return 3; } return 0; @@ -22417,6 +21549,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_C_locale_sans_EILSEQ" >&5 $as_echo "$gl_cv_C_locale_sans_EILSEQ" >&6; } @@ -22484,6 +21617,7 @@ $as_echo "#define C_LOCALE_MAYBE_EILSEQ 1" >>confdefs.h gl_LIBOBJS="$gl_LIBOBJS mbrtowc.$ac_objext" + : fi @@ -22512,23 +21646,12 @@ $as_echo "#define GNULIB_TEST_MBRTOWC 1" >>confdefs.h - : - - - - - - - : - - - - if test $ac_cv_func_mbsinit = yes && test $ac_cv_func_mbrtowc = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles incomplete characters" >&5 $as_echo_n "checking whether mbrtowc handles incomplete characters... " >&6; } if ${gl_cv_func_mbrtowc_incomplete_state+:} false; then : @@ -22569,7 +21692,50 @@ int main () memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) - return 1; + return 2; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_mbrtowc_incomplete_state=yes +else + gl_cv_func_mbrtowc_incomplete_state=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + else + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <locale.h> +#include <string.h> +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be + included before <wchar.h>. */ +#include <stddef.h> +#include <stdio.h> +#include <time.h> +#include <wchar.h> +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + const char input[] = "B\303\274\303\237er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; } return 0; } @@ -22583,6 +21749,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi fi fi @@ -22636,7 +21803,7 @@ int main () memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 6, &state) != 4 && mbtowc (&wc, input + 3, 6) == 4) - return 1; + return 2; } return 0; } @@ -22671,12 +21838,6 @@ $as_echo "$gl_cv_func_mbrtowc_sanitycheck" >&6; } - : - - - - - if test $ac_cv_func_mbsinit = no; then HAVE_MBSINIT=0 ac_fn_c_check_decl "$LINENO" "mbsinit" "ac_cv_have_decl_mbsinit" " @@ -22752,23 +21913,12 @@ $as_echo "#define GNULIB_TEST_MBSINIT 1" >>confdefs.h - : - - - - - - - : - - - - if test $ac_cv_func_mbsinit = yes && test $ac_cv_func_mbrtowc = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc handles incomplete characters" >&5 $as_echo_n "checking whether mbrtowc handles incomplete characters... " >&6; } if ${gl_cv_func_mbrtowc_incomplete_state+:} false; then : @@ -22809,7 +21959,7 @@ int main () memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) - return 1; + return 2; } return 0; } @@ -22823,6 +21973,50 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + else + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <locale.h> +#include <string.h> +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be + included before <wchar.h>. */ +#include <stddef.h> +#include <stdio.h> +#include <time.h> +#include <wchar.h> +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + const char input[] = "B\303\274\303\237er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_mbrtowc_incomplete_state=yes +else + gl_cv_func_mbrtowc_incomplete_state=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi fi fi @@ -22876,7 +22070,7 @@ int main () memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 6, &state) != 4 && mbtowc (&wc, input + 3, 6) == 4) - return 1; + return 2; } return 0; } @@ -22911,12 +22105,6 @@ $as_echo "$gl_cv_func_mbrtowc_sanitycheck" >&6; } - : - - - - - if test $ac_cv_func_mbsrtowcs = no; then HAVE_MBSRTOWCS=0 ac_fn_c_check_decl "$LINENO" "mbsrtowcs" "ac_cv_have_decl_mbsrtowcs" " @@ -23180,7 +22368,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky user" >/dev/null 2>&1; then : gl_cv_func_memmem_works_fast="guessing yes" else - gl_cv_func_memmem_works_fast="guessing no" + gl_cv_func_memmem_works_fast="$gl_cross_guess_normal" fi rm -f conftest* @@ -23217,6 +22405,9 @@ main () if (!memmem (haystack, 2 * m + 1, needle, m + 1)) result |= 1; } + /* Free allocated memory, in case some sanitizer is watching. */ + free (haystack); + free (needle); return result; ; @@ -23277,12 +22468,6 @@ done HAVE_MEMMEM=0 fi - : - - - - - if test $ac_cv_have_decl_memmem = no; then HAVE_DECL_MEMMEM=0 else @@ -23317,7 +22502,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky user" >/dev/null 2>&1; then : gl_cv_func_memmem_works_always="guessing yes" else - gl_cv_func_memmem_works_always="guessing no" + gl_cv_func_memmem_works_always="$gl_cross_guess_normal" fi rm -f conftest* @@ -23455,12 +22640,6 @@ $as_echo "#define GNULIB_TEST_MEMPCPY 1" >>confdefs.h - : - - - - - if test $ac_cv_have_decl_memrchr = no; then HAVE_DECL_MEMRCHR=0 fi @@ -23507,12 +22686,6 @@ $as_echo "#define GNULIB_TEST_MEMRCHR 1" >>confdefs.h - : - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mkdir handles trailing slash" >&5 $as_echo_n "checking whether mkdir handles trailing slash... " >&6; } if ${gl_cv_func_mkdir_trailing_slash_works+:} false; then : @@ -23521,10 +22694,30 @@ else rm -rf conftest.dir if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_mkdir_trailing_slash_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1; then : + gl_cv_func_mkdir_trailing_slash_works="guessing yes" +else + gl_cv_func_mkdir_trailing_slash_works="guessing no" +fi +rm -f conftest* + + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_mkdir_trailing_slash_works="$gl_cross_guess_normal" ;; esac else @@ -23572,10 +22765,14 @@ else rm -rf conftest.dir if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_mkdir_trailing_dot_works="guessing no" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_mkdir_trailing_dot_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_mkdir_trailing_dot_works="$gl_cross_guess_normal" ;; esac else @@ -23682,12 +22879,6 @@ $as_echo "#define GNULIB_TEST_MKDTEMP 1" >>confdefs.h - : - - - - - if test $ac_cv_func_mkostemp != yes; then HAVE_MKOSTEMP=0 fi @@ -23756,6 +22947,13 @@ $as_echo "#define GNULIB_TEST_MKOSTEMP 1" >>confdefs.h fi +cat >>confdefs.h <<_ACEOF +#define GNULIB_MSVC_NOTHROW 1 +_ACEOF + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <netinet/in.h> is self-contained" >&5 $as_echo_n "checking whether <netinet/in.h> is self-contained... " >&6; } if ${gl_cv_header_netinet_in_h_selfcontained+:} false; then : @@ -23805,12 +23003,6 @@ done - : - - - - - @@ -23903,36 +23095,36 @@ fi + case "$host_os" in mingw* | pw*) REPLACE_OPEN=1 ;; *) - : - - - + if test "$gl_cv_macro_O_CLOEXEC" != yes; then + REPLACE_OPEN=1 + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether open recognizes a trailing slash" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether open recognizes a trailing slash" >&5 $as_echo_n "checking whether open recognizes a trailing slash... " >&6; } if ${gl_cv_func_open_slash+:} false; then : $as_echo_n "(cached) " >&6 else # Assume that if we have lstat, we can also check symlinks. - if test $ac_cv_func_lstat = yes; then - touch conftest.tmp - ln -s conftest.tmp conftest.lnk - fi - if test "$cross_compiling" = yes; then : + if test $ac_cv_func_lstat = yes; then + touch conftest.tmp + ln -s conftest.tmp conftest.lnk + fi + if test "$cross_compiling" = yes; then : - case "$host_os" in - freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) - gl_cv_func_open_slash="guessing no" ;; - *) - gl_cv_func_open_slash="guessing yes" ;; - esac + case "$host_os" in + freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) + gl_cv_func_open_slash="guessing no" ;; + *) + gl_cv_func_open_slash="guessing yes" ;; + esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -23963,16 +23155,21 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - rm -f conftest.sl conftest.tmp conftest.lnk + rm -f conftest.sl conftest.tmp conftest.lnk fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_open_slash" >&5 $as_echo "$gl_cv_func_open_slash" >&6; } - case "$gl_cv_func_open_slash" in - *no) + case "$gl_cv_func_open_slash" in + *no) $as_echo "#define OPEN_TRAILING_SLASH_BUG 1" >>confdefs.h + ;; + esac + + case "$gl_cv_func_open_slash" in + *no) REPLACE_OPEN=1 ;; esac @@ -23983,12 +23180,6 @@ $as_echo "#define OPEN_TRAILING_SLASH_BUG 1" >>confdefs.h - : - - - - - if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi @@ -24035,17 +23226,13 @@ $as_echo "#define GNULIB_TEST_OPEN 1" >>confdefs.h - : - - - - - case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink in - yes+*yes) + case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink+$gl_cv_macro_O_CLOEXEC in + yes+*yes+yes) ;; yes+*) + # Solaris 10 lacks O_CLOEXEC. # Solaris 9 has *at functions, but uniformly mishandles trailing # slash in all of them. REPLACE_OPENAT=1 @@ -24113,12 +23300,6 @@ done - : - - - - - if test $ac_cv_func_fchdir = no; then HAVE_FCHDIR=0 fi @@ -24163,12 +23344,6 @@ $as_echo "#define GNULIB_TEST_OPENDIR 1" >>confdefs.h - : - - - - - @@ -24265,12 +23440,6 @@ $as_echo "#define GNULIB_TEST_READDIR 1" >>confdefs.h - : - - - - - if test $ac_cv_func_readlink = no; then HAVE_READLINK=0 else @@ -24311,10 +23480,12 @@ else ln -s conftest.link conftest.lnk2 if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_readlink_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_readlink_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_readlink_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_readlink_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_readlink_works="$gl_cross_guess_normal" ;; esac else @@ -24431,12 +23602,6 @@ $as_echo "#define GNULIB_TEST_REALLOC_POSIX 1" >>confdefs.h - : - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether rename honors trailing slash on destination" >&5 $as_echo_n "checking whether rename honors trailing slash on destination... " >&6; } @@ -24452,10 +23617,14 @@ else fi if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rename_slash_dst_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_rename_slash_dst_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rename_slash_dst_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_rename_slash_dst_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_rename_slash_dst_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rename_slash_dst_works="$gl_cross_guess_normal" ;; esac else @@ -24521,10 +23690,14 @@ else fi if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rename_slash_src_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_rename_slash_src_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rename_slash_src_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_rename_slash_src_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_rename_slash_src_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rename_slash_src_works="$gl_cross_guess_normal" ;; esac else @@ -24577,50 +23750,49 @@ $as_echo "#define RENAME_TRAILING_SLASH_SOURCE_BUG 1" >>confdefs.h esac - : - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether rename manages hard links correctly" >&5 $as_echo_n "checking whether rename manages hard links correctly... " >&6; } if ${gl_cv_func_rename_link_works+:} false; then : $as_echo_n "(cached) " >&6 else if test $ac_cv_func_link = yes; then - rm -rf conftest.f conftest.f1 - if touch conftest.f && ln conftest.f conftest.f1 && - set x `ls -i conftest.f conftest.f1` && test "" = ""; then - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rename_link_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_rename_link_works="guessing no" ;; - esac + if test $cross_compiling != yes; then + rm -rf conftest.f conftest.f1 conftest.f2 + if touch conftest.f conftest.f2 && ln conftest.f conftest.f1 && + set x `ls -i conftest.f conftest.f1` && test "" = ""; then + if test "$cross_compiling" = yes; then : + : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> +# include <errno.h> +# include <stdio.h> +# include <stdlib.h> +# include <unistd.h> int main () { int result = 0; - if (rename ("conftest.f", "conftest.f1")) - result |= 1; - if (unlink ("conftest.f1")) - result |= 2; - if (rename ("conftest.f", "conftest.f")) - result |= 4; - if (rename ("conftest.f1", "conftest.f1") == 0) - result |= 8; - return result; + if (rename ("conftest.f", "conftest.f1")) + result |= 1; + if (unlink ("conftest.f1")) + result |= 2; + + /* Allow either the POSIX-required behavior, where the + previous rename kept conftest.f, or the (better) NetBSD + behavior, where it removed conftest.f. */ + if (rename ("conftest.f", "conftest.f") != 0 + && errno != ENOENT) + result |= 4; + + if (rename ("conftest.f1", "conftest.f1") == 0) + result |= 8; + if (rename ("conftest.f2", "conftest.f2") != 0) + result |= 16; + return result; ; return 0; @@ -24635,10 +23807,22 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + else + gl_cv_func_rename_link_works="guessing no" + fi + rm -rf conftest.f conftest.f1 conftest.f2 else - gl_cv_func_rename_link_works="guessing no" + case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rename_link_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_rename_link_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_rename_link_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rename_link_works="$gl_cross_guess_normal" ;; + esac fi - rm -rf conftest.f conftest.f1 else gl_cv_func_rename_link_works=yes fi @@ -24666,10 +23850,14 @@ else as_fn_error $? "cannot create temporary files" "$LINENO" 5 if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rename_dest_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_rename_dest_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rename_dest_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_rename_dest_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_rename_dest_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rename_dest_works="$gl_cross_guess_normal" ;; esac else @@ -24792,12 +23980,6 @@ $as_echo "#define GNULIB_TEST_REWINDDIR 1" >>confdefs.h - : - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether rmdir works" >&5 $as_echo_n "checking whether rmdir works... " >&6; } if ${gl_cv_func_rmdir_works+:} false; then : @@ -24807,10 +23989,14 @@ else touch conftest.file if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rmdir_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_rmdir_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rmdir_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_rmdir_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_rmdir_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rmdir_works="$gl_cross_guess_normal" ;; esac else @@ -24889,96 +24075,6 @@ $as_echo "#define GNULIB_TEST_RMDIR 1" >>confdefs.h - : - - - - - - - - - - - - : - - - - - - if test $ac_cv_func_secure_getenv = no; then - HAVE_SECURE_GETENV=0 - fi - - if test $HAVE_SECURE_GETENV = 0; then - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS secure_getenv.$ac_objext" - - - for ac_func in __secure_getenv -do : - ac_fn_c_check_func "$LINENO" "__secure_getenv" "ac_cv_func___secure_getenv" -if test "x$ac_cv_func___secure_getenv" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE___SECURE_GETENV 1 -_ACEOF - -fi -done - - if test $ac_cv_func___secure_getenv = no; then - for ac_func in issetugid -do : - ac_fn_c_check_func "$LINENO" "issetugid" "ac_cv_func_issetugid" -if test "x$ac_cv_func_issetugid" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ISSETUGID 1 -_ACEOF - -fi -done - - fi - - : - - - - - - - - - - - - - - - - fi - - - - - - GNULIB_SECURE_GETENV=1 - - - - - -$as_echo "#define GNULIB_TEST_SECURE_GETENV 1" >>confdefs.h - - @@ -24992,10 +24088,12 @@ if ${gl_cv_func_setenv_works+:} false; then : else if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_setenv_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_setenv_works="guessing no" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_setenv_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_setenv_works="$gl_cross_guess_normal" ;; esac else @@ -25181,44 +24279,7 @@ fi - for gl_func in pthread_sigmask sigaction sigaddset sigdelset sigemptyset sigfillset sigismember sigpending sigprocmask; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <signal.h> - -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - eval ac_cv_have_decl_$gl_func=yes -fi - done ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " @@ -25238,7 +24299,7 @@ if test "x$ac_cv_type_socklen_t" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t equivalent" >&5 $as_echo_n "checking for socklen_t equivalent... " >&6; } - if ${gl_cv_socklen_t_equiv+:} false; then : +if ${gl_cv_socklen_t_equiv+:} false; then : $as_echo_n "(cached) " >&6 else # Systems have either "struct sockaddr *" or @@ -25269,13 +24330,12 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done test "$gl_cv_socklen_t_equiv" != "" && break done + if test "$gl_cv_socklen_t_equiv" = ""; then + as_fn_error $? "Cannot find a type to use in place of socklen_t" "$LINENO" 5 + fi fi - - if test "$gl_cv_socklen_t_equiv" = ""; then - as_fn_error $? "Cannot find a type to use in place of socklen_t" "$LINENO" 5 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_socklen_t_equiv" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_socklen_t_equiv" >&5 $as_echo "$gl_cv_socklen_t_equiv" >&6; } cat >>confdefs.h <<_ACEOF @@ -25320,64 +24380,31 @@ $as_echo "#define ssize_t int" >>confdefs.h - : - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on directories" >&5 -$as_echo_n "checking whether stat handles trailing slashes on directories... " >&6; } -if ${gl_cv_func_stat_dir_slash+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case $host_os in - mingw*) gl_cv_func_stat_dir_slash="guessing no";; - *) gl_cv_func_stat_dir_slash="guessing yes";; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <sys/stat.h> - -int -main () -{ -struct stat st; return stat (".", &st) != stat ("./", &st); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_stat_dir_slash=yes -else - gl_cv_func_stat_dir_slash=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_stat_dir_slash" >&5 -$as_echo "$gl_cv_func_stat_dir_slash" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on files" >&5 + case "$host_os" in + mingw*) + REPLACE_STAT=1 + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on files" >&5 $as_echo_n "checking whether stat handles trailing slashes on files... " >&6; } if ${gl_cv_func_stat_file_slash+:} false; then : $as_echo_n "(cached) " >&6 else touch conftest.tmp - # Assume that if we have lstat, we can also check symlinks. - if test $ac_cv_func_lstat = yes; then - ln -s conftest.tmp conftest.lnk - fi - if test "$cross_compiling" = yes; then : + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.tmp conftest.lnk + fi + if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_stat_file_slash="guessing no" ;; - esac + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;; + esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -25388,14 +24415,14 @@ int main () { int result = 0; - struct stat st; - if (!stat ("conftest.tmp/", &st)) - result |= 1; + struct stat st; + if (!stat ("conftest.tmp/", &st)) + result |= 1; #if HAVE_LSTAT - if (!stat ("conftest.lnk/", &st)) - result |= 2; + if (!stat ("conftest.lnk/", &st)) + result |= 2; #endif - return result; + return result; ; return 0; @@ -25410,21 +24437,22 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - rm -f conftest.tmp conftest.lnk + rm -f conftest.tmp conftest.lnk fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_stat_file_slash" >&5 $as_echo "$gl_cv_func_stat_file_slash" >&6; } - case $gl_cv_func_stat_dir_slash in - *no) REPLACE_STAT=1 - -$as_echo "#define REPLACE_FUNC_STAT_DIR 1" >>confdefs.h -;; - esac - case $gl_cv_func_stat_file_slash in - *no) REPLACE_STAT=1 + case $gl_cv_func_stat_file_slash in + *no) + REPLACE_STAT=1 $as_echo "#define REPLACE_FUNC_STAT_FILE 1" >>confdefs.h ;; + esac + case $host_os in + solaris*) + REPLACE_FSTAT=1 ;; + esac + ;; esac if test $REPLACE_STAT = 1; then @@ -25438,7 +24466,24 @@ $as_echo "#define REPLACE_FUNC_STAT_FILE 1" >>confdefs.h gl_LIBOBJS="$gl_LIBOBJS stat.$ac_objext" - : + case "$host_os" in + mingw*) + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS stat-w32.$ac_objext" + + ;; + esac + + + : + fi @@ -25456,6 +24501,144 @@ $as_echo "#define GNULIB_TEST_STAT 1" >>confdefs.h + + + + ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.tv_nsec" "ac_cv_member_struct_stat_st_atim_tv_nsec" "#include <sys/types.h> + #include <sys/stat.h> +" +if test "x$ac_cv_member_struct_stat_st_atim_tv_nsec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1 +_ACEOF + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct stat.st_atim is of type struct timespec" >&5 +$as_echo_n "checking whether struct stat.st_atim is of type struct timespec... " >&6; } +if ${ac_cv_typeof_struct_stat_st_atim_is_struct_timespec+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <sys/types.h> + #include <sys/stat.h> + #if HAVE_SYS_TIME_H + # include <sys/time.h> + #endif + #include <time.h> + struct timespec ts; + struct stat st; + +int +main () +{ + + st.st_atim = ts; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes +else + ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&5 +$as_echo "$ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&6; } + if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then + +$as_echo "#define TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC 1" >>confdefs.h + + fi +else + ac_fn_c_check_member "$LINENO" "struct stat" "st_atimespec.tv_nsec" "ac_cv_member_struct_stat_st_atimespec_tv_nsec" "#include <sys/types.h> + #include <sys/stat.h> +" +if test "x$ac_cv_member_struct_stat_st_atimespec_tv_nsec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC 1 +_ACEOF + + +else + ac_fn_c_check_member "$LINENO" "struct stat" "st_atimensec" "ac_cv_member_struct_stat_st_atimensec" "#include <sys/types.h> + #include <sys/stat.h> +" +if test "x$ac_cv_member_struct_stat_st_atimensec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1 +_ACEOF + + +else + ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.st__tim.tv_nsec" "ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" "#include <sys/types.h> + #include <sys/stat.h> +" +if test "x$ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC 1 +_ACEOF + + +fi + +fi + +fi + +fi + + + + + + ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimespec.tv_nsec" "ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" "#include <sys/types.h> + #include <sys/stat.h> +" +if test "x$ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1 +_ACEOF + + +else + ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimensec" "ac_cv_member_struct_stat_st_birthtimensec" "#include <sys/types.h> + #include <sys/stat.h> +" +if test "x$ac_cv_member_struct_stat_st_birthtimensec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC 1 +_ACEOF + + +else + ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtim.tv_nsec" "ac_cv_member_struct_stat_st_birthtim_tv_nsec" "#include <sys/types.h> + #include <sys/stat.h> +" +if test "x$ac_cv_member_struct_stat_st_birthtim_tv_nsec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC 1 +_ACEOF + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working stdalign.h" >&5 $as_echo_n "checking for working stdalign.h... " >&6; } if ${gl_cv_header_working_stdalign_h+:} false; then : @@ -25468,7 +24651,7 @@ else /* Test that alignof yields a result consistent with offsetof. This catches GCC bug 52023 - <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ #ifdef __cplusplus template <class t> struct alignof_helper { char a; t b; }; # define ao(type) offsetof (alignof_helper<type>, b) @@ -25485,8 +24668,8 @@ else || (defined __APPLE__ && defined __MACH__ \ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ : __GNUC__) \ - || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \ - || __ICC || 0x5110 <= __SUNPRO_C \ + || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ + || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__ \ || 1300 <= _MSC_VER) struct alignas_test { char c; char alignas (8) alignas_8; }; char test_alignas[offsetof (struct alignas_test, alignas_8) == 8 @@ -25530,10 +24713,20 @@ fi - # Define two additional variables used in the Makefile substitution. - if test "$ac_cv_header_stdbool_h" = yes; then - STDBOOL_H='' + if test "$ac_cv_header_stdbool_h" = yes; then + case "$host_os" in + solaris*) + if test -z "$GCC"; then + STDBOOL_H='stdbool.h' + else + STDBOOL_H='' + fi + ;; + *) + STDBOOL_H='' + ;; + esac else STDBOOL_H='stdbool.h' fi @@ -25558,19 +24751,49 @@ fi STDDEF_H= - ac_fn_c_check_type "$LINENO" "max_align_t" "ac_cv_type_max_align_t" "#include <stddef.h> -" -if test "x$ac_cv_type_max_align_t" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for good max_align_t" >&5 +$as_echo_n "checking for good max_align_t... " >&6; } +if ${gl_cv_type_max_align_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stddef.h> + unsigned int s = sizeof (max_align_t); + #if defined __GNUC__ || defined __IBM__ALIGNOF__ + int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; + int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; + #endif + +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_type_max_align_t=yes else - HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h + gl_cv_type_max_align_t=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_max_align_t" >&5 +$as_echo "$gl_cv_type_max_align_t" >&6; } + if test $gl_cv_type_max_align_t = no; then + HAVE_MAX_ALIGN_T=0 + STDDEF_H=stddef.h + fi if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NULL can be used in arbitrary expressions" >&5 $as_echo_n "checking whether NULL can be used in arbitrary expressions... " >&6; } if ${gl_cv_decl_null_works+:} false; then : @@ -25603,6 +24826,7 @@ $as_echo "$gl_cv_decl_null_works" >&6; } STDDEF_H=stddef.h fi + if test -n "$STDDEF_H"; then GL_GENERATE_STDDEF_H_TRUE= GL_GENERATE_STDDEF_H_FALSE='#' @@ -25777,7 +25001,7 @@ else /* 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 @@ -25842,44 +25066,7 @@ _ACEOF - for gl_func in dprintf fpurge fseeko ftello getdelim getline gets pclose popen renameat snprintf tmpfile vdprintf vsnprintf; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdio.h> - -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - eval ac_cv_have_decl_$gl_func=yes -fi - done @@ -25957,50 +25144,7 @@ $as_echo "$gl_cv_next_stdlib_h" >&6; } - for gl_func in _Exit atoll canonicalize_file_name getloadavg getsubopt grantpt initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps posix_openpt ptsname ptsname_r qsort_r random random_r realpath rpmatch secure_getenv setenv setstate setstate_r srandom srandom_r strtod strtoll strtoull unlockpt unsetenv; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdlib.h> -#if HAVE_SYS_LOADAVG_H -# include <sys/loadavg.h> -#endif -#if HAVE_RANDOM_H -# include <random.h> -#endif -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - - eval ac_cv_have_decl_$gl_func=yes -fi - done @@ -26116,24 +25260,12 @@ $as_echo "#define GNULIB_TEST_STRCHRNUL 1" >>confdefs.h - : - - - - - if test $ac_cv_func_strdup = yes; then if test $gl_cv_func_malloc_posix != yes; then REPLACE_STRDUP=1 fi fi - : - - - - - if test $ac_cv_have_decl_strdup = no; then HAVE_DECL_STRDUP=0 fi @@ -26181,10 +25313,12 @@ if ${gl_cv_func_working_strerror+:} false; then : else if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_working_strerror="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_working_strerror="guessing no" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_working_strerror="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; esac else @@ -26279,12 +25413,6 @@ $as_echo "#define GNULIB_TEST_STRERROR 1" >>confdefs.h - : - - - - - if test $ac_cv_header_sys_socket_h != yes; then for ac_header in winsock2.h do : @@ -26315,18 +25443,10 @@ done - ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" -if test "x$ac_cv_have_decl_strerror_r" = xyes; then : - HAVE_DECL_STRERROR_R=1 -else - HAVE_DECL_STRERROR_R=0 -fi - - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRERROR_R_ORIG $HAVE_DECL_STRERROR_R -_ACEOF + if test $ac_cv_have_decl_strerror_r = no; then + HAVE_DECL_STRERROR_R=0 + fi if test $ac_cv_func_strerror_r = yes; then if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then @@ -26342,9 +25462,6 @@ _ACEOF fi fi - # Overwrite the findings of AC_FUNC_STRERROR_R (for code that uses that). - - if test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1; then @@ -26358,41 +25475,30 @@ _ACEOF - : - - - - - - - : - - - - : - + fi - fi + GNULIB_STRERROR_R=1 - GNULIB_STRERROR_R=1 +$as_echo "#define GNULIB_TEST_STRERROR_R 1" >>confdefs.h -$as_echo "#define GNULIB_TEST_STRERROR_R 1" >>confdefs.h - +cat >>confdefs.h <<_ACEOF +#define GNULIB_STRERROR_R_POSIX 1 +_ACEOF @@ -26430,7 +25536,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky user" >/dev/null 2>&1; then : gl_cv_func_strstr_linear="guessing yes" else - gl_cv_func_strstr_linear="guessing no" + gl_cv_func_strstr_linear="$gl_cross_guess_normal" fi rm -f conftest* @@ -26475,6 +25581,9 @@ main () if (!strstr (haystack, needle)) result |= 1; } + /* Free allocated memory, in case some sanitizer is watching. */ + free (haystack); + free (needle); return result; ; @@ -26517,16 +25626,16 @@ $as_echo "$gl_cv_func_strstr_linear" >&6; } - if test "$gl_cv_func_memchr_works" != yes; then + if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then REPLACE_STRSTR=1 else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strstr works" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strstr works" >&5 $as_echo_n "checking whether strstr works... " >&6; } if ${gl_cv_func_strstr_works_always+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNU_LIBRARY__ @@ -26549,7 +25658,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky user" >/dev/null 2>&1; then : gl_cv_func_strstr_works_always="guessing yes" else - gl_cv_func_strstr_works_always="guessing no" + gl_cv_func_strstr_works_always="$gl_cross_guess_normal" fi rm -f conftest* @@ -26559,6 +25668,12 @@ else /* end confdefs.h. */ #include <string.h> /* for strstr */ +#ifdef __GNU_LIBRARY__ + #include <features.h> + #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28 + Unlucky user + #endif +#endif #define P "_EF_BF_BD" #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P #define NEEDLE P P P P P @@ -26643,11 +25758,12 @@ if ${gl_cv_func_strtok_r_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : - - case "$host_os" in - # Guess no on glibc systems. - *-gnu*) gl_cv_func_strtok_r_works="guessing no";; - *) gl_cv_func_strtok_r_works="guessing yes";; + case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_func_strtok_r_works="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_strtok_r_works="guessing yes" ;; + *) gl_cv_func_strtok_r_works="guessing yes" ;; esac else @@ -26699,12 +25815,6 @@ $as_echo "$gl_cv_func_strtok_r_works" >&6; } HAVE_STRTOK_R=0 fi - : - - - - - if test $ac_cv_have_decl_strtok_r = no; then HAVE_DECL_STRTOK_R=0 fi @@ -26752,12 +25862,6 @@ $as_echo "#define GNULIB_TEST_STRTOK_R 1" >>confdefs.h - : - - - - - @@ -26834,14 +25938,14 @@ $as_echo "$gl_cv_next_sys_stat_h" >&6; } + WINDOWS_STAT_TIMESPEC=0 + + - if test $WINDOWS_64_BIT_ST_SIZE = 1; then -$as_echo "#define _GL_WINDOWS_64_BIT_ST_SIZE 1" >>confdefs.h - fi ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include <sys/types.h> #include <sys/stat.h> @@ -26856,47 +25960,6 @@ fi - for gl_func in fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat mknod mknodat stat utimensat; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <sys/stat.h> - -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - - eval ac_cv_have_decl_$gl_func=yes -fi - done - - - @@ -26911,8 +25974,6 @@ fi - : - @@ -27012,10 +26073,14 @@ $as_echo "$gl_cv_next_sys_uio_h" >&6; } + ac_fn_c_check_decl "$LINENO" "localtime_r" "ac_cv_have_decl_localtime_r" "/* mingw's <time.h> provides the functions asctime_r, ctime_r, + gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has + been included before. */ + #if defined __MINGW32__ + # include <unistd.h> + #endif + #include <time.h> - - - ac_fn_c_check_decl "$LINENO" "localtime_r" "ac_cv_have_decl_localtime_r" "#include <time.h> " if test "x$ac_cv_have_decl_localtime_r" = xyes; then : ac_have_decl=1 @@ -27032,12 +26097,6 @@ _ACEOF fi - : - - - - - if test $ac_cv_func_localtime_r = yes; then HAVE_LOCALTIME_R=1 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether localtime_r is compatible with its POSIX signature" >&5 @@ -27047,7 +26106,14 @@ if ${gl_cv_time_r_posix+:} false; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <time.h> +/* mingw's <time.h> provides the functions asctime_r, ctime_r, + gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has + been included before. */ + #if defined __MINGW32__ + # include <unistd.h> + #endif + #include <time.h> + int main () { @@ -27081,6 +26147,47 @@ $as_echo "$gl_cv_time_r_posix" >&6; } fi else HAVE_LOCALTIME_R=0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether localtime_r exists as an inline function" >&5 +$as_echo_n "checking whether localtime_r exists as an inline function... " >&6; } +if ${gl_cv_func_localtime_r_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* mingw's <time.h> provides the functions asctime_r, ctime_r, + gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has + been included before. */ + #if defined __MINGW32__ + # include <unistd.h> + #endif + #include <time.h> + +int +main () +{ +time_t a; + struct tm r; + localtime_r (&a, &r); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_func_localtime_r_inline=yes +else + gl_cv_func_localtime_r_inline=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_localtime_r_inline" >&5 +$as_echo "$gl_cv_func_localtime_r_inline" >&6; } + if test $gl_cv_func_localtime_r_inline = yes; then + REPLACE_LOCALTIME_R=1 + fi fi if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then @@ -27122,12 +26229,6 @@ $as_echo "#define GNULIB_TEST_TIME_R 1" >>confdefs.h - : - - - - - @@ -27212,63 +26313,6 @@ $as_echo "$gl_cv_next_unistd_h" >&6; } - for gl_func in chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups gethostname getlogin getlogin_r getpagesize getusershell setusershell endusershell group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite readlink readlinkat rmdir sethostname sleep symlink symlinkat ttyname_r unlink unlinkat usleep; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#if HAVE_UNISTD_H -# include <unistd.h> -#endif -/* Some systems declare various items in the wrong headers. */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) -# include <fcntl.h> -# include <stdio.h> -# include <stdlib.h> -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# include <io.h> -# endif -#endif - -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - - eval ac_cv_have_decl_$gl_func=yes -fi - done - - - - - : - - @@ -27276,10 +26320,6 @@ fi - : - - - if test $ac_cv_have_decl_unsetenv = no; then @@ -27350,8 +26390,8 @@ else case "$host_os" in # Guess yes on glibc systems. *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_unsetenv_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;; esac else @@ -27420,12 +26460,6 @@ $as_echo "$gl_cv_func_unsetenv_works" >&6; } - : - - - - - fi @@ -27452,12 +26486,6 @@ $as_echo "#define GNULIB_TEST_UNSETENV 1" >>confdefs.h - : - - - - - @@ -27548,63 +26576,12 @@ $as_echo "$gl_cv_next_wchar_h" >&6; } - for gl_func in btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth ; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) -# include <stddef.h> -# include <stdio.h> -# include <time.h> -#endif -#include <wchar.h> - -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - - eval ac_cv_have_decl_$gl_func=yes -fi - done - - : - @@ -27630,10 +26607,6 @@ fi - : - - - @@ -27717,7 +26690,7 @@ if ${gl_cv_func_iswcntrl_works+:} false; then : else if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #if __GNU_LIBRARY__ == 1 @@ -27774,10 +26747,14 @@ $as_echo "$gl_cv_func_iswcntrl_works" >&6; } fi - case "$gl_cv_func_iswcntrl_works" in - *yes) REPLACE_ISWCNTRL=0 ;; - *) REPLACE_ISWCNTRL=1 ;; - esac + if test $GNULIB_OVERRIDES_WINT_T = 1; then + REPLACE_ISWCNTRL=1 + else + case "$gl_cv_func_iswcntrl_works" in + *yes) REPLACE_ISWCNTRL=0 ;; + *) REPLACE_ISWCNTRL=1 ;; + esac + fi if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then @@ -27920,57 +26897,69 @@ $as_echo "$gl_cv_type_wctrans_t" >&6; } fi - for gl_func in wctype iswctype wctrans towctrans ; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) -# include <stddef.h> -# include <stdio.h> -# include <time.h> -# include <wchar.h> -#endif -#include <wctype.h> -int -main () -{ -#undef $gl_func - (void) $gl_func; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" -else - eval "$as_gl_Symbol=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF - eval ac_cv_have_decl_$gl_func=yes -fi - done + case "$host_os" in + mingw*) + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS windows-mutex.$ac_objext" + + ;; + esac + + case "$host_os" in + mingw*) + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS windows-once.$ac_objext" + ;; + esac + + case "$host_os" in + mingw*) + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS windows-recmutex.$ac_objext" + + ;; + esac + + case "$host_os" in + mingw*) + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS windows-rwlock.$ac_objext" + + ;; + esac # End of code from modules @@ -28183,6 +27172,9 @@ test "$program_suffix" != NONE && ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) @@ -29110,6 +28102,14 @@ if test -z "${GL_GENERATE_FNMATCH_H_TRUE}" && test -z "${GL_GENERATE_FNMATCH_H_F as_fn_error $? "conditional \"GL_GENERATE_FNMATCH_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${GL_GENERATE_FNMATCH_H_TRUE}" && test -z "${GL_GENERATE_FNMATCH_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_FNMATCH_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_GLOB_H_TRUE}" && test -z "${GL_GENERATE_GLOB_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_GLOB_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${GL_GENERATE_GLOB_H_TRUE}" && test -z "${GL_GENERATE_GLOB_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_GLOB_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/gnulib/import/Makefile.am b/gnulib/import/Makefile.am index a79f6f7..4ddaf4f 100644 --- a/gnulib/import/Makefile.am +++ b/gnulib/import/Makefile.am @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2016 Free Software Foundation, Inc. +# Copyright (C) 2002-2019 Free Software Foundation, Inc. # # 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 @@ -13,7 +13,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this file. If not, see <http://www.gnu.org/licenses/>. +# along with this file. If not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, # this file may be distributed as part of a program that @@ -21,9 +21,55 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca canonicalize-lgpl dirent dirfd errno fnmatch-gnu frexpl getcwd glob inet_ntop inttypes limits-h lstat memchr memmem mkdir mkdtemp mkostemp pathmax rawmemchr readlink rename setenv signal-h strchrnul strerror_r-posix strstr strtok_r sys_stat time_r unistd unsetenv update-copyright wchar wctype-h - -AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects +# Reproduce by: +# gnulib-tool --import \ +# --lib=libgnu \ +# --source-base=import \ +# --m4-base=import/m4 \ +# --doc-base=doc \ +# --tests-base=tests \ +# --aux-dir=import/extra \ +# --no-conditional-dependencies \ +# --no-libtool \ +# --macro-prefix=gl \ +# --no-vc-files \ +# alloca \ +# canonicalize-lgpl \ +# dirent \ +# dirfd \ +# errno \ +# fnmatch-gnu \ +# frexpl \ +# getcwd \ +# glob \ +# inet_ntop \ +# inttypes \ +# limits-h \ +# lstat \ +# memchr \ +# memmem \ +# mkdir \ +# mkdtemp \ +# mkostemp \ +# pathmax \ +# rawmemchr \ +# readlink \ +# rename \ +# setenv \ +# signal-h \ +# strchrnul \ +# strerror_r-posix \ +# strstr \ +# strtok_r \ +# sys_stat \ +# time_r \ +# unistd \ +# unsetenv \ +# update-copyright \ +# wchar \ +# wctype-h + +AUTOMAKE_OPTIONS = 1.11 gnits subdir-objects SUBDIRS = noinst_HEADERS = @@ -37,6 +83,7 @@ MOSTLYCLEANDIRS = CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = +# No GNU Make output. EXTRA_DIST += m4/gnulib-cache.m4 AM_CPPFLAGS = @@ -79,7 +126,7 @@ if GL_GENERATE_ALLOCA_H alloca.h: alloca.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat $(srcdir)/alloca.in.h; \ + sed -e 's|@''HAVE_ALLOCA_H''@|$(HAVE_ALLOCA_H)|g' < $(srcdir)/alloca.in.h; \ } > $@-t && \ mv -f $@-t $@ else @@ -111,6 +158,7 @@ arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \ -e 's/@''GNULIB_INET_NTOP''@/$(GNULIB_INET_NTOP)/g' \ -e 's/@''GNULIB_INET_PTON''@/$(GNULIB_INET_PTON)/g' \ + -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \ -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \ -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \ @@ -188,51 +236,6 @@ EXTRA_libgnu_a_SOURCES += closedir.c ## end gnulib module closedir -## begin gnulib module configmake - -# Listed in the same order as the GNU makefile conventions, and -# provided by autoconf 2.59c+ or 2.70. -# The Automake-defined pkg* macros are appended, in the order -# listed in the Automake 1.10a+ documentation. -configmake.h: Makefile - $(AM_V_GEN)rm -f $@-t && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - echo '#define PREFIX "$(prefix)"'; \ - echo '#define EXEC_PREFIX "$(exec_prefix)"'; \ - echo '#define BINDIR "$(bindir)"'; \ - echo '#define SBINDIR "$(sbindir)"'; \ - echo '#define LIBEXECDIR "$(libexecdir)"'; \ - echo '#define DATAROOTDIR "$(datarootdir)"'; \ - echo '#define DATADIR "$(datadir)"'; \ - echo '#define SYSCONFDIR "$(sysconfdir)"'; \ - echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \ - echo '#define LOCALSTATEDIR "$(localstatedir)"'; \ - echo '#define RUNSTATEDIR "$(runstatedir)"'; \ - echo '#define INCLUDEDIR "$(includedir)"'; \ - echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \ - echo '#define DOCDIR "$(docdir)"'; \ - echo '#define INFODIR "$(infodir)"'; \ - echo '#define HTMLDIR "$(htmldir)"'; \ - echo '#define DVIDIR "$(dvidir)"'; \ - echo '#define PDFDIR "$(pdfdir)"'; \ - echo '#define PSDIR "$(psdir)"'; \ - echo '#define LIBDIR "$(libdir)"'; \ - echo '#define LISPDIR "$(lispdir)"'; \ - echo '#define LOCALEDIR "$(localedir)"'; \ - echo '#define MANDIR "$(mandir)"'; \ - echo '#define MANEXT "$(manext)"'; \ - echo '#define PKGDATADIR "$(pkgdatadir)"'; \ - echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \ - echo '#define PKGLIBDIR "$(pkglibdir)"'; \ - echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \ - } | sed '/""/d' > $@-t && \ - mv -f $@-t $@ - -BUILT_SOURCES += configmake.h -CLEANFILES += configmake.h configmake.h-t - -## end gnulib module configmake - ## begin gnulib module dirent BUILT_SOURCES += dirent.h @@ -406,12 +409,14 @@ fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ + -e 's/@''GNULIB_CREAT''@/$(GNULIB_CREAT)/g' \ -e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \ -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \ -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \ -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \ -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ + -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \ -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \ @@ -435,6 +440,12 @@ EXTRA_DIST += fd-hook.h ## end gnulib module fd-hook +## begin gnulib module fd-safer-flag + +libgnu_a_SOURCES += fd-safer-flag.c dup-safer-flag.c + +## end gnulib module fd-safer-flag + ## begin gnulib module fdopendir @@ -499,29 +510,46 @@ EXTRA_libgnu_a_SOURCES += float.c itold.c ## begin gnulib module fnmatch + +EXTRA_DIST += fnmatch.c fnmatch_loop.c + +EXTRA_libgnu_a_SOURCES += fnmatch.c fnmatch_loop.c + +## end gnulib module fnmatch + +## begin gnulib module fnmatch-h + BUILT_SOURCES += $(FNMATCH_H) -# We need the following in order to create <fnmatch.h> when the system -# doesn't have one that supports the required API. +# We need the following in order to create <fnmatch.h>. if GL_GENERATE_FNMATCH_H -fnmatch.h: fnmatch.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) +fnmatch.h: fnmatch.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_FNMATCH_H''@|$(HAVE_FNMATCH_H)|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_FNMATCH_H''@|$(NEXT_FNMATCH_H)|g' \ + -e 's/@''GNULIB_FNMATCH''@/$(GNULIB_FNMATCH)/g' \ + -e 's|@''HAVE_FNMATCH''@|$(HAVE_FNMATCH)|g' \ + -e 's|@''REPLACE_FNMATCH''@|$(REPLACE_FNMATCH)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/fnmatch.in.h; \ } > $@-t && \ - mv -f $@-t $@ + mv $@-t $@ else fnmatch.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t -EXTRA_DIST += fnmatch.c fnmatch.in.h fnmatch_loop.c +EXTRA_DIST += fnmatch.in.h -EXTRA_libgnu_a_SOURCES += fnmatch.c fnmatch_loop.c - -## end gnulib module fnmatch +## end gnulib module fnmatch-h ## begin gnulib module fpucw @@ -551,9 +579,9 @@ EXTRA_libgnu_a_SOURCES += frexp.c frexpl.c ## begin gnulib module fstat -EXTRA_DIST += fstat.c +EXTRA_DIST += fstat.c stat-w32.c stat-w32.h -EXTRA_libgnu_a_SOURCES += fstat.c +EXTRA_libgnu_a_SOURCES += fstat.c stat-w32.c ## end gnulib module fstat @@ -625,32 +653,48 @@ EXTRA_libgnu_a_SOURCES += gettimeofday.c ## begin gnulib module glob + +EXTRA_DIST += glob.c glob_internal.h glob_pattern_p.c globfree.c + +EXTRA_libgnu_a_SOURCES += glob.c glob_pattern_p.c globfree.c + +## end gnulib module glob + +## begin gnulib module glob-h + BUILT_SOURCES += $(GLOB_H) -# We need the following in order to create <glob.h> when the system -# doesn't have one that works with the given compiler. +# We need the following in order to create <glob.h>. if GL_GENERATE_GLOB_H glob.h: glob.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_GLOB_H''@|$(HAVE_GLOB_H)|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_GLOB_H''@|$(NEXT_GLOB_H)|g' \ + -e 's/@''GNULIB_GLOB''@/$(GNULIB_GLOB)/g' \ + -e 's|@''HAVE_GLOB''@|$(HAVE_GLOB)|g' \ + -e 's|@''HAVE_GLOB_PATTERN_P''@|$(HAVE_GLOB_PATTERN_P)|g' \ + -e 's|@''REPLACE_GLOB''@|$(REPLACE_GLOB)|g' \ + -e 's|@''REPLACE_GLOB_PATTERN_P''@|$(REPLACE_GLOB_PATTERN_P)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/glob.in.h; \ } > $@-t && \ - mv -f $@-t $@ + mv $@-t $@ else glob.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += glob.h glob.h-t -EXTRA_DIST += glob-libc.h glob.c glob.in.h +EXTRA_DIST += glob-libc.h glob.in.h -EXTRA_libgnu_a_SOURCES += glob.c - -## end gnulib module glob +## end gnulib module glob-h ## begin gnulib module hard-locale @@ -710,6 +754,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' \ @@ -746,6 +791,13 @@ EXTRA_libgnu_a_SOURCES += isnan.c isnanl.c ## end gnulib module isnanl-nolibm +## begin gnulib module libc-config + + +EXTRA_DIST += cdefs.h libc-config.h + +## end gnulib module libc-config + ## begin gnulib module limits-h BUILT_SOURCES += $(LIMITS_H) @@ -776,77 +828,20 @@ EXTRA_DIST += limits.in.h ## begin gnulib module localcharset -libgnu_a_SOURCES += localcharset.h localcharset.c - -# We need the following in order to install a simple file in $(libdir) -# which is shared with other installed packages. We use a list of referencing -# packages so that "make uninstall" will remove the file if and only if it -# is not used by another installed package. -# On systems with glibc-2.1 or newer, the file is redundant, therefore we -# avoid installing it. - -all-local: charset.alias ref-add.sed ref-del.sed - -charset_alias = $(DESTDIR)$(libdir)/charset.alias -charset_tmp = $(DESTDIR)$(libdir)/charset.tmp -install-exec-local: install-exec-localcharset -install-exec-localcharset: all-local - if test $(GLIBC21) = no; then \ - case '$(host_os)' in \ - darwin[56]*) \ - need_charset_alias=true ;; \ - darwin* | cygwin* | mingw* | pw32* | cegcc*) \ - need_charset_alias=false ;; \ - *) \ - need_charset_alias=true ;; \ - esac ; \ - else \ - need_charset_alias=false ; \ - fi ; \ - if $$need_charset_alias; then \ - $(mkinstalldirs) $(DESTDIR)$(libdir) ; \ - fi ; \ - if test -f $(charset_alias); then \ - sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \ - $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \ - rm -f $(charset_tmp) ; \ - else \ - if $$need_charset_alias; then \ - sed -f ref-add.sed charset.alias > $(charset_tmp) ; \ - $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \ - rm -f $(charset_tmp) ; \ - fi ; \ - fi - -uninstall-local: uninstall-localcharset -uninstall-localcharset: all-local - if test -f $(charset_alias); then \ - sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \ - if grep '^# Packages using this file: $$' $(charset_tmp) \ - > /dev/null; then \ - rm -f $(charset_alias); \ - else \ - $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \ - fi; \ - rm -f $(charset_tmp); \ - fi +libgnu_a_SOURCES += localcharset.c -charset.alias: config.charset - $(AM_V_GEN)rm -f t-$@ $@ && \ - $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@ && \ - mv t-$@ $@ +EXTRA_DIST += localcharset.h -SUFFIXES += .sed .sin -.sin.sed: - $(AM_V_GEN)rm -f t-$@ $@ && \ - sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ && \ - mv t-$@ $@ +## end gnulib module localcharset -CLEANFILES += charset.alias ref-add.sed ref-del.sed +## begin gnulib module localtime-buffer -EXTRA_DIST += config.charset ref-add.sin ref-del.sin -## end gnulib module localcharset +EXTRA_DIST += localtime-buffer.c localtime-buffer.h + +EXTRA_libgnu_a_SOURCES += localtime-buffer.c + +## end gnulib module localtime-buffer ## begin gnulib module lock @@ -876,7 +871,7 @@ EXTRA_libgnu_a_SOURCES += malloc.c libgnu_a_SOURCES += malloca.c -EXTRA_DIST += malloca.h malloca.valgrind +EXTRA_DIST += malloca.h ## end gnulib module malloca @@ -1089,13 +1084,22 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \ -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \ | \ - sed -e 's|@''REPLACE_CBRTF''@|$(REPLACE_CBRTF)|g' \ + sed -e 's|@''REPLACE_ACOSF''@|$(REPLACE_ACOSF)|g' \ + -e 's|@''REPLACE_ASINF''@|$(REPLACE_ASINF)|g' \ + -e 's|@''REPLACE_ATANF''@|$(REPLACE_ATANF)|g' \ + -e 's|@''REPLACE_ATAN2F''@|$(REPLACE_ATAN2F)|g' \ + -e 's|@''REPLACE_CBRTF''@|$(REPLACE_CBRTF)|g' \ -e 's|@''REPLACE_CBRTL''@|$(REPLACE_CBRTL)|g' \ -e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \ -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \ -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \ + -e 's|@''REPLACE_COSF''@|$(REPLACE_COSF)|g' \ + -e 's|@''REPLACE_COSHF''@|$(REPLACE_COSHF)|g' \ + -e 's|@''REPLACE_EXPF''@|$(REPLACE_EXPF)|g' \ + -e 's|@''REPLACE_EXPL''@|$(REPLACE_EXPL)|g' \ -e 's|@''REPLACE_EXPM1''@|$(REPLACE_EXPM1)|g' \ -e 's|@''REPLACE_EXPM1F''@|$(REPLACE_EXPM1F)|g' \ + -e 's|@''REPLACE_EXPM1L''@|$(REPLACE_EXPM1L)|g' \ -e 's|@''REPLACE_EXP2''@|$(REPLACE_EXP2)|g' \ -e 's|@''REPLACE_EXP2L''@|$(REPLACE_EXP2L)|g' \ -e 's|@''REPLACE_FABSL''@|$(REPLACE_FABSL)|g' \ @@ -1117,6 +1121,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''REPLACE_HYPOTL''@|$(REPLACE_HYPOTL)|g' \ -e 's|@''REPLACE_ILOGB''@|$(REPLACE_ILOGB)|g' \ -e 's|@''REPLACE_ILOGBF''@|$(REPLACE_ILOGBF)|g' \ + -e 's|@''REPLACE_ILOGBL''@|$(REPLACE_ILOGBL)|g' \ -e 's|@''REPLACE_ISFINITE''@|$(REPLACE_ISFINITE)|g' \ -e 's|@''REPLACE_ISINF''@|$(REPLACE_ISINF)|g' \ -e 's|@''REPLACE_ISNAN''@|$(REPLACE_ISNAN)|g' \ @@ -1144,12 +1149,18 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''REPLACE_REMAINDER''@|$(REPLACE_REMAINDER)|g' \ -e 's|@''REPLACE_REMAINDERF''@|$(REPLACE_REMAINDERF)|g' \ -e 's|@''REPLACE_REMAINDERL''@|$(REPLACE_REMAINDERL)|g' \ + -e 's|@''REPLACE_RINTL''@|$(REPLACE_RINTL)|g' \ -e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \ -e 's|@''REPLACE_ROUNDF''@|$(REPLACE_ROUNDF)|g' \ -e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \ -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \ -e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \ + -e 's|@''REPLACE_SINF''@|$(REPLACE_SINF)|g' \ + -e 's|@''REPLACE_SINHF''@|$(REPLACE_SINHF)|g' \ + -e 's|@''REPLACE_SQRTF''@|$(REPLACE_SQRTF)|g' \ -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \ + -e 's|@''REPLACE_TANF''@|$(REPLACE_TANF)|g' \ + -e 's|@''REPLACE_TANHF''@|$(REPLACE_TANHF)|g' \ -e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \ -e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \ -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \ @@ -1428,14 +1439,13 @@ EXTRA_DIST += save-cwd.h ## end gnulib module save-cwd -## begin gnulib module secure_getenv +## begin gnulib module scratch_buffer +libgnu_a_SOURCES += malloc/scratch_buffer_grow.c malloc/scratch_buffer_grow_preserve.c malloc/scratch_buffer_set_array_size.c -EXTRA_DIST += secure_getenv.c +EXTRA_DIST += malloc/scratch_buffer.h scratch_buffer.h -EXTRA_libgnu_a_SOURCES += secure_getenv.c - -## end gnulib module secure_getenv +## end gnulib module scratch_buffer ## begin gnulib module setenv @@ -1460,8 +1470,8 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ - -e 's|@''GNULIB_PTHREAD_SIGMASK''@|$(GNULIB_PTHREAD_SIGMASK)|g' \ - -e 's|@''GNULIB_RAISE''@|$(GNULIB_RAISE)|g' \ + -e 's/@''GNULIB_PTHREAD_SIGMASK''@/$(GNULIB_PTHREAD_SIGMASK)/g' \ + -e 's/@''GNULIB_RAISE''@/$(GNULIB_RAISE)/g' \ -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \ -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \ -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \ @@ -1491,93 +1501,68 @@ EXTRA_DIST += signal.in.h ## begin gnulib module snippet/_Noreturn # Because this Makefile snippet defines a variable used by other -# gnulib Makefile snippets, it must be present in all Makefile.am that +# gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. -_NORETURN_H=$(top_srcdir)/import/extra/snippet/_Noreturn.h +_NORETURN_H=$(srcdir)/_Noreturn.h -EXTRA_DIST += $(top_srcdir)/import/extra/snippet/_Noreturn.h +EXTRA_DIST += _Noreturn.h ## end gnulib module snippet/_Noreturn ## begin gnulib module snippet/arg-nonnull -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += arg-nonnull.h -# The arg-nonnull.h that gets inserted into generated .h files is the same as -# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut -# off. -arg-nonnull.h: $(top_srcdir)/import/extra/snippet/arg-nonnull.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/GL_ARG_NONNULL/,$$p' \ - < $(top_srcdir)/import/extra/snippet/arg-nonnull.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. -ARG_NONNULL_H=arg-nonnull.h +ARG_NONNULL_H=$(srcdir)/arg-nonnull.h -EXTRA_DIST += $(top_srcdir)/import/extra/snippet/arg-nonnull.h +EXTRA_DIST += arg-nonnull.h ## end gnulib module snippet/arg-nonnull ## begin gnulib module snippet/c++defs -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += c++defs.h -# The c++defs.h that gets inserted into generated .h files is the same as -# build-aux/snippet/c++defs.h, except that it has the copyright header cut off. -c++defs.h: $(top_srcdir)/import/extra/snippet/c++defs.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/_GL_CXXDEFS/,$$p' \ - < $(top_srcdir)/import/extra/snippet/c++defs.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += c++defs.h c++defs.h-t +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. -CXXDEFS_H=c++defs.h +CXXDEFS_H=$(srcdir)/c++defs.h -EXTRA_DIST += $(top_srcdir)/import/extra/snippet/c++defs.h +EXTRA_DIST += c++defs.h ## end gnulib module snippet/c++defs ## begin gnulib module snippet/warn-on-use -BUILT_SOURCES += warn-on-use.h -# The warn-on-use.h that gets inserted into generated .h files is the same as -# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut -# off. -warn-on-use.h: $(top_srcdir)/import/extra/snippet/warn-on-use.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/^.ifndef/,$$p' \ - < $(top_srcdir)/import/extra/snippet/warn-on-use.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. -WARN_ON_USE_H=warn-on-use.h +WARN_ON_USE_H=$(srcdir)/warn-on-use.h -EXTRA_DIST += $(top_srcdir)/import/extra/snippet/warn-on-use.h +EXTRA_DIST += warn-on-use.h ## end gnulib module snippet/warn-on-use ## begin gnulib module stat -EXTRA_DIST += stat.c +EXTRA_DIST += stat-w32.c stat-w32.h stat.c -EXTRA_libgnu_a_SOURCES += stat.c +EXTRA_libgnu_a_SOURCES += stat-w32.c stat.c ## end gnulib module stat +## begin gnulib module stat-time + +libgnu_a_SOURCES += stat-time.c + +EXTRA_DIST += stat-time.h + +## end gnulib module stat-time + ## begin gnulib module stdalign BUILT_SOURCES += $(STDALIGN_H) @@ -1693,6 +1678,7 @@ stdint.h: stdint.in.h $(top_builddir)/config.status -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ + -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ < $(srcdir)/stdint.in.h; \ } > $@-t && \ mv $@-t $@ @@ -1871,11 +1857,13 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \ -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ + -e 's/@''GNULIB_REALLOCARRAY''@/$(GNULIB_REALLOCARRAY)/g' \ -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ + -e 's/@''GNULIB_STRTOLD''@/$(GNULIB_STRTOLD)/g' \ -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \ -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \ @@ -1889,6 +1877,9 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ + -e 's|@''HAVE_INITSTATE''@|$(HAVE_INITSTATE)|g' \ + -e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \ + -e 's|@''HAVE_MBTOWC''@|$(HAVE_MBTOWC)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ @@ -1901,11 +1892,15 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ + -e 's|@''HAVE_REALLOCARRAY''@|$(HAVE_REALLOCARRAY)|g' \ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ + -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ + -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ + -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ @@ -1914,6 +1909,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ + -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \ -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ @@ -1921,11 +1917,14 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \ + -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ + -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ + -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ @@ -2006,6 +2005,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ + -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GNULIB_EXPLICIT_BZERO)/g' \ -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \ -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \ -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ @@ -2044,7 +2044,8 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ < $(srcdir)/string.in.h | \ - sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ + sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ + -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ @@ -2065,20 +2066,20 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ - -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ - -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ - -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ - -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ - -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ - -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ @@ -2184,6 +2185,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ + -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \ -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \ -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ @@ -2197,6 +2199,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \ -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \ -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \ + -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GNULIB_OVERRIDES_STRUCT_STAT)/g' \ -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ @@ -2280,6 +2283,7 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ < $(srcdir)/sys_types.in.h; \ } > $@-t && \ mv $@-t $@ @@ -2327,8 +2331,6 @@ EXTRA_DIST += tempname.h libgnu_a_SOURCES += glthread/threadlib.c -EXTRA_DIST += $(top_srcdir)/import/extra/config.rpath - ## end gnulib module threadlib ## begin gnulib module time @@ -2345,24 +2347,31 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ - -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \ + -e 's/@''GNULIB_CTIME''@/$(GNULIB_CTIME)/g' \ + -e 's/@''GNULIB_LOCALTIME''@/$(GNULIB_LOCALTIME)/g' \ -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \ -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \ + -e 's/@''GNULIB_STRFTIME''@/$(GNULIB_STRFTIME)/g' \ -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \ -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \ -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \ -e 's/@''GNULIB_TIME_RZ''@/$(GNULIB_TIME_RZ)/g' \ + -e 's/@''GNULIB_TZSET''@/$(GNULIB_TZSET)/g' \ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ + -e 's|@''HAVE_TZSET''@|$(HAVE_TZSET)|g' \ + -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ + -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ + -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \ -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ @@ -2405,9 +2414,11 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's/@''GNULIB_ACCESS''@/$(GNULIB_ACCESS)/g' \ -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \ -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ + -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GNULIB_COPY_FILE_RANGE)/g' \ -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \ -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ @@ -2427,6 +2438,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \ -e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \ -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \ + -e 's/@''GNULIB_GETPASS''@/$(GNULIB_GETPASS)/g' \ -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \ -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \ -e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/g' \ @@ -2446,6 +2458,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ + -e 's/@''GNULIB_TRUNCATE''@/$(GNULIB_TRUNCATE)/g' \ -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \ -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ @@ -2456,6 +2469,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \ < $(srcdir)/unistd.in.h | \ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ + -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ @@ -2468,8 +2482,8 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ - -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ + -e 's|@''HAVE_GETPASS''@|$(HAVE_GETPASS)|g' \ -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ @@ -2490,18 +2504,22 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \ -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ + -e 's|@''HAVE_DECL_GETLOGIN''@|$(HAVE_DECL_GETLOGIN)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -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' \ | \ - sed -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ + sed -e 's|@''REPLACE_ACCESS''@|$(REPLACE_ACCESS)|g' \ + -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ + -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ @@ -2510,6 +2528,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ + -e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \ -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ @@ -2524,6 +2543,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ + -e 's|@''REPLACE_TRUNCATE''@|$(REPLACE_TRUNCATE)|g' \ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ @@ -2589,6 +2609,8 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ + -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ + -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \ -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \ -e 's/@''GNULIB_MBSINIT''@/$(GNULIB_MBSINIT)/g' \ @@ -2628,6 +2650,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \ -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \ -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \ + -e 's/@''GNULIB_WCSFTIME''@/$(GNULIB_WCSFTIME)/g' \ < $(srcdir)/wchar.in.h | \ sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ @@ -2667,6 +2690,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \ -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \ -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \ + -e 's|@''HAVE_WCSFTIME''@|$(HAVE_WCSFTIME)|g' \ -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ | \ @@ -2683,6 +2707,8 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ + -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \ + -e 's|@''REPLACE_WCSTOK''@|$(REPLACE_WCSTOK)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ @@ -2710,6 +2736,8 @@ wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ + -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \ -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \ -e 's/@''GNULIB_ISWCTYPE''@/$(GNULIB_ISWCTYPE)/g' \ @@ -2734,6 +2762,49 @@ EXTRA_DIST += wctype.in.h ## end gnulib module wctype-h +## begin gnulib module windows-mutex + + +EXTRA_DIST += windows-initguard.h windows-mutex.c windows-mutex.h + +EXTRA_libgnu_a_SOURCES += windows-mutex.c + +## end gnulib module windows-mutex + +## begin gnulib module windows-once + + +EXTRA_DIST += windows-once.c windows-once.h + +EXTRA_libgnu_a_SOURCES += windows-once.c + +## end gnulib module windows-once + +## begin gnulib module windows-recmutex + + +EXTRA_DIST += windows-initguard.h windows-recmutex.c windows-recmutex.h + +EXTRA_libgnu_a_SOURCES += windows-recmutex.c + +## end gnulib module windows-recmutex + +## begin gnulib module windows-rwlock + + +EXTRA_DIST += windows-initguard.h windows-rwlock.c windows-rwlock.h + +EXTRA_libgnu_a_SOURCES += windows-rwlock.c + +## end gnulib module windows-rwlock + +## begin gnulib module xalloc-oversized + + +EXTRA_DIST += xalloc-oversized.h + +## end gnulib module xalloc-oversized + mostlyclean-local: mostlyclean-generic @for dir in '' $(MOSTLYCLEANDIRS); do \ diff --git a/gnulib/import/Makefile.in b/gnulib/import/Makefile.in index ba3207c..7059d4c 100644 --- a/gnulib/import/Makefile.in +++ b/gnulib/import/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -# Copyright (C) 2002-2016 Free Software Foundation, Inc. +# Copyright (C) 2002-2019 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this file. If not, see <http://www.gnu.org/licenses/>. +# along with this file. If not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, # this file may be distributed as part of a program that @@ -35,7 +35,53 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca canonicalize-lgpl dirent dirfd errno fnmatch-gnu frexpl getcwd glob inet_ntop inttypes limits-h lstat memchr memmem mkdir mkdtemp mkostemp pathmax rawmemchr readlink rename setenv signal-h strchrnul strerror_r-posix strstr strtok_r sys_stat time_r unistd unsetenv update-copyright wchar wctype-h +# Reproduce by: +# gnulib-tool --import \ +# --lib=libgnu \ +# --source-base=import \ +# --m4-base=import/m4 \ +# --doc-base=doc \ +# --tests-base=tests \ +# --aux-dir=import/extra \ +# --no-conditional-dependencies \ +# --no-libtool \ +# --macro-prefix=gl \ +# --no-vc-files \ +# alloca \ +# canonicalize-lgpl \ +# dirent \ +# dirfd \ +# errno \ +# fnmatch-gnu \ +# frexpl \ +# getcwd \ +# glob \ +# inet_ntop \ +# inttypes \ +# limits-h \ +# lstat \ +# memchr \ +# memmem \ +# mkdir \ +# mkdtemp \ +# mkostemp \ +# pathmax \ +# rawmemchr \ +# readlink \ +# rename \ +# setenv \ +# signal-h \ +# strchrnul \ +# strerror_r-posix \ +# strstr \ +# strtok_r \ +# sys_stat \ +# time_r \ +# unistd \ +# unsetenv \ +# update-copyright \ +# wchar \ +# wctype-h @@ -98,6 +144,7 @@ am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c @@ -121,15 +168,16 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/plugins.m4 \ $(top_srcdir)/import/m4/00gnulib.m4 \ + $(top_srcdir)/import/m4/__inline.m4 \ $(top_srcdir)/import/m4/absolute-header.m4 \ $(top_srcdir)/import/m4/alloca.m4 \ $(top_srcdir)/import/m4/arpa_inet_h.m4 \ + $(top_srcdir)/import/m4/builtin-expect.m4 \ $(top_srcdir)/import/m4/canonicalize.m4 \ $(top_srcdir)/import/m4/chdir-long.m4 \ $(top_srcdir)/import/m4/close.m4 \ $(top_srcdir)/import/m4/closedir.m4 \ $(top_srcdir)/import/m4/codeset.m4 \ - $(top_srcdir)/import/m4/configmake.m4 \ $(top_srcdir)/import/m4/d-ino.m4 \ $(top_srcdir)/import/m4/d-type.m4 \ $(top_srcdir)/import/m4/dirent_h.m4 \ @@ -154,6 +202,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/flexmember.m4 \ $(top_srcdir)/import/m4/float_h.m4 \ $(top_srcdir)/import/m4/fnmatch.m4 \ + $(top_srcdir)/import/m4/fnmatch_h.m4 \ $(top_srcdir)/import/m4/fpieee.m4 \ $(top_srcdir)/import/m4/frexp.m4 \ $(top_srcdir)/import/m4/frexpl.m4 \ @@ -163,14 +212,15 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/getcwd-path-max.m4 \ $(top_srcdir)/import/m4/getcwd.m4 \ $(top_srcdir)/import/m4/getdtablesize.m4 \ + $(top_srcdir)/import/m4/getlogin.m4 \ $(top_srcdir)/import/m4/getlogin_r.m4 \ + $(top_srcdir)/import/m4/getpagesize.m4 \ $(top_srcdir)/import/m4/getprogname.m4 \ $(top_srcdir)/import/m4/gettimeofday.m4 \ - $(top_srcdir)/import/m4/glibc21.m4 \ $(top_srcdir)/import/m4/glob.m4 \ + $(top_srcdir)/import/m4/glob_h.m4 \ $(top_srcdir)/import/m4/gnulib-common.m4 \ $(top_srcdir)/import/m4/gnulib-comp.m4 \ - $(top_srcdir)/import/m4/hard-locale.m4 \ $(top_srcdir)/import/m4/include_next.m4 \ $(top_srcdir)/import/m4/inet_ntop.m4 \ $(top_srcdir)/import/m4/inttypes-pri.m4 \ @@ -178,14 +228,12 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/isnand.m4 \ $(top_srcdir)/import/m4/isnanl.m4 \ $(top_srcdir)/import/m4/largefile.m4 \ - $(top_srcdir)/import/m4/lib-ld.m4 \ - $(top_srcdir)/import/m4/lib-link.m4 \ - $(top_srcdir)/import/m4/lib-prefix.m4 \ $(top_srcdir)/import/m4/limits-h.m4 \ $(top_srcdir)/import/m4/localcharset.m4 \ $(top_srcdir)/import/m4/locale-fr.m4 \ $(top_srcdir)/import/m4/locale-ja.m4 \ $(top_srcdir)/import/m4/locale-zh.m4 \ + $(top_srcdir)/import/m4/localtime-buffer.m4 \ $(top_srcdir)/import/m4/lock.m4 \ $(top_srcdir)/import/m4/longlong.m4 \ $(top_srcdir)/import/m4/lstat.m4 \ @@ -211,11 +259,13 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/netinet_in_h.m4 \ $(top_srcdir)/import/m4/nocrash.m4 \ $(top_srcdir)/import/m4/off_t.m4 \ - $(top_srcdir)/import/m4/onceonly.m4 \ + $(top_srcdir)/import/m4/open-cloexec.m4 \ + $(top_srcdir)/import/m4/open-slash.m4 \ $(top_srcdir)/import/m4/open.m4 \ $(top_srcdir)/import/m4/openat.m4 \ $(top_srcdir)/import/m4/opendir.m4 \ $(top_srcdir)/import/m4/pathmax.m4 \ + $(top_srcdir)/import/m4/pthread_rwlock_rdlock.m4 \ $(top_srcdir)/import/m4/rawmemchr.m4 \ $(top_srcdir)/import/m4/readdir.m4 \ $(top_srcdir)/import/m4/readlink.m4 \ @@ -224,13 +274,14 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/rewinddir.m4 \ $(top_srcdir)/import/m4/rmdir.m4 \ $(top_srcdir)/import/m4/save-cwd.m4 \ - $(top_srcdir)/import/m4/secure_getenv.m4 \ $(top_srcdir)/import/m4/setenv.m4 \ $(top_srcdir)/import/m4/signal_h.m4 \ $(top_srcdir)/import/m4/socklen.m4 \ $(top_srcdir)/import/m4/sockpfaf.m4 \ $(top_srcdir)/import/m4/ssize_t.m4 \ + $(top_srcdir)/import/m4/stat-time.m4 \ $(top_srcdir)/import/m4/stat.m4 \ + $(top_srcdir)/import/m4/std-gnu11.m4 \ $(top_srcdir)/import/m4/stdalign.m4 \ $(top_srcdir)/import/m4/stdbool.m4 \ $(top_srcdir)/import/m4/stddef_h.m4 \ @@ -277,15 +328,18 @@ am__DEPENDENCIES_1 = am__dirstamp = $(am__leading_dot)dirstamp am_libgnu_a_OBJECTS = cloexec.$(OBJEXT) dirname-lgpl.$(OBJEXT) \ basename-lgpl.$(OBJEXT) stripslash.$(OBJEXT) \ - exitfail.$(OBJEXT) fd-hook.$(OBJEXT) \ - filenamecat-lgpl.$(OBJEXT) getprogname.$(OBJEXT) \ - hard-locale.$(OBJEXT) localcharset.$(OBJEXT) \ - glthread/lock.$(OBJEXT) malloca.$(OBJEXT) math.$(OBJEXT) \ - openat-die.$(OBJEXT) save-cwd.$(OBJEXT) strnlen1.$(OBJEXT) \ - sys_socket.$(OBJEXT) tempname.$(OBJEXT) \ - glthread/threadlib.$(OBJEXT) unistd.$(OBJEXT) \ - dup-safer.$(OBJEXT) fd-safer.$(OBJEXT) pipe-safer.$(OBJEXT) \ - wctype-h.$(OBJEXT) + exitfail.$(OBJEXT) fd-hook.$(OBJEXT) fd-safer-flag.$(OBJEXT) \ + dup-safer-flag.$(OBJEXT) filenamecat-lgpl.$(OBJEXT) \ + getprogname.$(OBJEXT) hard-locale.$(OBJEXT) \ + localcharset.$(OBJEXT) glthread/lock.$(OBJEXT) \ + malloca.$(OBJEXT) math.$(OBJEXT) openat-die.$(OBJEXT) \ + save-cwd.$(OBJEXT) malloc/scratch_buffer_grow.$(OBJEXT) \ + malloc/scratch_buffer_grow_preserve.$(OBJEXT) \ + malloc/scratch_buffer_set_array_size.$(OBJEXT) \ + stat-time.$(OBJEXT) strnlen1.$(OBJEXT) sys_socket.$(OBJEXT) \ + tempname.$(OBJEXT) glthread/threadlib.$(OBJEXT) \ + unistd.$(OBJEXT) dup-safer.$(OBJEXT) fd-safer.$(OBJEXT) \ + pipe-safer.$(OBJEXT) wctype-h.$(OBJEXT) libgnu_a_OBJECTS = $(am_libgnu_a_OBJECTS) LTLIBRARIES = $(noinst_LTLIBRARIES) AM_V_P = $(am__v_P_@AM_V@) @@ -358,7 +412,6 @@ am__define_uniq_tagged_files = \ ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) -pkglibexecdir = @pkglibexecdir@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ @@ -400,10 +453,10 @@ FLOAT_H = @FLOAT_H@ FNMATCH_H = @FNMATCH_H@ FREXPL_LIBM = @FREXPL_LIBM@ FREXP_LIBM = @FREXP_LIBM@ -GLIBC21 = @GLIBC21@ GLOB_H = @GLOB_H@ GNULIB_ACCEPT = @GNULIB_ACCEPT@ GNULIB_ACCEPT4 = @GNULIB_ACCEPT4@ +GNULIB_ACCESS = @GNULIB_ACCESS@ GNULIB_ACOSF = @GNULIB_ACOSF@ GNULIB_ACOSL = @GNULIB_ACOSL@ GNULIB_ALPHASORT = @GNULIB_ALPHASORT@ @@ -431,9 +484,12 @@ GNULIB_CONNECT = @GNULIB_CONNECT@ GNULIB_COPYSIGN = @GNULIB_COPYSIGN@ GNULIB_COPYSIGNF = @GNULIB_COPYSIGNF@ GNULIB_COPYSIGNL = @GNULIB_COPYSIGNL@ +GNULIB_COPY_FILE_RANGE = @GNULIB_COPY_FILE_RANGE@ GNULIB_COSF = @GNULIB_COSF@ GNULIB_COSHF = @GNULIB_COSHF@ GNULIB_COSL = @GNULIB_COSL@ +GNULIB_CREAT = @GNULIB_CREAT@ +GNULIB_CTIME = @GNULIB_CTIME@ GNULIB_DIRFD = @GNULIB_DIRFD@ GNULIB_DPRINTF = @GNULIB_DPRINTF@ GNULIB_DUP = @GNULIB_DUP@ @@ -446,6 +502,7 @@ GNULIB_EXP2F = @GNULIB_EXP2F@ GNULIB_EXP2L = @GNULIB_EXP2L@ GNULIB_EXPF = @GNULIB_EXPF@ GNULIB_EXPL = @GNULIB_EXPL@ +GNULIB_EXPLICIT_BZERO = @GNULIB_EXPLICIT_BZERO@ GNULIB_EXPM1 = @GNULIB_EXPM1@ GNULIB_EXPM1F = @GNULIB_EXPM1F@ GNULIB_EXPM1L = @GNULIB_EXPM1L@ @@ -474,6 +531,7 @@ GNULIB_FMAL = @GNULIB_FMAL@ GNULIB_FMOD = @GNULIB_FMOD@ GNULIB_FMODF = @GNULIB_FMODF@ GNULIB_FMODL = @GNULIB_FMODL@ +GNULIB_FNMATCH = @GNULIB_FNMATCH@ GNULIB_FOPEN = @GNULIB_FOPEN@ GNULIB_FPRINTF = @GNULIB_FPRINTF@ GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ @@ -509,12 +567,14 @@ GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ +GNULIB_GETPASS = @GNULIB_GETPASS@ GNULIB_GETPEERNAME = @GNULIB_GETPEERNAME@ GNULIB_GETSOCKNAME = @GNULIB_GETSOCKNAME@ GNULIB_GETSOCKOPT = @GNULIB_GETSOCKOPT@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_GLOB = @GNULIB_GLOB@ GNULIB_GRANTPT = @GNULIB_GRANTPT@ GNULIB_GROUP_MEMBER = @GNULIB_GROUP_MEMBER@ GNULIB_HYPOT = @GNULIB_HYPOT@ @@ -543,6 +603,7 @@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LISTEN = @GNULIB_LISTEN@ +GNULIB_LOCALTIME = @GNULIB_LOCALTIME@ GNULIB_LOG = @GNULIB_LOG@ GNULIB_LOG10 = @GNULIB_LOG10@ GNULIB_LOG10F = @GNULIB_LOG10F@ @@ -606,6 +667,8 @@ GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@ GNULIB_OPEN = @GNULIB_OPEN@ GNULIB_OPENAT = @GNULIB_OPENAT@ GNULIB_OPENDIR = @GNULIB_OPENDIR@ +GNULIB_OVERRIDES_STRUCT_STAT = @GNULIB_OVERRIDES_STRUCT_STAT@ +GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ GNULIB_PCLOSE = @GNULIB_PCLOSE@ GNULIB_PERROR = @GNULIB_PERROR@ GNULIB_PIPE = @GNULIB_PIPE@ @@ -633,6 +696,7 @@ GNULIB_READ = @GNULIB_READ@ GNULIB_READDIR = @GNULIB_READDIR@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ +GNULIB_REALLOCARRAY = @GNULIB_REALLOCARRAY@ GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ GNULIB_REALPATH = @GNULIB_REALPATH@ GNULIB_RECV = @GNULIB_RECV@ @@ -684,6 +748,7 @@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ GNULIB_STRERROR_R = @GNULIB_STRERROR_R@ +GNULIB_STRFTIME = @GNULIB_STRFTIME@ GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ @@ -695,6 +760,7 @@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOD = @GNULIB_STRTOD@ GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLD = @GNULIB_STRTOLD@ GNULIB_STRTOLL = @GNULIB_STRTOLL@ GNULIB_STRTOULL = @GNULIB_STRTOULL@ GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ @@ -711,9 +777,11 @@ GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ GNULIB_TMPFILE = @GNULIB_TMPFILE@ GNULIB_TOWCTRANS = @GNULIB_TOWCTRANS@ GNULIB_TRUNC = @GNULIB_TRUNC@ +GNULIB_TRUNCATE = @GNULIB_TRUNCATE@ GNULIB_TRUNCF = @GNULIB_TRUNCF@ GNULIB_TRUNCL = @GNULIB_TRUNCL@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ +GNULIB_TZSET = @GNULIB_TZSET@ GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ GNULIB_UNLINK = @GNULIB_UNLINK@ @@ -743,6 +811,7 @@ GNULIB_WCSCOLL = @GNULIB_WCSCOLL@ GNULIB_WCSCPY = @GNULIB_WCSCPY@ GNULIB_WCSCSPN = @GNULIB_WCSCSPN@ GNULIB_WCSDUP = @GNULIB_WCSDUP@ +GNULIB_WCSFTIME = @GNULIB_WCSFTIME@ GNULIB_WCSLEN = @GNULIB_WCSLEN@ GNULIB_WCSNCASECMP = @GNULIB_WCSNCASECMP@ GNULIB_WCSNCAT = @GNULIB_WCSNCAT@ @@ -774,6 +843,7 @@ GREP = @GREP@ HAVE_ACCEPT4 = @HAVE_ACCEPT4@ HAVE_ACOSF = @HAVE_ACOSF@ HAVE_ACOSL = @HAVE_ACOSL@ +HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ARPA_INET_H = @HAVE_ARPA_INET_H@ HAVE_ASINF = @HAVE_ASINF@ @@ -792,9 +862,11 @@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ HAVE_COPYSIGN = @HAVE_COPYSIGN@ HAVE_COPYSIGNL = @HAVE_COPYSIGNL@ +HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@ HAVE_COSF = @HAVE_COSF@ HAVE_COSHF = @HAVE_COSHF@ HAVE_COSL = @HAVE_COSL@ +HAVE_CRTDEFS_H = @HAVE_CRTDEFS_H@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ @@ -824,6 +896,7 @@ HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ @@ -831,6 +904,7 @@ HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@ HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@ +HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ HAVE_DECL_LOG10L = @HAVE_DECL_LOG10L@ @@ -850,6 +924,7 @@ HAVE_DECL_ROUNDF = @HAVE_DECL_ROUNDF@ HAVE_DECL_ROUNDL = @HAVE_DECL_ROUNDL@ HAVE_DECL_SETENV = @HAVE_DECL_SETENV@ HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ +HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ @@ -863,6 +938,7 @@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ +HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@ HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@ @@ -877,6 +953,7 @@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_EXPF = @HAVE_EXPF@ HAVE_EXPL = @HAVE_EXPL@ +HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ HAVE_EXPM1 = @HAVE_EXPM1@ HAVE_EXPM1F = @HAVE_EXPM1F@ HAVE_FABSF = @HAVE_FABSF@ @@ -896,6 +973,8 @@ HAVE_FMAF = @HAVE_FMAF@ HAVE_FMAL = @HAVE_FMAL@ HAVE_FMODF = @HAVE_FMODF@ HAVE_FMODL = @HAVE_FMODL@ +HAVE_FNMATCH = @HAVE_FNMATCH@ +HAVE_FNMATCH_H = @HAVE_FNMATCH_H@ HAVE_FREXPF = @HAVE_FREXPF@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FSTATAT = @HAVE_FSTATAT@ @@ -908,8 +987,12 @@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETPASS = @HAVE_GETPASS@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@ +HAVE_GLOB = @HAVE_GLOB@ +HAVE_GLOB_H = @HAVE_GLOB_H@ +HAVE_GLOB_PATTERN_P = @HAVE_GLOB_PATTERN_P@ HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ HAVE_HYPOTF = @HAVE_HYPOTF@ @@ -917,6 +1000,8 @@ HAVE_HYPOTL = @HAVE_HYPOTL@ HAVE_ILOGB = @HAVE_ILOGB@ HAVE_ILOGBF = @HAVE_ILOGBF@ HAVE_ILOGBL = @HAVE_ILOGBL@ +HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@ +HAVE_INITSTATE = @HAVE_INITSTATE@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISNAND = @HAVE_ISNAND@ HAVE_ISNANF = @HAVE_ISNANF@ @@ -946,6 +1031,7 @@ HAVE_MBSINIT = @HAVE_MBSINIT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ +HAVE_MBTOWC = @HAVE_MBTOWC@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDIRAT = @HAVE_MKDIRAT@ @@ -987,6 +1073,7 @@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READDIR = @HAVE_READDIR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ +HAVE_REALLOCARRAY = @HAVE_REALLOCARRAY@ HAVE_REALPATH = @HAVE_REALPATH@ HAVE_REMAINDER = @HAVE_REMAINDER@ HAVE_REMAINDERF = @HAVE_REMAINDERF@ @@ -1001,6 +1088,7 @@ HAVE_SCANDIR = @HAVE_SCANDIR@ HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ +HAVE_SETSTATE = @HAVE_SETSTATE@ HAVE_SIGACTION = @HAVE_SIGACTION@ HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@ HAVE_SIGINFO_T = @HAVE_SIGINFO_T@ @@ -1023,6 +1111,7 @@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLD = @HAVE_STRTOLD@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ @@ -1034,7 +1123,6 @@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ -HAVE_SYS_CDEFS_H = @HAVE_SYS_CDEFS_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ @@ -1048,6 +1136,7 @@ HAVE_TANL = @HAVE_TANL@ HAVE_TIMEGM = @HAVE_TIMEGM@ HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ +HAVE_TZSET = @HAVE_TZSET@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ @@ -1069,6 +1158,7 @@ HAVE_WCSCOLL = @HAVE_WCSCOLL@ HAVE_WCSCPY = @HAVE_WCSCPY@ HAVE_WCSCSPN = @HAVE_WCSCSPN@ HAVE_WCSDUP = @HAVE_WCSDUP@ +HAVE_WCSFTIME = @HAVE_WCSFTIME@ HAVE_WCSLEN = @HAVE_WCSLEN@ HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@ HAVE_WCSNCAT = @HAVE_WCSNCAT@ @@ -1113,10 +1203,11 @@ LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@ LIBINTL = @LIBINTL@ LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ -LIBPTH = @LIBPTH@ -LIBPTH_PREFIX = @LIBPTH_PREFIX@ +LIBPMULTITHREAD = @LIBPMULTITHREAD@ +LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTHREAD = @LIBTHREAD@ +LIB_GETLOGIN = @LIB_GETLOGIN@ LIMITS_H = @LIMITS_H@ LN_S = @LN_S@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ @@ -1127,7 +1218,6 @@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBINTL = @LTLIBINTL@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ -LTLIBPTH = @LTLIBPTH@ LTLIBTHREAD = @LTLIBTHREAD@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -1139,6 +1229,8 @@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ +NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H = @NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H@ +NEXT_AS_FIRST_DIRECTIVE_GLOB_H = @NEXT_AS_FIRST_DIRECTIVE_GLOB_H@ NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@ NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_MATH_H = @NEXT_AS_FIRST_DIRECTIVE_MATH_H@ @@ -1162,6 +1254,8 @@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ +NEXT_FNMATCH_H = @NEXT_FNMATCH_H@ +NEXT_GLOB_H = @NEXT_GLOB_H@ NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_MATH_H = @NEXT_MATH_H@ @@ -1197,6 +1291,11 @@ PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ +REPLACE_ACCESS = @REPLACE_ACCESS@ +REPLACE_ACOSF = @REPLACE_ACOSF@ +REPLACE_ASINF = @REPLACE_ASINF@ +REPLACE_ATAN2F = @REPLACE_ATAN2F@ +REPLACE_ATANF = @REPLACE_ATANF@ REPLACE_BTOWC = @REPLACE_BTOWC@ REPLACE_CALLOC = @REPLACE_CALLOC@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ @@ -1208,15 +1307,23 @@ REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@ +REPLACE_COSF = @REPLACE_COSF@ +REPLACE_COSHF = @REPLACE_COSHF@ +REPLACE_CREAT = @REPLACE_CREAT@ +REPLACE_CTIME = @REPLACE_CTIME@ REPLACE_DIRFD = @REPLACE_DIRFD@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_EXP2 = @REPLACE_EXP2@ REPLACE_EXP2L = @REPLACE_EXP2L@ +REPLACE_EXPF = @REPLACE_EXPF@ +REPLACE_EXPL = @REPLACE_EXPL@ REPLACE_EXPM1 = @REPLACE_EXPM1@ REPLACE_EXPM1F = @REPLACE_EXPM1F@ +REPLACE_EXPM1L = @REPLACE_EXPM1L@ REPLACE_FABSL = @REPLACE_FABSL@ +REPLACE_FACCESSAT = @REPLACE_FACCESSAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCNTL = @REPLACE_FCNTL@ @@ -1232,6 +1339,7 @@ REPLACE_FMAL = @REPLACE_FMAL@ REPLACE_FMOD = @REPLACE_FMOD@ REPLACE_FMODF = @REPLACE_FMODF@ REPLACE_FMODL = @REPLACE_FMODL@ +REPLACE_FNMATCH = @REPLACE_FNMATCH@ REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ REPLACE_FPURGE = @REPLACE_FPURGE@ @@ -1255,7 +1363,10 @@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETLINE = @REPLACE_GETLINE@ REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_GETPASS = @REPLACE_GETPASS@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_GLOB = @REPLACE_GLOB@ +REPLACE_GLOB_PATTERN_P = @REPLACE_GLOB_PATTERN_P@ REPLACE_GMTIME = @REPLACE_GMTIME@ REPLACE_HUGE_VAL = @REPLACE_HUGE_VAL@ REPLACE_HYPOT = @REPLACE_HYPOT@ @@ -1263,8 +1374,10 @@ REPLACE_HYPOTF = @REPLACE_HYPOTF@ REPLACE_HYPOTL = @REPLACE_HYPOTL@ REPLACE_ILOGB = @REPLACE_ILOGB@ REPLACE_ILOGBF = @REPLACE_ILOGBF@ +REPLACE_ILOGBL = @REPLACE_ILOGBL@ REPLACE_INET_NTOP = @REPLACE_INET_NTOP@ REPLACE_INET_PTON = @REPLACE_INET_PTON@ +REPLACE_INITSTATE = @REPLACE_INITSTATE@ REPLACE_ISATTY = @REPLACE_ISATTY@ REPLACE_ISFINITE = @REPLACE_ISFINITE@ REPLACE_ISINF = @REPLACE_ISINF@ @@ -1331,6 +1444,7 @@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RAISE = @REPLACE_RAISE@ +REPLACE_RANDOM = @REPLACE_RANDOM@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ @@ -1343,16 +1457,21 @@ REPLACE_REMAINDERL = @REPLACE_REMAINDERL@ REPLACE_REMOVE = @REPLACE_REMOVE@ REPLACE_RENAME = @REPLACE_RENAME@ REPLACE_RENAMEAT = @REPLACE_RENAMEAT@ +REPLACE_RINTL = @REPLACE_RINTL@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_ROUND = @REPLACE_ROUND@ REPLACE_ROUNDF = @REPLACE_ROUNDF@ REPLACE_ROUNDL = @REPLACE_ROUNDL@ REPLACE_SETENV = @REPLACE_SETENV@ +REPLACE_SETSTATE = @REPLACE_SETSTATE@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ +REPLACE_SINF = @REPLACE_SINF@ +REPLACE_SINHF = @REPLACE_SINHF@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_SQRTF = @REPLACE_SQRTF@ REPLACE_SQRTL = @REPLACE_SQRTL@ REPLACE_STAT = @REPLACE_STAT@ REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@ @@ -1363,6 +1482,7 @@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ +REPLACE_STRFTIME = @REPLACE_STRFTIME@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ @@ -1371,17 +1491,22 @@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ +REPLACE_STRTOLD = @REPLACE_STRTOLD@ REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ +REPLACE_TANF = @REPLACE_TANF@ +REPLACE_TANHF = @REPLACE_TANHF@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TOWLOWER = @REPLACE_TOWLOWER@ REPLACE_TRUNC = @REPLACE_TRUNC@ +REPLACE_TRUNCATE = @REPLACE_TRUNCATE@ REPLACE_TRUNCF = @REPLACE_TRUNCF@ REPLACE_TRUNCL = @REPLACE_TRUNCL@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ +REPLACE_TZSET = @REPLACE_TZSET@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_UNSETENV = @REPLACE_UNSETENV@ @@ -1394,8 +1519,10 @@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ +REPLACE_WCSFTIME = @REPLACE_WCSFTIME@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ +REPLACE_WCSTOK = @REPLACE_WCSTOK@ REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@ REPLACE_WCTOB = @REPLACE_WCTOB@ REPLACE_WCTOMB = @REPLACE_WCTOMB@ @@ -1422,12 +1549,13 @@ VERSION = @VERSION@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ +WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@ +WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ @@ -1462,7 +1590,6 @@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ -lispdir = @lispdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ @@ -1472,7 +1599,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -1485,26 +1611,29 @@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects +AUTOMAKE_OPTIONS = 1.11 gnits subdir-objects SUBDIRS = noinst_HEADERS = noinst_LIBRARIES = libgnu.a noinst_LTLIBRARIES = +# No GNU Make output. EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h arpa_inet.in.h \ assure.h openat-priv.h openat-proc.c canonicalize-lgpl.c \ chdir-long.c chdir-long.h cloexec.h close.c closedir.c \ dirent-private.h dirent.in.h dirfd.c dirname.h dosname.h dup.c \ dup2.c errno.in.h error.c error.h exitfail.h fchdir.c fcntl.c \ fcntl.in.h fd-hook.h fdopendir.c filename.h filenamecat.h \ - flexmember.h float.c float.in.h itold.c fnmatch.c fnmatch.in.h \ - fnmatch_loop.c fpucw.h frexp.c frexp.c frexpl.c fstat.c \ - at-func.c fstatat.c getcwd.c getcwd-lgpl.c getdtablesize.c \ - getlogin_r.c gettimeofday.c glob-libc.h glob.c glob.in.h \ - hard-locale.h $(top_srcdir)/import/extra/config.rpath \ - inet_ntop.c intprops.h inttypes.in.h float+.h isnan.c \ - isnand-nolibm.h isnand.c float+.h isnan.c isnanl-nolibm.h \ - isnanl.c limits.in.h config.charset ref-add.sin ref-del.sin \ - lstat.c malloc.c malloca.h malloca.valgrind math.in.h \ + flexmember.h float.c float.in.h itold.c fnmatch.c \ + fnmatch_loop.c fnmatch.in.h fpucw.h frexp.c frexp.c frexpl.c \ + fstat.c stat-w32.c stat-w32.h at-func.c fstatat.c getcwd.c \ + getcwd-lgpl.c getdtablesize.c getlogin_r.c gettimeofday.c \ + glob.c glob_internal.h glob_pattern_p.c globfree.c glob-libc.h \ + glob.in.h hard-locale.h \ + $(top_srcdir)/import/extra/config.rpath inet_ntop.c intprops.h \ + inttypes.in.h float+.h isnan.c isnand-nolibm.h isnand.c \ + float+.h isnan.c isnanl-nolibm.h isnanl.c cdefs.h \ + libc-config.h limits.in.h localcharset.h localtime-buffer.c \ + localtime-buffer.h lstat.c malloc.c malloca.h math.in.h \ mbrtowc.c mbsinit.c mbsrtowcs-impl.h mbsrtowcs-state.c \ mbsrtowcs.c memchr.c memchr.valgrind memmem.c str-two-way.h \ mempcpy.c memrchr.c mkdir.c mkdtemp.c mkostemp.c msvc-inval.c \ @@ -1512,102 +1641,105 @@ EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h arpa_inet.in.h \ open.c openat.c openat.h dirent-private.h opendir.c pathmax.h \ rawmemchr.c rawmemchr.valgrind dirent-private.h readdir.c \ readlink.c realloc.c rename.c dirent-private.h rewinddir.c \ - rmdir.c same-inode.h save-cwd.h secure_getenv.c setenv.c \ - signal.in.h $(top_srcdir)/import/extra/snippet/_Noreturn.h \ - $(top_srcdir)/import/extra/snippet/arg-nonnull.h \ - $(top_srcdir)/import/extra/snippet/c++defs.h \ - $(top_srcdir)/import/extra/snippet/warn-on-use.h stat.c \ - stdalign.in.h stdbool.in.h stddef.in.h stdint.in.h stdio.in.h \ - stdlib.in.h strchrnul.c strchrnul.valgrind strdup.c streq.h \ - strerror.c strerror-override.c strerror-override.h \ - strerror_r.c string.in.h str-two-way.h strstr.c strtok_r.c \ - sys_socket.in.h sys_stat.in.h sys_time.in.h sys_types.in.h \ - sys_uio.in.h tempname.h \ - $(top_srcdir)/import/extra/config.rpath time.in.h time_r.c \ - unistd.in.h unistd--.h unistd-safer.h unsetenv.c \ + rmdir.c same-inode.h save-cwd.h malloc/scratch_buffer.h \ + scratch_buffer.h setenv.c signal.in.h _Noreturn.h \ + arg-nonnull.h c++defs.h warn-on-use.h stat-w32.c stat-w32.h \ + stat.c stat-time.h stdalign.in.h stdbool.in.h stddef.in.h \ + stdint.in.h stdio.in.h stdlib.in.h strchrnul.c \ + strchrnul.valgrind strdup.c streq.h strerror.c \ + strerror-override.c strerror-override.h strerror_r.c \ + string.in.h str-two-way.h strstr.c strtok_r.c sys_socket.in.h \ + sys_stat.in.h sys_time.in.h sys_types.in.h sys_uio.in.h \ + tempname.h time.in.h time_r.c unistd.in.h unistd--.h \ + unistd-safer.h unsetenv.c \ $(top_srcdir)/import/extra/update-copyright verify.h \ - wchar.in.h wctype.in.h - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. -BUILT_SOURCES = $(ALLOCA_H) arpa/inet.h configmake.h dirent.h \ - $(ERRNO_H) fcntl.h $(FLOAT_H) $(FNMATCH_H) $(GLOB_H) \ - inttypes.h $(LIMITS_H) math.h $(NETINET_IN_H) signal.h \ - arg-nonnull.h c++defs.h warn-on-use.h $(STDALIGN_H) \ - $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) stdio.h stdlib.h string.h \ - sys/socket.h sys/stat.h sys/time.h sys/types.h sys/uio.h \ - time.h unistd.h wchar.h wctype.h -SUFFIXES = .sed .sin + wchar.in.h wctype.in.h windows-initguard.h windows-mutex.c \ + windows-mutex.h windows-once.c windows-once.h \ + windows-initguard.h windows-recmutex.c windows-recmutex.h \ + windows-initguard.h windows-rwlock.c windows-rwlock.h \ + xalloc-oversized.h +BUILT_SOURCES = $(ALLOCA_H) arpa/inet.h dirent.h $(ERRNO_H) fcntl.h \ + $(FLOAT_H) $(FNMATCH_H) $(GLOB_H) inttypes.h $(LIMITS_H) \ + math.h $(NETINET_IN_H) signal.h $(STDALIGN_H) $(STDBOOL_H) \ + $(STDDEF_H) $(STDINT_H) stdio.h stdlib.h string.h sys/socket.h \ + sys/stat.h sys/time.h sys/types.h sys/uio.h time.h unistd.h \ + wchar.h wctype.h +SUFFIXES = MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t arpa/inet.h \ arpa/inet.h-t dirent.h dirent.h-t errno.h errno.h-t fcntl.h \ fcntl.h-t float.h float.h-t fnmatch.h fnmatch.h-t glob.h \ glob.h-t inttypes.h inttypes.h-t limits.h limits.h-t math.h \ math.h-t netinet/in.h netinet/in.h-t signal.h signal.h-t \ - arg-nonnull.h arg-nonnull.h-t c++defs.h c++defs.h-t \ - warn-on-use.h warn-on-use.h-t stdalign.h stdalign.h-t \ - stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t \ - stdio.h stdio.h-t stdlib.h stdlib.h-t string.h string.h-t \ - sys/socket.h sys/socket.h-t sys/stat.h sys/stat.h-t sys/time.h \ - sys/time.h-t sys/types.h sys/types.h-t sys/uio.h sys/uio.h-t \ - time.h time.h-t unistd.h unistd.h-t wchar.h wchar.h-t wctype.h \ - wctype.h-t + stdalign.h stdalign.h-t stdbool.h stdbool.h-t stddef.h \ + stddef.h-t stdint.h stdint.h-t stdio.h stdio.h-t stdlib.h \ + stdlib.h-t string.h string.h-t sys/socket.h sys/socket.h-t \ + sys/stat.h sys/stat.h-t sys/time.h sys/time.h-t sys/types.h \ + sys/types.h-t sys/uio.h sys/uio.h-t time.h time.h-t unistd.h \ + unistd.h-t wchar.h wchar.h-t wctype.h wctype.h-t MOSTLYCLEANDIRS = arpa netinet sys sys sys -CLEANFILES = configmake.h configmake.h-t charset.alias ref-add.sed \ - ref-del.sed +CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = AM_CPPFLAGS = AM_CFLAGS = libgnu_a_SOURCES = cloexec.c dirname-lgpl.c basename-lgpl.c \ - stripslash.c exitfail.c fd-hook.c filenamecat-lgpl.c \ - getprogname.h getprogname.c gettext.h hard-locale.c \ - localcharset.h localcharset.c glthread/lock.h glthread/lock.c \ - malloca.c math.c openat-die.c save-cwd.c strnlen1.h strnlen1.c \ - sys_socket.c tempname.c glthread/threadlib.c unistd.c \ - dup-safer.c fd-safer.c pipe-safer.c wctype-h.c + stripslash.c exitfail.c fd-hook.c fd-safer-flag.c \ + dup-safer-flag.c filenamecat-lgpl.c getprogname.h \ + getprogname.c gettext.h hard-locale.c localcharset.c \ + glthread/lock.h glthread/lock.c malloca.c math.c openat-die.c \ + save-cwd.c malloc/scratch_buffer_grow.c \ + malloc/scratch_buffer_grow_preserve.c \ + malloc/scratch_buffer_set_array_size.c stat-time.c strnlen1.h \ + strnlen1.c sys_socket.c tempname.c glthread/threadlib.c \ + unistd.c dup-safer.c fd-safer.c pipe-safer.c wctype-h.c libgnu_a_LIBADD = $(gl_LIBOBJS) @ALLOCA@ libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@ EXTRA_libgnu_a_SOURCES = alloca.c openat-proc.c canonicalize-lgpl.c \ chdir-long.c close.c closedir.c dirfd.c dup.c dup2.c error.c \ fchdir.c fcntl.c fdopendir.c float.c itold.c fnmatch.c \ - fnmatch_loop.c frexp.c frexp.c frexpl.c fstat.c at-func.c \ - fstatat.c getcwd.c getcwd-lgpl.c getdtablesize.c getlogin_r.c \ - gettimeofday.c glob.c inet_ntop.c isnan.c isnand.c isnan.c \ - isnanl.c lstat.c malloc.c mbrtowc.c mbsinit.c \ + fnmatch_loop.c frexp.c frexp.c frexpl.c fstat.c stat-w32.c \ + at-func.c fstatat.c getcwd.c getcwd-lgpl.c getdtablesize.c \ + getlogin_r.c gettimeofday.c glob.c glob_pattern_p.c globfree.c \ + inet_ntop.c isnan.c isnand.c isnan.c isnanl.c \ + localtime-buffer.c lstat.c malloc.c mbrtowc.c mbsinit.c \ mbsrtowcs-state.c mbsrtowcs.c memchr.c memmem.c mempcpy.c \ memrchr.c mkdir.c mkdtemp.c mkostemp.c msvc-inval.c \ msvc-nothrow.c open.c openat.c opendir.c rawmemchr.c readdir.c \ - readlink.c realloc.c rename.c rewinddir.c rmdir.c \ - secure_getenv.c setenv.c stat.c strchrnul.c strdup.c \ - strerror.c strerror-override.c strerror_r.c strstr.c \ - strtok_r.c time_r.c unsetenv.c + readlink.c realloc.c rename.c rewinddir.c rmdir.c setenv.c \ + stat-w32.c stat.c strchrnul.c strdup.c strerror.c \ + strerror-override.c strerror_r.c strstr.c strtok_r.c time_r.c \ + unsetenv.c windows-mutex.c windows-once.c windows-recmutex.c \ + windows-rwlock.c # Use this preprocessor expression to decide whether #include_next works. # Do not rely on a 'configure'-time test for this, since the expression # might appear in an installed header, which is used by some other compiler. HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER) -charset_alias = $(DESTDIR)$(libdir)/charset.alias -charset_tmp = $(DESTDIR)$(libdir)/charset.tmp # Because this Makefile snippet defines a variable used by other -# gnulib Makefile snippets, it must be present in all Makefile.am that +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. +_NORETURN_H = $(srcdir)/_Noreturn.h + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. +ARG_NONNULL_H = $(srcdir)/arg-nonnull.h + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. +CXXDEFS_H = $(srcdir)/c++defs.h + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. -_NORETURN_H = $(top_srcdir)/import/extra/snippet/_Noreturn.h -ARG_NONNULL_H = arg-nonnull.h -CXXDEFS_H = c++defs.h -WARN_ON_USE_H = warn-on-use.h +WARN_ON_USE_H = $(srcdir)/warn-on-use.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: -.SUFFIXES: .sed .sin .c .o .obj +.SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -1648,6 +1780,18 @@ glthread/$(DEPDIR)/$(am__dirstamp): @: > glthread/$(DEPDIR)/$(am__dirstamp) glthread/lock.$(OBJEXT): glthread/$(am__dirstamp) \ glthread/$(DEPDIR)/$(am__dirstamp) +malloc/$(am__dirstamp): + @$(MKDIR_P) malloc + @: > malloc/$(am__dirstamp) +malloc/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) malloc/$(DEPDIR) + @: > malloc/$(DEPDIR)/$(am__dirstamp) +malloc/scratch_buffer_grow.$(OBJEXT): malloc/$(am__dirstamp) \ + malloc/$(DEPDIR)/$(am__dirstamp) +malloc/scratch_buffer_grow_preserve.$(OBJEXT): malloc/$(am__dirstamp) \ + malloc/$(DEPDIR)/$(am__dirstamp) +malloc/scratch_buffer_set_array_size.$(OBJEXT): \ + malloc/$(am__dirstamp) malloc/$(DEPDIR)/$(am__dirstamp) glthread/threadlib.$(OBJEXT): glthread/$(am__dirstamp) \ glthread/$(DEPDIR)/$(am__dirstamp) @@ -1670,6 +1814,7 @@ clean-noinstLTLIBRARIES: mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f glthread/*.$(OBJEXT) + -rm -f malloc/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c @@ -1684,6 +1829,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closedir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirfd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirname-lgpl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup-safer-flag.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup-safer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup2.Po@am__quote@ @@ -1692,6 +1838,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchdir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcntl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-hook.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer-flag.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdopendir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filenamecat-lgpl.Po@am__quote@ @@ -1709,6 +1856,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getprogname.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettimeofday.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glob.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glob_pattern_p.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globfree.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hard-locale.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inet_ntop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnan.Po@am__quote@ @@ -1716,6 +1865,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnanl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/itold.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localcharset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localtime-buffer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloca.Po@am__quote@ @@ -1747,8 +1897,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rewinddir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmdir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/save-cwd.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/secure_getenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setenv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat-time.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat-w32.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strchrnul.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strdup.Po@am__quote@ @@ -1765,8 +1916,15 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unistd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unsetenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wctype-h.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-mutex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-once.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-recmutex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-rwlock.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@glthread/$(DEPDIR)/lock.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@glthread/$(DEPDIR)/threadlib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@malloc/$(DEPDIR)/scratch_buffer_grow.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@malloc/$(DEPDIR)/scratch_buffer_grow_preserve.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@malloc/$(DEPDIR)/scratch_buffer_set_array_size.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -1885,7 +2043,7 @@ distclean-tags: check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive -all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS) all-local +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: install: $(BUILT_SOURCES) @@ -1919,6 +2077,8 @@ distclean-generic: -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f glthread/$(DEPDIR)/$(am__dirstamp) -rm -f glthread/$(am__dirstamp) + -rm -f malloc/$(DEPDIR)/$(am__dirstamp) + -rm -f malloc/$(am__dirstamp) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @@ -1932,7 +2092,7 @@ clean-am: clean-generic clean-noinstLIBRARIES clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive - -rm -rf ./$(DEPDIR) glthread/$(DEPDIR) + -rm -rf ./$(DEPDIR) glthread/$(DEPDIR) malloc/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -1955,7 +2115,7 @@ install-dvi: install-dvi-recursive install-dvi-am: -install-exec-am: install-exec-local +install-exec-am: install-html: install-html-recursive @@ -1978,7 +2138,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) glthread/$(DEPDIR) + -rm -rf ./$(DEPDIR) glthread/$(DEPDIR) malloc/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -1995,25 +2155,24 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-local +uninstall-am: .MAKE: $(am__recursive_targets) all check install install-am \ install-strip -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \ - check check-am clean clean-generic clean-noinstLIBRARIES \ +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-noinstLIBRARIES \ clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-tags dvi dvi-am \ html html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-exec-local install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-local pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am uninstall-local + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-local pdf pdf-am ps ps-am tags \ + tags-am uninstall uninstall-am .PRECIOUS: Makefile @@ -2023,7 +2182,7 @@ uninstall-am: uninstall-local @GL_GENERATE_ALLOCA_H_TRUE@alloca.h: alloca.in.h $(top_builddir)/config.status @GL_GENERATE_ALLOCA_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ @GL_GENERATE_ALLOCA_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ -@GL_GENERATE_ALLOCA_H_TRUE@ cat $(srcdir)/alloca.in.h; \ +@GL_GENERATE_ALLOCA_H_TRUE@ sed -e 's|@''HAVE_ALLOCA_H''@|$(HAVE_ALLOCA_H)|g' < $(srcdir)/alloca.in.h; \ @GL_GENERATE_ALLOCA_H_TRUE@ } > $@-t && \ @GL_GENERATE_ALLOCA_H_TRUE@ mv -f $@-t $@ @GL_GENERATE_ALLOCA_H_FALSE@alloca.h: $(top_builddir)/config.status @@ -2044,6 +2203,7 @@ arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \ -e 's/@''GNULIB_INET_NTOP''@/$(GNULIB_INET_NTOP)/g' \ -e 's/@''GNULIB_INET_PTON''@/$(GNULIB_INET_PTON)/g' \ + -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \ -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \ -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \ @@ -2055,44 +2215,6 @@ arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON } > $@-t && \ mv $@-t $@ -# Listed in the same order as the GNU makefile conventions, and -# provided by autoconf 2.59c+ or 2.70. -# The Automake-defined pkg* macros are appended, in the order -# listed in the Automake 1.10a+ documentation. -configmake.h: Makefile - $(AM_V_GEN)rm -f $@-t && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - echo '#define PREFIX "$(prefix)"'; \ - echo '#define EXEC_PREFIX "$(exec_prefix)"'; \ - echo '#define BINDIR "$(bindir)"'; \ - echo '#define SBINDIR "$(sbindir)"'; \ - echo '#define LIBEXECDIR "$(libexecdir)"'; \ - echo '#define DATAROOTDIR "$(datarootdir)"'; \ - echo '#define DATADIR "$(datadir)"'; \ - echo '#define SYSCONFDIR "$(sysconfdir)"'; \ - echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \ - echo '#define LOCALSTATEDIR "$(localstatedir)"'; \ - echo '#define RUNSTATEDIR "$(runstatedir)"'; \ - echo '#define INCLUDEDIR "$(includedir)"'; \ - echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \ - echo '#define DOCDIR "$(docdir)"'; \ - echo '#define INFODIR "$(infodir)"'; \ - echo '#define HTMLDIR "$(htmldir)"'; \ - echo '#define DVIDIR "$(dvidir)"'; \ - echo '#define PDFDIR "$(pdfdir)"'; \ - echo '#define PSDIR "$(psdir)"'; \ - echo '#define LIBDIR "$(libdir)"'; \ - echo '#define LISPDIR "$(lispdir)"'; \ - echo '#define LOCALEDIR "$(localedir)"'; \ - echo '#define MANDIR "$(mandir)"'; \ - echo '#define MANEXT "$(manext)"'; \ - echo '#define PKGDATADIR "$(pkgdatadir)"'; \ - echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \ - echo '#define PKGLIBDIR "$(pkglibdir)"'; \ - echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \ - } | sed '/""/d' > $@-t && \ - mv -f $@-t $@ - # We need the following in order to create <dirent.h> when the system # doesn't have one that works with the given compiler. dirent.h: dirent.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) @@ -2164,12 +2286,14 @@ fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ + -e 's/@''GNULIB_CREAT''@/$(GNULIB_CREAT)/g' \ -e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \ -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \ -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \ -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \ -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ + -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \ -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \ @@ -2197,30 +2321,49 @@ fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) @GL_GENERATE_FLOAT_H_FALSE@float.h: $(top_builddir)/config.status @GL_GENERATE_FLOAT_H_FALSE@ rm -f $@ -# We need the following in order to create <fnmatch.h> when the system -# doesn't have one that supports the required API. -@GL_GENERATE_FNMATCH_H_TRUE@fnmatch.h: fnmatch.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) +# We need the following in order to create <fnmatch.h>. +@GL_GENERATE_FNMATCH_H_TRUE@fnmatch.h: fnmatch.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) @GL_GENERATE_FNMATCH_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ -@GL_GENERATE_FNMATCH_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ -@GL_GENERATE_FNMATCH_H_TRUE@ sed -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ +@GL_GENERATE_FNMATCH_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ +@GL_GENERATE_FNMATCH_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ +@GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''HAVE_FNMATCH_H''@|$(HAVE_FNMATCH_H)|g' \ +@GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ +@GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ +@GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ +@GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''NEXT_FNMATCH_H''@|$(NEXT_FNMATCH_H)|g' \ +@GL_GENERATE_FNMATCH_H_TRUE@ -e 's/@''GNULIB_FNMATCH''@/$(GNULIB_FNMATCH)/g' \ +@GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''HAVE_FNMATCH''@|$(HAVE_FNMATCH)|g' \ +@GL_GENERATE_FNMATCH_H_TRUE@ -e 's|@''REPLACE_FNMATCH''@|$(REPLACE_FNMATCH)|g' \ +@GL_GENERATE_FNMATCH_H_TRUE@ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ +@GL_GENERATE_FNMATCH_H_TRUE@ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ +@GL_GENERATE_FNMATCH_H_TRUE@ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ @GL_GENERATE_FNMATCH_H_TRUE@ < $(srcdir)/fnmatch.in.h; \ @GL_GENERATE_FNMATCH_H_TRUE@ } > $@-t && \ -@GL_GENERATE_FNMATCH_H_TRUE@ mv -f $@-t $@ +@GL_GENERATE_FNMATCH_H_TRUE@ mv $@-t $@ @GL_GENERATE_FNMATCH_H_FALSE@fnmatch.h: $(top_builddir)/config.status @GL_GENERATE_FNMATCH_H_FALSE@ rm -f $@ -# We need the following in order to create <glob.h> when the system -# doesn't have one that works with the given compiler. +# We need the following in order to create <glob.h>. @GL_GENERATE_GLOB_H_TRUE@glob.h: glob.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) @GL_GENERATE_GLOB_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ -@GL_GENERATE_GLOB_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ -@GL_GENERATE_GLOB_H_TRUE@ sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ +@GL_GENERATE_GLOB_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ +@GL_GENERATE_GLOB_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ +@GL_GENERATE_GLOB_H_TRUE@ -e 's|@''HAVE_GLOB_H''@|$(HAVE_GLOB_H)|g' \ +@GL_GENERATE_GLOB_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ +@GL_GENERATE_GLOB_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ +@GL_GENERATE_GLOB_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ +@GL_GENERATE_GLOB_H_TRUE@ -e 's|@''NEXT_GLOB_H''@|$(NEXT_GLOB_H)|g' \ +@GL_GENERATE_GLOB_H_TRUE@ -e 's/@''GNULIB_GLOB''@/$(GNULIB_GLOB)/g' \ +@GL_GENERATE_GLOB_H_TRUE@ -e 's|@''HAVE_GLOB''@|$(HAVE_GLOB)|g' \ +@GL_GENERATE_GLOB_H_TRUE@ -e 's|@''HAVE_GLOB_PATTERN_P''@|$(HAVE_GLOB_PATTERN_P)|g' \ +@GL_GENERATE_GLOB_H_TRUE@ -e 's|@''REPLACE_GLOB''@|$(REPLACE_GLOB)|g' \ +@GL_GENERATE_GLOB_H_TRUE@ -e 's|@''REPLACE_GLOB_PATTERN_P''@|$(REPLACE_GLOB_PATTERN_P)|g' \ @GL_GENERATE_GLOB_H_TRUE@ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ @GL_GENERATE_GLOB_H_TRUE@ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ @GL_GENERATE_GLOB_H_TRUE@ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ @GL_GENERATE_GLOB_H_TRUE@ < $(srcdir)/glob.in.h; \ @GL_GENERATE_GLOB_H_TRUE@ } > $@-t && \ -@GL_GENERATE_GLOB_H_TRUE@ mv -f $@-t $@ +@GL_GENERATE_GLOB_H_TRUE@ mv $@-t $@ @GL_GENERATE_GLOB_H_FALSE@glob.h: $(top_builddir)/config.status @GL_GENERATE_GLOB_H_FALSE@ rm -f $@ @@ -2247,6 +2390,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' \ @@ -2276,65 +2420,6 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_U @GL_GENERATE_LIMITS_H_FALSE@limits.h: $(top_builddir)/config.status @GL_GENERATE_LIMITS_H_FALSE@ rm -f $@ -# We need the following in order to install a simple file in $(libdir) -# which is shared with other installed packages. We use a list of referencing -# packages so that "make uninstall" will remove the file if and only if it -# is not used by another installed package. -# On systems with glibc-2.1 or newer, the file is redundant, therefore we -# avoid installing it. - -all-local: charset.alias ref-add.sed ref-del.sed -install-exec-local: install-exec-localcharset -install-exec-localcharset: all-local - if test $(GLIBC21) = no; then \ - case '$(host_os)' in \ - darwin[56]*) \ - need_charset_alias=true ;; \ - darwin* | cygwin* | mingw* | pw32* | cegcc*) \ - need_charset_alias=false ;; \ - *) \ - need_charset_alias=true ;; \ - esac ; \ - else \ - need_charset_alias=false ; \ - fi ; \ - if $$need_charset_alias; then \ - $(mkinstalldirs) $(DESTDIR)$(libdir) ; \ - fi ; \ - if test -f $(charset_alias); then \ - sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \ - $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \ - rm -f $(charset_tmp) ; \ - else \ - if $$need_charset_alias; then \ - sed -f ref-add.sed charset.alias > $(charset_tmp) ; \ - $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \ - rm -f $(charset_tmp) ; \ - fi ; \ - fi - -uninstall-local: uninstall-localcharset -uninstall-localcharset: all-local - if test -f $(charset_alias); then \ - sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \ - if grep '^# Packages using this file: $$' $(charset_tmp) \ - > /dev/null; then \ - rm -f $(charset_alias); \ - else \ - $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \ - fi; \ - rm -f $(charset_tmp); \ - fi - -charset.alias: config.charset - $(AM_V_GEN)rm -f t-$@ $@ && \ - $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@ && \ - mv t-$@ $@ -.sin.sed: - $(AM_V_GEN)rm -f t-$@ $@ && \ - sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ && \ - mv t-$@ $@ - # We need the following in order to create <math.h> when the system # doesn't have one that works with the given compiler. math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) @@ -2539,13 +2624,22 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \ -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \ | \ - sed -e 's|@''REPLACE_CBRTF''@|$(REPLACE_CBRTF)|g' \ + sed -e 's|@''REPLACE_ACOSF''@|$(REPLACE_ACOSF)|g' \ + -e 's|@''REPLACE_ASINF''@|$(REPLACE_ASINF)|g' \ + -e 's|@''REPLACE_ATANF''@|$(REPLACE_ATANF)|g' \ + -e 's|@''REPLACE_ATAN2F''@|$(REPLACE_ATAN2F)|g' \ + -e 's|@''REPLACE_CBRTF''@|$(REPLACE_CBRTF)|g' \ -e 's|@''REPLACE_CBRTL''@|$(REPLACE_CBRTL)|g' \ -e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \ -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \ -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \ + -e 's|@''REPLACE_COSF''@|$(REPLACE_COSF)|g' \ + -e 's|@''REPLACE_COSHF''@|$(REPLACE_COSHF)|g' \ + -e 's|@''REPLACE_EXPF''@|$(REPLACE_EXPF)|g' \ + -e 's|@''REPLACE_EXPL''@|$(REPLACE_EXPL)|g' \ -e 's|@''REPLACE_EXPM1''@|$(REPLACE_EXPM1)|g' \ -e 's|@''REPLACE_EXPM1F''@|$(REPLACE_EXPM1F)|g' \ + -e 's|@''REPLACE_EXPM1L''@|$(REPLACE_EXPM1L)|g' \ -e 's|@''REPLACE_EXP2''@|$(REPLACE_EXP2)|g' \ -e 's|@''REPLACE_EXP2L''@|$(REPLACE_EXP2L)|g' \ -e 's|@''REPLACE_FABSL''@|$(REPLACE_FABSL)|g' \ @@ -2567,6 +2661,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''REPLACE_HYPOTL''@|$(REPLACE_HYPOTL)|g' \ -e 's|@''REPLACE_ILOGB''@|$(REPLACE_ILOGB)|g' \ -e 's|@''REPLACE_ILOGBF''@|$(REPLACE_ILOGBF)|g' \ + -e 's|@''REPLACE_ILOGBL''@|$(REPLACE_ILOGBL)|g' \ -e 's|@''REPLACE_ISFINITE''@|$(REPLACE_ISFINITE)|g' \ -e 's|@''REPLACE_ISINF''@|$(REPLACE_ISINF)|g' \ -e 's|@''REPLACE_ISNAN''@|$(REPLACE_ISNAN)|g' \ @@ -2594,12 +2689,18 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''REPLACE_REMAINDER''@|$(REPLACE_REMAINDER)|g' \ -e 's|@''REPLACE_REMAINDERF''@|$(REPLACE_REMAINDERF)|g' \ -e 's|@''REPLACE_REMAINDERL''@|$(REPLACE_REMAINDERL)|g' \ + -e 's|@''REPLACE_RINTL''@|$(REPLACE_RINTL)|g' \ -e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \ -e 's|@''REPLACE_ROUNDF''@|$(REPLACE_ROUNDF)|g' \ -e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \ -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \ -e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \ + -e 's|@''REPLACE_SINF''@|$(REPLACE_SINF)|g' \ + -e 's|@''REPLACE_SINHF''@|$(REPLACE_SINHF)|g' \ + -e 's|@''REPLACE_SQRTF''@|$(REPLACE_SQRTF)|g' \ -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \ + -e 's|@''REPLACE_TANF''@|$(REPLACE_TANF)|g' \ + -e 's|@''REPLACE_TANHF''@|$(REPLACE_TANHF)|g' \ -e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \ -e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \ -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \ @@ -2637,8 +2738,8 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ - -e 's|@''GNULIB_PTHREAD_SIGMASK''@|$(GNULIB_PTHREAD_SIGMASK)|g' \ - -e 's|@''GNULIB_RAISE''@|$(GNULIB_RAISE)|g' \ + -e 's/@''GNULIB_PTHREAD_SIGMASK''@/$(GNULIB_PTHREAD_SIGMASK)/g' \ + -e 's/@''GNULIB_RAISE''@/$(GNULIB_RAISE)/g' \ -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \ -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \ -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \ @@ -2659,32 +2760,6 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H < $(srcdir)/signal.in.h; \ } > $@-t && \ mv $@-t $@ -# The arg-nonnull.h that gets inserted into generated .h files is the same as -# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut -# off. -arg-nonnull.h: $(top_srcdir)/import/extra/snippet/arg-nonnull.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/GL_ARG_NONNULL/,$$p' \ - < $(top_srcdir)/import/extra/snippet/arg-nonnull.h \ - > $@-t && \ - mv $@-t $@ -# The c++defs.h that gets inserted into generated .h files is the same as -# build-aux/snippet/c++defs.h, except that it has the copyright header cut off. -c++defs.h: $(top_srcdir)/import/extra/snippet/c++defs.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/_GL_CXXDEFS/,$$p' \ - < $(top_srcdir)/import/extra/snippet/c++defs.h \ - > $@-t && \ - mv $@-t $@ -# The warn-on-use.h that gets inserted into generated .h files is the same as -# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut -# off. -warn-on-use.h: $(top_srcdir)/import/extra/snippet/warn-on-use.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/^.ifndef/,$$p' \ - < $(top_srcdir)/import/extra/snippet/warn-on-use.h \ - > $@-t && \ - mv $@-t $@ # We need the following in order to create <stdalign.h> when the system # doesn't have one that works. @@ -2760,6 +2835,7 @@ warn-on-use.h: $(top_srcdir)/import/extra/snippet/warn-on-use.h @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ < $(srcdir)/stdint.in.h; \ @GL_GENERATE_STDINT_H_TRUE@ } > $@-t && \ @GL_GENERATE_STDINT_H_TRUE@ mv $@-t $@ @@ -2918,11 +2994,13 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \ -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ + -e 's/@''GNULIB_REALLOCARRAY''@/$(GNULIB_REALLOCARRAY)/g' \ -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ + -e 's/@''GNULIB_STRTOLD''@/$(GNULIB_STRTOLD)/g' \ -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \ -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \ @@ -2936,6 +3014,9 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ + -e 's|@''HAVE_INITSTATE''@|$(HAVE_INITSTATE)|g' \ + -e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \ + -e 's|@''HAVE_MBTOWC''@|$(HAVE_MBTOWC)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ @@ -2948,11 +3029,15 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ + -e 's|@''HAVE_REALLOCARRAY''@|$(HAVE_REALLOCARRAY)|g' \ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ + -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ + -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ + -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ @@ -2961,6 +3046,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ + -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \ -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ @@ -2968,11 +3054,14 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \ + -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ + -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ + -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ @@ -2992,6 +3081,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ + -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GNULIB_EXPLICIT_BZERO)/g' \ -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \ -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \ -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ @@ -3030,7 +3120,8 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ < $(srcdir)/string.in.h | \ - sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ + sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ + -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ @@ -3051,20 +3142,20 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ - -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ - -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ - -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ - -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ - -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ - -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ @@ -3126,6 +3217,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ + -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \ -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \ -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ @@ -3139,6 +3231,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \ -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \ -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \ + -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GNULIB_OVERRIDES_STRUCT_STAT)/g' \ -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ @@ -3203,6 +3296,7 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ < $(srcdir)/sys_types.in.h; \ } > $@-t && \ mv $@-t $@ @@ -3233,24 +3327,31 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ - -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \ + -e 's/@''GNULIB_CTIME''@/$(GNULIB_CTIME)/g' \ + -e 's/@''GNULIB_LOCALTIME''@/$(GNULIB_LOCALTIME)/g' \ -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \ -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \ + -e 's/@''GNULIB_STRFTIME''@/$(GNULIB_STRFTIME)/g' \ -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \ -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \ -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \ -e 's/@''GNULIB_TIME_RZ''@/$(GNULIB_TIME_RZ)/g' \ + -e 's/@''GNULIB_TZSET''@/$(GNULIB_TZSET)/g' \ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ + -e 's|@''HAVE_TZSET''@|$(HAVE_TZSET)|g' \ + -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ + -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ + -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \ -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ @@ -3274,9 +3375,11 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's/@''GNULIB_ACCESS''@/$(GNULIB_ACCESS)/g' \ -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \ -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ + -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GNULIB_COPY_FILE_RANGE)/g' \ -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \ -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ @@ -3296,6 +3399,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \ -e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \ -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \ + -e 's/@''GNULIB_GETPASS''@/$(GNULIB_GETPASS)/g' \ -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \ -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \ -e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/g' \ @@ -3315,6 +3419,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ + -e 's/@''GNULIB_TRUNCATE''@/$(GNULIB_TRUNCATE)/g' \ -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \ -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ @@ -3325,6 +3430,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \ < $(srcdir)/unistd.in.h | \ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ + -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ @@ -3337,8 +3443,8 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ - -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ + -e 's|@''HAVE_GETPASS''@|$(HAVE_GETPASS)|g' \ -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ @@ -3359,18 +3465,22 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \ -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ + -e 's|@''HAVE_DECL_GETLOGIN''@|$(HAVE_DECL_GETLOGIN)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -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' \ | \ - sed -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ + sed -e 's|@''REPLACE_ACCESS''@|$(REPLACE_ACCESS)|g' \ + -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ + -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ @@ -3379,6 +3489,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ + -e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \ -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ @@ -3393,6 +3504,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ + -e 's|@''REPLACE_TRUNCATE''@|$(REPLACE_TRUNCATE)|g' \ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ @@ -3418,6 +3530,8 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ + -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ + -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \ -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \ -e 's/@''GNULIB_MBSINIT''@/$(GNULIB_MBSINIT)/g' \ @@ -3457,6 +3571,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \ -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \ -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \ + -e 's/@''GNULIB_WCSFTIME''@/$(GNULIB_WCSFTIME)/g' \ < $(srcdir)/wchar.in.h | \ sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ @@ -3496,6 +3611,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \ -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \ -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \ + -e 's|@''HAVE_WCSFTIME''@|$(HAVE_WCSFTIME)|g' \ -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ | \ @@ -3512,6 +3628,8 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ + -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \ + -e 's|@''REPLACE_WCSTOK''@|$(REPLACE_WCSTOK)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ @@ -3529,6 +3647,8 @@ wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ + -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \ -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \ -e 's/@''GNULIB_ISWCTYPE''@/$(GNULIB_ISWCTYPE)/g' \ diff --git a/gnulib/import/_Noreturn.h b/gnulib/import/_Noreturn.h new file mode 100644 index 0000000..7570f82 --- /dev/null +++ b/gnulib/import/_Noreturn.h @@ -0,0 +1,40 @@ +/* A C macro for declaring that a function does not return. + Copyright (C) 2011-2019 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +#ifndef _Noreturn +# if (defined __cplusplus \ + && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ + || (defined _MSC_VER && 1900 <= _MSC_VER)) \ + && 0) + /* [[noreturn]] is not practically usable, because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would only be valid with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. */ +# define _Noreturn [[noreturn]] +# elif ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ + || 4 < __GNUC__ + (7 <= __GNUC_MINOR__))) + /* _Noreturn works as-is. */ +# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C +# define _Noreturn __attribute__ ((__noreturn__)) +# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif +#endif diff --git a/gnulib/import/alloca.c b/gnulib/import/alloca.c index ee0f018..d0476d5 100644 --- a/gnulib/import/alloca.c +++ b/gnulib/import/alloca.c @@ -350,16 +350,16 @@ i00afunc (long *address) /* There must be at least one stack segment. Therefore it is a fatal error if "trailer" is null. */ - if (trailer == 0) + if (trailer == NULL) abort (); /* Discard segments that do not contain our argument address. */ - while (trailer != 0) + while (trailer != NULL) { block = (long *) trailer->this_address; size = trailer->this_size; - if (block == 0 || size == 0) + if (block == NULL || size == 0) abort (); trailer = (struct stk_trailer *) trailer->link; if ((block <= address) && (address < (block + size))) @@ -371,7 +371,7 @@ i00afunc (long *address) result = address - block; - if (trailer == 0) + if (trailer == NULL) { return result; } @@ -383,7 +383,7 @@ i00afunc (long *address) result += trailer->this_size; trailer = (struct stk_trailer *) trailer->link; } - while (trailer != 0); + while (trailer != NULL); /* We are done. Note that if you present a bogus address (one not in any segment), you will get a different number back, formed diff --git a/gnulib/import/alloca.in.h b/gnulib/import/alloca.in.h index 6a25ecd..a581d58 100644 --- a/gnulib/import/alloca.in.h +++ b/gnulib/import/alloca.in.h @@ -1,6 +1,6 @@ /* Memory allocation on the stack. - Copyright (C) 1995, 1999, 2001-2004, 2006-2016 Free Software Foundation, + Copyright (C) 1995, 1999, 2001-2004, 2006-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see - <http://www.gnu.org/licenses/>. + <https://www.gnu.org/licenses/>. */ /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H @@ -36,6 +36,12 @@ #ifndef alloca # ifdef __GNUC__ + /* Some version of mingw have an <alloca.h> that causes trouble when + included after 'alloca' gets defined as a macro. As a workaround, include + this <alloca.h> first and define 'alloca' as a macro afterwards. */ +# if (defined _WIN32 && ! defined __CYGWIN__) && @HAVE_ALLOCA_H@ +# include_next <alloca.h> +# endif # define alloca __builtin_alloca # elif defined _AIX # define alloca __alloca diff --git a/gnulib/import/extra/snippet/arg-nonnull.h b/gnulib/import/arg-nonnull.h index 584649f..ad8c26c 100644 --- a/gnulib/import/extra/snippet/arg-nonnull.h +++ b/gnulib/import/arg-nonnull.h @@ -1,5 +1,5 @@ /* A C macro for declaring that specific arguments must not be NULL. - Copyright (C) 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2009-2019 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 @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools that the values passed as arguments n, ..., m must be non-NULL pointers. diff --git a/gnulib/import/arpa_inet.in.h b/gnulib/import/arpa_inet.in.h index 026c4dc..a5b3907 100644 --- a/gnulib/import/arpa_inet.in.h +++ b/gnulib/import/arpa_inet.in.h @@ -1,6 +1,6 @@ /* A GNU-like <arpa/inet.h>. - Copyright (C) 2005-2006, 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_ARPA_INET_H @@ -49,6 +49,12 @@ #ifndef _@GUARD_PREFIX@_ARPA_INET_H #define _@GUARD_PREFIX@_ARPA_INET_H +/* Get all possible declarations of inet_ntop() and inet_pton(). */ +#if (@GNULIB_INET_NTOP@ || @GNULIB_INET_PTON@ || defined GNULIB_POSIXCHECK) \ + && @HAVE_WS2TCPIP_H@ +# include <ws2tcpip.h> +#endif + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ @@ -70,8 +76,8 @@ the return value is NULL and errno is set to ENOSPC. A good value for CNT is 46. - For more details, see the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/inet_ntop.html>. */ + For more details, see the POSIX:2008 specification + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html>. */ # if @REPLACE_INET_NTOP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef inet_ntop @@ -97,7 +103,9 @@ _GL_CXXALIAS_SYS_CAST (inet_ntop, const char *, (int af, const void *restrict src, char *restrict dst, socklen_t cnt)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (inet_ntop); +# endif #elif defined GNULIB_POSIXCHECK # undef inet_ntop # if HAVE_RAW_DECL_INET_NTOP @@ -126,7 +134,9 @@ _GL_FUNCDECL_SYS (inet_pton, int, _GL_CXXALIAS_SYS (inet_pton, int, (int af, const char *restrict src, void *restrict dst)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (inet_pton); +# endif #elif defined GNULIB_POSIXCHECK # undef inet_pton # if HAVE_RAW_DECL_INET_PTON diff --git a/gnulib/import/assure.h b/gnulib/import/assure.h index de1f665..c21b6a6 100644 --- a/gnulib/import/assure.h +++ b/gnulib/import/assure.h @@ -1,6 +1,6 @@ /* Run-time assert-like macros. - Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copyright (C) 2014-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -23,7 +23,7 @@ #include <assert.h> /* Check E's value at runtime, and report an error and abort if not. - However, do nothng if NDEBUG is defined. + However, do nothing if NDEBUG is defined. Unlike standard 'assert', this macro always compiles E even when NDEBUG is defined, so as to catch typos and avoid some GCC warnings. */ diff --git a/gnulib/import/at-func.c b/gnulib/import/at-func.c index 5a8894a..d2e6319 100644 --- a/gnulib/import/at-func.c +++ b/gnulib/import/at-func.c @@ -1,5 +1,5 @@ /* Define at-style functions like fstatat, unlinkat, fchownat, etc. - Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/gnulib/import/basename-lgpl.c b/gnulib/import/basename-lgpl.c index 1182109..0ae04ee 100644 --- a/gnulib/import/basename-lgpl.c +++ b/gnulib/import/basename-lgpl.c @@ -1,6 +1,6 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/extra/snippet/c++defs.h b/gnulib/import/c++defs.h index d42ea25..87d0716 100644 --- a/gnulib/import/extra/snippet/c++defs.h +++ b/gnulib/import/c++defs.h @@ -1,5 +1,5 @@ /* C++ compatible function declaration macros. - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2019 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 @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _GL_CXXDEFS_H #define _GL_CXXDEFS_H @@ -133,8 +133,11 @@ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ - inline type rpl () const { return ::rpl_func; } \ - inline operator type () const { return rpl (); } \ + \ + inline operator type () const \ + { \ + return ::rpl_func; \ + } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy @@ -155,9 +158,11 @@ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ - inline type rpl () const \ - { return reinterpret_cast<type>(::rpl_func); } \ - inline operator type () const { return rpl (); } \ + \ + inline operator type () const \ + { \ + return reinterpret_cast<type>(::rpl_func); \ + } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy @@ -183,10 +188,13 @@ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ - inline type rpl () const { return ::func; } \ - inline operator type () const { return rpl (); } \ + \ + inline operator type () const \ + { \ + return ::func; \ + } \ } func = {}; \ - } \ + } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ @@ -205,9 +213,11 @@ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ - inline type rpl () const \ - { return reinterpret_cast<type>(::func); } \ - inline operator type () const { return rpl (); }\ + \ + inline operator type () const \ + { \ + return reinterpret_cast<type>(::func); \ + } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy @@ -235,10 +245,10 @@ { \ typedef rettype (*type) parameters; \ \ - inline type rpl () const \ - { return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); }\ - \ - inline operator type () const { return rpl (); } \ + inline operator type () const \ + { \ + return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ + } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy @@ -256,7 +266,7 @@ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) # define _GL_CXXALIASWARN_1(func,namespace) \ _GL_CXXALIASWARN_2 (func, namespace) -/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, +/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, we enable the warning only when not optimizing. */ # if !__OPTIMIZE__ # define _GL_CXXALIASWARN_2(func,namespace) \ @@ -284,7 +294,7 @@ GNULIB_NAMESPACE) # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) -/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, +/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, we enable the warning only when not optimizing. */ # if !__OPTIMIZE__ # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ diff --git a/gnulib/import/canonicalize-lgpl.c b/gnulib/import/canonicalize-lgpl.c index 4b1f6cb..4d1be6d 100644 --- a/gnulib/import/canonicalize-lgpl.c +++ b/gnulib/import/canonicalize-lgpl.c @@ -1,5 +1,5 @@ /* Return the canonical absolute name of a given file. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBC /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc @@ -59,8 +59,10 @@ */ # undef getcwd # endif -# ifdef VMS - /* We want the directory in Unix syntax, not in VMS syntax. */ +# if defined VMS && !defined getcwd + /* We want the directory in Unix syntax, not in VMS syntax. + The gnulib override of 'getcwd' takes 2 arguments; the original VMS + 'getcwd' takes 3 arguments. */ # define __getcwd(buf, max) getcwd (buf, max, 0) # else # define __getcwd getcwd @@ -93,9 +95,9 @@ static void alloc_failed (void) { -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ /* Avoid errno problem without using the malloc or realloc modules; see: - http://lists.gnu.org/archive/html/bug-gnulib/2016-08/msg00025.html */ + https://lists.gnu.org/r/bug-gnulib/2016-08/msg00025.html */ errno = ENOMEM; #endif } @@ -268,6 +270,8 @@ __realpath (const char *name, char *resolved) #endif *dest = '\0'; + /* FIXME: if lstat fails with errno == EOVERFLOW, + the entry exists. */ #ifdef _LIBC if (__lxstat64 (_STAT_VER, rpath, &st) < 0) #else diff --git a/gnulib/import/cdefs.h b/gnulib/import/cdefs.h new file mode 100644 index 0000000..96d2616 --- /dev/null +++ b/gnulib/import/cdefs.h @@ -0,0 +1,514 @@ +/* Copyright (C) 1992-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _SYS_CDEFS_H +#define _SYS_CDEFS_H 1 + +/* We are almost always included from features.h. */ +#ifndef _FEATURES_H +# include <features.h> +#endif + +/* The GNU libc does not support any K&R compilers or the traditional mode + of ISO C compilers anymore. Check for some of the combinations not + anymore supported. */ +#if defined __GNUC__ && !defined __STDC__ +# error "You need a ISO C conforming compiler to use the glibc headers" +#endif + +/* Some user header file might have defined this before. */ +#undef __P +#undef __PMT + +#ifdef __GNUC__ + +/* All functions, except those with callbacks or those that + synchronize memory, are leaf functions. */ +# if __GNUC_PREREQ (4, 6) && !defined _LIBC +# define __LEAF , __leaf__ +# define __LEAF_ATTR __attribute__ ((__leaf__)) +# else +# define __LEAF +# define __LEAF_ATTR +# endif + +/* GCC can always grok prototypes. For C++ programs we add throw() + to help it optimize the function calls. But this works only with + gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions + as non-throwing using a function attribute since programs can use + the -fexceptions options for C code as well. */ +# if !defined __cplusplus && __GNUC_PREREQ (3, 3) +# define __THROW __attribute__ ((__nothrow__ __LEAF)) +# define __THROWNL __attribute__ ((__nothrow__)) +# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct +# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct +# else +# if defined __cplusplus && __GNUC_PREREQ (2,8) +# define __THROW throw () +# define __THROWNL throw () +# define __NTH(fct) __LEAF_ATTR fct throw () +# define __NTHNL(fct) fct throw () +# else +# define __THROW +# define __THROWNL +# define __NTH(fct) fct +# define __NTHNL(fct) fct +# endif +# endif + +#else /* Not GCC. */ + +# if (defined __cplusplus \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) +# define __inline inline +# else +# define __inline /* No inline functions. */ +# endif + +# define __THROW +# define __THROWNL +# define __NTH(fct) fct + +#endif /* GCC. */ + +/* Compilers that are not clang may object to + #if defined __clang__ && __has_extension(...) + even though they do not need to evaluate the right-hand side of the &&. */ +#if defined __clang__ && defined __has_extension +# define __glibc_clang_has_extension(ext) __has_extension (ext) +#else +# define __glibc_clang_has_extension(ext) 0 +#endif + +/* These two macros are not used in glibc anymore. They are kept here + only because some other projects expect the macros to be defined. */ +#define __P(args) args +#define __PMT(args) args + +/* For these things, GCC behaves the ANSI way normally, + and the non-ANSI way under -traditional. */ + +#define __CONCAT(x,y) x ## y +#define __STRING(x) #x + +/* This is not a typedef so `const __ptr_t' does the right thing. */ +#define __ptr_t void * + + +/* C++ needs to know that types and declarations are C, not C++. */ +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS +# define __END_DECLS +#endif + + +/* Fortify support. */ +#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) +#define __bos0(ptr) __builtin_object_size (ptr, 0) + +#if __GNUC_PREREQ (4,3) +# define __warndecl(name, msg) \ + extern void name (void) __attribute__((__warning__ (msg))) +# define __warnattr(msg) __attribute__((__warning__ (msg))) +# define __errordecl(name, msg) \ + extern void name (void) __attribute__((__error__ (msg))) +#else +# define __warndecl(name, msg) extern void name (void) +# define __warnattr(msg) +# define __errordecl(name, msg) extern void name (void) +#endif + +/* Support for flexible arrays. + Headers that should use flexible arrays only if they're "real" + (e.g. only if they won't affect sizeof()) should test + #if __glibc_c99_flexarr_available. */ +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc +# define __flexarr [] +# define __glibc_c99_flexarr_available 1 +#elif __GNUC_PREREQ (2,97) +/* GCC 2.97 supports C99 flexible array members as an extension, + even when in C89 mode or compiling C++ (any version). */ +# define __flexarr [] +# define __glibc_c99_flexarr_available 1 +#elif defined __GNUC__ +/* Pre-2.97 GCC did not support C99 flexible arrays but did have + an equivalent extension with slightly different notation. */ +# define __flexarr [0] +# define __glibc_c99_flexarr_available 1 +#else +/* Some other non-C99 compiler. Approximate with [1]. */ +# define __flexarr [1] +# define __glibc_c99_flexarr_available 0 +#endif + + +/* __asm__ ("xyz") is used throughout the headers to rename functions + at the assembly language level. This is wrapped by the __REDIRECT + macro, in order to support compilers that can do this some other + way. When compilers don't support asm-names at all, we have to do + preprocessor tricks instead (which don't have exactly the right + semantics, but it's the best we can do). + + Example: + int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ + +#if defined __GNUC__ && __GNUC__ >= 2 + +# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) +# ifdef __cplusplus +# define __REDIRECT_NTH(name, proto, alias) \ + name proto __THROW __asm__ (__ASMNAME (#alias)) +# define __REDIRECT_NTHNL(name, proto, alias) \ + name proto __THROWNL __asm__ (__ASMNAME (#alias)) +# else +# define __REDIRECT_NTH(name, proto, alias) \ + name proto __asm__ (__ASMNAME (#alias)) __THROW +# define __REDIRECT_NTHNL(name, proto, alias) \ + name proto __asm__ (__ASMNAME (#alias)) __THROWNL +# endif +# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) +# define __ASMNAME2(prefix, cname) __STRING (prefix) cname + +/* +#elif __SOME_OTHER_COMPILER__ + +# define __REDIRECT(name, proto, alias) name proto; \ + _Pragma("let " #name " = " #alias) +*/ +#endif + +/* GCC has various useful declarations that can be made with the + `__attribute__' syntax. All of the ways we use this do fine if + they are omitted for compilers that don't understand it. */ +#if !defined __GNUC__ || __GNUC__ < 2 +# define __attribute__(xyz) /* Ignore */ +#endif + +/* At some point during the gcc 2.96 development the `malloc' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (2,96) +# define __attribute_malloc__ __attribute__ ((__malloc__)) +#else +# define __attribute_malloc__ /* Ignore */ +#endif + +/* Tell the compiler which arguments to an allocation function + indicate the size of the allocation. */ +#if __GNUC_PREREQ (4, 3) +# define __attribute_alloc_size__(params) \ + __attribute__ ((__alloc_size__ params)) +#else +# define __attribute_alloc_size__(params) /* Ignore. */ +#endif + +/* At some point during the gcc 2.96 development the `pure' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (2,96) +# define __attribute_pure__ __attribute__ ((__pure__)) +#else +# define __attribute_pure__ /* Ignore */ +#endif + +/* This declaration tells the compiler that the value is constant. */ +#if __GNUC_PREREQ (2,5) +# define __attribute_const__ __attribute__ ((__const__)) +#else +# define __attribute_const__ /* Ignore */ +#endif + +/* At some point during the gcc 3.1 development the `used' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (3,1) +# define __attribute_used__ __attribute__ ((__used__)) +# define __attribute_noinline__ __attribute__ ((__noinline__)) +#else +# define __attribute_used__ __attribute__ ((__unused__)) +# define __attribute_noinline__ /* Ignore */ +#endif + +/* Since version 3.2, gcc allows marking deprecated functions. */ +#if __GNUC_PREREQ (3,2) +# define __attribute_deprecated__ __attribute__ ((__deprecated__)) +#else +# define __attribute_deprecated__ /* Ignore */ +#endif + +/* Since version 4.5, gcc also allows one to specify the message printed + when a deprecated function is used. clang claims to be gcc 4.2, but + may also support this feature. */ +#if __GNUC_PREREQ (4,5) || \ + __glibc_clang_has_extension (__attribute_deprecated_with_message__) +# define __attribute_deprecated_msg__(msg) \ + __attribute__ ((__deprecated__ (msg))) +#else +# define __attribute_deprecated_msg__(msg) __attribute_deprecated__ +#endif + +/* At some point during the gcc 2.8 development the `format_arg' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. + If several `format_arg' attributes are given for the same function, in + gcc-3.0 and older, all but the last one are ignored. In newer gccs, + all designated arguments are considered. */ +#if __GNUC_PREREQ (2,8) +# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) +#else +# define __attribute_format_arg__(x) /* Ignore */ +#endif + +/* At some point during the gcc 2.97 development the `strfmon' format + attribute for functions was introduced. We don't want to use it + unconditionally (although this would be possible) since it + generates warnings. */ +#if __GNUC_PREREQ (2,97) +# define __attribute_format_strfmon__(a,b) \ + __attribute__ ((__format__ (__strfmon__, a, b))) +#else +# define __attribute_format_strfmon__(a,b) /* Ignore */ +#endif + +/* The nonnull function attribute marks pointer parameters that + must not be NULL. Do not define __nonnull if it is already defined, + for portability when this file is used in Gnulib. */ +#ifndef __nonnull +# if __GNUC_PREREQ (3,3) +# define __nonnull(params) __attribute__ ((__nonnull__ params)) +# else +# define __nonnull(params) +# endif +#endif + +/* If fortification mode, we warn about unused results of certain + function calls which can lead to problems. */ +#if __GNUC_PREREQ (3,4) +# define __attribute_warn_unused_result__ \ + __attribute__ ((__warn_unused_result__)) +# if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0 +# define __wur __attribute_warn_unused_result__ +# endif +#else +# define __attribute_warn_unused_result__ /* empty */ +#endif +#ifndef __wur +# define __wur /* Ignore */ +#endif + +/* Forces a function to be always inlined. */ +#if __GNUC_PREREQ (3,2) +/* The Linux kernel defines __always_inline in stddef.h (283d7573), and + it conflicts with this definition. Therefore undefine it first to + allow either header to be included first. */ +# undef __always_inline +# define __always_inline __inline __attribute__ ((__always_inline__)) +#else +# undef __always_inline +# define __always_inline __inline +#endif + +/* Associate error messages with the source location of the call site rather + than with the source location inside the function. */ +#if __GNUC_PREREQ (4,3) +# define __attribute_artificial__ __attribute__ ((__artificial__)) +#else +# define __attribute_artificial__ /* Ignore */ +#endif + +/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 + inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__ + or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions + older than 4.3 may define these macros and still not guarantee GNU inlining + semantics. + + clang++ identifies itself as gcc-4.2, but has support for GNU inlining + semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and + __GNUC_GNU_INLINE__ macro definitions. */ +#if (!defined __cplusplus || __GNUC_PREREQ (4,3) \ + || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \ + || defined __GNUC_GNU_INLINE__))) +# if defined __GNUC_STDC_INLINE__ || defined __cplusplus +# define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) +# define __extern_always_inline \ + extern __always_inline __attribute__ ((__gnu_inline__)) +# else +# define __extern_inline extern __inline +# define __extern_always_inline extern __always_inline +# endif +#endif + +#ifdef __extern_always_inline +# define __fortify_function __extern_always_inline __attribute_artificial__ +#endif + +/* GCC 4.3 and above allow passing all anonymous arguments of an + __extern_always_inline function to some other vararg function. */ +#if __GNUC_PREREQ (4,3) +# define __va_arg_pack() __builtin_va_arg_pack () +# define __va_arg_pack_len() __builtin_va_arg_pack_len () +#endif + +/* It is possible to compile containing GCC extensions even if GCC is + run in pedantic mode if the uses are carefully marked using the + `__extension__' keyword. But this is not generally available before + version 2.8. */ +#if !__GNUC_PREREQ (2,8) +# define __extension__ /* Ignore */ +#endif + +/* __restrict is known in EGCS 1.2 and above. */ +#if !__GNUC_PREREQ (2,92) +# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +# define __restrict restrict +# else +# define __restrict /* Ignore */ +# endif +#endif + +/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is + array_name[restrict] + GCC 3.1 supports this. */ +#if __GNUC_PREREQ (3,1) && !defined __GNUG__ +# define __restrict_arr __restrict +#else +# ifdef __GNUC__ +# define __restrict_arr /* Not supported in old GCC. */ +# else +# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +# define __restrict_arr restrict +# else +/* Some other non-C99 compiler. */ +# define __restrict_arr /* Not supported. */ +# endif +# endif +#endif + +#if __GNUC__ >= 3 +# define __glibc_unlikely(cond) __builtin_expect ((cond), 0) +# define __glibc_likely(cond) __builtin_expect ((cond), 1) +#else +# define __glibc_unlikely(cond) (cond) +# define __glibc_likely(cond) (cond) +#endif + +#ifdef __has_attribute +# define __glibc_has_attribute(attr) __has_attribute (attr) +#else +# define __glibc_has_attribute(attr) 0 +#endif + +#if (!defined _Noreturn \ + && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ + && !__GNUC_PREREQ (4,7)) +# if __GNUC_PREREQ (2,8) +# define _Noreturn __attribute__ ((__noreturn__)) +# else +# define _Noreturn +# endif +#endif + +#if __GNUC_PREREQ (8, 0) +/* Describes a char array whose address can safely be passed as the first + argument to strncpy and strncat, as the char array is not necessarily + a NUL-terminated string. */ +# define __attribute_nonstring__ __attribute__ ((__nonstring__)) +#else +# define __attribute_nonstring__ +#endif + +#if (!defined _Static_assert && !defined __cplusplus \ + && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ + && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__)) +# define _Static_assert(expr, diagnostic) \ + extern int (*__Static_assert_function (void)) \ + [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] +#endif + +/* The #ifndef lets Gnulib avoid including these on non-glibc + platforms, where the includes typically do not exist. */ +#ifndef __WORDSIZE +# include <bits/wordsize.h> +# include <bits/long-double.h> +#endif + +#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH +# define __LDBL_COMPAT 1 +# ifdef __REDIRECT +# define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) +# define __LDBL_REDIR(name, proto) \ + __LDBL_REDIR1 (name, proto, __nldbl_##name) +# define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) +# define __LDBL_REDIR_NTH(name, proto) \ + __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) +# define __LDBL_REDIR1_DECL(name, alias) \ + extern __typeof (name) name __asm (__ASMNAME (#alias)); +# define __LDBL_REDIR_DECL(name) \ + extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name)); +# define __REDIRECT_LDBL(name, proto, alias) \ + __LDBL_REDIR1 (name, proto, __nldbl_##alias) +# define __REDIRECT_NTH_LDBL(name, proto, alias) \ + __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) +# endif +#endif +#if !defined __LDBL_COMPAT || !defined __REDIRECT +# define __LDBL_REDIR1(name, proto, alias) name proto +# define __LDBL_REDIR(name, proto) name proto +# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW +# define __LDBL_REDIR_NTH(name, proto) name proto __THROW +# define __LDBL_REDIR_DECL(name) +# ifdef __REDIRECT +# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) +# define __REDIRECT_NTH_LDBL(name, proto, alias) \ + __REDIRECT_NTH (name, proto, alias) +# endif +#endif + +/* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is + intended for use in preprocessor macros. + + Note: MESSAGE must be a _single_ string; concatenation of string + literals is not supported. */ +#if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5) +# define __glibc_macro_warning1(message) _Pragma (#message) +# define __glibc_macro_warning(message) \ + __glibc_macro_warning1 (GCC warning message) +#else +# define __glibc_macro_warning(msg) +#endif + +/* Generic selection (ISO C11) is a C-only feature, available in GCC + since version 4.9. Previous versions do not provide generic + selection, even though they might set __STDC_VERSION__ to 201112L, + when in -std=c11 mode. Thus, we must check for !defined __GNUC__ + when testing __STDC_VERSION__ for generic selection support. + On the other hand, Clang also defines __GNUC__, so a clang-specific + check is required to enable the use of generic selection. */ +#if !defined __cplusplus \ + && (__GNUC_PREREQ (4, 9) \ + || __glibc_clang_has_extension (c_generic_selections) \ + || (!defined __GNUC__ && defined __STDC_VERSION__ \ + && __STDC_VERSION__ >= 201112L)) +# define __HAVE_GENERIC_SELECTION 1 +#else +# define __HAVE_GENERIC_SELECTION 0 +#endif + +#endif /* sys/cdefs.h */ diff --git a/gnulib/import/chdir-long.c b/gnulib/import/chdir-long.c index 5a039ce..febdf59 100644 --- a/gnulib/import/chdir-long.c +++ b/gnulib/import/chdir-long.c @@ -1,5 +1,5 @@ /* provide a chdir function that tries not to fail due to ENAMETOOLONG - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/gnulib/import/chdir-long.h b/gnulib/import/chdir-long.h index 614b6cf..43259d1 100644 --- a/gnulib/import/chdir-long.h +++ b/gnulib/import/chdir-long.h @@ -1,5 +1,5 @@ /* provide a chdir function that tries not to fail due to ENAMETOOLONG - Copyright (C) 2004-2005, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2005, 2009-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff --git a/gnulib/import/cloexec.c b/gnulib/import/cloexec.c index 1202836..db42576 100644 --- a/gnulib/import/cloexec.c +++ b/gnulib/import/cloexec.c @@ -1,6 +1,6 @@ -/* closexec.c - set or clear the close-on-exec descriptor flag +/* cloexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 1991, 2004-2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 1991, 2004-2006, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. The code is taken from glibc/manual/llio.texi */ diff --git a/gnulib/import/cloexec.h b/gnulib/import/cloexec.h index 0e58437..06ad945 100644 --- a/gnulib/import/cloexec.h +++ b/gnulib/import/cloexec.h @@ -1,6 +1,6 @@ -/* closexec.c - set or clear the close-on-exec descriptor flag +/* cloexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 2004, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2004, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. */ diff --git a/gnulib/import/close.c b/gnulib/import/close.c index 46a7aa5..40ce845 100644 --- a/gnulib/import/close.c +++ b/gnulib/import/close.c @@ -1,5 +1,5 @@ /* close replacement. - Copyright (C) 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2008-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -22,7 +22,9 @@ #include <errno.h> #include "fd-hook.h" -#include "msvc-inval.h" +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +#endif #undef close diff --git a/gnulib/import/closedir.c b/gnulib/import/closedir.c index 30d1290..017fb68 100644 --- a/gnulib/import/closedir.c +++ b/gnulib/import/closedir.c @@ -1,5 +1,5 @@ /* Stop reading the entries of a directory. - Copyright (C) 2006-2016 Free Software Foundation, Inc. + Copyright (C) 2006-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/config.charset b/gnulib/import/config.charset deleted file mode 100644 index 947d916..0000000 --- a/gnulib/import/config.charset +++ /dev/null @@ -1,682 +0,0 @@ -#! /bin/sh -# Output a system dependent table of character encoding aliases. -# -# Copyright (C) 2000-2004, 2006-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 <http://www.gnu.org/licenses/>. -# -# The table consists of lines of the form -# ALIAS CANONICAL -# -# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)". -# ALIAS is compared in a case sensitive way. -# -# CANONICAL is the GNU canonical name for this character encoding. -# It must be an encoding supported by libiconv. Support by GNU libc is -# also desirable. CANONICAL is case insensitive. Usually an upper case -# MIME charset name is preferred. -# The current list of GNU canonical charset names is as follows. -# -# name MIME? used by which systems -# (darwin = Mac OS X, woe32 = native Windows) -# -# ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin cygwin -# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin -# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin -# ISO-8859-3 Y glibc solaris cygwin -# ISO-8859-4 Y osf solaris freebsd netbsd openbsd darwin -# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin -# ISO-8859-6 Y glibc aix hpux solaris cygwin -# ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd openbsd darwin cygwin -# ISO-8859-8 Y glibc aix hpux osf solaris cygwin -# ISO-8859-9 Y glibc aix hpux irix osf solaris darwin cygwin -# ISO-8859-13 glibc netbsd openbsd darwin cygwin -# ISO-8859-14 glibc cygwin -# ISO-8859-15 glibc aix osf solaris freebsd netbsd openbsd darwin cygwin -# KOI8-R Y glibc solaris freebsd netbsd openbsd darwin -# KOI8-U Y glibc freebsd netbsd openbsd darwin cygwin -# KOI8-T glibc -# CP437 dos -# CP775 dos -# CP850 aix osf dos -# CP852 dos -# CP855 dos -# CP856 aix -# CP857 dos -# CP861 dos -# CP862 dos -# CP864 dos -# CP865 dos -# CP866 freebsd netbsd openbsd darwin dos -# CP869 dos -# CP874 woe32 dos -# CP922 aix -# CP932 aix cygwin woe32 dos -# CP943 aix -# CP949 osf darwin woe32 dos -# CP950 woe32 dos -# CP1046 aix -# CP1124 aix -# CP1125 dos -# CP1129 aix -# CP1131 darwin -# CP1250 woe32 -# CP1251 glibc solaris netbsd openbsd darwin cygwin woe32 -# CP1252 aix woe32 -# CP1253 woe32 -# CP1254 woe32 -# CP1255 glibc woe32 -# CP1256 woe32 -# CP1257 woe32 -# GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin -# EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin -# EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin -# EUC-TW glibc aix hpux irix osf solaris netbsd -# BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin cygwin -# BIG5-HKSCS glibc solaris darwin -# GBK glibc aix osf solaris darwin cygwin woe32 dos -# GB18030 glibc solaris netbsd darwin -# SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin -# JOHAB glibc solaris woe32 -# TIS-620 glibc aix hpux osf solaris cygwin -# VISCII Y glibc -# TCVN5712-1 glibc -# ARMSCII-8 glibc darwin -# GEORGIAN-PS glibc cygwin -# PT154 glibc -# HP-ROMAN8 hpux -# HP-ARABIC8 hpux -# HP-GREEK8 hpux -# HP-HEBREW8 hpux -# HP-TURKISH8 hpux -# HP-KANA8 hpux -# DEC-KANJI osf -# DEC-HANYU osf -# UTF-8 Y glibc aix hpux osf solaris netbsd darwin cygwin -# -# Note: Names which are not marked as being a MIME name should not be used in -# Internet protocols for information interchange (mail, news, etc.). -# -# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications -# must understand both names and treat them as equivalent. -# -# The first argument passed to this file is the canonical host specification, -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM - -host="$1" -os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'` -echo "# This file contains a table of character encoding aliases," -echo "# suitable for operating system '${os}'." -echo "# It was automatically generated from config.charset." -# List of references, updated during installation: -echo "# Packages using this file: " -case "$os" in - linux-gnulibc1*) - # Linux libc5 doesn't have nl_langinfo(CODESET); therefore - # localcharset.c falls back to using the full locale name - # from the environment variables. - echo "C ASCII" - echo "POSIX ASCII" - for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \ - en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \ - en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \ - es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \ - et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \ - fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \ - it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \ - sv_FI sv_SE; do - echo "$l ISO-8859-1" - echo "$l.iso-8859-1 ISO-8859-1" - echo "$l.iso-8859-15 ISO-8859-15" - echo "$l.iso-8859-15@euro ISO-8859-15" - echo "$l@euro ISO-8859-15" - echo "$l.cp-437 CP437" - echo "$l.cp-850 CP850" - echo "$l.cp-1252 CP1252" - echo "$l.cp-1252@euro CP1252" - #echo "$l.atari-st ATARI-ST" # not a commonly used encoding - echo "$l.utf-8 UTF-8" - echo "$l.utf-8@euro UTF-8" - done - for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \ - sl_SI sr sr_CS sr_YU; do - echo "$l ISO-8859-2" - echo "$l.iso-8859-2 ISO-8859-2" - echo "$l.cp-852 CP852" - echo "$l.cp-1250 CP1250" - echo "$l.utf-8 UTF-8" - done - for l in mk mk_MK ru ru_RU; do - echo "$l ISO-8859-5" - echo "$l.iso-8859-5 ISO-8859-5" - echo "$l.koi8-r KOI8-R" - echo "$l.cp-866 CP866" - echo "$l.cp-1251 CP1251" - echo "$l.utf-8 UTF-8" - done - for l in ar ar_SA; do - echo "$l ISO-8859-6" - echo "$l.iso-8859-6 ISO-8859-6" - echo "$l.cp-864 CP864" - #echo "$l.cp-868 CP868" # not a commonly used encoding - echo "$l.cp-1256 CP1256" - echo "$l.utf-8 UTF-8" - done - for l in el el_GR gr gr_GR; do - echo "$l ISO-8859-7" - echo "$l.iso-8859-7 ISO-8859-7" - echo "$l.cp-869 CP869" - echo "$l.cp-1253 CP1253" - echo "$l.cp-1253@euro CP1253" - echo "$l.utf-8 UTF-8" - echo "$l.utf-8@euro UTF-8" - done - for l in he he_IL iw iw_IL; do - echo "$l ISO-8859-8" - echo "$l.iso-8859-8 ISO-8859-8" - echo "$l.cp-862 CP862" - echo "$l.cp-1255 CP1255" - echo "$l.utf-8 UTF-8" - done - for l in tr tr_TR; do - echo "$l ISO-8859-9" - echo "$l.iso-8859-9 ISO-8859-9" - echo "$l.cp-857 CP857" - echo "$l.cp-1254 CP1254" - echo "$l.utf-8 UTF-8" - done - for l in lt lt_LT lv lv_LV; do - #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name - echo "$l ISO-8859-13" - done - for l in ru_UA uk uk_UA; do - echo "$l KOI8-U" - done - for l in zh zh_CN; do - #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name - echo "$l GB2312" - done - for l in ja ja_JP ja_JP.EUC; do - echo "$l EUC-JP" - done - for l in ko ko_KR; do - echo "$l EUC-KR" - done - for l in th th_TH; do - echo "$l TIS-620" - done - for l in fa fa_IR; do - #echo "$l ISIRI-3342" # a broken encoding - echo "$l.utf-8 UTF-8" - done - ;; - linux* | *-gnu*) - # With glibc-2.1 or newer, we don't need any canonicalization, - # because glibc has iconv and both glibc and libiconv support all - # GNU canonical names directly. Therefore, the Makefile does not - # need to install the alias file at all. - # The following applies only to glibc-2.0.x and older libcs. - echo "ISO_646.IRV:1983 ASCII" - ;; - aix*) - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-6 ISO-8859-6" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-8 ISO-8859-8" - echo "ISO8859-9 ISO-8859-9" - echo "ISO8859-15 ISO-8859-15" - echo "IBM-850 CP850" - echo "IBM-856 CP856" - echo "IBM-921 ISO-8859-13" - echo "IBM-922 CP922" - echo "IBM-932 CP932" - echo "IBM-943 CP943" - echo "IBM-1046 CP1046" - echo "IBM-1124 CP1124" - echo "IBM-1129 CP1129" - echo "IBM-1252 CP1252" - echo "IBM-eucCN GB2312" - echo "IBM-eucJP EUC-JP" - echo "IBM-eucKR EUC-KR" - echo "IBM-eucTW EUC-TW" - echo "big5 BIG5" - echo "GBK GBK" - echo "TIS-620 TIS-620" - echo "UTF-8 UTF-8" - ;; - hpux*) - echo "iso88591 ISO-8859-1" - echo "iso88592 ISO-8859-2" - echo "iso88595 ISO-8859-5" - echo "iso88596 ISO-8859-6" - echo "iso88597 ISO-8859-7" - echo "iso88598 ISO-8859-8" - echo "iso88599 ISO-8859-9" - echo "iso885915 ISO-8859-15" - echo "roman8 HP-ROMAN8" - echo "arabic8 HP-ARABIC8" - echo "greek8 HP-GREEK8" - echo "hebrew8 HP-HEBREW8" - echo "turkish8 HP-TURKISH8" - echo "kana8 HP-KANA8" - echo "tis620 TIS-620" - echo "big5 BIG5" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "eucTW EUC-TW" - echo "hp15CN GB2312" - #echo "ccdc ?" # what is this? - echo "SJIS SHIFT_JIS" - echo "utf8 UTF-8" - ;; - irix*) - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-9 ISO-8859-9" - echo "eucCN GB2312" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "eucTW EUC-TW" - ;; - osf*) - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-4 ISO-8859-4" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-8 ISO-8859-8" - echo "ISO8859-9 ISO-8859-9" - echo "ISO8859-15 ISO-8859-15" - echo "cp850 CP850" - echo "big5 BIG5" - echo "dechanyu DEC-HANYU" - echo "dechanzi GB2312" - echo "deckanji DEC-KANJI" - echo "deckorean EUC-KR" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "eucTW EUC-TW" - echo "GBK GBK" - echo "KSC5601 CP949" - echo "sdeckanji EUC-JP" - echo "SJIS SHIFT_JIS" - echo "TACTIS TIS-620" - echo "UTF-8 UTF-8" - ;; - solaris*) - echo "646 ASCII" - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-3 ISO-8859-3" - echo "ISO8859-4 ISO-8859-4" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-6 ISO-8859-6" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-8 ISO-8859-8" - echo "ISO8859-9 ISO-8859-9" - echo "ISO8859-15 ISO-8859-15" - echo "koi8-r KOI8-R" - echo "ansi-1251 CP1251" - echo "BIG5 BIG5" - echo "Big5-HKSCS BIG5-HKSCS" - echo "gb2312 GB2312" - echo "GBK GBK" - echo "GB18030 GB18030" - echo "cns11643 EUC-TW" - echo "5601 EUC-KR" - echo "ko_KR.johap92 JOHAB" - echo "eucJP EUC-JP" - echo "PCK SHIFT_JIS" - echo "TIS620.2533 TIS-620" - #echo "sun_eu_greek ?" # what is this? - echo "UTF-8 UTF-8" - ;; - freebsd*) - # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore - # localcharset.c falls back to using the full locale name - # from the environment variables. - echo "C ASCII" - echo "US-ASCII ASCII" - for l in la_LN lt_LN; do - echo "$l.ASCII ASCII" - done - for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ - fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \ - lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do - echo "$l.ISO_8859-1 ISO-8859-1" - echo "$l.DIS_8859-15 ISO-8859-15" - done - for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do - echo "$l.ISO_8859-2 ISO-8859-2" - done - for l in la_LN lt_LT; do - echo "$l.ISO_8859-4 ISO-8859-4" - done - for l in ru_RU ru_SU; do - echo "$l.KOI8-R KOI8-R" - echo "$l.ISO_8859-5 ISO-8859-5" - echo "$l.CP866 CP866" - done - echo "uk_UA.KOI8-U KOI8-U" - echo "zh_TW.BIG5 BIG5" - echo "zh_TW.Big5 BIG5" - echo "zh_CN.EUC GB2312" - echo "ja_JP.EUC EUC-JP" - echo "ja_JP.SJIS SHIFT_JIS" - echo "ja_JP.Shift_JIS SHIFT_JIS" - echo "ko_KR.EUC EUC-KR" - ;; - netbsd*) - echo "646 ASCII" - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-4 ISO-8859-4" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-13 ISO-8859-13" - echo "ISO8859-15 ISO-8859-15" - echo "eucCN GB2312" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "eucTW EUC-TW" - echo "BIG5 BIG5" - echo "SJIS SHIFT_JIS" - ;; - openbsd*) - echo "646 ASCII" - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-4 ISO-8859-4" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-13 ISO-8859-13" - echo "ISO8859-15 ISO-8859-15" - ;; - darwin[56]*) - # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore - # localcharset.c falls back to using the full locale name - # from the environment variables. - echo "C ASCII" - for l in en_AU en_CA en_GB en_US la_LN; do - echo "$l.US-ASCII ASCII" - done - for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ - fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \ - nl_NL no_NO pt_PT sv_SE; do - echo "$l ISO-8859-1" - echo "$l.ISO8859-1 ISO-8859-1" - echo "$l.ISO8859-15 ISO-8859-15" - done - for l in la_LN; do - echo "$l.ISO8859-1 ISO-8859-1" - echo "$l.ISO8859-15 ISO-8859-15" - done - for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do - echo "$l.ISO8859-2 ISO-8859-2" - done - for l in la_LN lt_LT; do - echo "$l.ISO8859-4 ISO-8859-4" - done - for l in ru_RU; do - echo "$l.KOI8-R KOI8-R" - echo "$l.ISO8859-5 ISO-8859-5" - echo "$l.CP866 CP866" - done - for l in bg_BG; do - echo "$l.CP1251 CP1251" - done - echo "uk_UA.KOI8-U KOI8-U" - echo "zh_TW.BIG5 BIG5" - echo "zh_TW.Big5 BIG5" - echo "zh_CN.EUC GB2312" - echo "ja_JP.EUC EUC-JP" - echo "ja_JP.SJIS SHIFT_JIS" - echo "ko_KR.EUC EUC-KR" - ;; - darwin*) - # Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is - # useless: - # - It returns the empty string when LANG is set to a locale of the - # form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8 - # LC_CTYPE file. - # - The environment variables LANG, LC_CTYPE, LC_ALL are not set by - # the system; nl_langinfo(CODESET) returns "US-ASCII" in this case. - # - The documentation says: - # "... all code that calls BSD system routines should ensure - # that the const *char parameters of these routines are in UTF-8 - # encoding. All BSD system functions expect their string - # parameters to be in UTF-8 encoding and nothing else." - # It also says - # "An additional caveat is that string parameters for files, - # paths, and other file-system entities must be in canonical - # UTF-8. In a canonical UTF-8 Unicode string, all decomposable - # characters are decomposed ..." - # but this is not true: You can pass non-decomposed UTF-8 strings - # to file system functions, and it is the OS which will convert - # them to decomposed UTF-8 before accessing the file system. - # - The Apple Terminal application displays UTF-8 by default. - # - However, other applications are free to use different encodings: - # - xterm uses ISO-8859-1 by default. - # - TextEdit uses MacRoman by default. - # We prefer UTF-8 over decomposed UTF-8-MAC because one should - # minimize the use of decomposed Unicode. Unfortunately, through the - # Darwin file system, decomposed UTF-8 strings are leaked into user - # space nevertheless. - # Then there are also the locales with encodings other than US-ASCII - # and UTF-8. These locales can be occasionally useful to users (e.g. - # when grepping through ISO-8859-1 encoded text files), when all their - # file names are in US-ASCII. - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-4 ISO-8859-4" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-9 ISO-8859-9" - echo "ISO8859-13 ISO-8859-13" - echo "ISO8859-15 ISO-8859-15" - echo "KOI8-R KOI8-R" - echo "KOI8-U KOI8-U" - echo "CP866 CP866" - echo "CP949 CP949" - echo "CP1131 CP1131" - echo "CP1251 CP1251" - echo "eucCN GB2312" - echo "GB2312 GB2312" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "Big5 BIG5" - echo "Big5HKSCS BIG5-HKSCS" - echo "GBK GBK" - echo "GB18030 GB18030" - echo "SJIS SHIFT_JIS" - echo "ARMSCII-8 ARMSCII-8" - echo "PT154 PT154" - #echo "ISCII-DEV ?" - echo "* UTF-8" - ;; - beos* | haiku*) - # BeOS and Haiku have a single locale, and it has UTF-8 encoding. - echo "* UTF-8" - ;; - msdosdjgpp*) - # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore - # localcharset.c falls back to using the full locale name - # from the environment variables. - echo "#" - echo "# The encodings given here may not all be correct." - echo "# If you find that the encoding given for your language and" - echo "# country is not the one your DOS machine actually uses, just" - echo "# correct it in this file, and send a mail to" - echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>" - echo "# and Bruno Haible <bruno@clisp.org>." - echo "#" - echo "C ASCII" - # ISO-8859-1 languages - echo "ca CP850" - echo "ca_ES CP850" - echo "da CP865" # not CP850 ?? - echo "da_DK CP865" # not CP850 ?? - echo "de CP850" - echo "de_AT CP850" - echo "de_CH CP850" - echo "de_DE CP850" - echo "en CP850" - echo "en_AU CP850" # not CP437 ?? - echo "en_CA CP850" - echo "en_GB CP850" - echo "en_NZ CP437" - echo "en_US CP437" - echo "en_ZA CP850" # not CP437 ?? - echo "es CP850" - echo "es_AR CP850" - echo "es_BO CP850" - echo "es_CL CP850" - echo "es_CO CP850" - echo "es_CR CP850" - echo "es_CU CP850" - echo "es_DO CP850" - echo "es_EC CP850" - echo "es_ES CP850" - echo "es_GT CP850" - echo "es_HN CP850" - echo "es_MX CP850" - echo "es_NI CP850" - echo "es_PA CP850" - echo "es_PY CP850" - echo "es_PE CP850" - echo "es_SV CP850" - echo "es_UY CP850" - echo "es_VE CP850" - echo "et CP850" - echo "et_EE CP850" - echo "eu CP850" - echo "eu_ES CP850" - echo "fi CP850" - echo "fi_FI CP850" - echo "fr CP850" - echo "fr_BE CP850" - echo "fr_CA CP850" - echo "fr_CH CP850" - echo "fr_FR CP850" - echo "ga CP850" - echo "ga_IE CP850" - echo "gd CP850" - echo "gd_GB CP850" - echo "gl CP850" - echo "gl_ES CP850" - echo "id CP850" # not CP437 ?? - echo "id_ID CP850" # not CP437 ?? - echo "is CP861" # not CP850 ?? - echo "is_IS CP861" # not CP850 ?? - echo "it CP850" - echo "it_CH CP850" - echo "it_IT CP850" - echo "lt CP775" - echo "lt_LT CP775" - echo "lv CP775" - echo "lv_LV CP775" - echo "nb CP865" # not CP850 ?? - echo "nb_NO CP865" # not CP850 ?? - echo "nl CP850" - echo "nl_BE CP850" - echo "nl_NL CP850" - echo "nn CP865" # not CP850 ?? - echo "nn_NO CP865" # not CP850 ?? - echo "no CP865" # not CP850 ?? - echo "no_NO CP865" # not CP850 ?? - echo "pt CP850" - echo "pt_BR CP850" - echo "pt_PT CP850" - echo "sv CP850" - echo "sv_SE CP850" - # ISO-8859-2 languages - echo "cs CP852" - echo "cs_CZ CP852" - echo "hr CP852" - echo "hr_HR CP852" - echo "hu CP852" - echo "hu_HU CP852" - echo "pl CP852" - echo "pl_PL CP852" - echo "ro CP852" - echo "ro_RO CP852" - echo "sk CP852" - echo "sk_SK CP852" - echo "sl CP852" - echo "sl_SI CP852" - echo "sq CP852" - echo "sq_AL CP852" - echo "sr CP852" # CP852 or CP866 or CP855 ?? - echo "sr_CS CP852" # CP852 or CP866 or CP855 ?? - echo "sr_YU CP852" # CP852 or CP866 or CP855 ?? - # ISO-8859-3 languages - echo "mt CP850" - echo "mt_MT CP850" - # ISO-8859-5 languages - echo "be CP866" - echo "be_BE CP866" - echo "bg CP866" # not CP855 ?? - echo "bg_BG CP866" # not CP855 ?? - echo "mk CP866" # not CP855 ?? - echo "mk_MK CP866" # not CP855 ?? - echo "ru CP866" - echo "ru_RU CP866" - echo "uk CP1125" - echo "uk_UA CP1125" - # ISO-8859-6 languages - echo "ar CP864" - echo "ar_AE CP864" - echo "ar_DZ CP864" - echo "ar_EG CP864" - echo "ar_IQ CP864" - echo "ar_IR CP864" - echo "ar_JO CP864" - echo "ar_KW CP864" - echo "ar_MA CP864" - echo "ar_OM CP864" - echo "ar_QA CP864" - echo "ar_SA CP864" - echo "ar_SY CP864" - # ISO-8859-7 languages - echo "el CP869" - echo "el_GR CP869" - # ISO-8859-8 languages - echo "he CP862" - echo "he_IL CP862" - # ISO-8859-9 languages - echo "tr CP857" - echo "tr_TR CP857" - # Japanese - echo "ja CP932" - echo "ja_JP CP932" - # Chinese - echo "zh_CN GBK" - echo "zh_TW CP950" # not CP938 ?? - # Korean - echo "kr CP949" # not CP934 ?? - echo "kr_KR CP949" # not CP934 ?? - # Thai - echo "th CP874" - echo "th_TH CP874" - # Other - echo "eo CP850" - echo "eo_EO CP850" - ;; -esac diff --git a/gnulib/import/dirent-private.h b/gnulib/import/dirent-private.h index 9b200f3..1eb1b35 100644 --- a/gnulib/import/dirent-private.h +++ b/gnulib/import/dirent-private.h @@ -1,5 +1,5 @@ /* Private details of the DIR type. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _DIRENT_PRIVATE_H #define _DIRENT_PRIVATE_H 1 diff --git a/gnulib/import/dirent.in.h b/gnulib/import/dirent.in.h index 65482d7..a3c8eb3 100644 --- a/gnulib/import/dirent.in.h +++ b/gnulib/import/dirent.in.h @@ -1,5 +1,5 @@ /* A GNU-like <dirent.h>. - Copyright (C) 2006-2016 Free Software Foundation, Inc. + Copyright (C) 2006-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_DIRENT_H diff --git a/gnulib/import/dirfd.c b/gnulib/import/dirfd.c index a325848..bc858fd 100644 --- a/gnulib/import/dirfd.c +++ b/gnulib/import/dirfd.c @@ -1,6 +1,6 @@ /* dirfd.c -- return the file descriptor associated with an open DIR* - Copyright (C) 2001, 2006, 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2001, 2006, 2008-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff --git a/gnulib/import/dirname-lgpl.c b/gnulib/import/dirname-lgpl.c index a7aabf9..7cf89d8 100644 --- a/gnulib/import/dirname-lgpl.c +++ b/gnulib/import/dirname-lgpl.c @@ -1,6 +1,6 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/dirname.h b/gnulib/import/dirname.h index 875b31b..5791659 100644 --- a/gnulib/import/dirname.h +++ b/gnulib/import/dirname.h @@ -1,6 +1,6 @@ /* Take file names apart into directory and base names. - Copyright (C) 1998, 2001, 2003-2006, 2009-2016 Free Software Foundation, + Copyright (C) 1998, 2001, 2003-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef DIRNAME_H_ # define DIRNAME_H_ 1 @@ -36,7 +36,7 @@ extern "C" { #endif # if GNULIB_DIRNAME -char *base_name (char const *file); +char *base_name (char const *file) _GL_ATTRIBUTE_MALLOC; char *dir_name (char const *file); # endif diff --git a/gnulib/import/dosname.h b/gnulib/import/dosname.h index 83a953f..c0ab684 100644 --- a/gnulib/import/dosname.h +++ b/gnulib/import/dosname.h @@ -1,6 +1,6 @@ /* File names on MS-DOS/Windows systems. - Copyright (C) 2000-2001, 2004-2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2004-2006, 2009-2019 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 @@ -13,16 +13,15 @@ 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 <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. 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__) +#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' \ diff --git a/gnulib/import/dup-safer-flag.c b/gnulib/import/dup-safer-flag.c new file mode 100644 index 0000000..485f741 --- /dev/null +++ b/gnulib/import/dup-safer-flag.c @@ -0,0 +1,38 @@ +/* Duplicate a file descriptor result, avoiding clobbering + STD{IN,OUT,ERR}_FILENO, with specific flags. + + Copyright (C) 2001, 2004-2006, 2009-2019 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Paul Eggert and Eric Blake. */ + +#include <config.h> + +/* Specification. */ +#include "unistd-safer.h" + +#include <fcntl.h> +#include <unistd.h> + +/* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or + STDERR_FILENO. If FLAG contains O_CLOEXEC, behave like + fcntl(F_DUPFD_CLOEXEC) rather than fcntl(F_DUPFD). */ + +int +dup_safer_flag (int fd, int flag) +{ + return fcntl (fd, (flag & O_CLOEXEC) ? F_DUPFD_CLOEXEC : F_DUPFD, + STDERR_FILENO + 1); +} diff --git a/gnulib/import/dup-safer.c b/gnulib/import/dup-safer.c index 6ed8f79..c0c5f2a 100644 --- a/gnulib/import/dup-safer.c +++ b/gnulib/import/dup-safer.c @@ -1,6 +1,6 @@ /* Invoke dup, but avoid some glitches. - Copyright (C) 2001, 2004-2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2001, 2004-2006, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/gnulib/import/dup.c b/gnulib/import/dup.c index 034fcf8..d37f920 100644 --- a/gnulib/import/dup.c +++ b/gnulib/import/dup.c @@ -1,6 +1,6 @@ /* Duplicate an open file descriptor. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -22,7 +22,9 @@ #include <errno.h> -#include "msvc-inval.h" +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +#endif #undef dup diff --git a/gnulib/import/dup2.c b/gnulib/import/dup2.c index 5d026f2..d3aafa4 100644 --- a/gnulib/import/dup2.c +++ b/gnulib/import/dup2.c @@ -1,6 +1,6 @@ /* Duplicate an open file descriptor to a specified file descriptor. - Copyright (C) 1999, 2004-2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 1999, 2004-2007, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Paul Eggert */ @@ -29,16 +29,45 @@ # 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 # include <windows.h> -# include "msvc-inval.h" +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +# endif /* Get _get_osfhandle. */ -# include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif + +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +static int +dup2_nothrow (int fd, int desired_fd) +{ + int result; + + TRY_MSVC_INVAL + { + result = dup2 (fd, desired_fd); + } + CATCH_MSVC_INVAL + { + errno = EBADF; + result = -1; + } + DONE_MSVC_INVAL; + + return result; +} +# else +# define dup2_nothrow dup2 +# endif static int ms_windows_dup2 (int fd, int desired_fd) @@ -59,23 +88,14 @@ ms_windows_dup2 (int fd, int desired_fd) } /* Wine 1.0.1 return 0 when desired_fd is negative but not -1: - http://bugs.winehq.org/show_bug.cgi?id=21289 */ + https://bugs.winehq.org/show_bug.cgi?id=21289 */ if (desired_fd < 0) { errno = EBADF; return -1; } - TRY_MSVC_INVAL - { - result = dup2 (fd, desired_fd); - } - CATCH_MSVC_INVAL - { - errno = EBADF; - result = -1; - } - DONE_MSVC_INVAL; + result = dup2_nothrow (fd, desired_fd); if (result == 0) result = desired_fd; diff --git a/gnulib/import/errno.in.h b/gnulib/import/errno.in.h index b8397ee..3bd27f1 100644 --- a/gnulib/import/errno.in.h +++ b/gnulib/import/errno.in.h @@ -1,6 +1,6 @@ /* A POSIX-like <errno.h>. - Copyright (C) 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2008-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_ERRNO_H @@ -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 diff --git a/gnulib/import/error.c b/gnulib/import/error.c index b3b1286..f8ab668 100644 --- a/gnulib/import/error.c +++ b/gnulib/import/error.c @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ @@ -93,33 +93,37 @@ extern void __error_at_line (int status, int errnum, const char *file_name, # include <fcntl.h> # include <unistd.h> -# 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> /* Get _get_osfhandle. */ -# include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif # endif /* The gnulib override of fcntl is not needed in this file. */ # undef fcntl -# if !HAVE_DECL_STRERROR_R +# if !(GNULIB_STRERROR_R_POSIX || HAVE_DECL_STRERROR_R) # ifndef HAVE_DECL_STRERROR_R "this configure-time declaration test was not run" # endif # if STRERROR_R_CHAR_P -char *strerror_r (); +char *strerror_r (int errnum, char *buf, size_t buflen); # else -int strerror_r (); +int strerror_r (int errnum, char *buf, size_t buflen); # endif # endif -#define program_name getprogname () +# define program_name getprogname () -# if HAVE_STRERROR_R || defined strerror_r +# if GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r -# endif /* HAVE_STRERROR_R || defined strerror_r */ +# endif /* GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r */ #endif /* not _LIBC */ #if !_LIBC @@ -127,7 +131,7 @@ int strerror_r (); static int is_open (int fd) { -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# if defined _WIN32 && ! defined __CYGWIN__ /* On native Windows: The initial state of unassigned standard file descriptors is that they are open but point to an INVALID_HANDLE_VALUE. There is no fcntl, and the gnulib replacement fcntl does not support @@ -172,9 +176,9 @@ print_errno_message (int errnum) { char const *s; -#if defined HAVE_STRERROR_R || _LIBC +#if _LIBC || GNULIB_STRERROR_R_POSIX || defined HAVE_STRERROR_R char errbuf[1024]; -# if _LIBC || STRERROR_R_CHAR_P +# if _LIBC || (!GNULIB_STRERROR_R_POSIX && STRERROR_R_CHAR_P) s = __strerror_r (errnum, errbuf, sizeof errbuf); # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) @@ -268,7 +272,6 @@ error_tail (int status, int errnum, const char *message, va_list args) else #endif vfprintf (stderr, message, args); - va_end (args); ++error_message_count; if (errnum) @@ -318,6 +321,7 @@ error (int status, int errnum, const char *message, ...) va_start (args, message); error_tail (status, errnum, message, args); + va_end (args); #ifdef _LIBC _IO_funlockfile (stderr); @@ -388,6 +392,7 @@ error_at_line (int status, int errnum, const char *file_name, va_start (args, message); error_tail (status, errnum, message, args); + va_end (args); #ifdef _LIBC _IO_funlockfile (stderr); diff --git a/gnulib/import/error.h b/gnulib/import/error.h index 6a69db0..3759f8a 100644 --- a/gnulib/import/error.h +++ b/gnulib/import/error.h @@ -1,5 +1,5 @@ /* Declaration for error-reporting function - Copyright (C) 1995-1997, 2003, 2006, 2008-2016 Free Software Foundation, + Copyright (C) 1995-1997, 2003, 2006, 2008-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _ERROR_H #define _ERROR_H 1 diff --git a/gnulib/import/exitfail.c b/gnulib/import/exitfail.c index 8033c22..69b3513 100644 --- a/gnulib/import/exitfail.c +++ b/gnulib/import/exitfail.c @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2007, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/exitfail.h b/gnulib/import/exitfail.h index 62311bd..480ad1a 100644 --- a/gnulib/import/exitfail.h +++ b/gnulib/import/exitfail.h @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2002, 2009-2019 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 @@ -13,6 +13,6 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ extern int volatile exit_failure; diff --git a/gnulib/import/extra/config.rpath b/gnulib/import/extra/config.rpath index 98183ff..be202c1 100755 --- a/gnulib/import/extra/config.rpath +++ b/gnulib/import/extra/config.rpath @@ -2,7 +2,7 @@ # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # -# Copyright 1996-2016 Free Software Foundation, Inc. +# Copyright 1996-2019 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # diff --git a/gnulib/import/extra/snippet/_Noreturn.h b/gnulib/import/extra/snippet/_Noreturn.h deleted file mode 100644 index c44ad89..0000000 --- a/gnulib/import/extra/snippet/_Noreturn.h +++ /dev/null @@ -1,10 +0,0 @@ -#if !defined _Noreturn && __STDC_VERSION__ < 201112 -# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ - || 0x5110 <= __SUNPRO_C) -# define _Noreturn __attribute__ ((__noreturn__)) -# elif 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn -# endif -#endif diff --git a/gnulib/import/extra/update-copyright b/gnulib/import/extra/update-copyright index 17ee6b1..e4809f6 100755 --- a/gnulib/import/extra/update-copyright +++ b/gnulib/import/extra/update-copyright @@ -1,11 +1,9 @@ -eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" "$@"' - & eval 'exec perl -wS -0777 -pi "$0" $argv:q' - if 0; -# Update an FSF copyright year list to include the current year. +#!/bin/sh +#! -*-perl-*- -my $VERSION = '2016-01-12.23:13'; # UTC +# Update an FSF copyright year list to include the current year. -# Copyright (C) 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2009-2019 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 @@ -18,10 +16,13 @@ my $VERSION = '2016-01-12.23:13'; # UTC # 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 <http://www.gnu.org/licenses/>. - +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# # Written by Jim Meyering and Joel E. Denny +# This script updates an FSF copyright year list to include the current year. +# Usage: update-copyright [FILE...] +# # The arguments to this script should be names of files that contain # copyright statements to be updated. The copyright holder's name # defaults to "Free Software Foundation, Inc." but may be changed to @@ -81,6 +82,7 @@ my $VERSION = '2016-01-12.23:13'; # UTC # B. (c) # C. @copyright{} # D. © +# E. © # # 4. The "Copyright" appears at the beginning of a line, except that it # may be prefixed by any sequence (e.g., a comment) of no more than @@ -96,7 +98,7 @@ my $VERSION = '2016-01-12.23:13'; # UTC # 6. Blank lines, even if preceded by the prefix, do not appear # within the FSF copyright statement. # 7. Each copyright year is 2 or 4 digits, and years are separated by -# commas or dashes. Whitespace may appear after commas. +# commas, "-", or "--". Whitespace may appear after commas. # # Environment variables: # @@ -120,11 +122,32 @@ my $VERSION = '2016-01-12.23:13'; # UTC # 5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other # than "Free Software Foundation, Inc.". +# This is a prologue that allows to run a perl script as an executable +# on systems that are compliant to a POSIX version before POSIX:2017. +# On such systems, the usual invocation of an executable through execlp() +# or execvp() fails with ENOEXEC if it is a script that does not start +# with a #! line. The script interpreter mentioned in the #! line has +# to be /bin/sh, because on GuixSD systems that is the only program that +# has a fixed file name. The second line is essential for perl and is +# also useful for editing this file in Emacs. The next two lines below +# are valid code in both sh and perl. When executed by sh, they re-execute +# the script through the perl program found in $PATH. The '-x' option +# is essential as well; without it, perl would re-execute the script +# through /bin/sh. When executed by perl, the next two lines are a no-op. +eval 'exec perl -wSx -0777 -pi "$0" "$@"' + if 0; + +my $VERSION = '2018-03-07.03:47'; # UTC +# The definition above must lie within the first 8 lines in order +# for the Emacs time-stamp write hook (at end) to update it. +# If you change this file with Emacs, please let the write hook +# do its job. Otherwise, update this string manually. + use strict; use warnings; my $copyright_re = 'Copyright'; -my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|©)'; +my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|©|©)'; my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER}; $holder ||= 'Free Software Foundation, Inc.'; my $prefix_max = 5; @@ -169,7 +192,7 @@ while (/(^|\n)(.{0,$prefix_max})$copyright_re/g) $holder_re =~ s/\s/$ws_re/g; my $stmt_remainder_re = "(?:$ws_re$circle_c_re)?" - . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|-))*" + . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|--?))*" . "((?:\\d\\d)?\\d\\d)$ws_re$holder_re"; if (/\G$stmt_remainder_re/) { @@ -208,26 +231,28 @@ if (defined $stmt_re) # Make the use of intervals consistent. if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS}) { - $stmt =~ s/(\d{4})-(\d{4})/join(', ', $1..$2)/eg; + $stmt =~ s/(\d{4})--?(\d{4})/join(', ', $1..$2)/eg; } else { + my $ndash = $ARGV =~ /\.tex(i(nfo)?)?$/ ? "--" : "-"; + $stmt =~ s/ (\d{4}) (?: - (,\ |-) + (,\ |--?) ((??{ - if ($2 eq '-') { '\d{4}'; } + if ($2 ne ', ') { '\d{4}'; } elsif (!$3) { $1 + 1; } else { $3 + 1; } })) )+ - /$1-$3/gx; + /$1$ndash$3/gx; # When it's 2, emit a single range encompassing all year numbers. $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2 - and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1-$2/; + and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1$ndash$2/; } # Format within margin. @@ -263,10 +288,13 @@ else print STDERR "$ARGV: warning: copyright statement not found\n"; } +# Hey Emacs! # Local variables: +# coding: utf-8 # mode: perl # indent-tabs-mode: nil -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-line-limit: 200 # time-stamp-start: "my $VERSION = '" # time-stamp-format: "%:y-%02m-%02d.%02H:%02M" # time-stamp-time-zone: "UTC0" diff --git a/gnulib/import/fchdir.c b/gnulib/import/fchdir.c index 8a7a072..38ab802 100644 --- a/gnulib/import/fchdir.c +++ b/gnulib/import/fchdir.c @@ -1,5 +1,5 @@ /* fchdir replacement. - Copyright (C) 2006-2016 Free Software Foundation, Inc. + Copyright (C) 2006-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/fcntl.c b/gnulib/import/fcntl.c index fd17e96..a3ffaa6 100644 --- a/gnulib/import/fcntl.c +++ b/gnulib/import/fcntl.c @@ -1,6 +1,6 @@ /* Provide file descriptor control. - Copyright (C) 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>. */ @@ -25,20 +25,25 @@ #include <errno.h> #include <limits.h> #include <stdarg.h> +#include <stdlib.h> #include <unistd.h> -#if !HAVE_FCNTL -# define rpl_fcntl fcntl +#ifdef __KLIBC__ +# define INCL_DOS +# include <os2.h> #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> /* Get _get_osfhandle. */ -# include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif /* Upper bound on getdtablesize(). See lib/getdtablesize.c. */ # define OPEN_MAX_MAX 0x10000 @@ -162,93 +167,18 @@ dupfd (int oldfd, int newfd, int flags) } #endif /* W32 */ +/* Forward declarations, because we '#undef fcntl' in the middle of this + compilation unit. */ +/* Our implementation of fcntl (fd, F_DUPFD, target). */ +static int rpl_fcntl_DUPFD (int fd, int target); +/* Our implementation of fcntl (fd, F_DUPFD_CLOEXEC, target). */ +static int rpl_fcntl_DUPFD_CLOEXEC (int fd, int target); #ifdef __KLIBC__ - -# define INCL_DOS -# include <os2.h> - -static int -klibc_fcntl (int fd, int action, /* arg */...) -{ - va_list arg_ptr; - int arg; - struct stat sbuf; - int result = -1; - - va_start (arg_ptr, action); - arg = va_arg (arg_ptr, int); - result = fcntl (fd, action, arg); - /* EPERM for F_DUPFD, ENOTSUP for others */ - if (result == -1 && (errno == EPERM || errno == ENOTSUP) - && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) - { - ULONG ulMode; - - switch (action) - { - case F_DUPFD: - /* Find available fd */ - while (fcntl (arg, F_GETFL) != -1 || errno != EBADF) - arg++; - - result = dup2 (fd, arg); - break; - - /* Using underlying APIs is right ? */ - case F_GETFD: - if (DosQueryFHState (fd, &ulMode)) - break; - - result = (ulMode & OPEN_FLAGS_NOINHERIT) ? FD_CLOEXEC : 0; - break; - - case F_SETFD: - if (arg & ~FD_CLOEXEC) - break; - - if (DosQueryFHState (fd, &ulMode)) - break; - - if (arg & FD_CLOEXEC) - ulMode |= OPEN_FLAGS_NOINHERIT; - else - ulMode &= ~OPEN_FLAGS_NOINHERIT; - - /* Filter supported flags. */ - ulMode &= (OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_FAIL_ON_ERROR - | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_NOINHERIT); - - if (DosSetFHState (fd, ulMode)) - break; - - result = 0; - break; - - case F_GETFL: - result = 0; - break; - - case F_SETFL: - if (arg != 0) - break; - - result = 0; - break; - - default : - errno = EINVAL; - break; - } - } - - va_end (arg_ptr); - - return result; -} - -# define fcntl klibc_fcntl +/* Adds support for fcntl on directories. */ +static int klibc_fcntl (int fd, int action, /* arg */...); #endif + /* Perform the specified ACTION on the file descriptor FD, possibly using the argument ARG further described below. This replacement handles the following actions, and forwards all others on to the @@ -269,110 +199,35 @@ klibc_fcntl (int fd, int action, /* arg */...) return -1 and set errno. */ int -rpl_fcntl (int fd, int action, /* arg */...) +fcntl (int fd, int action, /* arg */...) +#undef fcntl +#ifdef __KLIBC__ +# define fcntl klibc_fcntl +#endif { va_list arg; int result = -1; va_start (arg, action); switch (action) { - -#if !HAVE_FCNTL case F_DUPFD: { int target = va_arg (arg, int); - result = dupfd (fd, target, 0); + result = rpl_fcntl_DUPFD (fd, target); break; } -#elif FCNTL_DUPFD_BUGGY || REPLACE_FCHDIR - case F_DUPFD: - { - int target = va_arg (arg, int); - /* Detect invalid target; needed for cygwin 1.5.x. */ - if (target < 0 || getdtablesize () <= target) - errno = EINVAL; - else - { - /* Haiku alpha 2 loses fd flags on original. */ - int flags = fcntl (fd, F_GETFD); - if (flags < 0) - { - result = -1; - break; - } - result = fcntl (fd, action, target); - if (0 <= result && fcntl (fd, F_SETFD, flags) == -1) - { - int saved_errno = errno; - close (result); - result = -1; - errno = saved_errno; - } -# if REPLACE_FCHDIR - if (0 <= result) - result = _gl_register_dup (fd, result); -# endif - } - break; - } /* F_DUPFD */ -#endif /* FCNTL_DUPFD_BUGGY || REPLACE_FCHDIR */ case F_DUPFD_CLOEXEC: { int target = va_arg (arg, int); - -#if !HAVE_FCNTL - result = dupfd (fd, target, O_CLOEXEC); - break; -#else /* HAVE_FCNTL */ - /* Try the system call first, if the headers claim it exists - (that is, if GNULIB_defined_F_DUPFD_CLOEXEC is 0), since we - may be running with a glibc that has the macro but with an - older kernel that does not support it. Cache the - information on whether the system call really works, but - avoid caching failure if the corresponding F_DUPFD fails - for any reason. 0 = unknown, 1 = yes, -1 = no. */ - static int have_dupfd_cloexec = GNULIB_defined_F_DUPFD_CLOEXEC ? -1 : 0; - if (0 <= have_dupfd_cloexec) - { - result = fcntl (fd, action, target); - if (0 <= result || errno != EINVAL) - { - have_dupfd_cloexec = 1; -# if REPLACE_FCHDIR - if (0 <= result) - result = _gl_register_dup (fd, result); -# endif - } - else - { - result = rpl_fcntl (fd, F_DUPFD, target); - if (result < 0) - break; - have_dupfd_cloexec = -1; - } - } - else - result = rpl_fcntl (fd, F_DUPFD, target); - if (0 <= result && have_dupfd_cloexec == -1) - { - int flags = fcntl (result, F_GETFD); - if (flags < 0 || fcntl (result, F_SETFD, flags | FD_CLOEXEC) == -1) - { - int saved_errno = errno; - close (result); - errno = saved_errno; - result = -1; - } - } + result = rpl_fcntl_DUPFD_CLOEXEC (fd, target); break; -#endif /* HAVE_FCNTL */ - } /* F_DUPFD_CLOEXEC */ + } #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 @@ -401,8 +256,183 @@ rpl_fcntl (int fd, int action, /* arg */...) default: { #if HAVE_FCNTL - void *p = va_arg (arg, void *); - result = fcntl (fd, action, p); + switch (action) + { + #ifdef F_BARRIERFSYNC /* macOS */ + case F_BARRIERFSYNC: + #endif + #ifdef F_CHKCLEAN /* macOS */ + case F_CHKCLEAN: + #endif + #ifdef F_CLOSEM /* NetBSD, HP-UX */ + case F_CLOSEM: + #endif + #ifdef F_FLUSH_DATA /* macOS */ + case F_FLUSH_DATA: + #endif + #ifdef F_FREEZE_FS /* macOS */ + case F_FREEZE_FS: + #endif + #ifdef F_FULLFSYNC /* macOS */ + case F_FULLFSYNC: + #endif + #ifdef F_GETCONFINED /* macOS */ + case F_GETCONFINED: + #endif + #ifdef F_GETDEFAULTPROTLEVEL /* macOS */ + case F_GETDEFAULTPROTLEVEL: + #endif + #ifdef F_GETFD /* POSIX */ + case F_GETFD: + #endif + #ifdef F_GETFL /* POSIX */ + case F_GETFL: + #endif + #ifdef F_GETLEASE /* Linux */ + case F_GETLEASE: + #endif + #ifdef F_GETNOSIGPIPE /* macOS */ + case F_GETNOSIGPIPE: + #endif + #ifdef F_GETOWN /* POSIX */ + case F_GETOWN: + #endif + #ifdef F_GETPIPE_SZ /* Linux */ + case F_GETPIPE_SZ: + #endif + #ifdef F_GETPROTECTIONCLASS /* macOS */ + case F_GETPROTECTIONCLASS: + #endif + #ifdef F_GETPROTECTIONLEVEL /* macOS */ + case F_GETPROTECTIONLEVEL: + #endif + #ifdef F_GET_SEALS /* Linux */ + case F_GET_SEALS: + #endif + #ifdef F_GETSIG /* Linux */ + case F_GETSIG: + #endif + #ifdef F_MAXFD /* NetBSD */ + case F_MAXFD: + #endif + #ifdef F_RECYCLE /* macOS */ + case F_RECYCLE: + #endif + #ifdef F_SETFIFOENH /* HP-UX */ + case F_SETFIFOENH: + #endif + #ifdef F_THAW_FS /* macOS */ + case F_THAW_FS: + #endif + /* These actions take no argument. */ + result = fcntl (fd, action); + break; + + #ifdef F_ADD_SEALS /* Linux */ + case F_ADD_SEALS: + #endif + #ifdef F_BADFD /* Solaris */ + case F_BADFD: + #endif + #ifdef F_CHECK_OPENEVT /* macOS */ + case F_CHECK_OPENEVT: + #endif + #ifdef F_DUP2FD /* FreeBSD, AIX, Solaris */ + case F_DUP2FD: + #endif + #ifdef F_DUP2FD_CLOEXEC /* FreeBSD, Solaris */ + case F_DUP2FD_CLOEXEC: + #endif + #ifdef F_DUP2FD_CLOFORK /* Solaris */ + case F_DUP2FD_CLOFORK: + #endif + #ifdef F_DUPFD /* POSIX */ + case F_DUPFD: + #endif + #ifdef F_DUPFD_CLOEXEC /* POSIX */ + case F_DUPFD_CLOEXEC: + #endif + #ifdef F_DUPFD_CLOFORK /* Solaris */ + case F_DUPFD_CLOFORK: + #endif + #ifdef F_GETXFL /* Solaris */ + case F_GETXFL: + #endif + #ifdef F_GLOBAL_NOCACHE /* macOS */ + case F_GLOBAL_NOCACHE: + #endif + #ifdef F_MAKECOMPRESSED /* macOS */ + case F_MAKECOMPRESSED: + #endif + #ifdef F_MOVEDATAEXTENTS /* macOS */ + case F_MOVEDATAEXTENTS: + #endif + #ifdef F_NOCACHE /* macOS */ + case F_NOCACHE: + #endif + #ifdef F_NODIRECT /* macOS */ + case F_NODIRECT: + #endif + #ifdef F_NOTIFY /* Linux */ + case F_NOTIFY: + #endif + #ifdef F_OPLKACK /* IRIX */ + case F_OPLKACK: + #endif + #ifdef F_OPLKREG /* IRIX */ + case F_OPLKREG: + #endif + #ifdef F_RDAHEAD /* macOS */ + case F_RDAHEAD: + #endif + #ifdef F_SETBACKINGSTORE /* macOS */ + case F_SETBACKINGSTORE: + #endif + #ifdef F_SETCONFINED /* macOS */ + case F_SETCONFINED: + #endif + #ifdef F_SETFD /* POSIX */ + case F_SETFD: + #endif + #ifdef F_SETFL /* POSIX */ + case F_SETFL: + #endif + #ifdef F_SETLEASE /* Linux */ + case F_SETLEASE: + #endif + #ifdef F_SETNOSIGPIPE /* macOS */ + case F_SETNOSIGPIPE: + #endif + #ifdef F_SETOWN /* POSIX */ + case F_SETOWN: + #endif + #ifdef F_SETPIPE_SZ /* Linux */ + case F_SETPIPE_SZ: + #endif + #ifdef F_SETPROTECTIONCLASS /* macOS */ + case F_SETPROTECTIONCLASS: + #endif + #ifdef F_SETSIG /* Linux */ + case F_SETSIG: + #endif + #ifdef F_SINGLE_WRITER /* macOS */ + case F_SINGLE_WRITER: + #endif + /* These actions take an 'int' argument. */ + { + int x = va_arg (arg, int); + result = fcntl (fd, action, x); + } + break; + + default: + /* Other actions take a pointer argument. */ + { + void *p = va_arg (arg, void *); + result = fcntl (fd, action, p); + } + break; + } #else errno = EINVAL; #endif @@ -412,3 +442,186 @@ rpl_fcntl (int fd, int action, /* arg */...) va_end (arg); return result; } + +static int +rpl_fcntl_DUPFD (int fd, int target) +{ + int result; +#if !HAVE_FCNTL + result = dupfd (fd, target, 0); +#elif FCNTL_DUPFD_BUGGY || REPLACE_FCHDIR + /* Detect invalid target; needed for cygwin 1.5.x. */ + if (target < 0 || getdtablesize () <= target) + { + result = -1; + errno = EINVAL; + } + else + { + /* Haiku alpha 2 loses fd flags on original. */ + int flags = fcntl (fd, F_GETFD); + if (flags < 0) + result = -1; + else + { + result = fcntl (fd, F_DUPFD, target); + if (0 <= result && fcntl (fd, F_SETFD, flags) == -1) + { + int saved_errno = errno; + close (result); + result = -1; + errno = saved_errno; + } +# if REPLACE_FCHDIR + if (0 <= result) + result = _gl_register_dup (fd, result); +# endif + } + } +#else + result = fcntl (fd, F_DUPFD, target); +#endif + return result; +} + +static int +rpl_fcntl_DUPFD_CLOEXEC (int fd, int target) +{ + int result; +#if !HAVE_FCNTL + result = dupfd (fd, target, O_CLOEXEC); +#else /* HAVE_FCNTL */ +# if defined __HAIKU__ + /* On Haiku, the system fcntl (fd, F_DUPFD_CLOEXEC, target) sets + the FD_CLOEXEC flag on fd, not on target. Therefore avoid the + system fcntl in this case. */ +# define have_dupfd_cloexec -1 +# else + /* Try the system call first, if the headers claim it exists + (that is, if GNULIB_defined_F_DUPFD_CLOEXEC is 0), since we + may be running with a glibc that has the macro but with an + older kernel that does not support it. Cache the + information on whether the system call really works, but + avoid caching failure if the corresponding F_DUPFD fails + for any reason. 0 = unknown, 1 = yes, -1 = no. */ + static int have_dupfd_cloexec = GNULIB_defined_F_DUPFD_CLOEXEC ? -1 : 0; + if (0 <= have_dupfd_cloexec) + { + result = fcntl (fd, F_DUPFD_CLOEXEC, target); + if (0 <= result || errno != EINVAL) + { + have_dupfd_cloexec = 1; +# if REPLACE_FCHDIR + if (0 <= result) + result = _gl_register_dup (fd, result); +# endif + } + else + { + result = rpl_fcntl_DUPFD (fd, target); + if (result >= 0) + have_dupfd_cloexec = -1; + } + } + else +# endif + result = rpl_fcntl_DUPFD (fd, target); + if (0 <= result && have_dupfd_cloexec == -1) + { + int flags = fcntl (result, F_GETFD); + if (flags < 0 || fcntl (result, F_SETFD, flags | FD_CLOEXEC) == -1) + { + int saved_errno = errno; + close (result); + errno = saved_errno; + result = -1; + } + } +#endif /* HAVE_FCNTL */ + return result; +} + +#undef fcntl + +#ifdef __KLIBC__ + +static int +klibc_fcntl (int fd, int action, /* arg */...) +{ + va_list arg_ptr; + int arg; + struct stat sbuf; + int result; + + va_start (arg_ptr, action); + arg = va_arg (arg_ptr, int); + result = fcntl (fd, action, arg); + /* EPERM for F_DUPFD, ENOTSUP for others */ + if (result == -1 && (errno == EPERM || errno == ENOTSUP) + && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + { + ULONG ulMode; + + switch (action) + { + case F_DUPFD: + /* Find available fd */ + while (fcntl (arg, F_GETFL) != -1 || errno != EBADF) + arg++; + + result = dup2 (fd, arg); + break; + + /* Using underlying APIs is right ? */ + case F_GETFD: + if (DosQueryFHState (fd, &ulMode)) + break; + + result = (ulMode & OPEN_FLAGS_NOINHERIT) ? FD_CLOEXEC : 0; + break; + + case F_SETFD: + if (arg & ~FD_CLOEXEC) + break; + + if (DosQueryFHState (fd, &ulMode)) + break; + + if (arg & FD_CLOEXEC) + ulMode |= OPEN_FLAGS_NOINHERIT; + else + ulMode &= ~OPEN_FLAGS_NOINHERIT; + + /* Filter supported flags. */ + ulMode &= (OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_FAIL_ON_ERROR + | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_NOINHERIT); + + if (DosSetFHState (fd, ulMode)) + break; + + result = 0; + break; + + case F_GETFL: + result = 0; + break; + + case F_SETFL: + if (arg != 0) + break; + + result = 0; + break; + + default: + errno = EINVAL; + break; + } + } + + va_end (arg_ptr); + + return result; +} + +#endif diff --git a/gnulib/import/fcntl.in.h b/gnulib/import/fcntl.in.h index b943973..abe7993 100644 --- a/gnulib/import/fcntl.in.h +++ b/gnulib/import/fcntl.in.h @@ -1,6 +1,6 @@ /* Like <fcntl.h>, but with non-working flags defined to 0. - Copyright (C) 2006-2016 Free Software Foundation, Inc. + Copyright (C) 2006-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Paul Eggert */ @@ -39,6 +39,12 @@ #endif #@INCLUDE_NEXT@ @NEXT_FCNTL_H@ +/* Native Windows platforms declare open(), creat() in <io.h>. */ +#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__) +# include <io.h> +#endif + #else /* Normal invocation convention. */ @@ -59,6 +65,12 @@ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_FCNTL_H@ +/* Native Windows platforms declare open(), creat() in <io.h>. */ +#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__) +# include <io.h> +#endif + #ifndef _@GUARD_PREFIX@_FCNTL_H #define _@GUARD_PREFIX@_FCNTL_H @@ -66,12 +78,6 @@ # include <unistd.h> #endif -/* Native Windows platforms declare open(), creat() in <io.h>. */ -#if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ - && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) -# include <io.h> -#endif - /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -82,6 +88,26 @@ /* Declare overridden functions. */ +#if @GNULIB_CREAT@ +# if @REPLACE_CREAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef creat +# define creat rpl_creat +# endif +_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode)); +# else +_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); +# endif +_GL_CXXALIASWARN (creat); +#elif defined GNULIB_POSIXCHECK +# undef creat +/* Assume creat is always declared. */ +_GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " + "use gnulib module creat for portability"); +#endif + #if @GNULIB_FCNTL@ # if @REPLACE_FCNTL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -213,7 +239,10 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " #endif #ifndef O_CLOEXEC -# define O_CLOEXEC 0 +# define O_CLOEXEC 0x40000000 /* Try to not collide with system O_* flags. */ +# define GNULIB_defined_O_CLOEXEC 1 +#else +# define GNULIB_defined_O_CLOEXEC 0 #endif #ifndef O_DIRECT diff --git a/gnulib/import/fd-hook.c b/gnulib/import/fd-hook.c index 8676c6b..7879119 100644 --- a/gnulib/import/fd-hook.c +++ b/gnulib/import/fd-hook.c @@ -1,5 +1,5 @@ -/* Hook for making making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2016 Free Software Foundation, Inc. +/* Hook for making file descriptor functions close(), ioctl() extensible. + Copyright (C) 2009-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/fd-hook.h b/gnulib/import/fd-hook.h index 9568d07..bf07f00 100644 --- a/gnulib/import/fd-hook.h +++ b/gnulib/import/fd-hook.h @@ -1,5 +1,5 @@ -/* Hook for making making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2016 Free Software Foundation, Inc. +/* Hook for making file descriptor functions close(), ioctl() extensible. + Copyright (C) 2009-2019 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 @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef FD_HOOK_H diff --git a/gnulib/import/fd-safer-flag.c b/gnulib/import/fd-safer-flag.c new file mode 100644 index 0000000..7c026ef --- /dev/null +++ b/gnulib/import/fd-safer-flag.c @@ -0,0 +1,52 @@ +/* Adjust a file descriptor result so that it avoids clobbering + STD{IN,OUT,ERR}_FILENO, with specific flags. + + Copyright (C) 2005-2006, 2009-2019 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Paul Eggert and Eric Blake. */ + +#include <config.h> + +/* Specification. */ +#include "unistd-safer.h" + +#include <errno.h> +#include <unistd.h> + +/* Return FD, unless FD would be a copy of standard input, output, or + error; in that case, return a duplicate of FD, closing FD. If FLAG + contains O_CLOEXEC, the returned FD will have close-on-exec + semantics. On failure to duplicate, close FD, set errno, and + return -1. Preserve errno if FD is negative, so that the caller + can always inspect errno when the returned value is negative. + + This function is usefully wrapped around functions that return file + descriptors, e.g., fd_safer_flag (open ("file", O_RDONLY | flag), flag). */ + +int +fd_safer_flag (int fd, int flag) +{ + if (STDIN_FILENO <= fd && fd <= STDERR_FILENO) + { + int f = dup_safer_flag (fd, flag); + int e = errno; + close (fd); + errno = e; + fd = f; + } + + return fd; +} diff --git a/gnulib/import/fd-safer.c b/gnulib/import/fd-safer.c index 8a6bee2..b5113e1 100644 --- a/gnulib/import/fd-safer.c +++ b/gnulib/import/fd-safer.c @@ -1,6 +1,6 @@ /* Return a safer copy of a file descriptor. - Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/gnulib/import/fdopendir.c b/gnulib/import/fdopendir.c index c1f4dcb..b65588a 100644 --- a/gnulib/import/fdopendir.c +++ b/gnulib/import/fdopendir.c @@ -1,5 +1,5 @@ /* provide a replacement fdopendir function - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/gnulib/import/filename.h b/gnulib/import/filename.h index 7d2c31a..3ba3105 100644 --- a/gnulib/import/filename.h +++ b/gnulib/import/filename.h @@ -1,5 +1,5 @@ /* Basic filename support macros. - Copyright (C) 2001-2004, 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2007-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _FILENAME_H #define _FILENAME_H @@ -28,7 +28,7 @@ extern "C" { it may be concatenated to a directory pathname. IS_PATH_WITH_DIR(P) tests whether P contains a directory specification. */ -#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ +#if defined _WIN32 || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ /* Native Windows, Cygwin, OS/2, DOS */ # define ISSLASH(C) ((C) == '/' || (C) == '\\') # define HAS_DEVICE(P) \ diff --git a/gnulib/import/filenamecat-lgpl.c b/gnulib/import/filenamecat-lgpl.c index 4903fbf..98b105a 100644 --- a/gnulib/import/filenamecat-lgpl.c +++ b/gnulib/import/filenamecat-lgpl.c @@ -1,6 +1,6 @@ /* Concatenate two arbitrary file names. - Copyright (C) 1996-2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2007, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ @@ -31,55 +31,54 @@ # define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N))) #endif -/* Return the longest suffix of F that is a relative file name. - If it has no such suffix, return the empty string. */ - -static char const * _GL_ATTRIBUTE_PURE -longest_relative_suffix (char const *f) -{ - for (f += FILE_SYSTEM_PREFIX_LEN (f); ISSLASH (*f); f++) - continue; - return f; -} - -/* Concatenate two file name components, DIR and ABASE, in +/* Concatenate two file name components, DIR and BASE, in newly-allocated storage and return the result. The resulting file name F is such that the commands "ls F" and "(cd - DIR; ls BASE)" refer to the same file, where BASE is ABASE with any - file system prefixes and leading separators removed. - Arrange for a directory separator if necessary between DIR and BASE - in the result, removing any redundant separators. + DIR; ls ./BASE)" refer to the same file. If necessary, put + a separator between DIR and BASE in the result. Typically this + separator is "/", but in rare cases it might be ".". In any case, if BASE_IN_RESULT is non-NULL, set - *BASE_IN_RESULT to point to the copy of ABASE in the returned - concatenation. However, if ABASE begins with more than one slash, - set *BASE_IN_RESULT to point to the sole corresponding slash that - is copied into the result buffer. + *BASE_IN_RESULT to point to the copy of BASE at the end of the + returned concatenation. Return NULL if malloc fails. */ char * -mfile_name_concat (char const *dir, char const *abase, char **base_in_result) +mfile_name_concat (char const *dir, char const *base, char **base_in_result) { char const *dirbase = last_component (dir); size_t dirbaselen = base_len (dirbase); size_t dirlen = dirbase - dir + dirbaselen; - size_t needs_separator = (dirbaselen && ! ISSLASH (dirbase[dirbaselen - 1])); - - char const *base = longest_relative_suffix (abase); size_t baselen = strlen (base); - - char *p_concat = malloc (dirlen + needs_separator + baselen + 1); + char sep = '\0'; + if (dirbaselen) + { + /* DIR is not a file system root, so separate with / if needed. */ + if (! ISSLASH (dir[dirlen - 1]) && ! ISSLASH (*base)) + sep = '/'; + } + else if (ISSLASH (*base)) + { + /* DIR is a file system root and BASE begins with a slash, so + separate with ".". For example, if DIR is "/" and BASE is + "/foo" then return "/./foo", as "//foo" would be wrong on + some POSIX systems. A fancier algorithm could omit "." in + some cases but is not worth the trouble. */ + sep = '.'; + } + + char *p_concat = malloc (dirlen + (sep != '\0') + baselen + 1); char *p; if (p_concat == NULL) return NULL; p = mempcpy (p_concat, dir, dirlen); - *p = DIRECTORY_SEPARATOR; - p += needs_separator; + *p = sep; + p += sep != '\0'; if (base_in_result) - *base_in_result = p - IS_ABSOLUTE_FILE_NAME (abase); + *base_in_result = p; p = mempcpy (p, base, baselen); *p = '\0'; diff --git a/gnulib/import/filenamecat.h b/gnulib/import/filenamecat.h index 791a0af..67b46b0 100644 --- a/gnulib/import/filenamecat.h +++ b/gnulib/import/filenamecat.h @@ -1,6 +1,6 @@ /* Concatenate two arbitrary file names. - Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2016 Free Software + Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff --git a/gnulib/import/flexmember.h b/gnulib/import/flexmember.h index 62c556b..af17b41 100644 --- a/gnulib/import/flexmember.h +++ b/gnulib/import/flexmember.h @@ -1,19 +1,22 @@ /* Sizes of structs with flexible array members. - Copyright 2016 Free Software Foundation, Inc. + Copyright 2016-2019 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 file is part of the GNU C Library. - This program is distributed in the hope that it will be useful, + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + 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 <http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. Written by Paul Eggert. */ @@ -30,11 +33,26 @@ # 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 properly aligned 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. The result is suitable as an + argument to malloc. For example: + + struct s { int n; char d[FLEXIBLE_ARRAY_MEMBER]; }; + struct s *p = malloc (FLEXSIZEOF (struct s, d, n * sizeof (char))); + + FLEXSIZEOF (TYPE, MEMBER, N) is not simply (sizeof (TYPE) + N), + since FLEXIBLE_ARRAY_MEMBER may be 1 on pre-C11 platforms. Nor is + it simply (offsetof (TYPE, MEMBER) + N), as that might yield a size + that causes malloc to yield a pointer that is not properly aligned + for TYPE; for example, if sizeof (int) == alignof (int) == 4, + malloc (offsetof (struct s, d) + 3 * sizeof (char)) is equivalent + to malloc (7) and might yield a pointer that is not a multiple of 4 + (which means the pointer is not properly aligned for struct s), + whereas malloc (FLEXSIZEOF (struct s, d, 3 * sizeof (char))) is + equivalent to malloc (8) and must yield a pointer that is a + multiple of 4. + Yield a value less than N if and only if arithmetic overflow occurs. */ #define FLEXSIZEOF(type, member, n) \ diff --git a/gnulib/import/float+.h b/gnulib/import/float+.h index 00fcc76..5af861f 100644 --- a/gnulib/import/float+.h +++ b/gnulib/import/float+.h @@ -1,5 +1,5 @@ /* Supplemental information about the floating-point formats. - Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _FLOATPLUS_H #define _FLOATPLUS_H diff --git a/gnulib/import/float.c b/gnulib/import/float.c index 1bad2ee..8872deb 100644 --- a/gnulib/import/float.c +++ b/gnulib/import/float.c @@ -1,5 +1,5 @@ /* Auxiliary definitions for <float.h>. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/float.in.h b/gnulib/import/float.in.h index 0b93d90..ba094a8 100644 --- a/gnulib/import/float.in.h +++ b/gnulib/import/float.in.h @@ -1,6 +1,6 @@ /* A correct <float.h>. - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_FLOAT_H @@ -62,8 +62,8 @@ /* On FreeBSD/x86 6.4, the 'long double' type really has only 53 bits of precision in the compiler but 64 bits of precision at runtime. See - <http://lists.gnu.org/archive/html/bug-gnulib/2008-07/msg00063.html>. */ -#if defined __i386__ && defined __FreeBSD__ + <https://lists.gnu.org/r/bug-gnulib/2008-07/msg00063.html>. */ +#if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__) /* Number of mantissa units, in base FLT_RADIX. */ # undef LDBL_MANT_DIG # define LDBL_MANT_DIG 64 @@ -81,7 +81,7 @@ # define LDBL_MAX_EXP 16384 /* Minimum positive normalized number. */ # undef LDBL_MIN -# define LDBL_MIN 3.3621031431120935E-4932L /* = 0x1p-16382L */ +# define LDBL_MIN 3.362103143112093506262677817321752E-4932L /* = 0x1p-16382L */ /* Maximum representable finite number. */ # undef LDBL_MAX /* LDBL_MAX is represented as { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }. diff --git a/gnulib/import/fnmatch.c b/gnulib/import/fnmatch.c index 0858091..dbcd290 100644 --- a/gnulib/import/fnmatch.c +++ b/gnulib/import/fnmatch.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1993, 1996-2007, 2009-2016 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993, 1996-2007, 2009-2019 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 @@ -11,7 +11,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> @@ -22,10 +22,6 @@ # define _GNU_SOURCE 1 #endif -#if ! defined __builtin_expect && defined __GNUC__ && __GNUC__ < 3 -# define __builtin_expect(expr, expected) (expr) -#endif - #include <fnmatch.h> #include <alloca.h> @@ -69,6 +65,14 @@ extern int fnmatch (const char *pattern, const char *string, int flags); #include "flexmember.h" +#ifndef FALLTHROUGH +# if __GNUC__ < 7 +# define FALLTHROUGH ((void) 0) +# else +# define FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +#endif + /* We often have to test for FNM_FILE_NAME and FNM_PERIOD being both set. */ #define NO_LEADING_PERIOD(flags) \ ((flags & (FNM_FILE_NAME | FNM_PERIOD)) == (FNM_FILE_NAME | FNM_PERIOD)) diff --git a/gnulib/import/fnmatch.in.h b/gnulib/import/fnmatch.in.h index 890ee56..24359a0 100644 --- a/gnulib/import/fnmatch.in.h +++ b/gnulib/import/fnmatch.in.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2016 Free +/* Substitute for and wrapper around <fnmatch.h>. + Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -14,17 +15,31 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ -#ifndef _FNMATCH_H -#define _FNMATCH_H 1 +#ifndef _@GUARD_PREFIX@_FNMATCH_H -/* The definition of _GL_ARG_NONNULL is copied here. */ +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ -#ifdef __cplusplus -extern "C" { +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_FNMATCH_H@ && !@REPLACE_FNMATCH@ +# @INCLUDE_NEXT@ @NEXT_FNMATCH_H@ #endif +#ifndef _@GUARD_PREFIX@_FNMATCH_H +#define _@GUARD_PREFIX@_FNMATCH_H + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +#if !@HAVE_FNMATCH_H@ || @REPLACE_FNMATCH@ + /* We #undef these before defining them because some losing systems (HP-UX A.08.07 for example) define these in <unistd.h>. */ #undef FNM_PATHNAME @@ -54,14 +69,42 @@ extern "C" { # define FNM_NOSYS (-1) #endif +#endif + + +#if @GNULIB_FNMATCH@ /* Match NAME against the file name pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ -extern int fnmatch (const char *__pattern, const char *__name, - int __flags) - _GL_ARG_NONNULL ((1, 2)); - -#ifdef __cplusplus -} +# if @REPLACE_FNMATCH@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define fnmatch rpl_fnmatch +# endif +_GL_FUNCDECL_RPL (fnmatch, int, + (const char *pattern, const char *name, int flags) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (fnmatch, int, + (const char *pattern, const char *name, int flags)); +# else +# if !@HAVE_FNMATCH@ +_GL_FUNCDECL_SYS (fnmatch, int, + (const char *pattern, const char *name, int flags) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (fnmatch, int, + (const char *pattern, const char *name, int flags)); +# endif +# if !GNULIB_FNMATCH_GNU && __GLIBC__ >= 2 +_GL_CXXALIASWARN (fnmatch); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fnmatch +# if HAVE_RAW_DECL_FNMATCH +_GL_WARN_ON_USE (fnmatch, + "fnmatch does not portably work - " + "use gnulib module fnmatch for portability or gnulib module fnmatch-gnu for a glibc compatible implementation"); +# endif #endif -#endif /* fnmatch.h */ + +#endif /* _@GUARD_PREFIX@_FNMATCH_H */ +#endif /* _@GUARD_PREFIX@_FNMATCH_H */ diff --git a/gnulib/import/fnmatch_loop.c b/gnulib/import/fnmatch_loop.c index 0c2b484..82a7cee 100644 --- a/gnulib/import/fnmatch_loop.c +++ b/gnulib/import/fnmatch_loop.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1993, 1996-2006, 2009-2016 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993, 1996-2006, 2009-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Match STRING against the file name pattern PATTERN, returning zero if it matches, nonzero if not. */ @@ -960,7 +960,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, new_no_leading_period = true; break; } - /* FALLTHROUGH */ + FALLTHROUGH; default: normal_match: if (n == string_end || c != FOLD ((UCHAR) *n)) @@ -1114,8 +1114,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, case L_('*'): if (FCT (p, string, string_end, no_leading_period, flags) == 0) return 0; - /* FALLTHROUGH */ - + FALLTHROUGH; case L_('+'): do { @@ -1151,8 +1150,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, case L_('?'): if (FCT (p, string, string_end, no_leading_period, flags) == 0) return 0; - /* FALLTHROUGH */ - + FALLTHROUGH; case L_('@'): do /* I cannot believe it but 'strcat' is actually acceptable diff --git a/gnulib/import/fpucw.h b/gnulib/import/fpucw.h index 05ee0ca..91a1cbe 100644 --- a/gnulib/import/fpucw.h +++ b/gnulib/import/fpucw.h @@ -1,5 +1,5 @@ /* Manipulating the FPU control word. -*- coding: utf-8 -*- - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _FPUCW_H #define _FPUCW_H @@ -35,15 +35,15 @@ The FPU control word is under control of the application, i.e. it is not required to be set either way by the ABI. (In fact, the i386 ABI - http://refspecs.freestandards.org/elf/abi386-4.pdf page 3-12 = page 38 + https://www.linux-mips.org/pub/linux/mips/doc/ABI/abi386-4.pdf page 3-12 = page 38 is not clear about it. But in any case, gcc treats the control word like a "preserved" register: it emits code that assumes that the control word is preserved across calls, and it restores the control word at the end of functions that modify it.) - See Vincent Lefèvre's page http://www.vinc17.org/research/extended.en.html + See Vincent Lefèvre's page https://www.vinc17.net/research/extended.en.html for a good explanation. - See http://www.uwsg.iu.edu/hypermail/linux/kernel/0103.0/0453.html for + See https://web.archive.org/web/20060905133417/http://www.uwsg.iu.edu/hypermail/linux/kernel/0103.0/0453.html some argumentation which setting should be the default. */ /* This header file provides the following facilities: @@ -70,12 +70,12 @@ typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */ # define FPU_PC_DOUBLE 0x200 /* glibc calls this _FPU_DOUBLE */ # define FPU_PC_EXTENDED 0x300 /* glibc calls this _FPU_EXTENDED */ -# define GET_FPUCW() \ +# define GET_FPUCW() __extension__ \ ({ fpucw_t _cw; \ __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_cw)); \ _cw; \ }) -# define SET_FPUCW(word) \ +# define SET_FPUCW(word) __extension__ \ (void)({ fpucw_t _ncw = (word); \ __asm__ __volatile__ ("fldcw %0" : : "m" (*&_ncw)); \ }) diff --git a/gnulib/import/frexp.c b/gnulib/import/frexp.c index 5edb028..d3f1199 100644 --- a/gnulib/import/frexp.c +++ b/gnulib/import/frexp.c @@ -1,5 +1,5 @@ /* Split a double into fraction and mantissa. - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini <bonzini@gnu.org>, 2003, and Bruno Haible <bruno@clisp.org>, 2007. */ diff --git a/gnulib/import/frexpl.c b/gnulib/import/frexpl.c index 714a2ff..820cb2d 100644 --- a/gnulib/import/frexpl.c +++ b/gnulib/import/frexpl.c @@ -1,5 +1,5 @@ /* Split a 'long double' into fraction and mantissa. - Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/fstat.c b/gnulib/import/fstat.c index 435c429..a892b8f 100644 --- a/gnulib/import/fstat.c +++ b/gnulib/import/fstat.c @@ -1,5 +1,5 @@ /* fstat() replacement. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* If the user's config.h happens to include <sys/stat.h>, let it include only the system's <sys/stat.h> here, so that orig_fstat doesn't recurse to @@ -23,54 +23,45 @@ /* Get the original definition of fstat. It might be defined as a macro. */ #include <sys/types.h> #include <sys/stat.h> -#if _GL_WINDOWS_64_BIT_ST_SIZE -# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ -# define stat _stati64 -# undef fstat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ -# define fstat _fstati64 -#endif #undef __need_system_sys_stat_h +#if defined _WIN32 && ! defined __CYGWIN__ +# define WINDOWS_NATIVE +#endif + +#if !defined WINDOWS_NATIVE + static int orig_fstat (int fd, struct stat *buf) { return fstat (fd, buf); } +#endif + /* Specification. */ +#ifdef __osf__ /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include <sys/stat.h> above. */ -#include "sys/stat.h" - -#include <errno.h> -#include <unistd.h> - -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER -# include "msvc-inval.h" +# include "sys/stat.h" +#else +# include <sys/stat.h> #endif -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER -static int -fstat_nothrow (int fd, struct stat *buf) -{ - int result; +#include "stat-time.h" - TRY_MSVC_INVAL - { - result = orig_fstat (fd, buf); - } - CATCH_MSVC_INVAL - { - result = -1; - errno = EBADF; - } - DONE_MSVC_INVAL; - - return result; -} -#else -# define fstat_nothrow orig_fstat +#include <errno.h> +#include <unistd.h> +#ifdef WINDOWS_NATIVE +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif +# include "stat-w32.h" #endif int @@ -84,5 +75,20 @@ rpl_fstat (int fd, struct stat *buf) return stat (name, buf); #endif - return fstat_nothrow (fd, buf); +#ifdef WINDOWS_NATIVE + /* Fill the fields ourselves, because the original fstat function returns + values for st_atime, st_mtime, st_ctime that depend on the current time + zone. See + <https://lists.gnu.org/r/bug-gnulib/2017-04/msg00134.html> */ + HANDLE h = (HANDLE) _get_osfhandle (fd); + + if (h == INVALID_HANDLE_VALUE) + { + errno = EBADF; + return -1; + } + return _gl_fstat_by_handle (h, NULL, buf); +#else + return stat_time_normalize (orig_fstat (fd, buf), buf); +#endif } diff --git a/gnulib/import/fstatat.c b/gnulib/import/fstatat.c index ebbecfd..db864da 100644 --- a/gnulib/import/fstatat.c +++ b/gnulib/import/fstatat.c @@ -1,6 +1,6 @@ /* Work around an fstatat bug on Solaris 9. - Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert and Jim Meyering. */ @@ -28,7 +28,7 @@ #include <sys/stat.h> #undef __need_system_sys_stat_h -#if HAVE_FSTATAT +#if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG static int orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) { @@ -36,13 +36,20 @@ orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) } #endif +#ifdef __osf__ /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include <sys/stat.h> above. */ -#include "sys/stat.h" +# include "sys/stat.h" +#else +# include <sys/stat.h> +#endif + +#include "stat-time.h" #include <errno.h> #include <fcntl.h> +#include <stdlib.h> #include <string.h> #if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG @@ -51,6 +58,12 @@ orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) # define LSTAT_FOLLOWS_SLASHED_SYMLINK 0 # endif +static int +normal_fstatat (int fd, char const *file, struct stat *st, int flag) +{ + return stat_time_normalize (orig_fstatat (fd, file, st, flag), st); +} + /* fstatat should always follow symbolic links that end in /, but on Solaris 9 it doesn't if AT_SYMLINK_NOFOLLOW is specified. Likewise, trailing slash on a non-directory should be an error. @@ -63,7 +76,7 @@ orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) int rpl_fstatat (int fd, char const *file, struct stat *st, int flag) { - int result = orig_fstatat (fd, file, st, flag); + int result = normal_fstatat (fd, file, st, flag); size_t len; if (LSTAT_FOLLOWS_SLASHED_SYMLINK || result != 0) @@ -79,7 +92,7 @@ rpl_fstatat (int fd, char const *file, struct stat *st, int flag) errno = ENOTDIR; return -1; } - result = orig_fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW); + result = normal_fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW); } /* Fix stat behavior. */ if (result == 0 && !S_ISDIR (st->st_mode) && file[len - 1] == '/') @@ -111,7 +124,7 @@ stat_func (char const *name, struct stat *st) # endif /* Replacement for Solaris' function by the same name. - <http://www.google.com/search?q=fstatat+site:docs.sun.com> + <https://www.google.com/search?q=fstatat+site:docs.oracle.com> First, try to simulate it via l?stat ("/proc/self/fd/FD/FILE"). Failing that, simulate it via save_cwd/fchdir/(stat|lstat)/restore_cwd. If either the save_cwd or the restore_cwd fails (relatively unlikely), diff --git a/gnulib/import/getcwd-lgpl.c b/gnulib/import/getcwd-lgpl.c index c553f7b..1eaac78 100644 --- a/gnulib/import/getcwd-lgpl.c +++ b/gnulib/import/getcwd-lgpl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2016 Free Software Foundation, Inc. +/* Copyright (C) 2011-2019 Free Software Foundation, Inc. This file is part of gnulib. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -115,10 +115,15 @@ rpl_getcwd (char *buf, size_t size) } else { - /* Trim to fit, if possible. */ - result = realloc (buf, strlen (buf) + 1); - if (!result) - result = buf; + /* Here result == buf. */ + /* Shrink result before returning it. */ + size_t actual_size = strlen (result) + 1; + if (actual_size < size) + { + char *shrinked_result = realloc (result, actual_size); + if (shrinked_result != NULL) + result = shrinked_result; + } } return result; } diff --git a/gnulib/import/getcwd.c b/gnulib/import/getcwd.c index e1265fd..bf87809 100644 --- a/gnulib/import/getcwd.c +++ b/gnulib/import/getcwd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1999, 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 1991-1999, 2004-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if !_LIBC # include <config.h> @@ -79,6 +79,10 @@ # define MATCHING_INO(dp, ino) true #endif +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +#endif + #if !_LIBC # define __getcwd rpl_getcwd # define __lstat lstat @@ -100,6 +104,34 @@ # undef closedir #endif +#ifdef _MSC_VER +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +static char * +getcwd_nothrow (char *buf, size_t size) +{ + char *result; + + TRY_MSVC_INVAL + { + result = _getcwd (buf, size); + } + CATCH_MSVC_INVAL + { + result = NULL; + errno = ERANGE; + } + DONE_MSVC_INVAL; + + return result; +} +# else +# define getcwd_nothrow _getcwd +# endif +# define getcwd_system getcwd_nothrow +#else +# define getcwd_system getcwd +#endif + /* Get the name of the current working directory, and put it in SIZE bytes of BUF. Returns NULL if the directory couldn't be determined or SIZE was too small. If successful, returns BUF. In GNU, if BUF is @@ -155,7 +187,7 @@ __getcwd (char *buf, size_t size) this wrong result with errno = 0. */ # undef getcwd - dir = getcwd (buf, size); + dir = getcwd_system (buf, size); if (dir || (size && errno == ERANGE)) return dir; @@ -166,7 +198,7 @@ __getcwd (char *buf, size_t size) if (errno == EINVAL && buf == NULL && size == 0) { char big_buffer[BIG_FILE_NAME_LENGTH + 1]; - dir = getcwd (big_buffer, sizeof big_buffer); + dir = getcwd_system (big_buffer, sizeof big_buffer); if (dir) return strdup (dir); } @@ -411,7 +443,7 @@ __getcwd (char *buf, size_t size) if (size == 0) /* Ensure that the buffer is only as large as necessary. */ - buf = realloc (dir, used); + buf = (used < allocated ? realloc (dir, used) : dir); if (buf == NULL) /* Either buf was NULL all along, or 'realloc' failed but diff --git a/gnulib/import/getdtablesize.c b/gnulib/import/getdtablesize.c index d234055..03a9243 100644 --- a/gnulib/import/getdtablesize.c +++ b/gnulib/import/getdtablesize.c @@ -1,5 +1,5 @@ -/* getdtablesize() function for platforms that don't have it. - Copyright (C) 2008-2016 Free Software Foundation, Inc. +/* getdtablesize() function: Return maximum possible file descriptor value + 1. + Copyright (C) 2008-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,18 +13,20 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include <unistd.h> -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ # include <stdio.h> -# include "msvc-inval.h" +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +# endif # if HAVE_MSVC_INVALID_PARAMETER_HANDLER static int @@ -44,7 +46,8 @@ _setmaxstdio_nothrow (int newmax) return result; } -# define _setmaxstdio _setmaxstdio_nothrow +# else +# define _setmaxstdio_nothrow _setmaxstdio # endif /* Cache for the previous getdtablesize () result. Safe to cache because @@ -76,9 +79,9 @@ getdtablesize (void) freed when we call _setmaxstdio with the original value. */ int orig_max_stdio = _getmaxstdio (); unsigned int bound; - for (bound = 0x10000; _setmaxstdio (bound) < 0; bound = bound / 2) + for (bound = 0x10000; _setmaxstdio_nothrow (bound) < 0; bound = bound / 2) ; - _setmaxstdio (orig_max_stdio); + _setmaxstdio_nothrow (orig_max_stdio); dtablesize = bound; } return dtablesize; diff --git a/gnulib/import/getlogin_r.c b/gnulib/import/getlogin_r.c index 2bafb55..a94282c 100644 --- a/gnulib/import/getlogin_r.c +++ b/gnulib/import/getlogin_r.c @@ -1,6 +1,6 @@ /* Provide a working getlogin_r for systems which lack it. - Copyright (C) 2005-2007, 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2010-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert, Derek Price, and Bruno Haible. */ @@ -25,7 +25,9 @@ #include <errno.h> #include <string.h> -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#include "malloca.h" + +#if defined _WIN32 && ! defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN # include <windows.h> #else @@ -39,7 +41,7 @@ int getlogin_r (char *name, size_t size) { #undef getlogin_r -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ /* Native Windows platform. */ DWORD sz; @@ -63,9 +65,27 @@ getlogin_r (char *name, size_t size) /* Platform with a getlogin_r() function. */ int ret = getlogin_r (name, size); - if (ret == 0 && memchr (name, '\0', size) == NULL) - /* name contains a truncated result. */ - return ERANGE; + if (ret == 0) + { + const char *nul = memchr (name, '\0', size); + if (nul == NULL) + /* name contains a truncated result. */ + return ERANGE; + if (size > 0 && nul == name + size - 1) + { + /* strlen(name) == size-1. Determine whether the untruncated result + would have had length size-1 or size. */ + char *room = (char *) malloca (size + 1); + if (room == NULL) + return ENOMEM; + ret = getlogin_r (room, size + 1); + /* The untruncated result should be the same as in the first call. */ + if (ret == 0 && memcmp (name, room, size) != 0) + /* The untruncated result would have been different. */ + ret = ERANGE; + freea (room); + } + } return ret; #else /* Platform with a getlogin() function. */ diff --git a/gnulib/import/getprogname.c b/gnulib/import/getprogname.c index a7246e9..de8f49a 100644 --- a/gnulib/import/getprogname.c +++ b/gnulib/import/getprogname.c @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2016 Free Software Foundation, Inc. + Copyright (C) 2016-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -43,6 +43,14 @@ # include <string.h> #endif +#ifdef __sgi +# include <string.h> +# include <unistd.h> +# include <stdio.h> +# include <fcntl.h> +# include <sys/procfs.h> +#endif + #include "dirname.h" #ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */ @@ -56,17 +64,17 @@ getprogname (void) /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */ return last_component (program_invocation_name); # elif HAVE_GETEXECNAME /* Solaris */ - /* http://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrb1/index.html */ + /* https://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrb1/index.html */ const char *p = getexecname (); if (!p) p = "?"; return last_component (p); # elif HAVE_DECL___ARGV /* mingw, MSVC */ - /* https://msdn.microsoft.com/en-us/library/dn727674.aspx */ + /* https://docs.microsoft.com/en-us/cpp/c-runtime-library/argc-argv-wargv */ const char *p = __argv && __argv[0] ? __argv[0] : "?"; return last_component (p); -# elif HAVE_VAR___PROGNAME /* OpenBSD, QNX */ - /* http://man.openbsd.org/style.9 */ +# elif HAVE_VAR___PROGNAME /* OpenBSD, Android, QNX */ + /* https://man.openbsd.org/style.9 */ /* http://www.qnx.de/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_lib_ref%2Fp%2F__progname.html */ /* Be careful to declare this only when we absolutely need it (OpenBSD 5.1), rather than when it's available. Otherwise, @@ -74,12 +82,15 @@ getprogname (void) malfunction (have zero length) with Fedora 25's glibc. */ extern char *__progname; const char *p = __progname; +# if defined __ANDROID__ + return last_component (p); +# else return p && p[0] ? p : "?"; +# endif # elif _AIX /* 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 + https://lists.gnu.org/r/bug-gnulib/2010-12/msg00095.html + Reference: https://www.ibm.com/support/knowledgecenter/en/ssw_aix_61/com.ibm.aix.basetrf1/getprocs.htm */ static char *p; static int first = 1; @@ -103,9 +114,73 @@ getprogname (void) first = 0; pid_t pid = getpid (); struct pst_status status; - p = (0 < pstat_getproc (&status, sizeof status, 0, pid) - ? strdup (status.pst_ucomm) - : NULL); + if (pstat_getproc (&status, sizeof status, 0, pid) > 0) + { + char *ucomm = status.pst_ucomm; + char *cmd = status.pst_cmd; + if (strlen (ucomm) < PST_UCOMMLEN - 1) + p = ucomm; + else + { + /* ucomm is truncated to length PST_UCOMMLEN - 1. + Look at cmd instead. */ + char *space = strchr (cmd, ' '); + if (space != NULL) + *space = '\0'; + p = strrchr (cmd, '/'); + if (p != NULL) + p++; + else + p = cmd; + if (strlen (p) > PST_UCOMMLEN - 1 + && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0) + /* p is less truncated than ucomm. */ + ; + else + p = ucomm; + } + p = strdup (p); + } + else + { +# if !defined __LP64__ + /* Support for 32-bit programs running in 64-bit HP-UX. + The documented way to do this is to use the same source code + as above, but in a compilation unit where '#define _PSTAT64 1' + is in effect. I prefer a single compilation unit; the struct + size and the offsets are not going to change. */ + char status64[1216]; + if (__pstat_getproc64 (status64, sizeof status64, 0, pid) > 0) + { + char *ucomm = status64 + 288; + char *cmd = status64 + 168; + if (strlen (ucomm) < PST_UCOMMLEN - 1) + p = ucomm; + else + { + /* ucomm is truncated to length PST_UCOMMLEN - 1. + Look at cmd instead. */ + char *space = strchr (cmd, ' '); + if (space != NULL) + *space = '\0'; + p = strrchr (cmd, '/'); + if (p != NULL) + p++; + else + p = cmd; + if (strlen (p) > PST_UCOMMLEN - 1 + && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0) + /* p is less truncated than ucomm. */ + ; + else + p = ucomm; + } + p = strdup (p); + } + else +# endif + p = NULL; + } if (!p) p = "?"; } @@ -143,9 +218,43 @@ getprogname (void) free (buf.ps_pathptr); } return p; +# elif defined __sgi /* IRIX */ + char filename[50]; + int fd; + + sprintf (filename, "/proc/pinfo/%d", (int) getpid ()); + fd = open (filename, O_RDONLY); + if (0 <= fd) + { + prpsinfo_t buf; + int ioctl_ok = 0 <= ioctl (fd, PIOCPSINFO, &buf); + close (fd); + if (ioctl_ok) + { + char *name = buf.pr_fname; + size_t namesize = sizeof buf.pr_fname; + /* It may not be NUL-terminated. */ + char *namenul = memchr (name, '\0', namesize); + size_t namelen = namenul ? namenul - name : namesize; + char *namecopy = malloc (namelen + 1); + if (namecopy) + { + namecopy[namelen] = '\0'; + return memcpy (namecopy, name, namelen); + } + } + } + return NULL; # else # error "getprogname module not ported to this OS" # endif } #endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/gnulib/import/getprogname.h b/gnulib/import/getprogname.h index e8f9e97..1590b38 100644 --- a/gnulib/import/getprogname.h +++ b/gnulib/import/getprogname.h @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2016 Free Software Foundation, Inc. + Copyright (C) 2016-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _GL_GETPROGNAME_H #define _GL_GETPROGNAME_H diff --git a/gnulib/import/gettext.h b/gnulib/import/gettext.h index 9a232cc..c7c0fdb 100644 --- a/gnulib/import/gettext.h +++ b/gnulib/import/gettext.h @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2016 Free Software + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,13 +13,14 @@ 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 <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 -/* NLS can be disabled through the configure --disable-nls option. */ -#if ENABLE_NLS +/* NLS can be disabled through the configure --disable-nls option + or through "#define ENABLE NLS 0" before including this file. */ +#if defined ENABLE_NLS && ENABLE_NLS /* Get declarations of GNU message catalog functions. */ # include <libintl.h> @@ -183,8 +184,16 @@ npgettext_aux (const char *domain, #include <string.h> -#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ - /* || __STDC_VERSION__ >= 199901L */ ) +/* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported. + This relates to the -Wvla and -Wvla-larger-than warnings, enabled in + the default GCC many warnings set. This allows programs to disable use + of VLAs, which may be unintended, or may be awkward to support portably, + or may have security implications due to non-deterministic stack usage. */ + +#if (!defined GNULIB_NO_VLA \ + && (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ + /* || (__STDC_VERSION__ == 199901L && !defined __HP_cc) + || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )) # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1 #else # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0 diff --git a/gnulib/import/gettimeofday.c b/gnulib/import/gettimeofday.c index 224ca6a..e728bf4 100644 --- a/gnulib/import/gettimeofday.c +++ b/gnulib/import/gettimeofday.c @@ -1,6 +1,6 @@ /* Provide gettimeofday for systems that don't have it or for which it's broken. - Copyright (C) 2001-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ @@ -24,93 +24,99 @@ #include <time.h> -#if HAVE_SYS_TIMEB_H -# include <sys/timeb.h> +#if defined _WIN32 && ! defined __CYGWIN__ +# define WINDOWS_NATIVE +# include <windows.h> #endif -#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME +#include "localtime-buffer.h" -/* Work around the bug in some systems whereby gettimeofday clobbers - the static buffer that localtime uses for its return value. The - gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has - this problem. The tzset replacement is necessary for at least - Solaris 2.5, 2.5.1, and 2.6. */ - -static struct tm tm_zero_buffer; -static struct tm *localtime_buffer_addr = &tm_zero_buffer; +#ifdef WINDOWS_NATIVE -# undef localtime -extern struct tm *localtime (time_t const *); +/* Avoid warnings from gcc -Wcast-function-type. */ +# define GetProcAddress \ + (void *) GetProcAddress -# undef gmtime -extern struct tm *gmtime (time_t const *); +/* GetSystemTimePreciseAsFileTime was introduced only in Windows 8. */ +typedef void (WINAPI * GetSystemTimePreciseAsFileTimeFuncType) (FILETIME *lpTime); +static GetSystemTimePreciseAsFileTimeFuncType GetSystemTimePreciseAsFileTimeFunc = NULL; +static BOOL initialized = FALSE; -/* This is a wrapper for localtime. It is used only on systems for which - gettimeofday clobbers the static buffer used for localtime's result. - - On the first call, record the address of the static buffer that - localtime uses for its result. */ - -struct tm * -rpl_localtime (time_t const *timep) +static void +initialize (void) { - struct tm *tm = localtime (timep); - - if (localtime_buffer_addr == &tm_zero_buffer) - localtime_buffer_addr = tm; - - return tm; -} - -/* Same as above, since gmtime and localtime use the same buffer. */ -struct tm * -rpl_gmtime (time_t const *timep) -{ - struct tm *tm = gmtime (timep); - - if (localtime_buffer_addr == &tm_zero_buffer) - localtime_buffer_addr = tm; - - return tm; + HMODULE kernel32 = LoadLibrary ("kernel32.dll"); + if (kernel32 != NULL) + { + GetSystemTimePreciseAsFileTimeFunc = + (GetSystemTimePreciseAsFileTimeFuncType) GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime"); + } + initialized = TRUE; } -#endif /* GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME */ - -#if TZSET_CLOBBERS_LOCALTIME - -# undef tzset -extern void tzset (void); - -/* This is a wrapper for tzset, for systems on which tzset may clobber - the static buffer used for localtime's result. */ -void -rpl_tzset (void) -{ - /* Save and restore the contents of the buffer used for localtime's - result around the call to tzset. */ - struct tm save = *localtime_buffer_addr; - tzset (); - *localtime_buffer_addr = save; -} #endif /* This is a wrapper for gettimeofday. It is used only on systems that lack this function, or whose implementation of this function - causes problems. */ + causes problems. + Work around the bug in some systems whereby gettimeofday clobbers + the static buffer that localtime uses for its return value. The + gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has + this problem. */ int gettimeofday (struct timeval *restrict tv, void *restrict tz) { #undef gettimeofday -#if HAVE_GETTIMEOFDAY -# if GETTIMEOFDAY_CLOBBERS_LOCALTIME +#ifdef WINDOWS_NATIVE + + /* On native Windows, there are two ways to get the current time: + GetSystemTimeAsFileTime + <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime> + or + GetSystemTimePreciseAsFileTime + <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>. + GetSystemTimeAsFileTime produces values that jump by increments of + 15.627 milliseconds (!) on average. + Whereas GetSystemTimePreciseAsFileTime values usually jump by 1 or 2 + microseconds. + More discussion on this topic: + <http://www.windowstimestamp.com/description>. */ + FILETIME current_time; + + if (!initialized) + initialize (); + if (GetSystemTimePreciseAsFileTimeFunc != NULL) + GetSystemTimePreciseAsFileTimeFunc (¤t_time); + else + GetSystemTimeAsFileTime (¤t_time); + + /* Convert from FILETIME to 'struct timeval'. */ + /* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */ + ULONGLONG since_1601 = + ((ULONGLONG) current_time.dwHighDateTime << 32) + | (ULONGLONG) current_time.dwLowDateTime; + /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 leap + years, in total 134774 days. */ + ULONGLONG since_1970 = + since_1601 - (ULONGLONG) 134774 * (ULONGLONG) 86400 * (ULONGLONG) 10000000; + ULONGLONG microseconds_since_1970 = since_1970 / (ULONGLONG) 10; + tv->tv_sec = microseconds_since_1970 / (ULONGLONG) 1000000; + tv->tv_usec = microseconds_since_1970 % (ULONGLONG) 1000000; + + return 0; + +#else + +# if HAVE_GETTIMEOFDAY +# if GETTIMEOFDAY_CLOBBERS_LOCALTIME /* Save and restore the contents of the buffer used for localtime's result around the call to gettimeofday. */ struct tm save = *localtime_buffer_addr; -# endif +# endif -# if defined timeval /* 'struct timeval' overridden by gnulib? */ -# undef timeval +# if defined timeval /* 'struct timeval' overridden by gnulib? */ +# undef timeval struct timeval otv; int result = gettimeofday (&otv, (struct timezone *) tz); if (result == 0) @@ -118,25 +124,16 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz) tv->tv_sec = otv.tv_sec; tv->tv_usec = otv.tv_usec; } -# else +# else int result = gettimeofday (tv, (struct timezone *) tz); -# endif +# endif -# if GETTIMEOFDAY_CLOBBERS_LOCALTIME +# if GETTIMEOFDAY_CLOBBERS_LOCALTIME *localtime_buffer_addr = save; -# endif +# endif return result; -#else - -# if HAVE__FTIME - - struct _timeb timebuf; - _ftime (&timebuf); - tv->tv_sec = timebuf.time; - tv->tv_usec = timebuf.millitm * 1000; - # else # if !defined OK_TO_USE_1S_CLOCK @@ -146,9 +143,8 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz) tv->tv_sec = time (NULL); tv->tv_usec = 0; -# endif - return 0; +# endif #endif } diff --git a/gnulib/import/glob-libc.h b/gnulib/import/glob-libc.h index 6256077..9b7f93e 100644 --- a/gnulib/import/glob-libc.h +++ b/gnulib/import/glob-libc.h @@ -1,19 +1,19 @@ -/* Copyright (C) 1991-1992, 1995-1998, 2000-2001, 2004-2007, 2009-2016 Free - Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ #ifndef _GLOB_H #define _GLOB_H 1 @@ -22,42 +22,10 @@ # include <sys/cdefs.h> #endif -/* GCC 2.95 and later have "__restrict"; C99 compilers have - "restrict", and "configure" may have defined "restrict". - Other compilers use __restrict, __restrict__, and _Restrict, and - 'configure' might #define 'restrict' to those words, so pick a - different name. */ -#ifndef _Restrict_ -# if 199901L <= __STDC_VERSION__ -# define _Restrict_ restrict -# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__) -# define _Restrict_ __restrict -# else -# define _Restrict_ -# endif -#endif - __BEGIN_DECLS -/* We need 'size_t' for the following definitions. */ -#ifndef __size_t -# if defined __GNUC__ && __GNUC__ >= 2 -typedef __SIZE_TYPE__ __size_t; -# ifdef __USE_XOPEN -typedef __SIZE_TYPE__ size_t; -# endif -# else -# include <stddef.h> -# ifndef __size_t -# define __size_t size_t -# endif -# endif -#else -/* The GNU CC stddef.h version defines __size_t as empty. We need a real - definition. */ -# undef __size_t -# define __size_t size_t -#endif +#define __need_size_t +#include <stddef.h> /* Bits set in the FLAGS argument to 'glob'. */ #define GLOB_ERR (1 << 0)/* Return on read errors. */ @@ -69,7 +37,7 @@ typedef __SIZE_TYPE__ size_t; #define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ #define GLOB_PERIOD (1 << 7)/* Leading '.' can be matched by metachars. */ -#if !defined __USE_POSIX2 || defined __USE_BSD || defined __USE_GNU +#if !defined __USE_POSIX2 || defined __USE_MISC # define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */ # define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ @@ -105,9 +73,9 @@ struct stat; #endif typedef struct { - __size_t gl_pathc; /* Count of paths matched by the pattern. */ + size_t gl_pathc; /* Count of paths matched by the pattern. */ char **gl_pathv; /* List of matched pathnames. */ - __size_t gl_offs; /* Slots to reserve in 'gl_pathv'. */ + size_t gl_offs; /* Slots to reserve in 'gl_pathv'. */ int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ /* If the GLOB_ALTDIRFUNC flag is set, the following functions @@ -120,23 +88,23 @@ typedef struct #endif void *(*gl_opendir) (const char *); #ifdef __USE_GNU - int (*gl_lstat) (const char *_Restrict_, struct stat *_Restrict_); - int (*gl_stat) (const char *_Restrict_, struct stat *_Restrict_); + int (*gl_lstat) (const char *__restrict, struct stat *__restrict); + int (*gl_stat) (const char *__restrict, struct stat *__restrict); #else - int (*gl_lstat) (const char *_Restrict_, void *_Restrict_); - int (*gl_stat) (const char *_Restrict_, void *_Restrict_); + int (*gl_lstat) (const char *__restrict, void *__restrict); + int (*gl_stat) (const char *__restrict, void *__restrict); #endif } glob_t; -#if defined __USE_LARGEFILE64 && !defined __GLOB_GNULIB +#ifdef __USE_LARGEFILE64 # ifdef __USE_GNU struct stat64; # endif typedef struct { - __size_t gl_pathc; + size_t gl_pathc; char **gl_pathv; - __size_t gl_offs; + size_t gl_offs; int gl_flags; /* If the GLOB_ALTDIRFUNC flag is set, the following functions @@ -149,20 +117,15 @@ typedef struct # endif void *(*gl_opendir) (const char *); # ifdef __USE_GNU - int (*gl_lstat) (const char *_Restrict_, struct stat64 *_Restrict_); - int (*gl_stat) (const char *_Restrict_, struct stat64 *_Restrict_); + int (*gl_lstat) (const char *__restrict, struct stat64 *__restrict); + int (*gl_stat) (const char *__restrict, struct stat64 *__restrict); # else - int (*gl_lstat) (const char *_Restrict_, void *_Restrict_); - int (*gl_stat) (const char *_Restrict_, void *_Restrict_); + int (*gl_lstat) (const char *__restrict, void *__restrict); + int (*gl_stat) (const char *__restrict, void *__restrict); # endif } glob64_t; #endif -#if __USE_FILE_OFFSET64 && __GNUC__ < 2 && !defined __GLOB_GNULIB -# define glob glob64 -# define globfree globfree64 -#endif - /* Do glob searching for PATTERN, placing results in PGLOB. The bits defined above may be set in FLAGS. If a directory cannot be opened or read and ERRFUNC is not nil, @@ -171,29 +134,28 @@ typedef struct 'glob' returns GLOB_ABEND; if it returns zero, the error is ignored. If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. Otherwise, 'glob' returns zero. */ -#if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2 || defined __GLOB_GNULIB -extern int glob (const char *_Restrict_ __pattern, int __flags, +#if !defined __USE_FILE_OFFSET64 || defined __GLOB_GNULIB +extern int glob (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), - glob_t *_Restrict_ __pglob) __THROW _GL_ARG_NONNULL ((1, 4)); + glob_t *__restrict __pglob) __THROW; /* Free storage allocated in PGLOB by a previous 'glob' call. */ -extern void globfree (glob_t *__pglob) __THROW _GL_ARG_NONNULL ((1)); +extern void globfree (glob_t *__pglob) __THROW; #else -extern int __REDIRECT_NTH (glob, (const char *_Restrict_ __pattern, +extern int __REDIRECT_NTH (glob, (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), - glob_t *_Restrict_ __pglob), glob64); + glob_t *__restrict __pglob), glob64); extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64); #endif -#if defined __USE_LARGEFILE64 && !defined __GLOB_GNULIB -extern int glob64 (const char *_Restrict_ __pattern, int __flags, +#ifdef __USE_LARGEFILE64 +extern int glob64 (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), - glob64_t *_Restrict_ __pglob) - __THROW _GL_ARG_NONNULL ((1, 4)); + glob64_t *__restrict __pglob) __THROW; -extern void globfree64 (glob64_t *__pglob) __THROW _GL_ARG_NONNULL ((1)); +extern void globfree64 (glob64_t *__pglob) __THROW; #endif @@ -203,8 +165,7 @@ extern void globfree64 (glob64_t *__pglob) __THROW _GL_ARG_NONNULL ((1)); This function is not part of the interface specified by POSIX.2 but several programs want to use it. */ -extern int glob_pattern_p (const char *__pattern, int __quote) - __THROW _GL_ARG_NONNULL ((1)); +extern int glob_pattern_p (const char *__pattern, int __quote) __THROW; #endif __END_DECLS diff --git a/gnulib/import/glob.c b/gnulib/import/glob.c index 416d210..6f57860 100644 --- a/gnulib/import/glob.c +++ b/gnulib/import/glob.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,13 +13,16 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _LIBC + /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc - optimizes away the pattern == NULL || pglob == NULL tests below. */ + optimizes away the pattern == NULL test below. */ # define _GL_ARG_NONNULL(params) + # include <config.h> + #endif #include <glob.h> @@ -30,21 +33,10 @@ #include <stdbool.h> #include <stddef.h> #include <stdint.h> - -/* Outcomment the following line for production quality code. */ -/* #define NDEBUG 1 */ #include <assert.h> - -#include <stdio.h> /* Needed on stupid SunOS for assert. */ - -#ifndef GLOB_ONLY_P - #include <unistd.h> -#if !defined POSIX && defined _POSIX_VERSION -# define POSIX -#endif -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ # define WINDOWS32 #endif @@ -53,10 +45,6 @@ #endif #include <errno.h> -#ifndef __set_errno -# define __set_errno(val) errno = (val) -#endif - #include <dirent.h> #include <stdlib.h> #include <string.h> @@ -70,13 +58,20 @@ # define opendir(name) __opendir (name) # define readdir(str) __readdir64 (str) # define getpwnam_r(name, bufp, buf, len, res) \ - __getpwnam_r (name, bufp, buf, len, res) + __getpwnam_r (name, bufp, buf, len, res) +# ifndef __lstat64 +# define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf) +# endif # ifndef __stat64 # define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf) # endif # define struct_stat64 struct stat64 +# define FLEXIBLE_ARRAY_MEMBER +# include <shlib-compat.h> #else /* !_LIBC */ +# define __glob glob # define __getlogin_r(buf, len) getlogin_r (buf, len) +# define __lstat64(fname, buf) lstat (fname, buf) # define __stat64(fname, buf) stat (fname, buf) # define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag) # define struct_stat64 struct stat @@ -84,94 +79,63 @@ # define __alloca alloca # endif # define __readdir readdir -# define __glob_pattern_p glob_pattern_p # define COMPILE_GLOB64 #endif /* _LIBC */ #include <fnmatch.h> -#include "flexmember.h" - -#ifdef _SC_GETPW_R_SIZE_MAX -# define GETPW_R_SIZE_MAX() sysconf (_SC_GETPW_R_SIZE_MAX) -#else -# define GETPW_R_SIZE_MAX() (-1) -#endif -#ifdef _SC_LOGIN_NAME_MAX -# define GET_LOGIN_NAME_MAX() sysconf (_SC_LOGIN_NAME_MAX) -#else -# define GET_LOGIN_NAME_MAX() (-1) -#endif +#include <flexmember.h> +#include <glob_internal.h> +#include <scratch_buffer.h> static const char *next_brace_sub (const char *begin, int flags) __THROWNL; +/* The type of ((struct dirent *) 0)->d_type is 'unsigned char' on most + platforms, but 'unsigned int' in the mingw from mingw.org. */ +typedef uint_fast32_t dirent_type; + +#if !defined _LIBC && !defined HAVE_STRUCT_DIRENT_D_TYPE +/* Any distinct values will do here. + Undef any existing macros out of the way. */ +# undef DT_UNKNOWN +# undef DT_DIR +# undef DT_LNK +# define DT_UNKNOWN 0 +# define DT_DIR 1 +# define DT_LNK 2 +#endif + /* A representation of a directory entry which does not depend on the layout of struct dirent, or the size of ino_t. */ struct readdir_result { const char *name; -# if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE - uint8_t type; -# endif - bool skip_entry; +#if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE + dirent_type type; +#endif }; -# if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE -/* Initializer based on the d_type member of struct dirent. */ -# define D_TYPE_TO_RESULT(source) (source)->d_type, - -/* True if the directory entry D might be a symbolic link. */ -static bool -readdir_result_might_be_symlink (struct readdir_result d) -{ - return d.type == DT_UNKNOWN || d.type == DT_LNK; -} - -/* True if the directory entry D might be a directory. */ -static bool -readdir_result_might_be_dir (struct readdir_result d) -{ - return d.type == DT_DIR || readdir_result_might_be_symlink (d); -} -# else /* defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE */ -# define D_TYPE_TO_RESULT(source) - -/* If we do not have type information, symbolic links and directories - are always a possibility. */ - -static bool -readdir_result_might_be_symlink (struct readdir_result d) -{ - return true; -} - -static bool -readdir_result_might_be_dir (struct readdir_result d) +/* Initialize and return type member of struct readdir_result. */ +static dirent_type +readdir_result_type (struct readdir_result d) { - return true; +#if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE +# define D_TYPE_TO_RESULT(source) (source)->d_type, + return d.type; +#else +# define D_TYPE_TO_RESULT(source) + return DT_UNKNOWN; +#endif } -# endif /* defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE */ - -# if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__ -/* Initializer for skip_entry. POSIX does not require that the d_ino - field be present, and some systems do not provide it. */ -# define D_INO_TO_RESULT(source) false, -# else -# define D_INO_TO_RESULT(source) (source)->d_ino == 0, -# endif - /* Construct an initializer for a struct readdir_result object from a struct dirent *. No copy of the name is made. */ #define READDIR_RESULT_INITIALIZER(source) \ { \ source->d_name, \ D_TYPE_TO_RESULT (source) \ - D_INO_TO_RESULT (source) \ } -#endif /* !defined GLOB_ONLY_P */ - /* Call gl_readdir on STREAM. This macro can be overridden to reduce type safety if an old interface version needs to be supported. */ #ifndef GL_READDIR @@ -209,27 +173,6 @@ convert_dirent64 (const struct dirent64 *source) } #endif - -#ifndef attribute_hidden -# define attribute_hidden -#endif - -#ifndef __attribute_noinline__ -# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1) -# define __attribute_noinline__ /* Ignore */ -#else -# define __attribute_noinline__ __attribute__ ((__noinline__)) -# endif -#endif - -#if ! defined __builtin_expect && __GNUC__ < 3 -# define __builtin_expect(expr, expected) (expr) -#endif - -#ifndef __glibc_unlikely -# define __glibc_unlikely(expr) __builtin_expect (expr, 0) -#endif - #ifndef _LIBC /* The results of opendir() in this file are not used with dirfd and fchdir, and we do not leak fds to any single-threaded code that could use stdio, @@ -250,18 +193,37 @@ convert_dirent64 (const struct dirent64 *source) ((void) (buf), (void) (len), (void) (newlen), (void) (avar), (void *) 0) #endif -#ifndef __has_builtin -# define __has_builtin(x) 0 +static int +glob_lstat (glob_t *pglob, int flags, const char *fullname) +{ +/* Use on glob-lstat-compat.c to provide a compat symbol which does not + use lstat / gl_lstat. */ +#ifdef GLOB_NO_LSTAT +# define GL_LSTAT gl_stat +# define LSTAT64 __stat64 +#else +# define GL_LSTAT gl_lstat +# define LSTAT64 __lstat64 #endif + union + { + struct stat st; + struct_stat64 st64; + } ust; + return (__glibc_unlikely (flags & GLOB_ALTDIRFUNC) + ? pglob->GL_LSTAT (fullname, &ust.st) + : LSTAT64 (fullname, &ust.st64)); +} + /* Set *R = A + B. Return true if the answer is mathematically incorrect due to overflow; in this case, *R is the low order - bits of the correct answer.. */ + bits of the correct answer. */ static bool size_add_wrapv (size_t a, size_t b, size_t *r) { -#if 5 <= __GNUC__ || __has_builtin (__builtin_add_overflow) +#if 5 <= __GNUC__ && !defined __ICC return __builtin_add_overflow (a, b, r); #else *r = a + b; @@ -280,14 +242,22 @@ glob_use_alloca (size_t alloca_used, size_t len) static int glob_in_dir (const char *pattern, const char *directory, int flags, int (*errfunc) (const char *, int), glob_t *pglob, size_t alloca_used); -extern int __glob_pattern_type (const char *pattern, int quote) - attribute_hidden; - -#ifndef GLOB_ONLY_P static int prefix_array (const char *prefix, char **array, size_t n) __THROWNL; static int collated_compare (const void *, const void *) __THROWNL; +/* Return true if FILENAME is a directory or a symbolic link to a directory. + Use FLAGS and PGLOB to resolve the filename. */ +static bool +is_dir (char const *filename, int flags, glob_t const *pglob) +{ + struct stat st; + struct_stat64 st64; + return (__glibc_unlikely (flags & GLOB_ALTDIRFUNC) + ? pglob->gl_stat (filename, &st) == 0 && S_ISDIR (st.st_mode) + : __stat64 (filename, &st64) == 0 && S_ISDIR (st64.st_mode)); +} + /* Find the end of the sub-pattern in a brace expression. */ static const char * next_brace_sub (const char *cp, int flags) @@ -312,7 +282,9 @@ next_brace_sub (const char *cp, int flags) return *cp != '\0' ? cp : NULL; } -#endif /* !defined GLOB_ONLY_P */ +#ifndef GLOB_ATTRIBUTE +# define GLOB_ATTRIBUTE +#endif /* Do glob searching for PATTERN, placing results in PGLOB. The bits defined above may be set in FLAGS. @@ -323,11 +295,9 @@ next_brace_sub (const char *cp, int flags) If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. Otherwise, 'glob' returns zero. */ int -#ifdef GLOB_ATTRIBUTE GLOB_ATTRIBUTE -#endif -glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - glob_t *pglob) +__glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + glob_t *pglob) { const char *filename; char *dirname = NULL; @@ -357,6 +327,28 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), also makes all the code that uses gl_offs simpler. */ pglob->gl_offs = 0; + if (!(flags & GLOB_APPEND)) + { + pglob->gl_pathc = 0; + if (!(flags & GLOB_DOOFFS)) + pglob->gl_pathv = NULL; + else + { + size_t i; + + if (pglob->gl_offs >= ~((size_t) 0) / sizeof (char *)) + return GLOB_NOSPACE; + + pglob->gl_pathv = (char **) malloc ((pglob->gl_offs + 1) + * sizeof (char *)); + if (pglob->gl_pathv == NULL) + return GLOB_NOSPACE; + + for (i = 0; i <= pglob->gl_offs; ++i) + pglob->gl_pathv[i] = NULL; + } + } + if (flags & GLOB_BRACE) { const char *begin; @@ -386,7 +378,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), if (begin != NULL) { /* Allocate working buffer large enough for our work. Note that - we have at least an opening and closing brace. */ + we have at least an opening and closing brace. */ size_t firstc; char *alt_start; const char *p; @@ -402,14 +394,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), { onealt = malloc (pattern_len); if (onealt == NULL) - { - if (!(flags & GLOB_APPEND)) - { - pglob->gl_pathc = 0; - pglob->gl_pathv = NULL; - } - return GLOB_NOSPACE; - } + return GLOB_NOSPACE; } /* We know the prefix for all sub-patterns. */ @@ -424,7 +409,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), illegal_brace: if (__glibc_unlikely (!alloca_onealt)) free (onealt); - return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob); + flags &= ~GLOB_BRACE; + goto no_brace; } /* Now find the end of the whole brace expression. */ @@ -445,14 +431,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), points past the final }. We will accumulate result names from recursive runs for each brace alternative in the buffer using GLOB_APPEND. */ - - if (!(flags & GLOB_APPEND)) - { - /* This call is to set a new vector, so clear out the - vector so we can append to it. */ - pglob->gl_pathc = 0; - pglob->gl_pathv = NULL; - } firstc = pglob->gl_pathc; p = begin + 1; @@ -463,9 +441,10 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), /* Construct the new glob expression. */ mempcpy (mempcpy (alt_start, p, next - p), rest, rest_len); - result = glob (onealt, - ((flags & ~(GLOB_NOCHECK | GLOB_NOMAGIC)) - | GLOB_APPEND), errfunc, pglob); + result = __glob (onealt, + ((flags & ~(GLOB_NOCHECK | GLOB_NOMAGIC)) + | GLOB_APPEND), + errfunc, pglob); /* If we got an error, return it. */ if (result && result != GLOB_NOMATCH) @@ -500,31 +479,12 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), } } - if (!(flags & GLOB_APPEND)) - { - pglob->gl_pathc = 0; - if (!(flags & GLOB_DOOFFS)) - pglob->gl_pathv = NULL; - else - { - size_t i; - - if (pglob->gl_offs >= SIZE_MAX / sizeof (char *)) - return GLOB_NOSPACE; - - pglob->gl_pathv = malloc ((pglob->gl_offs + 1) * sizeof (char *)); - if (pglob->gl_pathv == NULL) - return GLOB_NOSPACE; - - for (i = 0; i <= pglob->gl_offs; ++i) - pglob->gl_pathv[i] = NULL; - } - } - + no_brace: oldcount = pglob->gl_pathc + pglob->gl_offs; /* Find the filename. */ filename = strrchr (pattern, '/'); + #if defined __MSDOS__ || defined WINDOWS32 /* The case of "d:pattern". Since ':' is not allowed in file names, we can safely assume that wherever it @@ -533,6 +493,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), if (filename == NULL) filename = strchr (pattern, ':'); #endif /* __MSDOS__ || WINDOWS32 */ + dirname_modified = 0; if (filename == NULL) { @@ -557,11 +518,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), } filename = pattern; -#ifdef _AMIGA - dirname = (char *) ""; -#else dirname = (char *) "."; -#endif dirlen = 0; } } @@ -596,6 +553,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), from "d:/", since "d:" and "d:/" are not the same.*/ } #endif + if (glob_use_alloca (alloca_used, dirlen + 1)) newp = alloca_account (dirlen + 1, alloca_used); else @@ -609,17 +567,19 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), dirname = newp; ++filename; - if (filename[0] == '\0' #if defined __MSDOS__ || defined WINDOWS32 - && dirname[dirlen - 1] != ':' - && (dirlen < 3 || dirname[dirlen - 2] != ':' - || dirname[dirlen - 1] != '/') + bool drive_root = (dirlen > 1 + && (dirname[dirlen - 1] == ':' + || (dirlen > 2 && dirname[dirlen - 2] == ':' + && dirname[dirlen - 1] == '/'))); +#else + bool drive_root = false; #endif - && dirlen > 1) + + if (filename[0] == '\0' && dirlen > 1 && !drive_root) /* "pattern/". Expand "pattern", appending slashes. */ { int orig_flags = flags; - int val; if (!(flags & GLOB_NOESCAPE) && dirname[dirlen - 1] == '\\') { /* "pattern\\/". Remove the final backslash if it hasn't @@ -633,7 +593,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), flags &= ~(GLOB_NOCHECK | GLOB_NOMAGIC); } } - val = glob (dirname, flags | GLOB_MARK, errfunc, pglob); + int val = __glob (dirname, flags | GLOB_MARK, errfunc, pglob); if (val == 0) pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK) | (flags & GLOB_MARK)); @@ -659,15 +619,11 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), /* Look up home directory. */ char *home_dir = getenv ("HOME"); int malloc_home_dir = 0; -# ifdef _AMIGA - if (home_dir == NULL || home_dir[0] == '\0') - home_dir = "SYS:"; -# else -# ifdef WINDOWS32 - /* Windows NT defines HOMEDRIVE and HOMEPATH. But give preference - to HOME, because the user can change HOME. */ if (home_dir == NULL || home_dir[0] == '\0') { +#ifdef WINDOWS32 + /* Windows NT defines HOMEDRIVE and HOMEPATH. But give + preference to HOME, because the user can change HOME. */ const char *home_drive = getenv ("HOMEDRIVE"); const char *home_path = getenv ("HOMEPATH"); @@ -683,133 +639,49 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), } else home_dir = "c:/users/default"; /* poor default */ - } -# else - if (home_dir == NULL || home_dir[0] == '\0') - { - int success; - char *name; - int malloc_name = 0; - size_t buflen = GET_LOGIN_NAME_MAX () + 1; - - if (buflen == 0) - /* 'sysconf' does not support _SC_LOGIN_NAME_MAX. Try - a moderate value. */ - buflen = 20; - if (glob_use_alloca (alloca_used, buflen)) - name = alloca_account (buflen, alloca_used); - else +#else + int err; + struct passwd *p; + struct passwd pwbuf; + struct scratch_buffer s; + scratch_buffer_init (&s); + while (true) { - name = malloc (buflen); - if (name == NULL) + p = NULL; + err = __getlogin_r (s.data, s.length); + if (err == 0) + { +# if defined HAVE_GETPWNAM_R || defined _LIBC + size_t ssize = strlen (s.data) + 1; + char *sdata = s.data; + err = getpwnam_r (sdata, &pwbuf, sdata + ssize, + s.length - ssize, &p); +# else + p = getpwnam (s.data); + if (p == NULL) + err = errno; +# endif + } + if (err != ERANGE) + break; + if (!scratch_buffer_grow (&s)) { retval = GLOB_NOSPACE; goto out; } - malloc_name = 1; } - - success = __getlogin_r (name, buflen) == 0; - if (success) + if (err == 0) { - struct passwd *p; -# if defined HAVE_GETPWNAM_R || defined _LIBC - long int pwbuflenmax = GETPW_R_SIZE_MAX (); - size_t pwbuflen = pwbuflenmax; - char *pwtmpbuf; - struct passwd pwbuf; - char *malloc_pwtmpbuf = NULL; - int save = errno; - -# ifndef _LIBC - if (! (0 < pwbuflenmax && pwbuflenmax <= SIZE_MAX)) - /* Perhaps 'sysconf' does not support _SC_GETPW_R_SIZE_MAX. - Try a moderate value. */ - pwbuflen = 1024; -# endif - if (glob_use_alloca (alloca_used, pwbuflen)) - pwtmpbuf = alloca_account (pwbuflen, alloca_used); - else - { - pwtmpbuf = malloc (pwbuflen); - if (pwtmpbuf == NULL) - { - if (__glibc_unlikely (malloc_name)) - free (name); - retval = GLOB_NOSPACE; - goto out; - } - malloc_pwtmpbuf = pwtmpbuf; - } - - while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p) - != 0) - { - size_t newlen; - bool v; - if (errno != ERANGE) - { - p = NULL; - break; - } - v = size_add_wrapv (pwbuflen, pwbuflen, &newlen); - if (!v && malloc_pwtmpbuf == NULL - && glob_use_alloca (alloca_used, newlen)) - pwtmpbuf = extend_alloca_account (pwtmpbuf, pwbuflen, - newlen, alloca_used); - else - { - char *newp = (v ? NULL - : realloc (malloc_pwtmpbuf, newlen)); - if (newp == NULL) - { - free (malloc_pwtmpbuf); - if (__glibc_unlikely (malloc_name)) - free (name); - retval = GLOB_NOSPACE; - goto out; - } - malloc_pwtmpbuf = pwtmpbuf = newp; - } - pwbuflen = newlen; - __set_errno (save); - } -# else - p = getpwnam (name); -# endif - if (__glibc_unlikely (malloc_name)) - free (name); - if (p != NULL) - { - if (malloc_pwtmpbuf == NULL) - home_dir = p->pw_dir; - else - { - size_t home_dir_len = strlen (p->pw_dir) + 1; - if (glob_use_alloca (alloca_used, home_dir_len)) - home_dir = alloca_account (home_dir_len, - alloca_used); - else - { - home_dir = malloc (home_dir_len); - if (home_dir == NULL) - { - free (pwtmpbuf); - retval = GLOB_NOSPACE; - goto out; - } - malloc_home_dir = 1; - } - memcpy (home_dir, p->pw_dir, home_dir_len); - } - } - free (malloc_pwtmpbuf); + home_dir = strdup (p->pw_dir); + malloc_home_dir = 1; } - else + scratch_buffer_free (&s); + if (err == 0 && home_dir == NULL) { - if (__glibc_unlikely (malloc_name)) - free (name); + retval = GLOB_NOSPACE; + goto out; } +#endif /* WINDOWS32 */ } if (home_dir == NULL || home_dir[0] == '\0') { @@ -826,8 +698,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), malloc_home_dir = 0; } } -# endif /* WINDOWS32 */ -# endif /* Now construct the full directory. */ if (dirname[1] == '\0') { @@ -872,9 +742,9 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), } dirname_modified = 1; } -# if !defined _AMIGA && !defined WINDOWS32 else { +#ifndef WINDOWS32 char *end_name = strchr (dirname, '/'); char *user_name; int malloc_user_name = 0; @@ -913,11 +783,11 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), char *p = mempcpy (newp, dirname + 1, unescape - dirname - 1); char *q = unescape; - while (*q != '\0') + while (q != end_name) { if (*q == '\\') { - if (q[1] == '\0') + if (q + 1 == end_name) { /* "~fo\\o\\" unescape to user_name "foo\\", but "~fo\\o\\/" unescape to user_name @@ -933,7 +803,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), *p = '\0'; } else - *((char *) mempcpy (newp, dirname + 1, end_name - dirname)) + *((char *) mempcpy (newp, dirname + 1, end_name - dirname - 1)) = '\0'; user_name = newp; } @@ -941,61 +811,21 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), /* Look up specific user's home directory. */ { struct passwd *p; + struct scratch_buffer pwtmpbuf; + scratch_buffer_init (&pwtmpbuf); + # if defined HAVE_GETPWNAM_R || defined _LIBC - long int buflenmax = GETPW_R_SIZE_MAX (); - size_t buflen = buflenmax; - char *pwtmpbuf; - char *malloc_pwtmpbuf = NULL; struct passwd pwbuf; - int save = errno; - -# ifndef _LIBC - if (! (0 <= buflenmax && buflenmax <= SIZE_MAX)) - /* Perhaps 'sysconf' does not support _SC_GETPW_R_SIZE_MAX. Try a - moderate value. */ - buflen = 1024; -# endif - if (glob_use_alloca (alloca_used, buflen)) - pwtmpbuf = alloca_account (buflen, alloca_used); - else + + while (getpwnam_r (user_name, &pwbuf, + pwtmpbuf.data, pwtmpbuf.length, &p) + == ERANGE) { - pwtmpbuf = malloc (buflen); - if (pwtmpbuf == NULL) + if (!scratch_buffer_grow (&pwtmpbuf)) { - nomem_getpw: - if (__glibc_unlikely (malloc_user_name)) - free (user_name); retval = GLOB_NOSPACE; goto out; } - malloc_pwtmpbuf = pwtmpbuf; - } - - while (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) != 0) - { - size_t newlen; - bool v; - if (errno != ERANGE) - { - p = NULL; - break; - } - v = size_add_wrapv (buflen, buflen, &newlen); - if (!v && malloc_pwtmpbuf == NULL - && glob_use_alloca (alloca_used, newlen)) - pwtmpbuf = extend_alloca_account (pwtmpbuf, buflen, - newlen, alloca_used); - else - { - char *newp = v ? NULL : realloc (malloc_pwtmpbuf, newlen); - if (newp == NULL) - { - free (malloc_pwtmpbuf); - goto nomem_getpw; - } - malloc_pwtmpbuf = pwtmpbuf = newp; - } - __set_errno (save); } # else p = getpwnam (user_name); @@ -1009,6 +839,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), { size_t home_len = strlen (p->pw_dir); size_t rest_len = end_name == NULL ? 0 : strlen (end_name); + char *d; if (__glibc_unlikely (malloc_dirname)) free (dirname); @@ -1022,24 +853,22 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), dirname = malloc (home_len + rest_len + 1); if (dirname == NULL) { - free (malloc_pwtmpbuf); + scratch_buffer_free (&pwtmpbuf); retval = GLOB_NOSPACE; goto out; } malloc_dirname = 1; } - *((char *) mempcpy (mempcpy (dirname, p->pw_dir, home_len), - end_name, rest_len)) = '\0'; + d = mempcpy (dirname, p->pw_dir, home_len); + if (end_name != NULL) + d = mempcpy (d, end_name, rest_len); + *d = '\0'; dirlen = home_len + rest_len; dirname_modified = 1; - - free (malloc_pwtmpbuf); } else { - free (malloc_pwtmpbuf); - if (flags & GLOB_TILDE_CHECK) { /* We have to regard it as an error if we cannot find the @@ -1048,77 +877,63 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), goto out; } } + scratch_buffer_free (&pwtmpbuf); } +#endif /* !WINDOWS32 */ } -# endif /* Not Amiga && not WINDOWS32. */ } /* Now test whether we looked for "~" or "~NAME". In this case we can give the answer now. */ if (filename == NULL) { - struct stat st; - struct_stat64 st64; - - /* Return the directory if we don't check for error or if it exists. */ - if ((flags & GLOB_NOCHECK) - || (((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)) - ? ((*pglob->gl_stat) (dirname, &st) == 0 - && S_ISDIR (st.st_mode)) - : (__stat64 (dirname, &st64) == 0 && S_ISDIR (st64.st_mode))))) + size_t newcount = pglob->gl_pathc + pglob->gl_offs; + char **new_gl_pathv; + + if (newcount > SIZE_MAX / sizeof (char *) - 2) { - size_t newcount = pglob->gl_pathc + pglob->gl_offs; - char **new_gl_pathv; + nospace: + free (pglob->gl_pathv); + pglob->gl_pathv = NULL; + pglob->gl_pathc = 0; + retval = GLOB_NOSPACE; + goto out; + } - if (newcount > SIZE_MAX / sizeof (char *) - 2) - { - nospace: - free (pglob->gl_pathv); - pglob->gl_pathv = NULL; - pglob->gl_pathc = 0; - retval = GLOB_NOSPACE; - goto out; - } + new_gl_pathv = realloc (pglob->gl_pathv, + (newcount + 2) * sizeof (char *)); + if (new_gl_pathv == NULL) + goto nospace; + pglob->gl_pathv = new_gl_pathv; - new_gl_pathv = realloc (pglob->gl_pathv, - (newcount + 2) * sizeof (char *)); - if (new_gl_pathv == NULL) + if (flags & GLOB_MARK && is_dir (dirname, flags, pglob)) + { + char *p; + pglob->gl_pathv[newcount] = malloc (dirlen + 2); + if (pglob->gl_pathv[newcount] == NULL) goto nospace; - pglob->gl_pathv = new_gl_pathv; - - if (flags & GLOB_MARK) + p = mempcpy (pglob->gl_pathv[newcount], dirname, dirlen); + p[0] = '/'; + p[1] = '\0'; + if (__glibc_unlikely (malloc_dirname)) + free (dirname); + } + else + { + if (__glibc_unlikely (malloc_dirname)) + pglob->gl_pathv[newcount] = dirname; + else { - char *p; - pglob->gl_pathv[newcount] = malloc (dirlen + 2); + pglob->gl_pathv[newcount] = strdup (dirname); if (pglob->gl_pathv[newcount] == NULL) goto nospace; - p = mempcpy (pglob->gl_pathv[newcount], dirname, dirlen); - p[0] = '/'; - p[1] = '\0'; - if (__glibc_unlikely (malloc_dirname)) - free (dirname); } - else - { - if (__glibc_unlikely (malloc_dirname)) - pglob->gl_pathv[newcount] = dirname; - else - { - pglob->gl_pathv[newcount] = strdup (dirname); - if (pglob->gl_pathv[newcount] == NULL) - goto nospace; - } - } - pglob->gl_pathv[++newcount] = NULL; - ++pglob->gl_pathc; - pglob->gl_flags = flags; - - return 0; } + pglob->gl_pathv[++newcount] = NULL; + ++pglob->gl_pathc; + pglob->gl_flags = flags; - /* Not found. */ - retval = GLOB_NOMATCH; - goto out; + return 0; } meta = __glob_pattern_type (dirname, !(flags & GLOB_NOESCAPE)); @@ -1127,7 +942,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), [ which we handle the same, using fnmatch. Broken unterminated pattern bracket expressions ought to be rare enough that it is not worth special casing them, fnmatch will do the right thing. */ - if (meta & 5) + if (meta & (GLOBPAT_SPECIAL | GLOBPAT_BRACKET)) { /* The directory name contains metacharacters, so we have to glob for the directory, and then glob for @@ -1156,11 +971,10 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), dirs.gl_lstat = pglob->gl_lstat; } - status = glob (dirname, - ((flags & (GLOB_ERR | GLOB_NOESCAPE - | GLOB_ALTDIRFUNC)) - | GLOB_NOSORT | GLOB_ONLYDIR), - errfunc, &dirs); + status = __glob (dirname, + ((flags & (GLOB_ERR | GLOB_NOESCAPE | GLOB_ALTDIRFUNC)) + | GLOB_NOSORT | GLOB_ONLYDIR), + errfunc, &dirs); if (status != 0) { if ((flags & GLOB_NOCHECK) == 0 || status != GLOB_NOMATCH) @@ -1178,20 +992,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), { size_t old_pathc; -#ifdef SHELL - { - /* Make globbing interruptible in the bash shell. */ - extern int interrupt_state; - - if (interrupt_state) - { - globfree (&dirs); - retval = GLOB_ABORTED; - goto out; - } - } -#endif /* SHELL. */ - old_pathc = pglob->gl_pathc; status = glob_in_dir (filename, dirs.gl_pathv[i], ((flags | GLOB_APPEND) @@ -1282,7 +1082,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), size_t old_pathc = pglob->gl_pathc; int orig_flags = flags; - if (meta & 2) + if (meta & GLOBPAT_BACKSLASH) { char *p = strchr (dirname, '\\'), *q; /* We need to unescape the dirname string. It is certainly @@ -1340,15 +1140,9 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), { /* Append slashes to directory names. */ size_t i; - struct stat st; - struct_stat64 st64; for (i = oldcount; i < pglob->gl_pathc + pglob->gl_offs; ++i) - if ((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) - ? ((*pglob->gl_stat) (pglob->gl_pathv[i], &st) == 0 - && S_ISDIR (st.st_mode)) - : (__stat64 (pglob->gl_pathv[i], &st64) == 0 - && S_ISDIR (st64.st_mode)))) + if (is_dir (pglob->gl_pathv[i], flags, pglob)) { size_t len = strlen (pglob->gl_pathv[i]) + 2; char *new = realloc (pglob->gl_pathv[i], len); @@ -1378,28 +1172,9 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), return retval; } -#if defined _LIBC && !defined glob -libc_hidden_def (glob) -#endif - - -#ifndef GLOB_ONLY_P - -/* Free storage allocated in PGLOB by a previous 'glob' call. */ -void -globfree (glob_t *pglob) -{ - if (pglob->gl_pathv != NULL) - { - size_t i; - for (i = 0; i < pglob->gl_pathc; ++i) - free (pglob->gl_pathv[pglob->gl_offs + i]); - free (pglob->gl_pathv); - pglob->gl_pathv = NULL; - } -} -#if defined _LIBC && !defined globfree -libc_hidden_def (globfree) +#if defined _LIBC && !defined __glob +versioned_symbol (libc, __glob, glob, GLIBC_2_27); +libc_hidden_ver (__glob, glob) #endif @@ -1429,19 +1204,15 @@ prefix_array (const char *dirname, char **array, size_t n) { size_t i; size_t dirlen = strlen (dirname); -#if defined __MSDOS__ || defined WINDOWS32 - int sep_char = '/'; -# define DIRSEP_CHAR sep_char -#else -# define DIRSEP_CHAR '/' -#endif + char dirsep_char = '/'; if (dirlen == 1 && dirname[0] == '/') /* DIRNAME is just "/", so normal prepending would get us "//foo". We want "/foo" instead, so don't prepend any chars from DIRNAME. */ dirlen = 0; + #if defined __MSDOS__ || defined WINDOWS32 - else if (dirlen > 1) + if (dirlen > 1) { if (dirname[dirlen - 1] == '/' && dirname[dirlen - 2] == ':') /* DIRNAME is "d:/". Don't prepend the slash from DIRNAME. */ @@ -1450,7 +1221,7 @@ prefix_array (const char *dirname, char **array, size_t n) { /* DIRNAME is "d:". Use ':' instead of '/'. */ --dirlen; - sep_char = ':'; + dirsep_char = ':'; } } #endif @@ -1468,7 +1239,7 @@ prefix_array (const char *dirname, char **array, size_t n) { char *endp = mempcpy (new, dirname, dirlen); - *endp++ = DIRSEP_CHAR; + *endp++ = dirsep_char; mempcpy (endp, array[i], eltlen); } free (array[i]); @@ -1478,107 +1249,6 @@ prefix_array (const char *dirname, char **array, size_t n) return 0; } - -/* We must not compile this function twice. */ -#ifndef NO_GLOB_PATTERN_P -int -__glob_pattern_type (const char *pattern, int quote) -{ - const char *p; - int ret = 0; - - for (p = pattern; *p != '\0'; ++p) - switch (*p) - { - case '?': - case '*': - return 1; - - case '\\': - if (quote) - { - if (p[1] != '\0') - ++p; - ret |= 2; - } - break; - - case '[': - ret |= 4; - break; - - case ']': - if (ret & 4) - return 1; - break; - } - - return ret; -} - -/* Return nonzero if PATTERN contains any metacharacters. - Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ -int -__glob_pattern_p (const char *pattern, int quote) -{ - return __glob_pattern_type (pattern, quote) == 1; -} -# ifdef _LIBC -weak_alias (__glob_pattern_p, glob_pattern_p) -# endif -#endif - - -/* We put this in a separate function mainly to allow the memory - allocated with alloca to be recycled. */ -static int -__attribute_noinline__ -link_exists2_p (const char *dir, size_t dirlen, const char *fname, - glob_t *pglob -# if !defined _LIBC && !HAVE_FSTATAT - , int flags -# endif - ) -{ - size_t fnamelen = strlen (fname); - char *fullname = __alloca (dirlen + 1 + fnamelen + 1); - struct stat st; - - mempcpy (mempcpy (mempcpy (fullname, dir, dirlen), "/", 1), - fname, fnamelen + 1); - -# if !defined _LIBC && !HAVE_FSTATAT - if (__builtin_expect ((flags & GLOB_ALTDIRFUNC) == 0, 1)) - { - struct_stat64 st64; - return __stat64 (fullname, &st64) == 0; - } -# endif - return (*pglob->gl_stat) (fullname, &st) == 0; -} - -/* Return true if DIR/FNAME exists. */ -static int -link_exists_p (int dfd, const char *dir, size_t dirlen, const char *fname, - glob_t *pglob, int flags) -{ -# if defined _LIBC || HAVE_FSTATAT - if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)) - return link_exists2_p (dir, dirlen, fname, pglob); - else - { - /* dfd cannot be -1 here, because dirfd never returns -1 on - glibc, or on hosts that have fstatat. */ - struct_stat64 st64; - return __fxstatat64 (_STAT_VER, dfd, fname, &st64, 0) == 0; - } -# else - return link_exists2_p (dir, dirlen, fname, pglob, flags); -# endif -} -#endif /* !defined GLOB_ONLY_P */ - - /* Like 'glob', but PATTERN is a final pathname component, and matches are searched for in DIRECTORY. The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done. @@ -1590,43 +1260,36 @@ glob_in_dir (const char *pattern, const char *directory, int flags, { size_t dirlen = strlen (directory); void *stream = NULL; - struct globnames - { - struct globnames *next; - size_t count; - char *name[64]; - }; - struct globnames init_names; - struct globnames *names = &init_names; - struct globnames *names_alloca = &init_names; +# define GLOBNAMES_MEMBERS(nnames) \ + struct globnames *next; size_t count; char *name[nnames]; + struct globnames { GLOBNAMES_MEMBERS (FLEXIBLE_ARRAY_MEMBER) }; + struct { GLOBNAMES_MEMBERS (64) } init_names_buf; + struct globnames *init_names = (struct globnames *) &init_names_buf; + struct globnames *names = init_names; + struct globnames *names_alloca = init_names; size_t nfound = 0; size_t cur = 0; int meta; int save; int result; - alloca_used += sizeof (init_names); + alloca_used += sizeof init_names_buf; - init_names.next = NULL; - init_names.count = sizeof init_names.name / sizeof init_names.name[0]; + init_names->next = NULL; + init_names->count = ((sizeof init_names_buf + - offsetof (struct globnames, name)) + / sizeof init_names->name[0]); meta = __glob_pattern_type (pattern, !(flags & GLOB_NOESCAPE)); - if (meta == 0 && (flags & (GLOB_NOCHECK|GLOB_NOMAGIC))) + if (meta == GLOBPAT_NONE && (flags & (GLOB_NOCHECK|GLOB_NOMAGIC))) { /* We need not do any tests. The PATTERN contains no meta characters and we must not return an error therefore the result will always contain exactly one name. */ flags |= GLOB_NOCHECK; } - else if (meta == 0) + else if (meta == GLOBPAT_NONE) { - /* Since we use the normal file functions we can also use stat() - to verify the file is there. */ - union - { - struct stat st; - struct_stat64 st64; - } ust; size_t patlen = strlen (pattern); size_t fullsize; bool alloca_fullname @@ -1645,9 +1308,8 @@ glob_in_dir (const char *pattern, const char *directory, int flags, mempcpy (mempcpy (mempcpy (fullname, directory, dirlen), "/", 1), pattern, patlen + 1); - if ((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) - ? (*pglob->gl_stat) (fullname, &ust.st) - : __stat64 (fullname, &ust.st64)) == 0) + if (glob_lstat (pglob, flags, fullname) == 0 + || errno == EOVERFLOW) /* We found this file to be existing. Now tell the rest of the function to copy this name into the result. */ flags |= GLOB_NOCHECK; @@ -1669,14 +1331,8 @@ glob_in_dir (const char *pattern, const char *directory, int flags, } else { - int dfd = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) - ? -1 : dirfd ((DIR *) stream)); int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) - | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0) -#if defined _AMIGA || defined VMS - | FNM_CASEFOLD -#endif - ); + | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)); flags |= GLOB_MAGCHAR; while (1) @@ -1696,51 +1352,46 @@ glob_in_dir (const char *pattern, const char *directory, int flags, } if (d.name == NULL) break; - if (d.skip_entry) - continue; /* If we shall match only directories use the information provided by the dirent call if possible. */ - if ((flags & GLOB_ONLYDIR) && !readdir_result_might_be_dir (d)) - continue; + if (flags & GLOB_ONLYDIR) + switch (readdir_result_type (d)) + { + case DT_DIR: case DT_LNK: case DT_UNKNOWN: break; + default: continue; + } if (fnmatch (pattern, d.name, fnm_flags) == 0) { - /* If the file we found is a symlink we have to - make sure the target file exists. */ - if (!readdir_result_might_be_symlink (d) - || link_exists_p (dfd, directory, dirlen, d.name, - pglob, flags)) + if (cur == names->count) { - if (cur == names->count) - { - struct globnames *newnames; - size_t count = names->count * 2; - size_t nameoff = offsetof (struct globnames, name); - size_t size = FLEXSIZEOF (struct globnames, name, - count * sizeof (char *)); - if ((SIZE_MAX - nameoff) / 2 / sizeof (char *) - < names->count) - goto memory_error; - if (glob_use_alloca (alloca_used, size)) - newnames = names_alloca - = alloca_account (size, alloca_used); - else if ((newnames = malloc (size)) - == NULL) - goto memory_error; - newnames->count = count; - newnames->next = names; - names = newnames; - cur = 0; - } - names->name[cur] = strdup (d.name); - if (names->name[cur] == NULL) + struct globnames *newnames; + size_t count = names->count * 2; + size_t nameoff = offsetof (struct globnames, name); + size_t size = FLEXSIZEOF (struct globnames, name, + count * sizeof (char *)); + if ((SIZE_MAX - nameoff) / 2 / sizeof (char *) + < names->count) goto memory_error; - ++cur; - ++nfound; - if (SIZE_MAX - pglob->gl_offs <= nfound) + if (glob_use_alloca (alloca_used, size)) + newnames = names_alloca + = alloca_account (size, alloca_used); + else if ((newnames = malloc (size)) + == NULL) goto memory_error; + newnames->count = count; + newnames->next = names; + names = newnames; + cur = 0; } + names->name[cur] = strdup (d.name); + if (names->name[cur] == NULL) + goto memory_error; + ++cur; + ++nfound; + if (SIZE_MAX - pglob->gl_offs <= nfound) + goto memory_error; } } } @@ -1769,7 +1420,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, new_gl_pathv = realloc (pglob->gl_pathv, (pglob->gl_pathc + pglob->gl_offs + nfound + 1) - * sizeof (char *)); + * sizeof (char *)); if (new_gl_pathv == NULL) { @@ -1777,8 +1428,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, while (1) { struct globnames *old = names; - size_t i; - for (i = 0; i < cur; ++i) + for (size_t i = 0; i < cur; ++i) free (names->name[i]); names = names->next; /* NB: we will not leak memory here if we exit without @@ -1787,7 +1437,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, and this is the block assigned to OLD here. */ if (names == NULL) { - assert (old == &init_names); + assert (old == init_names); break; } cur = names->count; @@ -1803,8 +1453,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, while (1) { struct globnames *old = names; - size_t i; - for (i = 0; i < cur; ++i) + for (size_t i = 0; i < cur; ++i) new_gl_pathv[pglob->gl_offs + pglob->gl_pathc++] = names->name[i]; names = names->next; @@ -1814,7 +1463,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, and this is the block assigned to OLD here. */ if (names == NULL) { - assert (old == &init_names); + assert (old == init_names); break; } cur = names->count; diff --git a/gnulib/import/glob.in.h b/gnulib/import/glob.in.h index 77816bc..597979b 100644 --- a/gnulib/import/glob.in.h +++ b/gnulib/import/glob.in.h @@ -1,6 +1,6 @@ /* glob.h -- Find a path matching a pattern. - Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2019 Free Software Foundation, Inc. Written by Derek Price <derek@ximbiot.com> & Paul Eggert <eggert@CS.UCLA.EDU> @@ -15,79 +15,166 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ -#ifndef _GL_GLOB_H -#define _GL_GLOB_H +#ifndef _@GUARD_PREFIX@_GLOB_H -#if @HAVE_SYS_CDEFS_H@ -# include <sys/cdefs.h> +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ -#include <stddef.h> +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_GLOB_H@ && !@REPLACE_GLOB@ +# @INCLUDE_NEXT@ @NEXT_GLOB_H@ +#endif -/* On some systems, such as AIX 5.1, <sys/stat.h> does a "#define stat stat64". - Make sure this definition is seen before glob-libc.h defines types that - rely on 'struct stat'. */ -#include <sys/stat.h> +#ifndef _@GUARD_PREFIX@_GLOB_H +#define _@GUARD_PREFIX@_GLOB_H + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ -#ifndef __BEGIN_DECLS -# ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } +/* The definition of _GL_WARN_ON_USE is copied here. */ + +/* GCC 2.95 and later have "__restrict"; C99 compilers have + "restrict", and "configure" may have defined "restrict". + Other compilers use __restrict, __restrict__, and _Restrict, and + 'configure' might #define 'restrict' to those words, so pick a + different name. */ +#ifndef _Restrict_ +# if 199901L <= __STDC_VERSION__ +# define _Restrict_ restrict +# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__) +# define _Restrict_ __restrict # else -# define __BEGIN_DECLS -# define __END_DECLS +# define _Restrict_ # endif #endif -#ifndef __THROW -# define __THROW + +#ifdef __cplusplus +extern "C" { #endif -#ifndef __THROWNL -# define __THROWNL +typedef int (*_gl_glob_errfunc_fn) (const char *, int); +#ifdef __cplusplus +} #endif -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ -/* The definition of _GL_ARG_NONNULL is copied here. */ +#if !@HAVE_GLOB_H@ || @REPLACE_GLOB@ -/* The definition of _GL_WARN_ON_USE is copied here. */ -#ifndef __size_t -# define __size_t size_t -#endif -#ifndef __USE_GNU -# define __USE_GNU 1 -#endif +/* Preparations for including the standard GNU C Library header. */ + +# include <libc-config.h> + +# include <stddef.h> + +/* On some systems, such as AIX 5.1, <sys/stat.h> does a "#define stat stat64". + Make sure this definition is seen before glob-libc.h defines types that + rely on 'struct stat'. */ +# include <sys/stat.h> +# ifndef __USE_GNU +# define __USE_GNU 1 +# endif -#define glob rpl_glob -#define globfree rpl_globfree -#define glob_pattern_p rpl_glob_pattern_p +# if @REPLACE_GLOB@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define glob rpl_glob +# define globfree rpl_globfree +# endif +# endif +# if @REPLACE_GLOB_PATTERN_P@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define glob_pattern_p rpl_glob_pattern_p +# endif +# endif +# define __glob_pattern_p glob_pattern_p + +# define __GLOB_GNULIB 1 -#define __GLOB_GNULIB 1 /* Now the standard GNU C Library header should work. */ -#include "glob-libc.h" +# include "glob-libc.h" -__BEGIN_DECLS -typedef int (*_gl_glob_errfunc_fn) (const char *, int); -__END_DECLS -#if defined __cplusplus && defined GNULIB_NAMESPACE -# undef glob -# undef globfree -# undef glob_pattern_p +#endif + + +#if @GNULIB_GLOB@ +# if @REPLACE_GLOB@ +_GL_FUNCDECL_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags, + _gl_glob_errfunc_fn __errfunc, + glob_t *_Restrict_ __pglob) + _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags, _gl_glob_errfunc_fn __errfunc, glob_t *_Restrict_ __pglob)); -_GL_CXXALIAS_RPL (globfree, void, (glob_t *__pglob)); -_GL_CXXALIAS_RPL (glob_pattern_p, int, (const char *__pattern, int __quote)); -# if 0 /* The C function name is rpl_glob, not glob. */ +# else +# if !@HAVE_GLOB@ +_GL_FUNCDECL_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags, + _gl_glob_errfunc_fn __errfunc, + glob_t *_Restrict_ __pglob) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags, + _gl_glob_errfunc_fn __errfunc, + glob_t *_Restrict_ __pglob)); +# endif _GL_CXXALIASWARN (glob); +#elif defined GNULIB_POSIXCHECK +# undef glob +# if HAVE_RAW_DECL_GLOB +_GL_WARN_ON_USE (glob, + "glob is unportable - " + "use gnulib module glob for portability"); +# endif +#endif + +#if @GNULIB_GLOB@ +# if @REPLACE_GLOB@ +_GL_FUNCDECL_RPL (globfree, void, (glob_t *__pglob) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (globfree, void, (glob_t *__pglob)); +# else +# if !@HAVE_GLOB@ +_GL_FUNCDECL_SYS (globfree, void, (glob_t *__pglob) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (globfree, void, (glob_t *__pglob)); +# endif _GL_CXXALIASWARN (globfree); +#elif defined GNULIB_POSIXCHECK +# undef globfree +# if HAVE_RAW_DECL_GLOBFREE +_GL_WARN_ON_USE (globfree, + "globfree is unportable - " + "use gnulib module glob for portability"); +# endif +#endif + +#if @GNULIB_GLOB@ +# if @REPLACE_GLOB_PATTERN_P@ +_GL_FUNCDECL_RPL (glob_pattern_p, int, (const char *__pattern, int __quote) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (glob_pattern_p, int, (const char *__pattern, int __quote)); +# else +# if !@HAVE_GLOB_PATTERN_P@ +_GL_FUNCDECL_SYS (glob_pattern_p, int, (const char *__pattern, int __quote) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (glob_pattern_p, int, (const char *__pattern, int __quote)); +# endif _GL_CXXALIASWARN (glob_pattern_p); +#elif defined GNULIB_POSIXCHECK +# undef glob_pattern_p +# if HAVE_RAW_DECL_GLOB_PATTERN_P +_GL_WARN_ON_USE (glob_pattern_p, + "glob_pattern_p is unportable - " + "use gnulib module glob for portability"); # endif #endif -#endif /* _GL_GLOB_H */ + +#endif /* _@GUARD_PREFIX@_GLOB_H */ +#endif /* _@GUARD_PREFIX@_GLOB_H */ diff --git a/gnulib/import/glob_internal.h b/gnulib/import/glob_internal.h new file mode 100644 index 0000000..469d4d9 --- /dev/null +++ b/gnulib/import/glob_internal.h @@ -0,0 +1,65 @@ +/* Shared definition for glob and glob_pattern_p. + Copyright (C) 2017-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef GLOB_INTERNAL_H +# define GLOB_INTERNAL_H + +enum +{ + GLOBPAT_NONE = 0x0, + GLOBPAT_SPECIAL = 0x1, + GLOBPAT_BACKSLASH = 0x2, + GLOBPAT_BRACKET = 0x4 +}; + +static inline int +__glob_pattern_type (const char *pattern, int quote) +{ + const char *p; + int ret = GLOBPAT_NONE; + + for (p = pattern; *p != '\0'; ++p) + switch (*p) + { + case '?': + case '*': + return GLOBPAT_SPECIAL; + + case '\\': + if (quote) + { + if (p[1] != '\0') + ++p; + ret |= GLOBPAT_BACKSLASH; + } + break; + + case '[': + ret |= GLOBPAT_BRACKET; + break; + + case ']': + if (ret & 4) + return GLOBPAT_SPECIAL; + break; + } + + return ret; +} + +#endif /* GLOB_INTERNAL_H */ diff --git a/gnulib/import/glob_pattern_p.c b/gnulib/import/glob_pattern_p.c new file mode 100644 index 0000000..163ce75 --- /dev/null +++ b/gnulib/import/glob_pattern_p.c @@ -0,0 +1,33 @@ +/* Return nonzero if PATTERN contains any metacharacters. + Copyright (C) 2017-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _LIBC +# include <libc-config.h> +#endif + +#include <glob.h> +#include "glob_internal.h" + +/* Return nonzero if PATTERN contains any metacharacters. + Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ +int +__glob_pattern_p (const char *pattern, int quote) +{ + return __glob_pattern_type (pattern, quote) == GLOBPAT_SPECIAL; +} +weak_alias (__glob_pattern_p, glob_pattern_p) diff --git a/gnulib/import/globfree.c b/gnulib/import/globfree.c new file mode 100644 index 0000000..77a1cca --- /dev/null +++ b/gnulib/import/globfree.c @@ -0,0 +1,41 @@ +/* Frees the dynamically allocated storage from an earlier call to glob. + Copyright (C) 2017-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _LIBC +# include <libc-config.h> +#endif + +#include <glob.h> +#include <stdlib.h> + +/* Free storage allocated in PGLOB by a previous `glob' call. */ +void +globfree (glob_t *pglob) +{ + if (pglob->gl_pathv != NULL) + { + size_t i; + for (i = 0; i < pglob->gl_pathc; ++i) + free (pglob->gl_pathv[pglob->gl_offs + i]); + free (pglob->gl_pathv); + pglob->gl_pathv = NULL; + } +} +#ifndef globfree +libc_hidden_def (globfree) +#endif diff --git a/gnulib/import/glthread/lock.c b/gnulib/import/glthread/lock.c index 935043b..e471188 100644 --- a/gnulib/import/glthread/lock.c +++ b/gnulib/import/glthread/lock.c @@ -1,5 +1,5 @@ /* Locking in multithreaded situations. - Copyright (C) 2005-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2019 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 @@ -12,11 +12,10 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. - Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h, - gthr-win32.h. */ + Based on GCC's gthr-posix.h, gthr-posix95.h. */ #include <config.h> @@ -24,15 +23,267 @@ /* ========================================================================= */ +#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +int +glthread_lock_init (gl_lock_t *lock) +{ + if (mtx_init (&lock->mutex, mtx_plain) != thrd_success) + return ENOMEM; + lock->init_needed = 0; + return 0; +} + +int +glthread_lock_lock (gl_lock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_lock (&lock->mutex) != thrd_success) + return EAGAIN; + return 0; +} + +int +glthread_lock_unlock (gl_lock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_unlock (&lock->mutex) != thrd_success) + return EINVAL; + return 0; +} + +int +glthread_lock_destroy (gl_lock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + mtx_destroy (&lock->mutex); + return 0; +} + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +int +glthread_rwlock_init (gl_rwlock_t *lock) +{ + if (mtx_init (&lock->lock, mtx_plain) != thrd_success + || cnd_init (&lock->waiting_readers) != thrd_success + || cnd_init (&lock->waiting_writers) != thrd_success) + return ENOMEM; + lock->waiting_writers_count = 0; + lock->runcount = 0; + lock->init_needed = 0; + return 0; +} + +int +glthread_rwlock_rdlock (gl_rwlock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_lock (&lock->lock) != thrd_success) + return EAGAIN; + /* Test whether only readers are currently running, and whether the runcount + field will not overflow, and whether no writer is waiting. The latter + condition is because POSIX recommends that "write locks shall take + precedence over read locks", to avoid "writer starvation". */ + while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_readers. */ + if (cnd_wait (&lock->waiting_readers, &lock->lock) != thrd_success) + { + mtx_unlock (&lock->lock); + return EINVAL; + } + } + lock->runcount++; + if (mtx_unlock (&lock->lock) != thrd_success) + return EINVAL; + return 0; +} + +int +glthread_rwlock_wrlock (gl_rwlock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_lock (&lock->lock) != thrd_success) + return EAGAIN; + /* Test whether no readers or writers are currently running. */ + while (!(lock->runcount == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_writers. */ + lock->waiting_writers_count++; + if (cnd_wait (&lock->waiting_writers, &lock->lock) != thrd_success) + { + lock->waiting_writers_count--; + mtx_unlock (&lock->lock); + return EINVAL; + } + lock->waiting_writers_count--; + } + lock->runcount--; /* runcount becomes -1 */ + if (mtx_unlock (&lock->lock) != thrd_success) + return EINVAL; + return 0; +} + +int +glthread_rwlock_unlock (gl_rwlock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_lock (&lock->lock) != thrd_success) + return EAGAIN; + if (lock->runcount < 0) + { + /* Drop a writer lock. */ + if (!(lock->runcount == -1)) + { + mtx_unlock (&lock->lock); + return EINVAL; + } + lock->runcount = 0; + } + else + { + /* Drop a reader lock. */ + if (!(lock->runcount > 0)) + { + mtx_unlock (&lock->lock); + return EINVAL; + } + lock->runcount--; + } + if (lock->runcount == 0) + { + /* POSIX recommends that "write locks shall take precedence over read + locks", to avoid "writer starvation". */ + if (lock->waiting_writers_count > 0) + { + /* Wake up one of the waiting writers. */ + if (cnd_signal (&lock->waiting_writers) != thrd_success) + { + mtx_unlock (&lock->lock); + return EINVAL; + } + } + else + { + /* Wake up all waiting readers. */ + if (cnd_broadcast (&lock->waiting_readers) != thrd_success) + { + mtx_unlock (&lock->lock); + return EINVAL; + } + } + } + if (mtx_unlock (&lock->lock) != thrd_success) + return EINVAL; + return 0; +} + +int +glthread_rwlock_destroy (gl_rwlock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + mtx_destroy (&lock->lock); + cnd_destroy (&lock->waiting_readers); + cnd_destroy (&lock->waiting_writers); + return 0; +} + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +int +glthread_recursive_lock_init (gl_recursive_lock_t *lock) +{ + if (mtx_init (&lock->mutex, mtx_plain | mtx_recursive) != thrd_success) + return ENOMEM; + lock->init_needed = 0; + return 0; +} + +int +glthread_recursive_lock_lock (gl_recursive_lock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_lock (&lock->mutex) != thrd_success) + return EAGAIN; + return 0; +} + +int +glthread_recursive_lock_unlock (gl_recursive_lock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_unlock (&lock->mutex) != thrd_success) + return EINVAL; + return 0; +} + +int +glthread_recursive_lock_destroy (gl_recursive_lock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + mtx_destroy (&lock->mutex); + return 0; +} + +/* -------------------------- gl_once_t datatype -------------------------- */ + +#endif + +/* ========================================================================= */ + #if USE_POSIX_THREADS /* -------------------------- gl_lock_t datatype -------------------------- */ /* ------------------------- gl_rwlock_t datatype ------------------------- */ -# if HAVE_PTHREAD_RWLOCK +# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1))) + +# ifdef PTHREAD_RWLOCK_INITIALIZER + +# if !HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER + /* glibc with bug https://sourceware.org/bugzilla/show_bug.cgi?id=13701 */ + +int +glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock) +{ + pthread_rwlockattr_t attributes; + int err; -# if !defined PTHREAD_RWLOCK_INITIALIZER + err = pthread_rwlockattr_init (&attributes); + if (err != 0) + return err; + /* Note: PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP is the only value that + causes the writer to be preferred. PTHREAD_RWLOCK_PREFER_WRITER_NP does not + do this; see + http://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html */ + err = pthread_rwlockattr_setkind_np (&attributes, + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); + if (err == 0) + err = pthread_rwlock_init(lock, &attributes); + /* pthread_rwlockattr_destroy always returns 0. It cannot influence the + return value. */ + pthread_rwlockattr_destroy (&attributes); + return err; +} + +# endif +# else int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock) @@ -152,11 +403,9 @@ glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock) if (err != 0) return err; /* Test whether only readers are currently running, and whether the runcount - field will not overflow. */ - /* POSIX says: "It is implementation-defined whether the calling thread - acquires the lock when a writer does not hold the lock and there are - writers blocked on the lock." Let's say, no: give the writers a higher - priority. */ + field will not overflow, and whether no writer is waiting. The latter + condition is because POSIX recommends that "write locks shall take + precedence over read locks", to avoid "writer starvation". */ while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0)) { /* This thread has to wait for a while. Enqueue it among the @@ -473,585 +722,8 @@ glthread_once_singlethreaded (pthread_once_t *once_control) /* ========================================================================= */ -#if USE_PTH_THREADS - -/* Use the GNU Pth threads library. */ - -/* -------------------------- gl_lock_t datatype -------------------------- */ - -/* ------------------------- gl_rwlock_t datatype ------------------------- */ - -/* --------------------- gl_recursive_lock_t datatype --------------------- */ - -/* -------------------------- gl_once_t datatype -------------------------- */ - -static void -glthread_once_call (void *arg) -{ - void (**gl_once_temp_addr) (void) = (void (**) (void)) arg; - void (*initfunction) (void) = *gl_once_temp_addr; - initfunction (); -} - -int -glthread_once_multithreaded (pth_once_t *once_control, void (*initfunction) (void)) -{ - void (*temp) (void) = initfunction; - return (!pth_once (once_control, glthread_once_call, &temp) ? errno : 0); -} - -int -glthread_once_singlethreaded (pth_once_t *once_control) -{ - /* We know that pth_once_t is an integer type. */ - if (*once_control == PTH_ONCE_INIT) - { - /* First time use of once_control. Invert the marker. */ - *once_control = ~ PTH_ONCE_INIT; - return 1; - } - else - return 0; -} - -#endif - -/* ========================================================================= */ - -#if USE_SOLARIS_THREADS - -/* Use the old Solaris threads library. */ - -/* -------------------------- gl_lock_t datatype -------------------------- */ - -/* ------------------------- gl_rwlock_t datatype ------------------------- */ - -/* --------------------- gl_recursive_lock_t datatype --------------------- */ - -int -glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) -{ - int err; - - err = mutex_init (&lock->mutex, USYNC_THREAD, NULL); - if (err != 0) - return err; - lock->owner = (thread_t) 0; - lock->depth = 0; - return 0; -} - -int -glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock) -{ - thread_t self = thr_self (); - if (lock->owner != self) - { - int err; - - err = mutex_lock (&lock->mutex); - if (err != 0) - return err; - lock->owner = self; - } - if (++(lock->depth) == 0) /* wraparound? */ - { - lock->depth--; - return EAGAIN; - } - return 0; -} - -int -glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock) -{ - if (lock->owner != thr_self ()) - return EPERM; - if (lock->depth == 0) - return EINVAL; - if (--(lock->depth) == 0) - { - lock->owner = (thread_t) 0; - return mutex_unlock (&lock->mutex); - } - else - return 0; -} - -int -glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock) -{ - if (lock->owner != (thread_t) 0) - return EBUSY; - return mutex_destroy (&lock->mutex); -} - -/* -------------------------- gl_once_t datatype -------------------------- */ - -int -glthread_once_multithreaded (gl_once_t *once_control, void (*initfunction) (void)) -{ - if (!once_control->inited) - { - int err; - - /* Use the mutex to guarantee that if another thread is already calling - the initfunction, this thread waits until it's finished. */ - err = mutex_lock (&once_control->mutex); - if (err != 0) - return err; - if (!once_control->inited) - { - once_control->inited = 1; - initfunction (); - } - return mutex_unlock (&once_control->mutex); - } - else - return 0; -} - -int -glthread_once_singlethreaded (gl_once_t *once_control) -{ - /* We know that gl_once_t contains an integer type. */ - if (!once_control->inited) - { - /* First time use of once_control. Invert the marker. */ - once_control->inited = ~ 0; - return 1; - } - else - return 0; -} - -#endif - -/* ========================================================================= */ - #if USE_WINDOWS_THREADS -/* -------------------------- gl_lock_t datatype -------------------------- */ - -void -glthread_lock_init_func (gl_lock_t *lock) -{ - InitializeCriticalSection (&lock->lock); - lock->guard.done = 1; -} - -int -glthread_lock_lock_func (gl_lock_t *lock) -{ - if (!lock->guard.done) - { - if (InterlockedIncrement (&lock->guard.started) == 0) - /* This thread is the first one to need this lock. Initialize it. */ - glthread_lock_init (lock); - else - /* Yield the CPU while waiting for another thread to finish - initializing this lock. */ - while (!lock->guard.done) - Sleep (0); - } - EnterCriticalSection (&lock->lock); - return 0; -} - -int -glthread_lock_unlock_func (gl_lock_t *lock) -{ - if (!lock->guard.done) - return EINVAL; - LeaveCriticalSection (&lock->lock); - return 0; -} - -int -glthread_lock_destroy_func (gl_lock_t *lock) -{ - if (!lock->guard.done) - return EINVAL; - DeleteCriticalSection (&lock->lock); - lock->guard.done = 0; - return 0; -} - -/* ------------------------- gl_rwlock_t datatype ------------------------- */ - -/* In this file, the waitqueues are implemented as circular arrays. */ -#define gl_waitqueue_t gl_carray_waitqueue_t - -static void -gl_waitqueue_init (gl_waitqueue_t *wq) -{ - wq->array = NULL; - wq->count = 0; - wq->alloc = 0; - wq->offset = 0; -} - -/* Enqueues the current thread, represented by an event, in a wait queue. - Returns INVALID_HANDLE_VALUE if an allocation failure occurs. */ -static HANDLE -gl_waitqueue_add (gl_waitqueue_t *wq) -{ - HANDLE event; - unsigned int index; - - if (wq->count == wq->alloc) - { - unsigned int new_alloc = 2 * wq->alloc + 1; - HANDLE *new_array = - (HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE)); - if (new_array == NULL) - /* No more memory. */ - return INVALID_HANDLE_VALUE; - /* Now is a good opportunity to rotate the array so that its contents - starts at offset 0. */ - if (wq->offset > 0) - { - unsigned int old_count = wq->count; - unsigned int old_alloc = wq->alloc; - unsigned int old_offset = wq->offset; - unsigned int i; - if (old_offset + old_count > old_alloc) - { - unsigned int limit = old_offset + old_count - old_alloc; - for (i = 0; i < limit; i++) - new_array[old_alloc + i] = new_array[i]; - } - for (i = 0; i < old_count; i++) - new_array[i] = new_array[old_offset + i]; - wq->offset = 0; - } - wq->array = new_array; - wq->alloc = new_alloc; - } - /* Whether the created event is a manual-reset one or an auto-reset one, - does not matter, since we will wait on it only once. */ - event = CreateEvent (NULL, TRUE, FALSE, NULL); - if (event == INVALID_HANDLE_VALUE) - /* No way to allocate an event. */ - return INVALID_HANDLE_VALUE; - index = wq->offset + wq->count; - if (index >= wq->alloc) - index -= wq->alloc; - wq->array[index] = event; - wq->count++; - return event; -} - -/* Notifies the first thread from a wait queue and dequeues it. */ -static void -gl_waitqueue_notify_first (gl_waitqueue_t *wq) -{ - SetEvent (wq->array[wq->offset + 0]); - wq->offset++; - wq->count--; - if (wq->count == 0 || wq->offset == wq->alloc) - wq->offset = 0; -} - -/* Notifies all threads from a wait queue and dequeues them all. */ -static void -gl_waitqueue_notify_all (gl_waitqueue_t *wq) -{ - unsigned int i; - - for (i = 0; i < wq->count; i++) - { - unsigned int index = wq->offset + i; - if (index >= wq->alloc) - index -= wq->alloc; - SetEvent (wq->array[index]); - } - wq->count = 0; - wq->offset = 0; -} - -void -glthread_rwlock_init_func (gl_rwlock_t *lock) -{ - InitializeCriticalSection (&lock->lock); - gl_waitqueue_init (&lock->waiting_readers); - gl_waitqueue_init (&lock->waiting_writers); - lock->runcount = 0; - lock->guard.done = 1; -} - -int -glthread_rwlock_rdlock_func (gl_rwlock_t *lock) -{ - if (!lock->guard.done) - { - if (InterlockedIncrement (&lock->guard.started) == 0) - /* This thread is the first one to need this lock. Initialize it. */ - glthread_rwlock_init (lock); - else - /* Yield the CPU while waiting for another thread to finish - initializing this lock. */ - while (!lock->guard.done) - Sleep (0); - } - EnterCriticalSection (&lock->lock); - /* Test whether only readers are currently running, and whether the runcount - field will not overflow. */ - if (!(lock->runcount + 1 > 0)) - { - /* This thread has to wait for a while. Enqueue it among the - waiting_readers. */ - HANDLE event = gl_waitqueue_add (&lock->waiting_readers); - if (event != INVALID_HANDLE_VALUE) - { - DWORD result; - LeaveCriticalSection (&lock->lock); - /* Wait until another thread signals this event. */ - result = WaitForSingleObject (event, INFINITE); - if (result == WAIT_FAILED || result == WAIT_TIMEOUT) - abort (); - CloseHandle (event); - /* The thread which signalled the event already did the bookkeeping: - removed us from the waiting_readers, incremented lock->runcount. */ - if (!(lock->runcount > 0)) - abort (); - return 0; - } - else - { - /* Allocation failure. Weird. */ - do - { - LeaveCriticalSection (&lock->lock); - Sleep (1); - EnterCriticalSection (&lock->lock); - } - while (!(lock->runcount + 1 > 0)); - } - } - lock->runcount++; - LeaveCriticalSection (&lock->lock); - return 0; -} - -int -glthread_rwlock_wrlock_func (gl_rwlock_t *lock) -{ - if (!lock->guard.done) - { - if (InterlockedIncrement (&lock->guard.started) == 0) - /* This thread is the first one to need this lock. Initialize it. */ - glthread_rwlock_init (lock); - else - /* Yield the CPU while waiting for another thread to finish - initializing this lock. */ - while (!lock->guard.done) - Sleep (0); - } - EnterCriticalSection (&lock->lock); - /* Test whether no readers or writers are currently running. */ - if (!(lock->runcount == 0)) - { - /* This thread has to wait for a while. Enqueue it among the - waiting_writers. */ - HANDLE event = gl_waitqueue_add (&lock->waiting_writers); - if (event != INVALID_HANDLE_VALUE) - { - DWORD result; - LeaveCriticalSection (&lock->lock); - /* Wait until another thread signals this event. */ - result = WaitForSingleObject (event, INFINITE); - if (result == WAIT_FAILED || result == WAIT_TIMEOUT) - abort (); - CloseHandle (event); - /* The thread which signalled the event already did the bookkeeping: - removed us from the waiting_writers, set lock->runcount = -1. */ - if (!(lock->runcount == -1)) - abort (); - return 0; - } - else - { - /* Allocation failure. Weird. */ - do - { - LeaveCriticalSection (&lock->lock); - Sleep (1); - EnterCriticalSection (&lock->lock); - } - while (!(lock->runcount == 0)); - } - } - lock->runcount--; /* runcount becomes -1 */ - LeaveCriticalSection (&lock->lock); - return 0; -} - -int -glthread_rwlock_unlock_func (gl_rwlock_t *lock) -{ - if (!lock->guard.done) - return EINVAL; - EnterCriticalSection (&lock->lock); - if (lock->runcount < 0) - { - /* Drop a writer lock. */ - if (!(lock->runcount == -1)) - abort (); - lock->runcount = 0; - } - else - { - /* Drop a reader lock. */ - if (!(lock->runcount > 0)) - { - LeaveCriticalSection (&lock->lock); - return EPERM; - } - lock->runcount--; - } - if (lock->runcount == 0) - { - /* POSIX recommends that "write locks shall take precedence over read - locks", to avoid "writer starvation". */ - if (lock->waiting_writers.count > 0) - { - /* Wake up one of the waiting writers. */ - lock->runcount--; - gl_waitqueue_notify_first (&lock->waiting_writers); - } - else - { - /* Wake up all waiting readers. */ - lock->runcount += lock->waiting_readers.count; - gl_waitqueue_notify_all (&lock->waiting_readers); - } - } - LeaveCriticalSection (&lock->lock); - return 0; -} - -int -glthread_rwlock_destroy_func (gl_rwlock_t *lock) -{ - if (!lock->guard.done) - return EINVAL; - if (lock->runcount != 0) - return EBUSY; - DeleteCriticalSection (&lock->lock); - if (lock->waiting_readers.array != NULL) - free (lock->waiting_readers.array); - if (lock->waiting_writers.array != NULL) - free (lock->waiting_writers.array); - lock->guard.done = 0; - return 0; -} - -/* --------------------- gl_recursive_lock_t datatype --------------------- */ - -void -glthread_recursive_lock_init_func (gl_recursive_lock_t *lock) -{ - lock->owner = 0; - lock->depth = 0; - InitializeCriticalSection (&lock->lock); - lock->guard.done = 1; -} - -int -glthread_recursive_lock_lock_func (gl_recursive_lock_t *lock) -{ - if (!lock->guard.done) - { - if (InterlockedIncrement (&lock->guard.started) == 0) - /* This thread is the first one to need this lock. Initialize it. */ - glthread_recursive_lock_init (lock); - else - /* Yield the CPU while waiting for another thread to finish - initializing this lock. */ - while (!lock->guard.done) - Sleep (0); - } - { - DWORD self = GetCurrentThreadId (); - if (lock->owner != self) - { - EnterCriticalSection (&lock->lock); - lock->owner = self; - } - if (++(lock->depth) == 0) /* wraparound? */ - { - lock->depth--; - return EAGAIN; - } - } - return 0; -} - -int -glthread_recursive_lock_unlock_func (gl_recursive_lock_t *lock) -{ - if (lock->owner != GetCurrentThreadId ()) - return EPERM; - if (lock->depth == 0) - return EINVAL; - if (--(lock->depth) == 0) - { - lock->owner = 0; - LeaveCriticalSection (&lock->lock); - } - return 0; -} - -int -glthread_recursive_lock_destroy_func (gl_recursive_lock_t *lock) -{ - if (lock->owner != 0) - return EBUSY; - DeleteCriticalSection (&lock->lock); - lock->guard.done = 0; - return 0; -} - -/* -------------------------- gl_once_t datatype -------------------------- */ - -void -glthread_once_func (gl_once_t *once_control, void (*initfunction) (void)) -{ - if (once_control->inited <= 0) - { - if (InterlockedIncrement (&once_control->started) == 0) - { - /* This thread is the first one to come to this once_control. */ - InitializeCriticalSection (&once_control->lock); - EnterCriticalSection (&once_control->lock); - once_control->inited = 0; - initfunction (); - once_control->inited = 1; - LeaveCriticalSection (&once_control->lock); - } - else - { - /* Undo last operation. */ - InterlockedDecrement (&once_control->started); - /* Some other thread has already started the initialization. - Yield the CPU while waiting for the other thread to finish - initializing and taking the lock. */ - while (once_control->inited < 0) - Sleep (0); - if (once_control->inited <= 0) - { - /* Take the lock. This blocks until the other thread has - finished calling the initfunction. */ - EnterCriticalSection (&once_control->lock); - LeaveCriticalSection (&once_control->lock); - if (!(once_control->inited > 0)) - abort (); - } - } - } -} - #endif /* ========================================================================= */ diff --git a/gnulib/import/glthread/lock.h b/gnulib/import/glthread/lock.h index e64506b..c190e2e 100644 --- a/gnulib/import/glthread/lock.h +++ b/gnulib/import/glthread/lock.h @@ -1,5 +1,5 @@ /* Locking in multithreaded situations. - Copyright (C) 2005-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2019 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 @@ -12,11 +12,10 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. - Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h, - gthr-win32.h. */ + Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-win32.h. */ /* This file contains locking primitives for use with a given thread library. It does not contain primitives for creating threads or for other @@ -81,6 +80,125 @@ #include <errno.h> #include <stdlib.h> +#if !defined c11_threads_in_use +# if HAVE_THREADS_H && USE_POSIX_THREADS_WEAK +# include <threads.h> +# pragma weak thrd_exit +# define c11_threads_in_use() (thrd_exit != NULL) +# else +# define c11_threads_in_use() 0 +# endif +#endif + +/* ========================================================================= */ + +#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS + +/* Use the ISO C threads library. */ + +# include <threads.h> + +# ifdef __cplusplus +extern "C" { +# endif + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +typedef struct + { + int volatile init_needed; + once_flag init_once; + void (*init_func) (void); + mtx_t mutex; + } + gl_lock_t; +# define gl_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_lock_t NAME; +# define gl_lock_define_initialized(STORAGECLASS, NAME) \ + static void _atomic_init_##NAME (void); \ + STORAGECLASS gl_lock_t NAME = \ + { 1, ONCE_FLAG_INIT, _atomic_init_##NAME }; \ + static void _atomic_init_##NAME (void) \ + { \ + if (glthread_lock_init (&(NAME))) \ + abort (); \ + } +extern int glthread_lock_init (gl_lock_t *lock); +extern int glthread_lock_lock (gl_lock_t *lock); +extern int glthread_lock_unlock (gl_lock_t *lock); +extern int glthread_lock_destroy (gl_lock_t *lock); + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +typedef struct + { + int volatile init_needed; + once_flag init_once; + void (*init_func) (void); + mtx_t lock; /* protects the remaining fields */ + cnd_t waiting_readers; /* waiting readers */ + cnd_t waiting_writers; /* waiting writers */ + unsigned int waiting_writers_count; /* number of waiting writers */ + int runcount; /* number of readers running, or -1 when a writer runs */ + } + gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME; +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ + static void _atomic_init_##NAME (void); \ + STORAGECLASS gl_rwlock_t NAME = \ + { 1, ONCE_FLAG_INIT, _atomic_init_##NAME }; \ + static void _atomic_init_##NAME (void) \ + { \ + if (glthread_rwlock_init (&(NAME))) \ + abort (); \ + } +extern int glthread_rwlock_init (gl_rwlock_t *lock); +extern int glthread_rwlock_rdlock (gl_rwlock_t *lock); +extern int glthread_rwlock_wrlock (gl_rwlock_t *lock); +extern int glthread_rwlock_unlock (gl_rwlock_t *lock); +extern int glthread_rwlock_destroy (gl_rwlock_t *lock); + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +typedef struct + { + int volatile init_needed; + once_flag init_once; + void (*init_func) (void); + mtx_t mutex; + } + gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME; +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ + static void _atomic_init_##NAME (void); \ + STORAGECLASS gl_recursive_lock_t NAME = \ + { 1, ONCE_FLAG_INIT, _atomic_init_##NAME }; \ + static void _atomic_init_##NAME (void) \ + { \ + if (glthread_recursive_lock_init (&(NAME))) \ + abort (); \ + } +extern int glthread_recursive_lock_init (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_lock (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_unlock (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_destroy (gl_recursive_lock_t *lock); + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef once_flag gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS once_flag NAME = ONCE_FLAG_INIT; +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (call_once (ONCE_CONTROL, INITFUNCTION), 0) + +# ifdef __cplusplus +} +# endif + +#endif + /* ========================================================================= */ #if USE_POSIX_THREADS @@ -139,13 +257,25 @@ extern int glthread_in_use (void); # pragma weak pthread_mutexattr_init # pragma weak pthread_mutexattr_settype # pragma weak pthread_mutexattr_destroy +# pragma weak pthread_rwlockattr_init +# if __GNU_LIBRARY__ > 1 +# pragma weak pthread_rwlockattr_setkind_np +# endif +# pragma weak pthread_rwlockattr_destroy # ifndef pthread_self # pragma weak pthread_self # endif # if !PTHREAD_IN_USE_DETECTION_HARD -# pragma weak pthread_cancel -# define pthread_in_use() (pthread_cancel != NULL) + /* Considering all platforms with USE_POSIX_THREADS_WEAK, only few symbols + can be used to determine whether libpthread is in use. These are: + pthread_mutexattr_gettype + pthread_rwlockattr_destroy + pthread_rwlockattr_init + */ +# pragma weak pthread_mutexattr_gettype +# define pthread_in_use() \ + (pthread_mutexattr_gettype != NULL || c11_threads_in_use ()) # endif # else @@ -176,7 +306,7 @@ typedef pthread_mutex_t gl_lock_t; /* ------------------------- gl_rwlock_t datatype ------------------------- */ -# if HAVE_PTHREAD_RWLOCK +# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1))) # ifdef PTHREAD_RWLOCK_INITIALIZER @@ -185,10 +315,18 @@ typedef pthread_rwlock_t gl_rwlock_t; STORAGECLASS pthread_rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS pthread_rwlock_t NAME = gl_rwlock_initializer; -# define gl_rwlock_initializer \ - PTHREAD_RWLOCK_INITIALIZER -# define glthread_rwlock_init(LOCK) \ - (pthread_in_use () ? pthread_rwlock_init (LOCK, NULL) : 0) +# if HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER +# define gl_rwlock_initializer \ + PTHREAD_RWLOCK_INITIALIZER +# define glthread_rwlock_init(LOCK) \ + (pthread_in_use () ? pthread_rwlock_init (LOCK, NULL) : 0) +# else /* glibc with bug https://sourceware.org/bugzilla/show_bug.cgi?id=13701 */ +# define gl_rwlock_initializer \ + PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP +# define glthread_rwlock_init(LOCK) \ + (pthread_in_use () ? glthread_rwlock_init_for_glibc (LOCK) : 0) +extern int glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock); +# endif # define glthread_rwlock_rdlock(LOCK) \ (pthread_in_use () ? pthread_rwlock_rdlock (LOCK) : 0) # define glthread_rwlock_wrlock(LOCK) \ @@ -376,248 +514,16 @@ extern int glthread_once_singlethreaded (pthread_once_t *once_control); /* ========================================================================= */ -#if USE_PTH_THREADS - -/* Use the GNU Pth threads library. */ - -# include <pth.h> - -# ifdef __cplusplus -extern "C" { -# endif - -# if USE_PTH_THREADS_WEAK - -/* Use weak references to the GNU Pth threads library. */ - -# pragma weak pth_mutex_init -# pragma weak pth_mutex_acquire -# pragma weak pth_mutex_release -# pragma weak pth_rwlock_init -# pragma weak pth_rwlock_acquire -# pragma weak pth_rwlock_release -# pragma weak pth_once - -# pragma weak pth_cancel -# define pth_in_use() (pth_cancel != NULL) - -# else - -# define pth_in_use() 1 - -# endif - -/* -------------------------- gl_lock_t datatype -------------------------- */ - -typedef pth_mutex_t gl_lock_t; -# define gl_lock_define(STORAGECLASS, NAME) \ - STORAGECLASS pth_mutex_t NAME; -# define gl_lock_define_initialized(STORAGECLASS, NAME) \ - STORAGECLASS pth_mutex_t NAME = gl_lock_initializer; -# define gl_lock_initializer \ - PTH_MUTEX_INIT -# define glthread_lock_init(LOCK) \ - (pth_in_use () && !pth_mutex_init (LOCK) ? errno : 0) -# define glthread_lock_lock(LOCK) \ - (pth_in_use () && !pth_mutex_acquire (LOCK, 0, NULL) ? errno : 0) -# define glthread_lock_unlock(LOCK) \ - (pth_in_use () && !pth_mutex_release (LOCK) ? errno : 0) -# define glthread_lock_destroy(LOCK) \ - ((void)(LOCK), 0) - -/* ------------------------- gl_rwlock_t datatype ------------------------- */ - -typedef pth_rwlock_t gl_rwlock_t; -# define gl_rwlock_define(STORAGECLASS, NAME) \ - STORAGECLASS pth_rwlock_t NAME; -# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ - STORAGECLASS pth_rwlock_t NAME = gl_rwlock_initializer; -# define gl_rwlock_initializer \ - PTH_RWLOCK_INIT -# define glthread_rwlock_init(LOCK) \ - (pth_in_use () && !pth_rwlock_init (LOCK) ? errno : 0) -# define glthread_rwlock_rdlock(LOCK) \ - (pth_in_use () && !pth_rwlock_acquire (LOCK, PTH_RWLOCK_RD, 0, NULL) ? errno : 0) -# define glthread_rwlock_wrlock(LOCK) \ - (pth_in_use () && !pth_rwlock_acquire (LOCK, PTH_RWLOCK_RW, 0, NULL) ? errno : 0) -# define glthread_rwlock_unlock(LOCK) \ - (pth_in_use () && !pth_rwlock_release (LOCK) ? errno : 0) -# define glthread_rwlock_destroy(LOCK) \ - ((void)(LOCK), 0) - -/* --------------------- gl_recursive_lock_t datatype --------------------- */ - -/* In Pth, mutexes are recursive by default. */ -typedef pth_mutex_t gl_recursive_lock_t; -# define gl_recursive_lock_define(STORAGECLASS, NAME) \ - STORAGECLASS pth_mutex_t NAME; -# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ - STORAGECLASS pth_mutex_t NAME = gl_recursive_lock_initializer; -# define gl_recursive_lock_initializer \ - PTH_MUTEX_INIT -# define glthread_recursive_lock_init(LOCK) \ - (pth_in_use () && !pth_mutex_init (LOCK) ? errno : 0) -# define glthread_recursive_lock_lock(LOCK) \ - (pth_in_use () && !pth_mutex_acquire (LOCK, 0, NULL) ? errno : 0) -# define glthread_recursive_lock_unlock(LOCK) \ - (pth_in_use () && !pth_mutex_release (LOCK) ? errno : 0) -# define glthread_recursive_lock_destroy(LOCK) \ - ((void)(LOCK), 0) - -/* -------------------------- gl_once_t datatype -------------------------- */ - -typedef pth_once_t gl_once_t; -# define gl_once_define(STORAGECLASS, NAME) \ - STORAGECLASS pth_once_t NAME = PTH_ONCE_INIT; -# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ - (pth_in_use () \ - ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \ - : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) -extern int glthread_once_multithreaded (pth_once_t *once_control, void (*initfunction) (void)); -extern int glthread_once_singlethreaded (pth_once_t *once_control); - -# ifdef __cplusplus -} -# endif - -#endif - -/* ========================================================================= */ - -#if USE_SOLARIS_THREADS - -/* Use the old Solaris threads library. */ - -# include <thread.h> -# include <synch.h> - -# ifdef __cplusplus -extern "C" { -# endif - -# if USE_SOLARIS_THREADS_WEAK - -/* Use weak references to the old Solaris threads library. */ - -# pragma weak mutex_init -# pragma weak mutex_lock -# pragma weak mutex_unlock -# pragma weak mutex_destroy -# pragma weak rwlock_init -# pragma weak rw_rdlock -# pragma weak rw_wrlock -# pragma weak rw_unlock -# pragma weak rwlock_destroy -# pragma weak thr_self - -# pragma weak thr_suspend -# define thread_in_use() (thr_suspend != NULL) - -# else - -# define thread_in_use() 1 - -# endif - -/* -------------------------- gl_lock_t datatype -------------------------- */ - -typedef mutex_t gl_lock_t; -# define gl_lock_define(STORAGECLASS, NAME) \ - STORAGECLASS mutex_t NAME; -# define gl_lock_define_initialized(STORAGECLASS, NAME) \ - STORAGECLASS mutex_t NAME = gl_lock_initializer; -# define gl_lock_initializer \ - DEFAULTMUTEX -# define glthread_lock_init(LOCK) \ - (thread_in_use () ? mutex_init (LOCK, USYNC_THREAD, NULL) : 0) -# define glthread_lock_lock(LOCK) \ - (thread_in_use () ? mutex_lock (LOCK) : 0) -# define glthread_lock_unlock(LOCK) \ - (thread_in_use () ? mutex_unlock (LOCK) : 0) -# define glthread_lock_destroy(LOCK) \ - (thread_in_use () ? mutex_destroy (LOCK) : 0) - -/* ------------------------- gl_rwlock_t datatype ------------------------- */ - -typedef rwlock_t gl_rwlock_t; -# define gl_rwlock_define(STORAGECLASS, NAME) \ - STORAGECLASS rwlock_t NAME; -# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ - STORAGECLASS rwlock_t NAME = gl_rwlock_initializer; -# define gl_rwlock_initializer \ - DEFAULTRWLOCK -# define glthread_rwlock_init(LOCK) \ - (thread_in_use () ? rwlock_init (LOCK, USYNC_THREAD, NULL) : 0) -# define glthread_rwlock_rdlock(LOCK) \ - (thread_in_use () ? rw_rdlock (LOCK) : 0) -# define glthread_rwlock_wrlock(LOCK) \ - (thread_in_use () ? rw_wrlock (LOCK) : 0) -# define glthread_rwlock_unlock(LOCK) \ - (thread_in_use () ? rw_unlock (LOCK) : 0) -# define glthread_rwlock_destroy(LOCK) \ - (thread_in_use () ? rwlock_destroy (LOCK) : 0) - -/* --------------------- gl_recursive_lock_t datatype --------------------- */ - -/* Old Solaris threads did not have recursive locks. - We have to implement them ourselves. */ - -typedef struct - { - mutex_t mutex; - thread_t owner; - unsigned long depth; - } - gl_recursive_lock_t; -# define gl_recursive_lock_define(STORAGECLASS, NAME) \ - STORAGECLASS gl_recursive_lock_t NAME; -# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ - STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; -# define gl_recursive_lock_initializer \ - { DEFAULTMUTEX, (thread_t) 0, 0 } -# define glthread_recursive_lock_init(LOCK) \ - (thread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0) -# define glthread_recursive_lock_lock(LOCK) \ - (thread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0) -# define glthread_recursive_lock_unlock(LOCK) \ - (thread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0) -# define glthread_recursive_lock_destroy(LOCK) \ - (thread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0) -extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock); -extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock); -extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock); -extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock); - -/* -------------------------- gl_once_t datatype -------------------------- */ - -typedef struct - { - volatile int inited; - mutex_t mutex; - } - gl_once_t; -# define gl_once_define(STORAGECLASS, NAME) \ - STORAGECLASS gl_once_t NAME = { 0, DEFAULTMUTEX }; -# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ - (thread_in_use () \ - ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \ - : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) -extern int glthread_once_multithreaded (gl_once_t *once_control, void (*initfunction) (void)); -extern int glthread_once_singlethreaded (gl_once_t *once_control); - -# ifdef __cplusplus -} -# endif - -#endif - -/* ========================================================================= */ - #if USE_WINDOWS_THREADS # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> +# include "windows-mutex.h" +# include "windows-rwlock.h" +# include "windows-recmutex.h" +# include "windows-once.h" + # ifdef __cplusplus extern "C" { # endif @@ -633,127 +539,69 @@ extern "C" { /* There is no way to statically initialize a CRITICAL_SECTION. It needs to be done lazily, once only. For this we need spinlocks. */ -typedef struct { volatile int done; volatile long started; } gl_spinlock_t; - /* -------------------------- gl_lock_t datatype -------------------------- */ -typedef struct - { - gl_spinlock_t guard; /* protects the initialization */ - CRITICAL_SECTION lock; - } - gl_lock_t; +typedef glwthread_mutex_t gl_lock_t; # define gl_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_lock_t NAME; # define gl_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_lock_t NAME = gl_lock_initializer; # define gl_lock_initializer \ - { { 0, -1 } } + GLWTHREAD_MUTEX_INIT # define glthread_lock_init(LOCK) \ - (glthread_lock_init_func (LOCK), 0) + (glwthread_mutex_init (LOCK), 0) # define glthread_lock_lock(LOCK) \ - glthread_lock_lock_func (LOCK) + glwthread_mutex_lock (LOCK) # define glthread_lock_unlock(LOCK) \ - glthread_lock_unlock_func (LOCK) + glwthread_mutex_unlock (LOCK) # define glthread_lock_destroy(LOCK) \ - glthread_lock_destroy_func (LOCK) -extern void glthread_lock_init_func (gl_lock_t *lock); -extern int glthread_lock_lock_func (gl_lock_t *lock); -extern int glthread_lock_unlock_func (gl_lock_t *lock); -extern int glthread_lock_destroy_func (gl_lock_t *lock); + glwthread_mutex_destroy (LOCK) /* ------------------------- gl_rwlock_t datatype ------------------------- */ -/* It is impossible to implement read-write locks using plain locks, without - introducing an extra thread dedicated to managing read-write locks. - Therefore here we need to use the low-level Event type. */ - -typedef struct - { - HANDLE *array; /* array of waiting threads, each represented by an event */ - unsigned int count; /* number of waiting threads */ - unsigned int alloc; /* length of allocated array */ - unsigned int offset; /* index of first waiting thread in array */ - } - gl_carray_waitqueue_t; -typedef struct - { - gl_spinlock_t guard; /* protects the initialization */ - CRITICAL_SECTION lock; /* protects the remaining fields */ - gl_carray_waitqueue_t waiting_readers; /* waiting readers */ - gl_carray_waitqueue_t waiting_writers; /* waiting writers */ - int runcount; /* number of readers running, or -1 when a writer runs */ - } - gl_rwlock_t; +typedef glwthread_rwlock_t gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; # define gl_rwlock_initializer \ - { { 0, -1 } } + GLWTHREAD_RWLOCK_INIT # define glthread_rwlock_init(LOCK) \ - (glthread_rwlock_init_func (LOCK), 0) + (glwthread_rwlock_init (LOCK), 0) # define glthread_rwlock_rdlock(LOCK) \ - glthread_rwlock_rdlock_func (LOCK) + glwthread_rwlock_rdlock (LOCK) # define glthread_rwlock_wrlock(LOCK) \ - glthread_rwlock_wrlock_func (LOCK) + glwthread_rwlock_wrlock (LOCK) # define glthread_rwlock_unlock(LOCK) \ - glthread_rwlock_unlock_func (LOCK) + glwthread_rwlock_unlock (LOCK) # define glthread_rwlock_destroy(LOCK) \ - glthread_rwlock_destroy_func (LOCK) -extern void glthread_rwlock_init_func (gl_rwlock_t *lock); -extern int glthread_rwlock_rdlock_func (gl_rwlock_t *lock); -extern int glthread_rwlock_wrlock_func (gl_rwlock_t *lock); -extern int glthread_rwlock_unlock_func (gl_rwlock_t *lock); -extern int glthread_rwlock_destroy_func (gl_rwlock_t *lock); + glwthread_rwlock_destroy (LOCK) /* --------------------- gl_recursive_lock_t datatype --------------------- */ -/* The native Windows documentation says that CRITICAL_SECTION already - implements a recursive lock. But we need not rely on it: It's easy to - implement a recursive lock without this assumption. */ - -typedef struct - { - gl_spinlock_t guard; /* protects the initialization */ - DWORD owner; - unsigned long depth; - CRITICAL_SECTION lock; - } - gl_recursive_lock_t; +typedef glwthread_recmutex_t gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME; # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; # define gl_recursive_lock_initializer \ - { { 0, -1 }, 0, 0 } + GLWTHREAD_RECMUTEX_INIT # define glthread_recursive_lock_init(LOCK) \ - (glthread_recursive_lock_init_func (LOCK), 0) + (glwthread_recmutex_init (LOCK), 0) # define glthread_recursive_lock_lock(LOCK) \ - glthread_recursive_lock_lock_func (LOCK) + glwthread_recmutex_lock (LOCK) # define glthread_recursive_lock_unlock(LOCK) \ - glthread_recursive_lock_unlock_func (LOCK) + glwthread_recmutex_unlock (LOCK) # define glthread_recursive_lock_destroy(LOCK) \ - glthread_recursive_lock_destroy_func (LOCK) -extern void glthread_recursive_lock_init_func (gl_recursive_lock_t *lock); -extern int glthread_recursive_lock_lock_func (gl_recursive_lock_t *lock); -extern int glthread_recursive_lock_unlock_func (gl_recursive_lock_t *lock); -extern int glthread_recursive_lock_destroy_func (gl_recursive_lock_t *lock); + glwthread_recmutex_destroy (LOCK) /* -------------------------- gl_once_t datatype -------------------------- */ -typedef struct - { - volatile int inited; - volatile long started; - CRITICAL_SECTION lock; - } - gl_once_t; +typedef glwthread_once_t gl_once_t; # define gl_once_define(STORAGECLASS, NAME) \ - STORAGECLASS gl_once_t NAME = { -1, -1 }; + STORAGECLASS gl_once_t NAME = GLWTHREAD_ONCE_INIT; # define glthread_once(ONCE_CONTROL, INITFUNCTION) \ - (glthread_once_func (ONCE_CONTROL, INITFUNCTION), 0) -extern void glthread_once_func (gl_once_t *once_control, void (*initfunction) (void)); + (glwthread_once (ONCE_CONTROL, INITFUNCTION), 0) # ifdef __cplusplus } @@ -763,7 +611,7 @@ extern void glthread_once_func (gl_once_t *once_control, void (*initfunction) (v /* ========================================================================= */ -#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WINDOWS_THREADS) +#if !(USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS) /* Provide dummy implementation if threads are not supported. */ diff --git a/gnulib/import/glthread/threadlib.c b/gnulib/import/glthread/threadlib.c index be63713..86947f5 100644 --- a/gnulib/import/glthread/threadlib.c +++ b/gnulib/import/glthread/threadlib.c @@ -1,5 +1,5 @@ /* Multithreading primitives. - Copyright (C) 2005-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. */ @@ -20,7 +20,7 @@ /* ========================================================================= */ -#if USE_POSIX_THREADS +#if USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS /* Use the POSIX threads library. */ diff --git a/gnulib/import/hard-locale.c b/gnulib/import/hard-locale.c index c7d9da5..dcfcad6 100644 --- a/gnulib/import/hard-locale.c +++ b/gnulib/import/hard-locale.c @@ -1,6 +1,6 @@ /* hard-locale.c -- Determine whether a locale is hard. - Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2016 Free Software + Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/hard-locale.h b/gnulib/import/hard-locale.h index 7644afa..8f1da96 100644 --- a/gnulib/import/hard-locale.h +++ b/gnulib/import/hard-locale.h @@ -1,6 +1,6 @@ /* Determine whether a locale is hard. - Copyright (C) 1999, 2003-2004, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 1999, 2003-2004, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef HARD_LOCALE_H_ # define HARD_LOCALE_H_ 1 diff --git a/gnulib/import/inet_ntop.c b/gnulib/import/inet_ntop.c index 8668bf6..14c38d2 100644 --- a/gnulib/import/inet_ntop.c +++ b/gnulib/import/inet_ntop.c @@ -1,6 +1,6 @@ /* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form - Copyright (C) 2005-2006, 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* * Copyright (c) 1996-1999 by Internet Software Consortium. diff --git a/gnulib/import/intprops.h b/gnulib/import/intprops.h index 8add5de..0c3963d 100644 --- a/gnulib/import/intprops.h +++ b/gnulib/import/intprops.h @@ -1,6 +1,6 @@ /* intprops.h -- properties of integer types - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -21,18 +21,14 @@ #define _GL_INTPROPS_H #include <limits.h> -#include <verify.h> -#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)) +/* Return a value with the common real type of E and V and the value of V. + Do not evaluate E. */ +#define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v)) /* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see - <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html>. */ -#define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v)) + <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00406.html>. */ +#define _GL_INT_NEGATE_CONVERT(e, v) ((1 ? 0 : (e)) - (v)) /* The extra casts in the following macros work around compiler bugs, e.g., in Cray C 5.0.3.0. */ @@ -45,13 +41,14 @@ #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) /* Return 1 if the real expression E, after promotion, has a - signed or floating type. */ + signed or floating type. Do not evaluate E. */ #define EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) /* Minimum and maximum values for integer types and expressions. */ /* The width in bits of the integer type or expression T. + Do not evaluate T. Padding bits are not supported; this is checked at compile-time below. */ #define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) @@ -63,7 +60,7 @@ : ((((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. */ + after integer promotion. E is not evaluated. */ #define _GL_INT_MINIMUM(e) \ (EXPR_SIGNED (e) \ ? ~ _GL_SIGNED_INT_MAXIMUM (e) \ @@ -84,24 +81,7 @@ /* This include file assumes that signed types are two's complement without padding bits; the above macros have undefined behavior otherwise. If this is a problem for you, please let us know how to fix it for your host. - As a sanity check, test the assumption for some signed types that - <limits.h> bounds. */ -verify (TYPE_MINIMUM (signed char) == SCHAR_MIN); -verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX); -verify (TYPE_MINIMUM (short int) == SHRT_MIN); -verify (TYPE_MAXIMUM (short int) == SHRT_MAX); -verify (TYPE_MINIMUM (int) == INT_MIN); -verify (TYPE_MAXIMUM (int) == INT_MAX); -verify (TYPE_MINIMUM (long int) == LONG_MIN); -verify (TYPE_MAXIMUM (long int) == LONG_MAX); -#ifdef LLONG_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 + This assumption is tested by the intprops-tests module. */ /* Does the __typeof__ keyword work? This could be done by 'configure', but for now it's easier to do it by hand. */ @@ -131,8 +111,8 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); Subtract 1 for the sign bit if T is signed, and then add 1 more for a minus sign if needed. - Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 0 when its argument is - signed, this macro may overestimate the true bound by one byte when + Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 1 when its argument is + unsigned, 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 (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \ @@ -201,7 +181,7 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); /* Return 1 if A * B would overflow in [MIN,MAX] arithmetic. See above for restrictions. Avoid && and || as they tickle bugs in Sun C 5.11 2010/08/13 and other compilers; see - <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. */ + <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00401.html>. */ #define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \ ((b) < 0 \ ? ((a) < 0 \ @@ -240,13 +220,27 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); ? (a) < (min) >> (b) \ : (max) >> (b) < (a)) -/* 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 (A, B, P) and __builtin_sub_overflow + (A, B, P) work when P is non-null. */ +#if 5 <= __GNUC__ && !defined __ICC +# define _GL_HAS_BUILTIN_ADD_OVERFLOW 1 +#elif defined __has_builtin +# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow) +#else +# define _GL_HAS_BUILTIN_ADD_OVERFLOW 0 +#endif + +/* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */ +#ifdef __clang__ +/* Work around Clang bug <https://bugs.llvm.org/show_bug.cgi?id=16404>. */ +# define _GL_HAS_BUILTIN_MUL_OVERFLOW 0 +#else +# define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW +#endif -/* True if __builtin_add_overflow_p (A, B, C) works. */ -#define _GL_HAS_BUILTIN_OVERFLOW_P \ - (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) +/* True if __builtin_add_overflow_p (A, B, C) works, and similarly for + __builtin_mul_overflow_p and __builtin_mul_overflow_p. */ +#define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__) /* The _GL*_OVERFLOW macros have the same restrictions as the *_RANGE_OVERFLOW macros, except that they do not assume that operands @@ -299,7 +293,9 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators might not yield numerically correct answers due to arithmetic overflow. - The INT_<op>_WRAPV macros also store the low-order bits of the answer. + The INT_<op>_WRAPV macros compute the low-order bits of the sum, + difference, and product of two C integers, and return 1 if these + low-order bits are not numerically correct. These macros work correctly on all known practical hosts, and do not rely on undefined behavior due to signed arithmetic overflow. @@ -327,9 +323,11 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); arguments should not have side effects. The WRAPV macros are not constant expressions. They support only - +, binary -, and *. The result type must be signed. + +, binary -, and *. Because the WRAPV macros convert the result, + they report overflow in different circumstances than the OVERFLOW + macros do. - These macros are tuned for their last argument being a constant. + These macros are tuned for their last input argument being a constant. Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B, A % B, and A << B would overflow, respectively. */ @@ -360,24 +358,43 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); Arguments should be free of side effects. */ #define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \ op_result_overflow (a, b, \ - _GL_INT_MINIMUM (0 * (b) + (a)), \ - _GL_INT_MAXIMUM (0 * (b) + (a))) + _GL_INT_MINIMUM (_GL_INT_CONVERT (a, b)), \ + _GL_INT_MAXIMUM (_GL_INT_CONVERT (a, b))) /* Store the low-order bits of A + B, A - B, A * B, respectively, into *R. Return 1 if the result overflows. See above for restrictions. */ -#define INT_ADD_WRAPV(a, b, r) \ - _GL_INT_OP_WRAPV (a, b, r, +, __builtin_add_overflow, INT_ADD_OVERFLOW) -#define INT_SUBTRACT_WRAPV(a, b, r) \ - _GL_INT_OP_WRAPV (a, b, r, -, __builtin_sub_overflow, INT_SUBTRACT_OVERFLOW) -#define INT_MULTIPLY_WRAPV(a, b, r) \ - _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW) +#if _GL_HAS_BUILTIN_ADD_OVERFLOW +# define INT_ADD_WRAPV(a, b, r) __builtin_add_overflow (a, b, r) +# define INT_SUBTRACT_WRAPV(a, b, r) __builtin_sub_overflow (a, b, r) +#else +# define INT_ADD_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW) +# define INT_SUBTRACT_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW) +#endif +#if _GL_HAS_BUILTIN_MUL_OVERFLOW +# if (9 < __GNUC__ + (3 <= __GNUC_MINOR__) \ + || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) +# define INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r) +# else + /* Work around GCC bug 91450. */ +# define INT_MULTIPLY_WRAPV(a, b, r) \ + ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && EXPR_SIGNED (a) && EXPR_SIGNED (b) \ + && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \ + ? ((void) __builtin_mul_overflow (a, b, r), 1) \ + : __builtin_mul_overflow (a, b, r)) +# endif +#else +# define INT_MULTIPLY_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) +#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 For now, assume all versions of GCC-like compilers generate bogus - warnings for _Generic. This matters only for older compilers that - lack __builtin_add_overflow. */ + warnings for _Generic. This matters only for compilers that + lack relevant builtins. */ #if __GNUC__ # define _GL__GENERIC_BOGUS 1 #else @@ -385,80 +402,183 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); #endif /* Store the low-order bits of A <op> B into *R, where OP specifies - the operation. BUILTIN is the builtin operation, and OVERFLOW the - overflow predicate. Return 1 if the result overflows. See above - for restrictions. */ -#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) \ + the operation and OVERFLOW the overflow predicate. Return 1 if the + result overflows. See above for restrictions. */ +#if 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS +# define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \ (_Generic \ (*(r), \ signed char: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ signed char, SCHAR_MIN, SCHAR_MAX), \ + unsigned char: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + unsigned char, 0, UCHAR_MAX), \ short int: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ short int, SHRT_MIN, SHRT_MAX), \ + unsigned short int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + unsigned short int, 0, USHRT_MAX), \ int: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ int, INT_MIN, INT_MAX), \ + unsigned int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + unsigned int, 0, UINT_MAX), \ long int: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ long int, LONG_MIN, LONG_MAX), \ + unsigned long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + unsigned long int, 0, ULONG_MAX), \ long long int: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ - long long int, LLONG_MIN, LLONG_MAX))) + long long int, LLONG_MIN, LLONG_MAX), \ + unsigned long long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + unsigned long long int, 0, ULLONG_MAX))) #else -# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ +/* Store the low-order bits of A <op> B into *R, where OP specifies + the operation and OVERFLOW the overflow predicate. If *R is + signed, its type is ST with bounds SMIN..SMAX; otherwise its type + is UT with bounds U..UMAX. ST and UT are narrower than int. + Return 1 if the result overflows. See above for restrictions. */ +# if _GL_HAVE___TYPEOF__ +# define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \ + (TYPE_SIGNED (__typeof__ (*(r))) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, st, smin, smax) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, ut, 0, umax)) +# else +# define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \ + (overflow (a, b, smin, smax) \ + ? (overflow (a, b, 0, umax) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 1) \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) < 0) \ + : (overflow (a, b, 0, umax) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) >= 0 \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 0))) +# endif + +# define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \ (sizeof *(r) == sizeof (signed char) \ - ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ - signed char, SCHAR_MIN, SCHAR_MAX) \ + ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \ + signed char, SCHAR_MIN, SCHAR_MAX, \ + unsigned char, UCHAR_MAX) \ : sizeof *(r) == sizeof (short int) \ - ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ - short int, SHRT_MIN, SHRT_MAX) \ + ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \ + short int, SHRT_MIN, SHRT_MAX, \ + unsigned short int, USHRT_MAX) \ : sizeof *(r) == sizeof (int) \ - ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ - int, INT_MIN, INT_MAX) \ + ? (EXPR_SIGNED (*(r)) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + unsigned int, 0, UINT_MAX)) \ : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow)) # ifdef LLONG_MAX # define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ (sizeof *(r) == sizeof (long int) \ - ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ - long int, LONG_MIN, LONG_MAX) \ - : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ - long long int, LLONG_MIN, LLONG_MAX)) + ? (EXPR_SIGNED (*(r)) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + unsigned long int, 0, ULONG_MAX)) \ + : (EXPR_SIGNED (*(r)) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + unsigned long long int, 0, ULLONG_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) + (EXPR_SIGNED (*(r)) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + unsigned long int, 0, ULONG_MAX)) # endif #endif /* Store the low-order bits of A <op> B into *R, where the operation is given by OP. Use the unsigned type UT for calculation to avoid - overflow problems. *R's type is T, with extremal values TMIN and - TMAX. T must be a signed integer type. Return 1 if the result - overflows. */ + overflow problems. *R's type is T, with extrema TMIN and TMAX. + T must be a signed integer type. Return 1 if the result overflows. */ #define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \ - (sizeof ((a) op (b)) < sizeof (t) \ - ? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \ - : _GL_INT_OP_CALC1 (a, b, r, op, overflow, ut, t, tmin, tmax)) -#define _GL_INT_OP_CALC1(a, b, r, op, overflow, ut, t, tmin, tmax) \ - ((overflow (a, b) \ - || (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \ - || (tmax) < ((a) op (b))) \ - ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 1) \ - : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 0)) - -/* Return A <op> B, where the operation is given by OP. Use the - unsigned type UT for calculation to avoid overflow problems. - Convert the result to type T without overflow by subtracting TMIN - from large values before converting, and adding it afterwards. - Compilers can optimize all the operations except OP. */ -#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t, tmin, tmax) \ - (((ut) (a) op (ut) (b)) <= (tmax) \ - ? (t) ((ut) (a) op (ut) (b)) \ - : ((t) (((ut) (a) op (ut) (b)) - (tmin)) + (tmin))) + (overflow (a, b, tmin, tmax) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0)) + +/* Return the low-order bits of A <op> B, where the operation is given + by OP. Use the unsigned type UT for calculation to avoid undefined + behavior on signed integer overflow, and convert the result to type T. + UT is at least as wide as T and is no narrower than unsigned int, + T is two's complement, and there is no padding or trap representations. + Assume that converting UT to T yields the low-order bits, as is + done in all known two's-complement C compilers. E.g., see: + https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html + + According to the C standard, converting UT to T yields an + implementation-defined result or signal for values outside T's + range. However, code that works around this theoretical problem + runs afoul of a compiler bug in Oracle Studio 12.3 x86. See: + https://lists.gnu.org/r/bug-gnulib/2017-04/msg00049.html + As the compiler bug is real, don't try to work around the + theoretical problem. */ + +#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t) \ + ((t) ((ut) (a) op (ut) (b))) + +/* Return true if the numeric values A + B, A - B, A * B fall outside + the range TMIN..TMAX. Arguments should be integer expressions + without side effects. TMIN should be signed and nonpositive. + TMAX should be positive, and should be signed unless TMIN is zero. */ +#define _GL_INT_ADD_RANGE_OVERFLOW(a, b, tmin, tmax) \ + ((b) < 0 \ + ? (((tmin) \ + ? ((EXPR_SIGNED (_GL_INT_CONVERT (a, (tmin) - (b))) || (b) < (tmin)) \ + && (a) < (tmin) - (b)) \ + : (a) <= -1 - (b)) \ + || ((EXPR_SIGNED (a) ? 0 <= (a) : (tmax) < (a)) && (tmax) < (a) + (b))) \ + : (a) < 0 \ + ? (((tmin) \ + ? ((EXPR_SIGNED (_GL_INT_CONVERT (b, (tmin) - (a))) || (a) < (tmin)) \ + && (b) < (tmin) - (a)) \ + : (b) <= -1 - (a)) \ + || ((EXPR_SIGNED (_GL_INT_CONVERT (a, b)) || (tmax) < (b)) \ + && (tmax) < (a) + (b))) \ + : (tmax) < (b) || (tmax) - (b) < (a)) +#define _GL_INT_SUBTRACT_RANGE_OVERFLOW(a, b, tmin, tmax) \ + (((a) < 0) == ((b) < 0) \ + ? ((a) < (b) \ + ? !(tmin) || -1 - (tmin) < (b) - (a) - 1 \ + : (tmax) < (a) - (b)) \ + : (a) < 0 \ + ? ((!EXPR_SIGNED (_GL_INT_CONVERT ((a) - (tmin), b)) && (a) - (tmin) < 0) \ + || (a) - (tmin) < (b)) \ + : ((! (EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \ + && EXPR_SIGNED (_GL_INT_CONVERT ((tmax) + (b), a))) \ + && (tmax) <= -1 - (b)) \ + || (tmax) + (b) < (a))) +#define _GL_INT_MULTIPLY_RANGE_OVERFLOW(a, b, tmin, tmax) \ + ((b) < 0 \ + ? ((a) < 0 \ + ? (EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \ + ? (a) < (tmax) / (b) \ + : ((INT_NEGATE_OVERFLOW (b) \ + ? _GL_INT_CONVERT (b, tmax) >> (TYPE_WIDTH (b) - 1) \ + : (tmax) / -(b)) \ + <= -1 - (a))) \ + : INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (b, tmin)) && (b) == -1 \ + ? (EXPR_SIGNED (a) \ + ? 0 < (a) + (tmin) \ + : 0 < (a) && -1 - (tmin) < (a) - 1) \ + : (tmin) / (b) < (a)) \ + : (b) == 0 \ + ? 0 \ + : ((a) < 0 \ + ? (INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (a, tmin)) && (a) == -1 \ + ? (EXPR_SIGNED (b) ? 0 < (b) + (tmin) : -1 - (tmin) < (b) - 1) \ + : (tmin) / (a) < (b)) \ + : (tmax) / (b) < (a))) #endif /* _GL_INTPROPS_H */ diff --git a/gnulib/import/inttypes.in.h b/gnulib/import/inttypes.in.h index ed09db6..49bcbc1 100644 --- a/gnulib/import/inttypes.in.h +++ b/gnulib/import/inttypes.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006-2016 Free Software Foundation, Inc. +/* Copyright (C) 2006-2019 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Derek Price. This file is part of gnulib. @@ -13,11 +13,11 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* * ISO C 99 <inttypes.h> for platforms that lack it. - * <http://www.opengroup.org/susv3xbd/inttypes.h.html> + * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/inttypes.h.html> */ #if __GNUC__ >= 3 @@ -49,15 +49,15 @@ #ifndef __GLIBC__ # include <stdint.h> #endif -/* Get CHAR_BIT. */ +/* Get CHAR_BIT, INT_MAX, LONG_MAX, etc. */ #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 -#if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX) -# error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>." +#if !(INT_MAX == 0x7fffffff && INT_MIN + INT_MAX == -1) +# error "This file assumes that 'int' is 32-bit two's complement. Please report your platform and compiler to <bug-gnulib@gnu.org>." #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -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 diff --git a/gnulib/import/isnan.c b/gnulib/import/isnan.c index e1e57b2..c399c18 100644 --- a/gnulib/import/isnan.c +++ b/gnulib/import/isnan.c @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff --git a/gnulib/import/isnand-nolibm.h b/gnulib/import/isnand-nolibm.h index dc47264..174c61e 100644 --- a/gnulib/import/isnand-nolibm.h +++ b/gnulib/import/isnand-nolibm.h @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if HAVE_ISNAND_IN_LIBC /* Get declaration of isnan macro. */ diff --git a/gnulib/import/isnand.c b/gnulib/import/isnand.c index 405b23a..c3cd315 100644 --- a/gnulib/import/isnand.c +++ b/gnulib/import/isnand.c @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2008-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ diff --git a/gnulib/import/isnanl-nolibm.h b/gnulib/import/isnanl-nolibm.h index efd9199..fdedf56 100644 --- a/gnulib/import/isnanl-nolibm.h +++ b/gnulib/import/isnanl-nolibm.h @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if HAVE_ISNANL_IN_LIBC /* Get declaration of isnan macro or (older) isnanl function. */ diff --git a/gnulib/import/isnanl.c b/gnulib/import/isnanl.c index 67d39d1..99afd29 100644 --- a/gnulib/import/isnanl.c +++ b/gnulib/import/isnanl.c @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff --git a/gnulib/import/itold.c b/gnulib/import/itold.c index 5533392..bca01eb 100644 --- a/gnulib/import/itold.c +++ b/gnulib/import/itold.c @@ -1,5 +1,5 @@ /* Replacement for 'int' to 'long double' conversion routine. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/libc-config.h b/gnulib/import/libc-config.h new file mode 100644 index 0000000..57c6966 --- /dev/null +++ b/gnulib/import/libc-config.h @@ -0,0 +1,174 @@ +/* System definitions for code taken from the GNU C Library + + Copyright 2017-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, see + <https://www.gnu.org/licenses/>. */ + +/* Written by Paul Eggert. */ + +/* This is intended to be a good-enough substitute for glibc system + macros like those defined in <sys/cdefs.h>, so that Gnulib code + shared with glibc can do this as the first #include: + + #ifndef _LIBC + # include <libc-config.h> + #endif + + When compiled as part of glibc this is a no-op; when compiled as + part of Gnulib this includes Gnulib's <config.h> and defines macros + that glibc library code would normally assume. */ + +#include <config.h> + +/* On glibc this includes <features.h> and <sys/cdefs.h> and #defines + _FEATURES_H, __WORDSIZE, and __set_errno. On FreeBSD 11 it + includes <sys/cdefs.h> which defines __nonnull. Elsewhere it + is harmless. */ +#include <errno.h> + +/* From glibc <errno.h>. */ +#ifndef __set_errno +# define __set_errno(val) (errno = (val)) +#endif + +/* From glibc <features.h>. */ + +#ifndef __GNUC_PREREQ +# if defined __GNUC__ && defined __GNUC_MINOR__ +# define __GNUC_PREREQ(maj, min) ((maj) < __GNUC__ + ((min) <= __GNUC_MINOR__)) +# else +# define __GNUC_PREREQ(maj, min) 0 +# endif +#endif + +#ifndef __glibc_clang_prereq +# if defined __clang_major__ && defined __clang_minor__ +# define __glibc_clang_prereq(maj, min) \ + ((maj) < __clang_major__ + ((min) <= __clang_minor__)) +# else +# define __glibc_clang_prereq(maj, min) 0 +# endif +#endif + + +/* Prepare to include <cdefs.h>, which is our copy of glibc + <sys/cdefs.h>. */ + +/* Define _FEATURES_H so that <cdefs.h> does not include <features.h>. */ +#ifndef _FEATURES_H +# define _FEATURES_H 1 +#endif +/* Define __WORDSIZE so that <cdefs.h> does not attempt to include + nonexistent files. Make it a syntax error, since Gnulib does not + use __WORDSIZE now, and if Gnulib uses it later the syntax error + will let us know that __WORDSIZE needs configuring. */ +#ifndef __WORDSIZE +# define __WORDSIZE %%% +#endif +/* Undef the macros unconditionally defined by our copy of glibc + <sys/cdefs.h>, so that they do not clash with any system-defined + versions. */ +#undef _SYS_CDEFS_H +#undef __ASMNAME +#undef __ASMNAME2 +#undef __BEGIN_DECLS +#undef __CONCAT +#undef __END_DECLS +#undef __HAVE_GENERIC_SELECTION +#undef __LDBL_COMPAT +#undef __LDBL_REDIR +#undef __LDBL_REDIR1 +#undef __LDBL_REDIR1_DECL +#undef __LDBL_REDIR1_NTH +#undef __LDBL_REDIR_DECL +#undef __LDBL_REDIR_NTH +#undef __LEAF +#undef __LEAF_ATTR +#undef __NTH +#undef __NTHNL +#undef __P +#undef __PMT +#undef __REDIRECT +#undef __REDIRECT_LDBL +#undef __REDIRECT_NTH +#undef __REDIRECT_NTHNL +#undef __REDIRECT_NTH_LDBL +#undef __STRING +#undef __THROW +#undef __THROWNL +#undef __always_inline +#undef __attribute__ +#undef __attribute_alloc_size__ +#undef __attribute_artificial__ +#undef __attribute_const__ +#undef __attribute_deprecated__ +#undef __attribute_deprecated_msg__ +#undef __attribute_format_arg__ +#undef __attribute_format_strfmon__ +#undef __attribute_malloc__ +#undef __attribute_noinline__ +#undef __attribute_nonstring__ +#undef __attribute_pure__ +#undef __attribute_used__ +#undef __attribute_warn_unused_result__ +#undef __bos +#undef __bos0 +#undef __errordecl +#undef __extension__ +#undef __extern_always_inline +#undef __extern_inline +#undef __flexarr +#undef __fortify_function +#undef __glibc_c99_flexarr_available +#undef __glibc_clang_has_extension +#undef __glibc_likely +#undef __glibc_macro_warning +#undef __glibc_macro_warning1 +#undef __glibc_unlikely +#undef __inline +#undef __ptr_t +#undef __restrict +#undef __restrict_arr +#undef __va_arg_pack +#undef __va_arg_pack_len +#undef __warnattr +#undef __warndecl + +/* Include our copy of glibc <sys/cdefs.h>. */ +#include <cdefs.h> + +/* <cdefs.h> __inline is too pessimistic for non-GCC. */ +#undef __inline +#ifndef HAVE___INLINE +# if 199901 <= __STDC_VERSION__ || defined inline +# define __inline inline +# else +# define __inline +# endif +#endif + + +/* A substitute for glibc <libc-symbols.h>, good enough for Gnulib. */ +#define attribute_hidden +#define libc_hidden_proto(name, ...) +#define libc_hidden_def(name) +#define libc_hidden_weak(name) +#define libc_hidden_ver(local, name) +#define strong_alias(name, aliasname) +#define weak_alias(name, aliasname) + +/* A substitute for glibc <shlib-compat.h>, good enough for Gnulib. */ +#define SHLIB_COMPAT(lib, introduced, obsoleted) 0 +#define versioned_symbol(lib, local, symbol, version) diff --git a/gnulib/import/limits.in.h b/gnulib/import/limits.in.h index a1eae02..39750b3 100644 --- a/gnulib/import/limits.in.h +++ b/gnulib/import/limits.in.h @@ -1,6 +1,6 @@ /* A GNU-like <limits.h>. - Copyright 2016 Free Software Foundation, Inc. + Copyright 2016-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_LIMITS_H @@ -28,6 +28,34 @@ #ifndef _@GUARD_PREFIX@_LIMITS_H #define _@GUARD_PREFIX@_LIMITS_H +#ifndef LLONG_MIN +# if defined LONG_LONG_MIN /* HP-UX 11.31 */ +# define LLONG_MIN LONG_LONG_MIN +# elif defined LONGLONG_MIN /* IRIX 6.5 */ +# define LLONG_MIN LONGLONG_MIN +# elif defined __GNUC__ +# define LLONG_MIN (- __LONG_LONG_MAX__ - 1LL) +# endif +#endif +#ifndef LLONG_MAX +# if defined LONG_LONG_MAX /* HP-UX 11.31 */ +# define LLONG_MAX LONG_LONG_MAX +# elif defined LONGLONG_MAX /* IRIX 6.5 */ +# define LLONG_MAX LONGLONG_MAX +# elif defined __GNUC__ +# define LLONG_MAX __LONG_LONG_MAX__ +# endif +#endif +#ifndef ULLONG_MAX +# if defined ULONG_LONG_MAX /* HP-UX 11.31 */ +# define ULLONG_MAX ULONG_LONG_MAX +# elif defined ULONGLONG_MAX /* IRIX 6.5 */ +# define ULLONG_MAX ULONGLONG_MAX +# elif defined __GNUC__ +# define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL) +# endif +#endif + /* 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 @@ -42,6 +70,19 @@ #define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n)) #define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1)) +#ifndef WORD_BIT +/* Assume 'int' is 32 bits wide. */ +# define WORD_BIT 32 +#endif +#ifndef LONG_BIT +/* Assume 'long' is 32 or 64 bits wide. */ +# if LONG_MAX == INT_MAX +# define LONG_BIT 32 +# else +# define LONG_BIT 64 +# endif +#endif + /* Macros specified by ISO/IEC TS 18661-1:2014. */ #if (! defined ULLONG_WIDTH \ diff --git a/gnulib/import/localcharset.c b/gnulib/import/localcharset.c index b2a0369..479fcb9 100644 --- a/gnulib/import/localcharset.c +++ b/gnulib/import/localcharset.c @@ -1,6 +1,6 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2006, 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>. */ @@ -22,7 +22,6 @@ /* Specification. */ #include "localcharset.h" -#include <fcntl.h> #include <stddef.h> #include <stdio.h> #include <string.h> @@ -32,7 +31,7 @@ # define DARWIN7 /* Darwin 7 or newer, i.e. Mac OS X 10.3 or newer */ #endif -#if defined _WIN32 || defined __WIN32__ +#if defined _WIN32 && !defined __CYGWIN__ # define WINDOWS_NATIVE # include <locale.h> #endif @@ -45,11 +44,10 @@ #endif #if !defined WINDOWS_NATIVE -# include <unistd.h> # if HAVE_LANGINFO_CODESET # include <langinfo.h> # else -# if 0 /* see comment below */ +# if 0 /* see comment regarding use of setlocale(), below */ # include <locale.h> # endif # endif @@ -71,317 +69,750 @@ # include <xlocale.h> #endif -#if ENABLE_RELOCATABLE -# include "relocatable.h" -#else -# define relocate(pathname) (pathname) -#endif - -/* Get LIBDIR. */ -#ifndef LIBDIR -# include "configmake.h" -#endif - -/* Define O_NOFOLLOW to 0 on platforms where it does not exist. */ -#ifndef O_NOFOLLOW -# define O_NOFOLLOW 0 -#endif - -#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ - /* Native Windows, Cygwin, OS/2, DOS */ -# define ISSLASH(C) ((C) == '/' || (C) == '\\') -#endif -#ifndef DIRECTORY_SEPARATOR -# define DIRECTORY_SEPARATOR '/' -#endif +#if HAVE_LANGINFO_CODESET || defined WINDOWS_NATIVE || defined OS2 -#ifndef ISSLASH -# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) -#endif +/* On these platforms, we use a mapping from non-canonical encoding name + to GNU canonical encoding name. */ -#if HAVE_DECL_GETC_UNLOCKED -# undef getc -# define getc getc_unlocked -#endif +/* With glibc-2.1 or newer, we don't need any canonicalization, + because glibc has iconv and both glibc and libiconv support all + GNU canonical names directly. */ +# if !((defined __GNU_LIBRARY__ && __GLIBC__ >= 2) || defined __UCLIBC__) -/* The following static variable is declared 'volatile' to avoid a - possible multithread problem in the function get_charset_aliases. If we - are running in a threaded environment, and if two threads initialize - 'charset_aliases' simultaneously, both will produce the same value, - and everything will be ok if the two assignments to 'charset_aliases' - are atomic. But I don't know what will happen if the two assignments mix. */ -#if __STDC__ != 1 -# define volatile /* empty */ -#endif -/* Pointer to the contents of the charset.alias file, if it has already been - read, else NULL. Its format is: - ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */ -static const char * volatile charset_aliases; - -/* Return a pointer to the contents of the charset.alias file. */ -static const char * -get_charset_aliases (void) +struct table_entry { - const char *cp; - - cp = charset_aliases; - if (cp == NULL) - { -#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__ || defined OS2) - const char *dir; - const char *base = "charset.alias"; - char *file_name; - - /* Make it possible to override the charset.alias location. This is - necessary for running the testsuite before "make install". */ - dir = getenv ("CHARSETALIASDIR"); - if (dir == NULL || dir[0] == '\0') - dir = relocate (LIBDIR); - - /* Concatenate dir and base into freshly allocated file_name. */ - { - size_t dir_len = strlen (dir); - size_t base_len = strlen (base); - int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1])); - file_name = (char *) malloc (dir_len + add_slash + base_len + 1); - if (file_name != NULL) - { - memcpy (file_name, dir, dir_len); - if (add_slash) - file_name[dir_len] = DIRECTORY_SEPARATOR; - memcpy (file_name + dir_len + add_slash, base, base_len + 1); - } - } - - if (file_name == NULL) - /* Out of memory. Treat the file as empty. */ - cp = ""; - else - { - int fd; - - /* Open the file. Reject symbolic links on platforms that support - O_NOFOLLOW. This is a security feature. Without it, an attacker - could retrieve parts of the contents (namely, the tail of the - first line that starts with "* ") of an arbitrary file by placing - a symbolic link to that file under the name "charset.alias" in - some writable directory and defining the environment variable - CHARSETALIASDIR to point to that directory. */ - fd = open (file_name, - O_RDONLY | (HAVE_WORKING_O_NOFOLLOW ? O_NOFOLLOW : 0)); - if (fd < 0) - /* File not found. Treat it as empty. */ - cp = ""; - else - { - FILE *fp; - - fp = fdopen (fd, "r"); - if (fp == NULL) - { - /* Out of memory. Treat the file as empty. */ - close (fd); - cp = ""; - } - else - { - /* Parse the file's contents. */ - char *res_ptr = NULL; - size_t res_size = 0; - - for (;;) - { - int c; - char buf1[50+1]; - char buf2[50+1]; - size_t l1, l2; - char *old_res_ptr; - - c = getc (fp); - if (c == EOF) - break; - if (c == '\n' || c == ' ' || c == '\t') - continue; - if (c == '#') - { - /* Skip comment, to end of line. */ - do - c = getc (fp); - while (!(c == EOF || c == '\n')); - if (c == EOF) - break; - continue; - } - ungetc (c, fp); - if (fscanf (fp, "%50s %50s", buf1, buf2) < 2) - break; - l1 = strlen (buf1); - l2 = strlen (buf2); - old_res_ptr = res_ptr; - if (res_size == 0) - { - res_size = l1 + 1 + l2 + 1; - res_ptr = (char *) malloc (res_size + 1); - } - else - { - res_size += l1 + 1 + l2 + 1; - res_ptr = (char *) realloc (res_ptr, res_size + 1); - } - if (res_ptr == NULL) - { - /* Out of memory. */ - res_size = 0; - free (old_res_ptr); - break; - } - strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1); - strcpy (res_ptr + res_size - (l2 + 1), buf2); - } - fclose (fp); - if (res_size == 0) - cp = ""; - else - { - *(res_ptr + res_size) = '\0'; - cp = res_ptr; - } - } - } + const char alias[11+1]; + const char canonical[11+1]; +}; + +/* Table of platform-dependent mappings, sorted in ascending order. */ +static const struct table_entry alias_table[] = + { +# if defined __FreeBSD__ /* FreeBSD */ + /*{ "ARMSCII-8", "ARMSCII-8" },*/ + { "Big5", "BIG5" }, + { "C", "ASCII" }, + /*{ "CP1131", "CP1131" },*/ + /*{ "CP1251", "CP1251" },*/ + /*{ "CP866", "CP866" },*/ + /*{ "GB18030", "GB18030" },*/ + /*{ "GB2312", "GB2312" },*/ + /*{ "GBK", "GBK" },*/ + /*{ "ISCII-DEV", "?" },*/ + { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-13", "ISO-8859-13" }, + { "ISO8859-15", "ISO-8859-15" }, + { "ISO8859-2", "ISO-8859-2" }, + { "ISO8859-5", "ISO-8859-5" }, + { "ISO8859-7", "ISO-8859-7" }, + { "ISO8859-9", "ISO-8859-9" }, + /*{ "KOI8-R", "KOI8-R" },*/ + /*{ "KOI8-U", "KOI8-U" },*/ + { "SJIS", "SHIFT_JIS" }, + { "US-ASCII", "ASCII" }, + { "eucCN", "GB2312" }, + { "eucJP", "EUC-JP" }, + { "eucKR", "EUC-KR" } +# define alias_table_defined +# endif +# if defined __NetBSD__ /* NetBSD */ + { "646", "ASCII" }, + /*{ "ARMSCII-8", "ARMSCII-8" },*/ + /*{ "BIG5", "BIG5" },*/ + { "Big5-HKSCS", "BIG5-HKSCS" }, + /*{ "CP1251", "CP1251" },*/ + /*{ "CP866", "CP866" },*/ + /*{ "GB18030", "GB18030" },*/ + /*{ "GB2312", "GB2312" },*/ + { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-13", "ISO-8859-13" }, + { "ISO8859-15", "ISO-8859-15" }, + { "ISO8859-2", "ISO-8859-2" }, + { "ISO8859-4", "ISO-8859-4" }, + { "ISO8859-5", "ISO-8859-5" }, + { "ISO8859-7", "ISO-8859-7" }, + /*{ "KOI8-R", "KOI8-R" },*/ + /*{ "KOI8-U", "KOI8-U" },*/ + /*{ "PT154", "PT154" },*/ + { "SJIS", "SHIFT_JIS" }, + { "eucCN", "GB2312" }, + { "eucJP", "EUC-JP" }, + { "eucKR", "EUC-KR" }, + { "eucTW", "EUC-TW" } +# define alias_table_defined +# endif +# if defined __OpenBSD__ /* OpenBSD */ + { "646", "ASCII" }, + { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-13", "ISO-8859-13" }, + { "ISO8859-15", "ISO-8859-15" }, + { "ISO8859-2", "ISO-8859-2" }, + { "ISO8859-4", "ISO-8859-4" }, + { "ISO8859-5", "ISO-8859-5" }, + { "ISO8859-7", "ISO-8859-7" } +# define alias_table_defined +# endif +# if defined __APPLE__ && defined __MACH__ /* Mac OS X */ + /* Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is + useless: + - It returns the empty string when LANG is set to a locale of the + form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8 + LC_CTYPE file. + - The environment variables LANG, LC_CTYPE, LC_ALL are not set by + the system; nl_langinfo(CODESET) returns "US-ASCII" in this case. + - The documentation says: + "... all code that calls BSD system routines should ensure + that the const *char parameters of these routines are in UTF-8 + encoding. All BSD system functions expect their string + parameters to be in UTF-8 encoding and nothing else." + It also says + "An additional caveat is that string parameters for files, + paths, and other file-system entities must be in canonical + UTF-8. In a canonical UTF-8 Unicode string, all decomposable + characters are decomposed ..." + but this is not true: You can pass non-decomposed UTF-8 strings + to file system functions, and it is the OS which will convert + them to decomposed UTF-8 before accessing the file system. + - The Apple Terminal application displays UTF-8 by default. + - However, other applications are free to use different encodings: + - xterm uses ISO-8859-1 by default. + - TextEdit uses MacRoman by default. + We prefer UTF-8 over decomposed UTF-8-MAC because one should + minimize the use of decomposed Unicode. Unfortunately, through the + Darwin file system, decomposed UTF-8 strings are leaked into user + space nevertheless. + Then there are also the locales with encodings other than US-ASCII + and UTF-8. These locales can be occasionally useful to users (e.g. + when grepping through ISO-8859-1 encoded text files), when all their + file names are in US-ASCII. + */ + { "ARMSCII-8", "ARMSCII-8" }, + { "Big5", "BIG5" }, + { "Big5HKSCS", "BIG5-HKSCS" }, + { "CP1131", "CP1131" }, + { "CP1251", "CP1251" }, + { "CP866", "CP866" }, + { "CP949", "CP949" }, + { "GB18030", "GB18030" }, + { "GB2312", "GB2312" }, + { "GBK", "GBK" }, + /*{ "ISCII-DEV", "?" },*/ + { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-13", "ISO-8859-13" }, + { "ISO8859-15", "ISO-8859-15" }, + { "ISO8859-2", "ISO-8859-2" }, + { "ISO8859-4", "ISO-8859-4" }, + { "ISO8859-5", "ISO-8859-5" }, + { "ISO8859-7", "ISO-8859-7" }, + { "ISO8859-9", "ISO-8859-9" }, + { "KOI8-R", "KOI8-R" }, + { "KOI8-U", "KOI8-U" }, + { "PT154", "PT154" }, + { "SJIS", "SHIFT_JIS" }, + { "eucCN", "GB2312" }, + { "eucJP", "EUC-JP" }, + { "eucKR", "EUC-KR" } +# define alias_table_defined +# endif +# if defined _AIX /* AIX */ + /*{ "GBK", "GBK" },*/ + { "IBM-1046", "CP1046" }, + { "IBM-1124", "CP1124" }, + { "IBM-1129", "CP1129" }, + { "IBM-1252", "CP1252" }, + { "IBM-850", "CP850" }, + { "IBM-856", "CP856" }, + { "IBM-921", "ISO-8859-13" }, + { "IBM-922", "CP922" }, + { "IBM-932", "CP932" }, + { "IBM-943", "CP943" }, + { "IBM-eucCN", "GB2312" }, + { "IBM-eucJP", "EUC-JP" }, + { "IBM-eucKR", "EUC-KR" }, + { "IBM-eucTW", "EUC-TW" }, + { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-15", "ISO-8859-15" }, + { "ISO8859-2", "ISO-8859-2" }, + { "ISO8859-5", "ISO-8859-5" }, + { "ISO8859-6", "ISO-8859-6" }, + { "ISO8859-7", "ISO-8859-7" }, + { "ISO8859-8", "ISO-8859-8" }, + { "ISO8859-9", "ISO-8859-9" }, + { "TIS-620", "TIS-620" }, + /*{ "UTF-8", "UTF-8" },*/ + { "big5", "BIG5" } +# define alias_table_defined +# endif +# if defined __hpux /* HP-UX */ + { "SJIS", "SHIFT_JIS" }, + { "arabic8", "HP-ARABIC8" }, + { "big5", "BIG5" }, + { "cp1251", "CP1251" }, + { "eucJP", "EUC-JP" }, + { "eucKR", "EUC-KR" }, + { "eucTW", "EUC-TW" }, + { "gb18030", "GB18030" }, + { "greek8", "HP-GREEK8" }, + { "hebrew8", "HP-HEBREW8" }, + { "hkbig5", "BIG5-HKSCS" }, + { "hp15CN", "GB2312" }, + { "iso88591", "ISO-8859-1" }, + { "iso885913", "ISO-8859-13" }, + { "iso885915", "ISO-8859-15" }, + { "iso88592", "ISO-8859-2" }, + { "iso88594", "ISO-8859-4" }, + { "iso88595", "ISO-8859-5" }, + { "iso88596", "ISO-8859-6" }, + { "iso88597", "ISO-8859-7" }, + { "iso88598", "ISO-8859-8" }, + { "iso88599", "ISO-8859-9" }, + { "kana8", "HP-KANA8" }, + { "koi8r", "KOI8-R" }, + { "roman8", "HP-ROMAN8" }, + { "tis620", "TIS-620" }, + { "turkish8", "HP-TURKISH8" }, + { "utf8", "UTF-8" } +# define alias_table_defined +# endif +# if defined __sgi /* IRIX */ + { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-15", "ISO-8859-15" }, + { "ISO8859-2", "ISO-8859-2" }, + { "ISO8859-5", "ISO-8859-5" }, + { "ISO8859-7", "ISO-8859-7" }, + { "ISO8859-9", "ISO-8859-9" }, + { "eucCN", "GB2312" }, + { "eucJP", "EUC-JP" }, + { "eucKR", "EUC-KR" }, + { "eucTW", "EUC-TW" } +# define alias_table_defined +# endif +# if defined __osf__ /* OSF/1 */ + /*{ "GBK", "GBK" },*/ + { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-15", "ISO-8859-15" }, + { "ISO8859-2", "ISO-8859-2" }, + { "ISO8859-4", "ISO-8859-4" }, + { "ISO8859-5", "ISO-8859-5" }, + { "ISO8859-7", "ISO-8859-7" }, + { "ISO8859-8", "ISO-8859-8" }, + { "ISO8859-9", "ISO-8859-9" }, + { "KSC5601", "CP949" }, + { "SJIS", "SHIFT_JIS" }, + { "TACTIS", "TIS-620" }, + /*{ "UTF-8", "UTF-8" },*/ + { "big5", "BIG5" }, + { "cp850", "CP850" }, + { "dechanyu", "DEC-HANYU" }, + { "dechanzi", "GB2312" }, + { "deckanji", "DEC-KANJI" }, + { "deckorean", "EUC-KR" }, + { "eucJP", "EUC-JP" }, + { "eucKR", "EUC-KR" }, + { "eucTW", "EUC-TW" }, + { "sdeckanji", "EUC-JP" } +# define alias_table_defined +# endif +# if defined __sun /* Solaris */ + { "5601", "EUC-KR" }, + { "646", "ASCII" }, + /*{ "BIG5", "BIG5" },*/ + { "Big5-HKSCS", "BIG5-HKSCS" }, + { "GB18030", "GB18030" }, + /*{ "GBK", "GBK" },*/ + { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-11", "TIS-620" }, + { "ISO8859-13", "ISO-8859-13" }, + { "ISO8859-15", "ISO-8859-15" }, + { "ISO8859-2", "ISO-8859-2" }, + { "ISO8859-3", "ISO-8859-3" }, + { "ISO8859-4", "ISO-8859-4" }, + { "ISO8859-5", "ISO-8859-5" }, + { "ISO8859-6", "ISO-8859-6" }, + { "ISO8859-7", "ISO-8859-7" }, + { "ISO8859-8", "ISO-8859-8" }, + { "ISO8859-9", "ISO-8859-9" }, + { "PCK", "SHIFT_JIS" }, + { "TIS620.2533", "TIS-620" }, + /*{ "UTF-8", "UTF-8" },*/ + { "ansi-1251", "CP1251" }, + { "cns11643", "EUC-TW" }, + { "eucJP", "EUC-JP" }, + { "gb2312", "GB2312" }, + { "koi8-r", "KOI8-R" } +# define alias_table_defined +# endif +# if defined __minix /* Minix */ + { "646", "ASCII" } +# define alias_table_defined +# endif +# if defined WINDOWS_NATIVE || defined __CYGWIN__ /* Windows */ + { "CP1361", "JOHAB" }, + { "CP20127", "ASCII" }, + { "CP20866", "KOI8-R" }, + { "CP20936", "GB2312" }, + { "CP21866", "KOI8-RU" }, + { "CP28591", "ISO-8859-1" }, + { "CP28592", "ISO-8859-2" }, + { "CP28593", "ISO-8859-3" }, + { "CP28594", "ISO-8859-4" }, + { "CP28595", "ISO-8859-5" }, + { "CP28596", "ISO-8859-6" }, + { "CP28597", "ISO-8859-7" }, + { "CP28598", "ISO-8859-8" }, + { "CP28599", "ISO-8859-9" }, + { "CP28605", "ISO-8859-15" }, + { "CP38598", "ISO-8859-8" }, + { "CP51932", "EUC-JP" }, + { "CP51936", "GB2312" }, + { "CP51949", "EUC-KR" }, + { "CP51950", "EUC-TW" }, + { "CP54936", "GB18030" }, + { "CP65001", "UTF-8" }, + { "CP936", "GBK" } +# define alias_table_defined +# endif +# if defined OS2 /* OS/2 */ + /* The list of encodings is taken from "List of OS/2 Codepages" + by Alex Taylor: + <http://altsan.org/os2/toolkits/uls/index.html#codepages>. + See also "__convcp() of kLIBC": + <https://github.com/bitwiseworks/libc/blob/master/src/emx/src/lib/locale/__convcp.c>. */ + { "CP1004", "CP1252" }, + /*{ "CP1041", "CP943" },*/ + /*{ "CP1088", "CP949" },*/ + { "CP1089", "ISO-8859-6" }, + /*{ "CP1114", "CP950" },*/ + /*{ "CP1115", "GB2312" },*/ + { "CP1208", "UTF-8" }, + /*{ "CP1380", "GB2312" },*/ + { "CP1381", "GB2312" }, + { "CP1383", "GB2312" }, + { "CP1386", "GBK" }, + /*{ "CP301", "CP943" },*/ + { "CP3372", "EUC-JP" }, + { "CP4946", "CP850" }, + /*{ "CP5048", "JIS_X0208-1990" },*/ + /*{ "CP5049", "JIS_X0212-1990" },*/ + /*{ "CP5067", "KS_C_5601-1987" },*/ + { "CP813", "ISO-8859-7" }, + { "CP819", "ISO-8859-1" }, + { "CP878", "KOI8-R" }, + /*{ "CP897", "CP943" },*/ + { "CP912", "ISO-8859-2" }, + { "CP913", "ISO-8859-3" }, + { "CP914", "ISO-8859-4" }, + { "CP915", "ISO-8859-5" }, + { "CP916", "ISO-8859-8" }, + { "CP920", "ISO-8859-9" }, + { "CP921", "ISO-8859-13" }, + { "CP923", "ISO-8859-15" }, + /*{ "CP941", "CP943" },*/ + /*{ "CP947", "CP950" },*/ + /*{ "CP951", "CP949" },*/ + /*{ "CP952", "JIS_X0208-1990" },*/ + /*{ "CP953", "JIS_X0212-1990" },*/ + { "CP954", "EUC-JP" }, + { "CP964", "EUC-TW" }, + { "CP970", "EUC-KR" }, + /*{ "CP971", "KS_C_5601-1987" },*/ + { "IBM-1004", "CP1252" }, + /*{ "IBM-1006", "?" },*/ + /*{ "IBM-1008", "?" },*/ + /*{ "IBM-1041", "CP943" },*/ + /*{ "IBM-1051", "?" },*/ + /*{ "IBM-1088", "CP949" },*/ + { "IBM-1089", "ISO-8859-6" }, + /*{ "IBM-1098", "?" },*/ + /*{ "IBM-1114", "CP950" },*/ + /*{ "IBM-1115", "GB2312" },*/ + /*{ "IBM-1116", "?" },*/ + /*{ "IBM-1117", "?" },*/ + /*{ "IBM-1118", "?" },*/ + /*{ "IBM-1119", "?" },*/ + { "IBM-1124", "CP1124" }, + { "IBM-1125", "CP1125" }, + { "IBM-1131", "CP1131" }, + { "IBM-1208", "UTF-8" }, + { "IBM-1250", "CP1250" }, + { "IBM-1251", "CP1251" }, + { "IBM-1252", "CP1252" }, + { "IBM-1253", "CP1253" }, + { "IBM-1254", "CP1254" }, + { "IBM-1255", "CP1255" }, + { "IBM-1256", "CP1256" }, + { "IBM-1257", "CP1257" }, + /*{ "IBM-1275", "?" },*/ + /*{ "IBM-1276", "?" },*/ + /*{ "IBM-1277", "?" },*/ + /*{ "IBM-1280", "?" },*/ + /*{ "IBM-1281", "?" },*/ + /*{ "IBM-1282", "?" },*/ + /*{ "IBM-1283", "?" },*/ + /*{ "IBM-1380", "GB2312" },*/ + { "IBM-1381", "GB2312" }, + { "IBM-1383", "GB2312" }, + { "IBM-1386", "GBK" }, + /*{ "IBM-301", "CP943" },*/ + { "IBM-3372", "EUC-JP" }, + { "IBM-367", "ASCII" }, + { "IBM-437", "CP437" }, + { "IBM-4946", "CP850" }, + /*{ "IBM-5048", "JIS_X0208-1990" },*/ + /*{ "IBM-5049", "JIS_X0212-1990" },*/ + /*{ "IBM-5067", "KS_C_5601-1987" },*/ + { "IBM-813", "ISO-8859-7" }, + { "IBM-819", "ISO-8859-1" }, + { "IBM-850", "CP850" }, + /*{ "IBM-851", "?" },*/ + { "IBM-852", "CP852" }, + { "IBM-855", "CP855" }, + { "IBM-856", "CP856" }, + { "IBM-857", "CP857" }, + /*{ "IBM-859", "?" },*/ + { "IBM-860", "CP860" }, + { "IBM-861", "CP861" }, + { "IBM-862", "CP862" }, + { "IBM-863", "CP863" }, + { "IBM-864", "CP864" }, + { "IBM-865", "CP865" }, + { "IBM-866", "CP866" }, + /*{ "IBM-868", "?" },*/ + { "IBM-869", "CP869" }, + { "IBM-874", "CP874" }, + { "IBM-878", "KOI8-R" }, + /*{ "IBM-895", "?" },*/ + /*{ "IBM-897", "CP943" },*/ + /*{ "IBM-907", "?" },*/ + /*{ "IBM-909", "?" },*/ + { "IBM-912", "ISO-8859-2" }, + { "IBM-913", "ISO-8859-3" }, + { "IBM-914", "ISO-8859-4" }, + { "IBM-915", "ISO-8859-5" }, + { "IBM-916", "ISO-8859-8" }, + { "IBM-920", "ISO-8859-9" }, + { "IBM-921", "ISO-8859-13" }, + { "IBM-922", "CP922" }, + { "IBM-923", "ISO-8859-15" }, + { "IBM-932", "CP932" }, + /*{ "IBM-941", "CP943" },*/ + /*{ "IBM-942", "?" },*/ + { "IBM-943", "CP943" }, + /*{ "IBM-947", "CP950" },*/ + { "IBM-949", "CP949" }, + { "IBM-950", "CP950" }, + /*{ "IBM-951", "CP949" },*/ + /*{ "IBM-952", "JIS_X0208-1990" },*/ + /*{ "IBM-953", "JIS_X0212-1990" },*/ + { "IBM-954", "EUC-JP" }, + /*{ "IBM-955", "?" },*/ + { "IBM-964", "EUC-TW" }, + { "IBM-970", "EUC-KR" }, + /*{ "IBM-971", "KS_C_5601-1987" },*/ + { "IBM-eucCN", "GB2312" }, + { "IBM-eucJP", "EUC-JP" }, + { "IBM-eucKR", "EUC-KR" }, + { "IBM-eucTW", "EUC-TW" }, + { "IBM33722", "EUC-JP" }, + { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-2", "ISO-8859-2" }, + { "ISO8859-3", "ISO-8859-3" }, + { "ISO8859-4", "ISO-8859-4" }, + { "ISO8859-5", "ISO-8859-5" }, + { "ISO8859-6", "ISO-8859-6" }, + { "ISO8859-7", "ISO-8859-7" }, + { "ISO8859-8", "ISO-8859-8" }, + { "ISO8859-9", "ISO-8859-9" }, + /*{ "JISX0201-1976", "JISX0201-1976" },*/ + /*{ "JISX0208-1978", "?" },*/ + /*{ "JISX0208-1983", "JIS_X0208-1983" },*/ + /*{ "JISX0208-1990", "JIS_X0208-1990" },*/ + /*{ "JISX0212-1990", "JIS_X0212-1990" },*/ + /*{ "KSC5601-1987", "KS_C_5601-1987" },*/ + { "SJIS-1", "CP943" }, + { "SJIS-2", "CP943" }, + { "eucJP", "EUC-JP" }, + { "eucKR", "EUC-KR" }, + { "eucTW-1993", "EUC-TW" } +# define alias_table_defined +# endif +# if defined VMS /* OpenVMS */ + /* The list of encodings is taken from the OpenVMS 7.3-1 documentation + "Compaq C Run-Time Library Reference Manual for OpenVMS systems" + section 10.7 "Handling Different Character Sets". */ + { "DECHANYU", "DEC-HANYU" }, + { "DECHANZI", "GB2312" }, + { "DECKANJI", "DEC-KANJI" }, + { "DECKOREAN", "EUC-KR" }, + { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-2", "ISO-8859-2" }, + { "ISO8859-5", "ISO-8859-5" }, + { "ISO8859-7", "ISO-8859-7" }, + { "ISO8859-8", "ISO-8859-8" }, + { "ISO8859-9", "ISO-8859-9" }, + { "SDECKANJI", "EUC-JP" }, + { "SJIS", "SHIFT_JIS" }, + { "eucJP", "EUC-JP" }, + { "eucTW", "EUC-TW" } +# define alias_table_defined +# endif +# ifndef alias_table_defined + /* Just a dummy entry, to avoid a C syntax error. */ + { "", "" } +# endif + }; - free (file_name); - } +# endif #else -# if defined DARWIN7 - /* To avoid the trouble of installing a file that is shared by many - GNU packages -- many packaging systems have problems with this --, - simply inline the aliases here. */ - cp = "ISO8859-1" "\0" "ISO-8859-1" "\0" - "ISO8859-2" "\0" "ISO-8859-2" "\0" - "ISO8859-4" "\0" "ISO-8859-4" "\0" - "ISO8859-5" "\0" "ISO-8859-5" "\0" - "ISO8859-7" "\0" "ISO-8859-7" "\0" - "ISO8859-9" "\0" "ISO-8859-9" "\0" - "ISO8859-13" "\0" "ISO-8859-13" "\0" - "ISO8859-15" "\0" "ISO-8859-15" "\0" - "KOI8-R" "\0" "KOI8-R" "\0" - "KOI8-U" "\0" "KOI8-U" "\0" - "CP866" "\0" "CP866" "\0" - "CP949" "\0" "CP949" "\0" - "CP1131" "\0" "CP1131" "\0" - "CP1251" "\0" "CP1251" "\0" - "eucCN" "\0" "GB2312" "\0" - "GB2312" "\0" "GB2312" "\0" - "eucJP" "\0" "EUC-JP" "\0" - "eucKR" "\0" "EUC-KR" "\0" - "Big5" "\0" "BIG5" "\0" - "Big5HKSCS" "\0" "BIG5-HKSCS" "\0" - "GBK" "\0" "GBK" "\0" - "GB18030" "\0" "GB18030" "\0" - "SJIS" "\0" "SHIFT_JIS" "\0" - "ARMSCII-8" "\0" "ARMSCII-8" "\0" - "PT154" "\0" "PT154" "\0" - /*"ISCII-DEV" "\0" "?" "\0"*/ - "*" "\0" "UTF-8" "\0"; -# endif +/* On these platforms, we use a mapping from locale name to GNU canonical + encoding name. */ -# if defined VMS - /* To avoid the troubles of an extra file charset.alias_vms in the - sources of many GNU packages, simply inline the aliases here. */ - /* The list of encodings is taken from the OpenVMS 7.3-1 documentation - "Compaq C Run-Time Library Reference Manual for OpenVMS systems" - section 10.7 "Handling Different Character Sets". */ - cp = "ISO8859-1" "\0" "ISO-8859-1" "\0" - "ISO8859-2" "\0" "ISO-8859-2" "\0" - "ISO8859-5" "\0" "ISO-8859-5" "\0" - "ISO8859-7" "\0" "ISO-8859-7" "\0" - "ISO8859-8" "\0" "ISO-8859-8" "\0" - "ISO8859-9" "\0" "ISO-8859-9" "\0" - /* Japanese */ - "eucJP" "\0" "EUC-JP" "\0" - "SJIS" "\0" "SHIFT_JIS" "\0" - "DECKANJI" "\0" "DEC-KANJI" "\0" - "SDECKANJI" "\0" "EUC-JP" "\0" - /* Chinese */ - "eucTW" "\0" "EUC-TW" "\0" - "DECHANYU" "\0" "DEC-HANYU" "\0" - "DECHANZI" "\0" "GB2312" "\0" - /* Korean */ - "DECKOREAN" "\0" "EUC-KR" "\0"; +struct table_entry +{ + const char locale[17+1]; + const char canonical[11+1]; +}; + +/* Table of platform-dependent mappings, sorted in ascending order. */ +static const struct table_entry locale_table[] = + { +# if defined __FreeBSD__ /* FreeBSD 4.2 */ + { "cs_CZ.ISO_8859-2", "ISO-8859-2" }, + { "da_DK.DIS_8859-15", "ISO-8859-15" }, + { "da_DK.ISO_8859-1", "ISO-8859-1" }, + { "de_AT.DIS_8859-15", "ISO-8859-15" }, + { "de_AT.ISO_8859-1", "ISO-8859-1" }, + { "de_CH.DIS_8859-15", "ISO-8859-15" }, + { "de_CH.ISO_8859-1", "ISO-8859-1" }, + { "de_DE.DIS_8859-15", "ISO-8859-15" }, + { "de_DE.ISO_8859-1", "ISO-8859-1" }, + { "en_AU.DIS_8859-15", "ISO-8859-15" }, + { "en_AU.ISO_8859-1", "ISO-8859-1" }, + { "en_CA.DIS_8859-15", "ISO-8859-15" }, + { "en_CA.ISO_8859-1", "ISO-8859-1" }, + { "en_GB.DIS_8859-15", "ISO-8859-15" }, + { "en_GB.ISO_8859-1", "ISO-8859-1" }, + { "en_US.DIS_8859-15", "ISO-8859-15" }, + { "en_US.ISO_8859-1", "ISO-8859-1" }, + { "es_ES.DIS_8859-15", "ISO-8859-15" }, + { "es_ES.ISO_8859-1", "ISO-8859-1" }, + { "fi_FI.DIS_8859-15", "ISO-8859-15" }, + { "fi_FI.ISO_8859-1", "ISO-8859-1" }, + { "fr_BE.DIS_8859-15", "ISO-8859-15" }, + { "fr_BE.ISO_8859-1", "ISO-8859-1" }, + { "fr_CA.DIS_8859-15", "ISO-8859-15" }, + { "fr_CA.ISO_8859-1", "ISO-8859-1" }, + { "fr_CH.DIS_8859-15", "ISO-8859-15" }, + { "fr_CH.ISO_8859-1", "ISO-8859-1" }, + { "fr_FR.DIS_8859-15", "ISO-8859-15" }, + { "fr_FR.ISO_8859-1", "ISO-8859-1" }, + { "hr_HR.ISO_8859-2", "ISO-8859-2" }, + { "hu_HU.ISO_8859-2", "ISO-8859-2" }, + { "is_IS.DIS_8859-15", "ISO-8859-15" }, + { "is_IS.ISO_8859-1", "ISO-8859-1" }, + { "it_CH.DIS_8859-15", "ISO-8859-15" }, + { "it_CH.ISO_8859-1", "ISO-8859-1" }, + { "it_IT.DIS_8859-15", "ISO-8859-15" }, + { "it_IT.ISO_8859-1", "ISO-8859-1" }, + { "ja_JP.EUC", "EUC-JP" }, + { "ja_JP.SJIS", "SHIFT_JIS" }, + { "ja_JP.Shift_JIS", "SHIFT_JIS" }, + { "ko_KR.EUC", "EUC-KR" }, + { "la_LN.ASCII", "ASCII" }, + { "la_LN.DIS_8859-15", "ISO-8859-15" }, + { "la_LN.ISO_8859-1", "ISO-8859-1" }, + { "la_LN.ISO_8859-2", "ISO-8859-2" }, + { "la_LN.ISO_8859-4", "ISO-8859-4" }, + { "lt_LN.ASCII", "ASCII" }, + { "lt_LN.DIS_8859-15", "ISO-8859-15" }, + { "lt_LN.ISO_8859-1", "ISO-8859-1" }, + { "lt_LN.ISO_8859-2", "ISO-8859-2" }, + { "lt_LT.ISO_8859-4", "ISO-8859-4" }, + { "nl_BE.DIS_8859-15", "ISO-8859-15" }, + { "nl_BE.ISO_8859-1", "ISO-8859-1" }, + { "nl_NL.DIS_8859-15", "ISO-8859-15" }, + { "nl_NL.ISO_8859-1", "ISO-8859-1" }, + { "no_NO.DIS_8859-15", "ISO-8859-15" }, + { "no_NO.ISO_8859-1", "ISO-8859-1" }, + { "pl_PL.ISO_8859-2", "ISO-8859-2" }, + { "pt_PT.DIS_8859-15", "ISO-8859-15" }, + { "pt_PT.ISO_8859-1", "ISO-8859-1" }, + { "ru_RU.CP866", "CP866" }, + { "ru_RU.ISO_8859-5", "ISO-8859-5" }, + { "ru_RU.KOI8-R", "KOI8-R" }, + { "ru_SU.CP866", "CP866" }, + { "ru_SU.ISO_8859-5", "ISO-8859-5" }, + { "ru_SU.KOI8-R", "KOI8-R" }, + { "sl_SI.ISO_8859-2", "ISO-8859-2" }, + { "sv_SE.DIS_8859-15", "ISO-8859-15" }, + { "sv_SE.ISO_8859-1", "ISO-8859-1" }, + { "uk_UA.KOI8-U", "KOI8-U" }, + { "zh_CN.EUC", "GB2312" }, + { "zh_TW.BIG5", "BIG5" }, + { "zh_TW.Big5", "BIG5" } +# define locale_table_defined # endif - -# if defined WINDOWS_NATIVE || defined __CYGWIN__ - /* To avoid the troubles of installing a separate file in the same - directory as the DLL and of retrieving the DLL's directory at - runtime, simply inline the aliases here. */ - - cp = "CP936" "\0" "GBK" "\0" - "CP1361" "\0" "JOHAB" "\0" - "CP20127" "\0" "ASCII" "\0" - "CP20866" "\0" "KOI8-R" "\0" - "CP20936" "\0" "GB2312" "\0" - "CP21866" "\0" "KOI8-RU" "\0" - "CP28591" "\0" "ISO-8859-1" "\0" - "CP28592" "\0" "ISO-8859-2" "\0" - "CP28593" "\0" "ISO-8859-3" "\0" - "CP28594" "\0" "ISO-8859-4" "\0" - "CP28595" "\0" "ISO-8859-5" "\0" - "CP28596" "\0" "ISO-8859-6" "\0" - "CP28597" "\0" "ISO-8859-7" "\0" - "CP28598" "\0" "ISO-8859-8" "\0" - "CP28599" "\0" "ISO-8859-9" "\0" - "CP28605" "\0" "ISO-8859-15" "\0" - "CP38598" "\0" "ISO-8859-8" "\0" - "CP51932" "\0" "EUC-JP" "\0" - "CP51936" "\0" "GB2312" "\0" - "CP51949" "\0" "EUC-KR" "\0" - "CP51950" "\0" "EUC-TW" "\0" - "CP54936" "\0" "GB18030" "\0" - "CP65001" "\0" "UTF-8" "\0"; +# if defined __DJGPP__ /* DOS / DJGPP 2.03 */ + /* The encodings given here may not all be correct. + If you find that the encoding given for your language and + country is not the one your DOS machine actually uses, just + correct it in this file, and send a mail to + Juan Manuel Guerrero <juan.guerrero@gmx.de> + and <bug-gnulib@gnu.org>. */ + { "C", "ASCII" }, + { "ar", "CP864" }, + { "ar_AE", "CP864" }, + { "ar_DZ", "CP864" }, + { "ar_EG", "CP864" }, + { "ar_IQ", "CP864" }, + { "ar_IR", "CP864" }, + { "ar_JO", "CP864" }, + { "ar_KW", "CP864" }, + { "ar_MA", "CP864" }, + { "ar_OM", "CP864" }, + { "ar_QA", "CP864" }, + { "ar_SA", "CP864" }, + { "ar_SY", "CP864" }, + { "be", "CP866" }, + { "be_BE", "CP866" }, + { "bg", "CP866" }, /* not CP855 ?? */ + { "bg_BG", "CP866" }, /* not CP855 ?? */ + { "ca", "CP850" }, + { "ca_ES", "CP850" }, + { "cs", "CP852" }, + { "cs_CZ", "CP852" }, + { "da", "CP865" }, /* not CP850 ?? */ + { "da_DK", "CP865" }, /* not CP850 ?? */ + { "de", "CP850" }, + { "de_AT", "CP850" }, + { "de_CH", "CP850" }, + { "de_DE", "CP850" }, + { "el", "CP869" }, + { "el_GR", "CP869" }, + { "en", "CP850" }, + { "en_AU", "CP850" }, /* not CP437 ?? */ + { "en_CA", "CP850" }, + { "en_GB", "CP850" }, + { "en_NZ", "CP437" }, + { "en_US", "CP437" }, + { "en_ZA", "CP850" }, /* not CP437 ?? */ + { "eo", "CP850" }, + { "eo_EO", "CP850" }, + { "es", "CP850" }, + { "es_AR", "CP850" }, + { "es_BO", "CP850" }, + { "es_CL", "CP850" }, + { "es_CO", "CP850" }, + { "es_CR", "CP850" }, + { "es_CU", "CP850" }, + { "es_DO", "CP850" }, + { "es_EC", "CP850" }, + { "es_ES", "CP850" }, + { "es_GT", "CP850" }, + { "es_HN", "CP850" }, + { "es_MX", "CP850" }, + { "es_NI", "CP850" }, + { "es_PA", "CP850" }, + { "es_PE", "CP850" }, + { "es_PY", "CP850" }, + { "es_SV", "CP850" }, + { "es_UY", "CP850" }, + { "es_VE", "CP850" }, + { "et", "CP850" }, + { "et_EE", "CP850" }, + { "eu", "CP850" }, + { "eu_ES", "CP850" }, + { "fi", "CP850" }, + { "fi_FI", "CP850" }, + { "fr", "CP850" }, + { "fr_BE", "CP850" }, + { "fr_CA", "CP850" }, + { "fr_CH", "CP850" }, + { "fr_FR", "CP850" }, + { "ga", "CP850" }, + { "ga_IE", "CP850" }, + { "gd", "CP850" }, + { "gd_GB", "CP850" }, + { "gl", "CP850" }, + { "gl_ES", "CP850" }, + { "he", "CP862" }, + { "he_IL", "CP862" }, + { "hr", "CP852" }, + { "hr_HR", "CP852" }, + { "hu", "CP852" }, + { "hu_HU", "CP852" }, + { "id", "CP850" }, /* not CP437 ?? */ + { "id_ID", "CP850" }, /* not CP437 ?? */ + { "is", "CP861" }, /* not CP850 ?? */ + { "is_IS", "CP861" }, /* not CP850 ?? */ + { "it", "CP850" }, + { "it_CH", "CP850" }, + { "it_IT", "CP850" }, + { "ja", "CP932" }, + { "ja_JP", "CP932" }, + { "kr", "CP949" }, /* not CP934 ?? */ + { "kr_KR", "CP949" }, /* not CP934 ?? */ + { "lt", "CP775" }, + { "lt_LT", "CP775" }, + { "lv", "CP775" }, + { "lv_LV", "CP775" }, + { "mk", "CP866" }, /* not CP855 ?? */ + { "mk_MK", "CP866" }, /* not CP855 ?? */ + { "mt", "CP850" }, + { "mt_MT", "CP850" }, + { "nb", "CP865" }, /* not CP850 ?? */ + { "nb_NO", "CP865" }, /* not CP850 ?? */ + { "nl", "CP850" }, + { "nl_BE", "CP850" }, + { "nl_NL", "CP850" }, + { "nn", "CP865" }, /* not CP850 ?? */ + { "nn_NO", "CP865" }, /* not CP850 ?? */ + { "no", "CP865" }, /* not CP850 ?? */ + { "no_NO", "CP865" }, /* not CP850 ?? */ + { "pl", "CP852" }, + { "pl_PL", "CP852" }, + { "pt", "CP850" }, + { "pt_BR", "CP850" }, + { "pt_PT", "CP850" }, + { "ro", "CP852" }, + { "ro_RO", "CP852" }, + { "ru", "CP866" }, + { "ru_RU", "CP866" }, + { "sk", "CP852" }, + { "sk_SK", "CP852" }, + { "sl", "CP852" }, + { "sl_SI", "CP852" }, + { "sq", "CP852" }, + { "sq_AL", "CP852" }, + { "sr", "CP852" }, /* CP852 or CP866 or CP855 ?? */ + { "sr_CS", "CP852" }, /* CP852 or CP866 or CP855 ?? */ + { "sr_YU", "CP852" }, /* CP852 or CP866 or CP855 ?? */ + { "sv", "CP850" }, + { "sv_SE", "CP850" }, + { "th", "CP874" }, + { "th_TH", "CP874" }, + { "tr", "CP857" }, + { "tr_TR", "CP857" }, + { "uk", "CP1125" }, + { "uk_UA", "CP1125" }, + { "zh_CN", "GBK" }, + { "zh_TW", "CP950" } /* not CP938 ?? */ +# define locale_table_defined # endif -# if defined OS2 - /* To avoid the troubles of installing a separate file in the same - directory as the DLL and of retrieving the DLL's directory at - runtime, simply inline the aliases here. */ - - /* The list of encodings is taken from "List of OS/2 Codepages" - by Alex Taylor: - <http://altsan.org/os2/toolkits/uls/index.html#codepages>. - See also "IBM Globalization - Code page identifiers": - <http://www-01.ibm.com/software/globalization/cp/cp_cpgid.html>. */ - cp = "CP813" "\0" "ISO-8859-7" "\0" - "CP878" "\0" "KOI8-R" "\0" - "CP819" "\0" "ISO-8859-1" "\0" - "CP912" "\0" "ISO-8859-2" "\0" - "CP913" "\0" "ISO-8859-3" "\0" - "CP914" "\0" "ISO-8859-4" "\0" - "CP915" "\0" "ISO-8859-5" "\0" - "CP916" "\0" "ISO-8859-8" "\0" - "CP920" "\0" "ISO-8859-9" "\0" - "CP921" "\0" "ISO-8859-13" "\0" - "CP923" "\0" "ISO-8859-15" "\0" - "CP954" "\0" "EUC-JP" "\0" - "CP964" "\0" "EUC-TW" "\0" - "CP970" "\0" "EUC-KR" "\0" - "CP1089" "\0" "ISO-8859-6" "\0" - "CP1208" "\0" "UTF-8" "\0" - "CP1381" "\0" "GB2312" "\0" - "CP1386" "\0" "GBK" "\0" - "CP3372" "\0" "EUC-JP" "\0"; +# ifndef locale_table_defined + /* Just a dummy entry, to avoid a C syntax error. */ + { "", "" } # endif -#endif + }; - charset_aliases = cp; - } +#endif - return cp; -} /* Determine the current locale's character encoding, and canonicalize it - into one of the canonical names listed in config.charset. + into one of the canonical names listed in localcharset.h. The result must not be freed; it is statically allocated. If the canonical name cannot be determined, the result is a non-canonical name. */ @@ -393,9 +824,8 @@ const char * locale_charset (void) { const char *codeset; - const char *aliases; -#if !(defined WINDOWS_NATIVE || defined OS2) +#if HAVE_LANGINFO_CODESET || defined WINDOWS_NATIVE || defined OS2 # if HAVE_LANGINFO_CODESET @@ -458,37 +888,11 @@ locale_charset (void) } # endif -# else - - /* On old systems which lack it, use setlocale or getenv. */ - const char *locale = NULL; - - /* But most old systems don't have a complete set of locales. Some - (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't - use setlocale here; it would return "C" when it doesn't support the - locale name the user has set. */ -# if 0 - locale = setlocale (LC_CTYPE, NULL); -# endif - if (locale == NULL || locale[0] == '\0') - { - locale = getenv ("LC_ALL"); - if (locale == NULL || locale[0] == '\0') - { - locale = getenv ("LC_CTYPE"); - if (locale == NULL || locale[0] == '\0') - locale = getenv ("LANG"); - } - } - - /* On some old systems, one used to set locale = "iso8859_1". On others, - you set it to "language_COUNTRY.charset". In any case, we resolve it - through the charset.alias file. */ - codeset = locale; - -# endif + if (codeset == NULL) + /* The canonical name cannot be determined. */ + codeset = ""; -#elif defined WINDOWS_NATIVE +# elif defined WINDOWS_NATIVE static char buf[2 + 10 + 1]; @@ -507,7 +911,7 @@ locale_charset (void) current_locale = setlocale (LC_CTYPE, NULL); pdot = strrchr (current_locale, '.'); - if (pdot) + if (pdot && 2 + strlen (pdot + 1) + 1 <= sizeof (buf)) sprintf (buf, "CP%s", pdot + 1); else { @@ -520,9 +924,14 @@ locale_charset (void) encoding is the best bet. */ sprintf (buf, "CP%u", GetACP ()); } - codeset = buf; + /* For a locale name such as "French_France.65001", in Windows 10, + setlocale now returns "French_France.utf8" instead. */ + if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0) + codeset = "UTF-8"; + else + codeset = buf; -#elif defined OS2 +# elif defined OS2 const char *locale; static char buf[2 + 10 + 1]; @@ -579,28 +988,144 @@ locale_charset (void) } } -#endif +# else - if (codeset == NULL) - /* The canonical name cannot be determined. */ - codeset = ""; +# error "Add code for other platforms here." - /* Resolve alias. */ - for (aliases = get_charset_aliases (); - *aliases != '\0'; - aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1) - if (strcmp (codeset, aliases) == 0 - || (aliases[0] == '*' && aliases[1] == '\0')) +# endif + + /* Resolve alias. */ + { +# ifdef alias_table_defined + /* On some platforms, UTF-8 locales are the most frequently used ones. + Speed up the common case and slow down the less common cases by + testing for this case first. */ +# if defined __OpenBSD__ || (defined __APPLE__ && defined __MACH__) || defined __sun || defined __CYGWIN__ + if (strcmp (codeset, "UTF-8") == 0) + goto done_table_lookup; + else +# endif { - codeset = aliases + strlen (aliases) + 1; - break; + const struct table_entry * const table = alias_table; + size_t const table_size = + sizeof (alias_table) / sizeof (struct table_entry); + /* The table is sorted. Perform a binary search. */ + size_t hi = table_size; + size_t lo = 0; + while (lo < hi) + { + /* Invariant: + for i < lo, strcmp (table[i].alias, codeset) < 0, + for i >= hi, strcmp (table[i].alias, codeset) > 0. */ + size_t mid = (hi + lo) >> 1; /* >= lo, < hi */ + int cmp = strcmp (table[mid].alias, codeset); + if (cmp < 0) + lo = mid + 1; + else if (cmp > 0) + hi = mid; + else + { + /* Found an i with + strcmp (table[i].alias, codeset) == 0. */ + codeset = table[mid].canonical; + goto done_table_lookup; + } + } } + if (0) + done_table_lookup: ; + else +# endif + { + /* Did not find it in the table. */ + /* On Mac OS X, all modern locales use the UTF-8 encoding. + BeOS and Haiku have a single locale, and it has UTF-8 encoding. */ +# if (defined __APPLE__ && defined __MACH__) || defined __BEOS__ || defined __HAIKU__ + codeset = "UTF-8"; +# else + /* Don't return an empty string. GNU libc and GNU libiconv interpret + the empty string as denoting "the locale's character encoding", + thus GNU libiconv would call this function a second time. */ + if (codeset[0] == '\0') + codeset = "ASCII"; +# endif + } + } - /* Don't return an empty string. GNU libc and GNU libiconv interpret - the empty string as denoting "the locale's character encoding", - thus GNU libiconv would call this function a second time. */ - if (codeset[0] == '\0') - codeset = "ASCII"; +#else + + /* On old systems which lack it, use setlocale or getenv. */ + const char *locale = NULL; + + /* But most old systems don't have a complete set of locales. Some + (like DJGPP) have only the C locale. Therefore we don't use setlocale + here; it would return "C" when it doesn't support the locale name the + user has set. */ +# if 0 + locale = setlocale (LC_CTYPE, NULL); +# endif + if (locale == NULL || locale[0] == '\0') + { + locale = getenv ("LC_ALL"); + if (locale == NULL || locale[0] == '\0') + { + locale = getenv ("LC_CTYPE"); + if (locale == NULL || locale[0] == '\0') + locale = getenv ("LANG"); + if (locale == NULL) + locale = ""; + } + } + + /* Map locale name to canonical encoding name. */ + { +# ifdef locale_table_defined + const struct table_entry * const table = locale_table; + size_t const table_size = + sizeof (locale_table) / sizeof (struct table_entry); + /* The table is sorted. Perform a binary search. */ + size_t hi = table_size; + size_t lo = 0; + while (lo < hi) + { + /* Invariant: + for i < lo, strcmp (table[i].locale, locale) < 0, + for i >= hi, strcmp (table[i].locale, locale) > 0. */ + size_t mid = (hi + lo) >> 1; /* >= lo, < hi */ + int cmp = strcmp (table[mid].locale, locale); + if (cmp < 0) + lo = mid + 1; + else if (cmp > 0) + hi = mid; + else + { + /* Found an i with + strcmp (table[i].locale, locale) == 0. */ + codeset = table[mid].canonical; + goto done_table_lookup; + } + } + if (0) + done_table_lookup: ; + else +# endif + { + /* Did not find it in the table. */ + /* On Mac OS X, all modern locales use the UTF-8 encoding. + BeOS and Haiku have a single locale, and it has UTF-8 encoding. */ +# if (defined __APPLE__ && defined __MACH__) || defined __BEOS__ || defined __HAIKU__ + codeset = "UTF-8"; +# else + /* The canonical name cannot be determined. */ + /* Don't return an empty string. GNU libc and GNU libiconv interpret + the empty string as denoting "the locale's character encoding", + thus GNU libiconv would call this function a second time. */ + codeset = "ASCII"; +# endif + } + } + +#endif #ifdef DARWIN7 /* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8" diff --git a/gnulib/import/localcharset.h b/gnulib/import/localcharset.h index 915182e..7d0d771 100644 --- a/gnulib/import/localcharset.h +++ b/gnulib/import/localcharset.h @@ -1,5 +1,5 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2003, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2009-2019 Free Software Foundation, Inc. This file is part of the GNU CHARSET Library. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LOCALCHARSET_H #define _LOCALCHARSET_H @@ -25,12 +25,106 @@ extern "C" { /* Determine the current locale's character encoding, and canonicalize it - into one of the canonical names listed in config.charset. + into one of the canonical names listed below. The result must not be freed; it is statically allocated. If the canonical name cannot be determined, the result is a non-canonical name. */ extern const char * locale_charset (void); +/* About GNU canonical names for character encodings: + + Every canonical name must be supported by GNU libiconv. Support by GNU libc + is also desirable. + + The name is case insensitive. Usually an upper case MIME charset name is + preferred. + + The current list of these GNU canonical names is: + + name MIME? used by which systems + (darwin = Mac OS X, windows = native Windows) + + ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin minix cygwin + ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin + ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin + ISO-8859-3 Y glibc solaris cygwin + ISO-8859-4 Y hpux osf solaris freebsd netbsd openbsd darwin + ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin + ISO-8859-6 Y glibc aix hpux solaris cygwin + ISO-8859-7 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin + ISO-8859-8 Y glibc aix hpux osf solaris cygwin + ISO-8859-9 Y glibc aix hpux irix osf solaris freebsd darwin cygwin + ISO-8859-13 glibc hpux solaris freebsd netbsd openbsd darwin cygwin + ISO-8859-14 glibc cygwin + ISO-8859-15 glibc aix irix osf solaris freebsd netbsd openbsd darwin cygwin + KOI8-R Y glibc hpux solaris freebsd netbsd openbsd darwin + KOI8-U Y glibc freebsd netbsd openbsd darwin cygwin + KOI8-T glibc + CP437 dos + CP775 dos + CP850 aix osf dos + CP852 dos + CP855 dos + CP856 aix + CP857 dos + CP861 dos + CP862 dos + CP864 dos + CP865 dos + CP866 freebsd netbsd openbsd darwin dos + CP869 dos + CP874 windows dos + CP922 aix + CP932 aix cygwin windows dos + CP943 aix + CP949 osf darwin windows dos + CP950 windows dos + CP1046 aix + CP1124 aix + CP1125 dos + CP1129 aix + CP1131 freebsd darwin + CP1250 windows + CP1251 glibc hpux solaris freebsd netbsd openbsd darwin cygwin windows + CP1252 aix windows + CP1253 windows + CP1254 windows + CP1255 glibc windows + CP1256 windows + CP1257 windows + GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin cygwin + EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin + EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin + EUC-TW glibc aix hpux irix osf solaris netbsd + BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin cygwin + BIG5-HKSCS glibc hpux solaris netbsd darwin + GBK glibc aix osf solaris freebsd darwin cygwin windows dos + GB18030 glibc hpux solaris freebsd netbsd darwin + SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin + JOHAB glibc solaris windows + TIS-620 glibc aix hpux osf solaris cygwin + VISCII Y glibc + TCVN5712-1 glibc + ARMSCII-8 glibc freebsd netbsd darwin + GEORGIAN-PS glibc cygwin + PT154 glibc netbsd cygwin + HP-ROMAN8 hpux + HP-ARABIC8 hpux + HP-GREEK8 hpux + HP-HEBREW8 hpux + HP-TURKISH8 hpux + HP-KANA8 hpux + DEC-KANJI osf + DEC-HANYU osf + UTF-8 Y glibc aix hpux osf solaris netbsd darwin cygwin + + Note: Names which are not marked as being a MIME name should not be used in + Internet protocols for information interchange (mail, news, etc.). + + Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications + must understand both names and treat them as equivalent. + */ + #ifdef __cplusplus } diff --git a/gnulib/import/localtime-buffer.c b/gnulib/import/localtime-buffer.c new file mode 100644 index 0000000..b65ea45 --- /dev/null +++ b/gnulib/import/localtime-buffer.c @@ -0,0 +1,60 @@ +/* Provide access to the last buffer returned by localtime() or gmtime(). + + Copyright (C) 2001-2003, 2005-2007, 2009-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* written by Jim Meyering */ + +#include <config.h> + +/* Specification. */ +#include "localtime-buffer.h" + +#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME + +static struct tm tm_zero_buffer; +struct tm *localtime_buffer_addr = &tm_zero_buffer; + +/* This is a wrapper for localtime. + + On the first call, record the address of the static buffer that + localtime uses for its result. */ + +struct tm * +rpl_localtime (time_t const *timep) +#undef localtime +{ + struct tm *tm = localtime (timep); + + if (localtime_buffer_addr == &tm_zero_buffer) + localtime_buffer_addr = tm; + + return tm; +} + +/* Same as above, since gmtime and localtime use the same buffer. */ +struct tm * +rpl_gmtime (time_t const *timep) +#undef gmtime +{ + struct tm *tm = gmtime (timep); + + if (localtime_buffer_addr == &tm_zero_buffer) + localtime_buffer_addr = tm; + + return tm; +} + +#endif diff --git a/gnulib/import/localtime-buffer.h b/gnulib/import/localtime-buffer.h new file mode 100644 index 0000000..031111a --- /dev/null +++ b/gnulib/import/localtime-buffer.h @@ -0,0 +1,27 @@ +/* Provide access to the last buffer returned by localtime() or gmtime(). + + Copyright (C) 2001-2003, 2005-2007, 2009-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* written by Jim Meyering */ + +#include <time.h> + +#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME + +/* The address of the last buffer returned by localtime() or gmtime(). */ +extern struct tm *localtime_buffer_addr; + +#endif diff --git a/gnulib/import/lstat.c b/gnulib/import/lstat.c index 03b0634..a3e40d8 100644 --- a/gnulib/import/lstat.c +++ b/gnulib/import/lstat.c @@ -1,6 +1,6 @@ /* Work around a bug of lstat on some systems - Copyright (C) 1997-2006, 2008-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2006, 2008-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ @@ -42,10 +42,16 @@ orig_lstat (const char *filename, struct stat *buf) } /* Specification. */ +# ifdef __osf__ /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include <sys/stat.h> above. */ -# include "sys/stat.h" +# include "sys/stat.h" +# else +# include <sys/stat.h> +# endif + +# include "stat-time.h" # include <string.h> # include <errno.h> @@ -66,32 +72,33 @@ orig_lstat (const char *filename, struct stat *buf) int rpl_lstat (const char *file, struct stat *sbuf) { - size_t len; - int lstat_result = orig_lstat (file, sbuf); - - if (lstat_result != 0) - return lstat_result; + int result = orig_lstat (file, sbuf); /* This replacement file can blindly check against '/' rather than using the ISSLASH macro, because all platforms with '\\' either lack symlinks (mingw) or have working lstat (cygwin) and thus do not compile this file. 0 len should have already been filtered out above, with a failure return of ENOENT. */ - len = strlen (file); - if (file[len - 1] != '/' || S_ISDIR (sbuf->st_mode)) - return 0; - - /* At this point, a trailing slash is only permitted on - symlink-to-dir; but it should have found information on the - directory, not the symlink. Call stat() to get info about the - link's referent. Our replacement stat guarantees valid results, - even if the symlink is not pointing to a directory. */ - if (!S_ISLNK (sbuf->st_mode)) + if (result == 0) { - errno = ENOTDIR; - return -1; + if (S_ISDIR (sbuf->st_mode) || file[strlen (file) - 1] != '/') + result = stat_time_normalize (result, sbuf); + else + { + /* At this point, a trailing slash is permitted only on + symlink-to-dir; but it should have found information on the + directory, not the symlink. Call 'stat' to get info about the + link's referent. Our replacement stat guarantees valid results, + even if the symlink is not pointing to a directory. */ + if (!S_ISLNK (sbuf->st_mode)) + { + errno = ENOTDIR; + return -1; + } + result = stat (file, sbuf); + } } - return stat (file, sbuf); + return result; } #endif /* HAVE_LSTAT */ diff --git a/gnulib/import/m4/00gnulib.m4 b/gnulib/import/m4/00gnulib.m4 index bb37e32..e3e0fb6 100644 --- a/gnulib/import/m4/00gnulib.m4 +++ b/gnulib/import/m4/00gnulib.m4 @@ -1,5 +1,5 @@ # 00gnulib.m4 serial 3 -dnl Copyright (C) 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2019 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. diff --git a/gnulib/import/m4/__inline.m4 b/gnulib/import/m4/__inline.m4 new file mode 100644 index 0000000..e1aa310 --- /dev/null +++ b/gnulib/import/m4/__inline.m4 @@ -0,0 +1,22 @@ +# Test for __inline keyword +dnl Copyright 2017-2019 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___INLINE], +[ + AC_CACHE_CHECK([whether the compiler supports the __inline keyword], + [gl_cv_c___inline], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[typedef int foo_t; + static __inline foo_t foo (void) { return 0; }]], + [[return foo ();]])], + [gl_cv_c___inline=yes], + [gl_cv_c___inline=no])]) + if test $gl_cv_c___inline = yes; then + AC_DEFINE([HAVE___INLINE], [1], + [Define to 1 if the compiler supports the keyword '__inline'.]) + fi +]) diff --git a/gnulib/import/m4/absolute-header.m4 b/gnulib/import/m4/absolute-header.m4 index 7ffc38d..a8f2cba 100644 --- a/gnulib/import/m4/absolute-header.m4 +++ b/gnulib/import/m4/absolute-header.m4 @@ -1,5 +1,5 @@ # absolute-header.m4 serial 16 -dnl Copyright (C) 2006-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2019 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. diff --git a/gnulib/import/m4/alloca.m4 b/gnulib/import/m4/alloca.m4 index 2382ff1..29bd289 100644 --- a/gnulib/import/m4/alloca.m4 +++ b/gnulib/import/m4/alloca.m4 @@ -1,5 +1,5 @@ -# alloca.m4 serial 14 -dnl Copyright (C) 2002-2004, 2006-2007, 2009-2016 Free Software Foundation, +# alloca.m4 serial 15 +dnl Copyright (C) 2002-2004, 2006-2007, 2009-2019 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -37,6 +37,13 @@ AC_DEFUN([gl_FUNC_ALLOCA], fi AC_SUBST([ALLOCA_H]) AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"]) + + if test $ac_cv_working_alloca_h = yes; then + HAVE_ALLOCA_H=1 + else + HAVE_ALLOCA_H=0 + fi + AC_SUBST([HAVE_ALLOCA_H]) ]) # Prerequisites of lib/alloca.c. @@ -44,12 +51,12 @@ AC_DEFUN([gl_FUNC_ALLOCA], AC_DEFUN([gl_PREREQ_ALLOCA], [:]) # This works around a bug in autoconf <= 2.68. -# See <http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00277.html>. +# See <https://lists.gnu.org/r/bug-gnulib/2011-06/msg00277.html>. m4_version_prereq([2.69], [] ,[ # This is taken from the following Autoconf patch: -# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497 +# https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=6cd9f12520b0d6f76d3230d7565feba1ecf29497 # _AC_LIBOBJ_ALLOCA # ----------------- diff --git a/gnulib/import/m4/arpa_inet_h.m4 b/gnulib/import/m4/arpa_inet_h.m4 index 5387f28..645011d 100644 --- a/gnulib/import/m4/arpa_inet_h.m4 +++ b/gnulib/import/m4/arpa_inet_h.m4 @@ -1,5 +1,5 @@ -# arpa_inet_h.m4 serial 13 -dnl Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc. +# arpa_inet_h.m4 serial 14 +dnl Copyright (C) 2006, 2008-2019 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. @@ -24,6 +24,8 @@ AC_DEFUN([gl_HEADER_ARPA_INET], AC_REQUIRE([gl_FEATURES_H]) + gl_PREREQ_SYS_H_WS2TCPIP + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ diff --git a/gnulib/import/m4/builtin-expect.m4 b/gnulib/import/m4/builtin-expect.m4 new file mode 100644 index 0000000..b65fbf8 --- /dev/null +++ b/gnulib/import/m4/builtin-expect.m4 @@ -0,0 +1,49 @@ +dnl Check for __builtin_expect. + +dnl Copyright 2016-2019 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 Written by Paul Eggert. + +AC_DEFUN([gl___BUILTIN_EXPECT], +[ + AC_CACHE_CHECK([for __builtin_expect], + [gl_cv___builtin_expect], + [AC_LINK_IFELSE( + [AC_LANG_SOURCE([[ + int + main (int argc, char **argv) + { + argc = __builtin_expect (argc, 100); + return argv[argc != 100][0]; + }]])], + [gl_cv___builtin_expect=yes], + [AC_LINK_IFELSE( + [AC_LANG_SOURCE([[ + #include <builtins.h> + int + main (int argc, char **argv) + { + argc = __builtin_expect (argc, 100); + return argv[argc != 100][0]; + }]])], + [gl_cv___builtin_expect="in <builtins.h>"], + [gl_cv___builtin_expect=no])])]) + if test "$gl_cv___builtin_expect" = yes; then + AC_DEFINE([HAVE___BUILTIN_EXPECT], [1]) + elif test "$gl_cv___builtin_expect" = "in <builtins.h>"; then + AC_DEFINE([HAVE___BUILTIN_EXPECT], [2]) + fi + AH_VERBATIM([HAVE___BUILTIN_EXPECT], + [/* Define to 1 if the compiler supports __builtin_expect, + and to 2 if <builtins.h> does. */ +#undef HAVE___BUILTIN_EXPECT +#ifndef HAVE___BUILTIN_EXPECT +# define __builtin_expect(e, c) (e) +#elif HAVE___BUILTIN_EXPECT == 2 +# include <builtins.h> +#endif + ]) +]) diff --git a/gnulib/import/m4/canonicalize.m4 b/gnulib/import/m4/canonicalize.m4 index cbbf3e2..cb0896f 100644 --- a/gnulib/import/m4/canonicalize.m4 +++ b/gnulib/import/m4/canonicalize.m4 @@ -1,6 +1,6 @@ -# canonicalize.m4 serial 28 +# canonicalize.m4 serial 31 -dnl Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2003-2007, 2009-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -35,8 +35,8 @@ AC_DEFUN([gl_CANONICALIZE_LGPL], HAVE_REALPATH=0 else case "$gl_cv_func_realpath_works" in - *yes) ;; - *) REPLACE_REALPATH=1 ;; + *yes) ;; + *) REPLACE_REALPATH=1 ;; esac fi else @@ -113,8 +113,12 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS], [case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_realpath_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_realpath_works="guessing no" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_realpath_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_realpath_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_realpath_works="$gl_cross_guess_normal" ;; esac ]) rm -rf conftest.a conftest.d diff --git a/gnulib/import/m4/chdir-long.m4 b/gnulib/import/m4/chdir-long.m4 index 85e7a22..64b5ef9 100644 --- a/gnulib/import/m4/chdir-long.m4 +++ b/gnulib/import/m4/chdir-long.m4 @@ -1,4 +1,4 @@ -#serial 15 +#serial 16 # Use Gnulib's robust chdir function. # It can handle arbitrarily long directory names, which means @@ -6,7 +6,7 @@ # never fails with ENAMETOOLONG. # Arrange to compile chdir-long.c only on systems that define PATH_MAX. -dnl Copyright (C) 2004-2007, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2007, 2009-2019 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. @@ -17,14 +17,14 @@ AC_DEFUN([gl_FUNC_CHDIR_LONG], [ AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ]) AC_CACHE_CHECK([whether this system has an arbitrary file name length limit], - gl_cv_have_arbitrary_file_name_length_limit, + [gl_cv_have_arbitrary_file_name_length_limit], [AC_EGREP_CPP([have_arbitrary_file_name_length_limit], gl_PATHMAX_SNIPPET[ #ifdef PATH_MAX have_arbitrary_file_name_length_limit #endif], - gl_cv_have_arbitrary_file_name_length_limit=yes, - gl_cv_have_arbitrary_file_name_length_limit=no)]) + [gl_cv_have_arbitrary_file_name_length_limit=yes], + [gl_cv_have_arbitrary_file_name_length_limit=no])]) ]) AC_DEFUN([gl_PREREQ_CHDIR_LONG], [:]) diff --git a/gnulib/import/m4/close.m4 b/gnulib/import/m4/close.m4 index 310f076..7013a13 100644 --- a/gnulib/import/m4/close.m4 +++ b/gnulib/import/m4/close.m4 @@ -1,5 +1,5 @@ -# close.m4 serial 8 -dnl Copyright (C) 2008-2016 Free Software Foundation, Inc. +# close.m4 serial 9 +dnl Copyright (C) 2008-2019 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. @@ -7,10 +7,12 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_CLOSE], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - AC_REQUIRE([gl_MSVC_INVAL]) - if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then - REPLACE_CLOSE=1 - fi + m4_ifdef([gl_MSVC_INVAL], [ + AC_REQUIRE([gl_MSVC_INVAL]) + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + REPLACE_CLOSE=1 + fi + ]) m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [ gl_PREREQ_SYS_H_WINSOCK2 if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then diff --git a/gnulib/import/m4/closedir.m4 b/gnulib/import/m4/closedir.m4 index 0c9fd82..37dc541 100644 --- a/gnulib/import/m4/closedir.m4 +++ b/gnulib/import/m4/closedir.m4 @@ -1,5 +1,5 @@ -# closedir.m4 serial 5 -dnl Copyright (C) 2011-2016 Free Software Foundation, Inc. +# closedir.m4 serial 6 +dnl Copyright (C) 2011-2019 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. @@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_CLOSEDIR], [ AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS([closedir]) if test $ac_cv_func_closedir = no; then diff --git a/gnulib/import/m4/codeset.m4 b/gnulib/import/m4/codeset.m4 index bc98201..280f556 100644 --- a/gnulib/import/m4/codeset.m4 +++ b/gnulib/import/m4/codeset.m4 @@ -1,6 +1,6 @@ # codeset.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016 Free Software Foundation, -dnl Inc. +dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019 Free Software +dnl 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. diff --git a/gnulib/import/m4/configmake.m4 b/gnulib/import/m4/configmake.m4 deleted file mode 100644 index 80b9254..0000000 --- a/gnulib/import/m4/configmake.m4 +++ /dev/null @@ -1,55 +0,0 @@ -# configmake.m4 serial 2 -dnl Copyright (C) 2010-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. - -# gl_CONFIGMAKE_PREP -# ------------------ -# Guarantee all of the standard directory variables, even when used with -# autoconf 2.59 (datarootdir wasn't supported until 2.59c, and runstatedir -# in 2.70) or automake 1.9.6 (pkglibexecdir wasn't supported until 1.10b, -# and runstatedir in 1.14.1). -AC_DEFUN([gl_CONFIGMAKE_PREP], -[ - dnl Technically, datadir should default to datarootdir. But if - dnl autoconf is too old to provide datarootdir, then reversing the - dnl definition is a reasonable compromise. Only AC_SUBST a variable - dnl if it was not already defined earlier by autoconf. - if test "x$datarootdir" = x; then - AC_SUBST([datarootdir], ['${datadir}']) - fi - dnl Copy the approach used in autoconf 2.60. - if test "x$docdir" = x; then - AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], - ['${datarootdir}/doc/${PACKAGE_TARNAME}'], - ['${datarootdir}/doc/${PACKAGE}'])]) - fi - dnl The remaining variables missing from autoconf 2.59 are easier. - if test "x$htmldir" = x; then - AC_SUBST([htmldir], ['${docdir}']) - fi - if test "x$dvidir" = x; then - AC_SUBST([dvidir], ['${docdir}']) - fi - if test "x$pdfdir" = x; then - AC_SUBST([pdfdir], ['${docdir}']) - fi - if test "x$psdir" = x; then - AC_SUBST([psdir], ['${docdir}']) - fi - if test "x$lispdir" = x; then - AC_SUBST([lispdir], ['${datarootdir}/emacs/site-lisp']) - fi - if test "x$localedir" = x; then - AC_SUBST([localedir], ['${datarootdir}/locale']) - fi - dnl Added in autoconf 2.70 - if test "x$runstatedir" = x; then - AC_SUBST([runstatedir], ['${localstatedir}/run']) - fi - - dnl Automake 1.9.6 only lacks pkglibexecdir; and since 1.11 merely - dnl provides it without AC_SUBST, this blind use of AC_SUBST is safe. - AC_SUBST([pkglibexecdir], ['${libexecdir}/${PACKAGE}']) -]) diff --git a/gnulib/import/m4/d-ino.m4 b/gnulib/import/m4/d-ino.m4 index f3ce54c..882fc4c 100644 --- a/gnulib/import/m4/d-ino.m4 +++ b/gnulib/import/m4/d-ino.m4 @@ -1,11 +1,11 @@ -# serial 15 +# serial 20 dnl From Jim Meyering. dnl dnl Check whether struct dirent has a member named d_ino. dnl -# Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2016 Free Software +# Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2019 Free Software # Foundation, Inc. # This file is free software; the Free Software Foundation @@ -15,7 +15,7 @@ dnl AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO], [AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([for d_ino member in directory struct], - gl_cv_struct_dirent_d_ino, + [gl_cv_struct_dirent_d_ino], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/types.h> @@ -29,21 +29,25 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO], return 1; e = readdir (dp); if (! e) - return 2; + { closedir (dp); return 2; } if (lstat (e->d_name, &st) != 0) - return 3; + { closedir (dp); return 3; } if (e->d_ino != st.st_ino) - return 4; + { closedir (dp); return 4; } closedir (dp); return 0; ]])], [gl_cv_struct_dirent_d_ino=yes], [gl_cv_struct_dirent_d_ino=no], [case "$host_os" in - # Guess yes on glibc systems with Linux kernel. - linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_struct_dirent_d_ino="guessing no" ;; + # Guess yes on glibc systems with Linux kernel. + linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;; + # Guess yes on musl systems with Linux kernel. + linux*-musl*) gl_cv_struct_dirent_d_ino="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_struct_dirent_d_ino="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_struct_dirent_d_ino="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_struct_dirent_d_ino" in diff --git a/gnulib/import/m4/d-type.m4 b/gnulib/import/m4/d-type.m4 index eda762c..4ca56d6 100644 --- a/gnulib/import/m4/d-type.m4 +++ b/gnulib/import/m4/d-type.m4 @@ -1,11 +1,11 @@ -# serial 11 +# serial 12 dnl From Jim Meyering. dnl dnl Check whether struct dirent has a member named d_type. dnl -# Copyright (C) 1997, 1999-2004, 2006, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 1997, 1999-2004, 2006, 2009-2019 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -13,7 +13,7 @@ dnl AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE], [AC_CACHE_CHECK([for d_type member in directory struct], - gl_cv_struct_dirent_d_type, + [gl_cv_struct_dirent_d_type], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <dirent.h> diff --git a/gnulib/import/m4/dirent_h.m4 b/gnulib/import/m4/dirent_h.m4 index 68836a4..732aa55 100644 --- a/gnulib/import/m4/dirent_h.m4 +++ b/gnulib/import/m4/dirent_h.m4 @@ -1,5 +1,5 @@ # dirent_h.m4 serial 16 -dnl Copyright (C) 2008-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2019 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. diff --git a/gnulib/import/m4/dirfd.m4 b/gnulib/import/m4/dirfd.m4 index 1d7cb08..5c75869 100644 --- a/gnulib/import/m4/dirfd.m4 +++ b/gnulib/import/m4/dirfd.m4 @@ -1,8 +1,8 @@ -# serial 24 -*- Autoconf -*- +# serial 26 -*- Autoconf -*- dnl Find out how to get the file descriptor associated with an open DIR*. -# Copyright (C) 2001-2006, 2008-2016 Free Software Foundation, Inc. +# Copyright (C) 2001-2006, 2008-2019 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. @@ -12,6 +12,7 @@ dnl From Jim Meyering AC_DEFUN([gl_FUNC_DIRFD], [ AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Persuade glibc <dirent.h> to declare dirfd(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) @@ -25,15 +26,15 @@ AC_DEFUN([gl_FUNC_DIRFD], fi AC_CACHE_CHECK([whether dirfd is a macro], - gl_cv_func_dirfd_macro, + [gl_cv_func_dirfd_macro], [AC_EGREP_CPP([dirent_header_defines_dirfd], [ #include <sys/types.h> #include <dirent.h> #ifdef dirfd dirent_header_defines_dirfd #endif], - gl_cv_func_dirfd_macro=yes, - gl_cv_func_dirfd_macro=no)]) + [gl_cv_func_dirfd_macro=yes], + [gl_cv_func_dirfd_macro=no])]) # Use the replacement if we have no function or macro with that name, # or if OS/2 kLIBC whose dirfd() does not work. diff --git a/gnulib/import/m4/dirname.m4 b/gnulib/import/m4/dirname.m4 index 6f8bec3..32141ae 100644 --- a/gnulib/import/m4/dirname.m4 +++ b/gnulib/import/m4/dirname.m4 @@ -1,5 +1,5 @@ #serial 10 -*- autoconf -*- -dnl Copyright (C) 2002-2006, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2019 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. diff --git a/gnulib/import/m4/double-slash-root.m4 b/gnulib/import/m4/double-slash-root.m4 index dfd3921..0c5afb1 100644 --- a/gnulib/import/m4/double-slash-root.m4 +++ b/gnulib/import/m4/double-slash-root.m4 @@ -1,5 +1,5 @@ # double-slash-root.m4 serial 4 -*- Autoconf -*- -dnl Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2008-2019 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. diff --git a/gnulib/import/m4/dup.m4 b/gnulib/import/m4/dup.m4 index e30348c..005f1ea 100644 --- a/gnulib/import/m4/dup.m4 +++ b/gnulib/import/m4/dup.m4 @@ -1,5 +1,5 @@ -# dup.m4 serial 4 -dnl Copyright (C) 2011-2016 Free Software Foundation, Inc. +# dup.m4 serial 6 +dnl Copyright (C) 2011-2019 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. @@ -7,10 +7,13 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_DUP], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - AC_REQUIRE([gl_MSVC_INVAL]) - if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then - REPLACE_DUP=1 - fi + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + m4_ifdef([gl_MSVC_INVAL], [ + AC_REQUIRE([gl_MSVC_INVAL]) + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + REPLACE_DUP=1 + fi + ]) dnl Replace dup() for supporting the gnulib-defined fchdir() function, dnl to keep fchdir's bookkeeping up-to-date. m4_ifdef([gl_FUNC_FCHDIR], [ @@ -31,7 +34,12 @@ AC_DEFUN([gl_FUNC_DUP], ], [gl_cv_func_dup_works=yes], [gl_cv_func_dup_works=no], - [gl_cv_func_dup_works='guessing yes']) + [case "$host_os" in + # Guess no on native Windows. + mingw*) gl_cv_func_dup_works="guessing no" ;; + *) gl_cv_func_dup_works="guessing yes" ;; + esac + ]) ]) case "$gl_cv_func_dup_works" in *yes) ;; diff --git a/gnulib/import/m4/dup2.m4 b/gnulib/import/m4/dup2.m4 index 5b68312..b314247 100644 --- a/gnulib/import/m4/dup2.m4 +++ b/gnulib/import/m4/dup2.m4 @@ -1,5 +1,5 @@ #serial 25 -dnl Copyright (C) 2002, 2005, 2007, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2005, 2007, 2009-2019 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. diff --git a/gnulib/import/m4/eealloc.m4 b/gnulib/import/m4/eealloc.m4 index 63d74de..2a4b120 100644 --- a/gnulib/import/m4/eealloc.m4 +++ b/gnulib/import/m4/eealloc.m4 @@ -1,5 +1,5 @@ # eealloc.m4 serial 3 -dnl Copyright (C) 2003, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2009-2019 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. diff --git a/gnulib/import/m4/environ.m4 b/gnulib/import/m4/environ.m4 index 9a0ea7e..c1a6fa3 100644 --- a/gnulib/import/m4/environ.m4 +++ b/gnulib/import/m4/environ.m4 @@ -1,5 +1,5 @@ -# environ.m4 serial 6 -dnl Copyright (C) 2001-2004, 2006-2016 Free Software Foundation, Inc. +# environ.m4 serial 7 +dnl Copyright (C) 2001-2004, 2006-2019 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. @@ -29,16 +29,14 @@ AC_DEFUN_ONCE([gl_ENVIRON], AC_DEFUN([gt_CHECK_VAR_DECL], [ define([gt_cv_var], [gt_cv_var_]$2[_declaration]) - AC_MSG_CHECKING([if $2 is properly declared]) - AC_CACHE_VAL([gt_cv_var], [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[$1 - extern struct { int foo; } $2;]], - [[$2.foo = 1;]])], - [gt_cv_var=no], - [gt_cv_var=yes])]) - AC_MSG_RESULT([$gt_cv_var]) + AC_CACHE_CHECK([if $2 is properly declared], [gt_cv_var], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[$1 + extern struct { int foo; } $2;]], + [[$2.foo = 1;]])], + [gt_cv_var=no], + [gt_cv_var=yes])]) if test $gt_cv_var = yes; then AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1, [Define if you have the declaration of $2.]) diff --git a/gnulib/import/m4/errno_h.m4 b/gnulib/import/m4/errno_h.m4 index b111fce..2388854 100644 --- a/gnulib/import/m4/errno_h.m4 +++ b/gnulib/import/m4/errno_h.m4 @@ -1,9 +1,11 @@ -# errno_h.m4 serial 12 -dnl Copyright (C) 2004, 2006, 2008-2016 Free Software Foundation, Inc. +# errno_h.m4 serial 13 +dnl Copyright (C) 2004, 2006, 2008-2019 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_PREREQ([2.61]) + AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], [ AC_REQUIRE([AC_PROG_CC]) @@ -129,9 +131,3 @@ yes AC_SUBST($1[_VALUE]) fi ]) - -dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. -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])]) -]) diff --git a/gnulib/import/m4/error.m4 b/gnulib/import/m4/error.m4 index f772bcf..393adb5 100644 --- a/gnulib/import/m4/error.m4 +++ b/gnulib/import/m4/error.m4 @@ -1,6 +1,6 @@ #serial 14 -# Copyright (C) 1996-1998, 2001-2004, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 1996-1998, 2001-2004, 2009-2019 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/gnulib/import/m4/exponentd.m4 b/gnulib/import/m4/exponentd.m4 index 7869a7d..90870df 100644 --- a/gnulib/import/m4/exponentd.m4 +++ b/gnulib/import/m4/exponentd.m4 @@ -1,5 +1,5 @@ # exponentd.m4 serial 3 -dnl Copyright (C) 2007-2008, 2010-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2008, 2010-2019 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. diff --git a/gnulib/import/m4/exponentl.m4 b/gnulib/import/m4/exponentl.m4 index c49cf2c3..4064981 100644 --- a/gnulib/import/m4/exponentl.m4 +++ b/gnulib/import/m4/exponentl.m4 @@ -1,11 +1,12 @@ -# exponentl.m4 serial 3 -dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +# exponentl.m4 serial 4 +dnl Copyright (C) 2007-2019 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_LONG_DOUBLE_EXPONENT_LOCATION], [ AC_REQUIRE([gl_BIGENDIAN]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([where to find the exponent in a 'long double'], [gl_cv_cc_long_double_expbit0], [ @@ -79,9 +80,24 @@ int main () [gl_cv_cc_long_double_expbit0=`cat conftest.out`], [gl_cv_cc_long_double_expbit0="unknown"], [ - dnl When cross-compiling, we don't know. It depends on the + dnl When cross-compiling, in general we don't know. It depends on the dnl ABI and compiler version. There are too many cases. gl_cv_cc_long_double_expbit0="unknown" + case "$host_os" in + mingw*) # On native Windows (little-endian), we know the result + # in two cases: mingw, MSVC. + AC_EGREP_CPP([Known], [ +#ifdef __MINGW32__ + Known +#endif + ], [gl_cv_cc_long_double_expbit0="word 2 bit 0"]) + AC_EGREP_CPP([Known], [ +#ifdef _MSC_VER + Known +#endif + ], [gl_cv_cc_long_double_expbit0="word 1 bit 20"]) + ;; + esac ]) rm -f conftest.out ]) diff --git a/gnulib/import/m4/extensions.m4 b/gnulib/import/m4/extensions.m4 index e114a6f..fd1ce81 100644 --- a/gnulib/import/m4/extensions.m4 +++ b/gnulib/import/m4/extensions.m4 @@ -1,7 +1,7 @@ -# serial 15 -*- Autoconf -*- +# serial 18 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006-2016 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006-2019 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. @@ -68,6 +68,14 @@ dnl configure.ac when using autoheader 2.62. #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif +/* Enable NetBSD extensions on NetBSD. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD extensions on NetBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS @@ -110,6 +118,11 @@ dnl configure.ac when using autoheader 2.62. #ifndef _XOPEN_SOURCE # undef _XOPEN_SOURCE #endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ @@ -128,6 +141,8 @@ dnl configure.ac when using autoheader 2.62. AC_DEFINE([_ALL_SOURCE]) AC_DEFINE([_DARWIN_C_SOURCE]) AC_DEFINE([_GNU_SOURCE]) + AC_DEFINE([_NETBSD_SOURCE]) + AC_DEFINE([_OPENBSD_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__]) AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__]) @@ -153,6 +168,7 @@ dnl configure.ac when using autoheader 2.62. [ac_cv_should_define__xopen_source=yes])])]) test $ac_cv_should_define__xopen_source = yes && AC_DEFINE([_XOPEN_SOURCE], [500]) + AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API]) ])# AC_USE_SYSTEM_EXTENSIONS # gl_USE_SYSTEM_EXTENSIONS diff --git a/gnulib/import/m4/extern-inline.m4 b/gnulib/import/m4/extern-inline.m4 index 1e578f3..84421ce 100644 --- a/gnulib/import/m4/extern-inline.m4 +++ b/gnulib/import/m4/extern-inline.m4 @@ -1,6 +1,6 @@ dnl 'extern inline' a la ISO C99. -dnl Copyright 2012-2016 Free Software Foundation, Inc. +dnl Copyright 2012-2019 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. @@ -11,7 +11,7 @@ AC_DEFUN([gl_EXTERN_INLINE], [/* Please see the Gnulib manual for how to use these macros. Suppress extern inline with HP-UX cc, as it appears to be broken; see - <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>. + <https://lists.gnu.org/r/bug-texinfo/2013-02/msg00030.html>. Suppress extern inline with Sun C in standards-conformance mode, as it mishandles inline functions that call each other. E.g., for 'inline void f @@ -25,20 +25,32 @@ AC_DEFUN([gl_EXTERN_INLINE], if isdigit is mistakenly implemented via a static inline function, a program containing an extern inline function that calls isdigit may not work since the C standard prohibits extern inline functions - from calling static functions. This bug is known to occur on: + from calling static functions (ISO C 99 section 6.7.4.(3). + This bug is known to occur on: OS X 10.8 and earlier; see: - http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html + https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html DragonFly; see - http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log + http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log FreeBSD; see: - http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html + https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and - for clang but remains for g++; see <http://trac.macports.org/ticket/41033>. - Assume DragonFly and FreeBSD will be similar. */ + for clang but remains for g++; see <https://trac.macports.org/ticket/41033>. + Assume DragonFly and FreeBSD will be similar. + + GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 + inline semantics, unless -fgnu89-inline is used. It defines a macro + __GNUC_STDC_INLINE__ to indicate this situation or a macro + __GNUC_GNU_INLINE__ to indicate the opposite situation. + GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline + semantics but warns, unless -fgnu89-inline is used: + warning: C99 inline functions are not supported; using GNU89 + warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute + It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. + */ #if (((defined __APPLE__ && defined __MACH__) \ || defined __DragonFly__ || defined __FreeBSD__) \ && (defined __header_inline \ diff --git a/gnulib/import/m4/fchdir.m4 b/gnulib/import/m4/fchdir.m4 index 4264166..ed29562 100644 --- a/gnulib/import/m4/fchdir.m4 +++ b/gnulib/import/m4/fchdir.m4 @@ -1,5 +1,5 @@ -# fchdir.m4 serial 21 -dnl Copyright (C) 2006-2016 Free Software Foundation, Inc. +# fchdir.m4 serial 25 +dnl Copyright (C) 2006-2019 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. @@ -31,10 +31,14 @@ AC_DEFUN([gl_FUNC_FCHDIR], [gl_cv_func_open_directory_works=yes], [gl_cv_func_open_directory_works=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_open_directory_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_open_directory_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_open_directory_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_open_directory_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_open_directory_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_open_directory_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_open_directory_works" in diff --git a/gnulib/import/m4/fcntl-o.m4 b/gnulib/import/m4/fcntl-o.m4 index 24fcf88..6ab3387 100644 --- a/gnulib/import/m4/fcntl-o.m4 +++ b/gnulib/import/m4/fcntl-o.m4 @@ -1,23 +1,22 @@ -# fcntl-o.m4 serial 4 -dnl Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. +# fcntl-o.m4 serial 6 +dnl Copyright (C) 2006, 2009-2019 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 Written by Paul Eggert. +AC_PREREQ([2.60]) + # Test whether the flags O_NOATIME and O_NOFOLLOW actually work. # Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. # Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. AC_DEFUN([gl_FCNTL_O_FLAGS], [ dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. - dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes - dnl AC_GNU_SOURCE. - m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], - [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], - [AC_REQUIRE([AC_GNU_SOURCE])]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CHECK_FUNCS_ONCE([symlink]) AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], @@ -116,7 +115,13 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( *) gl_cv_header_working_fcntl_h='no';; esac], - [gl_cv_header_working_fcntl_h=cross-compiling])]) + [case "$host_os" in + # Guess 'no' on native Windows. + mingw*) gl_cv_header_working_fcntl_h='no' ;; + *) gl_cv_header_working_fcntl_h=cross-compiling ;; + esac + ]) + ]) case $gl_cv_header_working_fcntl_h in #( *O_NOATIME* | no | cross-compiling) ac_val=0;; #( diff --git a/gnulib/import/m4/fcntl.m4 b/gnulib/import/m4/fcntl.m4 index bb61470..e409e96 100644 --- a/gnulib/import/m4/fcntl.m4 +++ b/gnulib/import/m4/fcntl.m4 @@ -1,5 +1,5 @@ # fcntl.m4 serial 9 -dnl Copyright (C) 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2019 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. diff --git a/gnulib/import/m4/fcntl_h.m4 b/gnulib/import/m4/fcntl_h.m4 index ef0d78d..60dc5e2 100644 --- a/gnulib/import/m4/fcntl_h.m4 +++ b/gnulib/import/m4/fcntl_h.m4 @@ -1,6 +1,6 @@ -# serial 15 +# serial 16 # Configure fcntl.h. -dnl Copyright (C) 2006-2007, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2007, 2009-2019 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. @@ -37,6 +37,7 @@ AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], AC_DEFUN([gl_FCNTL_H_DEFAULTS], [ + GNULIB_CREAT=0; AC_SUBST([GNULIB_CREAT]) GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL]) GNULIB_NONBLOCKING=0; AC_SUBST([GNULIB_NONBLOCKING]) GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) @@ -44,6 +45,7 @@ AC_DEFUN([gl_FCNTL_H_DEFAULTS], dnl Assume proper GNU behavior unless another module says otherwise. HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) + REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT]) REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) diff --git a/gnulib/import/m4/fdopendir.m4 b/gnulib/import/m4/fdopendir.m4 index cadbee3..ad48e4e 100644 --- a/gnulib/import/m4/fdopendir.m4 +++ b/gnulib/import/m4/fdopendir.m4 @@ -1,7 +1,7 @@ -# serial 10 +# serial 12 # See if we need to provide fdopendir. -dnl Copyright (C) 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2019 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. @@ -45,10 +45,12 @@ DIR *fdopendir (int); [gl_cv_func_fdopendir_works=yes], [gl_cv_func_fdopendir_works=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_fdopendir_works="guessing no" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_fdopendir_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_fdopendir_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_fdopendir_works" in diff --git a/gnulib/import/m4/filenamecat.m4 b/gnulib/import/m4/filenamecat.m4 index b794880..351715a 100644 --- a/gnulib/import/m4/filenamecat.m4 +++ b/gnulib/import/m4/filenamecat.m4 @@ -1,5 +1,5 @@ # filenamecat.m4 serial 11 -dnl Copyright (C) 2002-2006, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2019 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. diff --git a/gnulib/import/m4/flexmember.m4 b/gnulib/import/m4/flexmember.m4 index 155ae9b..c245ab0 100644 --- a/gnulib/import/m4/flexmember.m4 +++ b/gnulib/import/m4/flexmember.m4 @@ -1,7 +1,7 @@ -# serial 4 +# serial 5 # Check for flexible array member support. -# Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2006, 2009-2019 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. @@ -17,12 +17,15 @@ AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER], [[#include <stdlib.h> #include <stdio.h> #include <stddef.h> - struct s { int n; double d[]; };]], + struct m { struct m *next, **list; char name[]; }; + struct s { struct s *p; struct m *m; int n; double d[]; };]], [[int m = getchar (); 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->p = p; + p->m = NULL; p->d[0] = 0.0; return p->d != (double *) NULL;]])], [ac_cv_c_flexmember=yes], @@ -31,12 +34,10 @@ AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER], AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [], [Define to nothing if C supports flexible array members, and to 1 if it does not. That way, with a declaration like 'struct s - { int n; double d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack + { int n; short d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack can be used with pre-C99 compilers. - When computing the size of such an object, don't use 'sizeof (struct s)' - as it overestimates the size. Use 'offsetof (struct s, d)' instead. - Don't use 'offsetof (struct s, d@<:@0@:>@)', as this doesn't work with - MSVC and with C++ compilers.]) + Use 'FLEXSIZEOF (struct s, d, N * sizeof (short))' to calculate + the size in bytes of such a struct containing an N-element array.]) else AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [1]) fi diff --git a/gnulib/import/m4/float_h.m4 b/gnulib/import/m4/float_h.m4 index e2887eb..1cd28a0 100644 --- a/gnulib/import/m4/float_h.m4 +++ b/gnulib/import/m4/float_h.m4 @@ -1,5 +1,5 @@ -# float_h.m4 serial 9 -dnl Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. +# float_h.m4 serial 12 +dnl Copyright (C) 2007, 2009-2019 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. @@ -14,7 +14,7 @@ AC_DEFUN([gl_FLOAT_H], aix* | beos* | openbsd* | mirbsd* | irix*) FLOAT_H=float.h ;; - freebsd*) + freebsd* | dragonfly*) case "$host_cpu" in changequote(,)dnl i[34567]86 ) @@ -24,10 +24,14 @@ changequote([,])dnl x86_64 ) # On x86_64 systems, the C compiler may still be generating # 32-bit code. - AC_EGREP_CPP([yes], - [#if defined __LP64__ || defined __x86_64__ || defined __amd64__ - yes - #endif], + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ || defined __x86_64__ || defined __amd64__ + int ok; + #else + error fail + #endif + ]])], [], [FLOAT_H=float.h]) ;; @@ -42,7 +46,7 @@ changequote([,])dnl ;; esac case "$host_os" in - aix* | freebsd* | linux*) + aix* | freebsd* | dragonfly* | linux*) if test -n "$FLOAT_H"; then REPLACE_FLOAT_LDBL=1 fi @@ -69,14 +73,20 @@ int main () [gl_cv_func_itold_works=no], [case "$host" in sparc*-*-linux*) - AC_EGREP_CPP([yes], - [#if defined __LP64__ || defined __arch64__ - yes - #endif], + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ || defined __arch64__ + int ok; + #else + error fail + #endif + ]])], [gl_cv_func_itold_works="guessing no"], [gl_cv_func_itold_works="guessing yes"]) ;; - *) gl_cv_func_itold_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_itold_works="guessing yes" ;; + *) gl_cv_func_itold_works="guessing yes" ;; esac ]) ]) diff --git a/gnulib/import/m4/fnmatch.m4 b/gnulib/import/m4/fnmatch.m4 index b38f56c..75ba55b 100644 --- a/gnulib/import/m4/fnmatch.m4 +++ b/gnulib/import/m4/fnmatch.m4 @@ -1,6 +1,6 @@ -# Check for fnmatch - serial 9. -*- coding: utf-8 -*- +# Check for fnmatch - serial 14. -*- coding: utf-8 -*- -# Copyright (C) 2000-2007, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2000-2007, 2009-2019 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. @@ -13,124 +13,128 @@ AC_DEFUN([gl_FUNC_FNMATCH_POSIX], [ m4_divert_text([DEFAULTS], [gl_fnmatch_required=POSIX]) - dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc. - dnl This is only needed if gl_fnmatch_required = GNU. It would be possible - dnl to avoid this dependency for gl_FUNC_FNMATCH_POSIX by putting - dnl gl_FUNC_FNMATCH_GNU into a separate .m4 file. - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - - FNMATCH_H= + AC_REQUIRE([gl_FNMATCH_H]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles gl_fnmatch_required_lowercase=` echo $gl_fnmatch_required | LC_ALL=C tr '[[A-Z]]' '[[a-z]]' ` - gl_fnmatch_cache_var="gl_cv_func_fnmatch_${gl_fnmatch_required_lowercase}" - AC_CACHE_CHECK([for working $gl_fnmatch_required fnmatch], - [$gl_fnmatch_cache_var], - [dnl Some versions of Solaris, SCO, and the GNU C Library - dnl have a broken or incompatible fnmatch. - dnl So we run a test program. If we are cross-compiling, take no chance. - dnl Thanks to John Oleynick, François Pinard, and Paul Eggert for this - dnl test. - if test $gl_fnmatch_required = GNU; then - gl_fnmatch_gnu_start= - gl_fnmatch_gnu_end= - else - gl_fnmatch_gnu_start='#if 0' - gl_fnmatch_gnu_end='#endif' - fi - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include <fnmatch.h> - static int - y (char const *pattern, char const *string, int flags) - { - return fnmatch (pattern, string, flags) == 0; - } - static int - n (char const *pattern, char const *string, int flags) - { - return fnmatch (pattern, string, flags) == FNM_NOMATCH; - } - ]], - [[char const *Apat = 'A' < '\\\\' ? "[A-\\\\\\\\]" : "[\\\\\\\\-A]"; - char const *apat = 'a' < '\\\\' ? "[a-\\\\\\\\]" : "[\\\\\\\\-a]"; - static char const A_1[] = { 'A' - 1, 0 }; - static char const A01[] = { 'A' + 1, 0 }; - static char const a_1[] = { 'a' - 1, 0 }; - static char const a01[] = { 'a' + 1, 0 }; - static char const bs_1[] = { '\\\\' - 1, 0 }; - static char const bs01[] = { '\\\\' + 1, 0 }; - int result = 0; - if (!n ("a*", "", 0)) - return 1; - if (!y ("a*", "abc", 0)) - return 1; - if (!y ("[/b", "[/b", 0)) /*"]]"*/ /* glibc Bugzilla bug 12378 */ - return 1; - if (!n ("d*/*1", "d/s/1", FNM_PATHNAME)) - return 2; - if (!y ("a\\\\bc", "abc", 0)) - return 3; - if (!n ("a\\\\bc", "abc", FNM_NOESCAPE)) - return 3; - if (!y ("*x", ".x", 0)) - return 4; - if (!n ("*x", ".x", FNM_PERIOD)) - return 4; - if (!y (Apat, "\\\\", 0)) - return 5; - if (!y (Apat, "A", 0)) - return 5; - if (!y (apat, "\\\\", 0)) - return 5; - if (!y (apat, "a", 0)) - return 5; - if (!(n (Apat, A_1, 0) == ('A' < '\\\\'))) - return 5; - if (!(n (apat, a_1, 0) == ('a' < '\\\\'))) - return 5; - if (!(y (Apat, A01, 0) == ('A' < '\\\\'))) - return 5; - if (!(y (apat, a01, 0) == ('a' < '\\\\'))) - return 5; - if (!(y (Apat, bs_1, 0) == ('A' < '\\\\'))) - return 5; - if (!(y (apat, bs_1, 0) == ('a' < '\\\\'))) - return 5; - if (!(n (Apat, bs01, 0) == ('A' < '\\\\'))) - return 5; - if (!(n (apat, bs01, 0) == ('a' < '\\\\'))) - return 5; - $gl_fnmatch_gnu_start - if (!y ("xxXX", "xXxX", FNM_CASEFOLD)) - result |= 8; - if (!y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH)) - result |= 16; - if (!n ("d*/*1", "d/s/1", FNM_FILE_NAME)) - result |= 32; - if (!y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR)) - result |= 64; - if (!y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR)) - result |= 64; - if (!y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)) - result |= 64; - $gl_fnmatch_gnu_end - return result; - ]])], - [eval "$gl_fnmatch_cache_var=yes"], - [eval "$gl_fnmatch_cache_var=no"], - [eval "$gl_fnmatch_cache_var=\"guessing no\""]) - ]) - eval "gl_fnmatch_result=\"\$$gl_fnmatch_cache_var\"" - if test "$gl_fnmatch_result" = yes; then - dnl Not strictly necessary. Only to avoid spurious leftover files if people - dnl don't do "make distclean". - rm -f "$gl_source_base/fnmatch.h" + AC_CHECK_FUNCS_ONCE([fnmatch]) + if test $ac_cv_func_fnmatch = no; then + HAVE_FNMATCH=0 else - FNMATCH_H=fnmatch.h + gl_fnmatch_cache_var="gl_cv_func_fnmatch_${gl_fnmatch_required_lowercase}" + AC_CACHE_CHECK([for working $gl_fnmatch_required fnmatch], + [$gl_fnmatch_cache_var], + [dnl Some versions of Solaris, SCO, and the GNU C Library + dnl have a broken or incompatible fnmatch. + dnl So we run a test program. If we are cross-compiling, take no chance. + dnl Thanks to John Oleynick, François Pinard, and Paul Eggert for this + dnl test. + if test $gl_fnmatch_required = GNU; then + gl_fnmatch_gnu_start= + gl_fnmatch_gnu_end= + else + gl_fnmatch_gnu_start='#if 0' + gl_fnmatch_gnu_end='#endif' + fi + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <fnmatch.h> + static int + y (char const *pattern, char const *string, int flags) + { + return fnmatch (pattern, string, flags) == 0; + } + static int + n (char const *pattern, char const *string, int flags) + { + return fnmatch (pattern, string, flags) == FNM_NOMATCH; + } + ]], + [[char const *Apat = 'A' < '\\\\' ? "[A-\\\\\\\\]" : "[\\\\\\\\-A]"; + char const *apat = 'a' < '\\\\' ? "[a-\\\\\\\\]" : "[\\\\\\\\-a]"; + static char const A_1[] = { 'A' - 1, 0 }; + static char const A01[] = { 'A' + 1, 0 }; + static char const a_1[] = { 'a' - 1, 0 }; + static char const a01[] = { 'a' + 1, 0 }; + static char const bs_1[] = { '\\\\' - 1, 0 }; + static char const bs01[] = { '\\\\' + 1, 0 }; + int result = 0; + if (!n ("a*", "", 0)) + return 1; + if (!y ("a*", "abc", 0)) + return 1; + if (!y ("[/b", "[/b", 0)) /*"]]"*/ /* glibc Bugzilla bug 12378 */ + return 1; + if (!n ("d*/*1", "d/s/1", FNM_PATHNAME)) + return 2; + if (!y ("a\\\\bc", "abc", 0)) + return 3; + if (!n ("a\\\\bc", "abc", FNM_NOESCAPE)) + return 3; + if (!y ("*x", ".x", 0)) + return 4; + if (!n ("*x", ".x", FNM_PERIOD)) + return 4; + if (!y (Apat, "\\\\", 0)) + return 5; + if (!y (Apat, "A", 0)) + return 5; + if (!y (apat, "\\\\", 0)) + return 5; + if (!y (apat, "a", 0)) + return 5; + if (!(n (Apat, A_1, 0) == ('A' < '\\\\'))) + return 5; + if (!(n (apat, a_1, 0) == ('a' < '\\\\'))) + return 5; + if (!(y (Apat, A01, 0) == ('A' < '\\\\'))) + return 5; + if (!(y (apat, a01, 0) == ('a' < '\\\\'))) + return 5; + if (!(y (Apat, bs_1, 0) == ('A' < '\\\\'))) + return 5; + if (!(y (apat, bs_1, 0) == ('a' < '\\\\'))) + return 5; + if (!(n (Apat, bs01, 0) == ('A' < '\\\\'))) + return 5; + if (!(n (apat, bs01, 0) == ('a' < '\\\\'))) + return 5; + $gl_fnmatch_gnu_start + if (!y ("xxXX", "xXxX", FNM_CASEFOLD)) + result |= 8; + if (!y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH)) + result |= 16; + if (!n ("d*/*1", "d/s/1", FNM_FILE_NAME)) + result |= 32; + if (!y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR)) + result |= 64; + if (!y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR)) + result |= 64; + if (!y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)) + result |= 64; + $gl_fnmatch_gnu_end + return result; + ]])], + [eval "$gl_fnmatch_cache_var=yes"], + [eval "$gl_fnmatch_cache_var=no"], + [case "$host_os" in + # Guess yes on musl systems. + *-musl*) eval "$gl_fnmatch_cache_var=\"guessing yes\"" ;; + # Guess no otherwise, even on glibc systems. + *) eval "$gl_fnmatch_cache_var=\"guessing no\"" ;; + esac + ]) + ]) + eval "gl_fnmatch_result=\"\$$gl_fnmatch_cache_var\"" + case "$gl_fnmatch_result" in + *yes) ;; + *) REPLACE_FNMATCH=1 ;; + esac + fi + if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then + gl_REPLACE_FNMATCH_H fi - AC_SUBST([FNMATCH_H]) - AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"]) ]) # Request a POSIX compliant fnmatch function with GNU extensions. @@ -143,11 +147,6 @@ AC_DEFUN([gl_FUNC_FNMATCH_GNU], AC_DEFUN([gl_PREREQ_FNMATCH], [ - dnl We must choose a different name for our function, since on ELF systems - dnl a broken fnmatch() in libc.so would override our fnmatch() if it is - dnl compiled into a shared library. - AC_DEFINE_UNQUOTED([fnmatch], [${gl_fnmatch_required_lowercase}_fnmatch], - [Define to a replacement function name for fnmatch().]) dnl Prerequisites of lib/fnmatch.c. AC_REQUIRE([AC_TYPE_MBSTATE_T]) AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]]) diff --git a/gnulib/import/m4/fnmatch_h.m4 b/gnulib/import/m4/fnmatch_h.m4 new file mode 100644 index 0000000..fba6f86 --- /dev/null +++ b/gnulib/import/m4/fnmatch_h.m4 @@ -0,0 +1,75 @@ +# fnmatch_h.m4 serial 4 +dnl Copyright (C) 2009-2019 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 Bruno Haible. + +AC_DEFUN_ONCE([gl_FNMATCH_H], +[ + AC_REQUIRE([gl_FNMATCH_H_DEFAULTS]) + m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])]) + AC_CHECK_HEADERS_ONCE([fnmatch.h]) + gl_CHECK_NEXT_HEADERS([fnmatch.h]) + + dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc. + dnl This is only needed if gl_fnmatch_required = GNU. It would be possible + dnl to avoid this dependency for gl_FUNC_FNMATCH_POSIX by putting + dnl gl_FUNC_FNMATCH_GNU into a separate .m4 file. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + if test $ac_cv_header_fnmatch_h = yes; then + HAVE_FNMATCH_H=1 + else + HAVE_FNMATCH_H=0 + fi + AC_SUBST([HAVE_FNMATCH_H]) + + m4_ifdef([gl_POSIXCHECK], + [FNMATCH_H=fnmatch.h], + [FNMATCH_H='' + if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then + dnl Override <fnmatch.h> always, to support the C++ GNULIB_NAMESPACE. + FNMATCH_H=fnmatch.h + else + if test $ac_cv_header_fnmatch_h != yes; then + dnl Provide a substitute <fnmatch.h> file. + FNMATCH_H=fnmatch.h + fi + fi + ]) + AC_SUBST([FNMATCH_H]) + AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <fnmatch.h> + ]], + [fnmatch]) +]) + +dnl Unconditionally enables the replacement of <fnmatch.h>. +AC_DEFUN([gl_REPLACE_FNMATCH_H], +[ + AC_REQUIRE([gl_FNMATCH_H_DEFAULTS]) + FNMATCH_H='fnmatch.h' + AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"]) +]) + +AC_DEFUN([gl_FNMATCH_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_FNMATCH_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_FNMATCH_H_DEFAULTS], +[ + GNULIB_FNMATCH=0; AC_SUBST([GNULIB_FNMATCH]) + dnl Assume POSIX behavior unless another module says otherwise. + HAVE_FNMATCH=1; AC_SUBST([HAVE_FNMATCH]) + REPLACE_FNMATCH=0; AC_SUBST([REPLACE_FNMATCH]) +]) diff --git a/gnulib/import/m4/fpieee.m4 b/gnulib/import/m4/fpieee.m4 index e11ac9f..ea1d5da 100644 --- a/gnulib/import/m4/fpieee.m4 +++ b/gnulib/import/m4/fpieee.m4 @@ -1,5 +1,5 @@ # fpieee.m4 serial 2 -*- coding: utf-8 -*- -dnl Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2019 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. @@ -33,7 +33,7 @@ AC_DEFUN([gl_FP_IEEE], alpha*) # On Alpha systems, a compiler option provides the behaviour. # See the ieee(3) manual page, also available at - # <http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/0600____.HTM> + # <https://backdrift.org/man/tru64/man3/ieee.3.html> if test -n "$GCC"; then # GCC has the option -mieee. # For full IEEE compliance (rarely needed), use option -mieee-with-inexact. diff --git a/gnulib/import/m4/frexp.m4 b/gnulib/import/m4/frexp.m4 index 23f5821..990fce6 100644 --- a/gnulib/import/m4/frexp.m4 +++ b/gnulib/import/m4/frexp.m4 @@ -1,5 +1,5 @@ -# frexp.m4 serial 15 -dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +# frexp.m4 serial 16 +dnl Copyright (C) 2007-2019 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. @@ -164,8 +164,17 @@ int main() [gl_cv_func_frexp_works=yes], [gl_cv_func_frexp_works=no], [case "$host_os" in - netbsd* | irix* | mingw*) gl_cv_func_frexp_works="guessing no";; - *) gl_cv_func_frexp_works="guessing yes";; + netbsd* | irix*) gl_cv_func_frexp_works="guessing no" ;; + mingw*) # Guess yes with MSVC, no with mingw. + AC_EGREP_CPP([Good], [ +#ifdef _MSC_VER + Good +#endif + ], + [gl_cv_func_frexp_works="guessing yes"], + [gl_cv_func_frexp_works="guessing no"]) + ;; + *) gl_cv_func_frexp_works="guessing yes" ;; esac ]) ]) diff --git a/gnulib/import/m4/frexpl.m4 b/gnulib/import/m4/frexpl.m4 index 0bc6afe..53eed55 100644 --- a/gnulib/import/m4/frexpl.m4 +++ b/gnulib/import/m4/frexpl.m4 @@ -1,5 +1,5 @@ -# frexpl.m4 serial 20 -dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +# frexpl.m4 serial 21 +dnl Copyright (C) 2007-2019 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. @@ -131,7 +131,7 @@ AC_DEFUN([gl_FUNC_FREXPL_WORKS], # undef LDBL_MIN_EXP # define LDBL_MIN_EXP (-16381) #endif -#if defined __i386__ && defined __FreeBSD__ +#if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__) # undef LDBL_MIN_EXP # define LDBL_MIN_EXP (-16381) #endif diff --git a/gnulib/import/m4/fstat.m4 b/gnulib/import/m4/fstat.m4 index 29f9b81..2a59c8f 100644 --- a/gnulib/import/m4/fstat.m4 +++ b/gnulib/import/m4/fstat.m4 @@ -1,22 +1,22 @@ -# fstat.m4 serial 4 -dnl Copyright (C) 2011-2016 Free Software Foundation, Inc. +# fstat.m4 serial 6 +dnl Copyright (C) 2011-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FSTAT], [ + AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) - AC_REQUIRE([gl_MSVC_INVAL]) - if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then - REPLACE_FSTAT=1 - fi - - AC_REQUIRE([gl_HEADER_SYS_STAT_H]) - if test $WINDOWS_64_BIT_ST_SIZE = 1; then - REPLACE_FSTAT=1 - fi + case "$host_os" in + mingw* | solaris*) + dnl On MinGW, the original stat() returns st_atime, st_mtime, + dnl st_ctime values that are affected by the time zone. + dnl Solaris stat can return a negative tv_nsec. + REPLACE_FSTAT=1 + ;; + esac dnl Replace fstat() for supporting the gnulib-defined open() on directories. m4_ifdef([gl_FUNC_FCHDIR], [ @@ -32,5 +32,8 @@ AC_DEFUN([gl_FUNC_FSTAT], ]) ]) -# Prerequisites of lib/fstat.c. -AC_DEFUN([gl_PREREQ_FSTAT], [:]) +# Prerequisites of lib/fstat.c and lib/stat-w32.c. +AC_DEFUN([gl_PREREQ_FSTAT], [ + AC_REQUIRE([gl_HEADER_SYS_STAT_H]) + : +]) diff --git a/gnulib/import/m4/fstatat.m4 b/gnulib/import/m4/fstatat.m4 index 84177f0..489a55a 100644 --- a/gnulib/import/m4/fstatat.m4 +++ b/gnulib/import/m4/fstatat.m4 @@ -1,5 +1,5 @@ -# fstatat.m4 serial 3 -dnl Copyright (C) 2004-2016 Free Software Foundation, Inc. +# fstatat.m4 serial 4 +dnl Copyright (C) 2004-2019 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. @@ -13,14 +13,14 @@ AC_DEFUN([gl_FUNC_FSTATAT], AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS_ONCE([fstatat]) if test $ac_cv_func_fstatat = no; then HAVE_FSTATAT=0 else dnl Test for an AIX 7.1 bug; see - dnl <http://lists.gnu.org/archive/html/bug-tar/2011-09/msg00015.html>. + dnl <https://lists.gnu.org/r/bug-tar/2011-09/msg00015.html>. AC_CACHE_CHECK([whether fstatat (..., 0) works], [gl_cv_func_fstatat_zero_flag], [AC_RUN_IFELSE( @@ -46,15 +46,20 @@ AC_DEFUN([gl_FUNC_FSTATAT], case $gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in *yes+*yes) ;; - *) REPLACE_FSTATAT=1 - case $gl_cv_func_fstatat_zero_flag in - *yes) + *) REPLACE_FSTATAT=1 ;; + esac + + case $host_os in + solaris*) + REPLACE_FSTATAT=1 ;; + esac + + case $REPLACE_FSTATAT,$gl_cv_func_fstatat_zero_flag in + 1,*yes) AC_DEFINE([HAVE_WORKING_FSTATAT_ZERO_FLAG], [1], [Define to 1 if fstatat (..., 0) works. For example, it does not work in AIX 7.1.]) ;; - esac - ;; esac fi ]) diff --git a/gnulib/import/m4/getcwd-abort-bug.m4 b/gnulib/import/m4/getcwd-abort-bug.m4 index b73f474..7227f08 100644 --- a/gnulib/import/m4/getcwd-abort-bug.m4 +++ b/gnulib/import/m4/getcwd-abort-bug.m4 @@ -1,9 +1,9 @@ -# serial 7 +# serial 11 # Determine whether getcwd aborts when the length of the working directory # name is unusually large. Any length between 4k and 16k trigger the bug # when using glibc-2.4.90-9 or older. -# Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2006, 2009-2019 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. @@ -13,12 +13,19 @@ # gl_FUNC_GETCWD_ABORT_BUG([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) AC_DEFUN([gl_FUNC_GETCWD_ABORT_BUG], [ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_DECLS_ONCE([getcwd]) AC_CHECK_HEADERS_ONCE([unistd.h]) AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ]) - AC_CHECK_FUNCS([getpagesize]) + + gl_CHECK_FUNC_GETPAGESIZE + if test $gl_cv_func_getpagesize = yes; then + AC_DEFINE_UNQUOTED([HAVE_GETPAGESIZE], [1], + [Define to 1 if the system has the 'getpagesize' function.]) + fi + AC_CACHE_CHECK([whether getcwd aborts when 4k < cwd_length < 16k], - gl_cv_func_getcwd_abort_bug, + [gl_cv_func_getcwd_abort_bug], [# Remove any remnants of a previous test. rm -rf confdir-14B--- # Arrange for deletion of the temporary directory this test creates. @@ -121,20 +128,34 @@ main () return fail; } ]])], - [gl_cv_func_getcwd_abort_bug=no], - [dnl An abort will provoke an exit code of something like 134 (128 + 6). - dnl An exit code of 4 can also occur (in OpenBSD 4.9, NetBSD 5.1 for - dnl example): getcwd (NULL, 0) fails rather than returning a string - dnl longer than PATH_MAX. This may be POSIX compliant (in some - dnl interpretations of POSIX). But gnulib's getcwd module wants to - dnl provide a non-NULL value in this case. - ret=$? - if test $ret -ge 128 || test $ret = 4; then - gl_cv_func_getcwd_abort_bug=yes - else - gl_cv_func_getcwd_abort_bug=no - fi], - [gl_cv_func_getcwd_abort_bug=yes]) - ]) - AS_IF([test $gl_cv_func_getcwd_abort_bug = yes], [$1], [$2]) + [gl_cv_func_getcwd_abort_bug=no], + [dnl An abort will provoke an exit code of something like 134 (128 + 6). + dnl An exit code of 4 can also occur (in OpenBSD 4.9, NetBSD 5.1 for + dnl example): getcwd (NULL, 0) fails rather than returning a string + dnl longer than PATH_MAX. This may be POSIX compliant (in some + dnl interpretations of POSIX). But gnulib's getcwd module wants to + dnl provide a non-NULL value in this case. + ret=$? + if test $ret -ge 128 || test $ret = 4; then + gl_cv_func_getcwd_abort_bug=yes + else + gl_cv_func_getcwd_abort_bug=no + fi + ], + [case "$host_os" in + # Guess no on musl systems. + *-musl*) gl_cv_func_getcwd_abort_bug="guessing no" ;; + # Guess yes otherwise, even on glibc systems. + *) gl_cv_func_getcwd_abort_bug="guessing yes" + esac + ]) + ]) + case "$gl_cv_func_getcwd_abort_bug" in + *yes) + $1 + ;; + *) + $2 + ;; + esac ]) diff --git a/gnulib/import/m4/getcwd-path-max.m4 b/gnulib/import/m4/getcwd-path-max.m4 index 90bbc77..95a55be 100644 --- a/gnulib/import/m4/getcwd-path-max.m4 +++ b/gnulib/import/m4/getcwd-path-max.m4 @@ -1,4 +1,4 @@ -# serial 19 +# serial 23 # Check for several getcwd bugs with long file names. # If so, arrange to compile the wrapper function. @@ -6,7 +6,7 @@ # I've heard that this is due to a Linux kernel bug, and that it has # been fixed between 2.4.21-pre3 and 2.4.21-pre4. -# Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2003-2007, 2009-2019 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. @@ -21,7 +21,7 @@ AC_DEFUN([gl_FUNC_GETCWD_PATH_MAX], AC_CHECK_HEADERS_ONCE([unistd.h]) AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ]) AC_CACHE_CHECK([whether getcwd handles long file names properly], - gl_cv_func_getcwd_path_max, + [gl_cv_func_getcwd_path_max], [# Arrange for deletion of the temporary directory this test creates. ac_clean_files="$ac_clean_files confdir3" dnl Please keep this in sync with tests/test-getcwd.c. @@ -111,12 +111,20 @@ main () /* If mkdir or chdir fails, it could be that this system cannot create any file with an absolute name longer than PATH_MAX, such as cygwin. If so, leave fail as 0, because the current working directory can't - be too long for getcwd if it can't even be created. For other - errors, be pessimistic and consider that as a failure, too. */ + be too long for getcwd if it can't even be created. On Linux with + the 9p file system, mkdir fails with error EINVAL when cwd_len gets + too long; ignore this failure because the getcwd() system call + produces good results whereas the gnulib substitute calls getdents64 + which fails with error EPROTO. + For other errors, be pessimistic and consider that as a failure, + too. */ if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0) { if (! (errno == ERANGE || is_ENAMETOOLONG (errno))) - fail = 20; + #ifdef __linux__ + if (! (errno == EINVAL)) + #endif + fail = 20; break; } @@ -202,28 +210,28 @@ main () #endif } ]])], - [gl_cv_func_getcwd_path_max=yes], - [case $? in - 10|11|12) gl_cv_func_getcwd_path_max='no, but it is partly working';; - 31) gl_cv_func_getcwd_path_max='no, it has the AIX bug';; - 32) gl_cv_func_getcwd_path_max='yes, but with shorter paths';; - *) gl_cv_func_getcwd_path_max=no;; - esac], - [# Cross-compilation guesses: - case "$host_os" in - aix*) # On AIX, it has the AIX bug. - gl_cv_func_getcwd_path_max='no, it has the AIX bug' ;; - gnu*) # On Hurd, it is 'yes'. - gl_cv_func_getcwd_path_max=yes ;; - linux* | kfreebsd*) - # On older Linux+glibc it's 'no, but it is partly working', - # on newer Linux+glibc it's 'yes'. - # On Linux+musl libc, it's 'no, but it is partly working'. - # On kFreeBSD+glibc, it's 'no, but it is partly working'. - gl_cv_func_getcwd_path_max='no, but it is partly working' ;; - *) # If we don't know, assume the worst. - gl_cv_func_getcwd_path_max=no ;; - esac + [gl_cv_func_getcwd_path_max=yes], + [case $? in + 10|11|12) gl_cv_func_getcwd_path_max='no, but it is partly working';; + 31) gl_cv_func_getcwd_path_max='no, it has the AIX bug';; + 32) gl_cv_func_getcwd_path_max='yes, but with shorter paths';; + *) gl_cv_func_getcwd_path_max=no;; + esac], + [# Cross-compilation guesses: + case "$host_os" in + aix*) # On AIX, it has the AIX bug. + gl_cv_func_getcwd_path_max='guessing no, it has the AIX bug' ;; + gnu*) # On Hurd, it is 'yes'. + gl_cv_func_getcwd_path_max='guessing yes' ;; + linux* | kfreebsd*) + # On older Linux+glibc it's 'no, but it is partly working', + # on newer Linux+glibc it's 'yes'. + # On Linux+musl libc, it's 'no, but it is partly working'. + # On kFreeBSD+glibc, it's 'no, but it is partly working'. + gl_cv_func_getcwd_path_max='guessing no, but it is partly working' ;; + *) # If we don't know, obey --enable-cross-guesses. + gl_cv_func_getcwd_path_max="$gl_cross_guess_normal" ;; + esac + ]) ]) - ]) ]) diff --git a/gnulib/import/m4/getcwd.m4 b/gnulib/import/m4/getcwd.m4 index 566c3c1..3b3f755 100644 --- a/gnulib/import/m4/getcwd.m4 +++ b/gnulib/import/m4/getcwd.m4 @@ -1,12 +1,12 @@ # getcwd.m4 - check for working getcwd that is compatible with glibc -# Copyright (C) 2001, 2003-2007, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003-2007, 2009-2019 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert. -# serial 13 +# serial 18 AC_DEFUN([gl_FUNC_GETCWD_NULL], [ @@ -25,7 +25,7 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL], char *getcwd (); # endif ]], [[ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ /* mingw cwd does not start with '/', but getcwd does allocate. However, mingw fails to honor non-zero size. */ #else @@ -37,9 +37,9 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL], if (! f) return 2; if (f[0] != '/') - return 3; + { free (f); return 3; } if (f[1] != '\0') - return 4; + { free (f); return 4; } free (f); return 0; } @@ -48,12 +48,14 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL], [gl_cv_func_getcwd_null=yes], [gl_cv_func_getcwd_null=no], [[case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_getcwd_null="guessing yes";; - # Guess yes on Cygwin. - cygwin*) gl_cv_func_getcwd_null="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_getcwd_null="guessing no";; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_getcwd_null="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_getcwd_null="guessing yes";; + # Guess yes on Cygwin. + cygwin*) gl_cv_func_getcwd_null="guessing yes";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_getcwd_null="$gl_cross_guess_normal";; esac ]])]) ]) @@ -125,7 +127,7 @@ AC_DEFUN([gl_FUNC_GETCWD], dnl Define HAVE_MINIMALLY_WORKING_GETCWD and HAVE_PARTLY_WORKING_GETCWD dnl if appropriate. case "$gl_cv_func_getcwd_path_max" in - "no"|"no, it has the AIX bug") ;; + *"no" | *"no, it has the AIX bug") ;; *) AC_DEFINE([HAVE_MINIMALLY_WORKING_GETCWD], [1], [Define to 1 if getcwd minimally works, that is, its result can be @@ -133,12 +135,12 @@ AC_DEFUN([gl_FUNC_GETCWD], ;; esac case "$gl_cv_func_getcwd_path_max" in - "no, but it is partly working") + *"no, but it is partly working") AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], [1], [Define to 1 if getcwd works, except it sometimes fails when it shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.]) ;; - "yes, but with shorter paths") + *"yes, but with shorter paths") AC_DEFINE([HAVE_GETCWD_SHORTER], [1], [Define to 1 if getcwd works, but with shorter paths than is generally tested with the replacement.]) diff --git a/gnulib/import/m4/getdtablesize.m4 b/gnulib/import/m4/getdtablesize.m4 index 1bf4db0..96aa241 100644 --- a/gnulib/import/m4/getdtablesize.m4 +++ b/gnulib/import/m4/getdtablesize.m4 @@ -1,5 +1,5 @@ -# getdtablesize.m4 serial 6 -dnl Copyright (C) 2008-2016 Free Software Foundation, Inc. +# getdtablesize.m4 serial 7 +dnl Copyright (C) 2008-2019 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. @@ -12,29 +12,43 @@ AC_DEFUN([gl_FUNC_GETDTABLESIZE], AC_CHECK_DECLS_ONCE([getdtablesize]) if test $ac_cv_func_getdtablesize = yes && test $ac_cv_have_decl_getdtablesize = yes; then - # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit - # up to an unchangeable hard limit; all other platforms correctly - # require setrlimit before getdtablesize() can report a larger value. AC_CACHE_CHECK([whether getdtablesize works], [gl_cv_func_getdtablesize_works], - [AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[#include <unistd.h>]], - [int size = getdtablesize(); - if (dup2 (0, getdtablesize()) != -1) - return 1; - if (size != getdtablesize()) - return 2; - ])], - [gl_cv_func_getdtablesize_works=yes], - [gl_cv_func_getdtablesize_works=no], - [case "$host_os" in - cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows - gl_cv_func_getdtablesize_works="guessing no" ;; - *) gl_cv_func_getdtablesize_works="guessing yes" ;; - esac]) + [dnl There are two concepts: the "maximum possible file descriptor value + 1" + dnl and the "maximum number of open file descriptors in a process". + dnl Per SUSv2 and POSIX, getdtablesize() should return the first one. + dnl On most platforms, the first and the second concept are the same. + dnl On OpenVMS, however, they are different and getdtablesize() returns + dnl the second one; thus the test below fails. But we don't care + dnl because there's no good way to write a replacement getdtablesize(). + case "$host_os" in + vms*) gl_cv_func_getdtablesize_works="no (limitation)" ;; + *) + dnl Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft + dnl limit up to an unchangeable hard limit; all other platforms + dnl correctly require setrlimit before getdtablesize() can report + dnl a larger value. + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[#include <unistd.h>]], + [int size = getdtablesize(); + if (dup2 (0, getdtablesize()) != -1) + return 1; + if (size != getdtablesize()) + return 2; + ])], + [gl_cv_func_getdtablesize_works=yes], + [gl_cv_func_getdtablesize_works=no], + [case "$host_os" in + cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows + gl_cv_func_getdtablesize_works="guessing no" ;; + *) gl_cv_func_getdtablesize_works="guessing yes" ;; + esac + ]) + ;; + esac ]) case "$gl_cv_func_getdtablesize_works" in - *yes) ;; + *yes | "no (limitation)") ;; *) REPLACE_GETDTABLESIZE=1 ;; esac else diff --git a/gnulib/import/m4/getlogin.m4 b/gnulib/import/m4/getlogin.m4 new file mode 100644 index 0000000..c13d2e0 --- /dev/null +++ b/gnulib/import/m4/getlogin.m4 @@ -0,0 +1,32 @@ +# getlogin.m4 serial 5 +dnl Copyright (C) 2010-2019 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_GETLOGIN], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_CHECK_DECLS_ONCE([getlogin]) + if test $ac_cv_have_decl_getlogin = no; then + HAVE_DECL_GETLOGIN=0 + fi + AC_CHECK_FUNCS_ONCE([getlogin]) + if test $ac_cv_func_getlogin = no; then + HAVE_GETLOGIN=0 + fi +]) + +dnl Determines the library needed by the implementation of the +dnl getlogin and getlogin_r functions. +AC_DEFUN([gl_LIB_GETLOGIN], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case $host_os in + mingw*) + LIB_GETLOGIN='-ladvapi32' ;; + *) + LIB_GETLOGIN= ;; + esac + AC_SUBST([LIB_GETLOGIN]) +]) diff --git a/gnulib/import/m4/getlogin_r.m4 b/gnulib/import/m4/getlogin_r.m4 index 80f82f4..aff7086 100644 --- a/gnulib/import/m4/getlogin_r.m4 +++ b/gnulib/import/m4/getlogin_r.m4 @@ -1,6 +1,6 @@ -#serial 11 +#serial 12 -# Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2005-2007, 2009-2019 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -30,8 +30,8 @@ AC_DEFUN([gl_FUNC_GETLOGIN_R], HAVE_GETLOGIN_R=0 else HAVE_GETLOGIN_R=1 - dnl On OSF/1 5.1, getlogin_r returns a truncated result if the buffer is - dnl not large enough. + dnl On Mac OS X 10.12 and OSF/1 5.1, getlogin_r returns a truncated result + dnl if the buffer is not large enough. AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether getlogin_r works with small buffers], [gl_cv_func_getlogin_r_works], @@ -39,15 +39,16 @@ AC_DEFUN([gl_FUNC_GETLOGIN_R], dnl Initial guess, used when cross-compiling. changequote(,)dnl case "$host_os" in - # Guess no on OSF/1. - osf*) gl_cv_func_getlogin_r_works="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_getlogin_r_works="guessing yes" ;; + # Guess no on Mac OS X, OSF/1. + darwin* | osf*) gl_cv_func_getlogin_r_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_getlogin_r_works="guessing yes" ;; esac changequote([,])dnl AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stddef.h> +#include <string.h> #include <unistd.h> #if !HAVE_DECL_GETLOGIN_R extern @@ -63,16 +64,19 @@ main (void) char buf[100]; if (getlogin_r (buf, 0) == 0) - result |= 16; + result |= 1; if (getlogin_r (buf, 1) == 0) - result |= 17; + result |= 2; + if (getlogin_r (buf, 100) == 0) + { + size_t n = strlen (buf); + if (getlogin_r (buf, n) == 0) + result |= 4; + } return result; }]])], [gl_cv_func_getlogin_r_works=yes], - [case $? in - 16 | 17) gl_cv_func_getlogin_r_works=no ;; - esac - ], + [gl_cv_func_getlogin_r_works=no], [:]) ]) case "$gl_cv_func_getlogin_r_works" in diff --git a/gnulib/import/m4/getpagesize.m4 b/gnulib/import/m4/getpagesize.m4 new file mode 100644 index 0000000..546c3ad --- /dev/null +++ b/gnulib/import/m4/getpagesize.m4 @@ -0,0 +1,49 @@ +# getpagesize.m4 serial 10 +dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2019 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_GETPAGESIZE], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + gl_CHECK_FUNC_GETPAGESIZE + if test $gl_cv_func_getpagesize = no; then + HAVE_GETPAGESIZE=0 + AC_CHECK_HEADERS([OS.h]) + if test $ac_cv_header_OS_h = yes; then + HAVE_OS_H=1 + fi + AC_CHECK_HEADERS([sys/param.h]) + if test $ac_cv_header_sys_param_h = yes; then + HAVE_SYS_PARAM_H=1 + fi + fi + case "$host_os" in + mingw*) + REPLACE_GETPAGESIZE=1 + ;; + esac + dnl Also check whether it's declared. + dnl mingw has getpagesize() in libgcc.a but doesn't declare it. + AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0]) +]) + +dnl Tests whether the function getpagesize() exists. +dnl Sets gl_cv_func_getpagesize. +AC_DEFUN([gl_CHECK_FUNC_GETPAGESIZE], +[ + dnl We can't use AC_CHECK_FUNC here, because getpagesize() is defined as a + dnl static inline function when compiling for Android 4.4 or older. + AC_CACHE_CHECK([for getpagesize], [gl_cv_func_getpagesize], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <unistd.h>]], + [[return getpagesize();]]) + ], + [gl_cv_func_getpagesize=yes], + [gl_cv_func_getpagesize=no]) + ]) +]) diff --git a/gnulib/import/m4/getprogname.m4 b/gnulib/import/m4/getprogname.m4 index f027037..4a96d06 100644 --- a/gnulib/import/m4/getprogname.m4 +++ b/gnulib/import/m4/getprogname.m4 @@ -1,6 +1,6 @@ # getprogname.m4 - check for getprogname or replacements for it -# Copyright (C) 2016 Free Software Foundation, Inc. +# Copyright (C) 2016-2019 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. diff --git a/gnulib/import/m4/gettimeofday.m4 b/gnulib/import/m4/gettimeofday.m4 index 4ae5d63..7eebabd 100644 --- a/gnulib/import/m4/gettimeofday.m4 +++ b/gnulib/import/m4/gettimeofday.m4 @@ -1,6 +1,6 @@ -# serial 21 +# serial 27 -# Copyright (C) 2001-2003, 2005, 2007, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2001-2003, 2005, 2007, 2009-2019 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. @@ -9,9 +9,10 @@ dnl From Jim Meyering. AC_DEFUN([gl_FUNC_GETTIMEOFDAY], [ + AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_HEADER_SYS_TIME_H]) - AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([gettimeofday]) gl_gettimeofday_timezone=void @@ -54,19 +55,11 @@ int gettimeofday (struct timeval *restrict, struct timezone *restrict); if test $REPLACE_STRUCT_TIMEVAL = 1; then REPLACE_GETTIMEOFDAY=1 fi - m4_ifdef([gl_FUNC_TZSET_CLOBBER], [ - gl_FUNC_TZSET_CLOBBER - case "$gl_cv_func_tzset_clobber" in - *yes) - REPLACE_GETTIMEOFDAY=1 - gl_GETTIMEOFDAY_REPLACE_LOCALTIME - AC_DEFINE([tzset], [rpl_tzset], - [Define to rpl_tzset if the wrapper function should be used.]) - AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1], - [Define if tzset clobbers localtime's static buffer.]) - ;; - esac - ]) + dnl On mingw, the original gettimeofday has only a precision of 15.6 + dnl milliseconds. So override it. + case "$host_os" in + mingw*) REPLACE_GETTIMEOFDAY=1 ;; + esac fi AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone], [Define this to 'void' or 'struct timezone' to match the system's @@ -85,6 +78,7 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER], [ AC_REQUIRE([gl_HEADER_SYS_TIME_H]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([gl_LOCALTIME_BUFFER_DEFAULTS]) AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer], [gl_cv_func_gettimeofday_clobber], @@ -109,30 +103,26 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER], [gl_cv_func_gettimeofday_clobber=yes], [# When cross-compiling: case "$host_os" in - # Guess all is fine on glibc systems. - *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # If we don't know, assume the worst. - *) gl_cv_func_gettimeofday_clobber="guessing yes" ;; + # Guess all is fine on glibc systems. + *-gnu* | gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;; + # Guess all is fine on musl systems. + *-musl*) gl_cv_func_gettimeofday_clobber="guessing no" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_gettimeofday_clobber="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_gettimeofday_clobber="$gl_cross_guess_inverted" ;; esac ])]) case "$gl_cv_func_gettimeofday_clobber" in *yes) REPLACE_GETTIMEOFDAY=1 - gl_GETTIMEOFDAY_REPLACE_LOCALTIME AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], [1], [Define if gettimeofday clobbers the localtime buffer.]) + gl_LOCALTIME_BUFFER_NEEDED ;; esac ]) -AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [ - REPLACE_GMTIME=1 - REPLACE_LOCALTIME=1 -]) - # Prerequisites of lib/gettimeofday.c. -AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [ - AC_CHECK_HEADERS([sys/timeb.h]) - AC_CHECK_FUNCS([_ftime]) -]) +AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [:]) diff --git a/gnulib/import/m4/glibc21.m4 b/gnulib/import/m4/glibc21.m4 deleted file mode 100644 index dafebf5..0000000 --- a/gnulib/import/m4/glibc21.m4 +++ /dev/null @@ -1,34 +0,0 @@ -# glibc21.m4 serial 5 -dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2016 Free Software Foundation, -dnl 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. - -# Test for the GNU C Library, version 2.1 or newer, or uClibc. -# From Bruno Haible. - -AC_DEFUN([gl_GLIBC21], - [ - AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc], - [ac_cv_gnu_library_2_1], - [AC_EGREP_CPP([Lucky], - [ -#include <features.h> -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) - Lucky GNU user - #endif -#endif -#ifdef __UCLIBC__ - Lucky user -#endif - ], - [ac_cv_gnu_library_2_1=yes], - [ac_cv_gnu_library_2_1=no]) - ] - ) - AC_SUBST([GLIBC21]) - GLIBC21="$ac_cv_gnu_library_2_1" - ] -) diff --git a/gnulib/import/m4/glob.m4 b/gnulib/import/m4/glob.m4 index adf5fe2..543722c 100644 --- a/gnulib/import/m4/glob.m4 +++ b/gnulib/import/m4/glob.m4 @@ -1,5 +1,5 @@ -# glob.m4 serial 14 -dnl Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc. +# glob.m4 serial 23 +dnl Copyright (C) 2005-2007, 2009-2019 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. @@ -9,68 +9,81 @@ dnl with or without modifications, as long as this notice is preserved. # always include <glob.h> for the glob prototypes. AC_DEFUN([gl_GLOB], -[ GLOB_H= - AC_CHECK_HEADERS([glob.h], [], [GLOB_H=glob.h]) +[ + AC_REQUIRE([gl_GLOB_H]) + + AC_CHECK_FUNCS_ONCE([glob glob_pattern_p]) + if test $ac_cv_func_glob = no; then + HAVE_GLOB=0 + else - if test -z "$GLOB_H"; then - AC_CACHE_CHECK([for GNU glob interface version 1], - [gl_cv_gnu_glob_interface_version_1], + AC_CACHE_CHECK([for GNU glob interface version 1 or 2], + [gl_cv_gnu_glob_interface_version_1_2], [ AC_COMPILE_IFELSE([AC_LANG_SOURCE( [[#include <gnu-versions.h> -char a[_GNU_GLOB_INTERFACE_VERSION == 1 ? 1 : -1];]])], - [gl_cv_gnu_glob_interface_version_1=yes], - [gl_cv_gnu_glob_interface_version_1=no])]) - - if test "$gl_cv_gnu_glob_interface_version_1" = "no"; then - GLOB_H=glob.h +char a[_GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2 ? 1 : -1];]])], + [gl_cv_gnu_glob_interface_version_1_2=yes], + [gl_cv_gnu_glob_interface_version_1_2=no])]) + if test "$gl_cv_gnu_glob_interface_version_1_2" = "no"; then + REPLACE_GLOB=1 fi - fi - if test -z "$GLOB_H"; then - AC_CACHE_CHECK([whether glob lists broken symlinks], - [gl_cv_glob_lists_symlinks], -[ if ln -s conf-doesntexist conf$$-globtest 2>/dev/null; then - gl_cv_glob_lists_symlinks=maybe - else - # If we can't make a symlink, then we cannot test this issue. Be - # pessimistic about this. - gl_cv_glob_lists_symlinks=no - fi + if test $REPLACE_GLOB = 0; then + AC_CACHE_CHECK([whether glob lists broken symlinks], + [gl_cv_glob_lists_symlinks], + [if test $cross_compiling != yes; then + if ln -s conf-doesntexist conf$$-globtest 2>/dev/null; then + gl_cv_glob_lists_symlinks=maybe + else + # If we can't make a symlink, then we cannot test this issue. Be + # pessimistic about this. + gl_cv_glob_lists_symlinks=no + fi + if test $gl_cv_glob_lists_symlinks = maybe; then + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stddef.h> + #include <glob.h>]], + [[glob_t found; + if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH) + return 1; + ]])], + [gl_cv_glob_lists_symlinks=yes], + [gl_cv_glob_lists_symlinks=no], + [dnl We don't get here. + : + ]) + fi + rm -f conf$$-globtest + else + gl_cv_glob_lists_symlinks="$gl_cross_guess_normal" + fi + ]) + case "$gl_cv_glob_lists_symlinks" in + *yes) ;; + *) REPLACE_GLOB=1 ;; + esac + fi - if test $gl_cv_glob_lists_symlinks = maybe; then - AC_RUN_IFELSE([ -AC_LANG_PROGRAM( -[[#include <stddef.h> -#include <glob.h>]], -[[glob_t found; -if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH) return 1;]])], - [gl_cv_glob_lists_symlinks=yes], - [gl_cv_glob_lists_symlinks=no], [gl_cv_glob_lists_symlinks=no]) - fi]) + fi - if test $gl_cv_glob_lists_symlinks = no; then - GLOB_H=glob.h + if test $ac_cv_func_glob_pattern_p = no; then + HAVE_GLOB_PATTERN_P=0 + else + if test $REPLACE_GLOB = 1; then + REPLACE_GLOB_PATTERN_P=1 fi fi - rm -f conf$$-globtest - - AC_SUBST([GLOB_H]) - AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"]) + if test $HAVE_GLOB = 0 || test $REPLACE_GLOB = 1; then + gl_REPLACE_GLOB_H + fi ]) -# Prerequisites of lib/glob.*. +# Prerequisites of lib/glob.c and lib/globfree.c. AC_DEFUN([gl_PREREQ_GLOB], [ - AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])dnl - AC_REQUIRE([AC_C_RESTRICT])dnl - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])dnl - AC_CHECK_HEADERS_ONCE([sys/cdefs.h unistd.h])dnl - if test $ac_cv_header_sys_cdefs_h = yes; then - HAVE_SYS_CDEFS_H=1 - else - HAVE_SYS_CDEFS_H=0 - fi - AC_SUBST([HAVE_SYS_CDEFS_H]) - AC_CHECK_FUNCS_ONCE([fstatat getlogin_r getpwnam_r])dnl + AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE]) + AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_CHECK_FUNCS_ONCE([getlogin_r getpwnam_r]) ]) diff --git a/gnulib/import/m4/glob_h.m4 b/gnulib/import/m4/glob_h.m4 new file mode 100644 index 0000000..9cc29d0 --- /dev/null +++ b/gnulib/import/m4/glob_h.m4 @@ -0,0 +1,72 @@ +# glob_h.m4 serial 5 +dnl Copyright (C) 2018-2019 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 Bruno Haible. + +AC_DEFUN_ONCE([gl_GLOB_H], +[ + AC_REQUIRE([gl_GLOB_H_DEFAULTS]) + m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])]) + AC_REQUIRE([AC_C_RESTRICT]) + AC_CHECK_HEADERS_ONCE([glob.h]) + gl_CHECK_NEXT_HEADERS([glob.h]) + + if test $ac_cv_header_glob_h = yes; then + HAVE_GLOB_H=1 + else + HAVE_GLOB_H=0 + fi + AC_SUBST([HAVE_GLOB_H]) + + m4_ifdef([gl_POSIXCHECK], + [GLOB_H=glob.h], + [GLOB_H='' + if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then + dnl Override <glob.h> always, to support the C++ GNULIB_NAMESPACE. + GLOB_H=glob.h + else + if test $ac_cv_header_glob_h != yes; then + dnl Provide a substitute <glob.h> file. + GLOB_H=glob.h + fi + fi + ]) + AC_SUBST([GLOB_H]) + AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <glob.h> + ]], + [glob globfree glob_pattern_p]) +]) + +dnl Unconditionally enables the replacement of <glob.h>. +AC_DEFUN([gl_REPLACE_GLOB_H], +[ + AC_REQUIRE([gl_GLOB_H_DEFAULTS]) + GLOB_H='glob.h' + AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"]) +]) + +AC_DEFUN([gl_GLOB_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_GLOB_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_GLOB_H_DEFAULTS], +[ + GNULIB_GLOB=0; AC_SUBST([GNULIB_GLOB]) + dnl Assume POSIX and GNU behavior unless another module says otherwise. + HAVE_GLOB=1; AC_SUBST([HAVE_GLOB]) + HAVE_GLOB_PATTERN_P=1; AC_SUBST([HAVE_GLOB_PATTERN_P]) + REPLACE_GLOB=0; AC_SUBST([REPLACE_GLOB]) + REPLACE_GLOB_PATTERN_P=0; AC_SUBST([REPLACE_GLOB_PATTERN_P]) +]) diff --git a/gnulib/import/m4/gnulib-cache.m4 b/gnulib/import/m4/gnulib-cache.m4 index 80e080a..428f5c9 100644 --- a/gnulib/import/m4/gnulib-cache.m4 +++ b/gnulib/import/m4/gnulib-cache.m4 @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2016 Free Software Foundation, Inc. +# Copyright (C) 2002-2019 Free Software Foundation, Inc. # # 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 @@ -11,7 +11,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this file. If not, see <http://www.gnu.org/licenses/>. +# along with this file. If not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, # this file may be distributed as part of a program that @@ -27,7 +27,52 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca canonicalize-lgpl dirent dirfd errno fnmatch-gnu frexpl getcwd glob inet_ntop inttypes limits-h lstat memchr memmem mkdir mkdtemp mkostemp pathmax rawmemchr readlink rename setenv signal-h strchrnul strerror_r-posix strstr strtok_r sys_stat time_r unistd unsetenv update-copyright wchar wctype-h +# gnulib-tool --import \ +# --lib=libgnu \ +# --source-base=import \ +# --m4-base=import/m4 \ +# --doc-base=doc \ +# --tests-base=tests \ +# --aux-dir=import/extra \ +# --no-conditional-dependencies \ +# --no-libtool \ +# --macro-prefix=gl \ +# --no-vc-files \ +# alloca \ +# canonicalize-lgpl \ +# dirent \ +# dirfd \ +# errno \ +# fnmatch-gnu \ +# frexpl \ +# getcwd \ +# glob \ +# inet_ntop \ +# inttypes \ +# limits-h \ +# lstat \ +# memchr \ +# memmem \ +# mkdir \ +# mkdtemp \ +# mkostemp \ +# pathmax \ +# rawmemchr \ +# readlink \ +# rename \ +# setenv \ +# signal-h \ +# strchrnul \ +# strerror_r-posix \ +# strstr \ +# strtok_r \ +# sys_stat \ +# time_r \ +# unistd \ +# unsetenv \ +# update-copyright \ +# wchar \ +# wctype-h # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) diff --git a/gnulib/import/m4/gnulib-common.m4 b/gnulib/import/m4/gnulib-common.m4 index f8454c8..d8f0d3f 100644 --- a/gnulib/import/m4/gnulib-common.m4 +++ b/gnulib/import/m4/gnulib-common.m4 @@ -1,9 +1,11 @@ -# gnulib-common.m4 serial 36 -dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +# gnulib-common.m4 serial 46 +dnl Copyright (C) 2007-2019 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_PREREQ([2.62]) + # gl_COMMON # is expanded unconditionally through gnulib-tool magic. AC_DEFUN([gl_COMMON], [ @@ -14,12 +16,25 @@ AC_DEFUN([gl_COMMON], [ AC_DEFUN([gl_COMMON_BODY], [ AH_VERBATIM([_Noreturn], [/* The _Noreturn keyword of C11. */ -#if ! (defined _Noreturn \ - || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) -# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ - || 0x5110 <= __SUNPRO_C) +#ifndef _Noreturn +# if (defined __cplusplus \ + && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ + || (defined _MSC_VER && 1900 <= _MSC_VER)) \ + && 0) + /* [[noreturn]] is not practically usable, because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would only be valid with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. */ +# define _Noreturn [[noreturn]] +# elif ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ + || 4 < __GNUC__ + (7 <= __GNUC_MINOR__))) + /* _Noreturn works as-is. */ +# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C # define _Noreturn __attribute__ ((__noreturn__)) -# elif defined _MSC_VER && 1200 <= _MSC_VER +# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) # else # define _Noreturn @@ -72,7 +87,68 @@ 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 ]) + AH_VERBATIM([async_safe], +[/* The _GL_ASYNC_SAFE marker should be attached to functions that are + signal handlers (for signals other than SIGABRT, SIGPIPE) or can be + invoked from such signal handlers. Such functions have some restrictions: + * All functions that it calls should be marked _GL_ASYNC_SAFE as well, + or should be listed as async-signal-safe in POSIX + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04> + section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in + particular, are NOT async-signal-safe. + * All memory locations (variables and struct fields) that these functions + access must be marked 'volatile'. This holds for both read and write + accesses. Otherwise the compiler might optimize away stores to and + reads from such locations that occur in the program, depending on its + data flow analysis. For example, when the program contains a loop + that is intended to inspect a variable set from within a signal handler + while (!signal_occurred) + ; + the compiler is allowed to transform this into an endless loop if the + variable 'signal_occurred' is not declared 'volatile'. + Additionally, recall that: + * A signal handler should not modify errno (except if it is a handler + for a fatal signal and ends by raising the same signal again, thus + provoking the termination of the process). If it invokes a function + that may clobber errno, it needs to save and restore the value of + errno. */ +#define _GL_ASYNC_SAFE +]) + dnl Hint which direction to take regarding cross-compilation guesses: + dnl When a user installs a program on a platform they are not intimately + dnl familiar with, --enable-cross-guesses=conservative is the appropriate + dnl choice. It implements the "If we don't know, assume the worst" principle. + dnl However, when an operating system developer (on a platform which is not + dnl yet known to gnulib) builds packages for their platform, they want to + dnl expose, not hide, possible platform bugs; in this case, + dnl --enable-cross-guesses=risky is the appropriate choice. + dnl Sets the variables + dnl gl_cross_guess_normal (to be used when 'yes' is good and 'no' is bad), + dnl gl_cross_guess_inverted (to be used when 'no' is good and 'yes' is bad). + AC_ARG_ENABLE([cross-guesses], + [AS_HELP_STRING([--enable-cross-guesses={conservative|risky}], + [specify policy for cross-compilation guesses])], + [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then + AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses]) + enableval=conservative + fi + gl_cross_guesses="$enableval"], + [gl_cross_guesses=conservative]) + if test $gl_cross_guesses = risky; then + gl_cross_guess_normal="guessing yes" + gl_cross_guess_inverted="guessing no" + else + gl_cross_guess_normal="guessing no" + gl_cross_guess_inverted="guessing yes" + fi dnl Preparation for running test programs: dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not dnl to /dev/tty, so they can be redirected to log files. Such diagnostics @@ -207,13 +283,6 @@ AC_DEFUN([gl_FEATURES_H], AC_SUBST([HAVE_FEATURES_H]) ]) -# m4_foreach_w -# is a backport of autoconf-2.59c's m4_foreach_w. -# Remove this macro when we can assume autoconf >= 2.60. -m4_ifndef([m4_foreach_w], - [m4_define([m4_foreach_w], - [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) - # AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) # ---------------------------------------------------- # Backport of autoconf-2.63b's macro. @@ -226,15 +295,14 @@ m4_ifndef([AS_VAR_IF], # Modifies the value of the shell variable CC in an attempt to make $CC # understand ISO C99 source code. # This is like AC_PROG_CC_C99, except that -# - AC_PROG_CC_C99 did not exist in Autoconf versions < 2.60, # - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC -# <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00367.html>, +# <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00367.html>, # but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99 -# <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00441.html>. +# <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00441.html>. # Remaining problems: # - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options # to CC twice -# <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00431.html>. +# <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00431.html>. # - AC_PROG_CC_STDC is likely to change now that C11 is an ISO standard. AC_DEFUN([gl_PROG_CC_C99], [ @@ -256,7 +324,8 @@ AC_DEFUN([gl_PROG_AR_RANLIB], dnl library formats. In particular, the GNU binutils programs ar and ranlib dnl produce libraries that work only with gcc, not with cc. AC_REQUIRE([AC_PROG_CC]) - AC_BEFORE([$0], [AM_PROG_AR]) + dnl The '][' hides this use from 'aclocal'. + AC_BEFORE([$0], [A][M_PROG_AR]) AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler], [ AC_EGREP_CPP([Amsterdam], @@ -288,7 +357,9 @@ Amsterdam dnl __ACK__. It may seem like its easier to avoid calling the macro here, dnl but we need to AC_SUBST both AR/ARFLAGS (thus those must have some good dnl default value and automake should usually know them). - m4_ifdef([AM_PROG_AR], [AM_PROG_AR], [:]) + dnl + dnl The '][' hides this use from 'aclocal'. + m4_ifdef([A][M_PROG_AR], [A][M_PROG_AR], [:]) fi dnl In case the code above has not helped with setting AR/ARFLAGS, use @@ -312,25 +383,6 @@ Amsterdam AC_SUBST([RANLIB]) ]) -# AC_PROG_MKDIR_P -# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix -# for interoperability with automake-1.9.6 from autoconf-2.62. -# Remove this macro when we can assume autoconf >= 2.62 or -# autoconf >= 2.60 && automake >= 1.10. -# AC_AUTOCONF_VERSION was introduced in 2.62, so use that as the witness. -m4_ifndef([AC_AUTOCONF_VERSION],[ -m4_ifdef([AC_PROG_MKDIR_P], [ - dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed. - m4_define([AC_PROG_MKDIR_P], - m4_defn([AC_PROG_MKDIR_P])[ - AC_SUBST([MKDIR_P])])], [ - dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P. - AC_DEFUN_ONCE([AC_PROG_MKDIR_P], - [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake - MKDIR_P='$(mkdir_p)' - AC_SUBST([MKDIR_P])])]) -]) - # AC_C_RESTRICT # This definition is copied from post-2.69 Autoconf and overrides the # AC_C_RESTRICT macro from autoconf 2.60..2.69. It can be removed @@ -344,16 +396,16 @@ AC_DEFUN([AC_C_RESTRICT], for ac_kw in __restrict __restrict__ _Restrict restrict; do AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( - [[typedef int *int_ptr; - int foo (int_ptr $ac_kw ip) { return ip[0]; } - int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ - int bar (int ip[$ac_kw]) { return ip[0]; } - ]], - [[int s[1]; - int *$ac_kw t = s; - t[0] = 0; - return foo (t) + bar (t); - ]])], + [[typedef int *int_ptr; + int foo (int_ptr $ac_kw ip) { return ip[0]; } + int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ + int bar (int ip[$ac_kw]) { return ip[0]; } + ]], + [[int s[1]; + int *$ac_kw t = s; + t[0] = 0; + return foo (t) + bar (t); + ]])], [ac_cv_c_restrict=$ac_kw]) test "$ac_cv_c_restrict" != no && break done @@ -404,59 +456,3 @@ AC_DEFUN([gl_CACHE_VAL_SILENT], # AS_VAR_COPY was added in autoconf 2.63b m4_define_default([AS_VAR_COPY], [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])]) - -# AC_PROG_SED was added in autoconf 2.59b -m4_ifndef([AC_PROG_SED], -[AC_DEFUN([AC_PROG_SED], -[AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED, - [dnl ac_script should not contain more than 99 commands (for HP-UX sed), - dnl but more than about 7000 bytes, to catch a limit in Solaris 8 /usr/ucb/sed. - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - AS_UNSET([ac_script]) - if test -z "$SED"; then - ac_path_SED_found=false - _AS_PATH_WALK([], [ - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - AS_EXECUTABLE_P(["$ac_path_SED"]) || continue - case `"$ac_path_SED" --version 2>&1` in - *GNU*) ac_cv_path_SED=$ac_path_SED ac_path_SED_found=:;; - *) - ac_count=0 - _AS_ECHO_N([0123456789]) >conftest.in - while : - do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >> conftest.nl - "$ac_path_SED" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break - diff conftest.out conftest.nl >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best so far, but keep looking for better - ac_cv_path_SED=$ac_path_SED - ac_path_SED_max=$ac_count - fi - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; - esac - $ac_path_SED_found && break 3 - done - done]) - if test -z "$ac_cv_path_SED"; then - AC_ERROR([no acceptable sed could be found in \$PATH]) - fi - else - ac_cv_path_SED=$SED - fi - SED="$ac_cv_path_SED" - AC_SUBST([SED])dnl - rm -f conftest.sed -])])]) diff --git a/gnulib/import/m4/gnulib-comp.m4 b/gnulib/import/m4/gnulib-comp.m4 index 1a434d2..be1fd39 100644 --- a/gnulib/import/m4/gnulib-comp.m4 +++ b/gnulib/import/m4/gnulib-comp.m4 @@ -1,5 +1,5 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2016 Free Software Foundation, Inc. +# Copyright (C) 2002-2019 Free Software Foundation, Inc. # # 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 @@ -12,7 +12,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this file. If not, see <http://www.gnu.org/licenses/>. +# along with this file. If not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, # this file may be distributed as part of a program that @@ -49,13 +49,14 @@ AC_DEFUN([gl_EARLY], # Code from module arpa_inet: # Code from module assure: # Code from module at-internal: + # Code from module builtin-expect: + # Code from module c99: # Code from module canonicalize-lgpl: # Code from module chdir: # Code from module chdir-long: # Code from module cloexec: # Code from module close: # Code from module closedir: - # Code from module configmake: # Code from module d-ino: # Code from module d-type: # Code from module dirent: @@ -75,6 +76,7 @@ AC_DEFUN([gl_EARLY], # Code from module fcntl: # Code from module fcntl-h: # Code from module fd-hook: + # Code from module fd-safer-flag: # Code from module fdopendir: # Code from module filename: # Code from module filenamecat-lgpl: @@ -82,6 +84,7 @@ AC_DEFUN([gl_EARLY], # Code from module float: # Code from module fnmatch: # Code from module fnmatch-gnu: + # Code from module fnmatch-h: # Code from module fpieee: AC_REQUIRE([gl_FP_IEEE]) # Code from module fpucw: @@ -97,6 +100,7 @@ AC_DEFUN([gl_EARLY], # Code from module gettext-h: # Code from module gettimeofday: # Code from module glob: + # Code from module glob-h: # Code from module hard-locale: # Code from module havelib: # Code from module include_next: @@ -108,8 +112,10 @@ AC_DEFUN([gl_EARLY], # Code from module isnanl-nolibm: # Code from module largefile: AC_REQUIRE([AC_SYS_LARGEFILE]) + # Code from module libc-config: # Code from module limits-h: # Code from module localcharset: + # Code from module localtime-buffer: # Code from module lock: # Code from module lstat: # Code from module malloc-posix: @@ -146,7 +152,7 @@ AC_DEFUN([gl_EARLY], # Code from module rmdir: # Code from module same-inode: # Code from module save-cwd: - # Code from module secure_getenv: + # Code from module scratch_buffer: # Code from module setenv: # Code from module signal-h: # Code from module snippet/_Noreturn: @@ -156,6 +162,8 @@ AC_DEFUN([gl_EARLY], # Code from module socklen: # Code from module ssize_t: # Code from module stat: + # Code from module stat-time: + # Code from module std-gnu11: # Code from module stdalign: # Code from module stdbool: # Code from module stddef: @@ -190,6 +198,11 @@ AC_DEFUN([gl_EARLY], # Code from module verify: # Code from module wchar: # Code from module wctype-h: + # Code from module windows-mutex: + # Code from module windows-once: + # Code from module windows-recmutex: + # Code from module windows-rwlock: + # Code from module xalloc-oversized: ]) # This macro should be invoked from ./configure.ac, in the section @@ -212,6 +225,7 @@ AC_DEFUN([gl_INIT], gl_HEADER_ARPA_INET AC_PROG_MKDIR_P AC_LIBOBJ([openat-proc]) + gl___BUILTIN_EXPECT gl_CANONICALIZE_LGPL if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then AC_LIBOBJ([canonicalize-lgpl]) @@ -236,7 +250,6 @@ AC_DEFUN([gl_INIT], AC_LIBOBJ([closedir]) fi gl_DIRENT_MODULE_INDICATOR([closedir]) - gl_CONFIGMAKE_PREP gl_CHECK_TYPE_STRUCT_DIRENT_D_INO gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE gl_DIRENT_H @@ -281,6 +294,7 @@ AC_DEFUN([gl_INIT], fi gl_FCNTL_MODULE_INDICATOR([fcntl]) gl_FCNTL_H + gl_MODULE_INDICATOR([fd-safer-flag]) gl_FUNC_FDOPENDIR if test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1; then AC_LIBOBJ([fdopendir]) @@ -297,21 +311,24 @@ AC_DEFUN([gl_INIT], AC_LIBOBJ([itold]) fi gl_FUNC_FNMATCH_POSIX - if test -n "$FNMATCH_H"; then + if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then AC_LIBOBJ([fnmatch]) gl_PREREQ_FNMATCH fi + gl_FNMATCH_MODULE_INDICATOR([fnmatch]) gl_FUNC_FNMATCH_GNU - if test -n "$FNMATCH_H"; then + if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then AC_LIBOBJ([fnmatch]) gl_PREREQ_FNMATCH fi - gl_FUNC_FREXP + gl_MODULE_INDICATOR([fnmatch-gnu]) + gl_FNMATCH_H + AC_REQUIRE([gl_FUNC_FREXP]) if test $gl_func_frexp != yes; then AC_LIBOBJ([frexp]) fi gl_MATH_MODULE_INDICATOR([frexp]) - gl_FUNC_FREXPL + AC_REQUIRE([gl_FUNC_FREXPL]) if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; then AC_LIBOBJ([frexpl]) fi @@ -319,6 +336,11 @@ AC_DEFUN([gl_INIT], gl_FUNC_FSTAT if test $REPLACE_FSTAT = 1; then AC_LIBOBJ([fstat]) + case "$host_os" in + mingw*) + AC_LIBOBJ([stat-w32]) + ;; + esac gl_PREREQ_FSTAT fi gl_SYS_STAT_MODULE_INDICATOR([fstat]) @@ -351,6 +373,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_GETLOGIN_R fi gl_UNISTD_MODULE_INDICATOR([getlogin_r]) + AC_REQUIRE([gl_LIB_GETLOGIN]) gl_FUNC_GETPROGNAME AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) @@ -361,11 +384,16 @@ AC_DEFUN([gl_INIT], fi gl_SYS_TIME_MODULE_INDICATOR([gettimeofday]) gl_GLOB - if test -n "$GLOB_H"; then + if test $HAVE_GLOB = 0 || test $REPLACE_GLOB = 1; then AC_LIBOBJ([glob]) + AC_LIBOBJ([globfree]) gl_PREREQ_GLOB fi - gl_HARD_LOCALE + if test $HAVE_GLOB_PATTERN_P = 0 || test $REPLACE_GLOB_PATTERN_P = 1; then + AC_LIBOBJ([glob_pattern_p]) + fi + gl_GLOB_MODULE_INDICATOR([glob]) + gl_GLOB_H gl_FUNC_INET_NTOP if test $HAVE_INET_NTOP = 0 || test $REPLACE_INET_NTOP = 1; then AC_LIBOBJ([inet_ntop]) @@ -385,10 +413,14 @@ AC_DEFUN([gl_INIT], gl_PREREQ_ISNANL fi AC_REQUIRE([gl_LARGEFILE]) + gl___INLINE gl_LIMITS_H gl_LOCALCHARSET - LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\"" + dnl For backward compatibility. Some packages still use this. + LOCALCHARSET_TESTS_ENVIRONMENT= AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) + AC_REQUIRE([gl_LOCALTIME_BUFFER_DEFAULTS]) + AC_LIBOBJ([localtime-buffer]) gl_LOCK gl_MODULE_INDICATOR([lock]) gl_FUNC_LSTAT @@ -475,6 +507,7 @@ AC_DEFUN([gl_INIT], if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then AC_LIBOBJ([msvc-nothrow]) fi + gl_MODULE_INDICATOR([msvc-nothrow]) gl_MULTIARCH gl_HEADER_NETINET_IN AC_PROG_MKDIR_P @@ -535,12 +568,6 @@ AC_DEFUN([gl_INIT], fi gl_UNISTD_MODULE_INDICATOR([rmdir]) gl_SAVE_CWD - gl_FUNC_SECURE_GETENV - if test $HAVE_SECURE_GETENV = 0; then - AC_LIBOBJ([secure_getenv]) - gl_PREREQ_SECURE_GETENV - fi - gl_STDLIB_MODULE_INDICATOR([secure_getenv]) gl_FUNC_SETENV if test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1; then AC_LIBOBJ([setenv]) @@ -552,9 +579,16 @@ AC_DEFUN([gl_INIT], gl_FUNC_STAT if test $REPLACE_STAT = 1; then AC_LIBOBJ([stat]) + case "$host_os" in + mingw*) + AC_LIBOBJ([stat-w32]) + ;; + esac gl_PREREQ_STAT fi gl_SYS_STAT_MODULE_INDICATOR([stat]) + gl_STAT_TIME + gl_STAT_BIRTHTIME gl_STDALIGN_H AM_STDBOOL_H gl_STDDEF_H @@ -591,6 +625,8 @@ AC_DEFUN([gl_INIT], gl_PREREQ_STRERROR_R fi gl_STRING_MODULE_INDICATOR([strerror_r]) + dnl For the modules argp, error. + gl_MODULE_INDICATOR([strerror_r-posix]) gl_HEADER_STRING_H gl_FUNC_STRSTR if test $REPLACE_STRSTR = 1; then @@ -618,7 +654,7 @@ AC_DEFUN([gl_INIT], gl_HEADER_SYS_UIO AC_PROG_MKDIR_P gl_FUNC_GEN_TEMPNAME - gl_THREADLIB + AC_REQUIRE([gl_THREADLIB]) gl_HEADER_TIME_H gl_TIME_R if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then @@ -636,6 +672,30 @@ AC_DEFUN([gl_INIT], gl_STDLIB_MODULE_INDICATOR([unsetenv]) gl_WCHAR_H gl_WCTYPE_H + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-mutex]) + ;; + esac + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-once]) + ;; + esac + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-recmutex]) + ;; + esac + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-rwlock]) + ;; + esac # End of code from modules m4_ifval(gl_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || @@ -777,31 +837,31 @@ AC_DEFUN([gltests_LIBSOURCES], [ # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([gl_FILE_LIST], [ build-aux/config.rpath - build-aux/snippet/_Noreturn.h - build-aux/snippet/arg-nonnull.h - build-aux/snippet/c++defs.h - build-aux/snippet/warn-on-use.h build-aux/update-copyright + lib/_Noreturn.h lib/alloca.c lib/alloca.in.h + lib/arg-nonnull.h lib/arpa_inet.in.h lib/assure.h lib/at-func.c lib/basename-lgpl.c + lib/c++defs.h lib/canonicalize-lgpl.c + lib/cdefs.h lib/chdir-long.c lib/chdir-long.h lib/cloexec.c lib/cloexec.h lib/close.c lib/closedir.c - lib/config.charset lib/dirent-private.h lib/dirent.in.h lib/dirfd.c lib/dirname-lgpl.c lib/dirname.h lib/dosname.h + lib/dup-safer-flag.c lib/dup-safer.c lib/dup.c lib/dup2.c @@ -815,6 +875,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/fcntl.in.h lib/fd-hook.c lib/fd-hook.h + lib/fd-safer-flag.c lib/fd-safer.c lib/fdopendir.c lib/filename.h @@ -843,6 +904,9 @@ AC_DEFUN([gl_FILE_LIST], [ lib/glob-libc.h lib/glob.c lib/glob.in.h + lib/glob_internal.h + lib/glob_pattern_p.c + lib/globfree.c lib/glthread/lock.c lib/glthread/lock.h lib/glthread/threadlib.c @@ -857,14 +921,20 @@ AC_DEFUN([gl_FILE_LIST], [ lib/isnanl-nolibm.h lib/isnanl.c lib/itold.c + lib/libc-config.h lib/limits.in.h lib/localcharset.c lib/localcharset.h + lib/localtime-buffer.c + lib/localtime-buffer.h lib/lstat.c lib/malloc.c + lib/malloc/scratch_buffer.h + lib/malloc/scratch_buffer_grow.c + lib/malloc/scratch_buffer_grow_preserve.c + lib/malloc/scratch_buffer_set_array_size.c lib/malloca.c lib/malloca.h - lib/malloca.valgrind lib/math.c lib/math.in.h lib/mbrtowc.c @@ -899,17 +969,19 @@ AC_DEFUN([gl_FILE_LIST], [ lib/readdir.c lib/readlink.c lib/realloc.c - lib/ref-add.sin - lib/ref-del.sin lib/rename.c lib/rewinddir.c lib/rmdir.c lib/same-inode.h lib/save-cwd.c lib/save-cwd.h - lib/secure_getenv.c + lib/scratch_buffer.h lib/setenv.c lib/signal.in.h + lib/stat-time.c + lib/stat-time.h + lib/stat-w32.c + lib/stat-w32.h lib/stat.c lib/stdalign.in.h lib/stdbool.in.h @@ -948,19 +1020,31 @@ AC_DEFUN([gl_FILE_LIST], [ lib/unistd.in.h lib/unsetenv.c lib/verify.h + lib/warn-on-use.h lib/wchar.in.h lib/wctype-h.c lib/wctype.in.h + lib/windows-initguard.h + lib/windows-mutex.c + lib/windows-mutex.h + lib/windows-once.c + lib/windows-once.h + lib/windows-recmutex.c + lib/windows-recmutex.h + lib/windows-rwlock.c + lib/windows-rwlock.h + lib/xalloc-oversized.h m4/00gnulib.m4 + m4/__inline.m4 m4/absolute-header.m4 m4/alloca.m4 m4/arpa_inet_h.m4 + m4/builtin-expect.m4 m4/canonicalize.m4 m4/chdir-long.m4 m4/close.m4 m4/closedir.m4 m4/codeset.m4 - m4/configmake.m4 m4/d-ino.m4 m4/d-type.m4 m4/dirent_h.m4 @@ -986,6 +1070,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/flexmember.m4 m4/float_h.m4 m4/fnmatch.m4 + m4/fnmatch_h.m4 m4/fpieee.m4 m4/frexp.m4 m4/frexpl.m4 @@ -995,13 +1080,15 @@ AC_DEFUN([gl_FILE_LIST], [ m4/getcwd-path-max.m4 m4/getcwd.m4 m4/getdtablesize.m4 + m4/getlogin.m4 m4/getlogin_r.m4 + m4/getpagesize.m4 m4/getprogname.m4 m4/gettimeofday.m4 - m4/glibc21.m4 m4/glob.m4 + m4/glob_h.m4 m4/gnulib-common.m4 - m4/hard-locale.m4 + m4/host-cpu-c-abi.m4 m4/include_next.m4 m4/inet_ntop.m4 m4/inttypes-pri.m4 @@ -1017,6 +1104,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/locale-fr.m4 m4/locale-ja.m4 m4/locale-zh.m4 + m4/localtime-buffer.m4 m4/lock.m4 m4/longlong.m4 m4/lstat.m4 @@ -1042,11 +1130,13 @@ AC_DEFUN([gl_FILE_LIST], [ m4/netinet_in_h.m4 m4/nocrash.m4 m4/off_t.m4 - m4/onceonly.m4 + m4/open-cloexec.m4 + m4/open-slash.m4 m4/open.m4 m4/openat.m4 m4/opendir.m4 m4/pathmax.m4 + m4/pthread_rwlock_rdlock.m4 m4/rawmemchr.m4 m4/readdir.m4 m4/readlink.m4 @@ -1055,13 +1145,14 @@ AC_DEFUN([gl_FILE_LIST], [ m4/rewinddir.m4 m4/rmdir.m4 m4/save-cwd.m4 - m4/secure_getenv.m4 m4/setenv.m4 m4/signal_h.m4 m4/socklen.m4 m4/sockpfaf.m4 m4/ssize_t.m4 + m4/stat-time.m4 m4/stat.m4 + m4/std-gnu11.m4 m4/stdalign.m4 m4/stdbool.m4 m4/stddef_h.m4 diff --git a/gnulib/import/m4/gnulib-tool.m4 b/gnulib/import/m4/gnulib-tool.m4 index 0d2ee44..98e6ade 100644 --- a/gnulib/import/m4/gnulib-tool.m4 +++ b/gnulib/import/m4/gnulib-tool.m4 @@ -1,5 +1,5 @@ # gnulib-tool.m4 serial 2 -dnl Copyright (C) 2004-2005, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2005, 2009-2019 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. diff --git a/gnulib/import/m4/hard-locale.m4 b/gnulib/import/m4/hard-locale.m4 deleted file mode 100644 index 4661bfc..0000000 --- a/gnulib/import/m4/hard-locale.m4 +++ /dev/null @@ -1,11 +0,0 @@ -# hard-locale.m4 serial 8 -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. - -dnl No prerequisites of lib/hard-locale.c. -AC_DEFUN([gl_HARD_LOCALE], -[ - : -]) diff --git a/gnulib/import/m4/host-cpu-c-abi.m4 b/gnulib/import/m4/host-cpu-c-abi.m4 new file mode 100644 index 0000000..6fc31bc --- /dev/null +++ b/gnulib/import/m4/host-cpu-c-abi.m4 @@ -0,0 +1,675 @@ +# host-cpu-c-abi.m4 serial 13 +dnl Copyright (C) 2002-2019 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 Bruno Haible and Sam Steingold. + +dnl Sets the HOST_CPU variable to the canonical name of the CPU. +dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its +dnl C language ABI (application binary interface). +dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in +dnl config.h. +dnl +dnl This canonical name can be used to select a particular assembly language +dnl source file that will interoperate with C code on the given host. +dnl +dnl For example: +dnl * 'i386' and 'sparc' are different canonical names, because code for i386 +dnl will not run on SPARC CPUs and vice versa. They have different +dnl instruction sets. +dnl * 'sparc' and 'sparc64' are different canonical names, because code for +dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code +dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit +dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit +dnl mode, but not both. +dnl * 'mips' and 'mipsn32' are different canonical names, because they use +dnl different argument passing and return conventions for C functions, and +dnl although the instruction set of 'mips' is a large subset of the +dnl instruction set of 'mipsn32'. +dnl * 'mipsn32' and 'mips64' are different canonical names, because they use +dnl different sizes for the C types like 'int' and 'void *', and although +dnl the instruction sets of 'mipsn32' and 'mips64' are the same. +dnl * The same canonical name is used for different endiannesses. You can +dnl determine the endianness through preprocessor symbols: +dnl - 'arm': test __ARMEL__. +dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL. +dnl - 'powerpc64': test _BIG_ENDIAN vs. _LITTLE_ENDIAN. +dnl * The same name 'i386' is used for CPUs of type i386, i486, i586 +dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because +dnl - Instructions that do not exist on all of these CPUs (cmpxchg, +dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your +dnl assembly language source files use such instructions, you will +dnl need to make the distinction. +dnl - Speed of execution of the common instruction set is reasonable across +dnl the entire family of CPUs. If you have assembly language source files +dnl that are optimized for particular CPU types (like GNU gmp has), you +dnl will need to make the distinction. +dnl See <https://en.wikipedia.org/wiki/X86_instruction_listings>. +AC_DEFUN([gl_HOST_CPU_C_ABI], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_C_ASM]) + AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi], + [case "$host_cpu" in + +changequote(,)dnl + i[34567]86 ) +changequote([,])dnl + gl_cv_host_cpu_c_abi=i386 + ;; + + x86_64 ) + # On x86_64 systems, the C compiler may be generating code in one of + # these ABIs: + # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. + # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 + # with native Windows (mingw, MSVC). + # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if (defined __x86_64__ || defined __amd64__ \ + || defined _M_X64 || defined _M_AMD64) + int ok; + #else + error fail + #endif + ]])], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __ILP32__ || defined _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=x86_64-x32], + [gl_cv_host_cpu_c_abi=x86_64])], + [gl_cv_host_cpu_c_abi=i386]) + ;; + +changequote(,)dnl + alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) +changequote([,])dnl + gl_cv_host_cpu_c_abi=alpha + ;; + + arm* | aarch64 ) + # Assume arm with EABI. + # On arm64 systems, the C compiler may be generating code in one of + # these ABIs: + # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. + # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef __aarch64__ + int ok; + #else + error fail + #endif + ]])], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __ILP32__ || defined _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=arm64-ilp32], + [gl_cv_host_cpu_c_abi=arm64])], + [# Don't distinguish little-endian and big-endian arm, since they + # don't require different machine code for simple operations and + # since the user can distinguish them through the preprocessor + # defines __ARMEL__ vs. __ARMEB__. + # But distinguish arm which passes floating-point arguments and + # return values in integer registers (r0, r1, ...) - this is + # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which + # passes them in float registers (s0, s1, ...) and double registers + # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer + # sets the preprocessor defines __ARM_PCS (for the first case) and + # __ARM_PCS_VFP (for the second case), but older GCC does not. + echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c + # Look for a reference to the register d0 in the .s file. + AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 + if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then + gl_cv_host_cpu_c_abi=armhf + else + gl_cv_host_cpu_c_abi=arm + fi + rm -f conftest* + ]) + ;; + + hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) + # On hppa, the C compiler may be generating 32-bit code or 64-bit + # code. In the latter case, it defines _LP64 and __LP64__. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef __LP64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=hppa64], + [gl_cv_host_cpu_c_abi=hppa]) + ;; + + ia64* ) + # On ia64 on HP-UX, the C compiler may be generating 64-bit code or + # 32-bit code. In the latter case, it defines _ILP32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=ia64-ilp32], + [gl_cv_host_cpu_c_abi=ia64]) + ;; + + mips* ) + # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this + # at 32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=mips64], + [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but + # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIN32. + # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but + # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIO32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if (_MIPS_SIM == _ABIN32) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=mipsn32], + [gl_cv_host_cpu_c_abi=mips])]) + ;; + + powerpc* ) + # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. + # No need to distinguish them here; the caller may distinguish + # them based on the OS. + # On powerpc64 systems, the C compiler may still be generating + # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may + # be generating 64-bit code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __powerpc64__ || defined _ARCH_PPC64 + int ok; + #else + error fail + #endif + ]])], + [# On powerpc64, there are two ABIs on Linux: The AIX compatible + # one and the ELFv2 one. The latter defines _CALL_ELF=2. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined _CALL_ELF && _CALL_ELF == 2 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=powerpc64-elfv2], + [gl_cv_host_cpu_c_abi=powerpc64]) + ], + [gl_cv_host_cpu_c_abi=powerpc]) + ;; + + rs6000 ) + gl_cv_host_cpu_c_abi=powerpc + ;; + + riscv32 | riscv64 ) + # There are 2 architectures (with variants): rv32* and rv64*. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if __riscv_xlen == 64 + int ok; + #else + error fail + #endif + ]])], + [cpu=riscv64], + [cpu=riscv32]) + # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. + # Size of 'long' and 'void *': + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ + int ok; + #else + error fail + #endif + ]])], + [main_abi=lp64], + [main_abi=ilp32]) + # Float ABIs: + # __riscv_float_abi_double: + # 'float' and 'double' are passed in floating-point registers. + # __riscv_float_abi_single: + # 'float' are passed in floating-point registers. + # __riscv_float_abi_soft: + # No values are passed in floating-point registers. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __riscv_float_abi_double + int ok; + #else + error fail + #endif + ]])], + [float_abi=d], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __riscv_float_abi_single + int ok; + #else + error fail + #endif + ]])], + [float_abi=f], + [float_abi='']) + ]) + gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}" + ;; + + s390* ) + # On s390x, the C compiler may be generating 64-bit (= s390x) code + # or 31-bit (= s390) code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ || defined __s390x__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=s390x], + [gl_cv_host_cpu_c_abi=s390]) + ;; + + sparc | sparc64 ) + # UltraSPARCs running Linux have `uname -m` = "sparc64", but the + # C compiler still generates 32-bit code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __sparcv9 || defined __arch64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=sparc64], + [gl_cv_host_cpu_c_abi=sparc]) + ;; + + *) + gl_cv_host_cpu_c_abi="$host_cpu" + ;; + esac + ]) + + dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same. + HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'` + HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi" + AC_SUBST([HOST_CPU]) + AC_SUBST([HOST_CPU_C_ABI]) + + # This was + # AC_DEFINE_UNQUOTED([__${HOST_CPU}__]) + # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__]) + # earlier, but KAI C++ 3.2d doesn't like this. + sed -e 's/-/_/g' >> confdefs.h <<EOF +#ifndef __${HOST_CPU}__ +#define __${HOST_CPU}__ 1 +#endif +#ifndef __${HOST_CPU_C_ABI}__ +#define __${HOST_CPU_C_ABI}__ 1 +#endif +EOF + AH_TOP([/* CPU and C ABI indicator */ +#ifndef __i386__ +#undef __i386__ +#endif +#ifndef __x86_64_x32__ +#undef __x86_64_x32__ +#endif +#ifndef __x86_64__ +#undef __x86_64__ +#endif +#ifndef __alpha__ +#undef __alpha__ +#endif +#ifndef __arm__ +#undef __arm__ +#endif +#ifndef __armhf__ +#undef __armhf__ +#endif +#ifndef __arm64_ilp32__ +#undef __arm64_ilp32__ +#endif +#ifndef __arm64__ +#undef __arm64__ +#endif +#ifndef __hppa__ +#undef __hppa__ +#endif +#ifndef __hppa64__ +#undef __hppa64__ +#endif +#ifndef __ia64_ilp32__ +#undef __ia64_ilp32__ +#endif +#ifndef __ia64__ +#undef __ia64__ +#endif +#ifndef __m68k__ +#undef __m68k__ +#endif +#ifndef __mips__ +#undef __mips__ +#endif +#ifndef __mipsn32__ +#undef __mipsn32__ +#endif +#ifndef __mips64__ +#undef __mips64__ +#endif +#ifndef __powerpc__ +#undef __powerpc__ +#endif +#ifndef __powerpc64__ +#undef __powerpc64__ +#endif +#ifndef __powerpc64_elfv2__ +#undef __powerpc64_elfv2__ +#endif +#ifndef __riscv32__ +#undef __riscv32__ +#endif +#ifndef __riscv64__ +#undef __riscv64__ +#endif +#ifndef __riscv32_ilp32__ +#undef __riscv32_ilp32__ +#endif +#ifndef __riscv32_ilp32f__ +#undef __riscv32_ilp32f__ +#endif +#ifndef __riscv32_ilp32d__ +#undef __riscv32_ilp32d__ +#endif +#ifndef __riscv64_ilp32__ +#undef __riscv64_ilp32__ +#endif +#ifndef __riscv64_ilp32f__ +#undef __riscv64_ilp32f__ +#endif +#ifndef __riscv64_ilp32d__ +#undef __riscv64_ilp32d__ +#endif +#ifndef __riscv64_lp64__ +#undef __riscv64_lp64__ +#endif +#ifndef __riscv64_lp64f__ +#undef __riscv64_lp64f__ +#endif +#ifndef __riscv64_lp64d__ +#undef __riscv64_lp64d__ +#endif +#ifndef __s390__ +#undef __s390__ +#endif +#ifndef __s390x__ +#undef __s390x__ +#endif +#ifndef __sh__ +#undef __sh__ +#endif +#ifndef __sparc__ +#undef __sparc__ +#endif +#ifndef __sparc64__ +#undef __sparc64__ +#endif +]) + +]) + + +dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI +dnl (application binary interface) is a 32-bit one, to 'no' if it is a 64-bit +dnl one, or to 'unknown' if unknown. +dnl This is a simplified variant of gl_HOST_CPU_C_ABI. +AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit], + [if test -n "$gl_cv_host_cpu_c_abi"; then + case "$gl_cv_host_cpu_c_abi" in + i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) + gl_cv_host_cpu_c_abi_32bit=yes ;; + x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) + gl_cv_host_cpu_c_abi_32bit=no ;; + *) + gl_cv_host_cpu_c_abi_32bit=unknown ;; + esac + else + case "$host_cpu" in + + # CPUs that only support a 32-bit ABI. + arc \ + | bfin \ + | cris* \ + | csky \ + | epiphany \ + | ft32 \ + | h8300 \ + | m68k \ + | microblaze | microblazeel \ + | nds32 | nds32le | nds32be \ + | nios2 | nios2eb | nios2el \ + | or1k* \ + | or32 \ + | sh | sh[1234] | sh[1234]e[lb] \ + | tic6x \ + | xtensa* ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; + + # CPUs that only support a 64-bit ABI. +changequote(,)dnl + alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ + | mmix ) +changequote([,])dnl + gl_cv_host_cpu_c_abi_32bit=no + ;; + +changequote(,)dnl + i[34567]86 ) +changequote([,])dnl + gl_cv_host_cpu_c_abi_32bit=yes + ;; + + x86_64 ) + # On x86_64 systems, the C compiler may be generating code in one of + # these ABIs: + # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. + # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 + # with native Windows (mingw, MSVC). + # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if (defined __x86_64__ || defined __amd64__ \ + || defined _M_X64 || defined _M_AMD64) \ + && !(defined __ILP32__ || defined _ILP32) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + arm* | aarch64 ) + # Assume arm with EABI. + # On arm64 systems, the C compiler may be generating code in one of + # these ABIs: + # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. + # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) + # On hppa, the C compiler may be generating 32-bit code or 64-bit + # code. In the latter case, it defines _LP64 and __LP64__. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef __LP64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + ia64* ) + # On ia64 on HP-UX, the C compiler may be generating 64-bit code or + # 32-bit code. In the latter case, it defines _ILP32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=yes], + [gl_cv_host_cpu_c_abi_32bit=no]) + ;; + + mips* ) + # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this + # at 32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + powerpc* ) + # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. + # No need to distinguish them here; the caller may distinguish + # them based on the OS. + # On powerpc64 systems, the C compiler may still be generating + # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may + # be generating 64-bit code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __powerpc64__ || defined _ARCH_PPC64 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + rs6000 ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; + + riscv32 | riscv64 ) + # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. + # Size of 'long' and 'void *': + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + s390* ) + # On s390x, the C compiler may be generating 64-bit (= s390x) code + # or 31-bit (= s390) code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ || defined __s390x__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + sparc | sparc64 ) + # UltraSPARCs running Linux have `uname -m` = "sparc64", but the + # C compiler still generates 32-bit code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __sparcv9 || defined __arch64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + *) + gl_cv_host_cpu_c_abi_32bit=unknown + ;; + esac + fi + ]) + + HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" +]) diff --git a/gnulib/import/m4/include_next.m4 b/gnulib/import/m4/include_next.m4 index db0f2c0..86eb2c9 100644 --- a/gnulib/import/m4/include_next.m4 +++ b/gnulib/import/m4/include_next.m4 @@ -1,12 +1,13 @@ -# include_next.m4 serial 23 -dnl Copyright (C) 2006-2016 Free Software Foundation, Inc. +# include_next.m4 serial 24 +dnl Copyright (C) 2006-2019 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 and Derek Price. -dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER. +dnl Sets INCLUDE_NEXT, INCLUDE_NEXT_AS_FIRST_DIRECTIVE, PRAGMA_SYSTEM_HEADER, +dnl and PRAGMA_COLUMNS. dnl dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to dnl 'include' otherwise. diff --git a/gnulib/import/m4/inet_ntop.m4 b/gnulib/import/m4/inet_ntop.m4 index 26464c3..d71246b 100644 --- a/gnulib/import/m4/inet_ntop.m4 +++ b/gnulib/import/m4/inet_ntop.m4 @@ -1,5 +1,5 @@ -# inet_ntop.m4 serial 19 -dnl Copyright (C) 2005-2006, 2008-2016 Free Software Foundation, Inc. +# inet_ntop.m4 serial 21 +dnl Copyright (C) 2005-2006, 2008-2019 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. @@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_INET_NTOP], dnl Most platforms that provide inet_ntop define it in libc. dnl Solaris 8..10 provide inet_ntop in libnsl instead. dnl Solaris 2.6..7 provide inet_ntop in libresolv instead. + dnl Haiku provides it in -lnetwork. dnl Native Windows provides it in -lws2_32 instead, with a declaration in dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it). @@ -23,19 +24,20 @@ AC_DEFUN([gl_FUNC_INET_NTOP], INET_NTOP_LIB= gl_PREREQ_SYS_H_WINSOCK2 if test $HAVE_WINSOCK2_H = 1; then + dnl It needs to be overridden, because the stdcall calling convention + dnl is not compliant with POSIX. Set REPLACE_INET_NTOP in order to avoid + dnl a name conflict at the linker level, even though the header file + dnl <ws2tcpip.h> declares inet_ntop only if _WIN32_WINNT >= 0x0600. + REPLACE_INET_NTOP=1 AC_CHECK_DECLS([inet_ntop],,, [[#include <ws2tcpip.h>]]) if test $ac_cv_have_decl_inet_ntop = yes; then - dnl It needs to be overridden, because the stdcall calling convention - dnl is not compliant with POSIX. - REPLACE_INET_NTOP=1 INET_NTOP_LIB="-lws2_32" else HAVE_DECL_INET_NTOP=0 - HAVE_INET_NTOP=0 fi else gl_save_LIBS=$LIBS - AC_SEARCH_LIBS([inet_ntop], [nsl resolv], [], + AC_SEARCH_LIBS([inet_ntop], [nsl resolv network], [], [AC_CHECK_FUNCS([inet_ntop]) if test $ac_cv_func_inet_ntop = no; then HAVE_INET_NTOP=0 diff --git a/gnulib/import/m4/inttypes-pri.m4 b/gnulib/import/m4/inttypes-pri.m4 index ae20183..38fe118 100644 --- a/gnulib/import/m4/inttypes-pri.m4 +++ b/gnulib/import/m4/inttypes-pri.m4 @@ -1,5 +1,5 @@ # inttypes-pri.m4 serial 7 (gettext-0.18.2) -dnl Copyright (C) 1997-2002, 2006, 2008-2016 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2002, 2006, 2008-2019 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. diff --git a/gnulib/import/m4/inttypes.m4 b/gnulib/import/m4/inttypes.m4 index 61cdb1a..c58a1be 100644 --- a/gnulib/import/m4/inttypes.m4 +++ b/gnulib/import/m4/inttypes.m4 @@ -1,5 +1,5 @@ -# inttypes.m4 serial 26 -dnl Copyright (C) 2006-2016 Free Software Foundation, Inc. +# inttypes.m4 serial 27 +dnl Copyright (C) 2006-2019 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. @@ -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]) diff --git a/gnulib/import/m4/isnand.m4 b/gnulib/import/m4/isnand.m4 index bcf3840..31af024 100644 --- a/gnulib/import/m4/isnand.m4 +++ b/gnulib/import/m4/isnand.m4 @@ -1,5 +1,5 @@ # isnand.m4 serial 11 -dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2019 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. diff --git a/gnulib/import/m4/isnanl.m4 b/gnulib/import/m4/isnanl.m4 index 9766e47..3bef867 100644 --- a/gnulib/import/m4/isnanl.m4 +++ b/gnulib/import/m4/isnanl.m4 @@ -1,5 +1,5 @@ -# isnanl.m4 serial 19 -dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +# isnanl.m4 serial 20 +dnl Copyright (C) 2007-2019 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. @@ -231,6 +231,18 @@ int main () }]])], [gl_cv_func_isnanl_works=yes], [gl_cv_func_isnanl_works=no], - [gl_cv_func_isnanl_works="guessing yes"]) + [case "$host_os" in + mingw*) # Guess yes on mingw, no on MSVC. + AC_EGREP_CPP([Known], [ +#ifdef __MINGW32__ + Known +#endif + ], + [gl_cv_func_isnanl_works="guessing yes"], + [gl_cv_func_isnanl_works="guessing no"]) + ;; + *) gl_cv_func_isnanl_works="guessing yes" ;; + esac + ]) ]) ]) diff --git a/gnulib/import/m4/largefile.m4 b/gnulib/import/m4/largefile.m4 index 8bbdfaa..65d5a15 100644 --- a/gnulib/import/m4/largefile.m4 +++ b/gnulib/import/m4/largefile.m4 @@ -1,10 +1,26 @@ # Enable large files on systems where this is not the default. -# Copyright 1992-1996, 1998-2016 Free Software Foundation, Inc. +# Copyright 1992-1996, 1998-2019 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. +# The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO: +# It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this +# setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko +# and ftello in C++ mode as well. +AC_DEFUN([gl_SET_LARGEFILE_SOURCE], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_FUNC_FSEEKO + case "$host_os" in + hpux*) + AC_DEFINE([_LARGEFILE_SOURCE], [1], + [Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2).]) + ;; + esac +]) + # The following implementation works around a problem in autoconf <= 2.69; # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, # or configures them incorrectly in some cases. @@ -56,7 +72,7 @@ rm -rf conftest*[]dnl # By default, many hosts won't let programs access large files; # one must use special compiler options to get large-file access to work. # For more details about this brain damage please see: -# http://www.unix-systems.org/version2/whatsnew/lfs20mar.html +# http://www.unix.org/version2/whatsnew/lfs20mar.html AC_DEFUN([AC_SYS_LARGEFILE], [AC_ARG_ENABLE(largefile, [ --disable-largefile omit support for large files]) @@ -126,9 +142,24 @@ AC_DEFUN([gl_LARGEFILE], else WINDOWS_64_BIT_OFF_T=0 fi - dnl But all native Windows platforms (including mingw64) have a 32-bit - dnl st_size member in 'struct stat'. - WINDOWS_64_BIT_ST_SIZE=1 + dnl Some mingw versions define, if _FILE_OFFSET_BITS=64, 'struct stat' + dnl to 'struct _stat32i64' or 'struct _stat64' (depending on + dnl _USE_32BIT_TIME_T), which has a 32-bit st_size member. + AC_CACHE_CHECK([for 64-bit st_size], [gl_cv_member_st_size_64], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/types.h> + struct stat buf; + int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; + ]], + [[]])], + [gl_cv_member_st_size_64=yes], [gl_cv_member_st_size_64=no]) + ]) + if test $gl_cv_member_st_size_64 = no; then + WINDOWS_64_BIT_ST_SIZE=1 + else + WINDOWS_64_BIT_ST_SIZE=0 + fi ;; *) dnl Nothing to do on gnulib's side. diff --git a/gnulib/import/m4/lib-ld.m4 b/gnulib/import/m4/lib-ld.m4 index 6209de6..a187196 100644 --- a/gnulib/import/m4/lib-ld.m4 +++ b/gnulib/import/m4/lib-ld.m4 @@ -1,5 +1,5 @@ -# lib-ld.m4 serial 6 -dnl Copyright (C) 1996-2003, 2009-2016 Free Software Foundation, Inc. +# lib-ld.m4 serial 9 +dnl Copyright (C) 1996-2003, 2009-2019 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. @@ -47,73 +47,122 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. +if test -n "$LD"; then + AC_MSG_CHECKING([for ld]) +elif test "$GCC" = yes; then AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` - while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi -AC_CACHE_VAL([acl_cv_path_LD], -[if test -z "$LD"; then - acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$acl_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break - ;; - *) - test "$with_gnu_ld" != yes && break - ;; +if test -n "$LD"; then + # Let the user override the test with a path. + : +else + AC_CACHE_VAL([acl_cv_path_LD], + [ + acl_cv_path_LD= # Final result of this test + ac_prog=ld # Program to search in $PATH + if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + acl_output=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $acl_output in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` + while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do + acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` + done + # Got the pathname. No search in PATH is needed. + acl_cv_path_LD="$acl_output" + ac_prog= + ;; + "") + # If it fails, then pretend we aren't using GCC. + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; esac fi - done - IFS="$acl_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" + if test -n "$ac_prog"; then + # Search for $ac_prog in $PATH. + acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$acl_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break + ;; + *) + test "$with_gnu_ld" != yes && break + ;; + esac + fi + done + IFS="$acl_save_ifs" + fi + case $host in + *-*-aix*) + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __powerpc64__ || defined _ARCH_PPC64 + int ok; + #else + error fail + #endif + ]])], + [# The compiler produces 64-bit code. Add option '-b64' so that the + # linker groks 64-bit object files. + case "$acl_cv_path_LD " in + *" -b64 "*) ;; + *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; + esac + ], []) + ;; + sparc64-*-netbsd*) + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __sparcv9 || defined __arch64__ + int ok; + #else + error fail + #endif + ]])], + [], + [# The compiler produces 32-bit code. Add option '-m elf32_sparc' + # so that the linker groks 32-bit object files. + case "$acl_cv_path_LD " in + *" -m elf32_sparc "*) ;; + *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;; + esac + ]) + ;; + esac + ]) + LD="$acl_cv_path_LD" +fi if test -n "$LD"; then AC_MSG_RESULT([$LD]) else AC_MSG_RESULT([no]) + AC_MSG_ERROR([no acceptable ld found in \$PATH]) fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_LIB_PROG_LD_GNU ]) diff --git a/gnulib/import/m4/lib-link.m4 b/gnulib/import/m4/lib-link.m4 index 2f51855..b9fa364 100644 --- a/gnulib/import/m4/lib-link.m4 +++ b/gnulib/import/m4/lib-link.m4 @@ -1,12 +1,12 @@ -# lib-link.m4 serial 26 (gettext-0.18.2) -dnl Copyright (C) 2001-2016 Free Software Foundation, Inc. +# lib-link.m4 serial 31 +dnl Copyright (C) 2001-2019 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 Bruno Haible. -AC_PREREQ([2.54]) +AC_PREREQ([2.61]) dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. @@ -124,8 +124,8 @@ dnl acl_hardcode_direct, dnl acl_hardcode_minus_L. AC_DEFUN([AC_LIB_RPATH], [ - dnl Tell automake >= 1.10 to complain if config.rpath is missing. - m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) + dnl Complain if config.rpath is missing. + AC_REQUIRE_AUX_FILE([config.rpath]) AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host @@ -187,17 +187,17 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) - dnl Autoconf >= 2.61 supports dots in --with options. - pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" ]) - AC_ARG_WITH(P_A_C_K[-prefix], -[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib - --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], + AC_ARG_WITH(PACK[-prefix], +[[ --with-]]PACK[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib + --without-]]PACK[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no @@ -206,17 +206,23 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && ! test -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi + additional_libdir2="$withval/$acl_libdirstem2" + additional_libdir3="$withval/$acl_libdirstem3" fi fi ]) + if test "X$additional_libdir2" = "X$additional_libdir"; then + additional_libdir2= + fi + if test "X$additional_libdir3" = "X$additional_libdir"; then + additional_libdir3= + fi dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= @@ -272,48 +278,54 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], shrext= fi if test $use_additional = yes; then - dir="$additional_libdir" - dnl The same code as in the loop below: - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" + for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do + if test "X$found_dir" = "X"; then + eval dir=\$$additional_libdir_variable + if test -n "$dir"; then + dnl The same code as in the loop below: + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" - found_so="$dir/$f" - break + found_a="$dir/$libname.$acl_libext" fi - done + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi fi fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi + done fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do @@ -323,7 +335,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dir=`echo "X$x" | sed -e 's/^X-L//'` dnl First look for a shared library. if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else @@ -333,14 +345,14 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do - if test -f "$dir/$f"; then + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break @@ -351,7 +363,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], fi dnl Then look for a static library. if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi @@ -377,7 +389,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dnl standard /usr/lib. if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else @@ -477,6 +490,13 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], fi additional_includedir="$basedir/include" ;; + */$acl_libdirstem3 | */$acl_libdirstem3/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. @@ -527,19 +547,21 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], for dep in $dependency_libs; do case "$dep" in -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $dependency_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; @@ -550,29 +572,29 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then + if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + if test -d "$dependency_libdir"; then + dnl Really add $dependency_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$dependency_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then + if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + if test -d "$dependency_libdir"; then + dnl Really add $dependency_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$dependency_libdir" fi fi fi @@ -670,7 +692,6 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi - popdef([P_A_C_K]) popdef([PACKLIBS]) popdef([PACKUP]) popdef([PACK]) @@ -721,7 +742,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], dir="$next" dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then + && test "X$dir" != "X/usr/$acl_libdirstem2" \ + && test "X$dir" != "X/usr/$acl_libdirstem3"; then rpathdirs="$rpathdirs $dir" fi next= @@ -731,7 +753,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then + && test "X$dir" != "X/usr/$acl_libdirstem2" \ + && test "X$dir" != "X/usr/$acl_libdirstem3"; then rpathdirs="$rpathdirs $dir" fi next= ;; diff --git a/gnulib/import/m4/lib-prefix.m4 b/gnulib/import/m4/lib-prefix.m4 index 6851031..52ea5ae 100644 --- a/gnulib/import/m4/lib-prefix.m4 +++ b/gnulib/import/m4/lib-prefix.m4 @@ -1,18 +1,11 @@ -# lib-prefix.m4 serial 7 (gettext-0.18) -dnl Copyright (C) 2001-2005, 2008-2016 Free Software Foundation, Inc. +# lib-prefix.m4 serial 17 +dnl Copyright (C) 2001-2005, 2008-2019 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 Bruno Haible. -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that dnl a user will want packages to use other packages he previously installed @@ -32,9 +25,9 @@ AC_DEFUN([AC_LIB_PREFIX], eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], + AC_ARG_WITH([lib-prefix], +[[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no @@ -154,71 +147,174 @@ AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], ]) dnl AC_LIB_PREPARE_MULTILIB creates -dnl - a variable acl_libdirstem, containing the basename of the libdir, either -dnl "lib" or "lib64" or "lib/64", -dnl - a variable acl_libdirstem2, as a secondary possible value for -dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or -dnl "lib/amd64". +dnl - a function acl_is_expected_elfclass, that tests whether standard input +dn; has a 32-bit or 64-bit ELF header, depending on the host CPU ABI, +dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing +dnl the basename of the libdir to try in turn, either "lib" or "lib64" or +dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar. AC_DEFUN([AC_LIB_PREPARE_MULTILIB], [ - dnl There is no formal standard regarding lib and lib64. - dnl On glibc systems, the current practice is that on a system supporting + dnl There is no formal standard regarding lib, lib32, and lib64. + dnl On most glibc systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine - dnl the compiler's default mode by looking at the compiler's library search - dnl path. If at least one of its elements ends in /lib64 or points to a - dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. - dnl Otherwise we use the default, namely "lib". + dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on + dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go + dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib. + dnl We determine the compiler's default mode by looking at the compiler's + dnl library search path. If at least one of its elements ends in /lib64 or + dnl points to a directory whose absolute pathname ends in /lib64, we use that + dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default, + dnl namely "lib". dnl On Solaris systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. AC_REQUIRE([AC_CANONICAL_HOST]) - acl_libdirstem=lib - acl_libdirstem2= - case "$host_os" in - solaris*) - dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment - dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>. - dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." - dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the - dnl symlink is missing, so we set acl_libdirstem2 too. - AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], - [AC_EGREP_CPP([sixtyfour bits], [ -#ifdef _LP64 -sixtyfour bits -#endif - ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) - ]) - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 - case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; - esac - fi - ;; - *) - searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" - fi - ;; - esac - test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" + AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT]) + + AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf], + [AC_EGREP_CPP([Extensible Linking Format], + [#ifdef __ELF__ + Extensible Linking Format + #endif + ], + [gl_cv_elf=yes], + [gl_cv_elf=no]) + ]) + if test $gl_cv_elf; then + # Extract the ELF class of a file (5th byte) in decimal. + # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header + if od -A x < /dev/null >/dev/null 2>/dev/null; then + # Use POSIX od. + func_elfclass () + { + od -A n -t d1 -j 4 -N 1 + } + else + # Use BSD hexdump. + func_elfclass () + { + dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' + echo + } + fi +changequote(,)dnl + case $HOST_CPU_C_ABI_32BIT in + yes) + # 32-bit ABI. + acl_is_expected_elfclass () + { + test "`func_elfclass | sed -e 's/[ ]//g'`" = 1 + } + ;; + no) + # 64-bit ABI. + acl_is_expected_elfclass () + { + test "`func_elfclass | sed -e 's/[ ]//g'`" = 2 + } + ;; + *) + # Unknown. + acl_is_expected_elfclass () + { + : + } + ;; + esac +changequote([,])dnl + else + acl_is_expected_elfclass () + { + : + } + fi + + dnl Allow the user to override the result by setting acl_cv_libdirstems. + AC_CACHE_CHECK([for the common suffixes of directories in the library search path], + [acl_cv_libdirstems], + [dnl Try 'lib' first, because that's the default for libdir in GNU, see + dnl <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>. + acl_libdirstem=lib + acl_libdirstem2= + acl_libdirstem3= + case "$host_os" in + solaris*) + dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment + dnl <https://docs.oracle.com/cd/E19253-01/816-5138/dev-env/index.html>. + dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." + dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the + dnl symlink is missing, so we set acl_libdirstem2 too. + if test $HOST_CPU_C_ABI_32BIT = no; then + acl_libdirstem2=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem3=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; + esac + fi + ;; + *) + dnl If $CC generates code for a 32-bit ABI, the libraries are + dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64. + dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries + dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32. + dnl Find the compiler's search path. However, non-system compilers + dnl sometimes have odd library search paths. But we can't simply invoke + dnl '/usr/bin/gcc -print-search-dirs' because that would not take into + dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS. + searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ + | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test $HOST_CPU_C_ABI_32BIT != no; then + # 32-bit or unknown ABI. + if test -d /usr/lib32; then + acl_libdirstem2=lib32 + fi + fi + if test $HOST_CPU_C_ABI_32BIT != yes; then + # 64-bit or unknown ABI. + if test -d /usr/lib64; then + acl_libdirstem3=lib64 + fi + fi + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; + */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib32 ) acl_libdirstem2=lib32 ;; + */lib64 ) acl_libdirstem3=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + if test $HOST_CPU_C_ABI_32BIT = yes; then + # 32-bit ABI. + acl_libdirstem3= + fi + if test $HOST_CPU_C_ABI_32BIT = no; then + # 64-bit ABI. + acl_libdirstem2= + fi + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" + test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" + acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" + ]) + dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and + dnl acl_libdirstem3. +changequote(,)dnl + acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` + acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` + acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` +changequote([,])dnl ]) diff --git a/gnulib/import/m4/limits-h.m4 b/gnulib/import/m4/limits-h.m4 index 31fdf0a..68f724c 100644 --- a/gnulib/import/m4/limits-h.m4 +++ b/gnulib/import/m4/limits-h.m4 @@ -1,6 +1,6 @@ dnl Check whether limits.h has needed features. -dnl Copyright 2016 Free Software Foundation, Inc. +dnl Copyright 2016-2019 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. @@ -11,14 +11,18 @@ AC_DEFUN_ONCE([gl_LIMITS_H], [ gl_CHECK_NEXT_HEADERS([limits.h]) - AC_CACHE_CHECK([whether limits.h has ULLONG_WIDTH etc.], + AC_CACHE_CHECK([whether limits.h has LLONG_MAX, WORD_BIT, 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 <limits.h> - int ullw = ULLONG_WIDTH;]])], + [AC_LANG_PROGRAM( + [[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include <limits.h> + long long llm = LLONG_MAX; + int wb = WORD_BIT; + 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 @@ -29,3 +33,11 @@ AC_DEFUN_ONCE([gl_LIMITS_H], AC_SUBST([LIMITS_H]) AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) ]) + +dnl Unconditionally enables the replacement of <limits.h>. +AC_DEFUN([gl_REPLACE_LIMITS_H], +[ + AC_REQUIRE([gl_LIMITS_H]) + LIMITS_H='limits.h' + AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) +]) diff --git a/gnulib/import/m4/localcharset.m4 b/gnulib/import/m4/localcharset.m4 index 22c311b..2a7f82d 100644 --- a/gnulib/import/m4/localcharset.m4 +++ b/gnulib/import/m4/localcharset.m4 @@ -1,5 +1,5 @@ -# localcharset.m4 serial 7 -dnl Copyright (C) 2002, 2004, 2006, 2009-2016 Free Software Foundation, Inc. +# localcharset.m4 serial 8 +dnl Copyright (C) 2002, 2004, 2006, 2009-2019 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. @@ -8,10 +8,4 @@ AC_DEFUN([gl_LOCALCHARSET], [ dnl Prerequisites of lib/localcharset.c. AC_REQUIRE([AM_LANGINFO_CODESET]) - AC_REQUIRE([gl_FCNTL_O_FLAGS]) - AC_CHECK_DECLS_ONCE([getc_unlocked]) - - dnl Prerequisites of the lib/Makefile.am snippet. - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([gl_GLIBC21]) ]) diff --git a/gnulib/import/m4/locale-fr.m4 b/gnulib/import/m4/locale-fr.m4 index 92896a0..cfa068d 100644 --- a/gnulib/import/m4/locale-fr.m4 +++ b/gnulib/import/m4/locale-fr.m4 @@ -1,5 +1,5 @@ -# locale-fr.m4 serial 17 -dnl Copyright (C) 2003, 2005-2016 Free Software Foundation, Inc. +# locale-fr.m4 serial 19 +dnl Copyright (C) 2003, 2005-2019 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. @@ -24,8 +24,14 @@ changequote(,)dnl struct tm t; char buf[16]; int main () { + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if defined __BEOS__ || defined __HAIKU__ + return 1; +#else /* Check whether the given locale name is recognized by the system. */ -#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ +# if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE @@ -33,9 +39,9 @@ int main () { if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; -#else +# else if (setlocale (LC_ALL, "") == NULL) return 1; -#endif +# endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. @@ -44,32 +50,33 @@ int main () { some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ -#if HAVE_LANGINFO_CODESET +# if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } -#endif -#ifdef __CYGWIN__ +# endif +# ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; -#endif +# endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; -#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ +# if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; -#endif +# endif return 0; +#endif } changequote([,])dnl ])]) @@ -153,7 +160,7 @@ int main () { variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ -# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ +# if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE diff --git a/gnulib/import/m4/locale-ja.m4 b/gnulib/import/m4/locale-ja.m4 index f222a08..487f68b 100644 --- a/gnulib/import/m4/locale-ja.m4 +++ b/gnulib/import/m4/locale-ja.m4 @@ -1,5 +1,5 @@ -# locale-ja.m4 serial 12 -dnl Copyright (C) 2003, 2005-2016 Free Software Foundation, Inc. +# locale-ja.m4 serial 14 +dnl Copyright (C) 2003, 2005-2019 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. @@ -25,9 +25,14 @@ struct tm t; char buf[16]; int main () { - const char *p; + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if defined __BEOS__ || defined __HAIKU__ + return 1; +#else /* Check whether the given locale name is recognized by the system. */ -#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ +# if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE @@ -35,9 +40,9 @@ int main () if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; -#else +# else if (setlocale (LC_ALL, "") == NULL) return 1; -#endif +# endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. @@ -46,32 +51,36 @@ int main () some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ -#if HAVE_LANGINFO_CODESET +# if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } -#endif -#ifdef __CYGWIN__ +# endif +# ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; -#endif +# endif /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales on Cygwin 1.5.x. */ if (MB_CUR_MAX == 1) return 1; /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ - t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; - if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; - for (p = buf; *p != '\0'; p++) - if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) - return 1; + { + const char *p; + t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; + if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; + for (p = buf; *p != '\0'; p++) + if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) + return 1; + } return 0; +#endif } changequote([,])dnl ])]) diff --git a/gnulib/import/m4/locale-zh.m4 b/gnulib/import/m4/locale-zh.m4 index 2271f77..8b81326 100644 --- a/gnulib/import/m4/locale-zh.m4 +++ b/gnulib/import/m4/locale-zh.m4 @@ -1,5 +1,5 @@ -# locale-zh.m4 serial 12 -dnl Copyright (C) 2003, 2005-2016 Free Software Foundation, Inc. +# locale-zh.m4 serial 14 +dnl Copyright (C) 2003, 2005-2019 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. @@ -26,9 +26,14 @@ struct tm t; char buf[16]; int main () { - const char *p; + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if defined __BEOS__ || defined __HAIKU__ + return 1; +#else /* Check whether the given locale name is recognized by the system. */ -#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ +# if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, setlocale(category, "") looks at the system settings, not at the environment variables. Also, when an encoding suffix such as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE @@ -36,9 +41,9 @@ int main () if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) return 1; -#else +# else if (setlocale (LC_ALL, "") == NULL) return 1; -#endif +# endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. @@ -47,32 +52,36 @@ int main () some unit tests fail. On MirBSD 10, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "UTF-8". */ -#if HAVE_LANGINFO_CODESET +# if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 || strcmp (cs, "UTF-8") == 0) return 1; } -#endif -#ifdef __CYGWIN__ +# endif +# ifdef __CYGWIN__ /* On Cygwin, avoid locale names without encoding suffix, because the locale_charset() function relies on the encoding suffix. Note that LC_ALL is set on the command line. */ if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; -#endif +# endif /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding (except on MirBSD). */ - t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; - if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; - for (p = buf; *p != '\0'; p++) - if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) - return 1; + { + const char *p; + t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; + if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; + for (p = buf; *p != '\0'; p++) + if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) + return 1; + } /* Check whether a typical GB18030 multibyte sequence is recognized as a single wide character. This excludes the GB2312 and GBK encodings. */ if (mblen ("\203\062\332\066", 5) != 4) return 1; return 0; +#endif } changequote([,])dnl ])]) diff --git a/gnulib/import/m4/localtime-buffer.m4 b/gnulib/import/m4/localtime-buffer.m4 new file mode 100644 index 0000000..6d99828 --- /dev/null +++ b/gnulib/import/m4/localtime-buffer.m4 @@ -0,0 +1,21 @@ +# localtime-buffer.m4 serial 1 +dnl Copyright (C) 2017-2019 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_LOCALTIME_BUFFER_DEFAULTS], +[ + NEED_LOCALTIME_BUFFER=0 +]) + +dnl Macro invoked from other modules, to signal that the compilation of +dnl module 'localtime-buffer' is needed. +AC_DEFUN([gl_LOCALTIME_BUFFER_NEEDED], +[ + AC_REQUIRE([gl_LOCALTIME_BUFFER_DEFAULTS]) + AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + NEED_LOCALTIME_BUFFER=1 + REPLACE_GMTIME=1 + REPLACE_LOCALTIME=1 +]) diff --git a/gnulib/import/m4/lock.m4 b/gnulib/import/m4/lock.m4 index 1e83e23..93b76fa 100644 --- a/gnulib/import/m4/lock.m4 +++ b/gnulib/import/m4/lock.m4 @@ -1,5 +1,5 @@ -# lock.m4 serial 13 (gettext-0.18.2) -dnl Copyright (C) 2005-2016 Free Software Foundation, Inc. +# lock.m4 serial 14 +dnl Copyright (C) 2005-2019 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. @@ -12,11 +12,16 @@ AC_DEFUN([gl_LOCK], if test "$gl_threads_api" = posix; then # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the # pthread_rwlock_* functions. + has_rwlock=false AC_CHECK_TYPE([pthread_rwlock_t], - [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], + [has_rwlock=true + AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], [Define if the POSIX multithreading library has read/write locks.])], [], [#include <pthread.h>]) + if $has_rwlock; then + gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER + fi # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. AC_COMPILE_IFELSE([ AC_LANG_PROGRAM( diff --git a/gnulib/import/m4/longlong.m4 b/gnulib/import/m4/longlong.m4 index 36d8b12..08d0e36 100644 --- a/gnulib/import/m4/longlong.m4 +++ b/gnulib/import/m4/longlong.m4 @@ -1,14 +1,15 @@ -# longlong.m4 serial 17 -dnl Copyright (C) 1999-2007, 2009-2016 Free Software Foundation, Inc. +# longlong.m4 serial 18 +dnl Copyright (C) 1999-2007, 2009-2019 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_PREREQ([2.62]) + # Define HAVE_LONG_LONG_INT if 'long long int' works. -# This fixes a bug in Autoconf 2.61, and can be faster -# than what's in Autoconf 2.62 through 2.68. +# This can be faster than what's in Autoconf 2.62 through 2.68. # Note: If the type 'long long int' exists but is only 32 bits large # (as on some very old compilers), HAVE_LONG_LONG_INT will not be @@ -56,8 +57,7 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], ]) # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. -# This fixes a bug in Autoconf 2.61, and can be faster -# than what's in Autoconf 2.62 through 2.68. +# This can be faster than what's in Autoconf 2.62 through 2.68. # Note: If the type 'unsigned long long int' exists but is only 32 bits # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT diff --git a/gnulib/import/m4/lstat.m4 b/gnulib/import/m4/lstat.m4 index e143d5c..be6d3f2 100644 --- a/gnulib/import/m4/lstat.m4 +++ b/gnulib/import/m4/lstat.m4 @@ -1,6 +1,6 @@ -# serial 27 +# serial 33 -# Copyright (C) 1997-2001, 2003-2016 Free Software Foundation, Inc. +# Copyright (C) 1997-2001, 2003-2019 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10,14 +10,15 @@ dnl From Jim Meyering. AC_DEFUN([gl_FUNC_LSTAT], [ + AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) dnl If lstat does not exist, the replacement <sys/stat.h> does dnl "#define lstat stat", and lstat.c is a no-op. AC_CHECK_FUNCS_ONCE([lstat]) if test $ac_cv_func_lstat = yes; then AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) - case "$gl_cv_func_lstat_dereferences_slashed_symlink" in - *no) + case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in + solaris* | *no) REPLACE_LSTAT=1 ;; esac @@ -33,6 +34,7 @@ AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], [ dnl We don't use AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK any more, because it dnl is no longer maintained in Autoconf and because it invokes AC_LIBOBJ. + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether lstat correctly handles trailing slash], [gl_cv_func_lstat_dereferences_slashed_symlink], [rm -f conftest.sym conftest.file @@ -51,12 +53,18 @@ 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 - *-gnu*) + 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" ;; - *) - # If we don't know, assume the worst. + mingw*) + # Guess no on native Windows. gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; + *) + # If we don't know, obey --enable-cross-guesses. + gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; esac ]) rm -f conftest.sym conftest.file diff --git a/gnulib/import/m4/malloc.m4 b/gnulib/import/m4/malloc.m4 index c393690..6555dee 100644 --- a/gnulib/import/m4/malloc.m4 +++ b/gnulib/import/m4/malloc.m4 @@ -1,13 +1,11 @@ -# malloc.m4 serial 15 -dnl Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. +# malloc.m4 serial 20 +dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -m4_version_prereq([2.70], [] ,[ - # This is adapted with modifications from upstream Autoconf here: -# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c +# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c AC_DEFUN([_AC_FUNC_MALLOC_IF], [ AC_REQUIRE([AC_HEADER_STDC])dnl @@ -32,19 +30,24 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF], [ac_cv_func_malloc_0_nonnull=no], [case "$host_os" in # Guess yes on platforms where we know the result. - *-gnu* | freebsd* | netbsd* | openbsd* \ + *-gnu* | gnu* | *-musl* | freebsd* | netbsd* | openbsd* \ | hpux* | solaris* | cygwin* | mingw*) - ac_cv_func_malloc_0_nonnull=yes ;; - # If we don't know, assume the worst. - *) ac_cv_func_malloc_0_nonnull=no ;; + ac_cv_func_malloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; esac ]) ]) - AS_IF([test $ac_cv_func_malloc_0_nonnull = yes], [$1], [$2]) + case "$ac_cv_func_malloc_0_nonnull" in + *yes) + $1 + ;; + *) + $2 + ;; + esac ])# _AC_FUNC_MALLOC_IF -]) - # gl_FUNC_MALLOC_GNU # ------------------ # Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if @@ -91,7 +94,7 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX], AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[]], - [[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + [[#if defined _WIN32 && ! defined __CYGWIN__ choke me #endif ]])], diff --git a/gnulib/import/m4/malloca.m4 b/gnulib/import/m4/malloca.m4 index b368b20..820f40a 100644 --- a/gnulib/import/m4/malloca.m4 +++ b/gnulib/import/m4/malloca.m4 @@ -1,5 +1,5 @@ # malloca.m4 serial 1 -dnl Copyright (C) 2003-2004, 2006-2007, 2009-2016 Free Software Foundation, +dnl Copyright (C) 2003-2004, 2006-2007, 2009-2019 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gnulib/import/m4/math_h.m4 b/gnulib/import/m4/math_h.m4 index 35d07ee..3d5af84 100644 --- a/gnulib/import/m4/math_h.m4 +++ b/gnulib/import/m4/math_h.m4 @@ -1,5 +1,5 @@ -# math_h.m4 serial 114 -dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +# math_h.m4 serial 119 +dnl Copyright (C) 2007-2019 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. @@ -256,13 +256,22 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) + REPLACE_ACOSF=0; AC_SUBST([REPLACE_ACOSF]) + REPLACE_ASINF=0; AC_SUBST([REPLACE_ASINF]) + REPLACE_ATANF=0; AC_SUBST([REPLACE_ATANF]) + REPLACE_ATAN2F=0; AC_SUBST([REPLACE_ATAN2F]) REPLACE_CBRTF=0; AC_SUBST([REPLACE_CBRTF]) REPLACE_CBRTL=0; AC_SUBST([REPLACE_CBRTL]) REPLACE_CEIL=0; AC_SUBST([REPLACE_CEIL]) REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) + REPLACE_COSF=0; AC_SUBST([REPLACE_COSF]) + REPLACE_COSHF=0; AC_SUBST([REPLACE_COSHF]) + REPLACE_EXPF=0; AC_SUBST([REPLACE_EXPF]) + REPLACE_EXPL=0; AC_SUBST([REPLACE_EXPL]) REPLACE_EXPM1=0; AC_SUBST([REPLACE_EXPM1]) REPLACE_EXPM1F=0; AC_SUBST([REPLACE_EXPM1F]) + REPLACE_EXPM1L=0; AC_SUBST([REPLACE_EXPM1L]) REPLACE_EXP2=0; AC_SUBST([REPLACE_EXP2]) REPLACE_EXP2L=0; AC_SUBST([REPLACE_EXP2L]) REPLACE_FABSL=0; AC_SUBST([REPLACE_FABSL]) @@ -284,6 +293,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_HYPOTL=0; AC_SUBST([REPLACE_HYPOTL]) REPLACE_ILOGB=0; AC_SUBST([REPLACE_ILOGB]) REPLACE_ILOGBF=0; AC_SUBST([REPLACE_ILOGBF]) + REPLACE_ILOGBL=0; AC_SUBST([REPLACE_ILOGBL]) REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) @@ -310,12 +320,18 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_REMAINDER=0; AC_SUBST([REPLACE_REMAINDER]) REPLACE_REMAINDERF=0; AC_SUBST([REPLACE_REMAINDERF]) REPLACE_REMAINDERL=0; AC_SUBST([REPLACE_REMAINDERL]) + REPLACE_RINTL=0; AC_SUBST([REPLACE_RINTL]) REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND]) REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF]) REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL]) REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC]) + REPLACE_SINF=0; AC_SUBST([REPLACE_SINF]) + REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) + REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) + REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) + REPLACE_TANHF=0; AC_SUBST([REPLACE_TANHF]) REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) diff --git a/gnulib/import/m4/mbrtowc.m4 b/gnulib/import/m4/mbrtowc.m4 index d370fcc..16e166b 100644 --- a/gnulib/import/m4/mbrtowc.m4 +++ b/gnulib/import/m4/mbrtowc.m4 @@ -1,5 +1,5 @@ -# mbrtowc.m4 serial 27 -*- coding: utf-8 -*- -dnl Copyright (C) 2001-2002, 2004-2005, 2008-2016 Free Software Foundation, +# mbrtowc.m4 serial 33 -*- coding: utf-8 -*- +dnl Copyright (C) 2001-2002, 2004-2005, 2008-2019 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -126,6 +126,7 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_JA]) + AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], [gl_cv_func_mbrtowc_incomplete_state], @@ -164,13 +165,46 @@ int main () memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) if (mbsinit (&state)) - return 1; + return 2; } return 0; }]])], [gl_cv_func_mbrtowc_incomplete_state=yes], [gl_cv_func_mbrtowc_incomplete_state=no], [:]) + else + if test $LOCALE_FR_UTF8 != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <locale.h> +#include <string.h> +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be + included before <wchar.h>. */ +#include <stddef.h> +#include <stdio.h> +#include <time.h> +#include <wchar.h> +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + const char input[] = "B\303\274\303\237er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; + } + return 0; +}]])], + [gl_cv_func_mbrtowc_incomplete_state=yes], + [gl_cv_func_mbrtowc_incomplete_state=no], + [:]) + fi fi ]) ]) @@ -224,7 +258,7 @@ int main () memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, input + 3, 6, &state) != 4 && mbtowc (&wc, input + 3, 6) == 4) - return 1; + return 2; } return 0; }]])], @@ -352,7 +386,7 @@ int main () mbrtowc (&wc, NULL, 5, &state); /* Check that wc was not modified. */ if (wc != (wchar_t) 0xBADFACE) - return 1; + return 2; } return 0; }]])], @@ -539,7 +573,7 @@ int main () memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "", 1, &state) != 0) - return 1; + return 2; } return 0; }]])], @@ -563,10 +597,11 @@ AC_DEFUN([gl_MBRTOWC_EMPTY_INPUT], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on AIX and glibc systems. - aix* | *-gnu*) - gl_cv_func_mbrtowc_empty_input="guessing no" ;; - *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; + # Guess no on AIX and glibc systems. + aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; + *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; esac changequote([,])dnl AC_RUN_IFELSE( @@ -592,12 +627,13 @@ dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932 AC_DEFUN([gl_MBRTOWC_C_LOCALE], [ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether the C locale is free of encoding errors], [gl_cv_C_locale_sans_EILSEQ], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. - gl_cv_C_locale_sans_EILSEQ="guessing no" + gl_cv_C_locale_sans_EILSEQ="$gl_cross_guess_normal" AC_RUN_IFELSE( [AC_LANG_PROGRAM( @@ -608,7 +644,7 @@ AC_DEFUN([gl_MBRTOWC_C_LOCALE], int i; char *locale = setlocale (LC_ALL, "C"); if (! locale) - return 1; + return 2; for (i = CHAR_MIN; i <= CHAR_MAX; i++) { char c = i; @@ -616,17 +652,23 @@ AC_DEFUN([gl_MBRTOWC_C_LOCALE], mbstate_t mbs = { 0, }; size_t ss = mbrtowc (&wc, &c, 1, &mbs); if (1 < ss) - return 1; + return 3; } return 0; ]])], [gl_cv_C_locale_sans_EILSEQ=yes], [gl_cv_C_locale_sans_EILSEQ=no], - [:])]) + [case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_C_locale_sans_EILSEQ="guessing yes" ;; + esac + ]) + ]) ]) # Prerequisites of lib/mbrtowc.c. AC_DEFUN([gl_PREREQ_MBRTOWC], [ + AC_REQUIRE([AC_C_INLINE]) : ]) @@ -639,7 +681,7 @@ AC_DEFUN([AC_FUNC_MBRTOWC], [ dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared], - gl_cv_func_mbrtowc, + [gl_cv_func_mbrtowc], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be @@ -655,8 +697,8 @@ AC_DEFUN([AC_FUNC_MBRTOWC], size_t n = 1; mbstate_t state; return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])], - gl_cv_func_mbrtowc=yes, - gl_cv_func_mbrtowc=no)]) + [gl_cv_func_mbrtowc=yes], + [gl_cv_func_mbrtowc=no])]) if test $gl_cv_func_mbrtowc = yes; then AC_DEFINE([HAVE_MBRTOWC], [1], [Define to 1 if mbrtowc and mbstate_t are properly declared.]) diff --git a/gnulib/import/m4/mbsinit.m4 b/gnulib/import/m4/mbsinit.m4 index 88f0836..e2f45e7 100644 --- a/gnulib/import/m4/mbsinit.m4 +++ b/gnulib/import/m4/mbsinit.m4 @@ -1,5 +1,5 @@ # mbsinit.m4 serial 8 -dnl Copyright (C) 2008, 2010-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2008, 2010-2019 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. diff --git a/gnulib/import/m4/mbsrtowcs.m4 b/gnulib/import/m4/mbsrtowcs.m4 index 3b5dc6e..cbdde2c 100644 --- a/gnulib/import/m4/mbsrtowcs.m4 +++ b/gnulib/import/m4/mbsrtowcs.m4 @@ -1,5 +1,5 @@ # mbsrtowcs.m4 serial 13 -dnl Copyright (C) 2008-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2019 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. diff --git a/gnulib/import/m4/mbstate_t.m4 b/gnulib/import/m4/mbstate_t.m4 index 0a8eae2..f669753 100644 --- a/gnulib/import/m4/mbstate_t.m4 +++ b/gnulib/import/m4/mbstate_t.m4 @@ -1,5 +1,5 @@ # mbstate_t.m4 serial 13 -dnl Copyright (C) 2000-2002, 2008-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2000-2002, 2008-2019 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. diff --git a/gnulib/import/m4/memchr.m4 b/gnulib/import/m4/memchr.m4 index 25d32f0..c12d20a 100644 --- a/gnulib/import/m4/memchr.m4 +++ b/gnulib/import/m4/memchr.m4 @@ -1,11 +1,13 @@ -# memchr.m4 serial 12 -dnl Copyright (C) 2002-2004, 2009-2016 Free Software Foundation, Inc. +# memchr.m4 serial 15 +dnl Copyright (C) 2002-2004, 2009-2019 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_ONCE([gl_FUNC_MEMCHR], [ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + dnl Check for prerequisites for memory fence checks. gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) @@ -23,10 +25,12 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], if test $HAVE_MEMCHR = 1; then # Detect platform-specific bugs in some versions of glibc: # memchr should not dereference anything with length 0 - # http://bugzilla.redhat.com/499689 + # https://bugzilla.redhat.com/show_bug.cgi?id=499689 # memchr should not dereference overestimated length after a match - # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 - # http://sourceware.org/bugzilla/show_bug.cgi?id=10162 + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 + # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 + # memchr should cast the second argument to 'unsigned char'. + # This bug exists in Android 4.3. # Assume that memchr works on platforms that lack mprotect. AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ @@ -72,13 +76,33 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], if (memchr (fence - 1, 0, 3) != fence - 1) result |= 4; } + /* Test against bug on Android 4.3. */ + { + char input[3]; + input[0] = 'a'; + input[1] = 'b'; + input[2] = 'c'; + if (memchr (input, 0x789abc00 | 'b', 3) != input + 1) + result |= 8; + } return result; -]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], - [dnl Be pessimistic for now. - gl_cv_func_memchr_works="guessing no"])]) - if test "$gl_cv_func_memchr_works" != yes; then - REPLACE_MEMCHR=1 - fi +]])], + [gl_cv_func_memchr_works=yes], + [gl_cv_func_memchr_works=no], + [case "$host_os" in + # Guess no on Android. + linux*-android*) gl_cv_func_memchr_works="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_memchr_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; + esac + ]) + ]) + case "$gl_cv_func_memchr_works" in + *yes) ;; + *) REPLACE_MEMCHR=1 ;; + esac fi ]) diff --git a/gnulib/import/m4/memmem.m4 b/gnulib/import/m4/memmem.m4 index 981ede7..dcccefa 100644 --- a/gnulib/import/m4/memmem.m4 +++ b/gnulib/import/m4/memmem.m4 @@ -1,5 +1,5 @@ -# memmem.m4 serial 24 -dnl Copyright (C) 2002-2004, 2007-2016 Free Software Foundation, Inc. +# memmem.m4 serial 26 +dnl Copyright (C) 2002-2004, 2007-2019 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. @@ -21,7 +21,7 @@ AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE], if test $ac_cv_have_decl_memmem = no; then HAVE_DECL_MEMMEM=0 else - dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092. + dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092. dnl Also check that we handle empty needles correctly. AC_CACHE_CHECK([whether memmem works], [gl_cv_func_memmem_works_always], @@ -68,7 +68,7 @@ AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE], #endif ], [gl_cv_func_memmem_works_always="guessing yes"], - [gl_cv_func_memmem_works_always="guessing no"]) + [gl_cv_func_memmem_works_always="$gl_cross_guess_normal"]) ]) ]) case "$gl_cv_func_memmem_works_always" in @@ -113,6 +113,9 @@ static void quit (int sig) { _exit (sig + 128); } if (!memmem (haystack, 2 * m + 1, needle, m + 1)) result |= 1; } + /* Free allocated memory, in case some sanitizer is watching. */ + free (haystack); + free (needle); return result; ]])], [gl_cv_func_memmem_works_fast=yes], [gl_cv_func_memmem_works_fast=no], @@ -135,7 +138,7 @@ static void quit (int sig) { _exit (sig + 128); } #endif ], [gl_cv_func_memmem_works_fast="guessing yes"], - [gl_cv_func_memmem_works_fast="guessing no"]) + [gl_cv_func_memmem_works_fast="$gl_cross_guess_normal"]) ]) ]) case "$gl_cv_func_memmem_works_fast" in diff --git a/gnulib/import/m4/mempcpy.m4 b/gnulib/import/m4/mempcpy.m4 index 6991f29..b6090ee 100644 --- a/gnulib/import/m4/mempcpy.m4 +++ b/gnulib/import/m4/mempcpy.m4 @@ -1,5 +1,5 @@ # mempcpy.m4 serial 11 -dnl Copyright (C) 2003-2004, 2006-2007, 2009-2016 Free Software Foundation, +dnl Copyright (C) 2003-2004, 2006-2007, 2009-2019 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gnulib/import/m4/memrchr.m4 b/gnulib/import/m4/memrchr.m4 index 6e7df5c..e907590 100644 --- a/gnulib/import/m4/memrchr.m4 +++ b/gnulib/import/m4/memrchr.m4 @@ -1,5 +1,5 @@ # memrchr.m4 serial 10 -dnl Copyright (C) 2002-2003, 2005-2007, 2009-2016 Free Software Foundation, +dnl Copyright (C) 2002-2003, 2005-2007, 2009-2019 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gnulib/import/m4/mkdir.m4 b/gnulib/import/m4/mkdir.m4 index 574092b..6451fb7 100644 --- a/gnulib/import/m4/mkdir.m4 +++ b/gnulib/import/m4/mkdir.m4 @@ -1,6 +1,6 @@ -# serial 11 +# serial 16 -# Copyright (C) 2001, 2003-2004, 2006, 2008-2016 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003-2004, 2006, 2008-2019 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. @@ -23,10 +23,21 @@ AC_DEFUN([gl_FUNC_MKDIR], [gl_cv_func_mkdir_trailing_slash_works=yes], [gl_cv_func_mkdir_trailing_slash_works=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_mkdir_trailing_slash_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;; + # Guess yes on MSVC, no on mingw. + mingw*) AC_EGREP_CPP([Known], [ +#ifdef _MSC_VER + Known +#endif + ], + [gl_cv_func_mkdir_trailing_slash_works="guessing yes"], + [gl_cv_func_mkdir_trailing_slash_works="guessing no"]) + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_mkdir_trailing_slash_works="$gl_cross_guess_normal" ;; esac ]) rm -rf conftest.dir @@ -49,10 +60,14 @@ AC_DEFUN([gl_FUNC_MKDIR], [gl_cv_func_mkdir_trailing_dot_works=yes], [gl_cv_func_mkdir_trailing_dot_works=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_mkdir_trailing_dot_works="guessing no" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_mkdir_trailing_dot_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_mkdir_trailing_dot_works="$gl_cross_guess_normal" ;; esac ]) rm -rf conftest.dir diff --git a/gnulib/import/m4/mkdtemp.m4 b/gnulib/import/m4/mkdtemp.m4 index a2edd39..412bb39 100644 --- a/gnulib/import/m4/mkdtemp.m4 +++ b/gnulib/import/m4/mkdtemp.m4 @@ -1,5 +1,5 @@ # mkdtemp.m4 serial 8 -dnl Copyright (C) 2001-2003, 2006-2007, 2009-2016 Free Software Foundation, +dnl Copyright (C) 2001-2003, 2006-2007, 2009-2019 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gnulib/import/m4/mkostemp.m4 b/gnulib/import/m4/mkostemp.m4 index 1f44a03..56f566c 100644 --- a/gnulib/import/m4/mkostemp.m4 +++ b/gnulib/import/m4/mkostemp.m4 @@ -1,5 +1,5 @@ # mkostemp.m4 serial 2 -dnl Copyright (C) 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2019 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. diff --git a/gnulib/import/m4/mmap-anon.m4 b/gnulib/import/m4/mmap-anon.m4 index 853c89d..50c3808 100644 --- a/gnulib/import/m4/mmap-anon.m4 +++ b/gnulib/import/m4/mmap-anon.m4 @@ -1,5 +1,5 @@ # mmap-anon.m4 serial 10 -dnl Copyright (C) 2005, 2007, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2007, 2009-2019 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. diff --git a/gnulib/import/m4/mode_t.m4 b/gnulib/import/m4/mode_t.m4 index 0cd40db..ba840dc 100644 --- a/gnulib/import/m4/mode_t.m4 +++ b/gnulib/import/m4/mode_t.m4 @@ -1,5 +1,5 @@ # mode_t.m4 serial 2 -dnl Copyright (C) 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2019 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. diff --git a/gnulib/import/m4/msvc-inval.m4 b/gnulib/import/m4/msvc-inval.m4 index f5e4c89..4b95876 100644 --- a/gnulib/import/m4/msvc-inval.m4 +++ b/gnulib/import/m4/msvc-inval.m4 @@ -1,5 +1,5 @@ # msvc-inval.m4 serial 1 -dnl Copyright (C) 2011-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2019 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. diff --git a/gnulib/import/m4/msvc-nothrow.m4 b/gnulib/import/m4/msvc-nothrow.m4 index 58f5c0b..7e73b40 100644 --- a/gnulib/import/m4/msvc-nothrow.m4 +++ b/gnulib/import/m4/msvc-nothrow.m4 @@ -1,5 +1,5 @@ # msvc-nothrow.m4 serial 1 -dnl Copyright (C) 2011-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2019 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. diff --git a/gnulib/import/m4/multiarch.m4 b/gnulib/import/m4/multiarch.m4 index 43b5d05..d48316e 100644 --- a/gnulib/import/m4/multiarch.m4 +++ b/gnulib/import/m4/multiarch.m4 @@ -1,5 +1,5 @@ # multiarch.m4 serial 7 -dnl Copyright (C) 2008-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2019 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. diff --git a/gnulib/import/m4/netinet_in_h.m4 b/gnulib/import/m4/netinet_in_h.m4 index 93dcc68..0f96cae 100644 --- a/gnulib/import/m4/netinet_in_h.m4 +++ b/gnulib/import/m4/netinet_in_h.m4 @@ -1,5 +1,5 @@ # netinet_in_h.m4 serial 5 -dnl Copyright (C) 2006-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2019 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. diff --git a/gnulib/import/m4/nocrash.m4 b/gnulib/import/m4/nocrash.m4 index d8dd8f1..8577038 100644 --- a/gnulib/import/m4/nocrash.m4 +++ b/gnulib/import/m4/nocrash.m4 @@ -1,5 +1,5 @@ -# nocrash.m4 serial 4 -dnl Copyright (C) 2005, 2009-2016 Free Software Foundation, Inc. +# nocrash.m4 serial 5 +dnl Copyright (C) 2005, 2009-2019 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. @@ -53,7 +53,7 @@ nocrash_init (void) /* Allocate a port on which the thread shall listen for exceptions. */ if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) == KERN_SUCCESS) { - /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ if (mach_port_insert_right (self, our_exception_port, our_exception_port, MACH_MSG_TYPE_MAKE_SEND) == KERN_SUCCESS) { @@ -72,14 +72,14 @@ nocrash_init (void) for a particular thread. This has the effect that when our exception port gets the message, the thread specific exception port has already been asked, and we don't need to bother about it. - See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ task_set_exception_ports (self, mask, our_exception_port, EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); } } } } -#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> diff --git a/gnulib/import/m4/off_t.m4 b/gnulib/import/m4/off_t.m4 index 282751b..711a2d4 100644 --- a/gnulib/import/m4/off_t.m4 +++ b/gnulib/import/m4/off_t.m4 @@ -1,5 +1,5 @@ # off_t.m4 serial 1 -dnl Copyright (C) 2012-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2012-2019 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. diff --git a/gnulib/import/m4/onceonly.m4 b/gnulib/import/m4/onceonly.m4 deleted file mode 100644 index c0c9e2c..0000000 --- a/gnulib/import/m4/onceonly.m4 +++ /dev/null @@ -1,104 +0,0 @@ -# onceonly.m4 serial 9 -dnl Copyright (C) 2002-2003, 2005-2006, 2008-2016 Free Software Foundation, -dnl Inc. -dnl -dnl This file is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3 of the License, or -dnl (at your option) any later version. -dnl -dnl This file is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this file. If not, see <http://www.gnu.org/licenses/>. -dnl -dnl As a special exception to the GNU General Public License, -dnl this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl This file defines some "once only" variants of standard autoconf macros. -dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS -dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS -dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS -dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL -dnl The advantage is that the check for each of the headers/functions/decls -dnl will be put only once into the 'configure' file. It keeps the size of -dnl the 'configure' file down, and avoids redundant output when 'configure' -dnl is run. -dnl The drawback is that the checks cannot be conditionalized. If you write -dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi -dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to -dnl empty, and the check will be inserted before the body of the AC_DEFUNed -dnl function. - -dnl The original code implemented AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE -dnl in terms of AC_DEFUN and AC_REQUIRE. This implementation uses diversions to -dnl named sections DEFAULTS and INIT_PREPARE in order to check all requested -dnl headers at once, thus reducing the size of 'configure'. It is known to work -dnl with autoconf 2.57..2.62 at least . The size reduction is ca. 9%. - -dnl Autoconf version 2.59 plus gnulib is required; this file is not needed -dnl with Autoconf 2.60 or greater. But note that autoconf's implementation of -dnl AC_CHECK_DECLS_ONCE expects a comma-separated list of symbols as first -dnl argument! -AC_PREREQ([2.59]) - -# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of -# AC_CHECK_HEADERS(HEADER1 HEADER2 ...). -AC_DEFUN([AC_CHECK_HEADERS_ONCE], [ - : - m4_foreach_w([gl_HEADER_NAME], [$1], [ - AC_DEFUN([gl_CHECK_HEADER_]m4_quote(m4_translit(gl_HEADER_NAME, - [./-], [___])), [ - m4_divert_text([INIT_PREPARE], - [gl_header_list="$gl_header_list gl_HEADER_NAME"]) - gl_HEADERS_EXPANSION - AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])), - [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.]) - ]) - AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(m4_translit(gl_HEADER_NAME, - [./-], [___]))) - ]) -]) -m4_define([gl_HEADERS_EXPANSION], [ - m4_divert_text([DEFAULTS], [gl_header_list=]) - AC_CHECK_HEADERS([$gl_header_list]) - m4_define([gl_HEADERS_EXPANSION], []) -]) - -# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of -# AC_CHECK_FUNCS(FUNC1 FUNC2 ...). -AC_DEFUN([AC_CHECK_FUNCS_ONCE], [ - : - m4_foreach_w([gl_FUNC_NAME], [$1], [ - AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [ - m4_divert_text([INIT_PREPARE], - [gl_func_list="$gl_func_list gl_FUNC_NAME"]) - gl_FUNCS_EXPANSION - AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])), - [Define to 1 if you have the ']m4_defn([gl_FUNC_NAME])[' function.]) - ]) - AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME])) - ]) -]) -m4_define([gl_FUNCS_EXPANSION], [ - m4_divert_text([DEFAULTS], [gl_func_list=]) - AC_CHECK_FUNCS([$gl_func_list]) - m4_define([gl_FUNCS_EXPANSION], []) -]) - -# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of -# AC_CHECK_DECLS(DECL1, DECL2, ...). -AC_DEFUN([AC_CHECK_DECLS_ONCE], [ - : - m4_foreach_w([gl_DECL_NAME], [$1], [ - AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [ - AC_CHECK_DECLS(m4_defn([gl_DECL_NAME])) - ]) - AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME])) - ]) -]) diff --git a/gnulib/import/m4/open-cloexec.m4 b/gnulib/import/m4/open-cloexec.m4 new file mode 100644 index 0000000..52498d9 --- /dev/null +++ b/gnulib/import/m4/open-cloexec.m4 @@ -0,0 +1,21 @@ +# Test whether O_CLOEXEC is defined. + +dnl Copyright 2017-2019 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_PREPROC_O_CLOEXEC], +[ + AC_CACHE_CHECK([for O_CLOEXEC], + [gl_cv_macro_O_CLOEXEC], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include <fcntl.h> + #ifndef O_CLOEXEC + choke me; + #endif + ]], + [[return O_CLOEXEC;]])], + [gl_cv_macro_O_CLOEXEC=yes], + [gl_cv_macro_O_CLOEXEC=no])]) +]) diff --git a/gnulib/import/m4/open-slash.m4 b/gnulib/import/m4/open-slash.m4 new file mode 100644 index 0000000..a8756ae --- /dev/null +++ b/gnulib/import/m4/open-slash.m4 @@ -0,0 +1,59 @@ +# open-slash.m4 serial 1 +dnl Copyright (C) 2007-2019 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 Tests whether open() and creat() recognize a trailing slash. +dnl Sets gl_cv_func_open_slash. +AC_DEFUN([gl_OPEN_TRAILING_SLASH_BUG], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + dnl open("foo/") should not create a file when the file name has a + dnl trailing slash. FreeBSD only has the problem on symlinks. + AC_CHECK_FUNCS_ONCE([lstat]) + AC_CACHE_CHECK([whether open recognizes a trailing slash], + [gl_cv_func_open_slash], + [# Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + touch conftest.tmp + ln -s conftest.tmp conftest.lnk + fi + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <fcntl.h> +#if HAVE_UNISTD_H +# include <unistd.h> +#endif +int main () +{ + int result = 0; +#if HAVE_LSTAT + if (open ("conftest.lnk/", O_RDONLY) != -1) + result |= 1; +#endif + if (open ("conftest.sl/", O_CREAT, 0600) >= 0) + result |= 2; + return result; +}]])], + [gl_cv_func_open_slash=yes], + [gl_cv_func_open_slash=no], + [ +changequote(,)dnl + case "$host_os" in + freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) + gl_cv_func_open_slash="guessing no" ;; + *) + gl_cv_func_open_slash="guessing yes" ;; + esac +changequote([,])dnl + ]) + rm -f conftest.sl conftest.tmp conftest.lnk + ]) + case "$gl_cv_func_open_slash" in + *no) + AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1], + [Define to 1 if open() fails to recognize a trailing slash.]) + ;; + esac +]) diff --git a/gnulib/import/m4/open.m4 b/gnulib/import/m4/open.m4 index 53d3038..6cf0beb 100644 --- a/gnulib/import/m4/open.m4 +++ b/gnulib/import/m4/open.m4 @@ -1,5 +1,5 @@ -# open.m4 serial 14 -dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +# open.m4 serial 15 +dnl Copyright (C) 2007-2019 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. @@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_OPEN], [ AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) case "$host_os" in mingw* | pw*) REPLACE_OPEN=1 @@ -15,48 +16,12 @@ AC_DEFUN([gl_FUNC_OPEN], dnl open("foo/") should not create a file when the file name has a dnl trailing slash. FreeBSD only has the problem on symlinks. AC_CHECK_FUNCS_ONCE([lstat]) - AC_CACHE_CHECK([whether open recognizes a trailing slash], - [gl_cv_func_open_slash], - [# Assume that if we have lstat, we can also check symlinks. - if test $ac_cv_func_lstat = yes; then - touch conftest.tmp - ln -s conftest.tmp conftest.lnk - fi - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <fcntl.h> -#if HAVE_UNISTD_H -# include <unistd.h> -#endif -int main () -{ - int result = 0; -#if HAVE_LSTAT - if (open ("conftest.lnk/", O_RDONLY) != -1) - result |= 1; -#endif - if (open ("conftest.sl/", O_CREAT, 0600) >= 0) - result |= 2; - return result; -}]])], - [gl_cv_func_open_slash=yes], - [gl_cv_func_open_slash=no], - [ -changequote(,)dnl - case "$host_os" in - freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) - gl_cv_func_open_slash="guessing no" ;; - *) - gl_cv_func_open_slash="guessing yes" ;; - esac -changequote([,])dnl - ]) - rm -f conftest.sl conftest.tmp conftest.lnk - ]) + if test "$gl_cv_macro_O_CLOEXEC" != yes; then + REPLACE_OPEN=1 + fi + gl_OPEN_TRAILING_SLASH_BUG case "$gl_cv_func_open_slash" in *no) - AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1], - [Define to 1 if open() fails to recognize a trailing slash.]) REPLACE_OPEN=1 ;; esac diff --git a/gnulib/import/m4/openat.m4 b/gnulib/import/m4/openat.m4 index fdeb1de..005a2b4 100644 --- a/gnulib/import/m4/openat.m4 +++ b/gnulib/import/m4/openat.m4 @@ -1,7 +1,7 @@ -# serial 45 +# serial 46 # See if we need to use our replacement for Solaris' openat et al functions. -dnl Copyright (C) 2004-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2019 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. @@ -14,10 +14,12 @@ AC_DEFUN([gl_FUNC_OPENAT], AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_FUNCS_ONCE([openat]) AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) - case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink in - yes+*yes) + AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) + case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink+$gl_cv_macro_O_CLOEXEC in + yes+*yes+yes) ;; yes+*) + # Solaris 10 lacks O_CLOEXEC. # Solaris 9 has *at functions, but uniformly mishandles trailing # slash in all of them. REPLACE_OPENAT=1 diff --git a/gnulib/import/m4/opendir.m4 b/gnulib/import/m4/opendir.m4 index ffaa6ae..8f0d804 100644 --- a/gnulib/import/m4/opendir.m4 +++ b/gnulib/import/m4/opendir.m4 @@ -1,5 +1,5 @@ -# opendir.m4 serial 4 -dnl Copyright (C) 2011-2016 Free Software Foundation, Inc. +# opendir.m4 serial 5 +dnl Copyright (C) 2011-2019 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. @@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_OPENDIR], [ AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS([opendir]) if test $ac_cv_func_opendir = no; then diff --git a/gnulib/import/m4/pathmax.m4 b/gnulib/import/m4/pathmax.m4 index 6f8e59a..0770aca 100644 --- a/gnulib/import/m4/pathmax.m4 +++ b/gnulib/import/m4/pathmax.m4 @@ -1,5 +1,5 @@ -# pathmax.m4 serial 10 -dnl Copyright (C) 2002-2003, 2005-2006, 2009-2016 Free Software Foundation, +# pathmax.m4 serial 11 +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2019 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -29,7 +29,7 @@ AC_DEFUN([gl_PATHMAX_SNIPPET], [[ # undef PATH_MAX # define PATH_MAX 1024 #endif -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ # undef PATH_MAX # define PATH_MAX 260 #endif diff --git a/gnulib/import/m4/pthread_rwlock_rdlock.m4 b/gnulib/import/m4/pthread_rwlock_rdlock.m4 new file mode 100644 index 0000000..87886a3 --- /dev/null +++ b/gnulib/import/m4/pthread_rwlock_rdlock.m4 @@ -0,0 +1,185 @@ +# pthread_rwlock_rdlock.m4 serial 4 +dnl Copyright (C) 2017-2019 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 Bruno Haible. +dnl Inspired by +dnl https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c +dnl by Intel Corporation. + +dnl Test whether in a situation where +dnl - an rwlock is taken by a reader and has a writer waiting, +dnl - an additional reader requests the lock, +dnl - the waiting writer and the requesting reader threads have the same +dnl priority, +dnl the requesting reader thread gets blocked, so that at some point the +dnl waiting writer can acquire the lock. +dnl Without such a guarantee, when there a N readers and each of the readers +dnl spends more than 1/Nth of the time with the lock held, there is a high +dnl probability that the waiting writer will not get the lock in a given finite +dnl time, a phenomenon called "writer starvation". +dnl Without such a guarantee, applications have a hard time avoiding writer +dnl starvation. +dnl +dnl POSIX:2017 makes this requirement only for implementations that support TPS +dnl (Thread Priority Scheduling) and only for the scheduling policies SCHED_FIFO +dnl and SCHED_RR, see +dnl https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html +dnl but this test verifies the guarantee regardless of TPS and regardless of +dnl scheduling policy. +dnl Glibc does not provide this guarantee (and never will on Linux), see +dnl https://sourceware.org/bugzilla/show_bug.cgi?id=13701 +dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052 +AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], +[ + AC_REQUIRE([gl_THREADLIB_EARLY]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether pthread_rwlock_rdlock prefers a writer to a reader], + [gl_cv_pthread_rwlock_rdlock_prefer_writer], + [save_LIBS="$LIBS" + LIBS="$LIBS $LIBMULTITHREAD" + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <errno.h> +#include <pthread.h> +#include <stdlib.h> +#include <unistd.h> + +#define SUCCEED() exit (0) +#define FAILURE() exit (1) +#define UNEXPECTED(n) (exit (10 + (n))) + +/* The main thread creates the waiting writer and the requesting reader threads + in the default way; this guarantees that they have the same priority. + We can reuse the main thread as first reader thread. */ + +static pthread_rwlock_t lock; +static pthread_t reader1; +static pthread_t writer; +static pthread_t reader2; +static pthread_t timer; +/* Used to pass control from writer to reader2 and from reader2 to timer, + as in a relay race. + Passing control from one running thread to another running thread + is most likely faster than to create the second thread. */ +static pthread_mutex_t baton; + +static void * +timer_func (void *ignored) +{ + /* Step 13 (can be before or after step 12): + The timer thread takes the baton, then waits a moment to make sure + it can tell whether the second reader thread is blocked at step 12. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (13); + usleep (100000); + /* By the time we get here, it's clear that the second reader thread is + blocked at step 12. This is the desired behaviour. */ + SUCCEED (); +} + +static void * +reader2_func (void *ignored) +{ + int err; + + /* Step 8 (can be before or after step 7): + The second reader thread takes the baton, then waits a moment to make sure + the writer thread has reached step 7. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (8); + usleep (100000); + /* Step 9: The second reader thread requests the lock. */ + err = pthread_rwlock_tryrdlock (&lock); + if (err == 0) + FAILURE (); + else if (err != EBUSY) + UNEXPECTED (9); + /* Step 10: Launch a timer, to test whether the next call blocks. */ + if (pthread_create (&timer, NULL, timer_func, NULL)) + UNEXPECTED (10); + /* Step 11: Release the baton. */ + if (pthread_mutex_unlock (&baton)) + UNEXPECTED (11); + /* Step 12: The second reader thread requests the lock. */ + err = pthread_rwlock_rdlock (&lock); + if (err == 0) + FAILURE (); + else + UNEXPECTED (12); +} + +static void * +writer_func (void *ignored) +{ + /* Step 4: Take the baton, so that the second reader thread does not go ahead + too early. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (4); + /* Step 5: Create the second reader thread. */ + if (pthread_create (&reader2, NULL, reader2_func, NULL)) + UNEXPECTED (5); + /* Step 6: Release the baton. */ + if (pthread_mutex_unlock (&baton)) + UNEXPECTED (6); + /* Step 7: The writer thread requests the lock. */ + if (pthread_rwlock_wrlock (&lock)) + UNEXPECTED (7); + return NULL; +} + +int +main () +{ + reader1 = pthread_self (); + + /* Step 1: The main thread initializes the lock and the baton. */ + if (pthread_rwlock_init (&lock, NULL)) + UNEXPECTED (1); + if (pthread_mutex_init (&baton, NULL)) + UNEXPECTED (1); + /* Step 2: The main thread acquires the lock as a reader. */ + if (pthread_rwlock_rdlock (&lock)) + UNEXPECTED (2); + /* Step 3: Create the writer thread. */ + if (pthread_create (&writer, NULL, writer_func, NULL)) + UNEXPECTED (3); + /* Job done. Go to sleep. */ + for (;;) + { + sleep (1); + } +} +]])], + [gl_cv_pthread_rwlock_rdlock_prefer_writer=yes], + [gl_cv_pthread_rwlock_rdlock_prefer_writer=no], + [case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on musl systems. + *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on bionic systems. + *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess yes on native Windows with the mingw-w64 winpthreads library. + # Guess no on native Windows with the gnulib windows-rwlock module. + mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" + else + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" + fi + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; + esac + ]) + LIBS="$save_LIBS" + ]) + case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in + *yes) + AC_DEFINE([HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], [1], + [Define if the 'pthread_rwlock_rdlock' function prefers a writer to a reader.]) + ;; + esac +]) diff --git a/gnulib/import/m4/rawmemchr.m4 b/gnulib/import/m4/rawmemchr.m4 index d3ccb7e..03a8804 100644 --- a/gnulib/import/m4/rawmemchr.m4 +++ b/gnulib/import/m4/rawmemchr.m4 @@ -1,5 +1,5 @@ # rawmemchr.m4 serial 2 -dnl Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2007-2019 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. diff --git a/gnulib/import/m4/readdir.m4 b/gnulib/import/m4/readdir.m4 index eda3acf..d09cb9f 100644 --- a/gnulib/import/m4/readdir.m4 +++ b/gnulib/import/m4/readdir.m4 @@ -1,5 +1,5 @@ # readdir.m4 serial 1 -dnl Copyright (C) 2011-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2019 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. diff --git a/gnulib/import/m4/readlink.m4 b/gnulib/import/m4/readlink.m4 index ede0378..7aa6ce0 100644 --- a/gnulib/import/m4/readlink.m4 +++ b/gnulib/import/m4/readlink.m4 @@ -1,5 +1,5 @@ -# readlink.m4 serial 12 -dnl Copyright (C) 2003, 2007, 2009-2016 Free Software Foundation, Inc. +# readlink.m4 serial 15 +dnl Copyright (C) 2003, 2007, 2009-2019 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. @@ -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*) 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, obey --enable-cross-guesses. + *) gl_cv_func_readlink_works="$gl_cross_guess_normal" ;; esac ]) rm -f conftest.link conftest.lnk2]) diff --git a/gnulib/import/m4/realloc.m4 b/gnulib/import/m4/realloc.m4 index fc22825..05e7243 100644 --- a/gnulib/import/m4/realloc.m4 +++ b/gnulib/import/m4/realloc.m4 @@ -1,13 +1,11 @@ -# realloc.m4 serial 14 -dnl Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. +# realloc.m4 serial 18 +dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -m4_version_prereq([2.70], [] ,[ - # This is adapted with modifications from upstream Autoconf here: -# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c +# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c AC_DEFUN([_AC_FUNC_REALLOC_IF], [ AC_REQUIRE([AC_HEADER_STDC])dnl @@ -32,19 +30,24 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF], [ac_cv_func_realloc_0_nonnull=no], [case "$host_os" in # Guess yes on platforms where we know the result. - *-gnu* | freebsd* | netbsd* | openbsd* \ + *-gnu* | gnu* | *-musl* | freebsd* | netbsd* | openbsd* \ | hpux* | solaris* | cygwin* | mingw*) - ac_cv_func_realloc_0_nonnull=yes ;; - # If we don't know, assume the worst. - *) ac_cv_func_realloc_0_nonnull=no ;; + ac_cv_func_realloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;; esac ]) ]) - AS_IF([test $ac_cv_func_realloc_0_nonnull = yes], [$1], [$2]) + case "$ac_cv_func_realloc_0_nonnull" in + *yes) + $1 + ;; + *) + $2 + ;; + esac ])# AC_FUNC_REALLOC -]) - # gl_FUNC_REALLOC_GNU # ------------------- # Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace diff --git a/gnulib/import/m4/rename.m4 b/gnulib/import/m4/rename.m4 index fbcc758..b453666 100644 --- a/gnulib/import/m4/rename.m4 +++ b/gnulib/import/m4/rename.m4 @@ -1,6 +1,6 @@ -# serial 26 +# serial 32 -# Copyright (C) 2001, 2003, 2005-2006, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005-2006, 2009-2019 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. @@ -19,7 +19,7 @@ AC_DEFUN([gl_FUNC_RENAME], AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([lstat]) - dnl Solaris 10, AIX 7.1 mistakenly allow rename("file","name/"). + dnl Solaris 11.3, AIX 7.1 mistakenly allow rename("file","name/"). dnl NetBSD 1.6 mistakenly forbids rename("dir","name/"). dnl FreeBSD 7.2 mistakenly allows rename("file","link-to-file/"). dnl The Solaris bug can be worked around without stripping @@ -55,10 +55,14 @@ AC_DEFUN([gl_FUNC_RENAME], [gl_cv_func_rename_slash_dst_works=no], dnl When crosscompiling, assume rename is broken. [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rename_slash_dst_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_rename_slash_dst_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rename_slash_dst_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_rename_slash_dst_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_rename_slash_dst_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rename_slash_dst_works="$gl_cross_guess_normal" ;; esac ]) rm -rf conftest.f conftest.f1 conftest.f2 conftest.d1 conftest.d2 conftest.lnk @@ -69,7 +73,7 @@ AC_DEFUN([gl_FUNC_RENAME], REPLACE_RENAME=1 AC_DEFINE([RENAME_TRAILING_SLASH_DEST_BUG], [1], [Define if rename does not correctly handle slashes on the destination - argument, such as on Solaris 10 or NetBSD 1.6.]) + argument, such as on Solaris 11 or NetBSD 1.6.]) ;; esac @@ -107,10 +111,14 @@ AC_DEFUN([gl_FUNC_RENAME], [gl_cv_func_rename_slash_src_works=no], dnl When crosscompiling, assume rename is broken. [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rename_slash_src_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_rename_slash_src_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rename_slash_src_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_rename_slash_src_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_rename_slash_src_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rename_slash_src_works="$gl_cross_guess_normal" ;; esac ]) rm -rf conftest.f conftest.f1 conftest.d1 conftest.d2 conftest.d3 conftest.lnk @@ -132,40 +140,58 @@ AC_DEFUN([gl_FUNC_RENAME], AC_CACHE_CHECK([whether rename manages hard links correctly], [gl_cv_func_rename_link_works], [if test $ac_cv_func_link = yes; then - rm -rf conftest.f conftest.f1 - if touch conftest.f && ln conftest.f conftest.f1 && - set x `ls -i conftest.f conftest.f1` && test "$2" = "$4"; then - AC_RUN_IFELSE( - [AC_LANG_PROGRAM([[ -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> - ]], - [[int result = 0; - if (rename ("conftest.f", "conftest.f1")) - result |= 1; - if (unlink ("conftest.f1")) - result |= 2; - if (rename ("conftest.f", "conftest.f")) - result |= 4; - if (rename ("conftest.f1", "conftest.f1") == 0) - result |= 8; - return result; - ]])], - [gl_cv_func_rename_link_works=yes], - [gl_cv_func_rename_link_works=no], - dnl When crosscompiling, assume rename is broken. - [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rename_link_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_rename_link_works="guessing no" ;; - esac - ]) + if test $cross_compiling != yes; then + rm -rf conftest.f conftest.f1 conftest.f2 + if touch conftest.f conftest.f2 && ln conftest.f conftest.f1 && + set x `ls -i conftest.f conftest.f1` && test "$2" = "$4"; then + AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ +# include <errno.h> +# include <stdio.h> +# include <stdlib.h> +# include <unistd.h> + ]], + [[int result = 0; + if (rename ("conftest.f", "conftest.f1")) + result |= 1; + if (unlink ("conftest.f1")) + result |= 2; + + /* Allow either the POSIX-required behavior, where the + previous rename kept conftest.f, or the (better) NetBSD + behavior, where it removed conftest.f. */ + if (rename ("conftest.f", "conftest.f") != 0 + && errno != ENOENT) + result |= 4; + + if (rename ("conftest.f1", "conftest.f1") == 0) + result |= 8; + if (rename ("conftest.f2", "conftest.f2") != 0) + result |= 16; + return result; + ]])], + [gl_cv_func_rename_link_works=yes], + [gl_cv_func_rename_link_works=no], + [dnl We don't get here. + : + ]) + else + gl_cv_func_rename_link_works="guessing no" + fi + rm -rf conftest.f conftest.f1 conftest.f2 else - gl_cv_func_rename_link_works="guessing no" + dnl When crosscompiling, assume rename is broken. + case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rename_link_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_rename_link_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_rename_link_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rename_link_works="$gl_cross_guess_normal" ;; + esac fi - rm -rf conftest.f conftest.f1 else gl_cv_func_rename_link_works=yes fi @@ -205,10 +231,14 @@ AC_DEFUN([gl_FUNC_RENAME], [gl_cv_func_rename_dest_works=no], dnl When crosscompiling, assume rename is broken. [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rename_dest_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_rename_dest_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rename_dest_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_rename_dest_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_rename_dest_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rename_dest_works="$gl_cross_guess_normal" ;; esac ]) rm -rf conftest.f conftest.d1 conftest.d2 diff --git a/gnulib/import/m4/rewinddir.m4 b/gnulib/import/m4/rewinddir.m4 index 0d3d6c6..c14224c 100644 --- a/gnulib/import/m4/rewinddir.m4 +++ b/gnulib/import/m4/rewinddir.m4 @@ -1,5 +1,5 @@ # rewinddir.m4 serial 1 -dnl Copyright (C) 2011-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2019 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. diff --git a/gnulib/import/m4/rmdir.m4 b/gnulib/import/m4/rmdir.m4 index ebb3b5d..bc01778 100644 --- a/gnulib/import/m4/rmdir.m4 +++ b/gnulib/import/m4/rmdir.m4 @@ -1,5 +1,5 @@ -# rmdir.m4 serial 13 -dnl Copyright (C) 2002, 2005, 2009-2016 Free Software Foundation, Inc. +# rmdir.m4 serial 17 +dnl Copyright (C) 2002, 2005, 2009-2019 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. @@ -33,10 +33,14 @@ AC_DEFUN([gl_FUNC_RMDIR], ]])], [gl_cv_func_rmdir_works=yes], [gl_cv_func_rmdir_works=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_rmdir_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_rmdir_works="guessing no" ;; + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rmdir_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_rmdir_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_rmdir_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rmdir_works="$gl_cross_guess_normal" ;; esac ]) rm -rf conftest.dir conftest.file]) diff --git a/gnulib/import/m4/save-cwd.m4 b/gnulib/import/m4/save-cwd.m4 index d6e2410..816fd70 100644 --- a/gnulib/import/m4/save-cwd.m4 +++ b/gnulib/import/m4/save-cwd.m4 @@ -1,5 +1,5 @@ # serial 10 -dnl Copyright (C) 2002-2006, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2019 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. diff --git a/gnulib/import/m4/secure_getenv.m4 b/gnulib/import/m4/secure_getenv.m4 deleted file mode 100644 index 3983173..0000000 --- a/gnulib/import/m4/secure_getenv.m4 +++ /dev/null @@ -1,26 +0,0 @@ -# Look up an environment variable more securely. -dnl Copyright 2013-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_FUNC_SECURE_GETENV], -[ - dnl Persuade glibc <stdlib.h> to declare secure_getenv(). - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - AC_CHECK_FUNCS_ONCE([secure_getenv]) - if test $ac_cv_func_secure_getenv = no; then - HAVE_SECURE_GETENV=0 - fi -]) - -# Prerequisites of lib/secure_getenv.c. -AC_DEFUN([gl_PREREQ_SECURE_GETENV], [ - AC_CHECK_FUNCS([__secure_getenv]) - if test $ac_cv_func___secure_getenv = no; then - AC_CHECK_FUNCS([issetugid]) - fi - AC_CHECK_FUNCS_ONCE([getuid geteuid getgid getegid]) -]) diff --git a/gnulib/import/m4/setenv.m4 b/gnulib/import/m4/setenv.m4 index 5d49aba..6755459 100644 --- a/gnulib/import/m4/setenv.m4 +++ b/gnulib/import/m4/setenv.m4 @@ -1,5 +1,5 @@ -# setenv.m4 serial 26 -dnl Copyright (C) 2001-2004, 2006-2016 Free Software Foundation, Inc. +# setenv.m4 serial 29 +dnl Copyright (C) 2001-2004, 2006-2019 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. @@ -35,10 +35,12 @@ AC_DEFUN([gl_FUNC_SETENV], ]])], [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_setenv_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_setenv_works="guessing no" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_setenv_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_setenv_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_setenv_works" in @@ -129,8 +131,8 @@ int unsetenv (const char *name); [case "$host_os" in # Guess yes on glibc systems. *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_unsetenv_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_unsetenv_works" in diff --git a/gnulib/import/m4/signal_h.m4 b/gnulib/import/m4/signal_h.m4 index bcfd7b4..3acec64 100644 --- a/gnulib/import/m4/signal_h.m4 +++ b/gnulib/import/m4/signal_h.m4 @@ -1,5 +1,5 @@ # signal_h.m4 serial 18 -dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2019 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. diff --git a/gnulib/import/m4/socklen.m4 b/gnulib/import/m4/socklen.m4 index 634c43a..deb5135 100644 --- a/gnulib/import/m4/socklen.m4 +++ b/gnulib/import/m4/socklen.m4 @@ -1,5 +1,5 @@ -# socklen.m4 serial 10 -dnl Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc. +# socklen.m4 serial 11 +dnl Copyright (C) 2005-2007, 2009-2019 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. @@ -15,8 +15,8 @@ dnl So we have to test to find something that will work. AC_DEFUN([gl_TYPE_SOCKLEN_T], [AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])dnl AC_CHECK_TYPE([socklen_t], , - [AC_MSG_CHECKING([for socklen_t equivalent]) - AC_CACHE_VAL([gl_cv_socklen_t_equiv], + [AC_CACHE_CHECK([for socklen_t equivalent], + [gl_cv_socklen_t_equiv], [# Systems have either "struct sockaddr *" or # "void *" as the second argument to getpeername gl_cv_socklen_t_equiv= @@ -34,11 +34,10 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T], done test "$gl_cv_socklen_t_equiv" != "" && break done - ]) - if test "$gl_cv_socklen_t_equiv" = ""; then - AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) - fi - AC_MSG_RESULT([$gl_cv_socklen_t_equiv]) + if test "$gl_cv_socklen_t_equiv" = ""; then + AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) + fi + ]) AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], [type to use in place of socklen_t if not defined])], [gl_SOCKET_HEADERS])]) diff --git a/gnulib/import/m4/sockpfaf.m4 b/gnulib/import/m4/sockpfaf.m4 index dce8b8f..7b32982 100644 --- a/gnulib/import/m4/sockpfaf.m4 +++ b/gnulib/import/m4/sockpfaf.m4 @@ -1,5 +1,5 @@ -# sockpfaf.m4 serial 8 -dnl Copyright (C) 2004, 2006, 2009-2016 Free Software Foundation, Inc. +# sockpfaf.m4 serial 9 +dnl Copyright (C) 2004, 2006, 2009-2019 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. @@ -16,8 +16,8 @@ AC_DEFUN([gl_SOCKET_FAMILIES], AC_REQUIRE([gl_HEADER_SYS_SOCKET]) AC_CHECK_HEADERS_ONCE([netinet/in.h]) - AC_MSG_CHECKING([for IPv4 sockets]) - AC_CACHE_VAL([gl_cv_socket_ipv4], + AC_CACHE_CHECK([for IPv4 sockets], + [gl_cv_socket_ipv4], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> @@ -31,13 +31,12 @@ AC_DEFUN([gl_SOCKET_FAMILIES], [[int x = AF_INET; struct in_addr y; struct sockaddr_in z; if (&x && &y && &z) return 0;]])], gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)]) - AC_MSG_RESULT([$gl_cv_socket_ipv4]) if test $gl_cv_socket_ipv4 = yes; then AC_DEFINE([HAVE_IPV4], [1], [Define to 1 if <sys/socket.h> defines AF_INET.]) fi - AC_MSG_CHECKING([for IPv6 sockets]) - AC_CACHE_VAL([gl_cv_socket_ipv6], + AC_CACHE_CHECK([for IPv6 sockets], + [gl_cv_socket_ipv6], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> @@ -54,7 +53,6 @@ AC_DEFUN([gl_SOCKET_FAMILIES], [[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z; if (&x && &y && &z) return 0;]])], gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)]) - AC_MSG_RESULT([$gl_cv_socket_ipv6]) if test $gl_cv_socket_ipv6 = yes; then AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.]) fi @@ -65,8 +63,8 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX], AC_REQUIRE([gl_HEADER_SYS_SOCKET]) AC_CHECK_HEADERS_ONCE([sys/un.h]) - AC_MSG_CHECKING([for UNIX domain sockets]) - AC_CACHE_VAL([gl_cv_socket_unix], + AC_CACHE_CHECK([for UNIX domain sockets], + [gl_cv_socket_unix], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> @@ -80,7 +78,6 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX], [[int x = AF_UNIX; struct sockaddr_un y; if (&x && &y) return 0;]])], gl_cv_socket_unix=yes, gl_cv_socket_unix=no)]) - AC_MSG_RESULT([$gl_cv_socket_unix]) if test $gl_cv_socket_unix = yes; then AC_DEFINE([HAVE_UNIXSOCKET], [1], [Define to 1 if <sys/socket.h> defines AF_UNIX.]) fi diff --git a/gnulib/import/m4/ssize_t.m4 b/gnulib/import/m4/ssize_t.m4 index 3e7b9e6..38bcee1 100644 --- a/gnulib/import/m4/ssize_t.m4 +++ b/gnulib/import/m4/ssize_t.m4 @@ -1,5 +1,5 @@ # ssize_t.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2001-2003, 2006, 2010-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2003, 2006, 2010-2019 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. diff --git a/gnulib/import/m4/stat-time.m4 b/gnulib/import/m4/stat-time.m4 new file mode 100644 index 0000000..1685788 --- /dev/null +++ b/gnulib/import/m4/stat-time.m4 @@ -0,0 +1,83 @@ +# Checks for stat-related time functions. + +# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2019 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. + +dnl From Paul Eggert. + +# st_atim.tv_nsec - Linux, Solaris, Cygwin +# st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE +# st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE +# st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1) + +# st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway) +# st_birthtim - Cygwin 1.7.0+ + +AC_DEFUN([gl_STAT_TIME], +[ + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_HEADERS_ONCE([sys/time.h]) + + AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec], + [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec], + [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[ + #include <sys/types.h> + #include <sys/stat.h> + #if HAVE_SYS_TIME_H + # include <sys/time.h> + #endif + #include <time.h> + struct timespec ts; + struct stat st; + ]], + [[ + st.st_atim = ts; + ]])], + [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes], + [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])]) + if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then + AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1], + [Define to 1 if the type of the st_atim member of a struct stat is + struct timespec.]) + fi], + [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [], + [AC_CHECK_MEMBERS([struct stat.st_atimensec], [], + [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [], + [#include <sys/types.h> + #include <sys/stat.h>])], + [#include <sys/types.h> + #include <sys/stat.h>])], + [#include <sys/types.h> + #include <sys/stat.h>])], + [#include <sys/types.h> + #include <sys/stat.h>]) +]) + +# Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.) +# and NTFS (Cygwin). +# There was a time when this field was named st_createtime (21 June +# 2002 to 16 July 2002) But that window is very small and applied only +# to development code, so systems still using that configuration are +# not supported. See revisions 1.10 and 1.11 of FreeBSD's +# src/sys/ufs/ufs/dinode.h. +# +AC_DEFUN([gl_STAT_BIRTHTIME], +[ + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_HEADERS_ONCE([sys/time.h]) + AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [], + [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [], + [AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec], [], [], + [#include <sys/types.h> + #include <sys/stat.h>])], + [#include <sys/types.h> + #include <sys/stat.h>])], + [#include <sys/types.h> + #include <sys/stat.h>]) +]) diff --git a/gnulib/import/m4/stat.m4 b/gnulib/import/m4/stat.m4 index a794975..752661f 100644 --- a/gnulib/import/m4/stat.m4 +++ b/gnulib/import/m4/stat.m4 @@ -1,6 +1,6 @@ -# serial 11 +# serial 16 -# Copyright (C) 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2009-2019 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -8,64 +8,67 @@ AC_DEFUN([gl_FUNC_STAT], [ - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([lstat]) - dnl mingw is the only known platform where stat(".") and stat("./") differ - AC_CACHE_CHECK([whether stat handles trailing slashes on directories], - [gl_cv_func_stat_dir_slash], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/stat.h> -]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])], - [gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no], - [case $host_os in - mingw*) gl_cv_func_stat_dir_slash="guessing no";; - *) gl_cv_func_stat_dir_slash="guessing yes";; - esac])]) - dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/"). - dnl (For mingw, this is due to a broken stat() override in libmingwex.a.) - dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/"). - AC_CACHE_CHECK([whether stat handles trailing slashes on files], - [gl_cv_func_stat_file_slash], - [touch conftest.tmp - # Assume that if we have lstat, we can also check symlinks. - if test $ac_cv_func_lstat = yes; then - ln -s conftest.tmp conftest.lnk - fi - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/stat.h> + case "$host_os" in + mingw*) + dnl On this platform, the original stat() returns st_atime, st_mtime, + dnl st_ctime values that are affected by the time zone. + REPLACE_STAT=1 + ;; + *) + dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/"). + dnl (For mingw, this is due to a broken stat() override in libmingwex.a.) + dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/"). + AC_CACHE_CHECK([whether stat handles trailing slashes on files], + [gl_cv_func_stat_file_slash], + [touch conftest.tmp + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.tmp conftest.lnk + fi + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/stat.h> ]], [[int result = 0; - struct stat st; - if (!stat ("conftest.tmp/", &st)) - result |= 1; + struct stat st; + if (!stat ("conftest.tmp/", &st)) + result |= 1; #if HAVE_LSTAT - if (!stat ("conftest.lnk/", &st)) - result |= 2; + if (!stat ("conftest.lnk/", &st)) + result |= 2; #endif - return result; - ]])], - [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], - [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_stat_file_slash="guessing no" ;; - esac - ]) - rm -f conftest.tmp conftest.lnk]) - case $gl_cv_func_stat_dir_slash in - *no) REPLACE_STAT=1 - AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs - help when passed a directory name with a trailing slash]);; - esac - case $gl_cv_func_stat_file_slash in - *no) REPLACE_STAT=1 - AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs - help when passed a file name with a trailing slash]);; + return result; + ]])], + [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], + [case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;; + esac + ]) + rm -f conftest.tmp conftest.lnk]) + case $gl_cv_func_stat_file_slash in + *no) + REPLACE_STAT=1 + AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs + help when passed a file name with a trailing slash]);; + esac + case $host_os in + dnl Solaris stat can return a negative tv_nsec. + solaris*) + REPLACE_FSTAT=1 ;; + esac + ;; esac ]) -# Prerequisites of lib/stat.c. -AC_DEFUN([gl_PREREQ_STAT], [:]) +# Prerequisites of lib/stat.c and lib/stat-w32.c. +AC_DEFUN([gl_PREREQ_STAT], [ + AC_REQUIRE([gl_HEADER_SYS_STAT_H]) + : +]) diff --git a/gnulib/import/m4/std-gnu11.m4 b/gnulib/import/m4/std-gnu11.m4 new file mode 100644 index 0000000..23e7f75 --- /dev/null +++ b/gnulib/import/m4/std-gnu11.m4 @@ -0,0 +1,824 @@ +# Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- + +# This implementation is taken from GNU Autoconf lib/autoconf/c.m4 +# commit 017d5ddd82854911f0119691d91ea8a1438824d6 +# dated Sun Apr 3 13:57:17 2016 -0700 +# This implementation will be obsolete once we can assume Autoconf 2.70 +# or later is installed everywhere a Gnulib program might be developed. + + +# Copyright (C) 2001-2019 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +# Written by David MacKenzie, with help from +# Akim Demaille, Paul Eggert, +# François Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +# Roland McGrath, Noah Friedman, david d zuhn, and many others. + + +# AC_PROG_CC([COMPILER ...]) +# -------------------------- +# COMPILER ... is a space separated list of C compilers to search for. +# This just gives the user an opportunity to specify an alternative +# search list for the C compiler. +AC_DEFUN_ONCE([AC_PROG_CC], +[AC_LANG_PUSH(C)dnl +AC_ARG_VAR([CC], [C compiler command])dnl +AC_ARG_VAR([CFLAGS], [C compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +_AC_ARG_VAR_LIBS()dnl +_AC_ARG_VAR_CPPFLAGS()dnl +m4_ifval([$1], + [AC_CHECK_TOOLS(CC, [$1])], +[AC_CHECK_TOOL(CC, gcc) +if test -z "$CC"; then + dnl Here we want: + dnl AC_CHECK_TOOL(CC, cc) + dnl but without the check for a tool without the prefix. + dnl Until the check is removed from there, copy the code: + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc]) + fi +fi +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) +fi +if test -z "$CC"; then + AC_CHECK_TOOLS(CC, cl.exe) +fi +if test -z "$CC"; then + AC_CHECK_TOOL(CC, clang) +fi +]) + +test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH]) + +# Provide some information about the compiler. +_AS_ECHO_LOG([checking for _AC_LANG compiler version]) +set X $ac_compile +ac_compiler=$[2] +for ac_option in --version -v -V -qversion -version; do + m4_ifdef([_AC_DO_LIMIT],[_AC_DO_LIMIT],[_AC_DO])([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) +done + +m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl +_AC_LANG_COMPILER_GNU +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +_AC_PROG_CC_G +dnl +dnl Set ac_prog_cc_stdc to the supported C version. +dnl Also set the documented variable ac_cv_prog_cc_stdc; +dnl its name was chosen when it was cached, but it is no longer cached. +_AC_PROG_CC_C11([ac_prog_cc_stdc=c11 + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11], + [_AC_PROG_CC_C99([ac_prog_cc_stdc=c99 + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99], + [_AC_PROG_CC_C89([ac_prog_cc_stdc=c89 + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89], + [ac_prog_cc_stdc=no + ac_cv_prog_cc_stdc=no])])]) +dnl +AC_LANG_POP(C)dnl +])# AC_PROG_CC + + + +# AC_PROG_CXX([LIST-OF-COMPILERS]) +# -------------------------------- +# LIST-OF-COMPILERS is a space separated list of C++ compilers to search +# for (if not specified, a default list is used). This just gives the +# user an opportunity to specify an alternative search list for the C++ +# compiler. +# aCC HP-UX C++ compiler much better than `CC', so test before. +# FCC Fujitsu C++ compiler +# KCC KAI C++ compiler +# RCC Rational C++ +# xlC_r AIX C Set++ (with support for reentrant code) +# xlC AIX C Set++ +AC_DEFUN([AC_PROG_CXX], +[AC_LANG_PUSH(C++)dnl +AC_ARG_VAR([CXX], [C++ compiler command])dnl +AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +_AC_ARG_VAR_LIBS()dnl +_AC_ARG_VAR_CPPFLAGS()dnl +_AC_ARG_VAR_PRECIOUS([CCC])dnl +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + AC_CHECK_TOOLS(CXX, + [m4_default([$1], + [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++])], + g++) + fi +fi +# Provide some information about the compiler. +_AS_ECHO_LOG([checking for _AC_LANG compiler version]) +set X $ac_compile +ac_compiler=$[2] +for ac_option in --version -v -V -qversion; do + m4_ifdef([_AC_DO_LIMIT],[_AC_DO_LIMIT],[_AC_DO])([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) +done + +m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl +_AC_LANG_COMPILER_GNU +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +_AC_PROG_CXX_G +_AC_PROG_CXX_CXX11([ac_prog_cxx_stdcxx=cxx11 + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_cv_prog_cxx_cxx98=$ac_cv_prog_cxx_cxx11], + [_AC_PROG_CXX_CXX98([ac_prog_cxx_stdcxx=cxx98 + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98], + [ac_prog_cxx_stdcxx=no + ac_cv_prog_cxx_stdcxx=no])]) +AC_LANG_POP(C++)dnl +])# AC_PROG_CXX + + +# _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST, +# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) +# -------------------------------------------------------------- +# Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99') +# by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails, +# try again with each compiler option in the space-separated OPTION-LIST; if one +# helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE, +# else ACTION-IF-UNAVAILABLE. +AC_DEFUN([_AC_C_STD_TRY], +[AC_MSG_CHECKING([for $CC option to enable ]m4_translit($1, [c], [C])[ features]) +AC_CACHE_VAL(ac_cv_prog_cc_$1, +[ac_cv_prog_cc_$1=no +ac_save_CC=$CC +AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])]) +for ac_arg in '' $4 +do + CC="$ac_save_CC $ac_arg" + _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg]) + test "x$ac_cv_prog_cc_$1" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +])# AC_CACHE_VAL +ac_prog_cc_stdc_options= +case "x$ac_cv_prog_cc_$1" in + x) + AC_MSG_RESULT([none needed]) ;; + xno) + AC_MSG_RESULT([unsupported]) ;; + *) + ac_prog_cc_stdc_options=" $ac_cv_prog_cc_$1" + CC=$CC$ac_prog_cc_stdc_options + AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;; +esac +AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6]) +])# _AC_C_STD_TRY + +# _AC_C_C99_TEST_HEADER +# --------------------- +# A C header suitable for testing for C99. +AC_DEFUN([_AC_C_C99_TEST_HEADER], +[[#include <stdarg.h> +#include <stdbool.h> +#include <stddef.h> +#include <stdlib.h> +#include <wchar.h> +#include <stdio.h> + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +}]])# _AC_C_C99_TEST_HEADER + +# _AC_C_C99_TEST_BODY +# ------------------- +# A C body suitable for testing for C99, assuming the corresponding header. +AC_DEFUN([_AC_C_C99_TEST_BODY], +[[ + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); +]]) + +# _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +# ---------------------------------------------------------------- +# If the C compiler is not in ISO C99 mode by default, try to add an +# option to output variable CC to make it so. This macro tries +# various options that select ISO C99 on some system or another. It +# considers the compiler to be in ISO C99 mode if it handles _Bool, +# // comments, flexible array members, inline, long long int, mixed +# code and declarations, named initialization of structs, restrict, +# va_copy, varargs macros, variable declarations in for loops and +# variable length arrays. +AC_DEFUN([_AC_PROG_CC_C99], +[_AC_C_STD_TRY([c99], +[_AC_C_C99_TEST_HEADER], +[_AC_C_C99_TEST_BODY], +dnl Try +dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999) +dnl IBM XL C -qlanglvl=extc1x (V12.1; does not pass C11 test) +dnl IBM XL C -qlanglvl=extc99 +dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdc99) +dnl HP cc -AC99 +dnl Intel ICC -std=c99, -c99 (deprecated) +dnl IRIX -c99 +dnl Solaris -D_STDC_C99= +dnl cc's -xc99 option uses linker magic to define the external +dnl symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99 +dnl behavior for C library functions. This is not wanted here, +dnl because it means that a single module compiled with -xc99 +dnl alters C runtime behavior for the entire program, not for +dnl just the module. Instead, define the (private) symbol +dnl _STDC_C99, which suppresses a bogus failure in <stdbool.h>. +dnl The resulting compiler passes the test case here, and that's +dnl good enough. For more, please see the thread starting at: +dnl https://lists.gnu.org/r/autoconf/2010-12/msg00059.html +dnl Tru64 -c99 +dnl with extended modes being tried first. +[[-std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99]], [$1], [$2])[]dnl +])# _AC_PROG_CC_C99 + + +# _AC_PROG_CC_C11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +# ---------------------------------------------------------------- +# If the C compiler is not in ISO C11 mode by default, try to add an +# option to output variable CC to make it so. This macro tries +# various options that select ISO C11 on some system or another. It +# considers the compiler to be in ISO C11 mode if it handles _Alignas, +# _Alignof, _Noreturn, _Static_assert, UTF-8 string literals, +# duplicate typedefs, and anonymous structures and unions. +AC_DEFUN([_AC_PROG_CC_C11], +[_AC_C_STD_TRY([c11], +[_AC_C_C99_TEST_HEADER[ +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +]], +[_AC_C_C99_TEST_BODY[ + v1.i = 2; + v1.w.k = 5; + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); +]], +dnl Try +dnl GCC -std=gnu11 (unused restrictive mode: -std=c11) +dnl with extended modes being tried first. +dnl +dnl Do not try -qlanglvl=extc1x, because IBM XL C V12.1 (the latest version as +dnl of September 2012) does not pass the C11 test. For now, try extc1x when +dnl compiling the C99 test instead, since it enables _Static_assert and +dnl _Noreturn, which is a win. If -qlanglvl=extc11 or -qlanglvl=extc1x passes +dnl the C11 test in some future version of IBM XL C, we'll add it here, +dnl preferably extc11. +[[-std=gnu11]], [$1], [$2])[]dnl +])# _AC_PROG_CC_C11 + + +# AC_PROG_CC_C89 +# -------------- +# Do not use AU_ALIAS here and in AC_PROG_CC_C99 and AC_PROG_CC_STDC, +# as that'd be incompatible with how Automake redefines AC_PROG_CC. See +# <https://lists.gnu.org/r/autoconf/2012-10/msg00048.html>. +AU_DEFUN([AC_PROG_CC_C89], + [AC_REQUIRE([AC_PROG_CC])], + [$0 is obsolete; use AC_PROG_CC] +) + +# AC_PROG_CC_C99 +# -------------- +AU_DEFUN([AC_PROG_CC_C99], + [AC_REQUIRE([AC_PROG_CC])], + [$0 is obsolete; use AC_PROG_CC] +) + +# AC_PROG_CC_STDC +# --------------- +AU_DEFUN([AC_PROG_CC_STDC], + [AC_REQUIRE([AC_PROG_CC])], + [$0 is obsolete; use AC_PROG_CC] +) + + +# AC_C_PROTOTYPES +# --------------- +# Check if the C compiler supports prototypes, included if it needs +# options. +AC_DEFUN([AC_C_PROTOTYPES], +[AC_REQUIRE([AC_PROG_CC])dnl +if test "$ac_prog_cc_stdc" != no; then + AC_DEFINE(PROTOTYPES, 1, + [Define to 1 if the C compiler supports function prototypes.]) + AC_DEFINE(__PROTOTYPES, 1, + [Define like PROTOTYPES; this can be used by system headers.]) +fi +])# AC_C_PROTOTYPES + + +# _AC_CXX_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST, +# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) +# ---------------------------------------------------------------- +# Check whether the C++ compiler accepts features of STANDARD (e.g +# `cxx98', `cxx11') by trying to compile a program of TEST-PROLOGUE +# and TEST-BODY. If this fails, try again with each compiler option +# in the space-separated OPTION-LIST; if one helps, append it to CXX. +# If eventually successful, run ACTION-IF-AVAILABLE, else +# ACTION-IF-UNAVAILABLE. +AC_DEFUN([_AC_CXX_STD_TRY], +[AC_MSG_CHECKING([for $CXX option to enable ]m4_translit(m4_translit($1, [x], [+]), [a-z], [A-Z])[ features]) +AC_LANG_PUSH(C++)dnl +AC_CACHE_VAL(ac_cv_prog_cxx_$1, +[ac_cv_prog_cxx_$1=no +ac_save_CXX=$CXX +AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])]) +for ac_arg in '' $4 +do + CXX="$ac_save_CXX $ac_arg" + _AC_COMPILE_IFELSE([], [ac_cv_prog_cxx_$1=$ac_arg]) + test "x$ac_cv_prog_cxx_$1" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +])# AC_CACHE_VAL +ac_prog_cxx_stdcxx_options= +case "x$ac_cv_prog_cxx_$1" in + x) + AC_MSG_RESULT([none needed]) ;; + xno) + AC_MSG_RESULT([unsupported]) ;; + *) + ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_$1" + CXX=$CXX$ac_prog_cxx_stdcxx_options + AC_MSG_RESULT([$ac_cv_prog_cxx_$1]) ;; +esac +AC_LANG_POP(C++)dnl +AS_IF([test "x$ac_cv_prog_cxx_$1" != xno], [$5], [$6]) +])# _AC_CXX_STD_TRY + +# _AC_CXX_CXX98_TEST_HEADER +# ------------------------- +# A C++ header suitable for testing for CXX98. +AC_DEFUN([_AC_CXX_CXX98_TEST_HEADER], +[[ +#include <algorithm> +#include <cstdlib> +#include <fstream> +#include <iomanip> +#include <iostream> +#include <list> +#include <map> +#include <set> +#include <sstream> +#include <stdexcept> +#include <string> +#include <utility> +#include <vector> + +namespace test { + typedef std::vector<std::string> string_vec; + typedef std::pair<int,bool> map_value; + typedef std::map<std::string,map_value> map_type; + typedef std::set<int> set_type; + + template<typename T> + class printer { + public: + printer(std::ostringstream& os): os(os) {} + void operator() (T elem) { os << elem << std::endl; } + private: + std::ostringstream& os; + }; +} +]])# _AC_CXX_CXX98_TEST_HEADER + +# _AC_CXX_CXX98_TEST_BODY +# ----------------------- +# A C++ body suitable for testing for CXX98, assuming the corresponding header. +AC_DEFUN([_AC_CXX_CXX98_TEST_BODY], +[[ + +try { + // Basic string. + std::string teststr("ASCII text"); + teststr += " string"; + + // Simple vector. + test::string_vec testvec; + testvec.push_back(teststr); + testvec.push_back("foo"); + testvec.push_back("bar"); + if (testvec.size() != 3) { + throw std::runtime_error("vector size is not 1"); + } + + // Dump vector into stringstream and obtain string. + std::ostringstream os; + for (test::string_vec::const_iterator i = testvec.begin(); + i != testvec.end(); ++i) { + if (i + 1 != testvec.end()) { + os << teststr << '\n'; + } + } + // Check algorithms work. + std::for_each(testvec.begin(), testvec.end(), test::printer<std::string>(os)); + std::string os_out = os.str(); + + // Test pair and map. + test::map_type testmap; + testmap.insert(std::make_pair(std::string("key"), + std::make_pair(53,false))); + + // Test set. + int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + test::set_type testset(values, values + sizeof(values)/sizeof(values[0])); + std::list<int> testlist(testset.begin(), testset.end()); + std::copy(testset.begin(), testset.end(), std::back_inserter(testlist)); +} catch (const std::exception& e) { + std::cerr << "Caught exception: " << e.what() << std::endl; + + // Test fstream + std::ofstream of("test.txt"); + of << "Test ASCII text\n" << std::flush; + of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl; + of.close(); +} +std::exit(0); +]]) + +# _AC_CXX_CXX11_TEST_HEADER +# ------------------------- +# A C++ header suitable for testing for CXX11. +AC_DEFUN([_AC_CXX_CXX11_TEST_HEADER], +[[ +#include <deque> +#include <functional> +#include <memory> +#include <tuple> +#include <array> +#include <regex> +#include <iostream> + +namespace cxx11test +{ + typedef std::shared_ptr<std::string> sptr; + typedef std::weak_ptr<std::string> wptr; + + typedef std::tuple<std::string,int,double> tp; + typedef std::array<int, 20> int_array; + + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; +} +]])# _AC_CXX_CXX11_TEST_HEADER + +# _AC_CXX_CXX11_TEST_BODY +# ----------------------- +# A C++ body suitable for testing for CXX11, assuming the corresponding header. +AC_DEFUN([_AC_CXX_CXX11_TEST_BODY], +[[ +{ + // Test auto and decltype + std::deque<int> d; + d.push_front(43); + d.push_front(484); + d.push_front(3); + d.push_front(844); + int total = 0; + for (auto i = d.begin(); i != d.end(); ++i) { total += *i; } + + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for and lambda + cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (int &x : array) { x += 23; } + std::for_each(array.begin(), array.end(), [](int v1){ std::cout << v1; }); +} +{ + using cxx11test::sptr; + using cxx11test::wptr; + + sptr sp(new std::string("ASCII string")); + wptr wp(sp); + sptr sp2(wp); +} +{ + cxx11test::tp tuple("test", 54, 45.53434); + double d = std::get<2>(tuple); + std::string s; + int i; + std::tie(s,i,d) = tuple; +} +{ + static std::regex filename_regex("^_?([a-z0-9_.]+-)+[a-z0-9]+$"); + std::string testmatch("Test if this string matches"); + bool match = std::regex_search(testmatch, filename_regex); +} +{ + cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + cxx11test::int_array::size_type size = array.size(); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + std::vector<std::pair<int,char*>> v1; +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +]]) + +# _AC_PROG_CXX_CXX98 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +# ------------------------------------------------------------------- + +# If the C++ compiler is not in ISO C++98 mode by default, try to add +# an option to output variable CXX to make it so. This macro tries +# various options that select ISO C++98 on some system or another. It +# considers the compiler to be in ISO C++98 mode if it handles basic +# features of the std namespace including: string, containers (list, +# map, set, vector), streams (fstreams, iostreams, stringstreams, +# iomanip), pair, exceptions and algorithms. + + +AC_DEFUN([_AC_PROG_CXX_CXX98], +[_AC_CXX_STD_TRY([cxx98], +[_AC_CXX_CXX98_TEST_HEADER], +[_AC_CXX_CXX98_TEST_BODY], +dnl Try +dnl GCC -std=gnu++98 (unused restrictive mode: -std=c++98) +dnl IBM XL C -qlanglvl=extended +dnl HP aC++ -AA +dnl Intel ICC -std=gnu++98 +dnl Solaris N/A (default) +dnl Tru64 N/A (default, but -std gnu could be used) +dnl with extended modes being tried first. +[[-std=gnu++98 -std=c++98 -qlanglvl=extended -AA]], [$1], [$2])[]dnl +])# _AC_PROG_CXX_CXX98 + +# _AC_PROG_CXX_CXX11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +# ------------------------------------------------------------------- +# If the C++ compiler is not in ISO CXX11 mode by default, try to add +# an option to output variable CXX to make it so. This macro tries +# various options that select ISO C++11 on some system or another. It +# considers the compiler to be in ISO C++11 mode if it handles all the +# tests from the C++98 checks, plus the following: Language features +# (auto, constexpr, decltype, default/deleted constructors, delegate +# constructors, final, initializer lists, lambda functions, nullptr, +# override, range-based for loops, template brackets without spaces, +# unicode literals) and library features (array, memory (shared_ptr, +# weak_ptr), regex and tuple types). +AC_DEFUN([_AC_PROG_CXX_CXX11], +[_AC_CXX_STD_TRY([cxx11], +[_AC_CXX_CXX11_TEST_HEADER +_AC_CXX_CXX98_TEST_HEADER], +[_AC_CXX_CXX11_TEST_BODY +_AC_CXX_CXX98_TEST_BODY], +dnl Try +dnl GCC -std=gnu++11 (unused restrictive mode: -std=c++11) [and 0x variants] +dnl IBM XL C -qlanglvl=extended0x +dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdcxx11) +dnl HP aC++ -AA +dnl Intel ICC -std=c++11 -std=c++0x +dnl Solaris N/A (no support) +dnl Tru64 N/A (no support) +dnl with extended modes being tried first. +[[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], [$1], [$2])[]dnl +])# _AC_PROG_CXX_CXX11 diff --git a/gnulib/import/m4/stdalign.m4 b/gnulib/import/m4/stdalign.m4 index 49980cd..601fd21 100644 --- a/gnulib/import/m4/stdalign.m4 +++ b/gnulib/import/m4/stdalign.m4 @@ -1,6 +1,6 @@ # Check for stdalign.h that conforms to C11. -dnl Copyright 2011-2016 Free Software Foundation, Inc. +dnl Copyright 2011-2019 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. @@ -18,7 +18,7 @@ AC_DEFUN([gl_STDALIGN_H], /* Test that alignof yields a result consistent with offsetof. This catches GCC bug 52023 - <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ #ifdef __cplusplus template <class t> struct alignof_helper { char a; t b; }; # define ao(type) offsetof (alignof_helper<type>, b) @@ -35,8 +35,8 @@ AC_DEFUN([gl_STDALIGN_H], || (defined __APPLE__ && defined __MACH__ \ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ : __GNUC__) \ - || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \ - || __ICC || 0x5110 <= __SUNPRO_C \ + || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ + || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__ \ || 1300 <= _MSC_VER) struct alignas_test { char c; char alignas (8) alignas_8; }; char test_alignas[offsetof (struct alignas_test, alignas_8) == 8 diff --git a/gnulib/import/m4/stdbool.m4 b/gnulib/import/m4/stdbool.m4 index 2a9b1db..b470b05 100644 --- a/gnulib/import/m4/stdbool.m4 +++ b/gnulib/import/m4/stdbool.m4 @@ -1,22 +1,36 @@ # Check for stdbool.h that conforms to C99. -dnl Copyright (C) 2002-2006, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2019 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. -#serial 7 +#serial 8 # Prepare for substituting <stdbool.h> if it is not supported. AC_DEFUN([AM_STDBOOL_H], [ AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) + AC_REQUIRE([AC_CANONICAL_HOST]) - # Define two additional variables used in the Makefile substitution. - + dnl On some platforms, <stdbool.h> does not exist or does not conform to C99. + dnl On Solaris 10 with CC=cc CXX=CC, <stdbool.h> exists but is not usable + dnl in C++ mode (and no <cstdbool> exists). In this case, we use our + dnl replacement, also in C mode (for binary compatibility between C and C++). if test "$ac_cv_header_stdbool_h" = yes; then - STDBOOL_H='' + case "$host_os" in + solaris*) + if test -z "$GCC"; then + STDBOOL_H='stdbool.h' + else + STDBOOL_H='' + fi + ;; + *) + STDBOOL_H='' + ;; + esac else STDBOOL_H='stdbool.h' fi @@ -87,8 +101,8 @@ AC_DEFUN([AC_CHECK_HEADER_STDBOOL], char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html */ Bool q = true; Bool *pq = &q; diff --git a/gnulib/import/m4/stddef_h.m4 b/gnulib/import/m4/stddef_h.m4 index c045c65..979e3cf 100644 --- a/gnulib/import/m4/stddef_h.m4 +++ b/gnulib/import/m4/stddef_h.m4 @@ -1,6 +1,6 @@ dnl A placeholder for <stddef.h>, for platforms that have issues. -# stddef_h.m4 serial 5 -dnl Copyright (C) 2009-2016 Free Software Foundation, Inc. +# stddef_h.m4 serial 6 +dnl Copyright (C) 2009-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -10,13 +10,33 @@ AC_DEFUN([gl_STDDEF_H], AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) STDDEF_H= - AC_CHECK_TYPE([max_align_t], [], [HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h], - [[#include <stddef.h> - ]]) + + dnl Test whether the type max_align_t exists and whether its alignment + dnl "is as great as is supported by the implementation in all contexts". + AC_CACHE_CHECK([for good max_align_t], + [gl_cv_type_max_align_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stddef.h> + unsigned int s = sizeof (max_align_t); + #if defined __GNUC__ || defined __IBM__ALIGNOF__ + int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; + int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; + #endif + ]])], + [gl_cv_type_max_align_t=yes], + [gl_cv_type_max_align_t=no]) + ]) + if test $gl_cv_type_max_align_t = no; then + HAVE_MAX_ALIGN_T=0 + STDDEF_H=stddef.h + fi + if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h fi + AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], [gl_cv_decl_null_works], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h> @@ -28,6 +48,7 @@ AC_DEFUN([gl_STDDEF_H], REPLACE_NULL=1 STDDEF_H=stddef.h fi + AC_SUBST([STDDEF_H]) AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"]) if test -n "$STDDEF_H"; then diff --git a/gnulib/import/m4/stdint.m4 b/gnulib/import/m4/stdint.m4 index 05b6ab7..11d8e8e 100644 --- a/gnulib/import/m4/stdint.m4 +++ b/gnulib/import/m4/stdint.m4 @@ -1,5 +1,5 @@ -# stdint.m4 serial 48 -dnl Copyright (C) 2001-2016 Free Software Foundation, Inc. +# stdint.m4 serial 53 +dnl Copyright (C) 2001-2019 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. @@ -7,11 +7,15 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert and Bruno Haible. dnl Test whether <stdint.h> is supported or must be substituted. +AC_PREREQ([2.61]) + AC_DEFUN_ONCE([gl_STDINT_H], [ AC_PREREQ([2.59])dnl + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_LIMITS_H]) + AC_REQUIRE([gt_TYPE_WINT_T]) dnl Check for long long int and unsigned long long int. AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) @@ -287,8 +291,12 @@ static const char *macro_values[] = ]])], [gl_cv_header_working_stdint_h=yes], [], - [dnl When cross-compiling, assume it works. - gl_cv_header_working_stdint_h=yes + [case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; + # In general, assume it works. + *) gl_cv_header_working_stdint_h="guessing yes" ;; + esac ]) ]) ]) @@ -298,15 +306,16 @@ static const char *macro_values[] = 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 <stdint.h> 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([[ + case "$gl_cv_header_working_stdint_h" in + *yes) + HAVE_C99_STDINT_H=1 + dnl Now see whether the system <stdint.h> 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([[ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ #include <stdint.h> ] @@ -314,49 +323,50 @@ gl_STDINT_INCLUDES [ intmax_t im = INTMAX_MAX; int32_t i32 = INT32_C (0x7fffffff); - ]])], - [gl_cv_header_stdint_predates_cxx11_h=no])]) + ]])], + [gl_cv_header_stdint_predates_cxx11_h=no])]) - if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then - AC_DEFINE([__STDC_CONSTANT_MACROS], [1], - [Define to 1 if the system <stdint.h> predates C++11.]) - AC_DEFINE([__STDC_LIMIT_MACROS], [1], - [Define to 1 if the system <stdint.h> predates C++11.]) - fi - 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 <stdint.h> - ]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 <sys/inttypes.h>, and for - dnl <sys/bitypes.h> (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 - fi - if test $ac_cv_header_sys_bitypes_h = yes; then - HAVE_SYS_BITYPES_H=1 - fi - gl_STDINT_TYPE_PROPERTIES - fi + if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then + AC_DEFINE([__STDC_CONSTANT_MACROS], [1], + [Define to 1 if the system <stdint.h> predates C++11.]) + AC_DEFINE([__STDC_LIMIT_MACROS], [1], + [Define to 1 if the system <stdint.h> predates C++11.]) + fi + 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 <stdint.h> + ]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 + ;; + *) + dnl Check for <sys/inttypes.h>, and for + dnl <sys/bitypes.h> (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 + fi + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + fi + gl_STDINT_TYPE_PROPERTIES + ;; + esac - # 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"]) + dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. + gl_REPLACE_LIMITS_H AC_SUBST([HAVE_C99_STDINT_H]) AC_SUBST([HAVE_SYS_BITYPES_H]) @@ -528,13 +538,7 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], dnl requirement that wint_t is "unchanged by default argument promotions". dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t. dnl Set the variable BITSIZEOF_WINT_T accordingly. - if test $BITSIZEOF_WINT_T -lt 32; then + if test $GNULIB_OVERRIDES_WINT_T = 1; then BITSIZEOF_WINT_T=32 fi ]) - -dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. -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])]) -]) diff --git a/gnulib/import/m4/stdio_h.m4 b/gnulib/import/m4/stdio_h.m4 index eaa25a0..6c9c104 100644 --- a/gnulib/import/m4/stdio_h.m4 +++ b/gnulib/import/m4/stdio_h.m4 @@ -1,5 +1,5 @@ -# stdio_h.m4 serial 48 -dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +# stdio_h.m4 serial 49 +dnl Copyright (C) 2007-2019 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. @@ -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 diff --git a/gnulib/import/m4/stdlib_h.m4 b/gnulib/import/m4/stdlib_h.m4 index 3999068..6121602 100644 --- a/gnulib/import/m4/stdlib_h.m4 +++ b/gnulib/import/m4/stdlib_h.m4 @@ -1,5 +1,5 @@ -# stdlib_h.m4 serial 43 -dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +# stdlib_h.m4 serial 48 +dnl Copyright (C) 2007-2019 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. @@ -14,16 +14,19 @@ AC_DEFUN([gl_STDLIB_H], dnl guaranteed by C89. gl_WARN_ON_USE_PREPARE([[#include <stdlib.h> #if HAVE_SYS_LOADAVG_H +/* OpenIndiana has a bug: <sys/time.h> must be included before + <sys/loadavg.h>. */ +# include <sys/time.h> # include <sys/loadavg.h> #endif #if HAVE_RANDOM_H # include <random.h> #endif ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt - initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps - posix_openpt ptsname ptsname_r qsort_r random random_r realpath rpmatch - secure_getenv setenv setstate setstate_r srandom srandom_r - strtod strtoll strtoull unlockpt unsetenv]) + initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps + posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray + realpath rpmatch secure_getenv setenv setstate setstate_r srandom + srandom_r strtod strtold strtoll strtoull unlockpt unsetenv]) ]) AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], @@ -58,12 +61,14 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], GNULIB_QSORT_R=0; AC_SUBST([GNULIB_QSORT_R]) GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM]) GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) + GNULIB_REALLOCARRAY=0; AC_SUBST([GNULIB_REALLOCARRAY]) GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV]) GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) + GNULIB_STRTOLD=0; AC_SUBST([GNULIB_STRTOLD]) GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) @@ -77,6 +82,9 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) + HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE]) + HAVE_DECL_INITSTATE=1; AC_SUBST([HAVE_DECL_INITSTATE]) + HAVE_MBTOWC=1; AC_SUBST([HAVE_MBTOWC]) HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) @@ -89,12 +97,16 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM]) HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H]) HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) + HAVE_REALLOCARRAY=1; AC_SUBST([HAVE_REALLOCARRAY]) HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV]) HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) + HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) + HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) + HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) @@ -103,6 +115,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) + REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE]) REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) @@ -110,11 +123,14 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) + REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) + REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) + REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) ]) diff --git a/gnulib/import/m4/strchrnul.m4 b/gnulib/import/m4/strchrnul.m4 index ac5c211..93cf112 100644 --- a/gnulib/import/m4/strchrnul.m4 +++ b/gnulib/import/m4/strchrnul.m4 @@ -1,5 +1,5 @@ # strchrnul.m4 serial 9 -dnl Copyright (C) 2003, 2007, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2007, 2009-2019 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. diff --git a/gnulib/import/m4/strdup.m4 b/gnulib/import/m4/strdup.m4 index ff7060a..82d7420 100644 --- a/gnulib/import/m4/strdup.m4 +++ b/gnulib/import/m4/strdup.m4 @@ -1,6 +1,6 @@ # strdup.m4 serial 13 -dnl Copyright (C) 2002-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gnulib/import/m4/strerror.m4 b/gnulib/import/m4/strerror.m4 index e286594..fbfb4e1 100644 --- a/gnulib/import/m4/strerror.m4 +++ b/gnulib/import/m4/strerror.m4 @@ -1,5 +1,5 @@ -# strerror.m4 serial 17 -dnl Copyright (C) 2002, 2007-2016 Free Software Foundation, Inc. +# strerror.m4 serial 21 +dnl Copyright (C) 2002, 2007-2019 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. @@ -24,10 +24,12 @@ AC_DEFUN([gl_FUNC_STRERROR], [gl_cv_func_working_strerror=yes], [gl_cv_func_working_strerror=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_working_strerror="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_working_strerror="guessing no" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_working_strerror="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; esac ]) ]) @@ -78,10 +80,14 @@ AC_DEFUN([gl_FUNC_STRERROR_0], [gl_cv_func_strerror_0_works=yes], [gl_cv_func_strerror_0_works=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_strerror_0_works="guessing no" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; esac ]) ]) diff --git a/gnulib/import/m4/strerror_r.m4 b/gnulib/import/m4/strerror_r.m4 index aa0ea44..9907113 100644 --- a/gnulib/import/m4/strerror_r.m4 +++ b/gnulib/import/m4/strerror_r.m4 @@ -1,5 +1,5 @@ -# strerror_r.m4 serial 18 -dnl Copyright (C) 2002, 2007-2016 Free Software Foundation, Inc. +# strerror_r.m4 serial 20 +dnl Copyright (C) 2002, 2007-2019 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. @@ -14,10 +14,10 @@ AC_DEFUN([gl_FUNC_STRERROR_R], dnl Some systems don't declare strerror_r() if _THREAD_SAFE and _REENTRANT dnl are not defined. - AC_CHECK_DECL([strerror_r], - [HAVE_DECL_STRERROR_R=1], [HAVE_DECL_STRERROR_R=0]) - AC_DEFINE_UNQUOTED([HAVE_DECL_STRERROR_R_ORIG], [$HAVE_DECL_STRERROR_R], - [Define to 1 if you have the declaration of 'strerror_r' in the system include files, or to 0 otherwise.]) + AC_CHECK_DECLS_ONCE([strerror_r]) + if test $ac_cv_have_decl_strerror_r = no; then + HAVE_DECL_STRERROR_R=0 + fi if test $ac_cv_func_strerror_r = yes; then if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then @@ -36,20 +36,6 @@ AC_DEFUN([gl_FUNC_STRERROR_R], REPLACE_STRERROR_R=1 fi fi - - # Overwrite the findings of AC_FUNC_STRERROR_R (for code that uses that). - AC_REQUIRE([AC_FUNC_STRERROR_R]) -]) - -# If this module is in use, we unconditionally want POSIX semantics; so -# replace autoconf's macro with a version that does not probe -AC_DEFUN([AC_FUNC_STRERROR_R], [ - AC_DEFINE([HAVE_DECL_STRERROR_R], [1], - [Define to 1, since you should have the declaration of strerror_r.]) - AC_DEFINE([HAVE_STRERROR_R], [1], - [Define to 1, since you should have the function strerror_r.]) - AC_DEFINE([STRERROR_R_CHAR_P], [0], - [Define to 0, since strerror_r should not return char *.]) ]) # Prerequisites of lib/strerror_r.c. @@ -68,7 +54,7 @@ AC_DEFUN([gl_FUNC_STRERROR_R_WORKS], AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_FUNC_STRERROR_0]) - AC_CHECK_FUNC([strerror_r]) + AC_CHECK_FUNCS_ONCE([strerror_r]) if test $ac_cv_func_strerror_r = yes; then if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then dnl The POSIX prototype is: int strerror_r (int, char *, size_t); @@ -177,7 +163,7 @@ changequote([,])dnl [gl_cv_func_strerror_r_works=no], [dnl Guess no on all platforms that have __xpg_strerror_r, dnl at least until fixed glibc and cygwin are more common. - gl_cv_func_strerror_r_works="guessing no" + gl_cv_func_strerror_r_works="$gl_cross_guess_normal" ]) ]) fi diff --git a/gnulib/import/m4/string_h.m4 b/gnulib/import/m4/string_h.m4 index 0c5ec6f..0c0e3a7 100644 --- a/gnulib/import/m4/string_h.m4 +++ b/gnulib/import/m4/string_h.m4 @@ -1,11 +1,11 @@ # Configure a GNU-like replacement for <string.h>. -# Copyright (C) 2007-2016 Free Software Foundation, Inc. +# Copyright (C) 2007-2019 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 21 +# serial 22 # Written by Paul Eggert. @@ -43,6 +43,7 @@ AC_DEFUN([gl_STRING_MODULE_INDICATOR], AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], [ + GNULIB_EXPLICIT_BZERO=0; AC_SUBST([GNULIB_EXPLICIT_BZERO]) GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL]) GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL]) GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) @@ -82,6 +83,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO]) HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) @@ -105,16 +107,16 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) + REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) + REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) + REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) + REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) - REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) + REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) - REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) - REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) - REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) - REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) ]) diff --git a/gnulib/import/m4/strstr.m4 b/gnulib/import/m4/strstr.m4 index bfe4c85..2363514 100644 --- a/gnulib/import/m4/strstr.m4 +++ b/gnulib/import/m4/strstr.m4 @@ -1,5 +1,5 @@ -# strstr.m4 serial 17 -dnl Copyright (C) 2008-2016 Free Software Foundation, Inc. +# strstr.m4 serial 21 +dnl Copyright (C) 2008-2019 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. @@ -9,28 +9,37 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], [ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MEMCHR]) - if test "$gl_cv_func_memchr_works" != yes; then + if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then REPLACE_STRSTR=1 else - dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092. + dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092 + dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637. AC_CACHE_CHECK([whether strstr works], [gl_cv_func_strstr_works_always], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ #include <string.h> /* for strstr */ +#ifdef __GNU_LIBRARY__ + #include <features.h> + #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28 + Unlucky user + #endif +#endif #define P "_EF_BF_BD" #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P #define NEEDLE P P P P P -]], [[return !!strstr (HAYSTACK, NEEDLE); - ]])], - [gl_cv_func_strstr_works_always=yes], - [gl_cv_func_strstr_works_always=no], - [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not - dnl affected, since it uses different source code for strstr than - dnl glibc. - dnl Assume that it works on all other platforms, even if it is not - dnl linear. - AC_EGREP_CPP([Lucky user], - [ +]], + [[return !!strstr (HAYSTACK, NEEDLE); + ]])], + [gl_cv_func_strstr_works_always=yes], + [gl_cv_func_strstr_works_always=no], + [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not + dnl affected, since it uses different source code for strstr than + dnl glibc. + dnl Assume that it works on all other platforms, even if it is not + dnl linear. + AC_EGREP_CPP([Lucky user], + [ #ifdef __GNU_LIBRARY__ #include <features.h> #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ @@ -45,10 +54,10 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], #else Lucky user #endif - ], - [gl_cv_func_strstr_works_always="guessing yes"], - [gl_cv_func_strstr_works_always="guessing no"]) - ]) + ], + [gl_cv_func_strstr_works_always="guessing yes"], + [gl_cv_func_strstr_works_always="$gl_cross_guess_normal"]) + ]) ]) case "$gl_cv_func_strstr_works_always" in *yes) ;; @@ -99,6 +108,9 @@ static void quit (int sig) { _exit (sig + 128); } if (!strstr (haystack, needle)) result |= 1; } + /* Free allocated memory, in case some sanitizer is watching. */ + free (haystack); + free (needle); return result; ]])], [gl_cv_func_strstr_linear=yes], [gl_cv_func_strstr_linear=no], @@ -123,7 +135,7 @@ static void quit (int sig) { _exit (sig + 128); } #endif ], [gl_cv_func_strstr_linear="guessing yes"], - [gl_cv_func_strstr_linear="guessing no"]) + [gl_cv_func_strstr_linear="$gl_cross_guess_normal"]) ]) ]) case "$gl_cv_func_strstr_linear" in diff --git a/gnulib/import/m4/strtok_r.m4 b/gnulib/import/m4/strtok_r.m4 index d010307..e80daae 100644 --- a/gnulib/import/m4/strtok_r.m4 +++ b/gnulib/import/m4/strtok_r.m4 @@ -1,5 +1,5 @@ -# strtok_r.m4 serial 13 -dnl Copyright (C) 2002-2004, 2006-2007, 2009-2016 Free Software Foundation, +# strtok_r.m4 serial 15 +dnl Copyright (C) 2002-2004, 2006-2007, 2009-2019 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,7 +19,7 @@ AC_DEFUN([gl_FUNC_STRTOK_R], dnl when the second argument to strtok_r is a constant string that has dnl exactly one byte and compiling with optimization. This bug is, for dnl example, present in the glibc 2.7-18 package in Debian "lenny". - dnl See <http://sources.redhat.com/bugzilla/show_bug.cgi?id=5614>. + dnl See <https://sourceware.org/bugzilla/show_bug.cgi?id=5614>. AC_CACHE_CHECK([whether strtok_r works], [gl_cv_func_strtok_r_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ @@ -41,14 +41,13 @@ AC_DEFUN([gl_FUNC_STRTOK_R], ], [gl_cv_func_strtok_r_works=yes], [gl_cv_func_strtok_r_works=no], - [ -changequote(,)dnl - case "$host_os" in - # Guess no on glibc systems. - *-gnu*) gl_cv_func_strtok_r_works="guessing no";; - *) gl_cv_func_strtok_r_works="guessing yes";; + [case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_func_strtok_r_works="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_strtok_r_works="guessing yes" ;; + *) gl_cv_func_strtok_r_works="guessing yes" ;; esac -changequote([,])dnl ]) ]) case "$gl_cv_func_strtok_r_works" in diff --git a/gnulib/import/m4/sys_socket_h.m4 b/gnulib/import/m4/sys_socket_h.m4 index ae500c7..d0a9020 100644 --- a/gnulib/import/m4/sys_socket_h.m4 +++ b/gnulib/import/m4/sys_socket_h.m4 @@ -1,5 +1,5 @@ -# sys_socket_h.m4 serial 23 -dnl Copyright (C) 2005-2016 Free Software Foundation, Inc. +# sys_socket_h.m4 serial 24 +dnl Copyright (C) 2005-2019 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. @@ -104,17 +104,11 @@ AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], gl_CHECK_NEXT_HEADERS([sys/socket.h]) if test $ac_cv_header_sys_socket_h = yes; then HAVE_SYS_SOCKET_H=1 - HAVE_WS2TCPIP_H=0 else HAVE_SYS_SOCKET_H=0 - if test $ac_cv_header_ws2tcpip_h = yes; then - HAVE_WS2TCPIP_H=1 - else - HAVE_WS2TCPIP_H=0 - fi fi AC_SUBST([HAVE_SYS_SOCKET_H]) - AC_SUBST([HAVE_WS2TCPIP_H]) + gl_PREREQ_SYS_H_WS2TCPIP ]) # Common prerequisites of the <sys/socket.h> replacement and of the @@ -142,6 +136,24 @@ AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], AC_SUBST([HAVE_WINSOCK2_H]) ]) +# Common prerequisites of the <sys/socket.h> replacement and of the +# <arpa/inet.h> replacement. +# Sets and substitutes HAVE_WS2TCPIP_H. +AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP], +[ + AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) + if test $ac_cv_header_sys_socket_h = yes; then + HAVE_WS2TCPIP_H=0 + else + if test $ac_cv_header_ws2tcpip_h = yes; then + HAVE_WS2TCPIP_H=1 + else + HAVE_WS2TCPIP_H=0 + fi + fi + AC_SUBST([HAVE_WS2TCPIP_H]) +]) + AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. diff --git a/gnulib/import/m4/sys_stat_h.m4 b/gnulib/import/m4/sys_stat_h.m4 index 3d43b6f..361ac3f 100644 --- a/gnulib/import/m4/sys_stat_h.m4 +++ b/gnulib/import/m4/sys_stat_h.m4 @@ -1,5 +1,5 @@ -# sys_stat_h.m4 serial 28 -*- Autoconf -*- -dnl Copyright (C) 2006-2016 Free Software Foundation, Inc. +# sys_stat_h.m4 serial 31 -*- Autoconf -*- +dnl Copyright (C) 2006-2019 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. @@ -19,18 +19,21 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H], dnl Ensure the type mode_t gets defined. AC_REQUIRE([AC_TYPE_MODE_T]) - dnl Whether to override 'struct stat'. + dnl Whether to enable precise timestamps in 'struct stat'. + m4_ifdef([gl_WINDOWS_STAT_TIMESPEC], [ + AC_REQUIRE([gl_WINDOWS_STAT_TIMESPEC]) + ], [ + WINDOWS_STAT_TIMESPEC=0 + ]) + AC_SUBST([WINDOWS_STAT_TIMESPEC]) + + dnl Whether to ensure that struct stat.st_size is 64-bit wide. m4_ifdef([gl_LARGEFILE], [ AC_REQUIRE([gl_LARGEFILE]) ], [ WINDOWS_64_BIT_ST_SIZE=0 ]) AC_SUBST([WINDOWS_64_BIT_ST_SIZE]) - if test $WINDOWS_64_BIT_ST_SIZE = 1; then - AC_DEFINE([_GL_WINDOWS_64_BIT_ST_SIZE], [1], - [Define to 1 if Gnulib overrides 'struct stat' on Windows so that - struct stat.st_size becomes 64-bit.]) - fi dnl Define types that are supposed to be defined in <sys/types.h> or dnl <sys/stat.h>. @@ -72,6 +75,7 @@ AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT]) GNULIB_STAT=0; AC_SUBST([GNULIB_STAT]) GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT]) + GNULIB_OVERRIDES_STRUCT_STAT=0; AC_SUBST([GNULIB_OVERRIDES_STRUCT_STAT]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) diff --git a/gnulib/import/m4/sys_time_h.m4 b/gnulib/import/m4/sys_time_h.m4 index 3061a9c..3d9233a 100644 --- a/gnulib/import/m4/sys_time_h.m4 +++ b/gnulib/import/m4/sys_time_h.m4 @@ -1,7 +1,7 @@ # Configure a replacement for <sys/time.h>. -# serial 8 +# serial 9 -# Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2007, 2009-2019 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. @@ -105,7 +105,6 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS], HAVE_GETTIMEOFDAY=1; AC_SUBST([HAVE_GETTIMEOFDAY]) HAVE_STRUCT_TIMEVAL=1; AC_SUBST([HAVE_STRUCT_TIMEVAL]) HAVE_SYS_TIME_H=1; AC_SUBST([HAVE_SYS_TIME_H]) - HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) REPLACE_GETTIMEOFDAY=0; AC_SUBST([REPLACE_GETTIMEOFDAY]) REPLACE_STRUCT_TIMEVAL=0; AC_SUBST([REPLACE_STRUCT_TIMEVAL]) ]) diff --git a/gnulib/import/m4/sys_types_h.m4 b/gnulib/import/m4/sys_types_h.m4 index 159b005..be06559 100644 --- a/gnulib/import/m4/sys_types_h.m4 +++ b/gnulib/import/m4/sys_types_h.m4 @@ -1,11 +1,14 @@ -# sys_types_h.m4 serial 6 -dnl Copyright (C) 2011-2016 Free Software Foundation, Inc. +# sys_types_h.m4 serial 9 +dnl Copyright (C) 2011-2019 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_ONCE([gl_SYS_TYPES_H], [ + dnl Use sane struct stat types in OpenVMS 8.2 and later. + AC_DEFINE([_USE_STD_STAT], 1, [For standard stat data types on VMS.]) + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) gl_NEXT_HEADERS([sys/types.h]) @@ -17,6 +20,14 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], dnl Whether to override the 'off_t' type. AC_REQUIRE([gl_TYPE_OFF_T]) + + dnl Whether to override the 'dev_t' and 'ino_t' types. + m4_ifdef([gl_WINDOWS_STAT_INODES], [ + AC_REQUIRE([gl_WINDOWS_STAT_INODES]) + ], [ + WINDOWS_STAT_INODES=0 + ]) + AC_SUBST([WINDOWS_STAT_INODES]) ]) AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], @@ -24,12 +35,12 @@ AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], ]) # This works around a buggy version in autoconf <= 2.69. -# See <https://lists.gnu.org/archive/html/autoconf/2016-08/msg00014.html> +# See <https://lists.gnu.org/r/autoconf/2016-08/msg00014.html> m4_version_prereq([2.70], [], [ # This is taken from the following Autoconf patch: -# http://git.sv.gnu.org/cgit/autoconf.git/commit/?id=e17a30e98 +# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=e17a30e987d7ee695fb4294a82d987ec3dc9b974 m4_undefine([AC_HEADER_MAJOR]) AC_DEFUN([AC_HEADER_MAJOR], diff --git a/gnulib/import/m4/sys_uio_h.m4 b/gnulib/import/m4/sys_uio_h.m4 index d4d967f..8b8ba6d 100644 --- a/gnulib/import/m4/sys_uio_h.m4 +++ b/gnulib/import/m4/sys_uio_h.m4 @@ -1,5 +1,5 @@ # sys_uio_h.m4 serial 1 -dnl Copyright (C) 2011-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2019 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. diff --git a/gnulib/import/m4/tempname.m4 b/gnulib/import/m4/tempname.m4 index acf4c8d..664a632 100644 --- a/gnulib/import/m4/tempname.m4 +++ b/gnulib/import/m4/tempname.m4 @@ -1,6 +1,6 @@ #serial 5 -# Copyright (C) 2006-2007, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2006-2007, 2009-2019 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. diff --git a/gnulib/import/m4/threadlib.m4 b/gnulib/import/m4/threadlib.m4 index b43534e..96c74c1 100644 --- a/gnulib/import/m4/threadlib.m4 +++ b/gnulib/import/m4/threadlib.m4 @@ -1,11 +1,26 @@ -# threadlib.m4 serial 11 (gettext-0.18.2) -dnl Copyright (C) 2005-2016 Free Software Foundation, Inc. +# threadlib.m4 serial 24 +dnl Copyright (C) 2005-2019 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 Bruno Haible. +AC_PREREQ([2.60]) + +dnl gl_PTHREADLIB +dnl ------------- +dnl Tests for the libraries needs for using the POSIX threads API. +dnl Sets the variable LIBPTHREAD to the linker options for use in a Makefile. +dnl Sets the variable LIBPMULTITHREAD, for programs that really need +dnl multithread functionality. The difference between LIBPTHREAD and +dnl LIBPMULTITHREAD is that on platforms supporting weak symbols, typically +dnl LIBPTHREAD is empty whereas LIBPMULTITHREAD is not. +dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for +dnl multithread-safe programs. +dnl Defines the C macro HAVE_PTHREAD_API if (at least parts of) the POSIX +dnl threads API is available. + dnl gl_THREADLIB dnl ------------ dnl Tests for a multithreading library to be used. @@ -14,8 +29,13 @@ dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the dnl default is 'no', otherwise it is system dependent. In both cases, the user dnl can change the choice through the options --enable-threads=choice or dnl --disable-threads. -dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, -dnl USE_PTH_THREADS, USE_WINDOWS_THREADS +dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, +dnl USE_ISOC_AND_POSIX_THREADS, USE_WINDOWS_THREADS. +dnl The choice --enable-threads=isoc+posix is available only on platforms that +dnl have both the ISO C and the POSIX threads APIs. It has the effect of using +dnl the ISO C API for most things and the POSIX API only for creating and +dnl controlling threads (because there is no equivalent to pthread_atfork in +dnl the ISO C API). dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with dnl libtool). @@ -25,6 +45,35 @@ dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak dnl symbols, typically LIBTHREAD is empty whereas LIBMULTITHREAD is not. dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for dnl multithread-safe programs. +dnl Since support for GNU pth was removed, $LTLIBTHREAD and $LIBTHREAD have the +dnl same value, and similarly $LTLIBMULTITHREAD and $LIBMULTITHREAD have the +dnl same value. Only system libraries are needed. + +AC_DEFUN([gl_ANYTHREADLIB_EARLY], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + if test -z "$gl_anythreadlib_early_done"; then + case "$host_os" in + osf*) + # On OSF/1, the compiler needs the flag -D_REENTRANT so that it + # groks <pthread.h>. cc also understands the flag -pthread, but + # we don't use it because 1. gcc-2.95 doesn't understand -pthread, + # 2. putting a flag into CPPFLAGS that has an effect on the linker + # causes the AC_LINK_IFELSE test below to succeed unexpectedly, + # leading to wrong values of LIBTHREAD and LTLIBTHREAD. + CPPFLAGS="$CPPFLAGS -D_REENTRANT" + ;; + esac + # Some systems optimize for single-threaded programs by default, and + # need special flags to disable these optimizations. For example, the + # definition of 'errno' in <errno.h>. + case "$host_os" in + aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; + solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; + esac + gl_anythreadlib_early_done=done + fi +]) AC_DEFUN([gl_THREADLIB_EARLY], [ @@ -43,17 +92,14 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY], AC_REQUIRE([AC_CANONICAL_HOST]) dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. - dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes - dnl AC_GNU_SOURCE. - m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], - [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], - [AC_REQUIRE([AC_GNU_SOURCE])]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl Check for multithreading. m4_ifdef([gl_THREADLIB_DEFAULT_NO], [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) + m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=]) AC_ARG_ENABLE([threads], -AC_HELP_STRING([--enable-threads={posix|solaris|pth|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ +AC_HELP_STRING([--enable-threads={isoc|posix|isoc+posix|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ AC_HELP_STRING([--disable-threads], [build without multithread safety])]), [gl_use_threads=$enableval], [if test -n "$gl_use_threads_default"; then @@ -64,41 +110,174 @@ changequote(,)dnl dnl Disable multithreading by default on OSF/1, because it interferes dnl with fork()/exec(): When msgexec is linked with -lpthread, its dnl child process gets an endless segmentation fault inside execvp(). + osf*) gl_use_threads=no ;; dnl Disable multithreading by default on Cygwin 1.5.x, because it has dnl bugs that lead to endless loops or crashes. See - dnl <http://cygwin.com/ml/cygwin/2009-08/msg00283.html>. - osf*) gl_use_threads=no ;; + dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>. cygwin*) case `uname -r` in 1.[0-5].*) gl_use_threads=no ;; *) gl_use_threads=yes ;; esac ;; + dnl Obey gl_AVOID_WINPTHREAD on mingw. + mingw*) + case "$gl_use_winpthreads_default" in + yes) gl_use_threads=posix ;; + no) gl_use_threads=windows ;; + *) gl_use_threads=yes ;; + esac + ;; *) gl_use_threads=yes ;; esac changequote([,])dnl fi ]) - if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then - # For using <pthread.h>: - case "$host_os" in - osf*) - # On OSF/1, the compiler needs the flag -D_REENTRANT so that it - # groks <pthread.h>. cc also understands the flag -pthread, but - # we don't use it because 1. gcc-2.95 doesn't understand -pthread, - # 2. putting a flag into CPPFLAGS that has an effect on the linker - # causes the AC_LINK_IFELSE test below to succeed unexpectedly, - # leading to wrong values of LIBTHREAD and LTLIBTHREAD. - CPPFLAGS="$CPPFLAGS -D_REENTRANT" - ;; - esac - # Some systems optimize for single-threaded programs by default, and - # need special flags to disable these optimizations. For example, the - # definition of 'errno' in <errno.h>. - case "$host_os" in - aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; - solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; - esac + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = isoc \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + # For using <threads.h> or <pthread.h>: + gl_ANYTHREADLIB_EARLY + fi +]) + +dnl Checks whether the compiler and linker support weak declarations of symbols. + +AC_DEFUN([gl_WEAK_SYMBOLS], +[ + AC_CACHE_CHECK([whether imported symbols can be declared weak], + [gl_cv_have_weak], + [gl_cv_have_weak=no + dnl First, test whether the compiler accepts it syntactically. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[extern void xyzzy (); +#pragma weak xyzzy]], + [[xyzzy();]])], + [gl_cv_have_weak=maybe]) + if test $gl_cv_have_weak = maybe; then + dnl Second, test whether it actually works. On Cygwin 1.7.2, with + dnl gcc 4.3, symbols declared weak always evaluate to the address 0. + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <stdio.h> +#pragma weak fputs +int main () +{ + return (fputs == NULL); +}]])], + [gl_cv_have_weak=yes], + [gl_cv_have_weak=no], + [dnl When cross-compiling, assume that only ELF platforms support + dnl weak symbols. + AC_EGREP_CPP([Extensible Linking Format], + [#ifdef __ELF__ + Extensible Linking Format + #endif + ], + [gl_cv_have_weak="guessing yes"], + [gl_cv_have_weak="guessing no"]) + ]) + fi + dnl But when linking statically, weak symbols don't work. + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac + ]) + case "$gl_cv_have_weak" in + *yes) + AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], + [Define to 1 if the compiler and linker support weak declarations of symbols.]) + ;; + esac +]) + +dnl The guts of gl_PTHREADLIB. Needs to be expanded only once. + +AC_DEFUN([gl_PTHREADLIB_BODY], +[ + AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) + if test -z "$gl_threadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks <pthread.h>. It's added above, in gl_ANYTHREADLIB_EARLY. + AC_CHECK_HEADER([pthread.h], + [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <pthread.h> + pthread_mutex_t m; + pthread_mutexattr_t ma; + ]], + [[pthread_mutex_lock (&m); + pthread_mutexattr_init (&ma);]])], + [gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread]) + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done + + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + AC_CHECK_LIB([pthread], [pthread_kill], + [LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) + AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], + [Define if the pthread_in_use() detection is hard.]) + esac + ]) + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + AC_CHECK_LIB([pthread], [pthread_kill], + [gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread]) + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + AC_CHECK_LIB([c_r], [pthread_kill], + [gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r]) + fi + fi + fi + AC_MSG_CHECKING([whether POSIX threads API is available]) + AC_MSG_RESULT([$gl_pthread_api]) + AC_SUBST([LIBPTHREAD]) + AC_SUBST([LIBPMULTITHREAD]) + if test $gl_pthread_api = yes; then + AC_DEFINE([HAVE_PTHREAD_API], [1], + [Define if you have the <pthread.h> header and the POSIX threads API.]) + fi + gl_threadlib_body_done=done fi ]) @@ -114,108 +293,44 @@ AC_DEFUN([gl_THREADLIB_BODY], LTLIBMULTITHREAD= if test "$gl_use_threads" != no; then dnl Check whether the compiler and linker support weak declarations. - AC_CACHE_CHECK([whether imported symbols can be declared weak], - [gl_cv_have_weak], - [gl_cv_have_weak=no - dnl First, test whether the compiler accepts it syntactically. - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[extern void xyzzy (); -#pragma weak xyzzy]], - [[xyzzy();]])], - [gl_cv_have_weak=maybe]) - if test $gl_cv_have_weak = maybe; then - dnl Second, test whether it actually works. On Cygwin 1.7.2, with - dnl gcc 4.3, symbols declared weak always evaluate to the address 0. - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#pragma weak fputs -int main () -{ - return (fputs == NULL); -}]])], - [gl_cv_have_weak=yes], - [gl_cv_have_weak=no], - [dnl When cross-compiling, assume that only ELF platforms support - dnl weak symbols. - AC_EGREP_CPP([Extensible Linking Format], - [#ifdef __ELF__ - Extensible Linking Format - #endif - ], - [gl_cv_have_weak="guessing yes"], - [gl_cv_have_weak="guessing no"]) - ]) - fi - ]) - if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then - # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that - # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY. - AC_CHECK_HEADER([pthread.h], - [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) - if test "$gl_have_pthread_h" = yes; then - # Other possible tests: - # -lpthreads (FSU threads, PCthreads) - # -lgthreads - gl_have_pthread= - # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist - # in libc. IRIX 6.5 has the first one in both libc and libpthread, but - # the second one only in libpthread, and lock.c needs it. - # - # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 - # needs -pthread for some reason. See: - # http://lists.gnu.org/archive/html/bug-gnulib/2014-09/msg00023.html - save_LIBS=$LIBS - for gl_pthread in '' '-pthread'; do - LIBS="$LIBS $gl_pthread" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <pthread.h> - pthread_mutex_t m; - pthread_mutexattr_t ma; - ]], - [[pthread_mutex_lock (&m); - pthread_mutexattr_init (&ma);]])], - [gl_have_pthread=yes - LIBTHREAD=$gl_pthread LTLIBTHREAD=$gl_pthread - LIBMULTITHREAD=$gl_pthread LTLIBMULTITHREAD=$gl_pthread]) - LIBS=$save_LIBS - test -n "$gl_have_pthread" && break - done - - # Test for libpthread by looking for pthread_kill. (Not pthread_self, - # since it is defined as a macro on OSF/1.) - if test -n "$gl_have_pthread" && test -z "$LIBTHREAD"; then - # The program links fine without libpthread. But it may actually - # need to link with libpthread in order to create multiple threads. - AC_CHECK_LIB([pthread], [pthread_kill], - [LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread - # On Solaris and HP-UX, most pthread functions exist also in libc. - # Therefore pthread_in_use() needs to actually try to create a - # thread: pthread_create from libc will fail, whereas - # pthread_create will actually create a thread. - case "$host_os" in - solaris* | hpux*) - AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], - [Define if the pthread_in_use() detection is hard.]) - esac - ]) - elif test -z "$gl_have_pthread"; then - # Some library is needed. Try libpthread and libc_r. - AC_CHECK_LIB([pthread], [pthread_kill], - [gl_have_pthread=yes - LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread - LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread]) - if test -z "$gl_have_pthread"; then - # For FreeBSD 4. - AC_CHECK_LIB([c_r], [pthread_kill], - [gl_have_pthread=yes - LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r - LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r]) - fi - fi - if test -n "$gl_have_pthread"; then + gl_WEAK_SYMBOLS + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + dnl If we use weak symbols to implement pthread_in_use / pth_in_use / + dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create + dnl facility is in use. + AC_CHECK_HEADERS_ONCE([threads.h]) + : + fi + if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then + AC_CHECK_HEADERS_ONCE([threads.h]) + if test $ac_cv_header_threads_h = yes; then + gl_have_isoc_threads= + # Test whether both mtx_lock and cnd_timedwait exist in libc. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <threads.h> + #include <stddef.h> + mtx_t m; + cnd_t c; + ]], + [[mtx_lock (&m); + cnd_timedwait (&c, &m, NULL);]])], + [gl_have_isoc_threads=yes]) + fi + fi + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + gl_PTHREADLIB_BODY + LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD + LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD + if test $gl_pthread_api = yes; then + if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then + gl_threads_api='isoc+posix' + AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], + [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) + LIBTHREAD= LTLIBTHREAD= + else gl_threads_api=posix AC_DEFINE([USE_POSIX_THREADS], [1], [Define if the POSIX multithreading library can be used.]) @@ -223,75 +338,20 @@ int main () if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], [Define if references to the POSIX multithreading library should be made weak.]) - LIBTHREAD= - LTLIBTHREAD= + LIBTHREAD= LTLIBTHREAD= fi fi fi fi fi - if test -z "$gl_have_pthread"; then - if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then - gl_have_solaristhread= - gl_save_LIBS="$LIBS" - LIBS="$LIBS -lthread" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <thread.h> -#include <synch.h> - ]], - [[thr_self();]])], - [gl_have_solaristhread=yes]) - LIBS="$gl_save_LIBS" - if test -n "$gl_have_solaristhread"; then - gl_threads_api=solaris - LIBTHREAD=-lthread - LTLIBTHREAD=-lthread - LIBMULTITHREAD="$LIBTHREAD" - LTLIBMULTITHREAD="$LTLIBTHREAD" - AC_DEFINE([USE_SOLARIS_THREADS], [1], - [Define if the old Solaris multithreading library can be used.]) - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - AC_DEFINE([USE_SOLARIS_THREADS_WEAK], [1], - [Define if references to the old Solaris multithreading library should be made weak.]) - LIBTHREAD= - LTLIBTHREAD= - fi - fi + if test $gl_threads_api = none; then + if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then + gl_threads_api=isoc + AC_DEFINE([USE_ISOC_THREADS], [1], + [Define if the ISO C multithreading library can be used.]) fi fi - if test "$gl_use_threads" = pth; then - gl_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_LINKFLAGS([pth]) - gl_have_pth= - gl_save_LIBS="$LIBS" - LIBS="$LIBS $LIBPTH" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[#include <pth.h>]], [[pth_self();]])], - [gl_have_pth=yes]) - LIBS="$gl_save_LIBS" - if test -n "$gl_have_pth"; then - gl_threads_api=pth - LIBTHREAD="$LIBPTH" - LTLIBTHREAD="$LTLIBPTH" - LIBMULTITHREAD="$LIBTHREAD" - LTLIBMULTITHREAD="$LTLIBTHREAD" - AC_DEFINE([USE_PTH_THREADS], [1], - [Define if the GNU Pth multithreading library can be used.]) - if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - AC_DEFINE([USE_PTH_THREADS_WEAK], [1], - [Define if references to the GNU Pth multithreading library should be made weak.]) - LIBTHREAD= - LTLIBTHREAD= - fi - fi - else - CPPFLAGS="$gl_save_CPPFLAGS" - fi - fi - if test -z "$gl_have_pthread"; then + if test $gl_threads_api = none; then case "$gl_use_threads" in yes | windows | win32) # The 'win32' is for backward compatibility. if { case "$host_os" in @@ -315,6 +375,12 @@ int main () AC_SUBST([LTLIBMULTITHREAD]) ]) +AC_DEFUN([gl_PTHREADLIB], +[ + AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) + gl_PTHREADLIB_BODY +]) + AC_DEFUN([gl_THREADLIB], [ AC_REQUIRE([gl_THREADLIB_EARLY]) @@ -333,6 +399,18 @@ AC_DEFUN([gl_DISABLE_THREADS], [ ]) +dnl gl_AVOID_WINPTHREAD +dnl ------------------- +dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the +dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. +dnl The user can still override it at installation time, by using the +dnl configure option '--enable-threads'. + +AC_DEFUN([gl_AVOID_WINPTHREAD], [ + m4_divert_text([INIT_PREPARE], [gl_use_winpthreads_default=no]) +]) + + dnl Survey of platforms: dnl dnl Platform Available Compiler Supports test-lock @@ -362,7 +440,6 @@ dnl dnl Mac OS X 10.[123] posix -lpthread Y OK dnl dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK -dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK dnl dnl HP-UX 11 posix -lpthread N (cc) OK dnl Y (gcc) @@ -376,8 +453,6 @@ dnl -lpthread (gcc) Y dnl dnl Cygwin posix -lpthread Y OK dnl -dnl Any of the above pth -lpth 0.0 -dnl dnl Mingw windows N OK dnl dnl BeOS 5 -- diff --git a/gnulib/import/m4/time_h.m4 b/gnulib/import/m4/time_h.m4 index eb2a631..f08f29b 100644 --- a/gnulib/import/m4/time_h.m4 +++ b/gnulib/import/m4/time_h.m4 @@ -1,8 +1,8 @@ # Configure a more-standard replacement for <time.h>. -# Copyright (C) 2000-2001, 2003-2007, 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2000-2001, 2003-2007, 2009-2019 Free Software Foundation, Inc. -# serial 9 +# serial 11 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -104,24 +104,34 @@ AC_DEFUN([gl_TIME_MODULE_INDICATOR], AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], [ + GNULIB_CTIME=0; AC_SUBST([GNULIB_CTIME]) GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME]) + GNULIB_LOCALTIME=0; AC_SUBST([GNULIB_LOCALTIME]) GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP]) + GNULIB_STRFTIME=0; AC_SUBST([GNULIB_STRFTIME]) GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME]) GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM]) GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) GNULIB_TIME_RZ=0; AC_SUBST([GNULIB_TIME_RZ]) + GNULIB_TZSET=0; AC_SUBST([GNULIB_TZSET]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R]) HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) + HAVE_TZSET=1; AC_SUBST([HAVE_TZSET]) + dnl Even GNU libc does not have timezone_t yet. + HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) dnl If another module says to replace or to not replace, do that. dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; dnl this lets maintainers check for portability. + REPLACE_CTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_CTIME]) REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) + REPLACE_STRFTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRFTIME]) REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) + REPLACE_TZSET=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TZSET]) dnl Hack so that the time module doesn't depend on the sys_time module. dnl First, default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent. diff --git a/gnulib/import/m4/time_r.m4 b/gnulib/import/m4/time_r.m4 index 21b4a2c..cc4b3e0 100644 --- a/gnulib/import/m4/time_r.m4 +++ b/gnulib/import/m4/time_r.m4 @@ -1,6 +1,6 @@ dnl Reentrant time functions: localtime_r, gmtime_r. -dnl Copyright (C) 2003, 2006-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2006-2019 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. @@ -17,7 +17,15 @@ AC_DEFUN([gl_TIME_R], dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is dnl not defined. - AC_CHECK_DECLS([localtime_r], [], [], [[#include <time.h>]]) + AC_CHECK_DECLS([localtime_r], [], [], + [[/* mingw's <time.h> provides the functions asctime_r, ctime_r, + gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has + been included before. */ + #if defined __MINGW32__ + # include <unistd.h> + #endif + #include <time.h> + ]]) if test $ac_cv_have_decl_localtime_r = no; then HAVE_DECL_LOCALTIME_R=0 fi @@ -29,7 +37,14 @@ AC_DEFUN([gl_TIME_R], [gl_cv_time_r_posix], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( - [[#include <time.h>]], + [[/* mingw's <time.h> provides the functions asctime_r, ctime_r, + gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has + been included before. */ + #if defined __MINGW32__ + # include <unistd.h> + #endif + #include <time.h> + ]], [[/* We don't need to append 'restrict's to the argument types, even though the POSIX signature has the 'restrict's, since C99 says they can't affect type compatibility. */ @@ -49,6 +64,32 @@ AC_DEFUN([gl_TIME_R], fi else HAVE_LOCALTIME_R=0 + dnl On mingw, localtime_r() is defined as an inline function; use through a + dnl direct function call works but the use as a function pointer leads to a + dnl link error. + AC_CACHE_CHECK([whether localtime_r exists as an inline function], + [gl_cv_func_localtime_r_inline], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[/* mingw's <time.h> provides the functions asctime_r, ctime_r, + gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has + been included before. */ + #if defined __MINGW32__ + # include <unistd.h> + #endif + #include <time.h> + ]], + [[time_t a; + struct tm r; + localtime_r (&a, &r); + ]]) + ], + [gl_cv_func_localtime_r_inline=yes], + [gl_cv_func_localtime_r_inline=no]) + ]) + if test $gl_cv_func_localtime_r_inline = yes; then + REPLACE_LOCALTIME_R=1 + fi fi ]) diff --git a/gnulib/import/m4/unistd-safer.m4 b/gnulib/import/m4/unistd-safer.m4 index ceb5cc6..5e2a1be 100644 --- a/gnulib/import/m4/unistd-safer.m4 +++ b/gnulib/import/m4/unistd-safer.m4 @@ -1,5 +1,5 @@ #serial 9 -dnl Copyright (C) 2002, 2005-2006, 2009-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2005-2006, 2009-2019 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. diff --git a/gnulib/import/m4/unistd_h.m4 b/gnulib/import/m4/unistd_h.m4 index 544dadb..18b7140 100644 --- a/gnulib/import/m4/unistd_h.m4 +++ b/gnulib/import/m4/unistd_h.m4 @@ -1,5 +1,5 @@ -# unistd_h.m4 serial 68 -dnl Copyright (C) 2006-2016 Free Software Foundation, Inc. +# unistd_h.m4 serial 76 +dnl Copyright (C) 2006-2019 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. @@ -37,17 +37,17 @@ 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 - ]], [chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat - fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups - gethostname getlogin getlogin_r getpagesize + ]], [access chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir + fchownat fdatasync fsync ftruncate getcwd getdomainname getdtablesize + getgroups gethostname getlogin getlogin_r getpagesize getpass getusershell setusershell endusershell group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite - readlink readlinkat rmdir sethostname sleep symlink symlinkat ttyname_r - unlink unlinkat usleep]) + readlink readlinkat rmdir sethostname sleep symlink symlinkat + truncate ttyname_r unlink unlinkat usleep]) ]) AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], @@ -61,9 +61,11 @@ AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], AC_DEFUN([gl_UNISTD_H_DEFAULTS], [ + GNULIB_ACCESS=0; AC_SUBST([GNULIB_ACCESS]) GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR]) GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) + GNULIB_COPY_FILE_RANGE=0; AC_SUBST([GNULIB_COPY_FILE_RANGE]) GNULIB_DUP=0; AC_SUBST([GNULIB_DUP]) GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) @@ -83,6 +85,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) + GNULIB_GETPASS=0; AC_SUBST([GNULIB_GETPASS]) GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER]) GNULIB_ISATTY=0; AC_SUBST([GNULIB_ISATTY]) @@ -102,6 +105,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) + GNULIB_TRUNCATE=0; AC_SUBST([GNULIB_TRUNCATE]) GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING]) GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) @@ -111,6 +115,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) + HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE]) HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) @@ -125,6 +130,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) + HAVE_GETPASS=1; AC_SUBST([HAVE_GETPASS]) HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER]) HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) HAVE_LINK=1; AC_SUBST([HAVE_LINK]) @@ -145,17 +151,21 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC]) HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) + HAVE_DECL_GETLOGIN=1; AC_SUBST([HAVE_DECL_GETLOGIN]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) 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]) + REPLACE_ACCESS=0; AC_SUBST([REPLACE_ACCESS]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) + REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT]) REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) @@ -164,6 +174,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) + REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS]) REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) @@ -178,6 +189,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) + REPLACE_TRUNCATE=0; AC_SUBST([REPLACE_TRUNCATE]) REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) diff --git a/gnulib/import/m4/warn-on-use.m4 b/gnulib/import/m4/warn-on-use.m4 index 08440ec..7ebe2d3 100644 --- a/gnulib/import/m4/warn-on-use.m4 +++ b/gnulib/import/m4/warn-on-use.m4 @@ -1,11 +1,13 @@ -# warn-on-use.m4 serial 5 -dnl Copyright (C) 2010-2016 Free Software Foundation, Inc. +# warn-on-use.m4 serial 6 +dnl Copyright (C) 2010-2019 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. # gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) # --------------------------------------- +# If the module 'posixcheck' is in use: +# # For each whitespace-separated element in the list of NAMES, define # HAVE_RAW_DECL_name if the function has a declaration among INCLUDES # even after being undefined as a macro. @@ -23,25 +25,27 @@ dnl with or without modifications, as long as this notice is preserved. # needing gl_WARN_ON_USE_PREPARE. AC_DEFUN([gl_WARN_ON_USE_PREPARE], [ - m4_foreach_w([gl_decl], [$2], - [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), - [Define to 1 if ]m4_defn([gl_decl])[ is declared even after - undefining macros.])])dnl + m4_ifdef([gl_POSIXCHECK], + [m4_foreach_w([gl_decl], [$2], + [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), + [Define to 1 if ]m4_defn([gl_decl])[ is declared even after + undefining macros.])])dnl dnl FIXME: gl_Symbol must be used unquoted until we can assume dnl autoconf 2.64 or newer. - for gl_func in m4_flatten([$2]); do - AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl - AC_CACHE_CHECK([whether $gl_func is declared without a macro], - gl_Symbol, - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], + for gl_func in m4_flatten([$2]); do + AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl + AC_CACHE_CHECK([whether $gl_func is declared without a macro], + gl_Symbol, + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], [@%:@undef $gl_func (void) $gl_func;])], - [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) - AS_VAR_IF(gl_Symbol, [yes], - [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) - dnl shortcut - if the raw declaration exists, then set a cache - dnl variable to allow skipping any later AC_CHECK_DECL efforts - eval ac_cv_have_decl_$gl_func=yes]) - AS_VAR_POPDEF([gl_Symbol])dnl - done + [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) + AS_VAR_IF(gl_Symbol, [yes], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) + dnl shortcut - if the raw declaration exists, then set a cache + dnl variable to allow skipping any later AC_CHECK_DECL efforts + eval ac_cv_have_decl_$gl_func=yes]) + AS_VAR_POPDEF([gl_Symbol])dnl + done + ]) ]) diff --git a/gnulib/import/m4/wchar_h.m4 b/gnulib/import/m4/wchar_h.m4 index 16017a5..8c6ebcc 100644 --- a/gnulib/import/m4/wchar_h.m4 +++ b/gnulib/import/m4/wchar_h.m4 @@ -1,13 +1,13 @@ dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. -dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2019 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 Written by Eric Blake. -# wchar_h.m4 serial 40 +# wchar_h.m4 serial 44 AC_DEFUN([gl_WCHAR_H], [ @@ -35,6 +35,8 @@ AC_DEFUN([gl_WCHAR_H], fi AC_SUBST([HAVE_WINT_T]) + AC_REQUIRE([gl_TYPE_WINT_T_PREREQ]) + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ @@ -53,7 +55,7 @@ AC_DEFUN([gl_WCHAR_H], wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr - wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth + wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth wcsftime ]) ]) @@ -61,8 +63,8 @@ dnl Check whether <wchar.h> is usable at all. AC_DEFUN([gl_WCHAR_H_INLINE_OK], [ dnl Test whether <wchar.h> suffers due to the transition from '__inline' to - dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022> - dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, + dnl 'gnu_inline'. See <https://sourceware.org/bugzilla/show_bug.cgi?id=4022> + dnl and <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>. AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly], @@ -88,7 +90,8 @@ int main () { return zero(); } dnl that the object file has the latter name from the start. save_ac_compile="$ac_compile" ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` - if AC_TRY_EVAL([ac_compile]); then + if echo '#include "conftest.c"' >conftest1.c && + AC_TRY_EVAL([ac_compile]); then AC_LANG_CONFTEST([ AC_LANG_SOURCE([[#define wcstod renamed_wcstod /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before @@ -103,7 +106,8 @@ int zero (void) { return 0; } ]])]) dnl See note above about renaming object files. ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` - if AC_TRY_EVAL([ac_compile]); then + if echo '#include "conftest.c"' >conftest2.c && + AC_TRY_EVAL([ac_compile]); then if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then : else @@ -112,7 +116,7 @@ int zero (void) { return 0; } fi fi ac_compile="$save_ac_compile" - rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext + rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext ]) if test $gl_cv_header_wchar_h_correct_inline = no; then AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). @@ -120,7 +124,7 @@ This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in C99 mode. You have four options: - Add the flag -fgnu89-inline to CC and reconfigure, or - Fix your include files, using parts of - <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or + <https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or - Use a gcc version older than 4.3, or - Don't use the flags -std=c99 or -std=gnu99. Configuration aborted.]) @@ -177,6 +181,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], GNULIB_WCSSTR=0; AC_SUBST([GNULIB_WCSSTR]) GNULIB_WCSTOK=0; AC_SUBST([GNULIB_WCSTOK]) GNULIB_WCSWIDTH=0; AC_SUBST([GNULIB_WCSWIDTH]) + GNULIB_WCSFTIME=0; AC_SUBST([GNULIB_WCSFTIME]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) @@ -215,6 +220,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], HAVE_WCSSTR=1; AC_SUBST([HAVE_WCSSTR]) HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK]) HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH]) + HAVE_WCSFTIME=1; AC_SUBST([HAVE_WCSFTIME]) HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) @@ -230,4 +236,6 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) + REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) + REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) ]) diff --git a/gnulib/import/m4/wchar_t.m4 b/gnulib/import/m4/wchar_t.m4 index 2db8c3f..5db5815 100644 --- a/gnulib/import/m4/wchar_t.m4 +++ b/gnulib/import/m4/wchar_t.m4 @@ -1,5 +1,5 @@ # wchar_t.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2002-2003, 2008-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2008-2019 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. diff --git a/gnulib/import/m4/wctype_h.m4 b/gnulib/import/m4/wctype_h.m4 index accc001..d5acb72 100644 --- a/gnulib/import/m4/wctype_h.m4 +++ b/gnulib/import/m4/wctype_h.m4 @@ -1,8 +1,8 @@ -# wctype_h.m4 serial 18 +# wctype_h.m4 serial 22 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. -dnl Copyright (C) 2006-2016 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2019 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. @@ -30,6 +30,8 @@ AC_DEFUN([gl_WCTYPE_H], fi AC_SUBST([HAVE_WINT_T]) + AC_REQUIRE([gl_TYPE_WINT_T_PREREQ]) + gl_CHECK_NEXT_HEADERS([wctype.h]) if test $ac_cv_header_wctype_h = yes; then if test $ac_cv_func_iswcntrl = yes; then @@ -51,7 +53,8 @@ AC_DEFUN([gl_WCTYPE_H], int main () { return iswprint ('x') == 0; } ]])], [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> + [dnl Guess no on Linux libc5, yes otherwise. + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> #if __GNU_LIBRARY__ == 1 Linux libc5 i18n is broken. #endif]], [])], @@ -66,10 +69,14 @@ AC_DEFUN([gl_WCTYPE_H], fi AC_SUBST([HAVE_WCTYPE_H]) - case "$gl_cv_func_iswcntrl_works" in - *yes) REPLACE_ISWCNTRL=0 ;; - *) REPLACE_ISWCNTRL=1 ;; - esac + if test $GNULIB_OVERRIDES_WINT_T = 1; then + REPLACE_ISWCNTRL=1 + else + case "$gl_cv_func_iswcntrl_works" in + *yes) REPLACE_ISWCNTRL=0 ;; + *) REPLACE_ISWCNTRL=1 ;; + esac + fi AC_SUBST([REPLACE_ISWCNTRL]) if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then diff --git a/gnulib/import/m4/wint_t.m4 b/gnulib/import/m4/wint_t.m4 index 8ff2a5b..61e8a23 100644 --- a/gnulib/import/m4/wint_t.m4 +++ b/gnulib/import/m4/wint_t.m4 @@ -1,11 +1,12 @@ -# wint_t.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. +# wint_t.m4 serial 7 +dnl Copyright (C) 2003, 2007-2019 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 Bruno Haible. -dnl Test whether <wchar.h> has the 'wint_t' type. +dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's +dnl <wchar.h> or <wctype.h> would, if present, override 'wint_t'. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WINT_T], @@ -28,5 +29,46 @@ AC_DEFUN([gt_TYPE_WINT_T], [gt_cv_c_wint_t=no])]) if test $gt_cv_c_wint_t = yes; then AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) + + dnl Determine whether gnulib's <wchar.h> or <wctype.h> would, if present, + dnl override 'wint_t'. + AC_CACHE_CHECK([whether wint_t is too small], + [gl_cv_type_wint_t_too_small], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be + included before <wchar.h>. */ +#if !(defined __GLIBC__ && !defined __UCLIBC__) +# include <stddef.h> +# include <stdio.h> +# include <time.h> +#endif +#include <wchar.h> + int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1]; + ]])], + [gl_cv_type_wint_t_too_small=no], + [gl_cv_type_wint_t_too_small=yes])]) + if test $gl_cv_type_wint_t_too_small = yes; then + GNULIB_OVERRIDES_WINT_T=1 + else + GNULIB_OVERRIDES_WINT_T=0 + fi + else + GNULIB_OVERRIDES_WINT_T=0 + fi + AC_SUBST([GNULIB_OVERRIDES_WINT_T]) +]) + +dnl Prerequisites of the 'wint_t' override. +AC_DEFUN([gl_TYPE_WINT_T_PREREQ], +[ + AC_CHECK_HEADERS_ONCE([crtdefs.h]) + if test $ac_cv_header_crtdefs_h = yes; then + HAVE_CRTDEFS_H=1 + else + HAVE_CRTDEFS_H=0 fi + AC_SUBST([HAVE_CRTDEFS_H]) ]) diff --git a/gnulib/import/malloc.c b/gnulib/import/malloc.c index e9b01d2..76e6ff7 100644 --- a/gnulib/import/malloc.c +++ b/gnulib/import/malloc.c @@ -1,6 +1,6 @@ /* malloc() function that is glibc compatible. - Copyright (C) 1997-1998, 2006-2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 1997-1998, 2006-2007, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering and Bruno Haible */ diff --git a/gnulib/import/malloc/scratch_buffer.h b/gnulib/import/malloc/scratch_buffer.h new file mode 100644 index 0000000..9863e9c --- /dev/null +++ b/gnulib/import/malloc/scratch_buffer.h @@ -0,0 +1,135 @@ +/* Variable-sized buffer with on-stack default allocation. + Copyright (C) 2015-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _SCRATCH_BUFFER_H +#define _SCRATCH_BUFFER_H + +/* Scratch buffers with a default stack allocation and fallback to + heap allocation. It is expected that this function is used in this + way: + + struct scratch_buffer tmpbuf; + scratch_buffer_init (&tmpbuf); + + while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length)) + if (!scratch_buffer_grow (&tmpbuf)) + return -1; + + scratch_buffer_free (&tmpbuf); + return 0; + + The allocation functions (scratch_buffer_grow, + scratch_buffer_grow_preserve, scratch_buffer_set_array_size) make + sure that the heap allocation, if any, is freed, so that the code + above does not have a memory leak. The buffer still remains in a + state that can be deallocated using scratch_buffer_free, so a loop + like this is valid as well: + + struct scratch_buffer tmpbuf; + scratch_buffer_init (&tmpbuf); + + while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length)) + if (!scratch_buffer_grow (&tmpbuf)) + break; + + scratch_buffer_free (&tmpbuf); + + scratch_buffer_grow and scratch_buffer_grow_preserve are guaranteed + to grow the buffer by at least 512 bytes. This means that when + using the scratch buffer as a backing store for a non-character + array whose element size, in bytes, is 512 or smaller, the scratch + buffer only has to grow once to make room for at least one more + element. +*/ + +#include <stdbool.h> +#include <stddef.h> +#include <stdlib.h> + +/* Scratch buffer. Must be initialized with scratch_buffer_init + before its use. */ +struct scratch_buffer { + void *data; /* Pointer to the beginning of the scratch area. */ + size_t length; /* Allocated space at the data pointer, in bytes. */ + union { max_align_t __align; char __c[1024]; } __space; +}; + +/* Initializes *BUFFER so that BUFFER->data points to BUFFER->__space + and BUFFER->length reflects the available space. */ +static inline void +scratch_buffer_init (struct scratch_buffer *buffer) +{ + buffer->data = buffer->__space.__c; + buffer->length = sizeof (buffer->__space); +} + +/* Deallocates *BUFFER (if it was heap-allocated). */ +static inline void +scratch_buffer_free (struct scratch_buffer *buffer) +{ + if (buffer->data != buffer->__space.__c) + free (buffer->data); +} + +/* Grow *BUFFER by some arbitrary amount. The buffer contents is NOT + preserved. Return true on success, false on allocation failure (in + which case the old buffer is freed). On success, the new buffer is + larger than the previous size. On failure, *BUFFER is deallocated, + but remains in a free-able state, and errno is set. */ +bool __libc_scratch_buffer_grow (struct scratch_buffer *buffer); +libc_hidden_proto (__libc_scratch_buffer_grow) + +/* Alias for __libc_scratch_buffer_grow. */ +static __always_inline bool +scratch_buffer_grow (struct scratch_buffer *buffer) +{ + return __glibc_likely (__libc_scratch_buffer_grow (buffer)); +} + +/* Like __libc_scratch_buffer_grow, but preserve the old buffer + contents on success, as a prefix of the new buffer. */ +bool __libc_scratch_buffer_grow_preserve (struct scratch_buffer *buffer); +libc_hidden_proto (__libc_scratch_buffer_grow_preserve) + +/* Alias for __libc_scratch_buffer_grow_preserve. */ +static __always_inline bool +scratch_buffer_grow_preserve (struct scratch_buffer *buffer) +{ + return __glibc_likely (__libc_scratch_buffer_grow_preserve (buffer)); +} + +/* Grow *BUFFER so that it can store at least NELEM elements of SIZE + bytes. The buffer contents are NOT preserved. Both NELEM and SIZE + can be zero. Return true on success, false on allocation failure + (in which case the old buffer is freed, but *BUFFER remains in a + free-able state, and errno is set). It is unspecified whether this + function can reduce the array size. */ +bool __libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer, + size_t nelem, size_t size); +libc_hidden_proto (__libc_scratch_buffer_set_array_size) + +/* Alias for __libc_scratch_set_array_size. */ +static __always_inline bool +scratch_buffer_set_array_size (struct scratch_buffer *buffer, + size_t nelem, size_t size) +{ + return __glibc_likely (__libc_scratch_buffer_set_array_size + (buffer, nelem, size)); +} + +#endif /* _SCRATCH_BUFFER_H */ diff --git a/gnulib/import/malloc/scratch_buffer_grow.c b/gnulib/import/malloc/scratch_buffer_grow.c new file mode 100644 index 0000000..baeac4a --- /dev/null +++ b/gnulib/import/malloc/scratch_buffer_grow.c @@ -0,0 +1,56 @@ +/* Variable-sized buffer with on-stack default allocation. + Copyright (C) 2015-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _LIBC +# include <libc-config.h> +#endif + +#include <scratch_buffer.h> +#include <errno.h> + +bool +__libc_scratch_buffer_grow (struct scratch_buffer *buffer) +{ + void *new_ptr; + size_t new_length = buffer->length * 2; + + /* Discard old buffer. */ + scratch_buffer_free (buffer); + + /* Check for overflow. */ + if (__glibc_likely (new_length >= buffer->length)) + new_ptr = malloc (new_length); + else + { + __set_errno (ENOMEM); + new_ptr = NULL; + } + + if (__glibc_unlikely (new_ptr == NULL)) + { + /* Buffer must remain valid to free. */ + scratch_buffer_init (buffer); + return false; + } + + /* Install new heap-based buffer. */ + buffer->data = new_ptr; + buffer->length = new_length; + return true; +} +libc_hidden_def (__libc_scratch_buffer_grow) diff --git a/gnulib/import/malloc/scratch_buffer_grow_preserve.c b/gnulib/import/malloc/scratch_buffer_grow_preserve.c new file mode 100644 index 0000000..4da8fc1 --- /dev/null +++ b/gnulib/import/malloc/scratch_buffer_grow_preserve.c @@ -0,0 +1,67 @@ +/* Variable-sized buffer with on-stack default allocation. + Copyright (C) 2015-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _LIBC +# include <libc-config.h> +#endif + +#include <scratch_buffer.h> +#include <errno.h> +#include <string.h> + +bool +__libc_scratch_buffer_grow_preserve (struct scratch_buffer *buffer) +{ + size_t new_length = 2 * buffer->length; + void *new_ptr; + + if (buffer->data == buffer->__space.__c) + { + /* Move buffer to the heap. No overflow is possible because + buffer->length describes a small buffer on the stack. */ + new_ptr = malloc (new_length); + if (new_ptr == NULL) + return false; + memcpy (new_ptr, buffer->__space.__c, buffer->length); + } + else + { + /* Buffer was already on the heap. Check for overflow. */ + if (__glibc_likely (new_length >= buffer->length)) + new_ptr = realloc (buffer->data, new_length); + else + { + __set_errno (ENOMEM); + new_ptr = NULL; + } + + if (__glibc_unlikely (new_ptr == NULL)) + { + /* Deallocate, but buffer must remain valid to free. */ + free (buffer->data); + scratch_buffer_init (buffer); + return false; + } + } + + /* Install new heap-based buffer. */ + buffer->data = new_ptr; + buffer->length = new_length; + return true; +} +libc_hidden_def (__libc_scratch_buffer_grow_preserve) diff --git a/gnulib/import/malloc/scratch_buffer_set_array_size.c b/gnulib/import/malloc/scratch_buffer_set_array_size.c new file mode 100644 index 0000000..7ad188b --- /dev/null +++ b/gnulib/import/malloc/scratch_buffer_set_array_size.c @@ -0,0 +1,64 @@ +/* Variable-sized buffer with on-stack default allocation. + Copyright (C) 2015-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _LIBC +# include <libc-config.h> +#endif + +#include <scratch_buffer.h> +#include <errno.h> +#include <limits.h> + +bool +__libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer, + size_t nelem, size_t size) +{ + size_t new_length = nelem * size; + + /* Avoid overflow check if both values are small. */ + if ((nelem | size) >> (sizeof (size_t) * CHAR_BIT / 2) != 0 + && nelem != 0 && size != new_length / nelem) + { + /* Overflow. Discard the old buffer, but it must remain valid + to free. */ + scratch_buffer_free (buffer); + scratch_buffer_init (buffer); + __set_errno (ENOMEM); + return false; + } + + if (new_length <= buffer->length) + return true; + + /* Discard old buffer. */ + scratch_buffer_free (buffer); + + char *new_ptr = malloc (new_length); + if (new_ptr == NULL) + { + /* Buffer must remain valid to free. */ + scratch_buffer_init (buffer); + return false; + } + + /* Install new heap-based buffer. */ + buffer->data = new_ptr; + buffer->length = new_length; + return true; +} +libc_hidden_def (__libc_scratch_buffer_set_array_size) diff --git a/gnulib/import/malloca.c b/gnulib/import/malloca.c index a613277..f60c5fb 100644 --- a/gnulib/import/malloca.c +++ b/gnulib/import/malloca.c @@ -1,6 +1,6 @@ /* Safe automatic memory allocation. - Copyright (C) 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2003. + Copyright (C) 2003, 2006-2007, 2009-2019 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003, 2018. 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #define _GL_USE_STDLIB_ALLOC 1 #include <config.h> @@ -21,82 +21,49 @@ /* Specification. */ #include "malloca.h" -#include <stdint.h> - #include "verify.h" /* The speed critical point in this file is freea() applied to an alloca() result: it must be fast, to match the speed of alloca(). The speed of mmalloca() and freea() in the other case are not critical, because they - are only invoked for big memory sizes. */ - -#if HAVE_ALLOCA - -/* Store the mmalloca() results in a hash table. This is needed to reliably - distinguish a mmalloca() result and an alloca() result. - - Although it is possible that the same pointer is returned by alloca() and - by mmalloca() at different times in the same application, it does not lead - to a bug in freea(), because: - - Before a pointer returned by alloca() can point into malloc()ed memory, - the function must return, and once this has happened the programmer must - not call freea() on it anyway. - - Before a pointer returned by mmalloca() can point into the stack, it - must be freed. The only function that can free it is freea(), and - when freea() frees it, it also removes it from the hash table. */ - -#define MAGIC_NUMBER 0x1415fb4a -#define MAGIC_SIZE sizeof (int) -/* This is how the header info would look like without any alignment - considerations. */ -struct preliminary_header { void *next; int magic; }; -/* But the header's size must be a multiple of sa_alignment_max. */ -#define HEADER_SIZE \ - (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max) -union header { - void *next; - struct { - char room[HEADER_SIZE - MAGIC_SIZE]; - int word; - } magic; -}; -verify (HEADER_SIZE == sizeof (union header)); -/* We make the hash table quite big, so that during lookups the probability - of empty hash buckets is quite high. There is no need to make the hash - table resizable, because when the hash table gets filled so much that the - lookup becomes slow, it means that the application has memory leaks. */ -#define HASH_TABLE_SIZE 257 -static void * mmalloca_results[HASH_TABLE_SIZE]; - -#endif + are only invoked for big memory sizes. + Here we use a bit in the address as an indicator, an idea by Ondřej Bílka. + malloca() can return three types of pointers: + - Pointers ≡ 0 mod 2*sa_alignment_max come from stack allocation. + - Pointers ≡ sa_alignment_max mod 2*sa_alignment_max come from heap + allocation. + - NULL comes from a failed heap allocation. */ + +/* Type for holding very small pointer differences. */ +typedef unsigned char small_t; +/* Verify that it is wide enough. */ +verify (2 * sa_alignment_max - 1 <= (small_t) -1); void * mmalloca (size_t n) { #if HAVE_ALLOCA - /* Allocate one more word, that serves as an indicator for malloc()ed - memory, so that freea() of an alloca() result is fast. */ - size_t nplus = n + HEADER_SIZE; + /* Allocate one more word, used to determine the address to pass to freea(), + and room for the alignment ≡ sa_alignment_max mod 2*sa_alignment_max. */ + size_t nplus = n + sizeof (small_t) + 2 * sa_alignment_max - 1; if (nplus >= n) { - void *p = malloc (nplus); + char *mem = (char *) malloc (nplus); - if (p != NULL) + if (mem != NULL) { - size_t slot; - union header *h = p; - - p = h + 1; - - /* Put a magic number into the indicator word. */ - h->magic.word = MAGIC_NUMBER; - - /* Enter p into the hash table. */ - slot = (uintptr_t) p % HASH_TABLE_SIZE; - h->next = mmalloca_results[slot]; - mmalloca_results[slot] = p; - + char *p = + (char *)((((uintptr_t)mem + sizeof (small_t) + sa_alignment_max - 1) + & ~(uintptr_t)(2 * sa_alignment_max - 1)) + + sa_alignment_max); + /* Here p >= mem + sizeof (small_t), + and p <= mem + sizeof (small_t) + 2 * sa_alignment_max - 1 + hence p + n <= mem + nplus. + So, the memory range [p, p+n) lies in the allocated memory range + [mem, mem + nplus). */ + ((small_t *) p)[-1] = p - mem; + /* p ≡ sa_alignment_max mod 2*sa_alignment_max. */ return p; } } @@ -115,35 +82,24 @@ mmalloca (size_t n) void freea (void *p) { - /* mmalloca() may have returned NULL. */ - if (p != NULL) + /* Check argument. */ + if ((uintptr_t) p & (sa_alignment_max - 1)) { - /* Attempt to quickly distinguish the mmalloca() result - which has - a magic indicator word - and the alloca() result - which has an - uninitialized indicator word. It is for this test that sa_increment - additional bytes are allocated in the alloca() case. */ - if (((int *) p)[-1] == MAGIC_NUMBER) - { - /* Looks like a mmalloca() result. To see whether it really is one, - perform a lookup in the hash table. */ - size_t slot = (uintptr_t) p % HASH_TABLE_SIZE; - void **chain = &mmalloca_results[slot]; - for (; *chain != NULL;) - { - union header *h = p; - if (*chain == p) - { - /* Found it. Remove it from the hash table and free it. */ - union header *p_begin = h - 1; - *chain = p_begin->next; - free (p_begin); - return; - } - h = *chain; - chain = &h[-1].next; - } - } - /* At this point, we know it was not a mmalloca() result. */ + /* p was not the result of a malloca() call. Invalid argument. */ + abort (); + } + /* Determine whether p was a non-NULL pointer returned by mmalloca(). */ + if ((uintptr_t) p & sa_alignment_max) + { + void *mem = (char *) p - ((small_t *) p)[-1]; + free (mem); } } #endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/gnulib/import/malloca.h b/gnulib/import/malloca.h index fa27a9e..d80c316 100644 --- a/gnulib/import/malloca.h +++ b/gnulib/import/malloca.h @@ -1,5 +1,5 @@ /* Safe automatic memory allocation. - Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _MALLOCA_H #define _MALLOCA_H @@ -21,6 +21,9 @@ #include <alloca.h> #include <stddef.h> #include <stdlib.h> +#include <stdint.h> + +#include "xalloc-oversized.h" #ifdef __cplusplus @@ -53,8 +56,10 @@ extern "C" { the function returns. Upon failure, it returns NULL. */ #if HAVE_ALLOCA # define malloca(N) \ - ((N) < 4032 - sa_increment \ - ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \ + ((N) < 4032 - (2 * sa_alignment_max - 1) \ + ? (void *) (((uintptr_t) (char *) alloca ((N) + 2 * sa_alignment_max - 1) \ + + (2 * sa_alignment_max - 1)) \ + & ~(uintptr_t)(2 * sa_alignment_max - 1)) \ : mmalloca (N)) #else # define malloca(N) \ @@ -73,15 +78,7 @@ extern void freea (void *p); It allocates an array of N objects, each with S bytes of memory, on the stack. S must be positive and N must be nonnegative. The array must be freed using freea() before the function returns. */ -#if 1 -/* Cf. the definition of xalloc_oversized. */ -# define nmalloca(n, s) \ - ((n) > (size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) \ - ? NULL \ - : malloca ((n) * (s))) -#else -extern void * nmalloca (size_t n, size_t s); -#endif +#define nmalloca(n, s) (xalloc_oversized (n, s) ? NULL : malloca ((n) * (s))) #ifdef __cplusplus @@ -124,10 +121,7 @@ enum | (sa_alignment_longlong - 1) #endif | (sa_alignment_longdouble - 1) - ) + 1, -/* The increment that guarantees room for a magic word must be >= sizeof (int) - and a multiple of sa_alignment_max. */ - sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max + ) + 1 }; #endif /* _MALLOCA_H */ diff --git a/gnulib/import/malloca.valgrind b/gnulib/import/malloca.valgrind deleted file mode 100644 index 52f0a50..0000000 --- a/gnulib/import/malloca.valgrind +++ /dev/null @@ -1,7 +0,0 @@ -# Suppress a valgrind message about use of uninitialized memory in freea(). -# This use is OK because it provides only a speedup. -{ - freea - Memcheck:Cond - fun:freea -} diff --git a/gnulib/import/math.in.h b/gnulib/import/math.in.h index e1dc970..18f8ff3 100644 --- a/gnulib/import/math.in.h +++ b/gnulib/import/math.in.h @@ -1,6 +1,6 @@ /* A GNU-like <math.h>. - Copyright (C) 2002-2003, 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2007-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_MATH_H @@ -28,6 +28,11 @@ #ifndef _@GUARD_PREFIX@_MATH_H #define _@GUARD_PREFIX@_MATH_H +/* On OpenVMS, NAN, INFINITY, and HUGEVAL macros are defined in <fp.h>. */ +#if defined __VMS && ! defined NAN +# include <fp.h> +#endif + #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif @@ -62,20 +67,20 @@ _gl_cxx_ ## func ## l (long double l) \ { \ return func (l); \ } -# define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func) \ +# define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func,rpl_func,rettype) \ _GL_BEGIN_NAMESPACE \ -inline int \ -func (float f) \ +inline rettype \ +rpl_func (float f) \ { \ return _gl_cxx_ ## func ## f (f); \ } \ -inline int \ -func (double d) \ +inline rettype \ +rpl_func (double d) \ { \ return _gl_cxx_ ## func ## d (d); \ } \ -inline int \ -func (long double l) \ +inline rettype \ +rpl_func (long double l) \ { \ return _gl_cxx_ ## func ## l (l); \ } \ @@ -87,27 +92,27 @@ _GL_END_NAMESPACE classification macros with an argument of real-floating (that is, one of float, double, or long double). */ #define _GL_WARN_REAL_FLOATING_DECL(func) \ -_GL_MATH_INLINE int \ -rpl_ ## func ## f (float f) \ -{ \ - return func (f); \ -} \ -_GL_MATH_INLINE int \ -rpl_ ## func ## d (double d) \ -{ \ - return func (d); \ -} \ -_GL_MATH_INLINE int \ -rpl_ ## func ## l (long double l) \ -{ \ - return func (l); \ -} \ -_GL_WARN_ON_USE (rpl_ ## func ## f, #func " is unportable - " \ - "use gnulib module " #func " for portability"); \ -_GL_WARN_ON_USE (rpl_ ## func ## d, #func " is unportable - " \ - "use gnulib module " #func " for portability"); \ -_GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - " \ - "use gnulib module " #func " for portability") +_GL_MATH_INLINE int \ +_GL_WARN_ON_USE_ATTRIBUTE (#func " is unportable - " \ + "use gnulib module " #func " for portability") \ +rpl_ ## func ## f (float f) \ +{ \ + return func (f); \ +} \ +_GL_MATH_INLINE int \ +_GL_WARN_ON_USE_ATTRIBUTE (#func " is unportable - " \ + "use gnulib module " #func " for portability") \ +rpl_ ## func ## d (double d) \ +{ \ + return func (d); \ +} \ +_GL_MATH_INLINE int \ +_GL_WARN_ON_USE_ATTRIBUTE (#func " is unportable - " \ + "use gnulib module " #func " for portability") \ +rpl_ ## func ## l (long double l) \ +{ \ + return func (l); \ +} #define _GL_WARN_REAL_FLOATING_IMPL(func, value) \ (sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value) \ : sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value) \ @@ -189,8 +194,17 @@ _NaN () #endif -/* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined. */ -#if !(defined FP_ILOGB0 && defined FP_ILOGBNAN) +#if defined FP_ILOGB0 && defined FP_ILOGBNAN + /* Ensure FP_ILOGB0 and FP_ILOGBNAN are correct. */ +# if defined __HAIKU__ + /* Haiku: match what ilogb() does */ +# undef FP_ILOGB0 +# undef FP_ILOGBNAN +# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */ +# define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */ +# endif +#else + /* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined. */ # if defined __NetBSD__ || defined __sgi /* NetBSD, IRIX 6.5: match what ilogb() does */ # define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */ @@ -212,11 +226,20 @@ _NaN () #if @GNULIB_ACOSF@ -# if !@HAVE_ACOSF@ -# undef acosf +# if @REPLACE_ACOSF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef acosf +# define acosf rpl_acosf +# endif +_GL_FUNCDECL_RPL (acosf, float, (float x)); +_GL_CXXALIAS_RPL (acosf, float, (float x)); +# else +# if !@HAVE_ACOSF@ +# undef acosf _GL_FUNCDECL_SYS (acosf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (acosf, float, (float x)); +# endif _GL_CXXALIASWARN (acosf); #elif defined GNULIB_POSIXCHECK # undef acosf @@ -243,11 +266,20 @@ _GL_WARN_ON_USE (acosl, "acosl is unportable - " #if @GNULIB_ASINF@ -# if !@HAVE_ASINF@ -# undef asinf +# if @REPLACE_ASINF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef asinf +# define asinf rpl_asinf +# endif +_GL_FUNCDECL_RPL (asinf, float, (float x)); +_GL_CXXALIAS_RPL (asinf, float, (float x)); +# else +# if !@HAVE_ASINF@ +# undef asinf _GL_FUNCDECL_SYS (asinf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (asinf, float, (float x)); +# endif _GL_CXXALIASWARN (asinf); #elif defined GNULIB_POSIXCHECK # undef asinf @@ -274,11 +306,20 @@ _GL_WARN_ON_USE (asinl, "asinl is unportable - " #if @GNULIB_ATANF@ -# if !@HAVE_ATANF@ -# undef atanf +# if @REPLACE_ATANF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef atanf +# define atanf rpl_atanf +# endif +_GL_FUNCDECL_RPL (atanf, float, (float x)); +_GL_CXXALIAS_RPL (atanf, float, (float x)); +# else +# if !@HAVE_ATANF@ +# undef atanf _GL_FUNCDECL_SYS (atanf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (atanf, float, (float x)); +# endif _GL_CXXALIASWARN (atanf); #elif defined GNULIB_POSIXCHECK # undef atanf @@ -305,11 +346,20 @@ _GL_WARN_ON_USE (atanl, "atanl is unportable - " #if @GNULIB_ATAN2F@ -# if !@HAVE_ATAN2F@ -# undef atan2f +# if @REPLACE_ATAN2F@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef atan2f +# define atan2f rpl_atan2f +# endif +_GL_FUNCDECL_RPL (atan2f, float, (float y, float x)); +_GL_CXXALIAS_RPL (atan2f, float, (float y, float x)); +# else +# if !@HAVE_ATAN2F@ +# undef atan2f _GL_FUNCDECL_SYS (atan2f, float, (float y, float x)); -# endif +# endif _GL_CXXALIAS_SYS (atan2f, float, (float y, float x)); +# endif _GL_CXXALIASWARN (atan2f); #elif defined GNULIB_POSIXCHECK # undef atan2f @@ -348,7 +398,9 @@ _GL_WARN_ON_USE (cbrtf, "cbrtf is unportable - " _GL_FUNCDECL_SYS (cbrt, double, (double x)); # endif _GL_CXXALIAS_SYS (cbrt, double, (double x)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (cbrt); +# endif #elif defined GNULIB_POSIXCHECK # undef cbrt # if HAVE_RAW_DECL_CBRT @@ -416,7 +468,9 @@ _GL_CXXALIAS_RPL (ceil, double, (double x)); # else _GL_CXXALIAS_SYS (ceil, double, (double x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (ceil); +# endif #endif #if @GNULIB_CEILL@ @@ -446,6 +500,7 @@ _GL_WARN_ON_USE (ceill, "ceill is unportable - " #if @GNULIB_COPYSIGNF@ # if !@HAVE_DECL_COPYSIGNF@ +# undef copysignf _GL_FUNCDECL_SYS (copysignf, float, (float x, float y)); # endif _GL_CXXALIAS_SYS (copysignf, float, (float x, float y)); @@ -463,7 +518,9 @@ _GL_WARN_ON_USE (copysignf, "copysignf is unportable - " _GL_FUNCDECL_SYS (copysign, double, (double x, double y)); # endif _GL_CXXALIAS_SYS (copysign, double, (double x, double y)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (copysign); +# endif #elif defined GNULIB_POSIXCHECK # undef copysign # if HAVE_RAW_DECL_COPYSIGN @@ -488,11 +545,20 @@ _GL_WARN_ON_USE (copysign, "copysignl is unportable - " #if @GNULIB_COSF@ -# if !@HAVE_COSF@ -# undef cosf +# if @REPLACE_COSF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef cosf +# define cosf rpl_cosf +# endif +_GL_FUNCDECL_RPL (cosf, float, (float x)); +_GL_CXXALIAS_RPL (cosf, float, (float x)); +# else +# if !@HAVE_COSF@ +# undef cosf _GL_FUNCDECL_SYS (cosf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (cosf, float, (float x)); +# endif _GL_CXXALIASWARN (cosf); #elif defined GNULIB_POSIXCHECK # undef cosf @@ -519,11 +585,20 @@ _GL_WARN_ON_USE (cosl, "cosl is unportable - " #if @GNULIB_COSHF@ -# if !@HAVE_COSHF@ -# undef coshf +# if @REPLACE_COSHF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef coshf +# define coshf rpl_coshf +# endif +_GL_FUNCDECL_RPL (coshf, float, (float x)); +_GL_CXXALIAS_RPL (coshf, float, (float x)); +# else +# if !@HAVE_COSHF@ +# undef coshf _GL_FUNCDECL_SYS (coshf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (coshf, float, (float x)); +# endif _GL_CXXALIASWARN (coshf); #elif defined GNULIB_POSIXCHECK # undef coshf @@ -535,11 +610,20 @@ _GL_WARN_ON_USE (coshf, "coshf is unportable - " #if @GNULIB_EXPF@ -# if !@HAVE_EXPF@ -# undef expf +# if @REPLACE_EXPF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef expf +# define expf rpl_expf +# endif +_GL_FUNCDECL_RPL (expf, float, (float x)); +_GL_CXXALIAS_RPL (expf, float, (float x)); +# else +# if !@HAVE_EXPF@ +# undef expf _GL_FUNCDECL_SYS (expf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (expf, float, (float x)); +# endif _GL_CXXALIASWARN (expf); #elif defined GNULIB_POSIXCHECK # undef expf @@ -550,11 +634,20 @@ _GL_WARN_ON_USE (expf, "expf is unportable - " #endif #if @GNULIB_EXPL@ -# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@ -# undef expl +# if @REPLACE_EXPL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef expl +# define expl rpl_expl +# endif +_GL_FUNCDECL_RPL (expl, long double, (long double x)); +_GL_CXXALIAS_RPL (expl, long double, (long double x)); +# else +# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@ +# undef expl _GL_FUNCDECL_SYS (expl, long double, (long double x)); -# endif +# endif _GL_CXXALIAS_SYS (expl, long double, (long double x)); +# endif _GL_CXXALIASWARN (expl); #elif defined GNULIB_POSIXCHECK # undef expl @@ -593,7 +686,9 @@ _GL_FUNCDECL_SYS (exp2, double, (double x)); # endif _GL_CXXALIAS_SYS (exp2, double, (double x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (exp2); +# endif #elif defined GNULIB_POSIXCHECK # undef exp2 # if HAVE_RAW_DECL_EXP2 @@ -664,7 +759,9 @@ _GL_FUNCDECL_SYS (expm1, double, (double x)); # endif _GL_CXXALIAS_SYS (expm1, double, (double x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (expm1); +# endif #elif defined GNULIB_POSIXCHECK # undef expm1 # if HAVE_RAW_DECL_EXPM1 @@ -674,11 +771,22 @@ _GL_WARN_ON_USE (expm1, "expm1 is unportable - " #endif #if @GNULIB_EXPM1L@ -# if !@HAVE_DECL_EXPM1L@ -# undef expm1l +# if @REPLACE_EXPM1L@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef expm1l +# define expm1l rpl_expm1l +# endif +_GL_FUNCDECL_RPL (expm1l, long double, (long double x)); +_GL_CXXALIAS_RPL (expm1l, long double, (long double x)); +# else +# if !@HAVE_DECL_EXPM1L@ +# undef expm1l +# if !(defined __cplusplus && defined _AIX) _GL_FUNCDECL_SYS (expm1l, long double, (long double x)); -# endif +# endif +# endif _GL_CXXALIAS_SYS (expm1l, long double, (long double x)); +# endif _GL_CXXALIASWARN (expm1l); #elif defined GNULIB_POSIXCHECK # undef expm1l @@ -764,7 +872,9 @@ _GL_CXXALIAS_RPL (floor, double, (double x)); # else _GL_CXXALIAS_SYS (floor, double, (double x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (floor); +# endif #endif #if @GNULIB_FLOORL@ @@ -802,6 +912,7 @@ _GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z)); _GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z)); # else # if !@HAVE_FMAF@ +# undef fmaf _GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z)); # endif _GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z)); @@ -825,11 +936,14 @@ _GL_FUNCDECL_RPL (fma, double, (double x, double y, double z)); _GL_CXXALIAS_RPL (fma, double, (double x, double y, double z)); # else # if !@HAVE_FMA@ +# undef fma _GL_FUNCDECL_SYS (fma, double, (double x, double y, double z)); # endif _GL_CXXALIAS_SYS (fma, double, (double x, double y, double z)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fma); +# endif #elif defined GNULIB_POSIXCHECK # undef fma # if HAVE_RAW_DECL_FMA @@ -851,8 +965,10 @@ _GL_CXXALIAS_RPL (fmal, long double, # else # if !@HAVE_FMAL@ # undef fmal +# if !(defined __cplusplus && defined _AIX) _GL_FUNCDECL_SYS (fmal, long double, (long double x, long double y, long double z)); +# endif # endif _GL_CXXALIAS_SYS (fmal, long double, (long double x, long double y, long double z)); @@ -902,7 +1018,9 @@ _GL_CXXALIAS_RPL (fmod, double, (double x, double y)); # else _GL_CXXALIAS_SYS (fmod, double, (double x, double y)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fmod); +# endif #elif defined GNULIB_POSIXCHECK # undef fmod # if HAVE_RAW_DECL_FMOD @@ -985,7 +1103,9 @@ _GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr)); # else _GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN1 (frexp, double, (double x, int *expptr)); +# endif #elif defined GNULIB_POSIXCHECK # undef frexp /* Assume frexp is always declared. */ @@ -1065,7 +1185,9 @@ _GL_CXXALIAS_RPL (hypot, double, (double x, double y)); # else _GL_CXXALIAS_SYS (hypot, double, (double x, double y)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (hypot); +# endif #elif defined GNULIB_POSIXCHECK # undef hypot # if HAVE_RAW_DECL_HYPOT @@ -1136,7 +1258,9 @@ _GL_FUNCDECL_SYS (ilogb, int, (double x)); # endif _GL_CXXALIAS_SYS (ilogb, int, (double x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (ilogb); +# endif #elif defined GNULIB_POSIXCHECK # undef ilogb # if HAVE_RAW_DECL_ILOGB @@ -1146,10 +1270,19 @@ _GL_WARN_ON_USE (ilogb, "ilogb is unportable - " #endif #if @GNULIB_ILOGBL@ -# if !@HAVE_ILOGBL@ +# if @REPLACE_ILOGBL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ilogbl +# define ilogbl rpl_ilogbl +# endif +_GL_FUNCDECL_RPL (ilogbl, int, (long double x)); +_GL_CXXALIAS_RPL (ilogbl, int, (long double x)); +# else +# if !@HAVE_ILOGBL@ _GL_FUNCDECL_SYS (ilogbl, int, (long double x)); -# endif +# endif _GL_CXXALIAS_SYS (ilogbl, int, (long double x)); +# endif _GL_CXXALIASWARN (ilogbl); #elif defined GNULIB_POSIXCHECK # undef ilogbl @@ -1239,7 +1372,9 @@ _GL_CXXALIAS_RPL (log, double, (double x)); # else _GL_CXXALIAS_SYS (log, double, (double x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (log); +# endif #elif defined GNULIB_POSIXCHECK # undef log # if HAVE_RAW_DECL_LOG @@ -1308,7 +1443,9 @@ _GL_CXXALIAS_RPL (log10, double, (double x)); # else _GL_CXXALIAS_SYS (log10, double, (double x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (log10); +# endif #elif defined GNULIB_POSIXCHECK # undef log10 # if HAVE_RAW_DECL_LOG10 @@ -1379,7 +1516,9 @@ _GL_FUNCDECL_SYS (log1p, double, (double x)); # endif _GL_CXXALIAS_SYS (log1p, double, (double x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (log1p); +# endif #elif defined GNULIB_POSIXCHECK # undef log1p # if HAVE_RAW_DECL_LOG1P @@ -1451,7 +1590,9 @@ _GL_FUNCDECL_SYS (log2, double, (double x)); # endif _GL_CXXALIAS_SYS (log2, double, (double x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (log2); +# endif #elif defined GNULIB_POSIXCHECK # undef log2 # if HAVE_RAW_DECL_LOG2 @@ -1521,7 +1662,9 @@ _GL_FUNCDECL_SYS (logb, double, (double x)); # endif _GL_CXXALIAS_SYS (logb, double, (double x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (logb); +# endif #elif defined GNULIB_POSIXCHECK # undef logb # if HAVE_RAW_DECL_LOGB @@ -1589,7 +1732,9 @@ _GL_CXXALIAS_RPL (modf, double, (double x, double *iptr)); # else _GL_CXXALIAS_SYS (modf, double, (double x, double *iptr)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (modf); +# endif #elif defined GNULIB_POSIXCHECK # undef modf # if HAVE_RAW_DECL_MODF @@ -1678,7 +1823,9 @@ _GL_FUNCDECL_SYS (remainder, double, (double x, double y)); # endif _GL_CXXALIAS_SYS (remainder, double, (double x, double y)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (remainder); +# endif #elif defined GNULIB_POSIXCHECK # undef remainder # if HAVE_RAW_DECL_REMAINDER @@ -1698,7 +1845,9 @@ _GL_CXXALIAS_RPL (remainderl, long double, (long double x, long double y)); # else # if !@HAVE_DECL_REMAINDERL@ # undef remainderl +# if !(defined __cplusplus && defined _AIX) _GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y)); +# endif # endif _GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y)); # endif @@ -1731,7 +1880,9 @@ _GL_WARN_ON_USE (rintf, "rintf is unportable - " _GL_FUNCDECL_SYS (rint, double, (double x)); # endif _GL_CXXALIAS_SYS (rint, double, (double x)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (rint); +# endif #elif defined GNULIB_POSIXCHECK # undef rint # if HAVE_RAW_DECL_RINT @@ -1741,10 +1892,19 @@ _GL_WARN_ON_USE (rint, "rint is unportable - " #endif #if @GNULIB_RINTL@ -# if !@HAVE_RINTL@ +# if @REPLACE_RINTL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef rintl +# define rintl rpl_rintl +# endif +_GL_FUNCDECL_RPL (rintl, long double, (long double x)); +_GL_CXXALIAS_RPL (rintl, long double, (long double x)); +# else +# if !@HAVE_RINTL@ _GL_FUNCDECL_SYS (rintl, long double, (long double x)); -# endif +# endif _GL_CXXALIAS_SYS (rintl, long double, (long double x)); +# endif _GL_CXXALIASWARN (rintl); #elif defined GNULIB_POSIXCHECK # undef rintl @@ -1792,7 +1952,9 @@ _GL_FUNCDECL_SYS (round, double, (double x)); # endif _GL_CXXALIAS_SYS (round, double, (double x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (round); +# endif #elif defined GNULIB_POSIXCHECK # undef round # if HAVE_RAW_DECL_ROUND @@ -1812,7 +1974,9 @@ _GL_CXXALIAS_RPL (roundl, long double, (long double x)); # else # if !@HAVE_DECL_ROUNDL@ # undef roundl +# if !(defined __cplusplus && defined _AIX) _GL_FUNCDECL_SYS (roundl, long double, (long double x)); +# endif # endif _GL_CXXALIAS_SYS (roundl, long double, (long double x)); # endif @@ -1827,11 +1991,20 @@ _GL_WARN_ON_USE (roundl, "roundl is unportable - " #if @GNULIB_SINF@ -# if !@HAVE_SINF@ -# undef sinf +# if @REPLACE_SINF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef sinf +# define sinf rpl_sinf +# endif +_GL_FUNCDECL_RPL (sinf, float, (float x)); +_GL_CXXALIAS_RPL (sinf, float, (float x)); +# else +# if !@HAVE_SINF@ + # undef sinf _GL_FUNCDECL_SYS (sinf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (sinf, float, (float x)); +# endif _GL_CXXALIASWARN (sinf); #elif defined GNULIB_POSIXCHECK # undef sinf @@ -1858,11 +2031,20 @@ _GL_WARN_ON_USE (sinl, "sinl is unportable - " #if @GNULIB_SINHF@ -# if !@HAVE_SINHF@ -# undef sinhf +# if @REPLACE_SINHF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef sinhf +# define sinhf rpl_sinhf +# endif +_GL_FUNCDECL_RPL (sinhf, float, (float x)); +_GL_CXXALIAS_RPL (sinhf, float, (float x)); +# else +# if !@HAVE_SINHF@ +# undef sinhf _GL_FUNCDECL_SYS (sinhf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (sinhf, float, (float x)); +# endif _GL_CXXALIASWARN (sinhf); #elif defined GNULIB_POSIXCHECK # undef sinhf @@ -1874,11 +2056,20 @@ _GL_WARN_ON_USE (sinhf, "sinhf is unportable - " #if @GNULIB_SQRTF@ -# if !@HAVE_SQRTF@ -# undef sqrtf +# if @REPLACE_SQRTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef sqrtf +# define sqrtf rpl_sqrtf +# endif +_GL_FUNCDECL_RPL (sqrtf, float, (float x)); +_GL_CXXALIAS_RPL (sqrtf, float, (float x)); +# else +# if !@HAVE_SQRTF@ +# undef sqrtf _GL_FUNCDECL_SYS (sqrtf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (sqrtf, float, (float x)); +# endif _GL_CXXALIASWARN (sqrtf); #elif defined GNULIB_POSIXCHECK # undef sqrtf @@ -1914,11 +2105,20 @@ _GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - " #if @GNULIB_TANF@ -# if !@HAVE_TANF@ -# undef tanf +# if @REPLACE_TANF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef tanf +# define tanf rpl_tanf +# endif +_GL_FUNCDECL_RPL (tanf, float, (float x)); +_GL_CXXALIAS_RPL (tanf, float, (float x)); +# else +# if !@HAVE_TANF@ +# undef tanf _GL_FUNCDECL_SYS (tanf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (tanf, float, (float x)); +# endif _GL_CXXALIASWARN (tanf); #elif defined GNULIB_POSIXCHECK # undef tanf @@ -1945,11 +2145,20 @@ _GL_WARN_ON_USE (tanl, "tanl is unportable - " #if @GNULIB_TANHF@ -# if !@HAVE_TANHF@ -# undef tanhf +# if @REPLACE_TANHF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef tanhf +# define tanhf rpl_tanhf +# endif +_GL_FUNCDECL_RPL (tanhf, float, (float x)); +_GL_CXXALIAS_RPL (tanhf, float, (float x)); +# else +# if !@HAVE_TANHF@ +# undef tanhf _GL_FUNCDECL_SYS (tanhf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (tanhf, float, (float x)); +# endif _GL_CXXALIASWARN (tanhf); #elif defined GNULIB_POSIXCHECK # undef tanhf @@ -1997,7 +2206,9 @@ _GL_FUNCDECL_SYS (trunc, double, (double x)); # endif _GL_CXXALIAS_SYS (trunc, double, (double x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (trunc); +# endif #elif defined GNULIB_POSIXCHECK # undef trunc # if HAVE_RAW_DECL_TRUNC @@ -2049,7 +2260,14 @@ _GL_EXTERN_C int gl_isfinitel (long double x); # if defined isfinite || defined GNULIB_NAMESPACE _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite) # undef isfinite -_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite) +# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined _AIX)) + /* This platform's <cmath> possibly defines isfinite through a set of inline + functions. */ +_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool) +# define isfinite rpl_isfinite +# else +_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, isfinite, bool) +# endif # endif # endif #elif defined GNULIB_POSIXCHECK @@ -2076,7 +2294,14 @@ _GL_EXTERN_C int gl_isinfl (long double x); # if defined isinf || defined GNULIB_NAMESPACE _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf) # undef isinf -_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf) +# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)) + /* This platform's <cmath> possibly defines isinf through a set of inline + functions. */ +_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, rpl_isinf, bool) +# define isinf rpl_isinf +# else +_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, isinf, bool) +# endif # endif # endif #elif defined GNULIB_POSIXCHECK @@ -2194,7 +2419,14 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST; # if defined isnan || defined GNULIB_NAMESPACE _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan) # undef isnan -_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan) +# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)) + /* This platform's <cmath> possibly defines isnan through a set of inline + functions. */ +_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool) +# define isnan rpl_isnan +# else +_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool) +# endif # endif # else /* Ensure isnan is a macro. */ @@ -2221,7 +2453,7 @@ _GL_WARN_REAL_FLOATING_DECL (isnan); sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \ __builtin_signbitf (x)) # endif -# if @REPLACE_SIGNBIT@ +# if @REPLACE_SIGNBIT@ && !GNULIB_defined_signbit # undef signbit _GL_EXTERN_C int gl_signbitf (float arg); _GL_EXTERN_C int gl_signbitd (double arg); @@ -2264,12 +2496,20 @@ _GL_EXTERN_C int gl_signbitl (long double arg); (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \ sizeof (x) == sizeof (double) ? gl_signbitd (x) : \ gl_signbitf (x)) +# define GNULIB_defined_signbit 1 # endif # ifdef __cplusplus # if defined signbit || defined GNULIB_NAMESPACE _GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit) # undef signbit -_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit) +# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined _AIX)) + /* This platform's <cmath> possibly defines signbit through a set of inline + functions. */ +_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool) +# define signbit rpl_signbit +# else +_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, signbit, bool) +# endif # endif # endif #elif defined GNULIB_POSIXCHECK diff --git a/gnulib/import/mbrtowc.c b/gnulib/import/mbrtowc.c index cdd874b..1aad22c 100644 --- a/gnulib/import/mbrtowc.c +++ b/gnulib/import/mbrtowc.c @@ -1,5 +1,5 @@ /* Convert multibyte character to wide character. - Copyright (C) 1999-2002, 2005-2016 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2005-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -34,7 +34,67 @@ # include "localcharset.h" # include "streq.h" # include "verify.h" +# include "glthread/lock.h" + +# ifndef FALLTHROUGH +# if __GNUC__ < 7 +# define FALLTHROUGH ((void) 0) +# else +# define FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +# endif + +/* Returns a classification of special values of the encoding of the current + locale. */ +typedef enum { + enc_other, /* other */ + enc_utf8, /* UTF-8 */ + enc_eucjp, /* EUC-JP */ + enc_94, /* EUC-KR, GB2312, BIG5 */ + enc_euctw, /* EUC-TW */ + enc_gb18030, /* GB18030 */ + enc_sjis /* SJIS */ +} enc_t; +static inline enc_t +locale_enc (void) +{ + const char *encoding = locale_charset (); + if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) + return enc_utf8; + if (STREQ_OPT (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)) + return enc_eucjp; + if (STREQ_OPT (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) + || STREQ_OPT (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) + || STREQ_OPT (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)) + return enc_94; + if (STREQ_OPT (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)) + return enc_euctw; + if (STREQ_OPT (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0)) + return enc_gb18030; + if (STREQ_OPT (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0)) + return enc_sjis; + return enc_other; +} + +# if GNULIB_WCHAR_SINGLE +/* When we know that the locale does not change, provide a speedup by + caching the value of locale_enc. */ +static int cached_locale_enc = -1; +static inline enc_t +locale_enc_cached (void) +{ + if (cached_locale_enc < 0) + cached_locale_enc = locale_enc (); + return cached_locale_enc; +} +# else +/* By default, don't make assumptions, hence no caching. */ +# define locale_enc_cached locale_enc +# endif +/* This lock protects the internal state of mbtowc against multiple simultaneous + calls of mbrtowc. */ +gl_lock_define_initialized(static, mbtowc_lock) verify (sizeof (mbstate_t) >= 4); @@ -65,6 +125,8 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) char buf[4]; const char *p; size_t m; + enc_t enc; + int res; switch (nstate) { @@ -74,10 +136,10 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) break; case 3: buf[2] = pstate[3]; - /*FALLTHROUGH*/ + FALLTHROUGH; case 2: buf[1] = pstate[2]; - /*FALLTHROUGH*/ + FALLTHROUGH; case 1: buf[0] = pstate[1]; p = buf; @@ -97,231 +159,296 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) /* Here m > 0. */ -# if __GLIBC__ || defined __UCLIBC__ - /* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */ - mbtowc (NULL, NULL, 0); -# endif - { - int res = mbtowc (pwc, p, m); - - if (res >= 0) - { - if (pwc != NULL && ((*pwc == 0) != (res == 0))) - abort (); - if (nstate >= (res > 0 ? res : 1)) - abort (); - res -= nstate; - pstate[0] = 0; - return res; - } + enc = locale_enc_cached (); - /* mbtowc does not distinguish between invalid and incomplete multibyte - sequences. But mbrtowc needs to make this distinction. - There are two possible approaches: - - Use iconv() and its return value. - - Use built-in knowledge about the possible encodings. - Given the low quality of implementation of iconv() on the systems that - lack mbrtowc(), we use the second approach. - The possible encodings are: - - 8-bit encodings, - - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS, - - UTF-8. - Use specialized code for each. */ - if (m >= 4 || m >= MB_CUR_MAX) - goto invalid; - /* Here MB_CUR_MAX > 1 and 0 < m < 4. */ + if (enc == enc_utf8) /* UTF-8 */ { - const char *encoding = locale_charset (); + /* Achieve multi-thread safety by not calling mbtowc() at all. */ + /* Cf. unistr/u8-mbtouc.c. */ + unsigned char c = (unsigned char) p[0]; - if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) + if (c < 0x80) { - /* Cf. unistr/u8-mblen.c. */ - unsigned char c = (unsigned char) p[0]; - - if (c >= 0xc2) - { - if (c < 0xe0) - { - if (m == 1) - goto incomplete; - } - else if (c < 0xf0) - { - if (m == 1) - goto incomplete; - if (m == 2) - { - unsigned char c2 = (unsigned char) p[1]; - - if ((c2 ^ 0x80) < 0x40 - && (c >= 0xe1 || c2 >= 0xa0) - && (c != 0xed || c2 < 0xa0)) - goto incomplete; - } - } - else if (c <= 0xf4) - { - if (m == 1) - goto incomplete; - else /* m == 2 || m == 3 */ - { - unsigned char c2 = (unsigned char) p[1]; - - if ((c2 ^ 0x80) < 0x40 - && (c >= 0xf1 || c2 >= 0x90) - && (c < 0xf4 || (c == 0xf4 && c2 < 0x90))) - { - if (m == 2) - goto incomplete; - else /* m == 3 */ - { - unsigned char c3 = (unsigned char) p[2]; - - if ((c3 ^ 0x80) < 0x40) - goto incomplete; - } - } - } - } - } - goto invalid; + if (pwc != NULL) + *pwc = c; + res = (c == 0 ? 0 : 1); + goto success; } - - /* As a reference for this code, you can use the GNU libiconv - implementation. Look for uses of the RET_TOOFEW macro. */ - - if (STREQ_OPT (encoding, - "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)) + if (c >= 0xc2) { - if (m == 1) + if (c < 0xe0) { - unsigned char c = (unsigned char) p[0]; - - if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f) + if (m == 1) goto incomplete; - } - if (m == 2) - { - unsigned char c = (unsigned char) p[0]; - - if (c == 0x8f) + else /* m >= 2 */ { unsigned char c2 = (unsigned char) p[1]; - if (c2 >= 0xa1 && c2 < 0xff) - goto incomplete; + if ((c2 ^ 0x80) < 0x40) + { + if (pwc != NULL) + *pwc = ((unsigned int) (c & 0x1f) << 6) + | (unsigned int) (c2 ^ 0x80); + res = 2; + goto success; + } } } - goto invalid; - } - if (STREQ_OPT (encoding, - "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) - || STREQ_OPT (encoding, - "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) - || STREQ_OPT (encoding, - "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)) - { - if (m == 1) + else if (c < 0xf0) { - unsigned char c = (unsigned char) p[0]; - - if (c >= 0xa1 && c < 0xff) + if (m == 1) goto incomplete; - } - goto invalid; - } - if (STREQ_OPT (encoding, - "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)) - { - if (m == 1) - { - unsigned char c = (unsigned char) p[0]; + else + { + unsigned char c2 = (unsigned char) p[1]; - if ((c >= 0xa1 && c < 0xff) || c == 0x8e) - goto incomplete; - } - else /* m == 2 || m == 3 */ - { - unsigned char c = (unsigned char) p[0]; + if ((c2 ^ 0x80) < 0x40 + && (c >= 0xe1 || c2 >= 0xa0) + && (c != 0xed || c2 < 0xa0)) + { + if (m == 2) + goto incomplete; + else /* m >= 3 */ + { + unsigned char c3 = (unsigned char) p[2]; - if (c == 0x8e) - goto incomplete; + if ((c3 ^ 0x80) < 0x40) + { + if (pwc != NULL) + *pwc = ((unsigned int) (c & 0x0f) << 12) + | ((unsigned int) (c2 ^ 0x80) << 6) + | (unsigned int) (c3 ^ 0x80); + res = 3; + goto success; + } + } + } + } } - goto invalid; - } - if (STREQ_OPT (encoding, - "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0)) - { - if (m == 1) + else if (c <= 0xf4) { - unsigned char c = (unsigned char) p[0]; - - if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe)) + if (m == 1) goto incomplete; - } - else /* m == 2 || m == 3 */ - { - unsigned char c = (unsigned char) p[0]; - - if (c >= 0x90 && c <= 0xe3) + else { unsigned char c2 = (unsigned char) p[1]; - if (c2 >= 0x30 && c2 <= 0x39) + if ((c2 ^ 0x80) < 0x40 + && (c >= 0xf1 || c2 >= 0x90) + && (c < 0xf4 || (c == 0xf4 && c2 < 0x90))) { if (m == 2) goto incomplete; - else /* m == 3 */ + else { unsigned char c3 = (unsigned char) p[2]; - if (c3 >= 0x81 && c3 <= 0xfe) - goto incomplete; + if ((c3 ^ 0x80) < 0x40) + { + if (m == 3) + goto incomplete; + else /* m >= 4 */ + { + unsigned char c4 = (unsigned char) p[3]; + + if ((c4 ^ 0x80) < 0x40) + { + if (pwc != NULL) + *pwc = ((unsigned int) (c & 0x07) << 18) + | ((unsigned int) (c2 ^ 0x80) << 12) + | ((unsigned int) (c3 ^ 0x80) << 6) + | (unsigned int) (c4 ^ 0x80); + res = 4; + goto success; + } + } + } } } } } - goto invalid; } - if (STREQ_OPT (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0)) - { - if (m == 1) - { - unsigned char c = (unsigned char) p[0]; + goto invalid; + } + else + { + /* The hidden internal state of mbtowc would make this function not + multi-thread safe. Achieve multi-thread safety through a lock. */ + gl_lock_lock (mbtowc_lock); - if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea) - || (c >= 0xf0 && c <= 0xf9)) - goto incomplete; - } - goto invalid; - } + /* Put the hidden internal state of mbtowc into its initial state. + This is needed at least with glibc, uClibc, and MSVC CRT. + See <https://sourceware.org/bugzilla/show_bug.cgi?id=9674>. */ + mbtowc (NULL, NULL, 0); - /* An unknown multibyte encoding. */ - goto incomplete; - } + res = mbtowc (pwc, p, m); - incomplete: - { - size_t k = nstate; - /* Here 0 <= k < m < 4. */ - pstate[++k] = s[0]; - if (k < m) + gl_lock_unlock (mbtowc_lock); + + if (res >= 0) + { + if (pwc != NULL && ((*pwc == 0) != (res == 0))) + abort (); + goto success; + } + + /* mbtowc does not distinguish between invalid and incomplete multibyte + sequences. But mbrtowc needs to make this distinction. + There are two possible approaches: + - Use iconv() and its return value. + - Use built-in knowledge about the possible encodings. + Given the low quality of implementation of iconv() on the systems + that lack mbrtowc(), we use the second approach. + The possible encodings are: + - 8-bit encodings, + - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS, + - UTF-8 (already handled above). + Use specialized code for each. */ + if (m >= 4 || m >= MB_CUR_MAX) + goto invalid; + /* Here MB_CUR_MAX > 1 and 0 < m < 4. */ + switch (enc) { - pstate[++k] = s[1]; - if (k < m) - pstate[++k] = s[2]; + /* As a reference for this code, you can use the GNU libiconv + implementation. Look for uses of the RET_TOOFEW macro. */ + + case enc_eucjp: /* EUC-JP */ + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f) + goto incomplete; + } + if (m == 2) + { + unsigned char c = (unsigned char) p[0]; + + if (c == 0x8f) + { + unsigned char c2 = (unsigned char) p[1]; + + if (c2 >= 0xa1 && c2 < 0xff) + goto incomplete; + } + } + goto invalid; + } + + case enc_94: /* EUC-KR, GB2312, BIG5 */ + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if (c >= 0xa1 && c < 0xff) + goto incomplete; + } + goto invalid; + } + + case enc_euctw: /* EUC-TW */ + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0xa1 && c < 0xff) || c == 0x8e) + goto incomplete; + } + else /* m == 2 || m == 3 */ + { + unsigned char c = (unsigned char) p[0]; + + if (c == 0x8e) + goto incomplete; + } + goto invalid; + } + + case enc_gb18030: /* GB18030 */ + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe)) + goto incomplete; + } + else /* m == 2 || m == 3 */ + { + unsigned char c = (unsigned char) p[0]; + + if (c >= 0x90 && c <= 0xe3) + { + unsigned char c2 = (unsigned char) p[1]; + + if (c2 >= 0x30 && c2 <= 0x39) + { + if (m == 2) + goto incomplete; + else /* m == 3 */ + { + unsigned char c3 = (unsigned char) p[2]; + + if (c3 >= 0x81 && c3 <= 0xfe) + goto incomplete; + } + } + } + } + goto invalid; + } + + case enc_sjis: /* SJIS */ + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea) + || (c >= 0xf0 && c <= 0xf9)) + goto incomplete; + } + goto invalid; + } + + default: + /* An unknown multibyte encoding. */ + goto incomplete; } - if (k != m) - abort (); } - pstate[0] = m; - return (size_t)(-2); - invalid: - errno = EILSEQ; - /* The conversion state is undefined, says POSIX. */ - return (size_t)(-1); + success: + /* res >= 0 is the corrected return value of mbtowc (pwc, p, m). */ + if (nstate >= (res > 0 ? res : 1)) + abort (); + res -= nstate; + pstate[0] = 0; + return res; + + incomplete: + { + size_t k = nstate; + /* Here 0 <= k < m < 4. */ + pstate[++k] = s[0]; + if (k < m) + { + pstate[++k] = s[1]; + if (k < m) + pstate[++k] = s[2]; + } + if (k != m) + abort (); } + pstate[0] = m; + return (size_t)(-2); + + invalid: + errno = EILSEQ; + /* The conversion state is undefined, says POSIX. */ + return (size_t)(-1); } } diff --git a/gnulib/import/mbsinit.c b/gnulib/import/mbsinit.c index 372b523..5ecaef7 100644 --- a/gnulib/import/mbsinit.c +++ b/gnulib/import/mbsinit.c @@ -1,5 +1,5 @@ /* Test for initial conversion state. - Copyright (C) 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -22,17 +22,7 @@ #include "verify.h" -#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ - -/* On native Windows, 'mbstate_t' is defined as 'int'. */ - -int -mbsinit (const mbstate_t *ps) -{ - return ps == NULL || *ps == 0; -} - -#else +#if GNULIB_defined_mbstate_t /* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs() and wcrtomb(), wcsrtombs(). @@ -45,6 +35,7 @@ mbsinit (const mbstate_t *ps) We define the meaning of mbstate_t as follows: - In mb -> wc direction, mbstate_t's first byte contains the number of buffered bytes (in the range 0..3), followed by up to 3 buffered bytes. + See mbrtowc.c. - In wc -> mb direction, mbstate_t contains no information. In other words, it is always in the initial state. */ @@ -58,4 +49,25 @@ mbsinit (const mbstate_t *ps) return pstate == NULL || pstate[0] == 0; } +#else + +int +mbsinit (const mbstate_t *ps) +{ +# if defined _WIN32 && !defined __CYGWIN__ + /* Native Windows. */ +# ifdef __MINGW32__ + /* On mingw, 'mbstate_t' is defined as 'int'. */ + return ps == NULL || *ps == 0; +# else + /* MSVC defines 'mbstate_t' as an 8-byte struct; the first 4-bytes matter. */ + return ps == NULL || *(const unsigned int *)ps == 0; +# endif +# else + /* Minix, HP-UX 11.00, Solaris 2.6, Interix, ... */ + /* Maybe this definition works, maybe not... */ + return ps == NULL || *(const char *)ps == 0; +# endif +} + #endif diff --git a/gnulib/import/mbsrtowcs-impl.h b/gnulib/import/mbsrtowcs-impl.h index f99fa34..110d692 100644 --- a/gnulib/import/mbsrtowcs-impl.h +++ b/gnulib/import/mbsrtowcs-impl.h @@ -1,5 +1,5 @@ /* Convert string to wide string. - Copyright (C) 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) diff --git a/gnulib/import/mbsrtowcs-state.c b/gnulib/import/mbsrtowcs-state.c index 905547a..59525e7 100644 --- a/gnulib/import/mbsrtowcs-state.c +++ b/gnulib/import/mbsrtowcs-state.c @@ -1,5 +1,5 @@ /* Convert string to wide string. - Copyright (C) 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -23,7 +23,7 @@ mbstate_t _gl_mbsrtowcs_state /* The state must initially be in the "initial state"; so, zero-initialize it. On most systems, putting it into BSS is sufficient. Not so on Mac OS X 10.3, - see <http://lists.gnu.org/archive/html/bug-gnulib/2009-01/msg00329.html>. + see <https://lists.gnu.org/r/bug-gnulib/2009-01/msg00329.html>. When it needs an initializer, use 0 or {0} as initializer? 0 only works when mbstate_t is a scalar type (such as when gnulib defines it, or on AIX, IRIX, mingw). {0} works as an initializer in all cases: for a struct diff --git a/gnulib/import/mbsrtowcs.c b/gnulib/import/mbsrtowcs.c index 54bf6f7..14f241e 100644 --- a/gnulib/import/mbsrtowcs.c +++ b/gnulib/import/mbsrtowcs.c @@ -1,5 +1,5 @@ /* Convert string to wide string. - Copyright (C) 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/memchr.c b/gnulib/import/memchr.c index b565542..4e0c5f9 100644 --- a/gnulib/import/memchr.c +++ b/gnulib/import/memchr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2016 +/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2019 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), @@ -21,7 +21,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. */ +along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> diff --git a/gnulib/import/memchr.valgrind b/gnulib/import/memchr.valgrind index 60f247e..1d60e29 100644 --- a/gnulib/import/memchr.valgrind +++ b/gnulib/import/memchr.valgrind @@ -1,4 +1,20 @@ # Suppress a valgrind message about use of uninitialized memory in memchr(). + +# Copyright (C) 2009-2019 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + # POSIX states that when the character is found, memchr must not read extra # bytes in an overestimated length (for example, where memchr is used to # implement strnlen). However, we use a safe word read to provide a speedup. diff --git a/gnulib/import/memmem.c b/gnulib/import/memmem.c index 7d1f971..12ae24f 100644 --- a/gnulib/import/memmem.c +++ b/gnulib/import/memmem.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2016 Free Software +/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* This particular implementation was written by Eric Blake, 2008. */ @@ -24,10 +24,6 @@ /* Specification of memmem. */ #include <string.h> -#ifndef _LIBC -# define __builtin_expect(expr, val) (expr) -#endif - #define RETURN_TYPE void * #define AVAILABLE(h, h_l, j, n_l) ((j) <= (h_l) - (n_l)) #include "str-two-way.h" diff --git a/gnulib/import/mempcpy.c b/gnulib/import/mempcpy.c index d579f64..d0220e1 100644 --- a/gnulib/import/mempcpy.c +++ b/gnulib/import/mempcpy.c @@ -1,5 +1,5 @@ /* Copy memory area and return pointer after last written byte. - Copyright (C) 2003, 2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2003, 2007, 2009-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/memrchr.c b/gnulib/import/memrchr.c index e6212e5..9602283 100644 --- a/gnulib/import/memrchr.c +++ b/gnulib/import/memrchr.c @@ -1,6 +1,6 @@ /* memrchr -- find the last occurrence of a byte in a memory block - Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2016 Free Software + Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2019 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), @@ -20,7 +20,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if defined _LIBC # include <memcopy.h> @@ -68,7 +68,7 @@ __memrchr (void const *s, int c_in, size_t n) if (*--char_ptr == c) return (void *) char_ptr; - longword_ptr = (const longword *) char_ptr; + longword_ptr = (const void *) char_ptr; /* All these elucidatory comments refer to 4-byte longwords, but the theory applies equally well to any size longwords. */ diff --git a/gnulib/import/mkdir.c b/gnulib/import/mkdir.c index 59bdea1..b8320d0 100644 --- a/gnulib/import/mkdir.c +++ b/gnulib/import/mkdir.c @@ -1,7 +1,7 @@ /* On some systems, mkdir ("foo/", 0700) fails because of the trailing slash. On those systems, this wrapper removes the trailing slash. - Copyright (C) 2001, 2003, 2006, 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2006, 2008-2019 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 @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ @@ -38,7 +38,7 @@ 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 in the <sys/stat.h> override. */ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ # define mkdir(name,mode) _mkdir (name) # define maybe_unused _GL_UNUSED #else diff --git a/gnulib/import/mkdtemp.c b/gnulib/import/mkdtemp.c index c1b05fd..b1dd28d 100644 --- a/gnulib/import/mkdtemp.c +++ b/gnulib/import/mkdtemp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2016 Free Software +/* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Extracted from misc/mkdtemp.c. */ diff --git a/gnulib/import/mkostemp.c b/gnulib/import/mkostemp.c index 31c3e48..bbfe9db 100644 --- a/gnulib/import/mkostemp.c +++ b/gnulib/import/mkostemp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2016 Free Software +/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2019 Free Software Foundation, Inc. This file is derived from the one in the GNU C Library. @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if !_LIBC # include <config.h> diff --git a/gnulib/import/msvc-inval.c b/gnulib/import/msvc-inval.c index baaf39e..75b5a07 100644 --- a/gnulib/import/msvc-inval.c +++ b/gnulib/import/msvc-inval.c @@ -1,5 +1,5 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/msvc-inval.h b/gnulib/import/msvc-inval.h index 027c949..9d3aa1f 100644 --- a/gnulib/import/msvc-inval.h +++ b/gnulib/import/msvc-inval.h @@ -1,5 +1,5 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _MSVC_INVAL_H #define _MSVC_INVAL_H @@ -95,7 +95,7 @@ extern void gl_msvc_inval_ensure_handler (void); /* Gnulib can define its own status codes, as described in the page "Raising Software Exceptions" on microsoft.com - <http://msdn.microsoft.com/en-us/library/het71c37.aspx>. + <https://docs.microsoft.com/en-us/cpp/cpp/raising-software-exceptions>. Our status codes are composed of - 0xE0000000, mandatory for all user-defined status codes, - 0x474E550, a API identifier ("GNU"), @@ -106,7 +106,7 @@ extern void gl_msvc_inval_ensure_handler (void); # if defined _MSC_VER /* A compiler that supports __try/__except, as described in the page "try-except statement" on microsoft.com - <http://msdn.microsoft.com/en-us/library/s58ftw19.aspx>. + <https://docs.microsoft.com/en-us/cpp/cpp/try-except-statement>. With __try/__except, we can use the multithread-safe exception handling. */ # ifdef __cplusplus diff --git a/gnulib/import/msvc-nothrow.c b/gnulib/import/msvc-nothrow.c index ba75bbfb..49b709c 100644 --- a/gnulib/import/msvc-nothrow.c +++ b/gnulib/import/msvc-nothrow.c @@ -1,6 +1,6 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -24,7 +24,9 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> -#include "msvc-inval.h" +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +#endif #undef _get_osfhandle diff --git a/gnulib/import/msvc-nothrow.h b/gnulib/import/msvc-nothrow.h index 3493b84..8d3ca78 100644 --- a/gnulib/import/msvc-nothrow.h +++ b/gnulib/import/msvc-nothrow.h @@ -1,6 +1,6 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _MSVC_NOTHROW_H #define _MSVC_NOTHROW_H @@ -25,7 +25,7 @@ This file defines wrappers that turn such an invalid parameter notification into an error code. */ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ /* Get original declaration of _get_osfhandle. */ # include <io.h> diff --git a/gnulib/import/netinet_in.in.h b/gnulib/import/netinet_in.in.h index 54e1ec0..98575b2 100644 --- a/gnulib/import/netinet_in.in.h +++ b/gnulib/import/netinet_in.in.h @@ -1,5 +1,5 @@ /* Substitute for <netinet/in.h>. - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_NETINET_IN_H diff --git a/gnulib/import/open.c b/gnulib/import/open.c index e9c3120..0c2742b 100644 --- a/gnulib/import/open.c +++ b/gnulib/import/open.c @@ -1,5 +1,5 @@ /* Open a descriptor to a file. - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ @@ -38,6 +38,8 @@ orig_open (const char *filename, int flags, mode_t mode) this include because of the preliminary #include <fcntl.h> above. */ #include "fcntl.h" +#include "cloexec.h" + #include <errno.h> #include <stdarg.h> #include <string.h> @@ -52,6 +54,13 @@ orig_open (const char *filename, int flags, mode_t mode) int open (const char *filename, int flags, ...) { + /* 0 = unknown, 1 = yes, -1 = no. */ +#if GNULIB_defined_O_CLOEXEC + int have_cloexec = -1; +#else + static int have_cloexec; +#endif + mode_t mode; int fd; @@ -77,28 +86,25 @@ 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 #if OPEN_TRAILING_SLASH_BUG - /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR - is specified, then fail. - Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> - says that - "A pathname that contains at least one non-slash character and that - ends with one or more trailing slashes shall be resolved as if a - single dot character ( '.' ) were appended to the pathname." - and - "The special filename dot shall refer to the directory specified by - its predecessor." + /* Fail if one of O_CREAT, O_WRONLY, O_RDWR is specified and the filename + ends in a slash, as POSIX says such a filename must name a directory + <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>: + "A pathname that contains at least one non-<slash> character and that + ends with one or more trailing <slash> characters shall not be resolved + successfully unless the last pathname component before the trailing + <slash> characters names an existing directory" If the named file already exists as a directory, then - if O_CREAT is specified, open() must fail because of the semantics of O_CREAT, - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX - <http://www.opengroup.org/susv3/functions/open.html> says that it - fails with errno = EISDIR in this case. + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html> + says that it fails with errno = EISDIR in this case. If the named file does not exist or does not name a directory, then - if O_CREAT is specified, open() must fail since open() cannot create directories, @@ -115,7 +121,25 @@ open (const char *filename, int flags, ...) } #endif - fd = orig_open (filename, flags, mode); + fd = orig_open (filename, + flags & ~(have_cloexec <= 0 ? O_CLOEXEC : 0), mode); + + if (flags & O_CLOEXEC) + { + if (! have_cloexec) + { + if (0 <= fd) + have_cloexec = 1; + else if (errno == EINVAL) + { + fd = orig_open (filename, flags & ~O_CLOEXEC, mode); + have_cloexec = -1; + } + } + if (have_cloexec < 0 && 0 <= fd) + set_cloexec_flag (fd, true); + } + #if REPLACE_FCHDIR /* Implementing fchdir and fdopendir requires the ability to open a @@ -144,14 +168,12 @@ open (const char *filename, int flags, ...) #if OPEN_TRAILING_SLASH_BUG /* If the filename ends in a slash and fd does not refer to a directory, then fail. - Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> - says that - "A pathname that contains at least one non-slash character and that - ends with one or more trailing slashes shall be resolved as if a - single dot character ( '.' ) were appended to the pathname." - and - "The special filename dot shall refer to the directory specified by - its predecessor." + Rationale: POSIX says such a filename must name a directory + <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>: + "A pathname that contains at least one non-<slash> character and that + ends with one or more trailing <slash> characters shall not be resolved + successfully unless the last pathname component before the trailing + <slash> characters names an existing directory" If the named file without the slash is not a directory, open() must fail with ENOTDIR. */ if (fd >= 0) diff --git a/gnulib/import/openat-die.c b/gnulib/import/openat-die.c index 7ab3860..690c447 100644 --- a/gnulib/import/openat-die.c +++ b/gnulib/import/openat-die.c @@ -1,6 +1,6 @@ /* Report a save- or restore-cwd failure in our openat replacement and then exit. - Copyright (C) 2005-2006, 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/openat-priv.h b/gnulib/import/openat-priv.h index ed763db..7b90eef 100644 --- a/gnulib/import/openat-priv.h +++ b/gnulib/import/openat-priv.h @@ -1,6 +1,6 @@ /* Internals for openat-like functions. - Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/gnulib/import/openat-proc.c b/gnulib/import/openat-proc.c index 1712340..da76e2b 100644 --- a/gnulib/import/openat-proc.c +++ b/gnulib/import/openat-proc.c @@ -1,6 +1,6 @@ /* Create /proc/self/fd-related names for subfiles of open directories. - Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/gnulib/import/openat.c b/gnulib/import/openat.c index acbf7e3..8aaee49 100644 --- a/gnulib/import/openat.c +++ b/gnulib/import/openat.c @@ -1,5 +1,5 @@ /* provide a replacement openat function - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ @@ -41,19 +41,30 @@ orig_openat (int fd, char const *filename, int flags, mode_t mode) #include "openat.h" +#include "cloexec.h" + #include <stdarg.h> #include <stdbool.h> #include <stddef.h> +#include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <errno.h> #if HAVE_OPENAT -/* Like openat, but work around Solaris 9 bugs with trailing slash. */ +/* Like openat, but support O_CLOEXEC and work around Solaris 9 bugs + with trailing slash. */ int rpl_openat (int dfd, char const *filename, int flags, ...) { + /* 0 = unknown, 1 = yes, -1 = no. */ +#if GNULIB_defined_O_CLOEXEC + int have_cloexec = -1; +#else + static int have_cloexec; +#endif + mode_t mode; int fd; @@ -71,22 +82,19 @@ rpl_openat (int dfd, char const *filename, int flags, ...) } # if OPEN_TRAILING_SLASH_BUG - /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR - is specified, then fail. - Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> - says that - "A pathname that contains at least one non-slash character and that - ends with one or more trailing slashes shall be resolved as if a - single dot character ( '.' ) were appended to the pathname." - and - "The special filename dot shall refer to the directory specified by - its predecessor." + /* Fail if one of O_CREAT, O_WRONLY, O_RDWR is specified and the filename + ends in a slash, as POSIX says such a filename must name a directory + <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>: + "A pathname that contains at least one non-<slash> character and that + ends with one or more trailing <slash> characters shall not be resolved + successfully unless the last pathname component before the trailing + <slash> characters names an existing directory" If the named file already exists as a directory, then - if O_CREAT is specified, open() must fail because of the semantics of O_CREAT, - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX - <http://www.opengroup.org/susv3/functions/open.html> says that it - fails with errno = EISDIR in this case. + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/openat.html> + says that it fails with errno = EISDIR in this case. If the named file does not exist or does not name a directory, then - if O_CREAT is specified, open() must fail since open() cannot create directories, @@ -103,19 +111,35 @@ rpl_openat (int dfd, char const *filename, int flags, ...) } # endif - fd = orig_openat (dfd, filename, flags, mode); + fd = orig_openat (dfd, filename, + flags & ~(have_cloexec <= 0 ? O_CLOEXEC : 0), mode); + + if (flags & O_CLOEXEC) + { + if (! have_cloexec) + { + if (0 <= fd) + have_cloexec = 1; + else if (errno == EINVAL) + { + fd = orig_openat (dfd, filename, flags & ~O_CLOEXEC, mode); + have_cloexec = -1; + } + } + if (have_cloexec < 0 && 0 <= fd) + set_cloexec_flag (fd, true); + } + # if OPEN_TRAILING_SLASH_BUG /* If the filename ends in a slash and fd does not refer to a directory, then fail. - Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> - says that - "A pathname that contains at least one non-slash character and that - ends with one or more trailing slashes shall be resolved as if a - single dot character ( '.' ) were appended to the pathname." - and - "The special filename dot shall refer to the directory specified by - its predecessor." + Rationale: POSIX says such a filename must name a directory + <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>: + "A pathname that contains at least one non-<slash> character and that + ends with one or more trailing <slash> characters shall not be resolved + successfully unless the last pathname component before the trailing + <slash> characters names an existing directory" If the named file without the slash is not a directory, open() must fail with ENOTDIR. */ if (fd >= 0) @@ -146,7 +170,7 @@ rpl_openat (int dfd, char const *filename, int flags, ...) # include "save-cwd.h" /* Replacement for Solaris' openat function. - <http://www.google.com/search?q=openat+site:docs.sun.com> + <https://www.google.com/search?q=openat+site:docs.oracle.com> First, try to simulate it via open ("/proc/self/fd/FD/FILE"). Failing that, simulate it by doing save_cwd/fchdir/open/restore_cwd. If either the save_cwd or the restore_cwd fails (relatively unlikely), diff --git a/gnulib/import/openat.h b/gnulib/import/openat.h index edee6c5..f23b371 100644 --- a/gnulib/import/openat.h +++ b/gnulib/import/openat.h @@ -1,5 +1,5 @@ /* provide a replacement openat function - Copyright (C) 2004-2006, 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2006, 2008-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/gnulib/import/opendir.c b/gnulib/import/opendir.c index a135fd8..2eb96c6 100644 --- a/gnulib/import/opendir.c +++ b/gnulib/import/opendir.c @@ -1,5 +1,5 @@ /* Start reading the entries of a directory. - Copyright (C) 2006-2016 Free Software Foundation, Inc. + Copyright (C) 2006-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/pathmax.h b/gnulib/import/pathmax.h index aee22f8..4287d15 100644 --- a/gnulib/import/pathmax.h +++ b/gnulib/import/pathmax.h @@ -1,5 +1,5 @@ /* Define PATH_MAX somehow. Requires sys/types.h. - Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2016 Free Software + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,14 +13,14 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _PATHMAX_H # define _PATHMAX_H /* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename, including the terminating NUL byte. - <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html> + <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html> PATH_MAX is not defined on systems which have no limit on filename length, such as GNU/Hurd. @@ -65,10 +65,10 @@ # define PATH_MAX 1024 # endif -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# if defined _WIN32 && ! defined __CYGWIN__ /* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com, section "Maximum Path Length Limitation", - <http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#maxpath> + <https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#maximum-path-length-limitation> explains that the maximum size of a filename, including the terminating NUL byte, is 260 = 3 + 256 + 1. This is the same value as diff --git a/gnulib/import/pipe-safer.c b/gnulib/import/pipe-safer.c index fc6144e..6201739 100644 --- a/gnulib/import/pipe-safer.c +++ b/gnulib/import/pipe-safer.c @@ -1,5 +1,5 @@ /* Invoke pipe, but avoid some glitches. - Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff --git a/gnulib/import/rawmemchr.c b/gnulib/import/rawmemchr.c index dbe01bd..7df6151 100644 --- a/gnulib/import/rawmemchr.c +++ b/gnulib/import/rawmemchr.c @@ -1,5 +1,5 @@ /* Searching in a string. - Copyright (C) 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2008-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/rawmemchr.valgrind b/gnulib/import/rawmemchr.valgrind index 6363923..3d91a72 100644 --- a/gnulib/import/rawmemchr.valgrind +++ b/gnulib/import/rawmemchr.valgrind @@ -1,4 +1,20 @@ # Suppress a valgrind message about use of uninitialized memory in rawmemchr(). + +# Copyright (C) 2008-2019 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + # This use is OK because it provides only a speedup. { rawmemchr-value4 diff --git a/gnulib/import/readdir.c b/gnulib/import/readdir.c index 76b7e9d..200b6e5 100644 --- a/gnulib/import/readdir.c +++ b/gnulib/import/readdir.c @@ -1,5 +1,5 @@ /* Read the next entry of a directory. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -32,7 +32,7 @@ readdir (DIR *dirp) /* There is no need to add code to produce entries for "." and "..". According to the POSIX:2008 section "4.12 Pathname Resolution" - <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html> + <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html> "." and ".." are syntactic entities. POSIX also says: "If entries for dot or dot-dot exist, one entry shall be returned diff --git a/gnulib/import/readlink.c b/gnulib/import/readlink.c index e6c3925..bf71109 100644 --- a/gnulib/import/readlink.c +++ b/gnulib/import/readlink.c @@ -1,5 +1,5 @@ /* Stub for readlink(). - Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/realloc.c b/gnulib/import/realloc.c index 83cb44e..a81ce3b 100644 --- a/gnulib/import/realloc.c +++ b/gnulib/import/realloc.c @@ -1,6 +1,6 @@ /* realloc() function that is glibc compatible. - Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2016 Free Software + Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering and Bruno Haible */ diff --git a/gnulib/import/ref-add.sin b/gnulib/import/ref-add.sin deleted file mode 100644 index 42d3ab0..0000000 --- a/gnulib/import/ref-add.sin +++ /dev/null @@ -1,29 +0,0 @@ -# Add this package to a list of references stored in a text file. -# -# Copyright (C) 2000, 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, 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 <http://www.gnu.org/licenses/>. -# -# Written by Bruno Haible <haible@clisp.cons.org>. -# -/^# Packages using this file: / { - s/# Packages using this file:// - ta - :a - s/ @PACKAGE@ / @PACKAGE@ / - tb - s/ $/ @PACKAGE@ / - :b - s/^/# Packages using this file:/ -} diff --git a/gnulib/import/ref-del.sin b/gnulib/import/ref-del.sin deleted file mode 100644 index c77b33b..0000000 --- a/gnulib/import/ref-del.sin +++ /dev/null @@ -1,24 +0,0 @@ -# Remove this package from a list of references stored in a text file. -# -# Copyright (C) 2000, 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, 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 <http://www.gnu.org/licenses/>. -# -# Written by Bruno Haible <haible@clisp.cons.org>. -# -/^# Packages using this file: / { - s/# Packages using this file:// - s/ @PACKAGE@ / / - s/^/# Packages using this file:/ -} diff --git a/gnulib/import/rename.c b/gnulib/import/rename.c index e1d169a..9d88e5c 100644 --- a/gnulib/import/rename.c +++ b/gnulib/import/rename.c @@ -1,6 +1,6 @@ /* Work around rename bugs in some systems. - Copyright (C) 2001-2003, 2005-2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2006, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Volker Borchert, Eric Blake. */ @@ -23,7 +23,7 @@ #undef rename -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if defined _WIN32 && ! defined __CYGWIN__ /* The mingw rename has problems with trailing slashes; it also requires use of native Windows calls to allow atomic renames over existing files. */ diff --git a/gnulib/import/rewinddir.c b/gnulib/import/rewinddir.c index 2a70e7f..b58a47d 100644 --- a/gnulib/import/rewinddir.c +++ b/gnulib/import/rewinddir.c @@ -1,5 +1,5 @@ /* Restart reading the entries of a directory from the beginning. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/rmdir.c b/gnulib/import/rmdir.c index 4949df2..1d08822 100644 --- a/gnulib/import/rmdir.c +++ b/gnulib/import/rmdir.c @@ -1,6 +1,6 @@ /* Work around rmdir bugs. - Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2016 Free Software + Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/same-inode.h b/gnulib/import/same-inode.h index bf45635..06655b6 100644 --- a/gnulib/import/same-inode.h +++ b/gnulib/import/same-inode.h @@ -1,6 +1,6 @@ -/* Determine whether two stat buffers refer to the same file. +/* Determine whether two stat buffers are known to refer to the same file. - Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2019 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 @@ -13,17 +13,31 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef SAME_INODE_H # define SAME_INODE_H 1 -# ifdef __VMS +# include <sys/types.h> + +# if defined __VMS && __CRTL_VER < 80200000 # define SAME_INODE(a, b) \ ((a).st_ino[0] == (b).st_ino[0] \ && (a).st_ino[1] == (b).st_ino[1] \ && (a).st_ino[2] == (b).st_ino[2] \ && (a).st_dev == (b).st_dev) +# elif defined _WIN32 && ! defined __CYGWIN__ + /* Native Windows. */ +# if _GL_WINDOWS_STAT_INODES + /* stat() and fstat() set st_dev and st_ino to 0 if information about + the inode is not available. */ +# define SAME_INODE(a, b) \ + (!((a).st_ino == 0 && (a).st_dev == 0) \ + && (a).st_ino == (b).st_ino && (a).st_dev == (b).st_dev) +# else + /* stat() and fstat() set st_ino to 0 always. */ +# define SAME_INODE(a, b) 0 +# endif # else # define SAME_INODE(a, b) \ ((a).st_ino == (b).st_ino \ diff --git a/gnulib/import/save-cwd.c b/gnulib/import/save-cwd.c index 27cb750..a67d95d 100644 --- a/gnulib/import/save-cwd.c +++ b/gnulib/import/save-cwd.c @@ -1,6 +1,6 @@ /* save-cwd.c -- Save and restore current working directory. - Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2016 Free Software + Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ @@ -30,7 +30,6 @@ #include "chdir-long.h" #include "unistd--.h" -#include "cloexec.h" #if GNULIB_FCNTL_SAFER # include "fcntl--.h" @@ -64,16 +63,15 @@ save_cwd (struct saved_cwd *cwd) { cwd->name = NULL; - cwd->desc = open (".", O_SEARCH); + cwd->desc = open (".", O_SEARCH | O_CLOEXEC); if (!GNULIB_FCNTL_SAFER) - cwd->desc = fd_safer (cwd->desc); + cwd->desc = fd_safer_flag (cwd->desc, O_CLOEXEC); if (cwd->desc < 0) { cwd->name = getcwd (NULL, 0); return cwd->name ? 0 : -1; } - set_cloexec_flag (cwd->desc, true); return 0; } diff --git a/gnulib/import/save-cwd.h b/gnulib/import/save-cwd.h index dbb598d..6a78070 100644 --- a/gnulib/import/save-cwd.h +++ b/gnulib/import/save-cwd.h @@ -1,6 +1,6 @@ /* Save and restore current working directory. - Copyright (C) 1995, 1997-1998, 2003, 2009-2016 Free Software Foundation, + Copyright (C) 1995, 1997-1998, 2003, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff --git a/gnulib/import/scratch_buffer.h b/gnulib/import/scratch_buffer.h new file mode 100644 index 0000000..4c0db3e --- /dev/null +++ b/gnulib/import/scratch_buffer.h @@ -0,0 +1,11 @@ +#ifndef _GL_SCRATCH_BUFFER_H +#define _GL_SCRATCH_BUFFER_H + +#include <libc-config.h> + +#define __libc_scratch_buffer_grow gl_scratch_buffer_grow +#define __libc_scratch_buffer_grow_preserve gl_scratch_buffer_grow_preserve +#define __libc_scratch_buffer_set_array_size gl_scratch_buffer_set_array_size +#include <malloc/scratch_buffer.h> + +#endif /* _GL_SCRATCH_BUFFER_H */ diff --git a/gnulib/import/secure_getenv.c b/gnulib/import/secure_getenv.c deleted file mode 100644 index 88a60dc..0000000 --- a/gnulib/import/secure_getenv.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Look up an environment variable, returning NULL in insecure situations. - - Copyright 2013-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 <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -#include <stdlib.h> - -#if !HAVE___SECURE_GETENV -# if HAVE_ISSETUGID || (HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID) -# include <unistd.h> -# endif -#endif - -char * -secure_getenv (char const *name) -{ -#if HAVE___SECURE_GETENV /* glibc */ - return __secure_getenv (name); -#elif HAVE_ISSETUGID /* OS X, FreeBSD, NetBSD, OpenBSD */ - if (issetugid ()) - return NULL; - return getenv (name); -#elif HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID /* other Unix */ - if (geteuid () != getuid () || getegid () != getgid ()) - return NULL; - return getenv (name); -#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* native Windows */ - /* On native Windows, there is no such concept as setuid or setgid binaries. - - Programs launched as system services have high privileges, but they don't - inherit environment variables from a user. - - Programs launched by a user with "Run as Administrator" have high - privileges and use the environment variables, but the user has been asked - whether he agrees. - - Programs launched by a user without "Run as Administrator" cannot gain - high privileges, therefore there is no risk. */ - return getenv (name); -#else - return NULL; -#endif -} diff --git a/gnulib/import/setenv.c b/gnulib/import/setenv.c index 85c32cb..733b257 100644 --- a/gnulib/import/setenv.c +++ b/gnulib/import/setenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995-2003, 2005-2016 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995-2003, 2005-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if !_LIBC /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc diff --git a/gnulib/import/signal.in.h b/gnulib/import/signal.in.h index ab0a049..5b36c25 100644 --- a/gnulib/import/signal.in.h +++ b/gnulib/import/signal.in.h @@ -1,6 +1,6 @@ /* A GNU-like <signal.h>. - Copyright (C) 2006-2016 Free Software Foundation, Inc. + Copyright (C) 2006-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -137,14 +137,16 @@ _GL_FUNCDECL_RPL (pthread_sigmask, int, _GL_CXXALIAS_RPL (pthread_sigmask, int, (int how, const sigset_t *new_mask, sigset_t *old_mask)); # else -# if !@HAVE_PTHREAD_SIGMASK@ +# if !(@HAVE_PTHREAD_SIGMASK@ || defined pthread_sigmask) _GL_FUNCDECL_SYS (pthread_sigmask, int, (int how, const sigset_t *new_mask, sigset_t *old_mask)); # endif _GL_CXXALIAS_SYS (pthread_sigmask, int, (int how, const sigset_t *new_mask, sigset_t *old_mask)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_sigmask); +# endif #elif defined GNULIB_POSIXCHECK # undef pthread_sigmask # if HAVE_RAW_DECL_PTHREAD_SIGMASK @@ -168,7 +170,9 @@ _GL_FUNCDECL_SYS (raise, int, (int sig)); # endif _GL_CXXALIAS_SYS (raise, int, (int sig)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (raise); +# endif #elif defined GNULIB_POSIXCHECK # undef raise /* Assume raise is always declared. */ @@ -200,7 +204,7 @@ typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1]; /* When also using extern inline, suppress the use of static inline in standard headers of problematic Apple configurations, as Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., - <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. + <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>. Perhaps Apple will fix this some day. */ #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ && (defined __i386__ || defined __x86_64__)) @@ -318,10 +322,18 @@ _GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t, _GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t, (int sig, _gl_function_taking_int_returning_void_t func)); # else +/* On OpenBSD, the declaration of 'signal' may not be present at this point, + because it occurs in <sys/signal.h>, not <signal.h> directly. */ +# if defined __OpenBSD__ +_GL_FUNCDECL_SYS (signal, _gl_function_taking_int_returning_void_t, + (int sig, _gl_function_taking_int_returning_void_t func)); +# endif _GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t, (int sig, _gl_function_taking_int_returning_void_t func)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (signal); +# endif # if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE /* Raise signal SIGPIPE. */ diff --git a/gnulib/import/stat-time.c b/gnulib/import/stat-time.c new file mode 100644 index 0000000..81b83dd --- /dev/null +++ b/gnulib/import/stat-time.c @@ -0,0 +1,3 @@ +#include <config.h> +#define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE +#include "stat-time.h" diff --git a/gnulib/import/stat-time.h b/gnulib/import/stat-time.h new file mode 100644 index 0000000..38a1f55 --- /dev/null +++ b/gnulib/import/stat-time.h @@ -0,0 +1,252 @@ +/* stat-related time functions. + + Copyright (C) 2005, 2007, 2009-2019 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Paul Eggert. */ + +#ifndef STAT_TIME_H +#define STAT_TIME_H 1 + +#include "intprops.h" + +#include <errno.h> +#include <stddef.h> +#include <sys/stat.h> +#include <time.h> + +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif +_GL_INLINE_HEADER_BEGIN +#ifndef _GL_STAT_TIME_INLINE +# define _GL_STAT_TIME_INLINE _GL_INLINE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type + struct timespec, if available. If not, then STAT_TIMESPEC_NS (ST, + ST_XTIM) is the nanosecond component of the ST_XTIM member for *ST, + if available. ST_XTIM can be st_atim, st_ctim, st_mtim, or st_birthtim + for access, status change, data modification, or birth (creation) + time respectively. + + These macros are private to stat-time.h. */ +#if _GL_WINDOWS_STAT_TIMESPEC || defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC +# if _GL_WINDOWS_STAT_TIMESPEC || defined TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC +# define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim) +# else +# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.tv_nsec) +# endif +#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC +# define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim##espec) +#elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC +# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim##ensec) +#elif defined HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC +# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.st__tim.tv_nsec) +#endif + +/* Return the nanosecond component of *ST's access time. */ +_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE +get_stat_atime_ns (struct stat const *st) +{ +# if defined STAT_TIMESPEC + return STAT_TIMESPEC (st, st_atim).tv_nsec; +# elif defined STAT_TIMESPEC_NS + return STAT_TIMESPEC_NS (st, st_atim); +# else + return 0; +# endif +} + +/* Return the nanosecond component of *ST's status change time. */ +_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE +get_stat_ctime_ns (struct stat const *st) +{ +# if defined STAT_TIMESPEC + return STAT_TIMESPEC (st, st_ctim).tv_nsec; +# elif defined STAT_TIMESPEC_NS + return STAT_TIMESPEC_NS (st, st_ctim); +# else + return 0; +# endif +} + +/* Return the nanosecond component of *ST's data modification time. */ +_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE +get_stat_mtime_ns (struct stat const *st) +{ +# if defined STAT_TIMESPEC + return STAT_TIMESPEC (st, st_mtim).tv_nsec; +# elif defined STAT_TIMESPEC_NS + return STAT_TIMESPEC_NS (st, st_mtim); +# else + return 0; +# endif +} + +/* Return the nanosecond component of *ST's birth time. */ +_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE +get_stat_birthtime_ns (struct stat const *st _GL_UNUSED) +{ +# if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC + return STAT_TIMESPEC (st, st_birthtim).tv_nsec; +# elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC + return STAT_TIMESPEC_NS (st, st_birthtim); +# else + return 0; +# endif +} + +/* Return *ST's access time. */ +_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE +get_stat_atime (struct stat const *st) +{ +#ifdef STAT_TIMESPEC + return STAT_TIMESPEC (st, st_atim); +#else + struct timespec t; + t.tv_sec = st->st_atime; + t.tv_nsec = get_stat_atime_ns (st); + return t; +#endif +} + +/* Return *ST's status change time. */ +_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE +get_stat_ctime (struct stat const *st) +{ +#ifdef STAT_TIMESPEC + return STAT_TIMESPEC (st, st_ctim); +#else + struct timespec t; + t.tv_sec = st->st_ctime; + t.tv_nsec = get_stat_ctime_ns (st); + return t; +#endif +} + +/* Return *ST's data modification time. */ +_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE +get_stat_mtime (struct stat const *st) +{ +#ifdef STAT_TIMESPEC + return STAT_TIMESPEC (st, st_mtim); +#else + struct timespec t; + t.tv_sec = st->st_mtime; + t.tv_nsec = get_stat_mtime_ns (st); + return t; +#endif +} + +/* Return *ST's birth time, if available; otherwise return a value + with tv_sec and tv_nsec both equal to -1. */ +_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE +get_stat_birthtime (struct stat const *st _GL_UNUSED) +{ + struct timespec t; + +#if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ + || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC) + t = STAT_TIMESPEC (st, st_birthtim); +#elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC + t.tv_sec = st->st_birthtime; + t.tv_nsec = st->st_birthtimensec; +#elif defined _WIN32 && ! defined __CYGWIN__ + /* Native Windows platforms (but not Cygwin) put the "file creation + time" in st_ctime (!). See + <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions>. */ +# if _GL_WINDOWS_STAT_TIMESPEC + t = st->st_ctim; +# else + t.tv_sec = st->st_ctime; + t.tv_nsec = 0; +# endif +#else + /* Birth time is not supported. */ + t.tv_sec = -1; + t.tv_nsec = -1; +#endif + +#if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ + || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC \ + || defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC) + /* FreeBSD and NetBSD sometimes signal the absence of knowledge by + using zero. Attempt to work around this problem. Alas, this can + report failure even for valid timestamps. Also, NetBSD + sometimes returns junk in the birth time fields; work around this + bug if it is detected. */ + if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000)) + { + t.tv_sec = -1; + t.tv_nsec = -1; + } +#endif + + return t; +} + +/* If a stat-like function returned RESULT, normalize the timestamps + in *ST, in case this platform suffers from the Solaris 11 bug where + tv_nsec might be negative. Return the adjusted RESULT, setting + errno to EOVERFLOW if normalization overflowed. This function + is intended to be private to this .h file. */ +_GL_STAT_TIME_INLINE int +stat_time_normalize (int result, struct stat *st _GL_UNUSED) +{ +#if defined __sun && defined STAT_TIMESPEC + if (result == 0) + { + long int timespec_hz = 1000000000; + short int const ts_off[] = { offsetof (struct stat, st_atim), + offsetof (struct stat, st_mtim), + offsetof (struct stat, st_ctim) }; + int i; + for (i = 0; i < sizeof ts_off / sizeof *ts_off; i++) + { + struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]); + long int q = ts->tv_nsec / timespec_hz; + long int r = ts->tv_nsec % timespec_hz; + if (r < 0) + { + r += timespec_hz; + q--; + } + ts->tv_nsec = r; + /* Overflow is possible, as Solaris 11 stat can yield + tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000. + INT_ADD_WRAPV is OK, since time_t is signed on Solaris. */ + if (INT_ADD_WRAPV (q, ts->tv_sec, &ts->tv_sec)) + { + errno = EOVERFLOW; + return -1; + } + } + } +#endif + return result; +} + +#ifdef __cplusplus +} +#endif + +_GL_INLINE_HEADER_END + +#endif diff --git a/gnulib/import/stat-w32.c b/gnulib/import/stat-w32.c new file mode 100644 index 0000000..60fe5f6 --- /dev/null +++ b/gnulib/import/stat-w32.c @@ -0,0 +1,425 @@ +/* Core of implementation of fstat and stat for native Windows. + Copyright (C) 2017-2019 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible. */ + +#include <config.h> + +#if defined _WIN32 && ! defined __CYGWIN__ + +/* Ensure that <windows.h> defines FILE_ID_INFO. */ +#undef _WIN32_WINNT +#define _WIN32_WINNT _WIN32_WINNT_WIN8 + +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#include <limits.h> +#include <string.h> +#include <unistd.h> +#include <windows.h> + +/* Specification. */ +#include "stat-w32.h" + +#include "pathmax.h" +#include "verify.h" + +/* Avoid warnings from gcc -Wcast-function-type. */ +#define GetProcAddress \ + (void *) GetProcAddress + +#if _GL_WINDOWS_STAT_INODES == 2 +/* GetFileInformationByHandleEx was introduced only in Windows Vista. */ +typedef DWORD (WINAPI * GetFileInformationByHandleExFuncType) (HANDLE hFile, + FILE_INFO_BY_HANDLE_CLASS fiClass, + LPVOID lpBuffer, + DWORD dwBufferSize); +static GetFileInformationByHandleExFuncType GetFileInformationByHandleExFunc = NULL; +#endif +/* GetFinalPathNameByHandle was introduced only in Windows Vista. */ +typedef DWORD (WINAPI * GetFinalPathNameByHandleFuncType) (HANDLE hFile, + LPTSTR lpFilePath, + DWORD lenFilePath, + DWORD dwFlags); +static GetFinalPathNameByHandleFuncType GetFinalPathNameByHandleFunc = NULL; +static BOOL initialized = FALSE; + +static void +initialize (void) +{ + HMODULE kernel32 = LoadLibrary ("kernel32.dll"); + if (kernel32 != NULL) + { +#if _GL_WINDOWS_STAT_INODES == 2 + GetFileInformationByHandleExFunc = + (GetFileInformationByHandleExFuncType) GetProcAddress (kernel32, "GetFileInformationByHandleEx"); +#endif + GetFinalPathNameByHandleFunc = + (GetFinalPathNameByHandleFuncType) GetProcAddress (kernel32, "GetFinalPathNameByHandleA"); + } + initialized = TRUE; +} + +/* Converts a FILETIME to GMT time since 1970-01-01 00:00:00. */ +#if _GL_WINDOWS_STAT_TIMESPEC +struct timespec +_gl_convert_FILETIME_to_timespec (const FILETIME *ft) +{ + struct timespec result; + /* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */ + unsigned long long since_1601 = + ((unsigned long long) ft->dwHighDateTime << 32) + | (unsigned long long) ft->dwLowDateTime; + if (since_1601 == 0) + { + result.tv_sec = 0; + result.tv_nsec = 0; + } + else + { + /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 + leap years, in total 134774 days. */ + unsigned long long since_1970 = + since_1601 - (unsigned long long) 134774 * (unsigned long long) 86400 * (unsigned long long) 10000000; + result.tv_sec = since_1970 / (unsigned long long) 10000000; + result.tv_nsec = (unsigned long) (since_1970 % (unsigned long long) 10000000) * 100; + } + return result; +} +#else +time_t +_gl_convert_FILETIME_to_POSIX (const FILETIME *ft) +{ + /* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */ + unsigned long long since_1601 = + ((unsigned long long) ft->dwHighDateTime << 32) + | (unsigned long long) ft->dwLowDateTime; + if (since_1601 == 0) + return 0; + else + { + /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 + leap years, in total 134774 days. */ + unsigned long long since_1970 = + since_1601 - (unsigned long long) 134774 * (unsigned long long) 86400 * (unsigned long long) 10000000; + return since_1970 / (unsigned long long) 10000000; + } +} +#endif + +/* Fill *BUF with information about the file designated by H. + PATH is the file name, if known, otherwise NULL. + Return 0 if successful, or -1 with errno set upon failure. */ +int +_gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf) +{ + /* GetFileType + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfiletype> */ + DWORD type = GetFileType (h); + if (type == FILE_TYPE_DISK) + { + if (!initialized) + initialize (); + + /* st_mode can be determined through + GetFileAttributesEx + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileattributesexa> + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_win32_file_attribute_data> + or through + GetFileInformationByHandle + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileinformationbyhandle> + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_by_handle_file_information> + or through + GetFileInformationByHandleEx with argument FileBasicInfo + <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex> + <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_basic_info> + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ + BY_HANDLE_FILE_INFORMATION info; + if (! GetFileInformationByHandle (h, &info)) + goto failed; + + /* Test for error conditions before starting to fill *buf. */ + if (sizeof (buf->st_size) <= 4 && info.nFileSizeHigh > 0) + { + errno = EOVERFLOW; + return -1; + } + +#if _GL_WINDOWS_STAT_INODES + /* st_ino can be determined through + GetFileInformationByHandle + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileinformationbyhandle> + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_by_handle_file_information> + as 64 bits, or through + GetFileInformationByHandleEx with argument FileIdInfo + <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex> + <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_id_info> + as 128 bits. + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_WIN8 or higher. */ + /* Experiments show that GetFileInformationByHandleEx does not provide + much more information than GetFileInformationByHandle: + * The dwVolumeSerialNumber from GetFileInformationByHandle is equal + to the low 32 bits of the 64-bit VolumeSerialNumber from + GetFileInformationByHandleEx, and is apparently sufficient for + identifying the device. + * The nFileIndex from GetFileInformationByHandle is equal to the low + 64 bits of the 128-bit FileId from GetFileInformationByHandleEx, + and the high 64 bits of this 128-bit FileId are zero. + * On a FAT file system, GetFileInformationByHandleEx fails with error + ERROR_INVALID_PARAMETER, whereas GetFileInformationByHandle + succeeds. + * On a CIFS/SMB file system, GetFileInformationByHandleEx fails with + error ERROR_INVALID_LEVEL, whereas GetFileInformationByHandle + succeeds. */ +# if _GL_WINDOWS_STAT_INODES == 2 + if (GetFileInformationByHandleExFunc != NULL) + { + FILE_ID_INFO id; + if (GetFileInformationByHandleExFunc (h, FileIdInfo, &id, sizeof (id))) + { + buf->st_dev = id.VolumeSerialNumber; + verify (sizeof (ino_t) == sizeof (id.FileId)); + memcpy (&buf->st_ino, &id.FileId, sizeof (ino_t)); + goto ino_done; + } + else + { + switch (GetLastError ()) + { + case ERROR_INVALID_PARAMETER: /* older Windows version, or FAT */ + case ERROR_INVALID_LEVEL: /* CIFS/SMB file system */ + goto fallback; + default: + goto failed; + } + } + } + fallback: ; + /* Fallback for older Windows versions. */ + buf->st_dev = info.dwVolumeSerialNumber; + buf->st_ino._gl_ino[0] = ((ULONGLONG) info.nFileIndexHigh << 32) | (ULONGLONG) info.nFileIndexLow; + buf->st_ino._gl_ino[1] = 0; + ino_done: ; +# else /* _GL_WINDOWS_STAT_INODES == 1 */ + buf->st_dev = info.dwVolumeSerialNumber; + buf->st_ino = ((ULONGLONG) info.nFileIndexHigh << 32) | (ULONGLONG) info.nFileIndexLow; +# endif +#else + /* st_ino is not wide enough for identifying a file on a device. + Without st_ino, st_dev is pointless. */ + buf->st_dev = 0; + buf->st_ino = 0; +#endif + + /* st_mode. */ + unsigned int mode = + /* XXX How to handle FILE_ATTRIBUTE_REPARSE_POINT ? */ + ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR | S_IEXEC_UGO : _S_IFREG) + | S_IREAD_UGO + | ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE_UGO); + if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + /* Determine whether the file is executable by looking at the file + name suffix. + If the file name is already known, use it. Otherwise, for + non-empty files, it can be determined through + GetFinalPathNameByHandle + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfinalpathnamebyhandlea> + or through + GetFileInformationByHandleEx with argument FileNameInfo + <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex> + <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_name_info> + Both require -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ + if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0) + { + char fpath[PATH_MAX]; + if (path != NULL + || (GetFinalPathNameByHandleFunc != NULL + && GetFinalPathNameByHandleFunc (h, fpath, sizeof (fpath), VOLUME_NAME_NONE) + < sizeof (fpath) + && (path = fpath, 1))) + { + const char *last_dot = NULL; + const char *p; + for (p = path; *p != '\0'; p++) + if (*p == '.') + last_dot = p; + if (last_dot != NULL) + { + const char *suffix = last_dot + 1; + if (_stricmp (suffix, "exe") == 0 + || _stricmp (suffix, "bat") == 0 + || _stricmp (suffix, "cmd") == 0 + || _stricmp (suffix, "com") == 0) + mode |= S_IEXEC_UGO; + } + } + else + /* Cannot determine file name. Pretend that it is executable. */ + mode |= S_IEXEC_UGO; + } + } + buf->st_mode = mode; + + /* st_nlink can be determined through + GetFileInformationByHandle + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileinformationbyhandle> + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_by_handle_file_information> + or through + GetFileInformationByHandleEx with argument FileStandardInfo + <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex> + <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_standard_info> + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ + buf->st_nlink = (info.nNumberOfLinks > SHRT_MAX ? SHRT_MAX : info.nNumberOfLinks); + + /* There's no easy way to map the Windows SID concept to an integer. */ + buf->st_uid = 0; + buf->st_gid = 0; + + /* st_rdev is irrelevant for normal files and directories. */ + buf->st_rdev = 0; + + /* st_size can be determined through + GetFileSizeEx + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfilesizeex> + or through + GetFileAttributesEx + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileattributesexa> + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_win32_file_attribute_data> + or through + GetFileInformationByHandle + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileinformationbyhandle> + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_by_handle_file_information> + or through + GetFileInformationByHandleEx with argument FileStandardInfo + <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex> + <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_standard_info> + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ + if (sizeof (buf->st_size) <= 4) + /* Range check already done above. */ + buf->st_size = info.nFileSizeLow; + else + buf->st_size = ((long long) info.nFileSizeHigh << 32) | (long long) info.nFileSizeLow; + + /* st_atime, st_mtime, st_ctime can be determined through + GetFileTime + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfiletime> + or through + GetFileAttributesEx + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileattributesexa> + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_win32_file_attribute_data> + or through + GetFileInformationByHandle + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileinformationbyhandle> + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_by_handle_file_information> + or through + GetFileInformationByHandleEx with argument FileBasicInfo + <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex> + <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_basic_info> + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ +#if _GL_WINDOWS_STAT_TIMESPEC + buf->st_atim = _gl_convert_FILETIME_to_timespec (&info.ftLastAccessTime); + buf->st_mtim = _gl_convert_FILETIME_to_timespec (&info.ftLastWriteTime); + buf->st_ctim = _gl_convert_FILETIME_to_timespec (&info.ftCreationTime); +#else + buf->st_atime = _gl_convert_FILETIME_to_POSIX (&info.ftLastAccessTime); + buf->st_mtime = _gl_convert_FILETIME_to_POSIX (&info.ftLastWriteTime); + buf->st_ctime = _gl_convert_FILETIME_to_POSIX (&info.ftCreationTime); +#endif + + return 0; + } + else if (type == FILE_TYPE_CHAR || type == FILE_TYPE_PIPE) + { + buf->st_dev = 0; +#if _GL_WINDOWS_STAT_INODES == 2 + buf->st_ino._gl_ino[0] = buf->st_ino._gl_ino[1] = 0; +#else + buf->st_ino = 0; +#endif + buf->st_mode = (type == FILE_TYPE_PIPE ? _S_IFIFO : _S_IFCHR); + buf->st_nlink = 1; + buf->st_uid = 0; + buf->st_gid = 0; + buf->st_rdev = 0; + if (type == FILE_TYPE_PIPE) + { + /* PeekNamedPipe + <https://msdn.microsoft.com/en-us/library/aa365779.aspx> */ + DWORD bytes_available; + if (PeekNamedPipe (h, NULL, 0, NULL, &bytes_available, NULL)) + buf->st_size = bytes_available; + else + buf->st_size = 0; + } + else + buf->st_size = 0; +#if _GL_WINDOWS_STAT_TIMESPEC + buf->st_atim.tv_sec = 0; buf->st_atim.tv_nsec = 0; + buf->st_mtim.tv_sec = 0; buf->st_mtim.tv_nsec = 0; + buf->st_ctim.tv_sec = 0; buf->st_ctim.tv_nsec = 0; +#else + buf->st_atime = 0; + buf->st_mtime = 0; + buf->st_ctime = 0; +#endif + return 0; + } + else + { + errno = ENOENT; + return -1; + } + + failed: + { + DWORD error = GetLastError (); + #if 0 + fprintf (stderr, "_gl_fstat_by_handle error 0x%x\n", (unsigned int) error); + #endif + switch (error) + { + case ERROR_ACCESS_DENIED: + case ERROR_SHARING_VIOLATION: + errno = EACCES; + break; + + case ERROR_OUTOFMEMORY: + errno = ENOMEM; + break; + + case ERROR_WRITE_FAULT: + case ERROR_READ_FAULT: + case ERROR_GEN_FAILURE: + errno = EIO; + break; + + default: + errno = EINVAL; + break; + } + return -1; + } +} + +#else + +/* This declaration is solely to ensure that after preprocessing + this file is never empty. */ +typedef int dummy; + +#endif diff --git a/gnulib/import/stat-w32.h b/gnulib/import/stat-w32.h new file mode 100644 index 0000000..6b961d7 --- /dev/null +++ b/gnulib/import/stat-w32.h @@ -0,0 +1,37 @@ +/* Core of implementation of fstat and stat for native Windows. + Copyright (C) 2017-2019 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +#ifndef _STAT_W32_H +#define _STAT_W32_H 1 + +/* Converts a FILETIME to GMT time since 1970-01-01 00:00:00. */ +#if _GL_WINDOWS_STAT_TIMESPEC +extern struct timespec _gl_convert_FILETIME_to_timespec (const FILETIME *ft); +#else +extern time_t _gl_convert_FILETIME_to_POSIX (const FILETIME *ft); +#endif + +/* Fill *BUF with information about the file designated by H. + PATH is the file name, if known, otherwise NULL. + Return 0 if successful, or -1 with errno set upon failure. */ +extern int _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf); + +/* Bitmasks for st_mode. */ +#define S_IREAD_UGO (_S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6)) +#define S_IWRITE_UGO (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6)) +#define S_IEXEC_UGO (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6)) + +#endif /* _STAT_W32_H */ diff --git a/gnulib/import/stat.c b/gnulib/import/stat.c index 62e9e0b..e3248a8 100644 --- a/gnulib/import/stat.c +++ b/gnulib/import/stat.c @@ -1,5 +1,5 @@ /* Work around platform bugs in stat. - Copyright (C) 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2009-2019 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 @@ -12,9 +12,9 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ -/* written by Eric Blake */ +/* Written by Eric Blake and Bruno Haible. */ /* If the user's config.h happens to include <sys/stat.h>, let it include only the system's <sys/stat.h> here, so that orig_stat doesn't recurse to @@ -27,47 +27,72 @@ #include <sys/stat.h> #undef __need_system_sys_stat_h -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# if _GL_WINDOWS_64_BIT_ST_SIZE -# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ -# define stat _stati64 -# define REPLACE_FUNC_STAT_DIR 1 -# undef REPLACE_FUNC_STAT_FILE -# elif REPLACE_FUNC_STAT_FILE -/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a. - Bypass it. */ -# define stat _stat -# define REPLACE_FUNC_STAT_DIR 1 -# undef REPLACE_FUNC_STAT_FILE -# endif +#if defined _WIN32 && ! defined __CYGWIN__ +# define WINDOWS_NATIVE #endif +#if !defined WINDOWS_NATIVE + static int orig_stat (const char *filename, struct stat *buf) { return stat (filename, buf); } +#endif + /* Specification. */ +#ifdef __osf__ /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include <sys/stat.h> above. */ -#include "sys/stat.h" +# include "sys/stat.h" +#else +# include <sys/stat.h> +#endif + +#include "stat-time.h" #include <errno.h> #include <limits.h> #include <stdbool.h> #include <string.h> -#include "dosname.h" +#include "filename.h" +#include "malloca.h" #include "verify.h" -#if REPLACE_FUNC_STAT_DIR -# include "pathmax.h" - /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also - have a constant PATH_MAX. */ -# ifndef PATH_MAX -# error "Please port this replacement to your platform" -# endif +#ifdef WINDOWS_NATIVE +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +# include "stat-w32.h" +#endif + +#ifdef WINDOWS_NATIVE +/* Return TRUE if the given file name denotes an UNC root. */ +static BOOL +is_unc_root (const char *rname) +{ + /* Test whether it has the syntax '\\server\share'. */ + if (ISSLASH (rname[0]) && ISSLASH (rname[1])) + { + /* It starts with two slashes. Find the next slash. */ + const char *p = rname + 2; + const char *q = p; + while (*q != '\0' && !ISSLASH (*q)) + q++; + if (q > p && *q != '\0') + { + /* Found the next slash at q. */ + q++; + const char *r = q; + while (*r != '\0' && !ISSLASH (*r)) + r++; + if (r > q && *r == '\0') + return TRUE; + } + } + return FALSE; +} #endif /* Store information about NAME into ST. Work around bugs with @@ -77,62 +102,332 @@ orig_stat (const char *filename, struct stat *buf) correctly. */ int -rpl_stat (char const *name, struct stat *st) +rpl_stat (char const *name, struct stat *buf) { - int result = orig_stat (name, st); -#if REPLACE_FUNC_STAT_FILE - /* Solaris 9 mistakenly succeeds when given a non-directory with a - trailing slash. */ - if (result == 0 && !S_ISDIR (st->st_mode)) +#ifdef WINDOWS_NATIVE + /* Fill the fields ourselves, because the original stat function returns + values for st_atime, st_mtime, st_ctime that depend on the current time + zone. See + <https://lists.gnu.org/r/bug-gnulib/2017-04/msg00134.html> */ + /* XXX Should we convert to wchar_t* and prepend '\\?\', in order to work + around length limitations + <https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file> ? */ + + /* POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13> + specifies: "More than two leading <slash> characters shall be treated as + a single <slash> character." */ + if (ISSLASH (name[0]) && ISSLASH (name[1]) && ISSLASH (name[2])) + { + name += 2; + while (ISSLASH (name[1])) + name++; + } + + size_t len = strlen (name); + size_t drive_prefix_len = (HAS_DEVICE (name) ? 2 : 0); + + /* Remove trailing slashes (except the very first one, at position + drive_prefix_len), but remember their presence. */ + size_t rlen; + bool check_dir = false; + + rlen = len; + while (rlen > drive_prefix_len && ISSLASH (name[rlen-1])) + { + check_dir = true; + if (rlen == drive_prefix_len + 1) + break; + rlen--; + } + + /* Handle '' and 'C:'. */ + if (!check_dir && rlen == drive_prefix_len) + { + errno = ENOENT; + return -1; + } + + /* Handle '\\'. */ + if (rlen == 1 && ISSLASH (name[0]) && len >= 2) + { + errno = ENOENT; + return -1; + } + + const char *rname; + char *malloca_rname; + if (rlen == len) { - size_t len = strlen (name); - if (ISSLASH (name[len - 1])) + rname = name; + malloca_rname = NULL; + } + else + { + malloca_rname = malloca (rlen + 1); + if (malloca_rname == NULL) { - errno = ENOTDIR; + errno = ENOMEM; return -1; } + memcpy (malloca_rname, name, rlen); + malloca_rname[rlen] = '\0'; + rname = malloca_rname; } -#endif /* REPLACE_FUNC_STAT_FILE */ -#if REPLACE_FUNC_STAT_DIR - if (result == -1 && errno == ENOENT) + /* There are two ways to get at the requested information: + - by scanning the parent directory and examining the relevant + directory entry, + - by opening the file directly. + The first approach fails for root directories (e.g. 'C:\') and + UNC root directories (e.g. '\\server\share'). + The second approach fails for some system files (e.g. 'C:\pagefile.sys' + and 'C:\hiberfil.sys'): ERROR_SHARING_VIOLATION. + The second approach gives more information (in particular, correct + st_dev, st_ino, st_nlink fields). + So we use the second approach and, as a fallback except for root and + UNC root directories, also the first approach. */ + { + int ret; + { - /* Due to mingw's oddities, there are some directories (like - c:\) where stat() only succeeds with a trailing slash, and - other directories (like c:\windows) where stat() only - succeeds without a trailing slash. But we want the two to be - synonymous, since chdir() manages either style. Likewise, Mingw also - reports ENOENT for names longer than PATH_MAX, when we want - ENAMETOOLONG, and for stat("file/"), when we want ENOTDIR. - Fortunately, mingw PATH_MAX is small enough for stack - allocation. */ - char fixed_name[PATH_MAX + 1] = {0}; - size_t len = strlen (name); - bool check_dir = false; - verify (PATH_MAX <= 4096); - if (PATH_MAX <= len) - errno = ENAMETOOLONG; - else if (len) + /* Approach based on the file. */ + + /* Open a handle to the file. + CreateFile + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-createfilea> + <https://docs.microsoft.com/en-us/windows/desktop/FileIO/creating-and-opening-files> */ + HANDLE h = + CreateFile (rname, + FILE_READ_ATTRIBUTES, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + /* FILE_FLAG_POSIX_SEMANTICS (treat file names that differ only + in case as different) makes sense only when applied to *all* + filesystem operations. */ + FILE_FLAG_BACKUP_SEMANTICS /* | FILE_FLAG_POSIX_SEMANTICS */, + NULL); + if (h != INVALID_HANDLE_VALUE) { - strcpy (fixed_name, name); - if (ISSLASH (fixed_name[len - 1])) + ret = _gl_fstat_by_handle (h, rname, buf); + CloseHandle (h); + goto done; + } + } + + /* Test for root and UNC root directories. */ + if ((rlen == drive_prefix_len + 1 && ISSLASH (rname[drive_prefix_len])) + || is_unc_root (rname)) + goto failed; + + /* Fallback. */ + { + /* Approach based on the directory entry. */ + + if (strchr (rname, '?') != NULL || strchr (rname, '*') != NULL) + { + /* Other Windows API functions would fail with error + ERROR_INVALID_NAME. */ + if (malloca_rname != NULL) + freea (malloca_rname); + errno = ENOENT; + return -1; + } + + /* Get the details about the directory entry. This can be done through + FindFirstFile + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-findfirstfilea> + <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-_win32_find_dataa> + or through + FindFirstFileEx with argument FindExInfoBasic + <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-findfirstfileexa> + <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ne-minwinbase-findex_info_levels> + <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-_win32_find_dataa> */ + WIN32_FIND_DATA info; + HANDLE h = FindFirstFile (rname, &info); + if (h == INVALID_HANDLE_VALUE) + goto failed; + + /* Test for error conditions before starting to fill *buf. */ + if (sizeof (buf->st_size) <= 4 && info.nFileSizeHigh > 0) + { + FindClose (h); + if (malloca_rname != NULL) + freea (malloca_rname); + errno = EOVERFLOW; + return -1; + } + +# if _GL_WINDOWS_STAT_INODES + buf->st_dev = 0; +# if _GL_WINDOWS_STAT_INODES == 2 + buf->st_ino._gl_ino[0] = buf->st_ino._gl_ino[1] = 0; +# else /* _GL_WINDOWS_STAT_INODES == 1 */ + buf->st_ino = 0; +# endif +# else + /* st_ino is not wide enough for identifying a file on a device. + Without st_ino, st_dev is pointless. */ + buf->st_dev = 0; + buf->st_ino = 0; +# endif + + /* st_mode. */ + unsigned int mode = + /* XXX How to handle FILE_ATTRIBUTE_REPARSE_POINT ? */ + ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR | S_IEXEC_UGO : _S_IFREG) + | S_IREAD_UGO + | ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE_UGO); + if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + /* Determine whether the file is executable by looking at the file + name suffix. */ + if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0) { - check_dir = true; - while (len && ISSLASH (fixed_name[len - 1])) - fixed_name[--len] = '\0'; - if (!len) - fixed_name[0] = '/'; + const char *last_dot = NULL; + const char *p; + for (p = info.cFileName; *p != '\0'; p++) + if (*p == '.') + last_dot = p; + if (last_dot != NULL) + { + const char *suffix = last_dot + 1; + if (_stricmp (suffix, "exe") == 0 + || _stricmp (suffix, "bat") == 0 + || _stricmp (suffix, "cmd") == 0 + || _stricmp (suffix, "com") == 0) + mode |= S_IEXEC_UGO; + } } - else - fixed_name[len++] = '/'; - result = orig_stat (fixed_name, st); - if (result == 0 && check_dir && !S_ISDIR (st->st_mode)) + } + buf->st_mode = mode; + + /* st_nlink. Ignore hard links here. */ + buf->st_nlink = 1; + + /* There's no easy way to map the Windows SID concept to an integer. */ + buf->st_uid = 0; + buf->st_gid = 0; + + /* st_rdev is irrelevant for normal files and directories. */ + buf->st_rdev = 0; + + /* st_size. */ + if (sizeof (buf->st_size) <= 4) + /* Range check already done above. */ + buf->st_size = info.nFileSizeLow; + else + buf->st_size = ((long long) info.nFileSizeHigh << 32) | (long long) info.nFileSizeLow; + + /* st_atime, st_mtime, st_ctime. */ +# if _GL_WINDOWS_STAT_TIMESPEC + buf->st_atim = _gl_convert_FILETIME_to_timespec (&info.ftLastAccessTime); + buf->st_mtim = _gl_convert_FILETIME_to_timespec (&info.ftLastWriteTime); + buf->st_ctim = _gl_convert_FILETIME_to_timespec (&info.ftCreationTime); +# else + buf->st_atime = _gl_convert_FILETIME_to_POSIX (&info.ftLastAccessTime); + buf->st_mtime = _gl_convert_FILETIME_to_POSIX (&info.ftLastWriteTime); + buf->st_ctime = _gl_convert_FILETIME_to_POSIX (&info.ftCreationTime); +# endif + + FindClose (h); + + ret = 0; + } + + done: + if (ret >= 0 && check_dir && !S_ISDIR (buf->st_mode)) + { + errno = ENOTDIR; + ret = -1; + } + if (malloca_rname != NULL) + { + int saved_errno = errno; + freea (malloca_rname); + errno = saved_errno; + } + return ret; + } + + failed: + { + DWORD error = GetLastError (); + #if 0 + fprintf (stderr, "rpl_stat error 0x%x\n", (unsigned int) error); + #endif + + if (malloca_rname != NULL) + freea (malloca_rname); + + switch (error) + { + /* Some of these errors probably cannot happen with the specific flags + that we pass to CreateFile. But who knows... */ + case ERROR_FILE_NOT_FOUND: /* The last component of rname does not exist. */ + case ERROR_PATH_NOT_FOUND: /* Some directory component in rname does not exist. */ + case ERROR_BAD_PATHNAME: /* rname is such as '\\server'. */ + case ERROR_BAD_NET_NAME: /* rname is such as '\\server\nonexistentshare'. */ + case ERROR_INVALID_NAME: /* rname contains wildcards, misplaced colon, etc. */ + case ERROR_DIRECTORY: + errno = ENOENT; + break; + + case ERROR_ACCESS_DENIED: /* rname is such as 'C:\System Volume Information\foo'. */ + case ERROR_SHARING_VIOLATION: /* rname is such as 'C:\pagefile.sys' (second approach only). */ + /* XXX map to EACCES or EPERM? */ + errno = EACCES; + break; + + case ERROR_OUTOFMEMORY: + errno = ENOMEM; + break; + + case ERROR_WRITE_PROTECT: + errno = EROFS; + break; + + case ERROR_WRITE_FAULT: + case ERROR_READ_FAULT: + case ERROR_GEN_FAILURE: + errno = EIO; + break; + + case ERROR_BUFFER_OVERFLOW: + case ERROR_FILENAME_EXCED_RANGE: + errno = ENAMETOOLONG; + break; + + case ERROR_DELETE_PENDING: /* XXX map to EACCES or EPERM? */ + errno = EPERM; + break; + + default: + errno = EINVAL; + break; + } + + return -1; + } +#else + int result = orig_stat (name, buf); + if (result == 0) + { +# if REPLACE_FUNC_STAT_FILE + /* Solaris 9 mistakenly succeeds when given a non-directory with a + trailing slash. */ + if (!S_ISDIR (buf->st_mode)) + { + size_t len = strlen (name); + if (ISSLASH (name[len - 1])) { - result = -1; errno = ENOTDIR; + return -1; } } +# endif /* REPLACE_FUNC_STAT_FILE */ + result = stat_time_normalize (result, buf); } -#endif /* REPLACE_FUNC_STAT_DIR */ return result; +#endif } diff --git a/gnulib/import/stdalign.in.h b/gnulib/import/stdalign.in.h index 12f8a15..c20cf02 100644 --- a/gnulib/import/stdalign.in.h +++ b/gnulib/import/stdalign.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C11 <stdalign.h>. - Copyright 2011-2016 Free Software Foundation, Inc. + Copyright 2011-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert and Bruno Haible. */ @@ -53,7 +53,7 @@ #undef _Alignof /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 - <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ #if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9))) # ifdef __cplusplus @@ -102,8 +102,8 @@ # define _Alignas(a) alignas (a) # elif ((defined __APPLE__ && defined __MACH__ \ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ - : __GNUC__) \ - || 061200 <= __HP_cc || 061200 <= __HP_aCC \ + : __GNUC__ && !defined __ibmxl__) \ + || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__) # define _Alignas(a) __attribute__ ((__aligned__ (a))) # elif 1300 <= _MSC_VER diff --git a/gnulib/import/stdbool.in.h b/gnulib/import/stdbool.in.h index 7ecf203..8158b00 100644 --- a/gnulib/import/stdbool.in.h +++ b/gnulib/import/stdbool.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2003, 2006-2016 Free Software Foundation, Inc. +/* Copyright (C) 2001-2003, 2006-2019 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software; you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _GL_STDBOOL_H #define _GL_STDBOOL_H @@ -82,9 +82,9 @@ typedef bool _Bool; /* If @HAVE__BOOL@: Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when the built-in _Bool type is used. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html + https://lists.gnu.org/r/bug-coreutils/2005-10/msg00086.html Similar bugs are likely with other compilers as well; this file wouldn't be used if <stdbool.h> was working. So we override the _Bool type. diff --git a/gnulib/import/stddef.in.h b/gnulib/import/stddef.in.h index f4c4a10..6760561 100644 --- a/gnulib/import/stddef.in.h +++ b/gnulib/import/stddef.in.h @@ -1,6 +1,6 @@ /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. - Copyright (C) 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2009-2019 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 @@ -13,13 +13,13 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake. */ /* * POSIX 2008 <stddef.h> for platforms that have issues. - * <http://www.opengroup.org/susv3xbd/stddef.h.html> + * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html> */ #if __GNUC__ >= 3 @@ -83,26 +83,37 @@ /* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is a hack in case the configure-time test was done with g++ even though - we are currently compiling with gcc. */ -#if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T) + we are currently compiling with gcc. + On MSVC, max_align_t is defined only in C++ mode, after <cstddef> was + included. Its definition is good since it has an alignment of 8 (on x86 + and x86_64). */ +#if defined _MSC_VER && defined __cplusplus +# include <cstddef> +#else +# if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T) +# if !GNULIB_defined_max_align_t /* On the x86, the maximum storage alignment of double, long, etc. is 4, but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8, and the C11 standard allows this. Work around this problem by using __alignof__ (which returns 8 for double) rather than _Alignof (which returns 4), and align each union member accordingly. */ -# ifdef __GNUC__ -# define _GL_STDDEF_ALIGNAS(type) \ - __attribute__ ((__aligned__ (__alignof__ (type)))) -# else -# define _GL_STDDEF_ALIGNAS(type) /* */ -# endif +# ifdef __GNUC__ +# define _GL_STDDEF_ALIGNAS(type) \ + __attribute__ ((__aligned__ (__alignof__ (type)))) +# else +# define _GL_STDDEF_ALIGNAS(type) /* */ +# endif typedef union { char *__p _GL_STDDEF_ALIGNAS (char *); double __d _GL_STDDEF_ALIGNAS (double); long double __ld _GL_STDDEF_ALIGNAS (long double); long int __i _GL_STDDEF_ALIGNAS (long int); -} max_align_t; +} rpl_max_align_t; +# define max_align_t rpl_max_align_t +# define GNULIB_defined_max_align_t 1 +# endif +# endif #endif # endif /* _@GUARD_PREFIX@_STDDEF_H */ diff --git a/gnulib/import/stdint.in.h b/gnulib/import/stdint.in.h index c86ab09..39b6a4f 100644 --- a/gnulib/import/stdint.in.h +++ b/gnulib/import/stdint.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2002, 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2001-2002, 2004-2019 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. @@ -13,11 +13,11 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* * ISO C 99 <stdint.h> for platforms that lack it. - * <http://www.opengroup.org/susv3xbd/stdint.h.html> + * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html> */ #ifndef _@GUARD_PREFIX@_STDINT_H @@ -83,6 +83,15 @@ LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ #include <limits.h> +/* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides + wint_t. */ +#if @GNULIB_OVERRIDES_WINT_T@ +# undef WINT_MIN +# undef WINT_MAX +# define WINT_MIN 0x0U +# define WINT_MAX 0xffffffffU +#endif + #if ! @HAVE_C99_STDINT_H@ /* <sys/types.h> defines some of the stdint.h types as well, on glibc, @@ -119,8 +128,13 @@ 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)) +/* These are separate macros, because if you try to merge these macros into + a single one, HP-UX cc rejects the resulting expression in constant + expressions. */ +# define _STDINT_UNSIGNED_MIN(bits, zero) \ + (zero) +# define _STDINT_SIGNED_MIN(bits, zero) \ + (~ _STDINT_MAX (1, bits, zero)) # define _STDINT_MAX(signed, bits, zero) \ (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) @@ -285,16 +299,26 @@ typedef gl_uint_fast32_t gl_uint_fast16_t; /* 7.18.1.4. Integer types capable of holding object pointers */ -/* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own +/* 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 + to avoid clashes with declarations of system functions like sbrk. + Similarly, mingw 5.22 <crtdefs.h> defines _INTPTR_T_DEFINED and + _UINTPTR_T_DEFINED and needs its own definitions of intptr_t and + uintptr_t to avoid conflicting declarations of system functions like + _findclose in <io.h>. */ +# if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \ + || (defined __MINGW32__ && defined _INTPTR_T_DEFINED && defined _UINTPTR_T_DEFINED)) +# undef intptr_t +# undef uintptr_t +# ifdef _WIN64 +typedef long long int gl_intptr_t; +typedef unsigned long long int gl_uintptr_t; +# else 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 */ @@ -471,9 +495,15 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) # undef INTPTR_MIN # undef INTPTR_MAX # undef UINTPTR_MAX -# define INTPTR_MIN LONG_MIN -# define INTPTR_MAX LONG_MAX -# define UINTPTR_MAX ULONG_MAX +# ifdef _WIN64 +# define INTPTR_MIN LLONG_MIN +# define INTPTR_MAX LLONG_MAX +# define UINTPTR_MAX ULLONG_MAX +# else +# define INTPTR_MIN LONG_MIN +# define INTPTR_MAX LONG_MAX +# define UINTPTR_MAX ULONG_MAX +# endif /* 7.18.2.5. Limits of greatest-width integer types */ @@ -503,15 +533,15 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) # undef PTRDIFF_MAX # if @APPLE_UNIVERSAL_BUILD@ # ifdef _LP64 -# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) +# define PTRDIFF_MIN _STDINT_SIGNED_MIN (64, 0l) # define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) # else -# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) +# define PTRDIFF_MIN _STDINT_SIGNED_MIN (32, 0) # define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) # endif # else # define PTRDIFF_MIN \ - _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) + _STDINT_SIGNED_MIN (@BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) # define PTRDIFF_MAX \ _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) # endif @@ -519,9 +549,13 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) /* sig_atomic_t limits */ # 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@) +# if @HAVE_SIGNED_SIG_ATOMIC_T@ +# define SIG_ATOMIC_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@) +# else +# define SIG_ATOMIC_MIN \ + _STDINT_UNSIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@) +# endif # define SIG_ATOMIC_MAX \ _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ 0@SIG_ATOMIC_T_SUFFIX@) @@ -557,18 +591,32 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) # endif # undef WCHAR_MIN # undef WCHAR_MAX -# define WCHAR_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +# if @HAVE_SIGNED_WCHAR_T@ +# define WCHAR_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +# else +# define WCHAR_MIN \ + _STDINT_UNSIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +# endif # 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 \ - _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) -# define WINT_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +/* If gnulib's <wchar.h> or <wctype.h> overrides wint_t, @WINT_T_SUFFIX@ is not + accurate, therefore use the definitions from above. */ +# if !@GNULIB_OVERRIDES_WINT_T@ +# undef WINT_MIN +# undef WINT_MAX +# if @HAVE_SIGNED_WINT_T@ +# define WINT_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +# else +# define WINT_MIN \ + _STDINT_UNSIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +# endif +# define WINT_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +# endif /* 7.18.4. Macros for integer constants */ diff --git a/gnulib/import/stdio.in.h b/gnulib/import/stdio.in.h index 9b31365..92328bf 100644 --- a/gnulib/import/stdio.in.h +++ b/gnulib/import/stdio.in.h @@ -1,6 +1,6 @@ /* A GNU-like <stdio.h>. - Copyright (C) 2004, 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2004, 2007-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -111,13 +111,40 @@ #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) -/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */ +/* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */ /* But in any case avoid namespace pollution on glibc systems. */ -#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \ && ! defined __GLIBC__ # include <unistd.h> #endif +/* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>. */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ + && ! defined __GLIBC__ +# include <sys/stat.h> +#endif + +/* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>. We must include + 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 __CYGWIN__) \ + && ! defined __GLIBC__ +# include <stdlib.h> +#endif + +/* MSVC declares 'remove' in <io.h>, not in <stdio.h>. We must include + it before we #define remove rpl_remove. */ +/* MSVC declares 'rename' in <io.h>, not in <stdio.h>. We must include + 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 __CYGWIN__) \ + && ! defined __GLIBC__ +# include <io.h> +#endif + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -132,7 +159,7 @@ /* When also using extern inline, suppress the use of static inline in standard headers of problematic Apple configurations, as Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., - <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. + <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>. Perhaps Apple will fix this some day. */ #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ && defined __GNUC__ && defined __STDC__) @@ -176,7 +203,9 @@ _GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); # else _GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fclose); +# endif #elif defined GNULIB_POSIXCHECK # undef fclose /* Assume fclose is always declared. */ @@ -220,7 +249,9 @@ _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); # else _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fflush); +# endif #elif defined GNULIB_POSIXCHECK # undef fflush /* Assume fflush is always declared. */ @@ -239,7 +270,9 @@ _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); # else _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fgetc); +# endif #endif #if @GNULIB_FGETS@ @@ -254,7 +287,9 @@ _GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream)); # else _GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fgets); +# endif #endif #if @GNULIB_FOPEN@ @@ -269,7 +304,9 @@ _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode)); # else _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fopen); +# endif #elif defined GNULIB_POSIXCHECK # undef fopen /* Assume fopen is always declared. */ @@ -297,7 +334,9 @@ _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...)); # else _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fprintf); +# endif #endif #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_fprintf @@ -348,7 +387,9 @@ _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); # else _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fputc); +# endif #endif #if @GNULIB_FPUTS@ @@ -363,7 +404,9 @@ _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream)); # else _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fputs); +# endif #endif #if @GNULIB_FREAD@ @@ -378,7 +421,9 @@ _GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); # else _GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fread); +# endif #endif #if @GNULIB_FREOPEN@ @@ -396,7 +441,9 @@ _GL_CXXALIAS_RPL (freopen, FILE *, _GL_CXXALIAS_SYS (freopen, FILE *, (const char *filename, const char *mode, FILE *stream)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (freopen); +# endif #elif defined GNULIB_POSIXCHECK # undef freopen /* Assume freopen is always declared. */ @@ -418,7 +465,9 @@ _GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...)); # else _GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fscanf); +# endif #endif @@ -469,7 +518,9 @@ _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); # else _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fseek); +# endif #endif #if @GNULIB_FSEEKO@ @@ -532,7 +583,9 @@ _GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); # else _GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (ftell); +# endif #endif #if @GNULIB_FTELLO@ @@ -590,7 +643,7 @@ _GL_CXXALIAS_SYS (fwrite, size_t, (const void *ptr, size_t s, size_t n, FILE *stream)); /* Work around bug 11959 when fortifying glibc 2.4 through 2.15 - <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>, + <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>, which sometimes causes an unwanted diagnostic for fwrite calls. This affects only function declaration attributes under certain versions of gcc and clang, and is not needed for C++. */ @@ -612,7 +665,9 @@ extern size_t __REDIRECT (rpl_fwrite_unlocked, # define fwrite_unlocked rpl_fwrite_unlocked # endif # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fwrite); +# endif #endif #if @GNULIB_GETC@ @@ -626,7 +681,9 @@ _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); # else _GL_CXXALIAS_SYS (getc, int, (FILE *stream)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (getc); +# endif #endif #if @GNULIB_GETCHAR@ @@ -640,7 +697,9 @@ _GL_CXXALIAS_RPL (getchar, int, (void)); # else _GL_CXXALIAS_SYS (getchar, int, (void)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (getchar); +# endif #endif #if @GNULIB_GETDELIM@ @@ -805,7 +864,9 @@ _GL_CXXALIAS_RPL (perror, void, (const char *string)); # else _GL_CXXALIAS_SYS (perror, void, (const char *string)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (perror); +# endif #elif defined GNULIB_POSIXCHECK # undef perror /* Assume perror is always declared. */ @@ -876,7 +937,9 @@ _GL_CXXALIAS_RPL (printf, int, (const char *format, ...)); # else _GL_CXXALIAS_SYS (printf, int, (const char *format, ...)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (printf); +# endif #endif #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_printf @@ -899,7 +962,9 @@ _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); # else _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (putc); +# endif #endif #if @GNULIB_PUTCHAR@ @@ -913,7 +978,9 @@ _GL_CXXALIAS_RPL (putchar, int, (int c)); # else _GL_CXXALIAS_SYS (putchar, int, (int c)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (putchar); +# endif #endif #if @GNULIB_PUTS@ @@ -927,7 +994,9 @@ _GL_CXXALIAS_RPL (puts, int, (const char *string)); # else _GL_CXXALIAS_SYS (puts, int, (const char *string)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (puts); +# endif #endif #if @GNULIB_REMOVE@ @@ -941,7 +1010,9 @@ _GL_CXXALIAS_RPL (remove, int, (const char *name)); # else _GL_CXXALIAS_SYS (remove, int, (const char *name)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (remove); +# endif #elif defined GNULIB_POSIXCHECK # undef remove /* Assume remove is always declared. */ @@ -964,7 +1035,9 @@ _GL_CXXALIAS_RPL (rename, int, _GL_CXXALIAS_SYS (rename, int, (const char *old_filename, const char *new_filename)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (rename); +# endif #elif defined GNULIB_POSIXCHECK # undef rename /* Assume rename is always declared. */ @@ -1029,7 +1102,9 @@ _GL_CXXALIAS_RPL (scanf, int, (const char *format, ...)); # else _GL_CXXALIAS_SYS (scanf, int, (const char *format, ...)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (scanf); +# endif #endif #if @GNULIB_SNPRINTF@ @@ -1083,7 +1158,9 @@ _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); # else _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (sprintf); +# endif #elif defined GNULIB_POSIXCHECK # undef sprintf /* Assume sprintf is always declared. */ @@ -1102,7 +1179,9 @@ _GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); # else _GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (tmpfile); +# endif #elif defined GNULIB_POSIXCHECK # undef tmpfile # if HAVE_RAW_DECL_TMPFILE @@ -1180,7 +1259,9 @@ _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) _GL_CXXALIAS_SYS_CAST (vdprintf, int, (int fd, const char *format, va_list args)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (vdprintf); +# endif #elif defined GNULIB_POSIXCHECK # undef vdprintf # if HAVE_RAW_DECL_VDPRINTF @@ -1213,7 +1294,9 @@ _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)); _GL_CXXALIAS_SYS_CAST (vfprintf, int, (FILE *fp, const char *format, va_list args)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (vfprintf); +# endif #endif #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_vfprintf @@ -1267,7 +1350,9 @@ _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args)); and GCC's fixincludes did not change this to __gnuc_va_list. */ _GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (vprintf); +# endif #endif #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_vprintf @@ -1343,7 +1428,9 @@ _GL_CXXALIAS_RPL (vsprintf, int, _GL_CXXALIAS_SYS_CAST (vsprintf, int, (char *str, const char *format, va_list args)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (vsprintf); +# endif #elif defined GNULIB_POSIXCHECK # undef vsprintf /* Assume vsprintf is always declared. */ diff --git a/gnulib/import/stdlib.in.h b/gnulib/import/stdlib.in.h index 8f803a2..5edae2c 100644 --- a/gnulib/import/stdlib.in.h +++ b/gnulib/import/stdlib.in.h @@ -1,6 +1,6 @@ /* A GNU-like <stdlib.h>. - Copyright (C) 1995, 2001-2004, 2006-2016 Free Software Foundation, Inc. + Copyright (C) 1995, 2001-2004, 2006-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -47,11 +47,14 @@ /* Solaris declares getloadavg() in <sys/loadavg.h>. */ #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ +/* OpenIndiana has a bug: <sys/time.h> must be included before + <sys/loadavg.h>. */ +# include <sys/time.h> # include <sys/loadavg.h> #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 @@ -87,7 +90,7 @@ struct random_data # endif #endif -#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) +#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @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 Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */ @@ -173,7 +176,9 @@ _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); # else _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (calloc); +# endif #elif defined GNULIB_POSIXCHECK # undef calloc /* Assume calloc is always declared. */ @@ -235,8 +240,8 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " element (or NULL if it doesn't contain an "=" sign), - It returns the index of the "token" in the given array of tokens. Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. - For more details see the POSIX:2001 specification. - http://www.opengroup.org/susv3xsh/getsubopt.html */ + For more details see the POSIX specification. + https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ # if !@HAVE_GETSUBOPT@ _GL_FUNCDECL_SYS (getsubopt, int, (char **optionp, char *const *tokens, char **valuep) @@ -285,7 +290,9 @@ _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); # else _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (malloc); +# endif #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC # undef malloc /* Assume malloc is always declared. */ @@ -303,9 +310,20 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); # else +# if !@HAVE_MBTOWC@ +_GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +# endif _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbtowc); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mbtowc +# if HAVE_RAW_DECL_MBTOWC +_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " + "use gnulib module mbtowc for portability"); +# endif #endif #if @GNULIB_MKDTEMP@ @@ -570,10 +588,21 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ +# if @REPLACE_RANDOM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef random +# define random rpl_random +# endif +_GL_FUNCDECL_RPL (random, long, (void)); +_GL_CXXALIAS_RPL (random, long, (void)); +# else +# if !@HAVE_RANDOM@ _GL_FUNCDECL_SYS (random, long, (void)); +# endif +/* Need to cast, because on Haiku, the return type is + int. */ +_GL_CXXALIAS_SYS_CAST (random, long, (void)); # endif -_GL_CXXALIAS_SYS (random, long, (void)); _GL_CXXALIASWARN (random); #elif defined GNULIB_POSIXCHECK # undef random @@ -584,10 +613,21 @@ _GL_WARN_ON_USE (random, "random is unportable - " #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ +# if @REPLACE_RANDOM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef srandom +# define srandom rpl_srandom +# endif +_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); +_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); +# else +# if !@HAVE_RANDOM@ _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); +# endif +/* Need to cast, because on FreeBSD, the first parameter is + unsigned long seed. */ +_GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); # endif -_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed)); _GL_CXXALIASWARN (srandom); #elif defined GNULIB_POSIXCHECK # undef srandom @@ -598,31 +638,56 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - " #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ +# if @REPLACE_INITSTATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef initstate +# define initstate rpl_initstate +# endif +_GL_FUNCDECL_RPL (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size)); +# else +# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ _GL_FUNCDECL_SYS (initstate, char *, (unsigned int seed, char *buf, size_t buf_size) _GL_ARG_NONNULL ((2))); +# endif +/* Need to cast, because on FreeBSD, the first parameter is + unsigned long seed. */ +_GL_CXXALIAS_SYS_CAST (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size)); # endif -_GL_CXXALIAS_SYS (initstate, char *, - (unsigned int seed, char *buf, size_t buf_size)); _GL_CXXALIASWARN (initstate); #elif defined GNULIB_POSIXCHECK # undef initstate -# if HAVE_RAW_DECL_INITSTATE_R +# if HAVE_RAW_DECL_INITSTATE _GL_WARN_ON_USE (initstate, "initstate is unportable - " "use gnulib module random for portability"); # endif #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ +# if @REPLACE_SETSTATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setstate +# define setstate rpl_setstate +# endif +_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); +# else +# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); +# endif +/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter + is const char *arg_state. */ +_GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); # endif -_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state)); _GL_CXXALIASWARN (setstate); #elif defined GNULIB_POSIXCHECK # undef setstate -# if HAVE_RAW_DECL_SETSTATE_R +# if HAVE_RAW_DECL_SETSTATE _GL_WARN_ON_USE (setstate, "setstate is unportable - " "use gnulib module random for portability"); # endif @@ -703,9 +768,11 @@ _GL_FUNCDECL_SYS (initstate_r, int, struct random_data *rand_state) _GL_ARG_NONNULL ((2, 4))); # endif -_GL_CXXALIAS_SYS (initstate_r, int, - (unsigned int seed, char *buf, size_t buf_size, - struct random_data *rand_state)); +/* Need to cast, because on Haiku, the third parameter is + unsigned long buf_size. */ +_GL_CXXALIAS_SYS_CAST (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state)); # endif _GL_CXXALIASWARN (initstate_r); #elif defined GNULIB_POSIXCHECK @@ -733,8 +800,10 @@ _GL_FUNCDECL_SYS (setstate_r, int, (char *arg_state, struct random_data *rand_state) _GL_ARG_NONNULL ((1, 2))); # endif -_GL_CXXALIAS_SYS (setstate_r, int, - (char *arg_state, struct random_data *rand_state)); +/* Need to cast, because on Haiku, the first parameter is + void *arg_state. */ +_GL_CXXALIAS_SYS_CAST (setstate_r, int, + (char *arg_state, struct random_data *rand_state)); # endif _GL_CXXALIASWARN (setstate_r); #elif defined GNULIB_POSIXCHECK @@ -758,7 +827,9 @@ _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); # else _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (realloc); +# endif #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC # undef realloc /* Assume realloc is always declared. */ @@ -766,6 +837,23 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " "use gnulib module realloc-posix for portability"); #endif + +#if @GNULIB_REALLOCARRAY@ +# if ! @HAVE_REALLOCARRAY@ +_GL_FUNCDECL_SYS (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +# endif +_GL_CXXALIAS_SYS (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +_GL_CXXALIASWARN (reallocarray); +#elif defined GNULIB_POSIXCHECK +# undef reallocarray +# if HAVE_RAW_DECL_REALLOCARRAY +_GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " + "use gnulib module reallocarray for portability"); +# endif +#endif + #if @GNULIB_REALPATH@ # if @REPLACE_REALPATH@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -861,6 +949,7 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strtod rpl_strtod # endif +# define GNULIB_defined_strtod_function 1 _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); @@ -871,7 +960,9 @@ _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp) # endif _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (strtod); +# endif #elif defined GNULIB_POSIXCHECK # undef strtod # if HAVE_RAW_DECL_STRTOD @@ -880,6 +971,32 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - " # endif #endif +#if @GNULIB_STRTOLD@ + /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ +# if @REPLACE_STRTOLD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtold rpl_strtold +# endif +# define GNULIB_defined_strtold_function 1 +_GL_FUNCDECL_RPL (strtold, long double, (const char *str, char **endp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtold, long double, (const char *str, char **endp)); +# else +# if !@HAVE_STRTOLD@ +_GL_FUNCDECL_SYS (strtold, long double, (const char *str, char **endp) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtold, long double, (const char *str, char **endp)); +# endif +_GL_CXXALIASWARN (strtold); +#elif defined GNULIB_POSIXCHECK +# undef strtold +# if HAVE_RAW_DECL_STRTOLD +_GL_WARN_ON_USE (strtold, "strtold is unportable - " + "use gnulib module strtold for portability"); +# endif +#endif + #if @GNULIB_STRTOLL@ /* Parse a signed integer whose textual representation starts at STRING. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, @@ -984,7 +1101,9 @@ _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); # else _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wctomb); +# endif #endif diff --git a/gnulib/import/str-two-way.h b/gnulib/import/str-two-way.h index 0fe3161..30806d2 100644 --- a/gnulib/import/str-two-way.h +++ b/gnulib/import/str-two-way.h @@ -1,5 +1,5 @@ /* Byte-wise substring search, using the Two-Way algorithm. - Copyright (C) 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Eric Blake <ebb9@byu.net>, 2008. @@ -14,11 +14,11 @@ 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 <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Before including this file, you need to include <config.h> and <string.h>, and define: - RESULT_TYPE A macro that expands to the return type. + RETURN_TYPE A macro that expands to the return type. AVAILABLE(h, h_l, j, n_l) A macro that returns nonzero if there are at least N_L bytes left starting at H[J]. @@ -49,9 +49,9 @@ character shift table similar to the Boyer-Moore algorithm to achieve improved (potentially sub-linear) performance. - See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260, - http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm, - http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.6641&rep=rep1&type=pdf + See https://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260, + https://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm, + https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.6641&rep=rep1&type=pdf */ /* Point at which computing a bad-byte shift table is likely to be diff --git a/gnulib/import/strchrnul.c b/gnulib/import/strchrnul.c index 1482a77..0f5dd81 100644 --- a/gnulib/import/strchrnul.c +++ b/gnulib/import/strchrnul.c @@ -1,5 +1,5 @@ /* Searching in a string. - Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2003, 2007-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/strchrnul.valgrind b/gnulib/import/strchrnul.valgrind index b14fa13..781d037 100644 --- a/gnulib/import/strchrnul.valgrind +++ b/gnulib/import/strchrnul.valgrind @@ -1,4 +1,20 @@ # Suppress a valgrind message about use of uninitialized memory in strchrnul(). + +# Copyright (C) 2008-2019 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + # This use is OK because it provides only a speedup. { strchrnul-value4 diff --git a/gnulib/import/strdup.c b/gnulib/import/strdup.c index 81eb226..717cf65 100644 --- a/gnulib/import/strdup.c +++ b/gnulib/import/strdup.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2016 Free Software +/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> diff --git a/gnulib/import/streq.h b/gnulib/import/streq.h index 234f0756..326537b 100644 --- a/gnulib/import/streq.h +++ b/gnulib/import/streq.h @@ -1,5 +1,5 @@ /* Optimized string comparison. - Copyright (C) 2001-2002, 2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2007, 2009-2019 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 @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>. */ diff --git a/gnulib/import/strerror-override.c b/gnulib/import/strerror-override.c index 9bc9b18..558a010 100644 --- a/gnulib/import/strerror-override.c +++ b/gnulib/import/strerror-override.c @@ -1,6 +1,6 @@ /* strerror-override.c --- POSIX compatible system error routine - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2010. */ diff --git a/gnulib/import/strerror-override.h b/gnulib/import/strerror-override.h index 5264fd5..255febc 100644 --- a/gnulib/import/strerror-override.h +++ b/gnulib/import/strerror-override.h @@ -1,6 +1,6 @@ /* strerror-override.h --- POSIX compatible system error routine - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _GL_STRERROR_OVERRIDE_H # define _GL_STRERROR_OVERRIDE_H diff --git a/gnulib/import/strerror.c b/gnulib/import/strerror.c index 45c7633..f5900fd 100644 --- a/gnulib/import/strerror.c +++ b/gnulib/import/strerror.c @@ -1,6 +1,6 @@ /* strerror.c --- POSIX compatible system error routine - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -66,5 +66,6 @@ strerror (int n) if (sizeof buf <= len) abort (); - return memcpy (buf, msg, len + 1); + memcpy (buf, msg, len + 1); + return buf; } diff --git a/gnulib/import/strerror_r.c b/gnulib/import/strerror_r.c index b1d4cf5..85b9c6b 100644 --- a/gnulib/import/strerror_r.c +++ b/gnulib/import/strerror_r.c @@ -1,6 +1,6 @@ /* strerror_r.c --- POSIX compatible system error routine - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2010. */ @@ -28,6 +28,9 @@ #include <errno.h> #include <stdio.h> #include <stdlib.h> +#if !HAVE_SNPRINTF +# include <stdarg.h> +#endif #include "strerror-override.h" @@ -40,7 +43,7 @@ extern #endif int __xpg_strerror_r (int errnum, char *buf, size_t buflen); -#elif HAVE_DECL_STRERROR_R_ORIG && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) +#elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) /* The system's strerror_r function is OK, except that its third argument is 'int', not 'size_t', or its return type is wrong. */ @@ -58,7 +61,7 @@ int __xpg_strerror_r (int errnum, char *buf, size_t buflen); # define USE_SYSTEM_STRERROR 1 -# if defined __NetBSD__ || defined __hpux || ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __sgi || (defined __sun && !defined _LP64) || defined __CYGWIN__ +# if defined __NetBSD__ || defined __hpux || (defined _WIN32 && !defined __CYGWIN__) || defined __sgi || (defined __sun && !defined _LP64) || defined __CYGWIN__ /* No locking needed. */ @@ -126,22 +129,13 @@ static int safe_copy (char *buf, size_t buflen, const char *msg) { size_t len = strlen (msg); - int ret; + size_t moved = len < buflen ? len : buflen - 1; - if (len < buflen) - { - /* Although POSIX allows memcpy() to corrupt errno, we don't - know of any implementation where this is a real problem. */ - memcpy (buf, msg, len + 1); - ret = 0; - } - else - { - memcpy (buf, msg, buflen - 1); - buf[buflen - 1] = '\0'; - ret = ERANGE; - } - return ret; + /* Although POSIX lets memmove corrupt errno, we don't + know of any implementation where this is a real problem. */ + memmove (buf, msg, moved); + buf[moved] = '\0'; + return len < buflen ? 0 : ERANGE; } @@ -209,13 +203,16 @@ strerror_r (int errnum, char *buf, size_t buflen) # else ret = strerror_r (errnum, buf, buflen); - /* Some old implementations may return (-1, EINVAL) instead of EINVAL. */ + /* Some old implementations may return (-1, EINVAL) instead of EINVAL. + But on Haiku, valid error numbers are negative. */ +# if !defined __HAIKU__ if (ret < 0) ret = errno; +# endif # endif -# ifdef _AIX - /* AIX returns 0 rather than ERANGE when truncating strings; try +# if defined _AIX || defined __HAIKU__ + /* AIX and Haiku return 0 rather than ERANGE when truncating strings; try again until we are sure we got the entire string. */ if (!ret && strlen (buf) == buflen - 1) { @@ -252,7 +249,7 @@ strerror_r (int errnum, char *buf, size_t buflen) /* Try to do what strerror (errnum) does, but without clobbering the buffer used by strerror(). */ -# if defined __NetBSD__ || defined __hpux || ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __CYGWIN__ /* NetBSD, HP-UX, native Windows, Cygwin */ +# if defined __NetBSD__ || defined __hpux || (defined _WIN32 && !defined __CYGWIN__) || defined __CYGWIN__ /* NetBSD, HP-UX, native Windows, Cygwin */ /* NetBSD: sys_nerr, sys_errlist are declared through _NETBSD_SOURCE and <errno.h> above. @@ -329,8 +326,124 @@ strerror_r (int errnum, char *buf, size_t buflen) #endif +#if defined _WIN32 && !defined __CYGWIN__ + /* MSVC 14 defines names for many error codes in the range 100..140, + but _sys_errlist contains strings only for the error codes + < _sys_nerr = 43. */ + if (ret == EINVAL) + { + const char *errmsg; + + switch (errnum) + { + case 100 /* EADDRINUSE */: + errmsg = "Address already in use"; + break; + case 101 /* EADDRNOTAVAIL */: + errmsg = "Cannot assign requested address"; + break; + case 102 /* EAFNOSUPPORT */: + errmsg = "Address family not supported by protocol"; + break; + case 103 /* EALREADY */: + errmsg = "Operation already in progress"; + break; + case 105 /* ECANCELED */: + errmsg = "Operation canceled"; + break; + case 106 /* ECONNABORTED */: + errmsg = "Software caused connection abort"; + break; + case 107 /* ECONNREFUSED */: + errmsg = "Connection refused"; + break; + case 108 /* ECONNRESET */: + errmsg = "Connection reset by peer"; + break; + case 109 /* EDESTADDRREQ */: + errmsg = "Destination address required"; + break; + case 110 /* EHOSTUNREACH */: + errmsg = "No route to host"; + break; + case 112 /* EINPROGRESS */: + errmsg = "Operation now in progress"; + break; + case 113 /* EISCONN */: + errmsg = "Transport endpoint is already connected"; + break; + case 114 /* ELOOP */: + errmsg = "Too many levels of symbolic links"; + break; + case 115 /* EMSGSIZE */: + errmsg = "Message too long"; + break; + case 116 /* ENETDOWN */: + errmsg = "Network is down"; + break; + case 117 /* ENETRESET */: + errmsg = "Network dropped connection on reset"; + break; + case 118 /* ENETUNREACH */: + errmsg = "Network is unreachable"; + break; + case 119 /* ENOBUFS */: + errmsg = "No buffer space available"; + break; + case 123 /* ENOPROTOOPT */: + errmsg = "Protocol not available"; + break; + case 126 /* ENOTCONN */: + errmsg = "Transport endpoint is not connected"; + break; + case 128 /* ENOTSOCK */: + errmsg = "Socket operation on non-socket"; + break; + case 129 /* ENOTSUP */: + errmsg = "Not supported"; + break; + case 130 /* EOPNOTSUPP */: + errmsg = "Operation not supported"; + break; + case 132 /* EOVERFLOW */: + errmsg = "Value too large for defined data type"; + break; + case 133 /* EOWNERDEAD */: + errmsg = "Owner died"; + break; + case 134 /* EPROTO */: + errmsg = "Protocol error"; + break; + case 135 /* EPROTONOSUPPORT */: + errmsg = "Protocol not supported"; + break; + case 136 /* EPROTOTYPE */: + errmsg = "Protocol wrong type for socket"; + break; + case 138 /* ETIMEDOUT */: + errmsg = "Connection timed out"; + break; + case 140 /* EWOULDBLOCK */: + errmsg = "Operation would block"; + break; + default: + errmsg = NULL; + break; + } + if (errmsg != NULL) + ret = safe_copy (buf, buflen, errmsg); + } +#endif + if (ret == EINVAL && !*buf) - snprintf (buf, buflen, "Unknown error %d", errnum); + { +#if defined __HAIKU__ + /* For consistency with perror(). */ + snprintf (buf, buflen, "Unknown Application Error (%d)", errnum); +#else + snprintf (buf, buflen, "Unknown error %d", errnum); +#endif + } errno = saved_errno; return ret; diff --git a/gnulib/import/string.in.h b/gnulib/import/string.in.h index b3213c4..9b8ced2 100644 --- a/gnulib/import/string.in.h +++ b/gnulib/import/string.in.h @@ -1,6 +1,6 @@ /* A GNU-like <string.h>. - Copyright (C) 1995-1996, 2001-2016 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -74,6 +74,23 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ +/* Clear a block of memory. The compiler will not delete a call to + this function, even if the block is dead after the call. */ +#if @GNULIB_EXPLICIT_BZERO@ +# if ! @HAVE_EXPLICIT_BZERO@ +_GL_FUNCDECL_SYS (explicit_bzero, void, + (void *__dest, size_t __n) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); +_GL_CXXALIASWARN (explicit_bzero); +#elif defined GNULIB_POSIXCHECK +# undef explicit_bzero +# if HAVE_RAW_DECL_EXPLICIT_BZERO +_GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " + "use gnulib module explicit_bzero for portability"); +# endif +#endif + /* Find the index of the least-significant set bit. */ #if @GNULIB_FFSL@ # if !@HAVE_FFSL@ @@ -132,7 +149,7 @@ _GL_CXXALIAS_SYS_CAST2 (memchr, _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); _GL_CXXALIASWARN1 (memchr, void const *, (void const *__s, int __c, size_t __n)); -# else +# elif __GLIBC__ >= 2 _GL_CXXALIASWARN (memchr); # endif #elif defined GNULIB_POSIXCHECK @@ -400,7 +417,9 @@ _GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n)); # else _GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (strncat); +# endif #elif defined GNULIB_POSIXCHECK # undef strncat # if HAVE_RAW_DECL_STRNCAT @@ -495,7 +514,7 @@ _GL_CXXALIAS_SYS_CAST2 (strpbrk, _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); _GL_CXXALIASWARN1 (strpbrk, char const *, (char const *__s, char const *__accept)); -# else +# elif __GLIBC__ >= 2 _GL_CXXALIASWARN (strpbrk); # endif # if defined GNULIB_POSIXCHECK @@ -597,7 +616,7 @@ _GL_CXXALIAS_SYS_CAST2 (strstr, _GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); _GL_CXXALIASWARN1 (strstr, const char *, (const char *haystack, const char *needle)); -# else +# elif __GLIBC__ >= 2 _GL_CXXALIASWARN (strstr); # endif #elif defined GNULIB_POSIXCHECK @@ -676,7 +695,7 @@ _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " This is a variant of strtok() that is multithread-safe. For the POSIX documentation for this function, see: - http://www.opengroup.org/susv3xsh/strtok.html + https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html Caveat: It modifies the original string. Caveat: These functions cannot be used on constant strings. @@ -963,7 +982,9 @@ _GL_CXXALIAS_RPL (strerror, char *, (int)); # else _GL_CXXALIAS_SYS (strerror, char *, (int)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (strerror); +# endif #elif defined GNULIB_POSIXCHECK # undef strerror /* Assume strerror is always declared. */ diff --git a/gnulib/import/stripslash.c b/gnulib/import/stripslash.c index 0453e36..dfc15b4 100644 --- a/gnulib/import/stripslash.c +++ b/gnulib/import/stripslash.c @@ -1,6 +1,6 @@ /* stripslash.c -- remove redundant trailing slashes from a file name - Copyright (C) 1990, 2001, 2003-2006, 2009-2016 Free Software Foundation, + Copyright (C) 1990, 2001, 2003-2006, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/strnlen1.c b/gnulib/import/strnlen1.c index f5e0ffc..666a557 100644 --- a/gnulib/import/strnlen1.c +++ b/gnulib/import/strnlen1.c @@ -1,5 +1,5 @@ /* Find the length of STRING + 1, but scan at most MAXLEN bytes. - Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gnulib/import/strnlen1.h b/gnulib/import/strnlen1.h index d3cd7c1..5d95244 100644 --- a/gnulib/import/strnlen1.h +++ b/gnulib/import/strnlen1.h @@ -1,5 +1,5 @@ /* Find the length of STRING + 1, but scan at most MAXLEN bytes. - Copyright (C) 2005, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _STRNLEN1_H #define _STRNLEN1_H diff --git a/gnulib/import/strstr.c b/gnulib/import/strstr.c index 60cd3e3..df3fdd2 100644 --- a/gnulib/import/strstr.c +++ b/gnulib/import/strstr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2016 Free Software +/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* This particular implementation was written by Eric Blake, 2008. */ @@ -26,10 +26,6 @@ #include <stdbool.h> -#ifndef _LIBC -# define __builtin_expect(expr, val) (expr) -#endif - #define RETURN_TYPE char * #define AVAILABLE(h, h_l, j, n_l) \ (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \ diff --git a/gnulib/import/strtok_r.c b/gnulib/import/strtok_r.c index 3531634..d043ec7 100644 --- a/gnulib/import/strtok_r.c +++ b/gnulib/import/strtok_r.c @@ -1,5 +1,5 @@ /* Reentrant string tokenizer. Generic version. - Copyright (C) 1991, 1996-1999, 2001, 2004, 2007, 2009-2016 Free Software + Copyright (C) 1991, 1996-1999, 2001, 2004, 2007, 2009-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/gnulib/import/sys_socket.in.h b/gnulib/import/sys_socket.in.h index a627dd4..dbcc3ef 100644 --- a/gnulib/import/sys_socket.in.h +++ b/gnulib/import/sys_socket.in.h @@ -1,6 +1,6 @@ /* Provide a sys/socket header file for systems lacking it (read: MinGW) and for systems where it is incomplete. - Copyright (C) 2005-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2019 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* This file is supposed to be used on platforms that lack <sys/socket.h>, on platforms where <sys/socket.h> cannot be included standalone, and on @@ -79,7 +79,12 @@ _GL_INLINE_HEADER_BEGIN #if !@HAVE_SA_FAMILY_T@ # if !GNULIB_defined_sa_family_t +/* On OS/2 kLIBC, sa_family_t is unsigned char unless TCPV40HDRS is defined. */ +# if !defined __KLIBC__ || defined TCPV40HDRS typedef unsigned short sa_family_t; +# else +typedef unsigned char sa_family_t; +# endif # define GNULIB_defined_sa_family_t 1 # endif #endif @@ -136,6 +141,15 @@ struct sockaddr_storage # define SHUT_RDWR 2 # endif +# ifdef __VMS /* OpenVMS */ +# ifndef CMSG_SPACE +# define CMSG_SPACE(length) _CMSG_SPACE(length) +# endif +# ifndef CMSG_LEN +# define CMSG_LEN(length) _CMSG_LEN(length) +# endif +# endif + #else # ifdef __CYGWIN__ @@ -155,7 +169,7 @@ struct sockaddr_storage code may not run on older Windows releases then. My Windows 2000 box was not able to run the code, for example. The situation is slightly confusing because - <http://msdn.microsoft.com/en-us/library/ms738520> + <https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfo> suggests that getaddrinfo should be available on all Windows releases. */ @@ -201,6 +215,15 @@ struct msghdr { #endif +/* Ensure SO_REUSEPORT is defined. */ +/* For the subtle differences between SO_REUSEPORT and SO_REUSEADDR, see + https://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t + and https://lwn.net/Articles/542629/ + */ +#ifndef SO_REUSEPORT +# define SO_REUSEPORT SO_REUSEADDR +#endif + /* Fix some definitions from <winsock2.h>. */ #if @HAVE_WINSOCK2_H@ @@ -494,7 +517,10 @@ _GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); # else -_GL_CXXALIAS_SYS (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); +/* Need to cast, because on HP-UX 11.31 the return type may be + int, + depending on compiler options. */ +_GL_CXXALIAS_SYS_CAST (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); # endif _GL_CXXALIASWARN (recv); #elif @HAVE_WINSOCK2_H@ @@ -520,8 +546,11 @@ _GL_FUNCDECL_RPL (send, ssize_t, _GL_CXXALIAS_RPL (send, ssize_t, (int fd, const void *buf, size_t len, int flags)); # else -_GL_CXXALIAS_SYS (send, ssize_t, - (int fd, const void *buf, size_t len, int flags)); +/* Need to cast, because on HP-UX 11.31 the return type may be + int, + depending on compiler options. */ +_GL_CXXALIAS_SYS_CAST (send, ssize_t, + (int fd, const void *buf, size_t len, int flags)); # endif _GL_CXXALIASWARN (send); #elif @HAVE_WINSOCK2_H@ @@ -657,7 +686,7 @@ _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - " The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) and O_TEXT, O_BINARY (defined in "binary-io.h"). See also the Linux man page at - <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */ + <https://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */ # if @HAVE_ACCEPT4@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define accept4 rpl_accept4 diff --git a/gnulib/import/sys_stat.in.h b/gnulib/import/sys_stat.in.h index 72d9537..9ddd1a8 100644 --- a/gnulib/import/sys_stat.in.h +++ b/gnulib/import/sys_stat.in.h @@ -1,5 +1,5 @@ -/* Provide a more complete sys/stat header file. - Copyright (C) 2005-2016 Free Software Foundation, Inc. +/* Provide a more complete sys/stat.h header file. + Copyright (C) 2005-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ @@ -54,16 +54,23 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ +/* Before doing "#define mknod rpl_mknod" below, we need to include all + headers that may declare mknod(). OS/2 kLIBC declares mknod() in + <unistd.h>, not in <sys/stat.h>. */ +#ifdef __KLIBC__ +# include <unistd.h> +#endif + /* 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__ + in <io.h> and/or <direct.h>, not in <sys/stat.h>. */ +#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 @@ -72,6 +79,75 @@ # define stat _stati64 #endif +/* Optionally, override 'struct stat' on native Windows. */ +#if @GNULIB_OVERRIDES_STRUCT_STAT@ + +# undef stat +# if @GNULIB_STAT@ +# define stat rpl_stat +# else + /* Provoke a clear link error if stat() is used as a function and + module 'stat' is not in use. */ +# define stat stat_used_without_requesting_gnulib_module_stat +# endif + +# if !GNULIB_defined_struct_stat +struct stat +{ + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; +# if 0 + uid_t st_uid; +# else /* uid_t is not defined by default on native Windows. */ + short st_uid; +# endif +# if 0 + gid_t st_gid; +# else /* gid_t is not defined by default on native Windows. */ + short st_gid; +# endif + dev_t st_rdev; + off_t st_size; +# if 0 + blksize_t st_blksize; + blkcnt_t st_blocks; +# endif + +# if @WINDOWS_STAT_TIMESPEC@ + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; +# else + time_t st_atime; + time_t st_mtime; + time_t st_ctime; +# endif +}; +# if @WINDOWS_STAT_TIMESPEC@ +# define st_atime st_atim.tv_sec +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec + /* Indicator, for gnulib internal purposes. */ +# define _GL_WINDOWS_STAT_TIMESPEC 1 +# endif +# define GNULIB_defined_struct_stat 1 +# endif + +/* Other possible values of st_mode. */ +# if 0 +# define _S_IFBLK 0x6000 +# endif +# if 0 +# define _S_IFLNK 0xA000 +# endif +# if 0 +# define _S_IFSOCK 0xC000 +# endif + +#endif + #ifndef S_IFIFO # ifdef _S_IFIFO # define S_IFIFO _S_IFIFO @@ -345,6 +421,9 @@ _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); # endif _GL_CXXALIASWARN (fstat); +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +# undef fstat +# define fstat fstat_used_without_requesting_gnulib_module_fstat #elif @WINDOWS_64_BIT_ST_SIZE@ /* Above, we define stat to _stati64. */ # define fstat _fstati64 @@ -378,6 +457,9 @@ _GL_CXXALIAS_SYS (fstatat, int, (int fd, char const *name, struct stat *st, int flags)); # endif _GL_CXXALIASWARN (fstatat); +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +# undef fstatat +# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat #elif defined GNULIB_POSIXCHECK # undef fstatat # if HAVE_RAW_DECL_FSTATAT @@ -476,6 +558,9 @@ _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf)); # if @HAVE_LSTAT@ _GL_CXXALIASWARN (lstat); # endif +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +# undef lstat +# define lstat lstat_used_without_requesting_gnulib_module_lstat #elif defined GNULIB_POSIXCHECK # undef lstat # if HAVE_RAW_DECL_LSTAT @@ -498,7 +583,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 @@ -625,63 +710,69 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " #if @GNULIB_STAT@ # if @REPLACE_STAT@ -/* We can't use the object-like #define stat rpl_stat, because of - struct stat. This means that rpl_stat will not be used if the user - does (stat)(a,b). Oh well. */ -# if defined _AIX && defined stat && defined _LARGE_FILES - /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, - so we have to replace stat64() instead of stat(). */ -# undef stat64 -# define stat64(name, st) rpl_stat (name, st) -# elif @WINDOWS_64_BIT_ST_SIZE@ - /* Above, we define stat to _stati64. */ -# if defined __MINGW32__ && defined _stati64 -# ifndef _USE_32BIT_TIME_T - /* The system headers define _stati64 to _stat64. */ -# undef _stat64 -# define _stat64(name, st) rpl_stat (name, st) +# if !@GNULIB_OVERRIDES_STRUCT_STAT@ + /* We can't use the object-like #define stat rpl_stat, because of + struct stat. This means that rpl_stat will not be used if the user + does (stat)(a,b). Oh well. */ +# if defined _AIX && defined stat && defined _LARGE_FILES + /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, + so we have to replace stat64() instead of stat(). */ +# undef stat64 +# define stat64(name, st) rpl_stat (name, st) +# elif @WINDOWS_64_BIT_ST_SIZE@ + /* Above, we define stat to _stati64. */ +# if defined __MINGW32__ && defined _stati64 +# ifndef _USE_32BIT_TIME_T + /* The system headers define _stati64 to _stat64. */ +# undef _stat64 +# define _stat64(name, st) rpl_stat (name, st) +# endif +# elif defined _MSC_VER && defined _stati64 +# ifdef _USE_32BIT_TIME_T + /* The system headers define _stati64 to _stat32i64. */ +# undef _stat32i64 +# define _stat32i64(name, st) rpl_stat (name, st) +# else + /* The system headers define _stati64 to _stat64. */ +# undef _stat64 +# define _stat64(name, st) rpl_stat (name, st) +# endif +# else +# undef _stati64 +# define _stati64(name, st) rpl_stat (name, st) # endif -# elif defined _MSC_VER && defined _stati64 +# elif defined __MINGW32__ && defined stat # ifdef _USE_32BIT_TIME_T - /* The system headers define _stati64 to _stat32i64. */ + /* The system headers define stat to _stat32i64. */ # undef _stat32i64 # define _stat32i64(name, st) rpl_stat (name, st) # else - /* The system headers define _stati64 to _stat64. */ + /* The system headers define stat to _stat64. */ # undef _stat64 # define _stat64(name, st) rpl_stat (name, st) # endif -# else -# undef _stati64 -# define _stati64(name, st) rpl_stat (name, st) -# endif -# elif defined __MINGW32__ && defined stat -# ifdef _USE_32BIT_TIME_T - /* The system headers define stat to _stat32i64. */ -# undef _stat32i64 -# define _stat32i64(name, st) rpl_stat (name, st) -# else - /* The system headers define stat to _stat64. */ -# undef _stat64 -# define _stat64(name, st) rpl_stat (name, st) -# endif -# elif defined _MSC_VER && defined stat -# ifdef _USE_32BIT_TIME_T - /* The system headers define stat to _stat32. */ -# undef _stat32 -# define _stat32(name, st) rpl_stat (name, st) -# else - /* The system headers define stat to _stat64i32. */ -# undef _stat64i32 -# define _stat64i32(name, st) rpl_stat (name, st) -# endif -# else /* !(_AIX ||__MINGW32__ || _MSC_VER) */ -# undef stat -# define stat(name, st) rpl_stat (name, st) -# endif /* !_LARGE_FILES */ +# elif defined _MSC_VER && defined stat +# ifdef _USE_32BIT_TIME_T + /* The system headers define stat to _stat32. */ +# undef _stat32 +# define _stat32(name, st) rpl_stat (name, st) +# else + /* The system headers define stat to _stat64i32. */ +# undef _stat64i32 +# define _stat64i32(name, st) rpl_stat (name, st) +# endif +# else /* !(_AIX || __MINGW32__ || _MSC_VER) */ +# undef stat +# define stat(name, st) rpl_stat (name, st) +# endif /* !_LARGE_FILES */ +# endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */ _GL_EXTERN_C int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2)); # endif +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +/* see above: + #define stat stat_used_without_requesting_gnulib_module_stat + */ #elif defined GNULIB_POSIXCHECK # undef stat # if HAVE_RAW_DECL_STAT diff --git a/gnulib/import/sys_time.in.h b/gnulib/import/sys_time.in.h index d535a6a..d6c215e 100644 --- a/gnulib/import/sys_time.in.h +++ b/gnulib/import/sys_time.in.h @@ -1,6 +1,6 @@ /* Provide a more complete sys/time.h. - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -112,8 +112,12 @@ _GL_CXXALIASWARN (gettimeofday); # if defined __cplusplus && defined GNULIB_NAMESPACE namespace GNULIB_NAMESPACE { typedef ::timeval -#undef timeval +# undef timeval timeval; +# if @REPLACE_STRUCT_TIMEVAL@ +# define timeval rpl_timeval + typedef ::timeval timeval; +# endif } # endif #elif defined GNULIB_POSIXCHECK diff --git a/gnulib/import/sys_types.in.h b/gnulib/import/sys_types.in.h index 8ab0545..237e206 100644 --- a/gnulib/import/sys_types.in.h +++ b/gnulib/import/sys_types.in.h @@ -1,6 +1,6 @@ /* Provide a more complete sys/types.h. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 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 @@ -13,13 +13,24 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #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. */ @@ -42,12 +53,54 @@ # define _GL_WINDOWS_64_BIT_OFF_T 1 #endif +/* Override dev_t and ino_t if distinguishable inodes support is requested + on native Windows. */ +#if @WINDOWS_STAT_INODES@ + +# if @WINDOWS_STAT_INODES@ == 2 +/* Experimental, not useful in Windows 10. */ + +/* Define dev_t to a 64-bit type. */ +# if !defined GNULIB_defined_dev_t +typedef unsigned long long int rpl_dev_t; +# undef dev_t +# define dev_t rpl_dev_t +# define GNULIB_defined_dev_t 1 +# endif + +/* Define ino_t to a 128-bit type. */ +# if !defined GNULIB_defined_ino_t +/* MSVC does not have a 128-bit integer type. + GCC has a 128-bit integer type __int128, but only on 64-bit targets. */ +typedef struct { unsigned long long int _gl_ino[2]; } rpl_ino_t; +# undef ino_t +# define ino_t rpl_ino_t +# define GNULIB_defined_ino_t 1 +# endif + +# else /* @WINDOWS_STAT_INODES@ == 1 */ + +/* Define ino_t to a 64-bit type. */ +# if !defined GNULIB_defined_ino_t +typedef unsigned long long int rpl_ino_t; +# undef ino_t +# define ino_t rpl_ino_t +# define GNULIB_defined_ino_t 1 +# endif + +# endif + +/* Indicator, for gnulib internal purposes. */ +# define _GL_WINDOWS_STAT_INODES @WINDOWS_STAT_INODES@ + +#endif + /* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */ /* But avoid namespace pollution on glibc systems. */ -#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ - && ! 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 */ diff --git a/gnulib/import/sys_uio.in.h b/gnulib/import/sys_uio.in.h index e70663f..d040a50 100644 --- a/gnulib/import/sys_uio.in.h +++ b/gnulib/import/sys_uio.in.h @@ -1,5 +1,5 @@ /* Substitute for <sys/uio.h>. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ # if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ diff --git a/gnulib/import/tempname.c b/gnulib/import/tempname.c index b1e9880..be62ed9 100644 --- a/gnulib/import/tempname.c +++ b/gnulib/import/tempname.c @@ -1,6 +1,6 @@ /* tempname.c - generate the name of a temporary file. - Copyright (C) 1991-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 1991-2003, 2005-2007, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Extracted from glibc sysdeps/posix/tempname.c. See also tmpdir.c. */ @@ -69,7 +69,6 @@ # define __mkdir mkdir # define __open open # define __lxstat64(version, file, buf) lstat (file, buf) -# define __secure_getenv secure_getenv #endif #ifdef _LIBC @@ -279,7 +278,7 @@ try_nocreate (char *tmpl, void *flags _GL_UNUSED) { struct_stat64 st; - if (__lxstat64 (_STAT_VER, tmpl, &st) == 0) + if (__lxstat64 (_STAT_VER, tmpl, &st) == 0 || errno == EOVERFLOW) __set_errno (EEXIST); return errno == ENOENT ? 0 : -1; } diff --git a/gnulib/import/tempname.h b/gnulib/import/tempname.h index be01c51..fb203d3 100644 --- a/gnulib/import/tempname.h +++ b/gnulib/import/tempname.h @@ -1,6 +1,6 @@ /* Create a temporary file or directory. - Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* header written by Eric Blake */ diff --git a/gnulib/import/time.in.h b/gnulib/import/time.in.h index 865c114..1b3bf3e 100644 --- a/gnulib/import/time.in.h +++ b/gnulib/import/time.in.h @@ -1,6 +1,6 @@ /* A more-standard <time.h>. - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -37,6 +37,12 @@ # define _@GUARD_PREFIX@_TIME_H +/* mingw's <time.h> provides the functions asctime_r, ctime_r, gmtime_r, + localtime_r only if <unistd.h> or <pthread.h> has been included before. */ +# if defined __MINGW32__ +# include <unistd.h> +# endif + # @INCLUDE_NEXT@ @NEXT_TIME_H@ /* NetBSD 5.0 mis-defines NULL. */ @@ -48,7 +54,7 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ -/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3). +/* Some systems don't define struct timespec (e.g., AIX 4.1). Or they define it with the wrong member names or define it in <sys/time.h> (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it, but the pthreads-win32 library defines it in <pthread.h>. */ @@ -84,8 +90,8 @@ struct timespec # endif # if !GNULIB_defined_struct_time_t_must_be_integral -/* Per http://austingroupbugs.net/view.php?id=327, POSIX requires - time_t to be an integer type, even though C99 permits floating +/* https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html + requires time_t to be an integer type, even though C99 permits floating point. We don't know of any implementation that uses floating point, and it is much easier to write code that doesn't have to worry about that corner case, so we force the issue. */ @@ -97,7 +103,7 @@ struct __time_t_must_be_integral { /* Sleep for at least RQTP seconds unless interrupted, If interrupted, return -1 and store the remaining time into RMTP. See - <http://www.opengroup.org/susv3xsh/nanosleep.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/nanosleep.html>. */ # if @GNULIB_NANOSLEEP@ # if @REPLACE_NANOSLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -120,6 +126,24 @@ _GL_CXXALIAS_SYS (nanosleep, int, _GL_CXXALIASWARN (nanosleep); # endif +/* Initialize time conversion information. */ +# if @GNULIB_TZSET@ +# if @REPLACE_TZSET@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef tzset +# define tzset rpl_tzset +# endif +_GL_FUNCDECL_RPL (tzset, void, (void)); +_GL_CXXALIAS_RPL (tzset, void, (void)); +# else +# if ! @HAVE_TZSET@ +_GL_FUNCDECL_SYS (tzset, void, (void)); +# endif +_GL_CXXALIAS_SYS (tzset, void, (void)); +# endif +_GL_CXXALIASWARN (tzset); +# endif + /* Return the 'time_t' representation of TP and normalize TP. */ # if @GNULIB_MKTIME@ # if @REPLACE_MKTIME@ @@ -131,12 +155,14 @@ _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); # else _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (mktime); +# endif # endif /* Convert TIMER to RESULT, assuming local time and UTC respectively. See - <http://www.opengroup.org/susv3xsh/localtime_r.html> and - <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime_r.html> and + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gmtime_r.html>. */ # if @GNULIB_TIME_R@ # if @REPLACE_LOCALTIME_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -185,24 +211,26 @@ _GL_CXXALIASWARN (gmtime_r); # endif /* Convert TIMER to RESULT, assuming local time and UTC respectively. See - <http://www.opengroup.org/susv3xsh/localtime.html> and - <http://www.opengroup.org/susv3xsh/gmtime.html>. */ -# if @GNULIB_GETTIMEOFDAY@ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime.html> and + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gmtime.html>. */ +# if @GNULIB_LOCALTIME@ || @REPLACE_LOCALTIME@ # if @REPLACE_LOCALTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef localtime # define localtime rpl_localtime # endif _GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) - _GL_ARG_NONNULL ((1))); + _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); # else _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (localtime); +# endif # endif -# if @GNULIB_GETTIMEOFDAY@ +# if 0 || @REPLACE_GMTIME@ # if @REPLACE_GMTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gmtime @@ -217,9 +245,9 @@ _GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer)); _GL_CXXALIASWARN (gmtime); # endif -/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store +/* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store the resulting broken-down time into TM. See - <http://www.opengroup.org/susv3xsh/strptime.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html>. */ # if @GNULIB_STRPTIME@ # if ! @HAVE_STRPTIME@ _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, @@ -233,6 +261,45 @@ _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, _GL_CXXALIASWARN (strptime); # endif +/* Convert *TP to a date and time string. See + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html>. */ +# if @GNULIB_CTIME@ +# if @REPLACE_CTIME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define ctime rpl_ctime +# endif +_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); +# else +_GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (ctime); +# endif +# endif + +/* Convert *TP to a date and time string. See + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html>. */ +# if @GNULIB_STRFTIME@ +# if @REPLACE_STRFTIME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strftime rpl_strftime +# endif +_GL_FUNCDECL_RPL (strftime, size_t, (char *__buf, size_t __bufsize, + const char *__fmt, const struct tm *__tp) + _GL_ARG_NONNULL ((1, 3, 4))); +_GL_CXXALIAS_RPL (strftime, size_t, (char *__buf, size_t __bufsize, + const char *__fmt, const struct tm *__tp)); +# else +_GL_CXXALIAS_SYS (strftime, size_t, (char *__buf, size_t __bufsize, + const char *__fmt, const struct tm *__tp)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strftime); +# endif +# endif + # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ typedef struct tm_zone *timezone_t; _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); diff --git a/gnulib/import/time_r.c b/gnulib/import/time_r.c index dc1e161..a701ccc 100644 --- a/gnulib/import/time_r.c +++ b/gnulib/import/time_r.c @@ -1,6 +1,6 @@ /* Reentrant time functions like localtime_r. - Copyright (C) 2003, 2006-2007, 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2010-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/gnulib/import/unistd--.h b/gnulib/import/unistd--.h index bd1d0fb..1268854 100644 --- a/gnulib/import/unistd--.h +++ b/gnulib/import/unistd--.h @@ -1,6 +1,6 @@ /* Like unistd.h, but redefine some names to avoid glitches. - Copyright (C) 2005, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/gnulib/import/unistd-safer.h b/gnulib/import/unistd-safer.h index c8179ce..8eebffc 100644 --- a/gnulib/import/unistd-safer.h +++ b/gnulib/import/unistd-safer.h @@ -1,6 +1,6 @@ /* Invoke unistd-like functions, but avoid some glitches. - Copyright (C) 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert and Eric Blake. */ diff --git a/gnulib/import/unistd.in.h b/gnulib/import/unistd.in.h index c3af07a..48db46a 100644 --- a/gnulib/import/unistd.in.h +++ b/gnulib/import/unistd.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around <unistd.h>. - Copyright (C) 2003-2016 Free Software Foundation, Inc. + Copyright (C) 2003-2019 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 @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_UNISTD_H @@ -21,7 +21,7 @@ #endif @PRAGMA_COLUMNS@ -#ifdef _GL_INCLUDING_UNISTD_H +#if @HAVE_UNISTD_H@ && defined _GL_INCLUDING_UNISTD_H /* Special invocation convention: - On Mac OS X 10.3.9 we have a sequence of nested includes <unistd.h> -> <signal.h> -> <pthread.h> -> <unistd.h> @@ -52,21 +52,30 @@ #define _@GUARD_PREFIX@_UNISTD_H /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ -#include <stddef.h> +/* But avoid namespace pollution on glibc systems. */ +#ifndef __GLIBC__ +# include <stddef.h> +#endif /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */ +/* MSVC declares 'unlink' in <stdio.h>, not in <unistd.h>. We must include + it before we #define unlink rpl_unlink. */ /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */ /* 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 __CYGWIN__)) \ || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \ && defined __CYGWIN__)) \ && ! defined __GLIBC__ # include <stdio.h> #endif -/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */ +/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in + <unistd.h>. */ /* But avoid namespace pollution on glibc systems. */ -#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \ +#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ + && (defined __CYGWIN__ || defined __ANDROID__) \ && ! defined __GLIBC__ # include <fcntl.h> #endif @@ -90,13 +99,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 @@ -109,25 +118,32 @@ # include <netdb.h> #endif +/* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */ +/* But avoid namespace pollution on glibc systems. */ +#if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ + && !defined __GLIBC__ +# include <sys/stat.h> +#endif + /* MSVC defines off_t in <sys/types.h>. May also define off_t to a 64-bit type on native Windows. */ -#if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@ -/* Get off_t. */ +/* But avoid namespace pollution on glibc systems. */ +#ifndef __GLIBC__ +/* Get off_t, ssize_t. */ # include <sys/types.h> #endif -#if (@GNULIB_READ@ || @GNULIB_WRITE@ \ - || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ - || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) -/* Get ssize_t. */ -# include <sys/types.h> -#endif +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ -/* Get getopt(), optarg, optind, opterr, optopt. - But avoid namespace pollution on glibc systems. */ -#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT -# define __need_getopt -# include <getopt.h> +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +/* Get getopt(), optarg, optind, opterr, optopt. */ +#if @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT +# include <getopt-cdefs.h> +# include <getopt-pfx-core.h> #endif #ifndef _GL_INLINE_HEADER_BEGIN @@ -138,13 +154,6 @@ _GL_INLINE_HEADER_BEGIN # define _GL_UNISTD_INLINE _GL_INLINE #endif -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - - /* Hide some function declarations from <winsock2.h>. */ #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ @@ -244,10 +253,28 @@ _GL_INLINE_HEADER_BEGIN /* Declare overridden functions. */ -#if defined GNULIB_POSIXCHECK +#if @GNULIB_ACCESS@ +# if @REPLACE_ACCESS@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef access +# define access rpl_access +# endif +_GL_FUNCDECL_RPL (access, int, (const char *file, int mode) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); +# else +_GL_CXXALIAS_SYS (access, int, (const char *file, int mode)); +# endif +_GL_CXXALIASWARN (access); +#elif defined GNULIB_POSIXCHECK +# undef access +# if HAVE_RAW_DECL_ACCESS /* The access() function is a security risk. */ -_GL_WARN_ON_USE (access, "the access function is a security risk - " +_GL_WARN_ON_USE (access, "access does not always support X_OK - " + "use gnulib module access for portability; " + "also, this function is a security risk - " "use the gnulib module faccessat instead"); +# endif #endif @@ -268,7 +295,7 @@ _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " to GID (if GID is not -1). Follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */ # if @REPLACE_CHOWN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef chown @@ -319,6 +346,24 @@ _GL_WARN_ON_USE (close, "close does not portably work on sockets - " #endif +#if @GNULIB_COPY_FILE_RANGE@ +# if !@HAVE_COPY_FILE_RANGE@ +_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, + int ofd, off_t *opos, + size_t len, unsigned flags)); +_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, + int ofd, off_t *opos, + size_t len, unsigned flags)); +# endif +_GL_CXXALIASWARN (copy_file_range); +#elif defined GNULIB_POSIXCHECK +/* Assume copy_file_range is always declared. */ +_GL_WARN_ON_USE (copy_file_range, + "copy_file_range is unportable - " + "use gnulib module copy_file_range for portability"); +#endif + + #if @GNULIB_DUP@ # if @REPLACE_DUP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -344,7 +389,7 @@ _GL_WARN_ON_USE (dup, "dup is unportable - " NEWFD = OLDFD, otherwise close NEWFD first if it is open. Return newfd if successful, otherwise -1 and errno set. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */ # if @REPLACE_DUP2@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup2 rpl_dup2 @@ -375,7 +420,7 @@ _GL_WARN_ON_USE (dup2, "dup2 is unportable - " Close NEWFD first if it is open. Return newfd if successful, otherwise -1 and errno set. See the Linux man page at - <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ + <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ # if @HAVE_DUP3@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup3 rpl_dup3 @@ -397,6 +442,13 @@ _GL_WARN_ON_USE (dup3, "dup3 is unportable - " #if @GNULIB_ENVIRON@ +# if defined __CYGWIN__ && !defined __i386__ +/* The 'environ' variable is defined in a DLL. Therefore its declaration needs + the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it. + This leads to a link error on 64-bit Cygwin when the option + -Wl,--disable-auto-import is in use. */ +_GL_EXTERN_C __declspec(dllimport) char **environ; +# endif # if !@HAVE_DECL_ENVIRON@ /* Set of environment variables and values. An array of strings of the form "VARIABLE=VALUE", terminated with a NULL. */ @@ -422,12 +474,12 @@ extern char **environ; #elif defined GNULIB_POSIXCHECK # if HAVE_RAW_DECL_ENVIRON _GL_UNISTD_INLINE char *** +_GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - " + "use gnulib module environ for portability") rpl_environ (void) { return &environ; } -_GL_WARN_ON_USE (rpl_environ, "environ is unportable - " - "use gnulib module environ for portability"); # undef environ # define environ (*rpl_environ ()) # endif @@ -458,13 +510,25 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " #if @GNULIB_FACCESSAT@ -# if !@HAVE_FACCESSAT@ +# if @REPLACE_FACCESSAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef faccessat +# define faccessat rpl_faccessat +# endif +_GL_FUNCDECL_RPL (faccessat, int, + (int fd, char const *name, int mode, int flag) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (faccessat, int, + (int fd, char const *name, int mode, int flag)); +# else +# if !@HAVE_FACCESSAT@ _GL_FUNCDECL_SYS (faccessat, int, (int fd, char const *file, int mode, int flag) _GL_ARG_NONNULL ((2))); -# endif +# endif _GL_CXXALIAS_SYS (faccessat, int, (int fd, char const *file, int mode, int flag)); +# endif _GL_CXXALIASWARN (faccessat); #elif defined GNULIB_POSIXCHECK # undef faccessat @@ -480,7 +544,7 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " the given file descriptor is open. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ # if ! @HAVE_FCHDIR@ _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); @@ -541,7 +605,7 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " /* Synchronize changes to a file. Return 0 if successful, otherwise -1 and errno set. See POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ _GL_FUNCDECL_SYS (fdatasync, int, (int fd)); # endif @@ -560,7 +624,7 @@ _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " /* Synchronize changes, including metadata, to a file. Return 0 if successful, otherwise -1 and errno set. See POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ # if !@HAVE_FSYNC@ _GL_FUNCDECL_SYS (fsync, int, (int fd)); # endif @@ -579,7 +643,7 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - " /* Change the size of the file to which FD is opened to become equal to LENGTH. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */ # if @REPLACE_FTRUNCATE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ftruncate @@ -609,7 +673,7 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " Return BUF if successful, or NULL if the directory couldn't be determined or SIZE was too small. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. Additionally, the gnulib module 'getcwd' guarantees the following GNU extension: If BUF is NULL, an array is allocated with 'malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as @@ -685,7 +749,9 @@ _GL_CXXALIAS_RPL (getdtablesize, int, (void)); # if !@HAVE_GETDTABLESIZE@ _GL_FUNCDECL_SYS (getdtablesize, int, (void)); # endif -_GL_CXXALIAS_SYS (getdtablesize, int, (void)); +/* Need to cast, because on AIX, the parameter list is + (...). */ +_GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void)); # endif _GL_CXXALIASWARN (getdtablesize); #elif defined GNULIB_POSIXCHECK @@ -769,14 +835,14 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - " /* Returns the user's login name, or NULL if it cannot be found. Upon error, returns NULL with errno set. - See <http://www.opengroup.org/susv3xsh/getlogin.html>. + See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>. Most programs don't need to use this function, because the information is available through environment variables: ${LOGNAME-$USER} on Unix platforms, $USERNAME on native Windows platforms. */ -# if !@HAVE_GETLOGIN@ +# if !@HAVE_DECL_GETLOGIN@ _GL_FUNCDECL_SYS (getlogin, char *, (void)); # endif _GL_CXXALIAS_SYS (getlogin, char *, (void)); @@ -798,7 +864,7 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " the case that the login name cannot be found but no specific error is provided (this case is hopefully rare but is left open by the POSIX spec). - See <http://www.opengroup.org/susv3xsh/getlogin.html>. + See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>. Most programs don't need to use this function, because the information is available through environment variables: @@ -839,6 +905,11 @@ _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " _GL_FUNCDECL_RPL (getpagesize, int, (void)); _GL_CXXALIAS_RPL (getpagesize, int, (void)); # else +/* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if + the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */ +# if defined __hpux +_GL_FUNCDECL_SYS (getpagesize, int, (void)); +# endif # if !@HAVE_GETPAGESIZE@ # if !defined getpagesize /* This is for POSIX systems. */ @@ -913,6 +984,36 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " #endif +#if @GNULIB_GETPASS@ +/* Function getpass() from module 'getpass': + Read a password from /dev/tty or stdin. + Function getpass() from module 'getpass-gnu': + Read a password of arbitrary length from /dev/tty or stdin. */ +# if @REPLACE_GETPASS@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getpass +# define getpass rpl_getpass +# endif +_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); +# else +# if !@HAVE_GETPASS@ +_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); +# endif +_GL_CXXALIASWARN (getpass); +#elif defined GNULIB_POSIXCHECK +# undef getpass +# if HAVE_RAW_DECL_GETPASS +_GL_WARN_ON_USE (getpass, "getpass is unportable - " + "use gnulib module getpass or getpass-gnu for portability"); +# endif +#endif + + #if @GNULIB_GETUSERSHELL@ /* Return the next valid login shell on the system, or NULL when the end of the list has been reached. */ @@ -1003,7 +1104,7 @@ _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " to GID (if GID is not -1). Do not follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */ # if @REPLACE_LCHOWN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef lchown @@ -1033,7 +1134,7 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " /* Create a new hard link for an existing file. Return 0 if successful, otherwise -1 and errno set. See POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */ # if @REPLACE_LINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define link rpl_link @@ -1099,7 +1200,7 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - " /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. Return the new offset if successful, otherwise -1 and errno set. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */ # if @REPLACE_LSEEK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define lseek rpl_lseek @@ -1145,7 +1246,7 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - " Store the read-end as fd[0] and the write-end as fd[1]. Return 0 upon success, or -1 with errno set upon failure. See also the Linux man page at - <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ + <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ # if @HAVE_PIPE2@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define pipe2 rpl_pipe2 @@ -1171,7 +1272,7 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " Return the number of bytes placed into BUF if successful, otherwise set errno and return -1. 0 indicates EOF. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */ # if @REPLACE_PREAD@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pread @@ -1206,7 +1307,7 @@ _GL_WARN_ON_USE (pread, "pread is unportable - " Return the number of bytes written if successful, otherwise set errno and return -1. 0 indicates nothing written. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */ # if @REPLACE_PWRITE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pwrite @@ -1239,7 +1340,7 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " #if @GNULIB_READ@ /* Read up to COUNT bytes from file descriptor FD into the buffer starting at BUF. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */ # if @REPLACE_READ@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef read @@ -1263,7 +1364,7 @@ _GL_CXXALIASWARN (read); bytes of it into BUF. Return the number of bytes placed into BUF if successful, otherwise -1 and errno set. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */ # if @REPLACE_READLINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define readlink rpl_readlink @@ -1373,7 +1474,7 @@ _GL_WARN_ON_USE (sethostname, "sethostname is unportable - " /* Pause the execution of the current thread for N seconds. Returns the number of seconds left to sleep. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */ # if @REPLACE_SLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef sleep @@ -1453,6 +1554,36 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " #endif +#if @GNULIB_TRUNCATE@ +/* Change the size of the file designated by FILENAME to become equal to LENGTH. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2008 specification + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */ +# if @REPLACE_TRUNCATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef truncate +# define truncate rpl_truncate +# endif +_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_DECL_TRUNCATE@ +_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); +# endif +_GL_CXXALIASWARN (truncate); +#elif defined GNULIB_POSIXCHECK +# undef truncate +# if HAVE_RAW_DECL_TRUNCATE +_GL_WARN_ON_USE (truncate, "truncate is unportable - " + "use gnulib module truncate for portability"); +# endif +#endif + + #if @GNULIB_TTYNAME_R@ /* Store at most BUFLEN characters of the pathname of the terminal FD is open on in BUF. Return 0 on success, otherwise an error number. */ @@ -1534,7 +1665,7 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " /* Pause the execution of the current thread for N microseconds. Returns 0 on completion, or -1 on range error. See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/usleep.html>. */ + <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */ # if @REPLACE_USLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef usleep @@ -1546,7 +1677,9 @@ _GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); # if !@HAVE_USLEEP@ _GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); # endif -_GL_CXXALIAS_SYS (usleep, int, (useconds_t n)); +/* Need to cast, because on Haiku, the first parameter is + unsigned int n. */ +_GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n)); # endif _GL_CXXALIASWARN (usleep); #elif defined GNULIB_POSIXCHECK @@ -1561,7 +1694,7 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - " #if @GNULIB_WRITE@ /* Write up to COUNT bytes starting at BUF to file descriptor FD. See the POSIX:2008 specification - <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */ + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */ # if @REPLACE_WRITE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef write diff --git a/gnulib/import/unsetenv.c b/gnulib/import/unsetenv.c index 8368744..0199280 100644 --- a/gnulib/import/unsetenv.c +++ b/gnulib/import/unsetenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995-2002, 2005-2016 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995-2002, 2005-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc optimizes away the name == NULL test below. */ diff --git a/gnulib/import/verify.h b/gnulib/import/verify.h index 5c8381d..a58005c 100644 --- a/gnulib/import/verify.h +++ b/gnulib/import/verify.h @@ -1,6 +1,6 @@ /* Compile-time assert-like macros. - Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2019 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 @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ @@ -21,31 +21,37 @@ #define _GL_VERIFY_H -/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per C11. - This is supported by GCC 4.6.0 and later, in C mode, and its use - here generates easier-to-read diagnostics when verify (R) fails. +/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert (R, DIAGNOSTIC) + works as per C11. This is supported by GCC 4.6.0 and later, in C + mode. - Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11. - This will likely be supported by future GCC versions, in C++ mode. + Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as + per C2X, and define _GL_HAVE_STATIC_ASSERT1 if static_assert (R) + works as per C++17. This is supported by GCC 9.1 and later. - Use this only with GCC. If we were willing to slow 'configure' - down we could also use it with other compilers, but since this - affects only the quality of diagnostics, why bother? */ -#if (4 < __GNUC__ + (6 <= __GNUC_MINOR__) \ - && (201112L <= __STDC_VERSION__ || !defined __STRICT_ANSI__) \ - && !defined __cplusplus) -# define _GL_HAVE__STATIC_ASSERT 1 -#endif -/* The condition (99 < __GNUC__) is temporary, until we know about the - first G++ release that supports static_assert. */ -#if (99 < __GNUC__) && defined __cplusplus -# define _GL_HAVE_STATIC_ASSERT 1 + Support compilers claiming conformance to the relevant standard, + and also support GCC when not pedantic. If we were willing to slow + 'configure' down we could also use it with other compilers, but + since this affects only the quality of diagnostics, why bother? */ +#ifndef __cplusplus +# if (201112L <= __STDC_VERSION__ \ + || (!defined __STRICT_ANSI__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__))) +# define _GL_HAVE__STATIC_ASSERT 1 +# endif +# if (202000L <= __STDC_VERSION__ \ + || (!defined __STRICT_ANSI__ && 9 <= __GNUC__)) +# define _GL_HAVE__STATIC_ASSERT1 1 +# endif +#else +# if 201703L <= __cplusplus || 9 <= __GNUC__ +# define _GL_HAVE_STATIC_ASSERT1 1 +# endif #endif /* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other system headers, defines a conflicting _Static_assert that is no better than ours; override it. */ -#ifndef _GL_HAVE_STATIC_ASSERT +#ifndef _GL_HAVE__STATIC_ASSERT # include <stddef.h> # undef _Static_assert #endif @@ -143,9 +149,9 @@ which do not support _Static_assert, also do not warn about the last declaration mentioned above. - * GCC warns if -Wnested-externs is enabled and verify() is used + * GCC warns if -Wnested-externs is enabled and 'verify' is used within a function body; but inside a function, you can always - arrange to use verify_expr() instead. + arrange to use verify_expr instead. * In C++, any struct definition inside sizeof is invalid. Use a template type to work around the problem. */ @@ -197,48 +203,61 @@ template <int w> #endif /* Verify requirement R at compile-time, as a declaration without a - trailing ';'. If R is false, fail at compile-time, preferably - with a diagnostic that includes the string-literal DIAGNOSTIC. + trailing ';'. If R is false, fail at compile-time. + + This macro requires three or more arguments but uses at most the first + two, so that the _Static_assert macro optionally defined below supports + both the C11 two-argument syntax and the C2X one-argument syntax. Unfortunately, unlike C11, this implementation must appear as an ordinary declaration, and cannot appear inside struct { ... }. */ -#ifdef _GL_HAVE__STATIC_ASSERT -# define _GL_VERIFY _Static_assert +#if defined _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC) #else -# define _GL_VERIFY(R, DIAGNOSTIC) \ +# define _GL_VERIFY(R, DIAGNOSTIC, ...) \ extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] #endif /* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ #ifdef _GL_STATIC_ASSERT_H -# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert -# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC) +# if !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert +# define _Static_assert(...) \ + _GL_VERIFY (__VA_ARGS__, "static assertion failed", -) # endif -# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert +# if !defined _GL_HAVE_STATIC_ASSERT1 && !defined static_assert # define static_assert _Static_assert /* C11 requires this #define. */ # endif #endif /* @assert.h omit start@ */ +#if 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)) +# define _GL_HAS_BUILTIN_TRAP 1 +#elif defined __has_builtin +# define _GL_HAS_BUILTIN_TRAP __has_builtin (__builtin_trap) +#else +# define _GL_HAS_BUILTIN_TRAP 0 +#endif + +#if 4 < __GNUC__ + (5 <= __GNUC_MINOR__) +# define _GL_HAS_BUILTIN_UNREACHABLE 1 +#elif defined __has_builtin +# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) +#else +# define _GL_HAS_BUILTIN_UNREACHABLE 0 +#endif + /* Each of these macros verifies that its argument R is nonzero. To be portable, R should be an integer constant expression. Unlike assert (R), there is no run-time overhead. There are two macros, since no single macro can be used in all - contexts in C. verify_true (R) is for scalar contexts, including + contexts in C. verify_expr (R, E) is for scalar contexts, including integer constant expression contexts. verify (R) is for declaration contexts, e.g., the top level. */ -/* Verify requirement R at compile-time, as an integer constant expression. - Return 1. This is equivalent to verify_expr (R, 1). - - verify_true is obsolescent; please use verify_expr instead. */ - -#define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")") - /* Verify requirement R at compile-time. Return the value of the expression E. */ @@ -246,32 +265,35 @@ template <int w> (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E)) /* Verify requirement R at compile-time, as a declaration without a - trailing ';'. */ + trailing ';'. verify (R) acts like static_assert (R) except that + it is portable to C11/C++14 and earlier, it can issue better + diagnostics, and its name is shorter and may be more convenient. */ -#define verify(R) _GL_VERIFY (R, "verify (" #R ")") - -#ifndef __has_builtin -# define __has_builtin(x) 0 +#ifdef __PGI +/* PGI barfs if R is long. */ +# define verify(R) _GL_VERIFY (R, "verify (...)", -) +#else +# define verify(R) _GL_VERIFY (R, "verify (" #R ")", -) #endif -/* Assume that R always holds. This lets the compiler optimize - accordingly. R should not have side-effects; it may or may not be - evaluated. Behavior is undefined if R is false. */ +/* Assume that R always holds. Behavior is undefined if R is false, + fails to evaluate, or has side effects. Although assuming R can + help a compiler generate better code or diagnostics, performance + can suffer if R uses hard-to-optimize features such as function + calls not inlined by the compiler. */ -#if (__has_builtin (__builtin_unreachable) \ - || 4 < __GNUC__ + (5 <= __GNUC_MINOR__)) +#if _GL_HAS_BUILTIN_UNREACHABLE # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) #elif 1200 <= _MSC_VER # define assume(R) __assume (R) -#elif ((defined GCC_LINT || defined lint) \ - && (__has_builtin (__builtin_trap) \ - || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)))) +#elif (defined GCC_LINT || defined lint) && _GL_HAS_BUILTIN_TRAP /* Doing it this way helps various packages when configured with --enable-gcc-warnings, which compiles with -Dlint. It's nicer when 'assume' silences warnings even with older GCCs. */ # define assume(R) ((R) ? (void) 0 : __builtin_trap ()) #else -# define assume(R) ((void) (0 && (R))) + /* Some tools grok NOTREACHED, e.g., Oracle Studio 12.6. */ +# define assume(R) ((R) ? (void) 0 : /*NOTREACHED*/ (void) 0) #endif /* @assert.h omit end@ */ diff --git a/gnulib/import/extra/snippet/warn-on-use.h b/gnulib/import/warn-on-use.h index 2948b47..7d11a15 100644 --- a/gnulib/import/extra/snippet/warn-on-use.h +++ b/gnulib/import/warn-on-use.h @@ -1,5 +1,5 @@ /* A C macro for emitting warnings if a function is used. - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2019 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 @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* _GL_WARN_ON_USE (function, "literal string") issues a declaration for FUNCTION which will then trigger a compiler warning containing @@ -20,23 +20,32 @@ supported by the compiler. If the compiler does not support this feature, the macro expands to an unused extern declaration. - This macro is useful for marking a function as a potential + _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the + attribute used in _GL_WARN_ON_USE. If the compiler does not support + this feature, it expands to empty. + + These macros are useful for marking a function as a potential portability trap, with the intent that "literal string" include instructions on the replacement function that should be used - instead. However, one of the reasons that a function is a - portability trap is if it has the wrong signature. Declaring - FUNCTION with a different signature in C is a compilation error, so - this macro must use the same type as any existing declaration so - that programs that avoid the problematic FUNCTION do not fail to - compile merely because they included a header that poisoned the - function. But this implies that _GL_WARN_ON_USE is only safe to - use if FUNCTION is known to already have a declaration. Use of - this macro implies that there must not be any other macro hiding - the declaration of FUNCTION; but undefining FUNCTION first is part - of the poisoning process anyway (although for symbols that are - provided only via a macro, the result is a compilation error rather - than a warning containing "literal string"). Also note that in - C++, it is only safe to use if FUNCTION has no overloads. + instead. + _GL_WARN_ON_USE is for functions with 'extern' linkage. + _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' + linkage. + + However, one of the reasons that a function is a portability trap is + if it has the wrong signature. Declaring FUNCTION with a different + signature in C is a compilation error, so this macro must use the + same type as any existing declaration so that programs that avoid + the problematic FUNCTION do not fail to compile merely because they + included a header that poisoned the function. But this implies that + _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already + have a declaration. Use of this macro implies that there must not + be any other macro hiding the declaration of FUNCTION; but + undefining FUNCTION first is part of the poisoning process anyway + (although for symbols that are provided only via a macro, the result + is a compilation error rather than a warning containing + "literal string"). Also note that in C++, it is only safe to use if + FUNCTION has no overloads. For an example, it is possible to poison 'getline' by: - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], @@ -54,12 +63,21 @@ (less common usage, like &environ, will cause a compilation error rather than issue the nice warning, but the end result of informing the developer about their portability problem is still achieved): - #if HAVE_RAW_DECL_ENVIRON - static char ***rpl_environ (void) { return &environ; } - _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); - # undef environ - # define environ (*rpl_environ ()) - #endif + #if HAVE_RAW_DECL_ENVIRON + static char *** + rpl_environ (void) { return &environ; } + _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); + # undef environ + # define environ (*rpl_environ ()) + #endif + or better (avoiding contradictory use of 'static' and 'extern'): + #if HAVE_RAW_DECL_ENVIRON + static char *** + _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") + rpl_environ (void) { return &environ; } + # undef environ + # define environ (*rpl_environ ()) + #endif */ #ifndef _GL_WARN_ON_USE @@ -67,13 +85,17 @@ /* A compiler attribute is available in gcc versions 4.3.0 and later. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function __attribute__ ((__warning__ (message))) +# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ + __attribute__ ((__warning__ (message))) # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function +# define _GL_WARN_ON_USE_ATTRIBUTE(message) # else /* Unsupported. */ # define _GL_WARN_ON_USE(function, message) \ _GL_WARN_EXTERN_C int _gl_warn_on_use +# define _GL_WARN_ON_USE_ATTRIBUTE(message) # endif #endif diff --git a/gnulib/import/wchar.in.h b/gnulib/import/wchar.in.h index 75fb9f0..cc0594c 100644 --- a/gnulib/import/wchar.in.h +++ b/gnulib/import/wchar.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2019 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 @@ -13,13 +13,13 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake. */ /* * ISO C 99 <wchar.h> for platforms that have issues. - * <http://www.opengroup.org/susv3xbd/wchar.h.html> + * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html> * * For now, this just ensures proper prerequisite inclusion order and * the declaration of wcwidth(). @@ -31,7 +31,7 @@ @PRAGMA_COLUMNS@ #if (((defined __need_mbstate_t || defined __need_wint_t) \ - && !defined __MINGW32__ && !defined __KLIBC__) \ + && !defined __MINGW32__) \ || (defined __hpux \ && ((defined _INTTYPES_INCLUDED && !defined strtoimax) \ || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \ @@ -113,12 +113,16 @@ # define WEOF -1 # endif #else -/* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>. - This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be - "unchanged by default argument promotions". Override it. */ -# if defined _MSC_VER +/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or + <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that + wint_t must be "unchanged by default argument promotions". Override it. */ +# if @GNULIB_OVERRIDES_WINT_T@ # if !GNULIB_defined_wint_t -# include <crtdefs.h> +# if @HAVE_CRTDEFS_H@ +# include <crtdefs.h> +# else +# include <stddef.h> +# endif typedef unsigned int rpl_wint_t; # undef wint_t # define wint_t rpl_wint_t @@ -133,8 +137,11 @@ typedef unsigned int rpl_wint_t; /* Override mbstate_t if it is too small. On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for - implementing mbrtowc for encodings like UTF-8. */ -#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ + implementing mbrtowc for encodings like UTF-8. + On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is + large enough and overriding it would cause problems in C++ mode. */ +#if (!(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@) \ + && !(defined _AIX || defined _MSC_VER) # if !GNULIB_defined_mbstate_t typedef int rpl_mbstate_t; # undef mbstate_t @@ -157,9 +164,12 @@ _GL_CXXALIAS_RPL (btowc, wint_t, (int c)); # if !@HAVE_BTOWC@ _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); # endif -_GL_CXXALIAS_SYS (btowc, wint_t, (int c)); +/* Need to cast, because on mingw, the return type is 'unsigned short'. */ +_GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (btowc); +# endif #elif defined GNULIB_POSIXCHECK # undef btowc # if HAVE_RAW_DECL_BTOWC @@ -185,7 +195,9 @@ _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wctob); +# endif #elif defined GNULIB_POSIXCHECK # undef wctob # if HAVE_RAW_DECL_WCTOB @@ -210,7 +222,9 @@ _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); # endif _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbsinit); +# endif #elif defined GNULIB_POSIXCHECK # undef mbsinit # if HAVE_RAW_DECL_MBSINIT @@ -239,7 +253,9 @@ _GL_FUNCDECL_SYS (mbrtowc, size_t, _GL_CXXALIAS_SYS (mbrtowc, size_t, (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbrtowc); +# endif #elif defined GNULIB_POSIXCHECK # undef mbrtowc # if HAVE_RAW_DECL_MBRTOWC @@ -264,7 +280,9 @@ _GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); # endif _GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbrlen); +# endif #elif defined GNULIB_POSIXCHECK # undef mbrlen # if HAVE_RAW_DECL_MBRLEN @@ -297,7 +315,9 @@ _GL_CXXALIAS_SYS (mbsrtowcs, size_t, (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbsrtowcs); +# endif #elif defined GNULIB_POSIXCHECK # undef mbsrtowcs # if HAVE_RAW_DECL_MBSRTOWCS @@ -357,7 +377,9 @@ _GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); # endif _GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcrtomb); +# endif #elif defined GNULIB_POSIXCHECK # undef wcrtomb # if HAVE_RAW_DECL_WCRTOMB @@ -390,7 +412,9 @@ _GL_CXXALIAS_SYS (wcsrtombs, size_t, (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsrtombs); +# endif #elif defined GNULIB_POSIXCHECK # undef wcsrtombs # if HAVE_RAW_DECL_WCSRTOMBS @@ -415,7 +439,7 @@ _GL_CXXALIAS_RPL (wcsnrtombs, size_t, (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps)); # else -# if !@HAVE_WCSNRTOMBS@ +# if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun) _GL_FUNCDECL_SYS (wcsnrtombs, size_t, (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps) @@ -425,7 +449,9 @@ _GL_CXXALIAS_SYS (wcsnrtombs, size_t, (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsnrtombs); +# endif #elif defined GNULIB_POSIXCHECK # undef wcsnrtombs # if HAVE_RAW_DECL_WCSNRTOMBS @@ -448,15 +474,12 @@ _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); # if !@HAVE_DECL_WCWIDTH@ /* wcwidth exists but is not declared. */ _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); -# elif defined __KLIBC__ -/* On OS/2 kLIBC, wcwidth is a macro that expands to the name of a - static inline function. The implementation of wcwidth in wcwidth.c - causes a "conflicting types" error. */ -# undef wcwidth # endif _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcwidth); +# endif #elif defined GNULIB_POSIXCHECK # undef wcwidth # if HAVE_RAW_DECL_WCWIDTH @@ -485,7 +508,7 @@ _GL_CXXALIAS_SYS_CAST2 (wmemchr, _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); _GL_CXXALIASWARN1 (wmemchr, const wchar_t *, (const wchar_t *s, wchar_t c, size_t n)); -# else +# elif __GLIBC__ >= 2 _GL_CXXALIASWARN (wmemchr); # endif #elif defined GNULIB_POSIXCHECK @@ -506,7 +529,9 @@ _GL_FUNCDECL_SYS (wmemcmp, int, # endif _GL_CXXALIAS_SYS (wmemcmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wmemcmp); +# endif #elif defined GNULIB_POSIXCHECK # undef wmemcmp # if HAVE_RAW_DECL_WMEMCMP @@ -524,7 +549,9 @@ _GL_FUNCDECL_SYS (wmemcpy, wchar_t *, # endif _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, (wchar_t *dest, const wchar_t *src, size_t n)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wmemcpy); +# endif #elif defined GNULIB_POSIXCHECK # undef wmemcpy # if HAVE_RAW_DECL_WMEMCPY @@ -543,7 +570,9 @@ _GL_FUNCDECL_SYS (wmemmove, wchar_t *, # endif _GL_CXXALIAS_SYS (wmemmove, wchar_t *, (wchar_t *dest, const wchar_t *src, size_t n)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wmemmove); +# endif #elif defined GNULIB_POSIXCHECK # undef wmemmove # if HAVE_RAW_DECL_WMEMMOVE @@ -559,7 +588,9 @@ _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); # endif _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wmemset); +# endif #elif defined GNULIB_POSIXCHECK # undef wmemset # if HAVE_RAW_DECL_WMEMSET @@ -575,7 +606,9 @@ _GL_WARN_ON_USE (wmemset, "wmemset is unportable - " _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcslen); +# endif #elif defined GNULIB_POSIXCHECK # undef wcslen # if HAVE_RAW_DECL_WCSLEN @@ -608,7 +641,9 @@ _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " _GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); # endif _GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcscpy); +# endif #elif defined GNULIB_POSIXCHECK # undef wcscpy # if HAVE_RAW_DECL_WCSCPY @@ -642,7 +677,9 @@ _GL_FUNCDECL_SYS (wcsncpy, wchar_t *, # endif _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, (wchar_t *dest, const wchar_t *src, size_t n)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsncpy); +# endif #elif defined GNULIB_POSIXCHECK # undef wcsncpy # if HAVE_RAW_DECL_WCSNCPY @@ -677,7 +714,9 @@ _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " _GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); # endif _GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcscat); +# endif #elif defined GNULIB_POSIXCHECK # undef wcscat # if HAVE_RAW_DECL_WCSCAT @@ -695,7 +734,9 @@ _GL_FUNCDECL_SYS (wcsncat, wchar_t *, # endif _GL_CXXALIAS_SYS (wcsncat, wchar_t *, (wchar_t *dest, const wchar_t *src, size_t n)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsncat); +# endif #elif defined GNULIB_POSIXCHECK # undef wcsncat # if HAVE_RAW_DECL_WCSNCAT @@ -712,7 +753,9 @@ _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcscmp); +# endif #elif defined GNULIB_POSIXCHECK # undef wcscmp # if HAVE_RAW_DECL_WCSCMP @@ -731,7 +774,9 @@ _GL_FUNCDECL_SYS (wcsncmp, int, # endif _GL_CXXALIAS_SYS (wcsncmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsncmp); +# endif #elif defined GNULIB_POSIXCHECK # undef wcsncmp # if HAVE_RAW_DECL_WCSNCMP @@ -784,7 +829,9 @@ _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); # endif _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcscoll); +# endif #elif defined GNULIB_POSIXCHECK # undef wcscoll # if HAVE_RAW_DECL_WCSCOLL @@ -802,7 +849,9 @@ _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " _GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); # endif _GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsxfrm); +# endif #elif defined GNULIB_POSIXCHECK # undef wcsxfrm # if HAVE_RAW_DECL_WCSXFRM @@ -846,7 +895,7 @@ _GL_CXXALIAS_SYS_CAST2 (wcschr, && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); -# else +# elif __GLIBC__ >= 2 _GL_CXXALIASWARN (wcschr); # endif #elif defined GNULIB_POSIXCHECK @@ -876,7 +925,7 @@ _GL_CXXALIAS_SYS_CAST2 (wcsrchr, && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); -# else +# elif __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsrchr); # endif #elif defined GNULIB_POSIXCHECK @@ -896,7 +945,9 @@ _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcscspn); +# endif #elif defined GNULIB_POSIXCHECK # undef wcscspn # if HAVE_RAW_DECL_WCSCSPN @@ -914,7 +965,9 @@ _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsspn); +# endif #elif defined GNULIB_POSIXCHECK # undef wcsspn # if HAVE_RAW_DECL_WCSSPN @@ -945,7 +998,7 @@ _GL_CXXALIASWARN1 (wcspbrk, wchar_t *, (wchar_t *wcs, const wchar_t *accept)); _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, (const wchar_t *wcs, const wchar_t *accept)); -# else +# elif __GLIBC__ >= 2 _GL_CXXALIASWARN (wcspbrk); # endif #elif defined GNULIB_POSIXCHECK @@ -978,7 +1031,7 @@ _GL_CXXALIASWARN1 (wcsstr, wchar_t *, (wchar_t *haystack, const wchar_t *needle)); _GL_CXXALIASWARN1 (wcsstr, const wchar_t *, (const wchar_t *haystack, const wchar_t *needle)); -# else +# elif __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsstr); # endif #elif defined GNULIB_POSIXCHECK @@ -992,13 +1045,26 @@ _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " /* Divide WCS into tokens separated by characters in DELIM. */ #if @GNULIB_WCSTOK@ -# if !@HAVE_WCSTOK@ +# if @REPLACE_WCSTOK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wcstok +# define wcstok rpl_wcstok +# endif +_GL_FUNCDECL_RPL (wcstok, wchar_t *, + (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); +_GL_CXXALIAS_RPL (wcstok, wchar_t *, + (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); +# else +# if !@HAVE_WCSTOK@ _GL_FUNCDECL_SYS (wcstok, wchar_t *, (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); -# endif +# endif _GL_CXXALIAS_SYS (wcstok, wchar_t *, (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); +# endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcstok); +# endif #elif defined GNULIB_POSIXCHECK # undef wcstok # if HAVE_RAW_DECL_WCSTOK @@ -1026,7 +1092,9 @@ _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n) # endif _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcswidth); +# endif #elif defined GNULIB_POSIXCHECK # undef wcswidth # if HAVE_RAW_DECL_WCSWIDTH @@ -1036,6 +1104,40 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " #endif +/* Convert *TP to a date and time wide string. See + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>. */ +#if @GNULIB_WCSFTIME@ +# if @REPLACE_WCSFTIME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wcsftime +# define wcsftime rpl_wcsftime +# endif +_GL_FUNCDECL_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, + const wchar_t *__fmt, const struct tm *__tp) + _GL_ARG_NONNULL ((1, 3, 4))); +_GL_CXXALIAS_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, + const wchar_t *__fmt, const struct tm *__tp)); +# else +# if !@HAVE_WCSFTIME@ +_GL_FUNCDECL_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, + const wchar_t *__fmt, const struct tm *__tp) + _GL_ARG_NONNULL ((1, 3, 4))); +# endif +_GL_CXXALIAS_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, + const wchar_t *__fmt, const struct tm *__tp)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (wcsftime); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcsftime +# if HAVE_RAW_DECL_WCSFTIME +_GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - " + "use gnulib module wcsftime for portability"); +# endif +#endif + + #endif /* _@GUARD_PREFIX@_WCHAR_H */ #endif /* _@GUARD_PREFIX@_WCHAR_H */ #endif diff --git a/gnulib/import/wctype.in.h b/gnulib/import/wctype.in.h index 37b3d8e..0cc7512 100644 --- a/gnulib/import/wctype.in.h +++ b/gnulib/import/wctype.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. - Copyright (C) 2006-2016 Free Software Foundation, Inc. + Copyright (C) 2006-2019 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 @@ -13,13 +13,13 @@ 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 <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible and Paul Eggert. */ /* * ISO C 99 <wctype.h> for platforms that lack it. - * <http://www.opengroup.org/susv3xbd/wctype.h.html> + * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html> * * iswctype, towctrans, towlower, towupper, wctrans, wctype, * wctrans_t, and wctype_t are not yet implemented. @@ -56,11 +56,13 @@ # include <wchar.h> #endif -/* mingw has declarations of towupper and towlower in <ctype.h> as - well <wctype.h>. Include <ctype.h> in advance to avoid rpl_ prefix - being added to the declarations. */ -#ifdef __MINGW32__ +/* Native Windows (mingw, MSVC) have declarations of towupper, towlower, and + isw* functions in <ctype.h>, <wchar.h> as well as in <wctype.h>. Include + <ctype.h>, <wchar.h> in advance to avoid rpl_ prefix being added to the + declarations. */ +#if defined _WIN32 && ! defined __CYGWIN__ # include <ctype.h> +# include <wchar.h> #endif /* Include the original <wctype.h> if it exists. @@ -105,12 +107,16 @@ _GL_INLINE_HEADER_BEGIN # define WEOF -1 # endif #else -/* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>. - This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be - "unchanged by default argument promotions". Override it. */ -# if defined _MSC_VER +/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or + <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that + wint_t must be "unchanged by default argument promotions". Override it. */ +# if @GNULIB_OVERRIDES_WINT_T@ # if !GNULIB_defined_wint_t -# include <crtdefs.h> +# if @HAVE_CRTDEFS_H@ +# include <crtdefs.h> +# else +# include <stddef.h> +# endif typedef unsigned int rpl_wint_t; # undef wint_t # define wint_t rpl_wint_t @@ -127,33 +133,113 @@ typedef unsigned int rpl_wint_t; /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. Linux libc5 has <wctype.h> and the functions but they are broken. + mingw and MSVC have <wctype.h> and the functions but they take a wchar_t + as argument, not an rpl_wint_t. Assume all 11 functions (all isw* except iswblank) are implemented the same way, or not at all. */ # if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ -/* IRIX 5.3 has macros but no functions, its isw* macros refer to an - undefined variable _ctmp_ and to <ctype.h> macros like _P, and they - refer to system functions like _iswctype that are not in the - standard C library. Rather than try to get ancient buggy - implementations like this to work, just disable them. */ -# undef iswalnum -# undef iswalpha -# undef iswblank -# undef iswcntrl -# undef iswdigit -# undef iswgraph -# undef iswlower -# undef iswprint -# undef iswpunct -# undef iswspace -# undef iswupper -# undef iswxdigit -# undef towlower -# undef towupper +# if @GNULIB_OVERRIDES_WINT_T@ /* implies @REPLACE_ISWCNTRL@ */ + +_GL_WCTYPE_INLINE int +rpl_iswalnum (wint_t wc) +{ + return ((wchar_t) wc == wc ? iswalnum ((wchar_t) wc) : 0); +} + +_GL_WCTYPE_INLINE int +rpl_iswalpha (wint_t wc) +{ + return ((wchar_t) wc == wc ? iswalpha ((wchar_t) wc) : 0); +} + +_GL_WCTYPE_INLINE int +rpl_iswblank (wint_t wc) +{ + return ((wchar_t) wc == wc ? iswblank ((wchar_t) wc) : 0); +} + +_GL_WCTYPE_INLINE int +rpl_iswcntrl (wint_t wc) +{ + return ((wchar_t) wc == wc ? iswcntrl ((wchar_t) wc) : 0); +} + +_GL_WCTYPE_INLINE int +rpl_iswdigit (wint_t wc) +{ + return ((wchar_t) wc == wc ? iswdigit ((wchar_t) wc) : 0); +} + +_GL_WCTYPE_INLINE int +rpl_iswgraph (wint_t wc) +{ + return ((wchar_t) wc == wc ? iswgraph ((wchar_t) wc) : 0); +} + +_GL_WCTYPE_INLINE int +rpl_iswlower (wint_t wc) +{ + return ((wchar_t) wc == wc ? iswlower ((wchar_t) wc) : 0); +} + +_GL_WCTYPE_INLINE int +rpl_iswprint (wint_t wc) +{ + return ((wchar_t) wc == wc ? iswprint ((wchar_t) wc) : 0); +} + +_GL_WCTYPE_INLINE int +rpl_iswpunct (wint_t wc) +{ + return ((wchar_t) wc == wc ? iswpunct ((wchar_t) wc) : 0); +} + +_GL_WCTYPE_INLINE int +rpl_iswspace (wint_t wc) +{ + return ((wchar_t) wc == wc ? iswspace ((wchar_t) wc) : 0); +} + +_GL_WCTYPE_INLINE int +rpl_iswupper (wint_t wc) +{ + return ((wchar_t) wc == wc ? iswupper ((wchar_t) wc) : 0); +} + +_GL_WCTYPE_INLINE int +rpl_iswxdigit (wint_t wc) +{ + return ((wchar_t) wc == wc ? iswxdigit ((wchar_t) wc) : 0); +} + +_GL_WCTYPE_INLINE wint_t +rpl_towlower (wint_t wc) +{ + return ((wchar_t) wc == wc ? (wchar_t) towlower ((wchar_t) wc) : wc); +} + +_GL_WCTYPE_INLINE wint_t +rpl_towupper (wint_t wc) +{ + return ((wchar_t) wc == wc ? (wchar_t) towupper ((wchar_t) wc) : wc); +} -/* Linux libc5 has <wctype.h> and the functions but they are broken. */ -# if @REPLACE_ISWCNTRL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef iswalnum +# undef iswalpha +# undef iswblank +# undef iswcntrl +# undef iswdigit +# undef iswgraph +# undef iswlower +# undef iswprint +# undef iswpunct +# undef iswspace +# undef iswupper +# undef iswxdigit +# undef towlower +# undef towupper # define iswalnum rpl_iswalnum # define iswalpha rpl_iswalpha # define iswblank rpl_iswblank @@ -166,21 +252,62 @@ typedef unsigned int rpl_wint_t; # define iswspace rpl_iswspace # define iswupper rpl_iswupper # define iswxdigit rpl_iswxdigit -# endif -# endif -# if @REPLACE_TOWLOWER@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define towlower rpl_towlower # define towupper rpl_towupper # endif -# endif + +# else + +/* IRIX 5.3 has macros but no functions, its isw* macros refer to an + undefined variable _ctmp_ and to <ctype.h> macros like _P, and they + refer to system functions like _iswctype that are not in the + standard C library. Rather than try to get ancient buggy + implementations like this to work, just disable them. */ +# undef iswalnum +# undef iswalpha +# undef iswblank +# undef iswcntrl +# undef iswdigit +# undef iswgraph +# undef iswlower +# undef iswprint +# undef iswpunct +# undef iswspace +# undef iswupper +# undef iswxdigit +# undef towlower +# undef towupper + +/* Linux libc5 has <wctype.h> and the functions but they are broken. */ +# if @REPLACE_ISWCNTRL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define iswalnum rpl_iswalnum +# define iswalpha rpl_iswalpha +# define iswblank rpl_iswblank +# define iswcntrl rpl_iswcntrl +# define iswdigit rpl_iswdigit +# define iswgraph rpl_iswgraph +# define iswlower rpl_iswlower +# define iswprint rpl_iswprint +# define iswpunct rpl_iswpunct +# define iswspace rpl_iswspace +# define iswupper rpl_iswupper +# define iswxdigit rpl_iswxdigit +# endif +# endif +# if @REPLACE_TOWLOWER@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define towlower rpl_towlower +# define towupper rpl_towupper +# endif +# endif _GL_WCTYPE_INLINE int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswalnum -# else +# else iswalnum -# endif +# endif (wint_t wc) { return ((wc >= '0' && wc <= '9') @@ -188,88 +315,88 @@ iswalnum } _GL_WCTYPE_INLINE int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswalpha -# else +# else iswalpha -# endif +# endif (wint_t wc) { return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; } _GL_WCTYPE_INLINE int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswblank -# else +# else iswblank -# endif +# endif (wint_t wc) { return wc == ' ' || wc == '\t'; } _GL_WCTYPE_INLINE int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswcntrl -# else +# else iswcntrl -# endif +# endif (wint_t wc) { return (wc & ~0x1f) == 0 || wc == 0x7f; } _GL_WCTYPE_INLINE int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswdigit -# else +# else iswdigit -# endif +# endif (wint_t wc) { return wc >= '0' && wc <= '9'; } _GL_WCTYPE_INLINE int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswgraph -# else +# else iswgraph -# endif +# endif (wint_t wc) { return wc >= '!' && wc <= '~'; } _GL_WCTYPE_INLINE int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswlower -# else +# else iswlower -# endif +# endif (wint_t wc) { return wc >= 'a' && wc <= 'z'; } _GL_WCTYPE_INLINE int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswprint -# else +# else iswprint -# endif +# endif (wint_t wc) { return wc >= ' ' && wc <= '~'; } _GL_WCTYPE_INLINE int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswpunct -# else +# else iswpunct -# endif +# endif (wint_t wc) { return (wc >= '!' && wc <= '~' @@ -278,11 +405,11 @@ iswpunct } _GL_WCTYPE_INLINE int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswspace -# else +# else iswspace -# endif +# endif (wint_t wc) { return (wc == ' ' || wc == '\t' @@ -290,22 +417,22 @@ iswspace } _GL_WCTYPE_INLINE int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswupper -# else +# else iswupper -# endif +# endif (wint_t wc) { return wc >= 'A' && wc <= 'Z'; } _GL_WCTYPE_INLINE int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswxdigit -# else +# else iswxdigit -# endif +# endif (wint_t wc) { return ((wc >= '0' && wc <= '9') @@ -313,27 +440,29 @@ iswxdigit } _GL_WCTYPE_INLINE wint_t -# if @REPLACE_TOWLOWER@ +# if @REPLACE_TOWLOWER@ rpl_towlower -# else +# else towlower -# endif +# endif (wint_t wc) { return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc); } _GL_WCTYPE_INLINE wint_t -# if @REPLACE_TOWLOWER@ +# if @REPLACE_TOWLOWER@ rpl_towupper -# else +# else towupper -# endif +# endif (wint_t wc) { return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc); } +# endif + # elif @GNULIB_ISWBLANK@ && (! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@) /* Only the iswblank function is missing. */ @@ -348,7 +477,7 @@ _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); # endif -# if defined __MINGW32__ +# if defined __MINGW32__ && !@GNULIB_OVERRIDES_WINT_T@ /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t. The functions towlower and towupper are implemented in the MSVCRT library @@ -381,7 +510,7 @@ rpl_towupper (wint_t wc) # define towupper rpl_towupper # endif -# endif /* __MINGW32__ */ +# endif /* __MINGW32__ && !@GNULIB_OVERRIDES_WINT_T@ */ # define GNULIB_defined_wctype_functions 1 #endif @@ -411,6 +540,7 @@ _GL_CXXALIAS_SYS (iswspace, int, (wint_t wc)); _GL_CXXALIAS_SYS (iswupper, int, (wint_t wc)); _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc)); #endif +#if __GLIBC__ >= 2 _GL_CXXALIASWARN (iswalnum); _GL_CXXALIASWARN (iswalpha); _GL_CXXALIASWARN (iswcntrl); @@ -422,6 +552,7 @@ _GL_CXXALIASWARN (iswpunct); _GL_CXXALIASWARN (iswspace); _GL_CXXALIASWARN (iswupper); _GL_CXXALIASWARN (iswxdigit); +#endif #if @GNULIB_ISWBLANK@ # if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@ @@ -429,7 +560,9 @@ _GL_CXXALIAS_RPL (iswblank, int, (wint_t wc)); # else _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (iswblank); +# endif #endif #if !@HAVE_WCTYPE_T@ @@ -445,7 +578,9 @@ typedef void * wctype_t; _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name)); # endif _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wctype); +# endif #elif defined GNULIB_POSIXCHECK # undef wctype # if HAVE_RAW_DECL_WCTYPE @@ -458,11 +593,22 @@ _GL_WARN_ON_USE (wctype, "wctype is unportable - " The argument WC must be either a wchar_t value or WEOF. The argument DESC must have been returned by the wctype() function. */ #if @GNULIB_ISWCTYPE@ -# if !@HAVE_WCTYPE_T@ +# if @GNULIB_OVERRIDES_WINT_T@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef iswctype +# define iswctype rpl_iswctype +# endif +_GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc)); +_GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc)); +# else +# if !@HAVE_WCTYPE_T@ _GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc)); -# endif +# endif _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc)); +# endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (iswctype); +# endif #elif defined GNULIB_POSIXCHECK # undef iswctype # if HAVE_RAW_DECL_ISWCTYPE @@ -478,8 +624,10 @@ _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc)); _GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc)); _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc)); #endif +#if __GLIBC__ >= 2 _GL_CXXALIASWARN (towlower); _GL_CXXALIASWARN (towupper); +#endif #if !@HAVE_WCTRANS_T@ # if !GNULIB_defined_wctrans_t @@ -494,7 +642,9 @@ typedef void * wctrans_t; _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name)); # endif _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (wctrans); +# endif #elif defined GNULIB_POSIXCHECK # undef wctrans # if HAVE_RAW_DECL_WCTRANS @@ -511,7 +661,9 @@ _GL_WARN_ON_USE (wctrans, "wctrans is unportable - " _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); # endif _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (towctrans); +# endif #elif defined GNULIB_POSIXCHECK # undef towctrans # if HAVE_RAW_DECL_TOWCTRANS diff --git a/gnulib/import/windows-initguard.h b/gnulib/import/windows-initguard.h new file mode 100644 index 0000000..8aefd0b --- /dev/null +++ b/gnulib/import/windows-initguard.h @@ -0,0 +1,35 @@ +/* Init guards, somewhat like spinlocks (native Windows implementation). + Copyright (C) 2005-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-win32.h. */ + +#ifndef _WINDOWS_INITGUARD_H +#define _WINDOWS_INITGUARD_H + +#define WIN32_LEAN_AND_MEAN /* avoid including junk */ +#include <windows.h> + +typedef struct + { + volatile int done; + volatile LONG started; + } + glwthread_initguard_t; + +#define GLWTHREAD_INITGUARD_INIT { 0, -1 } + +#endif /* _WINDOWS_INITGUARD_H */ diff --git a/gnulib/import/windows-mutex.c b/gnulib/import/windows-mutex.c new file mode 100644 index 0000000..9433881 --- /dev/null +++ b/gnulib/import/windows-mutex.c @@ -0,0 +1,95 @@ +/* Plain mutexes (native Windows implementation). + Copyright (C) 2005-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-win32.h. */ + +#include <config.h> + +/* Specification. */ +#include "windows-mutex.h" + +#include <errno.h> + +void +glwthread_mutex_init (glwthread_mutex_t *mutex) +{ + InitializeCriticalSection (&mutex->lock); + mutex->guard.done = 1; +} + +int +glwthread_mutex_lock (glwthread_mutex_t *mutex) +{ + if (!mutex->guard.done) + { + if (InterlockedIncrement (&mutex->guard.started) == 0) + /* This thread is the first one to need this mutex. Initialize it. */ + glwthread_mutex_init (mutex); + else + { + /* Don't let mutex->guard.started grow and wrap around. */ + InterlockedDecrement (&mutex->guard.started); + /* Yield the CPU while waiting for another thread to finish + initializing this mutex. */ + while (!mutex->guard.done) + Sleep (0); + } + } + EnterCriticalSection (&mutex->lock); + return 0; +} + +int +glwthread_mutex_trylock (glwthread_mutex_t *mutex) +{ + if (!mutex->guard.done) + { + if (InterlockedIncrement (&mutex->guard.started) == 0) + /* This thread is the first one to need this mutex. Initialize it. */ + glwthread_mutex_init (mutex); + else + { + /* Don't let mutex->guard.started grow and wrap around. */ + InterlockedDecrement (&mutex->guard.started); + /* Let another thread finish initializing this mutex, and let it also + lock this mutex. */ + return EBUSY; + } + } + if (!TryEnterCriticalSection (&mutex->lock)) + return EBUSY; + return 0; +} + +int +glwthread_mutex_unlock (glwthread_mutex_t *mutex) +{ + if (!mutex->guard.done) + return EINVAL; + LeaveCriticalSection (&mutex->lock); + return 0; +} + +int +glwthread_mutex_destroy (glwthread_mutex_t *mutex) +{ + if (!mutex->guard.done) + return EINVAL; + DeleteCriticalSection (&mutex->lock); + mutex->guard.done = 0; + return 0; +} diff --git a/gnulib/import/windows-mutex.h b/gnulib/import/windows-mutex.h new file mode 100644 index 0000000..5364f92 --- /dev/null +++ b/gnulib/import/windows-mutex.h @@ -0,0 +1,51 @@ +/* Plain mutexes (native Windows implementation). + Copyright (C) 2005-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-win32.h. */ + +#ifndef _WINDOWS_MUTEX_H +#define _WINDOWS_MUTEX_H + +#define WIN32_LEAN_AND_MEAN /* avoid including junk */ +#include <windows.h> + +#include "windows-initguard.h" + +typedef struct + { + glwthread_initguard_t guard; /* protects the initialization */ + CRITICAL_SECTION lock; + } + glwthread_mutex_t; + +#define GLWTHREAD_MUTEX_INIT { GLWTHREAD_INITGUARD_INIT } + +#ifdef __cplusplus +extern "C" { +#endif + +extern void glwthread_mutex_init (glwthread_mutex_t *mutex); +extern int glwthread_mutex_lock (glwthread_mutex_t *mutex); +extern int glwthread_mutex_trylock (glwthread_mutex_t *mutex); +extern int glwthread_mutex_unlock (glwthread_mutex_t *mutex); +extern int glwthread_mutex_destroy (glwthread_mutex_t *mutex); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINDOWS_MUTEX_H */ diff --git a/gnulib/import/windows-once.c b/gnulib/import/windows-once.c new file mode 100644 index 0000000..455c50e --- /dev/null +++ b/gnulib/import/windows-once.c @@ -0,0 +1,62 @@ +/* Once-only control (native Windows implementation). + Copyright (C) 2005-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-win32.h. */ + +#include <config.h> + +/* Specification. */ +#include "windows-once.h" + +#include <stdlib.h> + +void +glwthread_once (glwthread_once_t *once_control, void (*initfunction) (void)) +{ + if (once_control->inited <= 0) + { + if (InterlockedIncrement (&once_control->started) == 0) + { + /* This thread is the first one to come to this once_control. */ + InitializeCriticalSection (&once_control->lock); + EnterCriticalSection (&once_control->lock); + once_control->inited = 0; + initfunction (); + once_control->inited = 1; + LeaveCriticalSection (&once_control->lock); + } + else + { + /* Don't let once_control->started grow and wrap around. */ + InterlockedDecrement (&once_control->started); + /* Some other thread has already started the initialization. + Yield the CPU while waiting for the other thread to finish + initializing and taking the lock. */ + while (once_control->inited < 0) + Sleep (0); + if (once_control->inited <= 0) + { + /* Take the lock. This blocks until the other thread has + finished calling the initfunction. */ + EnterCriticalSection (&once_control->lock); + LeaveCriticalSection (&once_control->lock); + if (!(once_control->inited > 0)) + abort (); + } + } + } +} diff --git a/gnulib/import/windows-once.h b/gnulib/import/windows-once.h new file mode 100644 index 0000000..1599983 --- /dev/null +++ b/gnulib/import/windows-once.h @@ -0,0 +1,47 @@ +/* Once-only control (native Windows implementation). + Copyright (C) 2005-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-win32.h. */ + +#ifndef _WINDOWS_ONCE_H +#define _WINDOWS_ONCE_H + +#define WIN32_LEAN_AND_MEAN /* avoid including junk */ +#include <windows.h> + +typedef struct + { + volatile int inited; + volatile LONG started; + CRITICAL_SECTION lock; + } + glwthread_once_t; + +#define GLWTHREAD_ONCE_INIT { -1, -1 } + +#ifdef __cplusplus +extern "C" { +#endif + +extern void glwthread_once (glwthread_once_t *once_control, + void (*initfunction) (void)); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINDOWS_ONCE_H */ diff --git a/gnulib/import/windows-recmutex.c b/gnulib/import/windows-recmutex.c new file mode 100644 index 0000000..7e6e446 --- /dev/null +++ b/gnulib/import/windows-recmutex.c @@ -0,0 +1,127 @@ +/* Plain recursive mutexes (native Windows implementation). + Copyright (C) 2005-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-win32.h. */ + +#include <config.h> + +/* Specification. */ +#include "windows-recmutex.h" + +#include <errno.h> + +void +glwthread_recmutex_init (glwthread_recmutex_t *mutex) +{ + mutex->owner = 0; + mutex->depth = 0; + InitializeCriticalSection (&mutex->lock); + mutex->guard.done = 1; +} + +int +glwthread_recmutex_lock (glwthread_recmutex_t *mutex) +{ + if (!mutex->guard.done) + { + if (InterlockedIncrement (&mutex->guard.started) == 0) + /* This thread is the first one to need this mutex. Initialize it. */ + glwthread_recmutex_init (mutex); + else + { + /* Don't let mutex->guard.started grow and wrap around. */ + InterlockedDecrement (&mutex->guard.started); + /* Yield the CPU while waiting for another thread to finish + initializing this mutex. */ + while (!mutex->guard.done) + Sleep (0); + } + } + { + DWORD self = GetCurrentThreadId (); + if (mutex->owner != self) + { + EnterCriticalSection (&mutex->lock); + mutex->owner = self; + } + if (++(mutex->depth) == 0) /* wraparound? */ + { + mutex->depth--; + return EAGAIN; + } + } + return 0; +} + +int +glwthread_recmutex_trylock (glwthread_recmutex_t *mutex) +{ + if (!mutex->guard.done) + { + if (InterlockedIncrement (&mutex->guard.started) == 0) + /* This thread is the first one to need this mutex. Initialize it. */ + glwthread_recmutex_init (mutex); + else + { + /* Don't let mutex->guard.started grow and wrap around. */ + InterlockedDecrement (&mutex->guard.started); + /* Let another thread finish initializing this mutex, and let it also + lock this mutex. */ + return EBUSY; + } + } + { + DWORD self = GetCurrentThreadId (); + if (mutex->owner != self) + { + if (!TryEnterCriticalSection (&mutex->lock)) + return EBUSY; + mutex->owner = self; + } + if (++(mutex->depth) == 0) /* wraparound? */ + { + mutex->depth--; + return EAGAIN; + } + } + return 0; +} + +int +glwthread_recmutex_unlock (glwthread_recmutex_t *mutex) +{ + if (mutex->owner != GetCurrentThreadId ()) + return EPERM; + if (mutex->depth == 0) + return EINVAL; + if (--(mutex->depth) == 0) + { + mutex->owner = 0; + LeaveCriticalSection (&mutex->lock); + } + return 0; +} + +int +glwthread_recmutex_destroy (glwthread_recmutex_t *mutex) +{ + if (mutex->owner != 0) + return EBUSY; + DeleteCriticalSection (&mutex->lock); + mutex->guard.done = 0; + return 0; +} diff --git a/gnulib/import/windows-recmutex.h b/gnulib/import/windows-recmutex.h new file mode 100644 index 0000000..d143108 --- /dev/null +++ b/gnulib/import/windows-recmutex.h @@ -0,0 +1,57 @@ +/* Plain recursive mutexes (native Windows implementation). + Copyright (C) 2005-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-win32.h. */ + +#ifndef _WINDOWS_RECMUTEX_H +#define _WINDOWS_RECMUTEX_H + +#define WIN32_LEAN_AND_MEAN /* avoid including junk */ +#include <windows.h> + +#include "windows-initguard.h" + +/* The native Windows documentation says that CRITICAL_SECTION already + implements a recursive lock. But we need not rely on it: It's easy to + implement a recursive lock without this assumption. */ + +typedef struct + { + glwthread_initguard_t guard; /* protects the initialization */ + DWORD owner; + unsigned long depth; + CRITICAL_SECTION lock; + } + glwthread_recmutex_t; + +#define GLWTHREAD_RECMUTEX_INIT { GLWTHREAD_INITGUARD_INIT, 0, 0 } + +#ifdef __cplusplus +extern "C" { +#endif + +extern void glwthread_recmutex_init (glwthread_recmutex_t *mutex); +extern int glwthread_recmutex_lock (glwthread_recmutex_t *mutex); +extern int glwthread_recmutex_trylock (glwthread_recmutex_t *mutex); +extern int glwthread_recmutex_unlock (glwthread_recmutex_t *mutex); +extern int glwthread_recmutex_destroy (glwthread_recmutex_t *mutex); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINDOWS_RECMUTEX_H */ diff --git a/gnulib/import/windows-rwlock.c b/gnulib/import/windows-rwlock.c new file mode 100644 index 0000000..9207d1b --- /dev/null +++ b/gnulib/import/windows-rwlock.c @@ -0,0 +1,373 @@ +/* Read-write locks (native Windows implementation). + Copyright (C) 2005-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-win32.h. */ + +#include <config.h> + +/* Specification. */ +#include "windows-rwlock.h" + +#include <errno.h> +#include <stdlib.h> + +/* In this file, the waitqueues are implemented as circular arrays. */ +#define glwthread_waitqueue_t glwthread_carray_waitqueue_t + +static void +glwthread_waitqueue_init (glwthread_waitqueue_t *wq) +{ + wq->array = NULL; + wq->count = 0; + wq->alloc = 0; + wq->offset = 0; +} + +/* Enqueues the current thread, represented by an event, in a wait queue. + Returns INVALID_HANDLE_VALUE if an allocation failure occurs. */ +static HANDLE +glwthread_waitqueue_add (glwthread_waitqueue_t *wq) +{ + HANDLE event; + unsigned int index; + + if (wq->count == wq->alloc) + { + unsigned int new_alloc = 2 * wq->alloc + 1; + HANDLE *new_array = + (HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE)); + if (new_array == NULL) + /* No more memory. */ + return INVALID_HANDLE_VALUE; + /* Now is a good opportunity to rotate the array so that its contents + starts at offset 0. */ + if (wq->offset > 0) + { + unsigned int old_count = wq->count; + unsigned int old_alloc = wq->alloc; + unsigned int old_offset = wq->offset; + unsigned int i; + if (old_offset + old_count > old_alloc) + { + unsigned int limit = old_offset + old_count - old_alloc; + for (i = 0; i < limit; i++) + new_array[old_alloc + i] = new_array[i]; + } + for (i = 0; i < old_count; i++) + new_array[i] = new_array[old_offset + i]; + wq->offset = 0; + } + wq->array = new_array; + wq->alloc = new_alloc; + } + /* Whether the created event is a manual-reset one or an auto-reset one, + does not matter, since we will wait on it only once. */ + event = CreateEvent (NULL, TRUE, FALSE, NULL); + if (event == INVALID_HANDLE_VALUE) + /* No way to allocate an event. */ + return INVALID_HANDLE_VALUE; + index = wq->offset + wq->count; + if (index >= wq->alloc) + index -= wq->alloc; + wq->array[index] = event; + wq->count++; + return event; +} + +/* Notifies the first thread from a wait queue and dequeues it. */ +static void +glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq) +{ + SetEvent (wq->array[wq->offset + 0]); + wq->offset++; + wq->count--; + if (wq->count == 0 || wq->offset == wq->alloc) + wq->offset = 0; +} + +/* Notifies all threads from a wait queue and dequeues them all. */ +static void +glwthread_waitqueue_notify_all (glwthread_waitqueue_t *wq) +{ + unsigned int i; + + for (i = 0; i < wq->count; i++) + { + unsigned int index = wq->offset + i; + if (index >= wq->alloc) + index -= wq->alloc; + SetEvent (wq->array[index]); + } + wq->count = 0; + wq->offset = 0; +} + +void +glwthread_rwlock_init (glwthread_rwlock_t *lock) +{ + InitializeCriticalSection (&lock->lock); + glwthread_waitqueue_init (&lock->waiting_readers); + glwthread_waitqueue_init (&lock->waiting_writers); + lock->runcount = 0; + lock->guard.done = 1; +} + +int +glwthread_rwlock_rdlock (glwthread_rwlock_t *lock) +{ + if (!lock->guard.done) + { + if (InterlockedIncrement (&lock->guard.started) == 0) + /* This thread is the first one to need this lock. Initialize it. */ + glwthread_rwlock_init (lock); + else + { + /* Don't let lock->guard.started grow and wrap around. */ + InterlockedDecrement (&lock->guard.started); + /* Yield the CPU while waiting for another thread to finish + initializing this lock. */ + while (!lock->guard.done) + Sleep (0); + } + } + EnterCriticalSection (&lock->lock); + /* Test whether only readers are currently running, and whether the runcount + field will not overflow, and whether no writer is waiting. The latter + condition is because POSIX recommends that "write locks shall take + precedence over read locks", to avoid "writer starvation". */ + if (!(lock->runcount + 1 > 0 && lock->waiting_writers.count == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_readers. */ + HANDLE event = glwthread_waitqueue_add (&lock->waiting_readers); + if (event != INVALID_HANDLE_VALUE) + { + DWORD result; + LeaveCriticalSection (&lock->lock); + /* Wait until another thread signals this event. */ + result = WaitForSingleObject (event, INFINITE); + if (result == WAIT_FAILED || result == WAIT_TIMEOUT) + abort (); + CloseHandle (event); + /* The thread which signalled the event already did the bookkeeping: + removed us from the waiting_readers, incremented lock->runcount. */ + if (!(lock->runcount > 0)) + abort (); + return 0; + } + else + { + /* Allocation failure. Weird. */ + do + { + LeaveCriticalSection (&lock->lock); + Sleep (1); + EnterCriticalSection (&lock->lock); + } + while (!(lock->runcount + 1 > 0)); + } + } + lock->runcount++; + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glwthread_rwlock_wrlock (glwthread_rwlock_t *lock) +{ + if (!lock->guard.done) + { + if (InterlockedIncrement (&lock->guard.started) == 0) + /* This thread is the first one to need this lock. Initialize it. */ + glwthread_rwlock_init (lock); + else + { + /* Don't let lock->guard.started grow and wrap around. */ + InterlockedDecrement (&lock->guard.started); + /* Yield the CPU while waiting for another thread to finish + initializing this lock. */ + while (!lock->guard.done) + Sleep (0); + } + } + EnterCriticalSection (&lock->lock); + /* Test whether no readers or writers are currently running. */ + if (!(lock->runcount == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_writers. */ + HANDLE event = glwthread_waitqueue_add (&lock->waiting_writers); + if (event != INVALID_HANDLE_VALUE) + { + DWORD result; + LeaveCriticalSection (&lock->lock); + /* Wait until another thread signals this event. */ + result = WaitForSingleObject (event, INFINITE); + if (result == WAIT_FAILED || result == WAIT_TIMEOUT) + abort (); + CloseHandle (event); + /* The thread which signalled the event already did the bookkeeping: + removed us from the waiting_writers, set lock->runcount = -1. */ + if (!(lock->runcount == -1)) + abort (); + return 0; + } + else + { + /* Allocation failure. Weird. */ + do + { + LeaveCriticalSection (&lock->lock); + Sleep (1); + EnterCriticalSection (&lock->lock); + } + while (!(lock->runcount == 0)); + } + } + lock->runcount--; /* runcount becomes -1 */ + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glwthread_rwlock_tryrdlock (glwthread_rwlock_t *lock) +{ + if (!lock->guard.done) + { + if (InterlockedIncrement (&lock->guard.started) == 0) + /* This thread is the first one to need this lock. Initialize it. */ + glwthread_rwlock_init (lock); + else + { + /* Don't let lock->guard.started grow and wrap around. */ + InterlockedDecrement (&lock->guard.started); + /* Yield the CPU while waiting for another thread to finish + initializing this lock. */ + while (!lock->guard.done) + Sleep (0); + } + } + /* It's OK to wait for this critical section, because it is never taken for a + long time. */ + EnterCriticalSection (&lock->lock); + /* Test whether only readers are currently running, and whether the runcount + field will not overflow, and whether no writer is waiting. The latter + condition is because POSIX recommends that "write locks shall take + precedence over read locks", to avoid "writer starvation". */ + if (!(lock->runcount + 1 > 0 && lock->waiting_writers.count == 0)) + { + /* This thread would have to wait for a while. Return instead. */ + LeaveCriticalSection (&lock->lock); + return EBUSY; + } + lock->runcount++; + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glwthread_rwlock_trywrlock (glwthread_rwlock_t *lock) +{ + if (!lock->guard.done) + { + if (InterlockedIncrement (&lock->guard.started) == 0) + /* This thread is the first one to need this lock. Initialize it. */ + glwthread_rwlock_init (lock); + else + { + /* Don't let lock->guard.started grow and wrap around. */ + InterlockedDecrement (&lock->guard.started); + /* Yield the CPU while waiting for another thread to finish + initializing this lock. */ + while (!lock->guard.done) + Sleep (0); + } + } + /* It's OK to wait for this critical section, because it is never taken for a + long time. */ + EnterCriticalSection (&lock->lock); + /* Test whether no readers or writers are currently running. */ + if (!(lock->runcount == 0)) + { + /* This thread would have to wait for a while. Return instead. */ + LeaveCriticalSection (&lock->lock); + return EBUSY; + } + lock->runcount--; /* runcount becomes -1 */ + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glwthread_rwlock_unlock (glwthread_rwlock_t *lock) +{ + if (!lock->guard.done) + return EINVAL; + EnterCriticalSection (&lock->lock); + if (lock->runcount < 0) + { + /* Drop a writer lock. */ + if (!(lock->runcount == -1)) + abort (); + lock->runcount = 0; + } + else + { + /* Drop a reader lock. */ + if (!(lock->runcount > 0)) + { + LeaveCriticalSection (&lock->lock); + return EPERM; + } + lock->runcount--; + } + if (lock->runcount == 0) + { + /* POSIX recommends that "write locks shall take precedence over read + locks", to avoid "writer starvation". */ + if (lock->waiting_writers.count > 0) + { + /* Wake up one of the waiting writers. */ + lock->runcount--; + glwthread_waitqueue_notify_first (&lock->waiting_writers); + } + else + { + /* Wake up all waiting readers. */ + lock->runcount += lock->waiting_readers.count; + glwthread_waitqueue_notify_all (&lock->waiting_readers); + } + } + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glwthread_rwlock_destroy (glwthread_rwlock_t *lock) +{ + if (!lock->guard.done) + return EINVAL; + if (lock->runcount != 0) + return EBUSY; + DeleteCriticalSection (&lock->lock); + if (lock->waiting_readers.array != NULL) + free (lock->waiting_readers.array); + if (lock->waiting_writers.array != NULL) + free (lock->waiting_writers.array); + lock->guard.done = 0; + return 0; +} diff --git a/gnulib/import/windows-rwlock.h b/gnulib/import/windows-rwlock.h new file mode 100644 index 0000000..9002040 --- /dev/null +++ b/gnulib/import/windows-rwlock.h @@ -0,0 +1,68 @@ +/* Read-write locks (native Windows implementation). + Copyright (C) 2005-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-win32.h. */ + +#ifndef _WINDOWS_RWLOCK_H +#define _WINDOWS_RWLOCK_H + +#define WIN32_LEAN_AND_MEAN /* avoid including junk */ +#include <windows.h> + +#include "windows-initguard.h" + +/* It is impossible to implement read-write locks using plain locks, without + introducing an extra thread dedicated to managing read-write locks. + Therefore here we need to use the low-level Event type. */ + +typedef struct + { + HANDLE *array; /* array of waiting threads, each represented by an event */ + unsigned int count; /* number of waiting threads */ + unsigned int alloc; /* length of allocated array */ + unsigned int offset; /* index of first waiting thread in array */ + } + glwthread_carray_waitqueue_t; +typedef struct + { + glwthread_initguard_t guard; /* protects the initialization */ + CRITICAL_SECTION lock; /* protects the remaining fields */ + glwthread_carray_waitqueue_t waiting_readers; /* waiting readers */ + glwthread_carray_waitqueue_t waiting_writers; /* waiting writers */ + int runcount; /* number of readers running, or -1 when a writer runs */ + } + glwthread_rwlock_t; + +#define GLWTHREAD_RWLOCK_INIT { GLWTHREAD_INITGUARD_INIT } + +#ifdef __cplusplus +extern "C" { +#endif + +extern void glwthread_rwlock_init (glwthread_rwlock_t *lock); +extern int glwthread_rwlock_rdlock (glwthread_rwlock_t *lock); +extern int glwthread_rwlock_wrlock (glwthread_rwlock_t *lock); +extern int glwthread_rwlock_tryrdlock (glwthread_rwlock_t *lock); +extern int glwthread_rwlock_trywrlock (glwthread_rwlock_t *lock); +extern int glwthread_rwlock_unlock (glwthread_rwlock_t *lock); +extern int glwthread_rwlock_destroy (glwthread_rwlock_t *lock); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINDOWS_RWLOCK_H */ diff --git a/gnulib/import/xalloc-oversized.h b/gnulib/import/xalloc-oversized.h new file mode 100644 index 0000000..e3068c8 --- /dev/null +++ b/gnulib/import/xalloc-oversized.h @@ -0,0 +1,60 @@ +/* xalloc-oversized.h -- memory allocation size checking + + Copyright (C) 1990-2000, 2003-2004, 2006-2019 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +#ifndef XALLOC_OVERSIZED_H_ +#define XALLOC_OVERSIZED_H_ + +#include <stddef.h> +#include <stdint.h> + +/* True if N * S would overflow in a size_t calculation, + or would generate a value larger than PTRDIFF_MAX. + This expands to a constant expression if N and S are both constants. + By gnulib convention, SIZE_MAX represents overflow in size + calculations, so the conservative size_t-based dividend to use here + is SIZE_MAX - 1. */ +#define __xalloc_oversized(n, s) \ + ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n)) + +#if PTRDIFF_MAX < SIZE_MAX +typedef ptrdiff_t __xalloc_count_type; +#else +typedef size_t __xalloc_count_type; +#endif + +/* Return 1 if an array of N objects, each of size S, cannot exist + reliably due to size or ptrdiff_t arithmetic overflow. S must be + positive and N must be nonnegative. This is a macro, not a + function, so that it works correctly even when SIZE_MAX < N. */ + +#if 7 <= __GNUC__ +# define xalloc_oversized(n, s) \ + __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) +#elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ +# define xalloc_oversized(n, s) \ + (__builtin_constant_p (n) && __builtin_constant_p (s) \ + ? __xalloc_oversized (n, s) \ + : ({ __xalloc_count_type __xalloc_count; \ + __builtin_mul_overflow (n, s, &__xalloc_count); })) + +/* Other compilers use integer division; this may be slower but is + more portable. */ +#else +# define xalloc_oversized(n, s) __xalloc_oversized (n, s) +#endif + +#endif /* !XALLOC_OVERSIZED_H_ */ diff --git a/gnulib/patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch b/gnulib/patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch deleted file mode 100644 index 1d8cdf6..0000000 --- a/gnulib/patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch +++ /dev/null @@ -1,69 +0,0 @@ -From a7447215cdc492a077732420a3f0db6d48b34d51 Mon Sep 17 00:00:00 2001 -From: Sergio Durigan Junior <sergiodj@redhat.com> -Date: Mon, 10 Sep 2018 12:52:04 -0400 -Subject: [PATCH] Fix PR gdb/23558: Use system's 'getcwd' when cross-compiling - GDB - -This is a backport of a gnulib fix for the following bug: - - https://sourceware.org/bugzilla/show_bug.cgi?id=23558 - -The problem reported there is about the replacement of 'getcwd' when -cross-compiling GDB. With our current gnulib copy, the mechanism for -deciding whether to use the system's 'getcwd' or gnulib's version is -too simplistic and pessimistic, so when cross-compiling we always end -up using gnulib's version, which has a limitation: it cannot handle -the situation when the parent directory doesn't have read permissions. - -The solution is to backport the following gnulib commit: - - commit a96d2e67052c879b1bcc5bc461722beac75fc372 - Author: Bruno Haible <bruno@clisp.org> - Date: Thu Aug 23 21:13:19 2018 +0200 - - getcwd: Add cross-compilation guesses. - -gdb/ChangeLog: -2018-09-10 Sergio Durigan Junior <sergiodj@redhat.com> - - PR gdb/23555 - PR gdb/23558 - * gnulib/import/m4/getcwd-path-max.m4: Add cross-compilation - guesses. ---- - gdb/gnulib/import/m4/getcwd-path-max.m4 | 20 ++++++++++++++++---- - 1 file changed, 16 insertions(+), 4 deletions(-) - -diff --git a/gdb/gnulib/import/m4/getcwd-path-max.m4 b/gdb/gnulib/import/m4/getcwd-path-max.m4 -index 2531ccff65c..90bbc77dea1 100644 ---- a/gdb/gnulib/import/m4/getcwd-path-max.m4 -+++ b/gdb/gnulib/import/m4/getcwd-path-max.m4 -@@ -209,9 +209,21 @@ main () - 32) gl_cv_func_getcwd_path_max='yes, but with shorter paths';; - *) gl_cv_func_getcwd_path_max=no;; - esac], -- [case "$host_os" in -- aix*) gl_cv_func_getcwd_path_max='no, it has the AIX bug';; -- *) gl_cv_func_getcwd_path_max=no;; -- esac]) -+ [# Cross-compilation guesses: -+ case "$host_os" in -+ aix*) # On AIX, it has the AIX bug. -+ gl_cv_func_getcwd_path_max='no, it has the AIX bug' ;; -+ gnu*) # On Hurd, it is 'yes'. -+ gl_cv_func_getcwd_path_max=yes ;; -+ linux* | kfreebsd*) -+ # On older Linux+glibc it's 'no, but it is partly working', -+ # on newer Linux+glibc it's 'yes'. -+ # On Linux+musl libc, it's 'no, but it is partly working'. -+ # On kFreeBSD+glibc, it's 'no, but it is partly working'. -+ gl_cv_func_getcwd_path_max='no, but it is partly working' ;; -+ *) # If we don't know, assume the worst. -+ gl_cv_func_getcwd_path_max=no ;; -+ esac -+ ]) - ]) - ]) --- -2.19.0 - diff --git a/gnulib/patches/0002-mkostemp-mkostemps-Fix-compilation-error-in-C-mode-o.patch b/gnulib/patches/0002-mkostemp-mkostemps-Fix-compilation-error-in-C-mode-o.patch deleted file mode 100644 index 35f917f..0000000 --- a/gnulib/patches/0002-mkostemp-mkostemps-Fix-compilation-error-in-C-mode-o.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 6954995dd32ea98a1973df31f411f3996bb47dfb Mon Sep 17 00:00:00 2001 -From: Tom Tromey <tom@tromey.com> -Date: Mon, 1 Oct 2018 14:57:45 -0600 -Subject: [PATCH] mkostemp, mkostemps: Fix compilation error in C++ mode on Mac - OS X. - -Attempting to use the mkostemp module in gdb caused a build failure -when using the C++ namespace feature, because mkostemp was not -declared. On OS X, mkostemp is declared in unistd.h, so this patch -extends the existing special case in stdlib.in.h to cover mkostemp and -mkostemps. - -* lib/stdlib.in.h: Include <unistd.h> for mkostemp and mkostemps -on OS X. ---- - ChangeLog | 6 ++++++ - lib/stdlib.in.h | 3 ++- - 2 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/gdb/gnulib/import/stdlib.in.h b/gdb/gnulib/import/stdlib.in.h -index db3253bd97..8f803a2ea3 100644 ---- a/gdb/gnulib/import/stdlib.in.h -+++ b/gdb/gnulib/import/stdlib.in.h -@@ -87,9 +87,10 @@ 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_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || 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 Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */ - /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */ - /* But avoid namespace pollution on glibc systems and native Windows. */ - # include <unistd.h> --- -2.19.0 - diff --git a/gnulib/patches/0003-Fix-glob-c-Coverity-issues.patch b/gnulib/patches/0003-Fix-glob-c-Coverity-issues.patch deleted file mode 100644 index f976bb9..0000000 --- a/gnulib/patches/0003-Fix-glob-c-Coverity-issues.patch +++ /dev/null @@ -1,279 +0,0 @@ -Coverity discovered a number of resource leaks in Gnulib. -The solution is to backport the following Gnulib commits: - - commit 0eee3ccaae5bb3d0016a0da8b8e5108767c02748 - Author: Bruno Haible <bruno@clisp.org> - Date: Fri Mar 31 22:41:38 2017 +0200 - - glob: Fix memory leaks. - - * lib/glob.c (glob): Free allocated memory before returning. - Reported by Coverity via Tim Rühsen. - - commit b1d7f3165ba1c7a44a29017eb80491094aa240ba - Author: Bruno Haible <bruno@clisp.org> - Date: Fri Mar 31 22:43:35 2017 +0200 - - glob: Fix invalid free() call. - - * lib/glob.c (glob): Reset malloc_home_dir when assigning a pointer to - static storage to home_dir. - Reported by Coverity via Tim Rühsen. - - commit 1540f3441555f756558f3a18e5f68914c0b72227 - Author: Bruno Haible <bruno@clisp.org> - Date: Sat Apr 1 15:15:18 2017 +0200 - - glob: Fix more memory leaks. - - * lib/glob.c (glob): Free allocated memory before returning. - Reported by Coverity via Tim Rühsen. - - commit b19cb256c9a4d3a138c27181cffee5513edb0e81 - Author: Bruno Haible <bruno@clisp.org> - Date: Thu Jul 6 23:21:49 2017 +0200 - - glob: Fix more memory leaks. - - * lib/glob.c (glob): Free dirname before returning. - Reported by Coverity and Tim Rühsen. - - commit 8cb994d1fc4a957359780e1a4187b4f250c1cea5 - Author: Tim Rühsen <tim.ruehsen@gmx.de> - Date: Mon Jul 10 19:02:19 2017 +0200 - - glob: Fix more memory leaks. - - * lib/glob.c (glob): Use 'goto out' in order to free dirname before - returning. - Reported by Tim Rühsen. - -diff --git a/gnulib/import/glob.c b/gnulib/import/glob.c -index 4b04b90..416d210 100644 ---- a/gdb/gnulib/import/glob.c -+++ b/gdb/gnulib/import/glob.c -@@ -734,6 +734,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - pwtmpbuf = malloc (pwbuflen); - if (pwtmpbuf == NULL) - { -+ if (__glibc_unlikely (malloc_name)) -+ free (name); - retval = GLOB_NOSPACE; - goto out; - } -@@ -762,6 +764,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - if (newp == NULL) - { - free (malloc_pwtmpbuf); -+ if (__glibc_unlikely (malloc_name)) -+ free (name); - retval = GLOB_NOSPACE; - goto out; - } -@@ -797,23 +801,30 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - malloc_home_dir = 1; - } - memcpy (home_dir, p->pw_dir, home_dir_len); -- -- free (pwtmpbuf); - } - } -+ free (malloc_pwtmpbuf); -+ } -+ else -+ { -+ if (__glibc_unlikely (malloc_name)) -+ free (name); - } - } - if (home_dir == NULL || home_dir[0] == '\0') - { -+ if (__glibc_unlikely (malloc_home_dir)) -+ free (home_dir); - if (flags & GLOB_TILDE_CHECK) - { -- if (__glibc_unlikely (malloc_home_dir)) -- free (home_dir); - retval = GLOB_NOMATCH; - goto out; - } - else -- home_dir = (char *) "~"; /* No luck. */ -+ { -+ home_dir = (char *) "~"; /* No luck. */ -+ malloc_home_dir = 0; -+ } - } - # endif /* WINDOWS32 */ - # endif -@@ -855,6 +866,9 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - dirname = newp; - dirlen += home_len - 1; - malloc_dirname = !use_alloca; -+ -+ if (__glibc_unlikely (malloc_home_dir)) -+ free (home_dir); - } - dirname_modified = 1; - } -@@ -1027,9 +1041,12 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - free (malloc_pwtmpbuf); - - if (flags & GLOB_TILDE_CHECK) -- /* We have to regard it as an error if we cannot find the -- home directory. */ -- return GLOB_NOMATCH; -+ { -+ /* We have to regard it as an error if we cannot find the -+ home directory. */ -+ retval = GLOB_NOMATCH; -+ goto out; -+ } - } - } - } -@@ -1059,7 +1076,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - free (pglob->gl_pathv); - pglob->gl_pathv = NULL; - pglob->gl_pathc = 0; -- return GLOB_NOSPACE; -+ retval = GLOB_NOSPACE; -+ goto out; - } - - new_gl_pathv = realloc (pglob->gl_pathv, -@@ -1077,12 +1095,19 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - p = mempcpy (pglob->gl_pathv[newcount], dirname, dirlen); - p[0] = '/'; - p[1] = '\0'; -+ if (__glibc_unlikely (malloc_dirname)) -+ free (dirname); - } - else - { -- pglob->gl_pathv[newcount] = strdup (dirname); -- if (pglob->gl_pathv[newcount] == NULL) -- goto nospace; -+ if (__glibc_unlikely (malloc_dirname)) -+ pglob->gl_pathv[newcount] = dirname; -+ else -+ { -+ pglob->gl_pathv[newcount] = strdup (dirname); -+ if (pglob->gl_pathv[newcount] == NULL) -+ goto nospace; -+ } - } - pglob->gl_pathv[++newcount] = NULL; - ++pglob->gl_pathc; -@@ -1092,7 +1117,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - } - - /* Not found. */ -- return GLOB_NOMATCH; -+ retval = GLOB_NOMATCH; -+ goto out; - } - - meta = __glob_pattern_type (dirname, !(flags & GLOB_NOESCAPE)); -@@ -1138,7 +1164,10 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - if (status != 0) - { - if ((flags & GLOB_NOCHECK) == 0 || status != GLOB_NOMATCH) -- return status; -+ { -+ retval = status; -+ goto out; -+ } - goto no_matches; - } - -@@ -1157,7 +1186,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - if (interrupt_state) - { - globfree (&dirs); -- return GLOB_ABORTED; -+ retval = GLOB_ABORTED; -+ goto out; - } - } - #endif /* SHELL. */ -@@ -1176,7 +1206,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - globfree (&dirs); - globfree (pglob); - pglob->gl_pathc = 0; -- return status; -+ retval = status; -+ goto out; - } - - /* Stick the directory on the front of each name. */ -@@ -1187,7 +1218,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - globfree (&dirs); - globfree (pglob); - pglob->gl_pathc = 0; -- return GLOB_NOSPACE; -+ retval = GLOB_NOSPACE; -+ goto out; - } - } - -@@ -1209,7 +1241,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - { - nospace2: - globfree (&dirs); -- return GLOB_NOSPACE; -+ retval = GLOB_NOSPACE; -+ goto out; - } - - new_gl_pathv = realloc (pglob->gl_pathv, -@@ -1224,7 +1257,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - globfree (&dirs); - globfree (pglob); - pglob->gl_pathc = 0; -- return GLOB_NOSPACE; -+ retval = GLOB_NOSPACE; -+ goto out; - } - - ++pglob->gl_pathc; -@@ -1236,7 +1270,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - else - { - globfree (&dirs); -- return GLOB_NOMATCH; -+ retval = GLOB_NOMATCH; -+ goto out; - } - } - -@@ -1282,7 +1317,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - flags = orig_flags; - goto no_matches; - } -- return status; -+ retval = status; -+ goto out; - } - - if (dirlen > 0) -@@ -1294,7 +1330,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - { - globfree (pglob); - pglob->gl_pathc = 0; -- return GLOB_NOSPACE; -+ retval = GLOB_NOSPACE; -+ goto out; - } - } - } -@@ -1319,7 +1356,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - { - globfree (pglob); - pglob->gl_pathc = 0; -- return GLOB_NOSPACE; -+ retval = GLOB_NOSPACE; -+ goto out; - } - strcpy (&new[len - 2], "/"); - pglob->gl_pathv[i] = new; diff --git a/gnulib/update-gnulib.sh b/gnulib/update-gnulib.sh index f8d68fc..602a21d 100755 --- a/gnulib/update-gnulib.sh +++ b/gnulib/update-gnulib.sh @@ -68,7 +68,7 @@ IMPORTED_GNULIB_MODULES="\ " # The gnulib commit ID to use for the update. -GNULIB_COMMIT_SHA1="38237baf99386101934cd93278023aa4ae523ec0" +GNULIB_COMMIT_SHA1="6be2862414da45975b8cbc33acc5387b012f3354" # The expected version number for the various auto tools we will # use after the import. @@ -164,17 +164,13 @@ fi # Apply our local patches. apply_patches () { - patch -p3 -f -i "$1" + patch -p2 -f -i "$1" if [ $? -ne 0 ]; then echo "Failed to apply some patches. Aborting." exit 1 fi } -apply_patches "patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch" -apply_patches "patches/0002-mkostemp-mkostemps-Fix-compilation-error-in-C-mode-o.patch" -apply_patches "patches/0003-Fix-glob-c-Coverity-issues.patch" - # Regenerate all necessary files... aclocal && autoconf && |