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