[linux-lvm] FYI: fix configure bug wrt readline

Jim Meyering jim at meyering.net
Thu Jul 24 15:08:46 UTC 2008


I've just committed this, along with a separate change
containing just the regenerated configure.

It's easy to reproduce without removing libreadline.
This fails before the patch, and succeeds after:
   ac_cv_lib_readline_readline=no ./configure -C \
       --with-dmdir=$PWD/../device-mapper

As for testing, I've configure with each of these,

    --enable-readline
    --disable-readline

both with the library available and
with it (simulated) absent, and all work properly.

Jim

>From fcd60fbbef2252b11132c20704511539ab7ad131 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Tue, 22 Jul 2008 17:35:21 +0200
Subject: [PATCH] Don't make configure fail when readline library is not available.

---
 WHATS_NEW    |    1 +
 configure.in |   31 +++++++++++++++++--------------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/WHATS_NEW b/WHATS_NEW
index 210ff97..0afc0b0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.40 - 
 ================================
+  configure no longer fails when the readline library is not available
   Remove dead code, is_lvm_partition() - no functional change.
   Refactor pvcreate to divide parameter parsing & validation from create logic.
   Check for label_write() failure in _text_pv_write().
diff --git a/configure.in b/configure.in
index b4e23fd..7936383 100644
--- a/configure.in
+++ b/configure.in
@@ -273,7 +273,7 @@ dnl -- Disable readline
 AC_MSG_CHECKING(whether to enable readline)
 AC_ARG_ENABLE([readline],
   [  --disable-readline      Disable readline support],
-  [READLINE=$enableval], [READLINE=yes])
+  [READLINE=$enableval], [READLINE=maybe])
 AC_MSG_RESULT($READLINE)

 ################################################################################
@@ -410,9 +410,11 @@ fi;

 ################################################################################
 dnl -- Check for termcap (Shamelessly copied from parted 1.4.17)
-if test x$READLINE = xyes; then
-	AC_SEARCH_LIBS(tgetent, ncurses curses termcap termlib, ,
-		AC_MSG_ERROR(
+if test x$READLINE != xno; then
+	AC_SEARCH_LIBS([tgetent], [ncurses curses termcap termlib],
+	  [tg_found=yes], [tg_found=no])
+	test x$READLINE:$tg_found = xyes:no &&
+	  AC_MSG_ERROR(
 termcap could not be found which is required for the
 --enable-readline option (which is enabled by default).  Either disable readline
 support with --disable-readline or download and install termcap from:
@@ -422,7 +424,6 @@ Note: if you are using precompiled packages you will also need the development
 Note: (n)curses also seems to work as a substitute for termcap.  This was
   not found either - but you could try installing that as well.
 )
-	)
 fi

 ################################################################################
@@ -514,9 +515,10 @@ AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getop

 ################################################################################
 dnl -- Check for readline (Shamelessly copied from parted 1.4.17)
-if test x$READLINE = xyes; then
-	AC_CHECK_LIB(readline, readline, ,
-		AC_MSG_ERROR(
+if test x$READLINE != xno; then
+	AC_CHECK_LIB([readline], [readline], [rl_found=yes], [rl_found=no])
+	test x$READLINE:$rl_found = xyes:no &&
+	  AC_MSG_ERROR(
 GNU Readline could not be found which is required for the
 --enable-readline option (which is enabled by default).  Either disable readline
 support with --disable-readline or download and install readline from:
@@ -524,12 +526,13 @@ support with --disable-readline or download and install readline from:
 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_DEFINE([READLINE_SUPPORT], 1,
-	  [Define to 1 to include the LVM readline shell.])
+	if test $rl_found = yes; then
+		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
 fi

 ################################################################################
-- 
1.6.0.rc0.46.g2ac23




More information about the linux-lvm mailing list