summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-11-29 14:57:36 +0100
committerGitHub <noreply@github.com>2021-11-29 14:57:36 +0100
commitf7a62f24053c82cf38c3db5848d9ff014470fa40 (patch)
tree39bf72dd8df058d2c259f5bebb91aa7d0f08c14a
parent39b60ceae820a86d730ebdd1ee8cf5370bf5dff8 (diff)
downloadcpython-git-f7a62f24053c82cf38c3db5848d9ff014470fa40.tar.gz
bpo-45847: Make socket module conditional (GH-29769)
-rwxr-xr-xconfigure59
-rw-r--r--configure.ac7
-rw-r--r--pyconfig.h.in3
3 files changed, 51 insertions, 18 deletions
diff --git a/configure b/configure
index 0f96171264..c670878c9e 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_MMAP_FALSE
MODULE_MMAP_TRUE
MODULE_FCNTL_FALSE
@@ -738,8 +740,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
@@ -8371,7 +8371,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"
@@ -21223,15 +21223,6 @@ 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='#'
else
@@ -21445,6 +21436,42 @@ fi
$as_echo "$py_cv_module_mmap" >&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; }
@@ -22982,10 +23009,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
@@ -23038,6 +23061,10 @@ if test -z "${MODULE_MMAP_TRUE}" && test -z "${MODULE_MMAP_FALSE}"; then
as_fn_error $? "conditional \"MODULE_MMAP\" 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 21429470eb..ada3e4ba09 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2206,7 +2206,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
@@ -6292,7 +6292,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])
@@ -6319,6 +6318,10 @@ PY_STDLIB_MOD([fcntl],
[], [$FCNTL_LIBS])
PY_STDLIB_MOD([mmap],
[], [test "$ac_cv_header_sys_mman_h" = "yes" -a "$ac_cv_header_sys_stat_h" = "yes"])
+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 27bed56084..efad243d0a 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -769,6 +769,9 @@
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
/* Define to 1 if you have the <netpacket/packet.h> header file. */
#undef HAVE_NETPACKET_PACKET_H