summaryrefslogtreecommitdiff
path: root/lib/ccan/wscript
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-10-14 16:05:58 +1030
committerRusty Russell <rusty@rustcorp.com.au>2012-10-17 01:55:14 +0200
commit029654897d721308c9ee782aee420abddce7edee (patch)
treeef5b7089389130c8e464f3291c40006b452204bc /lib/ccan/wscript
parent05a59748910cc11d43bffbfc4d00fdf3701e2ca1 (diff)
downloadsamba-029654897d721308c9ee782aee420abddce7edee.tar.gz
samba-029654897d721308c9ee782aee420abddce7edee.tar.bz2
samba-029654897d721308c9ee782aee420abddce7edee.zip
ccan: check for all the used config.h defines
In particular, not checking for byteswap.h meant we defined duplicates: https://bugzilla.samba.org/show_bug.cgi?id=9286 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date(master): Wed Oct 17 01:55:14 CEST 2012 on sn-devel-104
Diffstat (limited to 'lib/ccan/wscript')
-rw-r--r--lib/ccan/wscript21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/ccan/wscript b/lib/ccan/wscript
index 334f8fe4d0..4af9dd4c83 100644
--- a/lib/ccan/wscript
+++ b/lib/ccan/wscript
@@ -5,6 +5,9 @@ import Logs, sys, Options
def configure(conf):
conf.DEFINE('HAVE_CCAN', 1)
conf.CHECK_HEADERS('err.h')
+ conf.CHECK_HEADERS('byteswap.h')
+ conf.CHECK_FUNCS('bswap_64', link=False, headers="byteswap.h")
+
# FIXME: if they don't have -Werror, these will all fail. But they
# probably will anyway...
conf.CHECK_CODE('int __attribute__((cold)) func(int x) { return x; }',
@@ -107,6 +110,9 @@ def configure(conf):
define='HAVE_BUILTIN_TYPES_COMPATIBLE_P')
conf.CHECK_CODE('int *foo = (int[]) { 1, 2, 3, 4 }; return foo[0] ? 0 : 1;',
define='HAVE_COMPOUND_LITERALS')
+ conf.CHECK_CODE('struct foo { unsigned int x; int arr[]; };',
+ addmain=False, link=False,
+ define='HAVE_FLEXIBLE_ARRAY_MEMBER')
conf.CHECK_CODE("""#include <ctype.h>
int main(void) { return isblank(' ') ? 0 : 1; }""",
link=True, addmain=False, add_headers=False,
@@ -121,6 +127,21 @@ def configure(conf):
# backtrace could be in libexecinfo or in libc
conf.CHECK_FUNCS_IN('backtrace backtrace_symbols', 'execinfo', checklibc=True, headers='execinfo.h')
+ # Only check for FILE_OFFSET_BITS=64 if off_t is normally small:
+ # 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',
+ 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',
+ ccflags='-D_FILE_OFFSET_BITS=64',
+ define_name='HAVE_FILE_OFFSET_BITS')
+
def ccan_module(bld, name, deps=''):
bld.SAMBA_SUBSYSTEM('ccan-%s' % name,
source=bld.path.ant_glob('%s/*.c' % name),