[PATCH] build: make wafsamba CHECK_SIZEOF cross-compile friendly

Andrew Bartlett abartlet at samba.org
Wed Apr 2 15:00:28 MDT 2014


On Mon, 2014-03-31 at 09:33 -0300, Gustavo Zacarias wrote:
> Use the same trick as commit 0d9bb86293c9d39298786df095c73a6251b08b7e
> We do the same array trick iteratively starting from 1 (byte) by powers
> of 2 up to 32.
> 
> Signed-off-by: Gustavo Zacarias <gustavo at zacarias.com.ar>

I just need to compare the config.h outputs and then I'll review these.

Thanks for your patience on this.

> ---
>  buildtools/wafsamba/samba_autoconf.py | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
> index e726536..fe5dd29 100644
> --- a/buildtools/wafsamba/samba_autoconf.py
> +++ b/buildtools/wafsamba/samba_autoconf.py
> @@ -311,15 +311,16 @@ def CHECK_SIZEOF(conf, vars, headers=None, define=None):
>          v_define = define
>          if v_define is None:
>              v_define = 'SIZEOF_%s' % v.upper().replace(' ', '_')
> -        if not CHECK_CODE(conf,
> -                          'printf("%%u", (unsigned)sizeof(%s))' % v,
> +            for size in list((1, 2, 4, 8, 16, 32)):
> +                if CHECK_CODE(conf,
> +                          'static int test_array[1 - 2 * !(((long int)(sizeof(%s))) <= %d)];' % (v, size),
>                            define=v_define,
> -                          execute=True,
> -                          define_ret=True,
>                            quote=False,
>                            headers=headers,
>                            local_include=False,
> -                          msg="Checking size of %s" % v):
> +                          msg="Checking if size of %s == %d" % (v, size)):
> +                    conf.DEFINE(v_define, size)
> +                    break
>              ret = False
>      return ret
>  

-- 
Andrew Bartlett
http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba






More information about the samba-technical mailing list