Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ddb25f

Browse files
committed
Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
1 parent 9ac3350 commit 5ddb25f

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

setup.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ def detect_modules(self):
113113
inc_dirs = ['/usr/include'] + self.compiler.include_dirs
114114
exts = []
115115

116+
# Check for MacOS X, which doesn't need libm.a at all
117+
math_libs = ['m']
118+
if sys.platform == 'Darwin1.2':
119+
math_libs = []
120+
116121
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
117122

118123
#
@@ -129,13 +134,17 @@ def detect_modules(self):
129134
# array objects
130135
exts.append( Extension('array', ['arraymodule.c']) )
131136
# complex math library functions
132-
exts.append( Extension('cmath', ['cmathmodule.c'], libraries=['m']) )
137+
exts.append( Extension('cmath', ['cmathmodule.c'],
138+
libraries=math_libs) )
139+
133140
# math library functions, e.g. sin()
134-
exts.append( Extension('math', ['mathmodule.c'], libraries=['m']) )
141+
exts.append( Extension('math', ['mathmodule.c'],
142+
libraries=math_libs) )
135143
# fast string operations implemented in C
136144
exts.append( Extension('strop', ['stropmodule.c']) )
137145
# time operations and variables
138-
exts.append( Extension('time', ['timemodule.c'], libraries=['m']) )
146+
exts.append( Extension('time', ['timemodule.c'],
147+
libraries=math_libs) )
139148
# operator.add() and similar goodies
140149
exts.append( Extension('operator', ['operator.c']) )
141150
# access to the builtin codecs and codec registry

0 commit comments

Comments
 (0)