GNULIB_CLOSE
GNULIB_CHOWN
GETLOADAVG_LIBS
-KMEM_GROUP
-NEED_SETGID
REPLACE_UNSETENV
REPLACE_STRTOD
REPLACE_SETENV
LIBS
CPPFLAGS
CPP
+CPPFLAGS
+CPP
+CPPFLAGS
XMKMF'
# Persuade glibc <stdlib.h> to declare getloadavg().
-gl_have_func=no # yes means we've found a way to get the load average.
-
# Make sure getloadavg.c is where it belongs, at configure-time.
test -f "$srcdir/$gl_source_base/getloadavg.c" ||
as_fn_error $? "$srcdir/$gl_source_base/getloadavg.c is missing" "$LINENO" 5
gl_save_LIBS=$LIBS
-# Check for getloadavg, but be sure not to touch the cache variable.
-(ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg"
+ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg"
if test "x$ac_cv_func_getloadavg" = xyes; then :
- exit 0
-else
- exit 1
-fi
-) && gl_have_func=yes
-
-# On HPUX9, an unprivileged user can get load averages through this function.
-for ac_func in pstat_getdynamic
-do :
- ac_fn_c_check_func "$LINENO" "pstat_getdynamic" "ac_cv_func_pstat_getdynamic"
-if test "x$ac_cv_func_pstat_getdynamic" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_PSTAT_GETDYNAMIC 1
-_ACEOF
-
-fi
-done
+else
+ gl_have_func=no
-# Solaris has libkstat which does not require root.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for kstat_open in -lkstat" >&5
-$as_echo_n "checking for kstat_open in -lkstat... " >&6; }
-if ${ac_cv_lib_kstat_kstat_open+:} false; then :
+ # 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 to test for libelf and libkvm to force the
+ # definition of SVR4 below.
+ if test $gl_have_func = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for elf_begin in -lelf" >&5
+$as_echo_n "checking for elf_begin in -lelf... " >&6; }
+if ${ac_cv_lib_elf_elf_begin+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkstat $LIBS"
+LIBS="-lelf $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __cplusplus
extern "C"
#endif
-char kstat_open ();
+char elf_begin ();
int
main ()
{
-return kstat_open ();
+return elf_begin ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_kstat_kstat_open=yes
+ ac_cv_lib_elf_elf_begin=yes
else
- ac_cv_lib_kstat_kstat_open=no
+ ac_cv_lib_elf_elf_begin=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kstat_kstat_open" >&5
-$as_echo "$ac_cv_lib_kstat_kstat_open" >&6; }
-if test "x$ac_cv_lib_kstat_kstat_open" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBKSTAT 1
-_ACEOF
-
- LIBS="-lkstat $LIBS"
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_elf_elf_begin" >&5
+$as_echo "$ac_cv_lib_elf_elf_begin" >&6; }
+if test "x$ac_cv_lib_elf_elf_begin" = xyes; then :
+ LIBS="-lelf $LIBS"
fi
-test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes
-
-# AIX has libperfstat which does not require root
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for perfstat_cpu_total in -lperfstat" >&5
-$as_echo_n "checking for perfstat_cpu_total in -lperfstat... " >&6; }
-if ${ac_cv_lib_perfstat_perfstat_cpu_total+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5
+$as_echo_n "checking for kvm_open in -lkvm... " >&6; }
+if ${ac_cv_lib_kvm_kvm_open+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lperfstat $LIBS"
+LIBS="-lkvm $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __cplusplus
extern "C"
#endif
-char perfstat_cpu_total ();
+char kvm_open ();
int
main ()
{
-return perfstat_cpu_total ();
+return kvm_open ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_perfstat_perfstat_cpu_total=yes
+ ac_cv_lib_kvm_kvm_open=yes
else
- ac_cv_lib_perfstat_perfstat_cpu_total=no
+ ac_cv_lib_kvm_kvm_open=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_perfstat_perfstat_cpu_total" >&5
-$as_echo "$ac_cv_lib_perfstat_perfstat_cpu_total" >&6; }
-if test "x$ac_cv_lib_perfstat_perfstat_cpu_total" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPERFSTAT 1
-_ACEOF
-
- LIBS="-lperfstat $LIBS"
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5
+$as_echo "$ac_cv_lib_kvm_kvm_open" >&6; }
+if test "x$ac_cv_lib_kvm_kvm_open" = xyes; then :
+ LIBS="-lkvm $LIBS"
fi
-test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_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 to test for libelf and libkvm to force the
-# definition of SVR4 below.
-if test $gl_have_func = no; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for elf_begin in -lelf" >&5
-$as_echo_n "checking for elf_begin in -lelf... " >&6; }
-if ${ac_cv_lib_elf_elf_begin+:} false; then :
+ # Check for the 4.4BSD definition of getloadavg.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getloadavg in -lutil" >&5
+$as_echo_n "checking for getloadavg in -lutil... " >&6; }
+if ${ac_cv_lib_util_getloadavg+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lelf $LIBS"
+LIBS="-lutil $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __cplusplus
extern "C"
#endif
-char elf_begin ();
+char getloadavg ();
int
main ()
{
-return elf_begin ();
+return getloadavg ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_elf_elf_begin=yes
+ ac_cv_lib_util_getloadavg=yes
else
- ac_cv_lib_elf_elf_begin=no
+ ac_cv_lib_util_getloadavg=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_elf_elf_begin" >&5
-$as_echo "$ac_cv_lib_elf_elf_begin" >&6; }
-if test "x$ac_cv_lib_elf_elf_begin" = xyes; then :
- LIBS="-lelf $LIBS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_getloadavg" >&5
+$as_echo "$ac_cv_lib_util_getloadavg" >&6; }
+if test "x$ac_cv_lib_util_getloadavg" = xyes; then :
+ LIBS="-lutil $LIBS" gl_have_func=yes
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5
-$as_echo_n "checking for kvm_open in -lkvm... " >&6; }
-if ${ac_cv_lib_kvm_kvm_open+:} false; then :
+ fi
+
+ if test $gl_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.
+ gl_getloadavg_LIBS=$LIBS
+ LIBS="-L/usr/local/lib $LIBS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getloadavg in -lgetloadavg" >&5
+$as_echo_n "checking for getloadavg in -lgetloadavg... " >&6; }
+if ${ac_cv_lib_getloadavg_getloadavg+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkvm $LIBS"
+LIBS="-lgetloadavg $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __cplusplus
extern "C"
#endif
-char kvm_open ();
+char getloadavg ();
int
main ()
{
-return kvm_open ();
+return getloadavg ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_kvm_kvm_open=yes
+ ac_cv_lib_getloadavg_getloadavg=yes
else
- ac_cv_lib_kvm_kvm_open=no
+ ac_cv_lib_getloadavg_getloadavg=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5
-$as_echo "$ac_cv_lib_kvm_kvm_open" >&6; }
-if test "x$ac_cv_lib_kvm_kvm_open" = xyes; then :
- LIBS="-lkvm $LIBS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_getloadavg_getloadavg" >&5
+$as_echo "$ac_cv_lib_getloadavg_getloadavg" >&6; }
+if test "x$ac_cv_lib_getloadavg_getloadavg" = xyes; then :
+ LIBS="-lgetloadavg $LIBS" gl_have_func=yes
+else
+ LIBS=$gl_getloadavg_LIBS
fi
- # Check for the 4.4BSD definition of getloadavg.
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getloadavg in -lutil" >&5
-$as_echo_n "checking for getloadavg in -lutil... " >&6; }
-if ${ac_cv_lib_util_getloadavg+:} false; then :
+ fi
+
+ # Set up the replacement function if necessary.
+ if test $gl_have_func = no; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS getloadavg.$ac_objext"
+
+
+# Figure out what our getloadavg.c needs.
+
+# Solaris has libkstat which does not require root.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for kstat_open in -lkstat" >&5
+$as_echo_n "checking for kstat_open in -lkstat... " >&6; }
+if ${ac_cv_lib_kstat_kstat_open+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lutil $LIBS"
+LIBS="-lkstat $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __cplusplus
extern "C"
#endif
-char getloadavg ();
+char kstat_open ();
int
main ()
{
-return getloadavg ();
+return kstat_open ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_util_getloadavg=yes
+ ac_cv_lib_kstat_kstat_open=yes
else
- ac_cv_lib_util_getloadavg=no
+ ac_cv_lib_kstat_kstat_open=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_getloadavg" >&5
-$as_echo "$ac_cv_lib_util_getloadavg" >&6; }
-if test "x$ac_cv_lib_util_getloadavg" = xyes; then :
- LIBS="-lutil $LIBS" gl_have_func=yes gl_cv_func_getloadavg_setgid=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kstat_kstat_open" >&5
+$as_echo "$ac_cv_lib_kstat_kstat_open" >&6; }
+if test "x$ac_cv_lib_kstat_kstat_open" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBKSTAT 1
+_ACEOF
+
+ LIBS="-lkstat $LIBS"
+
fi
+test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes
+
+# On HPUX9, an unprivileged user can get load averages this way.
+if test $gl_have_func = no; then
+ for ac_func in pstat_getdynamic
+do :
+ ac_fn_c_check_func "$LINENO" "pstat_getdynamic" "ac_cv_func_pstat_getdynamic"
+if test "x$ac_cv_func_pstat_getdynamic" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_PSTAT_GETDYNAMIC 1
+_ACEOF
+ gl_have_func=yes
+fi
+done
+
fi
+# AIX has libperfstat which does not require root
if test $gl_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.
- gl_getloadavg_LIBS=$LIBS
- LIBS="-L/usr/local/lib $LIBS"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getloadavg in -lgetloadavg" >&5
-$as_echo_n "checking for getloadavg in -lgetloadavg... " >&6; }
-if ${ac_cv_lib_getloadavg_getloadavg+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perfstat_cpu_total in -lperfstat" >&5
+$as_echo_n "checking for perfstat_cpu_total in -lperfstat... " >&6; }
+if ${ac_cv_lib_perfstat_perfstat_cpu_total+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgetloadavg $LIBS"
+LIBS="-lperfstat $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __cplusplus
extern "C"
#endif
-char getloadavg ();
+char perfstat_cpu_total ();
int
main ()
{
-return getloadavg ();
+return perfstat_cpu_total ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_getloadavg_getloadavg=yes
+ ac_cv_lib_perfstat_perfstat_cpu_total=yes
else
- ac_cv_lib_getloadavg_getloadavg=no
+ ac_cv_lib_perfstat_perfstat_cpu_total=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_getloadavg_getloadavg" >&5
-$as_echo "$ac_cv_lib_getloadavg_getloadavg" >&6; }
-if test "x$ac_cv_lib_getloadavg_getloadavg" = xyes; then :
- LIBS="-lgetloadavg $LIBS"
-else
- LIBS=$gl_getloadavg_LIBS
-fi
-
-fi
-
-# Make sure it is really in the library, if we think we found it,
-# otherwise set up the replacement function.
-for ac_func in getloadavg
-do :
- ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg"
-if test "x$ac_cv_func_getloadavg" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_perfstat_perfstat_cpu_total" >&5
+$as_echo "$ac_cv_lib_perfstat_perfstat_cpu_total" >&6; }
+if test "x$ac_cv_lib_perfstat_perfstat_cpu_total" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_GETLOADAVG 1
+#define HAVE_LIBPERFSTAT 1
_ACEOF
-else
-
-
-
-
-
-
-
-
- gl_LIBOBJS="$gl_LIBOBJS getloadavg.$ac_objext"
+ LIBS="-lperfstat $LIBS"
+fi
-$as_echo "#define C_GETLOADAVG 1" >>confdefs.h
+ test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_have_func=yes
+fi
-# Figure out what our getloadavg.c needs.
-gl_have_func=no
-ac_fn_c_check_header_mongrel "$LINENO" "sys/dg_sys_info.h" "ac_cv_header_sys_dg_sys_info_h" "$ac_includes_default"
+if test $gl_have_func = no; then
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/dg_sys_info.h" "ac_cv_header_sys_dg_sys_info_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_dg_sys_info_h" = xyes; then :
gl_have_func=yes
$as_echo "#define DGUX 1" >>confdefs.h
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dg_sys_info in -ldgc" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dg_sys_info in -ldgc" >&5
$as_echo_n "checking for dg_sys_info in -ldgc... " >&6; }
if ${ac_cv_lib_dgc_dg_sys_info+:} false; then :
$as_echo_n "(cached) " >&6
fi
+fi
# 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
_ACEOF
-$as_echo "#define NLIST_NAME_UNION 1" >>confdefs.h
-
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
done
-fi
-done
-
-
-# Some definitions of getloadavg require that the program be installed setgid.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getloadavg requires setgid" >&5
-$as_echo_n "checking whether getloadavg requires setgid... " >&6; }
-if ${gl_cv_func_getloadavg_setgid+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#define CONFIGURING_GETLOADAVG
-#include "$srcdir/$gl_source_base/getloadavg.c"
-#ifdef LDAV_PRIVILEGED
-Yowza Am I SETGID yet
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "Yowza Am I SETGID yet" >/dev/null 2>&1; then :
- gl_cv_func_getloadavg_setgid=yes
-else
- gl_cv_func_getloadavg_setgid=no
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getloadavg_setgid" >&5
-$as_echo "$gl_cv_func_getloadavg_setgid" >&6; }
-if test $gl_cv_func_getloadavg_setgid = yes; then
- NEED_SETGID=true
-
-$as_echo "#define GETLOADAVG_PRIVILEGED 1" >>confdefs.h
-
-else
- NEED_SETGID=false
+ fi
fi
-if test $gl_cv_func_getloadavg_setgid = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking group of /dev/kmem" >&5
-$as_echo_n "checking group of /dev/kmem... " >&6; }
-if ${gl_cv_group_kmem+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- # On Solaris, /dev/kmem is a symlink. Get info on the real file.
- ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
- # If we got an error (system does not support symlinks), try without -L.
- test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
- gl_cv_group_kmem=`echo $ac_ls_output \
- | sed -ne 's/[ ][ ]*/ /g
- s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/
- / /s/.* //;p'`
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_group_kmem" >&5
-$as_echo "$gl_cv_group_kmem" >&6; }
- KMEM_GROUP=$gl_cv_group_kmem
-fi
if test "x$gl_save_LIBS" = x; then
GETLOADAVG_LIBS=$LIBS
else
# Persuade glibc <stdlib.h> to declare getloadavg().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-gl_have_func=no # yes means we've found a way to get the load average.
-
# Make sure getloadavg.c is where it belongs, at configure-time.
test -f "$srcdir/$1/getloadavg.c" ||
AC_MSG_ERROR([$srcdir/$1/getloadavg.c is missing])
gl_save_LIBS=$LIBS
-# Check for getloadavg, but be sure not to touch the cache variable.
-(AC_CHECK_FUNC([getloadavg], [exit 0], [exit 1])) && gl_have_func=yes
-
-# 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 && gl_have_func=yes
+AC_CHECK_FUNC([getloadavg], [],
+ [gl_have_func=no
+
+ # 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 to test for libelf and libkvm to force the
+ # definition of SVR4 below.
+ if test $gl_have_func = no; then
+ AC_CHECK_LIB([elf], [elf_begin], [LIBS="-lelf $LIBS"])
+ 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" gl_have_func=yes])
+ fi
+
+ if test $gl_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.
+ gl_getloadavg_LIBS=$LIBS
+ LIBS="-L/usr/local/lib $LIBS"
+ AC_CHECK_LIB([getloadavg], [getloadavg],
+ [LIBS="-lgetloadavg $LIBS" gl_have_func=yes],
+ [LIBS=$gl_getloadavg_LIBS])
+ fi
+
+ # Set up the replacement function if necessary.
+ if test $gl_have_func = no; then
+ AC_LIBOBJ([getloadavg])
+ gl_PREREQ_GETLOADAVG
+ fi])
-# AIX has libperfstat which does not require root
-AC_CHECK_LIB([perfstat], [perfstat_cpu_total])
-test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_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 to test for libelf and libkvm to force the
-# definition of SVR4 below.
-if test $gl_have_func = no; then
- AC_CHECK_LIB([elf], [elf_begin], [LIBS="-lelf $LIBS"])
- 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" gl_have_func=yes gl_cv_func_getloadavg_setgid=yes])
-fi
-
-if test $gl_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.
- gl_getloadavg_LIBS=$LIBS
- LIBS="-L/usr/local/lib $LIBS"
- AC_CHECK_LIB([getloadavg], [getloadavg],
- [LIBS="-lgetloadavg $LIBS"], [LIBS=$gl_getloadavg_LIBS])
-fi
-
-# Make sure it is really in the library, if we think we found it,
-# otherwise set up the replacement function.
-AC_CHECK_FUNCS([getloadavg], [],
- [gl_PREREQ_GETLOADAVG])
-
-# Some definitions of getloadavg require that the program be installed setgid.
-AC_CACHE_CHECK([whether getloadavg requires setgid],
- gl_cv_func_getloadavg_setgid,
-[AC_EGREP_CPP([Yowza Am I SETGID yet],
-[#define CONFIGURING_GETLOADAVG
-#include "$srcdir/$1/getloadavg.c"
-#ifdef LDAV_PRIVILEGED
-Yowza Am I SETGID yet
-#endif
-],
- gl_cv_func_getloadavg_setgid=yes,
- gl_cv_func_getloadavg_setgid=no)])
-if test $gl_cv_func_getloadavg_setgid = yes; then
- NEED_SETGID=true
- AC_DEFINE([GETLOADAVG_PRIVILEGED], [1],
- [Define to 1 if the `getloadavg' function needs to be run setuid
- or setgid.])
-else
- NEED_SETGID=false
-fi
-AC_SUBST([NEED_SETGID])dnl
-
-if test $gl_cv_func_getloadavg_setgid = yes; then
- AC_CACHE_CHECK([group of /dev/kmem], [gl_cv_group_kmem],
-[ # On Solaris, /dev/kmem is a symlink. Get info on the real file.
- ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
- # If we got an error (system does not support symlinks), try without -L.
- test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
- gl_cv_group_kmem=`echo $ac_ls_output \
- | sed -ne ['s/[ ][ ]*/ /g
- s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/
- / /s/.* //;p']`
-])
- AC_SUBST([KMEM_GROUP], [$gl_cv_group_kmem])dnl
-fi
if test "x$gl_save_LIBS" = x; then
GETLOADAVG_LIBS=$LIBS
else
# --------------------
# Set up the AC_LIBOBJ replacement of `getloadavg'.
AC_DEFUN([gl_PREREQ_GETLOADAVG],
-[AC_LIBOBJ([getloadavg])
-AC_DEFINE([C_GETLOADAVG], [1], [Define to 1 if using `getloadavg.c'.])
+[
# Figure out what our getloadavg.c needs.
-gl_have_func=no
-AC_CHECK_HEADER([sys/dg_sys_info.h],
-[gl_have_func=yes
- AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
- AC_CHECK_LIB([dgc], [dg_sys_info])])
+
+# Solaris has libkstat which does not require root.
+AC_CHECK_LIB([kstat], [kstat_open])
+test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes
+
+# On HPUX9, an unprivileged user can get load averages this way.
+if test $gl_have_func = no; then
+ AC_CHECK_FUNCS([pstat_getdynamic], [gl_have_func=yes])
+fi
+
+# AIX has libperfstat which does not require root
+if test $gl_have_func = no; then
+ AC_CHECK_LIB([perfstat], [perfstat_cpu_total])
+ test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_have_func=yes
+fi
+
+if test $gl_have_func = no; then
+ AC_CHECK_HEADER([sys/dg_sys_info.h],
+ [gl_have_func=yes
+ AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
+ AC_CHECK_LIB([dgc], [dg_sys_info])])
+fi
# 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
AC_CHECK_HEADERS([nlist.h],
[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
- [AC_DEFINE([NLIST_NAME_UNION], [1],
- [Define to 1 if your `struct nlist' has an
- `n_un' member. Obsolete, depend on
- `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [],
+ [], [],
[@%:@include <nlist.h>])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
[[struct nlist x;