[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
termcap: Fix link error on AIX 7
From: |
Bruno Haible |
Subject: |
termcap: Fix link error on AIX 7 |
Date: |
Sat, 03 Sep 2022 18:47:22 +0200 |
In a testdir with the termcap and terminfo modules, I get a link error on AIX 7:
xlc -q64 -qthreaded -qtls -g -L/home/haible/prefix64/lib -o test-termcap
test-termcap.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a
libtests.a -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm
ld: 0711-317 ERROR: Undefined symbol: .setupterm
ld: 0711-317 ERROR: Undefined symbol: .tigetstr
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
gmake[4]: *** [Makefile:19944: test-termcap] Error 8
The reason is that HAVE_TERMCAP gets set to 0 and HAVE_TERMINFO to 1 (due
to libxcurses, which has the setupterm() and tigetstr() functions). Thus to
make test-termcap link successfully, LIBTERMCAP needs to be set to '-lxcurses'
instead of empty. This patch achieves it: At configuration time,
checking where termcap library functions come from... not found, consider
installing GNU ncurses
becomes
checking where termcap library functions come from... libxcurses
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.
diff --git a/m4/termcap.m4 b/m4/termcap.m4
index 89765a5352..ce14890be5 100644
--- a/m4/termcap.m4
+++ b/m4/termcap.m4
@@ -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.])
diff --git a/m4/terminfo.m4 b/m4/terminfo.m4
index 7daa4d5513..4e9af63699 100644
--- a/m4/terminfo.m4
+++ b/m4/terminfo.m4
@@ -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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- termcap: Fix link error on AIX 7,
Bruno Haible <=