diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-10-10 10:06:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 10:06:18 (GMT) |
commit | 194272179dc2cbe67358fc0ebde73dea90bc5a1b (patch) | |
tree | c43fc87d178ae9df880d41bd856a3cdfd944e5e1 | |
parent | 2b3a4182798bc95a426e55d1f9f7199e2f2b5662 (diff) | |
download | cpython-194272179dc2cbe67358fc0ebde73dea90bc5a1b.zip cpython-194272179dc2cbe67358fc0ebde73dea90bc5a1b.tar.gz cpython-194272179dc2cbe67358fc0ebde73dea90bc5a1b.tar.bz2 |
[3.11] gh-78469: Declare missing sethostname for Solaris 10 (GH-109447) (#110581)
Add OS version specific macro for Solaris: Py_SUNOS_VERSION.
(cherry picked from commit 3b1580af07c0ce90d1c2073ab087772283d7e3b9)
Co-authored-by: Jakub KulĂk <Kulikjak@gmail.com>
-rw-r--r-- | Modules/socketmodule.c | 5 | ||||
-rwxr-xr-x | configure | 11 | ||||
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | pyconfig.h.in | 3 |
4 files changed, 25 insertions, 2 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index db3e051..8d9d3c3 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -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 @@ -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; } diff --git a/configure.ac b/configure.ac index 629b7b7..52d5c1f 100644 --- a/configure.ac +++ b/configure.ac @@ -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") diff --git a/pyconfig.h.in b/pyconfig.h.in index 94d02e1..a8c35bb 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1595,6 +1595,9 @@ /* 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 |