[Ocfs2-tools-devel] [PATCH 08/11] libo2dlm: Detect libdlm in configure.
Joel Becker
joel.becker at oracle.com
Tue May 27 18:44:28 PDT 2008
If libdlm is not installed, do not compile userspace cluster support.
Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
Config.make.in | 2 +
configure.in | 25 +++++++++++++++--
fsck.ocfs2/Makefile | 2 +-
fswreck/Makefile | 2 +-
libo2dlm/.gitignore | 1 +
libo2dlm/Makefile | 6 +++-
libo2dlm/o2dlm.c | 49 ++++++++++++++++++++++++++++++++++
libocfs2/Makefile | 2 +-
listuuid/Makefile | 2 +-
mkfs.ocfs2/Makefile | 2 +-
mount.ocfs2/Makefile | 2 +-
mounted.ocfs2/Makefile | 2 +-
o2dlm.pc.in | 2 +-
ocfs2_hb_ctl/Makefile | 2 +-
ocfs2cdsl/Makefile | 2 +-
ocfs2console/ocfs2interface/Makefile | 2 +-
tunefs.ocfs2/Makefile | 2 +-
17 files changed, 91 insertions(+), 16 deletions(-)
diff --git a/Config.make.in b/Config.make.in
index c0cd860..72373a7 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -75,7 +75,9 @@ BUILD_OCFS2CONSOLE = @BUILD_OCFS2CONSOLE@
BUILD_DEBUGOCFS2 = @BUILD_DEBUGOCFS2@
BUILD_CMAN_SUPPORT = @BUILD_CMAN_SUPPORT@
+BUILD_FSDLM_SUPPORT = @BUILD_FSDLM_SUPPORT@
CPG_LDFLAGS = @CPG_LDFLAGS@
+DL_LIBS = @DL_LIBS@
OCFS2_DEBUG = @OCFS2_DEBUG@
diff --git a/configure.in b/configure.in
index 409583b..213fa1c 100644
--- a/configure.in
+++ b/configure.in
@@ -279,14 +279,33 @@ if test "x$CPG_LDFLAGS" != "x"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
+ AC_MSG_WARN([libcpg not found, cman support will not be built])
cpg_found=
fi
AC_SUBST(CPG_LDFLAGS)
+fsdlm_found=
+AC_CHECK_LIB(dlm_lt, dlm_create_lockspace,
+ [AC_CHECK_HEADER(libdlm.h, fsdlm_found=yes,
+ [AC_MSG_WARN([libdlm.h not found, fsdlm support will not be built])])],
+ [AC_MSG_WARN([libdlm_lt not found, fsdlm support will not be built])])
+
+BUILD_FSDLM_SUPPORT=
+DL_LIBS=
+if test "x$fsdlm_found" = "xyes"; then
+ BUILD_FSDLM_SUPPORT=yes
+ DL_LIBS=-ldl
+fi
+AC_SUBST(BUILD_FSDLM_SUPPORT)
+AC_SUBST(DL_LIBS)
+
+BUILD_CMAN_SUPPORT=
if test "x$cman_found" = "xyes" -a "x$cpg_found" = "xyes"; then
- BUILD_CMAN_SUPPORT=yes
-else
- BUILD_CMAN_SUPPORT=
+ if test "x$fsdlm_found" = "xyes"; then
+ BUILD_CMAN_SUPPORT=yes
+ else
+ AC_MSG_WARN([fsdlm not available, cman support will not be built])
+ fi
fi
AC_SUBST(BUILD_CMAN_SUPPORT)
diff --git a/fsck.ocfs2/Makefile b/fsck.ocfs2/Makefile
index 260c2ed..b804f67 100644
--- a/fsck.ocfs2/Makefile
+++ b/fsck.ocfs2/Makefile
@@ -8,7 +8,7 @@ SBIN_PROGRAMS = fsck.ocfs2
INCLUDES = -I$(TOPDIR)/include -Iinclude
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
-LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm -ldl
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
diff --git a/fswreck/Makefile b/fswreck/Makefile
index 472fec1..f75d1a5 100644
--- a/fswreck/Makefile
+++ b/fswreck/Makefile
@@ -24,7 +24,7 @@ OBJS = $(subst .c,.o,$(CFILES))
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
-LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm -ldl
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
diff --git a/libo2dlm/.gitignore b/libo2dlm/.gitignore
index 9f9f470..5bcb91c 100644
--- a/libo2dlm/.gitignore
+++ b/libo2dlm/.gitignore
@@ -2,3 +2,4 @@ cscope.*
libo2dlm.a
o2dlm_err.*
*.d
+o2dlm_test
diff --git a/libo2dlm/Makefile b/libo2dlm/Makefile
index c176ef7..1e2f443 100644
--- a/libo2dlm/Makefile
+++ b/libo2dlm/Makefile
@@ -8,6 +8,10 @@ LIBRARIES = libo2dlm.a
CFLAGS += -fPIC
+ifneq ($(BUILD_FSDLM_SUPPORT),)
+DEFINES += -DHAVE_FSDLM
+endif
+
ifneq ($(OCFS2_DEBUG_EXE),)
DEBUG_EXE_FILES = $(shell awk '/DEBUG_EXE/{if (k[FILENAME] == 0) {print FILENAME; k[FILENAME] = 1;}}' $(CFILES))
DEBUG_EXE_PROGRAMS = $(addprefix debug_,$(subst .c,,$(DEBUG_EXE_FILES)))
@@ -48,7 +52,7 @@ libo2dlm.a: $(OBJS)
$(RANLIB) $@
o2dlm_test: $(TESTING_OBJS) $(LIBRARIES) $(COM_ERR_LIBS)
- $(LINK)
+ $(LINK) $(DL_LIBS)
DIST_FILES = $(CFILES) $(HFILES) o2dlm_err.et $(TESTING_CFILES)
diff --git a/libo2dlm/o2dlm.c b/libo2dlm/o2dlm.c
index 7f2274f..6adff5e 100644
--- a/libo2dlm/o2dlm.c
+++ b/libo2dlm/o2dlm.c
@@ -57,8 +57,10 @@ struct o2dlm_lock_res
int l_flags; /* limited set of flags */
enum o2dlm_lock_level l_level; /* either PR or EX */
int l_fd; /* the fd returned by the open call */
+#ifdef HAVE_FSDLM
struct dlm_lksb l_lksb; /* lksb for fsdlm locking */
char l_lvb[DLM_LVB_LEN]; /* LVB for fsdlm */
+#endif
};
struct o2dlm_ctxt
@@ -69,8 +71,10 @@ struct o2dlm_ctxt
char ct_domain_path[O2DLM_MAX_FULL_DOMAIN_PATH]; /* domain
* dir */
char ct_ctxt_lock_name[O2DLM_LOCK_ID_MAX_LEN];
+#ifdef HAVE_FSDLM
void *ct_lib_handle;
dlm_lshandle_t ct_handle;
+#endif
};
@@ -365,8 +369,10 @@ static struct o2dlm_lock_res *o2dlm_new_lock_res(const char *id,
lockres->l_flags = flags;
lockres->l_level = level;
lockres->l_fd = -1;
+#ifdef HAVE_FSDLM
lockres->l_lksb.sb_lvbptr = lockres->l_lvb;
memset(lockres->l_lksb.sb_lvbptr, 0, DLM_LVB_LEN);
+#endif
}
return lockres;
}
@@ -675,6 +681,7 @@ static errcode_t o2dlm_initialize_classic(const char *dlmfs_path,
* fsdlm operations
*/
+#ifdef HAVE_FSDLM
/* Dynamic symbols */
static dlm_lshandle_t (*fsdlm_create_lockspace)(const char *name,
mode_t mode);
@@ -1018,7 +1025,49 @@ free_and_exit:
o2dlm_free_ctxt(ctxt);
return error;
}
+#else /* HAVE_FSDLM */
+static errcode_t o2dlm_lock_fsdlm(struct o2dlm_ctxt *ctxt,
+ const char *lockid, int lockflags,
+ enum o2dlm_lock_level level)
+{
+ return O2DLM_ET_SERVICE_UNAVAILABLE;
+}
+
+static errcode_t o2dlm_unlock_lock_res_fsdlm(struct o2dlm_ctxt *ctxt,
+ struct o2dlm_lock_res *lockres)
+{
+ return O2DLM_ET_SERVICE_UNAVAILABLE;
+}
+
+static errcode_t o2dlm_read_lvb_fsdlm(struct o2dlm_ctxt *ctxt,
+ char *lockid,
+ char *lvb,
+ unsigned int len,
+ unsigned int *bytes_read)
+{
+ return O2DLM_ET_SERVICE_UNAVAILABLE;
+}
+
+static errcode_t o2dlm_write_lvb_fsdlm(struct o2dlm_ctxt *ctxt,
+ char *lockid,
+ const char *lvb,
+ unsigned int len,
+ unsigned int *bytes_written)
+{
+ return O2DLM_ET_SERVICE_UNAVAILABLE;
+}
+static errcode_t o2dlm_initialize_fsdlm(const char *domain_name,
+ struct o2dlm_ctxt **dlm_ctxt)
+{
+ return O2DLM_ET_SERVICE_UNAVAILABLE;
+}
+
+static errcode_t o2dlm_destroy_fsdlm(struct o2dlm_ctxt *ctxt)
+{
+ return O2DLM_ET_SERVICE_UNAVAILABLE;
+}
+#endif /* HAVE_FSDLM */
/*
* Public API
diff --git a/libocfs2/Makefile b/libocfs2/Makefile
index 6e998bb..ae6b986 100644
--- a/libocfs2/Makefile
+++ b/libocfs2/Makefile
@@ -6,7 +6,7 @@ INCLUDES = -I$(TOPDIR)/include
LIBRARIES = libocfs2.a
-LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm -ldl
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
diff --git a/listuuid/Makefile b/listuuid/Makefile
index 268f0b3..784e804 100644
--- a/listuuid/Makefile
+++ b/listuuid/Makefile
@@ -7,7 +7,7 @@ INCLUDES = -I$(TOPDIR)/include
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
-LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm -ldl
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
diff --git a/mkfs.ocfs2/Makefile b/mkfs.ocfs2/Makefile
index 1498ad6..b80b8b7 100644
--- a/mkfs.ocfs2/Makefile
+++ b/mkfs.ocfs2/Makefile
@@ -11,7 +11,7 @@ LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
-LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm -ldl
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
INCLUDES = -I$(TOPDIR)/include -I.
diff --git a/mount.ocfs2/Makefile b/mount.ocfs2/Makefile
index ac9e162..7fe24be 100644
--- a/mount.ocfs2/Makefile
+++ b/mount.ocfs2/Makefile
@@ -8,7 +8,7 @@ SBIN_PROGRAMS = mount.ocfs2 umount.ocfs2
INCLUDES = -I$(TOPDIR)/include
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
-LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm -ldl
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
diff --git a/mounted.ocfs2/Makefile b/mounted.ocfs2/Makefile
index 967d519..cd6a591 100644
--- a/mounted.ocfs2/Makefile
+++ b/mounted.ocfs2/Makefile
@@ -5,7 +5,7 @@ include $(TOPDIR)/Preamble.make
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
-LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm -ldl
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
diff --git a/o2dlm.pc.in b/o2dlm.pc.in
index a50f70b..9a663e6 100644
--- a/o2dlm.pc.in
+++ b/o2dlm.pc.in
@@ -7,5 +7,5 @@ Name: o2dlm
Description: Library for accessing the ocfs2 DLM
Version: @VERSION@
Requires: com_err
-Libs: -L${libdir} -lo2dlm -ldl
+Libs: -L${libdir} -lo2dlm @DL_LIBS@
Cflags: -I${includedir}
diff --git a/ocfs2_hb_ctl/Makefile b/ocfs2_hb_ctl/Makefile
index 804caf6..0e1f583 100644
--- a/ocfs2_hb_ctl/Makefile
+++ b/ocfs2_hb_ctl/Makefile
@@ -8,7 +8,7 @@ SBIN_PROGRAMS = ocfs2_hb_ctl
INCLUDES = -I$(TOPDIR)/include
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
-LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm -ldl
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
diff --git a/ocfs2cdsl/Makefile b/ocfs2cdsl/Makefile
index 55fc72b..391b553 100644
--- a/ocfs2cdsl/Makefile
+++ b/ocfs2cdsl/Makefile
@@ -5,7 +5,7 @@ include $(TOPDIR)/Preamble.make
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
-LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm -ldl
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
diff --git a/ocfs2console/ocfs2interface/Makefile b/ocfs2console/ocfs2interface/Makefile
index cb95154..c5dfea3 100644
--- a/ocfs2console/ocfs2interface/Makefile
+++ b/ocfs2console/ocfs2interface/Makefile
@@ -11,7 +11,7 @@ PYMOD_CFLAGS = -fno-strict-aliasing $(PYTHON_INCLUDES)
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
-LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm -ldl
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
diff --git a/tunefs.ocfs2/Makefile b/tunefs.ocfs2/Makefile
index ef1c9fc..8333971 100644
--- a/tunefs.ocfs2/Makefile
+++ b/tunefs.ocfs2/Makefile
@@ -5,7 +5,7 @@ include $(TOPDIR)/Preamble.make
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
-LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm -ldl
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
--
1.5.4.5
More information about the Ocfs2-tools-devel
mailing list