Subversion Repositories QNX 8.QNX8 IFS tool

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /* ACC -- Automatic Compiler Configuration
  2.  
  3.    Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
  4.    All Rights Reserved.
  5.  
  6.    This software is a copyrighted work licensed under the terms of
  7.    the GNU General Public License. Please consult the file "ACC_LICENSE"
  8.    for details.
  9.  
  10.    Markus F.X.J. Oberhumer
  11.    <markus@oberhumer.com>
  12.    http://www.oberhumer.com/
  13.  */
  14.  
  15.  
  16.  
  17. /***********************************************************************
  18. // preprocessor
  19. ************************************************************************/
  20.  
  21. /* workaround for preprocessor bugs in some compilers */
  22. #if 0
  23. #define ACC_0xffffL             0xfffful
  24. #define ACC_0xffffffffL         0xfffffffful
  25. #else
  26. #define ACC_0xffffL             65535ul
  27. #define ACC_0xffffffffL         4294967295ul
  28. #endif
  29.  
  30. /* some things we cannot work around */
  31. #if (ACC_0xffffL == ACC_0xffffffffL)
  32. #  error "your preprocessor is broken 1"
  33. #endif
  34. #if (16ul * 16384ul != 262144ul)
  35. #  error "your preprocessor is broken 2"
  36. #endif
  37. #if 0
  38. #if (32767 >= 4294967295ul)
  39. #  error "your preprocessor is broken 3"
  40. #endif
  41. #if (65535u >= 4294967295ul)
  42. #  error "your preprocessor is broken 4"
  43. #endif
  44. #endif
  45.  
  46.  
  47. /***********************************************************************
  48. // try to detect specific compilers
  49. ************************************************************************/
  50.  
  51. #if (UINT_MAX == ACC_0xffffL)
  52. #if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__)
  53. #  if !defined(MSDOS)
  54. #    define MSDOS 1
  55. #  endif
  56. #  if !defined(_MSDOS)
  57. #    define _MSDOS 1
  58. #  endif
  59. #elif defined(__VERSION) && defined(MB_LEN_MAX)
  60. #  if (__VERSION == 520) && (MB_LEN_MAX == 1)
  61. #    if !defined(__AZTEC_C__)
  62. #      define __AZTEC_C__ __VERSION
  63. #    endif
  64. #    if !defined(__DOS__)
  65. #      define __DOS__ 1
  66. #    endif
  67. #  endif
  68. #endif
  69. #endif
  70.  
  71.  
  72. /***********************************************************************
  73. // fix incorrect and missing stuff
  74. ************************************************************************/
  75.  
  76. /* Microsoft C does not correctly define ptrdiff_t for
  77.  * the 16-bit huge memory model.
  78.  */
  79. #if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == ACC_0xffffL)
  80. #  define ptrdiff_t long
  81. #  define _PTRDIFF_T_DEFINED
  82. #endif
  83.  
  84.  
  85. /* Fix old compiler versions. */
  86. #if (UINT_MAX == ACC_0xffffL)
  87. #  undef __ACC_RENAME_A
  88. #  undef __ACC_RENAME_B
  89. #  if defined(__AZTEC_C__) && defined(__DOS__)
  90. #    define __ACC_RENAME_A 1
  91. #  elif defined(_MSC_VER) && defined(MSDOS)
  92. #    if (_MSC_VER < 600)
  93. #      define __ACC_RENAME_A 1
  94. #    elif (_MSC_VER < 700)
  95. #      define __ACC_RENAME_B 1
  96. #    endif
  97. #  elif defined(__TSC__) && defined(__OS2__)
  98. #    define __ACC_RENAME_A 1
  99. #  elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410)
  100. #    define __ACC_RENAME_A 1
  101. #  elif defined(__PACIFIC__) && defined(DOS)
  102. #    if !defined(__far)
  103. #      define __far far
  104. #    endif
  105. #    if !defined(__near)
  106. #      define __near near
  107. #    endif
  108. #  endif
  109. #  if defined(__ACC_RENAME_A)
  110. #    if !defined(__cdecl)
  111. #      define __cdecl cdecl
  112. #    endif
  113. #    if !defined(__far)
  114. #      define __far far
  115. #    endif
  116. #    if !defined(__huge)
  117. #      define __huge huge
  118. #    endif
  119. #    if !defined(__near)
  120. #      define __near near
  121. #    endif
  122. #    if !defined(__pascal)
  123. #      define __pascal pascal
  124. #    endif
  125. #    if !defined(__huge)
  126. #      define __huge huge
  127. #    endif
  128. #  elif defined(__ACC_RENAME_B)
  129. #    if !defined(__cdecl)
  130. #      define __cdecl _cdecl
  131. #    endif
  132. #    if !defined(__far)
  133. #      define __far _far
  134. #    endif
  135. #    if !defined(__huge)
  136. #      define __huge _huge
  137. #    endif
  138. #    if !defined(__near)
  139. #      define __near _near
  140. #    endif
  141. #    if !defined(__pascal)
  142. #      define __pascal _pascal
  143. #    endif
  144. #  elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__)
  145. #    if !defined(__cdecl)
  146. #      define __cdecl cdecl
  147. #    endif
  148. #    if !defined(__pascal)
  149. #      define __pascal pascal
  150. #    endif
  151. #  endif
  152. #  undef __ACC_RENAME_A
  153. #  undef __ACC_RENAME_B
  154. #endif
  155.  
  156.  
  157. #if (UINT_MAX == ACC_0xffffL)
  158. #if defined(__AZTEC_C__) && defined(__DOS__)
  159. #  define ACC_BROKEN_CDECL_ALT_SYNTAX 1
  160. #elif defined(_MSC_VER) && defined(MSDOS)
  161. #  if (_MSC_VER < 600)
  162. #    define ACC_BROKEN_INTEGRAL_CONSTANTS 1
  163. #  endif
  164. #  if (_MSC_VER < 700)
  165. #    define ACC_BROKEN_INTEGRAL_PROMOTION 1
  166. #    define ACC_BROKEN_SIZEOF 1
  167. #  endif
  168. #elif defined(__PACIFIC__) && defined(DOS)
  169. #  define ACC_BROKEN_INTEGRAL_CONSTANTS 1
  170. #elif defined(__TURBOC__) && defined(__MSDOS__)
  171. #  if (__TURBOC__ < 0x0150)
  172. #    define ACC_BROKEN_CDECL_ALT_SYNTAX 1
  173. #    define ACC_BROKEN_INTEGRAL_CONSTANTS 1
  174. #    define ACC_BROKEN_INTEGRAL_PROMOTION 1
  175. #  endif
  176. #  if (__TURBOC__ < 0x0200)
  177. #    define ACC_BROKEN_SIZEOF 1
  178. #  endif
  179. #  if (__TURBOC__ < 0x0400) && defined(__cplusplus)
  180. #    define ACC_BROKEN_CDECL_ALT_SYNTAX 1
  181. #  endif
  182. #elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__)
  183. #  define ACC_BROKEN_CDECL_ALT_SYNTAX 1
  184. #  define ACC_BROKEN_SIZEOF 1
  185. #endif
  186. #endif
  187. #if defined(__WATCOMC__) && (__WATCOMC__ < 900)
  188. #  define ACC_BROKEN_INTEGRAL_CONSTANTS 1
  189. #endif
  190.  
  191.  
  192. /***********************************************************************
  193. // ANSI C preprocessor macros (cpp)
  194. ************************************************************************/
  195.  
  196. #define ACC_CPP_STRINGIZE(x)            #x
  197. #define ACC_CPP_MACRO_EXPAND(x)         ACC_CPP_STRINGIZE(x)
  198.  
  199. /* concatenate */
  200. #define ACC_CPP_CONCAT2(a,b)            a ## b
  201. #define ACC_CPP_CONCAT3(a,b,c)          a ## b ## c
  202. #define ACC_CPP_CONCAT4(a,b,c,d)        a ## b ## c ## d
  203. #define ACC_CPP_CONCAT5(a,b,c,d,e)      a ## b ## c ## d ## e
  204.  
  205. /* expand and concatenate (by using one level of indirection) */
  206. #define ACC_CPP_ECONCAT2(a,b)           ACC_CPP_CONCAT2(a,b)
  207. #define ACC_CPP_ECONCAT3(a,b,c)         ACC_CPP_CONCAT3(a,b,c)
  208. #define ACC_CPP_ECONCAT4(a,b,c,d)       ACC_CPP_CONCAT4(a,b,c,d)
  209. #define ACC_CPP_ECONCAT5(a,b,c,d,e)     ACC_CPP_CONCAT5(a,b,c,d,e)
  210.  
  211.  
  212. /***********************************************************************
  213. // stdc macros
  214. ************************************************************************/
  215.  
  216. #if defined(__cplusplus)
  217. #  undef __STDC_CONSTANT_MACROS
  218. #  undef __STDC_LIMIT_MACROS
  219. #  define __STDC_CONSTANT_MACROS 1
  220. #  define __STDC_LIMIT_MACROS 1
  221. #endif
  222.  
  223.  
  224. /***********************************************************************
  225. // misc macros
  226. ************************************************************************/
  227.  
  228. #if defined(__cplusplus)
  229. #  define ACC_EXTERN_C extern "C"
  230. #else
  231. #  define ACC_EXTERN_C extern
  232. #endif
  233.  
  234.  
  235. /*
  236. vi:ts=4:et
  237. */
  238.