1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

77 Commits

Author SHA1 Message Date
Gustavo Zacarias
5ac317e2b6 build: unify and fix endian tests
Unify the endian tests out of lib/ccan/wscript into wafsamba since
they're almost cross-compile friendly.
While at it fix them to be so by moving the preprocessor directives out
of main scope since that will fail.
And keep the WORDS_BIGENDIAN, HAVE_LITTLE_ENDIAN and HAVE_BIG_ENDIAN
defines separate because of different codebases.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2014-05-06 18:14:13 +02:00
Stefan Metzmacher
a939027c6e lib/ccan: explicitly use allow_warnings=True
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-04-02 09:03:46 +02:00
Gustavo Zacarias
0d9bb86293 build: find FILE_OFFSET_BITS via array
This makes cross-compiling happy, use a trick similar to autoconf's
AC_CHECK_SIZEOF macro.
Basically we make an array:

static int array[1 - 2 * !(((long int)(sizeof(off_t))) < 8)];

This gives -1 multiplied by the negation of the condition
(sizeof(off_t) < 8) cast to a long int.
So if the condition is true it gives array[(-1 * 0)] (remember the
condition is cast and negated) thus passing a build test with a 0-sized
array.
If it's false it gives array[(-1 * 1)] thus failing with a
negative-sized array.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Feb 18 23:18:32 CET 2014 on sn-devel-104
2014-02-18 23:18:32 +01:00
Volker Lendecke
f387d9a352 ccan: Fix calling memset with zero length parameter
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jul 11 16:55:49 CEST 2013 on sn-devel-104
2013-07-11 16:55:48 +02:00
Andrew Bartlett
cd4b413cb0 build: Remove autoconf build system
We are now confident that that waf build system meets enough of our needs
that we will work to improve it, rather than maintain two build systems.

Andrew Bartlett

Reviewed-by: Jelmer Vernooij <jelmer@samba.org>

Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-05-28 12:17:10 +10:00
Rusty Russell
5b15d10795 autoconf: build in NTDB.
I previously added -DDISABLE_NTDB to FLAGS, but lib/param/util.c
doesn't seem to be compiled with that flag, so it's really not a good
solution.

So instead, compile in ntdb for the autoconf build.  This means:

1) Add -DHAVE_CCAN to cflags.
2) Remove pyntdb from autoconf objects (which is what tdb does)
3) Remove -DDISABLE_NTDB
4) Add ntdb utility objects
5) Link in ntdb everywhere we link in tdb.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-12 14:59:00 -07:00
Rusty Russell
5dad084ab1 ccan: fix HAVE_BSWAP_64 for autoconf.
Autoconf defines HAVE_BSWAP_64_DECL, we want HAVE_BSWAP_64.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-03 22:10:13 +02:00
Andrew Bartlett
29dfc94ca3 ccan: Cast getpid() result to unsigned int for GNU/Solaris build
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-15 10:37:53 -07:00
Björn Jacke
fdead585dc ccan/wafbuild: use WERROR_CFLAGS instead of -Werror 2012-10-30 13:18:50 +01:00
Rusty Russell
029654897d 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
2012-10-17 01:55:14 +02:00
Andrew Bartlett
08d3062fc3 ntdb: Try to fix the build on Solaris which does not have err 2012-09-23 14:31:01 +10:00
Andrew Bartlett
5b4792d9d2 lib/ccan: Fix format string errors found by -Werror=format in ccan failtest 2012-07-30 14:25:09 +10:00
Rusty Russell
8150f69dc4 ccan: make it a grouping library.
Andrew Bartlett pointed out that making CCAN a non-library will break
the build in a different way in future: when two separate private
libraries start using the same CCAN module, the symbol duplicate
detection will fire (since private libaries don't use any symbol
hiding).  That doesn't happen yet, but it will surely happen
eventually.

So, for now at least, we build as a private library again.  This
unfortunately means the top-level build creates a libccan.so, which
contains all the ccan modules whether you need them or not.  Given the
size of the library, I don't think this is a win.  But it's simple.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Sat Jun 30 11:19:04 CEST 2012 on sn-devel-104
2012-06-30 11:19:03 +02:00
Stefan Metzmacher
19941a9054 lib/ccan: readd execinfo dependency to failtest
metze

Signed-off-by: Michael Adam <obnox@samba.org>
2012-06-29 15:21:15 +02:00
Rusty Russell
f3862b9171 ccan: we're subsystems, not a library.
Don't expose a libccan.so; it would produce clashes if someone else
does the same thing.  Unfortunately, if we just change it from a
SAMBA_LIBRARY to a SAMBA_SUBSYSTEM, it doesn't create a static library
as we'd like, but links all the object files in.  This means we get
many duplicates (eg. everyone gets a copy of tally, even though only
ntdb wants it).

So, the solution is twofold:
1) Make the ccan modules separate.
2) Make the ccan modules SAMBA_SUBSYSTEMs not SAMBA_LIBRARYs so we don't
   build shared libraries which we can't share.
3) Make the places which uses ccan explicit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Fri Jun 29 06:22:44 CEST 2012 on sn-devel-104
2012-06-29 06:22:44 +02:00
Rusty Russell
c7273629a2 ccan: remove bogus debug print.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19 05:38:06 +02:00
Rusty Russell
5bad913938 ccan: check for err.h ourselves
Heimdal does this, but that doesn't help the autoconf build or the standalone
libntdb build.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19 05:38:05 +02:00
Rusty Russell
36353a9fc3 tdb2: use ccan/err instead of err.h
Solaris has no err.h, so use CCAN replacement.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Sat Jun  9 12:07:15 CEST 2012 on sn-devel-104
2012-06-09 12:07:13 +02:00
Rusty Russell
aeb3ff5c86 ccan: make failtest use ccan/err.
As per CCAN commit 48b700953f9c856102e91596103238f5da9ea079.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-09 15:41:23 +09:30
Rusty Russell
d9ce876ea9 ccan: import err module.from ccan revision 5add556a1cb64b49a664506aa76216d885b22c97
This allows us to avoid err.h in failtest.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-09 15:41:18 +09:30
Andrew Bartlett
35a2d020a0 ccan: Only build ccan-failtest when we are in developer mode
From: Andrew Bartlett <abartlet@samba.org>

This code is incredibly useful, but is only needed in test code and may not be
perfectly portable.  It has compiled on all systems bar Solaris so far, but
rather than make it a requirement to build Samba, just keep it for development.

Andrew Bartlett

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Thu Jun  7 18:53:12 CEST 2012 on sn-devel-104
2012-06-07 18:53:12 +02:00
Martin Schwenke
b7754f4bf7 s3:build(autoconf): fix "no AC_LANG_SOURCE call detected" warnings
Autoconf 2.68 NEWS says:

** The macros AC_PREPROC_IFELSE, AC_COMPILE_IFELSE, AC_LINK_IFELSE, and
   AC_RUN_IFELSE now warn if the first argument failed to use
   AC_LANG_SOURCE or AC_LANG_PROGRAM to generate the conftest file
   contents.  A new macro AC_LANG_DEFINES_PROVIDED exists if you have
   a compelling reason why you cannot use AC_LANG_SOURCE but must
   avoid the warning.

Signed-off-by: Martin Schwenke <martin@meltin.net>
2012-06-05 04:27:36 +02:00
Andrew Bartlett
980574238f ccan: fix autoconf test for isblank()
The define in the C code is HAVE_ISBLANK

Andrew Bartlett
2012-06-02 15:56:41 +10:00
Stefan Metzmacher
5e6357b421 lib/ccan: add a missing dependency to 'execinfo' for 'backtrace()'
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Tue May 15 16:12:54 CEST 2012 on sn-devel-104
2012-05-15 16:12:53 +02:00
Andrew Bartlett
73818636e0 ccan: Fix failtest on Fedora 16 as stdlib.h does not imply malloc.h
The issue is that there are two different sources of the malloc
prototype, and they both need to be included otherwise the failtest
overrides chokes on the headers.

Andrew Bartlett
2012-04-11 02:30:40 +02:00
Rusty Russell
f74ae3257a cast: make sure suncc sees a constant.
cast_const() et. al. are supposed to be a constant expression, so you can do things like:
	static char *p = cast_const(char *, (const char *)"hello");

Unfortunately, a cast to intptr_t and arithmetic makes suncc reject it as
a constant expression.  We need the cast, because (1) the expression could be
a void *, so we can't just add to it, and (2) gcc complains with -Wcast-qual
without it.

So instead of adding BUILD_BUG_OR_ZERO, we use a ? :, which keeps everyone happy.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 74859ab18b10aaf990848e49d7789ff5c6cf96c6)

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Thu Mar 29 08:18:57 CEST 2012 on sn-devel-104
2012-03-29 08:18:57 +02:00
Rusty Russell
be25ab9c8d cast: test/compile_fail-cast_static.c should fail without COMPOUND_LITERALS.
It still gave a warning on gcc, because casting a char to a char* gives a warning.  Not so on sun CC.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 6569a707d169a629e25e10710c760c8dc84525c7)
2012-03-29 15:14:30 +10:30
Rusty Russell
b3a6ffd7b2 lib/ccan/failtest: compile fix for OpenBSD
OpenBSD doesn't idempotent-wrap sys/mman.h, so when we #define mmap to
an alternative, it fails to compile when sys/mman.h is included again.

Workaround is not to #define mmap to add arguments on Open BSD.

(Imported from CCAN commit e18e80fe175422d26efe689addc0f67bdba0e097)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-22 01:57:37 +01:00
Rusty Russell
675593221c lib/ccan: namespacize ccan/list to avoid conflict with OpenIndiana's sys/list.h
CCAN includes a little utility called "namespacize" which prepends ccan_ to
all public methods of a module, and fixes up any dependencies it finds.  It's
a little primitive, but it works here.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-22 01:57:37 +01:00
Rusty Russell
b442e37525 failtest: don't assume FD_SETSIZE is maximum runtime fd.
This breaks when rlimit is less.  Unfortunately, valgrind (32 bit x86,
3.7.0.SVN, Ubuntu) fails to set the file limit properly on the test:
reducing it to the obvious getrlimit/setrlimit/getrlimit works fine,
so leaving diagnostics for another day.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit a85a809bb17af6b6cf6fa31b300c6622f64ee700)

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Thu Mar  8 06:30:48 CET 2012 on sn-devel-104
2012-03-08 06:30:48 +01:00
Rusty Russell
361f3ea9ee lib/ccan: import failtest and required ccan modules for TDB2 unit tests.
New modules: failtest, list, time, read_write_all and tlist.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-07 13:16:16 +11:00
Rusty Russell
fb8cf568ca lib/ccan: define HAVE_CCAN.
This allows public headers to use CCAN if available, and dummy macros
if not (eg. tdb2).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-02-21 15:29:06 +10:30
Martin Schwenke
0429471fe4 lib/ccan: Fix some typos in libccan.m4
Signed-off-by: Martin Schwenke <martin@meltin.net>

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Thu Dec 15 07:40:33 CET 2011 on sn-devel-104
2011-12-15 07:40:33 +01:00
Rusty Russell
fef4f5193b lib/ccan: fix m4 tests for builtin_expect and compound literals.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-12-15 15:34:55 +10:30
Rusty Russell
71384d5d75 lib/ccan/cast: fix warnings with -Wextra (specifically -Wmissing-field-initializers)
As noted by Jan Engelhardt; libHX fixed this already.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit b2cc1341c9464b6da4654fd3fa0aafe934fba578)
2011-12-05 16:42:50 +10:30
Rusty Russell
3b390b754e lib/ccan/compiler, ilog: IDEMPOTENT "idempotent does not mean what you think it means"
Actually, I don't even think it means that.  But rename it to something
which is sane.

Thanks to David Gibson for reporting.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit e764d0a27d2b6748ea7d343042ec7d6dda1f6aae)
2011-12-05 16:42:50 +10:30
Rusty Russell
ab2c07b8f0 lib/ccan/asearch: fix example on 64 bit platforms.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit a8446c3ef94ae0d5f273656da12aa9a8b3abf658)
2011-12-05 16:42:49 +10:30
Rusty Russell
18cd3dd2ad lib/ccan/htable: benchmark against hsearch(3)
Since that has a fixed hash table size and doesn't support delete, we can't
do a thorough comparison, but we can insert and search.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 95757f0e9d979e7c653e9b53bb640deb4f0ea1f9)
2011-12-05 16:42:49 +10:30
Rusty Russell
5917d97991 lib/ccan/likely: use htable_type
Also general cleanups:
(1) Don't assume that strings are folded by the compiler.
(2) Implement likely_stats_reset().
(3) Return non-const string from likely_stats(), as caller must free it.
(4) Don't use struct info indirection (that was from when we used callbacks?)
(5) Close memory leak in run-debug.c

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 0e5d0e30b30bb07b6605843e5ff224210d8083d8)
2011-12-05 16:42:48 +10:30
Rusty Russell
e137404967 lib/ccan/htable: HTABLE_INITIALIZER() for static initialization.
Unfortunately it's a bit of a pain to use for typed hashtables, but it
works.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 60cc720d0797fc49325437ea36a9ffd909c75ed0)
2011-12-05 16:42:48 +10:30
Rusty Russell
0ac7deefbf lib/ccan/htable: clean up interface, document htable_type better.
We change from htable_new()/htable_free() to htable_init/htable_clear.
We also change HTABLE_DEFINE_TYPE() to be the full name, without automatically
prepending htable_.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 0c3590dc33d644f73bb8587db454c491830aaf26)
2011-12-05 16:42:47 +10:30
Rusty Russell
19409ddaf2 lib/ccan/htable: start empty.
There's no real reason to start with 128 entries.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 45f24da35118db441e6153f02f6ddd937da1fa1c)
2011-12-05 16:42:47 +10:30
Rusty Russell
1beb793664 lib/ccan/htable, strset: benchmarking tools.
This lets us compare hash table vs. strset vs. the example
implementation of critbit trees.

cbspeed 100 runs, min-max(avg):
#01: Initial insert:   236-245(237)
#02: Initial lookup (match):   180-186(180)
#03: Initial lookup (miss):   171-185(172)
#04: Initial lookup (random):   441-457(444)
#05: Initial delete all:   127-132(128)
#06: Initial re-inserting:   219-225(220)
#07: Deleting first half:   101-104(102)
#08: Adding (a different) half:   158-162(159)
#09: Lookup after half-change (match):   202-207(203)
#10: Lookup after half-change (miss):   217-222(218)
#11: Churn 1:   297-302(299)
#12: Churn 2:   297-305(300)
#13: Churn 3:   301-308(303)
#14: Post-Churn lookup (match):   189-195(190)
#15: Post-Churn lookup (miss):   189-193(190)
#16: Post-Churn lookup (random):   499-513(503)

speed 100 runs, min-max(avg):
#01: Initial insert:   211-218(212)
#02: Initial lookup (match):   161-166(162)
#03: Initial lookup (miss):   157-162(158)
#04: Initial lookup (random):   452-460(454)
#05: Initial delete all:   126-135(127)
#06: Initial re-inserting:   193-201(194)
#07: Deleting first half:   99-107(99)
#08: Adding (a different) half:   143-190(144)
#09: Lookup after half-change (match):   183-195(184)
#10: Lookup after half-change (miss):   197-203(198)
#11: Churn 1:   271-278(274)
#12: Churn 2:   280-287(282)
#13: Churn 3:   277-285(279)
#14: Post-Churn lookup (match):   171-175(171)
#15: Post-Churn lookup (miss):   174-178(175)
#16: Post-Churn lookup (random):   525-552(528)

stringspeed 100 runs, min-max(avg):
#01: Initial insert:   300-343(308)
#02: Initial lookup (match):   98-136(99)
#03: Initial lookup (miss):   73-102(75)
#04: Initial lookup (random):   230-282(233)
#05: Initial delete all:   66-102(69)
#06: Initial re-inserting:   62-99(64)
#07: Deleting first half:   43-52(43)
#08: Adding (a different) half:   101-156(106)
#09: Lookup after half-change (match):   114-156(120)
#10: Lookup after half-change (miss):   94-103(95)
#11: Churn 1:   98-105(99)
#12: Churn 2:   96-104(98)
#13: Churn 3:   174-184(176)
#14: Post-Churn lookup (match):   93-112(94)
#15: Post-Churn lookup (miss):   77-107(79)
#16: Post-Churn lookup (random):   229-265(232)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 5c559e7df1d31b4c0ddf26451fac972dc8a0c2c9)
2011-12-05 16:42:46 +10:30
Rusty Russell
00b226bfe4 lib/ccan/str: fix warnings.
Firstly, -Wwrite-strings makes string literals const, secondly, we mustn't
define str_strstr etc in terms of themselves!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 0845e79650c9257aa0ddef8ff99fd815b5edffac)
2011-12-05 16:42:46 +10:30
Rusty Russell
ed349eabd9 lib/ccan/str: relicense to public domain.
LGPL is overkill for trivial wrappers like this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 942f2788e165bb203b0f160f29bd4592f32dc344)
2011-12-05 16:42:45 +10:30
Rusty Russell
4e377c28a9 lib/ccan/typesafe_cb: fix example macro ordering in typesafe_cb_preargs documentation.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 12652625db55f6586e95fc5edc73e1e85bae8a5c)
2011-12-05 16:42:45 +10:30
Rusty Russell
a0bff7d062 lib/ccan/htable: fix tools/speed.
As pointed out by Christian Thaeter, it has bitrotted.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit f725bbb1987284933e0f21dfb8f2ce7a1f0806e5)
2011-12-05 16:42:44 +10:30
Joey Adams
11c90462cd lib/ccan/build_assert: Remove stale LGPL license comment.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit d3d4303acd139e8c34f11067333c000a3f885307)
2011-12-05 16:42:43 +10:30
Rusty Russell
bc318580e4 lib/ccan/array_size: relicense under public domain.
It's just a header, I don't care what's done with it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit d06b67d244657da7054e3da580a771c365566d3c)
2011-12-05 16:42:40 +10:30
Rusty Russell
abb437c0ab ccan: configure check for HAVE_BUILTIN_CHOOSE_EXPR
We weren't testing for this, and without it, typesafe_cb just casts
its function argument.  This is why I didn't get a warning when one of
my patches amended a function incorrectly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14 07:05:13 +09:30