Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/config/auto_link.hpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 9.9 KB
Line 
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
15USAGE:
16~~~~~~
17
18Before including this header you must define one or more of define the following macros:
19
20BOOST_LIB_NAME:           Required: A string containing the basename of the library,
21                          for example boost_regex.
22BOOST_LIB_TOOLSET:        Optional: the base name of the toolset.
23BOOST_DYN_LINK:           Optional: when set link to dll rather than static library.
24BOOST_LIB_DIAGNOSTIC:     Optional: when set the header will print out the name
25                          of the library selected (useful for debugging).
26BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib,
27                          rather than a mangled-name version.
28
29These macros will be undef'ed at the end of the header, further this header
30has no include guards - so be sure to include it only once from your library!
31
32Algorithm:
33~~~~~~~~~~
34
35Libraries for Borland and Microsoft compilers are automatically
36selected here, the name of the lib is selected according to the following
37formula:
38
39BOOST_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
48These are defined as:
49
50BOOST_LIB_PREFIX:     "lib" for static libraries otherwise "".
51
52BOOST_LIB_NAME:       The base name of the lib ( for example boost_regex).
53
54BOOST_LIB_TOOLSET:    The compiler toolset name (vc6, vc7, bcb5 etc).
55
56BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing.
57
58BOOST_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
67BOOST_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(__BORLANDC__)
139
140   // CBuilder 6:
141#  define BOOST_LIB_TOOLSET "bcb"
142
143#elif defined(__ICL)
144
145   // Intel C++, no version number:
146#  define BOOST_LIB_TOOLSET "iw"
147
148#elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF )
149
150   // Metrowerks CodeWarrior 8.x
151#  define BOOST_LIB_TOOLSET "cw8"
152
153#elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF )
154
155   // Metrowerks CodeWarrior 9.x
156#  define BOOST_LIB_TOOLSET "cw9"
157
158#endif
159#endif // BOOST_LIB_TOOLSET
160
161//
162// select thread opt:
163//
164#if defined(_MT) || defined(__MT__)
165#  define BOOST_LIB_THREAD_OPT "-mt"
166#else
167#  define BOOST_LIB_THREAD_OPT
168#endif
169
170#if defined(_MSC_VER) || defined(__MWERKS__)
171
172#  ifdef _DLL
173
174#     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
175
176#        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
177#            define BOOST_LIB_RT_OPT "-gdp"
178#        elif defined(_DEBUG)
179#            define BOOST_LIB_RT_OPT "-gdp"
180#            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
181#            error "Build options aren't compatible with pre-built libraries"
182#        else
183#            define BOOST_LIB_RT_OPT "-p"
184#        endif
185
186#     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
187
188#        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
189#            define BOOST_LIB_RT_OPT "-gdpn"
190#        elif defined(_DEBUG)
191#            define BOOST_LIB_RT_OPT "-gdpn"
192#            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
193#            error "Build options aren't compatible with pre-built libraries"
194#        else
195#            define BOOST_LIB_RT_OPT "-pn"
196#        endif
197
198#     else
199
200#        if defined(_DEBUG)
201#            define BOOST_LIB_RT_OPT "-gd"
202#        else
203#            define BOOST_LIB_RT_OPT
204#        endif
205
206#     endif
207
208#  else
209
210#     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
211
212#        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
213#            define BOOST_LIB_RT_OPT "-sgdp"
214#        elif defined(_DEBUG)
215#             define BOOST_LIB_RT_OPT "-sgdp"
216#            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
217#            error "Build options aren't compatible with pre-built libraries"
218#        else
219#            define BOOST_LIB_RT_OPT "-sp"
220#        endif
221
222#     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
223
224#        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
225#            define BOOST_LIB_RT_OPT "-sgdpn"
226#        elif defined(_DEBUG)
227#             define BOOST_LIB_RT_OPT "-sgdpn"
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 "-spn"
232#        endif
233
234#     else
235
236#        if defined(_DEBUG)
237#             define BOOST_LIB_RT_OPT "-sgd"
238#        else
239#            define BOOST_LIB_RT_OPT "-s"
240#        endif
241
242#     endif
243
244#  endif
245
246#elif defined(__BORLANDC__)
247
248//
249// figure out whether we want the debug builds or not:
250//
251#if __BORLANDC__ > 0x561
252#pragma defineonoption BOOST_BORLAND_DEBUG -v
253#endif
254//
255// sanity check:
256//
257#if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
258#error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form"
259#endif
260
261#  ifdef _RTLDLL
262
263#     ifdef BOOST_BORLAND_DEBUG
264#         define BOOST_LIB_RT_OPT "-d"
265#     else
266#         define BOOST_LIB_RT_OPT
267#     endif
268
269#  else
270
271#     ifdef BOOST_BORLAND_DEBUG
272#         define BOOST_LIB_RT_OPT "-sd"
273#     else
274#         define BOOST_LIB_RT_OPT "-s"
275#     endif
276
277#  endif
278
279#endif
280
281//
282// select linkage opt:
283//
284#if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK)
285#  define BOOST_LIB_PREFIX
286#elif defined(BOOST_DYN_LINK)
287#  error "Mixing a dll boost library with a static runtime is a really bad idea..."
288#else
289#  define BOOST_LIB_PREFIX "lib"
290#endif
291
292//
293// now include the lib:
294//
295#if defined(BOOST_LIB_NAME) \
296      && defined(BOOST_LIB_PREFIX) \
297      && defined(BOOST_LIB_TOOLSET) \
298      && defined(BOOST_LIB_THREAD_OPT) \
299      && defined(BOOST_LIB_RT_OPT) \
300      && defined(BOOST_LIB_VERSION)
301
302#ifndef BOOST_AUTO_LINK_NOMANGLE
303#  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")
304#  ifdef BOOST_LIB_DIAGNOSTIC
305#     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")
306#  endif
307#else
308#  pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
309#  ifdef BOOST_LIB_DIAGNOSTIC
310#     pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
311#  endif
312#endif
313
314#else
315#  error "some required macros where not defined (internal logic error)."
316#endif
317
318
319#endif // _MSC_VER || __BORLANDC__
320
321//
322// finally undef any macros we may have set:
323//
324#ifdef BOOST_LIB_PREFIX
325#  undef BOOST_LIB_PREFIX
326#endif
327#if defined(BOOST_LIB_NAME)
328#  undef BOOST_LIB_NAME
329#endif
330// Don't undef this one: it can be set by the user and should be the
331// same for all libraries:
332//#if defined(BOOST_LIB_TOOLSET)
333//#  undef BOOST_LIB_TOOLSET
334//#endif
335#if defined(BOOST_LIB_THREAD_OPT)
336#  undef BOOST_LIB_THREAD_OPT
337#endif
338#if defined(BOOST_LIB_RT_OPT)
339#  undef BOOST_LIB_RT_OPT
340#endif
341#if defined(BOOST_LIB_LINK_OPT)
342#  undef BOOST_LIB_LINK_OPT
343#endif
344#if defined(BOOST_LIB_DEBUG_OPT)
345#  undef BOOST_LIB_DEBUG_OPT
346#endif
347#if defined(BOOST_DYN_LINK)
348#  undef BOOST_DYN_LINK
349#endif
350#if defined(BOOST_AUTO_LINK_NOMANGLE)
351#  undef BOOST_AUTO_LINK_NOMANGLE
352#endif
353
354
355
356
357
358
359
360
361
362
363
Note: See TracBrowser for help on using the repository browser.