mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 05:43:11 +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")
|
set(TPARM_INCLUDES "${TPARM_INCLUDES}#include <ncurses/term.h>\n")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Solaris and X/Open-conforming systems have a fixed-args tparm
|
|
||||||
cmake_push_check_state()
|
cmake_push_check_state()
|
||||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
|
list(APPEND CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
|
||||||
|
# Solaris and X/Open-conforming systems have a fixed-args tparm
|
||||||
check_cxx_source_compiles("
|
check_cxx_source_compiles("
|
||||||
#define TPARM_VARARGS
|
#define TPARM_VARARGS
|
||||||
${TPARM_INCLUDES}
|
${TPARM_INCLUDES}
|
||||||
|
@ -182,6 +182,23 @@ int main () {
|
||||||
TPARM_TAKES_VARARGS
|
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)
|
if(TPARM_TAKES_VARARGS)
|
||||||
set(TPARM_VARARGS 1)
|
set(TPARM_VARARGS 1)
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -148,6 +148,9 @@
|
||||||
/* Use a variadic tparm on NetBSD curses. */
|
/* Use a variadic tparm on NetBSD curses. */
|
||||||
#cmakedefine TPARM_VARARGS 1
|
#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. */
|
/* Define to 1 if tparm accepts a fixed amount of parameters. */
|
||||||
#cmakedefine TPARM_SOLARIS_KLUDGE 1
|
#cmakedefine TPARM_SOLARIS_KLUDGE 1
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,9 @@ int fish_mkstemp_cloexec(char *);
|
||||||
#define WCHAR_MAX INT_MAX
|
#define WCHAR_MAX INT_MAX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Under curses, tputs expects an int (*func)(char) as its last parameter, but in ncurses, tputs
|
/// Both ncurses and NetBSD curses expect an int (*func)(int) as the last parameter for tputs.
|
||||||
/// expects a int (*func)(int) as its last parameter. tputs_arg_t is defined to always be what tputs
|
/// Apparently OpenIndiana's curses still uses int (*func)(char) here.
|
||||||
/// expects. Hopefully.
|
#if TPUTS_USES_INT_ARG
|
||||||
#if defined(NCURSES_VERSION) || defined(__NetBSD__)
|
|
||||||
using tputs_arg_t = int;
|
using tputs_arg_t = int;
|
||||||
#else
|
#else
|
||||||
using tputs_arg_t = char;
|
using tputs_arg_t = char;
|
||||||
|
|
Loading…
Reference in a new issue