diff options
author | Jack Lloyd <[email protected]> | 2017-09-05 14:54:41 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-05 14:56:50 -0400 |
commit | 9972e0fc2b407ea831f4cf90c5196b8b343e5e3a (patch) | |
tree | fe1b752f8fefc45d6f692c2a8506313c1b0f6561 /configure.py | |
parent | b9fdd383c047b34ea56d81341dda45a433c3cc74 (diff) |
Add some simple deductions of --cc given --cc-bin
If --cc is not set but --cc-bin is, try guessing the compiler type
based on that.
This is useful for OSS-Fuzz (https://github.com/google/oss-fuzz/pull/649)
and convenient elsewhere (eg --cc-bin=afl-clang++ now does the right thing)
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/configure.py b/configure.py index 912c5d49a..25f142cb9 100755 --- a/configure.py +++ b/configure.py @@ -2849,6 +2849,16 @@ def set_defaults_for_unset_options(options, info_arch, info_cc): # pylint: disab options.os = system_from_python logging.info('Guessing target OS is %s (use --os to set)' % (options.os)) + def deduce_compiler_type_from_cc_bin(cc_bin): + if cc_bin.find('clang') != -1: + return 'clang' + if cc_bin.find('-g++') != -1: + return 'gcc' + return None + + if options.compiler is None and options.compiler_binary != None: + options.compiler = deduce_compiler_type_from_cc_bin(options.compiler_binary) + if options.compiler is None: if options.os == 'windows': if have_program('g++') and not have_program('cl'): @@ -2868,8 +2878,7 @@ def set_defaults_for_unset_options(options, info_arch, info_cc): # pylint: disab options.compiler = 'gcc' else: options.compiler = 'gcc' - logging.info('Guessing to use compiler %s (use --cc to set)' % ( - options.compiler)) + logging.info('Guessing to use compiler %s (use --cc to set)' % (options.compiler)) if options.cpu is None: (options.arch, options.cpu) = guess_processor(info_arch) |