[PATCH] build: make wafsamba CHECK_SIZEOF cross-compile friendly
Gustavo Zacarias
gustavo at zacarias.com.ar
Mon Mar 31 06:33:25 MDT 2014
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>
---
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
--
1.8.3.2
More information about the samba-technical
mailing list