[PATCH 3/3] build: make wafsamba WORDS_BIGENDIAN test cross-compile friendly

Gustavo Zacarias gustavo at zacarias.com.ar
Mon Mar 31 06:31:01 MDT 2014


Use the same test as lib/ccan/wscript that's cross-compile friendly.
These separate tests should probably be reconciled by moving everything
into wafsamba.

Signed-off-by: Gustavo Zacarias <gustavo at zacarias.com.ar>
---
 buildtools/wafsamba/wscript | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 7984227..0b96d89 100755
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -390,9 +390,25 @@ 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')
+    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='WORDS_BIGENDIAN')
 
     # check if signal() takes a void function
     if conf.CHECK_CODE('return *(signal (0, 0)) (0) == 1',
-- 
1.8.3.2



More information about the samba-technical mailing list