]> Savannah Git Hosting - gnulib.git/commitdiff
termcap: Fix link error on AIX 7.
authorBruno Haible <bruno@clisp.org>
Sat, 3 Sep 2022 16:42:13 +0000 (18:42 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 4 Sep 2022 00:07:22 +0000 (02:07 +0200)
* m4/termcap.m4 (gl_TERMCAP_BODY): Search also for libxcurses and for
libcurses, like gl_TERMINFO_BODY does.
* m4/terminfo.m4 (gl_TERMINFO_BODY): Update platform list in comment.

ChangeLog
m4/termcap.m4
m4/terminfo.m4

index 0834c530311a5458dfa79546f2d7f11a14e1dbee..9100ca7d300209cc8e46fc021308791402106735 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-09-03  Bruno Haible  <bruno@clisp.org>
+
+       termcap: Fix link error on AIX 7.
+       * m4/termcap.m4 (gl_TERMCAP_BODY): Search also for libxcurses and for
+       libcurses, like gl_TERMINFO_BODY does.
+       * m4/terminfo.m4 (gl_TERMINFO_BODY): Update platform list in comment.
+
 2022-09-02  Bruno Haible  <bruno@clisp.org>
 
        getrandom: Fix compilation error in C++ mode on FreeBSD 12.
index 89765a5352544dc9ea43052705158694d4abce65..ce14890be5c383432c4eb4fa4599f4cb348026d3 100644 (file)
@@ -1,4 +1,4 @@
-# termcap.m4 serial 9
+# termcap.m4 serial 10
 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,
@@ -52,6 +52,14 @@ AC_DEFUN([gl_TERMCAP_BODY],
     dnl accordingly.
     AC_LIB_LINKFLAGS_BODY([termcap])
 
+    dnl Search for libxcurses and define LIBXCURSES, LTLIBXCURSES and INCXCURSES
+    dnl accordingly.
+    AC_LIB_LINKFLAGS_BODY([xcurses])
+
+    dnl Search for libcurses and define LIBCURSES, LTLIBCURSES and INCCURSES
+    dnl accordingly.
+    AC_LIB_LINKFLAGS_BODY([curses])
+
   else
 
     LIBNCURSES=
@@ -62,6 +70,14 @@ AC_DEFUN([gl_TERMCAP_BODY],
     LTLIBTERMCAP=
     INCTERMCAP=
 
+    LIBXCURSES=
+    LTLIBXCURSES=
+    INCXCURSES=
+
+    LIBCURSES=
+    LTLIBCURSES=
+    INCCURSES=
+
   fi
 
   AC_CACHE_CHECK([where termcap library functions come from], [gl_cv_termcap], [
@@ -104,6 +120,36 @@ AC_DEFUN([gl_TERMCAP_BODY],
              [[return tgetent ((char *) 0, "xterm");]])],
           [gl_cv_termcap=libtermcap])
         LIBS="$gl_save_LIBS"
+        if test "$gl_cv_termcap" != libtermcap; then
+          gl_save_LIBS="$LIBS"
+          LIBS="$LIBS $LIBXCURSES"
+          AC_LINK_IFELSE(
+            [AC_LANG_PROGRAM(
+               [[extern
+                 #ifdef __cplusplus
+                 "C"
+                 #endif
+                 int tgetent (char *, const char *);
+               ]],
+               [[return tgetent ((char *) 0, "xterm");]])],
+            [gl_cv_termcap=libxcurses])
+          LIBS="$gl_save_LIBS"
+          if test "$gl_cv_termcap" != libxcurses; then
+            gl_save_LIBS="$LIBS"
+            LIBS="$LIBS $LIBCURSES"
+            AC_LINK_IFELSE(
+              [AC_LANG_PROGRAM(
+                 [[extern
+                   #ifdef __cplusplus
+                   "C"
+                   #endif
+                   int tgetent (char *, const char *);
+                 ]],
+                 [[return tgetent ((char *) 0, "xterm");]])],
+              [gl_cv_termcap=libcurses])
+            LIBS="$gl_save_LIBS"
+          fi
+        fi
       fi
     fi
   ])
@@ -120,6 +166,16 @@ AC_DEFUN([gl_TERMCAP_BODY],
       ;;
     libtermcap)
       ;;
+    libxcurses)
+      LIBTERMCAP="$LIBXCURSES"
+      LTLIBTERMCAP="$LTLIBXCURSES"
+      INCTERMCAP="$INCXCURSES"
+      ;;
+    libcurses)
+      LIBTERMCAP="$LIBCURSES"
+      LTLIBTERMCAP="$LTLIBCURSES"
+      INCTERMCAP="$INCCURSES"
+      ;;
     "not found"*)
       LIBTERMCAP=
       LTLIBTERMCAP=
@@ -127,7 +183,7 @@ AC_DEFUN([gl_TERMCAP_BODY],
       ;;
   esac
   case "$gl_cv_termcap" in
-    libc | libncurses | libtermcap)
+    libc | libncurses | libtermcap | libxcurses | libcurses)
       AC_DEFINE([HAVE_TERMCAP], 1,
         [Define if tgetent(), tgetnum(), tgetstr(), tgetflag()
          are among the termcap library functions.])
index 7daa4d5513db93470fdd5fb8b6263d1869fea721..4e9af636996a6f90c4191564fcc2e791ad26ca1b 100644 (file)
@@ -30,7 +30,7 @@ AC_DEFUN([gl_TERMINFO_BODY],
   dnl tgetflag(), e.g. Linux (in libncurses) or Solaris (in libtermcap =
   dnl libncurses).
   dnl Some systems have them in a different library, e.g. OSF/1 (in libcurses,
-  dnl not in libtermcap) or HP-UX (in libxcurses, not in libtermcap).
+  dnl not in libtermcap) or AIX, HP-UX (in libxcurses, not in libtermcap).
   dnl Some systems, like NetBSD or BeOS, don't have these functions at all;
   dnl they have only a libtermcap.
   dnl Some systems, like BeOS, use GNU termcap, which has tparam() instead of