From: Yann Dirson Date: Sun, 29 Sep 2013 21:16:30 +0000 (+0200) Subject: Allow configure --without-curses. X-Git-Url: http://winboard.nl/cgi-bin?p=gnushogi.git;a=commitdiff_plain;h=3dc43b3d0a8f0a12895b91f5158b4be3a5e78317 Allow configure --without-curses. Not finding libcurses was surely causing problems, we now also proceed cleanly in that case. --- diff --git a/configure.ac b/configure.ac index 00a824b..85d880b 100644 --- a/configure.ac +++ b/configure.ac @@ -41,12 +41,31 @@ AC_PROG_INSTALL echo AC_PATH_XTRA +# +# Check for ncurses. +# + +AC_ARG_WITH([curses], + [AS_HELP_STRING([--with-curses], + [enable curses UI])], + [], + [with_curses=check]) + +LIBCURSES= +AS_IF([test "x$with_curses" != xno], + [AC_CHECK_LIB([curses], [clrtoeol], + [AC_SUBST([LIBCURSES], ["-lcurses"]) + AC_DEFINE([HAVE_LIBCURSES], [1], + [Define if you have lib]) + ], + [AC_MSG_FAILURE( + [--with-curses was given, but test for curses failed])], + [-ltermcap])]) # # Check for other libraries. # -AC_CHECK_LIB(curses, clrtoeol) AC_CHECK_LIB(m, pow) dnl Replace `main' with a function in -ltermcap: AC_CHECK_LIB(termcap, tgoto) diff --git a/gnushogi/dspwrappers.c b/gnushogi/dspwrappers.c index 0a27ec0..7590dcb 100644 --- a/gnushogi/dspwrappers.c +++ b/gnushogi/dspwrappers.c @@ -42,10 +42,15 @@ case DISPLAY_X: \ func args; \ break + +#ifdef HAVE_LIBCURSES #define CASE_DSP_CURSES(func,args) \ case DISPLAY_CURSES: \ func args; \ break; +#else +#define CASE_DSP_CURSES(func,args) +#endif #define DISPLAY_FUNC(func,argsdecl,args) \ void func argsdecl \ diff --git a/gnushogi/gnushogi.h b/gnushogi/gnushogi.h index 13dea78..39c0715 100644 --- a/gnushogi/gnushogi.h +++ b/gnushogi/gnushogi.h @@ -47,7 +47,13 @@ * Display options. */ -typedef enum { DISPLAY_RAW, DISPLAY_CURSES, DISPLAY_X } display_t; +typedef enum { + DISPLAY_RAW, +#ifdef HAVE_LIBCURSES + DISPLAY_CURSES, +#endif + DISPLAY_X +} display_t; extern display_t display_type; #define XSHOGI (display_type == DISPLAY_X) diff --git a/gnushogi/main.c b/gnushogi/main.c index c7f4f63..dabb8eb 100644 --- a/gnushogi/main.c +++ b/gnushogi/main.c @@ -95,12 +95,13 @@ main (int argc, char **argv) break; #endif +#ifdef HAVE_LIBCURSES case 'C': /* Curses interface. */ display_type = DISPLAY_CURSES; break; - +#endif case 'h': /* Need the "+" syntax here... */