diff options
author | lloyd <[email protected]> | 2014-05-01 02:30:57 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-05-01 02:30:57 +0000 |
commit | d2e86fc7dca835058bcc91ce0fb0cc787383a7bb (patch) | |
tree | 2fb60d6819c90b1f9f7c95a73d7e8cb309719deb /configure.py | |
parent | 2c91264a5e65d1db035412a0bc82526bd0c75e88 (diff) |
Support restricting compiler ISAs to specific architectures. Specifically
to work around weird MSVC limitations in 32-bit mode, but maybe useful
elsewhere someday. Github #11.
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/configure.py b/configure.py index fbf2205eb..30b5ef551 100755 --- a/configure.py +++ b/configure.py @@ -680,12 +680,12 @@ class ModuleInfo(object): def compatible_os(self, os): return self.os == [] or os in self.os - def compatible_compiler(self, ccinfo, cc): - if self.cc != [] and cc not in self.cc: + def compatible_compiler(self, cc, arch): + if self.cc != [] and cc.basename not in self.cc: return False for isa in self.need_isa: - if isa not in ccinfo.isa_flags: + if cc.isa_flags_for(isa, arch) is None: return False return True @@ -832,6 +832,14 @@ class CompilerInfo(object): del self.mach_opt + def isa_flags_for(self, isa, arch): + if isa in self.isa_flags: + return self.isa_flags[isa] + arch_isa = '%s:%s' % (arch, isa) + if arch_isa in self.isa_flags: + return self.isa_flags[arch_isa] + return None + """ Return the shared library build flags, if any """ @@ -1107,9 +1115,10 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): def get_isa_specific_flags(cc, isas): flags = [] for isa in isas: - if isa not in cc.isa_flags: - raise Exception('Compiler does not support %s' % (isa)) - flags.append(cc.isa_flags[isa]) + flag = cc.isa_flags_for(isa, arch.basename) + if flag is None: + raise Exception('Compiler %s does not support %s' % (cc.basename, isa)) + flags.append(flag) return '' if len(flags) == 0 else (' ' + ' '.join(sorted(list(flags)))) def simd_dependencies(): @@ -1372,7 +1381,7 @@ def choose_modules_to_use(modules, archinfo, ccinfo, options): elif not module.compatible_os(options.os): cannot_use_because(modname, 'incompatible OS') - elif not module.compatible_compiler(ccinfo, options.compiler): + elif not module.compatible_compiler(ccinfo, archinfo.basename): cannot_use_because(modname, 'incompatible compiler') elif not module.compatible_cpu(archinfo, options): cannot_use_because(modname, 'incompatible CPU') |