# Boost.Iostreams Library Build Jamfile # (C) Copyright Jonathan Turkanis 2004 # 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.) # See http://www.boost.org/libs/iostreams for documentation. project /boost/iostreams : source-location ../src ; # The biggest trick in this Jamfile is to link to zlib and bzip2 when # needed. To configure that, a number of variables are used, which must # be set by user with 'path-constant' either in Boost's root Jamfile, or # in user-config.jam. # For each library with either link to existing binary, or build # a library from the sources. import modules ; import os ; local debug = [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] ; for local v in NO_COMPRESSION NO_ZLIB ZLIB_SOURCE ZLIB_INCLUDE ZLIB_BINARY ZLIB_LIBPATH NO_BZIP2 BZIP2_SOURCE BZIP2_INCLUDE BZIP2_BINARY BZIP2_LIBPATH { $(v) = [ modules.peek : $(v) ] ; } # Given a name of library, either 'zlib', or 'bzip2', creates the necessary # main target and returns it. If compression is disabled, returns nothing. # The 'sources' argument is the list of sources names for the library, # which will be used if building the library. rule create-library ( library-name : windows-name unix-name : sources + : requirements * ) { local LIB = $(library-name:U) ; if ! $(library-name) in zlib bzip2 { EXIT "Wrong library name passed to 'create-library' in libs/iostream/build/Jamfile.v2" ; } if [ os.name ] = NT && ! $($(LIB)_SOURCE) && ! $($(LIB)_INCLUDE) { if $(debug) { ECHO "notice: iostreams: not using $(library-name) compression " ; } NO_$(LIB) = 1 ; # This is necessary to that test Jamfiles don't run compression # tests when not needed. Dirty, but I don't have time to # write full-blow project module for zlib and bzip2. modules.poke : NO_$(LIB) : 1 ; } if $(NO_COMPRESSION) || $(NO_$(LIB)) { if $(debug) { ECHO "notice: iostreams: not using $(library-name) compression " ; } } else { if ! $($(LIB)_INCLUDE) { $(LIB)_INCLUDE = $($(LIB)_SOURCE) ; } # Should we use prebuilt library or build it ourselves? if $($(LIB)_SOURCE) { return [ lib boost_$(library-name) : $($(LIB)_SOURCE)/$(sources).c : $($(LIB)_INCLUDE) $(LIB:L) $(requirements) : : $($(LIB)_INCLUDE) ] ; } else { if $(debug) { ECHO "notice: iostreams: using prebuilt $(library-name)" ; } # Should use prebuilt library. if ! $($(LIB)_BINARY) { # No explicit name specified, guess it. if [ os.name ] = NT { $(LIB)_BINARY = $(windows-name) ; lib boost_$(library-name) : : $(windows-name) ; } else { $(LIB)_BINARY = $(unix-name) ; } } return [ lib boost_$(library-name) : : $($(LIB)_BINARY) $($(LIB)_LIBPATH) : : $($(LIB)_INCLUDE) ] ; } } } local sources = file_descriptor.cpp mapped_file.cpp ; local z = [ create-library zlib : zll z : adler32 compress crc32 deflate gzio infback inffast inflate inftrees trees uncompr zutil : shared:ZLIB_DLL ] ; if $(z) { sources += boost_zlib zlib.cpp ; } local bz2 = [ create-library bzip2 : libbz2 bz2 : blocksort bzlib compress crctable decompress huffman mk251 randtable : shared:$(BZIP2_SOURCE)/libbz2.def ] ; if $(bz2) { sources += boost_bzip2 bzip2.cpp ; } lib boost_iostreams : $(sources) : shared:BOOST_IOSTREAMS_DYN_LINK=1 ;