[Ocfs2-tools-devel] [PATCH] fix configure checking libs

Coly Li i at coly.li
Tue Jul 20 09:56:56 PDT 2010


This issue was reported by Tim Serong, the patch was proposed by Tim Serong too.
I just rebase the patch from ocfs2-tools 1.6.2 and cite the comments from Tim's email.

The problem was that the openSUSE Factory build sets --as-needed, which means
the order of arguments to the linker is important (-lcpg needs to
appear before the source file, or it won't build).  This problem will
actually cause the build to lock up forever trying to detect
cpg_initialize, at least on OBS/IBS for Factory builds.  It may or
may not cause problems for other build environments.

This patch is in ocfs2-tools of openSUSE Factory for days, it works well.
Since Tim is not on ocfs2-tools mailing list, I post this patch via my email address.

Signed-off-by: Tim Serong <tserong at novell.com>
Signed-off-by: Coly Li <bosong.ly at taobao.com>
---
 configure.in |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure.in b/configure.in
index 79297eb..024ffef 100644
--- a/configure.in
+++ b/configure.in
@@ -281,9 +281,12 @@ if test "x$cpg_found" = "xyes"; then
         # TRY="$TRY"

         saved_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS $TRY -lcpg"
+        saved_LIBS="$LIBS"
+        LDFLAGS="$LDFLAGS $TRY"
+        LIBS="-lcpg"
         AC_LINK_IFELSE([AC_LANG_CALL([], [cpg_initialize])],
         	       cpg_found=yes)
+        LIBS="$saved_LIBS"
         LDFLAGS="$saved_LDFLAGS"

         if test "x$cpg_found" = "xyes"; then
@@ -325,9 +328,12 @@ if test "x$ckpt_found" = "xyes"; then
         # TRY="$TRY"

         saved_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS $TRY -lSaCkpt"
+        saved_LIBS="$LIBS"
+        LDFLAGS="$LDFLAGS $TRY"
+        LIBS="-lSaCkpt"
         AC_LINK_IFELSE([AC_LANG_CALL([], [saCkptInitialize])],
         	       ckpt_found=yes)
+        LIBS="$saved_LIBS"
         LDFLAGS="$saved_LDFLAGS"

         if test "x$ckpt_found" = "xyes"; then

-- 
Coly Li



More information about the Ocfs2-tools-devel mailing list