Le mardi 20 décembre 2011 à 12:43, Daniel Stenberg a écrit :
> On Tue, 20 Dec 2011, Cédric Deltheil wrote:
>
> > Please find attached a (minor) patch that fixes cURL cross-compilation when
> >
> > working with the Android Standalone Toolchain.
> >
>
>
> This makes me very curious. Does this mean they removed the ANDROID symbol or
>
> how did we end up using that in the first place? Do we really need to check
> both android symbols now?
>
>
I would say we really need to check both since I've observed that:
* if you use Android.mk file(s) and the 'ndk-build' script (aka vanilla way),
ANDROID is predefined (see -DANDROID extra C flag),
* if you use the Android Standalone Toolchain, then __ANDROID__ is predefined
as stated by the compiler:
/path/to/arm-linux-androideabi-gcc -E -dM - < /dev/null | grep -i android
#define __ANDROID__ 1
To confirm this in practice, I've created a small executable:
--
#include <stdio.h>
#if defined(ANDROID)
#define FOO "ANDROID"
#elif defined(__ANDROID__)
#define FOO "__ANDROID__"
#endif
int main(void) {
printf("FOO: %s\n", FOO);
return 0;
}
--
When I build this with 'ndk-build' (with Android NDK r7) and test it on a
device I obtain:
FOO: ANDROID
On the other hand, if I build it with the arm-linux-androideabi-gcc from the
standalone toolchain (android-9) I get:
FOO: __ANDROID__
Cédric
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html