From 4c39f0feb06ad4a5dc0a2191b340aaa4b666760f Mon Sep 17 00:00:00 2001 From: Mats Erik Andersson Date: Wed, 14 Mar 2012 01:17:14 +0100 Subject: [PATCH] Detection of termcap and libwrap. --- ChangeLog | 12 ++++++++++++ am/libcurses.m4 | 23 +++++++++++++++-------- configure.ac | 6 ++++-- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index d1f7e040..4f22ce13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2012-03-14 Mats Erik Andersson + + Make explicit dependency on header files for libwrap and termcap. + + * am/libcurses.m4 (IU_LIB_TERMCAP): Check whether tgetent() is really + declared in , not only checking presence of . + That failing, check declaration of tgetent() using the pair , + and . 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 exists. + 2012-03-13 Mats Erik Andersson * src/traceroute.c (do_try): When displaying traces, print host name diff --git a/am/libcurses.m4 b/am/libcurses.m4 index 62c53e79..cc3a7818 100644 --- a/am/libcurses.m4 +++ b/am/libcurses.m4 @@ -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 ! +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 ]]) 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 .]) 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 .]) + AC_CHECK_DECLS([tgetent], , , [[#include +#include ]]) + 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 .]) + 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 diff --git a/configure.ac b/configure.ac index dde3d7c8..e5c303e0 100644 --- a/configure.ac +++ b/configure.ac @@ -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 .]) LIBWRAP=-lwrap fi AC_MSG_RESULT($ac_cv_lib_wrap_hosts_ctl);