]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
No library nor special privilege is needed to run `getloadavg'
authorAkim Demaille <akim@epita.fr>
Fri, 26 May 2000 08:37:38 +0000 (08:37 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 26 May 2000 08:37:38 +0000 (08:37 +0000)
under FreeBSD.
Reported by Alec Wolman.

* acspecific.m4 (AC_FUNC_GETLOADAVG): Check for `getloadavg'
without any additional library.
Fixes Autoconf/109.

ChangeLog
THANKS
acspecific.m4
lib/autoconf/specific.m4

index 1c52b0af13eb20dc12535104a477037e0005a512..abdb39ae5be25a4253b3e928286c397bbb13ea21 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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
diff --git a/THANKS b/THANKS
index 5c13db3529d333035c4798b2492bdde8e080bd22..bea9bd530e2a08fca67e1991be511985db13a18f 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -6,6 +6,7 @@ Aaron Crane             aaronc@pobox.com
 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
index 3b85025de879cca8b9569d83be240e582ef4b71e..2d04307baa42443fa683790ebe7e1e6575e991f2 100644 (file)
@@ -895,6 +895,46 @@ fi
 ])# 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'.
@@ -948,46 +988,6 @@ AC_CHECK_HEADERS(nlist.h,
 ])# _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],
@@ -995,6 +995,9 @@ 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)
 
@@ -1006,7 +1009,9 @@ test $ac_cv_lib_kstat_kstat_open = yes && ac_have_func=yes
 # 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.
index 3b85025de879cca8b9569d83be240e582ef4b71e..2d04307baa42443fa683790ebe7e1e6575e991f2 100644 (file)
@@ -895,6 +895,46 @@ fi
 ])# 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'.
@@ -948,46 +988,6 @@ AC_CHECK_HEADERS(nlist.h,
 ])# _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],
@@ -995,6 +995,9 @@ 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)
 
@@ -1006,7 +1009,9 @@ test $ac_cv_lib_kstat_kstat_open = yes && ac_have_func=yes
 # 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.