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.m445
1 files changed, 27 insertions, 18 deletions
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4
index 015bcac2..0a731c4f 100644
--- a/gl/m4/getloadavg.m4
+++ b/gl/m4/getloadavg.m4
@@ -1,7 +1,7 @@
1# Check for getloadavg. 1# Check for getloadavg.
2 2
3# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2003, 3# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2010 Free Software
4# 2006, 2008, 2009 Free Software 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,
@@ -60,17 +60,17 @@ if test $gl_have_func = no; then
60 gl_getloadavg_LIBS=$LIBS 60 gl_getloadavg_LIBS=$LIBS
61 LIBS="-L/usr/local/lib $LIBS" 61 LIBS="-L/usr/local/lib $LIBS"
62 AC_CHECK_LIB([getloadavg], [getloadavg], 62 AC_CHECK_LIB([getloadavg], [getloadavg],
63 [LIBS="-lgetloadavg $LIBS"], [LIBS=$gl_getloadavg_LIBS]) 63 [LIBS="-lgetloadavg $LIBS"], [LIBS=$gl_getloadavg_LIBS])
64fi 64fi
65 65
66# Make sure it is really in the library, if we think we found it, 66# Make sure it is really in the library, if we think we found it,
67# otherwise set up the replacement function. 67# otherwise set up the replacement function.
68AC_CHECK_FUNCS([getloadavg], [], 68AC_CHECK_FUNCS([getloadavg], [],
69 [gl_PREREQ_GETLOADAVG]) 69 [gl_PREREQ_GETLOADAVG])
70 70
71# Some definitions of getloadavg require that the program be installed setgid. 71# Some definitions of getloadavg require that the program be installed setgid.
72AC_CACHE_CHECK([whether getloadavg requires setgid], 72AC_CACHE_CHECK([whether getloadavg requires setgid],
73 gl_cv_func_getloadavg_setgid, 73 gl_cv_func_getloadavg_setgid,
74[AC_EGREP_CPP([Yowza Am I SETGID yet], 74[AC_EGREP_CPP([Yowza Am I SETGID yet],
75[#define CONFIGURING_GETLOADAVG 75[#define CONFIGURING_GETLOADAVG
76#include "$srcdir/$1/getloadavg.c" 76#include "$srcdir/$1/getloadavg.c"
@@ -78,13 +78,13 @@ AC_CACHE_CHECK([whether getloadavg requires setgid],
78Yowza Am I SETGID yet 78Yowza Am I SETGID yet
79#endif 79#endif
80], 80],
81 gl_cv_func_getloadavg_setgid=yes, 81 gl_cv_func_getloadavg_setgid=yes,
82 gl_cv_func_getloadavg_setgid=no)]) 82 gl_cv_func_getloadavg_setgid=no)])
83if test $gl_cv_func_getloadavg_setgid = yes; then 83if test $gl_cv_func_getloadavg_setgid = yes; then
84 NEED_SETGID=true 84 NEED_SETGID=true
85 AC_DEFINE([GETLOADAVG_PRIVILEGED], [1], 85 AC_DEFINE([GETLOADAVG_PRIVILEGED], [1],
86 [Define to 1 if the `getloadavg' function needs to be run setuid 86 [Define to 1 if the `getloadavg' function needs to be run setuid
87 or setgid.]) 87 or setgid.])
88else 88else
89 NEED_SETGID=false 89 NEED_SETGID=false
90fi 90fi
@@ -98,8 +98,8 @@ if test $gl_cv_func_getloadavg_setgid = yes; then
98 test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem` 98 test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
99 gl_cv_group_kmem=`echo $ac_ls_output \ 99 gl_cv_group_kmem=`echo $ac_ls_output \
100 | sed -ne ['s/[ ][ ]*/ /g 100 | sed -ne ['s/[ ][ ]*/ /g
101 s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/ 101 s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/
102 / /s/.* //;p']` 102 / /s/.* //;p']`
103]) 103])
104 AC_SUBST([KMEM_GROUP], [$gl_cv_group_kmem])dnl 104 AC_SUBST([KMEM_GROUP], [$gl_cv_group_kmem])dnl
105fi 105fi
@@ -154,8 +154,8 @@ if test $gl_have_func = no; then
154 [gl_have_func=yes 154 [gl_have_func=yes
155 AC_DEFINE([UMAX], [1], [Define to 1 for Encore UMAX.]) 155 AC_DEFINE([UMAX], [1], [Define to 1 for Encore UMAX.])
156 AC_DEFINE([UMAX4_3], [1], 156 AC_DEFINE([UMAX4_3], [1],
157 [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> 157 [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h>
158 instead of <sys/cpustats.h>.])]) 158 instead of <sys/cpustats.h>.])])
159fi 159fi
160 160
161if test $gl_have_func = no; then 161if test $gl_have_func = no; then
@@ -169,10 +169,19 @@ fi
169 169
170AC_CHECK_HEADERS([nlist.h], 170AC_CHECK_HEADERS([nlist.h],
171[AC_CHECK_MEMBERS([struct nlist.n_un.n_name], 171[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
172 [AC_DEFINE([NLIST_NAME_UNION], [1], 172 [AC_DEFINE([NLIST_NAME_UNION], [1],
173 [Define to 1 if your `struct nlist' has an 173 [Define to 1 if your `struct nlist' has an
174 `n_un' member. Obsolete, depend on 174 `n_un' member. Obsolete, depend on
175 `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [], 175 `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [],
176 [@%:@include <nlist.h>]) 176 [@%:@include <nlist.h>])
177 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
178 [[struct nlist x;
179 #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
180 x.n_un.n_name = "";
181 #else
182 x.n_name = "";
183 #endif]])],
184 [AC_DEFINE([N_NAME_POINTER], [1],
185 [Define to 1 if the nlist n_name member is a pointer])])
177])dnl 186])dnl
178])# gl_PREREQ_GETLOADAVG 187])# gl_PREREQ_GETLOADAVG