diff --git a/src/engine/build.bat b/src/engine/build.bat index 28d978b24..2bc872ad5 100644 --- a/src/engine/build.bat +++ b/src/engine/build.bat @@ -381,7 +381,7 @@ rename y.tab.h jamgram.h @if "_%BJAM_UPDATE%_" == "_update_" goto Skip_Clean .\bootstrap\jam0 -f build.jam --toolset=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " clean :Skip_Clean -.\bootstrap\jam0 -f build.jam --toolset=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " %1 %2 %3 %4 %5 %6 %7 %8 %9 +.\bootstrap\jam0 -f build.jam --toolset=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " %* :Skip_Jam :Finish diff --git a/src/engine/build.jam b/src/engine/build.jam index 3a7001ae7..e43083710 100644 --- a/src/engine/build.jam +++ b/src/engine/build.jam @@ -17,11 +17,6 @@ VERSION = 3$(.)1$(.)12 ; RELEASE = 1 ; LICENSE = 1_0 ; -HAVE_PYTHON = 0 ; -PYTHON_INCUDES = /usr/include/python2.3 ; -PYTHON_LIB = -lpython2.3 ; - - # Generate development debug binaries? if --debug in $(ARGV) { @@ -41,6 +36,41 @@ if ! ( --release in $(ARGV) ) && ARGV += --release ; } +# Enable, and configure, Python hooks. +with-python = ; +python-location = [ MATCH --with-python=(.*) : $(ARGV) ] ; +if $(python-location) +{ + with-python = true ; +} +if $(with-python) +{ + if $(NT) + { + --python-include = [ .path $(python-location) include ] ; + --python-lib = ; + for local v in 25 24 23 22 + { + --python-lib ?= [ GLOB [ .path $(python-location) libs ] : "python$(v).lib" ] ; + } + } + else + { + --python-include = ; + --python-lib = ; + for local v in 2.5 2.4 2.3 2.2 + { + local inc = [ GLOB [ .path $(python-location) include ] : python$(v) ] ; + local lib = [ GLOB [ .path $(python-location) lib ] : libpython$(v)* ] ; + if $(inc) && $(lib) + { + --python-include ?= $(inc) ; + --python-lib ?= python$(v) ; + } + } + } +} + # An explicit root for the toolset? (trim spaces) toolset-root = [ MATCH --toolset-root=(.*) : $(ARGV) ] ; { @@ -75,59 +105,70 @@ rule opt ( type : yes-opt * : no-opt * ) { if $(type) in $(ARGV) { return $(yes- toolset acc cc : "-o " : -D : -Ae [ opt --release : -s -O3 ] - [ opt --debug : -g -pg ] ; + [ opt --debug : -g -pg ] + -I$(--python-include) ; ## Borland C++ 5.5.x toolset borland bcc32 : -e -n : /D : -WC -w- -q "-I$(toolset-root)Include" "-L$(toolset-root)Lib" [ opt --release : -O2 -vi -w-inl ] - [ opt --debug : -v -Od -vi- ] ; + [ opt --debug : -v -Od -vi- ] + -I$(--python-include) ; ## Generic Unix cc if ! $(CC) { CC = cc ; } toolset cc $(CC) : "-o " : -D : $(CFLAGS) [ opt --release : -s -O ] [ opt --debug : -g ] + -I$(--python-include) : $(LIBS) ; ## Comeau C/C++ 4.x toolset como como : "-o " : -D : --c [ opt --release : --inlining ] - [ opt --debug : --no_inlining ] ; + [ opt --debug : --no_inlining ] + -I$(--python-include) ; ## MacOSX Darwin, using GCC 2.9.x, 3.x toolset darwin cc : "-o " : -D : [ opt --release : -Wl,-x -O3 -finline-functions ] - [ opt --debug : -g -O0 -fno-inline -pg ] ; + [ opt --debug : -g -O0 -fno-inline -pg ] + -I$(--python-include) ; ## GCC 2.x, 3.x, 4.x toolset gcc gcc : "-o " : -D : -pedantic [ opt --release : [ opt --symbols : -g : -s ] -O3 ] - [ opt --debug : -g -O0 -fno-inline ] ; + [ opt --debug : -g -O0 -fno-inline ] + -I$(--python-include) ; ## GCC 2.x, 3.x on CYGWIN but without cygwin1.dll toolset gcc-nocygwin gcc : "-o " : -D : -s -O3 -mno-cygwin [ opt --release : -finline-functions ] - [ opt --debug : -s -O3 -fno-inline -pg ] ; + [ opt --debug : -s -O3 -fno-inline -pg ] + -I$(--python-include) ; ## Intel C/C++ for Linux toolset intel-linux icc : "-o " : -D : [ opt --release : -Xlinker -s -O3 ] - [ opt --debug : -g -O0 -p ] ; + [ opt --debug : -g -O0 -p ] + -I$(--python-include) ; ## Intel C/C++ for Win32 toolset intel-win32 icl : /Fe : -D : /nologo [ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ] - [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ] ; + [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ] + -I$(--python-include) ; ## KCC ? toolset kcc KCC : "-o " : -D : [ opt --release : -s +K2 ] - [ opt --debug : -g +K0 ] ; + [ opt --debug : -g +K0 ] + -I$(--python-include) ; ## Borland Kylix toolset kylix bc++ : -o : -D : -tC -q [ opt --release : -O2 -vi -w-inl ] - [ opt --debug : -v -Od -vi- ] ; + [ opt --debug : -v -Od -vi- ] + -I$(--python-include) ; ## Metrowerks CodeWarrior 8.x { # Even though CW can compile all files at once, it crashes if it tries in the bjam case. @@ -136,7 +177,8 @@ toolset kylix bc++ : -o : -D toolset metrowerks $(mwcc) : "-o " : -D : -c -lang c -subsystem console -cwd include [ opt --release : -runtime ss -opt full -inline all ] - [ opt --debug : -runtime ssd -opt none -inline off ] ; + [ opt --debug : -runtime ssd -opt none -inline off ] + -I$(--python-include) ; toolset metrowerks $(mwcc) .link : "-o " : : -subsystem console -ladvapi32.lib [ opt --release : -runtime ss ] @@ -146,38 +188,46 @@ toolset kylix bc++ : -o : -D toolset mingw gcc : "-o " : -D : [ opt --release : -s -O3 -finline-functions ] - [ opt --debug : -g -O0 -fno-inline -pg ] ; + [ opt --debug : -g -O0 -fno-inline -pg ] + -I$(--python-include) ; ## MIPS Pro toolset mipspro cc : "-o " : -D : [ opt --release : -s -O3 -g0 -INLINE:none ] - [ opt --debug : -g -O0 -INLINE ] ; + [ opt --debug : -g -O0 -INLINE ] + -I$(--python-include) ; ## Microsoft Visual Studio C++ 6.x toolset msvc cl : /Fe : -D : /nologo [ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ] [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ] + -I$(--python-include) : kernel32.lib advapi32.lib ; ## Sun Workshop 6 C++ toolset sunpro cc : "-o " : -D : [ opt --release : -s -fast -xO4 ] - [ opt --debug : -g ] ; + [ opt --debug : -g ] + -xarch=generic + -I$(--python-include) ; ## Compaq Alpha CXX toolset tru64cxx cc : "-o " : -D : [ opt --release : -s -O5 -inline speed ] - [ opt --debug : -g -O0 -pg ] ; + [ opt --debug : -g -O0 -pg ] + -I$(--python-include) ; ## IBM VisualAge C++ toolset vacpp xlc : "-o " : -D : [ opt --release : -s -O3 -qstrict -qinline ] - [ opt --debug : -g -qNOOPTimize -qnoinline -pg ] ; + [ opt --debug : -g -qNOOPTimize -qnoinline -pg ] + -I$(--python-include) ; ## Microsoft Visual C++ .NET 7.x toolset vc7 cl : /Fe : -D : /nologo [ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ] [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ] + -I$(--python-include) : kernel32.lib advapi32.lib ; ## VMS/OpenVMS DEC C toolset vmsdecc cc : /OBJECT= : "/DEFINES=(" "," ")" @@ -337,12 +387,11 @@ if $(VMS) } --defs += YYSTACKSIZE=5000 ; -if $(HAVE_PYTHON) = 1 +if $(with-python) { --defs += HAVE_PYTHON ; - --flags += -I$(PYTHON_INCUDES) ; - --flags += -Wno-long-long ; - --libs += $(PYTHON_LIB) ; + #~ --flags += -Wno-long-long ; + --libs += $(--python-lib) ; } diff --git a/src/engine/build.sh b/src/engine/build.sh index 732d7985e..0d08f2d40 100755 --- a/src/engine/build.sh +++ b/src/engine/build.sh @@ -161,11 +161,12 @@ case $BOOST_JAM_TOOLSET in ;; sunpro) - if test -r /opt/SUNWspro/bin/cc ; then + if test -z "${BOOST_JAM_TOOLSET_ROOT}" -a -r /opt/SUNWspro/bin/cc ; then BOOST_JAM_TOOLSET_ROOT=/opt/SUNWspro/ fi - if test -r $BOOST_JAM_TOOLSET_ROOTbin/cc ; then - export PATH=$BOOST_JAM_TOOLSET_ROOTbin:$PATH + if test -r "${BOOST_JAM_TOOLSET_ROOT}bin/cc" ; then + PATH=${BOOST_JAM_TOOLSET_ROOT}bin:${PATH} + export PATH fi BOOST_JAM_CC=cc ;;