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 <sysc/packages/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 <sysc/packages/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 <sysc/packages/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 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1200)
00113 
00114    // vc6:
00115 #  define BOOST_LIB_TOOLSET "vc6"
00116 
00117 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
00118 
00119    // vc7:
00120 #  define BOOST_LIB_TOOLSET "vc7"
00121 
00122 #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
00123 
00124    // vc71:
00125 #  define BOOST_LIB_TOOLSET "vc71"
00126 
00127 #elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1400)
00128 
00129    // vc80:
00130 #  define BOOST_LIB_TOOLSET "vc80"
00131 
00132 #elif defined(__BORLANDC__)
00133 
00134    // CBuilder 6:
00135 #  define BOOST_LIB_TOOLSET "bcb"
00136 
00137 #elif defined(__ICL)
00138 
00139    // Intel C++, no version number:
00140 #  define BOOST_LIB_TOOLSET "iw"
00141 
00142 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF )
00143 
00144    // Metrowerks CodeWarrior 8.x
00145 #  define BOOST_LIB_TOOLSET "cw8"
00146 
00147 #elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF )
00148 
00149    // Metrowerks CodeWarrior 9.x
00150 #  define BOOST_LIB_TOOLSET "cw9"
00151 
00152 #endif
00153 #endif // BOOST_LIB_TOOLSET
00154 
00155 //
00156 // select thread opt:
00157 //
00158 #if defined(_MT) || defined(__MT__)
00159 #  define BOOST_LIB_THREAD_OPT "-mt"
00160 #else
00161 #  define BOOST_LIB_THREAD_OPT
00162 #endif
00163 
00164 #if defined(_MSC_VER) || defined(__MWERKS__)
00165 
00166 #  ifdef _DLL
00167 
00168 #     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
00169 
00170 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
00171 #            define BOOST_LIB_RT_OPT "-gdp"
00172 #        elif defined(_DEBUG)
00173 #            define BOOST_LIB_RT_OPT "-gdp"
00174 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
00175 #            error "Build options aren't compatible with pre-built libraries"
00176 #        else
00177 #            define BOOST_LIB_RT_OPT "-p"
00178 #        endif
00179 
00180 #     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
00181 
00182 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
00183 #            define BOOST_LIB_RT_OPT "-gdpn"
00184 #        elif defined(_DEBUG)
00185 #            define BOOST_LIB_RT_OPT "-gdpn"
00186 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
00187 #            error "Build options aren't compatible with pre-built libraries"
00188 #        else
00189 #            define BOOST_LIB_RT_OPT "-pn"
00190 #        endif
00191 
00192 #     else
00193 
00194 #        if defined(_DEBUG)
00195 #            define BOOST_LIB_RT_OPT "-gd"
00196 #        else
00197 #            define BOOST_LIB_RT_OPT
00198 #        endif
00199 
00200 #     endif
00201 
00202 #  else
00203 
00204 #     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
00205 
00206 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
00207 #            define BOOST_LIB_RT_OPT "-sgdp"
00208 #        elif defined(_DEBUG)
00209 #             define BOOST_LIB_RT_OPT "-sgdp"
00210 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
00211 #            error "Build options aren't compatible with pre-built libraries"
00212 #        else
00213 #            define BOOST_LIB_RT_OPT "-sp"
00214 #        endif
00215 
00216 #     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
00217 
00218 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
00219 #            define BOOST_LIB_RT_OPT "-sgdpn"
00220 #        elif defined(_DEBUG)
00221 #             define BOOST_LIB_RT_OPT "-sgdpn"
00222 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
00223 #            error "Build options aren't compatible with pre-built libraries"
00224 #        else
00225 #            define BOOST_LIB_RT_OPT "-spn"
00226 #        endif
00227 
00228 #     else
00229 
00230 #        if defined(_DEBUG)
00231 #             define BOOST_LIB_RT_OPT "-sgd"
00232 #        else
00233 #            define BOOST_LIB_RT_OPT "-s"
00234 #        endif
00235 
00236 #     endif
00237 
00238 #  endif
00239 
00240 #elif defined(__BORLANDC__)
00241 
00242 //
00243 // figure out whether we want the debug builds or not:
00244 //
00245 #if __BORLANDC__ > 0x561
00246 #pragma defineonoption BOOST_BORLAND_DEBUG -v
00247 #endif
00248 //
00249 // sanity check:
00250 //
00251 #if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
00252 #error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form"
00253 #endif
00254 
00255 #  ifdef _RTLDLL
00256 
00257 #     ifdef BOOST_BORLAND_DEBUG
00258 #         define BOOST_LIB_RT_OPT "-d"
00259 #     else
00260 #         define BOOST_LIB_RT_OPT
00261 #     endif
00262 
00263 #  else
00264 
00265 #     ifdef BOOST_BORLAND_DEBUG
00266 #         define BOOST_LIB_RT_OPT "-sd"
00267 #     else
00268 #         define BOOST_LIB_RT_OPT "-s"
00269 #     endif
00270 
00271 #  endif
00272 
00273 #endif
00274 
00275 //
00276 // select linkage opt:
00277 //
00278 #if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK)
00279 #  define BOOST_LIB_PREFIX
00280 #elif defined(BOOST_DYN_LINK)
00281 #  error "Mixing a dll boost library with a static runtime is a really bad idea..."
00282 #else
00283 #  define BOOST_LIB_PREFIX "lib"
00284 #endif
00285 
00286 //
00287 // now include the lib:
00288 //
00289 #if defined(BOOST_LIB_NAME) \
00290       && defined(BOOST_LIB_PREFIX) \
00291       && defined(BOOST_LIB_TOOLSET) \
00292       && defined(BOOST_LIB_THREAD_OPT) \
00293       && defined(BOOST_LIB_RT_OPT) \
00294       && defined(BOOST_LIB_VERSION)
00295 
00296 #ifndef BOOST_AUTO_LINK_NOMANGLE
00297 #  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")
00298 #  ifdef BOOST_LIB_DIAGNOSTIC
00299 #     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")
00300 #  endif
00301 #else
00302 #  pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
00303 #  ifdef BOOST_LIB_DIAGNOSTIC
00304 #     pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
00305 #  endif
00306 #endif
00307 
00308 #else
00309 #  error "some required macros where not defined (internal logic error)."
00310 #endif
00311 
00312 
00313 #endif // _MSC_VER || __BORLANDC__
00314 
00315 //
00316 // finally undef any macros we may have set:
00317 //
00318 #ifdef BOOST_LIB_PREFIX
00319 #  undef BOOST_LIB_PREFIX
00320 #endif
00321 #if defined(BOOST_LIB_NAME)
00322 #  undef BOOST_LIB_NAME
00323 #endif
00324 // Don't undef this one: it can be set by the user and should be the 
00325 // same for all libraries:
00326 //#if defined(BOOST_LIB_TOOLSET)
00327 //#  undef BOOST_LIB_TOOLSET
00328 //#endif
00329 #if defined(BOOST_LIB_THREAD_OPT)
00330 #  undef BOOST_LIB_THREAD_OPT
00331 #endif
00332 #if defined(BOOST_LIB_RT_OPT)
00333 #  undef BOOST_LIB_RT_OPT
00334 #endif
00335 #if defined(BOOST_LIB_LINK_OPT)
00336 #  undef BOOST_LIB_LINK_OPT
00337 #endif
00338 #if defined(BOOST_LIB_DEBUG_OPT)
00339 #  undef BOOST_LIB_DEBUG_OPT
00340 #endif
00341 #if defined(BOOST_DYN_LINK)
00342 #  undef BOOST_DYN_LINK
00343 #endif
00344 #if defined(BOOST_AUTO_LINK_NOMANGLE)
00345 #  undef BOOST_AUTO_LINK_NOMANGLE
00346 #endif
00347 
00348 
00349 
00350 
00351 
00352 
00353 
00354 
00355 
00356 
00357 

Generated on Wed Jan 21 15:32:09 2009 for SystemC by  doxygen 1.5.5