Merge branch '4561_tar_segfault'
[midnight-commander.git] / m4.include / mc-use-termcap.m4
blob6781815fdfa563de00eeae73335cb5f7f8cd2a7e
1 dnl
2 dnl Try using termcap database and link with libtermcap if possible.
3 dnl
4 AC_DEFUN([mc_USE_TERMCAP], [
5         screen_msg="$screen_msg with termcap database"
6         AC_MSG_NOTICE([using S-Lang screen library with termcap])
7         AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap database])
9         ac_save_LIBS="$LIBS"
10         AC_SEARCH_LIBS([tgoto], [termcap xcurses curses],
11             [MCLIBS="$MCLIBS $ac_cv_search_tgoto"],
12             [AC_MSG_ERROR([Could not find a library providing tgoto])]
13         )
14         LIBS="$ac_save_LIBS"
17 dnl
18 dnl Check if the installed S-Lang library uses termcap
19 dnl
20 AC_DEFUN([mc_SLANG_TERMCAP], [
21     unset ac_cv_lib_termcap_tgoto
23     AC_CACHE_CHECK([if S-Lang uses termcap], [mc_cv_slang_termcap], [
24         ac_save_LIBS="$LIBS"
25         LIBS="$LIBS -lslang"
26         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
27 #include <slang.h>
28         ]],
29         [[SLtt_get_terminfo(); SLtt_tgetflag((char*)"");]])],
30         [mc_cv_slang_termcap=no], [mc_cv_slang_termcap=yes])
32         LIBS="$ac_save_LIBS"
33     ])
35     if test x"$mc_cv_slang_termcap" = xyes; then
36         mc_USE_TERMCAP
37     fi