blob: b13da2d102ae66e0bd44ead4a5513a4e1ef3852a [file] [log] [blame]
diff -Naur Python-2.7.9-orig/configure.ac Python-2.7.9/configure.ac
--- Python-2.7.9-orig/configure.ac 2014-12-10 19:00:00.000000000 +0300
+++ Python-2.7.9/configure.ac 2014-12-11 13:49:29.658200000 +0300
@@ -1349,6 +1349,37 @@
CFLAGS=$save_CFLAGS
fi
+dnl NOTE:
+dnl - GCC 4.4+ for mingw* require and use posix threads(pthreads-w32)
+dnl - Host may contain installed pthreads-w32.
+dnl - On windows platform only NT-thread model is supported.
+dnl To avoid miss detection scipt first will check for NT-thread model
+dnl and if is not found will try to detect build options for pthread
+dnl model. Autodetection could be overiden if variable ac_cv_ntthread
+dnl is set in "Site Configuration" (see autoconf manual).
+dnl If NT-thread model is enabled script skips some checks that
+dnl impact build process. When a new functionality is added, developers
+dnl are responsible to update configure script to avoid thread models
+dnl to be mixed.
+
+AC_MSG_CHECKING([for NT threads])
+AC_CACHE_VAL([ac_cv_ntthread],[
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[]],[[_beginthread(0, 0, 0);]])
+ ],
+ [ac_cv_ntthread=yes],
+ [ac_cv_ntthread=no])
+])
+AC_MSG_RESULT([$ac_cv_ntthread])
+
+if test $ac_cv_ntthread = yes ; then
+ dnl temporary default flag to avoid additional pthread checks
+ dnl and initilize other ac..thread flags to no
+ ac_cv_pthread_is_default=yes
+ ac_cv_kthread=no
+ ac_cv_pthread=no
+ dnl ac_cv_kpthread is set to no if default is yes (see below)
+else
# On some compilers, pthreads are available without further options
# (e.g. MacOS X). On some of these systems, the compiler will not
# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
@@ -1376,6 +1407,7 @@
],[ac_cv_pthread_is_default=no],[ac_cv_pthread_is_default=no])
])
AC_MSG_RESULT($ac_cv_pthread_is_default)
+fi
if test $ac_cv_pthread_is_default = yes
@@ -1467,6 +1499,9 @@
AC_MSG_RESULT($ac_cv_pthread)
fi
+dnl unset temporary pthread default if NT-thread model is enabled
+test $ac_cv_ntthread = yes && ac_cv_pthread_is_default=no
+
# If we have set a CC compiler flag for thread support then
# check if it works for CXX, too.
ac_cv_cxx_thread=no
@@ -1487,6 +1522,10 @@
then
CXX="$CXX -pthread"
ac_cv_cxx_thread=yes
+elif test $ac_cv_ntthread = yes
+then
+ dnl set to always to skip extra pthread check below
+ ac_cv_cxx_thread=always
fi
if test $ac_cv_cxx_thread = yes
@@ -1516,6 +1555,11 @@
dnl AC_MSG_RESULT($cpp_type)
# checks for header files
+if test $ac_cv_ntthread = yes ; then
+ dnl skip checks for some pthread headers if NT-thread model is enabled
+ ac_cv_header_sched_h=skip
+ ac_cv_header_pthread_h=skip
+fi
AC_HEADER_STDC
AC_CHECK_HEADERS(asm/types.h conio.h direct.h dlfcn.h errno.h \
fcntl.h grp.h \
@@ -1752,9 +1796,14 @@
fi
AC_MSG_CHECKING(for pthread_t)
have_pthread_t=no
+if test $ac_cv_ntthread = yes ; then
+ dnl skip check for pthread_t if NT-thread model is enabled
+ have_pthread_t=skip
+else
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]])
],[have_pthread_t=yes],[])
+fi
AC_MSG_RESULT($have_pthread_t)
if test "$have_pthread_t" = yes ; then
AC_CHECK_SIZEOF(pthread_t, [], [
@@ -2223,11 +2272,16 @@
AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
# only check for sem_init if thread support is requested
+if test $ac_cv_ntthread = yes ; then
+ dnl do not search for sem_init if NT-thread model is enabled
+ :
+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
fi
+fi
# check if we need libintl for locale functions
AC_CHECK_LIB(intl, textdomain,
@@ -2442,6 +2496,13 @@
AC_DEFINE(WITH_THREAD)
posix_threads=yes
THREADOBJ="Python/thread.o"
+elif test $ac_cv_ntthread = yes
+then
+ AC_DEFINE(WITH_THREAD)
+ posix_threads=no
+ THREADOBJ="Python/thread.o"
+ AC_DEFINE(NT_THREADS, 1,
+ [Define to 1 if you want to use native NT threads])
else
if test ! -z "$with_threads" -a -d "$with_threads"
then LDFLAGS="$LDFLAGS -L$with_threads"
@@ -2910,6 +2971,15 @@
AC_MSG_RESULT(MACHDEP_OBJS)
# checks for library functions
+if test $ac_cv_ntthread = yes ; then
+ dnl GCC(mingw) 4.4+ require and use posix threads(pthreads-w32)
+ dnl and host may contain installed pthreads-w32.
+ dnl Skip checks for some functions declared in pthreads-w32 if
+ dnl NT-thread model is enabled.
+ ac_cv_func_pthread_kill=skip
+ ac_cv_func_sem_open=skip
+ ac_cv_func_sched_setscheduler=skip
+fi
AC_CHECK_FUNCS(alarm setitimer getitimer chown \
clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
getentropy \
@@ -3812,6 +3882,10 @@
# the kernel module that provides POSIX semaphores
# isn't loaded by default, so an attempt to call
# sem_open results in a 'Signal 12' error.
+if test $ac_cv_ntthread = yes ; then
+ dnl skip posix semaphores test if NT-thread model is enabled
+ ac_cv_posix_semaphores_enabled=no
+fi
AC_MSG_CHECKING(whether POSIX semaphores are enabled)
AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
AC_RUN_IFELSE([AC_LANG_SOURCE([[
@@ -3845,6 +3919,14 @@
# Multiprocessing check for broken sem_getvalue
AC_MSG_CHECKING(for broken sem_getvalue)
+if test $ac_cv_ntthread = yes ; then
+ dnl Skip test if NT-thread model is enabled.
+ dnl NOTE the test case below fail for pthreads-w32 as:
+ dnl - SEM_FAILED is not defined;
+ dnl - sem_open is a stub;
+ dnl - sem_getvalue work(!).
+ ac_cv_broken_sem_getvalue=skip
+fi
AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <unistd.h>
diff -Naur Python-2.7.9-orig/pyconfig.h.in Python-2.7.9/pyconfig.h.in
--- Python-2.7.9-orig/pyconfig.h.in 2014-12-10 19:00:01.000000000 +0300
+++ Python-2.7.9/pyconfig.h.in 2014-12-11 13:49:29.658200000 +0300
@@ -936,6 +936,9 @@
/* Define if mvwdelch in curses.h is an expression. */
#undef MVWDELCH_IS_EXPRESSION
+/* Define to 1 if you want to use native NT threads */
+#undef NT_THREADS
+
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT