diff options
Diffstat (limited to 'meta-networking/recipes-connectivity/samba/samba-4.1.12/0005-build-unify-and-fix-endian-tests.patch')
-rw-r--r-- | meta-networking/recipes-connectivity/samba/samba-4.1.12/0005-build-unify-and-fix-endian-tests.patch | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/samba/samba-4.1.12/0005-build-unify-and-fix-endian-tests.patch b/meta-networking/recipes-connectivity/samba/samba-4.1.12/0005-build-unify-and-fix-endian-tests.patch new file mode 100644 index 0000000000..5546b6d65e --- /dev/null +++ b/meta-networking/recipes-connectivity/samba/samba-4.1.12/0005-build-unify-and-fix-endian-tests.patch | |||
@@ -0,0 +1,169 @@ | |||
1 | From 81379b6b14ea725c72953be2170b382403ed8728 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gustavo Zacarias <gustavo@zacarias.com.ar> | ||
3 | Date: Mon, 21 Apr 2014 10:18:15 -0300 | ||
4 | Subject: [PATCH 5/7] build: unify and fix endian tests | ||
5 | |||
6 | Unify the endian tests out of lib/ccan/wscript into wafsamba since | ||
7 | they're almost cross-compile friendly. | ||
8 | While at it fix them to be so by moving the preprocessor directives out | ||
9 | of main scope since that will fail. | ||
10 | And keep the WORDS_BIGENDIAN, HAVE_LITTLE_ENDIAN and HAVE_BIG_ENDIAN | ||
11 | defines separate because of different codebases. | ||
12 | |||
13 | Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> | ||
14 | Reviewed-by: Andrew Bartlett <abartlet@samba.org> | ||
15 | Reviewed-by: David Disseldorp <ddiss@samba.org> | ||
16 | |||
17 | Upstream-Status: Backport | ||
18 | |||
19 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
20 | --- | ||
21 | buildtools/wafsamba/wscript | 65 ++++++++++++++++++++++++++++++++++++++++++--- | ||
22 | lib/ccan/wscript | 55 -------------------------------------- | ||
23 | 2 files changed, 62 insertions(+), 58 deletions(-) | ||
24 | |||
25 | diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript | ||
26 | index 7984227..1a2cfe6 100755 | ||
27 | --- a/buildtools/wafsamba/wscript | ||
28 | +++ b/buildtools/wafsamba/wscript | ||
29 | @@ -390,9 +390,68 @@ def configure(conf): | ||
30 | else: | ||
31 | conf.define('SHLIBEXT', "so", quote=True) | ||
32 | |||
33 | - conf.CHECK_CODE('long one = 1; return ((char *)(&one))[0]', | ||
34 | - execute=True, | ||
35 | - define='WORDS_BIGENDIAN') | ||
36 | + # First try a header check for cross-compile friendlyness | ||
37 | + conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER | ||
38 | + #define B __BYTE_ORDER | ||
39 | + #elif defined(BYTE_ORDER) | ||
40 | + #define B BYTE_ORDER | ||
41 | + #endif | ||
42 | + | ||
43 | + #ifdef __LITTLE_ENDIAN | ||
44 | + #define LITTLE __LITTLE_ENDIAN | ||
45 | + #elif defined(LITTLE_ENDIAN) | ||
46 | + #define LITTLE LITTLE_ENDIAN | ||
47 | + #endif | ||
48 | + | ||
49 | + #if !defined(LITTLE) || !defined(B) || LITTLE != B | ||
50 | + #error Not little endian. | ||
51 | + #endif | ||
52 | + int main(void) { return 0; }""", | ||
53 | + addmain=False, | ||
54 | + headers="endian.h sys/endian.h", | ||
55 | + define="HAVE_LITTLE_ENDIAN") | ||
56 | + conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER | ||
57 | + #define B __BYTE_ORDER | ||
58 | + #elif defined(BYTE_ORDER) | ||
59 | + #define B BYTE_ORDER | ||
60 | + #endif | ||
61 | + | ||
62 | + #ifdef __BIG_ENDIAN | ||
63 | + #define BIG __BIG_ENDIAN | ||
64 | + #elif defined(BIG_ENDIAN) | ||
65 | + #define BIG BIG_ENDIAN | ||
66 | + #endif | ||
67 | + | ||
68 | + #if !defined(BIG) || !defined(B) || BIG != B | ||
69 | + #error Not big endian. | ||
70 | + #endif | ||
71 | + int main(void) { return 0; }""", | ||
72 | + addmain=False, | ||
73 | + headers="endian.h sys/endian.h", | ||
74 | + define="HAVE_BIG_ENDIAN") | ||
75 | + | ||
76 | + if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): | ||
77 | + # That didn't work! Do runtime test. | ||
78 | + conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; | ||
79 | + u.i = 0x01020304; | ||
80 | + return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""", | ||
81 | + addmain=True, execute=True, | ||
82 | + define='HAVE_LITTLE_ENDIAN', | ||
83 | + msg="Checking for HAVE_LITTLE_ENDIAN - runtime") | ||
84 | + conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; | ||
85 | + u.i = 0x01020304; | ||
86 | + return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""", | ||
87 | + addmain=True, execute=True, | ||
88 | + define='HAVE_BIG_ENDIAN', | ||
89 | + msg="Checking for HAVE_BIG_ENDIAN - runtime") | ||
90 | + | ||
91 | + # Extra sanity check. | ||
92 | + if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): | ||
93 | + Logs.error("Failed endian determination. The PDP-11 is back?") | ||
94 | + sys.exit(1) | ||
95 | + else: | ||
96 | + if conf.CONFIG_SET("HAVE_BIG_ENDIAN"): | ||
97 | + conf.DEFINE('WORDS_BIGENDIAN', 1) | ||
98 | |||
99 | # check if signal() takes a void function | ||
100 | if conf.CHECK_CODE('return *(signal (0, 0)) (0) == 1', | ||
101 | diff --git a/lib/ccan/wscript b/lib/ccan/wscript | ||
102 | index a0b5406..5b3a910 100644 | ||
103 | --- a/lib/ccan/wscript | ||
104 | +++ b/lib/ccan/wscript | ||
105 | @@ -25,61 +25,6 @@ def configure(conf): | ||
106 | conf.CHECK_CODE('int __attribute__((used)) func(int x) { return x; }', | ||
107 | addmain=False, link=False, cflags=conf.env['WERROR_CFLAGS'], | ||
108 | define='HAVE_ATTRIBUTE_USED') | ||
109 | - # We try to use headers for a compile-time test. | ||
110 | - conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER | ||
111 | - #define B __BYTE_ORDER | ||
112 | - #elif defined(BYTE_ORDER) | ||
113 | - #define B BYTE_ORDER | ||
114 | - #endif | ||
115 | - | ||
116 | - #ifdef __LITTLE_ENDIAN | ||
117 | - #define LITTLE __LITTLE_ENDIAN | ||
118 | - #elif defined(LITTLE_ENDIAN) | ||
119 | - #define LITTLE LITTLE_ENDIAN | ||
120 | - #endif | ||
121 | - | ||
122 | - #if !defined(LITTLE) || !defined(B) || LITTLE != B | ||
123 | - #error Not little endian. | ||
124 | - #endif""", | ||
125 | - headers="endian.h sys/endian.h", | ||
126 | - define="HAVE_LITTLE_ENDIAN") | ||
127 | - conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER | ||
128 | - #define B __BYTE_ORDER | ||
129 | - #elif defined(BYTE_ORDER) | ||
130 | - #define B BYTE_ORDER | ||
131 | - #endif | ||
132 | - | ||
133 | - #ifdef __BIG_ENDIAN | ||
134 | - #define BIG __BIG_ENDIAN | ||
135 | - #elif defined(BIG_ENDIAN) | ||
136 | - #define BIG BIG_ENDIAN | ||
137 | - #endif | ||
138 | - | ||
139 | - #if !defined(BIG) || !defined(B) || BIG != B | ||
140 | - #error Not big endian. | ||
141 | - #endif""", | ||
142 | - headers="endian.h sys/endian.h", | ||
143 | - define="HAVE_BIG_ENDIAN") | ||
144 | - | ||
145 | - if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): | ||
146 | - # That didn't work! Do runtime test. | ||
147 | - conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; | ||
148 | - u.i = 0x01020304; | ||
149 | - return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""", | ||
150 | - addmain=True, execute=True, | ||
151 | - define='HAVE_LITTLE_ENDIAN', | ||
152 | - msg="Checking for HAVE_LITTLE_ENDIAN - runtime") | ||
153 | - conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; | ||
154 | - u.i = 0x01020304; | ||
155 | - return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""", | ||
156 | - addmain=True, execute=True, | ||
157 | - define='HAVE_BIG_ENDIAN', | ||
158 | - msg="Checking for HAVE_BIG_ENDIAN - runtime") | ||
159 | - | ||
160 | - # Extra sanity check. | ||
161 | - if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): | ||
162 | - Logs.error("Failed endian determination. The PDP-11 is back?") | ||
163 | - sys.exit(1) | ||
164 | |||
165 | conf.CHECK_CODE('return __builtin_choose_expr(1, 0, "garbage");', | ||
166 | link=True, | ||
167 | -- | ||
168 | 1.9.1 | ||
169 | |||