aboutsummaryrefslogtreecommitdiffstats
path: root/configure.py
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2017-04-24 23:43:39 +0200
committerSimon Warta <[email protected]>2017-04-25 00:38:04 +0200
commitf30d150b78842d7d6a1df44c2b735657d798a491 (patch)
tree6b640fc01ea15f6f1df1577ce3c1f279cc6beeaa /configure.py
parent5ede186a46f3c519fc971794a9f02f65f82929ae (diff)
Extract canonicalize_options
Diffstat (limited to 'configure.py')
-rwxr-xr-xconfigure.py41
1 files changed, 22 insertions, 19 deletions
diff --git a/configure.py b/configure.py
index 52fcb152a..7f853a437 100755
--- a/configure.py
+++ b/configure.py
@@ -2584,6 +2584,27 @@ def set_defaults_for_unset_options(options):
options.with_sphinx = True
+# Mutates `options`
+def canonicalize_options(options, info_os, info_arch):
+ if options.os not in info_os:
+ def find_canonical_os_name(os_name_variant):
+ for (canonical_os_name, info) in info_os.items():
+ if os_name_variant in info.aliases:
+ return canonical_os_name
+ return os_name_variant # not found
+ options.os = find_canonical_os_name(options.os)
+
+ # canonical ARCH/CPU
+ cpu_from_user = options.cpu
+ results = canon_processor(info_arch, options.cpu)
+ if results != None:
+ (options.arch, options.cpu) = results
+ logging.info('Canonicalized CPU target %s to %s/%s' % (
+ cpu_from_user, options.arch, options.cpu))
+ else:
+ raise UserError('Unknown or unidentifiable processor "%s"' % (options.cpu))
+
+
# Checks user options for consistency
# This method DOES NOT change options on behalf of the user but explains
# why the given configuration does not work.
@@ -2695,31 +2716,13 @@ def main(argv=None):
logging.info('Guessing to use compiler %s (use --cc to set)' % (
options.compiler))
- if options.os not in info_os:
- def find_canonical_os_name(os_name_variant):
- for (canonical_os_name, info) in info_os.items():
- if os_name_variant in info.aliases:
- return canonical_os_name
- return os_name_variant # not found
- options.os = find_canonical_os_name(options.os)
-
if options.cpu is None:
(options.arch, options.cpu) = guess_processor(info_arch)
logging.info('Guessing target processor is a %s/%s (use --cpu to set)' % (
options.arch, options.cpu))
- else:
- cpu_from_user = options.cpu
-
- results = canon_processor(info_arch, options.cpu)
-
- if results != None:
- (options.arch, options.cpu) = results
- logging.info('Canonicalizized CPU target %s to %s/%s' % (
- cpu_from_user, options.arch, options.cpu))
- else:
- logging.error('Unknown or unidentifiable processor "%s"' % (options.cpu))
set_defaults_for_unset_options(options)
+ canonicalize_options(options, info_os, info_arch)
validate_options(options, info_os, info_cc, module_policies)
logging.info('Target is %s-%s-%s-%s' % (