]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
* configure.in src/Makefile.am src/virsh.c: fix compilation problems
authorDaniel Veillard <veillard@redhat.com>
Thu, 6 Dec 2007 10:24:52 +0000 (10:24 +0000)
committerDaniel Veillard <veillard@redhat.com>
Thu, 6 Dec 2007 10:24:52 +0000 (10:24 +0000)
  when readline headers were found but not the library
Daniel

ChangeLog
configure.in
src/Makefile.am
src/virsh.c

index 302706c2bcfcb8704bdb7a19e391baa9b85aa6fa..1a100b1140445a348cae526057cbbfebdc3f6be6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Dec  6 11:23:31 CET 2007 Daniel Veillard <veillard@redhat.com>
+
+       * configure.in src/Makefile.am src/virsh.c: fix compilation problems
+         when readline headers were found but not the library
+
 Wed Dec  5 23:57:53 CET 2007 Jim Meyering <meyering@redhat.com>
 
        Accommodate developers using autoconf-2.59.
index 8d2a14367badefbc3bf555cda283a1c414b40dc3..74028d80d0a95c588c90d2eaeacdd1837e178931 100644 (file)
@@ -448,11 +448,21 @@ AC_SUBST(AVAHI_CFLAGS)
 AC_SUBST(AVAHI_LIBS)
 
 dnl virsh libraries
+USE_READLINE=
+READLINE_CFLAGS=
 AC_CHECK_HEADERS([readline/readline.h])
 AC_CHECK_LIB(readline, main,
-       [VIRSH_LIBS="$VIRSH_LIBS -lreadline"],
-       [AC_MSG_WARN([readline library not found])],
+       [USE_READLINE=yes],
+       [USE_READLINE=no],
        [$VIRSH_LIBS])
+if test "$USE_READLINE" = "yes" ; then
+    VIRSH_LIBS="$VIRSH_LIBS -lreadline"
+    AC_DEFINE_UNQUOTED(USE_READLINE, 1, [whether virsh use readline])
+    READLINE_CFLAGS="-DUSE_READLINE"
+else
+    AC_MSG_WARN([readline library not found])
+fi
+AC_SUBST(READLINE_CFLAGS)
 AC_SUBST(VIRSH_LIBS)
 
 # end of if with_depends
@@ -687,4 +697,5 @@ AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Miscellaneous])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([  Debug: $enable_debug])
+AC_MSG_NOTICE([  Readline: $USE_READLINE])
 AC_MSG_NOTICE([])
index a14b9b6eac63e5c3ee9d16ece872b1b09665df8b..1979a194315e1f4f5ad1a186708e0c420991b0b1 100644 (file)
@@ -76,7 +76,7 @@ virsh_SOURCES = virsh.c console.c console.h
 virsh_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDFLAGS)
 virsh_DEPENDENCIES = $(DEPS)
 virsh_LDADD = $(LDADDS) $(VIRSH_LIBS)
-virsh_CFLAGS = $(COVERAGE_CFLAGS)
+virsh_CFLAGS = $(COVERAGE_CFLAGS) $(READLINE_CFLAGS)
 
 #
 # target to ease building test programs
index d67ba7c068efdb55f1fc2a8ee2bfd7921fcb1540..3486d463b610a901040bfac30c5ccf95a84f2d51 100644 (file)
@@ -4661,7 +4661,7 @@ vshCloseLogFile(vshControl *ctl)
     }
 }
 
-#ifdef HAVE_READLINE_READLINE_H
+#ifdef USE_READLINE
 
 /* -----------------
  * Readline stuff
@@ -4786,7 +4786,7 @@ vshReadline (vshControl *ctl ATTRIBUTE_UNUSED, const char *prompt)
     return readline (prompt);
 }
 
-#else /* !HAVE_READLINE_READLINE_H */
+#else /* !USE_READLINE */
 
 static void
 vshReadlineInit (void)
@@ -4813,7 +4813,7 @@ vshReadline (vshControl *ctl, const char *prompt)
     return vshStrdup (ctl, r);
 }
 
-#endif /* !HAVE_READLINE_READLINE_H */
+#endif /* !USE_READLINE */
 
 /*
  * Deinitliaze virsh
@@ -5059,7 +5059,7 @@ main(int argc, char **argv)
             if (ctl->cmdstr == NULL)
                 break;          /* EOF */
             if (*ctl->cmdstr) {
-#if HAVE_READLINE_READLINE_H
+#if USE_READLINE
                 add_history(ctl->cmdstr);
 #endif
                 if (vshCommandParse(ctl, ctl->cmdstr))