1 dnl ---------------------------------------------------------------------------
2 dnl Look for the curses libraries. Older curses implementations may require
3 dnl termcap/termlib to be linked as well.
4 AC_DEFUN([CF_CURSES_LIBS],[
5 AC_CHECK_FUNC(initscr,,[
8 AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"])
11 AC_CHECK_LIB(cur_colr,initscr,[
12 LIBS="-lcur_colr $LIBS"
13 CFLAGS="-I/usr/include/curses_colr $CFLAGS"
14 ac_cv_func_initscr=yes
16 AC_CHECK_LIB(Hcurses,initscr,[
17 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
18 LIBS="-lHcurses $LIBS"
19 CFLAGS="-D__HP_CURSES -D_HP_CURSES $CFLAGS"
20 ac_cv_func_initscr=yes
23 linux*) # Suse Linux does not follow /usr/lib convention
28 if test ".$With5lib" != ".no" ; then
29 if test -d /usr/5lib ; then
31 CPPFLAGS="$CPPFLAGS -I/usr/5include"
32 LIBS="$LIBS -L/usr/5lib"
36 if test ".$ac_cv_func_initscr" != .yes ; then
41 # Check for library containing tgoto. Do this before curses library
42 # because it may be needed to link the test-case for initscr.
43 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
44 for cf_term_lib in termcap termlib unknown
46 AC_CHECK_LIB($cf_term_lib,tgoto,[break])
50 # Check for library containing initscr
51 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
52 for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown
54 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
56 test $cf_curs_lib = unknown && AC_ERROR(no curses library found)
58 LIBS="-l$cf_curs_lib $cf_save_LIBS"
59 if test "$cf_term_lib" = unknown ; then
60 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
61 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
65 AC_MSG_RESULT($cf_result)
66 test $cf_result = no && AC_ERROR(Cannot link curses library)
67 elif test "$cf_term_lib" != predefined ; then
68 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
69 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
70 [initscr(); tgoto((char *)0, 0, 0);],
73 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
74 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
79 AC_MSG_RESULT($cf_result)