libsmbios_c library
auto_link.hpp
Go to the documentation of this file.
1 /* vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:cindent:
2  */
3 /*
4  * Copyright (C) 2005 Dell Inc.
5  * by Michael Brown <Michael_E_Brown@dell.com>
6  * Licensed under the Open Software License version 2.1
7  *
8  * Alternatively, you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published
10  * by the Free Software Foundation; either version 2 of the License,
11  * or (at your option) any later version.
12 
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  */
18 
19 /* safe to include in C headers */
20 
21 #ifndef LIBSMBIOS_AUTO_LINK_H_INCLUDED
22 #define LIBSMBIOS_AUTO_LINK_H_INCLUDED
23 
24 #ifdef __cplusplus
25 # ifndef LIBSMBIOS_CONFIG_H
26 # include "smbios/config.hpp"
27 # endif
28 #elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__)
29 /*
30  * C language compatability (no, honestly)
31  */
32 # define BOOST_MSVC _MSC_VER
33 # define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
34 # define BOOST_DO_STRINGIZE(X) #X
35 #endif
36 
37 #if (defined(LIBSMBIOS_PLATFORM_WIN32) || defined(LIBSMBIOS_PLATFORM_WIN64)) && defined(_MSC_VER)
38 // The rest of the code in this file is used to automatically select which
39 // version libsmbios library to link to.
40 
41 // libsmbios-vc6 // single-thread (DLL) (non-debug) XXX
42 // libsmbios-vc6-mt // multi-thread (DLL) (non-debug) mt-dll
43 // libsmbios-vc6-gd // single-thread (DLL) (debug) XXX
44 // libsmbios-vc6-mt-gd // multi-thread (DLL) (debug) d-mt-dll
45 // libsmbios-vc6-s // single-thread (non-DLL) (non-debug) st
46 // libsmbios-vc6-mt-s // multi-thread (non-DLL) (non-debug) mt
47 // libsmbios-vc6-sgd // single-thread (non-DLL) (debug) d-st
48 // libsmbios-vc6-mt-sgd // multi-thread (non-DLL) (debug) d-mt
49 
50 
51 
52 #if !defined(LIBSMBIOS_ALL_NO_LIB) && !defined(LIBSMBIOS_SOURCE)
53 
54 
55 #if defined(LIBSMBIOS_ALL_DYN_LINK)
56 # define LIBSMBIOS_DYN_LINK
57 #endif
58 
59 // ==============================
60 //
61 // select toolset if not defined already:
62 //
63 #ifndef LIBSMBIOS_LIB_TOOLSET
64 #if defined(LIBSMBIOS_MSVC) && (LIBSMBIOS_MSVC == 1200)
65 
66  // vc6:
67 # define LIBSMBIOS_LIB_TOOLSET "vc6"
68 
69 #elif defined(LIBSMBIOS_MSVC) && (LIBSMBIOS_MSVC == 1300)
70 
71  // vc7:
72 # define LIBSMBIOS_LIB_TOOLSET "vc7"
73 
74 #elif defined(LIBSMBIOS_MSVC) && (LIBSMBIOS_MSVC == 1310)
75 
76  // vc71:
77 # define LIBSMBIOS_LIB_TOOLSET "vc71"
78 
79 #elif defined(LIBSMBIOS_MSVC) && (LIBSMBIOS_MSVC >= 1400)
80 
81  // vc80:
82 # define LIBSMBIOS_LIB_TOOLSET "vc80"
83 #endif
84 #endif
85 
86 
87 // ==============================
88 //
89 // select linkage opt:
90 //
91 #if (defined(_DLL) || defined(_RTLDLL)) && defined(LIBSMBIOS_DYN_LINK)
92 # define LIBSMBIOS_LIB_PREFIX
93 #elif defined(LIBSMBIOS_DYN_LINK)
94 # error "Mixing a dll boost library with a static runtime is a really bad idea..."
95 #else
96 # define LIBSMBIOS_LIB_PREFIX "lib"
97 #endif
98 
99 
100 // ==============================
101 //
102 // select thread opt:
103 //
104 #if defined(_MT) || defined(__MT__)
105 # define LIBSMBIOS_LIB_THREAD_OPT "-mt"
106 #else
107 # define LIBSMBIOS_LIB_THREAD_OPT
108 #endif
109 
110 // ==============================
111 //
112 // select runtime opt:
113 //
114 #if defined(_MSC_VER) || defined(__MWERKS__)
115 # ifdef _DLL
116 # if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
117 
118 # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
119 # define LIBSMBIOS_LIB_RT_OPT "-gdp"
120 # elif defined(_DEBUG)
121 # define LIBSMBIOS_LIB_RT_OPT "-gdp"
122 # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
123 # error "Build options aren't compatible with pre-built libraries"
124 # else
125 # define LIBSMBIOS_LIB_RT_OPT "-p"
126 # endif
127 
128 # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
129 
130 # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
131 # define LIBSMBIOS_LIB_RT_OPT "-gdpn"
132 # elif defined(_DEBUG)
133 # define LIBSMBIOS_LIB_RT_OPT "-gdpn"
134 # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
135 # error "Build options aren't compatible with pre-built libraries"
136 # else
137 # define LIBSMBIOS_LIB_RT_OPT "-pn"
138 # endif
139 
140 # else
141 
142 # if defined(_DEBUG)
143 # define LIBSMBIOS_LIB_RT_OPT "-gd"
144 # else
145 # define LIBSMBIOS_LIB_RT_OPT
146 # endif
147 
148 # endif
149 # else
150 
151 # if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
152 
153 # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
154 # define LIBSMBIOS_LIB_RT_OPT "-sgdp"
155 # elif defined(_DEBUG)
156 # define LIBSMBIOS_LIB_RT_OPT "-sgdp"
157 # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
158 # error "Build options aren't compatible with pre-built libraries"
159 # else
160 # define LIBSMBIOS_LIB_RT_OPT "-sp"
161 # endif
162 
163 # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
164 
165 # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
166 # define LIBSMBIOS_LIB_RT_OPT "-sgdpn"
167 # elif defined(_DEBUG)
168 # define LIBSMBIOS_LIB_RT_OPT "-sgdpn"
169 # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1")
170 # error "Build options aren't compatible with pre-built libraries"
171 # else
172 # define LIBSMBIOS_LIB_RT_OPT "-spn"
173 # endif
174 
175 # else
176 
177 # if defined(_DEBUG)
178 # define LIBSMBIOS_LIB_RT_OPT "-sgd"
179 # else
180 # define LIBSMBIOS_LIB_RT_OPT "-s"
181 # endif
182 
183 # endif
184 
185 # endif
186 #endif
187 
188 #define LIBSMBIOS_LIB_NAME smbios
189 
190 #ifndef LIBSMBIOS_AUTO_LINK_NOMANGLE
191 # pragma comment(lib, LIBSMBIOS_LIB_PREFIX LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) "-" LIBSMBIOS_LIB_TOOLSET LIBSMBIOS_LIB_THREAD_OPT LIBSMBIOS_LIB_RT_OPT ".lib" )
192 # ifdef LIBSMBIOS_LIB_DIAGNOSTIC
193 # 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")
194 # endif
195 # if defined(LIBSMBIOS_NEED_SMBIOSXML)
196 # undef LIBSMBIOS_LIB_NAME
197 # define LIBSMBIOS_LIB_NAME smbiosxml
198 # pragma comment(lib, LIBSMBIOS_LIB_PREFIX LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) "-" LIBSMBIOS_LIB_TOOLSET LIBSMBIOS_LIB_THREAD_OPT LIBSMBIOS_LIB_RT_OPT ".lib" )
199 # ifdef LIBSMBIOS_LIB_DIAGNOSTIC
200 # 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")
201 # endif
202 # endif
203 #else
204 # pragma comment(lib, LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) ".lib" )
205 # ifdef LIBSMBIOS_LIB_DIAGNOSTIC
206 # pragma message ("Automatically Linking to lib file: " LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) ".lib")
207 # endif
208 # if defined(LIBSMBIOS_NEED_SMBIOSXML)
209 # undef LIBSMBIOS_LIB_NAME
210 # define LIBSMBIOS_LIB_NAME smbiosxml
211 # pragma comment(lib, LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) ".lib" )
212 # ifdef LIBSMBIOS_LIB_DIAGNOSTIC
213 # pragma message ("Automatically Linking to lib file: " LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) ".lib")
214 # endif
215 # endif
216 #endif
217 
218 // automatic linking for xerces, if we are using XML
219 #if defined(LIBSMBIOS_NEED_SMBIOSXML)
220 # undef LIBSMBIOS_LIB_NAME
221 # if !defined(_MT) && !defined(__MT__)
222 # 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.")
223 # endif
224 
225 # if (defined(_DLL) || defined(_RTLDLL))
226 # if defined(_DEBUG)
227 # define LIBSMBIOS_LIB_NAME xerces-c_2D
228 # else
229 # define LIBSMBIOS_LIB_NAME xerces-c_2
230 # endif
231 # else
232 # if defined(_DEBUG)
233 # define LIBSMBIOS_LIB_NAME Xerces-c_static_2D
234 # else
235 # define LIBSMBIOS_LIB_NAME Xerces-c_static_2
236 # endif
237 # endif
238 # pragma comment(lib, LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) ".lib" )
239 # ifdef LIBSMBIOS_LIB_DIAGNOSTIC
240 # pragma message ("Automatically Linking to lib file: " LIBSMBIOS_STRINGIZE(LIBSMBIOS_LIB_NAME) ".lib")
241 # endif
242 #endif
243 
244 // //#include <config/auto_link.hpp>
245 #endif /* !LIBSMBIOS_ALL_NO_LIB && ! LIBSMBIOS_SOURCE */
246 #endif /* LIBSMBIOS_PLATFORM_WIN32 */
247 
248 #ifdef LIBSMBIOS_LIB_PREFIX
249 # undef LIBSMBIOS_LIB_PREFIX
250 #endif
251 #if defined(LIBSMBIOS_LIB_NAME)
252 # undef LIBSMBIOS_LIB_NAME
253 #endif
254 #if defined(LIBSMBIOS_LIB_TOOLSET)
255 # undef LIBSMBIOS_LIB_TOOLSET
256 #endif
257 #if defined(LIBSMBIOS_LIB_THREAD_OPT)
258 # undef LIBSMBIOS_LIB_THREAD_OPT
259 #endif
260 #if defined(LIBSMBIOS_LIB_RT_OPT)
261 # undef LIBSMBIOS_LIB_RT_OPT
262 #endif
263 #if defined(LIBSMBIOS_LIB_LINK_OPT)
264 # undef LIBSMBIOS_LIB_LINK_OPT
265 #endif
266 #if defined(LIBSMBIOS_LIB_DEBUG_OPT)
267 # undef LIBSMBIOS_LIB_DEBUG_OPT
268 #endif
269 #if defined(LIBSMBIOS_DYN_LINK)
270 # undef LIBSMBIOS_DYN_LINK
271 #endif
272 #if defined(LIBSMBIOS_AUTO_LINK_NOMANGLE)
273 # undef LIBSMBIOS_AUTO_LINK_NOMANGLE
274 #endif
275 
276 #endif /* AUTO_LINK_H */