]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Synchronize AC_FUNC_GETLOADAVG with the version of the shellutils
authorAkim Demaille <akim@epita.fr>
Fri, 19 May 2000 12:08:46 +0000 (12:08 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 19 May 2000 12:08:46 +0000 (12:08 +0000)
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)'.

ChangeLog
acspecific.m4
doc/autoconf.texi
lib/autoconf/specific.m4
tests/aclocal.m4

index 541a4d6c5888dfc02594dbf68d7c494ee430945d..f6d159feba6deb9817ae2fc20870d26f429f13e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+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.
index 3de2c5d26efdd7c17b38c829bc284a56e43fb789..1096bc3ba3b9577b0272de3dc78b99fdd87df625 100644 (file)
@@ -859,25 +859,37 @@ fi
 
 # 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.
@@ -888,27 +900,29 @@ if test $ac_cv_func_getloadavg = yes; then
             [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>.])])
@@ -946,10 +960,10 @@ AC_CACHE_CHECK(whether getloadavg requires setgid,
 [#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.])
@@ -972,6 +986,12 @@ if test $ac_cv_func_getloadavg_setgid = yes; then
   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
 
 
@@ -1208,7 +1228,6 @@ ac_cv_func_working_mktime=no)])
 if test $ac_cv_func_working_mktime = no; then
   AC_LIBOBJ([mktime])
 fi
-AC_SUBST(LIBOBJS)dnl
 ])# AC_FUNC_MKTIME
 
 
index 1e0c667b175bc8746b1dea38f949624b09a77cda..da72c73767e13b9bc7dd928edfbe32368c97485f 100644 (file)
@@ -2870,33 +2870,37 @@ SunOS 5.4), define @code{HAVE_FNMATCH}.
 @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
index 3de2c5d26efdd7c17b38c829bc284a56e43fb789..1096bc3ba3b9577b0272de3dc78b99fdd87df625 100644 (file)
@@ -859,25 +859,37 @@ fi
 
 # 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.
@@ -888,27 +900,29 @@ if test $ac_cv_func_getloadavg = yes; then
             [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>.])])
@@ -946,10 +960,10 @@ AC_CACHE_CHECK(whether getloadavg requires setgid,
 [#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.])
@@ -972,6 +986,12 @@ if test $ac_cv_func_getloadavg_setgid = yes; then
   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
 
 
@@ -1208,7 +1228,6 @@ ac_cv_func_working_mktime=no)])
 if test $ac_cv_func_working_mktime = no; then
   AC_LIBOBJ([mktime])
 fi
-AC_SUBST(LIBOBJS)dnl
 ])# AC_FUNC_MKTIME
 
 
index ef2a8b3dbb9dbedf60f0b210681fb23ae676a4e0..f81be737356f3cbbd2fd8e029074444f7bab65c2 100644 (file)
@@ -40,7 +40,7 @@ AC_DEFUN(AC_ENV_SAVE,
       [^(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