diff --git a/configure.ac b/configure.ac index 153298a6..5b70c6d2 100644 --- a/configure.ac +++ b/configure.ac @@ -42,10 +42,7 @@ AC_ARG_ENABLE(execinfo, AX_PTHREAD([], AC_MSG_ERROR([requires pthread])) -AC_ARG_WITH([ncurses], - [AS_HELP_STRING([--without-ncurses], [build without ncurses (daemon-only mode)])], - [with_ncurses=$withval], - [with_ncurses=yes]) +TORRENT_WITHOUT_NCURSES if test "x$with_ncurses" != xno; then AX_WITH_CURSES @@ -53,8 +50,6 @@ if test "x$with_ncurses" != xno; then if test "x$ax_cv_ncursesw" != xyes && test "x$ax_cv_ncurses" != xyes; then AC_MSG_ERROR([requires either NcursesW or Ncurses library]) fi -else - AC_DEFINE([HAVE_NO_NCURSES], [1], [Define to 1 if building without ncurses]) fi PKG_CHECK_MODULES([CPPUNIT], [cppunit],, [no_cppunit="yes"]) @@ -80,20 +75,9 @@ AC_DEFINE(USER_AGENT, [std::string(PACKAGE "/" VERSION)], Http user agent) dnl Only update global build variables immediately before generating the output, dnl to avoid affecting the global build environment for other autoconf checks. -if test "x$with_ncurses" != xno; then - LIBS="$PTHREAD_LIBS $CURSES_LIB $CURSES_LIBS $ZLIB_LIBS $DEPENDENCIES_LIBS $LIBS" -else - LIBS="$PTHREAD_LIBS $ZLIB_LIBS $DEPENDENCIES_LIBS $LIBS" -fi -if test "x$with_ncurses" != xno; then - CFLAGS="$CFLAGS $PTHREAD_CFLAGS $CURSES_CFLAGS $ZLIB_CFLAGS $DEPENDENCIES_CFLAGS" - CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS $CURSES_CFLAGS $ZLIB_CFLAGS $DEPENDENCIES_CFLAGS" -else - CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ZLIB_CFLAGS $DEPENDENCIES_CFLAGS" - CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS $ZLIB_CFLAGS $DEPENDENCIES_CFLAGS" -fi - -AM_CONDITIONAL([NO_NCURSES], [test "x$with_ncurses" = xno]) +LIBS="$PTHREAD_LIBS $CURSES_LIB $CURSES_LIBS $ZLIB_LIBS $DEPENDENCIES_LIBS $LIBS" +CFLAGS="$CFLAGS $PTHREAD_CFLAGS $CURSES_CFLAGS $ZLIB_CFLAGS $DEPENDENCIES_CFLAGS" +CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS $CURSES_CFLAGS $ZLIB_CFLAGS $DEPENDENCIES_CFLAGS" TORRENT_CHECK_CACHELINE TORRENT_CHECK_POPCOUNT diff --git a/scripts/checks.m4 b/scripts/checks.m4 index 663b1e8c..923689ad 100644 --- a/scripts/checks.m4 +++ b/scripts/checks.m4 @@ -506,3 +506,20 @@ AC_DEFUN([TORRENT_WITH_SYSTEMD], [ fi ]) ]) + + +AC_DEFUN([TORRENT_WITHOUT_NCURSES], [ + AC_ARG_WITH([ncurses], + [AS_HELP_STRING([--without-ncurses], [build without ncurses (daemon-only mode)])], + [with_ncurses=$withval], + [with_ncurses=yes]) + + if test "x$with_ncurses" = xno; then + AC_DEFINE([HAVE_NO_NCURSES], [1], [Define to 1 if building without ncurses]) + CURSES_LIBS="" + CURSES_CFLAGS="" + CURSES_LIB="" + fi + + AM_CONDITIONAL([NO_NCURSES], [test "x$with_ncurses" = xno]) +]) diff --git a/src/display/curses_stub.h b/src/display/curses_stub.h index 9a5c467b..9e601c6f 100644 --- a/src/display/curses_stub.h +++ b/src/display/curses_stub.h @@ -99,6 +99,7 @@ inline int init_pair(short, short, short) { return 0; } inline int pair_content(short, short*, short*) { return 0; } inline int resizeterm(int, int) { return 0; } inline int getch() { return ERR; } +inline int set_escdelay(int) { return 0; } // getyx / getmaxyx are macros in real ncurses; stub them as no-ops #define getyx(w, y, x) do { (y) = 0; (x) = 0; } while (0)