From: Akim Demaille Date: Fri, 26 May 2000 08:37:38 +0000 (+0000) Subject: No library nor special privilege is needed to run `getloadavg' X-Git-Tag: autoconf-2.50~862 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa8bef1fcd635c2ececa034591b1b87a33cb6469;p=thirdparty%2Fautoconf.git 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. --- diff --git a/ChangeLog b/ChangeLog index 1c52b0af1..abdb39ae5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2000-05-26 Akim Demaille + + 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 * doc/autoconf.texi (Limitations of Usual Tools, Limitations of diff --git a/THANKS b/THANKS index 5c13db352..bea9bd530 100644 --- 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 diff --git a/acspecific.m4 b/acspecific.m4 index 3b85025de..2d04307ba 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -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. diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 3b85025de..2d04307ba 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -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.