Merge from gnulib
This incorporates: 2017-04-30 strftime-fixes: New module 2017-04-30 mktime: Work around TZ problem on native Windows 2017-04-30 ctime, localtime: New modules 2017-04-30 gettimeofday: Provide higher resolution on native Windows 2017-04-29 utime-h: Modernize handling of 'struct utimbuf' 2017-04-29 Make use of module 'utime-h' 2017-04-30 Fix a few typos * admin/merge-gnulib (AVOIDED_MODULES): Avoid utime-h, too. * lib/gettimeofday.c, lib/mktime.c, lib/time.in.h, lib/utimens.c: * m4/gettimeofday.m4, m4/include_next.m4, m4/mktime.m4: * m4/strftime.m4, m4/time_h.m4, m4/timegm.m4, m4/utimens.m4: Copy from gnulib. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
This commit is contained in:
parent
3ad9d5c347
commit
b6aa3446df
14 changed files with 206 additions and 71 deletions
|
@ -49,7 +49,7 @@ AVOIDED_MODULES='
|
|||
malloc-posix msvc-inval msvc-nothrow
|
||||
open openat-die opendir raise
|
||||
save-cwd select setenv sigprocmask stat stdarg stdbool
|
||||
threadlib unsetenv
|
||||
threadlib unsetenv utime-h
|
||||
'
|
||||
|
||||
GNULIB_TOOL_FLAGS='
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
|
||||
#include <time.h>
|
||||
|
||||
#if HAVE_SYS_TIMEB_H
|
||||
# include <sys/timeb.h>
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
# define WINDOWS_NATIVE
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME
|
||||
|
@ -92,6 +93,28 @@ rpl_tzset (void)
|
|||
tzset ();
|
||||
*localtime_buffer_addr = save;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS_NATIVE
|
||||
|
||||
/* GetSystemTimePreciseAsFileTime was introduced only in Windows 8. */
|
||||
typedef void (WINAPI * GetSystemTimePreciseAsFileTimeFuncType) (FILETIME *lpTime);
|
||||
static GetSystemTimePreciseAsFileTimeFuncType GetSystemTimePreciseAsFileTimeFunc = NULL;
|
||||
static BOOL initialized = FALSE;
|
||||
|
||||
static void
|
||||
initialize (void)
|
||||
{
|
||||
HMODULE kernel32 = LoadLibrary ("kernel32.dll");
|
||||
if (kernel32 != NULL)
|
||||
{
|
||||
GetSystemTimePreciseAsFileTimeFunc =
|
||||
(GetSystemTimePreciseAsFileTimeFuncType) GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime");
|
||||
}
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* This is a wrapper for gettimeofday. It is used only on systems
|
||||
|
@ -130,12 +153,35 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz)
|
|||
|
||||
#else
|
||||
|
||||
# if HAVE__FTIME
|
||||
# ifdef WINDOWS_NATIVE
|
||||
|
||||
struct _timeb timebuf;
|
||||
_ftime (&timebuf);
|
||||
tv->tv_sec = timebuf.time;
|
||||
tv->tv_usec = timebuf.millitm * 1000;
|
||||
/* On native Windows, there are two ways to get the current time:
|
||||
GetSystemTimeAsFileTime
|
||||
<https://msdn.microsoft.com/en-us/library/ms724397.aspx>
|
||||
or
|
||||
GetSystemTimePreciseAsFileTime
|
||||
<https://msdn.microsoft.com/en-us/library/hh706895.aspx>. */
|
||||
FILETIME current_time;
|
||||
|
||||
if (!initialized)
|
||||
initialize ();
|
||||
if (GetSystemTimePreciseAsFileTimeFunc != NULL)
|
||||
GetSystemTimePreciseAsFileTimeFunc (¤t_time);
|
||||
else
|
||||
GetSystemTimeAsFileTime (¤t_time);
|
||||
|
||||
/* Convert from FILETIME to 'struct timeval'. */
|
||||
/* FILETIME: <https://msdn.microsoft.com/en-us/library/ms724284.aspx> */
|
||||
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;
|
||||
|
||||
# else
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stat --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=unsetenv --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax strtoumax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub update-copyright utimens vla warnings
|
||||
# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stat --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=unsetenv --avoid=utime-h --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax strtoumax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub update-copyright utimens vla warnings
|
||||
|
||||
|
||||
MOSTLYCLEANFILES += core *.stackdump
|
||||
|
@ -117,6 +117,7 @@ GNULIB_CHDIR = @GNULIB_CHDIR@
|
|||
GNULIB_CHOWN = @GNULIB_CHOWN@
|
||||
GNULIB_CLOSE = @GNULIB_CLOSE@
|
||||
GNULIB_CLOSEDIR = @GNULIB_CLOSEDIR@
|
||||
GNULIB_CTIME = @GNULIB_CTIME@
|
||||
GNULIB_DIRFD = @GNULIB_DIRFD@
|
||||
GNULIB_DPRINTF = @GNULIB_DPRINTF@
|
||||
GNULIB_DUP = @GNULIB_DUP@
|
||||
|
@ -183,6 +184,7 @@ GNULIB_LCHMOD = @GNULIB_LCHMOD@
|
|||
GNULIB_LCHOWN = @GNULIB_LCHOWN@
|
||||
GNULIB_LINK = @GNULIB_LINK@
|
||||
GNULIB_LINKAT = @GNULIB_LINKAT@
|
||||
GNULIB_LOCALTIME = @GNULIB_LOCALTIME@
|
||||
GNULIB_LSEEK = @GNULIB_LSEEK@
|
||||
GNULIB_LSTAT = @GNULIB_LSTAT@
|
||||
GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
|
||||
|
@ -281,6 +283,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@
|
||||
|
@ -669,6 +672,7 @@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@
|
|||
REPLACE_CHOWN = @REPLACE_CHOWN@
|
||||
REPLACE_CLOSE = @REPLACE_CLOSE@
|
||||
REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@
|
||||
REPLACE_CTIME = @REPLACE_CTIME@
|
||||
REPLACE_DIRFD = @REPLACE_DIRFD@
|
||||
REPLACE_DPRINTF = @REPLACE_DPRINTF@
|
||||
REPLACE_DUP = @REPLACE_DUP@
|
||||
|
@ -760,6 +764,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@
|
||||
|
@ -2701,9 +2706,12 @@ 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_CTIME''@/$(GNULIB_CTIME)/g' \
|
||||
-e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/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' \
|
||||
|
@ -2713,11 +2721,13 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
|
|||
-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|@''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|@''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' \
|
||||
|
|
47
lib/mktime.c
47
lib/mktime.c
|
@ -23,6 +23,19 @@
|
|||
# define DEBUG_MKTIME 0
|
||||
#endif
|
||||
|
||||
/* The following macros influence what gets defined when this file is compiled:
|
||||
|
||||
Macro/expression Which gnulib module This compilation unit
|
||||
should define
|
||||
|
||||
NEED_MKTIME_WORKING mktime rpl_mktime
|
||||
|| NEED_MKTIME_WINDOWS
|
||||
|
||||
NEED_MKTIME_INTERNAL mktime-internal mktime_internal
|
||||
|
||||
DEBUG_MKTIME (defined manually) my_mktime, main
|
||||
*/
|
||||
|
||||
#if !defined _LIBC && !DEBUG_MKTIME
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
@ -51,6 +64,13 @@
|
|||
# define mktime my_mktime
|
||||
#endif
|
||||
|
||||
#if NEED_MKTIME_WINDOWS /* on native Windows */
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#if NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL || DEBUG_MKTIME
|
||||
|
||||
/* A signed type that can represent an integer number of years
|
||||
multiplied by three times the number of seconds in a year. It is
|
||||
needed when converting a tm_year value times the number of seconds
|
||||
|
@ -458,25 +478,46 @@ __mktime_internal (struct tm *tp,
|
|||
return t;
|
||||
}
|
||||
|
||||
#endif /* NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL || DEBUG_MKTIME */
|
||||
|
||||
#if NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS || DEBUG_MKTIME
|
||||
|
||||
# if NEED_MKTIME_WORKING || DEBUG_MKTIME
|
||||
static mktime_offset_t localtime_offset;
|
||||
# endif
|
||||
|
||||
/* Convert *TP to a time_t value. */
|
||||
time_t
|
||||
mktime (struct tm *tp)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
# if NEED_MKTIME_WINDOWS
|
||||
/* If the environment variable TZ has been set by Cygwin, neutralize it.
|
||||
The Microsoft CRT interprets TZ differently than Cygwin and produces
|
||||
incorrect results if TZ has the syntax used by Cygwin. */
|
||||
const char *tz = getenv ("TZ");
|
||||
if (tz != NULL && strchr (tz, '/') != NULL)
|
||||
_putenv ("TZ=");
|
||||
# endif
|
||||
|
||||
# if NEED_MKTIME_WORKING || DEBUG_MKTIME
|
||||
# ifdef _LIBC
|
||||
/* POSIX.1 8.1.1 requires that whenever mktime() is called, the
|
||||
time zone names contained in the external variable 'tzname' shall
|
||||
be set as if the tzset() function had been called. */
|
||||
__tzset ();
|
||||
#elif HAVE_TZSET
|
||||
# elif HAVE_TZSET
|
||||
tzset ();
|
||||
#endif
|
||||
# endif
|
||||
|
||||
return __mktime_internal (tp, __localtime_r, &localtime_offset);
|
||||
# else
|
||||
# undef mktime
|
||||
return mktime (tp);
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif /* NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS || DEBUG_MKTIME */
|
||||
|
||||
#ifdef weak_alias
|
||||
weak_alias (mktime, timelocal)
|
||||
#endif
|
||||
|
|
|
@ -187,7 +187,7 @@ _GL_CXXALIASWARN (gmtime_r);
|
|||
/* 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@
|
||||
# if @GNULIB_LOCALTIME@ || @GNULIB_GETTIMEOFDAY@
|
||||
# if @REPLACE_LOCALTIME@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef localtime
|
||||
|
@ -233,6 +233,41 @@ _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
|
|||
_GL_CXXALIASWARN (strptime);
|
||||
# endif
|
||||
|
||||
/* Convert *TP to a date and time string. See
|
||||
<http://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
|
||||
_GL_CXXALIASWARN (ctime);
|
||||
# endif
|
||||
|
||||
/* Convert *TP to a date and time string. See
|
||||
<http://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
|
||||
_GL_CXXALIASWARN (strftime);
|
||||
# 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));
|
||||
|
|
|
@ -30,24 +30,11 @@
|
|||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
|
||||
#include "stat-time.h"
|
||||
#include "timespec.h"
|
||||
|
||||
#if HAVE_UTIME_H
|
||||
# include <utime.h>
|
||||
#endif
|
||||
|
||||
/* Some systems (even some that do have <utime.h>) don't declare this
|
||||
structure anywhere. */
|
||||
#ifndef HAVE_STRUCT_UTIMBUF
|
||||
struct utimbuf
|
||||
{
|
||||
long actime;
|
||||
long modtime;
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Avoid recursion with rpl_futimens or rpl_utimensat. */
|
||||
#undef futimens
|
||||
#undef utimensat
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# serial 21
|
||||
# serial 22
|
||||
|
||||
# Copyright (C) 2001-2003, 2005, 2007, 2009-2017 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
|
@ -132,7 +132,4 @@ AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [
|
|||
])
|
||||
|
||||
# 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], [:])
|
||||
|
|
|
@ -516,7 +516,7 @@ AC_DEFUN([gl_INIT],
|
|||
{
|
||||
if ! $gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31; then
|
||||
gl_FUNC_MKTIME_INTERNAL
|
||||
if test $REPLACE_MKTIME = 1; then
|
||||
if test $WANT_MKTIME_INTERNAL = 1; then
|
||||
AC_LIBOBJ([mktime])
|
||||
gl_PREREQ_MKTIME
|
||||
fi
|
||||
|
@ -1051,7 +1051,6 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/timespec.m4
|
||||
m4/tm_gmtoff.m4
|
||||
m4/unistd_h.m4
|
||||
m4/utimbuf.m4
|
||||
m4/utimens.m4
|
||||
m4/utimes.m4
|
||||
m4/vararrays.m4
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# include_next.m4 serial 23
|
||||
# include_next.m4 serial 24
|
||||
dnl Copyright (C) 2006-2017 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -6,7 +6,8 @@ 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.
|
||||
|
|
65
m4/mktime.m4
65
m4/mktime.m4
|
@ -1,4 +1,4 @@
|
|||
# serial 27
|
||||
# serial 28
|
||||
dnl Copyright (C) 2002-2003, 2005-2007, 2009-2017 Free Software Foundation,
|
||||
dnl Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
|
@ -21,9 +21,9 @@ AC_DEFUN([gl_TIME_T_IS_SIGNED],
|
|||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_FUNC_MKTIME],
|
||||
dnl Test whether mktime works. Set gl_cv_func_working_mktime.
|
||||
AC_DEFUN([gl_FUNC_MKTIME_WORKS],
|
||||
[
|
||||
AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
|
||||
AC_REQUIRE([gl_TIME_T_IS_SIGNED])
|
||||
|
||||
dnl We don't use AC_FUNC_MKTIME any more, because it is no longer maintained
|
||||
|
@ -239,29 +239,50 @@ main ()
|
|||
}]])],
|
||||
[gl_cv_func_working_mktime=yes],
|
||||
[gl_cv_func_working_mktime=no],
|
||||
[gl_cv_func_working_mktime=no])
|
||||
[gl_cv_func_working_mktime="guessing no"])
|
||||
])
|
||||
|
||||
if test $gl_cv_func_working_mktime = no; then
|
||||
REPLACE_MKTIME=1
|
||||
else
|
||||
REPLACE_MKTIME=0
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [
|
||||
AC_REQUIRE([gl_FUNC_MKTIME])
|
||||
if test $REPLACE_MKTIME = 0; then
|
||||
dnl BeOS has __mktime_internal in libc, but other platforms don't.
|
||||
AC_CHECK_FUNC([__mktime_internal],
|
||||
[AC_DEFINE([mktime_internal], [__mktime_internal],
|
||||
[Define to the real name of the mktime_internal function.])
|
||||
],
|
||||
[dnl mktime works but it doesn't export __mktime_internal,
|
||||
dnl so we need to substitute our own mktime implementation.
|
||||
REPLACE_MKTIME=1
|
||||
])
|
||||
dnl Main macro of module 'mktime'.
|
||||
AC_DEFUN([gl_FUNC_MKTIME],
|
||||
[
|
||||
AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_REQUIRE([gl_FUNC_MKTIME_WORKS])
|
||||
|
||||
REPLACE_MKTIME=0
|
||||
if test "$gl_cv_func_working_mktime" != yes; then
|
||||
REPLACE_MKTIME=1
|
||||
AC_DEFINE([NEED_MKTIME_WORKING], [1],
|
||||
[Define if the compilation of mktime.c should define 'mktime'
|
||||
with the algorithmic workarounds.])
|
||||
fi
|
||||
case "$host_os" in
|
||||
mingw*)
|
||||
REPLACE_MKTIME=1
|
||||
AC_DEFINE([NEED_MKTIME_WINDOWS], [1],
|
||||
[Define if the compilation of mktime.c should define 'mktime'
|
||||
with the native Windows TZ workaround.])
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
dnl Main macro of module 'mktime-internal'.
|
||||
AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [
|
||||
AC_REQUIRE([gl_FUNC_MKTIME_WORKS])
|
||||
|
||||
WANT_MKTIME_INTERNAL=0
|
||||
dnl BeOS has __mktime_internal in libc, but other platforms don't.
|
||||
AC_CHECK_FUNC([__mktime_internal],
|
||||
[AC_DEFINE([mktime_internal], [__mktime_internal],
|
||||
[Define to the real name of the mktime_internal function.])
|
||||
],
|
||||
[dnl mktime works but it doesn't export __mktime_internal,
|
||||
dnl so we need to substitute our own mktime implementation.
|
||||
WANT_MKTIME_INTERNAL=1
|
||||
AC_DEFINE([NEED_MKTIME_INTERNAL], [1],
|
||||
[Define if the compilation of mktime.c should define 'mktime_internal'.])
|
||||
])
|
||||
])
|
||||
|
||||
# Prerequisites of lib/mktime.c.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# serial 33
|
||||
# serial 34
|
||||
|
||||
# Copyright (C) 1996-1997, 1999-2007, 2009-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
|
@ -9,12 +9,6 @@
|
|||
# Written by Jim Meyering and Paul Eggert.
|
||||
|
||||
AC_DEFUN([gl_FUNC_GNU_STRFTIME],
|
||||
[
|
||||
gl_FUNC_STRFTIME
|
||||
])
|
||||
|
||||
# These are the prerequisite macros for GNU's strftime.c replacement.
|
||||
AC_DEFUN([gl_FUNC_STRFTIME],
|
||||
[
|
||||
# This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
|
||||
AC_REQUIRE([AC_STRUCT_TIMEZONE])
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Copyright (C) 2000-2001, 2003-2007, 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
# serial 9
|
||||
# serial 10
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -104,8 +104,11 @@ 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])
|
||||
|
@ -118,9 +121,11 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
|
|||
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])
|
||||
|
||||
dnl Hack so that the time module doesn't depend on the sys_time module.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# timegm.m4 serial 11
|
||||
# timegm.m4 serial 12
|
||||
dnl Copyright (C) 2003, 2007, 2009-2017 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -7,11 +7,11 @@ dnl with or without modifications, as long as this notice is preserved.
|
|||
AC_DEFUN([gl_FUNC_TIMEGM],
|
||||
[
|
||||
AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
|
||||
AC_REQUIRE([gl_FUNC_MKTIME])
|
||||
AC_REQUIRE([gl_FUNC_MKTIME_WORKS])
|
||||
REPLACE_TIMEGM=0
|
||||
AC_CHECK_FUNCS_ONCE([timegm])
|
||||
if test $ac_cv_func_timegm = yes; then
|
||||
if test $gl_cv_func_working_mktime = no; then
|
||||
if test "$gl_cv_func_working_mktime" != yes; then
|
||||
# Assume that timegm is buggy if mktime is.
|
||||
REPLACE_TIMEGM=1
|
||||
fi
|
||||
|
|
|
@ -3,14 +3,13 @@ dnl This file is free software; the Free Software Foundation
|
|||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl serial 7
|
||||
dnl serial 8
|
||||
|
||||
AC_DEFUN([gl_UTIMENS],
|
||||
[
|
||||
dnl Prerequisites of lib/utimens.c.
|
||||
AC_REQUIRE([gl_FUNC_UTIMES])
|
||||
AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
|
||||
AC_REQUIRE([gl_CHECK_TYPE_STRUCT_UTIMBUF])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
||||
AC_CHECK_FUNCS_ONCE([futimes futimesat futimens utimensat lutimes])
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue