android: Enable build against API level 21
[strongswan.git] / src / libstrongswan / utils / compat / android.h
1 /*
2 * Copyright (C) 2010-2015 Tobias Brunner
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup android android
18 * @{ @ingroup compat
19 */
20
21 #ifndef ANDROID_H_
22 #define ANDROID_H_
23
24 #include <android/api-level.h>
25
26 /* stuff defined in AndroidConfig.h, which is included using the -include
27 * command-line option, thus cannot be undefined using -U CFLAGS options.
28 * the reason we have to undefine these flags in the first place, is that
29 * AndroidConfig.h defines them as 0, which in turn means that they are
30 * actually defined. */
31 #undef HAVE_BACKTRACE
32
33 /* API level 21 changed quite a few things, we define some stuff here and not
34 * via CFLAGS in Android.mk files as it is easier to compare versions */
35 #if __ANDROID_API__ >= 21
36
37 #define HAVE_PTHREAD_CONDATTR_INIT 1
38 #define HAVE_CONDATTR_CLOCK_MONOTONIC 1
39
40 #define HAVE_SYS_CAPABILITY_H 1
41
42 #else /* __ANDROID_API__ */
43
44 #define HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC 1
45
46 #endif /* __ANDROID_API__ */
47
48 #endif /** ANDROID_H_ @}*/