emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103286: Import getloadavg module fro


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103286: Import getloadavg module from gnulib.
Date: Tue, 15 Feb 2011 16:33:44 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103286
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2011-02-15 16:33:44 -0800
message:
  Import getloadavg module from gnulib.
added:
  lib/stdlib.in.h
  m4/getloadavg.m4
  m4/stdlib_h.m4
renamed:
  src/getloadavg.c => lib/getloadavg.c
modified:
  .bzrignore
  ChangeLog
  Makefile.in
  aclocal.m4
  admin/CPP-DEFINES
  admin/ChangeLog
  admin/notes/copyright
  configure
  configure.in
  lib/Makefile.in
  lib/gnulib.mk
  m4/gl-comp.m4
  src/ChangeLog
  src/config.in
  src/deps.mk
  src/lisp.h
  src/m/alpha.h
  src/m/amdx86-64.h
  src/m/ia64.h
  src/m/ibms390.h
  src/m/macppc.h
  src/m/sparc.h
  src/m/template.h
  src/m/vax.h
  src/s/aix4-2.h
  src/s/bsd-common.h
  src/s/freebsd.h
  src/s/hpux10-20.h
  src/s/netbsd.h
  src/s/unixware.h
  src/s/usg5-4-common.h
  lib/getloadavg.c
=== modified file '.bzrignore'
--- a/.bzrignore        2011-02-13 18:35:05 +0000
+++ b/.bzrignore        2011-02-16 00:33:44 +0000
@@ -39,6 +39,7 @@
 lib/arg-nonnull.h
 lib/c++defs.h
 lib/getopt.h
+lib/stdlib.h
 lib/time.h
 lib/unistd.h
 lib/warn-on-use.h

=== modified file 'ChangeLog'
--- a/ChangeLog 2011-02-16 00:19:57 +0000
+++ b/ChangeLog 2011-02-16 00:33:44 +0000
@@ -1,3 +1,24 @@
+2011-02-16  Paul Eggert  <address@hidden>
+
+       Import getloadavg module from gnulib.
+       * .bzrignore: Add lib/stdlib.h.
+       * Makefile.in (GNULIB_MODULES): Add getloadavg.
+       * admin/notes/copyright: Remove src/getloadavg.c as a special case.
+       * configure.in (LIBS_SYSTEM): Omit -lkstat on sol2*; gnulib does this.
+       (AC_CONFIG_LIBOBJ_DIR, AC_FUNC_GETLOADAVG, GETLOADAVG_FILES):
+       Remove; gnulib does this now.
+       * lib/getloadavg.c: Rename from src/getloadavg.c, and sync
+       from gnulib.  This adds support for several other systems, such
+       as Tru64 4.0D, QNX, AIX perfstat, etc.  It also fixes a potential
+       buffer overrun on Linux hosts under very high load, and on hosts
+       that maintain a channel to the load average file it makes sure
+       the file descriptor is close-on-exec (on hosts that support this)
+       and is not stdin, stdout, or stderr.
+       * lib/stdlib.in.h, m4/getloadavg.m4, m4/stdlib_h.m4: New files,
+       from gnulib.
+       * aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4:
+       * src/config.in: Regenerate.
+
 2011-02-15  Paul Eggert  <address@hidden>
 
        Merge from gnulib.

=== modified file 'Makefile.in'
--- a/Makefile.in       2011-02-03 19:29:35 +0000
+++ b/Makefile.in       2011-02-16 00:33:44 +0000
@@ -330,7 +330,7 @@
 # Update modules from gnulib, for maintainers, who should have it in
 # $(gnulib_srcdir) (relative to $(srcdir) and should have build tools
 # as per $(gnulib_srcdir)/DEPENDENCIES.
-GNULIB_MODULES = dtoastr getopt-gnu ignore-value mktime strftime
+GNULIB_MODULES = dtoastr getloadavg getopt-gnu ignore-value mktime strftime
 GNULIB_TOOL_FLAGS = \
  --import --no-changelog --no-vc-files --makefile-name=gnulib.mk
 sync-from-gnulib: $(gnulib_srcdir)

=== modified file 'aclocal.m4'
--- a/aclocal.m4        2011-01-30 23:34:18 +0000
+++ b/aclocal.m4        2011-02-16 00:33:44 +0000
@@ -987,6 +987,7 @@
 m4_include([m4/00gnulib.m4])
 m4_include([m4/c-strtod.m4])
 m4_include([m4/extensions.m4])
+m4_include([m4/getloadavg.m4])
 m4_include([m4/getopt.m4])
 m4_include([m4/gl-comp.m4])
 m4_include([m4/gnulib-common.m4])
@@ -995,6 +996,7 @@
 m4_include([m4/multiarch.m4])
 m4_include([m4/stdbool.m4])
 m4_include([m4/stddef_h.m4])
+m4_include([m4/stdlib_h.m4])
 m4_include([m4/strftime.m4])
 m4_include([m4/time_h.m4])
 m4_include([m4/time_r.m4])

=== modified file 'admin/CPP-DEFINES'
--- a/admin/CPP-DEFINES 2011-01-15 23:16:57 +0000
+++ b/admin/CPP-DEFINES 2011-02-16 00:33:44 +0000
@@ -62,8 +62,6 @@
 SYSTEM_TYPE
 
 ** Machine specific macros, decribed in detail in src/m/template.h
-LOAD_AVE_CVT
-LOAD_AVE_TYPE
 VIRT_ADDR_VARIES
 
 ** Misc macros
@@ -111,7 +109,6 @@
 EMACS_UINT
 FILE_SYSTEM_CASE
 FLOAT_CHECK_DOMAIN
-FSCALE
 GC_LISP_OBJECT_ALIGNMENT
 GC_MARK_SECONDARY_STACK
 GC_MARK_STACK
@@ -193,8 +190,6 @@
 INTERNAL_TERMINAL
 IS_ANY_SEP
 IS_DIRECTORY_SEP
-KERNEL_FILE
-LDAV_SYMBOL
 LINKER
 LINUX_VERSION_CODE
 LISP_FLOAT_TYPE
@@ -381,4 +376,3 @@
 wait
 write
 xfree
-

=== modified file 'admin/ChangeLog'
--- a/admin/ChangeLog   2011-02-12 23:37:43 +0000
+++ b/admin/ChangeLog   2011-02-16 00:33:44 +0000
@@ -1,3 +1,9 @@
+2011-02-16  Paul Eggert  <address@hidden>
+
+       Remove no-longer needed getloadavg symbols.
+       * CPP-DEFINES (LOAD_AVE_CVT, LOAD_AVE_TYPE, FSCALE, KERNEL_FILE):
+       (LDAV_SYMBOL): Remove.
+
 2011-02-12  Glenn Morris  <address@hidden>
 
        * bzrmerge.el (bzrmerge-resolve): Fix bzr revert call.

=== modified file 'admin/notes/copyright'
--- a/admin/notes/copyright     2011-01-30 23:34:18 +0000
+++ b/admin/notes/copyright     2011-02-16 00:33:44 +0000
@@ -631,7 +631,6 @@
     warn-on-use.h
     lib/*.[ch]
     lib/gnulib.mk
-    src/getloadavg.c
     src/gmalloc.c
     src/md5.c
     src/md5.h

=== modified file 'configure'
--- a/configure 2011-02-08 21:42:56 +0000
+++ b/configure 2011-02-16 00:33:44 +0000
@@ -599,7 +599,6 @@
 # include <unistd.h>
 #endif"
 
-ac_config_libobj_dir=src
 ac_header_list=
 gl_getopt_required=POSIX
 gl_getopt_required=POSIX
@@ -611,6 +610,7 @@
 am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
+LIBOBJS
 WINDOW_SUPPORT
 TOOLTIP_SUPPORT
 MOUSE_SUPPORT
@@ -677,6 +677,8 @@
 TIME_H_DEFINES_STRUCT_TIMESPEC
 NEXT_AS_FIRST_DIRECTIVE_TIME_H
 NEXT_TIME_H
+NEXT_AS_FIRST_DIRECTIVE_STDLIB_H
+NEXT_STDLIB_H
 NEXT_AS_FIRST_DIRECTIVE_STDDEF_H
 NEXT_STDDEF_H
 STDDEF_H
@@ -813,12 +815,70 @@
 GNULIB_DUP2
 GNULIB_CLOSE
 GNULIB_CHOWN
+GETLOADAVG_LIBS
+REPLACE_UNSETENV
+REPLACE_STRTOD
+REPLACE_SETENV
+REPLACE_REALPATH
+REPLACE_REALLOC
+REPLACE_PUTENV
+REPLACE_MKSTEMP
+REPLACE_MALLOC
+REPLACE_CANONICALIZE_FILE_NAME
+REPLACE_CALLOC
+HAVE_DECL_UNSETENV
+HAVE_UNLOCKPT
+HAVE_SYS_LOADAVG_H
+HAVE_STRUCT_RANDOM_DATA
+HAVE_STRTOULL
+HAVE_STRTOLL
+HAVE_STRTOD
+HAVE_DECL_SETENV
+HAVE_SETENV
+HAVE_RPMATCH
+HAVE_REALPATH
+HAVE_RANDOM_R
+HAVE_RANDOM_H
+HAVE_PTSNAME
+HAVE_MKSTEMPS
+HAVE_MKSTEMP
+HAVE_MKOSTEMPS
+HAVE_MKOSTEMP
+HAVE_MKDTEMP
+HAVE_GRANTPT
+HAVE_GETSUBOPT
+HAVE_DECL_GETLOADAVG
+HAVE_CANONICALIZE_FILE_NAME
+HAVE_ATOLL
+HAVE__EXIT
+GNULIB_UNSETENV
+GNULIB_UNLOCKPT
+GNULIB_SYSTEM_POSIX
+GNULIB_STRTOULL
+GNULIB_STRTOLL
+GNULIB_STRTOD
+GNULIB_SETENV
+GNULIB_RPMATCH
+GNULIB_REALPATH
+GNULIB_REALLOC_POSIX
+GNULIB_RANDOM_R
+GNULIB_PUTENV
+GNULIB_PTSNAME
+GNULIB_MKSTEMPS
+GNULIB_MKSTEMP
+GNULIB_MKOSTEMPS
+GNULIB_MKOSTEMP
+GNULIB_MKDTEMP
+GNULIB_MALLOC_POSIX
+GNULIB_GRANTPT
+GNULIB_GETSUBOPT
+GNULIB_GETLOADAVG
+GNULIB_CANONICALIZE_FILE_NAME
+GNULIB_CALLOC_POSIX
+GNULIB_ATOLL
+GNULIB__EXIT
 GL_COND_LIBTOOL_FALSE
 GL_COND_LIBTOOL_TRUE
-GETLOADAVG_LIBS
-KMEM_GROUP
-NEED_SETGID
-LIBOBJS
 BLESSMAIL_TARGET
 LIBS_MAIL
 liblockfile
@@ -1043,6 +1103,9 @@
 LIBS
 CPPFLAGS
 CPP
+CPPFLAGS
+CPP
+CPPFLAGS
 XMKMF'
 
 
@@ -5821,6 +5884,7 @@
   # Code from module dtoastr:
   # Code from module extensions:
 
+  # Code from module getloadavg:
   # Code from module getopt-gnu:
   # Code from module getopt-posix:
   # Code from module gettext-h:
@@ -5831,6 +5895,7 @@
   # Code from module multiarch:
   # Code from module stdbool:
   # Code from module stddef:
+  # Code from module stdlib:
   # Code from module strftime:
   # Code from module time:
   # Code from module time_r:
@@ -6703,7 +6768,7 @@
 
   hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
 
-  sol2*) LIBS_SYSTEM="-lsocket -lnsl -lkstat" ;;
+  sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
 
   ## Motif needs -lgen.
   unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
@@ -6719,8 +6784,6 @@
   CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
 fi
 
-
-
 # Check whether --enable-largefile was given.
 if test "${enable_largefile+set}" = set; then :
   enableval=$enable_largefile;
@@ -13020,500 +13083,6 @@
 done
 
 
-ac_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/$ac_config_libobj_dir/getloadavg.c" ||
-  as_fn_error $? "$srcdir/$ac_config_libobj_dir/getloadavg.c is missing" 
"$LINENO" 5
-
-ac_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"
-if test "x$ac_cv_func_getloadavg" = xyes; then :
-  exit 0
-else
-  exit 1
-fi
-) && ac_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
-
-
-# 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="-lkstat  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char kstat_open ();
-int
-main ()
-{
-return kstat_open ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_kstat_kstat_open=yes
-else
-  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_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 && 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.
-if test $ac_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="-lelf  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char elf_begin ();
-int
-main ()
-{
-return elf_begin ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_elf_elf_begin=yes
-else
-  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_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
-
-fi
-if test $ac_have_func = no; 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="-lkvm  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char kvm_open ();
-int
-main ()
-{
-return kvm_open ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_kvm_kvm_open=yes
-else
-  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_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
-
-  # 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="-lutil  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char getloadavg ();
-int
-main ()
-{
-return getloadavg ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_util_getloadavg=yes
-else
-  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_util_getloadavg" 
>&5
-$as_echo "$ac_cv_lib_util_getloadavg" >&6; }
-if test "x$ac_cv_lib_util_getloadavg" = xyes; then :
-  LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes
-fi
-
-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"
-  { $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="-lgetloadavg  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char getloadavg ();
-int
-main ()
-{
-return getloadavg ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_getloadavg_getloadavg=yes
-else
-  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_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=$ac_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 :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_GETLOADAVG 1
-_ACEOF
-
-else
-  case " $LIBOBJS " in
-  *" getloadavg.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS getloadavg.$ac_objext"
- ;;
-esac
-
-
-$as_echo "#define C_GETLOADAVG 1" >>confdefs.h
-
-# Figure out what our getloadavg.c needs.
-ac_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 "x$ac_cv_header_sys_dg_sys_info_h" = xyes; then :
-  ac_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_n "checking for dg_sys_info in -ldgc... " >&6; }
-if ${ac_cv_lib_dgc_dg_sys_info+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldgc  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dg_sys_info ();
-int
-main ()
-{
-return dg_sys_info ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_dgc_dg_sys_info=yes
-else
-  ac_cv_lib_dgc_dg_sys_info=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_dgc_dg_sys_info" 
>&5
-$as_echo "$ac_cv_lib_dgc_dg_sys_info" >&6; }
-if test "x$ac_cv_lib_dgc_dg_sys_info" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDGC 1
-_ACEOF
-
-  LIBS="-ldgc $LIBS"
-
-fi
-
-fi
-
-
-
-ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" 
"$ac_includes_default"
-if test "x$ac_cv_header_locale_h" = xyes; then :
-
-fi
-
-
-for ac_func in setlocale
-do :
-  ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale"
-if test "x$ac_cv_func_setlocale" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SETLOCALE 1
-_ACEOF
-
-fi
-done
-
-
-# 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 \
-    && test "$ac_cv_lib_kvm_kvm_open" = yes; then
-  ac_have_func=yes
-
-$as_echo "#define SVR4 1" >>confdefs.h
-
-fi
-
-if test $ac_have_func = no; then
-  ac_fn_c_check_header_mongrel "$LINENO" "inq_stats/cpustats.h" 
"ac_cv_header_inq_stats_cpustats_h" "$ac_includes_default"
-if test "x$ac_cv_header_inq_stats_cpustats_h" = xyes; then :
-  ac_have_func=yes
-
-$as_echo "#define UMAX 1" >>confdefs.h
-
-
-$as_echo "#define UMAX4_3 1" >>confdefs.h
-
-fi
-
-
-fi
-
-if test $ac_have_func = no; then
-  ac_fn_c_check_header_mongrel "$LINENO" "sys/cpustats.h" 
"ac_cv_header_sys_cpustats_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_cpustats_h" = xyes; then :
-  ac_have_func=yes; $as_echo "#define UMAX 1" >>confdefs.h
-
-fi
-
-
-fi
-
-if test $ac_have_func = no; then
-  for ac_header in mach/mach.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "mach/mach.h" 
"ac_cv_header_mach_mach_h" "$ac_includes_default"
-if test "x$ac_cv_header_mach_mach_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_MACH_MACH_H 1
-_ACEOF
-
-fi
-
-done
-
-fi
-
-for ac_header in nlist.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "nlist.h" "ac_cv_header_nlist_h" 
"$ac_includes_default"
-if test "x$ac_cv_header_nlist_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_NLIST_H 1
-_ACEOF
- ac_fn_c_check_member "$LINENO" "struct nlist" "n_un.n_name" 
"ac_cv_member_struct_nlist_n_un_n_name" "#include <nlist.h>
-"
-if test "x$ac_cv_member_struct_nlist_n_un_n_name" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_NLIST_N_UN_N_NAME 1
-_ACEOF
-
-
-$as_echo "#define NLIST_NAME_UNION 1" >>confdefs.h
-
-fi
-
-
-fi
-
-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 ${ac_cv_func_getloadavg_setgid+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include "$srcdir/$ac_config_libobj_dir/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 :
-  ac_cv_func_getloadavg_setgid=yes
-else
-  ac_cv_func_getloadavg_setgid=no
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_func_getloadavg_setgid" >&5
-$as_echo "$ac_cv_func_getloadavg_setgid" >&6; }
-if test $ac_cv_func_getloadavg_setgid = yes; then
-  NEED_SETGID=true
-
-$as_echo "#define GETLOADAVG_PRIVILEGED 1" >>confdefs.h
-
-else
-  NEED_SETGID=false
-fi
-
-if test $ac_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 ${ac_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`
-  ac_cv_group_kmem=`$as_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: $ac_cv_group_kmem" >&5
-$as_echo "$ac_cv_group_kmem" >&6; }
-  KMEM_GROUP=$ac_cv_group_kmem
-fi
-if test "x$ac_save_LIBS" = x; then
-  GETLOADAVG_LIBS=$LIBS
-else
-  GETLOADAVG_LIBS=`$as_echo "$LIBS" | sed "s|$ac_save_LIBS||"`
-fi
-LIBS=$ac_save_LIBS
-
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value 
needed for large files" >&5
 $as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " 
>&6; }
 if ${ac_cv_sys_largefile_source+:} false; then :
@@ -13676,6 +13245,69 @@
   fi
 
 
+  GNULIB__EXIT=0;
+  GNULIB_ATOLL=0;
+  GNULIB_CALLOC_POSIX=0;
+  GNULIB_CANONICALIZE_FILE_NAME=0;
+  GNULIB_GETLOADAVG=0;
+  GNULIB_GETSUBOPT=0;
+  GNULIB_GRANTPT=0;
+  GNULIB_MALLOC_POSIX=0;
+  GNULIB_MKDTEMP=0;
+  GNULIB_MKOSTEMP=0;
+  GNULIB_MKOSTEMPS=0;
+  GNULIB_MKSTEMP=0;
+  GNULIB_MKSTEMPS=0;
+  GNULIB_PTSNAME=0;
+  GNULIB_PUTENV=0;
+  GNULIB_RANDOM_R=0;
+  GNULIB_REALLOC_POSIX=0;
+  GNULIB_REALPATH=0;
+  GNULIB_RPMATCH=0;
+  GNULIB_SETENV=0;
+  GNULIB_STRTOD=0;
+  GNULIB_STRTOLL=0;
+  GNULIB_STRTOULL=0;
+  GNULIB_SYSTEM_POSIX=0;
+  GNULIB_UNLOCKPT=0;
+  GNULIB_UNSETENV=0;
+    HAVE__EXIT=1;
+  HAVE_ATOLL=1;
+  HAVE_CANONICALIZE_FILE_NAME=1;
+  HAVE_DECL_GETLOADAVG=1;
+  HAVE_GETSUBOPT=1;
+  HAVE_GRANTPT=1;
+  HAVE_MKDTEMP=1;
+  HAVE_MKOSTEMP=1;
+  HAVE_MKOSTEMPS=1;
+  HAVE_MKSTEMP=1;
+  HAVE_MKSTEMPS=1;
+  HAVE_PTSNAME=1;
+  HAVE_RANDOM_H=1;
+  HAVE_RANDOM_R=1;
+  HAVE_REALPATH=1;
+  HAVE_RPMATCH=1;
+  HAVE_SETENV=1;
+  HAVE_DECL_SETENV=1;
+  HAVE_STRTOD=1;
+  HAVE_STRTOLL=1;
+  HAVE_STRTOULL=1;
+  HAVE_STRUCT_RANDOM_DATA=1;
+  HAVE_SYS_LOADAVG_H=0;
+  HAVE_UNLOCKPT=1;
+  HAVE_DECL_UNSETENV=1;
+  REPLACE_CALLOC=0;
+  REPLACE_CANONICALIZE_FILE_NAME=0;
+  REPLACE_MALLOC=0;
+  REPLACE_MKSTEMP=0;
+  REPLACE_PUTENV=0;
+  REPLACE_REALLOC=0;
+  REPLACE_REALPATH=0;
+  REPLACE_SETENV=0;
+  REPLACE_STRTOD=0;
+  REPLACE_UNSETENV=0;
+
+
   GNULIB_CHOWN=0;
   GNULIB_CLOSE=0;
   GNULIB_DUP2=0;
@@ -14831,6 +14463,534 @@
   # Code from module dtoastr:
 
   # Code from module extensions:
+  # Code from module getloadavg:
+
+
+# Persuade glibc <stdlib.h> to declare getloadavg().
+
+
+# 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
+
+ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg"
+if test "x$ac_cv_func_getloadavg" = xyes; then :
+
+else
+  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
+     { $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="-lelf  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char elf_begin ();
+int
+main ()
+{
+return elf_begin ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_elf_elf_begin=yes
+else
+  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_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
+
+     { $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="-lkvm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char kvm_open ();
+int
+main ()
+{
+return kvm_open ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_kvm_kvm_open=yes
+else
+  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_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
+
+     # 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="-lutil  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char getloadavg ();
+int
+main ()
+{
+return getloadavg ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_util_getloadavg=yes
+else
+  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_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
+
+   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="-lgetloadavg  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char getloadavg ();
+int
+main ()
+{
+return getloadavg ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_getloadavg_getloadavg=yes
+else
+  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_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
+
+   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="-lkstat  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char kstat_open ();
+int
+main ()
+{
+return kstat_open ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_kstat_kstat_open=yes
+else
+  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_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
+  { $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="-lperfstat  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char perfstat_cpu_total ();
+int
+main ()
+{
+return perfstat_cpu_total ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_perfstat_perfstat_cpu_total=yes
+else
+  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_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"
+
+fi
+
+  test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_have_func=yes
+fi
+
+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_n "checking for dg_sys_info in -ldgc... " >&6; }
+if ${ac_cv_lib_dgc_dg_sys_info+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldgc  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dg_sys_info ();
+int
+main ()
+{
+return dg_sys_info ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dgc_dg_sys_info=yes
+else
+  ac_cv_lib_dgc_dg_sys_info=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_dgc_dg_sys_info" 
>&5
+$as_echo "$ac_cv_lib_dgc_dg_sys_info" >&6; }
+if test "x$ac_cv_lib_dgc_dg_sys_info" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDGC 1
+_ACEOF
+
+  LIBS="-ldgc $LIBS"
+
+fi
+
+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
+# Irix 4.0.5F has the header but not the library.
+if test $gl_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes \
+    && test "$ac_cv_lib_kvm_kvm_open" = yes; then
+  gl_have_func=yes
+
+$as_echo "#define SVR4 1" >>confdefs.h
+
+fi
+
+if test $gl_have_func = no; then
+  ac_fn_c_check_header_mongrel "$LINENO" "inq_stats/cpustats.h" 
"ac_cv_header_inq_stats_cpustats_h" "$ac_includes_default"
+if test "x$ac_cv_header_inq_stats_cpustats_h" = xyes; then :
+  gl_have_func=yes
+
+$as_echo "#define UMAX 1" >>confdefs.h
+
+
+$as_echo "#define UMAX4_3 1" >>confdefs.h
+
+fi
+
+
+fi
+
+if test $gl_have_func = no; then
+  ac_fn_c_check_header_mongrel "$LINENO" "sys/cpustats.h" 
"ac_cv_header_sys_cpustats_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_cpustats_h" = xyes; then :
+  gl_have_func=yes; $as_echo "#define UMAX 1" >>confdefs.h
+
+fi
+
+
+fi
+
+if test $gl_have_func = no; then
+  for ac_header in mach/mach.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "mach/mach.h" 
"ac_cv_header_mach_mach_h" "$ac_includes_default"
+if test "x$ac_cv_header_mach_mach_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_MACH_MACH_H 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+for ac_header in nlist.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "nlist.h" "ac_cv_header_nlist_h" 
"$ac_includes_default"
+if test "x$ac_cv_header_nlist_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_NLIST_H 1
+_ACEOF
+ ac_fn_c_check_member "$LINENO" "struct nlist" "n_un.n_name" 
"ac_cv_member_struct_nlist_n_un_n_name" "#include <nlist.h>
+"
+if test "x$ac_cv_member_struct_nlist_n_un_n_name" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_NLIST_N_UN_N_NAME 1
+_ACEOF
+
+
+fi
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <nlist.h>
+int
+main ()
+{
+struct nlist x;
+                    #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
+                    x.n_un.n_name = "";
+                    #else
+                    x.n_name = "";
+                    #endif
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+$as_echo "#define N_NAME_POINTER 1" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+done
+
+   fi
+fi
+
+
+if test "x$gl_save_LIBS" = x; then
+  GETLOADAVG_LIBS=$LIBS
+else
+  GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_save_LIBS!!"`
+fi
+LIBS=$gl_save_LIBS
+
+
+# Test whether the system declares getloadavg. Solaris has the function
+# but declares it in <sys/loadavg.h>, not <stdlib.h>.
+for ac_header in sys/loadavg.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "sys/loadavg.h" 
"ac_cv_header_sys_loadavg_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_loadavg_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_LOADAVG_H 1
+_ACEOF
+
+fi
+
+done
+
+if test $ac_cv_header_sys_loadavg_h = yes; then
+  HAVE_SYS_LOADAVG_H=1
+else
+  HAVE_SYS_LOADAVG_H=0
+fi
+ac_fn_c_check_decl "$LINENO" "getloadavg" "ac_cv_have_decl_getloadavg" "#if 
HAVE_SYS_LOADAVG_H
+   # include <sys/loadavg.h>
+   #endif
+   #include <stdlib.h>
+"
+if test "x$ac_cv_have_decl_getloadavg" = xyes; then :
+
+else
+  HAVE_DECL_GETLOADAVG=0
+fi
+
+
+
+
+
+  GNULIB_GETLOADAVG=1
+
+
+
   # Code from module getopt-gnu:
 
 
@@ -15262,6 +15422,65 @@
 
   fi
 
+  # Code from module stdlib:
+
+
+
+
+
+
+
+
+
+
+     if test $gl_cv_have_include_next = yes; then
+       gl_cv_next_stdlib_h='<'stdlib.h'>'
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of 
<stdlib.h>" >&5
+$as_echo_n "checking absolute name of <stdlib.h>... " >&6; }
+if ${gl_cv_next_stdlib_h+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+                                                                               
                                         case "$host_os" in
+                 aix*) gl_absname_cpp="$ac_cpp -C" ;;
+                 *)    gl_absname_cpp="$ac_cpp" ;;
+               esac
+                                                            
gl_cv_next_stdlib_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
+                  sed -n '\#/stdlib.h#{
+                    s#.*"\(.*/stdlib.h\)".*#\1#
+                    s#^/[^/]#//&#
+                    p
+                    q
+                  }'`'"'
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdlib_h" >&5
+$as_echo "$gl_cv_next_stdlib_h" >&6; }
+     fi
+     NEXT_STDLIB_H=$gl_cv_next_stdlib_h
+
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = 
buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'stdlib.h'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=$gl_cv_next_stdlib_h
+     fi
+     NEXT_AS_FIRST_DIRECTIVE_STDLIB_H=$gl_next_as_first_directive
+
+
+
+
+
+
+
   # Code from module strftime:
 
 
@@ -17079,7 +17298,6 @@
 
 
 
-
 cat >>confdefs.h <<_ACEOF
 #define EMACS_CONFIGURATION "${canonical}"
 _ACEOF

=== modified file 'configure.in'
--- a/configure.in      2011-02-08 21:42:56 +0000
+++ b/configure.in      2011-02-16 00:33:44 +0000
@@ -984,7 +984,7 @@
 
   hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
 
-  sol2*) LIBS_SYSTEM="-lsocket -lnsl -lkstat" ;;
+  sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
 
   ## Motif needs -lgen.
   unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
@@ -1000,9 +1000,6 @@
   CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
 fi
 
-dnl For AC_FUNC_GETLOADAVG, at least:
-AC_CONFIG_LIBOBJ_DIR(src)
-
 dnl Do this early because it can frob feature test macros for Unix-98 &c.
 AC_SYS_LARGEFILE
 
@@ -2668,8 +2665,6 @@
 
 AC_CHECK_HEADERS(sys/un.h)
 
-AC_FUNC_GETLOADAVG
-
 AC_FUNC_FSEEKO
 
 AC_FUNC_GETPGRP
@@ -3118,7 +3113,6 @@
 S_FILE="\$(srcdir)/${opsysfile}"
 AC_SUBST(M_FILE)
 AC_SUBST(S_FILE)
-AC_SUBST(GETLOADAVG_LIBS)
 AC_SUBST(ns_appdir)
 AC_SUBST(ns_appbindir)
 AC_SUBST(ns_appresdir)

=== modified file 'lib/Makefile.in'
--- a/lib/Makefile.in   2011-02-09 01:40:01 +0000
+++ b/lib/Makefile.in   2011-02-16 00:33:44 +0000
@@ -24,7 +24,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. 
--makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr 
getopt-gnu ignore-value mktime strftime
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. 
--makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr 
getloadavg getopt-gnu ignore-value mktime strftime
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
@@ -51,14 +51,15 @@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
        $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \
-       $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gl-comp.m4 \
-       $(top_srcdir)/m4/gnulib-common.m4 \
+       $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \
+       $(top_srcdir)/m4/gl-comp.m4 $(top_srcdir)/m4/gnulib-common.m4 \
        $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/mktime.m4 \
        $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/stdbool.m4 \
-       $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/strftime.m4 \
-       $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
-       $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \
-       $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in
+       $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \
+       $(top_srcdir)/m4/strftime.m4 $(top_srcdir)/m4/time_h.m4 \
+       $(top_srcdir)/m4/time_r.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
+       $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
+       $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -134,6 +135,9 @@
 GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
 GETOPT_H = @GETOPT_H@
 GMALLOC_OBJ = @GMALLOC_OBJ@
+GNULIB_ATOLL = @GNULIB_ATOLL@
+GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
+GNULIB_CANONICALIZE_FILE_NAME = @GNULIB_CANONICALIZE_FILE_NAME@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_CLOSE = @GNULIB_CLOSE@
 GNULIB_DUP2 = @GNULIB_DUP2@
@@ -150,27 +154,47 @@
 GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@
 GNULIB_GETGROUPS = @GNULIB_GETGROUPS@
 GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@
+GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@
 GNULIB_GETLOGIN = @GNULIB_GETLOGIN@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
 GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
+GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@
+GNULIB_GRANTPT = @GNULIB_GRANTPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LINK = @GNULIB_LINK@
 GNULIB_LINKAT = @GNULIB_LINKAT@
 GNULIB_LSEEK = @GNULIB_LSEEK@
+GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
+GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
+GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@
+GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@
+GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
+GNULIB_MKSTEMPS = @GNULIB_MKSTEMPS@
 GNULIB_MKTIME = @GNULIB_MKTIME@
 GNULIB_NANOSLEEP = @GNULIB_NANOSLEEP@
 GNULIB_PIPE = @GNULIB_PIPE@
 GNULIB_PIPE2 = @GNULIB_PIPE2@
 GNULIB_PREAD = @GNULIB_PREAD@
+GNULIB_PTSNAME = @GNULIB_PTSNAME@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_PWRITE = @GNULIB_PWRITE@
+GNULIB_RANDOM_R = @GNULIB_RANDOM_R@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_READLINKAT = @GNULIB_READLINKAT@
+GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_REALPATH = @GNULIB_REALPATH@
 GNULIB_RMDIR = @GNULIB_RMDIR@
+GNULIB_RPMATCH = @GNULIB_RPMATCH@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_STRPTIME = @GNULIB_STRPTIME@
+GNULIB_STRTOD = @GNULIB_STRTOD@
+GNULIB_STRTOLL = @GNULIB_STRTOLL@
+GNULIB_STRTOULL = @GNULIB_STRTOULL@
 GNULIB_SYMLINK = @GNULIB_SYMLINK@
 GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@
+GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@
 GNULIB_TIMEGM = @GNULIB_TIMEGM@
 GNULIB_TIME_R = @GNULIB_TIME_R@
 GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@
@@ -178,8 +202,11 @@
 GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@
 GNULIB_UNLINK = @GNULIB_UNLINK@
 GNULIB_UNLINKAT = @GNULIB_UNLINKAT@
+GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_USLEEP = @GNULIB_USLEEP@
 GNULIB_WRITE = @GNULIB_WRITE@
+GNULIB__EXIT = @GNULIB__EXIT@
 GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@
 GREP = @GREP@
 GTK_CFLAGS = @GTK_CFLAGS@
@@ -187,15 +214,20 @@
 GTK_OBJ = @GTK_OBJ@
 GZIP_INFO = @GZIP_INFO@
 GZIP_PROG = @GZIP_PROG@
+HAVE_ATOLL = @HAVE_ATOLL@
+HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@
 HAVE_CHOWN = @HAVE_CHOWN@
 HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@
 HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@
+HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
 HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@
 HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@
 HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@
+HAVE_DECL_SETENV = @HAVE_DECL_SETENV@
 HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@
+HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@
 HAVE_DUP2 = @HAVE_DUP2@
 HAVE_DUP3 = @HAVE_DUP3@
 HAVE_EUIDACCESS = @HAVE_EUIDACCESS@
@@ -210,30 +242,50 @@
 HAVE_GETLOGIN = @HAVE_GETLOGIN@
 HAVE_GETOPT_H = @HAVE_GETOPT_H@
 HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
+HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GRANTPT = @HAVE_GRANTPT@
 HAVE_LCHOWN = @HAVE_LCHOWN@
 HAVE_LINK = @HAVE_LINK@
 HAVE_LINKAT = @HAVE_LINKAT@
 HAVE_MAKEINFO = @HAVE_MAKEINFO@
+HAVE_MKDTEMP = @HAVE_MKDTEMP@
+HAVE_MKOSTEMP = @HAVE_MKOSTEMP@
+HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@
+HAVE_MKSTEMP = @HAVE_MKSTEMP@
+HAVE_MKSTEMPS = @HAVE_MKSTEMPS@
 HAVE_NANOSLEEP = @HAVE_NANOSLEEP@
 HAVE_OS_H = @HAVE_OS_H@
 HAVE_PIPE = @HAVE_PIPE@
 HAVE_PIPE2 = @HAVE_PIPE2@
 HAVE_PREAD = @HAVE_PREAD@
+HAVE_PTSNAME = @HAVE_PTSNAME@
 HAVE_PWRITE = @HAVE_PWRITE@
+HAVE_RANDOM_H = @HAVE_RANDOM_H@
+HAVE_RANDOM_R = @HAVE_RANDOM_R@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_READLINKAT = @HAVE_READLINKAT@
+HAVE_REALPATH = @HAVE_REALPATH@
+HAVE_RPMATCH = @HAVE_RPMATCH@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STRPTIME = @HAVE_STRPTIME@
+HAVE_STRTOD = @HAVE_STRTOD@
+HAVE_STRTOLL = @HAVE_STRTOLL@
+HAVE_STRTOULL = @HAVE_STRTOULL@
+HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@
 HAVE_SYMLINK = @HAVE_SYMLINK@
 HAVE_SYMLINKAT = @HAVE_SYMLINKAT@
+HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@
 HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_TIMEGM = @HAVE_TIMEGM@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
 HAVE_UNLINKAT = @HAVE_UNLINKAT@
+HAVE_UNLOCKPT = @HAVE_UNLOCKPT@
 HAVE_USLEEP = @HAVE_USLEEP@
 HAVE_WCHAR_T = @HAVE_WCHAR_T@
 HAVE_XSERVER = @HAVE_XSERVER@
 HAVE__BOOL = @HAVE__BOOL@
+HAVE__EXIT = @HAVE__EXIT@
 IMAGEMAGICK_CFLAGS = @IMAGEMAGICK_CFLAGS@
 IMAGEMAGICK_LIBS = @IMAGEMAGICK_LIBS@
 INCLUDE_NEXT = @INCLUDE_NEXT@
@@ -244,7 +296,6 @@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-KMEM_GROUP = @KMEM_GROUP@
 KRB4LIB = @KRB4LIB@
 KRB5LIB = @KRB5LIB@
 LDFLAGS = @LDFLAGS@
@@ -297,13 +348,14 @@
 MKDIR_P = @MKDIR_P@
 MOUSE_SUPPORT = @MOUSE_SUPPORT@
 M_FILE = @M_FILE@
-NEED_SETGID = @NEED_SETGID@
 NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@
 NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
+NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@
 NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@
 NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@
 NEXT_GETOPT_H = @NEXT_GETOPT_H@
 NEXT_STDDEF_H = @NEXT_STDDEF_H@
+NEXT_STDLIB_H = @NEXT_STDLIB_H@
 NEXT_TIME_H = @NEXT_TIME_H@
 NEXT_UNISTD_H = @NEXT_UNISTD_H@
 NS_OBJ = @NS_OBJ@
@@ -331,6 +383,8 @@
 PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
 RALLOC_OBJ = @RALLOC_OBJ@
 RANLIB = @RANLIB@
+REPLACE_CALLOC = @REPLACE_CALLOC@
+REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_CLOSE = @REPLACE_CLOSE@
 REPLACE_DUP = @REPLACE_DUP@
@@ -346,19 +400,27 @@
 REPLACE_LINKAT = @REPLACE_LINKAT@
 REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MALLOC = @REPLACE_MALLOC@
+REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_MKTIME = @REPLACE_MKTIME@
 REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
 REPLACE_NULL = @REPLACE_NULL@
 REPLACE_PREAD = @REPLACE_PREAD@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_PWRITE = @REPLACE_PWRITE@
 REPLACE_READLINK = @REPLACE_READLINK@
+REPLACE_REALLOC = @REPLACE_REALLOC@
+REPLACE_REALPATH = @REPLACE_REALPATH@
 REPLACE_RMDIR = @REPLACE_RMDIR@
+REPLACE_SETENV = @REPLACE_SETENV@
 REPLACE_SLEEP = @REPLACE_SLEEP@
+REPLACE_STRTOD = @REPLACE_STRTOD@
 REPLACE_SYMLINK = @REPLACE_SYMLINK@
 REPLACE_TIMEGM = @REPLACE_TIMEGM@
 REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@
 REPLACE_UNLINK = @REPLACE_UNLINK@
 REPLACE_UNLINKAT = @REPLACE_UNLINKAT@
+REPLACE_UNSETENV = @REPLACE_UNSETENV@
 REPLACE_USLEEP = @REPLACE_USLEEP@
 REPLACE_WRITE = @REPLACE_WRITE@
 RSVG_CFLAGS = @RSVG_CFLAGS@
@@ -472,23 +534,23 @@
 # present in all Makefile.am that need it. This is ensured by the applicability
 # 'all' defined above.
 BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \
-       $(STDDEF_H) time.h unistd.h warn-on-use.h
+       $(STDDEF_H) stdlib.h time.h unistd.h warn-on-use.h
 EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \
-       ftoastr.c ftoastr.h getopt.c getopt.in.h getopt1.c \
-       getopt_int.h intprops.h mktime-internal.h mktime.c \
-       stdbool.in.h stddef.in.h strftime.c strftime.h time.in.h \
-       time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h
+       ftoastr.c ftoastr.h getloadavg.c getopt.c getopt.in.h \
+       getopt1.c getopt_int.h intprops.h mktime-internal.h mktime.c \
+       stdbool.in.h stddef.in.h stdlib.in.h strftime.c strftime.h \
+       time.in.h time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h
 MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \
        c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \
-       stdbool.h-t stddef.h stddef.h-t time.h time.h-t unistd.h \
-       unistd.h-t warn-on-use.h warn-on-use.h-t
+       stdbool.h-t stddef.h stddef.h-t stdlib.h stdlib.h-t time.h \
+       time.h-t unistd.h unistd.h-t warn-on-use.h warn-on-use.h-t
 noinst_LIBRARIES = libgnu.a
 DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src
 libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h
 libgnu_a_LIBADD = $(gl_LIBOBJS)
 libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
-EXTRA_libgnu_a_SOURCES = ftoastr.c getopt.c getopt1.c mktime.c \
-       strftime.c time_r.c
+EXTRA_libgnu_a_SOURCES = ftoastr.c getloadavg.c getopt.c getopt1.c \
+       mktime.c strftime.c time_r.c
 ARG_NONNULL_H = arg-nonnull.h
 CXXDEFS_H = c++defs.h
 WARN_ON_USE_H = warn-on-use.h
@@ -543,6 +605,7 @@
 
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
@@ -819,6 +882,82 @@
        } > address@hidden && \
        mv address@hidden $@
 
+# We need the following in order to create <stdlib.h> when the system
+# doesn't have one that works with the given compiler.
+stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
+             -e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \
+             -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \
+             -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
+             -e 
's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \
+             -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \
+             -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
+             -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \
+             -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
+             -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
+             -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \
+             -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \
+             -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
+             -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \
+             -e 's|@''GNULIB_PTSNAME''@|$(GNULIB_PTSNAME)|g' \
+             -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
+             -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \
+             -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
+             -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \
+             -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
+             -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
+             -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
+             -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
+             -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
+             -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \
+             -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
+             -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
+             < $(srcdir)/stdlib.in.h | \
+         sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
+             -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
+             -e 
's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
+             -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
+             -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
+             -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
+             -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
+             -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
+             -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
+             -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
+             -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
+             -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
+             -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
+             -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
+             -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
+             -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
+             -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
+             -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
+             -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
+             -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
+             -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' 
\
+             -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
+             -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
+             -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
+             -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
+             -e 
's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
+             -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
+             -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+             -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
+             -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
+             -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
+             -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
+             -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
+             -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
+       } > address@hidden && \
+       mv address@hidden $@
+
 # We need the following in order to create <time.h> when the system
 # doesn't have one that works with the given compiler.
 time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)

=== renamed file 'src/getloadavg.c' => 'lib/getloadavg.c'
--- a/src/getloadavg.c  2011-01-17 19:01:01 +0000
+++ b/lib/getloadavg.c  2011-02-16 00:33:44 +0000
@@ -1,15 +1,15 @@
 /* Get the system load averages.
-   Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994, 1995,
-                 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-                 Free Software Foundation, Inc.
+
+   Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2011 Free Software
+   Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with gnulib.
    Bugs can be reported to address@hidden
 
-   This program is free software; you can redistribute it and/or modify
+   This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,62 +17,62 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-   USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Compile-time symbols that this file uses:
 
-   HAVE_PSTAT_GETDYNAMIC       Define this if your system has the
+   HAVE_PSTAT_GETDYNAMIC        Define this if your system has the
                                 pstat_getdynamic function.  I think it
-                               is unique to HPUX9.  The best way to get the
-                               definition is through the AC_FUNC_GETLOADAVG
-                               macro that comes with autoconf 2.13 or newer.
-                               If that isn't an option, then just put
-                               AC_CHECK_FUNCS(pstat_getdynamic) in your
-                               configure.in file.
-   FIXUP_KERNEL_SYMBOL_ADDR()  Adjust address in returned struct nlist.
-   KERNEL_FILE                 Pathname of the kernel to nlist.
-   LDAV_CVT()                  Scale the load average from the kernel.
-                               Returns a double.
-   LDAV_SYMBOL                 Name of kernel symbol giving load average.
-   LOAD_AVE_TYPE               Type of the load average array in the kernel.
-                               Must be defined unless one of
-                               apollo, DGUX, NeXT, or UMAX is defined;
+                                is unique to HPUX9.  The best way to get the
+                                definition is through the AC_FUNC_GETLOADAVG
+                                macro that comes with autoconf 2.13 or newer.
+                                If that isn't an option, then just put
+                                AC_CHECK_FUNCS(pstat_getdynamic) in your
+                                configure.in file.
+   HAVE_LIBPERFSTAT Define this if your system has the
+                                perfstat_cpu_total function in libperfstat 
(AIX).
+   FIXUP_KERNEL_SYMBOL_ADDR()   Adjust address in returned struct nlist.
+   KERNEL_FILE                  Name of the kernel file to nlist.
+   LDAV_CVT()                   Scale the load average from the kernel.
+                                Returns a double.
+   LDAV_SYMBOL                  Name of kernel symbol giving load average.
+   LOAD_AVE_TYPE                Type of the load average array in the kernel.
+                                Must be defined unless one of
+                                apollo, DGUX, NeXT, or UMAX is defined;
                                 or we have libkstat;
-                               otherwise, no load average is available.
+                                otherwise, no load average is available.
    HAVE_NLIST_H                 nlist.h is available.  NLIST_STRUCT defaults
                                 to this.
-   NLIST_STRUCT                        Include nlist.h, not a.out.h, and
-                               the nlist n_name element is a pointer,
-                               not an array.
+   NLIST_STRUCT                 Include nlist.h, not a.out.h.
+   N_NAME_POINTER               The nlist n_name element is a pointer,
+                                not an array.
    HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'.
-   LINUX_LDAV_FILE             [__linux__]: File containing load averages.
-   HAVE_LOCALE_H                locale.h is available.
-   HAVE_SETLOCALE               The `setlocale' function is available.
+   LINUX_LDAV_FILE              [__linux__, __CYGWIN__]: File containing
+                                load averages.
 
    Specific system predefines this file uses, aside from setting
    default values if not emacs:
 
    apollo
-   BSD                         Real BSD, not just BSD-like.
+   BSD                          Real BSD, not just BSD-like.
    convex
    DGUX
-   eunice                      UNIX emulator under VMS.
+   eunice                       UNIX emulator under VMS.
    hpux
-   __MSDOS__                   No-op for MSDOS.
+   __MSDOS__                    No-op for MSDOS.
    NeXT
    sgi
-   sequent                     Sequent Dynix 3.x.x (BSD)
-   _SEQUENT_                   Sequent DYNIX/ptx 1.x.x (SYSV)
+   sequent                      Sequent Dynix 3.x.x (BSD)
+   _SEQUENT_                    Sequent DYNIX/ptx 1.x.x (SYSV)
    sony_news                    NEWS-OS (works at least for 4.1C)
    UMAX
    UMAX4_3
    VMS
-   WINDOWS32                   No-op for Windows95/NT.
-   __linux__                   Linux: assumes /proc filesystem mounted.
-                               Support from Michael K. Johnson.
-   __NetBSD__                  NetBSD: assumes /kern filesystem mounted.
+   WINDOWS32                    No-op for Windows95/NT.
+   __linux__                    Linux: assumes /proc file system mounted.
+                                Support from Michael K. Johnson.
+   __CYGWIN__                   Cygwin emulates linux /proc/loadavg.
+   __NetBSD__                   NetBSD: assumes /kern file system mounted.
 
    In addition, to avoid nesting many #ifdefs, we internally set
    LDAV_DONE to indicate that the load average has been computed.
@@ -80,41 +80,30 @@
    We also #define LDAV_PRIVILEGED if a program will require
    special installation to be able to call getloadavg.  */
 
-/* This should always be first.  */
-#ifdef HAVE_CONFIG_H
+/* "configure" defines CONFIGURING_GETLOADAVG to sidestep problems
+   with partially-configured source directories.  */
+
+#ifndef CONFIGURING_GETLOADAVG
 # include <config.h>
+# include <stdbool.h>
 #endif
 
-#include <sys/types.h>
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+#include <stdio.h>
+
+# include <sys/types.h>
 
 /* Both the Emacs and non-Emacs sections want this.  Some
    configuration files' definitions for the LOAD_AVE_CVT macro (like
    sparc.h's) use macros like FSCALE, defined here.  */
-#if defined (unix) || defined (__unix)
-# include <sys/param.h>
-#endif
-
-
-/* Exclude all the code except the test program at the end
-   if the system has its own `getloadavg' function.
-
-   The declaration of `errno' is needed by the test program
-   as well as the function itself, so it comes first.  */
-
-#include <errno.h>
-
-#ifndef errno
-extern int errno;
-#endif
-
-#ifdef HAVE_LOCALE_H
-# include <locale.h>
-#endif
-#ifndef HAVE_SETLOCALE
-# define setlocale(Category, Locale) /* empty */
-#endif
-
-#ifndef HAVE_GETLOADAVG
+# if defined (unix) || defined (__unix)
+#  include <sys/param.h>
+# endif
+
+# include "intprops.h"
 
 /* The existing Emacs configuration files define a macro called
    LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
@@ -126,7 +115,7 @@
    LOAD_AVE_CVT, but future machine config files should just define
    LDAV_CVT directly.  */
 
-# if !defined(LDAV_CVT) && defined(LOAD_AVE_CVT)
+# if !defined (LDAV_CVT) && defined (LOAD_AVE_CVT)
 #  define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0)
 # endif
 
@@ -170,11 +159,11 @@
 #  define sun
 # endif
 
-# if defined(hp300) && !defined(hpux)
+# if defined (hp300) && !defined (hpux)
 #  define MORE_BSD
 # endif
 
-# if defined(ultrix) && defined(mips)
+# if defined (ultrix) && defined (mips)
 #  define decstation
 # endif
 
@@ -182,7 +171,7 @@
 #  define SVR4
 # endif
 
-# if (defined(sun) && defined(SVR4)) || defined (SOLARIS2)
+# if (defined (sun) && defined (SVR4)) || defined (SOLARIS2)
 #  define SUNOS_5
 # endif
 
@@ -192,6 +181,8 @@
 #  include <sys/socket.h>
 #  include <net/route.h>
 #  include <sys/table.h>
+/* Tru64 4.0D's table.h redefines sys */
+#  undef sys
 # endif
 
 # if defined (__osf__) && (defined (mips) || defined (__mips__))
@@ -203,7 +194,7 @@
    default, but _MACH_IND_SYS_TYPES is defined in <sys/types.h>.  Combine
    that with a couple of other things and we'll have a unique match.  */
 # if !defined (tek4300) && defined (unix) && defined (m68k) && defined 
(mc68000) && defined (mc68020) && defined (_MACH_IND_SYS_TYPES)
-#  define tek4300                      /* Define by emacs, but not by other 
users.  */
+#  define tek4300                       /* Define by emacs, but not by other 
users.  */
 # endif
 
 
@@ -254,11 +245,11 @@
 #   define LOAD_AVE_TYPE long
 #  endif
 
-#  if defined(alliant) && defined(i860) /* Alliant FX/2800 */
+#  if defined (alliant) && defined (i860) /* Alliant FX/2800 */
 #   define LOAD_AVE_TYPE long
 #  endif
 
-#  ifdef _AIX
+#  if defined _AIX && ! defined HAVE_LIBPERFSTAT
 #   define LOAD_AVE_TYPE long
 #  endif
 
@@ -278,7 +269,7 @@
 #  define FSCALE 1024.0
 # endif
 
-# if defined(alliant) && defined(i860) /* Alliant FX/2800 */
+# if defined (alliant) && defined (i860) /* Alliant FX/2800 */
 /* <sys/param.h> defines an incorrect value for FSCALE on an
    Alliant FX/2800 Concentrix 2.2, according to address@hidden  */
 #  undef FSCALE
@@ -286,7 +277,7 @@
 # endif
 
 
-# ifndef       FSCALE
+# ifndef FSCALE
 
 /* SunOS and some others define FSCALE in sys/param.h.  */
 
@@ -294,7 +285,7 @@
 #   define FSCALE 2048.0
 #  endif
 
-#  if defined(MIPS) || defined(SVR4) || defined(decstation)
+#  if defined (MIPS) || defined (SVR4) || defined (decstation)
 #   define FSCALE 256
 #  endif
 
@@ -313,11 +304,11 @@
 #   define FSCALE 100.0
 #  endif
 
-#  ifdef _AIX
+#  if defined _AIX && !defined HAVE_LIBPERFSTAT
 #   define FSCALE 65536.0
 #  endif
 
-# endif        /* Not FSCALE.  */
+# endif /* Not FSCALE.  */
 
 # if !defined (LDAV_CVT) && defined (FSCALE)
 #  define LDAV_CVT(n) (((double) (n)) / FSCALE)
@@ -329,7 +320,7 @@
 #  endif
 # endif
 
-# if defined(sgi) || (defined(mips) && !defined(BSD))
+# if defined (sgi) || (defined (mips) && !defined (BSD))
 #  define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31))
 # endif
 
@@ -342,7 +333,7 @@
 #  define KERNEL_FILE "/hp-ux"
 # endif
 
-# if !defined(KERNEL_FILE) && (defined(_SEQUENT_) || defined(MIPS) || 
defined(SVR4) || defined(ISC) || defined (sgi) || (defined (ardent) && defined 
(titan)))
+# if !defined (KERNEL_FILE) && (defined (_SEQUENT_) || defined (MIPS) || 
defined (SVR4) || defined (ISC) || defined (sgi) || (defined (ardent) && 
defined (titan)))
 #  define KERNEL_FILE "/unix"
 # endif
 
@@ -351,22 +342,21 @@
 #  define LDAV_SYMBOL "_Loadavg"
 # endif
 
-# if !defined(LDAV_SYMBOL) && ((defined(hpux) && !defined(hp9000s300)) || 
defined(_SEQUENT_) || defined(SVR4) || defined(ISC) || defined(sgi) || (defined 
(ardent) && defined (titan)) || defined (_AIX))
+# if !defined (LDAV_SYMBOL) && ((defined (hpux) && !defined (hp9000s300)) || 
defined (_SEQUENT_) || defined (SVR4) || defined (ISC) || defined (sgi) || 
(defined (ardent) && defined (titan)) || (defined (_AIX) && 
!defined(HAVE_LIBPERFSTAT)))
 #  define LDAV_SYMBOL "avenrun"
 # endif
 
 # include <unistd.h>
-# include <stdio.h>
 
 /* LOAD_AVE_TYPE should only get defined if we're going to use the
    nlist method.  */
-# if !defined(LOAD_AVE_TYPE) && (defined(BSD) || defined(LDAV_CVT) || 
defined(KERNEL_FILE) || defined(LDAV_SYMBOL))
+# if !defined (LOAD_AVE_TYPE) && (defined (BSD) || defined (LDAV_CVT) || 
defined (KERNEL_FILE) || defined (LDAV_SYMBOL))
 #  define LOAD_AVE_TYPE double
 # endif
 
 # ifdef LOAD_AVE_TYPE
 
-#  ifndef VMS
+#  ifndef __VMS
 #   ifndef __linux__
 #    ifndef NLIST_STRUCT
 #     include <a.out.h>
@@ -375,7 +365,6 @@
 #    endif /* NLIST_STRUCT */
 
 #    ifdef SUNOS_5
-#     include <fcntl.h>
 #     include <kvm.h>
 #     include <kstat.h>
 #    endif
@@ -393,7 +382,7 @@
 #    endif /* LDAV_SYMBOL */
 #   endif /* __linux__ */
 
-#  else /* VMS */
+#  else /* __VMS */
 
 #   ifndef eunice
 #    include <iodef.h>
@@ -401,7 +390,7 @@
 #   else /* eunice */
 #    include <vms/iodef.h>
 #   endif /* eunice */
-#  endif /* VMS */
+#  endif /* __VMS */
 
 #  ifndef LDAV_CVT
 #   define LDAV_CVT(n) ((double) (n))
@@ -409,7 +398,16 @@
 
 # endif /* LOAD_AVE_TYPE */
 
-# if defined(__GNU__) && !defined (NeXT)
+# if defined HAVE_LIBPERFSTAT
+#  include <sys/protosw.h>
+#  include <libperfstat.h>
+#  include <sys/proc.h>
+#  ifndef SBITS
+#   define SBITS 16
+#  endif
+# endif
+
+# if defined (__GNU__) && !defined (NeXT)
 /* Note that NeXT Openstep defines __GNU__ even though it should not.  */
 /* GNU system acts much like NeXT, for load average purposes,
    but not exactly.  */
@@ -430,7 +428,6 @@
 # endif /* sgi */
 
 # ifdef UMAX
-#  include <stdio.h>
 #  include <signal.h>
 #  include <sys/time.h>
 #  include <sys/wait.h>
@@ -456,17 +453,16 @@
 #  include <sys/dg_sys_info.h>
 # endif
 
-# if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION)
+# if (defined __linux__ || defined __CYGWIN__ || defined SUNOS_5        \
+      || (defined LOAD_AVE_TYPE && ! defined __VMS))
 #  include <fcntl.h>
-# else
-#  include <sys/file.h>
 # endif
 
 /* Avoid static vars inside a function since in HPUX they dump as pure.  */
 
 # ifdef NeXT
 static processor_set_t default_set;
-static int getloadavg_initialized;
+static bool getloadavg_initialized;
 # endif /* NeXT */
 
 # ifdef UMAX
@@ -475,44 +471,40 @@
 # endif /* UMAX */
 
 # ifdef DGUX
-static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
+static struct dg_sys_info_load_info load_info;  /* what-a-mouthful! */
 # endif /* DGUX */
 
-#if !defined(HAVE_LIBKSTAT) && defined(LOAD_AVE_TYPE)
+# if !defined (HAVE_LIBKSTAT) && defined (LOAD_AVE_TYPE)
 /* File descriptor open to /dev/kmem or VMS load ave driver.  */
 static int channel;
-/* Nonzero if channel is valid.  */
-static int getloadavg_initialized;
+/* True if channel is valid.  */
+static bool getloadavg_initialized;
 /* Offset in kmem to seek to read load average, or 0 means invalid.  */
 static long offset;
 
-#  if !defined(VMS) && !defined(sgi) && !defined(__linux__)
+#  if ! defined __VMS && ! defined sgi && ! defined __linux__
 static struct nlist name_list[2];
-#  endif /* Not VMS or sgi */
+#  endif
 
 #  ifdef SUNOS_5
 static kvm_t *kd;
 #  endif /* SUNOS_5 */
 
-#endif /* LOAD_AVE_TYPE && !HAVE_LIBKSTAT */
+# endif /* LOAD_AVE_TYPE && !HAVE_LIBKSTAT */
 
 /* Put the 1 minute, 5 minute and 15 minute load averages
    into the first NELEM elements of LOADAVG.
    Return the number written (never more than 3, but may be less than NELEM),
-   or -1 if an error occurred.  */
+   or -1 (setting errno) if an error occurred.  */
 
 int
-getloadavg (loadavg, nelem)
-     double loadavg[];
-     int nelem;
+getloadavg (double loadavg[], int nelem)
 {
-  int elem = 0;                        /* Return value.  */
+  int elem = 0;                 /* Return value.  */
 
 # ifdef NO_GET_LOAD_AVG
 #  define LDAV_DONE
-  /* Set errno to zero to indicate that there was no particular error;
-     this function just can't work at all on this system.  */
-  errno = 0;
+  errno = ENOSYS;
   elem = -1;
 # endif
 
@@ -522,12 +514,13 @@
   kstat_ctl_t *kc;
   kstat_t *ksp;
   kstat_named_t *kn;
+  int saved_errno;
 
   kc = kstat_open ();
   if (kc == 0)
     return -1;
   ksp = kstat_lookup (kc, "unix", 0, "system_misc");
-  if (ksp == 0 )
+  if (ksp == 0)
     return -1;
   if (kstat_read (kc, ksp, 0) == -1)
     return -1;
@@ -542,25 +535,27 @@
     }
 
   if (nelem >= 1)
-    loadavg[elem++] = (double) kn->value.ul/FSCALE;
+    loadavg[elem++] = (double) kn->value.ul / FSCALE;
 
   if (nelem >= 2)
     {
       kn = kstat_data_lookup (ksp, "avenrun_5min");
       if (kn != 0)
-       {
-         loadavg[elem++] = (double) kn->value.ul/FSCALE;
+        {
+          loadavg[elem++] = (double) kn->value.ul / FSCALE;
 
-         if (nelem >= 3)
-           {
-             kn = kstat_data_lookup (ksp, "avenrun_15min");
-             if (kn != 0)
-               loadavg[elem++] = (double) kn->value.ul/FSCALE;
-           }
-       }
+          if (nelem >= 3)
+            {
+              kn = kstat_data_lookup (ksp, "avenrun_15min");
+              if (kn != 0)
+                loadavg[elem++] = (double) kn->value.ul / FSCALE;
+            }
+        }
     }
 
+  saved_errno = errno;
   kstat_close (kc);
+  errno = saved_errno;
 # endif /* HAVE_LIBKSTAT */
 
 # if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
@@ -580,7 +575,23 @@
 
 # endif /* hpux && HAVE_PSTAT_GETDYNAMIC */
 
-# if !defined (LDAV_DONE) && defined (__linux__)
+# if ! defined LDAV_DONE && defined HAVE_LIBPERFSTAT
+#  define LDAV_DONE
+#  undef LOAD_AVE_TYPE
+/* Use perfstat_cpu_total because we don't have to be root. */
+  {
+    perfstat_cpu_total_t cpu_stats;
+    int result = perfstat_cpu_total (NULL, &cpu_stats, sizeof cpu_stats, 1);
+    if (result == -1)
+      return result;
+    loadavg[0] = cpu_stats.loadavg[0] / (double)(1 << SBITS);
+    loadavg[1] = cpu_stats.loadavg[1] / (double)(1 << SBITS);
+    loadavg[2] = cpu_stats.loadavg[2] / (double)(1 << SBITS);
+    elem = 3;
+  }
+# endif
+
+# if !defined (LDAV_DONE) && (defined (__linux__) || defined (__CYGWIN__))
 #  define LDAV_DONE
 #  undef LOAD_AVE_TYPE
 
@@ -588,32 +599,54 @@
 #   define LINUX_LDAV_FILE "/proc/loadavg"
 #  endif
 
-  char ldavgbuf[40];
-  double load_ave[3];
-  int fd, count;
+  char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")];
+  char const *ptr = ldavgbuf;
+  int fd, count, saved_errno;
 
   fd = open (LINUX_LDAV_FILE, O_RDONLY);
   if (fd == -1)
     return -1;
-  count = read (fd, ldavgbuf, 40);
+  count = read (fd, ldavgbuf, sizeof ldavgbuf - 1);
+  saved_errno = errno;
   (void) close (fd);
+  errno = saved_errno;
   if (count <= 0)
     return -1;
-
-  /* The following sscanf must use the C locale.  */
-  setlocale (LC_NUMERIC, "C");
-  count = sscanf (ldavgbuf, "%lf %lf %lf",
-                 &load_ave[0], &load_ave[1], &load_ave[2]);
-  setlocale (LC_NUMERIC, "");
-  if (count < 1)
-    return -1;
-
-  for (elem = 0; elem < nelem && elem < count; elem++)
-    loadavg[elem] = load_ave[elem];
+  ldavgbuf[count] = '\0';
+
+  for (elem = 0; elem < nelem; elem++)
+    {
+      double numerator = 0;
+      double denominator = 1;
+
+      while (*ptr == ' ')
+        ptr++;
+
+      /* Finish if this number is missing, and report an error if all
+         were missing.  */
+      if (! ('0' <= *ptr && *ptr <= '9'))
+        {
+          if (elem == 0)
+            {
+              errno = ENOTSUP;
+              return -1;
+            }
+          break;
+        }
+
+      while ('0' <= *ptr && *ptr <= '9')
+        numerator = 10 * numerator + (*ptr++ - '0');
+
+      if (*ptr == '.')
+        for (ptr++; '0' <= *ptr && *ptr <= '9'; ptr++)
+          numerator = 10 * numerator + (*ptr - '0'), denominator *= 10;
+
+      loadavg[elem++] = numerator / denominator;
+    }
 
   return elem;
 
-# endif /* __linux__ */
+# endif /* __linux__ || __CYGWIN__ */
 
 # if !defined (LDAV_DONE) && defined (__NetBSD__)
 #  define LDAV_DONE
@@ -631,11 +664,14 @@
   if (fp == NULL)
     return -1;
   count = fscanf (fp, "%lu %lu %lu %lu\n",
-                 &load_ave[0], &load_ave[1], &load_ave[2],
-                 &scale);
+                  &load_ave[0], &load_ave[1], &load_ave[2],
+                  &scale);
   (void) fclose (fp);
   if (count != 4)
-    return -1;
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
 
   for (elem = 0; elem < nelem; elem++)
     loadavg[elem] = (double) load_ave[elem] / (double) scale;
@@ -650,7 +686,7 @@
 
   host_t host;
   struct processor_set_basic_info info;
-  unsigned info_count;
+  unsigned int info_count;
 
   /* We only know how to get the 1-minute average for this system,
      so even if the caller asks for more than 1, we only return 1.  */
@@ -658,25 +694,28 @@
   if (!getloadavg_initialized)
     {
       if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS)
-       getloadavg_initialized = 1;
+        getloadavg_initialized = true;
     }
 
   if (getloadavg_initialized)
     {
       info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
       if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host,
-                             (processor_set_info_t) &info, &info_count)
-         != KERN_SUCCESS)
-       getloadavg_initialized = 0;
+                              (processor_set_info_t) &info, &info_count)
+          != KERN_SUCCESS)
+        getloadavg_initialized = false;
       else
-       {
-         if (nelem > 0)
-           loadavg[elem++] = (double) info.load_average / LOAD_SCALE;
-       }
+        {
+          if (nelem > 0)
+            loadavg[elem++] = (double) info.load_average / LOAD_SCALE;
+        }
     }
 
   if (!getloadavg_initialized)
-    return -1;
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
 # endif /* NeXT */
 
 # if !defined (LDAV_DONE) && defined (UMAX)
@@ -704,24 +743,24 @@
       desc.sd_size = sizeof conf;
 
       if (inq_stats (1, &desc))
-       return -1;
+        return -1;
 
       c = 0;
       for (i = 0; i < conf.config_maxclass; ++i)
-       {
-         struct class_stats stats;
-         memset (&stats, 0, sizeof stats);
-
-         desc.sd_type = CPUTYPE_CLASS;
-         desc.sd_objid = i;
-         desc.sd_addr = (char *) &stats;
-         desc.sd_size = sizeof stats;
-
-         if (inq_stats (1, &desc))
-           return -1;
-
-         c += stats.class_numcpus;
-       }
+        {
+          struct class_stats stats;
+          memset (&stats, 0, sizeof stats);
+
+          desc.sd_type = CPUTYPE_CLASS;
+          desc.sd_objid = i;
+          desc.sd_addr = (char *) &stats;
+          desc.sd_size = sizeof stats;
+
+          if (inq_stats (1, &desc))
+            return -1;
+
+          c += stats.class_numcpus;
+        }
       cpus = c;
       samples = cpus < 2 ? 3 : (2 * cpus / 3);
     }
@@ -742,7 +781,7 @@
     {
       load += proc_sum_data.ps_nrun[j];
       if (j++ == PS_NRUNSIZE)
-       j = 0;
+        j = 0;
     }
 
   if (nelem > 0)
@@ -755,8 +794,8 @@
      it's not supposed to fail.  The first argument is for no
      apparent reason of type `long int *'.  */
   dg_sys_info ((long int *) &load_info,
-              DG_SYS_INFO_LOAD_INFO_TYPE,
-              DG_SYS_INFO_LOAD_VERSION_0);
+               DG_SYS_INFO_LOAD_INFO_TYPE,
+               DG_SYS_INFO_LOAD_VERSION_0);
 
   if (nelem > 0)
     loadavg[elem++] = load_info.one_minute;
@@ -800,7 +839,7 @@
     = (load_ave.tl_lscale == 0
        ? load_ave.tl_avenrun.d[0]
        : (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
-# endif        /* OSF_MIPS */
+# endif /* OSF_MIPS */
 
 # if !defined (LDAV_DONE) && (defined (__MSDOS__) || defined (WINDOWS32))
 #  define LDAV_DONE
@@ -820,15 +859,15 @@
   for (elem = 0; elem < nelem; elem++)
     loadavg[elem]
       = (load_ave.tl_lscale == 0
-       ? load_ave.tl_avenrun.d[elem]
-       : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
+         ? load_ave.tl_avenrun.d[elem]
+         : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
 # endif /* OSF_ALPHA */
 
-# if !defined (LDAV_DONE) && defined (VMS)
+# if ! defined LDAV_DONE && defined __VMS
   /* VMS specific code -- read from the Load Ave driver.  */
 
   LOAD_AVE_TYPE load_ave[3];
-  static int getloadavg_initialized = 0;
+  static bool getloadavg_initialized;
 #  ifdef eunice
   struct
   {
@@ -848,27 +887,30 @@
       $DESCRIPTOR (descriptor, "LAV0:");
 #  endif
       if (sys$assign (&descriptor, &channel, 0, 0) & 1)
-       getloadavg_initialized = 1;
+        getloadavg_initialized = true;
     }
 
   /* Read the load average vector.  */
   if (getloadavg_initialized
       && !(sys$qiow (0, channel, IO$_READVBLK, 0, 0, 0,
-                    load_ave, 12, 0, 0, 0, 0) & 1))
+                     load_ave, 12, 0, 0, 0, 0) & 1))
     {
       sys$dassgn (channel);
-      getloadavg_initialized = 0;
+      getloadavg_initialized = false;
     }
 
   if (!getloadavg_initialized)
-    return -1;
-# endif /* VMS */
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
+# endif /* ! defined LDAV_DONE && defined __VMS */
 
-# if !defined (LDAV_DONE) && defined(LOAD_AVE_TYPE) && !defined(VMS)
+# if ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS
 
   /* UNIX-specific code -- read the average from /dev/kmem.  */
 
-#  define LDAV_PRIVILEGED              /* This code requires special 
installation.  */
+#  define LDAV_PRIVILEGED               /* This code requires special 
installation.  */
 
   LOAD_AVE_TYPE load_ave[3];
 
@@ -876,7 +918,7 @@
   if (offset == 0)
     {
 #  ifndef sgi
-#   ifndef NLIST_STRUCT
+#   if ! defined NLIST_STRUCT || ! defined N_NAME_POINTER
       strcpy (name_list[0].n_name, LDAV_SYMBOL);
       strcpy (name_list[1].n_name, "");
 #   else /* NLIST_STRUCT */
@@ -892,25 +934,25 @@
 #   ifndef SUNOS_5
       if (
 #    if !(defined (_AIX) && !defined (ps2))
-         nlist (KERNEL_FILE, name_list)
+          nlist (KERNEL_FILE, name_list)
 #    else  /* _AIX */
-         knlist (name_list, 1, sizeof (name_list[0]))
+          knlist (name_list, 1, sizeof (name_list[0]))
 #    endif
-         >= 0)
-         /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i.  */
-         {
+          >= 0)
+          /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i.  */
+          {
 #    ifdef FIXUP_KERNEL_SYMBOL_ADDR
-           FIXUP_KERNEL_SYMBOL_ADDR (name_list);
+            FIXUP_KERNEL_SYMBOL_ADDR (name_list);
 #    endif
-           offset = name_list[0].n_value;
-         }
+            offset = name_list[0].n_value;
+          }
 #   endif /* !SUNOS_5 */
 #  else  /* sgi */
       int ldav_off;
 
       ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
       if (ldav_off != -1)
-       offset = (long) ldav_off & 0x7fffffff;
+        offset = (long int) ldav_off & 0x7fffffff;
 #  endif /* sgi */
     }
 
@@ -918,30 +960,39 @@
   if (!getloadavg_initialized)
     {
 #  ifndef SUNOS_5
-      channel = open ("/dev/kmem", 0);
-      if (channel >= 0)
-       {
-         /* Set the channel to close on exec, so it does not
-            litter any child's descriptor table.  */
-#   ifdef F_SETFD
-#    ifndef FD_CLOEXEC
-#     define FD_CLOEXEC 1
-#    endif
-         (void) fcntl (channel, F_SETFD, FD_CLOEXEC);
-#   endif
-         getloadavg_initialized = 1;
-       }
+      /* Set the channel to close on exec, so it does not
+         litter any child's descriptor table.  */
+#   ifndef O_CLOEXEC
+#    define O_CLOEXEC 0
+#   endif
+      int fd = open ("/dev/kmem", O_RDONLY | O_CLOEXEC);
+      if (0 <= fd)
+        {
+#   if F_DUPFD_CLOEXEC
+          if (fd <= STDERR_FILENO)
+            {
+              int fd1 = fcntl (fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
+              close (fd);
+              fd = fd1;
+            }
+#   endif
+          if (0 <= fd)
+            {
+              channel = fd;
+              getloadavg_initialized = true;
+            }
+        }
 #  else /* SUNOS_5 */
       /* We pass 0 for the kernel, corefile, and swapfile names
-        to use the currently running kernel.  */
+         to use the currently running kernel.  */
       kd = kvm_open (0, 0, 0, O_RDONLY, 0);
       if (kd != 0)
-       {
-         /* nlist the currently running kernel.  */
-         kvm_nlist (kd, name_list);
-         offset = name_list[0].n_value;
-         getloadavg_initialized = 1;
-       }
+        {
+          /* nlist the currently running kernel.  */
+          kvm_nlist (kd, name_list);
+          offset = name_list[0].n_value;
+          getloadavg_initialized = true;
+        }
 #  endif /* SUNOS_5 */
     }
 
@@ -951,25 +1002,28 @@
       /* Try to read the load.  */
 #  ifndef SUNOS_5
       if (lseek (channel, offset, 0) == -1L
-         || read (channel, (char *) load_ave, sizeof (load_ave))
-         != sizeof (load_ave))
-       {
-         close (channel);
-         getloadavg_initialized = 0;
-       }
+          || read (channel, (char *) load_ave, sizeof (load_ave))
+          != sizeof (load_ave))
+        {
+          close (channel);
+          getloadavg_initialized = false;
+        }
 #  else  /* SUNOS_5 */
       if (kvm_read (kd, offset, (char *) load_ave, sizeof (load_ave))
-         != sizeof (load_ave))
+          != sizeof (load_ave))
         {
           kvm_close (kd);
-          getloadavg_initialized = 0;
-       }
+          getloadavg_initialized = false;
+        }
 #  endif /* SUNOS_5 */
     }
 
   if (offset == 0 || !getloadavg_initialized)
-    return -1;
-# endif /* LOAD_AVE_TYPE and not VMS */
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
+# endif /* ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS */
 
 # if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS.  */
   if (nelem > 0)
@@ -982,56 +1036,9 @@
 #  define LDAV_DONE
 # endif /* !LDAV_DONE && LOAD_AVE_TYPE */
 
-# ifdef LDAV_DONE
+# if !defined LDAV_DONE
+  errno = ENOSYS;
+  elem = -1;
+# endif
   return elem;
-# else
-  /* Set errno to zero to indicate that there was no particular error;
-     this function just can't work at all on this system.  */
-  errno = 0;
-  return -1;
-# endif
-}
-
-#endif /* ! HAVE_GETLOADAVG */
-
-#ifdef TEST
-void
-main (argc, argv)
-     int argc;
-     char **argv;
-{
-  int naptime = 0;
-
-  if (argc > 1)
-    naptime = atoi (argv[1]);
-
-  while (1)
-    {
-      double avg[3];
-      int loads;
-
-      errno = 0;               /* Don't be misled if it doesn't set errno.  */
-      loads = getloadavg (avg, 3);
-      if (loads == -1)
-       {
-         perror ("Error getting load average");
-         exit (1);
-       }
-      if (loads > 0)
-       printf ("1-minute: %f  ", avg[0]);
-      if (loads > 1)
-       printf ("5-minute: %f  ", avg[1]);
-      if (loads > 2)
-       printf ("15-minute: %f  ", avg[2]);
-      if (loads > 0)
-       putchar ('\n');
-
-      if (naptime == 0)
-       break;
-      sleep (naptime);
-    }
-
-  exit (0);
-}
-#endif /* TEST */
-
+}

=== modified file 'lib/gnulib.mk'
--- a/lib/gnulib.mk     2011-02-09 01:40:01 +0000
+++ b/lib/gnulib.mk     2011-02-16 00:33:44 +0000
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. 
--makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr 
getopt-gnu ignore-value mktime strftime
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. 
--makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr 
getloadavg getopt-gnu ignore-value mktime strftime
 
 
 MOSTLYCLEANFILES += core *.stackdump
@@ -79,6 +79,15 @@
 
 ## end   gnulib module dtoastr
 
+## begin gnulib module getloadavg
+
+
+EXTRA_DIST += getloadavg.c
+
+EXTRA_libgnu_a_SOURCES += getloadavg.c
+
+## end   gnulib module getloadavg
+
 ## begin gnulib module getopt-posix
 
 BUILT_SOURCES += $(GETOPT_H)
@@ -175,6 +184,91 @@
 
 ## end   gnulib module stddef
 
+## begin gnulib module stdlib
+
+BUILT_SOURCES += stdlib.h
+
+# We need the following in order to create <stdlib.h> when the system
+# doesn't have one that works with the given compiler.
+stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
+             -e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \
+             -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \
+             -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
+             -e 
's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \
+             -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \
+             -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
+             -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \
+             -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
+             -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
+             -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \
+             -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \
+             -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
+             -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \
+             -e 's|@''GNULIB_PTSNAME''@|$(GNULIB_PTSNAME)|g' \
+             -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
+             -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \
+             -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
+             -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \
+             -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
+             -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
+             -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
+             -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
+             -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
+             -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \
+             -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
+             -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
+             < $(srcdir)/stdlib.in.h | \
+         sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
+             -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
+             -e 
's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
+             -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
+             -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
+             -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
+             -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
+             -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
+             -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
+             -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
+             -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
+             -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
+             -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
+             -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
+             -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
+             -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
+             -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
+             -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
+             -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
+             -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
+             -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' 
\
+             -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
+             -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
+             -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
+             -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
+             -e 
's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
+             -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
+             -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+             -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
+             -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
+             -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
+             -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
+             -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
+             -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += stdlib.h stdlib.h-t
+
+EXTRA_DIST += stdlib.in.h
+
+## end   gnulib module stdlib
+
 ## begin gnulib module strftime
 
 

=== added file 'lib/stdlib.in.h'
--- a/lib/stdlib.in.h   1970-01-01 00:00:00 +0000
+++ b/lib/stdlib.in.h   2011-02-16 00:33:44 +0000
@@ -0,0 +1,729 @@
+/* A GNU-like <stdlib.h>.
+
+   Copyright (C) 1995, 2001-2004, 2006-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#if __GNUC__ >= 3
address@hidden@
+#endif
address@hidden@
+
+#if defined __need_malloc_and_calloc
+/* Special invocation convention inside glibc header files.  */
+
address@hidden@ @NEXT_STDLIB_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _GL_STDLIB_H
+
+/* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_STDLIB_H@
+
+#ifndef _GL_STDLIB_H
+#define _GL_STDLIB_H
+
+/* NetBSD 5.0 mis-defines NULL.  */
+#include <stddef.h>
+
+/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.  */
+#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
+# include <sys/wait.h>
+#endif
+
+/* Solaris declares getloadavg() in <sys/loadavg.h>.  */
+#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
+# include <sys/loadavg.h>
+#endif
+
+#if @GNULIB_RANDOM_R@
+
+/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
+   from <stdlib.h> if _REENTRANT is defined.  Include it whenever we need
+   'struct random_data'.  */
+# if @HAVE_RANDOM_H@
+#  include <random.h>
+# endif
+
+# if address@hidden@ || address@hidden@
+#  include <stdint.h>
+# endif
+
+# if address@hidden@
+/* Define 'struct random_data'.
+   But allow multiple gnulib generated <stdlib.h> replacements to coexist.  */
+#  if !GNULIB_defined_struct_random_data
+struct random_data
+{
+  int32_t *fptr;                /* Front pointer.  */
+  int32_t *rptr;                /* Rear pointer.  */
+  int32_t *state;               /* Array of state values.  */
+  int rand_type;                /* Type of random number generator.  */
+  int rand_deg;                 /* Degree of random number generator.  */
+  int rand_sep;                 /* Distance between front and rear.  */
+  int32_t *end_ptr;             /* Pointer behind state table.  */
+};
+#   define GNULIB_defined_struct_random_data 1
+#  endif
+# endif
+#endif
+
+#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! 
defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined 
__CYGWIN__)
+/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
+/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
+/* But avoid namespace pollution on glibc systems and native Windows.  */
+# include <unistd.h>
+#endif
+
+#if 3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__
+# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#else
+# define _GL_ATTRIBUTE_NORETURN
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
+#ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+#endif
+/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
+   with proper operation of xargs.  */
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#elif EXIT_FAILURE != 1
+# undef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
+
+#if @GNULIB__EXIT@
+/* Terminate the current process with the given return code, without running
+   the 'atexit' handlers.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (_Exit, void, (int status) _GL_ATTRIBUTE_NORETURN);
+# endif
+_GL_CXXALIAS_SYS (_Exit, void, (int status));
+_GL_CXXALIASWARN (_Exit);
+#elif defined GNULIB_POSIXCHECK
+# undef _Exit
+# if HAVE_RAW_DECL__EXIT
+_GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
+                 "use gnulib module _Exit for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ATOLL@
+/* Parse a signed decimal integer.
+   Returns the value of the integer.  Errors are not detected.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL 
((1)));
+# endif
+_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
+_GL_CXXALIASWARN (atoll);
+#elif defined GNULIB_POSIXCHECK
+# undef atoll
+# if HAVE_RAW_DECL_ATOLL
+_GL_WARN_ON_USE (atoll, "atoll is unportable - "
+                 "use gnulib module atoll for portability");
+# endif
+#endif
+
+#if @GNULIB_CALLOC_POSIX@
+# if @REPLACE_CALLOC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef calloc
+#   define calloc rpl_calloc
+#  endif
+_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
+_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
+# else
+_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
+# endif
+_GL_CXXALIASWARN (calloc);
+#elif defined GNULIB_POSIXCHECK
+# undef calloc
+/* Assume calloc is always declared.  */
+_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
+                 "use gnulib module calloc-posix for portability");
+#endif
+
+#if @GNULIB_CANONICALIZE_FILE_NAME@
+# if @REPLACE_CANONICALIZE_FILE_NAME@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define canonicalize_file_name rpl_canonicalize_file_name
+#  endif
+_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
+                                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
+                                                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
+# endif
+_GL_CXXALIASWARN (canonicalize_file_name);
+#elif defined GNULIB_POSIXCHECK
+# undef canonicalize_file_name
+# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
+_GL_WARN_ON_USE (canonicalize_file_name,
+                 "canonicalize_file_name is unportable - "
+                 "use gnulib module canonicalize-lgpl for portability");
+# endif
+#endif
+
+#if @GNULIB_GETLOADAVG@
+/* Store max(NELEM,3) load average numbers in LOADAVG[].
+   The three numbers are the load average of the last 1 minute, the last 5
+   minutes, and the last 15 minutes, respectively.
+   LOADAVG is an array of NELEM numbers.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
+                                   _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
+_GL_CXXALIASWARN (getloadavg);
+#elif defined GNULIB_POSIXCHECK
+# undef getloadavg
+# if HAVE_RAW_DECL_GETLOADAVG
+_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
+                 "use gnulib module getloadavg for portability");
+# endif
+#endif
+
+#if @GNULIB_GETSUBOPT@
+/* Assuming *OPTIONP is a comma separated list of elements of the form
+   "token" or "token=value", getsubopt parses the first of these elements.
+   If the first element refers to a "token" that is member of the given
+   NULL-terminated array of tokens:
+     - It replaces the comma with a NUL byte, updates *OPTIONP to point past
+       the first option and the comma, sets *VALUEP to the value of the
+       element (or NULL if it doesn't contain an "=" sign),
+     - It returns the index of the "token" in the given array of tokens.
+   Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
+   For more details see the POSIX:2001 specification.
+   http://www.opengroup.org/susv3xsh/getsubopt.html */
+# if address@hidden@
+_GL_FUNCDECL_SYS (getsubopt, int,
+                  (char **optionp, char *const *tokens, char **valuep)
+                  _GL_ARG_NONNULL ((1, 2, 3)));
+# endif
+_GL_CXXALIAS_SYS (getsubopt, int,
+                  (char **optionp, char *const *tokens, char **valuep));
+_GL_CXXALIASWARN (getsubopt);
+#elif defined GNULIB_POSIXCHECK
+# undef getsubopt
+# if HAVE_RAW_DECL_GETSUBOPT
+_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
+                 "use gnulib module getsubopt for portability");
+# endif
+#endif
+
+#if @GNULIB_GRANTPT@
+/* Change the ownership and access permission of the slave side of the
+   pseudo-terminal whose master side is specified by FD.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (grantpt, int, (int fd));
+# endif
+_GL_CXXALIAS_SYS (grantpt, int, (int fd));
+_GL_CXXALIASWARN (grantpt);
+#elif defined GNULIB_POSIXCHECK
+# undef grantpt
+# if HAVE_RAW_DECL_GRANTPT
+_GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
+                 "use gnulib module grantpt for portability");
+# endif
+#endif
+
+#if @GNULIB_MALLOC_POSIX@
+# if @REPLACE_MALLOC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef malloc
+#   define malloc rpl_malloc
+#  endif
+_GL_FUNCDECL_RPL (malloc, void *, (size_t size));
+_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
+# else
+_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
+# endif
+_GL_CXXALIASWARN (malloc);
+#elif defined GNULIB_POSIXCHECK
+# undef malloc
+/* Assume malloc is always declared.  */
+_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
+                 "use gnulib module malloc-posix for portability");
+#endif
+
+#if @GNULIB_MKDTEMP@
+/* Create a unique temporary directory from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the directory name unique.
+   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
+   The directory is created mode 700.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL 
((1)));
+# endif
+_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
+_GL_CXXALIASWARN (mkdtemp);
+#elif defined GNULIB_POSIXCHECK
+# undef mkdtemp
+# if HAVE_RAW_DECL_MKDTEMP
+_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
+                 "use gnulib module mkdtemp for portability");
+# endif
+#endif
+
+#if @GNULIB_MKOSTEMP@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
+   and O_TEXT, O_BINARY (defined in "binary-io.h").
+   The file is then created, with the specified flags, ensuring it didn't exist
+   before.
+   The file is created read-write (mask at least 0600 & ~umask), but it may be
+   world-readable and world-writable (mask 0666 & ~umask), depending on the
+   implementation.
+   Returns the open file descriptor if successful, otherwise -1 and errno
+   set.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
+                                 _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
+_GL_CXXALIASWARN (mkostemp);
+#elif defined GNULIB_POSIXCHECK
+# undef mkostemp
+# if HAVE_RAW_DECL_MKOSTEMP
+_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
+                 "use gnulib module mkostemp for portability");
+# endif
+#endif
+
+#if @GNULIB_MKOSTEMPS@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE before a suffix of length
+   SUFFIXLEN must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
+   and O_TEXT, O_BINARY (defined in "binary-io.h").
+   The file is then created, with the specified flags, ensuring it didn't exist
+   before.
+   The file is created read-write (mask at least 0600 & ~umask), but it may be
+   world-readable and world-writable (mask 0666 & ~umask), depending on the
+   implementation.
+   Returns the open file descriptor if successful, otherwise -1 and errno
+   set.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (mkostemps, int,
+                  (char * /*template*/, int /*suffixlen*/, int /*flags*/)
+                  _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (mkostemps, int,
+                  (char * /*template*/, int /*suffixlen*/, int /*flags*/));
+_GL_CXXALIASWARN (mkostemps);
+#elif defined GNULIB_POSIXCHECK
+# undef mkostemps
+# if HAVE_RAW_DECL_MKOSTEMPS
+_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
+                 "use gnulib module mkostemps for portability");
+# endif
+#endif
+
+#if @GNULIB_MKSTEMP@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   The file is then created, ensuring it didn't exist before.
+   The file is created read-write (mask at least 0600 & ~umask), but it may be
+   world-readable and world-writable (mask 0666 & ~umask), depending on the
+   implementation.
+   Returns the open file descriptor if successful, otherwise -1 and errno
+   set.  */
+# if @REPLACE_MKSTEMP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define mkstemp rpl_mkstemp
+#  endif
+_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
+# else
+#  if ! @HAVE_MKSTEMP@
+_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
+# endif
+_GL_CXXALIASWARN (mkstemp);
+#elif defined GNULIB_POSIXCHECK
+# undef mkstemp
+# if HAVE_RAW_DECL_MKSTEMP
+_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
+                 "use gnulib module mkstemp for portability");
+# endif
+#endif
+
+#if @GNULIB_MKSTEMPS@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE prior to a suffix of length
+   SUFFIXLEN must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   The file is then created, ensuring it didn't exist before.
+   The file is created read-write (mask at least 0600 & ~umask), but it may be
+   world-readable and world-writable (mask 0666 & ~umask), depending on the
+   implementation.
+   Returns the open file descriptor if successful, otherwise -1 and errno
+   set.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
+                                 _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
+_GL_CXXALIASWARN (mkstemps);
+#elif defined GNULIB_POSIXCHECK
+# undef mkstemps
+# if HAVE_RAW_DECL_MKSTEMPS
+_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
+                 "use gnulib module mkstemps for portability");
+# endif
+#endif
+
+#if @GNULIB_PTSNAME@
+/* Return the pathname of the pseudo-terminal slave associated with
+   the master FD is open on, or NULL on errors.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (ptsname, char *, (int fd));
+# endif
+_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
+_GL_CXXALIASWARN (ptsname);
+#elif defined GNULIB_POSIXCHECK
+# undef ptsname
+# if HAVE_RAW_DECL_PTSNAME
+_GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
+                 "use gnulib module ptsname for portability");
+# endif
+#endif
+
+#if @GNULIB_PUTENV@
+# if @REPLACE_PUTENV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putenv
+#   define putenv rpl_putenv
+#  endif
+_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (putenv, int, (char *string));
+# else
+_GL_CXXALIAS_SYS (putenv, int, (char *string));
+# endif
+_GL_CXXALIASWARN (putenv);
+#endif
+
+
+#if @GNULIB_RANDOM_R@
+# if address@hidden@
+#  ifndef RAND_MAX
+#   define RAND_MAX 2147483647
+#  endif
+# endif
+#endif
+
+#if @GNULIB_RANDOM_R@
+# if address@hidden@
+_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
+                                 _GL_ARG_NONNULL ((1, 2)));
+# endif
+_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
+_GL_CXXALIASWARN (random_r);
+#elif defined GNULIB_POSIXCHECK
+# undef random_r
+# if HAVE_RAW_DECL_RANDOM_R
+_GL_WARN_ON_USE (random_r, "random_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM_R@
+# if address@hidden@
+_GL_FUNCDECL_SYS (srandom_r, int,
+                  (unsigned int seed, struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (srandom_r, int,
+                  (unsigned int seed, struct random_data *rand_state));
+_GL_CXXALIASWARN (srandom_r);
+#elif defined GNULIB_POSIXCHECK
+# undef srandom_r
+# if HAVE_RAW_DECL_SRANDOM_R
+_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM_R@
+# if address@hidden@
+_GL_FUNCDECL_SYS (initstate_r, int,
+                  (unsigned int seed, char *buf, size_t buf_size,
+                   struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((2, 4)));
+# endif
+_GL_CXXALIAS_SYS (initstate_r, int,
+                  (unsigned int seed, char *buf, size_t buf_size,
+                   struct random_data *rand_state));
+_GL_CXXALIASWARN (initstate_r);
+#elif defined GNULIB_POSIXCHECK
+# undef initstate_r
+# if HAVE_RAW_DECL_INITSTATE_R
+_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM_R@
+# if address@hidden@
+_GL_FUNCDECL_SYS (setstate_r, int,
+                  (char *arg_state, struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((1, 2)));
+# endif
+_GL_CXXALIAS_SYS (setstate_r, int,
+                  (char *arg_state, struct random_data *rand_state));
+_GL_CXXALIASWARN (setstate_r);
+#elif defined GNULIB_POSIXCHECK
+# undef setstate_r
+# if HAVE_RAW_DECL_SETSTATE_R
+_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
+#endif
+
+
+#if @GNULIB_REALLOC_POSIX@
+# if @REPLACE_REALLOC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef realloc
+#   define realloc rpl_realloc
+#  endif
+_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
+_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
+# else
+_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
+# endif
+_GL_CXXALIASWARN (realloc);
+#elif defined GNULIB_POSIXCHECK
+# undef realloc
+/* Assume realloc is always declared.  */
+_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
+                 "use gnulib module realloc-posix for portability");
+#endif
+
+#if @GNULIB_REALPATH@
+# if @REPLACE_REALPATH@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define realpath rpl_realpath
+#  endif
+_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
+                                    _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
+                                    _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
+# endif
+_GL_CXXALIASWARN (realpath);
+#elif defined GNULIB_POSIXCHECK
+# undef realpath
+# if HAVE_RAW_DECL_REALPATH
+_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
+                 "canonicalize or canonicalize-lgpl for portability");
+# endif
+#endif
+
+#if @GNULIB_RPMATCH@
+/* Test a user response to a question.
+   Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
+_GL_CXXALIASWARN (rpmatch);
+#elif defined GNULIB_POSIXCHECK
+# undef rpmatch
+# if HAVE_RAW_DECL_RPMATCH
+_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
+                 "use gnulib module rpmatch for portability");
+# endif
+#endif
+
+#if @GNULIB_SETENV@
+/* Set NAME to VALUE in the environment.
+   If REPLACE is nonzero, overwrite an existing value.  */
+# if @REPLACE_SETENV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef setenv
+#   define setenv rpl_setenv
+#  endif
+_GL_FUNCDECL_RPL (setenv, int,
+                  (const char *name, const char *value, int replace)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (setenv, int,
+                  (const char *name, const char *value, int replace));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (setenv, int,
+                  (const char *name, const char *value, int replace)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (setenv, int,
+                  (const char *name, const char *value, int replace));
+# endif
+# if !(@REPLACE_SETENV@ && address@hidden@)
+_GL_CXXALIASWARN (setenv);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef setenv
+# if HAVE_RAW_DECL_SETENV
+_GL_WARN_ON_USE (setenv, "setenv is unportable - "
+                 "use gnulib module setenv for portability");
+# endif
+#endif
+
+#if @GNULIB_STRTOD@
+ /* Parse a double from STRING, updating ENDP if appropriate.  */
+# if @REPLACE_STRTOD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strtod rpl_strtod
+#  endif
+_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
+                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
+                                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
+# endif
+_GL_CXXALIASWARN (strtod);
+#elif defined GNULIB_POSIXCHECK
+# undef strtod
+# if HAVE_RAW_DECL_STRTOD
+_GL_WARN_ON_USE (strtod, "strtod is unportable - "
+                 "use gnulib module strtod for portability");
+# endif
+#endif
+
+#if @GNULIB_STRTOLL@
+/* Parse a signed integer whose textual representation starts at STRING.
+   The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
+   it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
+   "0x").
+   If ENDPTR is not NULL, the address of the first byte after the integer is
+   stored in *ENDPTR.
+   Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
+   to ERANGE.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (strtoll, long long,
+                  (const char *string, char **endptr, int base)
+                  _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (strtoll, long long,
+                  (const char *string, char **endptr, int base));
+_GL_CXXALIASWARN (strtoll);
+#elif defined GNULIB_POSIXCHECK
+# undef strtoll
+# if HAVE_RAW_DECL_STRTOLL
+_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
+                 "use gnulib module strtoll for portability");
+# endif
+#endif
+
+#if @GNULIB_STRTOULL@
+/* Parse an unsigned integer whose textual representation starts at STRING.
+   The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
+   it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
+   "0x").
+   If ENDPTR is not NULL, the address of the first byte after the integer is
+   stored in *ENDPTR.
+   Upon overflow, the return value is ULLONG_MAX, and errno is set to
+   ERANGE.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (strtoull, unsigned long long,
+                  (const char *string, char **endptr, int base)
+                  _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (strtoull, unsigned long long,
+                  (const char *string, char **endptr, int base));
+_GL_CXXALIASWARN (strtoull);
+#elif defined GNULIB_POSIXCHECK
+# undef strtoull
+# if HAVE_RAW_DECL_STRTOULL
+_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
+                 "use gnulib module strtoull for portability");
+# endif
+#endif
+
+#if @GNULIB_UNLOCKPT@
+/* Unlock the slave side of the pseudo-terminal whose master side is specified
+   by FD, so that it can be opened.  */
+# if address@hidden@
+_GL_FUNCDECL_SYS (unlockpt, int, (int fd));
+# endif
+_GL_CXXALIAS_SYS (unlockpt, int, (int fd));
+_GL_CXXALIASWARN (unlockpt);
+#elif defined GNULIB_POSIXCHECK
+# undef unlockpt
+# if HAVE_RAW_DECL_UNLOCKPT
+_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
+                 "use gnulib module unlockpt for portability");
+# endif
+#endif
+
+#if @GNULIB_UNSETENV@
+/* Remove the variable NAME from the environment.  */
+# if @REPLACE_UNSETENV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unsetenv
+#   define unsetenv rpl_unsetenv
+#  endif
+_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
+# endif
+# if !(@REPLACE_UNSETENV@ && address@hidden@)
+_GL_CXXALIASWARN (unsetenv);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef unsetenv
+# if HAVE_RAW_DECL_UNSETENV
+_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
+                 "use gnulib module unsetenv for portability");
+# endif
+#endif
+
+
+#endif /* _GL_STDLIB_H */
+#endif /* _GL_STDLIB_H */
+#endif

=== added file 'm4/getloadavg.m4'
--- a/m4/getloadavg.m4  1970-01-01 00:00:00 +0000
+++ b/m4/getloadavg.m4  2011-02-16 00:33:44 +0000
@@ -0,0 +1,156 @@
+# Check for getloadavg.
+
+# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2011 Free Software
+# Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 2
+
+# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
+# New applications should use gl_GETLOADAVG instead.
+
+# gl_GETLOADAVG(LIBOBJDIR)
+# ------------------------
+AC_DEFUN([gl_GETLOADAVG],
+[AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+# Persuade glibc <stdlib.h> to declare getloadavg().
+AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+# 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
+
+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])
+
+if test "x$gl_save_LIBS" = x; then
+  GETLOADAVG_LIBS=$LIBS
+else
+  GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_save_LIBS!!"`
+fi
+LIBS=$gl_save_LIBS
+
+AC_SUBST([GETLOADAVG_LIBS])dnl
+
+# Test whether the system declares getloadavg. Solaris has the function
+# but declares it in <sys/loadavg.h>, not <stdlib.h>.
+AC_CHECK_HEADERS([sys/loadavg.h])
+if test $ac_cv_header_sys_loadavg_h = yes; then
+  HAVE_SYS_LOADAVG_H=1
+else
+  HAVE_SYS_LOADAVG_H=0
+fi
+AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0],
+  [#if HAVE_SYS_LOADAVG_H
+   # include <sys/loadavg.h>
+   #endif
+   #include <stdlib.h>])
+])# gl_GETLOADAVG
+
+
+# gl_PREREQ_GETLOADAVG
+# --------------------
+# Set up the AC_LIBOBJ replacement of `getloadavg'.
+AC_DEFUN([gl_PREREQ_GETLOADAVG],
+[
+# Figure out what our getloadavg.c needs.
+
+# 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
+# Irix 4.0.5F has the header but not the library.
+if test $gl_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes \
+    && test "$ac_cv_lib_kvm_kvm_open" = yes; then
+  gl_have_func=yes
+  AC_DEFINE([SVR4], [1], [Define to 1 on System V Release 4.])
+fi
+
+if test $gl_have_func = no; then
+  AC_CHECK_HEADER([inq_stats/cpustats.h],
+  [gl_have_func=yes
+   AC_DEFINE([UMAX], [1], [Define to 1 for Encore UMAX.])
+   AC_DEFINE([UMAX4_3], [1],
+             [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h>
+              instead of <sys/cpustats.h>.])])
+fi
+
+if test $gl_have_func = no; then
+  AC_CHECK_HEADER([sys/cpustats.h],
+  [gl_have_func=yes; AC_DEFINE([UMAX])])
+fi
+
+if test $gl_have_func = no; then
+  AC_CHECK_HEADERS([mach/mach.h])
+fi
+
+AC_CHECK_HEADERS([nlist.h],
+[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
+                  [], [],
+                  address@hidden:@include <nlist.h>])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
+                   [[struct nlist x;
+                    #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
+                    x.n_un.n_name = "";
+                    #else
+                    x.n_name = "";
+                    #endif]])],
+                [AC_DEFINE([N_NAME_POINTER], [1],
+                           [Define to 1 if the nlist n_name member is a 
pointer])])
+])dnl
+])# gl_PREREQ_GETLOADAVG

=== modified file 'm4/gl-comp.m4'
--- a/m4/gl-comp.m4     2011-02-03 19:29:35 +0000
+++ b/m4/gl-comp.m4     2011-02-16 00:33:44 +0000
@@ -31,6 +31,7 @@
   # Code from module dtoastr:
   # Code from module extensions:
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  # Code from module getloadavg:
   # Code from module getopt-gnu:
   # Code from module getopt-posix:
   # Code from module gettext-h:
@@ -41,6 +42,7 @@
   # Code from module multiarch:
   # Code from module stdbool:
   # Code from module stddef:
+  # Code from module stdlib:
   # Code from module strftime:
   # Code from module time:
   # Code from module time_r:
@@ -69,6 +71,9 @@
   # Code from module dtoastr:
   AC_REQUIRE([gl_C99_STRTOLD])
   # Code from module extensions:
+  # Code from module getloadavg:
+  gl_GETLOADAVG([$gl_source_base])
+  gl_STDLIB_MODULE_INDICATOR([getloadavg])
   # Code from module getopt-gnu:
   gl_FUNC_GETOPT_GNU
   gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu])
@@ -90,6 +95,8 @@
   AM_STDBOOL_H
   # Code from module stddef:
   gl_STDDEF_H
+  # Code from module stdlib:
+  gl_STDLIB_H
   # Code from module strftime:
   gl_FUNC_GNU_STRFTIME
   # Code from module time:
@@ -246,6 +253,7 @@
   lib/dtoastr.c
   lib/ftoastr.c
   lib/ftoastr.h
+  lib/getloadavg.c
   lib/getopt.c
   lib/getopt.in.h
   lib/getopt1.c
@@ -257,6 +265,7 @@
   lib/mktime.c
   lib/stdbool.in.h
   lib/stddef.in.h
+  lib/stdlib.in.h
   lib/strftime.c
   lib/strftime.h
   lib/time.in.h
@@ -265,6 +274,7 @@
   m4/00gnulib.m4
   m4/c-strtod.m4
   m4/extensions.m4
+  m4/getloadavg.m4
   m4/getopt.m4
   m4/gnulib-common.m4
   m4/include_next.m4
@@ -272,6 +282,7 @@
   m4/multiarch.m4
   m4/stdbool.m4
   m4/stddef_h.m4
+  m4/stdlib_h.m4
   m4/strftime.m4
   m4/time_h.m4
   m4/time_r.m4

=== added file 'm4/stdlib_h.m4'
--- a/m4/stdlib_h.m4    1970-01-01 00:00:00 +0000
+++ b/m4/stdlib_h.m4    2011-02-16 00:33:44 +0000
@@ -0,0 +1,101 @@
+# stdlib_h.m4 serial 36
+dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_STDLIB_H],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  gl_NEXT_HEADERS([stdlib.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
+#if HAVE_SYS_LOADAVG_H
+# include <sys/loadavg.h>
+#endif
+#if HAVE_RANDOM_H
+# include <random.h>
+#endif
+    ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt 
mkdtemp
+    mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r
+    setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt
+    unsetenv])
+])
+
+AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+AC_DEFUN([gl_STDLIB_H_DEFAULTS],
+[
+  GNULIB__EXIT=0;         AC_SUBST([GNULIB__EXIT])
+  GNULIB_ATOLL=0;         AC_SUBST([GNULIB_ATOLL])
+  GNULIB_CALLOC_POSIX=0;  AC_SUBST([GNULIB_CALLOC_POSIX])
+  GNULIB_CANONICALIZE_FILE_NAME=0;  AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME])
+  GNULIB_GETLOADAVG=0;    AC_SUBST([GNULIB_GETLOADAVG])
+  GNULIB_GETSUBOPT=0;     AC_SUBST([GNULIB_GETSUBOPT])
+  GNULIB_GRANTPT=0;       AC_SUBST([GNULIB_GRANTPT])
+  GNULIB_MALLOC_POSIX=0;  AC_SUBST([GNULIB_MALLOC_POSIX])
+  GNULIB_MKDTEMP=0;       AC_SUBST([GNULIB_MKDTEMP])
+  GNULIB_MKOSTEMP=0;      AC_SUBST([GNULIB_MKOSTEMP])
+  GNULIB_MKOSTEMPS=0;     AC_SUBST([GNULIB_MKOSTEMPS])
+  GNULIB_MKSTEMP=0;       AC_SUBST([GNULIB_MKSTEMP])
+  GNULIB_MKSTEMPS=0;      AC_SUBST([GNULIB_MKSTEMPS])
+  GNULIB_PTSNAME=0;       AC_SUBST([GNULIB_PTSNAME])
+  GNULIB_PUTENV=0;        AC_SUBST([GNULIB_PUTENV])
+  GNULIB_RANDOM_R=0;      AC_SUBST([GNULIB_RANDOM_R])
+  GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
+  GNULIB_REALPATH=0;      AC_SUBST([GNULIB_REALPATH])
+  GNULIB_RPMATCH=0;       AC_SUBST([GNULIB_RPMATCH])
+  GNULIB_SETENV=0;        AC_SUBST([GNULIB_SETENV])
+  GNULIB_STRTOD=0;        AC_SUBST([GNULIB_STRTOD])
+  GNULIB_STRTOLL=0;       AC_SUBST([GNULIB_STRTOLL])
+  GNULIB_STRTOULL=0;      AC_SUBST([GNULIB_STRTOULL])
+  GNULIB_SYSTEM_POSIX=0;  AC_SUBST([GNULIB_SYSTEM_POSIX])
+  GNULIB_UNLOCKPT=0;      AC_SUBST([GNULIB_UNLOCKPT])
+  GNULIB_UNSETENV=0;      AC_SUBST([GNULIB_UNSETENV])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE__EXIT=1;              AC_SUBST([HAVE__EXIT])
+  HAVE_ATOLL=1;              AC_SUBST([HAVE_ATOLL])
+  HAVE_CANONICALIZE_FILE_NAME=1;  AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
+  HAVE_DECL_GETLOADAVG=1;    AC_SUBST([HAVE_DECL_GETLOADAVG])
+  HAVE_GETSUBOPT=1;          AC_SUBST([HAVE_GETSUBOPT])
+  HAVE_GRANTPT=1;            AC_SUBST([HAVE_GRANTPT])
+  HAVE_MKDTEMP=1;            AC_SUBST([HAVE_MKDTEMP])
+  HAVE_MKOSTEMP=1;           AC_SUBST([HAVE_MKOSTEMP])
+  HAVE_MKOSTEMPS=1;          AC_SUBST([HAVE_MKOSTEMPS])
+  HAVE_MKSTEMP=1;            AC_SUBST([HAVE_MKSTEMP])
+  HAVE_MKSTEMPS=1;           AC_SUBST([HAVE_MKSTEMPS])
+  HAVE_PTSNAME=1;            AC_SUBST([HAVE_PTSNAME])
+  HAVE_RANDOM_H=1;           AC_SUBST([HAVE_RANDOM_H])
+  HAVE_RANDOM_R=1;           AC_SUBST([HAVE_RANDOM_R])
+  HAVE_REALPATH=1;           AC_SUBST([HAVE_REALPATH])
+  HAVE_RPMATCH=1;            AC_SUBST([HAVE_RPMATCH])
+  HAVE_SETENV=1;             AC_SUBST([HAVE_SETENV])
+  HAVE_DECL_SETENV=1;        AC_SUBST([HAVE_DECL_SETENV])
+  HAVE_STRTOD=1;             AC_SUBST([HAVE_STRTOD])
+  HAVE_STRTOLL=1;            AC_SUBST([HAVE_STRTOLL])
+  HAVE_STRTOULL=1;           AC_SUBST([HAVE_STRTOULL])
+  HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
+  HAVE_SYS_LOADAVG_H=0;      AC_SUBST([HAVE_SYS_LOADAVG_H])
+  HAVE_UNLOCKPT=1;           AC_SUBST([HAVE_UNLOCKPT])
+  HAVE_DECL_UNSETENV=1;      AC_SUBST([HAVE_DECL_UNSETENV])
+  REPLACE_CALLOC=0;          AC_SUBST([REPLACE_CALLOC])
+  REPLACE_CANONICALIZE_FILE_NAME=0;  AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
+  REPLACE_MALLOC=0;          AC_SUBST([REPLACE_MALLOC])
+  REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
+  REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
+  REPLACE_REALLOC=0;         AC_SUBST([REPLACE_REALLOC])
+  REPLACE_REALPATH=0;        AC_SUBST([REPLACE_REALPATH])
+  REPLACE_SETENV=0;          AC_SUBST([REPLACE_SETENV])
+  REPLACE_STRTOD=0;          AC_SUBST([REPLACE_STRTOD])
+  REPLACE_UNSETENV=0;        AC_SUBST([REPLACE_UNSETENV])
+])

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-02-15 03:57:00 +0000
+++ b/src/ChangeLog     2011-02-16 00:33:44 +0000
@@ -1,3 +1,29 @@
+2011-02-16  Paul Eggert  <address@hidden>
+
+       Remove no-longer needed getloadavg symbols.
+       * m/alpha.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+       * m/amdx86-64.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+       * m/ia64.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+       * m/ibms390.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+       * m/macppc.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+       * m/sparc.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+       * m/template.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+       * m/vax.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
+       * s/aix4-2.h (KERNEL_FILE, LDAV_SYMBOL): Remove.
+       * s/bsd-common.h (KERNEL_FILE, LDAV_SYMBOL): Remove #undef.
+       * s/hpux10-20.h (KERNEL_FILE, LOAD_AVE_TYPE, LOAD_AVE_CVT):
+       (LDAV_SYMBOL): Remove.
+       * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): Remove.
+       * s/usg5-4-common.h (KERNEL_FILE, LDAV_SYMBOL): Remove.
+
+       Import getloadavg module from gnulib.
+       * deps.mk (getloadavg.o): Remove; gnulib now does this.
+       * lisp.h (getloadavg) [!defined HAVE_GETLOADAVG]: Remove; gnulib
+       now does this.
+       * src/s/freebsd.h (HAVE_GETLOADAVG): Remove; gnulib now does this.
+       * src/s/netbsd.h (HAVE_GETLOADAVG): Likewise.
+       * config.in: Regenerate.
+
 2011-02-15  Eli Zaretskii  <address@hidden>
 
        * nsfns.m (ns_set_name_as_filename, Fns_read_file_name): Use B_.
@@ -9,7 +35,7 @@
 
 2011-02-14  Eli Zaretskii  <address@hidden>
 
-       * msdos.c (IT_frame_up_to_date): 
+       * msdos.c (IT_frame_up_to_date):
        * s/msdos.h (MODE_LINE_BINARY_TEXT): Use B_ for the MS-DOS build.
 
        * dired.c (directory_files_internal):

=== modified file 'src/config.in'
--- a/src/config.in     2011-02-05 05:07:22 +0000
+++ b/src/config.in     2011-02-16 00:33:44 +0000
@@ -42,9 +42,6 @@
 /* Define to 1 if using `alloca.c'. */
 #undef C_ALLOCA
 
-/* Define to 1 if using `getloadavg.c'. */
-#undef C_GETLOADAVG
-
 /* Define to 1 for DGUX with <sys/dg_sys_info.h>. */
 #undef DGUX
 
@@ -74,10 +71,6 @@
 /* Define this to check for short string overrun. */
 #undef GC_CHECK_STRING_OVERRUN
 
-/* Define to 1 if the `getloadavg' function needs to be run setuid or setgid.
-   */
-#undef GETLOADAVG_PRIVILEGED
-
 /* Define to 1 if the `getpgrp' function requires zero arguments. */
 #undef GETPGRP_VOID
 
@@ -225,9 +218,6 @@
 /* Define to 1 if you have the `getline' function. */
 #undef HAVE_GETLINE
 
-/* Define to 1 if you have the `getloadavg' function. */
-#undef HAVE_GETLOADAVG
-
 /* Define to 1 if you have the <getopt.h> header file. */
 #undef HAVE_GETOPT_H
 
@@ -408,6 +398,9 @@
 /* Define to 1 if using libotf. */
 #undef HAVE_LIBOTF
 
+/* Define to 1 if you have the `perfstat' library (-lperfstat). */
+#undef HAVE_LIBPERFSTAT
+
 /* Define to 1 if you have the <libpng/png.h> header file. */
 #undef HAVE_LIBPNG_PNG_H
 
@@ -672,6 +665,9 @@
 /* Define to 1 if you have the `sysinfo' function. */
 #undef HAVE_SYSINFO
 
+/* Define to 1 if you have the <sys/loadavg.h> header file. */
+#undef HAVE_SYS_LOADAVG_H
+
 /* Define to 1 if you have the <sys/mman.h> header file. */
 #undef HAVE_SYS_MMAN_H
 
@@ -870,10 +866,6 @@
 /* Define to support POP mail retrieval. */
 #undef MAIL_USE_POP
 
-/* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend
-   on `HAVE_STRUCT_NLIST_N_UN_N_NAME */
-#undef NLIST_NAME_UNION
-
 /* Define to 1 if you don't have struct exception in math.h. */
 #undef NO_MATHERR
 
@@ -889,6 +881,9 @@
 /* Define to 1 if you are using NS windowing under GNUstep. */
 #undef NS_IMPL_GNUSTEP
 
+/* Define to 1 if the nlist n_name member is a pointer */
+#undef N_NAME_POINTER
+
 /* Define if the C compiler is the linker. */
 #undef ORDINARY_LINK
 

=== modified file 'src/deps.mk'
--- a/src/deps.mk       2011-02-04 12:01:34 +0000
+++ b/src/deps.mk       2011-02-16 00:33:44 +0000
@@ -115,7 +115,6 @@
 ftfont.o: ftfont.c dispextern.h frame.h character.h charset.h composite.h \
    font.h lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h \
    fontset.h ccl.h ftfont.h globals.h
-getloadavg.o: getloadavg.c $(config_h)
 gnutls.o: gnutls.c gnutls.h process.h ../lib/unistd.h \
    lisp.h globals.h $(config_h)
 gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2011-02-14 15:39:19 +0000
+++ b/src/lisp.h        2011-02-16 00:33:44 +0000
@@ -3407,11 +3407,6 @@
 EXFUN (Fx_load_color_file, 1);
 extern void syms_of_xfaces (void);
 
-#ifndef HAVE_GETLOADAVG
-/* Defined in getloadavg.c */
-extern int getloadavg (double *, int);
-#endif
-
 #ifdef HAVE_X_WINDOWS
 /* Defined in xfns.c */
 extern void syms_of_xfns (void);

=== modified file 'src/m/alpha.h'
--- a/src/m/alpha.h     2011-01-25 04:08:28 +0000
+++ b/src/m/alpha.h     2011-02-16 00:33:44 +0000
@@ -29,12 +29,6 @@
 /* __alpha defined automatically */
 
 
-/* Data type of load average, as read out of kmem.  */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
 #ifdef __ELF__
 
 #if !defined(GNU_LINUX) && !defined(__NetBSD__)
@@ -57,4 +51,3 @@
    Define DBL_MIN_REPLACEMENT to be the next value larger than DBL_MIN:
    this avoids the assembler bug.  */
 #define DBL_MIN_REPLACEMENT 2.2250738585072019e-308
-

=== modified file 'src/m/amdx86-64.h'
--- a/src/m/amdx86-64.h 2011-01-25 04:08:28 +0000
+++ b/src/m/amdx86-64.h 2011-02-16 00:33:44 +0000
@@ -30,12 +30,5 @@
 #define EMACS_INT               long
 #define EMACS_UINT              unsigned long
 
-/* Data type of load average, as read out of kmem.  */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
 /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
 #undef DATA_SEG_BITS
-

=== modified file 'src/m/ia64.h'
--- a/src/m/ia64.h      2011-01-25 04:08:28 +0000
+++ b/src/m/ia64.h      2011-02-16 00:33:44 +0000
@@ -30,12 +30,6 @@
 #define EMACS_INT              long
 #define EMACS_UINT             unsigned long
 
-/* Data type of load average, as read out of kmem.  */
-#define LOAD_AVE_TYPE          long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
 #ifdef REL_ALLOC
 #ifndef _MALLOC_INTERNAL
 /* "char *" because ralloc.c defines it that way.  gmalloc.c thinks it
@@ -45,4 +39,3 @@
 extern void r_alloc_free ();
 #endif /* not _MALLOC_INTERNAL */
 #endif /* REL_ALLOC */
-

=== modified file 'src/m/ibms390.h'
--- a/src/m/ibms390.h   2011-01-25 04:08:28 +0000
+++ b/src/m/ibms390.h   2011-02-16 00:33:44 +0000
@@ -18,12 +18,6 @@
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
-/* Data type of load average, as read out of kmem.  */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
 /* Define VIRT_ADDR_VARIES if the virtual addresses of
    pure and impure space as loaded can vary, and even their
    relative order cannot be relied on.
@@ -31,4 +25,3 @@
    Otherwise Emacs assumes that text space precedes data space,
    numerically.  */
 #define VIRT_ADDR_VARIES
-

=== modified file 'src/m/macppc.h'
--- a/src/m/macppc.h    2011-01-25 04:08:28 +0000
+++ b/src/m/macppc.h    2011-02-16 00:33:44 +0000
@@ -17,15 +17,8 @@
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* Data type of load average, as read out of kmem.  */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
 #ifdef _ARCH_PPC64
 #ifndef _LP64
 #define _LP64
 #endif
 #endif
-

=== modified file 'src/m/sparc.h'
--- a/src/m/sparc.h     2011-01-25 04:08:28 +0000
+++ b/src/m/sparc.h     2011-02-16 00:33:44 +0000
@@ -19,12 +19,6 @@
 
 /* __sparc__ is defined by the compiler by default.  */
 
-/* Data type of load average, as read out of kmem.  */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
 #ifdef __arch64__              /* GCC, 64-bit ABI.  */
 
 #define BITS_PER_LONG 64
@@ -34,4 +28,3 @@
 #endif
 
 #endif  /* __arch64__ */
-

=== modified file 'src/m/template.h'
--- a/src/m/template.h  2011-01-25 04:08:28 +0000
+++ b/src/m/template.h  2011-02-16 00:33:44 +0000
@@ -21,12 +21,6 @@
    does not define it automatically.
    Ones defined so far include m68k and many others */
 
-/* Data type of load average, as read out of kmem.  */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
 /* Define VIRT_ADDR_VARIES if the virtual addresses of
    pure and impure space as loaded can vary, and even their
    relative order cannot be relied on.
@@ -46,4 +40,3 @@
    If you've just fixed a problem in an existing configuration file,
    you should also check `etc/MACHINES' to make sure its descriptions
    of known problems in that configuration should be updated.  */
-

=== modified file 'src/m/vax.h'
--- a/src/m/vax.h       2011-01-25 04:08:28 +0000
+++ b/src/m/vax.h       2011-02-16 00:33:44 +0000
@@ -20,14 +20,4 @@
 
 /* #define vax    -- appears to be done automatically  */
 
-/* USG systems I know of running on Vaxes do not actually
-   support the load average, so disable it for them.  */
-
-/* Data type of load average, as read out of kmem.  */
-#define LOAD_AVE_TYPE double
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-#define LOAD_AVE_CVT(x) ((int) ((x) * 100.0))
-
 #define HAVE_FTIME
-

=== modified file 'src/s/aix4-2.h'
--- a/src/s/aix4-2.h    2011-01-25 04:08:28 +0000
+++ b/src/s/aix4-2.h    2011-02-16 00:33:44 +0000
@@ -41,12 +41,6 @@
 
 /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
 #define HAVE_SOCKETS
-
-/* The file containing the kernel's symbol table is called /unix.  */
-#define KERNEL_FILE "/unix"
-
-/* The kernel symbol where the load average is found is named avenrun.  */
-#define LDAV_SYMBOL "avenrun"
 
 /* Special items needed to make Emacs run on this system.  */
 
@@ -86,4 +80,3 @@
    Emacs currently calls xrealloc on the results of get_current_dir name,
    to avoid a crash just use the Emacs implementation for that function.  */
 #define BROKEN_GET_CURRENT_DIR_NAME 1
-

=== modified file 'src/s/bsd-common.h'
--- a/src/s/bsd-common.h        2011-01-25 04:08:28 +0000
+++ b/src/s/bsd-common.h        2011-02-16 00:33:44 +0000
@@ -37,10 +37,6 @@
 #define TABDLY OXTABS
 #define TAB3 OXTABS
 
-/* These aren't needed, since we have getloadavg.  */
-#undef KERNEL_FILE
-#undef LDAV_SYMBOL
-
 #define NO_TERMIO
 
 /* If the system's imake configuration file defines `NeedWidePrototypes'
@@ -72,12 +68,5 @@
    a file that someone else has modified in his Emacs.  */
 #define CLASH_DETECTION
 
-/* The file containing the kernel's symbol table is called /vmunix.  */
-#define KERNEL_FILE "/vmunix"
-
-/* The kernel symbol where the load average is found is named _avenrun.  */
-#define LDAV_SYMBOL "_avenrun"
-
 /* Send signals to subprocesses by "typing" special chars at them.  */
 #define SIGNALS_VIA_CHARACTERS
-

=== modified file 'src/s/freebsd.h'
--- a/src/s/freebsd.h   2011-01-25 04:08:28 +0000
+++ b/src/s/freebsd.h   2011-02-16 00:33:44 +0000
@@ -25,8 +25,6 @@
 
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 
-#define HAVE_GETLOADAVG 1
-
 /* This silences a few compilation warnings.  */
 #undef BSD_SYSTEM
 #if __FreeBSD__ == 1

=== modified file 'src/s/hpux10-20.h'
--- a/src/s/hpux10-20.h 2011-01-25 04:08:28 +0000
+++ b/src/s/hpux10-20.h 2011-02-16 00:33:44 +0000
@@ -47,9 +47,6 @@
    a file that someone else has modified in his Emacs.  */
 #define CLASH_DETECTION
 
-/* The symbol in the kernel where the load average is found
-   depends on the cpu type, so we let the m- files define LDAV_SYMBOL.  */
-
 /* Special hacks needed to make Emacs run on this system.  */
 
 /* In hpux, the symbol SIGIO is defined, but the feature
@@ -91,9 +88,6 @@
 #undef random
 #undef HAVE_RANDOM
 
-/* AlainF 20-Jul-1996 says this is right.  */
-#define KERNEL_FILE "/stand/vmunix"
-
 
 /* Rainer Malzbender <address@hidden> says definining
    HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20 using GCC.  */
@@ -119,18 +113,3 @@
 #define DATA_SEG_BITS 0x40000000
 
 #define DATA_START    0x40000000
-
-/* Data type of load average, as read out of kmem.  */
-#define LOAD_AVE_TYPE double
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-#define LOAD_AVE_CVT(x) ((int) (x * 100.0))
-
-/* The kernel symbol where the load average is found is named _avenrun.
-   At this time there are two major flavors of hp-ux (there is the s800
-   and s300 (s200) flavors).  The differences are thusly moved to the
-   corresponding machine description file.  */
-
-/* No underscore please.  */
-#define LDAV_SYMBOL "avenrun"
-

=== modified file 'src/s/netbsd.h'
--- a/src/s/netbsd.h    2011-01-25 04:08:28 +0000
+++ b/src/s/netbsd.h    2011-02-16 00:33:44 +0000
@@ -21,8 +21,6 @@
 /* Get most of the stuff from bsd-common.  */
 #include "bsd-common.h"
 
-#define HAVE_GETLOADAVG 1
-
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 
 #define DEFAULT_SOUND_DEVICE "/dev/audio"
@@ -43,4 +41,3 @@
 
 /* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method.  */
 #define GC_MARK_STACK  GC_MAKE_GCPROS_NOOPS
-

=== modified file 'src/s/unixware.h'
--- a/src/s/unixware.h  2011-01-25 04:08:28 +0000
+++ b/src/s/unixware.h  2011-02-16 00:33:44 +0000
@@ -49,14 +49,4 @@
     pty_name[sizeof(pty_name) - 1] = 0;                \
   }
 
-/* Data type of load average, as read out of kmem.  */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-/* This is totally uncalibrated. */
-#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
-#define FSCALE 256.0
-
-
 #define        PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base)
-

=== modified file 'src/s/usg5-4-common.h'
--- a/src/s/usg5-4-common.h     2011-01-25 04:08:28 +0000
+++ b/src/s/usg5-4-common.h     2011-02-16 00:33:44 +0000
@@ -30,12 +30,6 @@
    It sets the Lisp variable system-type.  */
 #define SYSTEM_TYPE "usg-unix-v"
 
-/* The file containing the kernel's symbol table is called /unix.  */
-#define KERNEL_FILE "/unix"
-
-/* The kernel symbol where the load average is found is named avenrun.  */
-#define LDAV_SYMBOL "avenrun"
-
 /* setjmp and longjmp can safely replace _setjmp and _longjmp,
    but they will run slower.  */
 #define _setjmp setjmp
@@ -105,4 +99,3 @@
 
 /* This definition was suggested for next release.  So give it a try.  */
 #define HAVE_SOCKETS
-


reply via email to

[Prev in Thread] Current Thread [Next in Thread]