[PATCH 1/3] build: fix non-runtime endian detection

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


All the preprocessor clauses must be outside of main() scope
or the test builds will fail.

Signed-off-by: Gustavo Zacarias <gustavo at zacarias.com.ar>
---
 lib/ccan/wscript | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/ccan/wscript b/lib/ccan/wscript
index 81039d0..932c247 100644
--- a/lib/ccan/wscript
+++ b/lib/ccan/wscript
@@ -40,7 +40,9 @@ def configure(conf):
 
                         #if !defined(LITTLE) || !defined(B) || LITTLE != B
                         #error Not little endian.
-                        #endif""",
+                        #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
@@ -57,7 +59,9 @@ def configure(conf):
 
                         #if !defined(BIG) || !defined(B) || BIG != B
                         #error Not big endian.
-                        #endif""",
+                        #endif
+			int main(void) { return 0; }""",
+                           addmain=False,
                            headers="endian.h sys/endian.h",
                            define="HAVE_BIG_ENDIAN")
 
-- 
1.8.3.2



More information about the samba-technical mailing list