]> git.lyx.org Git - lyx.git/blob - boost/boost/config/auto_link.hpp
update boost to version 1.36
[lyx.git] / boost / boost / config / auto_link.hpp
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)
5
6  /*
7   *   LOCATION:    see http://www.boost.org for most recent version.
8   *   FILE         auto_link.hpp
9   *   VERSION      see <boost/version.hpp>
10   *   DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers.
11   */
12
13 /*************************************************************************
14
15 USAGE:
16 ~~~~~~
17
18 Before including this header you must define one or more of define the following macros:
19
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.
28
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!
31
32 Algorithm:
33 ~~~~~~~~~~
34
35 Libraries for Borland and Microsoft compilers are automatically
36 selected here, the name of the lib is selected according to the following
37 formula:
38
39 BOOST_LIB_PREFIX
40    + BOOST_LIB_NAME
41    + "_"
42    + BOOST_LIB_TOOLSET
43    + BOOST_LIB_THREAD_OPT
44    + BOOST_LIB_RT_OPT
45    "-"
46    + BOOST_LIB_VERSION
47
48 These are defined as:
49
50 BOOST_LIB_PREFIX:     "lib" for static libraries otherwise "".
51
52 BOOST_LIB_NAME:       The base name of the lib ( for example boost_regex).
53
54 BOOST_LIB_TOOLSET:    The compiler toolset name (vc6, vc7, bcb5 etc).
55
56 BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing.
57
58 BOOST_LIB_RT_OPT:     A suffix that indicates the runtime library used,
59                       contains one or more of the following letters after
60                       a hiphen:
61
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).
65                       p      STLPort Build.
66
67 BOOST_LIB_VERSION:    The Boost version, in the form x_y, for Boost version x.y.
68
69
70 ***************************************************************************/
71
72 #ifdef __cplusplus
73 #  ifndef BOOST_CONFIG_HPP
74 #     include <boost/config.hpp>
75 #  endif
76 #elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__)
77 //
78 // C language compatability (no, honestly)
79 //
80 #  define BOOST_MSVC _MSC_VER
81 #  define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
82 #  define BOOST_DO_STRINGIZE(X) #X
83 #endif
84 //
85 // Only include what follows for known and supported compilers:
86 //
87 #if defined(BOOST_MSVC) \
88     || defined(__BORLANDC__) \
89     || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \
90     || (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200))
91
92 #ifndef BOOST_VERSION_HPP
93 #  include <boost/version.hpp>
94 #endif
95
96 #ifndef BOOST_LIB_NAME
97 #  error "Macro BOOST_LIB_NAME not set (internal error)"
98 #endif
99
100 //
101 // error check:
102 //
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"
107 #endif
108 //
109 // select toolset if not defined already:
110 //
111 #ifndef BOOST_LIB_TOOLSET
112 // Note: no compilers before 1200 are supported
113 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
114
115 #  ifdef UNDER_CE
116      // vc6:
117 #    define BOOST_LIB_TOOLSET "evc4"
118 #  else
119      // vc6:
120 #    define BOOST_LIB_TOOLSET "vc6"
121 #  endif
122
123 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
124
125    // vc7:
126 #  define BOOST_LIB_TOOLSET "vc7"
127
128 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
129
130    // vc71:
131 #  define BOOST_LIB_TOOLSET "vc71"
132
133 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1400)
134
135    // vc80:
136 #  define BOOST_LIB_TOOLSET "vc80"
137
138 #elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1500)
139
140    // vc90:
141 #  define BOOST_LIB_TOOLSET "vc90"
142
143 #elif defined(__BORLANDC__)
144
145    // CBuilder 6:
146 #  define BOOST_LIB_TOOLSET "bcb"
147
148 #elif defined(__ICL)
149
150    // Intel C++, no version number:
151 #  define BOOST_LIB_TOOLSET "iw"
152
153 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF )
154
155    // Metrowerks CodeWarrior 8.x
156 #  define BOOST_LIB_TOOLSET "cw8"
157
158 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF )
159
160    // Metrowerks CodeWarrior 9.x
161 #  define BOOST_LIB_TOOLSET "cw9"
162
163 #endif
164 #endif // BOOST_LIB_TOOLSET
165
166 //
167 // select thread opt:
168 //
169 #if defined(_MT) || defined(__MT__)
170 #  define BOOST_LIB_THREAD_OPT "-mt"
171 #else
172 #  define BOOST_LIB_THREAD_OPT
173 #endif
174
175 #if defined(_MSC_VER) || defined(__MWERKS__)
176
177 #  ifdef _DLL
178
179 #     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
180
181 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
182 #            define BOOST_LIB_RT_OPT "-gdp"
183 #        elif defined(_DEBUG)
184 #            define BOOST_LIB_RT_OPT "-gdp"
185 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
186 #            error "Build options aren't compatible with pre-built libraries"
187 #        else
188 #            define BOOST_LIB_RT_OPT "-p"
189 #        endif
190
191 #     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
192
193 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
194 #            define BOOST_LIB_RT_OPT "-gdpn"
195 #        elif defined(_DEBUG)
196 #            define BOOST_LIB_RT_OPT "-gdpn"
197 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
198 #            error "Build options aren't compatible with pre-built libraries"
199 #        else
200 #            define BOOST_LIB_RT_OPT "-pn"
201 #        endif
202
203 #     else
204
205 #        if defined(_DEBUG)
206 #            define BOOST_LIB_RT_OPT "-gd"
207 #        else
208 #            define BOOST_LIB_RT_OPT
209 #        endif
210
211 #     endif
212
213 #  else
214
215 #     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
216
217 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
218 #            define BOOST_LIB_RT_OPT "-sgdp"
219 #        elif defined(_DEBUG)
220 #             define BOOST_LIB_RT_OPT "-sgdp"
221 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
222 #            error "Build options aren't compatible with pre-built libraries"
223 #        else
224 #            define BOOST_LIB_RT_OPT "-sp"
225 #        endif
226
227 #     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
228
229 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
230 #            define BOOST_LIB_RT_OPT "-sgdpn"
231 #        elif defined(_DEBUG)
232 #             define BOOST_LIB_RT_OPT "-sgdpn"
233 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
234 #            error "Build options aren't compatible with pre-built libraries"
235 #        else
236 #            define BOOST_LIB_RT_OPT "-spn"
237 #        endif
238
239 #     else
240
241 #        if defined(_DEBUG)
242 #             define BOOST_LIB_RT_OPT "-sgd"
243 #        else
244 #            define BOOST_LIB_RT_OPT "-s"
245 #        endif
246
247 #     endif
248
249 #  endif
250
251 #elif defined(__BORLANDC__)
252
253 //
254 // figure out whether we want the debug builds or not:
255 //
256 #if __BORLANDC__ > 0x561
257 #pragma defineonoption BOOST_BORLAND_DEBUG -v
258 #endif
259 //
260 // sanity check:
261 //
262 #if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
263 #error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form"
264 #endif
265
266 #  ifdef _RTLDLL
267
268 #     ifdef BOOST_BORLAND_DEBUG
269 #         define BOOST_LIB_RT_OPT "-d"
270 #     else
271 #         define BOOST_LIB_RT_OPT
272 #     endif
273
274 #  else
275
276 #     ifdef BOOST_BORLAND_DEBUG
277 #         define BOOST_LIB_RT_OPT "-sd"
278 #     else
279 #         define BOOST_LIB_RT_OPT "-s"
280 #     endif
281
282 #  endif
283
284 #endif
285
286 //
287 // select linkage opt:
288 //
289 #if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK)
290 #  define BOOST_LIB_PREFIX
291 #elif defined(BOOST_DYN_LINK)
292 #  error "Mixing a dll boost library with a static runtime is a really bad idea..."
293 #else
294 #  define BOOST_LIB_PREFIX "lib"
295 #endif
296
297 //
298 // now include the lib:
299 //
300 #if defined(BOOST_LIB_NAME) \
301       && defined(BOOST_LIB_PREFIX) \
302       && defined(BOOST_LIB_TOOLSET) \
303       && defined(BOOST_LIB_THREAD_OPT) \
304       && defined(BOOST_LIB_RT_OPT) \
305       && defined(BOOST_LIB_VERSION)
306
307 #ifndef BOOST_AUTO_LINK_NOMANGLE
308 #  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")
309 #  ifdef BOOST_LIB_DIAGNOSTIC
310 #     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")
311 #  endif
312 #else
313 #  pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
314 #  ifdef BOOST_LIB_DIAGNOSTIC
315 #     pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
316 #  endif
317 #endif
318
319 #else
320 #  error "some required macros where not defined (internal logic error)."
321 #endif
322
323
324 #endif // _MSC_VER || __BORLANDC__
325
326 //
327 // finally undef any macros we may have set:
328 //
329 #ifdef BOOST_LIB_PREFIX
330 #  undef BOOST_LIB_PREFIX
331 #endif
332 #if defined(BOOST_LIB_NAME)
333 #  undef BOOST_LIB_NAME
334 #endif
335 // Don't undef this one: it can be set by the user and should be the 
336 // same for all libraries:
337 //#if defined(BOOST_LIB_TOOLSET)
338 //#  undef BOOST_LIB_TOOLSET
339 //#endif
340 #if defined(BOOST_LIB_THREAD_OPT)
341 #  undef BOOST_LIB_THREAD_OPT
342 #endif
343 #if defined(BOOST_LIB_RT_OPT)
344 #  undef BOOST_LIB_RT_OPT
345 #endif
346 #if defined(BOOST_LIB_LINK_OPT)
347 #  undef BOOST_LIB_LINK_OPT
348 #endif
349 #if defined(BOOST_LIB_DEBUG_OPT)
350 #  undef BOOST_LIB_DEBUG_OPT
351 #endif
352 #if defined(BOOST_DYN_LINK)
353 #  undef BOOST_DYN_LINK
354 #endif
355 #if defined(BOOST_AUTO_LINK_NOMANGLE)
356 #  undef BOOST_AUTO_LINK_NOMANGLE
357 #endif
358
359
360
361
362
363
364
365
366
367
368