--- Python-2.5.2/Lib/distutils/sysconfig.py 2008-04-03 02:33:10.000000000 -0500 +++ Python-2.5.2/Lib/distutils/sysconfig.py 2008-04-03 02:37:12.000000000 -0500 @@ -146,9 +146,9 @@ def customize_compiler(compiler): varies across Unices and is stored in Python's Makefile. """ if compiler.compiler_type == "unix": - (cc, cxx, opt, cflags, ccshared, ldshared, so_ext) = \ - get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', - 'CCSHARED', 'LDSHARED', 'SO') + (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, cxxflags) = ( + get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', 'CCSHARED', + 'LDSHARED', 'SO', 'CXXFLAGS')) if os.environ.has_key('CC'): cc = os.environ['CC'] @@ -169,13 +169,17 @@ def customize_compiler(compiler): cpp = cpp + ' ' + os.environ['CPPFLAGS'] cflags = cflags + ' ' + os.environ['CPPFLAGS'] ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] + if os.environ.has_key('CXXFLAGS'): + cxxflags = opt + ' ' + os.environ['CXXFLAGS'] cc_cmd = cc + ' ' + cflags + cxx_cmd = cxx + ' ' + cxxflags compiler.set_executables( preprocessor=cpp, compiler=cc_cmd, compiler_so=cc_cmd + ' ' + ccshared, - compiler_cxx=cxx, + compiler_cxx=cxx_cmd, + compiler_cxx_so=cxx_cmd + ' ' + ccshared, linker_so=ldshared, linker_exe=cc) @@ -512,6 +516,7 @@ def get_config_vars(*args): for key in ('LDFLAGS', 'BASECFLAGS', # a number of derived variables. These need to be # patched up as well. + 'CXXFLAGS', 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): flags = _config_vars[key] --- Python-2.5.2/Lib/distutils/unixccompiler.py 2008-04-03 02:33:10.000000000 -0500 +++ Python-2.5.2/Lib/distutils/unixccompiler.py 2008-04-03 02:41:30.000000000 -0500 @@ -114,6 +114,7 @@ class UnixCCompiler(CCompiler): 'compiler' : ["cc"], 'compiler_so' : ["cc"], 'compiler_cxx' : ["cc"], + 'compiler_cxx_so' : ["cc"], 'linker_so' : ["cc", "-shared"], 'linker_exe' : ["cc"], 'archiver' : ["ar", "-cr"], @@ -167,10 +168,15 @@ class UnixCCompiler(CCompiler): def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): 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: - self.spawn(compiler_so + cc_args + [src, '-o', obj] + + if ext == '.c' or ext == '.m': + cc = compiler_so + cc_args + else: + cc = compiler_cxx_so + cc_args + self.spawn(cc + cc_args + [src, '-o', obj] + extra_postargs) except DistutilsExecError, msg: raise CompileError, msg