From a870ca2d72e64ecc755c0fcc9676022c06257b6e Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Thu, 14 Oct 2004 21:59:00 +0000
Subject: [PATCH] simplify the curses library tests in configure.ac by checking
 for initscr() instead of tgetent() where possible

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1988 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog    | 4 ++++
 configure.ac | 9 +--------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5e0ff29c..977ec949 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -242,6 +242,10 @@ CVS code -
 	  function, set the fourth parameter to default to "no" (since
 	  it apparently only occurs on glibc 2.2.3-based systems) so
 	  that cross-compiling will work. (DLR, found by Mike Frysinger)
+	- Simplify the curses library tests by only checking for
+	  initscr(), which ncurses, curses, and pdcurses should all
+	  have, and not tgetent(), which is a termcap-specific function.
+	  (DLR)
 - nanorc.sample:
 	- Remove specific references to control key shortcuts other than
 	  XON and XOFF. (DLR)
diff --git a/configure.ac b/configure.ac
index a91ec585..b62382c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -315,15 +315,9 @@ dnl Checks for libraries.
 if eval "test x$CURSES_LIB_NAME = x"
 then
     AC_CHECK_HEADERS(curses.h ncurses.h)
-    AC_CHECK_LIB(ncurses, tgetent, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
+    AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
 fi
 
-if eval "test x$CURSES_LIB_NAME = x"
-then
-    AC_CHECK_LIB(curses, tgetent, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
-fi
-
-# Fallback for PDCurses and less useful curses libs...
 if eval "test x$CURSES_LIB_NAME = x"
 then
     AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
@@ -344,7 +338,6 @@ else
     AC_MSG_RESULT([Using $CURSES_LIB_NAME as the termcap library])
 fi
 
-
 AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors command.]))
 
 dnl Parse any configure options.
-- 
GitLab