auto_link.hpp
Go to the documentation of this file.
00001 //  (C) Copyright John Maddock 2003.
00002 //  Use, modification and distribution are subject to the
00003 //  Boost Software License, Version 1.0. (See accompanying file
00004 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00005 
00006  /*
00007   *   LOCATION:    see http://www.boost.org for most recent version.
00008   *   FILE         auto_link.hpp
00009   *   VERSION      see <boost/version.hpp>
00010   *   DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers.
00011   */
00012 
00013 /*************************************************************************
00014 
00015 USAGE:
00016 ~~~~~~
00017 
00018 Before including this header you must define one or more of define the following macros:
00019 
00020 BOOST_LIB_NAME:           Required: A string containing the basename of the library,
00021                           for example boost_regex.
00022 BOOST_LIB_TOOLSET:        Optional: the base name of the toolset.
00023 BOOST_DYN_LINK:           Optional: when set link to dll rather than static library.
00024 BOOST_LIB_DIAGNOSTIC:     Optional: when set the header will print out the name
00025                           of the library selected (useful for debugging).
00026 BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib,
00027                           rather than a mangled-name version.
00028 
00029 These macros will be undef'ed at the end of the header, further this header
00030 has no include guards - so be sure to include it only once from your library!
00031 
00032 Algorithm:
00033 ~~~~~~~~~~
00034 
00035 Libraries for Borland and Microsoft compilers are automatically
00036 selected here, the name of the lib is selected according to the following
00037 formula:
00038 
00039 BOOST_LIB_PREFIX
00040    + BOOST_LIB_NAME
00041    + "_"
00042    + BOOST_LIB_TOOLSET
00043    + BOOST_LIB_THREAD_OPT
00044    + BOOST_LIB_RT_OPT
00045    "-"
00046    + BOOST_LIB_VERSION
00047 
00048 These are defined as:
00049 
00050 BOOST_LIB_PREFIX:     "lib" for static libraries otherwise "".
00051 
00052 BOOST_LIB_NAME:       The base name of the lib ( for example boost_regex).
00053 
00054 BOOST_LIB_TOOLSET:    The compiler toolset name (vc6, vc7, bcb5 etc).
00055 
00056 BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing.
00057 
00058 BOOST_LIB_RT_OPT:     A suffix that indicates the runtime library used,
00059                       contains one or more of the following letters after
00060                       a hiphen:
00061 
00062                       s      static runtime (dynamic if not present).
00063                       d      debug build (release if not present).
00064                       g      debug/diagnostic runtime (release if not present).
00065                       p      STLPort Build.
00066 
00067 BOOST_LIB_VERSION:    The Boost version, in the form x_y, for Boost version x.y.
00068 
00069 
00070 ***************************************************************************/
00071 
00072 #ifdef __cplusplus
00073 #  ifndef BOOST_CONFIG_HPP
00074 #     include <boost/config.hpp>
00075 #  endif
00076 #elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__)
00077 //
00078 // C language compatability (no, honestly)
00079 //
00080 #  define BOOST_MSVC _MSC_VER
00081 #  define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
00082 #  define BOOST_DO_STRINGIZE(X) #X
00083 #endif
00084 //
00085 // Only include what follows for known and supported compilers:
00086 //
00087 #if defined(BOOST_MSVC) \
00088     || defined(__BORLANDC__) \
00089     || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \
00090     || (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200))
00091 
00092 #ifndef BOOST_VERSION_HPP
00093 #  include <boost/version.hpp>
00094 #endif
00095 
00096 #ifndef BOOST_LIB_NAME
00097 #  error "Macro BOOST_LIB_NAME not set (internal error)"
00098 #endif
00099 
00100 //
00101 // error check:
00102 //
00103 #if defined(__MSVC_RUNTIME_CHECKS) && !defined(_DEBUG)
00104 #  pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors")
00105 #  pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes")
00106 #  error "Incompatible build options"
00107 #endif
00108 //
00109 // select toolset if not defined already:
00110 //
00111 #ifndef BOOST_LIB_TOOLSET
00112 // Note: no compilers before 1200 are supported
00113 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
00114 
00115 #  ifdef UNDER_CE
00116      // vc6:
00117 #    define BOOST_LIB_TOOLSET "evc4"
00118 #  else
00119      // vc6:
00120 #    define BOOST_LIB_TOOLSET "vc6"
00121 #  endif
00122 
00123 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
00124 
00125    // vc7:
00126 #  define BOOST_LIB_TOOLSET "vc7"
00127 
00128 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
00129 
00130    // vc71:
00131 #  define BOOST_LIB_TOOLSET "vc71"
00132 
00133 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1400)
00134 
00135    // vc80:
00136 #  define BOOST_LIB_TOOLSET "vc80"
00137 
00138 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
00139 
00140    // vc90:
00141 #  define BOOST_LIB_TOOLSET "vc90"
00142 
00143 #elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1600)
00144 
00145    // vc10:
00146 #  define BOOST_LIB_TOOLSET "vc100"
00147 
00148 #elif defined(__BORLANDC__)
00149 
00150    // CBuilder 6:
00151 #  define BOOST_LIB_TOOLSET "bcb"
00152 
00153 #elif defined(__ICL)
00154 
00155    // Intel C++, no version number:
00156 #  define BOOST_LIB_TOOLSET "iw"
00157 
00158 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF )
00159 
00160    // Metrowerks CodeWarrior 8.x
00161 #  define BOOST_LIB_TOOLSET "cw8"
00162 
00163 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF )
00164 
00165    // Metrowerks CodeWarrior 9.x
00166 #  define BOOST_LIB_TOOLSET "cw9"
00167 
00168 #endif
00169 #endif // BOOST_LIB_TOOLSET
00170 
00171 //
00172 // select thread opt:
00173 //
00174 #if defined(_MT) || defined(__MT__)
00175 #  define BOOST_LIB_THREAD_OPT "-mt"
00176 #else
00177 #  define BOOST_LIB_THREAD_OPT
00178 #endif
00179 
00180 #if defined(_MSC_VER) || defined(__MWERKS__)
00181 
00182 #  ifdef _DLL
00183 
00184 #     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
00185 
00186 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
00187 #            define BOOST_LIB_RT_OPT "-gdp"
00188 #        elif defined(_DEBUG)
00189 #            define BOOST_LIB_RT_OPT "-gdp"
00190 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
00191 #            error "Build options aren't compatible with pre-built libraries"
00192 #        else
00193 #            define BOOST_LIB_RT_OPT "-p"
00194 #        endif
00195 
00196 #     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
00197 
00198 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
00199 #            define BOOST_LIB_RT_OPT "-gdpn"
00200 #        elif defined(_DEBUG)
00201 #            define BOOST_LIB_RT_OPT "-gdpn"
00202 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
00203 #            error "Build options aren't compatible with pre-built libraries"
00204 #        else
00205 #            define BOOST_LIB_RT_OPT "-pn"
00206 #        endif
00207 
00208 #     else
00209 
00210 #        if defined(_DEBUG)
00211 #            define BOOST_LIB_RT_OPT "-gd"
00212 #        else
00213 #            define BOOST_LIB_RT_OPT
00214 #        endif
00215 
00216 #     endif
00217 
00218 #  else
00219 
00220 #     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
00221 
00222 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
00223 #            define BOOST_LIB_RT_OPT "-sgdp"
00224 #        elif defined(_DEBUG)
00225 #             define BOOST_LIB_RT_OPT "-sgdp"
00226 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
00227 #            error "Build options aren't compatible with pre-built libraries"
00228 #        else
00229 #            define BOOST_LIB_RT_OPT "-sp"
00230 #        endif
00231 
00232 #     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
00233 
00234 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
00235 #            define BOOST_LIB_RT_OPT "-sgdpn"
00236 #        elif defined(_DEBUG)
00237 #             define BOOST_LIB_RT_OPT "-sgdpn"
00238 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
00239 #            error "Build options aren't compatible with pre-built libraries"
00240 #        else
00241 #            define BOOST_LIB_RT_OPT "-spn"
00242 #        endif
00243 
00244 #     else
00245 
00246 #        if defined(_DEBUG)
00247 #             define BOOST_LIB_RT_OPT "-sgd"
00248 #        else
00249 #            define BOOST_LIB_RT_OPT "-s"
00250 #        endif
00251 
00252 #     endif
00253 
00254 #  endif
00255 
00256 #elif defined(__BORLANDC__)
00257 
00258 //
00259 // figure out whether we want the debug builds or not:
00260 //
00261 #if __BORLANDC__ > 0x561
00262 #pragma defineonoption BOOST_BORLAND_DEBUG -v
00263 #endif
00264 //
00265 // sanity check:
00266 //
00267 #if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
00268 #error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form"
00269 #endif
00270 
00271 #  ifdef _RTLDLL
00272 
00273 #     ifdef BOOST_BORLAND_DEBUG
00274 #         define BOOST_LIB_RT_OPT "-d"
00275 #     else
00276 #         define BOOST_LIB_RT_OPT
00277 #     endif
00278 
00279 #  else
00280 
00281 #     ifdef BOOST_BORLAND_DEBUG
00282 #         define BOOST_LIB_RT_OPT "-sd"
00283 #     else
00284 #         define BOOST_LIB_RT_OPT "-s"
00285 #     endif
00286 
00287 #  endif
00288 
00289 #endif
00290 
00291 //
00292 // select linkage opt:
00293 //
00294 #if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK)
00295 #  define BOOST_LIB_PREFIX
00296 #elif defined(BOOST_DYN_LINK)
00297 #  error "Mixing a dll boost library with a static runtime is a really bad idea..."
00298 #else
00299 #  define BOOST_LIB_PREFIX "lib"
00300 #endif
00301 
00302 //
00303 // now include the lib:
00304 //
00305 #if defined(BOOST_LIB_NAME) \
00306       && defined(BOOST_LIB_PREFIX) \
00307       && defined(BOOST_LIB_TOOLSET) \
00308       && defined(BOOST_LIB_THREAD_OPT) \
00309       && defined(BOOST_LIB_RT_OPT) \
00310       && defined(BOOST_LIB_VERSION)
00311 
00312 #ifndef BOOST_AUTO_LINK_NOMANGLE
00313 #  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")
00314 #  ifdef BOOST_LIB_DIAGNOSTIC
00315 #     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")
00316 #  endif
00317 #else
00318 #  pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
00319 #  ifdef BOOST_LIB_DIAGNOSTIC
00320 #     pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
00321 #  endif
00322 #endif
00323 
00324 #else
00325 #  error "some required macros where not defined (internal logic error)."
00326 #endif
00327 
00328 
00329 #endif // _MSC_VER || __BORLANDC__
00330 
00331 //
00332 // finally undef any macros we may have set:
00333 //
00334 #ifdef BOOST_LIB_PREFIX
00335 #  undef BOOST_LIB_PREFIX
00336 #endif
00337 #if defined(BOOST_LIB_NAME)
00338 #  undef BOOST_LIB_NAME
00339 #endif
00340 // Don't undef this one: it can be set by the user and should be the 
00341 // same for all libraries:
00342 //#if defined(BOOST_LIB_TOOLSET)
00343 //#  undef BOOST_LIB_TOOLSET
00344 //#endif
00345 #if defined(BOOST_LIB_THREAD_OPT)
00346 #  undef BOOST_LIB_THREAD_OPT
00347 #endif
00348 #if defined(BOOST_LIB_RT_OPT)
00349 #  undef BOOST_LIB_RT_OPT
00350 #endif
00351 #if defined(BOOST_LIB_LINK_OPT)
00352 #  undef BOOST_LIB_LINK_OPT
00353 #endif
00354 #if defined(BOOST_LIB_DEBUG_OPT)
00355 #  undef BOOST_LIB_DEBUG_OPT
00356 #endif
00357 #if defined(BOOST_DYN_LINK)
00358 #  undef BOOST_DYN_LINK
00359 #endif
00360 #if defined(BOOST_AUTO_LINK_NOMANGLE)
00361 #  undef BOOST_AUTO_LINK_NOMANGLE
00362 #endif
00363 
00364 
00365 
00366 
00367 
00368 
00369 
00370 
00371 
00372 
00373 


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:28