1
dnl IU_LIB_NCURSES, IU_LIB_CURSES and IU_LIB_TERMCAP are:
2
dnl Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
3
dnl Written by Miles Bader <miles@gnu.ai.mit.edu>
5
dnl This program is free software; you can redistribute it and/or modify
6
dnl it under the terms of the GNU General Public License as published by
7
dnl the Free Software Foundation; either version 2, or (at your option)
10
dnl This program is distributed in the hope that it will be useful,
11
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
dnl GNU General Public License for more details.
15
dnl You should have received a copy of the GNU General Public License
16
dnl along with this program; if not, write to the Free Software
17
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
dnl IU_LIB_NCURSES -- check for, and configure, ncurses
22
dnl If libncurses is found to exist on this system and the --disable-ncurses
23
dnl flag wasn't specified, defines LIBNCURSES with the appropriate linker
24
dnl specification, and possibly defines NCURSES_INCLUDE with the appropriate
25
dnl -I flag to get access to ncurses include files.
27
AC_DEFUN([IU_LIB_NCURSES], [
28
AC_ARG_ENABLE(ncurses, [ --disable-ncurses don't prefer -lncurses over -lcurses],
30
if test "$enable_ncurses" = yes; then
31
AC_CHECK_LIB(ncurses, initscr, LIBNCURSES="-lncurses")
32
if test "$LIBNCURSES"; then
33
# Use ncurses header files instead of the ordinary ones, if possible;
34
# is there a better way of doing this, that avoids looking in specific
36
AC_ARG_WITH(ncurses-include-dir,
37
[ --with-ncurses-include-dir=DIR
38
Set directory containing the include files for
39
use with -lncurses, when it isn't installed as
40
the default curses library. If DIR is "none",
41
then no special ncurses include files are used.
42
--without-ncurses-include-dir
43
Equivalent to --with-ncurses-include-dir=none])dnl
44
if test "${with_ncurses_include_dir+set}" = set; then
45
AC_MSG_CHECKING(for ncurses include dir)
46
case "$with_ncurses_include_dir" in
48
inetutils_cv_includedir_ncurses=none;;
50
inetutils_cv_includedir_ncurses="$with_ncurses_include_dir";;
52
AC_MSG_RESULT($inetutils_cv_includedir_ncurses)
54
AC_CACHE_CHECK(for ncurses include dir,
55
inetutils_cv_includedir_ncurses,
56
for D in $includedir $prefix/include /local/include /usr/local/include /include /usr/include; do
57
if test -d $D/ncurses; then
58
inetutils_cv_includedir_ncurses="$D/ncurses"
61
test "$inetutils_cv_includedir_ncurses" \
62
|| inetutils_cv_includedir_ncurses=none
65
if test "$inetutils_cv_includedir_ncurses" = none; then
68
NCURSES_INCLUDE="-I$inetutils_cv_includedir_ncurses"
72
AC_SUBST(NCURSES_INCLUDE)
73
AC_SUBST(LIBNCURSES)])dnl
75
dnl IU_LIB_TERMCAP -- check for various termcap libraries
77
dnl Checks for various common libraries implementing the termcap interface,
78
dnl including ncurses (unless --disable ncurses is specified), curses (which
79
dnl does on some systems), termcap, and termlib. If termcap is found, then
80
dnl LIBTERMCAP is defined with the appropriate linker specification.
82
AC_DEFUN([IU_LIB_TERMCAP], [
83
AC_REQUIRE([IU_LIB_NCURSES])
84
if test "$LIBNCURSES"; then
85
LIBTERMCAP="$LIBNCURSES"
87
AC_CHECK_LIB(curses, tgetent, LIBTERMCAP=-lcurses)
88
if test "$ac_cv_lib_curses_tgetent" = no; then
89
AC_CHECK_LIB(termcap, tgetent, LIBTERMCAP=-ltermcap)
91
if test "$ac_cv_lib_termcap_tgetent" = no; then
92
AC_CHECK_LIB(termlib, tgetent, LIBTERMCAP=-ltermlib)
95
AC_SUBST(LIBTERMCAP)])dnl
97
dnl IU_LIB_CURSES -- checke for curses, and associated libraries
99
dnl Checks for varions libraries implementing the curses interface, and if
100
dnl found, defines LIBCURSES to be the appropriate linker specification,
101
dnl *including* any termcap libraries if needed (some versions of curses
102
dnl don't need termcap).
104
AC_DEFUN([IU_LIB_CURSES], [
105
AC_REQUIRE([IU_LIB_TERMCAP])
106
AC_REQUIRE([IU_LIB_NCURSES])
107
if test "$LIBNCURSES"; then
108
LIBCURSES="$LIBNCURSES" # ncurses doesn't require termcap
110
_IU_SAVE_LIBS="$LIBS"
112
AC_CHECK_LIB(curses, initscr, LIBCURSES="-lcurses")
113
if test "$LIBCURSES" -a "$LIBTERMCAP" -a "$LIBCURSES" != "$LIBTERMCAP"; then
114
AC_CACHE_CHECK(whether curses needs $LIBTERMCAP,
115
inetutils_cv_curses_needs_termcap,
117
AC_TRY_LINK([#include <curses.h>], [initscr ();],
118
[inetutils_cv_curses_needs_termcap=no],
119
[inetutils_cv_curses_needs_termcap=yes]))
120
if test $inetutils_cv_curses_needs_termcap = yes; then
121
LIBCURSES="$LIBCURSES $LIBTERMCAP"
124
LIBS="$_IU_SAVE_LIBS"
126
AC_SUBST(LIBCURSES)])dnl