File 0001-Prefer-ncurses6w.patch of Package iftop

From 5c213cce4f4a8b6a68dec4bca00e5754ff3d9e63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crodriguez@owncloud.com>
Date: Thu, 3 Jan 2019 10:13:41 -0300
Subject: [PATCH] Prefer ncurses6w.

---
 Makefile.am  |  4 +++-
 configure.ac | 60 ++--------------------------------------------------
 2 files changed, 5 insertions(+), 59 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4a5ec95..d11953b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,11 +13,13 @@
 sbin_PROGRAMS = iftop 
 #iftop-dump
 
+iftop_CFLAGS = $(NCURSES_CFLAGS) -pthread -Wall -fvisibility=hidden
 iftop_SOURCES = addr_hash.c edline.c hash.c iftop.c ns_hash.c \
                  options.c resolver.c screenfilter.c serv_hash.c \
                  sorted_list.c threadprof.c ui_common.c ui.c tui.c util.c \
 		 addrs_ioctl.c addrs_dlpi.c dlcommon.c \
-		 stringmap.c cfgfile.c vector.c
+		 stringmap.c cfgfile.c
+iftop_LDADD = $(NCURSES_LIBS)
 
 #iftop_dump_SOURCES = counter_hash.c hash.c iftop-dump.c  \
 #                 options.c \
diff --git a/configure.ac b/configure.ac
index b93a206..0d3dc55 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,7 @@ AM_INIT_AUTOMAKE
 dnl Make sure we have a C compiler....
 AC_PROG_CC
 AC_HEADER_STDC
+AC_USE_SYSTEM_EXTENSIONS
 
 dnl
 dnl Options to configure.
@@ -347,70 +348,13 @@ dnl we use the (apparently obscure) mvchgat function. Unfortunately, there's
 dnl a solid chance that mvchgat is a macro, so we can't just use
 dnl AC_SEARCH_LIBS....
 dnl
-
-AC_MSG_CHECKING([for a curses library containing mvchgat])
-oldLIBS=$LIBS
-for curseslib in ncursesw curses ncurses ; do
-    LIBS="$oldLIBS -l$curseslib"
-    AC_TRY_LINK([
-#include <$curseslib.h>
-        ], [
-        mvchgat(0, 0, 1, A_REVERSE, 0, NULL)
-        ], [
-        foundcurseslib=$curseslib
-        break
-        ])
-done
-
-if test x$foundcurseslib = x ; then
-    AC_MSG_RESULT([none found])
-    AC_MSG_ERROR([Curses! Foiled again!
-  (Can't find a curses library supporting mvchgat.)
-  Consider installing ncurses.])
-else
-    AC_MSG_RESULT([-l$foundcurseslib])
-fi
-
+PKG_CHECK_MODULES([NCURSES], [ncursesw])
 
 dnl
 dnl POSIX threads. Different systems like different combinations of flags,
 dnl libraries, etc. We use a test program to figure this stuff out.
 dnl
 
-AC_MSG_CHECKING([POSIX threads compilation])
-thrfail=1
-oldCFLAGS=$CFLAGS
-oldLIBS=$LIBS
-for flag in "" -mt -pthread -thread ; do
-    CFLAGS="$oldCFLAGS $flag"
-    for lib in "" -lpthread "-lpthread -lposix4" ; do
-        LIBS="$oldLIBS $lib"
-        AC_LINK_IFELSE([AC_LANG_SOURCE([`cat config/pthread.c`])], [
-            foundthrlib=$lib
-            foundthrflag=$flag
-            thrfail=0
-            break
-            ])
-    done
-    if test $thrfail = 0 ; then
-        break
-    fi
-done
-
-if test $thrfail = 1 ; then
-    AC_MSG_RESULT([no idea])
-    AC_MSG_ERROR([can't figure out how to compile with POSIX threads
-  If your system actually supports POSIX threads, this means we've messed up.])
-fi
-
-AC_MSG_RESULT([CFLAGS=$foundthrflag and LIBS=$foundthrlib])
-AC_MSG_CHECKING([POSIX threads usability])
-AC_RUN_IFELSE([AC_LANG_SOURCE([`cat config/pthread.c`])],
-	      [AC_MSG_RESULT([yes])],
-              [AC_MSG_ERROR(
-	       [it fails.  We probably guessed the wrong CFLAGS.])],
-	      [AC_MSG_RESULT([can't test because we are cross-compiling])])
-
 dnl
 dnl Are we on a system (like Solaris) that requires promiscuous mode in order to
 dnl see any outgoing packets?
-- 
2.19.2