[Ocfs2-tools-devel] [PATCH 09/39] configure: Check for libcman and cpg.

Joel Becker joel.becker at oracle.com
Fri Mar 14 16:52:32 PDT 2008


Check for the cman and cpg libraries.

Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
 Config.make.in |    3 ++
 configure.in   |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 65 insertions(+), 2 deletions(-)

diff --git a/Config.make.in b/Config.make.in
index 6d79148..c0cd860 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -74,6 +74,9 @@ BUILD_OCFS2CONSOLE = @BUILD_OCFS2CONSOLE@
 
 BUILD_DEBUGOCFS2 = @BUILD_DEBUGOCFS2@
 
+BUILD_CMAN_SUPPORT = @BUILD_CMAN_SUPPORT@
+CPG_LDFLAGS = @CPG_LDFLAGS@
+
 OCFS2_DEBUG = @OCFS2_DEBUG@
 
 OCFS2_DEBUG_EXE = @OCFS2_DEBUG_EXE@
diff --git a/configure.in b/configure.in
index c1bf2c6..409583b 100644
--- a/configure.in
+++ b/configure.in
@@ -219,17 +219,77 @@ AC_SUBST(OCFS2_DYNAMIC_CTL)
 
 BUILD_DEBUGOCFS2=
 
-ocfs_tools_save_LIBS=$LIBS
+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
+LIBS="$ocfs_tools_save_LIBS"
 
 AC_SUBST(BUILD_DEBUGOCFS2)
 
+# We use cman_replyto_shutdown to insure a new enough libcman
+cman_found=
+AC_CHECK_LIB(cman, cman_replyto_shutdown,
+  [AC_CHECK_HEADER(libcman.h, cman_found=yes,
+    [AC_MSG_WARN([libcman.h not found, cman support will not be built])])],
+  [AC_MSG_WARN([libcman not found, cman support will not be built])])
+
+cpg_found=
+if test "x$cman_found" = "xyes"; then
+  AC_CHECK_HEADER(openais/cpg.h, cpg_found=yes,
+    [AC_MSG_WARN([openais/cpg.h not found, cman support will not be built])])
+fi
+
+#
+# We can't use AC_CHECK_LIB on libcpg, because it is in
+# ${libdir}/openais, and we can't expand it in configure.in.  What we'll
+# try instead is to search AIS_TRY_PATH for -L<element>/openais -lcpg.
+# NOTE that the initial colon ':' is *intentional*.  We want the empty
+# string first in case the user passed LDFLAGS.
+#
+CPG_LDFLAGS=
+if test "x$cpg_found" = "xyes"; then
+    # Remember, AIS_TRY_PATH starts with a colon ':' on purpose
+    AIS_TRY_PATH=":/usr/lib64:/usr/lib:/usr/local/lib64:/usr/local/lib"
+    AC_MSG_CHECKING([for cpg_initialize in -lcpg])
+    while test "x$AIS_TRY_PATH" != "x"; do
+	TRY="`echo $AIS_TRY_PATH | cut -f1 -d:`"
+	AIS_TRY_PATH="`echo $AIS_TRY_PATH | cut -f2- -d:`"
+
+	if test "x$TRY" != "x"; then
+	    TRY="-L${TRY}/openais"
+	fi
+        TRY="$TRY"
+
+	saved_LDFLAGS="$LDFLAGS"
+	LDFLAGS="$LDFLAGS $TRY -lcpg"
+	AC_LINK_IFELSE([AC_LANG_CALL([], [cpg_initialize])],
+		       [CPG_LDFLAGS="$TRY"])
+	LDFLAGS="$saved_LDFLAGS"
+
+	if test "x$CPG_LDFLAGS" != "x"; then
+	    break
+	fi
+    done
+fi
+if test "x$CPG_LDFLAGS" != "x"; then
+    AC_MSG_RESULT(yes)
+else
+    AC_MSG_RESULT(no)
+    cpg_found=
+fi
+AC_SUBST(CPG_LDFLAGS)
+
+if test "x$cman_found" = "xyes" -a "x$cpg_found" = "xyes"; then
+  BUILD_CMAN_SUPPORT=yes
+else
+  BUILD_CMAN_SUPPORT=
+fi
+AC_SUBST(BUILD_CMAN_SUPPORT)
+
 BUILD_OCFS2CONSOLE=
 AC_ARG_ENABLE(ocfs2console, [  --enable-ocfs2console=[yes/no]    Build GUI frontend [default=yes]],,enable_ocfs2console=yes)
 
-- 
1.5.3.8




More information about the Ocfs2-tools-devel mailing list