os_auto.h.in 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. /*
  2. * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
  3. * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef __PJ_COMPAT_OS_AUTO_H__
  20. #define __PJ_COMPAT_OS_AUTO_H__
  21. /**
  22. * @file os_auto.h
  23. * @brief Describes operating system specifics (automatically detected by
  24. * autoconf)
  25. */
  26. /* Canonical OS name */
  27. #undef PJ_OS_NAME
  28. /* Legacy macros */
  29. #undef PJ_WIN64
  30. #undef PJ_WIN32
  31. #undef PJ_WIN32_WINNT
  32. #undef WIN32_LEAN_AND_MEAN
  33. #undef PJ_DARWINOS
  34. #undef PJ_LINUX
  35. #undef PJ_BSD
  36. #undef PJ_RTEMS
  37. #undef PJ_SUNOS
  38. #undef PJ_ANDROID
  39. #if defined(PJ_WIN32_WINNT) && !defined(_WIN32_WINNT)
  40. # define _WIN32_WINNT PJ_WIN32_WINNT
  41. #endif
  42. /* Headers availability */
  43. #undef PJ_HAS_ARPA_INET_H
  44. #undef PJ_HAS_ASSERT_H
  45. #undef PJ_HAS_CTYPE_H
  46. #undef PJ_HAS_ERRNO_H
  47. #undef PJ_HAS_FCNTL_H
  48. #undef PJ_HAS_LIMITS_H
  49. #undef PJ_HAS_LINUX_SOCKET_H
  50. #undef PJ_HAS_MALLOC_H
  51. #undef PJ_HAS_NETDB_H
  52. #undef PJ_HAS_NETINET_IN_SYSTM_H
  53. #undef PJ_HAS_NETINET_IN_H
  54. #undef PJ_HAS_NETINET_IP_H
  55. #undef PJ_HAS_NETINET_TCP_H
  56. #undef PJ_HAS_NET_IF_H
  57. #undef PJ_HAS_IFADDRS_H
  58. #undef PJ_HAS_INTTYPES_H
  59. #undef PJ_HAS_SEMAPHORE_H
  60. #undef PJ_HAS_SETJMP_H
  61. #undef PJ_HAS_STDARG_H
  62. #undef PJ_HAS_STDDEF_H
  63. #undef PJ_HAS_STDIO_H
  64. #undef PJ_HAS_STDINT_H
  65. #undef PJ_HAS_STDLIB_H
  66. #undef PJ_HAS_STRING_H
  67. #undef PJ_HAS_SYS_IOCTL_H
  68. #undef PJ_HAS_SYS_SELECT_H
  69. #undef PJ_HAS_SYS_SOCKET_H
  70. #undef PJ_HAS_SYS_TIME_H
  71. #undef PJ_HAS_SYS_TIMEB_H
  72. #undef PJ_HAS_SYS_TYPES_H
  73. #undef PJ_HAS_SYS_FILIO_H
  74. #undef PJ_HAS_SYS_SOCKIO_H
  75. #undef PJ_HAS_SYS_UTSNAME_H
  76. #undef PJ_HAS_TIME_H
  77. #undef PJ_HAS_UNISTD_H
  78. #undef PJ_HAS_EXECINFO_H
  79. #undef PJ_HAS_MSWSOCK_H
  80. #undef PJ_HAS_WINSOCK_H
  81. #undef PJ_HAS_WINSOCK2_H
  82. #undef PJ_HAS_WS2TCPIP_H
  83. #undef PJ_SOCK_HAS_IPV6_V6ONLY
  84. #undef PJ_SOCK_HAS_INET_ATON
  85. #undef PJ_SOCK_HAS_INET_PTON
  86. #undef PJ_SOCK_HAS_INET_NTOP
  87. #undef PJ_SOCK_HAS_GETADDRINFO
  88. #undef PJ_SOCK_HAS_SOCKETPAIR
  89. /* On these OSes, semaphore feature depends on semaphore.h */
  90. #if defined(PJ_HAS_SEMAPHORE_H) && PJ_HAS_SEMAPHORE_H!=0
  91. # define PJ_HAS_SEMAPHORE 1
  92. #elif defined(PJ_WIN32) && PJ_WIN32!=0
  93. # define PJ_HAS_SEMAPHORE 1
  94. #else
  95. # define PJ_HAS_SEMAPHORE 0
  96. #endif
  97. /* Do we have pthread_mutexattr_settype()? */
  98. #undef PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE
  99. /* Does pthread_mutexattr_t has "recursive" member? */
  100. #undef PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE
  101. /* Set 1 if native sockaddr_in has sin_len member.
  102. * Default: 0
  103. */
  104. #undef PJ_SOCKADDR_HAS_LEN
  105. /* Does the OS have socklen_t? */
  106. #undef PJ_HAS_SOCKLEN_T
  107. #if !defined(socklen_t) && (!defined(PJ_HAS_SOCKLEN_T) || PJ_HAS_SOCKLEN_T==0)
  108. # define PJ_HAS_SOCKLEN_T 1
  109. typedef int socklen_t;
  110. #endif
  111. /**
  112. * If this macro is set, it tells select I/O Queue that select() needs to
  113. * be given correct value of nfds (i.e. largest fd + 1). This requires
  114. * select ioqueue to re-scan the descriptors on each registration and
  115. * unregistration.
  116. * If this macro is not set, then ioqueue will always give FD_SETSIZE for
  117. * nfds argument when calling select().
  118. *
  119. * Default: 0
  120. */
  121. #undef PJ_SELECT_NEEDS_NFDS
  122. /* Was Linux epoll support enabled */
  123. #undef PJ_HAS_LINUX_EPOLL
  124. /* Is errno a good way to retrieve OS errors?
  125. */
  126. #undef PJ_HAS_ERRNO_VAR
  127. /* When this macro is set, getsockopt(SOL_SOCKET, SO_ERROR) will return
  128. * the status of non-blocking connect() operation.
  129. */
  130. #undef PJ_HAS_SO_ERROR
  131. /* This value specifies the value set in errno by the OS when a non-blocking
  132. * socket recv() can not return immediate daata.
  133. */
  134. #undef PJ_BLOCKING_ERROR_VAL
  135. /* This value specifies the value set in errno by the OS when a non-blocking
  136. * socket connect() can not get connected immediately.
  137. */
  138. #undef PJ_BLOCKING_CONNECT_ERROR_VAL
  139. /* Default threading is enabled, unless it's overridden. */
  140. #ifndef PJ_HAS_THREADS
  141. # define PJ_HAS_THREADS (1)
  142. #endif
  143. /* Do we need high resolution timer? */
  144. #undef PJ_HAS_HIGH_RES_TIMER
  145. /* Is malloc() available? */
  146. #undef PJ_HAS_MALLOC
  147. #ifndef PJ_OS_HAS_CHECK_STACK
  148. # define PJ_OS_HAS_CHECK_STACK 0
  149. #endif
  150. /* Is localtime_r() available? */
  151. #undef PJ_HAS_LOCALTIME_R
  152. /* Unicode? */
  153. #undef PJ_NATIVE_STRING_IS_UNICODE
  154. /* Pool alignment in bytes */
  155. #undef PJ_POOL_ALIGNMENT
  156. /* The type of atomic variable value: */
  157. #undef PJ_ATOMIC_VALUE_TYPE
  158. #if defined(PJ_DARWINOS) && PJ_DARWINOS!=0
  159. /* Disable local host resolution in pj_gethostip() (see ticket #1342) */
  160. # define PJ_GETHOSTIP_DISABLE_LOCAL_RESOLUTION 1
  161. /* Use pj_getaddrinfo() (instead of pj_inet_pton()) in
  162. * pj_sockaddr_set_str_addr()
  163. */
  164. # define PJ_SOCKADDR_USE_GETADDRINFO 1
  165. # include "TargetConditionals.h"
  166. # if TARGET_OS_IPHONE
  167. # include "Availability.h"
  168. /* Use CFHost API for pj_getaddrinfo() (see ticket #1246) */
  169. # ifndef PJ_GETADDRINFO_USE_CFHOST
  170. # define PJ_GETADDRINFO_USE_CFHOST 0
  171. # endif
  172. # ifdef __IPHONE_4_0
  173. /* Is multitasking support available? (see ticket #1107) */
  174. # define PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT 1
  175. /* Activesock TCP background mode support (VoIP socket).
  176. * Disabled by default, VoIP socket deprecated since iOS 9 and
  177. * on iOS16 using VoIP socket causes app getting killed.
  178. */
  179. # define PJ_ACTIVESOCK_TCP_IPHONE_OS_BG 0
  180. # endif
  181. # endif
  182. #endif
  183. /* If 1, use Read/Write mutex emulation for platforms that don't support it */
  184. #undef PJ_EMULATE_RWMUTEX
  185. /* If 1, pj_thread_create() should enforce the stack size when creating
  186. * threads.
  187. * Default: 0 (let OS decide the thread's stack size).
  188. */
  189. #undef PJ_THREAD_SET_STACK_SIZE
  190. /* If 1, pj_thread_create() should allocate stack from the pool supplied.
  191. * Default: 0 (let OS allocate memory for thread's stack).
  192. */
  193. #undef PJ_THREAD_ALLOCATE_STACK
  194. /* SSL socket availability. */
  195. #ifndef PJ_HAS_SSL_SOCK
  196. #undef PJ_HAS_SSL_SOCK
  197. #endif
  198. #ifndef PJ_SSL_SOCK_IMP
  199. #undef PJ_SSL_SOCK_IMP
  200. #endif
  201. /* Has pthread_np.h ? */
  202. #undef PJ_HAS_PTHREAD_NP_H
  203. /* Has pthread_setname_np() ? */
  204. #undef PJ_HAS_PTHREAD_SETNAME_NP
  205. /* Has pthread_set_name_np() ? */
  206. #undef PJ_HAS_PTHREAD_SET_NAME_NP
  207. #endif /* __PJ_COMPAT_OS_AUTO_H__ */