@@ -12,6 +12,13 @@ def run(self):
1212
1313BASEDIR = os .path .dirname (os .path .abspath (__file__ ))
1414
15+ def _supported_unix ():
16+ if sys .platform .startswith ('linux' ):
17+ return 'linux'
18+ if sys .platform .startswith ('freebsd' ):
19+ return 'bsd'
20+ return False
21+
1522if IS_PYPY :
1623 ext_modules = [] # built-in
1724else :
@@ -35,14 +42,19 @@ def run(self):
3542 extra_compile_args += ['-g' ]
3643 extra_compile_args += ['-O2' ]
3744 extra_source_files += ['src/vmprof_unix.c' , 'src/vmprof_mt.c' ]
38- elif sys . platform . startswith ( 'linux' ):
45+ elif _supported_unix ( ):
3946 libraries = ['dl' ,'unwind' ]
4047 extra_compile_args = ['-Wno-unused' ]
41- extra_compile_args += ['-DVMPROF_LINUX=1' ]
48+ if _supported_unix () == 'linux' :
49+ extra_compile_args += ['-DVMPROF_LINUX=1' ]
50+ if _supported_unix () == 'bsd' :
51+ libraries = ['unwind' ]
52+ extra_compile_args += ['-DVMPROF_BSD=1' ]
53+ extra_compile_args += ['-I/usr/local/include' ]
4254 extra_compile_args += ['-DVMPROF_UNIX=1' ]
4355 if platform .machine ().startswith ("arm" ):
4456 libraries .append ('unwind-arm' )
45- elif platform .machine ().startswith ("x86" ):
57+ elif platform .machine ().startswith ("x86" ) or platform . machine (). startswith ( "amd64" ) :
4658 if sys .maxsize == 2 ** 63 - 1 :
4759 libraries .append ('unwind-x86_64' )
4860 else :
0 commit comments