+2023-01-22 Bruno Haible <bruno@clisp.org>
+
+ Resolve conflicts for functions introduced in Android API level 29.
+
+ * lib/time.in.h (timespec_get): Consider REPLACE_TIMESPEC_GET. Disable
+ _GL_CXXALIASWARN invocation on non-glibc systems.
+ * m4/time_h.m4 (gl_TIME_H_DEFAULTS): Initialize REPLACE_TIMESPEC_GET.
+ * modules/time (Makefile.am): Substitute REPLACE_TIMESPEC_GET.
+ * m4/gettime.m4 (gl_CHECK_FUNC_TIMESPEC_GET): Set also
+ gl_cv_onwards_func_timespec_get.
+ * m4/timespec_get.m4 (gl_FUNC_TIMESPEC_GET): Conditionally set
+ REPLACE_TIMESPEC_GET.
+ * modules/timespec_get (Depends-on, configure.ac): Consider
+ REPLACE_TIMESPEC_GET.
+
2023-01-22 Bruno Haible <bruno@clisp.org>
Resolve conflicts for functions introduced in Android API level 28.
/* Set *TS to the current time, and return BASE.
Upon failure, return 0. */
# if @GNULIB_TIMESPEC_GET@
-# if ! @HAVE_TIMESPEC_GET@
+# if @REPLACE_TIMESPEC_GET@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef timespec_get
+# define timespec_get rpl_timespec_get
+# endif
+_GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (timespec_get, int, (struct timespec *ts, int base));
+# else
+# if !@HAVE_TIMESPEC_GET@
_GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base)
_GL_ARG_NONNULL ((1)));
-# endif
+# endif
_GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base));
+# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (timespec_get);
+# endif
# endif
/* Set *TS to the current time resolution, and return BASE.
-# gettime.m4 serial 13
+# gettime.m4 serial 14
dnl Copyright (C) 2002, 2004-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,
])
dnl Tests whether the function timespec_get exists.
-dnl Sets gl_cv_func_timespec_get.
+dnl Sets gl_cv_func_timespec_get and gl_cv_onwards_func_timespec_get.
AC_DEFUN([gl_CHECK_FUNC_TIMESPEC_GET],
[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+
dnl Persuade OpenBSD <time.h> to declare timespec_get().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
dnl But at the same time, we need to notice a missing declaration, like
dnl gl_CHECK_FUNCS_ANDROID does.
AC_CHECK_DECL([timespec_get], , , [[#include <time.h>]])
- if test $ac_cv_have_decl_timespec_get = yes; then
- AC_CACHE_CHECK([for timespec_get], [gl_cv_func_timespec_get],
- [AC_LINK_IFELSE(
+ AC_CACHE_CHECK([for timespec_get], [gl_cv_onwards_func_timespec_get],
+ [if test $ac_cv_have_decl_timespec_get = yes; then
+ AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <time.h>
struct timespec ts;
]],
[[return timespec_get (&ts, 0);]])
],
- [gl_cv_func_timespec_get=yes],
- [gl_cv_func_timespec_get=no])
- ])
- else
- gl_cv_func_timespec_get=no
- fi
+ [gl_cv_onwards_func_timespec_get=yes],
+ [gl_cv_onwards_func_timespec_get=no])
+ else
+ gl_cv_onwards_func_timespec_get=no
+ fi
+ case "$host_os" in
+ linux*-android*)
+ if test $gl_cv_onwards_func_timespec_get = no; then
+ gl_cv_onwards_func_timespec_get='future OS version'
+ fi
+ ;;
+ esac
+ ])
+ case "$gl_cv_onwards_func_timespec_get" in
+ future*) gl_cv_func_timespec_get=no ;;
+ *) gl_cv_func_timespec_get=$gl_cv_onwards_func_timespec_get ;;
+ esac
])
AC_DEFUN([gl_GETTIME_RES],
# Copyright (C) 2000-2001, 2003-2007, 2009-2023 Free Software Foundation, Inc.
-# serial 20
+# serial 21
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
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_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.
-# timespec_get.m4 serial 3
+# timespec_get.m4 serial 4
dnl Copyright (C) 2021-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,
AC_REQUIRE([gl_CHECK_FUNC_TIMESPEC_GET])
if test $gl_cv_func_timespec_get != yes; then
HAVE_TIMESPEC_GET=0
+ case "$gl_cv_onwards_func_timespec_get" in
+ future*) REPLACE_TIMESPEC_GET=1 ;;
+ esac
fi
])
-e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
-e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \
-e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
+ -e 's|@''REPLACE_TIMESPEC_GET''@|$(REPLACE_TIMESPEC_GET)|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' \
Depends-on:
time
extensions
-gettime [test $HAVE_TIMESPEC_GET = 0]
+gettime [test $HAVE_TIMESPEC_GET = 0 || test $REPLACE_TIMESPEC_GET = 1]
configure.ac:
gl_FUNC_TIMESPEC_GET
-gl_CONDITIONAL([GL_COND_OBJ_TIMESPEC_GET], [test $HAVE_TIMESPEC_GET = 0])
+gl_CONDITIONAL([GL_COND_OBJ_TIMESPEC_GET],
+ [test $HAVE_TIMESPEC_GET = 0 || test $REPLACE_TIMESPEC_GET = 1])
gl_TIME_MODULE_INDICATOR([timespec_get])
Makefile.am: