diff options
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/configure.py b/configure.py index 4d0905340..60a6b324a 100755 --- a/configure.py +++ b/configure.py @@ -2,7 +2,7 @@ """ Configuration program for botan (http://botan.randombit.net/) - (C) 2009-2011 Jack Lloyd + (C) 2009,2010,2011,2012 Jack Lloyd Distributed under the terms of the Botan license Tested with CPython 2.6, 2.7, 3.1 and PyPy 1.5 @@ -503,7 +503,13 @@ def lex_me_harder(infofile, to_obj, allowed_groups, name_val_pairs): lexer.lineno) elif token in name_val_pairs.keys(): - to_obj.__dict__[token] = lexer.get_token() + next_val = lexer.get_token() + + if type(to_obj.__dict__[token]) is list: + to_obj.__dict__[token].append(next_val) + else: + to_obj.__dict__[token] = next_val + else: # No match -> error raise LexerError('Bad token "%s"' % (token), lexer.lineno) @@ -525,7 +531,7 @@ class ModuleInfo(object): 'comment'], { 'load_on': 'auto', - 'define': None, + 'define': [], 'need_isa': None, 'mp_bits': 0 }) @@ -587,6 +593,9 @@ class ModuleInfo(object): def internal_headers(self): return self.header_internal + def defines(self): + return ['HAS_' + d for d in self.define] + def compatible_cpu(self, archinfo, options): arch_name = archinfo.basename @@ -911,10 +920,10 @@ def canon_processor(archinfo, proc): return (ainfo.basename, submodel) logging.debug('Known CPU names: ' + ' '.join( - sorted(sum([[ainfo.basename] + \ - ainfo.aliases + \ - [x for (x,_) in ainfo.all_submodels()] - for ainfo in archinfo.values()], [])))) + sorted(flatten([[ainfo.basename] + \ + ainfo.aliases + \ + [x for (x,_) in ainfo.all_submodels()] + for ainfo in archinfo.values()])))) raise Exception('Unknown or unidentifiable processor "%s"' % (proc)) @@ -988,10 +997,15 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): if dir.startswith('src'): parts = dir.split(os.sep)[1:] + + # Handle src/X/X.cpp -> X.o if file == parts[-1] + '.cpp': name = '_'.join(dir.split(os.sep)[1:]) + '.cpp' else: name = '_'.join(dir.split(os.sep)[1:]) + '_' + file + + # Special case hack cause I'm lazy + name = name.replace('tls_tls_', 'tls_') else: name = file @@ -1102,8 +1116,7 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): 'link_to': ' '.join([cc.add_lib_option + lib for lib in link_to()]), - 'module_defines': make_cpp_macros( - sorted(['HAS_' + m.define for m in modules if m.define])), + 'module_defines': make_cpp_macros(sorted(flatten([m.defines() for m in modules]))), 'target_os_defines': make_cpp_macros(osinfo.defines()), |