under FreeBSD.
Reported by Alec Wolman.
* acspecific.m4 (AC_FUNC_GETLOADAVG): Check for `getloadavg'
without any additional library.
Fixes Autoconf/109.
+2000-05-26 Akim Demaille <akim@epita.fr>
+
+ No library nor special privilege is needed to run `getloadavg'
+ under FreeBSD.
+ Reported by Alec Wolman.
+
+ * acspecific.m4 (AC_FUNC_GETLOADAVG): Check for `getloadavg'
+ without any additional library.
+ Fixes Autoconf/109.
+
2000-05-26 Akim Demaille <akim@epita.fr>
* doc/autoconf.texi (Limitations of Usual Tools, Limitations of
Aharon Robbins arnold@gnu.org
Akim Demaille akim@epita.fr
Alain Knaff Alain.Knaff@imag.fr
+Alec Wolman wolman@cs.washington.edu
Alexandre Oliva oliva@lsd.ic.unicamp.br
Andreas Schott schott@rzg.mpg.de
Andreas Schwab schwab@issan.informatik.uni-dortmund.de
])# AC_FUNC_FNMATCH
+# AC_FUNC_GETGROUPS
+# -----------------
+# Try to find `getgroups', and check that it works.
+# When crosscompiling, assume getgroups is broken.
+AC_DEFUN([AC_FUNC_GETGROUPS],
+[AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
+AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+AC_CHECK_FUNC(getgroups)
+
+# If we don't yet have getgroups, see if it's in -lbsd.
+# This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
+ac_save_LIBS=$LIBS
+if test $ac_cv_func_getgroups = no; then
+ AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
+fi
+
+# Run the program to test the functionality of the system-supplied
+# getgroups function only if there is such a function.
+if test $ac_cv_func_getgroups = yes; then
+ AC_CACHE_CHECK([for working getgroups], ac_cv_func_getgroups_works,
+ [AC_TRY_RUN([
+ int
+ main ()
+ {
+ /* On Ultrix 4.3, getgroups (0, 0) always fails. */
+ exit (getgroups (0, 0) == -1 ? 1 : 0);
+ }],
+ ac_cv_func_getgroups_works=yes,
+ ac_cv_func_getgroups_works=no,
+ ac_cv_func_getgroups_works=no)
+ ])
+ if test $ac_cv_func_getgroups_works = yes; then
+ AC_DEFINE(HAVE_GETGROUPS, 1,
+ [Define if your system has a working `getgroups' function.])
+ fi
+fi
+LIBS=$ac_save_LIBS
+])# AC_FUNC_GETGROUPS
+
+
# _AC_LIBOBJ_GETLOADAVG
# ---------------------
# Set up the AC_LIBOBJ replacement of `getloadavg'.
])# _AC_LIBOBJ_GETLOADAVG
-# AC_FUNC_GETGROUPS
-# -----------------
-# Try to find `getgroups', and check that it works.
-# When crosscompiling, assume getgroups is broken.
-AC_DEFUN([AC_FUNC_GETGROUPS],
-[AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
-AC_REQUIRE([AC_TYPE_SIZE_T])dnl
-AC_CHECK_FUNC(getgroups)
-
-# If we don't yet have getgroups, see if it's in -lbsd.
-# This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
-ac_save_LIBS=$LIBS
-if test $ac_cv_func_getgroups = no; then
- AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
-fi
-
-# Run the program to test the functionality of the system-supplied
-# getgroups function only if there is such a function.
-if test $ac_cv_func_getgroups = yes; then
- AC_CACHE_CHECK([for working getgroups], ac_cv_func_getgroups_works,
- [AC_TRY_RUN([
- int
- main ()
- {
- /* On Ultrix 4.3, getgroups (0, 0) always fails. */
- exit (getgroups (0, 0) == -1 ? 1 : 0);
- }],
- ac_cv_func_getgroups_works=yes,
- ac_cv_func_getgroups_works=no,
- ac_cv_func_getgroups_works=no)
- ])
- if test $ac_cv_func_getgroups_works = yes; then
- AC_DEFINE(HAVE_GETGROUPS, 1,
- [Define if your system has a working `getgroups' function.])
- fi
-fi
-LIBS=$ac_save_LIBS
-])# AC_FUNC_GETGROUPS
-
-
# AC_FUNC_GETLOADAVG
# ------------------
AC_DEFUN([AC_FUNC_GETLOADAVG],
ac_save_LIBS=$LIBS
+# Check for getloadavg, but be sure not to touch the cache variable.
+(AC_CHECK_FUNC(getloadavg, exit 0, exit 1)) && ac_have_func=yes
+
# On HPUX9, an unprivileged user can get load averages through this function.
AC_CHECK_FUNCS(pstat_getdynamic)
# 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")
+if test $ac_have_func = no; then
+ AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
+fi
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_FUNC_FNMATCH
+# AC_FUNC_GETGROUPS
+# -----------------
+# Try to find `getgroups', and check that it works.
+# When crosscompiling, assume getgroups is broken.
+AC_DEFUN([AC_FUNC_GETGROUPS],
+[AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
+AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+AC_CHECK_FUNC(getgroups)
+
+# If we don't yet have getgroups, see if it's in -lbsd.
+# This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
+ac_save_LIBS=$LIBS
+if test $ac_cv_func_getgroups = no; then
+ AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
+fi
+
+# Run the program to test the functionality of the system-supplied
+# getgroups function only if there is such a function.
+if test $ac_cv_func_getgroups = yes; then
+ AC_CACHE_CHECK([for working getgroups], ac_cv_func_getgroups_works,
+ [AC_TRY_RUN([
+ int
+ main ()
+ {
+ /* On Ultrix 4.3, getgroups (0, 0) always fails. */
+ exit (getgroups (0, 0) == -1 ? 1 : 0);
+ }],
+ ac_cv_func_getgroups_works=yes,
+ ac_cv_func_getgroups_works=no,
+ ac_cv_func_getgroups_works=no)
+ ])
+ if test $ac_cv_func_getgroups_works = yes; then
+ AC_DEFINE(HAVE_GETGROUPS, 1,
+ [Define if your system has a working `getgroups' function.])
+ fi
+fi
+LIBS=$ac_save_LIBS
+])# AC_FUNC_GETGROUPS
+
+
# _AC_LIBOBJ_GETLOADAVG
# ---------------------
# Set up the AC_LIBOBJ replacement of `getloadavg'.
])# _AC_LIBOBJ_GETLOADAVG
-# AC_FUNC_GETGROUPS
-# -----------------
-# Try to find `getgroups', and check that it works.
-# When crosscompiling, assume getgroups is broken.
-AC_DEFUN([AC_FUNC_GETGROUPS],
-[AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
-AC_REQUIRE([AC_TYPE_SIZE_T])dnl
-AC_CHECK_FUNC(getgroups)
-
-# If we don't yet have getgroups, see if it's in -lbsd.
-# This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
-ac_save_LIBS=$LIBS
-if test $ac_cv_func_getgroups = no; then
- AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
-fi
-
-# Run the program to test the functionality of the system-supplied
-# getgroups function only if there is such a function.
-if test $ac_cv_func_getgroups = yes; then
- AC_CACHE_CHECK([for working getgroups], ac_cv_func_getgroups_works,
- [AC_TRY_RUN([
- int
- main ()
- {
- /* On Ultrix 4.3, getgroups (0, 0) always fails. */
- exit (getgroups (0, 0) == -1 ? 1 : 0);
- }],
- ac_cv_func_getgroups_works=yes,
- ac_cv_func_getgroups_works=no,
- ac_cv_func_getgroups_works=no)
- ])
- if test $ac_cv_func_getgroups_works = yes; then
- AC_DEFINE(HAVE_GETGROUPS, 1,
- [Define if your system has a working `getgroups' function.])
- fi
-fi
-LIBS=$ac_save_LIBS
-])# AC_FUNC_GETGROUPS
-
-
# AC_FUNC_GETLOADAVG
# ------------------
AC_DEFUN([AC_FUNC_GETLOADAVG],
ac_save_LIBS=$LIBS
+# Check for getloadavg, but be sure not to touch the cache variable.
+(AC_CHECK_FUNC(getloadavg, exit 0, exit 1)) && ac_have_func=yes
+
# On HPUX9, an unprivileged user can get load averages through this function.
AC_CHECK_FUNCS(pstat_getdynamic)
# 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")
+if test $ac_have_func = no; then
+ AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
+fi
if test $ac_have_func = no; then
AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
# Check for the 4.4BSD definition of getloadavg.