xref: /netbsd-src/external/gpl3/gdb/dist/readline/readline/examples/autoconf/BASH_CHECK_LIB_TERMCAP (revision 4b169a6ba595ae283ca507b26b15fdff40495b1c)
1AC_DEFUN([BASH_CHECK_LIB_TERMCAP],
2[
3if test "X$bash_cv_termcap_lib" = "X"; then
4_bash_needmsg=yes
5else
6AC_MSG_CHECKING(which library has the termcap functions)
7_bash_needmsg=
8fi
9AC_CACHE_VAL(bash_cv_termcap_lib,
10[AC_CHECK_FUNC(tgetent, bash_cv_termcap_lib=libc,
11  [AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
12    [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo,
13        [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
14	    [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
15                [AC_CHECK_LIB(ncursesw, tgetent, bash_cv_termcap_lib=libncursesw,
16	            bash_cv_termcap_lib=gnutermcap)])])])])])])
17if test "X$_bash_needmsg" = "Xyes"; then
18AC_MSG_CHECKING(which library has the termcap functions)
19fi
20AC_MSG_RESULT(using $bash_cv_termcap_lib)
21if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
22LDFLAGS="$LDFLAGS -L./lib/termcap"
23TERMCAP_LIB="./lib/termcap/libtermcap.a"
24TERMCAP_DEP="./lib/termcap/libtermcap.a"
25elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
26TERMCAP_LIB=-ltermcap
27TERMCAP_DEP=
28elif test $bash_cv_termcap_lib = libtinfo; then
29TERMCAP_LIB=-ltinfo
30TERMCAP_DEP=
31elif test $bash_cv_termcap_lib = libncurses; then
32TERMCAP_LIB=-lncurses
33TERMCAP_DEP=
34elif test $bash_cv_termcap_lib = libc; then
35TERMCAP_LIB=
36TERMCAP_DEP=
37else
38TERMCAP_LIB=-lcurses
39TERMCAP_DEP=
40fi
41])
42