[PATCH] fixes for android in libraries/unix
nathan.huesken at posteo.de
Sun Feb 17 18:23:39 CET 2013
On 02/17/2013 01:58 PM, Ian Lynagh wrote:
> Hi Nathan,
> On Tue, Jan 29, 2013 at 07:45:34PM +0100, Nathan Hüsken wrote:
>> 2 is difficult. To correctly test if _POSIX_VDISABLE is supported, a
>> program must be compiled and run which test if _POSIX_VDISABLE is != -1.
>> But that is not possible for cross compilation, because the program can
>> not be run.
>> Suggestion what should be done here?
> The patch did:
> +#ifdef __ANDROID__
> +-- the android ndk does not define this symbol
> +#define _POSIX_VDISABLE _PC_VDISABLE
> so can't you test whether compiling
> int i = _POSIX_VDISABLE;
> succeeds? I assume that that will fail on Android with an undefined
> variable error. Or we could just do
> #if !defined(_POSIX_VDISABLE) && defined(_PC_VDISABLE)
> #define _POSIX_VDISABLE _PC_VDISABLE
> Are you sure the patch is right, though? On Linux I have
> _POSIX_VDISABLE == 0 and _PC_VDISABLE == 8.
No, I am not really sure what the right thing to do is. When I google,
somewhere it said that _POSIX_VDISABLE must not necessarily be a define.
And even if it exists, a value of "-1" means that is should not be used.
I am just reading here 
that my approach of using _PC_VDISABLE is _not_ correct.
 says, that one should use the return value of
pathconf(path,_PC_VDISABLE), but only if it is not "-1".
A general solution should consider, there might not be a value to
disable special characters might not exists.
And I have not Idea what to do then.
More information about the ghc-devs