summaryrefslogtreecommitdiffstats
path: root/gl/m4/getloadavg.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/getloadavg.m4')
-rw-r--r--gl/m4/getloadavg.m438
1 files changed, 22 insertions, 16 deletions
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4
index 79e420ba..8ab613db 100644
--- a/gl/m4/getloadavg.m4
+++ b/gl/m4/getloadavg.m4
@@ -1,13 +1,13 @@
1# Check for getloadavg. 1# getloadavg.m4
2 2# serial 13
3# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2023 Free Software 3dnl Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2025 Free
4# Foundation, Inc. 4dnl Software Foundation, Inc.
5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
5 9
6# This file is free software; the Free Software Foundation 10# Check for getloadavg.
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10#serial 10
11 11
12# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent. 12# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
13# New applications should use gl_GETLOADAVG instead. 13# New applications should use gl_GETLOADAVG instead.
@@ -20,13 +20,18 @@ AC_DEFUN([gl_GETLOADAVG],
20# Persuade glibc <stdlib.h> to declare getloadavg(). 20# Persuade glibc <stdlib.h> to declare getloadavg().
21AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 21AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
22 22
23gl_save_LIBS=$LIBS 23gl_saved_LIBS=$LIBS
24 24
25# getloadavg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0, 25# getloadavg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0,
26# NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7. 26# NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7.
27HAVE_GETLOADAVG=1 27HAVE_GETLOADAVG=1
28AC_CHECK_FUNC([getloadavg], [], 28gl_CHECK_FUNCS_ANDROID([getloadavg], [[#include <stdlib.h>]])
29 [gl_func_getloadavg_done=no 29if test $ac_cv_func_getloadavg != yes; then
30 case "$gl_cv_onwards_func_getloadavg" in
31 future*) REPLACE_GETLOADAVG=1 ;;
32 esac
33
34 gl_func_getloadavg_done=no
30 35
31 # Some systems with -lutil have (and need) -lkvm as well, some do not. 36 # Some systems with -lutil have (and need) -lkvm as well, some do not.
32 # On Solaris, -lkvm requires nlist from -lelf, so check that first 37 # On Solaris, -lkvm requires nlist from -lelf, so check that first
@@ -73,14 +78,15 @@ AC_CHECK_FUNC([getloadavg], [],
73 AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.]) 78 AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
74 AC_CHECK_LIB([dgc], [dg_sys_info])]) 79 AC_CHECK_LIB([dgc], [dg_sys_info])])
75 fi 80 fi
76 fi]) 81 fi
82fi
77 83
78if test "x$gl_save_LIBS" = x; then 84if test "x$gl_saved_LIBS" = x; then
79 GETLOADAVG_LIBS=$LIBS 85 GETLOADAVG_LIBS=$LIBS
80else 86else
81 GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_save_LIBS!!"` 87 GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_saved_LIBS!!"`
82fi 88fi
83LIBS=$gl_save_LIBS 89LIBS=$gl_saved_LIBS
84 90
85AC_SUBST([GETLOADAVG_LIBS])dnl 91AC_SUBST([GETLOADAVG_LIBS])dnl
86 92