Skip to content

Commit 0af5f50

Browse files
author
Erlend E. Aasland
committed
bpo-45847: Port _multiprocessing to PY_STDLIB_MOD
1 parent 24c10d2 commit 0af5f50

File tree

4 files changed

+183
-163
lines changed

4 files changed

+183
-163
lines changed

Modules/Setup.stdlib.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@
124124

125125
# multiprocessing
126126
@MODULE__POSIXSHMEM_TRUE@_posixshmem _multiprocessing/posixshmem.c
127+
@MODULE__MULTIPROCESSING_TRUE@_multiprocessing _multiprocessing/multiprocessing.c _multiprocessing/semaphore.c
127128

128129

129130
############################################################################

configure

Lines changed: 106 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,6 @@ MODULE_OSSAUDIODEV_FALSE
712712
MODULE_OSSAUDIODEV_TRUE
713713
MODULE_GRP_FALSE
714714
MODULE_GRP_TRUE
715-
MODULE__POSIXSHMEM_FALSE
716-
MODULE__POSIXSHMEM_TRUE
717715
MODULE_MMAP_FALSE
718716
MODULE_MMAP_TRUE
719717
MODULE_FCNTL_FALSE
@@ -728,6 +726,10 @@ MODULE__STATISTICS_FALSE
728726
MODULE__STATISTICS_TRUE
729727
MODULE_AUDIOOP_FALSE
730728
MODULE_AUDIOOP_TRUE
729+
MODULE__POSIXSHMEM_FALSE
730+
MODULE__POSIXSHMEM_TRUE
731+
MODULE__MULTIPROCESSING_FALSE
732+
MODULE__MULTIPROCESSING_TRUE
731733
MODULE__ZONEINFO_FALSE
732734
MODULE__ZONEINFO_TRUE
733735
MODULE__XXSUBINTERPRETERS_FALSE
@@ -10382,6 +10384,9 @@ fi
1038210384
# Dynamic linking for HP-UX
1038310385

1038410386

10387+
10388+
10389+
1038510390
have_uuid=missing
1038610391

1038710392
for ac_header in uuid.h
@@ -10414,10 +10419,6 @@ fi
1041410419
done
1041510420

1041610421

10417-
10418-
10419-
10420-
1042110422
if test "x$have_uuid" = xmissing; then :
1042210423

1042310424

@@ -17601,11 +17602,6 @@ done
1760117602

1760217603
LIBS=$LIBS_SAVE
1760317604

17604-
# For multiprocessing module, check that sem_open
17605-
# actually works. For FreeBSD versions <= 7.2,
17606-
# the kernel module that provides POSIX semaphores
17607-
# isn't loaded by default, so an attempt to call
17608-
# sem_open results in a 'Signal 12' error.
1760917605
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX semaphores are enabled" >&5
1761017606
$as_echo_n "checking whether POSIX semaphores are enabled... " >&6; }
1761117607
if ${ac_cv_posix_semaphores_enabled+:} false; then :
@@ -17617,22 +17613,24 @@ else
1761717613
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1761817614
/* end confdefs.h. */
1761917615

17620-
#include <unistd.h>
17621-
#include <fcntl.h>
17622-
#include <stdio.h>
17623-
#include <semaphore.h>
17624-
#include <sys/stat.h>
1762517616

17626-
int main(void) {
17627-
sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
17628-
if (a == SEM_FAILED) {
17629-
perror("sem_open");
17630-
return 1;
17631-
}
17632-
sem_close(a);
17633-
sem_unlink("/autoconf");
17634-
return 0;
17635-
}
17617+
#include <unistd.h>
17618+
#include <fcntl.h>
17619+
#include <stdio.h>
17620+
#include <semaphore.h>
17621+
#include <sys/stat.h>
17622+
17623+
int main(void) {
17624+
sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
17625+
if (a == SEM_FAILED) {
17626+
perror("sem_open");
17627+
return 1;
17628+
}
17629+
sem_close(a);
17630+
sem_unlink("/autoconf");
17631+
return 0;
17632+
}
17633+
1763617634

1763717635
_ACEOF
1763817636
if ac_fn_c_try_run "$LINENO"; then :
@@ -17648,14 +17646,14 @@ fi
1764817646
fi
1764917647
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_posix_semaphores_enabled" >&5
1765017648
$as_echo "$ac_cv_posix_semaphores_enabled" >&6; }
17651-
if test $ac_cv_posix_semaphores_enabled = no
17652-
then
17649+
if test "x$ac_cv_posix_semaphores_enabled" = xno; then :
17650+
1765317651

1765417652
$as_echo "#define POSIX_SEMAPHORES_NOT_ENABLED 1" >>confdefs.h
1765517653

17654+
1765617655
fi
1765717656

17658-
# Multiprocessing check for broken sem_getvalue
1765917657
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken sem_getvalue" >&5
1766017658
$as_echo_n "checking for broken sem_getvalue... " >&6; }
1766117659
if ${ac_cv_broken_sem_getvalue+:} false; then :
@@ -17667,26 +17665,28 @@ else
1766717665
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1766817666
/* end confdefs.h. */
1766917667

17670-
#include <unistd.h>
17671-
#include <fcntl.h>
17672-
#include <stdio.h>
17673-
#include <semaphore.h>
17674-
#include <sys/stat.h>
1767517668

17676-
int main(void){
17677-
sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
17678-
int count;
17679-
int res;
17680-
if(a==SEM_FAILED){
17681-
perror("sem_open");
17682-
return 1;
17669+
#include <unistd.h>
17670+
#include <fcntl.h>
17671+
#include <stdio.h>
17672+
#include <semaphore.h>
17673+
#include <sys/stat.h>
17674+
17675+
int main(void){
17676+
sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
17677+
int count;
17678+
int res;
17679+
if(a==SEM_FAILED){
17680+
perror("sem_open");
17681+
return 1;
17682+
17683+
}
17684+
res = sem_getvalue(a, &count);
17685+
sem_close(a);
17686+
sem_unlink("/autocftw");
17687+
return res==-1 ? 1 : 0;
17688+
}
1768317689

17684-
}
17685-
res = sem_getvalue(a, &count);
17686-
sem_close(a);
17687-
sem_unlink("/autocftw");
17688-
return res==-1 ? 1 : 0;
17689-
}
1769017690

1769117691
_ACEOF
1769217692
if ac_fn_c_try_run "$LINENO"; then :
@@ -17702,11 +17702,12 @@ fi
1770217702
fi
1770317703
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_broken_sem_getvalue" >&5
1770417704
$as_echo "$ac_cv_broken_sem_getvalue" >&6; }
17705-
if test $ac_cv_broken_sem_getvalue = yes
17706-
then
17705+
if test "x$ac_cv_broken_sem_getvalue" = xyes; then :
17706+
1770717707

1770817708
$as_echo "#define HAVE_BROKEN_SEM_GETVALUE 1" >>confdefs.h
1770917709

17710+
1771017711
fi
1771117712

1771217713
ac_fn_c_check_decl "$LINENO" "RTLD_LAZY" "ac_cv_have_decl_RTLD_LAZY" "#include <dlfcn.h>
@@ -21207,6 +21208,54 @@ fi
2120721208
as_fn_append MODULE_BLOCK "MODULE__ZONEINFO=yes$as_nl"
2120821209

2120921210

21211+
if true; then
21212+
MODULE__MULTIPROCESSING_TRUE=
21213+
MODULE__MULTIPROCESSING_FALSE='#'
21214+
else
21215+
MODULE__MULTIPROCESSING_TRUE='#'
21216+
MODULE__MULTIPROCESSING_FALSE=
21217+
fi
21218+
as_fn_append MODULE_BLOCK "MODULE__MULTIPROCESSING=yes$as_nl"
21219+
as_fn_append MODULE_BLOCK "MODULE__MULTIPROCESSING_CFLAGS=-I\$(srcdir)/Modules/_multiprocessing$as_nl"
21220+
21221+
21222+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _posixshmem" >&5
21223+
$as_echo_n "checking for stdlib extension module _posixshmem... " >&6; }
21224+
case $py_stdlib_not_available in #(
21225+
*_posixshmem*) :
21226+
py_cv_module__posixshmem=n/a ;; #(
21227+
*) :
21228+
if true; then :
21229+
if test "$have_posix_shmem" = "yes"; then :
21230+
py_cv_module__posixshmem=yes
21231+
else
21232+
py_cv_module__posixshmem=missing
21233+
fi
21234+
else
21235+
py_cv_module__posixshmem=disabled
21236+
fi
21237+
;;
21238+
esac
21239+
as_fn_append MODULE_BLOCK "MODULE__POSIXSHMEM=$py_cv_module__posixshmem$as_nl"
21240+
if test "x$py_cv_module__posixshmem" = xyes; then :
21241+
21242+
as_fn_append MODULE_BLOCK "MODULE__POSIXSHMEM_CFLAGS=$POSIXSHMEM_CFLAGS$as_nl"
21243+
as_fn_append MODULE_BLOCK "MODULE__POSIXSHMEM_LDFLAGS=$POSIXSHMEM_LIBS$as_nl"
21244+
21245+
fi
21246+
if test "$py_cv_module__posixshmem" = yes; then
21247+
MODULE__POSIXSHMEM_TRUE=
21248+
MODULE__POSIXSHMEM_FALSE='#'
21249+
else
21250+
MODULE__POSIXSHMEM_TRUE='#'
21251+
MODULE__POSIXSHMEM_FALSE=
21252+
fi
21253+
21254+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__posixshmem" >&5
21255+
$as_echo "$py_cv_module__posixshmem" >&6; }
21256+
21257+
21258+
2121021259
if true; then
2121121260
MODULE_AUDIOOP_TRUE=
2121221261
MODULE_AUDIOOP_FALSE='#'
@@ -21336,42 +21385,6 @@ fi
2133621385
$as_echo "$py_cv_module_mmap" >&6; }
2133721386

2133821387

21339-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _posixshmem" >&5
21340-
$as_echo_n "checking for stdlib extension module _posixshmem... " >&6; }
21341-
case $py_stdlib_not_available in #(
21342-
*_posixshmem*) :
21343-
py_cv_module__posixshmem=n/a ;; #(
21344-
*) :
21345-
if true; then :
21346-
if test "$have_posix_shmem" = "yes"; then :
21347-
py_cv_module__posixshmem=yes
21348-
else
21349-
py_cv_module__posixshmem=missing
21350-
fi
21351-
else
21352-
py_cv_module__posixshmem=disabled
21353-
fi
21354-
;;
21355-
esac
21356-
as_fn_append MODULE_BLOCK "MODULE__POSIXSHMEM=$py_cv_module__posixshmem$as_nl"
21357-
if test "x$py_cv_module__posixshmem" = xyes; then :
21358-
21359-
as_fn_append MODULE_BLOCK "MODULE__POSIXSHMEM_CFLAGS=$POSIXSHMEM_CFLAGS$as_nl"
21360-
as_fn_append MODULE_BLOCK "MODULE__POSIXSHMEM_LDFLAGS=$POSIXSHMEM_LIBS$as_nl"
21361-
21362-
fi
21363-
if test "$py_cv_module__posixshmem" = yes; then
21364-
MODULE__POSIXSHMEM_TRUE=
21365-
MODULE__POSIXSHMEM_FALSE='#'
21366-
else
21367-
MODULE__POSIXSHMEM_TRUE='#'
21368-
MODULE__POSIXSHMEM_FALSE=
21369-
fi
21370-
21371-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__posixshmem" >&5
21372-
$as_echo "$py_cv_module__posixshmem" >&6; }
21373-
21374-
2137521388

2137621389
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module grp" >&5
2137721390
$as_echo_n "checking for stdlib extension module grp... " >&6; }
@@ -22929,6 +22942,14 @@ if test -z "${MODULE__ZONEINFO_TRUE}" && test -z "${MODULE__ZONEINFO_FALSE}"; th
2292922942
as_fn_error $? "conditional \"MODULE__ZONEINFO\" was never defined.
2293022943
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2293122944
fi
22945+
if test -z "${MODULE__MULTIPROCESSING_TRUE}" && test -z "${MODULE__MULTIPROCESSING_FALSE}"; then
22946+
as_fn_error $? "conditional \"MODULE__MULTIPROCESSING\" was never defined.
22947+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
22948+
fi
22949+
if test -z "${MODULE__POSIXSHMEM_TRUE}" && test -z "${MODULE__POSIXSHMEM_FALSE}"; then
22950+
as_fn_error $? "conditional \"MODULE__POSIXSHMEM\" was never defined.
22951+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
22952+
fi
2293222953
if test -z "${MODULE_AUDIOOP_TRUE}" && test -z "${MODULE_AUDIOOP_FALSE}"; then
2293322954
as_fn_error $? "conditional \"MODULE_AUDIOOP\" was never defined.
2293422955
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -22957,10 +22978,6 @@ if test -z "${MODULE_MMAP_TRUE}" && test -z "${MODULE_MMAP_FALSE}"; then
2295722978
as_fn_error $? "conditional \"MODULE_MMAP\" was never defined.
2295822979
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2295922980
fi
22960-
if test -z "${MODULE__POSIXSHMEM_TRUE}" && test -z "${MODULE__POSIXSHMEM_FALSE}"; then
22961-
as_fn_error $? "conditional \"MODULE__POSIXSHMEM\" was never defined.
22962-
Usually this means the macro was only invoked conditionally." "$LINENO" 5
22963-
fi
2296422981
if test -z "${MODULE_GRP_TRUE}" && test -z "${MODULE_GRP_FALSE}"; then
2296522982
as_fn_error $? "conditional \"MODULE_GRP\" was never defined.
2296622983
Usually this means the macro was only invoked conditionally." "$LINENO" 5

0 commit comments

Comments
 (0)