PageRenderTime 40ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/dep/acelite/ace/config-linux-common.h

http://github.com/TrinityCore/TrinityCore
C++ Header | 438 lines | 236 code | 89 blank | 113 comment | 50 complexity | 70de4cb22ebcce876de6b4c2d18ff89a MD5 | raw file
Possible License(s): BSD-2-Clause, BSD-3-Clause, GPL-2.0, CC-BY-SA-3.0
  1. /* -*- C++ -*- */
  2. // $Id: config-linux-common.h 92183 2010-10-08 08:44:15Z olli $
  3. // Do not use this configuration file directly since it's designed to
  4. // be included by another, specific configuration file, such as
  5. // config-linux.h. It provides config information common to all Linux
  6. // platforms. It automatically determines the CPU architecture,
  7. // compiler (g++ or egcs), and libc (libc5 or glibc), and configures
  8. // based on those.
  9. #ifndef ACE_LINUX_COMMON_H
  10. #define ACE_LINUX_COMMON_H
  11. #include /**/ "ace/pre.h"
  12. #define ACE_HAS_BYTESEX_H
  13. #if ! defined (__ACE_INLINE__)
  14. #define __ACE_INLINE__
  15. #endif /* ! __ACE_INLINE__ */
  16. // Needed to differentiate between libc 5 and libc 6 (aka glibc).
  17. #include <features.h>
  18. #if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500)
  19. # define ACE_HAS_PTHREADS_UNIX98_EXT
  20. #endif /* _XOPEN_SOURCE - 0 >= 500 */
  21. #if !defined (ACE_LACKS_LINUX_NPTL)
  22. # include "ace/config-posix.h"
  23. // Temporary fix because NPTL kernels do have shm_open but there is a problem
  24. // with shm_open/shm_unlink pairing in ACE which needs to be fixed when I have time.
  25. # if defined (ACE_HAS_SHM_OPEN)
  26. # undef ACE_HAS_SHM_OPEN
  27. # endif /* ACE_HAS_SHM_OPEN */
  28. # if defined (ACE_USES_FIFO_SEM)
  29. // Don't use this for Linux NPTL since this has complete
  30. // POSIX semaphores which are more efficient
  31. # undef ACE_USES_FIFO_SEM
  32. # endif /* ACE_USES_FIFO_SEM */
  33. # if defined (ACE_HAS_POSIX_SEM)
  34. // Linux NPTL may not define the right POSIX macro
  35. // but they have the actual runtime support for this stuff
  36. # if !defined (ACE_HAS_POSIX_SEM_TIMEOUT) && (((_POSIX_C_SOURCE - 0) >= 200112L) || (_XOPEN_SOURCE >= 600))
  37. # define ACE_HAS_POSIX_SEM_TIMEOUT
  38. # endif /* !ACE_HAS_POSIX_SEM_TIMEOUT && (((_POSIX_C_SOURCE - 0) >= 200112L) || (_XOPEN_SOURCE >= 600)) */
  39. # endif /* ACE_HAS_POSIX_SEM */
  40. #endif /* !ACE_LACKS_LINUX_NPTL */
  41. // First the machine specific part
  42. #if defined (__powerpc__) || defined (__x86_64__)
  43. # if !defined (ACE_DEFAULT_BASE_ADDR)
  44. # define ACE_DEFAULT_BASE_ADDR ((char *) 0x40000000)
  45. # endif /* ! ACE_DEFAULT_BASE_ADDR */
  46. #elif defined (__ia64)
  47. # if !defined (ACE_DEFAULT_BASE_ADDR)
  48. // Zero base address should work fine for Linux of IA-64: it just lets
  49. // the kernel to choose the right value.
  50. # define ACE_DEFAULT_BASE_ADDR ((char *) 0x0000000000000000)
  51. # endif /* ! ACE_DEFAULT_BASE_ADDR */
  52. #endif /* ! __powerpc__ && ! __ia64 */
  53. // Then glibc/libc5 specific parts
  54. #if defined(__GLIBC__)
  55. # if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
  56. # define ACE_HAS_NONCONST_SETRLIMIT
  57. # endif
  58. # if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 3)
  59. # define ACE_HAS_RUSAGE_WHO_ENUM enum __rusage_who
  60. # define ACE_HAS_RLIMIT_RESOURCE_ENUM enum __rlimit_resource
  61. # define ACE_LACKS_ISCTYPE
  62. # endif
  63. # define ACE_HAS_SOCKLEN_T
  64. # define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
  65. // glibc defines both of these, used in OS_String.
  66. # if defined (_GNU_SOURCE)
  67. # define ACE_HAS_STRNLEN
  68. # define ACE_HAS_WCSNLEN
  69. // This is probably not a 100%-sure-fire check... Red Hat Linux 9
  70. // and Enterprise Linux 3 and up have a new kernel that can send signals
  71. // across threads. This was not possible prior because there was no real
  72. // difference between a process and a thread. With this, the
  73. // ACE_POSIX_SIG_Proactor is the only chance of getting asynch I/O working.
  74. // There are restrictions, such as all socket operations being silently
  75. // converted to synchronous by the kernel, that make aio a non-starter
  76. // for most Linux platforms at this time. But we'll start to crawl...
  77. # define ACE_POSIX_SIG_PROACTOR
  78. # endif
  79. // To avoid the strangeness with Linux's ::select (), which modifies
  80. // its timeout argument, use ::poll () instead.
  81. # define ACE_HAS_POLL
  82. // Don't define _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED in ACE to make
  83. // getpgid() prototype visible. ACE shouldn't depend on feature test
  84. // macros to make prototypes visible.
  85. # define ACE_LACKS_GETPGID_PROTOTYPE
  86. // @note the following defines are necessary with glibc 2.0 (0.961212-5)
  87. // on Alpha. I assume that they're necessary on Intel as well,
  88. // but that may depend on the version of glibc that is used.
  89. //# define ACE_HAS_DLFCN_H_BROKEN_EXTERN_C
  90. # define ACE_HAS_VOIDPTR_SOCKOPT
  91. // Don't define _POSIX_SOURCE in ACE to make strtok() prototype
  92. // visible. ACE shouldn't depend on feature test macros to make
  93. // prototypes visible.
  94. # define ACE_LACKS_STRTOK_R_PROTOTYPE
  95. // @note end of glibc 2.0 (0.961212-5)-specific configuration.
  96. # if __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1
  97. // These were suggested by Robert Hanzlik <robi@codalan.cz> to get
  98. // ACE to compile on Linux using glibc 2.1 and libg++/gcc 2.8.
  99. # undef ACE_HAS_BYTESEX_H
  100. # define ACE_HAS_SIGINFO_T
  101. # define ACE_LACKS_SIGINFO_H
  102. # define ACE_HAS_UCONTEXT_T
  103. // Pre-glibc (RedHat 5.2) doesn't have sigtimedwait.
  104. # define ACE_HAS_SIGTIMEDWAIT
  105. # endif /* __GLIBC__ 2.1+ */
  106. #else /* ! __GLIBC__ */
  107. // Fixes a problem with some non-glibc versions of Linux...
  108. # define ACE_LACKS_MADVISE
  109. # define ACE_LACKS_MSG_ACCRIGHTS
  110. #endif /* ! __GLIBC__ */
  111. // Don't define _LARGEFILE64_SOURCE in ACE to make llseek() or
  112. // lseek64() prototype visible. ACE shouldn't depend on feature test
  113. // macros to make prototypes visible.
  114. #if __GLIBC__ > 1
  115. # if __GLIBC_MINOR__ == 0
  116. # define ACE_HAS_LLSEEK
  117. # define ACE_LACKS_LLSEEK_PROTOTYPE
  118. # else /* __GLIBC_MINOR__ > 0 */
  119. # define ACE_HAS_LSEEK64
  120. # define ACE_LACKS_LSEEK64_PROTOTYPE
  121. # endif
  122. #endif /* __GLIBC__ > 1 */
  123. #if __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1
  124. # define ACE_HAS_P_READ_WRITE
  125. // Use ACE's alternate cuserid() implementation since the use of the
  126. // system cuserid() is discouraged.
  127. # define ACE_HAS_ALT_CUSERID
  128. #endif /* __GLIBC__ > 1 && __GLIBC_MINOR__ >= 0 */
  129. #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
  130. # define ACE_HAS_ISASTREAM_PROTOTYPE
  131. # define ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE
  132. # define ACE_HAS_CPU_SET_T
  133. #endif /* __GLIBC__ > 2 || __GLIBC__ === 2 && __GLIBC_MINOR__ >= 3) */
  134. // Then the compiler specific parts
  135. #if defined (__INTEL_COMPILER)
  136. # include "ace/config-icc-common.h"
  137. #elif defined (__GNUG__)
  138. // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so
  139. // this must appear before its #include.
  140. # define ACE_HAS_STRING_CLASS
  141. # include "ace/config-g++-common.h"
  142. #elif defined (__SUNCC_PRO) || defined (__SUNPRO_CC)
  143. # include "ace/config-suncc-common.h"
  144. #elif defined (__PGI)
  145. // Portable group compiler
  146. # define ACE_HAS_CPLUSPLUS_HEADERS
  147. # define ACE_HAS_STDCPP_STL_INCLUDES
  148. # define ACE_HAS_STANDARD_CPP_LIBRARY 1
  149. # define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
  150. # define ACE_LACKS_SWAB
  151. #elif defined (__GNUC__)
  152. /**
  153. * GNU C compiler.
  154. *
  155. * We need to recognize the GNU C compiler since TAO has at least one
  156. * C source header and file
  157. * (TAO/orbsvcs/orbsvcs/SSLIOP/params_dup.{h,c}) that may indirectly
  158. * include this
  159. */
  160. #else /* ! __GNUG__ && !__DECCXX && !__INTEL_COMPILER && && !__PGI */
  161. # ifdef __cplusplus /* Let it slide for C compilers. */
  162. # error unsupported compiler in ace/config-linux-common.h
  163. # endif /* __cplusplus */
  164. #endif /* ! __GNUG__*/
  165. // Completely common part :-)
  166. // Platform/compiler has the sigwait(2) prototype
  167. #define ACE_HAS_SIGWAIT
  168. #define ACE_HAS_SIGSUSPEND
  169. #define ACE_HAS_UALARM
  170. #define ACE_HAS_STRSIGNAL
  171. #if __GLIBC__ >= 2
  172. #ifndef ACE_HAS_POSIX_REALTIME_SIGNALS
  173. #define ACE_HAS_POSIX_REALTIME_SIGNALS
  174. #endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
  175. #ifndef ACE_HAS_AIO_CALLS
  176. #define ACE_HAS_AIO_CALLS
  177. #endif /* ACE_HAS_AIO_CALLS */
  178. #endif
  179. #if __GLIBC__ >= 2
  180. // glibc 2 and higher has wchar support
  181. # define ACE_HAS_XPG4_MULTIBYTE_CHAR
  182. # define ACE_HAS_VFWPRINTF
  183. #endif
  184. #if __GLIBC__ < 2
  185. // These are present in glibc 2 and higher
  186. # define ACE_LACKS_WCSTOK
  187. # define ACE_LACKS_WCSDUP_PROTOTYPE
  188. #endif /* __GLIBC__ < 2 */
  189. #define ACE_LACKS_ITOW
  190. #define ACE_LACKS_WCSICMP
  191. #define ACE_LACKS_WCSNICMP
  192. #define ACE_LACKS_ISWASCII
  193. #if __GLIBC__ >= 2
  194. # define ACE_HAS_3_PARAM_WCSTOK
  195. #endif
  196. #define ACE_HAS_3_PARAM_READDIR_R
  197. #if !defined (ACE_DEFAULT_BASE_ADDR)
  198. # define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000)
  199. #endif /* ! ACE_DEFAULT_BASE_ADDR */
  200. // Compiler/platform supports alloca().
  201. // Although ACE does have alloca() on this compiler/platform combination, it is
  202. // disabled by default since it can be dangerous. Uncomment the following line
  203. // if you ACE to use it.
  204. //#define ACE_HAS_ALLOCA
  205. // Compiler/platform has <alloca.h>
  206. #define ACE_HAS_ALLOCA_H
  207. #define ACE_HAS_SYS_SYSINFO_H
  208. #define ACE_HAS_LINUX_SYSINFO
  209. // Compiler/platform has the getrusage() system call.
  210. #define ACE_HAS_GETRUSAGE
  211. #define ACE_HAS_GETRUSAGE_PROTOTYPE
  212. #define ACE_HAS_BYTESWAP_H
  213. #define ACE_HAS_BSWAP_16
  214. #define ACE_HAS_BSWAP_32
  215. #if defined __GNUC__ && __GNUC__ >= 2
  216. # define ACE_HAS_BSWAP_64
  217. #endif
  218. #define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
  219. // Optimize ACE_Handle_Set for select().
  220. #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
  221. // ONLY define this if you have config'd multicast into a 2.0.34 or
  222. // prior kernel. It is enabled by default in 2.0.35 kernels.
  223. #if !defined (ACE_HAS_IP_MULTICAST)
  224. # define ACE_HAS_IP_MULTICAST
  225. #endif /* ! ACE_HAS_IP_MULTICAST */
  226. // At least for IPv4, Linux lacks perfect filtering.
  227. #if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING
  228. # define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
  229. #endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */
  230. #define ACE_HAS_BIG_FD_SET
  231. // Linux defines struct msghdr in /usr/include/socket.h
  232. #define ACE_HAS_MSG
  233. // Linux "improved" the interface to select() so that it modifies
  234. // the struct timeval to reflect the amount of time not slept
  235. // (see NOTES in Linux's select(2) man page).
  236. #define ACE_HAS_NONCONST_SELECT_TIMEVAL
  237. #define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535
  238. #define ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE 1
  239. #define ACE_HAS_GETPAGESIZE 1
  240. #if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2)
  241. // glibc supports wchar, but lacks fgetwc and ungetwc
  242. # define ACE_LACKS_FGETWC
  243. # define ACE_HAS_NONCONST_MSGSND
  244. # define ACE_LACKS_STRNLEN_PROTOTYPE
  245. #endif
  246. // glibc requires _XOPEN_SOURCE_EXTENDED to make this prototype
  247. // visible, so force ACE to declare one. Yuk!
  248. #ifndef _XOPEN_SOURCE_EXTENDED
  249. # define ACE_LACKS_MKSTEMP_PROTOTYPE
  250. #endif /* !_XOPEN_SOURCE_EXTENDED */
  251. // Platform defines struct timespec but not timespec_t
  252. #define ACE_LACKS_TIMESPEC_T
  253. // Platform supplies scandir()
  254. #define ACE_HAS_SCANDIR
  255. #if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10)
  256. // Although the scandir man page says otherwise, this setting is correct.
  257. // The setting was fixed in 2.10, so do not use the hack after that.
  258. #define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR
  259. #endif
  260. // A conflict appears when including both <ucontext.h> and
  261. // <sys/procfs.h> with recent glibc headers.
  262. //#define ACE_HAS_PROC_FS
  263. // Platform supports System V IPC (most versions of UNIX, but not Win32)
  264. #define ACE_HAS_SYSV_IPC
  265. // Compiler/platform contains the <sys/syscall.h> file.
  266. #define ACE_HAS_SYS_SYSCALL_H
  267. // Platform/compiler supports global timezone variable.
  268. #define ACE_HAS_TIMEZONE
  269. #define ACE_HAS_TIMEZONE_GETTIMEOFDAY
  270. // Don't define _XOPEN_SOURCE in ACE to make strptime() prototype
  271. // visible. ACE shouldn't depend on feature test macros to make
  272. // prototypes visible.
  273. #define ACE_LACKS_STRPTIME_PROTOTYPE
  274. // Compiler supports the ssize_t typedef.
  275. #define ACE_HAS_SSIZE_T
  276. // Compiler/platform defines the sig_atomic_t typedef.
  277. #define ACE_HAS_SIG_ATOMIC_T
  278. // Compiler/platform defines a union semun for SysV shared memory.
  279. #define ACE_HAS_SEMUN
  280. #define ACE_HAS_POSIX_TIME
  281. #define ACE_HAS_GPERF
  282. #define ACE_HAS_DIRENT
  283. // Starting with FC9 rawhide this file is not available anymore but
  284. // this define is set
  285. #if defined _XOPEN_STREAMS && _XOPEN_STREAMS == -1
  286. # define ACE_LACKS_STROPTS_H
  287. # define ACE_LACKS_STRRECVFD
  288. #endif
  289. #if !defined (ACE_LACKS_STROPTS_H)
  290. # define ACE_HAS_STRBUF_T
  291. #endif
  292. #if defined (__ia64) || defined(__alpha) || defined (__x86_64__)
  293. // On 64 bit platforms, the "long" type is 64-bits. Override the
  294. // default 32-bit platform-specific format specifiers appropriately.
  295. # define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%lu"
  296. # define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld"
  297. # define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu"
  298. #endif /* __ia64 */
  299. #define ACE_SIZEOF_WCHAR 4
  300. #if defined (__powerpc__) && !defined (ACE_SIZEOF_LONG_DOUBLE)
  301. // 32bit PowerPC Linux uses 128bit long double
  302. # define ACE_SIZEOF_LONG_DOUBLE 16
  303. #endif
  304. #define ACE_LACKS_GETIPNODEBYADDR
  305. #define ACE_LACKS_GETIPNODEBYNAME
  306. // Platform has POSIX terminal interface.
  307. #define ACE_HAS_TERMIOS
  308. // Linux implements sendfile().
  309. #define ACE_HAS_SENDFILE 1
  310. #define ACE_HAS_VOIDPTR_MMAP
  311. #define ACE_HAS_ICMP_SUPPORT 1
  312. #define ACE_HAS_VASPRINTF
  313. // According to man pages Linux uses different (compared to UNIX systems) types
  314. // for setting IP_MULTICAST_TTL and IPV6_MULTICAST_LOOP / IP_MULTICAST_LOOP
  315. // in setsockopt/getsockopt.
  316. #define ACE_HAS_IP_MULTICAST_TTL_AS_INT 1
  317. #define ACE_HAS_IPV6_MULTICAST_LOOP_AS_BOOL 1
  318. #define ACE_HAS_IP_MULTICAST_LOOP_AS_INT 1
  319. #if defined (ACE_LACKS_NETWORKING)
  320. # include "ace/config-posix-nonetworking.h"
  321. #else
  322. # define ACE_HAS_NETLINK
  323. # if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
  324. # define ACE_HAS_GETIFADDRS
  325. # endif
  326. #endif
  327. #if !defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO)
  328. // Detect if getsockname() and getpeername() returns random values in
  329. // the sockaddr_in::sin_zero field by evaluation of the kernel
  330. // version. Since version 2.5.47 this problem is fixed.
  331. # if !defined (ACE_LACKS_LINUX_VERSION_H)
  332. # include <linux/version.h>
  333. # endif /* !ACE_LACKS_LINUX_VERSION_H */
  334. # if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,47))
  335. # define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 0
  336. # else
  337. # define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 1
  338. # endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,47)) */
  339. #endif /* ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO */
  340. #if !defined (ACE_HAS_EVENT_POLL) && !defined (ACE_HAS_DEV_POLL)
  341. # if !defined (ACE_LACKS_LINUX_VERSION_H)
  342. # include <linux/version.h>
  343. # endif /* !ACE_LACKS_LINUX_VERSION_H */
  344. # if (LINUX_VERSION_CODE > KERNEL_VERSION (2,6,0))
  345. # define ACE_HAS_EVENT_POLL
  346. # endif
  347. #endif
  348. #include /**/ "ace/post.h"
  349. #endif /* ACE_LINUX_COMMON_H */