@ -160,34 +160,25 @@ class BuildLibpythonize(Command):
cmdlist . append ( " --mode=compile " )
cmdlist . append ( " --tag=CXX " )
# Find the compiler flags and options
# CXX is empty on some Systems, let's do it 'the hard way'.
# FIXME :: get CXX from make.conf for Gentoo.
if len ( sysconfig . get_config_var ( " CXX " ) . split ( ) ) > = 2 :
cmdlist . extend ( sysconfig . get_config_var ( " CXX " ) . split ( ) )
else :
cmdlist . extend ( [ ' g++ ' , ' -pthread ' ] )
# Find the compiler and flags
cxx = sysconfig . get_config_var ( " CXX " ) or os . environ . get ( " CXX " ) or " c++ "
cxxflags = [ ]
# Use python's CFLAGS
cflags = ( sysconfig . get_config_var ( " CFLAGS " ) )
if cflags :
cxxflags . extend ( cflags . split ( ) )
# Append our own flags
cxxflags . append ( ' -fno-strict-aliasing ' )
# Get user-provided flags
if os . environ . get ( " CXXFLAGS " ) :
cxxflags . extend ( os . environ [ " CXXFLAGS " ] . split ( ) )
cmdlist . append ( cxx )
# cc_flags
cmdlist . append ( " -c " )
cmdlist . append ( " -g " )
cmdlist . extend ( cxxflags )
# The 4 is randomly chosen!
# FIXME :: get CFLAGS from make.conf for Gentoo.
if len ( sysconfig . get_config_var ( " CFLAGS " ) . split ( ) ) > = 4 :
cmdlist . extend ( sysconfig . get_config_var ( " CFLAGS " ) . split ( ) )
else :
# On Gentoo systems, CFLAGS are not in the environment.
raw = os . popen ( ' emerge info 2> /dev/null|grep CFLAGS ' )
lines = raw . readlines ( )
if len ( lines ) :
cflags = lines [ 0 ] . split ( ' " ' ) [ 1 ] . split ( )
print ( " Got CFLAGS from emerge info. " )
cmdlist . extend ( cflags )
else :
# Still no CFLAGS found, use these ...
cmdlist . extend ( [ ' -fno-strict-aliasing ' , ' -DNDEBUG ' , ' -g ' , ' -O3 ' , ' -Wall ' , ' -Wstrict-prototypes ' ] )
# includes
cmdlist . append ( " -I " + sysconfig . get_config_var ( " INCLUDEDIR " ) )
cmdlist . append ( " -I " + sysconfig . get_config_var ( " INCLUDEPY " ) )
@ -205,7 +196,7 @@ class BuildLibpythonize(Command):
# Link the resulting object file to create a shared library.
cmdlist = [ ' libtool ' ]
cmdlist . append ( " --mode=link " )
cmdlist . append ( " --tag= LD " )
cmdlist . append ( " --tag= CXX " )
# Grab the linker command name
cmdlist . append ( sysconfig . get_config_var ( " LDSHARED " ) . split ( ) [ 0 ] )