[linux-lvm] avoid configure-dependent link failures

Jim Meyering jim at meyering.net
Fri Jun 20 20:44:56 UTC 2008


I noticed that when configuring without --enable-readline,
or without --enable-cmdlib, building would fail with link errors,
at least on rawhide.

The two patches below fix those problems so that builds
succeed regardless of which settings you choose for those
configure-time options.  i.e., these four builds all succeed:

for enable in enable disable; do
  for f in readline cmdlib; do
    echo --$enable-$f
    { make clean && ./configure --$enable-$f --enable-dmeventd \
      --disable-nls --with-dmdir=$PWD/../device-mapper CFLAGS=-g \
      --enable-readline && make } > log-$enable-$f 2>&1
  done
done

Barring objections, I'll commit these (along with WHATS_NEW
and configure updates) on Monday.

>From d9c27d1da320fce6c931b49ee3f9b5406c1c278c Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Fri, 20 Jun 2008 22:03:46 +0200
Subject: [PATCH] avoid link errors when configuring without --enable-readline

* configure.in: Define READLINE_SUPPORT not when processing
--enable-readline or --disable-readline, but rather only after
determining that readline support is desired and the readline
library is available/usable.
---
 configure.in |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/configure.in b/configure.in
index e220522..73c4ee4 100644
--- a/configure.in
+++ b/configure.in
@@ -270,14 +270,11 @@ fi
 ################################################################################
 dnl -- Enable readline
 AC_MSG_CHECKING(whether to enable readline)
-AC_ARG_ENABLE(readline, [  --enable-readline       Enable readline support],
-READLINE=$enableval, READLINE=no)
+AC_ARG_ENABLE([readline],
+  [  --enable-readline       Enable readline support],
+  [READLINE=$enableval], [READLINE=no])
 AC_MSG_RESULT($READLINE)

-if test x$READLINE = xyes; then
-	AC_DEFINE([READLINE_SUPPORT], 1, [Define to 1 to include the LVM readline shell.])
-fi
-
 ################################################################################
 dnl -- Disable realtime clock support
 AC_MSG_CHECKING(whether to enable realtime support)
@@ -501,7 +498,11 @@ Note: if you are using precompiled packages you will also need the development
 package as well (which may be called readline-devel or something similar).
 )
 	)
-	AC_CHECK_FUNC(rl_completion_matches, AC_DEFINE([HAVE_RL_COMPLETION_MATCHES], 1, [Define to 1 if rl_completion_matches() is available.]))
+	AC_CHECK_FUNC([rl_completion_matches],
+	  AC_DEFINE([HAVE_RL_COMPLETION_MATCHES], 1,
+	  [Define to 1 if rl_completion_matches() is available.]))
+	AC_DEFINE([READLINE_SUPPORT], 1,
+	  [Define to 1 to include the LVM readline shell.])
 fi

 ################################################################################
--
1.5.6.7.g67e08b


>From ef46f6256681441d16a94181dee2e7c86eebad7a Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Fri, 20 Jun 2008 22:38:22 +0200
Subject: [PATCH] avoid link failure when configuring without --enable-cmdlib

* make.tmpl.in (LVM2CMD_LIB): Define to -llvm2cmd when CMDLIB = yes.
* dmeventd/mirror/Makefile.in (CLDFLAGS): Use $(LVM2CMD_LIB) rather
than hard-coding -llvm2cmd.
* dmeventd/snapshot/Makefile.in (CLDFLAGS): Likewise.
---
 dmeventd/mirror/Makefile.in   |    5 ++---
 dmeventd/snapshot/Makefile.in |    3 +--
 make.tmpl.in                  |    6 +++++-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dmeventd/mirror/Makefile.in b/dmeventd/mirror/Makefile.in
index 5b3c7a0..baa0a5c 100644
--- a/dmeventd/mirror/Makefile.in
+++ b/dmeventd/mirror/Makefile.in
@@ -1,6 +1,6 @@
 #
 # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
-# Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2004-2005, 2008 Red Hat, Inc. All rights reserved.
 #
 # This file is part of LVM2.
 #
@@ -17,7 +17,7 @@ top_srcdir = @top_srcdir@
 VPATH = @srcdir@

 INCLUDES += -I${top_srcdir}/tools
-CLDFLAGS += -L${top_srcdir}/tools -ldevmapper -llvm2cmd
+CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)

 SOURCES = dmeventd_mirror.c

@@ -33,4 +33,3 @@ install: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX)
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
 		$(libdir)/$<.$(LIB_VERSION)
 	$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<
-
diff --git a/dmeventd/snapshot/Makefile.in b/dmeventd/snapshot/Makefile.in
index be03e27..379b87e 100644
--- a/dmeventd/snapshot/Makefile.in
+++ b/dmeventd/snapshot/Makefile.in
@@ -17,7 +17,7 @@ top_srcdir = @top_srcdir@
 VPATH = @srcdir@

 INCLUDES += -I${top_srcdir}/tools
-CLDFLAGS += -L${top_srcdir}/tools -ldevmapper -llvm2cmd
+CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)

 SOURCES = dmeventd_snapshot.c

@@ -33,4 +33,3 @@ install: libdevmapper-event-lvm2snapshot.$(LIB_SUFFIX)
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
 		$(libdir)/$<.$(LIB_VERSION)
 	$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<
-
diff --git a/make.tmpl.in b/make.tmpl.in
index 2f8e9a4..7a2e92e 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -1,7 +1,7 @@
 # @configure_input@
 #
 # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
-# Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2004, 2008 Red Hat, Inc. All rights reserved.
 #
 # This file is part of LVM2.
 #
@@ -151,6 +151,10 @@ $(SUBDIRS.pofile):
 	$(MAKE) -C $(@:.pofile=) pofile
 endif

+ifeq (@CMDLIB@, yes)
+LVM2CMD_LIB=-llvm2cmd
+endif
+
 ifneq ("@CFLOW_CMD@", "")
 cflow: $(SUBDIRS.cflow)

--
1.5.6.7.g67e08b




More information about the linux-lvm mailing list