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