]> git.donarmstrong.com Git - rsem.git/blob - boost/config/auto_link.hpp
0d17eb8fea8be7b3120f4b1b27c2b4fc0972f939
[rsem.git] / 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(__BORLANDC__)
154
155    // CBuilder 6:
156 #  define BOOST_LIB_TOOLSET "bcb"
157
158 #elif defined(__ICL)
159
160    // Intel C++, no version number:
161 #  define BOOST_LIB_TOOLSET "iw"
162
163 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF )
164
165    // Metrowerks CodeWarrior 8.x
166 #  define BOOST_LIB_TOOLSET "cw8"
167
168 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF )
169
170    // Metrowerks CodeWarrior 9.x
171 #  define BOOST_LIB_TOOLSET "cw9"
172
173 #endif
174 #endif // BOOST_LIB_TOOLSET
175
176 //
177 // select thread opt:
178 //
179 #if defined(_MT) || defined(__MT__)
180 #  define BOOST_LIB_THREAD_OPT "-mt"
181 #else
182 #  define BOOST_LIB_THREAD_OPT
183 #endif
184
185 #if defined(_MSC_VER) || defined(__MWERKS__)
186
187 #  ifdef _DLL
188
189 #     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
190
191 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\
192                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
193 #            define BOOST_LIB_RT_OPT "-gydp"
194 #        elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
195 #            define BOOST_LIB_RT_OPT "-gdp"
196 #        elif defined(_DEBUG)\
197                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
198 #            define BOOST_LIB_RT_OPT "-gydp"
199 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
200 #            error "Build options aren't compatible with pre-built libraries"
201 #        elif defined(_DEBUG)
202 #            define BOOST_LIB_RT_OPT "-gdp"
203 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
204 #            error "Build options aren't compatible with pre-built libraries"
205 #        else
206 #            define BOOST_LIB_RT_OPT "-p"
207 #        endif
208
209 #     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
210
211 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\
212                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
213 #            define BOOST_LIB_RT_OPT "-gydpn"
214 #        elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
215 #            define BOOST_LIB_RT_OPT "-gdpn"
216 #        elif defined(_DEBUG)\
217                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
218 #            define BOOST_LIB_RT_OPT "-gydpn"
219 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
220 #            error "Build options aren't compatible with pre-built libraries"
221 #        elif defined(_DEBUG)
222 #            define BOOST_LIB_RT_OPT "-gdpn"
223 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
224 #            error "Build options aren't compatible with pre-built libraries"
225 #        else
226 #            define BOOST_LIB_RT_OPT "-pn"
227 #        endif
228
229 #     else
230
231 #        if defined(_DEBUG) && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
232 #            define BOOST_LIB_RT_OPT "-gyd"
233 #        elif defined(_DEBUG)
234 #            define BOOST_LIB_RT_OPT "-gd"
235 #        else
236 #            define BOOST_LIB_RT_OPT
237 #        endif
238
239 #     endif
240
241 #  else
242
243 #     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
244
245 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\
246                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
247 #            define BOOST_LIB_RT_OPT "-sgydp"
248 #        elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
249 #            define BOOST_LIB_RT_OPT "-sgdp"
250 #        elif defined(_DEBUG)\
251                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
252 #             define BOOST_LIB_RT_OPT "-sgydp"
253 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
254 #            error "Build options aren't compatible with pre-built libraries"
255 #        elif defined(_DEBUG)
256 #             define BOOST_LIB_RT_OPT "-sgdp"
257 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
258 #            error "Build options aren't compatible with pre-built libraries"
259 #        else
260 #            define BOOST_LIB_RT_OPT "-sp"
261 #        endif
262
263 #     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
264
265 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\
266                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
267 #            define BOOST_LIB_RT_OPT "-sgydpn"
268 #        elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
269 #            define BOOST_LIB_RT_OPT "-sgdpn"
270 #        elif defined(_DEBUG)\
271                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
272 #             define BOOST_LIB_RT_OPT "-sgydpn"
273 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
274 #            error "Build options aren't compatible with pre-built libraries"
275 #        elif defined(_DEBUG)
276 #             define BOOST_LIB_RT_OPT "-sgdpn"
277 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
278 #            error "Build options aren't compatible with pre-built libraries"
279 #        else
280 #            define BOOST_LIB_RT_OPT "-spn"
281 #        endif
282
283 #     else
284
285 #        if defined(_DEBUG)\
286                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
287 #             define BOOST_LIB_RT_OPT "-sgyd"
288 #        elif defined(_DEBUG)
289 #             define BOOST_LIB_RT_OPT "-sgd"
290 #        else
291 #            define BOOST_LIB_RT_OPT "-s"
292 #        endif
293
294 #     endif
295
296 #  endif
297
298 #elif defined(__BORLANDC__)
299
300 //
301 // figure out whether we want the debug builds or not:
302 //
303 #if __BORLANDC__ > 0x561
304 #pragma defineonoption BOOST_BORLAND_DEBUG -v
305 #endif
306 //
307 // sanity check:
308 //
309 #if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
310 #error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form"
311 #endif
312
313 #  ifdef _RTLDLL
314
315 #     if defined(BOOST_BORLAND_DEBUG)\
316                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
317 #         define BOOST_LIB_RT_OPT "-yd"
318 #     elif defined(BOOST_BORLAND_DEBUG)
319 #         define BOOST_LIB_RT_OPT "-d"
320 #     elif defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
321 #         define BOOST_LIB_RT_OPT -y
322 #     else
323 #         define BOOST_LIB_RT_OPT
324 #     endif
325
326 #  else
327
328 #     if defined(BOOST_BORLAND_DEBUG)\
329                && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
330 #         define BOOST_LIB_RT_OPT "-syd"
331 #     elif defined(BOOST_BORLAND_DEBUG)
332 #         define BOOST_LIB_RT_OPT "-sd"
333 #     elif defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
334 #         define BOOST_LIB_RT_OPT "-sy"
335 #     else
336 #         define BOOST_LIB_RT_OPT "-s"
337 #     endif
338
339 #  endif
340
341 #endif
342
343 //
344 // select linkage opt:
345 //
346 #if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK)
347 #  define BOOST_LIB_PREFIX
348 #elif defined(BOOST_DYN_LINK)
349 #  error "Mixing a dll boost library with a static runtime is a really bad idea..."
350 #else
351 #  define BOOST_LIB_PREFIX "lib"
352 #endif
353
354 //
355 // now include the lib:
356 //
357 #if defined(BOOST_LIB_NAME) \
358       && defined(BOOST_LIB_PREFIX) \
359       && defined(BOOST_LIB_TOOLSET) \
360       && defined(BOOST_LIB_THREAD_OPT) \
361       && defined(BOOST_LIB_RT_OPT) \
362       && defined(BOOST_LIB_VERSION)
363
364 #ifdef BOOST_AUTO_LINK_TAGGED
365 #  pragma commentcomment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib")
366 #  ifdef BOOST_LIB_DIAGNOSTIC
367 #     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")
368 #  endif
369 #elif defined(BOOST_AUTO_LINK_NOMANGLE)
370 #  pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
371 #  ifdef BOOST_LIB_DIAGNOSTIC
372 #     pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
373 #  endif
374 #else
375 #  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")
376 #  ifdef BOOST_LIB_DIAGNOSTIC
377 #     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")
378 #  endif
379 #endif
380
381 #else
382 #  error "some required macros where not defined (internal logic error)."
383 #endif
384
385
386 #endif // _MSC_VER || __BORLANDC__
387
388 //
389 // finally undef any macros we may have set:
390 //
391 #ifdef BOOST_LIB_PREFIX
392 #  undef BOOST_LIB_PREFIX
393 #endif
394 #if defined(BOOST_LIB_NAME)
395 #  undef BOOST_LIB_NAME
396 #endif
397 // Don't undef this one: it can be set by the user and should be the 
398 // same for all libraries:
399 //#if defined(BOOST_LIB_TOOLSET)
400 //#  undef BOOST_LIB_TOOLSET
401 //#endif
402 #if defined(BOOST_LIB_THREAD_OPT)
403 #  undef BOOST_LIB_THREAD_OPT
404 #endif
405 #if defined(BOOST_LIB_RT_OPT)
406 #  undef BOOST_LIB_RT_OPT
407 #endif
408 #if defined(BOOST_LIB_LINK_OPT)
409 #  undef BOOST_LIB_LINK_OPT
410 #endif
411 #if defined(BOOST_LIB_DEBUG_OPT)
412 #  undef BOOST_LIB_DEBUG_OPT
413 #endif
414 #if defined(BOOST_DYN_LINK)
415 #  undef BOOST_DYN_LINK
416 #endif
417 #if defined(BOOST_AUTO_LINK_NOMANGLE)
418 #  undef BOOST_AUTO_LINK_NOMANGLE
419 #endif
420