3 # Matthias Jahn jahn dôt matthias ât freenet dôt de, 2007 (pmarat)
5 import os, sys, imp, types, ccroot
7 import Utils, Configure, Options
11 'win32': ['msvc', 'gcc'],
14 'aix': ['xlc', 'gcc'],
15 'linux': ['gcc', 'icc', 'suncc'],
16 'sunos': ['gcc', 'suncc'],
23 def __list_possible_compiler(platform):
25 return c_compiler[platform]
27 return c_compiler["default"]
31 for each compiler for the platform, try to configure the compiler
32 in theory the tools should raise a configuration error if the compiler
33 pretends to be something it is not (setting CC=icc and trying to configure gcc)
35 try: test_for_compiler = Options.options.check_c_compiler
36 except AttributeError: conf.fatal("Add set_options(opt): opt.tool_options('compiler_cc')")
38 for compiler in test_for_compiler.split():
39 conf.env = orig.copy()
41 conf.check_tool(compiler)
42 except Configure.ConfigurationError, e:
43 debug('compiler_cc: %r' % e)
46 orig.table = conf.env.get_merged_dict()
48 conf.check_message(compiler, '', True)
49 conf.env['COMPILER_CC'] = compiler
51 conf.check_message(compiler, '', False)
53 conf.env.STANDARD_LIBPATH = get_cc_std_libpath(conf.env.CC)
55 conf.fatal('could not configure a c compiler!')
58 build_platform = Utils.unversioned_sys_platform()
59 possible_compiler_list = __list_possible_compiler(build_platform)
60 test_for_compiler = ' '.join(possible_compiler_list)
61 cc_compiler_opts = opt.add_option_group("C Compiler Options")
62 cc_compiler_opts.add_option('--check-c-compiler', default="%s" % test_for_compiler,
63 help='On this platform (%s) the following C-Compiler will be checked by default: "%s"' % (build_platform, test_for_compiler),
64 dest="check_c_compiler")
66 for c_compiler in test_for_compiler.split():
67 opt.tool_options('%s' % c_compiler, option_group=cc_compiler_opts)