]> git.lyx.org Git - lyx.git/blob - boost/boost/config/auto_link.hpp
thinko: if we have requires, do not test package
[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 BOOST_AUTO_LINK_TAGGED:   Specifies that we link to libraries built with the --layout=tagged option.
29                           This is essentially the same as the default name-mangled version, but without
30                           the compiler name and version, or the Boost version.  Just the build options.
31
32 These macros will be undef'ed at the end of the header, further this header
33 has no include guards - so be sure to include it only once from your library!
34
35 Algorithm:
36 ~~~~~~~~~~
37
38 Libraries for Borland and Microsoft compilers are automatically
39 selected here, the name of the lib is selected according to the following
40 formula:
41
42 BOOST_LIB_PREFIX
43    + BOOST_LIB_NAME
44    + "_"
45    + BOOST_LIB_TOOLSET
46    + BOOST_LIB_THREAD_OPT
47    + BOOST_LIB_RT_OPT
48    "-"
49    + BOOST_LIB_VERSION
50
51 These are defined as:
52
53 BOOST_LIB_PREFIX:     "lib" for static libraries otherwise "".
54
55 BOOST_LIB_NAME:       The base name of the lib ( for example boost_regex).
56
57 BOOST_LIB_TOOLSET:    The compiler toolset name (vc6, vc7, bcb5 etc).
58
59 BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing.
60
61 BOOST_LIB_RT_OPT:     A suffix that indicates the runtime library used,
62                       contains one or more of the following letters after
63                       a hiphen:
64
65                       s      static runtime (dynamic if not present).
66                       g      debug/diagnostic runtime (release if not present).
67                       y      Python debug/diagnostic runtime (release if not present).
68                       d      debug build (release if not present).
69                       g      debug/diagnostic runtime (release if not present).
70                       p      STLPort Build.
71
72 BOOST_LIB_VERSION:    The Boost version, in the form x_y, for Boost version x.y.
73
74
75 ***************************************************************************/
76
77 #ifdef __cplusplus
78 #  ifndef BOOST_CONFIG_HPP
79 #     include <boost/config.hpp>
80 #  endif
81 #elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__)
82 //
83 // C language compatability (no, honestly)
84 //
85 #  define BOOST_MSVC _MSC_VER
86 #  define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
87 #  define BOOST_DO_STRINGIZE(X) #X
88 #endif
89 //
90 // Only include what follows for known and supported compilers:
91 //
92 #if defined(BOOST_MSVC) \
93     || defined(__BORLANDC__) \
94     || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \
95     || (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200))
96
97 #ifndef BOOST_VERSION_HPP
98 #  include <boost/version.hpp>
99 #endif
100
101 #ifndef BOOST_LIB_NAME
102 #  error "Macro BOOST_LIB_NAME not set (internal error)"
103 #endif
104
105 //
106 // error check:
107 //
108 #if defined(__MSVC_RUNTIME_CHECKS) && !defined(_DEBUG)
109 #  pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors")
110 #  pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes")
111 #  error "Incompatible build options"
112 #endif
113 //
114 // select toolset if not defined already:
115 //
116 #ifndef BOOST_LIB_TOOLSET
117 // Note: no compilers before 1200 are supported
118 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
119
120 #  ifdef UNDER_CE
121      // vc6:
122 #    define BOOST_LIB_TOOLSET "evc4"
123 #  else
124      // vc6:
125 #    define BOOST_LIB_TOOLSET "vc6"
126 #  endif
127
128 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
129
130    // vc7:
131 #  define BOOST_LIB_TOOLSET "vc7"
132
133 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
134
135    // vc71:
136 #  define BOOST_LIB_TOOLSET "vc71"
137
138 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1400)
139
140    // vc80:
141 #  define BOOST_LIB_TOOLSET "vc80"
142
143 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
144
145    // vc90:
146 #  define BOOST_LIB_TOOLSET "vc90"
147
148 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1600)
149
150    // vc10:
151 #  define BOOST_LIB_TOOLSET "vc100"
152
153 #elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1700)
154
155    // vc11:
156 #  define BOOST_LIB_TOOLSET "vc110"
157
158 #elif defined(__BORLANDC__)
159
160    // CBuilder 6:
161 #  define BOOST_LIB_TOOLSET "bcb"
162
163 #elif defined(__ICL)
164
165    // Intel C++, no version number:
166 #  define BOOST_LIB_TOOLSET "iw"
167
168 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF )
169
170    // Metrowerks CodeWarrior 8.x
171 #  define BOOST_LIB_TOOLSET "cw8"
172
173 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF )
174
175    // Metrowerks CodeWarrior 9.x
176 #  define BOOST_LIB_TOOLSET "cw9"
177
178 #endif
179 #endif // BOOST_LIB_TOOLSET
180
181 //
182 // select thread opt:
183 //
184 #if defined(_MT) || defined(__MT__)
185 #  define BOOST_LIB_THREAD_OPT "-mt"
186 #else
187 #  define BOOST_LIB_THREAD_OPT
188 #endif
189
190 #if defined(_MSC_VER) || defined(__MWERKS__)
191
192 #  ifdef _DLL
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                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
198 #            define BOOST_LIB_RT_OPT "-gydp"
199 #        elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
200 #            define BOOST_LIB_RT_OPT "-gdp"
201 #        elif defined(_DEBUG)\
202                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
203 #            define BOOST_LIB_RT_OPT "-gydp"
204 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
205 #            error "Build options aren't compatible with pre-built libraries"
206 #        elif defined(_DEBUG)
207 #            define BOOST_LIB_RT_OPT "-gdp"
208 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
209 #            error "Build options aren't compatible with pre-built libraries"
210 #        else
211 #            define BOOST_LIB_RT_OPT "-p"
212 #        endif
213
214 #     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
215
216 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\
217                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
218 #            define BOOST_LIB_RT_OPT "-gydpn"
219 #        elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
220 #            define BOOST_LIB_RT_OPT "-gdpn"
221 #        elif defined(_DEBUG)\
222                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
223 #            define BOOST_LIB_RT_OPT "-gydpn"
224 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
225 #            error "Build options aren't compatible with pre-built libraries"
226 #        elif defined(_DEBUG)
227 #            define BOOST_LIB_RT_OPT "-gdpn"
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"
230 #        else
231 #            define BOOST_LIB_RT_OPT "-pn"
232 #        endif
233
234 #     else
235
236 #        if defined(_DEBUG) && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
237 #            define BOOST_LIB_RT_OPT "-gyd"
238 #        elif defined(_DEBUG)
239 #            define BOOST_LIB_RT_OPT "-gd"
240 #        else
241 #            define BOOST_LIB_RT_OPT
242 #        endif
243
244 #     endif
245
246 #  else
247
248 #     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
249
250 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\
251                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
252 #            define BOOST_LIB_RT_OPT "-sgydp"
253 #        elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
254 #            define BOOST_LIB_RT_OPT "-sgdp"
255 #        elif defined(_DEBUG)\
256                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
257 #             define BOOST_LIB_RT_OPT "-sgydp"
258 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
259 #            error "Build options aren't compatible with pre-built libraries"
260 #        elif defined(_DEBUG)
261 #             define BOOST_LIB_RT_OPT "-sgdp"
262 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
263 #            error "Build options aren't compatible with pre-built libraries"
264 #        else
265 #            define BOOST_LIB_RT_OPT "-sp"
266 #        endif
267
268 #     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
269
270 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\
271                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
272 #            define BOOST_LIB_RT_OPT "-sgydpn"
273 #        elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
274 #            define BOOST_LIB_RT_OPT "-sgdpn"
275 #        elif defined(_DEBUG)\
276                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
277 #             define BOOST_LIB_RT_OPT "-sgydpn"
278 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
279 #            error "Build options aren't compatible with pre-built libraries"
280 #        elif defined(_DEBUG)
281 #             define BOOST_LIB_RT_OPT "-sgdpn"
282 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
283 #            error "Build options aren't compatible with pre-built libraries"
284 #        else
285 #            define BOOST_LIB_RT_OPT "-spn"
286 #        endif
287
288 #     else
289
290 #        if defined(_DEBUG)\
291                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
292 #             define BOOST_LIB_RT_OPT "-sgyd"
293 #        elif defined(_DEBUG)
294 #             define BOOST_LIB_RT_OPT "-sgd"
295 #        else
296 #            define BOOST_LIB_RT_OPT "-s"
297 #        endif
298
299 #     endif
300
301 #  endif
302
303 #elif defined(__BORLANDC__)
304
305 //
306 // figure out whether we want the debug builds or not:
307 //
308 #if __BORLANDC__ > 0x561
309 #pragma defineonoption BOOST_BORLAND_DEBUG -v
310 #endif
311 //
312 // sanity check:
313 //
314 #if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
315 #error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form"
316 #endif
317
318 #  ifdef _RTLDLL
319
320 #     if defined(BOOST_BORLAND_DEBUG)\
321                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
322 #         define BOOST_LIB_RT_OPT "-yd"
323 #     elif defined(BOOST_BORLAND_DEBUG)
324 #         define BOOST_LIB_RT_OPT "-d"
325 #     elif defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
326 #         define BOOST_LIB_RT_OPT -y
327 #     else
328 #         define BOOST_LIB_RT_OPT
329 #     endif
330
331 #  else
332
333 #     if defined(BOOST_BORLAND_DEBUG)\
334                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
335 #         define BOOST_LIB_RT_OPT "-syd"
336 #     elif defined(BOOST_BORLAND_DEBUG)
337 #         define BOOST_LIB_RT_OPT "-sd"
338 #     elif defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
339 #         define BOOST_LIB_RT_OPT "-sy"
340 #     else
341 #         define BOOST_LIB_RT_OPT "-s"
342 #     endif
343
344 #  endif
345
346 #endif
347
348 //
349 // select linkage opt:
350 //
351 #if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK)
352 #  define BOOST_LIB_PREFIX
353 #elif defined(BOOST_DYN_LINK)
354 #  error "Mixing a dll boost library with a static runtime is a really bad idea..."
355 #else
356 #  define BOOST_LIB_PREFIX "lib"
357 #endif
358
359 //
360 // now include the lib:
361 //
362 #if defined(BOOST_LIB_NAME) \
363       && defined(BOOST_LIB_PREFIX) \
364       && defined(BOOST_LIB_TOOLSET) \
365       && defined(BOOST_LIB_THREAD_OPT) \
366       && defined(BOOST_LIB_RT_OPT) \
367       && defined(BOOST_LIB_VERSION)
368
369 #ifdef BOOST_AUTO_LINK_TAGGED
370 #  pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib")
371 #  ifdef BOOST_LIB_DIAGNOSTIC
372 #     pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib")
373 #  endif
374 #elif defined(BOOST_AUTO_LINK_NOMANGLE)
375 #  pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
376 #  ifdef BOOST_LIB_DIAGNOSTIC
377 #     pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
378 #  endif
379 #else
380 #  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")
381 #  ifdef BOOST_LIB_DIAGNOSTIC
382 #     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")
383 #  endif
384 #endif
385
386 #else
387 #  error "some required macros where not defined (internal logic error)."
388 #endif
389
390
391 #endif // _MSC_VER || __BORLANDC__
392
393 //
394 // finally undef any macros we may have set:
395 //
396 #ifdef BOOST_LIB_PREFIX
397 #  undef BOOST_LIB_PREFIX
398 #endif
399 #if defined(BOOST_LIB_NAME)
400 #  undef BOOST_LIB_NAME
401 #endif
402 // Don't undef this one: it can be set by the user and should be the 
403 // same for all libraries:
404 //#if defined(BOOST_LIB_TOOLSET)
405 //#  undef BOOST_LIB_TOOLSET
406 //#endif
407 #if defined(BOOST_LIB_THREAD_OPT)
408 #  undef BOOST_LIB_THREAD_OPT
409 #endif
410 #if defined(BOOST_LIB_RT_OPT)
411 #  undef BOOST_LIB_RT_OPT
412 #endif
413 #if defined(BOOST_LIB_LINK_OPT)
414 #  undef BOOST_LIB_LINK_OPT
415 #endif
416 #if defined(BOOST_LIB_DEBUG_OPT)
417 #  undef BOOST_LIB_DEBUG_OPT
418 #endif
419 #if defined(BOOST_DYN_LINK)
420 #  undef BOOST_DYN_LINK
421 #endif
422