[PATCH 3/3] build: find FILE_OFFSET_BITS via array

Gustavo Zacarias gustavo at zacarias.com.ar
Thu Jan 30 13:59:50 MST 2014


This makes cross-compiling happy, use a trick similar to autoconf's
AC_CHECK_SIZEOF macro.

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

diff --git a/lib/ccan/wscript b/lib/ccan/wscript
index 59b8205..626fde3 100644
--- a/lib/ccan/wscript
+++ b/lib/ccan/wscript
@@ -128,14 +128,14 @@ def configure(conf):
     # use raw routines because wrappers include previous _GNU_SOURCE
     # or _FILE_OFFSET_BITS defines.
     conf.check(fragment="""#include <sys/types.h>
-               int main(void) { return !(sizeof(off_t) < 8); }""",
-               execute=True, msg='Checking for small off_t',
+               int main(void) { static int test_array[1 - 2 * !(((long int)(sizeof(off_t))) < 8)]; }""",
+               msg='Checking for small off_t',
                define_name='SMALL_OFF_T')
     # Unreliable return value above, hence use define.
     if conf.CONFIG_SET('SMALL_OFF_T'):
         conf.check(fragment="""#include <sys/types.h>
-                   int main(void) { return !(sizeof(off_t) >= 8); }""",
-                   execute=True, msg='Checking for -D_FILE_OFFSET_BITS=64',
+		   int main(void) { static int test_array[1 - 2 * !(((long int)(sizeof(off_t))) >= 8)]; }""",
+                   msg='Checking for -D_FILE_OFFSET_BITS=64',
                    ccflags='-D_FILE_OFFSET_BITS=64',
                    define_name='HAVE_FILE_OFFSET_BITS')
 
-- 
1.8.3.2



More information about the samba-technical mailing list