Skip to content

Commit

Permalink
Changes in configuration to identify location of 'term.h'
Browse files Browse the repository at this point in the history
* ProvideTerm.h: New file
* Update configure.ac to detect term.h
* Update iwyu/htop.imp
* Add ProvideTerm.h to Makefile

Co-authored-by: BenBE <[email protected]>
  • Loading branch information
valdaarhun and BenBE committed May 22, 2023
1 parent f77ea80 commit 3fc2862
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ myhtopheaders = \
ProcessList.h \
ProcessLocksScreen.h \
ProvideCurses.h \
ProvideTerm.h \
RichString.h \
Scheduling.h \
ScreenManager.h \
Expand Down
24 changes: 24 additions & 0 deletions ProvideTerm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef HEADER_ProvideTerm
#define HEADER_ProvideTerm
/*
htop - Filename.h
(C) 2023 htop dev team
Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
*/

#include "config.h" // IWYU pragma: keep

// IWYU pragma: begin_exports

#if defined(HAVE_NCURSESW_TERM_H)
#include <ncursesw/term.h>
#elif defined(HAVE_NCURSES_TERM_H)
#include <ncurses/term.h>
#elif defined(HAVE_TERM_H)
#include <term.h>
#endif

// IWYU pragma: end_exports

#endif // HEADER_ProvideTerm
12 changes: 11 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@ if test "x$enable_unicode" = xyes; then
[AC_CHECK_HEADERS([ncurses.h], [],
[AC_MSG_ERROR([can not find required ncurses header file])])])])])

AC_CHECK_HEADERS([ncursesw/term.h], [],
[AC_CHECK_HEADERS([ncurses/term.h], [],
[AC_CHECK_HEADERS([term.h], [],
[AC_MSG_ERROR([can not find required term header file])])])])

# check if additional linker flags are needed for keypad(3)
# (at this point we already link against a working ncurses library with wide character support)
AC_SEARCH_LIBS([keypad], [tinfow tinfo])
Expand All @@ -375,13 +380,18 @@ else
AC_CHECK_HEADERS([curses.h], [],
[AC_CHECK_HEADERS([ncurses/curses.h], [],
[AC_CHECK_HEADERS([ncurses/ncurses.h], [],
[AC_CHECK_HEADERS([ncurses.h] ,[],
[AC_CHECK_HEADERS([ncurses.h], [],
[AC_MSG_ERROR([can not find required ncurses header file])])])])])

AC_CHECK_HEADERS([ncurses/term.h], [],
[AC_CHECK_HEADERS([term.h], [],
[AC_MSG_ERROR([can not find required term header file])])])

# check if additional linker flags are needed for keypad(3)
# (at this point we already link against a working ncurses library)
AC_SEARCH_LIBS([keypad], [tinfo])
fi

if test "$enable_static" = yes; then
AC_SEARCH_LIBS([Gpm_GetEvent], [gpm])
fi
Expand Down
4 changes: 4 additions & 0 deletions iwyu/htop.imp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
{ include: ["<ncurses/curses.h>", "private", "\"ProvideCurses.h\"", "public"] },
{ include: ["<ncurses/ncurses.h>", "private", "\"ProvideCurses.h\"", "public"] },

{ include: ["<term.h>", "private", "\"ProvideTerm.h\"", "public"] },
{ include: ["<ncurses/term.h>", "private", "\"ProvideTerm.h\"", "public"] },
{ include: ["<ncursesw/term.h>", "private", "\"ProvideTerm.h\"", "public"] },

{ include: ["<bits/types/struct_tm.h>", "private", "<time.h>", "public"] },

{ include: ["<bits/getopt_core.h>", "private", "<unistd.h>", "public"] },
Expand Down

0 comments on commit 3fc2862

Please sign in to comment.