summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2017-11-13 04:53:39 (GMT)
committerGitHub <noreply@github.com>2017-11-13 04:53:39 (GMT)
commit8acaa31eec84010c2211b838cffa9f69a91a5240 (patch)
tree445b45eb907b617ff14b6c0e2a4ad6b7de06cfb4 /setup.py
parentd7d4fea4a39da4bfdea1de22fe040023eb4ddc17 (diff)
downloadcpython-8acaa31eec84010c2211b838cffa9f69a91a5240.zip
cpython-8acaa31eec84010c2211b838cffa9f69a91a5240.tar.gz
cpython-8acaa31eec84010c2211b838cffa9f69a91a5240.tar.bz2
remove detect_math_libs (#4383)
Darwin may not require libm, but it doesn't hurt to link it and simplifies configuration logic.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py31
1 files changed, 10 insertions, 21 deletions
diff --git a/setup.py b/setup.py
index f284301..cbe6139 100644
--- a/setup.py
+++ b/setup.py
@@ -501,13 +501,6 @@ class PyBuildExt(build_ext):
finally:
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):
# Ensure that /usr/local is always used, but the local build
# directories (i.e. '.' and 'Include') must be first. See issue
@@ -613,8 +606,6 @@ class PyBuildExt(build_ext):
if item.startswith('-L'):
lib_dirs.append(item[2:])
- math_libs = self.detect_math_libs()
-
#
# The following modules are all pretty straightforward, and compile
# on pretty much any POSIXish platform.
@@ -628,12 +619,12 @@ class PyBuildExt(build_ext):
exts.append( Extension('cmath', ['cmathmodule.c'],
extra_objects=[shared_math],
depends=['_math.h', shared_math],
- libraries=math_libs) )
+ libraries=['m']) )
# math library functions, e.g. sin()
exts.append( Extension('math', ['mathmodule.c'],
extra_objects=[shared_math],
depends=['_math.h', shared_math],
- libraries=math_libs) )
+ libraries=['m']) )
# time libraries: librt may be needed for clock_gettime()
time_libs = []
@@ -644,10 +635,10 @@ class PyBuildExt(build_ext):
# time operations and variables
exts.append( Extension('time', ['timemodule.c'],
libraries=time_libs) )
- # math_libs is needed by delta_new() that uses round() and by accum()
- # that uses modf().
+ # libm is needed by delta_new() that uses round() and by accum() that
+ # uses modf().
exts.append( Extension('_datetime', ['_datetimemodule.c'],
- libraries=math_libs) )
+ libraries=['m']) )
# random number generator implemented in C
exts.append( Extension("_random", ["_randommodule.c"]) )
# bisect
@@ -732,9 +723,9 @@ class PyBuildExt(build_ext):
# According to #993173, this one should actually work fine on
# 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'],
- libraries=math_libs) )
+ libraries=['m']) )
# readline
do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
@@ -1972,7 +1963,6 @@ class PyBuildExt(build_ext):
'_ctypes/stgdict.c',
'_ctypes/cfield.c']
depends = ['_ctypes/ctypes.h']
- math_libs = self.detect_math_libs()
if host_platform == 'darwin':
sources.append('_ctypes/malloc_closure.c')
@@ -2003,10 +1993,10 @@ class PyBuildExt(build_ext):
libraries=[],
sources=sources,
depends=depends)
- # function my_sqrt() needs math library for sqrt()
+ # function my_sqrt() needs libm for sqrt()
ext_test = Extension('_ctypes_test',
sources=['_ctypes/_ctypes_test.c'],
- libraries=math_libs)
+ libraries=['m'])
self.extensions.extend([ext, ext_test])
if host_platform == 'darwin':
@@ -2050,7 +2040,6 @@ class PyBuildExt(build_ext):
'Modules',
'_decimal',
'libmpdec'))]
- libraries = self.detect_math_libs()
sources = [
'_decimal/_decimal.c',
'_decimal/libmpdec/basearith.c',
@@ -2146,7 +2135,7 @@ class PyBuildExt(build_ext):
ext = Extension (
'_decimal',
include_dirs=include_dirs,
- libraries=libraries,
+ libraries=['m'],
define_macros=define_macros,
undef_macros=undef_macros,
extra_compile_args=extra_compile_args,