[PATCH 07/25] dbench: update use of time.h or sys/time.h

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



autoconf complains about the deprecated use of including
just sys/time.h. Fix this.

Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx>
---
 configure.ac | 16 +---------------
 dbench.h     | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/configure.ac b/configure.ac
index e8b373e..b8c26fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,27 +23,13 @@ else
 	CFLAGS="$CFLAGS -O"
 fi
 
-AC_HEADER_DIRENT
-m4_warn([obsolete],
-[Update your code to rely only on HAVE_SYS_TIME_H,
-then remove this warning and the obsolete code below it.
-All current systems provide time.h; it need not be checked for.
-Not all systems provide sys/time.h, but those that do, all allow
-you to include it and time.h simultaneously.])dnl
-AC_CHECK_HEADERS_ONCE([sys/time.h])
-# Obsolete code to be removed.
-if test $ac_cv_header_sys_time_h = yes; then
-  AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both <sys/time.h>
-	     and <time.h>.  This macro is obsolete.])
-fi
-# End of obsolete code.
-
 AC_HEADER_SYS_WAIT
 
 AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h sys/vfs.h sys/statvfs.h stdint.h)
 
 AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h)
 AC_CHECK_HEADERS(sys/mount.h)
+AC_CHECK_HEADERS([sys/time.h])
 
 AC_CHECK_FUNCS(fdatasync)
 # Check if we have libattr
diff --git a/dbench.h b/dbench.h
index 465cf3b..1fecd1a 100644
--- a/dbench.h
+++ b/dbench.h
@@ -27,7 +27,18 @@
 #include <ctype.h>
 #include <dirent.h>
 #include <sys/stat.h>
-#include <sys/time.h>
+
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
 #include <sys/wait.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-- 
2.34.1




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux