You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.7 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../procps/procps-tinfo-linking.patch
# Copyright (C) 2014 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
Fix linking in the case libtinfo is a standalone library
In the case of top we get an error like this
------------------------------------------------------------------------
CCLD top
/bin/ld: top.o: undefined reference to symbol 'tparm'
/bin/ld: note: 'tparm' is defined in DSO /lib/libtinfo.so.5 so try adding it to the linker command line
/lib/libtinfo.so.5: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
------------------------------------------------------------------------
Before checking for ncurses we check for libtinfo and set TINFO_LIBS which
simply gets add uncondtionally because in the case libtinfo is not stand-
alone the TINFO_LIBS variable will be empty.
--- a/configure.ac
+++ b/configure.ac
@@ -128,6 +128,12 @@
if test "x$with_ncurses" = xno; then
AM_CONDITIONAL(WITH_NCURSES, false)
else
+ PKG_CHECK_MODULES([TINFO], [tinfo], [], [
+ AC_CHECK_LIB(tinfo, tparm, [have_tinfo=yes], [have_tinfo=no])
+ if test "x$have_tinfo" = xyes; then
+ TINFO_LIBS="-ltinfo"
+ fi
+ ])
PKG_CHECK_MODULES([NCURSES], [ncurses], [], [
AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
AC_CHECK_HEADERS(curses.h ncurses.h term.h, [], [have_ncurses=no], AC_INCLUDES_DEFAULT)
@@ -147,6 +153,7 @@
fi
fi
AC_SUBST([NCURSES_LIBS])
+AC_SUBST([TINFO_LIBS])
AC_SUBST([WATCH_NCURSES_LIBS])
AC_ARG_WITH([systemd],
--- a/Makefile.am
+++ b/Makefile.am
@@ -76,9 +76,9 @@
slabtop.1 \
watch.1
slabtop_SOURCES = slabtop.c $(top_srcdir)/lib/strutils.c $(top_srcdir)/lib/fileutils.c
-slabtop_LDADD = @NCURSES_LIBS@
+slabtop_LDADD = @NCURSES_LIBS@ @TINFO_LIBS@
watch_SOURCES = watch.c $(top_srcdir)/lib/strutils.c $(top_srcdir)/lib/fileutils.c
-watch_LDADD = @WATCH_NCURSES_LIBS@
+watch_LDADD = @WATCH_NCURSES_LIBS@ @TINFO_LIBS@
endif
if BUILD_SKILL
--- a/top/Makefile.am
+++ b/top/Makefile.am
@@ -19,7 +19,7 @@
dist_man_MANS = \
top.1
-top_LDADD = @NCURSES_LIBS@
+top_LDADD = @NCURSES_LIBS@ @TINFO_LIBS@
endif
EXTRA_DIST =