bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] getloadavg: Allow building on Windows without Cygwin


From: Paul Smith
Subject: [PATCH] getloadavg: Allow building on Windows without Cygwin
Date: Sun, 20 May 2018 17:33:50 -0400

* lib/getloadavg.c: Reinstate ifdef for HAVE_UNISTD_H
* m4/getloadavg.m4: Check for unistd.h
---
An alternative would be to use ifdef WINDOWS32 instead of checking
for unistd.h.

 lib/getloadavg.c | 4 +++-
 m4/getloadavg.m4 | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index 702338f..2a5c413 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -324,7 +324,9 @@
 #  define LDAV_SYMBOL "avenrun"
 # endif
 
-# include <unistd.h>
+# if defined (HAVE_UNISTD_H)
+#  include <unistd.h>
+# endif
 
 /* LOAD_AVE_TYPE should only get defined if we're going to use the
    nlist method.  */
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index d3a8910..c9f5a6d 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -108,7 +108,7 @@ AC_DEFUN([gl_PREREQ_GETLOADAVG],
 [
 # Figure out what our getloadavg.c needs.
 
-AC_CHECK_HEADERS_ONCE([sys/param.h])
+AC_CHECK_HEADERS_ONCE([sys/param.h unistd.h])
 
 # On HPUX9, an unprivileged user can get load averages this way.
 if test $gl_func_getloadavg_done = no; then
-- 
2.9.2




reply via email to

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