We've been including it init.c without an AC check for 16 years.

As investigated by Alejandro Colomar:

  <sys/time.h> was standardized in POSIX.1-2001.  And well before that,
  4.3BSD-Reno already had <sys/time.h>, with the file first added in 1983
  (although 4.3BSD-Reno was released later in 1990).

  <https://www.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Reno/src/sys/sys/time.h>

  Because every modern BSD is descendant of 4.3BSD-Reno, we know the file
  is present in every version of FreeBSD/NetBSD/OpenBSD.

  glibc also has the file since the very first commit.
  musl libc also has the file since the very first commit.

  I think we can assume the header exists in every Unix-like system.

  And checking gnulib documentation, it seems that the only platform that
  lacks this header file was MSVC 14.  Is mutt being built there?
  If not, we could maybe remove that check in master everywhere.
---

This is based on top of "[PATCH v2] Improve mutt's random data
generator."

 autocrypt/autocrypt.c | 2 --
 configure.ac          | 2 +-
 crypt-gpgme.c         | 2 --
 crypt.c               | 2 --
 curs_lib.c            | 4 +---
 hcache.c              | 2 --
 mh.c                  | 3 ---
 mutt_random.c         | 4 +---
 mutt_socket.c         | 2 --
 pgp.c                 | 4 +---
 smime.c               | 4 +---
 11 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/autocrypt/autocrypt.c b/autocrypt/autocrypt.c
index 724617f4..d63b5b50 100644
--- a/autocrypt/autocrypt.c
+++ b/autocrypt/autocrypt.c
@@ -30,9 +30,7 @@
 #include "autocrypt.h"
 #include "autocrypt_private.h"
 
-#ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
-#endif
 #include <errno.h>
 
 static int autocrypt_dir_init(int can_create)
diff --git a/configure.ac b/configure.ac
index 456b916a..78a58963 100644
--- a/configure.ac
+++ b/configure.ac
@@ -373,7 +373,7 @@ main ()
         ])
 
 AC_CHECK_HEADERS(stdarg.h sys/ioctl.h ioctl.h sysexits.h)
-AC_CHECK_HEADERS(sys/time.h sys/resource.h)
+AC_CHECK_HEADERS(sys/resource.h)
 AC_CHECK_HEADERS(unix.h)
 
 AC_CHECK_FUNCS(setrlimit getsid)
diff --git a/crypt-gpgme.c b/crypt-gpgme.c
index 91053713..1a363a9b 100644
--- a/crypt-gpgme.c
+++ b/crypt-gpgme.c
@@ -51,9 +51,7 @@
 #include <langinfo.h>
 #endif
 
-#ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
-#endif
 
 #ifdef HAVE_SYS_RESOURCE_H
 # include <sys/resource.h>
diff --git a/crypt.c b/crypt.c
index 5090f85f..e12f9c44 100644
--- a/crypt.c
+++ b/crypt.c
@@ -46,9 +46,7 @@
 
 #include <locale.h>
 
-#ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
-#endif
 
 #ifdef HAVE_SYS_RESOURCE_H
 # include <sys/resource.h>
diff --git a/curs_lib.c b/curs_lib.c
index f06de0b7..c1eb7bc6 100644
--- a/curs_lib.c
+++ b/curs_lib.c
@@ -39,9 +39,7 @@
 #include <string.h>
 #include <errno.h>
 #include <ctype.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 #include <time.h>
 
 #ifdef HAVE_LANGINFO_YESEXPR
diff --git a/hcache.c b/hcache.c
index 22f8bdf4..90f41d0c 100644
--- a/hcache.c
+++ b/hcache.c
@@ -44,9 +44,7 @@
 
 #include <errno.h>
 #include <fcntl.h>
-#if HAVE_SYS_TIME_H
 #include <sys/time.h>
-#endif
 #include "mutt.h"
 #include "hcache.h"
 #include "hcversion.h"
diff --git a/mh.c b/mh.c
index 408fc81a..c7e71859 100644
--- a/mh.c
+++ b/mh.c
@@ -54,10 +54,7 @@
 #include <errno.h>
 #include <string.h>
 #include <utime.h>
-
-#if HAVE_SYS_TIME_H
 #include <sys/time.h>
-#endif
 
 #define         INS_SORT_THRESHOLD              6
 
diff --git a/mutt_random.c b/mutt_random.c
index 6e95f6bf..0d944625 100644
--- a/mutt_random.c
+++ b/mutt_random.c
@@ -25,9 +25,7 @@
 
 #include <fcntl.h>
 #include <string.h>
-#ifdef HAVE_SYS_TIME_H
-  #include <sys/time.h>
-#endif
+#include <sys/time.h>
 #ifdef HAVE_SYS_RANDOM_H
   #include <sys/random.h>
 #endif
diff --git a/mutt_socket.c b/mutt_socket.c
index d6f0faa8..7581cb7d 100644
--- a/mutt_socket.c
+++ b/mutt_socket.c
@@ -38,9 +38,7 @@
 #include <signal.h>
 #include <fcntl.h>
 #include <sys/types.h>
-#ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
-#endif
 #include <time.h>
 #include <sys/socket.h>
 #ifdef HAVE_SYS_SELECT_H
diff --git a/pgp.c b/pgp.c
index 07869a27..2a4a165c 100644
--- a/pgp.c
+++ b/pgp.c
@@ -47,9 +47,7 @@
 
 #include <locale.h>
 
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 
 #ifdef HAVE_SYS_RESOURCE_H
 # include <sys/resource.h>
diff --git a/smime.c b/smime.c
index 5517b2af..d09ba7b1 100644
--- a/smime.c
+++ b/smime.c
@@ -40,9 +40,7 @@
 
 #include <locale.h>
 
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 
 #ifdef HAVE_SYS_RESOURCE_H
 # include <sys/resource.h>
-- 
2.54.0

Reply via email to