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_DYN_LINK: Optional: when set link to dll rather than static library.
23 BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name
24 of the library selected (useful for debugging).
26 These macros will be undef'ed at the end of the header, further this header
27 has no include guards - so be sure to include it only once from your library!
32 Libraries for Borland and Microsoft compilers are automatically
33 selected here, the name of the lib is selected according to the following
40 + BOOST_LIB_THREAD_OPT
47 BOOST_LIB_PREFIX: "lib" for static libraries otherwise "".
49 BOOST_LIB_NAME: The base name of the lib ( for example boost_regex).
51 BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc).
53 BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing.
55 BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used,
56 contains one or more of the following letters after
59 s static runtime (dynamic if not present).
60 d debug build (release if not present).
61 g debug/diagnostic runtime (release if not present).
64 BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
67 ***************************************************************************/
70 # ifndef BOOST_CONFIG_HPP
71 # include <boost/config.hpp>
73 #elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__)
75 // C language compatability (no, honestly)
77 # define BOOST_MSVC _MSC_VER
78 # define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
79 # define BOOST_DO_STRINGIZE(X) #X
82 // Only include what follows for known and supported compilers:
84 #if defined(BOOST_MSVC) \
85 || defined(__BORLANDC__) \
86 || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \
87 || (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200))
89 #ifndef BOOST_VERSION_HPP
90 # include <boost/version.hpp>
93 #ifndef BOOST_LIB_NAME
94 # error "Macro BOOST_LIB_NAME not set (internal error)"
100 #if defined(__MSVC_RUNTIME_CHECKS) && !defined(_DEBUG)
101 # pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors")
102 # pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes")
103 # error "Incompatible build options"
108 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1200)
111 # define BOOST_LIB_TOOLSET "vc6"
113 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
116 # define BOOST_LIB_TOOLSET "vc7"
118 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
121 # define BOOST_LIB_TOOLSET "vc71"
123 #elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1400)
126 # define BOOST_LIB_TOOLSET "vc80"
128 #elif defined(__BORLANDC__)
131 # define BOOST_LIB_TOOLSET "bcb"
135 // Intel C++, no version number:
136 # define BOOST_LIB_TOOLSET "iw"
138 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF )
140 // Metrowerks CodeWarrior 8.x
141 # define BOOST_LIB_TOOLSET "cw8"
143 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF )
145 // Metrowerks CodeWarrior 9.x
146 # define BOOST_LIB_TOOLSET "cw9"
151 // select thread opt:
153 #if defined(_MT) || defined(__MT__)
154 # define BOOST_LIB_THREAD_OPT "-mt"
156 # define BOOST_LIB_THREAD_OPT
159 #if defined(_MSC_VER) || defined(__MWERKS__)
163 # if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
165 # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
166 # define BOOST_LIB_RT_OPT "-gdp"
167 # elif defined(_DEBUG)
168 # define BOOST_LIB_RT_OPT "-gdp"
169 # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
170 # error "Build options aren't compatible with pre-built libraries"
172 # define BOOST_LIB_RT_OPT "-p"
175 # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
177 # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
178 # define BOOST_LIB_RT_OPT "-gdpn"
179 # elif defined(_DEBUG)
180 # define BOOST_LIB_RT_OPT "-gdpn"
181 # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
182 # error "Build options aren't compatible with pre-built libraries"
184 # define BOOST_LIB_RT_OPT "-pn"
190 # define BOOST_LIB_RT_OPT "-gd"
192 # define BOOST_LIB_RT_OPT
199 # if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
201 # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
202 # define BOOST_LIB_RT_OPT "-sgdp"
203 # elif defined(_DEBUG)
204 # define BOOST_LIB_RT_OPT "-sgdp"
205 # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
206 # error "Build options aren't compatible with pre-built libraries"
208 # define BOOST_LIB_RT_OPT "-sp"
211 # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
213 # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
214 # define BOOST_LIB_RT_OPT "-sgdpn"
215 # elif defined(_DEBUG)
216 # define BOOST_LIB_RT_OPT "-sgdpn"
217 # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
218 # error "Build options aren't compatible with pre-built libraries"
220 # define BOOST_LIB_RT_OPT "-spn"
226 # define BOOST_LIB_RT_OPT "-sgd"
228 # define BOOST_LIB_RT_OPT "-s"
235 #elif defined(__BORLANDC__)
238 // figure out whether we want the debug builds or not:
240 #pragma defineonoption BOOST_BORLAND_DEBUG -v
244 #if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
245 #error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form"
250 # ifdef BOOST_BORLAND_DEBUG
251 # define BOOST_LIB_RT_OPT "-d"
253 # define BOOST_LIB_RT_OPT
258 # ifdef BOOST_BORLAND_DEBUG
259 # define BOOST_LIB_RT_OPT "-sd"
261 # define BOOST_LIB_RT_OPT "-s"
269 // select linkage opt:
271 #if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK)
272 # define BOOST_LIB_PREFIX
273 #elif defined(BOOST_DYN_LINK)
274 # error "Mixing a dll boost library with a static runtime is a really bad idea..."
276 # define BOOST_LIB_PREFIX "lib"
280 // now include the lib:
282 #if defined(BOOST_LIB_NAME) \
283 && defined(BOOST_LIB_PREFIX) \
284 && defined(BOOST_LIB_TOOLSET) \
285 && defined(BOOST_LIB_THREAD_OPT) \
286 && defined(BOOST_LIB_RT_OPT) \
287 && defined(BOOST_LIB_VERSION)
289 # 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")
290 #ifdef BOOST_LIB_DIAGNOSTIC
291 # 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")
295 # error "some required macros where not defined (internal logic error)."
299 #endif // _MSC_VER || __BORLANDC__
302 // finally undef any macros we may have set:
304 #ifdef BOOST_LIB_PREFIX
305 # undef BOOST_LIB_PREFIX
307 #if defined(BOOST_LIB_NAME)
308 # undef BOOST_LIB_NAME
310 #if defined(BOOST_LIB_TOOLSET)
311 # undef BOOST_LIB_TOOLSET
313 #if defined(BOOST_LIB_THREAD_OPT)
314 # undef BOOST_LIB_THREAD_OPT
316 #if defined(BOOST_LIB_RT_OPT)
317 # undef BOOST_LIB_RT_OPT
319 #if defined(BOOST_LIB_LINK_OPT)
320 # undef BOOST_LIB_LINK_OPT
322 #if defined(BOOST_LIB_DEBUG_OPT)
323 # undef BOOST_LIB_DEBUG_OPT
325 #if defined(BOOST_DYN_LINK)
326 # undef BOOST_DYN_LINK