--- make-4.2.1/configure.ac 2016-06-06 13:27:31.000000000 +0100 +++ make-4.2.1.1/configure.ac 2016-10-09 18:33:34.574257275 +0100 @@ -176,10 +176,30 @@ AS_IF([test "$have_guile" = yes], [AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])]) AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = yes]) +AC_CHECK_FUNCS[open close read lseek atoi] +AC_CACHE_CHECK([for /proc/loadavg usability], [ac_cv_proc_loadavg], + [ac_cv_proc_loadavg=no + AC_RUN_IFELSE([AC_LANG_SOURCE([[#include +#include +#include +int main() { + int fd, i, n; char str[64]; + fd = open("/proc/loadavg", O_RDONLY); + if (fd < 0 || read(fd, str, 64) < 0 || lseek(fd, 0, SEEK_SET) < 0) return 1; + for (str[63] = i = n = 0; i < 3 && n < 64; ++n) if (str[n] == ' ') ++i; + return i < 3 || atoi(&str[n]) < 1 || close(fd) < 0;}]])], + [ac_cv_proc_loadavg=yes], + [ac_cv_proc_loadavg=no], + [ac_cv_proc_loadavg="no (cross-compiling)"])]) +AS_IF([test "$ac_cv_proc_loadavg" = yes], +[ AC_DEFINE([HAVE_PROC_LOADAVG], [1], + [Define to 1 when /proc/loadavg exists and appears usable]) +]) + AC_FUNC_GETLOADAVG # AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it # doesn't. So, we will.