[Python-checkins] python/dist/src/Lib/distutils sysconfig.py,1.50,1.51

akuchling@users.sourceforge.net akuchling@users.sourceforge.net
Mon, 04 Nov 2002 11:53:26 -0800


Update of /cvsroot/python/python/dist/src/Lib/distutils
In directory usw-pr-cvs1:/tmp/cvs-serv10816

Modified Files:
	sysconfig.py 
Log Message:
[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.


Index: sysconfig.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** sysconfig.py	12 Jul 2002 09:16:44 -0000	1.50
--- sysconfig.py	4 Nov 2002 19:53:24 -0000	1.51
***************
*** 143,149 ****
              get_config_vars('CC', 'OPT', 'CCSHARED', 'LDSHARED', 'SO')
  
          cc_cmd = cc + ' ' + opt
          compiler.set_executables(
!             preprocessor=cc + " -E",    # not always!
              compiler=cc_cmd,
              compiler_so=cc_cmd + ' ' + ccshared,
--- 143,165 ----
              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=cpp,
              compiler=cc_cmd,
              compiler_so=cc_cmd + ' ' + ccshared,