Require ncursesw

This commit is contained in:
Andrzej Rybczak
2016-12-16 07:11:51 +01:00
parent 30830e338a
commit 5c62072713
4 changed files with 37 additions and 42 deletions

1
NEWS
View File

@@ -13,6 +13,7 @@ ncmpcpp-0.8 (????-??-??)
* Support for fetching lyrics for selected items in background was added. * Support for fetching lyrics for selected items in background was added.
* Application will now exit if stdin is closed. * Application will now exit if stdin is closed.
* Configuration variable 'visualizer_sample_multiplier' was deprecated and will be removed in 0.9. * Configuration variable 'visualizer_sample_multiplier' was deprecated and will be removed in 0.9.
* Wide character version of ncurses is now required.
ncmpcpp-0.7.7 (2016-10-31) ncmpcpp-0.7.7 (2016-10-31)
* Fixed compilation on 32bit platforms. * Fixed compilation on 32bit platforms.

View File

@@ -13,7 +13,6 @@ AM_PROG_LIBTOOL
AC_ARG_ENABLE(outputs, AS_HELP_STRING([--enable-outputs], [Enable outputs screen @<:@default=no@:>@]), [outputs=$enableval], [outputs=no]) AC_ARG_ENABLE(outputs, AS_HELP_STRING([--enable-outputs], [Enable outputs screen @<:@default=no@:>@]), [outputs=$enableval], [outputs=no])
AC_ARG_ENABLE(visualizer, AS_HELP_STRING([--enable-visualizer], [Enable music visualizer screen @<:@default=no@:>@]), [visualizer=$enableval], [visualizer=no]) AC_ARG_ENABLE(visualizer, AS_HELP_STRING([--enable-visualizer], [Enable music visualizer screen @<:@default=no@:>@]), [visualizer=$enableval], [visualizer=no])
AC_ARG_ENABLE(clock, AS_HELP_STRING([--enable-clock], [Enable clock screen @<:@default=no@:>@]), [clock=$enableval], [clock=no]) AC_ARG_ENABLE(clock, AS_HELP_STRING([--enable-clock], [Enable clock screen @<:@default=no@:>@]), [clock=$enableval], [clock=no])
AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode], [Enable utf8 support @<:@default=yes@:>@]), [unicode=$enableval], [unicode=yes])
AC_ARG_WITH(fftw, AS_HELP_STRING([--with-fftw], [Enable fftw support (required for frequency spectrum vizualization) @<:@default=auto@:>@]), [fftw=$withval], [fftw=auto]) AC_ARG_WITH(fftw, AS_HELP_STRING([--with-fftw], [Enable fftw support (required for frequency spectrum vizualization) @<:@default=auto@:>@]), [fftw=$withval], [fftw=auto])
AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto]) AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto])
@@ -184,34 +183,30 @@ AC_CHECK_LIB(pthread, pthread_create, LIBS="$LIBS -lpthread",
AC_MSG_ERROR([pthread library is required]) AC_MSG_ERROR([pthread library is required])
) )
dnl ======================== dnl =========================
dnl = checking for ncurses = dnl = checking for ncursesw =
dnl ======================== dnl =========================
if test "$unicode" = "yes" ; then AH_TEMPLATE([NCURSES_WADDWSTR], [ncursesw has waddwstr function])
curses_config_bin="ncursesw6-config ncursesw5-config" AH_TEMPLATE([NCURSES_WADDNWSTR], [ncursesw has waddnwstr function])
AC_DEFINE([NCMPCPP_UNICODE], [1], [enables unicode support]) PKG_CHECK_MODULES([ncursesw], [ncursesw], [
else AC_SUBST(ncursesw_CFLAGS)
curses_config_bin="ncurses6-config ncurses5-config" AC_SUBST(ncursesw_LIBS)
fi CPPFLAGS="$CPPFLAGS $ncursesw_CFLAGS"
AC_CHECK_HEADERS([curses.h],
AC_PATH_PROGS(CURSES_CONFIG, $curses_config_bin) LIBS="$LIBS $ncursesw_LIBS"
if test "$CURSES_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`"
LIBS="$LIBS `$CURSES_CONFIG --libs`"
fi
AC_CHECK_LIB(ncursesw, initscr,
curses_lib=ncursesw,
curses_lib=ncurses
)
AC_CHECK_LIB($curses_lib, initscr,
if test "$CURSES_CONFIG" = "" ; then
LIBS="$LIBS -l$curses_lib"
fi
, ,
AC_MSG_ERROR([$curses_lib library is required]) AC_MSG_ERROR([missing curses.h header])
) )
AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing curses.h header])) AC_CHECK_LIB(ncursesw, initscr, , AC_MSG_ERROR([ncursesw doesn't provide initscr]))
AC_CHECK_LIB(ncursesw, waddwstr,
AC_DEFINE([NCURSES_WADDWSTR], [1], []),
AC_DEFINE([NCURSES_WADDWSTR], [0], []))
AC_CHECK_LIB(ncursesw, waddnwstr,
AC_DEFINE([NCURSES_WADDNWSTR], [1], []),
AC_DEFINE([NCURSES_WADDNWSTR], [0], []))
],
AC_MSG_ERROR([ncursesw is required!])
)
dnl ====================== dnl ======================
dnl = checking for fftw3 = dnl = checking for fftw3 =

View File

@@ -128,9 +128,6 @@ bool configure(int argc, char **argv)
<< " ncurses" << " ncurses"
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
<< " taglib" << " taglib"
# endif
# ifdef NCMPCPP_UNICODE
<< " unicode"
# endif # endif
<< "\n"; << "\n";
return false; return false;

View File

@@ -1335,29 +1335,31 @@ Window &Window::operator<<(const char *s)
Window &Window::operator<<(char c) Window &Window::operator<<(char c)
{ {
// the following causes problems: https://github.com/arybczak/ncmpcpp/issues/21 // Might cause problem similar to
// waddnstr(m_window, &c, 1); // https://github.com/arybczak/ncmpcpp/issues/21, enable for testing as the
wprintw(m_window, "%c", c); // code in the ticket supposed to be culprit was rewritten.
waddnstr(m_window, &c, 1);
//wprintw(m_window, "%c", c);
return *this; return *this;
} }
Window &Window::operator<<(const wchar_t *ws) Window &Window::operator<<(const wchar_t *ws)
{ {
# ifdef NCMPCPP_UNICODE #if NCURSES_WADDWSTR
waddwstr(m_window, ws); waddwstr(m_window, ws);
# else #else
wprintw(m_window, "%ls", ws); wprintw(m_window, "%ls", ws);
# endif // NCMPCPP_UNICODE #endif // NCURSES_WADDWSTR
return *this; return *this;
} }
Window &Window::operator<<(wchar_t wc) Window &Window::operator<<(wchar_t wc)
{ {
# ifdef NCMPCPP_UNICODE #if NCURSES_WADDNWSTR
waddnwstr(m_window, &wc, 1); waddnwstr(m_window, &wc, 1);
# else #else
wprintw(m_window, "%lc", wc); wprintw(m_window, "%lc", wc);
# endif // NCMPCPP_UNICODE #endif // NCURSES_WADDNWSTR
return *this; return *this;
} }
@@ -1381,11 +1383,11 @@ Window &Window::operator<<(const std::string &s)
Window &Window::operator<<(const std::wstring &ws) Window &Window::operator<<(const std::wstring &ws)
{ {
# ifdef NCMPCPP_UNICODE #if NCURSES_WADDNWSTR
waddnwstr(m_window, ws.c_str(), ws.length()); waddnwstr(m_window, ws.c_str(), ws.length());
# else #else
wprintw(m_window, "%lc", ws.c_str()); wprintw(m_window, "%lc", ws.c_str());
# endif // NCMPCPP_UNICODE #endif // NCURSES_WADDNWSTR
return *this; return *this;
} }