[libvirt] [PATCH] configure: adds an option for not using the readline library

So we can use "--with-readline=no" for situations where that helpful. ie. MacOS X 10.5. By default, we use "--with-readline=check". --- configure.ac | 47 ++++++++++++++++++++++++++++------------------- 1 files changed, 28 insertions(+), 19 deletions(-) diff --git a/configure.ac b/configure.ac index e41f2b5..2831db0 100644 --- a/configure.ac +++ b/configure.ac @@ -240,6 +240,10 @@ AC_ARG_WITH([remote], AC_ARG_WITH([libvirtd], AC_HELP_STRING([--with-libvirtd], [add libvirtd support @<:@default=yes@:>@]),[],[with_libvirtd=yes]) +dnl Add a --help string for the readline usage option +AC_ARG_WITH([readline], + AC_HELP_STRING([--with-readline], [add readline support @<:@default=check@:>@]),[],[with_readline=check]) + dnl dnl in case someone want to build static binaries dnl STATIC_BINARIES="-static" @@ -1338,26 +1342,29 @@ AM_CONDITIONAL([HAVE_CAPNG], [test "$with_capng" != "no"]) AC_SUBST([CAPNG_CFLAGS]) AC_SUBST([CAPNG_LIBS]) +dnl If we've been instructed to not use readline, then don't even check for it +if test "$with_readline" = "no"; then + lv_use_readline="no" +fi +if test "$with_readline" != "no"; then + dnl virsh libraries + AC_CHECK_HEADERS([readline/readline.h]) - -dnl virsh libraries -AC_CHECK_HEADERS([readline/readline.h]) - -# Check for readline. -AC_CHECK_LIB([readline], [readline], + # Check for readline. + AC_CHECK_LIB([readline], [readline], [lv_use_readline=yes; VIRSH_LIBS="$VIRSH_LIBS -lreadline"], [lv_use_readline=no]) -# If the above test failed, it may simply be that -lreadline requires -# some termcap-related code, e.g., from one of the following libraries. -# See if adding one of them to LIBS helps. -if test $lv_use_readline = no; then - lv_saved_libs=$LIBS - LIBS= - AC_SEARCH_LIBS([tgetent], [ncurses curses termcap termlib]) - case $LIBS in - no*) ;; # handle "no" and "none required" - *) # anything else is a -lLIBRARY + # If the above test failed, it may simply be that -lreadline requires + # some termcap-related code, e.g., from one of the following libraries. + # See if adding one of them to LIBS helps. + if test $lv_use_readline = no; then + lv_saved_libs=$LIBS + LIBS= + AC_SEARCH_LIBS([tgetent], [ncurses curses termcap termlib]) + case $LIBS in + no*) ;; # handle "no" and "none required" + *) # anything else is a -lLIBRARY # Now, check for -lreadline again, also using $LIBS. # Note: this time we use a different function, so that # we don't get a cached "no" result. @@ -1366,12 +1373,14 @@ if test $lv_use_readline = no; then VIRSH_LIBS="$VIRSH_LIBS -lreadline $LIBS"],, [$LIBS]) ;; - esac - test $lv_use_readline = no && + esac + test $lv_use_readline = no && AC_MSG_WARN([readline library not found]) - LIBS=$lv_saved_libs + LIBS=$lv_saved_libs + fi fi +dnl We now adjust things to suit the result of our checks for readline if test $lv_use_readline = yes; then AC_DEFINE_UNQUOTED([USE_READLINE], 1, [whether virsh can use readline]) -- 1.7.2.3

On 10/23/2010 09:58 AM, Justin Clift wrote:
So we can use "--with-readline=no" for situations where that helpful. ie. MacOS X 10.5.
By default, we use "--with-readline=check".
Not sure if we need this patch. There's nothing wrong with it (that I know of), but the OSX version that needed it, turns out not too. We were able to link in a newer version of the proper readline libraries instead. ?

Hi Justin, On Sun, Oct 24, 2010 at 23:48, Justin Clift <jclift@redhat.com> wrote:
On 10/23/2010 09:58 AM, Justin Clift wrote:
So we can use "--with-readline=no" for situations where that helpful. ie. MacOS X 10.5.
By default, we use "--with-readline=check".
Not sure if we need this patch. There's nothing wrong with it (that I know of), but the OSX version that needed it, turns out not too. We were able to link in a newer version of the proper readline libraries instead.
?
I think this patch is still useful for users not using homebrew. I'm trying to do a (debug) build of libvirt from a tarball outside of homebrew. In this case the (keg only) readline isn't picked up. Even better would be an option to specify the headers/library location. What do you think? Ruben

On 10/25/2010 10:58 AM, Ruben Kerkhof wrote: <snip>
I think this patch is still useful for users not using homebrew. I'm trying to do a (debug) build of libvirt from a tarball outside of homebrew. In this case the (keg only) readline isn't picked up.
Even better would be an option to specify the headers/library location.
What do you think?
Ahhh, you mean like an override, which explicitly sets where libvirt will check for the readline headers and matching libraries? That makes sense, yeah. :) If you're interested in hacking on that yourself, you can crack open the configure.ac file, and look at the other bits of code in there. That's how I do most of the stuff in there, by copying other bits of code and then applying logic+copious testing. :) Eric Blake (and others) are pretty good at this stuff, so they often have suggested on how to do things better too. Your kind of thing, or are you wanting me to have a go at it? :) (I'll happily leave it for you if you want) Regards and best wishes, Justin Clift

On Mon, Oct 25, 2010 at 07:00, Justin Clift <jclift@redhat.com> wrote:
On 10/25/2010 10:58 AM, Ruben Kerkhof wrote: <snip>
I think this patch is still useful for users not using homebrew. I'm trying to do a (debug) build of libvirt from a tarball outside of homebrew. In this case the (keg only) readline isn't picked up.
Even better would be an option to specify the headers/library location.
What do you think?
Ahhh, you mean like an override, which explicitly sets where libvirt will check for the readline headers and matching libraries?
That makes sense, yeah. :)
I got there in the end with ./configure CPPFLAGS='-I/usr/local/Cellar/libxml2/2.7.7/include -I/usr/local/Cellar/readline/6.1/include' LDFLAGS='-L/usr/local/Cellar/libxml2/2.7.7/lib -L/usr/local/Cellar/readline/6.1/lib' So I don't think the patch is really needed. What would be good though is a AC_CHECK_LIB(readline, rl_completion_matches This would work with readline 4.2 and higher, and fail on Leopard since the readline shim libedit provides doesn't do completion.
If you're interested in hacking on that yourself, you can crack open the configure.ac file, and look at the other bits of code in there.
That's how I do most of the stuff in there, by copying other bits of code and then applying logic+copious testing. :)
Eric Blake (and others) are pretty good at this stuff, so they often have suggested on how to do things better too.
Your kind of thing, or are you wanting me to have a go at it? :)
As soon as I can do a proper bootstrap from git...
(I'll happily leave it for you if you want)
Regards and best wishes,
Justin Clift
Thanks! Ruben
participants (2)
-
Justin Clift
-
Ruben Kerkhof