~ubuntu-branches/ubuntu/wily/xmms2/wily

« back to all changes in this revision

Viewing changes to wafadmin/Tools/compiler_cxx.py

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2008-05-29 10:14:25 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080529101425-ycw1nbd980uhvzfp
Tags: 0.4DrKosmos-4ubuntu1
* Merge from debian unstable (LP: #178477), remaining changes:
  - debian/control: Update Maintainer field
  - debian/control: add lpia to xmms2-plugin-alsa supported architectures
* This version reads AAC files (LP: #156359)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python
 
2
# encoding: utf-8
 
3
# Matthias Jahn <jahn.matthias@freenet.de>, 2007 (pmarat)
 
4
 
 
5
import os, sys, imp, types
 
6
import optparse
 
7
import Utils, Action, Params, checks, Configure
 
8
 
 
9
def __list_possible_compiler(plattform):
 
10
        c_compiler = {
 
11
'win32':  ['msvc', 'g++'],
 
12
'cygwin': ['g++'],
 
13
'darwin': ['g++'],
 
14
'aix5':   ['g++'],
 
15
'linux':  ['g++', 'sunc++'],
 
16
'sunos':  ['sunc++', 'g++'],
 
17
'irix':   ['g++'],
 
18
'hpux':   ['g++'],
 
19
'default': ['g++']
 
20
        }
 
21
        try:
 
22
                return(c_compiler[plattform])
 
23
        except KeyError:
 
24
                return(c_compiler["default"])
 
25
 
 
26
def setup(env):
 
27
        pass
 
28
 
 
29
def detect(conf):
 
30
        test_for_compiler = Params.g_options.check_cxx_compiler
 
31
        for cxx_compiler in test_for_compiler.split():
 
32
                if conf.check_tool(cxx_compiler):
 
33
                        conf.check_message("%s" %cxx_compiler, '', True)
 
34
                        conf.env["COMPILER_CXX"] = "%s" %cxx_compiler #store the choosed c++ compiler
 
35
                        return (1)
 
36
                conf.check_message("%s" %cxx_compiler, '', False)
 
37
        conf.env["COMPILER_CXX"] = None
 
38
        return (0)
 
39
 
 
40
def set_options(opt):
 
41
        detected_plattform = checks.detect_platform(None)
 
42
        possible_compiler_list = __list_possible_compiler(detected_plattform)
 
43
        test_for_compiler = str(" ").join(possible_compiler_list)
 
44
        cxx_compiler_opts = opt.add_option_group("C++ Compiler Options")
 
45
        try:
 
46
                cxx_compiler_opts.add_option('--check-cxx-compiler', default="%s" % test_for_compiler,
 
47
                        help='On this platform (%s) following C++ Compiler will be checked default: "%s"' % 
 
48
                                                                (detected_plattform, test_for_compiler),
 
49
                        dest="check_cxx_compiler")
 
50
        except optparse.OptionConflictError:
 
51
                # the g++ tool might have added that option already
 
52
                pass
 
53
        for cxx_compiler in test_for_compiler.split():
 
54
                opt.tool_options('%s' % cxx_compiler, option_group=cxx_compiler_opts)
 
55