Hi there,
On some systems, the ncurses library is split in two libraries: ncurses and tinfo. This makes moc fail to build since some of the symbols it thinks are in libncurses are in fact in libtinfo (e.g., cbreak).
This patch adds detection in m4/mp_with_curses.m4
for the missing cbreak symbol and tries to add -ltinfo to the required libraries if it is indeed missing.
Note that the code appropriately adds -ltinfo or -ltinfow depending on the selected ncurses library. I do not know whether the curses library is affected so I left it untouched.
Please review!
Thanks,
LaomaiWeng
diff -u a/configure.in b/configure.in
--- a/configure.in
+++ b/configure.in 2015-11-20 09:38:51
@@ -349,7 +349,7 @@
AC_DEFINE([HAVE_SET_ESCDELAY], 1, [Define if you have set_escdelay.]),
[AC_CHECK_FUNC([setenv], ,
AC_MSG_ERROR([Required function setenv not found.]))])
+ EXTRA_LIBS="$EXTRA_LIBS -l$CURSES_LIB $TINFO_LIBS"
- EXTRA_LIBS="$EXTRA_LIBS -l$CURSES_LIB"
fi
dnl popt
diff -u a/m4/mp_with_curses.m4 b/m4/mp_with_curses.m4
--- a/m4/mp_with_curses.m4
+++ b/m4/mp_with_curses.m4 2015-11-20 09:38:24
@@ -24,6 +24,7 @@
[Don't use ncursesw (UTF-8 support)])],,)
CURSES_LIB=""
+ TINFO_LIBS=""
if test "$with_ncursesw" != "no"
then
@@ -40,6 +41,11 @@
AC_DEFINE(HAVE_NCURSES_H, 1, [Define if you have ncursesw/curses.h])
AC_DEFINE(HAVE_NCURSESW, 1, [Define if you have libncursesw])
CURSES_LIB="ncursesw"
+ AC_CHECK_FUNC([cbreak],
+ [],
+ [AC_CHECK_LIB([tinfow], [cbreak],
+ [TINFO_LIBS="-ltinfow"],
+ [AC_MSG_ERROR([Required function cbreak not found.])])])
fi
fi
@@ -69,7 +75,13 @@
then
AC_DEFINE(HAVE_NCURSES_H, 1, [Define if you have ncurses.h])
CURSES_LIB="ncurses"
+ AC_CHECK_FUNC([cbreak],
+ [],
+ [AC_CHECK_LIB([tinfo], [cbreak],
+ [TINFO_LIBS="-ltinfo"],
+ [AC_MSG_ERROR([Required function cbreak not found.])])])
fi
fi
+
LIBS="$mp_save_LIBS"
])dnl