summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2023-08-12 12:50:15 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2023-08-12 12:57:35 -0700
commitf3868cb9d1806b35186eabc0262393316ebe689a (patch)
treeb94176760150b6994aacf74292a12ba0890b9222 /m4
parentb66c16c789d8046ff40c48b9346b26238b1b97e1 (diff)
downloademacs-f3868cb9d1806b35186eabc0262393316ebe689a.tar.gz
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'm4')
-rw-r--r--m4/clock_time.m432
-rw-r--r--m4/mktime.m43
-rw-r--r--m4/nanosleep.m46
-rw-r--r--m4/stdalign.m410
-rw-r--r--m4/time_h.m435
-rw-r--r--m4/time_r.m44
-rw-r--r--m4/timegm.m43
7 files changed, 50 insertions, 43 deletions
diff --git a/m4/clock_time.m4 b/m4/clock_time.m4
index d624a73d35d..28534db1c76 100644
--- a/m4/clock_time.m4
+++ b/m4/clock_time.m4
@@ -1,4 +1,4 @@
-# clock_time.m4 serial 12
+# clock_time.m4 serial 13
dnl Copyright (C) 2002-2006, 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -12,9 +12,17 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_CLOCK_TIME],
[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+
dnl Persuade glibc and Solaris <time.h> to declare these functions.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ # On mingw, these functions are defined in the libwinpthread library,
+ # which is better avoided. In fact, the clock_gettime function is buggy
+ # in 32-bit mingw, when -D__MINGW_USE_VC2005_COMPAT is used (which Gnulib's
+ # year2038 module does): It leaves the upper 32 bits of the tv_sec field
+ # of the result uninitialized.
+
# Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
@@ -23,12 +31,22 @@ AC_DEFUN([gl_CLOCK_TIME],
# library, inducing unnecessary run-time overhead.
CLOCK_TIME_LIB=
AC_SUBST([CLOCK_TIME_LIB])
- gl_saved_libs=$LIBS
- AC_SEARCH_LIBS([clock_gettime], [rt posix4],
- [test "$ac_cv_search_clock_gettime" = "none required" ||
- CLOCK_TIME_LIB=$ac_cv_search_clock_gettime])
- AC_CHECK_FUNCS([clock_getres clock_gettime clock_settime])
- LIBS=$gl_saved_libs
+ case "$host_os" in
+ mingw*)
+ ac_cv_func_clock_getres=no
+ ac_cv_func_clock_gettime=no
+ ac_cv_func_clock_settime=no
+ ;;
+ *)
+ gl_saved_libs=$LIBS
+ AC_SEARCH_LIBS([clock_gettime], [rt posix4],
+ [test "$ac_cv_search_clock_gettime" = "none required" ||
+ CLOCK_TIME_LIB=$ac_cv_search_clock_gettime])
+ AC_CHECK_FUNCS([clock_getres clock_gettime clock_settime])
+ LIBS=$gl_saved_libs
+ ;;
+ esac
+
# For backward compatibility.
LIB_CLOCK_GETTIME="$CLOCK_TIME_LIB"
AC_SUBST([LIB_CLOCK_GETTIME])
diff --git a/m4/mktime.m4 b/m4/mktime.m4
index e9d31f35a46..69cce86da5a 100644
--- a/m4/mktime.m4
+++ b/m4/mktime.m4
@@ -1,4 +1,4 @@
-# serial 37
+# serial 38
dnl Copyright (C) 2002-2003, 2005-2007, 2009-2023 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -280,7 +280,6 @@ AC_DEFUN([gl_FUNC_MKTIME],
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],
diff --git a/m4/nanosleep.m4 b/m4/nanosleep.m4
index e21a3e343cb..b7f22d7b606 100644
--- a/m4/nanosleep.m4
+++ b/m4/nanosleep.m4
@@ -1,4 +1,4 @@
-# serial 43
+# serial 44
dnl From Jim Meyering.
dnl Check for the nanosleep function.
@@ -126,9 +126,7 @@ AC_DEFUN([gl_FUNC_NANOSLEEP],
])
])
case "$gl_cv_func_nanosleep" in
- *yes)
- REPLACE_NANOSLEEP=0
- ;;
+ *yes) ;;
*)
REPLACE_NANOSLEEP=1
case "$gl_cv_func_nanosleep" in
diff --git a/m4/stdalign.m4 b/m4/stdalign.m4
index 1a236d66d2f..6a39ffe7565 100644
--- a/m4/stdalign.m4
+++ b/m4/stdalign.m4
@@ -68,8 +68,10 @@ AC_DEFUN([gl_ALIGNASOF],
dnl The "zz" puts this toward config.h's end, to avoid potential
dnl collisions with other definitions.
AH_VERBATIM([zzalignas],
-[#if !defined HAVE_C_ALIGNASOF && __cplusplus < 201103 && !defined alignof
-# if HAVE_STDALIGN_H
+[#if !defined HAVE_C_ALIGNASOF \
+ && !(defined __cplusplus && 201103 <= __cplusplus) \
+ && !defined alignof
+# if defined HAVE_STDALIGN_H
# include <stdalign.h>
# endif
@@ -166,7 +168,7 @@ AC_DEFUN([gl_ALIGNASOF],
# define _Alignas(a) __declspec (align (a))
# endif
# endif
-# if !HAVE_STDALIGN_H
+# if !defined HAVE_STDALIGN_H
# if ((defined _Alignas \
&& !(defined __cplusplus \
&& (201103 <= __cplusplus || defined _MSC_VER))) \
@@ -175,7 +177,7 @@ AC_DEFUN([gl_ALIGNASOF],
# endif
# endif
-# if _GL_STDALIGN_NEEDS_STDDEF
+# if defined _GL_STDALIGN_NEEDS_STDDEF
# include <stddef.h>
# endif
#endif])
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index 51d553a2f1a..632d18fc071 100644
--- a/m4/time_h.m4
+++ b/m4/time_h.m4
@@ -2,7 +2,7 @@
# Copyright (C) 2000-2001, 2003-2007, 2009-2023 Free Software Foundation, Inc.
-# serial 22
+# serial 24
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -23,7 +23,10 @@ AC_DEFUN_ONCE([gl_TIME_H],
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[
#include <time.h>
- ]], [asctime_r ctime_r])
+ ]], [
+ asctime asctime_r ctime ctime_r gmtime_r localtime localtime_r mktime
+ nanosleep strftime strptime time timegm timespec_get timespec_getres tzset
+ ])
AC_REQUIRE([AC_C_RESTRICT])
@@ -162,25 +165,15 @@ AC_DEFUN([gl_TIME_H_DEFAULTS],
HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES])
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_TIME=0; AC_SUBST([REPLACE_TIME])
- REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM])
- REPLACE_TIMESPEC_GET=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMESPEC_GET])
- 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.
- : ${GNULIB_GETTIMEOFDAY=0}; AC_SUBST([GNULIB_GETTIMEOFDAY])
- dnl Second, it's OK to not use GNULIB_PORTCHECK for REPLACE_GMTIME
- dnl and REPLACE_LOCALTIME, as portability to Solaris 2.6 and earlier
- dnl is no longer a big deal.
+ REPLACE_CTIME=0; AC_SUBST([REPLACE_CTIME])
REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME])
REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME])
+ REPLACE_LOCALTIME_R=0; AC_SUBST([REPLACE_LOCALTIME_R])
+ REPLACE_MKTIME=0; AC_SUBST([REPLACE_MKTIME])
+ REPLACE_NANOSLEEP=0; AC_SUBST([REPLACE_NANOSLEEP])
+ REPLACE_STRFTIME=0; AC_SUBST([REPLACE_STRFTIME])
+ REPLACE_TIME=0; AC_SUBST([REPLACE_TIME])
+ REPLACE_TIMEGM=0; AC_SUBST([REPLACE_TIMEGM])
+ REPLACE_TIMESPEC_GET=0; AC_SUBST([REPLACE_TIMESPEC_GET])
+ REPLACE_TZSET=0; AC_SUBST([REPLACE_TZSET])
])
diff --git a/m4/time_r.m4 b/m4/time_r.m4
index adce438abf1..4831eb26f90 100644
--- a/m4/time_r.m4
+++ b/m4/time_r.m4
@@ -57,9 +57,7 @@ AC_DEFUN([gl_TIME_R],
[gl_cv_time_r_posix=yes],
[gl_cv_time_r_posix=no])
])
- if test $gl_cv_time_r_posix = yes; then
- REPLACE_LOCALTIME_R=0
- else
+ if test $gl_cv_time_r_posix != yes; then
REPLACE_LOCALTIME_R=1
fi
else
diff --git a/m4/timegm.m4 b/m4/timegm.m4
index 8ab265e65fe..6da07807698 100644
--- a/m4/timegm.m4
+++ b/m4/timegm.m4
@@ -1,4 +1,4 @@
-# timegm.m4 serial 15
+# timegm.m4 serial 16
dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -8,7 +8,6 @@ AC_DEFUN([gl_FUNC_TIMEGM],
[
AC_REQUIRE([gl_TIME_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_MKTIME_WORKS])
- REPLACE_TIMEGM=0
gl_CHECK_FUNCS_ANDROID([timegm], [[#include <time.h>]])
if test $ac_cv_func_timegm = yes; then
if test "$gl_cv_func_working_mktime" != yes; then