https://github.com/python/cpython/commit/1064141967a2d22c2ae9e22ae77e8c9616559947
commit: 1064141967a2d22c2ae9e22ae77e8c9616559947
branch: main
author: Jakub KulĂ­k <[email protected]>
committer: encukou <[email protected]>
date: 2024-10-30T13:19:44+01:00
summary:

gh-91962: Fix `hstrerror` detection issues on Solaris (GH-91963)

files:
M configure
M configure.ac
M pyconfig.h.in

diff --git a/configure b/configure
index 70eea29620fde8..5be57e39309b91 100755
--- a/configure
+++ b/configure
@@ -20478,10 +20478,89 @@ fi
 printf "%s\n" "$ac_cv_lib_resolv_inet_aton" >&6; }
 if test "x$ac_cv_lib_resolv_inet_aton" = xyes
 then :
-  printf "%s\n" "#define HAVE_LIBRESOLV 1" >>confdefs.h
+  SOCKET_LIBS="-lresolv"
+fi
+
+
+fi
 
-  LIBS="-lresolv $LIBS"
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for hstrerror in -lc" 
>&5
+printf %s "checking for hstrerror in -lc... " >&6; }
+if test ${ac_cv_lib_c_hstrerror+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+char hstrerror ();
+int
+main (void)
+{
+return hstrerror ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"
+then :
+  ac_cv_lib_c_hstrerror=yes
+else $as_nop
+  ac_cv_lib_c_hstrerror=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_hstrerror" 
>&5
+printf "%s\n" "$ac_cv_lib_c_hstrerror" >&6; }
+if test "x$ac_cv_lib_c_hstrerror" = xyes
+then :
+  $ac_cv_prog_TRUE
+else $as_nop
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for hstrerror in 
-lresolv" >&5
+printf %s "checking for hstrerror in -lresolv... " >&6; }
+if test ${ac_cv_lib_resolv_hstrerror+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lresolv  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+char hstrerror ();
+int
+main (void)
+{
+return hstrerror ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"
+then :
+  ac_cv_lib_resolv_hstrerror=yes
+else $as_nop
+  ac_cv_lib_resolv_hstrerror=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_lib_resolv_hstrerror" >&5
+printf "%s\n" "$ac_cv_lib_resolv_hstrerror" >&6; }
+if test "x$ac_cv_lib_resolv_hstrerror" = xyes
+then :
+  SOCKET_LIBS="-lresolv"
 fi
 
 
@@ -29988,7 +30067,7 @@ fi
 then :
 
 
-
+    as_fn_append MODULE_BLOCK "MODULE__SOCKET_LDFLAGS=$SOCKET_LIBS$as_nl"
 
 fi
    if test "$py_cv_module__socket" = yes; then
diff --git a/configure.ac b/configure.ac
index 86e7075f07eac0..caf0244cc7b54b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5311,10 +5311,13 @@ AS_VAR_IF([ac_cv_broken_unsetenv], [yes], [
 dnl check for true
 AC_CHECK_PROGS([TRUE], [true], [/bin/true])
 
-dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
+dnl On some systems (e.g. Solaris), hstrerror and inet_aton are in -lresolv
 dnl On others, they are in the C library, so we to take no action
 AC_CHECK_LIB([c], [inet_aton], [$ac_cv_prog_TRUE],
-  AC_CHECK_LIB([resolv], [inet_aton])
+  AC_CHECK_LIB([resolv], [inet_aton], [SOCKET_LIBS="-lresolv"])
+)
+AC_CHECK_LIB([c], [hstrerror], [$ac_cv_prog_TRUE],
+  AC_CHECK_LIB([resolv], [hstrerror], [SOCKET_LIBS="-lresolv"])
 )
 
 # On Tru64, chflags seems to be present, but calling it will
@@ -7789,7 +7792,7 @@ PY_STDLIB_MOD([mmap],
 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"]))
+                    -a "$ac_cv_header_netinet_in_h" = "yes"]), [], 
[$SOCKET_LIBS])
 
 dnl platform specific extensions
 PY_STDLIB_MOD([grp], [],
diff --git a/pyconfig.h.in b/pyconfig.h.in
index fb9ab1e78dc7e1..fcb8a965b1e476 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -691,9 +691,6 @@
 /* Define to 1 if you have the <libintl.h> header file. */
 #undef HAVE_LIBINTL_H
 
-/* Define to 1 if you have the `resolv' library (-lresolv). */
-#undef HAVE_LIBRESOLV
-
 /* Define to 1 if you have the `sendfile' library (-lsendfile). */
 #undef HAVE_LIBSENDFILE
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to