Subject: Re: Patch for Android NDK build

Re: Patch for Android NDK build

From: Guenter <lists_at_gknw.net>
Date: Mon, 16 Apr 2012 01:34:56 +0200

Hi Wayne,
Am 12.04.2012 23:59, schrieb wayne_at_tinmith.net:
> I have noticed a problem with building c-ares on the Android NDK. The
> problem is that c-ares currently only checks for #ifdef ANDROID but it
> really also needs to check for __ANDROID__ as well.
>
> I noticed recently that a patch was submitted by Cedric Deltheil to the
> CURL sources on 20 Dec 2011, which is designed to correctly test for
> building with the Android NDK. I have included a copy of his comments and
> patches for everyone to review at the bottom of this email.
>
> I think a similar patch should also be applied to c-ares as well:
>
> diff --git a/ares_init.c b/ares_init.c
> index ea2a978..3d29cfe 100644
> --- a/ares_init.c
> +++ b/ares_init.c
> @@ -60,7 +60,7 @@
> #include<ctype.h>
> #include<time.h>
>
> -#ifdef ANDROID
> +#if defined(ANDROID) || defined(__ANDROID__)
> #include<sys/system_properties.h>
> #endif
>
> @@ -971,7 +971,7 @@ DhcpNameServer
> }
> status = ARES_EOF;
>
> -#elif defined(ANDROID)
> +#elif defined(ANDROID) || defined(__ANDROID__)
> char value[PROP_VALUE_MAX]="";
> __system_property_get("net.dns1", value);
> status = config_nameserver(&servers,&nservers, value);
Thanks! But can you please explain to me why its not enough to check for
__ANDROID__ only since the NDK toolchain defines it; and everyone who
wants to use another toolchain can still define it self?

Gün.
Received on 2012-04-16