summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>2013-07-21 22:27:58 -0300
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2013-07-25 00:01:51 -0300
commit057467f6b33b9f7c942bd2327561b74e738285b7 (patch)
treef2afcf8f7684ef4bd31f352437e0c7b5811ad387 /configure
parent2c07cb00360cb962d0bb543ce59ea028aa9e4e76 (diff)
downloadmpv-057467f6b33b9f7c942bd2327561b74e738285b7.tar.bz2
mpv-057467f6b33b9f7c942bd2327561b74e738285b7.tar.xz
getch2: Refactor/rewrite
Still uses termcap, but uses terminfo for loading the termcap database if possible. Adds configure test to find terminfo; skips the termcap test if terminfo is found since terminfo provides termcap. Use termcap completely for special keys; if we can't get it from termcap and it isn't one of the known fallbacks, we ignore its specialness and treat as a sequence of UTF-8 codes. Further hardcoded fallbacks can be added by calling keys_push_once in load_termcap; there is no limit to the amount of keys pushed. Uses the "ke" and "ks" capabilities to start / exit application mode, which is necessary on vt100 emulators (including screen, xterm and all terminals that emulate either of those) to correctly receive arrow keys. It's now possible to compile getch2 even without termcap, though it won't be of much use since it'll be unable to detect special keys. Converted to 4 spaces per tab, prettified some statements.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure26
1 files changed, 26 insertions, 0 deletions
diff --git a/configure b/configure
index 723cc96fa9..67df30c033 100755
--- a/configure
+++ b/configure
@@ -293,6 +293,7 @@ Installation directories:
Optional features:
--disable-encoding disable encoding functionality [enable]
--disable-libguess disable libguess [autodetect]
+ --enable-terminfo use terminfo database for key codes [autodetect]
--enable-termcap use termcap database for key codes [autodetect]
--enable-termios use termios database for key codes [autodetect]
--disable-iconv disable iconv for encoding conversion [autodetect]
@@ -464,6 +465,7 @@ _libguess=auto
_joystick=no
_lirc=auto
_lircc=auto
+_terminfo=auto
_termcap=auto
_termios=auto
_shm=auto
@@ -668,6 +670,8 @@ for ac_option do
--disable-lirc) _lirc=no ;;
--enable-lircc) _lircc=yes ;;
--disable-lircc) _lircc=no ;;
+ --enable-terminfo) _terminfo=yes ;;
+ --disable-terminfo) _terminfo=no ;;
--enable-termcap) _termcap=yes ;;
--disable-termcap) _termcap=no ;;
--enable-termios) _termios=yes ;;
@@ -1409,6 +1413,27 @@ header_check sys/videoio.h && sys_videoio_h=yes &&
echores "$sys_videoio_h"
+echocheck "terminfo"
+if test "$_terminfo" = auto ; then
+ _terminfo=no
+ for _ld_tmp in "-lncurses" "-lncursesw"; do
+ statement_check term.h 'setupterm(NULL, 1, NULL)' $_ld_tmp &&
+ libs_mplayer="$libs_mplayer $_ld_tmp" && _terminfo=yes && break
+ done
+fi
+if test "$_terminfo" = yes ; then
+ def_terminfo='#define HAVE_TERMINFO 1'
+ test $_ld_tmp && res_comment="using $_ld_tmp"
+
+ if test "$_termcap" = auto ; then
+ _termcap = yes # terminfo provides termcap
+ fi
+else
+ def_terminfo='#undef HAVE_TERMINFO'
+fi
+echores "$_terminfo"
+
+
echocheck "termcap"
if test "$_termcap" = auto ; then
_termcap=no
@@ -3098,6 +3123,7 @@ $def_posix_select
$def_select
$def_setmode
$def_shm
+$def_terminfo
$def_termcap
$def_termios