]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-78469: Declare missing sethostname for Solaris 10 (GH-109447) (#110580)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 10 Oct 2023 09:26:36 +0000 (11:26 +0200)
committerGitHub <noreply@github.com>
Tue, 10 Oct 2023 09:26:36 +0000 (09:26 +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 4ec68e22a9f8cd74fc027beb8a895c0b7f2b2f82..62b0e67be15c49c29b9dc7b0eb0f8e8c04e33375 100644 (file)
@@ -5655,8 +5655,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 985b3741349e8e137a873fb24ea90f131b3af28c..0240ff86dccbf95867304b2e523abaea8993f48e 100755 (executable)
--- a/configure
+++ b/configure
@@ -4304,6 +4304,15 @@ 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 '.'`
+
+printf "%s\n" "#define Py_SUNOS_VERSION $SUNOS_VERSION" >>confdefs.h
+
+    fi
 fi
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: \"$MACHDEP\"" >&5
 printf "%s\n" "\"$MACHDEP\"" >&6; }
index 2a7a91882640fd76d21b4f9443885ab07e01ff58..34e0653623dd6ede2ebdc3a3ae63e69e141448bd 100644 (file)
@@ -590,6 +590,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 9f858b2d3541d092dae8172b6c80681e15ebed36..6d370f6664c10c0b7c28c3ab7781e38c5e9f7bff 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