[PATCHSET] cluster configure check improvements

Michael Adam obnox at samba.org
Thu Nov 1 03:25:27 MDT 2012


Alright, another minor cosmetic update:

If no --with[out]-cluster-support option is specified and
cluster support is not found, don't Logs.warn() but Logs.info()
the fact.

Cheers - Michael

On 2012-10-31 at 17:07 +0100, Michael Adam wrote:
> Hi,
> 
> here is an update to the patchset from yesterday,
> 
> it adds one patch that fixes the behaviour of configure
> with respect to the presence of --with[out]-cluster-support
> and the success of the ctdb checks:
> 
> If --with-cluster-support is specified and the cluster checks
> fail, we up to now succeede the configure and built without
> cluster support. With this patch, we correctly fail the
> configure.
> 
> This change can serve as a model to fix various other
> --with[out]-.. options.
> 
> I expect more patches along these lines from Björn in the next
> couple of days.
> 
> Cheers - Michael
> 
> 
> On 2012-10-30 at 17:15 +0100, Michael Adam wrote:
> > Hi,
> > 
> > attached find a patchset for review that improves our cluster (ctdb)
> > configure checks in Samba master (for waf and autoconf).
> > 
> > * the build against older (pre 1.2) ctdb versions is fixed
> > * the configure checks are fixed on system without libtalloc
> >   installed
> > 
> > These should go into master if found to be correct.
> > 
> > Cheers - Michael
> > 
> > PS:
> > * branch master-cluster-checks under git://git.samba.org/obnox/samba/samba-obnox.git
> > * gitweb: https://gitweb.samba.org/?p=obnox/samba/samba-obnox.git;a=log;h=refs/heads/master-cluster-checks
-------------- next part --------------
From 974764164c554c909ad025db7a0384d87cddab8c Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Tue, 30 Oct 2012 14:41:04 +0100
Subject: [PATCH 1/8] build(waf): fix a tab indentation to spaces

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/wscript |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/wscript b/source3/wscript
index cc94053..9db03ec 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1302,7 +1302,7 @@ main() {
         else:
             includes = ''
 
-	if not conf.env.USING_SYSTEM_TDB:
+        if not conf.env.USING_SYSTEM_TDB:
             includes = includes + ' ' + srcdir + '/lib/tdb/include'
 
         have_cluster_support = True
-- 
1.7.9.5


From 0d8c641cc58aebff439e8d5307da29246098f99b Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Tue, 30 Oct 2012 14:43:42 +0100
Subject: [PATCH 2/8] build(waf): fix the cluster(ctdb) build without system
 talloc installed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is analogous to the earlier patch for tdb.
It temporarily adds the talloc include path to the
includes search list for the ctdb-header configure checks.

Signed-off-by: Michael Adam <obnox at samba.org>
Tested-by: Björn Baumbach <bb at sernet.de>
---
 source3/wscript |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/source3/wscript b/source3/wscript
index 9db03ec..5cbfd35 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1305,6 +1305,9 @@ main() {
         if not conf.env.USING_SYSTEM_TDB:
             includes = includes + ' ' + srcdir + '/lib/tdb/include'
 
+        if not conf.env.USING_SYSTEM_TALLOC:
+            includes = includes + ' ' + srcdir + '/lib/talloc'
+
         have_cluster_support = True
         ctdb_broken = ""
 
-- 
1.7.9.5


From 3f68cb0d4736bbc31246cdcd10073e03be0c2701 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Baumbach?= <bb at sernet.de>
Date: Tue, 30 Oct 2012 13:40:48 +0100
Subject: [PATCH 3/8] build(autoconf): fix check for ctdb_private.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Michael Adam <obnox at samba.org>
---
 source3/configure.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/configure.in b/source3/configure.in
index fb00fee..327e55e 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -4989,7 +4989,7 @@ then
 fi
 
 if test "x$have_cluster_support" = "xyes" -a \
-	"x$ac_cv_header_ctdb_h" != "xyes"
+	"x$ac_cv_header_ctdb_private_h" != "xyes"
 then
 	have_cluster_support=no
 	ctdb_broken="ctdb_private.h is required for cluster support"
-- 
1.7.9.5


From 293f41c3be8cbe99d62df709c9cadd3c3df80d6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Baumbach?= <bb at sernet.de>
Date: Tue, 30 Oct 2012 13:26:24 +0100
Subject: [PATCH 4/8] build(autoconf): check if we have ctdb_protocol.h in the
 cluster checks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Michael Adam <obnox at samba.org>
---
 source3/configure.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/configure.in b/source3/configure.in
index 327e55e..179d12d 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -4969,7 +4969,7 @@ ctdb_broken="no"
 SAVED_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS} $CTDB_CPPFLAGS"
 
-AC_CHECK_HEADERS(ctdb.h ctdb_private.h,,,[
+AC_CHECK_HEADERS(ctdb.h ctdb_private.h ctdb_protocol.h ,,,[
 #include "confdefs.h"
 #define NO_CONFIG_H
 #include "replace.h"
-- 
1.7.9.5


From c795a595df06f2e57a9273c3435e68b7b2aa358f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Baumbach?= <bb at sernet.de>
Date: Tue, 30 Oct 2012 13:59:41 +0100
Subject: [PATCH 5/8] build(waf): check if we have ctdb_protocol.h in the
 cluster checks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Michael Adam <obnox at samba.org>
---
 source3/wscript |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/source3/wscript b/source3/wscript
index 5cbfd35..157a8c9 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1367,6 +1367,28 @@ main() {
                 #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_protocol.h>
+
+                int main(void)
+                {
+                    return 0;
+                }
+                ''',
+                'HAVE_CTDB_PROTOCOL_H',
+                addmain=False,
+                includes=includes,
+                msg='Checking for header ctdb_protocol.h')
+
+        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>
-- 
1.7.9.5


From 20484c329273854e809ddf808d5ecd11a633bbe6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Baumbach?= <bb at sernet.de>
Date: Wed, 17 Oct 2012 16:54:33 +0200
Subject: [PATCH 6/8] s3:ctdb library: fix the build against older ctdb
 versions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

by checking if we have the ctdb_protocol.h and including ctdb_private.h otherwise.

Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Michael Adam <obnox at samba.org>
---
 source3/lib/ctdb_conn.h |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/source3/lib/ctdb_conn.h b/source3/lib/ctdb_conn.h
index 9229536..0d648c7 100644
--- a/source3/lib/ctdb_conn.h
+++ b/source3/lib/ctdb_conn.h
@@ -23,7 +23,12 @@
 #ifdef CLUSTER_SUPPORT
 
 #include <tdb.h>
+
+#ifdef HAVE_CTDB_PROTOCOL_H
 #include <ctdb_protocol.h>
+#else
+#include <ctdb_private.h>
+#endif
 
 #else /* CLUSTER_SUPPORT */
 
-- 
1.7.9.5


From 8464f967a6b2b9ae14d349c82aa5cd1a3760551a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Baumbach?= <bb at sernet.de>
Date: Tue, 30 Oct 2012 16:45:30 +0100
Subject: [PATCH 7/8] s3-torture:test_ctdbconn: fix the build against older
 ctdb versions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

by checking if we have the ctdb_protocol.h and including ctdb_private.h otherwise.

Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Michael Adam <obnox at samba.org>
---
 source3/torture/test_ctdbconn.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/source3/torture/test_ctdbconn.c b/source3/torture/test_ctdbconn.c
index 539e224..d018352 100644
--- a/source3/torture/test_ctdbconn.c
+++ b/source3/torture/test_ctdbconn.c
@@ -25,7 +25,13 @@
 #include "ctdb_conn.h"
 #include "lib/util/tevent_unix.h"
 #include "tdb.h"
+
+#ifdef HAVE_CTDB_PROTOCOL_H
 #include "ctdb_protocol.h"
+#else
+#include "ctdb_private.h"
+#endif
+
 #include "messages.h"
 
 struct ctdb_conn_test_state {
-- 
1.7.9.5


From 68df59f00ba13174e4e1cefe35ec853d0150f9c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Baumbach?= <bb at sernet.de>
Date: Tue, 30 Oct 2012 16:04:10 +0100
Subject: [PATCH 8/8] build(waf): Fail "configure --with-cluster-support" if
 ctdb support is not available.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently, configure only warns if cluster support is not found.

Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Michael Adam <obnox at samba.org>
---
 source3/wscript |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/source3/wscript b/source3/wscript
index 157a8c9..96ab4de 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -43,7 +43,7 @@ def set_options(opt):
     opt.SAMBA3_ADD_OPTION('aio-support')
     opt.SAMBA3_ADD_OPTION('profiling-data', default=False)
 
-    opt.SAMBA3_ADD_OPTION('cluster-support')
+    opt.SAMBA3_ADD_OPTION('cluster-support', default=None)
 
     opt.add_option('--with-ctdb-dir',
                    help=("Directory under which ctdb is installed"),
@@ -1288,7 +1288,9 @@ main() {
     #
     # checking for clustering extensions (CTDB)
     #
-    if not Options.options.with_cluster_support:
+    if Options.options.with_cluster_support == False:
+        # configure is called with --without-cluster-support,
+        # so don't check for and build w/o ctdb support.
         have_cluster_support = False
 
     else:
@@ -1519,14 +1521,16 @@ main() {
         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")
+        if Options.options.with_cluster_support == False:
+            Logs.info("building without cluster support (--without-cluster-support)")
+        elif Options.options.with_cluster_support == True:
+            Logs.error("Cluster support not available: " + ctdb_broken)
+            conf.fatal("Cluster support not found, but --with-cluster-support was specified")
         else:
-            Logs.warn("building without cluster support: " + ctdb_broken)
+            Logs.info("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,
-- 
1.7.9.5

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 206 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20121101/c38abef6/attachment.pgp>


More information about the samba-technical mailing list