summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-04-02 02:20:49 +0200
committerMichael Adam <obnox@samba.org>2011-04-02 03:26:55 +0200
commitd143bc444c10df99b2dd64f4a0e02c902c3c024e (patch)
treea5aaf407ae32843337584ed1362031140649cec7 /source3
parentaf82dcae302934c4ea9c14a5932a4647444f0a63 (diff)
downloadsamba-d143bc444c10df99b2dd64f4a0e02c902c3c024e.tar.gz
samba-d143bc444c10df99b2dd64f4a0e02c902c3c024e.tar.bz2
samba-d143bc444c10df99b2dd64f4a0e02c902c3c024e.zip
s3:waf: add cluster support / ctdb checks.
The checks are roughtly taken from the autoconf ctdb checks. I was not able to implement checks with CHECK_DECL, CHECK_TYPE, CHECK_HEADER and friends, because the ctdb headers seem to need too special a setup of includes and defines in order to compile. So I used CHECK_CODE() in all checks. In the long run, this should be changed. I supported a --with-ctdb-dir options to allow for building against a ctdb that is not installed into /usr (e.g. against a local git checkout). In order to implement this, I had to hand includes in to the CHECK_CODE function. Here I found a problem with CHECK_CODE (or even the core waf conf.check() function: The CHECK_CODE function does not expand the includes it gets (i.e. '#' is not expanded to the base dir, and relative paths are left relative). But the core check() function seems to ignore all include paths that are not absolute paths. Hence in particular the usual default '# .' for the includes is useless. So I preprocessed the list of includes for the cluster checks. But I assume that it would be useful to move this expansion into CHECK_CODE or even into the core waf check function. Autobuild-User: Michael Adam <obnox@samba.org> Autobuild-Date: Sat Apr 2 03:26:55 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/wscript196
1 files changed, 196 insertions, 0 deletions
diff --git a/source3/wscript b/source3/wscript
index e8bd62598b..e6e0b5a774 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -60,6 +60,16 @@ def set_options(opt):
opt.SAMBA3_ADD_OPTION('automount')
opt.SAMBA3_ADD_OPTION('aio-support')
+ opt.SAMBA3_ADD_OPTION('cluster-support')
+
+ opt.add_option('--with-ctdb-dir',
+ help=("Directory under which ctdb is installed"),
+ action="store", dest='ctdb_dir', default=None)
+ opt.add_option('--enable-old-ctdb',
+ help=("enable building against (too) old version of ctdb (default=false)"),
+ action="store_true", dest='enable_old_ctdb', default=False)
+
+
def configure(conf):
from samba_utils import TO_LIST
@@ -1496,6 +1506,192 @@ main() {
# For sys/quota.h and linux/quota.h
conf.CHECK_HEADERS('sys/quota.h')
+
+ #
+ # checking for clustering extensions (CTDB)
+ #
+ if not Options.options.with_cluster_support:
+ have_cluster_support = False
+
+ else:
+
+ if Options.options.ctdb_dir:
+ conf.ADD_EXTRA_INCLUDES(Options.options.ctdb_dir + '/include')
+
+ srcdir = os.path.realpath(conf.srcdir)
+ if 'EXTRA_INCLUDES' in conf.env:
+ includes = ' '.join(conf.env['EXTRA_INCLUDES']).replace('#', srcdir + '/')
+ else:
+ includes = ''
+
+ have_cluster_support = True
+ ctdb_broken = ""
+
+ conf.CHECK_CODE('''
+ #define NO_CONFIG_H
+ #include "replace.h"
+ #include "system/wait.h"
+ #include "system/network.h"
+ #define private #error __USED_RESERVED_WORD_private__
+ #include <talloc.h>
+ #include <tdb.h>
+ #include <ctdb.h>
+
+ int main(void)
+ {
+ return 0;
+ }
+ ''',
+ 'HAVE_CTDB_H',
+ addmain=False,
+ includes=includes,
+ msg='Checking for header ctdb.h')
+
+ if not conf.CONFIG_SET('HAVE_CTDB_H'):
+ have_cluster_support = False
+ ctdb_broken = "ctdb.h is required for cluster support"
+
+ if have_cluster_support:
+ conf.CHECK_CODE('''
+ #define NO_CONFIG_H
+ #include "replace.h"
+ #include "system/wait.h"
+ #include "system/network.h"
+ #define private #error __USED_RESERVED_WORD_private__
+ #include <talloc.h>
+ #include <tdb.h>
+ #include <ctdb.h>
+ #include <ctdb_private.h>
+
+ int main(void)
+ {
+ return 0;
+ }
+ ''',
+ 'HAVE_CTDB_PRIVATE_H',
+ addmain=False,
+ includes=includes,
+ msg='Checking for header ctdb_private.h')
+
+ if not conf.CONFIG_SET('HAVE_CTDB_PRIVATE_H'):
+ have_cluster_support = False
+ ctdb_broken = "ctdb_private.h is required for cluster support"
+
+ if have_cluster_support:
+ conf.CHECK_CODE('''
+ #define NO_CONFIG_H
+ #include "replace.h"
+ #include "system/wait.h"
+ #include "system/network.h"
+ #include <talloc.h>
+ #include <tdb.h>
+ #include <ctdb.h>
+ #include <ctdb_private.h>
+
+ int main(void)
+ {
+ int i = (int)CTDB_CONTROL_TRANS3_COMMIT;
+ return 0;
+ }
+ ''',
+ 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL',
+ addmain=False,
+ includes=includes,
+ msg='Checking for transaction support (TRANS3_COMMIT control)')
+
+ if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'):
+ have_cluster_support = False
+ ctdb_broken = "ctdb transaction support missing or too old"
+
+ if have_cluster_support:
+ conf.CHECK_CODE('''
+ #define NO_CONFIG_H
+ #include "replace.h"
+ #include "system/wait.h"
+ #include "system/network.h"
+ #include <talloc.h>
+ #include <tdb.h>
+ #include <ctdb.h>
+ #include <ctdb_private.h>
+
+ int main(void)
+ {
+ int i = (int)CTDB_CONTROL_SCHEDULE_FOR_DELETION;
+ return 0;
+ }
+ ''',
+ 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL',
+ addmain=False,
+ includes=includes,
+ msg='Checking for SCHEDULE_FOR_DELETION control')
+
+ if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'):
+ if not Options.optinons.enable_old_ctdb:
+ have_cluster_support = False
+ ctdb_broken = "SCHEDULE_FOR_DELETION control missing"
+ else:
+ Logs.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)")
+
+ if have_cluster_support:
+ conf.CHECK_CODE('''
+ #define NO_CONFIG_H
+ #include "replace.h"
+ #include "system/wait.h"
+ #include "system/network.h"
+ #include <talloc.h>
+ #include <tdb.h>
+ #include <ctdb.h>
+ #include <ctdb_private.h>
+
+ int main(void)
+ {
+ struct ctdb_control_tcp _x;
+ return 0;
+ }
+ ''',
+ 'HAVE_STRUCT_CTDB_CONTROL_TCP',
+ addmain=False,
+ includes=includes,
+ msg='Checking for ctdb ipv4 support')
+
+ if not conf.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'):
+ have_cluster_support = False
+ ctdb_broken = "missing struct ctdb_control_tcp"
+
+ if have_cluster_support:
+ conf.CHECK_CODE('''
+ #define NO_CONFIG_H
+ #include "replace.h"
+ #include "system/wait.h"
+ #include "system/network.h"
+ #include <talloc.h>
+ #include <tdb.h>
+ #include <ctdb.h>
+ #include <ctdb_private.h>
+
+ int main(void)
+ {
+ struct ctdb_control_tcp_addr _x;
+ return 0;
+ }
+ ''',
+ 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR',
+ addmain=False,
+ includes=includes,
+ msg='Checking for ctdb ipv6 support')
+
+ if have_cluster_support:
+ Logs.info("building with cluster support")
+ conf.DEFINE('CLUSTER_SUPPORT', 1);
+ else:
+ if not Options.options.with_cluster_support:
+ Logs.info("building without cluster support")
+ else:
+ Logs.warn("building without cluster support: " + ctdb_broken)
+ conf.undefine('CLUSTER_SUPPORT')
+
+
+
conf.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
addmain=False,