s4:lib/messaging: terminate the irpc_servers_byname() result with server_id_set_disco...
[Samba/gebeck_regimport.git] / buildtools / wafadmin / Tools / compiler_cxx.py
blob5308ea97199e04f028d380157d8217b0ab29ac10
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 cxx_compiler = {
11 'win32': ['msvc', 'g++'],
12 'cygwin': ['g++'],
13 'darwin': ['g++'],
14 'aix': ['xlc++', 'g++'],
15 'linux': ['g++', 'icpc', 'sunc++'],
16 'sunos': ['g++', 'sunc++'],
17 'irix': ['g++'],
18 'hpux': ['g++'],
19 'gnu': ['g++'],
20 'default': ['g++']
23 def __list_possible_compiler(platform):
24 try:
25 return cxx_compiler[platform]
26 except KeyError:
27 return cxx_compiler["default"]
29 def detect(conf):
30 try: test_for_compiler = Options.options.check_cxx_compiler
31 except AttributeError: raise Configure.ConfigurationError("Add set_options(opt): opt.tool_options('compiler_cxx')")
32 orig = conf.env
33 for compiler in test_for_compiler.split():
34 try:
35 conf.env = orig.copy()
36 conf.check_tool(compiler)
37 except Configure.ConfigurationError, e:
38 debug('compiler_cxx: %r' % e)
39 else:
40 if conf.env['CXX']:
41 orig.table = conf.env.get_merged_dict()
42 conf.env = orig
43 conf.check_message(compiler, '', True)
44 conf.env['COMPILER_CXX'] = compiler
45 break
46 conf.check_message(compiler, '', False)
47 break
48 else:
49 conf.fatal('could not configure a cxx compiler!')
51 def set_options(opt):
52 build_platform = Utils.unversioned_sys_platform()
53 possible_compiler_list = __list_possible_compiler(build_platform)
54 test_for_compiler = ' '.join(possible_compiler_list)
55 cxx_compiler_opts = opt.add_option_group('C++ Compiler Options')
56 cxx_compiler_opts.add_option('--check-cxx-compiler', default="%s" % test_for_compiler,
57 help='On this platform (%s) the following C++ Compiler will be checked by default: "%s"' % (build_platform, test_for_compiler),
58 dest="check_cxx_compiler")
60 for cxx_compiler in test_for_compiler.split():
61 opt.tool_options('%s' % cxx_compiler, option_group=cxx_compiler_opts)