You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

310 lines
10 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: b64/implicit_link.h
  3. *
  4. * Purpose: Implicit linking for the b64 API.
  5. *
  6. * Created: 5th March 2006
  7. * Updated: 16th June 2010
  8. *
  9. * Home: http://synesis.com.au/software/
  10. *
  11. * Copyright (c) 2006-2010, Matthew Wilson and Synesis Software
  12. * All rights reserved.
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions are
  16. * met:
  17. *
  18. * - Redistributions of source code must retain the above copyright notice,
  19. * this list of conditions and the following disclaimer.
  20. * - Redistributions in binary form must reproduce the above copyright
  21. * notice, this list of conditions and the following disclaimer in the
  22. * documentation and/or other materials provided with the distribution.
  23. * - Neither the names of Matthew Wilson and Synesis Software nor the names
  24. * of any contributors may be used to endorse or promote products derived
  25. * from this software without specific prior written permission.
  26. *
  27. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  28. * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  29. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  30. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  31. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  32. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  33. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  34. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  35. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  36. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  37. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. * ////////////////////////////////////////////////////////////////////// */
  40. /** \file b64/implicit_link.h \brief [C/C++] Implicit linking for the b64 API
  41. *
  42. * Inclusion of this file causes the appropriate library file to be automatically
  43. * linked for compilers that support implicit linking: Borland, Metrowerks
  44. * CodeWarrior, Intel, and Visual C++.
  45. */
  46. #ifndef B64_INCL_B64_H_IMPLICIT_LINK
  47. #define B64_INCL_B64_H_IMPLICIT_LINK
  48. /* /////////////////////////////////////////////////////////////////////////
  49. * Version
  50. */
  51. #ifndef B64_DOCUMENTATION_SKIP_SECTION
  52. # define B64_VER_B64_H_IMPLICIT_LINK_MAJOR 1
  53. # define B64_VER_B64_H_IMPLICIT_LINK_MINOR 3
  54. # define B64_VER_B64_H_IMPLICIT_LINK_REVISION 1
  55. # define B64_VER_B64_H_IMPLICIT_LINK_EDIT 9
  56. #endif /* !B64_DOCUMENTATION_SKIP_SECTION */
  57. /* /////////////////////////////////////////////////////////////////////////
  58. * Includes
  59. */
  60. #ifndef B64_INCL_B64_H_B64
  61. # include <b64/b64.h>
  62. #endif /* !B64_INCL_B64_H_B64 */
  63. /* /////////////////////////////////////////////////////////////////////////
  64. * Macros and definitions
  65. */
  66. # define B64_IMPL_LINK_STRINGIZE_2_(x) #x
  67. # define B64_IMPL_LINK_STRINGIZE_1_(x) B64_IMPL_LINK_STRINGIZE_2_(x)
  68. /* /////////////////////////////////////////////////////////////////////////
  69. * Implicit linking
  70. */
  71. #if defined(_WIN32) || \
  72. defined(_WIN64)
  73. # if defined(__BORLANDC__) || \
  74. /* defined(__DMC__) || */ \
  75. defined(__INTEL_COMPILER) || \
  76. defined(__MWERKS__) || \
  77. defined(_MSC_VER)
  78. # if !defined(__COMO__)
  79. # define B64_IMPLICIT_LINK_SUPPORT
  80. # endif /* compiler */
  81. # endif /* compiler */
  82. #if defined(B64_IMPLICIT_LINK_SUPPORT) && \
  83. defined(B64_NO_IMPLICIT_LINK)
  84. # undef B64_IMPLICIT_LINK_SUPPORT
  85. #endif /* B64_IMPLICIT_LINK_SUPPORT && B64_NO_IMPLICIT_LINK */
  86. # if defined(B64_IMPLICIT_LINK_SUPPORT)
  87. /* prefix */
  88. # define B64_IMPL_LINK_PREFIX
  89. /* library basename */
  90. # define B64_IMPL_LINK_LIBRARY_BASENAME "b64"
  91. /* major version */
  92. # define B64_IMPL_LINK_MAJOR_VERSION "." B64_IMPL_LINK_STRINGIZE_1_(B64_VER_MAJOR)
  93. /* module name */
  94. # define B64_IMPL_LINK_MODULE_NAME ".core"
  95. /* compiler tag */
  96. # if defined(__BORLANDC__)
  97. # if __BORLANDC__ == 0x0550
  98. # define B64_IMPL_LINK_COMPILER_NAME "bc55"
  99. # elif (__BORLANDC__ == 0x0551)
  100. # define B64_IMPL_LINK_COMPILER_NAME "bc551"
  101. # elif (__BORLANDC__ == 0x0560)
  102. # define B64_IMPL_LINK_COMPILER_NAME "bc56"
  103. # elif (__BORLANDC__ == 0x0564)
  104. # define B64_IMPL_LINK_COMPILER_NAME "bc564"
  105. # elif (__BORLANDC__ == 0x0582)
  106. # define B64_IMPL_LINK_COMPILER_NAME "bc582"
  107. # elif (0x0590 == (__BORLANDC__ & 0xfff0))
  108. # define B64_IMPL_LINK_COMPILER_NAME "bc59x"
  109. # elif (0x0610 == (__BORLANDC__ & 0xfff0))
  110. # define B64_IMPL_LINK_COMPILER_NAME "bc61x"
  111. # else /* ? __BORLANDC__ */
  112. # error Unrecognised value of __BORLANDC__
  113. # endif /* __BORLANDC__ */
  114. /*
  115. # elif defined(__DMC__)
  116. # define B64_IMPL_LINK_COMPILER_NAME "dm"
  117. */
  118. # elif defined(__INTEL_COMPILER)
  119. # if (__INTEL_COMPILER == 600)
  120. # define B64_IMPL_LINK_COMPILER_NAME "icl6"
  121. # elif (__INTEL_COMPILER == 700)
  122. # define B64_IMPL_LINK_COMPILER_NAME "icl7"
  123. # elif (__INTEL_COMPILER == 800)
  124. # define B64_IMPL_LINK_COMPILER_NAME "icl8"
  125. # elif (__INTEL_COMPILER == 900)
  126. # define B64_IMPL_LINK_COMPILER_NAME "icl9"
  127. # elif (__INTEL_COMPILER == 1000)
  128. # define B64_IMPL_LINK_COMPILER_NAME "icl10"
  129. # elif (__INTEL_COMPILER == 1100)
  130. # define B64_IMPL_LINK_COMPILER_NAME "icl11"
  131. # else /* ? __INTEL_COMPILER */
  132. # error Unrecognised value of __INTEL_COMPILER
  133. # endif /* __INTEL_COMPILER */
  134. # elif defined(__MWERKS__)
  135. # if ((__MWERKS__ & 0xFF00) == 0x2400)
  136. # define B64_IMPL_LINK_COMPILER_NAME "cw7"
  137. # elif ((__MWERKS__ & 0xFF00) == 0x3000)
  138. # define B64_IMPL_LINK_COMPILER_NAME "cw8"
  139. # elif ((__MWERKS__ & 0xFF00) == 0x3200)
  140. # define B64_IMPL_LINK_COMPILER_NAME "cw9"
  141. # else /* ? __MWERKS__ */
  142. # error Unrecognised value of __MWERKS__
  143. # endif /* __MWERKS__ */
  144. # elif defined(_MSC_VER)
  145. # if _MSC_VER == 1000
  146. # define B64_IMPL_LINK_COMPILER_NAME "vc4"
  147. # elif _MSC_VER == 1020
  148. # define B64_IMPL_LINK_COMPILER_NAME "vc42"
  149. # elif _MSC_VER == 1100
  150. # define B64_IMPL_LINK_COMPILER_NAME "vc5"
  151. # elif _MSC_VER == 1200
  152. # define B64_IMPL_LINK_COMPILER_NAME "vc6"
  153. # elif _MSC_VER == 1300
  154. # define B64_IMPL_LINK_COMPILER_NAME "vc7"
  155. # elif _MSC_VER == 1310
  156. # define B64_IMPL_LINK_COMPILER_NAME "vc71"
  157. # elif _MSC_VER == 1400
  158. # define B64_IMPL_LINK_COMPILER_NAME "vc8"
  159. # elif _MSC_VER == 1500
  160. # define B64_IMPL_LINK_COMPILER_NAME "vc9"
  161. # elif _MSC_VER == 1600
  162. # define B64_IMPL_LINK_COMPILER_NAME "vc10"
  163. # else /* ? _MSC_VER */
  164. # error Unrecognised value of _MSC_VER
  165. # endif /* _MSC_VER */
  166. # else /* ? compiler */
  167. # error Unrecognised compiler
  168. # endif /* compiler */
  169. /* operating system tag */
  170. # if defined(_STLSOFT_FORCE_ANY_COMPILER) && \
  171. defined(PLATFORMSTL_OS_IS_UNIX) && \
  172. defined(_WIN32)
  173. # define B64_IMPL_LINK_OS_TAG ".unix"
  174. # endif /* pseudo UNIX */
  175. # if !defined(B64_IMPL_LINK_OS_TAG)
  176. # define B64_IMPL_LINK_OS_TAG ""
  177. # endif /* !B64_IMPL_LINK_OS_TAG */
  178. /* architecture tag */
  179. # if defined(PLATFORMSTL_ARCH_IS_X86)
  180. # define B64_IMPL_LINK_ARCH_TAG ""
  181. # elif defined(PLATFORMSTL_ARCH_IS_X64)
  182. # define B64_IMPL_LINK_ARCH_TAG ".x64"
  183. # elif defined(PLATFORMSTL_ARCH_IS_IA64)
  184. # define B64_IMPL_LINK_ARCH_TAG ".ia64"
  185. # endif /* arch */
  186. # if !defined(B64_IMPL_LINK_ARCH_TAG)
  187. # define B64_IMPL_LINK_ARCH_TAG ""
  188. # endif /* !B64_IMPL_LINK_ARCH_TAG */
  189. /* encoding tag */
  190. # if defined(B64_USE_WIDE_STRINGS)
  191. # define B64_IMPL_LINK_ENCODING_TAG ".widestring"
  192. # else /* ? B64_USE_WIDE_STRINGS */
  193. # define B64_IMPL_LINK_ENCODING_TAG ""
  194. # endif /* B64_USE_WIDE_STRINGS */
  195. /* threading tag */
  196. # if defined(__MT__) || \
  197. defined(_REENTRANT) || \
  198. defined(_MT)
  199. # if defined(_DLL) || \
  200. defined(__DLL)
  201. # define B64_IMPL_LINK_THREADING_TAG ".dll"
  202. # else /* ? dll */
  203. # define B64_IMPL_LINK_THREADING_TAG ".mt"
  204. # endif /* dll */
  205. # else /* ? mt */
  206. # define B64_IMPL_LINK_THREADING_TAG ""
  207. # endif /* mt */
  208. /* NoX */
  209. # if defined(B64_CF_NOX)
  210. # define B64_IMPL_LINK_NOX_TYPE ".nox"
  211. # else /* ? B64_CF_NOX */
  212. # define B64_IMPL_LINK_NOX_TYPE ""
  213. # endif /* B64_CF_NOX */
  214. /* debug tag */
  215. # if defined(B64_VARIANT_TEST)
  216. # define B64_IMPL_LINK_DEBUG_TYPE ".test"
  217. # elif !defined(NDEBUG) && \
  218. defined(_DEBUG)
  219. # define B64_IMPL_LINK_DEBUG_TAG ".debug"
  220. # else /* ? debug */
  221. # define B64_IMPL_LINK_DEBUG_TAG ""
  222. # endif /* debug */
  223. /* suffix */
  224. # define B64_IMPL_LINK_SUFFIX ".lib"
  225. /* Library name is:
  226. *
  227. * [lib]<library-basename>.<major-version>.<module-name>.<compiler-name>[.<os-arch-tag>][.<char-encoding-tag>][.<threading-tag>][.<nox-tag>][.<debug-tag>].{a|lib}
  228. */
  229. # define B64_IMPL_LINK_LIBRARY_NAME B64_IMPL_LINK_PREFIX \
  230. B64_IMPL_LINK_LIBRARY_BASENAME \
  231. B64_IMPL_LINK_MAJOR_VERSION \
  232. B64_IMPL_LINK_MODULE_NAME \
  233. "." B64_IMPL_LINK_COMPILER_NAME \
  234. B64_IMPL_LINK_OS_TAG \
  235. B64_IMPL_LINK_ARCH_TAG \
  236. B64_IMPL_LINK_ENCODING_TAG \
  237. B64_IMPL_LINK_THREADING_TAG \
  238. B64_IMPL_LINK_NOX_TYPE \
  239. B64_IMPL_LINK_DEBUG_TAG \
  240. B64_IMPL_LINK_SUFFIX
  241. # pragma message("lib: " B64_IMPL_LINK_LIBRARY_NAME)
  242. # pragma comment(lib, B64_IMPL_LINK_LIBRARY_NAME)
  243. # endif /* B64_IMPLICIT_LINK_SUPPORT */
  244. #endif /* Win-32 || Win-64 */
  245. /* ////////////////////////////////////////////////////////////////////// */
  246. #endif /* B64_INCL_B64_H_IMPLICIT_LINK */
  247. /* ///////////////////////////// end of file //////////////////////////// */