Update comment about utimes bugs.
[gnulib.git] / m4 / getloadavg.m4
index d0ab2b8..567245e 100644 (file)
@@ -1,4 +1,4 @@
-#serial 7
+#serial 11
 
 # A replacement for autoconf's macro by the same name.  This version
 # accepts an optional argument specifying the name of the $srcdir-relative
@@ -12,10 +12,14 @@ undefine([AC_FUNC_GETLOADAVG])
 AC_DEFUN([AC_FUNC_GETLOADAVG],
 [ac_have_func=no # yes means we've found a way to get the load average.
 
+AC_CHECK_HEADERS_ONCE(fcntl.h locale.h unistd.h)
+AC_CHECK_HEADERS(mach/mach.h)
+AC_CHECK_FUNCS(setlocale)
+
 # By default, expect to find getloadavg.c in $srcdir/.
 ac_lib_dir_getloadavg=$srcdir
 # But if there's an argument, DIR, expect to find getloadavg.c in $srcdir/DIR.
-ifval([$1], [ac_lib_dir_getloadavg=$srcdir/$1])
+m4_ifval([$1], [ac_lib_dir_getloadavg=$srcdir/$1])
 # Make sure getloadavg.c is where it belongs, at ./configure-time.
 test -f $ac_lib_dir_getloadavg/getloadavg.c \
   || AC_MSG_ERROR([getloadavg.c is not in $ac_lib_dir_getloadavg])
@@ -88,7 +92,7 @@ if test $ac_cv_func_getloadavg_setgid = yes; then
   # 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=`echo $ac_ls_output \
-    | sed -ne ['s/[    ][      ]*/ /g;
+    | sed -ne ['s/[     ][      ]*/ /g;
               s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/;
               / /s/.* //;p;']`
 ])
@@ -99,5 +103,23 @@ if test "x$ac_save_LIBS" = x; then
 else
   GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$ac_save_LIBS!!"`
 fi
+LIBS=$ac_save_LIBS
+
 AC_SUBST(GETLOADAVG_LIBS)dnl
 ])# AC_FUNC_GETLOADAVG
+
+
+AC_DEFUN([gl_FUNC_GETLOADAVG],
+[
+  AC_FUNC_GETLOADAVG([lib])
+  dnl Note AC_FUNC_GETLOADAVG does AC_LIBOBJ(getloadavg).
+  if test $ac_cv_func_getloadavg = no; then
+    gl_PREREQ_GETLOADAVG
+  fi
+])
+
+# Prerequisites of lib/getloadavg.c not done by autoconf's AC_FUNC_GETLOADAVG.
+AC_DEFUN([gl_PREREQ_GETLOADAVG],
+[
+  AC_CHECK_HEADERS_ONCE(fcntl.h unistd.h)
+])