Skip to content

Commit d547345

Browse files
committed
Review conf_net.py: fix socket extra_libs and getaddrinfo ipv6 check.
- check_network_libs: pass extra_libs=v.LIBS when checking for -lsocket, matching configure.ac's AC_CHECK_LIB 5th arg ($LIBS); on SVR4/Solaris, socket requires -lnsl in the link test. - check_getaddrinfo: replace v.enable_ipv6 != "" (always False, falls back to unset env var) with ENABLE_IPV6.given, which correctly detects whether --enable-ipv6 or --disable-ipv6 was explicitly passed. Assisted-by: Claude
1 parent 6b2b415 commit d547345

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

Tools/configure/conf_net.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def check_network_libs(v):
3535
# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
3636
if pyconf.check_lib("nsl", "t_open"):
3737
v.LIBS = f"-lnsl {v.LIBS}"
38-
if pyconf.check_lib("socket", "socket"):
38+
if pyconf.check_lib("socket", "socket", extra_libs=v.LIBS):
3939
v.LIBS = f"-lsocket {v.LIBS}"
4040
if f"{v.ac_sys_system}/{v.ac_sys_release}".startswith("Haiku"):
4141
if pyconf.check_lib("network", "socket"):
@@ -380,7 +380,7 @@ def check_getaddrinfo(v):
380380
if pyconf.cross_compiling:
381381
if v.ac_sys_system in ("Linux-android", "iOS"):
382382
ac_cv_buggy_getaddrinfo = False
383-
elif v.enable_ipv6 != "":
383+
elif ENABLE_IPV6.given:
384384
ac_cv_buggy_getaddrinfo = (
385385
"no -- configured with --(en|dis)able-ipv6"
386386
)

Tools/configure/configure.awk

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5069,6 +5069,12 @@ function u__setup_macos_deployment_target( _tmp_split, arch, cur_target, cur_
50695069

50705070
# --- conf_math ---
50715071
function u_check_math_library( found, with_libc, with_libm) {
5072+
pyconf_checking("for __fpu_control")
5073+
found = (pyconf_check_func("__fpu_control", "", "HAVE___FPU_CONTROL") ? "yes" : "no")
5074+
pyconf_result(found)
5075+
if ((!((found != "") && (found != "no")))) {
5076+
pyconf_check_lib("ieee", "__fpu_control")
5077+
}
50725078
v_export("LIBM")
50735079
if ((V["ac_sys_system"] != "Darwin")) {
50745080
V["LIBM"] = "-lm"
@@ -5106,12 +5112,6 @@ function u_check_math_library( found, with_libc, with_libm) {
51065112
} else {
51075113
pyconf_result("default LIBC=\"" V["LIBC"] "\"")
51085114
}
5109-
pyconf_checking("for __fpu_control")
5110-
found = (pyconf_check_func("__fpu_control", "", "HAVE___FPU_CONTROL") ? "yes" : "no")
5111-
pyconf_result(found)
5112-
if ((!((found != "") && (found != "no")))) {
5113-
pyconf_check_lib("ieee", "__fpu_control")
5114-
}
51155115
}
51165116

51175117
function u__define_float_big() {
@@ -5391,12 +5391,12 @@ function u_detect_libmpdec( _i_p, _n_p, _opt_result, ac_cv_gcc_asm_for_x64, a
53915391
} else if ((libmpdec_machine == "unknown")) {
53925392
pyconf_fatal("_decimal: unsupported architecture")
53935393
}
5394-
if (((V["have_ipa_pure_const_bug"] != "") && (V["have_ipa_pure_const_bug"] != "no"))) {
5395-
V["LIBMPDEC_CFLAGS"] = V["LIBMPDEC_CFLAGS"] " -fno-ipa-pure-const"
5396-
}
5397-
if (((V["have_glibc_memmove_bug"] != "") && (V["have_glibc_memmove_bug"] != "no"))) {
5398-
V["LIBMPDEC_CFLAGS"] = V["LIBMPDEC_CFLAGS"] " -U_FORTIFY_SOURCE"
5399-
}
5394+
}
5395+
if (((V["have_ipa_pure_const_bug"] != "") && (V["have_ipa_pure_const_bug"] != "no"))) {
5396+
V["LIBMPDEC_CFLAGS"] = V["LIBMPDEC_CFLAGS"] " -fno-ipa-pure-const"
5397+
}
5398+
if (((V["have_glibc_memmove_bug"] != "") && (V["have_glibc_memmove_bug"] != "no"))) {
5399+
V["LIBMPDEC_CFLAGS"] = V["LIBMPDEC_CFLAGS"] " -U_FORTIFY_SOURCE"
54005400
}
54015401
v_export("LIBMPDEC_CFLAGS")
54025402
v_export("LIBMPDEC_LIBS")
@@ -5657,7 +5657,7 @@ function u_check_network_libs( libs_val) {
56575657
if (pyconf_check_lib("nsl", "t_open", "", "")) {
56585658
V["LIBS"] = "-lnsl " V["LIBS"]
56595659
}
5660-
if (pyconf_check_lib("socket", "socket", "", "")) {
5660+
if (pyconf_check_lib("socket", "socket", "", V["LIBS"])) {
56615661
V["LIBS"] = "-lsocket " V["LIBS"]
56625662
}
56635663
if (_str_startswith(V["ac_sys_system"] "/" V["ac_sys_release"], "Haiku")) {
@@ -5857,7 +5857,7 @@ function u_check_getaddrinfo( GETADDRINFO_TEST, ac_cv_buggy_getaddrinfo, ac_c
58575857
if (((pyconf_cross_compiling != "") && (pyconf_cross_compiling != "no"))) {
58585858
if (((V["ac_sys_system"] == "Linux-android") || (V["ac_sys_system"] == "iOS"))) {
58595859
ac_cv_buggy_getaddrinfo = "no"
5860-
} else if ((V["enable_ipv6"] != "")) {
5860+
} else if (pyconf_option_given("enable_ipv6")) {
58615861
ac_cv_buggy_getaddrinfo = "no -- configured with --(en|dis)able-ipv6"
58625862
} else {
58635863
ac_cv_buggy_getaddrinfo = "yes"

0 commit comments

Comments
 (0)