1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
# DP: Allow setting BASECFLAGS, OPT and EXTRA_LDFLAGS (like, CC, CXX, CPP,
# DP: CFLAGS, CPPFLAGS, CCSHARED, LDSHARED) from the environment.
Index: b/Lib/distutils/sysconfig.py
===================================================================
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -174,10 +174,12 @@ def customize_compiler(compiler):
_osx_support.customize_compiler(_config_vars)
_config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
- (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
- 'CCSHARED', 'LDSHARED', 'SO', 'AR',
- 'ARFLAGS')
+ (cc, cxx, opt, cflags, extra_cflags, basecflags,
+ ccshared, ldshared, so_ext, ar, ar_flags,
+ configure_cppflags, configure_cflags, configure_ldflags) = \
+ get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', 'EXTRA_CFLAGS', 'BASECFLAGS',
+ 'CCSHARED', 'LDSHARED', 'SO', 'AR', 'ARFLAGS',
+ 'CONFIGURE_CPPFLAGS', 'CONFIGURE_CFLAGS', 'CONFIGURE_LDFLAGS')
if 'CC' in os.environ:
newcc = os.environ['CC']
@@ -198,13 +200,27 @@ def customize_compiler(compiler):
cpp = cc + " -E" # not always
if 'LDFLAGS' in os.environ:
ldshared = ldshared + ' ' + os.environ['LDFLAGS']
+ elif configure_ldflags:
+ ldshared = ldshared + ' ' + configure_ldflags
+ if 'BASECFLAGS' in os.environ:
+ basecflags = os.environ['BASECFLAGS']
+ if 'OPT' in os.environ:
+ opt = os.environ['OPT']
+ cflags = ' '.join(str(x) for x in (basecflags, opt, extra_cflags) if x)
if 'CFLAGS' in os.environ:
- cflags = opt + ' ' + os.environ['CFLAGS']
+ cflags = ' '.join(str(x) for x in (opt, basecflags, os.environ['CFLAGS'], extra_cflags) if x)
ldshared = ldshared + ' ' + os.environ['CFLAGS']
+ elif configure_cflags:
+ cflags = ' '.join(str(x) for x in (opt, basecflags, configure_cflags, extra_cflags) if x)
+ ldshared = ldshared + ' ' + configure_cflags
if 'CPPFLAGS' in os.environ:
cpp = cpp + ' ' + os.environ['CPPFLAGS']
cflags = cflags + ' ' + os.environ['CPPFLAGS']
ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
+ elif configure_cppflags:
+ cpp = cpp + ' ' + configure_cppflags
+ cflags = cflags + ' ' + configure_cppflags
+ ldshared = ldshared + ' ' + configure_cppflags
if 'AR' in os.environ:
ar = os.environ['AR']
if 'ARFLAGS' in os.environ:
|