mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
remove detect_math_libs (#4383)
Darwin may not require libm, but it doesn't hurt to link it and simplifies configuration logic.
This commit is contained in:
parent
d7d4fea4a3
commit
8acaa31eec
1 changed files with 10 additions and 21 deletions
31
setup.py
31
setup.py
|
|
@ -501,13 +501,6 @@ class PyBuildExt(build_ext):
|
||||||
finally:
|
finally:
|
||||||
os.unlink(tmpfile)
|
os.unlink(tmpfile)
|
||||||
|
|
||||||
def detect_math_libs(self):
|
|
||||||
# Check for MacOS X, which doesn't need libm.a at all
|
|
||||||
if host_platform == 'darwin':
|
|
||||||
return []
|
|
||||||
else:
|
|
||||||
return ['m']
|
|
||||||
|
|
||||||
def detect_modules(self):
|
def detect_modules(self):
|
||||||
# Ensure that /usr/local is always used, but the local build
|
# Ensure that /usr/local is always used, but the local build
|
||||||
# directories (i.e. '.' and 'Include') must be first. See issue
|
# directories (i.e. '.' and 'Include') must be first. See issue
|
||||||
|
|
@ -613,8 +606,6 @@ class PyBuildExt(build_ext):
|
||||||
if item.startswith('-L'):
|
if item.startswith('-L'):
|
||||||
lib_dirs.append(item[2:])
|
lib_dirs.append(item[2:])
|
||||||
|
|
||||||
math_libs = self.detect_math_libs()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# The following modules are all pretty straightforward, and compile
|
# The following modules are all pretty straightforward, and compile
|
||||||
# on pretty much any POSIXish platform.
|
# on pretty much any POSIXish platform.
|
||||||
|
|
@ -628,12 +619,12 @@ class PyBuildExt(build_ext):
|
||||||
exts.append( Extension('cmath', ['cmathmodule.c'],
|
exts.append( Extension('cmath', ['cmathmodule.c'],
|
||||||
extra_objects=[shared_math],
|
extra_objects=[shared_math],
|
||||||
depends=['_math.h', shared_math],
|
depends=['_math.h', shared_math],
|
||||||
libraries=math_libs) )
|
libraries=['m']) )
|
||||||
# math library functions, e.g. sin()
|
# math library functions, e.g. sin()
|
||||||
exts.append( Extension('math', ['mathmodule.c'],
|
exts.append( Extension('math', ['mathmodule.c'],
|
||||||
extra_objects=[shared_math],
|
extra_objects=[shared_math],
|
||||||
depends=['_math.h', shared_math],
|
depends=['_math.h', shared_math],
|
||||||
libraries=math_libs) )
|
libraries=['m']) )
|
||||||
|
|
||||||
# time libraries: librt may be needed for clock_gettime()
|
# time libraries: librt may be needed for clock_gettime()
|
||||||
time_libs = []
|
time_libs = []
|
||||||
|
|
@ -644,10 +635,10 @@ class PyBuildExt(build_ext):
|
||||||
# time operations and variables
|
# time operations and variables
|
||||||
exts.append( Extension('time', ['timemodule.c'],
|
exts.append( Extension('time', ['timemodule.c'],
|
||||||
libraries=time_libs) )
|
libraries=time_libs) )
|
||||||
# math_libs is needed by delta_new() that uses round() and by accum()
|
# libm is needed by delta_new() that uses round() and by accum() that
|
||||||
# that uses modf().
|
# uses modf().
|
||||||
exts.append( Extension('_datetime', ['_datetimemodule.c'],
|
exts.append( Extension('_datetime', ['_datetimemodule.c'],
|
||||||
libraries=math_libs) )
|
libraries=['m']) )
|
||||||
# random number generator implemented in C
|
# random number generator implemented in C
|
||||||
exts.append( Extension("_random", ["_randommodule.c"]) )
|
exts.append( Extension("_random", ["_randommodule.c"]) )
|
||||||
# bisect
|
# bisect
|
||||||
|
|
@ -732,9 +723,9 @@ class PyBuildExt(build_ext):
|
||||||
# According to #993173, this one should actually work fine on
|
# According to #993173, this one should actually work fine on
|
||||||
# 64-bit platforms.
|
# 64-bit platforms.
|
||||||
#
|
#
|
||||||
# audioop needs math_libs for floor() in multiple functions.
|
# audioop needs libm for floor() in multiple functions.
|
||||||
exts.append( Extension('audioop', ['audioop.c'],
|
exts.append( Extension('audioop', ['audioop.c'],
|
||||||
libraries=math_libs) )
|
libraries=['m']) )
|
||||||
|
|
||||||
# readline
|
# readline
|
||||||
do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
|
do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
|
||||||
|
|
@ -1972,7 +1963,6 @@ class PyBuildExt(build_ext):
|
||||||
'_ctypes/stgdict.c',
|
'_ctypes/stgdict.c',
|
||||||
'_ctypes/cfield.c']
|
'_ctypes/cfield.c']
|
||||||
depends = ['_ctypes/ctypes.h']
|
depends = ['_ctypes/ctypes.h']
|
||||||
math_libs = self.detect_math_libs()
|
|
||||||
|
|
||||||
if host_platform == 'darwin':
|
if host_platform == 'darwin':
|
||||||
sources.append('_ctypes/malloc_closure.c')
|
sources.append('_ctypes/malloc_closure.c')
|
||||||
|
|
@ -2003,10 +1993,10 @@ class PyBuildExt(build_ext):
|
||||||
libraries=[],
|
libraries=[],
|
||||||
sources=sources,
|
sources=sources,
|
||||||
depends=depends)
|
depends=depends)
|
||||||
# function my_sqrt() needs math library for sqrt()
|
# function my_sqrt() needs libm for sqrt()
|
||||||
ext_test = Extension('_ctypes_test',
|
ext_test = Extension('_ctypes_test',
|
||||||
sources=['_ctypes/_ctypes_test.c'],
|
sources=['_ctypes/_ctypes_test.c'],
|
||||||
libraries=math_libs)
|
libraries=['m'])
|
||||||
self.extensions.extend([ext, ext_test])
|
self.extensions.extend([ext, ext_test])
|
||||||
|
|
||||||
if host_platform == 'darwin':
|
if host_platform == 'darwin':
|
||||||
|
|
@ -2050,7 +2040,6 @@ class PyBuildExt(build_ext):
|
||||||
'Modules',
|
'Modules',
|
||||||
'_decimal',
|
'_decimal',
|
||||||
'libmpdec'))]
|
'libmpdec'))]
|
||||||
libraries = self.detect_math_libs()
|
|
||||||
sources = [
|
sources = [
|
||||||
'_decimal/_decimal.c',
|
'_decimal/_decimal.c',
|
||||||
'_decimal/libmpdec/basearith.c',
|
'_decimal/libmpdec/basearith.c',
|
||||||
|
|
@ -2146,7 +2135,7 @@ class PyBuildExt(build_ext):
|
||||||
ext = Extension (
|
ext = Extension (
|
||||||
'_decimal',
|
'_decimal',
|
||||||
include_dirs=include_dirs,
|
include_dirs=include_dirs,
|
||||||
libraries=libraries,
|
libraries=['m'],
|
||||||
define_macros=define_macros,
|
define_macros=define_macros,
|
||||||
undef_macros=undef_macros,
|
undef_macros=undef_macros,
|
||||||
extra_compile_args=extra_compile_args,
|
extra_compile_args=extra_compile_args,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue