[PATCH] Fix AC_CHECK_HEADERS for term.h to look in ncurses directory.

"Kevin J. McCarthy" <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <[email protected]>
When ncurses headers are installed inside a subdirectory, the term.h
file will be there too.
---
While taking a closer look at the "mutt on macOS and --with-curses=DIR"
thread, I realized the configure.ac was actually making a mistake
searching for term.h.  It should be trying to look in the appropriate
ncurses subdirectory first, as it does for ncurses.h.

 configure.ac  |  4 ++--
 curs_ti_lib.c | 12 ++++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 36564a7b..fe84cfdd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -346,18 +346,18 @@ main ()
 
                   AC_CHECK_HEADERS(ncursesw/ncurses.h,[cf_cv_ncurses_header="ncursesw/ncurses.h"],
                     [AC_CHECK_HEADERS(ncurses.h,[cf_cv_ncurses_header="ncurses.h"])])
+                  AC_CHECK_HEADERS(ncursesw/term.h,,[AC_CHECK_HEADERS(term.h)])
                 else
                   AC_CHECK_LIB(tinfo, tgetent, [MUTTLIBS="$MUTTLIBS -ltinfo"])
 
                   AC_CHECK_HEADERS(ncurses/ncurses.h,[cf_cv_ncurses_header="ncurses/ncurses.h"],
                     [AC_CHECK_HEADERS(ncurses.h,[cf_cv_ncurses_header="ncurses.h"])])
+                  AC_CHECK_HEADERS(ncurses/term.h,,[AC_CHECK_HEADERS(term.h)])
                 fi],
 
                 [CF_CURSES_LIBS])
                 ])
 
-        AC_CHECK_HEADERS(term.h)
-
         old_LIBS="$LIBS"
         LIBS="$LIBS $MUTTLIBS"
         CF_CHECK_FUNCDECLS([#include <${cf_cv_ncurses_header-curses.h}>],
diff --git a/curs_ti_lib.c b/curs_ti_lib.c
index 3bb27155..c25161c6 100644
--- a/curs_ti_lib.c
+++ b/curs_ti_lib.c
@@ -28,8 +28,16 @@
  *       file than everywhere that includes mutt_curses.h.
  */
 
-#if !defined(USE_SLANG_CURSES) && defined(HAVE_TERM_H)
-#include <term.h>
+#if !defined(USE_SLANG_CURSES) && \
+  (defined(HAVE_TERM_H) || defined(HAVE_NCURSESW_TERM_H) || defined(HAVE_NCURSES_TERM_H))
+
+#if defined(HAVE_NCURSESW_TERM_H)
+  #include <ncursesw/term.h>
+#elif defined(HAVE_NCURSES_TERM_H)
+  #include <ncurses/term.h>
+#else
+  #include <term.h>
+#endif
 
 const char *mutt_tigetstr(const char *capname)
 {
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.