From b9290c8a835c089603addeaafa9dec038948a818 Mon Sep 17 00:00:00 2001 From: Wesley Merkel Date: Sat, 5 Apr 2014 13:31:53 -0600 Subject: [PATCH] Let user disable native colours with ./configure --- configure.ac | 22 ++++++++++++++++++++++ src/main.c | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 0becaaf..971a22c 100644 --- a/configure.ac +++ b/configure.ac @@ -451,6 +451,28 @@ fi AM_CONDITIONAL(BUILD_AV, test "x$BUILD_AV" = "xyes") +# check for ncurses default colour capabilities +NATIVE_COLOURS="yes" +AC_ARG_ENABLE([native-colours], + [AC_HELP_STRING( + [--disable-native-colours], [use terminal-default fg/bg colours]) + ], + [ + if test "x$enableval" = "xno"; then + NATIVE_COLOURS="no" + elif test "x$enableval" = "xyes"; then + NATIVE_COLOURS="yes" + fi + ] +) +if test "x$NATIVE_COLOURS" = "xyes"; then + AC_CHECK_LIB([ncurses], [assume_default_colors], + [AC_DEFINE( + [TOXIC_NATIVE_COLOURS], [1], [use terminal-default fg/bg colours]) + ], + [AC_MSG_WARN([curses library does not support native colours])] + ) +fi TOXIC_VERSION="$PACKAGE_VERSION" AC_PATH_PROG([GIT], [git], [no]) diff --git a/src/main.c b/src/main.c index 6ec642f..0725797 100644 --- a/src/main.c +++ b/src/main.c @@ -108,7 +108,7 @@ static void init_term(void) if (has_colors()) { short bg_color = COLOR_BLACK; start_color(); -#ifdef NCURSES_EXT_FUNCS +#ifdef TOXIC_NATIVE_COLOURS if (assume_default_colors(-1,-1) == OK) bg_color = -1; #endif