--- Python-2.5.2.old1/Lib/distutils/ccompiler.py 2008-04-07 00:44:46.000000000 -0500 +++ Python-2.5.2/Lib/distutils/ccompiler.py 2008-04-07 01:10:51.000000000 -0500 @@ -689,12 +689,15 @@ class CCompiler: depends, extra_postargs) cc_args = self._get_cc_args(pp_opts, debug, extra_preargs) + lang = self.detect_language(sources) + for obj in objects: try: src, ext = build[obj] except KeyError: 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 objects --- Python-2.5.2.old1/Lib/distutils/unixccompiler.py 2008-04-07 01:07:25.000000000 -0500 +++ Python-2.5.2/Lib/distutils/unixccompiler.py 2008-04-07 01:10:54.000000000 -0500 @@ -166,16 +166,17 @@ class UnixCCompiler(CCompiler): except DistutilsExecError, 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_cxx_so = self.compiler_cxx_so if sys.platform == 'darwin': compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs) try: - if ext == '.c' or ext == '.m': - cc = compiler_so + cc_args - else: + 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) except DistutilsExecError, msg: