Make #inclusion of <features.h> conditional on autoconf telling us
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 5 Nov 2008 07:58:46 +0000 (07:58 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 5 Nov 2008 07:58:46 +0000 (07:58 +0000)
it exists. agedu now builds on OS X.

git-svn-id: svn://svn.tartarus.org/sgt/agedu@8279 cda61777-01e9-0310-a592-d414129be87e

config.h
configure.ac
du.c

index 95d89c0..27135bd 100644 (file)
--- a/config.h
+++ b/config.h
@@ -13,3 +13,4 @@
  */
 
 #define HAVE_LSTAT64
+#define HAVE_FEATURES_H
index e1cc6c5..8117e81 100644 (file)
@@ -17,7 +17,7 @@ AC_PROG_INSTALL
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h syslog.h termios.h unistd.h])
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h features.h limits.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h syslog.h termios.h unistd.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
diff --git a/du.c b/du.c
index 9a8a4a3..1a375bf 100644 (file)
--- a/du.c
+++ b/du.c
@@ -2,8 +2,12 @@
  * du.c: implementation of du.h.
  */
 
+#include "agedu.h" /* for config.h */
+
+#ifdef HAVE_FEATURES_H
 #define _GNU_SOURCE
 #include <features.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
@@ -14,7 +18,6 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "agedu.h"
 #include "du.h"
 #include "alloc.h"