diff --git a/config/Tools.mk.in b/config/Tools.mk.in index d67352e56d..aef9ed6657 100644 --- a/config/Tools.mk.in +++ b/config/Tools.mk.in @@ -77,5 +77,6 @@ CONFIG_LIBICONV := @libiconv@ CONFIG_GCRYPT := @libgcrypt@ EXTFS_LIBS := @EXTFS_LIBS@ CURSES_LIBS := @CURSES_LIBS@ +TINFO_LIBS := @TINFO_LIBS@ FILE_OFFSET_BITS := @FILE_OFFSET_BITS@ diff --git a/tools/configure b/tools/configure index 4c2928dc7b..896d8928f1 100755 --- a/tools/configure +++ b/tools/configure @@ -651,6 +651,7 @@ glib_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG +TINFO_LIBS CURSES_LIBS PY_NOOPT_CFLAGS EGREP @@ -7678,6 +7679,51 @@ $as_echo "#define INCLUDE_CURSES_H " >>confdefs.h fi +if test "$ncurses" = "y"; then : + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for define_key in -ltinfo" >&5 +$as_echo_n "checking for define_key in -ltinfo... " >&6; } +if ${ac_cv_lib_tinfo_define_key+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ltinfo $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char define_key (); +int +main () +{ +return define_key (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_tinfo_define_key=yes +else + ac_cv_lib_tinfo_define_key=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_define_key" >&5 +$as_echo "$ac_cv_lib_tinfo_define_key" >&6; } +if test "x$ac_cv_lib_tinfo_define_key" = xyes; then : + TINFO_LIBS=-ltinfo +fi + + +fi + diff --git a/tools/configure.ac b/tools/configure.ac index 9bf6450a64..1a06ddf98d 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -318,6 +318,10 @@ i[[3456]]86|x86_64) esac AX_CHECK_UUID AX_CHECK_CURSES +AS_IF([test "$ncurses" = "y"], [ +AC_CHECK_LIB([tinfo], [define_key], [TINFO_LIBS=-ltinfo]) +]) +AC_SUBST(TINFO_LIBS) dnl The following are only required when upstream QEMU is built AS_IF([test "x$qemu_xen" = "xy"], [ diff --git a/tools/misc/Makefile b/tools/misc/Makefile index 3817317c95..82c361f285 100644 --- a/tools/misc/Makefile +++ b/tools/misc/Makefile @@ -100,7 +100,7 @@ xen-lowmemd: xen-lowmemd.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS) gtraceview: gtraceview.o - $(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS) $(APPEND_LDFLAGS) + $(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS) $(TINFO_LIBS) $(APPEND_LDFLAGS) xencov: xencov.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) diff --git a/tools/xenstat/xentop/Makefile b/tools/xenstat/xentop/Makefile index 2652c9dac5..97950b970b 100644 --- a/tools/xenstat/xentop/Makefile +++ b/tools/xenstat/xentop/Makefile @@ -19,7 +19,7 @@ all install xentop: else CFLAGS += -DGCC_PRINTF -Werror $(CFLAGS_libxenstat) -LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(SOCKET_LIBS) -lm -lyajl +LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(TINFO_LIBS) $(SOCKET_LIBS) -lm -lyajl CFLAGS += -DHOST_$(XEN_OS) # Include configure output (config.h) to headers search path