selftest: Run krb5.kdc with an account that has a UPN and an SPN
[Samba.git] / buildtools / wafadmin / Tools / compiler_cc.py
blob0421503f7c932ba65b6b10c39c0ffb647a40c619
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # Matthias Jahn jahn dôt matthias ât freenet dôt de, 2007 (pmarat)
5 import os, sys, imp, types, ccroot
6 import optparse
7 import Utils, Configure, Options
8 from Logs import debug
10 c_compiler = {
11 'win32': ['msvc', 'gcc'],
12 'cygwin': ['gcc'],
13 'darwin': ['gcc'],
14 'aix': ['xlc', 'gcc'],
15 'linux': ['gcc', 'icc', 'suncc'],
16 'sunos': ['gcc', 'suncc'],
17 'irix': ['gcc'],
18 'hpux': ['gcc'],
19 'gnu': ['gcc'],
20 'default': ['gcc']
23 def __list_possible_compiler(platform):
24 try:
25 return c_compiler[platform]
26 except KeyError:
27 return c_compiler["default"]
29 def detect(conf):
30 """
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)
34 """
35 try: test_for_compiler = Options.options.check_c_compiler
36 except AttributeError: conf.fatal("Add set_options(opt): opt.tool_options('compiler_cc')")
37 orig = conf.env
38 for compiler in test_for_compiler.split():
39 conf.env = orig.copy()
40 try:
41 conf.check_tool(compiler)
42 except Configure.ConfigurationError, e:
43 debug('compiler_cc: %r' % e)
44 else:
45 if conf.env['CC']:
46 orig.table = conf.env.get_merged_dict()
47 conf.env = orig
48 conf.check_message(compiler, '', True)
49 conf.env['COMPILER_CC'] = compiler
50 break
51 conf.check_message(compiler, '', False)
52 break
53 else:
54 conf.fatal('could not configure a c compiler!')
56 def set_options(opt):
57 build_platform = Utils.unversioned_sys_platform()
58 possible_compiler_list = __list_possible_compiler(build_platform)
59 test_for_compiler = ' '.join(possible_compiler_list)
60 cc_compiler_opts = opt.add_option_group("C Compiler Options")
61 cc_compiler_opts.add_option('--check-c-compiler', default="%s" % test_for_compiler,
62 help='On this platform (%s) the following C-Compiler will be checked by default: "%s"' % (build_platform, test_for_compiler),
63 dest="check_c_compiler")
65 for c_compiler in test_for_compiler.split():
66 opt.tool_options('%s' % c_compiler, option_group=cc_compiler_opts)