From c779bf5627acf1fd2b564d6df53c6271f452ca99 Mon Sep 17 00:00:00 2001
From: Martin Stjernholm <mast@lysator.liu.se>
Date: Mon, 8 Feb 1999 05:57:28 +0100
Subject: [PATCH] Check for and include libtermcap or libncurses only when
 needed.

Rev: src/modules/readline/configure.in:1.5
Rev: src/modules/readline/readlinemod.c:1.11
---
 src/modules/readline/configure.in  | 14 +++++++++++---
 src/modules/readline/readlinemod.c |  6 +-----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/modules/readline/configure.in b/src/modules/readline/configure.in
index 3f50a21743..e157085778 100644
--- a/src/modules/readline/configure.in
+++ b/src/modules/readline/configure.in
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.4 1998/09/20 08:33:42 hubbe Exp $
+# $Id: configure.in,v 1.5 1999/02/08 04:57:27 mast Exp $
 AC_INIT(readlinemod.c)
 AC_CONFIG_HEADER(readline_machine.h)
 AC_ARG_WITH(readline,[  --with(out)-readline   support command line editing],[],[with_readline=yes])
@@ -34,8 +34,16 @@ if test x$with_readline = xyes ; then
 
   if test $ac_cv_header_readline_h = yes -o $ac_cv_header_readline_readline_h = yes ; then
     if test $ac_cv_header_history_h = yes -o $ac_cv_header_history_history_h = yes -o $ac_cv_header_readline_history_h = yes ; then
-      AC_CHECK_LIB(termcap, tputs)
-      AC_CHECK_LIB(readline, readline)
+      AC_CHECK_LIB(readline, tputs, : , : )
+      if test $ac_cv_lib_readline_tputs = no ; then
+        AC_CHECK_LIB(termcap, tputs)
+        if test $ac_cv_lib_termcap_tputs = no ; then
+          AC_CHECK_LIB(ncurses, tputs)
+        fi
+      fi
+      if test $ac_cv_lib_readline_tputs = yes -o x$ac_cv_lib_termcap_tputs = xyes -o x$ac_cv_lib_ncurses_tputs = xyes ; then
+        AC_CHECK_LIB(readline, readline)
+      fi
     fi
   fi
 fi
diff --git a/src/modules/readline/readlinemod.c b/src/modules/readline/readlinemod.c
index d4658869e7..8dc9b6ab75 100644
--- a/src/modules/readline/readlinemod.c
+++ b/src/modules/readline/readlinemod.c
@@ -13,14 +13,10 @@
 #include "pike_macros.h"
 #include "threads.h"
 
-RCSID("$Id: readlinemod.c,v 1.10 1998/09/06 17:30:07 grubba Exp $");
+RCSID("$Id: readlinemod.c,v 1.11 1999/02/08 04:57:28 mast Exp $");
 
 #include <errno.h>
 
-#ifndef HAVE_LIBTERMCAP
-#undef HAVE_LIBREADLINE
-#endif
-
 #if !defined(HAVE_READLINE_H) && !defined(HAVE_READLINE_READLINE_H)
 #undef HAVE_LIBREADLINE
 #endif
-- 
GitLab