--- a/configure.in
+++ b/configure.in
@@ -40,31 +40,6 @@
 fi
 AC_DEFINE(OSTYPE, ["${OSTYPE}"], [The operating system to build for])
 
-for cursespath in /usr/include/ncurses.h /usr/local/include/ncurses.h /usr/local/include/ncurses/ncurses.h /opt/include/ncurses.h /opt/include/curses.h /usr/include/curses.h /usr/local/include/curses.h /dev/null
-do
-  test -f "${cursespath}" && break
-done
-case ${cursespath} in
-  /usr/include/*) 
-	CFLAGS="$CFLAGS -I/usr/include"
-	LDFLAGS=""
-	;;
-  /usr/local/include/ncurses/*)
-        CFLAGS="${CFLAGS} -I/usr/local/include/ncurses"
-        LDFLAGS="-L/usr/local/lib"
-        SOLLDFLAGS="-R/usr/local/lib"
-        ;;
-  /usr/local/include/*) 
-	CFLAGS="${CFLAGS} -I/usr/local/include"
-	LDFLAGS="-L/usr/local/lib"
-	SOLLDFLAGS="-R/usr/local/lib"
-	;;
-  /opt/include/*) 
-	CFLAGS="${CFLAGS} -I/opt/include"
-	LDFLAGS="-L/opt/lib"
-	SOLLDFLAGS="-R/opt/lib"
-	;;
-esac
 # add Slowlaris -R and libraries to LDFLAGS
 if test ${OSTYPE} = "solaris" ; then
 	LDFLAGS="${LDFLAGS} ${SOLLDFLAGS} -lnsl -lsocket -lkstat"
@@ -74,7 +49,12 @@
 ncurses_support="no"
 curses_support="no"
 color_support="no"
-AC_CHECK_LIB(ncurses, use_default_colors, LDFLAGS="$LDFLAGS -lncurses"; CFLAGS="$CFLAGS -D_HAVE_NCURSES -D_HAVE_NCURSES_COLOR"; color_support="yes"; ncurses_support="yes", AC_CHECK_LIB(ncurses, use_default_colors, LDFLAGS="$LDFLAGS -lncurses"; CFLAGS="$CFLAGS -D_HAVE_NCURSES"; ncurses_support="yes"; echo "NO TRANSPARENCY SUPPORT in this ncurses lib", AC_CHECK_LIB(curses, initscr, LDFLAGS="$LDFLAGS -lcurses"; CFLAGS="$CFLAGS -D_HAVE_CURSES"; curses_support="yes"; echo "NO TRANSPARENCY SUPPORT in curses lib"))) 
+PKG_CHECK_MODULES(ncurses,ncurses,
+	LIBS="$LIBS $ncurses_LIBS"
+	AC_DEFINE(HAVE_NCURSES, 1, [Define if we have ncurses])
+	AC_DEFINE(HAVE_NCURSES_COLOR, 1, [We want color])
+	color_support="yes"; ncurses_support="yes"
+	,AC_MSG_ERROR([ncurses not found]))
 
 # disable color support on Solaris for now
 if test ${OSTYPE} = "solaris" ; then
