summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--lib/stdlib.in.h16
-rw-r--r--m4/getloadavg.m46
-rw-r--r--m4/stdlib_h.m43
-rw-r--r--modules/getloadavg11
-rw-r--r--modules/stdlib1
6 files changed, 37 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 1ce418acc0..9836300631 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,15 @@
Resolve conflicts for functions introduced in Android API level 29.
+ * lib/stdlib.in.h (getloadavg): Consider REPLACE_GETLOADAVG. Disable
+ _GL_CXXALIASWARN invocation on non-glibc systems.
+ * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_GETLOADAVG.
+ * modules/stdlib (Makefile.am): Substitute REPLACE_GETLOADAVG.
+ * m4/getloadavg.m4 (gl_GETLOADAVG): Conditionally set
+ REPLACE_GETLOADAVG.
+ * modules/getloadavg (Depends-on, configure.ac): Consider
+ REPLACE_GETLOADAVG.
+
* 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.
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index c03f46ee38..ba1d8bff4e 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -427,12 +427,24 @@ _GL_CXXALIASWARN (gcvt);
The three numbers are the load average of the last 1 minute, the last 5
minutes, and the last 15 minutes, respectively.
LOADAVG is an array of NELEM numbers. */
-# if !@HAVE_DECL_GETLOADAVG@
+# if @REPLACE_GETLOADAVG@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef getloadavg
+# define getloadavg rpl_getloadavg
+# endif
+_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem));
+# else
+# if !@HAVE_DECL_GETLOADAVG@
_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
_GL_ARG_NONNULL ((1)));
-# endif
+# endif
_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
+# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (getloadavg);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef getloadavg
# if HAVE_RAW_DECL_GETLOADAVG
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index 067f142abc..ee83b32f1e 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -7,7 +7,7 @@
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-#serial 11
+#serial 12
# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
# New applications should use gl_GETLOADAVG instead.
@@ -27,6 +27,10 @@ gl_save_LIBS=$LIBS
HAVE_GETLOADAVG=1
gl_CHECK_FUNCS_ANDROID([getloadavg], [[#include <stdlib.h>]])
if test $ac_cv_func_getloadavg != yes; then
+ case "$gl_cv_onwards_func_getloadavg" in
+ future*) REPLACE_GETLOADAVG=1 ;;
+ esac
+
gl_func_getloadavg_done=no
# Some systems with -lutil have (and need) -lkvm as well, some do not.
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index ee1f48ee5a..249ef65722 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 70
+# stdlib_h.m4 serial 71
dnl Copyright (C) 2007-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,
@@ -174,6 +174,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX])
REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
REPLACE_FREE=0; AC_SUBST([REPLACE_FREE])
+ REPLACE_GETLOADAVG=0; AC_SUBST([REPLACE_GETLOADAVG])
REPLACE_GETPROGNAME=0; AC_SUBST([REPLACE_GETPROGNAME])
REPLACE_GETSUBOPT=0; AC_SUBST([REPLACE_GETSUBOPT])
REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE])
diff --git a/modules/getloadavg b/modules/getloadavg
index 9a5553ebba..fcd4352d28 100644
--- a/modules/getloadavg
+++ b/modules/getloadavg
@@ -7,15 +7,16 @@ m4/getloadavg.m4
Depends-on:
extensions
-intprops [test $HAVE_GETLOADAVG = 0]
-open [case $host_os in mingw*) false;; *) test $HAVE_GETLOADAVG = 0;; esac]
-stdbool [test $HAVE_GETLOADAVG = 0]
-stdlib [test $HAVE_GETLOADAVG = 0]
+intprops [test $HAVE_GETLOADAVG = 0 || test $REPLACE_GETLOADAVG = 1]
+open [case $host_os in mingw*) false;; *) test $HAVE_GETLOADAVG = 0 || test $REPLACE_GETLOADAVG = 1;; esac]
+stdbool [test $HAVE_GETLOADAVG = 0 || test $REPLACE_GETLOADAVG = 1]
+stdlib [test $HAVE_GETLOADAVG = 0 || test $REPLACE_GETLOADAVG = 1]
configure.ac:
AC_REQUIRE([AC_CANONICAL_HOST])
gl_GETLOADAVG
-gl_CONDITIONAL([GL_COND_OBJ_GETLOADAVG], [test $HAVE_GETLOADAVG = 0])
+gl_CONDITIONAL([GL_COND_OBJ_GETLOADAVG],
+ [test $HAVE_GETLOADAVG = 0 || test $REPLACE_GETLOADAVG = 1])
AM_COND_IF([GL_COND_OBJ_GETLOADAVG], [
gl_PREREQ_GETLOADAVG
])
diff --git a/modules/stdlib b/modules/stdlib
index 5ae3e6665d..bafeb214ee 100644
--- a/modules/stdlib
+++ b/modules/stdlib
@@ -134,6 +134,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''REPLACE_CALLOC_FOR_CALLOC_POSIX''@|$(REPLACE_CALLOC_FOR_CALLOC_POSIX)|g' \
-e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
-e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \
+ -e 's|@''REPLACE_GETLOADAVG''@|$(REPLACE_GETLOADAVG)|g' \
-e 's|@''REPLACE_GETPROGNAME''@|$(REPLACE_GETPROGNAME)|g' \
-e 's|@''REPLACE_GETSUBOPT''@|$(REPLACE_GETSUBOPT)|g' \
-e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \