diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2002-11-04 19:53:24 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2002-11-04 19:53:24 (GMT) |
commit | 29c8623e5cdec2855ddbdec2c9c6305a8daa8fbd (patch) | |
tree | 91ebae58d5de48a26d6e03c158b67627e7bddb4e /Lib | |
parent | fb0ea525d528153838586bf8ece15a45bbf5ddf3 (diff) | |
download | cpython-29c8623e5cdec2855ddbdec2c9c6305a8daa8fbd.zip cpython-29c8623e5cdec2855ddbdec2c9c6305a8daa8fbd.tar.gz cpython-29c8623e5cdec2855ddbdec2c9c6305a8daa8fbd.tar.bz2 |
[Patch #588809] LDFLAGS support for build_ext.py, from Robert Weber
customize_compiler() now looks at various environment variables and uses
their values to override the configured C compiler/preprocessor/linker
binary and flags.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/sysconfig.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 48672d6..e879fa14 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -142,9 +142,25 @@ def customize_compiler(compiler): (cc, opt, ccshared, ldshared, so_ext) = \ get_config_vars('CC', 'OPT', 'CCSHARED', 'LDSHARED', 'SO') + if os.environ.has_key('CC'): + cc = os.environ['CC'] + if os.environ.has_key('CPP'): + cpp = os.environ['CPP'] + else: + cpp = cc + " -E" # not always + if os.environ.has_key('LDFLAGS'): + ldshared = ldshared + ' ' + os.environ['LDFLAGS'] + if os.environ.has_key('CFLAGS'): + opt = opt + ' ' + os.environ['CFLAGS'] + ldshared = ldshared + ' ' + os.environ['CFLAGS'] + if os.environ.has_key('CPPFLAGS'): + cpp = cpp + ' ' + os.environ['CPPFLAGS'] + opt = opt + ' ' + os.environ['CPPFLAGS'] + ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] + cc_cmd = cc + ' ' + opt compiler.set_executables( - preprocessor=cc + " -E", # not always! + preprocessor=cpp, compiler=cc_cmd, compiler_so=cc_cmd + ' ' + ccshared, linker_so=ldshared, |