cmake: adjust logic for TPARM_VARARGS

- Define it before the headers so they can pick the variadic tparm
prototype.
- We need a TPARM_VARARGS define, add it to config_cmake.h.
- Move & adjust comment - put it near the code, and mentiont that
NetBSD curses doesn't need the kludge.

Now variadic tparm is used on NetBSD instead of the Solaris kludge.
This commit is contained in:
Maya Rashish 2020-02-19 00:04:35 +02:00 committed by Fabian Homborg
parent ee943a0821
commit 934f708ef6
2 changed files with 9 additions and 16 deletions

View file

@ -131,7 +131,6 @@ CMAKE_POP_CHECK_STATE()
CHECK_TYPE_SIZE("wchar_t[8]" WCHAR_T_BITS LANGUAGE CXX)
# Solaris, NetBSD and X/Open-conforming systems have a fixed-args tparm
SET(TPARM_INCLUDES)
IF(HAVE_NCURSES_H)
SET(TPARM_INCLUDES "${TPARM_INCLUDES}#include <ncurses.h>\n")
@ -147,9 +146,11 @@ 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})
CHECK_CXX_SOURCE_COMPILES("
#define TPARM_VARARGS
${TPARM_INCLUDES}
int main () {
@ -158,22 +159,11 @@ int main () {
"
TPARM_TAKES_VARARGS
)
IF(NOT TPARM_TAKES_VARARGS)
CHECK_CXX_SOURCE_COMPILES("
${TPARM_INCLUDES}
#define TPARM_VARARGS
int main () {
tparm( \"\" );
}
"
TPARM_TAKES_VARARGS_WITH_VARARGS
)
IF(NOT TPARM_TAKES_VARARGS)
SET(TPARM_SOLARIS_KLUDGE 1)
ELSE()
IF(TPARM_TAKES_VARARGS)
SET(TPARM_VARARGS 1)
ENDIF()
ELSE()
SET(TPARM_SOLARIS_KLUDGE 1)
ENDIF()
CMAKE_POP_CHECK_STATE()

View file

@ -145,6 +145,9 @@
/* Define to the full name of this package. */
#define PACKAGE_NAME "fish"
/* Use a variadic tparm on NetBSD curses. */
#cmakedefine TPARM_VARARGS 1
/* Define to 1 if tparm accepts a fixed amount of parameters. */
#cmakedefine TPARM_SOLARIS_KLUDGE 1