diff --git a/meson.build b/meson.build index 0d06c466..866bfd27 100644 --- a/meson.build +++ b/meson.build @@ -569,6 +569,28 @@ foreach h : headers endif endforeach +if want_textui and conf.get('HAVE_TERM_H', 0) == 1 + if not cc.links(''' +#include +#include +int main () { + return tputs("x", 1, putchar); +} +''', dependencies : textui_dep) + if cc.has_header('curses.h') and cc.links(''' +#include +#include +int main () { + return tputs("x", 1, putchar); +} +''', dependencies : textui_dep, name : 'working Curses') + conf.set('NEED_CURSES_H', 1, description : 'tputs needs curses.h') + else + error('could not link terminfo') + endif + endif +endif + conf.set('HAVE_LIBUTF8PROC', have_libutf8proc) conf.set_quoted('PACKAGE_VERSION', package_version) conf.set_quoted('PACKAGE_TARNAME', meson.project_name()) diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c index 06310cc9..698ff84c 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -31,6 +31,9 @@ #include #ifdef HAVE_TERM_H +#ifdef NEED_CURSES_H +#include +#endif #include #else /* TODO: This needs arguments, starting with C2X. */ @@ -40,14 +43,13 @@ int tputs(); /* returns number of characters in the beginning of the buffer being a a single character, or -1 if more input is needed. The character will be saved in result */ -typedef int (*TERM_INPUT_FUNC)(const unsigned char *buffer, int size, - unichar *result); +typedef int (*TERM_INPUT_FUNC)(const unsigned char *buffer, int size, unichar *result); struct _TERM_WINDOW { - /* Terminal to use for window */ + /* Terminal to use for window */ TERM_REC *term; - /* Area for window in terminal */ + /* Area for window in terminal */ int x, y; int width, height; }; diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c index 7c21d509..bd735731 100644 --- a/src/fe-text/terminfo-core.c +++ b/src/fe-text/terminfo-core.c @@ -13,6 +13,9 @@ inline static int term_putchar(int c) } #ifdef HAVE_TERM_H +#ifdef NEED_CURSES_H +#include +#endif #include #else /* Don't bother including curses.h because of these -