[Olsr-dev] changing 'linux' macro to __linux__ or __gnu_linux__
Felix Fietkau
(spam-protected)
Thu Feb 2 14:58:54 CET 2012
On 2012-02-01 8:56 PM, Hans-Christoph Steiner wrote:
>
> One thing that I've learned in my own porting work is: it is generally
> the least overall work to try to use the platform macros that are
> automatically defined by the compiler. Android's NDK only recently
> added the __ANDROID__ macro, for example, and Android's gcc also defines
> __linux__, but NOT __gnu_linux__.
>
> Every GNU/Linux I've tried (which is mostly Debian and derivatives) has
> a compiler that sets __linux__ and __gnu_linux__. So I propose changing
> olsrd's linux macro to be __linux__ when its kernel-related and
> __gnu_linux__ when its OS related. This will allow the code to
> differentiate between GNU/Linux and Android/Linux (not GNU at all,
> besides the compiler).
>
> If people are amenable, I'll post a patch. This isn't so much to fix a
> specific issue now, but rather to prevent issues from arising in the future.
I think it's better to explicitly check for android instead of relying
on __gnu_linux__. There are enough embedded distros out there (e.g.
OpenWrt) that are mostly GNU compatible, but do not use glibc, nor
define __gnu_linux__
- Felix
More information about the Olsr-dev
mailing list