Update contrib.
1 // (C) Copyright John Maddock 2003.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 * LOCATION: see http://www.boost.org for most recent version.
9 * VERSION see <boost/version.hpp>
10 * DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers.
13 /*************************************************************************
18 Before including this header you must define one or more of define the following macros:
20 BOOST_LIB_NAME: Required: A string containing the basename of the library,
21 for example boost_regex.
22 BOOST_LIB_TOOLSET: Optional: the base name of the toolset.
23 BOOST_DYN_LINK: Optional: when set link to dll rather than static library.
24 BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name
25 of the library selected (useful for debugging).
26 BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib,
27 rather than a mangled-name version.
29 These macros will be undef'ed at the end of the header, further this header
30 has no include guards - so be sure to include it only once from your library!
35 Libraries for Borland and Microsoft compilers are automatically
36 selected here, the name of the lib is selected according to the following
43 + BOOST_LIB_THREAD_OPT
50 BOOST_LIB_PREFIX: "lib" for static libraries otherwise "".
52 BOOST_LIB_NAME: The base name of the lib ( for example boost_regex).
54 BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc).
56 BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing.
58 BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used,
59 contains one or more of the following letters after
62 s static runtime (dynamic if not present).
63 d debug build (release if not present).
64 g debug/diagnostic runtime (release if not present).
67 BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
70 ***************************************************************************/
73 # ifndef BOOST_CONFIG_HPP
74 # include <boost/config.hpp>
76 #elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__)
78 // C language compatability (no, honestly)
80 # define BOOST_MSVC _MSC_VER
81 # define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
82 # define BOOST_DO_STRINGIZE(X) #X
85 // Only include what follows for known and supported compilers:
87 #if defined(BOOST_MSVC) \
88 || defined(__BORLANDC__) \
89 || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \
90 || (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200))
92 #ifndef BOOST_VERSION_HPP
93 # include <boost/version.hpp>
96 #ifndef BOOST_LIB_NAME
97 # error "Macro BOOST_LIB_NAME not set (internal error)"
103 #if defined(__MSVC_RUNTIME_CHECKS) && !defined(_DEBUG)
104 # pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors")
105 # pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes")
106 # error "Incompatible build options"
109 // select toolset if not defined already:
111 #ifndef BOOST_LIB_TOOLSET
112 // Note: no compilers before 1200 are supported
113 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
117 # define BOOST_LIB_TOOLSET "evc4"
120 # define BOOST_LIB_TOOLSET "vc6"
123 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
126 # define BOOST_LIB_TOOLSET "vc7"
128 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
131 # define BOOST_LIB_TOOLSET "vc71"
133 #elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1400)
136 # define BOOST_LIB_TOOLSET "vc80"
138 #elif defined(__BORLANDC__)
141 # define BOOST_LIB_TOOLSET "bcb"
145 // Intel C++, no version number:
146 # define BOOST_LIB_TOOLSET "iw"
148 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF )
150 // Metrowerks CodeWarrior 8.x
151 # define BOOST_LIB_TOOLSET "cw8"
153 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF )
155 // Metrowerks CodeWarrior 9.x
156 # define BOOST_LIB_TOOLSET "cw9"
159 #endif // BOOST_LIB_TOOLSET
162 // select thread opt:
164 #if defined(_MT) || defined(__MT__)
165 # define BOOST_LIB_THREAD_OPT "-mt"
167 # define BOOST_LIB_THREAD_OPT
170 #if defined(_MSC_VER) || defined(__MWERKS__)
174 # if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
176 # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
177 # define BOOST_LIB_RT_OPT "-gdp"
178 # elif defined(_DEBUG)
179 # define BOOST_LIB_RT_OPT "-gdp"
180 # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
181 # error "Build options aren't compatible with pre-built libraries"
183 # define BOOST_LIB_RT_OPT "-p"
186 # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
188 # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
189 # define BOOST_LIB_RT_OPT "-gdpn"
190 # elif defined(_DEBUG)
191 # define BOOST_LIB_RT_OPT "-gdpn"
192 # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
193 # error "Build options aren't compatible with pre-built libraries"
195 # define BOOST_LIB_RT_OPT "-pn"
201 # define BOOST_LIB_RT_OPT "-gd"
203 # define BOOST_LIB_RT_OPT
210 # if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
212 # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
213 # define BOOST_LIB_RT_OPT "-sgdp"
214 # elif defined(_DEBUG)
215 # define BOOST_LIB_RT_OPT "-sgdp"
216 # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
217 # error "Build options aren't compatible with pre-built libraries"
219 # define BOOST_LIB_RT_OPT "-sp"
222 # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
224 # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
225 # define BOOST_LIB_RT_OPT "-sgdpn"
226 # elif defined(_DEBUG)
227 # define BOOST_LIB_RT_OPT "-sgdpn"
228 # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
229 # error "Build options aren't compatible with pre-built libraries"
231 # define BOOST_LIB_RT_OPT "-spn"
237 # define BOOST_LIB_RT_OPT "-sgd"
239 # define BOOST_LIB_RT_OPT "-s"
246 #elif defined(__BORLANDC__)
249 // figure out whether we want the debug builds or not:
251 #if __BORLANDC__ > 0x561
252 #pragma defineonoption BOOST_BORLAND_DEBUG -v
257 #if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
258 #error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form"
263 # ifdef BOOST_BORLAND_DEBUG
264 # define BOOST_LIB_RT_OPT "-d"
266 # define BOOST_LIB_RT_OPT
271 # ifdef BOOST_BORLAND_DEBUG
272 # define BOOST_LIB_RT_OPT "-sd"
274 # define BOOST_LIB_RT_OPT "-s"
282 // select linkage opt:
284 #if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK)
285 # define BOOST_LIB_PREFIX
286 #elif defined(BOOST_DYN_LINK)
287 # error "Mixing a dll boost library with a static runtime is a really bad idea..."
289 # define BOOST_LIB_PREFIX "lib"
293 // now include the lib:
295 #if defined(BOOST_LIB_NAME) \
296 && defined(BOOST_LIB_PREFIX) \
297 && defined(BOOST_LIB_TOOLSET) \
298 && defined(BOOST_LIB_THREAD_OPT) \
299 && defined(BOOST_LIB_RT_OPT) \
300 && defined(BOOST_LIB_VERSION)
302 #ifndef BOOST_AUTO_LINK_NOMANGLE
303 # pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib")
304 # ifdef BOOST_LIB_DIAGNOSTIC
305 # pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib")
308 # pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
309 # ifdef BOOST_LIB_DIAGNOSTIC
310 # pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
315 # error "some required macros where not defined (internal logic error)."
319 #endif // _MSC_VER || __BORLANDC__
322 // finally undef any macros we may have set:
324 #ifdef BOOST_LIB_PREFIX
325 # undef BOOST_LIB_PREFIX
327 #if defined(BOOST_LIB_NAME)
328 # undef BOOST_LIB_NAME
330 // Don't undef this one: it can be set by the user and should be the
331 // same for all libraries:
332 //#if defined(BOOST_LIB_TOOLSET)
333 //# undef BOOST_LIB_TOOLSET
335 #if defined(BOOST_LIB_THREAD_OPT)
336 # undef BOOST_LIB_THREAD_OPT
338 #if defined(BOOST_LIB_RT_OPT)
339 # undef BOOST_LIB_RT_OPT
341 #if defined(BOOST_LIB_LINK_OPT)
342 # undef BOOST_LIB_LINK_OPT
344 #if defined(BOOST_LIB_DEBUG_OPT)
345 # undef BOOST_LIB_DEBUG_OPT
347 #if defined(BOOST_DYN_LINK)
348 # undef BOOST_DYN_LINK
350 #if defined(BOOST_AUTO_LINK_NOMANGLE)
351 # undef BOOST_AUTO_LINK_NOMANGLE