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.m417
1 files changed, 11 insertions, 6 deletions
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4
index 611372a..bba2216 100644
--- a/gl/m4/getloadavg.m4
+++ b/gl/m4/getloadavg.m4
@@ -1,13 +1,13 @@
1# Check for getloadavg. 1# Check for getloadavg.
2 2
3# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2013 Free Software 3# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2021 Free Software
4# Foundation, Inc. 4# Foundation, Inc.
5 5
6# This file is free software; the Free Software Foundation 6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it, 7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved. 8# with or without modifications, as long as this notice is preserved.
9 9
10#serial 6 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.
@@ -22,7 +22,7 @@ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
22 22
23gl_save_LIBS=$LIBS 23gl_save_LIBS=$LIBS
24 24
25# getloadvg 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], [], 28AC_CHECK_FUNC([getloadavg], [],
@@ -45,7 +45,9 @@ AC_CHECK_FUNC([getloadavg], [],
45 # There is a commonly available library for RS/6000 AIX. 45 # There is a commonly available library for RS/6000 AIX.
46 # Since it is not a standard part of AIX, it might be installed locally. 46 # Since it is not a standard part of AIX, it might be installed locally.
47 gl_getloadavg_LIBS=$LIBS 47 gl_getloadavg_LIBS=$LIBS
48 LIBS="-L/usr/local/lib $LIBS" 48 if test $cross_compiling != yes; then
49 LIBS="-L/usr/local/lib $LIBS"
50 fi
49 AC_CHECK_LIB([getloadavg], [getloadavg], 51 AC_CHECK_LIB([getloadavg], [getloadavg],
50 [LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes], 52 [LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes],
51 [LIBS=$gl_getloadavg_LIBS]) 53 [LIBS=$gl_getloadavg_LIBS])
@@ -92,6 +94,9 @@ else
92fi 94fi
93AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0], 95AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0],
94 [[#if HAVE_SYS_LOADAVG_H 96 [[#if HAVE_SYS_LOADAVG_H
97 /* OpenIndiana has a bug: <sys/time.h> must be included before
98 <sys/loadavg.h>. */
99 # include <sys/time.h>
95 # include <sys/loadavg.h> 100 # include <sys/loadavg.h>
96 #endif 101 #endif
97 #include <stdlib.h>]]) 102 #include <stdlib.h>]])
@@ -105,7 +110,7 @@ AC_DEFUN([gl_PREREQ_GETLOADAVG],
105[ 110[
106# Figure out what our getloadavg.c needs. 111# Figure out what our getloadavg.c needs.
107 112
108AC_CHECK_HEADERS_ONCE([sys/param.h]) 113AC_CHECK_HEADERS_ONCE([sys/param.h unistd.h])
109 114
110# On HPUX9, an unprivileged user can get load averages this way. 115# On HPUX9, an unprivileged user can get load averages this way.
111if test $gl_func_getloadavg_done = no; then 116if test $gl_func_getloadavg_done = no; then
@@ -142,7 +147,7 @@ fi
142AC_CHECK_HEADERS([nlist.h], 147AC_CHECK_HEADERS([nlist.h],
143[AC_CHECK_MEMBERS([struct nlist.n_un.n_name], 148[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
144 [], [], 149 [], [],
145 [@%:@include <nlist.h>]) 150 [#include <nlist.h>])
146 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]], 151 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
147 [[struct nlist x; 152 [[struct nlist x;
148 #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME 153 #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME