blob: 671e078cd1e4b5e696fb210b74703ca56933dac6 [file] [log] [blame]
Mike Frysingerce0b8c02019-07-11 00:40:18 -04001make sure we respect the system libffi setting in our build config.
2the 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,8 +2113,6 @@ class PyBuildExt(build_ext):
16 # OS X 10.5 comes with libffi.dylib; the include files are
17 # in /usr/include/ffi
18 inc_dirs.append('/usr/include/ffi')
19- elif '--without-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
20- return
21
22 ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
23 if not ffi_inc or ffi_inc[0] == '':
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 if sysconfig.get_config_var('HAVE_LIBDL'):
36 # for dlopen, see bpo-32647