Cross-Platform build scripts for audio plugins
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
7.0KB

  1. diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac
  2. --- Python-3.8.0-orig/configure.ac 2019-10-22 10:00:29.329088100 +0300
  3. +++ Python-3.8.0/configure.ac 2019-10-22 10:00:31.778292400 +0300
  4. @@ -1960,6 +1960,46 @@
  5. BASECFLAGS="$BASECFLAGS $ac_arch_flags"
  6. fi
  7. +dnl NOTE:
  8. +dnl - GCC 4.4+ for mingw* require and use posix threads(pthreads-w32)
  9. +dnl - Host may contain installed pthreads-w32.
  10. +dnl - On windows platform only NT-thread model is supported.
  11. +dnl To avoid miss detection scipt first will check for NT-thread model
  12. +dnl and if is not found will try to detect build options for pthread
  13. +dnl model. Autodetection could be overiden if variable with_nt_threads
  14. +dnl is set in "Site Configuration" (see autoconf manual).
  15. +dnl If NT-thread model is enabled script skips some checks that
  16. +dnl impact build process. When a new functionality is added, developers
  17. +dnl are responsible to update configure script to avoid thread models
  18. +dnl to be mixed.
  19. +
  20. +AC_MSG_CHECKING([for NT threads])
  21. +AC_ARG_WITH(nt-threads,
  22. + AS_HELP_STRING([--with-nt-threads], [build with windows threads]),
  23. +[
  24. + case $withval in
  25. + no) with_nt_threads=no;;
  26. + yes) with_nt_threads=yes;;
  27. + *) with_nt_threads=yes;;
  28. + esac], [
  29. + with_nt_threads=no])
  30. +if test $with_nt_threads = yes ; then
  31. +AC_LINK_IFELSE([
  32. + AC_LANG_PROGRAM([[]],[[_beginthread(0, 0, 0);]])
  33. + ],
  34. + [with_nt_threads=yes],
  35. + [with_nt_threads=no])
  36. +fi
  37. +AC_MSG_RESULT([$with_nt_threads])
  38. +
  39. +if test $with_nt_threads = yes ; then
  40. + dnl temporary default flag to avoid additional pthread checks
  41. + dnl and initilize other ac..thread flags to no
  42. + ac_cv_pthread_is_default=no
  43. + ac_cv_kthread=no
  44. + ac_cv_pthread=no
  45. + dnl ac_cv_kpthread is set to no if default is yes (see below)
  46. +else
  47. # On some compilers, pthreads are available without further options
  48. # (e.g. MacOS X). On some of these systems, the compiler will not
  49. # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
  50. @@ -2078,6 +2118,8 @@
  51. AC_MSG_RESULT($ac_cv_pthread)
  52. fi
  53. +fi
  54. +
  55. # If we have set a CC compiler flag for thread support then
  56. # check if it works for CXX, too.
  57. ac_cv_cxx_thread=no
  58. @@ -2098,6 +2140,10 @@
  59. then
  60. CXX="$CXX -pthread"
  61. ac_cv_cxx_thread=yes
  62. +elif test $with_nt_threads = yes
  63. +then
  64. + dnl set to always to skip extra pthread check below
  65. + ac_cv_cxx_thread=always
  66. fi
  67. if test $ac_cv_cxx_thread = yes
  68. @@ -2130,8 +2176,8 @@
  69. AC_HEADER_STDC
  70. AC_CHECK_HEADERS(asm/types.h crypt.h conio.h direct.h dlfcn.h errno.h \
  71. fcntl.h grp.h \
  72. -ieeefp.h io.h langinfo.h libintl.h process.h pthread.h \
  73. -sched.h shadow.h signal.h stropts.h termios.h \
  74. +ieeefp.h io.h langinfo.h libintl.h process.h \
  75. +shadow.h signal.h stropts.h termios.h \
  76. utime.h \
  77. poll.h sys/devpoll.h sys/epoll.h sys/poll.h \
  78. sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h \
  79. @@ -2145,6 +2191,14 @@
  80. AC_HEADER_DIRENT
  81. AC_HEADER_MAJOR
  82. +# If using nt threads, don't look for pthread.h or thread.h
  83. +if test "x$with_nt_threads" = xno ; then
  84. +AC_HEADER_STDC
  85. +AC_CHECK_HEADERS(pthread.h sched.h thread.h)
  86. +AC_HEADER_DIRENT
  87. +AC_HEADER_MAJOR
  88. +fi
  89. +
  90. # bluetooth/bluetooth.h has been known to not compile with -std=c99.
  91. # http://permalink.gmane.org/gmane.linux.bluez.kernel/22294
  92. SAVE_CFLAGS=$CFLAGS
  93. @@ -2342,6 +2396,10 @@
  94. AC_MSG_CHECKING(for pthread_t)
  95. have_pthread_t=no
  96. +if test $with_nt_threads = yes ; then
  97. + dnl skip check for pthread_t if NT-thread model is enabled
  98. + have_pthread_t=skip
  99. +else
  100. AC_COMPILE_IFELSE([
  101. AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]])
  102. ],[have_pthread_t=yes],[])
  103. @@ -2372,6 +2430,7 @@
  104. else
  105. AC_MSG_RESULT(no)
  106. fi
  107. +fi
  108. CC="$ac_save_cc"
  109. AC_SUBST(OTHER_LIBTOOL_OPT)
  110. @@ -2814,10 +2873,15 @@
  111. [AC_MSG_RESULT(no)]
  112. )
  113. +if test $with_nt_threads = yes ; then
  114. + dnl do not search for sem_init if NT-thread model is enabled
  115. + :
  116. +else
  117. # 'Real Time' functions on Solaris
  118. # posix4 on Solaris 2.6
  119. # pthread (first!) on Linux
  120. AC_SEARCH_LIBS(sem_init, pthread rt posix4)
  121. +fi
  122. # check if we need libintl for locale functions
  123. AC_CHECK_LIB(intl, textdomain,
  124. @@ -3087,6 +3151,11 @@
  125. CXX="$CXX -pthread"
  126. fi
  127. posix_threads=yes
  128. +elif test $with_nt_threads = yes
  129. +then
  130. + posix_threads=no
  131. + AC_DEFINE(NT_THREADS, 1,
  132. + [Define to 1 if you want to use native NT threads])
  133. else
  134. if test ! -z "$withval" -a -d "$withval"
  135. then LDFLAGS="$LDFLAGS -L$withval"
  136. @@ -3538,6 +3607,15 @@
  137. fi
  138. # checks for library functions
  139. +if test $with_nt_threads = yes ; then
  140. + dnl GCC(mingw) 4.4+ require and use posix threads(pthreads-w32)
  141. + dnl and host may contain installed pthreads-w32.
  142. + dnl Skip checks for some functions declared in pthreads-w32 if
  143. + dnl NT-thread model is enabled.
  144. + ac_cv_func_pthread_kill=skip
  145. + ac_cv_func_sem_open=skip
  146. + ac_cv_func_sched_setscheduler=skip
  147. +fi
  148. AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
  149. clock confstr copy_file_range ctermid dup3 execv explicit_bzero explicit_memset \
  150. faccessat fchmod fchmodat fchown fchownat \
  151. @@ -4462,6 +4540,10 @@
  152. # the kernel module that provides POSIX semaphores
  153. # isn't loaded by default, so an attempt to call
  154. # sem_open results in a 'Signal 12' error.
  155. +if test $with_nt_threads = yes ; then
  156. + dnl skip posix semaphores test if NT-thread model is enabled
  157. + ac_cv_posix_semaphores_enabled=no
  158. +fi
  159. AC_MSG_CHECKING(whether POSIX semaphores are enabled)
  160. AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
  161. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  162. @@ -4495,6 +4577,14 @@
  163. # Multiprocessing check for broken sem_getvalue
  164. AC_MSG_CHECKING(for broken sem_getvalue)
  165. +if test $with_nt_threads = yes ; then
  166. + dnl Skip test if NT-thread model is enabled.
  167. + dnl NOTE the test case below fail for pthreads-w32 as:
  168. + dnl - SEM_FAILED is not defined;
  169. + dnl - sem_open is a stub;
  170. + dnl - sem_getvalue work(!).
  171. + ac_cv_broken_sem_getvalue=skip
  172. +fi
  173. AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
  174. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  175. #include <unistd.h>
  176. diff -Naur Python-3.8.0-orig/Modules/_multiprocessing/multiprocessing.h Python-3.8.0/Modules/_multiprocessing/multiprocessing.h
  177. --- Python-3.8.0-orig/Modules/_multiprocessing/multiprocessing.h 2019-10-14 16:34:47.000000000 +0300
  178. +++ Python-3.8.0/Modules/_multiprocessing/multiprocessing.h 2019-10-22 10:00:32.168293100 +0300
  179. @@ -21,6 +21,9 @@
  180. # endif
  181. # define SEM_HANDLE HANDLE
  182. # define SEM_VALUE_MAX LONG_MAX
  183. +# if defined(HAVE_SEM_OPEN) && defined(_POSIX_THREADS)
  184. +# include <semaphore.h>
  185. +# endif
  186. #else
  187. # include <fcntl.h> /* O_CREAT and O_EXCL */
  188. # if defined(HAVE_SEM_OPEN) && !defined(POSIX_SEMAPHORES_NOT_ENABLED)
  189. diff -Naur Python-3.8.0-orig/pyconfig.h.in Python-3.8.0/pyconfig.h.in
  190. --- Python-3.8.0-orig/pyconfig.h.in 2019-10-14 16:34:47.000000000 +0300
  191. +++ Python-3.8.0/pyconfig.h.in 2019-10-22 10:00:32.558293800 +0300
  192. @@ -1352,6 +1352,9 @@
  193. /* Define if mvwdelch in curses.h is an expression. */
  194. #undef MVWDELCH_IS_EXPRESSION
  195. +/* Define to 1 if you want to use native NT threads */
  196. +#undef NT_THREADS
  197. +
  198. /* Define to the address where bug reports for this package should be sent. */
  199. #undef PACKAGE_BUGREPORT