2 // Config Header file for Android NDK
4 #ifndef ACE_CONFIG_ANDROID_H
5 #define ACE_CONFIG_ANDROID_H
6 #include /**/ "ace/pre.h"
8 // NOTE: We must be careful from now on to distinguish between the API level
10 // There is a large number of combinations of these two that can lead to
13 // Location of the __ANDROID_API__ define
14 // #include $NDK_ROOT/sysroot/usr/include/android/api-level.h
15 #include "android/api-level.h"
17 #if !defined (__ANDROID_API__)
18 # error __ANDROID_API__ must be defined
22 #define ACE_PLATFORM_CONFIG config-android.h
24 #include "ace/config-linux-common.h"
27 * Android NDK Revision Macros
29 * Revsions Scheme Work Like This:
30 * Revision | __NDK_MAJOR__ | __NDK_MINOR__
35 * After r16, NDK version macros are defined in android/ndk-version.h Before
36 * that they must be defined in platform_macros.GNU before the include of
37 * platform_android.GNU.
39 #define ACE_ANDROID_NDK_AT_LEAST(MAJ, MIN) \
40 (__NDK_MAJOR__ > (MAJ) || (__NDK_MAJOR__ == (MAJ) && __NDK_MINOR__ >= (MIN)))
42 #define ACE_ANDROID_NDK_EXACTLY(MAJ, MIN) \
43 (__NDK_MAJOR__ == (MAJ) && __NDK_MINOR__ == (MIN))
45 #define ACE_ANDROID_NDK_LESS_THAN(MAJ, MIN) \
46 (__NDK_MAJOR__ < (MAJ) || (__NDK_MAJOR__ == (MAJ) && __NDK_MINOR__ < (MIN)))
48 #ifdef ACE_ANDROID_NDK_HAS_NDK_VERSION_H
49 # include "android/ndk-version.h"
51 # ifndef __NDK_MAJOR__
52 # error ndk-version.h is missing, __NDK_MAJOR__ for Android NDK must be defined!
54 # ifndef __NDK_MINOR__
55 # error ndk-version.h is missing, __NDK_MINOR__ for Android NDK must be defined!
59 // ucontext.h and clock_settime() were added in r10c
60 #if ACE_ANDROID_NDK_AT_LEAST(10, 2)
61 # define ACE_HAS_UCONTEXT_T
62 # define ACE_HAS_CLOCK_SETTIME
64 # define ACE_LACKS_UCONTEXT_H
67 // NDK has these by r12b
68 #if ACE_ANDROID_NDK_LESS_THAN(12, 1)
69 # define ACE_LACKS_GETHOSTENT
70 # define ACE_LACKS_LOCALECONV
71 # define ACE_LACKS_WCHAR_STD_NAMESPACE
72 // Used in tests/Sequence_Unit_Tests/string_sequence_tester.hpp
73 # define TAO_LACKS_WCHAR_CXX_STDLIB
76 #if ACE_ANDROID_NDK_LESS_THAN(12, 1) || __ANDROID_API__ < 18
77 # define ACE_LACKS_LOG2
80 #if ACE_ANDROID_NDK_LESS_THAN(12, 1) || __ANDROID_API__ < 21
81 # define ACE_LACKS_SEARCH_H
82 # define ACE_LACKS_SYS_SEM_H
83 # define ACE_LACKS_SEMBUF_T
84 # define ACE_LACKS_SYS_MSG_H
85 # define ACE_LACKS_SYS_SHM_H
86 # define ACE_LACKS_SYSV_SHMEM
88 # define ACE_HAS_SEMUN
91 #if ACE_ANDROID_NDK_LESS_THAN(15, 0) && __ANDROID_API__ < 21
92 // NOTE: The && is correct, SYS_GETTID is present in API 16 in r15 onwards
93 # ifdef ACE_HAS_GETTID
94 # undef ACE_HAS_GETTID
98 // NDK has telldir() and seekdir() by 15c
99 #if ACE_ANDROID_NDK_LESS_THAN(15, 2) || __ANDROID_API__ < 23
100 # define ACE_LACKS_TELLDIR
101 # define ACE_LACKS_SEEKDIR
104 // strbuf was added by r16
105 #if ACE_ANDROID_NDK_LESS_THAN(16, 0)
106 # ifdef ACE_HAS_STRBUF_T
107 # undef ACE_HAS_STRBUF_T
111 // fd_mask was added in r17c
112 #if ACE_ANDROID_NDK_LESS_THAN(17, 2)
113 # define ACE_LACKS_FD_MASK
116 #if __ANDROID_API__ < 21
117 # define ACE_LACKS_RAND_R
118 # define ACE_LACKS_WCSTOLL
119 # define ACE_LACKS_WCSTOULL
120 # define ACE_LACKS_CONDATTR_SETCLOCK
121 # ifdef ACE_HAS_EVENT_POLL
122 # undef ACE_HAS_EVENT_POLL
126 #if ACE_ANDROID_NDK_LESS_THAN(15, 0)
127 # define ACE_LACKS_STRUCT_IF_NAMEINDEX
130 #if ACE_ANDROID_NDK_LESS_THAN(15, 0) || __ANDROID_API__ < 24
131 # define ACE_LACKS_IF_NAMEINDEX
134 // These were available before r18, but in r18 they are restricted to API >= 28 ¯\_(ツ)_/¯
135 #if __ANDROID_API__ < 28
136 # define ACE_LACKS_SETHOSTENT
137 # define ACE_LACKS_ENDHOSTENT
140 #if !defined(ACE_HAS_GLIBC_2_2_3) && (ACE_ANDROID_NDK_AT_LEAST(15, 0) || __ANDROID_API__ >= 21)
141 # define ACE_HAS_CPU_SET_T
144 // system errorno is a volatile int
145 #define ACE_HAS_VOLATILE_ERRNO
146 #define ACE_ERRNO_TYPE volatile int
148 // Android doesn't check is sig is out of range.
149 #define ACE_HAS_SIGISMEMBER_BUG
151 #define ACE_HAS_PTHREADS_UNIX98_EXT
153 // Android does not support pthread concurrency (yet)
154 #define ACE_LACKS_MUTEXATTR_PSHARED 1
156 // the android definition of struct stat{} uses
157 // unsigned long rather than time_t for st_[acm]time
158 // members of the stat struct used to report file
160 #define ACE_USES_ULONG_FOR_STAT_TIME
162 #define ACE_LACKS_NEW_H
163 #define ACE_LACKS_SIGINFO_H
164 #define ACE_LACKS_STROPTS_H
165 #define ACE_LACKS_SYS_SYSCTL_H
167 #define ACE_LACKS_GETLOADAVG
168 #define ACE_LACKS_ISCTYPE
169 #define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS
170 #define ACE_LACKS_PWD_FUNCTIONS
171 #define ACE_LACKS_STRRECVFD
172 #define ACE_LACKS_PTHREAD_CANCEL // posix_limits.h explicitly says this
173 #define ACE_LACKS_SETINHERITSCHED // posix_limits.h explicitly says this
174 #define ACE_LACKS_SWAB
176 // Android seems to have 64 keys of which Android itself use 5
177 #define ACE_DEFAULT_THREAD_KEYS 59
179 // Android Standalone compiler std library does not include
180 // wide character support
181 // Used in tests/Sequence_Unit_Tests/string_sequence_tester.hpp
182 # define TAO_LACKS_WCHAR_CXX_STDLIB
184 // @todo JW, test if this works
185 // #define ACE_HAS_POSIX_SEM
186 // #define ACE_HAS_POSIX_SEM_TIMEOUT
188 // AIO support pulls in the rt library, which pulls in the pthread
189 // library. Disable AIO in single-threaded builds.
190 #if defined (ACE_HAS_THREADS)
191 # define ACE_HAS_CLOCK_GETTIME
193 # undef ACE_HAS_AIO_CALLS
196 #define ACE_HAS_SIGINFO_T
197 #define ACE_HAS_SOCKLEN_T
198 #define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
200 #define ACE_LACKS_CUSERID
202 #define ACE_MMAP_NO_ZERO
204 #define ACE_HAS_NETLINK
205 #define ACE_HAS_SIOCGIFCONF
207 #if !defined ACE_DEFAULT_TEMP_DIR
208 # define ACE_DEFAULT_TEMP_DIR "/data/tmp"
211 #if !defined TEST_DIR
212 # define TEST_DIR "/data"
215 #define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE
217 #if !defined (ACE_AS_STATIC_LIBS)
218 # if (__GNUC__ == 4 && __GNUC_MINOR__ == 4)
219 # error Shared library support is not possible with GCC 4.4.x
223 // The defines listed below might give compile issues when
224 // users declare one letter (IDL) methods. To prevent this,
225 // these defines are undefined here.
226 // The defines are declared in ctype.h and are used in
227 // ctype_base.h as well. That's why <ostream> is included
257 // Disable newer features, result in runtime failures on Android
258 #define ACE_LACKS_GETADDRINFO
259 #define ACE_LACKS_GETNAMEINFO
261 #include /**/ "ace/post.h"
263 #endif /* ACE_CONFIG_ANDROID_H */