diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac	2018-03-19 11:04:42.000000000 +0000
+++ b/configure.ac	2022-05-31 22:18:52.959822579 +0100
@@ -51,16 +51,14 @@
 
 dnl Checks for libraries.
 dnl Replace `main' with a function in -lncurses:
-AC_CHECK_LIB(ncursesw, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncursesw"])
-if test "$ac_cv_lib_ncursesw_initscr" != yes; then
-  AC_CHECK_LIB(ncurses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncurses"])
-  if test "$ac_cv_lib_ncurses_initscr" != yes; then
-    AC_CHECK_LIB(curses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) LIBS="$LIBS -lcurses"])
-    if test "$ac_cv_lib_curses_initscr" != yes; then
-      AC_CHECK_LIB(termcap, tgetent, [AC_DEFINE(USE_CAP, 1, [Allow -mCAP environment]) LIBS="$LIBS -ltermcap"])
-    fi
-  fi
-fi
+PKG_CHECK_MODULES(
+    [NCURSES],
+    [ncurses],
+    [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment])
+     AC_DEFINE(USE_NCURSES, 1, [Use ncurses])
+     [LIBS="${LIBS} ${NCURSES_LIBS}"]
+    ]
+)
 
 AC_CHECK_LIB(iconv, iconv_open)
 
