[Ocfs2-tools-devel] [PATCH 03/11] configure: Detect systems where
we cannot statically build o2cb_ctl.
Sunil Mushran
sunil.mushran at oracle.com
Thu Sep 27 17:14:26 PDT 2007
From: Joel Becker <joel.becker at oracle.com>
Fedora 7 no longer provides static libraries for GLib 2. Thus, we
cannot statically link o2cb_ctl on that platform. While the
--enable-dynamic-ctl option works, this is really something we should
detect.
If --enable/disable-dynamic-ctl is not specified, configure will try to
link a static program with GLib 2. If this works, o2cb_ctl will be
built static, otherwise it will be built dynamic. We honor
--enable/disable-dynamic-ctl when it is specified. Caveat emptor.
While we're here, we now error if GLib 2 is not found. We require it
for o2cb_ctl. As GLib 2 it now required, we no longer conditionally
build ocfs2cdsl. That test is cleaned up too.
Signed-off-by: Joel Becker <joel.becker at oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh at oracle.com>
---
Config.make.in | 1 -
Makefile | 6 +----
configure.in | 70 ++++++++++++++++++++++++++++++++-----------------------
3 files changed, 42 insertions(+), 35 deletions(-)
diff --git a/Config.make.in b/Config.make.in
index 2bd419e..af829c6 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -68,7 +68,6 @@ HAVE_BLKID = @HAVE_BLKID@
BUILD_OCFS2CONSOLE = @BUILD_OCFS2CONSOLE@
-BUILD_OCFS2CDSL = @BUILD_OCFS2CDSL@
BUILD_DEBUGOCFS2 = @BUILD_DEBUGOCFS2@
OCFS2_DEBUG = @OCFS2_DEBUG@
diff --git a/Makefile b/Makefile
index f421b10..0c467e1 100644
--- a/Makefile
+++ b/Makefile
@@ -20,11 +20,7 @@ CHKCONFIG_DEP = chkconfig
COMPILE_PY = 1
endif
-SUBDIRS = libo2dlm libo2cb libocfs2 fsck.ocfs2 mkfs.ocfs2 mounted.ocfs2 tunefs.ocfs2 debugfs.ocfs2 o2cb_ctl ocfs2_hb_ctl mount.ocfs2 listuuid sizetest extras patches
-
-ifdef BUILD_OCFS2CDSL
-SUBDIRS += ocfs2cdsl
-endif
+SUBDIRS = libo2dlm libo2cb libocfs2 fsck.ocfs2 mkfs.ocfs2 mounted.ocfs2 tunefs.ocfs2 debugfs.ocfs2 o2cb_ctl ocfs2_hb_ctl mount.ocfs2 ocfs2cdsl listuuid sizetest extras patches
ifdef BUILD_OCFS2CONSOLE
SUBDIRS += ocfs2console
diff --git a/configure.in b/configure.in
index 279d03b..aff9312 100644
--- a/configure.in
+++ b/configure.in
@@ -123,6 +123,11 @@ fi
AC_SUBST(OCFS2_DEBUG_EXE)
AC_MSG_RESULT($enable_debugexe)
+GLIB_REQUIRED_VERSION=2.2.3
+
+AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION, have_glib=yes,
+ AC_MSG_ERROR([GLib $GLIB_REQUIRED_VERSION or better is required]))
+
AC_MSG_CHECKING(whether to build fsck dynamically)
AC_ARG_ENABLE([dynamic-fsck], [ --enable-dynamic-fsck=[yes/no] Build fsck dynamically [default=no]],,enable_dynamic_fsck=no)
OCFS2_DYNAMIC_FSCK=
@@ -132,49 +137,56 @@ fi
AC_SUBST(OCFS2_DYNAMIC_FSCK)
AC_MSG_RESULT($enable_dynamic_fsck)
-AC_MSG_CHECKING(whether to build cluster control tools dynamically)
-AC_ARG_ENABLE([dynamic-ctl], [ --enable-dynamic-ctl=[yes/no] Build cluster control tools dynamically [default=no]],,enable_dynamic_ctl=no)
OCFS2_DYNAMIC_CTL=
+AC_MSG_CHECKING(whether to build cluster control tools dynamically)
+AC_ARG_ENABLE([dynamic-ctl], [ --enable-dynamic-ctl=[yes/no] Build cluster control tools dynamically [default=test]], [
+AC_MSG_RESULT($enable_dynamic_ctl)
+], [
+enable_dynamic_ctl=test
+AC_MSG_RESULT(test)])
+
+if test "x$enable_dynamic_ctl" = "xtest"; then
+ dyn_save_CFLAGS="$CFLAGS"
+ dyn_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GLIB_CFLAGS"
+ LIBS="-static $LIBS $GLIB_LIBS"
+
+ AC_MSG_CHECKING(how to link o2cb_ctl)
+ AC_TRY_LINK([
+#include <glib.h>
+#include <stdio.h>
+], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], [
+enable_dynamic_ctl=no
+AC_MSG_RESULT(static)
+], [
+enable_dynamic_ctl=yes
+AC_MSG_RESULT(dynamic)])
+
+ CFLAGS="$dyn_save_CFLAGS"
+ LIBS="$dyn_save_LIBS"
+fi
+
if test "x$enable_dynamic_ctl" = "xyes"; then
OCFS2_DYNAMIC_CTL=yes
fi
AC_SUBST(OCFS2_DYNAMIC_CTL)
-AC_MSG_RESULT($enable_dynamic_ctl)
-GLIB_REQUIRED_VERSION=2.2.3
-
-AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION, have_glib=yes, have_glib=no)
-
-if test "x$have_glib" != "xyes"; then
- AC_MSG_WARN([Glib $GLIB_REQUIRED_VERSION or better not found, some tools won't be built])
-fi
-
-BUILD_OCFS2CDSL=
BUILD_DEBUGOCFS2=
-if test "x$have_glib" = "xyes"; then
- BUILD_OCFS2CDSL=yes
-
- ocfs_tools_save_LIBS=$LIBS
- LIBS="$LIBS -lncurses"
- AC_CHECK_LIB(readline, readline,
- [AC_CHECK_HEADER(readline/readline.h,
- BUILD_DEBUGOCFS2=yes,
- [AC_MSG_WARN([readline not found, debugfs.ocfs2 will not be built])])],
- [AC_MSG_WARN([readline not found, debugfs.ocfs2 will not be built])])
- LIBS=$ocfs_tools_save_LIBS
-fi
+ocfs_tools_save_LIBS=$LIBS
+LIBS="$LIBS -lncurses"
+AC_CHECK_LIB(readline, readline,
+ [AC_CHECK_HEADER(readline/readline.h,
+ BUILD_DEBUGOCFS2=yes,
+ [AC_MSG_WARN([readline not found, debugfs.ocfs2 will not be built])])],
+ [AC_MSG_WARN([readline not found, debugfs.ocfs2 will not be built])])
+LIBS=$ocfs_tools_save_LIBS
-AC_SUBST(BUILD_OCFS2CDSL)
AC_SUBST(BUILD_DEBUGOCFS2)
BUILD_OCFS2CONSOLE=
AC_ARG_ENABLE(ocfs2console, [ --enable-ocfs2console=[yes/no] Build GUI frontend [default=yes]],,enable_ocfs2console=yes)
-if test "x$have_glib" != "xyes"; then
- enable_ocfs2console=no
-fi
-
if test "x$enable_ocfs2console" = "xyes"; then
dnl check for Python
AM_PATH_PYTHON(2.3, have_python=yes, have_python=no)
--
1.5.2.5
More information about the Ocfs2-tools-devel
mailing list