1.16f (serial 4).
* acspecific.m4 (AC_FUNC_GETLOADAVG): Check for
`pstat_getdynamic'.
Define `C_GETLOADAVG' if compiling `getloadavg.c'.
Check for NLS.
Compute `GETLOADAVG_LIBS'.
(AC_FUNC_MKTIME): Remove a forgotten `AC_SUBST(LIBOBJS)'.
+2000-05-19 Akim Demaille <akim@epita.fr>
+
+ Synchronize AC_FUNC_GETLOADAVG with the version of the shellutils
+ 1.16f (serial 4).
+
+ * acspecific.m4 (AC_FUNC_GETLOADAVG): Check for
+ `pstat_getdynamic'.
+ Define `C_GETLOADAVG' if compiling `getloadavg.c'.
+ Check for NLS.
+ Compute `GETLOADAVG_LIBS'.
+ (AC_FUNC_MKTIME): Remove a forgotten `AC_SUBST(LIBOBJS)'.
+
2000-05-19 Akim Demaille <akim@epita.fr>
* acgeneral.m4 (AC_SHELL_UNSET, AC_SHELL_UNSETENV): New macro.
# AC_FUNC_GETLOADAVG
# ------------------
-AC_DEFUN(AC_FUNC_GETLOADAVG,
+AC_DEFUN([AC_FUNC_GETLOADAVG],
[ac_have_func=no # yes means we've found a way to get the load average.
+ac_save_LIBS=$LIBS
+
+# On HPUX9, an unprivileged user can get load averages through this function.
+AC_CHECK_FUNCS(pstat_getdynamic)
+
+# Solaris has libkstat which does not require root.
+AC_CHECK_LIB(kstat, kstat_open)
+test $ac_cv_lib_kstat_kstat_open = yes && ac_have_func=yes
+
# Some systems with -lutil have (and need) -lkvm as well, some do not.
# On Solaris, -lkvm requires nlist from -lelf, so check that first
# to get the right answer into the cache.
+# For kstat on solaris, we need libelf to force the definition of SVR4 below.
AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
-AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
-AC_CHECK_LIB(kstat, kstat_open)
-# Check for the 4.4BSD definition of getloadavg.
-AC_CHECK_LIB(util, getloadavg,
- [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
+if test $ac_have_func = no; then
+ AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
+ # Check for the 4.4BSD definition of getloadavg.
+ AC_CHECK_LIB(util, getloadavg,
+ [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
+fi
if test $ac_have_func = no; then
# There is a commonly available library for RS/6000 AIX.
# Since it is not a standard part of AIX, it might be installed locally.
- ac_getloadavg_LIBS=$LIBS; LIBS="-L/usr/local/lib $LIBS"
+ ac_getloadavg_LIBS=$LIBS
+ LIBS="-L/usr/local/lib $LIBS"
AC_CHECK_LIB(getloadavg, getloadavg,
- LIBS="-lgetloadavg $LIBS", LIBS=$ac_getloadavg_LIBS)
+ [LIBS="-lgetloadavg $LIBS"], [LIBS=$ac_getloadavg_LIBS])
fi
# Make sure it is really in the library, if we think we found it.
[Define if your system has its own `getloadavg' function.])
ac_have_func=yes
else
+ AC_DEFINE(C_GETLOADAVG, 1, [Define if using getloadavg.c.])
# Figure out what our getloadavg.c needs.
ac_have_func=no
AC_CHECK_HEADER(sys/dg_sys_info.h,
- [ac_have_func=yes;
+ [ac_have_func=yes
AC_DEFINE(DGUX, 1, [Define for DGUX with <sys/dg_sys_info.h>.])
AC_CHECK_LIB(dgc, dg_sys_info)])
+ AC_CHECK_HEADER(locale.h)
+ AC_CHECK_FUNCS(setlocale)
+
# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
# uses stabs), but it is still SVR4. We cannot check for <elf.h> because
# Irix 4.0.5F has the header but not the library.
if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then
- ac_have_func=yes;
- AC_DEFINE(SVR4, 1,
- [Define on System V Release 4.])
+ ac_have_func=yes
+ AC_DEFINE(SVR4, 1, [Define on System V Release 4.])
fi
if test $ac_have_func = no; then
AC_CHECK_HEADER(inq_stats/cpustats.h,
- [ac_have_func=yes;
- AC_DEFINE(UMAX, 1,
- [Define for Encore UMAX.])
+ [ac_have_func=yes
+ AC_DEFINE(UMAX, 1, [Define for Encore UMAX.])
AC_DEFINE(UMAX4_3, 1,
[Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
instead of <sys/cpustats.h>.])])
[#include "$srcdir/getloadavg.c"
#ifdef LDAV_PRIVILEGED
Yowza Am I SETGID yet
-#endif],
+@%:@endif],
ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])
if test $ac_cv_func_getloadavg_setgid = yes; then
- NEED_SETGID=true;
+ NEED_SETGID=true
AC_DEFINE(GETLOADAVG_PRIVILEGED, 1,
[Define if the `getloadavg' function needs to be run setuid
or setgid.])
KMEM_GROUP=$ac_cv_group_kmem
fi
AC_SUBST(KMEM_GROUP)dnl
+if test "x$ac_save_LIBS" = x; then
+ GETLOADAVG_LIBS=$LIBS
+else
+ GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$ac_save_LIBS!!"`
+fi
+AC_SUBST(GETLOADAVG_LIBS)dnl
])# AC_FUNC_GETLOADAVG
if test $ac_cv_func_working_mktime = no; then
AC_LIBOBJ([mktime])
fi
-AC_SUBST(LIBOBJS)dnl
])# AC_FUNC_MKTIME
@cvindex NLIST_NAME_UNION
@cvindex GETLODAVG_PRIVILEGED
@cvindex NEED_SETGID
+@cvindex C_GETLOADAVG
@ovindex LIBOBJS
@ovindex NEED_SETGID
@ovindex KMEM_GROUP
+@ovindex GETLOADAVG_LIBS
Check how to get the system load averages. If the system has the
-@code{getloadavg} function, this macro defines @code{HAVE_GETLOADAVG},
-and adds to @code{LIBS} any libraries needed to get that function.
+@code{getloadavg} function, define @code{HAVE_GETLOADAVG}, and set
+@code{GETLOADAVG_LIBS} to any libraries needed to get that function.
+Also add @code{GETLOADAVG_LIBS} to @code{LIBS}.
-Otherwise, it requires an @code{AC_LIBOBJ} replacement of
-@samp{getloadavg}, and possibly defines several other C preprocessor
-macros and output variables:
+Otherwise, require an @code{AC_LIBOBJ} replacement of @samp{getloadavg},
+and possibly define several other C preprocessor macros and output
+variables:
@enumerate
@item
-It defines @code{SVR4}, @code{DGUX}, @code{UMAX}, or @code{UMAX4_3} if
-on those systems.
+Define @code{SVR4}, @code{DGUX}, @code{UMAX}, or @code{UMAX4_3} if on
+those systems.
@item
-If it finds @file{nlist.h}, it defines @code{NLIST_STRUCT}.
+If @file{nlist.h} is found, define @code{NLIST_STRUCT}.
@item
-If @samp{struct nlist} has an @samp{n_un} member, it defines
+If @samp{struct nlist} has an @samp{n_un} member, define
@code{NLIST_NAME_UNION}.
@item
-If compiling @file{getloadavg.c} defines @code{LDAV_PRIVILEGED},
-programs need to be installed specially on this system for
-@code{getloadavg} to work, and this macro defines
+@c FIXME: I don't understand anything to this sentence :(
+If compiling @file{getloadavg.c} define @code{C_GETLOADAVG} and
+@code{LDAV_PRIVILEGED}, programs need to be installed specially on this
+system for @code{getloadavg} to work, and this macro defines
@code{GETLOADAVG_PRIVILEGED}.
@item
# AC_FUNC_GETLOADAVG
# ------------------
-AC_DEFUN(AC_FUNC_GETLOADAVG,
+AC_DEFUN([AC_FUNC_GETLOADAVG],
[ac_have_func=no # yes means we've found a way to get the load average.
+ac_save_LIBS=$LIBS
+
+# On HPUX9, an unprivileged user can get load averages through this function.
+AC_CHECK_FUNCS(pstat_getdynamic)
+
+# Solaris has libkstat which does not require root.
+AC_CHECK_LIB(kstat, kstat_open)
+test $ac_cv_lib_kstat_kstat_open = yes && ac_have_func=yes
+
# Some systems with -lutil have (and need) -lkvm as well, some do not.
# On Solaris, -lkvm requires nlist from -lelf, so check that first
# to get the right answer into the cache.
+# For kstat on solaris, we need libelf to force the definition of SVR4 below.
AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
-AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
-AC_CHECK_LIB(kstat, kstat_open)
-# Check for the 4.4BSD definition of getloadavg.
-AC_CHECK_LIB(util, getloadavg,
- [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
+if test $ac_have_func = no; then
+ AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
+ # Check for the 4.4BSD definition of getloadavg.
+ AC_CHECK_LIB(util, getloadavg,
+ [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
+fi
if test $ac_have_func = no; then
# There is a commonly available library for RS/6000 AIX.
# Since it is not a standard part of AIX, it might be installed locally.
- ac_getloadavg_LIBS=$LIBS; LIBS="-L/usr/local/lib $LIBS"
+ ac_getloadavg_LIBS=$LIBS
+ LIBS="-L/usr/local/lib $LIBS"
AC_CHECK_LIB(getloadavg, getloadavg,
- LIBS="-lgetloadavg $LIBS", LIBS=$ac_getloadavg_LIBS)
+ [LIBS="-lgetloadavg $LIBS"], [LIBS=$ac_getloadavg_LIBS])
fi
# Make sure it is really in the library, if we think we found it.
[Define if your system has its own `getloadavg' function.])
ac_have_func=yes
else
+ AC_DEFINE(C_GETLOADAVG, 1, [Define if using getloadavg.c.])
# Figure out what our getloadavg.c needs.
ac_have_func=no
AC_CHECK_HEADER(sys/dg_sys_info.h,
- [ac_have_func=yes;
+ [ac_have_func=yes
AC_DEFINE(DGUX, 1, [Define for DGUX with <sys/dg_sys_info.h>.])
AC_CHECK_LIB(dgc, dg_sys_info)])
+ AC_CHECK_HEADER(locale.h)
+ AC_CHECK_FUNCS(setlocale)
+
# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
# uses stabs), but it is still SVR4. We cannot check for <elf.h> because
# Irix 4.0.5F has the header but not the library.
if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then
- ac_have_func=yes;
- AC_DEFINE(SVR4, 1,
- [Define on System V Release 4.])
+ ac_have_func=yes
+ AC_DEFINE(SVR4, 1, [Define on System V Release 4.])
fi
if test $ac_have_func = no; then
AC_CHECK_HEADER(inq_stats/cpustats.h,
- [ac_have_func=yes;
- AC_DEFINE(UMAX, 1,
- [Define for Encore UMAX.])
+ [ac_have_func=yes
+ AC_DEFINE(UMAX, 1, [Define for Encore UMAX.])
AC_DEFINE(UMAX4_3, 1,
[Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
instead of <sys/cpustats.h>.])])
[#include "$srcdir/getloadavg.c"
#ifdef LDAV_PRIVILEGED
Yowza Am I SETGID yet
-#endif],
+@%:@endif],
ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])
if test $ac_cv_func_getloadavg_setgid = yes; then
- NEED_SETGID=true;
+ NEED_SETGID=true
AC_DEFINE(GETLOADAVG_PRIVILEGED, 1,
[Define if the `getloadavg' function needs to be run setuid
or setgid.])
KMEM_GROUP=$ac_cv_group_kmem
fi
AC_SUBST(KMEM_GROUP)dnl
+if test "x$ac_save_LIBS" = x; then
+ GETLOADAVG_LIBS=$LIBS
+else
+ GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$ac_save_LIBS!!"`
+fi
+AC_SUBST(GETLOADAVG_LIBS)dnl
])# AC_FUNC_GETLOADAVG
if test $ac_cv_func_working_mktime = no; then
AC_LIBOBJ([mktime])
fi
-AC_SUBST(LIBOBJS)dnl
])# AC_FUNC_MKTIME
[^(cross_compiling)=],
[^(interpval)=],
[^(f77_(case|underscore))=],
- [^(ALLOCA|NEED_SETGID|KMEM_GROUP)=],
+ [^(ALLOCA|GETLOADAVG_LIBS|KMEM_GROUP|NEED_SETGID)=],
[^(AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|RANLIB|SET_MAKE|YACC)=],
[^(_|LINENO|OLDPWD|PIPESTATUS|RANDOM|SECONDS)=])' |
# There maybe variables spread on several lines, eg IFS, remove the dead