summaryrefslogtreecommitdiffstats
path: root/m4.include/mc-use-termcap.m4
blob: 4ae695780d779e5e781542a6d2f587f018bf370c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
dnl
dnl Try using termcap database and link with libtermcap if possible.
dnl
AC_DEFUN([mc_USE_TERMCAP], [
	screen_msg="$screen_msg with termcap database"
	AC_MSG_NOTICE([using S-Lang screen library with termcap])
	AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap database])
	AC_CHECK_LIB(termcap, tgoto, [MCLIBS="$MCLIBS -ltermcap"], , [$LIBS])
])

dnl
dnl Check if the installed S-Lang library uses termcap
dnl
AC_DEFUN([mc_SLANG_TERMCAP], [
    unset ac_cv_lib_termcap_tgoto

    AC_CACHE_CHECK([if S-Lang uses termcap], [mc_cv_slang_termcap], [
	ac_save_LIBS="$LIBS"
	LIBS="$LIBS -lslang"
	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <slang.h>
	]],
	[[SLtt_get_terminfo(); SLtt_tgetflag((char*)"");]])],
	[mc_cv_slang_termcap=no], [mc_cv_slang_termcap=yes])

	LIBS="$ac_save_LIBS"
    ])

    if test x"$mc_cv_slang_termcap" = xyes; then
	mc_USE_TERMCAP
    fi
])