blob: 375a0be2e0fb0969ca03dc36af42265abaaec5ea [file] [log] [blame]
[/
Copyright 2006-2007 John Maddock.
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).
]
[section:install Building and Installing the Library]
When you extract the library from its zip file, you must preserve its internal
directory structure (for example by using the -d option when extracting). If you
didn't do that when extracting, then you'd better stop reading this, delete the
files you just extracted, and try again!
This library should not need configuring before use; most popular compilers\/standard
libraries\/platforms are already supported "as is". If you do experience configuration
problems, or just want to test the configuration with your compiler, then the
process is the same as for all of boost; see the
[@../../../config/index.html configuration library documentation].
The library will encase all code inside namespace boost.
Unlike some other template libraries, this library consists of a mixture of
template code (in the headers) and static code and data (in cpp files).
Consequently it is necessary to build the library's support code into a
library or archive file before you can use it, instructions for specific
platforms are as follows:
[h4 Building with bjam]
This is now the preferred method for building and installing this library,
please refer to the
[@../../../../more/getting_started.html getting started guide] for more information.
[h4 Building With Unicode and ICU Support]
Boost.Regex is now capable of performing a configuration check
to test whether ICU is already installed in your compiler's
search paths. When you build you should see a message like
this:
Performing configuration checks
- has_icu builds : yes
Whick means that ICU has been found, and support for it will be enabled
in the library build.
[tip If you don't want the regex library to use ICU then build with the
"--disable-icu" command line option.]
If instead you see:
Performing configuration checks
- has_icu builds : no
Then ICU was not found and support for it will not be compiled into the library.
If you think that it should have been found, then you will need to take a look
at the contents of the file ['boost-root/bin.v2/config.log] for the actual error
messages obtained when the build carried out the configuration check. You will
then need to fix these errors by ensuring your compiler gets invoked with the correct
options, for example:
[pre bjam include=some-include-path --toolset=toolset-name install]
will add "some-include-path" to your compilers header include path, or if ICU
has been built with non-standard names for it's binaries, then:
[pre bjam -sICU_LINK="linker-options-for-icu" --toolset=toolset-name install]
Will use ['"linker-options-for-icu"] when linking the library rather than the default
ICU binary names.
You might also need to use the options "cxxflags=-option" and "linkflags=-option" to set compiler and linker
specific options.
[important Configuration results are cached - if you try rebuilding with different compiler
options then add an "-a" to the bjam command line to force all targets to be rebuilt.]
If ICU is not already in your compiler's path, but instead headers, libraries and binaries
are located at ['path-to-icu/include], ['path-to-icu/lib] and ['path-to-icu/bin] respectively
then you need to set the environment variable `ICU_PATH` to point to the root directory of your
ICU installation: this typically happens if you're building with MSVC.
For example if ICU was installed to `c:\download\icu` you
might use:
[pre bjam -sICU_PATH=c:\download\icu --toolset=toolset-name install]
[important ICU is a C++ library just like Boost is, as such your copy of
ICU must have been built with the same C++ compiler (and compiler version)
that you are using to build Boost. Boost.Regex will not work correctly unless
you ensure that this is the case: it is up to you to ensure that the version
of ICU you are using is binary compatible with the toolset you use to build Boost.]
[h4 Building via makefiles]
[h5 Borland C++ Builder:]
* Open up a console window and change to the `<boost>\libs\regex\build` directory.
* Select the appropriate makefile (bcb4.mak for C++ Builder 4, bcb5.mak for C++ Builder 5, and bcb6.mak for C++ Builder 6).
* Invoke the makefile (pass the full path to your version of make if you have more than one version installed, the makefile relies on the path to make to obtain your C++ Builder installation directory and tools) for example:
[pre make -fbcb5.mak]
The build process will build a variety of .lib and .dll files (the exact number
depends upon the version of Borland's tools you are using) the .lib and dll
files will be in a sub-directory called bcb4 or bcb5 depending upon the
makefile used. To install the libraries into your development system use:
[pre make -fbcb5.mak install]
library files will be copied to `<BCROOT>/lib` and the dll's to `<BCROOT>/bin`,
where `<BCROOT>` corresponds to the install path of your Borland C++ tools.
You may also remove temporary files created during the build process
(excluding lib and dll files) by using:
[pre make -fbcb5.mak clean]
Finally when you use Boost.Regex it is only necessary for you to add the
`<boost>` root director to your list of include directories for that project.
It is not necessary for you to manually add a .lib file to the project;
the headers will automatically select the correct .lib file for your build mode
and tell the linker to include it. There is one caveat however: the library
can not tell the difference between VCL and non-VCL enabled builds when building
a GUI application from the command line, if you build from the command line
with the 5.5 command line tools then you must define the pre-processor symbol
_NO_VCL in order to ensure that the correct link libraries are selected: the
C++ Builder IDE normally sets this automatically. Hint, users of the
5.5 command line tools may want to add a -D_NO_VCL to bcc32.cfg in order to
set this option permanently.
If you would prefer to do a dynamic link to the regex libraries when using the
dll runtime then define BOOST_REGEX_DYN_LINK (you must do this if you want to
use Boost.Regex in multiple dll's), otherwise Boost.Regex will be statically
linked by default.
If you want to suppress automatic linking altogether (and supply your own
custom build of the lib) then define BOOST_REGEX_NO_LIB.
If you are building with C++ Builder 6, you will find that `<boost/regex.hpp>` can
not be used in a pre-compiled header (the actual problem is in `<locale>` which
gets included by `<boost/regex.hpp>`), if this causes problems for you,
then try defining BOOST_NO_STD_LOCALE when building, this will disable some
features throughout boost, but may save you a lot in compile times!
[h4 Microsoft Visual C++ 6, 7, 7.1 and 8]
You need version 6 or later of MSVC to build this library. If you are using VC5
then you may want to look at one of the previous releases of this library.
Open up a command prompt, which has the necessary MSVC environment variables
defined (for example by using the batch file Vcvars32.bat installed by the
Visual Studio installation), and change to the `<boost>\libs\regex\build directory`.
Select the correct makefile - vc6.mak for "vanilla" Visual C++ 6 or
vc6-stlport.mak if you are using STLPort.
Invoke the makefile like this:
[pre nmake -fvc6.mak]
You will now have a collection of lib and dll files in a "vc6" subdirectory, to
install these into your development system use:
[pre nmake -fvc6.mak install]
The lib files will be copied to your `<VC6>\lib` directory and the dll files to
`<VC6>\bin`, where `<VC6>` is the root of your Visual C++ 6 installation.
You can delete all the temporary files created during the build (excluding lib and
dll files) using:
[pre nmake -fvc6.mak clean ]
If you want to build with ICU support, then you need to pass the path to your
ICU directory to the makefile, for example with:
[pre nmake ICU_PATH=c:\open-source\icu -fvc71.mak install]
Finally when you use Boost.Regex it is only necessary for you to add the
`<boost>` root directory to your list of include directories for that project.
It is not necessary for you to manually add a .lib file to the project;
the headers will automatically select the correct .lib file for your build mode
and tell the linker to include it.
Note that if you want to dynamically link to the regex library when using the
dynamic C++ runtime, define BOOST_REGEX_DYN_LINK when building your project.
If you want to add the source directly to your project then define
BOOST_REGEX_NO_LIB to disable automatic library selection.
There are several important caveats to remember when using Boost.Regex with
Microsoft's Compiler:
* There have been some reports of compiler-optimization bugs affecting this library,
(particularly with VC6 versions prior to service patch 5) the workaround is to
build the library using /Oityb1 rather than /O2. That is to use all optimization settings
except /Oa. This problem is reported to affect some standard library code as well (
in fact I'm not sure if the problem is with the regex code or the underlying standard library),
so it's probably worthwhile applying this workaround in normal practice in any case.
* If you have replaced the C++ standard library that comes with VC6, then when you
build the library you must ensure that the environment variables "INCLUDE" and "LIB"
have been updated to reflect the include and library paths for the new library - see
vcvars32.bat (part of your Visual Studio installation) for more details.
* If you are building with the full STLPort v4.x, then use the vc6-stlport.mak
file provided and set the environment variable STLPORT_PATH to point to the location of
your STLPort installation (Note that the full STLPort libraries appear not to
support single-thread static builds).
* If you are building your application with /Zc:wchar_t then you will need to
modify the makefile to add /Zc:wchar_t before building the library.
[h5 GCC(2.95 and later)]
You can build with gcc using the normal boost Jamfile in `<boost>/libs/regex/build`,
alternatively there is a conservative makefile for the g++ compiler. From
the command prompt change to the <boost>/libs/regex/build directory and type:
[pre make -fgcc.mak ]
At the end of the build process you should have a gcc sub-directory containing
release and debug versions of the library (libboost_regex.a and libboost_regex_debug.a). When you build projects that use regex++, you will need to add the boost install directory to your list of include paths and add <boost>/libs/regex/build/gcc/libboost_regex.a to your list of library files.
There is also a makefile to build the library as a shared library:
[pre make -fgcc-shared.mak]
which will build libboost_regex.so and libboost_regex_debug.so.
Both of the these makefiles support the following environment variables:
ICU_PATH: tells the makefile to build with Unicode support, set to the path where your ICU installation is located, for example with: make ICU_PATH=/usr/local install -fgcc.mak
CXXFLAGS: extra compiler options - note that this applies to both the debug and release builds.
INCLUDES: additional include directories.
LDFLAGS: additional linker options.
LIBS: additional library files.
For the more adventurous there is a configure script in `<boost>/libs/config`; see
the [@../../../config/index.html config library documentation].
[h5 Sun Workshop 6.1]
There is a makefile for the sun (6.1) compiler (C++ version 3.12). From the command
prompt change to the `<boost>/libs/regex/build` directory and type:
[pre dmake -f sunpro.mak ]
At the end of the build process you should have a sunpro sub-directory containing single
and multithread versions of the library (libboost_regex.a, libboost_regex.so,
libboost_regex_mt.a and libboost_regex_mt.so). When you build projects that use
Boost.Regex, you will need to add the boost install directory to your list of
include paths and add `<boost>/libs/regex/build/sunpro/` to your library search path.
Both of the these makefiles support the following environment variables:
CXXFLAGS: extra compiler options - note that this applies to both the single and multithreaded builds.
INCLUDES: additional include directories.
LDFLAGS: additional linker options.
LIBS: additional library files.
LIBSUFFIX: a suffix to mangle the library name with (defaults to nothing).
This makefile does not set any architecture specific options like -xarch=v9, you can set these by defining the appropriate macros, for example:
[pre dmake CXXFLAGS="-xarch=v9" LDFLAGS="-xarch=v9" LIBSUFFIX="_v9" -f sunpro.mak]
will build v9 variants of the regex library named libboost_regex_v9.a etc.
[h5 Makefiles for Other compilers]
There is a generic makefile (generic.mak ) provided in `<boost-root>/libs/regex/build`
- see that makefile for details of environment variables that need to be set
before use.
[endsect]