Files
MINGW-packages/mingw-w64-python3/0520-py3k-mingw-ntthreads-vs-pthreads.patch
2014-03-18 00:25:28 +04:00

75 lines
2.3 KiB
Diff

diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac 2014-03-18 00:07:13.250600000 +0400
+++ b/configure.ac 2014-03-18 00:07:13.422200000 +0400
@@ -1700,7 +1700,7 @@
CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
fcntl.h grp.h \
-ieeefp.h io.h langinfo.h libintl.h ncurses.h process.h pthread.h \
+ieeefp.h io.h langinfo.h libintl.h ncurses.h process.h \
sched.h shadow.h signal.h stdint.h stropts.h termios.h \
unistd.h utime.h \
poll.h sys/devpoll.h sys/epoll.h sys/poll.h \
@@ -1733,6 +1733,14 @@
])
+# If using nt threads, don't look for pthread.h or thread.h
+if test "x$ac_cv_ntthread" = xno ; then
+AC_HEADER_STDC
+AC_CHECK_HEADERS(pthread.h thread.h)
+AC_HEADER_DIRENT
+AC_HEADER_MAJOR
+fi
+
# On Solaris, term.h requires curses.h
AC_CHECK_HEADERS(term.h,,,[
#ifdef HAVE_CURSES_H
@@ -2412,9 +2420,11 @@
:
else
if test "$with_threads" = "yes" -o -z "$with_threads"; then
- AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
- # posix4 on Solaris 2.6
- # pthread (first!) on Linux
+ if test "$ac_cv_ntthread" = "no" -o -z "$ac_cv_ntthread"; then
+ AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
+ # posix4 on Solaris 2.6
+ # pthread (first!) on Linux
+ fi
fi
fi
diff -Naur a/Python/condvar.h b/Python/condvar.h
--- a/Python/condvar.h 2014-03-17 06:31:31.000000000 +0400
+++ b/Python/condvar.h 2014-03-18 00:07:13.422200000 +0400
@@ -42,6 +42,12 @@
#include "Python.h"
+#ifdef __MINGW32__
+# if !defined(HAVE_PTHREAD_H) || defined(NT_THREADS)
+# undef _POSIX_THREADS
+# endif
+#endif
+
#ifndef _POSIX_THREADS
/* This means pthreads are not implemented in libc headers, hence the macro
not present in unistd.h. But they still can be implemented as an external
diff -Naur a/Python/thread.c b/Python/thread.c
--- a/Python/thread.c 2014-03-17 06:31:31.000000000 +0400
+++ b/Python/thread.c 2014-03-18 00:07:13.422200000 +0400
@@ -7,6 +7,12 @@
#include "Python.h"
+#ifdef __MINGW32__
+# if !defined(HAVE_PTHREAD_H) || defined(NT_THREADS)
+# undef _POSIX_THREADS
+# endif
+#endif
+
#ifndef _POSIX_THREADS
/* This means pthreads are not implemented in libc headers, hence the macro
not present in unistd.h. But they still can be implemented as an external