mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
bpo-35903: Use autoconfig to probe for shm_open() and shm_unlink(). (#11765)
Use autoconfig to probe for shm_open() and shm_unlink(). Set SHM_NEEDS_LIBRT if we must link with librt to get the shm_* functions. Change setup.py to use the autoconfig defines. These changes should make it more likely that _multiprocessing/posixshmem.c gets built correctly on different platforms.
This commit is contained in:
parent
64360ada0f
commit
5741c45acf
4 changed files with 142 additions and 3 deletions
7
setup.py
7
setup.py
|
@ -1592,12 +1592,13 @@ class PyBuildExt(build_ext):
|
|||
if (sysconfig.get_config_var('HAVE_SEM_OPEN') and not
|
||||
sysconfig.get_config_var('POSIX_SEMAPHORES_NOT_ENABLED')):
|
||||
multiprocessing_srcs.append('_multiprocessing/semaphore.c')
|
||||
if (self.compiler.find_library_file(lib_dirs, 'rt') or
|
||||
host_platform != 'cygwin'):
|
||||
if (sysconfig.get_config_var('HAVE_SHM_OPEN') and
|
||||
sysconfig.get_config_var('HAVE_SHM_UNLINK')):
|
||||
posixshmem_srcs = [ '_multiprocessing/posixshmem.c',
|
||||
]
|
||||
libs = []
|
||||
if self.compiler.find_library_file(lib_dirs, 'rt'):
|
||||
if sysconfig.get_config_var('SHM_NEEDS_LIBRT'):
|
||||
# need to link with librt to get shm_open()
|
||||
libs.append('rt')
|
||||
exts.append( Extension('_posixshmem', posixshmem_srcs,
|
||||
define_macros={},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue