Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

auto_link.hpp

Go to the documentation of this file.
00001 /* vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:cindent: 
00002  */
00003 /*
00004  * Copyright (C) 2005 Dell Inc.
00005  *  by Michael Brown <Michael_E_Brown@dell.com>
00006  * Licensed under the Open Software License version 2.1 
00007  * 
00008  * Alternatively, you can redistribute it and/or modify 
00009  * it under the terms of the GNU General Public License as published 
00010  * by the Free Software Foundation; either version 2 of the License, 
00011  * or (at your option) any later version.
00012 
00013  * This program is distributed in the hope that it will be useful, but 
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of 
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
00016  * See the GNU General Public License for more details.
00017  */
00018 
00019 /* safe to include in C headers */
00020 
00021 #ifndef LIBSMBIOS_AUTO_LINK_H_INCLUDED
00022 #define LIBSMBIOS_AUTO_LINK_H_INCLUDED
00023 
00024 #ifdef __cplusplus
00025 #  ifndef LIBSMBIOS_CONFIG_H
00026 #     include "smbios/config.hpp"
00027 #  endif
00028 #elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__)
00029 /*
00030  * C language compatability (no, honestly)
00031  */
00032 #  define BOOST_MSVC _MSC_VER
00033 #  define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
00034 #  define BOOST_DO_STRINGIZE(X) #X
00035 #endif
00036 
00037 #ifdef LIBSMBIOS_PLATFORM_WIN32
00038 // The rest of the code in this file is used to automatically select which 
00039 // version libsmbios library to link to.
00040 
00041 // libsmbios-vc6        // single-thread  (DLL)     (non-debug)     XXX
00042 // libsmbios-vc6-mt     // multi-thread   (DLL)     (non-debug)     mt-dll
00043 // libsmbios-vc6-gd     // single-thread  (DLL)     (debug)         XXX
00044 // libsmbios-vc6-mt-gd  // multi-thread   (DLL)     (debug)         d-mt-dll
00045 // libsmbios-vc6-s      // single-thread  (non-DLL) (non-debug)     st
00046 // libsmbios-vc6-mt-s   // multi-thread   (non-DLL) (non-debug)     mt
00047 // libsmbios-vc6-sgd    // single-thread  (non-DLL) (debug)         d-st
00048 // libsmbios-vc6-mt-sgd // multi-thread   (non-DLL) (debug)         d-mt
00049 
00050 
00051 
00052 #if !defined(LIBSMBIOS_ALL_NO_LIB) && !defined(LIBSMBIOS_SOURCE)
00053 
00054 
00055 #if defined(LIBSMBIOS_ALL_DYN_LINK)
00056 #   define LIBSMBIOS_DYN_LINK
00057 #endif
00058 
00059 // ==============================
00060 //
00061 // select toolset if not defined already:
00062 //
00063 #ifndef LIBSMBIOS_LIB_TOOLSET
00064 #if defined(LIBSMBIOS_MSVC) && (LIBSMBIOS_MSVC == 1200)
00065 
00066    // vc6:
00067 #  define LIBSMBIOS_LIB_TOOLSET "vc6"
00068 
00069 #elif defined(LIBSMBIOS_MSVC) && (LIBSMBIOS_MSVC == 1300)
00070 
00071    // vc7:
00072 #  define LIBSMBIOS_LIB_TOOLSET "vc7"
00073 
00074 #elif defined(LIBSMBIOS_MSVC) && (LIBSMBIOS_MSVC == 1310)
00075 
00076    // vc71:
00077 #  define LIBSMBIOS_LIB_TOOLSET "vc71"
00078 
00079 #elif defined(LIBSMBIOS_MSVC) && (LIBSMBIOS_MSVC >= 1400)
00080 
00081    // vc80:
00082 #  define LIBSMBIOS_LIB_TOOLSET "vc80"
00083 #endif
00084 #endif
00085 
00086 
00087 // ==============================
00088 //
00089 // select linkage opt:
00090 //
00091 #if (defined(_DLL) || defined(_RTLDLL)) && defined(LIBSMBIOS_DYN_LINK)
00092 #  define LIBSMBIOS_LIB_PREFIX
00093 #elif defined(LIBSMBIOS_DYN_LINK)
00094 #  error "Mixing a dll boost library with a static runtime is a really bad idea..."
00095 #else
00096 #  define LIBSMBIOS_LIB_PREFIX "lib"
00097 #endif
00098 
00099 
00100 // ==============================
00101 //
00102 // select thread opt:
00103 //
00104 #if defined(_MT) || defined(__MT__)
00105 #  define LIBSMBIOS_LIB_THREAD_OPT "-mt"
00106 #else
00107 #  define LIBSMBIOS_LIB_THREAD_OPT
00108 #endif
00109 
00110 // ==============================
00111 //
00112 // select runtime opt:
00113 //
00114 #if defined(_MSC_VER) || defined(__MWERKS__)
00115 #  ifdef _DLL
00116 #     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
00117 
00118 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
00119 #            define LIBSMBIOS_LIB_RT_OPT "-gdp"
00120 #        elif defined(_DEBUG)
00121 #            define LIBSMBIOS_LIB_RT_OPT "-gdp"
00122 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
00123 #            error "Build options aren't compatible with pre-built libraries"
00124 #        else
00125 #            define LIBSMBIOS_LIB_RT_OPT "-p"
00126 #        endif
00127 
00128 #     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
00129 
00130 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
00131 #            define LIBSMBIOS_LIB_RT_OPT "-gdpn"
00132 #        elif defined(_DEBUG)
00133 #            define LIBSMBIOS_LIB_RT_OPT "-gdpn"
00134 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
00135 #            error "Build options aren't compatible with pre-built libraries"
00136 #        else
00137 #            define LIBSMBIOS_LIB_RT_OPT "-pn"
00138 #        endif
00139 
00140 #     else
00141 
00142 #        if defined(_DEBUG)
00143 #            define LIBSMBIOS_LIB_RT_OPT "-gd"
00144 #        else
00145 #            define LIBSMBIOS_LIB_RT_OPT
00146 #        endif
00147 
00148 #     endif
00149 #  else
00150 
00151 #     if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
00152 
00153 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
00154 #            define LIBSMBIOS_LIB_RT_OPT "-sgdp"
00155 #        elif defined(_DEBUG)
00156 #             define LIBSMBIOS_LIB_RT_OPT "-sgdp"
00157 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
00158 #            error "Build options aren't compatible with pre-built libraries"
00159 #        else
00160 #            define LIBSMBIOS_LIB_RT_OPT "-sp"
00161 #        endif
00162 
00163 #     elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
00164 
00165 #        if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
00166 #            define LIBSMBIOS_LIB_RT_OPT "-sgdpn"
00167 #        elif defined(_DEBUG)
00168 #             define LIBSMBIOS_LIB_RT_OPT "-sgdpn"
00169 #            pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
00170 #            error "Build options aren't compatible with pre-built libraries"
00171 #        else
00172 #            define LIBSMBIOS_LIB_RT_OPT "-spn"
00173 #        endif
00174 
00175 #     else
00176 
00177 #        if defined(_DEBUG)
00178 #             define LIBSMBIOS_LIB_RT_OPT "-sgd"
00179 #        else
00180 #            define LIBSMBIOS_LIB_RT_OPT "-s"
00181 #        endif
00182 
00183 #     endif
00184 
00185 #  endif
00186 #endif
00187 
00188 #define LIBSMBIOS_LIB_NAME smbios
00189 
00190 #ifndef LIBSMBIOS_AUTO_LINK_NOMANGLE
00191 #   pragma comment(lib, LIBSMBIOS_LIB_PREFIX LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) "-" LIBSMBIOS_LIB_TOOLSET LIBSMBIOS_LIB_THREAD_OPT LIBSMBIOS_LIB_RT_OPT ".lib" )
00192 #   ifdef LIBSMBIOS_LIB_DIAGNOSTIC
00193 #       pragma message ("Automatically Linking to lib file: " LIBSMBIOS_LIB_PREFIX LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) "-" LIBSMBIOS_LIB_TOOLSET LIBSMBIOS_LIB_THREAD_OPT LIBSMBIOS_LIB_RT_OPT ".lib")
00194 #   endif
00195 #   if defined(LIBSMBIOS_NEED_SMBIOSXML)
00196 #       undef LIBSMBIOS_LIB_NAME
00197 #       define LIBSMBIOS_LIB_NAME smbiosxml
00198 #       pragma comment(lib, LIBSMBIOS_LIB_PREFIX LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) "-" LIBSMBIOS_LIB_TOOLSET LIBSMBIOS_LIB_THREAD_OPT LIBSMBIOS_LIB_RT_OPT ".lib" )
00199 #       ifdef LIBSMBIOS_LIB_DIAGNOSTIC
00200 #           pragma message ("Automatically Linking to lib file: " LIBSMBIOS_LIB_PREFIX LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) "-" LIBSMBIOS_LIB_TOOLSET LIBSMBIOS_LIB_THREAD_OPT LIBSMBIOS_LIB_RT_OPT ".lib")
00201 #       endif
00202 #   endif
00203 #else
00204 #   pragma comment(lib, LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) ".lib" )
00205 #   ifdef LIBSMBIOS_LIB_DIAGNOSTIC
00206 #       pragma message ("Automatically Linking to lib file: " LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) ".lib")
00207 #   endif
00208 #   if defined(LIBSMBIOS_NEED_SMBIOSXML)
00209 #       undef LIBSMBIOS_LIB_NAME
00210 #       define LIBSMBIOS_LIB_NAME smbiosxml
00211 #       pragma comment(lib, LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) ".lib" )
00212 #       ifdef LIBSMBIOS_LIB_DIAGNOSTIC
00213 #           pragma message ("Automatically Linking to lib file: " LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) ".lib")
00214 #       endif
00215 #   endif
00216 #endif
00217 
00218 // automatic linking for xerces, if we are using XML
00219 #if defined(LIBSMBIOS_NEED_SMBIOSXML)
00220 #   undef LIBSMBIOS_LIB_NAME
00221 #   if !defined(_MT) && !defined(__MT__) 
00222 #       error("Xerces DLLs are only distributed as (debug|non-debug) x (multithreaded|multithreaded DLL). Your runtime code-generation must be set to either of these configurations.")
00223 #   endif
00224 
00225 #   if (defined(_DLL) || defined(_RTLDLL)) 
00226 #       if defined(_DEBUG)
00227 #           define LIBSMBIOS_LIB_NAME xerces-c_2D
00228 #       else
00229 #           define LIBSMBIOS_LIB_NAME xerces-c_2
00230 #       endif
00231 #   else
00232 #       if defined(_DEBUG)
00233 #           define LIBSMBIOS_LIB_NAME Xerces-c_static_2D
00234 #       else
00235 #           define LIBSMBIOS_LIB_NAME Xerces-c_static_2
00236 #       endif
00237 #   endif
00238 #   pragma comment(lib, LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) ".lib" )
00239 #   ifdef LIBSMBIOS_LIB_DIAGNOSTIC
00240 #       pragma message ("Automatically Linking to lib file: " LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) ".lib")
00241 #   endif
00242 #endif
00243 
00244 //  //#include <config/auto_link.hpp>
00245 #endif /* !LIBSMBIOS_ALL_NO_LIB && ! LIBSMBIOS_SOURCE */
00246 #endif /* LIBSMBIOS_PLATFORM_WIN32 */
00247 
00248 #ifdef LIBSMBIOS_LIB_PREFIX
00249 #  undef LIBSMBIOS_LIB_PREFIX
00250 #endif
00251 #if defined(LIBSMBIOS_LIB_NAME)
00252 #  undef LIBSMBIOS_LIB_NAME
00253 #endif
00254 #if defined(LIBSMBIOS_LIB_TOOLSET)
00255 #  undef LIBSMBIOS_LIB_TOOLSET
00256 #endif
00257 #if defined(LIBSMBIOS_LIB_THREAD_OPT)
00258 #  undef LIBSMBIOS_LIB_THREAD_OPT
00259 #endif
00260 #if defined(LIBSMBIOS_LIB_RT_OPT)
00261 #  undef LIBSMBIOS_LIB_RT_OPT
00262 #endif
00263 #if defined(LIBSMBIOS_LIB_LINK_OPT)
00264 #  undef LIBSMBIOS_LIB_LINK_OPT
00265 #endif
00266 #if defined(LIBSMBIOS_LIB_DEBUG_OPT)
00267 #  undef LIBSMBIOS_LIB_DEBUG_OPT
00268 #endif
00269 #if defined(LIBSMBIOS_DYN_LINK)
00270 #  undef LIBSMBIOS_DYN_LINK
00271 #endif
00272 #if defined(LIBSMBIOS_AUTO_LINK_NOMANGLE)
00273 #  undef LIBSMBIOS_AUTO_LINK_NOMANGLE
00274 #endif
00275 
00276 #endif /* AUTO_LINK_H */

Generated on Wed Apr 11 16:25:10 2007 for SMBIOS Library by doxygen 1.3.5