The branch, master has been updated via 9d4adbc6 build: find blkcnt_t size via array via db86180 build: tweak SIZEOF utmp->ut_line via 6619055 build: make wafsamba CHECK_SIZEOF cross-compile friendly via 5ac317e build: unify and fix endian tests via 5bf6ed5 byteorder: do not assume PowerPC is big-endian from 401f555 dsdb: Do not permit nested event loops when in a transaction, use a nested event context
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 9d4adbc65a5832d0300543cc58bce1620bb50ed0 Author: Gustavo Zacarias <gust...@zacarias.com.ar> Date: Mon Apr 21 10:18:18 2014 -0300 build: find blkcnt_t size via array Using the same trick as commit 0d9bb86293c9d39298786df095c73a6251b08b7e find blkcnt_t size via an array so that it can be determined via build rather than running it. Signed-off-by: Gustavo Zacarias <gust...@zacarias.com.ar> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> Autobuild-User(master): David Disseldorp <dd...@samba.org> Autobuild-Date(master): Tue May 6 20:37:16 CEST 2014 on sn-devel-104 commit db8618050d40612666c279cb2d3a486473278b6b Author: Gustavo Zacarias <gust...@zacarias.com.ar> Date: Mon Apr 21 10:18:17 2014 -0300 build: tweak SIZEOF utmp->ut_line Set the critical parameter of CHECK_SIZEOF utmp->ut_line to False since it's used to find out if utmp support should be enabled. This is necessary with the introduction of the cross-compile aware CHECK_SIZEOF. Signed-off-by: Gustavo Zacarias <gust...@zacarias.com.ar> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> commit 6619055f6034c1f7194c821ac230d53bf735adbc Author: Gustavo Zacarias <gust...@zacarias.com.ar> Date: Mon Apr 21 10:18:16 2014 -0300 build: make wafsamba CHECK_SIZEOF cross-compile friendly 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. The new 'critical' option is used to make the invocation die or not according to each test. The default is True since normally it's expected to find a proper result and should error out if not. Signed-off-by: Gustavo Zacarias <gust...@zacarias.com.ar> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> commit 5ac317e2b6a7a45c024490e3e1e2bd00debf150f Author: Gustavo Zacarias <gust...@zacarias.com.ar> Date: Mon Apr 21 10:18:15 2014 -0300 build: unify and fix endian tests Unify the endian tests out of lib/ccan/wscript into wafsamba since they're almost cross-compile friendly. While at it fix them to be so by moving the preprocessor directives out of main scope since that will fail. And keep the WORDS_BIGENDIAN, HAVE_LITTLE_ENDIAN and HAVE_BIG_ENDIAN defines separate because of different codebases. Signed-off-by: Gustavo Zacarias <gust...@zacarias.com.ar> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> commit 5bf6ed5ebd0dc5ecdc5bcfb1d4720e9251849adc Author: David Disseldorp <dd...@samba.org> Date: Mon May 5 13:42:36 2014 +0200 byteorder: do not assume PowerPC is big-endian byteorder.h currently uses reverse-indexing ASM instructions for little endian multi-byte storage/retrieval on PowerPC. With Power8 this is an incorrect assumption, as it can be big or little endian. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10590 Signed-off-by: David Disseldorp <dd...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> ----------------------------------------------------------------------- Summary of changes: buildtools/wafsamba/samba_autoconf.py | 28 ++++++++------ buildtools/wafsamba/wscript | 65 +++++++++++++++++++++++++++++++-- lib/ccan/wscript | 55 ---------------------------- lib/util/byteorder.h | 10 +++-- source3/wscript | 24 +++++++------ 5 files changed, 97 insertions(+), 85 deletions(-) Changeset truncated at 500 lines: diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index 59d9e79..f60ce9d 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -304,23 +304,27 @@ def CHECK_FUNCS(conf, list, link=True, lib=None, headers=None): @conf -def CHECK_SIZEOF(conf, vars, headers=None, define=None): +def CHECK_SIZEOF(conf, vars, headers=None, define=None, critical=True): '''check the size of a type''' - ret = True for v in TO_LIST(vars): v_define = define + ret = False if v_define is None: v_define = 'SIZEOF_%s' % v.upper().replace(' ', '_') - if not CHECK_CODE(conf, - 'printf("%%u", (unsigned)sizeof(%s))' % v, - define=v_define, - execute=True, - define_ret=True, - quote=False, - headers=headers, - local_include=False, - msg="Checking size of %s" % v): - ret = False + 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, + quote=False, + headers=headers, + local_include=False, + msg="Checking if size of %s == %d" % (v, size)): + conf.DEFINE(v_define, size) + ret = True + break + if not ret and critical: + Logs.error("Couldn't determine size of '%s'" % v) + sys.exit(1) return ret @conf diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript index 7984227..1a2cfe6 100755 --- a/buildtools/wafsamba/wscript +++ b/buildtools/wafsamba/wscript @@ -390,9 +390,68 @@ def configure(conf): else: conf.define('SHLIBEXT', "so", quote=True) - conf.CHECK_CODE('long one = 1; return ((char *)(&one))[0]', - execute=True, - define='WORDS_BIGENDIAN') + # First try a header check for cross-compile friendlyness + conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER + #define B __BYTE_ORDER + #elif defined(BYTE_ORDER) + #define B BYTE_ORDER + #endif + + #ifdef __LITTLE_ENDIAN + #define LITTLE __LITTLE_ENDIAN + #elif defined(LITTLE_ENDIAN) + #define LITTLE LITTLE_ENDIAN + #endif + + #if !defined(LITTLE) || !defined(B) || LITTLE != B + #error Not little endian. + #endif + int main(void) { return 0; }""", + addmain=False, + headers="endian.h sys/endian.h", + define="HAVE_LITTLE_ENDIAN") + conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER + #define B __BYTE_ORDER + #elif defined(BYTE_ORDER) + #define B BYTE_ORDER + #endif + + #ifdef __BIG_ENDIAN + #define BIG __BIG_ENDIAN + #elif defined(BIG_ENDIAN) + #define BIG BIG_ENDIAN + #endif + + #if !defined(BIG) || !defined(B) || BIG != B + #error Not big endian. + #endif + int main(void) { return 0; }""", + addmain=False, + headers="endian.h sys/endian.h", + define="HAVE_BIG_ENDIAN") + + if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): + # That didn't work! Do runtime test. + conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; + u.i = 0x01020304; + return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""", + addmain=True, execute=True, + define='HAVE_LITTLE_ENDIAN', + msg="Checking for HAVE_LITTLE_ENDIAN - runtime") + conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; + u.i = 0x01020304; + return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""", + addmain=True, execute=True, + define='HAVE_BIG_ENDIAN', + msg="Checking for HAVE_BIG_ENDIAN - runtime") + + # Extra sanity check. + if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): + Logs.error("Failed endian determination. The PDP-11 is back?") + sys.exit(1) + else: + if conf.CONFIG_SET("HAVE_BIG_ENDIAN"): + conf.DEFINE('WORDS_BIGENDIAN', 1) # check if signal() takes a void function if conf.CHECK_CODE('return *(signal (0, 0)) (0) == 1', diff --git a/lib/ccan/wscript b/lib/ccan/wscript index 1c5f337..0e540db 100644 --- a/lib/ccan/wscript +++ b/lib/ccan/wscript @@ -25,61 +25,6 @@ def configure(conf): conf.CHECK_CODE('int __attribute__((used)) func(int x) { return x; }', addmain=False, link=False, cflags=conf.env['WERROR_CFLAGS'], define='HAVE_ATTRIBUTE_USED') - # We try to use headers for a compile-time test. - conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER - #define B __BYTE_ORDER - #elif defined(BYTE_ORDER) - #define B BYTE_ORDER - #endif - - #ifdef __LITTLE_ENDIAN - #define LITTLE __LITTLE_ENDIAN - #elif defined(LITTLE_ENDIAN) - #define LITTLE LITTLE_ENDIAN - #endif - - #if !defined(LITTLE) || !defined(B) || LITTLE != B - #error Not little endian. - #endif""", - headers="endian.h sys/endian.h", - define="HAVE_LITTLE_ENDIAN") - conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER - #define B __BYTE_ORDER - #elif defined(BYTE_ORDER) - #define B BYTE_ORDER - #endif - - #ifdef __BIG_ENDIAN - #define BIG __BIG_ENDIAN - #elif defined(BIG_ENDIAN) - #define BIG BIG_ENDIAN - #endif - - #if !defined(BIG) || !defined(B) || BIG != B - #error Not big endian. - #endif""", - headers="endian.h sys/endian.h", - define="HAVE_BIG_ENDIAN") - - if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): - # That didn't work! Do runtime test. - conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; - u.i = 0x01020304; - return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""", - addmain=True, execute=True, - define='HAVE_LITTLE_ENDIAN', - msg="Checking for HAVE_LITTLE_ENDIAN - runtime") - conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; - u.i = 0x01020304; - return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""", - addmain=True, execute=True, - define='HAVE_BIG_ENDIAN', - msg="Checking for HAVE_BIG_ENDIAN - runtime") - - # Extra sanity check. - if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): - Logs.error("Failed endian determination. The PDP-11 is back?") - sys.exit(1) conf.CHECK_CODE('return __builtin_choose_expr(1, 0, "garbage");', link=True, diff --git a/lib/util/byteorder.h b/lib/util/byteorder.h index 58cd68a..297be52 100644 --- a/lib/util/byteorder.h +++ b/lib/util/byteorder.h @@ -89,10 +89,12 @@ it also defines lots of intermediate macros, just ignore those :-) /* - on powerpc we can use the magic instructions to load/store - in little endian -*/ -#if (defined(__powerpc__) && defined(__GNUC__)) + * On powerpc we can use the magic instructions to load/store in little endian. + * The instructions are reverse-indexing, so assume a big endian Power + * processor. Power8 can be big or little endian, so we need to explicitly + * check. + */ +#if (defined(__powerpc__) && defined(__GNUC__) && HAVE_BIG_ENDIAN) static __inline__ uint16_t ld_le16(const uint16_t *addr) { uint16_t val; diff --git a/source3/wscript b/source3/wscript index 8cbd9bc..2bca8fa 100644 --- a/source3/wscript +++ b/source3/wscript @@ -277,18 +277,20 @@ int main(int argc, char **argv) headers='sys/types.h sys/stat.h unistd.h') if "HAVE_BLKCNT_T" in conf.env: - conf.CHECK_CODE(''' - return sizeof(blkcnt_t) == 4 ? 0 : 1''', - 'SIZEOF_BLKCNT_T_4', execute=True, - headers='replace.h sys/types.h sys/stat.h unistd.h', - msg="Checking whether blkcnt_t is 32 bit") + conf.CHECK_CODE(''' + static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 4)];''', + 'SIZEOF_BLKCNT_T_4', + headers='replace.h sys/types.h sys/stat.h unistd.h', + msg="Checking whether blkcnt_t is 32 bit") + # If sizeof is 4 it can't be 8 if "HAVE_BLKCNT_T" in conf.env: - conf.CHECK_CODE(''' - return sizeof(blkcnt_t) == 8 ? 0 : 1''', - 'SIZEOF_BLKCNT_T_8', execute=True, - headers='replace.h sys/types.h sys/stat.h unistd.h', - msg="Checking whether blkcnt_t is 64 bit") + if not conf.CONFIG_SET('SIZEOF_BLKCNT_T_4'): + conf.CHECK_CODE(''' + static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 8)];''', + 'SIZEOF_BLKCNT_T_8', + headers='replace.h sys/types.h sys/stat.h unistd.h', + msg="Checking whether blkcnt_t is 64 bit") # Check for POSIX capability support conf.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers='sys/capability.h') @@ -813,7 +815,7 @@ msg.msg_acctrightslen = sizeof(fd); 'PUTUTLINE_RETURNS_UTMP', headers='utmp.h', msg="Checking whether pututline returns pointer") conf.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers='utmp.h', - define='SIZEOF_UTMP_UT_LINE') + define='SIZEOF_UTMP_UT_LINE', critical=False) if not conf.CONFIG_SET('SIZEOF_UTMP_UT_LINE'): conf.env.with_utmp = False elif int(conf.env.SIZEOF_UTMP_UT_LINE) < 15: -- Samba Shared Repository