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