From 934f708ef6395a849f7b859c6dab8e0e482fdf9d Mon Sep 17 00:00:00 2001 From: Maya Rashish Date: Wed, 19 Feb 2020 00:04:35 +0200 Subject: [PATCH] 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. --- cmake/ConfigureChecks.cmake | 22 ++++++---------------- config_cmake.h.in | 3 +++ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index be696da71..25dc9eb61 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -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 \n") @@ -147,9 +146,11 @@ ELSEIF(HAVE_NCURSES_TERM_H) SET(TPARM_INCLUDES "${TPARM_INCLUDES}#include \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() - SET(TPARM_VARARGS 1) - ENDIF() +IF(TPARM_TAKES_VARARGS) + SET(TPARM_VARARGS 1) +ELSE() + SET(TPARM_SOLARIS_KLUDGE 1) ENDIF() CMAKE_POP_CHECK_STATE() diff --git a/config_cmake.h.in b/config_cmake.h.in index 471094269..0330940fa 100644 --- a/config_cmake.h.in +++ b/config_cmake.h.in @@ -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