@@ -501,13 +501,6 @@ def add_gcc_paths(self):
501
501
finally :
502
502
os .unlink (tmpfile )
503
503
504
- def detect_math_libs (self ):
505
- # Check for MacOS X, which doesn't need libm.a at all
506
- if host_platform == 'darwin' :
507
- return []
508
- else :
509
- return ['m' ]
510
-
511
504
def detect_modules (self ):
512
505
# Ensure that /usr/local is always used, but the local build
513
506
# directories (i.e. '.' and 'Include') must be first. See issue
@@ -613,8 +606,6 @@ def detect_modules(self):
613
606
if item .startswith ('-L' ):
614
607
lib_dirs .append (item [2 :])
615
608
616
- math_libs = self .detect_math_libs ()
617
-
618
609
#
619
610
# The following modules are all pretty straightforward, and compile
620
611
# on pretty much any POSIXish platform.
@@ -628,12 +619,12 @@ def detect_modules(self):
628
619
exts .append ( Extension ('cmath' , ['cmathmodule.c' ],
629
620
extra_objects = [shared_math ],
630
621
depends = ['_math.h' , shared_math ],
631
- libraries = math_libs ) )
622
+ libraries = [ 'm' ] ) )
632
623
# math library functions, e.g. sin()
633
624
exts .append ( Extension ('math' , ['mathmodule.c' ],
634
625
extra_objects = [shared_math ],
635
626
depends = ['_math.h' , shared_math ],
636
- libraries = math_libs ) )
627
+ libraries = [ 'm' ] ) )
637
628
638
629
# time libraries: librt may be needed for clock_gettime()
639
630
time_libs = []
@@ -644,10 +635,10 @@ def detect_modules(self):
644
635
# time operations and variables
645
636
exts .append ( Extension ('time' , ['timemodule.c' ],
646
637
libraries = time_libs ) )
647
- # math_libs is needed by delta_new() that uses round() and by accum()
648
- # that uses modf().
638
+ # libm is needed by delta_new() that uses round() and by accum() that
639
+ # uses modf().
649
640
exts .append ( Extension ('_datetime' , ['_datetimemodule.c' ],
650
- libraries = math_libs ) )
641
+ libraries = [ 'm' ] ) )
651
642
# random number generator implemented in C
652
643
exts .append ( Extension ("_random" , ["_randommodule.c" ]) )
653
644
# bisect
@@ -732,9 +723,9 @@ def detect_modules(self):
732
723
# According to #993173, this one should actually work fine on
733
724
# 64-bit platforms.
734
725
#
735
- # audioop needs math_libs for floor() in multiple functions.
726
+ # audioop needs libm for floor() in multiple functions.
736
727
exts .append ( Extension ('audioop' , ['audioop.c' ],
737
- libraries = math_libs ) )
728
+ libraries = [ 'm' ] ) )
738
729
739
730
# readline
740
731
do_readline = self .compiler .find_library_file (lib_dirs , 'readline' )
@@ -1972,7 +1963,6 @@ def detect_ctypes(self, inc_dirs, lib_dirs):
1972
1963
'_ctypes/stgdict.c' ,
1973
1964
'_ctypes/cfield.c' ]
1974
1965
depends = ['_ctypes/ctypes.h' ]
1975
- math_libs = self .detect_math_libs ()
1976
1966
1977
1967
if host_platform == 'darwin' :
1978
1968
sources .append ('_ctypes/malloc_closure.c' )
@@ -2003,10 +1993,10 @@ def detect_ctypes(self, inc_dirs, lib_dirs):
2003
1993
libraries = [],
2004
1994
sources = sources ,
2005
1995
depends = depends )
2006
- # function my_sqrt() needs math library for sqrt()
1996
+ # function my_sqrt() needs libm for sqrt()
2007
1997
ext_test = Extension ('_ctypes_test' ,
2008
1998
sources = ['_ctypes/_ctypes_test.c' ],
2009
- libraries = math_libs )
1999
+ libraries = [ 'm' ] )
2010
2000
self .extensions .extend ([ext , ext_test ])
2011
2001
2012
2002
if host_platform == 'darwin' :
@@ -2050,7 +2040,6 @@ def _decimal_ext(self):
2050
2040
'Modules' ,
2051
2041
'_decimal' ,
2052
2042
'libmpdec' ))]
2053
- libraries = self .detect_math_libs ()
2054
2043
sources = [
2055
2044
'_decimal/_decimal.c' ,
2056
2045
'_decimal/libmpdec/basearith.c' ,
@@ -2146,7 +2135,7 @@ def _decimal_ext(self):
2146
2135
ext = Extension (
2147
2136
'_decimal' ,
2148
2137
include_dirs = include_dirs ,
2149
- libraries = libraries ,
2138
+ libraries = [ 'm' ] ,
2150
2139
define_macros = define_macros ,
2151
2140
undef_macros = undef_macros ,
2152
2141
extra_compile_args = extra_compile_args ,
0 commit comments