]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-89886: Rely on HAVE_SYS_TIME_H (GH-105058) (#105192)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 1 Jun 2023 12:08:37 +0000 (05:08 -0700)
committerGitHub <noreply@github.com>
Thu, 1 Jun 2023 12:08:37 +0000 (12:08 +0000)
Quoting autoconf (v2.71):

    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.

(cherry picked from commit 9ab587b7146618866cee52c220aecf7bd5b44b02)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Modules/readline.c
Modules/resource.c
configure
configure.ac
pyconfig.h.in

index fdb6356e1c84b5b753ebb7bd6da7a7c5af86d28d..2824105a1875860c5168f77cdbfaa2cd1c2da1bf 100644 (file)
 #include <signal.h>
 #include <stddef.h>
 #include <stdlib.h>               // free()
+#ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
+#include <time.h>
 
 #if defined(HAVE_SETLOCALE)
 /* GNU readline() mistakenly sets the LC_CTYPE locale.
index 2a8158c9be5359ad729db39f89e8a4bbe569cb4f..3c89468c48c56eb444d7349e92070bb543de867f 100644 (file)
@@ -1,7 +1,10 @@
 
 #include "Python.h"
 #include <sys/resource.h>
+#ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
+#include <time.h>
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
index ed80d95ecba0229f2a24bd3faaea948be1cee501..012dac94feddd6b2e581d0652771b89229d5d1db 100755 (executable)
--- a/configure
+++ b/configure
 done
 
 
-if test "x$ac_cv_header_sys_time_h" = xyes; then :
-
-
-$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
-
-
-fi
-
 # checks for structures
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
@@ -26736,7 +26728,7 @@ $as_echo_n "checking for stdlib extension module pyexpat... " >&6; }
         if test "$py_cv_module_pyexpat" != "n/a"; then :
 
     if true; then :
-  if true; then :
+  if test "$ac_cv_header_sys_time_h" = "yes"; then :
   py_cv_module_pyexpat=yes
 else
   py_cv_module_pyexpat=missing
index 2d3f5191fbf3c3f21c342a46bc16fa8bf5fb06ab..c30fb2a08d104edd099e135abb8c66977263c436 100644 (file)
@@ -5375,12 +5375,6 @@ fi
 
 AC_CHECK_FUNCS([getnameinfo])
 
-dnl autoconf 2.71 deprecates AC_HEADER_TIME, keep for backwards compatibility
-dnl TIME_WITH_SYS_TIME works on all supported systems that have sys/time.h
-AS_VAR_IF([ac_cv_header_sys_time_h], [yes], [
-  AC_DEFINE([TIME_WITH_SYS_TIME], 1, [Define to 1 if you can safely include both <sys/time.h> and <time.h>.])
-])
-
 # checks for structures
 AC_STRUCT_TM
 AC_STRUCT_TIMEZONE
@@ -7375,7 +7369,9 @@ PY_STDLIB_MOD([syslog], [], [test "$ac_cv_header_syslog_h" = yes])
 PY_STDLIB_MOD([termios], [], [test "$ac_cv_header_termios_h" = yes])
 
 dnl _elementtree loads libexpat via CAPI hook in pyexpat
-PY_STDLIB_MOD([pyexpat], [], [], [$LIBEXPAT_CFLAGS], [$LIBEXPAT_LDFLAGS])
+PY_STDLIB_MOD([pyexpat],
+  [], [test "$ac_cv_header_sys_time_h" = "yes"],
+  [$LIBEXPAT_CFLAGS], [$LIBEXPAT_LDFLAGS])
 PY_STDLIB_MOD([_elementtree], [], [], [$LIBEXPAT_CFLAGS], [])
 PY_STDLIB_MOD_SIMPLE([_codecs_cn])
 PY_STDLIB_MOD_SIMPLE([_codecs_hk])
index 2c22b27af65ea3e512ef9e5b28e46b3d9eabea98..b33e82c3609c18d79eb613767602bdbfd33f0248 100644 (file)
 /* Library needed by timemodule.c: librt may be needed for clock_gettime() */
 #undef TIMEMODULE_LIB
 
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
 /* Define to 1 if your <sys/time.h> declares `struct tm'. */
 #undef TM_IN_SYS_TIME