mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 13:23:09 +00:00
Check for tputs type via cmake
Instead of testing for ncurses and netbsd. Fixes #8087.
This commit is contained in:
parent
5a685c16c5
commit
82a809e2db
3 changed files with 24 additions and 5 deletions
|
@ -168,9 +168,9 @@ elseif(HAVE_NCURSES_TERM_H)
|
|||
set(TPARM_INCLUDES "${TPARM_INCLUDES}#include <ncurses/term.h>\n")
|
||||
endif()
|
||||
|
||||
# Solaris and X/Open-conforming systems have a fixed-args tparm
|
||||
cmake_push_check_state()
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
|
||||
# Solaris and X/Open-conforming systems have a fixed-args tparm
|
||||
check_cxx_source_compiles("
|
||||
#define TPARM_VARARGS
|
||||
${TPARM_INCLUDES}
|
||||
|
@ -182,6 +182,23 @@ int main () {
|
|||
TPARM_TAKES_VARARGS
|
||||
)
|
||||
|
||||
|
||||
# Check if tputs needs a function reading an int or char.
|
||||
# The only curses I can find that needs a char is OpenIndiana.
|
||||
check_cxx_source_compiles("
|
||||
#include <curses.h>
|
||||
#include <term.h>
|
||||
|
||||
static int writer(int b) {
|
||||
return b;
|
||||
}
|
||||
|
||||
int main() {
|
||||
return tputs(\"foo\", 5, writer);
|
||||
}"
|
||||
TPUTS_USES_INT_ARG
|
||||
)
|
||||
|
||||
if(TPARM_TAKES_VARARGS)
|
||||
set(TPARM_VARARGS 1)
|
||||
else()
|
||||
|
|
|
@ -148,6 +148,9 @@
|
|||
/* Use a variadic tparm on NetBSD curses. */
|
||||
#cmakedefine TPARM_VARARGS 1
|
||||
|
||||
/* The parameter type for the last tputs parameter */
|
||||
#cmakedefine TPUTS_USES_INT_ARG 1
|
||||
|
||||
/* Define to 1 if tparm accepts a fixed amount of parameters. */
|
||||
#cmakedefine TPARM_SOLARIS_KLUDGE 1
|
||||
|
||||
|
|
|
@ -50,10 +50,9 @@ int fish_mkstemp_cloexec(char *);
|
|||
#define WCHAR_MAX INT_MAX
|
||||
#endif
|
||||
|
||||
/// Under curses, tputs expects an int (*func)(char) as its last parameter, but in ncurses, tputs
|
||||
/// expects a int (*func)(int) as its last parameter. tputs_arg_t is defined to always be what tputs
|
||||
/// expects. Hopefully.
|
||||
#if defined(NCURSES_VERSION) || defined(__NetBSD__)
|
||||
/// Both ncurses and NetBSD curses expect an int (*func)(int) as the last parameter for tputs.
|
||||
/// Apparently OpenIndiana's curses still uses int (*func)(char) here.
|
||||
#if TPUTS_USES_INT_ARG
|
||||
using tputs_arg_t = int;
|
||||
#else
|
||||
using tputs_arg_t = char;
|
||||
|
|
Loading…
Reference in a new issue