Autoconfigure use of terminfo

New configure --with-terminfo.  Before, terminfo was assumed to be
available everywhere but on Windows.
This commit is contained in:
Markus Armbruster 2009-04-19 15:42:19 +02:00
parent e049ad6a56
commit dfb6620203
5 changed files with 39 additions and 9 deletions

View file

@ -28,7 +28,7 @@
# configure.ac: Autoconf input file # configure.ac: Autoconf input file
# #
# Known contributors to this file: # Known contributors to this file:
# Markus Armbruster, 2005-2008 # Markus Armbruster, 2005-2009
# #
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
@ -73,7 +73,6 @@ save_LIBS="$LIBS"
LIBS="$LIBS_SOCKETS $LIBS" LIBS="$LIBS_SOCKETS $LIBS"
LIB_SOCKET_NSL LIB_SOCKET_NSL
LIBS_server="$LIBS" LIBS_server="$LIBS"
AC_SEARCH_LIBS([setupterm], [termlib termcap curses ncurses])
LIBS_client="$LIBS" LIBS_client="$LIBS"
LIBS="$save_LIBS" LIBS="$save_LIBS"
AC_SUBST(LIBS_server) 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]) ;; Windows) AC_DEFINE([EMPTH_W32], 1, [Define to use Windows threads]) ;;
esac esac
save_LIBS="$LIBS"
LIBS="$LIBS_client"
MY_WITH_TERMINFO
LIBS_client="$LIBS"
LIBS="$save_LIBS"
### Output ### Output

25
m4/my_termlib.m4 Normal file
View file

@ -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
])

View file

@ -28,7 +28,7 @@
# configure.ac: Autoconf input file # configure.ac: Autoconf input file
# #
# Known contributors to this file: # Known contributors to this file:
# Markus Armbruster, 2005-2008 # Markus Armbruster, 2005-2009
# #
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
@ -54,7 +54,6 @@ MY_WINDOWS_API
### Checks for libraries. ### Checks for libraries.
LIBS="$LIBS_SOCKETS $LIBS" LIBS="$LIBS_SOCKETS $LIBS"
LIB_SOCKET_NSL LIB_SOCKET_NSL
AC_SEARCH_LIBS([setupterm], [termlib termcap curses ncurses])
### Checks for header files. ### Checks for header files.
@ -80,6 +79,7 @@ test "$EMPIREHOST" || EMPIREHOST=blitz.wolfpackempire.com
AC_ARG_VAR([EMPIREPORT], [Default port [6789]]) AC_ARG_VAR([EMPIREPORT], [Default port [6789]])
test "$EMPIREPORT" || EMPIREPORT=6789 test "$EMPIREPORT" || EMPIREPORT=6789
MY_WITH_TERMINFO
### Output ### Output

View file

@ -49,15 +49,15 @@ extern int input_fd;
extern int send_eof; extern int send_eof;
extern FILE *auxfp; extern FILE *auxfp;
#ifndef _WIN32 #ifdef HAVE_CURSES_TERMINFO
void getsose(void); void getsose(void);
void putso(void); void putso(void);
void putse(void); void putse(void);
#else /* !_WIN32 */ #else /* !HAVE_CURSES_TERMINFO */
#define getsose() ((void)0) #define getsose() ((void)0)
#define putso() ((void)0) #define putso() ((void)0)
#define putse() ((void)0) #define putse() ((void)0)
#endif /* !WIN32 */ #endif /* !HAVE_CURSES_TERMINFO */
int recvline(int s, char *buf); int recvline(int s, char *buf);
int parseid(char *); int parseid(char *);
int expect(int s, int match, char *buf); int expect(int s, int match, char *buf);

View file

@ -34,7 +34,7 @@
#include <config.h> #include <config.h>
#ifndef _WIN32 #ifdef HAVE_CURSES_TERMINFO
#include <curses.h> #include <curses.h>
#include <stdio.h> #include <stdio.h>
@ -77,4 +77,4 @@ putse(void)
putp(rmso); putp(rmso);
} }
#endif /* !_WIN32 */ #endif /* HAVE_CURSES_TERMINFO */