bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

terminfo: Don't disturb the termcap module


From: Bruno Haible
Subject: terminfo: Don't disturb the termcap module
Date: Fri, 02 Sep 2022 17:27:37 +0200

A testdir that contains both the 'termcap' and 'terminfo' modules fails
to build on systems that don't have libncurses nor libtermcap:

gcc-10  -Wno-error -g -O2  -L/home/bruno/inst-x86_64-64/lib -o test-termcap 
test-termcap.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a 
libtests.a  -ltermcap 
/usr/bin/ld: cannot find -ltermcap
collect2: error: ld returned 1 exit status
make[5]: *** [Makefile:1373: test-termcap] Error 1

The cause is that while running configure, gl_TERMCAP_BODY sets
LIBTERMCAP to empty, and then later gl_TERMINFO_BODY sets
LIBTERMCAP='-ltermcap'. gl_TERMINFO_BODY needs LIBTERMCAP only for
internal purposes, whereas for gl_TERMCAP_BODY it is one of the documented
output variables.

This patch fixes it.


2022-09-02  Bruno Haible  <bruno@clisp.org>

        terminfo: Don't disturb the termcap module.
        * m4/terminfo.m4 (gl_TERMINFO_BODY): Save and restore the variables
        determined by the gl_TERMCAP_BODY macro.

diff --git a/m4/terminfo.m4 b/m4/terminfo.m4
index e923518540..7daa4d5513 100644
--- a/m4/terminfo.m4
+++ b/m4/terminfo.m4
@@ -1,4 +1,4 @@
-# terminfo.m4 serial 4
+# terminfo.m4 serial 5
 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,
@@ -45,6 +45,11 @@ AC_DEFUN([gl_TERMINFO_BODY],
   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
   AC_REQUIRE([AC_LIB_RPATH])
 
+  dnl Avoid disturbing the gl_TERMCAP_BODY macro.
+  gl_save_LIBTERMCAP="$LIBTERMCAP"
+  gl_save_LTLIBTERMCAP="$LTLIBTERMCAP"
+  gl_save_INCTERMCAP="$INCTERMCAP"
+
   if test "$gl_curses_allowed" != no; then
 
     dnl Search for libncurses and define LIBNCURSES, LTLIBNCURSES and 
INCNCURSES
@@ -398,4 +403,9 @@ AC_DEFUN([gl_TERMINFO_BODY],
       LIBS="$gl_save_LIBS"
     ])
   fi
+
+  dnl Avoid disturbing the gl_TERMCAP_BODY macro.
+  LIBTERMCAP="$gl_save_LIBTERMCAP"
+  LTLIBTERMCAP="$gl_save_LTLIBTERMCAP"
+  INCTERMCAP="$gl_save_INCTERMCAP"
 ])






reply via email to

[Prev in Thread] Current Thread [Next in Thread]