From 0fdde2228b5a86c3d4b08feb6f5fe1e7994e9bd1 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 25 Nov 2021 01:23:28 +0100 Subject: [PATCH] bpo-45847: Make socket module conditional --- configure | 66 +++++++++++++++++++++++++++++++++++---------------- configure.ac | 7 ++++-- pyconfig.h.in | 3 +++ 3 files changed, 54 insertions(+), 22 deletions(-) diff --git a/configure b/configure index abfda2b00de745..2b8cfc9e8650d0 100755 --- a/configure +++ b/configure @@ -712,6 +712,8 @@ MODULE_OSSAUDIODEV_FALSE MODULE_OSSAUDIODEV_TRUE MODULE_GRP_FALSE MODULE_GRP_TRUE +MODULE__SOCKET_FALSE +MODULE__SOCKET_TRUE MODULE__POSIXSHMEM_FALSE MODULE__POSIXSHMEM_TRUE MODULE_MMAP_FALSE @@ -736,8 +738,6 @@ MODULE__TYPING_FALSE MODULE__TYPING_TRUE MODULE__STRUCT_FALSE MODULE__STRUCT_TRUE -MODULE__SOCKET_FALSE -MODULE__SOCKET_TRUE MODULE_SELECT_FALSE MODULE_SELECT_TRUE MODULE__RANDOM_FALSE @@ -8359,7 +8359,7 @@ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h \ -sys/mman.h sys/eventfd.h linux/soundcard.h sys/soundcard.h syslog.h +sys/mman.h sys/eventfd.h linux/soundcard.h sys/soundcard.h syslog.h netinet/in.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -10382,6 +10382,9 @@ fi # Dynamic linking for HP-UX + + + have_uuid=missing for ac_header in uuid.h @@ -10414,10 +10417,6 @@ fi done - - - - if test "x$have_uuid" = xmissing; then : @@ -21161,15 +21160,6 @@ else fi as_fn_append MODULE_BLOCK "MODULE_SELECT=yes$as_nl" - if true; then - MODULE__SOCKET_TRUE= - MODULE__SOCKET_FALSE='#' -else - MODULE__SOCKET_TRUE='#' - MODULE__SOCKET_FALSE= -fi - as_fn_append MODULE_BLOCK "MODULE__SOCKET=yes$as_nl" - if true; then MODULE__STRUCT_TRUE= MODULE__STRUCT_FALSE='#' @@ -21372,6 +21362,42 @@ fi $as_echo "$py_cv_module__posixshmem" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _socket" >&5 +$as_echo_n "checking for stdlib extension module _socket... " >&6; } + case $py_stdlib_not_available in #( + *_socket*) : + py_cv_module__socket=n/a ;; #( + *) : + if true; then : + if test "$ac_cv_header_sys_socket_h" = "yes" -a "$ac_cv_header_sys_types_h" = "yes" -a "$ac_cv_header_netinet_in_h" = "yes"; then : + py_cv_module__socket=yes +else + py_cv_module__socket=missing +fi +else + py_cv_module__socket=disabled +fi + ;; +esac + as_fn_append MODULE_BLOCK "MODULE__SOCKET=$py_cv_module__socket$as_nl" + if test "x$py_cv_module__socket" = xyes; then : + + + + +fi + if test "$py_cv_module__socket" = yes; then + MODULE__SOCKET_TRUE= + MODULE__SOCKET_FALSE='#' +else + MODULE__SOCKET_TRUE='#' + MODULE__SOCKET_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__socket" >&5 +$as_echo "$py_cv_module__socket" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module grp" >&5 $as_echo_n "checking for stdlib extension module grp... " >&6; } @@ -22909,10 +22935,6 @@ if test -z "${MODULE_SELECT_TRUE}" && test -z "${MODULE_SELECT_FALSE}"; then as_fn_error $? "conditional \"MODULE_SELECT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${MODULE__SOCKET_TRUE}" && test -z "${MODULE__SOCKET_FALSE}"; then - as_fn_error $? "conditional \"MODULE__SOCKET\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${MODULE__STRUCT_TRUE}" && test -z "${MODULE__STRUCT_FALSE}"; then as_fn_error $? "conditional \"MODULE__STRUCT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -22961,6 +22983,10 @@ if test -z "${MODULE__POSIXSHMEM_TRUE}" && test -z "${MODULE__POSIXSHMEM_FALSE}" as_fn_error $? "conditional \"MODULE__POSIXSHMEM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${MODULE__SOCKET_TRUE}" && test -z "${MODULE__SOCKET_FALSE}"; then + as_fn_error $? "conditional \"MODULE__SOCKET\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MODULE_GRP_TRUE}" && test -z "${MODULE_GRP_FALSE}"; then as_fn_error $? "conditional \"MODULE_GRP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 1853baa5a8e8c2..f86911f5f49c7c 100644 --- a/configure.ac +++ b/configure.ac @@ -2197,7 +2197,7 @@ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h \ -sys/mman.h sys/eventfd.h linux/soundcard.h sys/soundcard.h syslog.h) +sys/mman.h sys/eventfd.h linux/soundcard.h sys/soundcard.h syslog.h netinet/in.h) AC_HEADER_DIRENT AC_HEADER_MAJOR @@ -6247,7 +6247,6 @@ PY_STDLIB_MOD_SIMPLE([_posixsubprocess]) PY_STDLIB_MOD_SIMPLE([_queue]) PY_STDLIB_MOD_SIMPLE([_random]) PY_STDLIB_MOD_SIMPLE([select]) -PY_STDLIB_MOD_SIMPLE([_socket]) PY_STDLIB_MOD_SIMPLE([_struct]) PY_STDLIB_MOD_SIMPLE([_typing]) PY_STDLIB_MOD_SIMPLE([_xxsubinterpreters]) @@ -6271,6 +6270,10 @@ PY_STDLIB_MOD([mmap], PY_STDLIB_MOD([_posixshmem], [], [test "$have_posix_shmem" = "yes"], [$POSIXSHMEM_CFLAGS], [$POSIXSHMEM_LIBS]) +PY_STDLIB_MOD([_socket], + [], m4_flatten([test "$ac_cv_header_sys_socket_h" = "yes" + -a "$ac_cv_header_sys_types_h" = "yes" + -a "$ac_cv_header_netinet_in_h" = "yes"])) dnl platform specific extensions PY_STDLIB_MOD([grp], [], [test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes]) diff --git a/pyconfig.h.in b/pyconfig.h.in index 842759fb213ae1..b631309f09e657 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -751,6 +751,9 @@ /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + /* Define to 1 if you have the header file. */ #undef HAVE_NETPACKET_PACKET_H