View | Details | Raw Unified
Collapse All | Expand All

(-) Python-2.5.2/Lib/distutils/unixccompiler.py (-7 / +22 lines)
 Lines 689-700   class CCompiler: Link Here 
                                    depends, extra_postargs)
                                    depends, extra_postargs)
        cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
        cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
        lang = self.detect_language(sources)
        for obj in objects:
        for obj in objects:
            try:
            try:
                src, ext = build[obj]
                src, ext = build[obj]
            except KeyError:
            except KeyError:
                continue
                continue
            self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
            self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts,
                          lang=lang)
        # Return *all* object filenames, not just the ones we just built.
        # Return *all* object filenames, not just the ones we just built.
        return objects
        return objects
 Lines 146-154   def customize_compiler(compiler): Link Here 
    varies across Unices and is stored in Python's Makefile.
    varies across Unices and is stored in Python's Makefile.
    """
    """
    if compiler.compiler_type == "unix":
    if compiler.compiler_type == "unix":
        (cc, cxx, opt, cflags, ccshared, ldshared, so_ext) = \
        (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, cxxflags) = (
            get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
            get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', 'CCSHARED',
                            'CCSHARED', 'LDSHARED', 'SO')
                            'LDSHARED', 'SO', 'CXXFLAGS'))
        if os.environ.has_key('CC'):
        if os.environ.has_key('CC'):
            cc = os.environ['CC']
            cc = os.environ['CC']
 Lines 169-181   def customize_compiler(compiler): Link Here 
            cpp = cpp + ' ' + os.environ['CPPFLAGS']
            cpp = cpp + ' ' + os.environ['CPPFLAGS']
            cflags = cflags + ' ' + os.environ['CPPFLAGS']
            cflags = cflags + ' ' + os.environ['CPPFLAGS']
            ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
            ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
        if os.environ.has_key('CXXFLAGS'):
            cxxflags = opt + ' ' + os.environ['CXXFLAGS']
        cc_cmd = cc + ' ' + cflags
        cc_cmd = cc + ' ' + cflags
        cxx_cmd = cxx + ' ' + cxxflags
        compiler.set_executables(
        compiler.set_executables(
            preprocessor=cpp,
            preprocessor=cpp,
            compiler=cc_cmd,
            compiler=cc_cmd,
            compiler_so=cc_cmd + ' ' + ccshared,
            compiler_so=cc_cmd + ' ' + ccshared,
            compiler_cxx=cxx,
            compiler_cxx=cxx_cmd,
            compiler_cxx_so=cxx_cmd + ' ' + ccshared,
            linker_so=ldshared,
            linker_so=ldshared,
            linker_exe=cc)
            linker_exe=cc)
 Lines 512-517   def get_config_vars(*args): Link Here 
                for key in ('LDFLAGS', 'BASECFLAGS',
                for key in ('LDFLAGS', 'BASECFLAGS',
                        # a number of derived variables. These need to be
                        # a number of derived variables. These need to be
                        # patched up as well.
                        # patched up as well.
                        'CXXFLAGS',
                        'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
                        'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
                    flags = _config_vars[key]
                    flags = _config_vars[key]
 Lines 114-119   class UnixCCompiler(CCompiler): Link Here 
                   'compiler'     : ["cc"],
                   'compiler'     : ["cc"],
                   'compiler_so'  : ["cc"],
                   'compiler_so'  : ["cc"],
                   'compiler_cxx' : ["cc"],
                   'compiler_cxx' : ["cc"],
                   'compiler_cxx_so' : ["cc"],
                   'linker_so'    : ["cc", "-shared"],
                   'linker_so'    : ["cc", "-shared"],
                   'linker_exe'   : ["cc"],
                   'linker_exe'   : ["cc"],
                   'archiver'     : ["ar", "-cr"],
                   'archiver'     : ["ar", "-cr"],
 Lines 165-176   class UnixCCompiler(CCompiler): Link Here 
            except DistutilsExecError, msg:
            except DistutilsExecError, msg:
                raise CompileError, msg
                raise CompileError, msg
    def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
    def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts,
                 lang='c'):
        compiler_so = self.compiler_so
        compiler_so = self.compiler_so
        compiler_cxx_so = self.compiler_cxx_so
        if sys.platform == 'darwin':
        if sys.platform == 'darwin':
            compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs)
            compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs)
        try:
        try:
            self.spawn(compiler_so + cc_args + [src, '-o', obj] +
            if lang == 'c++':
                cc = compiler_cxx_so + cc_args
            else:
                cc = compiler_so + cc_args
            self.spawn(cc + cc_args + [src, '-o', obj] +
                       extra_postargs)
                       extra_postargs)
        except DistutilsExecError, msg:
        except DistutilsExecError, msg:
            raise CompileError, msg
            raise CompileError, msg