Daniel Kurtz | 7abe6f5 | 2019-05-21 17:41:24 -0600 | [diff] [blame^] | 1 | make sure we respect the system libffi setting in our build config. |
| 2 | the compiler probing is fragile and can break in some situations. |
| 3 | |
| 4 | --- a/setup.py |
| 5 | +++ b/setup.py |
| 6 | @@ -2069,7 +2069,7 @@ class PyBuildExt(build_ext): |
| 7 | return True |
| 8 | |
| 9 | def detect_ctypes(self, inc_dirs, lib_dirs): |
| 10 | - self.use_system_libffi = False |
| 11 | + self.use_system_libffi = ('--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS")) |
| 12 | include_dirs = [] |
| 13 | extra_compile_args = [] |
| 14 | extra_link_args = [] |
| 15 | @@ -2113,7 +2113,7 @@ class PyBuildExt(build_ext): |
| 16 | sources=['_ctypes/_ctypes_test.c']) |
| 17 | self.extensions.extend([ext, ext_test]) |
| 18 | |
| 19 | - if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"): |
| 20 | + if not self.use_system_libffi: |
| 21 | return |
| 22 | |
| 23 | if host_platform == 'darwin': |
| 24 | @@ -2141,10 +2141,10 @@ class PyBuildExt(build_ext): |
| 25 | ffi_lib = lib_name |
| 26 | break |
| 27 | |
| 28 | - if ffi_inc and ffi_lib: |
| 29 | + if ffi_inc: |
| 30 | ext.include_dirs.extend(ffi_inc) |
| 31 | + if ffi_lib: |
| 32 | ext.libraries.append(ffi_lib) |
| 33 | - self.use_system_libffi = True |
| 34 | |
| 35 | |
| 36 | class PyBuildInstall(install): |