[PATCHv2] build: find FILE_OFFSET_BITS via array

Andreas Schneider asn at samba.org
Mon Feb 17 07:55:17 MST 2014


On Saturday 08 February 2014 06:57:22 Andrew Bartlett wrote:
> On Fri, 2014-01-31 at 06:53 -0300, Gustavo Zacarias wrote:
> > This makes cross-compiling happy, use a trick similar to autoconf's
> > AC_CHECK_SIZEOF macro.
> > Basically we make an array:
> > 
> > static int array[1 - 2 * !(((long int)(sizeof(off_t))) < 8)];
> > 
> > This gives -1 multiplied by the negation of the condition
> > (sizeof(off_t) < 8) cast to a long int.
> > So if the condition is true it gives array[(-1 * 0)] (remember the
> > condition is cast and negated) thus passing a build test with a 0-sized
> > array.
> > If it's false it gives array[(-1 * 1)] thus failing with a
> > negative-sized array.
> > 
> > Signed-off-by: Gustavo Zacarias <gustavo at zacarias.com.ar>
> 
> Reviewed-by: Andrew Bartlett <abartlet at samba.org>
> 
> David,
> 
> Can you give me the second team review on this?

Reviewed-by: Andreas Schneider <asn at samba.org>

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org



More information about the samba-technical mailing list