Commit 025dee92 authored by Martin v. Löwis's avatar Martin v. Löwis

Patch #497098: build support for GNU/Hurd.

parent c9b16805
...@@ -301,6 +301,7 @@ Dom Mitchell ...@@ -301,6 +301,7 @@ Dom Mitchell
Doug Moen Doug Moen
The Dragon De Monsyne The Dragon De Monsyne
Skip Montanaro Skip Montanaro
James A Morrison
Sape Mullender Sape Mullender
Sjoerd Mullender Sjoerd Mullender
Michael Muller Michael Muller
......
...@@ -30,6 +30,8 @@ C API ...@@ -30,6 +30,8 @@ C API
New platforms New platforms
- GNU/Hurd is now supported.
Tests Tests
Windows Windows
......
#ifdef MACH_C_THREADS
#include <mach/cthreads.h> #include <mach/cthreads.h>
#endif
#ifdef HURD_C_THREADS
#include <cthreads.h>
#endif
/* /*
* Initialization. * Initialization.
...@@ -8,7 +13,14 @@ ...@@ -8,7 +13,14 @@
static void static void
PyThread__init_thread(void) PyThread__init_thread(void)
{ {
#ifndef HURD_C_THREADS
/* Roland McGrath said this should not be used since this is
done while linking to threads */
cthread_init(); cthread_init();
#else
/* do nothing */
;
#endif
} }
/* /*
...@@ -127,10 +139,10 @@ PyThread_acquire_lock(PyThread_type_lock lock, int waitflag) ...@@ -127,10 +139,10 @@ PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag)); dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
if (waitflag) { /* blocking */ if (waitflag) { /* blocking */
mutex_lock(lock); mutex_lock((mutex_t)lock);
success = TRUE; success = TRUE;
} else { /* non blocking */ } else { /* non blocking */
success = mutex_try_lock(lock); success = mutex_try_lock((mutex_t)lock);
} }
dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
return success; return success;
......
...@@ -19,6 +19,12 @@ ...@@ -19,6 +19,12 @@
/* Define if you have the Mach cthreads package */ /* Define if you have the Mach cthreads package */
#undef C_THREADS #undef C_THREADS
/* Define if you are using Mach cthreads under mach / */
#undef MACH_C_THREADS
/* Define if you are using Mach cthreads directly under /include */
#undef HURD_C_THREADS
/* Define to `long' if <time.h> doesn't define. */ /* Define to `long' if <time.h> doesn't define. */
#undef clock_t #undef clock_t
...@@ -47,6 +53,9 @@ ...@@ -47,6 +53,9 @@
/* struct addrinfo (netdb.h) */ /* struct addrinfo (netdb.h) */
#undef HAVE_ADDRINFO #undef HAVE_ADDRINFO
/* Define if you have the getaddrinfo function. */
#undef HAVE_GETADDRINFO
/* struct sockaddr_storage (sys/socket.h) */ /* struct sockaddr_storage (sys/socket.h) */
#undef HAVE_SOCKADDR_STORAGE #undef HAVE_SOCKADDR_STORAGE
......
This diff is collapsed.
...@@ -796,7 +796,7 @@ then ...@@ -796,7 +796,7 @@ then
# No framework. Ignore undefined symbols, assuming they come from Python # No framework. Ignore undefined symbols, assuming they come from Python
LDSHARED="$LDSHARED -flat_namespace -undefined suppress" LDSHARED="$LDSHARED -flat_namespace -undefined suppress"
fi ;; fi ;;
Linux*) LDSHARED="gcc -shared";; Linux*|GNU*) LDSHARED="gcc -shared";;
dgux*) LDSHARED="ld -G";; dgux*) LDSHARED="ld -G";;
BSD/OS*/4*) LDSHARED="gcc -shared";; BSD/OS*/4*) LDSHARED="gcc -shared";;
OpenBSD*|NetBSD*|FreeBSD*) OpenBSD*|NetBSD*|FreeBSD*)
...@@ -832,7 +832,7 @@ then ...@@ -832,7 +832,7 @@ then
then CCSHARED="-fPIC"; then CCSHARED="-fPIC";
else CCSHARED="+z"; else CCSHARED="+z";
fi;; fi;;
Linux*) CCSHARED="-fPIC";; Linux*|GNU*) CCSHARED="-fPIC";;
BSD/OS*/4*) CCSHARED="-fpic";; BSD/OS*/4*) CCSHARED="-fpic";;
FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";; FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
OpenUNIX*|UnixWare*) OpenUNIX*|UnixWare*)
...@@ -860,7 +860,7 @@ then ...@@ -860,7 +860,7 @@ then
hp*|HP*) hp*|HP*)
LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Linux*) LINKFORSHARED="-Xlinker -export-dynamic";; Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
# -u libsys_s pulls in all symbols in libsys # -u libsys_s pulls in all symbols in libsys
Darwin/*) Darwin/*)
# -u __dummy makes the linker aware of the objc runtime # -u __dummy makes the linker aware of the objc runtime
...@@ -1033,8 +1033,14 @@ else ...@@ -1033,8 +1033,14 @@ else
AC_MSG_RESULT($unistd_defines_pthreads) AC_MSG_RESULT($unistd_defines_pthreads)
AC_DEFINE(_REENTRANT) AC_DEFINE(_REENTRANT)
AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
AC_DEFINE(C_THREADS)
AC_DEFINE(HURD_C_THREADS)
LIBS="$LIBS -lthreads"
LIBOBJS="$LIBOBJS thread.o"],[
AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
AC_DEFINE(C_THREADS) AC_DEFINE(C_THREADS)
AC_DEFINE(MACH_C_THREADS)
LIBOBJS="$LIBOBJS thread.o"],[ LIBOBJS="$LIBOBJS thread.o"],[
AC_MSG_CHECKING(for --with-pth) AC_MSG_CHECKING(for --with-pth)
AC_ARG_WITH(pth, AC_ARG_WITH(pth,
...@@ -1088,7 +1094,7 @@ pthread_create (NULL, NULL, start_routine, NULL)], [ ...@@ -1088,7 +1094,7 @@ pthread_create (NULL, NULL, start_routine, NULL)], [
LIBS="$LIBS -lcma" LIBS="$LIBS -lcma"
LIBOBJS="$LIBOBJS thread.o"],[ LIBOBJS="$LIBOBJS thread.o"],[
USE_THREAD_MODULE="#"]) USE_THREAD_MODULE="#"])
])])])])])])])])]) ])])])])])])])])])])
if test "$posix_threads" = "yes"; then if test "$posix_threads" = "yes"; then
if test "$unistd_defines_pthreads" = "no"; then if test "$unistd_defines_pthreads" = "no"; then
......
...@@ -93,6 +93,12 @@ ...@@ -93,6 +93,12 @@
/* Define if you have the Mach cthreads package */ /* Define if you have the Mach cthreads package */
#undef C_THREADS #undef C_THREADS
/* Define if you are using Mach cthreads under mach / */
#undef MACH_C_THREADS
/* Define if you are using Mach cthreads directly under /include */
#undef HURD_C_THREADS
/* Define to `long' if <time.h> doesn't define. */ /* Define to `long' if <time.h> doesn't define. */
#undef clock_t #undef clock_t
...@@ -121,6 +127,9 @@ ...@@ -121,6 +127,9 @@
/* struct addrinfo (netdb.h) */ /* struct addrinfo (netdb.h) */
#undef HAVE_ADDRINFO #undef HAVE_ADDRINFO
/* Define if you have the getaddrinfo function. */
#undef HAVE_GETADDRINFO
/* struct sockaddr_storage (sys/socket.h) */ /* struct sockaddr_storage (sys/socket.h) */
#undef HAVE_SOCKADDR_STORAGE #undef HAVE_SOCKADDR_STORAGE
...@@ -402,9 +411,6 @@ ...@@ -402,9 +411,6 @@
/* Define if you have the gai_strerror function. */ /* Define if you have the gai_strerror function. */
#undef HAVE_GAI_STRERROR #undef HAVE_GAI_STRERROR
/* Define if you have the getaddrinfo function. */
#undef HAVE_GETADDRINFO
/* Define if you have the getcwd function. */ /* Define if you have the getcwd function. */
#undef HAVE_GETCWD #undef HAVE_GETCWD
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment