From c64d420f50f058c7fbea86de3b6d2084359d3bcc Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sat, 14 May 2022 21:59:58 +0200
Subject: [PATCH] termcap: Fix link error when no suitable library is found.

* m4/termcap.m4 (gl_TERMCAP_BODY): If no suitable library is found,
set LIBTERMCAP and LTLIBTERMCAP to empty.
---
 ChangeLog     | 6 ++++++
 m4/termcap.m4 | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index fe26d37618..0bd1ad0388 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-05-14  Bruno Haible  <bruno@clisp.org>
+
+	termcap: Fix link error when no suitable library is found.
+	* m4/termcap.m4 (gl_TERMCAP_BODY): If no suitable library is found,
+	set LIBTERMCAP and LTLIBTERMCAP to empty.
+
 2022-05-13  Paul Eggert  <eggert@cs.ucla.edu>
 
 	dfa: fix bug with ‘.’ and UTF-8 Hangul Syllables
diff --git a/m4/termcap.m4 b/m4/termcap.m4
index 4817b5343c..89765a5352 100644
--- a/m4/termcap.m4
+++ b/m4/termcap.m4
@@ -1,4 +1,4 @@
-# termcap.m4 serial 8
+# termcap.m4 serial 9
 dnl Copyright (C) 2000-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -120,6 +120,11 @@ AC_DEFUN([gl_TERMCAP_BODY],
       ;;
     libtermcap)
       ;;
+    "not found"*)
+      LIBTERMCAP=
+      LTLIBTERMCAP=
+      INCTERMCAP=
+      ;;
   esac
   case "$gl_cv_termcap" in
     libc | libncurses | libtermcap)
-- 
2.39.5