[0fa325b] | 1 | #! /usr/bin/env python |
---|
| 2 | # encoding: utf-8 |
---|
| 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file |
---|
| 4 | |
---|
[904702d] | 5 | import os,sys,imp,types,re |
---|
[0fa325b] | 6 | from waflib.Tools import ccroot |
---|
| 7 | from waflib import Utils,Configure |
---|
| 8 | from waflib.Logs import debug |
---|
[904702d] | 9 | c_compiler={'win32':['msvc','gcc','clang'],'cygwin':['gcc'],'darwin':['clang','gcc'],'aix':['xlc','gcc','clang'],'linux':['gcc','clang','icc'],'sunos':['suncc','gcc'],'irix':['gcc','irixcc'],'hpux':['gcc'],'gnu':['gcc','clang'],'java':['gcc','msvc','clang','icc'],'default':['gcc','clang'],} |
---|
| 10 | def default_compilers(): |
---|
| 11 | build_platform=Utils.unversioned_sys_platform() |
---|
| 12 | possible_compiler_list=c_compiler.get(build_platform,c_compiler['default']) |
---|
| 13 | return' '.join(possible_compiler_list) |
---|
[0fa325b] | 14 | def configure(conf): |
---|
[904702d] | 15 | try:test_for_compiler=conf.options.check_c_compiler or default_compilers() |
---|
[0fa325b] | 16 | except AttributeError:conf.fatal("Add options(opt): opt.load('compiler_c')") |
---|
[904702d] | 17 | for compiler in re.split('[ ,]+',test_for_compiler): |
---|
[0fa325b] | 18 | conf.env.stash() |
---|
[904702d] | 19 | conf.start_msg('Checking for %r (C compiler)'%compiler) |
---|
[0fa325b] | 20 | try: |
---|
| 21 | conf.load(compiler) |
---|
| 22 | except conf.errors.ConfigurationError ,e: |
---|
| 23 | conf.env.revert() |
---|
| 24 | conf.end_msg(False) |
---|
| 25 | debug('compiler_c: %r'%e) |
---|
| 26 | else: |
---|
| 27 | if conf.env['CC']: |
---|
| 28 | conf.end_msg(conf.env.get_flat('CC')) |
---|
| 29 | conf.env['COMPILER_CC']=compiler |
---|
| 30 | break |
---|
| 31 | conf.end_msg(False) |
---|
| 32 | else: |
---|
[904702d] | 33 | conf.fatal('could not configure a C compiler!') |
---|
[0fa325b] | 34 | def options(opt): |
---|
[904702d] | 35 | test_for_compiler=default_compilers() |
---|
[0fa325b] | 36 | opt.load_special_tools('c_*.py',ban=['c_dumbpreproc.py']) |
---|
[904702d] | 37 | cc_compiler_opts=opt.add_option_group('Configuration options') |
---|
| 38 | cc_compiler_opts.add_option('--check-c-compiler',default=None,help='list of C compilers to try [%s]'%test_for_compiler,dest="check_c_compiler") |
---|
[0fa325b] | 39 | for x in test_for_compiler.split(): |
---|
| 40 | opt.load('%s'%x) |
---|