Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-89886: Rely on HAVE_SYS_TIME_H #105058

Merged
merged 8 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Modules/expat/xmlparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
#ifdef _WIN32
# define getpid GetCurrentProcessId
#else
// HAVE_SYS_TIME_H is enforced by configure
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
# include <sys/time.h> /* gettimeofday() */
# include <sys/types.h> /* getpid() */
# include <unistd.h> /* getpid() */
Expand Down
3 changes: 3 additions & 0 deletions Modules/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
#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.
Expand Down
3 changes: 3 additions & 0 deletions Modules/resource.c
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
17 changes: 7 additions & 10 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3735,6 +3735,11 @@ AS_VAR_IF([with_system_expat], [yes], [
AC_SUBST([LIBEXPAT_CFLAGS])
AC_SUBST([LIBEXPAT_INTERNAL])

AS_VAR_IF(
[ac_cv_header_sys_time_h], [yes],
[AS_VAR_SET([have_libexpat], [yes])]
)
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved

dnl detect libffi
have_libffi=missing
AS_VAR_IF([ac_sys_system], [Darwin], [
Expand Down Expand Up @@ -5236,12 +5241,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
Expand Down Expand Up @@ -7200,8 +7199,12 @@ 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([_elementtree], [], [], [$LIBEXPAT_CFLAGS], [])
PY_STDLIB_MOD([pyexpat],
[], [test "$have_libexpat" = "yes"],
[$LIBEXPAT_CFLAGS], [$LIBEXPAT_LDFLAGS])
PY_STDLIB_MOD([_elementtree],
[], [test "$have_libexpat" = "yes"],
[$LIBEXPAT_CFLAGS], [])
PY_STDLIB_MOD_SIMPLE([_codecs_cn])
PY_STDLIB_MOD_SIMPLE([_codecs_hk])
PY_STDLIB_MOD_SIMPLE([_codecs_iso2022])
Expand Down
3 changes: 0 additions & 3 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -1682,9 +1682,6 @@
/* 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

Expand Down