From: Karel Zak Date: Wed, 31 May 2017 09:01:46 +0000 (+0200) Subject: build-sys: ncurses headers cleanup X-Git-Tag: v2.30~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3947ca4ca9737d830f54658ef353f5626c0d0282;p=thirdparty%2Futil-linux.git build-sys: ncurses headers cleanup * assume ncursesw headers in ncursesw/ directory only * prefer long paths, and should be last possibility * fix typos Signed-off-by: Karel Zak --- diff --git a/configure.ac b/configure.ac index 8bb7fb71e0..217d5dc5bb 100644 --- a/configure.ac +++ b/configure.ac @@ -803,9 +803,8 @@ have_ncursesw_header=no AS_IF([test "x$with_ncursesw" != xno], [ UL_NCURSES_CHECK([ncursesw]) AS_IF([test "x$have_ncursesw" = xyes], [ - AC_CHECK_HEADERS([ncursesw/ncurses.h ncurses.h], - [have_ncursesw_header=yes]) - AC_CHECK_HEADERS([ncursesw/term.h term.h]) + AC_CHECK_HEADERS([ncursesw/ncurses.h], [have_ncursesw_header=yes]) + AC_CHECK_HEADERS([ncursesw/term.h]) AS_IF([test "x$have_ncursesw_header" = xno], [have_ncursesw=no]) ]) AS_IF([test "x$have_ncursesw" = xyes], [ @@ -830,8 +829,7 @@ AS_CASE([$with_ncurses:$build_widechar], AS_IF([test "x$have_ncursesw" = xno -a "x$with_ncurses" != xno ], [ UL_NCURSES_CHECK([ncurses]) AS_IF([test "x$have_ncurses" = xyes], [ - AC_CHECK_HEADERS([ncurses/ncurses.h ncurses.h], - [have_ncurses_header=yes]) + AC_CHECK_HEADERS([ncurses/ncurses.h ncurses.h], [have_ncurses_header=yes]) AC_CHECK_HEADERS([ncurses/term.h term.h]) AS_IF([test "x$have_ncurses_header" = xno], [have_ncurses=no]) ]) diff --git a/lib/colors.c b/lib/colors.c index 72c5158cb3..f82496d7a1 100644 --- a/lib/colors.c +++ b/lib/colors.c @@ -12,12 +12,19 @@ #include #if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBNCURSESW) -# ifdef HAVE_TERM_H -# include +# if defined(HAVE_NCURSESW_NCURSES_H) +# include +# elif defined(HAVE_NCURSES_NCURSES_H) +# include +# elif defined(HAVE_NCURSES_H) +# include +# endif +# if defined(HAVE_NCURSESW_TERM_H) +# include # elif defined(HAVE_NCURSES_TERM_H) # include -# elif defined(HAVE_NCURSESW_TERM_H) -# include +# elif defined(HAVE_TERM_H) +# include # endif #endif diff --git a/misc-utils/cal.c b/misc-utils/cal.c index 2b16979db4..604eb26a76 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -80,12 +80,12 @@ static int has_term = 0; static const char *Senter = "", *Sexit = ""; /* enter and exit standout mode */ #if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBNCURSESW) -# ifdef HAVE_TERM_H -# include +# if defined(HAVE_NCURSESW_TERM_H) +# include # elif defined(HAVE_NCURSES_TERM_H) # include -# elif defined(HAVE_NCURSESW_TERM_H) -# include +# elif defined(HAVE_TERM_H) +# include # endif #endif diff --git a/term-utils/setterm.c b/term-utils/setterm.c index 53826f9540..9f60e56934 100644 --- a/term-utils/setterm.c +++ b/term-utils/setterm.c @@ -60,12 +60,12 @@ #include #include -#ifdef HAVE_TERM_H -# include +#if defined(HAVE_NCURSESW_TERM_H) +# include #elif defined(HAVE_NCURSES_TERM_H) # include -#elif defined(HAVE_NCURSESW_TERM_H) -# include +#elif defined(HAVE_TERM_H) +# include #endif #ifdef HAVE_LINUX_TIOCL_H diff --git a/text-utils/more.c b/text-utils/more.c index cc53075f61..72dd96bf42 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -190,12 +190,12 @@ static struct { } context, screen_start; extern char PC; /* pad character */ -#ifdef HAVE_TERM_H -# include +#if defined(HAVE_NCURSESW_TERM_H) +# include #elif defined(HAVE_NCURSES_TERM_H) # include -#elif defined(HAVE_NCURSESW_TERM_H) -# include +#elif defined(HAVE_TERM_H) +# include #endif #define TERM_AUTO_RIGHT_MARGIN "am" diff --git a/text-utils/pg.c b/text-utils/pg.c index bc485e2fe9..1b9b8d7dd9 100644 --- a/text-utils/pg.c +++ b/text-utils/pg.c @@ -59,22 +59,20 @@ #include #include -#ifdef HAVE_NCURSESW_H -# include -#elif defined(HAVE_NCURSES_H) -# include -#elif defined(HAVE_NCURSESW_NCURSES_H) +#if defined(HAVE_NCURSESW_NCURSES_H) # include #elif defined(HAVE_NCURSES_NCURSES_H) # include +#elif defined(HAVE_NCURSES_H) +# include #endif -#ifdef HAVE_TERM_H -# include +#if defined(HAVE_NCURSESW_TERM_H) +# include #elif defined(HAVE_NCURSES_TERM_H) # include -#elif defined(HAVE_NCURSESW_TERM_H) -# include +#elif defined(HAVE_TERM_H) +# include #endif #include "nls.h" diff --git a/text-utils/ul.c b/text-utils/ul.c index 3d1518ceac..3986b42060 100644 --- a/text-utils/ul.c +++ b/text-utils/ul.c @@ -49,12 +49,12 @@ #include #include -#ifdef HAVE_TERM_H -# include +#if defined(HAVE_NCURSESW_TERM_H) +# include #elif defined(HAVE_NCURSES_TERM_H) # include -#elif defined(HAVE_NCURSESW_TERM_H) -# include +#elif defined(HAVE_TERM_H) +# include #endif #include "nls.h"