+From 51157b7416cd9d09cb21ee8cebf5750b48f44201 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <casantos@datacom.ind.br>
+Date: Thu, 22 Jun 2017 20:53:55 -0300
+Subject: [PATCH] Revert "build-sys: ncurses headers cleanup"
+
+This reverts commit 3947ca4ca9737d830f54658ef353f5626c0d0282.
+---
+ configure.ac | 8 +++++---
+ lib/colors.c | 15 ++++-----------
+ misc-utils/cal.c | 8 ++++----
+ term-utils/setterm.c | 8 ++++----
+ text-utils/more.c | 8 ++++----
+ text-utils/pg.c | 16 +++++++++-------
+ text-utils/ul.c | 8 ++++----
+ 7 files changed, 34 insertions(+), 37 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 53d25b8ab..3512162df 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -803,8 +803,9 @@ 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], [have_ncursesw_header=yes])
+- AC_CHECK_HEADERS([ncursesw/term.h])
++ AC_CHECK_HEADERS([ncursesw/ncurses.h ncurses.h],
++ [have_ncursesw_header=yes])
++ AC_CHECK_HEADERS([ncursesw/term.h term.h])
+ AS_IF([test "x$have_ncursesw_header" = xno], [have_ncursesw=no])
+ ])
+ AS_IF([test "x$have_ncursesw" = xyes], [
+@@ -829,7 +830,8 @@ 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 f82496d7a..72c5158cb 100644
+--- a/lib/colors.c
++++ b/lib/colors.c
+@@ -12,19 +12,12 @@
+ #include <ctype.h>
+
+ #if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBNCURSESW)
+-# if defined(HAVE_NCURSESW_NCURSES_H)
+-# include <ncursesw/ncurses.h>
+-# elif defined(HAVE_NCURSES_NCURSES_H)
+-# include <ncurses/ncurses.h>
+-# elif defined(HAVE_NCURSES_H)
+-# include <ncurses.h>
+-# endif
+-# if defined(HAVE_NCURSESW_TERM_H)
+-# include <ncursesw/term.h>
++# ifdef HAVE_TERM_H
++# include <term.h>
+ # elif defined(HAVE_NCURSES_TERM_H)
+ # include <ncurses/term.h>
+-# elif defined(HAVE_TERM_H)
+-# include <term.h>
++# elif defined(HAVE_NCURSESW_TERM_H)
++# include <ncursesw/term.h>
+ # endif
+ #endif
+
+diff --git a/misc-utils/cal.c b/misc-utils/cal.c
+index 604eb26a7..2b16979db 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)
+-# if defined(HAVE_NCURSESW_TERM_H)
+-# include <ncursesw/term.h>
++# ifdef HAVE_TERM_H
++# include <term.h>
+ # elif defined(HAVE_NCURSES_TERM_H)
+ # include <ncurses/term.h>
+-# elif defined(HAVE_TERM_H)
+-# include <term.h>
++# elif defined(HAVE_NCURSESW_TERM_H)
++# include <ncursesw/term.h>
+ # endif
+ #endif
+
+diff --git a/term-utils/setterm.c b/term-utils/setterm.c
+index 9f60e5693..53826f954 100644
+--- a/term-utils/setterm.c
++++ b/term-utils/setterm.c
+@@ -60,12 +60,12 @@
+ #include <termios.h>
+ #include <unistd.h>
+
+-#if defined(HAVE_NCURSESW_TERM_H)
+-# include <ncursesw/term.h>
++#ifdef HAVE_TERM_H
++# include <term.h>
+ #elif defined(HAVE_NCURSES_TERM_H)
+ # include <ncurses/term.h>
+-#elif defined(HAVE_TERM_H)
+-# include <term.h>
++#elif defined(HAVE_NCURSESW_TERM_H)
++# include <ncursesw/term.h>
+ #endif
+
+ #ifdef HAVE_LINUX_TIOCL_H
+diff --git a/text-utils/more.c b/text-utils/more.c
+index 72dd96bf4..cc53075f6 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 */
+
+-#if defined(HAVE_NCURSESW_TERM_H)
+-# include <ncursesw/term.h>
++#ifdef HAVE_TERM_H
++# include <term.h>
+ #elif defined(HAVE_NCURSES_TERM_H)
+ # include <ncurses/term.h>
+-#elif defined(HAVE_TERM_H)
+-# include <term.h>
++#elif defined(HAVE_NCURSESW_TERM_H)
++# include <ncursesw/term.h>
+ #endif
+
+ #define TERM_AUTO_RIGHT_MARGIN "am"
+diff --git a/text-utils/pg.c b/text-utils/pg.c
+index 1b9b8d7dd..bc485e2fe 100644
+--- a/text-utils/pg.c
++++ b/text-utils/pg.c
+@@ -59,20 +59,22 @@
+ #include <signal.h>
+ #include <setjmp.h>
+
+-#if defined(HAVE_NCURSESW_NCURSES_H)
++#ifdef HAVE_NCURSESW_H
++# include <ncursesw.h>
++#elif defined(HAVE_NCURSES_H)
++# include <ncurses.h>
++#elif defined(HAVE_NCURSESW_NCURSES_H)
+ # include <ncursesw/ncurses.h>
+ #elif defined(HAVE_NCURSES_NCURSES_H)
+ # include <ncurses/ncurses.h>
+-#elif defined(HAVE_NCURSES_H)
+-# include <ncurses.h>
+ #endif
+
+-#if defined(HAVE_NCURSESW_TERM_H)
+-# include <ncursesw/term.h>
++#ifdef HAVE_TERM_H
++# include <term.h>
+ #elif defined(HAVE_NCURSES_TERM_H)
+ # include <ncurses/term.h>
+-#elif defined(HAVE_TERM_H)
+-# include <term.h>
++#elif defined(HAVE_NCURSESW_TERM_H)
++# include <ncursesw/term.h>
+ #endif
+
+ #include "nls.h"
+diff --git a/text-utils/ul.c b/text-utils/ul.c
+index 3986b4206..3d1518cea 100644
+--- a/text-utils/ul.c
++++ b/text-utils/ul.c
+@@ -49,12 +49,12 @@
+ #include <errno.h>
+ #include <getopt.h>
+
+-#if defined(HAVE_NCURSESW_TERM_H)
+-# include <ncursesw/term.h>
++#ifdef HAVE_TERM_H
++# include <term.h>
+ #elif defined(HAVE_NCURSES_TERM_H)
+ # include <ncurses/term.h>
+-#elif defined(HAVE_TERM_H)
+-# include <term.h>
++#elif defined(HAVE_NCURSESW_TERM_H)
++# include <ncursesw/term.h>
+ #endif
+
+ #include "nls.h"
+--
+2.11.0
+