Commit 0094f898 authored by Christian Persch's avatar Christian Persch

Bug 552096 – Detect tgetent if provided by libtinfo

	* configure.in: Rewrote tgetent checks to be more readable. Also check
	for tgetent in libtinfo.
	* src/keymap.c: (_vte_keymap_map), (_vte_keymap_key_is_modifier):
	* src/ssfe.c: Adjust includes accordingly.

svn path=/trunk/; revision=2316
parent a1bac903
2008-12-02 Christian Persch <chpe@gnome.org>
Bug 552096 Detect tgetent if provided by libtinfo
* configure.in: Rewrote tgetent checks to be more readable. Also check
for tgetent in libtinfo.
* src/keymap.c: (_vte_keymap_map), (_vte_keymap_key_is_modifier):
* src/ssfe.c: Adjust includes accordingly.
2008-12-02 Behdad Esfahbod <behdad@gnome.org>
* src/vte.c (vte_terminal_start_selection),
......
......@@ -289,21 +289,42 @@ fi
AC_CHECK_FUNC(floor,,AC_CHECK_LIB(m,floor,LIBS=["$LIBS -lm"]))
AC_CHECK_FUNCS([ceil floor])
# Look for ncurses or curses or termcap.
AC_CHECK_HEADER(ncurses.h,[AC_CHECK_HEADER(term.h,[AC_CHECK_LIB(ncurses,tgetent,[LIBS="-lncurses $LIBS";AC_DEFINE(HAVE_NCURSES,1,[Define if you have ncurses.h and libncurses])])])])
if test x$ac_cv_lib_ncurses_tgetent != xyes ; then
AC_CHECK_HEADER(ncurses/curses.h,[AC_CHECK_HEADER(ncurses/term.h,[AC_CHECK_LIB(ncurses,tgetent,[LIBS="-lncurses $LIBS";AC_DEFINE(HAVE_NCURSES_CURSES,1,[Define if you have ncurses/curses.h and libncurses])])])])
if test x$ac_cv_lib_ncurses_tgetent != xyes ; then
AC_CHECK_HEADER(curses.h,[AC_CHECK_HEADER(term.h,[AC_CHECK_LIB(curses,tgetent,[LIBS="-lcurses $LIBS";AC_DEFINE(HAVE_CURSES,1,[Define if you have curses.h and libcurses])])])])
if test x$ac_cv_lib_curses_tgetent != xyes ; then
AC_CHECK_HEADER(termcap.h,[AC_CHECK_LIB(termcap,tgetent,[LIBS="-ltermcap $LIBS";AC_DEFINE(HAVE_TERMCAP,1,[Define if you have termcap.h and libtermcap])])])
if test x$ac_cv_header_termcap_h != xyes ; then
AC_MSG_ERROR([You must have at least one of ncurses, curses, or libtermcap installed to build vte.])
fi
fi
fi
fi
# Look for tgetent
AC_CHECK_FUNC([tgetent],[vte_cv_termcap_lib=libc],
[AC_CHECK_LIB([ncurses],[tgetent],[vte_cv_termcap_lib=libncurses],
[AC_CHECK_LIB([tinfo],[tgetent],[vte_cv_termcap_lib=libtinfo],
[AC_CHECK_LIB([curses],[tgetent],[vte_cv_termcap_lib=libcurses],
[AC_CHECK_LIB([termcap],[tgetent],[vte_cv_termcap_lib=libtermcap],
[vte_cv_termcap_lib=])])])])])
case "$vte_cv_termcap_lib" in
libc) # FIXME: which headers to include here?
;;
libncurses) # We need ncurses.h and term.h, or ncurses/curses.h and ncurses/term.h
AC_CHECK_HEADERS([ncurses.h term.h],[],
[AC_CHECK_HEADERS([ncuses/curses.h ncurses/term.h],[],
[AC_MSG_ERROR([ncurses headers not found])])])
LIBS="-lncurses $LIBS"
;;
libtinfo) # Need ncurses/curses.h and ncurses/term.h
AC_CHECK_HEADERS([ncurses.h term.h],[],
[AC_CHECK_HEADERS([ncuses/curses.h ncurses/term.h],[],
[AC_MSG_ERROR([ncurses headers not found])])])
LIBS="-ltinfo $LIBS"
;;
libcurses) # Need curses.h and term.h
AC_CHECK_HEADERS([curses.h term.h],[],
[AC_MSG_ERROR([curses headers not found])])
LIBS="-lncurses $LIBS"
;;
libtermcap) # Need termcap.h
AC_CHECK_HEADERS([termcap.h],[],
[AC_MSG_ERROR([termcap headers not found])])
LIBS="-ltermcap $LIBS"
;;
*) AC_MSG_ERROR([tgetent not found in any library]) ;;
esac
# Search for the required modules.
VTE_PKGS="glib-2.0 >= $GLIB_REQUIRED gobject-2.0 pango >= $PANGO_REQUIRED gtk+-2.0 >= $GTK_REQUIRED"
......
......@@ -27,25 +27,24 @@
#include "debug.h"
#include "keymap.h"
#include "vtetc.h"
#ifdef HAVE_NCURSES
#if defined(HAVE_NCURSES_H) && defined(HAVE_TERM_H)
#include <ncurses.h>
#include <term.h>
#define HAVE_CURSES
#else
#ifdef HAVE_NCURSES_CURSES
#define VTE_TERMCAP_NAME "ncurses"
#elif defined(HAVE_NCURSES_CURSES_H) && defined(HAVE_NCURSES_TERM_H)
#include <ncurses/curses.h>
#include <ncurses/term.h>
#define HAVE_CURSES
#else
#ifdef HAVE_CURSES
#define VTE_TERMCAP_NAME "ncurses"
#elif defined(HAVE_CURSES_H) && defined(HAVE_TERM_H)
#include <curses.h>
#include <term.h>
#else
#ifdef HAVE_TERMCAP
#define VTE_TERMCAP_NAME "curses"
#elif defined(HAVE_TERMCAP_H)
#include <termcap.h>
#endif
#endif
#endif
#define VTE_TERMCAP_NAME "termcap"
#else
#error No termcap??
#endif
#ifdef VTE_DEBUG
......@@ -1009,10 +1008,8 @@ _vte_keymap_map(guint keyval,
enum _vte_fkey_mode fkey_mode;
char *cap, *tmp;
const char *termcap_special = NULL;
#if defined(HAVE_CURSES) || defined(HAVE_TERMCAP)
char ncurses_buffer[4096];
char ncurses_area[512];
#endif
g_return_if_fail(normal != NULL);
g_return_if_fail(normal_length != NULL);
......@@ -1167,7 +1164,6 @@ _vte_keymap_map(guint keyval,
}
}
}
#if defined(HAVE_CURSES) || defined(HAVE_TERMCAP)
if (termcap_special != NULL) {
tmp = g_strdup(terminal);
cap = NULL;
......@@ -1191,13 +1187,7 @@ _vte_keymap_map(guint keyval,
#ifdef VTE_DEBUG
if (_vte_debug_on(VTE_DEBUG_KEYBOARD)) {
int j;
#ifdef HAVE_CURSES
g_printerr(" via ncurses to '");
#else
#ifdef HAVE_TERMCAP
g_printerr(" via termcap to '");
#endif
#endif
g_printerr(" via " VTE_TERMCAP_NAME " to '");
for (j = 0; j < *normal_length; j++) {
if (((*normal)[j] < 32) ||
((*normal)[j] >= 127)) {
......@@ -1214,7 +1204,6 @@ _vte_keymap_map(guint keyval,
return;
}
}
#endif
_vte_debug_print(VTE_DEBUG_KEYBOARD,
" (ignoring, no match for modifier state).\n");
......
......@@ -22,25 +22,23 @@
#include <stdarg.h>
#ifdef HAVE_NCURSES
#if defined(HAVE_NCURSES_H) && defined(HAVE_TERM_H)
#include <ncurses.h>
#include <term.h>
#define HAVE_CURSES
#else
#ifdef HAVE_NCURSES_CURSES
#define VTE_TERMCAP_NAME "ncurses"
#elif defined(HAVE_NCURSES_CURSES_H) && defined(HAVE_NCURSES_TERM_H)
#include <ncurses/curses.h>
#include <ncurses/term.h>
#define HAVE_CURSES
#else
#ifdef HAVE_CURSES
#define VTE_TERMCAP_NAME "ncurses"
#elif defined(HAVE_CURSES_H) && defined(HAVE_TERM_H)
#include <curses.h>
#include <term.h>
#else
#ifdef HAVE_TERMCAP
#define VTE_TERMCAP_NAME "curses"
#elif defined(HAVE_TERMCAP_H)
#include <termcap.h>
#endif
#endif
#endif
#define VTE_TERMCAP_NAME "termcap"
#else
#error No termcap??
#endif
#include <sys/types.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment