Detection of termcap and libwrap.

This commit is contained in:
Mats Erik Andersson
2012-03-14 01:17:14 +01:00
parent bc4809d686
commit 4c39f0feb0
3 changed files with 31 additions and 10 deletions

View File

@@ -1,3 +1,15 @@
2012-03-14 Mats Erik Andersson <gnu@gisladisker.se>
Make explicit dependency on header files for libwrap and termcap.
* am/libcurses.m4 (IU_LIB_TERMCAP): Check whether tgetent() is really
declared in <termcap.h>, not only checking presence of <termcap.h>.
That failing, check declaration of tgetent() using the pair <curses.h>,
and <term.h>. In case of no successful detection at all, set LIBTERMCAP
to empty.
* configure.ac (LIBWRAP): Define only if hosts_ctl() is present in
libwrap and also the header <tcpd.h> exists.
2012-03-13 Mats Erik Andersson <gnu@gisladisker.se>
* src/traceroute.c (do_try): When displaying traces, print host name

View File

@@ -80,27 +80,32 @@ dnl IU_LIB_TERMCAP -- check for various termcap libraries
dnl
dnl Checks for various common libraries implementing the termcap interface,
dnl including ncurses (unless --disable ncurses is specified), curses (which
dnl does on some systems), termcap, and termlib. If termcap is found, then
dnl does so on some systems), termcap, and termlib. If termcap is found, then
dnl LIBTERMCAP is defined with the appropriate linker specification.
dnl
dnl Solaris is known to use libtermcap for tgetent, but to declare tgetent
dnl in <term.h>!
dnl
AC_DEFUN([IU_LIB_TERMCAP], [
AC_REQUIRE([IU_LIB_NCURSES])
if test "$LIBNCURSES"; then
LIBTERMCAP="$LIBNCURSES"
else
AC_CHECK_LIB(termcap, tgetent, LIBTERMCAP=-ltermcap)
AC_CHECK_HEADERS([termcap.h])
AC_CHECK_DECLS([tgetent], , , [[#include <termcap.h>]])
if test "$ac_cv_lib_termcap_tgetent" = yes \
|| test "$ac_cv_header_termcap_h" = yes; then
&& test "$ac_cv_have_decl_tgetent" = yes; then
AC_DEFINE([HAVE_TERMCAP_TGETENT], 1,
[Define to 1 if tgetent() exists in <termcap.h>.])
else
AC_CHECK_LIB(curses, tgetent, LIBTERMCAP=-lcurses)
fi
if test "$ac_cv_lib_curses_tgetent" = yes \
&& test "$ac_cv_lib_termcap_tgetent" = no; then
AC_DEFINE([HAVE_CURSES_TGETENT], 1,
[Define to 1 if tgetent() exists in <curses.h>.])
AC_CHECK_DECLS([tgetent], , , [[#include <curses.h>
#include <term.h>]])
if test "$ac_cv_lib_curses_tgetent" = yes \
&& test "$ac_cv_have_decl_tgetent" = yes; then
AC_DEFINE([HAVE_CURSES_TGETENT], 1,
[Define to 1 if tgetent() exists in <curses.h>.])
fi
fi
if test "$ac_cv_lib_curses_tgetent" = no \
&& test "$ac_cv_lib_termcap_tgetent" = no; then
@@ -108,6 +113,8 @@ AC_DEFUN([IU_LIB_TERMCAP], [
if "$ac_cv_lib_termlib_tgetent" = yes; then
AC_DEFINE([HAVE_TERMINFO_TGETENT], 1,
[Define to 1 if tgetent() exists in libterminfo.])
else
LIBTERMCAP=
fi
fi
if test -n "$LIBTERMCAP"; then

View File

@@ -469,6 +469,7 @@ dnl See if we have libwrap.a
dnl we cannot use AC_CHECK_LIB reliably since for the wrap lib
dnl you have to define some global variables
#AC_CHECK_LIB(wrap, hosts_ctl, LIBWRAP=-lwrap)
AC_CHECK_HEADERS([tcpd.h])
AC_MSG_CHECKING(hosts_ctl in -lwrap);
save_LIBS=$LIBS
LIBS="$save_LIBS -lwrap"
@@ -476,8 +477,9 @@ dnl you have to define some global variables
hosts_ctl(), eval "ac_cv_lib_wrap_hosts_ctl=yes",
eval "ac_cv_lib_wrap_hosts_ctl=no")
LIBS=$save_LIBS
if test "$ac_cv_lib_wrap_hosts_ctl" = yes ; then
AC_DEFINE([WITH_WRAP], 1, [Define to one if you have -lwrap.])
if test "$ac_cv_lib_wrap_hosts_ctl" = yes \
&& test "$ac_cv_header_tcpd_h" = yes; then
AC_DEFINE([WITH_WRAP], 1, [Define to one if you have -lwrap and <tcpd.h>.])
LIBWRAP=-lwrap
fi
AC_MSG_RESULT($ac_cv_lib_wrap_hosts_ctl);