diff --git a/configure.ac b/configure.ac index 9157b197..c5ca2ac5 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,7 @@ # configure.ac: Autoconf input file # # Known contributors to this file: -# Markus Armbruster, 2005-2008 +# Markus Armbruster, 2005-2009 # # Process this file with autoconf to produce a configure script. @@ -73,7 +73,6 @@ save_LIBS="$LIBS" LIBS="$LIBS_SOCKETS $LIBS" LIB_SOCKET_NSL LIBS_server="$LIBS" -AC_SEARCH_LIBS([setupterm], [termlib termcap curses ncurses]) LIBS_client="$LIBS" LIBS="$save_LIBS" AC_SUBST(LIBS_server) @@ -136,6 +135,12 @@ POSIX) AC_DEFINE([EMPTH_POSIX], 1, [Define to use POSIX threads]) ;; Windows) AC_DEFINE([EMPTH_W32], 1, [Define to use Windows threads]) ;; esac +save_LIBS="$LIBS" +LIBS="$LIBS_client" +MY_WITH_TERMINFO +LIBS_client="$LIBS" +LIBS="$save_LIBS" + ### Output diff --git a/m4/my_termlib.m4 b/m4/my_termlib.m4 new file mode 100644 index 00000000..7fb65136 --- /dev/null +++ b/m4/my_termlib.m4 @@ -0,0 +1,25 @@ +AC_DEFUN([MY_CURSES_TERMINFO], +[ + AC_SEARCH_LIBS([setupterm], [termlib termcap curses ncurses], + [have_terminfo=yes], [have_terminfo=no]) + AC_CHECK_HEADER([curses.h], , [have_terminfo=no]) + AC_CHECK_HEADER([term.h], , [have_terminfo=no]) + if test "$have_terminfo" = yes + then AC_DEFINE([HAVE_CURSES_TERMINFO], 1, + [Define if you have the curses interface to terminfo]) + fi +]) + +AC_DEFUN([MY_WITH_TERMINFO], +[ + AC_ARG_WITH([terminfo], + AS_HELP_STRING([--with-terminfo], + [use terminfo for highlighting (default check)])) + if test "x$with_terminfo" != xno; then + MY_CURSES_TERMINFO + if test "$have_terminfo$with_terminfo" = noyes + then AC_MSG_FAILURE([Can't satisfy --with-terminfo]) + fi + with_terminfo="$have_terminfo" + fi +]) diff --git a/src/client/configure.ac b/src/client/configure.ac index 7a74286a..733af2bc 100644 --- a/src/client/configure.ac +++ b/src/client/configure.ac @@ -28,7 +28,7 @@ # configure.ac: Autoconf input file # # Known contributors to this file: -# Markus Armbruster, 2005-2008 +# Markus Armbruster, 2005-2009 # # Process this file with autoconf to produce a configure script. @@ -54,7 +54,6 @@ MY_WINDOWS_API ### Checks for libraries. LIBS="$LIBS_SOCKETS $LIBS" LIB_SOCKET_NSL -AC_SEARCH_LIBS([setupterm], [termlib termcap curses ncurses]) ### Checks for header files. @@ -80,6 +79,7 @@ test "$EMPIREHOST" || EMPIREHOST=blitz.wolfpackempire.com AC_ARG_VAR([EMPIREPORT], [Default port [6789]]) test "$EMPIREPORT" || EMPIREPORT=6789 +MY_WITH_TERMINFO ### Output diff --git a/src/client/misc.h b/src/client/misc.h index eea059f0..de799645 100644 --- a/src/client/misc.h +++ b/src/client/misc.h @@ -49,15 +49,15 @@ extern int input_fd; extern int send_eof; extern FILE *auxfp; -#ifndef _WIN32 +#ifdef HAVE_CURSES_TERMINFO void getsose(void); void putso(void); void putse(void); -#else /* !_WIN32 */ +#else /* !HAVE_CURSES_TERMINFO */ #define getsose() ((void)0) #define putso() ((void)0) #define putse() ((void)0) -#endif /* !WIN32 */ +#endif /* !HAVE_CURSES_TERMINFO */ int recvline(int s, char *buf); int parseid(char *); int expect(int s, int match, char *buf); diff --git a/src/client/termlib.c b/src/client/termlib.c index ad664908..1711afd4 100644 --- a/src/client/termlib.c +++ b/src/client/termlib.c @@ -34,7 +34,7 @@ #include -#ifndef _WIN32 +#ifdef HAVE_CURSES_TERMINFO #include #include @@ -77,4 +77,4 @@ putse(void) putp(rmso); } -#endif /* !_WIN32 */ +#endif /* HAVE_CURSES_TERMINFO */