]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-78469: Declare missing sethostname for Solaris 10 (GH-109447) (#110581)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 10 Oct 2023 10:06:18 +0000 (12:06 +0200)
committerGitHub <noreply@github.com>
Tue, 10 Oct 2023 10:06:18 +0000 (10:06 +0000)
Add OS version specific macro for Solaris: Py_SUNOS_VERSION.
(cherry picked from commit 3b1580af07c0ce90d1c2073ab087772283d7e3b9)

Co-authored-by: Jakub KulĂ­k <Kulikjak@gmail.com>
Modules/socketmodule.c
configure
configure.ac
pyconfig.h.in

index db3e0519c63f3df894cf62dee0c97fadb8613447..8d9d3c3e1cd3e3ab0e930c3132ffb7a5de98430f 100644 (file)
@@ -5534,8 +5534,9 @@ socket_sethostname(PyObject *self, PyObject *args)
     Py_buffer buf;
     int res, flag = 0;
 
-#ifdef _AIX
-/* issue #18259, not declared in any useful header file */
+#if defined(_AIX) || (defined(__sun) && defined(__SVR4) && Py_SUNOS_VERSION <= 510)
+/* issue #18259, sethostname is not declared in any useful header file on AIX
+ * the same is true for Solaris 10 */
 extern int sethostname(const char *, size_t);
 #endif
 
index b294f93a5564b48fdedaaef1ef52783e8d4594c0..8d2f3f4cc0fa5f4717ca3a2cf66cd3f700124451 100755 (executable)
--- a/configure
+++ b/configure
@@ -3860,6 +3860,17 @@ then
        darwin*) MACHDEP="darwin";;
        '')     MACHDEP="unknown";;
     esac
+
+    if test "$ac_sys_system" = "SunOS"; then
+       # For Solaris, there isn't an OS version specific macro defined
+       # in most compilers, so we define one here.
+       SUNOS_VERSION=`echo $ac_sys_release | sed -e 's!\.\(0-9\)$!.0\1!g' | tr -d '.'`
+
+cat >>confdefs.h <<_ACEOF
+#define Py_SUNOS_VERSION $SUNOS_VERSION
+_ACEOF
+
+    fi
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$MACHDEP\"" >&5
 $as_echo "\"$MACHDEP\"" >&6; }
index 629b7b76c3c315ff4d6c04b69c3e5773bc6503f6..52d5c1f7dd3593f3f825fc82af841f76315745ca 100644 (file)
@@ -582,6 +582,14 @@ then
        darwin*) MACHDEP="darwin";;
        '')     MACHDEP="unknown";;
     esac
+
+    if test "$ac_sys_system" = "SunOS"; then
+       # For Solaris, there isn't an OS version specific macro defined
+       # in most compilers, so we define one here.
+       SUNOS_VERSION=`echo $ac_sys_release | sed -e 's!\.\([0-9]\)$!.0\1!g' | tr -d '.'`
+       AC_DEFINE_UNQUOTED([Py_SUNOS_VERSION], [$SUNOS_VERSION],
+                          [The version of SunOS/Solaris as reported by `uname -r' without the dot.])
+    fi
 fi
 AC_MSG_RESULT("$MACHDEP")
 
index 94d02e14c444ac9aacb059ba226afb77bad9af6a..a8c35bba448ea85f70bc3005a03299969b716804 100644 (file)
 /* Define if you want to enable internal statistics gathering. */
 #undef Py_STATS
 
+/* The version of SunOS/Solaris as reported by `uname -r' without the dot. */
+#undef Py_SUNOS_VERSION
+
 /* Define if you want to enable tracing references for debugging purpose */
 #undef Py_TRACE_REFS