diff --git a/bootstrap.sh b/bootstrap.sh index 8523c3db3..c99242ee8 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -57,7 +57,7 @@ my_dir="." if test "x$TOOLSET" = x; then guessed_toolset=`$my_dir/src/engine/build.sh --guess-toolset` case $guessed_toolset in - acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp ) + acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp | xlcpp ) TOOLSET=$guessed_toolset ;; diff --git a/src/engine/build.jam b/src/engine/build.jam index 0263d4637..8e48ecae4 100644 --- a/src/engine/build.jam +++ b/src/engine/build.jam @@ -336,13 +336,22 @@ toolset tru64cxx cc : "-o " : -D [ opt --debug : -g -O0 -pg ] -I$(--python-include) -I$(--extra-include) : -L$(--python-lib[1]) -l$(--python-lib[2]) ; -## IBM VisualAge C++ +## IBM VisualAge C++ or IBM XL C/C++ for Aix or IBM XL C/C++ for Linux (Big endian) toolset vacpp xlc : "-o " : -D : [ opt --release : -s -O3 -qstrict -qinline ] [ opt --debug : -g -qNOOPTimize -qnoinline -pg ] -I$(--python-include) -I$(--extra-include) : -L$(--python-lib[1]) -l$(--python-lib[2]) [ if-os AIX : -bmaxdata:0x40000000 ] ; + +## IBM XL C/C++ for Linux (little endian) +toolset xlcpp xlC : "-o " : -D + : -Wno-unused -Wno-format + [ opt --release : -s ] + [ opt --debug : -g -qNOOPTimize -qnoinline -pg ] + -I$(--python-include) -I$(--extra-include) + : -L$(--python-lib[1]) -l$(--python-lib[2]) ; + ## Microsoft Visual C++ .NET 7.x toolset vc7 cl : /Fe /Fe /Fd /Fo : -D : /nologo diff --git a/src/engine/build.sh b/src/engine/build.sh index 6dbc70633..612011d18 100755 --- a/src/engine/build.sh +++ b/src/engine/build.sh @@ -70,6 +70,15 @@ Guess_Toolset () elif test_uname IRIX64 ; then BOOST_JAM_TOOLSET=mipspro elif test_uname OSF1 ; then BOOST_JAM_TOOLSET=tru64cxx elif test_uname QNX && test_path qcc ; then BOOST_JAM_TOOLSET=qcc + elif test_uname Linux && test_path xlc; then + if /usr/bin/lscpu | grep Byte | grep Little > /dev/null 2>&1 ; then + # Little endian linux + BOOST_JAM_TOOLSET=xlcpp + else + #Big endian linux + BOOST_JAM_TOOLSET=vacpp + fi + elif test_uname AIX && test_path xlc; then BOOST_JAM_TOOLSET=vacpp elif test_path gcc ; then BOOST_JAM_TOOLSET=gcc elif test_path icc ; then BOOST_JAM_TOOLSET=intel-linux elif test -r /opt/intel/cc/9.0/bin/iccvars.sh ; then @@ -89,7 +98,6 @@ Guess_Toolset () BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler50/ia32/ elif test_path pgcc ; then BOOST_JAM_TOOLSET=pgi elif test_path pathcc ; then BOOST_JAM_TOOLSET=pathscale - elif test_path xlc ; then BOOST_JAM_TOOLSET=vacpp elif test_path como ; then BOOST_JAM_TOOLSET=como elif test_path KCC ; then BOOST_JAM_TOOLSET=kcc elif test_path bc++ ; then BOOST_JAM_TOOLSET=kylix @@ -185,6 +193,10 @@ case $BOOST_JAM_TOOLSET in vacpp) BOOST_JAM_CC=xlc ;; + + xlcpp) + BOOST_JAM_CC=xlc + ;; como) BOOST_JAM_CC="como --c" diff --git a/src/tools/xlcpp.jam b/src/tools/xlcpp.jam new file mode 100644 index 000000000..0d6e80cf5 --- /dev/null +++ b/src/tools/xlcpp.jam @@ -0,0 +1,151 @@ +# Copyright Vladimir Prus 2004. +# Copyright Toon Knapen 2004. +# Copyright Catherine Morton 2015. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt +# or copy at http://www.boost.org/LICENSE_1_0.txt) + +# +# Boost.Build V2 toolset for the IBM XL C++ compiler +# + +import toolset : flags ; +import feature ; +import common ; +import generators ; +import os ; + +feature.extend toolset : xlcpp ; +toolset.inherit xlcpp : unix ; +generators.override xlcpp.prebuilt : builtin.prebuilt ; +generators.override xlcpp.searched-lib-generator : searched-lib-generator ; + +# Configure the xlcpp toolset +rule init ( version ? : command * : options * ) +{ + local condition = [ + common.check-init-parameters xlcpp : version $(version) ] ; + + command = [ common.get-invocation-command xlcpp : xlC + : $(command) : "/usr/xlcpp/bin/xlC" ] ; + + common.handle-options xlcpp : $(condition) : $(command) : $(options) ; +} + +# Declare generators +generators.register-c-compiler xlcpp.compile.c : C : OBJ : xlcpp ; +generators.register-c-compiler xlcpp.compile.c++ : CPP : OBJ : xlcpp ; + +# Allow C++ style comments in C files +flags xlcpp CFLAGS : -qnoxlcompatmacros ; + +# Declare flags +flags xlcpp CFLAGS off : -qNOOPTimize ; +flags xlcpp CFLAGS speed : ; +flags xlcpp CFLAGS space : -O2 -qcompact ; + +# Discretionary inlining (not recommended) +flags xlcpp CFLAGS off : -qnoinline ; +flags xlcpp CFLAGS on : -qinline ; +#flags xlcpp CFLAGS full : -qinline ; +flags xlcpp CFLAGS full : ; + +# Exception handling +flags xlcpp C++FLAGS off : -qnoeh ; +flags xlcpp C++FLAGS on : -qeh ; + +# Run-time Type Identification +flags xlcpp C++FLAGS off : -qnortti ; +flags xlcpp C++FLAGS on : -qrtti ; + +# Enable 64-bit memory addressing model +flags xlcpp CFLAGS 64 : -q64 ; +flags xlcpp LINKFLAGS 64 : -q64 ; +flags xlcpp ARFLAGS aix/64 : -X 64 ; + +# Use absolute path when generating debug information +flags xlcpp CFLAGS on : -g -qfullpath ; +flags xlcpp LINKFLAGS on : -g -qfullpath ; +flags xlcpp LINKFLAGS off : -s ; + +if [ os.name ] = AIX +{ + flags xlcpp.compile C++FLAGS : -qfuncsect ; + + # The -bnoipath strips the prepending (relative) path of libraries from + # the loader section in the target library or executable. Hence, during + # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded + # -blibpath (*similar* to -lrpath/-lrpath-link) is searched. Without + # this option, the prepending (relative) path + library name is + # hard-coded in the loader section, causing *only* this path to be + # searched during load-time. Note that the AIX linker does not have an + # -soname equivalent, this is as close as it gets. + # + # The above options are definately for AIX 5.x, and most likely also for + # AIX 4.x and AIX 6.x. For details about the AIX linker see: + # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf + # + flags xlcpp.link LINKFLAGS shared : -bnoipath ; + + # Run-time linking + flags xlcpp.link EXE-LINKFLAGS shared : -brtl ; +} +else +{ + # Linux PPC + flags xlcpp.compile CFLAGS shared : -qpic=large ; + flags xlcpp FINDLIBS : rt ; +} + +# Profiling +flags xlcpp CFLAGS on : -pg ; +flags xlcpp LINKFLAGS on : -pg ; + +flags xlcpp.compile OPTIONS ; +flags xlcpp.compile.c++ OPTIONS ; +flags xlcpp DEFINES ; +flags xlcpp UNDEFS ; +flags xlcpp HDRS ; +flags xlcpp STDHDRS ; +flags xlcpp.link OPTIONS ; +flags xlcpp ARFLAGS ; + +flags xlcpp LIBPATH ; +flags xlcpp NEEDLIBS ; +flags xlcpp FINDLIBS ; +flags xlcpp FINDLIBS ; + +# Select the compiler name according to the threading model. +flags xlcpp VA_C_COMPILER single : xlc ; +flags xlcpp VA_C_COMPILER multi : xlc ; +flags xlcpp VA_CXX_COMPILER single : xlC ; +flags xlcpp VA_CXX_COMPILER multi : xlC ; + +SPACE = " " ; + +flags xlcpp.link.dll HAVE_SONAME linux : "" ; + +actions xlcpp.link bind NEEDLIBS +{ + $(VA_CXX_COMPILER) $(EXE-LINKFLAGS) $(LINKFLAGS) -o "$(<[1])" -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS) +} + +actions xlcpp.link.dll bind NEEDLIBS +{ + xlC -G $(LINKFLAGS) -o "$(<[1])" $(HAVE_SONAME)-Wl,-soname$(SPACE)-Wl,$(<[-1]:D=) -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS) +} + +actions xlcpp.compile.c +{ + $(VA_C_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" +} + +actions xlcpp.compile.c++ +{ + $(VA_CXX_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" +} + +actions updated together piecemeal xlcpp.archive +{ + ar $(ARFLAGS) ru "$(<)" "$(>)" +}