From 8736e490253e08ed36ddeed8d572a39a450a88b4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 6 Oct 2008 16:03:24 +0200 Subject: [PATCH] include ncursesw/ncurses.h if available When compiling with libncursesw, include instead of (if available). --- configure.ac | 5 +++++ src/colors.h | 4 ++++ src/command.h | 1 - src/list_window.h | 7 ++++++- src/ncu.c | 4 ++++ src/screen.h | 7 ++++++- src/screen_artist.c | 1 - src/screen_file.c | 1 - src/screen_help.c | 1 - src/screen_keydef.c | 1 - src/screen_list.h | 4 ++++ src/screen_lyrics.c | 1 - src/screen_play.c | 1 - src/screen_utils.h | 5 +++++ src/wreadln.h | 7 +++++++ 15 files changed, 41 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 4aa392e..51faeee 100644 --- a/configure.ac +++ b/configure.ac @@ -83,6 +83,11 @@ AC_CHECK_LIB([$ncurses], [LIBS="$LIBS -l$ncurses"], [AC_MSG_ERROR($ncurses library is required)]) +if test "x$ncurses" = "xncursesw"; then + AC_CHECK_HEADER([ncursesw/ncurses.h], + AC_DEFINE([HAVE_NCURSESW_NCURSES_H], [1], [ncursesw/ncurses.h]), + ,) +fi dnl Check for glib-2.4 diff --git a/src/colors.h b/src/colors.h index 051aa9e..dec3ecd 100644 --- a/src/colors.h +++ b/src/colors.h @@ -3,7 +3,11 @@ #include "config.h" +#ifdef HAVE_NCURSESW_NCURSES_H +#include +#else #include +#endif enum color { COLOR_TITLE = 1, diff --git a/src/command.h b/src/command.h index 63d83b0..b48bf80 100644 --- a/src/command.h +++ b/src/command.h @@ -3,7 +3,6 @@ #include #include -#include #define MAX_COMMAND_KEYS 3 diff --git a/src/list_window.h b/src/list_window.h index 1d93a36..11c4cdd 100644 --- a/src/list_window.h +++ b/src/list_window.h @@ -4,9 +4,14 @@ #include "../config.h" #include "command.h" -#include #include +#ifdef HAVE_NCURSESW_NCURSES_H +#include +#else +#include +#endif + #define LW_HIDE_CURSOR 0x01 typedef const char *(*list_window_callback_fn_t)(unsigned index, diff --git a/src/ncu.c b/src/ncu.c index 1ade90b..c31f97d 100644 --- a/src/ncu.c +++ b/src/ncu.c @@ -26,7 +26,11 @@ #include "options.h" #endif +#ifdef HAVE_NCURSESW_NCURSES_H +#include +#else #include +#endif void ncu_init(void) diff --git a/src/screen.h b/src/screen.h index ef7940a..404d0a8 100644 --- a/src/screen.h +++ b/src/screen.h @@ -5,9 +5,14 @@ #include "mpdclient.h" #include "command.h" -#include #include +#ifdef HAVE_NCURSESW_NCURSES_H +#include +#else +#include +#endif + #define IS_PLAYING(s) (s==MPD_STATUS_STATE_PLAY) #define IS_PAUSED(s) (s==MPD_STATUS_STATE_PAUSE) #define IS_STOPPED(s) (!(IS_PLAYING(s) | IS_PAUSED(s))) diff --git a/src/screen_artist.c b/src/screen_artist.c index 846902e..5fec3c0 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -32,7 +32,6 @@ #include #include #include -#include #define BUFSIZE 1024 diff --git a/src/screen_file.c b/src/screen_file.c index bef155f..b14b3b1 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -32,7 +32,6 @@ #include #include #include -#include static struct screen_browser browser; diff --git a/src/screen_help.c b/src/screen_help.c index 3b66403..1f0043c 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -27,7 +27,6 @@ #include #include #include -#include typedef struct { signed char highlight; diff --git a/src/screen_keydef.c b/src/screen_keydef.c index 86faaba..4e42b38 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -29,7 +29,6 @@ #include #include #include -#include #define STATIC_ITEMS 0 #define STATIC_SUB_ITEMS 1 diff --git a/src/screen_list.h b/src/screen_list.h index 27c0346..e208a8b 100644 --- a/src/screen_list.h +++ b/src/screen_list.h @@ -22,7 +22,11 @@ #include "config.h" +#ifdef HAVE_NCURSESW_NCURSES_H +#include +#else #include +#endif extern const struct screen_functions screen_playlist; extern const struct screen_functions screen_browse; diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 2a8e10b..6d9c6e4 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include diff --git a/src/screen_play.c b/src/screen_play.c index 37705c5..90b06aa 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -36,7 +36,6 @@ #include #include #include -#include #define MAX_SONG_LENGTH 512 diff --git a/src/screen_utils.h b/src/screen_utils.h index a550f17..335face 100644 --- a/src/screen_utils.h +++ b/src/screen_utils.h @@ -1,10 +1,15 @@ #ifndef SCREEN_UTILS_H #define SCREEN_UTILS_H +#include "config.h" #include "list_window.h" #include "command.h" +#ifdef HAVE_NCURSESW_NCURSES_H +#include +#else #include +#endif struct mpdclient; diff --git a/src/wreadln.h b/src/wreadln.h index e1efe1c..e1ac673 100644 --- a/src/wreadln.h +++ b/src/wreadln.h @@ -1,8 +1,15 @@ #ifndef WREADLN_H #define WREADLN_H +#include "config.h" + #include + +#ifdef HAVE_NCURSESW_NCURSES_H +#include +#else #include +#endif /* completion callback data */ extern void *wrln_completion_callback_data; -- 2.30.2