--- /dev/null
+ configure.ac | 22 ++++++++++++----------
+ src/Makefile.am | 2 ++
+ 2 files changed, 14 insertions(+), 10 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 9cf6a53..7367a32 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -18,17 +18,19 @@ AC_PROG_CC
+
+ # Platform specific ncurses check.
+ AC_CANONICAL_HOST
+-AS_CASE([$host_os],
+- [darwin*],
++PKG_CHECK_MODULES([NCURSES], [ncurses], [], [
++ AS_CASE([$host_os],
++ [darwin*],
++ [
++ AC_CHECK_LIB(ncurses, killwchar, [], [AC_MSG_ERROR([Could not find ncurses library])])
++ AC_CHECK_HEADER(curses.h)
++ ],
+ [
+- AC_CHECK_LIB(ncurses, killwchar, [], [AC_MSG_ERROR([Could not find ncurses library])])
+- AC_CHECK_HEADER(curses.h)
+- ],
+- [
+- AC_CHECK_LIB(ncursesw, killwchar, [], [AC_MSG_ERROR([Could not find ncursesw library])])
+- AC_CHECK_HEADER(ncursesw/curses.h)
+- ]
+-)
++ AC_CHECK_LIB(ncursesw, killwchar, [], [AC_MSG_ERROR([Could not find ncursesw library])])
++ AC_CHECK_HEADER(ncursesw/curses.h)
++ ]
++ )
++])
+
+ # Checks for libraries.
+ AC_CHECK_LIB(m, cos, [], [AC_MSG_ERROR([Could not find m library])])
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 5765613..ee411a9 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -15,3 +15,5 @@ hh_SOURCES = \
+ hstr_regexp.c include/hstr_regexp.h \
+ radixsort.c include/radixsort.h \
+ hstr.c
++
++hh_LDADD = $(NCURSES_LIBS)
--- /dev/null
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=true
+
+inherit autotools-utils
+
+DESCRIPTION="Shell history suggest box - easily view, navigate, search and manage your command history"
+HOMEPAGE="https://github.com/dvorka/hstr http://www.mindforger.com"
+SRC_URI="https://github.com/dvorka/hstr/archive/1.17.tar.gz -> ${P}.tar.gz"
+
+SLOT="0"
+LICENSE="Apache-2.0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+RDEPEND="sys-libs/ncurses:0="
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+"
+
+PATCHES=( "${FILESDIR}"/${P}-tinfo.patch )
+
+DOCS=( CONFIGURATION.md README.md )
+
+src_prepare() {
+ sed \
+ -e 's:-O2::g' \
+ -i src/Makefile.am || die
+ autotools-utils_src_prepare
+}