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 | |
---|
5 | import os,sys,imp,types,re |
---|
6 | from waflib.Tools import ccroot |
---|
7 | from waflib import Utils,Configure |
---|
8 | from waflib.Logs import debug |
---|
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) |
---|
14 | def configure(conf): |
---|
15 | try:test_for_compiler=conf.options.check_c_compiler or default_compilers() |
---|
16 | except AttributeError:conf.fatal("Add options(opt): opt.load('compiler_c')") |
---|
17 | for compiler in re.split('[ ,]+',test_for_compiler): |
---|
18 | conf.env.stash() |
---|
19 | conf.start_msg('Checking for %r (C compiler)'%compiler) |
---|
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: |
---|
33 | conf.fatal('could not configure a C compiler!') |
---|
34 | def options(opt): |
---|
35 | test_for_compiler=default_compilers() |
---|
36 | opt.load_special_tools('c_*.py',ban=['c_dumbpreproc.py']) |
---|
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") |
---|
39 | for x in test_for_compiler.split(): |
---|
40 | opt.load('%s'%x) |
---|