Richard W.M. Jones
2014-Nov-05 21:37 UTC
[Libguestfs] [PATCH] Use -ltinfo instead of -lncurses.
In tools except guestfish, we don't use ncurses, or even curses, just 2 termcap functions and a global variable. These are provided by libtinfo, so just link to that. In guestfish we use readline which needs ncurses. Leave that alone. --- builder/Makefile.am | 2 +- configure.ac | 12 ++++++------ customize/Makefile.am | 2 +- mllib/Makefile.am | 6 +++--- resize/Makefile.am | 2 +- sparsify/link.sh.in | 2 +- sysprep/Makefile.am | 2 +- v2v/link.sh.in | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/builder/Makefile.am b/builder/Makefile.am index f747fc3..7b66afb 100644 --- a/builder/Makefile.am +++ b/builder/Makefile.am @@ -172,7 +172,7 @@ OCAMLCLIBS = \ -L../src/.libs -lutils \ -L../gnulib/lib/.libs -lgnu \ -pthread -lpthread \ - -lncurses -lcrypt + -ltinfo -lcrypt if HAVE_OCAMLOPT virt-builder: $(OBJECTS) diff --git a/configure.ac b/configure.ac index 3165e96..8916ebd 100644 --- a/configure.ac +++ b/configure.ac @@ -355,14 +355,14 @@ struct sockaddr_un myaddr; dnl tgetent, tputs and UP [sic] are all required. They come from libtinfo dnl which is pulled in as a dependency of libncurses. old_LIBS="$LIBS" -AC_CHECK_LIB([ncurses], [tgetent], [], [ - AC_MSG_ERROR(['ncurses' library not found, or it doesn't contain 'tgetent']) +AC_CHECK_LIB([tinfo], [tgetent], [], [ + AC_MSG_ERROR(['libtinfo' library (usually part of ncurses) not found, or it doesn't contain 'tgetent']) ]) -AC_CHECK_LIB([ncurses], [tputs], [], [ - AC_MSG_ERROR(['ncurses' library not found, or it doesn't contain 'tputs']) +AC_CHECK_LIB([tinfo], [tputs], [], [ + AC_MSG_ERROR(['libtinfo' library (usually part of ncurses) not found, or it doesn't contain 'tputs']) ]) -AC_CHECK_LIB([ncurses], [UP], [], [ - AC_MSG_ERROR(['ncurses' library not found, or it doesn't contain 'UP']) +AC_CHECK_LIB([tinfo], [UP], [], [ + AC_MSG_ERROR(['libtinfo' library (usually part of ncurses) not found, or it doesn't contain 'UP']) ]) LIBS="$old_LIBS" diff --git a/customize/Makefile.am b/customize/Makefile.am index c945685..f9dccd5 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -124,7 +124,7 @@ OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES) OCAMLOPTFLAGS = $(OCAMLCFLAGS) OCAMLCLIBS = \ - $(LIBXML2_LIBS) $(LIBINTL) -lncurses -lcrypt \ + $(LIBXML2_LIBS) $(LIBINTL) -ltinfo -lcrypt \ -L../src/.libs -lutils \ -L../gnulib/lib/.libs -lgnu diff --git a/mllib/Makefile.am b/mllib/Makefile.am index 567ff84..d248a72 100644 --- a/mllib/Makefile.am +++ b/mllib/Makefile.am @@ -99,7 +99,7 @@ OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES) OCAMLOPTFLAGS = $(OCAMLCFLAGS) OCAMLCLIBS = \ - $(LIBXML2_LIBS) $(LIBINTL) -lncurses -lcrypt \ + $(LIBXML2_LIBS) $(LIBINTL) -ltinfo -lcrypt \ -L../src/.libs -lutils \ -L../gnulib/lib/.libs -lgnu @@ -154,11 +154,11 @@ check_SCRIPTS = common_utils_tests if HAVE_OCAMLOPT common_utils_tests: common_gettext.cmx tty-c.o tTY.cmx common_utils.cmx common_utils_tests.cmx $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \ - mlguestfs.cmxa -linkpkg $^ -cclib -lncurses -o $@ + mlguestfs.cmxa -linkpkg $^ -cclib -ltinfo -o $@ else common_utils_tests: common_gettext.cmo tty-c.o tTY.cmo common_utils.cmo common_utils_tests.cmo $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \ - mlguestfs.cma -linkpkg $^ -cclib -lncurses -custom -o $@ + mlguestfs.cma -linkpkg $^ -cclib -ltinfo -custom -o $@ endif TESTS_ENVIRONMENT = $(top_builddir)/run --test diff --git a/resize/Makefile.am b/resize/Makefile.am index 3a7483c..f7aa9b4 100644 --- a/resize/Makefile.am +++ b/resize/Makefile.am @@ -71,7 +71,7 @@ OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES) OCAMLOPTFLAGS = $(OCAMLCFLAGS) OCAMLCLIBS = \ - $(LIBXML2_LIBS) $(LIBINTL) -lncurses \ + $(LIBXML2_LIBS) $(LIBINTL) -ltinfo \ -L../src/.libs -lutils \ -L../gnulib/lib/.libs -lgnu diff --git a/sparsify/link.sh.in b/sparsify/link.sh.in index 50bcc1f..537e967 100644 --- a/sparsify/link.sh.in +++ b/sparsify/link.sh.in @@ -19,4 +19,4 @@ # Hack automake to link binary properly. There is no other way to add # the -cclib parameter to the end of the command line. -exec "$@" -linkpkg -cclib '-lncurses' +exec "$@" -linkpkg -cclib '-ltinfo' diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index 58c63bb..70f677d 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -136,7 +136,7 @@ OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES) OCAMLOPTFLAGS = $(OCAMLCFLAGS) OCAMLCLIBS = \ - $(LIBXML2_LIBS) $(LIBINTL) -lncurses -lcrypt \ + $(LIBXML2_LIBS) $(LIBINTL) -ltinfo -lcrypt \ -L../src/.libs -lutils \ -L../gnulib/lib/.libs -lgnu diff --git a/v2v/link.sh.in b/v2v/link.sh.in index d6313fe..d95a1dc 100644 --- a/v2v/link.sh.in +++ b/v2v/link.sh.in @@ -19,4 +19,4 @@ # Hack automake to link binary properly. There is no other way to add # the -cclib parameter to the end of the command line. -exec "$@" -linkpkg -cclib '-lutils -lncurses -lcrypt @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu' +exec "$@" -linkpkg -cclib '-lutils -ltinfo -lcrypt @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu' -- 2.1.0
Pino Toscano
2014-Nov-06 12:34 UTC
Re: [Libguestfs] [PATCH] Use -ltinfo instead of -lncurses.
On Wednesday 05 November 2014 21:37:14 Richard W.M. Jones wrote:> In tools except guestfish, we don't use ncurses, or even curses, just > 2 termcap functions and a global variable. These are provided by > libtinfo, so just link to that.Sounds good.> In guestfish we use readline which needs ncurses. Leave that alone.Given that three AC_CHECK_LIB checking for ncurses are now gone, wouldn't it better to explicitly search for it prior to searching for readline? -- Pino Toscano
Richard W.M. Jones
2014-Nov-06 14:10 UTC
Re: [Libguestfs] [PATCH] Use -ltinfo instead of -lncurses.
On Thu, Nov 06, 2014 at 01:34:24PM +0100, Pino Toscano wrote:> Given that three AC_CHECK_LIB checking for ncurses are now gone, > wouldn't it better to explicitly search for it prior to searching for > readline?According to https://bugzilla.redhat.com/show_bug.cgi?id=499837 readline can be linked against either ncurses or termcap. No modern system would prefer termcap, and I'll assume any system ancient/strange enough to only provide termcap and not ncurses would not be able to run libguestfs. In Fedora, the readline-devel package requires ncurses-devel, so if our test for readline succeeds, we can assume ncurses-devel is installed and '-lreadline -lncurses' will just work. On Debian/Ubuntu, they've ditched the nonsense of allowing alternate backend implementations, and they link readline to ncurses properly (so on Debian, '-lreadline' on its own works, whereas on Fedora we still need '-lreadline -lncurses' for no useful reason). It would be nice if readline itself shipped with a pkgconfig file, or even any useful documentation on linking. It does neither. So .. I think I'll leave this alone. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW