summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/Setup.stdlib.in1
-rwxr-xr-xconfigure188
-rw-r--r--configure.ac135
-rw-r--r--setup.py18
4 files changed, 183 insertions, 159 deletions
diff --git a/Modules/Setup.stdlib.in b/Modules/Setup.stdlib.in
index 0329540..9dfe918 100644
--- a/Modules/Setup.stdlib.in
+++ b/Modules/Setup.stdlib.in
@@ -124,6 +124,7 @@
# multiprocessing
@MODULE__POSIXSHMEM_TRUE@_posixshmem _multiprocessing/posixshmem.c
+@MODULE__MULTIPROCESSING_TRUE@_multiprocessing _multiprocessing/multiprocessing.c _multiprocessing/semaphore.c
############################################################################
diff --git a/configure b/configure
index 9580072..32aed7e 100755
--- a/configure
+++ b/configure
@@ -712,8 +712,6 @@ MODULE_OSSAUDIODEV_FALSE
MODULE_OSSAUDIODEV_TRUE
MODULE_GRP_FALSE
MODULE_GRP_TRUE
-MODULE__POSIXSHMEM_FALSE
-MODULE__POSIXSHMEM_TRUE
MODULE_MMAP_FALSE
MODULE_MMAP_TRUE
MODULE_FCNTL_FALSE
@@ -728,6 +726,10 @@ MODULE__STATISTICS_FALSE
MODULE__STATISTICS_TRUE
MODULE_AUDIOOP_FALSE
MODULE_AUDIOOP_TRUE
+MODULE__POSIXSHMEM_FALSE
+MODULE__POSIXSHMEM_TRUE
+MODULE__MULTIPROCESSING_FALSE
+MODULE__MULTIPROCESSING_TRUE
MODULE__ZONEINFO_FALSE
MODULE__ZONEINFO_TRUE
MODULE__XXSUBINTERPRETERS_FALSE
@@ -17647,11 +17649,6 @@ done
LIBS=$LIBS_SAVE
-# For multiprocessing module, check that sem_open
-# actually works. For FreeBSD versions <= 7.2,
-# 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.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX semaphores are enabled" >&5
$as_echo_n "checking whether POSIX semaphores are enabled... " >&6; }
if ${ac_cv_posix_semaphores_enabled+:} false; then :
@@ -17663,22 +17660,24 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <semaphore.h>
-#include <sys/stat.h>
-int main(void) {
- sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
- if (a == SEM_FAILED) {
- perror("sem_open");
- return 1;
- }
- sem_close(a);
- sem_unlink("/autoconf");
- return 0;
-}
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+ #include <semaphore.h>
+ #include <sys/stat.h>
+
+ int main(void) {
+ sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
+ if (a == SEM_FAILED) {
+ perror("sem_open");
+ return 1;
+ }
+ sem_close(a);
+ sem_unlink("/autoconf");
+ return 0;
+ }
+
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
@@ -17694,14 +17693,14 @@ fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_posix_semaphores_enabled" >&5
$as_echo "$ac_cv_posix_semaphores_enabled" >&6; }
-if test $ac_cv_posix_semaphores_enabled = no
-then
+if test "x$ac_cv_posix_semaphores_enabled" = xno; then :
+
$as_echo "#define POSIX_SEMAPHORES_NOT_ENABLED 1" >>confdefs.h
+
fi
-# Multiprocessing check for broken sem_getvalue
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken sem_getvalue" >&5
$as_echo_n "checking for broken sem_getvalue... " >&6; }
if ${ac_cv_broken_sem_getvalue+:} false; then :
@@ -17713,26 +17712,28 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <semaphore.h>
-#include <sys/stat.h>
-int main(void){
- sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
- int count;
- int res;
- if(a==SEM_FAILED){
- perror("sem_open");
- return 1;
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+ #include <semaphore.h>
+ #include <sys/stat.h>
+
+ int main(void){
+ sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
+ int count;
+ int res;
+ if(a==SEM_FAILED){
+ perror("sem_open");
+ return 1;
+
+ }
+ res = sem_getvalue(a, &count);
+ sem_close(a);
+ sem_unlink("/autocftw");
+ return res==-1 ? 1 : 0;
+ }
- }
- res = sem_getvalue(a, &count);
- sem_close(a);
- sem_unlink("/autocftw");
- return res==-1 ? 1 : 0;
-}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
@@ -17748,11 +17749,12 @@ fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_broken_sem_getvalue" >&5
$as_echo "$ac_cv_broken_sem_getvalue" >&6; }
-if test $ac_cv_broken_sem_getvalue = yes
-then
+if test "x$ac_cv_broken_sem_getvalue" = xyes; then :
+
$as_echo "#define HAVE_BROKEN_SEM_GETVALUE 1" >>confdefs.h
+
fi
ac_fn_c_check_decl "$LINENO" "RTLD_LAZY" "ac_cv_have_decl_RTLD_LAZY" "#include <dlfcn.h>
@@ -21263,6 +21265,54 @@ fi
if true; then
+ MODULE__MULTIPROCESSING_TRUE=
+ MODULE__MULTIPROCESSING_FALSE='#'
+else
+ MODULE__MULTIPROCESSING_TRUE='#'
+ MODULE__MULTIPROCESSING_FALSE=
+fi
+ as_fn_append MODULE_BLOCK "MODULE__MULTIPROCESSING=yes$as_nl"
+ as_fn_append MODULE_BLOCK "MODULE__MULTIPROCESSING_CFLAGS=-I\$(srcdir)/Modules/_multiprocessing$as_nl"
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _posixshmem" >&5
+$as_echo_n "checking for stdlib extension module _posixshmem... " >&6; }
+ case $py_stdlib_not_available in #(
+ *_posixshmem*) :
+ py_cv_module__posixshmem=n/a ;; #(
+ *) :
+ if true; then :
+ if test "$have_posix_shmem" = "yes"; then :
+ py_cv_module__posixshmem=yes
+else
+ py_cv_module__posixshmem=missing
+fi
+else
+ py_cv_module__posixshmem=disabled
+fi
+ ;;
+esac
+ as_fn_append MODULE_BLOCK "MODULE__POSIXSHMEM=$py_cv_module__posixshmem$as_nl"
+ if test "x$py_cv_module__posixshmem" = xyes; then :
+
+ as_fn_append MODULE_BLOCK "MODULE__POSIXSHMEM_CFLAGS=$POSIXSHMEM_CFLAGS$as_nl"
+ as_fn_append MODULE_BLOCK "MODULE__POSIXSHMEM_LDFLAGS=$POSIXSHMEM_LIBS$as_nl"
+
+fi
+ if test "$py_cv_module__posixshmem" = yes; then
+ MODULE__POSIXSHMEM_TRUE=
+ MODULE__POSIXSHMEM_FALSE='#'
+else
+ MODULE__POSIXSHMEM_TRUE='#'
+ MODULE__POSIXSHMEM_FALSE=
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__posixshmem" >&5
+$as_echo "$py_cv_module__posixshmem" >&6; }
+
+
+
+ if true; then
MODULE_AUDIOOP_TRUE=
MODULE_AUDIOOP_FALSE='#'
else
@@ -21391,42 +21441,6 @@ fi
$as_echo "$py_cv_module_mmap" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _posixshmem" >&5
-$as_echo_n "checking for stdlib extension module _posixshmem... " >&6; }
- case $py_stdlib_not_available in #(
- *_posixshmem*) :
- py_cv_module__posixshmem=n/a ;; #(
- *) :
- if true; then :
- if test "$have_posix_shmem" = "yes"; then :
- py_cv_module__posixshmem=yes
-else
- py_cv_module__posixshmem=missing
-fi
-else
- py_cv_module__posixshmem=disabled
-fi
- ;;
-esac
- as_fn_append MODULE_BLOCK "MODULE__POSIXSHMEM=$py_cv_module__posixshmem$as_nl"
- if test "x$py_cv_module__posixshmem" = xyes; then :
-
- as_fn_append MODULE_BLOCK "MODULE__POSIXSHMEM_CFLAGS=$POSIXSHMEM_CFLAGS$as_nl"
- as_fn_append MODULE_BLOCK "MODULE__POSIXSHMEM_LDFLAGS=$POSIXSHMEM_LIBS$as_nl"
-
-fi
- if test "$py_cv_module__posixshmem" = yes; then
- MODULE__POSIXSHMEM_TRUE=
- MODULE__POSIXSHMEM_FALSE='#'
-else
- MODULE__POSIXSHMEM_TRUE='#'
- MODULE__POSIXSHMEM_FALSE=
-fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__posixshmem" >&5
-$as_echo "$py_cv_module__posixshmem" >&6; }
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module grp" >&5
$as_echo_n "checking for stdlib extension module grp... " >&6; }
@@ -22984,6 +22998,14 @@ if test -z "${MODULE__ZONEINFO_TRUE}" && test -z "${MODULE__ZONEINFO_FALSE}"; th
as_fn_error $? "conditional \"MODULE__ZONEINFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${MODULE__MULTIPROCESSING_TRUE}" && test -z "${MODULE__MULTIPROCESSING_FALSE}"; then
+ as_fn_error $? "conditional \"MODULE__MULTIPROCESSING\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${MODULE__POSIXSHMEM_TRUE}" && test -z "${MODULE__POSIXSHMEM_FALSE}"; then
+ as_fn_error $? "conditional \"MODULE__POSIXSHMEM\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MODULE_AUDIOOP_TRUE}" && test -z "${MODULE_AUDIOOP_FALSE}"; then
as_fn_error $? "conditional \"MODULE_AUDIOOP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -23012,10 +23034,6 @@ if test -z "${MODULE_MMAP_TRUE}" && test -z "${MODULE_MMAP_FALSE}"; then
as_fn_error $? "conditional \"MODULE_MMAP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${MODULE__POSIXSHMEM_TRUE}" && test -z "${MODULE__POSIXSHMEM_FALSE}"; then
- as_fn_error $? "conditional \"MODULE__POSIXSHMEM\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
if test -z "${MODULE_GRP_TRUE}" && test -z "${MODULE_GRP_FALSE}"; then
as_fn_error $? "conditional \"MODULE_GRP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/configure.ac b/configure.ac
index 0fce3f6..ec71470 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4832,73 +4832,79 @@ AC_CHECK_FUNCS(
)
LIBS=$LIBS_SAVE
-# For multiprocessing module, check that sem_open
-# actually works. For FreeBSD versions <= 7.2,
-# 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.
+dnl For multiprocessing module, check that sem_open
+dnl actually works. For FreeBSD versions <= 7.2,
+dnl the kernel module that provides POSIX semaphores
+dnl isn't loaded by default, so an attempt to call
+dnl sem_open results in a 'Signal 12' error.
AC_CACHE_CHECK([whether POSIX semaphores are enabled], [ac_cv_posix_semaphores_enabled],
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <semaphore.h>
-#include <sys/stat.h>
-
-int main(void) {
- sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
- if (a == SEM_FAILED) {
- perror("sem_open");
- return 1;
- }
- sem_close(a);
- sem_unlink("/autoconf");
- return 0;
-}
-]])],
-[ac_cv_posix_semaphores_enabled=yes],
-[ac_cv_posix_semaphores_enabled=no],
-[ac_cv_posix_semaphores_enabled=yes])
+ AC_RUN_IFELSE([
+ AC_LANG_SOURCE([
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+ #include <semaphore.h>
+ #include <sys/stat.h>
+
+ int main(void) {
+ sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
+ if (a == SEM_FAILED) {
+ perror("sem_open");
+ return 1;
+ }
+ sem_close(a);
+ sem_unlink("/autoconf");
+ return 0;
+ }
+ ])
+ ],
+ [ac_cv_posix_semaphores_enabled=yes],
+ [ac_cv_posix_semaphores_enabled=no],
+ [ac_cv_posix_semaphores_enabled=yes])
)
-if test $ac_cv_posix_semaphores_enabled = no
-then
- AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
- [Define if POSIX semaphores aren't enabled on your system])
-fi
+AS_VAR_IF([ac_cv_posix_semaphores_enabled], [no], [
+ AC_DEFINE(
+ [POSIX_SEMAPHORES_NOT_ENABLED], [1],
+ [Define if POSIX semaphores aren't enabled on your system]
+ )
+])
-# Multiprocessing check for broken sem_getvalue
+dnl Multiprocessing check for broken sem_getvalue
AC_CACHE_CHECK([for broken sem_getvalue], [ac_cv_broken_sem_getvalue],
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <semaphore.h>
-#include <sys/stat.h>
+ AC_RUN_IFELSE([
+ AC_LANG_SOURCE([
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+ #include <semaphore.h>
+ #include <sys/stat.h>
-int main(void){
- sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
- int count;
- int res;
- if(a==SEM_FAILED){
- perror("sem_open");
- return 1;
+ int main(void){
+ sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
+ int count;
+ int res;
+ if(a==SEM_FAILED){
+ perror("sem_open");
+ return 1;
- }
- res = sem_getvalue(a, &count);
- sem_close(a);
- sem_unlink("/autocftw");
- return res==-1 ? 1 : 0;
-}
-]])],
-[ac_cv_broken_sem_getvalue=no],
-[ac_cv_broken_sem_getvalue=yes],
-[ac_cv_broken_sem_getvalue=yes])
+ }
+ res = sem_getvalue(a, &count);
+ sem_close(a);
+ sem_unlink("/autocftw");
+ return res==-1 ? 1 : 0;
+ }
+ ])
+ ],
+ [ac_cv_broken_sem_getvalue=no],
+ [ac_cv_broken_sem_getvalue=yes],
+ [ac_cv_broken_sem_getvalue=yes])
)
-if test $ac_cv_broken_sem_getvalue = yes
-then
- AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
- [define to 1 if your sem_getvalue is broken.])
-fi
+AS_VAR_IF([ac_cv_broken_sem_getvalue], [yes], [
+ AC_DEFINE(
+ [HAVE_BROKEN_SEM_GETVALUE], [1],
+ [define to 1 if your sem_getvalue is broken.]
+ )
+])
AC_CHECK_DECLS([RTLD_LAZY, RTLD_NOW, RTLD_GLOBAL, RTLD_LOCAL, RTLD_NODELETE, RTLD_NOLOAD, RTLD_DEEPBIND, RTLD_MEMBER], [], [], [[#include <dlfcn.h>]])
@@ -6272,6 +6278,12 @@ PY_STDLIB_MOD_SIMPLE([_typing])
PY_STDLIB_MOD_SIMPLE([_xxsubinterpreters])
PY_STDLIB_MOD_SIMPLE([_zoneinfo])
+dnl multiprocessing modules
+PY_STDLIB_MOD_SIMPLE([_multiprocessing], [-I\$(srcdir)/Modules/_multiprocessing])
+PY_STDLIB_MOD([_posixshmem],
+ [], [test "$have_posix_shmem" = "yes"],
+ [$POSIXSHMEM_CFLAGS], [$POSIXSHMEM_LIBS])
+
dnl needs libm
PY_STDLIB_MOD_SIMPLE([audioop], [], [$LIBM])
PY_STDLIB_MOD_SIMPLE([_statistics], [], [$LIBM])
@@ -6287,9 +6299,6 @@ PY_STDLIB_MOD([fcntl],
[], [$FCNTL_LIBS])
PY_STDLIB_MOD([mmap],
[], [test "$ac_cv_header_sys_mman_h" = "yes" -a "$ac_cv_header_sys_stat_h" = "yes"])
-PY_STDLIB_MOD([_posixshmem],
- [], [test "$have_posix_shmem" = "yes"],
- [$POSIXSHMEM_CFLAGS], [$POSIXSHMEM_LIBS])
dnl platform specific extensions
PY_STDLIB_MOD([grp], [], [test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes])
diff --git a/setup.py b/setup.py
index 79f8f4e..572f2ac 100644
--- a/setup.py
+++ b/setup.py
@@ -1388,17 +1388,13 @@ class PyBuildExt(build_ext):
def detect_multiprocessing(self):
# Richard Oudkerk's multiprocessing module
- if MS_WINDOWS:
- multiprocessing_srcs = ['_multiprocessing/multiprocessing.c',
- '_multiprocessing/semaphore.c']
- else:
- multiprocessing_srcs = ['_multiprocessing/multiprocessing.c']
- if (sysconfig.get_config_var('HAVE_SEM_OPEN') and not
- sysconfig.get_config_var('POSIX_SEMAPHORES_NOT_ENABLED')):
- multiprocessing_srcs.append('_multiprocessing/semaphore.c')
- self.add(Extension('_multiprocessing', multiprocessing_srcs,
- include_dirs=["Modules/_multiprocessing"]))
-
+ multiprocessing_srcs = ['_multiprocessing/multiprocessing.c']
+ if (
+ sysconfig.get_config_var('HAVE_SEM_OPEN') and not
+ sysconfig.get_config_var('POSIX_SEMAPHORES_NOT_ENABLED')
+ ):
+ multiprocessing_srcs.append('_multiprocessing/semaphore.c')
+ self.addext(Extension('_multiprocessing', multiprocessing_srcs))
self.addext(Extension('_posixshmem', ['_multiprocessing/posixshmem.c']))
def detect_uuid(self):