2011-02-16 00:33:44 +00:00
|
|
|
# Check for getloadavg.
|
|
|
|
|
Update from gnulib
This incorporates:
2019-12-23 mktime, nstrftime: tweak division performance
2019-12-22 count-leading-zeros: assume 'long long'
2019-12-22 count-one-bits: assume 'long long'
2019-12-22 count-trailing-zeros: assume 'long long'
2019-12-12 inttypes-incomplete: assume 'long long'
2019-12-22 malloca: assume 'long long'
2019-12-22 stdint: assume 'long long'
2019-12-22 strtoll, strtoimax, strtoumax: assume 'long long'
2019-12-22 prefer lib_SOURCES to unconditional AC_LIBOBJ
2019-12-19 nstrftime: avoid a shadowing warning
2019-12-18 improve port of AC_C_RESTRICT to Oracle C++
2019-12-12 stdalign: port to xlclang 16.01
2019-12-11 stddef, unistd: fix compilation error in C++ mode on MSVC
2019-12-08 fix compilation errors in C++ mode on Haiku
2019-12-08 fix compilation errors in 32-bit C++ mode on HP-UX 11/ia64
2019-12-08 fix compilation error in C++ mode on OpenBSD
* build-aux/config.guess, doc/misc/texinfo.tex:
* lib/count-leading-zeros.h, lib/count-one-bits.h:
* lib/count-trailing-zeros.h, lib/inttypes.in.h, lib/malloca.h:
* lib/mktime.c, lib/nstrftime.c, lib/signal.in.h, lib/stdalign.in.h:
* lib/stddef.in.h, lib/stdint.in.h, lib/stdio.in.h, lib/stdlib.in.h:
* lib/strtoimax.c, lib/unistd.in.h, m4/gnulib-common.m4:
* m4/inttypes.m4, m4/largefile.m4, m4/malloca.m4, m4/strtoimax.m4:
* m4/strtoll.m4:
Copy from Gnulib. Also, change copyright notices in some other
Gnulib-copied files to exactly match Gnulib, as Gnulib updated
them in a trivially different way.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
2020-01-01 03:11:22 +00:00
|
|
|
# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2020 Free Software
|
|
|
|
# Foundation, Inc.
|
2011-02-16 00:33:44 +00:00
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
Update from Gnulib
This incorporates:
2020-08-16 time_rz: remove unused functions
2020-08-16 time_rz: fix issues with mktime_z failures
2020-08-16 nstrftime: Guide inlining also on clang
2020-08-16 intprops: Avoid bogus warning on clang
2020-08-16 libc-config: Enable __REDIRECT macro also on clang
2020-08-16 regex: Use initializer shorthand syntax also with clang
2020-08-16 regex: Use space optimization also with clang
2020-08-16 Use _Static_assert and static_assert when present on clang
2020-08-16 Use 'throw ()' for optimization in C++ mode also on clang
2020-08-16 stdio: Don't break attribute 'scanf' on clang
2020-08-16 Fix "warning: 'format' attribute ...: rpl_printf"
2020-08-16 Fix "warning: attribute declaration must precede definition"
2020-08-16 Fix undesired warnings
2020-08-16 Don't use Autoconf quadrigraphsxo
2020-08-16 Fix quoting of AC_LANG_PROGRAM arguments
2020-08-16 Assume autoconf >= 2.64
2020-08-15 nstrftime: be more predictable about errno
2020-08-15 canonicalize: Fix autoconf test on MSVC/clang
2020-08-15 Support compiling without -loldnames on native Windows
2020-08-14 mktime, mktime-internal: Remove obsolete code
2020-08-14 Assume tzset exists
* lib/c++defs.h, lib/canonicalize-lgpl.c, lib/cdefs.h, lib/dup2.c:
* lib/fcntl.in.h, lib/getopt-cdefs.in.h, lib/intprops.h, lib/md5.h:
* lib/mktime.c, lib/nstrftime.c, lib/open.c, lib/regcomp.c:
* lib/regex_internal.h, lib/stdio.in.h, lib/stdlib.in.h:
* lib/strftime.h, lib/string.in.h, lib/sys_select.in.h:
* lib/sys_stat.in.h, lib/sys_time.in.h, lib/time.in.h, lib/time_rz.c:
* lib/unistd.in.h, lib/verify.h, m4/00gnulib.m4:
* m4/absolute-header.m4, m4/alloca.m4, m4/canonicalize.m4, m4/dup2.m4:
* m4/fchmodat.m4, m4/fcntl.m4, m4/fdopendir.m4, m4/fpending.m4:
* m4/futimens.m4, m4/getdtablesize.m4, m4/getloadavg.m4:
* m4/gnulib-common.m4, m4/include_next.m4, m4/largefile.m4:
* m4/manywarnings.m4, m4/mktime.m4, m4/nstrftime.m4, m4/open-slash.m4:
* m4/pselect.m4, m4/pthread_sigmask.m4, m4/time_h.m4, m4/utimens.m4:
* m4/utimensat.m4, m4/utimes.m4, m4/warnings.m4:
Copy from Gnulib.
* lib/gnulib.mk.in: Regenerate.
2020-08-16 21:22:56 +00:00
|
|
|
#serial 10
|
2011-02-16 00:33:44 +00:00
|
|
|
|
|
|
|
# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
|
|
|
|
# New applications should use gl_GETLOADAVG instead.
|
|
|
|
|
2011-05-29 21:52:18 +00:00
|
|
|
# gl_GETLOADAVG
|
|
|
|
# -------------
|
2011-02-16 00:33:44 +00:00
|
|
|
AC_DEFUN([gl_GETLOADAVG],
|
|
|
|
[AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
|
|
|
|
|
|
|
# Persuade glibc <stdlib.h> to declare getloadavg().
|
|
|
|
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
|
|
|
|
|
|
|
|
gl_save_LIBS=$LIBS
|
|
|
|
|
2018-03-20 16:26:09 +00:00
|
|
|
# getloadavg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0,
|
2011-02-18 07:41:43 +00:00
|
|
|
# NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7.
|
2011-06-15 22:27:54 +00:00
|
|
|
HAVE_GETLOADAVG=1
|
2011-02-16 00:33:44 +00:00
|
|
|
AC_CHECK_FUNC([getloadavg], [],
|
2011-06-19 18:22:16 +00:00
|
|
|
[gl_func_getloadavg_done=no
|
2011-02-16 00:33:44 +00:00
|
|
|
|
|
|
|
# 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.
|
2011-06-19 18:22:16 +00:00
|
|
|
if test $gl_func_getloadavg_done = no; then
|
2011-02-16 00:33:44 +00:00
|
|
|
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],
|
2011-06-19 18:22:16 +00:00
|
|
|
[LIBS="-lutil $LIBS" gl_func_getloadavg_done=yes])
|
2011-02-16 00:33:44 +00:00
|
|
|
fi
|
|
|
|
|
2011-06-19 18:22:16 +00:00
|
|
|
if test $gl_func_getloadavg_done = no; then
|
2011-02-16 00:33:44 +00:00
|
|
|
# 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
|
2020-02-25 01:55:00 +00:00
|
|
|
if test $cross_compiling != yes; then
|
|
|
|
LIBS="-L/usr/local/lib $LIBS"
|
|
|
|
fi
|
2011-02-16 00:33:44 +00:00
|
|
|
AC_CHECK_LIB([getloadavg], [getloadavg],
|
2011-06-19 18:22:16 +00:00
|
|
|
[LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes],
|
2011-02-16 00:33:44 +00:00
|
|
|
[LIBS=$gl_getloadavg_LIBS])
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set up the replacement function if necessary.
|
2011-06-19 18:22:16 +00:00
|
|
|
if test $gl_func_getloadavg_done = no; then
|
2011-06-15 22:27:54 +00:00
|
|
|
HAVE_GETLOADAVG=0
|
2011-06-19 18:22:16 +00:00
|
|
|
|
|
|
|
# Solaris has libkstat which does not require root.
|
|
|
|
AC_CHECK_LIB([kstat], [kstat_open])
|
|
|
|
test $ac_cv_lib_kstat_kstat_open = yes && gl_func_getloadavg_done=yes
|
|
|
|
|
|
|
|
# AIX has libperfstat which does not require root
|
|
|
|
if test $gl_func_getloadavg_done = no; then
|
|
|
|
AC_CHECK_LIB([perfstat], [perfstat_cpu_total])
|
|
|
|
test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_func_getloadavg_done=yes
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test $gl_func_getloadavg_done = no; then
|
|
|
|
AC_CHECK_HEADER([sys/dg_sys_info.h],
|
|
|
|
[gl_func_getloadavg_done=yes
|
|
|
|
AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
|
|
|
|
AC_CHECK_LIB([dgc], [dg_sys_info])])
|
|
|
|
fi
|
2011-02-16 00:33:44 +00:00
|
|
|
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],
|
Merge from gnulib, improving some licensing wording.
This clarifies and fixes some licensing issues raised by Glenn Morris
<http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00397.html>.
It also merges the latest version of texinfo.tex and has some
MSVC-related changes that don't affect Emacs.
* Makefile.in (GNULIB_TOOL_FLAGS): Avoid msvc-inval, msvc-nothrow,
pathmax, and raise, since these are needed only to address
MSVC-related issues that Emacs doesn't have.
* doc/misc/texinfo.tex, lib/dup2.c, lib/gnulib.mk, lib/signal.in.h:
* lib/sigprocmask.c, lib/stat.c, lib/stdio.in.h, lib/sys_stat.in.h:
* lib/unistd.in.h, m4/dup2.m4, m4/getloadavg.m4, m4/gl-comp.m4:
* m4/include_next.m4, m4/signal_h.m4, m4/signalblocking.m4:
* m4/stdint.m4, m4/stdio_h.m4, m4/sys_stat_h.m4, m4/time_h.m4:
* m4/unistd_h.m4: Merge from gnulib.
2011-09-26 21:30:18 +00:00
|
|
|
[[#if HAVE_SYS_LOADAVG_H
|
2018-02-20 21:42:19 +00:00
|
|
|
/* OpenIndiana has a bug: <sys/time.h> must be included before
|
|
|
|
<sys/loadavg.h>. */
|
|
|
|
# include <sys/time.h>
|
Merge from gnulib, improving some licensing wording.
This clarifies and fixes some licensing issues raised by Glenn Morris
<http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00397.html>.
It also merges the latest version of texinfo.tex and has some
MSVC-related changes that don't affect Emacs.
* Makefile.in (GNULIB_TOOL_FLAGS): Avoid msvc-inval, msvc-nothrow,
pathmax, and raise, since these are needed only to address
MSVC-related issues that Emacs doesn't have.
* doc/misc/texinfo.tex, lib/dup2.c, lib/gnulib.mk, lib/signal.in.h:
* lib/sigprocmask.c, lib/stat.c, lib/stdio.in.h, lib/sys_stat.in.h:
* lib/unistd.in.h, m4/dup2.m4, m4/getloadavg.m4, m4/gl-comp.m4:
* m4/include_next.m4, m4/signal_h.m4, m4/signalblocking.m4:
* m4/stdint.m4, m4/stdio_h.m4, m4/sys_stat_h.m4, m4/time_h.m4:
* m4/unistd_h.m4: Merge from gnulib.
2011-09-26 21:30:18 +00:00
|
|
|
# include <sys/loadavg.h>
|
|
|
|
#endif
|
|
|
|
#include <stdlib.h>]])
|
2011-02-16 00:33:44 +00:00
|
|
|
])# gl_GETLOADAVG
|
|
|
|
|
|
|
|
|
|
|
|
# gl_PREREQ_GETLOADAVG
|
|
|
|
# --------------------
|
2012-05-26 23:14:36 +00:00
|
|
|
# Set up the AC_LIBOBJ replacement of 'getloadavg'.
|
2011-02-16 00:33:44 +00:00
|
|
|
AC_DEFUN([gl_PREREQ_GETLOADAVG],
|
|
|
|
[
|
|
|
|
# Figure out what our getloadavg.c needs.
|
|
|
|
|
Update from Gnulib
This incorporates:
2018-06-29 regex: glibc does not use intprops.h
2018-06-28 regex: port to recently proposed glibc regex merge
2018-06-25 Continue to use spaces for indentation, not tabs
2018-06-25 manywarnings: Don't enable -Wjump-misses-init by default
2018-06-25 acl-internal.h: remove _GL_ATTRIBUTE_CONST on void function
2018-06-24 manywarnings: accommodate GCC 9: remove -Wchkp and -Wabi
2018-06-24 maint: clarify comments about sticky EOF
2018-06-24 af_alg: avoid hangs when reading from streams
2018-06-17 crypto: use byteswap
2018-06-17 getloadavg: Return 0 on MS-Windows without Cygwi
2018-06-17 getloadavg: Allow building on MS-Windows without Cygwin
* build-aux/config.guess, build-aux/config.sub, doc/misc/texinfo.tex:
* lib/acl-internal.c, lib/acl-internal.h, lib/get-permissions.c:
* lib/getloadavg.c, lib/gettimeofday.c, lib/md5.c, lib/pselect.c:
* lib/set-permissions.c, lib/sha1.c, lib/sha256.c, lib/sha512.c:
* lib/time.in.h, m4/getloadavg.m4, m4/gnulib-common.m4:
* m4/manywarnings.m4, m4/pthread_sigmask.m4, m4/vararrays.m4:
Copy from Gnulib.
2018-06-30 00:31:04 +00:00
|
|
|
AC_CHECK_HEADERS_ONCE([sys/param.h unistd.h])
|
2012-07-11 00:01:21 +00:00
|
|
|
|
2011-02-16 00:33:44 +00:00
|
|
|
# On HPUX9, an unprivileged user can get load averages this way.
|
2011-06-19 18:22:16 +00:00
|
|
|
if test $gl_func_getloadavg_done = no; then
|
|
|
|
AC_CHECK_FUNCS([pstat_getdynamic], [gl_func_getloadavg_done=yes])
|
2011-02-16 00:33:44 +00:00
|
|
|
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.
|
2011-06-19 18:22:16 +00:00
|
|
|
if test $gl_func_getloadavg_done = no && test "$ac_cv_lib_elf_elf_begin" = yes \
|
2011-02-16 00:33:44 +00:00
|
|
|
&& test "$ac_cv_lib_kvm_kvm_open" = yes; then
|
2011-06-19 18:22:16 +00:00
|
|
|
gl_func_getloadavg_done=yes
|
2011-02-16 00:33:44 +00:00
|
|
|
AC_DEFINE([SVR4], [1], [Define to 1 on System V Release 4.])
|
|
|
|
fi
|
|
|
|
|
2011-06-19 18:22:16 +00:00
|
|
|
if test $gl_func_getloadavg_done = no; then
|
2011-02-16 00:33:44 +00:00
|
|
|
AC_CHECK_HEADER([inq_stats/cpustats.h],
|
2011-06-19 18:22:16 +00:00
|
|
|
[gl_func_getloadavg_done=yes
|
2011-02-16 00:33:44 +00:00
|
|
|
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
|
|
|
|
|
2011-06-19 18:22:16 +00:00
|
|
|
if test $gl_func_getloadavg_done = no; then
|
2011-02-16 00:33:44 +00:00
|
|
|
AC_CHECK_HEADER([sys/cpustats.h],
|
2011-06-19 18:22:16 +00:00
|
|
|
[gl_func_getloadavg_done=yes; AC_DEFINE([UMAX])])
|
2011-02-16 00:33:44 +00:00
|
|
|
fi
|
|
|
|
|
2011-06-19 18:22:16 +00:00
|
|
|
if test $gl_func_getloadavg_done = no; then
|
2011-02-16 00:33:44 +00:00
|
|
|
AC_CHECK_HEADERS([mach/mach.h])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_CHECK_HEADERS([nlist.h],
|
|
|
|
[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
|
|
|
|
[], [],
|
Update from Gnulib
This incorporates:
2020-08-16 time_rz: remove unused functions
2020-08-16 time_rz: fix issues with mktime_z failures
2020-08-16 nstrftime: Guide inlining also on clang
2020-08-16 intprops: Avoid bogus warning on clang
2020-08-16 libc-config: Enable __REDIRECT macro also on clang
2020-08-16 regex: Use initializer shorthand syntax also with clang
2020-08-16 regex: Use space optimization also with clang
2020-08-16 Use _Static_assert and static_assert when present on clang
2020-08-16 Use 'throw ()' for optimization in C++ mode also on clang
2020-08-16 stdio: Don't break attribute 'scanf' on clang
2020-08-16 Fix "warning: 'format' attribute ...: rpl_printf"
2020-08-16 Fix "warning: attribute declaration must precede definition"
2020-08-16 Fix undesired warnings
2020-08-16 Don't use Autoconf quadrigraphsxo
2020-08-16 Fix quoting of AC_LANG_PROGRAM arguments
2020-08-16 Assume autoconf >= 2.64
2020-08-15 nstrftime: be more predictable about errno
2020-08-15 canonicalize: Fix autoconf test on MSVC/clang
2020-08-15 Support compiling without -loldnames on native Windows
2020-08-14 mktime, mktime-internal: Remove obsolete code
2020-08-14 Assume tzset exists
* lib/c++defs.h, lib/canonicalize-lgpl.c, lib/cdefs.h, lib/dup2.c:
* lib/fcntl.in.h, lib/getopt-cdefs.in.h, lib/intprops.h, lib/md5.h:
* lib/mktime.c, lib/nstrftime.c, lib/open.c, lib/regcomp.c:
* lib/regex_internal.h, lib/stdio.in.h, lib/stdlib.in.h:
* lib/strftime.h, lib/string.in.h, lib/sys_select.in.h:
* lib/sys_stat.in.h, lib/sys_time.in.h, lib/time.in.h, lib/time_rz.c:
* lib/unistd.in.h, lib/verify.h, m4/00gnulib.m4:
* m4/absolute-header.m4, m4/alloca.m4, m4/canonicalize.m4, m4/dup2.m4:
* m4/fchmodat.m4, m4/fcntl.m4, m4/fdopendir.m4, m4/fpending.m4:
* m4/futimens.m4, m4/getdtablesize.m4, m4/getloadavg.m4:
* m4/gnulib-common.m4, m4/include_next.m4, m4/largefile.m4:
* m4/manywarnings.m4, m4/mktime.m4, m4/nstrftime.m4, m4/open-slash.m4:
* m4/pselect.m4, m4/pthread_sigmask.m4, m4/time_h.m4, m4/utimens.m4:
* m4/utimensat.m4, m4/utimes.m4, m4/warnings.m4:
Copy from Gnulib.
* lib/gnulib.mk.in: Regenerate.
2020-08-16 21:22:56 +00:00
|
|
|
[#include <nlist.h>])
|
2011-02-16 00:33:44 +00:00
|
|
|
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
|